@ali-hm/angular-tree-component 12.0.5 → 18.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.
Files changed (64) hide show
  1. package/{esm2020 → esm2022}/ali-hm-angular-tree-component.mjs +4 -4
  2. package/{esm2020 → esm2022}/lib/angular-tree-component.module.mjs +100 -100
  3. package/{esm2020 → esm2022}/lib/components/loading.component.mjs +21 -21
  4. package/{esm2020 → esm2022}/lib/components/tree-node-checkbox.component.mjs +15 -15
  5. package/esm2022/lib/components/tree-node-collection.component.mjs +284 -0
  6. package/{esm2020 → esm2022}/lib/components/tree-node-content.component.mjs +23 -23
  7. package/{esm2020 → esm2022}/lib/components/tree-node-drop-slot.component.mjs +26 -26
  8. package/{esm2020 → esm2022}/lib/components/tree-node-expander.component.mjs +16 -16
  9. package/{esm2020 → esm2022}/lib/components/tree-node-wrapper.component.mjs +24 -24
  10. package/{esm2020 → esm2022}/lib/components/tree-viewport.component.mjs +55 -55
  11. package/esm2022/lib/components/tree.component.mjs +186 -0
  12. package/{esm2020 → esm2022}/lib/constants/events.mjs +19 -19
  13. package/{esm2020 → esm2022}/lib/constants/keys.mjs +9 -9
  14. package/{esm2020 → esm2022}/lib/defs/api.mjs +1 -1
  15. package/esm2022/lib/directives/tree-animate-open.directive.mjs +101 -0
  16. package/{esm2020 → esm2022}/lib/directives/tree-drag.directive.mjs +65 -65
  17. package/esm2022/lib/directives/tree-drop.directive.mjs +127 -0
  18. package/{esm2020 → esm2022}/lib/mobx-angular/mobx-proxy.mjs +16 -16
  19. package/esm2022/lib/mobx-angular/tree-mobx-autorun.directive.mjs +40 -0
  20. package/{esm2020 → esm2022}/lib/models/tree-dragged-element.model.mjs +25 -25
  21. package/esm2022/lib/models/tree-node.model.mjs +390 -0
  22. package/esm2022/lib/models/tree-options.model.mjs +150 -0
  23. package/esm2022/lib/models/tree-virtual-scroll.model.mjs +197 -0
  24. package/esm2022/lib/models/tree.model.mjs +546 -0
  25. package/{esm2020 → esm2022}/public-api.mjs +4 -4
  26. package/{fesm2020 → fesm2022}/ali-hm-angular-tree-component.mjs +2080 -2080
  27. package/{fesm2020 → fesm2022}/ali-hm-angular-tree-component.mjs.map +1 -1
  28. package/index.d.ts +5 -5
  29. package/lib/angular-tree-component.module.d.ts +43 -43
  30. package/lib/components/loading.component.d.ts +9 -9
  31. package/lib/components/tree-node-checkbox.component.d.ts +7 -7
  32. package/lib/components/tree-node-collection.component.d.ts +34 -34
  33. package/lib/components/tree-node-content.component.d.ts +10 -10
  34. package/lib/components/tree-node-drop-slot.component.d.ts +10 -10
  35. package/lib/components/tree-node-expander.component.d.ts +7 -7
  36. package/lib/components/tree-node-wrapper.component.d.ts +9 -9
  37. package/lib/components/tree-viewport.component.d.ts +17 -17
  38. package/lib/components/tree.component.d.ts +47 -47
  39. package/lib/constants/events.d.ts +19 -19
  40. package/lib/constants/keys.d.ts +9 -9
  41. package/lib/defs/api.d.ts +611 -611
  42. package/lib/directives/tree-animate-open.directive.d.ts +20 -20
  43. package/lib/directives/tree-drag.directive.d.ts +21 -21
  44. package/lib/directives/tree-drop.directive.d.ts +33 -33
  45. package/lib/mobx-angular/mobx-proxy.d.ts +7 -7
  46. package/lib/mobx-angular/tree-mobx-autorun.directive.d.ts +17 -17
  47. package/lib/models/tree-dragged-element.model.d.ts +9 -9
  48. package/lib/models/tree-node.model.d.ts +83 -83
  49. package/lib/models/tree-options.model.d.ts +77 -77
  50. package/lib/models/tree-virtual-scroll.model.d.ts +27 -27
  51. package/lib/models/tree.model.d.ts +91 -91
  52. package/package.json +10 -16
  53. package/public-api.d.ts +1 -1
  54. package/esm2020/lib/components/tree-node-collection.component.mjs +0 -284
  55. package/esm2020/lib/components/tree.component.mjs +0 -186
  56. package/esm2020/lib/directives/tree-animate-open.directive.mjs +0 -101
  57. package/esm2020/lib/directives/tree-drop.directive.mjs +0 -127
  58. package/esm2020/lib/mobx-angular/tree-mobx-autorun.directive.mjs +0 -40
  59. package/esm2020/lib/models/tree-node.model.mjs +0 -390
  60. package/esm2020/lib/models/tree-options.model.mjs +0 -150
  61. package/esm2020/lib/models/tree-virtual-scroll.model.mjs +0 -197
  62. package/esm2020/lib/models/tree.model.mjs +0 -546
  63. package/fesm2015/ali-hm-angular-tree-component.mjs +0 -2511
  64. package/fesm2015/ali-hm-angular-tree-component.mjs.map +0 -1
@@ -4,1540 +4,1540 @@ import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { autorun, reaction, computed as computed$1, observable as observable$1, action as action$1 } from 'mobx';
6
6
 
