@ali-hm/angular-tree-component 20.3.3 → 21.0.0

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,44 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, TemplateRef, ViewContainerRef, Input, Directive, Injectable, ViewEncapsulation, Component, ElementRef, Renderer2, NgZone, EventEmitter, HostListener, Output, forwardRef, ViewChild, ContentChild, NgModule } from '@angular/core';
3
- import { NgIf, NgTemplateOutlet, NgFor, CommonModule } from '@angular/common';
4
- import { autorun, reaction, computed as computed$1, observable as observable$1, action as action$1 } from 'mobx';
5
-
6
- class TreeMobxAutorunDirective {
7
- constructor() {
8
- this.templateRef = inject(TemplateRef);
9
- this.viewContainer = inject(ViewContainerRef);
10
- this.templateBindings = {};
11
- }
12
- ngOnInit() {
13
- this.view = this.viewContainer.createEmbeddedView(this.templateRef);
14
- if (this.dispose) {
15
- this.dispose();
16
- }
17
- if (this.shouldDetach()) {
18
- this.view.detach();
19
- }
20
- this.autoDetect(this.view);
21
- }
22
- shouldDetach() {
23
- return this.treeMobxAutorun && this.treeMobxAutorun.detach;
24
- }
25
- autoDetect(view) {
26
- this.dispose = autorun(() => view.detectChanges());
27
- }
28
- ngOnDestroy() {
29
- if (this.dispose) {
30
- this.dispose();
31
- }
32
- }
33
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeMobxAutorunDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
34
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: TreeMobxAutorunDirective, isStandalone: true, selector: "[treeMobxAutorun]", inputs: { treeMobxAutorun: "treeMobxAutorun" }, ngImport: i0 }); }
35
- }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeMobxAutorunDirective, decorators: [{
37
- type: Directive,
38
- args: [{ selector: '[treeMobxAutorun]' }]
39
- }], propDecorators: { treeMobxAutorun: [{
40
- type: Input
41
- }] } });
2
+ import { signal, effect, Injectable, inject, input, ViewEncapsulation, Component, ElementRef, Injector, Renderer2, afterNextRender, output, HostListener, Directive, computed, TemplateRef, ViewContainerRef, forwardRef, EventEmitter, Output, Input, ViewChild, ContentChild, NgModule } from '@angular/core';
3
+ import { NgTemplateOutlet, CommonModule } from '@angular/common';
42
4
 
