Skip to content

Commit 2547da9

Browse files
authored
refactor(module:*): remove ngClass and ngStyle (#1852)
1 parent 0323a37 commit 2547da9

33 files changed

+63
-77
lines changed

packages/abc/avatar-list/avatar-list.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ul class="avatar-list__wrap">
22
@for (i of items; track $index) {
3-
<li [ngClass]="cls">
3+
<li [class]="cls">
44
@if (i.tips) {
55
<nz-avatar
66
nz-tooltip
@@ -16,8 +16,8 @@
1616
</li>
1717
}
1818
@if (exceedCount > 0) {
19-
<li [ngClass]="cls">
20-
<nz-avatar [nzSize]="avatarSize" style="cursor: auto" [ngStyle]="excessItemsStyle" [nzText]="'+' + exceedCount" />
19+
<li [class]="cls">
20+
<nz-avatar [nzSize]="avatarSize" style="cursor: auto" [style]="excessItemsStyle" [nzText]="'+' + exceedCount" />
2121
</li>
2222
}
2323
</ul>

packages/abc/avatar-list/avatar-list.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Direction, Directionality } from '@angular/cdk/bidi';
2-
import { NgClass, NgStyle } from '@angular/common';
32
import {
43
AfterViewInit,
54
ChangeDetectionStrategy,
@@ -37,7 +36,7 @@ import { AvatarListItemComponent } from './avatar-list-item.component';
3736
changeDetection: ChangeDetectionStrategy.OnPush,
3837
encapsulation: ViewEncapsulation.None,
3938
standalone: true,
40-
imports: [NgStyle, NgClass, NzAvatarComponent, NzTooltipDirective]
39+
imports: [NzAvatarComponent, NzTooltipDirective]
4140
})
4241
export class AvatarListComponent implements AfterViewInit, OnChanges {
4342
private readonly cdr = inject(ChangeDetectorRef);

packages/abc/ellipsis/ellipsis.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ng-template>
1616
@switch (type) {
1717
@case ('default') {
18-
<span [ngClass]="cls"></span>
18+
<span [class]="cls"></span>
1919
}
2020
@case ('length') {
2121
<ng-template [ngTemplateOutlet]="tooltipTpl" [ngTemplateOutletContext]="{ $implicit: lengthTpl }" />
@@ -24,11 +24,11 @@
2424
@case ('line-clamp') {
2525
<ng-template [ngTemplateOutlet]="tooltipTpl" [ngTemplateOutletContext]="{ $implicit: lineClampTpl }" />
2626
<ng-template #lineClampTpl>
27-
<div [ngClass]="cls" [ngStyle]="{ '-webkit-line-clamp': lines, '-webkit-box-orient': 'vertical' }"></div>
27+
<div [class]="cls" [style]="{ '-webkit-line-clamp': lines, '-webkit-box-orient': 'vertical' }"></div>
2828
</ng-template>
2929
}
3030
@case ('line') {
31-
<div [ngClass]="cls">
31+
<div [class]="cls">
3232
<div class="ellipsis__handle">
3333
<ng-template [ngTemplateOutlet]="tooltipTpl" [ngTemplateOutletContext]="{ $implicit: lineTpl }" />
3434
<ng-template #lineTpl>{{ linsWord }}</ng-template>

packages/abc/ellipsis/ellipsis.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CdkObserveContent } from '@angular/cdk/observers';
2-
import { DOCUMENT, NgClass, NgStyle, NgTemplateOutlet } from '@angular/common';
2+
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
33
import {
44
AfterViewInit,
55
ChangeDetectionStrategy,
@@ -29,7 +29,7 @@ import { NzTooltipDirective } from 'ng-zorro-antd/tooltip';
2929
changeDetection: ChangeDetectionStrategy.OnPush,
3030
encapsulation: ViewEncapsulation.None,
3131
standalone: true,
32-
imports: [CdkObserveContent, NzTooltipDirective, NgTemplateOutlet, NgClass, NgStyle]
32+
imports: [CdkObserveContent, NzTooltipDirective, NgTemplateOutlet]
3333
})
3434
export class EllipsisComponent implements AfterViewInit, OnChanges {
3535
private readonly el: HTMLElement = inject(ElementRef).nativeElement;

packages/abc/loading/loading.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<i nz-icon [nzType]="icon.type!" [nzTheme]="icon.theme!" [nzSpin]="icon.spin"></i>
99
}
1010
@default {
11-
<div class="loading-default__custom" [ngStyle]="custom.style!" [innerHTML]="custom.html"></div>
11+
<div class="loading-default__custom" [style]="custom.style!" [innerHTML]="custom.html"></div>
1212
}
1313
}
1414
</div>

packages/abc/loading/loading.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Direction } from '@angular/cdk/bidi';
2-
import { NgStyle } from '@angular/common';
32
import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
43

