forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
placement.ts
59 lines (57 loc) · 1.77 KB
/
placement.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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);
}
}