@rxap/tree 12.2.0 → 12.3.2
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/bundles/rxap-tree.umd.js +217 -153
- package/bundles/rxap-tree.umd.js.map +1 -1
- package/esm2015/lib/tree.component.js +16 -10
- package/esm2015/lib/tree.component.js.map +1 -1
- package/esm2015/lib/tree.component.module.js +7 -3
- package/esm2015/lib/tree.component.module.js.map +1 -1
- package/esm2015/lib/tree.data-source.js +139 -110
- package/esm2015/lib/tree.data-source.js.map +1 -1
- package/fesm2015/rxap-tree.js +161 -122
- package/fesm2015/rxap-tree.js.map +1 -1
- package/lib/tree.component.d.ts +2 -1
- package/lib/tree.component.module.d.ts +2 -1
- package/lib/tree.data-source.d.ts +17 -11
- package/package.json +2 -2
package/fesm2015/rxap-tree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { BehaviorSubject, from, merge } from 'rxjs';
|
|
2
|
+
import { BehaviorSubject, Subject, from, merge } from 'rxjs';
|
|
3
3
|
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
4
4
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
5
5
|
import { map, tap, switchMap, startWith } from 'rxjs/operators';
|
|
@@ -7,26 +7,28 @@ import { BaseDataSource, RXAP_DATA_SOURCE_METADATA } from '@rxap/data-source';
|
|
|
7
7
|
import { joinPath, Required, DebounceCall } from '@rxap/utilities';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { InjectionToken, Injectable, Inject, TemplateRef, Directive, EventEmitter, ViewContainerRef, ChangeDetectorRef, Component, ChangeDetectionStrategy, Optional, Input, ContentChild, Output, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
10
|
-
import { Node } from '@rxap/utilities/rxjs';
|
|
11
|
-
import * as
|
|
10
|
+
import { ToggleSubject, Node } from '@rxap/utilities/rxjs';
|
|
11
|
+
import * as i12 from '@angular/cdk/portal';
|
|
12
12
|
import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
13
13
|
import * as i1 from '@angular/material/tree';
|
|
14
14
|
import { MatTreeModule } from '@angular/material/tree';
|
|
15
15
|
import * as i2 from '@angular/material/icon';
|
|
16
16
|
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
-
import * as i3 from '@angular/material/
|
|
17
|
+
import * as i3 from '@angular/material/checkbox';
|
|
18
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
19
|
+
import * as i4 from '@angular/material/button';
|
|
18
20
|
import { MatButtonModule } from '@angular/material/button';
|
|
19
|
-
import * as
|
|
21
|
+
import * as i5 from '@angular/material/progress-spinner';
|
|
20
22
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
21
|
-
import * as
|
|
23
|
+
import * as i6 from '@angular/material/divider';
|
|
22
24
|
import { MatDividerModule } from '@angular/material/divider';
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
25
|
+
import * as i7 from '@angular/flex-layout/flex';
|
|
26
|
+
import * as i8 from '@angular/common';
|
|
25
27
|
import { CommonModule } from '@angular/common';
|
|
26
|
-
import * as
|
|
27
|
-
import * as
|
|
28
|
+
import * as i9 from '@angular/flex-layout/extended';
|
|
29
|
+
import * as i10 from '@rxap/material-directives/icon';
|
|
28
30
|
import { IconDirectiveModule } from '@rxap/material-directives/icon';
|
|
29
|
-
import * as
|
|
31
|
+
import * as i11 from '@rxap/contenteditable';
|
|
30
32
|
import { ContenteditableDirectiveModule } from '@rxap/contenteditable';
|
|
31
33
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
32
34
|
|
|
@@ -47,9 +49,12 @@ class TreeDataSource extends BaseDataSource {
|
|
|
47
49
|
// im localStorage wird nur die id gespeichert.
|
|
48
50
|
this._preSelected = [];
|
|
49
51
|
this._data$ = new BehaviorSubject([]);
|
|
52
|
+
this.loading$ = new ToggleSubject(true);
|
|
50
53
|
this.toDisplay = () => 'to display function not defined';
|
|
51
54
|
this.getIcon = () => null;
|
|
52
55
|
this.hasDetails = () => true;
|
|
56
|
+
this.matchFilter = () => true;
|
|
57
|
+
this._refreshMatchFilter = new Subject();
|
|
53
58
|
this.tree$
|
|
54
59
|
.pipe(map((tree) => tree
|
|
55
60
|
.map((child) => this.flatTree(child))
|
|
@@ -61,15 +66,17 @@ class TreeDataSource extends BaseDataSource {
|
|
|
61
66
|
}
|
|
62
67
|
getTreeRoot() {
|
|
63
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
this.loading$.enable();
|
|
64
70
|
const root = yield this.getRoot();
|
|
65
71
|
let rootNodes;
|
|
66
72
|
if (Array.isArray(root)) {
|
|
67
|
-
rootNodes = root.map((node) => this._toNode(node));
|
|
73
|
+
rootNodes = yield Promise.all(root.map((node) => this._toNode(node)));
|
|
68
74
|
}
|
|
69
75
|
else {
|
|
70
|
-
rootNodes = [this._toNode(root)];
|
|
76
|
+
rootNodes = [yield this._toNode(root)];
|
|
71
77
|
}
|
|
72
78
|
this.tree$.next(rootNodes);
|
|
79
|
+
this.loading$.disable();
|
|
73
80
|
return rootNodes;
|
|
74
81
|
});
|
|
75
82
|
}
|
|
@@ -86,6 +93,9 @@ class TreeDataSource extends BaseDataSource {
|
|
|
86
93
|
setTreeControl(treeControl) {
|
|
87
94
|
this.treeControl = treeControl;
|
|
88
95
|
}
|
|
96
|
+
setMatchFilter(matchFilter) {
|
|
97
|
+
this.matchFilter = matchFilter;
|
|
98
|
+
}
|
|
89
99
|
setToDisplay(toDisplay = this.toDisplay) {
|
|
90
100
|
this.toDisplay = toDisplay;
|
|
91
101
|
}
|
|
@@ -101,29 +111,31 @@ class TreeDataSource extends BaseDataSource {
|
|
|
101
111
|
}
|
|
102
112
|
// - the SelectModel that stores the selection into the local storage?
|
|
103
113
|
_toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
node
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
node
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const node = yield this.toNode(item, depth, onExpand, onCollapse, onSelect, onDeselect);
|
|
116
|
+
if (this.expanded.isSelected(node.id)) {
|
|
117
|
+
node
|
|
118
|
+
.expand()
|
|
119
|
+
.then(() => {
|
|
120
|
+
// TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in this.treeControl.expansionModel
|
|
121
|
+
// das problem ist das ich beim speicher in localStorage nur die id speicher.
|
|
122
|
+
// Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel
|
|
123
|
+
// nicht einfach mit den expanend nodes fullen. Da dort das node object benötigt wird
|
|
124
|
+
// möglich lösungen:
|
|
125
|
+
// - das node object läde die entity mithilfe der id automatisch nach
|
|
126
|
+
this.treeControl.expansionModel.select(node);
|
|
127
|
+
console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
|
|
128
|
+
})
|
|
129
|
+
.catch(() => console.debug(`Restore expand for node '${node.id}' FAILED`));
|
|
130
|
+
}
|
|
131
|
+
if (this._preSelected.includes(node.id)) {
|
|
132
|
+
yield node
|
|
133
|
+
.select()
|
|
134
|
+
.then(() => console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`))
|
|
135
|
+
.catch(() => console.debug(`Restore select for node '${node.id}' FAILED`));
|
|
136
|
+
}
|
|
137
|
+
return node;
|
|
138
|
+
});
|
|
127
139
|
}
|
|
128
140
|
expandNode(node) {
|
|
129
141
|
var _a;
|
|
@@ -133,7 +145,7 @@ class TreeDataSource extends BaseDataSource {
|
|
|
133
145
|
const children = yield this.getChildren(node);
|
|
134
146
|
// add the loaded children to the item object
|
|
135
147
|
node.item.children = children;
|
|
136
|
-
node.addChildren(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse)));
|
|
148
|
+
node.addChildren(yield Promise.all(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse))));
|
|
137
149
|
node.isLoading$.disable();
|
|
138
150
|
}
|
|
139
151
|
this.expanded.select(node.id);
|
|
@@ -147,11 +159,77 @@ class TreeDataSource extends BaseDataSource {
|
|
|
147
159
|
}
|
|
148
160
|
getRoot() {
|
|
149
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
|
|
162
|
+
const rootParameters = yield this.getRootParameters();
|
|
163
|
+
return this.rootRemoteMethod.call(rootParameters);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
getRootParameters() {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
return undefined;
|
|
151
169
|
});
|
|
152
170
|
}
|
|
153
171
|
// TODO : find better solution to allow the overwrite of the toNode method
|
|
154
172
|
// without losing the custom preselect and preexpand function
|
|
173
|
+
getNodeById(id) {
|
|
174
|
+
function getNodeById(node, nodeId) {
|
|
175
|
+
if (node.id === nodeId) {
|
|
176
|
+
return node;
|
|
177
|
+
}
|
|
178
|
+
if (node.hasNode(nodeId)) {
|
|
179
|
+
return node.getNode(nodeId);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return (this.tree$.value
|
|
186
|
+
.map((node) => getNodeById(node, id))
|
|
187
|
+
.filter(Boolean)[0] || null);
|
|
188
|
+
}
|
|
189
|
+
toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
return Node.ToNode(item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, onSelect, onDeselect, this.hasDetails);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
collapseNode(node) {
|
|
195
|
+
this.expanded.deselect(node.id);
|
|
196
|
+
this.tree$.next(this.tree$.value);
|
|
197
|
+
return Promise.resolve();
|
|
198
|
+
}
|
|
199
|
+
flatTree(tree) {
|
|
200
|
+
function flat(acc, list) {
|
|
201
|
+
return [...acc, ...list];
|
|
202
|
+
}
|
|
203
|
+
const flatTree = (node) => {
|
|
204
|
+
if (!Array.isArray(node.children)) {
|
|
205
|
+
console.log(node);
|
|
206
|
+
throw new Error('Node has not defined children');
|
|
207
|
+
}
|
|
208
|
+
if (node.expanded || this.expanded.isSelected(node.id)) {
|
|
209
|
+
return [
|
|
210
|
+
node,
|
|
211
|
+
...node.children.map((child) => flatTree(child)).reduce(flat, []),
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
return [node];
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
return flatTree(tree);
|
|
219
|
+
}
|
|
220
|
+
destroy() {
|
|
221
|
+
super.destroy();
|
|
222
|
+
// TODO : add subscription handler to BaseDataSource
|
|
223
|
+
if (this._expandedLocalStorageSubscription) {
|
|
224
|
+
this._expandedLocalStorageSubscription.unsubscribe();
|
|
225
|
+
}
|
|
226
|
+
if (this._selectedLocalStorageSubscription) {
|
|
227
|
+
this._selectedLocalStorageSubscription.unsubscribe();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
refreshMatchFilter() {
|
|
231
|
+
this._refreshMatchFilter.next();
|
|
232
|
+
}
|
|
155
233
|
_connect(collectionViewer) {
|
|
156
234
|
this.treeControl.expansionModel.changed.subscribe((change) => {
|
|
157
235
|
if (isSelectionChange(change)) {
|
|
@@ -200,77 +278,7 @@ class TreeDataSource extends BaseDataSource {
|
|
|
200
278
|
return Promise.all(promises);
|
|
201
279
|
}
|
|
202
280
|
return Promise.resolve();
|
|
203
|
-
}), switchMap(() => merge(collectionViewer.viewChange, this._data$).pipe(map(() => this._data$.value))));
|
|
204
|
-
}
|
|
205
|
-
toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
206
|
-
return Node.ToNode(item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, onSelect, onDeselect, this.hasDetails);
|
|
207
|
-
}
|
|
208
|
-
collapseNode(node) {
|
|
209
|
-
this.expanded.deselect(node.id);
|
|
210
|
-
this.tree$.next(this.tree$.value);
|
|
211
|
-
return Promise.resolve();
|
|
212
|
-
}
|
|
213
|
-
flatTree(tree) {
|
|
214
|
-
function flat(acc, list) {
|
|
215
|
-
return [...acc, ...list];
|
|
216
|
-
}
|
|
217
|
-
const flatTree = (node) => {
|
|
218
|
-
if (!Array.isArray(node.children)) {
|
|
219
|
-
console.log(node);
|
|
220
|
-
throw new Error('Node has not defined children');
|
|
221
|
-
}
|
|
222
|
-
if (node.expanded || this.expanded.isSelected(node.id)) {
|
|
223
|
-
return [
|
|
224
|
-
node,
|
|
225
|
-
...node.children.map((child) => flatTree(child)).reduce(flat, []),
|
|
226
|
-
];
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
return [node];
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
return flatTree(tree);
|
|
233
|
-
}
|
|
234
|
-
destroy() {
|
|
235
|
-
super.destroy();
|
|
236
|
-
// TODO : add subscription handler to BaseDataSource
|
|
237
|
-
if (this._expandedLocalStorageSubscription) {
|
|
238
|
-
this._expandedLocalStorageSubscription.unsubscribe();
|
|
239
|
-
}
|
|
240
|
-
if (this._selectedLocalStorageSubscription) {
|
|
241
|
-
this._selectedLocalStorageSubscription.unsubscribe();
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
getNodeById(id) {
|
|
245
|
-
function getNodeById(node, nodeId) {
|
|
246
|
-
if (node.id === nodeId) {
|
|
247
|
-
return node;
|
|
248
|
-
}
|
|
249
|
-
if (node.hasNode(nodeId)) {
|
|
250
|
-
return node.getNode(nodeId);
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return (this.tree$.value
|
|
257
|
-
.map((node) => getNodeById(node, id))
|
|
258
|
-
.filter(Boolean)[0] || null);
|
|
259
|
-
}
|
|
260
|
-
initSelected() {
|
|
261
|
-
const key = joinPath('rxap/tree', this.id, 'selected');
|
|
262
|
-
if (localStorage.getItem(key)) {
|
|
263
|
-
try {
|
|
264
|
-
this._preSelected = JSON.parse(localStorage.getItem(key));
|
|
265
|
-
}
|
|
266
|
-
catch (e) {
|
|
267
|
-
console.debug('parse expanded tree data source nodes failed');
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
this.selected = new SelectionModel(!!this.metadata.selectMultiple, []);
|
|
271
|
-
this._selectedLocalStorageSubscription = this.selected.changed
|
|
272
|
-
.pipe(tap(() => localStorage.setItem(key, JSON.stringify(this.selected.selected.map((s) => s.id)))))
|
|
273
|
-
.subscribe();
|
|
281
|
+
}), 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))))));
|
|
274
282
|
}
|
|
275
283
|
refresh() {
|
|
276
284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -298,6 +306,25 @@ class TreeDataSource extends BaseDataSource {
|
|
|
298
306
|
this.selected.select(...selected);
|
|
299
307
|
});
|
|
300
308
|
}
|
|
309
|
+
initSelected() {
|
|
310
|
+
const key = joinPath('rxap/tree', this.id, 'selected');
|
|
311
|
+
if (this.metadata.cacheSelected) {
|
|
312
|
+
if (localStorage.getItem(key)) {
|
|
313
|
+
try {
|
|
314
|
+
this._preSelected = JSON.parse(localStorage.getItem(key));
|
|
315
|
+
}
|
|
316
|
+
catch (e) {
|
|
317
|
+
console.debug('parse expanded tree data source nodes failed');
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
this.selected = new SelectionModel(!!this.metadata.selectMultiple, []);
|
|
322
|
+
if (this.metadata.cacheSelected) {
|
|
323
|
+
this._selectedLocalStorageSubscription = this.selected.changed
|
|
324
|
+
.pipe(tap(() => localStorage.setItem(key, JSON.stringify(this.selected.selected.map((s) => s.id)))))
|
|
325
|
+
.subscribe();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
301
328
|
reset() {
|
|
302
329
|
this.selected.clear();
|
|
303
330
|
this.expanded.clear();
|
|
@@ -306,18 +333,22 @@ class TreeDataSource extends BaseDataSource {
|
|
|
306
333
|
initExpanded() {
|
|
307
334
|
const key = joinPath('rxap/tree', this.id, 'expanded');
|
|
308
335
|
let expanded = [];
|
|
309
|
-
if (
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
336
|
+
if (this.metadata.cacheExpanded) {
|
|
337
|
+
if (localStorage.getItem(key)) {
|
|
338
|
+
try {
|
|
339
|
+
expanded = JSON.parse(localStorage.getItem(key));
|
|
340
|
+
}
|
|
341
|
+
catch (e) {
|
|
342
|
+
console.debug('parse expanded tree data source nodes failed');
|
|
343
|
+
}
|
|
315
344
|
}
|
|
316
345
|
}
|
|
317
346
|
this.expanded = new SelectionModel(this.metadata.expandMultiple !== false, expanded);
|
|
318
|
-
|
|
319
|
-
.
|
|
320
|
-
|
|
347
|
+
if (this.metadata.cacheExpanded) {
|
|
348
|
+
this._expandedLocalStorageSubscription = this.expanded.changed
|
|
349
|
+
.pipe(tap(() => localStorage.setItem(key, JSON.stringify(this.expanded.selected))))
|
|
350
|
+
.subscribe();
|
|
351
|
+
}
|
|
321
352
|
}
|
|
322
353
|
}
|
|
323
354
|
TreeDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", 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 });
|
|
@@ -364,6 +395,7 @@ class TreeComponent {
|
|
|
364
395
|
this.viewContainerRef = viewContainerRef;
|
|
365
396
|
this.cdr = cdr;
|
|
366
397
|
this.renderer = renderer;
|
|
398
|
+
this.multiple = false;
|
|
367
399
|
this.hideLeafIcon = false;
|
|
368
400
|
this.details = new EventEmitter();
|
|
369
401
|
this.portal = null;
|
|
@@ -389,10 +421,12 @@ class TreeComponent {
|
|
|
389
421
|
return !!this.contentEditableMethod;
|
|
390
422
|
}
|
|
391
423
|
ngOnInit() {
|
|
424
|
+
var _a;
|
|
392
425
|
this.dataSource.setTreeControl(this.treeControl);
|
|
393
426
|
this.dataSource.setToDisplay(this.toDisplay);
|
|
394
427
|
this.dataSource.setGetIcon(this.getIcon);
|
|
395
428
|
this.dataSource.setHasDetails(this.hasDetails);
|
|
429
|
+
this.multiple = (_a = this.dataSource.metadata.selectMultiple) !== null && _a !== void 0 ? _a : this.multiple;
|
|
396
430
|
if (this.dataSource.selected.hasValue()) {
|
|
397
431
|
this.dataSource.selected.selected.forEach((node) => this.openDetails(node));
|
|
398
432
|
}
|
|
@@ -436,7 +470,7 @@ class TreeComponent {
|
|
|
436
470
|
}
|
|
437
471
|
}
|
|
438
472
|
TreeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TreeComponent, deps: [{ token: ViewContainerRef }, { token: ChangeDetectorRef }, { token: RXAP_TREE_CONTENT_EDITABLE_METHOD, optional: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
439
|
-
TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.1", type: TreeComponent, selector: "rxap-tree", inputs: { dataSource: "dataSource", contentEditableMethod: "contentEditableMethod", toDisplay: "toDisplay", getIcon: "getIcon", hasDetails: "hasDetails", hideLeafIcon: "hideLeafIcon" }, 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 #treeContainer class=\"tree-container\" fxFlex=\"nogrow\">\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 <
|
|
473
|
+
TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.1", type: TreeComponent, selector: "rxap-tree", inputs: { dataSource: "dataSource", contentEditableMethod: "contentEditableMethod", toDisplay: "toDisplay", getIcon: "getIcon", multiple: "multiple", hasDetails: "hasDetails", hideLeafIcon: "hideLeafIcon" }, 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 #treeContainer class=\"tree-container\" fxFlex=\"nogrow\">\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 (change)=\"node.toggleSelect()\" [checked]=\"node.selected\" [disabled]=\"!node.hasDetails\" fxFlex=\"nogrow\">{{ node.display }}</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 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 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 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:transparent;background-color:initial}.details,.tree-container{max-height:calc(100vh - 64px - 32px);overflow-y:auto}.tree-container{min-width:-webkit-fit-content;min-width:-moz-fit-content;min-width:fit-content}.divider{cursor:ew-resize;padding:12px}.divider ::ng-deep .mat-divider{height:100%}"], components: [{ type: i1.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i4.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"] }, { type: i5.MatProgressSpinner, selector: "mat-progress-spinner", inputs: ["color", "mode", "diameter", "strokeWidth", "value"], exportAs: ["matProgressSpinner"] }, { type: i6.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i7.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"] }, { type: i7.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"] }, { type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { type: i1.MatTreeNode, selector: "mat-tree-node", inputs: ["role", "disabled", "tabIndex"], exportAs: ["matTreeNode"] }, { type: i1.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { type: i7.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"] }, { type: i9.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"] }, { type: i10.IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { type: i1.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { type: i11.ContenteditableDirective, selector: "[rxapContenteditable]", inputs: ["rxapContenteditable", "disabled"], outputs: ["change"] }, { type: i7.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"] }, { type: i12.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], pipes: { "async": i8.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
440
474
|
__decorate([
|
|
441
475
|
Required,
|
|
442
476
|
__metadata("design:type", TreeDataSource)
|
|
@@ -475,6 +509,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
475
509
|
type: Input
|
|
476
510
|
}], getIcon: [{
|
|
477
511
|
type: Input
|
|
512
|
+
}], multiple: [{
|
|
513
|
+
type: Input
|
|
478
514
|
}], hasDetails: [{
|
|
479
515
|
type: Input
|
|
480
516
|
}], content: [{
|
|
@@ -507,7 +543,8 @@ TreeComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ver
|
|
|
507
543
|
MatProgressSpinnerModule,
|
|
508
544
|
PortalModule,
|
|
509
545
|
ContenteditableDirectiveModule,
|
|
510
|
-
IconDirectiveModule
|
|
546
|
+
IconDirectiveModule,
|
|
547
|
+
MatCheckboxModule], exports: [TreeComponent, TreeContentDirective] });
|
|
511
548
|
TreeComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TreeComponentModule, imports: [[
|
|
512
549
|
CommonModule,
|
|
513
550
|
MatTreeModule,
|
|
@@ -518,7 +555,8 @@ TreeComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
|
518
555
|
MatProgressSpinnerModule,
|
|
519
556
|
PortalModule,
|
|
520
557
|
ContenteditableDirectiveModule,
|
|
521
|
-
IconDirectiveModule
|
|
558
|
+
IconDirectiveModule,
|
|
559
|
+
MatCheckboxModule
|
|
522
560
|
]] });
|
|
523
561
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TreeComponentModule, decorators: [{
|
|
524
562
|
type: NgModule,
|
|
@@ -533,7 +571,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
533
571
|
MatProgressSpinnerModule,
|
|
534
572
|
PortalModule,
|
|
535
573
|
ContenteditableDirectiveModule,
|
|
536
|
-
IconDirectiveModule
|
|
574
|
+
IconDirectiveModule,
|
|
575
|
+
MatCheckboxModule
|
|
537
576
|
],
|
|
538
577
|
declarations: [TreeComponent, TreeContentDirective],
|
|
539
578
|
exports: [TreeComponent, TreeContentDirective],
|