Skip to content

Commit dc43fa5

Browse files
feat(module:collapse): support standalone component (#8267)
LGTM
1 parent f8fedfc commit dc43fa5

File tree

5 files changed

+50
-51
lines changed

5 files changed

+50
-51
lines changed

components/collapse/collapse-panel.component.ts

Lines changed: 6 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 } from '@angular/common';
67
import {
78
ChangeDetectionStrategy,
89
ChangeDetectorRef,
@@ -26,9 +27,11 @@ import { filter, takeUntil } from 'rxjs/operators';
2627
import { collapseMotion } from 'ng-zorro-antd/core/animation';
2728
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
2829
import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
30+
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
2931
import { NzDestroyService } from 'ng-zorro-antd/core/services';
3032
import { BooleanInput } from 'ng-zorro-antd/core/types';
3133
import { InputBoolean } from 'ng-zorro-antd/core/util';
34+
import { NzIconModule } from 'ng-zorro-antd/icon';
3235

3336
import { NzCollapseComponent } from './collapse.component';
3437

@@ -75,7 +78,9 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'collapsePanel';
7578
'[class.ant-collapse-item-active]': 'nzActive',
7679
'[class.ant-collapse-item-disabled]': 'nzDisabled'
7780
},
78-
providers: [NzDestroyService]
81+
providers: [NzDestroyService],
82+
imports: [NgIf, NzOutletModule, NzIconModule],
83+
standalone: true
7984
})
8085
export class NzCollapsePanelComponent implements OnInit, OnDestroy {
8186
readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;

components/collapse/collapse.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'collapse';
3838
'[class.ant-collapse-borderless]': '!nzBordered',
3939
'[class.ant-collapse-rtl]': "dir === 'rtl'"
4040
},
41-
providers: [NzDestroyService]
41+
providers: [NzDestroyService],
42+
standalone: true
4243
})
4344
export class NzCollapseComponent implements OnInit {
4445
readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;

components/collapse/collapse.module.ts

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

6-
import { BidiModule } from '@angular/cdk/bidi';
7-
import { CommonModule } from '@angular/common';
86
import { NgModule } from '@angular/core';
97

10-
import { NzNoAnimationModule } from 'ng-zorro-antd/core/no-animation';
11-
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
12-
import { NzIconModule } from 'ng-zorro-antd/icon';
13-
148
import { NzCollapsePanelComponent } from './collapse-panel.component';
159
import { NzCollapseComponent } from './collapse.component';
1610

1711
@NgModule({
18-
declarations: [NzCollapsePanelComponent, NzCollapseComponent],
19-
exports: [NzCollapsePanelComponent, NzCollapseComponent],
20-
imports: [BidiModule, CommonModule, NzIconModule, NzOutletModule, NzNoAnimationModule]
12+
imports: [NzCollapsePanelComponent, NzCollapseComponent],
13+
exports: [NzCollapsePanelComponent, NzCollapseComponent]
2114
})
2215
export class NzCollapseModule {}

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ import { NzCollapseModule } from 'ng-zorro-antd/collapse';
1919

2020
## API
2121

22-
### nz-collapse
23-
24-
| Property | Description | Type | Default | Global Config |
25-
| -------- | ----------- | ---- | ------- | ------------- |
26-
| `[nzAccordion]` | Accordion mode | `boolean` | `false`||
27-
| `[nzBordered]` | Set border style | `boolean` | `true` ||
28-
| `[nzGhost]` | Make the collapse borderless and its background transparent | `boolean` | `false` ||
29-
| `[nzExpandIconPosition]` | Set expand icon position | `'left' \| 'right'` | `left` | - |
30-
31-
### nz-collapse-panel
32-
33-
| Property | Description | Type | Default |
34-
| -------- | ----------- | ---- | ------- |
35-
| `[nzDisabled]` | If `true`, panel cannot be opened or closed | `boolean` | `false` |
36-
| `[nzHeader]` | Title of the panel | `string \| TemplateRef<void>` | - |
37-
| `[nzExpandedIcon]` | Customize an icon for toggle | `string \| TemplateRef<void>` | - |
38-
| `[nzExtra]` | Extra element in the corner | `string \| TemplateRef<void>` | - |
39-
| `[nzShowArrow]` | Display arrow or not | `boolean` | `true` ||
40-
| `[nzActive]` | Active status of panel, double binding | `boolean` | - |
41-
| `(nzActiveChange)` | Callback function of the active status | `EventEmitter<boolean>` | - |
22+
### nz-collapse:standalone
23+
24+
| Property | Description | Type | Default | Global Config |
25+
| ------------------------ | ----------------------------------------------------------- | ------------------- | ------- | ------------- |
26+
| `[nzAccordion]` | Accordion mode | `boolean` | `false` | |
27+
| `[nzBordered]` | Set border style | `boolean` | `true` | |
28+
| `[nzGhost]` | Make the collapse borderless and its background transparent | `boolean` | `false` | |
29+
| `[nzExpandIconPosition]` | Set expand icon position | `'left' \| 'right'` | `left` | - |
30+
31+
### nz-collapse-panel:standalone
32+
33+
| Property | Description | Type | Default | Global Config |
34+
| ------------------ | ------------------------------------------- | ----------------------------- | ------- | ------------- |
35+
| `[nzDisabled]` | If `true`, panel cannot be opened or closed | `boolean` | `false` | - |
36+
| `[nzHeader]` | Title of the panel | `string \| TemplateRef<void>` | - | - |
37+
| `[nzExpandedIcon]` | Customize an icon for toggle | `string \| TemplateRef<void>` | - | - |
38+
| `[nzExtra]` | Extra element in the corner | `string \| TemplateRef<void>` | - | - |
39+
| `[nzShowArrow]` | Display arrow or not | `boolean` | `true` | |
40+
| `[nzActive]` | Active status of panel, double binding | `boolean` | - | - |
41+
| `(nzActiveChange)` | Callback function of the active status | `EventEmitter<boolean>` | - | - |

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ import { NzCollapseModule } from 'ng-zorro-antd/collapse';
2020

2121
## API
2222

23-
### nz-collapse
24-
25-
| 参数 | 说明 | 类型 | 默认值 | 全局配置 |
26-
| --- | --- | --- | --- | --- |
27-
| `[nzAccordion]` | 是否每次只打开一个tab | `boolean` | `false` ||
28-
| `[nzBordered]` | 是否有边框 | `boolean` | `true` ||
29-
| `[nzGhost]` | 使折叠面板透明且无边框 | `boolean` | `false` ||
30-
| `[nzExpandIconPosition]` | 设置图标位置 | `'left' \| 'right'` | `left` | - |
31-
32-
### nz-collapse-panel
33-
34-
| 参数 | 说明 | 类型 | 默认值 |
35-
| --- | --- | --- | --- |
36-
| `[nzDisabled]` | 禁用后的面板展开与否将无法通过用户交互改变 | `boolean` | `false` |
37-
| `[nzHeader]` | 面板头内容 | `string \| TemplateRef<void>` | - |
38-
| `[nzExpandedIcon]` | 自定义切换图标 | `string \| TemplateRef<void>` | - |
39-
| `[nzExtra]` | 自定义渲染每个面板右上角的内容 | `string \| TemplateRef<void>` | - |
40-
| `[nzShowArrow]` | 是否展示箭头 | `boolean` | `true` ||
41-
| `[nzActive]` | 面板是否展开,可双向绑定 | `boolean` | - |
42-
| `(nzActiveChange)` | 面板展开回调 | `EventEmitter<boolean>` | - |
23+
### nz-collapse:standalone
24+
25+
| 参数 | 说明 | 类型 | 默认值 | 全局配置 |
26+
| ------------------------ | ---------------------- | ------------------- | ------- | -------- |
27+
| `[nzAccordion]` | 是否每次只打开一个 tab | `boolean` | `false` | |
28+
| `[nzBordered]` | 是否有边框 | `boolean` | `true` | |
29+
| `[nzGhost]` | 使折叠面板透明且无边框 | `boolean` | `false` | |
30+
| `[nzExpandIconPosition]` | 设置图标位置 | `'left' \| 'right'` | `left` | - |
31+
32+
### nz-collapse-panel:standalone
33+
34+
| 参数 | 说明 | 类型 | 默认值 | 全局配置 |
35+
| ------------------ | ------------------------------------------ | ----------------------------- | ------- | -------- |
36+
| `[nzDisabled]` | 禁用后的面板展开与否将无法通过用户交互改变 | `boolean` | `false` | - |
37+
| `[nzHeader]` | 面板头内容 | `string \| TemplateRef<void>` | - | - |
38+
| `[nzExpandedIcon]` | 自定义切换图标 | `string \| TemplateRef<void>` | - | - |
39+
| `[nzExtra]` | 自定义渲染每个面板右上角的内容 | `string \| TemplateRef<void>` | - | - |
40+
| `[nzShowArrow]` | 是否展示箭头 | `boolean` | `true` | |
41+
| `[nzActive]` | 面板是否展开,可双向绑定 | `boolean` | - | - |
42+
| `(nzActiveChange)` | 面板展开回调 | `EventEmitter<boolean>` | - | - |

0 commit comments

Comments
 (0)