@exhaustive-ui/mcp 22.5.0 → 22.6.0
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/data/cards/accordion.md +5 -2
- package/data/cards/animateonscroll.md +8 -5
- package/data/cards/autocomplete.md +8 -3
- package/data/cards/autofocus.md +4 -2
- package/data/cards/avatar.md +4 -2
- package/data/cards/badge.md +2 -1
- package/data/cards/breadcrumb.md +3 -1
- package/data/cards/button.md +8 -2
- package/data/cards/card.md +2 -1
- package/data/cards/carousel.md +7 -5
- package/data/cards/cascadeselect.md +2 -6
- package/data/cards/chart.md +9 -7
- package/data/cards/checkbox.md +4 -3
- package/data/cards/chip.md +2 -1
- package/data/cards/classnames.md +21 -3
- package/data/cards/colorpicker.md +2 -1
- package/data/cards/confirmdialog.md +35 -5
- package/data/cards/confirmpopup.md +25 -3
- package/data/cards/contextmenu.md +1 -7
- package/data/cards/dataview.md +28 -9
- package/data/cards/datepicker.md +4 -3
- package/data/cards/dialog.md +3 -3
- package/data/cards/divider.md +2 -1
- package/data/cards/dock.md +24 -3
- package/data/cards/dragdrop.md +5 -1
- package/data/cards/drawer.md +3 -3
- package/data/cards/dynamicdialog.md +41 -14
- package/data/cards/editor.md +1 -1
- package/data/cards/fieldset.md +2 -1
- package/data/cards/fileinput.md +1 -1
- package/data/cards/fileupload.md +7 -8
- package/data/cards/floatlabel.md +1 -1
- package/data/cards/fluid.md +7 -5
- package/data/cards/focustrap.md +6 -2
- package/data/cards/galleria.md +18 -25
- package/data/cards/iconfield.md +3 -2
- package/data/cards/iftalabel.md +1 -1
- package/data/cards/image.md +4 -2
- package/data/cards/imagecompare.md +4 -3
- package/data/cards/inplace.md +2 -1
- package/data/cards/inputgroup.md +14 -3
- package/data/cards/inputmask.md +2 -2
- package/data/cards/inputnumber.md +4 -3
- package/data/cards/inputotp.md +2 -2
- package/data/cards/inputtext.md +2 -2
- package/data/cards/keyfilter.md +2 -1
- package/data/cards/knob.md +3 -2
- package/data/cards/listbox.md +5 -3
- package/data/cards/megamenu.md +7 -8
- package/data/cards/menu.md +3 -7
- package/data/cards/menubar.md +3 -7
- package/data/cards/message.md +2 -1
- package/data/cards/metergroup.md +3 -7
- package/data/cards/multiselect.md +5 -9
- package/data/cards/orderlist.md +6 -4
- package/data/cards/organizationchart.md +33 -6
- package/data/cards/overlay.md +2 -1
- package/data/cards/paginator.md +2 -1
- package/data/cards/panel.md +2 -1
- package/data/cards/panelmenu.md +4 -13
- package/data/cards/password.md +6 -3
- package/data/cards/picklist.md +9 -5
- package/data/cards/popover.md +6 -5
- package/data/cards/progressbar.md +4 -3
- package/data/cards/progressspinner.md +2 -1
- package/data/cards/radiobutton.md +4 -3
- package/data/cards/rating.md +1 -1
- package/data/cards/ripple.md +2 -1
- package/data/cards/scrollpanel.md +2 -1
- package/data/cards/scrolltop.md +5 -3
- package/data/cards/select.md +2 -1
- package/data/cards/selectbutton.md +6 -2
- package/data/cards/skeleton.md +2 -1
- package/data/cards/slider.md +4 -3
- package/data/cards/speeddial.md +7 -4
- package/data/cards/splitbutton.md +21 -18
- package/data/cards/splitter.md +2 -1
- package/data/cards/stepper.md +8 -3
- package/data/cards/styleclass.md +4 -2
- package/data/cards/table.md +46 -11
- package/data/cards/tabs.md +2 -1
- package/data/cards/tag.md +2 -1
- package/data/cards/terminal.md +31 -22
- package/data/cards/textarea.md +3 -2
- package/data/cards/tieredmenu.md +1 -6
- package/data/cards/timeline.md +5 -5
- package/data/cards/toast.md +7 -8
- package/data/cards/togglebutton.md +1 -1
- package/data/cards/toggleswitch.md +4 -3
- package/data/cards/toolbar.md +8 -8
- package/data/cards/tooltip.md +2 -1
- package/data/cards/tree.md +3 -6
- package/data/cards/treeselect.md +6 -7
- package/data/cards/treetable.md +52 -31
- package/data/components/accordion.md +31 -23
- package/data/components/animateonscroll.md +18 -15
- package/data/components/autocomplete.md +162 -93
- package/data/components/autofocus.md +9 -7
- package/data/components/avatar.md +56 -43
- package/data/components/badge.md +27 -18
- package/data/components/blockui.md +15 -8
- package/data/components/breadcrumb.md +20 -14
- package/data/components/button.md +121 -94
- package/data/components/card.md +12 -10
- package/data/components/carousel.md +75 -53
- package/data/components/cascadeselect.md +271 -238
- package/data/components/chart.md +88 -74
- package/data/components/checkbox.md +107 -73
- package/data/components/chip.md +20 -16
- package/data/components/classnames.md +22 -4
- package/data/components/colorpicker.md +54 -36
- package/data/components/confirmdialog.md +146 -43
- package/data/components/confirmpopup.md +95 -22
- package/data/components/contextmenu.md +110 -39
- package/data/components/dataview.md +176 -83
- package/data/components/datepicker.md +171 -141
- package/data/components/dialog.md +80 -68
- package/data/components/divider.md +17 -12
- package/data/components/dock.md +63 -27
- package/data/components/dragdrop.md +26 -12
- package/data/components/drawer.md +67 -48
- package/data/components/dynamicdialog.md +22 -13
- package/data/components/editor.md +42 -33
- package/data/components/fieldset.md +20 -17
- package/data/components/fileinput.md +92 -35
- package/data/components/fileupload.md +101 -61
- package/data/components/floatlabel.md +20 -11
- package/data/components/fluid.md +11 -9
- package/data/components/focustrap.md +11 -7
- package/data/components/galleria.md +224 -83
- package/data/components/iconfield.md +23 -15
- package/data/components/iftalabel.md +15 -9
- package/data/components/image.md +31 -26
- package/data/components/imagecompare.md +8 -6
- package/data/components/inplace.md +27 -22
- package/data/components/inputgroup.md +53 -29
- package/data/components/inputmask.md +107 -85
- package/data/components/inputnumber.md +127 -89
- package/data/components/inputotp.md +55 -42
- package/data/components/inputtext.md +72 -50
- package/data/components/keyfilter.md +6 -3
- package/data/components/knob.md +70 -58
- package/data/components/listbox.md +171 -141
- package/data/components/megamenu.md +24 -23
- package/data/components/menu.md +37 -34
- package/data/components/menubar.md +27 -22
- package/data/components/message.md +44 -32
- package/data/components/metergroup.md +48 -17
- package/data/components/multiselect.md +232 -168
- package/data/components/orderlist.md +55 -48
- package/data/components/organizationchart.md +182 -13
- package/data/components/overlay.md +31 -26
- package/data/components/paginator.md +49 -34
- package/data/components/panel.md +23 -19
- package/data/components/panelmenu.md +51 -25
- package/data/components/password.md +104 -91
- package/data/components/picklist.md +92 -70
- package/data/components/popover.md +68 -46
- package/data/components/progressbar.md +28 -22
- package/data/components/progressspinner.md +13 -11
- package/data/components/radiobutton.md +69 -35
- package/data/components/rating.md +48 -40
- package/data/components/ripple.md +8 -6
- package/data/components/scroller.md +29 -29
- package/data/components/scrollpanel.md +9 -7
- package/data/components/scrolltop.md +20 -18
- package/data/components/select.md +248 -169
- package/data/components/selectbutton.md +118 -56
- package/data/components/skeleton.md +22 -18
- package/data/components/slider.md +73 -49
- package/data/components/speeddial.md +77 -59
- package/data/components/splitbutton.md +354 -329
- package/data/components/splitter.md +22 -18
- package/data/components/stepper.md +38 -21
- package/data/components/styleclass.md +12 -6
- package/data/components/table.md +523 -314
- package/data/components/tabs.md +44 -26
- package/data/components/tag.md +18 -14
- package/data/components/terminal.md +38 -27
- package/data/components/textarea.md +82 -47
- package/data/components/tieredmenu.md +34 -29
- package/data/components/timeline.md +29 -28
- package/data/components/toast.md +115 -57
- package/data/components/togglebutton.md +53 -39
- package/data/components/toggleswitch.md +41 -28
- package/data/components/toolbar.md +19 -18
- package/data/components/tooltip.md +43 -32
- package/data/components/tree.md +114 -81
- package/data/components/treeselect.md +176 -174
- package/data/components/treetable.md +1250 -1045
- package/data/components.json +4122 -4080
- package/data/llms-full.txt +8784 -6249
- package/data/manifest.json +154 -15
- package/data/pages/tailwind.md +20 -10
- package/data/snapshot.json +2 -2
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -11,34 +11,36 @@ Screen Reader Default role of the table is table . Header, body and footer eleme
|
|
|
11
11
|
TreeTable requires a collection of TreeNode instances as a value components as children for the representation.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Component,
|
|
14
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
15
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
15
16
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
16
17
|
import { NodeService } from '@/service/nodeservice';
|
|
17
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
18
18
|
|
|
19
19
|
@Component({
|
|
20
20
|
template: `
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
<div class="card">
|
|
22
|
+
<p-tree-table [value]="files" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
23
|
+
<ng-template #header>
|
|
24
|
+
<tr>
|
|
25
|
+
<th>Name</th>
|
|
26
|
+
<th>Size</th>
|
|
27
|
+
<th>Type</th>
|
|
28
|
+
</tr>
|
|
29
|
+
</ng-template>
|
|
30
|
+
<ng-template #body let-rowNode let-rowData="rowData">
|
|
31
|
+
<tr [ttRow]="rowNode">
|
|
32
|
+
<td>
|
|
33
|
+
<div class="flex items-center gap-2">
|
|
34
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
35
|
+
<span>{{ rowData.name }}</span>
|
|
36
|
+
</div>
|
|
37
|
+
</td>
|
|
38
|
+
<td>{{ rowData.size }}</td>
|
|
39
|
+
<td>{{ rowData.type }}</td>
|
|
40
|
+
</tr>
|
|
41
|
+
</ng-template>
|
|
42
|
+
</p-tree-table>
|
|
43
|
+
</div>
|
|
42
44
|
`,
|
|
43
45
|
standalone: true,
|
|
44
46
|
imports: [TreeTableModule],
|
|
@@ -46,6 +48,7 @@ import { TreeNode } from '@exhaustive-ui/core/api';
|
|
|
46
48
|
})
|
|
47
49
|
export class TreetableBasicDemo implements OnInit {
|
|
48
50
|
private nodeService = inject(NodeService);
|
|
51
|
+
|
|
49
52
|
files!: TreeNode[];
|
|
50
53
|
|
|
51
54
|
ngOnInit() {
|
|
@@ -58,51 +61,52 @@ export class TreetableBasicDemo implements OnInit {
|
|
|
58
61
|
|
|
59
62
|
```typescript
|
|
60
63
|
import { Component, OnInit } from '@angular/core';
|
|
61
|
-
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
62
64
|
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
63
|
-
import {
|
|
65
|
+
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
64
66
|
|
|
65
67
|
@Component({
|
|
66
68
|
template: `
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
69
|
+
<div class="card">
|
|
70
|
+
<p-tree-table [value]="sales" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
71
|
+
<ng-template #header>
|
|
72
|
+
<tr>
|
|
73
|
+
<th rowspan="3">Brand</th>
|
|
74
|
+
<th colspan="4">Sale Rate</th>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<th colspan="2">Sales</th>
|
|
78
|
+
<th colspan="2">Profits</th>
|
|
79
|
+
</tr>
|
|
80
|
+
<tr>
|
|
81
|
+
<th>Last Year</th>
|
|
82
|
+
<th>This Year</th>
|
|
83
|
+
<th>Last Year</th>
|
|
84
|
+
<th>This Year</th>
|
|
85
|
+
</tr>
|
|
86
|
+
</ng-template>
|
|
87
|
+
<ng-template #body let-rowNode let-rowData="rowData">
|
|
88
|
+
<tr [ttRow]="rowNode">
|
|
89
|
+
<td>
|
|
90
|
+
<div class="flex items-center gap-2">
|
|
91
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
92
|
+
<span>{{ rowData.brand }}</span>
|
|
93
|
+
</div>
|
|
94
|
+
</td>
|
|
95
|
+
<td>{{ rowData.lastYearSale }}</td>
|
|
96
|
+
<td>{{ rowData.thisYearSale }}</td>
|
|
97
|
+
<td>{{ rowData.lastYearProfit }}</td>
|
|
98
|
+
<td>{{ rowData.thisYearProfit }}</td>
|
|
99
|
+
</tr>
|
|
100
|
+
</ng-template>
|
|
101
|
+
<ng-template #footer>
|
|
102
|
+
<tr>
|
|
103
|
+
<td colspan="3">Totals</td>
|
|
104
|
+
<td>$3,283,772</td>
|
|
105
|
+
<td>$2,126,925</td>
|
|
106
|
+
</tr>
|
|
107
|
+
</ng-template>
|
|
108
|
+
</p-tree-table>
|
|
109
|
+
</div>
|
|
106
110
|
`,
|
|
107
111
|
standalone: true,
|
|
108
112
|
imports: [TreeTableModule]
|
|
@@ -372,10 +376,11 @@ export class TreetableColumngroupDemo implements OnInit {
|
|
|
372
376
|
Setting columnResizeMode as expand changes the table width as well.
|
|
373
377
|
|
|
374
378
|
```typescript
|
|
375
|
-
import {
|
|
379
|
+
import { CommonModule } from '@angular/common';
|
|
380
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
381
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
376
382
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
377
383
|
import { NodeService } from '@/service/nodeservice';
|
|
378
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
379
384
|
|
|
380
385
|
interface Column {
|
|
381
386
|
field: string;
|
|
@@ -384,41 +389,45 @@ interface Column {
|
|
|
384
389
|
|
|
385
390
|
@Component({
|
|
386
391
|
template: `
|
|
387
|
-
<
|
|
388
|
-
<
|
|
389
|
-
<
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
<
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
<
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
392
|
+
<div class="card">
|
|
393
|
+
<p-tree-table [value]="files" [columns]="cols" [resizableColumns]="true" columnResizeMode="expand" showGridlines>
|
|
394
|
+
<ng-template #header let-columns>
|
|
395
|
+
<tr>
|
|
396
|
+
@for (col of columns; track col) {
|
|
397
|
+
<th ttResizableColumn>
|
|
398
|
+
{{ col.header }}
|
|
399
|
+
</th>
|
|
400
|
+
}
|
|
401
|
+
</tr>
|
|
402
|
+
</ng-template>
|
|
403
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
404
|
+
<tr [ttRow]="rowNode">
|
|
405
|
+
@for (col of columns; let first = $first; track col) {
|
|
406
|
+
<td>
|
|
407
|
+
@if (first) {
|
|
408
|
+
<div class="flex items-center gap-2">
|
|
409
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
410
|
+
<span>{{ rowData[col.field] }}</span>
|
|
411
|
+
</div>
|
|
412
|
+
} @else {
|
|
413
|
+
{{ rowData[col.field] }}
|
|
414
|
+
}
|
|
415
|
+
</td>
|
|
416
|
+
}
|
|
417
|
+
</tr>
|
|
418
|
+
</ng-template>
|
|
419
|
+
</p-tree-table>
|
|
420
|
+
</div>
|
|
414
421
|
`,
|
|
415
422
|
standalone: true,
|
|
416
|
-
imports: [TreeTableModule],
|
|
423
|
+
imports: [CommonModule, TreeTableModule],
|
|
417
424
|
providers: [NodeService]
|
|
418
425
|
})
|
|
419
426
|
export class TreetableColumnresizeexpandDemo implements OnInit {
|
|
420
427
|
private nodeService = inject(NodeService);
|
|
428
|
+
|
|
421
429
|
files!: TreeNode[];
|
|
430
|
+
|
|
422
431
|
cols!: Column[];
|
|
423
432
|
|
|
424
433
|
ngOnInit() {
|
|
@@ -437,10 +446,11 @@ export class TreetableColumnresizeexpandDemo implements OnInit {
|
|
|
437
446
|
Columns can be resized with drag and drop when resizableColumns is enabled. Default resize mode is fit that does not change the overall table width.
|
|
438
447
|
|
|
439
448
|
```typescript
|
|
440
|
-
import {
|
|
449
|
+
import { CommonModule } from '@angular/common';
|
|
450
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
451
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
441
452
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
442
453
|
import { NodeService } from '@/service/nodeservice';
|
|
443
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
444
454
|
|
|
445
455
|
interface Column {
|
|
446
456
|
field: string;
|
|
@@ -449,41 +459,45 @@ interface Column {
|
|
|
449
459
|
|
|
450
460
|
@Component({
|
|
451
461
|
template: `
|
|
452
|
-
<
|
|
453
|
-
<
|
|
454
|
-
<
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
<
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
<
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
462
|
+
<div class="card">
|
|
463
|
+
<p-tree-table [value]="files" [columns]="cols" [resizableColumns]="true" [tableStyle]="{ 'min-width': '50rem' }" showGridlines>
|
|
464
|
+
<ng-template #header let-columns>
|
|
465
|
+
<tr>
|
|
466
|
+
@for (col of columns; track col) {
|
|
467
|
+
<th ttResizableColumn>
|
|
468
|
+
{{ col.header }}
|
|
469
|
+
</th>
|
|
470
|
+
}
|
|
471
|
+
</tr>
|
|
472
|
+
</ng-template>
|
|
473
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
474
|
+
<tr [ttRow]="rowNode">
|
|
475
|
+
@for (col of columns; let first = $first; track col) {
|
|
476
|
+
<td>
|
|
477
|
+
@if (first) {
|
|
478
|
+
<div class="flex items-center gap-2">
|
|
479
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
480
|
+
<span>{{ rowData[col.field] }}</span>
|
|
481
|
+
</div>
|
|
482
|
+
} @else {
|
|
483
|
+
{{ rowData[col.field] }}
|
|
484
|
+
}
|
|
485
|
+
</td>
|
|
486
|
+
}
|
|
487
|
+
</tr>
|
|
488
|
+
</ng-template>
|
|
489
|
+
</p-tree-table>
|
|
490
|
+
</div>
|
|
479
491
|
`,
|
|
480
492
|
standalone: true,
|
|
481
|
-
imports: [TreeTableModule],
|
|
493
|
+
imports: [CommonModule, TreeTableModule],
|
|
482
494
|
providers: [NodeService]
|
|
483
495
|
})
|
|
484
496
|
export class TreetableColumnresizefitDemo implements OnInit {
|
|
485
497
|
private nodeService = inject(NodeService);
|
|
498
|
+
|
|
486
499
|
files!: TreeNode[];
|
|
500
|
+
|
|
487
501
|
cols!: Column[];
|
|
488
502
|
|
|
489
503
|
ngOnInit() {
|
|
@@ -502,11 +516,11 @@ export class TreetableColumnresizefitDemo implements OnInit {
|
|
|
502
516
|
To utilize the column resize modes with a scrollable TreeTable, a colgroup template must be defined. The default value of scrollHeight is "flex," it can also be set as a string value.
|
|
503
517
|
|
|
504
518
|
```typescript
|
|
505
|
-
import {
|
|
506
|
-
import {
|
|
507
|
-
import { NodeService } from '@/service/nodeservice';
|
|
519
|
+
import { CommonModule } from '@angular/common';
|
|
520
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
508
521
|
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
509
|
-
import {
|
|
522
|
+
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
523
|
+
import { NodeService } from '@/service/nodeservice';
|
|
510
524
|
|
|
511
525
|
interface Column {
|
|
512
526
|
field: string;
|
|
@@ -515,48 +529,52 @@ interface Column {
|
|
|
515
529
|
|
|
516
530
|
@Component({
|
|
517
531
|
template: `
|
|
518
|
-
<
|
|
519
|
-
<
|
|
520
|
-
<colgroup>
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
<
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
<
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
<
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
532
|
+
<div class="card">
|
|
533
|
+
<p-tree-table [value]="files" [columns]="cols" [resizableColumns]="true" [scrollable]="true" scrollHeight="200px" [tableStyle]="{ 'min-width': '50rem' }" showGridlines>
|
|
534
|
+
<ng-template #colgroup let-columns>
|
|
535
|
+
<colgroup>
|
|
536
|
+
@for (col of columns; track col) {
|
|
537
|
+
<col />
|
|
538
|
+
}
|
|
539
|
+
</colgroup>
|
|
540
|
+
</ng-template>
|
|
541
|
+
<ng-template #header let-columns>
|
|
542
|
+
<tr>
|
|
543
|
+
@for (col of columns; track col) {
|
|
544
|
+
<th ttResizableColumn>
|
|
545
|
+
{{ col.header }}
|
|
546
|
+
</th>
|
|
547
|
+
}
|
|
548
|
+
</tr>
|
|
549
|
+
</ng-template>
|
|
550
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
551
|
+
<tr [ttRow]="rowNode">
|
|
552
|
+
@for (col of columns; let first = $first; track col) {
|
|
553
|
+
<td>
|
|
554
|
+
@if (first) {
|
|
555
|
+
<div class="flex items-center gap-2">
|
|
556
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
557
|
+
<span>{{ rowData[col.field] }}</span>
|
|
558
|
+
</div>
|
|
559
|
+
} @else {
|
|
560
|
+
{{ rowData[col.field] }}
|
|
561
|
+
}
|
|
562
|
+
</td>
|
|
563
|
+
}
|
|
564
|
+
</tr>
|
|
565
|
+
</ng-template>
|
|
566
|
+
</p-tree-table>
|
|
567
|
+
</div>
|
|
552
568
|
`,
|
|
553
569
|
standalone: true,
|
|
554
|
-
imports: [TreeTableModule],
|
|
570
|
+
imports: [CommonModule, TreeTableModule],
|
|
555
571
|
providers: [NodeService]
|
|
556
572
|
})
|
|
557
573
|
export class TreetableColumnresizescrollableDemo implements OnInit {
|
|
558
574
|
private nodeService = inject(NodeService);
|
|
575
|
+
|
|
559
576
|
files!: TreeNode[];
|
|
577
|
+
|
|
560
578
|
cols!: Column[];
|
|
561
579
|
|
|
562
580
|
ngOnInit() {
|
|
@@ -575,12 +593,13 @@ export class TreetableColumnresizescrollableDemo implements OnInit {
|
|
|
575
593
|
Column visibility based on a condition can be implemented with dynamic columns, in this sample a MultiSelect is used to manage the visible columns.
|
|
576
594
|
|
|
577
595
|
```typescript
|
|
578
|
-
import {
|
|
596
|
+
import { CommonModule } from '@angular/common';
|
|
597
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
579
598
|
import { FormsModule } from '@angular/forms';
|
|
599
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
580
600
|
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
581
601
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
582
602
|
import { NodeService } from '@/service/nodeservice';
|
|
583
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
584
603
|
|
|
585
604
|
interface Column {
|
|
586
605
|
field: string;
|
|
@@ -589,56 +608,63 @@ interface Column {
|
|
|
589
608
|
|
|
590
609
|
@Component({
|
|
591
610
|
template: `
|
|
592
|
-
<
|
|
593
|
-
<
|
|
594
|
-
<
|
|
595
|
-
<
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
<
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
<
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
<
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
611
|
+
<div class="card">
|
|
612
|
+
<p-tree-table [value]="files" [columns]="selectedColumns" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
613
|
+
<ng-template #caption>
|
|
614
|
+
<div style="text-align:left">
|
|
615
|
+
<p-multi-select [options]="cols" [(ngModel)]="selectedColumns" optionLabel="header" selectedItemsLabel="{0} columns selected" [style]="{ width: '20em' }" placeholder="Choose Columns" display="chip" />
|
|
616
|
+
</div>
|
|
617
|
+
</ng-template>
|
|
618
|
+
<ng-template #header let-columns>
|
|
619
|
+
<tr>
|
|
620
|
+
@for (col of columns; track col) {
|
|
621
|
+
<th>
|
|
622
|
+
{{ col.header }}
|
|
623
|
+
</th>
|
|
624
|
+
}
|
|
625
|
+
</tr>
|
|
626
|
+
</ng-template>
|
|
627
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
628
|
+
<tr [ttRow]="rowNode">
|
|
629
|
+
@for (col of columns; let first = $first; track col) {
|
|
630
|
+
<td>
|
|
631
|
+
@if (first) {
|
|
632
|
+
<div class="flex items-center gap-2">
|
|
633
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
634
|
+
<span>{{ rowData[col.field] }}</span>
|
|
635
|
+
</div>
|
|
636
|
+
} @else {
|
|
637
|
+
{{ rowData[col.field] }}
|
|
638
|
+
}
|
|
639
|
+
</td>
|
|
640
|
+
}
|
|
641
|
+
</tr>
|
|
642
|
+
</ng-template>
|
|
643
|
+
</p-tree-table>
|
|
644
|
+
</div>
|
|
624
645
|
`,
|
|
625
646
|
standalone: true,
|
|
626
|
-
imports: [
|
|
647
|
+
imports: [CommonModule, FormsModule, TreeTableModule, MultiSelectModule],
|
|
627
648
|
providers: [NodeService]
|
|
628
649
|
})
|
|
629
650
|
export class TreetableColumntoggleDemo implements OnInit {
|
|
630
651
|
private nodeService = inject(NodeService);
|
|
652
|
+
|
|
631
653
|
files!: TreeNode[];
|
|
654
|
+
|
|
632
655
|
cols!: Column[];
|
|
656
|
+
|
|
633
657
|
selectedColumns!: Column[];
|
|
634
658
|
|
|
635
659
|
ngOnInit() {
|
|
636
660
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
661
|
+
|
|
637
662
|
this.cols = [
|
|
638
663
|
{ field: 'name', header: 'Name' },
|
|
639
664
|
{ field: 'size', header: 'Size' },
|
|
640
665
|
{ field: 'type', header: 'Type' }
|
|
641
666
|
];
|
|
667
|
+
|
|
642
668
|
this.selectedColumns = this.cols;
|
|
643
669
|
}
|
|
644
670
|
}
|
|
@@ -649,10 +675,11 @@ export class TreetableColumntoggleDemo implements OnInit {
|
|
|
649
675
|
Particular rows and cells can be styled based on conditions. The ngClass receives a row data as a parameter to return a style class for a row whereas cells are customized using the body template.
|
|
650
676
|
|
|
651
677
|
```typescript
|
|
652
|
-
import {
|
|
678
|
+
import { CommonModule } from '@angular/common';
|
|
679
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
680
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
653
681
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
654
682
|
import { NodeService } from '@/service/nodeservice';
|
|
655
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
656
683
|
|
|
657
684
|
interface Column {
|
|
658
685
|
field: string;
|
|
@@ -661,44 +688,48 @@ interface Column {
|
|
|
661
688
|
|
|
662
689
|
@Component({
|
|
663
690
|
template: `
|
|
664
|
-
<
|
|
665
|
-
<
|
|
666
|
-
<
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
<
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
<
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
691
|
+
<div class="card">
|
|
692
|
+
<p-tree-table [value]="files" [columns]="cols" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
693
|
+
<ng-template #header let-columns>
|
|
694
|
+
<tr>
|
|
695
|
+
@for (col of columns; track col) {
|
|
696
|
+
<th>
|
|
697
|
+
{{ col.header }}
|
|
698
|
+
</th>
|
|
699
|
+
}
|
|
700
|
+
</tr>
|
|
701
|
+
</ng-template>
|
|
702
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
703
|
+
<tr [ttRow]="rowNode" [ngClass]="{ 'bg-surface-100! dark:bg-surface-800!': rowData.size.endsWith('kb') }">
|
|
704
|
+
@for (col of columns; let first = $first; track col) {
|
|
705
|
+
<td [class]="{ 'line-through': col.field === 'size' && rowData.size.endsWith('kb') }">
|
|
706
|
+
@if (first) {
|
|
707
|
+
<div class="flex items-center gap-2">
|
|
708
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
709
|
+
<span>{{ rowData[col.field] }}</span>
|
|
710
|
+
</div>
|
|
711
|
+
} @else {
|
|
712
|
+
{{ rowData[col.field] }}
|
|
713
|
+
}
|
|
714
|
+
</td>
|
|
715
|
+
}
|
|
716
|
+
</tr>
|
|
717
|
+
</ng-template>
|
|
718
|
+
</p-tree-table>
|
|
719
|
+
</div>
|
|
720
|
+
`,
|
|
721
|
+
standalone: true,
|
|
722
|
+
imports: [CommonModule, TreeTableModule],
|
|
723
|
+
providers: [NodeService]
|
|
724
|
+
})
|
|
725
|
+
export class TreetableConditionalstyleDemo implements OnInit {
|
|
726
|
+
private nodeService = inject(NodeService);
|
|
727
|
+
|
|
728
|
+
files!: TreeNode[];
|
|
729
|
+
|
|
730
|
+
cols!: Column[];
|
|
731
|
+
|
|
732
|
+
ngOnInit() {
|
|
702
733
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
703
734
|
this.cols = [
|
|
704
735
|
{ field: 'name', header: 'Name' },
|
|
@@ -714,11 +745,13 @@ export class TreetableConditionalstyleDemo implements OnInit {
|
|
|
714
745
|
TreeTable has exclusive integration with contextmenu component. In order to attach a menu to a table, add ttContextMenuRow directive to the rows that can be selected with context menu, define a local template variable for the menu and bind it to the contextMenu property of the table. This enables displaying the menu whenever a row is right clicked. A separate contextMenuSelection property is used to get a hold of the right clicked row. For dynamic columns, setting ttContextMenuRowDisabled property as true disables context menu for that particular row.
|
|
715
746
|
|
|
716
747
|
```typescript
|
|
717
|
-
import {
|
|
718
|
-
import {
|
|
748
|
+
import { CommonModule } from '@angular/common';
|
|
749
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
750
|
+
import { MenuItem, MessageService, TreeNode } from '@exhaustive-ui/core/api';
|
|
751
|
+
import { ContextMenuModule } from '@exhaustive-ui/core/contextmenu';
|
|
752
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
753
|
+
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
719
754
|
import { NodeService } from '@/service/nodeservice';
|
|
720
|
-
import { TreeNode, MenuItem, MessageService } from '@exhaustive-ui/core/api';
|
|
721
|
-
import { TreeTable } from '@exhaustive-ui/core/treetable';
|
|
722
755
|
|
|
723
756
|
interface Column {
|
|
724
757
|
field: string;
|
|
@@ -727,53 +760,63 @@ interface Column {
|
|
|
727
760
|
|
|
728
761
|
@Component({
|
|
729
762
|
template: `
|
|
730
|
-
<
|
|
731
|
-
<
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
<
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
763
|
+
<div class="card">
|
|
764
|
+
<p-toast [style]="{ marginTop: '80px' }" />
|
|
765
|
+
<p-tree-table [value]="files" [columns]="cols" dataKey="name" [(contextMenuSelection)]="selectedNode" [contextMenu]="cm" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
766
|
+
<ng-template #header let-columns>
|
|
767
|
+
<tr>
|
|
768
|
+
@for (col of columns; track col) {
|
|
769
|
+
<th>
|
|
770
|
+
{{ col.header }}
|
|
771
|
+
</th>
|
|
772
|
+
}
|
|
773
|
+
</tr>
|
|
774
|
+
</ng-template>
|
|
775
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
776
|
+
<tr [ttRow]="rowNode" [ttContextMenuRow]="rowNode">
|
|
777
|
+
@for (col of columns; let first = $first; track col) {
|
|
778
|
+
<td>
|
|
779
|
+
@if (first) {
|
|
780
|
+
<div class="flex items-center gap-2">
|
|
781
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
782
|
+
<span>{{ rowData[col.field] }}</span>
|
|
783
|
+
</div>
|
|
784
|
+
} @else {
|
|
785
|
+
{{ rowData[col.field] }}
|
|
786
|
+
}
|
|
787
|
+
</td>
|
|
788
|
+
}
|
|
789
|
+
</tr>
|
|
790
|
+
</ng-template>
|
|
791
|
+
</p-tree-table>
|
|
792
|
+
<p-context-menu #cm [model]="items" />
|
|
793
|
+
</div>
|
|
757
794
|
`,
|
|
758
795
|
standalone: true,
|
|
759
|
-
imports: [TreeTableModule],
|
|
760
|
-
providers: [
|
|
796
|
+
imports: [CommonModule, TreeTableModule, ToastModule, ContextMenuModule],
|
|
797
|
+
providers: [MessageService, NodeService]
|
|
761
798
|
})
|
|
762
799
|
export class TreetableContextmenuDemo implements OnInit {
|
|
763
800
|
private nodeService = inject(NodeService);
|
|
764
801
|
private messageService = inject(MessageService);
|
|
802
|
+
|
|
765
803
|
files!: TreeNode[];
|
|
804
|
+
|
|
766
805
|
selectedNode!: TreeNode;
|
|
806
|
+
|
|
767
807
|
cols!: Column[];
|
|
808
|
+
|
|
768
809
|
items!: MenuItem[];
|
|
769
810
|
|
|
770
811
|
ngOnInit() {
|
|
771
812
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
813
|
+
|
|
772
814
|
this.cols = [
|
|
773
815
|
{ field: 'name', header: 'Name' },
|
|
774
816
|
{ field: 'size', header: 'Size' },
|
|
775
817
|
{ field: 'type', header: 'Type' }
|
|
776
818
|
];
|
|
819
|
+
|
|
777
820
|
this.items = [
|
|
778
821
|
{ label: 'View', icon: 'pi pi-search', command: (event) => this.viewFile(this.selectedNode) },
|
|
779
822
|
{ label: 'Toggle', icon: 'pi pi-sort', command: (event) => this.toggleFile(this.selectedNode) }
|
|
@@ -793,44 +836,49 @@ export class TreetableContextmenuDemo implements OnInit {
|
|
|
793
836
|
|
|
794
837
|
## Controlled
|
|
795
838
|
|
|
796
|
-
Expansion state is controlled with
|
|
839
|
+
Expansion state is controlled with the expanded property of the nodes.
|
|
797
840
|
|
|
798
841
|
```typescript
|
|
799
|
-
import { Component,
|
|
842
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
843
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
844
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
800
845
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
801
846
|
import { NodeService } from '@/service/nodeservice';
|
|
802
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
803
847
|
|
|
804
848
|
@Component({
|
|
805
849
|
template: `
|
|
806
|
-
<
|
|
807
|
-
<
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
<
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
<
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
850
|
+
<div class="card">
|
|
851
|
+
<p-button (click)="toggleApplications()" label="Toggle Applications" class="block mb-4" />
|
|
852
|
+
<p-tree-table [value]="files" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
853
|
+
<ng-template #header>
|
|
854
|
+
<tr>
|
|
855
|
+
<th>Name</th>
|
|
856
|
+
<th>Size</th>
|
|
857
|
+
<th>Type</th>
|
|
858
|
+
</tr>
|
|
859
|
+
</ng-template>
|
|
860
|
+
<ng-template #body let-rowNode let-rowData="rowData">
|
|
861
|
+
<tr [ttRow]="rowNode">
|
|
862
|
+
<td>
|
|
863
|
+
<div class="flex items-center gap-2">
|
|
864
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
865
|
+
<span>{{ rowData.name }}</span>
|
|
866
|
+
</div>
|
|
867
|
+
</td>
|
|
868
|
+
<td>{{ rowData.size }}</td>
|
|
869
|
+
<td>{{ rowData.type }}</td>
|
|
870
|
+
</tr>
|
|
871
|
+
</ng-template>
|
|
872
|
+
</p-tree-table>
|
|
873
|
+
</div>
|
|
827
874
|
`,
|
|
828
875
|
standalone: true,
|
|
829
|
-
imports: [TreeTableModule],
|
|
876
|
+
imports: [TreeTableModule, ButtonModule],
|
|
830
877
|
providers: [NodeService]
|
|
831
878
|
})
|
|
832
879
|
export class TreetableControlledDemo implements OnInit {
|
|
833
880
|
private nodeService = inject(NodeService);
|
|
881
|
+
|
|
834
882
|
files!: TreeNode[];
|
|
835
883
|
|
|
836
884
|
ngOnInit() {
|
|
@@ -854,10 +902,11 @@ export class TreetableControlledDemo implements OnInit {
|
|
|
854
902
|
Columns can be created programmatically.
|
|
855
903
|
|
|
856
904
|
```typescript
|
|
857
|
-
import {
|
|
905
|
+
import { CommonModule } from '@angular/common';
|
|
906
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
907
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
858
908
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
859
909
|
import { NodeService } from '@/service/nodeservice';
|
|
860
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
861
910
|
|
|
862
911
|
interface Column {
|
|
863
912
|
field: string;
|
|
@@ -866,41 +915,45 @@ interface Column {
|
|
|
866
915
|
|
|
867
916
|
@Component({
|
|
868
917
|
template: `
|
|
869
|
-
<
|
|
870
|
-
<
|
|
871
|
-
<
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
<
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
<
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
918
|
+
<div class="card">
|
|
919
|
+
<p-tree-table [value]="files" [columns]="cols" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
920
|
+
<ng-template #header let-columns>
|
|
921
|
+
<tr>
|
|
922
|
+
@for (col of columns; track col) {
|
|
923
|
+
<th>
|
|
924
|
+
{{ col.header }}
|
|
925
|
+
</th>
|
|
926
|
+
}
|
|
927
|
+
</tr>
|
|
928
|
+
</ng-template>
|
|
929
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
930
|
+
<tr [ttRow]="rowNode">
|
|
931
|
+
@for (col of columns; let first = $first; track col) {
|
|
932
|
+
<td>
|
|
933
|
+
@if (first) {
|
|
934
|
+
<div class="flex items-center gap-2">
|
|
935
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
936
|
+
<span>{{ rowData[col.field] }}</span>
|
|
937
|
+
</div>
|
|
938
|
+
} @else {
|
|
939
|
+
{{ rowData[col.field] }}
|
|
940
|
+
}
|
|
941
|
+
</td>
|
|
942
|
+
}
|
|
943
|
+
</tr>
|
|
944
|
+
</ng-template>
|
|
945
|
+
</p-tree-table>
|
|
946
|
+
</div>
|
|
896
947
|
`,
|
|
897
948
|
standalone: true,
|
|
898
|
-
imports: [TreeTableModule],
|
|
949
|
+
imports: [CommonModule, TreeTableModule],
|
|
899
950
|
providers: [NodeService]
|
|
900
951
|
})
|
|
901
952
|
export class TreetableDynamiccolumnsDemo implements OnInit {
|
|
902
953
|
private nodeService = inject(NodeService);
|
|
954
|
+
|
|
903
955
|
files!: TreeNode[];
|
|
956
|
+
|
|
904
957
|
cols!: Column[];
|
|
905
958
|
|
|
906
959
|
ngOnInit() {
|
|
@@ -916,15 +969,16 @@ export class TreetableDynamiccolumnsDemo implements OnInit {
|
|
|
916
969
|
|
|
917
970
|
## edit-doc
|
|
918
971
|
|
|
919
|
-
Incell editing is enabled by defining input elements with
|
|
972
|
+
Incell editing is enabled by adding ttEditableColumn to a cell and defining input elements with p-tree-table-cell-editor .
|
|
920
973
|
|
|
921
974
|
```typescript
|
|
922
|
-
import {
|
|
975
|
+
import { CommonModule } from '@angular/common';
|
|
976
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
923
977
|
import { FormsModule } from '@angular/forms';
|
|
924
978
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
925
979
|
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
926
|
-
import { NodeService } from '@/service/nodeservice';
|
|
927
980
|
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
981
|
+
import { NodeService } from '@/service/nodeservice';
|
|
928
982
|
|
|
929
983
|
interface Column {
|
|
930
984
|
field: string;
|
|
@@ -933,36 +987,40 @@ interface Column {
|
|
|
933
987
|
|
|
934
988
|
@Component({
|
|
935
989
|
template: `
|
|
936
|
-
<
|
|
937
|
-
<
|
|
938
|
-
<
|
|
939
|
-
<
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
<
|
|
946
|
-
<
|
|
947
|
-
<
|
|
948
|
-
|
|
949
|
-
<
|
|
950
|
-
<input
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
990
|
+
<div class="card">
|
|
991
|
+
<p-tree-table [value]="files" [columns]="cols" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
992
|
+
<ng-template #header let-columns>
|
|
993
|
+
<tr>
|
|
994
|
+
<th *ngFor="let col of columns">
|
|
995
|
+
{{ col.header }}
|
|
996
|
+
</th>
|
|
997
|
+
</tr>
|
|
998
|
+
</ng-template>
|
|
999
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
1000
|
+
<tr [ttRow]="rowNode">
|
|
1001
|
+
<td *ngFor="let col of columns; let i = index" ttEditableColumn [ttEditableColumnDisabled]="i == 0" [ngClass]="{ 'p-toggler-column': i === 0 }">
|
|
1002
|
+
<p-tree-table-toggler [rowNode]="rowNode" *ngIf="i === 0" />
|
|
1003
|
+
<p-tree-table-cell-editor>
|
|
1004
|
+
<ng-template #input>
|
|
1005
|
+
<input pInputText type="text" [(ngModel)]="rowData[col.field]" />
|
|
1006
|
+
</ng-template>
|
|
1007
|
+
<ng-template #output>{{ rowData[col.field] }}</ng-template>
|
|
1008
|
+
</p-tree-table-cell-editor>
|
|
1009
|
+
</td>
|
|
1010
|
+
</tr>
|
|
1011
|
+
</ng-template>
|
|
1012
|
+
</p-tree-table>
|
|
1013
|
+
</div>
|
|
958
1014
|
`,
|
|
959
1015
|
standalone: true,
|
|
960
|
-
imports: [TreeTableModule, InputTextModule
|
|
1016
|
+
imports: [CommonModule, FormsModule, TreeTableModule, InputTextModule],
|
|
961
1017
|
providers: [NodeService]
|
|
962
1018
|
})
|
|
963
1019
|
export class TreetableEditDemo implements OnInit {
|
|
964
1020
|
private nodeService = inject(NodeService);
|
|
1021
|
+
|
|
965
1022
|
files!: TreeNode[];
|
|
1023
|
+
|
|
966
1024
|
cols!: Column[];
|
|
967
1025
|
|
|
968
1026
|
ngOnInit() {
|
|
@@ -978,16 +1036,19 @@ export class TreetableEditDemo implements OnInit {
|
|
|
978
1036
|
|
|
979
1037
|
## Filter
|
|
980
1038
|
|
|
981
|
-
The 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. A
|
|
1039
|
+
The 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. A method called filterGlobal is also provided to search all columns that support filtering.
|
|
982
1040
|
|
|
983
1041
|
```typescript
|
|
984
|
-
import {
|
|
1042
|
+
import { CommonModule } from '@angular/common';
|
|
1043
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1044
|
+
import { FormsModule } from '@angular/forms';
|
|
1045
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
985
1046
|
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
986
1047
|
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
987
|
-
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
988
1048
|
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
1049
|
+
import { SelectButtonModule } from '@exhaustive-ui/core/selectbutton';
|
|
1050
|
+
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
989
1051
|
import { NodeService } from '@/service/nodeservice';
|
|
990
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
991
1052
|
|
|
992
1053
|
interface Column {
|
|
993
1054
|
field: string;
|
|
@@ -996,63 +1057,75 @@ interface Column {
|
|
|
996
1057
|
|
|
997
1058
|
@Component({
|
|
998
1059
|
template: `
|
|
999
|
-
<
|
|
1000
|
-
<
|
|
1001
|
-
<
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
</
|
|
1044
|
-
|
|
1045
|
-
|
|
1060
|
+
<div class="card">
|
|
1061
|
+
<div class="flex justify-center mb-6">
|
|
1062
|
+
<p-select-button [options]="filterModes" [(ngModel)]="filterMode" optionLabel="label" optionValue="value" />
|
|
1063
|
+
</div>
|
|
1064
|
+
<p-tree-table #tt [value]="files" [columns]="cols" [filterMode]="filterMode" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1065
|
+
<ng-template #caption>
|
|
1066
|
+
<div class="flex justify-end items-center">
|
|
1067
|
+
<p-icon-field>
|
|
1068
|
+
<p-input-icon class="pi pi-search" />
|
|
1069
|
+
<input type="text" pInputText placeholder="Global Search" (input)="tt.filterGlobal($event.target.value, 'contains')" />
|
|
1070
|
+
</p-icon-field>
|
|
1071
|
+
</div>
|
|
1072
|
+
</ng-template>
|
|
1073
|
+
<ng-template #header let-columns>
|
|
1074
|
+
<tr>
|
|
1075
|
+
@for (col of columns; track col) {
|
|
1076
|
+
<th>
|
|
1077
|
+
{{ col.header }}
|
|
1078
|
+
</th>
|
|
1079
|
+
}
|
|
1080
|
+
</tr>
|
|
1081
|
+
<tr>
|
|
1082
|
+
@for (col of columns; track col) {
|
|
1083
|
+
<th>
|
|
1084
|
+
<input pInputText [placeholder]="'Filter by ' + col.field" type="text" (input)="tt.filter($event.target.value, col.field, col.filterMatchMode)" />
|
|
1085
|
+
</th>
|
|
1086
|
+
}
|
|
1087
|
+
</tr>
|
|
1088
|
+
</ng-template>
|
|
1089
|
+
<ng-template #body let-rowNode let-rowData="rowData">
|
|
1090
|
+
<tr [ttRow]="rowNode">
|
|
1091
|
+
@for (col of cols; let first = $first; track col) {
|
|
1092
|
+
<td>
|
|
1093
|
+
@if (first) {
|
|
1094
|
+
<div class="flex items-center gap-2">
|
|
1095
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
1096
|
+
<span>{{ rowData[col.field] }}</span>
|
|
1097
|
+
</div>
|
|
1098
|
+
} @else {
|
|
1099
|
+
{{ rowData[col.field] }}
|
|
1100
|
+
}
|
|
1101
|
+
</td>
|
|
1102
|
+
}
|
|
1103
|
+
</tr>
|
|
1104
|
+
</ng-template>
|
|
1105
|
+
<ng-template #emptymessage>
|
|
1106
|
+
<tr>
|
|
1107
|
+
<td [attr.colspan]="cols?.length">No data found.</td>
|
|
1108
|
+
</tr>
|
|
1109
|
+
</ng-template>
|
|
1110
|
+
</p-tree-table>
|
|
1111
|
+
</div>
|
|
1046
1112
|
`,
|
|
1047
1113
|
standalone: true,
|
|
1048
|
-
imports: [
|
|
1114
|
+
imports: [CommonModule, FormsModule, TreeTableModule, SelectButtonModule, InputTextModule, IconFieldModule, InputIconModule],
|
|
1049
1115
|
providers: [NodeService]
|
|
1050
1116
|
})
|
|
1051
1117
|
export class TreetableFilterDemo implements OnInit {
|
|
1052
1118
|
private nodeService = inject(NodeService);
|
|
1053
|
-
|
|
1054
|
-
|
|
1119
|
+
|
|
1120
|
+
filterMode = 'lenient';
|
|
1121
|
+
|
|
1122
|
+
filterModes = [
|
|
1123
|
+
{ label: 'Lenient', value: 'lenient' },
|
|
1124
|
+
{ label: 'Strict', value: 'strict' }
|
|
1125
|
+
];
|
|
1126
|
+
|
|
1055
1127
|
files!: TreeNode[];
|
|
1128
|
+
|
|
1056
1129
|
cols!: Column[];
|
|
1057
1130
|
|
|
1058
1131
|
ngOnInit() {
|
|
@@ -1071,52 +1144,56 @@ export class TreetableFilterDemo implements OnInit {
|
|
|
1071
1144
|
Flex scroll feature makes the scrollable viewport section dynamic instead of a fixed value so that it can grow or shrink relative to the parent size of the table. Click the button below to display a maximizable Dialog where data viewport adjusts itself according to the size changes.
|
|
1072
1145
|
|
|
1073
1146
|
```typescript
|
|
1074
|
-
import { Component,
|
|
1147
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1148
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1075
1149
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1076
|
-
import {
|
|
1150
|
+
import { DialogModule } from '@exhaustive-ui/core/dialog';
|
|
1077
1151
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1078
1152
|
import { NodeService } from '@/service/nodeservice';
|
|
1079
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1080
1153
|
|
|
1081
1154
|
@Component({
|
|
1082
1155
|
template: `
|
|
1083
|
-
<
|
|
1084
|
-
|
|
1085
|
-
<
|
|
1086
|
-
<
|
|
1087
|
-
<
|
|
1088
|
-
<
|
|
1089
|
-
<
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
<
|
|
1096
|
-
<
|
|
1097
|
-
<
|
|
1098
|
-
<
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
<
|
|
1110
|
-
|
|
1111
|
-
|
|
1156
|
+
<div class="card flex justify-center">
|
|
1157
|
+
<p-button label="Show" icon="pi pi-external-link" (onClick)="dialogVisible = true" />
|
|
1158
|
+
<p-dialog [(visible)]="dialogVisible" header="Flex Scroll" [style]="{ width: '75vw' }" maximizable modal [contentStyle]="{ height: '300px' }">
|
|
1159
|
+
<ng-template #content>
|
|
1160
|
+
<p-tree-table [value]="files" [scrollable]="true" scrollHeight="flex" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1161
|
+
<ng-template #header>
|
|
1162
|
+
<tr>
|
|
1163
|
+
<th>Name</th>
|
|
1164
|
+
<th>Size</th>
|
|
1165
|
+
<th>Type</th>
|
|
1166
|
+
</tr>
|
|
1167
|
+
</ng-template>
|
|
1168
|
+
<ng-template #body let-rowNode let-rowData="rowData">
|
|
1169
|
+
<tr [ttRow]="rowNode">
|
|
1170
|
+
<td>
|
|
1171
|
+
<div class="flex items-center gap-2">
|
|
1172
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
1173
|
+
<span>{{ rowData.name }}</span>
|
|
1174
|
+
</div>
|
|
1175
|
+
</td>
|
|
1176
|
+
<td>{{ rowData.size }}</td>
|
|
1177
|
+
<td>{{ rowData.type }}</td>
|
|
1178
|
+
</tr>
|
|
1179
|
+
</ng-template>
|
|
1180
|
+
</p-tree-table>
|
|
1181
|
+
</ng-template>
|
|
1182
|
+
<ng-template #footer>
|
|
1183
|
+
<p-button label="Ok" icon="pi pi-check" (onClick)="dialogVisible = false" />
|
|
1184
|
+
</ng-template>
|
|
1185
|
+
</p-dialog>
|
|
1186
|
+
</div>
|
|
1112
1187
|
`,
|
|
1113
1188
|
standalone: true,
|
|
1114
|
-
imports: [ButtonModule, DialogModule
|
|
1189
|
+
imports: [TreeTableModule, ButtonModule, DialogModule],
|
|
1115
1190
|
providers: [NodeService]
|
|
1116
1191
|
})
|
|
1117
1192
|
export class TreetableFlexiblescrollDemo implements OnInit {
|
|
1118
1193
|
private nodeService = inject(NodeService);
|
|
1194
|
+
|
|
1119
1195
|
files!: TreeNode[];
|
|
1196
|
+
|
|
1120
1197
|
dialogVisible: boolean = false;
|
|
1121
1198
|
|
|
1122
1199
|
ngOnInit() {
|
|
@@ -1132,34 +1209,38 @@ export class TreetableFlexiblescrollDemo implements OnInit {
|
|
|
1132
1209
|
Enabling showGridlines displays grid lines.
|
|
1133
1210
|
|
|
1134
1211
|
```typescript
|
|
1135
|
-
import { Component,
|
|
1212
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1213
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1136
1214
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1137
1215
|
import { NodeService } from '@/service/nodeservice';
|
|
1138
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1139
1216
|
|
|
1140
1217
|
@Component({
|
|
1141
1218
|
template: `
|
|
1142
|
-
<
|
|
1143
|
-
<
|
|
1144
|
-
<
|
|
1145
|
-
<
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
<
|
|
1153
|
-
<
|
|
1154
|
-
<
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1219
|
+
<section class="py-6">
|
|
1220
|
+
<div class="card">
|
|
1221
|
+
<p-tree-table [value]="files" [scrollable]="true" showGridlines [tableStyle]="{ 'min-width': '50rem' }">
|
|
1222
|
+
<ng-template #header>
|
|
1223
|
+
<tr>
|
|
1224
|
+
<th>Name</th>
|
|
1225
|
+
<th>Size</th>
|
|
1226
|
+
<th>Type</th>
|
|
1227
|
+
</tr>
|
|
1228
|
+
</ng-template>
|
|
1229
|
+
<ng-template #body let-rowNode let-rowData="rowData">
|
|
1230
|
+
<tr [ttRow]="rowNode">
|
|
1231
|
+
<td>
|
|
1232
|
+
<div class="flex items-center gap-2">
|
|
1233
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
1234
|
+
<span>{{ rowData.name }}</span>
|
|
1235
|
+
</div>
|
|
1236
|
+
</td>
|
|
1237
|
+
<td>{{ rowData.size }}</td>
|
|
1238
|
+
<td>{{ rowData.type }}</td>
|
|
1239
|
+
</tr>
|
|
1240
|
+
</ng-template>
|
|
1241
|
+
</p-tree-table>
|
|
1242
|
+
</div>
|
|
1243
|
+
</section>
|
|
1163
1244
|
`,
|
|
1164
1245
|
standalone: true,
|
|
1165
1246
|
imports: [TreeTableModule],
|
|
@@ -1167,6 +1248,7 @@ import { TreeNode } from '@exhaustive-ui/core/api';
|
|
|
1167
1248
|
})
|
|
1168
1249
|
export class TreetableGridlinesDemo implements OnInit {
|
|
1169
1250
|
private nodeService = inject(NodeService);
|
|
1251
|
+
|
|
1170
1252
|
files!: TreeNode[];
|
|
1171
1253
|
|
|
1172
1254
|
ngOnInit() {
|
|
@@ -1180,10 +1262,10 @@ export class TreetableGridlinesDemo implements OnInit {
|
|
|
1180
1262
|
Lazy mode is handy to deal with large datasets, instead of loading the entire data, small chunks of data is loaded by invoking corresponding callbacks everytime paging , sorting and filtering occurs. Sample below imitates lazy loading data from a remote datasource using an in-memory list and timeouts to mimic network connection. Enabling the lazy property and assigning the logical number of rows to totalRecords by doing a projection query are the key elements of the implementation so that paginator displays the UI assuming there are actually records of totalRecords size although in reality they are not present on page, only the records that are displayed on the current page exist. In addition, only the root elements should be loaded, children can be loaded on demand using onNodeExpand callback.
|
|
1181
1263
|
|
|
1182
1264
|
```typescript
|
|
1183
|
-
import {
|
|
1184
|
-
import {
|
|
1185
|
-
import { NodeService } from '@/service/nodeservice';
|
|
1265
|
+
import { CommonModule } from '@angular/common';
|
|
1266
|
+
import { Component, OnInit } from '@angular/core';
|
|
1186
1267
|
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1268
|
+
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1187
1269
|
|
|
1188
1270
|
interface Column {
|
|
1189
1271
|
field: string;
|
|
@@ -1235,14 +1317,15 @@ interface Column {
|
|
|
1235
1317
|
</div>
|
|
1236
1318
|
`,
|
|
1237
1319
|
standalone: true,
|
|
1238
|
-
imports: [TreeTableModule]
|
|
1239
|
-
providers: [NodeService]
|
|
1320
|
+
imports: [CommonModule, TreeTableModule]
|
|
1240
1321
|
})
|
|
1241
1322
|
export class TreetableLazyloadDemo implements OnInit {
|
|
1242
|
-
private nodeService = inject(NodeService);
|
|
1243
1323
|
files!: TreeNode[];
|
|
1324
|
+
|
|
1244
1325
|
cols!: Column[];
|
|
1326
|
+
|
|
1245
1327
|
totalRecords!: number;
|
|
1328
|
+
|
|
1246
1329
|
loading: boolean = false;
|
|
1247
1330
|
|
|
1248
1331
|
ngOnInit() {
|
|
@@ -1251,16 +1334,18 @@ export class TreetableLazyloadDemo implements OnInit {
|
|
|
1251
1334
|
{ field: 'size', header: 'Size' },
|
|
1252
1335
|
{ field: 'type', header: 'Type' }
|
|
1253
1336
|
];
|
|
1337
|
+
|
|
1254
1338
|
this.totalRecords = 1000;
|
|
1339
|
+
|
|
1255
1340
|
this.loading = true;
|
|
1256
1341
|
}
|
|
1257
1342
|
|
|
1258
1343
|
loadNodes(event: any) {
|
|
1259
1344
|
this.loading = true;
|
|
1260
|
-
|
|
1345
|
+
|
|
1261
1346
|
setTimeout(() => {
|
|
1262
1347
|
this.files = [];
|
|
1263
|
-
|
|
1348
|
+
|
|
1264
1349
|
for (let i = 0; i < event.rows; i++) {
|
|
1265
1350
|
let node = {
|
|
1266
1351
|
data: {
|
|
@@ -1270,21 +1355,20 @@ export class TreetableLazyloadDemo implements OnInit {
|
|
|
1270
1355
|
},
|
|
1271
1356
|
leaf: false
|
|
1272
1357
|
};
|
|
1273
|
-
|
|
1358
|
+
|
|
1274
1359
|
this.files.push(node);
|
|
1275
1360
|
}
|
|
1276
1361
|
this.loading = false;
|
|
1277
|
-
this.cd.markForCheck();
|
|
1278
1362
|
}, 1000);
|
|
1279
1363
|
}
|
|
1280
1364
|
|
|
1281
1365
|
onNodeExpand(event: any) {
|
|
1282
1366
|
this.loading = true;
|
|
1283
|
-
|
|
1367
|
+
|
|
1284
1368
|
setTimeout(() => {
|
|
1285
1369
|
this.loading = false;
|
|
1286
1370
|
const node = event.node;
|
|
1287
|
-
|
|
1371
|
+
|
|
1288
1372
|
node.children = [
|
|
1289
1373
|
{
|
|
1290
1374
|
data: {
|
|
@@ -1301,9 +1385,8 @@ export class TreetableLazyloadDemo implements OnInit {
|
|
|
1301
1385
|
}
|
|
1302
1386
|
}
|
|
1303
1387
|
];
|
|
1304
|
-
|
|
1388
|
+
|
|
1305
1389
|
this.files = [...this.files];
|
|
1306
|
-
this.cd.markForCheck();
|
|
1307
1390
|
}, 250);
|
|
1308
1391
|
}
|
|
1309
1392
|
}
|
|
@@ -1314,10 +1397,10 @@ export class TreetableLazyloadDemo implements OnInit {
|
|
|
1314
1397
|
The loading property displays a mask layer to indicate busy state. Use the paginator to display the mask.
|
|
1315
1398
|
|
|
1316
1399
|
```typescript
|
|
1317
|
-
import { Component,
|
|
1400
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1401
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1318
1402
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1319
1403
|
import { NodeService } from '@/service/nodeservice';
|
|
1320
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1321
1404
|
|
|
1322
1405
|
@Component({
|
|
1323
1406
|
template: `
|
|
@@ -1351,6 +1434,7 @@ import { TreeNode } from '@exhaustive-ui/core/api';
|
|
|
1351
1434
|
})
|
|
1352
1435
|
export class TreetableLoadingmaskDemo implements OnInit {
|
|
1353
1436
|
private nodeService = inject(NodeService);
|
|
1437
|
+
|
|
1354
1438
|
files!: TreeNode[];
|
|
1355
1439
|
|
|
1356
1440
|
ngOnInit() {
|
|
@@ -1364,11 +1448,11 @@ export class TreetableLoadingmaskDemo implements OnInit {
|
|
|
1364
1448
|
Skeleton component can be used as a placeholder during the loading process.
|
|
1365
1449
|
|
|
1366
1450
|
```typescript
|
|
1367
|
-
import { Component,
|
|
1451
|
+
import { Component, signal, inject, OnInit } from '@angular/core';
|
|
1452
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1368
1453
|
import { SkeletonModule } from '@exhaustive-ui/core/skeleton';
|
|
1369
1454
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1370
1455
|
import { NodeService } from '@/service/nodeservice';
|
|
1371
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1372
1456
|
|
|
1373
1457
|
@Component({
|
|
1374
1458
|
template: `
|
|
@@ -1392,11 +1476,12 @@ import { TreeNode } from '@exhaustive-ui/core/api';
|
|
|
1392
1476
|
</div>
|
|
1393
1477
|
`,
|
|
1394
1478
|
standalone: true,
|
|
1395
|
-
imports: [
|
|
1479
|
+
imports: [TreeTableModule, SkeletonModule],
|
|
1396
1480
|
providers: [NodeService]
|
|
1397
1481
|
})
|
|
1398
1482
|
export class TreetableLoadingskeletonDemo implements OnInit {
|
|
1399
1483
|
private nodeService = inject(NodeService);
|
|
1484
|
+
|
|
1400
1485
|
files = signal<TreeNode[]>([]);
|
|
1401
1486
|
|
|
1402
1487
|
ngOnInit() {
|
|
@@ -1410,9 +1495,10 @@ export class TreetableLoadingskeletonDemo implements OnInit {
|
|
|
1410
1495
|
Pagination is enabled by adding paginator property and defining rows per page.
|
|
1411
1496
|
|
|
1412
1497
|
```typescript
|
|
1498
|
+
import { CommonModule } from '@angular/common';
|
|
1413
1499
|
import { Component, OnInit } from '@angular/core';
|
|
1414
|
-
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1415
1500
|
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1501
|
+
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1416
1502
|
|
|
1417
1503
|
interface Column {
|
|
1418
1504
|
field: string;
|
|
@@ -1421,41 +1507,43 @@ interface Column {
|
|
|
1421
1507
|
|
|
1422
1508
|
@Component({
|
|
1423
1509
|
template: `
|
|
1424
|
-
<
|
|
1425
|
-
<
|
|
1426
|
-
<
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
<
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
<
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1510
|
+
<div class="card">
|
|
1511
|
+
<p-tree-table [value]="files" [columns]="cols" [paginator]="true" [rows]="5" [rowsPerPageOptions]="[5, 10, 25]" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1512
|
+
<ng-template #header let-columns>
|
|
1513
|
+
<tr>
|
|
1514
|
+
@for (col of columns; track col) {
|
|
1515
|
+
<th>
|
|
1516
|
+
{{ col.header }}
|
|
1517
|
+
</th>
|
|
1518
|
+
}
|
|
1519
|
+
</tr>
|
|
1520
|
+
</ng-template>
|
|
1521
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
1522
|
+
<tr [ttRow]="rowNode">
|
|
1523
|
+
@for (col of columns; let first = $first; track col) {
|
|
1524
|
+
<td>
|
|
1525
|
+
@if (first) {
|
|
1526
|
+
<div class="flex items-center gap-2">
|
|
1527
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
1528
|
+
<span>{{ rowData[col.field] }}</span>
|
|
1529
|
+
</div>
|
|
1530
|
+
} @else {
|
|
1531
|
+
{{ rowData[col.field] }}
|
|
1532
|
+
}
|
|
1533
|
+
</td>
|
|
1534
|
+
}
|
|
1535
|
+
</tr>
|
|
1536
|
+
</ng-template>
|
|
1537
|
+
</p-tree-table>
|
|
1538
|
+
</div>
|
|
1451
1539
|
`,
|
|
1452
1540
|
standalone: true,
|
|
1453
|
-
imports: [TreeTableModule]
|
|
1541
|
+
imports: [CommonModule, TreeTableModule]
|
|
1454
1542
|
})
|
|
1455
1543
|
export class TreetablePaginatorbasicDemo implements OnInit {
|
|
1456
1544
|
files!: TreeNode[];
|
|
1457
|
-
cols!: Column[];
|
|
1458
1545
|
|
|
1546
|
+
cols!: Column[];
|
|
1459
1547
|
ngOnInit() {
|
|
1460
1548
|
this.files = [];
|
|
1461
1549
|
for (let i = 0; i < 50; i++) {
|
|
@@ -1475,8 +1563,10 @@ export class TreetablePaginatorbasicDemo implements OnInit {
|
|
|
1475
1563
|
}
|
|
1476
1564
|
]
|
|
1477
1565
|
};
|
|
1566
|
+
|
|
1478
1567
|
this.files.push(node);
|
|
1479
1568
|
}
|
|
1569
|
+
|
|
1480
1570
|
this.cols = [
|
|
1481
1571
|
{ field: 'name', header: 'Name' },
|
|
1482
1572
|
{ field: 'size', header: 'Size' },
|
|
@@ -1491,11 +1581,12 @@ export class TreetablePaginatorbasicDemo implements OnInit {
|
|
|
1491
1581
|
Paginator UI is customized using the paginatorleft and paginatorright property. Each element can also be customized further with your own UI to replace the default one, refer to the Paginator component for more information about the advanced customization options.
|
|
1492
1582
|
|
|
1493
1583
|
```typescript
|
|
1584
|
+
import { CommonModule } from '@angular/common';
|
|
1494
1585
|
import { Component, OnInit } from '@angular/core';
|
|
1586
|
+
import { RouterModule } from '@angular/router';
|
|
1587
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1495
1588
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1496
1589
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1497
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1498
|
-
import { Paginator } from '@exhaustive-ui/core/paginator';
|
|
1499
1590
|
|
|
1500
1591
|
interface Column {
|
|
1501
1592
|
field: string;
|
|
@@ -1504,45 +1595,48 @@ interface Column {
|
|
|
1504
1595
|
|
|
1505
1596
|
@Component({
|
|
1506
1597
|
template: `
|
|
1507
|
-
<
|
|
1508
|
-
<
|
|
1509
|
-
<
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
<
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
<
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
<
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
<
|
|
1538
|
-
|
|
1539
|
-
|
|
1598
|
+
<div class="card">
|
|
1599
|
+
<p-tree-table [value]="files" [columns]="cols" [paginator]="true" [rows]="10" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1600
|
+
<ng-template #header let-columns>
|
|
1601
|
+
<tr>
|
|
1602
|
+
@for (col of columns; track col) {
|
|
1603
|
+
<th>
|
|
1604
|
+
{{ col.header }}
|
|
1605
|
+
</th>
|
|
1606
|
+
}
|
|
1607
|
+
</tr>
|
|
1608
|
+
</ng-template>
|
|
1609
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
1610
|
+
<tr [ttRow]="rowNode">
|
|
1611
|
+
@for (col of columns; let first = $first; track col) {
|
|
1612
|
+
<td>
|
|
1613
|
+
@if (first) {
|
|
1614
|
+
<div class="flex items-center gap-2">
|
|
1615
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
1616
|
+
<span>{{ rowData[col.field] }}</span>
|
|
1617
|
+
</div>
|
|
1618
|
+
} @else {
|
|
1619
|
+
{{ rowData[col.field] }}
|
|
1620
|
+
}
|
|
1621
|
+
</td>
|
|
1622
|
+
}
|
|
1623
|
+
</tr>
|
|
1624
|
+
</ng-template>
|
|
1625
|
+
<ng-template #paginatorleft>
|
|
1626
|
+
<p-button icon="pi pi-refresh" text />
|
|
1627
|
+
</ng-template>
|
|
1628
|
+
<ng-template #paginatorright>
|
|
1629
|
+
<p-button icon="pi pi-download" text />
|
|
1630
|
+
</ng-template>
|
|
1631
|
+
</p-tree-table>
|
|
1632
|
+
</div>
|
|
1540
1633
|
`,
|
|
1541
1634
|
standalone: true,
|
|
1542
|
-
imports: [ButtonModule,
|
|
1635
|
+
imports: [CommonModule, TreeTableModule, ButtonModule, RouterModule]
|
|
1543
1636
|
})
|
|
1544
1637
|
export class TreetablePaginatortemplateDemo implements OnInit {
|
|
1545
1638
|
files!: TreeNode[];
|
|
1639
|
+
|
|
1546
1640
|
cols!: Column[];
|
|
1547
1641
|
|
|
1548
1642
|
ngOnInit() {
|
|
@@ -1564,8 +1658,10 @@ export class TreetablePaginatortemplateDemo implements OnInit {
|
|
|
1564
1658
|
}
|
|
1565
1659
|
]
|
|
1566
1660
|
};
|
|
1661
|
+
|
|
1567
1662
|
this.files.push(node);
|
|
1568
1663
|
}
|
|
1664
|
+
|
|
1569
1665
|
this.cols = [
|
|
1570
1666
|
{ field: 'name', header: 'Name' },
|
|
1571
1667
|
{ field: 'size', header: 'Size' },
|
|
@@ -1580,10 +1676,11 @@ export class TreetablePaginatortemplateDemo implements OnInit {
|
|
|
1580
1676
|
Order of the columns can be changed using drag and drop when reorderableColumns is present.
|
|
1581
1677
|
|
|
1582
1678
|
```typescript
|
|
1583
|
-
import {
|
|
1679
|
+
import { CommonModule } from '@angular/common';
|
|
1680
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1681
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1584
1682
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1585
1683
|
import { NodeService } from '@/service/nodeservice';
|
|
1586
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1587
1684
|
|
|
1588
1685
|
interface Column {
|
|
1589
1686
|
field: string;
|
|
@@ -1592,41 +1689,45 @@ interface Column {
|
|
|
1592
1689
|
|
|
1593
1690
|
@Component({
|
|
1594
1691
|
template: `
|
|
1595
|
-
<
|
|
1596
|
-
<
|
|
1597
|
-
<
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
<
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
<
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1692
|
+
<div class="card">
|
|
1693
|
+
<p-tree-table [value]="files" [columns]="cols" [reorderableColumns]="true" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1694
|
+
<ng-template #header let-columns>
|
|
1695
|
+
<tr>
|
|
1696
|
+
@for (col of columns; track col) {
|
|
1697
|
+
<th ttReorderableColumn>
|
|
1698
|
+
{{ col.header }}
|
|
1699
|
+
</th>
|
|
1700
|
+
}
|
|
1701
|
+
</tr>
|
|
1702
|
+
</ng-template>
|
|
1703
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
1704
|
+
<tr [ttRow]="rowNode">
|
|
1705
|
+
@for (col of columns; let first = $first; track col) {
|
|
1706
|
+
<td>
|
|
1707
|
+
@if (first) {
|
|
1708
|
+
<div class="flex items-center gap-2">
|
|
1709
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
1710
|
+
<span>{{ rowData[col.field] }}</span>
|
|
1711
|
+
</div>
|
|
1712
|
+
} @else {
|
|
1713
|
+
{{ rowData[col.field] }}
|
|
1714
|
+
}
|
|
1715
|
+
</td>
|
|
1716
|
+
}
|
|
1717
|
+
</tr>
|
|
1718
|
+
</ng-template>
|
|
1719
|
+
</p-tree-table>
|
|
1720
|
+
</div>
|
|
1622
1721
|
`,
|
|
1623
1722
|
standalone: true,
|
|
1624
|
-
imports: [TreeTableModule],
|
|
1723
|
+
imports: [CommonModule, TreeTableModule],
|
|
1625
1724
|
providers: [NodeService]
|
|
1626
1725
|
})
|
|
1627
1726
|
export class TreetableReorderDemo implements OnInit {
|
|
1628
1727
|
private nodeService = inject(NodeService);
|
|
1728
|
+
|
|
1629
1729
|
files!: TreeNode[];
|
|
1730
|
+
|
|
1630
1731
|
cols!: Column[];
|
|
1631
1732
|
|
|
1632
1733
|
ngOnInit() {
|
|
@@ -1645,10 +1746,11 @@ export class TreetableReorderDemo implements OnInit {
|
|
|
1645
1746
|
A column can be fixed during horizontal scrolling by enabling the frozenColumns property.
|
|
1646
1747
|
|
|
1647
1748
|
```typescript
|
|
1648
|
-
import {
|
|
1749
|
+
import { CommonModule } from '@angular/common';
|
|
1750
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1751
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1649
1752
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1650
1753
|
import { NodeService } from '@/service/nodeservice';
|
|
1651
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1652
1754
|
|
|
1653
1755
|
interface Column {
|
|
1654
1756
|
field: string;
|
|
@@ -1657,53 +1759,59 @@ interface Column {
|
|
|
1657
1759
|
|
|
1658
1760
|
@Component({
|
|
1659
1761
|
template: `
|
|
1660
|
-
<
|
|
1661
|
-
<
|
|
1662
|
-
<colgroup>
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
<
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
<
|
|
1679
|
-
|
|
1762
|
+
<div class="card">
|
|
1763
|
+
<p-tree-table [value]="files" [columns]="scrollableCols" [frozenColumns]="frozenCols" [scrollable]="true" scrollHeight="250px" frozenWidth="200px" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1764
|
+
<ng-template #colgroup let-columns>
|
|
1765
|
+
<colgroup>
|
|
1766
|
+
@for (col of columns; track col) {
|
|
1767
|
+
<col style="width:250px" />
|
|
1768
|
+
}
|
|
1769
|
+
</colgroup>
|
|
1770
|
+
</ng-template>
|
|
1771
|
+
<ng-template #header let-columns>
|
|
1772
|
+
<tr>
|
|
1773
|
+
@for (col of columns; track col) {
|
|
1774
|
+
<th>
|
|
1775
|
+
{{ col.header }}
|
|
1776
|
+
</th>
|
|
1777
|
+
}
|
|
1778
|
+
</tr>
|
|
1779
|
+
</ng-template>
|
|
1780
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
1781
|
+
<tr [ttRow]="rowNode" style="height: 57px">
|
|
1782
|
+
@for (col of columns; track col) {
|
|
1783
|
+
<td>
|
|
1784
|
+
{{ rowData[col.field] }}
|
|
1785
|
+
</td>
|
|
1786
|
+
}
|
|
1787
|
+
</tr>
|
|
1788
|
+
</ng-template>
|
|
1789
|
+
<ng-template #frozenbody let-rowNode let-rowData="rowData">
|
|
1790
|
+
<tr [ttRow]="rowNode" style="height: 57px">
|
|
1680
1791
|
<td>
|
|
1681
|
-
|
|
1792
|
+
<div class="flex items-center gap-2">
|
|
1793
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
1794
|
+
<span class="font-bold">{{ rowData.name }}</span>
|
|
1795
|
+
</div>
|
|
1682
1796
|
</td>
|
|
1683
|
-
|
|
1684
|
-
</
|
|
1685
|
-
</
|
|
1686
|
-
|
|
1687
|
-
<tr [ttRow]="rowNode" style="height: 57px">
|
|
1688
|
-
<td>
|
|
1689
|
-
<div class="flex items-center gap-2">
|
|
1690
|
-
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
1691
|
-
<span class="font-bold">{{ rowData.name }}</span>
|
|
1692
|
-
</div>
|
|
1693
|
-
</td>
|
|
1694
|
-
</tr>
|
|
1695
|
-
</ng-template>
|
|
1696
|
-
</p-tree-table>
|
|
1797
|
+
</tr>
|
|
1798
|
+
</ng-template>
|
|
1799
|
+
</p-tree-table>
|
|
1800
|
+
</div>
|
|
1697
1801
|
`,
|
|
1698
1802
|
standalone: true,
|
|
1699
|
-
imports: [TreeTableModule],
|
|
1803
|
+
imports: [CommonModule, TreeTableModule],
|
|
1700
1804
|
providers: [NodeService]
|
|
1701
1805
|
})
|
|
1702
1806
|
export class TreetableScrollfrozencolumnsDemo implements OnInit {
|
|
1703
1807
|
private nodeService = inject(NodeService);
|
|
1808
|
+
|
|
1704
1809
|
files!: TreeNode[];
|
|
1810
|
+
|
|
1705
1811
|
cols!: Column[];
|
|
1812
|
+
|
|
1706
1813
|
frozenCols!: Column[];
|
|
1814
|
+
|
|
1707
1815
|
scrollableCols!: Column[];
|
|
1708
1816
|
|
|
1709
1817
|
ngOnInit() {
|
|
@@ -1713,6 +1821,7 @@ export class TreetableScrollfrozencolumnsDemo implements OnInit {
|
|
|
1713
1821
|
{ field: 'size', header: 'Size' },
|
|
1714
1822
|
{ field: 'type', header: 'Type' }
|
|
1715
1823
|
];
|
|
1824
|
+
|
|
1716
1825
|
this.scrollableCols = [
|
|
1717
1826
|
{ field: 'size', header: 'Size' },
|
|
1718
1827
|
{ field: 'type', header: 'Type' },
|
|
@@ -1721,6 +1830,7 @@ export class TreetableScrollfrozencolumnsDemo implements OnInit {
|
|
|
1721
1830
|
{ field: 'size', header: 'Size' },
|
|
1722
1831
|
{ field: 'type', header: 'Type' }
|
|
1723
1832
|
];
|
|
1833
|
+
|
|
1724
1834
|
this.frozenCols = [{ field: 'name', header: 'Name' }];
|
|
1725
1835
|
}
|
|
1726
1836
|
}
|
|
@@ -1731,10 +1841,11 @@ export class TreetableScrollfrozencolumnsDemo implements OnInit {
|
|
|
1731
1841
|
Horizontal scrolling is enabled when the total width of columns exceeds table width.
|
|
1732
1842
|
|
|
1733
1843
|
```typescript
|
|
1734
|
-
import {
|
|
1844
|
+
import { CommonModule } from '@angular/common';
|
|
1845
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1846
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1735
1847
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1736
1848
|
import { NodeService } from '@/service/nodeservice';
|
|
1737
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1738
1849
|
|
|
1739
1850
|
interface Column {
|
|
1740
1851
|
field: string;
|
|
@@ -1743,48 +1854,52 @@ interface Column {
|
|
|
1743
1854
|
|
|
1744
1855
|
@Component({
|
|
1745
1856
|
template: `
|
|
1746
|
-
<
|
|
1747
|
-
<
|
|
1748
|
-
<colgroup>
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
<
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
<
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
<
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1857
|
+
<div class="card">
|
|
1858
|
+
<p-tree-table [value]="files" [columns]="cols" [scrollable]="true" scrollHeight="250px" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1859
|
+
<ng-template #colgroup let-columns>
|
|
1860
|
+
<colgroup>
|
|
1861
|
+
@for (col of columns; track col) {
|
|
1862
|
+
<col style="width:500px" />
|
|
1863
|
+
}
|
|
1864
|
+
</colgroup>
|
|
1865
|
+
</ng-template>
|
|
1866
|
+
<ng-template #header let-columns>
|
|
1867
|
+
<tr>
|
|
1868
|
+
@for (col of columns; track col) {
|
|
1869
|
+
<th>
|
|
1870
|
+
{{ col.header }}
|
|
1871
|
+
</th>
|
|
1872
|
+
}
|
|
1873
|
+
</tr>
|
|
1874
|
+
</ng-template>
|
|
1875
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
1876
|
+
<tr [ttRow]="rowNode">
|
|
1877
|
+
@for (col of columns; let first = $first; track col) {
|
|
1878
|
+
<td>
|
|
1879
|
+
@if (first) {
|
|
1880
|
+
<div class="flex items-center gap-2">
|
|
1881
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
1882
|
+
<span>{{ rowData[col.field] }}</span>
|
|
1883
|
+
</div>
|
|
1884
|
+
} @else {
|
|
1885
|
+
{{ rowData[col.field] }}
|
|
1886
|
+
}
|
|
1887
|
+
</td>
|
|
1888
|
+
}
|
|
1889
|
+
</tr>
|
|
1890
|
+
</ng-template>
|
|
1891
|
+
</p-tree-table>
|
|
1892
|
+
</div>
|
|
1780
1893
|
`,
|
|
1781
1894
|
standalone: true,
|
|
1782
|
-
imports: [TreeTableModule],
|
|
1895
|
+
imports: [CommonModule, TreeTableModule],
|
|
1783
1896
|
providers: [NodeService]
|
|
1784
1897
|
})
|
|
1785
1898
|
export class TreetableScrollhorizontalDemo implements OnInit {
|
|
1786
1899
|
private nodeService = inject(NodeService);
|
|
1900
|
+
|
|
1787
1901
|
files!: TreeNode[];
|
|
1902
|
+
|
|
1788
1903
|
cols!: Column[];
|
|
1789
1904
|
|
|
1790
1905
|
ngOnInit() {
|
|
@@ -1803,10 +1918,11 @@ export class TreetableScrollhorizontalDemo implements OnInit {
|
|
|
1803
1918
|
Adding scrollable property along with a scrollHeight for the data viewport enables vertical scrolling with fixed headers.
|
|
1804
1919
|
|
|
1805
1920
|
```typescript
|
|
1806
|
-
import {
|
|
1921
|
+
import { CommonModule } from '@angular/common';
|
|
1922
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1923
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1807
1924
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1808
1925
|
import { NodeService } from '@/service/nodeservice';
|
|
1809
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1810
1926
|
|
|
1811
1927
|
interface Column {
|
|
1812
1928
|
field: string;
|
|
@@ -1815,41 +1931,45 @@ interface Column {
|
|
|
1815
1931
|
|
|
1816
1932
|
@Component({
|
|
1817
1933
|
template: `
|
|
1818
|
-
<
|
|
1819
|
-
<
|
|
1820
|
-
<
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
<
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
<
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1934
|
+
<div class="card">
|
|
1935
|
+
<p-tree-table [value]="files" [columns]="cols" [scrollable]="true" scrollHeight="200px" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1936
|
+
<ng-template #header let-columns>
|
|
1937
|
+
<tr>
|
|
1938
|
+
@for (col of columns; track col) {
|
|
1939
|
+
<th>
|
|
1940
|
+
{{ col.header }}
|
|
1941
|
+
</th>
|
|
1942
|
+
}
|
|
1943
|
+
</tr>
|
|
1944
|
+
</ng-template>
|
|
1945
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
1946
|
+
<tr [ttRow]="rowNode">
|
|
1947
|
+
@for (col of columns; let first = $first; track col) {
|
|
1948
|
+
<td>
|
|
1949
|
+
@if (first) {
|
|
1950
|
+
<div class="flex items-center gap-2">
|
|
1951
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
1952
|
+
<span>{{ rowData[col.field] }}</span>
|
|
1953
|
+
</div>
|
|
1954
|
+
} @else {
|
|
1955
|
+
{{ rowData[col.field] }}
|
|
1956
|
+
}
|
|
1957
|
+
</td>
|
|
1958
|
+
}
|
|
1959
|
+
</tr>
|
|
1960
|
+
</ng-template>
|
|
1961
|
+
</p-tree-table>
|
|
1962
|
+
</div>
|
|
1845
1963
|
`,
|
|
1846
1964
|
standalone: true,
|
|
1847
|
-
imports: [TreeTableModule],
|
|
1965
|
+
imports: [CommonModule, TreeTableModule],
|
|
1848
1966
|
providers: [NodeService]
|
|
1849
1967
|
})
|
|
1850
1968
|
export class TreetableScrollverticalDemo implements OnInit {
|
|
1851
1969
|
private nodeService = inject(NodeService);
|
|
1970
|
+
|
|
1852
1971
|
files!: TreeNode[];
|
|
1972
|
+
|
|
1853
1973
|
cols!: Column[];
|
|
1854
1974
|
|
|
1855
1975
|
ngOnInit() {
|
|
@@ -1865,13 +1985,14 @@ export class TreetableScrollverticalDemo implements OnInit {
|
|
|
1865
1985
|
|
|
1866
1986
|
## selectioncheckbox-doc
|
|
1867
1987
|
|
|
1868
|
-
Selection of multiple nodes via checkboxes is enabled by configuring selectionMode as checkbox . In checkbox selection mode,
|
|
1988
|
+
Selection of multiple nodes via checkboxes is enabled by configuring selectionMode as checkbox . In checkbox selection mode, selectionKeys binding should be a key-value pair where key (or the dataKey) is the node key and value is an object that has checked and partialChecked properties to represent the checked state of a node.
|
|
1869
1989
|
|
|
1870
1990
|
```typescript
|
|
1871
|
-
import {
|
|
1991
|
+
import { CommonModule } from '@angular/common';
|
|
1992
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1993
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1872
1994
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1873
1995
|
import { NodeService } from '@/service/nodeservice';
|
|
1874
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
1875
1996
|
|
|
1876
1997
|
interface Column {
|
|
1877
1998
|
field: string;
|
|
@@ -1880,54 +2001,61 @@ interface Column {
|
|
|
1880
2001
|
|
|
1881
2002
|
@Component({
|
|
1882
2003
|
template: `
|
|
1883
|
-
<
|
|
1884
|
-
<
|
|
1885
|
-
<
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
<
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
<
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2004
|
+
<div class="card mt-4">
|
|
2005
|
+
<p-tree-table [value]="files" [columns]="cols" selectionMode="checkbox" [(selectionKeys)]="selectionKeys" dataKey="key" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2006
|
+
<ng-template #header let-columns>
|
|
2007
|
+
<tr>
|
|
2008
|
+
@for (col of columns; track col) {
|
|
2009
|
+
<th>
|
|
2010
|
+
{{ col.header }}
|
|
2011
|
+
</th>
|
|
2012
|
+
}
|
|
2013
|
+
</tr>
|
|
2014
|
+
</ng-template>
|
|
2015
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2016
|
+
<tr [ttRow]="rowNode" [ttSelectableRow]="rowNode">
|
|
2017
|
+
@for (col of columns; let first = $first; track col) {
|
|
2018
|
+
<td>
|
|
2019
|
+
@if (first) {
|
|
2020
|
+
<div class="flex items-center gap-2">
|
|
2021
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
2022
|
+
<p-tree-table-checkbox [value]="rowNode" />
|
|
2023
|
+
<span>{{ rowData[col.field] }}</span>
|
|
2024
|
+
</div>
|
|
2025
|
+
} @else {
|
|
2026
|
+
{{ rowData[col.field] }}
|
|
2027
|
+
}
|
|
2028
|
+
</td>
|
|
2029
|
+
}
|
|
2030
|
+
</tr>
|
|
2031
|
+
</ng-template>
|
|
2032
|
+
</p-tree-table>
|
|
2033
|
+
</div>
|
|
1911
2034
|
`,
|
|
1912
2035
|
standalone: true,
|
|
1913
|
-
imports: [TreeTableModule],
|
|
2036
|
+
imports: [CommonModule, TreeTableModule],
|
|
1914
2037
|
providers: [NodeService]
|
|
1915
2038
|
})
|
|
1916
2039
|
export class TreetableSelectioncheckboxDemo implements OnInit {
|
|
1917
2040
|
private nodeService = inject(NodeService);
|
|
2041
|
+
|
|
1918
2042
|
files!: TreeNode[];
|
|
1919
|
-
|
|
2043
|
+
|
|
2044
|
+
selectionKeys = {};
|
|
2045
|
+
|
|
1920
2046
|
cols!: Column[];
|
|
1921
2047
|
|
|
1922
2048
|
ngOnInit() {
|
|
1923
2049
|
this.nodeService.getTreeTableNodes().then((files) => {
|
|
1924
2050
|
this.files = files;
|
|
1925
2051
|
});
|
|
2052
|
+
|
|
1926
2053
|
this.cols = [
|
|
1927
2054
|
{ field: 'name', header: 'Name' },
|
|
1928
2055
|
{ field: 'size', header: 'Size' },
|
|
1929
2056
|
{ field: 'type', header: 'Type' }
|
|
1930
2057
|
];
|
|
2058
|
+
|
|
1931
2059
|
this.selectionKeys = {
|
|
1932
2060
|
'0': {
|
|
1933
2061
|
partialChecked: true
|
|
@@ -1955,10 +2083,12 @@ export class TreetableSelectioncheckboxDemo implements OnInit {
|
|
|
1955
2083
|
TreeTable provides onNodeSelect and onNodeUnselect events to listen selection events.
|
|
1956
2084
|
|
|
1957
2085
|
```typescript
|
|
1958
|
-
import {
|
|
2086
|
+
import { CommonModule } from '@angular/common';
|
|
2087
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2088
|
+
import { MessageService, TreeNode } from '@exhaustive-ui/core/api';
|
|
2089
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
1959
2090
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
1960
2091
|
import { NodeService } from '@/service/nodeservice';
|
|
1961
|
-
import { TreeNode, MessageService } from '@exhaustive-ui/core/api';
|
|
1962
2092
|
|
|
1963
2093
|
interface Column {
|
|
1964
2094
|
field: string;
|
|
@@ -1972,57 +2102,64 @@ interface NodeEvent {
|
|
|
1972
2102
|
|
|
1973
2103
|
@Component({
|
|
1974
2104
|
template: `
|
|
1975
|
-
<
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
<
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2105
|
+
<div class="card">
|
|
2106
|
+
<p-toast />
|
|
2107
|
+
<p-tree-table
|
|
2108
|
+
[value]="files"
|
|
2109
|
+
[columns]="cols"
|
|
2110
|
+
selectionMode="single"
|
|
2111
|
+
[(selection)]="selectedNode"
|
|
2112
|
+
dataKey="name"
|
|
2113
|
+
(onNodeSelect)="nodeSelect($event)"
|
|
2114
|
+
(onNodeUnselect)="nodeUnselect($event)"
|
|
2115
|
+
[scrollable]="true"
|
|
2116
|
+
[tableStyle]="{ 'min-width': '50rem' }"
|
|
2117
|
+
>
|
|
2118
|
+
<ng-template #header let-columns>
|
|
2119
|
+
<tr>
|
|
2120
|
+
@for (col of columns; track col) {
|
|
2121
|
+
<th>
|
|
2122
|
+
{{ col.header }}
|
|
2123
|
+
</th>
|
|
2124
|
+
}
|
|
2125
|
+
</tr>
|
|
2126
|
+
</ng-template>
|
|
2127
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2128
|
+
<tr [ttRow]="rowNode" [ttSelectableRow]="rowNode">
|
|
2129
|
+
@for (col of columns; let first = $first; track col) {
|
|
2130
|
+
<td>
|
|
2131
|
+
@if (first) {
|
|
2132
|
+
<div class="flex items-center gap-2">
|
|
2133
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
2134
|
+
<span>{{ rowData[col.field] }}</span>
|
|
2135
|
+
</div>
|
|
2136
|
+
} @else {
|
|
2137
|
+
{{ rowData[col.field] }}
|
|
2138
|
+
}
|
|
2139
|
+
</td>
|
|
2140
|
+
}
|
|
2141
|
+
</tr>
|
|
2142
|
+
</ng-template>
|
|
2143
|
+
</p-tree-table>
|
|
2144
|
+
</div>
|
|
2012
2145
|
`,
|
|
2013
2146
|
standalone: true,
|
|
2014
|
-
imports: [TreeTableModule],
|
|
2015
|
-
providers: [
|
|
2147
|
+
imports: [CommonModule, TreeTableModule, ToastModule],
|
|
2148
|
+
providers: [MessageService, NodeService]
|
|
2016
2149
|
})
|
|
2017
2150
|
export class TreetableSelectioneventscDemo implements OnInit {
|
|
2018
2151
|
private nodeService = inject(NodeService);
|
|
2019
2152
|
private messageService = inject(MessageService);
|
|
2153
|
+
|
|
2020
2154
|
files!: TreeNode[];
|
|
2155
|
+
|
|
2021
2156
|
selectedNode!: TreeNode;
|
|
2157
|
+
|
|
2022
2158
|
cols!: Column[];
|
|
2023
2159
|
|
|
2024
2160
|
ngOnInit() {
|
|
2025
2161
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
2162
|
+
|
|
2026
2163
|
this.cols = [
|
|
2027
2164
|
{ field: 'name', header: 'Name' },
|
|
2028
2165
|
{ field: 'size', header: 'Size' },
|
|
@@ -2045,11 +2182,13 @@ export class TreetableSelectioneventscDemo implements OnInit {
|
|
|
2045
2182
|
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, TreeTable always ignores metaKey.
|
|
2046
2183
|
|
|
2047
2184
|
```typescript
|
|
2048
|
-
import {
|
|
2049
|
-
import {
|
|
2050
|
-
import {
|
|
2185
|
+
import { CommonModule } from '@angular/common';
|
|
2186
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2187
|
+
import { FormsModule } from '@angular/forms';
|
|
2051
2188
|
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2052
|
-
import {
|
|
2189
|
+
import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';
|
|
2190
|
+
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
2191
|
+
import { NodeService } from '@/service/nodeservice';
|
|
2053
2192
|
|
|
2054
2193
|
interface Column {
|
|
2055
2194
|
field: string;
|
|
@@ -2058,47 +2197,58 @@ interface Column {
|
|
|
2058
2197
|
|
|
2059
2198
|
@Component({
|
|
2060
2199
|
template: `
|
|
2061
|
-
<
|
|
2062
|
-
<
|
|
2063
|
-
<
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2200
|
+
<div class="card">
|
|
2201
|
+
<div class="flex gap-4 items-center justify-center mb-6">
|
|
2202
|
+
<p-toggle-switch [(ngModel)]="metaKeySelection" inputId="metakey-multiple" />
|
|
2203
|
+
<label for="metakey-multiple">Metakey</label>
|
|
2204
|
+
</div>
|
|
2205
|
+
<p-tree-table [value]="files" [columns]="cols" selectionMode="multiple" [(selection)]="selectedNodes" dataKey="name" [metaKeySelection]="metaKeySelection" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2206
|
+
<ng-template #header let-columns>
|
|
2207
|
+
<tr>
|
|
2208
|
+
@for (col of columns; track col) {
|
|
2209
|
+
<th>
|
|
2210
|
+
{{ col.header }}
|
|
2211
|
+
</th>
|
|
2212
|
+
}
|
|
2213
|
+
</tr>
|
|
2214
|
+
</ng-template>
|
|
2215
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2216
|
+
<tr [ttRow]="rowNode" [ttSelectableRow]="rowNode">
|
|
2217
|
+
@for (col of columns; let first = $first; track col) {
|
|
2218
|
+
<td>
|
|
2219
|
+
@if (first) {
|
|
2220
|
+
<div class="flex items-center gap-2">
|
|
2221
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
2222
|
+
<span>{{ rowData[col.field] }}</span>
|
|
2223
|
+
</div>
|
|
2224
|
+
} @else {
|
|
2225
|
+
{{ rowData[col.field] }}
|
|
2226
|
+
}
|
|
2227
|
+
</td>
|
|
2228
|
+
}
|
|
2229
|
+
</tr>
|
|
2230
|
+
</ng-template>
|
|
2231
|
+
</p-tree-table>
|
|
2232
|
+
</div>
|
|
2088
2233
|
`,
|
|
2089
2234
|
standalone: true,
|
|
2090
|
-
imports: [TreeTableModule],
|
|
2235
|
+
imports: [CommonModule, FormsModule, TreeTableModule, ToggleSwitchModule],
|
|
2091
2236
|
providers: [NodeService]
|
|
2092
2237
|
})
|
|
2093
2238
|
export class TreetableSelectionmultipleDemo implements OnInit {
|
|
2094
2239
|
private nodeService = inject(NodeService);
|
|
2240
|
+
|
|
2095
2241
|
metaKeySelection: boolean = true;
|
|
2242
|
+
|
|
2096
2243
|
files!: TreeNode[];
|
|
2244
|
+
|
|
2097
2245
|
selectedNodes!: TreeNode[];
|
|
2246
|
+
|
|
2098
2247
|
cols!: Column[];
|
|
2099
2248
|
|
|
2100
2249
|
ngOnInit() {
|
|
2101
2250
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
2251
|
+
|
|
2102
2252
|
this.cols = [
|
|
2103
2253
|
{ field: 'name', header: 'Name' },
|
|
2104
2254
|
{ field: 'size', header: 'Size' },
|
|
@@ -2113,10 +2263,13 @@ export class TreetableSelectionmultipleDemo implements OnInit {
|
|
|
2113
2263
|
Single node selection is configured by setting selectionMode as single along with selection properties to manage the selection value binding. By default, metaKey press (e.g. ⌘ ) is necessary to unselect a node however this can be configured with disabling the metaKeySelection property. In touch enabled devices this option has no effect and behavior is same as setting it to false
|
|
2114
2264
|
|
|
2115
2265
|
```typescript
|
|
2116
|
-
import {
|
|
2266
|
+
import { CommonModule } from '@angular/common';
|
|
2267
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2268
|
+
import { FormsModule } from '@angular/forms';
|
|
2269
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2270
|
+
import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';
|
|
2117
2271
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
2118
2272
|
import { NodeService } from '@/service/nodeservice';
|
|
2119
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2120
2273
|
|
|
2121
2274
|
interface Column {
|
|
2122
2275
|
field: string;
|
|
@@ -2125,47 +2278,58 @@ interface Column {
|
|
|
2125
2278
|
|
|
2126
2279
|
@Component({
|
|
2127
2280
|
template: `
|
|
2128
|
-
<
|
|
2129
|
-
<
|
|
2130
|
-
<
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2281
|
+
<div class="card">
|
|
2282
|
+
<div class="flex gap-4 items-center justify-center mb-6">
|
|
2283
|
+
<p-toggle-switch [(ngModel)]="metaKeySelection" inputId="metakey-single" />
|
|
2284
|
+
<label for="metakey-single">Metakey</label>
|
|
2285
|
+
</div>
|
|
2286
|
+
<p-tree-table [value]="files" [columns]="cols" selectionMode="single" [metaKeySelection]="metaKeySelection" [(selection)]="selectedNode" dataKey="name" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2287
|
+
<ng-template #header let-columns>
|
|
2288
|
+
<tr>
|
|
2289
|
+
@for (col of columns; track col) {
|
|
2290
|
+
<th>
|
|
2291
|
+
{{ col.header }}
|
|
2292
|
+
</th>
|
|
2293
|
+
}
|
|
2294
|
+
</tr>
|
|
2295
|
+
</ng-template>
|
|
2296
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2297
|
+
<tr [ttRow]="rowNode" [ttSelectableRow]="rowNode">
|
|
2298
|
+
@for (col of columns; let first = $first; track col) {
|
|
2299
|
+
<td>
|
|
2300
|
+
@if (first) {
|
|
2301
|
+
<div class="flex items-center gap-2">
|
|
2302
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
2303
|
+
<span>{{ rowData[col.field] }}</span>
|
|
2304
|
+
</div>
|
|
2305
|
+
} @else {
|
|
2306
|
+
{{ rowData[col.field] }}
|
|
2307
|
+
}
|
|
2308
|
+
</td>
|
|
2309
|
+
}
|
|
2310
|
+
</tr>
|
|
2311
|
+
</ng-template>
|
|
2312
|
+
</p-tree-table>
|
|
2313
|
+
</div>
|
|
2155
2314
|
`,
|
|
2156
2315
|
standalone: true,
|
|
2157
|
-
imports: [TreeTableModule],
|
|
2316
|
+
imports: [CommonModule, FormsModule, TreeTableModule, ToggleSwitchModule],
|
|
2158
2317
|
providers: [NodeService]
|
|
2159
2318
|
})
|
|
2160
2319
|
export class TreetableSelectionsingleDemo implements OnInit {
|
|
2161
2320
|
private nodeService = inject(NodeService);
|
|
2321
|
+
|
|
2162
2322
|
metaKeySelection: boolean = true;
|
|
2323
|
+
|
|
2163
2324
|
files!: TreeNode[];
|
|
2325
|
+
|
|
2164
2326
|
selectedNode!: TreeNode;
|
|
2327
|
+
|
|
2165
2328
|
cols!: Column[];
|
|
2166
2329
|
|
|
2167
2330
|
ngOnInit() {
|
|
2168
2331
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
2332
|
+
|
|
2169
2333
|
this.cols = [
|
|
2170
2334
|
{ field: 'name', header: 'Name' },
|
|
2171
2335
|
{ field: 'size', header: 'Size' },
|
|
@@ -2180,47 +2344,61 @@ export class TreetableSelectionsingleDemo implements OnInit {
|
|
|
2180
2344
|
In addition to a regular treetable, alternatives with alternative sizes are available. Add p-treetable-sm class to reduce the size of treetable or p-treetable-lg to enlarge it.
|
|
2181
2345
|
|
|
2182
2346
|
```typescript
|
|
2183
|
-
import {
|
|
2347
|
+
import { CommonModule } from '@angular/common';
|
|
2348
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2349
|
+
import { FormsModule } from '@angular/forms';
|
|
2350
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2351
|
+
import { SelectButtonModule } from '@exhaustive-ui/core/selectbutton';
|
|
2184
2352
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
2185
2353
|
import { NodeService } from '@/service/nodeservice';
|
|
2186
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2187
2354
|
|
|
2188
2355
|
@Component({
|
|
2189
2356
|
template: `
|
|
2190
|
-
<
|
|
2191
|
-
<
|
|
2192
|
-
<
|
|
2193
|
-
<
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2357
|
+
<section class="py-6">
|
|
2358
|
+
<div class="card">
|
|
2359
|
+
<div class="flex justify-center mb-4">
|
|
2360
|
+
<p-select-button [options]="sizes" [(ngModel)]="selectedSize" [multiple]="false" optionLabel="name" optionValue="class" />
|
|
2361
|
+
</div>
|
|
2362
|
+
<p-tree-table [value]="files" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }" [class]="selectedSize">
|
|
2363
|
+
<ng-template #header>
|
|
2364
|
+
<tr>
|
|
2365
|
+
<th>Name</th>
|
|
2366
|
+
<th>Size</th>
|
|
2367
|
+
<th>Type</th>
|
|
2368
|
+
</tr>
|
|
2369
|
+
</ng-template>
|
|
2370
|
+
<ng-template #body let-rowNode let-rowData="rowData">
|
|
2371
|
+
<tr [ttRow]="rowNode">
|
|
2372
|
+
<td>
|
|
2373
|
+
<div class="flex items-center gap-2">
|
|
2374
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
2375
|
+
<span>{{ rowData.name }}</span>
|
|
2376
|
+
</div>
|
|
2377
|
+
</td>
|
|
2378
|
+
<td>{{ rowData.size }}</td>
|
|
2379
|
+
<td>{{ rowData.type }}</td>
|
|
2380
|
+
</tr>
|
|
2381
|
+
</ng-template>
|
|
2382
|
+
</p-tree-table>
|
|
2383
|
+
</div>
|
|
2384
|
+
</section>
|
|
2211
2385
|
`,
|
|
2212
2386
|
standalone: true,
|
|
2213
|
-
imports: [TreeTableModule],
|
|
2387
|
+
imports: [CommonModule, FormsModule, TreeTableModule, SelectButtonModule],
|
|
2214
2388
|
providers: [NodeService]
|
|
2215
2389
|
})
|
|
2216
2390
|
export class TreetableSizeDemo implements OnInit {
|
|
2217
2391
|
private nodeService = inject(NodeService);
|
|
2392
|
+
|
|
2218
2393
|
files!: TreeNode[];
|
|
2394
|
+
|
|
2219
2395
|
sizes!: any[];
|
|
2396
|
+
|
|
2220
2397
|
selectedSize: any = '';
|
|
2221
2398
|
|
|
2222
2399
|
ngOnInit() {
|
|
2223
2400
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
2401
|
+
|
|
2224
2402
|
this.sizes = [
|
|
2225
2403
|
{ name: 'Small', class: 'p-treetable-sm' },
|
|
2226
2404
|
{ name: 'Normal', class: '' },
|
|
@@ -2235,10 +2413,11 @@ export class TreetableSizeDemo implements OnInit {
|
|
|
2235
2413
|
Multiple columns can be sorted by defining sortMode as multiple . This mode requires metaKey (e.g. ⌘ ) to be pressed when clicking a header.
|
|
2236
2414
|
|
|
2237
2415
|
```typescript
|
|
2238
|
-
import {
|
|
2416
|
+
import { CommonModule } from '@angular/common';
|
|
2417
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2418
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2239
2419
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
2240
2420
|
import { NodeService } from '@/service/nodeservice';
|
|
2241
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2242
2421
|
|
|
2243
2422
|
interface Column {
|
|
2244
2423
|
field: string;
|
|
@@ -2247,48 +2426,53 @@ interface Column {
|
|
|
2247
2426
|
|
|
2248
2427
|
@Component({
|
|
2249
2428
|
template: `
|
|
2250
|
-
<
|
|
2251
|
-
<
|
|
2252
|
-
<
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
<
|
|
2256
|
-
{{ col.header }}
|
|
2257
|
-
<p-tree-table-sort-icon [field]="col.field" />
|
|
2258
|
-
</div>
|
|
2259
|
-
</th>
|
|
2260
|
-
}
|
|
2261
|
-
</tr>
|
|
2262
|
-
</ng-template>
|
|
2263
|
-
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2264
|
-
<tr [ttRow]="rowNode">
|
|
2265
|
-
@for (col of columns; let first = $first; track col) {
|
|
2266
|
-
<td>
|
|
2267
|
-
@if (first) {
|
|
2429
|
+
<div class="card">
|
|
2430
|
+
<p-tree-table [value]="files" [columns]="cols" sortMode="multiple" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2431
|
+
<ng-template #header let-columns>
|
|
2432
|
+
<tr>
|
|
2433
|
+
@for (col of columns; track col) {
|
|
2434
|
+
<th [ttSortableColumn]="col.field">
|
|
2268
2435
|
<div class="flex items-center gap-2">
|
|
2269
|
-
|
|
2270
|
-
<
|
|
2436
|
+
{{ col.header }}
|
|
2437
|
+
<p-tree-table-sort-icon [field]="col.field" />
|
|
2271
2438
|
</div>
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2439
|
+
</th>
|
|
2440
|
+
}
|
|
2441
|
+
</tr>
|
|
2442
|
+
</ng-template>
|
|
2443
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2444
|
+
<tr [ttRow]="rowNode">
|
|
2445
|
+
@for (col of columns; let first = $first; track col) {
|
|
2446
|
+
<td>
|
|
2447
|
+
@if (first) {
|
|
2448
|
+
<div class="flex items-center gap-2">
|
|
2449
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
2450
|
+
<span>{{ rowData[col.field] }}</span>
|
|
2451
|
+
</div>
|
|
2452
|
+
} @else {
|
|
2453
|
+
{{ rowData[col.field] }}
|
|
2454
|
+
}
|
|
2455
|
+
</td>
|
|
2456
|
+
}
|
|
2457
|
+
</tr>
|
|
2458
|
+
</ng-template>
|
|
2459
|
+
</p-tree-table>
|
|
2460
|
+
</div>
|
|
2280
2461
|
`,
|
|
2281
2462
|
standalone: true,
|
|
2282
|
-
imports: [TreeTableModule],
|
|
2463
|
+
imports: [CommonModule, TreeTableModule],
|
|
2283
2464
|
providers: [NodeService]
|
|
2284
2465
|
})
|
|
2285
2466
|
export class TreetableSortmultiplecolumnsDemo implements OnInit {
|
|
2286
2467
|
private nodeService = inject(NodeService);
|
|
2468
|
+
|
|
2287
2469
|
files!: TreeNode[];
|
|
2470
|
+
|
|
2288
2471
|
cols!: Column[];
|
|
2289
2472
|
|
|
2290
2473
|
ngOnInit() {
|
|
2291
2474
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
2475
|
+
|
|
2292
2476
|
this.cols = [
|
|
2293
2477
|
{ field: 'name', header: 'Name' },
|
|
2294
2478
|
{ field: 'size', header: 'Size' },
|
|
@@ -2303,11 +2487,11 @@ export class TreetableSortmultiplecolumnsDemo implements OnInit {
|
|
|
2303
2487
|
The removable sort can be implemented using the customSort property.
|
|
2304
2488
|
|
|
2305
2489
|
```typescript
|
|
2306
|
-
import { Component,
|
|
2490
|
+
import { Component, ViewChild, inject, OnInit } from '@angular/core';
|
|
2491
|
+
import { CommonModule } from '@angular/common';
|
|
2492
|
+
import { SortEvent, TreeNode } from '@exhaustive-ui/core/api';
|
|
2307
2493
|
import { TreeTable, TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
2308
2494
|
import { NodeService } from '@/service/nodeservice';
|
|
2309
|
-
import { TreeNode, SortEvent } from '@exhaustive-ui/core/api';
|
|
2310
|
-
import { TreeTable } from '@exhaustive-ui/core/treetable';
|
|
2311
2495
|
|
|
2312
2496
|
interface Column {
|
|
2313
2497
|
field: string;
|
|
@@ -2316,48 +2500,58 @@ interface Column {
|
|
|
2316
2500
|
|
|
2317
2501
|
@Component({
|
|
2318
2502
|
template: `
|
|
2319
|
-
<
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
<
|
|
2334
|
-
<
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
<
|
|
2342
|
-
<
|
|
2343
|
-
<
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2503
|
+
<div class="card">
|
|
2504
|
+
<p-tree-table
|
|
2505
|
+
#tt
|
|
2506
|
+
[value]="files"
|
|
2507
|
+
(sortFunction)="customSort($event)"
|
|
2508
|
+
[customSort]="true"
|
|
2509
|
+
[columns]="cols"
|
|
2510
|
+
selectionMode="single"
|
|
2511
|
+
[metaKeySelection]="metaKeySelection"
|
|
2512
|
+
[(selection)]="selectedNode"
|
|
2513
|
+
dataKey="name"
|
|
2514
|
+
[scrollable]="true"
|
|
2515
|
+
[tableStyle]="{ 'min-width': '50rem' }"
|
|
2516
|
+
>
|
|
2517
|
+
<ng-template #header let-columns>
|
|
2518
|
+
<tr>
|
|
2519
|
+
<th *ngFor="let col of columns" [ttSortableColumn]="col.field">
|
|
2520
|
+
{{ col.header }}
|
|
2521
|
+
<p-tree-table-sort-icon [field]="col.field" />
|
|
2522
|
+
</th>
|
|
2523
|
+
</tr>
|
|
2524
|
+
</ng-template>
|
|
2525
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2526
|
+
<tr [ttRow]="rowNode" [ttSelectableRow]="rowNode">
|
|
2527
|
+
<td *ngFor="let col of columns; let i = index">
|
|
2528
|
+
<p-tree-table-toggler [rowNode]="rowNode" *ngIf="i === 0" />
|
|
2529
|
+
{{ rowData[col.field] }}
|
|
2530
|
+
</td>
|
|
2531
|
+
</tr>
|
|
2532
|
+
</ng-template>
|
|
2533
|
+
</p-tree-table>
|
|
2534
|
+
</div>
|
|
2349
2535
|
`,
|
|
2350
2536
|
standalone: true,
|
|
2351
|
-
imports: [TreeTableModule],
|
|
2537
|
+
imports: [CommonModule, TreeTableModule],
|
|
2352
2538
|
providers: [NodeService]
|
|
2353
2539
|
})
|
|
2354
2540
|
export class TreetableSortremovableDemo implements OnInit {
|
|
2355
2541
|
private nodeService = inject(NodeService);
|
|
2542
|
+
|
|
2543
|
+
@ViewChild('tt') tt: TreeTable;
|
|
2544
|
+
|
|
2356
2545
|
metaKeySelection: boolean = true;
|
|
2546
|
+
|
|
2357
2547
|
files!: TreeNode[];
|
|
2548
|
+
|
|
2358
2549
|
initialValue: TreeNode[];
|
|
2550
|
+
|
|
2359
2551
|
selectedNode!: TreeNode;
|
|
2552
|
+
|
|
2360
2553
|
cols!: Column[];
|
|
2554
|
+
|
|
2361
2555
|
isSorted: boolean = null;
|
|
2362
2556
|
|
|
2363
2557
|
ngOnInit() {
|
|
@@ -2365,13 +2559,13 @@ export class TreetableSortremovableDemo implements OnInit {
|
|
|
2365
2559
|
this.files = files;
|
|
2366
2560
|
this.initialValue = [...files];
|
|
2367
2561
|
});
|
|
2562
|
+
|
|
2368
2563
|
this.cols = [
|
|
2369
2564
|
{ field: 'name', header: 'Name' },
|
|
2370
2565
|
{ field: 'size', header: 'Size' },
|
|
2371
2566
|
{ field: 'type', header: 'Type' }
|
|
2372
2567
|
];
|
|
2373
2568
|
}
|
|
2374
|
-
|
|
2375
2569
|
customSort(event: SortEvent) {
|
|
2376
2570
|
if (this.isSorted == null || this.isSorted === undefined) {
|
|
2377
2571
|
this.isSorted = true;
|
|
@@ -2396,7 +2590,7 @@ export class TreetableSortremovableDemo implements OnInit {
|
|
|
2396
2590
|
else if (value1 == null && value2 == null) result = 0;
|
|
2397
2591
|
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2);
|
|
2398
2592
|
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
2399
|
-
|
|
2593
|
+
|
|
2400
2594
|
return event.order * result;
|
|
2401
2595
|
});
|
|
2402
2596
|
}
|
|
@@ -2408,10 +2602,11 @@ export class TreetableSortremovableDemo implements OnInit {
|
|
|
2408
2602
|
Sorting on a column is enabled by adding the ttSortableColumn property.
|
|
2409
2603
|
|
|
2410
2604
|
```typescript
|
|
2411
|
-
import {
|
|
2605
|
+
import { CommonModule } from '@angular/common';
|
|
2606
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2607
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2412
2608
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
2413
2609
|
import { NodeService } from '@/service/nodeservice';
|
|
2414
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2415
2610
|
|
|
2416
2611
|
interface Column {
|
|
2417
2612
|
field: string;
|
|
@@ -2420,48 +2615,53 @@ interface Column {
|
|
|
2420
2615
|
|
|
2421
2616
|
@Component({
|
|
2422
2617
|
template: `
|
|
2423
|
-
<
|
|
2424
|
-
<
|
|
2425
|
-
<
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
<
|
|
2429
|
-
{{ col.header }}
|
|
2430
|
-
<p-tree-table-sort-icon [field]="col.field" />
|
|
2431
|
-
</div>
|
|
2432
|
-
</th>
|
|
2433
|
-
}
|
|
2434
|
-
</tr>
|
|
2435
|
-
</ng-template>
|
|
2436
|
-
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2437
|
-
<tr [ttRow]="rowNode">
|
|
2438
|
-
@for (col of columns; let first = $first; track col) {
|
|
2439
|
-
<td>
|
|
2440
|
-
@if (first) {
|
|
2618
|
+
<div class="card">
|
|
2619
|
+
<p-tree-table [value]="files" [columns]="cols" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2620
|
+
<ng-template #header let-columns>
|
|
2621
|
+
<tr>
|
|
2622
|
+
@for (col of columns; track col) {
|
|
2623
|
+
<th [ttSortableColumn]="col.field">
|
|
2441
2624
|
<div class="flex items-center gap-2">
|
|
2442
|
-
|
|
2443
|
-
<
|
|
2625
|
+
{{ col.header }}
|
|
2626
|
+
<p-tree-table-sort-icon [field]="col.field" />
|
|
2444
2627
|
</div>
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2628
|
+
</th>
|
|
2629
|
+
}
|
|
2630
|
+
</tr>
|
|
2631
|
+
</ng-template>
|
|
2632
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2633
|
+
<tr [ttRow]="rowNode">
|
|
2634
|
+
@for (col of columns; let first = $first; track col) {
|
|
2635
|
+
<td>
|
|
2636
|
+
@if (first) {
|
|
2637
|
+
<div class="flex items-center gap-2">
|
|
2638
|
+
<p-tree-table-toggler [rowNode]="rowNode"></p-tree-table-toggler>
|
|
2639
|
+
<span>{{ rowData[col.field] }}</span>
|
|
2640
|
+
</div>
|
|
2641
|
+
} @else {
|
|
2642
|
+
{{ rowData[col.field] }}
|
|
2643
|
+
}
|
|
2644
|
+
</td>
|
|
2645
|
+
}
|
|
2646
|
+
</tr>
|
|
2647
|
+
</ng-template>
|
|
2648
|
+
</p-tree-table>
|
|
2649
|
+
</div>
|
|
2453
2650
|
`,
|
|
2454
2651
|
standalone: true,
|
|
2455
|
-
imports: [TreeTableModule],
|
|
2652
|
+
imports: [CommonModule, TreeTableModule],
|
|
2456
2653
|
providers: [NodeService]
|
|
2457
2654
|
})
|
|
2458
2655
|
export class TreetableSortsinglecolumnDemo implements OnInit {
|
|
2459
2656
|
private nodeService = inject(NodeService);
|
|
2657
|
+
|
|
2460
2658
|
files!: TreeNode[];
|
|
2659
|
+
|
|
2461
2660
|
cols!: Column[];
|
|
2462
2661
|
|
|
2463
2662
|
ngOnInit() {
|
|
2464
2663
|
this.nodeService.getFilesystem().then((files) => (this.files = files));
|
|
2664
|
+
|
|
2465
2665
|
this.cols = [
|
|
2466
2666
|
{ field: 'name', header: 'Name' },
|
|
2467
2667
|
{ field: 'size', header: 'Size' },
|
|
@@ -2476,11 +2676,12 @@ export class TreetableSortsinglecolumnDemo implements OnInit {
|
|
|
2476
2676
|
Custom content at caption , header , body and summary sections are supported via templating.
|
|
2477
2677
|
|
|
2478
2678
|
```typescript
|
|
2479
|
-
import {
|
|
2679
|
+
import { CommonModule } from '@angular/common';
|
|
2680
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2681
|
+
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2480
2682
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
2481
2683
|
import { TreeTableModule } from '@exhaustive-ui/core/treetable';
|
|
2482
2684
|
import { NodeService } from '@/service/nodeservice';
|
|
2483
|
-
import { TreeNode } from '@exhaustive-ui/core/api';
|
|
2484
2685
|
|
|
2485
2686
|
interface Column {
|
|
2486
2687
|
field: string;
|
|
@@ -2489,52 +2690,56 @@ interface Column {
|
|
|
2489
2690
|
|
|
2490
2691
|
@Component({
|
|
2491
2692
|
template: `
|
|
2492
|
-
<
|
|
2493
|
-
<
|
|
2494
|
-
|
|
2495
|
-
<
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
{
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
<
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
<
|
|
2693
|
+
<div class="card">
|
|
2694
|
+
<p-tree-table [value]="files" [columns]="cols" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2695
|
+
<ng-template #caption><div class="text-xl font-bold">File Viewer</div> </ng-template>
|
|
2696
|
+
<ng-template #header let-columns>
|
|
2697
|
+
<tr>
|
|
2698
|
+
@for (col of columns; let last = $last; track col) {
|
|
2699
|
+
<th [class]="{ 'w-40': last }">
|
|
2700
|
+
{{ col.header }}
|
|
2701
|
+
</th>
|
|
2702
|
+
}
|
|
2703
|
+
</tr>
|
|
2704
|
+
</ng-template>
|
|
2705
|
+
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
|
2706
|
+
<tr [ttRow]="rowNode">
|
|
2707
|
+
@for (col of columns; let first = $first; let last = $last; track col) {
|
|
2708
|
+
<td>
|
|
2709
|
+
@if (first) {
|
|
2710
|
+
<div class="flex items-center gap-2">
|
|
2711
|
+
<p-tree-table-toggler [rowNode]="rowNode" />
|
|
2712
|
+
<span>{{ rowData[col.field] }}</span>
|
|
2713
|
+
</div>
|
|
2714
|
+
} @else if (last) {
|
|
2715
|
+
<div class="flex flex-wrap gap-2">
|
|
2716
|
+
<p-button icon="pi pi-search" rounded="true" severity="secondary" />
|
|
2717
|
+
<p-button icon="pi pi-pencil" rounded="true" severity="secondary" />
|
|
2718
|
+
</div>
|
|
2719
|
+
} @else {
|
|
2510
2720
|
<span>{{ rowData[col.field] }}</span>
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
</ng-template>
|
|
2524
|
-
<ng-template #summary>
|
|
2525
|
-
<div style="text-align:left">
|
|
2526
|
-
<p-button icon="pi pi-refresh" label="Reload" severity="warn" />
|
|
2527
|
-
</div>
|
|
2528
|
-
</ng-template>
|
|
2529
|
-
</p-tree-table>
|
|
2721
|
+
}
|
|
2722
|
+
</td>
|
|
2723
|
+
}
|
|
2724
|
+
</tr>
|
|
2725
|
+
</ng-template>
|
|
2726
|
+
<ng-template #summary>
|
|
2727
|
+
<div style="text-align:left">
|
|
2728
|
+
<p-button icon="pi pi-refresh" label="Reload" severity="warn" />
|
|
2729
|
+
</div>
|
|
2730
|
+
</ng-template>
|
|
2731
|
+
</p-tree-table>
|
|
2732
|
+
</div>
|
|
2530
2733
|
`,
|
|
2531
2734
|
standalone: true,
|
|
2532
|
-
imports: [
|
|
2735
|
+
imports: [CommonModule, TreeTableModule, ButtonModule],
|
|
2533
2736
|
providers: [NodeService]
|
|
2534
2737
|
})
|
|
2535
2738
|
export class TreetableTemplateDemo implements OnInit {
|
|
2536
2739
|
private nodeService = inject(NodeService);
|
|
2740
|
+
|
|
2537
2741
|
files!: TreeNode[];
|
|
2742
|
+
|
|
2538
2743
|
cols!: Column[];
|
|
2539
2744
|
|
|
2540
2745
|
ngOnInit() {
|
|
@@ -2557,71 +2762,71 @@ TreeTable is used to display hierarchical data in tabular format.
|
|
|
2557
2762
|
|
|
2558
2763
|
| Name | Type | Default | Description |
|
|
2559
2764
|
|------|------|---------|-------------|
|
|
2560
|
-
| dt |
|
|
2561
|
-
| unstyled |
|
|
2562
|
-
| pt |
|
|
2563
|
-
| ptOptions |
|
|
2564
|
-
| columns |
|
|
2565
|
-
| tableStyle |
|
|
2566
|
-
| tableStyleClass |
|
|
2567
|
-
| autoLayout |
|
|
2568
|
-
| lazy |
|
|
2569
|
-
| lazyLoadOnInit |
|
|
2570
|
-
| paginator |
|
|
2571
|
-
| rows |
|
|
2572
|
-
| first |
|
|
2573
|
-
| pageLinks |
|
|
2574
|
-
| rowsPerPageOptions |
|
|
2575
|
-
| alwaysShowPaginator |
|
|
2576
|
-
| paginatorPosition |
|
|
2577
|
-
| paginatorStyleClass |
|
|
2578
|
-
| paginatorDropdownAppendTo |
|
|
2579
|
-
| currentPageReportTemplate |
|
|
2580
|
-
| showCurrentPageReport |
|
|
2581
|
-
| showJumpToPageDropdown |
|
|
2582
|
-
| showFirstLastIcon |
|
|
2583
|
-
| showPageLinks |
|
|
2584
|
-
| defaultSortOrder |
|
|
2585
|
-
| sortMode |
|
|
2586
|
-
| resetPageOnSort |
|
|
2587
|
-
| customSort |
|
|
2588
|
-
| selectionMode |
|
|
2589
|
-
| contextMenuSelection |
|
|
2590
|
-
| contextMenuSelectionMode |
|
|
2591
|
-
| dataKey |
|
|
2592
|
-
| metaKeySelection |
|
|
2593
|
-
| compareSelectionBy |
|
|
2594
|
-
| rowHover |
|
|
2595
|
-
| loading |
|
|
2596
|
-
| loadingIcon |
|
|
2597
|
-
| showLoader |
|
|
2598
|
-
| scrollable |
|
|
2599
|
-
| scrollHeight |
|
|
2600
|
-
| virtualScroll |
|
|
2601
|
-
| virtualScrollItemSize |
|
|
2602
|
-
| virtualScrollOptions |
|
|
2603
|
-
| virtualScrollDelay |
|
|
2604
|
-
| frozenWidth |
|
|
2605
|
-
| frozenColumns |
|
|
2606
|
-
| resizableColumns |
|
|
2607
|
-
| columnResizeMode |
|
|
2608
|
-
| reorderableColumns |
|
|
2609
|
-
| contextMenu |
|
|
2610
|
-
| rowTrackBy |
|
|
2611
|
-
| filters |
|
|
2612
|
-
| globalFilterFields |
|
|
2613
|
-
| filterDelay |
|
|
2614
|
-
| filterMode |
|
|
2615
|
-
| filterLocale |
|
|
2616
|
-
| paginatorLocale |
|
|
2617
|
-
| totalRecords |
|
|
2618
|
-
| sortField |
|
|
2619
|
-
| sortOrder |
|
|
2620
|
-
| multiSortMeta |
|
|
2621
|
-
| selection |
|
|
2622
|
-
| value |
|
|
2623
|
-
| selectionKeys |
|
|
2624
|
-
| showGridlines |
|
|
2765
|
+
| dt | Object | undefined | Defines scoped design tokens of the component. |
|
|
2766
|
+
| unstyled | boolean | undefined | Indicates whether the component should be rendered without styles. |
|
|
2767
|
+
| pt | TreeTablePassThrough | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
2768
|
+
| ptOptions | PassThroughOptions | undefined | Used to configure passthrough(pt) options of the component. |
|
|
2769
|
+
| columns | any[] | - | An array of objects to represent dynamic columns. |
|
|
2770
|
+
| tableStyle | { [klass: string]: any } | - | Inline style of the table. |
|
|
2771
|
+
| tableStyleClass | string | - | Style class of the table. |
|
|
2772
|
+
| autoLayout | boolean | - | Whether the cell widths scale according to their content or not. |
|
|
2773
|
+
| lazy | boolean | false | Defines if data is loaded and interacted with in lazy manner. |
|
|
2774
|
+
| lazyLoadOnInit | boolean | true | Whether to call lazy loading on initialization. |
|
|
2775
|
+
| paginator | boolean | - | When specified as true, enables the pagination. |
|
|
2776
|
+
| rows | number | - | Number of rows to display per page, supports one or two-way binding. Emits `rowsChange` with the row count on rows change. |
|
|
2777
|
+
| first | number | 0 | Index of the first row to be displayed, supports one or two-way binding. Emits `firstChange` with the first element on pagination. |
|
|
2778
|
+
| pageLinks | number | 5 | Number of page links to display in paginator. |
|
|
2779
|
+
| rowsPerPageOptions | any[] | - | Array of integer/object values to display inside rows per page dropdown of paginator |
|
|
2780
|
+
| alwaysShowPaginator | boolean | true | Whether to show it even there is only one page. |
|
|
2781
|
+
| paginatorPosition | "top" \| "bottom" \| "both" | 'bottom' | Position of the paginator. |
|
|
2782
|
+
| paginatorStyleClass | string | - | Custom style class for paginator |
|
|
2783
|
+
| paginatorDropdownAppendTo | any | - | Target element to attach the paginator dropdown 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). |
|
|
2784
|
+
| currentPageReportTemplate | string | '{currentPage} of {totalPages}' | Template of the current page report element. Available placeholders are {currentPage},{totalPages},{rows},{first},{last} and {totalRecords} |
|
|
2785
|
+
| showCurrentPageReport | boolean | - | Whether to display current page report. |
|
|
2786
|
+
| showJumpToPageDropdown | boolean | - | Whether to display a dropdown to navigate to any page. |
|
|
2787
|
+
| showFirstLastIcon | boolean | true | When enabled, icons are displayed on paginator to go first and last page. |
|
|
2788
|
+
| showPageLinks | boolean | true | Whether to show page links. |
|
|
2789
|
+
| defaultSortOrder | number | 1 | Sort order to use when an unsorted column gets sorted by user interaction. |
|
|
2790
|
+
| sortMode | "multiple" \| "single" | 'single' | Defines whether sorting works on single column or on multiple columns. |
|
|
2791
|
+
| resetPageOnSort | boolean | true | When true, resets paginator to first page after sorting. |
|
|
2792
|
+
| customSort | boolean | - | Whether to use the default sorting or a custom one using sortFunction. |
|
|
2793
|
+
| selectionMode | string | - | Specifies the selection mode, valid values are "single" and "multiple". |
|
|
2794
|
+
| contextMenuSelection | any | - | Selected row with a context menu, supports one or two-way binding. Emits `contextMenuSelectionChange` with the node instance on context menu selection change. |
|
|
2795
|
+
| contextMenuSelectionMode | string | 'separate' | Mode of the contet menu selection. |
|
|
2796
|
+
| dataKey | string | - | A property to uniquely identify a record in data. |
|
|
2797
|
+
| metaKeySelection | boolean | false | Defines whether metaKey is should be considered for the selection. On touch enabled devices, metaKeySelection is turned off automatically. |
|
|
2798
|
+
| compareSelectionBy | string | 'deepEquals' | Algorithm to define if a row is selected, valid values are "equals" that compares by reference and "deepEquals" that compares all fields. |
|
|
2799
|
+
| rowHover | boolean | - | Adds hover effect to rows without the need for selectionMode. |
|
|
2800
|
+
| loading | boolean | - | Displays a loader to indicate data load is in progress. |
|
|
2801
|
+
| loadingIcon | string | - | The icon to show while indicating data load is in progress. |
|
|
2802
|
+
| showLoader | boolean | true | Whether to show the loading mask when loading property is true. |
|
|
2803
|
+
| scrollable | boolean | - | When specified, enables horizontal and/or vertical scrolling. |
|
|
2804
|
+
| scrollHeight | string | - | Height of the scroll viewport in fixed pixels or the "flex" keyword for a dynamic size. |
|
|
2805
|
+
| virtualScroll | boolean | - | Whether the data should be loaded on demand during scroll. |
|
|
2806
|
+
| virtualScrollItemSize | number | - | Height of a row to use in calculations of virtual scrolling. |
|
|
2807
|
+
| virtualScrollOptions | ScrollerOptions | - | Whether to use the scroller feature. The properties of scroller component can be used like an object in it. |
|
|
2808
|
+
| virtualScrollDelay | number | 150 | The delay (in milliseconds) before triggering the virtual scroll. This determines the time gap between the user's scroll action and the actual rendering of the next set of items in the virtual scroll. |
|
|
2809
|
+
| frozenWidth | string | - | Width of the frozen columns container. |
|
|
2810
|
+
| frozenColumns | { [klass: string]: any } | - | An array of objects to represent dynamic columns that are frozen. |
|
|
2811
|
+
| resizableColumns | boolean | - | When enabled, columns can be resized using drag and drop. |
|
|
2812
|
+
| columnResizeMode | string | 'fit' | Defines whether the overall table width should change on column resize, valid values are "fit" and "expand". |
|
|
2813
|
+
| reorderableColumns | boolean | - | When enabled, columns can be reordered using drag and drop. |
|
|
2814
|
+
| contextMenu | any | - | Local ng-template varilable of a ContextMenu. |
|
|
2815
|
+
| rowTrackBy | Function | (index: number, item: any) => item?.node ?? item | Function to optimize the dom operations by delegating to ngForTrackBy, default algorithm checks for the identity of the row node. |
|
|
2816
|
+
| filters | { [s: string]: FilterMetadata } | {} | An array of FilterMetadata objects to provide external filters. |
|
|
2817
|
+
| globalFilterFields | string[] | - | An array of fields as string to use in global filtering. |
|
|
2818
|
+
| filterDelay | number | 300 | Delay in milliseconds before filtering the data. |
|
|
2819
|
+
| filterMode | string | 'lenient' | Mode for filtering valid values are "lenient" and "strict". Default is lenient. |
|
|
2820
|
+
| filterLocale | string | - | Locale to use in filtering. The default locale is the host environment's current locale. |
|
|
2821
|
+
| paginatorLocale | string | - | Locale to be used in paginator formatting. |
|
|
2822
|
+
| totalRecords | number | 0 | Number of total records, defaults to length of value when not defined. |
|
|
2823
|
+
| sortField | string | - | Name of the field to sort data by default. |
|
|
2824
|
+
| sortOrder | number | 1 | Order to sort when default sorting is enabled. |
|
|
2825
|
+
| multiSortMeta | SortMeta[] | null | An array of SortMeta objects to sort the data by default in multiple sort mode. |
|
|
2826
|
+
| selection | any | null | Selected row in single mode or an array of values in multiple mode, supports one or two-way binding. Emits `selectionChange` with the node instance on selected node change. |
|
|
2827
|
+
| value | TreeNode<any>[] | [] | An array of objects to display. |
|
|
2828
|
+
| selectionKeys | any | - | A map of keys to control the selection state. |
|
|
2829
|
+
| showGridlines | boolean | false | Whether to show grid lines between cells. |
|
|
2625
2830
|
|
|
2626
2831
|
### Emits
|
|
2627
2832
|
|