43
5
  const KEYS = {
44
6
  LEFT: 37,
@@ -219,39 +181,37 @@ const TREE_EVENTS = {
219
181
  stateChange: 'stateChange'
220
182
  };
221
183
 
222
- var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
223
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
224
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
225
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
226
- return c > 3 && r && Object.defineProperty(target, key, r), r;
227
- };
228
184
  class TreeNode {
185
+ // Public getters/setters for API compatibility
186
+ get children() { return this._children(); }
187
+ set children(value) { this._children.set(value); }
188
+ get index() { return this._index(); }
189
+ set index(value) { this._index.set(value); }
190
+ get position() { return this._position(); }
191
+ set position(value) { this._position.set(value); }
192
+ get height() { return this._height(); }
193
+ set height(value) { this._height.set(value); }
194
+ // Computed properties
229
195
  get isHidden() { return this.treeModel.isHidden(this); }
230
- ;
231
196
  get isExpanded() { return this.treeModel.isExpanded(this); }
232
- ;
233
197
  get isActive() { return this.treeModel.isActive(this); }
234
- ;
235
198
  get isFocused() { return this.treeModel.isNodeFocused(this); }
236
- ;
237
199
  get isSelected() {
238
200
  if (this.isSelectable()) {
239
201
  return this.treeModel.isSelected(this);
240
202
  }
241
203
  else {
242
- return this.children.some((node) => node.isSelected);
204
+ return this.children?.some((node) => node.isSelected);
243
205
  }
244
206
  }
245
- ;
246
207
  get isAllSelected() {
247
208
  if (this.isSelectable()) {
248
209
  return this.treeModel.isSelected(this);
249
210
  }
250
211
  else {
251
- return this.children.every((node) => node.isAllSelected);
212
+ return this.children?.every((node) => node.isAllSelected);
252
213
  }
253
214
  }
254
- ;
255
215
  get isPartiallySelected() {
256
216
  return this.isSelected && !this.isAllSelected;
257
217
  }
@@ -271,7 +231,12 @@ class TreeNode {
271
231
  this.data = data;
272
232
  this.parent = parent;
273
233
  this.treeModel = treeModel;
274
- this.position = 0;
234
+ this._isLoadingChildren = false;
235
+ // Private signals
236
+ this._children = signal(undefined, ...(ngDevMode ? [{ debugName: "_children" }] : []));
237
+ this._index = signal(undefined, ...(ngDevMode ? [{ debugName: "_index" }] : []));
238
+ this._position = signal(0, ...(ngDevMode ? [{ debugName: "_position" }] : []));
239
+ this._height = signal(undefined, ...(ngDevMode ? [{ debugName: "_height" }] : []));
275
240
  this.allowDrop = (element, $event) => {
276
241
  return this.options.allowDrop(element, { parent: this, index: 0 }, $event);
277
242
  };
@@ -452,25 +417,29 @@ class TreeNode {
452
417
  setIsExpanded(value) {
453
418
  if (this.hasChildren) {
454
419
  this.treeModel.setExpandedNode(this, value);
420
+ // Load children when expanding if they haven't been loaded yet
421
+ if (value && !this.children && this.hasChildren && !this._isLoadingChildren) {
422
+ this._isLoadingChildren = true;
423
+ this.loadNodeChildren().finally(() => {
424
+ this._isLoadingChildren = false;
425
+ });
426
+ }
455
427
  }
456
428
  return this;
457
429
  }
458
430
  ;
459
431
  autoLoadChildren() {
460
- this.handler =
461
- reaction(() => this.isExpanded, (isExpanded) => {
462
- if (!this.children && this.hasChildren && isExpanded) {
463
- this.loadNodeChildren();
464
- }
465
- }, { fireImmediately: true });
432
+ // Instead of using effect, we'll load children when the node is expanded
433
+ // This is handled by the toggleExpanded and setIsExpanded methods
434
+ // Check immediately if we should load
435
+ if (this.isExpanded && !this.children && this.hasChildren) {
436
+ this.loadNodeChildren();
437
+ }
466
438
  }
467
439
  dispose() {
468
440
  if (this.children) {
469
441
  this.children.forEach((child) => child.dispose());
470
442
  }
471
- if (this.handler) {
472
- this.handler();
473
- }
474
443
  this.parent = null;
475
444
  this.children = null;
476
445
  }
@@ -555,77 +524,62 @@ class TreeNode {
555
524
  .map((c, index) => new TreeNode(c, this, this.treeModel, index));
556
525
  }
557
526
  }
558
- __decorate$3([
559
- computed$1
560
- ], TreeNode.prototype, "isHidden", null);
561
- __decorate$3([
562
- computed$1
563
- ], TreeNode.prototype, "isExpanded", null);
564
- __decorate$3([
565
- computed$1
566
- ], TreeNode.prototype, "isActive", null);
567
- __decorate$3([
568
- computed$1
569
- ], TreeNode.prototype, "isFocused", null);
570
- __decorate$3([
571
- computed$1
572
- ], TreeNode.prototype, "isSelected", null);
573
- __decorate$3([
574
- computed$1
575
- ], TreeNode.prototype, "isAllSelected", null);
576
- __decorate$3([
577
- computed$1
578
- ], TreeNode.prototype, "isPartiallySelected", null);
579
- __decorate$3([
580
- observable$1
581
- ], TreeNode.prototype, "children", void 0);
582
- __decorate$3([
583
- observable$1
584
- ], TreeNode.prototype, "index", void 0);
585
- __decorate$3([
586
- observable$1
587
- ], TreeNode.prototype, "position", void 0);
588
- __decorate$3([
589
- observable$1
590
- ], TreeNode.prototype, "height", void 0);
591
- __decorate$3([
592
- computed$1
593
- ], TreeNode.prototype, "level", null);
594
- __decorate$3([
595
- computed$1
596
- ], TreeNode.prototype, "path", null);
597
- __decorate$3([
598
- computed$1
599
- ], TreeNode.prototype, "visibleChildren", null);
600
- __decorate$3([
601
- action$1
602
- ], TreeNode.prototype, "setIsSelected", null);
603
- __decorate$3([
604
- action$1
605
- ], TreeNode.prototype, "_initChildren", null);
606
527
  function uuid() {
607
528
  return Math.floor(Math.random() * 10000000000000);
608
529
  }
609
530
 
610
- var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
611
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
612
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
613
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
614
- return c > 3 && r && Object.defineProperty(target, key, r), r;
615
- };
616
531
  class TreeModel {
617
532
  constructor() {
618
533
  this.options = new TreeOptions();
619
534
  this.eventNames = Object.keys(TREE_EVENTS);
620
- this.expandedNodeIds = {};
621
- this.selectedLeafNodeIds = {};
622
- this.activeNodeIds = {};
623
- this.hiddenNodeIds = {};
624
- this.focusedNodeId = null;
535
+ // Private signals
536
+ this._roots = signal(undefined, ...(ngDevMode ? [{ debugName: "_roots" }] : []));
537
+ this._expandedNodeIds = signal({}, ...(ngDevMode ? [{ debugName: "_expandedNodeIds" }] : []));
538
+ this._selectedLeafNodeIds = signal({}, ...(ngDevMode ? [{ debugName: "_selectedLeafNodeIds" }] : []));
539
+ this._activeNodeIds = signal({}, ...(ngDevMode ? [{ debugName: "_activeNodeIds" }] : []));
540
+ this._hiddenNodeIds = signal({}, ...(ngDevMode ? [{ debugName: "_hiddenNodeIds" }] : []));
541
+ this._focusedNodeId = signal(null, ...(ngDevMode ? [{ debugName: "_focusedNodeId" }] : []));
542
+ this._virtualRoot = signal(undefined, ...(ngDevMode ? [{ debugName: "_virtualRoot" }] : []));
625
543
  this.firstUpdate = true;
626
544
  this.subscriptions = [];
627
545
  }
628
546
  static { this.focusedTree = null; }
547
+ // Public getters/setters to maintain API compatibility
548
+ get roots() { return this._roots(); }
549
+ set roots(value) { this._roots.set(value); }
550
+ get virtualRoot() { return this._virtualRoot(); }
551
+ get focusedNode() {
552
+ const id = this._focusedNodeId();
553
+ return id ? this.getNodeById(id) : null;
554
+ }
555
+ get expandedNodes() {
556
+ const ids = this._expandedNodeIds();
557
+ const nodes = Object.keys(ids)
558
+ .filter((id) => ids[id])
559
+ .map((id) => this.getNodeById(id));
560
+ return nodes.filter(Boolean);
561
+ }
562
+ get activeNodes() {
563
+ const ids = this._activeNodeIds();
564
+ const nodes = Object.keys(ids)
565
+ .filter((id) => ids[id])
566
+ .map((id) => this.getNodeById(id));
567
+ return nodes.filter(Boolean);
568
+ }
569
+ get hiddenNodes() {
570
+ const ids = this._hiddenNodeIds();
571
+ const nodes = Object.keys(ids)
572
+ .filter((id) => ids[id])
573
+ .map((id) => this.getNodeById(id));
574
+ return nodes.filter(Boolean);
575
+ }
576
+ get selectedLeafNodes() {
577
+ const ids = this._selectedLeafNodeIds();
578
+ const nodes = Object.keys(ids)
579
+ .filter((id) => ids[id])
580
+ .map((id) => this.getNodeById(id));
581
+ return nodes.filter(Boolean);
582
+ }
629
583
  // events
630
584
  fireEvent(event) {
631
585
  event.treeModel = this;
@@ -647,7 +601,7 @@ class TreeModel {
647
601
  return this.activeNodes;
648
602
  }
649
603
  getVisibleRoots() {
650
- return this.virtualRoot.visibleChildren;
604
+ return this._virtualRoot()?.visibleChildren;
651
605
  }
652
606
  getFirstRoot(skipHidden = false) {
653
607
  const root = skipHidden ? this.getVisibleRoots() : this.roots;
@@ -664,40 +618,14 @@ class TreeModel {
664
618
  return this.focusedNode === node;
665
619
  }
666
620
  isEmptyTree() {
667
- return this.roots && this.roots.length === 0;
668
- }
669
- get focusedNode() {
670
- return this.focusedNodeId ? this.getNodeById(this.focusedNodeId) : null;
671
- }
672
- get expandedNodes() {
673
- const nodes = Object.keys(this.expandedNodeIds)
674
- .filter((id) => this.expandedNodeIds[id])
675
- .map((id) => this.getNodeById(id));
676
- return nodes.filter(Boolean);
677
- }
678
- get activeNodes() {
679
- const nodes = Object.keys(this.activeNodeIds)
680
- .filter((id) => this.activeNodeIds[id])
681
- .map((id) => this.getNodeById(id));
682
- return nodes.filter(Boolean);
683
- }
684
- get hiddenNodes() {
685
- const nodes = Object.keys(this.hiddenNodeIds)
686
- .filter((id) => this.hiddenNodeIds[id])
687
- .map((id) => this.getNodeById(id));
688
- return nodes.filter(Boolean);
689
- }
690
- get selectedLeafNodes() {
691
- const nodes = Object.keys(this.selectedLeafNodeIds)
692
- .filter((id) => this.selectedLeafNodeIds[id])
693
- .map((id) => this.getNodeById(id));
694
- return nodes.filter(Boolean);
621
+ const rootNodes = this.roots;
622
+ return rootNodes && rootNodes.length === 0;
695
623
  }
696
624
  // locating nodes
697
625
  getNodeByPath(path, startNode = null) {
698
626
  if (!path)
699
627
  return null;
700
- startNode = startNode || this.virtualRoot;
628
+ startNode = startNode || this._virtualRoot();
701
629
  if (path.length === 0)
702
630
  return startNode;
703
631
  if (!startNode.children)
@@ -713,7 +641,7 @@ class TreeModel {
713
641
  return this.getNodeBy((node) => node.id.toString() === idStr);
714
642
  }
715
643
  getNodeBy(predicate, startNode = null) {
716
- startNode = startNode || this.virtualRoot;
644
+ startNode = startNode || this._virtualRoot();
717
645
  if (!startNode.children)
718
646
  return null;
719
647
  const found = startNode.children.find(predicate);
@@ -729,16 +657,16 @@ class TreeModel {
729
657
  }
730
658
  }
731
659
  isExpanded(node) {
732
- return this.expandedNodeIds[node.id];
660
+ return this._expandedNodeIds()[node.id];
733
661
  }
734
662
  isHidden(node) {
735
- return this.hiddenNodeIds[node.id];
663
+ return this._hiddenNodeIds()[node.id];
736
664
  }
737
665
  isActive(node) {
738
- return this.activeNodeIds[node.id];
666
+ return this._activeNodeIds()[node.id];
739
667
  }
740
668
  isSelected(node) {
741
- return this.selectedLeafNodeIds[node.id];
669
+ return this._selectedLeafNodeIds()[node.id];
742
670
  }
743
671
  ngOnDestroy() {
744
672
  this.dispose();
@@ -746,8 +674,9 @@ class TreeModel {
746
674
  }
747
675
  dispose() {
748
676
  // Dispose reactions of the replaced nodes
749
- if (this.virtualRoot) {
750
- this.virtualRoot.dispose();
677
+ const vRoot = this._virtualRoot();
678
+ if (vRoot) {
679
+ vRoot.dispose();
751
680
  }
752
681
  }
753
682
  unsubscribeAll() {
@@ -775,11 +704,13 @@ class TreeModel {
775
704
  [this.options.childrenField]: this.nodes
776
705
  };
777
706
  this.dispose();
778
- this.virtualRoot = new TreeNode(virtualRootConfig, null, this, 0);
779
- this.roots = this.virtualRoot.children;
707
+ const newVirtualRoot = new TreeNode(virtualRootConfig, null, this, 0);
708
+ this._virtualRoot.set(newVirtualRoot);
709
+ this.roots = newVirtualRoot.children;
780
710
  // Fire event:
711
+ const currentRoots = this.roots;
781
712
  if (this.firstUpdate) {
782
- if (this.roots) {
713
+ if (currentRoots) {
783
714
  this.firstUpdate = false;
784
715
  this._calculateExpandedNodes();
785
716
  }
@@ -789,7 +720,7 @@ class TreeModel {
789
720
  }
790
721
  }
791
722
  setFocusedNode(node) {
792
- this.focusedNodeId = node ? node.id : null;
723
+ this._focusedNodeId.set(node ? node.id : null);
793
724
  }
794
725
  setFocus(value) {
795
726
  TreeModel.focusedTree = value ? this : null;
@@ -851,7 +782,7 @@ class TreeModel {
851
782
  }
852
783
  }
853
784
  setSelectedNode(node, value) {
854
- this.selectedLeafNodeIds = Object.assign({}, this.selectedLeafNodeIds, { [node.id]: value });
785
+ this._selectedLeafNodeIds.update(ids => ({ ...ids, [node.id]: value }));
855
786
  if (value) {
856
787
  node.focus();
857
788
  this.fireEvent({ eventName: TREE_EVENTS.select, node });
@@ -861,7 +792,7 @@ class TreeModel {
861
792
  }
862
793
  }
863
794
  setExpandedNode(node, value) {
864
- this.expandedNodeIds = Object.assign({}, this.expandedNodeIds, { [node.id]: value });
795
+ this._expandedNodeIds.update(ids => ({ ...ids, [node.id]: value }));
865
796
  this.fireEvent({ eventName: TREE_EVENTS.toggleExpanded, node, isExpanded: value });
866
797
  }
867
798
  expandAll() {
@@ -871,12 +802,14 @@ class TreeModel {
871
802
  this.roots.forEach((root) => root.collapseAll());
872
803
  }
873
804
  setIsHidden(node, value) {
874
- this.hiddenNodeIds = Object.assign({}, this.hiddenNodeIds, { [node.id]: value });
805
+ this._hiddenNodeIds.update(ids => ({ ...ids, [node.id]: value }));
875
806
  }
876
807
  setHiddenNodeIds(nodeIds) {
877
- this.hiddenNodeIds = nodeIds.reduce((hiddenNodeIds, id) => Object.assign(hiddenNodeIds, {
808
+ const ids = nodeIds.reduce((hiddenNodeIds, id) => ({
809
+ ...hiddenNodeIds,
878
810
  [id]: true
879
811
  }), {});
812
+ this._hiddenNodeIds.set(ids);
880
813
  }
881
814
  performKeyAction(node, $event) {
882
815
  const keyAction = this.options.actionMapping.keys[$event.keyCode];
@@ -908,11 +841,11 @@ class TreeModel {
908
841
  }
909
842
  const ids = {};
910
843
  this.roots.forEach((node) => this._filterNode(ids, node, filterFn, autoShow));
911
- this.hiddenNodeIds = ids;
844
+ this._hiddenNodeIds.set(ids);
912
845
  this.fireEvent({ eventName: TREE_EVENTS.changeFilter });
913
846
  }
914
847
  clearFilter() {
915
- this.hiddenNodeIds = {};
848
+ this._hiddenNodeIds.set({});
916
849
  this.fireEvent({ eventName: TREE_EVENTS.changeFilter });
917
850
  }
918
851
  moveNode(node, to) {
@@ -960,26 +893,24 @@ class TreeModel {
960
893
  }
961
894
  getState() {
962
895
  return {
963
- expandedNodeIds: this.expandedNodeIds,
964
- selectedLeafNodeIds: this.selectedLeafNodeIds,
965
- activeNodeIds: this.activeNodeIds,
966
- hiddenNodeIds: this.hiddenNodeIds,
967
- focusedNodeId: this.focusedNodeId
896
+ expandedNodeIds: this._expandedNodeIds(),
897
+ selectedLeafNodeIds: this._selectedLeafNodeIds(),
898
+ activeNodeIds: this._activeNodeIds(),
899
+ hiddenNodeIds: this._hiddenNodeIds(),
900
+ focusedNodeId: this._focusedNodeId()
968
901
  };
969
902
  }
970
903
  setState(state) {
971
904
  if (!state)
972
905
  return;
973
- Object.assign(this, {
974
- expandedNodeIds: state.expandedNodeIds || {},
975
- selectedLeafNodeIds: state.selectedLeafNodeIds || {},
976
- activeNodeIds: state.activeNodeIds || {},
977
- hiddenNodeIds: state.hiddenNodeIds || {},
978
- focusedNodeId: state.focusedNodeId
979
- });
906
+ this._expandedNodeIds.set(state.expandedNodeIds || {});
907
+ this._selectedLeafNodeIds.set(state.selectedLeafNodeIds || {});
908
+ this._activeNodeIds.set(state.activeNodeIds || {});
909
+ this._hiddenNodeIds.set(state.hiddenNodeIds || {});
910
+ this._focusedNodeId.set(state.focusedNodeId);
980
911
  }
981
912
  subscribeToState(fn) {
982
- autorun(() => fn(this.getState()));
913
+ effect(() => fn(this.getState()));
983
914
  }
984
915
  canMoveNode(node, to, fromIndex = undefined) {
985
916
  const fromNodeIndex = fromIndex || node.getIndexInParent();
@@ -1015,9 +946,9 @@ class TreeModel {
1015
946
  return isVisible;
1016
947
  }
1017
948
  _calculateExpandedNodes(startNode = null) {
1018
- startNode = startNode || this.virtualRoot;
949
+ startNode = startNode || this._virtualRoot();
1019
950
  if (startNode.data[this.options.isExpandedField]) {
1020
- this.expandedNodeIds = Object.assign({}, this.expandedNodeIds, { [startNode.id]: true });
951
+ this._expandedNodeIds.update(ids => ({ ...ids, [startNode.id]: true }));
1021
952
  }
1022
953
  if (startNode.children) {
1023
954
  startNode.children.forEach((child) => this._calculateExpandedNodes(child));
@@ -1032,120 +963,21 @@ class TreeModel {
1032
963
  this.fireEvent({ eventName: TREE_EVENTS.nodeDeactivate, node: activeNode }); // For IE11
1033
964
  });
1034
965
  if (value) {
1035
- this.activeNodeIds = { [node.id]: true };
966
+ this._activeNodeIds.set({ [node.id]: true });
1036
967
  }
1037
968
  else {
1038
- this.activeNodeIds = {};
969
+ this._activeNodeIds.set({});
1039
970
  }
1040
971
  }
1041
972
  _setActiveNodeMulti(node, value) {
1042
- this.activeNodeIds = Object.assign({}, this.activeNodeIds, { [node.id]: value });
973
+ this._activeNodeIds.update(ids => ({ ...ids, [node.id]: value }));
1043
974
  }
1044
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1045
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeModel }); }
975
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
976
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeModel }); }
1046
977
  }
1047
- __decorate$2([
1048
- observable$1
1049
- ], TreeModel.prototype, "roots", void 0);
1050
- __decorate$2([
1051
- observable$1
1052
- ], TreeModel.prototype, "expandedNodeIds", void 0);
1053
- __decorate$2([
1054
- observable$1
1055
- ], TreeModel.prototype, "selectedLeafNodeIds", void 0);
1056
- __decorate$2([
1057
- observable$1
1058
- ], TreeModel.prototype, "activeNodeIds", void 0);
1059
- __decorate$2([
1060
- observable$1
1061
- ], TreeModel.prototype, "hiddenNodeIds", void 0);
1062
- __decorate$2([
1063
- observable$1
1064
- ], TreeModel.prototype, "focusedNodeId", void 0);
1065
- __decorate$2([
1066
- observable$1
1067
- ], TreeModel.prototype, "virtualRoot", void 0);
1068
- __decorate$2([
1069
- computed$1
1070
- ], TreeModel.prototype, "focusedNode", null);
1071
- __decorate$2([
1072
- computed$1
1073
- ], TreeModel.prototype, "expandedNodes", null);
1074
- __decorate$2([
1075
- computed$1
1076
- ], TreeModel.prototype, "activeNodes", null);
1077
- __decorate$2([
1078
- computed$1
1079
- ], TreeModel.prototype, "hiddenNodes", null);
1080
- __decorate$2([
1081
- computed$1
1082
- ], TreeModel.prototype, "selectedLeafNodes", null);
1083
- __decorate$2([
1084
- action$1
1085
- ], TreeModel.prototype, "setData", null);
1086
- __decorate$2([
1087
- action$1
1088
- ], TreeModel.prototype, "update", null);
1089
- __decorate$2([
1090
- action$1
1091
- ], TreeModel.prototype, "setFocusedNode", null);
1092
- __decorate$2([
1093
- action$1
1094
- ], TreeModel.prototype, "setFocus", null);
1095
- __decorate$2([
1096
- action$1
1097
- ], TreeModel.prototype, "doForAll", null);
1098
- __decorate$2([
1099
- action$1
1100
- ], TreeModel.prototype, "focusNextNode", null);
1101
- __decorate$2([
1102
- action$1
1103
- ], TreeModel.prototype, "focusPreviousNode", null);
1104
- __decorate$2([
1105
- action$1
1106
- ], TreeModel.prototype, "focusDrillDown", null);
1107
- __decorate$2([
1108
- action$1
1109
- ], TreeModel.prototype, "focusDrillUp", null);
1110
- __decorate$2([
1111
- action$1
1112
- ], TreeModel.prototype, "setActiveNode", null);
1113
- __decorate$2([
1114
- action$1
1115
- ], TreeModel.prototype, "setSelectedNode", null);
1116
- __decorate$2([
1117
- action$1
1118
- ], TreeModel.prototype, "setExpandedNode", null);
1119
- __decorate$2([
1120
- action$1
1121
- ], TreeModel.prototype, "expandAll", null);
1122
- __decorate$2([
1123
- action$1
1124
- ], TreeModel.prototype, "collapseAll", null);
1125
- __decorate$2([
1126
- action$1
1127
- ], TreeModel.prototype, "setIsHidden", null);
1128
- __decorate$2([
1129
- action$1
1130
- ], TreeModel.prototype, "setHiddenNodeIds", null);
1131
- __decorate$2([
1132
- action$1
1133
- ], TreeModel.prototype, "filterNodes", null);
1134
- __decorate$2([
1135
- action$1
1136
- ], TreeModel.prototype, "clearFilter", null);
1137
- __decorate$2([
1138
- action$1
1139
- ], TreeModel.prototype, "moveNode", null);
1140
- __decorate$2([
1141
- action$1
1142
- ], TreeModel.prototype, "copyNode", null);
1143
- __decorate$2([
1144
- action$1
1145
- ], TreeModel.prototype, "setState", null);
1146
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeModel, decorators: [{
978
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeModel, decorators: [{
1147
979
  type: Injectable
1148
- }], propDecorators: { roots: [], expandedNodeIds: [], selectedLeafNodeIds: [], activeNodeIds: [], hiddenNodeIds: [], focusedNodeId: [], virtualRoot: [], focusedNode: [], expandedNodes: [], activeNodes: [], hiddenNodes: [], selectedLeafNodes: [], setData: [], update: [], setFocusedNode: [], setFocus: [], doForAll: [], focusNextNode: [], focusPreviousNode: [], focusDrillDown: [], focusDrillUp: [], setActiveNode: [], setSelectedNode: [], setExpandedNode: [], expandAll: [], collapseAll: [], setIsHidden: [], setHiddenNodeIds: [], filterNodes: [], clearFilter: [], moveNode: [], copyNode: [], setState: [] } });
980
+ }] });
1149
981
 
1150
982
  class TreeDraggedElement {
1151
983
  constructor() {
@@ -1160,40 +992,41 @@ class TreeDraggedElement {
1160
992
  isDragging() {
1161
993
  return !!this.get();
1162
994
  }
1163
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeDraggedElement, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1164
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeDraggedElement, providedIn: 'root' }); }
995
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeDraggedElement, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
996
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeDraggedElement, providedIn: 'root' }); }
1165
997
  }
1166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeDraggedElement, decorators: [{
998
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeDraggedElement, decorators: [{
1167
999
  type: Injectable,
1168
1000
  args: [{
1169
1001
  providedIn: 'root'
1170
1002
  }]
1171
1003
  }] });
1172
1004
 
1173
- var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
1174
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1175
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1176
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1177
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1178
- };
1179
1005
  const Y_OFFSET = 500; // Extra pixels outside the viewport, in each direction, to render nodes in
1180
1006
  const Y_EPSILON = 150; // Minimum pixel change required to recalculate the rendered nodes