7
- class TreeMobxAutorunDirective {
8
- constructor(templateRef, viewContainer) {
9
- this.templateRef = templateRef;
10
- this.viewContainer = viewContainer;
11
- this.templateBindings = {};
12
- }
13
- ngOnInit() {
14
- this.view = this.viewContainer.createEmbeddedView(this.templateRef);
15
- if (this.dispose) {
16
- this.dispose();
17
- }
18
- if (this.shouldDetach()) {
19
- this.view.detach();
20
- }
21
- this.autoDetect(this.view);
22
- }
23
- shouldDetach() {
24
- return this.treeMobxAutorun && this.treeMobxAutorun.detach;
25
- }
26
- autoDetect(view) {
27
- this.dispose = autorun(() => view.detectChanges());
28
- }
29
- ngOnDestroy() {
30
- if (this.dispose) {
31
- this.dispose();
32
- }
33
- }
34
- }
35
- /** @nocollapse */ TreeMobxAutorunDirectivefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeMobxAutorunDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
36
- /** @nocollapse */ TreeMobxAutorunDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: { treeMobxAutorun: "treeMobxAutorun" }, ngImport: i0 });
37
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeMobxAutorunDirective, decorators: [{
38
- type: Directive,
39
- args: [{ selector: '[treeMobxAutorun]' }]
40
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { treeMobxAutorun: [{
41
- type: Input
7
+ class TreeMobxAutorunDirective {
8
+ constructor(templateRef, viewContainer) {
9
+ this.templateRef = templateRef;
10
+ this.viewContainer = viewContainer;
11
+ this.templateBindings = {};
12
+ }
13
+ ngOnInit() {
14
+ this.view = this.viewContainer.createEmbeddedView(this.templateRef);
15
+ if (this.dispose) {
16
+ this.dispose();
17
+ }
18
+ if (this.shouldDetach()) {
19
+ this.view.detach();
20
+ }
21
+ this.autoDetect(this.view);
22
+ }
23
+ shouldDetach() {
24
+ return this.treeMobxAutorun && this.treeMobxAutorun.detach;
25
+ }
26
+ autoDetect(view) {
27
+ this.dispose = autorun(() => view.detectChanges());
28
+ }
29
+ ngOnDestroy() {
30
+ if (this.dispose) {
31
+ this.dispose();
32
+ }
33
+ }
34
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeMobxAutorunDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
35
+ /** @nocollapse */ static { thisdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: { treeMobxAutorun: "treeMobxAutorun" }, ngImport: i0 }); }
36
+ }
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeMobxAutorunDirective, decorators: [{
38
+ type: Directive,
39
+ args: [{ selector: '[treeMobxAutorun]' }]
40
+ }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { treeMobxAutorun: [{
41
+ type: Input
42
42
  }] } });
43
43
 
44
- const KEYS = {
45
- LEFT: 37,
46
- UP: 38,
47
- RIGHT: 39,
48
- DOWN: 40,
49
- ENTER: 13,
50
- SPACE: 32,
51
- CONTEXT_MENU: 32
44
+ const KEYS = {
45
+ LEFT: 37,
46
+ UP: 38,
47
+ RIGHT: 39,
48
+ DOWN: 40,
49
+ ENTER: 13,
50
+ SPACE: 32,
51
+ CONTEXT_MENU: 32
52
52
  };
53
53
 
54
- const TREE_ACTIONS = {
55
- TOGGLE_ACTIVE: (tree, node, $event) => node && node.toggleActivated(),
56
- TOGGLE_ACTIVE_MULTI: (tree, node, $event) => node && node.toggleActivated(true),
57
- TOGGLE_SELECTED: (tree, node, $event) => node && node.toggleSelected(),
58
- ACTIVATE: (tree, node, $event) => node.setIsActive(true),
59
- DEACTIVATE: (tree, node, $event) => node.setIsActive(false),
60
- SELECT: (tree, node, $event) => node.setIsSelected(true),
61
- DESELECT: (tree, node, $event) => node.setIsSelected(false),
62
- FOCUS: (tree, node, $event) => node.focus(),
63
- TOGGLE_EXPANDED: (tree, node, $event) => node.hasChildren && node.toggleExpanded(),
64
- EXPAND: (tree, node, $event) => node.expand(),
65
- COLLAPSE: (tree, node, $event) => node.collapse(),
66
- DRILL_DOWN: (tree, node, $event) => tree.focusDrillDown(),
67
- DRILL_UP: (tree, node, $event) => tree.focusDrillUp(),
68
- NEXT_NODE: (tree, node, $event) => tree.focusNextNode(),
69
- PREVIOUS_NODE: (tree, node, $event) => tree.focusPreviousNode(),
70
- MOVE_NODE: (tree, node, $event, { from, to }) => {
71
- // default action assumes from = node, to = {parent, index}
72
- if ($event.ctrlKey) {
73
- tree.copyNode(from, to);
74
- }
75
- else {
76
- tree.moveNode(from, to);
77
- }
78
- }
79
- };
80
- const defaultActionMapping = {
81
- mouse: {
82
- click: TREE_ACTIONS.TOGGLE_ACTIVE,
83
- dblClick: null,
84
- contextMenu: null,
85
- expanderClick: TREE_ACTIONS.TOGGLE_EXPANDED,
86
- checkboxClick: TREE_ACTIONS.TOGGLE_SELECTED,
87
- drop: TREE_ACTIONS.MOVE_NODE
88
- },
89
- keys: {
90
- [KEYS.RIGHT]: TREE_ACTIONS.DRILL_DOWN,
91
- [KEYS.LEFT]: TREE_ACTIONS.DRILL_UP,
92
- [KEYS.DOWN]: TREE_ACTIONS.NEXT_NODE,
93
- [KEYS.UP]: TREE_ACTIONS.PREVIOUS_NODE,
94
- [KEYS.SPACE]: TREE_ACTIONS.TOGGLE_ACTIVE,
95
- [KEYS.ENTER]: TREE_ACTIONS.TOGGLE_ACTIVE
96
- }
97
- };
98
- class TreeOptions {
99
- constructor(options = {}) {
100
- this.options = options;
101
- this.actionMapping = {
102
- mouse: {
103
- click: this.options?.actionMapping?.mouse?.click ?? defaultActionMapping.mouse.click,
104
- dblClick: this.options?.actionMapping?.mouse?.dblClick ?? defaultActionMapping.mouse.dblClick,
105
- contextMenu: this.options?.actionMapping?.mouse?.contextMenu ?? defaultActionMapping.mouse.contextMenu,
106
- expanderClick: this.options?.actionMapping?.mouse?.expanderClick ?? defaultActionMapping.mouse.expanderClick,
107
- checkboxClick: this.options?.actionMapping?.mouse?.checkboxClick ?? defaultActionMapping.mouse.checkboxClick,
108
- drop: this.options?.actionMapping?.mouse?.drop ?? defaultActionMapping.mouse.drop,
109
- dragStart: this.options?.actionMapping?.mouse?.dragStart ?? undefined,
110
- drag: this.options?.actionMapping?.mouse?.drag ?? undefined,
111
- dragEnd: this.options?.actionMapping?.mouse?.dragEnd ?? undefined,
112
- dragOver: this.options?.actionMapping?.mouse?.dragOver ?? undefined,
113
- dragLeave: this.options?.actionMapping?.mouse?.dragLeave ?? undefined,
114
- dragEnter: this.options?.actionMapping?.mouse?.dragEnter ?? undefined,
115
- mouseOver: this.options?.actionMapping?.mouse?.mouseOver ?? undefined,
116
- mouseOut: this.options?.actionMapping?.mouse?.mouseOut ?? undefined,
117
- },
118
- keys: {
119
- [KEYS.RIGHT]: TREE_ACTIONS.DRILL_DOWN,
120
- [KEYS.LEFT]: TREE_ACTIONS.DRILL_UP,
121
- [KEYS.DOWN]: TREE_ACTIONS.NEXT_NODE,
122
- [KEYS.UP]: TREE_ACTIONS.PREVIOUS_NODE,
123
- [KEYS.SPACE]: TREE_ACTIONS.TOGGLE_ACTIVE,
124
- [KEYS.ENTER]: TREE_ACTIONS.TOGGLE_ACTIVE
125
- }
126
- };
127
- if (this.options?.actionMapping?.keys) {
128
- this.actionMapping.keys = {
129
- ...this.actionMapping.keys,
130
- ...this.options.actionMapping.keys
131
- };
132
- }
133
- if (options.rtl) {
134
- this.actionMapping.keys[KEYS.RIGHT] = options.actionMapping?.keys[KEYS.RIGHT] || TREE_ACTIONS.DRILL_UP;
135
- this.actionMapping.keys[KEYS.LEFT] = options.actionMapping?.keys[KEYS.LEFT] || TREE_ACTIONS.DRILL_DOWN;
136
- }
137
- }
138
- get hasChildrenField() { return this.options.hasChildrenField || 'hasChildren'; }
139
- get childrenField() { return this.options.childrenField || 'children'; }
140
- get displayField() { return this.options.displayField || 'name'; }
141
- get idField() { return this.options.idField || 'id'; }
142
- get isExpandedField() { return this.options.isExpandedField || 'isExpanded'; }
143
- get getChildren() { return this.options.getChildren; }
144
- get levelPadding() { return this.options.levelPadding || 0; }
145
- get useVirtualScroll() { return this.options.useVirtualScroll; }
146
- get animateExpand() { return this.options.animateExpand; }
147
- get animateSpeed() { return this.options.animateSpeed || 1; }
148
- get animateAcceleration() { return this.options.animateAcceleration || 1.2; }
149
- get scrollOnActivate() { return this.options.scrollOnActivate === undefined ? true : this.options.scrollOnActivate; }
150
- get rtl() { return !!this.options.rtl; }
151
- get rootId() { return this.options.rootId; }
152
- get useCheckbox() { return this.options.useCheckbox; }
153
- get useTriState() { return this.options.useTriState === undefined ? true : this.options.useTriState; }
154
- get scrollContainer() { return this.options.scrollContainer; }
155
- get allowDragoverStyling() { return this.options.allowDragoverStyling === undefined ? true : this.options.allowDragoverStyling; }
156
- getNodeClone(node) {
157
- if (this.options.getNodeClone) {
158
- return this.options.getNodeClone(node);
159
- }
160
- // remove id from clone
161
- // keeping ie11 compatibility
162
- const nodeClone = Object.assign({}, node.data);
163
- if (nodeClone.id) {
164
- delete nodeClone.id;
165
- }
166
- return nodeClone;
167
- }
168
- allowDrop(element, to, $event) {
169
- if (this.options.allowDrop instanceof Function) {
170
- return this.options.allowDrop(element, to, $event);
171
- }
172
- else {
173
- return this.options.allowDrop === undefined ? true : this.options.allowDrop;
174
- }
175
- }
176
- allowDrag(node) {
177
- if (this.options.allowDrag instanceof Function) {
178
- return this.options.allowDrag(node);
179
- }
180
- else {
181
- return this.options.allowDrag;
182
- }
183
- }
184
- nodeClass(node) {
185
- return this.options.nodeClass ? this.options.nodeClass(node) : '';
186
- }
187
- nodeHeight(node) {
188
- if (node.data.virtual) {
189
- return 0;
190
- }
191
- let nodeHeight = this.options.nodeHeight || 22;
192
- if (typeof nodeHeight === 'function') {
193
- nodeHeight = nodeHeight(node);
194
- }
195
- // account for drop slots:
196
- return nodeHeight + (node.index === 0 ? 2 : 1) * this.dropSlotHeight;
197
- }
198
- get dropSlotHeight() {
199
- return typeof this.options.dropSlotHeight === 'number' ? this.options.dropSlotHeight : 2;
200
- }
54
+ const TREE_ACTIONS = {
55
+ TOGGLE_ACTIVE: (tree, node, $event) => node && node.toggleActivated(),
56
+ TOGGLE_ACTIVE_MULTI: (tree, node, $event) => node && node.toggleActivated(true),
57
+ TOGGLE_SELECTED: (tree, node, $event) => node && node.toggleSelected(),
58
+ ACTIVATE: (tree, node, $event) => node.setIsActive(true),
59
+ DEACTIVATE: (tree, node, $event) => node.setIsActive(false),
60
+ SELECT: (tree, node, $event) => node.setIsSelected(true),
61
+ DESELECT: (tree, node, $event) => node.setIsSelected(false),
62
+ FOCUS: (tree, node, $event) => node.focus(),
63
+ TOGGLE_EXPANDED: (tree, node, $event) => node.hasChildren && node.toggleExpanded(),
64
+ EXPAND: (tree, node, $event) => node.expand(),
65
+ COLLAPSE: (tree, node, $event) => node.collapse(),
66
+ DRILL_DOWN: (tree, node, $event) => tree.focusDrillDown(),
67
+ DRILL_UP: (tree, node, $event) => tree.focusDrillUp(),
68
+ NEXT_NODE: (tree, node, $event) => tree.focusNextNode(),
69
+ PREVIOUS_NODE: (tree, node, $event) => tree.focusPreviousNode(),
70
+ MOVE_NODE: (tree, node, $event, { from, to }) => {
71
+ // default action assumes from = node, to = {parent, index}
72
+ if ($event.ctrlKey) {
73
+ tree.copyNode(from, to);
74
+ }
75
+ else {
76
+ tree.moveNode(from, to);
77
+ }
78
+ }
79
+ };
80
+ const defaultActionMapping = {
81
+ mouse: {
82
+ click: TREE_ACTIONS.TOGGLE_ACTIVE,
83
+ dblClick: null,
84
+ contextMenu: null,
85
+ expanderClick: TREE_ACTIONS.TOGGLE_EXPANDED,
86
+ checkboxClick: TREE_ACTIONS.TOGGLE_SELECTED,
87
+ drop: TREE_ACTIONS.MOVE_NODE
88
+ },
89
+ keys: {
90
+ [KEYS.RIGHT]: TREE_ACTIONS.DRILL_DOWN,
91
+ [KEYS.LEFT]: TREE_ACTIONS.DRILL_UP,
92
+ [KEYS.DOWN]: TREE_ACTIONS.NEXT_NODE,
93
+ [KEYS.UP]: TREE_ACTIONS.PREVIOUS_NODE,
94
+ [KEYS.SPACE]: TREE_ACTIONS.TOGGLE_ACTIVE,
95
+ [KEYS.ENTER]: TREE_ACTIONS.TOGGLE_ACTIVE
96
+ }
97
+ };
98
+ class TreeOptions {
99
+ get hasChildrenField() { return this.options.hasChildrenField || 'hasChildren'; }
100
+ get childrenField() { return this.options.childrenField || 'children'; }
101
+ get displayField() { return this.options.displayField || 'name'; }
102
+ get idField() { return this.options.idField || 'id'; }
103
+ get isExpandedField() { return this.options.isExpandedField || 'isExpanded'; }
104
+ get getChildren() { return this.options.getChildren; }
105
+ get levelPadding() { return this.options.levelPadding || 0; }
106
+ get useVirtualScroll() { return this.options.useVirtualScroll; }
107
+ get animateExpand() { return this.options.animateExpand; }
108
+ get animateSpeed() { return this.options.animateSpeed || 1; }
109
+ get animateAcceleration() { return this.options.animateAcceleration || 1.2; }
110
+ get scrollOnActivate() { return this.options.scrollOnActivate === undefined ? true : this.options.scrollOnActivate; }
111
+ get rtl() { return !!this.options.rtl; }
112
+ get rootId() { return this.options.rootId; }
113
+ get useCheckbox() { return this.options.useCheckbox; }
114
+ get useTriState() { return this.options.useTriState === undefined ? true : this.options.useTriState; }
115
+ get scrollContainer() { return this.options.scrollContainer; }
116
+ get allowDragoverStyling() { return this.options.allowDragoverStyling === undefined ? true : this.options.allowDragoverStyling; }
117
+ constructor(options = {}) {
118
+ this.options = options;
119
+ this.actionMapping = {
120
+ mouse: {
121
+ click: this.options?.actionMapping?.mouse?.click ?? defaultActionMapping.mouse.click,
122
+ dblClick: this.options?.actionMapping?.mouse?.dblClick ?? defaultActionMapping.mouse.dblClick,
123
+ contextMenu: this.options?.actionMapping?.mouse?.contextMenu ?? defaultActionMapping.mouse.contextMenu,
124
+ expanderClick: this.options?.actionMapping?.mouse?.expanderClick ?? defaultActionMapping.mouse.expanderClick,
125
+ checkboxClick: this.options?.actionMapping?.mouse?.checkboxClick ?? defaultActionMapping.mouse.checkboxClick,
126
+ drop: this.options?.actionMapping?.mouse?.drop ?? defaultActionMapping.mouse.drop,
127
+ dragStart: this.options?.actionMapping?.mouse?.dragStart ?? undefined,
128
+ drag: this.options?.actionMapping?.mouse?.drag ?? undefined,
129
+ dragEnd: this.options?.actionMapping?.mouse?.dragEnd ?? undefined,
130
+ dragOver: this.options?.actionMapping?.mouse?.dragOver ?? undefined,
131
+ dragLeave: this.options?.actionMapping?.mouse?.dragLeave ?? undefined,
132
+ dragEnter: this.options?.actionMapping?.mouse?.dragEnter ?? undefined,
133
+ mouseOver: this.options?.actionMapping?.mouse?.mouseOver ?? undefined,
134
+ mouseOut: this.options?.actionMapping?.mouse?.mouseOut ?? undefined,
135
+ },
136
+ keys: {
137
+ [KEYS.RIGHT]: TREE_ACTIONS.DRILL_DOWN,
138
+ [KEYS.LEFT]: TREE_ACTIONS.DRILL_UP,
139
+ [KEYS.DOWN]: TREE_ACTIONS.NEXT_NODE,
140
+ [KEYS.UP]: TREE_ACTIONS.PREVIOUS_NODE,
141
+ [KEYS.SPACE]: TREE_ACTIONS.TOGGLE_ACTIVE,
142
+ [KEYS.ENTER]: TREE_ACTIONS.TOGGLE_ACTIVE
143
+ }
144
+ };
145
+ if (this.options?.actionMapping?.keys) {
146
+ this.actionMapping.keys = {
147
+ ...this.actionMapping.keys,
148
+ ...this.options.actionMapping.keys
149
+ };
150
+ }
151
+ if (options.rtl) {
152
+ this.actionMapping.keys[KEYS.RIGHT] = options.actionMapping?.keys[KEYS.RIGHT] || TREE_ACTIONS.DRILL_UP;
153
+ this.actionMapping.keys[KEYS.LEFT] = options.actionMapping?.keys[KEYS.LEFT] || TREE_ACTIONS.DRILL_DOWN;
154
+ }
155
+ }
156
+ getNodeClone(node) {
157
+ if (this.options.getNodeClone) {
158
+ return this.options.getNodeClone(node);
159
+ }
160
+ // remove id from clone
161
+ // keeping ie11 compatibility
162
+ const nodeClone = Object.assign({}, node.data);
163
+ if (nodeClone.id) {
164
+ delete nodeClone.id;
165
+ }
166
+ return nodeClone;
167
+ }
168
+ allowDrop(element, to, $event) {
169
+ if (this.options.allowDrop instanceof Function) {
170
+ return this.options.allowDrop(element, to, $event);
171
+ }
172
+ else {
173
+ return this.options.allowDrop === undefined ? true : this.options.allowDrop;
174
+ }
175
+ }
176
+ allowDrag(node) {
177
+ if (this.options.allowDrag instanceof Function) {
178
+ return this.options.allowDrag(node);
179
+ }
180
+ else {
181
+ return this.options.allowDrag;
182
+ }
183
+ }
184
+ nodeClass(node) {
185
+ return this.options.nodeClass ? this.options.nodeClass(node) : '';
186
+ }
187
+ nodeHeight(node) {
188
+ if (node.data.virtual) {
189
+ return 0;
190
+ }
191
+ let nodeHeight = this.options.nodeHeight || 22;
192
+ if (typeof nodeHeight === 'function') {
193
+ nodeHeight = nodeHeight(node);
194
+ }
195
+ // account for drop slots:
196
+ return nodeHeight + (node.index === 0 ? 2 : 1) * this.dropSlotHeight;
197
+ }
198
+ get dropSlotHeight() {
199
+ return typeof this.options.dropSlotHeight === 'number' ? this.options.dropSlotHeight : 2;
200
+ }
201
201
  }
202
202
 
203
- const TREE_EVENTS = {
204
- toggleExpanded: 'toggleExpanded',
205
- activate: 'activate',
206
- deactivate: 'deactivate',
207
- nodeActivate: 'nodeActivate',
208
- nodeDeactivate: 'nodeDeactivate',
209
- select: 'select',
210
- deselect: 'deselect',
211
- focus: 'focus',
212
- blur: 'blur',
213
- initialized: 'initialized',
214
- updateData: 'updateData',
215
- moveNode: 'moveNode',
216
- copyNode: 'copyNode',
217
- event: 'event',
218
- loadNodeChildren: 'loadNodeChildren',
219
- changeFilter: 'changeFilter',
220
- stateChange: 'stateChange'
203
+ const TREE_EVENTS = {
204
+ toggleExpanded: 'toggleExpanded',
205
+ activate: 'activate',
206
+ deactivate: 'deactivate',
207
+ nodeActivate: 'nodeActivate',
208
+ nodeDeactivate: 'nodeDeactivate',
209
+ select: 'select',
210
+ deselect: 'deselect',
211
+ focus: 'focus',
212
+ blur: 'blur',
213
+ initialized: 'initialized',
214
+ updateData: 'updateData',
215
+ moveNode: 'moveNode',
216
+ copyNode: 'copyNode',
217
+ event: 'event',
218
+ loadNodeChildren: 'loadNodeChildren',
219
+ changeFilter: 'changeFilter',
220
+ stateChange: 'stateChange'
221
221
  };
222
222
 
223
- var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
224
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
225
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
226
- 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;
227
- return c > 3 && r && Object.defineProperty(target, key, r), r;
228
- };
229
- class TreeNode {
230
- constructor(data, parent, treeModel, index) {
231
- this.data = data;
232
- this.parent = parent;
233
- this.treeModel = treeModel;
234
- this.position = 0;
235
- this.allowDrop = (element, $event) => {
236
- return this.options.allowDrop(element, { parent: this, index: 0 }, $event);
237
- };
238
- this.allowDragoverStyling = () => {
239
- return this.options.allowDragoverStyling;
240
- };
241
- if (this.id === undefined || this.id === null) {
242
- this.id = uuid();
243
- } // Make sure there's a unique id without overriding existing ids to work with immutable data structures
244
- this.index = index;
245
- if (this.getField('children')) {
246
- this._initChildren();
247
- }
248
- this.autoLoadChildren();
249
- }
250
- get isHidden() { return this.treeModel.isHidden(this); }
251
- ;
252
- get isExpanded() { return this.treeModel.isExpanded(this); }
253
- ;
254
- get isActive() { return this.treeModel.isActive(this); }
255
- ;
256
- get isFocused() { return this.treeModel.isNodeFocused(this); }
257
- ;
258
- get isSelected() {
259
- if (this.isSelectable()) {
260
- return this.treeModel.isSelected(this);
261
- }
262
- else {
263
- return this.children.some((node) => node.isSelected);
264
- }
265
- }
266
- ;
267
- get isAllSelected() {
268
- if (this.isSelectable()) {
269
- return this.treeModel.isSelected(this);
270
- }
271
- else {
272
- return this.children.every((node) => node.isAllSelected);
273
- }
274
- }
275
- ;
276
- get isPartiallySelected() {
277
- return this.isSelected && !this.isAllSelected;
278
- }
279
- get level() {
280
- return this.parent ? this.parent.level + 1 : 0;
281
- }
282
- get path() {
283
- return this.parent ? [...this.parent.path, this.id] : [];
284
- }
285
- get elementRef() {
223
+ var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
224
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
225
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
226
+ 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;
227
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
228
+ };
229
+ class TreeNode {
230
+ get isHidden() { return this.treeModel.isHidden(this); }
231
+ ;
232
+ get isExpanded() { return this.treeModel.isExpanded(this); }
233
+ ;
234
+ get isActive() { return this.treeModel.isActive(this); }
235
+ ;
236
+ get isFocused() { return this.treeModel.isNodeFocused(this); }
237
+ ;
238
+ get isSelected() {
239
+ if (this.isSelectable()) {
240
+ return this.treeModel.isSelected(this);
241
+ }
242
+ else {
243
+ return this.children.some((node) => node.isSelected);
244
+ }
245
+ }
246
+ ;
247
+ get isAllSelected() {
248
+ if (this.isSelectable()) {
249
+ return this.treeModel.isSelected(this);
250
+ }
251
+ else {
252
+ return this.children.every((node) => node.isAllSelected);
253
+ }
254
+ }
255
+ ;
256
+ get isPartiallySelected() {
257
+ return this.isSelected && !this.isAllSelected;
258
+ }
259
+ get level() {
260
+ return this.parent ? this.parent.level + 1 : 0;
261
+ }
262
+ get path() {
263
+ return this.parent ? [...this.parent.path, this.id] : [];
264
+ }
265
+ get elementRef() {
286
266
  throw `Element Ref is no longer supported since introducing virtual scroll\n
287
- You may use a template to obtain a reference to the element`;
288
- }
289
- get originalNode() { return this._originalNode; }
290
- ;
291
- // helper get functions:
292
- get hasChildren() {
293
- return !!(this.getField('hasChildren') || (this.children && this.children.length > 0));
294
- }
295
- get isCollapsed() { return !this.isExpanded; }
296
- get isLeaf() { return !this.hasChildren; }
297
- get isRoot() { return this.parent.data.virtual; }
298
- get realParent() { return this.isRoot ? null : this.parent; }
299
- // proxy functions:
300
- get options() { return this.treeModel.options; }
301
- fireEvent(event) { this.treeModel.fireEvent(event); }
302
- // field accessors:
303
- get displayField() {
304
- return this.getField('display');
305
- }
306
- get id() {
307
- return this.getField('id');
308
- }
309
- set id(value) {
310
- this.setField('id', value);
311
- }
312
- getField(key) {
313
- return this.data[this.options[`${key}Field`]];
314
- }
315
- setField(key, value) {
316
- this.data[this.options[`${key}Field`]] = value;
317
- }
318
- // traversing:
319
- _findAdjacentSibling(steps, skipHidden = false) {
320
- const siblings = this._getParentsChildren(skipHidden);
321
- const index = siblings.indexOf(this);
322
- return siblings.length > index + steps ? siblings[index + steps] : null;
323
- }
324
- findNextSibling(skipHidden = false) {
325
- return this._findAdjacentSibling(+1, skipHidden);
326
- }
327
- findPreviousSibling(skipHidden = false) {
328
- return this._findAdjacentSibling(-1, skipHidden);
329
- }
330
- getVisibleChildren() {
331
- return this.visibleChildren;
332
- }
333
- get visibleChildren() {
334
- return (this.children || []).filter((node) => !node.isHidden);
335
- }
336
- getFirstChild(skipHidden = false) {
337
- let children = skipHidden ? this.visibleChildren : this.children;
338
- return children != null && children.length ? children[0] : null;
339
- }
340
- getLastChild(skipHidden = false) {
341
- let children = skipHidden ? this.visibleChildren : this.children;
342
- return children != null && children.length ? children[children.length - 1] : null;
343
- }
344
- findNextNode(goInside = true, skipHidden = false) {
345
- return goInside && this.isExpanded && this.getFirstChild(skipHidden) ||
346
- this.findNextSibling(skipHidden) ||
347
- this.parent && this.parent.findNextNode(false, skipHidden);
348
- }
349
- findPreviousNode(skipHidden = false) {
350
- let previousSibling = this.findPreviousSibling(skipHidden);
351
- if (!previousSibling) {
352
- return this.realParent;
353
- }
354
- return previousSibling._getLastOpenDescendant(skipHidden);
355
- }
356
- _getLastOpenDescendant(skipHidden = false) {
357
- const lastChild = this.getLastChild(skipHidden);
358
- return (this.isCollapsed || !lastChild)
359
- ? this
360
- : lastChild._getLastOpenDescendant(skipHidden);
361
- }
362
- _getParentsChildren(skipHidden = false) {
363
- const children = this.parent &&
364
- (skipHidden ? this.parent.getVisibleChildren() : this.parent.children);
365
- return children || [];
366
- }
367
- getIndexInParent(skipHidden = false) {
368
- return this._getParentsChildren(skipHidden).indexOf(this);
369
- }
370
- isDescendantOf(node) {
371
- if (this === node)
372
- return true;
373
- else
374
- return this.parent && this.parent.isDescendantOf(node);
375
- }
376
- getNodePadding() {
377
- return this.options.levelPadding * (this.level - 1) + 'px';
378
- }
379
- getClass() {
380
- return [this.options.nodeClass(this), `tree-node-level-${this.level}`].join(' ');
381
- }
382
- onDrop($event) {
383
- this.mouseAction('drop', $event.event, {
384
- from: $event.element,
385
- to: { parent: this, index: 0, dropOnNode: true }
386
- });
387
- }
388
- allowDrag() {
389
- return this.options.allowDrag(this);
390
- }
391
- // helper methods:
392
- loadNodeChildren() {
393
- if (!this.options.getChildren) {
394
- return Promise.resolve(); // Not getChildren method - for using redux
395
- }
396
- return Promise.resolve(this.options.getChildren(this))
397
- .then((children) => {
398
- if (children) {
399
- this.setField('children', children);
400
- this._initChildren();
401
- if (this.options.useTriState && this.treeModel.isSelected(this)) {
402
- this.setIsSelected(true);
403
- }
404
- this.children.forEach((child) => {
405
- if (child.getField('isExpanded') && child.hasChildren) {
406
- child.expand();
407
- }
408
- });
409
- }
410
- }).then(() => {
411
- this.fireEvent({
412
- eventName: TREE_EVENTS.loadNodeChildren,
413
- node: this
414
- });
415
- });
416
- }
417
- expand() {
418
- if (!this.isExpanded) {
419
- this.toggleExpanded();
420
- }
421
- return this;
422
- }
423
- collapse() {
424
- if (this.isExpanded) {
425
- this.toggleExpanded();
426
- }
427
- return this;
428
- }
429
- doForAll(fn) {
430
- Promise.resolve(fn(this)).then(() => {
431
- if (this.children) {
432
- this.children.forEach((child) => child.doForAll(fn));
433
- }
434
- });
435
- }
436
- expandAll() {
437
- this.doForAll((node) => node.expand());
438
- }
439
- collapseAll() {
440
- this.doForAll((node) => node.collapse());
441
- }
442
- ensureVisible() {
443
- if (this.realParent) {
444
- this.realParent.expand();
445
- this.realParent.ensureVisible();
446
- }
447
- return this;
448
- }
449
- toggleExpanded() {
450
- this.setIsExpanded(!this.isExpanded);
451
- return this;
452
- }
453
- setIsExpanded(value) {
454
- if (this.hasChildren) {
455
- this.treeModel.setExpandedNode(this, value);
456
- }
457
- return this;
458
- }
459
- ;
460
- autoLoadChildren() {
461
- this.handler =
462
- reaction(() => this.isExpanded, (isExpanded) => {
463
- if (!this.children && this.hasChildren && isExpanded) {
464
- this.loadNodeChildren();
465
- }
466
- }, { fireImmediately: true });
467
- }
468
- dispose() {
469
- if (this.children) {
470
- this.children.forEach((child) => child.dispose());
471
- }
472
- if (this.handler) {
473
- this.handler();
474
- }
475
- this.parent = null;
476
- this.children = null;
477
- }
478
- setIsActive(value, multi = false) {
479
- this.treeModel.setActiveNode(this, value, multi);
480
- if (value) {
481
- this.focus(this.options.scrollOnActivate);
482
- }
483
- return this;
484
- }
485
- isSelectable() {
486
- return this.isLeaf || !this.children || !this.options.useTriState;
487
- }
488
- setIsSelected(value) {
489
- if (this.isSelectable()) {
490
- this.treeModel.setSelectedNode(this, value);
491
- }
492
- else {
493
- this.visibleChildren.forEach((child) => child.setIsSelected(value));
494
- }
495
- return this;
496
- }
497
- toggleSelected() {
498
- this.setIsSelected(!this.isSelected);
499
- return this;
500
- }
501
- toggleActivated(multi = false) {
502
- this.setIsActive(!this.isActive, multi);
503
- return this;
504
- }
505
- setActiveAndVisible(multi = false) {
506
- this.setIsActive(true, multi)
507
- .ensureVisible();
508
- setTimeout(this.scrollIntoView.bind(this));
509
- return this;
510
- }
511
- scrollIntoView(force = false) {
512
- this.treeModel.virtualScroll.scrollIntoView(this, force);
513
- }
514
- focus(scroll = true) {
515
- let previousNode = this.treeModel.getFocusedNode();
516
- this.treeModel.setFocusedNode(this);
517
- if (scroll) {
518
- this.scrollIntoView();
519
- }
520
- if (previousNode) {
521
- this.fireEvent({ eventName: TREE_EVENTS.blur, node: previousNode });
522
- }
523
- this.fireEvent({ eventName: TREE_EVENTS.focus, node: this });
524
- return this;
525
- }
526
- blur() {
527
- let previousNode = this.treeModel.getFocusedNode();
528
- this.treeModel.setFocusedNode(null);
529
- if (previousNode) {
530
- this.fireEvent({ eventName: TREE_EVENTS.blur, node: this });
531
- }
532
- return this;
533
- }
534
- setIsHidden(value) {
535
- this.treeModel.setIsHidden(this, value);
536
- }
537
- hide() {
538
- this.setIsHidden(true);
539
- }
540
- show() {
541
- this.setIsHidden(false);
542
- }
543
- mouseAction(actionName, $event, data = null) {
544
- this.treeModel.setFocus(true);
545
- const actionMapping = this.options.actionMapping.mouse;
546
- const mouseAction = actionMapping[actionName];
547
- if (mouseAction) {
548
- mouseAction(this.treeModel, this, $event, data);
549
- }
550
- }
551
- getSelfHeight() {
552
- return this.options.nodeHeight(this);
553
- }
554
- _initChildren() {
555
- this.children = this.getField('children')
556
- .map((c, index) => new TreeNode(c, this, this.treeModel, index));
557
- }
558
- }
559
- __decorate$3([
560
- computed$1
561
- ], TreeNode.prototype, "isHidden", null);
562
- __decorate$3([
563
- computed$1
564
- ], TreeNode.prototype, "isExpanded", null);
565
- __decorate$3([
566
- computed$1
567
- ], TreeNode.prototype, "isActive", null);
568
- __decorate$3([
569
- computed$1
570
- ], TreeNode.prototype, "isFocused", null);
571
- __decorate$3([
572
- computed$1
573
- ], TreeNode.prototype, "isSelected", null);
574
- __decorate$3([
575
- computed$1
576
- ], TreeNode.prototype, "isAllSelected", null);
577
- __decorate$3([
578
- computed$1
579
- ], TreeNode.prototype, "isPartiallySelected", null);
580
- __decorate$3([
581
- observable$1
582
- ], TreeNode.prototype, "children", void 0);
583
- __decorate$3([
584
- observable$1
585
- ], TreeNode.prototype, "index", void 0);
586
- __decorate$3([
587
- observable$1
588
- ], TreeNode.prototype, "position", void 0);
589
- __decorate$3([
590
- observable$1
591
- ], TreeNode.prototype, "height", void 0);
592
- __decorate$3([
593
- computed$1
594
- ], TreeNode.prototype, "level", null);
595
- __decorate$3([
596
- computed$1
597
- ], TreeNode.prototype, "path", null);
598
- __decorate$3([
599
- computed$1
600
- ], TreeNode.prototype, "visibleChildren", null);
601
- __decorate$3([
602
- action$1
603
- ], TreeNode.prototype, "setIsSelected", null);
604
- __decorate$3([
605
- action$1
606
- ], TreeNode.prototype, "_initChildren", null);
607
- function uuid() {
608
- return Math.floor(Math.random() * 10000000000000);
267
+ You may use a template to obtain a reference to the element`;
268
+ }
269
+ get originalNode() { return this._originalNode; }
270
+ ;
271
+ constructor(data, parent, treeModel, index) {
272
+ this.data = data;
273
+ this.parent = parent;
274
+ this.treeModel = treeModel;
275
+ this.position = 0;
276
+ this.allowDrop = (element, $event) => {
277
+ return this.options.allowDrop(element, { parent: this, index: 0 }, $event);
278
+ };
279
+ this.allowDragoverStyling = () => {
280
+ return this.options.allowDragoverStyling;
281
+ };
282
+ if (this.id === undefined || this.id === null) {
283
+ this.id = uuid();
284
+ } // Make sure there's a unique id without overriding existing ids to work with immutable data structures
285
+ this.index = index;
286
+ if (this.getField('children')) {
287
+ this._initChildren();
288
+ }
289
+ this.autoLoadChildren();
290
+ }
291
+ // helper get functions:
292
+ get hasChildren() {
293
+ return !!(this.getField('hasChildren') || (this.children && this.children.length > 0));
294
+ }
295
+ get isCollapsed() { return !this.isExpanded; }
296
+ get isLeaf() { return !this.hasChildren; }
297
+ get isRoot() { return this.parent.data.virtual; }
298
+ get realParent() { return this.isRoot ? null : this.parent; }
299
+ // proxy functions:
300
+ get options() { return this.treeModel.options; }
301
+ fireEvent(event) { this.treeModel.fireEvent(event); }
302
+ // field accessors:
303
+ get displayField() {
304
+ return this.getField('display');
305
+ }
306
+ get id() {
307
+ return this.getField('id');
308
+ }
309
+ set id(value) {
310
+ this.setField('id', value);
311
+ }
312
+ getField(key) {
313
+ return this.data[this.options[`${key}Field`]];
314
+ }
315
+ setField(key, value) {
316
+ this.data[this.options[`${key}Field`]] = value;
317
+ }
318
+ // traversing:
319
+ _findAdjacentSibling(steps, skipHidden = false) {
320
+ const siblings = this._getParentsChildren(skipHidden);
321
+ const index = siblings.indexOf(this);
322
+ return siblings.length > index + steps ? siblings[index + steps] : null;
323
+ }
324
+ findNextSibling(skipHidden = false) {
325
+ return this._findAdjacentSibling(+1, skipHidden);
326
+ }
327
+ findPreviousSibling(skipHidden = false) {
328
+ return this._findAdjacentSibling(-1, skipHidden);
329
+ }
330
+ getVisibleChildren() {
331
+ return this.visibleChildren;
332
+ }
333
+ get visibleChildren() {
334
+ return (this.children || []).filter((node) => !node.isHidden);
335
+ }
336
+ getFirstChild(skipHidden = false) {
337
+ let children = skipHidden ? this.visibleChildren : this.children;
338
+ return children != null && children.length ? children[0] : null;
339
+ }
340
+ getLastChild(skipHidden = false) {
341
+ let children = skipHidden ? this.visibleChildren : this.children;
342
+ return children != null && children.length ? children[children.length - 1] : null;
343
+ }
344
+ findNextNode(goInside = true, skipHidden = false) {
345
+ return goInside && this.isExpanded && this.getFirstChild(skipHidden) ||
346
+ this.findNextSibling(skipHidden) ||
347
+ this.parent && this.parent.findNextNode(false, skipHidden);
348
+ }
349
+ findPreviousNode(skipHidden = false) {
350
+ let previousSibling = this.findPreviousSibling(skipHidden);
351
+ if (!previousSibling) {
352
+ return this.realParent;
353
+ }
354
+ return previousSibling._getLastOpenDescendant(skipHidden);
355
+ }
356
+ _getLastOpenDescendant(skipHidden = false) {
357
+ const lastChild = this.getLastChild(skipHidden);
358
+ return (this.isCollapsed || !lastChild)
359
+ ? this
360
+ : lastChild._getLastOpenDescendant(skipHidden);
361
+ }
362
+ _getParentsChildren(skipHidden = false) {
363
+ const children = this.parent &&
364
+ (skipHidden ? this.parent.getVisibleChildren() : this.parent.children);
365
+ return children || [];
366
+ }
367
+ getIndexInParent(skipHidden = false) {
368
+ return this._getParentsChildren(skipHidden).indexOf(this);
369
+ }
370
+ isDescendantOf(node) {
371
+ if (this === node)
372
+ return true;
373
+ else
374
+ return this.parent && this.parent.isDescendantOf(node);
375
+ }
376
+ getNodePadding() {
377
+ return this.options.levelPadding * (this.level - 1) + 'px';
378
+ }
379
+ getClass() {
380
+ return [this.options.nodeClass(this), `tree-node-level-${this.level}`].join(' ');
381
+ }
382
+ onDrop($event) {
383
+ this.mouseAction('drop', $event.event, {
384
+ from: $event.element,
385
+ to: { parent: this, index: 0, dropOnNode: true }
386
+ });
387
+ }
388
+ allowDrag() {
389
+ return this.options.allowDrag(this);
390
+ }
391
+ // helper methods:
392
+ loadNodeChildren() {
393
+ if (!this.options.getChildren) {
394
+ return Promise.resolve(); // Not getChildren method - for using redux
395
+ }
396
+ return Promise.resolve(this.options.getChildren(this))
397
+ .then((children) => {
398
+ if (children) {
399
+ this.setField('children', children);
400
+ this._initChildren();
401
+ if (this.options.useTriState && this.treeModel.isSelected(this)) {
402
+ this.setIsSelected(true);
403
+ }
404
+ this.children.forEach((child) => {
405
+ if (child.getField('isExpanded') && child.hasChildren) {
406
+ child.expand();
407
+ }
408
+ });
409
+ }
410
+ }).then(() => {
411
+ this.fireEvent({
412
+ eventName: TREE_EVENTS.loadNodeChildren,
413
+ node: this
414
+ });
415
+ });
416
+ }
417
+ expand() {
418
+ if (!this.isExpanded) {
419
+ this.toggleExpanded();
420
+ }
421
+ return this;
422
+ }
423
+ collapse() {
424
+ if (this.isExpanded) {
425
+ this.toggleExpanded();
426
+ }
427
+ return this;
428
+ }
429
+ doForAll(fn) {
430
+ Promise.resolve(fn(this)).then(() => {
431
+ if (this.children) {
432
+ this.children.forEach((child) => child.doForAll(fn));
433
+ }
434
+ });
435
+ }
436
+ expandAll() {
437
+ this.doForAll((node) => node.expand());
438
+ }
439
+ collapseAll() {
440
+ this.doForAll((node) => node.collapse());
441
+ }
442
+ ensureVisible() {
443
+ if (this.realParent) {
444
+ this.realParent.expand();
445
+ this.realParent.ensureVisible();
446
+ }
447
+ return this;
448
+ }
449
+ toggleExpanded() {
450
+ this.setIsExpanded(!this.isExpanded);
451
+ return this;
452
+ }
453
+ setIsExpanded(value) {
454
+ if (this.hasChildren) {
455
+ this.treeModel.setExpandedNode(this, value);
456
+ }
457
+ return this;
458
+ }
459
+ ;
460
+ autoLoadChildren() {
461
+ this.handler =
462
+ reaction(() => this.isExpanded, (isExpanded) => {
463
+ if (!this.children && this.hasChildren && isExpanded) {
464
+ this.loadNodeChildren();
465
+ }
466
+ }, { fireImmediately: true });
467
+ }
468
+ dispose() {
469
+ if (this.children) {
470
+ this.children.forEach((child) => child.dispose());
471
+ }
472
+ if (this.handler) {
473
+ this.handler();
474
+ }
475
+ this.parent = null;
476
+ this.children = null;
477
+ }
478
+ setIsActive(value, multi = false) {
479
+ this.treeModel.setActiveNode(this, value, multi);
480
+ if (value) {
481
+ this.focus(this.options.scrollOnActivate);
482
+ }
483
+ return this;
484
+ }
485
+ isSelectable() {
486
+ return this.isLeaf || !this.children || !this.options.useTriState;
487
+ }
488
+ setIsSelected(value) {
489
+ if (this.isSelectable()) {
490
+ this.treeModel.setSelectedNode(this, value);
491
+ }
492
+ else {
493
+ this.visibleChildren.forEach((child) => child.setIsSelected(value));
494
+ }
495
+ return this;
496
+ }
497
+ toggleSelected() {
498
+ this.setIsSelected(!this.isSelected);
499
+ return this;
500
+ }
501
+ toggleActivated(multi = false) {
502
+ this.setIsActive(!this.isActive, multi);
503
+ return this;
504
+ }
505
+ setActiveAndVisible(multi = false) {
506
+ this.setIsActive(true, multi)
507
+ .ensureVisible();
508
+ setTimeout(this.scrollIntoView.bind(this));
509
+ return this;
510
+ }
511
+ scrollIntoView(force = false) {
512
+ this.treeModel.virtualScroll.scrollIntoView(this, force);
513
+ }
514
+ focus(scroll = true) {
515
+ let previousNode = this.treeModel.getFocusedNode();
516
+ this.treeModel.setFocusedNode(this);
517
+ if (scroll) {
518
+ this.scrollIntoView();
519
+ }
520
+ if (previousNode) {
521
+ this.fireEvent({ eventName: TREE_EVENTS.blur, node: previousNode });
522
+ }
523
+ this.fireEvent({ eventName: TREE_EVENTS.focus, node: this });
524
+ return this;
525
+ }
526
+ blur() {
527
+ let previousNode = this.treeModel.getFocusedNode();
528
+ this.treeModel.setFocusedNode(null);
529
+ if (previousNode) {
530
+ this.fireEvent({ eventName: TREE_EVENTS.blur, node: this });
531
+ }
532
+ return this;
533
+ }
534
+ setIsHidden(value) {
535
+ this.treeModel.setIsHidden(this, value);
536
+ }
537
+ hide() {
538
+ this.setIsHidden(true);
539
+ }
540
+ show() {
541
+ this.setIsHidden(false);
542
+ }
543
+ mouseAction(actionName, $event, data = null) {
544
+ this.treeModel.setFocus(true);
545
+ const actionMapping = this.options.actionMapping.mouse;
546
+ const mouseAction = actionMapping[actionName];
547
+ if (mouseAction) {
548
+ mouseAction(this.treeModel, this, $event, data);
549
+ }
550
+ }
551
+ getSelfHeight() {
552
+ return this.options.nodeHeight(this);
553
+ }
554
+ _initChildren() {
555
+ this.children = this.getField('children')
556
+ .map((c, index) => new TreeNode(c, this, this.treeModel, index));
557
+ }
558
+ }
559
+ __decorate$3([
560
+ computed$1
561
+ ], TreeNode.prototype, "isHidden", null);
562
+ __decorate$3([
563
+ computed$1
564
+ ], TreeNode.prototype, "isExpanded", null);
565
+ __decorate$3([
566
+ computed$1
567
+ ], TreeNode.prototype, "isActive", null);
568
+ __decorate$3([
569
+ computed$1
570
+ ], TreeNode.prototype, "isFocused", null);
571
+ __decorate$3([
572
+ computed$1
573
+ ], TreeNode.prototype, "isSelected", null);
574
+ __decorate$3([
575
+ computed$1
576
+ ], TreeNode.prototype, "isAllSelected", null);
577
+ __decorate$3([
578
+ computed$1
579
+ ], TreeNode.prototype, "isPartiallySelected", null);
580
+ __decorate$3([
581
+ observable$1
582
+ ], TreeNode.prototype, "children", void 0);
583
+ __decorate$3([
584
+ observable$1
585
+ ], TreeNode.prototype, "index", void 0);
586
+ __decorate$3([
587
+ observable$1
588
+ ], TreeNode.prototype, "position", void 0);
589
+ __decorate$3([
590
+ observable$1
591
+ ], TreeNode.prototype, "height", void 0);
592
+ __decorate$3([
593
+ computed$1
594
+ ], TreeNode.prototype, "level", null);
595
+ __decorate$3([
596
+ computed$1
597
+ ], TreeNode.prototype, "path", null);
598
+ __decorate$3([
599
+ computed$1
600
+ ], TreeNode.prototype, "visibleChildren", null);
601
+ __decorate$3([
602
+ action$1
603
+ ], TreeNode.prototype, "setIsSelected", null);
604
+ __decorate$3([
605
+ action$1
606
+ ], TreeNode.prototype, "_initChildren", null);
607
+ function uuid() {
608
+ return Math.floor(Math.random() * 10000000000000);
609
609
  }
610
610
 
611
- var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
612
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
613
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
614
- 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;
615
- return c > 3 && r && Object.defineProperty(target, key, r), r;
616
- };
617
- class TreeModel {
618
- constructor() {
619
- this.options = new TreeOptions();
620
- this.eventNames = Object.keys(TREE_EVENTS);
621
- this.expandedNodeIds = {};
622
- this.selectedLeafNodeIds = {};
623
- this.activeNodeIds = {};
624
- this.hiddenNodeIds = {};
625
- this.focusedNodeId = null;
626
- this.firstUpdate = true;
627
- this.subscriptions = [];
628
- }
629
- // events
630
- fireEvent(event) {
631
- event.treeModel = this;
632
- this.events[event.eventName].emit(event);
633
- this.events.event.emit(event);
634
- }
635
- subscribe(eventName, fn) {
636
- const subscription = this.events[eventName].subscribe(fn);
637
- this.subscriptions.push(subscription);
638
- }
639
- // getters
640
- getFocusedNode() {
641
- return this.focusedNode;
642
- }
643
- getActiveNode() {
644
- return this.activeNodes[0];
645
- }
646
- getActiveNodes() {
647
- return this.activeNodes;
648
- }
649
- getVisibleRoots() {
650
- return this.virtualRoot.visibleChildren;
651
- }
652
- getFirstRoot(skipHidden = false) {
653
- const root = skipHidden ? this.getVisibleRoots() : this.roots;
654
- return root != null && root.length ? root[0] : null;
655
- }
656
- getLastRoot(skipHidden = false) {
657
- const root = skipHidden ? this.getVisibleRoots() : this.roots;
658
- return root != null && root.length ? root[root.length - 1] : null;
659
- }
660
- get isFocused() {
661
- return TreeModel.focusedTree === this;
662
- }
663
- isNodeFocused(node) {
664
- return this.focusedNode === node;
665
- }
666
- 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);
695
- }
696
- // locating nodes
697
- getNodeByPath(path, startNode = null) {
698
- if (!path)
699
- return null;
700
- startNode = startNode || this.virtualRoot;
701
- if (path.length === 0)
702
- return startNode;
703
- if (!startNode.children)
704
- return null;
705
- const childId = path.shift();
706
- const childNode = startNode.children.find(c => c.id === childId);
707
- if (!childNode)
708
- return null;
709
- return this.getNodeByPath(path, childNode);
710
- }
711
- getNodeById(id) {
712
- const idStr = id.toString();
713
- return this.getNodeBy((node) => node.id.toString() === idStr);
714
- }
715
- getNodeBy(predicate, startNode = null) {
716
- startNode = startNode || this.virtualRoot;
717
- if (!startNode.children)
718
- return null;
719
- const found = startNode.children.find(predicate);
720
- if (found) { // found in children
721
- return found;
722
- }
723
- else { // look in children's children
724
- for (let child of startNode.children) {
725
- const foundInChildren = this.getNodeBy(predicate, child);
726
- if (foundInChildren)
727
- return foundInChildren;
728
- }
729
- }
730
- }
731
- isExpanded(node) {
732
- return this.expandedNodeIds[node.id];
733
- }
734
- isHidden(node) {
735
- return this.hiddenNodeIds[node.id];
736
- }
737
- isActive(node) {
738
- return this.activeNodeIds[node.id];
739
- }
740
- isSelected(node) {
741
- return this.selectedLeafNodeIds[node.id];
742
- }
743
- ngOnDestroy() {
744
- this.dispose();
745
- this.unsubscribeAll();
746
- }
747
- dispose() {
748
- // Dispose reactions of the replaced nodes
749
- if (this.virtualRoot) {
750
- this.virtualRoot.dispose();
751
- }
752
- }
753
- unsubscribeAll() {
754
- this.subscriptions.forEach(subscription => subscription.unsubscribe());
755
- this.subscriptions = [];
756
- }
757
- // actions
758
- setData({ nodes, options = null, events = null }) {
759
- if (options) {
760
- this.options = new TreeOptions(options);
761
- }
762
- if (events) {
763
- this.events = events;
764
- }
765
- if (nodes) {
766
- this.nodes = nodes;
767
- }
768
- this.update();
769
- }
770
- update() {
771
- // Rebuild tree:
772
- let virtualRootConfig = {
773
- id: this.options.rootId,
774
- virtual: true,
775
- [this.options.childrenField]: this.nodes
776
- };
777
- this.dispose();
778
- this.virtualRoot = new TreeNode(virtualRootConfig, null, this, 0);
779
- this.roots = this.virtualRoot.children;
780
- // Fire event:
781
- if (this.firstUpdate) {
782
- if (this.roots) {
783
- this.firstUpdate = false;
784
- this._calculateExpandedNodes();
785
- }
786
- }
787
- else {
788
- this.fireEvent({ eventName: TREE_EVENTS.updateData });
789
- }
790
- }
791
- setFocusedNode(node) {
792
- this.focusedNodeId = node ? node.id : null;
793
- }
794
- setFocus(value) {
795
- TreeModel.focusedTree = value ? this : null;
796
- }
797
- doForAll(fn) {
798
- this.roots.forEach((root) => root.doForAll(fn));
799
- }
800
- focusNextNode() {
801
- let previousNode = this.getFocusedNode();
802
- let nextNode = previousNode ? previousNode.findNextNode(true, true) : this.getFirstRoot(true);
803
- if (nextNode)
804
- nextNode.focus();
805
- }
806
- focusPreviousNode() {
807
- let previousNode = this.getFocusedNode();
808
- let nextNode = previousNode ? previousNode.findPreviousNode(true) : this.getLastRoot(true);
809
- if (nextNode)
810
- nextNode.focus();
811
- }
812
- focusDrillDown() {
813
- let previousNode = this.getFocusedNode();
814
- if (previousNode && previousNode.isCollapsed && previousNode.hasChildren) {
815
- previousNode.toggleExpanded();
816
- }
817
- else {
818
- let nextNode = previousNode ? previousNode.getFirstChild(true) : this.getFirstRoot(true);
819
- if (nextNode)
820
- nextNode.focus();
821
- }
822
- }
823
- focusDrillUp() {
824
- let previousNode = this.getFocusedNode();
825
- if (!previousNode)
826
- return;
827
- if (previousNode.isExpanded) {
828
- previousNode.toggleExpanded();
829
- }
830
- else {
831
- let nextNode = previousNode.realParent;
832
- if (nextNode)
833
- nextNode.focus();
834
- }
835
- }
836
- setActiveNode(node, value, multi = false) {
837
- if (multi) {
838
- this._setActiveNodeMulti(node, value);
839
- }
840
- else {
841
- this._setActiveNodeSingle(node, value);
842
- }
843
- if (value) {
844
- node.focus(this.options.scrollOnActivate);
845
- this.fireEvent({ eventName: TREE_EVENTS.activate, node });
846
- this.fireEvent({ eventName: TREE_EVENTS.nodeActivate, node }); // For IE11
847
- }
848
- else {
849
- this.fireEvent({ eventName: TREE_EVENTS.deactivate, node });
850
- this.fireEvent({ eventName: TREE_EVENTS.nodeDeactivate, node }); // For IE11
851
- }
852
- }
853
- setSelectedNode(node, value) {
854
- this.selectedLeafNodeIds = Object.assign({}, this.selectedLeafNodeIds, { [node.id]: value });
855
- if (value) {
856
- node.focus();
857
- this.fireEvent({ eventName: TREE_EVENTS.select, node });
858
- }
859
- else {
860
- this.fireEvent({ eventName: TREE_EVENTS.deselect, node });
861
- }
862
- }
863
- setExpandedNode(node, value) {
864
- this.expandedNodeIds = Object.assign({}, this.expandedNodeIds, { [node.id]: value });
865
- this.fireEvent({ eventName: TREE_EVENTS.toggleExpanded, node, isExpanded: value });
866
- }
867
- expandAll() {
868
- this.roots.forEach((root) => root.expandAll());
869
- }
870
- collapseAll() {
871
- this.roots.forEach((root) => root.collapseAll());
872
- }
873
- setIsHidden(node, value) {
874
- this.hiddenNodeIds = Object.assign({}, this.hiddenNodeIds, { [node.id]: value });
875
- }
876
- setHiddenNodeIds(nodeIds) {
877
- this.hiddenNodeIds = nodeIds.reduce((hiddenNodeIds, id) => Object.assign(hiddenNodeIds, {
878
- [id]: true
879
- }), {});
880
- }
881
- performKeyAction(node, $event) {
882
- const keyAction = this.options.actionMapping.keys[$event.keyCode];
883
- if (keyAction) {
884
- $event.preventDefault();
885
- keyAction(this, node, $event);
886
- return true;
887
- }
888
- else {
889
- return false;
890
- }
891
- }
892
- filterNodes(filter, autoShow = true) {
893
- let filterFn;
894
- if (!filter) {
895
- return this.clearFilter();
896
- }
897
- // support function and string filter
898
- if (filter && typeof filter.valueOf() === 'string') {
899
- filterFn = (node) => node.displayField.toLowerCase().indexOf(filter.toLowerCase()) !== -1;
900
- }
901
- else if (filter && typeof filter === 'function') {
902
- filterFn = filter;
903
- }
904
- else {
905
- console.error('Don\'t know what to do with filter', filter);
906
- console.error('Should be either a string or function');
907
- return;
908
- }
909
- const ids = {};
910
- this.roots.forEach((node) => this._filterNode(ids, node, filterFn, autoShow));
911
- this.hiddenNodeIds = ids;
912
- this.fireEvent({ eventName: TREE_EVENTS.changeFilter });
913
- }
914
- clearFilter() {
915
- this.hiddenNodeIds = {};
916
- this.fireEvent({ eventName: TREE_EVENTS.changeFilter });
917
- }
918
- moveNode(node, to) {
919
- const fromIndex = node.getIndexInParent();
920
- const fromParent = node.parent;
921
- if (!this.canMoveNode(node, to, fromIndex))
922
- return;
923
- const fromChildren = fromParent.getField('children');
924
- // If node doesn't have children - create children array
925
- if (!to.parent.getField('children')) {
926
- to.parent.setField('children', []);
927
- }
928
- const toChildren = to.parent.getField('children');
929
- const originalNode = fromChildren.splice(fromIndex, 1)[0];
930
- // Compensate for index if already removed from parent:
931
- let toIndex = (fromParent === to.parent && to.index > fromIndex) ? to.index - 1 : to.index;
932
- toChildren.splice(toIndex, 0, originalNode);
933
- fromParent.treeModel.update();
934
- if (to.parent.treeModel !== fromParent.treeModel) {
935
- to.parent.treeModel.update();
936
- }
937
- this.fireEvent({
938
- eventName: TREE_EVENTS.moveNode,
939
- node: originalNode,
940
- to: { parent: to.parent.data, index: toIndex },
941
- from: { parent: fromParent.data, index: fromIndex }
942
- });
943
- }
944
- copyNode(node, to) {
945
- const fromIndex = node.getIndexInParent();
946
- if (!this.canMoveNode(node, to, fromIndex))
947
- return;
948
- // If node doesn't have children - create children array
949
- if (!to.parent.getField('children')) {
950
- to.parent.setField('children', []);
951
- }
952
- const toChildren = to.parent.getField('children');
953
- const nodeCopy = this.options.getNodeClone(node);
954
- toChildren.splice(to.index, 0, nodeCopy);
955
- node.treeModel.update();
956
- if (to.parent.treeModel !== node.treeModel) {
957
- to.parent.treeModel.update();
958
- }
959
- this.fireEvent({ eventName: TREE_EVENTS.copyNode, node: nodeCopy, to: { parent: to.parent.data, index: to.index } });
960
- }
961
- getState() {
962
- return {
963
- expandedNodeIds: this.expandedNodeIds,
964
- selectedLeafNodeIds: this.selectedLeafNodeIds,
965
- activeNodeIds: this.activeNodeIds,
966
- hiddenNodeIds: this.hiddenNodeIds,
967
- focusedNodeId: this.focusedNodeId
968
- };
969
- }
970
- setState(state) {
971
- if (!state)
972
- 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
- });
980
- }
981
- subscribeToState(fn) {
982
- autorun(() => fn(this.getState()));
983
- }
984
- canMoveNode(node, to, fromIndex = undefined) {
985
- const fromNodeIndex = fromIndex || node.getIndexInParent();
986
- // same node:
987
- if (node.parent === to.parent && fromIndex === to.index) {
988
- return false;
989
- }
990
- return !to.parent.isDescendantOf(node);
991
- }
992
- calculateExpandedNodes() {
993
- this._calculateExpandedNodes();
994
- }
995
- // private methods
996
- _filterNode(ids, node, filterFn, autoShow) {
997
- // if node passes function then it's visible
998
- let isVisible = filterFn(node);
999
- if (node.children) {
1000
- // if one of node's children passes filter then this node is also visible
1001
- node.children.forEach((child) => {
1002
- if (this._filterNode(ids, child, filterFn, autoShow)) {
1003
- isVisible = true;
1004
- }
1005
- });
1006
- }
1007
- // mark node as hidden
1008
- if (!isVisible) {
1009
- ids[node.id] = true;
1010
- }
1011
- // auto expand parents to make sure the filtered nodes are visible
1012
- if (autoShow && isVisible) {
1013
- node.ensureVisible();
1014
- }
1015
- return isVisible;
1016
- }
1017
- _calculateExpandedNodes(startNode = null) {
1018
- startNode = startNode || this.virtualRoot;
1019
- if (startNode.data[this.options.isExpandedField]) {
1020
- this.expandedNodeIds = Object.assign({}, this.expandedNodeIds, { [startNode.id]: true });
1021
- }
1022
- if (startNode.children) {
1023
- startNode.children.forEach((child) => this._calculateExpandedNodes(child));
1024
- }
1025
- }
1026
- _setActiveNodeSingle(node, value) {
1027
- // Deactivate all other nodes:
1028
- this.activeNodes
1029
- .filter((activeNode) => activeNode !== node)
1030
- .forEach((activeNode) => {
1031
- this.fireEvent({ eventName: TREE_EVENTS.deactivate, node: activeNode });
1032
- this.fireEvent({ eventName: TREE_EVENTS.nodeDeactivate, node: activeNode }); // For IE11
1033
- });
1034
- if (value) {
1035
- this.activeNodeIds = { [node.id]: true };
1036
- }
1037
- else {
1038
- this.activeNodeIds = {};
1039
- }
1040
- }
1041
- _setActiveNodeMulti(node, value) {
1042
- this.activeNodeIds = Object.assign({}, this.activeNodeIds, { [node.id]: value });
1043
- }
1044
- }
1045
- TreeModel.focusedTree = null;
1046
- /** @nocollapse */ TreeModelfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1047
- /** @nocollapse */ TreeModel.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeModel });
1048
- __decorate$2([
1049
- observable$1
1050
- ], TreeModel.prototype, "roots", void 0);
1051
- __decorate$2([
1052
- observable$1
1053
- ], TreeModel.prototype, "expandedNodeIds", void 0);
1054
- __decorate$2([
1055
- observable$1
1056
- ], TreeModel.prototype, "selectedLeafNodeIds", void 0);
1057
- __decorate$2([
1058
- observable$1
1059
- ], TreeModel.prototype, "activeNodeIds", void 0);
1060
- __decorate$2([
1061
- observable$1
1062
- ], TreeModel.prototype, "hiddenNodeIds", void 0);
1063
- __decorate$2([
1064
- observable$1
1065
- ], TreeModel.prototype, "focusedNodeId", void 0);
1066
- __decorate$2([
1067
- observable$1
1068
- ], TreeModel.prototype, "virtualRoot", void 0);
1069
- __decorate$2([
1070
- computed$1
1071
- ], TreeModel.prototype, "focusedNode", null);
1072
- __decorate$2([
1073
- computed$1
1074
- ], TreeModel.prototype, "expandedNodes", null);
1075
- __decorate$2([
1076
- computed$1
1077
- ], TreeModel.prototype, "activeNodes", null);
1078
- __decorate$2([
1079
- computed$1
1080
- ], TreeModel.prototype, "hiddenNodes", null);
1081
- __decorate$2([
1082
- computed$1
1083
- ], TreeModel.prototype, "selectedLeafNodes", null);
1084
- __decorate$2([
1085
- action$1
1086
- ], TreeModel.prototype, "setData", null);
1087
- __decorate$2([
1088
- action$1
1089
- ], TreeModel.prototype, "update", null);
1090
- __decorate$2([
1091
- action$1
1092
- ], TreeModel.prototype, "setFocusedNode", null);
1093
- __decorate$2([
1094
- action$1
1095
- ], TreeModel.prototype, "setFocus", null);
1096
- __decorate$2([
1097
- action$1
1098
- ], TreeModel.prototype, "doForAll", null);
1099
- __decorate$2([
1100
- action$1
1101
- ], TreeModel.prototype, "focusNextNode", null);
1102
- __decorate$2([
1103
- action$1
1104
- ], TreeModel.prototype, "focusPreviousNode", null);
1105
- __decorate$2([
1106
- action$1
1107
- ], TreeModel.prototype, "focusDrillDown", null);
1108
- __decorate$2([
1109
- action$1
1110
- ], TreeModel.prototype, "focusDrillUp", null);
1111
- __decorate$2([
1112
- action$1
1113
- ], TreeModel.prototype, "setActiveNode", null);
1114
- __decorate$2([
1115
- action$1
1116
- ], TreeModel.prototype, "setSelectedNode", null);
1117
- __decorate$2([
1118
- action$1
1119
- ], TreeModel.prototype, "setExpandedNode", null);
1120
- __decorate$2([
1121
- action$1
1122
- ], TreeModel.prototype, "expandAll", null);
1123
- __decorate$2([
1124
- action$1
1125
- ], TreeModel.prototype, "collapseAll", null);
1126
- __decorate$2([
1127
- action$1
1128
- ], TreeModel.prototype, "setIsHidden", null);
1129
- __decorate$2([
1130
- action$1
1131
- ], TreeModel.prototype, "setHiddenNodeIds", null);
1132
- __decorate$2([
1133
- action$1
1134
- ], TreeModel.prototype, "filterNodes", null);
1135
- __decorate$2([
1136
- action$1
1137
- ], TreeModel.prototype, "clearFilter", null);
1138
- __decorate$2([
1139
- action$1
1140
- ], TreeModel.prototype, "moveNode", null);
1141
- __decorate$2([
1142
- action$1
1143
- ], TreeModel.prototype, "copyNode", null);
1144
- __decorate$2([
1145
- action$1
1146
- ], TreeModel.prototype, "setState", null);
1147
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeModel, decorators: [{
1148
- type: Injectable
611
+ var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
612
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
613
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
614
+ 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;
615
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
616
+ };
617
+ class TreeModel {
618
+ constructor() {
619
+ this.options = new TreeOptions();
620
+ this.eventNames = Object.keys(TREE_EVENTS);
621
+ this.expandedNodeIds = {};
622
+ this.selectedLeafNodeIds = {};
623
+ this.activeNodeIds = {};
624
+ this.hiddenNodeIds = {};
625
+ this.focusedNodeId = null;
626
+ this.firstUpdate = true;
627
+ this.subscriptions = [];
628
+ }
629
+ static { this.focusedTree = null; }
630
+ // events
631
+ fireEvent(event) {
632
+ event.treeModel = this;
633
+ this.events[event.eventName].emit(event);
634
+ this.events.event.emit(event);
635
+ }
636
+ subscribe(eventName, fn) {
637
+ const subscription = this.events[eventName].subscribe(fn);
638
+ this.subscriptions.push(subscription);
639
+ }
640
+ // getters
641
+ getFocusedNode() {
642
+ return this.focusedNode;
643
+ }
644
+ getActiveNode() {
645
+ return this.activeNodes[0];
646
+ }
647
+ getActiveNodes() {
648
+ return this.activeNodes;
649
+ }
650
+ getVisibleRoots() {
651
+ return this.virtualRoot.visibleChildren;
652
+ }
653
+ getFirstRoot(skipHidden = false) {
654
+ const root = skipHidden ? this.getVisibleRoots() : this.roots;
655
+ return root != null && root.length ? root[0] : null;
656
+ }
657
+ getLastRoot(skipHidden = false) {
658
+ const root = skipHidden ? this.getVisibleRoots() : this.roots;
659
+ return root != null && root.length ? root[root.length - 1] : null;
660
+ }
661
+ get isFocused() {
662
+ return TreeModel.focusedTree === this;
663
+ }
664
+ isNodeFocused(node) {
665
+ return this.focusedNode === node;
666
+ }
667
+ isEmptyTree() {
668
+ return this.roots && this.roots.length === 0;
669
+ }
670
+ get focusedNode() {
671
+ return this.focusedNodeId ? this.getNodeById(this.focusedNodeId) : null;
672
+ }
673
+ get expandedNodes() {
674
+ const nodes = Object.keys(this.expandedNodeIds)
675
+ .filter((id) => this.expandedNodeIds[id])
676
+ .map((id) => this.getNodeById(id));
677
+ return nodes.filter(Boolean);
678
+ }
679
+ get activeNodes() {
680
+ const nodes = Object.keys(this.activeNodeIds)
681
+ .filter((id) => this.activeNodeIds[id])
682
+ .map((id) => this.getNodeById(id));
683
+ return nodes.filter(Boolean);
684
+ }
685
+ get hiddenNodes() {
686
+ const nodes = Object.keys(this.hiddenNodeIds)
687
+ .filter((id) => this.hiddenNodeIds[id])
688
+ .map((id) => this.getNodeById(id));
689
+ return nodes.filter(Boolean);
690
+ }
691
+ get selectedLeafNodes() {
692
+ const nodes = Object.keys(this.selectedLeafNodeIds)
693
+ .filter((id) => this.selectedLeafNodeIds[id])
694
+ .map((id) => this.getNodeById(id));
695
+ return nodes.filter(Boolean);
696
+ }
697
+ // locating nodes
698
+ getNodeByPath(path, startNode = null) {
699
+ if (!path)
700
+ return null;
701
+ startNode = startNode || this.virtualRoot;
702
+ if (path.length === 0)
703
+ return startNode;
704
+ if (!startNode.children)
705
+ return null;
706
+ const childId = path.shift();
707
+ const childNode = startNode.children.find(c => c.id === childId);
708
+ if (!childNode)
709
+ return null;
710
+ return this.getNodeByPath(path, childNode);
711
+ }
712
+ getNodeById(id) {
713
+ const idStr = id.toString();
714
+ return this.getNodeBy((node) => node.id.toString() === idStr);
715
+ }
716
+ getNodeBy(predicate, startNode = null) {
717
+ startNode = startNode || this.virtualRoot;
718
+ if (!startNode.children)
719
+ return null;
720
+ const found = startNode.children.find(predicate);
721
+ if (found) { // found in children
722
+ return found;
723
+ }
724
+ else { // look in children's children
725
+ for (let child of startNode.children) {
726
+ const foundInChildren = this.getNodeBy(predicate, child);
727
+ if (foundInChildren)
728
+ return foundInChildren;
729
+ }
730
+ }
731
+ }
732
+ isExpanded(node) {
733
+ return this.expandedNodeIds[node.id];
734
+ }
735
+ isHidden(node) {
736
+ return this.hiddenNodeIds[node.id];
737
+ }
738
+ isActive(node) {
739
+ return this.activeNodeIds[node.id];
740
+ }
741
+ isSelected(node) {
742
+ return this.selectedLeafNodeIds[node.id];
743
+ }
744
+ ngOnDestroy() {
745
+ this.dispose();
746
+ this.unsubscribeAll();
747
+ }
748
+ dispose() {
749
+ // Dispose reactions of the replaced nodes
750
+ if (this.virtualRoot) {
751
+ this.virtualRoot.dispose();
752
+ }
753
+ }
754
+ unsubscribeAll() {
755
+ this.subscriptions.forEach(subscription => subscription.unsubscribe());
756
+ this.subscriptions = [];
757
+ }
758
+ // actions
759
+ setData({ nodes, options = null, events = null }) {
760
+ if (options) {
761
+ this.options = new TreeOptions(options);
762
+ }
763
+ if (events) {
764
+ this.events = events;
765
+ }
766
+ if (nodes) {
767
+ this.nodes = nodes;
768
+ }
769
+ this.update();
770
+ }
771
+ update() {
772
+ // Rebuild tree:
773
+ let virtualRootConfig = {
774
+ id: this.options.rootId,
775
+ virtual: true,
776
+ [this.options.childrenField]: this.nodes
777
+ };
778
+ this.dispose();
779
+ this.virtualRoot = new TreeNode(virtualRootConfig, null, this, 0);
780
+ this.roots = this.virtualRoot.children;
781
+ // Fire event:
782
+ if (this.firstUpdate) {
783
+ if (this.roots) {
784
+ this.firstUpdate = false;
785
+ this._calculateExpandedNodes();
786
+ }
787
+ }
788
+ else {
789
+ this.fireEvent({ eventName: TREE_EVENTS.updateData });
790
+ }
791
+ }
792
+ setFocusedNode(node) {
793
+ this.focusedNodeId = node ? node.id : null;
794
+ }
795
+ setFocus(value) {
796
+ TreeModel.focusedTree = value ? this : null;
797
+ }
798
+ doForAll(fn) {
799
+ this.roots.forEach((root) => root.doForAll(fn));
800
+ }
801
+ focusNextNode() {
802
+ let previousNode = this.getFocusedNode();
803
+ let nextNode = previousNode ? previousNode.findNextNode(true, true) : this.getFirstRoot(true);
804
+ if (nextNode)
805
+ nextNode.focus();
806
+ }
807
+ focusPreviousNode() {
808
+ let previousNode = this.getFocusedNode();
809
+ let nextNode = previousNode ? previousNode.findPreviousNode(true) : this.getLastRoot(true);
810
+ if (nextNode)
811
+ nextNode.focus();
812
+ }
813
+ focusDrillDown() {
814
+ let previousNode = this.getFocusedNode();
815
+ if (previousNode && previousNode.isCollapsed && previousNode.hasChildren) {
816
+ previousNode.toggleExpanded();
817
+ }
818
+ else {
819
+ let nextNode = previousNode ? previousNode.getFirstChild(true) : this.getFirstRoot(true);
820
+ if (nextNode)
821
+ nextNode.focus();
822
+ }
823
+ }
824
+ focusDrillUp() {
825
+ let previousNode = this.getFocusedNode();
826
+ if (!previousNode)
827
+ return;
828
+ if (previousNode.isExpanded) {
829
+ previousNode.toggleExpanded();
830
+ }
831
+ else {
832
+ let nextNode = previousNode.realParent;
833
+ if (nextNode)
834
+ nextNode.focus();
835
+ }
836
+ }
837
+ setActiveNode(node, value, multi = false) {
838
+ if (multi) {
839
+ this._setActiveNodeMulti(node, value);
840
+ }
841
+ else {
842
+ this._setActiveNodeSingle(node, value);
843
+ }
844
+ if (value) {
845
+ node.focus(this.options.scrollOnActivate);
846
+ this.fireEvent({ eventName: TREE_EVENTS.activate, node });
847
+ this.fireEvent({ eventName: TREE_EVENTS.nodeActivate, node }); // For IE11
848
+ }
849
+ else {
850
+ this.fireEvent({ eventName: TREE_EVENTS.deactivate, node });
851
+ this.fireEvent({ eventName: TREE_EVENTS.nodeDeactivate, node }); // For IE11
852
+ }
853
+ }
854
+ setSelectedNode(node, value) {
855
+ this.selectedLeafNodeIds = Object.assign({}, this.selectedLeafNodeIds, { [node.id]: value });
856
+ if (value) {
857
+ node.focus();
858
+ this.fireEvent({ eventName: TREE_EVENTS.select, node });
859
+ }
860
+ else {
861
+ this.fireEvent({ eventName: TREE_EVENTS.deselect, node });
862
+ }
863
+ }
864
+ setExpandedNode(node, value) {
865
+ this.expandedNodeIds = Object.assign({}, this.expandedNodeIds, { [node.id]: value });
866
+ this.fireEvent({ eventName: TREE_EVENTS.toggleExpanded, node, isExpanded: value });
867
+ }
868
+ expandAll() {
869
+ this.roots.forEach((root) => root.expandAll());
870
+ }
871
+ collapseAll() {
872
+ this.roots.forEach((root) => root.collapseAll());
873
+ }
874
+ setIsHidden(node, value) {
875
+ this.hiddenNodeIds = Object.assign({}, this.hiddenNodeIds, { [node.id]: value });
876
+ }
877
+ setHiddenNodeIds(nodeIds) {
878
+ this.hiddenNodeIds = nodeIds.reduce((hiddenNodeIds, id) => Object.assign(hiddenNodeIds, {
879
+ [id]: true
880
+ }), {});
881
+ }
882
+ performKeyAction(node, $event) {
883
+ const keyAction = this.options.actionMapping.keys[$event.keyCode];
884
+ if (keyAction) {
885
+ $event.preventDefault();
886
+ keyAction(this, node, $event);
887
+ return true;
888
+ }
889
+ else {
890
+ return false;
891
+ }
892
+ }
893
+ filterNodes(filter, autoShow = true) {
894
+ let filterFn;
895
+ if (!filter) {
896
+ return this.clearFilter();
897
+ }
898
+ // support function and string filter
899
+ if (filter && typeof filter.valueOf() === 'string') {
900
+ filterFn = (node) => node.displayField.toLowerCase().indexOf(filter.toLowerCase()) !== -1;
901
+ }
902
+ else if (filter && typeof filter === 'function') {
903
+ filterFn = filter;
904
+ }
905
+ else {
906
+ console.error('Don\'t know what to do with filter', filter);
907
+ console.error('Should be either a string or function');
908
+ return;
909
+ }
910
+ const ids = {};
911
+ this.roots.forEach((node) => this._filterNode(ids, node, filterFn, autoShow));
912
+ this.hiddenNodeIds = ids;
913
+ this.fireEvent({ eventName: TREE_EVENTS.changeFilter });
914
+ }
915
+ clearFilter() {
916
+ this.hiddenNodeIds = {};
917
+ this.fireEvent({ eventName: TREE_EVENTS.changeFilter });
918
+ }
919
+ moveNode(node, to) {
920
+ const fromIndex = node.getIndexInParent();
921
+ const fromParent = node.parent;
922
+ if (!this.canMoveNode(node, to, fromIndex))
923
+ return;
924
+ const fromChildren = fromParent.getField('children');
925
+ // If node doesn't have children - create children array
926
+ if (!to.parent.getField('children')) {
927
+ to.parent.setField('children', []);
928
+ }
929
+ const toChildren = to.parent.getField('children');
930
+ const originalNode = fromChildren.splice(fromIndex, 1)[0];
931
+ // Compensate for index if already removed from parent:
932
+ let toIndex = (fromParent === to.parent && to.index > fromIndex) ? to.index - 1 : to.index;
933
+ toChildren.splice(toIndex, 0, originalNode);
934
+ fromParent.treeModel.update();
935
+ if (to.parent.treeModel !== fromParent.treeModel) {
936
+ to.parent.treeModel.update();
937
+ }
938
+ this.fireEvent({
939
+ eventName: TREE_EVENTS.moveNode,
940
+ node: originalNode,
941
+ to: { parent: to.parent.data, index: toIndex },
942
+ from: { parent: fromParent.data, index: fromIndex }
943
+ });
944
+ }
945
+ copyNode(node, to) {
946
+ const fromIndex = node.getIndexInParent();
947
+ if (!this.canMoveNode(node, to, fromIndex))
948
+ return;
949
+ // If node doesn't have children - create children array
950
+ if (!to.parent.getField('children')) {
951
+ to.parent.setField('children', []);
952
+ }
953
+ const toChildren = to.parent.getField('children');
954
+ const nodeCopy = this.options.getNodeClone(node);
955
+ toChildren.splice(to.index, 0, nodeCopy);
956
+ node.treeModel.update();
957
+ if (to.parent.treeModel !== node.treeModel) {
958
+ to.parent.treeModel.update();
959
+ }
960
+ this.fireEvent({ eventName: TREE_EVENTS.copyNode, node: nodeCopy, to: { parent: to.parent.data, index: to.index } });
961
+ }
962
+ getState() {
963
+ return {
964
+ expandedNodeIds: this.expandedNodeIds,
965
+ selectedLeafNodeIds: this.selectedLeafNodeIds,
966
+ activeNodeIds: this.activeNodeIds,
967
+ hiddenNodeIds: this.hiddenNodeIds,
968
+ focusedNodeId: this.focusedNodeId
969
+ };
970
+ }
971
+ setState(state) {
972
+ if (!state)
973
+ return;
974
+ Object.assign(this, {
975
+ expandedNodeIds: state.expandedNodeIds || {},
976
+ selectedLeafNodeIds: state.selectedLeafNodeIds || {},
977
+ activeNodeIds: state.activeNodeIds || {},
978
+ hiddenNodeIds: state.hiddenNodeIds || {},
979
+ focusedNodeId: state.focusedNodeId
980
+ });
981
+ }
982
+ subscribeToState(fn) {
983
+ autorun(() => fn(this.getState()));
984
+ }
985
+ canMoveNode(node, to, fromIndex = undefined) {
986
+ const fromNodeIndex = fromIndex || node.getIndexInParent();
987
+ // same node:
988
+ if (node.parent === to.parent && fromIndex === to.index) {
989
+ return false;
990
+ }
991
+ return !to.parent.isDescendantOf(node);
992
+ }
993
+ calculateExpandedNodes() {
994
+ this._calculateExpandedNodes();
995
+ }
996
+ // private methods
997
+ _filterNode(ids, node, filterFn, autoShow) {
998
+ // if node passes function then it's visible
999
+ let isVisible = filterFn(node);
1000
+ if (node.children) {
1001
+ // if one of node's children passes filter then this node is also visible
1002
+ node.children.forEach((child) => {
1003
+ if (this._filterNode(ids, child, filterFn, autoShow)) {
1004
+ isVisible = true;
1005
+ }
1006
+ });
1007
+ }
1008
+ // mark node as hidden
1009
+ if (!isVisible) {
1010
+ ids[node.id] = true;
1011
+ }
1012
+ // auto expand parents to make sure the filtered nodes are visible
1013
+ if (autoShow && isVisible) {
1014
+ node.ensureVisible();
1015
+ }
1016
+ return isVisible;
1017
+ }
1018
+ _calculateExpandedNodes(startNode = null) {
1019
+ startNode = startNode || this.virtualRoot;
1020
+ if (startNode.data[this.options.isExpandedField]) {
1021
+ this.expandedNodeIds = Object.assign({}, this.expandedNodeIds, { [startNode.id]: true });
1022
+ }
1023
+ if (startNode.children) {
1024
+ startNode.children.forEach((child) => this._calculateExpandedNodes(child));
1025
+ }
1026
+ }
1027
+ _setActiveNodeSingle(node, value) {
1028
+ // Deactivate all other nodes:
1029
+ this.activeNodes
1030
+ .filter((activeNode) => activeNode !== node)
1031
+ .forEach((activeNode) => {
1032
+ this.fireEvent({ eventName: TREE_EVENTS.deactivate, node: activeNode });
1033
+ this.fireEvent({ eventName: TREE_EVENTS.nodeDeactivate, node: activeNode }); // For IE11
1034
+ });
1035
+ if (value) {
1036
+ this.activeNodeIds = { [node.id]: true };
1037
+ }
1038
+ else {
1039
+ this.activeNodeIds = {};
1040
+ }
1041
+ }
1042
+ _setActiveNodeMulti(node, value) {
1043
+ this.activeNodeIds = Object.assign({}, this.activeNodeIds, { [node.id]: value });
1044
+ }
1045
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1046
+ /** @nocollapse */ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeModel }); }
1047
+ }
1048
+ __decorate$2([
1049
+ observable$1
1050
+ ], TreeModel.prototype, "roots", void 0);
1051
+ __decorate$2([
1052
+ observable$1
1053
+ ], TreeModel.prototype, "expandedNodeIds", void 0);
1054
+ __decorate$2([
1055
+ observable$1
1056
+ ], TreeModel.prototype, "selectedLeafNodeIds", void 0);
1057
+ __decorate$2([
1058
+ observable$1
1059
+ ], TreeModel.prototype, "activeNodeIds", void 0);
1060
+ __decorate$2([
1061
+ observable$1
1062
+ ], TreeModel.prototype, "hiddenNodeIds", void 0);
1063
+ __decorate$2([
1064
+ observable$1
1065
+ ], TreeModel.prototype, "focusedNodeId", void 0);
1066
+ __decorate$2([
1067
+ observable$1
1068
+ ], TreeModel.prototype, "virtualRoot", void 0);
1069
+ __decorate$2([
1070
+ computed$1
1071
+ ], TreeModel.prototype, "focusedNode", null);
1072
+ __decorate$2([
1073
+ computed$1
1074
+ ], TreeModel.prototype, "expandedNodes", null);
1075
+ __decorate$2([
1076
+ computed$1
1077
+ ], TreeModel.prototype, "activeNodes", null);
1078
+ __decorate$2([
1079
+ computed$1
1080
+ ], TreeModel.prototype, "hiddenNodes", null);
1081
+ __decorate$2([
1082
+ computed$1
1083
+ ], TreeModel.prototype, "selectedLeafNodes", null);
1084
+ __decorate$2([
1085
+ action$1
1086
+ ], TreeModel.prototype, "setData", null);
1087
+ __decorate$2([
1088
+ action$1
1089
+ ], TreeModel.prototype, "update", null);
1090
+ __decorate$2([
1091
+ action$1
1092
+ ], TreeModel.prototype, "setFocusedNode", null);
1093
+ __decorate$2([
1094
+ action$1
1095
+ ], TreeModel.prototype, "setFocus", null);
1096
+ __decorate$2([
1097
+ action$1
1098
+ ], TreeModel.prototype, "doForAll", null);
1099
+ __decorate$2([
1100
+ action$1
1101
+ ], TreeModel.prototype, "focusNextNode", null);
1102
+ __decorate$2([
1103
+ action$1
1104
+ ], TreeModel.prototype, "focusPreviousNode", null);
1105
+ __decorate$2([
1106
+ action$1
1107
+ ], TreeModel.prototype, "focusDrillDown", null);
1108
+ __decorate$2([
1109
+ action$1
1110
+ ], TreeModel.prototype, "focusDrillUp", null);
1111
+ __decorate$2([
1112
+ action$1
1113
+ ], TreeModel.prototype, "setActiveNode", null);
1114
+ __decorate$2([
1115
+ action$1
1116
+ ], TreeModel.prototype, "setSelectedNode", null);
1117
+ __decorate$2([
1118
+ action$1
1119
+ ], TreeModel.prototype, "setExpandedNode", null);
1120
+ __decorate$2([
1121
+ action$1
1122
+ ], TreeModel.prototype, "expandAll", null);
1123
+ __decorate$2([
1124
+ action$1
1125
+ ], TreeModel.prototype, "collapseAll", null);
1126
+ __decorate$2([
1127
+ action$1
1128
+ ], TreeModel.prototype, "setIsHidden", null);
1129
+ __decorate$2([
1130
+ action$1
1131
+ ], TreeModel.prototype, "setHiddenNodeIds", null);
1132
+ __decorate$2([
1133
+ action$1
1134
+ ], TreeModel.prototype, "filterNodes", null);
1135
+ __decorate$2([
1136
+ action$1
1137
+ ], TreeModel.prototype, "clearFilter", null);
1138
+ __decorate$2([
1139
+ action$1
1140
+ ], TreeModel.prototype, "moveNode", null);
1141
+ __decorate$2([
1142
+ action$1
1143
+ ], TreeModel.prototype, "copyNode", null);
1144
+ __decorate$2([
1145
+ action$1
1146
+ ], TreeModel.prototype, "setState", null);
1147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeModel, decorators: [{
1148
+ type: Injectable
1149
1149
  }], 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: [] } });
1150
1150
 
1151
- class TreeDraggedElement {
1152
- constructor() {
1153
- this._draggedElement = null;
1154
- }
1155
- set(draggedElement) {
1156
- this._draggedElement = draggedElement;
1157
- }
1158
- get() {
1159
- return this._draggedElement;
1160
- }
1161
- isDragging() {
1162
- return !!this.get();
1163
- }
1164
- }
1165
- /** @nocollapse */ TreeDraggedElementfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDraggedElement, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1166
- /** @nocollapse */ TreeDraggedElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDraggedElement, providedIn: 'root' });
1167
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDraggedElement, decorators: [{
1168
- type: Injectable,
1169
- args: [{
1170
- providedIn: 'root'
1171
- }]
1151
+ class TreeDraggedElement {
1152
+ constructor() {
1153
+ this._draggedElement = null;
1154
+ }
1155
+ set(draggedElement) {
1156
+ this._draggedElement = draggedElement;
1157
+ }
1158
+ get() {
1159
+ return this._draggedElement;
1160
+ }
1161
+ isDragging() {
1162
+ return !!this.get();
1163
+ }
1164
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeDraggedElement, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1165
+ /** @nocollapse */ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeDraggedElement, providedIn: 'root' }); }
1166
+ }
1167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeDraggedElement, decorators: [{
1168
+ type: Injectable,
1169
+ args: [{
1170
+ providedIn: 'root'
1171
+ }]
1172
1172
  }] });
1173
1173
 
1174
- var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
1175
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1176
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1177
- 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;
1178
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1179
- };
1180
- const Y_OFFSET = 500; // Extra pixels outside the viewport, in each direction, to render nodes in
1181
- const Y_EPSILON = 150; // Minimum pixel change required to recalculate the rendered nodes
1182
- class TreeVirtualScroll {
1183
- constructor(treeModel) {
1184
- this.treeModel = treeModel;
1185
- this.yBlocks = 0;
1186
- this.x = 0;
1187
- this.viewportHeight = null;
1188
- this.viewport = null;
1189
- treeModel.virtualScroll = this;
1190
- this._dispose = [autorun(() => this.fixScroll())];
1191
- }
1192
- get y() {
1193
- return this.yBlocks * Y_EPSILON;
1194
- }
1195
- get totalHeight() {
1196
- return this.treeModel.virtualRoot ? this.treeModel.virtualRoot.height : 0;
1197
- }
1198
- fireEvent(event) {
1199
- this.treeModel.fireEvent(event);
1200
- }
1201
- init() {
1202
- const fn = this.recalcPositions.bind(this);
1203
- fn();
1204
- this._dispose = [
1205
- ...this._dispose,
1206
- reaction(() => this.treeModel.roots, fn),
1207
- reaction(() => this.treeModel.expandedNodeIds, fn),
1208
- reaction(() => this.treeModel.hiddenNodeIds, fn)
1209
- ];
1210
- this.treeModel.subscribe(TREE_EVENTS.loadNodeChildren, fn);
1211
- }
1212
- isEnabled() {
1213
- return this.treeModel.options.useVirtualScroll;
1214
- }
1215
- _setYBlocks(value) {
1216
- this.yBlocks = value;
1217
- }
1218
- recalcPositions() {
1219
- this.treeModel.virtualRoot.height = this._getPositionAfter(this.treeModel.getVisibleRoots(), 0);
1220
- }
1221
- _getPositionAfter(nodes, startPos) {
1222
- let position = startPos;
1223
- nodes.forEach((node) => {
1224
- node.position = position;
1225
- position = this._getPositionAfterNode(node, position);
1226
- });
1227
- return position;
1228
- }
1229
- _getPositionAfterNode(node, startPos) {
1230
- let position = node.getSelfHeight() + startPos;
1231
- if (node.children && node.isExpanded) { // TBD: consider loading component as well
1232
- position = this._getPositionAfter(node.visibleChildren, position);
1233
- }
1234
- node.height = position - startPos;
1235
- return position;
1236
- }
1237
- clear() {
1238
- this._dispose.forEach((d) => d());
1239
- }
1240
- setViewport(viewport) {
1241
- Object.assign(this, {
1242
- viewport,
1243
- x: viewport.scrollLeft,
1244
- yBlocks: Math.round(viewport.scrollTop / Y_EPSILON),
1245
- viewportHeight: viewport.getBoundingClientRect ? viewport.getBoundingClientRect().height : 0
1246
- });
1247
- }
1248
- scrollIntoView(node, force, scrollToMiddle = true) {
1249
- if (node.options.scrollContainer) {
1250
- const scrollContainer = node.options.scrollContainer;
1251
- const scrollContainerHeight = scrollContainer.getBoundingClientRect().height;
1252
- const scrollContainerTop = scrollContainer.getBoundingClientRect().top;
1253
- const nodeTop = this.viewport.getBoundingClientRect().top + node.position - scrollContainerTop;
1254
- if (force || // force scroll to node
1255
- nodeTop < scrollContainer.scrollTop || // node is above scroll container
1256
- nodeTop + node.getSelfHeight() > scrollContainer.scrollTop + scrollContainerHeight) { // node is below container
1257
- scrollContainer.scrollTop = scrollToMiddle ?
1258
- nodeTop - scrollContainerHeight / 2 : // scroll to middle
1259
- nodeTop; // scroll to start
1260
- }
1261
- }
1262
- else {
1263
- if (force || // force scroll to node
1264
- node.position < this.y || // node is above viewport
1265
- node.position + node.getSelfHeight() > this.y + this.viewportHeight) { // node is below viewport
1266
- if (this.viewport) {
1267
- this.viewport.scrollTop = scrollToMiddle ?
1268
- node.position - this.viewportHeight / 2 : // scroll to middle
1269
- node.position; // scroll to start
1270
- this._setYBlocks(Math.floor(this.viewport.scrollTop / Y_EPSILON));
1271
- }
1272
- }
1273
- }
1274
- }
1275
- getViewportNodes(nodes) {
1276
- if (!nodes)
1277
- return [];
1278
- const visibleNodes = nodes.filter((node) => !node.isHidden);
1279
- if (!this.isEnabled())
1280
- return visibleNodes;
1281
- if (!this.viewportHeight || !visibleNodes.length)
1282
- return [];
1283
- // When loading children async this method is called before their height and position is calculated.
1284
- // In that case firstIndex === 0 and lastIndex === visibleNodes.length - 1 (e.g. 1000),
1285
- // which means that it loops through every visibleNodes item and push them into viewportNodes array.
1286
- // We can prevent nodes from being pushed to the array and wait for the appropriate calculations to take place
1287
- const lastVisibleNode = visibleNodes.slice(-1)[0];
1288
- if (!lastVisibleNode.height && lastVisibleNode.position === 0)
1289
- return [];
1290
- // Search for first node in the viewport using binary search
1291
- // Look for first node that starts after the beginning of the viewport (with buffer)
1292
- // Or that ends after the beginning of the viewport
1293
- const firstIndex = binarySearch(visibleNodes, (node) => {
1294
- return (node.position + Y_OFFSET > this.y) ||
1295
- (node.position + node.height > this.y);
1296
- });
1297
- // Search for last node in the viewport using binary search
1298
- // Look for first node that starts after the end of the viewport (with buffer)
1299
- const lastIndex = binarySearch(visibleNodes, (node) => {
1300
- return node.position - Y_OFFSET > this.y + this.viewportHeight;
1301
- }, firstIndex);
1302
- const viewportNodes = [];
1303
- for (let i = firstIndex; i <= lastIndex; i++) {
1304
- viewportNodes.push(visibleNodes[i]);
1305
- }
1306
- return viewportNodes;
1307
- }
1308
- fixScroll() {
1309
- const maxY = Math.max(0, this.totalHeight - this.viewportHeight);
1310
- if (this.y < 0)
1311
- this._setYBlocks(0);
1312
- if (this.y > maxY)
1313
- this._setYBlocks(maxY / Y_EPSILON);
1314
- }
1315
- }
1316
- /** @nocollapse */ TreeVirtualScrollfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeVirtualScroll, deps: [{ token: TreeModel }], target: i0.ɵɵFactoryTarget.Injectable });
1317
- /** @nocollapse */ TreeVirtualScroll.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeVirtualScroll });
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: "14.3.0", ngImport: i0, type: TreeVirtualScroll, decorators: [{
1346
- type: Injectable
1347
- }], ctorParameters: function () { return [{ type: TreeModel }]; }, propDecorators: { yBlocks: [], x: [], viewportHeight: [], y: [], totalHeight: [], _setYBlocks: [], recalcPositions: [], setViewport: [], scrollIntoView: [] } });
1348
- function binarySearch(nodes, condition, firstIndex = 0) {
1349
- let index = firstIndex;
1350
- let toIndex = nodes.length - 1;
1351
- while (index !== toIndex) {
1352
- let midIndex = Math.floor((index + toIndex) / 2);
1353
- if (condition(nodes[midIndex])) {
1354
- toIndex = midIndex;
1355
- }
1356
- else {
1357
- if (index === midIndex)
1358
- index = toIndex;
1359
- else
1360
- index = midIndex;
1361
- }
1362
- }
1363
- return index;
1174
+ var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
1175
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1176
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1177
+ 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;
1178
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1179
+ };
1180
+ const Y_OFFSET = 500; // Extra pixels outside the viewport, in each direction, to render nodes in
1181
+ const Y_EPSILON = 150; // Minimum pixel change required to recalculate the rendered nodes
1182
+ class TreeVirtualScroll {
1183
+ get y() {
1184
+ return this.yBlocks * Y_EPSILON;
1185
+ }
1186
+ get totalHeight() {
1187
+ return this.treeModel.virtualRoot ? this.treeModel.virtualRoot.height : 0;
1188
+ }
1189
+ constructor(treeModel) {
1190
+ this.treeModel = treeModel;
1191
+ this.yBlocks = 0;
1192
+ this.x = 0;
1193
+ this.viewportHeight = null;
1194
+ this.viewport = null;
1195
+ treeModel.virtualScroll = this;
1196
+ this._dispose = [autorun(() => this.fixScroll())];
1197
+ }
1198
+ fireEvent(event) {
1199
+ this.treeModel.fireEvent(event);
1200
+ }
1201
+ init() {
1202
+ const fn = this.recalcPositions.bind(this);
1203
+ fn();
1204
+ this._dispose = [
1205
+ ...this._dispose,
1206
+ reaction(() => this.treeModel.roots, fn),
1207
+ reaction(() => this.treeModel.expandedNodeIds, fn),
1208
+ reaction(() => this.treeModel.hiddenNodeIds, fn)
1209
+ ];
1210
+ this.treeModel.subscribe(TREE_EVENTS.loadNodeChildren, fn);
1211
+ }
1212
+ isEnabled() {
1213
+ return this.treeModel.options.useVirtualScroll;
1214
+ }
1215
+ _setYBlocks(value) {
1216
+ this.yBlocks = value;
1217
+ }
1218
+ recalcPositions() {
1219
+ this.treeModel.virtualRoot.height = this._getPositionAfter(this.treeModel.getVisibleRoots(), 0);
1220
+ }
1221
+ _getPositionAfter(nodes, startPos) {
1222
+ let position = startPos;
1223
+ nodes.forEach((node) => {
1224
+ node.position = position;
1225
+ position = this._getPositionAfterNode(node, position);
1226
+ });
1227
+ return position;
1228
+ }
1229
+ _getPositionAfterNode(node, startPos) {
1230
+ let position = node.getSelfHeight() + startPos;
1231
+ if (node.children && node.isExpanded) { // TBD: consider loading component as well
1232
+ position = this._getPositionAfter(node.visibleChildren, position);
1233
+ }
1234
+ node.height = position - startPos;
1235
+ return position;
1236
+ }
1237
+ clear() {
1238
+ this._dispose.forEach((d) => d());
1239
+ }
1240
+ setViewport(viewport) {
1241
+ Object.assign(this, {
1242
+ viewport,
1243
+ x: viewport.scrollLeft,
1244
+ yBlocks: Math.round(viewport.scrollTop / Y_EPSILON),
1245
+ viewportHeight: viewport.getBoundingClientRect ? viewport.getBoundingClientRect().height : 0
1246
+ });
1247
+ }
1248
+ scrollIntoView(node, force, scrollToMiddle = true) {
1249
+ if (node.options.scrollContainer) {
1250
+ const scrollContainer = node.options.scrollContainer;
1251
+ const scrollContainerHeight = scrollContainer.getBoundingClientRect().height;
1252
+ const scrollContainerTop = scrollContainer.getBoundingClientRect().top;
1253
+ const nodeTop = this.viewport.getBoundingClientRect().top + node.position - scrollContainerTop;
1254
+ if (force || // force scroll to node
1255
+ nodeTop < scrollContainer.scrollTop || // node is above scroll container
1256
+ nodeTop + node.getSelfHeight() > scrollContainer.scrollTop + scrollContainerHeight) { // node is below container
1257
+ scrollContainer.scrollTop = scrollToMiddle ?
1258
+ nodeTop - scrollContainerHeight / 2 : // scroll to middle
1259
+ nodeTop; // scroll to start
1260
+ }
1261
+ }
1262
+ else {
1263
+ if (force || // force scroll to node
1264
+ node.position < this.y || // node is above viewport
1265
+ node.position + node.getSelfHeight() > this.y + this.viewportHeight) { // node is below viewport
1266
+ if (this.viewport) {
1267
+ this.viewport.scrollTop = scrollToMiddle ?
1268
+ node.position - this.viewportHeight / 2 : // scroll to middle
1269
+ node.position; // scroll to start
1270
+ this._setYBlocks(Math.floor(this.viewport.scrollTop / Y_EPSILON));
1271
+ }
1272
+ }
1273
+ }
1274
+ }
1275
+ getViewportNodes(nodes) {
1276
+ if (!nodes)
1277
+ return [];
1278
+ const visibleNodes = nodes.filter((node) => !node.isHidden);
1279
+ if (!this.isEnabled())
1280
+ return visibleNodes;
1281
+ if (!this.viewportHeight || !visibleNodes.length)
1282
+ return [];
1283
+ // When loading children async this method is called before their height and position is calculated.
1284
+ // In that case firstIndex === 0 and lastIndex === visibleNodes.length - 1 (e.g. 1000),
1285
+ // which means that it loops through every visibleNodes item and push them into viewportNodes array.
1286
+ // We can prevent nodes from being pushed to the array and wait for the appropriate calculations to take place
1287
+ const lastVisibleNode = visibleNodes.slice(-1)[0];
1288
+ if (!lastVisibleNode.height && lastVisibleNode.position === 0)
1289
+ return [];
1290
+ // Search for first node in the viewport using binary search
1291
+ // Look for first node that starts after the beginning of the viewport (with buffer)
1292
+ // Or that ends after the beginning of the viewport
1293
+ const firstIndex = binarySearch(visibleNodes, (node) => {
1294
+ return (node.position + Y_OFFSET > this.y) ||
1295
+ (node.position + node.height > this.y);
1296
+ });
1297
+ // Search for last node in the viewport using binary search
1298
+ // Look for first node that starts after the end of the viewport (with buffer)
1299
+ const lastIndex = binarySearch(visibleNodes, (node) => {
1300
+ return node.position - Y_OFFSET > this.y + this.viewportHeight;
1301
+ }, firstIndex);
1302
+ const viewportNodes = [];
1303
+ for (let i = firstIndex; i <= lastIndex; i++) {
1304
+ viewportNodes.push(visibleNodes[i]);
1305
+ }
1306
+ return viewportNodes;
1307
+ }
1308
+ fixScroll() {
1309
+ const maxY = Math.max(0, this.totalHeight - this.viewportHeight);
1310
+ if (this.y < 0)
1311
+ this._setYBlocks(0);
1312
+ if (this.y > maxY)
1313
+ this._setYBlocks(maxY / Y_EPSILON);
1314
+ }
1315
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeVirtualScroll, deps: [{ token: TreeModel }], target: i0.ɵɵFactoryTarget.Injectable }); }
1316
+ /** @nocollapse */ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeVirtualScroll }); }
1317
+ }
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: "18.2.8", ngImport: i0, type: TreeVirtualScroll, decorators: [{
1346
+ type: Injectable
1347
+ }], ctorParameters: () => [{ type: TreeModel }], propDecorators: { yBlocks: [], x: [], viewportHeight: [], y: [], totalHeight: [], _setYBlocks: [], recalcPositions: [], setViewport: [], scrollIntoView: [] } });
1348
+ function binarySearch(nodes, condition, firstIndex = 0) {
1349
+ let index = firstIndex;
1350
+ let toIndex = nodes.length - 1;
1351
+ while (index !== toIndex) {
1352
+ let midIndex = Math.floor((index + toIndex) / 2);
1353
+ if (condition(nodes[midIndex])) {
1354
+ toIndex = midIndex;
1355
+ }
1356
+ else {
1357
+ if (index === midIndex)
1358
+ index = toIndex;
1359
+ else
1360
+ index = midIndex;
1361
+ }
1362
+ }
1363
+ return index;
1364
1364
  }
1365
1365
 
1366
- class LoadingComponent {
1367
- }
1368
- /** @nocollapse */ LoadingComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1369
- /** @nocollapse */ LoadingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: LoadingComponent, selector: "tree-loading-component", inputs: { template: "template", node: "node" }, ngImport: i0, template: `
1366
+ class LoadingComponent {
1367
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1368
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: LoadingComponent, selector: "tree-loading-component", inputs: { template: "template", node: "node" }, ngImport: i0, template: `
1370
1369
  <span *ngIf="!template">loading...</span>
1371
1370
  <ng-container
1372
1371
  [ngTemplateOutlet]="template"
1373
1372
  [ngTemplateOutletContext]="{ $implicit: node }">
1374
1373
  </ng-container>
1375
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None });
1376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoadingComponent, decorators: [{
1377
- type: Component,
1378
- args: [{
1379
- encapsulation: ViewEncapsulation.None,
1380
- selector: 'tree-loading-component',
1374
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1375
+ }
1376
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingComponent, decorators: [{
1377
+ type: Component,
1378
+ args: [{
1379
+ encapsulation: ViewEncapsulation.None,
1380
+ selector: 'tree-loading-component',
1381
1381
  template: `
1382
1382
  <span *ngIf="!template">loading...</span>
1383
1383
  <ng-container
1384
1384
  [ngTemplateOutlet]="template"
1385
1385
  [ngTemplateOutletContext]="{ $implicit: node }">
1386
1386
  </ng-container>
1387
- `,
1388
- }]
1389
- }], propDecorators: { template: [{
1390
- type: Input
1391
- }], node: [{
1392
- type: Input
1387
+ `,
1388
+ }]
1389
+ }], propDecorators: { template: [{
1390
+ type: Input
1391
+ }], node: [{
1392
+ type: Input
1393
1393
  }] } });
1394
1394
 
1395
- const DRAG_OVER_CLASS$1 = 'is-dragging-over';
1396
- const DRAG_DISABLED_CLASS = 'is-dragging-over-disabled';
1397
- class TreeDropDirective {
1398
- constructor(el, renderer, treeDraggedElement, ngZone) {
1399
- this.el = el;
1400
- this.renderer = renderer;
1401
- this.treeDraggedElement = treeDraggedElement;
1402
- this.ngZone = ngZone;
1403
- this.allowDragoverStyling = true;
1404
- this.onDropCallback = new EventEmitter();
1405
- this.onDragOverCallback = new EventEmitter();
1406
- this.onDragLeaveCallback = new EventEmitter();
1407
- this.onDragEnterCallback = new EventEmitter();
1408
- this._allowDrop = (element, $event) => true;
1409
- this.dragOverEventHandler = this.onDragOver.bind(this);
1410
- this.dragEnterEventHandler = this.onDragEnter.bind(this);
1411
- this.dragLeaveEventHandler = this.onDragLeave.bind(this);
1412
- }
1413
- set treeAllowDrop(allowDrop) {
1414
- if (allowDrop instanceof Function) {
1415
- this._allowDrop = allowDrop;
1416
- }
1417
- else
1418
- this._allowDrop = (element, $event) => allowDrop;
1419
- }
1420
- allowDrop($event) {
1421
- return this._allowDrop(this.treeDraggedElement.get(), $event);
1422
- }
1423
- ngAfterViewInit() {
1424
- let el = this.el.nativeElement;
1425
- this.ngZone.runOutsideAngular(() => {
1426
- el.addEventListener('dragover', this.dragOverEventHandler);
1427
- el.addEventListener('dragenter', this.dragEnterEventHandler);
1428
- el.addEventListener('dragleave', this.dragLeaveEventHandler);
1429
- });
1430
- }
1431
- ngOnDestroy() {
1432
- let el = this.el.nativeElement;
1433
- el.removeEventListener('dragover', this.dragOverEventHandler);
1434
- el.removeEventListener('dragenter', this.dragEnterEventHandler);
1435
- el.removeEventListener('dragleave', this.dragLeaveEventHandler);
1436
- }
1437
- onDragOver($event) {
1438
- if (!this.allowDrop($event)) {
1439
- if (this.allowDragoverStyling) {
1440
- return this.addDisabledClass();
1441
- }
1442
- return;
1443
- }
1444
- this.onDragOverCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1445
- $event.preventDefault();
1446
- if (this.allowDragoverStyling) {
1447
- this.addClass();
1448
- }
1449
- }
1450
- onDragEnter($event) {
1451
- if (!this.allowDrop($event))
1452
- return;
1453
- $event.preventDefault();
1454
- this.onDragEnterCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1455
- }
1456
- onDragLeave($event) {
1457
- if (!this.allowDrop($event)) {
1458
- if (this.allowDragoverStyling) {
1459
- return this.removeDisabledClass();
1460
- }
1461
- return;
1462
- }
1463
- this.onDragLeaveCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1464
- if (this.allowDragoverStyling) {
1465
- this.removeClass();
1466
- }
1467
- }
1468
- onDrop($event) {
1469
- if (!this.allowDrop($event))
1470
- return;
1471
- $event.preventDefault();
1472
- this.onDropCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1473
- if (this.allowDragoverStyling) {
1474
- this.removeClass();
1475
- }
1476
- this.treeDraggedElement.set(null);
1477
- }
1478
- addClass() {
1479
- this.renderer.addClass(this.el.nativeElement, DRAG_OVER_CLASS$1);
1480
- }
1481
- removeClass() {
1482
- this.renderer.removeClass(this.el.nativeElement, DRAG_OVER_CLASS$1);
1483
- }
1484
- addDisabledClass() {
1485
- this.renderer.addClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
1486
- }
1487
- removeDisabledClass() {
1488
- this.renderer.removeClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
1489
- }
1490
- }
1491
- /** @nocollapse */ TreeDropDirectivefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDropDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: TreeDraggedElement }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1492
- /** @nocollapse */ TreeDropDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: TreeDropDirective, selector: "[treeDrop]", inputs: { allowDragoverStyling: "allowDragoverStyling", treeAllowDrop: "treeAllowDrop" }, outputs: { onDropCallback: "treeDrop", onDragOverCallback: "treeDropDragOver", onDragLeaveCallback: "treeDropDragLeave", onDragEnterCallback: "treeDropDragEnter" }, host: { listeners: { "drop": "onDrop($event)" } }, ngImport: i0 });
1493
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDropDirective, decorators: [{
1494
- type: Directive,
1495
- args: [{
1496
- selector: '[treeDrop]'
1497
- }]
1498
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }]; }, propDecorators: { allowDragoverStyling: [{
1499
- type: Input
1500
- }], onDropCallback: [{
1501
- type: Output,
1502
- args: ['treeDrop']
1503
- }], onDragOverCallback: [{
1504
- type: Output,
1505
- args: ['treeDropDragOver']
1506
- }], onDragLeaveCallback: [{
1507
- type: Output,
1508
- args: ['treeDropDragLeave']
1509
- }], onDragEnterCallback: [{
1510
- type: Output,
1511
- args: ['treeDropDragEnter']
1512
- }], treeAllowDrop: [{
1513
- type: Input
1514
- }], onDrop: [{
1515
- type: HostListener,
1516
- args: ['drop', ['$event']]
1395
+ const DRAG_OVER_CLASS$1 = 'is-dragging-over';
1396
+ const DRAG_DISABLED_CLASS = 'is-dragging-over-disabled';
1397
+ class TreeDropDirective {
1398
+ set treeAllowDrop(allowDrop) {
1399
+ if (allowDrop instanceof Function) {
1400
+ this._allowDrop = allowDrop;
1401
+ }
1402
+ else
1403
+ this._allowDrop = (element, $event) => allowDrop;
1404
+ }
1405
+ allowDrop($event) {
1406
+ return this._allowDrop(this.treeDraggedElement.get(), $event);
1407
+ }
1408
+ constructor(el, renderer, treeDraggedElement, ngZone) {
1409
+ this.el = el;
1410
+ this.renderer = renderer;
1411
+ this.treeDraggedElement = treeDraggedElement;
1412
+ this.ngZone = ngZone;
1413
+ this.allowDragoverStyling = true;
1414
+ this.onDropCallback = new EventEmitter();
1415
+ this.onDragOverCallback = new EventEmitter();
1416
+ this.onDragLeaveCallback = new EventEmitter();
1417
+ this.onDragEnterCallback = new EventEmitter();
1418
+ this._allowDrop = (element, $event) => true;
1419
+ this.dragOverEventHandler = this.onDragOver.bind(this);
1420
+ this.dragEnterEventHandler = this.onDragEnter.bind(this);
1421
+ this.dragLeaveEventHandler = this.onDragLeave.bind(this);
1422
+ }
1423
+ ngAfterViewInit() {
1424
+ let el = this.el.nativeElement;
1425
+ this.ngZone.runOutsideAngular(() => {
1426
+ el.addEventListener('dragover', this.dragOverEventHandler);
1427
+ el.addEventListener('dragenter', this.dragEnterEventHandler);
1428
+ el.addEventListener('dragleave', this.dragLeaveEventHandler);
1429
+ });
1430
+ }
1431
+ ngOnDestroy() {
1432
+ let el = this.el.nativeElement;
1433
+ el.removeEventListener('dragover', this.dragOverEventHandler);
1434
+ el.removeEventListener('dragenter', this.dragEnterEventHandler);
1435
+ el.removeEventListener('dragleave', this.dragLeaveEventHandler);
1436
+ }
1437
+ onDragOver($event) {
1438
+ if (!this.allowDrop($event)) {
1439
+ if (this.allowDragoverStyling) {
1440
+ return this.addDisabledClass();
1441
+ }
1442
+ return;
1443
+ }
1444
+ this.onDragOverCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1445
+ $event.preventDefault();
1446
+ if (this.allowDragoverStyling) {
1447
+ this.addClass();
1448
+ }
1449
+ }
1450
+ onDragEnter($event) {
1451
+ if (!this.allowDrop($event))
1452
+ return;
1453
+ $event.preventDefault();
1454
+ this.onDragEnterCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1455
+ }
1456
+ onDragLeave($event) {
1457
+ if (!this.allowDrop($event)) {
1458
+ if (this.allowDragoverStyling) {
1459
+ return this.removeDisabledClass();
1460
+ }
1461
+ return;
1462
+ }
1463
+ this.onDragLeaveCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1464
+ if (this.allowDragoverStyling) {
1465
+ this.removeClass();
1466
+ }
1467
+ }
1468
+ onDrop($event) {
1469
+ if (!this.allowDrop($event))
1470
+ return;
1471
+ $event.preventDefault();
1472
+ this.onDropCallback.emit({ event: $event, element: this.treeDraggedElement.get() });
1473
+ if (this.allowDragoverStyling) {
1474
+ this.removeClass();
1475
+ }
1476
+ this.treeDraggedElement.set(null);
1477
+ }
1478
+ addClass() {
1479
+ this.renderer.addClass(this.el.nativeElement, DRAG_OVER_CLASS$1);
1480
+ }
1481
+ removeClass() {
1482
+ this.renderer.removeClass(this.el.nativeElement, DRAG_OVER_CLASS$1);
1483
+ }
1484
+ addDisabledClass() {
1485
+ this.renderer.addClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
1486
+ }
1487
+ removeDisabledClass() {
1488
+ this.renderer.removeClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
1489
+ }
1490
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeDropDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: TreeDraggedElement }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
1491
+ /** @nocollapse */ static { thisdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: TreeDropDirective, selector: "[treeDrop]", inputs: { allowDragoverStyling: "allowDragoverStyling", treeAllowDrop: "treeAllowDrop" }, outputs: { onDropCallback: "treeDrop", onDragOverCallback: "treeDropDragOver", onDragLeaveCallback: "treeDropDragLeave", onDragEnterCallback: "treeDropDragEnter" }, host: { listeners: { "drop": "onDrop($event)" } }, ngImport: i0 }); }
1492
+ }
1493
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeDropDirective, decorators: [{
1494
+ type: Directive,
1495
+ args: [{
1496
+ selector: '[treeDrop]'
1497
+ }]
1498
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }], propDecorators: { allowDragoverStyling: [{
1499
+ type: Input
1500
+ }], onDropCallback: [{
1501
+ type: Output,
1502
+ args: ['treeDrop']
1503
+ }], onDragOverCallback: [{
1504
+ type: Output,
1505
+ args: ['treeDropDragOver']
1506
+ }], onDragLeaveCallback: [{
1507
+ type: Output,
1508
+ args: ['treeDropDragLeave']
1509
+ }], onDragEnterCallback: [{
1510
+ type: Output,
1511
+ args: ['treeDropDragEnter']
1512
+ }], treeAllowDrop: [{
1513
+ type: Input
1514
+ }], onDrop: [{
1515
+ type: HostListener,
1516
+ args: ['drop', ['$event']]
1517
1517
  }] } });
