Skip to content

Commit 5765ae9

Browse files
feat(module:table): support standalone component (#8276)
1 parent ac48fba commit 5765ae9

31 files changed

Lines changed: 402 additions & 340 deletions

components/table/doc/index.en-US.md

Lines changed: 131 additions & 135 deletions
Large diffs are not rendered by default.

components/table/doc/index.zh-CN.md

Lines changed: 129 additions & 134 deletions
Large diffs are not rendered by default.

components/table/src/addon/filter-trigger.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/con
2323
import { NzDestroyService } from 'ng-zorro-antd/core/services';
2424
import { BooleanInput } from 'ng-zorro-antd/core/types';
2525
import { InputBoolean } from 'ng-zorro-antd/core/util';
26-
import { NzDropDownDirective, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';
26+
import { NzDropDownDirective, NzDropdownMenuComponent, NzDropDownModule } from 'ng-zorro-antd/dropdown';
2727

2828
const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'filterTrigger';
2929

@@ -50,7 +50,9 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'filterTrigger';
5050
<ng-content></ng-content>
5151
</span>
5252
`,
53-
providers: [NzDestroyService]
53+
providers: [NzDestroyService],
54+
imports: [NzDropDownModule],
55+
standalone: true
5456
})
5557
export class NzFilterTriggerComponent implements OnInit {
5658
readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;

components/table/src/addon/filter.component.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6+
import { NgForOf, NgIf, NgTemplateOutlet } from '@angular/common';
67
import {
78
ChangeDetectionStrategy,
89
ChangeDetectorRef,
@@ -17,14 +18,21 @@ import {
1718
TemplateRef,
1819
ViewEncapsulation
1920
} from '@angular/core';
21+
import { FormsModule } from '@angular/forms';
2022
import { Subject } from 'rxjs';
2123
import { takeUntil } from 'rxjs/operators';
2224

25+
import { NzButtonModule } from 'ng-zorro-antd/button';
26+
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
2327
import { NzSafeAny } from 'ng-zorro-antd/core/types';
2428
import { arraysEqual } from 'ng-zorro-antd/core/util';
29+
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
2530
import { NzI18nService, NzTableI18nInterface } from 'ng-zorro-antd/i18n';
31+
import { NzIconModule } from 'ng-zorro-antd/icon';
32+
import { NzRadioComponent } from 'ng-zorro-antd/radio';
2633

2734
import { NzTableFilterList } from '../table.types';
35+
import { NzFilterTriggerComponent } from './filter-trigger.component';
2836

2937
interface NzThItemInterface {
3038
text: string;
@@ -74,7 +82,20 @@ interface NzThItemInterface {
7482
</nz-dropdown-menu>
7583
</ng-container>
7684
`,
77-
host: { class: 'ant-table-filter-column' }
85+
host: { class: 'ant-table-filter-column' },
86+
imports: [
87+
NgTemplateOutlet,
88+
NgIf,
89+
NzFilterTriggerComponent,
90+
NzIconModule,
91+
NzDropDownModule,
92+
NgForOf,
93+
NzRadioComponent,
94+
NzCheckboxModule,
95+
FormsModule,
96+
NzButtonModule
97+
],
98+
standalone: true
7899
})
79100
export class NzTableFilterComponent implements OnChanges, OnDestroy, OnInit {
80101
@Input() contentTemplate: TemplateRef<NzSafeAny> | null = null;

components/table/src/addon/row-expand-button.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { Directive, EventEmitter, Input, Output } from '@angular/core';
1414
'[class.ant-table-row-expand-icon-collapsed]': `!spaceMode && expand === false`,
1515
'[class.ant-table-row-expand-icon-spaced]': 'spaceMode',
1616
'(click)': 'onHostClick()'
17-
}
17+
},
18+
standalone: true
1819
})
1920
export class NzRowExpandButtonDirective {
2021
@Input() expand = false;

components/table/src/addon/row-indent.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { Directive, Input } from '@angular/core';
1010
host: {
1111
class: 'ant-table-row-indent',
1212
'[style.padding-left.px]': 'indentSize'
13-
}
13+
},
14+
standalone: true
1415
})
1516
export class NzRowIndentDirective {
1617
@Input() indentSize = 0;

components/table/src/addon/selection.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6+
import { NgForOf, NgIf } from '@angular/common';
67
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
8+
import { FormsModule } from '@angular/forms';
79

10+
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
811
import { NzSafeAny } from 'ng-zorro-antd/core/types';
12+
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
13+
import { NzIconModule } from 'ng-zorro-antd/icon';
914

1015
@Component({
1116
selector: 'nz-table-selection',
@@ -36,7 +41,9 @@ import { NzSafeAny } from 'ng-zorro-antd/core/types';
3641
</nz-dropdown-menu>
3742
</div>
3843
`,
39-
host: { class: 'ant-table-selection' }
44+
host: { class: 'ant-table-selection' },
45+
imports: [NgIf, FormsModule, NzCheckboxModule, NzDropDownModule, NzIconModule, NgForOf],
46+
standalone: true
4047
})
4148
export class NzTableSelectionComponent {
4249
@Input() listOfSelections: Array<{ text: string; onSelect(...args: NzSafeAny[]): NzSafeAny }> = [];

components/table/src/addon/sorters.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6+
import { NgIf, NgTemplateOutlet } from '@angular/common';
67
import {
78
ChangeDetectionStrategy,
89
Component,
@@ -14,6 +15,7 @@ import {
1415
} from '@angular/core';
1516

1617
import { NzSafeAny } from 'ng-zorro-antd/core/types';
18+
import { NzIconModule } from 'ng-zorro-antd/icon';
1719

1820
import { NzTableSortOrder } from '../table.types';
1921

@@ -43,7 +45,9 @@ import { NzTableSortOrder } from '../table.types';
4345
</span>
4446
</span>
4547
`,
46-
host: { class: 'ant-table-column-sorters' }
48+
host: { class: 'ant-table-column-sorters' },
49+
imports: [NzIconModule, NgTemplateOutlet, NgIf],
50+
standalone: true
4751
})
4852
export class NzTableSortersComponent implements OnChanges {
4953
@Input() sortDirections: NzTableSortOrder[] = ['ascend', 'descend', null];

components/table/src/cell/cell-fixed.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Subject } from 'rxjs';
1212
'[class.ant-table-cell-fix-right]': `isFixedRight`,
1313
'[class.ant-table-cell-fix-left]': `isFixedLeft`,
1414
'[style.position]': `isFixed? 'sticky' : null`
15-
}
15+
},
16+
standalone: true
1617
})
1718
export class NzCellFixedDirective implements OnChanges {
1819
@Input() nzRight: string | boolean = false;

components/table/src/cell/cell.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import { NzTableStyleService } from '../table-style.service';
1111
selector: 'th:not(.nz-disable-th):not([mat-cell]), td:not(.nz-disable-td):not([mat-cell])',
1212
host: {
1313
'[class.ant-table-cell]': 'isInsideTable'
14-
}
14+
},
15+
standalone: true
1516
})
1617
export class NzTableCellDirective {
1718
isInsideTable = false;

0 commit comments

Comments
 (0)