1181
1007
  class TreeVirtualScroll {
1008
+ get yBlocks() { return this._yBlocks(); }
1009
+ set yBlocks(value) { this._yBlocks.set(value); }
1010
+ get x() { return this._x(); }
1011
+ set x(value) { this._x.set(value); }
1012
+ get viewportHeight() { return this._viewportHeight(); }
1013
+ set viewportHeight(value) { this._viewportHeight.set(value); }
1182
1014
  get y() {
1183
1015
  return this.yBlocks * Y_EPSILON;
1184
1016
  }
1185
1017
  get totalHeight() {
1186
- return this.treeModel.virtualRoot ? this.treeModel.virtualRoot.height : 0;
1018
+ const vRoot = this.treeModel['_virtualRoot']();
1019
+ return vRoot ? vRoot.height : 0;
1187
1020
  }
1188
1021
  constructor() {
1189
1022
  this.treeModel = inject(TreeModel);
1190
- this.yBlocks = 0;
1191
- this.x = 0;
1192
- this.viewportHeight = null;
1023
+ this._dispose = [];
1024
+ this._yBlocks = signal(0, ...(ngDevMode ? [{ debugName: "_yBlocks" }] : []));
1025
+ this._x = signal(0, ...(ngDevMode ? [{ debugName: "_x" }] : []));
1026
+ this._viewportHeight = signal(null, ...(ngDevMode ? [{ debugName: "_viewportHeight" }] : []));
1193
1027
  this.viewport = null;
1194
1028
  const treeModel = this.treeModel;
1195
1029
  treeModel.virtualScroll = this;
1196
- this._dispose = [autorun(() => this.fixScroll())];
1197
1030
  }
1198
1031
  fireEvent(event) {
1199
1032
  this.treeModel.fireEvent(event);
@@ -1201,13 +1034,34 @@ class TreeVirtualScroll {
1201
1034
  init() {
1202
1035
  const fn = this.recalcPositions.bind(this);
1203
1036
  fn();
1037
+ this.treeModel.subscribe(TREE_EVENTS.loadNodeChildren, fn);
1038
+ }
1039
+ setupWatchers(injector) {
1040
+ const fn = this.recalcPositions.bind(this);
1041
+ const fixScrollEffect = effect(() => {
1042
+ const yBlocks = this._yBlocks();
1043
+ const totalHeight = this.totalHeight;
1044
+ const viewportHeight = this._viewportHeight();
1045
+ this.fixScroll();
1046
+ }, ...(ngDevMode ? [{ debugName: "fixScrollEffect", injector }] : [{ injector }]));
1047
+ const rootsEffect = effect(() => {
1048
+ const roots = this.treeModel.roots;
1049
+ fn();
1050
+ }, ...(ngDevMode ? [{ debugName: "rootsEffect", injector }] : [{ injector }]));
1051
+ const expandedEffect = effect(() => {
1052
+ const expandedNodes = this.treeModel.expandedNodes;
1053
+ fn();
1054
+ }, ...(ngDevMode ? [{ debugName: "expandedEffect", injector }] : [{ injector }]));
1055
+ const hiddenEffect = effect(() => {
1056
+ const hiddenNodes = this.treeModel.hiddenNodes;
1057
+ fn();
1058
+ }, ...(ngDevMode ? [{ debugName: "hiddenEffect", injector }] : [{ injector }]));
1204
1059
  this._dispose = [
1205
- ...this._dispose,
1206
- reaction(() => this.treeModel.roots, fn),
1207
- reaction(() => this.treeModel.expandedNodeIds, fn),
1208
- reaction(() => this.treeModel.hiddenNodeIds, fn)
1060
+ () => fixScrollEffect.destroy(),
1061
+ () => rootsEffect.destroy(),
1062
+ () => expandedEffect.destroy(),
1063
+ () => hiddenEffect.destroy()
1209
1064
  ];
1210
- this.treeModel.subscribe(TREE_EVENTS.loadNodeChildren, fn);
1211
1065
  }
1212
1066
  isEnabled() {
1213
1067
  return this.treeModel.options.useVirtualScroll;
@@ -1216,7 +1070,10 @@ class TreeVirtualScroll {
1216
1070
  this.yBlocks = value;
1217
1071
  }
1218
1072
  recalcPositions() {
1219
- this.treeModel.virtualRoot.height = this._getPositionAfter(this.treeModel.getVisibleRoots(), 0);
1073
+ const vRoot = this.treeModel['_virtualRoot']();
1074
+ if (vRoot) {
1075
+ vRoot.height = this._getPositionAfter(this.treeModel.getVisibleRoots(), 0);
1076
+ }
1220
1077
  }
1221
1078
  _getPositionAfter(nodes, startPos) {
1222
1079
  let position = startPos;
@@ -1312,39 +1169,12 @@ class TreeVirtualScroll {
1312
1169
  if (this.y > maxY)
1313
1170
  this._setYBlocks(maxY / Y_EPSILON);
1314
1171
  }
1315
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeVirtualScroll, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1316
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeVirtualScroll }); }
1172
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeVirtualScroll, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1173
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeVirtualScroll }); }
1317
1174
  }
1318
- __decorate$1([
1319
- observable$1
1320
- ], TreeVirtualScroll.prototype, "yBlocks", void 0);
1321
- __decorate$1([
1322
- observable$1
1323
- ], TreeVirtualScroll.prototype, "x", void 0);
1324
- __decorate$1([
1325
- observable$1
1326
- ], TreeVirtualScroll.prototype, "viewportHeight", void 0);
1327
- __decorate$1([
1328
- computed$1
1329
- ], TreeVirtualScroll.prototype, "y", null);
1330
- __decorate$1([
1331
- computed$1
1332
- ], TreeVirtualScroll.prototype, "totalHeight", null);
1333
- __decorate$1([
1334
- action$1
1335
- ], TreeVirtualScroll.prototype, "_setYBlocks", null);
1336
- __decorate$1([
1337
- action$1
1338
- ], TreeVirtualScroll.prototype, "recalcPositions", null);
1339
- __decorate$1([
1340
- action$1
1341
- ], TreeVirtualScroll.prototype, "setViewport", null);
1342
- __decorate$1([
1343
- action$1
1344
- ], TreeVirtualScroll.prototype, "scrollIntoView", null);
1345
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeVirtualScroll, decorators: [{
1175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeVirtualScroll, decorators: [{
1346
1176
  type: Injectable
1347
- }], ctorParameters: () => [], propDecorators: { yBlocks: [], x: [], viewportHeight: [], y: [], totalHeight: [], _setYBlocks: [], recalcPositions: [], setViewport: [], scrollIntoView: [] } });
1177
+ }], ctorParameters: () => [] });
1348
1178
  function binarySearch(nodes, condition, firstIndex = 0) {
1349
1179
  let index = firstIndex;
1350
1180
  let toIndex = nodes.length - 1;
@@ -1364,59 +1194,69 @@ function binarySearch(nodes, condition, firstIndex = 0) {
1364
1194
  }
1365
1195
 
1366
1196
  class LoadingComponent {
1367
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1368
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: LoadingComponent, isStandalone: true, selector: "tree-loading-component", inputs: { template: "template", node: "node" }, ngImport: i0, template: `
1369
- <span *ngIf="!template">loading...</span>
1197
+ constructor() {
1198
+ this.template = input(undefined, ...(ngDevMode ? [{ debugName: "template" }] : []));
1199
+ this.node = input(undefined, ...(ngDevMode ? [{ debugName: "node" }] : []));
1200
+ }
1201
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1202
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: LoadingComponent, isStandalone: true, selector: "tree-loading-component", inputs: { template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1203
+ @if (!template()) {
1204
+ <span>loading...</span>
1205
+ }
1370
1206
  <ng-container
1371
- [ngTemplateOutlet]="template"
1372
- [ngTemplateOutletContext]="{ $implicit: node }">
1207
+ [ngTemplateOutlet]="template()"
1208
+ [ngTemplateOutletContext]="{ $implicit: node() }"
1209
+ >
1373
1210
  </ng-container>
1374
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1211
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1375
1212
  }
1376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: LoadingComponent, decorators: [{
1213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: LoadingComponent, decorators: [{
1377
1214
  type: Component,
1378
1215
  args: [{
1379
1216
  encapsulation: ViewEncapsulation.None,
1380
1217
  selector: 'tree-loading-component',
1381
1218
  template: `
1382
- <span *ngIf="!template">loading...</span>
1219
+ @if (!template()) {
1220
+ <span>loading...</span>
1221
+ }
1383
1222
  <ng-container
1384
- [ngTemplateOutlet]="template"
1385
- [ngTemplateOutletContext]="{ $implicit: node }">
1223
+ [ngTemplateOutlet]="template()"
1224
+ [ngTemplateOutletContext]="{ $implicit: node() }"
1225
+ >
1386
1226
  </ng-container>
1387
1227
  `,
1388
- imports: [NgIf, NgTemplateOutlet]
1228
+ imports: [NgTemplateOutlet]
1389
1229
  }]
1390
- }], propDecorators: { template: [{
1391
- type: Input
1392
- }], node: [{
1393
- type: Input
1394
- }] } });
1230
+ }], propDecorators: { template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }], node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }] } });
1395
1231
 
1396
1232
  class TreeViewportComponent {
1397
1233
  constructor() {
1398
1234
  this.elementRef = inject(ElementRef);
1399
1235
  this.virtualScroll = inject(TreeVirtualScroll);
1236
+ this.injector = inject(Injector);
1237
+ this.renderer = inject(Renderer2);
1400
1238
  this.setViewport = this.throttle(() => {
1401
1239
  this.virtualScroll.setViewport(this.elementRef.nativeElement);
1402
1240
  }, 17);
1241
+ this.removeScrollListener = null;
1403
1242
  this.scrollEventHandler = this.setViewport.bind(this);
1404
1243
  }
1405
1244
  ngOnInit() {
1406
1245
  this.virtualScroll.init();
1246
+ this.virtualScroll.setupWatchers(this.injector);
1407
1247
  }
1408
1248
  ngAfterViewInit() {
1409
- setTimeout(() => {
1249
+ afterNextRender(() => {
1410
1250
  this.setViewport();
1411
1251
  this.virtualScroll.fireEvent({ eventName: TREE_EVENTS.initialized });
1412
- });
1413
- let el = this.elementRef.nativeElement;
1414
- el.addEventListener('scroll', this.scrollEventHandler);
1252
+ }, { injector: this.injector });
1253
+ const el = this.elementRef.nativeElement;
1254
+ this.removeScrollListener = this.renderer.listen(el, 'scroll', this.scrollEventHandler);
1415
1255
  }
1416
1256
  ngOnDestroy() {
1417
1257
  this.virtualScroll.clear();
1418
- let el = this.elementRef.nativeElement;
1419
- el.removeEventListener('scroll', this.scrollEventHandler);
1258
+ this.removeScrollListener?.();
1259
+ this.removeScrollListener = null;
1420
1260
  }
1421
1261
  getTotalHeight() {
1422
1262
  return ((this.virtualScroll.isEnabled() &&
@@ -1433,50 +1273,25 @@ class TreeViewportComponent {
1433
1273
  }
1434
1274
  };
1435
1275
  }
1436
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeViewportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1437
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeViewportComponent, isStandalone: true, selector: "tree-viewport", providers: [TreeVirtualScroll], ngImport: i0, template: `
1438
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
1439
- <div [style.height]="getTotalHeight()">
1440
- <ng-content></ng-content>
1441
- </div>
1442
- </ng-container>
1443
- `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }] }); }
1276
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeViewportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1277
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.0", type: TreeViewportComponent, isStandalone: true, selector: "tree-viewport", providers: [TreeVirtualScroll], ngImport: i0, template: `
1278
+ <div [style.height]="getTotalHeight()">
1279
+ <ng-content></ng-content>
1280
+ </div>
1281
+ `, isInline: true }); }
1444
1282
  }
1445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeViewportComponent, decorators: [{
1283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeViewportComponent, decorators: [{
1446
1284
  type: Component,
1447
1285
  args: [{ selector: 'tree-viewport', providers: [TreeVirtualScroll], template: `
1448
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
1449
- <div [style.height]="getTotalHeight()">
1450
- <ng-content></ng-content>
1451
- </div>
1452
- </ng-container>
1453
- `, imports: [TreeMobxAutorunDirective] }]
1286
+ <div [style.height]="getTotalHeight()">
1287
+ <ng-content></ng-content>
1288
+ </div>
1289
+ `, imports: [] }]
1454
1290
  }], ctorParameters: () => [] });
1455
1291
 
1456
- // Re-export mobx operators to be able to use inside components with AOT:
1457
- function actionInternal(...args) {
1458
- return action$1(...args);
1459
- }
1460
- const action = Object.assign(actionInternal, action$1);
1461
- function computedInternal(...args) {
1462
- return computed$1(...args);
1463
- }
1464
- const computed = Object.assign(computedInternal, computed$1);
1465
- function observableInternal(...args) {
1466
- return observable$1(...args);
1467
- }
1468
- const observable = Object.assign(observableInternal, observable$1);
1469
-
1470
- const DRAG_OVER_CLASS$1 = 'is-dragging-over';
1292
+ const DRAG_OVER_CLASS = 'is-dragging-over';
1471
1293
  const DRAG_DISABLED_CLASS = 'is-dragging-over-disabled';
