@rxap/tree 16.0.0-dev.9 → 16.0.1-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +1,174 @@
1
- import { BehaviorSubject, Subject, from, merge } from 'rxjs';
1
+ import { __decorate, __metadata } from 'tslib';
2
2
  import { SelectionModel } from '@angular/cdk/collections';
3
- import { map, tap, switchMap, startWith } from 'rxjs/operators';
4
- import { BaseDataSource, RXAP_DATA_SOURCE_METADATA } from '@rxap/data-source';
5
- import { joinPath, DebounceCall } from '@rxap/utilities';
3
+ import { FlatTreeControl } from '@angular/cdk/tree';
6
4
  import * as i0 from '@angular/core';
7
- import { InjectionToken, isDevMode, Injectable, Inject, TemplateRef, Directive, EventEmitter, ViewContainerRef, ChangeDetectorRef, Component, ChangeDetectionStrategy, Optional, Input, ContentChild, Output, ViewChild, HostListener } from '@angular/core';
5
+ import { InjectionToken, isDevMode, Injectable, Inject, Optional, TemplateRef, Directive, INJECTOR, SkipSelf, 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';
8
7
  import { Node } from '@rxap/data-structure-tree';
9
8
  import { ToggleSubject } from '@rxap/rxjs';
10
- import { __decorate, __metadata } from 'tslib';
11
- import * as i10 from '@angular/cdk/portal';
9
+ import { coerceArray, getIdentifierPropertyValue, 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 { FlatTreeControl } from '@angular/cdk/tree';
14
- import { NgStyle, NgIf, AsyncPipe } from '@angular/common';
15
- import * as i2 from '@angular/flex-layout/extended';
16
- import { ExtendedModule } from '@angular/flex-layout/extended';
17
- import * as i1 from '@angular/flex-layout/flex';
18
- import { FlexModule } from '@angular/flex-layout/flex';
19
- 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';
20
16
  import { MatButtonModule } from '@angular/material/button';
21
- import * as i6 from '@angular/material/checkbox';
17
+ import * as i4 from '@angular/material/checkbox';
22
18
  import { MatCheckboxModule } from '@angular/material/checkbox';
23
- import * as i9 from '@angular/material/divider';
19
+ import * as i7 from '@angular/material/divider';
24
20
  import { MatDividerModule } from '@angular/material/divider';
25
- import * as i5 from '@angular/material/icon';
21
+ import * as i3 from '@angular/material/icon';
26
22
  import { MatIconModule } from '@angular/material/icon';
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 i8 from '@angular/material/progress-spinner';
25
+ import * as i6 from '@angular/material/progress-spinner';
30
26
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
31
- import * as i4 from '@angular/material/tree';
27
+ import * as i2 from '@angular/material/tree';
32
28
  import { MatTreeModule } from '@angular/material/tree';
33
29
  import { ContenteditableDirective } from '@rxap/contenteditable';
34
30
  import { IconDirective } from '@rxap/material-directives/icon';
31
+ import { UseFormControl, RxapFormControl, RxapForm, RxapFormBuilder, RXAP_FORM_DEFINITION, RXAP_FORM_INITIAL_STATE } from '@rxap/forms';
35
32
 
36
33
  function isSelectionChange(obj) {
37
- return !!obj && !!obj['added'] && !!obj['removed'];
34
+ return !!obj && obj['added'] !== undefined && obj['removed'] !== undefined;
38
35
  }
39
36
  const RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD = new InjectionToken('rxap/tree/data-source/root-remote-method');
40
37
  const RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD = new InjectionToken('rxap/tree/data-source/children-remote-method');
41
- class TreeDataSource extends BaseDataSource {
42
- constructor(rootRemoteMethod, childrenRemoteMethod, metadata = null) {
38
+ const RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD = new InjectionToken('rxap/tree/data-source/apply-filter-method');
39
+ function flatTree(tree, all = false) {
40
+ tree = coerceArray(tree);
41
+ function flat(acc, list) {
42
+ return [...acc, ...list];
43
+ }
44
+ const _flatTree = (node) => {
45
+ if (!Array.isArray(node.children)) {
46
+ if (isDevMode()) {
47
+ console.log(node);
48
+ }
49
+ throw new Error('Node has not defined children');
50
+ }
51
+ if (all || node.expanded) {
52
+ return [
53
+ node,
54
+ ...node.children.map((child) => _flatTree(child)).reduce(flat, []),
55
+ ];
56
+ }
57
+ else {
58
+ return [node];
59
+ }
60
+ };
61
+ return tree
62
+ .map((child) => _flatTree(child))
63
+ .reduce((acc, items) => [...acc, ...items], []);
64
+ }
65
+ class DefaultTreeApplyFilterMethod {
66
+ constructor() {
67
+ this.lastFilter = null;
68
+ }
69
+ call({ tree, filter, scopeTypes }) {
70
+ const nodes = flatTree(tree, true);
71
+ if (this.isEqualToLastFilter(filter)) {
72
+ return flatTree(tree, false).filter(node => node.isVisible);
73
+ }
74
+ const hasScopeFilter = (filter.scope &&
75
+ Object.keys(filter.scope) &&
76
+ Object.values(filter.scope).some((list) => list.length > 0));
77
+ // if not scope and the search filter is an empty string, collapse all non-root nodes
78
+ if (!filter.search && filter.search !== this.lastFilter?.search) {
79
+ nodes
80
+ .filter(node => node.parent)
81
+ .forEach(node => node.collapse({ quite: true }));
82
+ }
83
+ if (filter.search || hasScopeFilter) {
84
+ nodes.forEach(node => node.hide());
85
+ for (const [type, list] of Object.entries(filter.scope ?? {})) {
86
+ for (const node of nodes) {
87
+ if (node.type === type) {
88
+ if (list.some(item => getIdentifierPropertyValue(item) === node.id)) {
89
+ node.show({ forEachChildren: true });
90
+ }
91
+ }
92
+ }
93
+ }
94
+ if (filter.search) {
95
+ for (const node of nodes) {
96
+ if (hasScopeFilter && node.hidden) {
97
+ // if the filter has a scope filter. Only check the search filter on nodes that are shown by the scope
98
+ // filter
99
+ continue;
100
+ }
101
+ const display = node.display?.toLowerCase();
102
+ if (display) {
103
+ if (display.includes(filter.search.toLowerCase())) {
104
+ node.show({ parents: true });
105
+ }
106
+ else {
107
+ node.hide();
108
+ }
109
+ }
110
+ else {
111
+ // if node has no display, it is not shown
112
+ node.hide();
113
+ }
114
+ }
115
+ // hide each node that has no visible children
116
+ // there exists the edge case that a node has visible children, but the node.hide() function is called
117
+ // after the child.show({ parent:true })
118
+ for (const node of nodes.filter(n => n.hidden && n.hasChildren && n.children.some(child => child.isVisible))) {
119
+ if (node.hidden) {
120
+ console.warn('Edge case detected. Node has visible children but is hidden.');
121
+ node.show();
122
+ }
123
+ }
124
+ // expand each node that has visible children
125
+ for (const node of nodes.filter(n => n.hasChildren)) {
126
+ if (node.children.some(child => child.isVisible)) {
127
+ // set quite to true to prevent the tree from reloading -> this would result in a infinite loop
128
+ node.expand({ quite: true });
129
+ }
130
+ }
131
+ }
132
+ }
133
+ else {
134
+ nodes.forEach(node => node.show());
135
+ }
136
+ this.lastFilter = filter;
137
+ return flatTree(tree, false).filter(node => node.isVisible);
138
+ }
139
+ isEqualToLastFilter(filter) {
140
+ if (this.lastFilter) {
141
+ if (this.lastFilter.search === filter.search) {
142
+ if (this.lastFilter.scope && filter.scope) {
143
+ if (Object.keys(this.lastFilter.scope).every(key => Object.keys(filter.scope).includes(key))) {
144
+ if (Object.entries(this.lastFilter.scope)
145
+ .every(([key, scope]) => scope.some(item => filter.scope[key].includes(item)))) {
146
+ return true;
147
+ }
148
+ }
149
+ }
150
+ if (filter.scope === this.lastFilter.scope) {
151
+ return true;
152
+ }
153
+ }
154
+ }
155
+ return false;
156
+ }
157
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DefaultTreeApplyFilterMethod, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
158
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DefaultTreeApplyFilterMethod }); }
159
+ }
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DefaultTreeApplyFilterMethod, decorators: [{
161
+ type: Injectable
162
+ }] });
163
+ let TreeDataSource = class TreeDataSource extends BaseDataSource {
164
+ constructor(rootRemoteMethod, childrenRemoteMethod = null, applyFilterMethod = null, metadata = null) {
43
165
  super(metadata);
44
166
  this.rootRemoteMethod = rootRemoteMethod;
45
167
  this.childrenRemoteMethod = childrenRemoteMethod;
46
168
  this.tree$ = new BehaviorSubject([]);
47
- this.loading$ = new ToggleSubject(true);
48
169
  // TODO : änlich problem wie bei der redundaten expand SelectionModel.
170
+ this.loading$ = new ToggleSubject(true);
171
+ this.searchForm = null;
49
172
  this._data$ = new BehaviorSubject([]);
50
173
  this._expandedLocalStorageSubscription = null;
51
174
  this._selectedLocalStorageSubscription = null;
@@ -55,14 +178,11 @@ class TreeDataSource extends BaseDataSource {
55
178
  this._nodeParameters = null;
56
179
  this.toDisplay = () => 'to display function not defined';
57
180
  this.getIcon = () => null;
181
+ this.getType = () => null;
58
182
  this.getStyle = () => ({});
59
183
  this.hasDetails = () => true;
60
184
  this.matchFilter = () => true;
61
- this.tree$
62
- .pipe(map((tree) => tree
63
- .map((child) => this.flatTree(child))
64
- .reduce((acc, nodes) => [...acc, ...nodes], [])))
65
- .subscribe(this._data$);
185
+ this.applyFilterMethod = applyFilterMethod ?? new DefaultTreeApplyFilterMethod();
66
186
  // TODO add new SelectModel class that saves the select model to the localStorage
67
187
  this.initSelected();
68
188
  this.initExpanded();
@@ -74,15 +194,31 @@ class TreeDataSource extends BaseDataSource {
74
194
  this._nodeParameters = nodeParameters;
75
195
  this.tree$.value.forEach(node => node.parameters = nodeParameters);
76
196
  }
77
- async getTreeRoot() {
197
+ ngOnInit() {
198
+ if (this.searchForm) {
199
+ combineLatest([
200
+ this.tree$,
201
+ this.searchForm.rxapFormGroup.value$,
202
+ ]).pipe(switchMap(async ([tree, filter]) => await this.applyFilterMethod.call({
203
+ tree,
204
+ filter,
205
+ scopeTypes: this.metadata?.scopeTypes,
206
+ })), map(nodes => coerceArray(nodes)))
207
+ .subscribe(data => this._data$.next(data));
208
+ }
209
+ else {
210
+ this.tree$.pipe(map(tree => flatTree(tree).filter(node => node.isVisible)), tap(nodes => nodes.forEach(node => node.show()))).subscribe(data => this._data$.next(data));
211
+ }
212
+ }
213
+ async getTreeRoot(options = {}) {
78
214
  this.loading$.enable();
79
- const root = await this.getRoot();
215
+ const root = await this.getRoot(options);
80
216
  let rootNodes;
81
217
  if (Array.isArray(root)) {
82
- rootNodes = await Promise.all(root.map((node) => this._toNode(node)));
218
+ rootNodes = await Promise.all(root.map((node) => this._toNode(null, node)));
83
219
  }
84
220
  else {
85
- rootNodes = [await this._toNode(root)];
221
+ rootNodes = [await this._toNode(null, root)];
86
222
  }
87
223
  this.tree$.next(rootNodes);
88
224
  this.loading$.disable();
@@ -118,52 +254,68 @@ class TreeDataSource extends BaseDataSource {
118
254
  return Promise.resolve();
119
255
  }
120
256
  // - the SelectModel that stores the selection into the local storage?
121
- 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)) {
122
- const node = await this.toNode(item, depth, onExpand, onCollapse, onSelect, onDeselect);
257
+ 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)) {
258
+ const node = await this.toNode(parent, item, depth, onExpand, onCollapse, onSelect, onDeselect);
123
259
  if (this.expanded.isSelected(node.id)) {
124
260
  node
125
261
  .expand()
126
262
  .then(() => {
127
- // TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in this.treeControl.expansionModel
128
- // das problem ist das ich beim speicher in localStorage nur die id speicher.
129
- // Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel
130
- // nicht einfach mit den expanend nodes fullen. Da dort das node object benötigt wird
131
- // möglich lösungen:
132
- // - das node object läde die entity mithilfe der id automatisch nach
263
+ // TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in
264
+ // this.treeControl.expansionModel das problem ist das ich beim speicher in localStorage nur die id speicher.
265
+ // Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel nicht einfach mit den
266
+ // expanend nodes fullen. Da dort das node object benötigt wird möglich lösungen: - das node object läde die
267
+ // entity mithilfe der id automatisch nach
133
268
  this.treeControl.expansionModel.select(node);
134
- console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
135
- })
136
- .catch(() => console.debug(`Restore expand for node '${node.id}' FAILED`));
269
+ // console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
270
+ });
271
+ // .catch(() =>
272
+ // console.debug(`Restore expand for node '${node.id}' FAILED`)
273
+ // );
137
274
  }
138
275
  if (this._preSelected.includes(node.id)) {
139
276
  await node
140
- .select()
141
- .then(() => console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`))
142
- .catch(() => console.debug(`Restore select for node '${node.id}' FAILED`));
277
+ .select();
278
+ // .then(() =>
279
+ // console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`)
280
+ // )
281
+ // .catch(() =>
282
+ // console.debug(`Restore select for node '${node.id}' FAILED`)
283
+ // );
143
284
  }
144
285
  return node;
145
286
  }
