@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.
Files changed (121) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +167 -2
  3. package/data/components/accordion.md +421 -0
  4. package/data/components/animateonscroll.md +163 -0
  5. package/data/components/autocomplete.md +1077 -0
  6. package/data/components/autofocus.md +38 -0
  7. package/data/components/avatar.md +417 -0
  8. package/data/components/badge.md +234 -0
  9. package/data/components/blockui.md +108 -0
  10. package/data/components/breadcrumb.md +178 -0
  11. package/data/components/button.md +774 -0
  12. package/data/components/card.md +138 -0
  13. package/data/components/carousel.md +440 -0
  14. package/data/components/cascadeselect.md +1387 -0
  15. package/data/components/chart.md +1178 -0
  16. package/data/components/checkbox.md +529 -0
  17. package/data/components/chip.md +180 -0
  18. package/data/components/colorpicker.md +301 -0
  19. package/data/components/confirmdialog.md +287 -0
  20. package/data/components/confirmpopup.md +417 -0
  21. package/data/components/contextmenu.md +491 -0
  22. package/data/components/dataview.md +600 -0
  23. package/data/components/datepicker.md +1262 -0
  24. package/data/components/dialog.md +622 -0
  25. package/data/components/divider.md +250 -0
  26. package/data/components/dock.md +500 -0
  27. package/data/components/dragdrop.md +285 -0
  28. package/data/components/drawer.md +510 -0
  29. package/data/components/dynamicdialog.md +109 -0
  30. package/data/components/editor.md +291 -0
  31. package/data/components/fieldset.md +182 -0
  32. package/data/components/fileupload.md +430 -0
  33. package/data/components/floatlabel.md +155 -0
  34. package/data/components/fluid.md +72 -0
  35. package/data/components/focustrap.md +65 -0
  36. package/data/components/galleria.md +627 -0
  37. package/data/components/iconfield.md +246 -0
  38. package/data/components/iftalabel.md +105 -0
  39. package/data/components/imagecompare.md +97 -0
  40. package/data/components/inplace.md +233 -0
  41. package/data/components/inputgroup.md +306 -0
  42. package/data/components/inputmask.md +518 -0
  43. package/data/components/inputnumber.md +675 -0
  44. package/data/components/inputotp.md +336 -0
  45. package/data/components/inputtext.md +488 -0
  46. package/data/components/keyfilter.md +85 -0
  47. package/data/components/knob.md +462 -0
  48. package/data/components/listbox.md +798 -0
  49. package/data/components/llms.md +28 -0
  50. package/data/components/megamenu.md +587 -0
  51. package/data/components/menu.md +483 -0
  52. package/data/components/menubar.md +462 -0
  53. package/data/components/message.md +449 -0
  54. package/data/components/metergroup.md +241 -0
  55. package/data/components/multiselect.md +1047 -0
  56. package/data/components/orderlist.md +342 -0
  57. package/data/components/organizationchart.md +197 -0
  58. package/data/components/overlay.md +217 -0
  59. package/data/components/paginator.md +314 -0
  60. package/data/components/panel.md +214 -0
  61. package/data/components/panelmenu.md +699 -0
  62. package/data/components/password.md +570 -0
  63. package/data/components/picklist.md +420 -0
  64. package/data/components/popover.md +378 -0
  65. package/data/components/progressbar.md +181 -0
  66. package/data/components/progressspinner.md +91 -0
  67. package/data/components/radiobutton.md +377 -0
  68. package/data/components/rating.md +312 -0
  69. package/data/components/ripple.md +89 -0
  70. package/data/components/scroller.md +122 -0
  71. package/data/components/scrollpanel.md +149 -0
  72. package/data/components/scrolltop.md +105 -0
  73. package/data/components/select.md +1206 -0
  74. package/data/components/selectbutton.md +356 -0
  75. package/data/components/skeleton.md +242 -0
  76. package/data/components/slider.md +337 -0
  77. package/data/components/speeddial.md +589 -0
  78. package/data/components/splitbutton.md +945 -0
  79. package/data/components/splitter.md +196 -0
  80. package/data/components/stepper.md +411 -0
  81. package/data/components/styleclass.md +126 -0
  82. package/data/components/table.md +4557 -0
  83. package/data/components/tabs.md +467 -0
  84. package/data/components/tag.md +200 -0
  85. package/data/components/terminal.md +118 -0
  86. package/data/components/textarea.md +416 -0
  87. package/data/components/tieredmenu.md +578 -0
  88. package/data/components/timeline.md +310 -0
  89. package/data/components/toast.md +596 -0
  90. package/data/components/togglebutton.md +356 -0
  91. package/data/components/toggleswitch.md +285 -0
  92. package/data/components/toolbar.md +182 -0
  93. package/data/components/tooltip.md +211 -0
  94. package/data/components/tree.md +746 -0
  95. package/data/components/treeselect.md +912 -0
  96. package/data/components/treetable.md +2814 -0
  97. package/data/components.json +43751 -0
  98. package/data/llms-full.txt +47433 -0
  99. package/data/llms.txt +121 -0
  100. package/data/manifest.json +46513 -0
  101. package/data/pages/accessibility.md +28 -0
  102. package/data/pages/animations.md +28 -0
  103. package/data/pages/configuration.md +210 -0
  104. package/data/pages/contribution.md +20 -0
  105. package/data/pages/customicons.md +20 -0
  106. package/data/pages/faq.md +20 -0
  107. package/data/pages/icons.md +66 -0
  108. package/data/pages/installation.md +71 -0
  109. package/data/pages/llms.md +61 -0
  110. package/data/pages/passthrough.md +32 -0
  111. package/data/pages/philosophy.md +28 -0
  112. package/data/pages/primeflex.md +20 -0
  113. package/data/pages/rtl.md +12 -0
  114. package/data/pages/styled.md +132 -0
  115. package/data/pages/tailwind.md +40 -0
  116. package/data/pages/unstyled.md +39 -0
  117. package/data/snapshot.json +9 -0
  118. package/dist/index.d.mts +448 -0
  119. package/dist/index.mjs +2501 -0
  120. package/dist/index.mjs.map +1 -0
  121. package/package.json +67 -3