1472
1294
  class TreeDropDirective {
1473
- set treeAllowDrop(allowDrop) {
1474
- if (allowDrop instanceof Function) {
1475
- this._allowDrop = allowDrop;
1476
- }
1477
- else
1478
- this._allowDrop = (element, $event) => allowDrop;
1479
- }
1480
1295
  allowDrop($event) {
1481
1296
  return this._allowDrop(this.treeDraggedElement.get(), $event);
1482
1297
  }
@@ -1484,41 +1299,53 @@ class TreeDropDirective {
1484
1299
  this.el = inject(ElementRef);
1485
1300
  this.renderer = inject(Renderer2);
1486
1301
  this.treeDraggedElement = inject(TreeDraggedElement);
1487
- this.ngZone = inject(NgZone);
1488
- this.allowDragoverStyling = true;
1489
- this.onDropCallback = new EventEmitter();
1490
- this.onDragOverCallback = new EventEmitter();
1491
- this.onDragLeaveCallback = new EventEmitter();
1492
- this.onDragEnterCallback = new EventEmitter();
1302
+ this.allowDragoverStyling = input(true, ...(ngDevMode ? [{ debugName: "allowDragoverStyling" }] : []));
1303
+ this.treeAllowDrop = input(undefined, ...(ngDevMode ? [{ debugName: "treeAllowDrop" }] : []));
1304
+ this.onDropCallback = output({ alias: 'treeDrop' });
1305
+ this.onDragOverCallback = output({ alias: 'treeDropDragOver' });
1306
+ this.onDragLeaveCallback = output({ alias: 'treeDropDragLeave' });
1307
+ this.onDragEnterCallback = output({ alias: 'treeDropDragEnter' });
1308
+ this.dragOverUnlisten = null;
1309
+ this.dragEnterUnlisten = null;
1310
+ this.dragLeaveUnlisten = null;
1493
1311
  this._allowDrop = (element, $event) => true;
1494
1312
  this.dragOverEventHandler = this.onDragOver.bind(this);
1495
1313
  this.dragEnterEventHandler = this.onDragEnter.bind(this);
1496
1314
  this.dragLeaveEventHandler = this.onDragLeave.bind(this);
1315
+ effect(() => {
1316
+ const allowDrop = this.treeAllowDrop();
1317
+ if (allowDrop instanceof Function) {
1318
+ this._allowDrop = allowDrop;
1319
+ }
1320
+ else if (allowDrop !== undefined) {
1321
+ this._allowDrop = (element, $event) => allowDrop;
1322
+ }
1323
+ });
1497
1324
  }
1498
1325
  ngAfterViewInit() {
1499
1326
  let el = this.el.nativeElement;
1500
- this.ngZone.runOutsideAngular(() => {
1501
- el.addEventListener('dragover', this.dragOverEventHandler);
1502
- el.addEventListener('dragenter', this.dragEnterEventHandler);
1503
- el.addEventListener('dragleave', this.dragLeaveEventHandler);
1504
- });
1327
+ this.dragOverUnlisten = this.renderer.listen(el, 'dragover', this.dragOverEventHandler);
1328
+ this.dragEnterUnlisten = this.renderer.listen(el, 'dragenter', this.dragEnterEventHandler);
1329
+ this.dragLeaveUnlisten = this.renderer.listen(el, 'dragleave', this.dragLeaveEventHandler);
1505
1330
  }
1506
1331
  ngOnDestroy() {
1507
- let el = this.el.nativeElement;
1508
- el.removeEventListener('dragover', this.dragOverEventHandler);
1509
- el.removeEventListener('dragenter', this.dragEnterEventHandler);
1510
- el.removeEventListener('dragleave', this.dragLeaveEventHandler);
1332
+ this.dragOverUnlisten?.();
1333
+ this.dragEnterUnlisten?.();
1334
+ this.dragLeaveUnlisten?.();
1335
+ this.dragOverUnlisten = null;
1336
+ this.dragEnterUnlisten = null;
1337
+ this.dragLeaveUnlisten = null;
1511
1338
  }
1512
1339
  onDragOver($event) {
1513
1340
  if (!this.allowDrop($event)) {
1514
- if (this.allowDragoverStyling) {
1341
+ if (this.allowDragoverStyling()) {
1515
1342
  return this.addDisabledClass();
1516
1343
  }
1517
1344
  return;
1518
1345
  }
1519
1346
  this.onDragOverCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1520
1347
  $event.preventDefault();
1521
- if (this.allowDragoverStyling) {
1348
+ if (this.allowDragoverStyling()) {
1522
1349
  this.addClass();
1523
1350
  }
1524
1351
  }
@@ -1530,13 +1357,13 @@ class TreeDropDirective {
1530
1357
  }
1531
1358
  onDragLeave($event) {
1532
1359
  if (!this.allowDrop($event)) {
1533
- if (this.allowDragoverStyling) {
1360
+ if (this.allowDragoverStyling()) {
1534
1361
  return this.removeDisabledClass();
1535
1362
  }
1536
1363
  return;
1537
1364
  }
1538
1365
  this.onDragLeaveCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1539
- if (this.allowDragoverStyling) {
1366
+ if (this.allowDragoverStyling()) {
1540
1367
  this.removeClass();
1541
1368
  }
1542
1369
  }
@@ -1545,16 +1372,16 @@ class TreeDropDirective {
1545
1372
  return;
1546
1373
  $event.preventDefault();
1547
1374
  this.onDropCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1548
- if (this.allowDragoverStyling) {
1375
+ if (this.allowDragoverStyling()) {
1549
1376
  this.removeClass();
1550
1377
  }
1551
1378
  this.treeDraggedElement.set(null);
1552
1379
  }
1553
1380
  addClass() {
1554
- this.renderer.addClass(this.el.nativeElement, DRAG_OVER_CLASS$1);
1381
+ this.renderer.addClass(this.el.nativeElement, DRAG_OVER_CLASS);
1555
1382
  }
1556
1383
  removeClass() {
1557
- this.renderer.removeClass(this.el.nativeElement, DRAG_OVER_CLASS$1);
1384
+ this.renderer.removeClass(this.el.nativeElement, DRAG_OVER_CLASS);
1558
1385
  }
1559
1386
  addDisabledClass() {
1560
1387
  this.renderer.addClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
@@ -1562,192 +1389,170 @@ class TreeDropDirective {
1562
1389
  removeDisabledClass() {
1563
1390
  this.renderer.removeClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
1564
1391
  }
1565
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1566
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: TreeDropDirective, isStandalone: true, selector: "[treeDrop]", inputs: { allowDragoverStyling: "allowDragoverStyling", treeAllowDrop: "treeAllowDrop" }, outputs: { onDropCallback: "treeDrop", onDragOverCallback: "treeDropDragOver", onDragLeaveCallback: "treeDropDragLeave", onDragEnterCallback: "treeDropDragEnter" }, host: { listeners: { "drop": "onDrop($event)" } }, ngImport: i0 }); }
1392
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1393
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: TreeDropDirective, isStandalone: true, selector: "[treeDrop]", inputs: { allowDragoverStyling: { classPropertyName: "allowDragoverStyling", publicName: "allowDragoverStyling", isSignal: true, isRequired: false, transformFunction: null }, treeAllowDrop: { classPropertyName: "treeAllowDrop", publicName: "treeAllowDrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onDropCallback: "treeDrop", onDragOverCallback: "treeDropDragOver", onDragLeaveCallback: "treeDropDragLeave", onDragEnterCallback: "treeDropDragEnter" }, host: { listeners: { "drop": "onDrop($event)" } }, ngImport: i0 }); }
1567
1394
  }
1568
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeDropDirective, decorators: [{
1395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeDropDirective, decorators: [{
1569
1396
  type: Directive,
1570
1397
  args: [{ selector: '[treeDrop]' }]
1571
- }], ctorParameters: () => [], propDecorators: { allowDragoverStyling: [{
1572
- type: Input
1573
- }], onDropCallback: [{
1574
- type: Output,
1575
- args: ['treeDrop']
1576
- }], onDragOverCallback: [{
1577
- type: Output,
1578
- args: ['treeDropDragOver']
1579
- }], onDragLeaveCallback: [{
1580
- type: Output,
1581
- args: ['treeDropDragLeave']
1582
- }], onDragEnterCallback: [{
1583
- type: Output,
1584
- args: ['treeDropDragEnter']
1585
- }], treeAllowDrop: [{
1586
- type: Input
1587
- }], onDrop: [{
1398
+ }], ctorParameters: () => [], propDecorators: { allowDragoverStyling: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDragoverStyling", required: false }] }], treeAllowDrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeAllowDrop", required: false }] }], onDropCallback: [{ type: i0.Output, args: ["treeDrop"] }], onDragOverCallback: [{ type: i0.Output, args: ["treeDropDragOver"] }], onDragLeaveCallback: [{ type: i0.Output, args: ["treeDropDragLeave"] }], onDragEnterCallback: [{ type: i0.Output, args: ["treeDropDragEnter"] }], onDrop: [{
1588
1399
  type: HostListener,
1589
1400
  args: ['drop', ['$event']]
1590
1401
  }] } });
1591
1402
 
1592
1403
  class TreeNodeDropSlot {
1404
+ constructor() {
1405
+ this.node = input(undefined, ...(ngDevMode ? [{ debugName: "node" }] : []));
1406
+ this.dropIndex = input(undefined, ...(ngDevMode ? [{ debugName: "dropIndex" }] : []));
1407
+ }
1593
1408
  onDrop($event) {
1594
- this.node.mouseAction('drop', $event.event, {
1409
+ this.node().mouseAction('drop', $event.event, {
1595
1410
  from: $event.element,
1596
- to: { parent: this.node, index: this.dropIndex }
1411
+ to: { parent: this.node(), index: this.dropIndex() }
1597
1412
  });
1598
1413
  }
1599
1414
  allowDrop(element, $event) {
1600
- return this.node.options.allowDrop(element, { parent: this.node, index: this.dropIndex }, $event);
1415
+ return this.node().options.allowDrop(element, { parent: this.node(), index: this.dropIndex() }, $event);
1601
1416
  }
1602
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeDropSlot, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1603
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeDropSlot, isStandalone: true, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: { node: "node", dropIndex: "dropIndex" }, ngImport: i0, template: `
1417
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeDropSlot, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1418
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: TreeNodeDropSlot, isStandalone: true, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null }, dropIndex: { classPropertyName: "dropIndex", publicName: "dropIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1604
1419
  <div
1605
1420
  class="node-drop-slot"
1606
1421
  (treeDrop)="onDrop($event)"
1607
1422
  [treeAllowDrop]="allowDrop.bind(this)"
1608
- [allowDragoverStyling]="true">
1609
- </div>
1423
+ [allowDragoverStyling]="true"
1424
+ ></div>
1610
1425
  `, isInline: true, dependencies: [{ kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }], encapsulation: i0.ViewEncapsulation.None }); }
1611
1426
  }
1612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeDropSlot, decorators: [{
1427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeDropSlot, decorators: [{
1613
1428
  type: Component,
1614
1429
  args: [{ selector: 'TreeNodeDropSlot, tree-node-drop-slot', encapsulation: ViewEncapsulation.None, template: `
1615
1430
  <div
1616
1431
  class="node-drop-slot"
1617
1432
  (treeDrop)="onDrop($event)"
1618
1433
  [treeAllowDrop]="allowDrop.bind(this)"
1619
- [allowDragoverStyling]="true">
1620
- </div>
1434
+ [allowDragoverStyling]="true"
1435
+ ></div>
1621
1436
  `, imports: [TreeDropDirective] }]
1622
- }], propDecorators: { node: [{
1623
- type: Input
1624
- }], dropIndex: [{
1625
- type: Input
1626
- }] } });
1437
+ }], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }], dropIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropIndex", required: false }] }] } });
1627
1438
 
1628
1439
  class TreeNodeCheckboxComponent {
1629
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1630
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeCheckboxComponent, isStandalone: true, selector: "tree-node-checkbox", inputs: { node: "node" }, ngImport: i0, template: `
1631
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
1632
- <input
1633
- class="tree-node-checkbox"
1634
- type="checkbox"
1635
- (click)="node.mouseAction('checkboxClick', $event)"
1636
- [checked]="node.isSelected"
1637
- [indeterminate]="node.isPartiallySelected"
1638
- />
1639
- </ng-container>
1640
- `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
1440
+ constructor() {
1441
+ this.node = input(undefined, ...(ngDevMode ? [{ debugName: "node" }] : []));
1442
+ }
1443
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1444
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: TreeNodeCheckboxComponent, isStandalone: true, selector: "tree-node-checkbox", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1445
+ <input
1446
+ class="tree-node-checkbox"
1447
+ type="checkbox"
1448
+ (click)="node().mouseAction('checkboxClick', $event)"
1449
+ [checked]="node().isSelected"
1450
+ [indeterminate]="node().isPartiallySelected"
1451
+ />
1452
+ `, isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
1641
1453
  }
1642
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeCheckboxComponent, decorators: [{
1454
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeCheckboxComponent, decorators: [{
1643
1455
  type: Component,
1644
1456
  args: [{ selector: 'tree-node-checkbox', encapsulation: ViewEncapsulation.None, template: `
1645
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
1646
- <input
1647
- class="tree-node-checkbox"
1648
- type="checkbox"
1649
- (click)="node.mouseAction('checkboxClick', $event)"
1650
- [checked]="node.isSelected"
1651
- [indeterminate]="node.isPartiallySelected"
1652
- />
1653
- </ng-container>
1654
- `, imports: [TreeMobxAutorunDirective] }]
1655
- }], propDecorators: { node: [{
1656
- type: Input
1657
- }] } });
1457
+ <input
1458
+ class="tree-node-checkbox"
1459
+ type="checkbox"
1460
+ (click)="node().mouseAction('checkboxClick', $event)"
1461
+ [checked]="node().isSelected"
1462
+ [indeterminate]="node().isPartiallySelected"
1463
+ />
1464
+ `, imports: [] }]
1465
+ }], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }] } });
1658
1466
 
1659
1467
  class TreeNodeExpanderComponent {
1660
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeExpanderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1661
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeExpanderComponent, isStandalone: true, selector: "tree-node-expander", inputs: { node: "node" }, ngImport: i0, template: `
1662
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
1663
- <span
1664
- *ngIf="node.hasChildren"
1665
- [class.toggle-children-wrapper-expanded]="node.isExpanded"
1666
- [class.toggle-children-wrapper-collapsed]="node.isCollapsed"
1667
- class="toggle-children-wrapper"
1668
- (click)="node.mouseAction('expanderClick', $event)"
1669
- >
1670
- <span class="toggle-children"></span>
1671
- </span>
1672
- <span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
1673
- </span>
1674
- </ng-container>
1675
- `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None }); }
1468
+ constructor() {
1469
+ this.node = input(...(ngDevMode ? [undefined, { debugName: "node" }] : []));
1470
+ this.hasChildren = computed(() => this.node().hasChildren, ...(ngDevMode ? [{ debugName: "hasChildren" }] : []));
1471
+ }
1472
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeExpanderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1473
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNodeExpanderComponent, isStandalone: true, selector: "tree-node-expander", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1474
+ @if (hasChildren()) {
1475
+ <span
1476
+ [class.toggle-children-wrapper-expanded]="node().isExpanded"
1477
+ [class.toggle-children-wrapper-collapsed]="node().isCollapsed"
1478
+ class="toggle-children-wrapper"
1479
+ (click)="node().mouseAction('expanderClick', $event)"
1480
+ >
1481
+ <span class="toggle-children"></span>
1482
+ </span>
1483
+ } @if (!hasChildren()) {
1484
+ <span class="toggle-children-placeholder"></span>
1485
+ }
1486
+ `, isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
1676
1487
  }
1677
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeExpanderComponent, decorators: [{
1488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeExpanderComponent, decorators: [{
1678
1489
  type: Component,
1679
1490
  args: [{ selector: 'tree-node-expander', encapsulation: ViewEncapsulation.None, template: `
1680
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
1681
- <span
1682
- *ngIf="node.hasChildren"
1683
- [class.toggle-children-wrapper-expanded]="node.isExpanded"
1684
- [class.toggle-children-wrapper-collapsed]="node.isCollapsed"
1685
- class="toggle-children-wrapper"
1686
- (click)="node.mouseAction('expanderClick', $event)"
1687
- >
1688
- <span class="toggle-children"></span>
1689
- </span>
1690
- <span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
1691
- </span>
1692
- </ng-container>
1693
- `, imports: [TreeMobxAutorunDirective, NgIf] }]
1694
- }], propDecorators: { node: [{
1695
- type: Input
1696
- }] } });
1491
+ @if (hasChildren()) {
1492
+ <span
1493
+ [class.toggle-children-wrapper-expanded]="node().isExpanded"
1494
+ [class.toggle-children-wrapper-collapsed]="node().isCollapsed"
1495
+ class="toggle-children-wrapper"
1496
+ (click)="node().mouseAction('expanderClick', $event)"
1497
+ >
1498
+ <span class="toggle-children"></span>
1499
+ </span>
1500
+ } @if (!hasChildren()) {
1501
+ <span class="toggle-children-placeholder"></span>
1502
+ }
1503
+ `, imports: [] }]
1504
+ }], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }] } });
1697
1505
 
