@acorex/components 21.0.0-next.11 → 21.0.0-next.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/autocomplete/index.d.ts +13 -9
  2. package/fesm2022/acorex-components-autocomplete.mjs +13 -6
  3. package/fesm2022/acorex-components-autocomplete.mjs.map +1 -1
  4. package/fesm2022/acorex-components-color-palette.mjs +1 -1
  5. package/fesm2022/acorex-components-color-palette.mjs.map +1 -1
  6. package/fesm2022/acorex-components-cron-job.mjs +6 -6
  7. package/fesm2022/acorex-components-cron-job.mjs.map +1 -1
  8. package/fesm2022/acorex-components-kanban.mjs +1 -1
  9. package/fesm2022/acorex-components-kanban.mjs.map +1 -1
  10. package/fesm2022/acorex-components-media-viewer.mjs +2 -2
  11. package/fesm2022/acorex-components-media-viewer.mjs.map +1 -1
  12. package/fesm2022/{acorex-components-modal-acorex-components-modal-ClSGRCam.mjs → acorex-components-modal-acorex-components-modal-BLjJGxLT.mjs} +2 -2
  13. package/fesm2022/{acorex-components-modal-acorex-components-modal-ClSGRCam.mjs.map → acorex-components-modal-acorex-components-modal-BLjJGxLT.mjs.map} +1 -1
  14. package/fesm2022/{acorex-components-modal-modal-content.component-BC-z7O0z.mjs → acorex-components-modal-modal-content.component-CC_L42pt.mjs} +4 -4
  15. package/fesm2022/acorex-components-modal-modal-content.component-CC_L42pt.mjs.map +1 -0
  16. package/fesm2022/acorex-components-modal.mjs +1 -1
  17. package/fesm2022/acorex-components-phone-box.mjs +1 -1
  18. package/fesm2022/acorex-components-phone-box.mjs.map +1 -1
  19. package/fesm2022/acorex-components-query-builder.mjs +1 -1
  20. package/fesm2022/acorex-components-query-builder.mjs.map +1 -1
  21. package/fesm2022/acorex-components-rest-api-generator.mjs +1 -1
  22. package/fesm2022/acorex-components-rest-api-generator.mjs.map +1 -1
  23. package/fesm2022/acorex-components-rrule.mjs +1 -1
  24. package/fesm2022/acorex-components-rrule.mjs.map +1 -1
  25. package/fesm2022/acorex-components-scheduler.mjs +8 -8
  26. package/fesm2022/acorex-components-scheduler.mjs.map +1 -1
  27. package/fesm2022/acorex-components-select-box.mjs +18 -8
  28. package/fesm2022/acorex-components-select-box.mjs.map +1 -1
  29. package/fesm2022/acorex-components-tag-box.mjs +45 -15
  30. package/fesm2022/acorex-components-tag-box.mjs.map +1 -1
  31. package/fesm2022/acorex-components-tag.mjs +39 -3
  32. package/fesm2022/acorex-components-tag.mjs.map +1 -1
  33. package/fesm2022/acorex-components-tree2.mjs +596 -0
  34. package/fesm2022/acorex-components-tree2.mjs.map +1 -0
  35. package/package.json +15 -11
  36. package/select-box/index.d.ts +14 -10
  37. package/tag/index.d.ts +8 -2
  38. package/tag-box/index.d.ts +12 -3
  39. package/tree2/README.md +3 -0
  40. package/tree2/index.d.ts +267 -0
  41. package/fesm2022/acorex-components-modal-modal-content.component-BC-z7O0z.mjs.map +0 -1
