Skip to content

Commit

Permalink
refactor: 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
huajian123 committed Nov 14, 2023
1 parent c84d84c commit b19b604
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/app/pages/login/login-form/login-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class LoginFormComponent implements OnInit {
源码地址:<a href="https://github.com/huajian123/ng-ant-admin">在这里</a>
`,
{
nzPlacement: 'top',
nzDuration: 0
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nz-card [nzBodyStyle]="{ padding: 0 }">
<nz-collapse nzGhost>
<nz-collapse-panel *ngFor="let panel of panels" [nzActive]="panel.active" [nzDisabled]="panel.disabled" [nzExtra]="extraTpl" [nzHeader]="panel.name">
<p style="margin: 0">A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
<p style="margin: 0">我还在紧张开发中。。。嘻嘻</p>
</nz-collapse-panel>
</nz-collapse>
</nz-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
nzTheme="outline"
[nzPopoverContent]="contentTemplate"
[nzPopoverTitle]="searchTitle"
[nzType]="seletedIcon || 'appstore'"
[nzType]="selectedIcon || 'appstore'"
[(nzPopoverVisible)]="visible"
></i>
<ng-template #searchTitle>
Expand Down
11 changes: 5 additions & 6 deletions src/app/shared/biz-components/icon-sel/icon-sel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class IconSelComponent implements OnInit, AfterViewInit {
@Input({ transform: booleanAttribute }) visible = false;
// 做图标搜索防抖
private searchText$ = new Subject<string>();
seletedIcon = '';
selectedIcon = '';
@Output() readonly selIcon = new EventEmitter<string>();
// 分页信息
pageObj = {
Expand Down Expand Up @@ -58,11 +58,10 @@ export class IconSelComponent implements OnInit, AfterViewInit {
}

selIconFn(item: IconItem): void {
this.seletedIcon = item.icon;
this.sourceIconsArray.forEach(icon => (icon.isChecked = false));
this.iconsStrShowArray.forEach(icon => (icon.isChecked = false));
this.iconsStrAllArray.forEach(icon => (icon.isChecked = false));

this.selectedIcon = item.icon;
[this.sourceIconsArray, this.iconsStrShowArray, this.iconsStrAllArray].forEach(item => {
item.forEach(icon => (icon.isChecked = false));
});
item.isChecked = true;
this.selIcon.emit(item.icon);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export class PSMProgressBarDirective implements OnChanges {
this.progressBar = this.el.nativeElement;
}

ngOnChanges(changes: SimpleChanges) {
ngOnChanges(changes: SimpleChanges): void {
if (changes['numberOfProgressBarItems']) {
this.setProgressBarItems();
}

this.setProgressBar();
}

setProgressBarItems() {
setProgressBarItems(): void {
const progressBarItemContainer = this.progressBar.querySelector('.psm__progress-bar-items');
const width = 100 / this.numberOfProgressBarItems!;

Expand All @@ -57,7 +57,7 @@ export class PSMProgressBarDirective implements OnChanges {
});
}

setProgressBar() {
setProgressBar(): void {
const progressBarOverlayWidth = this.getFillMeterWidth(this.passwordStrength as number);
const progressBarOverlayWidthInPx = `${progressBarOverlayWidth}%`;

Expand Down Expand Up @@ -87,7 +87,7 @@ export class PSMProgressBarDirective implements OnChanges {
return roundedStrengthInPercentage;
}

getMeterFillColor(progressLevel: number) {
getMeterFillColor(progressLevel: number): string {
if (!progressLevel || progressLevel <= 0 || (progressLevel > this.colors.length && progressLevel > this.defaultColors.length)) {
return this.colors[0] ? this.colors[0] : this.defaultColors[0];
}
Expand Down

0 comments on commit b19b604

Please sign in to comment.