1698
- const DRAG_OVER_CLASS = 'is-dragging-over';
1699
1506
  class TreeDragDirective {
1700
1507
  constructor() {
1701
1508
  this.el = inject(ElementRef);
1702
1509
  this.renderer = inject(Renderer2);
1703
1510
  this.treeDraggedElement = inject(TreeDraggedElement);
1704
- this.ngZone = inject(NgZone);
1511
+ this.draggedElement = input(undefined, ...(ngDevMode ? [{ debugName: "draggedElement", alias: "treeDrag" }] : [{ alias: "treeDrag" }]));
1512
+ this.treeDragEnabled = input(undefined, ...(ngDevMode ? [{ debugName: "treeDragEnabled" }] : []));
1513
+ this.dragUnlisten = null;
1705
1514
  this.dragEventHandler = this.onDrag.bind(this);
1706
1515
  }
1707
1516
  ngAfterViewInit() {
1708
1517
  let el = this.el.nativeElement;
1709
- this.ngZone.runOutsideAngular(() => {
1710
- el.addEventListener('drag', this.dragEventHandler);
1711
- });
1518
+ this.dragUnlisten = this.renderer.listen(el, 'drag', this.dragEventHandler);
1712
1519
  }
1713
1520
  ngDoCheck() {
1714
- this.renderer.setAttribute(this.el.nativeElement, 'draggable', this.treeDragEnabled ? 'true' : 'false');
1521
+ this.renderer.setAttribute(this.el.nativeElement, 'draggable', this.treeDragEnabled() ? 'true' : 'false');
1715
1522
  }
1716
1523
  ngOnDestroy() {
1717
- let el = this.el.nativeElement;
1718
- el.removeEventListener('drag', this.dragEventHandler);
1524
+ this.dragUnlisten?.();
1525
+ this.dragUnlisten = null;
1719
1526
  }
1720
1527
  onDragStart(ev) {
1721
1528
  // setting the data is required by firefox
1722
1529
  ev.dataTransfer.setData('text', ev.target.id);
1723
- this.treeDraggedElement.set(this.draggedElement);
1724
- if (this.draggedElement.mouseAction) {
1725
- this.draggedElement.mouseAction('dragStart', ev);
1530
+ const draggedElement = this.draggedElement();
1531
+ this.treeDraggedElement.set(draggedElement);
1532
+ if (draggedElement.mouseAction) {
1533
+ draggedElement.mouseAction('dragStart', ev);
1726
1534
  }
1727
1535
  }
1728
1536
  onDrag(ev) {
1729
- if (this.draggedElement.mouseAction) {
1730
- this.draggedElement.mouseAction('drag', ev);
1537
+ const draggedElement = this.draggedElement();
1538
+ if (draggedElement.mouseAction) {
1539
+ draggedElement.mouseAction('drag', ev);
1731
1540
  }
1732
1541
  }
1733
1542
  onDragEnd() {
1734
- if (this.draggedElement.mouseAction) {
1735
- this.draggedElement.mouseAction('dragEnd');
1543
+ const draggedElement = this.draggedElement();
1544
+ if (draggedElement.mouseAction) {
1545
+ draggedElement.mouseAction('dragEnd');
1736
1546
  }
1737
1547
  this.treeDraggedElement.set(null);
1738
1548
  }
1739
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeDragDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1740
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: TreeDragDirective, isStandalone: true, selector: "[treeDrag]", inputs: { draggedElement: ["treeDrag", "draggedElement"], treeDragEnabled: "treeDragEnabled" }, host: { listeners: { "dragstart": "onDragStart($event)", "dragend": "onDragEnd()" } }, ngImport: i0 }); }
1549
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeDragDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1550
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: TreeDragDirective, isStandalone: true, selector: "[treeDrag]", inputs: { draggedElement: { classPropertyName: "draggedElement", publicName: "treeDrag", isSignal: true, isRequired: false, transformFunction: null }, treeDragEnabled: { classPropertyName: "treeDragEnabled", publicName: "treeDragEnabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "dragstart": "onDragStart($event)", "dragend": "onDragEnd()" } }, ngImport: i0 }); }
1741
1551
  }
1742
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeDragDirective, decorators: [{
1552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeDragDirective, decorators: [{
1743
1553
  type: Directive,
1744
1554
  args: [{ selector: '[treeDrag]' }]
1745
- }], ctorParameters: () => [], propDecorators: { draggedElement: [{
1746
- type: Input,
1747
- args: ['treeDrag']
1748
- }], treeDragEnabled: [{
1749
- type: Input
1750
- }], onDragStart: [{
1555
+ }], ctorParameters: () => [], propDecorators: { draggedElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeDrag", required: false }] }], treeDragEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeDragEnabled", required: false }] }], onDragStart: [{
1751
1556
  type: HostListener,
1752
1557
  args: ['dragstart', ['$event']]
1753
1558
  }], onDragEnd: [{
@@ -1756,107 +1561,159 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
1756
1561
  }] } });
1757
1562
 
1758
1563
  class TreeNodeContent {
1759
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1760
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeContent, isStandalone: true, selector: "tree-node-content", inputs: { node: "node", index: "index", template: "template" }, ngImport: i0, template: `
1761
- <span *ngIf="!template">{{ node.displayField }}</span>
1762
- <ng-container
1763
- [ngTemplateOutlet]="template"
1764
- [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
1765
- </ng-container>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1564
+ constructor() {
1565
+ this.node = input(undefined, ...(ngDevMode ? [{ debugName: "node" }] : []));
1566
+ this.index = input(undefined, ...(ngDevMode ? [{ debugName: "index" }] : []));
1567
+ this.template = input(undefined, ...(ngDevMode ? [{ debugName: "template" }] : []));
1568
+ }
1569
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1570
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNodeContent, isStandalone: true, selector: "tree-node-content", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1571
+ @if (!template()) {
1572
+ <span>{{ node().displayField }}</span>
1573
+ }
1574
+ <ng-container
1575
+ [ngTemplateOutlet]="template()"
1576
+ [ngTemplateOutletContext]="{
1577
+ $implicit: node(),
1578
+ node: node(),
1579
+ index: index()
1580
+ }"
1581
+ >
1582
+ </ng-container>
1583
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1766
1584
  }
1767
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeContent, decorators: [{
1585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeContent, decorators: [{
1768
1586
  type: Component,
1769
1587
  args: [{
1770
1588
  selector: 'tree-node-content',
1771
1589
  encapsulation: ViewEncapsulation.None,
1772
1590
  template: `
1773
- <span *ngIf="!template">{{ node.displayField }}</span>
1774
- <ng-container
1775
- [ngTemplateOutlet]="template"
1776
- [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
1777
- </ng-container>`,
1778
- imports: [NgIf, NgTemplateOutlet]
1591
+ @if (!template()) {
1592
+ <span>{{ node().displayField }}</span>
1593
+ }
1594
+ <ng-container
1595
+ [ngTemplateOutlet]="template()"
1596
+ [ngTemplateOutletContext]="{
1597
+ $implicit: node(),
1598
+ node: node(),
1599
+ index: index()
1600
+ }"
1601
+ >
1602
+ </ng-container>
1603
+ `,
1604
+ imports: [NgTemplateOutlet]
1779
1605
  }]
1780
- }], propDecorators: { node: [{
1781
- type: Input
1782
- }], index: [{
1783
- type: Input
1784
- }], template: [{
1785
- type: Input
1786
- }] } });
1606
+ }], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }] } });
1787
1607
 
1788
1608
  class TreeNodeWrapperComponent {
1789
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1790
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeWrapperComponent, isStandalone: true, selector: "tree-node-wrapper", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
1791
- <div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
1792
- <tree-node-checkbox *ngIf="node.options.useCheckbox" [node]="node"></tree-node-checkbox>
1793
- <tree-node-expander [node]="node"></tree-node-expander>
1794
- <div class="node-content-wrapper"
1795
- [class.node-content-wrapper-active]="node.isActive"
1796
- [class.node-content-wrapper-focused]="node.isFocused"
1797
- (click)="node.mouseAction('click', $event)"
1798
- (dblclick)="node.mouseAction('dblClick', $event)"
1799
- (mouseover)="node.mouseAction('mouseOver', $event)"
1800
- (mouseout)="node.mouseAction('mouseOut', $event)"
1801
- (contextmenu)="node.mouseAction('contextMenu', $event)"
1802
- (treeDrop)="node.onDrop($event)"
1803
- (treeDropDragOver)="node.mouseAction('dragOver', $event)"
1804
- (treeDropDragLeave)="node.mouseAction('dragLeave', $event)"
1805
- (treeDropDragEnter)="node.mouseAction('dragEnter', $event)"
1806
- [treeAllowDrop]="node.allowDrop"
1807
- [allowDragoverStyling]="node.allowDragoverStyling()"
1808
- [treeDrag]="node"
1809
- [treeDragEnabled]="node.allowDrag()">
1810
-
1811
- <tree-node-content [node]="node" [index]="index" [template]="templates.treeNodeTemplate">
1812
- </tree-node-content>
1813
- </div>
1609
+ constructor() {
1610
+ this.node = input(...(ngDevMode ? [undefined, { debugName: "node" }] : []));
1611
+ this.index = input(undefined, ...(ngDevMode ? [{ debugName: "index" }] : []));
1612
+ this.templates = input(...(ngDevMode ? [undefined, { debugName: "templates" }] : []));
1613
+ this.treeNodeWrapperTemplate = computed(() => this.templates().treeNodeWrapperTemplate, ...(ngDevMode ? [{ debugName: "treeNodeWrapperTemplate" }] : []));
1614
+ }
1615
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1616
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNodeWrapperComponent, isStandalone: true, selector: "tree-node-wrapper", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, templates: { classPropertyName: "templates", publicName: "templates", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1617
+ @if (!treeNodeWrapperTemplate()) {
1618
+ <div class="node-wrapper" [style.padding-left]="node().getNodePadding()">
1619
+ @if (node().options.useCheckbox) {
1620
+ <tree-node-checkbox [node]="node()"></tree-node-checkbox>
1621
+ }
1622
+ <tree-node-expander [node]="node()"></tree-node-expander>
1623
+ <div
1624
+ class="node-content-wrapper"
1625
+ [class.node-content-wrapper-active]="node().isActive"
1626
+ [class.node-content-wrapper-focused]="node().isFocused"
1627
+ (click)="node().mouseAction('click', $event)"
1628
+ (dblclick)="node().mouseAction('dblClick', $event)"
1629
+ (mouseover)="node().mouseAction('mouseOver', $event)"
1630
+ (mouseout)="node().mouseAction('mouseOut', $event)"
1631
+ (contextmenu)="node().mouseAction('contextMenu', $event)"
1632
+ (treeDrop)="node().onDrop($event)"
1633
+ (treeDropDragOver)="node().mouseAction('dragOver', $event)"
1634
+ (treeDropDragLeave)="node().mouseAction('dragLeave', $event)"
1635
+ (treeDropDragEnter)="node().mouseAction('dragEnter', $event)"
1636
+ [treeAllowDrop]="node().allowDrop"
1637
+ [allowDragoverStyling]="node().allowDragoverStyling()"
1638
+ [treeDrag]="node()"
1639
+ [treeDragEnabled]="node().allowDrag()"
1640
+ >
1641
+ <tree-node-content
1642
+ [node]="node()"
1643
+ [index]="index()"
1644
+ [template]="templates().treeNodeTemplate"
1645
+ >
1646
+ </tree-node-content>
1814
1647
  </div>
1815
- <ng-container
1816
- [ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
1817
- [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
1818
- </ng-container>
1819
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeCheckboxComponent, selector: "tree-node-checkbox", inputs: ["node"] }, { kind: "component", type: TreeNodeExpanderComponent, selector: "tree-node-expander", inputs: ["node"] }, { kind: "directive", type: TreeDragDirective, selector: "[treeDrag]", inputs: ["treeDrag", "treeDragEnabled"] }, { kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }, { kind: "component", type: TreeNodeContent, selector: "tree-node-content", inputs: ["node", "index", "template"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1648
+ </div>
1649
+ }
1650
+ <ng-container
1651
+ [ngTemplateOutlet]="treeNodeWrapperTemplate()"
1652
+ [ngTemplateOutletContext]="{
1653
+ $implicit: node(),
1654
+ node: node(),
1655
+ index: index(),
1656
+ templates: templates()
1657
+ }"
1658
+ >
1659
+ </ng-container>
1660
+ `, isInline: true, dependencies: [{ kind: "component", type: TreeNodeCheckboxComponent, selector: "tree-node-checkbox", inputs: ["node"] }, { kind: "component", type: TreeNodeExpanderComponent, selector: "tree-node-expander", inputs: ["node"] }, { kind: "directive", type: TreeDragDirective, selector: "[treeDrag]", inputs: ["treeDrag", "treeDragEnabled"] }, { kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }, { kind: "component", type: TreeNodeContent, selector: "tree-node-content", inputs: ["node", "index", "template"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1820
1661
  }
1821
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeWrapperComponent, decorators: [{
1662
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeWrapperComponent, decorators: [{
1822
1663
  type: Component,
1823
1664
  args: [{ selector: 'tree-node-wrapper', encapsulation: ViewEncapsulation.None, template: `
1824
- <div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
1825
- <tree-node-checkbox *ngIf="node.options.useCheckbox" [node]="node"></tree-node-checkbox>
1826
- <tree-node-expander [node]="node"></tree-node-expander>
1827
- <div class="node-content-wrapper"
1828
- [class.node-content-wrapper-active]="node.isActive"
1829
- [class.node-content-wrapper-focused]="node.isFocused"
1830
- (click)="node.mouseAction('click', $event)"
1831
- (dblclick)="node.mouseAction('dblClick', $event)"
1832
- (mouseover)="node.mouseAction('mouseOver', $event)"
1833
- (mouseout)="node.mouseAction('mouseOut', $event)"
1834
- (contextmenu)="node.mouseAction('contextMenu', $event)"
1835
- (treeDrop)="node.onDrop($event)"
1836
- (treeDropDragOver)="node.mouseAction('dragOver', $event)"
1837
- (treeDropDragLeave)="node.mouseAction('dragLeave', $event)"
1838
- (treeDropDragEnter)="node.mouseAction('dragEnter', $event)"
1839
- [treeAllowDrop]="node.allowDrop"
1840
- [allowDragoverStyling]="node.allowDragoverStyling()"
1841
- [treeDrag]="node"
1842
- [treeDragEnabled]="node.allowDrag()">
1843
-
1844
- <tree-node-content [node]="node" [index]="index" [template]="templates.treeNodeTemplate">
1845
- </tree-node-content>
1846
- </div>
1665
+ @if (!treeNodeWrapperTemplate()) {
1666
+ <div class="node-wrapper" [style.padding-left]="node().getNodePadding()">
1667
+ @if (node().options.useCheckbox) {
1668
+ <tree-node-checkbox [node]="node()"></tree-node-checkbox>
1669
+ }
1670
+ <tree-node-expander [node]="node()"></tree-node-expander>
1671
+ <div
1672
+ class="node-content-wrapper"
1673
+ [class.node-content-wrapper-active]="node().isActive"
1674
+ [class.node-content-wrapper-focused]="node().isFocused"
1675
+ (click)="node().mouseAction('click', $event)"
1676
+ (dblclick)="node().mouseAction('dblClick', $event)"
1677
+ (mouseover)="node().mouseAction('mouseOver', $event)"
1678
+ (mouseout)="node().mouseAction('mouseOut', $event)"
1679
+ (contextmenu)="node().mouseAction('contextMenu', $event)"
1680
+ (treeDrop)="node().onDrop($event)"
1681
+ (treeDropDragOver)="node().mouseAction('dragOver', $event)"
1682
+ (treeDropDragLeave)="node().mouseAction('dragLeave', $event)"
1683
+ (treeDropDragEnter)="node().mouseAction('dragEnter', $event)"
1684
+ [treeAllowDrop]="node().allowDrop"
1685
+ [allowDragoverStyling]="node().allowDragoverStyling()"
1686
+ [treeDrag]="node()"
1687
+ [treeDragEnabled]="node().allowDrag()"
1688
+ >
1689
+ <tree-node-content
1690
+ [node]="node()"
1691
+ [index]="index()"
1692
+ [template]="templates().treeNodeTemplate"
1693
+ >
1694
+ </tree-node-content>
1847
1695
  </div>
1848
- <ng-container
1849
- [ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
1850
- [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
1851
- </ng-container>
1852
- `, imports: [NgIf, TreeNodeCheckboxComponent, TreeNodeExpanderComponent, TreeDragDirective, TreeDropDirective, TreeNodeContent, NgTemplateOutlet] }]
1853
- }], propDecorators: { node: [{
1854
- type: Input
1855
- }], index: [{
1856
- type: Input
1857
- }], templates: [{
1858
- type: Input
1859
- }] } });
1696
+ </div>
1697
+ }
1698
+ <ng-container
1699
+ [ngTemplateOutlet]="treeNodeWrapperTemplate()"
1700
+ [ngTemplateOutletContext]="{
1701
+ $implicit: node(),
1702
+ node: node(),
1703
+ index: index(),
1704
+ templates: templates()
1705
+ }"
1706
+ >
1707
+ </ng-container>
1708
+ `, imports: [
1709
+ TreeNodeCheckboxComponent,
1710
+ TreeNodeExpanderComponent,
1711
+ TreeDragDirective,
1712
+ TreeDropDirective,
1713
+ TreeNodeContent,
1714
+ NgTemplateOutlet
1715
+ ] }]
1716
+ }], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], templates: [{ type: i0.Input, args: [{ isSignal: true, alias: "templates", required: false }] }] } });
1860
1717
 
