Skip to content

Commit 65425bb

Browse files
chore(release): release 11.0.0 (#91)
Co-authored-by: huaweidevcloud <[email protected]>
1 parent de24f29 commit 65425bb

File tree

985 files changed

+19606
-11258
lines changed

Some content is hidden

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

985 files changed

+19606
-11258
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To see more in [devui.design](https://devui.design/home).
2323

2424
## Angular Support
2525

26-
Now supports Angular <font color=red>`^10.0.0`</font>
26+
Now supports Angular <font color=red>`^11.0.0`</font>
2727

2828
## Getting Started
2929

README_zh_CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DevUI Design设计系统包含了DevUI规则、设计语言和最佳实践的资
2323

2424
## Angular版本
2525

26-
当前支持的angular版本<font color=red>`^10.0.0`</font>
26+
当前支持的angular版本<font color=red>`^11.0.0`</font>
2727

2828
## 快速开始
2929

angular.json

+12-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
"build": {
1414
"builder": "@angular-builders/custom-webpack:browser",
1515
"options": {
16+
"allowedCommonJsDependencies": [
17+
"date-fns",
18+
"highlight.js",
19+
"codemirror",
20+
"xss",
21+
"enquire.js"
22+
],
1623
"customWebpackConfig": {
1724
"path": "scripts/extra-webpack.config.js"
1825
},
@@ -23,7 +30,8 @@
2330
"tsConfig": "src/tsconfig.app.json",
2431
"assets": [
2532
"src/favicon.ico",
26-
"src/assets"
33+
"src/assets",
34+
"src/assets/i18n"
2735
],
2836
"styles": [
2937
"node_modules/highlight.js/styles/an-old-hope.css",
@@ -103,7 +111,8 @@
103111
"scripts": [],
104112
"assets": [
105113
"src/favicon.ico",
106-
"src/assets"
114+
"src/assets",
115+
"src/assets/i18n"
107116
]
108117
}
109118
},
@@ -156,7 +165,7 @@
156165
"prefix": "lib",
157166
"architect": {
158167
"build": {
159-
"builder": "@angular-devkit/build-ng-packagr:build",
168+
"builder": "@angular-devkit/build-angular:ng-packagr",
160169
"options": {
161170
"tsConfig": "devui/tsconfig.lib.json",
162171
"project": "devui/ng-package.json"

devui/accordion/accordion-list.component.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { Component, Host, Input, OnDestroy, OnInit, Optional, QueryList, SkipSelf, ViewChildren, ViewEncapsulation } from '@angular/core';
1+
import {
2+
Component, Host, HostBinding, Input, OnDestroy, OnInit,
3+
Optional, QueryList, SkipSelf, ViewChildren, ViewEncapsulation
4+
} from '@angular/core';
25
import { AccordionItemRouterlinkComponent } from './accordion-item-routerlink.component';
36
import { AccordionMenuComponent } from './accordion-menu.component';
47
import { AccordionComponent } from './accordion.component';
@@ -18,7 +21,6 @@ export class AccordionListComponent implements OnInit, OnDestroy {
1821
@ViewChildren(AccordionItemRouterlinkComponent) accordionItemRouterlinkQueryList: QueryList<AccordionItemRouterlinkComponent>;
1922
constructor(@Optional() @Host() @SkipSelf() private parentComponent: AccordionMenuComponent,
2023
private accordion: AccordionComponent) {}
21-
2224
ngOnInit(): void {
2325
if (this.parentComponent) {
2426
setTimeout(() => {this.parentComponent.accordionListFromView = this; });
@@ -30,6 +32,10 @@ export class AccordionListComponent implements OnInit, OnDestroy {
3032
}
3133
}
3234

35+
@HostBinding('class.devui-accordion-show-animate') get animateState() {
36+
return this.accordion.showAnimation;
37+
}
38+
3339
get loading() {
3440
return this.parent && this.parent[this.accordion.loadingKey];
3541
}

devui/accordion/accordion-menu.component.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
</div>
4141
<d-accordion-list
4242
class="devui-accordion-submenu"
43-
[ngClass]="{ 'devui-accordion-menu-hidden': !open }"
43+
[@collapseState]="!showAnimate ? '' : open ? 'expanded' : 'collapsed'"
44+
[ngClass]="{ 'devui-accordion-menu-hidden': !open && !showAnimate }"
4445
[deepth]="deepth + 1"
4546
[data]="children"
4647
[parent]="item"

devui/accordion/accordion-menu.component.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { Component, HostBinding, ViewEncapsulation } from '@angular/core';
2+
import { collapseMotion } from 'ng-devui/utils';
23
import { AccordionBaseComponent } from './accordion-base-component.class';
34
import { AccordionListComponent } from './accordion-list.component';
45
import { AccordionComponent } from './accordion.component';
56
import { AccordionBaseMenu, AccordionMenuItem } from './accordion.type';
6-
77
@Component({
88
selector: 'd-accordion-menu',
99
templateUrl: './accordion-menu.component.html',
1010
encapsulation: ViewEncapsulation.None,
1111
preserveWhitespaces: false,
12+
animations: [collapseMotion]
1213
})
1314
export class AccordionMenuComponent extends AccordionBaseComponent<AccordionBaseMenu<AccordionMenuItem>> {
1415
@HostBinding('class.devui-accordion-menu-item')
@@ -20,6 +21,10 @@ export class AccordionMenuComponent extends AccordionBaseComponent<AccordionBase
2021
return this.accordion.menuItemTemplate;
2122
}
2223

24+
get showAnimate() {
25+
return this.accordion.showAnimation;
26+
}
27+
2328
@HostBinding('class.open')
2429
get open() {
2530
return (this.keyOpen === undefined && this.accordion.autoOpenActiveMenu)

devui/accordion/accordion.component.scss

+41-8
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@
107107
}
108108
}
109109

110+
:host ::ng-deep .devui-accordion-menu-item {
111+
overflow-y: hidden;
112+
}
113+
110114
/* 展开图标相关 */
111115
:host ::ng-deep .devui-accordion-menu-item > .devui-accordion-item-title {
112116
position: relative;
@@ -187,17 +191,46 @@
187191
}
188192
}
189193

194+
.devui-accordion-splitter::before {
195+
content: '';
196+
display: block;
197+
width: 2px;
198+
height: 18px;
199+
background-color: $devui-form-control-line-active;
200+
position: absolute;
201+
top: 11px;
202+
left: 0;
203+
opacity: 0;
204+
}
205+
190206
&.devui-router-active,
191207
&.active {
192208
&:not(.open) .devui-accordion-splitter::before {
193-
content: '';
194-
display: block;
195-
width: 2px;
196-
height: 18px;
197-
background: $devui-form-control-line-active;
198-
position: absolute;
199-
top: 11px;
200-
left: 0;
209+
opacity: 1;
210+
}
211+
}
212+
}
213+
214+
:host ::ng-deep .devui-accordion-show-animate .devui-accordion-item-title {
215+
transition: font-weight ease-in-out 0.3s;
216+
217+
&:not(.disabled) {
218+
&.devui-router-active,
219+
&.active:not(.open) {
220+
transition: font-weight ease-in-out 0.3s;
221+
}
222+
}
223+
224+
.devui-accordion-splitter::before {
225+
transform: scaleY(0);
226+
transition: transform 0.3s ease-in-out;
227+
}
228+
229+
&.devui-router-active,
230+
&.active {
231+
&:not(.open) .devui-accordion-splitter::before {
232+
transform: scaleY(1);
233+
transition: transform 0.3s ease-in-out;
201234
}
202235
}
203236
}

devui/accordion/accordion.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, TemplateRef } from '@angular/core';
22
import { I18nInterface, I18nService } from 'ng-devui/i18n';
33
import { Subscription } from 'rxjs';
4-
import { AccordionItemClickEvent, AccordionMenuToggleEvent, AccordionMenuType, AccordionOptions} from './accordion.type';
5-
4+
import { AccordionItemClickEvent, AccordionMenuToggleEvent, AccordionMenuType, AccordionOptions } from './accordion.type';
65
@Component({
76
selector: 'd-accordion',
87
templateUrl: './accordion.component.html',
@@ -43,11 +42,11 @@ export class AccordionComponent implements AccordionOptions, OnChanges, OnInit,
4342
@Input() linkDefaultTarget = '_self'; // 不设置target的时候target默认值
4443

4544
@Input() accordionType: 'normal' | 'embed' = 'normal';
45+
@Input() showAnimation = true;
4646

4747
activeItem; // 记录用户点击的激活菜单项
4848
i18nCommonText: I18nInterface['common'];
4949
i18nSubscription: Subscription;
50-
5150
constructor(private i18n: I18nService) {
5251
}
5352

devui/accordion/demo/basic/basic.component.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77
(activeItemChange)="log($event)"
88
[accordionType]="accordionTypeEmbed ? 'embed' : 'normal'"
99
></d-accordion>
10-
<div class="option"><d-toggle [(ngModel)]="restrictOneOpen"></d-toggle> 限制只能展开一个一级菜单</div>
11-
<div class="option"><d-toggle [(ngModel)]="accordionTypeEmbed"></d-toggle> 内嵌菜单形式(无阴影)</div>
10+
<div class="option">
11+
<d-toggle [(ngModel)]="restrictOneOpen"></d-toggle> Only one level-1 menu can be expanded.<!--限制只能展开一个一级菜单-->
12+
</div>
13+
<div class="option"><d-toggle [(ngModel)]="accordionTypeEmbed"></d-toggle> Embedded menu (no shadow)<!--内嵌菜单形式(无阴影)--></div>

devui/accordion/demo/basic/basic.component.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ export class BasicComponent {
99
restrictOneOpen = false;
1010
accordionTypeEmbed = false;
1111
menu = [{
12-
title: '内容一',
12+
title: 'Content 1',
1313
children: [
14-
{title: '子内容1'},
15-
{title: '子内容2'},
16-
{title: '子内容3'},
14+
{title: 'Child Content 1'},
15+
{title: 'Child Content 2'},
16+
{title: 'Child Content '},
1717
]
1818
}, {
19-
title: '内容二(超长长长长长长长长长长长长长长内容测试)',
19+
title: 'Content 2(This is a long sentence for option display.)',
2020
children: [
21-
{title: '子内容1(超长长长长长长长长长长长长长长内容测试'},
22-
{title: '子内容2'},
23-
{title: '子内容3'},
21+
{title: 'Child Content 1 (This is a long sentence for option display.)'},
22+
{title: 'Child Content 2'},
23+
{title: 'Child Content 3'},
2424
]
2525
}, {
26-
title: '内容三(默认展开)',
26+
title: 'Content 3 (Default Open)',
2727
open: true,
2828
children: [
29-
{title: '子内容1(禁用)', disabled: true},
30-
{title: '子内容2(默认激活)', active: true},
31-
{title: '子内容3'},
29+
{title: 'Child Content 1 (Disabled)', disabled: true},
30+
{title: 'Child Content 2 (Default Active)', active: true},
31+
{title: 'Child Content 3'},
3232
]
3333
}, {
34-
title: '内容四(没有子项)',
34+
title: 'Content 4 (No Child)',
3535
children: []
3636
}, {
37-
title: '内容五(禁用)',
37+
title: 'Content 5 (Disabled)',
3838
disabled: true,
3939
children: [
4040
]
4141
}, {
42-
title: '内容六(动态加载)',
42+
title: 'Content 6 (Dynamic Content)',
4343
needLoadChildren: true,
4444
loading: false,
4545
children: [
@@ -56,8 +56,8 @@ export class BasicComponent {
5656
event.item.loading = true;
5757
setTimeout(() => {
5858
event.item.children = [
59-
{title: '子内容1'},
60-
{title: '子内容2'}
59+
{title: 'Child Content 1'},
60+
{title: 'Child Content 2'}
6161
];
6262
event.item.needLoadChildren = false;
6363
event.item.loading = false;

devui/accordion/demo/change-key/change-key.component.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ export class ChangeKeyComponent {
1414
childrenKey: 'subs',
1515
};
1616
menu = [{
17-
value: '内容一',
17+
value: 'Content 1',
1818
}, {
19-
value: '内容二(展开)',
19+
value: 'Content 2 (expended)',
2020
$show: true,
2121
subs: [
22-
{value: '子内容1(禁用)', forbidden: true},
23-
{value: '子内容2(选中)', $selected: true},
24-
{value: '子内容3'},
22+
{ value: 'Child Content 1 (disabled)', forbidden: true },
23+
{ value: 'Child Content 2 (active)', $selected: true },
24+
{ value: 'Child Content 3' },
2525
]
2626
}];
2727
}

devui/accordion/demo/inner-list-template/inner-list-template.component.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'd-inner-list-template',
@@ -7,13 +7,13 @@ import { Component, OnInit } from '@angular/core';
77
})
88
export class InnerListTemplateComponent {
99
menu = [{
10-
title: '内容一',
10+
title: 'Content 1',
1111
children: [],
12-
content: '内容一的内容'
12+
content: 'Child Content of Content 1'
1313
}, {
14-
title: '内容二',
14+
title: 'Content 2',
1515
children: [],
16-
content: '内容二的内容'
16+
content: 'Child Content of Content 2'
1717
}];
1818

1919
itemClick(event) {

devui/accordion/demo/link/link.component.css

+4
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@
3232
width: 80%;
3333
}
3434
}
35+
36+
.menu-wrapper > div {
37+
margin-bottom: 8px;
38+
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<div class="menu-wrapper">
2-
<div>路由链接(推荐使用)</div>
2+
<div>router link (recommended)<!--路由链接(推荐使用)--></div>
33
<d-accordion [data]="menu" class="menu" [linkType]="'routerLink'"></d-accordion>
44
</div>
55
<div class="menu-wrapper">
6-
<div>原生超链接(涉及跨站场景使用)</div>
7-
<d-accordion [data]="menu2" class="menu" [linkType]="'hrefLink'" [linkDefaultTarget]="'_self'"></d-accordion>
6+
<div>original hyperlink (cross site scene)<!--原生超链接(涉及跨站场景使用)--></div>
7+
<d-accordion [data]="menu2" class="menu" [linkType]="'hrefLink'" [linkDefaultTarget]="'self'"></d-accordion>
88
</div>
99
<div class="menu-wrapper">
10-
<div>混合链接(部分涉及跨站场景使用)</div>
11-
<d-accordion [data]="menu3" class="menu" [linkType]="'dependOnLinkTypeKey'"></d-accordion>
10+
<div>mix link (partial cross site scene) (<!--混合链接(部分涉及跨站场景使用)--></div>
11+
<d-accordion [data]="menu3" class="menu" [linkType]="'dependOnLinkTypeKey'" [showAnimation]="false"></d-accordion>
1212
</div>

0 commit comments

Comments
 (0)