Skip to content

Commit e7a38ea

Browse files
chore(release): release 16.2.0 (#339)
Co-authored-by: huaweidevcloud <[email protected]>
1 parent dc82be3 commit e7a38ea

File tree

211 files changed

+1806
-1099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+1806
-1099
lines changed

CodeArts-logo.png

9.26 KB
Loading

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Modern browsers and Internet Explorer 11+.
105105

106106
## Who use it
107107

108-
<p><a href="https://devcloud.huaweicloud.com/" target="_blank" rel="noopener noreferrer"><img alt="DevCloud Logo" src="devcloud-logo.png" width="150" style="max-width:100%;"></a></p>
108+
<p><a href="https://www.huaweicloud.com/devcloud/" target="_blank" rel="noopener noreferrer"><img alt="CodeArts Logo" src="CodeArts-logo.png" width="150" style="max-width:100%;"></a></p>
109109

110110
## LICENSE
111111

README_zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ ng serve --open
107107

108108
## 谁在使用
109109

110-
<p><a href="https://devcloud.huaweicloud.com/" target="_blank" rel="noopener noreferrer"><img alt="DevCloud Logo" src="devcloud-logo.png" width="150" style="max-width:100%;"></a></p>
110+
<p><a href="https://www.huaweicloud.com/devcloud/" target="_blank" rel="noopener noreferrer"><img alt="CodeArts Logo" src="CodeArts-logo.png" width="150" style="max-width:100%;"></a></p>
111111

112112
## LICENSE
113113

devcloud-logo.png

-15.8 KB
Binary file not shown.

devui-commons/src/sidebar/sidebar.component.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<div class="sidebar-wrapper">
2-
<d-search class="sidebar-search-container" [iconPosition]="'left'" [styleType]="'gray'" [isKeyupSearch]="true"
3-
[placeholder]="searchPlaceholder" (searchFn)="onSearch($event)"></d-search>
2+
<d-search
3+
class="sidebar-search-container"
4+
[iconPosition]="'left'"
5+
[styleType]="'gray'"
6+
[isKeyupSearch]="true"
7+
[placeholder]="searchPlaceholder"
8+
(searchFn)="onSearch($event)"
9+
></d-search>
410
<ul class="sidebar-menu" [ngClass]="{'sidebar-menu-design': !sideMenuList.length}">
511
<li *ngFor="let item of sideMenuList" class="sidebar-menu-item" routerLinkActive="sidebar-menu-item-selected">
612
<a *ngIf="item.linkType === 'routerLink'" [routerLink]="item.path">
@@ -12,8 +18,7 @@
1218
</li>
1319
</ul>
1420
<nav class="sidebar-nav">
15-
<d-accordion [data]="componentsDataDisplay" [linkType]="linkType" [itemTemplate]="itemtemplate"
16-
(itemClick)="handleResetPage()" [linkDefaultTarget]="linkDefaultTarget"></d-accordion>
21+
<d-accordion [data]="componentsDataDisplay" [linkType]="linkType" [itemTemplate]="itemtemplate" (itemClick)="handleResetPage()" [linkDefaultTarget]="linkDefaultTarget"></d-accordion>
1722
<ng-template #itemtemplate let-item="item">
1823
{{ item.title }}
1924
<d-tag *ngIf="item.newChange" [tag]="text.new" [labelStyle]="'update-custom'"></d-tag>
@@ -40,4 +45,4 @@
4045
</a>
4146
</div>
4247
</div>
43-
</div>
48+
</div>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:host {
2+
display: block;
3+
width: 100%;
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'd-alert-carousel-item',
5+
styleUrls: ['./alert-carousel-item.component.scss'],
6+
template: `<ng-content></ng-content>`,
7+
preserveWhitespaces: false,
8+
})
9+
export class AlertCarouselItemComponent {}