@@ -0,0 +1,746 @@
1
+ # Angular Tree Component
2
+
3
+ Tree is used to display hierarchical data.
4
+
5
+ ## Accessibility
6
+
7
+ Screen Reader Value to describe the component can either be provided with aria-labelledby or aria-label props. The root list element has a tree role whereas 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 . The container element of a treenode has the group role. 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 aria-setsize , aria-posinset and aria-level attributes are calculated implicitly and added to each treeitem. Keyboard Support Key Function tab Moves focus to the first selected node when focus enters the component, if there is none then first element receives the focus. If focus is already inside the component, moves focus to the next focusable element in the page tab sequence. shift + tab Moves focus to the last selected node when focus enters the component, if there is none then first element receives the focus. If focus is already inside the component, moves focus to the previous focusable element in the page tab sequence. enter Selects the focused treenode. space Selects the focused treenode. down arrow Moves focus to the next treenode. up arrow Moves focus to the previous treenode. right arrow If node is closed, opens the node otherwise moves focus to the first child node. left arrow If node is open, closes the node otherwise moves focus to the parent node.
8
+
9
+ ## Basic
10
+
11
+ Tree component requires an array of TreeNode objects as its value .
12
+
13
+ ```typescript
14
+ import { Component, OnInit, inject, signal } from '@angular/core';
15
+ import { TreeModule } from '@exhaustive-ui/core/tree';
16
+ import { NodeService } from '@/service/nodeservice';
17
+ import { TreeNode } from '@exhaustive-ui/core/api';
18
+
19
+ @Component({
20
+ template: `
21
+ <div class="card">
22
+ <p-tree [value]="files()" class="w-full md:w-[30rem]" />
23
+ </div>
24
+ `,
25
+ standalone: true,
26
+ imports: [TreeModule],
27
+ providers: [NodeService]
28
+ })
29
+ export class TreeBasicDemo implements OnInit {
30
+ private nodeService = inject(NodeService);
31
+ files = signal<TreeNode[]>(undefined);
32
+
33
+ ngOnInit() {
34
+ this.nodeService.getFiles().then((data) => {
35
+ this.files.set(data);
36
+ });
37
+ }
38
+ }
39
+ ```
40
+
41
+ ## Checkbox
42
+
43
+ Selection of multiple nodes via checkboxes is enabled by configuring selectionMode as checkbox .
44
+
45
+ ```typescript
46
+ import { Component, OnInit, inject, signal } from '@angular/core';
47
+ import { TreeModule } from '@exhaustive-ui/core/tree';
48
+ import { NodeService } from '@/service/nodeservice';
49
+ import { TreeNode } from '@exhaustive-ui/core/api';
50
+
51
+ @Component({
52
+ template: `
53
+ <div class="card">
54
+ <p-tree [value]="files()" selectionMode="checkbox" class="w-full md:w-[30rem]" [(selection)]="selectedFiles" />
55
+ </div>
56
+ `,
57
+ standalone: true,
58
+ imports: [TreeModule],
59
+ providers: [NodeService]
60
+ })
61
+ export class TreeCheckboxDemo implements OnInit {
62
+ private nodeService = inject(NodeService);
63
+ files = signal<TreeNode[]>(undefined);
64
+ selectedFiles!: TreeNode[];
65
+
66
+ ngOnInit() {
67
+ this.nodeService.getFiles().then((data) => {
68
+ this.files.set(data);
69
+ });
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## Context Menu
75
+
76
+ Tree has exclusive integration with ContextMenu using the contextMenu property along with the contextMenuSelection to manage the selection.
77
+
78
+ ```typescript
79
+ import { Component, OnInit, inject, signal } from '@angular/core';
80
+ import { ContextMenu, ContextMenuModule } from '@exhaustive-ui/core/contextmenu';
81
+ import { ToastModule } from '@exhaustive-ui/core/toast';
82
+ import { TreeModule } from '@exhaustive-ui/core/tree';
83
+ import { NodeService } from '@/service/nodeservice';
84
+ import { TreeNode, MenuItem, MessageService } from '@exhaustive-ui/core/api';
85
+ import { ContextMenu } from '@exhaustive-ui/core/contextmenu';
86
+
87
+ @Component({
88
+ template: `
89
+ <div class="card">
90
+ <p-toast [style]="{ marginTop: '80px' }" />
91
+ <p-tree [value]="files()" class="w-full md:w-80" selectionMode="single" [(selection)]="selectedNode" [(contextMenuSelection)]="contextMenuNode" [contextMenu]="cm" contextMenuSelectionMode="separate" />
92
+ <p-contextmenu #cm [model]="items" />
93
+ </div>
94
+ `,
95
+ standalone: true,
96
+ imports: [ContextMenuModule, ToastModule, TreeModule],
97
+ providers: [NodeService, MessageService]
98
+ })
99
+ export class TreeContextmenuDemo implements OnInit {
100
+ private nodeService = inject(NodeService);
101
+ private messageService = inject(MessageService);
102
+ files = signal<TreeNode[]>([]);
103
+ selectedNode: any = model<TreeNode | null>(null);
104
+ contextMenuNode: any = model<TreeNode | null>(null);
105
+ items!: MenuItem[];
106
+
107
+ ngOnInit() {
108
+ this.nodeService.getFiles().then((files) => this.files.set(files));
109
+ this.items = [
110
+ { label: 'View', icon: 'pi pi-search', command: () => this.viewFile(this.contextMenuNode()) },
111
+ { label: 'Toggle', icon: 'pi pi-sort', command: () => this.toggleFile(this.contextMenuNode()) }
112
+ ];
113
+ }
114
+
115
+ viewFile(node: TreeNode | null) {
116
+ if (node) {
117
+ this.messageService.add({ severity: 'info', summary: 'File Selected', detail: node.label });
118
+ }
119
+ }
120
+
121
+ toggleFile(node: TreeNode | null) {
122
+ if (node) {
123
+ this.files.set(this.updateNodeInTree(this.files(), node.key, { ...node, expanded: !node.expanded }));
124
+ }
125
+ }
126
+
127
+ updateNodeInTree(nodes: TreeNode[], key: string | undefined, updatedNode: TreeNode): TreeNode[] {
128
+ return nodes.map((n) => {
129
+ if (n.key === key) {
130
+ return updatedNode;
131
+ }
132
+ if (n.children) {
133
+ return { ...n, children: this.updateNodeInTree(n.children, key, updatedNode) };
134
+ }
135
+ return n;
136
+ });
137
+ }
138
+ }
139
+ ```
140
+
141
+ ## Controlled
142
+
143
+ Tree requires a collection of TreeNode instances as a value .
144
+
145
+ ```typescript
146
+ import { Component, OnInit, inject, signal } from '@angular/core';
147
+ import { ButtonModule } from '@exhaustive-ui/core/button';
148
+ import { TreeModule } from '@exhaustive-ui/core/tree';
149
+ import { NodeService } from '@/service/nodeservice';
150
+ import { TreeNode } from '@exhaustive-ui/core/api';
151
+
152
+ @Component({
153
+ template: `
154
+ <div class="card">
155
+ <div class="flex flex-wrap gap-2 mb-6">
156
+ <p-button icon="pi pi-plus" label="Expand all" (click)="expandAll()" />
157
+ <p-button icon="pi pi-minus" label="Collapse all" (click)="collapseAll()" />
158
+ </div>
159
+ <p-tree [value]="files()" class="w-full md:w-[30rem]" />
160
+ </div>
161
+ `,
162
+ standalone: true,
163
+ imports: [ButtonModule, TreeModule],
164
+ providers: [NodeService]
165
+ })
166
+ export class TreeControlledDemo implements OnInit {
167
+ private nodeService = inject(NodeService);
168
+ files = signal<TreeNode[]>(undefined);
169
+
170
+ ngOnInit() {
171
+ this.nodeService.getFiles().then((data) => {
172
+ this.files.set(data);
173
+ });
174
+ }
175
+
176
+ expandAll() {
177
+ const updatedFiles = this.files().map((node) => this.expandRecursive(node, true));
178
+ this.files.set(updatedFiles);
179
+ }
180
+
181
+ collapseAll() {
182
+ const updatedFiles = this.files().map((node) => this.expandRecursive(node, false));
183
+ this.files.set(updatedFiles);
184
+ }
185
+ }
186
+ ```
187
+
188
+ ## Events
189
+
190
+ An event is provided for each type of user interaction such as expand, collapse and selection.
191
+
192
+ ```typescript
193
+ import { Component, OnInit, inject, signal } from '@angular/core';
194
+ import { ToastModule } from '@exhaustive-ui/core/toast';
195
+ import { TreeModule } from '@exhaustive-ui/core/tree';
196
+ import { NodeService } from '@/service/nodeservice';
197
+ import { TreeNode, MessageService } from '@exhaustive-ui/core/api';
198
+
199
+ @Component({
200
+ template: `
201
+ <div class="card">
202
+ <p-toast />
203
+ <p-tree
204
+ [value]="files()"
205
+ class="w-full md:w-[30rem]"
206
+ selectionMode="single"
207
+ [(selection)]="selectedFile"
208
+ (onNodeExpand)="nodeExpand($event)"
209
+ (onNodeCollapse)="nodeCollapse($event)"
210
+ (onNodeSelect)="nodeSelect($event)"
211
+ (onNodeUnselect)="nodeUnselect($event)"
212
+ />
213
+ </div>
214
+ `,
215
+ standalone: true,
216
+ imports: [ToastModule, TreeModule],
217
+ providers: [NodeService, MessageService]
218
+ })
219
+ export class TreeEventDemo implements OnInit {
220
+ private nodeService = inject(NodeService);
221
+ private messageService = inject(MessageService);
222
+ files = signal<TreeNode[]>(undefined);
223
+ selectedFile!: TreeNode;
224
+
225
+ ngOnInit() {
226
+ this.nodeService.getFiles().then((data) => {
227
+ this.files.set(data);
228
+ });
229
+ }
230
+
231
+ nodeExpand(event: any) {
232
+ this.messageService.add({ severity: 'success', summary: 'Node Expanded', detail: event.node.label });
233
+ }
234
+
235
+ nodeCollapse(event: any) {
236
+ this.messageService.add({ severity: 'warn', summary: 'Node Collapsed', detail: event.node.label });
237
+ }
238
+
239
+ nodeSelect(event: any) {
240
+ this.messageService.add({ severity: 'info', summary: 'Node Selected', detail: event.node.label });
241
+ }
242
+
243
+ nodeUnselect(event: any) {
244
+ this.messageService.add({ severity: 'info', summary: 'Node Unselected', detail: event.node.label });
245
+ }
246
+ }
247
+ ```
248
+
249
+ ## Filter
250
+
251
+ 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.
252
+
253
+ ```typescript
254
+ import { Component, OnInit, inject, signal } from '@angular/core';
255
+ import { TreeModule } from '@exhaustive-ui/core/tree';
256
+ import { NodeService } from '@/service/nodeservice';
257
+ import { TreeNode } from '@exhaustive-ui/core/api';
258
+
259
+ @Component({
260
+ template: `
261
+ <div class="card flex flex-wrap gap-4">
262
+ <div class="flex-auto md:flex md:justify-start md:items-center flex-col">
263
+ <p-tree [value]="files()" [filter]="true" filterPlaceholder="Lenient Filter" />
264
+ </div>
265
+ <div class="flex-auto md:flex md:justify-start md:items-center flex-col">
266
+ <p-tree [value]="files2()" [filter]="true" filterMode="strict" filterPlaceholder="Strict Filter" />
267
+ </div>
268
+ </div>
269
+ `,
270
+ standalone: true,
271
+ imports: [TreeModule],
272
+ providers: [NodeService]
273
+ })
274
+ export class TreeFilterDemo implements OnInit {
275
+ private nodeService = inject(NodeService);
276
+ files = signal<TreeNode[]>(undefined);
277
+ files2 = signal<TreeNode[]>(undefined);
278
+
279
+ ngOnInit() {
280
+ this.nodeService.getFiles().then((data) => {
281
+ this.files.set(data);
282
+ this.files2.set(data);
283
+ });
284
+ }
285
+ }
286
+ ```
287
+
288
+ ## Lazy
289
+
290
+ Lazy loading is useful when dealing with huge datasets, in this example nodes are dynamically loaded on demand using loading property and onNodeExpand method.
291
+
292
+ ```typescript
293
+ import { Component, OnInit, signal } from '@angular/core';
294
+ import { TreeModule } from '@exhaustive-ui/core/tree';
295
+ import { TreeNode } from '@exhaustive-ui/core/api';
296
+
297
+ @Component({
298
+ template: `
299
+ <div class="card">
300
+ <p-tree class="w-full md:w-[30rem]" [value]="nodes()" loadingMode="icon" (onNodeExpand)="onNodeExpand($event)" />
301
+ </div>
302
+ `,
303
+ standalone: true,
304
+ imports: [TreeModule]
305
+ })
306
+ export class TreeLazyDemo implements OnInit {
307
+ nodes = signal<TreeNode[]>(undefined);
308
+
309
+ ngOnInit() {
310
+ this.nodes.set(this.initiateNodes());
311
+ setTimeout(() => {
312
+ this.nodes.set(this.nodes().map((node) => ({ ...node, loading: false })));
313
+ }, 2000);
314
+ }
315
+
316
+ initiateNodes(): TreeNode[] {
317
+ return [
318
+ {
319
+ key: '0',
320
+ label: 'Node 0',
321
+ leaf: false,
322
+ loading: true
323
+ },
324
+ {
325
+ key: '1',
326
+ label: 'Node 1',
327
+ leaf: false,
328
+ loading: true
329
+ },
330
+ {
331
+ key: '2',
332
+ label: 'Node 2',
333
+ leaf: false,
334
+ loading: true
335
+ }
336
+ ];
337
+ }
338
+
339
+ onNodeExpand(event: any) {
340
+ if (!event.node.children) {
341
+ event.node.loading = true;
342
+
343
+ setTimeout(() => {
344
+ const _nodes = this.nodes();
345
+ let _node = { ...event.node };
346
+ _node.children = [];
347
+
348
+ for (let i = 0; i < 3; i++) {
349
+ _node.children.push({
350
+ key: event.node.key + '-' + i,
351
+ label: 'Lazy ' + event.node.label + '-' + i
352
+ });
353
+ }
354
+
355
+ const key = parseInt(_node.key, 10);
356
+ _nodes[key] = { ..._node, loading: false };
357
+ this.nodes.set([..._nodes]);
358
+ }, 500);
359
+ }
360
+ }
361
+ }
362
+ ```
363
+
364
+ ## Multiple
365
+
366
+ 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, Tree 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.
367
+
368
+ ```typescript
369
+ import { Component, OnInit, inject, signal } from '@angular/core';
370
+ import { FormsModule } from '@angular/forms';
371
+ import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';
372
+ import { Tree, TreeModule } from '@exhaustive-ui/core/tree';
373
+ import { NodeService } from '@/service/nodeservice';
374
+ import { TreeNode } from '@exhaustive-ui/core/api';
375
+
376
+ @Component({
377
+ template: `
378
+ <div class="card">
379
+ <div class="flex items-center mb-6 gap-2">
380
+ <p-toggleswitch inputId="input-metakey" [(ngModel)]="metaKeySelection" />
381
+ <label for="input-metakey">MetaKey</label>
382
+ </div>
383
+ <p-tree [metaKeySelection]="metaKeySelection" [value]="files()" class="w-full md:w-[30rem]" selectionMode="multiple" [(selection)]="selectedFiles" />
384
+ </div>
385
+ `,
386
+ standalone: true,
387
+ imports: [ToggleSwitchModule, TreeModule, FormsModule],
388
+ providers: [NodeService]
389
+ })
390
+ export class TreeMultipleDemo implements OnInit {
391
+ private nodeService = inject(NodeService);
392
+ metaKeySelection: boolean = false;
393
+ files = signal<TreeNode[]>(undefined);
394
+ selectedFiles!: TreeNode[];
395
+
396
+ ngOnInit() {
397
+ this.nodeService.getFiles().then((data) => {
398
+ this.files.set(data);
399
+ });
400
+ }
401
+ }
402
+ ```
403
+
404
+ ## Single
405
+
406
+ Single node selection is configured by setting selectionMode as single along with selection properties to manage the selection value binding.
407
+
408
+ ```typescript
409
+ import { Component, OnInit, inject, signal } from '@angular/core';
410
+ import { TreeModule } from '@exhaustive-ui/core/tree';
411
+ import { NodeService } from '@/service/nodeservice';
412
+ import { TreeNode } from '@exhaustive-ui/core/api';
413
+
414
+ @Component({
415
+ template: `
416
+ <div class="card">
417
+ <p-tree [value]="files()" class="w-full md:w-[30rem]" selectionMode="single" [(selection)]="selectedFile" />
418
+ </div>
419
+ `,
420
+ standalone: true,
421
+ imports: [TreeModule],
422
+ providers: [NodeService]
423
+ })
424
+ export class TreeSingleDemo implements OnInit {
425
+ private nodeService = inject(NodeService);
426
+ files = signal<TreeNode[]>(undefined);
427
+ selectedFile!: TreeNode;
428
+
429
+ ngOnInit() {
430
+ this.nodeService.getFiles().then((data) => {
431
+ this.files.set(data);
432
+ });
433
+ }
434
+ }
435
+ ```
436
+
437
+ ## Template
438
+
439
+ Custom node content instead of a node label is defined with the pTemplate property.
440
+
441
+ ```typescript
442
+ import { Component, OnInit, signal } from '@angular/core';
443
+ import { TreeModule } from '@exhaustive-ui/core/tree';
444
+ import { TreeNode } from '@exhaustive-ui/core/api';
445
+
446
+ @Component({
447
+ template: `
448
+ <div class="card">
449
+ <p-tree [value]="nodes()" class="w-full md:w-[30rem]">
450
+ <ng-template let-node pTemplate="url">
451
+ <a [href]="node.data" target="_blank" rel="noopener noreferrer" class="text-surface-700 dark:text-surface-100 hover:text-primary">{{ node.label }}</a>
452
+ </ng-template>
453
+ <ng-template let-node pTemplate="default">
454
+ <b>{{ node.label }}</b>
455
+ </ng-template>
456
+ </p-tree>
457
+ </div>
458
+ `,
459
+ standalone: true,
460
+ imports: [TreeModule]
461
+ })
462
+ export class TreeTemplateDemo implements OnInit {
463
+ nodes = signal<TreeNode[]>(undefined);
464
+
465
+ ngOnInit() {
466
+ this.nodes.set([
467
+ {
468
+ key: '0',
469
+ label: 'Introduction',
470
+ children: [
471
+ { key: '0-0', label: 'What is Angular', data: 'https://angular.io', type: 'url' },
472
+ { key: '0-1', label: 'Getting Started', data: 'https://angular.io/guide/setup-local', type: 'url' },
473
+ { key: '0-2', label: 'Learn and Explore', data: 'https://angular.io/guide/architecture', type: 'url' },
474
+ { key: '0-3', label: 'Take a Look', data: 'https://angular.io/start', type: 'url' }
475
+ ]
476
+ },
477
+ {
478
+ key: '1',
479
+ label: 'Components In-Depth',
480
+ children: [
481
+ { key: '1-0', label: 'Component Registration', data: 'https://angular.io/guide/component-interaction', type: 'url' },
482
+ { key: '1-1', label: 'User Input', data: 'https://angular.io/guide/user-input', type: 'url' },
483
+ { key: '1-2', label: 'Hooks', data: 'https://angular.io/guide/lifecycle-hooks', type: 'url' },
484
+ { key: '1-3', label: 'Attribute Directives', data: 'https://angular.io/guide/attribute-directives', type: 'url' }
485
+ ]
486
+ }
487
+ ]);
488
+ }
489
+ }
490
+ ```
491
+
492
+ ## Virtual Scroll
493
+
494
+ VirtualScroller is a performance-approach to handle huge data efficiently. Setting virtualScroll property as true and providing a virtualScrollItemSize in pixels would be enough to enable this functionality.
495
+
496
+ ```typescript
497
+ import { Component, OnInit, inject, signal } from '@angular/core';
498
+ import { TreeModule } from '@exhaustive-ui/core/tree';
499
+ import { NodeService } from '@/service/nodeservice';
500
+ import { TreeNode } from '@exhaustive-ui/core/api';
501
+
502
+ @Component({
503
+ template: `
504
+ <div class="card">
505
+ <p-tree [value]="nodes()" scrollHeight="250px" [virtualScroll]="true" [virtualScrollItemSize]="35" />
506
+ </div>
507
+ `,
508
+ standalone: true,
509
+ imports: [TreeModule],
510
+ providers: [NodeService]
511
+ })
512
+ export class TreeVirtualscrollDemo implements OnInit {
513
+ private nodeService = inject(NodeService);
514
+ nodes = signal<TreeNode[]>(undefined);
515
+
516
+ ngOnInit() {
517
+ this.nodes.set(this.nodeService.generateNodes(150));
518
+ }
519
+ }
520
+ ```
521
+
522
+ ## virtualscrolllazy-doc
523
+
524
+ VirtualScroller is a performance-approach to handle huge data efficiently. Setting virtualScroll property as true and providing a virtualScrollItemSize in pixels would be enough to enable this functionality.
525
+
526
+ ```typescript
527
+ import { Component, OnInit, inject, signal } from '@angular/core';
528
+ import { TreeModule } from '@exhaustive-ui/core/tree';
529
+ import { NodeService } from '@/service/nodeservice';
530
+ import { TreeNode } from '@exhaustive-ui/core/api';
531
+
532
+ @Component({
533
+ template: `
534
+ <div class="card">
535
+ <p-tree [value]="nodes()" scrollHeight="250px" [virtualScroll]="true" [lazy]="true" [virtualScrollItemSize]="35" (onNodeExpand)="nodeExpand($event)" [loading]="loading()" />
536
+ </div>
537
+ `,
538
+ standalone: true,
539
+ imports: [TreeModule],
540
+ providers: [NodeService]
541
+ })
542
+ export class TreeVirtualscrolllazyDemo implements OnInit {
543
+ private nodeService = inject(NodeService);
544
+ loading = signal<boolean>(false);
545
+ nodes = signal<TreeNode[]>(undefined);
546
+
547
+ ngOnInit() {
548
+ this.loading.set(true);
549
+ setTimeout(() => {
550
+ this.nodes.set(this.nodeService.generateNodes(150));
551
+ this.loading.set(false);
552
+ }, 1000);
553
+ }
554
+
555
+ nodeExpand(event: any) {
556
+ if (event.node) {
557
+ this.loading.set(true);
558
+ setTimeout(() => {
559
+ event.node.children = this.nodeService.createNodes(5, event.node.key);
560
+ this.loading.set(false);
561
+ this.nodes.set([...this.nodes()]);
562
+ }, 200);
563
+ }
564
+ }
565
+ }
566
+ ```
567
+
568
+ ## Tree
569
+
570
+ Tree is used to display hierarchical data.
571
+
572
+ ### Props
573
+
574
+ | Name | Type | Default | Description |
575
+ |------|------|---------|-------------|
576
+ | dt | InputSignal<Object> | undefined | Defines scoped design tokens of the component. |
577
+ | unstyled | InputSignal<boolean> | undefined | Indicates whether the component should be rendered without styles. |
578
+ | pt | InputSignal<TreePassThrough> | undefined | Used to pass attributes to DOM elements inside the component. |
579
+ | ptOptions | InputSignal<PassThroughOptions> | undefined | Used to configure passthrough(pt) options of the component. |
580
+ | value | ModelSignal<any> | ... | An array of treenodes. |
581
+ | selectionMode | InputSignal<"multiple" \| "single" \| "checkbox"> | ... | Defines the selection mode. |
582
+ | loadingMode | InputSignal<"mask" \| "icon"> | ... | Loading mode display. |
583
+ | selection | ModelSignal<TreeNode<any> \| TreeNode<any>[]> | ... | A single treenode instance or an array to refer to the selections. |
584
+ | contextMenu | InputSignal<any> | ... | Context menu instance. |
585
+ | contextMenuSelectionMode | InputSignal<"separate" \| "joint"> | ... | Defines the behavior of context menu selection, in "separate" mode context menu updates contextMenuSelection property whereas in joint mode selection property is used instead so that when row selection is enabled, both row selection and context menu selection use the same property. |
586
+ | contextMenuSelection | ModelSignal<TreeNode<any>> | ... | Selected node with a context menu. |
587
+ | draggableScope | InputSignal<any> | ... | Scope of the draggable nodes to match a droppableScope. |
588
+ | droppableScope | InputSignal<any> | ... | Scope of the droppable nodes to match a draggableScope. |
589
+ | draggableNodes | InputSignalWithTransform<boolean, unknown> | ... | Whether the nodes are draggable. |
590
+ | droppableNodes | InputSignalWithTransform<boolean, unknown> | ... | Whether the nodes are droppable. |
591
+ | 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. |
592
+ | propagateSelectionUp | InputSignalWithTransform<boolean, unknown> | ... | Whether checkbox selections propagate to ancestor nodes. |
593
+ | propagateSelectionDown | InputSignalWithTransform<boolean, unknown> | ... | Whether checkbox selections propagate to descendant nodes. |
594
+ | loading | InputSignalWithTransform<boolean, unknown> | ... | Displays a loader to indicate data load is in progress. |
595
+ | loadingIcon | InputSignal<string> | ... | The icon to show while indicating data load is in progress. |
596
+ | emptyMessage | InputSignal<string> | ... | Text to display when there is no data. |
597
+ | ariaLabel | InputSignal<string> | ... | Used to define a string that labels the tree. |
598
+ | togglerAriaLabel | InputSignal<string> | ... | Defines a string that labels the toggler icon for accessibility. |
599
+ | ariaLabelledBy | InputSignal<string> | ... | Establishes relationships between the component and label(s) where its value should be one or more element IDs. |
600
+ | validateDrop | InputSignalWithTransform<boolean, unknown> | ... | When enabled, drop can be accepted or rejected based on condition defined at onNodeDrop. |
601
+ | filter | InputSignalWithTransform<boolean, unknown> | ... | When specified, displays an input field to filter the items. |
602
+ | filterInputAutoFocus | InputSignalWithTransform<boolean, unknown> | ... | Determines whether the filter input should be automatically focused when the component is rendered. |
603
+ | filterBy | InputSignal<string> | ... | When filtering is enabled, filterBy decides which field or fields (comma separated) to search against. |
604
+ | filterMode | InputSignal<string> | ... | Mode for filtering valid values are "lenient" and "strict". Default is lenient. |
605
+ | filterOptions | InputSignal<any> | ... | Mode for filtering valid values are "lenient" and "strict". Default is lenient. |
606
+ | filterPlaceholder | InputSignal<string> | ... | Placeholder text to show when filter input is empty. |
607
+ | filteredNodes | ModelSignal<TreeNode<any>[]> | ... | Values after the tree nodes are filtered. |
608
+ | filterLocale | InputSignal<string> | ... | Locale to use in filtering. The default locale is the host environment's current locale. |
609
+ | scrollHeight | InputSignal<string> | ... | Height of the scrollable viewport. |
610
+ | lazy | InputSignalWithTransform<boolean, unknown> | ... | Defines if data is loaded and interacted with in lazy manner. |
611
+ | virtualScroll | InputSignalWithTransform<boolean, unknown> | ... | Whether the data should be loaded on demand during scroll. |
612
+ | virtualScrollItemSize | InputSignalWithTransform<number, unknown> | ... | Height of an item in the list for VirtualScrolling. |
613
+ | virtualScrollOptions | InputSignal<ScrollerOptions> | ... | Whether to use the scroller feature. The properties of scroller component can be used like an object in it. |
614
+ | indentation | InputSignalWithTransform<number, unknown> | ... | Indentation factor for spacing of the nested node when virtual scrolling is enabled. |
615
+ | _templateMap | InputSignal<any> | ... | Custom templates of the component. |
616
+ | trackBy | InputSignal<Function> | ... | Function to optimize the node list rendering, default algorithm checks for object identity. |
617
+ | highlightOnSelect | InputSignalWithTransform<boolean, unknown> | ... | Highlights the node on select. |
618
+
619
+ ### Emits
620
+
621
+ | Name | Parameters | Description |
622
+ |------|------------|-------------|
623
+ | onNodeSelect | event: TreeNodeSelectEvent | Callback to invoke when a node is selected. |
624
+ | onNodeUnselect | event: TreeNodeUnSelectEvent | Callback to invoke when a node is unselected. |
625
+ | onNodeExpand | event: TreeNodeExpandEvent | Callback to invoke when a node is expanded. |
626
+ | onNodeCollapse | event: TreeNodeCollapseEvent | Callback to invoke when a node is collapsed. |
627
+ | onNodeContextMenuSelect | event: TreeNodeContextMenuSelectEvent | Callback to invoke when a node is selected with right click. |
628
+ | onNodeDoubleClick | event: TreeNodeDoubleClickEvent | Callback to invoke when a node is double clicked. |
629
+ | onNodeDrop | event: TreeNodeDropEvent | Callback to invoke when a node is dropped. |
630
+ | onLazyLoad | event: TreeLazyLoadEvent | Callback to invoke in lazy mode to load new data. |
631
+ | onScroll | event: TreeScrollEvent | Callback to invoke in virtual scroll mode when scroll position changes. |
632
+ | onScrollIndexChange | event: TreeScrollIndexChangeEvent | Callback to invoke in virtual scroll mode when scroll position and item's range in view changes. |
633
+ | onFilter | event: TreeFilterEvent | Callback to invoke when data is filtered. |
634
+
635
+ ### Templates
636
+
637
+ | Name | Type | Description |
638
+ |------|------|-------------|
639
+ | filter | TemplateRef<TreeFilterTemplateContext> | Custom filter template. |
640
+ | header | TemplateRef<void> | Custom header template. |
641
+ | footer | TemplateRef<void> | Custom footer template. |
642
+ | loader | TemplateRef<TreeLoaderTemplateContext> | Custom loader template. |
643
+ | empty | TemplateRef<void> | Custom empty message template. |
644
+ | togglericon | TemplateRef<TreeTogglerIconTemplateContext> | Custom toggler icon template. |
645
+ | checkboxicon | TemplateRef<TreeCheckboxIconTemplateContext> | Custom checkbox icon template. |
646
+ | loadingicon | TemplateRef<void> | Custom loading icon template. |
647
+ | filtericon | TemplateRef<void> | Custom filter icon template. |
648
+
649
+ ### Methods
650
+
651
+ | Name | Parameters | Return Type | Description |
652
+ |------|------------|-------------|-------------|
653
+ | resetFilter | | void | Resets filter. |
654
+ | scrollToVirtualIndex | index: number | void | Scrolls to virtual index. |
655
+ | scrollTo | options: any | void | Scrolls to virtual index. |
656
+
657
+ ## Pass Through Options
658
+
659
+ | Name | Type | Description |
660
+ |------|------|-------------|
661
+ | host | PassThroughOption<HTMLElement, I> | Used to pass attributes to the host's DOM element. |
662
+ | root | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the root's DOM element. |
663
+ | mask | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the loading mask's DOM element. |
664
+ | loadingIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the loading icon's DOM element. |
665
+ | pcFilterContainer | IconFieldPassThrough | Used to pass attributes to the filter container's DOM element. |
666
+ | pcFilterIconContainer | InputIconPassThrough | Used to pass attributes to the filter icon container's DOM element. |
667
+ | pcFilterInput | InputTextPassThrough | Used to pass attributes to the filter input's DOM element. |
668
+ | filterIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the filter icon's DOM element. |
669
+ | pcScroller | VirtualScrollerPassThrough | Used to pass attributes to the Scroller component. |
670
+ | wrapper | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the wrapper's DOM element. |
671
+ | rootChildren | PassThroughOption<HTMLUListElement, I> | Used to pass attributes to the root children's DOM element. |
672
+ | node | PassThroughOption<HTMLLIElement, I> | Used to pass attributes to the node's DOM element. |
673
+ | dropPoint | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the drop point's DOM element. |
674
+ | nodeContent | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the node content's DOM element. |
675
+ | nodeToggleButton | PassThroughOption<HTMLButtonElement, I> | Used to pass attributes to the node toggle button's DOM element. |
676
+ | nodeTogglerIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the node toggle icon's DOM element. |
677
+ | pcNodeCheckbox | CheckboxPassThrough | Used to pass attributes to the node checkbox's DOM element. |
678
+ | nodeIcon | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the node icon's DOM element. |
679
+ | nodeLabel | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the node label's DOM element. |
680
+ | nodeChildren | PassThroughOption<HTMLUListElement, I> | Used to pass attributes to the node children's DOM element. |
681
+ | emptyMessage | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the empty message's DOM element. |
682
+
683
+ ## Theming
684
+
685
+ ### CSS Classes
686
+
687
+ | Class | Description |
688
+ |-------|-------------|
689
+ | p-tree | Class name of the root element |
690
+ | p-tree-mask | Class name of the mask element |
691
+ | p-tree-loading-icon | Class name of the loading icon element |
692
+ | p-tree-filter-input | Class name of the filter input element |
693
+ | p-tree-root | Class name of the wrapper element |
694
+ | p-tree-root-children | Class name of the root children element |
695
+ | p-tree-node | Class name of the node element |
696
+ | p-tree-node-content | Class name of the node content element |
697
+ | p-tree-node-toggle-button | Class name of the node toggle button element |
698
+ | p-tree-node-toggle-icon | Class name of the node toggle icon element |
699
+ | p-tree-node-checkbox | Class name of the node checkbox element |
700
+ | p-tree-node-icon | Class name of the node icon element |
701
+ | p-tree-node-label | Class name of the node label element |
702
+ | p-tree-node-children | Class name of the node children element |
703
+ | p-tree-empty-message | Class name of the empty message element |
704
+ | p-tree-node-droppoint | Class name of the drop point element |
705
+
706
+ ### Design Tokens
707
+
708
+ | Token | CSS Variable | Description |
709
+ |-------|--------------|-------------|
710
+ | tree.background | --p-tree-background | Background of root |
711
+ | tree.color | --p-tree-color | Color of root |
712
+ | tree.padding | --p-tree-padding | Padding of root |
713
+ | tree.gap | --p-tree-gap | Gap of root |
714
+ | tree.indent | --p-tree-indent | Indent of root |
715
+ | tree.transition.duration | --p-tree-transition-duration | Transition duration of root |
716
+ | tree.node.padding | --p-tree-node-padding | Padding of node |
717
+ | tree.node.border.radius | --p-tree-node-border-radius | Border radius of node |
718
+ | tree.node.hover.background | --p-tree-node-hover-background | Hover background of node |
719
+ | tree.node.selected.background | --p-tree-node-selected-background | Selected background of node |
720
+ | tree.node.color | --p-tree-node-color | Color of node |
721
+ | tree.node.hover.color | --p-tree-node-hover-color | Hover color of node |
722
+ | tree.node.selected.color | --p-tree-node-selected-color | Selected color of node |
723
+ | tree.node.focus.ring.width | --p-tree-node-focus-ring-width | Focus ring width of node |
724
+ | tree.node.focus.ring.style | --p-tree-node-focus-ring-style | Focus ring style of node |
725
+ | tree.node.focus.ring.color | --p-tree-node-focus-ring-color | Focus ring color of node |
726
+ | tree.node.focus.ring.offset | --p-tree-node-focus-ring-offset | Focus ring offset of node |
727
+ | tree.node.focus.ring.shadow | --p-tree-node-focus-ring-shadow | Focus ring shadow of node |
728
+ | tree.node.gap | --p-tree-node-gap | Gap of node |
729
+ | tree.node.icon.color | --p-tree-node-icon-color | Color of node icon |
730
+ | tree.node.icon.hover.color | --p-tree-node-icon-hover-color | Hover color of node icon |
731
+ | tree.node.icon.selected.color | --p-tree-node-icon-selected-color | Selected color of node icon |
732
+ | tree.node.toggle.button.border.radius | --p-tree-node-toggle-button-border-radius | Border radius of node toggle button |
733
+ | tree.node.toggle.button.size | --p-tree-node-toggle-button-size | Size of node toggle button |
734
+ | tree.node.toggle.button.hover.background | --p-tree-node-toggle-button-hover-background | Hover background of node toggle button |
735
+ | tree.node.toggle.button.selected.hover.background | --p-tree-node-toggle-button-selected-hover-background | Selected hover background of node toggle button |
736
+ | tree.node.toggle.button.color | --p-tree-node-toggle-button-color | Color of node toggle button |
737
+ | tree.node.toggle.button.hover.color | --p-tree-node-toggle-button-hover-color | Hover color of node toggle button |
738
+ | tree.node.toggle.button.selected.hover.color | --p-tree-node-toggle-button-selected-hover-color | Selected hover color of node toggle button |
739
+ | tree.node.toggle.button.focus.ring.width | --p-tree-node-toggle-button-focus-ring-width | Focus ring width of node toggle button |
740
+ | tree.node.toggle.button.focus.ring.style | --p-tree-node-toggle-button-focus-ring-style | Focus ring style of node toggle button |
741
+ | tree.node.toggle.button.focus.ring.color | --p-tree-node-toggle-button-focus-ring-color | Focus ring color of node toggle button |
742
+ | tree.node.toggle.button.focus.ring.offset | --p-tree-node-toggle-button-focus-ring-offset | Focus ring offset of node toggle button |
743
+ | tree.node.toggle.button.focus.ring.shadow | --p-tree-node-toggle-button-focus-ring-shadow | Focus ring shadow of node toggle button |
744
+ | tree.loading.icon.size | --p-tree-loading-icon-size | Size of loading icon |
745
+ | tree.filter.margin | --p-tree-filter-margin | Margin of filter |
746
+