1518
1518
 
1519
- class TreeNodeDropSlot {
1520
- onDrop($event) {
1521
- this.node.mouseAction('drop', $event.event, {
1522
- from: $event.element,
1523
- to: { parent: this.node, index: this.dropIndex }
1524
- });
1525
- }
1526
- allowDrop(element, $event) {
1527
- return this.node.options.allowDrop(element, { parent: this.node, index: this.dropIndex }, $event);
1528
- }
1529
- }
1530
- /** @nocollapse */ TreeNodeDropSlotfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeDropSlot, deps: [], target: i0.ɵɵFactoryTarget.Component });
1531
- /** @nocollapse */ TreeNodeDropSlot.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: { node: "node", dropIndex: "dropIndex" }, ngImport: i0, template: `
1519
+ class TreeNodeDropSlot {
1520
+ onDrop($event) {
1521
+ this.node.mouseAction('drop', $event.event, {
1522
+ from: $event.element,
1523
+ to: { parent: this.node, index: this.dropIndex }
1524
+ });
1525
+ }
1526
+ allowDrop(element, $event) {
1527
+ return this.node.options.allowDrop(element, { parent: this.node, index: this.dropIndex }, $event);
1528
+ }
1529
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeDropSlot, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1530
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: { node: "node", dropIndex: "dropIndex" }, ngImport: i0, template: `
1532
1531
  <div
