@rxap/tree 16.0.0-dev.2 → 16.0.0-dev.21
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/CHANGELOG.md +402 -0
- package/LICENSE +621 -27
- package/LICENSE.md +621 -0
- package/README.md +8 -22
- package/esm2022/index.mjs +1 -1
- package/esm2022/lib/search.form.mjs +44 -0
- package/esm2022/lib/tokens.mjs +1 -1
- package/esm2022/lib/tree-content.directive.mjs +7 -9
- package/esm2022/lib/tree.component.mjs +52 -57
- package/esm2022/lib/tree.data-source.mjs +298 -129
- package/esm2022/rxap-tree.mjs +1 -1
- package/fesm2022/rxap-tree.mjs +345 -180
- package/fesm2022/rxap-tree.mjs.map +1 -1
- package/lib/search.form.d.ts +20 -0
- package/lib/tree.component.d.ts +16 -12
- package/lib/tree.data-source.d.ts +50 -22
- package/package.json +83 -60
- package/theme.css +1 -0
- package/collection.json +0 -10
- package/migration.json +0 -4
- package/src/schematics/ng-add/index.d.ts +0 -2
- package/src/schematics/ng-add/index.js +0 -8
- package/src/schematics/ng-add/index.js.map +0 -1
- package/src/schematics/ng-add/schema.json +0 -7
package/fesm2022/rxap-tree.mjs
CHANGED
|
@@ -1,51 +1,166 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { BehaviorSubject, Subject, from, merge } from 'rxjs';
|
|
3
|
-
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
4
2
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
5
|
-
import {
|
|
6
|
-
import { BaseDataSource, RXAP_DATA_SOURCE_METADATA } from '@rxap/data-source';
|
|
7
|
-
import { joinPath, Required, DebounceCall } from '@rxap/utilities';
|
|
3
|
+
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
8
4
|
import * as i0 from '@angular/core';
|
|
9
|
-
import { InjectionToken, isDevMode, Injectable, Inject, TemplateRef, Directive, EventEmitter, ViewContainerRef, ChangeDetectorRef, Component, ChangeDetectionStrategy,
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
5
|
+
import { InjectionToken, isDevMode, Injectable, Inject, Optional, TemplateRef, Directive, EventEmitter, signal, ViewContainerRef, ChangeDetectorRef, Component, ChangeDetectionStrategy, Input, ContentChild, Output, ViewChild, HostListener } from '@angular/core';
|
|
6
|
+
import { BaseDataSource, RXAP_DATA_SOURCE_METADATA, RxapDataSource } from '@rxap/data-source';
|
|
7
|
+
import { Node } from '@rxap/data-structure-tree';
|
|
8
|
+
import { ToggleSubject } from '@rxap/rxjs';
|
|
9
|
+
import { coerceArray, joinPath, Required, DebounceCall } from '@rxap/utilities';
|
|
10
|
+
import { BehaviorSubject, Subject, combineLatest, from, merge } from 'rxjs';
|
|
11
|
+
import { switchMap, map, tap, startWith } from 'rxjs/operators';
|
|
12
|
+
import * as i8 from '@angular/cdk/portal';
|
|
12
13
|
import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import * as i8 from '@angular/material/progress-spinner';
|
|
16
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
17
|
-
import { ContenteditableDirective } from '@rxap/contenteditable';
|
|
18
|
-
import * as i7 from '@angular/material/button';
|
|
14
|
+
import { NgStyle, NgIf, AsyncPipe, NgClass, NgForOf } from '@angular/common';
|
|
15
|
+
import * as i5 from '@angular/material/button';
|
|
19
16
|
import { MatButtonModule } from '@angular/material/button';
|
|
20
|
-
import * as
|
|
17
|
+
import * as i4 from '@angular/material/checkbox';
|
|
21
18
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
22
|
-
import
|
|
23
|
-
import
|
|
19
|
+
import * as i7 from '@angular/material/divider';
|
|
20
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
21
|
+
import * as i3 from '@angular/material/icon';
|
|
24
22
|
import { MatIconModule } from '@angular/material/icon';
|
|
25
|
-
import * as
|
|
26
|
-
import { MatTreeModule } from '@angular/material/tree';
|
|
27
|
-
import * as i3 from '@angular/material/progress-bar';
|
|
23
|
+
import * as i1 from '@angular/material/progress-bar';
|
|
28
24
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
29
|
-
import * as
|
|
30
|
-
import {
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import {
|
|
25
|
+
import * as i6 from '@angular/material/progress-spinner';
|
|
26
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
27
|
+
import * as i2 from '@angular/material/tree';
|
|
28
|
+
import { MatTreeModule } from '@angular/material/tree';
|
|
29
|
+
import { ContenteditableDirective } from '@rxap/contenteditable';
|
|
30
|
+
import { IconDirective } from '@rxap/material-directives/icon';
|
|
34
31
|
|
|
35
32
|
function isSelectionChange(obj) {
|
|
36
|
-
return !!obj && obj
|
|
33
|
+
return !!obj && obj['added'] !== undefined && obj['removed'] !== undefined;
|
|
37
34
|
}
|
|
38
35
|
const RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD = new InjectionToken('rxap/tree/data-source/root-remote-method');
|
|
39
36
|
const RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD = new InjectionToken('rxap/tree/data-source/children-remote-method');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
const RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD = new InjectionToken('rxap/tree/data-source/apply-filter-method');
|
|
38
|
+
function flatTree(tree, all = false) {
|
|
39
|
+
tree = coerceArray(tree);
|
|
40
|
+
function flat(acc, list) {
|
|
41
|
+
return [...acc, ...list];
|
|
42
|
+
}
|
|
43
|
+
const _flatTree = (node) => {
|
|
44
|
+
if (!Array.isArray(node.children)) {
|
|
45
|
+
if (isDevMode()) {
|
|
46
|
+
console.log(node);
|
|
47
|
+
}
|
|
48
|
+
throw new Error('Node has not defined children');
|
|
49
|
+
}
|
|
50
|
+
if (all || node.expanded) {
|
|
51
|
+
return [
|
|
52
|
+
node,
|
|
53
|
+
...node.children.map((child) => _flatTree(child)).reduce(flat, []),
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return [node];
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return tree
|
|
61
|
+
.map((child) => _flatTree(child))
|
|
62
|
+
.reduce((acc, items) => [...acc, ...items], []);
|
|
63
|
+
}
|
|
64
|
+
class DefaultTreeApplyFilterMethod {
|
|
65
|
+
constructor() {
|
|
66
|
+
this.lastFilter = null;
|
|
67
|
+
}
|
|
68
|
+
call({ tree, filter, scopeTypes }) {
|
|
69
|
+
const nodes = flatTree(tree, true);
|
|
70
|
+
if (this.isEqualToLastFilter(filter)) {
|
|
71
|
+
return flatTree(tree, false).filter(node => node.isVisible);
|
|
72
|
+
}
|
|
73
|
+
const hasScopeFilter = (filter.scope &&
|
|
74
|
+
Object.keys(filter.scope) &&
|
|
75
|
+
Object.values(filter.scope).some(list => list.length > 0));
|
|
76
|
+
// if not scope and the search filter is an empty string, collapse all non-root nodes
|
|
77
|
+
if (!filter.search && filter.search !== this.lastFilter?.search) {
|
|
78
|
+
nodes
|
|
79
|
+
.filter(node => node.parent)
|
|
80
|
+
.forEach(node => node.collapse({ quite: true }));
|
|
81
|
+
}
|
|
82
|
+
if (filter.search || hasScopeFilter) {
|
|
83
|
+
nodes.forEach(node => node.hide());
|
|
84
|
+
for (const [type, list] of Object.entries(filter.scope ?? {})) {
|
|
85
|
+
for (const node of nodes) {
|
|
86
|
+
if (node.type === type) {
|
|
87
|
+
if (list.some(item => item.uuid === node.id)) {
|
|
88
|
+
node.show({ forEachChildren: true });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (filter.search) {
|
|
94
|
+
for (const node of nodes) {
|
|
95
|
+
if (hasScopeFilter && node.hidden) {
|
|
96
|
+
// if the filter has a scope filter. Only check the search filter on nodes that are shown by the scope
|
|
97
|
+
// filter
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const display = node.display?.toLowerCase();
|
|
101
|
+
if (display) {
|
|
102
|
+
if (display.includes(filter.search.toLowerCase())) {
|
|
103
|
+
node.show({ parents: true });
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
node.hide();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// if node has no display, it is not shown
|
|
111
|
+
node.hide();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// hide each node that has no visible children
|
|
115
|
+
// there exists the edge case that a node has visible children, but the node.hide() function is called
|
|
116
|
+
// after the child.show({ parent:true })
|
|
117
|
+
for (const node of nodes.filter(n => n.hidden && n.hasChildren && n.children.some(child => child.isVisible))) {
|
|
118
|
+
if (node.hidden) {
|
|
119
|
+
console.warn('Edge case detected. Node has visible children but is hidden.');
|
|
120
|
+
node.show();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// expand each node that has visible children
|
|
124
|
+
for (const node of nodes.filter(n => n.hasChildren)) {
|
|
125
|
+
if (node.children.some(child => child.isVisible)) {
|
|
126
|
+
// set quite to true to prevent the tree from reloading -> this would result in a infinite loop
|
|
127
|
+
node.expand({ quite: true });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
nodes.forEach(node => node.show());
|
|
134
|
+
}
|
|
135
|
+
this.lastFilter = filter;
|
|
136
|
+
return flatTree(tree, false).filter(node => node.isVisible);
|
|
137
|
+
}
|
|
138
|
+
isEqualToLastFilter(filter) {
|
|
139
|
+
if (this.lastFilter) {
|
|
140
|
+
if (this.lastFilter.search === filter.search) {
|
|
141
|
+
if (this.lastFilter.scope && filter.scope) {
|
|
142
|
+
if (Object.keys(this.lastFilter.scope).every(key => Object.keys(filter.scope).includes(key))) {
|
|
143
|
+
if (Object.entries(this.lastFilter.scope)
|
|
144
|
+
.every(([key, scope]) => scope.some(item => filter.scope[key].includes(item)))) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (filter.scope === this.lastFilter.scope) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
47
155
|
}
|
|
48
|
-
|
|
156
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DefaultTreeApplyFilterMethod, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
157
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DefaultTreeApplyFilterMethod }); }
|
|
158
|
+
}
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DefaultTreeApplyFilterMethod, decorators: [{
|
|
160
|
+
type: Injectable
|
|
161
|
+
}] });
|
|
162
|
+
let TreeDataSource = class TreeDataSource extends BaseDataSource {
|
|
163
|
+
constructor(rootRemoteMethod, childrenRemoteMethod = null, applyFilterMethod = null, metadata = null) {
|
|
49
164
|
super(metadata);
|
|
50
165
|
this.rootRemoteMethod = rootRemoteMethod;
|
|
51
166
|
this.childrenRemoteMethod = childrenRemoteMethod;
|
|
@@ -53,35 +168,56 @@ class TreeDataSource extends BaseDataSource {
|
|
|
53
168
|
this._expandedLocalStorageSubscription = null;
|
|
54
169
|
this._selectedLocalStorageSubscription = null;
|
|
55
170
|
// TODO : änlich problem wie bei der redundaten expand SelectionModel.
|
|
171
|
+
this.loading$ = new ToggleSubject(true);
|
|
172
|
+
this.searchForm = null;
|
|
56
173
|
// im localStorage wird nur die id gespeichert.
|
|
57
174
|
this._preSelected = [];
|
|
58
175
|
this._data$ = new BehaviorSubject([]);
|
|
59
|
-
this.
|
|
176
|
+
this._refreshMatchFilter = new Subject();
|
|
177
|
+
this._nodeParameters = null;
|
|
60
178
|
this.toDisplay = () => 'to display function not defined';
|
|
61
179
|
this.getIcon = () => null;
|
|
180
|
+
this.getType = () => null;
|
|
62
181
|
this.getStyle = () => ({});
|
|
63
182
|
this.hasDetails = () => true;
|
|
64
183
|
this.matchFilter = () => true;
|
|
65
|
-
this.
|
|
66
|
-
this._nodeParameters = null;
|
|
67
|
-
this.tree$
|
|
68
|
-
.pipe(map((tree) => tree
|
|
69
|
-
.map((child) => this.flatTree(child))
|
|
70
|
-
.reduce((acc, nodes) => [...acc, ...nodes], [])))
|
|
71
|
-
.subscribe(this._data$);
|
|
184
|
+
this.applyFilterMethod = applyFilterMethod ?? new DefaultTreeApplyFilterMethod();
|
|
72
185
|
// TODO add new SelectModel class that saves the select model to the localStorage
|
|
73
186
|
this.initSelected();
|
|
74
187
|
this.initExpanded();
|
|
75
188
|
}
|
|
189
|
+
ngOnInit() {
|
|
190
|
+
if (this.searchForm) {
|
|
191
|
+
combineLatest([
|
|
192
|
+
this.tree$,
|
|
193
|
+
this.searchForm.rxapFormGroup.value$,
|
|
194
|
+
]).pipe(switchMap(async ([tree, filter]) => await this.applyFilterMethod.call({
|
|
195
|
+
tree,
|
|
196
|
+
filter,
|
|
197
|
+
scopeTypes: this.metadata?.scopeTypes,
|
|
198
|
+
})), map(nodes => coerceArray(nodes)))
|
|
199
|
+
.subscribe(data => this._data$.next(data));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this.tree$.pipe(map(tree => flatTree(tree).filter(node => node.isVisible)), tap(nodes => nodes.forEach(node => node.show()))).subscribe(data => this._data$.next(data));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
get nodeParameters() {
|
|
206
|
+
return this._nodeParameters;
|
|
207
|
+
}
|
|
208
|
+
set nodeParameters(nodeParameters) {
|
|
209
|
+
this._nodeParameters = nodeParameters;
|
|
210
|
+
this.tree$.value.forEach(node => node.parameters = nodeParameters);
|
|
211
|
+
}
|
|
76
212
|
async getTreeRoot() {
|
|
77
213
|
this.loading$.enable();
|
|
78
214
|
const root = await this.getRoot();
|
|
79
215
|
let rootNodes;
|
|
80
216
|
if (Array.isArray(root)) {
|
|
81
|
-
rootNodes = await Promise.all(root.map((node) => this._toNode(node)));
|
|
217
|
+
rootNodes = await Promise.all(root.map((node) => this._toNode(null, node)));
|
|
82
218
|
}
|
|
83
219
|
else {
|
|
84
|
-
rootNodes = [await this._toNode(root)];
|
|
220
|
+
rootNodes = [await this._toNode(null, root)];
|
|
85
221
|
}
|
|
86
222
|
this.tree$.next(rootNodes);
|
|
87
223
|
this.loading$.disable();
|
|
@@ -117,44 +253,60 @@ class TreeDataSource extends BaseDataSource {
|
|
|
117
253
|
return Promise.resolve();
|
|
118
254
|
}
|
|
119
255
|
// - the SelectModel that stores the selection into the local storage?
|
|
120
|
-
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)) {
|
|
121
|
-
const node = await this.toNode(item, depth, onExpand, onCollapse, onSelect, onDeselect);
|
|
256
|
+
async _toNode(parent, item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
257
|
+
const node = await this.toNode(parent, item, depth, onExpand, onCollapse, onSelect, onDeselect);
|
|
122
258
|
if (this.expanded.isSelected(node.id)) {
|
|
123
259
|
node
|
|
124
260
|
.expand()
|
|
125
261
|
.then(() => {
|
|
126
|
-
// TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in
|
|
127
|
-
// das problem ist das ich beim speicher in localStorage nur die id speicher.
|
|
128
|
-
// Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
// - das node object läde die entity mithilfe der id automatisch nach
|
|
262
|
+
// TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in
|
|
263
|
+
// this.treeControl.expansionModel das problem ist das ich beim speicher in localStorage nur die id speicher.
|
|
264
|
+
// Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel nicht einfach mit den
|
|
265
|
+
// expanend nodes fullen. Da dort das node object benötigt wird möglich lösungen: - das node object läde die
|
|
266
|
+
// entity mithilfe der id automatisch nach
|
|
132
267
|
this.treeControl.expansionModel.select(node);
|
|
133
|
-
console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
|
|
134
|
-
})
|
|
135
|
-
|
|
268
|
+
// console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
|
|
269
|
+
});
|
|
270
|
+
// .catch(() =>
|
|
271
|
+
// console.debug(`Restore expand for node '${node.id}' FAILED`)
|
|
272
|
+
// );
|
|
136
273
|
}
|
|
137
274
|
if (this._preSelected.includes(node.id)) {
|
|
138
275
|
await node
|
|
139
|
-
.select()
|
|
140
|
-
|
|
141
|
-
|
|
276
|
+
.select();
|
|
277
|
+
// .then(() =>
|
|
278
|
+
// console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`)
|
|
279
|
+
// )
|
|
280
|
+
// .catch(() =>
|
|
281
|
+
// console.debug(`Restore select for node '${node.id}' FAILED`)
|
|
282
|
+
// );
|
|
142
283
|
}
|
|
143
284
|
return node;
|
|
144
285
|
}
|
|
145
|
-
async expandNode(node) {
|
|
286
|
+
async expandNode(node, options) {
|
|
287
|
+
if (!options?.onlySelf) {
|
|
288
|
+
// required to sync the expanstion state with the tree control
|
|
289
|
+
// if the collpase is trigged by node.expand this state is not
|
|
290
|
+
// sync with the tree control
|
|
291
|
+
this.treeControl.expansionModel.select(node);
|
|
292
|
+
}
|
|
146
293
|
if (node.item.hasChildren && !node.item.children?.length) {
|
|
147
294
|
node.isLoading$.enable();
|
|
148
295
|
const children = await this.getChildren(node);
|
|
149
296
|
// add the loaded children to the item object
|
|
150
297
|
node.item.children = children;
|
|
151
|
-
node.addChildren(await Promise.all(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse))));
|
|
298
|
+
node.addChildren(await Promise.all(children.map((child) => this._toNode(node, child, node.depth + 1, node.onExpand, node.onCollapse))));
|
|
152
299
|
node.isLoading$.disable();
|
|
153
300
|
}
|
|
154
301
|
this.expanded.select(node.id);
|
|
155
|
-
|
|
302
|
+
if (!options?.quite) {
|
|
303
|
+
this.tree$.next(this.tree$.value);
|
|
304
|
+
}
|
|
156
305
|
}
|
|
157
306
|
async getChildren(node) {
|
|
307
|
+
if (!this.childrenRemoteMethod) {
|
|
308
|
+
throw new Error(`The node '${node.id}' has unloaded children but the RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD is not provided.`);
|
|
309
|
+
}
|
|
158
310
|
return this.childrenRemoteMethod.call(node);
|
|
159
311
|
}
|
|
160
312
|
async getRoot() {
|
|
@@ -182,36 +334,30 @@ class TreeDataSource extends BaseDataSource {
|
|
|
182
334
|
.map((node) => getNodeById(node, id))
|
|
183
335
|
.filter(Boolean)[0] || null);
|
|
184
336
|
}
|
|
185
|
-
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)) {
|
|
186
|
-
return Node.ToNode(item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, onSelect, onDeselect, this.hasDetails, this.getStyle, this.nodeParameters);
|
|
337
|
+
async toNode(parent, item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
338
|
+
return Node.ToNode(parent, item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, this.getType, onSelect, onDeselect, this.hasDetails, this.getStyle, this.nodeParameters);
|
|
187
339
|
}
|
|
188
|
-
collapseNode(node) {
|
|
340
|
+
collapseNode(node, options) {
|
|
341
|
+
if (!options?.onlySelf) {
|
|
342
|
+
// required to sync the expanstion state with the tree control
|
|
343
|
+
// if the collpase is trigged by node.colapse this state is not
|
|
344
|
+
// sync with the tree control
|
|
345
|
+
this.treeControl.expansionModel.deselect(node);
|
|
346
|
+
}
|
|
189
347
|
this.expanded.deselect(node.id);
|
|
190
|
-
|
|
348
|
+
if (!options?.quite) {
|
|
349
|
+
this.tree$.next(this.tree$.value);
|
|
350
|
+
}
|
|
191
351
|
return Promise.resolve();
|
|
192
352
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
throw new Error('Node has not defined children');
|
|
203
|
-
}
|
|
204
|
-
if (node.expanded || this.expanded.isSelected(node.id)) {
|
|
205
|
-
return [
|
|
206
|
-
node,
|
|
207
|
-
...node.children.map((child) => flatTree(child)).reduce(flat, []),
|
|
208
|
-
];
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
return [node];
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
return flatTree(tree);
|
|
353
|
+
/**
|
|
354
|
+
* Converts the tree structure into a list.
|
|
355
|
+
*
|
|
356
|
+
* @param tree
|
|
357
|
+
* @param all true - include nodes children that are not expanded
|
|
358
|
+
*/
|
|
359
|
+
flatTree(tree, all = false) {
|
|
360
|
+
return flatTree(tree, all);
|
|
215
361
|
}
|
|
216
362
|
destroy() {
|
|
217
363
|
super.destroy();
|
|
@@ -226,20 +372,71 @@ class TreeDataSource extends BaseDataSource {
|
|
|
226
372
|
refreshMatchFilter() {
|
|
227
373
|
this._refreshMatchFilter.next();
|
|
228
374
|
}
|
|
375
|
+
async refresh() {
|
|
376
|
+
const rootNodes = await this.getTreeRoot();
|
|
377
|
+
// refresh all expanded nodes;
|
|
378
|
+
const loadExpandedNodes = async (children) => {
|
|
379
|
+
for (const child of children) {
|
|
380
|
+
if (this.expanded.isSelected(child.id)) {
|
|
381
|
+
// call the node method to ensure that the expanded property of
|
|
382
|
+
// Node is set.
|
|
383
|
+
await child.expand();
|
|
384
|
+
}
|
|
385
|
+
if (child.hasChildren) {
|
|
386
|
+
await loadExpandedNodes(child.children);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
await Promise.all(rootNodes
|
|
391
|
+
.filter((node) => node.hasChildren)
|
|
392
|
+
.map((node) => loadExpandedNodes(node.children)));
|
|
393
|
+
const selected = this.selected.selected
|
|
394
|
+
.map((node) => this.getNodeById(node.id))
|
|
395
|
+
.filter(Boolean);
|
|
396
|
+
this.selected.clear();
|
|
397
|
+
this.selected.select(...selected);
|
|
398
|
+
}
|
|
399
|
+
reset() {
|
|
400
|
+
this.selected.clear();
|
|
401
|
+
this.expanded.clear();
|
|
402
|
+
return this.getTreeRoot();
|
|
403
|
+
}
|
|
404
|
+
setGetStyle(getStyle = this.getStyle) {
|
|
405
|
+
this.getStyle = getStyle;
|
|
406
|
+
}
|
|
407
|
+
setGetType(getType = this.getType) {
|
|
408
|
+
this.getType = getType;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* recall the getStyle, getIcon and toDisplay methods
|
|
412
|
+
* and update the node objects
|
|
413
|
+
*/
|
|
414
|
+
updateNodes() {
|
|
415
|
+
this._data$.value.forEach(node => {
|
|
416
|
+
node.style = this.getStyle(node.item);
|
|
417
|
+
node.icon = coerceArray(this.getIcon(node.item));
|
|
418
|
+
node.display = this.toDisplay(node.item);
|
|
419
|
+
});
|
|
420
|
+
this._data$.next(this._data$.value);
|
|
421
|
+
}
|
|
229
422
|
_connect(collectionViewer) {
|
|
230
|
-
this.
|
|
423
|
+
this.init();
|
|
424
|
+
this.treeControl.expansionModel.changed.pipe(tap(async (change) => {
|
|
231
425
|
if (isSelectionChange(change)) {
|
|
426
|
+
const promiseList = [];
|
|
232
427
|
if (change.added) {
|
|
233
|
-
change.added.
|
|
428
|
+
promiseList.push(...change.added.map((node) => node.expand({ onlySelf: true, quite: true })));
|
|
234
429
|
}
|
|
235
430
|
if (change.removed) {
|
|
236
|
-
change.removed
|
|
431
|
+
promiseList.push(...change.removed
|
|
237
432
|
.slice()
|
|
238
433
|
.reverse()
|
|
239
|
-
.
|
|
434
|
+
.map((node) => node.collapse({ onlySelf: true, quite: true })));
|
|
240
435
|
}
|
|
436
|
+
await Promise.all(promiseList);
|
|
437
|
+
this.tree$.next(this.tree$.value);
|
|
241
438
|
}
|
|
242
|
-
});
|
|
439
|
+
})).subscribe();
|
|
243
440
|
let loadRoot = Promise.resolve();
|
|
244
441
|
if (this.tree$.value.length === 0) {
|
|
245
442
|
loadRoot = this.getTreeRoot();
|
|
@@ -276,105 +473,74 @@ class TreeDataSource extends BaseDataSource {
|
|
|
276
473
|
return Promise.resolve();
|
|
277
474
|
}), 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))))));
|
|
278
475
|
}
|
|
279
|
-
async refresh() {
|
|
280
|
-
const rootNodes = await this.getTreeRoot();
|
|
281
|
-
// refresh all expanded nodes;
|
|
282
|
-
const loadExpandedNodes = async (children) => {
|
|
283
|
-
for (const child of children) {
|
|
284
|
-
if (this.expanded.isSelected(child.id)) {
|
|
285
|
-
// call the node method to ensure that the expanded property of
|
|
286
|
-
// Node is set.
|
|
287
|
-
await child.expand();
|
|
288
|
-
}
|
|
289
|
-
if (child.hasChildren) {
|
|
290
|
-
await loadExpandedNodes(child.children);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
await Promise.all(rootNodes
|
|
295
|
-
.filter((node) => node.hasChildren)
|
|
296
|
-
.map((node) => loadExpandedNodes(node.children)));
|
|
297
|
-
const selected = this.selected.selected
|
|
298
|
-
.map((node) => this.getNodeById(node.id))
|
|
299
|
-
.filter(Boolean);
|
|
300
|
-
this.selected.clear();
|
|
301
|
-
this.selected.select(...selected);
|
|
302
|
-
}
|
|
303
476
|
initSelected() {
|
|
304
477
|
const key = joinPath('rxap/tree', this.id, 'selected');
|
|
305
|
-
if (this.metadata
|
|
478
|
+
if (this.metadata['cacheSelected']) {
|
|
306
479
|
if (localStorage.getItem(key)) {
|
|
307
480
|
try {
|
|
308
481
|
this._preSelected = JSON.parse(localStorage.getItem(key));
|
|
309
482
|
}
|
|
310
483
|
catch (e) {
|
|
311
|
-
console.
|
|
484
|
+
console.error('parse expanded tree data source nodes failed');
|
|
312
485
|
}
|
|
313
486
|
}
|
|
314
487
|
}
|
|
315
488
|
this.selected = new SelectionModel(!!this.metadata.selectMultiple, []);
|
|
316
|
-
if (this.metadata
|
|
489
|
+
if (this.metadata['cacheSelected']) {
|
|
317
490
|
this._selectedLocalStorageSubscription = this.selected.changed
|
|
318
491
|
.pipe(tap(() => localStorage.setItem(key, JSON.stringify(this.selected.selected.map((s) => s.id)))))
|
|
319
492
|
.subscribe();
|
|
320
493
|
}
|
|
321
494
|
}
|
|
322
|
-
reset() {
|
|
323
|
-
this.selected.clear();
|
|
324
|
-
this.expanded.clear();
|
|
325
|
-
return this.getTreeRoot();
|
|
326
|
-
}
|
|
327
495
|
initExpanded() {
|
|
328
496
|
const key = joinPath('rxap/tree', this.id, 'expanded');
|
|
329
497
|
let expanded = [];
|
|
330
|
-
if (this.metadata
|
|
498
|
+
if (this.metadata['cacheExpanded']) {
|
|
331
499
|
if (localStorage.getItem(key)) {
|
|
332
500
|
try {
|
|
333
501
|
expanded = JSON.parse(localStorage.getItem(key));
|
|
334
502
|
}
|
|
335
503
|
catch (e) {
|
|
336
|
-
console.
|
|
504
|
+
console.error('parse expanded tree data source nodes failed');
|
|
337
505
|
}
|
|
338
506
|
}
|
|
339
507
|
}
|
|
340
508
|
this.expanded = new SelectionModel(this.metadata.expandMultiple !== false, expanded);
|
|
341
|
-
if (this.metadata
|
|
509
|
+
if (this.metadata['cacheExpanded']) {
|
|
342
510
|
this._expandedLocalStorageSubscription = this.expanded.changed
|
|
343
511
|
.pipe(tap(() => localStorage.setItem(key, JSON.stringify(this.expanded.selected))))
|
|
344
512
|
.subscribe();
|
|
345
513
|
}
|
|
346
514
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* recall the getStyle, getIcon and toDisplay methods
|
|
352
|
-
* and update the node objects
|
|
353
|
-
*/
|
|
354
|
-
updateNodes() {
|
|
355
|
-
this._data$.value.forEach(node => {
|
|
356
|
-
node.style = this.getStyle(node.item);
|
|
357
|
-
node.icon = this.getIcon(node.item);
|
|
358
|
-
node.display = this.toDisplay(node.item);
|
|
359
|
-
});
|
|
360
|
-
this._data$.next(this._data$.value);
|
|
361
|
-
}
|
|
362
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.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 }); }
|
|
363
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: TreeDataSource }); }
|
|
364
|
-
}
|
|
515
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeDataSource, deps: [{ token: RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD }, { token: RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD, optional: true }, { token: RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD, optional: true }, { token: RXAP_DATA_SOURCE_METADATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
516
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeDataSource }); }
|
|
517
|
+
};
|
|
365
518
|
__decorate([
|
|
366
519
|
Required,
|
|
367
520
|
__metadata("design:type", FlatTreeControl)
|
|
368
521
|
], TreeDataSource.prototype, "treeControl", void 0);
|
|
369
|
-
|
|
522
|
+
TreeDataSource = __decorate([
|
|
523
|
+
RxapDataSource('tree'),
|
|
524
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object])
|
|
525
|
+
], TreeDataSource);
|
|
526
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeDataSource, decorators: [{
|
|
370
527
|
type: Injectable
|
|
371
528
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
372
529
|
type: Inject,
|
|
373
530
|
args: [RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD]
|
|
374
531
|
}] }, { type: undefined, decorators: [{
|
|
532
|
+
type: Optional
|
|
533
|
+
}, {
|
|
375
534
|
type: Inject,
|
|
376
535
|
args: [RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD]
|
|
377
536
|
}] }, { type: undefined, decorators: [{
|
|
537
|
+
type: Optional
|
|
538
|
+
}, {
|
|
539
|
+
type: Inject,
|
|
540
|
+
args: [RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD]
|
|
541
|
+
}] }, { type: undefined, decorators: [{
|
|
542
|
+
type: Optional
|
|
543
|
+
}, {
|
|
378
544
|
type: Inject,
|
|
379
545
|
args: [RXAP_DATA_SOURCE_METADATA]
|
|
380
546
|
}] }]; }, propDecorators: { treeControl: [] } });
|
|
@@ -383,15 +549,14 @@ class TreeContentDirective {
|
|
|
383
549
|
constructor(template) {
|
|
384
550
|
this.template = template;
|
|
385
551
|
}
|
|
386
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
387
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
552
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeContentDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
553
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: TreeContentDirective, isStandalone: true, selector: "ng-template[rxapTreeContent]", ngImport: i0 }); }
|
|
388
554
|
}
|
|
389
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
555
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeContentDirective, decorators: [{
|
|
390
556
|
type: Directive,
|
|
391
557
|
args: [{
|
|
392
|
-
// tslint:disable-next-line:directive-selector
|
|
393
558
|
selector: 'ng-template[rxapTreeContent]',
|
|
394
|
-
standalone: true
|
|
559
|
+
standalone: true,
|
|
395
560
|
}]
|
|
396
561
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
397
562
|
type: Inject,
|
|
@@ -401,24 +566,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
401
566
|
const RXAP_TREE_CONTENT_EDITABLE_METHOD = new InjectionToken('rxap/tree-content-editable-method');
|
|
402
567
|
|
|
403
568
|
class TreeComponent {
|
|
404
|
-
|
|
405
|
-
return !!this.contentEditableMethod;
|
|
406
|
-
}
|
|
407
|
-
get cacheId() {
|
|
408
|
-
return ['rxap', 'tree', this.id].join('/');
|
|
409
|
-
}
|
|
410
|
-
constructor(viewContainerRef, cdr, contentEditableMethod, renderer) {
|
|
569
|
+
constructor(viewContainerRef, cdr, contentEditableMethod, renderer, elementRef) {
|
|
411
570
|
this.viewContainerRef = viewContainerRef;
|
|
412
571
|
this.cdr = cdr;
|
|
413
572
|
this.renderer = renderer;
|
|
573
|
+
this.elementRef = elementRef;
|
|
414
574
|
this.multiple = false;
|
|
415
575
|
this.hideLeafIcon = false;
|
|
416
576
|
this.details = new EventEmitter();
|
|
417
577
|
this.dividerOffset = '256px';
|
|
418
578
|
this.portal = null;
|
|
419
|
-
this.
|
|
420
|
-
this.isExpandable = (node) => node.hasChildren;
|
|
421
|
-
this.hasChild = (_, nodeData) => nodeData.hasChildren;
|
|
579
|
+
this.showTreeNavigation = signal(true);
|
|
422
580
|
/**
|
|
423
581
|
* Indicates that the divider is moved with mouse down
|
|
424
582
|
* @private
|
|
@@ -431,9 +589,18 @@ class TreeComponent {
|
|
|
431
589
|
* @private
|
|
432
590
|
*/
|
|
433
591
|
this._treeContainerWidth = null;
|
|
592
|
+
this.getLevel = (node) => node.depth;
|
|
593
|
+
this.isExpandable = (node) => node.hasChildren;
|
|
594
|
+
this.hasChild = (_, nodeData) => nodeData.hasChildren;
|
|
434
595
|
this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);
|
|
435
596
|
this.contentEditableMethod = contentEditableMethod;
|
|
436
597
|
}
|
|
598
|
+
get nodeDisplayEditable() {
|
|
599
|
+
return !!this.contentEditableMethod;
|
|
600
|
+
}
|
|
601
|
+
get cacheId() {
|
|
602
|
+
return ['rxap', 'tree', this.id].join('/');
|
|
603
|
+
}
|
|
437
604
|
ngOnInit() {
|
|
438
605
|
this.dataSource.setTreeControl(this.treeControl);
|
|
439
606
|
this.dataSource.setToDisplay(this.toDisplay);
|
|
@@ -449,7 +616,7 @@ class TreeComponent {
|
|
|
449
616
|
this.setDividerOffset(cachedOffset);
|
|
450
617
|
}
|
|
451
618
|
else if (isDevMode()) {
|
|
452
|
-
console.log(
|
|
619
|
+
console.log('Divider offset cache is not available or invalid: ' + cachedOffset);
|
|
453
620
|
}
|
|
454
621
|
}
|
|
455
622
|
ngAfterContentInit() {
|
|
@@ -481,40 +648,35 @@ class TreeComponent {
|
|
|
481
648
|
if (!this._treeContainerWidth) {
|
|
482
649
|
this._treeContainerWidth = this.treeContainer.nativeElement.clientWidth;
|
|
483
650
|
}
|
|
484
|
-
|
|
651
|
+
const rect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
652
|
+
this._treeContainerWidth = Math.min(Math.max($event.clientX - (rect.left + 12), 128), rect.right - rect.left - 128);
|
|
485
653
|
const offset = this._treeContainerWidth + 'px';
|
|
486
654
|
this.setDividerOffset(offset);
|
|
487
655
|
}
|
|
488
656
|
}
|
|
489
657
|
setDividerOffset(offset) {
|
|
490
|
-
if (isDevMode()) {
|
|
491
|
-
console.log("set divider offset to: " + offset);
|
|
492
|
-
}
|
|
493
658
|
this.dividerOffset = offset;
|
|
494
659
|
this.renderer.setStyle(this.treeContainer.nativeElement, 'max-width', offset);
|
|
495
660
|
this.renderer.setStyle(this.treeContainer.nativeElement, 'min-width', offset);
|
|
496
661
|
this.renderer.setStyle(this.treeContainer.nativeElement, 'flex-basis', offset);
|
|
497
662
|
localStorage.setItem(this.cacheId, offset);
|
|
498
663
|
}
|
|
499
|
-
|
|
500
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: TreeComponent, isStandalone: true, 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: "ngmodule", type: FlexModule }, { kind: "directive", type: i1.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: i1.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: i1.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: i1.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: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: ExtendedModule }, { kind: "directive", type: i2.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: i2.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: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i3.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatTreeModule }, { kind: "directive", type: i4.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "directive", type: i4.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { kind: "directive", type: i4.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { kind: "component", type: i4.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i4.MatTreeNode, selector: "mat-tree-node", inputs: ["role", "disabled", "tabIndex"], exportAs: ["matTreeNode"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i6.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i7.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: ContenteditableDirective, selector: "[rxapContenteditable]", inputs: ["rxapContenteditable", "disabled"], outputs: ["change"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i9.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i10.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
664
|
+
toggleTreeNavigation() {
|
|
665
|
+
this.showTreeNavigation.update((value) => !value);
|
|
666
|
+
}
|
|
667
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeComponent, deps: [{ token: ViewContainerRef }, { token: ChangeDetectorRef }, { token: RXAP_TREE_CONTENT_EDITABLE_METHOD, optional: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
668
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.4", type: TreeComponent, isStandalone: true, 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=\"grow flex flex-col gap-2\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button>\n <span class=\"flex flex-row justify-start items-center gap-6\">\n <ng-template [ngIf]=\"showTreeNavigation()\">\n <mat-icon>arrow_back</mat-icon>\n <span i18n>Hide tree navigation</span>\n </ng-template>\n <ng-template [ngIf]=\"!showTreeNavigation()\">\n <mat-icon>arrow_forward</mat-icon>\n <span i18n>Show tree navigation</span>\n </ng-template>\n </span>\n </button>\n <div class=\"flex flex-row grow\">\n <div #treeContainer [ngClass]=\"{ 'hidden': !showTreeNavigation() }\"\n [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\"\n class=\"w-fit grow-0 overflow-y-auto\">\n <mat-progress-bar *ngIf=\"!dataSource || (dataSource.loading$ | async)\" mode=\"indeterminate\"></mat-progress-bar>\n <ng-content select=\"[searchHeader]\"></ng-content>\n <mat-tree *ngIf=\"dataSource; else loading\" [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n <mat-icon [ngClass]=\"{ 'hidden': hideLeafIcon }\">subdirectory_arrow_right</mat-icon>\n <ng-container *ngIf=\"node.icon?.length\">\n <mat-icon *ngFor=\"let icon of node.icon\" [rxapIcon]=\"$any(icon)\"></mat-icon>\n </ng-container>\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 class=\"grow-0\">\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' : undefined\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0\"\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 class=\"flex flex-row justify-start items-center gap-2\">\n <ng-container *ngIf=\"node.icon?.length else withoutIcon\">\n <mat-icon *ngFor=\"let icon of node.icon\" [rxapIcon]=\"$any(icon)\"></mat-icon>\n </ng-container>\n <ng-template #withoutIcon>\n <div></div>\n </ng-template>\n <ng-template [ngIfElse]=\"withoutDetails\" [ngIf]=\"node.hasDetails\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [ngStyle]=\"node.style\"\n class=\"grow-0\"\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 [ngStyle]=\"node.style\"\n class=\"grow-0\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n </ng-template>\n <mat-progress-spinner\n *ngIf=\"node.isLoading$ | async\"\n [diameter]=\"16\"\n class=\"grow-0 pl-4\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n </div>\n </mat-tree-node>\n\n </mat-tree>\n </div>\n\n <div (mousedown)=\"onMousedown()\" *ngIf=\"showTreeNavigation()\"\n class=\"divider cursor-ew-resize px-3 grow-0\">\n <mat-divider [vertical]=\"true\" class=\"h-full\"></mat-divider>\n </div>\n\n <div class=\"grow\">\n <ng-container *ngIf=\"portal\">\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n </ng-container>\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n<ng-template #loading>Load data source</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatTreeModule }, { 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: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i4.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: ContenteditableDirective, selector: "[rxapContenteditable]", inputs: ["rxapContenteditable", "disabled"], outputs: ["change"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i8.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
501
669
|
}
|
|
502
|
-
__decorate([
|
|
503
|
-
Required,
|
|
504
|
-
__metadata("design:type", TreeDataSource)
|
|
505
|
-
], TreeComponent.prototype, "dataSource", void 0);
|
|
506
670
|
__decorate([
|
|
507
671
|
DebounceCall(100),
|
|
508
672
|
__metadata("design:type", Function),
|
|
509
673
|
__metadata("design:paramtypes", [Node]),
|
|
510
674
|
__metadata("design:returntype", void 0)
|
|
511
675
|
], TreeComponent.prototype, "openDetails", null);
|
|
512
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
676
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeComponent, decorators: [{
|
|
513
677
|
type: Component,
|
|
514
678
|
args: [{ selector: 'rxap-tree', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
515
|
-
FlexModule,
|
|
516
679
|
NgStyle,
|
|
517
|
-
ExtendedModule,
|
|
518
680
|
NgIf,
|
|
519
681
|
MatProgressBarModule,
|
|
520
682
|
MatTreeModule,
|
|
@@ -526,8 +688,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
526
688
|
MatProgressSpinnerModule,
|
|
527
689
|
MatDividerModule,
|
|
528
690
|
PortalModule,
|
|
529
|
-
AsyncPipe
|
|
530
|
-
|
|
691
|
+
AsyncPipe,
|
|
692
|
+
NgClass,
|
|
693
|
+
NgForOf,
|
|
694
|
+
], template: "<div class=\"grow flex flex-col gap-2\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button>\n <span class=\"flex flex-row justify-start items-center gap-6\">\n <ng-template [ngIf]=\"showTreeNavigation()\">\n <mat-icon>arrow_back</mat-icon>\n <span i18n>Hide tree navigation</span>\n </ng-template>\n <ng-template [ngIf]=\"!showTreeNavigation()\">\n <mat-icon>arrow_forward</mat-icon>\n <span i18n>Show tree navigation</span>\n </ng-template>\n </span>\n </button>\n <div class=\"flex flex-row grow\">\n <div #treeContainer [ngClass]=\"{ 'hidden': !showTreeNavigation() }\"\n [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\"\n class=\"w-fit grow-0 overflow-y-auto\">\n <mat-progress-bar *ngIf=\"!dataSource || (dataSource.loading$ | async)\" mode=\"indeterminate\"></mat-progress-bar>\n <ng-content select=\"[searchHeader]\"></ng-content>\n <mat-tree *ngIf=\"dataSource; else loading\" [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n <mat-icon [ngClass]=\"{ 'hidden': hideLeafIcon }\">subdirectory_arrow_right</mat-icon>\n <ng-container *ngIf=\"node.icon?.length\">\n <mat-icon *ngFor=\"let icon of node.icon\" [rxapIcon]=\"$any(icon)\"></mat-icon>\n </ng-container>\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 class=\"grow-0\">\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' : undefined\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0\"\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 class=\"flex flex-row justify-start items-center gap-2\">\n <ng-container *ngIf=\"node.icon?.length else withoutIcon\">\n <mat-icon *ngFor=\"let icon of node.icon\" [rxapIcon]=\"$any(icon)\"></mat-icon>\n </ng-container>\n <ng-template #withoutIcon>\n <div></div>\n </ng-template>\n <ng-template [ngIfElse]=\"withoutDetails\" [ngIf]=\"node.hasDetails\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [ngStyle]=\"node.style\"\n class=\"grow-0\"\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 [ngStyle]=\"node.style\"\n class=\"grow-0\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n </ng-template>\n <mat-progress-spinner\n *ngIf=\"node.isLoading$ | async\"\n [diameter]=\"16\"\n class=\"grow-0 pl-4\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n </div>\n </mat-tree-node>\n\n </mat-tree>\n </div>\n\n <div (mousedown)=\"onMousedown()\" *ngIf=\"showTreeNavigation()\"\n class=\"divider cursor-ew-resize px-3 grow-0\">\n <mat-divider [vertical]=\"true\" class=\"h-full\"></mat-divider>\n </div>\n\n <div class=\"grow\">\n <ng-container *ngIf=\"portal\">\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n </ng-container>\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n<ng-template #loading>Load data source</ng-template>\n" }]
|
|
531
695
|
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef, decorators: [{
|
|
532
696
|
type: Inject,
|
|
533
697
|
args: [ViewContainerRef]
|
|
@@ -539,8 +703,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
539
703
|
}, {
|
|
540
704
|
type: Inject,
|
|
541
705
|
args: [RXAP_TREE_CONTENT_EDITABLE_METHOD]
|
|
542
|
-
}] }, { type: i0.Renderer2 }]; }, propDecorators: { dataSource: [{
|
|
543
|
-
type: Input
|
|
706
|
+
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { dataSource: [{
|
|
707
|
+
type: Input,
|
|
708
|
+
args: [{ required: true }]
|
|
544
709
|
}], contentEditableMethod: [{
|
|
545
710
|
type: Input
|
|
546
711
|
}], toDisplay: [{
|
|
@@ -579,5 +744,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
579
744
|
* Generated bundle index. Do not edit.
|
|
580
745
|
*/
|
|
581
746
|
|
|
582
|
-
export { RXAP_TREE_CONTENT_EDITABLE_METHOD, RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD, RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD, TreeComponent, TreeContentDirective, TreeDataSource, isSelectionChange };
|
|
747
|
+
export { DefaultTreeApplyFilterMethod, RXAP_TREE_CONTENT_EDITABLE_METHOD, RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD, RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD, RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD, TreeComponent, TreeContentDirective, TreeDataSource, flatTree, isSelectionChange };
|
|
583
748
|
//# sourceMappingURL=rxap-tree.mjs.map
|