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