devui/alert/alert.component.html

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
<div class="devui-alert devui-alert-{{ type }} {{ cssClass }}" *ngIf="!hide">
2-
<div class="devui-close" (click)="close()" *ngIf="closeable">
3-
<svg
4-
width="10px"
5-
height="10px"
6-
viewBox="0 0 10 10"
7-
version="1.1"
8-
xmlns="http://www.w3.org/2000/svg"
9-
xmlns:xlink="http://www.w3.org/1999/xlink"
10-
>
11-
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
12-
<g transform="translate(-3.000000, -3.000000)" fill-rule="nonzero">
13-
<path
14-
d="M11.6426,3.19816936 C11.9239974,2.91574512 12.4131626,2.93784891 12.7352108,3.24751057 C13.0571998,3.5572302 13.0901298,4.03723416 12.8087324,4.31965839 L9.14064666,7.99900183 L12.8087324,11.6803416 C13.0645482,11.9370909 13.0605893,12.3571292 12.8158402,12.6640749 L12.7352108,12.7524894 C12.4131626,13.0621511 11.9239974,13.0842548 11.6426,12.8018306 L8,9.14489021 L4.35740003,12.8018306 C4.10158422,13.05858 3.6740594,13.0636532 3.35648225,12.8298003 L3.26478919,12.7524894 C2.94280021,12.4427698 2.90987023,11.9627658 3.19126762,11.6803416 L6.8583349,7.99900183 L3.19126762,4.31965839 C2.93545181,4.06290908 2.93941068,3.64287076 3.18415975,3.3359251 L3.26478919,3.24751057 C3.58683735,2.93784891 4.07600264,2.91574512 4.35740003,3.19816936 L8,6.85411161 L11.6426,3.19816936 Z"
15-
></path>
16-
</g>
17-
</g>
18-
</svg>
19-
</div>
202
<span class="devui-alert-icon" *ngIf="showIcon !== false && type !== 'simple'">
213
<svg
224
width="16px"
@@ -76,5 +58,55 @@
7658
</g>
7759
</svg>
7860
</span>
79-
<ng-content></ng-content>
61+
<div class="devui-alert-carousel-container">
62+
<div
63+
#carouselContainer
64+
class="devui-alert-carousel-box"
65+
(mouseenter)="clearScheduledTransition()"
66+
(mouseleave)="autoScheduleTransition()"
67+
>
68+
<ng-content></ng-content>
69+
</div>
70+
</div>
71+
<div class="devui-alert-operation-container">
72+
<div *ngIf="carouselNum > 1" class="devui-alert-carousel-num">
73+
<span>{{ currentIndex }}/{{ carouselNum }}</span>
74+
<span class="devui-alert-carousel-button" (click)="next()">
75+
<svg
76+
width="12px"
77+
height="12px"
78+
viewBox="0 0 16 16"
79+
version="1.1"
80+
xmlns="http://www.w3.org/2000/svg"
81+
xmlns:xlink="http://www.w3.org/1999/xlink"
82+
>
83+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
84+
<path
85+
d="M2.64644661,5.14644661 C2.82001296,4.97288026 3.08943736,4.95359511 3.2843055,5.08859116 L3.35355339,5.14644661 L7.999,9.793 L12.6464466,5.14644661 C12.820013,4.97288026 13.0894374,4.95359511 13.2843055,5.08859116 L13.3535534,5.14644661 C13.5271197,5.32001296 13.5464049,5.58943736 13.4114088,5.7843055 L13.3535534,5.85355339 L8.35355339,10.8535534 C8.17998704,11.0271197 7.91056264,11.0464049 7.7156945,10.9114088 L7.64644661,10.8535534 L2.64644661,5.85355339 C2.45118446,5.65829124 2.45118446,5.34170876 2.64644661,5.14644661 Z"
86+
fill-rule="nonzero"
87+
></path>
88+
</g>
89+
</svg>
90+
</span>
91+
</div>
92+
<ng-template [ngTemplateOutlet]="operationTemplate" [ngTemplateOutletContext]="{ close: close }"> </ng-template>
93+
<div class="devui-close" (click)="close()" *ngIf="closeable">
94+
<svg
95+
width="10px"
96+
height="10px"
97+
viewBox="0 0 10 10"
98+
version="1.1"
99+
xmlns="http://www.w3.org/2000/svg"
100+
xmlns:xlink="http://www.w3.org/1999/xlink"
101+
>
102+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
103+
<g transform="translate(-3.000000, -3.000000)" fill-rule="nonzero">
104+
<path
105+
d="M11.6426,3.19816936 C11.9239974,2.91574512 12.4131626,2.93784891 12.7352108,3.24751057 C13.0571998,3.5572302 13.0901298,4.03723416 12.8087324,4.31965839 L9.14064666,7.99900183 L12.8087324,11.6803416 C13.0645482,11.9370909 13.0605893,12.3571292 12.8158402,12.6640749 L12.7352108,12.7524894 C12.4131626,13.0621511 11.9239974,13.0842548 11.6426,12.8018306 L8,9.14489021 L4.35740003,12.8018306 C4.10158422,13.05858 3.6740594,13.0636532 3.35648225,12.8298003 L3.26478919,12.7524894 C2.94280021,12.4427698 2.90987023,11.9627658 3.19126762,11.6803416 L6.8583349,7.99900183 L3.19126762,4.31965839 C2.93545181,4.06290908 2.93941068,3.64287076 3.18415975,3.3359251 L3.26478919,3.24751057 C3.58683735,2.93784891 4.07600264,2.91574512 4.35740003,3.19816936 L8,6.85411161 L11.6426,3.19816936 Z"
106+
></path>
107+
</g>
108+
</g>
109+
</svg>
110+
</div>
111+
</div>
80112
</div>