54
import { NzIconDirective } from 'ng-zorro-antd/icon';
@@ -18,7 +17,7 @@ import { LoadingCustom, LoadingIcon, LoadingShowOptions } from './loading.types'
1817
changeDetection: ChangeDetectionStrategy.OnPush,
1918
encapsulation: ViewEncapsulation.None,
2019
standalone: true,
21-
imports: [NzSpinComponent, NzIconDirective, NgStyle]
20+
imports: [NzSpinComponent, NzIconDirective]
2221
})
2322
export class LoadingDefaultComponent {
2423
options!: LoadingShowOptions;

packages/abc/notice-icon/notice-icon.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ng-template #badgeTpl>
2-
<nz-badge [nzCount]="count" [ngClass]="btnClass!" [nzStyle]="{ 'box-shadow': 'none' }">
3-
<i nz-icon nzType="bell" [ngClass]="btnIconClass!"></i>
2+
<nz-badge [nzCount]="count" [class]="btnClass!" [nzStyle]="{ 'box-shadow': 'none' }">
3+
<i nz-icon nzType="bell" [class]="btnIconClass!"></i>
44
</nz-badge>
55
</ng-template>
66
@if (data!.length <= 0) {

packages/abc/notice-icon/notice-icon.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NgClass, NgTemplateOutlet } from '@angular/common';
1+
import { NgTemplateOutlet } from '@angular/common';
22
import {
33
ChangeDetectionStrategy,
44
ChangeDetectorRef,
@@ -37,7 +37,6 @@ import { NoticeIconSelect, NoticeItem } from './notice-icon.types';
3737
encapsulation: ViewEncapsulation.None,
3838
standalone: true,
3939
imports: [
40-
NgClass,
4140
NgTemplateOutlet,
4241
NzBadgeComponent,
4342
NzIconDirective,

packages/abc/quick-menu/quick-menu.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="quick-menu__inner">
2-
<div class="quick-menu__ctrl" [ngStyle]="ctrlStyle">
2+
<div class="quick-menu__ctrl" [style]="ctrlStyle">
33
<div class="quick-menu__ctrl-icon">
44
<ng-container *nzStringTemplateOutlet="icon">
55
<i nz-icon [nzType]="$any(icon)"></i>

packages/abc/quick-menu/quick-menu.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { NgStyle } from '@angular/common';
21
import {
32
ChangeDetectionStrategy,
43
ChangeDetectorRef,
@@ -32,7 +31,7 @@ import { NzIconDirective } from 'ng-zorro-antd/icon';
3231
changeDetection: ChangeDetectionStrategy.OnPush,
3332
encapsulation: ViewEncapsulation.None,
3433
standalone: true,
35-
imports: [NgStyle, NzIconDirective, NzStringTemplateOutletDirective]
34+
imports: [NzIconDirective, NzStringTemplateOutletDirective]
3635
})
3736
export class QuickMenuComponent implements OnInit, OnChanges {
3837
private readonly cdr = inject(ChangeDetectorRef);

0 commit comments

Comments
 (0)