1533
1532
  class="node-drop-slot"
1534
1533
  (treeDrop)="onDrop($event)"
1535
1534
  [treeAllowDrop]="allowDrop.bind(this)"
1536
1535
  [allowDragoverStyling]="true">
1537
1536
  </div>
1538
- `, isInline: true, dependencies: [{ kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }], encapsulation: i0.ViewEncapsulation.None });
1539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeDropSlot, decorators: [{
1540
- type: Component,
1537
+ `, isInline: true, dependencies: [{ kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }], encapsulation: i0.ViewEncapsulation.None }); }
1538
+ }
1539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeDropSlot, decorators: [{
1540
+ type: Component,
1541
1541
  args: [{ selector: 'TreeNodeDropSlot, tree-node-drop-slot', encapsulation: ViewEncapsulation.None, template: `
1542
1542
  <div
1543
1543
  class="node-drop-slot"
@@ -1545,221 +1545,220 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1545
1545
  [treeAllowDrop]="allowDrop.bind(this)"
1546
1546
  [allowDragoverStyling]="true">
1547
1547
  </div>
1548
- ` }]
1549
- }], propDecorators: { node: [{
1550
- type: Input
1551
- }], dropIndex: [{
1552
- type: Input
1548
+ ` }]
1549
+ }], propDecorators: { node: [{
1550
+ type: Input
1551
+ }], dropIndex: [{
1552
+ type: Input
1553
1553
  }] } });
1554
1554
 
1555
- // Re-export mobx operators to be able to use inside components with AOT:
1556
- function actionInternal(...args) {
1557
- return action$1(...args);
1558
- }
1559
- const action = Object.assign(actionInternal, action$1);
1560
- function computedInternal(...args) {
1561
- return computed$1(...args);
1562
- }
1563
- const computed = Object.assign(computedInternal, computed$1);
1564
- function observableInternal(...args) {
1565
- return observable$1(...args);
1566
- }
1555
+ // Re-export mobx operators to be able to use inside components with AOT:
1556
+ function actionInternal(...args) {
1557
+ return action$1(...args);
1558
+ }
1559
+ const action = Object.assign(actionInternal, action$1);
1560
+ function computedInternal(...args) {
1561
+ return computed$1(...args);
1562
+ }
1563
+ const computed = Object.assign(computedInternal, computed$1);
1564
+ function observableInternal(...args) {
1565
+ return observable$1(...args);
1566
+ }
1567
1567
  const observable = Object.assign(observableInternal, observable$1);
1568
1568
 
1569
- const EASE_ACCELERATION = 1.005;
1570
- class TreeAnimateOpenDirective {
1571
- constructor(renderer, templateRef, viewContainerRef) {
1572
- this.renderer = renderer;
1573
- this.templateRef = templateRef;
1574
- this.viewContainerRef = viewContainerRef;
1575
- }
1576
- set isOpen(value) {
1577
- if (value) {
1578
- this._show();
1579
- if (this.isEnabled && this._isOpen === false) {
1580
- this._animateOpen();
1581
- }
1582
- }
1583
- else {
1584
- this.isEnabled ? this._animateClose() : this._hide();
1585
- }
1586
- this._isOpen = !!value;
1587
- }
1588
- ;
1589
- _show() {
1590
- if (this.innerElement)
1591
- return;
1592
- // create child view
1593
- this.innerElement = this.viewContainerRef.createEmbeddedView(this.templateRef).rootNodes[0];
1594
- }
1595
- _hide() {
1596
- this.viewContainerRef.clear();
1597
- this.innerElement = null;
1598
- }
1599
- _animateOpen() {
1600
- let delta = this.animateSpeed;
1601
- let ease = this.animateAcceleration;
1602
- let maxHeight = 0;
1603
- // set height to 0
1604
- this.renderer.setStyle(this.innerElement, 'max-height', `0`);
1605
- // increase maxHeight until height doesn't change
1606
- setTimeout(() => {
1607
- const i = setInterval(() => {
1608
- if (!this._isOpen || !this.innerElement)
1609
- return clearInterval(i);
1610
- maxHeight += delta;
1611
- const roundedMaxHeight = Math.round(maxHeight);
1612
- this.renderer.setStyle(this.innerElement, 'max-height', `${roundedMaxHeight}px`);
1613
- const height = this.innerElement.getBoundingClientRect ? this.innerElement.getBoundingClientRect().height : 0; // TBD use renderer
1614
- delta *= ease;
1615
- ease *= EASE_ACCELERATION;
1616
- if (height < roundedMaxHeight) {
1617
- // Make maxHeight auto because animation finished and container might change height later on
1618
- this.renderer.setStyle(this.innerElement, 'max-height', null);
1619
- clearInterval(i);
1620
- }
1621
- }, 17);
1622
- });
1623
- }
1624
- _animateClose() {
1625
- if (!this.innerElement)
1626
- return;
1627
- let delta = this.animateSpeed;
1628
- let ease = this.animateAcceleration;
1629
- let height = this.innerElement.getBoundingClientRect().height; // TBD use renderer
1630
- // slowly decrease maxHeight to 0, starting from current height
1631
- const i = setInterval(() => {
1632
- if (this._isOpen || !this.innerElement)
1633
- return clearInterval(i);
1634
- height -= delta;
1635
- this.renderer.setStyle(this.innerElement, 'max-height', `${height}px`);
1636
- delta *= ease;
1637
- ease *= EASE_ACCELERATION;
1638
- if (height <= 0) {
1639
- // after animation complete - remove child element
1640
- this.viewContainerRef.clear();
1641
- this.innerElement = null;
1642
- clearInterval(i);
1643
- }
1644
- }, 17);
1645
- }
1646
- }
1647
- /** @nocollapse */ TreeAnimateOpenDirectivefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeAnimateOpenDirective, deps: [{ token: i0.Renderer2 }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
1648
- /** @nocollapse */ TreeAnimateOpenDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: TreeAnimateOpenDirective, selector: "[treeAnimateOpen]", inputs: { animateSpeed: ["treeAnimateOpenSpeed", "animateSpeed"], animateAcceleration: ["treeAnimateOpenAcceleration", "animateAcceleration"], isEnabled: ["treeAnimateOpenEnabled", "isEnabled"], isOpen: ["treeAnimateOpen", "isOpen"] }, ngImport: i0 });
1649
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeAnimateOpenDirective, decorators: [{
1650
- type: Directive,
1651
- args: [{
1652
- selector: '[treeAnimateOpen]'
1653
- }]
1654
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { animateSpeed: [{
1655
- type: Input,
1656
- args: ['treeAnimateOpenSpeed']
1657
- }], animateAcceleration: [{
1658
- type: Input,
1659
- args: ['treeAnimateOpenAcceleration']
1660
- }], isEnabled: [{
1661
- type: Input,
1662
- args: ['treeAnimateOpenEnabled']
1663
- }], isOpen: [{
1664
- type: Input,
1665
- args: ['treeAnimateOpen']
1569
+ const EASE_ACCELERATION = 1.005;
1570
+ class TreeAnimateOpenDirective {
1571
+ set isOpen(value) {
1572
+ if (value) {
1573
+ this._show();
1574
+ if (this.isEnabled && this._isOpen === false) {
1575
+ this._animateOpen();
1576
+ }
1577
+ }
1578
+ else {
1579
+ this.isEnabled ? this._animateClose() : this._hide();
1580
+ }
1581
+ this._isOpen = !!value;
1582
+ }
1583
+ ;
1584
+ constructor(renderer, templateRef, viewContainerRef) {
1585
+ this.renderer = renderer;
1586
+ this.templateRef = templateRef;
1587
+ this.viewContainerRef = viewContainerRef;
1588
+ }
1589
+ _show() {
1590
+ if (this.innerElement)
1591
+ return;
1592
+ // create child view
1593
+ this.innerElement = this.viewContainerRef.createEmbeddedView(this.templateRef).rootNodes[0];
1594
+ }
1595
+ _hide() {
1596
+ this.viewContainerRef.clear();
1597
+ this.innerElement = null;
1598
+ }
1599
+ _animateOpen() {
1600
+ let delta = this.animateSpeed;
1601
+ let ease = this.animateAcceleration;
1602
+ let maxHeight = 0;
1603
+ // set height to 0
1604
+ this.renderer.setStyle(this.innerElement, 'max-height', `0`);
1605
+ // increase maxHeight until height doesn't change
1606
+ setTimeout(() => {
1607
+ const i = setInterval(() => {
1608
+ if (!this._isOpen || !this.innerElement)
1609
+ return clearInterval(i);
1610
+ maxHeight += delta;
1611
+ const roundedMaxHeight = Math.round(maxHeight);
1612
+ this.renderer.setStyle(this.innerElement, 'max-height', `${roundedMaxHeight}px`);
1613
+ const height = this.innerElement.getBoundingClientRect ? this.innerElement.getBoundingClientRect().height : 0; // TBD use renderer
1614
+ delta *= ease;
1615
+ ease *= EASE_ACCELERATION;
1616
+ if (height < roundedMaxHeight) {
1617
+ // Make maxHeight auto because animation finished and container might change height later on
1618
+ this.renderer.setStyle(this.innerElement, 'max-height', null);
1619
+ clearInterval(i);
1620
+ }
1621
+ }, 17);
1622
+ });
1623
+ }
1624
+ _animateClose() {
1625
+ if (!this.innerElement)
1626
+ return;
1627
+ let delta = this.animateSpeed;
1628
+ let ease = this.animateAcceleration;
1629
+ let height = this.innerElement.getBoundingClientRect().height; // TBD use renderer
1630
+ // slowly decrease maxHeight to 0, starting from current height
1631
+ const i = setInterval(() => {
1632
+ if (this._isOpen || !this.innerElement)
1633
+ return clearInterval(i);
1634
+ height -= delta;
1635
+ this.renderer.setStyle(this.innerElement, 'max-height', `${height}px`);
1636
+ delta *= ease;
1637
+ ease *= EASE_ACCELERATION;
1638
+ if (height <= 0) {
1639
+ // after animation complete - remove child element
1640
+ this.viewContainerRef.clear();
1641
+ this.innerElement = null;
1642
+ clearInterval(i);
1643
+ }
1644
+ }, 17);
1645
+ }
1646
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeAnimateOpenDirective, deps: [{ token: i0.Renderer2 }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1647
+ /** @nocollapse */ static { thisdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: TreeAnimateOpenDirective, selector: "[treeAnimateOpen]", inputs: { animateSpeed: ["treeAnimateOpenSpeed", "animateSpeed"], animateAcceleration: ["treeAnimateOpenAcceleration", "animateAcceleration"], isEnabled: ["treeAnimateOpenEnabled", "isEnabled"], isOpen: ["treeAnimateOpen", "isOpen"] }, ngImport: i0 }); }
1648
+ }
1649
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeAnimateOpenDirective, decorators: [{
1650
+ type: Directive,
1651
+ args: [{
1652
+ selector: '[treeAnimateOpen]'
1653
+ }]
1654
+ }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { animateSpeed: [{
1655
+ type: Input,
1656
+ args: ['treeAnimateOpenSpeed']
1657
+ }], animateAcceleration: [{
1658
+ type: Input,
1659
+ args: ['treeAnimateOpenAcceleration']
1660
+ }], isEnabled: [{
1661
+ type: Input,
1662
+ args: ['treeAnimateOpenEnabled']
1663
+ }], isOpen: [{
1664
+ type: Input,
1665
+ args: ['treeAnimateOpen']
1666
1666
  }] } });
1667
1667
 
1668
- class TreeNodeContent {
1669
- }
1670
- /** @nocollapse */ TreeNodeContentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1671
- /** @nocollapse */ TreeNodeContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeContent, selector: "tree-node-content", inputs: { node: "node", index: "index", template: "template" }, ngImport: i0, template: `
1668
+ class TreeNodeContent {
1669
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1670
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeContent, selector: "tree-node-content", inputs: { node: "node", index: "index", template: "template" }, ngImport: i0, template: `
1672
1671
  <span *ngIf="!template">{{ node.displayField }}</span>
1673
1672
  <ng-container
1674
1673
  [ngTemplateOutlet]="template"
1675
1674
  [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
1676
- </ng-container>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None });
1677
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeContent, decorators: [{
1678
- type: Component,
1679
- args: [{
1680
- selector: 'tree-node-content',
1681
- encapsulation: ViewEncapsulation.None,
1675
+ </ng-container>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
1676
+ }
1677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeContent, decorators: [{
1678
+ type: Component,
1679
+ args: [{
1680
+ selector: 'tree-node-content',
1681
+ encapsulation: ViewEncapsulation.None,
1682
1682
  template: `
1683
1683
  <span *ngIf="!template">{{ node.displayField }}</span>
1684
1684
  <ng-container
1685
1685
  [ngTemplateOutlet]="template"
1686
1686
  [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
1687
- </ng-container>`,
1688
- }]
1689
- }], propDecorators: { node: [{
1690
- type: Input
1691
- }], index: [{
1692
- type: Input
1693
- }], template: [{
1694
- type: Input
1687
+ </ng-container>`,
1688
+ }]
1689
+ }], propDecorators: { node: [{
1690
+ type: Input
1691
+ }], index: [{
1692
+ type: Input
1693
+ }], template: [{
1694
+ type: Input
1695
1695
  }] } });
