@ngstarter-ui/components 21.0.25 → 21.0.27

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.
@@ -1,6 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ViewContainerRef, Directive, viewChild, ChangeDetectionStrategy, Component, input, numberAttribute, booleanAttribute, HostAttributeToken, effect } from '@angular/core';
2
+ import { inject, ViewContainerRef, Directive, input, booleanAttribute, output, signal, effect, ViewChild, ChangeDetectionStrategy, Component, createComponent, ElementRef, Renderer2, ApplicationRef, EnvironmentInjector, PLATFORM_ID, numberAttribute, HostAttributeToken } from '@angular/core';
3
3
  import { CDK_TREE_NODE_OUTLET_NODE, CdkTreeNodeOutlet, CdkTree, CdkTreeNode, CdkNestedTreeNode, CdkTreeNodePadding, CdkTreeNodeToggle, CdkTreeNodeDef } from '@angular/cdk/tree';
4
+ import { isPlatformBrowser } from '@angular/common';
5
+ import { Checkbox } from '@ngstarter-ui/components/checkbox';
4
6
 
5
7
  class TreeNodeOutlet {
6
8
  viewContainer = inject(ViewContainerRef);
@@ -26,12 +28,552 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
26
28
  standalone: true
27
29
  }]
28
30
  }] });
31
+ const NGS_TREE_DEFAULT_FILTER_PREDICATE = (node, filterValue) => {
32
+ const query = filterValue.trim().toLowerCase();
33
+ if (!query) {
34
+ return true;
35
+ }
36
+ const candidates = node && typeof node === 'object'
37
+ ? [
38
+ node['name'],
39
+ node['label'],
40
+ node['title'],
41
+ node['value'],
42
+ ]
43
+ : [node];
44
+ return candidates.some(value => value != null && String(value).toLowerCase().includes(query));
45
+ };
29
46
  class Tree extends CdkTree {
30
- // Outlets within the tree's template where the dataNodes will be inserted.
31
- // We need an initializer here to avoid a TS error. The value will be set in `ngAfterViewInit`.
32
- _nodeOutlet = viewChild(TreeNodeOutlet);
33
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: Tree, deps: null, target: i0.ɵɵFactoryTarget.Component });
34
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.4", type: Tree, isStandalone: true, selector: "ngs-tree", host: { classAttribute: "ngs-tree" }, providers: [{ provide: CdkTree, useExisting: Tree }], viewQueries: [{ propertyName: "_nodeOutlet", first: true, predicate: TreeNodeOutlet, descendants: true, isSignal: true }], exportAs: ["ngsTree"], usesInheritance: true, ngImport: i0, template: `<ng-container ngsTreeNodeOutlet />`, isInline: true, styles: [":host{display:block;background:var(--ngs-tree-container-background-color, transparent)}:host ::ng-deep .ngs-tree-node,:host ::ng-deep .ngs-nested-tree-node{color:var(--ngs-tree-node-text-color, inherit);font-family:var(--ngs-tree-node-text-font, inherit);font-size:var(--ngs-tree-node-text-size, inherit);font-weight:var(--ngs-tree-node-text-weight, inherit)}:host ::ng-deep .ngs-tree-node{display:flex;align-items:center;flex:1;word-wrap:break-word;min-height:var(--ngs-tree-node-min-height, 48px);box-sizing:border-box}:host ::ng-deep .ngs-nested-tree-node{border-bottom-width:0}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: TreeNodeOutlet, selector: "[ngsTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
47
+ get dataSource() {
48
+ return this._sourceDataSource ?? [];
49
+ }
50
+ set dataSource(dataSource) {
51
+ if (this._sourceDataSource !== dataSource) {
52
+ this._sourceDataSource = dataSource;
53
+ this._applyFilteredDataSource();
54
+ }
55
+ }
56
+ checkable = input(false, { ...(ngDevMode ? { debugName: "checkable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
57
+ selectable = input(false, { ...(ngDevMode ? { debugName: "selectable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
58
+ draggable = input(false, { ...(ngDevMode ? { debugName: "draggable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
59
+ childrenKey = input('children', ...(ngDevMode ? [{ debugName: "childrenKey" }] : /* istanbul ignore next */ []));
60
+ filterValue = input('', { ...(ngDevMode ? { debugName: "filterValue" } : /* istanbul ignore next */ {}), transform: (value) => value == null ? '' : String(value) });
61
+ filterPredicate = input(NGS_TREE_DEFAULT_FILTER_PREDICATE, ...(ngDevMode ? [{ debugName: "filterPredicate" }] : /* istanbul ignore next */ []));
62
+ filterMode = input('includeAncestors', ...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
63
+ checkedChange = output();
64
+ selectedChange = output();
65
+ nodeDrop = output();
66
+ _checkStateVersion = signal(0, ...(ngDevMode ? [{ debugName: "_checkStateVersion" }] : /* istanbul ignore next */ []));
67
+ _selectedKey = signal(undefined, ...(ngDevMode ? [{ debugName: "_selectedKey" }] : /* istanbul ignore next */ []));
68
+ _dropTargetKey = signal(undefined, ...(ngDevMode ? [{ debugName: "_dropTargetKey" }] : /* istanbul ignore next */ []));
69
+ _dropTargetPosition = signal(undefined, ...(ngDevMode ? [{ debugName: "_dropTargetPosition" }] : /* istanbul ignore next */ []));
70
+ _checkedKeys = new Set();
71
+ _nodeValueByDataKey = new Map();
72
+ _disabledDataKeys = new Set();
73
+ _enabledDataKeys = new Set();
74
+ _draggedNode;
75
+ _sourceDataSource;
76
+ _filteredNodeOriginals = new WeakMap();
77
+ _nodeOutlet = undefined;
78
+ constructor() {
79
+ super();
80
+ effect(() => {
81
+ this.filterValue();
82
+ this.filterPredicate();
83
+ this.filterMode();
84
+ this._applyFilteredDataSource();
85
+ });
86
+ }
87
+ _toggleNodeChecked(node, checked) {
88
+ if (this._isNodeDisabled(node)) {
89
+ return;
90
+ }
91
+ const nodes = [node, ...this._getCheckableDescendants(node)].filter(item => !this._isNodeDisabled(item));
92
+ for (const item of nodes) {
93
+ const key = this._getCheckableNodeKey(item);
94
+ if (checked) {
95
+ this._checkedKeys.add(key);
96
+ }
97
+ else {
98
+ this._checkedKeys.delete(key);
99
+ }
100
+ }
101
+ this._syncCheckedParentKeys();
102
+ this._checkStateVersion.update(value => value + 1);
103
+ this.checkedChange.emit(this._getCheckedValues());
104
+ }
105
+ _isNodeChecked(node) {
106
+ if (this._isNodeDisabled(node)) {
107
+ return false;
108
+ }
109
+ const descendants = this._getCheckableDescendants(node).filter(item => !this._isNodeDisabled(item));
110
+ if (!descendants.length) {
111
+ return this._checkedKeys.has(this._getCheckableNodeKey(node));
112
+ }
113
+ return descendants.every(item => this._checkedKeys.has(this._getCheckableNodeKey(item)));
114
+ }
115
+ _isNodeIndeterminate(node) {
116
+ if (this._isNodeDisabled(node)) {
117
+ return false;
118
+ }
119
+ const descendants = this._getCheckableDescendants(node).filter(item => !this._isNodeDisabled(item));
120
+ if (!descendants.length) {
121
+ return false;
122
+ }
123
+ const selectedCount = descendants.filter(item => this._checkedKeys.has(this._getCheckableNodeKey(item))).length;
124
+ return selectedCount > 0 && selectedCount < descendants.length;
125
+ }
126
+ _selectNode(node) {
127
+ if (this._isNodeDisabled(node)) {
128
+ return;
129
+ }
130
+ const value = this._getTreeNodeValue(node);
131
+ if (Object.is(this._selectedKey(), value)) {
132
+ return;
133
+ }
134
+ this._selectedKey.set(value);
135
+ this.selectedChange.emit(value);
136
+ }
137
+ _isNodeSelected(node) {
138
+ return !this._isNodeDisabled(node) && Object.is(this._selectedKey(), this._getTreeNodeValue(node));
139
+ }
140
+ _canDragNode(node) {
141
+ return node !== undefined && this.draggable() && !this._isNodeDisabled(node);
142
+ }
143
+ _isNodeDropTarget(node) {
144
+ return node !== undefined && Object.is(this._dropTargetKey(), this._getTreeNodeDataKey(node));
145
+ }
146
+ _isNodeDropTargetPosition(node, position) {
147
+ return this._isNodeDropTarget(node) && this._dropTargetPosition() === position;
148
+ }
149
+ _startNodeDrag(node, event) {
150
+ if (!this._canDragNode(node)) {
151
+ event.preventDefault();
152
+ return;
153
+ }
154
+ this._draggedNode = node;
155
+ if (event.dataTransfer) {
156
+ event.dataTransfer.effectAllowed = 'move';
157
+ event.dataTransfer.setData('text/plain', String(this._getTreeNodeValue(node) ?? ''));
158
+ }
159
+ }
160
+ _dragNodeOver(node, event) {
161
+ const position = this._getDropPosition(event);
162
+ if (!this._canDropNode(node, position)) {
163
+ return;
164
+ }
165
+ event.preventDefault();
166
+ event.stopPropagation();
167
+ if (event.dataTransfer) {
168
+ event.dataTransfer.dropEffect = 'move';
169
+ }
170
+ this._dropTargetKey.set(this._getTreeNodeDataKey(node));
171
+ this._dropTargetPosition.set(position);
172
+ }
173
+ _dragNodeLeave(node, event) {
174
+ event.stopPropagation();
175
+ if (Object.is(this._dropTargetKey(), this._getTreeNodeDataKey(node))) {
176
+ this._dropTargetKey.set(undefined);
177
+ this._dropTargetPosition.set(undefined);
178
+ }
179
+ }
180
+ _dropNodeInto(node, event) {
181
+ const position = this._dropTargetPosition() ?? this._getDropPosition(event);
182
+ if (!this._canDropNode(node, position)) {
183
+ return;
184
+ }
185
+ event.preventDefault();
186
+ event.stopPropagation();
187
+ const source = this._draggedNode;
188
+ const moved = this._moveNode(source, node, position);
189
+ this._clearNodeDrag();
190
+ if (moved) {
191
+ this.nodeDrop.emit({
192
+ source,
193
+ target: node,
194
+ position,
195
+ sourceValue: this._getTreeNodeValue(source),
196
+ targetValue: this._getTreeNodeValue(node),
197
+ dataSource: this._getRootNodes() ?? [],
198
+ });
199
+ }
200
+ }
201
+ _endNodeDrag() {
202
+ this._clearNodeDrag();
203
+ }
204
+ _registerNodeValue(node, value) {
205
+ const key = this._getTreeNodeDataKey(node);
206
+ this._nodeValueByDataKey.set(key, value);
207
+ }
208
+ _unregisterNodeValueByDataKey(key) {
209
+ this._nodeValueByDataKey.delete(key);
210
+ }
211
+ _registerNodeDisabled(node, disabled) {
212
+ const key = this._getTreeNodeDataKey(node);
213
+ if (disabled) {
214
+ const checkedKey = this._getCheckableNodeKey(node);
215
+ const wasChecked = this._checkedKeys.has(checkedKey);
216
+ this._disabledDataKeys.add(key);
217
+ this._enabledDataKeys.delete(key);
218
+ this._checkedKeys.delete(checkedKey);
219
+ if (Object.is(this._selectedKey(), this._getTreeNodeValue(node))) {
220
+ this._selectedKey.set(undefined);
221
+ this.selectedChange.emit(undefined);
222
+ }
223
+ if (wasChecked) {
224
+ this._syncCheckedParentKeys();
225
+ this._checkStateVersion.update(value => value + 1);
226
+ this.checkedChange.emit(this._getCheckedValues());
227
+ }
228
+ }
229
+ else {
230
+ this._disabledDataKeys.delete(key);
231
+ this._enabledDataKeys.add(key);
232
+ }
233
+ }
234
+ _unregisterNodeDisabledByDataKey(key) {
235
+ this._disabledDataKeys.delete(key);
236
+ this._enabledDataKeys.delete(key);
237
+ }
238
+ _isNodeDisabled(node) {
239
+ const key = this._getTreeNodeDataKey(node);
240
+ if (this._enabledDataKeys.has(key)) {
241
+ return false;
242
+ }
243
+ return this._disabledDataKeys.has(key) || node?.disabled === true;
244
+ }
245
+ _getTreeNodeDataKey(node) {
246
+ return this._getTreeNodeKey(node);
247
+ }
248
+ _getTreeNodeValue(node) {
249
+ const key = this._getTreeNodeDataKey(node);
250
+ return this._nodeValueByDataKey.has(key) ? this._nodeValueByDataKey.get(key) : key;
251
+ }
252
+ _canDropNode(target, position) {
253
+ const source = this._draggedNode;
254
+ return !!source
255
+ && this.draggable()
256
+ && !this._isNodeDisabled(target)
257
+ && !this._isSameNode(source, target)
258
+ && !this._isNodeDescendantOf(target, source);
259
+ }
260
+ _moveNode(source, target, position) {
261
+ const rootNodes = this._getRootNodes();
262
+ if (!rootNodes) {
263
+ return false;
264
+ }
265
+ const moved = position === 'inside'
266
+ ? this._moveNodeInto(source, target, rootNodes)
267
+ : this._moveNodeBeside(source, target, position, rootNodes);
268
+ if (!moved) {
269
+ return false;
270
+ }
271
+ this._refreshTreeData(rootNodes);
272
+ this._syncCheckedParentKeys();
273
+ this._checkStateVersion.update(value => value + 1);
274
+ return true;
275
+ }
276
+ _moveNodeInto(source, target, rootNodes) {
277
+ const sourceLocation = this._removeNodeFrom(rootNodes, source);
278
+ if (!sourceLocation) {
279
+ return false;
280
+ }
281
+ const targetChildren = this._getMutableNodeChildren(target);
282
+ if (!targetChildren) {
283
+ sourceLocation.items.splice(sourceLocation.index, 0, source);
284
+ return false;
285
+ }
286
+ targetChildren.push(source);
287
+ this.expand?.(target);
288
+ return true;
289
+ }
290
+ _moveNodeBeside(source, target, position, rootNodes) {
291
+ const sourceLocation = this._removeNodeFrom(rootNodes, source);
292
+ if (!sourceLocation) {
293
+ return false;
294
+ }
295
+ const targetLocation = this._findNodeLocation(rootNodes, target);
296
+ if (!targetLocation) {
297
+ sourceLocation.items.splice(sourceLocation.index, 0, source);
298
+ return false;
299
+ }
300
+ const insertIndex = position === 'before' ? targetLocation.index : targetLocation.index + 1;
301
+ targetLocation.items.splice(insertIndex, 0, source);
302
+ return true;
303
+ }
304
+ _findNodeLocation(nodes, target) {
305
+ for (let i = 0; i < nodes.length; i++) {
306
+ const node = nodes[i];
307
+ if (this._isSameNode(node, target)) {
308
+ return { items: nodes, index: i };
309
+ }
310
+ const children = this._getDataNodeChildren(node);
311
+ if (Array.isArray(children)) {
312
+ const location = this._findNodeLocation(children, target);
313
+ if (location) {
314
+ return location;
315
+ }
316
+ }
317
+ }
318
+ return undefined;
319
+ }
320
+ _removeNodeFrom(nodes, source) {
321
+ for (let i = 0; i < nodes.length; i++) {
322
+ const node = nodes[i];
323
+ if (this._isSameNode(node, source)) {
324
+ nodes.splice(i, 1);
325
+ return { items: nodes, index: i };
326
+ }
327
+ const children = this._getDataNodeChildren(node);
328
+ if (Array.isArray(children)) {
329
+ const location = this._removeNodeFrom(children, source);
330
+ if (location) {
331
+ return location;
332
+ }
333
+ }
334
+ }
335
+ return undefined;
336
+ }
337
+ _getRootNodes() {
338
+ return Array.isArray(this.dataSource) ? this.dataSource : undefined;
339
+ }
340
+ _getDataNodeChildren(node) {
341
+ const childrenAccessor = this.childrenAccessor;
342
+ const children = childrenAccessor?.(node);
343
+ return Array.isArray(children) ? children : undefined;
344
+ }
345
+ _getMutableNodeChildren(node) {
346
+ const existingChildren = this._getDataNodeChildren(node);
347
+ if (existingChildren?.length) {
348
+ return existingChildren;
349
+ }
350
+ const childrenKey = this.childrenKey();
351
+ const nodeRecord = node;
352
+ if (!nodeRecord || typeof nodeRecord !== 'object') {
353
+ return existingChildren;
354
+ }
355
+ if (!Array.isArray(nodeRecord[childrenKey])) {
356
+ nodeRecord[childrenKey] = [];
357
+ }
358
+ return nodeRecord[childrenKey];
359
+ }
360
+ _refreshTreeData(rootNodes) {
361
+ if (Array.isArray(this.dataSource)) {
362
+ this.dataSource = [];
363
+ this.dataSource = [...rootNodes];
364
+ return;
365
+ }
366
+ this.renderNodeChanges(rootNodes);
367
+ }
368
+ _applyFilteredDataSource() {
369
+ const source = this._sourceDataSource;
370
+ if (!source) {
371
+ super.dataSource = [];
372
+ return;
373
+ }
374
+ super.dataSource = this._getFilteredDataSource(source);
375
+ }
376
+ _getFilteredDataSource(dataSource) {
377
+ this._filteredNodeOriginals = new WeakMap();
378
+ if (!Array.isArray(dataSource) || !this._isFilterActive()) {
379
+ return dataSource;
380
+ }
381
+ const filteredData = dataSource
382
+ .map(node => this._filterNode(node))
383
+ .filter((node) => node !== undefined);
384
+ this._expandFilteredNodes(filteredData);
385
+ return filteredData;
386
+ }
387
+ _filterNode(node) {
388
+ const filterValue = this.filterValue().trim();
389
+ const children = this._getDataNodeChildren(node) ?? [];
390
+ const matches = this.filterPredicate()(node, filterValue);
391
+ if (matches && this.filterMode() === 'includeDescendants') {
392
+ return node;
393
+ }
394
+ const filteredChildren = children
395
+ .map(child => this._filterNode(child))
396
+ .filter((child) => child !== undefined);
397
+ if (!matches && !filteredChildren.length) {
398
+ return undefined;
399
+ }
400
+ if (filteredChildren.length === children.length) {
401
+ return node;
402
+ }
403
+ return this._cloneNodeWithChildren(node, filteredChildren);
404
+ }
405
+ _cloneNodeWithChildren(node, children) {
406
+ const nodeRecord = node;
407
+ if (!nodeRecord || typeof nodeRecord !== 'object') {
408
+ return node;
409
+ }
410
+ const clone = {
411
+ ...nodeRecord,
412
+ [this.childrenKey()]: children,
413
+ };
414
+ this._filteredNodeOriginals.set(clone, node);
415
+ return clone;
416
+ }
417
+ _expandFilteredNodes(nodes) {
418
+ this._getExpansionModel?.();
419
+ for (const node of nodes) {
420
+ const children = this._getDataNodeChildren(node);
421
+ if (!children?.length) {
422
+ continue;
423
+ }
424
+ this.expand(node);
425
+ this._expandFilteredNodes(children);
426
+ }
427
+ }
428
+ _isFilterActive() {
429
+ return this.filterValue().trim().length > 0;
430
+ }
431
+ _isNodeDescendantOf(node, maybeAncestor) {
432
+ return this._getCheckableDescendants(maybeAncestor).some(item => this._isSameNode(item, node));
433
+ }
434
+ _isSameNode(first, second) {
435
+ return first === second || Object.is(this._getTreeNodeDataKey(first), this._getTreeNodeDataKey(second));
436
+ }
437
+ _getDropPosition(event) {
438
+ const element = event.currentTarget instanceof HTMLElement
439
+ ? event.currentTarget
440
+ : event.target instanceof HTMLElement
441
+ ? event.target
442
+ : null;
443
+ const rect = element?.getBoundingClientRect();
444
+ if (!rect?.height) {
445
+ return 'inside';
446
+ }
447
+ const relativeY = event.clientY - rect.top;
448
+ if (relativeY < rect.height * 0.25) {
449
+ return 'before';
450
+ }
451
+ if (relativeY > rect.height * 0.75) {
452
+ return 'after';
453
+ }
454
+ return 'inside';
455
+ }
456
+ _clearNodeDrag() {
457
+ this._draggedNode = undefined;
458
+ this._dropTargetKey.set(undefined);
459
+ this._dropTargetPosition.set(undefined);
460
+ }
461
+ _getCheckableDescendants(node) {
462
+ const treeControl = this.treeControl;
463
+ const flatNodes = treeControl?.dataNodes?.length
464
+ ? treeControl.dataNodes
465
+ : (this._keyManagerNodes?.value ?? this._flattenedNodes?.value ?? []);
466
+ if (flatNodes.length && treeControl?.getLevel) {
467
+ const nodeKey = this._getTreeNodeKey(node);
468
+ const startIndex = flatNodes.findIndex(item => (item === node || this._getTreeNodeKey(item) === nodeKey));
469
+ if (startIndex > -1) {
470
+ const descendants = [];
471
+ const level = treeControl.getLevel(flatNodes[startIndex]);
472
+ for (let i = startIndex + 1; i < flatNodes.length && treeControl.getLevel(flatNodes[i]) > level; i++) {
473
+ descendants.push(flatNodes[i]);
474
+ }
475
+ return descendants;
476
+ }
477
+ }
478
+ if (treeControl?.getDescendants) {
479
+ return treeControl.getDescendants(node);
480
+ }
481
+ const childrenAccessor = this.childrenAccessor;
482
+ if (!childrenAccessor) {
483
+ return [];
484
+ }
485
+ const descendants = [];
486
+ const collect = (current) => {
487
+ const children = childrenAccessor(current);
488
+ if (!Array.isArray(children)) {
489
+ return;
490
+ }
491
+ for (const child of children) {
492
+ descendants.push(child);
493
+ collect(child);
494
+ }
495
+ };
496
+ collect(node);
497
+ return descendants;
498
+ }
499
+ _getCheckableNodeKey(node) {
500
+ return this._getTreeNodeValue(node);
501
+ }
502
+ _getCheckedValues() {
503
+ return Array.from(this._checkedKeys);
504
+ }
505
+ _syncCheckedParentKeys() {
506
+ const nodes = this._getCheckableNodes();
507
+ for (let i = nodes.length - 1; i >= 0; i--) {
508
+ const node = nodes[i];
509
+ if (this._isNodeDisabled(node)) {
510
+ this._checkedKeys.delete(this._getCheckableNodeKey(node));
511
+ continue;
512
+ }
513
+ const descendants = this._getCheckableDescendants(node).filter(item => !this._isNodeDisabled(item));
514
+ if (!descendants.length) {
515
+ continue;
516
+ }
517
+ const key = this._getCheckableNodeKey(node);
518
+ if (descendants.every(item => this._checkedKeys.has(this._getCheckableNodeKey(item)))) {
519
+ this._checkedKeys.add(key);
520
+ }
521
+ else {
522
+ this._checkedKeys.delete(key);
523
+ }
524
+ }
525
+ }
526
+ _getCheckableNodes() {
527
+ const treeControl = this.treeControl;
528
+ const flatNodes = treeControl?.dataNodes?.length
529
+ ? treeControl.dataNodes
530
+ : (this._keyManagerNodes?.value ?? this._flattenedNodes?.value ?? []);
531
+ if (flatNodes.length) {
532
+ return flatNodes;
533
+ }
534
+ const data = this.dataSource;
535
+ if (!Array.isArray(data)) {
536
+ return [];
537
+ }
538
+ const childrenAccessor = this.childrenAccessor;
539
+ if (!childrenAccessor) {
540
+ return data;
541
+ }
542
+ const nodes = [];
543
+ const collect = (items) => {
544
+ for (const item of items) {
545
+ nodes.push(item);
546
+ const children = childrenAccessor(item);
547
+ if (Array.isArray(children)) {
548
+ collect(children);
549
+ }
550
+ }
551
+ };
552
+ collect(data);
553
+ return nodes;
554
+ }
555
+ _getTreeNodeKey(node) {
556
+ const originalNode = this._getOriginalFilterNode(node);
557
+ const treeControl = this.treeControl;
558
+ if (treeControl?.trackBy) {
559
+ return treeControl.trackBy(originalNode);
560
+ }
561
+ if (this.expansionKey) {
562
+ return this.expansionKey(originalNode);
563
+ }
564
+ if (this.trackBy) {
565
+ return this.trackBy(-1, originalNode);
566
+ }
567
+ return originalNode;
568
+ }
569
+ _getOriginalFilterNode(node) {
570
+ if (node && typeof node === 'object') {
571
+ return this._filteredNodeOriginals.get(node) ?? node;
572
+ }
573
+ return node;
574
+ }
575
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: Tree, deps: [], target: i0.ɵɵFactoryTarget.Component });
576
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: Tree, isStandalone: true, selector: "ngs-tree", inputs: { checkable: { classPropertyName: "checkable", publicName: "checkable", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, childrenKey: { classPropertyName: "childrenKey", publicName: "childrenKey", isSignal: true, isRequired: false, transformFunction: null }, filterValue: { classPropertyName: "filterValue", publicName: "filterValue", isSignal: true, isRequired: false, transformFunction: null }, filterPredicate: { classPropertyName: "filterPredicate", publicName: "filterPredicate", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange", selectedChange: "selectedChange", nodeDrop: "nodeDrop" }, host: { classAttribute: "ngs-tree" }, providers: [{ provide: CdkTree, useExisting: Tree }], viewQueries: [{ propertyName: "_nodeOutlet", first: true, predicate: TreeNodeOutlet, descendants: true, static: true }], exportAs: ["ngsTree"], usesInheritance: true, ngImport: i0, template: `<ng-container ngsTreeNodeOutlet />`, isInline: true, styles: [":host{--ngs-tree-padding: calc(var(--spacing, .25rem) * 3) 0;--ngs-tree-node-padding: var(--ngs-nav-item-padding);--ngs-tree-node-min-height: var(--ngs-nav-item-height);--ngs-tree-node-hover-bg: var(--ngs-nav-item-hover-bg);--ngs-tree-node-active-bg: var(--ngs-nav-item-active-bg);--ngs-tree-node-active-color: var(--ngs-nav-item-active-color);--ngs-tree-node-disabled-opacity: .38;--ngs-tree-node-title-font-size: 1rem;--ngs-tree-node-font-size: var(--ngs-nav-item-font-size);--ngs-tree-node-gap: var(--ngs-nav-item-gap);--ngs-tree-node-radius: var(--ngs-nav-item-radius);--ngs-tree-node-color: var(--ngs-nav-item-color);--ngs-tree-node-hover-color: var(--ngs-nav-item-hover-color);--ngs-tree-gap: calc(var(--spacing, .25rem) * 1);--ngs-tree-node-line-color: var(--ngs-color-neutral);display:flex;flex-direction:column;gap:var(--ngs-tree-gap);padding:var(--ngs-tree-padding);background:var(--ngs-tree-container-background-color, transparent)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: TreeNodeOutlet, selector: "[ngsTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
35
577
  }
36
578
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: Tree, decorators: [{
37
579
  type: Component,
@@ -39,24 +581,173 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
39
581
  TreeNodeOutlet
40
582
  ], template: `<ng-container ngsTreeNodeOutlet />`, changeDetection: ChangeDetectionStrategy.OnPush, providers: [{ provide: CdkTree, useExisting: Tree }], host: {
41
583
  'class': 'ngs-tree',
42
- }, styles: [":host{display:block;background:var(--ngs-tree-container-background-color, transparent)}:host ::ng-deep .ngs-tree-node,:host ::ng-deep .ngs-nested-tree-node{color:var(--ngs-tree-node-text-color, inherit);font-family:var(--ngs-tree-node-text-font, inherit);font-size:var(--ngs-tree-node-text-size, inherit);font-weight:var(--ngs-tree-node-text-weight, inherit)}:host ::ng-deep .ngs-tree-node{display:flex;align-items:center;flex:1;word-wrap:break-word;min-height:var(--ngs-tree-node-min-height, 48px);box-sizing:border-box}:host ::ng-deep .ngs-nested-tree-node{border-bottom-width:0}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
43
- }], propDecorators: { _nodeOutlet: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TreeNodeOutlet), { isSignal: true }] }] } });
584
+ }, styles: [":host{--ngs-tree-padding: calc(var(--spacing, .25rem) * 3) 0;--ngs-tree-node-padding: var(--ngs-nav-item-padding);--ngs-tree-node-min-height: var(--ngs-nav-item-height);--ngs-tree-node-hover-bg: var(--ngs-nav-item-hover-bg);--ngs-tree-node-active-bg: var(--ngs-nav-item-active-bg);--ngs-tree-node-active-color: var(--ngs-nav-item-active-color);--ngs-tree-node-disabled-opacity: .38;--ngs-tree-node-title-font-size: 1rem;--ngs-tree-node-font-size: var(--ngs-nav-item-font-size);--ngs-tree-node-gap: var(--ngs-nav-item-gap);--ngs-tree-node-radius: var(--ngs-nav-item-radius);--ngs-tree-node-color: var(--ngs-nav-item-color);--ngs-tree-node-hover-color: var(--ngs-nav-item-hover-color);--ngs-tree-gap: calc(var(--spacing, .25rem) * 1);--ngs-tree-node-line-color: var(--ngs-color-neutral);display:flex;flex-direction:column;gap:var(--ngs-tree-gap);padding:var(--ngs-tree-padding);background:var(--ngs-tree-container-background-color, transparent)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
585
+ }], ctorParameters: () => [], propDecorators: { checkable: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkable", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], draggable: [{ type: i0.Input, args: [{ isSignal: true, alias: "draggable", required: false }] }], childrenKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "childrenKey", required: false }] }], filterValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterValue", required: false }] }], filterPredicate: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPredicate", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], nodeDrop: [{ type: i0.Output, args: ["nodeDrop"] }], _nodeOutlet: [{
586
+ type: ViewChild,
587
+ args: [TreeNodeOutlet, { static: true }]
588
+ }] } });
44
589
 
