@acorex/components 21.0.0-next.39 → 21.0.0-next.40
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/accordion/index.d.ts +0 -1
- package/button-group/index.d.ts +6 -4
- package/chips/index.d.ts +3 -8
- package/dialog/index.d.ts +1 -1
- package/fesm2022/acorex-components-accordion.mjs +16 -21
- package/fesm2022/acorex-components-accordion.mjs.map +1 -1
- package/fesm2022/acorex-components-action-sheet.mjs +12 -12
- package/fesm2022/acorex-components-action-sheet.mjs.map +1 -1
- package/fesm2022/acorex-components-alert.mjs +13 -13
- package/fesm2022/acorex-components-alert.mjs.map +1 -1
- package/fesm2022/acorex-components-aspect-ratio.mjs +3 -3
- package/fesm2022/acorex-components-aspect-ratio.mjs.map +1 -1
- package/fesm2022/acorex-components-audio-wave.mjs +11 -10
- package/fesm2022/acorex-components-audio-wave.mjs.map +1 -1
- package/fesm2022/acorex-components-autocomplete.mjs +7 -7
- package/fesm2022/acorex-components-autocomplete.mjs.map +1 -1
- package/fesm2022/acorex-components-avatar.mjs +12 -12
- package/fesm2022/acorex-components-avatar.mjs.map +1 -1
- package/fesm2022/acorex-components-badge.mjs +9 -9
- package/fesm2022/acorex-components-badge.mjs.map +1 -1
- package/fesm2022/acorex-components-bottom-navigation.mjs +11 -11
- package/fesm2022/acorex-components-bottom-navigation.mjs.map +1 -1
- package/fesm2022/acorex-components-breadcrumbs.mjs +11 -11
- package/fesm2022/acorex-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/acorex-components-button-group.mjs +23 -19
- package/fesm2022/acorex-components-button-group.mjs.map +1 -1
- package/fesm2022/acorex-components-button.mjs +18 -18
- package/fesm2022/acorex-components-button.mjs.map +1 -1
- package/fesm2022/acorex-components-calendar.mjs +17 -17
- package/fesm2022/acorex-components-calendar.mjs.map +1 -1
- package/fesm2022/acorex-components-check-box.mjs +10 -10
- package/fesm2022/acorex-components-check-box.mjs.map +1 -1
- package/fesm2022/acorex-components-chips.mjs +12 -14
- package/fesm2022/acorex-components-chips.mjs.map +1 -1
- package/fesm2022/acorex-components-circular-progress.mjs +12 -10
- package/fesm2022/acorex-components-circular-progress.mjs.map +1 -1
- package/fesm2022/acorex-components-code-editor.mjs +10 -10
- package/fesm2022/acorex-components-code-editor.mjs.map +1 -1
- package/fesm2022/acorex-components-collapse.mjs +13 -13
- package/fesm2022/acorex-components-collapse.mjs.map +1 -1
- package/fesm2022/acorex-components-color-box.mjs +9 -9
- package/fesm2022/acorex-components-color-box.mjs.map +1 -1
- package/fesm2022/acorex-components-color-palette.mjs +30 -30
- package/fesm2022/acorex-components-color-palette.mjs.map +1 -1
- package/fesm2022/acorex-components-command.mjs +9 -9
- package/fesm2022/acorex-components-command.mjs.map +1 -1
- package/fesm2022/acorex-components-comment.mjs +32 -32
- package/fesm2022/acorex-components-comment.mjs.map +1 -1
- package/fesm2022/acorex-components-conversation.mjs +51 -51
- package/fesm2022/acorex-components-conversation.mjs.map +1 -1
- package/fesm2022/acorex-components-conversation2.mjs +184 -184
- package/fesm2022/acorex-components-conversation2.mjs.map +1 -1
- package/fesm2022/acorex-components-cron-job.mjs +46 -46
- package/fesm2022/acorex-components-cron-job.mjs.map +1 -1
- package/fesm2022/acorex-components-data-list.mjs +3 -3
- package/fesm2022/acorex-components-data-list.mjs.map +1 -1
- package/fesm2022/acorex-components-data-pager.mjs +33 -33
- package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
- package/fesm2022/acorex-components-data-table.mjs +43 -43
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-box.mjs +9 -9
- package/fesm2022/acorex-components-datetime-box.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-input.mjs +9 -9
- package/fesm2022/acorex-components-datetime-input.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-picker.mjs +9 -9
- package/fesm2022/acorex-components-datetime-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-decorators.mjs +43 -36
- package/fesm2022/acorex-components-decorators.mjs.map +1 -1
- package/fesm2022/acorex-components-dialog.mjs +15 -14
- package/fesm2022/acorex-components-dialog.mjs.map +1 -1
- package/fesm2022/acorex-components-drawer-legacy.mjs +13 -13
- package/fesm2022/acorex-components-drawer-legacy.mjs.map +1 -1
- package/fesm2022/acorex-components-drawer.mjs +15 -16
- package/fesm2022/acorex-components-drawer.mjs.map +1 -1
- package/fesm2022/acorex-components-dropdown-button.mjs +9 -9
- package/fesm2022/acorex-components-dropdown-button.mjs.map +1 -1
- package/fesm2022/acorex-components-dropdown.mjs +18 -16
- package/fesm2022/acorex-components-dropdown.mjs.map +1 -1
- package/fesm2022/acorex-components-editor.mjs +11 -11
- package/fesm2022/acorex-components-editor.mjs.map +1 -1
- package/fesm2022/acorex-components-file-explorer.mjs +25 -25
- package/fesm2022/acorex-components-file-explorer.mjs.map +1 -1
- package/fesm2022/acorex-components-flow-chart.mjs +16 -16
- package/fesm2022/acorex-components-flow-chart.mjs.map +1 -1
- package/fesm2022/acorex-components-form.mjs +32 -24
- package/fesm2022/acorex-components-form.mjs.map +1 -1
- package/fesm2022/acorex-components-grid-layout-builder.mjs +12 -13
- package/fesm2022/acorex-components-grid-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-components-image-editor.mjs +44 -44
- package/fesm2022/acorex-components-image-editor.mjs.map +1 -1
- package/fesm2022/acorex-components-image.mjs +9 -9
- package/fesm2022/acorex-components-image.mjs.map +1 -1
- package/fesm2022/acorex-components-json-viewer.mjs +8 -8
- package/fesm2022/acorex-components-json-viewer.mjs.map +1 -1
- package/fesm2022/acorex-components-kanban.mjs +8 -6
- package/fesm2022/acorex-components-kanban.mjs.map +1 -1
- package/fesm2022/acorex-components-kbd.mjs +29 -11
- package/fesm2022/acorex-components-kbd.mjs.map +1 -1
- package/fesm2022/acorex-components-label.mjs +9 -9
- package/fesm2022/acorex-components-label.mjs.map +1 -1
- package/fesm2022/acorex-components-list.mjs +9 -9
- package/fesm2022/acorex-components-list.mjs.map +1 -1
- package/fesm2022/acorex-components-loading-dialog.mjs +12 -12
- package/fesm2022/acorex-components-loading-dialog.mjs.map +1 -1
- package/fesm2022/acorex-components-loading.mjs +23 -23
- package/fesm2022/acorex-components-loading.mjs.map +1 -1
- package/fesm2022/acorex-components-map.mjs +14 -14
- package/fesm2022/acorex-components-map.mjs.map +1 -1
- package/fesm2022/acorex-components-media-viewer.mjs +41 -41
- package/fesm2022/acorex-components-media-viewer.mjs.map +1 -1
- package/fesm2022/acorex-components-menu.mjs +21 -21
- package/fesm2022/acorex-components-menu.mjs.map +1 -1
- package/fesm2022/{acorex-components-modal-acorex-components-modal-iYSPzoLn.mjs → acorex-components-modal-acorex-components-modal-CjHPRiZD.mjs} +22 -22
- package/fesm2022/acorex-components-modal-acorex-components-modal-CjHPRiZD.mjs.map +1 -0
- package/fesm2022/acorex-components-modal-modal-content.component-j-bS0WGj.mjs +214 -0
- package/fesm2022/acorex-components-modal-modal-content.component-j-bS0WGj.mjs.map +1 -0
- package/fesm2022/acorex-components-modal.mjs +1 -1
- package/fesm2022/acorex-components-navbar.mjs +9 -9
- package/fesm2022/acorex-components-navbar.mjs.map +1 -1
- package/fesm2022/acorex-components-notification.mjs +16 -23
- package/fesm2022/acorex-components-notification.mjs.map +1 -1
- package/fesm2022/acorex-components-number-box-legacy.mjs +9 -9
- package/fesm2022/acorex-components-number-box-legacy.mjs.map +1 -1
- package/fesm2022/acorex-components-number-box.mjs +14 -15
- package/fesm2022/acorex-components-number-box.mjs.map +1 -1
- package/fesm2022/acorex-components-otp.mjs +9 -9
- package/fesm2022/acorex-components-otp.mjs.map +1 -1
- package/fesm2022/acorex-components-page.mjs +10 -10
- package/fesm2022/acorex-components-page.mjs.map +1 -1
- package/fesm2022/acorex-components-paint.mjs +34 -39
- package/fesm2022/acorex-components-paint.mjs.map +1 -1
- package/fesm2022/acorex-components-password-box.mjs +12 -12
- package/fesm2022/acorex-components-password-box.mjs.map +1 -1
- package/fesm2022/acorex-components-pdf-reader.mjs +8 -8
- package/fesm2022/acorex-components-pdf-reader.mjs.map +1 -1
- package/fesm2022/acorex-components-phone-box.mjs +9 -9
- package/fesm2022/acorex-components-phone-box.mjs.map +1 -1
- package/fesm2022/acorex-components-picker.mjs +15 -15
- package/fesm2022/acorex-components-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-popover.mjs +11 -11
- package/fesm2022/acorex-components-popover.mjs.map +1 -1
- package/fesm2022/acorex-components-popup.mjs +13 -13
- package/fesm2022/acorex-components-popup.mjs.map +1 -1
- package/fesm2022/acorex-components-progress-bar.mjs +11 -9
- package/fesm2022/acorex-components-progress-bar.mjs.map +1 -1
- package/fesm2022/acorex-components-qrcode.mjs +7 -7
- package/fesm2022/acorex-components-qrcode.mjs.map +1 -1
- package/fesm2022/acorex-components-query-builder.mjs +8 -8
- package/fesm2022/acorex-components-query-builder.mjs.map +1 -1
- package/fesm2022/acorex-components-radio.mjs +7 -7
- package/fesm2022/acorex-components-radio.mjs.map +1 -1
- package/fesm2022/acorex-components-rail-navigation.mjs +38 -36
- package/fesm2022/acorex-components-rail-navigation.mjs.map +1 -1
- package/fesm2022/acorex-components-range-slider.mjs +10 -10
- package/fesm2022/acorex-components-range-slider.mjs.map +1 -1
- package/fesm2022/acorex-components-rate-picker.mjs +20 -35
- package/fesm2022/acorex-components-rate-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-rest-api-generator.mjs +22 -22
- package/fesm2022/acorex-components-rest-api-generator.mjs.map +1 -1
- package/fesm2022/acorex-components-result.mjs +8 -8
- package/fesm2022/acorex-components-result.mjs.map +1 -1
- package/fesm2022/acorex-components-routing-progress.mjs +8 -8
- package/fesm2022/acorex-components-routing-progress.mjs.map +1 -1
- package/fesm2022/acorex-components-rrule.mjs +9 -9
- package/fesm2022/acorex-components-rrule.mjs.map +1 -1
- package/fesm2022/acorex-components-scheduler-picker.mjs +56 -56
- package/fesm2022/acorex-components-scheduler-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-scheduler.mjs +43 -43
- package/fesm2022/acorex-components-scheduler.mjs.map +1 -1
- package/fesm2022/acorex-components-scss.mjs +4 -4
- package/fesm2022/acorex-components-scss.mjs.map +1 -1
- package/fesm2022/acorex-components-search-box.mjs +16 -10
- package/fesm2022/acorex-components-search-box.mjs.map +1 -1
- package/fesm2022/acorex-components-select-box.mjs +11 -9
- package/fesm2022/acorex-components-select-box.mjs.map +1 -1
- package/fesm2022/acorex-components-selection-list-2.mjs +11 -11
- package/fesm2022/acorex-components-selection-list-2.mjs.map +1 -1
- package/fesm2022/acorex-components-selection-list.mjs +9 -9
- package/fesm2022/acorex-components-selection-list.mjs.map +1 -1
- package/fesm2022/acorex-components-side-menu.mjs +14 -14
- package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-skeleton.mjs +8 -8
- package/fesm2022/acorex-components-skeleton.mjs.map +1 -1
- package/fesm2022/acorex-components-slider.mjs +10 -10
- package/fesm2022/acorex-components-slider.mjs.map +1 -1
- package/fesm2022/acorex-components-sliding-item.mjs +14 -14
- package/fesm2022/acorex-components-sliding-item.mjs.map +1 -1
- package/fesm2022/acorex-components-step-wizard.mjs +14 -14
- package/fesm2022/acorex-components-step-wizard.mjs.map +1 -1
- package/fesm2022/acorex-components-switch.mjs +14 -14
- package/fesm2022/acorex-components-switch.mjs.map +1 -1
- package/fesm2022/acorex-components-tabs.mjs +15 -15
- package/fesm2022/acorex-components-tabs.mjs.map +1 -1
- package/fesm2022/acorex-components-tag-box.mjs +9 -9
- package/fesm2022/acorex-components-tag-box.mjs.map +1 -1
- package/fesm2022/acorex-components-tag.mjs +9 -9
- package/fesm2022/acorex-components-tag.mjs.map +1 -1
- package/fesm2022/acorex-components-text-area.mjs +9 -9
- package/fesm2022/acorex-components-text-area.mjs.map +1 -1
- package/fesm2022/acorex-components-text-box.mjs +12 -12
- package/fesm2022/acorex-components-text-box.mjs.map +1 -1
- package/fesm2022/acorex-components-time-duration.mjs +7 -7
- package/fesm2022/acorex-components-time-duration.mjs.map +1 -1
- package/fesm2022/acorex-components-time-line.mjs +12 -12
- package/fesm2022/acorex-components-time-line.mjs.map +1 -1
- package/fesm2022/acorex-components-toast.mjs +14 -14
- package/fesm2022/acorex-components-toast.mjs.map +1 -1
- package/fesm2022/acorex-components-toolbar.mjs +8 -8
- package/fesm2022/acorex-components-toolbar.mjs.map +1 -1
- package/fesm2022/acorex-components-tooltip.mjs +11 -11
- package/fesm2022/acorex-components-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-components-tree-view-legacy.mjs +10 -10
- package/fesm2022/acorex-components-tree-view-legacy.mjs.map +1 -1
- package/fesm2022/acorex-components-tree-view.mjs +326 -664
- package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
- package/fesm2022/acorex-components-uploader.mjs +16 -16
- package/fesm2022/acorex-components-uploader.mjs.map +1 -1
- package/fesm2022/acorex-components-video-player.mjs +7 -7
- package/fesm2022/acorex-components-video-player.mjs.map +1 -1
- package/fesm2022/acorex-components-wysiwyg.mjs +42 -42
- package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
- package/fesm2022/acorex-components.mjs.map +1 -1
- package/grid-layout-builder/index.d.ts +1 -2
- package/kbd/index.d.ts +13 -7
- package/loading/index.d.ts +1 -1
- package/notification/index.d.ts +0 -2
- package/number-box/index.d.ts +1 -1
- package/package.json +7 -7
- package/paint/index.d.ts +1 -6
- package/rate-picker/index.d.ts +5 -15
- package/tree-view/index.d.ts +45 -213
- package/fesm2022/acorex-components-modal-acorex-components-modal-iYSPzoLn.mjs.map +0 -1
- package/fesm2022/acorex-components-modal-modal-content.component-sZWKhYM-.mjs +0 -212
- package/fesm2022/acorex-components-modal-modal-content.component-sZWKhYM-.mjs.map +0 -1
|
@@ -4,7 +4,6 @@ import { AXBadgeComponent } from '@acorex/components/badge';
|
|
|
4
4
|
import { AXButtonComponent } from '@acorex/components/button';
|
|
5
5
|
import { AXCheckBoxComponent } from '@acorex/components/check-box';
|
|
6
6
|
import { AXDecoratorIconComponent } from '@acorex/components/decorators';
|
|
7
|
-
import { AXTooltipDirective } from '@acorex/components/tooltip';
|
|
8
7
|
import { AXPlatform } from '@acorex/core/platform';
|
|
9
8
|
import * as i1 from '@angular/common';
|
|
10
9
|
import { CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
@@ -28,13 +27,12 @@ class AXTreeViewService {
|
|
|
28
27
|
/**
|
|
29
28
|
* Find a node by ID in the tree
|
|
30
29
|
*/
|
|
31
|
-
findNodeById(nodes, id
|
|
30
|
+
findNodeById(nodes, id) {
|
|
32
31
|
for (const node of nodes) {
|
|
33
|
-
if (node
|
|
32
|
+
if (node.id === id)
|
|
34
33
|
return node;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const found = this.findNodeById(children, id, idField);
|
|
34
|
+
if (node.children) {
|
|
35
|
+
const found = this.findNodeById(node.children, id);
|
|
38
36
|
if (found)
|
|
39
37
|
return found;
|
|
40
38
|
}
|
|
@@ -44,15 +42,13 @@ class AXTreeViewService {
|
|
|
44
42
|
/**
|
|
45
43
|
* Find parent node of a given node
|
|
46
44
|
*/
|
|
47
|
-
findParentNode(nodes, targetNode
|
|
48
|
-
const targetId = targetNode[idField];
|
|
45
|
+
findParentNode(nodes, targetNode) {
|
|
49
46
|
for (const node of nodes) {
|
|
50
|
-
|
|
51
|
-
if (children?.some((child) => child[idField] === targetId)) {
|
|
47
|
+
if (node.children?.some((child) => child.id === targetNode.id)) {
|
|
52
48
|
return node;
|
|
53
49
|
}
|
|
54
|
-
if (children) {
|
|
55
|
-
const found = this.findParentNode(children, targetNode
|
|
50
|
+
if (node.children) {
|
|
51
|
+
const found = this.findParentNode(node.children, targetNode);
|
|
56
52
|
if (found)
|
|
57
53
|
return found;
|
|
58
54
|
}
|
|
@@ -63,10 +59,8 @@ class AXTreeViewService {
|
|
|
63
59
|
* Check if targetNode is a descendant of ancestorNode (or the same node)
|
|
64
60
|
* Prevents circular references by checking if target exists in ancestor's children tree
|
|
65
61
|
*/
|
|
66
|
-
isValidDropTarget(movedNode, targetNode
|
|
67
|
-
|
|
68
|
-
const targetId = targetNode[idField];
|
|
69
|
-
if (movedId === targetId || this.isNodeDescendantOf(targetNode, movedNode, idField, childrenField)) {
|
|
62
|
+
isValidDropTarget(movedNode, targetNode) {
|
|
63
|
+
if (movedNode.id === targetNode.id || this.isNodeDescendantOf(targetNode, movedNode)) {
|
|
70
64
|
return false;
|
|
71
65
|
}
|
|
72
66
|
return true;
|
|
@@ -74,22 +68,18 @@ class AXTreeViewService {
|
|
|
74
68
|
/**
|
|
75
69
|
* Check if targetNode is a descendant of ancestorNode
|
|
76
70
|
*/
|
|
77
|
-
isNodeDescendantOf(targetNode, ancestorNode
|
|
78
|
-
|
|
79
|
-
const ancestorId = ancestorNode[idField];
|
|
80
|
-
if (targetId === ancestorId) {
|
|
71
|
+
isNodeDescendantOf(targetNode, ancestorNode) {
|
|
72
|
+
if (targetNode.id === ancestorNode.id) {
|
|
81
73
|
return true;
|
|
82
74
|
}
|
|
83
|
-
|
|
84
|
-
if (!children || children.length === 0) {
|
|
75
|
+
if (!ancestorNode.children || ancestorNode.children.length === 0) {
|
|
85
76
|
return false;
|
|
86
77
|
}
|
|
87
|
-
for (const child of children) {
|
|
88
|
-
|
|
89
|
-
if (childId === targetId) {
|
|
78
|
+
for (const child of ancestorNode.children) {
|
|
79
|
+
if (child.id === targetNode.id) {
|
|
90
80
|
return true;
|
|
91
81
|
}
|
|
92
|
-
if (this.isNodeDescendantOf(targetNode, child
|
|
82
|
+
if (this.isNodeDescendantOf(targetNode, child)) {
|
|
93
83
|
return true;
|
|
94
84
|
}
|
|
95
85
|
}
|
|
@@ -98,18 +88,14 @@ class AXTreeViewService {
|
|
|
98
88
|
/**
|
|
99
89
|
* Build a flat list of all visible focusable nodes
|
|
100
90
|
*/
|
|
101
|
-
buildFlatNodeList(nodes
|
|
91
|
+
buildFlatNodeList(nodes) {
|
|
102
92
|
const flatList = [];
|
|
103
93
|
const traverse = (nodeList, level, parent) => {
|
|
104
94
|
for (const node of nodeList) {
|
|
105
|
-
|
|
106
|
-
const disabled = node[disabledField];
|
|
107
|
-
if (hidden !== true && !disabled) {
|
|
95
|
+
if (node.visible !== false && !node.disabled) {
|
|
108
96
|
flatList.push({ node, level, parent });
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (expanded && children) {
|
|
112
|
-
traverse(children, level + 1, node);
|
|
97
|
+
if (node.expanded && node.children) {
|
|
98
|
+
traverse(node.children, level + 1, node);
|
|
113
99
|
}
|
|
114
100
|
}
|
|
115
101
|
}
|
|
@@ -121,44 +107,39 @@ class AXTreeViewService {
|
|
|
121
107
|
/**
|
|
122
108
|
* Check if node has children
|
|
123
109
|
*/
|
|
124
|
-
hasChildren(node
|
|
125
|
-
|
|
126
|
-
return Boolean(children?.length);
|
|
110
|
+
hasChildren(node) {
|
|
111
|
+
return Boolean(node.children?.length);
|
|
127
112
|
}
|
|
128
113
|
/**
|
|
129
114
|
* Check if node can be lazy loaded
|
|
130
115
|
*/
|
|
131
|
-
canLazyLoad(node, isLazyDataSource
|
|
132
|
-
|
|
133
|
-
return isLazyDataSource && Boolean(childrenCount && childrenCount > 0 && !this.hasChildren(node, childrenField));
|
|
116
|
+
canLazyLoad(node, isLazyDataSource) {
|
|
117
|
+
return isLazyDataSource && Boolean(node.childrenCount && node.childrenCount > 0 && !this.hasChildren(node));
|
|
134
118
|
}
|
|
135
119
|
// ==================== Selection Management ====================
|
|
136
120
|
/**
|
|
137
121
|
* Recursively select/deselect all children
|
|
138
122
|
*/
|
|
139
|
-
selectAllChildren(children, selected
|
|
123
|
+
selectAllChildren(children, selected) {
|
|
140
124
|
for (const child of children) {
|
|
141
|
-
child
|
|
142
|
-
child
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this.selectAllChildren(childChildren, selected, selectedField, indeterminateField, childrenField);
|
|
125
|
+
child.selected = selected;
|
|
126
|
+
child.indeterminate = false;
|
|
127
|
+
if (child.children) {
|
|
128
|
+
this.selectAllChildren(child.children, selected);
|
|
146
129
|
}
|
|
147
130
|
}
|
|
148
131
|
}
|
|
149
132
|
/**
|
|
150
133
|
* Get selection state of children
|
|
151
134
|
*/
|
|
152
|
-
getChildrenSelectionState(children
|
|
135
|
+
getChildrenSelectionState(children) {
|
|
153
136
|
let selectedCount = 0;
|
|
154
137
|
let indeterminateCount = 0;
|
|
155
138
|
for (const child of children) {
|
|
156
|
-
|
|
157
|
-
const indeterminate = child[indeterminateField];
|
|
158
|
-
if (selected && !indeterminate) {
|
|
139
|
+
if (child.selected && !child.indeterminate) {
|
|
159
140
|
selectedCount++;
|
|
160
141
|
}
|
|
161
|
-
if (indeterminate) {
|
|
142
|
+
if (child.indeterminate) {
|
|
162
143
|
indeterminateCount++;
|
|
163
144
|
}
|
|
164
145
|
}
|
|
@@ -170,69 +151,65 @@ class AXTreeViewService {
|
|
|
170
151
|
/**
|
|
171
152
|
* Update parent node states based on children selection (with intermediate state support)
|
|
172
153
|
*/
|
|
173
|
-
updateParentStates(nodes, changedNode, intermediateState
|
|
174
|
-
const parent = this.findParentNode(nodes, changedNode
|
|
175
|
-
|
|
176
|
-
if (!parent || !parentChildren)
|
|
154
|
+
updateParentStates(nodes, changedNode, intermediateState) {
|
|
155
|
+
const parent = this.findParentNode(nodes, changedNode);
|
|
156
|
+
if (!parent || !parent.children)
|
|
177
157
|
return;
|
|
178
|
-
const { allSelected, someSelected } = this.getChildrenSelectionState(
|
|
158
|
+
const { allSelected, someSelected } = this.getChildrenSelectionState(parent.children);
|
|
179
159
|
if (allSelected) {
|
|
180
|
-
parent
|
|
181
|
-
parent
|
|
160
|
+
parent.selected = true;
|
|
161
|
+
parent.indeterminate = false;
|
|
182
162
|
}
|
|
183
163
|
else if (someSelected) {
|
|
184
164
|
if (intermediateState) {
|
|
185
|
-
parent
|
|
186
|
-
parent
|
|
165
|
+
parent.selected = true;
|
|
166
|
+
parent.indeterminate = true;
|
|
187
167
|
}
|
|
188
168
|
else {
|
|
189
|
-
parent
|
|
190
|
-
parent
|
|
169
|
+
parent.selected = false;
|
|
170
|
+
parent.indeterminate = false;
|
|
191
171
|
}
|
|
192
172
|
}
|
|
193
173
|
else {
|
|
194
|
-
parent
|
|
195
|
-
parent
|
|
174
|
+
parent.selected = false;
|
|
175
|
+
parent.indeterminate = false;
|
|
196
176
|
}
|
|
197
|
-
this.updateParentStates(nodes, parent, intermediateState
|
|
177
|
+
this.updateParentStates(nodes, parent, intermediateState);
|
|
198
178
|
}
|
|
199
179
|
/**
|
|
200
180
|
* Recursively deselect all nodes
|
|
201
181
|
*/
|
|
202
|
-
deselectAllNodes(nodes
|
|
182
|
+
deselectAllNodes(nodes) {
|
|
203
183
|
for (const node of nodes) {
|
|
204
|
-
node
|
|
205
|
-
node
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.deselectAllNodes(children, selectedField, indeterminateField, childrenField);
|
|
184
|
+
node.selected = false;
|
|
185
|
+
node.indeterminate = false;
|
|
186
|
+
if (node.children) {
|
|
187
|
+
this.deselectAllNodes(node.children);
|
|
209
188
|
}
|
|
210
189
|
}
|
|
211
190
|
}
|
|
212
191
|
/**
|
|
213
192
|
* Recursively set selection state for all nodes
|
|
214
193
|
*/
|
|
215
|
-
setAllSelection(nodes, selected
|
|
194
|
+
setAllSelection(nodes, selected) {
|
|
216
195
|
for (const node of nodes) {
|
|
217
|
-
node
|
|
218
|
-
node
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
this.setAllSelection(children, selected, selectedField, indeterminateField, childrenField);
|
|
196
|
+
node.selected = selected;
|
|
197
|
+
node.indeterminate = false;
|
|
198
|
+
if (node.children) {
|
|
199
|
+
this.setAllSelection(node.children, selected);
|
|
222
200
|
}
|
|
223
201
|
}
|
|
224
202
|
}
|
|
225
203
|
/**
|
|
226
204
|
* Recursively count selected nodes
|
|
227
205
|
*/
|
|
228
|
-
countSelected(nodes
|
|
206
|
+
countSelected(nodes) {
|
|
229
207
|
let count = 0;
|
|
230
208
|
for (const node of nodes) {
|
|
231
|
-
if (node
|
|
209
|
+
if (node.selected)
|
|
232
210
|
count++;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
count += this.countSelected(children, selectedField, childrenField);
|
|
211
|
+
if (node.children) {
|
|
212
|
+
count += this.countSelected(node.children);
|
|
236
213
|
}
|
|
237
214
|
}
|
|
238
215
|
return count;
|
|
@@ -240,61 +217,53 @@ class AXTreeViewService {
|
|
|
240
217
|
/**
|
|
241
218
|
* Recursively collect selected nodes
|
|
242
219
|
*/
|
|
243
|
-
collectSelected(nodes, result
|
|
220
|
+
collectSelected(nodes, result) {
|
|
244
221
|
for (const node of nodes) {
|
|
245
|
-
if (node
|
|
222
|
+
if (node.selected)
|
|
246
223
|
result.push(node);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this.collectSelected(children, result, selectedField, childrenField);
|
|
224
|
+
if (node.children) {
|
|
225
|
+
this.collectSelected(node.children, result);
|
|
250
226
|
}
|
|
251
227
|
}
|
|
252
228
|
}
|
|
253
229
|
/**
|
|
254
230
|
* Recursively remove selected nodes
|
|
255
231
|
*/
|
|
256
|
-
removeSelected(nodes
|
|
232
|
+
removeSelected(nodes) {
|
|
257
233
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
258
|
-
|
|
259
|
-
const selected = node[selectedField];
|
|
260
|
-
const indeterminate = node[indeterminateField];
|
|
261
|
-
if (selected && !indeterminate) {
|
|
234
|
+
if (nodes[i].selected && !nodes[i].indeterminate) {
|
|
262
235
|
nodes.splice(i, 1);
|
|
263
236
|
}
|
|
264
|
-
else {
|
|
265
|
-
|
|
266
|
-
if (children) {
|
|
267
|
-
this.removeSelected(children, selectedField, indeterminateField, childrenField);
|
|
268
|
-
}
|
|
237
|
+
else if (nodes[i].children) {
|
|
238
|
+
this.removeSelected(nodes[i].children ?? []);
|
|
269
239
|
}
|
|
270
240
|
}
|
|
271
241
|
}
|
|
272
242
|
/**
|
|
273
243
|
* Recursively update all parent states in the tree (used after deletion)
|
|
274
244
|
*/
|
|
275
|
-
updateAllParentStates(nodes, intermediateState
|
|
245
|
+
updateAllParentStates(nodes, intermediateState) {
|
|
276
246
|
for (const node of nodes) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const { allSelected, someSelected } = this.getChildrenSelectionState(children, selectedField, indeterminateField);
|
|
247
|
+
if (node.children && node.children.length > 0) {
|
|
248
|
+
this.updateAllParentStates(node.children, intermediateState);
|
|
249
|
+
const { allSelected, someSelected } = this.getChildrenSelectionState(node.children);
|
|
281
250
|
if (allSelected) {
|
|
282
|
-
node
|
|
283
|
-
node
|
|
251
|
+
node.selected = true;
|
|
252
|
+
node.indeterminate = false;
|
|
284
253
|
}
|
|
285
254
|
else if (someSelected) {
|
|
286
255
|
if (intermediateState) {
|
|
287
|
-
node
|
|
288
|
-
node
|
|
256
|
+
node.selected = true;
|
|
257
|
+
node.indeterminate = true;
|
|
289
258
|
}
|
|
290
259
|
else {
|
|
291
|
-
node
|
|
292
|
-
node
|
|
260
|
+
node.selected = false;
|
|
261
|
+
node.indeterminate = false;
|
|
293
262
|
}
|
|
294
263
|
}
|
|
295
264
|
else {
|
|
296
|
-
node
|
|
297
|
-
node
|
|
265
|
+
node.selected = false;
|
|
266
|
+
node.indeterminate = false;
|
|
298
267
|
}
|
|
299
268
|
}
|
|
300
269
|
}
|
|
@@ -303,18 +272,17 @@ class AXTreeViewService {
|
|
|
303
272
|
/**
|
|
304
273
|
* Recursively set expanded state (with lazy loading)
|
|
305
274
|
*/
|
|
306
|
-
async setExpandedState(nodes, expanded, isLazyDataSource, loadNodeChildren
|
|
275
|
+
async setExpandedState(nodes, expanded, isLazyDataSource, loadNodeChildren) {
|
|
307
276
|
for (const node of nodes) {
|
|
308
|
-
const hasChildren = this.hasChildren(node
|
|
309
|
-
const canLazyLoad = this.canLazyLoad(node, isLazyDataSource
|
|
277
|
+
const hasChildren = this.hasChildren(node);
|
|
278
|
+
const canLazyLoad = this.canLazyLoad(node, isLazyDataSource);
|
|
310
279
|
if (hasChildren || canLazyLoad) {
|
|
311
280
|
if (expanded && canLazyLoad) {
|
|
312
281
|
await loadNodeChildren(node);
|
|
313
282
|
}
|
|
314
|
-
node
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
await this.setExpandedState(children, expanded, isLazyDataSource, loadNodeChildren, expandedField, childrenField, childrenCountField);
|
|
283
|
+
node.expanded = expanded;
|
|
284
|
+
if (node.children) {
|
|
285
|
+
await this.setExpandedState(node.children, expanded, isLazyDataSource, loadNodeChildren);
|
|
318
286
|
}
|
|
319
287
|
}
|
|
320
288
|
}
|
|
@@ -323,24 +291,23 @@ class AXTreeViewService {
|
|
|
323
291
|
/**
|
|
324
292
|
* Get array reference by drop list ID
|
|
325
293
|
*/
|
|
326
|
-
getArrayByListId(nodes, listId
|
|
294
|
+
getArrayByListId(nodes, listId) {
|
|
327
295
|
if (listId === AXTreeViewService.ROOT_LIST_ID) {
|
|
328
296
|
return nodes;
|
|
329
297
|
}
|
|
330
298
|
if (listId.startsWith(AXTreeViewService.NODE_DROP_PREFIX)) {
|
|
331
299
|
const nodeId = listId.replace(AXTreeViewService.NODE_DROP_PREFIX, '');
|
|
332
|
-
const node = this.findNodeById(nodes, nodeId
|
|
300
|
+
const node = this.findNodeById(nodes, nodeId);
|
|
333
301
|
return node ? [node] : null;
|
|
334
302
|
}
|
|
335
303
|
const nodeId = listId.replace(AXTreeViewService.LIST_PREFIX, '');
|
|
336
|
-
const node = this.findNodeById(nodes, nodeId
|
|
337
|
-
|
|
338
|
-
return children ?? null;
|
|
304
|
+
const node = this.findNodeById(nodes, nodeId);
|
|
305
|
+
return node?.children ?? null;
|
|
339
306
|
}
|
|
340
307
|
/**
|
|
341
308
|
* Find parent node by list ID
|
|
342
309
|
*/
|
|
343
|
-
findParentByListId(nodes, listId
|
|
310
|
+
findParentByListId(nodes, listId) {
|
|
344
311
|
if (listId === AXTreeViewService.ROOT_LIST_ID) {
|
|
345
312
|
return undefined;
|
|
346
313
|
}
|
|
@@ -348,16 +315,13 @@ class AXTreeViewService {
|
|
|
348
315
|
? AXTreeViewService.NODE_DROP_PREFIX
|
|
349
316
|
: AXTreeViewService.LIST_PREFIX;
|
|
350
317
|
const nodeId = listId.replace(prefix, '');
|
|
351
|
-
return this.findNodeById(nodes, nodeId
|
|
318
|
+
return this.findNodeById(nodes, nodeId) ?? undefined;
|
|
352
319
|
}
|
|
353
320
|
/**
|
|
354
321
|
* Generate unique list ID for each node
|
|
355
322
|
*/
|
|
356
|
-
getListId(node
|
|
357
|
-
|
|
358
|
-
return AXTreeViewService.ROOT_LIST_ID;
|
|
359
|
-
const nodeId = node[idField];
|
|
360
|
-
return `${AXTreeViewService.LIST_PREFIX}${nodeId}`;
|
|
323
|
+
getListId(node) {
|
|
324
|
+
return node ? `${AXTreeViewService.LIST_PREFIX}${node.id}` : AXTreeViewService.ROOT_LIST_ID;
|
|
361
325
|
}
|
|
362
326
|
/**
|
|
363
327
|
* Get root list ID constant
|
|
@@ -381,14 +345,13 @@ class AXTreeViewService {
|
|
|
381
345
|
/**
|
|
382
346
|
* Get all nodes in a flat array
|
|
383
347
|
*/
|
|
384
|
-
getAllNodes(nodes
|
|
348
|
+
getAllNodes(nodes) {
|
|
385
349
|
const allNodes = [];
|
|
386
350
|
const traverse = (nodeList) => {
|
|
387
351
|
for (const node of nodeList) {
|
|
388
352
|
allNodes.push(node);
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
traverse(children);
|
|
353
|
+
if (node.children) {
|
|
354
|
+
traverse(node.children);
|
|
392
355
|
}
|
|
393
356
|
}
|
|
394
357
|
};
|
|
@@ -422,70 +385,63 @@ class AXTreeViewService {
|
|
|
422
385
|
/**
|
|
423
386
|
* Get sibling nodes of a given node
|
|
424
387
|
*/
|
|
425
|
-
getSiblings(nodes, nodeId
|
|
426
|
-
const node = this.findNodeById(nodes, nodeId
|
|
388
|
+
getSiblings(nodes, nodeId) {
|
|
389
|
+
const node = this.findNodeById(nodes, nodeId);
|
|
427
390
|
if (!node) {
|
|
428
391
|
return [];
|
|
429
392
|
}
|
|
430
|
-
const parent = this.findParentNode(nodes, node
|
|
431
|
-
const siblingsArray = parent?.
|
|
432
|
-
return siblingsArray.filter((n) => n
|
|
393
|
+
const parent = this.findParentNode(nodes, node);
|
|
394
|
+
const siblingsArray = parent?.children ?? nodes;
|
|
395
|
+
return siblingsArray.filter((n) => n.id !== nodeId);
|
|
433
396
|
}
|
|
434
397
|
/**
|
|
435
398
|
* Clone a node (creates a deep copy)
|
|
436
399
|
*/
|
|
437
|
-
cloneNode(node
|
|
400
|
+
cloneNode(node) {
|
|
438
401
|
const cloned = {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
402
|
+
id: `${node.id}-clone-${Date.now()}`,
|
|
403
|
+
label: node.label,
|
|
404
|
+
icon: node.icon,
|
|
405
|
+
expanded: node.expanded,
|
|
406
|
+
selected: false, // Cloned nodes are not selected by default
|
|
407
|
+
indeterminate: false,
|
|
408
|
+
disabled: node.disabled,
|
|
409
|
+
visible: node.visible,
|
|
410
|
+
childrenCount: node.childrenCount,
|
|
411
|
+
loading: false, // Cloned nodes are not loading
|
|
412
|
+
data: node.data ? JSON.parse(JSON.stringify(node.data)) : undefined,
|
|
450
413
|
};
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
cloned
|
|
454
|
-
cloned[childrenCountField] = cloned[childrenField].length;
|
|
414
|
+
if (node.children && node.children.length > 0) {
|
|
415
|
+
cloned.children = node.children.map((child) => this.cloneNode(child));
|
|
416
|
+
cloned.childrenCount = cloned.children.length;
|
|
455
417
|
}
|
|
456
418
|
return cloned;
|
|
457
419
|
}
|
|
458
420
|
/**
|
|
459
421
|
* Validate node structure (check for required fields and circular references)
|
|
460
422
|
*/
|
|
461
|
-
validateNode(node, visitedIds = new Set()
|
|
423
|
+
validateNode(node, visitedIds = new Set()) {
|
|
462
424
|
const errors = [];
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (!nodeId) {
|
|
466
|
-
errors.push(`Node must have an ${idField}`);
|
|
425
|
+
if (!node.id) {
|
|
426
|
+
errors.push('Node must have an id');
|
|
467
427
|
}
|
|
468
|
-
if (!
|
|
469
|
-
errors.push(
|
|
428
|
+
if (!node.label) {
|
|
429
|
+
errors.push('Node must have a label');
|
|
470
430
|
}
|
|
471
|
-
if (
|
|
472
|
-
errors.push(`Circular reference detected: node ${
|
|
431
|
+
if (visitedIds.has(node.id)) {
|
|
432
|
+
errors.push(`Circular reference detected: node ${node.id} appears multiple times in the tree`);
|
|
473
433
|
}
|
|
474
|
-
|
|
475
|
-
if (children) {
|
|
434
|
+
if (node.children) {
|
|
476
435
|
const newVisited = new Set(visitedIds);
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
for (const child of children) {
|
|
481
|
-
const childValidation = this.validateNode(child, newVisited, idField, titleField, childrenField, childrenCountField);
|
|
436
|
+
newVisited.add(node.id);
|
|
437
|
+
for (const child of node.children) {
|
|
438
|
+
const childValidation = this.validateNode(child, newVisited);
|
|
482
439
|
if (!childValidation.valid) {
|
|
483
|
-
errors.push(...childValidation.errors.map((e) => `Child of ${
|
|
440
|
+
errors.push(...childValidation.errors.map((e) => `Child of ${node.id}: ${e}`));
|
|
484
441
|
}
|
|
485
442
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
errors.push(`Node ${nodeId}: ${childrenCountField} (${childrenCount}) does not match ${childrenField} array length (${children.length})`);
|
|
443
|
+
if (node.childrenCount !== undefined && node.childrenCount !== node.children.length) {
|
|
444
|
+
errors.push(`Node ${node.id}: childrenCount (${node.childrenCount}) does not match children array length (${node.children.length})`);
|
|
489
445
|
}
|
|
490
446
|
}
|
|
491
447
|
return {
|
|
@@ -493,10 +449,10 @@ class AXTreeViewService {
|
|
|
493
449
|
errors,
|
|
494
450
|
};
|
|
495
451
|
}
|
|
496
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
497
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
452
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
453
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewService }); }
|
|
498
454
|
}
|
|
499
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewService, decorators: [{
|
|
500
456
|
type: Injectable
|
|
501
457
|
}] });
|
|
502
458
|
|
|
@@ -513,8 +469,10 @@ class AXTreeViewComponent {
|
|
|
513
469
|
this.selectMode = input('multiple', ...(ngDevMode ? [{ debugName: "selectMode" }] : []));
|
|
514
470
|
/** Whether to show checkboxes for selection (only applies to multiple mode) */
|
|
515
471
|
this.showCheckbox = input(true, ...(ngDevMode ? [{ debugName: "showCheckbox" }] : []));
|
|
516
|
-
/**
|
|
517
|
-
this.
|
|
472
|
+
/** When true, selecting a parent also selects all loaded children (only for multiple mode) */
|
|
473
|
+
this.checkChildrenOnSelect = input(true, ...(ngDevMode ? [{ debugName: "checkChildrenOnSelect" }] : []));
|
|
474
|
+
/** When true, selecting a child makes parents indeterminate (only for multiple mode) */
|
|
475
|
+
this.intermediateState = input(true, ...(ngDevMode ? [{ debugName: "intermediateState" }] : []));
|
|
518
476
|
/** When true, clicking on a node toggles its selection (works for both single and multiple modes) */
|
|
519
477
|
this.checkOnClick = input(false, ...(ngDevMode ? [{ debugName: "checkOnClick" }] : []));
|
|
520
478
|
/** Drag and drop mode: 'none' (disabled), 'handler' (drag handle), 'item' (entire item) */
|
|
@@ -530,35 +488,13 @@ class AXTreeViewComponent {
|
|
|
530
488
|
/** Custom icon for collapsed nodes */
|
|
531
489
|
this.collapsedIcon = input('fa-solid fa-chevron-right', ...(ngDevMode ? [{ debugName: "collapsedIcon" }] : []));
|
|
532
490
|
/** Indent size in pixels for each level */
|
|
533
|
-
this.indentSize = input(
|
|
491
|
+
this.indentSize = input(12, ...(ngDevMode ? [{ debugName: "indentSize" }] : []));
|
|
492
|
+
/** Node height in pixels */
|
|
493
|
+
this.nodeHeight = input('normal', ...(ngDevMode ? [{ debugName: "nodeHeight" }] : []));
|
|
534
494
|
/** Visual style variant */
|
|
535
495
|
this.look = input('default', ...(ngDevMode ? [{ debugName: "look" }] : []));
|
|
536
496
|
/** Custom template for tree items */
|
|
537
|
-
this.
|
|
538
|
-
/** Field name for node ID (default: 'id') */
|
|
539
|
-
this.idField = input('id', ...(ngDevMode ? [{ debugName: "idField" }] : []));
|
|
540
|
-
/** Field name for node title (default: 'title') */
|
|
541
|
-
this.titleField = input('title', ...(ngDevMode ? [{ debugName: "titleField" }] : []));
|
|
542
|
-
/** Field name for node tooltip (default: 'tooltip') */
|
|
543
|
-
this.tooltipField = input('tooltip', ...(ngDevMode ? [{ debugName: "tooltipField" }] : []));
|
|
544
|
-
/** Field name for node icon (default: 'icon') */
|
|
545
|
-
this.iconField = input('icon', ...(ngDevMode ? [{ debugName: "iconField" }] : []));
|
|
546
|
-
/** Field name for expanded state (default: 'expanded') */
|
|
547
|
-
this.expandedField = input('expanded', ...(ngDevMode ? [{ debugName: "expandedField" }] : []));
|
|
548
|
-
/** Field name for selected state (default: 'selected') */
|
|
549
|
-
this.selectedField = input('selected', ...(ngDevMode ? [{ debugName: "selectedField" }] : []));
|
|
550
|
-
/** Field name for indeterminate state (default: 'indeterminate') */
|
|
551
|
-
this.indeterminateField = input('indeterminate', ...(ngDevMode ? [{ debugName: "indeterminateField" }] : []));
|
|
552
|
-
/** Field name for disabled state (default: 'disabled') */
|
|
553
|
-
this.disabledField = input('disabled', ...(ngDevMode ? [{ debugName: "disabledField" }] : []));
|
|
554
|
-
/** Field name for hidden state (default: 'hidden') */
|
|
555
|
-
this.hiddenField = input('hidden', ...(ngDevMode ? [{ debugName: "hiddenField" }] : []));
|
|
556
|
-
/** Field name for children array (default: 'children') */
|
|
557
|
-
this.childrenField = input('children', ...(ngDevMode ? [{ debugName: "childrenField" }] : []));
|
|
558
|
-
/** Field name for children count (default: 'childrenCount') */
|
|
559
|
-
this.childrenCountField = input('childrenCount', ...(ngDevMode ? [{ debugName: "childrenCountField" }] : []));
|
|
560
|
-
/** Field name for custom data (default: 'data') */
|
|
561
|
-
this.dataField = input('data', ...(ngDevMode ? [{ debugName: "dataField" }] : []));
|
|
497
|
+
this.itemTemplate = input(...(ngDevMode ? [undefined, { debugName: "itemTemplate" }] : []));
|
|
562
498
|
// ==================== Outputs ====================
|
|
563
499
|
/** Emitted before a drop operation - set canceled to true to prevent drop */
|
|
564
500
|
this.onBeforeDrop = output();
|
|
@@ -566,8 +502,6 @@ class AXTreeViewComponent {
|
|
|
566
502
|
this.onNodeToggle = output();
|
|
567
503
|
/** Emitted when a node is selected/deselected */
|
|
568
504
|
this.onNodeSelect = output();
|
|
569
|
-
/** Emitted when selection changes - returns all currently selected nodes */
|
|
570
|
-
this.onSelectionChange = output();
|
|
571
505
|
/** Emitted when nodes are reordered within the same parent */
|
|
572
506
|
this.onOrderChange = output();
|
|
573
507
|
/** Emitted when a node is moved to a different parent */
|
|
@@ -600,35 +534,19 @@ class AXTreeViewComponent {
|
|
|
600
534
|
this.isUpdatingFromDatasource = false;
|
|
601
535
|
/** Computed to check if datasource is a function */
|
|
602
536
|
this.isLazyDataSource = computed(() => typeof this.datasource() === 'function', ...(ngDevMode ? [{ debugName: "isLazyDataSource" }] : []));
|
|
603
|
-
/** Computed: Returns true when selection is restricted to leaf nodes only */
|
|
604
|
-
this.isLeafOnlyMode = computed(() => this.selectionBehavior() === 'leaf', ...(ngDevMode ? [{ debugName: "isLeafOnlyMode" }] : []));
|
|
605
|
-
/** Computed: Returns true when selecting a parent automatically selects all its children */
|
|
606
|
-
this.cascadesToChildren = computed(() => {
|
|
607
|
-
const behavior = this.selectionBehavior();
|
|
608
|
-
return behavior === 'nested' || behavior === 'intermediate-nested';
|
|
609
|
-
}, ...(ngDevMode ? [{ debugName: "cascadesToChildren" }] : []));
|
|
610
|
-
/** Computed: Returns true when parent nodes show indeterminate state based on children selection */
|
|
611
|
-
this.hasIntermediateState = computed(() => {
|
|
612
|
-
const behavior = this.selectionBehavior();
|
|
613
|
-
return behavior === 'intermediate' || behavior === 'intermediate-nested';
|
|
614
|
-
}, ...(ngDevMode ? [{ debugName: "hasIntermediateState" }] : []));
|
|
615
537
|
// ==================== Effects ====================
|
|
616
538
|
/** Effect to handle datasource changes */
|
|
617
|
-
this.#datasourceEffect = effect(
|
|
618
|
-
if (this.isUpdatingFromDatasource)
|
|
539
|
+
this.#datasourceEffect = effect(() => {
|
|
540
|
+
if (this.isUpdatingFromDatasource)
|
|
619
541
|
return;
|
|
620
|
-
}
|
|
621
542
|
const ds = this.datasource();
|
|
622
543
|
if (Array.isArray(ds)) {
|
|
623
544
|
this.nodes.set([...ds]);
|
|
624
545
|
}
|
|
625
546
|
else if (typeof ds === 'function') {
|
|
626
|
-
|
|
627
|
-
await this.loadRootItems(ds);
|
|
628
|
-
}
|
|
629
|
-
catch (error) {
|
|
547
|
+
this.loadRootItems(ds).catch((error) => {
|
|
630
548
|
this.handleError('Failed to load root items', error);
|
|
631
|
-
}
|
|
549
|
+
});
|
|
632
550
|
}
|
|
633
551
|
}, ...(ngDevMode ? [{ debugName: "#datasourceEffect" }] : []));
|
|
634
552
|
/** Initialize direction change listener */
|
|
@@ -638,115 +556,6 @@ class AXTreeViewComponent {
|
|
|
638
556
|
.subscribe((isRtl) => this.isRtl.set(isRtl));
|
|
639
557
|
});
|
|
640
558
|
}
|
|
641
|
-
// ==================== Node Property Helpers ====================
|
|
642
|
-
/**
|
|
643
|
-
* Get a property value from a node using the configured field name
|
|
644
|
-
*/
|
|
645
|
-
getNodeProp(node, fieldName, defaultValue) {
|
|
646
|
-
return node[fieldName] ?? defaultValue;
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Set a property value on a node using the configured field name
|
|
650
|
-
*/
|
|
651
|
-
setNodeProp(node, fieldName, value) {
|
|
652
|
-
node[fieldName] = value;
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Get node ID
|
|
656
|
-
*/
|
|
657
|
-
getNodeId(node) {
|
|
658
|
-
return this.getNodeProp(node, this.idField(), '');
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* Get node title
|
|
662
|
-
*/
|
|
663
|
-
getNodeTitle(node) {
|
|
664
|
-
return this.getNodeProp(node, this.titleField(), '');
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Get node tooltip
|
|
668
|
-
*/
|
|
669
|
-
getNodeTooltip(node) {
|
|
670
|
-
return this.getNodeProp(node, this.tooltipField(), undefined);
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Get node icon
|
|
674
|
-
*/
|
|
675
|
-
getNodeIcon(node) {
|
|
676
|
-
return this.getNodeProp(node, this.iconField(), undefined);
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* Get node expanded state
|
|
680
|
-
*/
|
|
681
|
-
getNodeExpanded(node) {
|
|
682
|
-
return this.getNodeProp(node, this.expandedField(), false);
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Set node expanded state
|
|
686
|
-
*/
|
|
687
|
-
setNodeExpanded(node, value) {
|
|
688
|
-
this.setNodeProp(node, this.expandedField(), value);
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Get node selected state
|
|
692
|
-
*/
|
|
693
|
-
getNodeSelected(node) {
|
|
694
|
-
return this.getNodeProp(node, this.selectedField(), false);
|
|
695
|
-
}
|
|
696
|
-
/**
|
|
697
|
-
* Set node selected state
|
|
698
|
-
*/
|
|
699
|
-
setNodeSelected(node, value) {
|
|
700
|
-
this.setNodeProp(node, this.selectedField(), value);
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* Get node indeterminate state
|
|
704
|
-
*/
|
|
705
|
-
getNodeIndeterminate(node) {
|
|
706
|
-
return this.getNodeProp(node, this.indeterminateField(), false);
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Set node indeterminate state
|
|
710
|
-
*/
|
|
711
|
-
setNodeIndeterminate(node, value) {
|
|
712
|
-
this.setNodeProp(node, this.indeterminateField(), value);
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* Get node disabled state
|
|
716
|
-
*/
|
|
717
|
-
getNodeDisabled(node) {
|
|
718
|
-
return this.getNodeProp(node, this.disabledField(), false);
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* Get node hidden state
|
|
722
|
-
*/
|
|
723
|
-
getNodeHidden(node) {
|
|
724
|
-
return this.getNodeProp(node, this.hiddenField(), false);
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* Get node children array
|
|
728
|
-
*/
|
|
729
|
-
getNodeChildren(node) {
|
|
730
|
-
return this.getNodeProp(node, this.childrenField(), undefined);
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Set node children array
|
|
734
|
-
*/
|
|
735
|
-
setNodeChildren(node, value) {
|
|
736
|
-
this.setNodeProp(node, this.childrenField(), value);
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* Get node children count
|
|
740
|
-
*/
|
|
741
|
-
getNodeChildrenCount(node) {
|
|
742
|
-
return this.getNodeProp(node, this.childrenCountField(), undefined);
|
|
743
|
-
}
|
|
744
|
-
/**
|
|
745
|
-
* Set node children count
|
|
746
|
-
*/
|
|
747
|
-
setNodeChildrenCount(node, value) {
|
|
748
|
-
this.setNodeProp(node, this.childrenCountField(), value);
|
|
749
|
-
}
|
|
750
559
|
// ==================== Effects ====================
|
|
751
560
|
/** Effect to handle datasource changes */
|
|
752
561
|
#datasourceEffect;
|
|
@@ -757,21 +566,21 @@ class AXTreeViewComponent {
|
|
|
757
566
|
* Expand all nodes in the tree (with lazy loading support)
|
|
758
567
|
*/
|
|
759
568
|
async expandAll() {
|
|
760
|
-
await this.treeService.setExpandedState(this.nodes(), true, this.isLazyDataSource(), (node) => this.loadNodeChildren(node)
|
|
569
|
+
await this.treeService.setExpandedState(this.nodes(), true, this.isLazyDataSource(), (node) => this.loadNodeChildren(node));
|
|
761
570
|
this.refreshNodes();
|
|
762
571
|
}
|
|
763
572
|
/**
|
|
764
573
|
* Collapse all nodes in the tree
|
|
765
574
|
*/
|
|
766
575
|
collapseAll() {
|
|
767
|
-
this.treeService.setExpandedState(this.nodes(), false, this.isLazyDataSource(), (node) => this.loadNodeChildren(node)
|
|
576
|
+
this.treeService.setExpandedState(this.nodes(), false, this.isLazyDataSource(), (node) => this.loadNodeChildren(node));
|
|
768
577
|
this.refreshNodes();
|
|
769
578
|
}
|
|
770
579
|
/**
|
|
771
580
|
* Get count of selected nodes
|
|
772
581
|
*/
|
|
773
582
|
getSelectedCount() {
|
|
774
|
-
return this.treeService.countSelected(this.nodes()
|
|
583
|
+
return this.treeService.countSelected(this.nodes());
|
|
775
584
|
}
|
|
776
585
|
/**
|
|
777
586
|
* Check if any nodes are selected
|
|
@@ -784,62 +593,36 @@ class AXTreeViewComponent {
|
|
|
784
593
|
*/
|
|
785
594
|
getSelectedNodes() {
|
|
786
595
|
const selected = [];
|
|
787
|
-
this.treeService.collectSelected(this.nodes(), selected
|
|
596
|
+
this.treeService.collectSelected(this.nodes(), selected);
|
|
788
597
|
return selected;
|
|
789
598
|
}
|
|
790
599
|
/**
|
|
791
600
|
* Delete selected nodes from the tree
|
|
792
601
|
*/
|
|
793
602
|
deleteSelected() {
|
|
794
|
-
this.treeService.removeSelected(this.nodes()
|
|
795
|
-
|
|
796
|
-
this.treeService.updateAllParentStates(this.nodes(), this.hasIntermediateState(), this.childrenField(), this.selectedField(), this.indeterminateField());
|
|
797
|
-
}
|
|
603
|
+
this.treeService.removeSelected(this.nodes());
|
|
604
|
+
this.treeService.updateAllParentStates(this.nodes(), this.intermediateState());
|
|
798
605
|
this.refreshNodes();
|
|
799
|
-
this.emitSelectionChange();
|
|
800
606
|
}
|
|
801
607
|
/**
|
|
802
608
|
* Select all nodes in the tree
|
|
803
609
|
*/
|
|
804
610
|
selectAll() {
|
|
805
|
-
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
if (this.isLeafOnlyMode()) {
|
|
809
|
-
// Only select leaf nodes
|
|
810
|
-
const selectLeafs = (nodes) => {
|
|
811
|
-
for (const node of nodes) {
|
|
812
|
-
if (this.isLeafNode(node) && !this.getNodeDisabled(node)) {
|
|
813
|
-
this.setNodeSelected(node, true);
|
|
814
|
-
this.setNodeIndeterminate(node, false);
|
|
815
|
-
}
|
|
816
|
-
const children = this.getNodeChildren(node);
|
|
817
|
-
if (children) {
|
|
818
|
-
selectLeafs(children);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
selectLeafs(this.nodes());
|
|
823
|
-
}
|
|
824
|
-
else {
|
|
825
|
-
this.treeService.setAllSelection(this.nodes(), true, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
826
|
-
}
|
|
611
|
+
this.treeService.setAllSelection(this.nodes(), true);
|
|
827
612
|
this.refreshNodes();
|
|
828
|
-
this.emitSelectionChange();
|
|
829
613
|
}
|
|
830
614
|
/**
|
|
831
615
|
* Deselect all nodes in the tree
|
|
832
616
|
*/
|
|
833
617
|
deselectAll() {
|
|
834
|
-
this.treeService.setAllSelection(this.nodes(), false
|
|
618
|
+
this.treeService.setAllSelection(this.nodes(), false);
|
|
835
619
|
this.refreshNodes();
|
|
836
|
-
this.emitSelectionChange();
|
|
837
620
|
}
|
|
838
621
|
/**
|
|
839
622
|
* Find a node by ID in the tree
|
|
840
623
|
*/
|
|
841
624
|
findNode(id) {
|
|
842
|
-
return this.treeService.findNodeById(this.nodes(), id
|
|
625
|
+
return this.treeService.findNodeById(this.nodes(), id);
|
|
843
626
|
}
|
|
844
627
|
/**
|
|
845
628
|
* Refresh the tree to trigger change detection
|
|
@@ -853,12 +636,6 @@ class AXTreeViewComponent {
|
|
|
853
636
|
isNodeLoading(nodeId) {
|
|
854
637
|
return this.loadingNodes().has(nodeId);
|
|
855
638
|
}
|
|
856
|
-
/**
|
|
857
|
-
* Get loading state for a node (internal state)
|
|
858
|
-
*/
|
|
859
|
-
getNodeLoading(node) {
|
|
860
|
-
return this.loadingNodes().has(this.getNodeId(node));
|
|
861
|
-
}
|
|
862
639
|
/**
|
|
863
640
|
* Edit/update a node's properties
|
|
864
641
|
* @param nodeId - The ID of the node to edit
|
|
@@ -873,14 +650,12 @@ class AXTreeViewComponent {
|
|
|
873
650
|
// Update node properties
|
|
874
651
|
Object.assign(node, updates);
|
|
875
652
|
// If children array is provided, ensure it exists
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
this.setNodeChildren(node, updates[childrenField]);
|
|
653
|
+
if (updates.children !== undefined) {
|
|
654
|
+
node.children = updates.children;
|
|
879
655
|
}
|
|
880
656
|
// Update childrenCount if children array is provided
|
|
881
|
-
if (updates
|
|
882
|
-
|
|
883
|
-
this.setNodeChildrenCount(node, children?.length);
|
|
657
|
+
if (updates.children !== undefined) {
|
|
658
|
+
node.childrenCount = updates.children.length;
|
|
884
659
|
}
|
|
885
660
|
this.refreshNodes();
|
|
886
661
|
return true;
|
|
@@ -898,23 +673,21 @@ class AXTreeViewComponent {
|
|
|
898
673
|
return false;
|
|
899
674
|
}
|
|
900
675
|
// Ensure children array exists
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
children = [];
|
|
904
|
-
this.setNodeChildren(parent, children);
|
|
676
|
+
if (!parent.children) {
|
|
677
|
+
parent.children = [];
|
|
905
678
|
}
|
|
906
679
|
// Insert or append child
|
|
907
|
-
if (index !== undefined && index >= 0 && index <= children.length) {
|
|
908
|
-
children.splice(index, 0, childNode);
|
|
680
|
+
if (index !== undefined && index >= 0 && index <= parent.children.length) {
|
|
681
|
+
parent.children.splice(index, 0, childNode);
|
|
909
682
|
}
|
|
910
683
|
else {
|
|
911
|
-
children.push(childNode);
|
|
684
|
+
parent.children.push(childNode);
|
|
912
685
|
}
|
|
913
686
|
// Update childrenCount
|
|
914
|
-
|
|
687
|
+
parent.childrenCount = parent.children.length;
|
|
915
688
|
// Auto-expand parent if it was collapsed
|
|
916
|
-
if (!
|
|
917
|
-
|
|
689
|
+
if (!parent.expanded) {
|
|
690
|
+
parent.expanded = true;
|
|
918
691
|
}
|
|
919
692
|
this.refreshNodes();
|
|
920
693
|
return true;
|
|
@@ -930,21 +703,19 @@ class AXTreeViewComponent {
|
|
|
930
703
|
return null;
|
|
931
704
|
}
|
|
932
705
|
// Find parent to remove from its children array
|
|
933
|
-
const parent = this.treeService.findParentNode(this.nodes(), node
|
|
934
|
-
const
|
|
935
|
-
const targetArray = parentChildren ?? this.nodes();
|
|
706
|
+
const parent = this.treeService.findParentNode(this.nodes(), node);
|
|
707
|
+
const targetArray = parent?.children ?? this.nodes();
|
|
936
708
|
// Find and remove the node
|
|
937
|
-
const index = targetArray.findIndex((n) =>
|
|
709
|
+
const index = targetArray.findIndex((n) => n.id === nodeId);
|
|
938
710
|
if (index !== -1) {
|
|
939
711
|
const removed = targetArray.splice(index, 1)[0];
|
|
940
712
|
// Update parent's childrenCount if it exists
|
|
941
713
|
if (parent) {
|
|
942
|
-
|
|
943
|
-
this.setNodeChildrenCount(parent, updatedChildren?.length ?? 0);
|
|
714
|
+
parent.childrenCount = parent.children?.length ?? 0;
|
|
944
715
|
}
|
|
945
716
|
// Update parent states if needed
|
|
946
|
-
if (this.
|
|
947
|
-
this.treeService.updateAllParentStates(this.nodes(), this.
|
|
717
|
+
if (this.intermediateState()) {
|
|
718
|
+
this.treeService.updateAllParentStates(this.nodes(), this.intermediateState());
|
|
948
719
|
}
|
|
949
720
|
this.refreshNodes();
|
|
950
721
|
return removed;
|
|
@@ -961,13 +732,13 @@ class AXTreeViewComponent {
|
|
|
961
732
|
if (!node) {
|
|
962
733
|
return;
|
|
963
734
|
}
|
|
964
|
-
const hasChildren = this.treeService.hasChildren(node
|
|
965
|
-
const canLazyLoad = this.treeService.canLazyLoad(node, this.isLazyDataSource()
|
|
735
|
+
const hasChildren = this.treeService.hasChildren(node);
|
|
736
|
+
const canLazyLoad = this.treeService.canLazyLoad(node, this.isLazyDataSource());
|
|
966
737
|
if (hasChildren || canLazyLoad) {
|
|
967
738
|
if (canLazyLoad) {
|
|
968
739
|
await this.loadNodeChildren(node);
|
|
969
740
|
}
|
|
970
|
-
|
|
741
|
+
node.expanded = true;
|
|
971
742
|
this.refreshNodes();
|
|
972
743
|
this.onNodeToggle.emit({ component: this, node, nativeEvent: new Event('expand') });
|
|
973
744
|
}
|
|
@@ -981,8 +752,8 @@ class AXTreeViewComponent {
|
|
|
981
752
|
if (!node) {
|
|
982
753
|
return;
|
|
983
754
|
}
|
|
984
|
-
if (
|
|
985
|
-
|
|
755
|
+
if (node.expanded) {
|
|
756
|
+
node.expanded = false;
|
|
986
757
|
this.refreshNodes();
|
|
987
758
|
this.onNodeToggle.emit({ component: this, node, nativeEvent: new Event('collapse') });
|
|
988
759
|
}
|
|
@@ -997,7 +768,7 @@ class AXTreeViewComponent {
|
|
|
997
768
|
if (!node) {
|
|
998
769
|
return;
|
|
999
770
|
}
|
|
1000
|
-
if (
|
|
771
|
+
if (node.expanded) {
|
|
1001
772
|
this.collapseNode(nodeId);
|
|
1002
773
|
}
|
|
1003
774
|
else {
|
|
@@ -1010,28 +781,24 @@ class AXTreeViewComponent {
|
|
|
1010
781
|
* @returns true if node was found and selected, false otherwise
|
|
1011
782
|
*/
|
|
1012
783
|
selectNode(nodeId) {
|
|
1013
|
-
if (this.selectMode() === 'none') {
|
|
1014
|
-
return false;
|
|
1015
|
-
}
|
|
1016
784
|
const node = this.findNode(nodeId);
|
|
1017
|
-
if (!node ||
|
|
785
|
+
if (!node || node.disabled) {
|
|
1018
786
|
return false;
|
|
1019
787
|
}
|
|
1020
788
|
const mode = this.selectMode();
|
|
1021
789
|
if (mode === 'single') {
|
|
1022
|
-
this.treeService.deselectAllNodes(this.nodes()
|
|
1023
|
-
|
|
1024
|
-
|
|
790
|
+
this.treeService.deselectAllNodes(this.nodes());
|
|
791
|
+
node.selected = true;
|
|
792
|
+
node.indeterminate = false;
|
|
1025
793
|
}
|
|
1026
794
|
else {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
this.treeService.selectAllChildren(children, true, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
795
|
+
node.selected = true;
|
|
796
|
+
node.indeterminate = false;
|
|
797
|
+
if (this.checkChildrenOnSelect() && node.children) {
|
|
798
|
+
this.treeService.selectAllChildren(node.children, true);
|
|
1032
799
|
}
|
|
1033
|
-
if (this.
|
|
1034
|
-
this.treeService.updateParentStates(this.nodes(), node, this.
|
|
800
|
+
if (this.intermediateState()) {
|
|
801
|
+
this.treeService.updateParentStates(this.nodes(), node, this.intermediateState());
|
|
1035
802
|
}
|
|
1036
803
|
}
|
|
1037
804
|
this.refreshNodes();
|
|
@@ -1040,7 +807,6 @@ class AXTreeViewComponent {
|
|
|
1040
807
|
node,
|
|
1041
808
|
isUserInteraction: false,
|
|
1042
809
|
});
|
|
1043
|
-
this.emitSelectionChange();
|
|
1044
810
|
return true;
|
|
1045
811
|
}
|
|
1046
812
|
/**
|
|
@@ -1053,14 +819,13 @@ class AXTreeViewComponent {
|
|
|
1053
819
|
if (!node) {
|
|
1054
820
|
return false;
|
|
1055
821
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
this.treeService.selectAllChildren(children, false, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
822
|
+
node.selected = false;
|
|
823
|
+
node.indeterminate = false;
|
|
824
|
+
if (this.checkChildrenOnSelect() && node.children) {
|
|
825
|
+
this.treeService.selectAllChildren(node.children, false);
|
|
1061
826
|
}
|
|
1062
|
-
if (this.
|
|
1063
|
-
this.treeService.updateParentStates(this.nodes(), node, this.
|
|
827
|
+
if (this.intermediateState()) {
|
|
828
|
+
this.treeService.updateParentStates(this.nodes(), node, this.intermediateState());
|
|
1064
829
|
}
|
|
1065
830
|
this.refreshNodes();
|
|
1066
831
|
this.onNodeSelect.emit({
|
|
@@ -1068,7 +833,6 @@ class AXTreeViewComponent {
|
|
|
1068
833
|
node,
|
|
1069
834
|
isUserInteraction: false,
|
|
1070
835
|
});
|
|
1071
|
-
this.emitSelectionChange();
|
|
1072
836
|
return true;
|
|
1073
837
|
}
|
|
1074
838
|
/**
|
|
@@ -1081,7 +845,7 @@ class AXTreeViewComponent {
|
|
|
1081
845
|
if (!node) {
|
|
1082
846
|
return null;
|
|
1083
847
|
}
|
|
1084
|
-
return this.treeService.findParentNode(this.nodes(), node
|
|
848
|
+
return this.treeService.findParentNode(this.nodes(), node) ?? null;
|
|
1085
849
|
}
|
|
1086
850
|
/**
|
|
1087
851
|
* Get children of a node
|
|
@@ -1093,7 +857,7 @@ class AXTreeViewComponent {
|
|
|
1093
857
|
if (!node) {
|
|
1094
858
|
return null;
|
|
1095
859
|
}
|
|
1096
|
-
return
|
|
860
|
+
return node.children ?? [];
|
|
1097
861
|
}
|
|
1098
862
|
/**
|
|
1099
863
|
* Get all root nodes
|
|
@@ -1111,9 +875,8 @@ class AXTreeViewComponent {
|
|
|
1111
875
|
const traverse = (nodes) => {
|
|
1112
876
|
for (const node of nodes) {
|
|
1113
877
|
allNodes.push(node);
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
traverse(children);
|
|
878
|
+
if (node.children) {
|
|
879
|
+
traverse(node.children);
|
|
1117
880
|
}
|
|
1118
881
|
}
|
|
1119
882
|
};
|
|
@@ -1133,8 +896,8 @@ class AXTreeViewComponent {
|
|
|
1133
896
|
}
|
|
1134
897
|
let current = node;
|
|
1135
898
|
while (current) {
|
|
1136
|
-
path.unshift(
|
|
1137
|
-
const parent = this.treeService.findParentNode(this.nodes(), current
|
|
899
|
+
path.unshift(current.id);
|
|
900
|
+
const parent = this.treeService.findParentNode(this.nodes(), current);
|
|
1138
901
|
current = parent ?? null;
|
|
1139
902
|
}
|
|
1140
903
|
return path;
|
|
@@ -1161,11 +924,10 @@ class AXTreeViewComponent {
|
|
|
1161
924
|
return false;
|
|
1162
925
|
}
|
|
1163
926
|
// Find current parent
|
|
1164
|
-
const currentParent = this.treeService.findParentNode(this.nodes(), node
|
|
1165
|
-
const
|
|
1166
|
-
const currentArray = currentParentChildren ?? this.nodes();
|
|
927
|
+
const currentParent = this.treeService.findParentNode(this.nodes(), node);
|
|
928
|
+
const currentArray = currentParent?.children ?? this.nodes();
|
|
1167
929
|
// Find and remove from current location
|
|
1168
|
-
const currentIndex = currentArray.findIndex((n) =>
|
|
930
|
+
const currentIndex = currentArray.findIndex((n) => n.id === nodeId);
|
|
1169
931
|
if (currentIndex === -1) {
|
|
1170
932
|
return false;
|
|
1171
933
|
}
|
|
@@ -1181,17 +943,15 @@ class AXTreeViewComponent {
|
|
|
1181
943
|
return false;
|
|
1182
944
|
}
|
|
1183
945
|
// Validate drop target
|
|
1184
|
-
if (!this.treeService.isValidDropTarget(movedNode, newParent
|
|
946
|
+
if (!this.treeService.isValidDropTarget(movedNode, newParent)) {
|
|
1185
947
|
// Restore node if invalid drop target
|
|
1186
948
|
currentArray.splice(currentIndex, 0, movedNode);
|
|
1187
949
|
return false;
|
|
1188
950
|
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
newParentChildren = [];
|
|
1192
|
-
this.setNodeChildren(newParent, newParentChildren);
|
|
951
|
+
if (!newParent.children) {
|
|
952
|
+
newParent.children = [];
|
|
1193
953
|
}
|
|
1194
|
-
targetArray =
|
|
954
|
+
targetArray = newParent.children;
|
|
1195
955
|
}
|
|
1196
956
|
else {
|
|
1197
957
|
targetArray = this.nodes();
|
|
@@ -1207,13 +967,11 @@ class AXTreeViewComponent {
|
|
|
1207
967
|
}
|
|
1208
968
|
// Update childrenCount
|
|
1209
969
|
if (currentParent) {
|
|
1210
|
-
|
|
1211
|
-
this.setNodeChildrenCount(currentParent, updatedChildren?.length ?? 0);
|
|
970
|
+
currentParent.childrenCount = currentParent.children?.length ?? 0;
|
|
1212
971
|
}
|
|
1213
972
|
if (newParent) {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
this.setNodeExpanded(newParent, true); // Auto-expand new parent
|
|
973
|
+
newParent.childrenCount = newParent.children?.length ?? 0;
|
|
974
|
+
newParent.expanded = true; // Auto-expand new parent
|
|
1217
975
|
}
|
|
1218
976
|
// Emit drop events
|
|
1219
977
|
this.emitDropEvents(movedNode, currentParent, newParent, currentIndex, newIndex, false);
|
|
@@ -1230,7 +988,7 @@ class AXTreeViewComponent {
|
|
|
1230
988
|
if (!node) {
|
|
1231
989
|
return null;
|
|
1232
990
|
}
|
|
1233
|
-
return this.treeService.cloneNode(node
|
|
991
|
+
return this.treeService.cloneNode(node);
|
|
1234
992
|
}
|
|
1235
993
|
/**
|
|
1236
994
|
* Focus a specific node by ID
|
|
@@ -1239,7 +997,7 @@ class AXTreeViewComponent {
|
|
|
1239
997
|
*/
|
|
1240
998
|
focusNode(nodeId) {
|
|
1241
999
|
const node = this.findNode(nodeId);
|
|
1242
|
-
if (!node ||
|
|
1000
|
+
if (!node || node.visible === false || node.disabled) {
|
|
1243
1001
|
return false;
|
|
1244
1002
|
}
|
|
1245
1003
|
this.focusNodeById(nodeId);
|
|
@@ -1253,12 +1011,11 @@ class AXTreeViewComponent {
|
|
|
1253
1011
|
const expanded = [];
|
|
1254
1012
|
const traverse = (nodes) => {
|
|
1255
1013
|
for (const node of nodes) {
|
|
1256
|
-
if (
|
|
1014
|
+
if (node.expanded) {
|
|
1257
1015
|
expanded.push(node);
|
|
1258
1016
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
traverse(children);
|
|
1017
|
+
if (node.children) {
|
|
1018
|
+
traverse(node.children);
|
|
1262
1019
|
}
|
|
1263
1020
|
}
|
|
1264
1021
|
};
|
|
@@ -1273,13 +1030,11 @@ class AXTreeViewComponent {
|
|
|
1273
1030
|
const collapsed = [];
|
|
1274
1031
|
const traverse = (nodes) => {
|
|
1275
1032
|
for (const node of nodes) {
|
|
1276
|
-
|
|
1277
|
-
const childrenCount = this.getNodeChildrenCount(node);
|
|
1278
|
-
if (!this.getNodeExpanded(node) && (children?.length || childrenCount)) {
|
|
1033
|
+
if (!node.expanded && (node.children?.length || node.childrenCount)) {
|
|
1279
1034
|
collapsed.push(node);
|
|
1280
1035
|
}
|
|
1281
|
-
if (children) {
|
|
1282
|
-
traverse(children);
|
|
1036
|
+
if (node.children) {
|
|
1037
|
+
traverse(node.children);
|
|
1283
1038
|
}
|
|
1284
1039
|
}
|
|
1285
1040
|
};
|
|
@@ -1293,7 +1048,7 @@ class AXTreeViewComponent {
|
|
|
1293
1048
|
*/
|
|
1294
1049
|
isNodeExpanded(nodeId) {
|
|
1295
1050
|
const node = this.findNode(nodeId);
|
|
1296
|
-
return node
|
|
1051
|
+
return node?.expanded ?? false;
|
|
1297
1052
|
}
|
|
1298
1053
|
/**
|
|
1299
1054
|
* Check if a node is selected
|
|
@@ -1302,7 +1057,7 @@ class AXTreeViewComponent {
|
|
|
1302
1057
|
*/
|
|
1303
1058
|
isNodeSelected(nodeId) {
|
|
1304
1059
|
const node = this.findNode(nodeId);
|
|
1305
|
-
return node
|
|
1060
|
+
return node?.selected ?? false;
|
|
1306
1061
|
}
|
|
1307
1062
|
/**
|
|
1308
1063
|
* Check if a node has children
|
|
@@ -1311,21 +1066,19 @@ class AXTreeViewComponent {
|
|
|
1311
1066
|
*/
|
|
1312
1067
|
hasChildren(nodeId) {
|
|
1313
1068
|
const node = this.findNode(nodeId);
|
|
1314
|
-
return this.treeService.hasChildren(node ?? {
|
|
1069
|
+
return this.treeService.hasChildren(node ?? { id: '', label: '' });
|
|
1315
1070
|
}
|
|
1316
1071
|
/**
|
|
1317
1072
|
* Get template context for a node
|
|
1318
1073
|
*/
|
|
1319
1074
|
getTemplateContext(node, level = 0) {
|
|
1320
|
-
const children = this.getNodeChildren(node);
|
|
1321
|
-
const childrenCount = this.getNodeChildrenCount(node);
|
|
1322
1075
|
return {
|
|
1323
1076
|
$implicit: node,
|
|
1324
1077
|
node,
|
|
1325
1078
|
level,
|
|
1326
|
-
expanded:
|
|
1327
|
-
childrenCount: childrenCount ?? children?.length ?? 0,
|
|
1328
|
-
loading:
|
|
1079
|
+
expanded: node.expanded ?? false,
|
|
1080
|
+
childrenCount: node.childrenCount ?? node.children?.length ?? 0,
|
|
1081
|
+
loading: node.loading ?? false,
|
|
1329
1082
|
};
|
|
1330
1083
|
}
|
|
1331
1084
|
/**
|
|
@@ -1341,8 +1094,7 @@ class AXTreeViewComponent {
|
|
|
1341
1094
|
* Check if node should show expand toggle
|
|
1342
1095
|
*/
|
|
1343
1096
|
shouldShowExpandToggle(node) {
|
|
1344
|
-
return
|
|
1345
|
-
this.treeService.canLazyLoad(node, this.isLazyDataSource(), this.childrenCountField(), this.childrenField()));
|
|
1097
|
+
return this.treeService.hasChildren(node) || this.treeService.canLazyLoad(node, this.isLazyDataSource());
|
|
1346
1098
|
}
|
|
1347
1099
|
/**
|
|
1348
1100
|
* Check if checkboxes should be shown (only for multiple mode)
|
|
@@ -1350,50 +1102,11 @@ class AXTreeViewComponent {
|
|
|
1350
1102
|
shouldShowCheckbox() {
|
|
1351
1103
|
return this.selectMode() === 'multiple' && this.showCheckbox();
|
|
1352
1104
|
}
|
|
1353
|
-
/**
|
|
1354
|
-
* Check if a node is a leaf (has no children)
|
|
1355
|
-
* A node is a leaf if it has no loaded children AND no childrenCount (or childrenCount is 0)
|
|
1356
|
-
*/
|
|
1357
|
-
isLeafNode(node) {
|
|
1358
|
-
const hasChildren = this.treeService.hasChildren(node, this.childrenField());
|
|
1359
|
-
const childrenCount = this.getNodeChildrenCount(node);
|
|
1360
|
-
const hasChildrenCount = childrenCount && childrenCount > 0;
|
|
1361
|
-
const canLazyLoad = this.treeService.canLazyLoad(node, this.isLazyDataSource(), this.childrenCountField(), this.childrenField());
|
|
1362
|
-
// A node is a leaf if:
|
|
1363
|
-
// 1. It has no loaded children
|
|
1364
|
-
// 2. AND it has no childrenCount (or childrenCount is 0)
|
|
1365
|
-
// 3. AND it cannot be lazy loaded
|
|
1366
|
-
return !hasChildren && !hasChildrenCount && !canLazyLoad;
|
|
1367
|
-
}
|
|
1368
|
-
/**
|
|
1369
|
-
* Check if a node can be selected (considering selectMode and isLeafOnlyMode)
|
|
1370
|
-
*/
|
|
1371
|
-
canSelectNode(node) {
|
|
1372
|
-
if (this.selectMode() === 'none') {
|
|
1373
|
-
return false;
|
|
1374
|
-
}
|
|
1375
|
-
if (this.isLeafOnlyMode()) {
|
|
1376
|
-
return this.isLeafNode(node);
|
|
1377
|
-
}
|
|
1378
|
-
return true;
|
|
1379
|
-
}
|
|
1380
|
-
/**
|
|
1381
|
-
* Check if checkbox should be shown for a specific node
|
|
1382
|
-
*/
|
|
1383
|
-
shouldShowCheckboxForNode(node) {
|
|
1384
|
-
if (!this.shouldShowCheckbox()) {
|
|
1385
|
-
return false;
|
|
1386
|
-
}
|
|
1387
|
-
if (this.isLeafOnlyMode()) {
|
|
1388
|
-
return this.isLeafNode(node);
|
|
1389
|
-
}
|
|
1390
|
-
return true;
|
|
1391
|
-
}
|
|
1392
1105
|
/**
|
|
1393
1106
|
* Generate unique list ID for each node
|
|
1394
1107
|
*/
|
|
1395
1108
|
getListId(node) {
|
|
1396
|
-
return this.treeService.getListId(node
|
|
1109
|
+
return this.treeService.getListId(node);
|
|
1397
1110
|
}
|
|
1398
1111
|
/**
|
|
1399
1112
|
* Check if a node is currently focused
|
|
@@ -1414,44 +1127,23 @@ class AXTreeViewComponent {
|
|
|
1414
1127
|
if (!this.shouldShowExpandToggle(node)) {
|
|
1415
1128
|
return null;
|
|
1416
1129
|
}
|
|
1417
|
-
return
|
|
1130
|
+
return node.expanded ? 'true' : 'false';
|
|
1418
1131
|
}
|
|
1419
1132
|
/**
|
|
1420
1133
|
* Get ARIA selected state for a node
|
|
1421
1134
|
*/
|
|
1422
1135
|
getNodeAriaSelected(node) {
|
|
1423
|
-
if (this.selectMode() === 'none') {
|
|
1424
|
-
return null;
|
|
1425
|
-
}
|
|
1426
|
-
const selected = this.getNodeSelected(node);
|
|
1427
1136
|
if (this.selectMode() === 'single') {
|
|
1428
|
-
return selected ? 'true' : 'false';
|
|
1429
|
-
}
|
|
1430
|
-
if (this.selectMode() === 'multiple') {
|
|
1431
|
-
return selected ? 'true' : 'false';
|
|
1137
|
+
return node.selected ? 'true' : 'false';
|
|
1432
1138
|
}
|
|
1433
1139
|
return null;
|
|
1434
1140
|
}
|
|
1435
|
-
/**
|
|
1436
|
-
* Emit selection change event with all selected nodes
|
|
1437
|
-
*/
|
|
1438
|
-
emitSelectionChange() {
|
|
1439
|
-
const selectedNodes = this.getSelectedNodes();
|
|
1440
|
-
this.onSelectionChange.emit({
|
|
1441
|
-
component: this,
|
|
1442
|
-
selectedNodes,
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1445
1141
|
// ==================== Event Handlers ====================
|
|
1446
1142
|
/**
|
|
1447
1143
|
* Handle node click - for single selection mode or multiple mode with checkOnClick enabled
|
|
1448
1144
|
*/
|
|
1449
1145
|
onNodeClick(node, event) {
|
|
1450
|
-
if (
|
|
1451
|
-
return;
|
|
1452
|
-
if (this.selectMode() === 'none')
|
|
1453
|
-
return;
|
|
1454
|
-
if (!this.canSelectNode(node))
|
|
1146
|
+
if (node.disabled)
|
|
1455
1147
|
return;
|
|
1456
1148
|
const mode = this.selectMode();
|
|
1457
1149
|
const shouldCheckOnClick = this.checkOnClick();
|
|
@@ -1466,19 +1158,19 @@ class AXTreeViewComponent {
|
|
|
1466
1158
|
* Toggle node expansion state with lazy loading support
|
|
1467
1159
|
*/
|
|
1468
1160
|
async toggleNode(node, event) {
|
|
1469
|
-
if (
|
|
1161
|
+
if (node.disabled)
|
|
1470
1162
|
return;
|
|
1471
1163
|
if (this.isEvent(event) && typeof event.stopPropagation === 'function') {
|
|
1472
1164
|
event.stopPropagation();
|
|
1473
1165
|
}
|
|
1474
|
-
const hasChildren = this.treeService.hasChildren(node
|
|
1475
|
-
const canLazyLoad = this.treeService.canLazyLoad(node, this.isLazyDataSource()
|
|
1166
|
+
const hasChildren = this.treeService.hasChildren(node);
|
|
1167
|
+
const canLazyLoad = this.treeService.canLazyLoad(node, this.isLazyDataSource());
|
|
1476
1168
|
if (hasChildren || canLazyLoad) {
|
|
1477
|
-
const willExpand = !
|
|
1169
|
+
const willExpand = !node.expanded;
|
|
1478
1170
|
if (willExpand && canLazyLoad) {
|
|
1479
1171
|
await this.loadNodeChildren(node);
|
|
1480
1172
|
}
|
|
1481
|
-
|
|
1173
|
+
node.expanded = willExpand;
|
|
1482
1174
|
this.refreshNodes();
|
|
1483
1175
|
this.onNodeToggle.emit({ component: this, node, nativeEvent: event });
|
|
1484
1176
|
}
|
|
@@ -1489,22 +1181,17 @@ class AXTreeViewComponent {
|
|
|
1489
1181
|
toggleSelection(node, event) {
|
|
1490
1182
|
if (!event.isUserInteraction)
|
|
1491
1183
|
return;
|
|
1492
|
-
if (this.selectMode() === 'none')
|
|
1493
|
-
return;
|
|
1494
|
-
if (!this.canSelectNode(node))
|
|
1495
|
-
return;
|
|
1496
1184
|
const mode = this.selectMode();
|
|
1497
1185
|
if (mode !== 'multiple')
|
|
1498
1186
|
return;
|
|
1499
1187
|
const newValue = event.value === null ? true : event.value;
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
this.treeService.selectAllChildren(children, newValue, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
1188
|
+
node.selected = newValue;
|
|
1189
|
+
node.indeterminate = false;
|
|
1190
|
+
if (this.checkChildrenOnSelect() && node.children) {
|
|
1191
|
+
this.treeService.selectAllChildren(node.children, newValue);
|
|
1505
1192
|
}
|
|
1506
|
-
if (this.
|
|
1507
|
-
this.treeService.updateParentStates(this.nodes(), node, this.
|
|
1193
|
+
if (this.intermediateState()) {
|
|
1194
|
+
this.treeService.updateParentStates(this.nodes(), node, this.intermediateState());
|
|
1508
1195
|
}
|
|
1509
1196
|
this.refreshNodes();
|
|
1510
1197
|
this.onNodeSelect.emit({
|
|
@@ -1512,13 +1199,12 @@ class AXTreeViewComponent {
|
|
|
1512
1199
|
node,
|
|
1513
1200
|
isUserInteraction: event.isUserInteraction,
|
|
1514
1201
|
});
|
|
1515
|
-
this.emitSelectionChange();
|
|
1516
1202
|
}
|
|
1517
1203
|
/**
|
|
1518
1204
|
* Handle drop events for tree nodes
|
|
1519
1205
|
*/
|
|
1520
1206
|
onDrop(event, parentNode) {
|
|
1521
|
-
const targetArray = parentNode
|
|
1207
|
+
const targetArray = parentNode?.children ?? this.nodes();
|
|
1522
1208
|
const isReordering = event.previousContainer === event.container;
|
|
1523
1209
|
if (isReordering) {
|
|
1524
1210
|
this.handleReorder(event, targetArray, parentNode);
|
|
@@ -1539,18 +1225,14 @@ class AXTreeViewComponent {
|
|
|
1539
1225
|
if (!sourceArray)
|
|
1540
1226
|
return;
|
|
1541
1227
|
const movedNode = sourceArray[event.previousIndex];
|
|
1542
|
-
if (!this.treeService.isValidDropTarget(movedNode, targetNode
|
|
1228
|
+
if (!this.treeService.isValidDropTarget(movedNode, targetNode))
|
|
1543
1229
|
return;
|
|
1544
1230
|
if (!this.emitBeforeDropEvent(movedNode, sourceListId, targetNode, event.previousIndex, 0))
|
|
1545
1231
|
return;
|
|
1546
|
-
|
|
1547
|
-
if (!targetChildren) {
|
|
1548
|
-
targetChildren = [];
|
|
1549
|
-
this.setNodeChildren(targetNode, targetChildren);
|
|
1550
|
-
}
|
|
1232
|
+
targetNode.children ??= [];
|
|
1551
1233
|
sourceArray.splice(event.previousIndex, 1);
|
|
1552
|
-
|
|
1553
|
-
|
|
1234
|
+
targetNode.children.unshift(movedNode);
|
|
1235
|
+
targetNode.expanded = true;
|
|
1554
1236
|
this.emitDropEvents(movedNode, this.findParentByListId(sourceListId), targetNode, event.previousIndex, 0, false);
|
|
1555
1237
|
this.refreshNodes();
|
|
1556
1238
|
}
|
|
@@ -1565,23 +1247,23 @@ class AXTreeViewComponent {
|
|
|
1565
1247
|
*/
|
|
1566
1248
|
onTreeFocus(event) {
|
|
1567
1249
|
if (event.target === event.currentTarget) {
|
|
1568
|
-
const flatList = this.treeService.buildFlatNodeList(this.nodes()
|
|
1250
|
+
const flatList = this.treeService.buildFlatNodeList(this.nodes());
|
|
1569
1251
|
if (flatList.length > 0) {
|
|
1570
1252
|
const focusedId = this.focusedNodeId();
|
|
1571
1253
|
if (focusedId) {
|
|
1572
|
-
// Check if the focused node still exists and is
|
|
1573
|
-
const focusedNode = this.treeService.findNodeById(this.nodes(), focusedId
|
|
1574
|
-
if (focusedNode &&
|
|
1254
|
+
// Check if the focused node still exists and is visible
|
|
1255
|
+
const focusedNode = this.treeService.findNodeById(this.nodes(), focusedId);
|
|
1256
|
+
if (focusedNode && focusedNode.visible !== false) {
|
|
1575
1257
|
this.focusNodeById(focusedId);
|
|
1576
1258
|
}
|
|
1577
1259
|
else {
|
|
1578
1260
|
// Focused node no longer exists, focus first node
|
|
1579
|
-
this.focusNodeById(
|
|
1261
|
+
this.focusNodeById(flatList[0].node.id);
|
|
1580
1262
|
}
|
|
1581
1263
|
}
|
|
1582
1264
|
else {
|
|
1583
1265
|
// No node is focused, focus first node
|
|
1584
|
-
this.focusNodeById(
|
|
1266
|
+
this.focusNodeById(flatList[0].node.id);
|
|
1585
1267
|
}
|
|
1586
1268
|
}
|
|
1587
1269
|
}
|
|
@@ -1598,13 +1280,11 @@ class AXTreeViewComponent {
|
|
|
1598
1280
|
* Handle keyboard navigation
|
|
1599
1281
|
*/
|
|
1600
1282
|
handleKeyDown(event) {
|
|
1601
|
-
const flatList = this.treeService.buildFlatNodeList(this.nodes()
|
|
1283
|
+
const flatList = this.treeService.buildFlatNodeList(this.nodes());
|
|
1602
1284
|
if (flatList.length === 0)
|
|
1603
1285
|
return;
|
|
1604
1286
|
const currentFocused = this.getFocusedNode();
|
|
1605
|
-
let currentIndex = currentFocused
|
|
1606
|
-
? flatList.findIndex((item) => this.getNodeId(item.node) === this.getNodeId(currentFocused))
|
|
1607
|
-
: -1;
|
|
1287
|
+
let currentIndex = currentFocused ? flatList.findIndex((item) => item.node.id === currentFocused.id) : -1;
|
|
1608
1288
|
if (currentIndex === -1 && event.target === event.currentTarget) {
|
|
1609
1289
|
currentIndex = 0;
|
|
1610
1290
|
}
|
|
@@ -1617,7 +1297,7 @@ class AXTreeViewComponent {
|
|
|
1617
1297
|
if (navigationResult.targetIndex !== null &&
|
|
1618
1298
|
navigationResult.targetIndex >= 0 &&
|
|
1619
1299
|
navigationResult.targetIndex < flatList.length) {
|
|
1620
|
-
this.focusNodeById(
|
|
1300
|
+
this.focusNodeById(flatList[navigationResult.targetIndex].node.id);
|
|
1621
1301
|
}
|
|
1622
1302
|
}
|
|
1623
1303
|
}
|
|
@@ -1640,34 +1320,32 @@ class AXTreeViewComponent {
|
|
|
1640
1320
|
* Load children for a node using lazy loading
|
|
1641
1321
|
*/
|
|
1642
1322
|
async loadNodeChildren(node) {
|
|
1643
|
-
|
|
1644
|
-
|
|
1323
|
+
if (!this.isLazyDataSource() || node.loading)
|
|
1324
|
+
return;
|
|
1325
|
+
if (this.treeService.hasChildren(node) || !node.childrenCount || node.childrenCount === 0) {
|
|
1645
1326
|
return;
|
|
1646
|
-
if (this.treeService.hasChildren(node, this.childrenField())) {
|
|
1647
|
-
const childrenCount = this.getNodeChildrenCount(node);
|
|
1648
|
-
if (!childrenCount || childrenCount === 0) {
|
|
1649
|
-
return;
|
|
1650
|
-
}
|
|
1651
1327
|
}
|
|
1652
1328
|
const ds = this.datasource();
|
|
1653
1329
|
if (typeof ds !== 'function')
|
|
1654
1330
|
return;
|
|
1655
1331
|
try {
|
|
1656
|
-
|
|
1332
|
+
node.loading = true;
|
|
1333
|
+
this.loadingNodes.update((set) => new Set(set).add(node.id));
|
|
1657
1334
|
this.refreshNodes();
|
|
1658
|
-
const result = ds(
|
|
1335
|
+
const result = ds(node.id);
|
|
1659
1336
|
const children = result instanceof Promise ? await result : result;
|
|
1660
|
-
|
|
1661
|
-
|
|
1337
|
+
node.children = children;
|
|
1338
|
+
node.childrenCount = children.length;
|
|
1662
1339
|
}
|
|
1663
1340
|
catch (error) {
|
|
1664
1341
|
this.handleError('Failed to load children', error);
|
|
1665
|
-
|
|
1342
|
+
node.childrenCount = 0;
|
|
1666
1343
|
}
|
|
1667
1344
|
finally {
|
|
1345
|
+
node.loading = false;
|
|
1668
1346
|
this.loadingNodes.update((set) => {
|
|
1669
1347
|
const newSet = new Set(set);
|
|
1670
|
-
newSet.delete(
|
|
1348
|
+
newSet.delete(node.id);
|
|
1671
1349
|
return newSet;
|
|
1672
1350
|
});
|
|
1673
1351
|
this.refreshNodes();
|
|
@@ -1697,12 +1375,11 @@ class AXTreeViewComponent {
|
|
|
1697
1375
|
*/
|
|
1698
1376
|
ensureNewArrayReferences(nodes) {
|
|
1699
1377
|
for (const node of nodes) {
|
|
1700
|
-
|
|
1701
|
-
if (children && children.length > 0) {
|
|
1378
|
+
if (node.children && node.children.length > 0) {
|
|
1702
1379
|
// Create new array reference for children
|
|
1703
|
-
|
|
1380
|
+
node.children = [...node.children];
|
|
1704
1381
|
// Recursively process nested children
|
|
1705
|
-
this.ensureNewArrayReferences(children);
|
|
1382
|
+
this.ensureNewArrayReferences(node.children);
|
|
1706
1383
|
}
|
|
1707
1384
|
}
|
|
1708
1385
|
}
|
|
@@ -1710,9 +1387,9 @@ class AXTreeViewComponent {
|
|
|
1710
1387
|
* Handle single selection mode
|
|
1711
1388
|
*/
|
|
1712
1389
|
handleSingleSelection(node, event) {
|
|
1713
|
-
this.treeService.deselectAllNodes(this.nodes()
|
|
1714
|
-
|
|
1715
|
-
|
|
1390
|
+
this.treeService.deselectAllNodes(this.nodes());
|
|
1391
|
+
node.selected = true;
|
|
1392
|
+
node.indeterminate = false;
|
|
1716
1393
|
this.refreshNodes();
|
|
1717
1394
|
this.onNodeSelect.emit({
|
|
1718
1395
|
component: this,
|
|
@@ -1720,21 +1397,19 @@ class AXTreeViewComponent {
|
|
|
1720
1397
|
nativeEvent: event,
|
|
1721
1398
|
isUserInteraction: true,
|
|
1722
1399
|
});
|
|
1723
|
-
this.emitSelectionChange();
|
|
1724
1400
|
}
|
|
1725
1401
|
/**
|
|
1726
1402
|
* Handle multiple selection mode with checkOnClick
|
|
1727
1403
|
*/
|
|
1728
1404
|
handleMultipleSelection(node, event) {
|
|
1729
|
-
const newValue = !
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
this.treeService.selectAllChildren(children, newValue, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
1405
|
+
const newValue = !node.selected;
|
|
1406
|
+
node.selected = newValue;
|
|
1407
|
+
node.indeterminate = false;
|
|
1408
|
+
if (this.checkChildrenOnSelect() && node.children) {
|
|
1409
|
+
this.treeService.selectAllChildren(node.children, newValue);
|
|
1735
1410
|
}
|
|
1736
|
-
if (this.
|
|
1737
|
-
this.treeService.updateParentStates(this.nodes(), node, this.
|
|
1411
|
+
if (this.intermediateState()) {
|
|
1412
|
+
this.treeService.updateParentStates(this.nodes(), node, this.intermediateState());
|
|
1738
1413
|
}
|
|
1739
1414
|
this.refreshNodes();
|
|
1740
1415
|
this.onNodeSelect.emit({
|
|
@@ -1743,19 +1418,18 @@ class AXTreeViewComponent {
|
|
|
1743
1418
|
nativeEvent: event,
|
|
1744
1419
|
isUserInteraction: true,
|
|
1745
1420
|
});
|
|
1746
|
-
this.emitSelectionChange();
|
|
1747
1421
|
}
|
|
1748
1422
|
/**
|
|
1749
1423
|
* Get array reference by drop list ID
|
|
1750
1424
|
*/
|
|
1751
1425
|
getArrayByListId(listId) {
|
|
1752
|
-
return this.treeService.getArrayByListId(this.nodes(), listId
|
|
1426
|
+
return this.treeService.getArrayByListId(this.nodes(), listId);
|
|
1753
1427
|
}
|
|
1754
1428
|
/**
|
|
1755
1429
|
* Find parent node by list ID
|
|
1756
1430
|
*/
|
|
1757
1431
|
findParentByListId(listId) {
|
|
1758
|
-
return this.treeService.findParentByListId(this.nodes(), listId
|
|
1432
|
+
return this.treeService.findParentByListId(this.nodes(), listId);
|
|
1759
1433
|
}
|
|
1760
1434
|
/**
|
|
1761
1435
|
* Check if move operation is allowed based on dragOperationType
|
|
@@ -1840,7 +1514,7 @@ class AXTreeViewComponent {
|
|
|
1840
1514
|
const focusedId = this.focusedNodeId();
|
|
1841
1515
|
if (!focusedId)
|
|
1842
1516
|
return null;
|
|
1843
|
-
return this.treeService.findNodeById(this.nodes(), focusedId
|
|
1517
|
+
return this.treeService.findNodeById(this.nodes(), focusedId);
|
|
1844
1518
|
}
|
|
1845
1519
|
/**
|
|
1846
1520
|
* Set focus to a node by ID
|
|
@@ -1884,14 +1558,14 @@ class AXTreeViewComponent {
|
|
|
1884
1558
|
break;
|
|
1885
1559
|
case 'ArrowLeft':
|
|
1886
1560
|
if (currentFocused) {
|
|
1887
|
-
if (
|
|
1561
|
+
if (currentFocused.expanded && this.shouldShowExpandToggle(currentFocused)) {
|
|
1888
1562
|
this.toggleNode(currentFocused, event);
|
|
1889
1563
|
return { handled: true, shouldPreventDefault: true, targetIndex: null };
|
|
1890
1564
|
}
|
|
1891
1565
|
else {
|
|
1892
1566
|
const currentItem = flatList[currentIndex];
|
|
1893
1567
|
if (currentItem?.parent) {
|
|
1894
|
-
targetIndex = flatList.findIndex((item) =>
|
|
1568
|
+
targetIndex = flatList.findIndex((item) => item.node.id === currentItem.parent.id);
|
|
1895
1569
|
}
|
|
1896
1570
|
else {
|
|
1897
1571
|
shouldPreventDefault = false;
|
|
@@ -1904,21 +1578,22 @@ class AXTreeViewComponent {
|
|
|
1904
1578
|
break;
|
|
1905
1579
|
case 'ArrowRight':
|
|
1906
1580
|
if (currentFocused) {
|
|
1907
|
-
if (!
|
|
1581
|
+
if (!currentFocused.expanded && this.shouldShowExpandToggle(currentFocused)) {
|
|
1908
1582
|
this.toggleNode(currentFocused, event);
|
|
1909
1583
|
return { handled: true, shouldPreventDefault: true, targetIndex: null };
|
|
1910
1584
|
}
|
|
1911
|
-
else if (
|
|
1912
|
-
this.treeService.hasChildren(currentFocused
|
|
1913
|
-
|
|
1914
|
-
|
|
1585
|
+
else if (currentFocused.expanded &&
|
|
1586
|
+
this.treeService.hasChildren(currentFocused) &&
|
|
1587
|
+
currentFocused.children) {
|
|
1588
|
+
const children = currentFocused.children;
|
|
1589
|
+
if (children.length > 0) {
|
|
1915
1590
|
const firstChild = children[0];
|
|
1916
|
-
targetIndex = flatList.findIndex((item) =>
|
|
1591
|
+
targetIndex = flatList.findIndex((item) => item.node.id === firstChild.id);
|
|
1917
1592
|
if (targetIndex === -1) {
|
|
1918
|
-
const updatedFlatList = this.treeService.buildFlatNodeList(this.nodes()
|
|
1919
|
-
targetIndex = updatedFlatList.findIndex((item) =>
|
|
1593
|
+
const updatedFlatList = this.treeService.buildFlatNodeList(this.nodes());
|
|
1594
|
+
targetIndex = updatedFlatList.findIndex((item) => item.node.id === firstChild.id);
|
|
1920
1595
|
if (targetIndex >= 0 && targetIndex < updatedFlatList.length) {
|
|
1921
|
-
this.focusNodeById(
|
|
1596
|
+
this.focusNodeById(updatedFlatList[targetIndex].node.id);
|
|
1922
1597
|
return { handled: true, shouldPreventDefault: true, targetIndex: null };
|
|
1923
1598
|
}
|
|
1924
1599
|
}
|
|
@@ -1943,7 +1618,7 @@ class AXTreeViewComponent {
|
|
|
1943
1618
|
break;
|
|
1944
1619
|
case ' ':
|
|
1945
1620
|
case 'Space':
|
|
1946
|
-
if (currentFocused && this.selectMode() === 'multiple'
|
|
1621
|
+
if (currentFocused && this.selectMode() === 'multiple') {
|
|
1947
1622
|
event.preventDefault();
|
|
1948
1623
|
this.handleSpaceKeySelection(currentFocused, event);
|
|
1949
1624
|
return { handled: true, shouldPreventDefault: true, targetIndex: null };
|
|
@@ -1951,7 +1626,7 @@ class AXTreeViewComponent {
|
|
|
1951
1626
|
shouldPreventDefault = false;
|
|
1952
1627
|
break;
|
|
1953
1628
|
case 'Enter':
|
|
1954
|
-
if (currentFocused
|
|
1629
|
+
if (currentFocused) {
|
|
1955
1630
|
event.preventDefault();
|
|
1956
1631
|
this.handleEnterKeySelection(currentFocused, event);
|
|
1957
1632
|
return { handled: true, shouldPreventDefault: true, targetIndex: null };
|
|
@@ -1960,7 +1635,7 @@ class AXTreeViewComponent {
|
|
|
1960
1635
|
break;
|
|
1961
1636
|
default:
|
|
1962
1637
|
if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') {
|
|
1963
|
-
if (currentFocused && this.selectMode() === 'multiple'
|
|
1638
|
+
if (currentFocused && this.selectMode() === 'multiple') {
|
|
1964
1639
|
event.preventDefault();
|
|
1965
1640
|
this.handleCtrlEnterSelection(currentFocused, event);
|
|
1966
1641
|
return { handled: true, shouldPreventDefault: true, targetIndex: null };
|
|
@@ -1976,17 +1651,14 @@ class AXTreeViewComponent {
|
|
|
1976
1651
|
* Handle Space key selection
|
|
1977
1652
|
*/
|
|
1978
1653
|
handleSpaceKeySelection(node, event) {
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
this.
|
|
1983
|
-
|
|
1984
|
-
const children = this.getNodeChildren(node);
|
|
1985
|
-
if (this.cascadesToChildren() && children && !this.isLeafOnlyMode()) {
|
|
1986
|
-
this.treeService.selectAllChildren(children, newValue, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
1654
|
+
const newValue = !node.selected;
|
|
1655
|
+
node.selected = newValue;
|
|
1656
|
+
node.indeterminate = false;
|
|
1657
|
+
if (this.checkChildrenOnSelect() && node.children) {
|
|
1658
|
+
this.treeService.selectAllChildren(node.children, newValue);
|
|
1987
1659
|
}
|
|
1988
|
-
if (this.
|
|
1989
|
-
this.treeService.updateParentStates(this.nodes(), node, this.
|
|
1660
|
+
if (this.intermediateState()) {
|
|
1661
|
+
this.treeService.updateParentStates(this.nodes(), node, this.intermediateState());
|
|
1990
1662
|
}
|
|
1991
1663
|
this.refreshNodes();
|
|
1992
1664
|
this.onNodeSelect.emit({
|
|
@@ -1995,25 +1667,21 @@ class AXTreeViewComponent {
|
|
|
1995
1667
|
nativeEvent: event,
|
|
1996
1668
|
isUserInteraction: true,
|
|
1997
1669
|
});
|
|
1998
|
-
this.emitSelectionChange();
|
|
1999
1670
|
}
|
|
2000
1671
|
/**
|
|
2001
1672
|
* Handle Enter key selection
|
|
2002
1673
|
*/
|
|
2003
1674
|
handleEnterKeySelection(node, event) {
|
|
2004
|
-
if (!this.canSelectNode(node))
|
|
2005
|
-
return;
|
|
2006
1675
|
const mode = this.selectMode();
|
|
2007
|
-
this.treeService.deselectAllNodes(this.nodes()
|
|
2008
|
-
|
|
2009
|
-
|
|
1676
|
+
this.treeService.deselectAllNodes(this.nodes());
|
|
1677
|
+
node.selected = true;
|
|
1678
|
+
node.indeterminate = false;
|
|
2010
1679
|
if (mode === 'multiple') {
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
this.treeService.selectAllChildren(children, true, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
1680
|
+
if (this.checkChildrenOnSelect() && node.children) {
|
|
1681
|
+
this.treeService.selectAllChildren(node.children, true);
|
|
2014
1682
|
}
|
|
2015
|
-
if (this.
|
|
2016
|
-
this.treeService.updateParentStates(this.nodes(), node, this.
|
|
1683
|
+
if (this.intermediateState()) {
|
|
1684
|
+
this.treeService.updateParentStates(this.nodes(), node, this.intermediateState());
|
|
2017
1685
|
}
|
|
2018
1686
|
}
|
|
2019
1687
|
this.refreshNodes();
|
|
@@ -2023,23 +1691,19 @@ class AXTreeViewComponent {
|
|
|
2023
1691
|
nativeEvent: event,
|
|
2024
1692
|
isUserInteraction: true,
|
|
2025
1693
|
});
|
|
2026
|
-
this.emitSelectionChange();
|
|
2027
1694
|
}
|
|
2028
1695
|
/**
|
|
2029
1696
|
* Handle Ctrl/Cmd + Enter key selection
|
|
2030
1697
|
*/
|
|
2031
1698
|
handleCtrlEnterSelection(node, event) {
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
this.
|
|
2036
|
-
|
|
2037
|
-
const children = this.getNodeChildren(node);
|
|
2038
|
-
if (this.cascadesToChildren() && children && !this.isLeafOnlyMode()) {
|
|
2039
|
-
this.treeService.selectAllChildren(children, newValue, this.selectedField(), this.indeterminateField(), this.childrenField());
|
|
1699
|
+
const newValue = !node.selected;
|
|
1700
|
+
node.selected = newValue;
|
|
1701
|
+
node.indeterminate = false;
|
|
1702
|
+
if (this.checkChildrenOnSelect() && node.children) {
|
|
1703
|
+
this.treeService.selectAllChildren(node.children, newValue);
|
|
2040
1704
|
}
|
|
2041
|
-
if (this.
|
|
2042
|
-
this.treeService.updateParentStates(this.nodes(), node, this.
|
|
1705
|
+
if (this.intermediateState()) {
|
|
1706
|
+
this.treeService.updateParentStates(this.nodes(), node, this.intermediateState());
|
|
2043
1707
|
}
|
|
2044
1708
|
this.refreshNodes();
|
|
2045
1709
|
this.onNodeSelect.emit({
|
|
@@ -2048,7 +1712,6 @@ class AXTreeViewComponent {
|
|
|
2048
1712
|
nativeEvent: event,
|
|
2049
1713
|
isUserInteraction: true,
|
|
2050
1714
|
});
|
|
2051
|
-
this.emitSelectionChange();
|
|
2052
1715
|
}
|
|
2053
1716
|
/**
|
|
2054
1717
|
* Type guard to check if value is an Event
|
|
@@ -2067,10 +1730,10 @@ class AXTreeViewComponent {
|
|
|
2067
1730
|
console.error(`${message}:`, error);
|
|
2068
1731
|
}
|
|
2069
1732
|
}
|
|
2070
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
2071
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: AXTreeViewComponent, isStandalone: true, selector: "ax-tree-view", inputs: { datasource: { classPropertyName: "datasource", publicName: "datasource", isSignal: true, isRequired: true, transformFunction: null }, selectMode: { classPropertyName: "selectMode", publicName: "selectMode", isSignal: true, isRequired: false, transformFunction: null }, showCheckbox: { classPropertyName: "showCheckbox", publicName: "showCheckbox", isSignal: true, isRequired: false, transformFunction: null }, selectionBehavior: { classPropertyName: "selectionBehavior", publicName: "selectionBehavior", isSignal: true, isRequired: false, transformFunction: null }, checkOnClick: { classPropertyName: "checkOnClick", publicName: "checkOnClick", isSignal: true, isRequired: false, transformFunction: null }, dragMode: { classPropertyName: "dragMode", publicName: "dragMode", isSignal: true, isRequired: false, transformFunction: null }, dragOperationType: { classPropertyName: "dragOperationType", publicName: "dragOperationType", isSignal: true, isRequired: false, transformFunction: null }, showIcons: { classPropertyName: "showIcons", publicName: "showIcons", isSignal: true, isRequired: false, transformFunction: null }, showChildrenBadge: { classPropertyName: "showChildrenBadge", publicName: "showChildrenBadge", isSignal: true, isRequired: false, transformFunction: null }, expandedIcon: { classPropertyName: "expandedIcon", publicName: "expandedIcon", isSignal: true, isRequired: false, transformFunction: null }, collapsedIcon: { classPropertyName: "collapsedIcon", publicName: "collapsedIcon", isSignal: true, isRequired: false, transformFunction: null }, indentSize: { classPropertyName: "indentSize", publicName: "indentSize", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, nodeTemplate: { classPropertyName: "nodeTemplate", publicName: "nodeTemplate", isSignal: true, isRequired: false, transformFunction: null }, idField: { classPropertyName: "idField", publicName: "idField", isSignal: true, isRequired: false, transformFunction: null }, titleField: { classPropertyName: "titleField", publicName: "titleField", isSignal: true, isRequired: false, transformFunction: null }, tooltipField: { classPropertyName: "tooltipField", publicName: "tooltipField", isSignal: true, isRequired: false, transformFunction: null }, iconField: { classPropertyName: "iconField", publicName: "iconField", isSignal: true, isRequired: false, transformFunction: null }, expandedField: { classPropertyName: "expandedField", publicName: "expandedField", isSignal: true, isRequired: false, transformFunction: null }, selectedField: { classPropertyName: "selectedField", publicName: "selectedField", isSignal: true, isRequired: false, transformFunction: null }, indeterminateField: { classPropertyName: "indeterminateField", publicName: "indeterminateField", isSignal: true, isRequired: false, transformFunction: null }, disabledField: { classPropertyName: "disabledField", publicName: "disabledField", isSignal: true, isRequired: false, transformFunction: null }, hiddenField: { classPropertyName: "hiddenField", publicName: "hiddenField", isSignal: true, isRequired: false, transformFunction: null }, childrenField: { classPropertyName: "childrenField", publicName: "childrenField", isSignal: true, isRequired: false, transformFunction: null }, childrenCountField: { classPropertyName: "childrenCountField", publicName: "childrenCountField", isSignal: true, isRequired: false, transformFunction: null }, dataField: { classPropertyName: "dataField", publicName: "dataField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { datasource: "datasourceChange", onBeforeDrop: "onBeforeDrop", onNodeToggle: "onNodeToggle", onNodeSelect: "onNodeSelect", onSelectionChange: "onSelectionChange", onOrderChange: "onOrderChange", onMoveChange: "onMoveChange", onItemsChange: "onItemsChange" }, host: { attributes: { "role": "tree", "tabindex": "0" }, listeners: { "keydown": "handleKeyDown($event)", "focus": "onTreeFocus($event)", "blur": "onTreeBlur($event)" }, properties: { "class.ax-tree-view-default": "look() === 'default'", "class.ax-tree-view-card": "look() === 'card'", "class.ax-tree-view-with-line": "look() === 'with-line'", "class.ax-tree-view-rtl": "isRtl", "style.--ax-tree-view-indent-size": "indentSize() + 'px'", "style.--ax-tree-view-line-offset": "(indentSize() / 2) + 'px'", "attr.aria-label": "\"Tree navigation\"" }, classAttribute: "ax-tree-view" }, providers: [AXTreeViewService], ngImport: i0, template: "<!-- Root drop list -->\n<div\n axFocusTrap\n [axDropList]=\"dragMode() !== 'none'\"\n [sortingDisabled]=\"false\"\n [id]=\"getListId()\"\n [attr.data-node-id]=\"null\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event)\"\n class=\"ax-tree-view-drop-list\"\n [class.ax-tree-view-card]=\"look() === 'card'\"\n [class.ax-tree-view-with-lines]=\"look() === 'with-line'\"\n role=\"group\"\n>\n @for (node of nodes(); track getNodeId(node)) {\n @if (getNodeHidden(node) !== true) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"getNodeDisabled(node)\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"getNodeSelected(node)\"\n [class.ax-tree-view-node-disabled]=\"getNodeDisabled(node)\"\n [class.ax-tree-view-node-loading]=\"getNodeLoading(node)\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(0)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"getNodeDisabled(node) || (isLeafOnlyMode() && !isLeafNode(node)) ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + getNodeId(node)\"\n [attr.data-node-id]=\"getNodeId(node)\"\n [attr.data-tree-node-id]=\"getNodeId(node)\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) && onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(getNodeId(node))\"\n [tabindex]=\"isNodeFocused(getNodeId(node)) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"getNodeExpanded(node)\"\n [disabled]=\"getNodeDisabled(node) || getNodeLoading(node)\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (getNodeLoading(node)) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"getNodeExpanded(node) ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n @if (nodeTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, 0)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckboxForNode(node)) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"getNodeIndeterminate(node) ? null : getNodeSelected(node) || false\"\n [indeterminate]=\"getNodeIndeterminate(node) || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && getNodeIcon(node)) {\n <i [class]=\"getNodeIcon(node)\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span\n class=\"ax-tree-view-node-label\"\n [axTooltip]=\"getNodeTooltip(node) || ''\"\n [axTooltipDisabled]=\"!getNodeTooltip(node)\"\n [axTooltipPlacement]=\"'top-start'\"\n >\n {{ getNodeTitle(node) }}\n </span>\n @if (\n showChildrenBadge() &&\n (getNodeChildrenCount(node) || (getNodeChildren(node) && getNodeChildren(node)!.length > 0))\n ) {\n <span class=\"ax-tree-view-node-badge\">\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(getNodeChildrenCount(node) ?? getNodeChildren(node)?.length ?? 0).toString()\"\n ></ax-badge>\n </span>\n }\n }\n </div>\n </div>\n @if (getNodeExpanded(node) && getNodeChildren(node) && getNodeChildren(node)!.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: getNodeChildren(node), parent: node, level: 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n</div>\n\n<!-- Recursive children template -->\n<ng-template #childrenList let-children=\"children\" let-parent=\"parent\" let-level=\"level\">\n <div\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"getListId(parent)\"\n [attr.data-node-id]=\"getNodeId(parent)\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event, parent)\"\n class=\"ax-tree-view-drop-list\"\n role=\"group\"\n >\n @for (node of children; track getNodeId(node)) {\n @if (getNodeHidden(node) !== true) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"getNodeDisabled(node)\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"getNodeSelected(node)\"\n [class.ax-tree-view-node-disabled]=\"getNodeDisabled(node)\"\n [class.ax-tree-view-node-loading]=\"getNodeLoading(node)\"\n [class.ax-tree-view-node-focused]=\"isNodeFocused(getNodeId(node))\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(level)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"getNodeDisabled(node) ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + getNodeId(node)\"\n [attr.data-node-id]=\"getNodeId(node)\"\n [attr.data-tree-node-id]=\"getNodeId(node)\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) &&\n onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(getNodeId(node))\"\n (blur)=\"focusedNodeId.set(null)\"\n [tabindex]=\"isNodeFocused(getNodeId(node)) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"getNodeExpanded(node)\"\n [disabled]=\"getNodeDisabled(node) || getNodeLoading(node)\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (getNodeLoading(node)) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"getNodeExpanded(node) ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n\n @if (nodeTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, level)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckboxForNode(node)) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"getNodeIndeterminate(node) ? null : getNodeSelected(node) || false\"\n [indeterminate]=\"getNodeIndeterminate(node) || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && getNodeIcon(node)) {\n <i [class]=\"getNodeIcon(node)\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span\n class=\"ax-tree-view-node-label\"\n [axTooltip]=\"getNodeTooltip(node) || ''\"\n [axTooltipDisabled]=\"!getNodeTooltip(node)\"\n [axTooltipPlacement]=\"'top-start'\"\n >\n {{ getNodeTitle(node) }}\n </span>\n @if (\n showChildrenBadge() &&\n (getNodeChildrenCount(node) || (getNodeChildren(node) && getNodeChildren(node)!.length > 0))\n ) {\n <span class=\"ax-tree-view-node-badge\">\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(getNodeChildrenCount(node) ?? getNodeChildren(node)?.length ?? 0).toString()\"\n ></ax-badge>\n </span>\n }\n }\n </div>\n </div>\n @if (getNodeExpanded(node) && getNodeChildren(node) && getNodeChildren(node)!.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: getNodeChildren(node), parent: node, level: level + 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n </div>\n</ng-template>\n", styles: [".ax-tree-view{display:block;width:100%;--ax-comp-tree-view-indent-size: 12px;--ax-comp-tree-view-node-hover-bg: rgba(var(--ax-sys-color-on-lightest-surface), .04);--ax-comp-tree-view-node-selected-bg: rgba(var(--ax-sys-color-primary-500), .12);--ax-comp-tree-view-node-border-radius: 6px;--ax-comp-tree-view-node-margin: .25rem;--ax-comp-tree-view-line-color: rgba(var(--ax-sys-color-on-lightest-surface), .15);--ax-comp-tree-view-drag-preview-opacity: .9;--ax-comp-tree-view-drag-placeholder-bg: rgba(var(--ax-sys-color-on-lightest-surface), .02);--ax-comp-tree-view-drop-active-bg: rgba(var(--ax-sys-color-primary-500), .08);--ax-comp-tree-view-drop-active-outline: rgba(var(--ax-sys-color-primary-500), .3);--ax-comp-tree-view-content-padding: 0;--ax-comp-tree-view-content-gap: .5rem;--ax-comp-tree-view-drop-list-min-height: 2rem;--ax-comp-tree-view-drag-handle-padding: .25rem;--ax-comp-tree-view-badge-padding: .25rem;--ax-comp-tree-view-expand-toggle-padding: .25rem;--ax-comp-tree-view-outline-offset: 2px;--ax-comp-tree-view-outline-offset-negative: -2px}.ax-tree-view-drop-list{min-height:var(--ax-comp-tree-view-drop-list-min-height)}.ax-tree-view-node{position:relative;margin:var(--ax-comp-tree-view-node-margin) 0;border-radius:var(--ax-comp-tree-view-node-border-radius);cursor:move}.ax-tree-view-node:hover:not(.ax-dragging){background:var(--ax-comp-tree-view-node-hover-bg)}.ax-tree-view-node.ax-tree-view-node-selected{background:var(--ax-comp-tree-view-node-selected-bg)}.ax-tree-view-node.ax-dragging{opacity:var(--ax-comp-tree-view-drag-placeholder-opacity);cursor:grabbing!important}.ax-tree-view-node.ax-drag-placeholder{background:var(--ax-comp-tree-view-drag-placeholder-bg)}.ax-drag-preview{opacity:var(--ax-comp-tree-view-drag-preview-opacity)!important;box-shadow:0 4px 12px rgba(var(--ax-sys-color-on-lightest-surface),.2)!important;cursor:grabbing!important;border:2px dashed currentColor!important}.ax-tree-view-node-content.ax-drop-list-sorting-active{background:var(--ax-comp-tree-view-drop-active-bg);border-radius:var(--ax-comp-tree-view-node-border-radius);outline:2px dashed var(--ax-comp-tree-view-drop-active-outline);outline-offset:var(--ax-comp-tree-view-outline-offset-negative)}.ax-tree-view-node-content{display:flex;align-items:center;gap:var(--ax-comp-tree-view-content-gap);padding:var(--ax-comp-tree-view-content-padding);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-node-content:focus{outline:none}.ax-tree-view-node-content:focus-visible{outline:2px solid rgba(var(--ax-sys-color-primary-500),.8);outline-offset:var(--ax-comp-tree-view-outline-offset);border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-drag-handle{cursor:grab;opacity:.6;padding:var(--ax-comp-tree-view-drag-handle-padding);padding-inline-start:calc(var(--ax-comp-tree-view-drag-handle-padding) * 2)}.ax-tree-view-drag-handle:hover{opacity:1}.ax-tree-view-drag-handle:active{cursor:grabbing}.ax-tree-view-expand-toggle{background:none;border:none;cursor:pointer;padding:var(--ax-comp-tree-view-expand-toggle-padding);min-width:1.5rem;height:1.5rem}.ax-tree-view-expand-toggle:not(.ax-tree-view-has-children){opacity:0;pointer-events:none}.ax-tree-view-toggle-icon{font-size:.75rem}.ax-tree-view-node-icon{font-size:1.125rem;flex-shrink:0}.ax-tree-view-node-label{flex:1;font-size:.875rem;line-height:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ax-tree-view-node-badge{padding:var(--ax-comp-tree-view-badge-padding);padding-inline-end:calc(var(--ax-comp-tree-view-badge-padding) * 1.5)}.ax-tree-view-children{padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-node-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.ax-tree-view-node-loading{opacity:.7}.ax-tree-view-card .ax-tree-view-node{border:1px solid rgba(var(--ax-sys-color-border-lightest-surface),1)}.ax-tree-view-card .ax-tree-view-node.ax-tree-view-node-selected{border:1px solid rgba(var(--ax-sys-color-border-surface),1)}.ax-tree-view-with-lines .ax-tree-view-children{position:relative;padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-with-lines .ax-tree-view-children:before{content:\"\";position:absolute;inset-inline-start:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));top:0;height:calc(100% - .875rem);width:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines .ax-tree-view-node{position:relative}.ax-tree-view-with-lines .ax-tree-view-node:before{content:\"\";position:absolute;inset-inline-start:calc(-1 * var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2)));top:60%;width:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));height:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines>.ax-tree-view-drop-list>.ax-tree-view-node:before,.ax-tree-view-with-lines>.ax-tree-view-node:before{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: AXDragDirective, selector: "[axDrag]", inputs: ["axDrag", "dragData", "dragDisabled", "dragTransition", "dragElementClone", "dropZoneGroup", "dragStartDelay", "dragResetOnDblClick", "dragLockAxis", "dragClonedTemplate", "dragCursor", "dragBoundary", "dragTransitionDuration"], outputs: ["dragPositionChanged"] }, { kind: "directive", type: AXDragHandleDirective, selector: "[axDragHandle]" }, { kind: "directive", type: AXDropListDirective, selector: "[axDropList]", inputs: ["axDropList", "sortingDisabled", "dropListGroup", "dropListOrientation"], outputs: ["dropListDropped"], exportAs: ["axDropList"] }, { kind: "directive", type: AXFocusTrapDirective, selector: "[axFocusTrap]" }, { kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXCheckBoxComponent, selector: "ax-check-box", inputs: ["disabled", "tabIndex", "readonly", "color", "value", "name", "id", "isLoading", "indeterminate"], outputs: ["onBlur", "onFocus", "valueChange", "onValueChanged"] }, { kind: "component", type: AXBadgeComponent, selector: "ax-badge", inputs: ["color", "look", "text"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "directive", type: AXTooltipDirective, selector: "[axTooltip]", inputs: ["axTooltipDisabled", "axTooltip", "axTooltipContext", "axTooltipPlacement", "axTooltipOffsetX", "axTooltipOffsetY", "axTooltipOpenAfter", "axTooltipCloseAfter"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1733
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1734
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: AXTreeViewComponent, isStandalone: true, selector: "ax-tree-view", inputs: { datasource: { classPropertyName: "datasource", publicName: "datasource", isSignal: true, isRequired: true, transformFunction: null }, selectMode: { classPropertyName: "selectMode", publicName: "selectMode", isSignal: true, isRequired: false, transformFunction: null }, showCheckbox: { classPropertyName: "showCheckbox", publicName: "showCheckbox", isSignal: true, isRequired: false, transformFunction: null }, checkChildrenOnSelect: { classPropertyName: "checkChildrenOnSelect", publicName: "checkChildrenOnSelect", isSignal: true, isRequired: false, transformFunction: null }, intermediateState: { classPropertyName: "intermediateState", publicName: "intermediateState", isSignal: true, isRequired: false, transformFunction: null }, checkOnClick: { classPropertyName: "checkOnClick", publicName: "checkOnClick", isSignal: true, isRequired: false, transformFunction: null }, dragMode: { classPropertyName: "dragMode", publicName: "dragMode", isSignal: true, isRequired: false, transformFunction: null }, dragOperationType: { classPropertyName: "dragOperationType", publicName: "dragOperationType", isSignal: true, isRequired: false, transformFunction: null }, showIcons: { classPropertyName: "showIcons", publicName: "showIcons", isSignal: true, isRequired: false, transformFunction: null }, showChildrenBadge: { classPropertyName: "showChildrenBadge", publicName: "showChildrenBadge", isSignal: true, isRequired: false, transformFunction: null }, expandedIcon: { classPropertyName: "expandedIcon", publicName: "expandedIcon", isSignal: true, isRequired: false, transformFunction: null }, collapsedIcon: { classPropertyName: "collapsedIcon", publicName: "collapsedIcon", isSignal: true, isRequired: false, transformFunction: null }, indentSize: { classPropertyName: "indentSize", publicName: "indentSize", isSignal: true, isRequired: false, transformFunction: null }, nodeHeight: { classPropertyName: "nodeHeight", publicName: "nodeHeight", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { datasource: "datasourceChange", onBeforeDrop: "onBeforeDrop", onNodeToggle: "onNodeToggle", onNodeSelect: "onNodeSelect", onOrderChange: "onOrderChange", onMoveChange: "onMoveChange", onItemsChange: "onItemsChange" }, host: { attributes: { "role": "tree", "tabindex": "0" }, listeners: { "keydown": "handleKeyDown($event)", "focus": "onTreeFocus($event)", "blur": "onTreeBlur($event)" }, properties: { "class.ax-tree-view-default": "look() === 'default'", "class.ax-tree-view-card": "look() === 'card'", "class.ax-tree-view-with-line": "look() === 'with-line'", "class.ax-tree-view-rtl": "isRtl", "style.--ax-tree-view-indent-size": "indentSize() + 'px'", "style.--ax-tree-view-line-offset": "(indentSize() / 2) + 'px'", "attr.aria-label": "\"Tree navigation\"" }, classAttribute: "ax-tree-view" }, providers: [AXTreeViewService], ngImport: i0, template: "<!-- Root drop list -->\n<div\n axFocusTrap\n [axDropList]=\"dragMode() !== 'none'\"\n [sortingDisabled]=\"false\"\n [id]=\"getListId()\"\n [attr.data-node-id]=\"null\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event)\"\n class=\"ax-tree-view-drop-list\"\n [class.ax-tree-view-card]=\"look() === 'card'\"\n [class.ax-tree-view-with-lines]=\"look() === 'with-line'\"\n [class.ax-tree-view-compact]=\"nodeHeight() === 'compact'\"\n [class.ax-tree-view-comfortable]=\"nodeHeight() === 'comfortable'\"\n role=\"group\"\n>\n @for (node of nodes(); track node.id) {\n @if (node.visible !== false) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"node.disabled\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"node.selected\"\n [class.ax-tree-view-node-disabled]=\"node.disabled\"\n [class.ax-tree-view-node-loading]=\"node.loading\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(0)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"node.disabled ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-tree-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) && onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(node.id)\"\n [tabindex]=\"isNodeFocused(node.id) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"node.expanded\"\n [disabled]=\"node.disabled || node.loading\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (node.loading) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, 0)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckbox()) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span class=\"ax-tree-view-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(node.childrenCount ?? node.children?.length ?? 0).toString()\"\n ></ax-badge>\n }\n }\n </div>\n </div>\n @if (node.expanded && node.children && node.children.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: node.children, parent: node, level: 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n</div>\n\n<!-- Recursive children template -->\n<ng-template #childrenList let-children=\"children\" let-parent=\"parent\" let-level=\"level\">\n <div\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"getListId(parent)\"\n [attr.data-node-id]=\"parent.id\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event, parent)\"\n class=\"ax-tree-view-drop-list\"\n role=\"group\"\n >\n @for (node of children; track node.id) {\n @if (node.visible !== false) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"node.disabled\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"node.selected\"\n [class.ax-tree-view-node-disabled]=\"node.disabled\"\n [class.ax-tree-view-node-loading]=\"node.loading\"\n [class.ax-tree-view-node-focused]=\"isNodeFocused(node.id)\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(level)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"node.disabled ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [style.padding-inline-start.px]=\"getNodePaddingInline(level)\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-tree-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) &&\n onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(node.id)\"\n (blur)=\"focusedNodeId.set(null)\"\n [tabindex]=\"isNodeFocused(node.id) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"node.expanded\"\n [disabled]=\"node.disabled || node.loading\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (node.loading) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, level)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckbox()) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span class=\"ax-tree-view-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(node.childrenCount ?? node.children?.length ?? 0).toString()\"\n ></ax-badge>\n }\n }\n </div>\n </div>\n @if (node.expanded && node.children && node.children.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: node.children, parent: node, level: level + 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n </div>\n</ng-template>\n", styles: [".ax-tree-view{display:block;width:100%;--ax-comp-tree-view-indent-size: 12px;--ax-comp-tree-view-node-hover-bg: rgba(var(--ax-sys-color-on-lightest-surface), .04);--ax-comp-tree-view-node-selected-bg: rgba(var(--ax-sys-color-primary-500), .12);--ax-comp-tree-view-node-border-radius: 6px;--ax-comp-tree-view-node-margin: .25rem;--ax-comp-tree-view-line-color: rgba(var(--ax-sys-color-on-lightest-surface), .15);--ax-comp-tree-view-drag-preview-opacity: .9;--ax-comp-tree-view-drag-placeholder-bg: rgba(var(--ax-sys-color-on-lightest-surface), .02);--ax-comp-tree-view-drop-active-bg: rgba(var(--ax-sys-color-primary-500), .08);--ax-comp-tree-view-drop-active-outline: rgba(var(--ax-sys-color-primary-500), .3);--ax-comp-tree-view-content-padding: 0;--ax-comp-tree-view-content-gap: .5rem;--ax-comp-tree-view-drop-list-min-height: 2rem;--ax-comp-tree-view-drag-handle-padding: .25rem;--ax-comp-tree-view-expand-toggle-padding: .25rem;--ax-comp-tree-view-card-node-margin: .5rem;--ax-comp-tree-view-card-content-padding: 1rem;--ax-comp-tree-view-outline-offset: 2px;--ax-comp-tree-view-outline-offset-negative: -2px}.ax-tree-view-drop-list{min-height:var(--ax-comp-tree-view-drop-list-min-height)}.ax-tree-view-compact .ax-tree-view-node-content{padding:var(--ax-comp-tree-view-content-padding, .25rem .5rem);gap:var(--ax-comp-tree-view-content-gap, .375rem);font-size:.8125rem}.ax-tree-view-comfortable .ax-tree-view-node-content{padding:var(--ax-comp-tree-view-content-padding, .75rem .625rem);gap:var(--ax-comp-tree-view-content-gap, .625rem);font-size:.9375rem}.ax-tree-view-node{position:relative;margin:var(--ax-comp-tree-view-node-margin) 0;border-radius:var(--ax-comp-tree-view-node-border-radius);border:1px solid transparent;cursor:move}.ax-tree-view-node:hover:not(.ax-dragging){background:var(--ax-comp-tree-view-node-hover-bg)}.ax-tree-view-node.ax-tree-view-node-selected{background:var(--ax-comp-tree-view-node-selected-bg);border-color:currentColor}.ax-tree-view-node.ax-dragging{opacity:var(--ax-comp-tree-view-drag-placeholder-opacity);cursor:grabbing!important}.ax-tree-view-node.ax-drag-placeholder{background:var(--ax-comp-tree-view-drag-placeholder-bg)}.ax-drag-preview{opacity:var(--ax-comp-tree-view-drag-preview-opacity)!important;box-shadow:0 4px 12px rgba(var(--ax-sys-color-on-lightest-surface),.2)!important;cursor:grabbing!important;border:2px dashed currentColor!important}.ax-tree-view-node-content.ax-drop-list-sorting-active{background:var(--ax-comp-tree-view-drop-active-bg);border-radius:var(--ax-comp-tree-view-node-border-radius);outline:2px dashed var(--ax-comp-tree-view-drop-active-outline);outline-offset:var(--ax-comp-tree-view-outline-offset-negative)}.ax-tree-view-node-content{display:flex;align-items:center;gap:var(--ax-comp-tree-view-content-gap);padding:var(--ax-comp-tree-view-content-padding);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;border:1px solid transparent;border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-node-content:focus{outline:none}.ax-tree-view-node-content:focus-visible{outline:2px solid rgba(var(--ax-sys-color-primary-500),.8);outline-offset:var(--ax-comp-tree-view-outline-offset);border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-drag-handle{cursor:grab;opacity:.6;padding:var(--ax-comp-tree-view-drag-handle-padding)}.ax-tree-view-drag-handle:hover{opacity:1}.ax-tree-view-drag-handle:active{cursor:grabbing}.ax-tree-view-expand-toggle{background:none;border:none;cursor:pointer;padding:var(--ax-comp-tree-view-expand-toggle-padding);min-width:1.5rem;height:1.5rem}.ax-tree-view-expand-toggle:not(.ax-tree-view-has-children){opacity:0;pointer-events:none}.ax-tree-view-toggle-icon{font-size:.75rem}.ax-tree-view-node-icon{font-size:1.125rem;flex-shrink:0}.ax-tree-view-node-label{flex:1;font-size:.875rem;line-height:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ax-tree-view-children{padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-node-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.ax-tree-view-node-loading{opacity:.7}.ax-tree-view-card .ax-tree-view-node{border:1px solid rgba(var(--ax-sys-color-border-lightest-surface),1);margin:var(--ax-comp-tree-view-card-node-margin) 0}.ax-tree-view-card .ax-tree-view-node-content{padding:var(--ax-comp-tree-view-card-content-padding)}.ax-tree-view-with-lines .ax-tree-view-children{position:relative;padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-with-lines .ax-tree-view-children:before{content:\"\";position:absolute;inset-inline-start:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));top:0;height:calc(100% - .875rem);width:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines .ax-tree-view-node{position:relative}.ax-tree-view-with-lines .ax-tree-view-node:before{content:\"\";position:absolute;inset-inline-start:calc(-1 * var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2)));top:60%;width:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));height:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines>.ax-tree-view-drop-list>.ax-tree-view-node:before,.ax-tree-view-with-lines>.ax-tree-view-node:before{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: AXDragDirective, selector: "[axDrag]", inputs: ["axDrag", "dragData", "dragDisabled", "dragTransition", "dragElementClone", "dropZoneGroup", "dragStartDelay", "dragResetOnDblClick", "dragLockAxis", "dragClonedTemplate", "dragCursor", "dragBoundary", "dragTransitionDuration"], outputs: ["dragPositionChanged"] }, { kind: "directive", type: AXDragHandleDirective, selector: "[axDragHandle]" }, { kind: "directive", type: AXDropListDirective, selector: "[axDropList]", inputs: ["axDropList", "sortingDisabled", "dropListGroup", "dropListOrientation"], outputs: ["dropListDropped"], exportAs: ["axDropList"] }, { kind: "directive", type: AXFocusTrapDirective, selector: "[axFocusTrap]" }, { kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXCheckBoxComponent, selector: "ax-check-box", inputs: ["disabled", "tabIndex", "readonly", "color", "value", "name", "id", "isLoading", "indeterminate"], outputs: ["onBlur", "onFocus", "valueChange", "onValueChanged"] }, { kind: "component", type: AXBadgeComponent, selector: "ax-badge", inputs: ["color", "look", "text"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2072
1735
|
}
|
|
2073
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewComponent, decorators: [{
|
|
2074
1737
|
type: Component,
|
|
2075
1738
|
args: [{ selector: 'ax-tree-view', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [AXTreeViewService], imports: [
|
|
2076
1739
|
CommonModule,
|
|
@@ -2084,7 +1747,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
2084
1747
|
AXCheckBoxComponent,
|
|
2085
1748
|
AXBadgeComponent,
|
|
2086
1749
|
AXDecoratorIconComponent,
|
|
2087
|
-
AXTooltipDirective,
|
|
2088
1750
|
], host: {
|
|
2089
1751
|
class: 'ax-tree-view',
|
|
2090
1752
|
'[class.ax-tree-view-default]': "look() === 'default'",
|
|
@@ -2099,15 +1761,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
2099
1761
|
'(focus)': 'onTreeFocus($event)',
|
|
2100
1762
|
'(blur)': 'onTreeBlur($event)',
|
|
2101
1763
|
tabindex: '0',
|
|
2102
|
-
}, template: "<!-- Root drop list -->\n<div\n axFocusTrap\n [axDropList]=\"dragMode() !== 'none'\"\n [sortingDisabled]=\"false\"\n [id]=\"getListId()\"\n [attr.data-node-id]=\"null\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event)\"\n class=\"ax-tree-view-drop-list\"\n [class.ax-tree-view-card]=\"look() === 'card'\"\n [class.ax-tree-view-with-lines]=\"look() === 'with-line'\"\n role=\"group\"\n>\n @for (node of nodes(); track getNodeId(node)) {\n @if (getNodeHidden(node) !== true) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"getNodeDisabled(node)\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"getNodeSelected(node)\"\n [class.ax-tree-view-node-disabled]=\"getNodeDisabled(node)\"\n [class.ax-tree-view-node-loading]=\"getNodeLoading(node)\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(0)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"getNodeDisabled(node) || (isLeafOnlyMode() && !isLeafNode(node)) ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + getNodeId(node)\"\n [attr.data-node-id]=\"getNodeId(node)\"\n [attr.data-tree-node-id]=\"getNodeId(node)\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) && onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(getNodeId(node))\"\n [tabindex]=\"isNodeFocused(getNodeId(node)) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"getNodeExpanded(node)\"\n [disabled]=\"getNodeDisabled(node) || getNodeLoading(node)\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (getNodeLoading(node)) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"getNodeExpanded(node) ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n @if (nodeTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, 0)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckboxForNode(node)) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"getNodeIndeterminate(node) ? null : getNodeSelected(node) || false\"\n [indeterminate]=\"getNodeIndeterminate(node) || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && getNodeIcon(node)) {\n <i [class]=\"getNodeIcon(node)\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span\n class=\"ax-tree-view-node-label\"\n [axTooltip]=\"getNodeTooltip(node) || ''\"\n [axTooltipDisabled]=\"!getNodeTooltip(node)\"\n [axTooltipPlacement]=\"'top-start'\"\n >\n {{ getNodeTitle(node) }}\n </span>\n @if (\n showChildrenBadge() &&\n (getNodeChildrenCount(node) || (getNodeChildren(node) && getNodeChildren(node)!.length > 0))\n ) {\n <span class=\"ax-tree-view-node-badge\">\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(getNodeChildrenCount(node) ?? getNodeChildren(node)?.length ?? 0).toString()\"\n ></ax-badge>\n </span>\n }\n }\n </div>\n </div>\n @if (getNodeExpanded(node) && getNodeChildren(node) && getNodeChildren(node)!.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: getNodeChildren(node), parent: node, level: 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n</div>\n\n<!-- Recursive children template -->\n<ng-template #childrenList let-children=\"children\" let-parent=\"parent\" let-level=\"level\">\n <div\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"getListId(parent)\"\n [attr.data-node-id]=\"getNodeId(parent)\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event, parent)\"\n class=\"ax-tree-view-drop-list\"\n role=\"group\"\n >\n @for (node of children; track getNodeId(node)) {\n @if (getNodeHidden(node) !== true) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"getNodeDisabled(node)\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"getNodeSelected(node)\"\n [class.ax-tree-view-node-disabled]=\"getNodeDisabled(node)\"\n [class.ax-tree-view-node-loading]=\"getNodeLoading(node)\"\n [class.ax-tree-view-node-focused]=\"isNodeFocused(getNodeId(node))\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(level)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"getNodeDisabled(node) ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + getNodeId(node)\"\n [attr.data-node-id]=\"getNodeId(node)\"\n [attr.data-tree-node-id]=\"getNodeId(node)\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) &&\n onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(getNodeId(node))\"\n (blur)=\"focusedNodeId.set(null)\"\n [tabindex]=\"isNodeFocused(getNodeId(node)) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"getNodeExpanded(node)\"\n [disabled]=\"getNodeDisabled(node) || getNodeLoading(node)\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (getNodeLoading(node)) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"getNodeExpanded(node) ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n\n @if (nodeTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, level)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckboxForNode(node)) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"getNodeIndeterminate(node) ? null : getNodeSelected(node) || false\"\n [indeterminate]=\"getNodeIndeterminate(node) || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && getNodeIcon(node)) {\n <i [class]=\"getNodeIcon(node)\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span\n class=\"ax-tree-view-node-label\"\n [axTooltip]=\"getNodeTooltip(node) || ''\"\n [axTooltipDisabled]=\"!getNodeTooltip(node)\"\n [axTooltipPlacement]=\"'top-start'\"\n >\n {{ getNodeTitle(node) }}\n </span>\n @if (\n showChildrenBadge() &&\n (getNodeChildrenCount(node) || (getNodeChildren(node) && getNodeChildren(node)!.length > 0))\n ) {\n <span class=\"ax-tree-view-node-badge\">\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(getNodeChildrenCount(node) ?? getNodeChildren(node)?.length ?? 0).toString()\"\n ></ax-badge>\n </span>\n }\n }\n </div>\n </div>\n @if (getNodeExpanded(node) && getNodeChildren(node) && getNodeChildren(node)!.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: getNodeChildren(node), parent: node, level: level + 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n </div>\n</ng-template>\n", styles: [".ax-tree-view{display:block;width:100%;--ax-comp-tree-view-indent-size: 12px;--ax-comp-tree-view-node-hover-bg: rgba(var(--ax-sys-color-on-lightest-surface), .04);--ax-comp-tree-view-node-selected-bg: rgba(var(--ax-sys-color-primary-500), .12);--ax-comp-tree-view-node-border-radius: 6px;--ax-comp-tree-view-node-margin: .25rem;--ax-comp-tree-view-line-color: rgba(var(--ax-sys-color-on-lightest-surface), .15);--ax-comp-tree-view-drag-preview-opacity: .9;--ax-comp-tree-view-drag-placeholder-bg: rgba(var(--ax-sys-color-on-lightest-surface), .02);--ax-comp-tree-view-drop-active-bg: rgba(var(--ax-sys-color-primary-500), .08);--ax-comp-tree-view-drop-active-outline: rgba(var(--ax-sys-color-primary-500), .3);--ax-comp-tree-view-content-padding: 0;--ax-comp-tree-view-content-gap: .5rem;--ax-comp-tree-view-drop-list-min-height: 2rem;--ax-comp-tree-view-drag-handle-padding: .25rem;--ax-comp-tree-view-badge-padding: .25rem;--ax-comp-tree-view-expand-toggle-padding: .25rem;--ax-comp-tree-view-outline-offset: 2px;--ax-comp-tree-view-outline-offset-negative: -2px}.ax-tree-view-drop-list{min-height:var(--ax-comp-tree-view-drop-list-min-height)}.ax-tree-view-node{position:relative;margin:var(--ax-comp-tree-view-node-margin) 0;border-radius:var(--ax-comp-tree-view-node-border-radius);cursor:move}.ax-tree-view-node:hover:not(.ax-dragging){background:var(--ax-comp-tree-view-node-hover-bg)}.ax-tree-view-node.ax-tree-view-node-selected{background:var(--ax-comp-tree-view-node-selected-bg)}.ax-tree-view-node.ax-dragging{opacity:var(--ax-comp-tree-view-drag-placeholder-opacity);cursor:grabbing!important}.ax-tree-view-node.ax-drag-placeholder{background:var(--ax-comp-tree-view-drag-placeholder-bg)}.ax-drag-preview{opacity:var(--ax-comp-tree-view-drag-preview-opacity)!important;box-shadow:0 4px 12px rgba(var(--ax-sys-color-on-lightest-surface),.2)!important;cursor:grabbing!important;border:2px dashed currentColor!important}.ax-tree-view-node-content.ax-drop-list-sorting-active{background:var(--ax-comp-tree-view-drop-active-bg);border-radius:var(--ax-comp-tree-view-node-border-radius);outline:2px dashed var(--ax-comp-tree-view-drop-active-outline);outline-offset:var(--ax-comp-tree-view-outline-offset-negative)}.ax-tree-view-node-content{display:flex;align-items:center;gap:var(--ax-comp-tree-view-content-gap);padding:var(--ax-comp-tree-view-content-padding);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-node-content:focus{outline:none}.ax-tree-view-node-content:focus-visible{outline:2px solid rgba(var(--ax-sys-color-primary-500),.8);outline-offset:var(--ax-comp-tree-view-outline-offset);border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-drag-handle{cursor:grab;opacity:.6;padding:var(--ax-comp-tree-view-drag-handle-padding);padding-inline-start:calc(var(--ax-comp-tree-view-drag-handle-padding) * 2)}.ax-tree-view-drag-handle:hover{opacity:1}.ax-tree-view-drag-handle:active{cursor:grabbing}.ax-tree-view-expand-toggle{background:none;border:none;cursor:pointer;padding:var(--ax-comp-tree-view-expand-toggle-padding);min-width:1.5rem;height:1.5rem}.ax-tree-view-expand-toggle:not(.ax-tree-view-has-children){opacity:0;pointer-events:none}.ax-tree-view-toggle-icon{font-size:.75rem}.ax-tree-view-node-icon{font-size:1.125rem;flex-shrink:0}.ax-tree-view-node-label{flex:1;font-size:.875rem;line-height:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ax-tree-view-node-badge{padding:var(--ax-comp-tree-view-badge-padding);padding-inline-end:calc(var(--ax-comp-tree-view-badge-padding) * 1.5)}.ax-tree-view-children{padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-node-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.ax-tree-view-node-loading{opacity:.7}.ax-tree-view-card .ax-tree-view-node{border:1px solid rgba(var(--ax-sys-color-border-lightest-surface),1)}.ax-tree-view-card .ax-tree-view-node.ax-tree-view-node-selected{border:1px solid rgba(var(--ax-sys-color-border-surface),1)}.ax-tree-view-with-lines .ax-tree-view-children{position:relative;padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-with-lines .ax-tree-view-children:before{content:\"\";position:absolute;inset-inline-start:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));top:0;height:calc(100% - .875rem);width:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines .ax-tree-view-node{position:relative}.ax-tree-view-with-lines .ax-tree-view-node:before{content:\"\";position:absolute;inset-inline-start:calc(-1 * var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2)));top:60%;width:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));height:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines>.ax-tree-view-drop-list>.ax-tree-view-node:before,.ax-tree-view-with-lines>.ax-tree-view-node:before{display:none}\n"] }]
|
|
2103
|
-
}], propDecorators: { datasource: [{ type: i0.Input, args: [{ isSignal: true, alias: "datasource", required: true }] }, { type: i0.Output, args: ["datasourceChange"] }], selectMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectMode", required: false }] }], showCheckbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCheckbox", required: false }] }],
|
|
1764
|
+
}, template: "<!-- Root drop list -->\n<div\n axFocusTrap\n [axDropList]=\"dragMode() !== 'none'\"\n [sortingDisabled]=\"false\"\n [id]=\"getListId()\"\n [attr.data-node-id]=\"null\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event)\"\n class=\"ax-tree-view-drop-list\"\n [class.ax-tree-view-card]=\"look() === 'card'\"\n [class.ax-tree-view-with-lines]=\"look() === 'with-line'\"\n [class.ax-tree-view-compact]=\"nodeHeight() === 'compact'\"\n [class.ax-tree-view-comfortable]=\"nodeHeight() === 'comfortable'\"\n role=\"group\"\n>\n @for (node of nodes(); track node.id) {\n @if (node.visible !== false) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"node.disabled\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"node.selected\"\n [class.ax-tree-view-node-disabled]=\"node.disabled\"\n [class.ax-tree-view-node-loading]=\"node.loading\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(0)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"node.disabled ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-tree-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) && onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(node.id)\"\n [tabindex]=\"isNodeFocused(node.id) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"node.expanded\"\n [disabled]=\"node.disabled || node.loading\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (node.loading) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, 0)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckbox()) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span class=\"ax-tree-view-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(node.childrenCount ?? node.children?.length ?? 0).toString()\"\n ></ax-badge>\n }\n }\n </div>\n </div>\n @if (node.expanded && node.children && node.children.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: node.children, parent: node, level: 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n</div>\n\n<!-- Recursive children template -->\n<ng-template #childrenList let-children=\"children\" let-parent=\"parent\" let-level=\"level\">\n <div\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"getListId(parent)\"\n [attr.data-node-id]=\"parent.id\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDrop($event, parent)\"\n class=\"ax-tree-view-drop-list\"\n role=\"group\"\n >\n @for (node of children; track node.id) {\n @if (node.visible !== false) {\n <div\n [axDrag]=\"dragMode() !== 'none'\"\n [dragDisabled]=\"node.disabled\"\n [dragData]=\"node\"\n class=\"ax-tree-view-node\"\n [class.ax-tree-view-node-selected]=\"node.selected\"\n [class.ax-tree-view-node-disabled]=\"node.disabled\"\n [class.ax-tree-view-node-loading]=\"node.loading\"\n [class.ax-tree-view-node-focused]=\"isNodeFocused(node.id)\"\n role=\"treeitem\"\n [attr.aria-level]=\"getNodeAriaLevel(level)\"\n [attr.aria-expanded]=\"getNodeAriaExpanded(node)\"\n [attr.aria-selected]=\"getNodeAriaSelected(node)\"\n [attr.aria-disabled]=\"node.disabled ? 'true' : null\"\n >\n <div\n class=\"ax-tree-view-node-content\"\n [style.padding-inline-start.px]=\"getNodePaddingInline(level)\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-view-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-tree-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-view-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n (click)=\"\n (selectMode() === 'single' || (selectMode() === 'multiple' && checkOnClick())) &&\n onNodeClick(node, $event)\n \"\n (focus)=\"onNodeFocus(node.id)\"\n (blur)=\"focusedNodeId.set(null)\"\n [tabindex]=\"isNodeFocused(node.id) ? 0 : -1\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree-view-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree-view-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree-view-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree-view-expanded]=\"node.expanded\"\n [disabled]=\"node.disabled || node.loading\"\n [style.visibility]=\"shouldShowExpandToggle(node) ? 'visible' : 'hidden'\"\n >\n @if (node.loading) {\n <ax-icon>\n <i class=\"fa-solid fa-spinner fa-spin ax-tree-view-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree-view-toggle-icon\"\n ></i>\n </ax-icon>\n }\n </ax-button>\n\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"getTemplateContext(node, level)\"\n ></ng-container>\n } @else {\n @if (shouldShowCheckbox()) {\n <ax-check-box\n class=\"ax-tree-view-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree-view-node-icon\"></i>\n }\n <span class=\"ax-tree-view-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree-view-children-badge\"\n [text]=\"(node.childrenCount ?? node.children?.length ?? 0).toString()\"\n ></ax-badge>\n }\n }\n </div>\n </div>\n @if (node.expanded && node.children && node.children.length > 0) {\n <div class=\"ax-tree-view-children\" role=\"group\">\n <ng-container\n [ngTemplateOutlet]=\"childrenList\"\n [ngTemplateOutletContext]=\"{ children: node.children, parent: node, level: level + 1 }\"\n ></ng-container>\n </div>\n }\n }\n }\n </div>\n</ng-template>\n", styles: [".ax-tree-view{display:block;width:100%;--ax-comp-tree-view-indent-size: 12px;--ax-comp-tree-view-node-hover-bg: rgba(var(--ax-sys-color-on-lightest-surface), .04);--ax-comp-tree-view-node-selected-bg: rgba(var(--ax-sys-color-primary-500), .12);--ax-comp-tree-view-node-border-radius: 6px;--ax-comp-tree-view-node-margin: .25rem;--ax-comp-tree-view-line-color: rgba(var(--ax-sys-color-on-lightest-surface), .15);--ax-comp-tree-view-drag-preview-opacity: .9;--ax-comp-tree-view-drag-placeholder-bg: rgba(var(--ax-sys-color-on-lightest-surface), .02);--ax-comp-tree-view-drop-active-bg: rgba(var(--ax-sys-color-primary-500), .08);--ax-comp-tree-view-drop-active-outline: rgba(var(--ax-sys-color-primary-500), .3);--ax-comp-tree-view-content-padding: 0;--ax-comp-tree-view-content-gap: .5rem;--ax-comp-tree-view-drop-list-min-height: 2rem;--ax-comp-tree-view-drag-handle-padding: .25rem;--ax-comp-tree-view-expand-toggle-padding: .25rem;--ax-comp-tree-view-card-node-margin: .5rem;--ax-comp-tree-view-card-content-padding: 1rem;--ax-comp-tree-view-outline-offset: 2px;--ax-comp-tree-view-outline-offset-negative: -2px}.ax-tree-view-drop-list{min-height:var(--ax-comp-tree-view-drop-list-min-height)}.ax-tree-view-compact .ax-tree-view-node-content{padding:var(--ax-comp-tree-view-content-padding, .25rem .5rem);gap:var(--ax-comp-tree-view-content-gap, .375rem);font-size:.8125rem}.ax-tree-view-comfortable .ax-tree-view-node-content{padding:var(--ax-comp-tree-view-content-padding, .75rem .625rem);gap:var(--ax-comp-tree-view-content-gap, .625rem);font-size:.9375rem}.ax-tree-view-node{position:relative;margin:var(--ax-comp-tree-view-node-margin) 0;border-radius:var(--ax-comp-tree-view-node-border-radius);border:1px solid transparent;cursor:move}.ax-tree-view-node:hover:not(.ax-dragging){background:var(--ax-comp-tree-view-node-hover-bg)}.ax-tree-view-node.ax-tree-view-node-selected{background:var(--ax-comp-tree-view-node-selected-bg);border-color:currentColor}.ax-tree-view-node.ax-dragging{opacity:var(--ax-comp-tree-view-drag-placeholder-opacity);cursor:grabbing!important}.ax-tree-view-node.ax-drag-placeholder{background:var(--ax-comp-tree-view-drag-placeholder-bg)}.ax-drag-preview{opacity:var(--ax-comp-tree-view-drag-preview-opacity)!important;box-shadow:0 4px 12px rgba(var(--ax-sys-color-on-lightest-surface),.2)!important;cursor:grabbing!important;border:2px dashed currentColor!important}.ax-tree-view-node-content.ax-drop-list-sorting-active{background:var(--ax-comp-tree-view-drop-active-bg);border-radius:var(--ax-comp-tree-view-node-border-radius);outline:2px dashed var(--ax-comp-tree-view-drop-active-outline);outline-offset:var(--ax-comp-tree-view-outline-offset-negative)}.ax-tree-view-node-content{display:flex;align-items:center;gap:var(--ax-comp-tree-view-content-gap);padding:var(--ax-comp-tree-view-content-padding);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;border:1px solid transparent;border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-node-content:focus{outline:none}.ax-tree-view-node-content:focus-visible{outline:2px solid rgba(var(--ax-sys-color-primary-500),.8);outline-offset:var(--ax-comp-tree-view-outline-offset);border-radius:var(--ax-comp-tree-view-node-border-radius)}.ax-tree-view-drag-handle{cursor:grab;opacity:.6;padding:var(--ax-comp-tree-view-drag-handle-padding)}.ax-tree-view-drag-handle:hover{opacity:1}.ax-tree-view-drag-handle:active{cursor:grabbing}.ax-tree-view-expand-toggle{background:none;border:none;cursor:pointer;padding:var(--ax-comp-tree-view-expand-toggle-padding);min-width:1.5rem;height:1.5rem}.ax-tree-view-expand-toggle:not(.ax-tree-view-has-children){opacity:0;pointer-events:none}.ax-tree-view-toggle-icon{font-size:.75rem}.ax-tree-view-node-icon{font-size:1.125rem;flex-shrink:0}.ax-tree-view-node-label{flex:1;font-size:.875rem;line-height:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ax-tree-view-children{padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-node-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.ax-tree-view-node-loading{opacity:.7}.ax-tree-view-card .ax-tree-view-node{border:1px solid rgba(var(--ax-sys-color-border-lightest-surface),1);margin:var(--ax-comp-tree-view-card-node-margin) 0}.ax-tree-view-card .ax-tree-view-node-content{padding:var(--ax-comp-tree-view-card-content-padding)}.ax-tree-view-with-lines .ax-tree-view-children{position:relative;padding-inline-start:var(--ax-tree-view-indent-size, var(--ax-comp-tree-view-indent-size))}.ax-tree-view-with-lines .ax-tree-view-children:before{content:\"\";position:absolute;inset-inline-start:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));top:0;height:calc(100% - .875rem);width:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines .ax-tree-view-node{position:relative}.ax-tree-view-with-lines .ax-tree-view-node:before{content:\"\";position:absolute;inset-inline-start:calc(-1 * var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2)));top:60%;width:var(--ax-tree-view-line-offset, calc(var(--ax-comp-tree-view-indent-size) / 2));height:1px;background:var(--ax-tree-view-line-color, var(--ax-comp-tree-view-line-color))}.ax-tree-view-with-lines>.ax-tree-view-drop-list>.ax-tree-view-node:before,.ax-tree-view-with-lines>.ax-tree-view-node:before{display:none}\n"] }]
|
|
1765
|
+
}], propDecorators: { datasource: [{ type: i0.Input, args: [{ isSignal: true, alias: "datasource", required: true }] }, { type: i0.Output, args: ["datasourceChange"] }], selectMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectMode", required: false }] }], showCheckbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCheckbox", required: false }] }], checkChildrenOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkChildrenOnSelect", required: false }] }], intermediateState: [{ type: i0.Input, args: [{ isSignal: true, alias: "intermediateState", required: false }] }], checkOnClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkOnClick", required: false }] }], dragMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragMode", required: false }] }], dragOperationType: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragOperationType", required: false }] }], showIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcons", required: false }] }], showChildrenBadge: [{ type: i0.Input, args: [{ isSignal: true, alias: "showChildrenBadge", required: false }] }], expandedIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedIcon", required: false }] }], collapsedIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsedIcon", required: false }] }], indentSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "indentSize", required: false }] }], nodeHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeHeight", required: false }] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], onBeforeDrop: [{ type: i0.Output, args: ["onBeforeDrop"] }], onNodeToggle: [{ type: i0.Output, args: ["onNodeToggle"] }], onNodeSelect: [{ type: i0.Output, args: ["onNodeSelect"] }], onOrderChange: [{ type: i0.Output, args: ["onOrderChange"] }], onMoveChange: [{ type: i0.Output, args: ["onMoveChange"] }], onItemsChange: [{ type: i0.Output, args: ["onItemsChange"] }] } });
|
|
2104
1766
|
|
|
2105
1767
|
class AXTreeViewModule {
|
|
2106
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
2107
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
2108
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
1768
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1769
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewModule, imports: [AXTreeViewComponent] }); }
|
|
1770
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewModule, imports: [AXTreeViewComponent] }); }
|
|
2109
1771
|
}
|
|
2110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1772
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AXTreeViewModule, decorators: [{
|
|
2111
1773
|
type: NgModule,
|
|
2112
1774
|
args: [{
|
|
2113
1775
|
imports: [AXTreeViewComponent],
|