1696
1696
 
1697
- const DRAG_OVER_CLASS = 'is-dragging-over';
1698
- class TreeDragDirective {
1699
- constructor(el, renderer, treeDraggedElement, ngZone) {
1700
- this.el = el;
1701
- this.renderer = renderer;
1702
- this.treeDraggedElement = treeDraggedElement;
1703
- this.ngZone = ngZone;
1704
- this.dragEventHandler = this.onDrag.bind(this);
1705
- }
1706
- ngAfterViewInit() {
1707
- let el = this.el.nativeElement;
1708
- this.ngZone.runOutsideAngular(() => {
1709
- el.addEventListener('drag', this.dragEventHandler);
1710
- });
1711
- }
1712
- ngDoCheck() {
1713
- this.renderer.setAttribute(this.el.nativeElement, 'draggable', this.treeDragEnabled ? 'true' : 'false');
1714
- }
1715
- ngOnDestroy() {
1716
- let el = this.el.nativeElement;
1717
- el.removeEventListener('drag', this.dragEventHandler);
1718
- }
1719
- onDragStart(ev) {
1720
- // setting the data is required by firefox
1721
- ev.dataTransfer.setData('text', ev.target.id);
1722
- this.treeDraggedElement.set(this.draggedElement);
1723
- if (this.draggedElement.mouseAction) {
1724
- this.draggedElement.mouseAction('dragStart', ev);
1725
- }
1726
- }
1727
- onDrag(ev) {
1728
- if (this.draggedElement.mouseAction) {
1729
- this.draggedElement.mouseAction('drag', ev);
1730
- }
1731
- }
1732
- onDragEnd() {
1733
- if (this.draggedElement.mouseAction) {
1734
- this.draggedElement.mouseAction('dragEnd');
1735
- }
1736
- this.treeDraggedElement.set(null);
1737
- }
1738
- }
1739
- /** @nocollapse */ TreeDragDirectivefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDragDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: TreeDraggedElement }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1740
- /** @nocollapse */ TreeDragDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: TreeDragDirective, selector: "[treeDrag]", inputs: { draggedElement: ["treeDrag", "draggedElement"], treeDragEnabled: "treeDragEnabled" }, host: { listeners: { "dragstart": "onDragStart($event)", "dragend": "onDragEnd()" } }, ngImport: i0 });
1741
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDragDirective, decorators: [{
1742
- type: Directive,
1743
- args: [{
1744
- selector: '[treeDrag]'
1745
- }]
1746
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }]; }, propDecorators: { draggedElement: [{
1747
- type: Input,
1748
- args: ['treeDrag']
1749
- }], treeDragEnabled: [{
1750
- type: Input
1751
- }], onDragStart: [{
1752
- type: HostListener,
1753
- args: ['dragstart', ['$event']]
1754
- }], onDragEnd: [{
1755
- type: HostListener,
1756
- args: ['dragend']
1697
+ const DRAG_OVER_CLASS = 'is-dragging-over';
1698
+ class TreeDragDirective {
1699
+ constructor(el, renderer, treeDraggedElement, ngZone) {
1700
+ this.el = el;
1701
+ this.renderer = renderer;
1702
+ this.treeDraggedElement = treeDraggedElement;
1703
+ this.ngZone = ngZone;
1704
+ this.dragEventHandler = this.onDrag.bind(this);
1705
+ }
1706
+ ngAfterViewInit() {
1707
+ let el = this.el.nativeElement;
1708
+ this.ngZone.runOutsideAngular(() => {
1709
+ el.addEventListener('drag', this.dragEventHandler);
1710
+ });
1711
+ }
1712
+ ngDoCheck() {
1713
+ this.renderer.setAttribute(this.el.nativeElement, 'draggable', this.treeDragEnabled ? 'true' : 'false');
1714
+ }
1715
+ ngOnDestroy() {
1716
+ let el = this.el.nativeElement;
1717
+ el.removeEventListener('drag', this.dragEventHandler);
1718
+ }
1719
+ onDragStart(ev) {
1720
+ // setting the data is required by firefox
1721
+ ev.dataTransfer.setData('text', ev.target.id);
1722
+ this.treeDraggedElement.set(this.draggedElement);
1723
+ if (this.draggedElement.mouseAction) {
1724
+ this.draggedElement.mouseAction('dragStart', ev);
1725
+ }
1726
+ }
1727
+ onDrag(ev) {
1728
+ if (this.draggedElement.mouseAction) {
1729
+ this.draggedElement.mouseAction('drag', ev);
1730
+ }
1731
+ }
1732
+ onDragEnd() {
1733
+ if (this.draggedElement.mouseAction) {
1734
+ this.draggedElement.mouseAction('dragEnd');
1735
+ }
1736
+ this.treeDraggedElement.set(null);
1737
+ }
1738
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeDragDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: TreeDraggedElement }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
1739
+ /** @nocollapse */ static { thisdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: TreeDragDirective, selector: "[treeDrag]", inputs: { draggedElement: ["treeDrag", "draggedElement"], treeDragEnabled: "treeDragEnabled" }, host: { listeners: { "dragstart": "onDragStart($event)", "dragend": "onDragEnd()" } }, ngImport: i0 }); }
1740
+ }
1741
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeDragDirective, decorators: [{
1742
+ type: Directive,
1743
+ args: [{
1744
+ selector: '[treeDrag]'
1745
+ }]
1746
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }], propDecorators: { draggedElement: [{
1747
+ type: Input,
1748
+ args: ['treeDrag']
1749
+ }], treeDragEnabled: [{
1750
+ type: Input
1751
+ }], onDragStart: [{
1752
+ type: HostListener,
1753
+ args: ['dragstart', ['$event']]
1754
+ }], onDragEnd: [{
1755
+ type: HostListener,
1756
+ args: ['dragend']
1757
1757
  }] } });
