Skip to content

Commit cc77ca4

Browse files
chore(release): release 11.3.0 (#119)
Co-authored-by: huaweidevcloud <[email protected]>
1 parent a7c549f commit cc77ca4

File tree

368 files changed

+5793
-2441
lines changed

Some content is hidden

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

368 files changed

+5793
-2441
lines changed

devui-commons/src/devui-commons.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export class DevuiCommonsService {
1818
this._eventBus = new Subject<CommonsEvent>();
1919
}
2020

21-
broadcast(key: any, data?: any) {
21+
broadcast(key: any, data?: any): void {
2222
this._eventBus.next({key, data});
2323
}
2424

2525
on<T>(key: any): Observable<T> {
2626
return this._eventBus.asObservable().pipe(
2727
filter(event => event.key === key),
2828
map(event => <T>event.data)
29-
)
29+
);
3030
}
3131
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export interface UserInfo {
22
displayNameCn: string;
3-
uid?:string;
3+
uid?: string;
44
employeeNumber: string;
5-
iconUrl:string;
6-
docCount?:number;
7-
questionCount?:number;
8-
draftCount?:number;
9-
};
5+
iconUrl: string;
6+
docCount?: number;
7+
questionCount?: number;
8+
draftCount?: number;
9+
}

devui-commons/src/header/ecosystem/ecosystem.component.html

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
>
88
<span dDropDownToggle class="drop-down-span"
99
>{{curLanguage === 'zh-cn' ? '生态' : 'Ecology'}}
10+
<span class="devui-header-open-icon">
11+
<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
12+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13+
<polygon
14+
transform="translate(8.000000, 8.000000) scale(1, -1) rotate(-360.000000) translate(-8.000000, -8.000000) "
15+
points="4 5.5 12 5.5 8 10.5"
16+
></polygon>
17+
</g>
18+
</svg>
19+
</span>
1020
</span>
1121
<ul dDropDownMenu class="dropdown-menu devui-dropdown-menu devui-scrollbar" role="menu">
1222
<li role="menuitem" class="menuitem" *ngFor="let nav of navs">

devui-commons/src/header/ecosystem/ecosystem.component.scss

+29
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,32 @@ a {
1515
color: $devui-list-item-hover-text;
1616
}
1717
}
18+
19+
.g-dropdown {
20+
.devui-header-open-icon {
21+
display: inline-block;
22+
text-indent: 0;
23+
pointer-events: none; /* 让鼠标穿透 */
24+
width: 16px;
25+
height: 16px;
26+
line-height: 16px;
27+
transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
28+
transform-origin: center;
29+
vertical-align: text-top;
30+
31+
& > svg {
32+
width: 16px;
33+
height: 16px;
34+
35+
polygon {
36+
fill: $devui-text-weak;
37+
}
38+
}
39+
}
40+
41+
&:not(.devui-dropdown-open) {
42+
.devui-header-open-icon {
43+
transform: rotate(-180deg);
44+
}
45+
}
46+
}

devui-commons/src/header/ecosystem/ecosystem.component.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, Input, OnInit, TemplateRef } from '@angular/core';
22
import { DevuiCommonsService } from '../../devui-commons.service';
3+
import { I18nUtil } from '../../i18n/i18n.util';
34