146
- async expandNode(node) {
287
+ async expandNode(node, options) {
288
+ if (!options?.onlySelf) {
289
+ // required to sync the expanstion state with the tree control
290
+ // if the collpase is trigged by node.expand this state is not
291
+ // sync with the tree control
292
+ this.treeControl.expansionModel.select(node);
293
+ }
147
294
  if (node.item.hasChildren && !node.item.children?.length) {
148
295
  node.isLoading$.enable();
149
296
  const children = await this.getChildren(node);
150
297
  // add the loaded children to the item object
151
298
  node.item.children = children;
152
- node.addChildren(await Promise.all(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse))));
299
+ node.addChildren(await Promise.all(children.map((child) => this._toNode(node, child, node.depth + 1, node.onExpand, node.onCollapse))));
153
300
  node.isLoading$.disable();
154
301
  }
155
302
  this.expanded.select(node.id);
156
- this.tree$.next(this.tree$.value);
303
+ if (!options?.quite) {
304
+ this.tree$.next(this.tree$.value);
305
+ }
157
306
  }
158
307
  async getChildren(node) {
308
+ if (!this.childrenRemoteMethod) {
309
+ throw new Error(`The node '${node.id}' has unloaded children but the RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD is not provided.`);
310
+ }
159
311
  return this.childrenRemoteMethod.call(node);
160
312
  }
