Skip to content

Commit 128f4c0

Browse files
feat(module:description): support standalone component (#8262)
1 parent d21f8a1 commit 128f4c0

File tree

5 files changed

+42
-43
lines changed

5 files changed

+42
-43
lines changed

components/descriptions/descriptions-item.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import { InputNumber } from 'ng-zorro-antd/core/util';
2828
</ng-template>
2929
`,
3030
exportAs: 'nzDescriptionsItem',
31-
preserveWhitespaces: false
31+
preserveWhitespaces: false,
32+
standalone: true
3233
})
3334
export class NzDescriptionsItemComponent implements OnChanges, OnDestroy {
3435
static ngAcceptInputType_nzSpan: NumberInput;

components/descriptions/descriptions.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { Direction, Directionality } from '@angular/cdk/bidi';
7+
import { NgForOf, NgIf, NgTemplateOutlet } from '@angular/common';
78
import {
89
AfterContentInit,
910
ChangeDetectionStrategy,
@@ -25,6 +26,7 @@ import { auditTime, startWith, switchMap, takeUntil, tap } from 'rxjs/operators'
2526

2627
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
2728
import { warn } from 'ng-zorro-antd/core/logger';
29+
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
2830
import { gridResponsiveMap, NzBreakpointEnum, NzBreakpointService } from 'ng-zorro-antd/core/services';
2931
import { BooleanInput } from 'ng-zorro-antd/core/types';
3032
import { InputBoolean } from 'ng-zorro-antd/core/util';
@@ -155,7 +157,9 @@ const defaultColumnMap: { [key in NzBreakpointEnum]: number } = {
155157
'[class.ant-descriptions-middle]': 'nzSize === "middle"',
156158
'[class.ant-descriptions-small]': 'nzSize === "small"',
157159
'[class.ant-descriptions-rtl]': 'dir === "rtl"'
158-
}
160+
},
161+
imports: [NgIf, NzOutletModule, NgForOf, NgTemplateOutlet],
162+
standalone: true
159163
})
160164
export class NzDescriptionsComponent implements OnChanges, OnDestroy, AfterContentInit, OnInit {
161165
readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;

components/descriptions/descriptions.module.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +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 { PlatformModule } from '@angular/cdk/platform';
8-
import { CommonModule } from '@angular/common';
96
import { NgModule } from '@angular/core';
107

11-
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
12-
138
import { NzDescriptionsItemComponent } from './descriptions-item.component';
149
import { NzDescriptionsComponent } from './descriptions.component';
1510

1611
@NgModule({
17-
imports: [BidiModule, CommonModule, NzOutletModule, PlatformModule],
18-
declarations: [NzDescriptionsComponent, NzDescriptionsItemComponent],
12+
imports: [NzDescriptionsComponent, NzDescriptionsItemComponent],
1913
exports: [NzDescriptionsComponent, NzDescriptionsItemComponent]
2014
})
2115
export class NzDescriptionsModule {}

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions';
1818

1919
## API
2020

21-
### nz-descriptions
22-
23-
| Property | Description | Type | Default | Global Config |
24-
| -------- | ----------- | ---- | ------- | ------------- |
25-
| `[nzTitle]` | Describe the title of the list, displayed at the top | `string\|TemplateRef<void>` | `false` |
26-
| `[nzExtra]` | The action area of the description list, placed at the top-right | `string\|TemplateRef<void>` | `-` |
27-
| `[nzBordered]` | Whether to display the border | `boolean` | `false` ||
28-
| `[nzColumn]` | The number of `nz-descriptions-item` in a row. It could be a number or a object like `{ xs: 8, sm: 16, md: 24}` | `number\|object` | `{ xxl: 3, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }` ||
29-
| `[nzSize]` | Set the size of the list. Only works when `nzBordered` is set | `'default' \| 'middle' \| 'small'` | `'default'` ||
30-
| `[nzColon]` | Show colon after title | `boolean` | `true` ||
31-
32-
### nz-descriptions-item
33-
34-
| Property | Description | Type | Default |
35-
| -------- | ----------- | ---- | ------- |
36-
| `[nzTitle]` | Description of the content | `boolean` | `string\|TemplateRef<void>` |
37-
| `[nzSpan]` | The number of columns included | `number` | `1` |
21+
### nz-descriptions:standalone
22+
23+
| Property | Description | Type | Default | Global Config |
24+
| -------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ----------------------------------------------- | ------------- |
25+
| `[nzTitle]` | Describe the title of the list, displayed at the top | `string\|TemplateRef<void>` | `false` |
26+
| `[nzExtra]` | The action area of the description list, placed at the top-right | `string\|TemplateRef<void>` | `-` |
27+
| `[nzBordered]` | Whether to display the border | `boolean` | `false` | |
28+
| `[nzColumn]` | The number of `nz-descriptions-item` in a row. It could be a number or a object like `{ xs: 8, sm: 16, md: 24}` | `number\|object` | `{ xxl: 3, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }` | |
29+
| `[nzSize]` | Set the size of the list. Only works when `nzBordered` is set | `'default' \| 'middle' \| 'small'` | `'default'` | |
30+
| `[nzColon]` | Show colon after title | `boolean` | `true` | |
31+
32+
### nz-descriptions-item:standalone
33+
34+
| Property | Description | Type | Default |
35+
| ----------- | ------------------------------ | --------- | --------------------------- |
36+
| `[nzTitle]` | Description of the content | `boolean` | `string\|TemplateRef<void>` |
37+
| `[nzSpan]` | The number of columns included | `number` | `1` |

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

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

2020
## API
2121

22-
### nz-descriptions
23-
24-
| 参数 | 说明 | 类型 | 默认值 | 支持全局配置 |
25-
| -------- | ----------- | ---- | ------- | --- |
26-
| `[nzTitle]` | 描述列表的标题,显示在最顶部 | `string\|TemplateRef<void>` | `false` |
27-
| `[nzExtra]` | 描述列表的操作区域,显示在右上方 | `string\|TemplateRef<void>` | `-` |
28-
| `[nzBordered]` | 是否展示边框 | `boolean` | `false` ||
29-
| `[nzColumn]` | 一行的 `nz-descriptions-item` 的数量,可以写成像素值或支持响应式的对象写法 `{ xs: 8, sm: 16, md: 24}` | `number\|object` | `{ xxl: 3, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }` ||
30-
| `[nzSize]` | 设置列表的大小(只有设置 `nzBordered` 时生效) | `'default' \| 'middle' \| 'small'` | `'default'` ||
31-
| `[nzColon]` | 在标题后显示冒号 | `boolean` | `true` ||
32-
33-
### nz-descriptions-item
34-
35-
| 参数 | 说明 | 类型 | 默认值 |
36-
| -------- | ----------- | ---- | ------- |
37-
| `[nzTitle]` | 内容的描述 | `string\|TemplateRef<void>` | - |
38-
| `[nzSpan]` | 包含列的数量 | `number` | `1` |
22+
### nz-descriptions:standalone
23+
24+
| 参数 | 说明 | 类型 | 默认值 | 支持全局配置 |
25+
| -------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------- | ----------------------------------------------- | ------------ |
26+
| `[nzTitle]` | 描述列表的标题,显示在最顶部 | `string\|TemplateRef<void>` | `false` |
27+
| `[nzExtra]` | 描述列表的操作区域,显示在右上方 | `string\|TemplateRef<void>` | `-` |
28+
| `[nzBordered]` | 是否展示边框 | `boolean` | `false` | |
29+
| `[nzColumn]` | 一行的 `nz-descriptions-item` 的数量,可以写成像素值或支持响应式的对象写法 `{ xs: 8, sm: 16, md: 24}` | `number\|object` | `{ xxl: 3, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }` | |
30+
| `[nzSize]` | 设置列表的大小(只有设置 `nzBordered` 时生效) | `'default' \| 'middle' \| 'small'` | `'default'` | |
31+
| `[nzColon]` | 在标题后显示冒号 | `boolean` | `true` | |
32+
33+
### nz-descriptions-item:standalone
34+
35+
| 参数 | 说明 | 类型 | 默认值 |
36+
| ----------- | ------------ | --------------------------- | ------ |
37+
| `[nzTitle]` | 内容的描述 | `string\|TemplateRef<void>` | - |
38+
| `[nzSpan]` | 包含列的数量 | `number` | `1` |

0 commit comments

Comments
 (0)