Skip to content

Commit d66bcba

Browse files
feat(module:cdk): support standalone component (#8270)
1 parent c51e8da commit d66bcba

7 files changed

Lines changed: 14 additions & 18 deletions

components/cdk/overflow/overflow-container.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import { NzOverflowSuffixDirective } from './overflow-suffix.directive';
3030
<ng-content select="[appOverflowRest]"></ng-content>
3131
<ng-content select="[appOverflowSuffix]"></ng-content>`,
3232
providers: [NzResizeObserver],
33-
changeDetection: ChangeDetectionStrategy.OnPush
33+
changeDetection: ChangeDetectionStrategy.OnPush,
34+
standalone: true
3435
})
3536
export class NzOverflowContainerComponent implements OnInit, AfterContentInit, OnDestroy {
3637
contentInit$ = new Subject<void>();

components/cdk/overflow/overflow-item.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { NzResizeObserver } from 'ng-zorro-antd/cdk/resize-observer';
1212
selector: '[nzOverflowItem]',
1313
host: {
1414
'[style]': 'overflowStyle'
15-
}
15+
},
16+
standalone: true
1617
})
1718
export class NzOverflowItemDirective {
1819
overflowStyle: { [key: string]: string | number | undefined } | undefined = undefined;

components/cdk/overflow/overflow-rest.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { NzResizeObserver } from 'ng-zorro-antd/cdk/resize-observer';
1212
selector: '[nzOverflowRest]',
1313
host: {
1414
'[style]': 'restStyle'
15-
}
15+
},
16+
standalone: true
1617
})
1718
export class NzOverflowRestDirective {
1819
restStyle: { [key: string]: string | number | undefined } | undefined = undefined;

components/cdk/overflow/overflow-suffix.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { NzResizeObserver } from 'ng-zorro-antd/cdk/resize-observer';
1212
selector: '[nzOverflowSuffix]',
1313
host: {
1414
'[style]': 'suffixStyle'
15-
}
15+
},
16+
standalone: true
1617
})
1718
export class NzOverflowSuffixDirective {
1819
suffixStyle = {};

components/cdk/overflow/overflow.module.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@
55

66
import { NgModule } from '@angular/core';
77

8-
import { NzResizeObserverModule } from 'ng-zorro-antd/cdk/resize-observer';
9-
108
import { NzOverflowContainerComponent } from './overflow-container.component';
119
import { NzOverflowItemDirective } from './overflow-item.directive';
1210
import { NzOverflowRestDirective } from './overflow-rest.directive';
1311
import { NzOverflowSuffixDirective } from './overflow-suffix.directive';
1412

1513
@NgModule({
16-
imports: [NzResizeObserverModule],
17-
declarations: [
18-
NzOverflowContainerComponent,
19-
NzOverflowItemDirective,
20-
NzOverflowRestDirective,
21-
NzOverflowSuffixDirective
22-
],
14+
imports: [NzOverflowContainerComponent, NzOverflowItemDirective, NzOverflowRestDirective, NzOverflowSuffixDirective],
2315
exports: [NzOverflowContainerComponent, NzOverflowItemDirective, NzOverflowRestDirective, NzOverflowSuffixDirective]
2416
})
2517
export class NzOverflowModule {}

components/cdk/resize-observer/resize-observer.directive.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ import { Subscription } from 'rxjs';
1919
import { BooleanInput } from 'ng-zorro-antd/core/types';
2020
import { InputBoolean } from 'ng-zorro-antd/core/util';
2121

22-
import { NzResizeObserver } from './resize-observer.service';
22+
import { NzResizeObserver, NzResizeObserverFactory } from './resize-observer.service';
2323

2424
@Directive({
25-
selector: '[nzResizeObserver]'
25+
selector: '[nzResizeObserver]',
26+
standalone: true,
27+
providers: [NzResizeObserverFactory]
2628
})
2729
export class NzResizeObserverDirective implements AfterContentInit, OnDestroy, OnChanges {
2830
static ngAcceptInputType_nzResizeObserverDisabled: BooleanInput;

components/cdk/resize-observer/resize-observer.module.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
import { NgModule } from '@angular/core';
77

88
import { NzResizeObserverDirective } from './resize-observer.directive';
9-
import { NzResizeObserverFactory } from './resize-observer.service';
109

1110
@NgModule({
12-
providers: [NzResizeObserverFactory],
13-
declarations: [NzResizeObserverDirective],
11+
imports: [NzResizeObserverDirective],
1412
exports: [NzResizeObserverDirective]
1513
})
1614
export class NzResizeObserverModule {}

0 commit comments

Comments
 (0)