161
- async getRoot() {
162
- const rootParameters = await this.getRootParameters();
313
+ async getRoot(options = {}) {
314
+ const rootParameters = await this.getRootParameters(options);
163
315
  return this.rootRemoteMethod.call(rootParameters);
164
316
  }
165
- async getRootParameters() {
166
- return undefined;
317
+ async getRootParameters(options = {}) {
318
+ return options;
167
319
  }
168
320
  // TODO : find better solution to allow the overwrite of the toNode method
169
321
  // without losing the custom preselect and preexpand function
@@ -183,36 +335,30 @@ class TreeDataSource extends BaseDataSource {
183
335
  .map((node) => getNodeById(node, id))
184
336
  .filter(Boolean)[0] || null);
185
337
  }
186
- 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)) {
187
- return Node.ToNode(item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, onSelect, onDeselect, this.hasDetails, this.getStyle, this.nodeParameters);
338
+ 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)) {
339
+ return Node.ToNode(parent, item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, this.getType, onSelect, onDeselect, this.hasDetails, this.getStyle, this.nodeParameters);
188
340
  }
189
- collapseNode(node) {
341
+ collapseNode(node, options) {
342
+ if (!options?.onlySelf) {
343
+ // required to sync the expanstion state with the tree control
344
+ // if the collpase is trigged by node.colapse this state is not
345
+ // sync with the tree control
346
+ this.treeControl.expansionModel.deselect(node);
347
+ }
190
348
  this.expanded.deselect(node.id);
191
- this.tree$.next(this.tree$.value);
349
+ if (!options?.quite) {
350
+ this.tree$.next(this.tree$.value);
351
+ }
192
352
  return Promise.resolve();
193
353
  }
194
- flatTree(tree) {
195
- function flat(acc, list) {
196
- return [...acc, ...list];
197
- }
198
- const flatTree = (node) => {
199
- if (!Array.isArray(node.children)) {
200
- if (isDevMode()) {
201
- console.log(node);
202
- }
203
- throw new Error('Node has not defined children');
204
- }
205
- if (node.expanded || this.expanded.isSelected(node.id)) {
206
- return [
207
- node,
208
- ...node.children.map((child) => flatTree(child)).reduce(flat, []),
209
- ];
210
- }
211
- else {
212
- return [node];
213
- }
214
- };
215
- return flatTree(tree);
354
+ /**
355
+ * Converts the tree structure into a list.
356
+ *
357
+ * @param tree
358
+ * @param all true - include nodes children that are not expanded
359
+ */
360
+ flatTree(tree, all = false) {
361
+ return flatTree(tree, all);
216
362
  }
217
363
  destroy() {
218
364
  super.destroy();
@@ -228,7 +374,7 @@ class TreeDataSource extends BaseDataSource {
228
374
  this._refreshMatchFilter.next();
229
375
  }
230
376
  async refresh() {
231
- const rootNodes = await this.getTreeRoot();
377
+ const rootNodes = await this.getTreeRoot({ cache: false });
232
378
  // refresh all expanded nodes;
233
379
  const loadExpandedNodes = async (children) => {
234
380
  for (const child of children) {
@@ -245,11 +391,11 @@ class TreeDataSource extends BaseDataSource {
245
391
  await Promise.all(rootNodes
246
392
  .filter((node) => node.hasChildren)
247
393
  .map((node) => loadExpandedNodes(node.children)));
248
- const selected = this.selected.selected
249
- .map((node) => this.getNodeById(node.id))
250
- .filter(Boolean);
251
- this.selected.clear();
252
- this.selected.select(...selected);
394
+ // const selected: Array<Node<Data>> = this.selected.selected
395
+ // .map((node) => this.getNodeById(node.id))
396
+ // .filter(Boolean) as any;
397
+ // this.selected.clear();
398
+ // this.selected.select(...selected);
253
399
  }
254
400
  reset() {
255
401
  this.selected.clear();
@@ -259,6 +405,9 @@ class TreeDataSource extends BaseDataSource {
259
405
  setGetStyle(getStyle = this.getStyle) {
260
406
  this.getStyle = getStyle;
261
407
  }
408
+ setGetType(getType = this.getType) {
409
+ this.getType = getType;
410
+ }
262
411
  /**
263
412
  * recall the getStyle, getIcon and toDisplay methods
264
413
  * and update the node objects
@@ -266,29 +415,39 @@ class TreeDataSource extends BaseDataSource {
266
415
  updateNodes() {
267
416
  this._data$.value.forEach(node => {
268
417
  node.style = this.getStyle(node.item);
269
- node.icon = this.getIcon(node.item);
418
+ node.icon = coerceArray(this.getIcon(node.item));
270
419
  node.display = this.toDisplay(node.item);
271
420
  });
272
421
  this._data$.next(this._data$.value);
273
422
  }
274
423
  _connect(collectionViewer) {
275
- this.treeControl.expansionModel.changed.subscribe((change) => {
424
+ this.init();
425
+ this.treeControl.expansionModel.changed.pipe(tap(async (change) => {
276
426
  if (isSelectionChange(change)) {
427
+ const promiseList = [];
277
428
  if (change.added) {
278
- change.added.forEach((node) => node.expand());
429
+ promiseList.push(...change.added.map((node) => node.expand({ onlySelf: true, quite: true })));
279
430
  }
280
431
  if (change.removed) {
281
- change.removed
432
+ promiseList.push(...change.removed
282
433
  .slice()
283
434
  .reverse()
284
- .forEach((node) => node.collapse());
435
+ .map((node) => node.collapse({ onlySelf: true, quite: true })));
285
436
  }
437
+ await Promise.all(promiseList);
438
+ this.tree$.next(this.tree$.value);
286
439
  }
287
- });
440
+ })).subscribe();
288
441
  let loadRoot = Promise.resolve();
289
442
  if (this.tree$.value.length === 0) {
290
443
  loadRoot = this.getTreeRoot();
291
444
  }
445
+ if (this.metadata.autoRefreshWithoutCache) {
446
+ loadRoot = loadRoot.then(data => {
447
+ this.refresh();
448
+ return data;
449
+ });
450
+ }
292
451
  return from(loadRoot).pipe(tap((rootNodes) => {
293
452
  if (rootNodes) {
294
453
  const promises = [];
@@ -329,7 +488,7 @@ class TreeDataSource extends BaseDataSource {
329
488
  this._preSelected = JSON.parse(localStorage.getItem(key));
330
489
  }
331
490
  catch (e) {
332
- console.debug('parse expanded tree data source nodes failed');
491
+ console.error('parse expanded tree data source nodes failed');
333
492
  }
334
493
  }
335
494
  }
@@ -349,7 +508,7 @@ class TreeDataSource extends BaseDataSource {
349
508
  expanded = JSON.parse(localStorage.getItem(key));
350
509
  }
351
510
  catch (e) {
352
- console.debug('parse expanded tree data source nodes failed');
511
+ console.error('parse expanded tree data source nodes failed');
353
512
  }
354
513
  }
355
514
  }
@@ -360,21 +519,38 @@ class TreeDataSource extends BaseDataSource {
360
519
  .subscribe();
361
520
  }
362
521
  }
363
- 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 }, { token: RXAP_DATA_SOURCE_METADATA }], target: i0.ɵɵFactoryTarget.Injectable }); }
522
+ 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 }); }
364
523
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeDataSource }); }
365
- }
524
+ };
525
+ __decorate([
526
+ Required,
527
+ __metadata("design:type", FlatTreeControl)
528
+ ], TreeDataSource.prototype, "treeControl", void 0);
529
+ TreeDataSource = __decorate([
530
+ RxapDataSource('tree'),
531
+ __metadata("design:paramtypes", [Object, Object, Object, Object])
532
+ ], TreeDataSource);
366
533
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeDataSource, decorators: [{
367
534
  type: Injectable
368
535
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
369
536
  type: Inject,
370
537
  args: [RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD]
371
538
  }] }, { type: undefined, decorators: [{
539
+ type: Optional
540
+ }, {
372
541
  type: Inject,
373
542
  args: [RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD]
374
543
  }] }, { type: undefined, decorators: [{
544
+ type: Optional
545
+ }, {
546
+ type: Inject,
547
+ args: [RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD]
548
+ }] }, { type: undefined, decorators: [{
549
+ type: Optional
550
+ }, {
375
551
  type: Inject,
376
552
  args: [RXAP_DATA_SOURCE_METADATA]
377
- }] }]; } });
553
+ }] }]; }, propDecorators: { treeControl: [] } });
378
554
 
379
555
  class TreeContentDirective {
380
556
  constructor(template) {
@@ -396,16 +572,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
396
572
 
397
573
  const RXAP_TREE_CONTENT_EDITABLE_METHOD = new InjectionToken('rxap/tree-content-editable-method');
398
574
 
575
+ let SearchForm = class SearchForm {
576
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SearchForm, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
577
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SearchForm }); }
578
+ };
579
+ __decorate([
580
+ UseFormControl(),
581
+ __metadata("design:type", RxapFormControl)
582
+ ], SearchForm.prototype, "search", void 0);
583
+ __decorate([
584
+ UseFormControl(),
585
+ __metadata("design:type", RxapFormControl)
586
+ ], SearchForm.prototype, "scope", void 0);
587
+ SearchForm = __decorate([
588
+ RxapForm({
589
+ id: 'search',
590
+ autoSubmit: 500,
591
+ })
592
+ ], SearchForm);
593
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SearchForm, decorators: [{
594
+ type: Injectable
595
+ }], propDecorators: { search: [], scope: [] } });
596
+ function FormFactory(injector, state, existingFormDefinition) {
597
+ if (existingFormDefinition) {
598
+ return existingFormDefinition;
599
+ }
600
+ return new RxapFormBuilder(SearchForm, injector).build(state ?? {});
601
+ }
602
+ const SearchFormProviders = [
603
+ SearchForm,
604
+ {
605
+ provide: RXAP_FORM_DEFINITION,
606
+ useFactory: FormFactory,
607
+ deps: [
608
+ INJECTOR,
609
+ [new Optional(), RXAP_FORM_INITIAL_STATE],
610
+ [new SkipSelf(), new Optional(), RXAP_FORM_DEFINITION],
611
+ ],
612
+ },
613
+ ];
614
+
399
615
  class TreeComponent {
400
- constructor(viewContainerRef, cdr, contentEditableMethod, renderer) {
616
+ constructor(viewContainerRef, cdr, contentEditableMethod, renderer, elementRef, searchForm) {
401
617
  this.viewContainerRef = viewContainerRef;
402
618
  this.cdr = cdr;
403
619
  this.renderer = renderer;
620
+ this.elementRef = elementRef;
621
+ this.searchForm = searchForm;
404
622
  this.multiple = false;
405
623
  this.hideLeafIcon = false;
406
624
  this.details = new EventEmitter();
407
625
  this.dividerOffset = '256px';
408
626
  this.portal = null;
627
+ this.showTreeNavigation = signal(true);
409
628
  /**
410
629
  * Indicates that the divider is moved with mouse down
411
630
  * @private
@@ -431,11 +650,13 @@ class TreeComponent {
431
650
  return ['rxap', 'tree', this.id].join('/');
432
651
  }
433
652
  ngOnInit() {
653
+ this.dataSource.searchForm = this.searchForm;
434
654
  this.dataSource.setTreeControl(this.treeControl);
435
655
  this.dataSource.setToDisplay(this.toDisplay);
436
656
  this.dataSource.setGetIcon(this.getIcon);
437
657
  this.dataSource.setHasDetails(this.hasDetails);
438
658
  this.dataSource.setGetStyle(this.getStyle);
659
+ this.dataSource.setGetType(this.getType);
439
660
  this.multiple = this.dataSource.metadata.selectMultiple ?? this.multiple;
440
661
  if (this.dataSource.selected.hasValue()) {
441
662
  this.dataSource.selected.selected.forEach((node) => this.openDetails(node));
@@ -477,23 +698,24 @@ class TreeComponent {
477
698
  if (!this._treeContainerWidth) {
478
699
  this._treeContainerWidth = this.treeContainer.nativeElement.clientWidth;
479
700
  }
480
- this._treeContainerWidth = $event.clientX - 75;
701
+ const rect = this.elementRef.nativeElement.getBoundingClientRect();
702
+ this._treeContainerWidth = Math.min(Math.max($event.clientX - (rect.left + 12), 128), rect.right - rect.left - 128);
481
703
  const offset = this._treeContainerWidth + 'px';
482
704
  this.setDividerOffset(offset);
483
705
  }
484
706
  }
707
+ toggleTreeNavigation() {
708
+ this.showTreeNavigation.update((value) => !value);
709
+ }
485
710
  setDividerOffset(offset) {
486
- if (isDevMode()) {
487
- console.log('set divider offset to: ' + offset);
488
- }
489
711
  this.dividerOffset = offset;
490
712
  this.renderer.setStyle(this.treeContainer.nativeElement, 'max-width', offset);
491
713
  this.renderer.setStyle(this.treeContainer.nativeElement, 'min-width', offset);
492
714
  this.renderer.setStyle(this.treeContainer.nativeElement, 'flex-basis', offset);
493
715
  localStorage.setItem(this.cacheId, offset);
494
716
  }
495
- 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 }], target: i0.ɵɵFactoryTarget.Component }); }
496
- 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=\"container\" fxLayout=\"row\">\n <div #treeContainer [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\"\n 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\"\n 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 [ngStyle]=\"node.style\"\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 [ngStyle]=\"node.style\"\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"], 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 }); }
717
+ 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 }, { token: RXAP_FORM_DEFINITION, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
718
+ 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", getType: "getType", 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 justify-start items-start\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button type=\"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 w-full\">\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 type=\"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 type=\"button\">\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 type=\"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 }); }
497
719
  }
498
720
  __decorate([
499
721
  DebounceCall(100),
@@ -504,9 +726,7 @@ __decorate([
504
726
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: TreeComponent, decorators: [{
505
727
  type: Component,
506
728
  args: [{ selector: 'rxap-tree', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
507
- FlexModule,
508
729
  NgStyle,
509
- ExtendedModule,
510
730
  NgIf,
511
731
  MatProgressBarModule,
512
732
  MatTreeModule,
@@ -519,7 +739,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
519
739
  MatDividerModule,
520
740
  PortalModule,
521
741
  AsyncPipe,
522
- ], template: "<div class=\"container\" fxLayout=\"row\">\n <div #treeContainer [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\"\n 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\"\n 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 [ngStyle]=\"node.style\"\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 [ngStyle]=\"node.style\"\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"] }]
742
+ NgClass,
743
+ NgForOf,
744
+ ], template: "<div class=\"grow flex flex-col gap-2 justify-start items-start\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button type=\"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 w-full\">\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 type=\"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 type=\"button\">\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 type=\"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" }]
523
745
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef, decorators: [{
524
746
  type: Inject,
525
747
  args: [ViewContainerRef]
@@ -531,7 +753,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
531
753
  }, {
532
754
  type: Inject,
533
755
  args: [RXAP_TREE_CONTENT_EDITABLE_METHOD]
534
- }] }, { type: i0.Renderer2 }]; }, propDecorators: { dataSource: [{
756
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: SearchForm, decorators: [{
757
+ type: Optional
758
+ }, {
759
+ type: Inject,
760
+ args: [RXAP_FORM_DEFINITION]
761
+ }] }]; }, propDecorators: { dataSource: [{
535
762
  type: Input,
536
763
  args: [{ required: true }]
537
764
  }], contentEditableMethod: [{
@@ -540,6 +767,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
540
767
  type: Input
541
768
  }], getIcon: [{
542
769
  type: Input
770
+ }], getType: [{
771
+ type: Input
543
772
  }], getStyle: [{
544
773
  type: Input
545
774
  }], multiple: [{
@@ -572,5 +801,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
572
801
  * Generated bundle index. Do not edit.
573
802
  */
574
803
 
575
- export { RXAP_TREE_CONTENT_EDITABLE_METHOD, RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD, RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD, TreeComponent, TreeContentDirective, TreeDataSource, isSelectionChange };
804
+ 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 };
576
805
  //# sourceMappingURL=rxap-tree.mjs.map