1861
1718
  const EASE_ACCELERATION = 1.005;
1862
1719
  class TreeAnimateOpenDirective {
@@ -1864,20 +1721,33 @@ class TreeAnimateOpenDirective {
1864
1721
  this.renderer = inject(Renderer2);
1865
1722
  this.templateRef = inject(TemplateRef);
1866
1723
  this.viewContainerRef = inject(ViewContainerRef);
1867
- }
1868
- set isOpen(value) {
1869
- if (value) {
1870
- this._show();
1871
- if (this.isEnabled && this._isOpen === false) {
1872
- this._animateOpen();
1724
+ this.isOpen = input(undefined, ...(ngDevMode ? [{ debugName: "isOpen", alias: 'treeAnimateOpen' }] : [{ alias: 'treeAnimateOpen' }]));
1725
+ this.animateSpeed = input(undefined, ...(ngDevMode ? [{ debugName: "animateSpeed", alias: 'treeAnimateOpenSpeed' }] : [{
1726
+ alias: 'treeAnimateOpenSpeed'
1727
+ }]));
1728
+ this.animateAcceleration = input(undefined, ...(ngDevMode ? [{ debugName: "animateAcceleration", alias: 'treeAnimateOpenAcceleration' }] : [{
1729
+ alias: 'treeAnimateOpenAcceleration'
1730
+ }]));
1731
+ this.isEnabled = input(undefined, ...(ngDevMode ? [{ debugName: "isEnabled", alias: 'treeAnimateOpenEnabled' }] : [{
1732
+ alias: 'treeAnimateOpenEnabled'
1733
+ }]));
1734
+ this.startOpenTimeout = null;
1735
+ this.openInterval = null;
1736
+ this.closeInterval = null;
1737
+ effect(() => {
1738
+ const value = this.isOpen();
1739
+ if (value) {
1740
+ this._show();
1741
+ if (this.isEnabled() && this.previousIsOpen === false) {
1742
+ this._animateOpen();
1743
+ }
1873
1744
  }
1874
- }
1875
- else {
1876
- this.isEnabled ? this._animateClose() : this._hide();
1877
- }
1878
- this._isOpen = !!value;
1745
+ else {
1746
+ this.isEnabled() ? this._animateClose() : this._hide();
1747
+ }
1748
+ this.previousIsOpen = !!value;
1749
+ });
1879
1750
  }
1880
- ;
1881
1751
  _show() {
1882
1752
  if (this.innerElement)
1883
1753
  return;
@@ -1885,30 +1755,38 @@ class TreeAnimateOpenDirective {
1885
1755
  this.innerElement = this.viewContainerRef.createEmbeddedView(this.templateRef).rootNodes[0];
1886
1756
  }
1887
1757
  _hide() {
1758
+ this.clearTimers();
1888
1759
  this.viewContainerRef.clear();
1889
1760
  this.innerElement = null;
1890
1761
  }
1891
1762
  _animateOpen() {
1892
- let delta = this.animateSpeed;
1893
- let ease = this.animateAcceleration;
1763
+ this.clearTimers();
1764
+ let delta = this.animateSpeed();
1765
+ let ease = this.animateAcceleration();
1894
1766
  let maxHeight = 0;
1895
1767
  // set height to 0
1896
1768
  this.renderer.setStyle(this.innerElement, 'max-height', `0`);
1897
1769
  // increase maxHeight until height doesn't change
1898
- setTimeout(() => {
1899
- const i = setInterval(() => {
1900
- if (!this._isOpen || !this.innerElement)
1901
- return clearInterval(i);
1770
+ this.startOpenTimeout = setTimeout(() => {
1771
+ this.startOpenTimeout = null;
1772
+ // Allow inner element to create its content
1773
+ this.openInterval = setInterval(() => {
1774
+ if (!this.isOpen() || !this.innerElement) {
1775
+ this.clearOpenInterval();
1776
+ return;
1777
+ }
1902
1778
  maxHeight += delta;
1903
1779
  const roundedMaxHeight = Math.round(maxHeight);
1904
1780
  this.renderer.setStyle(this.innerElement, 'max-height', `${roundedMaxHeight}px`);
1905
- const height = this.innerElement.getBoundingClientRect ? this.innerElement.getBoundingClientRect().height : 0; // TBD use renderer
1781
+ const height = this.innerElement.getBoundingClientRect
1782
+ ? this.innerElement.getBoundingClientRect().height
1783
+ : 0; // TBD use renderer
1906
1784
  delta *= ease;
1907
1785
  ease *= EASE_ACCELERATION;
1908
1786
  if (height < roundedMaxHeight) {
1909
1787
  // Make maxHeight auto because animation finished and container might change height later on
1910
1788
  this.renderer.setStyle(this.innerElement, 'max-height', null);
1911
- clearInterval(i);
1789
+ this.clearOpenInterval();
1912
1790
  }
1913
1791
  }, 17);
1914
1792
  });
@@ -1916,13 +1794,16 @@ class TreeAnimateOpenDirective {
1916
1794
  _animateClose() {
1917
1795
  if (!this.innerElement)
1918
1796
  return;
1919
- let delta = this.animateSpeed;
1920
- let ease = this.animateAcceleration;
1797
+ this.clearTimers();
1798
+ let delta = this.animateSpeed();
1799
+ let ease = this.animateAcceleration();
1921
1800
  let height = this.innerElement.getBoundingClientRect().height; // TBD use renderer
1922
1801
  // slowly decrease maxHeight to 0, starting from current height
1923
- const i = setInterval(() => {
1924
- if (this._isOpen || !this.innerElement)
1925
- return clearInterval(i);
1802
+ this.closeInterval = setInterval(() => {
1803
+ if (this.isOpen() || !this.innerElement) {
1804
+ this.clearCloseInterval();
1805
+ return;
1806
+ }
1926
1807
  height -= delta;
1927
1808
  this.renderer.setStyle(this.innerElement, 'max-height', `${height}px`);
1928
1809
  delta *= ease;
@@ -1931,313 +1812,286 @@ class TreeAnimateOpenDirective {
1931
1812
  // after animation complete - remove child element
1932
1813
  this.viewContainerRef.clear();
1933
1814
  this.innerElement = null;
1934
- clearInterval(i);
1815
+ this.clearCloseInterval();
1935
1816
  }
1936
1817
  }, 17);
1937
1818
  }
1938
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeAnimateOpenDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1939
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: TreeAnimateOpenDirective, isStandalone: true, selector: "[treeAnimateOpen]", inputs: { animateSpeed: ["treeAnimateOpenSpeed", "animateSpeed"], animateAcceleration: ["treeAnimateOpenAcceleration", "animateAcceleration"], isEnabled: ["treeAnimateOpenEnabled", "isEnabled"], isOpen: ["treeAnimateOpen", "isOpen"] }, ngImport: i0 }); }
1819
+ ngOnDestroy() {
1820
+ this.clearTimers();
1821
+ }
1822
+ clearTimers() {
1823
+ if (this.startOpenTimeout !== null) {
1824
+ clearTimeout(this.startOpenTimeout);
1825
+ this.startOpenTimeout = null;
1826
+ }
1827
+ this.clearOpenInterval();
1828
+ this.clearCloseInterval();
1829
+ }
1830
+ clearOpenInterval() {
1831
+ if (this.openInterval !== null) {
1832
+ clearInterval(this.openInterval);
1833
+ this.openInterval = null;
1834
+ }
1835
+ }
1836
+ clearCloseInterval() {
1837
+ if (this.closeInterval !== null) {
1838
+ clearInterval(this.closeInterval);
1839
+ this.closeInterval = null;
1840
+ }
1841
+ }
1842
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeAnimateOpenDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1843
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: TreeAnimateOpenDirective, isStandalone: true, selector: "[treeAnimateOpen]", inputs: { isOpen: { classPropertyName: "isOpen", publicName: "treeAnimateOpen", isSignal: true, isRequired: false, transformFunction: null }, animateSpeed: { classPropertyName: "animateSpeed", publicName: "treeAnimateOpenSpeed", isSignal: true, isRequired: false, transformFunction: null }, animateAcceleration: { classPropertyName: "animateAcceleration", publicName: "treeAnimateOpenAcceleration", isSignal: true, isRequired: false, transformFunction: null }, isEnabled: { classPropertyName: "isEnabled", publicName: "treeAnimateOpenEnabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
1940
1844
  }
1941
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeAnimateOpenDirective, decorators: [{
1845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeAnimateOpenDirective, decorators: [{
1942
1846
  type: Directive,
1943
1847
  args: [{ selector: '[treeAnimateOpen]' }]
1944
- }], propDecorators: { animateSpeed: [{
1945
- type: Input,
1946
- args: ['treeAnimateOpenSpeed']
1947
- }], animateAcceleration: [{
1948
- type: Input,
1949
- args: ['treeAnimateOpenAcceleration']
1950
- }], isEnabled: [{
1951
- type: Input,
1952
- args: ['treeAnimateOpenEnabled']
1953
- }], isOpen: [{
1954
- type: Input,
1955
- args: ['treeAnimateOpen']
1956
- }] } });
1848
+ }], ctorParameters: () => [], propDecorators: { isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeAnimateOpen", required: false }] }], animateSpeed: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeAnimateOpenSpeed", required: false }] }], animateAcceleration: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeAnimateOpenAcceleration", required: false }] }], isEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeAnimateOpenEnabled", required: false }] }] } });
1957
1849
 
1958
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
1959
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1960
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1961
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1962
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1963
- };
1964
1850
  class TreeNodeChildrenComponent {
1965
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeChildrenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1966
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeChildrenComponent, isStandalone: true, selector: "tree-node-children", inputs: { node: "node", templates: "templates" }, ngImport: i0, template: `
1967
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
1968
- <div
1969
- [class.tree-children]="true"
1970
- [class.tree-children-no-padding]="node.options.levelPadding"
1971
- *treeAnimateOpen="
1972
- node.isExpanded;
1973
- speed: node.options.animateSpeed;
1974
- acceleration: node.options.animateAcceleration;
1975
- enabled: node.options.animateExpand
1976
- "
1851
+ constructor() {
1852
+ this.node = input(...(ngDevMode ? [undefined, { debugName: "node" }] : []));
1853
+ this.templates = input(undefined, ...(ngDevMode ? [{ debugName: "templates" }] : []));
1854
+ this.children = computed(() => this.node().children, ...(ngDevMode ? [{ debugName: "children" }] : []));
1855
+ }
1856
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeChildrenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1857
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNodeChildrenComponent, isStandalone: true, selector: "tree-node-children", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null }, templates: { classPropertyName: "templates", publicName: "templates", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1858
+ <div
1859
+ [class.tree-children]="true"
1860
+ [class.tree-children-no-padding]="node().options.levelPadding"
1861
+ *treeAnimateOpen="
1862
+ node().isExpanded;
1863
+ speed: node().options.animateSpeed;
1864
+ acceleration: node().options.animateAcceleration;
1865
+ enabled: node().options.animateExpand
1866
+ "
1867
+ >
1868
+ @if (children()) {
1869
+ <tree-node-collection
1870
+ [nodes]="children()"
1871
+ [templates]="templates()"
1872
+ [treeModel]="node().treeModel"
1977
1873
  >
1978
- <tree-node-collection
1979
- *ngIf="node.children"
1980
- [nodes]="node.children"
1981
- [templates]="templates"
1982
- [treeModel]="node.treeModel"
1983
- >
1984
- </tree-node-collection>
1985
- <tree-loading-component
1986
- [style.padding-left]="node.getNodePadding()"
1987
- class="tree-node-loading"
1988
- *ngIf="!node.children"
1989
- [template]="templates.loadingTemplate"
1990
- [node]="node"
1991
- ></tree-loading-component>
1992
- </div>
1993
- </ng-container>
1994
- `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => TreeMobxAutorunDirective), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: i0.forwardRef(() => TreeAnimateOpenDirective), selector: "[treeAnimateOpen]", inputs: ["treeAnimateOpenSpeed", "treeAnimateOpenAcceleration", "treeAnimateOpenEnabled", "treeAnimateOpen"] }, { kind: "directive", type: i0.forwardRef(() => NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(() => TreeNodeCollectionComponent), selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: i0.forwardRef(() => LoadingComponent), selector: "tree-loading-component", inputs: ["template", "node"] }], encapsulation: i0.ViewEncapsulation.None }); }
1874
+ </tree-node-collection>
1875
+ } @if (!children()) {
1876
+ <tree-loading-component
1877
+ [style.padding-left]="node().getNodePadding()"
1878
+ class="tree-node-loading"
1879
+ [template]="templates().loadingTemplate"
1880
+ [node]="node()"
1881
+ ></tree-loading-component>
1882
+ }
1883
+ </div>
1884
+ `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => TreeAnimateOpenDirective), selector: "[treeAnimateOpen]", inputs: ["treeAnimateOpen", "treeAnimateOpenSpeed", "treeAnimateOpenAcceleration", "treeAnimateOpenEnabled"] }, { kind: "component", type: i0.forwardRef(() => TreeNodeCollectionComponent), selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: i0.forwardRef(() => LoadingComponent), selector: "tree-loading-component", inputs: ["template", "node"] }], encapsulation: i0.ViewEncapsulation.None }); }
1995
1885
  }
1996
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeChildrenComponent, decorators: [{
1886
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeChildrenComponent, decorators: [{
1997
1887
  type: Component,
1998
1888
  args: [{ selector: 'tree-node-children', encapsulation: ViewEncapsulation.None, template: `