1758
1758
 
1759
- class TreeNodeExpanderComponent {
1760
- }
1761
- /** @nocollapse */ TreeNodeExpanderComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeExpanderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1762
- /** @nocollapse */ TreeNodeExpanderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeExpanderComponent, selector: "tree-node-expander", inputs: { node: "node" }, ngImport: i0, template: `
1759
+ class TreeNodeExpanderComponent {
1760
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeExpanderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1761
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeExpanderComponent, selector: "tree-node-expander", inputs: { node: "node" }, ngImport: i0, template: `
1763
1762
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
1764
1763
  <span
1765
1764
  *ngIf="node.hasChildren"
@@ -1773,9 +1772,10 @@ class TreeNodeExpanderComponent {
1773
1772
  <span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
1774
1773
  </span>
1775
1774
  </ng-container>
1776
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None });
1777
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeExpanderComponent, decorators: [{
1778
- type: Component,
1775
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
1776
+ }
1777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeExpanderComponent, decorators: [{
1778
+ type: Component,
1779
1779
  args: [{ selector: 'tree-node-expander', encapsulation: ViewEncapsulation.None, template: `
1780
1780
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
1781
1781
  <span
@@ -1790,15 +1790,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1790
1790
  <span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
1791
1791
  </span>
1792
1792
  </ng-container>
1793
- ` }]
1794
- }], propDecorators: { node: [{
1795
- type: Input
1793
+ ` }]
1794
+ }], propDecorators: { node: [{
1795
+ type: Input
1796
1796
  }] } });
1797
1797
 
1798
- class TreeNodeCheckboxComponent {
1799
- }
1800
- /** @nocollapse */ TreeNodeCheckboxComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1801
- /** @nocollapse */ TreeNodeCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeCheckboxComponent, selector: "tree-node-checkbox", inputs: { node: "node" }, ngImport: i0, template: `
1798
+ class TreeNodeCheckboxComponent {
1799
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1800
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeCheckboxComponent, selector: "tree-node-checkbox", inputs: { node: "node" }, ngImport: i0, template: `
1802
1801
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
1803
1802
  <input
1804
1803
  class="tree-node-checkbox"
@@ -1808,9 +1807,10 @@ class TreeNodeCheckboxComponent {
1808
1807
  [indeterminate]="node.isPartiallySelected"
1809
1808
  />
1810
1809
  </ng-container>
1811
- `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None });
1812
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeCheckboxComponent, decorators: [{
1813
- type: Component,
1810
+ `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
1811
+ }
1812
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeCheckboxComponent, decorators: [{
1813
+ type: Component,
1814
1814
  args: [{ selector: 'tree-node-checkbox', encapsulation: ViewEncapsulation.None, template: `
1815
1815
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
1816
1816
  <input
@@ -1821,15 +1821,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1821
1821
  [indeterminate]="node.isPartiallySelected"
1822
1822
  />
1823
1823
  </ng-container>
1824
- ` }]
1825
- }], propDecorators: { node: [{
1826
- type: Input
1824
+ ` }]
1825
+ }], propDecorators: { node: [{
1826
+ type: Input
1827
1827
  }] } });
