Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:tree-select): support to set placement (#7551)
* feat(module:tree-select): add status add 'nzStatus' , display diffrent status of tree-select * docs update 'nzStatus' docs * test add 'nzStatus' tests * docs(module:tree-select): update status docs * update 'status' demo * fix(module:tree-select): add 'NzSpaceModule' * fix module of demo need to depend on NzSpaceModule * feat(module:tree-select): add placement add 'nzPlacement' , display drop on diffrent placement of tree-select * docs update 'nzPlacement' docs * style(module:tree-select): update code style * style update code style * fix(module:tree-select): update nzPlacement * fix(module:tree-select): update nzPlacement * fix(module:tree-select): update nzPlacement * fix(module:tree-select): update nzPlacement demo Co-authored-by: wethin <806769481@qq.com>
- Loading branch information
Showing
6 changed files
with
103 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select'; | ||
import { NzIconModule } from 'ng-zorro-antd/icon'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { NzRadioModule } from 'ng-zorro-antd/radio'; | ||
import { NzSpaceModule } from 'ng-zorro-antd/space'; | ||
|
||
|
||
export const moduleList = [ FormsModule, NzTreeSelectModule, NzIconModule , NzSpaceModule]; | ||
export const moduleList = [ FormsModule, NzTreeSelectModule, NzIconModule , NzRadioModule , NzSpaceModule]; |
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,13 @@ | ||
--- | ||
order: 7 | ||
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,59 @@ | ||
import { Component } from '@angular/core'; | ||
export type NzPlacementType = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight' | ''; | ||
|
||
@Component({ | ||
selector: 'nz-demo-tree-select-placement', | ||
template: ` | ||
<nz-space nzDirection="vertical" style="width:100%;"> | ||
<nz-radio-group *nzSpaceItem [(ngModel)]="placement"> | ||
<label *ngFor="let item of list" nz-radio-button [nzValue]="item">{{ item }}</label> | ||
</nz-radio-group> | ||
<nz-tree-select | ||
*nzSpaceItem | ||
style="width: 120px" | ||
nzPlaceHolder="Please select" | ||
[nzPlacement]="placement" | ||
[(ngModel)]="value" | ||
[nzMaxTagCount]="3" | ||
[nzMaxTagPlaceholder]="omittedPlaceHolder" | ||
[nzNodes]="nodes" | ||
[nzDropdownStyle]="{ width: '300px' }" | ||
[nzDefaultExpandAll]="true" | ||
[nzAllowClear]="false" | ||
[nzMultiple]="true" | ||
(ngModelChange)="onChange($event)" | ||
></nz-tree-select> | ||
<ng-template #omittedPlaceHolder let-omittedValues>and {{ omittedValues.length }} more...</ng-template> | ||
</nz-space> | ||
` | ||
}) | ||
export class NzDemoTreeSelectPlacementComponent { | ||
list: NzPlacementType[] = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']; | ||
placement: NzPlacementType = 'topLeft'; | ||
value: string[] = []; | ||
nodes = [ | ||
{ | ||
title: 'parent 1', | ||
key: '100', | ||
children: [ | ||
{ | ||
title: 'parent 1-0', | ||
key: '1001', | ||
children: [ | ||
{ title: 'leaf 1-0-0', key: '10010', isLeaf: true }, | ||
{ title: 'leaf 1-0-1', key: '10011', isLeaf: true } | ||
] | ||
}, | ||
{ | ||
title: 'parent 1-1', | ||
key: '1002', | ||
children: [{ title: 'leaf 1-1-0', key: '10020', isLeaf: true }] | ||
} | ||
] | ||
} | ||
]; | ||
|
||
onChange($event: string[]): void { | ||
console.log($event); | ||
} | ||
} |
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