1999
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
2000
- <div
2001
- [class.tree-children]="true"
2002
- [class.tree-children-no-padding]="node.options.levelPadding"
2003
- *treeAnimateOpen="
2004
- node.isExpanded;
2005
- speed: node.options.animateSpeed;
2006
- acceleration: node.options.animateAcceleration;
2007
- enabled: node.options.animateExpand
2008
- "
1889
+ <div
1890
+ [class.tree-children]="true"
1891
+ [class.tree-children-no-padding]="node().options.levelPadding"
1892
+ *treeAnimateOpen="
1893
+ node().isExpanded;
1894
+ speed: node().options.animateSpeed;
1895
+ acceleration: node().options.animateAcceleration;
1896
+ enabled: node().options.animateExpand
1897
+ "
1898
+ >
1899
+ @if (children()) {
1900
+ <tree-node-collection
1901
+ [nodes]="children()"
1902
+ [templates]="templates()"
1903
+ [treeModel]="node().treeModel"
2009
1904
  >
2010
- <tree-node-collection
2011
- *ngIf="node.children"
2012
- [nodes]="node.children"
2013
- [templates]="templates"
2014
- [treeModel]="node.treeModel"
2015
- >
2016
- </tree-node-collection>
2017
- <tree-loading-component
2018
- [style.padding-left]="node.getNodePadding()"
2019
- class="tree-node-loading"
2020
- *ngIf="!node.children"
2021
- [template]="templates.loadingTemplate"
2022
- [node]="node"
2023
- ></tree-loading-component>
2024
- </div>
2025
- </ng-container>
2026
- `, imports: [TreeMobxAutorunDirective, TreeAnimateOpenDirective, NgIf, forwardRef((() => TreeNodeCollectionComponent)), LoadingComponent] }]
2027
- }], propDecorators: { node: [{
2028
- type: Input
2029
- }], templates: [{
2030
- type: Input
2031
- }] } });
1905
+ </tree-node-collection>
1906
+ } @if (!children()) {
1907
+ <tree-loading-component
1908
+ [style.padding-left]="node().getNodePadding()"
1909
+ class="tree-node-loading"
1910
+ [template]="templates().loadingTemplate"
1911
+ [node]="node()"
1912
+ ></tree-loading-component>
1913
+ }
1914
+ </div>
1915
+ `, imports: [
1916
+ TreeAnimateOpenDirective,
1917
+ forwardRef((() => TreeNodeCollectionComponent)),
1918
+ LoadingComponent
1919
+ ] }]
1920
+ }], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }], templates: [{ type: i0.Input, args: [{ isSignal: true, alias: "templates", required: false }] }] } });
2032
1921
  class TreeNodeCollectionComponent {
2033
1922
  constructor() {
2034
- this._dispose = [];
2035
- }
2036
- get nodes() {
2037
- return this._nodes;
2038
- }
2039
- set nodes(nodes) {
2040
- this.setNodes(nodes);
2041
- }
2042
- get marginTop() {
2043
- const firstNode = this.viewportNodes && this.viewportNodes.length && this.viewportNodes[0];
2044
- const relativePosition = firstNode && firstNode.parent
2045
- ? firstNode.position -
2046
- firstNode.parent.position -
2047
- firstNode.parent.getSelfHeight()
2048
- : 0;
2049
- return `${relativePosition}px`;
2050
- }
2051
- setNodes(nodes) {
2052
- this._nodes = nodes;
1923
+ this.nodes = input(undefined, ...(ngDevMode ? [{ debugName: "nodes" }] : []));
1924
+ this.treeModel = input(undefined, ...(ngDevMode ? [{ debugName: "treeModel" }] : []));
1925
+ this.injector = inject(Injector);
1926
+ this.templates = input(undefined, ...(ngDevMode ? [{ debugName: "templates" }] : []));
1927
+ this.viewportNodes = signal([], ...(ngDevMode ? [{ debugName: "viewportNodes" }] : []));
1928
+ this.marginTop = computed(() => {
1929
+ const nodes = this.viewportNodes();
1930
+ const firstNode = nodes && nodes.length && nodes[0];
1931
+ const relativePosition = firstNode && firstNode.parent
1932
+ ? firstNode.position -
1933
+ firstNode.parent.position -
1934
+ firstNode.parent.getSelfHeight()
1935
+ : 0;
1936
+ return `${relativePosition}px`;
1937
+ }, ...(ngDevMode ? [{ debugName: "marginTop" }] : []));
1938
+ this._disposeEffects = [];
2053
1939
  }
2054
1940
  ngOnInit() {
2055
- this.virtualScroll = this.treeModel.virtualScroll;
2056
- this._dispose = [
2057
- // return node indexes so we can compare structurally,
2058
- reaction(() => {
2059
- return this.virtualScroll
2060
- .getViewportNodes(this.nodes)
2061
- .map(n => n.index);
2062
- }, nodeIndexes => {
2063
- this.viewportNodes = nodeIndexes.map(i => this.nodes[i]);
2064
- }, { compareStructural: true, fireImmediately: true }),
2065
- reaction(() => this.nodes, nodes => {
2066
- this.viewportNodes = this.virtualScroll.getViewportNodes(nodes);
2067
- })
2068
- ];
1941
+ this.virtualScroll = this.treeModel().virtualScroll;
1942
+ const viewportEffect = effect(() => {
1943
+ const nodes = this.nodes();
1944
+ if (nodes && this.virtualScroll) {
1945
+ const viewportNodes = this.virtualScroll.getViewportNodes(nodes);
1946
+ this.viewportNodes.set(viewportNodes);
1947
+ }
1948
+ }, ...(ngDevMode ? [{ debugName: "viewportEffect", injector: this.injector }] : [{ injector: this.injector }]));
1949
+ this._disposeEffects = [() => viewportEffect.destroy()];
2069
1950
  }
2070
1951
  ngOnDestroy() {
2071
- this._dispose.forEach(d => d());
1952
+ this._disposeEffects.forEach(d => d());
2072
1953
  }
2073
1954
  trackNode(index, node) {
2074
1955
  return node.id;
2075
1956
  }
2076
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeCollectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2077
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeCollectionComponent, isStandalone: true, selector: "tree-node-collection", inputs: { nodes: "nodes", treeModel: "treeModel", templates: "templates" }, ngImport: i0, template: `
2078
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
2079
- <div [style.margin-top]="marginTop">
2080
- <tree-node
2081
- *ngFor="let node of viewportNodes; let i = index; trackBy: trackNode"
2082
- [node]="node"
2083
- [index]="i"
2084
- [templates]="templates"
2085
- >
2086
- </tree-node>
2087
- </div>
2088
- </ng-container>
2089
- `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => TreeMobxAutorunDirective), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: i0.forwardRef(() => NgFor), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i0.forwardRef(() => TreeNodeComponent), selector: "TreeNode, tree-node", inputs: ["node", "index", "templates"] }], encapsulation: i0.ViewEncapsulation.None }); }
1957
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeCollectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1958
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNodeCollectionComponent, isStandalone: true, selector: "tree-node-collection", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, treeModel: { classPropertyName: "treeModel", publicName: "treeModel", isSignal: true, isRequired: false, transformFunction: null }, templates: { classPropertyName: "templates", publicName: "templates", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1959
+ <div [style.margin-top]="marginTop()">
1960
+ @for (node of viewportNodes(); track trackNode(i, node); let i = $index) {
1961
+ <tree-node [node]="node" [index]="i" [templates]="templates()">
1962
+ </tree-node>
1963
+ }
1964
+ </div>
1965
+ `, isInline: true, dependencies: [{ kind: "component", type: i0.forwardRef(() => TreeNodeComponent), selector: "TreeNode, tree-node", inputs: ["node", "index", "templates"] }], encapsulation: i0.ViewEncapsulation.None }); }
2090
1966
  }
2091
- __decorate([
2092
- observable
2093
- ], TreeNodeCollectionComponent.prototype, "_nodes", void 0);
2094
- __decorate([
2095
- observable
2096
- ], TreeNodeCollectionComponent.prototype, "viewportNodes", void 0);
2097
- __decorate([
2098
- computed
2099
- ], TreeNodeCollectionComponent.prototype, "marginTop", null);
2100
- __decorate([
2101
- action
2102
- ], TreeNodeCollectionComponent.prototype, "setNodes", null);
2103
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeCollectionComponent, decorators: [{
1967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeCollectionComponent, decorators: [{
2104
1968
  type: Component,
2105
1969
  args: [{
2106
1970
  selector: 'tree-node-collection',
2107
1971
  encapsulation: ViewEncapsulation.None,
2108
1972
  template: `
2109
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
2110
- <div [style.margin-top]="marginTop">
2111
- <tree-node
2112
- *ngFor="let node of viewportNodes; let i = index; trackBy: trackNode"
2113
- [node]="node"
2114
- [index]="i"
2115
- [templates]="templates"
2116
- >
2117
- </tree-node>
2118
- </div>
2119
- </ng-container>
1973
+ <div [style.margin-top]="marginTop()">
1974
+ @for (node of viewportNodes(); track trackNode(i, node); let i = $index) {
1975
+ <tree-node [node]="node" [index]="i" [templates]="templates()">
1976
+ </tree-node>
1977
+ }
1978
+ </div>
2120
1979
  `,
2121
- imports: [TreeMobxAutorunDirective, NgFor, forwardRef((() => TreeNodeComponent))]
1980
+ imports: [forwardRef((() => TreeNodeComponent))]
2122
1981
  }]
2123
- }], propDecorators: { nodes: [{
2124
- type: Input
2125
- }], treeModel: [{
2126
- type: Input
2127
- }], _nodes: [], templates: [{
2128
- type: Input
2129
- }], viewportNodes: [], marginTop: [], setNodes: [] } });
1982
+ }], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: false }] }], treeModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeModel", required: false }] }], templates: [{ type: i0.Input, args: [{ isSignal: true, alias: "templates", required: false }] }] } });
2130
1983
  class TreeNodeComponent {
2131
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2132
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeNodeComponent, isStandalone: true, selector: "TreeNode, tree-node", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
2133
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
2134
- <div
2135
- *ngIf="!templates.treeNodeFullTemplate"
2136
- [class]="node.getClass()"
2137
- [class.tree-node]="true"
2138
- [class.tree-node-expanded]="node.isExpanded && node.hasChildren"
2139
- [class.tree-node-collapsed]="node.isCollapsed && node.hasChildren"
2140
- [class.tree-node-leaf]="node.isLeaf"
2141
- [class.tree-node-active]="node.isActive"
2142
- [class.tree-node-focused]="node.isFocused"
2143
- >
2144
- <tree-node-drop-slot
2145
- *ngIf="index === 0"
2146
- [dropIndex]="node.index"
2147
- [node]="node.parent"
2148
- ></tree-node-drop-slot>
1984
+ constructor() {
1985
+ this.node = input(undefined, ...(ngDevMode ? [{ debugName: "node" }] : []));
1986
+ this.index = input(undefined, ...(ngDevMode ? [{ debugName: "index" }] : []));
1987
+ this.templates = input(...(ngDevMode ? [undefined, { debugName: "templates" }] : []));
1988
+ this.treeNodeFullTemplate = computed(() => this.templates().treeNodeFullTemplate, ...(ngDevMode ? [{ debugName: "treeNodeFullTemplate" }] : []));
1989
+ }
1990
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1991
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeNodeComponent, isStandalone: true, selector: "TreeNode, tree-node", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, templates: { classPropertyName: "templates", publicName: "templates", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1992
+ @if (!treeNodeFullTemplate()) {
1993
+ <div
1994
+ [class]="node().getClass()"
1995
+ [class.tree-node]="true"
1996
+ [class.tree-node-expanded]="node().isExpanded && node().hasChildren"
1997
+ [class.tree-node-collapsed]="node().isCollapsed && node().hasChildren"
1998
+ [class.tree-node-leaf]="node().isLeaf"
1999
+ [class.tree-node-active]="node().isActive"
2000
+ [class.tree-node-focused]="node().isFocused"
2001
+ >
2002
+ @if (index() === 0) {
2003
+ <tree-node-drop-slot
2004
+ [dropIndex]="node().index"
2005
+ [node]="node().parent"
2006
+ ></tree-node-drop-slot>
2007
+ }
2149
2008
 
2150
- <tree-node-wrapper
2151
- [node]="node"
2152
- [index]="index"
2153
- [templates]="templates"
2154
- ></tree-node-wrapper>
2009
+ <tree-node-wrapper
2010
+ [node]="node()"
2011
+ [index]="index()"
2012
+ [templates]="templates()"
2013
+ ></tree-node-wrapper>
2155
2014
 
2156
- <tree-node-children
2157
- [node]="node"
2158
- [templates]="templates"
2159
- ></tree-node-children>
2160
- <tree-node-drop-slot
2161
- [dropIndex]="node.index + 1"
2162
- [node]="node.parent"
2163
- ></tree-node-drop-slot>
2164
- </div>
2165
- <ng-container
2166
- [ngTemplateOutlet]="templates.treeNodeFullTemplate"
2167
- [ngTemplateOutletContext]="{
2168
- $implicit: node,
2169
- node: node,
2170
- index: index,
2171
- templates: templates
2172
- }"
2173
- >
2174
- </ng-container>
2015
+ <tree-node-children
2016
+ [node]="node()"
2017
+ [templates]="templates()"
2018
+ ></tree-node-children>
2019
+ <tree-node-drop-slot
2020
+ [dropIndex]="node().index + 1"
2021
+ [node]="node().parent"
2022
+ ></tree-node-drop-slot>
2023
+ </div>
2024
+ }
2025
+ <ng-container
2026
+ [ngTemplateOutlet]="treeNodeFullTemplate()"
2027
+ [ngTemplateOutletContext]="{
2028
+ $implicit: node(),
2029
+ node: node(),
2030
+ index: index(),
2031
+ templates: templates()
2032
+ }"
2033
+ >
2175
2034
  </ng-container>
2176
- `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }, { kind: "component", type: TreeNodeWrapperComponent, selector: "tree-node-wrapper", inputs: ["node", "index", "templates"] }, { kind: "component", type: TreeNodeChildrenComponent, selector: "tree-node-children", inputs: ["node", "templates"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
2035
+ `, isInline: true, dependencies: [{ kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }, { kind: "component", type: TreeNodeWrapperComponent, selector: "tree-node-wrapper", inputs: ["node", "index", "templates"] }, { kind: "component", type: TreeNodeChildrenComponent, selector: "tree-node-children", inputs: ["node", "templates"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
2177
2036
  }
2178
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeNodeComponent, decorators: [{
2037
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeComponent, decorators: [{
2179
2038
  type: Component,
2180
2039
  args: [{ selector: 'TreeNode, tree-node', encapsulation: ViewEncapsulation.None, template: `
2181
- <ng-container *treeMobxAutorun="{ dontDetach: true }">
2182
- <div
2183
- *ngIf="!templates.treeNodeFullTemplate"
2184
- [class]="node.getClass()"
2185
- [class.tree-node]="true"
2186
- [class.tree-node-expanded]="node.isExpanded && node.hasChildren"
2187
- [class.tree-node-collapsed]="node.isCollapsed && node.hasChildren"
2188
- [class.tree-node-leaf]="node.isLeaf"
2189
- [class.tree-node-active]="node.isActive"
2190
- [class.tree-node-focused]="node.isFocused"
2191
- >
2192
- <tree-node-drop-slot
2193
- *ngIf="index === 0"
2194
- [dropIndex]="node.index"
2195
- [node]="node.parent"
2196
- ></tree-node-drop-slot>
2040
+ @if (!treeNodeFullTemplate()) {
2041
+ <div
2042
+ [class]="node().getClass()"
2043
+ [class.tree-node]="true"
2044
+ [class.tree-node-expanded]="node().isExpanded && node().hasChildren"
2045
+ [class.tree-node-collapsed]="node().isCollapsed && node().hasChildren"
2046
+ [class.tree-node-leaf]="node().isLeaf"
2047
+ [class.tree-node-active]="node().isActive"
2048
+ [class.tree-node-focused]="node().isFocused"
2049
+ >
2050
+ @if (index() === 0) {
2051
+ <tree-node-drop-slot
2052
+ [dropIndex]="node().index"
2053
+ [node]="node().parent"
2054
+ ></tree-node-drop-slot>
2055
+ }
2197
2056
 
2198
- <tree-node-wrapper
2199
- [node]="node"
2200
- [index]="index"
2201
- [templates]="templates"
2202
- ></tree-node-wrapper>
2057
+ <tree-node-wrapper
2058
+ [node]="node()"
2059
+ [index]="index()"
2060
+ [templates]="templates()"
2061
+ ></tree-node-wrapper>
2203
2062
 
2204
- <tree-node-children
2205
- [node]="node"
2206
- [templates]="templates"
2207
- ></tree-node-children>
2208
- <tree-node-drop-slot
2209
- [dropIndex]="node.index + 1"
2210
- [node]="node.parent"
2211
- ></tree-node-drop-slot>
2212
- </div>
2213
- <ng-container
2214
- [ngTemplateOutlet]="templates.treeNodeFullTemplate"
2215
- [ngTemplateOutletContext]="{
2216
- $implicit: node,
2217
- node: node,
2218
- index: index,
2219
- templates: templates
2220
- }"
2221
- >
2222
- </ng-container>
2063
+ <tree-node-children
2064
+ [node]="node()"
2065
+ [templates]="templates()"
2066
+ ></tree-node-children>
2067
+ <tree-node-drop-slot
2068
+ [dropIndex]="node().index + 1"
2069
+ [node]="node().parent"
2070
+ ></tree-node-drop-slot>
2071
+ </div>
2072
+ }
2073
+ <ng-container
2074
+ [ngTemplateOutlet]="treeNodeFullTemplate()"
2075
+ [ngTemplateOutletContext]="{
2076
+ $implicit: node(),
2077
+ node: node(),
2078
+ index: index(),
2079
+ templates: templates()
2080
+ }"
2081
+ >
2223
2082
  </ng-container>
