Skip to content

Commit 8809885

Browse files
feat(module:space): support array for size (#9289)
1 parent ff1fa28 commit 8809885

13 files changed

Lines changed: 136 additions & 154 deletions

components/core/config/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export interface SegmentedConfig {
276276
}
277277

278278
export interface SpaceConfig {
279-
nzSize?: 'small' | 'middle' | 'large' | number;
279+
nzSize?: 'small' | 'middle' | 'large' | number | Array<'small' | 'middle' | 'large' | number>;
280280
}
281281

282282
export interface SpinConfig {

components/space/demo/align.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ title:
1111

1212
## en-US
1313

14-
Config item align.
14+
Config item align.

components/space/demo/compact-button-vertical.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
order: 8
2+
order: 9
33
title:
44
zh-CN: 垂直方向紧凑布局
55
en-US: Vertical Compact Mode

components/space/demo/compact-buttons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
order: 7
2+
order: 8
33
title:
44
zh-CN: Button 紧凑布局
55
en-US: Button Compact Mode

components/space/demo/compact.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
order: 6
2+
order: 7
33
title:
44
zh-CN: 紧凑布局组合
55
en-US: Compact Mode

components/space/demo/customize.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
order: 3
2+
order: 4
33
title:
44
zh-CN: 自定义尺寸
55
en-US: Customize Size

components/space/demo/split.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
order: 5
2+
order: 6
33
title:
44
zh-CN: 分隔符
55
en-US: Split

components/space/demo/wrap.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
order: 5
3+
title:
4+
zh-CN: 换行
5+
en-US: Wrap
6+
---
7+
8+
## zh-CN
9+
10+
自动换行。
11+
12+
## en-US
13+
14+
Auto wrap line.

components/space/demo/wrap.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Component } from '@angular/core';
2+
3+
import { NzButtonModule } from 'ng-zorro-antd/button';
4+
import { NzSpaceModule } from 'ng-zorro-antd/space';
5+
6+
@Component({
7+
selector: 'nz-demo-space-wrap',
8+
imports: [NzButtonModule, NzSpaceModule],
9+
template: `
10+
<nz-space [nzSize]="[8, 16]" nzWrap>
11+
@for (item of items; track $index) {
12+
<button *nzSpaceItem nz-button>Button</button>
13+
}
14+
</nz-space>
15+
`
16+
})
17+
export class NzDemoSpaceWrapComponent {
18+
items = new Array(20).fill(null);
19+
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ The difference with Flex component is:
2424

2525
| Property | Description | Type | Default | Global Config |
2626
| --------------- | ------------------------------------------- | -------------------------------------------- | ------------ | ------------- |
27-
| `[nzSize]` | The space size | `'small' \| 'middle' \| 'large' \| number` | `small` ||
27+
| `[nzSize]` | The space size | `NzSpaceSize \| NzSpaceSize[]` | `small` ||
2828
| `[nzDirection]` | The space direction | `'vertical' \| 'horizontal'` | `horizontal` | |
2929
| `[nzAlign]` | Align items | `'start' \| 'end' \| 'baseline' \| 'center'` | - | |
3030
| `[nzWrap]` | Auto wrap line, when `horizontal` effective | `boolean` | `false` | |
3131
| `[nzSplit]` | Set split | `TemplateRef \| string` | - | |
3232

33+
#### Interfaces
34+
35+
```ts
36+
type NzSpaceSize = 'small' | 'middle' | 'large' | number;
37+
```
38+
3339
### nz-space-compact
3440

3541
Use `<nz-space-compact>` when child form components are compactly connected and the border is collapsed. The supported components are:

0 commit comments

Comments
 (0)