1828
1828
 
1829
- class TreeNodeWrapperComponent {
1830
- }
1831
- /** @nocollapse */ TreeNodeWrapperComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1832
- /** @nocollapse */ TreeNodeWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeWrapperComponent, selector: "tree-node-wrapper", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
1829
+ class TreeNodeWrapperComponent {
1830
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1831
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeWrapperComponent, selector: "tree-node-wrapper", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
1833
1832
  <div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
1834
1833
  <tree-node-checkbox *ngIf="node.options.useCheckbox" [node]="node"></tree-node-checkbox>
1835
1834
  <tree-node-expander [node]="node"></tree-node-expander>
@@ -1858,9 +1857,10 @@ class TreeNodeWrapperComponent {
1858
1857
  [ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
1859
1858
  [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
1860
1859
  </ng-container>
1861
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TreeNodeContent, selector: "tree-node-content", inputs: ["node", "index", "template"] }, { kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }, { kind: "directive", type: TreeDragDirective, selector: "[treeDrag]", inputs: ["treeDrag", "treeDragEnabled"] }, { kind: "component", type: TreeNodeExpanderComponent, selector: "tree-node-expander", inputs: ["node"] }, { kind: "component", type: TreeNodeCheckboxComponent, selector: "tree-node-checkbox", inputs: ["node"] }], encapsulation: i0.ViewEncapsulation.None });
1862
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeWrapperComponent, decorators: [{
1863
- type: Component,
1860
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TreeNodeContent, selector: "tree-node-content", inputs: ["node", "index", "template"] }, { kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }, { kind: "directive", type: TreeDragDirective, selector: "[treeDrag]", inputs: ["treeDrag", "treeDragEnabled"] }, { kind: "component", type: TreeNodeExpanderComponent, selector: "tree-node-expander", inputs: ["node"] }, { kind: "component", type: TreeNodeCheckboxComponent, selector: "tree-node-checkbox", inputs: ["node"] }], encapsulation: i0.ViewEncapsulation.None }); }
1861
+ }
1862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeWrapperComponent, decorators: [{
1863
+ type: Component,
1864
1864
  args: [{ selector: 'tree-node-wrapper', encapsulation: ViewEncapsulation.None, template: `
1865
1865
  <div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
1866
1866
  <tree-node-checkbox *ngIf="node.options.useCheckbox" [node]="node"></tree-node-checkbox>
@@ -1890,25 +1890,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1890
1890
  [ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
1891
1891
  [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
1892
1892
  </ng-container>
1893
- ` }]
1894
- }], propDecorators: { node: [{
1895
- type: Input
1896
- }], index: [{
1897
- type: Input
1898
- }], templates: [{
1899
- type: Input
1893
+ ` }]
1894
+ }], propDecorators: { node: [{
1895
+ type: Input
1896
+ }], index: [{
1897
+ type: Input
1898
+ }], templates: [{
1899
+ type: Input
1900
1900
  }] } });
1901
1901
 
1902
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
1903
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1904
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1905
- 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;
1906
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1907
- };
1908
- class TreeNodeChildrenComponent {
1909
- }
1910
- /** @nocollapse */ TreeNodeChildrenComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeChildrenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1911
- /** @nocollapse */ TreeNodeChildrenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeChildrenComponent, selector: "tree-node-children", inputs: { node: "node", templates: "templates" }, ngImport: i0, template: `
1902
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
1903
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1904
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1905
+ 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;
1906
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1907
+ };
1908
+ class TreeNodeChildrenComponent {
1909
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeChildrenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1910
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeChildrenComponent, selector: "tree-node-children", inputs: { node: "node", templates: "templates" }, ngImport: i0, template: `
1912
1911
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
1913
1912
  <div
1914
1913
  [class.tree-children]="true"
@@ -1936,9 +1935,10 @@ class TreeNodeChildrenComponent {
1936
1935
  ></tree-loading-component>
1937
1936
  </div>
1938
1937
  </ng-container>
1939
- `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(function () { return LoadingComponent; }), selector: "tree-loading-component", inputs: ["template", "node"] }, { kind: "component", type: i0.forwardRef(function () { return TreeNodeCollectionComponent; }), selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "directive", type: i0.forwardRef(function () { return TreeAnimateOpenDirective; }), selector: "[treeAnimateOpen]", inputs: ["treeAnimateOpenSpeed", "treeAnimateOpenAcceleration", "treeAnimateOpenEnabled", "treeAnimateOpen"] }, { kind: "directive", type: i0.forwardRef(function () { return TreeMobxAutorunDirective; }), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None });
1940
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeChildrenComponent, decorators: [{
1941
- type: Component,
1938
+ `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(() => LoadingComponent), selector: "tree-loading-component", inputs: ["template", "node"] }, { kind: "component", type: i0.forwardRef(() => TreeNodeCollectionComponent), selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "directive", type: i0.forwardRef(() => TreeAnimateOpenDirective), selector: "[treeAnimateOpen]", inputs: ["treeAnimateOpenSpeed", "treeAnimateOpenAcceleration", "treeAnimateOpenEnabled", "treeAnimateOpen"] }, { kind: "directive", type: i0.forwardRef(() => TreeMobxAutorunDirective), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
1939
+ }
1940
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeChildrenComponent, decorators: [{
1941
+ type: Component,
1942
1942
  args: [{ selector: 'tree-node-children', encapsulation: ViewEncapsulation.None, template: `
1943
1943
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
1944
1944
  <div
@@ -1967,59 +1967,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1967
1967
  ></tree-loading-component>
1968
1968
  </div>
1969
1969
  </ng-container>
1970
- ` }]
1971
- }], propDecorators: { node: [{
1972
- type: Input
1973
- }], templates: [{
1974
- type: Input
1975
- }] } });
1976
- class TreeNodeCollectionComponent {
1977
- constructor() {
1978
- this._dispose = [];
1979
- }
1980
- get nodes() {
1981
- return this._nodes;
1982
- }
1983
- set nodes(nodes) {
1984
- this.setNodes(nodes);
1985
- }
1986
- get marginTop() {
1987
- const firstNode = this.viewportNodes && this.viewportNodes.length && this.viewportNodes[0];
1988
- const relativePosition = firstNode && firstNode.parent
1989
- ? firstNode.position -
1990
- firstNode.parent.position -
1991
- firstNode.parent.getSelfHeight()
1992
- : 0;
1993
- return `${relativePosition}px`;
1994
- }
1995
- setNodes(nodes) {
1996
- this._nodes = nodes;
1997
- }
1998
- ngOnInit() {
1999
- this.virtualScroll = this.treeModel.virtualScroll;
2000
- this._dispose = [
2001
- // return node indexes so we can compare structurally,
2002
- reaction(() => {
2003
- return this.virtualScroll
2004
- .getViewportNodes(this.nodes)
2005
- .map(n => n.index);
2006
- }, nodeIndexes => {
2007
- this.viewportNodes = nodeIndexes.map(i => this.nodes[i]);
2008
- }, { compareStructural: true, fireImmediately: true }),
2009
- reaction(() => this.nodes, nodes => {
2010
- this.viewportNodes = this.virtualScroll.getViewportNodes(nodes);
2011
- })
2012
- ];
2013
- }
2014
- ngOnDestroy() {
2015
- this._dispose.forEach(d => d());
2016
- }
2017
- trackNode(index, node) {
2018
- return node.id;
2019
- }
2020
- }
2021
- /** @nocollapse */ TreeNodeCollectionComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeCollectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2022
- /** @nocollapse */ TreeNodeCollectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeCollectionComponent, selector: "tree-node-collection", inputs: { nodes: "nodes", treeModel: "treeModel", templates: "templates" }, ngImport: i0, template: `
1970
+ ` }]
1971
+ }], propDecorators: { node: [{
1972
+ type: Input
1973
+ }], templates: [{
1974
+ type: Input
1975
+ }] } });
1976
+ class TreeNodeCollectionComponent {
1977
+ constructor() {
1978
+ this._dispose = [];
1979
+ }
1980
+ get nodes() {
1981
+ return this._nodes;
1982
+ }
1983
+ set nodes(nodes) {
1984
+ this.setNodes(nodes);
1985
+ }
1986
+ get marginTop() {
1987
+ const firstNode = this.viewportNodes && this.viewportNodes.length && this.viewportNodes[0];
1988
+ const relativePosition = firstNode && firstNode.parent
1989
+ ? firstNode.position -
1990
+ firstNode.parent.position -
1991
+ firstNode.parent.getSelfHeight()
1992
+ : 0;
1993
+ return `${relativePosition}px`;
1994
+ }
1995
+ setNodes(nodes) {
1996
+ this._nodes = nodes;
1997
+ }
1998
+ ngOnInit() {
1999
+ this.virtualScroll = this.treeModel.virtualScroll;
2000
+ this._dispose = [
2001
+ // return node indexes so we can compare structurally,
2002
+ reaction(() => {
2003
+ return this.virtualScroll
2004
+ .getViewportNodes(this.nodes)
2005
+ .map(n => n.index);
2006
+ }, nodeIndexes => {
2007
+ this.viewportNodes = nodeIndexes.map(i => this.nodes[i]);
2008
+ }, { compareStructural: true, fireImmediately: true }),
2009
+ reaction(() => this.nodes, nodes => {
2010
+ this.viewportNodes = this.virtualScroll.getViewportNodes(nodes);
2011
+ })
2012
+ ];
2013
+ }
2014
+ ngOnDestroy() {
2015
+ this._dispose.forEach(d => d());
2016
+ }
2017
+ trackNode(index, node) {
2018
+ return node.id;
2019
+ }
2020
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeCollectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2021
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeCollectionComponent, selector: "tree-node-collection", inputs: { nodes: "nodes", treeModel: "treeModel", templates: "templates" }, ngImport: i0, template: `
2023
2022
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
2024
2023
  <div [style.margin-top]="marginTop">
2025
2024
  <tree-node
@@ -2031,24 +2030,25 @@ class TreeNodeCollectionComponent {
2031
2030
  </tree-node>
2032
2031
  </div>
2033
2032
  </ng-container>
2034
- `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i0.forwardRef(function () { return TreeNodeComponent; }), selector: "TreeNode, tree-node", inputs: ["node", "index", "templates"] }, { kind: "directive", type: i0.forwardRef(function () { return TreeMobxAutorunDirective; }), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None });
2035
- __decorate([
2036
- observable
2037
- ], TreeNodeCollectionComponent.prototype, "_nodes", void 0);
2038
- __decorate([
2039
- observable
2040
- ], TreeNodeCollectionComponent.prototype, "viewportNodes", void 0);
2041
- __decorate([
2042
- computed
2043
- ], TreeNodeCollectionComponent.prototype, "marginTop", null);
2044
- __decorate([
2045
- action
2046
- ], TreeNodeCollectionComponent.prototype, "setNodes", null);
2047
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeCollectionComponent, decorators: [{
2048
- type: Component,
2049
- args: [{
2050
- selector: 'tree-node-collection',
2051
- encapsulation: ViewEncapsulation.None,
2033
+ `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => i1.NgForOf), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i0.forwardRef(() => TreeNodeComponent), selector: "TreeNode, tree-node", inputs: ["node", "index", "templates"] }, { kind: "directive", type: i0.forwardRef(() => TreeMobxAutorunDirective), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
2034
+ }
2035
+ __decorate([
2036
+ observable
2037
+ ], TreeNodeCollectionComponent.prototype, "_nodes", void 0);
2038
+ __decorate([
2039
+ observable
2040
+ ], TreeNodeCollectionComponent.prototype, "viewportNodes", void 0);
2041
+ __decorate([
2042
+ computed
2043
+ ], TreeNodeCollectionComponent.prototype, "marginTop", null);
2044
+ __decorate([
2045
+ action
2046
+ ], TreeNodeCollectionComponent.prototype, "setNodes", null);
2047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeCollectionComponent, decorators: [{
2048
+ type: Component,
2049
+ args: [{
2050
+ selector: 'tree-node-collection',
2051
+ encapsulation: ViewEncapsulation.None,
2052
2052
  template: `
2053
2053
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
2054
2054
  <div [style.margin-top]="marginTop">
@@ -2061,19 +2061,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2061
2061
  </tree-node>
2062
2062
  </div>
2063
2063
  </ng-container>
2064
- `
2065
- }]
2066
- }], propDecorators: { nodes: [{
2067
- type: Input
2068
- }], treeModel: [{
2069
- type: Input
2070
- }], _nodes: [], templates: [{
2071
- type: Input
2072
- }], viewportNodes: [], marginTop: [], setNodes: [] } });
2073
- class TreeNodeComponent {
2074
- }
2075
- /** @nocollapse */ TreeNodeComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2076
- /** @nocollapse */ TreeNodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeNodeComponent, selector: "TreeNode, tree-node", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
2064
+ `
2065
+ }]
2066
+ }], propDecorators: { nodes: [{
2067
+ type: Input
2068
+ }], treeModel: [{
2069
+ type: Input
2070
+ }], _nodes: [], templates: [{
2071
+ type: Input
2072
+ }], viewportNodes: [], marginTop: [], setNodes: [] } });
2073
+ class TreeNodeComponent {
2074
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2075
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeNodeComponent, selector: "TreeNode, tree-node", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
2077
2076
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
2078
2077
  <div
2079
2078
  *ngIf="!templates.treeNodeFullTemplate"
@@ -2117,9 +2116,10 @@ class TreeNodeComponent {
2117
2116
  >
2118
2117
  </ng-container>
2119
2118
  </ng-container>
2120
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TreeNodeChildrenComponent, selector: "tree-node-children", inputs: ["node", "templates"] }, { 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: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None });
2121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeNodeComponent, decorators: [{
2122
- type: Component,
2119
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TreeNodeChildrenComponent, selector: "tree-node-children", inputs: ["node", "templates"] }, { 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: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
2120
+ }
2121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeNodeComponent, decorators: [{
2122
+ type: Component,
2123
2123
  args: [{ selector: 'TreeNode, tree-node', encapsulation: ViewEncapsulation.None, template: `
