@acorex/components 21.0.0-next.37 → 21.0.0-next.39
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 +1 -0
- package/button-group/index.d.ts +4 -6
- package/calendar/index.d.ts +4 -0
- package/chips/index.d.ts +8 -3
- package/dialog/index.d.ts +1 -1
- package/fesm2022/acorex-components-accordion.mjs +21 -16
- 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 +10 -11
- 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 +19 -23
- 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 +32 -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 +14 -12
- package/fesm2022/acorex-components-chips.mjs.map +1 -1
- package/fesm2022/acorex-components-circular-progress.mjs +10 -12
- 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 +186 -186
- 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 +37 -34
- 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 +36 -43
- package/fesm2022/acorex-components-decorators.mjs.map +1 -1
- package/fesm2022/acorex-components-dialog.mjs +14 -15
- 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 +16 -15
- 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 +16 -18
- 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 +32 -32
- 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 +24 -32
- package/fesm2022/acorex-components-form.mjs.map +1 -1
- package/fesm2022/acorex-components-grid-layout-builder.mjs +13 -12
- package/fesm2022/acorex-components-grid-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-components-image-editor.mjs +47 -46
- 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 +6 -8
- package/fesm2022/acorex-components-kanban.mjs.map +1 -1
- package/fesm2022/acorex-components-kbd.mjs +7 -7
- 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 +289 -31
- 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-BmmAkCKJ.mjs → acorex-components-modal-acorex-components-modal-iYSPzoLn.mjs} +22 -22
- package/fesm2022/acorex-components-modal-acorex-components-modal-iYSPzoLn.mjs.map +1 -0
- package/fesm2022/acorex-components-modal-modal-content.component-sZWKhYM-.mjs +212 -0
- package/fesm2022/acorex-components-modal-modal-content.component-sZWKhYM-.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 +23 -16
- 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 +15 -14
- 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 +39 -34
- 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 +9 -11
- 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 +36 -38
- 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 +35 -20
- 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 +10 -16
- package/fesm2022/acorex-components-search-box.mjs.map +1 -1
- package/fesm2022/acorex-components-select-box.mjs +9 -11
- 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 +511 -0
- package/fesm2022/acorex-components-tree-view-legacy.mjs.map +1 -0
- package/fesm2022/acorex-components-tree-view.mjs +2016 -405
- 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/file-explorer/index.d.ts +6 -6
- package/grid-layout-builder/index.d.ts +2 -1
- package/loading/index.d.ts +1 -1
- package/map/index.d.ts +28 -1
- package/notification/index.d.ts +2 -0
- package/number-box/index.d.ts +1 -1
- package/package.json +6 -6
- package/paint/index.d.ts +6 -1
- package/rate-picker/index.d.ts +15 -5
- package/tree-view/index.d.ts +826 -168
- package/tree-view-legacy/README.md +3 -0
- package/tree-view-legacy/index.d.ts +184 -0
- package/fesm2022/acorex-components-modal-acorex-components-modal-BmmAkCKJ.mjs.map +0 -1
- package/fesm2022/acorex-components-modal-modal-content.component-5GqTzNOs.mjs +0 -214
- package/fesm2022/acorex-components-modal-modal-content.component-5GqTzNOs.mjs.map +0 -1
- package/fesm2022/acorex-components-tree2.mjs +0 -730
- package/fesm2022/acorex-components-tree2.mjs.map +0 -1
- package/tree2/README.md +0 -3
- package/tree2/index.d.ts +0 -346
|
@@ -1,730 +0,0 @@
|
|
|
1
|
-
import { moveItemInArray, transferArrayItem, AXDragDirective, AXDragHandleDirective, AXDropListDirective } from '@acorex/cdk/drag-drop';
|
|
2
|
-
import { AXBadgeComponent } from '@acorex/components/badge';
|
|
3
|
-
import { AXButtonComponent } from '@acorex/components/button';
|
|
4
|
-
import { AXCheckBoxComponent } from '@acorex/components/check-box';
|
|
5
|
-
import { AXDecoratorIconComponent } from '@acorex/components/decorators';
|
|
6
|
-
import { AXPlatform } from '@acorex/core/platform';
|
|
7
|
-
import * as i1 from '@angular/common';
|
|
8
|
-
import { CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
9
|
-
import * as i0 from '@angular/core';
|
|
10
|
-
import { inject, DestroyRef, model, input, signal, output, computed, effect, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
11
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
|
-
import * as i2 from '@angular/forms';
|
|
13
|
-
import { FormsModule } from '@angular/forms';
|
|
14
|
-
import { map } from 'rxjs/operators';
|
|
15
|
-
|
|
16
|
-
class AXTree2Component {
|
|
17
|
-
constructor() {
|
|
18
|
-
// Constants for list ID generation
|
|
19
|
-
this.ROOT_LIST_ID = 'ax-tree-root-list';
|
|
20
|
-
this.NODE_DROP_PREFIX = 'ax-tree-node-drop-';
|
|
21
|
-
this.LIST_PREFIX = 'ax-tree-list-';
|
|
22
|
-
/** Platform service for RTL detection */
|
|
23
|
-
this.platformService = inject(AXPlatform);
|
|
24
|
-
/** DestroyRef for cleanup */
|
|
25
|
-
this.destroyRef = inject(DestroyRef);
|
|
26
|
-
/** Tree data nodes */
|
|
27
|
-
this.nodes = model.required(...(ngDevMode ? [{ debugName: "nodes" }] : []));
|
|
28
|
-
/** Whether to show checkboxes for selection */
|
|
29
|
-
this.showCheckbox = input(true, ...(ngDevMode ? [{ debugName: "showCheckbox" }] : []));
|
|
30
|
-
/** Drag and drop mode: 'none' (disabled), 'handler' (drag handle), 'item' (entire item) */
|
|
31
|
-
this.dragMode = input('handler', ...(ngDevMode ? [{ debugName: "dragMode" }] : []));
|
|
32
|
-
/** Drag operation type: 'order-only' (reorder only), 'move' (move between parents), 'both' (allow both) */
|
|
33
|
-
this.dragOperationType = input('both', ...(ngDevMode ? [{ debugName: "dragOperationType" }] : []));
|
|
34
|
-
/** Whether to show icons */
|
|
35
|
-
this.showIcons = input(true, ...(ngDevMode ? [{ debugName: "showIcons" }] : []));
|
|
36
|
-
/** Whether to show children count badge */
|
|
37
|
-
this.showChildrenBadge = input(true, ...(ngDevMode ? [{ debugName: "showChildrenBadge" }] : []));
|
|
38
|
-
/** Custom icon for expanded nodes */
|
|
39
|
-
this.expandedIcon = input('fa-solid fa-chevron-down', ...(ngDevMode ? [{ debugName: "expandedIcon" }] : []));
|
|
40
|
-
/** Custom icon for collapsed nodes */
|
|
41
|
-
this.collapsedIcon = input('fa-solid fa-chevron-right', ...(ngDevMode ? [{ debugName: "collapsedIcon" }] : []));
|
|
42
|
-
/** RTL detection signal */
|
|
43
|
-
this.isRtl = signal(this.platformService.isRtl(), ...(ngDevMode ? [{ debugName: "isRtl" }] : []));
|
|
44
|
-
/** Indent size in pixels for each level */
|
|
45
|
-
this.indentSize = input(12, ...(ngDevMode ? [{ debugName: "indentSize" }] : []));
|
|
46
|
-
/** Node height in pixels */
|
|
47
|
-
this.nodeHeight = input('normal', ...(ngDevMode ? [{ debugName: "nodeHeight" }] : []));
|
|
48
|
-
/** Visual style variant */
|
|
49
|
-
this.look = input('default', ...(ngDevMode ? [{ debugName: "look" }] : []));
|
|
50
|
-
/** Custom template for tree items */
|
|
51
|
-
this.itemTemplate = input(...(ngDevMode ? [undefined, { debugName: "itemTemplate" }] : []));
|
|
52
|
-
/** Lazy load function for fetching children */
|
|
53
|
-
this.lazyLoad = input(...(ngDevMode ? [undefined, { debugName: "lazyLoad" }] : []));
|
|
54
|
-
/** Whether to enable lazy loading */
|
|
55
|
-
this.enableLazyLoad = input(false, ...(ngDevMode ? [{ debugName: "enableLazyLoad" }] : []));
|
|
56
|
-
/** Emitted before a drop operation - set canceled to true to prevent drop */
|
|
57
|
-
this.onBeforeDrop = output();
|
|
58
|
-
/** Emitted when a node is toggled (expanded/collapsed) */
|
|
59
|
-
this.onNodeToggle = output();
|
|
60
|
-
/** Emitted when a node is selected/deselected */
|
|
61
|
-
this.onNodeSelect = output();
|
|
62
|
-
/** Emitted when nodes are reordered within the same parent */
|
|
63
|
-
this.onOrderChange = output();
|
|
64
|
-
/** Emitted when a node is moved to a different parent */
|
|
65
|
-
this.onMoveChange = output();
|
|
66
|
-
/** Emitted for any item change (order or move) */
|
|
67
|
-
this.onItemsChange = output();
|
|
68
|
-
/** Internal signal for tracking loading state */
|
|
69
|
-
this.loadingNodes = signal(new Set(), ...(ngDevMode ? [{ debugName: "loadingNodes" }] : []));
|
|
70
|
-
/** Computed chevron icons that flip for RTL */
|
|
71
|
-
this.directionExpandedIcon = computed(() => {
|
|
72
|
-
const direction = this.isRtl();
|
|
73
|
-
const defaultIcon = this.expandedIcon();
|
|
74
|
-
// For RTL, if using default chevron icons, flip them
|
|
75
|
-
if (direction && defaultIcon === 'fa-solid fa-chevron-down') {
|
|
76
|
-
return 'fa-solid fa-chevron-down'; // Down stays down
|
|
77
|
-
}
|
|
78
|
-
return defaultIcon;
|
|
79
|
-
}, ...(ngDevMode ? [{ debugName: "directionExpandedIcon" }] : []));
|
|
80
|
-
this.directionCollapsedIcon = computed(() => {
|
|
81
|
-
const direction = this.isRtl();
|
|
82
|
-
const defaultIcon = this.collapsedIcon();
|
|
83
|
-
// For RTL, flip chevron-right to chevron-left
|
|
84
|
-
if (direction && defaultIcon === 'fa-solid fa-chevron-right') {
|
|
85
|
-
return 'fa-solid fa-chevron-left';
|
|
86
|
-
}
|
|
87
|
-
// For LTR, flip chevron-left to chevron-right
|
|
88
|
-
if (!direction && defaultIcon === 'fa-solid fa-chevron-left') {
|
|
89
|
-
return 'fa-solid fa-chevron-right';
|
|
90
|
-
}
|
|
91
|
-
return defaultIcon;
|
|
92
|
-
}, ...(ngDevMode ? [{ debugName: "directionCollapsedIcon" }] : []));
|
|
93
|
-
/** Effect to handle lazy load function changes */
|
|
94
|
-
this.#lazyLoadEffect = effect(() => {
|
|
95
|
-
const lazyLoadFn = this.lazyLoad();
|
|
96
|
-
const enabled = this.enableLazyLoad();
|
|
97
|
-
if (lazyLoadFn && enabled) {
|
|
98
|
-
// Initialize lazy loading state
|
|
99
|
-
this.updateHasChildrenFlags(this.nodes());
|
|
100
|
-
}
|
|
101
|
-
}, ...(ngDevMode ? [{ debugName: "#lazyLoadEffect" }] : []));
|
|
102
|
-
/** Initialize direction change listener */
|
|
103
|
-
this.#initDirectionListener = afterNextRender(() => {
|
|
104
|
-
this.platformService.directionChange
|
|
105
|
-
.pipe(map((event) => event.data === 'rtl'), takeUntilDestroyed(this.destroyRef))
|
|
106
|
-
.subscribe((isRtl) => this.isRtl.set(isRtl));
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/** Effect to handle lazy load function changes */
|
|
110
|
-
#lazyLoadEffect;
|
|
111
|
-
/** Initialize direction change listener */
|
|
112
|
-
#initDirectionListener;
|
|
113
|
-
/**
|
|
114
|
-
* Toggle node expansion state with lazy loading support
|
|
115
|
-
*/
|
|
116
|
-
async toggleNode(node, event) {
|
|
117
|
-
if (node.disabled)
|
|
118
|
-
return;
|
|
119
|
-
const hasChildren = this.hasChildren(node);
|
|
120
|
-
const canLazyLoad = this.canLazyLoad(node);
|
|
121
|
-
if (hasChildren || canLazyLoad) {
|
|
122
|
-
const willExpand = !node.expanded;
|
|
123
|
-
if (willExpand && canLazyLoad) {
|
|
124
|
-
// Lazy load children before expanding
|
|
125
|
-
await this.loadNodeChildren(node);
|
|
126
|
-
}
|
|
127
|
-
node.expanded = willExpand;
|
|
128
|
-
this.nodes.set([...this.nodes()]);
|
|
129
|
-
this.onNodeToggle.emit({ component: this, node, nativeEvent: event });
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Load children for a node using lazy loading
|
|
134
|
-
*/
|
|
135
|
-
async loadNodeChildren(node) {
|
|
136
|
-
const lazyLoadFn = this.lazyLoad();
|
|
137
|
-
if (!lazyLoadFn || node.loading)
|
|
138
|
-
return;
|
|
139
|
-
try {
|
|
140
|
-
node.loading = true;
|
|
141
|
-
this.loadingNodes.update((set) => new Set(set).add(node.id));
|
|
142
|
-
this.nodes.set([...this.nodes()]);
|
|
143
|
-
const children = await lazyLoadFn(node);
|
|
144
|
-
node.children = children;
|
|
145
|
-
node.childrenCount = children.length;
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
console.error('Failed to load children:', error);
|
|
149
|
-
node.childrenCount = 0;
|
|
150
|
-
}
|
|
151
|
-
finally {
|
|
152
|
-
node.loading = false;
|
|
153
|
-
this.loadingNodes.update((set) => {
|
|
154
|
-
const newSet = new Set(set);
|
|
155
|
-
newSet.delete(node.id);
|
|
156
|
-
return newSet;
|
|
157
|
-
});
|
|
158
|
-
this.nodes.set([...this.nodes()]);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Update childrenCount flags for lazy loading
|
|
163
|
-
*/
|
|
164
|
-
updateHasChildrenFlags(nodes) {
|
|
165
|
-
nodes.forEach((node) => {
|
|
166
|
-
if (node.childrenCount === undefined && !node.children) {
|
|
167
|
-
node.childrenCount = 0;
|
|
168
|
-
}
|
|
169
|
-
if (node.children) {
|
|
170
|
-
this.updateHasChildrenFlags(node.children);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Toggle node selection state with indeterminate support
|
|
176
|
-
*/
|
|
177
|
-
toggleSelection(node, event) {
|
|
178
|
-
// CRITICAL: Only process if this is a real user interaction
|
|
179
|
-
// Prevents cascade when parent state changes trigger checkbox ngModelChange
|
|
180
|
-
if (!event.isUserInteraction) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
// Handle null value (indeterminate state clicked) - treat as select
|
|
184
|
-
const newValue = event.value === null ? true : event.value;
|
|
185
|
-
node.selected = newValue;
|
|
186
|
-
node.indeterminate = false; // Clear indeterminate when explicitly toggled
|
|
187
|
-
// Select/deselect all children recursively
|
|
188
|
-
if (node.children) {
|
|
189
|
-
this.selectAllChildren(node.children, newValue);
|
|
190
|
-
}
|
|
191
|
-
// Update parent states up the tree
|
|
192
|
-
this.updateParentStates(this.nodes(), node);
|
|
193
|
-
this.nodes.set([...this.nodes()]);
|
|
194
|
-
this.onNodeSelect.emit({
|
|
195
|
-
component: this,
|
|
196
|
-
node,
|
|
197
|
-
isUserInteraction: event.isUserInteraction,
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Recursively select/deselect all children
|
|
202
|
-
*/
|
|
203
|
-
selectAllChildren(children, selected) {
|
|
204
|
-
children.forEach((child) => {
|
|
205
|
-
child.selected = selected;
|
|
206
|
-
child.indeterminate = false;
|
|
207
|
-
if (child.children) {
|
|
208
|
-
this.selectAllChildren(child.children, selected);
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Update parent node states based on children selection
|
|
214
|
-
*/
|
|
215
|
-
updateParentStates(nodes, changedNode) {
|
|
216
|
-
const parent = this.findParentNode(nodes, changedNode);
|
|
217
|
-
if (!parent || !parent.children)
|
|
218
|
-
return;
|
|
219
|
-
const { allSelected, someSelected } = this.getChildrenSelectionState(parent.children);
|
|
220
|
-
if (allSelected) {
|
|
221
|
-
// All children selected → parent is selected
|
|
222
|
-
parent.selected = true;
|
|
223
|
-
parent.indeterminate = false;
|
|
224
|
-
}
|
|
225
|
-
else if (someSelected) {
|
|
226
|
-
// Some children selected → parent is indeterminate
|
|
227
|
-
// Keep selected=true to maintain consistent state and prevent issues with deleteSelected()
|
|
228
|
-
parent.selected = true;
|
|
229
|
-
parent.indeterminate = true;
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
// No children selected → parent is unselected
|
|
233
|
-
parent.selected = false;
|
|
234
|
-
parent.indeterminate = false;
|
|
235
|
-
}
|
|
236
|
-
// Recursively update grandparents
|
|
237
|
-
this.updateParentStates(nodes, parent);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Get selection state of children
|
|
241
|
-
*/
|
|
242
|
-
getChildrenSelectionState(children) {
|
|
243
|
-
let selectedCount = 0;
|
|
244
|
-
let indeterminateCount = 0;
|
|
245
|
-
children.forEach((child) => {
|
|
246
|
-
// Only count fully selected children (not indeterminate)
|
|
247
|
-
if (child.selected && !child.indeterminate)
|
|
248
|
-
selectedCount++;
|
|
249
|
-
if (child.indeterminate)
|
|
250
|
-
indeterminateCount++;
|
|
251
|
-
});
|
|
252
|
-
const allSelected = selectedCount === children.length;
|
|
253
|
-
const someSelected = selectedCount > 0 || indeterminateCount > 0;
|
|
254
|
-
return { allSelected, someSelected };
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Find parent node of a given node
|
|
258
|
-
*/
|
|
259
|
-
findParentNode(nodes, targetNode) {
|
|
260
|
-
for (const node of nodes) {
|
|
261
|
-
if (node.children?.some((child) => child.id === targetNode.id)) {
|
|
262
|
-
return node;
|
|
263
|
-
}
|
|
264
|
-
if (node.children) {
|
|
265
|
-
const found = this.findParentNode(node.children, targetNode);
|
|
266
|
-
if (found)
|
|
267
|
-
return found;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return undefined;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Handle drop events for tree nodes
|
|
274
|
-
*/
|
|
275
|
-
onDrop(event, parentNode) {
|
|
276
|
-
const targetArray = parentNode?.children ?? this.nodes();
|
|
277
|
-
const isReordering = event.previousContainer === event.container;
|
|
278
|
-
if (isReordering) {
|
|
279
|
-
this.handleReorder(event, targetArray, parentNode);
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
this.handleMove(event, targetArray, parentNode);
|
|
283
|
-
}
|
|
284
|
-
this.nodes.set([...this.nodes()]);
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Handle drop events when dropping directly onto a node (to make it a child)
|
|
288
|
-
*/
|
|
289
|
-
onDropOntoNode(event, targetNode) {
|
|
290
|
-
if (!this.canMoveToParent())
|
|
291
|
-
return;
|
|
292
|
-
const sourceListId = event.previousContainer.element.id;
|
|
293
|
-
const sourceArray = this.getArrayByListId(sourceListId);
|
|
294
|
-
if (!sourceArray)
|
|
295
|
-
return;
|
|
296
|
-
const movedNode = sourceArray[event.previousIndex];
|
|
297
|
-
if (!this.isValidDropTarget(movedNode, targetNode))
|
|
298
|
-
return;
|
|
299
|
-
if (!this.emitBeforeDropEvent(movedNode, sourceListId, targetNode, event.previousIndex, 0))
|
|
300
|
-
return;
|
|
301
|
-
// Initialize children array and perform transfer
|
|
302
|
-
targetNode.children ??= [];
|
|
303
|
-
sourceArray.splice(event.previousIndex, 1);
|
|
304
|
-
targetNode.children.unshift(movedNode);
|
|
305
|
-
targetNode.expanded = true;
|
|
306
|
-
// Emit events
|
|
307
|
-
this.emitDropEvents(movedNode, this.findParentByListId(sourceListId), targetNode, event.previousIndex, 0, false);
|
|
308
|
-
this.nodes.set([...this.nodes()]);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Get array reference by drop list ID
|
|
312
|
-
*/
|
|
313
|
-
getArrayByListId(listId) {
|
|
314
|
-
if (listId === this.ROOT_LIST_ID) {
|
|
315
|
-
return this.nodes();
|
|
316
|
-
}
|
|
317
|
-
if (listId.startsWith(this.NODE_DROP_PREFIX)) {
|
|
318
|
-
const nodeId = listId.replace(this.NODE_DROP_PREFIX, '');
|
|
319
|
-
const node = this.findNodeById(this.nodes(), nodeId);
|
|
320
|
-
return node ? [node] : null;
|
|
321
|
-
}
|
|
322
|
-
const nodeId = listId.replace(this.LIST_PREFIX, '');
|
|
323
|
-
const node = this.findNodeById(this.nodes(), nodeId);
|
|
324
|
-
return node?.children ?? null;
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Find parent node by list ID
|
|
328
|
-
*/
|
|
329
|
-
findParentByListId(listId) {
|
|
330
|
-
if (listId === this.ROOT_LIST_ID) {
|
|
331
|
-
return undefined;
|
|
332
|
-
}
|
|
333
|
-
const prefix = listId.startsWith(this.NODE_DROP_PREFIX) ? this.NODE_DROP_PREFIX : this.LIST_PREFIX;
|
|
334
|
-
const nodeId = listId.replace(prefix, '');
|
|
335
|
-
return this.findNodeById(this.nodes(), nodeId) ?? undefined;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Find a node by ID in the tree
|
|
339
|
-
*/
|
|
340
|
-
findNodeById(nodes, id) {
|
|
341
|
-
for (const node of nodes) {
|
|
342
|
-
if (node.id === id)
|
|
343
|
-
return node;
|
|
344
|
-
if (node.children) {
|
|
345
|
-
const found = this.findNodeById(node.children, id);
|
|
346
|
-
if (found)
|
|
347
|
-
return found;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Check if targetNode is a descendant of ancestorNode (or the same node)
|
|
354
|
-
* Prevents circular references by checking if target exists in ancestor's children tree
|
|
355
|
-
*/
|
|
356
|
-
isNodeDescendantOf(targetNode, ancestorNode) {
|
|
357
|
-
// First check: prevent dropping a node into itself
|
|
358
|
-
if (targetNode.id === ancestorNode.id) {
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
if (!ancestorNode.children || ancestorNode.children.length === 0) {
|
|
362
|
-
return false;
|
|
363
|
-
}
|
|
364
|
-
for (const child of ancestorNode.children) {
|
|
365
|
-
// Direct child match
|
|
366
|
-
if (child.id === targetNode.id) {
|
|
367
|
-
return true;
|
|
368
|
-
}
|
|
369
|
-
// Recursive check in deeper levels
|
|
370
|
-
if (this.isNodeDescendantOf(targetNode, child)) {
|
|
371
|
-
return true;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Generate unique list ID for each node
|
|
378
|
-
*/
|
|
379
|
-
getListId(node) {
|
|
380
|
-
return node ? `${this.LIST_PREFIX}${node.id}` : this.ROOT_LIST_ID;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Expand all nodes in the tree (with lazy loading support)
|
|
384
|
-
*/
|
|
385
|
-
async expandAll() {
|
|
386
|
-
await this.setExpandedState(this.nodes(), true);
|
|
387
|
-
this.nodes.set([...this.nodes()]);
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Collapse all nodes in the tree
|
|
391
|
-
*/
|
|
392
|
-
collapseAll() {
|
|
393
|
-
this.setExpandedState(this.nodes(), false);
|
|
394
|
-
this.nodes.set([...this.nodes()]);
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Recursively set expanded state (with lazy loading)
|
|
398
|
-
*/
|
|
399
|
-
async setExpandedState(nodes, expanded) {
|
|
400
|
-
for (const node of nodes) {
|
|
401
|
-
const hasChildren = this.hasChildren(node);
|
|
402
|
-
const canLazyLoad = this.canLazyLoad(node);
|
|
403
|
-
if (hasChildren || canLazyLoad) {
|
|
404
|
-
if (expanded && canLazyLoad) {
|
|
405
|
-
await this.loadNodeChildren(node);
|
|
406
|
-
}
|
|
407
|
-
node.expanded = expanded;
|
|
408
|
-
if (node.children) {
|
|
409
|
-
await this.setExpandedState(node.children, expanded);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Get count of selected nodes
|
|
416
|
-
*/
|
|
417
|
-
getSelectedCount() {
|
|
418
|
-
return this.countSelected(this.nodes());
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Check if any nodes are selected
|
|
422
|
-
*/
|
|
423
|
-
hasSelection() {
|
|
424
|
-
return this.getSelectedCount() > 0;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Recursively count selected nodes
|
|
428
|
-
*/
|
|
429
|
-
countSelected(nodes) {
|
|
430
|
-
let count = 0;
|
|
431
|
-
nodes.forEach((node) => {
|
|
432
|
-
if (node.selected)
|
|
433
|
-
count++;
|
|
434
|
-
if (node.children) {
|
|
435
|
-
count += this.countSelected(node.children);
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
return count;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Get all selected nodes
|
|
442
|
-
*/
|
|
443
|
-
getSelectedNodes() {
|
|
444
|
-
const selected = [];
|
|
445
|
-
this.collectSelected(this.nodes(), selected);
|
|
446
|
-
return selected;
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Recursively collect selected nodes
|
|
450
|
-
*/
|
|
451
|
-
collectSelected(nodes, result) {
|
|
452
|
-
nodes.forEach((node) => {
|
|
453
|
-
if (node.selected)
|
|
454
|
-
result.push(node);
|
|
455
|
-
if (node.children) {
|
|
456
|
-
this.collectSelected(node.children, result);
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Delete selected nodes from the tree
|
|
462
|
-
*/
|
|
463
|
-
deleteSelected() {
|
|
464
|
-
this.removeSelected(this.nodes());
|
|
465
|
-
// Update all parent states after deletion to clear stale indeterminate states
|
|
466
|
-
this.updateAllParentStates(this.nodes());
|
|
467
|
-
this.nodes.set([...this.nodes()]);
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Select all nodes in the tree
|
|
471
|
-
*/
|
|
472
|
-
selectAll() {
|
|
473
|
-
this.setAllSelection(this.nodes(), true);
|
|
474
|
-
this.nodes.set([...this.nodes()]);
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* Deselect all nodes in the tree
|
|
478
|
-
*/
|
|
479
|
-
deselectAll() {
|
|
480
|
-
this.setAllSelection(this.nodes(), false);
|
|
481
|
-
this.nodes.set([...this.nodes()]);
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Find a node by ID in the tree
|
|
485
|
-
*/
|
|
486
|
-
findNode(id) {
|
|
487
|
-
return this.findNodeById(this.nodes(), id);
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* Refresh the tree to trigger change detection
|
|
491
|
-
*/
|
|
492
|
-
refresh() {
|
|
493
|
-
this.nodes.set([...this.nodes()]);
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Recursively set selection state for all nodes
|
|
497
|
-
*/
|
|
498
|
-
setAllSelection(nodes, selected) {
|
|
499
|
-
nodes.forEach((node) => {
|
|
500
|
-
node.selected = selected;
|
|
501
|
-
node.indeterminate = false;
|
|
502
|
-
if (node.children) {
|
|
503
|
-
this.setAllSelection(node.children, selected);
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Recursively remove selected nodes
|
|
509
|
-
*/
|
|
510
|
-
removeSelected(nodes) {
|
|
511
|
-
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
512
|
-
// Only delete nodes that are fully selected (not indeterminate)
|
|
513
|
-
// Indeterminate parents should not be deleted
|
|
514
|
-
if (nodes[i].selected && !nodes[i].indeterminate) {
|
|
515
|
-
nodes.splice(i, 1);
|
|
516
|
-
}
|
|
517
|
-
else if (nodes[i].children) {
|
|
518
|
-
this.removeSelected(nodes[i].children ?? []);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Recursively update all parent states in the tree (used after deletion)
|
|
524
|
-
*/
|
|
525
|
-
updateAllParentStates(nodes) {
|
|
526
|
-
nodes.forEach((node) => {
|
|
527
|
-
if (node.children && node.children.length > 0) {
|
|
528
|
-
// First, recursively update nested children (bottom-up)
|
|
529
|
-
this.updateAllParentStates(node.children);
|
|
530
|
-
// Then update this node's state based on its children
|
|
531
|
-
const { allSelected, someSelected } = this.getChildrenSelectionState(node.children);
|
|
532
|
-
if (allSelected) {
|
|
533
|
-
node.selected = true;
|
|
534
|
-
node.indeterminate = false;
|
|
535
|
-
}
|
|
536
|
-
else if (someSelected) {
|
|
537
|
-
node.selected = true;
|
|
538
|
-
node.indeterminate = true;
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
node.selected = false;
|
|
542
|
-
node.indeterminate = false;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Check if a node is currently loading
|
|
549
|
-
*/
|
|
550
|
-
isNodeLoading(nodeId) {
|
|
551
|
-
return this.loadingNodes().has(nodeId);
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Get template context for a node
|
|
555
|
-
*/
|
|
556
|
-
getTemplateContext(node, level = 0) {
|
|
557
|
-
return {
|
|
558
|
-
$implicit: node,
|
|
559
|
-
node,
|
|
560
|
-
level,
|
|
561
|
-
expanded: node.expanded ?? false,
|
|
562
|
-
childrenCount: node.childrenCount ?? node.children?.length ?? 0,
|
|
563
|
-
loading: node.loading ?? false,
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Check if node should show expand toggle
|
|
568
|
-
*/
|
|
569
|
-
shouldShowExpandToggle(node) {
|
|
570
|
-
return this.hasChildren(node) || this.canLazyLoad(node);
|
|
571
|
-
}
|
|
572
|
-
// Helper methods for improved code reusability
|
|
573
|
-
/**
|
|
574
|
-
* Check if node has children
|
|
575
|
-
*/
|
|
576
|
-
hasChildren(node) {
|
|
577
|
-
return Boolean(node.children?.length);
|
|
578
|
-
}
|
|
579
|
-
/**
|
|
580
|
-
* Check if node can be lazy loaded
|
|
581
|
-
*/
|
|
582
|
-
canLazyLoad(node) {
|
|
583
|
-
return this.enableLazyLoad() && Boolean(node.childrenCount && node.childrenCount > 0 && !this.hasChildren(node));
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Check if move operation is allowed based on dragOperationType
|
|
587
|
-
*/
|
|
588
|
-
canMoveToParent() {
|
|
589
|
-
if (this.dragOperationType() === 'order-only') {
|
|
590
|
-
console.warn('Moving between parents is disabled when dragOperationType is "order-only"');
|
|
591
|
-
return false;
|
|
592
|
-
}
|
|
593
|
-
return true;
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Check if reorder operation is allowed based on dragOperationType
|
|
597
|
-
*/
|
|
598
|
-
canReorder() {
|
|
599
|
-
if (this.dragOperationType() === 'move') {
|
|
600
|
-
console.warn('Reordering is disabled when dragOperationType is "move"');
|
|
601
|
-
return false;
|
|
602
|
-
}
|
|
603
|
-
return true;
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Validate if drop target is valid (prevent circular references)
|
|
607
|
-
*/
|
|
608
|
-
isValidDropTarget(movedNode, targetNode) {
|
|
609
|
-
if (movedNode.id === targetNode.id || this.isNodeDescendantOf(targetNode, movedNode)) {
|
|
610
|
-
console.warn('Cannot drop a node onto itself or its descendants');
|
|
611
|
-
return false;
|
|
612
|
-
}
|
|
613
|
-
return true;
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Handle reordering within the same list
|
|
617
|
-
*/
|
|
618
|
-
handleReorder(event, targetArray, parentNode) {
|
|
619
|
-
if (!this.canReorder())
|
|
620
|
-
return;
|
|
621
|
-
const movedNode = targetArray[event.previousIndex];
|
|
622
|
-
moveItemInArray(targetArray, event.previousIndex, event.currentIndex);
|
|
623
|
-
this.emitDropEvents(movedNode, parentNode, parentNode, event.previousIndex, event.currentIndex, true);
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* Handle moving between different lists
|
|
627
|
-
*/
|
|
628
|
-
handleMove(event, targetArray, parentNode) {
|
|
629
|
-
if (!this.canMoveToParent())
|
|
630
|
-
return;
|
|
631
|
-
const sourceListId = event.previousContainer.element.id;
|
|
632
|
-
const sourceArray = this.getArrayByListId(sourceListId);
|
|
633
|
-
if (!sourceArray)
|
|
634
|
-
return;
|
|
635
|
-
const movedNode = sourceArray[event.previousIndex];
|
|
636
|
-
// Prevent circular references
|
|
637
|
-
if (parentNode && !this.isValidDropTarget(movedNode, parentNode))
|
|
638
|
-
return;
|
|
639
|
-
// Check if user wants to cancel
|
|
640
|
-
if (!this.emitBeforeDropEvent(movedNode, sourceListId, parentNode, event.previousIndex, event.currentIndex)) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
transferArrayItem(sourceArray, targetArray, event.previousIndex, event.currentIndex);
|
|
644
|
-
this.emitDropEvents(movedNode, this.findParentByListId(sourceListId), parentNode, event.previousIndex, event.currentIndex, false);
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Emit beforeDrop event and return whether to continue
|
|
648
|
-
*/
|
|
649
|
-
emitBeforeDropEvent(movedNode, sourceListId, currentParent, previousIndex, currentIndex) {
|
|
650
|
-
const beforeDropEvent = {
|
|
651
|
-
component: this,
|
|
652
|
-
movedNode,
|
|
653
|
-
previousParent: this.findParentByListId(sourceListId),
|
|
654
|
-
currentParent,
|
|
655
|
-
previousIndex,
|
|
656
|
-
currentIndex,
|
|
657
|
-
canceled: false,
|
|
658
|
-
};
|
|
659
|
-
this.onBeforeDrop.emit(beforeDropEvent);
|
|
660
|
-
if (beforeDropEvent.canceled) {
|
|
661
|
-
console.warn('Drop canceled by user in onBeforeDrop event');
|
|
662
|
-
return false;
|
|
663
|
-
}
|
|
664
|
-
return true;
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Emit drop events based on operation type
|
|
668
|
-
*/
|
|
669
|
-
emitDropEvents(node, previousParent, currentParent, previousIndex, currentIndex, isReorder) {
|
|
670
|
-
const dropEvent = {
|
|
671
|
-
component: this,
|
|
672
|
-
node,
|
|
673
|
-
previousParent,
|
|
674
|
-
currentParent,
|
|
675
|
-
previousIndex,
|
|
676
|
-
currentIndex,
|
|
677
|
-
};
|
|
678
|
-
if (isReorder) {
|
|
679
|
-
this.onOrderChange.emit(dropEvent);
|
|
680
|
-
}
|
|
681
|
-
else {
|
|
682
|
-
this.onMoveChange.emit(dropEvent);
|
|
683
|
-
}
|
|
684
|
-
this.onItemsChange.emit(dropEvent);
|
|
685
|
-
}
|
|
686
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTree2Component, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
687
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: AXTree2Component, isStandalone: true, selector: "ax-tree2", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, showCheckbox: { classPropertyName: "showCheckbox", publicName: "showCheckbox", 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 }, lazyLoad: { classPropertyName: "lazyLoad", publicName: "lazyLoad", isSignal: true, isRequired: false, transformFunction: null }, enableLazyLoad: { classPropertyName: "enableLazyLoad", publicName: "enableLazyLoad", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodes: "nodesChange", onBeforeDrop: "onBeforeDrop", onNodeToggle: "onNodeToggle", onNodeSelect: "onNodeSelect", onOrderChange: "onOrderChange", onMoveChange: "onMoveChange", onItemsChange: "onItemsChange" }, host: { properties: { "class.ax-tree2-default": "look() === 'default'", "class.ax-tree2-card": "look() === 'card'", "class.ax-tree2-with-line": "look() === 'with-line'", "class.ax-tree2-rtl": "isRtl", "style.--ax-tree-indent-size": "indentSize() + 'px'", "style.--ax-tree-line-offset": "(indentSize() / 2) + 'px'" }, classAttribute: "ax-tree2" }, ngImport: i0, template: "<!-- Root drop list -->\n<div\n [axDropList]=\"dragMode() !== 'none'\"\n [sortingDisabled]=\"false\"\n [id]=\"getListId()\"\n [attr.data-node-id]=\"null\"\n dropListGroup=\"ax-tree-nodes\"\n (dropListDropped)=\"onDrop($event)\"\n class=\"ax-tree2-drop-list\"\n [class.ax-tree2-card]=\"look() === 'card'\"\n [class.ax-tree2-with-lines]=\"look() === 'with-line'\"\n [class.ax-tree2-compact]=\"nodeHeight() === 'compact'\"\n [class.ax-tree2-comfortable]=\"nodeHeight() === 'comfortable'\"\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-tree2-node\"\n [class.ax-tree2-node-selected]=\"node.selected\"\n [class.ax-tree2-node-disabled]=\"node.disabled\"\n [class.ax-tree2-node-loading]=\"node.loading\"\n >\n <div\n class=\"ax-tree2-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree2-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree2-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree2-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree2-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-tree2-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree2-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 (showCheckbox()) {\n <ax-check-box\n class=\"ax-tree2-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n (click)=\"$event.stopPropagation()\"\n (pointerdown)=\"$event.stopPropagation()\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree2-node-icon\"></i>\n }\n <span class=\"ax-tree2-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree2-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-tree2-children\">\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-nodes\"\n (dropListDropped)=\"onDrop($event, parent)\"\n class=\"ax-tree2-drop-list\"\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-tree2-node\"\n [class.ax-tree2-node-selected]=\"node.selected\"\n [class.ax-tree2-node-disabled]=\"node.disabled\"\n [class.ax-tree2-node-loading]=\"node.loading\"\n >\n <div\n class=\"ax-tree2-node-content\"\n [style.padding-left.px]=\"!isRtl() ? (level * indentSize()) / (look() === 'with-line' ? 3 : 1) : 0\"\n [style.padding-right.px]=\"isRtl() ? (level * indentSize()) / (look() === 'with-line' ? 3 : 1) : 0\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree2-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree2-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree2-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree2-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-tree2-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree2-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 (showCheckbox()) {\n <ax-check-box\n class=\"ax-tree2-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n (click)=\"$event.stopPropagation()\"\n (pointerdown)=\"$event.stopPropagation()\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree2-node-icon\"></i>\n }\n <span class=\"ax-tree2-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree2-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-tree2-children\">\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-tree2{display:block;width:100%;--ax-comp-tree2-indent-size: 12px;--ax-comp-tree2-node-hover-bg: rgba(var(--ax-sys-color-on-lightest-surface), .04);--ax-comp-tree2-node-selected-bg: rgba(var(--ax-sys-color-primary-500), .12);--ax-comp-tree2-node-border-radius: 6px;--ax-comp-tree2-node-margin: .25rem;--ax-comp-tree2-line-color: rgba(var(--ax-sys-color-on-lightest-surface), .15);--ax-comp-tree2-drag-preview-opacity: .9;--ax-comp-tree2-drag-placeholder-bg: rgba(var(--ax-sys-color-on-lightest-surface), .02);--ax-comp-tree2-drop-active-bg: rgba(var(--ax-sys-color-primary-500), .08);--ax-comp-tree2-drop-active-outline: rgba(var(--ax-sys-color-primary-500), .3)}.ax-tree2-drop-list{min-height:2rem}.ax-tree2-compact .ax-tree2-node-content{padding:.25rem .5rem;gap:.375rem;font-size:.8125rem}.ax-tree2-comfortable .ax-tree2-node-content{padding:.75rem .625rem;gap:.625rem;font-size:.9375rem}.ax-tree2-node{position:relative;margin:var(--ax-comp-tree2-node-margin) 0;border-radius:var(--ax-comp-tree2-node-border-radius);border:1px solid transparent;cursor:move}.ax-tree2-node:hover:not(.ax-dragging){background:var(--ax-comp-tree2-node-hover-bg)}.ax-tree2-node.ax-tree2-node-selected{background:var(--ax-comp-tree2-node-selected-bg);border-color:currentColor}.ax-tree2-node.ax-dragging{opacity:var(--ax-comp-tree2-drag-placeholder-opacity);cursor:grabbing!important}.ax-tree2-node.ax-drag-placeholder{background:var(--ax-comp-tree2-drag-placeholder-bg)}.ax-drag-preview{opacity:var(--ax-comp-tree2-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-tree2-node-content.ax-drop-list-sorting-active{background:var(--ax-comp-tree2-drop-active-bg);border-radius:var(--ax-comp-tree2-node-border-radius);outline:2px dashed var(--ax-comp-tree2-drop-active-outline);outline-offset:-2px}.ax-tree2-node-content{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.ax-tree2-drag-handle{cursor:grab;opacity:.6;padding:.25rem}.ax-tree2-drag-handle:hover{opacity:1}.ax-tree2-drag-handle:active{cursor:grabbing}.ax-tree2-expand-toggle{background:none;border:none;cursor:pointer;padding:.25rem;min-width:1.5rem;height:1.5rem}.ax-tree2-expand-toggle:not(.ax-tree2-has-children){opacity:0;pointer-events:none}.ax-tree2-toggle-icon{font-size:.75rem}.ax-tree2-node-icon{font-size:1.125rem;flex-shrink:0}.ax-tree2-node-label{flex:1;font-size:.875rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ax-tree2-children{padding-left:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-rtl .ax-tree2-children{padding-left:0;padding-right:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-node-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.ax-tree2-node-loading{opacity:.7}.ax-tree2-card .ax-tree2-node{border:1px solid rgba(var(--ax-sys-color-border-lightest-surface),1);margin:.5rem 0}.ax-tree2-card .ax-tree2-node-content{padding:1rem}.ax-tree2-with-lines .ax-tree2-children{position:relative;padding-left:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-with-lines .ax-tree2-children:before{content:\"\";position:absolute;left:var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2));top:0;height:calc(100% - .875rem);width:1px;background:var(--ax-tree-line-color, var(--ax-comp-tree2-line-color))}.ax-tree2-with-lines .ax-tree2-node{position:relative}.ax-tree2-with-lines .ax-tree2-node:before{content:\"\";position:absolute;left:calc(-1 * var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2)));top:60%;width:var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2));height:1px;background:var(--ax-tree-line-color, var(--ax-comp-tree2-line-color))}.ax-tree2-with-lines>.ax-tree2-drop-list>.ax-tree2-node:before,.ax-tree2-with-lines>.ax-tree2-node:before{display:none}.ax-tree2-with-lines.ax-tree2-rtl .ax-tree2-children,.ax-tree2-rtl .ax-tree2-with-lines .ax-tree2-children{padding-left:0;padding-right:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-with-lines.ax-tree2-rtl .ax-tree2-children:before,.ax-tree2-rtl .ax-tree2-with-lines .ax-tree2-children:before{left:auto;right:var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2))}.ax-tree2-with-lines.ax-tree2-rtl .ax-tree2-node:before,.ax-tree2-rtl .ax-tree2-with-lines .ax-tree2-node:before{left:auto;right:calc(-1 * var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2)))}\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: "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 }); }
|
|
688
|
-
}
|
|
689
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTree2Component, decorators: [{
|
|
690
|
-
type: Component,
|
|
691
|
-
args: [{ selector: 'ax-tree2', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
692
|
-
CommonModule,
|
|
693
|
-
FormsModule,
|
|
694
|
-
AXDragDirective,
|
|
695
|
-
AXDragHandleDirective,
|
|
696
|
-
AXDropListDirective,
|
|
697
|
-
NgTemplateOutlet,
|
|
698
|
-
AXButtonComponent,
|
|
699
|
-
AXCheckBoxComponent,
|
|
700
|
-
AXBadgeComponent,
|
|
701
|
-
AXDecoratorIconComponent,
|
|
702
|
-
], host: {
|
|
703
|
-
class: 'ax-tree2',
|
|
704
|
-
'[class.ax-tree2-default]': "look() === 'default'",
|
|
705
|
-
'[class.ax-tree2-card]': "look() === 'card'",
|
|
706
|
-
'[class.ax-tree2-with-line]': "look() === 'with-line'",
|
|
707
|
-
'[class.ax-tree2-rtl]': 'isRtl',
|
|
708
|
-
'[style.--ax-tree-indent-size]': "indentSize() + 'px'",
|
|
709
|
-
'[style.--ax-tree-line-offset]': "(indentSize() / 2) + 'px'",
|
|
710
|
-
}, template: "<!-- Root drop list -->\n<div\n [axDropList]=\"dragMode() !== 'none'\"\n [sortingDisabled]=\"false\"\n [id]=\"getListId()\"\n [attr.data-node-id]=\"null\"\n dropListGroup=\"ax-tree-nodes\"\n (dropListDropped)=\"onDrop($event)\"\n class=\"ax-tree2-drop-list\"\n [class.ax-tree2-card]=\"look() === 'card'\"\n [class.ax-tree2-with-lines]=\"look() === 'with-line'\"\n [class.ax-tree2-compact]=\"nodeHeight() === 'compact'\"\n [class.ax-tree2-comfortable]=\"nodeHeight() === 'comfortable'\"\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-tree2-node\"\n [class.ax-tree2-node-selected]=\"node.selected\"\n [class.ax-tree2-node-disabled]=\"node.disabled\"\n [class.ax-tree2-node-loading]=\"node.loading\"\n >\n <div\n class=\"ax-tree2-node-content\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree2-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree2-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree2-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree2-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-tree2-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree2-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 (showCheckbox()) {\n <ax-check-box\n class=\"ax-tree2-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n (click)=\"$event.stopPropagation()\"\n (pointerdown)=\"$event.stopPropagation()\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree2-node-icon\"></i>\n }\n <span class=\"ax-tree2-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree2-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-tree2-children\">\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-nodes\"\n (dropListDropped)=\"onDrop($event, parent)\"\n class=\"ax-tree2-drop-list\"\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-tree2-node\"\n [class.ax-tree2-node-selected]=\"node.selected\"\n [class.ax-tree2-node-disabled]=\"node.disabled\"\n [class.ax-tree2-node-loading]=\"node.loading\"\n >\n <div\n class=\"ax-tree2-node-content\"\n [style.padding-left.px]=\"!isRtl() ? (level * indentSize()) / (look() === 'with-line' ? 3 : 1) : 0\"\n [style.padding-right.px]=\"isRtl() ? (level * indentSize()) / (look() === 'with-line' ? 3 : 1) : 0\"\n [axDropList]=\"dragMode() !== 'none'\"\n [id]=\"'ax-tree-node-drop-' + node.id\"\n [attr.data-node-id]=\"node.id\"\n [attr.data-drop-type]=\"'onto-node'\"\n dropListGroup=\"ax-tree-nodes\"\n (dropListDropped)=\"onDropOntoNode($event, node)\"\n >\n @if (dragMode() === 'handler') {\n <span class=\"ax-tree2-drag-handle\" axDragHandle title=\"Drag to reorder\"> \u22EE\u22EE </span>\n }\n <ax-button\n class=\"ax-tree2-expand-toggle ax-sm\"\n (onClick)=\"toggleNode(node, $any($event))\"\n [class.ax-tree2-has-children]=\"shouldShowExpandToggle(node)\"\n [class.ax-tree2-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-tree2-loading-spinner\"></i>\n </ax-icon>\n } @else {\n <ax-icon>\n <i\n [class]=\"node.expanded ? directionExpandedIcon() : directionCollapsedIcon()\"\n class=\"ax-tree2-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 (showCheckbox()) {\n <ax-check-box\n class=\"ax-tree2-checkbox\"\n [ngModel]=\"node.indeterminate ? null : node.selected || false\"\n [indeterminate]=\"node.indeterminate || false\"\n (onValueChanged)=\"toggleSelection(node, $event)\"\n (click)=\"$event.stopPropagation()\"\n (pointerdown)=\"$event.stopPropagation()\"\n ></ax-check-box>\n }\n @if (showIcons() && node.icon) {\n <i [class]=\"node.icon\" class=\"ax-tree2-node-icon\"></i>\n }\n <span class=\"ax-tree2-node-label\">{{ node.label }}</span>\n @if (showChildrenBadge() && (node.childrenCount || (node.children && node.children.length > 0))) {\n <ax-badge\n class=\"ax-tree2-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-tree2-children\">\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-tree2{display:block;width:100%;--ax-comp-tree2-indent-size: 12px;--ax-comp-tree2-node-hover-bg: rgba(var(--ax-sys-color-on-lightest-surface), .04);--ax-comp-tree2-node-selected-bg: rgba(var(--ax-sys-color-primary-500), .12);--ax-comp-tree2-node-border-radius: 6px;--ax-comp-tree2-node-margin: .25rem;--ax-comp-tree2-line-color: rgba(var(--ax-sys-color-on-lightest-surface), .15);--ax-comp-tree2-drag-preview-opacity: .9;--ax-comp-tree2-drag-placeholder-bg: rgba(var(--ax-sys-color-on-lightest-surface), .02);--ax-comp-tree2-drop-active-bg: rgba(var(--ax-sys-color-primary-500), .08);--ax-comp-tree2-drop-active-outline: rgba(var(--ax-sys-color-primary-500), .3)}.ax-tree2-drop-list{min-height:2rem}.ax-tree2-compact .ax-tree2-node-content{padding:.25rem .5rem;gap:.375rem;font-size:.8125rem}.ax-tree2-comfortable .ax-tree2-node-content{padding:.75rem .625rem;gap:.625rem;font-size:.9375rem}.ax-tree2-node{position:relative;margin:var(--ax-comp-tree2-node-margin) 0;border-radius:var(--ax-comp-tree2-node-border-radius);border:1px solid transparent;cursor:move}.ax-tree2-node:hover:not(.ax-dragging){background:var(--ax-comp-tree2-node-hover-bg)}.ax-tree2-node.ax-tree2-node-selected{background:var(--ax-comp-tree2-node-selected-bg);border-color:currentColor}.ax-tree2-node.ax-dragging{opacity:var(--ax-comp-tree2-drag-placeholder-opacity);cursor:grabbing!important}.ax-tree2-node.ax-drag-placeholder{background:var(--ax-comp-tree2-drag-placeholder-bg)}.ax-drag-preview{opacity:var(--ax-comp-tree2-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-tree2-node-content.ax-drop-list-sorting-active{background:var(--ax-comp-tree2-drop-active-bg);border-radius:var(--ax-comp-tree2-node-border-radius);outline:2px dashed var(--ax-comp-tree2-drop-active-outline);outline-offset:-2px}.ax-tree2-node-content{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.ax-tree2-drag-handle{cursor:grab;opacity:.6;padding:.25rem}.ax-tree2-drag-handle:hover{opacity:1}.ax-tree2-drag-handle:active{cursor:grabbing}.ax-tree2-expand-toggle{background:none;border:none;cursor:pointer;padding:.25rem;min-width:1.5rem;height:1.5rem}.ax-tree2-expand-toggle:not(.ax-tree2-has-children){opacity:0;pointer-events:none}.ax-tree2-toggle-icon{font-size:.75rem}.ax-tree2-node-icon{font-size:1.125rem;flex-shrink:0}.ax-tree2-node-label{flex:1;font-size:.875rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ax-tree2-children{padding-left:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-rtl .ax-tree2-children{padding-left:0;padding-right:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-node-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.ax-tree2-node-loading{opacity:.7}.ax-tree2-card .ax-tree2-node{border:1px solid rgba(var(--ax-sys-color-border-lightest-surface),1);margin:.5rem 0}.ax-tree2-card .ax-tree2-node-content{padding:1rem}.ax-tree2-with-lines .ax-tree2-children{position:relative;padding-left:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-with-lines .ax-tree2-children:before{content:\"\";position:absolute;left:var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2));top:0;height:calc(100% - .875rem);width:1px;background:var(--ax-tree-line-color, var(--ax-comp-tree2-line-color))}.ax-tree2-with-lines .ax-tree2-node{position:relative}.ax-tree2-with-lines .ax-tree2-node:before{content:\"\";position:absolute;left:calc(-1 * var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2)));top:60%;width:var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2));height:1px;background:var(--ax-tree-line-color, var(--ax-comp-tree2-line-color))}.ax-tree2-with-lines>.ax-tree2-drop-list>.ax-tree2-node:before,.ax-tree2-with-lines>.ax-tree2-node:before{display:none}.ax-tree2-with-lines.ax-tree2-rtl .ax-tree2-children,.ax-tree2-rtl .ax-tree2-with-lines .ax-tree2-children{padding-left:0;padding-right:var(--ax-tree-indent-size, var(--ax-comp-tree2-indent-size))}.ax-tree2-with-lines.ax-tree2-rtl .ax-tree2-children:before,.ax-tree2-rtl .ax-tree2-with-lines .ax-tree2-children:before{left:auto;right:var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2))}.ax-tree2-with-lines.ax-tree2-rtl .ax-tree2-node:before,.ax-tree2-rtl .ax-tree2-with-lines .ax-tree2-node:before{left:auto;right:calc(-1 * var(--ax-tree-line-offset, calc(var(--ax-comp-tree2-indent-size) / 2)))}\n"] }]
|
|
711
|
-
}], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: true }] }, { type: i0.Output, args: ["nodesChange"] }], showCheckbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCheckbox", 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 }] }], lazyLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyLoad", required: false }] }], enableLazyLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableLazyLoad", 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"] }] } });
|
|
712
|
-
|
|
713
|
-
class Tree2Module {
|
|
714
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Tree2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
715
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: Tree2Module, imports: [AXTree2Component] }); }
|
|
716
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Tree2Module, imports: [AXTree2Component] }); }
|
|
717
|
-
}
|
|
718
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Tree2Module, decorators: [{
|
|
719
|
-
type: NgModule,
|
|
720
|
-
args: [{
|
|
721
|
-
imports: [AXTree2Component],
|
|
722
|
-
}]
|
|
723
|
-
}] });
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
* Generated bundle index. Do not edit.
|
|
727
|
-
*/
|
|
728
|
-
|
|
729
|
-
export { AXTree2Component, Tree2Module };
|
|
730
|
-
//# sourceMappingURL=acorex-components-tree2.mjs.map
|