2224
- `, imports: [TreeMobxAutorunDirective, NgIf, TreeNodeDropSlot, TreeNodeWrapperComponent, TreeNodeChildrenComponent, NgTemplateOutlet] }]
2225
- }], propDecorators: { node: [{
2226
- type: Input
2227
- }], index: [{
2228
- type: Input
2229
- }], templates: [{
2230
- type: Input
2231
- }] } });
2083
+ `, imports: [
2084
+ TreeNodeDropSlot,
2085
+ TreeNodeWrapperComponent,
2086
+ TreeNodeChildrenComponent,
2087
+ NgTemplateOutlet
2088
+ ] }]
2089
+ }], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], templates: [{ type: i0.Input, args: [{ isSignal: true, alias: "templates", required: false }] }] } });
2232
2090
 
2233
2091
  class TreeComponent {
2234
2092
  // Will be handled in ngOnChanges
2235
- set nodes(nodes) {
2236
- }
2237
- ;
2238
- set options(options) {
2239
- }
2240
- ;
2093
+ set nodes(nodes) { }
2094
+ set options(options) { }
2241
2095
  set focused(value) {
2242
2096
  this.treeModel.setFocus(value);
2243
2097
  }
@@ -2248,8 +2102,8 @@ class TreeComponent {
2248
2102
  this.treeModel = inject(TreeModel);
2249
2103
  this.treeDraggedElement = inject(TreeDraggedElement);
2250
2104
  const treeModel = this.treeModel;
2251
- treeModel.eventNames.forEach((name) => this[name] = new EventEmitter());
2252
- treeModel.subscribeToState((state) => this.stateChange.emit(state));
2105
+ treeModel.eventNames.forEach(name => (this[name] = new EventEmitter()));
2106
+ treeModel.subscribeToState(state => this.stateChange.emit(state));
2253
2107
  }
2254
2108
  onKeydown($event) {
2255
2109
  if (!this.treeModel.isFocused)
@@ -2261,7 +2115,11 @@ class TreeComponent {
2261
2115
  }
2262
2116
  onMousedown($event) {
2263
2117
  function isOutsideClick(startElement, nodeName) {
2264
- return !startElement ? true : startElement.localName === nodeName ? false : isOutsideClick(startElement.parentElement, nodeName);
2118
+ return !startElement
2119
+ ? true
2120
+ : startElement.localName === nodeName
2121
+ ? false
2122
+ : isOutsideClick(startElement.parentElement, nodeName);
2265
2123
  }
2266
2124
  if (isOutsideClick($event.target, 'tree-root')) {
2267
2125
  this.treeModel.setFocus(false);
@@ -2287,62 +2145,76 @@ class TreeComponent {
2287
2145
  return obj;
2288
2146
  }, {});
2289
2147
  }
2290
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2291
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: TreeComponent, isStandalone: true, selector: "Tree, tree-root", inputs: { nodes: "nodes", options: "options", focused: "focused", state: "state" }, outputs: { toggleExpanded: "toggleExpanded", activate: "activate", deactivate: "deactivate", nodeActivate: "nodeActivate", nodeDeactivate: "nodeDeactivate", select: "select", deselect: "deselect", focus: "focus", blur: "blur", updateData: "updateData", initialized: "initialized", moveNode: "moveNode", copyNode: "copyNode", loadNodeChildren: "loadNodeChildren", changeFilter: "changeFilter", event: "event", stateChange: "stateChange" }, host: { listeners: { "body: keydown": "onKeydown($event)", "body: mousedown": "onMousedown($event)" } }, providers: [TreeModel], queries: [{ propertyName: "loadingTemplate", first: true, predicate: ["loadingTemplate"], descendants: true }, { propertyName: "treeNodeTemplate", first: true, predicate: ["treeNodeTemplate"], descendants: true }, { propertyName: "treeNodeWrapperTemplate", first: true, predicate: ["treeNodeWrapperTemplate"], descendants: true }, { propertyName: "treeNodeFullTemplate", first: true, predicate: ["treeNodeFullTemplate"], descendants: true }], viewQueries: [{ propertyName: "viewportComponent", first: true, predicate: ["viewport"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
2292
- <tree-viewport #viewport>
2293
- <div
2294
- class="angular-tree-component"
2295
- [class.node-dragging]="treeDraggedElement.isDragging()"
2296
- [class.angular-tree-component-rtl]="treeModel.options.rtl">
2297
- <tree-node-collection
2298
- *ngIf="treeModel.roots"
2299
- [nodes]="treeModel.roots"
2300
- [treeModel]="treeModel"
2301
- [templates]="{
2148
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2149
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: TreeComponent, isStandalone: true, selector: "Tree, tree-root", inputs: { nodes: "nodes", options: "options", focused: "focused", state: "state" }, outputs: { toggleExpanded: "toggleExpanded", activate: "activate", deactivate: "deactivate", nodeActivate: "nodeActivate", nodeDeactivate: "nodeDeactivate", select: "select", deselect: "deselect", focus: "focus", blur: "blur", updateData: "updateData", initialized: "initialized", moveNode: "moveNode", copyNode: "copyNode", loadNodeChildren: "loadNodeChildren", changeFilter: "changeFilter", event: "event", stateChange: "stateChange" }, host: { listeners: { "body: keydown": "onKeydown($event)", "body: mousedown": "onMousedown($event)" } }, providers: [TreeModel], queries: [{ propertyName: "loadingTemplate", first: true, predicate: ["loadingTemplate"], descendants: true }, { propertyName: "treeNodeTemplate", first: true, predicate: ["treeNodeTemplate"], descendants: true }, { propertyName: "treeNodeWrapperTemplate", first: true, predicate: ["treeNodeWrapperTemplate"], descendants: true }, { propertyName: "treeNodeFullTemplate", first: true, predicate: ["treeNodeFullTemplate"], descendants: true }], viewQueries: [{ propertyName: "viewportComponent", first: true, predicate: ["viewport"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
2150
+ <tree-viewport #viewport>
2151
+ <div
2152
+ class="angular-tree-component"
2153
+ [class.node-dragging]="treeDraggedElement.isDragging()"
2154
+ [class.angular-tree-component-rtl]="treeModel.options.rtl"
2155
+ >
2156
+ @if (treeModel.roots) {
2157
+ <tree-node-collection
2158
+ [nodes]="treeModel.roots"
2159
+ [treeModel]="treeModel"
2160
+ [templates]="{
2302
2161
  loadingTemplate: loadingTemplate,
2303
2162
  treeNodeTemplate: treeNodeTemplate,
2304
2163
  treeNodeWrapperTemplate: treeNodeWrapperTemplate,
2305
2164
  treeNodeFullTemplate: treeNodeFullTemplate
2306
- }">
2307
- </tree-node-collection>
2308
- <tree-node-drop-slot
2309
- class="empty-tree-drop-slot"
2310
- *ngIf="treeModel.isEmptyTree()"
2311
- [dropIndex]="0"
2312
- [node]="treeModel.virtualRoot">
2313
- </tree-node-drop-slot>
2314
- </div>
2315
- </tree-viewport>
2316
- `, isInline: true, dependencies: [{ kind: "component", type: TreeViewportComponent, selector: "tree-viewport" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeCollectionComponent, selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }] }); }
2165
+ }"
2166
+ >
2167
+ </tree-node-collection>
2168
+ }
2169
+ @if (treeModel.isEmptyTree()) {
2170
+ <tree-node-drop-slot
2171
+ class="empty-tree-drop-slot"
2172
+ [dropIndex]="0"
2173
+ [node]="treeModel.virtualRoot"
2174
+ >
2175
+ </tree-node-drop-slot>
2176
+ }
2177
+ </div>
2178
+ </tree-viewport>
2179
+ `, isInline: true, dependencies: [{ kind: "component", type: TreeViewportComponent, selector: "tree-viewport" }, { kind: "component", type: TreeNodeCollectionComponent, selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }] }); }
2317
2180
  }
2318
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeComponent, decorators: [{
2181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeComponent, decorators: [{
2319
2182
  type: Component,
2320
2183
  args: [{ selector: 'Tree, tree-root', providers: [TreeModel], template: `
2321
- <tree-viewport #viewport>
2322
- <div
2323
- class="angular-tree-component"
2324
- [class.node-dragging]="treeDraggedElement.isDragging()"
2325
- [class.angular-tree-component-rtl]="treeModel.options.rtl">
2326
- <tree-node-collection
2327
- *ngIf="treeModel.roots"
2328
- [nodes]="treeModel.roots"
2329
- [treeModel]="treeModel"
2330
- [templates]="{
2184
+ <tree-viewport #viewport>
2185
+ <div
2186
+ class="angular-tree-component"
2187
+ [class.node-dragging]="treeDraggedElement.isDragging()"
2188
+ [class.angular-tree-component-rtl]="treeModel.options.rtl"
2189
+ >
2190
+ @if (treeModel.roots) {
2191
+ <tree-node-collection
2192
+ [nodes]="treeModel.roots"
2193
+ [treeModel]="treeModel"
2194
+ [templates]="{
2331
2195
  loadingTemplate: loadingTemplate,
2332
2196
  treeNodeTemplate: treeNodeTemplate,
2333
2197
  treeNodeWrapperTemplate: treeNodeWrapperTemplate,
2334
2198
  treeNodeFullTemplate: treeNodeFullTemplate
2335
- }">
2336
- </tree-node-collection>
2337
- <tree-node-drop-slot
2338
- class="empty-tree-drop-slot"
2339
- *ngIf="treeModel.isEmptyTree()"
2340
- [dropIndex]="0"
2341
- [node]="treeModel.virtualRoot">
2342
- </tree-node-drop-slot>
2343
- </div>
2344
- </tree-viewport>
2345
- `, imports: [TreeViewportComponent, NgIf, TreeNodeCollectionComponent, TreeNodeDropSlot] }]
2199
+ }"
2200
+ >
2201
+ </tree-node-collection>
2202
+ }
2203
+ @if (treeModel.isEmptyTree()) {
2204
+ <tree-node-drop-slot
2205
+ class="empty-tree-drop-slot"
2206
+ [dropIndex]="0"
2207
+ [node]="treeModel.virtualRoot"
2208
+ >
2209
+ </tree-node-drop-slot>
2210
+ }
2211
+ </div>
2212
+ </tree-viewport>
2213
+ `, imports: [
2214
+ TreeViewportComponent,
2215
+ TreeNodeCollectionComponent,
2216
+ TreeNodeDropSlot
2217
+ ] }]
2346
2218
  }], ctorParameters: () => [], propDecorators: { loadingTemplate: [{
2347
2219
  type: ContentChild,
2348
2220
  args: ['loadingTemplate', { static: false }]
@@ -2409,8 +2281,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
2409
2281
  }] } });
2410
2282
 
2411
2283
  class TreeModule {
2412
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2413
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.3", ngImport: i0, type: TreeModule, imports: [CommonModule, TreeComponent,
2284
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2285
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: TreeModule, imports: [CommonModule, TreeComponent,
2414
2286
  TreeNodeComponent,
2415
2287
  TreeNodeContent,
2416
2288
  LoadingComponent,
@@ -2423,8 +2295,7 @@ class TreeModule {
2423
2295
  TreeViewportComponent,
2424
2296
  TreeNodeWrapperComponent,
2425
2297
  TreeNodeCheckboxComponent,
2426
- TreeAnimateOpenDirective,
2427
- TreeMobxAutorunDirective], exports: [TreeComponent,
2298
+ TreeAnimateOpenDirective], exports: [TreeComponent,
2428
2299
  TreeNodeComponent,
2429
2300
  TreeNodeContent,
2430
2301
  LoadingComponent,
@@ -2437,11 +2308,10 @@ class TreeModule {
2437
2308
  TreeViewportComponent,
2438
2309
  TreeNodeWrapperComponent,
2439
2310
  TreeNodeCheckboxComponent,
2440
- TreeAnimateOpenDirective,
2441
- TreeMobxAutorunDirective] }); }
2442
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeModule, imports: [CommonModule] }); }
2311
+ TreeAnimateOpenDirective] }); }
2312
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeModule, imports: [CommonModule] }); }
2443
2313
  }
2444
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: TreeModule, decorators: [{
2314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeModule, decorators: [{
2445
2315
  type: NgModule,
2446
2316
  args: [{
2447
2317
  declarations: [],
@@ -2459,8 +2329,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
2459
2329
  TreeViewportComponent,
2460
2330
  TreeNodeWrapperComponent,
2461
2331
  TreeNodeCheckboxComponent,
2462
- TreeAnimateOpenDirective,
2463
- TreeMobxAutorunDirective
2332
+ TreeAnimateOpenDirective
2464
2333
  ],
2465
2334
  imports: [CommonModule, TreeComponent,
2466
2335
  TreeNodeComponent,
@@ -2475,8 +2344,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
2475
2344
  TreeViewportComponent,
2476
2345
  TreeNodeWrapperComponent,
2477
2346
  TreeNodeCheckboxComponent,
2478
- TreeAnimateOpenDirective,
2479
- TreeMobxAutorunDirective],
2347
+ TreeAnimateOpenDirective],
2480
2348
  providers: []
2481
2349
  }]
2482
2350
  }] });
@@ -2489,5 +2357,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
2489
2357
  * Generated bundle index. Do not edit.
2490
2358
  */
2491
2359
 
2492
- export { KEYS, LoadingComponent, TREE_ACTIONS, TreeAnimateOpenDirective, TreeComponent, TreeDragDirective, TreeDraggedElement, TreeDropDirective, TreeMobxAutorunDirective, TreeModel, TreeModule, TreeNode, TreeNodeCheckboxComponent, TreeNodeChildrenComponent, TreeNodeCollectionComponent, TreeNodeComponent, TreeNodeContent, TreeNodeDropSlot, TreeNodeExpanderComponent, TreeNodeWrapperComponent, TreeViewportComponent, TreeVirtualScroll };
2360
+ export { KEYS, LoadingComponent, TREE_ACTIONS, TreeAnimateOpenDirective, TreeComponent, TreeDragDirective, TreeDraggedElement, TreeDropDirective, TreeModel, TreeModule, TreeNode, TreeNodeCheckboxComponent, TreeNodeChildrenComponent, TreeNodeCollectionComponent, TreeNodeComponent, TreeNodeContent, TreeNodeDropSlot, TreeNodeExpanderComponent, TreeNodeWrapperComponent, TreeViewportComponent, TreeVirtualScroll };
2493
2361
  //# sourceMappingURL=ali-hm-angular-tree-component.mjs.map