590
+ const NGS_TREE_NODE_VALUE_UNSET = Symbol('ngs-tree-node-value-unset');
45
591
  function isNoopTreeKeyManager(keyManager) {
46
592
  return !!keyManager._isNoopTreeKeyManager;
47
593
  }
594
+ function isTreeNodeControlClick(event, host) {
595
+ const target = event.target;
596
+ if (!(target instanceof Element)) {
597
+ return false;
598
+ }
599
+ const control = target.closest('.ngs-tree-node-checkbox, [ngsTreeNodeToggle], [ngstreenodetoggle]');
600
+ return !!control && control !== host;
601
+ }
602
+ class TreeNodeCheckbox {
603
+ _node;
604
+ _tree;
605
+ _elementRef;
606
+ _renderer;
607
+ _appRef;
608
+ _environmentInjector;
609
+ _disabled;
610
+ _isReady = false;
611
+ _wrapperElement;
612
+ _componentRef;
613
+ _unlistenClick;
614
+ _unlistenKeydown;
615
+ _changeSubscription;
616
+ constructor(_node, _tree, _elementRef, _renderer, _appRef, _environmentInjector, _disabled) {
617
+ this._node = _node;
618
+ this._tree = _tree;
619
+ this._elementRef = _elementRef;
620
+ this._renderer = _renderer;
621
+ this._appRef = _appRef;
622
+ this._environmentInjector = _environmentInjector;
623
+ this._disabled = _disabled;
624
+ }
625
+ enable() {
626
+ this._isReady = true;
627
+ this.sync();
628
+ }
629
+ sync() {
630
+ if (!this._isReady) {
631
+ return;
632
+ }
633
+ if (!this._tree.checkable()) {
634
+ this.destroy();
635
+ return;
636
+ }
637
+ const checkbox = this._ensureCheckbox();
638
+ const node = this._node.data;
639
+ const checked = this._tree._isNodeChecked(node);
640
+ const indeterminate = this._tree._isNodeIndeterminate(node);
641
+ checkbox.checked.set(checked);
642
+ checkbox.indeterminate.set(indeterminate);
643
+ checkbox.disabled.set(this._disabled());
644
+ this._componentRef?.changeDetectorRef.detectChanges();
645
+ }
646
+ destroy() {
647
+ this._unlistenClick?.();
648
+ this._unlistenClick = undefined;
649
+ this._unlistenKeydown?.();
650
+ this._unlistenKeydown = undefined;
651
+ this._changeSubscription?.unsubscribe();
652
+ this._changeSubscription = undefined;
653
+ if (this._componentRef) {
654
+ this._appRef.detachView(this._componentRef.hostView);
655
+ this._componentRef.destroy();
656
+ this._componentRef = undefined;
657
+ }
658
+ this._wrapperElement?.remove();
659
+ this._wrapperElement = undefined;
660
+ }
661
+ _ensureCheckbox() {
662
+ if (this._componentRef) {
663
+ return this._componentRef.instance;
664
+ }
665
+ const existingWrapper = this._elementRef.nativeElement.querySelector(':scope > .ngs-tree-node-checkbox');
666
+ const wrapper = existingWrapper ?? this._renderer.createElement('span');
667
+ let checkboxHost = wrapper.querySelector(':scope > ngs-checkbox');
668
+ if (!existingWrapper) {
669
+ this._renderer.addClass(wrapper, 'ngs-tree-node-checkbox');
670
+ checkboxHost = this._renderer.createElement('ngs-checkbox');
671
+ this._renderer.appendChild(wrapper, checkboxHost);
672
+ this._renderer.insertBefore(this._elementRef.nativeElement, wrapper, this._getCheckboxInsertionReference());
673
+ }
674
+ else if (!checkboxHost) {
675
+ checkboxHost = this._renderer.createElement('ngs-checkbox');
676
+ this._renderer.appendChild(wrapper, checkboxHost);
677
+ }
678
+ while (checkboxHost.firstChild) {
679
+ checkboxHost.firstChild.remove();
680
+ }
681
+ this._wrapperElement = wrapper;
682
+ this._componentRef = createComponent(Checkbox, {
683
+ environmentInjector: this._environmentInjector,
684
+ hostElement: checkboxHost,
685
+ });
686
+ this._componentRef.setInput('aria-label', 'Select tree node');
687
+ this._componentRef.setInput('tabIndex', -1);
688
+ this._appRef.attachView(this._componentRef.hostView);
689
+ this._bindCheckboxEvents(wrapper, this._componentRef);
690
+ return this._componentRef.instance;
691
+ }
692
+ _getCheckboxInsertionReference() {
693
+ const host = this._elementRef.nativeElement;
694
+ const firstElement = host.firstElementChild;
695
+ if (firstElement?.matches('button, [ngsTreeNodeToggle], [ngstreenodetoggle], [ngsIconButton], [ngsiconbutton]')) {
696
+ return firstElement.nextSibling;
697
+ }
698
+ return host.firstChild;
699
+ }
700
+ _bindCheckboxEvents(checkboxElement, checkboxRef) {
701
+ this._unlistenClick = this._renderer.listen(checkboxElement, 'click', (event) => {
702
+ event.stopPropagation();
703
+ });
704
+ this._unlistenKeydown = this._renderer.listen(checkboxElement, 'keydown', (event) => {
705
+ event.stopPropagation();
706
+ });
707
+ this._changeSubscription = checkboxRef.instance.change.subscribe((event) => {
708
+ this._tree._toggleNodeChecked(this._node.data, event.checked);
709
+ });
710
+ }
711
+ }
48
712
  class TreeNode extends CdkTreeNode {
713
+ _hostElementRef = inject(ElementRef);
714
+ _renderer = inject(Renderer2);
715
+ _appRef = inject(ApplicationRef);
716
+ _environmentInjector = inject(EnvironmentInjector);
717
+ _platformId = inject(PLATFORM_ID);
718
+ _checkbox;
719
+ _dataChangesSubscription;
720
+ _checkboxEnableHandle;
721
+ _registeredDataKey = NGS_TREE_NODE_VALUE_UNSET;
49
722
  tabIndexInputBinding = input(0, { ...(ngDevMode ? { debugName: "tabIndexInputBinding" } : /* istanbul ignore next */ {}), transform: (value) => (value == null ? 0 : numberAttribute(value)),
50
723
  alias: 'tabIndex' });
724
+ value = input(NGS_TREE_NODE_VALUE_UNSET, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
51
725
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
52
726
  defaultTabIndex = 0;
53
727
  constructor() {
54
728
  super();
729
+ const tree = this._tree;
730
+ this._checkbox = new TreeNodeCheckbox(this, tree, this._hostElementRef, this._renderer, this._appRef, this._environmentInjector, () => this.disabled());
731
+ this._dataChangesSubscription = this._dataChanges.subscribe(() => this._syncNodeState());
732
+ if (isPlatformBrowser(this._platformId)) {
733
+ this._checkboxEnableHandle = setTimeout(() => this._checkbox.enable());
734
+ }
55
735
  const tabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
56
736
  this._tabIndexInputBinding = Number(tabIndex) || this.defaultTabIndex;
57
737
  effect(() => {
58
738
  this.isDisabled = this.disabled();
59
739
  });
740
+ effect(() => {
741
+ tree.checkable();
742
+ tree._checkStateVersion();
743
+ this.disabled();
744
+ this._syncNodeDisabledRegistration();
745
+ this._checkbox.sync();
746
+ });
747
+ effect(() => {
748
+ this.value();
749
+ this._syncNodeState();
750
+ });
60
751
  }
61
752
  _getTabindexAttribute() {
62
753
  if (isNoopTreeKeyManager(this._tree._keyManager)) {
@@ -64,81 +755,313 @@ class TreeNode extends CdkTreeNode {
64
755
  }
65
756
  return this._tabindex;
66
757
  }
758
+ _handleNodeClick(event) {
759
+ this._focusItem();
760
+ this._selectNodeFromEvent(event);
761
+ }
762
+ _isSelectable() {
763
+ return this._tree.selectable() && !this.disabled();
764
+ }
765
+ _isSelected() {
766
+ const tree = this._tree;
767
+ return tree.selectable() && tree._isNodeSelected(this.data);
768
+ }
769
+ _getAriaSelected() {
770
+ return this._tree.selectable() ? this._isSelected() : null;
771
+ }
772
+ _isDraggable() {
773
+ return this._tree._canDragNode(this.data);
774
+ }
775
+ _isDropTarget() {
776
+ return this._tree._isNodeDropTarget(this.data);
777
+ }
778
+ _isDropTargetPosition(position) {
779
+ return this._tree._isNodeDropTargetPosition(this.data, position);
780
+ }
781
+ _getDraggableAttribute() {
782
+ return this._isDraggable() ? true : null;
783
+ }
784
+ _getAriaGrabbed() {
785
+ return this._tree.draggable() ? false : null;
786
+ }
787
+ _handleDragStart(event) {
788
+ this._tree._startNodeDrag(this.data, event);
789
+ }
790
+ _handleDragOver(event) {
791
+ this._tree._dragNodeOver(this.data, event);
792
+ }
793
+ _handleDragLeave(event) {
794
+ this._tree._dragNodeLeave(this.data, event);
795
+ }
796
+ _handleDrop(event) {
797
+ this._tree._dropNodeInto(this.data, event);
798
+ }
799
+ _handleDragEnd() {
800
+ this._tree._endNodeDrag();
801
+ }
802
+ _selectNodeFromEvent(event) {
803
+ if (!this._isSelectable() || this._isTreeControlClick(event)) {
804
+ return;
805
+ }
806
+ this._tree._selectNode(this.data);
807
+ }
808
+ _isTreeControlClick(event) {
809
+ return isTreeNodeControlClick(event, this._hostElementRef.nativeElement);
810
+ }
811
+ _syncNodeState() {
812
+ this._syncNodeValueRegistration();
813
+ this._syncNodeDisabledRegistration();
814
+ this._checkbox.sync();
815
+ }
816
+ _syncNodeValueRegistration() {
817
+ if (this.data === undefined) {
818
+ return;
819
+ }
820
+ const tree = this._tree;
821
+ const key = tree._getTreeNodeDataKey(this.data);
822
+ if (this._registeredDataKey !== NGS_TREE_NODE_VALUE_UNSET && !Object.is(this._registeredDataKey, key)) {
823
+ tree._unregisterNodeValueByDataKey(this._registeredDataKey);
824
+ tree._unregisterNodeDisabledByDataKey(this._registeredDataKey);
825
+ }
826
+ this._registeredDataKey = key;
827
+ if (this.value() === NGS_TREE_NODE_VALUE_UNSET) {
828
+ tree._unregisterNodeValueByDataKey(key);
829
+ }
830
+ else {
831
+ tree._registerNodeValue(this.data, this.value());
832
+ }
833
+ }
834
+ _syncNodeDisabledRegistration() {
835
+ if (this.data === undefined) {
836
+ return;
837
+ }
838
+ this._tree._registerNodeDisabled(this.data, this.disabled());
839
+ }
67
840
  ngOnInit() {
68
841
  super.ngOnInit();
842
+ this._syncNodeState();
69
843
  }
70
844
  ngOnDestroy() {
845
+ if (this._checkboxEnableHandle) {
846
+ clearTimeout(this._checkboxEnableHandle);
847
+ }
848
+ this._dataChangesSubscription?.unsubscribe();
849
+ if (this._registeredDataKey !== NGS_TREE_NODE_VALUE_UNSET) {
850
+ this._tree._unregisterNodeValueByDataKey(this._registeredDataKey);
851
+ this._tree._unregisterNodeDisabledByDataKey(this._registeredDataKey);
852
+ }
853
+ this._checkbox.destroy();
71
854
  super.ngOnDestroy();
72
855
  }
73
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TreeNode, deps: [], target: i0.ɵɵFactoryTarget.Directive });
74
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: TreeNode, isStandalone: true, selector: "ngs-tree-node", inputs: { tabIndexInputBinding: { classPropertyName: "tabIndexInputBinding", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activation: "activation", expandedChange: "expandedChange" }, host: { listeners: { "click": "_focusItem()" }, properties: { "attr.aria-expanded": "_getAriaExpanded()", "attr.aria-level": "level + 1", "attr.aria-posinset": "_getPositionInSet()", "attr.aria-setsize": "_getSetSize()", "tabindex": "_getTabindexAttribute()" }, classAttribute: "ngs-tree-node" }, providers: [{ provide: CdkTreeNode, useExisting: TreeNode }], exportAs: ["ngsTreeNode"], usesInheritance: true, ngImport: i0 });
856
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TreeNode, deps: [], target: i0.ɵɵFactoryTarget.Component });
857
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: TreeNode, isStandalone: true, selector: "ngs-tree-node", inputs: { tabIndexInputBinding: { classPropertyName: "tabIndexInputBinding", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activation: "activation", expandedChange: "expandedChange" }, host: { listeners: { "click": "_handleNodeClick($event)", "dragstart": "_handleDragStart($event)", "dragover": "_handleDragOver($event)", "dragleave": "_handleDragLeave($event)", "drop": "_handleDrop($event)", "dragend": "_handleDragEnd()" }, properties: { "class.ngs-tree-node-selectable": "_isSelectable()", "class.ngs-tree-node-selected": "_isSelected()", "class.ngs-tree-node-disabled": "disabled()", "class.ngs-tree-node-draggable": "_isDraggable()", "class.ngs-tree-node-drop-target": "_isDropTarget()", "class.ngs-tree-node-drop-before": "_isDropTargetPosition(\"before\")", "class.ngs-tree-node-drop-inside": "_isDropTargetPosition(\"inside\")", "class.ngs-tree-node-drop-after": "_isDropTargetPosition(\"after\")", "attr.draggable": "_getDraggableAttribute()", "attr.aria-expanded": "_getAriaExpanded()", "attr.aria-level": "level + 1", "attr.aria-posinset": "_getPositionInSet()", "attr.aria-setsize": "_getSetSize()", "attr.aria-selected": "_getAriaSelected()", "attr.aria-disabled": "disabled()", "attr.aria-grabbed": "_getAriaGrabbed()", "tabindex": "_getTabindexAttribute()" }, classAttribute: "ngs-tree-node" }, providers: [{ provide: CdkTreeNode, useExisting: TreeNode }], exportAs: ["ngsTreeNode"], usesInheritance: true, ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{color:var(--ngs-tree-node-color);font-size:var(--ngs-tree-node-font-size);position:relative}:host.ngs-tree-node{display:flex;align-items:center;flex:1;gap:var(--ngs-tree-node-gap);padding:var(--ngs-tree-node-padding);word-wrap:break-word;min-height:var(--ngs-tree-node-min-height);box-sizing:border-box}:host.ngs-nested-tree-node{border-bottom-width:0}:host.ngs-tree-node-selectable{border-radius:var(--ngs-tree-node-radius);cursor:pointer}:host.ngs-tree-node-disabled{opacity:var(--ngs-tree-node-disabled-opacity);cursor:default}:host.ngs-tree-node-draggable{cursor:grab}:host.ngs-tree-node-draggable:active{cursor:grabbing}:host.ngs-tree-node-drop-inside{color:var(--ngs-tree-node-drop-target-color, var(--ngs-tree-node-active-color));background:var(--ngs-tree-node-drop-target-bg, var(--ngs-tree-node-active-bg));outline:var(--ngs-tree-node-drop-target-outline, 1px solid var(--ngs-color-primary));outline-offset:var(--ngs-tree-node-drop-target-outline-offset, -1px)}:host.ngs-tree-node-drop-before:before,:host.ngs-tree-node-drop-after:after{content:\"\";position:absolute;z-index:1;inset-inline:0;height:var(--ngs-tree-node-drop-line-size, 2px);background:var(--ngs-tree-node-drop-line-color, var(--ngs-color-primary));border-radius:var(--ngs-tree-node-drop-line-radius, 999px);pointer-events:none}:host.ngs-tree-node-drop-before:before{top:0}:host.ngs-tree-node-drop-after:after{bottom:0}:host.ngs-tree-node-selectable:not(.ngs-tree-node-selected,.ngs-tree-node-disabled):hover{color:var(--ngs-tree-node-hover-color);background:var(--ngs-tree-node-hover-bg)}:host.ngs-tree-node-selected:not(.ngs-tree-node-disabled){color:var(--ngs-tree-node-active-color);background:var(--ngs-tree-node-active-bg)}:host.ngs-tree-node-selectable>button:disabled{pointer-events:none}:host .ngs-tree-node-checkbox{display:inline-flex;align-items:center;justify-content:center;flex:none;margin-inline-end:var(--ngs-tree-node-checkbox-gap, calc(var(--spacing, .25rem) * 2))}:host .ngs-tree-node-checkbox ngs-checkbox{--ngs-checkbox-gap: 0}:host .ngs-tree-node-checkbox .ngs-checkbox-label{display:none}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
75
858
  }
76
859
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TreeNode, decorators: [{
77
- type: Directive,
78
- args: [{
79
- selector: 'ngs-tree-node',
80
- exportAs: 'ngsTreeNode',
81
- outputs: ['activation', 'expandedChange'],
82
- providers: [{ provide: CdkTreeNode, useExisting: TreeNode }],
83
- host: {
860
+ type: Component,
861
+ args: [{ selector: 'ngs-tree-node', exportAs: 'ngsTreeNode', template: '<ng-content />', standalone: true, outputs: ['activation', 'expandedChange'], providers: [{ provide: CdkTreeNode, useExisting: TreeNode }], changeDetection: ChangeDetectionStrategy.OnPush, host: {
84
862
  'class': 'ngs-tree-node',
863
+ '[class.ngs-tree-node-selectable]': '_isSelectable()',
864
+ '[class.ngs-tree-node-selected]': '_isSelected()',
865
+ '[class.ngs-tree-node-disabled]': 'disabled()',
866
+ '[class.ngs-tree-node-draggable]': '_isDraggable()',
867
+ '[class.ngs-tree-node-drop-target]': '_isDropTarget()',
868
+ '[class.ngs-tree-node-drop-before]': '_isDropTargetPosition("before")',
869
+ '[class.ngs-tree-node-drop-inside]': '_isDropTargetPosition("inside")',
870
+ '[class.ngs-tree-node-drop-after]': '_isDropTargetPosition("after")',
871
+ '[attr.draggable]': '_getDraggableAttribute()',
85
872
  '[attr.aria-expanded]': '_getAriaExpanded()',
86
873
  '[attr.aria-level]': 'level + 1',
87
874
  '[attr.aria-posinset]': '_getPositionInSet()',
88
875
  '[attr.aria-setsize]': '_getSetSize()',
89
- '(click)': '_focusItem()',
876
+ '[attr.aria-selected]': '_getAriaSelected()',
877
+ '[attr.aria-disabled]': 'disabled()',
878
+ '[attr.aria-grabbed]': '_getAriaGrabbed()',
879
+ '(click)': '_handleNodeClick($event)',
880
+ '(dragstart)': '_handleDragStart($event)',
881
+ '(dragover)': '_handleDragOver($event)',
882
+ '(dragleave)': '_handleDragLeave($event)',
883
+ '(drop)': '_handleDrop($event)',
884
+ '(dragend)': '_handleDragEnd()',
90
885
  '[tabindex]': '_getTabindexAttribute()',
91
- },
92
- standalone: true
93
- }]
94
- }], ctorParameters: () => [], propDecorators: { tabIndexInputBinding: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
886
+ }, styles: [":host{color:var(--ngs-tree-node-color);font-size:var(--ngs-tree-node-font-size);position:relative}:host.ngs-tree-node{display:flex;align-items:center;flex:1;gap:var(--ngs-tree-node-gap);padding:var(--ngs-tree-node-padding);word-wrap:break-word;min-height:var(--ngs-tree-node-min-height);box-sizing:border-box}:host.ngs-nested-tree-node{border-bottom-width:0}:host.ngs-tree-node-selectable{border-radius:var(--ngs-tree-node-radius);cursor:pointer}:host.ngs-tree-node-disabled{opacity:var(--ngs-tree-node-disabled-opacity);cursor:default}:host.ngs-tree-node-draggable{cursor:grab}:host.ngs-tree-node-draggable:active{cursor:grabbing}:host.ngs-tree-node-drop-inside{color:var(--ngs-tree-node-drop-target-color, var(--ngs-tree-node-active-color));background:var(--ngs-tree-node-drop-target-bg, var(--ngs-tree-node-active-bg));outline:var(--ngs-tree-node-drop-target-outline, 1px solid var(--ngs-color-primary));outline-offset:var(--ngs-tree-node-drop-target-outline-offset, -1px)}:host.ngs-tree-node-drop-before:before,:host.ngs-tree-node-drop-after:after{content:\"\";position:absolute;z-index:1;inset-inline:0;height:var(--ngs-tree-node-drop-line-size, 2px);background:var(--ngs-tree-node-drop-line-color, var(--ngs-color-primary));border-radius:var(--ngs-tree-node-drop-line-radius, 999px);pointer-events:none}:host.ngs-tree-node-drop-before:before{top:0}:host.ngs-tree-node-drop-after:after{bottom:0}:host.ngs-tree-node-selectable:not(.ngs-tree-node-selected,.ngs-tree-node-disabled):hover{color:var(--ngs-tree-node-hover-color);background:var(--ngs-tree-node-hover-bg)}:host.ngs-tree-node-selected:not(.ngs-tree-node-disabled){color:var(--ngs-tree-node-active-color);background:var(--ngs-tree-node-active-bg)}:host.ngs-tree-node-selectable>button:disabled{pointer-events:none}:host .ngs-tree-node-checkbox{display:inline-flex;align-items:center;justify-content:center;flex:none;margin-inline-end:var(--ngs-tree-node-checkbox-gap, calc(var(--spacing, .25rem) * 2))}:host .ngs-tree-node-checkbox ngs-checkbox{--ngs-checkbox-gap: 0}:host .ngs-tree-node-checkbox .ngs-checkbox-label{display:none}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
887
+ }], ctorParameters: () => [], propDecorators: { tabIndexInputBinding: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
95
888
  class NestedTreeNode extends CdkNestedTreeNode {
889
+ _hostElementRef = inject(ElementRef);
890
+ _renderer = inject(Renderer2);
891
+ _appRef = inject(ApplicationRef);
892
+ _environmentInjector = inject(EnvironmentInjector);
893
+ _platformId = inject(PLATFORM_ID);
894
+ _checkbox;
895
+ _dataChangesSubscription;
896
+ _checkboxEnableHandle;
897
+ _registeredDataKey = NGS_TREE_NODE_VALUE_UNSET;
96
898
  node = input(undefined, { ...(ngDevMode ? { debugName: "node" } : /* istanbul ignore next */ {}), alias: 'ngsNestedTreeNode' });
899
+ value = input(NGS_TREE_NODE_VALUE_UNSET, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
97
900
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
98
901
  tabIndexInput = input(0, { ...(ngDevMode ? { debugName: "tabIndexInput" } : /* istanbul ignore next */ {}), alias: 'tabIndex',
99
902
  transform: (value) => (value == null ? 0 : numberAttribute(value)) });
100
903
  constructor() {
101
904
  super();
905
+ const tree = this._tree;
906
+ this._checkbox = new TreeNodeCheckbox(this, tree, this._hostElementRef, this._renderer, this._appRef, this._environmentInjector, () => this.disabled());
907
+ this._dataChangesSubscription = this._dataChanges.subscribe(() => this._syncNodeState());
908
+ if (isPlatformBrowser(this._platformId)) {
909
+ this._checkboxEnableHandle = setTimeout(() => this._checkbox.enable());
910
+ }
102
911
  effect(() => {
103
912
  this.isDisabled = this.disabled();
104
913
  });
914
+ effect(() => {
915
+ tree.checkable();
916
+ tree._checkStateVersion();
917
+ this.disabled();
918
+ this._syncNodeDisabledRegistration();
919
+ this._checkbox.sync();
920
+ });
921
+ effect(() => {
922
+ this.value();
923
+ this._syncNodeState();
924
+ });
105
925
  }
106
926
  get tabIndex() {
107
927
  return this.isDisabled ? -1 : this.tabIndexInput();
108
928
  }
929
+ _handleNodeClick(event) {
930
+ this._focusItem?.();
931
+ this._selectNodeFromEvent(event);
932
+ }
933
+ _isSelectable() {
934
+ return this._tree.selectable() && !this.disabled();
935
+ }
936
+ _isSelected() {
937
+ const tree = this._tree;
938
+ return tree.selectable() && tree._isNodeSelected(this.data);
939
+ }
940
+ _getAriaSelected() {
941
+ return this._tree.selectable() ? this._isSelected() : null;
942
+ }
943
+ _isDraggable() {
944
+ return this._tree._canDragNode(this.data);
945
+ }
946
+ _isDropTarget() {
947
+ return this._tree._isNodeDropTarget(this.data);
948
+ }
949
+ _isDropTargetPosition(position) {
950
+ return this._tree._isNodeDropTargetPosition(this.data, position);
951
+ }
952
+ _getDraggableAttribute() {
953
+ return this._isDraggable() ? true : null;
954
+ }
955
+ _getAriaGrabbed() {
956
+ return this._tree.draggable() ? false : null;
957
+ }
958
+ _handleDragStart(event) {
959
+ this._tree._startNodeDrag(this.data, event);
960
+ }
961
+ _handleDragOver(event) {
962
+ this._tree._dragNodeOver(this.data, event);
963
+ }
964
+ _handleDragLeave(event) {
965
+ this._tree._dragNodeLeave(this.data, event);
966
+ }
967
+ _handleDrop(event) {
968
+ this._tree._dropNodeInto(this.data, event);
969
+ }
970
+ _handleDragEnd() {
971
+ this._tree._endNodeDrag();
972
+ }
973
+ _selectNodeFromEvent(event) {
974
+ if (!this._isSelectable() || this._isTreeControlClick(event)) {
975
+ return;
976
+ }
977
+ this._tree._selectNode(this.data);
978
+ }
979
+ _isTreeControlClick(event) {
980
+ return isTreeNodeControlClick(event, this._hostElementRef.nativeElement);
981
+ }
982
+ _syncNodeState() {
983
+ this._syncNodeValueRegistration();
984
+ this._syncNodeDisabledRegistration();
985
+ this._checkbox.sync();
986
+ }
987
+ _syncNodeValueRegistration() {
988
+ if (this.data === undefined) {
989
+ return;
990
+ }
991
+ const tree = this._tree;
992
+ const key = tree._getTreeNodeDataKey(this.data);
993
+ if (this._registeredDataKey !== NGS_TREE_NODE_VALUE_UNSET && !Object.is(this._registeredDataKey, key)) {
994
+ tree._unregisterNodeValueByDataKey(this._registeredDataKey);
995
+ tree._unregisterNodeDisabledByDataKey(this._registeredDataKey);
996
+ }
997
+ this._registeredDataKey = key;
998
+ if (this.value() === NGS_TREE_NODE_VALUE_UNSET) {
999
+ tree._unregisterNodeValueByDataKey(key);
1000
+ }
1001
+ else {
1002
+ tree._registerNodeValue(this.data, this.value());
1003
+ }
1004
+ }
1005
+ _syncNodeDisabledRegistration() {
1006
+ if (this.data === undefined) {
1007
+ return;
1008
+ }
1009
+ this._tree._registerNodeDisabled(this.data, this.disabled());
1010
+ }
109
1011
  ngOnInit() {
110
1012
  super.ngOnInit();
1013
+ this._syncNodeState();
111
1014
  }
112
1015
  ngAfterContentInit() {
113
1016
  super.ngAfterContentInit();
114
1017
  }
115
1018
  ngOnDestroy() {
1019
+ if (this._checkboxEnableHandle) {
1020
+ clearTimeout(this._checkboxEnableHandle);
1021
+ }
1022
+ this._dataChangesSubscription?.unsubscribe();
1023
+ if (this._registeredDataKey !== NGS_TREE_NODE_VALUE_UNSET) {
1024
+ this._tree._unregisterNodeValueByDataKey(this._registeredDataKey);
1025
+ this._tree._unregisterNodeDisabledByDataKey(this._registeredDataKey);
1026
+ }
1027
+ this._checkbox.destroy();
116
1028
  super.ngOnDestroy();
117
1029
  }
118
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: NestedTreeNode, deps: [], target: i0.ɵɵFactoryTarget.Directive });
119
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: NestedTreeNode, isStandalone: true, selector: "ngs-nested-tree-node", inputs: { node: { classPropertyName: "node", publicName: "ngsNestedTreeNode", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndexInput: { classPropertyName: "tabIndexInput", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activation: "activation", expandedChange: "expandedChange" }, host: { classAttribute: "ngs-nested-tree-node" }, providers: [
1030
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: NestedTreeNode, deps: [], target: i0.ɵɵFactoryTarget.Component });
1031
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: NestedTreeNode, isStandalone: true, selector: "ngs-nested-tree-node", inputs: { node: { classPropertyName: "node", publicName: "ngsNestedTreeNode", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndexInput: { classPropertyName: "tabIndexInput", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activation: "activation", expandedChange: "expandedChange" }, host: { listeners: { "click": "_handleNodeClick($event)", "dragstart": "_handleDragStart($event)", "dragover": "_handleDragOver($event)", "dragleave": "_handleDragLeave($event)", "drop": "_handleDrop($event)", "dragend": "_handleDragEnd()" }, properties: { "class.ngs-tree-node-selectable": "_isSelectable()", "class.ngs-tree-node-selected": "_isSelected()", "class.ngs-tree-node-disabled": "disabled()", "class.ngs-tree-node-draggable": "_isDraggable()", "class.ngs-tree-node-drop-target": "_isDropTarget()", "class.ngs-tree-node-drop-before": "_isDropTargetPosition(\"before\")", "class.ngs-tree-node-drop-inside": "_isDropTargetPosition(\"inside\")", "class.ngs-tree-node-drop-after": "_isDropTargetPosition(\"after\")", "attr.draggable": "_getDraggableAttribute()", "attr.aria-selected": "_getAriaSelected()", "attr.aria-disabled": "disabled()", "attr.aria-grabbed": "_getAriaGrabbed()" }, classAttribute: "ngs-nested-tree-node" }, providers: [
120
1032
  { provide: CdkNestedTreeNode, useExisting: NestedTreeNode },
121
1033
  { provide: CdkTreeNode, useExisting: NestedTreeNode },
122
1034
  { provide: CDK_TREE_NODE_OUTLET_NODE, useExisting: NestedTreeNode },
123
- ], exportAs: ["ngsNestedTreeNode"], usesInheritance: true, ngImport: i0 });
1035
+ ], exportAs: ["ngsNestedTreeNode"], usesInheritance: true, ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{color:var(--ngs-tree-node-color);font-size:var(--ngs-tree-node-font-size);position:relative}:host.ngs-tree-node{display:flex;align-items:center;flex:1;gap:var(--ngs-tree-node-gap);padding:var(--ngs-tree-node-padding);word-wrap:break-word;min-height:var(--ngs-tree-node-min-height);box-sizing:border-box}:host.ngs-nested-tree-node{border-bottom-width:0}:host.ngs-tree-node-selectable{border-radius:var(--ngs-tree-node-radius);cursor:pointer}:host.ngs-tree-node-disabled{opacity:var(--ngs-tree-node-disabled-opacity);cursor:default}:host.ngs-tree-node-draggable{cursor:grab}:host.ngs-tree-node-draggable:active{cursor:grabbing}:host.ngs-tree-node-drop-inside{color:var(--ngs-tree-node-drop-target-color, var(--ngs-tree-node-active-color));background:var(--ngs-tree-node-drop-target-bg, var(--ngs-tree-node-active-bg));outline:var(--ngs-tree-node-drop-target-outline, 1px solid var(--ngs-color-primary));outline-offset:var(--ngs-tree-node-drop-target-outline-offset, -1px)}:host.ngs-tree-node-drop-before:before,:host.ngs-tree-node-drop-after:after{content:\"\";position:absolute;z-index:1;inset-inline:0;height:var(--ngs-tree-node-drop-line-size, 2px);background:var(--ngs-tree-node-drop-line-color, var(--ngs-color-primary));border-radius:var(--ngs-tree-node-drop-line-radius, 999px);pointer-events:none}:host.ngs-tree-node-drop-before:before{top:0}:host.ngs-tree-node-drop-after:after{bottom:0}:host.ngs-tree-node-selectable:not(.ngs-tree-node-selected,.ngs-tree-node-disabled):hover{color:var(--ngs-tree-node-hover-color);background:var(--ngs-tree-node-hover-bg)}:host.ngs-tree-node-selected:not(.ngs-tree-node-disabled){color:var(--ngs-tree-node-active-color);background:var(--ngs-tree-node-active-bg)}:host.ngs-tree-node-selectable>button:disabled{pointer-events:none}:host .ngs-tree-node-checkbox{display:inline-flex;align-items:center;justify-content:center;flex:none;margin-inline-end:var(--ngs-tree-node-checkbox-gap, calc(var(--spacing, .25rem) * 2))}:host .ngs-tree-node-checkbox ngs-checkbox{--ngs-checkbox-gap: 0}:host .ngs-tree-node-checkbox .ngs-checkbox-label{display:none}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
124
1036
  }
125
1037
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: NestedTreeNode, decorators: [{
126
- type: Directive,
127
- args: [{
128
- selector: 'ngs-nested-tree-node',
129
- exportAs: 'ngsNestedTreeNode',
130
- outputs: ['activation', 'expandedChange'],
131
- providers: [
1038
+ type: Component,
1039
+ args: [{ selector: 'ngs-nested-tree-node', exportAs: 'ngsNestedTreeNode', template: '<ng-content />', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, outputs: ['activation', 'expandedChange'], providers: [
132
1040
  { provide: CdkNestedTreeNode, useExisting: NestedTreeNode },
133
1041
  { provide: CdkTreeNode, useExisting: NestedTreeNode },
134
1042
  { provide: CDK_TREE_NODE_OUTLET_NODE, useExisting: NestedTreeNode },
135
- ],
136
- host: {
1043
+ ], host: {
137
1044
  'class': 'ngs-nested-tree-node',
138
- },
139
- standalone: true
140
- }]
141
- }], ctorParameters: () => [], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngsNestedTreeNode", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], tabIndexInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }] } });
1045
+ '[class.ngs-tree-node-selectable]': '_isSelectable()',
1046
+ '[class.ngs-tree-node-selected]': '_isSelected()',
1047
+ '[class.ngs-tree-node-disabled]': 'disabled()',
1048
+ '[class.ngs-tree-node-draggable]': '_isDraggable()',
1049
+ '[class.ngs-tree-node-drop-target]': '_isDropTarget()',
1050
+ '[class.ngs-tree-node-drop-before]': '_isDropTargetPosition("before")',
1051
+ '[class.ngs-tree-node-drop-inside]': '_isDropTargetPosition("inside")',
1052
+ '[class.ngs-tree-node-drop-after]': '_isDropTargetPosition("after")',
1053
+ '[attr.draggable]': '_getDraggableAttribute()',
1054
+ '[attr.aria-selected]': '_getAriaSelected()',
1055
+ '[attr.aria-disabled]': 'disabled()',
1056
+ '[attr.aria-grabbed]': '_getAriaGrabbed()',
1057
+ '(click)': '_handleNodeClick($event)',
1058
+ '(dragstart)': '_handleDragStart($event)',
1059
+ '(dragover)': '_handleDragOver($event)',
1060
+ '(dragleave)': '_handleDragLeave($event)',
1061
+ '(drop)': '_handleDrop($event)',
1062
+ '(dragend)': '_handleDragEnd()',
1063
+ }, styles: [":host{color:var(--ngs-tree-node-color);font-size:var(--ngs-tree-node-font-size);position:relative}:host.ngs-tree-node{display:flex;align-items:center;flex:1;gap:var(--ngs-tree-node-gap);padding:var(--ngs-tree-node-padding);word-wrap:break-word;min-height:var(--ngs-tree-node-min-height);box-sizing:border-box}:host.ngs-nested-tree-node{border-bottom-width:0}:host.ngs-tree-node-selectable{border-radius:var(--ngs-tree-node-radius);cursor:pointer}:host.ngs-tree-node-disabled{opacity:var(--ngs-tree-node-disabled-opacity);cursor:default}:host.ngs-tree-node-draggable{cursor:grab}:host.ngs-tree-node-draggable:active{cursor:grabbing}:host.ngs-tree-node-drop-inside{color:var(--ngs-tree-node-drop-target-color, var(--ngs-tree-node-active-color));background:var(--ngs-tree-node-drop-target-bg, var(--ngs-tree-node-active-bg));outline:var(--ngs-tree-node-drop-target-outline, 1px solid var(--ngs-color-primary));outline-offset:var(--ngs-tree-node-drop-target-outline-offset, -1px)}:host.ngs-tree-node-drop-before:before,:host.ngs-tree-node-drop-after:after{content:\"\";position:absolute;z-index:1;inset-inline:0;height:var(--ngs-tree-node-drop-line-size, 2px);background:var(--ngs-tree-node-drop-line-color, var(--ngs-color-primary));border-radius:var(--ngs-tree-node-drop-line-radius, 999px);pointer-events:none}:host.ngs-tree-node-drop-before:before{top:0}:host.ngs-tree-node-drop-after:after{bottom:0}:host.ngs-tree-node-selectable:not(.ngs-tree-node-selected,.ngs-tree-node-disabled):hover{color:var(--ngs-tree-node-hover-color);background:var(--ngs-tree-node-hover-bg)}:host.ngs-tree-node-selected:not(.ngs-tree-node-disabled){color:var(--ngs-tree-node-active-color);background:var(--ngs-tree-node-active-bg)}:host.ngs-tree-node-selectable>button:disabled{pointer-events:none}:host .ngs-tree-node-checkbox{display:inline-flex;align-items:center;justify-content:center;flex:none;margin-inline-end:var(--ngs-tree-node-checkbox-gap, calc(var(--spacing, .25rem) * 2))}:host .ngs-tree-node-checkbox ngs-checkbox{--ngs-checkbox-gap: 0}:host .ngs-tree-node-checkbox .ngs-checkbox-label{display:none}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
1064
+ }], ctorParameters: () => [], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngsNestedTreeNode", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], tabIndexInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }] } });
142
1065
 
143
1066
  class TreeNodePadding extends CdkTreeNodePadding {
144
1067
  levelInput = input(0, { ...(ngDevMode ? { debugName: "levelInput" } : /* istanbul ignore next */ {}), alias: 'ngsTreeNodePadding',