devui/alert/alert.component.scss

Lines changed: 80 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@
1616
border-radius: $devui-border-radius;
1717
word-break: normal;
1818
word-wrap: break-word;
19-
20-
.devui-close {
21-
color: $devui-text;
22-
opacity: 1;
23-
line-height: 26px;
24-
height: 24px;
25-
26-
& > svg path {
27-
fill: $devui-light-text;
28-
}
29-
30-
span {
31-
color: $devui-text;
32-
font-size: $devui-font-size;
33-
font-weight: bold;
34-
}
35-
}
19+
display: flex;
20+
flex-wrap: nowrap;
21+
align-items: center;
3622

3723
&.devui-alert-success {
3824
background-color: $devui-success-bg;
@@ -93,6 +79,10 @@
9379
}
9480
}
9581

82+
.devui-alert-icon {
83+
padding-right: 8px;
84+
}
85+
9686
svg.devui-icon {
9787
width: 16px;
9888
height: 16px;
@@ -151,8 +141,78 @@
151141
}
152142
}
153143
}
154-
}
155144

156-
.devui-alert-icon {
157-
margin-right: 4px;
145+
.devui-alert-carousel-container {
146+
flex-grow: 1;
147+
flex-shrink: 0;
148+
height: 24px;
149+
overflow: hidden;
150+
151+
.devui-alert-carousel-box {
152+
position: relative;
153+
left: 0;
154+
top: 0;
155+
}
156+
}
157+
158+
.devui-alert-operation-container {
159+
flex-grow: 0;
160+
flex-shrink: 1;
161+
display: flex;
162+
align-items: center;
163+
justify-content: flex-end;
164+
height: 24px;
165+
min-width: 200px;
166+
167+
.devui-alert-carousel-num {
168+
padding-right: 8px;
169+
}
170+
171+
.devui-alert-carousel-button {
172+
margin-left: 8px;
173+
display: inline-flex;
174+
align-items: center;
175+
justify-content: center;
176+
width: 24px;
177+
height: 16px;
178+
line-height: 16px;
179+
vertical-align: middle;
180+
background-color: transparent;
181+
text-align: center;
182+
border-radius: $devui-border-radius;
183+
cursor: pointer;
184+
185+
svg path {
186+
fill: $devui-text;
187+
}
188+
189+
&:hover {
190+
background-color: $devui-shape-icon-fill-hover;
191+
192+
svg path {
193+
fill: $devui-light-text;
194+
}
195+
}
196+
}
197+
}
198+
199+
.devui-close {
200+
flex-grow: 0;
201+
flex-shrink: 1;
202+
color: $devui-text;
203+
opacity: 1;
204+
line-height: 26px;
205+
height: 24px;
206+
padding-left: 8px;
207+
208+
& > svg path {
209+
fill: $devui-light-text;
210+
}
211+
212+
span {
213+
color: $devui-text;
214+
font-size: $devui-font-size;
215+
font-weight: bold;
216+
}
217+
}
158218
}

devui/alert/alert.component.ts

