@acorex/components 21.0.0-next.36 → 21.0.0-next.38
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/fesm2022/acorex-components-file-explorer.mjs +8 -8
- package/fesm2022/acorex-components-file-explorer.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 +1123 -397
- package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
- package/file-explorer/index.d.ts +6 -6
- package/package.json +6 -6
- package/tree-view/index.d.ts +499 -168
- package/tree-view-legacy/README.md +3 -0
- package/tree-view-legacy/index.d.ts +184 -0
- 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
package/tree-view/index.d.ts
CHANGED
|
@@ -1,184 +1,515 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { AXPlatform } from '@acorex/core/platform';
|
|
6
|
-
import * as i3 from '@angular/common';
|
|
7
|
-
import * as i5 from '@acorex/components/decorators';
|
|
8
|
-
import * as i6 from '@acorex/components/check-box';
|
|
9
|
-
import * as i7 from '@acorex/components/form';
|
|
10
|
-
import * as i8 from '@angular/forms';
|
|
11
|
-
import * as i9 from '@acorex/components/tooltip';
|
|
12
|
-
import * as i10 from '@acorex/components/loading';
|
|
2
|
+
import { TemplateRef } from '@angular/core';
|
|
3
|
+
import { AXEvent, AXHtmlEvent, AXValueChangedEvent } from '@acorex/cdk/common';
|
|
4
|
+
import { AXDropListDroppedEvent } from '@acorex/cdk/drag-drop';
|
|
13
5
|
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
/**
|
|
7
|
+
* TreeView Component - Design Tokens
|
|
8
|
+
*
|
|
9
|
+
* The component supports the following CSS custom properties (design tokens):
|
|
10
|
+
*
|
|
11
|
+
* **Layout & Spacing:**
|
|
12
|
+
* - `--ax-comp-tree-view-indent-size`: Indentation size for each tree level.
|
|
13
|
+
* Default: `12px`
|
|
14
|
+
* - `--ax-comp-tree-view-node-margin`: Vertical margin between nodes.
|
|
15
|
+
* Default: `0.125rem`
|
|
16
|
+
*
|
|
17
|
+
* **Node Styling:**
|
|
18
|
+
* - `--ax-comp-tree-view-node-border-radius`: Border radius for tree nodes.
|
|
19
|
+
* Default: `6px`
|
|
20
|
+
* - `--ax-comp-tree-view-node-hover-bg`: Background color on node hover.
|
|
21
|
+
* Default: `rgba(var(--ax-sys-color-on-lightest-surface), 0.04)`
|
|
22
|
+
* - `--ax-comp-tree-view-node-selected-bg`: Background color for selected nodes.
|
|
23
|
+
* Default: `rgba(var(--ax-sys-color-primary-500), 0.12)`
|
|
24
|
+
*
|
|
25
|
+
* **Tree Lines (with-line look):**
|
|
26
|
+
* - `--ax-comp-tree-view-line-color`: Color for tree structure lines.
|
|
27
|
+
* Default: `rgba(var(--ax-sys-color-on-lightest-surface), 0.15)`
|
|
28
|
+
*
|
|
29
|
+
* **Drag & Drop:**
|
|
30
|
+
* - `--ax-comp-tree-view-drag-preview-opacity`: Opacity of dragged element preview.
|
|
31
|
+
* Default: `0.9`
|
|
32
|
+
* - `--ax-comp-tree-view-drag-placeholder-bg`: Background for drag placeholder.
|
|
33
|
+
* Default: `rgba(var(--ax-sys-color-on-lightest-surface), 0.02)`
|
|
34
|
+
* - `--ax-comp-tree-view-drop-active-bg`: Background when hovering over valid drop zone.
|
|
35
|
+
* Default: `rgba(var(--ax-sys-color-primary-500), 0.08)`
|
|
36
|
+
* - `--ax-comp-tree-view-drop-active-outline`: Outline color for active drop zones.
|
|
37
|
+
* Default: `rgba(var(--ax-sys-color-primary-500), 0.3)`
|
|
38
|
+
*
|
|
39
|
+
* **Dynamic Tokens (set via TypeScript):**
|
|
40
|
+
* - `--ax-tree-view-indent-size`: Dynamically set from `indentSize` input
|
|
41
|
+
* - `--ax-tree-view-line-offset`: Dynamically calculated as `indentSize / 2`
|
|
42
|
+
* - `--ax-tree-view-line-color`: Optional override for line color
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```css
|
|
46
|
+
* // Customize tree appearance
|
|
47
|
+
* ax-tree-view {
|
|
48
|
+
* --ax-comp-tree-view-indent-size: 16px;
|
|
49
|
+
* --ax-comp-tree-view-node-selected-bg: rgba(var(--ax-sys-color-primary-600), 0.15);
|
|
50
|
+
* --ax-comp-tree-view-line-color: rgba(var(--ax-sys-color-on-lightest-surface), 0.1);
|
|
51
|
+
* --ax-comp-tree-view-node-hover-bg: rgba(var(--ax-sys-color-primary-500), 0.06);
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* All color tokens use Acorex design system variables (`--ax-sys-color-*`) for automatic
|
|
57
|
+
* light/dark mode support. Colors adapt based on the active theme without additional configuration.
|
|
58
|
+
*/
|
|
59
|
+
interface AXTreeViewBeforeDropEvent extends AXEvent {
|
|
60
|
+
movedNode: AXTreeViewNode;
|
|
61
|
+
previousParent?: AXTreeViewNode;
|
|
62
|
+
currentParent?: AXTreeViewNode;
|
|
63
|
+
previousIndex: number;
|
|
64
|
+
currentIndex: number;
|
|
65
|
+
canceled: boolean;
|
|
16
66
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
abstract hasChildField(): string;
|
|
31
|
-
abstract tooltipField(): string;
|
|
32
|
-
abstract showEmptyNodeMassage(): boolean;
|
|
33
|
-
abstract expandOn(): AXTreeViewExpandBehavior;
|
|
34
|
-
abstract focusNodeEnabled(): boolean;
|
|
35
|
-
abstract toggleIcons(): {
|
|
36
|
-
expanded: string;
|
|
37
|
-
collapsed: string;
|
|
38
|
-
} | null;
|
|
39
|
-
abstract itemsPromise: boolean;
|
|
40
|
-
abstract itemsSignal(): unknown[];
|
|
41
|
-
abstract fetchData(item: unknown): void;
|
|
42
|
-
abstract setNodeLoading(value: unknown, loading: boolean): void;
|
|
43
|
-
abstract handleUnActiveNode(items: unknown[]): void;
|
|
44
|
-
abstract onCollapsedChanged: EventEmitter<{
|
|
45
|
-
component: any;
|
|
46
|
-
data: unknown;
|
|
47
|
-
nativeElement: any;
|
|
48
|
-
}>;
|
|
49
|
-
abstract onNodeClick: EventEmitter<{
|
|
50
|
-
component: any;
|
|
51
|
-
data: unknown;
|
|
52
|
-
nativeElement: any;
|
|
53
|
-
}>;
|
|
54
|
-
abstract onNodedbClick: EventEmitter<{
|
|
55
|
-
component: any;
|
|
56
|
-
data: unknown;
|
|
57
|
-
nativeElement: any;
|
|
58
|
-
}>;
|
|
67
|
+
interface AXTreeViewNode {
|
|
68
|
+
id: string;
|
|
69
|
+
label: string;
|
|
70
|
+
icon?: string;
|
|
71
|
+
expanded?: boolean;
|
|
72
|
+
selected?: boolean;
|
|
73
|
+
indeterminate?: boolean;
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
visible?: boolean;
|
|
76
|
+
children?: AXTreeViewNode[];
|
|
77
|
+
childrenCount?: number;
|
|
78
|
+
loading?: boolean;
|
|
79
|
+
data?: unknown;
|
|
59
80
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
81
|
+
interface AXTreeViewNodeToggleEvent extends AXHtmlEvent {
|
|
82
|
+
node: AXTreeViewNode;
|
|
83
|
+
}
|
|
84
|
+
interface AXTreeViewNodeSelectEvent extends AXHtmlEvent {
|
|
85
|
+
node: AXTreeViewNode;
|
|
86
|
+
}
|
|
87
|
+
interface AXTreeViewDropEvent extends AXEvent {
|
|
88
|
+
node: AXTreeViewNode;
|
|
89
|
+
previousParent?: AXTreeViewNode;
|
|
90
|
+
currentParent?: AXTreeViewNode;
|
|
91
|
+
previousIndex: number;
|
|
92
|
+
currentIndex: number;
|
|
93
|
+
}
|
|
94
|
+
interface AXTreeViewItemTemplateContext {
|
|
95
|
+
$implicit: AXTreeViewNode;
|
|
96
|
+
node: AXTreeViewNode;
|
|
97
|
+
level: number;
|
|
98
|
+
expanded: boolean;
|
|
99
|
+
childrenCount: number;
|
|
100
|
+
loading: boolean;
|
|
101
|
+
}
|
|
102
|
+
type AXTreeViewViewLook = 'default' | 'card' | 'with-line';
|
|
103
|
+
type AXTreeViewDragMode = 'none' | 'handler' | 'item';
|
|
104
|
+
type AXTreeViewDragOperationType = 'order-only' | 'move' | 'both';
|
|
105
|
+
type AXTreeViewSelectMode = 'single' | 'multiple';
|
|
106
|
+
/**
|
|
107
|
+
* Function type for lazy loading tree nodes
|
|
108
|
+
*/
|
|
109
|
+
type AXTreeViewCallback = (id?: string) => AXTreeViewNode[] | Promise<AXTreeViewNode[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Data source type - can be static array or lazy loading function
|
|
112
|
+
*/
|
|
113
|
+
type AXTreeViewDataSource = AXTreeViewNode[] | AXTreeViewCallback;
|
|
114
|
+
/**
|
|
115
|
+
* Flat node representation for keyboard navigation
|
|
116
|
+
*/
|
|
117
|
+
interface AXTreeViewFlatNode {
|
|
118
|
+
node: AXTreeViewNode;
|
|
119
|
+
level: number;
|
|
120
|
+
parent?: AXTreeViewNode;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Children selection state for parent node calculation
|
|
124
|
+
*/
|
|
125
|
+
interface AXTreeViewChildrenSelectionState {
|
|
126
|
+
allSelected: boolean;
|
|
127
|
+
someSelected: boolean;
|
|
76
128
|
}
|
|
77
129
|
|
|
78
|
-
declare class AXTreeViewComponent
|
|
130
|
+
declare class AXTreeViewComponent {
|
|
79
131
|
#private;
|
|
80
|
-
|
|
81
|
-
private
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
itemTemplate
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
*
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
*
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
132
|
+
private readonly treeService;
|
|
133
|
+
private readonly platformService;
|
|
134
|
+
private readonly destroyRef;
|
|
135
|
+
/** Tree data source - can be static array or lazy loading function */
|
|
136
|
+
readonly datasource: _angular_core.ModelSignal<AXTreeViewDataSource>;
|
|
137
|
+
/** Selection mode: 'single' (click to select) or 'multiple' (checkbox selection) */
|
|
138
|
+
readonly selectMode: _angular_core.InputSignal<AXTreeViewSelectMode>;
|
|
139
|
+
/** Whether to show checkboxes for selection (only applies to multiple mode) */
|
|
140
|
+
readonly showCheckbox: _angular_core.InputSignal<boolean>;
|
|
141
|
+
/** When true, selecting a parent also selects all loaded children (only for multiple mode) */
|
|
142
|
+
readonly checkChildrenOnSelect: _angular_core.InputSignal<boolean>;
|
|
143
|
+
/** When true, selecting a child makes parents indeterminate (only for multiple mode) */
|
|
144
|
+
readonly intermediateState: _angular_core.InputSignal<boolean>;
|
|
145
|
+
/** When true, clicking on a node toggles its selection (works for both single and multiple modes) */
|
|
146
|
+
readonly checkOnClick: _angular_core.InputSignal<boolean>;
|
|
147
|
+
/** Drag and drop mode: 'none' (disabled), 'handler' (drag handle), 'item' (entire item) */
|
|
148
|
+
readonly dragMode: _angular_core.InputSignal<AXTreeViewDragMode>;
|
|
149
|
+
/** Drag operation type: 'order-only' (reorder only), 'move' (move between parents), 'both' (allow both) */
|
|
150
|
+
readonly dragOperationType: _angular_core.InputSignal<AXTreeViewDragOperationType>;
|
|
151
|
+
/** Whether to show icons */
|
|
152
|
+
readonly showIcons: _angular_core.InputSignal<boolean>;
|
|
153
|
+
/** Whether to show children count badge */
|
|
154
|
+
readonly showChildrenBadge: _angular_core.InputSignal<boolean>;
|
|
155
|
+
/** Custom icon for expanded nodes */
|
|
156
|
+
readonly expandedIcon: _angular_core.InputSignal<string>;
|
|
157
|
+
/** Custom icon for collapsed nodes */
|
|
158
|
+
readonly collapsedIcon: _angular_core.InputSignal<string>;
|
|
159
|
+
/** Indent size in pixels for each level */
|
|
160
|
+
readonly indentSize: _angular_core.InputSignal<number>;
|
|
161
|
+
/** Node height in pixels */
|
|
162
|
+
readonly nodeHeight: _angular_core.InputSignal<"compact" | "normal" | "comfortable">;
|
|
163
|
+
/** Visual style variant */
|
|
164
|
+
readonly look: _angular_core.InputSignal<AXTreeViewViewLook>;
|
|
165
|
+
/** Custom template for tree items */
|
|
166
|
+
readonly itemTemplate: _angular_core.InputSignal<TemplateRef<AXTreeViewItemTemplateContext>>;
|
|
167
|
+
/** Emitted before a drop operation - set canceled to true to prevent drop */
|
|
168
|
+
readonly onBeforeDrop: _angular_core.OutputEmitterRef<AXTreeViewBeforeDropEvent>;
|
|
169
|
+
/** Emitted when a node is toggled (expanded/collapsed) */
|
|
170
|
+
readonly onNodeToggle: _angular_core.OutputEmitterRef<AXTreeViewNodeToggleEvent>;
|
|
171
|
+
/** Emitted when a node is selected/deselected */
|
|
172
|
+
readonly onNodeSelect: _angular_core.OutputEmitterRef<AXTreeViewNodeSelectEvent>;
|
|
173
|
+
/** Emitted when nodes are reordered within the same parent */
|
|
174
|
+
readonly onOrderChange: _angular_core.OutputEmitterRef<AXTreeViewDropEvent>;
|
|
175
|
+
/** Emitted when a node is moved to a different parent */
|
|
176
|
+
readonly onMoveChange: _angular_core.OutputEmitterRef<AXTreeViewDropEvent>;
|
|
177
|
+
/** Emitted for any item change (order or move) */
|
|
178
|
+
readonly onItemsChange: _angular_core.OutputEmitterRef<AXTreeViewDropEvent>;
|
|
179
|
+
/** Internal signal for tree nodes */
|
|
180
|
+
protected readonly nodes: _angular_core.WritableSignal<AXTreeViewNode[]>;
|
|
181
|
+
/** Internal signal for tracking loading state */
|
|
182
|
+
protected readonly loadingNodes: _angular_core.WritableSignal<Set<string>>;
|
|
183
|
+
/** Currently focused node ID for keyboard navigation */
|
|
184
|
+
protected readonly focusedNodeId: _angular_core.WritableSignal<string>;
|
|
185
|
+
/** RTL detection signal */
|
|
186
|
+
protected readonly isRtl: _angular_core.WritableSignal<boolean>;
|
|
187
|
+
/** Computed chevron icons that flip for RTL */
|
|
188
|
+
protected readonly directionExpandedIcon: _angular_core.Signal<string>;
|
|
189
|
+
protected readonly directionCollapsedIcon: _angular_core.Signal<string>;
|
|
190
|
+
/** Flag to prevent infinite loops when syncing datasource */
|
|
191
|
+
private isUpdatingFromDatasource;
|
|
192
|
+
/** Computed to check if datasource is a function */
|
|
193
|
+
private readonly isLazyDataSource;
|
|
194
|
+
/**
|
|
195
|
+
* Expand all nodes in the tree (with lazy loading support)
|
|
196
|
+
*/
|
|
197
|
+
expandAll(): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Collapse all nodes in the tree
|
|
200
|
+
*/
|
|
201
|
+
collapseAll(): void;
|
|
202
|
+
/**
|
|
203
|
+
* Get count of selected nodes
|
|
204
|
+
*/
|
|
205
|
+
getSelectedCount(): number;
|
|
206
|
+
/**
|
|
207
|
+
* Check if any nodes are selected
|
|
208
|
+
*/
|
|
209
|
+
hasSelection(): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Get all selected nodes
|
|
212
|
+
*/
|
|
213
|
+
getSelectedNodes(): AXTreeViewNode[];
|
|
214
|
+
/**
|
|
215
|
+
* Delete selected nodes from the tree
|
|
216
|
+
*/
|
|
217
|
+
deleteSelected(): void;
|
|
218
|
+
/**
|
|
219
|
+
* Select all nodes in the tree
|
|
220
|
+
*/
|
|
221
|
+
selectAll(): void;
|
|
222
|
+
/**
|
|
223
|
+
* Deselect all nodes in the tree
|
|
224
|
+
*/
|
|
225
|
+
deselectAll(): void;
|
|
226
|
+
/**
|
|
227
|
+
* Find a node by ID in the tree
|
|
228
|
+
*/
|
|
229
|
+
findNode(id: string): AXTreeViewNode | null;
|
|
230
|
+
/**
|
|
231
|
+
* Refresh the tree to trigger change detection
|
|
232
|
+
*/
|
|
169
233
|
refresh(): void;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Check if a node is currently loading
|
|
236
|
+
*/
|
|
237
|
+
isNodeLoading(nodeId: string): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Get template context for a node
|
|
240
|
+
*/
|
|
241
|
+
getTemplateContext(node: AXTreeViewNode, level?: number): AXTreeViewItemTemplateContext;
|
|
242
|
+
/**
|
|
243
|
+
* Calculate padding-inline for a node based on its level
|
|
244
|
+
*/
|
|
245
|
+
getNodePaddingInline(level: number): number;
|
|
246
|
+
/**
|
|
247
|
+
* Check if node should show expand toggle
|
|
248
|
+
*/
|
|
249
|
+
shouldShowExpandToggle(node: AXTreeViewNode): boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Check if checkboxes should be shown (only for multiple mode)
|
|
252
|
+
*/
|
|
253
|
+
shouldShowCheckbox(): boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Generate unique list ID for each node
|
|
256
|
+
*/
|
|
257
|
+
getListId(node?: AXTreeViewNode): string;
|
|
258
|
+
/**
|
|
259
|
+
* Check if a node is currently focused
|
|
260
|
+
*/
|
|
261
|
+
isNodeFocused(nodeId: string): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Get ARIA level for a node
|
|
264
|
+
*/
|
|
265
|
+
getNodeAriaLevel(level: number): number;
|
|
266
|
+
/**
|
|
267
|
+
* Get ARIA expanded state for a node
|
|
268
|
+
*/
|
|
269
|
+
getNodeAriaExpanded(node: AXTreeViewNode): string | null;
|
|
270
|
+
/**
|
|
271
|
+
* Get ARIA selected state for a node
|
|
272
|
+
*/
|
|
273
|
+
getNodeAriaSelected(node: AXTreeViewNode): string | null;
|
|
274
|
+
/**
|
|
275
|
+
* Handle node click - for single selection mode or multiple mode with checkOnClick enabled
|
|
276
|
+
*/
|
|
277
|
+
onNodeClick(node: AXTreeViewNode, event: Event): void;
|
|
278
|
+
/**
|
|
279
|
+
* Toggle node expansion state with lazy loading support
|
|
280
|
+
*/
|
|
281
|
+
toggleNode(node: AXTreeViewNode, event: Event): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Toggle node selection state with indeterminate support (for multiple mode)
|
|
284
|
+
*/
|
|
285
|
+
toggleSelection(node: AXTreeViewNode, event: AXValueChangedEvent): void;
|
|
286
|
+
/**
|
|
287
|
+
* Handle drop events for tree nodes
|
|
288
|
+
*/
|
|
289
|
+
onDrop(event: AXDropListDroppedEvent, parentNode?: AXTreeViewNode): void;
|
|
290
|
+
/**
|
|
291
|
+
* Handle drop events when dropping directly onto a node (to make it a child)
|
|
292
|
+
*/
|
|
293
|
+
onDropOntoNode(event: AXDropListDroppedEvent, targetNode: AXTreeViewNode): void;
|
|
294
|
+
/**
|
|
295
|
+
* Handle node focus event
|
|
296
|
+
*/
|
|
297
|
+
onNodeFocus(nodeId: string): void;
|
|
298
|
+
/**
|
|
299
|
+
* Handle tree container focus - focus first node if none is focused
|
|
300
|
+
*/
|
|
301
|
+
onTreeFocus(event: FocusEvent): void;
|
|
302
|
+
/**
|
|
303
|
+
* Handle tree container blur
|
|
304
|
+
*/
|
|
305
|
+
onTreeBlur(event: FocusEvent): void;
|
|
306
|
+
/**
|
|
307
|
+
* Handle keyboard navigation
|
|
308
|
+
*/
|
|
309
|
+
handleKeyDown(event: KeyboardEvent): void;
|
|
310
|
+
/**
|
|
311
|
+
* Load root items when datasource is a function
|
|
312
|
+
*/
|
|
313
|
+
private loadRootItems;
|
|
314
|
+
/**
|
|
315
|
+
* Load children for a node using lazy loading
|
|
316
|
+
*/
|
|
317
|
+
private loadNodeChildren;
|
|
318
|
+
/**
|
|
319
|
+
* Internal method to refresh nodes signal and sync back to datasource if it's an array
|
|
320
|
+
* Creates new array references for all nested children to ensure reactivity
|
|
321
|
+
*/
|
|
322
|
+
private refreshNodes;
|
|
323
|
+
/**
|
|
324
|
+
* Recursively ensure all children arrays have new references to trigger change detection
|
|
325
|
+
* Mutates the tree structure by replacing children arrays with new array references
|
|
326
|
+
*/
|
|
327
|
+
private ensureNewArrayReferences;
|
|
328
|
+
/**
|
|
329
|
+
* Handle single selection mode
|
|
330
|
+
*/
|
|
331
|
+
private handleSingleSelection;
|
|
332
|
+
/**
|
|
333
|
+
* Handle multiple selection mode with checkOnClick
|
|
334
|
+
*/
|
|
335
|
+
private handleMultipleSelection;
|
|
336
|
+
/**
|
|
337
|
+
* Get array reference by drop list ID
|
|
338
|
+
*/
|
|
339
|
+
private getArrayByListId;
|
|
340
|
+
/**
|
|
341
|
+
* Find parent node by list ID
|
|
342
|
+
*/
|
|
343
|
+
private findParentByListId;
|
|
344
|
+
/**
|
|
345
|
+
* Check if move operation is allowed based on dragOperationType
|
|
346
|
+
*/
|
|
347
|
+
private canMoveToParent;
|
|
348
|
+
/**
|
|
349
|
+
* Check if reorder operation is allowed based on dragOperationType
|
|
350
|
+
*/
|
|
351
|
+
private canReorder;
|
|
352
|
+
/**
|
|
353
|
+
* Handle reordering within the same list */
|
|
354
|
+
private handleReorder;
|
|
355
|
+
/**
|
|
356
|
+
* Handle moving between different lists
|
|
357
|
+
*/
|
|
358
|
+
private handleMove;
|
|
359
|
+
/**
|
|
360
|
+
* Emit beforeDrop event and return whether to continue
|
|
361
|
+
*/
|
|
362
|
+
private emitBeforeDropEvent;
|
|
363
|
+
/**
|
|
364
|
+
* Emit drop events based on operation type
|
|
365
|
+
*/
|
|
366
|
+
private emitDropEvents;
|
|
367
|
+
/**
|
|
368
|
+
* Get the currently focused node
|
|
369
|
+
*/
|
|
370
|
+
private getFocusedNode;
|
|
371
|
+
/**
|
|
372
|
+
* Set focus to a node by ID
|
|
373
|
+
*/
|
|
374
|
+
private focusNodeById;
|
|
375
|
+
/**
|
|
376
|
+
* Handle keyboard navigation keys
|
|
377
|
+
*/
|
|
378
|
+
private handleNavigationKey;
|
|
379
|
+
/**
|
|
380
|
+
* Handle Space key selection
|
|
381
|
+
*/
|
|
382
|
+
private handleSpaceKeySelection;
|
|
383
|
+
/**
|
|
384
|
+
* Handle Enter key selection
|
|
385
|
+
*/
|
|
386
|
+
private handleEnterKeySelection;
|
|
387
|
+
/**
|
|
388
|
+
* Handle Ctrl/Cmd + Enter key selection
|
|
389
|
+
*/
|
|
390
|
+
private handleCtrlEnterSelection;
|
|
391
|
+
/**
|
|
392
|
+
* Type guard to check if value is an Event
|
|
393
|
+
*/
|
|
394
|
+
private isEvent;
|
|
395
|
+
/**
|
|
396
|
+
* Handle errors consistently
|
|
397
|
+
*/
|
|
398
|
+
private handleError;
|
|
173
399
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXTreeViewComponent, never>;
|
|
174
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXTreeViewComponent, "ax-tree-view", never, { "
|
|
400
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXTreeViewComponent, "ax-tree-view", never, { "datasource": { "alias": "datasource"; "required": true; "isSignal": true; }; "selectMode": { "alias": "selectMode"; "required": false; "isSignal": true; }; "showCheckbox": { "alias": "showCheckbox"; "required": false; "isSignal": true; }; "checkChildrenOnSelect": { "alias": "checkChildrenOnSelect"; "required": false; "isSignal": true; }; "intermediateState": { "alias": "intermediateState"; "required": false; "isSignal": true; }; "checkOnClick": { "alias": "checkOnClick"; "required": false; "isSignal": true; }; "dragMode": { "alias": "dragMode"; "required": false; "isSignal": true; }; "dragOperationType": { "alias": "dragOperationType"; "required": false; "isSignal": true; }; "showIcons": { "alias": "showIcons"; "required": false; "isSignal": true; }; "showChildrenBadge": { "alias": "showChildrenBadge"; "required": false; "isSignal": true; }; "expandedIcon": { "alias": "expandedIcon"; "required": false; "isSignal": true; }; "collapsedIcon": { "alias": "collapsedIcon"; "required": false; "isSignal": true; }; "indentSize": { "alias": "indentSize"; "required": false; "isSignal": true; }; "nodeHeight": { "alias": "nodeHeight"; "required": false; "isSignal": true; }; "look": { "alias": "look"; "required": false; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; }, { "datasource": "datasourceChange"; "onBeforeDrop": "onBeforeDrop"; "onNodeToggle": "onNodeToggle"; "onNodeSelect": "onNodeSelect"; "onOrderChange": "onOrderChange"; "onMoveChange": "onMoveChange"; "onItemsChange": "onItemsChange"; }, never, never, true, never>;
|
|
175
401
|
}
|
|
176
402
|
|
|
177
403
|
declare class AXTreeViewModule {
|
|
178
404
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXTreeViewModule, never>;
|
|
179
|
-
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<AXTreeViewModule, never, [typeof AXTreeViewComponent
|
|
405
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<AXTreeViewModule, never, [typeof AXTreeViewComponent], never>;
|
|
180
406
|
static ɵinj: _angular_core.ɵɵInjectorDeclaration<AXTreeViewModule>;
|
|
181
407
|
}
|
|
182
408
|
|
|
183
|
-
|
|
184
|
-
|
|
409
|
+
/**
|
|
410
|
+
* Service for tree node operations
|
|
411
|
+
* Handles all business logic for tree node manipulation
|
|
412
|
+
*/
|
|
413
|
+
declare class AXTreeViewService {
|
|
414
|
+
private static readonly ROOT_LIST_ID;
|
|
415
|
+
private static readonly NODE_DROP_PREFIX;
|
|
416
|
+
private static readonly LIST_PREFIX;
|
|
417
|
+
/**
|
|
418
|
+
* Find a node by ID in the tree
|
|
419
|
+
*/
|
|
420
|
+
findNodeById(nodes: AXTreeViewNode[], id: string): AXTreeViewNode | null;
|
|
421
|
+
/**
|
|
422
|
+
* Find parent node of a given node
|
|
423
|
+
*/
|
|
424
|
+
findParentNode(nodes: AXTreeViewNode[], targetNode: AXTreeViewNode): AXTreeViewNode | undefined;
|
|
425
|
+
/**
|
|
426
|
+
* Check if targetNode is a descendant of ancestorNode (or the same node)
|
|
427
|
+
* Prevents circular references by checking if target exists in ancestor's children tree
|
|
428
|
+
*/
|
|
429
|
+
isValidDropTarget(movedNode: AXTreeViewNode, targetNode: AXTreeViewNode): boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Check if targetNode is a descendant of ancestorNode
|
|
432
|
+
*/
|
|
433
|
+
private isNodeDescendantOf;
|
|
434
|
+
/**
|
|
435
|
+
* Build a flat list of all visible focusable nodes
|
|
436
|
+
*/
|
|
437
|
+
buildFlatNodeList(nodes: AXTreeViewNode[]): AXTreeViewFlatNode[];
|
|
438
|
+
/**
|
|
439
|
+
* Check if node has children
|
|
440
|
+
*/
|
|
441
|
+
hasChildren(node: AXTreeViewNode): boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Check if node can be lazy loaded
|
|
444
|
+
*/
|
|
445
|
+
canLazyLoad(node: AXTreeViewNode, isLazyDataSource: boolean): boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Recursively select/deselect all children
|
|
448
|
+
*/
|
|
449
|
+
selectAllChildren(children: AXTreeViewNode[], selected: boolean): void;
|
|
450
|
+
/**
|
|
451
|
+
* Get selection state of children
|
|
452
|
+
*/
|
|
453
|
+
getChildrenSelectionState(children: AXTreeViewNode[]): AXTreeViewChildrenSelectionState;
|
|
454
|
+
/**
|
|
455
|
+
* Update parent node states based on children selection (with intermediate state support)
|
|
456
|
+
*/
|
|
457
|
+
updateParentStates(nodes: AXTreeViewNode[], changedNode: AXTreeViewNode, intermediateState: boolean): void;
|
|
458
|
+
/**
|
|
459
|
+
* Recursively deselect all nodes
|
|
460
|
+
*/
|
|
461
|
+
deselectAllNodes(nodes: AXTreeViewNode[]): void;
|
|
462
|
+
/**
|
|
463
|
+
* Recursively set selection state for all nodes
|
|
464
|
+
*/
|
|
465
|
+
setAllSelection(nodes: AXTreeViewNode[], selected: boolean): void;
|
|
466
|
+
/**
|
|
467
|
+
* Recursively count selected nodes
|
|
468
|
+
*/
|
|
469
|
+
countSelected(nodes: AXTreeViewNode[]): number;
|
|
470
|
+
/**
|
|
471
|
+
* Recursively collect selected nodes
|
|
472
|
+
*/
|
|
473
|
+
collectSelected(nodes: AXTreeViewNode[], result: AXTreeViewNode[]): void;
|
|
474
|
+
/**
|
|
475
|
+
* Recursively remove selected nodes
|
|
476
|
+
*/
|
|
477
|
+
removeSelected(nodes: AXTreeViewNode[]): void;
|
|
478
|
+
/**
|
|
479
|
+
* Recursively update all parent states in the tree (used after deletion)
|
|
480
|
+
*/
|
|
481
|
+
updateAllParentStates(nodes: AXTreeViewNode[], intermediateState: boolean): void;
|
|
482
|
+
/**
|
|
483
|
+
* Recursively set expanded state (with lazy loading)
|
|
484
|
+
*/
|
|
485
|
+
setExpandedState(nodes: AXTreeViewNode[], expanded: boolean, isLazyDataSource: boolean, loadNodeChildren: (node: AXTreeViewNode) => Promise<void>): Promise<void>;
|
|
486
|
+
/**
|
|
487
|
+
* Get array reference by drop list ID
|
|
488
|
+
*/
|
|
489
|
+
getArrayByListId(nodes: AXTreeViewNode[], listId: string): AXTreeViewNode[] | null;
|
|
490
|
+
/**
|
|
491
|
+
* Find parent node by list ID
|
|
492
|
+
*/
|
|
493
|
+
findParentByListId(nodes: AXTreeViewNode[], listId: string): AXTreeViewNode | undefined;
|
|
494
|
+
/**
|
|
495
|
+
* Generate unique list ID for each node
|
|
496
|
+
*/
|
|
497
|
+
getListId(node?: AXTreeViewNode): string;
|
|
498
|
+
/**
|
|
499
|
+
* Get root list ID constant
|
|
500
|
+
*/
|
|
501
|
+
getRootListId(): string;
|
|
502
|
+
/**
|
|
503
|
+
* Get node drop prefix constant
|
|
504
|
+
*/
|
|
505
|
+
getNodeDropPrefix(): string;
|
|
506
|
+
/**
|
|
507
|
+
* Get list prefix constant
|
|
508
|
+
*/
|
|
509
|
+
getListPrefix(): string;
|
|
510
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXTreeViewService, never>;
|
|
511
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AXTreeViewService>;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export { AXTreeViewComponent, AXTreeViewModule, AXTreeViewService };
|
|
515
|
+
export type { AXTreeViewBeforeDropEvent, AXTreeViewCallback, AXTreeViewChildrenSelectionState, AXTreeViewDataSource, AXTreeViewDragMode, AXTreeViewDragOperationType, AXTreeViewDropEvent, AXTreeViewFlatNode, AXTreeViewItemTemplateContext, AXTreeViewNode, AXTreeViewNodeSelectEvent, AXTreeViewNodeToggleEvent, AXTreeViewSelectMode, AXTreeViewViewLook };
|