2124
2124
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
2125
2125
  <div
@@ -2164,134 +2164,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2164
2164
  >
2165
2165
  </ng-container>
2166
2166
  </ng-container>
2167
- ` }]
2168
- }], propDecorators: { node: [{
2169
- type: Input
2170
- }], index: [{
2171
- type: Input
2172
- }], templates: [{
2173
- type: Input
2167
+ ` }]
2168
+ }], propDecorators: { node: [{
2169
+ type: Input
2170
+ }], index: [{
2171
+ type: Input
2172
+ }], templates: [{
2173
+ type: Input
2174
2174
  }] } });
2175
2175
 
2176
- class TreeViewportComponent {
2177
- constructor(elementRef, virtualScroll) {
2178
- this.elementRef = elementRef;
2179
- this.virtualScroll = virtualScroll;
2180
- this.setViewport = this.throttle(() => {
2181
- this.virtualScroll.setViewport(this.elementRef.nativeElement);
2182
- }, 17);
2183
- this.scrollEventHandler = this.setViewport.bind(this);
2184
- }
2185
- ngOnInit() {
2186
- this.virtualScroll.init();
2187
- }
2188
- ngAfterViewInit() {
2189
- setTimeout(() => {
2190
- this.setViewport();
2191
- this.virtualScroll.fireEvent({ eventName: TREE_EVENTS.initialized });
2192
- });
2193
- let el = this.elementRef.nativeElement;
2194
- el.addEventListener('scroll', this.scrollEventHandler);
2195
- }
2196
- ngOnDestroy() {
2197
- this.virtualScroll.clear();
2198
- let el = this.elementRef.nativeElement;
2199
- el.removeEventListener('scroll', this.scrollEventHandler);
2200
- }
2201
- getTotalHeight() {
2202
- return ((this.virtualScroll.isEnabled() &&
2203
- this.virtualScroll.totalHeight + 'px') ||
2204
- 'auto');
2205
- }
2206
- throttle(func, timeFrame) {
2207
- let lastTime = 0;
2208
- return function () {
2209
- let now = Date.now();
2210
- if (now - lastTime >= timeFrame) {
2211
- func();
2212
- lastTime = now;
2213
- }
2214
- };
2215
- }
2216
- }
2217
- /** @nocollapse */ TreeViewportComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeViewportComponent, deps: [{ token: i0.ElementRef }, { token: TreeVirtualScroll }], target: i0.ɵɵFactoryTarget.Component });
2218
- /** @nocollapse */ TreeViewportComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeViewportComponent, selector: "tree-viewport", providers: [TreeVirtualScroll], ngImport: i0, template: `
2176
+ class TreeViewportComponent {
2177
+ constructor(elementRef, virtualScroll) {
2178
+ this.elementRef = elementRef;
2179
+ this.virtualScroll = virtualScroll;
2180
+ this.setViewport = this.throttle(() => {
2181
+ this.virtualScroll.setViewport(this.elementRef.nativeElement);
2182
+ }, 17);
2183
+ this.scrollEventHandler = this.setViewport.bind(this);
2184
+ }
2185
+ ngOnInit() {
2186
+ this.virtualScroll.init();
2187
+ }
2188
+ ngAfterViewInit() {
2189
+ setTimeout(() => {
2190
+ this.setViewport();
2191
+ this.virtualScroll.fireEvent({ eventName: TREE_EVENTS.initialized });
2192
+ });
2193
+ let el = this.elementRef.nativeElement;
2194
+ el.addEventListener('scroll', this.scrollEventHandler);
2195
+ }
2196
+ ngOnDestroy() {
2197
+ this.virtualScroll.clear();
2198
+ let el = this.elementRef.nativeElement;
2199
+ el.removeEventListener('scroll', this.scrollEventHandler);
2200
+ }
2201
+ getTotalHeight() {
2202
+ return ((this.virtualScroll.isEnabled() &&
2203
+ this.virtualScroll.totalHeight + 'px') ||
2204
+ 'auto');
2205
+ }
2206
+ throttle(func, timeFrame) {
2207
+ let lastTime = 0;
2208
+ return function () {
2209
+ let now = Date.now();
2210
+ if (now - lastTime >= timeFrame) {
2211
+ func();
2212
+ lastTime = now;
2213
+ }
2214
+ };
2215
+ }
2216
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeViewportComponent, deps: [{ token: i0.ElementRef }, { token: TreeVirtualScroll }], target: i0.ɵɵFactoryTarget.Component }); }
2217
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeViewportComponent, selector: "tree-viewport", providers: [TreeVirtualScroll], ngImport: i0, template: `
2219
2218
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
2220
2219
  <div [style.height]="getTotalHeight()">
2221
2220
  <ng-content></ng-content>
2222
2221
  </div>
2223
2222
  </ng-container>
2224
- `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }] });
2225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeViewportComponent, decorators: [{
2226
- type: Component,
2223
+ `, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }] }); }
2224
+ }
2225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeViewportComponent, decorators: [{
2226
+ type: Component,
2227
2227
  args: [{ selector: 'tree-viewport', providers: [TreeVirtualScroll], template: `
2228
2228
  <ng-container *treeMobxAutorun="{ dontDetach: true }">
2229
2229
  <div [style.height]="getTotalHeight()">
2230
2230
  <ng-content></ng-content>
2231
2231
  </div>
2232
2232
  </ng-container>
2233
- ` }]
2234
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: TreeVirtualScroll }]; } });
2233
+ ` }]
2234
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: TreeVirtualScroll }] });
2235
2235
 
2236
- class TreeComponent {
2237
- constructor(treeModel, treeDraggedElement) {
2238
- this.treeModel = treeModel;
2239
- this.treeDraggedElement = treeDraggedElement;
2240
- treeModel.eventNames.forEach((name) => this[name] = new EventEmitter());
2241
- treeModel.subscribeToState((state) => this.stateChange.emit(state));
2242
- }
2243
- // Will be handled in ngOnChanges
2244
- set nodes(nodes) {
2245
- }
2246
- ;
2247
- set options(options) {
2248
- }
2249
- ;
2250
- set focused(value) {
2251
- this.treeModel.setFocus(value);
2252
- }
2253
- set state(state) {
2254
- this.treeModel.setState(state);
2255
- }
2256
- onKeydown($event) {
2257
- if (!this.treeModel.isFocused)
2258
- return;
2259
- if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase()))
2260
- return;
2261
- const focusedNode = this.treeModel.getFocusedNode();
2262
- this.treeModel.performKeyAction(focusedNode, $event);
2263
- }
2264
- onMousedown($event) {
2265
- function isOutsideClick(startElement, nodeName) {
2266
- return !startElement ? true : startElement.localName === nodeName ? false : isOutsideClick(startElement.parentElement, nodeName);
2267
- }
2268
- if (isOutsideClick($event.target, 'tree-root')) {
2269
- this.treeModel.setFocus(false);
2270
- }
2271
- }
2272
- ngOnChanges(changes) {
2273
- if (changes.options || changes.nodes) {
2274
- this.treeModel.setData({
2275
- options: changes.options && changes.options.currentValue,
2276
- nodes: changes.nodes && changes.nodes.currentValue,
2277
- events: this.pick(this, this.treeModel.eventNames)
2278
- });
2279
- }
2280
- }
2281
- sizeChanged() {
2282
- this.viewportComponent.setViewport();
2283
- }
2284
- pick(object, keys) {
2285
- return keys.reduce((obj, key) => {
2286
- if (object && object.hasOwnProperty(key)) {
2287
- obj[key] = object[key];
2288
- }
2289
- return obj;
2290
- }, {});
2291
- }
2292
- }
2293
- /** @nocollapse */ TreeComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeComponent, deps: [{ token: TreeModel }, { token: TreeDraggedElement }], target: i0.ɵɵFactoryTarget.Component });
2294
- /** @nocollapse */ TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TreeComponent, 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: `
2236
+ class TreeComponent {
2237
+ // Will be handled in ngOnChanges
2238
+ set nodes(nodes) {
2239
+ }
2240
+ ;
2241
+ set options(options) {
2242
+ }
2243
+ ;
2244
+ set focused(value) {
2245
+ this.treeModel.setFocus(value);
2246
+ }
2247
+ set state(state) {
2248
+ this.treeModel.setState(state);
2249
+ }
2250
+ constructor(treeModel, treeDraggedElement) {
2251
+ this.treeModel = treeModel;
2252
+ this.treeDraggedElement = treeDraggedElement;
2253
+ treeModel.eventNames.forEach((name) => this[name] = new EventEmitter());
2254
+ treeModel.subscribeToState((state) => this.stateChange.emit(state));
2255
+ }
2256
+ onKeydown($event) {
2257
+ if (!this.treeModel.isFocused)
2258
+ return;
2259
+ if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase()))
2260
+ return;
2261
+ const focusedNode = this.treeModel.getFocusedNode();
2262
+ this.treeModel.performKeyAction(focusedNode, $event);
2263
+ }
2264
+ onMousedown($event) {
2265
+ function isOutsideClick(startElement, nodeName) {
2266
+ return !startElement ? true : startElement.localName === nodeName ? false : isOutsideClick(startElement.parentElement, nodeName);
2267
+ }
2268
+ if (isOutsideClick($event.target, 'tree-root')) {
2269
+ this.treeModel.setFocus(false);
2270
+ }
2271
+ }
2272
+ ngOnChanges(changes) {
2273
+ if (changes.options || changes.nodes) {
2274
+ this.treeModel.setData({
2275
+ options: changes.options && changes.options.currentValue,
2276
+ nodes: changes.nodes && changes.nodes.currentValue,
2277
+ events: this.pick(this, this.treeModel.eventNames)
2278
+ });
2279
+ }
2280
+ }
2281
+ sizeChanged() {
2282
+ this.viewportComponent.setViewport();
2283
+ }
2284
+ pick(object, keys) {
2285
+ return keys.reduce((obj, key) => {
2286
+ if (object && object.hasOwnProperty(key)) {
2287
+ obj[key] = object[key];
2288
+ }
2289
+ return obj;
2290
+ }, {});
2291
+ }
2292
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeComponent, deps: [{ token: TreeModel }, { token: TreeDraggedElement }], target: i0.ɵɵFactoryTarget.Component }); }
2293
+ /** @nocollapse */ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: TreeComponent, 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: `
2295
2294
  <tree-viewport #viewport>
2296
2295
  <div
2297
2296
  class="angular-tree-component"
@@ -2316,9 +2315,10 @@ class TreeComponent {
2316
2315
  </tree-node-drop-slot>
2317
2316
  </div>
2318
2317
  </tree-viewport>
2319
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }, { kind: "component", type: TreeNodeCollectionComponent, selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: TreeViewportComponent, selector: "tree-viewport" }] });
2320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeComponent, decorators: [{
2321
- type: Component,
2318
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }, { kind: "component", type: TreeNodeCollectionComponent, selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: TreeViewportComponent, selector: "tree-viewport" }] }); }
2319
+ }
2320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeComponent, decorators: [{
2321
+ type: Component,
2322
2322
  args: [{ selector: 'Tree, tree-root', providers: [TreeModel], template: `
2323
2323
  <tree-viewport #viewport>
2324
2324
  <div
@@ -2344,153 +2344,153 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2344
2344
  </tree-node-drop-slot>
2345
2345
  </div>
2346
2346
  </tree-viewport>
2347
- ` }]
2348
- }], ctorParameters: function () { return [{ type: TreeModel }, { type: TreeDraggedElement }]; }, propDecorators: { loadingTemplate: [{
2349
- type: ContentChild,
2350
- args: ['loadingTemplate', { static: false }]
2351
- }], treeNodeTemplate: [{
2352
- type: ContentChild,
2353
- args: ['treeNodeTemplate', { static: false }]
2354
- }], treeNodeWrapperTemplate: [{
2355
- type: ContentChild,
2356
- args: ['treeNodeWrapperTemplate', { static: false }]
2357
- }], treeNodeFullTemplate: [{
2358
- type: ContentChild,
2359
- args: ['treeNodeFullTemplate', { static: false }]
2360
- }], viewportComponent: [{
2361
- type: ViewChild,
2362
- args: ['viewport', { static: false }]
2363
- }], nodes: [{
2364
- type: Input
2365
- }], options: [{
2366
- type: Input
2367
- }], focused: [{
2368
- type: Input
2369
- }], state: [{
2370
- type: Input
2371
- }], toggleExpanded: [{
2372
- type: Output
2373
- }], activate: [{
2374
- type: Output
2375
- }], deactivate: [{
2376
- type: Output
2377
- }], nodeActivate: [{
2378
- type: Output
2379
- }], nodeDeactivate: [{
2380
- type: Output
2381
- }], select: [{
2382
- type: Output
2383
- }], deselect: [{
2384
- type: Output
2385
- }], focus: [{
2386
- type: Output
2387
- }], blur: [{
2388
- type: Output
2389
- }], updateData: [{
2390
- type: Output
2391
- }], initialized: [{
2392
- type: Output
2393
- }], moveNode: [{
2394
- type: Output
2395
- }], copyNode: [{
2396
- type: Output
2397
- }], loadNodeChildren: [{
2398
- type: Output
2399
- }], changeFilter: [{
2400
- type: Output
2401
- }], event: [{
2402
- type: Output
2403
- }], stateChange: [{
2404
- type: Output
2405
- }], onKeydown: [{
2406
- type: HostListener,
2407
- args: ['body: keydown', ['$event']]
2408
- }], onMousedown: [{
2409
- type: HostListener,
2410
- args: ['body: mousedown', ['$event']]
2347
+ ` }]
2348
+ }], ctorParameters: () => [{ type: TreeModel }, { type: TreeDraggedElement }], propDecorators: { loadingTemplate: [{
2349
+ type: ContentChild,
2350
+ args: ['loadingTemplate', { static: false }]
2351
+ }], treeNodeTemplate: [{
2352
+ type: ContentChild,
2353
+ args: ['treeNodeTemplate', { static: false }]
2354
+ }], treeNodeWrapperTemplate: [{
2355
+ type: ContentChild,
2356
+ args: ['treeNodeWrapperTemplate', { static: false }]
2357
+ }], treeNodeFullTemplate: [{
2358
+ type: ContentChild,
2359
+ args: ['treeNodeFullTemplate', { static: false }]
2360
+ }], viewportComponent: [{
2361
+ type: ViewChild,
2362
+ args: ['viewport', { static: false }]
2363
+ }], nodes: [{
2364
+ type: Input
2365
+ }], options: [{
2366
+ type: Input
2367
+ }], focused: [{
2368
+ type: Input
2369
+ }], state: [{
2370
+ type: Input
2371
+ }], toggleExpanded: [{
2372
+ type: Output
2373
+ }], activate: [{
2374
+ type: Output
2375
+ }], deactivate: [{
2376
+ type: Output
2377
+ }], nodeActivate: [{
2378
+ type: Output
2379
+ }], nodeDeactivate: [{
2380
+ type: Output
2381
+ }], select: [{
2382
+ type: Output
2383
+ }], deselect: [{
2384
+ type: Output
2385
+ }], focus: [{
2386
+ type: Output
2387
+ }], blur: [{
2388
+ type: Output
2389
+ }], updateData: [{
2390
+ type: Output
2391
+ }], initialized: [{
2392
+ type: Output
2393
+ }], moveNode: [{
2394
+ type: Output
2395
+ }], copyNode: [{
2396
+ type: Output
2397
+ }], loadNodeChildren: [{
2398
+ type: Output
2399
+ }], changeFilter: [{
2400
+ type: Output
2401
+ }], event: [{
2402
+ type: Output
2403
+ }], stateChange: [{
2404
+ type: Output
2405
+ }], onKeydown: [{
2406
+ type: HostListener,
2407
+ args: ['body: keydown', ['$event']]
2408
+ }], onMousedown: [{
2409
+ type: HostListener,
2410
+ args: ['body: mousedown', ['$event']]
2411
2411
  }] } });
2412
2412
 
2413
- class TreeModule {
2414
- }
2415
- /** @nocollapse */ TreeModulefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2416
- /** @nocollapse */ TreeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: TreeModule, declarations: [TreeComponent,
2417
- TreeNodeComponent,
2418
- TreeNodeContent,
2419
- LoadingComponent,
2420
- TreeDropDirective,
2421
- TreeDragDirective,
2422
- TreeNodeExpanderComponent,
2423
- TreeNodeChildrenComponent,
2424
- TreeNodeDropSlot,
2425
- TreeNodeCollectionComponent,
2426
- TreeViewportComponent,
2427
- TreeNodeWrapperComponent,
2428
- TreeNodeCheckboxComponent,
2429
- TreeAnimateOpenDirective,
2430
- TreeMobxAutorunDirective], imports: [CommonModule], exports: [TreeComponent,
2431
- TreeNodeComponent,
2432
- TreeNodeContent,
2433
- LoadingComponent,
2434
- TreeDropDirective,
2435
- TreeDragDirective,
2436
- TreeNodeExpanderComponent,
2437
- TreeNodeChildrenComponent,
2438
- TreeNodeDropSlot,
2439
- TreeNodeCollectionComponent,
2440
- TreeViewportComponent,
2441
- TreeNodeWrapperComponent,
2442
- TreeNodeCheckboxComponent,
2443
- TreeAnimateOpenDirective,
2444
- TreeMobxAutorunDirective] });
2445
- /** @nocollapse */ TreeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeModule, imports: [CommonModule] });
2446
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeModule, decorators: [{
2447
- type: NgModule,
2448
- args: [{
2449
- declarations: [
2450
- TreeComponent,
2451
- TreeNodeComponent,
2452
- TreeNodeContent,
2453
- LoadingComponent,
2454
- TreeDropDirective,
2455
- TreeDragDirective,
2456
- TreeNodeExpanderComponent,
2457
- TreeNodeChildrenComponent,
2458
- TreeNodeDropSlot,
2459
- TreeNodeCollectionComponent,
2460
- TreeViewportComponent,
2461
- TreeNodeWrapperComponent,
2462
- TreeNodeCheckboxComponent,
2463
- TreeAnimateOpenDirective,
2464
- TreeMobxAutorunDirective
2465
- ],
2466
- exports: [
2467
- TreeComponent,
2468
- TreeNodeComponent,
2469
- TreeNodeContent,
2470
- LoadingComponent,
2471
- TreeDropDirective,
2472
- TreeDragDirective,
2473
- TreeNodeExpanderComponent,
2474
- TreeNodeChildrenComponent,
2475
- TreeNodeDropSlot,
2476
- TreeNodeCollectionComponent,
2477
- TreeViewportComponent,
2478
- TreeNodeWrapperComponent,
2479
- TreeNodeCheckboxComponent,
2480
- TreeAnimateOpenDirective,
2481
- TreeMobxAutorunDirective
2482
- ],
2483
- imports: [CommonModule],
2484
- providers: []
2485
- }]
2413
+ class TreeModule {
2414
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2415
+ /** @nocollapse */ static { thismod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: TreeModule, declarations: [TreeComponent,
2416
+ TreeNodeComponent,
2417
+ TreeNodeContent,
2418
+ LoadingComponent,
2419
+ TreeDropDirective,
2420
+ TreeDragDirective,
2421
+ TreeNodeExpanderComponent,
2422
+ TreeNodeChildrenComponent,
2423
+ TreeNodeDropSlot,
2424
+ TreeNodeCollectionComponent,
2425
+ TreeViewportComponent,
2426
+ TreeNodeWrapperComponent,
2427
+ TreeNodeCheckboxComponent,
2428
+ TreeAnimateOpenDirective,
2429
+ TreeMobxAutorunDirective], imports: [CommonModule], exports: [TreeComponent,
2430
+ TreeNodeComponent,
2431
+ TreeNodeContent,
2432
+ LoadingComponent,
2433
+ TreeDropDirective,
2434
+ TreeDragDirective,
2435
+ TreeNodeExpanderComponent,
2436
+ TreeNodeChildrenComponent,
2437
+ TreeNodeDropSlot,
2438
+ TreeNodeCollectionComponent,
2439
+ TreeViewportComponent,
2440
+ TreeNodeWrapperComponent,
2441
+ TreeNodeCheckboxComponent,
2442
+ TreeAnimateOpenDirective,
2443
+ TreeMobxAutorunDirective] }); }
2444
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeModule, imports: [CommonModule] }); }
2445
+ }
2446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: TreeModule, decorators: [{
2447
+ type: NgModule,
2448
+ args: [{
2449
+ declarations: [
2450
+ TreeComponent,
2451
+ TreeNodeComponent,
2452
+ TreeNodeContent,
2453
+ LoadingComponent,
2454
+ TreeDropDirective,
2455
+ TreeDragDirective,
2456
+ TreeNodeExpanderComponent,
2457
+ TreeNodeChildrenComponent,
2458
+ TreeNodeDropSlot,
2459
+ TreeNodeCollectionComponent,
2460
+ TreeViewportComponent,
2461
+ TreeNodeWrapperComponent,
2462
+ TreeNodeCheckboxComponent,
2463
+ TreeAnimateOpenDirective,
2464
+ TreeMobxAutorunDirective
2465
+ ],
2466
+ exports: [
2467
+ TreeComponent,
2468
+ TreeNodeComponent,
2469
+ TreeNodeContent,
2470
+ LoadingComponent,
2471
+ TreeDropDirective,
2472
+ TreeDragDirective,
2473
+ TreeNodeExpanderComponent,
2474
+ TreeNodeChildrenComponent,
2475
+ TreeNodeDropSlot,
2476
+ TreeNodeCollectionComponent,
2477
+ TreeViewportComponent,
2478
+ TreeNodeWrapperComponent,
2479
+ TreeNodeCheckboxComponent,
2480
+ TreeAnimateOpenDirective,
2481
+ TreeMobxAutorunDirective
2482
+ ],
2483
+ imports: [CommonModule],
2484
+ providers: []
2485
+ }]
2486
2486
  }] });
2487
2487
 
2488
- /*
2489
- * Public API Surface of angular-tree-component
2488
+ /*
2489
+ * Public API Surface of angular-tree-component
2490
2490
  */
2491
2491
 
2492
- /**
2493
- * Generated bundle index. Do not edit.
2492
+ /**
2493
+ * Generated bundle index. Do not edit.
2494
2494
  */
2495
2495
 
2496
2496
  export { KEYS, LoadingComponent, TREE_ACTIONS, TreeAnimateOpenDirective, TreeComponent, TreeDragDirective, TreeDraggedElement, TreeDropDirective, TreeMobxAutorunDirective, TreeModel, TreeModule, TreeNode, TreeNodeCheckboxComponent, TreeNodeChildrenComponent, TreeNodeCollectionComponent, TreeNodeComponent, TreeNodeContent, TreeNodeDropSlot, TreeNodeExpanderComponent, TreeNodeWrapperComponent, TreeViewportComponent, TreeVirtualScroll };