@rxap/tree 14.0.0 → 16.0.0-dev.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/esm2022/lib/tree-content.directive.mjs +21 -0
- package/esm2022/lib/tree.component.mjs +184 -0
- package/esm2022/lib/tree.component.module.mjs +66 -0
- package/esm2022/lib/tree.data-source.mjs +358 -0
- package/{fesm2020 → fesm2022}/rxap-tree.mjs +60 -60
- package/{fesm2020 → fesm2022}/rxap-tree.mjs.map +1 -1
- package/lib/tree-content.directive.d.ts +1 -1
- package/lib/tree.component.d.ts +1 -1
- package/lib/tree.component.module.d.ts +5 -5
- package/package.json +27 -31
- package/esm2020/lib/tree-content.directive.mjs +0 -20
- package/esm2020/lib/tree.component.mjs +0 -183
- package/esm2020/lib/tree.component.module.mjs +0 -65
- package/esm2020/lib/tree.data-source.mjs +0 -357
- package/fesm2015/rxap-tree.mjs +0 -642
- package/fesm2015/rxap-tree.mjs.map +0 -1
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/tokens.mjs +0 -0
- /package/{esm2020 → esm2022}/rxap-tree.mjs +0 -0
package/fesm2015/rxap-tree.mjs
DELETED
|
@@ -1,642 +0,0 @@
|
|
|
1
|
-
import { __awaiter, __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { BehaviorSubject, Subject, from, merge } from 'rxjs';
|
|
3
|
-
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
4
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
5
|
-
import { map, tap, switchMap, startWith } from 'rxjs/operators';
|
|
6
|
-
import { BaseDataSource, RXAP_DATA_SOURCE_METADATA } from '@rxap/data-source';
|
|
7
|
-
import { joinPath, Required, DebounceCall } from '@rxap/utilities';
|
|
8
|
-
import * as i0 from '@angular/core';
|
|
9
|
-
import { InjectionToken, isDevMode, Injectable, Inject, TemplateRef, Directive, EventEmitter, ViewContainerRef, ChangeDetectorRef, Component, ChangeDetectionStrategy, Optional, Input, ContentChild, Output, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
10
|
-
import { ToggleSubject, Node } from '@rxap/utilities/rxjs';
|
|
11
|
-
import * as i9 from '@angular/cdk/portal';
|
|
12
|
-
import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
13
|
-
import * as i1 from '@angular/common';
|
|
14
|
-
import { CommonModule } from '@angular/common';
|
|
15
|
-
import * as i2 from '@angular/material/tree';
|
|
16
|
-
import { MatTreeModule } from '@angular/material/tree';
|
|
17
|
-
import * as i3 from '@angular/material/button';
|
|
18
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
19
|
-
import * as i4 from '@angular/material/icon';
|
|
20
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
21
|
-
import * as i5 from '@angular/flex-layout/flex';
|
|
22
|
-
import * as i6 from '@angular/flex-layout/extended';
|
|
23
|
-
import * as i7 from '@angular/material/divider';
|
|
24
|
-
import { MatDividerModule } from '@angular/material/divider';
|
|
25
|
-
import * as i8 from '@angular/material/progress-spinner';
|
|
26
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
27
|
-
import * as i10 from '@rxap/contenteditable';
|
|
28
|
-
import { ContenteditableDirectiveModule } from '@rxap/contenteditable';
|
|
29
|
-
import * as i11 from '@rxap/material-directives/icon';
|
|
30
|
-
import { IconDirectiveModule } from '@rxap/material-directives/icon';
|
|
31
|
-
import * as i12 from '@angular/material/checkbox';
|
|
32
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
33
|
-
import * as i13 from '@angular/material/progress-bar';
|
|
34
|
-
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
35
|
-
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
36
|
-
|
|
37
|
-
function isSelectionChange(obj) {
|
|
38
|
-
return !!obj && obj.hasOwnProperty('added') && obj.hasOwnProperty('removed');
|
|
39
|
-
}
|
|
40
|
-
const RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD = new InjectionToken('rxap/tree/data-source/root-remote-method');
|
|
41
|
-
const RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD = new InjectionToken('rxap/tree/data-source/children-remote-method');
|
|
42
|
-
class TreeDataSource extends BaseDataSource {
|
|
43
|
-
constructor(rootRemoteMethod, childrenRemoteMethod, metadata = null) {
|
|
44
|
-
super(metadata);
|
|
45
|
-
this.rootRemoteMethod = rootRemoteMethod;
|
|
46
|
-
this.childrenRemoteMethod = childrenRemoteMethod;
|
|
47
|
-
this.tree$ = new BehaviorSubject([]);
|
|
48
|
-
this._expandedLocalStorageSubscription = null;
|
|
49
|
-
this._selectedLocalStorageSubscription = null;
|
|
50
|
-
// TODO : änlich problem wie bei der redundaten expand SelectionModel.
|
|
51
|
-
// im localStorage wird nur die id gespeichert.
|
|
52
|
-
this._preSelected = [];
|
|
53
|
-
this._data$ = new BehaviorSubject([]);
|
|
54
|
-
this.loading$ = new ToggleSubject(true);
|
|
55
|
-
this.toDisplay = () => 'to display function not defined';
|
|
56
|
-
this.getIcon = () => null;
|
|
57
|
-
this.getStyle = () => ({});
|
|
58
|
-
this.hasDetails = () => true;
|
|
59
|
-
this.matchFilter = () => true;
|
|
60
|
-
this._refreshMatchFilter = new Subject();
|
|
61
|
-
this._nodeParameters = null;
|
|
62
|
-
this.tree$
|
|
63
|
-
.pipe(map((tree) => tree
|
|
64
|
-
.map((child) => this.flatTree(child))
|
|
65
|
-
.reduce((acc, nodes) => [...acc, ...nodes], [])))
|
|
66
|
-
.subscribe(this._data$);
|
|
67
|
-
// TODO add new SelectModel class that saves the select model to the localStorage
|
|
68
|
-
this.initSelected();
|
|
69
|
-
this.initExpanded();
|
|
70
|
-
}
|
|
71
|
-
get nodeParameters() {
|
|
72
|
-
return this._nodeParameters;
|
|
73
|
-
}
|
|
74
|
-
set nodeParameters(nodeParameters) {
|
|
75
|
-
this._nodeParameters = nodeParameters;
|
|
76
|
-
this.tree$.value.forEach(node => node.parameters = nodeParameters);
|
|
77
|
-
}
|
|
78
|
-
getTreeRoot() {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
this.loading$.enable();
|
|
81
|
-
const root = yield this.getRoot();
|
|
82
|
-
let rootNodes;
|
|
83
|
-
if (Array.isArray(root)) {
|
|
84
|
-
rootNodes = yield Promise.all(root.map((node) => this._toNode(node)));
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
rootNodes = [yield this._toNode(root)];
|
|
88
|
-
}
|
|
89
|
-
this.tree$.next(rootNodes);
|
|
90
|
-
this.loading$.disable();
|
|
91
|
-
return rootNodes;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
selectNode(node) {
|
|
95
|
-
if (!this.selected.isMultipleSelection()) {
|
|
96
|
-
if (this.selected.hasValue()) {
|
|
97
|
-
const currentSelectedNode = this.selected.selected[0];
|
|
98
|
-
currentSelectedNode.deselect();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
this.selected.select(node);
|
|
102
|
-
return Promise.resolve();
|
|
103
|
-
}
|
|
104
|
-
setTreeControl(treeControl) {
|
|
105
|
-
this.treeControl = treeControl;
|
|
106
|
-
}
|
|
107
|
-
setMatchFilter(matchFilter) {
|
|
108
|
-
this.matchFilter = matchFilter;
|
|
109
|
-
}
|
|
110
|
-
setToDisplay(toDisplay = this.toDisplay) {
|
|
111
|
-
this.toDisplay = toDisplay;
|
|
112
|
-
}
|
|
113
|
-
setGetIcon(getIcon = this.getIcon) {
|
|
114
|
-
this.getIcon = getIcon;
|
|
115
|
-
}
|
|
116
|
-
setHasDetails(hasDetails = this.hasDetails) {
|
|
117
|
-
this.hasDetails = hasDetails;
|
|
118
|
-
}
|
|
119
|
-
deselectNode(node) {
|
|
120
|
-
this.selected.deselect(node);
|
|
121
|
-
return Promise.resolve();
|
|
122
|
-
}
|
|
123
|
-
// - the SelectModel that stores the selection into the local storage?
|
|
124
|
-
_toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
125
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
const node = yield this.toNode(item, depth, onExpand, onCollapse, onSelect, onDeselect);
|
|
127
|
-
if (this.expanded.isSelected(node.id)) {
|
|
128
|
-
node
|
|
129
|
-
.expand()
|
|
130
|
-
.then(() => {
|
|
131
|
-
// TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in this.treeControl.expansionModel
|
|
132
|
-
// das problem ist das ich beim speicher in localStorage nur die id speicher.
|
|
133
|
-
// Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel
|
|
134
|
-
// nicht einfach mit den expanend nodes fullen. Da dort das node object benötigt wird
|
|
135
|
-
// möglich lösungen:
|
|
136
|
-
// - das node object läde die entity mithilfe der id automatisch nach
|
|
137
|
-
this.treeControl.expansionModel.select(node);
|
|
138
|
-
console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
|
|
139
|
-
})
|
|
140
|
-
.catch(() => console.debug(`Restore expand for node '${node.id}' FAILED`));
|
|
141
|
-
}
|
|
142
|
-
if (this._preSelected.includes(node.id)) {
|
|
143
|
-
yield node
|
|
144
|
-
.select()
|
|
145
|
-
.then(() => console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`))
|
|
146
|
-
.catch(() => console.debug(`Restore select for node '${node.id}' FAILED`));
|
|
147
|
-
}
|
|
148
|
-
return node;
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
expandNode(node) {
|
|
152
|
-
var _a;
|
|
153
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
if (node.item.hasChildren && !((_a = node.item.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
155
|
-
node.isLoading$.enable();
|
|
156
|
-
const children = yield this.getChildren(node);
|
|
157
|
-
// add the loaded children to the item object
|
|
158
|
-
node.item.children = children;
|
|
159
|
-
node.addChildren(yield Promise.all(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse))));
|
|
160
|
-
node.isLoading$.disable();
|
|
161
|
-
}
|
|
162
|
-
this.expanded.select(node.id);
|
|
163
|
-
this.tree$.next(this.tree$.value);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
getChildren(node) {
|
|
167
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
return this.childrenRemoteMethod.call(node);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
getRoot() {
|
|
172
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
const rootParameters = yield this.getRootParameters();
|
|
174
|
-
return this.rootRemoteMethod.call(rootParameters);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
getRootParameters() {
|
|
178
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
-
return undefined;
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
// TODO : find better solution to allow the overwrite of the toNode method
|
|
183
|
-
// without losing the custom preselect and preexpand function
|
|
184
|
-
getNodeById(id) {
|
|
185
|
-
function getNodeById(node, nodeId) {
|
|
186
|
-
if (node.id === nodeId) {
|
|
187
|
-
return node;
|
|
188
|
-
}
|
|
189
|
-
if (node.hasNode(nodeId)) {
|
|
190
|
-
return node.getNode(nodeId);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return (this.tree$.value
|
|
197
|
-
.map((node) => getNodeById(node, id))
|
|
198
|
-
.filter(Boolean)[0] || null);
|
|
199
|
-
}
|
|
200
|
-
toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
return Node.ToNode(item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, onSelect, onDeselect, this.hasDetails, this.getStyle, this.nodeParameters);
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
collapseNode(node) {
|
|
206
|
-
this.expanded.deselect(node.id);
|
|
207
|
-
this.tree$.next(this.tree$.value);
|
|
208
|
-
return Promise.resolve();
|
|
209
|
-
}
|
|
210
|
-
flatTree(tree) {
|
|
211
|
-
function flat(acc, list) {
|
|
212
|
-
return [...acc, ...list];
|
|
213
|
-
}
|
|
214
|
-
const flatTree = (node) => {
|
|
215
|
-
if (!Array.isArray(node.children)) {
|
|
216
|
-
if (isDevMode()) {
|
|
217
|
-
console.log(node);
|
|
218
|
-
}
|
|
219
|
-
throw new Error('Node has not defined children');
|
|
220
|
-
}
|
|
221
|
-
if (node.expanded || this.expanded.isSelected(node.id)) {
|
|
222
|
-
return [
|
|
223
|
-
node,
|
|
224
|
-
...node.children.map((child) => flatTree(child)).reduce(flat, []),
|
|
225
|
-
];
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
return [node];
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
return flatTree(tree);
|
|
232
|
-
}
|
|
233
|
-
destroy() {
|
|
234
|
-
super.destroy();
|
|
235
|
-
// TODO : add subscription handler to BaseDataSource
|
|
236
|
-
if (this._expandedLocalStorageSubscription) {
|
|
237
|
-
this._expandedLocalStorageSubscription.unsubscribe();
|
|
238
|
-
}
|
|
239
|
-
if (this._selectedLocalStorageSubscription) {
|
|
240
|
-
this._selectedLocalStorageSubscription.unsubscribe();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
refreshMatchFilter() {
|
|
244
|
-
this._refreshMatchFilter.next();
|
|
245
|
-
}
|
|
246
|
-
_connect(collectionViewer) {
|
|
247
|
-
this.treeControl.expansionModel.changed.subscribe((change) => {
|
|
248
|
-
if (isSelectionChange(change)) {
|
|
249
|
-
if (change.added) {
|
|
250
|
-
change.added.forEach((node) => node.expand());
|
|
251
|
-
}
|
|
252
|
-
if (change.removed) {
|
|
253
|
-
change.removed
|
|
254
|
-
.slice()
|
|
255
|
-
.reverse()
|
|
256
|
-
.forEach((node) => node.collapse());
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
let loadRoot = Promise.resolve();
|
|
261
|
-
if (this.tree$.value.length === 0) {
|
|
262
|
-
loadRoot = this.getTreeRoot();
|
|
263
|
-
}
|
|
264
|
-
return from(loadRoot).pipe(tap((rootNodes) => {
|
|
265
|
-
if (rootNodes) {
|
|
266
|
-
const promises = [];
|
|
267
|
-
if (this.metadata.selectMultiple) {
|
|
268
|
-
if (!this.selected.hasValue()) {
|
|
269
|
-
promises.push(...rootNodes
|
|
270
|
-
.filter((node) => node.hasDetails)
|
|
271
|
-
.map((node) => node.select()));
|
|
272
|
-
}
|
|
273
|
-
if (!this.expanded.hasValue()) {
|
|
274
|
-
promises.push(...rootNodes
|
|
275
|
-
.filter((node) => node.hasChildren)
|
|
276
|
-
.map((node) => node.expand()));
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
else if (rootNodes.length) {
|
|
280
|
-
const rootNode = rootNodes[0];
|
|
281
|
-
if (!this.selected.hasValue()) {
|
|
282
|
-
// TODO : rename hasDetails to isSelectable
|
|
283
|
-
if (rootNode.hasDetails) {
|
|
284
|
-
promises.push(rootNode.select());
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
if (!this.expanded.hasValue()) {
|
|
288
|
-
promises.push(rootNode.expand());
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
return Promise.all(promises);
|
|
292
|
-
}
|
|
293
|
-
return Promise.resolve();
|
|
294
|
-
}), switchMap(() => merge(collectionViewer.viewChange, this._data$).pipe(map(() => this._data$.value))), switchMap(nodeList => this._refreshMatchFilter.pipe(startWith(null), map(() => nodeList.filter(node => this.matchFilter(node))))));
|
|
295
|
-
}
|
|
296
|
-
refresh() {
|
|
297
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
298
|
-
const rootNodes = yield this.getTreeRoot();
|
|
299
|
-
// refresh all expanded nodes;
|
|
300
|
-
const loadExpandedNodes = (children) => __awaiter(this, void 0, void 0, function* () {
|
|
301
|
-
for (const child of children) {
|
|
302
|
-
if (this.expanded.isSelected(child.id)) {
|
|
303
|
-
// call the node method to ensure that the expanded property of
|
|
304
|
-
// Node is set.
|
|
305
|
-
yield child.expand();
|
|
306
|
-
}
|
|
307
|
-
if (child.hasChildren) {
|
|
308
|
-
yield loadExpandedNodes(child.children);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
yield Promise.all(rootNodes
|
|
313
|
-
.filter((node) => node.hasChildren)
|
|
314
|
-
.map((node) => loadExpandedNodes(node.children)));
|
|
315
|
-
const selected = this.selected.selected
|
|
316
|
-
.map((node) => this.getNodeById(node.id))
|
|
317
|
-
.filter(Boolean);
|
|
318
|
-
this.selected.clear();
|
|
319
|
-
this.selected.select(...selected);
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
initSelected() {
|
|
323
|
-
const key = joinPath('rxap/tree', this.id, 'selected');
|
|
324
|
-
if (this.metadata.cacheSelected) {
|
|
325
|
-
if (localStorage.getItem(key)) {
|
|
326
|
-
try {
|
|
327
|
-
this._preSelected = JSON.parse(localStorage.getItem(key));
|
|
328
|
-
}
|
|
329
|
-
catch (e) {
|
|
330
|
-
console.debug('parse expanded tree data source nodes failed');
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
this.selected = new SelectionModel(!!this.metadata.selectMultiple, []);
|
|
335
|
-
if (this.metadata.cacheSelected) {
|
|
336
|
-
this._selectedLocalStorageSubscription = this.selected.changed
|
|
337
|
-
.pipe(tap(() => localStorage.setItem(key, JSON.stringify(this.selected.selected.map((s) => s.id)))))
|
|
338
|
-
.subscribe();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
reset() {
|
|
342
|
-
this.selected.clear();
|
|
343
|
-
this.expanded.clear();
|
|
344
|
-
return this.getTreeRoot();
|
|
345
|
-
}
|
|
346
|
-
initExpanded() {
|
|
347
|
-
const key = joinPath('rxap/tree', this.id, 'expanded');
|
|
348
|
-
let expanded = [];
|
|
349
|
-
if (this.metadata.cacheExpanded) {
|
|
350
|
-
if (localStorage.getItem(key)) {
|
|
351
|
-
try {
|
|
352
|
-
expanded = JSON.parse(localStorage.getItem(key));
|
|
353
|
-
}
|
|
354
|
-
catch (e) {
|
|
355
|
-
console.debug('parse expanded tree data source nodes failed');
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
this.expanded = new SelectionModel(this.metadata.expandMultiple !== false, expanded);
|
|
360
|
-
if (this.metadata.cacheExpanded) {
|
|
361
|
-
this._expandedLocalStorageSubscription = this.expanded.changed
|
|
362
|
-
.pipe(tap(() => localStorage.setItem(key, JSON.stringify(this.expanded.selected))))
|
|
363
|
-
.subscribe();
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
setGetStyle(getStyle = this.getStyle) {
|
|
367
|
-
this.getStyle = getStyle;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* recall the getStyle, getIcon and toDisplay methods
|
|
371
|
-
* and update the node objects
|
|
372
|
-
*/
|
|
373
|
-
updateNodes() {
|
|
374
|
-
this._data$.value.forEach(node => {
|
|
375
|
-
node.style = this.getStyle(node.item);
|
|
376
|
-
node.icon = this.getIcon(node.item);
|
|
377
|
-
node.display = this.toDisplay(node.item);
|
|
378
|
-
});
|
|
379
|
-
this._data$.next(this._data$.value);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
TreeDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeDataSource, deps: [{ token: RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD }, { token: RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD }, { token: RXAP_DATA_SOURCE_METADATA }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
383
|
-
TreeDataSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeDataSource });
|
|
384
|
-
__decorate([
|
|
385
|
-
Required,
|
|
386
|
-
__metadata("design:type", FlatTreeControl)
|
|
387
|
-
], TreeDataSource.prototype, "treeControl", void 0);
|
|
388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeDataSource, decorators: [{
|
|
389
|
-
type: Injectable
|
|
390
|
-
}], ctorParameters: function () {
|
|
391
|
-
return [{ type: undefined, decorators: [{
|
|
392
|
-
type: Inject,
|
|
393
|
-
args: [RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD]
|
|
394
|
-
}] }, { type: undefined, decorators: [{
|
|
395
|
-
type: Inject,
|
|
396
|
-
args: [RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD]
|
|
397
|
-
}] }, { type: undefined, decorators: [{
|
|
398
|
-
type: Inject,
|
|
399
|
-
args: [RXAP_DATA_SOURCE_METADATA]
|
|
400
|
-
}] }];
|
|
401
|
-
}, propDecorators: { treeControl: [] } });
|
|
402
|
-
|
|
403
|
-
class TreeContentDirective {
|
|
404
|
-
constructor(template) {
|
|
405
|
-
this.template = template;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
TreeContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeContentDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
409
|
-
TreeContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: TreeContentDirective, selector: "ng-template[rxapTreeContent]", ngImport: i0 });
|
|
410
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeContentDirective, decorators: [{
|
|
411
|
-
type: Directive,
|
|
412
|
-
args: [{
|
|
413
|
-
// tslint:disable-next-line:directive-selector
|
|
414
|
-
selector: 'ng-template[rxapTreeContent]',
|
|
415
|
-
}]
|
|
416
|
-
}], ctorParameters: function () {
|
|
417
|
-
return [{ type: i0.TemplateRef, decorators: [{
|
|
418
|
-
type: Inject,
|
|
419
|
-
args: [TemplateRef]
|
|
420
|
-
}] }];
|
|
421
|
-
} });
|
|
422
|
-
|
|
423
|
-
const RXAP_TREE_CONTENT_EDITABLE_METHOD = new InjectionToken('rxap/tree-content-editable-method');
|
|
424
|
-
|
|
425
|
-
class TreeComponent {
|
|
426
|
-
constructor(viewContainerRef, cdr, contentEditableMethod, renderer) {
|
|
427
|
-
this.viewContainerRef = viewContainerRef;
|
|
428
|
-
this.cdr = cdr;
|
|
429
|
-
this.renderer = renderer;
|
|
430
|
-
this.multiple = false;
|
|
431
|
-
this.hideLeafIcon = false;
|
|
432
|
-
this.details = new EventEmitter();
|
|
433
|
-
this.dividerOffset = '256px';
|
|
434
|
-
this.portal = null;
|
|
435
|
-
this.getLevel = (node) => node.depth;
|
|
436
|
-
this.isExpandable = (node) => node.hasChildren;
|
|
437
|
-
this.hasChild = (_, nodeData) => nodeData.hasChildren;
|
|
438
|
-
/**
|
|
439
|
-
* Indicates that the divider is moved with mouse down
|
|
440
|
-
* @private
|
|
441
|
-
*/
|
|
442
|
-
this._moveDivider = false;
|
|
443
|
-
/**
|
|
444
|
-
* Holds the current tree container width.
|
|
445
|
-
* If null the move divider feature was not yet used and the initial
|
|
446
|
-
* container width is not calculated
|
|
447
|
-
* @private
|
|
448
|
-
*/
|
|
449
|
-
this._treeContainerWidth = null;
|
|
450
|
-
this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);
|
|
451
|
-
this.contentEditableMethod = contentEditableMethod;
|
|
452
|
-
}
|
|
453
|
-
get nodeDisplayEditable() {
|
|
454
|
-
return !!this.contentEditableMethod;
|
|
455
|
-
}
|
|
456
|
-
get cacheId() {
|
|
457
|
-
return ['rxap', 'tree', this.id].join('/');
|
|
458
|
-
}
|
|
459
|
-
ngOnInit() {
|
|
460
|
-
var _a;
|
|
461
|
-
this.dataSource.setTreeControl(this.treeControl);
|
|
462
|
-
this.dataSource.setToDisplay(this.toDisplay);
|
|
463
|
-
this.dataSource.setGetIcon(this.getIcon);
|
|
464
|
-
this.dataSource.setHasDetails(this.hasDetails);
|
|
465
|
-
this.dataSource.setGetStyle(this.getStyle);
|
|
466
|
-
this.multiple = (_a = this.dataSource.metadata.selectMultiple) !== null && _a !== void 0 ? _a : this.multiple;
|
|
467
|
-
if (this.dataSource.selected.hasValue()) {
|
|
468
|
-
this.dataSource.selected.selected.forEach((node) => this.openDetails(node));
|
|
469
|
-
}
|
|
470
|
-
const cachedOffset = localStorage.getItem(this.cacheId);
|
|
471
|
-
if (cachedOffset && cachedOffset.match(/^(\d+\.)?\d+px$/)) {
|
|
472
|
-
this.setDividerOffset(cachedOffset);
|
|
473
|
-
}
|
|
474
|
-
else if (isDevMode()) {
|
|
475
|
-
console.log("Divider offset cache is not available or invalid: " + cachedOffset);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
ngAfterContentInit() {
|
|
479
|
-
this.dataSource.selected.changed
|
|
480
|
-
.pipe(map(($event) => $event.source.selected), startWith(this.dataSource.selected.selected), tap((selected) => selected.forEach((node) => this.openDetails(node))))
|
|
481
|
-
.subscribe();
|
|
482
|
-
}
|
|
483
|
-
openDetails(node) {
|
|
484
|
-
if (this.content) {
|
|
485
|
-
this.portal = new TemplatePortal(this.content.template, this.viewContainerRef, {
|
|
486
|
-
$implicit: node.item,
|
|
487
|
-
node,
|
|
488
|
-
});
|
|
489
|
-
this.cdr.markForCheck();
|
|
490
|
-
}
|
|
491
|
-
this.details.emit(node.item);
|
|
492
|
-
}
|
|
493
|
-
onContentEditableChange(value, node) {
|
|
494
|
-
var _a;
|
|
495
|
-
return (_a = this.contentEditableMethod) === null || _a === void 0 ? void 0 : _a.call(value, node.item, node);
|
|
496
|
-
}
|
|
497
|
-
onMousedown() {
|
|
498
|
-
this._moveDivider = true;
|
|
499
|
-
}
|
|
500
|
-
onMouseup() {
|
|
501
|
-
this._moveDivider = false;
|
|
502
|
-
}
|
|
503
|
-
onMousemove($event) {
|
|
504
|
-
if (this._moveDivider) {
|
|
505
|
-
if (!this._treeContainerWidth) {
|
|
506
|
-
this._treeContainerWidth = this.treeContainer.nativeElement.clientWidth;
|
|
507
|
-
}
|
|
508
|
-
this._treeContainerWidth = $event.clientX - 75;
|
|
509
|
-
const offset = this._treeContainerWidth + 'px';
|
|
510
|
-
this.setDividerOffset(offset);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
setDividerOffset(offset) {
|
|
514
|
-
if (isDevMode()) {
|
|
515
|
-
console.log("set divider offset to: " + offset);
|
|
516
|
-
}
|
|
517
|
-
this.dividerOffset = offset;
|
|
518
|
-
this.renderer.setStyle(this.treeContainer.nativeElement, 'max-width', offset);
|
|
519
|
-
this.renderer.setStyle(this.treeContainer.nativeElement, 'min-width', offset);
|
|
520
|
-
this.renderer.setStyle(this.treeContainer.nativeElement, 'flex-basis', offset);
|
|
521
|
-
localStorage.setItem(this.cacheId, offset);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
TreeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeComponent, deps: [{ token: ViewContainerRef }, { token: ChangeDetectorRef }, { token: RXAP_TREE_CONTENT_EDITABLE_METHOD, optional: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
525
|
-
TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: TreeComponent, selector: "rxap-tree", inputs: { dataSource: "dataSource", contentEditableMethod: "contentEditableMethod", toDisplay: "toDisplay", getIcon: "getIcon", getStyle: "getStyle", multiple: "multiple", hasDetails: "hasDetails", hideLeafIcon: "hideLeafIcon", id: "id", dividerOffset: "dividerOffset" }, outputs: { details: "details" }, host: { listeners: { "mouseup": "onMouseup()", "mousemove": "onMousemove($event)" } }, queries: [{ propertyName: "content", first: true, predicate: TreeContentDirective, descendants: true, static: true }], viewQueries: [{ propertyName: "treeContainer", first: true, predicate: ["treeContainer"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"container\" fxLayout=\"row\">\n <div [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\" #treeContainer class=\"tree-container\" fxFlex=\"nogrow\">\n <mat-progress-bar *ngIf=\"!dataSource || (dataSource.loading$ | async)\" mode=\"indeterminate\"></mat-progress-bar>\n <mat-tree *ngIf=\"dataSource; else loading\" [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" class=\"tree-view\">\n\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon [fxHide]=\"hideLeafIcon\" fxFlex=\"40px\">subdirectory_arrow_right</mat-icon>\n <mat-icon *ngIf=\"node.icon\" [rxapIcon]=\"node.icon\" fxFlex=\"40px\"></mat-icon>\n <ng-template [ngIf]=\"multiple\">\n <mat-checkbox\n (change)=\"node.toggleSelect()\"\n [checked]=\"node.selected\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n fxFlex=\"nogrow\">\n {{ node.display }}\n </mat-checkbox>\n </ng-template>\n <ng-template [ngIf]=\"!multiple\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : null\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n fxFlex=\"nogrow\"\n mat-button\n >\n {{ node.display }}\n </button>\n </ng-template>\n </div>\n </mat-tree-node>\n\n <!-- Node with children -->\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\n <button [attr.aria-label]=\"'toggle ' + node.filename\" mat-icon-button matTreeNodeToggle>\n <mat-icon class=\"mat-icon-rtl-mirror\">\n {{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n </button>\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon *ngIf=\"node.icon; else withoutIcon\" [rxapIcon]=\"node.icon\" fxFlex=\"40px\"></mat-icon>\n <ng-template #withoutIcon>\n <div fxFlex=\"0\"></div>\n </ng-template>\n <ng-template [ngIfElse]=\"withoutDetails\" [ngIf]=\"node.hasDetails\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : null\"\n fxFlex=\"nogrow\"\n [ngStyle]=\"node.style\"\n mat-button\n >\n {{ node.display }}\n </button>\n </ng-template>\n <ng-template #withoutDetails>\n <span\n (change)=\"onContentEditableChange($event, node)\"\n [disabled]=\"!nodeDisplayEditable\"\n fxFlex=\"nogrow\"\n [ngStyle]=\"node.style\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n </ng-template>\n <mat-progress-spinner\n *ngIf=\"node.isLoading$ | async\"\n [diameter]=\"16\"\n fxFlex=\"nogrow\"\n fxFlexOffset=\"16px\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n </div>\n </mat-tree-node>\n\n </mat-tree>\n </div>\n\n <div (mousedown)=\"onMousedown()\"\n class=\"divider\"\n fxFlex=\"nogrow\">\n <mat-divider\n [vertical]=\"true\"\n >\n </mat-divider>\n </div>\n\n <div class=\"details\" fxFlex=\"grow\">\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n <ng-content></ng-content>\n </div>\n</div>\n\n<ng-template #loading>Load data source</ng-template>\n", styles: [".container{height:100%}.tree-view{background-color:initial}.details{max-height:calc(100vh - 96px);overflow-y:auto}.tree-container{max-height:calc(100vh - 96px);overflow-y:auto;width:-moz-fit-content;width:fit-content}.divider{cursor:ew-resize;padding:12px}.divider ::ng-deep .mat-divider{height:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "directive", type: i2.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { kind: "directive", type: i2.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { kind: "component", type: i2.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i2.MatTreeNode, selector: "mat-tree-node", inputs: ["role", "disabled", "tabIndex"], exportAs: ["matTreeNode"] }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i5.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i5.DefaultFlexOffsetDirective, selector: " [fxFlexOffset], [fxFlexOffset.xs], [fxFlexOffset.sm], [fxFlexOffset.md], [fxFlexOffset.lg], [fxFlexOffset.xl], [fxFlexOffset.lt-sm], [fxFlexOffset.lt-md], [fxFlexOffset.lt-lg], [fxFlexOffset.lt-xl], [fxFlexOffset.gt-xs], [fxFlexOffset.gt-sm], [fxFlexOffset.gt-md], [fxFlexOffset.gt-lg]", inputs: ["fxFlexOffset", "fxFlexOffset.xs", "fxFlexOffset.sm", "fxFlexOffset.md", "fxFlexOffset.lg", "fxFlexOffset.xl", "fxFlexOffset.lt-sm", "fxFlexOffset.lt-md", "fxFlexOffset.lt-lg", "fxFlexOffset.lt-xl", "fxFlexOffset.gt-xs", "fxFlexOffset.gt-sm", "fxFlexOffset.gt-md", "fxFlexOffset.gt-lg"] }, { kind: "directive", type: i5.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i6.DefaultShowHideDirective, selector: " [fxShow], [fxShow.print], [fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl], [fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl], [fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg], [fxHide], [fxHide.print], [fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl], [fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl], [fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]", inputs: ["fxShow", "fxShow.print", "fxShow.xs", "fxShow.sm", "fxShow.md", "fxShow.lg", "fxShow.xl", "fxShow.lt-sm", "fxShow.lt-md", "fxShow.lt-lg", "fxShow.lt-xl", "fxShow.gt-xs", "fxShow.gt-sm", "fxShow.gt-md", "fxShow.gt-lg", "fxHide", "fxHide.print", "fxHide.xs", "fxHide.sm", "fxHide.md", "fxHide.lg", "fxHide.xl", "fxHide.lt-sm", "fxHide.lt-md", "fxHide.lt-lg", "fxHide.lt-xl", "fxHide.gt-xs", "fxHide.gt-sm", "fxHide.gt-md", "fxHide.gt-lg"] }, { kind: "directive", type: i6.DefaultStyleDirective, selector: " [ngStyle], [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl], [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl], [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", inputs: ["ngStyle", "ngStyle.xs", "ngStyle.sm", "ngStyle.md", "ngStyle.lg", "ngStyle.xl", "ngStyle.lt-sm", "ngStyle.lt-md", "ngStyle.lt-lg", "ngStyle.lt-xl", "ngStyle.gt-xs", "ngStyle.gt-sm", "ngStyle.gt-md", "ngStyle.gt-lg"] }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i9.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: i10.ContenteditableDirective, selector: "[rxapContenteditable]", inputs: ["rxapContenteditable", "disabled"], outputs: ["change"] }, { kind: "directive", type: i11.IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { kind: "component", type: i12.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i13.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
526
|
-
__decorate([
|
|
527
|
-
Required,
|
|
528
|
-
__metadata("design:type", TreeDataSource)
|
|
529
|
-
], TreeComponent.prototype, "dataSource", void 0);
|
|
530
|
-
__decorate([
|
|
531
|
-
DebounceCall(100),
|
|
532
|
-
__metadata("design:type", Function),
|
|
533
|
-
__metadata("design:paramtypes", [Node]),
|
|
534
|
-
__metadata("design:returntype", void 0)
|
|
535
|
-
], TreeComponent.prototype, "openDetails", null);
|
|
536
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeComponent, decorators: [{
|
|
537
|
-
type: Component,
|
|
538
|
-
args: [{ selector: 'rxap-tree', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"container\" fxLayout=\"row\">\n <div [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\" #treeContainer class=\"tree-container\" fxFlex=\"nogrow\">\n <mat-progress-bar *ngIf=\"!dataSource || (dataSource.loading$ | async)\" mode=\"indeterminate\"></mat-progress-bar>\n <mat-tree *ngIf=\"dataSource; else loading\" [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" class=\"tree-view\">\n\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon [fxHide]=\"hideLeafIcon\" fxFlex=\"40px\">subdirectory_arrow_right</mat-icon>\n <mat-icon *ngIf=\"node.icon\" [rxapIcon]=\"node.icon\" fxFlex=\"40px\"></mat-icon>\n <ng-template [ngIf]=\"multiple\">\n <mat-checkbox\n (change)=\"node.toggleSelect()\"\n [checked]=\"node.selected\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n fxFlex=\"nogrow\">\n {{ node.display }}\n </mat-checkbox>\n </ng-template>\n <ng-template [ngIf]=\"!multiple\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : null\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n fxFlex=\"nogrow\"\n mat-button\n >\n {{ node.display }}\n </button>\n </ng-template>\n </div>\n </mat-tree-node>\n\n <!-- Node with children -->\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\n <button [attr.aria-label]=\"'toggle ' + node.filename\" mat-icon-button matTreeNodeToggle>\n <mat-icon class=\"mat-icon-rtl-mirror\">\n {{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n </button>\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon *ngIf=\"node.icon; else withoutIcon\" [rxapIcon]=\"node.icon\" fxFlex=\"40px\"></mat-icon>\n <ng-template #withoutIcon>\n <div fxFlex=\"0\"></div>\n </ng-template>\n <ng-template [ngIfElse]=\"withoutDetails\" [ngIf]=\"node.hasDetails\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : null\"\n fxFlex=\"nogrow\"\n [ngStyle]=\"node.style\"\n mat-button\n >\n {{ node.display }}\n </button>\n </ng-template>\n <ng-template #withoutDetails>\n <span\n (change)=\"onContentEditableChange($event, node)\"\n [disabled]=\"!nodeDisplayEditable\"\n fxFlex=\"nogrow\"\n [ngStyle]=\"node.style\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n </ng-template>\n <mat-progress-spinner\n *ngIf=\"node.isLoading$ | async\"\n [diameter]=\"16\"\n fxFlex=\"nogrow\"\n fxFlexOffset=\"16px\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n </div>\n </mat-tree-node>\n\n </mat-tree>\n </div>\n\n <div (mousedown)=\"onMousedown()\"\n class=\"divider\"\n fxFlex=\"nogrow\">\n <mat-divider\n [vertical]=\"true\"\n >\n </mat-divider>\n </div>\n\n <div class=\"details\" fxFlex=\"grow\">\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n <ng-content></ng-content>\n </div>\n</div>\n\n<ng-template #loading>Load data source</ng-template>\n", styles: [".container{height:100%}.tree-view{background-color:initial}.details{max-height:calc(100vh - 96px);overflow-y:auto}.tree-container{max-height:calc(100vh - 96px);overflow-y:auto;width:-moz-fit-content;width:fit-content}.divider{cursor:ew-resize;padding:12px}.divider ::ng-deep .mat-divider{height:100%}\n"] }]
|
|
539
|
-
}], ctorParameters: function () {
|
|
540
|
-
return [{ type: i0.ViewContainerRef, decorators: [{
|
|
541
|
-
type: Inject,
|
|
542
|
-
args: [ViewContainerRef]
|
|
543
|
-
}] }, { type: i0.ChangeDetectorRef, decorators: [{
|
|
544
|
-
type: Inject,
|
|
545
|
-
args: [ChangeDetectorRef]
|
|
546
|
-
}] }, { type: undefined, decorators: [{
|
|
547
|
-
type: Optional
|
|
548
|
-
}, {
|
|
549
|
-
type: Inject,
|
|
550
|
-
args: [RXAP_TREE_CONTENT_EDITABLE_METHOD]
|
|
551
|
-
}] }, { type: i0.Renderer2 }];
|
|
552
|
-
}, propDecorators: { dataSource: [{
|
|
553
|
-
type: Input
|
|
554
|
-
}], contentEditableMethod: [{
|
|
555
|
-
type: Input
|
|
556
|
-
}], toDisplay: [{
|
|
557
|
-
type: Input
|
|
558
|
-
}], getIcon: [{
|
|
559
|
-
type: Input
|
|
560
|
-
}], getStyle: [{
|
|
561
|
-
type: Input
|
|
562
|
-
}], multiple: [{
|
|
563
|
-
type: Input
|
|
564
|
-
}], hasDetails: [{
|
|
565
|
-
type: Input
|
|
566
|
-
}], content: [{
|
|
567
|
-
type: ContentChild,
|
|
568
|
-
args: [TreeContentDirective, { static: true }]
|
|
569
|
-
}], hideLeafIcon: [{
|
|
570
|
-
type: Input
|
|
571
|
-
}], id: [{
|
|
572
|
-
type: Input
|
|
573
|
-
}], details: [{
|
|
574
|
-
type: Output
|
|
575
|
-
}], dividerOffset: [{
|
|
576
|
-
type: Input
|
|
577
|
-
}], treeContainer: [{
|
|
578
|
-
type: ViewChild,
|
|
579
|
-
args: ['treeContainer', { static: true }]
|
|
580
|
-
}], openDetails: [], onMouseup: [{
|
|
581
|
-
type: HostListener,
|
|
582
|
-
args: ['mouseup']
|
|
583
|
-
}], onMousemove: [{
|
|
584
|
-
type: HostListener,
|
|
585
|
-
args: ['mousemove', ['$event']]
|
|
586
|
-
}] } });
|
|
587
|
-
|
|
588
|
-
class TreeComponentModule {
|
|
589
|
-
}
|
|
590
|
-
TreeComponentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
591
|
-
TreeComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: TreeComponentModule, declarations: [TreeComponent, TreeContentDirective], imports: [CommonModule,
|
|
592
|
-
MatTreeModule,
|
|
593
|
-
MatButtonModule,
|
|
594
|
-
MatIconModule,
|
|
595
|
-
FlexLayoutModule,
|
|
596
|
-
MatDividerModule,
|
|
597
|
-
MatProgressSpinnerModule,
|
|
598
|
-
PortalModule,
|
|
599
|
-
ContenteditableDirectiveModule,
|
|
600
|
-
IconDirectiveModule,
|
|
601
|
-
MatCheckboxModule,
|
|
602
|
-
MatProgressBarModule], exports: [TreeComponent, TreeContentDirective] });
|
|
603
|
-
TreeComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeComponentModule, imports: [CommonModule,
|
|
604
|
-
MatTreeModule,
|
|
605
|
-
MatButtonModule,
|
|
606
|
-
MatIconModule,
|
|
607
|
-
FlexLayoutModule,
|
|
608
|
-
MatDividerModule,
|
|
609
|
-
MatProgressSpinnerModule,
|
|
610
|
-
PortalModule,
|
|
611
|
-
ContenteditableDirectiveModule,
|
|
612
|
-
IconDirectiveModule,
|
|
613
|
-
MatCheckboxModule,
|
|
614
|
-
MatProgressBarModule] });
|
|
615
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: TreeComponentModule, decorators: [{
|
|
616
|
-
type: NgModule,
|
|
617
|
-
args: [{
|
|
618
|
-
imports: [
|
|
619
|
-
CommonModule,
|
|
620
|
-
MatTreeModule,
|
|
621
|
-
MatButtonModule,
|
|
622
|
-
MatIconModule,
|
|
623
|
-
FlexLayoutModule,
|
|
624
|
-
MatDividerModule,
|
|
625
|
-
MatProgressSpinnerModule,
|
|
626
|
-
PortalModule,
|
|
627
|
-
ContenteditableDirectiveModule,
|
|
628
|
-
IconDirectiveModule,
|
|
629
|
-
MatCheckboxModule,
|
|
630
|
-
MatProgressBarModule,
|
|
631
|
-
],
|
|
632
|
-
declarations: [TreeComponent, TreeContentDirective],
|
|
633
|
-
exports: [TreeComponent, TreeContentDirective]
|
|
634
|
-
}]
|
|
635
|
-
}] });
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Generated bundle index. Do not edit.
|
|
639
|
-
*/
|
|
640
|
-
|
|
641
|
-
export { RXAP_TREE_CONTENT_EDITABLE_METHOD, RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD, RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD, TreeComponent, TreeComponentModule, TreeContentDirective, TreeDataSource, isSelectionChange };
|
|
642
|
-
//# sourceMappingURL=rxap-tree.mjs.map
|