45
@Component({
56
selector: 'd-ecosystem',
@@ -12,12 +13,12 @@ export class EcosystemComponent implements OnInit {
1213

1314
constructor(private commonsService: DevuiCommonsService) { }
1415

15-
ngOnInit() {
16-
this.curLanguage = localStorage.getItem('lang') || 'zh-cn';
16+
ngOnInit(): void {
17+
this.curLanguage = I18nUtil.getCurrentLanguage();
1718
this.commonsService.on('languageEvent').subscribe(term => this.changeLanguage(term));
1819
}
1920

20-
changeLanguage(lang) {
21+
changeLanguage(lang): void {
2122
this.curLanguage = lang;
2223
}
2324

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'header-maxwidth': hasMaxWidth
99
}">
1010
<div class="header-left">
11-
<div *ngIf="showSlideButton" class="slide-menu-link" (click)="clickSlideMenu($event)">
11+
<div *ngIf="showSlideButton" class="slide-menu-link" (click)="clickSlideMenu()">
1212
<span></span>
1313
</div>
1414
<ng-content select="d-header-logo"></ng-content>
@@ -22,7 +22,7 @@
2222
<ng-content select="d-header-language-switch"></ng-content>
2323
<div *ngIf="showGitStar">
2424
<iframe class="header-gitStar"
25-
src="https://ghbtns.com/github-btn.html?user=DevCloudFE&repo=ng-devui&type=star&count=true"
25+
[attr.src]="repoLink"
2626
></iframe>
2727
</div>
2828
<div *ngIf="showAvatar" class="header-avatar">

devui-commons/src/header/header.component.scss

+7-12
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
.fixed-wapper {
5252
width: 100%;
5353
z-index: 1;
54+
position: absolute;
55+
top: 0;
5456
}
5557

5658
.header-wapper {
@@ -59,6 +61,7 @@
5961
display: flex;
6062
justify-content: space-between;
6163
background-color: $devui-base-bg;
64+
position: relative;
6265

6366
.header-left {
6467
display: flex;
@@ -114,7 +117,7 @@
114117

115118
.header-fixed {
116119
position: fixed;
117-
z-index: 10;
120+
z-index: 1000;
118121
}
119122

120123
.header-shadow {
@@ -126,14 +129,6 @@
126129
}
127130

128131
@media (max-width: 1360px) {
129-
.header-left {
130-
d-search {
131-
display: none;
132-
}
133-
}
134-
}
135-
136-
@media (max-width: 1180px) {
137132
.header-wapper {
138133
flex-direction: column;
139134
height: 60px;
@@ -145,17 +140,17 @@
145140

146141
.header-left {
147142
height: 60px;
148-
d-search {
149-
display: none;
150-
}
151143
}
152144

153145
.header-right {
154146
display: none;
147+
position: absolute;
148+
top: 60px;
155149
}
156150

157151
.header-right.active {
158152
background-color: $devui-global-bg-normal;
153+
box-shadow: $devui-shadow-length-connected-overlay $devui-light-shadow;
159154
height: 520px;
160155
z-index: 3;
161156

devui-commons/src/header/header.component.ts

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Component, ContentChildren, HostListener, Input, OnInit, QueryList } from '@angular/core';
22
import { DevuiCommonsService } from '../devui-commons.service';
33
import { LogoComponent } from './logo/logo.component';
4+
import { DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
5+
import { I18nUtil } from '../i18n/i18n.util';
46

57
@Component({
68
selector: 'd-common-header',
@@ -15,6 +17,9 @@ export class HeaderComponent implements OnInit {
1517
@Input() showSlideButton = true;
1618
@Input() showSearch = false;
1719
@Input() showAvatar = false;
20+
@Input() repoName = 'ng-devui';
21+
22+
repoLink: SafeResourceUrl;
1823

1924
@ContentChildren(LogoComponent) subLogo: QueryList<LogoComponent> = new QueryList<LogoComponent>();
2025

@@ -27,45 +32,49 @@ export class HeaderComponent implements OnInit {
2732

2833

2934
@HostListener('window:resize')
30-
resize() {
35+
resize(): void {
3136
this.showSlideMenu = document.body.clientWidth < 1024 ? false : true;
3237
this.setSlideBarStyle();
3338
}
3439

35-
constructor(private commonsService: DevuiCommonsService) {
40+
constructor(private commonsService: DevuiCommonsService, private sanitizer: DomSanitizer) {
3641
}
3742

38-
ngOnInit() {
39-
this.curLanguage = localStorage.getItem('lang') || 'zh-cn';
43+
ngOnInit(): void {
44+
this.curLanguage = I18nUtil.getCurrentLanguage();
4045
this.commonsService.on('languageEvent').subscribe(term => this.changeLanguage(term));
4146
this.searchPlaceholder = this.curLanguage === 'zh-cn' ? '请输入你想查找的组件' : 'Enter the component';
4247
this.showSlideMenu = document.body.clientWidth < 1024 ? false : true;
4348
this.setSlideBarStyle();
49+
this.repoLink = this.sanitizer.bypassSecurityTrustResourceUrl(`https://ghbtns.com/github-btn.html?user=DevCloudFE&repo=${this.repoName}&type=star&count=true`);
4450
}
4551

46-
onSearch(term) {
52+
onSearch(term): void {
4753
this.commonsService.broadcast('searchEvent', term);
54+
55+
if (term) {
56+
this.clickSlideMenu(true);
57+
}
4858
}
4959

5060
toggleMenu($event): void {
5161
this.collapseMenuActive = !this.collapseMenuActive;
5262
}
5363

54-
clickSlideMenu($event) {
55-
this.showSlideMenu = !this.showSlideMenu;
64+
clickSlideMenu(showMenu?: boolean): void {
65+
this.showSlideMenu = typeof showMenu === 'boolean' ? showMenu : !this.showSlideMenu;
5666
this.setSlideBarStyle();
5767
}
5868

59-
setSlideBarStyle() {
69+
setSlideBarStyle(): void {
6070
const ele = document.querySelector('.sidebar-wrapper');
6171
if (ele) {
6272
ele.setAttribute('style', `max-width: ${ this.showSlideMenu ? '260px' : '0'}`);
6373
}
6474
}
6575

66-
changeLanguage(lang) {
76+
changeLanguage(lang): void {
6777
this.curLanguage = lang;
6878
this.searchPlaceholder = this.curLanguage === 'zh-cn' ? '请输入你想查找的组件' : 'Enter the component';
6979
}
70-
7180
}

devui-commons/src/header/header.module.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { HeaderComponent } from './header.component';
77
import { LanguageSwitchComponent } from './language-switch/language-switch.component';
88
import { LogoComponent } from './logo/logo.component';
99
import { MenuComponent } from './menu/menu.component';
10+
import { ThemePickerComponent } from './theme-picker/theme-picker.component';
1011
import { ThemeSwitchComponent } from './theme-switch/theme-switch.component';
1112
import { VersionSwitchComponent } from './version-switch/version-switch.component';
1213

@@ -21,6 +22,7 @@ import { VersionSwitchComponent } from './version-switch/version-switch.componen
2122
LogoComponent,
2223
MenuComponent,
2324
VersionSwitchComponent,
25+
ThemePickerComponent,
2426
ThemeSwitchComponent,
2527
LanguageSwitchComponent,
2628
EcosystemComponent
@@ -30,6 +32,7 @@ import { VersionSwitchComponent } from './version-switch/version-switch.componen
3032
LogoComponent,
3133
MenuComponent,
3234
VersionSwitchComponent,
35+
ThemePickerComponent,
3336
ThemeSwitchComponent,
3437
LanguageSwitchComponent,
3538
EcosystemComponent

devui-commons/src/header/language-switch/language-switch.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
22
import { DevuiCommonsService } from '../../devui-commons.service';
3+
import { I18nUtil } from '../../i18n/i18n.util';
34

45
@Component({
56
selector: 'd-header-language-switch',
@@ -13,8 +14,8 @@ export class LanguageSwitchComponent implements OnInit {
1314

1415
constructor(private commonsService: DevuiCommonsService) { }
1516

16-
ngOnInit() {
17-
this.currentLang = localStorage.getItem('lang') || 'zh-cn';
17+
ngOnInit(): void {
18+
this.currentLang = I18nUtil.getCurrentLanguage();
1819
}
1920

2021
changeLanguage(): void {

devui-commons/src/header/logo/logo.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="header-logo">
2-
<a target="_self" href="/home">
2+
<a target="_self" [attr.href]="link || '/home'">
33
<span class="logo">
44
<svg
55
viewBox="0 0 26 26"

devui-commons/src/header/logo/logo.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Component, Input, OnInit } from '@angular/core';
77
})
88
export class LogoComponent implements OnInit {
99
@Input() name = 'DevUI';
10+
@Input() link = '/home';
1011

1112
constructor() { }
1213

devui-commons/src/header/menu/menu.component.html

+11-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@
1212
>
1313
<a dDropDownToggle>
1414
{{curLanguage === 'zh-cn' ? item.name : item.enName}}
15-
<span class="icon-chevron-down"></span>
15+
<span class="devui-header-open-icon">
16+
<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
17+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
18+
<polygon
19+
transform="translate(8.000000, 8.000000) scale(1, -1) rotate(-360.000000) translate(-8.000000, -8.000000) "
20+
points="4 5.5 12 5.5 8 10.5"
21+
></polygon>
22+
</g>
23+
</svg>
24+
</span>
1625
</a>
1726
<div dDropDownMenu class="devui-scrollbar menu-list-wrapper">
1827
<div class="menu-list" *ngFor="let itemInList of item.children">
@@ -21,7 +30,7 @@
2130
</div>
2231
<ul class="menu-sublist">
2332
<li class="menu-sublist-item" *ngFor="let itemInSubList of itemInList.children">
24-
<a *ngIf="itemInSubList.href" class="" [href]="itemInSubList.href" rel="noopener noreferrer" [target]="itemInSubList.target ? itemInSubList.target : '_blank'">
33+
<a *ngIf="itemInSubList.href" [href]="itemInSubList.href" rel="noopener noreferrer" [target]="itemInSubList.target ? itemInSubList.target : '_blank'">
2534
<span>{{curLanguage === 'zh-cn' ? itemInSubList.name : itemInSubList.enName}}</span>
2635
</a>
2736
</li>

0 commit comments

Comments
 (0)