-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:cascader): support
nzPlacement
(#8935)
- Loading branch information
Showing
11 changed files
with
218 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 18 | ||
title: | ||
zh-CN: 弹出位置 | ||
en-US: Placement | ||
--- | ||
|
||
## zh-CN | ||
|
||
可以通过 `nzPlacement` 手动指定弹出的位置。 | ||
|
||
## en-US | ||
|
||
You can manually specify the position of the popup via `nzPlacement`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { NzCascaderModule, NzCascaderOption, NzCascaderPlacement } from 'ng-zorro-antd/cascader'; | ||
import { NzSegmentedModule } from 'ng-zorro-antd/segmented'; | ||
|
||
const options: NzCascaderOption[] = [ | ||
{ | ||
value: 'zhejiang', | ||
label: 'Zhejiang', | ||
children: [ | ||
{ | ||
value: 'hangzhou', | ||
label: 'Hangzhou', | ||
children: [ | ||
{ | ||
value: 'xihu', | ||
label: 'West Lake', | ||
isLeaf: true | ||
} | ||
] | ||
}, | ||
{ | ||
value: 'ningbo', | ||
label: 'Ningbo', | ||
isLeaf: true | ||
} | ||
] | ||
}, | ||
{ | ||
value: 'jiangsu', | ||
label: 'Jiangsu', | ||
children: [ | ||
{ | ||
value: 'nanjing', | ||
label: 'Nanjing', | ||
children: [ | ||
{ | ||
value: 'zhonghuamen', | ||
label: 'Zhong Hua Men', | ||
isLeaf: true | ||
} | ||
] | ||
} | ||
] | ||
} | ||
]; | ||
|
||
@Component({ | ||
selector: 'nz-demo-cascader-placement', | ||
imports: [NzCascaderModule, NzSegmentedModule], | ||
template: ` | ||
<nz-segmented [nzOptions]="placements" (nzValueChange)="setPlacement($event)"></nz-segmented> | ||
<br /> | ||
<br /> | ||
<nz-cascader [nzOptions]="nzOptions" [nzPlacement]="placement"></nz-cascader> | ||
` | ||
}) | ||
export class NzDemoCascaderPlacementComponent { | ||
nzOptions: NzCascaderOption[] = options; | ||
placement: NzCascaderPlacement = 'topLeft'; | ||
readonly placements: NzCascaderPlacement[] = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']; | ||
|
||
setPlacement(placement: string | number): void { | ||
this.placement = placement as NzCascaderPlacement; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
order: 18 | ||
order: 19 | ||
title: | ||
zh-CN: 自定义状态 | ||
en-US: Status | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.