Lines changed: 85 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import {
2+
AfterViewInit,
23
Component,
3-
4+
ContentChildren,
5+
ElementRef,
46
EventEmitter,
57
Input,
6-
Output
8+
OnChanges,
9+
OnDestroy,
10+
Output,
11+
QueryList,
12+
Renderer2,
13+
SimpleChanges,
14+
TemplateRef,
15+
ViewChild
716
} from '@angular/core';
17+
import { AlertCarouselItemComponent } from './alert-carousel-item.component';
818
import { AlertType } from './alert.types';
919

1020
@Component({
@@ -13,26 +23,89 @@ import { AlertType } from './alert.types';
1323
styleUrls: ['./alert.component.scss'],
1424
preserveWhitespaces: false,
1525
})
16-
export class AlertComponent {
26+
export class AlertComponent implements OnChanges, OnDestroy, AfterViewInit {
1727
@Input() type: AlertType = 'info';
1828
@Input() cssClass: string;
1929
@Input() closeable = true;
20-
/**
21-
* @deprecated
22-
*/
23-
@Input() content: HTMLElement | string;
2430
@Input() showIcon = true;
25-
@Output() closeEvent = new EventEmitter<AlertComponent>();
26-
@Input() set dismissTime(time) {
31+
@Input() autoplay = false;
32+
@Input() autoplaySpeed = 3000;
33+
@Input() transitionSpeed = 500;
34+
@Input() operationTemplate: TemplateRef<any>;
35+
@Input() set dismissTime(time: number) {
2736
setTimeout(() => {
2837
this.close();
2938
}, time);
3039
}
31-
40+
@Output() closeEvent = new EventEmitter<AlertComponent>();
41+
@ViewChild('carouselContainer') box: ElementRef<any>;
42+
@ContentChildren(AlertCarouselItemComponent) carouselItems: QueryList<AlertCarouselItemComponent>;
3243
hide = false;
44+
carouselNum: number;
45+
currentIndex = 1;
46+
scheduledId: any;
47+
48+
constructor(private renderer: Renderer2) {}
49+
50+
ngOnChanges(changes: SimpleChanges) {
51+
const { autoplay, autoplaySpeed, transitionSpeed } = changes;
52+
if ((autoplay || autoplaySpeed) && (!this.autoplay || !this.autoplaySpeed)) {
53+
this.clearScheduledTransition();
54+
} else {
55+
this.autoScheduleTransition();
56+
}
57+
if (transitionSpeed && this.transitionSpeed) {
58+
this.renderer.setStyle(this.box.nativeElement, 'transition', `top ${this.transitionSpeed}ms ease`);
59+
}
60+
}
61+
62+
ngAfterViewInit(): void {
63+
this.renderCarouselItem();
64+
this.carouselItems.changes.subscribe(() => this.renderCarouselItem());
65+
}
66+
67+
ngOnDestroy() {
68+
this.clearScheduledTransition();
69+
}
3370

34-
close() {
71+
renderCarouselItem() {
72+
this.carouselNum = this.carouselItems.length;
73+
if (this.carouselNum) {
74+
this.renderer.setStyle(this.box.nativeElement, 'transition', `top ${this.transitionSpeed}ms ease`);
75+
this.autoScheduleTransition();
76+
}
77+
}
78+
79+
next = (): void => {
80+
if (this.currentIndex < this.carouselNum) {
81+
this.currentIndex++;
82+
} else {
83+
this.currentIndex = 1;
84+
}
85+
this.translatePosition(this.currentIndex - 1);
86+
this.autoScheduleTransition();
87+
};
88+
89+
autoScheduleTransition() {
90+
this.clearScheduledTransition();
91+
if (this.autoplay && this.autoplaySpeed) {
92+
this.scheduledId = setTimeout(() => this.next(), this.autoplaySpeed);
93+
}
94+
}
95+
96+
clearScheduledTransition() {
97+
if (this.scheduledId) {
98+
clearTimeout(this.scheduledId);
99+
this.scheduledId = undefined;
100+
}
101+
}
102+
103+
translatePosition(size: number) {
104+
this.renderer.setStyle(this.box.nativeElement, 'top', `${-size * 100}%`);
105+
}
106+
107+
close = (): void => {
35108
this.closeEvent.emit(this);
36109
this.hide = true;
37-
}
110+
};
38111
}

0 commit comments

Comments
 (0)