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