@stratusjs/angular 0.5.2 → 0.5.3
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/dist/angular.bundle.min.js +1 -1
- package/package.json +1 -1
- package/src/angular.modules.js +33 -18
- package/src/angular.modules.js.map +1 -1
- package/src/app.module.js +254 -181
- package/src/app.module.js.map +1 -1
- package/src/backend.service.js +87 -66
- package/src/backend.service.js.map +1 -1
- package/src/base/base.component.js +124 -101
- package/src/base/base.component.js.map +1 -1
- package/src/boot.js +55 -42
- package/src/boot.js.map +1 -1
- package/src/confirm-dialog/confirm-dialog.component.js +60 -41
- package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
- package/src/core/base.interface.js +9 -1
- package/src/core/base.interface.js.map +1 -1
- package/src/core/refresh.interface.js +9 -1
- package/src/core/refresh.interface.js.map +1 -1
- package/src/core/responsive.component.js +58 -40
- package/src/core/responsive.component.js.map +1 -1
- package/src/core/responsive.interface.js +9 -1
- package/src/core/responsive.interface.js.map +1 -1
- package/src/core/root.component.js +43 -24
- package/src/core/root.component.js.map +1 -1
- package/src/core/trigger.interface.js +9 -1
- package/src/core/trigger.interface.js.map +1 -1
- package/src/data/contact-meta.interface.js +9 -1
- package/src/data/contact-meta.interface.js.map +1 -1
- package/src/data/content.interface.js +9 -1
- package/src/data/content.interface.js.map +1 -1
- package/src/data/convoy.interface.js +9 -1
- package/src/data/convoy.interface.js.map +1 -1
- package/src/editor/citation-dialog.component.js +207 -174
- package/src/editor/citation-dialog.component.js.map +1 -1
- package/src/editor/code-mirror-bridge.js +74 -60
- package/src/editor/code-mirror-bridge.js.map +1 -1
- package/src/editor/code-mirror-bridge.min.js +1 -1
- package/src/editor/code-view-dialog.component.js +116 -87
- package/src/editor/code-view-dialog.component.js.map +1 -1
- package/src/editor/editor.component.js +961 -903
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/link-dialog.component.js +395 -356
- package/src/editor/link-dialog.component.js.map +1 -1
- package/src/editor/media-dialog.component.js +303 -270
- package/src/editor/media-dialog.component.js.map +1 -1
- package/src/froala/plugins/citationManager.js +191 -170
- package/src/froala/plugins/citationManager.js.map +1 -1
- package/src/froala/plugins/inputButton.js +138 -122
- package/src/froala/plugins/inputButton.js.map +1 -1
- package/src/froala/plugins/linkManager.js +104 -89
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/mediaManager.js +87 -72
- package/src/froala/plugins/mediaManager.js.map +1 -1
- package/src/froala/plugins/menuButton.js +86 -71
- package/src/froala/plugins/menuButton.js.map +1 -1
- package/src/main.js +33 -13
- package/src/main.js.map +1 -1
- package/src/material.js +194 -99
- package/src/material.js.map +1 -1
- package/src/media-selector/media-selector.component.js +441 -406
- package/src/media-selector/media-selector.component.js.map +1 -1
- package/src/polyfills.js +16 -3
- package/src/polyfills.js.map +1 -1
- package/src/quill-plugins/quill-break-blot.plugin.js +35 -19
- package/src/quill-plugins/quill-break-blot.plugin.js.map +1 -1
- package/src/quill-plugins/quill-html-edit.plugin.js +153 -140
- package/src/quill-plugins/quill-html-edit.plugin.js.map +1 -1
- package/src/quill-plugins/quill-image-format.plugin.js +47 -33
- package/src/quill-plugins/quill-image-format.plugin.js.map +1 -1
- package/src/quill-plugins/quill-input-button.plugin.js +95 -77
- package/src/quill-plugins/quill-input-button.plugin.js.map +1 -1
- package/src/selector/selector.component.js +276 -241
- package/src/selector/selector.component.js.map +1 -1
- package/src/test/test.directive.js +66 -49
- package/src/test/test.directive.js.map +1 -1
- package/src/tree/tree-dialog.component.js +231 -202
- package/src/tree/tree-dialog.component.js.map +1 -1
- package/src/tree/tree-node.component.js +282 -253
- package/src/tree/tree-node.component.js.map +1 -1
- package/src/tree/tree.component.js +561 -531
- package/src/tree/tree.component.js.map +1 -1
|
@@ -1,552 +1,582 @@
|
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.dropListMap = {};
|
|
64
|
-
this.expandedNodeSet = new Set();
|
|
65
|
-
this.dragging = false;
|
|
66
|
-
this.expandDelay = 1000;
|
|
67
|
-
this.dropData = null;
|
|
68
|
-
this.cdkDropListSortingDisabled = true;
|
|
69
|
-
this.dropDebug = false;
|
|
70
|
-
this.treeControl = new NestedTreeControl((node) => node.children || []);
|
|
71
|
-
}
|
|
72
|
-
ngOnInit() {
|
|
73
|
-
this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName)}_component_`);
|
|
74
|
-
Stratus.Instances[this.uid] = this;
|
|
75
|
-
this.hydrate(this.elementRef, this.sanitizer, ["title", "uid", "isInitialized", "isDestroyed", "isStyled", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "_", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "unsettled", "svgIcons", "isSingleClick", "dblClickWait", "dropLists", "dropListIdMap", "dropListMap", "expandedNodeSet", "dragging", "expandTimeout", "expandDelay", "dropData", "cdkDropListSortingDisabled", "dropDebug", "tree", "treeMap", "metaMap", "dataSource", "treeControl", "iconRegistry", "sanitizer", "backend", "ref", "elementRef", "document", "ngOnInit", "ngOnDestroy", "refresh", "remove", "removeNode", "nodeIsEqual", "fetchData", "dataDefer", "dataRef", "trackDropLists", "setExpanded", "setExpandedClick", "setExpandedDblClick", "onDragDrop", "onDragMove", "showDragData", "clearDragData", "buildNodePatch", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading"]);
|
|
76
|
-
Stratus.Internals.CssLoader(`${localDir}/${moduleName}/${moduleName}.component${min}.css`)
|
|
77
|
-
.then(() => {
|
|
78
|
-
this.isStyled = true;
|
|
79
|
-
this.refresh();
|
|
80
|
-
})
|
|
81
|
-
.catch((err) => {
|
|
82
|
-
console.warn('Issue detected in CSS Loader for Component:', this);
|
|
83
|
-
console.error(err);
|
|
84
|
-
this.isStyled = true;
|
|
85
|
-
this.refresh();
|
|
86
|
-
});
|
|
87
|
-
_.forEach({
|
|
88
|
-
tree_check: `${Stratus.BaseUrl}sitetheorycore/images/icons/check.svg`,
|
|
89
|
-
tree_add: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/add.svg`,
|
|
90
|
-
tree_delete: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,
|
|
91
|
-
tree_edit: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`,
|
|
92
|
-
tree_visibility: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/visibility.svg`,
|
|
93
|
-
}, (value, key) => this.iconRegistry.addSvgIcon(key, this.sanitizer.bypassSecurityTrustResourceUrl(value)).getNamedSvgIcon(key));
|
|
94
|
-
this.fetchData()
|
|
95
|
-
.then(data => {
|
|
96
|
-
if (!data || !(data instanceof EventManager)) {
|
|
97
|
-
console.warn('Unable to bind data from Registry!');
|
|
98
|
-
return;
|
|
1
|
+
System.register(["@angular/core", "@angular/cdk/drag-drop", "@angular/cdk/tree", "@angular/platform-browser", "@angular/material/icon", "rxjs", "@stratusjs/runtime/stratus", "lodash", "@agentepsilon/decko", "../core/root.component", "../backend.service", "@stratusjs/angularjs/services/registry", "@stratusjs/core/environment", "@stratusjs/core/events/eventManager", "@angular/common"], function (exports_1, context_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8
|
+
};
|
|
9
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11
|
+
};
|
|
12
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
13
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
14
|
+
};
|
|
15
|
+
var core_1, drag_drop_1, tree_1, platform_browser_1, icon_1, rxjs_1, stratus_1, lodash_1, decko_1, root_component_1, backend_service_1, registry_1, environment_1, eventManager_1, common_1, systemDir, moduleName, min, localDir, TreeComponent;
|
|
16
|
+
var __moduleName = context_1 && context_1.id;
|
|
17
|
+
return {
|
|
18
|
+
setters: [
|
|
19
|
+
function (core_1_1) {
|
|
20
|
+
core_1 = core_1_1;
|
|
21
|
+
},
|
|
22
|
+
function (drag_drop_1_1) {
|
|
23
|
+
drag_drop_1 = drag_drop_1_1;
|
|
24
|
+
},
|
|
25
|
+
function (tree_1_1) {
|
|
26
|
+
tree_1 = tree_1_1;
|
|
27
|
+
},
|
|
28
|
+
function (platform_browser_1_1) {
|
|
29
|
+
platform_browser_1 = platform_browser_1_1;
|
|
30
|
+
},
|
|
31
|
+
function (icon_1_1) {
|
|
32
|
+
icon_1 = icon_1_1;
|
|
33
|
+
},
|
|
34
|
+
function (rxjs_1_1) {
|
|
35
|
+
rxjs_1 = rxjs_1_1;
|
|
36
|
+
},
|
|
37
|
+
function (stratus_1_1) {
|
|
38
|
+
stratus_1 = stratus_1_1;
|
|
39
|
+
},
|
|
40
|
+
function (lodash_1_1) {
|
|
41
|
+
lodash_1 = lodash_1_1;
|
|
42
|
+
},
|
|
43
|
+
function (decko_1_1) {
|
|
44
|
+
decko_1 = decko_1_1;
|
|
45
|
+
},
|
|
46
|
+
function (root_component_1_1) {
|
|
47
|
+
root_component_1 = root_component_1_1;
|
|
48
|
+
},
|
|
49
|
+
function (backend_service_1_1) {
|
|
50
|
+
backend_service_1 = backend_service_1_1;
|
|
51
|
+
},
|
|
52
|
+
function (registry_1_1) {
|
|
53
|
+
registry_1 = registry_1_1;
|
|
54
|
+
},
|
|
55
|
+
function (environment_1_1) {
|
|
56
|
+
environment_1 = environment_1_1;
|
|
57
|
+
},
|
|
58
|
+
function (eventManager_1_1) {
|
|
59
|
+
eventManager_1 = eventManager_1_1;
|
|
60
|
+
},
|
|
61
|
+
function (common_1_1) {
|
|
62
|
+
common_1 = common_1_1;
|
|
99
63
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
64
|
+
],
|
|
65
|
+
execute: function () {
|
|
66
|
+
systemDir = '@stratusjs/angular';
|
|
67
|
+
moduleName = 'tree';
|
|
68
|
+
min = !environment_1.cookie('env') ? '.min' : '';
|
|
69
|
+
localDir = `${stratus_1.Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
|
|
70
|
+
TreeComponent = class TreeComponent extends root_component_1.RootComponent {
|
|
71
|
+
constructor(iconRegistry, sanitizer, backend, ref, elementRef, document) {
|
|
72
|
+
super();
|
|
73
|
+
this.iconRegistry = iconRegistry;
|
|
74
|
+
this.sanitizer = sanitizer;
|
|
75
|
+
this.backend = backend;
|
|
76
|
+
this.ref = ref;
|
|
77
|
+
this.elementRef = elementRef;
|
|
78
|
+
this.document = document;
|
|
79
|
+
this.title = moduleName + '_component';
|
|
80
|
+
this.isInitialized = false;
|
|
81
|
+
this.isDestroyed = false;
|
|
82
|
+
this.isStyled = false;
|
|
83
|
+
this._ = lodash_1.default;
|
|
84
|
+
this.Stratus = stratus_1.Stratus;
|
|
85
|
+
this.registry = new registry_1.Registry();
|
|
86
|
+
this.onChange = new rxjs_1.Subject();
|
|
87
|
+
this.unsettled = false;
|
|
88
|
+
this.svgIcons = {};
|
|
89
|
+
this.dblClickWait = 500;
|
|
90
|
+
this.dropLists = [];
|
|
91
|
+
this.dropListIdMap = {};
|
|
92
|
+
this.dropListMap = {};
|
|
93
|
+
this.expandedNodeSet = new Set();
|
|
94
|
+
this.dragging = false;
|
|
95
|
+
this.expandDelay = 1000;
|
|
96
|
+
this.dropData = null;
|
|
97
|
+
this.cdkDropListSortingDisabled = true;
|
|
98
|
+
this.dropDebug = false;
|
|
99
|
+
this.treeControl = new tree_1.NestedTreeControl((node) => node.children || []);
|
|
103
100
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
ngOnInit() {
|
|
102
|
+
this.uid = lodash_1.default.uniqueId(`sa_${lodash_1.default.snakeCase(moduleName)}_component_`);
|
|
103
|
+
stratus_1.Stratus.Instances[this.uid] = this;
|
|
104
|
+
this.hydrate(this.elementRef, this.sanitizer, ["title", "uid", "isInitialized", "isDestroyed", "isStyled", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "_", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "unsettled", "svgIcons", "isSingleClick", "dblClickWait", "dropLists", "dropListIdMap", "dropListMap", "expandedNodeSet", "dragging", "expandTimeout", "expandDelay", "dropData", "cdkDropListSortingDisabled", "dropDebug", "tree", "treeMap", "metaMap", "dataSource", "treeControl", "iconRegistry", "sanitizer", "backend", "ref", "elementRef", "document", "ngOnInit", "ngOnDestroy", "refresh", "remove", "removeNode", "nodeIsEqual", "fetchData", "dataDefer", "dataRef", "trackDropLists", "setExpanded", "setExpandedClick", "setExpandedDblClick", "onDragDrop", "onDragMove", "showDragData", "clearDragData", "buildNodePatch", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading"]);
|
|
105
|
+
stratus_1.Stratus.Internals.CssLoader(`${localDir}/${moduleName}/${moduleName}.component${min}.css`)
|
|
106
|
+
.then(() => {
|
|
107
|
+
this.isStyled = true;
|
|
108
|
+
this.refresh();
|
|
109
|
+
})
|
|
110
|
+
.catch((err) => {
|
|
111
|
+
console.warn('Issue detected in CSS Loader for Component:', this);
|
|
112
|
+
console.error(err);
|
|
113
|
+
this.isStyled = true;
|
|
114
|
+
this.refresh();
|
|
115
|
+
});
|
|
116
|
+
lodash_1.default.forEach({
|
|
117
|
+
tree_check: `${stratus_1.Stratus.BaseUrl}sitetheorycore/images/icons/check.svg`,
|
|
118
|
+
tree_add: `${stratus_1.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/add.svg`,
|
|
119
|
+
tree_delete: `${stratus_1.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,
|
|
120
|
+
tree_edit: `${stratus_1.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`,
|
|
121
|
+
tree_visibility: `${stratus_1.Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/visibility.svg`,
|
|
122
|
+
}, (value, key) => this.iconRegistry.addSvgIcon(key, this.sanitizer.bypassSecurityTrustResourceUrl(value)).getNamedSvgIcon(key));
|
|
123
|
+
this.fetchData()
|
|
124
|
+
.then(data => {
|
|
125
|
+
if (!data || !(data instanceof eventManager_1.EventManager)) {
|
|
126
|
+
console.warn('Unable to bind data from Registry!');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const onDataChange = () => {
|
|
130
|
+
if (this.unsettled || !data.completed) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this.dataDefer(this.subscriber);
|
|
134
|
+
this.refresh();
|
|
135
|
+
};
|
|
136
|
+
data.on('change', onDataChange);
|
|
137
|
+
onDataChange();
|
|
138
|
+
data.on('add', (event, model) => {
|
|
139
|
+
let modelCompleted = false;
|
|
140
|
+
const onModelChange = () => {
|
|
141
|
+
if (!model.completed) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (modelCompleted) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
modelCompleted = true;
|
|
148
|
+
if (!(model.getIdentifier() in this.treeMap)) {
|
|
149
|
+
model.meta.set('postPersist', true);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const node = this.treeMap[model.getIdentifier()];
|
|
153
|
+
if (!node.meta.component || !('openDialog' in node.meta.component)) {
|
|
154
|
+
model.meta.set('postPersist', true);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
node.meta.component.openDialog();
|
|
158
|
+
};
|
|
159
|
+
model.on('change', onModelChange);
|
|
160
|
+
onModelChange();
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
this.dataSub = new rxjs_1.Observable((subscriber) => this.dataDefer(subscriber));
|
|
164
|
+
this.dropListIdMap[`${this.uid}_parent_drop_list`] = true;
|
|
165
|
+
this.trackDropLists();
|
|
166
|
+
this.isInitialized = true;
|
|
167
|
+
this.refresh();
|
|
168
|
+
}
|
|
169
|
+
ngOnDestroy() {
|
|
170
|
+
this.isDestroyed = true;
|
|
171
|
+
}
|
|
172
|
+
refresh() {
|
|
173
|
+
if (this.isDestroyed) {
|
|
174
|
+
return new Promise(resolve => resolve());
|
|
175
|
+
}
|
|
176
|
+
lodash_1.default.forEach(this.metaMap, (meta) => {
|
|
177
|
+
if (!meta.component || !('refresh' in meta.component)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
meta.component.refresh();
|
|
181
|
+
});
|
|
182
|
+
return super.refresh();
|
|
183
|
+
}
|
|
184
|
+
remove(model) {
|
|
185
|
+
}
|
|
186
|
+
removeNode(list, node) {
|
|
187
|
+
const index = list.indexOf(node);
|
|
188
|
+
if (index === -1) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
list.splice(index, 1);
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
nodeIsEqual(node, other) {
|
|
195
|
+
if (!node || !other) {
|
|
196
|
+
return node === other;
|
|
197
|
+
}
|
|
198
|
+
return node.id === other.id;
|
|
199
|
+
}
|
|
200
|
+
async fetchData() {
|
|
201
|
+
if (this.fetched) {
|
|
202
|
+
return this.fetched;
|
|
203
|
+
}
|
|
204
|
+
return this.fetched = this.registry.fetch(stratus_1.Stratus.Select(this.elementRef.nativeElement), this);
|
|
205
|
+
}
|
|
206
|
+
dataDefer(subscriber) {
|
|
207
|
+
this.subscriber = this.subscriber || subscriber;
|
|
208
|
+
if (!this.subscriber || !this.collection || !this.collection.completed) {
|
|
209
|
+
setTimeout(() => {
|
|
210
|
+
this.dataDefer(subscriber);
|
|
211
|
+
}, 500);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const tree = this.dataRef(true);
|
|
215
|
+
if (tree && tree.length) {
|
|
216
|
+
subscriber.next(tree);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
setTimeout(() => this.dataDefer(subscriber), 200);
|
|
220
|
+
}
|
|
221
|
+
dataRef(force = false) {
|
|
222
|
+
if (!this.collection) {
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
225
|
+
if (!force && this.tree && this.tree.length > 0) {
|
|
226
|
+
return this.tree;
|
|
227
|
+
}
|
|
228
|
+
let models = this.collection.models;
|
|
229
|
+
if (!models || !lodash_1.default.isArray(models) || !models.length) {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
models = lodash_1.default.sortBy(models, ['data.priority']);
|
|
233
|
+
this.metaMap = this.metaMap || {};
|
|
234
|
+
this.treeMap = {};
|
|
235
|
+
this.tree = [];
|
|
236
|
+
lodash_1.default.forEach(models, (model) => {
|
|
237
|
+
const modelId = lodash_1.default.get(model, 'data.id');
|
|
238
|
+
const parentId = lodash_1.default.get(model, 'data.nestParent.id');
|
|
239
|
+
this.dropListIdMap[`${this.uid}_node_${modelId}_drop_list`] = true;
|
|
240
|
+
if (!lodash_1.default.has(this.metaMap, modelId)) {
|
|
241
|
+
this.metaMap[modelId] = {
|
|
242
|
+
id: modelId,
|
|
243
|
+
expanded: true
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
if (!lodash_1.default.has(this.treeMap, modelId)) {
|
|
247
|
+
this.treeMap[modelId] = {
|
|
248
|
+
id: modelId,
|
|
249
|
+
model,
|
|
250
|
+
children: [],
|
|
251
|
+
meta: this.metaMap[modelId]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
this.treeMap[modelId].model = model;
|
|
255
|
+
this.treeMap[modelId].meta = this.metaMap[modelId];
|
|
256
|
+
if (parentId) {
|
|
257
|
+
if (!lodash_1.default.has(this.treeMap, parentId)) {
|
|
258
|
+
this.treeMap[parentId] = {
|
|
259
|
+
id: parentId,
|
|
260
|
+
model: null,
|
|
261
|
+
children: [],
|
|
262
|
+
meta: null
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
this.treeMap[parentId].children.push(this.treeMap[modelId]);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this.tree.push(this.treeMap[modelId]);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
this.trackDropLists();
|
|
272
|
+
return this.tree;
|
|
273
|
+
}
|
|
274
|
+
trackDropLists() {
|
|
275
|
+
this.dropLists = [];
|
|
276
|
+
lodash_1.default.forEach(this.dropListIdMap, (value, key) => {
|
|
277
|
+
if (!value) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const cached = key in this.dropListMap;
|
|
281
|
+
const element = cached ? this.dropListMap[key] : document.getElementById(key);
|
|
282
|
+
if (!element) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
this.dropLists.push(key);
|
|
286
|
+
if (cached) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
this.dropListMap[key] = element;
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
setExpanded(expanded) {
|
|
293
|
+
if (!this.metaMap || !lodash_1.default.size(this.metaMap)) {
|
|
113
294
|
return;
|
|
114
295
|
}
|
|
115
|
-
|
|
296
|
+
lodash_1.default.forEach(this.metaMap, (nodeMeta) => {
|
|
297
|
+
nodeMeta.expanded = expanded;
|
|
298
|
+
});
|
|
299
|
+
this.refresh();
|
|
300
|
+
}
|
|
301
|
+
setExpandedClick(expanded) {
|
|
302
|
+
this.isSingleClick = true;
|
|
303
|
+
setTimeout(() => {
|
|
304
|
+
if (!this.isSingleClick) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
this.setExpanded(expanded);
|
|
308
|
+
}, this.dblClickWait);
|
|
309
|
+
}
|
|
310
|
+
setExpandedDblClick(expanded) {
|
|
311
|
+
this.isSingleClick = false;
|
|
312
|
+
this.setExpanded(expanded);
|
|
313
|
+
}
|
|
314
|
+
onDragDrop(event) {
|
|
315
|
+
if (!event.isPointerOverContainer) {
|
|
116
316
|
return;
|
|
117
317
|
}
|
|
118
|
-
|
|
119
|
-
if (!
|
|
120
|
-
model.meta.set('postPersist', true);
|
|
318
|
+
const targetNode = event.item.data;
|
|
319
|
+
if (!targetNode) {
|
|
121
320
|
return;
|
|
122
321
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
322
|
+
let parentNode = event.container.data;
|
|
323
|
+
const pastParentNode = event.previousContainer.data;
|
|
324
|
+
const tree = parentNode ? parentNode.children : this.dataRef();
|
|
325
|
+
if (!tree) {
|
|
126
326
|
return;
|
|
127
327
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
model
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
328
|
+
this.unsettled = true;
|
|
329
|
+
const targetDropNode = (this.dropData.targetId && this.dropData.targetId in this.treeMap) ?
|
|
330
|
+
this.treeMap[lodash_1.default.toNumber(this.dropData.targetId)] : null;
|
|
331
|
+
if (environment_1.cookie('env') && this.dropDebug) {
|
|
332
|
+
console.group('onDragDrop()');
|
|
333
|
+
lodash_1.default.forEach([
|
|
334
|
+
`model drop: ${targetNode.model.get('name')}`,
|
|
335
|
+
`list shift: ${event.container.element.nativeElement.id} -> ${event.previousContainer.element.nativeElement.id}`,
|
|
336
|
+
`index change (event): ${event.previousIndex} -> ${event.currentIndex}`,
|
|
337
|
+
`current priority: ${targetNode.model.get('priority')}`,
|
|
338
|
+
`target drop action: ${this.dropData.action}`,
|
|
339
|
+
], (message) => console.log(message));
|
|
340
|
+
}
|
|
341
|
+
if (targetDropNode && !this.nodeIsEqual(parentNode, targetDropNode)) {
|
|
342
|
+
if (environment_1.cookie('env') && this.dropDebug) {
|
|
343
|
+
console.log(`target drop node differs: ${targetDropNode.id} -> ${targetDropNode.model.get('name')}`);
|
|
344
|
+
console.log('target drop node is the same as target node:', targetNode.id === targetDropNode.id);
|
|
345
|
+
}
|
|
346
|
+
if (targetNode.id !== targetDropNode.id) {
|
|
347
|
+
switch (this.dropData.action) {
|
|
348
|
+
case 'before':
|
|
349
|
+
case 'after':
|
|
350
|
+
const nestParentId = targetDropNode.model.get('nestParent.id');
|
|
351
|
+
const nestParent = (nestParentId && nestParentId in this.treeMap) ? this.treeMap[nestParentId] : null;
|
|
352
|
+
parentNode = nestParent;
|
|
353
|
+
break;
|
|
354
|
+
case 'inside':
|
|
355
|
+
parentNode = targetDropNode;
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (environment_1.cookie('env') && this.dropDebug) {
|
|
360
|
+
console.log('target drop node selected:', parentNode ? `${parentNode.id} -> ${parentNode.model.get('name')}` : 'none');
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (!this.nodeIsEqual(parentNode, pastParentNode)) {
|
|
364
|
+
if (parentNode) {
|
|
365
|
+
switch (this.dropData.action) {
|
|
366
|
+
case 'before':
|
|
367
|
+
case 'after':
|
|
368
|
+
let targetIndex = parentNode.children.findIndex((n) => n.id === targetNode.id);
|
|
369
|
+
if (this.dropData.action === 'after') {
|
|
370
|
+
targetIndex++;
|
|
371
|
+
}
|
|
372
|
+
parentNode.children.splice(targetIndex, 0, targetNode);
|
|
373
|
+
break;
|
|
374
|
+
case 'inside':
|
|
375
|
+
parentNode.children.push(targetNode);
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
parentNode.meta.expanded = true;
|
|
379
|
+
}
|
|
380
|
+
if (pastParentNode) {
|
|
381
|
+
this.removeNode(pastParentNode.children, targetNode);
|
|
382
|
+
}
|
|
383
|
+
targetNode.model.set('nestParent', this.buildNodePatch(parentNode));
|
|
384
|
+
if (environment_1.cookie('env') && this.dropDebug) {
|
|
385
|
+
console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const branch = parentNode ? parentNode.children : tree;
|
|
389
|
+
let targetDropIndex = event.currentIndex;
|
|
390
|
+
if (this.cdkDropListSortingDisabled) {
|
|
391
|
+
targetDropIndex = null;
|
|
392
|
+
switch (this.dropData.action) {
|
|
393
|
+
case 'before':
|
|
394
|
+
case 'after':
|
|
395
|
+
targetDropIndex = branch.findIndex((n) => n.id === targetDropNode.id);
|
|
396
|
+
if (this.dropData.action === 'after') {
|
|
397
|
+
targetDropIndex++;
|
|
398
|
+
}
|
|
399
|
+
if (environment_1.cookie('env') && this.dropDebug) {
|
|
400
|
+
console.log('index change (drop node):', `${event.previousIndex} -> ${targetDropIndex}`);
|
|
401
|
+
}
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (lodash_1.default.isNumber(targetDropIndex)) {
|
|
406
|
+
drag_drop_1.moveItemInArray(branch, event.previousIndex, targetDropIndex);
|
|
407
|
+
let priority = 0;
|
|
408
|
+
lodash_1.default.forEach(branch, (node) => {
|
|
409
|
+
if (!node.model || !node.model.set) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
node.model.set('priority', priority++);
|
|
413
|
+
});
|
|
414
|
+
if (environment_1.cookie('env') && this.dropDebug) {
|
|
415
|
+
console.log('new priority:', targetNode.model.get('priority'));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (environment_1.cookie('env') && this.dropDebug) {
|
|
419
|
+
console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`);
|
|
420
|
+
console.groupEnd();
|
|
421
|
+
}
|
|
422
|
+
targetNode.model.save();
|
|
423
|
+
this.unsettled = false;
|
|
424
|
+
}
|
|
425
|
+
onDragMove(event) {
|
|
426
|
+
const e = this.document.elementFromPoint(event.pointerPosition.x, event.pointerPosition.y);
|
|
427
|
+
if (!e) {
|
|
428
|
+
this.clearDragData();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const containerClass = 'tree-node-content';
|
|
432
|
+
const container = e.classList.contains(containerClass) ? e : e.closest(`.${containerClass}`);
|
|
433
|
+
if (!container) {
|
|
434
|
+
this.clearDragData();
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
this.dropData = {
|
|
438
|
+
targetId: container.getAttribute('data-id')
|
|
236
439
|
};
|
|
440
|
+
const targetRect = container.getBoundingClientRect();
|
|
441
|
+
const oneThird = targetRect.height / 3;
|
|
442
|
+
if (event.pointerPosition.y - targetRect.top < oneThird) {
|
|
443
|
+
this.dropData.action = 'before';
|
|
444
|
+
}
|
|
445
|
+
else if (event.pointerPosition.y - targetRect.top > 2 * oneThird) {
|
|
446
|
+
this.dropData.action = 'after';
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
this.dropData.action = 'inside';
|
|
450
|
+
}
|
|
451
|
+
this.showDragData();
|
|
237
452
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.trackDropLists();
|
|
245
|
-
return this.tree;
|
|
246
|
-
}
|
|
247
|
-
trackDropLists() {
|
|
248
|
-
this.dropLists = [];
|
|
249
|
-
_.forEach(this.dropListIdMap, (value, key) => {
|
|
250
|
-
if (!value) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const cached = key in this.dropListMap;
|
|
254
|
-
const element = cached ? this.dropListMap[key] : document.getElementById(key);
|
|
255
|
-
if (!element) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
this.dropLists.push(key);
|
|
259
|
-
if (cached) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
this.dropListMap[key] = element;
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
setExpanded(expanded) {
|
|
266
|
-
if (!this.metaMap || !_.size(this.metaMap)) {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
_.forEach(this.metaMap, (nodeMeta) => {
|
|
270
|
-
nodeMeta.expanded = expanded;
|
|
271
|
-
});
|
|
272
|
-
this.refresh();
|
|
273
|
-
}
|
|
274
|
-
setExpandedClick(expanded) {
|
|
275
|
-
this.isSingleClick = true;
|
|
276
|
-
setTimeout(() => {
|
|
277
|
-
if (!this.isSingleClick) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
this.setExpanded(expanded);
|
|
281
|
-
}, this.dblClickWait);
|
|
282
|
-
}
|
|
283
|
-
setExpandedDblClick(expanded) {
|
|
284
|
-
this.isSingleClick = false;
|
|
285
|
-
this.setExpanded(expanded);
|
|
286
|
-
}
|
|
287
|
-
onDragDrop(event) {
|
|
288
|
-
if (!event.isPointerOverContainer) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
const targetNode = event.item.data;
|
|
292
|
-
if (!targetNode) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
let parentNode = event.container.data;
|
|
296
|
-
const pastParentNode = event.previousContainer.data;
|
|
297
|
-
const tree = parentNode ? parentNode.children : this.dataRef();
|
|
298
|
-
if (!tree) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
this.unsettled = true;
|
|
302
|
-
const targetDropNode = (this.dropData.targetId && this.dropData.targetId in this.treeMap) ?
|
|
303
|
-
this.treeMap[_.toNumber(this.dropData.targetId)] : null;
|
|
304
|
-
if (cookie('env') && this.dropDebug) {
|
|
305
|
-
console.group('onDragDrop()');
|
|
306
|
-
_.forEach([
|
|
307
|
-
`model drop: ${targetNode.model.get('name')}`,
|
|
308
|
-
`list shift: ${event.container.element.nativeElement.id} -> ${event.previousContainer.element.nativeElement.id}`,
|
|
309
|
-
`index change (event): ${event.previousIndex} -> ${event.currentIndex}`,
|
|
310
|
-
`current priority: ${targetNode.model.get('priority')}`,
|
|
311
|
-
`target drop action: ${this.dropData.action}`,
|
|
312
|
-
], (message) => console.log(message));
|
|
313
|
-
}
|
|
314
|
-
if (targetDropNode && !this.nodeIsEqual(parentNode, targetDropNode)) {
|
|
315
|
-
if (cookie('env') && this.dropDebug) {
|
|
316
|
-
console.log(`target drop node differs: ${targetDropNode.id} -> ${targetDropNode.model.get('name')}`);
|
|
317
|
-
console.log('target drop node is the same as target node:', targetNode.id === targetDropNode.id);
|
|
318
|
-
}
|
|
319
|
-
if (targetNode.id !== targetDropNode.id) {
|
|
320
|
-
switch (this.dropData.action) {
|
|
321
|
-
case 'before':
|
|
322
|
-
case 'after':
|
|
323
|
-
const nestParentId = targetDropNode.model.get('nestParent.id');
|
|
324
|
-
const nestParent = (nestParentId && nestParentId in this.treeMap) ? this.treeMap[nestParentId] : null;
|
|
325
|
-
parentNode = nestParent;
|
|
326
|
-
break;
|
|
327
|
-
case 'inside':
|
|
328
|
-
parentNode = targetDropNode;
|
|
329
|
-
break;
|
|
453
|
+
showDragData() {
|
|
454
|
+
this.clearDragData();
|
|
455
|
+
if (!this.dropData) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
this.document.getElementById(`node-${this.dropData.targetId}`).classList.add(`drop-${this.dropData.action}`);
|
|
330
459
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
460
|
+
clearDragData(dropped = false) {
|
|
461
|
+
if (dropped) {
|
|
462
|
+
this.dropData = null;
|
|
463
|
+
}
|
|
464
|
+
this.document
|
|
465
|
+
.querySelectorAll('.drop-before')
|
|
466
|
+
.forEach(element => element.classList.remove('drop-before'));
|
|
467
|
+
this.document
|
|
468
|
+
.querySelectorAll('.drop-after')
|
|
469
|
+
.forEach(element => element.classList.remove('drop-after'));
|
|
470
|
+
this.document
|
|
471
|
+
.querySelectorAll('.drop-inside')
|
|
472
|
+
.forEach(element => element.classList.remove('drop-inside'));
|
|
473
|
+
}
|
|
474
|
+
buildNodePatch(node = null) {
|
|
475
|
+
if (!node || !node.model) {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
const nodePatch = {};
|
|
479
|
+
lodash_1.default.forEach([
|
|
480
|
+
'id',
|
|
481
|
+
'name'
|
|
482
|
+
], (key) => {
|
|
483
|
+
const value = node.model.get(key);
|
|
484
|
+
if (!value) {
|
|
485
|
+
return;
|
|
344
486
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
parentNode.children.push(targetNode);
|
|
349
|
-
break;
|
|
487
|
+
lodash_1.default.set(nodePatch, key, value);
|
|
488
|
+
});
|
|
489
|
+
return nodePatch;
|
|
350
490
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (this.dropData.action === 'after') {
|
|
370
|
-
targetDropIndex++;
|
|
491
|
+
getSvg(url, options) {
|
|
492
|
+
const uid = this.addSvgIcon(url, options);
|
|
493
|
+
return new rxjs_1.Observable((subscriber) => {
|
|
494
|
+
this.iconRegistry
|
|
495
|
+
.getNamedSvgIcon(uid)
|
|
496
|
+
.subscribe({
|
|
497
|
+
error(err) {
|
|
498
|
+
console.error(`getSvg(${url}): ${err}`);
|
|
499
|
+
},
|
|
500
|
+
complete() {
|
|
501
|
+
subscriber.next(uid);
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
addSvgIcon(url, options) {
|
|
507
|
+
if (url in this.svgIcons) {
|
|
508
|
+
return this.svgIcons[url];
|
|
371
509
|
}
|
|
372
|
-
if (
|
|
373
|
-
|
|
510
|
+
if (!options) {
|
|
511
|
+
options = {};
|
|
374
512
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (_.isNumber(targetDropIndex)) {
|
|
379
|
-
moveItemInArray(branch, event.previousIndex, targetDropIndex);
|
|
380
|
-
let priority = 0;
|
|
381
|
-
_.forEach(branch, (node) => {
|
|
382
|
-
if (!node.model || !node.model.set) {
|
|
383
|
-
return;
|
|
513
|
+
const uid = this.svgIcons[url] = lodash_1.default.uniqueId('selector_svg');
|
|
514
|
+
this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options);
|
|
515
|
+
return uid;
|
|
384
516
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
buildNodePatch(node = null) {
|
|
448
|
-
if (!node || !node.model) {
|
|
449
|
-
return null;
|
|
450
|
-
}
|
|
451
|
-
const nodePatch = {};
|
|
452
|
-
_.forEach([
|
|
453
|
-
'id',
|
|
454
|
-
'name'
|
|
455
|
-
], (key) => {
|
|
456
|
-
const value = node.model.get(key);
|
|
457
|
-
if (!value) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
_.set(nodePatch, key, value);
|
|
461
|
-
});
|
|
462
|
-
return nodePatch;
|
|
463
|
-
}
|
|
464
|
-
getSvg(url, options) {
|
|
465
|
-
const uid = this.addSvgIcon(url, options);
|
|
466
|
-
return new Observable((subscriber) => {
|
|
467
|
-
this.iconRegistry
|
|
468
|
-
.getNamedSvgIcon(uid)
|
|
469
|
-
.subscribe({
|
|
470
|
-
error(err) {
|
|
471
|
-
console.error(`getSvg(${url}): ${err}`);
|
|
472
|
-
},
|
|
473
|
-
complete() {
|
|
474
|
-
subscriber.next(uid);
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
addSvgIcon(url, options) {
|
|
480
|
-
if (url in this.svgIcons) {
|
|
481
|
-
return this.svgIcons[url];
|
|
482
|
-
}
|
|
483
|
-
if (!options) {
|
|
484
|
-
options = {};
|
|
517
|
+
};
|
|
518
|
+
__decorate([
|
|
519
|
+
core_1.Input(),
|
|
520
|
+
__metadata("design:type", String)
|
|
521
|
+
], TreeComponent.prototype, "target", void 0);
|
|
522
|
+
__decorate([
|
|
523
|
+
core_1.Input(),
|
|
524
|
+
__metadata("design:type", String)
|
|
525
|
+
], TreeComponent.prototype, "targetSuffix", void 0);
|
|
526
|
+
__decorate([
|
|
527
|
+
core_1.Input(),
|
|
528
|
+
__metadata("design:type", Number)
|
|
529
|
+
], TreeComponent.prototype, "id", void 0);
|
|
530
|
+
__decorate([
|
|
531
|
+
core_1.Input(),
|
|
532
|
+
__metadata("design:type", Boolean)
|
|
533
|
+
], TreeComponent.prototype, "manifest", void 0);
|
|
534
|
+
__decorate([
|
|
535
|
+
core_1.Input(),
|
|
536
|
+
__metadata("design:type", Boolean)
|
|
537
|
+
], TreeComponent.prototype, "decouple", void 0);
|
|
538
|
+
__decorate([
|
|
539
|
+
core_1.Input(),
|
|
540
|
+
__metadata("design:type", Boolean)
|
|
541
|
+
], TreeComponent.prototype, "direct", void 0);
|
|
542
|
+
__decorate([
|
|
543
|
+
core_1.Input(),
|
|
544
|
+
__metadata("design:type", Object)
|
|
545
|
+
], TreeComponent.prototype, "api", void 0);
|
|
546
|
+
__decorate([
|
|
547
|
+
core_1.Input(),
|
|
548
|
+
__metadata("design:type", String)
|
|
549
|
+
], TreeComponent.prototype, "urlRoot", void 0);
|
|
550
|
+
__decorate([
|
|
551
|
+
core_1.Input(),
|
|
552
|
+
__metadata("design:type", String)
|
|
553
|
+
], TreeComponent.prototype, "type", void 0);
|
|
554
|
+
__decorate([
|
|
555
|
+
core_1.Input(),
|
|
556
|
+
__metadata("design:type", String)
|
|
557
|
+
], TreeComponent.prototype, "property", void 0);
|
|
558
|
+
__decorate([
|
|
559
|
+
decko_1.debounce(50),
|
|
560
|
+
__metadata("design:type", Function),
|
|
561
|
+
__metadata("design:paramtypes", [Object]),
|
|
562
|
+
__metadata("design:returntype", void 0)
|
|
563
|
+
], TreeComponent.prototype, "onDragMove", null);
|
|
564
|
+
TreeComponent = __decorate([
|
|
565
|
+
core_1.Component({
|
|
566
|
+
selector: `sa-${moduleName}`,
|
|
567
|
+
templateUrl: `${localDir}/${moduleName}/${moduleName}.component${min}.html`,
|
|
568
|
+
}),
|
|
569
|
+
__param(5, core_1.Inject(common_1.DOCUMENT)),
|
|
570
|
+
__metadata("design:paramtypes", [icon_1.MatIconRegistry,
|
|
571
|
+
platform_browser_1.DomSanitizer,
|
|
572
|
+
backend_service_1.BackendService,
|
|
573
|
+
core_1.ChangeDetectorRef,
|
|
574
|
+
core_1.ElementRef,
|
|
575
|
+
Document])
|
|
576
|
+
], TreeComponent);
|
|
577
|
+
exports_1("TreeComponent", TreeComponent);
|
|
485
578
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
return uid;
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
__decorate([
|
|
492
|
-
Input(),
|
|
493
|
-
__metadata("design:type", String)
|
|
494
|
-
], TreeComponent.prototype, "target", void 0);
|
|
495
|
-
__decorate([
|
|
496
|
-
Input(),
|
|
497
|
-
__metadata("design:type", String)
|
|
498
|
-
], TreeComponent.prototype, "targetSuffix", void 0);
|
|
499
|
-
__decorate([
|
|
500
|
-
Input(),
|
|
501
|
-
__metadata("design:type", Number)
|
|
502
|
-
], TreeComponent.prototype, "id", void 0);
|
|
503
|
-
__decorate([
|
|
504
|
-
Input(),
|
|
505
|
-
__metadata("design:type", Boolean)
|
|
506
|
-
], TreeComponent.prototype, "manifest", void 0);
|
|
507
|
-
__decorate([
|
|
508
|
-
Input(),
|
|
509
|
-
__metadata("design:type", Boolean)
|
|
510
|
-
], TreeComponent.prototype, "decouple", void 0);
|
|
511
|
-
__decorate([
|
|
512
|
-
Input(),
|
|
513
|
-
__metadata("design:type", Boolean)
|
|
514
|
-
], TreeComponent.prototype, "direct", void 0);
|
|
515
|
-
__decorate([
|
|
516
|
-
Input(),
|
|
517
|
-
__metadata("design:type", Object)
|
|
518
|
-
], TreeComponent.prototype, "api", void 0);
|
|
519
|
-
__decorate([
|
|
520
|
-
Input(),
|
|
521
|
-
__metadata("design:type", String)
|
|
522
|
-
], TreeComponent.prototype, "urlRoot", void 0);
|
|
523
|
-
__decorate([
|
|
524
|
-
Input(),
|
|
525
|
-
__metadata("design:type", String)
|
|
526
|
-
], TreeComponent.prototype, "type", void 0);
|
|
527
|
-
__decorate([
|
|
528
|
-
Input(),
|
|
529
|
-
__metadata("design:type", String)
|
|
530
|
-
], TreeComponent.prototype, "property", void 0);
|
|
531
|
-
__decorate([
|
|
532
|
-
debounce(50),
|
|
533
|
-
__metadata("design:type", Function),
|
|
534
|
-
__metadata("design:paramtypes", [Object]),
|
|
535
|
-
__metadata("design:returntype", void 0)
|
|
536
|
-
], TreeComponent.prototype, "onDragMove", null);
|
|
537
|
-
TreeComponent = __decorate([
|
|
538
|
-
Component({
|
|
539
|
-
selector: `sa-${moduleName}`,
|
|
540
|
-
templateUrl: `${localDir}/${moduleName}/${moduleName}.component${min}.html`,
|
|
541
|
-
}),
|
|
542
|
-
__param(5, Inject(DOCUMENT)),
|
|
543
|
-
__metadata("design:paramtypes", [MatIconRegistry,
|
|
544
|
-
DomSanitizer,
|
|
545
|
-
BackendService,
|
|
546
|
-
ChangeDetectorRef,
|
|
547
|
-
ElementRef,
|
|
548
|
-
Document])
|
|
549
|
-
], TreeComponent);
|
|
550
|
-
export { TreeComponent };
|
|
579
|
+
};
|
|
580
|
+
});
|
|
551
581
|
|
|
552
582
|
//# sourceMappingURL=tree.component.js.map
|