@exhaustive-ui/mcp 0.0.0-stage → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +167 -2
- package/data/components/accordion.md +421 -0
- package/data/components/animateonscroll.md +163 -0
- package/data/components/autocomplete.md +1077 -0
- package/data/components/autofocus.md +38 -0
- package/data/components/avatar.md +417 -0
- package/data/components/badge.md +234 -0
- package/data/components/blockui.md +108 -0
- package/data/components/breadcrumb.md +178 -0
- package/data/components/button.md +774 -0
- package/data/components/card.md +138 -0
- package/data/components/carousel.md +440 -0
- package/data/components/cascadeselect.md +1387 -0
- package/data/components/chart.md +1178 -0
- package/data/components/checkbox.md +529 -0
- package/data/components/chip.md +180 -0
- package/data/components/colorpicker.md +301 -0
- package/data/components/confirmdialog.md +287 -0
- package/data/components/confirmpopup.md +417 -0
- package/data/components/contextmenu.md +491 -0
- package/data/components/dataview.md +600 -0
- package/data/components/datepicker.md +1262 -0
- package/data/components/dialog.md +622 -0
- package/data/components/divider.md +250 -0
- package/data/components/dock.md +500 -0
- package/data/components/dragdrop.md +285 -0
- package/data/components/drawer.md +510 -0
- package/data/components/dynamicdialog.md +109 -0
- package/data/components/editor.md +291 -0
- package/data/components/fieldset.md +182 -0
- package/data/components/fileupload.md +430 -0
- package/data/components/floatlabel.md +155 -0
- package/data/components/fluid.md +72 -0
- package/data/components/focustrap.md +65 -0
- package/data/components/galleria.md +627 -0
- package/data/components/iconfield.md +246 -0
- package/data/components/iftalabel.md +105 -0
- package/data/components/imagecompare.md +97 -0
- package/data/components/inplace.md +233 -0
- package/data/components/inputgroup.md +306 -0
- package/data/components/inputmask.md +518 -0
- package/data/components/inputnumber.md +675 -0
- package/data/components/inputotp.md +336 -0
- package/data/components/inputtext.md +488 -0
- package/data/components/keyfilter.md +85 -0
- package/data/components/knob.md +462 -0
- package/data/components/listbox.md +798 -0
- package/data/components/llms.md +28 -0
- package/data/components/megamenu.md +587 -0
- package/data/components/menu.md +483 -0
- package/data/components/menubar.md +462 -0
- package/data/components/message.md +449 -0
- package/data/components/metergroup.md +241 -0
- package/data/components/multiselect.md +1047 -0
- package/data/components/orderlist.md +342 -0
- package/data/components/organizationchart.md +197 -0
- package/data/components/overlay.md +217 -0
- package/data/components/paginator.md +314 -0
- package/data/components/panel.md +214 -0
- package/data/components/panelmenu.md +699 -0
- package/data/components/password.md +570 -0
- package/data/components/picklist.md +420 -0
- package/data/components/popover.md +378 -0
- package/data/components/progressbar.md +181 -0
- package/data/components/progressspinner.md +91 -0
- package/data/components/radiobutton.md +377 -0
- package/data/components/rating.md +312 -0
- package/data/components/ripple.md +89 -0
- package/data/components/scroller.md +122 -0
- package/data/components/scrollpanel.md +149 -0
- package/data/components/scrolltop.md +105 -0
- package/data/components/select.md +1206 -0
- package/data/components/selectbutton.md +356 -0
- package/data/components/skeleton.md +242 -0
- package/data/components/slider.md +337 -0
- package/data/components/speeddial.md +589 -0
- package/data/components/splitbutton.md +945 -0
- package/data/components/splitter.md +196 -0
- package/data/components/stepper.md +411 -0
- package/data/components/styleclass.md +126 -0
- package/data/components/table.md +4557 -0
- package/data/components/tabs.md +467 -0
- package/data/components/tag.md +200 -0
- package/data/components/terminal.md +118 -0
- package/data/components/textarea.md +416 -0
- package/data/components/tieredmenu.md +578 -0
- package/data/components/timeline.md +310 -0
- package/data/components/toast.md +596 -0
- package/data/components/togglebutton.md +356 -0
- package/data/components/toggleswitch.md +285 -0
- package/data/components/toolbar.md +182 -0
- package/data/components/tooltip.md +211 -0
- package/data/components/tree.md +746 -0
- package/data/components/treeselect.md +912 -0
- package/data/components/treetable.md +2814 -0
- package/data/components.json +43751 -0
- package/data/llms-full.txt +47433 -0
- package/data/llms.txt +121 -0
- package/data/manifest.json +46513 -0
- package/data/pages/accessibility.md +28 -0
- package/data/pages/animations.md +28 -0
- package/data/pages/configuration.md +210 -0
- package/data/pages/contribution.md +20 -0
- package/data/pages/customicons.md +20 -0
- package/data/pages/faq.md +20 -0
- package/data/pages/icons.md +66 -0
- package/data/pages/installation.md +71 -0
- package/data/pages/llms.md +61 -0
- package/data/pages/passthrough.md +32 -0
- package/data/pages/philosophy.md +28 -0
- package/data/pages/primeflex.md +20 -0
- package/data/pages/rtl.md +12 -0
- package/data/pages/styled.md +132 -0
- package/data/pages/tailwind.md +40 -0
- package/data/pages/unstyled.md +39 -0
- package/data/snapshot.json +9 -0
- package/dist/index.d.mts +448 -0
- package/dist/index.mjs +2501 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -3
|
@@ -0,0 +1,912 @@
|
|
|
1
|
+
# Angular TreeSelect Component
|
|
2
|
+
|
|
3
|
+
TreeSelect is a form component to choose from hierarchical data.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
Screen Reader Value to describe the component can either be provided with ariaLabelledby or ariaLabel props. The treeselect element has a combobox role in addition to aria-haspopup and aria-expanded attributes. The relation between the combobox and the popup is created with aria-controls that refers to the id of the popup. The popup list has an id that refers to the aria-controls attribute of the combobox element and uses tree as the role. Each list item has a treeitem role along with aria-label , aria-selected and aria-expanded attributes. In checkbox selection, aria-checked is used instead of aria-selected . Checkbox and toggle icons are hidden from screen readers as their parent element with treeitem role and attributes are used instead for readers and keyboard support. The container element of a treenode has the group role. The aria-setsize , aria-posinset and aria-level attributes are calculated implicitly and added to each treeitem. If filtering is enabled, filterInputProps can be defined to give aria-* props to the filter input element.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
TreeSelect is used as a controlled component with ng-model directive along with an options collection. Internally Tree component is used so the options model is based on TreeNode API. In single selection mode, value binding should be the key value of a node.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
15
|
+
import { FormsModule } from '@angular/forms';
|
|
16
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
17
|
+
import { NodeService } from '@/service/nodeservice';
|
|
18
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
template: `
|
|
22
|
+
<div class="card flex justify-center">
|
|
23
|
+
<p-treeselect class="md:w-80 w-full" [(ngModel)]="selectedNodes" [options]="nodes" placeholder="Select Item" />
|
|
24
|
+
</div>
|
|
25
|
+
`,
|
|
26
|
+
standalone: true,
|
|
27
|
+
imports: [TreeSelectModule, FormsModule],
|
|
28
|
+
providers: [NodeService]
|
|
29
|
+
})
|
|
30
|
+
export class TreeselectBasicDemo implements OnInit {
|
|
31
|
+
private nodeService = inject(NodeService);
|
|
32
|
+
nodes!: any[];
|
|
33
|
+
selectedNodes: any;
|
|
34
|
+
|
|
35
|
+
constructor() {
|
|
36
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ngOnInit() {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Checkbox
|
|
45
|
+
|
|
46
|
+
Selection of multiple nodes via checkboxes is enabled by configuring selectionMode as checkbox .
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
50
|
+
import { FormsModule } from '@angular/forms';
|
|
51
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
52
|
+
import { NodeService } from '@/service/nodeservice';
|
|
53
|
+
|
|
54
|
+
@Component({
|
|
55
|
+
template: `
|
|
56
|
+
<div class="card flex justify-center">
|
|
57
|
+
<p-treeselect class="w-full md:w-80" [(ngModel)]="selectedNodes" [options]="nodes" display="chip" [metaKeySelection]="false" selectionMode="checkbox" placeholder="Select Item" />
|
|
58
|
+
</div>
|
|
59
|
+
`,
|
|
60
|
+
standalone: true,
|
|
61
|
+
imports: [TreeSelectModule, FormsModule],
|
|
62
|
+
providers: [NodeService]
|
|
63
|
+
})
|
|
64
|
+
export class TreeselectCheckboxDemo implements OnInit {
|
|
65
|
+
private nodeService = inject(NodeService);
|
|
66
|
+
nodes!: any[];
|
|
67
|
+
selectedNodes: any;
|
|
68
|
+
|
|
69
|
+
constructor() {
|
|
70
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
ngOnInit() {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Clear Icon
|
|
79
|
+
|
|
80
|
+
When showClear is enabled, a clear icon is displayed to clear the value.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
84
|
+
import { FormsModule } from '@angular/forms';
|
|
85
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
86
|
+
import { NodeService } from '@/service/nodeservice';
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
template: `
|
|
90
|
+
<div class="card flex justify-center">
|
|
91
|
+
<p-treeselect [(ngModel)]="selectedNodes" [options]="nodes" placeholder="Select Item" class="md:w-80 w-full" [showClear]="true" />
|
|
92
|
+
</div>
|
|
93
|
+
`,
|
|
94
|
+
standalone: true,
|
|
95
|
+
imports: [TreeSelectModule, FormsModule],
|
|
96
|
+
providers: [NodeService]
|
|
97
|
+
})
|
|
98
|
+
export class TreeselectCleariconDemo implements OnInit {
|
|
99
|
+
private nodeService = inject(NodeService);
|
|
100
|
+
nodes!: any[];
|
|
101
|
+
selectedNodes: any;
|
|
102
|
+
|
|
103
|
+
constructor() {
|
|
104
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
ngOnInit() {
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Disabled
|
|
113
|
+
|
|
114
|
+
When disabled is present, the element cannot be edited and focused.
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
118
|
+
import { FormsModule } from '@angular/forms';
|
|
119
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
120
|
+
import { NodeService } from '@/service/nodeservice';
|
|
121
|
+
|
|
122
|
+
@Component({
|
|
123
|
+
template: `
|
|
124
|
+
<div class="card flex justify-center">
|
|
125
|
+
<p-treeselect class="md:w-80 w-full" [(ngModel)]="selectedNodes" [options]="nodes" [disabled]="true" placeholder="TreeSelect" />
|
|
126
|
+
</div>
|
|
127
|
+
`,
|
|
128
|
+
standalone: true,
|
|
129
|
+
imports: [TreeSelectModule, FormsModule],
|
|
130
|
+
providers: [NodeService]
|
|
131
|
+
})
|
|
132
|
+
export class TreeselectDisabledDemo implements OnInit {
|
|
133
|
+
private nodeService = inject(NodeService);
|
|
134
|
+
nodes!: any[];
|
|
135
|
+
selectedNodes: any;
|
|
136
|
+
|
|
137
|
+
constructor() {
|
|
138
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
ngOnInit() {
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Filled
|
|
147
|
+
|
|
148
|
+
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
152
|
+
import { FormsModule } from '@angular/forms';
|
|
153
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
154
|
+
import { NodeService } from '@/service/nodeservice';
|
|
155
|
+
|
|
156
|
+
@Component({
|
|
157
|
+
template: `
|
|
158
|
+
<div class="card flex justify-center">
|
|
159
|
+
<p-treeselect class="md:w-80 w-full" [(ngModel)]="selectedNodes" variant="filled" [options]="nodes" placeholder="Select Item" />
|
|
160
|
+
</div>
|
|
161
|
+
`,
|
|
162
|
+
standalone: true,
|
|
163
|
+
imports: [TreeSelectModule, FormsModule],
|
|
164
|
+
providers: [NodeService]
|
|
165
|
+
})
|
|
166
|
+
export class TreeselectFilledDemo implements OnInit {
|
|
167
|
+
private nodeService = inject(NodeService);
|
|
168
|
+
nodes!: any[];
|
|
169
|
+
selectedNodes: any;
|
|
170
|
+
|
|
171
|
+
constructor() {
|
|
172
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
ngOnInit() {
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Filter
|
|
181
|
+
|
|
182
|
+
Filtering is enabled by adding the filter property, by default label property of a node is used to compare against the value in the text field, in order to customize which field(s) should be used during search define filterBy property. In addition filterMode specifies the filtering strategy. In lenient mode when the query matches a node, children of the node are not searched further as all descendants of the node are included. On the other hand, in strict mode when the query matches a node, filtering continues on all descendants.
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
186
|
+
import { FormsModule } from '@angular/forms';
|
|
187
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
188
|
+
import { NodeService } from '@/service/nodeservice';
|
|
189
|
+
|
|
190
|
+
@Component({
|
|
191
|
+
template: `
|
|
192
|
+
<div class="card flex justify-center">
|
|
193
|
+
<p-treeselect class="md:w-80 w-full" [(ngModel)]="selectedNodes" [options]="nodes" placeholder="Select Item" [filter]="true" [filterInputAutoFocus]="true" />
|
|
194
|
+
</div>
|
|
195
|
+
`,
|
|
196
|
+
standalone: true,
|
|
197
|
+
imports: [TreeSelectModule, FormsModule],
|
|
198
|
+
providers: [NodeService]
|
|
199
|
+
})
|
|
200
|
+
export class TreeselectFilterDemo implements OnInit {
|
|
201
|
+
private nodeService = inject(NodeService);
|
|
202
|
+
nodes!: any[];
|
|
203
|
+
selectedNodes: any;
|
|
204
|
+
|
|
205
|
+
constructor() {
|
|
206
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
ngOnInit() {
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Float Label
|
|
215
|
+
|
|
216
|
+
A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
220
|
+
import { FormsModule } from '@angular/forms';
|
|
221
|
+
import { FloatLabelModule } from '@exhaustive-ui/core/floatlabel';
|
|
222
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
223
|
+
import { NodeService } from '@/service/nodeservice';
|
|
224
|
+
|
|
225
|
+
@Component({
|
|
226
|
+
template: `
|
|
227
|
+
<div class="card flex flex-wrap justify-center items-end gap-4">
|
|
228
|
+
<p-floatlabel class="w-full md:w-80">
|
|
229
|
+
<p-treeselect [(ngModel)]="value1" inputId="over_label" [options]="nodes" class="w-full" />
|
|
230
|
+
<label for="over_label">Over Label</label>
|
|
231
|
+
</p-floatlabel>
|
|
232
|
+
<p-floatlabel class="w-full md:w-80" variant="in">
|
|
233
|
+
<p-treeselect [(ngModel)]="value2" inputId="in_label" [options]="nodes" class="w-full" />
|
|
234
|
+
<label for="in_label">In Label</label>
|
|
235
|
+
</p-floatlabel>
|
|
236
|
+
<p-floatlabel class="w-full md:w-80" variant="on">
|
|
237
|
+
<p-treeselect [(ngModel)]="value3" inputId="on_label" [options]="nodes" class="w-full" />
|
|
238
|
+
<label for="on_label">On Label</label>
|
|
239
|
+
</p-floatlabel>
|
|
240
|
+
</div>
|
|
241
|
+
`,
|
|
242
|
+
standalone: true,
|
|
243
|
+
imports: [FloatLabelModule, TreeSelectModule, FormsModule],
|
|
244
|
+
providers: [NodeService]
|
|
245
|
+
})
|
|
246
|
+
export class TreeselectFloatlabelDemo implements OnInit {
|
|
247
|
+
private nodeService = inject(NodeService);
|
|
248
|
+
nodes!: any[];
|
|
249
|
+
value1: any;
|
|
250
|
+
value2: any;
|
|
251
|
+
value3: any;
|
|
252
|
+
|
|
253
|
+
constructor() {
|
|
254
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
ngOnInit() {
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Fluid
|
|
263
|
+
|
|
264
|
+
The fluid prop makes the component take up the full width of its container when set to true.
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
268
|
+
import { FormsModule } from '@angular/forms';
|
|
269
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
270
|
+
import { NodeService } from '@/service/nodeservice';
|
|
271
|
+
|
|
272
|
+
@Component({
|
|
273
|
+
template: `
|
|
274
|
+
<div class="card">
|
|
275
|
+
<p-treeselect [(ngModel)]="selectedNodes" [options]="nodes" placeholder="Select Item" fluid />
|
|
276
|
+
</div>
|
|
277
|
+
`,
|
|
278
|
+
standalone: true,
|
|
279
|
+
imports: [TreeSelectModule, FormsModule],
|
|
280
|
+
providers: [NodeService]
|
|
281
|
+
})
|
|
282
|
+
export class TreeselectFluidDemo implements OnInit {
|
|
283
|
+
private nodeService = inject(NodeService);
|
|
284
|
+
nodes!: any[];
|
|
285
|
+
selectedNodes: any;
|
|
286
|
+
|
|
287
|
+
constructor() {
|
|
288
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
ngOnInit() {
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Ifta Label
|
|
297
|
+
|
|
298
|
+
IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
302
|
+
import { FormsModule } from '@angular/forms';
|
|
303
|
+
import { IftaLabelModule } from '@exhaustive-ui/core/iftalabel';
|
|
304
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
305
|
+
import { NodeService } from '@/service/nodeservice';
|
|
306
|
+
|
|
307
|
+
@Component({
|
|
308
|
+
template: `
|
|
309
|
+
<div class="card flex justify-center">
|
|
310
|
+
<p-iftalabel class="w-full md:w-80">
|
|
311
|
+
<p-treeselect [(ngModel)]="selectedValue" inputId="t_file" [options]="nodes" class="w-full" />
|
|
312
|
+
<label for="t_file">File</label>
|
|
313
|
+
</p-iftalabel>
|
|
314
|
+
</div>
|
|
315
|
+
`,
|
|
316
|
+
standalone: true,
|
|
317
|
+
imports: [IftaLabelModule, TreeSelectModule, FormsModule],
|
|
318
|
+
providers: [NodeService]
|
|
319
|
+
})
|
|
320
|
+
export class TreeselectIftalabelDemo implements OnInit {
|
|
321
|
+
private nodeService = inject(NodeService);
|
|
322
|
+
nodes!: any[];
|
|
323
|
+
selectedValue: any;
|
|
324
|
+
|
|
325
|
+
constructor() {
|
|
326
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
ngOnInit() {
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Invalid
|
|
335
|
+
|
|
336
|
+
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with Angular Forms.
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
340
|
+
import { FormsModule } from '@angular/forms';
|
|
341
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
342
|
+
import { NodeService } from '@/service/nodeservice';
|
|
343
|
+
|
|
344
|
+
@Component({
|
|
345
|
+
template: `
|
|
346
|
+
<div class="card flex flex-wrap justify-center gap-4">
|
|
347
|
+
<p-treeselect [invalid]="selectedValue1 === undefined" [(ngModel)]="selectedValue1" [options]="nodes" placeholder="TreeSelect" class="md:w-80 w-full" />
|
|
348
|
+
<p-treeselect [invalid]="selectedValue2 === undefined" [(ngModel)]="selectedValue2" [options]="nodes" placeholder="TreeSelect" class="md:w-80 w-full" />
|
|
349
|
+
</div>
|
|
350
|
+
`,
|
|
351
|
+
standalone: true,
|
|
352
|
+
imports: [TreeSelectModule, FormsModule],
|
|
353
|
+
providers: [NodeService]
|
|
354
|
+
})
|
|
355
|
+
export class TreeselectInvalidDemo implements OnInit {
|
|
356
|
+
private nodeService = inject(NodeService);
|
|
357
|
+
nodes!: any[];
|
|
358
|
+
selectedValue1: any;
|
|
359
|
+
selectedValue2: any;
|
|
360
|
+
|
|
361
|
+
constructor() {
|
|
362
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
ngOnInit() {
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## Lazy
|
|
371
|
+
|
|
372
|
+
Lazy loading is useful when dealing with huge datasets, in this example nodes are dynamically loaded on demand using loading property and onNodeExpand method.
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
import { Component, OnInit, signal } from '@angular/core';
|
|
376
|
+
import { FormsModule } from '@angular/forms';
|
|
377
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
378
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
379
|
+
|
|
380
|
+
@Component({
|
|
381
|
+
template: `
|
|
382
|
+
<div class="card flex justify-center">
|
|
383
|
+
<p-treeselect
|
|
384
|
+
class="w-full md:w-80"
|
|
385
|
+
[(ngModel)]="selectedNodes"
|
|
386
|
+
(onNodeExpand)="onNodeExpand($event)"
|
|
387
|
+
[options]="nodes()"
|
|
388
|
+
display="chip"
|
|
389
|
+
[metaKeySelection]="false"
|
|
390
|
+
selectionMode="checkbox"
|
|
391
|
+
placeholder="Select Item"
|
|
392
|
+
[loading]="loading"
|
|
393
|
+
loadingMode="icon"
|
|
394
|
+
/>
|
|
395
|
+
</div>
|
|
396
|
+
`,
|
|
397
|
+
standalone: true,
|
|
398
|
+
imports: [TreeSelectModule, FormsModule]
|
|
399
|
+
})
|
|
400
|
+
export class TreeselectLazyDemo implements OnInit {
|
|
401
|
+
selectedNodes: TreeNode[] = [];
|
|
402
|
+
nodes = signal<TreeNode[]>(undefined);
|
|
403
|
+
loading = signal<boolean>(false);
|
|
404
|
+
|
|
405
|
+
ngOnInit() {
|
|
406
|
+
this.loading.set(true);
|
|
407
|
+
this.nodes.set(this.initiateNodes());
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
initiateNodes(): TreeNode[] {
|
|
411
|
+
return [
|
|
412
|
+
{
|
|
413
|
+
key: '0',
|
|
414
|
+
label: 'Node 0',
|
|
415
|
+
leaf: false,
|
|
416
|
+
loading: false
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
key: '1',
|
|
420
|
+
label: 'Node 1',
|
|
421
|
+
leaf: false,
|
|
422
|
+
loading: false
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
key: '2',
|
|
426
|
+
label: 'Node 2',
|
|
427
|
+
leaf: false,
|
|
428
|
+
loading: false
|
|
429
|
+
}
|
|
430
|
+
];
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
onNodeExpand(event: any) {
|
|
434
|
+
if (!event.node.children) {
|
|
435
|
+
event.node.loading = true;
|
|
436
|
+
|
|
437
|
+
setTimeout(() => {
|
|
438
|
+
const _nodes = this.nodes();
|
|
439
|
+
let _node = { ...event.node };
|
|
440
|
+
_node.children = [];
|
|
441
|
+
|
|
442
|
+
for (let i = 0; i < 3; i++) {
|
|
443
|
+
_node.children.push({
|
|
444
|
+
key: event.node.key + '-' + i,
|
|
445
|
+
label: 'Lazy ' + event.node.label + '-' + i
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const key = parseInt(_node.key, 10);
|
|
450
|
+
_nodes[key] = { ..._node, loading: false };
|
|
451
|
+
this.nodes.set([..._nodes]);
|
|
452
|
+
}, 500);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
## Multiple
|
|
459
|
+
|
|
460
|
+
More than one node is selectable by setting selectionMode to multiple . By default in multiple selection mode, metaKey press (e.g. ⌘ ) is necessary to add to existing selections however this can be configured with disabling the metaKeySelection property. Note that in touch enabled devices, TreeSelect always ignores metaKey. In multiple selection mode, value binding should be a key-value pair where key is the node key and value is a boolean to indicate selection.
|
|
461
|
+
|
|
462
|
+
```typescript
|
|
463
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
464
|
+
import { FormsModule } from '@angular/forms';
|
|
465
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
466
|
+
import { NodeService } from '@/service/nodeservice';
|
|
467
|
+
|
|
468
|
+
@Component({
|
|
469
|
+
template: `
|
|
470
|
+
<div class="card flex justify-center">
|
|
471
|
+
<p-treeselect class="w-full md:w-80" [(ngModel)]="selectedNodes" [options]="nodes" [metaKeySelection]="false" selectionMode="multiple" placeholder="Select Item" />
|
|
472
|
+
</div>
|
|
473
|
+
`,
|
|
474
|
+
standalone: true,
|
|
475
|
+
imports: [TreeSelectModule, FormsModule],
|
|
476
|
+
providers: [NodeService]
|
|
477
|
+
})
|
|
478
|
+
export class TreeselectMultipleDemo implements OnInit {
|
|
479
|
+
private nodeService = inject(NodeService);
|
|
480
|
+
nodes!: any[];
|
|
481
|
+
selectedNodes: any;
|
|
482
|
+
|
|
483
|
+
constructor() {
|
|
484
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
ngOnInit() {
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## reactiveforms-doc
|
|
493
|
+
|
|
494
|
+
TreeSelect can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
498
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
499
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
500
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
501
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
502
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
503
|
+
import { NodeService } from '@/service/nodeservice';
|
|
504
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
505
|
+
|
|
506
|
+
@Component({
|
|
507
|
+
template: `
|
|
508
|
+
<p-toast />
|
|
509
|
+
<div class="card flex justify-center">
|
|
510
|
+
<form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4 w-full md:w-80">
|
|
511
|
+
<div class="flex flex-col gap-1">
|
|
512
|
+
<p-treeselect class="md:w-80 w-full" formControlName="selectedNodes" [options]="nodes" placeholder="Select Item" [invalid]="isInvalid('selectedNodes')" />
|
|
513
|
+
@if (isInvalid('selectedNodes')) {
|
|
514
|
+
<p-message severity="error" size="small" variant="simple">Selection is required.</p-message>
|
|
515
|
+
}
|
|
516
|
+
</div>
|
|
517
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
518
|
+
</form>
|
|
519
|
+
</div>
|
|
520
|
+
`,
|
|
521
|
+
standalone: true,
|
|
522
|
+
imports: [MessageModule, ToastModule, TreeSelectModule, ButtonModule, ReactiveFormsModule],
|
|
523
|
+
providers: [NodeService]
|
|
524
|
+
})
|
|
525
|
+
export class TreeselectReactiveformsDemo implements OnInit {
|
|
526
|
+
private nodeService = inject(NodeService);
|
|
527
|
+
messageService = inject(MessageService);
|
|
528
|
+
nodes!: any[];
|
|
529
|
+
exampleForm: FormGroup | undefined;
|
|
530
|
+
formSubmitted: boolean = false;
|
|
531
|
+
|
|
532
|
+
constructor() {
|
|
533
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
534
|
+
this.exampleForm = this.fb.group({
|
|
535
|
+
selectedNodes: ['', Validators.required]
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
ngOnInit() {
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
onSubmit() {
|
|
543
|
+
this.formSubmitted = true;
|
|
544
|
+
if (this.exampleForm.valid) {
|
|
545
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form is submitted', life: 3000 });
|
|
546
|
+
this.exampleForm.reset();
|
|
547
|
+
this.formSubmitted = false;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
isInvalid(controlName: string) {
|
|
552
|
+
const control = this.exampleForm.get(controlName);
|
|
553
|
+
return control?.invalid && this.formSubmitted;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
## Sizes
|
|
559
|
+
|
|
560
|
+
TreeSelect provides small and large sizes as alternatives to the base.
|
|
561
|
+
|
|
562
|
+
```typescript
|
|
563
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
564
|
+
import { FormsModule } from '@angular/forms';
|
|
565
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
566
|
+
import { NodeService } from '@/service/nodeservice';
|
|
567
|
+
|
|
568
|
+
@Component({
|
|
569
|
+
template: `
|
|
570
|
+
<div class="card flex flex-col items-center gap-4">
|
|
571
|
+
<p-treeselect [(ngModel)]="value1" [options]="nodes" size="small" placeholder="Small" class="md:w-80 w-full" />
|
|
572
|
+
<p-treeselect [(ngModel)]="value2" [options]="nodes" placeholder="Normal" class="md:w-80 w-full" />
|
|
573
|
+
<p-treeselect [(ngModel)]="value3" [options]="nodes" size="large" placeholder="Large" class="md:w-80 w-full" />
|
|
574
|
+
</div>
|
|
575
|
+
`,
|
|
576
|
+
standalone: true,
|
|
577
|
+
imports: [TreeSelectModule, FormsModule],
|
|
578
|
+
providers: [NodeService]
|
|
579
|
+
})
|
|
580
|
+
export class TreeselectSizesDemo implements OnInit {
|
|
581
|
+
private nodeService = inject(NodeService);
|
|
582
|
+
nodes!: any[];
|
|
583
|
+
value1: any;
|
|
584
|
+
value2: any;
|
|
585
|
+
value3: any;
|
|
586
|
+
|
|
587
|
+
constructor() {
|
|
588
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
ngOnInit() {
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
## Template
|
|
597
|
+
|
|
598
|
+
TreeSelect offers multiple templates for customization through templating.
|
|
599
|
+
|
|
600
|
+
```typescript
|
|
601
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
602
|
+
import { FormsModule } from '@angular/forms';
|
|
603
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
604
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
605
|
+
import { NodeService } from '@/service/nodeservice';
|
|
606
|
+
|
|
607
|
+
@Component({
|
|
608
|
+
template: `
|
|
609
|
+
<div class="card flex justify-center">
|
|
610
|
+
<p-treeselect class="md:w-80 w-full" [(ngModel)]="selectedNodes" [options]="nodes" placeholder="Select Item">
|
|
611
|
+
<ng-template #dropdownicon>
|
|
612
|
+
<i class="pi pi-search"></i>
|
|
613
|
+
</ng-template>
|
|
614
|
+
<ng-template #header>
|
|
615
|
+
<div class="font-medium px-3 py-2">Available Files</div>
|
|
616
|
+
</ng-template>
|
|
617
|
+
<ng-template #footer>
|
|
618
|
+
<div class="px-3 pt-1 pb-2 flex justify-between">
|
|
619
|
+
<p-button label="Add New" severity="secondary" text size="small" icon="pi pi-plus" />
|
|
620
|
+
<p-button label="Remove All" severity="danger" text size="small" icon="pi pi-plus" />
|
|
621
|
+
</div>
|
|
622
|
+
</ng-template>
|
|
623
|
+
</p-treeselect>
|
|
624
|
+
</div>
|
|
625
|
+
`,
|
|
626
|
+
standalone: true,
|
|
627
|
+
imports: [ButtonModule, TreeSelectModule, FormsModule],
|
|
628
|
+
providers: [NodeService]
|
|
629
|
+
})
|
|
630
|
+
export class TreeselectTemplateDemo implements OnInit {
|
|
631
|
+
private nodeService = inject(NodeService);
|
|
632
|
+
nodes!: any[];
|
|
633
|
+
selectedNodes: any;
|
|
634
|
+
|
|
635
|
+
constructor() {
|
|
636
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
ngOnInit() {
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
## templatedrivenforms-doc
|
|
645
|
+
|
|
646
|
+
```typescript
|
|
647
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
648
|
+
import { FormsModule } from '@angular/forms';
|
|
649
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
650
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
651
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
652
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
653
|
+
import { NodeService } from '@/service/nodeservice';
|
|
654
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
655
|
+
|
|
656
|
+
@Component({
|
|
657
|
+
template: `
|
|
658
|
+
<p-toast />
|
|
659
|
+
<div class="card flex justify-center">
|
|
660
|
+
<form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex flex-col gap-4 w-full md:w-80">
|
|
661
|
+
<div class="flex flex-col gap-1">
|
|
662
|
+
<p-treeselect #node="ngModel" [(ngModel)]="selectedNodes" [invalid]="node.invalid && exampleForm.submitted" name="node" class="md:w-80 w-full" [options]="nodes" placeholder="Select Item" required />
|
|
663
|
+
@if (node.invalid && exampleForm.submitted) {
|
|
664
|
+
<p-message severity="error" size="small" variant="simple">Selection is required.</p-message>
|
|
665
|
+
}
|
|
666
|
+
</div>
|
|
667
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
668
|
+
</form>
|
|
669
|
+
</div>
|
|
670
|
+
`,
|
|
671
|
+
standalone: true,
|
|
672
|
+
imports: [MessageModule, ToastModule, TreeSelectModule, ButtonModule, FormsModule],
|
|
673
|
+
providers: [NodeService]
|
|
674
|
+
})
|
|
675
|
+
export class TreeselectTemplatedrivenformsDemo implements OnInit {
|
|
676
|
+
private nodeService = inject(NodeService);
|
|
677
|
+
messageService = inject(MessageService);
|
|
678
|
+
selectedNodes: any;
|
|
679
|
+
nodes!: any[];
|
|
680
|
+
|
|
681
|
+
constructor() {
|
|
682
|
+
this.nodeService.getFiles().then((files) => (this.nodes = files));
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
ngOnInit() {
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
onSubmit(form: any) {
|
|
689
|
+
if (form.valid) {
|
|
690
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
|
|
691
|
+
form.resetForm();
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
## virtualscroll-doc
|
|
698
|
+
|
|
699
|
+
VirtualScrolling is an efficient way of rendering the options by displaying a small subset of data in the viewport at any time. When dealing with huge number of options, it is suggested to enable VirtualScrolling to avoid performance issues. Usage is simple as setting virtualScroll property to true and defining virtualScrollItemSize to specify the height of an item.
|
|
700
|
+
|
|
701
|
+
```typescript
|
|
702
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
703
|
+
import { FormsModule } from '@angular/forms';
|
|
704
|
+
import { TreeSelectModule } from '@exhaustive-ui/core/treeselect';
|
|
705
|
+
import { NodeService } from '@/service/nodeservice';
|
|
706
|
+
|
|
707
|
+
@Component({
|
|
708
|
+
template: `
|
|
709
|
+
<div class="card flex justify-center">
|
|
710
|
+
<p-treeselect
|
|
711
|
+
class="w-full md:w-80"
|
|
712
|
+
[(ngModel)]="selectedNodes"
|
|
713
|
+
[options]="nodes"
|
|
714
|
+
display="chip"
|
|
715
|
+
[metaKeySelection]="false"
|
|
716
|
+
selectionMode="checkbox"
|
|
717
|
+
placeholder="Select Item"
|
|
718
|
+
[virtualScroll]="true"
|
|
719
|
+
[virtualScrollItemSize]="35"
|
|
720
|
+
[virtualScrollOptions]="{ scrollHeight: '200px' }"
|
|
721
|
+
></p-treeselect>
|
|
722
|
+
</div>
|
|
723
|
+
`,
|
|
724
|
+
standalone: true,
|
|
725
|
+
imports: [TreeSelectModule, FormsModule],
|
|
726
|
+
providers: [NodeService]
|
|
727
|
+
})
|
|
728
|
+
export class TreeselectVirtualscrollDemo implements OnInit {
|
|
729
|
+
private nodeService = inject(NodeService);
|
|
730
|
+
nodes!: any[];
|
|
731
|
+
selectedNodes: any;
|
|
732
|
+
|
|
733
|
+
constructor() {
|
|
734
|
+
this.nodeService.getLargeTreeNodes().then((files) => (this.nodes = files));
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
ngOnInit() {
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
## Tree Select
|
|
743
|
+
|
|
744
|
+
TreeSelect is a form component to choose from hierarchical data.
|
|
745
|
+
|
|
746
|
+
### Props
|
|
747
|
+
|
|
748
|
+
| Name | Type | Default | Description |
|
|
749
|
+
|------|------|---------|-------------|
|
|
750
|
+
| dt | InputSignal<Object> | undefined | Defines scoped design tokens of the component. |
|
|
751
|
+
| unstyled | InputSignal<boolean> | undefined | Indicates whether the component should be rendered without styles. |
|
|
752
|
+
| pt | InputSignal<TreeSelectPassThrough> | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
753
|
+
| ptOptions | InputSignal<PassThroughOptions> | undefined | Used to configure passthrough(pt) options of the component. |
|
|
754
|
+
| required | InputSignalWithTransform<boolean, unknown> | false | There must be a value (if set). |
|
|
755
|
+
| invalid | InputSignalWithTransform<boolean, unknown> | false | When present, it specifies that the component should have invalid state style. |
|
|
756
|
+
| disabled | InputSignalWithTransform<boolean, unknown> | false | When present, it specifies that the component should have disabled state style. |
|
|
757
|
+
| name | InputSignal<string> | undefined | When present, it specifies that the name of the input. |
|
|
758
|
+
| inputId | InputSignal<string> | ... | Identifier of the underlying input element. |
|
|
759
|
+
| scrollHeight | InputSignal<string> | ... | Height of the viewport, a scrollbar is defined if height of list exceeds this value. |
|
|
760
|
+
| metaKeySelection | InputSignalWithTransform<boolean, unknown> | ... | Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item can be toggled individually. On touch enabled devices, metaKeySelection is turned off automatically. |
|
|
761
|
+
| display | InputSignal<"chip" \| "comma"> | ... | Defines how the selected items are displayed. |
|
|
762
|
+
| selectionMode | InputSignal<"multiple" \| "single" \| "checkbox"> | ... | Defines the selection mode. |
|
|
763
|
+
| tabindex | InputSignal<string> | ... | Index of the element in tabbing order. |
|
|
764
|
+
| ariaLabel | InputSignal<string> | ... | Defines a string that labels the input for accessibility. |
|
|
765
|
+
| ariaLabelledBy | InputSignal<string> | ... | Establishes relationships between the component and label(s) where its value should be one or more element IDs. |
|
|
766
|
+
| placeholder | InputSignal<string> | ... | Label to display when there are no selections. |
|
|
767
|
+
| panelClass | InputSignal<string \| string[] \| Set<string> \| { [klass: string]: any }> | ... | Style class of the overlay panel. |
|
|
768
|
+
| panelStyle | InputSignal<{ [klass: string]: any }> | ... | Inline style of the panel element. |
|
|
769
|
+
| panelStyleClass | InputSignal<string> | ... | Style class of the panel element. |
|
|
770
|
+
| labelStyle | InputSignal<{ [klass: string]: any }> | ... | Inline style of the label element. |
|
|
771
|
+
| labelStyleClass | InputSignal<string> | ... | Style class of the label element. |
|
|
772
|
+
| overlayOptions | InputSignal<OverlayOptions> | ... | Specifies the options for the overlay. |
|
|
773
|
+
| emptyMessage | InputSignal<string> | ... | Text to display when there are no options available. Defaults to value from Exhaustive locale configuration. |
|
|
774
|
+
| filter | InputSignalWithTransform<boolean, unknown> | ... | When specified, displays an input field to filter the items. |
|
|
775
|
+
| filterBy | InputSignal<string> | ... | When filtering is enabled, filterBy decides which field or fields (comma separated) to search against. |
|
|
776
|
+
| filterMode | InputSignal<string> | ... | Mode for filtering valid values are "lenient" and "strict". Default is lenient. |
|
|
777
|
+
| filterPlaceholder | InputSignal<string> | ... | Placeholder text to show when filter input is empty. |
|
|
778
|
+
| filterLocale | InputSignal<string> | ... | Locale to use in filtering. The default locale is the host environment's current locale. |
|
|
779
|
+
| filterInputAutoFocus | InputSignalWithTransform<boolean, unknown> | ... | Determines whether the filter input should be automatically focused when the component is rendered. |
|
|
780
|
+
| propagateSelectionDown | InputSignalWithTransform<boolean, unknown> | ... | Whether checkbox selections propagate to descendant nodes. |
|
|
781
|
+
| propagateSelectionUp | InputSignalWithTransform<boolean, unknown> | ... | Whether checkbox selections propagate to ancestor nodes. |
|
|
782
|
+
| showClear | InputSignalWithTransform<boolean, unknown> | ... | When enabled, a clear icon is displayed to clear the value. |
|
|
783
|
+
| resetFilterOnHide | InputSignalWithTransform<boolean, unknown> | ... | Clears the filter value when hiding the dropdown. |
|
|
784
|
+
| virtualScroll | InputSignal<boolean> | ... | Whether the data should be loaded on demand during scroll. |
|
|
785
|
+
| virtualScrollItemSize | InputSignal<number> | ... | Height of an item in the list for VirtualScrolling. |
|
|
786
|
+
| virtualScrollOptions | InputSignal<ScrollerOptions> | ... | Whether to use the scroller feature. The properties of scroller component can be used like an object in it. |
|
|
787
|
+
| autofocus | InputSignalWithTransform<boolean, unknown> | ... | When present, it specifies that the component should automatically get focus on load. |
|
|
788
|
+
| options | InputSignal<TreeNode<any>[]> | undefined | An array of treenodes. |
|
|
789
|
+
| loading | InputSignalWithTransform<boolean, unknown> | ... | Displays a loader to indicate data load is in progress. |
|
|
790
|
+
| loadingMode | InputSignal<"mask" \| "icon"> | ... | Loading mode display. |
|
|
791
|
+
| size | InputSignal<"small" \| "large"> | undefined | Specifies the size of the component. |
|
|
792
|
+
| variant | InputSignal<"outlined" \| "filled"> | undefined | Specifies the input variant of the component. |
|
|
793
|
+
| fluid | InputSignalWithTransform<boolean, unknown> | undefined | Spans 100% width of the container when enabled. |
|
|
794
|
+
| appendTo | InputSignal<any> | 'self' | Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name). |
|
|
795
|
+
| motionOptions | InputSignal<MotionOptions> | ... | The motion options. |
|
|
796
|
+
|
|
797
|
+
### Emits
|
|
798
|
+
|
|
799
|
+
| Name | Parameters | Description |
|
|
800
|
+
|------|------------|-------------|
|
|
801
|
+
| onNodeExpand | event: TreeSelectNodeExpandEvent | Callback to invoke when a node is expanded. |
|
|
802
|
+
| onNodeCollapse | event: TreeSelectNodeCollapseEvent | Callback to invoke when a node is collapsed. |
|
|
803
|
+
| onShow | value: any | Callback to invoke when the overlay is shown. |
|
|
804
|
+
| onHide | event: Event | Callback to invoke when the overlay is hidden. |
|
|
805
|
+
| onClear | value: any | Callback to invoke when input field is cleared. |
|
|
806
|
+
| onFilter | event: TreeFilterEvent | Callback to invoke when data is filtered. |
|
|
807
|
+
| onFocus | event: Event | Callback to invoke when treeselect gets focus. |
|
|
808
|
+
| onBlur | event: Event | Callback to invoke when treeselect loses focus. |
|
|
809
|
+
| onNodeUnselect | event: TreeNodeUnSelectEvent | Callback to invoke when a node is unselected. |
|
|
810
|
+
| onNodeSelect | event: TreeNodeSelectEvent | Callback to invoke when a node is selected. |
|
|
811
|
+
|
|
812
|
+
### Templates
|
|
813
|
+
|
|
814
|
+
| Name | Type | Description |
|
|
815
|
+
|------|------|-------------|
|
|
816
|
+
| value | TemplateRef<TreeSelectValueTemplateContext> | Custom value template. |
|
|
817
|
+
| header | TemplateRef<TreeSelectHeaderTemplateContext> | Custom header template. |
|
|
818
|
+
| empty | TemplateRef<void> | Custom empty message template. |
|
|
819
|
+
| footer | TemplateRef<TreeSelectHeaderTemplateContext> | Custom footer template. |
|
|
820
|
+
| clearicon | TemplateRef<void> | Custom clear icon template. |
|
|
821
|
+
| triggericon | TemplateRef<void> | Custom trigger icon template. |
|
|
822
|
+
| dropdownicon | TemplateRef<void> | Custom dropdown icon template. |
|
|
823
|
+
| filtericon | TemplateRef<void> | Custom filter icon template. |
|
|
824
|
+
| itemtogglericon | TemplateRef<TreeSelectItemTogglerIconTemplateContext> | Custom item toggler icon template. |
|
|
825
|
+
| itemcheckboxicon | TemplateRef<TreeSelectItemCheckboxIconTemplateContext> | Custom item checkbox icon template. |
|
|
826
|
+
| itemloadingicon | TemplateRef<void> | Custom item loading icon template. |
|
|
827
|
+
|
|
828
|
+
## Pass Through Options
|
|
829
|
+
|
|
830
|
+
| Name | Type | Description |
|
|
831
|
+
|------|------|-------------|
|
|
832
|
+
| host | PassThroughOption<HTMLElement, I> | Used to pass attributes to the host's DOM element. |
|
|
833
|
+
| root | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the root's DOM element. |
|
|
834
|
+
| hiddenInputContainer | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the hidden input container's DOM element. |
|
|
835
|
+
| hiddenInput | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the hidden input's DOM element. |
|
|
836
|
+
| labelContainer | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the label container's DOM element. |
|
|
837
|
+
| label | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the label's DOM element. |
|
|
838
|
+
| chipItem | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the chip item's DOM element. |
|
|
839
|
+
| pcChip | ChipPassThrough | Used to pass attributes to the Chip component. |
|
|
840
|
+
| clearIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the clear icon's DOM element. |
|
|
841
|
+
| dropdown | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the dropdown's DOM element. |
|
|
842
|
+
| dropdownIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the dropdown icon's DOM element. |
|
|
843
|
+
| panel | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the panel's DOM element. |
|
|
844
|
+
| hiddenFirstFocusableEl | PassThroughOption<HTMLElement, I> | Used to pass attributes to the first hidden focusable element's DOM element. |
|
|
845
|
+
| treeContainer | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the tree container's DOM element. |
|
|
846
|
+
| pcTree | TreePassThrough | Used to pass attributes to the Tree component. |
|
|
847
|
+
| hiddenLastFocusableEl | PassThroughOption<HTMLElement, I> | Used to pass attributes to the last hidden focusable element's DOM element. |
|
|
848
|
+
| pcOverlay | OverlayPassThrough | Used to pass attributes to the Overlay component. |
|
|
849
|
+
|
|
850
|
+
## Theming
|
|
851
|
+
|
|
852
|
+
### CSS Classes
|
|
853
|
+
|
|
854
|
+
| Class | Description |
|
|
855
|
+
|-------|-------------|
|
|
856
|
+
| p-treeselect | Class name of the root element |
|
|
857
|
+
| p-treeselect-label-container | Class name of the label container element |
|
|
858
|
+
| p-treeselect-label | Class name of the label element |
|
|
859
|
+
| p-treeselect-chip-item | Class name of the chip item element |
|
|
860
|
+
| p-treeselect-clear-icon | Class name of the clear icon element |
|
|
861
|
+
| p-treeselect-chip | Class name of the chip element |
|
|
862
|
+
| p-treeselect-dropdown | Class name of the dropdown element |
|
|
863
|
+
| p-treeselect-dropdown-icon | Class name of the dropdown icon element |
|
|
864
|
+
| p-treeselect-overlay | Class name of the panel element |
|
|
865
|
+
| p-treeselect-tree-container | Class name of the tree container element |
|
|
866
|
+
| p-treeselect-empty-message | Class name of the empty message element |
|
|
867
|
+
|
|
868
|
+
### Design Tokens
|
|
869
|
+
|
|
870
|
+
| Token | CSS Variable | Description |
|
|
871
|
+
|-------|--------------|-------------|
|
|
872
|
+
| treeselect.background | --p-treeselect-background | Background of root |
|
|
873
|
+
| treeselect.disabled.background | --p-treeselect-disabled-background | Disabled background of root |
|
|
874
|
+
| treeselect.filled.background | --p-treeselect-filled-background | Filled background of root |
|
|
875
|
+
| treeselect.filled.hover.background | --p-treeselect-filled-hover-background | Filled hover background of root |
|
|
876
|
+
| treeselect.filled.focus.background | --p-treeselect-filled-focus-background | Filled focus background of root |
|
|
877
|
+
| treeselect.border.color | --p-treeselect-border-color | Border color of root |
|
|
878
|
+
| treeselect.hover.border.color | --p-treeselect-hover-border-color | Hover border color of root |
|
|
879
|
+
| treeselect.focus.border.color | --p-treeselect-focus-border-color | Focus border color of root |
|
|
880
|
+
| treeselect.invalid.border.color | --p-treeselect-invalid-border-color | Invalid border color of root |
|
|
881
|
+
| treeselect.color | --p-treeselect-color | Color of root |
|
|
882
|
+
| treeselect.disabled.color | --p-treeselect-disabled-color | Disabled color of root |
|
|
883
|
+
| treeselect.placeholder.color | --p-treeselect-placeholder-color | Placeholder color of root |
|
|
884
|
+
| treeselect.invalid.placeholder.color | --p-treeselect-invalid-placeholder-color | Invalid placeholder color of root |
|
|
885
|
+
| treeselect.shadow | --p-treeselect-shadow | Shadow of root |
|
|
886
|
+
| treeselect.padding.x | --p-treeselect-padding-x | Padding x of root |
|
|
887
|
+
| treeselect.padding.y | --p-treeselect-padding-y | Padding y of root |
|
|
888
|
+
| treeselect.border.radius | --p-treeselect-border-radius | Border radius of root |
|
|
889
|
+
| treeselect.focus.ring.width | --p-treeselect-focus-ring-width | Focus ring width of root |
|
|
890
|
+
| treeselect.focus.ring.style | --p-treeselect-focus-ring-style | Focus ring style of root |
|
|
891
|
+
| treeselect.focus.ring.color | --p-treeselect-focus-ring-color | Focus ring color of root |
|
|
892
|
+
| treeselect.focus.ring.offset | --p-treeselect-focus-ring-offset | Focus ring offset of root |
|
|
893
|
+
| treeselect.focus.ring.shadow | --p-treeselect-focus-ring-shadow | Focus ring shadow of root |
|
|
894
|
+
| treeselect.transition.duration | --p-treeselect-transition-duration | Transition duration of root |
|
|
895
|
+
| treeselect.sm.font.size | --p-treeselect-sm-font-size | Sm font size of root |
|
|
896
|
+
| treeselect.sm.padding.x | --p-treeselect-sm-padding-x | Sm padding x of root |
|
|
897
|
+
| treeselect.sm.padding.y | --p-treeselect-sm-padding-y | Sm padding y of root |
|
|
898
|
+
| treeselect.lg.font.size | --p-treeselect-lg-font-size | Lg font size of root |
|
|
899
|
+
| treeselect.lg.padding.x | --p-treeselect-lg-padding-x | Lg padding x of root |
|
|
900
|
+
| treeselect.lg.padding.y | --p-treeselect-lg-padding-y | Lg padding y of root |
|
|
901
|
+
| treeselect.dropdown.width | --p-treeselect-dropdown-width | Width of dropdown |
|
|
902
|
+
| treeselect.dropdown.color | --p-treeselect-dropdown-color | Color of dropdown |
|
|
903
|
+
| treeselect.overlay.background | --p-treeselect-overlay-background | Background of overlay |
|
|
904
|
+
| treeselect.overlay.border.color | --p-treeselect-overlay-border-color | Border color of overlay |
|
|
905
|
+
| treeselect.overlay.border.radius | --p-treeselect-overlay-border-radius | Border radius of overlay |
|
|
906
|
+
| treeselect.overlay.color | --p-treeselect-overlay-color | Color of overlay |
|
|
907
|
+
| treeselect.overlay.shadow | --p-treeselect-overlay-shadow | Shadow of overlay |
|
|
908
|
+
| treeselect.tree.padding | --p-treeselect-tree-padding | Padding of tree |
|
|
909
|
+
| treeselect.clear.icon.color | --p-treeselect-clear-icon-color | Color of clear icon |
|
|
910
|
+
| treeselect.empty.message.padding | --p-treeselect-empty-message-padding | Padding of empty message |
|
|
911
|
+
| treeselect.chip.border.radius | --p-treeselect-chip-border-radius | Border radius of chip |
|
|
912
|
+
|