@@ -0,0 +1,596 @@
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 * as i1 from '@angular/common';
7
+ import { CommonModule, NgTemplateOutlet } from '@angular/common';
8
+ import * as i0 from '@angular/core';
9
+ import { model, input, output, signal, effect, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
10
+ import * as i2 from '@angular/forms';
11
+ import { FormsModule } from '@angular/forms';
12
+
13
+ class AXTree2Component {
14
+ constructor() {
15
+ /** Tree data nodes */
16
+ this.nodes = model.required(...(ngDevMode ? [{ debugName: "nodes" }] : []));
17
+ /** Whether to show checkboxes for selection */
18
+ this.showCheckbox = input(true, ...(ngDevMode ? [{ debugName: "showCheckbox" }] : []));
19
+ /** Drag and drop mode: 'none' (disabled), 'handler' (drag handle), 'item' (entire item) */
20
+ this.dragMode = input('handler', ...(ngDevMode ? [{ debugName: "dragMode" }] : []));
21
+ /** Whether to show icons */
22
+ this.showIcons = input(true, ...(ngDevMode ? [{ debugName: "showIcons" }] : []));
23
+ /** Whether to show children count badge */
24
+ this.showChildrenBadge = input(true, ...(ngDevMode ? [{ debugName: "showChildrenBadge" }] : []));
25
+ /** Whether to animate expand/collapse */
26
+ this.animated = input(true, ...(ngDevMode ? [{ debugName: "animated" }] : []));
27
+ /** Custom icon for expanded nodes */
28
+ this.expandedIcon = input('fa-solid fa-chevron-down', ...(ngDevMode ? [{ debugName: "expandedIcon" }] : []));
29
+ /** Custom icon for collapsed nodes */
30
+ this.collapsedIcon = input('fa-solid fa-chevron-right', ...(ngDevMode ? [{ debugName: "collapsedIcon" }] : []));
31
+ /** Indent size in pixels for each level */
32
+ this.indentSize = input(12, ...(ngDevMode ? [{ debugName: "indentSize" }] : []));
33
+ /** Node height in pixels */
34
+ this.nodeHeight = input('normal', ...(ngDevMode ? [{ debugName: "nodeHeight" }] : []));
35
+ /** Visual style variant */
36
+ this.look = input('default', ...(ngDevMode ? [{ debugName: "look" }] : []));
37
+ /** Custom template for tree items */
38
+ this.itemTemplate = input(...(ngDevMode ? [undefined, { debugName: "itemTemplate" }] : []));
39
+ /** Lazy load function for fetching children */
40
+ this.lazyLoad = input(...(ngDevMode ? [undefined, { debugName: "lazyLoad" }] : []));
41
+ /** Whether to enable lazy loading */
42
+ this.enableLazyLoad = input(false, ...(ngDevMode ? [{ debugName: "enableLazyLoad" }] : []));
43
+ /** Emitted before a drop operation - set canceled to true to prevent drop */
44
+ this.onBeforeDrop = output();
45
+ /** Emitted when a node is toggled (expanded/collapsed) */
46
+ this.nodeToggle = output();
47
+ /** Emitted when a node is selected/deselected */
48
+ this.nodeSelect = output();
49
+ /** Emitted when a node is dropped */
50
+ this.nodeDrop = output();
51
+ /** Internal signal for tracking loading state */
52
+ this.loadingNodes = signal(new Set(), ...(ngDevMode ? [{ debugName: "loadingNodes" }] : []));
53
+ /** Effect to handle lazy load function changes */
54
+ this.#lazyLoadEffect = effect(() => {
55
+ const lazyLoadFn = this.lazyLoad();
56
+ const enabled = this.enableLazyLoad();
57
+ if (lazyLoadFn && enabled) {
58
+ // Initialize lazy loading state
59
+ this.updateHasChildrenFlags(this.nodes());
60
+ }
61
+ }, ...(ngDevMode ? [{ debugName: "#lazyLoadEffect" }] : []));
62
+ }
63
+ /** Effect to handle lazy load function changes */
64
+ #lazyLoadEffect;
65
+ /**
66
+ * Toggle node expansion state with lazy loading support
67
+ */
68
+ async toggleNode(node, event) {
69
+ if (node.disabled)
70
+ return;
71
+ const hasChildren = node.children && node.children.length > 0;
72
+ const canLazyLoad = this.enableLazyLoad() && node.childrenCount && node.childrenCount > 0 && !hasChildren;
73
+ if (hasChildren || canLazyLoad) {
74
+ const willExpand = !node.expanded;
75
+ if (willExpand && canLazyLoad) {
76
+ // Lazy load children before expanding
77
+ await this.loadNodeChildren(node);
78
+ }
79
+ node.expanded = willExpand;
80
+ this.nodes.set([...this.nodes()]);
81
+ this.nodeToggle.emit({ component: this, node, nativeEvent: event });
82
+ }
83
+ }
84
+ /**
85
+ * Load children for a node using lazy loading
86
+ */
87
+ async loadNodeChildren(node) {
88
+ const lazyLoadFn = this.lazyLoad();
89
+ if (!lazyLoadFn || node.loading)
90
+ return;
91
+ try {
92
+ node.loading = true;
93
+ this.loadingNodes.update((set) => new Set(set).add(node.id));
94
+ this.nodes.set([...this.nodes()]);
95
+ const children = await lazyLoadFn(node);
96
+ node.children = children;
97
+ node.childrenCount = children.length;
98
+ }
99
+ catch (error) {
100
+ console.error('Failed to load children:', error);
101
+ node.childrenCount = 0;
102
+ }
103
+ finally {
104
+ node.loading = false;
105
+ this.loadingNodes.update((set) => {
106
+ const newSet = new Set(set);
107
+ newSet.delete(node.id);
108
+ return newSet;
109
+ });
110
+ this.nodes.set([...this.nodes()]);
111
+ }
112
+ }
113
+ /**
114
+ * Update childrenCount flags for lazy loading
115
+ */
116
+ updateHasChildrenFlags(nodes) {
117
+ nodes.forEach((node) => {
118
+ if (node.childrenCount === undefined && !node.children) {
119
+ node.childrenCount = 0;
120
+ }
121
+ if (node.children) {
122
+ this.updateHasChildrenFlags(node.children);
123
+ }
124
+ });
125
+ }
126
+ /**
127
+ * Toggle node selection state with indeterminate support
128
+ */
129
+ toggleSelection(node, event) {
130
+ // CRITICAL: Only process if this is a real user interaction
131
+ // Prevents cascade when parent state changes trigger checkbox ngModelChange
132
+ if (!event.isUserInteraction) {
133
+ return;
134
+ }
135
+ // Handle null value (indeterminate state clicked) - treat as select
136
+ const newValue = event.value === null ? true : event.value;
137
+ node.selected = newValue;
138
+ node.indeterminate = false; // Clear indeterminate when explicitly toggled
139
+ // Select/deselect all children recursively
140
+ if (node.children) {
141
+ this.selectAllChildren(node.children, newValue);
142
+ }
143
+ // Update parent states up the tree
144
+ this.updateParentStates(this.nodes(), node);
145
+ this.nodes.set([...this.nodes()]);
146
+ this.nodeSelect.emit({
147
+ component: this,
148
+ node,
149
+ isUserInteraction: event.isUserInteraction,
150
+ });
151
+ }
152
+ /**
153
+ * Recursively select/deselect all children
154
+ */
155
+ selectAllChildren(children, selected) {
156
+ children.forEach((child) => {
157
+ child.selected = selected;
158
+ child.indeterminate = false;
159
+ if (child.children) {
160
+ this.selectAllChildren(child.children, selected);
161
+ }
162
+ });
163
+ }
164
+ /**
165
+ * Update parent node states based on children selection
166
+ */
167
+ updateParentStates(nodes, changedNode) {
168
+ const parent = this.findParentNode(nodes, changedNode);
169
+ if (!parent || !parent.children)
170
+ return;
171
+ const { allSelected, someSelected } = this.getChildrenSelectionState(parent.children);
172
+ if (allSelected) {
173
+ // All children selected → parent is selected
174
+ parent.selected = true;
175
+ parent.indeterminate = false;
176
+ }
177
+ else if (someSelected) {
178
+ // Some children selected → parent is indeterminate
179
+ // Keep selected=true to maintain consistent state and prevent issues with deleteSelected()
180
+ parent.selected = true;
181
+ parent.indeterminate = true;
182
+ }
183
+ else {
184
+ // No children selected → parent is unselected
185
+ parent.selected = false;
186
+ parent.indeterminate = false;
187
+ }
188
+ // Recursively update grandparents
189
+ this.updateParentStates(nodes, parent);
190
+ }
191
+ /**
192
+ * Get selection state of children
193
+ */
194
+ getChildrenSelectionState(children) {
195
+ let selectedCount = 0;
196
+ let indeterminateCount = 0;
197
+ children.forEach((child) => {
198
+ // Only count fully selected children (not indeterminate)
199
+ if (child.selected && !child.indeterminate)
200
+ selectedCount++;
201
+ if (child.indeterminate)
202
+ indeterminateCount++;
203
+ });
204
+ const allSelected = selectedCount === children.length;
205
+ const someSelected = selectedCount > 0 || indeterminateCount > 0;
206
+ return { allSelected, someSelected };
207
+ }
208
+ /**
209
+ * Find parent node of a given node
210
+ */
211
+ findParentNode(nodes, targetNode) {
212
+ for (const node of nodes) {
213
+ if (node.children?.some((child) => child.id === targetNode.id)) {
214
+ return node;
215
+ }
216
+ if (node.children) {
217
+ const found = this.findParentNode(node.children, targetNode);
218
+ if (found)
219
+ return found;
220
+ }
221
+ }
222
+ return undefined;
223
+ }
224
+ /**
225
+ * Handle drop events for tree nodes
226
+ */
227
+ onDrop(event, parentNode) {
228
+ const targetArray = parentNode?.children ?? this.nodes();
229
+ if (event.previousContainer === event.container) {
230
+ // Reordering within the same list
231
+ moveItemInArray(targetArray, event.previousIndex, event.currentIndex);
232
+ }
233
+ else {
234
+ // Moving between different lists
235
+ const sourceListId = event.previousContainer.element.id;
236
+ const sourceArray = this.getArrayByListId(sourceListId);
237
+ if (sourceArray) {
238
+ const movedNode = sourceArray[event.previousIndex];
239
+ // CRITICAL: Prevent dropping a node into its own descendants (circular reference)
240
+ if (parentNode && this.isNodeDescendantOf(parentNode, movedNode)) {
241
+ console.warn('Cannot drop a node into its own descendants');
242
+ // Do NOT transfer the item - just return early
243
+ return;
244
+ }
245
+ // Emit beforeDrop event - user can cancel by setting canceled = true
246
+ const beforeDropEvent = {
247
+ component: this,
248
+ movedNode,
249
+ previousParent: this.findParentByListId(sourceListId),
250
+ currentParent: parentNode,
251
+ previousIndex: event.previousIndex,
252
+ currentIndex: event.currentIndex,
253
+ canceled: false,
254
+ };
255
+ this.onBeforeDrop.emit(beforeDropEvent);
256
+ if (beforeDropEvent.canceled) {
257
+ console.warn('Drop canceled by user in onBeforeDrop event');
258
+ return;
259
+ }
260
+ transferArrayItem(sourceArray, targetArray, event.previousIndex, event.currentIndex);
261
+ // Emit drop event
262
+ this.nodeDrop.emit({
263
+ component: this,
264
+ node: movedNode,
265
+ previousParent: this.findParentByListId(sourceListId),
266
+ currentParent: parentNode,
267
+ previousIndex: event.previousIndex,
268
+ currentIndex: event.currentIndex,
269
+ });
270
+ }
271
+ }
272
+ // Update the signal to trigger change detection
273
+ this.nodes.set([...this.nodes()]);
274
+ }
275
+ /**
276
+ * Handle drop events when dropping directly onto a node (to make it a child)
277
+ */
278
+ onDropOntoNode(event, targetNode) {
279
+ const sourceListId = event.previousContainer.element.id;
280
+ const sourceArray = this.getArrayByListId(sourceListId);
281
+ if (!sourceArray)
282
+ return;
283
+ const movedNode = sourceArray[event.previousIndex];
284
+ // CRITICAL: Prevent dropping a node onto itself or its descendants
285
+ if (movedNode.id === targetNode.id || this.isNodeDescendantOf(targetNode, movedNode)) {
286
+ console.warn('Cannot drop a node onto itself or its descendants');
287
+ return;
288
+ }
289
+ // Emit beforeDrop event - user can cancel by setting canceled = true
290
+ const beforeDropEvent = {
291
+ component: this,
292
+ movedNode,
293
+ previousParent: this.findParentByListId(sourceListId),
294
+ currentParent: targetNode,
295
+ previousIndex: event.previousIndex,
296
+ currentIndex: 0, // Always first child when dropping onto node
297
+ canceled: false,
298
+ };
299
+ this.onBeforeDrop.emit(beforeDropEvent);
300
+ if (beforeDropEvent.canceled) {
301
+ console.warn('Drop canceled by user in onBeforeDrop event');
302
+ return;
303
+ }
304
+ // Initialize children array if it doesn't exist
305
+ if (!targetNode.children) {
306
+ targetNode.children = [];
307
+ }
308
+ // Remove from source
309
+ sourceArray.splice(event.previousIndex, 1);
310
+ // Add as first child of target node
311
+ targetNode.children.unshift(movedNode);
312
+ // Auto-expand the target node to show the new child
313
+ targetNode.expanded = true;
314
+ // Emit drop event
315
+ this.nodeDrop.emit({
316
+ component: this,
317
+ node: movedNode,
318
+ previousParent: this.findParentByListId(sourceListId),
319
+ currentParent: targetNode,
320
+ previousIndex: event.previousIndex,
321
+ currentIndex: 0,
322
+ });
323
+ // Update the signal to trigger change detection
324
+ this.nodes.set([...this.nodes()]);
325
+ }
326
+ /**
327
+ * Get array reference by drop list ID
328
+ */
329
+ getArrayByListId(listId) {
330
+ if (listId === 'ax-tree-root-list') {
331
+ return this.nodes();
332
+ }
333
+ // Handle node drop zones (dropping onto a node)
334
+ if (listId.startsWith('ax-tree-node-drop-')) {
335
+ const nodeId = listId.replace('ax-tree-node-drop-', '');
336
+ const node = this.findNodeById(this.nodes(), nodeId);
337
+ return node ? [node] : null;
338
+ }
339
+ // Handle children list drop zones
340
+ const nodeId = listId.replace('ax-tree-list-', '');
341
+ const node = this.findNodeById(this.nodes(), nodeId);
342
+ return node?.children || null;
343
+ }
344
+ /**
345
+ * Find parent node by list ID
346
+ */
347
+ findParentByListId(listId) {
348
+ if (listId === 'ax-tree-root-list') {
349
+ return undefined;
350
+ }
351
+ // Handle node drop zones
352
+ if (listId.startsWith('ax-tree-node-drop-')) {
353
+ const nodeId = listId.replace('ax-tree-node-drop-', '');
354
+ return this.findNodeById(this.nodes(), nodeId) || undefined;
355
+ }
356
+ // Handle children list drop zones
357
+ const nodeId = listId.replace('ax-tree-list-', '');
358
+ return this.findNodeById(this.nodes(), nodeId) || undefined;
359
+ }
360
+ /**
361
+ * Find a node by ID in the tree
362
+ */
363
+ findNodeById(nodes, id) {
364
+ for (const node of nodes) {
365
+ if (node.id === id)
366
+ return node;
367
+ if (node.children) {
368
+ const found = this.findNodeById(node.children, id);
369
+ if (found)
370
+ return found;
371
+ }
372
+ }
373
+ return null;
374
+ }
375
+ /**
376
+ * Check if targetNode is a descendant of ancestorNode (or the same node)
377
+ * Prevents circular references by checking if target exists in ancestor's children tree
378
+ */
379
+ isNodeDescendantOf(targetNode, ancestorNode) {
380
+ // First check: prevent dropping a node into itself
381
+ if (targetNode.id === ancestorNode.id) {
382
+ return true;
383
+ }
384
+ if (!ancestorNode.children || ancestorNode.children.length === 0) {
385
+ return false;
386
+ }
387
+ for (const child of ancestorNode.children) {
388
+ // Direct child match
389
+ if (child.id === targetNode.id) {
390
+ return true;
391
+ }
392
+ // Recursive check in deeper levels
393
+ if (this.isNodeDescendantOf(targetNode, child)) {
394
+ return true;
395
+ }
396
+ }
397
+ return false;
398
+ }
399
+ /**
400
+ * Generate unique list ID for each node
401
+ */
402
+ getListId(node) {
403
+ return node ? `ax-tree-list-${node.id}` : 'ax-tree-root-list';
404
+ }
405
+ /**
406
+ * Expand all nodes in the tree (with lazy loading support)
407
+ */
408
+ async expandAll() {
409
+ await this.setExpandedState(this.nodes(), true);
410
+ this.nodes.set([...this.nodes()]);
411
+ }
412
+ /**
413
+ * Collapse all nodes in the tree
414
+ */
415
+ collapseAll() {
416
+ this.setExpandedState(this.nodes(), false);
417
+ this.nodes.set([...this.nodes()]);
418
+ }
419
+ /**
420
+ * Recursively set expanded state (with lazy loading)
421
+ */
422
+ async setExpandedState(nodes, expanded) {
423
+ for (const node of nodes) {
424
+ const hasChildren = node.children && node.children.length > 0;
425
+ const canLazyLoad = this.enableLazyLoad() && node.childrenCount && node.childrenCount > 0 && !hasChildren;
426
+ if (hasChildren || canLazyLoad) {
427
+ if (expanded && canLazyLoad) {
428
+ await this.loadNodeChildren(node);
429
+ }
430
+ node.expanded = expanded;
431
+ if (node.children) {
432
+ await this.setExpandedState(node.children, expanded);
433
+ }
434
+ }
435
+ }
436
+ }
437
+ /**
438
+ * Get count of selected nodes
439
+ */
440
+ getSelectedCount() {
441
+ return this.countSelected(this.nodes());
442
+ }
443
+ /**
444
+ * Recursively count selected nodes
445
+ */
446
+ countSelected(nodes) {
447
+ let count = 0;
448
+ nodes.forEach((node) => {
449
+ if (node.selected)
450
+ count++;
451
+ if (node.children) {
452
+ count += this.countSelected(node.children);
453
+ }
454
+ });
455
+ return count;
456
+ }
457
+ /**
458
+ * Get all selected nodes
459
+ */
460
+ getSelectedNodes() {
461
+ const selected = [];
462
+ this.collectSelected(this.nodes(), selected);
463
+ return selected;
464
+ }
465
+ /**
466
+ * Recursively collect selected nodes
467
+ */
468
+ collectSelected(nodes, result) {
469
+ nodes.forEach((node) => {
470
+ if (node.selected)
471
+ result.push(node);
472
+ if (node.children) {
473
+ this.collectSelected(node.children, result);
474
+ }
475
+ });
476
+ }
477
+ /**
478
+ * Delete selected nodes from the tree
479
+ */
480
+ deleteSelected() {
481
+ this.removeSelected(this.nodes());
482
+ // Update all parent states after deletion to clear stale indeterminate states
483
+ this.updateAllParentStates(this.nodes());
484
+ this.nodes.set([...this.nodes()]);
485
+ }
486
+ /**
487
+ * Recursively remove selected nodes
488
+ */
489
+ removeSelected(nodes) {
490
+ for (let i = nodes.length - 1; i >= 0; i--) {
491
+ // Only delete nodes that are fully selected (not indeterminate)
492
+ // Indeterminate parents should not be deleted
493
+ if (nodes[i].selected && !nodes[i].indeterminate) {
494
+ nodes.splice(i, 1);
495
+ }
496
+ else if (nodes[i].children) {
497
+ this.removeSelected(nodes[i].children ?? []);
498
+ }
499
+ }
500
+ }
501
+ /**
502
+ * Recursively update all parent states in the tree (used after deletion)
503
+ */
504
+ updateAllParentStates(nodes) {
505
+ nodes.forEach((node) => {
506
+ if (node.children && node.children.length > 0) {
507
+ // First, recursively update nested children (bottom-up)
508
+ this.updateAllParentStates(node.children);
509
+ // Then update this node's state based on its children
510
+ const { allSelected, someSelected } = this.getChildrenSelectionState(node.children);
511
+ if (allSelected) {
512
+ node.selected = true;
513
+ node.indeterminate = false;
514
+ }
515
+ else if (someSelected) {
516
+ node.selected = true;
517
+ node.indeterminate = true;
518
+ }
519
+ else {
520
+ node.selected = false;
521
+ node.indeterminate = false;
522
+ }
523
+ }
524
+ });
525
+ }
526
+ /**
527
+ * Check if a node is currently loading
528
+ */
529
+ isNodeLoading(nodeId) {
530
+ return this.loadingNodes().has(nodeId);
531
+ }
532
+ /**
533
+ * Get template context for a node
534
+ */
535
+ getTemplateContext(node, level = 0) {
536
+ return {
537
+ $implicit: node,
538
+ node,
539
+ level,
540
+ expanded: node.expanded ?? false,
541
+ childrenCount: node.childrenCount ?? node.children?.length ?? 0,
542
+ loading: node.loading ?? false,
543
+ };
544
+ }
545
+ /**
546
+ * Check if node should show expand toggle
547
+ */
548
+ shouldShowExpandToggle(node) {
549
+ return ((node.children && node.children.length > 0) ||
550
+ (this.enableLazyLoad() && node.childrenCount && node.childrenCount > 0) ||
551
+ false);
552
+ }
553
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: AXTree2Component, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
554
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.6", 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 }, showIcons: { classPropertyName: "showIcons", publicName: "showIcons", isSignal: true, isRequired: false, transformFunction: null }, showChildrenBadge: { classPropertyName: "showChildrenBadge", publicName: "showChildrenBadge", isSignal: true, isRequired: false, transformFunction: null }, animated: { classPropertyName: "animated", publicName: "animated", 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", nodeToggle: "nodeToggle", nodeSelect: "nodeSelect", nodeDrop: "nodeDrop" }, host: { properties: { "class.ax-tree2-default": "look() === 'default'", "class.ax-tree2-card": "look() === 'card'", "class.ax-tree2-with-line": "look() === 'with-line'", "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-animated]=\"animated()\"\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 [class]=\"node.expanded ? expandedIcon() : collapsedIcon()\" class=\"ax-tree2-toggle-icon\"></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]=\"(level * indentSize()) / (look() === 'with-line' ? 3 : 1)\"\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 [class]=\"node.expanded ? expandedIcon() : collapsedIcon()\" class=\"ax-tree2-toggle-icon\"></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: .125rem;--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:.25rem;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-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}\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 }); }
555
+ }
556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: AXTree2Component, decorators: [{
557
+ type: Component,
558
+ args: [{ selector: 'ax-tree2', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
559
+ CommonModule,
560
+ FormsModule,
561
+ AXDragDirective,
562
+ AXDragHandleDirective,
563
+ AXDropListDirective,
564
+ NgTemplateOutlet,
565
+ AXButtonComponent,
566
+ AXCheckBoxComponent,
567
+ AXBadgeComponent,
568
+ AXDecoratorIconComponent,
569
+ ], host: {
570
+ class: 'ax-tree2',
571
+ '[class.ax-tree2-default]': "look() === 'default'",
572
+ '[class.ax-tree2-card]': "look() === 'card'",
573
+ '[class.ax-tree2-with-line]': "look() === 'with-line'",
574
+ '[style.--ax-tree-indent-size]': "indentSize() + 'px'",
575
+ '[style.--ax-tree-line-offset]': "(indentSize() / 2) + 'px'",
576
+ }, 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-animated]=\"animated()\"\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 [class]=\"node.expanded ? expandedIcon() : collapsedIcon()\" class=\"ax-tree2-toggle-icon\"></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]=\"(level * indentSize()) / (look() === 'with-line' ? 3 : 1)\"\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 [class]=\"node.expanded ? expandedIcon() : collapsedIcon()\" class=\"ax-tree2-toggle-icon\"></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: .125rem;--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:.25rem;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-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}\n"] }]
577
+ }], 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 }] }], showIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcons", required: false }] }], showChildrenBadge: [{ type: i0.Input, args: [{ isSignal: true, alias: "showChildrenBadge", required: false }] }], animated: [{ type: i0.Input, args: [{ isSignal: true, alias: "animated", 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"] }], nodeToggle: [{ type: i0.Output, args: ["nodeToggle"] }], nodeSelect: [{ type: i0.Output, args: ["nodeSelect"] }], nodeDrop: [{ type: i0.Output, args: ["nodeDrop"] }] } });
578
+
579
+ class Tree2Module {
580
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: Tree2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
581
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.6", ngImport: i0, type: Tree2Module, imports: [CommonModule] }); }
582
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: Tree2Module, imports: [CommonModule] }); }
583
+ }
584
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: Tree2Module, decorators: [{
585
+ type: NgModule,
586
+ args: [{
587
+ imports: [CommonModule],
588
+ }]
589
+ }] });
590
+
591
+ /**
592
+ * Generated bundle index. Do not edit.
593
+ */
594
+
595
+ export { AXTree2Component, Tree2Module };
596
+ //# sourceMappingURL=acorex-components-tree2.mjs.map