@rxap/tree 18.0.2 → 18.0.3-dev.1

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.
Files changed (126) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +14 -1
  3. package/compodoc/changelog.html +571 -0
  4. package/compodoc/components/TreeComponent.html +2049 -0
  5. package/compodoc/dependencies.html +219 -0
  6. package/compodoc/directives/TreeContentDirective.html +387 -0
  7. package/compodoc/fonts/ionicons.eot +0 -0
  8. package/compodoc/fonts/ionicons.svg +2090 -0
  9. package/compodoc/fonts/ionicons.ttf +0 -0
  10. package/compodoc/fonts/ionicons.woff +0 -0
  11. package/compodoc/fonts/ionicons.woff2 +0 -0
  12. package/compodoc/fonts/roboto-v15-latin-300.eot +0 -0
  13. package/compodoc/fonts/roboto-v15-latin-300.svg +314 -0
  14. package/compodoc/fonts/roboto-v15-latin-300.ttf +0 -0
  15. package/compodoc/fonts/roboto-v15-latin-300.woff +0 -0
  16. package/compodoc/fonts/roboto-v15-latin-300.woff2 +0 -0
  17. package/compodoc/fonts/roboto-v15-latin-700.eot +0 -0
  18. package/compodoc/fonts/roboto-v15-latin-700.svg +310 -0
  19. package/compodoc/fonts/roboto-v15-latin-700.ttf +0 -0
  20. package/compodoc/fonts/roboto-v15-latin-700.woff +0 -0
  21. package/compodoc/fonts/roboto-v15-latin-700.woff2 +0 -0
  22. package/compodoc/fonts/roboto-v15-latin-italic.eot +0 -0
  23. package/compodoc/fonts/roboto-v15-latin-italic.svg +323 -0
  24. package/compodoc/fonts/roboto-v15-latin-italic.ttf +0 -0
  25. package/compodoc/fonts/roboto-v15-latin-italic.woff +0 -0
  26. package/compodoc/fonts/roboto-v15-latin-italic.woff2 +0 -0
  27. package/compodoc/fonts/roboto-v15-latin-regular.eot +0 -0
  28. package/compodoc/fonts/roboto-v15-latin-regular.svg +308 -0
  29. package/compodoc/fonts/roboto-v15-latin-regular.ttf +0 -0
  30. package/compodoc/fonts/roboto-v15-latin-regular.woff +0 -0
  31. package/compodoc/fonts/roboto-v15-latin-regular.woff2 +0 -0
  32. package/compodoc/graph/dependencies.svg +24 -0
  33. package/compodoc/images/compodoc-vectorise-inverted.png +0 -0
  34. package/compodoc/images/compodoc-vectorise-inverted.svg +201 -0
  35. package/compodoc/images/compodoc-vectorise.png +0 -0
  36. package/compodoc/images/compodoc-vectorise.svg +201 -0
  37. package/compodoc/images/favicon.ico +0 -0
  38. package/compodoc/index.html +200 -0
  39. package/compodoc/injectables/DefaultTreeApplyFilterMethod.html +1226 -0
  40. package/compodoc/injectables/SearchForm.html +420 -0
  41. package/compodoc/injectables/TreeDataSource.html +3572 -0
  42. package/compodoc/interfaces/ISearchForm.html +379 -0
  43. package/compodoc/interfaces/TreeApplyFilterParameter.html +1145 -0
  44. package/compodoc/interfaces/TreeDataSourceMetadata.html +1214 -0
  45. package/compodoc/js/compodoc.js +14 -0
  46. package/compodoc/js/lazy-load-graphs.js +44 -0
  47. package/compodoc/js/libs/EventDispatcher.js +5 -0
  48. package/compodoc/js/libs/bootstrap-native.js +2 -0
  49. package/compodoc/js/libs/clipboard.min.js +7 -0
  50. package/compodoc/js/libs/custom-elements-es5-adapter.js +15 -0
  51. package/compodoc/js/libs/custom-elements.min.js +38 -0
  52. package/compodoc/js/libs/d3.v3.min.js +2 -0
  53. package/compodoc/js/libs/deep-iterator.js +2 -0
  54. package/compodoc/js/libs/es6-shim.min.js +12 -0
  55. package/compodoc/js/libs/htmlparser.js +23 -0
  56. package/compodoc/js/libs/innersvg.js +9 -0
  57. package/compodoc/js/libs/lit-html.js +1 -0
  58. package/compodoc/js/libs/prism.js +46 -0
  59. package/compodoc/js/libs/promise.min.js +6 -0
  60. package/compodoc/js/libs/svg-pan-zoom.min.js +3 -0
  61. package/compodoc/js/libs/tablesort.min.js +6 -0
  62. package/compodoc/js/libs/tablesort.number.min.js +6 -0
  63. package/compodoc/js/libs/vis.min.js +47 -0
  64. package/compodoc/js/libs/zepto.min.js +2 -0
  65. package/compodoc/js/menu-wc.js +149 -0
  66. package/compodoc/js/menu-wc_es5.js +40 -0
  67. package/compodoc/js/menu.js +270 -0
  68. package/compodoc/js/routes.js +301 -0
  69. package/compodoc/js/search/lunr.min.js +6 -0
  70. package/compodoc/js/search/search-lunr.js +67 -0
  71. package/compodoc/js/search/search.js +283 -0
  72. package/compodoc/js/search/search_index.js +4 -0
  73. package/compodoc/js/sourceCode.js +58 -0
  74. package/compodoc/js/svg-pan-zoom.controls.js +53 -0
  75. package/compodoc/js/tabs.js +21 -0
  76. package/compodoc/js/tree.js +147 -0
  77. package/compodoc/license.html +731 -0
  78. package/compodoc/miscellaneous/functions.html +495 -0
  79. package/compodoc/miscellaneous/variables.html +341 -0
  80. package/compodoc/modules.html +183 -0
  81. package/compodoc/overview.html +217 -0
  82. package/compodoc/properties.html +197 -0
  83. package/compodoc/styles/bootstrap-card.css +219 -0
  84. package/compodoc/styles/bootstrap.min.css +6 -0
  85. package/compodoc/styles/compodoc.css +1124 -0
  86. package/compodoc/styles/dark.css +121 -0
  87. package/compodoc/styles/ionicons.min.css +11 -0
  88. package/compodoc/styles/laravel.css +113 -0
  89. package/compodoc/styles/material.css +131 -0
  90. package/compodoc/styles/original.css +51 -0
  91. package/compodoc/styles/postmark.css +238 -0
  92. package/compodoc/styles/prism.css +301 -0
  93. package/compodoc/styles/readthedocs.css +117 -0
  94. package/compodoc/styles/reset.css +129 -0
  95. package/compodoc/styles/stripe.css +106 -0
  96. package/compodoc/styles/style.css +7 -0
  97. package/compodoc/styles/tablesort.css +33 -0
  98. package/compodoc/styles/vagrant.css +130 -0
  99. package/docs/.nojekyll +1 -0
  100. package/docs/assets/highlight.css +43 -0
  101. package/docs/assets/icons.js +15 -0
  102. package/docs/assets/icons.svg +1 -0
  103. package/docs/assets/main.js +59 -0
  104. package/docs/assets/navigation.js +1 -0
  105. package/docs/assets/search.js +1 -0
  106. package/docs/assets/style.css +1412 -0
  107. package/docs/classes/DefaultTreeApplyFilterMethod.html +5 -0
  108. package/docs/classes/SearchForm.html +5 -0
  109. package/docs/classes/TreeComponent.html +44 -0
  110. package/docs/classes/TreeContentDirective.html +3 -0
  111. package/docs/classes/TreeDataSource.html +107 -0
  112. package/docs/documentation.json +11367 -0
  113. package/docs/functions/FormFactory.html +1 -0
  114. package/docs/functions/flatTree.html +1 -0
  115. package/docs/functions/isSelectionChange.html +1 -0
  116. package/docs/index.html +28 -0
  117. package/docs/interfaces/ISearchForm.html +3 -0
  118. package/docs/interfaces/TreeApplyFilterParameter.html +4 -0
  119. package/docs/interfaces/TreeDataSourceMetadata.html +9 -0
  120. package/docs/modules.html +17 -0
  121. package/docs/variables/RXAP_TREE_CONTENT_EDITABLE_METHOD.html +1 -0
  122. package/docs/variables/RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD.html +1 -0
  123. package/docs/variables/RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD.html +1 -0
  124. package/docs/variables/RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD.html +1 -0
  125. package/docs/variables/SearchFormProviders.html +1 -0
  126. package/package.json +31 -29
@@ -0,0 +1,1214 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <title>angular-tree</title>
7
+ <meta name="description" content="">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
11
+ <link rel="stylesheet" href="../styles/style.css">
12
+ <link rel="stylesheet" href="../styles/dark.css">
13
+ </head>
14
+ <body>
15
+ <script>
16
+ // Blocking script to avoid flickering dark mode
17
+ // Dark mode toggle button
18
+ var useDark = window.matchMedia('(prefers-color-scheme: dark)');
19
+ var darkModeState = useDark.matches;
20
+ var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
21
+ var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
22
+ var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
23
+
24
+ function checkToggle(check) {
25
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
26
+ $darkModeToggleSwitchers[i].checked = check;
27
+ }
28
+ }
29
+
30
+ function toggleDarkMode(state) {
31
+ if (window.localStorage) {
32
+ localStorage.setItem('compodoc_darkmode-state', state);
33
+ }
34
+
35
+ checkToggle(state);
36
+
37
+ const hasClass = document.body.classList.contains('dark');
38
+
39
+ if (state) {
40
+ for (var i = 0; i < $darkModeToggles.length; i++) {
41
+ $darkModeToggles[i].classList.add('dark');
42
+ }
43
+ if (!hasClass) {
44
+ document.body.classList.add('dark');
45
+ }
46
+ } else {
47
+ for (var i = 0; i < $darkModeToggles.length; i++) {
48
+ $darkModeToggles[i].classList.remove('dark');
49
+ }
50
+ if (hasClass) {
51
+ document.body.classList.remove('dark');
52
+ }
53
+ }
54
+ }
55
+
56
+ useDark.addEventListener('change', function (evt) {
57
+ toggleDarkMode(evt.matches);
58
+ });
59
+ if (darkModeStateLocal) {
60
+ darkModeState = darkModeStateLocal === 'true';
61
+ }
62
+ toggleDarkMode(darkModeState);
63
+ </script>
64
+
65
+ <div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
66
+ <div class="d-flex">
67
+ <a href="../" class="navbar-brand">angular-tree</a>
68
+ <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="xs-menu menu" id="mobile-menu">
73
+ <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
74
+ </div>
75
+
76
+ <div class="container-fluid main">
77
+ <div class="row main">
78
+ <div class="d-none d-md-block menu">
79
+ <compodoc-menu mode="normal"></compodoc-menu>
80
+ </div>
81
+ <!-- START CONTENT -->
82
+ <div class="content interface">
83
+ <div class="content-data">
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <ol class="breadcrumb">
98
+ <li class="breadcrumb-item">Interfaces</li>
99
+ <li class="breadcrumb-item"
100
+ >
101
+ TreeDataSourceMetadata</li>
102
+ </ol>
103
+
104
+ <ul class="nav nav-tabs" role="tablist">
105
+ <li class="nav-item">
106
+ <a href="#info"
107
+ class="nav-link"
108
+ class="nav-link active"
109
+ role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
110
+ </li>
111
+ <li class="nav-item">
112
+ <a href="#source"
113
+ class="nav-link"
114
+
115
+ role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a>
116
+ </li>
117
+ </ul>
118
+
119
+ <div class="tab-content">
120
+ <div class="tab-pane fade active in" id="info">
121
+ <p class="comment">
122
+ <h3>File</h3>
123
+ </p>
124
+ <p class="comment">
125
+ <code>src/lib/tree.data-source.ts</code>
126
+ </p>
127
+
128
+
129
+
130
+ <p class="comment">
131
+ <h3>Extends</h3>
132
+ </p>
133
+ <p class="comment">
134
+ <code>BaseDataSourceMetadata</code>
135
+ </p>
136
+
137
+ <section data-compodoc="block-index">
138
+ <h3 id="index">Index</h3>
139
+ <table class="table table-sm table-bordered index-table">
140
+ <tbody>
141
+ <tr>
142
+ <td class="col-md-4">
143
+ <h6><b>Properties</b></h6>
144
+ </td>
145
+ </tr>
146
+ <tr>
147
+ <td class="col-md-4">
148
+ <ul class="index-list">
149
+ <li>
150
+ <span class="modifier">Optional</span>
151
+ <a href="#autoRefreshWithoutCache"
152
+ >
153
+ autoRefreshWithoutCache
154
+ </a>
155
+ </li>
156
+ <li>
157
+ <span class="modifier">Optional</span>
158
+ <a href="#expandMultiple"
159
+ >
160
+ expandMultiple
161
+ </a>
162
+ </li>
163
+ <li>
164
+ <span class="modifier">Optional</span>
165
+ <a href="#scopeTypes"
166
+ >
167
+ scopeTypes
168
+ </a>
169
+ </li>
170
+ <li>
171
+ <span class="modifier">Optional</span>
172
+ <a href="#selectMultiple"
173
+ >
174
+ selectMultiple
175
+ </a>
176
+ </li>
177
+ </ul>
178
+ </td>
179
+ </tr>
180
+ </tbody>
181
+ </table>
182
+ </section>
183
+
184
+
185
+
186
+ <section data-compodoc="block-properties">
187
+ <h3 id="inputs">Properties</h3>
188
+ <table class="table table-sm table-bordered">
189
+ <tbody>
190
+ <tr>
191
+ <td class="col-md-4">
192
+ <a name="autoRefreshWithoutCache"></a>
193
+ <span class="name "><b>autoRefreshWithoutCache</b>
194
+ <a href="#autoRefreshWithoutCache">
195
+ <span class="icon ion-ios-link"></span>
196
+ </a>
197
+ </span>
198
+ </td>
199
+ </tr>
200
+ <tr>
201
+ <td class="col-md-4">
202
+ <code>autoRefreshWithoutCache: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
203
+ </code>
204
+ </td>
205
+ </tr>
206
+
207
+
208
+ <tr>
209
+ <td class="col-md-4">
210
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
211
+
212
+ </td>
213
+ </tr>
214
+
215
+ <tr>
216
+ <td class="col-md-4">
217
+ <i>Optional</i>
218
+ </td>
219
+ </tr>
220
+
221
+
222
+
223
+
224
+ <tr>
225
+ <td class="col-md-4">
226
+ <div class="io-description"><p>If true the tree will be refreshed with caching disbabled after the first load</p>
227
+ </div>
228
+ </td>
229
+ </tr>
230
+ </tbody>
231
+ </table>
232
+ <table class="table table-sm table-bordered">
233
+ <tbody>
234
+ <tr>
235
+ <td class="col-md-4">
236
+ <a name="expandMultiple"></a>
237
+ <span class="name "><b>expandMultiple</b>
238
+ <a href="#expandMultiple">
239
+ <span class="icon ion-ios-link"></span>
240
+ </a>
241
+ </span>
242
+ </td>
243
+ </tr>
244
+ <tr>
245
+ <td class="col-md-4">
246
+ <code>expandMultiple: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
247
+ </code>
248
+ </td>
249
+ </tr>
250
+
251
+
252
+ <tr>
253
+ <td class="col-md-4">
254
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
255
+
256
+ </td>
257
+ </tr>
258
+
259
+ <tr>
260
+ <td class="col-md-4">
261
+ <i>Optional</i>
262
+ </td>
263
+ </tr>
264
+
265
+
266
+
267
+
268
+ </tbody>
269
+ </table>
270
+ <table class="table table-sm table-bordered">
271
+ <tbody>
272
+ <tr>
273
+ <td class="col-md-4">
274
+ <a name="scopeTypes"></a>
275
+ <span class="name "><b>scopeTypes</b>
276
+ <a href="#scopeTypes">
277
+ <span class="icon ion-ios-link"></span>
278
+ </a>
279
+ </span>
280
+ </td>
281
+ </tr>
282
+ <tr>
283
+ <td class="col-md-4">
284
+ <code>scopeTypes: <code>string[]</code>
285
+ </code>
286
+ </td>
287
+ </tr>
288
+
289
+
290
+ <tr>
291
+ <td class="col-md-4">
292
+ <i>Type : </i> <code>string[]</code>
293
+
294
+ </td>
295
+ </tr>
296
+
297
+ <tr>
298
+ <td class="col-md-4">
299
+ <i>Optional</i>
300
+ </td>
301
+ </tr>
302
+
303
+
304
+
305
+
306
+ </tbody>
307
+ </table>
308
+ <table class="table table-sm table-bordered">
309
+ <tbody>
310
+ <tr>
311
+ <td class="col-md-4">
312
+ <a name="selectMultiple"></a>
313
+ <span class="name "><b>selectMultiple</b>
314
+ <a href="#selectMultiple">
315
+ <span class="icon ion-ios-link"></span>
316
+ </a>
317
+ </span>
318
+ </td>
319
+ </tr>
320
+ <tr>
321
+ <td class="col-md-4">
322
+ <code>selectMultiple: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
323
+ </code>
324
+ </td>
325
+ </tr>
326
+
327
+
328
+ <tr>
329
+ <td class="col-md-4">
330
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
331
+
332
+ </td>
333
+ </tr>
334
+
335
+ <tr>
336
+ <td class="col-md-4">
337
+ <i>Optional</i>
338
+ </td>
339
+ </tr>
340
+
341
+
342
+
343
+
344
+ </tbody>
345
+ </table>
346
+ </section>
347
+ </div>
348
+
349
+
350
+ <div class="tab-pane fade tab-source-code" id="source">
351
+ <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
352
+ SelectionChange,
353
+ SelectionModel,
354
+ } from &#x27;@angular/cdk/collections&#x27;;
355
+ import { FlatTreeControl } from &#x27;@angular/cdk/tree&#x27;;
356
+ import {
357
+ Inject,
358
+ Injectable,
359
+ InjectionToken,
360
+ isDevMode,
361
+ OnInit,
362
+ Optional,
363
+ } from &#x27;@angular/core&#x27;;
364
+ import {
365
+ BaseDataSource,
366
+ BaseDataSourceMetadata,
367
+ BaseDataSourceViewer,
368
+ RXAP_DATA_SOURCE_METADATA,
369
+ RxapDataSource,
370
+ } from &#x27;@rxap/data-source&#x27;;
371
+ import {
372
+ EventOptions,
373
+ ExpandNodeFunction,
374
+ Node,
375
+ NodeGetIconFunction,
376
+ NodeGetStyleFunction,
377
+ NodeGetTypeFunction,
378
+ NodeHasDetailsFunction,
379
+ NodeToDisplayFunction,
380
+ } from &#x27;@rxap/data-structure-tree&#x27;;
381
+ import { Method } from &#x27;@rxap/pattern&#x27;;
382
+ import { ToggleSubject } from &#x27;@rxap/rxjs&#x27;;
383
+ import {
384
+ coerceArray,
385
+ getIdentifierPropertyValue,
386
+ joinPath,
387
+ Required,
388
+ WithChildren,
389
+ WithIdentifier,
390
+ } from &#x27;@rxap/utilities&#x27;;
391
+ import {
392
+ BehaviorSubject,
393
+ combineLatest,
394
+ debounceTime,
395
+ from,
396
+ merge,
397
+ Observable,
398
+ Subject,
399
+ Subscription,
400
+ } from &#x27;rxjs&#x27;;
401
+ import {
402
+ map,
403
+ startWith,
404
+ switchMap,
405
+ tap,
406
+ } from &#x27;rxjs/operators&#x27;;
407
+ import {
408
+ ISearchForm,
409
+ SearchForm,
410
+ } from &#x27;./search.form&#x27;;
411
+
412
+ export function isSelectionChange&lt;T&gt;(obj: any): obj is SelectionChange&lt;T&gt; {
413
+ return !!obj &amp;&amp; obj[&#x27;added&#x27;] !&#x3D;&#x3D; undefined &amp;&amp; obj[&#x27;removed&#x27;] !&#x3D;&#x3D; undefined;
414
+ }
415
+
416
+ export interface TreeDataSourceMetadata extends BaseDataSourceMetadata {
417
+ selectMultiple?: boolean;
418
+ expandMultiple?: boolean;
419
+ scopeTypes?: string[];
420
+ /**
421
+ * If true the tree will be refreshed with caching disbabled after the first load
422
+ */
423
+ autoRefreshWithoutCache?: boolean;
424
+ }
425
+
426
+ export const RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD &#x3D; new InjectionToken(
427
+ &#x27;rxap/tree/data-source/root-remote-method&#x27;,
428
+ );
429
+ export const RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD &#x3D; new InjectionToken(
430
+ &#x27;rxap/tree/data-source/children-remote-method&#x27;,
431
+ );
432
+
433
+ export const RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD &#x3D; new InjectionToken(
434
+ &#x27;rxap/tree/data-source/apply-filter-method&#x27;);
435
+
436
+ export function flatTree&lt;Data extends WithIdentifier &amp; WithChildren &#x3D; any&gt;(
437
+ tree: Node&lt;Data&gt; | Array&lt;Node&lt;Data&gt;&gt;,
438
+ all &#x3D; false,
439
+ ): Array&lt;Node&lt;Data&gt;&gt; {
440
+ tree &#x3D; coerceArray(tree);
441
+
442
+ function flat(acc: any[], list: any[]) {
443
+ return [ ...acc, ...list ];
444
+ }
445
+
446
+ const _flatTree &#x3D; (node: Node&lt;Data&gt;): Array&lt;Node&lt;Data&gt;&gt; &#x3D;&gt; {
447
+ if (!Array.isArray(node.children)) {
448
+ if (isDevMode()) {
449
+ console.log(node);
450
+ }
451
+ throw new Error(&#x27;Node has not defined children&#x27;);
452
+ }
453
+
454
+ if (all || node.expanded) {
455
+ return [
456
+ node,
457
+ ...node.children.map((child) &#x3D;&gt; _flatTree(child)).reduce(flat, []),
458
+ ];
459
+ } else {
460
+ return [ node ];
461
+ }
462
+ };
463
+
464
+ return tree
465
+ .map((child) &#x3D;&gt; _flatTree(child))
466
+ .reduce((acc, items) &#x3D;&gt; [ ...acc, ...items ], []);
467
+ }
468
+
469
+ export interface TreeApplyFilterParameter&lt;Form extends ISearchForm &#x3D; ISearchForm, Data extends WithIdentifier &amp; WithChildren &#x3D; any&gt; {
470
+ tree: Array&lt;Node&lt;Data&gt;&gt;,
471
+ filter: Form;
472
+ scopeTypes?: string[]
473
+ }
474
+
475
+ @Injectable()
476
+ export class DefaultTreeApplyFilterMethod&lt;Data extends WithIdentifier &amp; WithChildren &#x3D; any&gt;
477
+ implements Method&lt;Array&lt;Node&lt;Data&gt;&gt;, TreeApplyFilterParameter&gt; {
478
+
479
+ protected lastFilter: ISearchForm | null &#x3D; null;
480
+
481
+ call(
482
+ {tree, filter, scopeTypes}: TreeApplyFilterParameter,
483
+ ): Array&lt;Node&lt;Data&gt;&gt; | Promise&lt;Array&lt;Node&lt;Data&gt;&gt;&gt; {
484
+
485
+ const nodes &#x3D; flatTree(tree, true);
486
+
487
+ // if (this.isEqualToLastFilter(filter)) {
488
+ // return flatTree(tree, false).filter(node &#x3D;&gt; node.isVisible);
489
+ // }
490
+
491
+ const hasScopeFilter &#x3D; (
492
+ filter.scope &amp;&amp;
493
+ Object.keys(filter.scope) &amp;&amp;
494
+ Object.values(filter.scope).some((list) &#x3D;&gt; list.length &gt; 0)
495
+ );
496
+
497
+ // if not scope and the search filter is an empty string, collapse all non-root nodes
498
+ if (!filter.search &amp;&amp; filter.search !&#x3D;&#x3D; this.lastFilter?.search) {
499
+ nodes
500
+ .filter(node &#x3D;&gt; node.parent)
501
+ .forEach(node &#x3D;&gt; node.collapse({quite: true}));
502
+ }
503
+
504
+ if (filter.search || hasScopeFilter) {
505
+
506
+ nodes.forEach(node &#x3D;&gt; node.hide());
507
+
508
+ for (const [ type, list ] of Object.entries(filter.scope ?? {})) {
509
+ for (const node of nodes) {
510
+ if (node.type &#x3D;&#x3D;&#x3D; type) {
511
+ if (list.some(item &#x3D;&gt; getIdentifierPropertyValue(item) &#x3D;&#x3D;&#x3D; node.id)) {
512
+ node.show({forEachChildren: true});
513
+ }
514
+ }
515
+ }
516
+ }
517
+
518
+ if (filter.search) {
519
+ for (const node of nodes) {
520
+ if (hasScopeFilter &amp;&amp; node.hidden) {
521
+ // if the filter has a scope filter. Only check the search filter on nodes that are shown by the scope
522
+ // filter
523
+ continue;
524
+ }
525
+ const display &#x3D; node.display?.toLowerCase();
526
+ if (display) {
527
+ if (display.includes(filter.search.toLowerCase())) {
528
+ node.show({parents: true});
529
+ } else {
530
+ node.hide();
531
+ }
532
+ } else {
533
+ // if node has no display, it is not shown
534
+ node.hide();
535
+ }
536
+ }
537
+ // hide each node that has no visible children
538
+ // there exists the edge case that a node has visible children, but the node.hide() function is called
539
+ // after the child.show({ parent:true })
540
+ for (const node of nodes.filter(n &#x3D;&gt; n.hidden &amp;&amp; n.hasChildren &amp;&amp; n.children.some(child &#x3D;&gt; child.isVisible))) {
541
+ if (node.hidden) {
542
+ console.warn(&#x27;Edge case detected. Node has visible children but is hidden.&#x27;);
543
+ node.show();
544
+ }
545
+ }
546
+ // expand each node that has visible children
547
+ for (const node of nodes.filter(n &#x3D;&gt; n.hasChildren)) {
548
+ if (node.children.some(child &#x3D;&gt; child.isVisible)) {
549
+ // set quite to true to prevent the tree from reloading -&gt; this would result in a infinite loop
550
+ node.expand({quite: true});
551
+ }
552
+ }
553
+ }
554
+
555
+ } else {
556
+ nodes.forEach(node &#x3D;&gt; node.show());
557
+ }
558
+
559
+ this.lastFilter &#x3D; filter;
560
+
561
+ return flatTree(tree, false).filter(node &#x3D;&gt; node.isVisible);
562
+
563
+ }
564
+
565
+ protected isEqualToLastFilter(filter: ISearchForm): boolean {
566
+ if (this.lastFilter) {
567
+ if (this.lastFilter.search &#x3D;&#x3D;&#x3D; filter.search) {
568
+ if (this.lastFilter.scope &amp;&amp; filter.scope) {
569
+ if (Object.keys(this.lastFilter.scope).every(key &#x3D;&gt; Object.keys(filter.scope).includes(key))) {
570
+ if (Object.entries(this.lastFilter.scope)
571
+ .every(([ key, scope ]) &#x3D;&gt; scope.some(item &#x3D;&gt; filter.scope[key].includes(item)))) {
572
+ return true;
573
+ }
574
+ }
575
+ }
576
+ if (filter.scope &#x3D;&#x3D;&#x3D; this.lastFilter.scope) {
577
+ return true;
578
+ }
579
+ }
580
+ }
581
+ return false;
582
+ }
583
+
584
+ }
585
+
586
+ @RxapDataSource(&#x27;tree&#x27;)
587
+ @Injectable()
588
+ export class TreeDataSource&lt;
589
+ Data extends WithIdentifier &amp; WithChildren &#x3D; any,
590
+ RootParameters &#x3D; any,
591
+ NodeParameters &#x3D; any,
592
+ &gt; extends BaseDataSource&lt;Array&lt;Node&lt;Data&gt;&gt;, TreeDataSourceMetadata&gt; implements OnInit {
593
+ public tree$ &#x3D; new BehaviorSubject&lt;Array&lt;Node&lt;Data&gt;&gt;&gt;([]);
594
+ @Required public treeControl!: FlatTreeControl&lt;Node&lt;Data&gt;&gt;;
595
+ public selected!: SelectionModel&lt;Node&lt;Data&gt;&gt;;
596
+ public expanded!: SelectionModel&lt;string&gt;;
597
+ // TODO : änlich problem wie bei der redundaten expand SelectionModel.
598
+ public override loading$ &#x3D; new ToggleSubject(true);
599
+ public searchForm: SearchForm | null &#x3D; null;
600
+ protected override _data$ &#x3D; new BehaviorSubject&lt;Array&lt;Node&lt;Data&gt;&gt;&gt;([]);
601
+ private _expandedLocalStorageSubscription: Subscription | null &#x3D; null;
602
+ private _selectedLocalStorageSubscription: Subscription | null &#x3D; null;
603
+ // im localStorage wird nur die id gespeichert.
604
+ private _preSelected: string[] &#x3D; [];
605
+ private _refreshMatchFilter &#x3D; new Subject&lt;void&gt;();
606
+ private readonly applyFilterMethod: Method&lt;Array&lt;Node&lt;Data&gt;&gt;, TreeApplyFilterParameter&gt;;
607
+
608
+ constructor(
609
+ @Inject(RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD)
610
+ public readonly rootRemoteMethod: Method&lt;Data | Data[], RootParameters&gt;,
611
+ @Optional()
612
+ @Inject(RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD)
613
+ public readonly childrenRemoteMethod: Method&lt;Data[], Node&lt;Data&gt;&gt; | null &#x3D; null,
614
+ @Optional()
615
+ @Inject(RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD)
616
+ applyFilterMethod: Method&lt;Array&lt;Node&lt;Data&gt;&gt;, TreeApplyFilterParameter&gt; | null &#x3D; null,
617
+ @Optional()
618
+ @Inject(RXAP_DATA_SOURCE_METADATA)
619
+ metadata: TreeDataSourceMetadata | null &#x3D; null,
620
+ ) {
621
+ super(metadata);
622
+ this.applyFilterMethod &#x3D; applyFilterMethod ?? new DefaultTreeApplyFilterMethod();
623
+ // TODO add new SelectModel class that saves the select model to the localStorage
624
+ this.initSelected();
625
+ this.initExpanded();
626
+ }
627
+
628
+ private _nodeParameters: NodeParameters | null &#x3D; null;
629
+
630
+ public get nodeParameters(): NodeParameters | null {
631
+ return this._nodeParameters;
632
+ }
633
+
634
+ public set nodeParameters(nodeParameters: NodeParameters | null) {
635
+ this._nodeParameters &#x3D; nodeParameters;
636
+ this.tree$.value.forEach(node &#x3D;&gt; node.parameters &#x3D; nodeParameters);
637
+ }
638
+
639
+ ngOnInit() {
640
+ if (this.searchForm) {
641
+ combineLatest([
642
+ this.tree$,
643
+ (this.searchForm.rxapFormGroup.value$ as Observable&lt;any&gt;).pipe(debounceTime(1000)),
644
+ ]).pipe(
645
+ switchMap(async ([ tree, filter ]) &#x3D;&gt; await this.applyFilterMethod.call({
646
+ tree,
647
+ filter,
648
+ scopeTypes: this.metadata?.scopeTypes,
649
+ })),
650
+ map(nodes &#x3D;&gt; coerceArray(nodes)),
651
+ )
652
+ .subscribe(data &#x3D;&gt; this._data$.next(data));
653
+ } else {
654
+ this.tree$.pipe(
655
+ map(tree &#x3D;&gt; flatTree(tree).filter(node &#x3D;&gt; node.isVisible)),
656
+ tap(nodes &#x3D;&gt; nodes.forEach(node &#x3D;&gt; node.show())),
657
+ ).subscribe(data &#x3D;&gt; this._data$.next(data));
658
+ }
659
+ }
660
+
661
+ public toDisplay: NodeToDisplayFunction&lt;Data&gt; &#x3D; () &#x3D;&gt;
662
+ &#x27;to display function not defined&#x27;;
663
+
664
+ public getIcon: NodeGetIconFunction&lt;Data&gt; &#x3D; () &#x3D;&gt; null;
665
+
666
+ public getType: NodeGetTypeFunction&lt;Data&gt; &#x3D; () &#x3D;&gt; null;
667
+
668
+ public getStyle: NodeGetStyleFunction&lt;Data&gt; &#x3D; () &#x3D;&gt; (
669
+ {}
670
+ );
671
+
672
+ public hasDetails: NodeHasDetailsFunction&lt;Data&gt; &#x3D; () &#x3D;&gt; true;
673
+
674
+ public matchFilter: (node: Node&lt;Data&gt;) &#x3D;&gt; boolean &#x3D; () &#x3D;&gt; true;
675
+
676
+ public async getTreeRoot(options: { cache?: boolean } &#x3D; {}): Promise&lt;Array&lt;Node&lt;Data&gt;&gt;&gt; {
677
+ this.loading$.enable();
678
+ const root: Data | Data[] &#x3D; await this.getRoot(options);
679
+
680
+ let rootNodes: Array&lt;Node&lt;Data&gt;&gt;;
681
+
682
+ if (Array.isArray(root)) {
683
+ rootNodes &#x3D; await Promise.all(root.map((node) &#x3D;&gt; this.toNode(null, node)));
684
+ } else {
685
+ rootNodes &#x3D; [ await this.toNode(null, root) ];
686
+ }
687
+
688
+ const tmpSelectedNodes: Node&lt;Data&gt;[] &#x3D; [];
689
+
690
+ const restoreExpandAndSelectedState &#x3D; (node: Node&lt;Data&gt;) &#x3D;&gt; {
691
+ if (this.expanded.isSelected(node.id)) {
692
+ (node as any)._expanded &#x3D; true;
693
+ }
694
+ if (this.selected.selected.some(n &#x3D;&gt; n.id &#x3D;&#x3D;&#x3D; node.id)) {
695
+ console.log(&#x27;restore selected&#x27;, node.display);
696
+ (node as any)._selected &#x3D; true;
697
+ tmpSelectedNodes.push(node);
698
+ }
699
+ node.children.forEach(restoreExpandAndSelectedState);
700
+ };
701
+
702
+ rootNodes.forEach(restoreExpandAndSelectedState);
703
+
704
+ console.log(&#x27;restore expand and selected state&#x27;, tmpSelectedNodes);
705
+ this.selected.setSelection(...tmpSelectedNodes);
706
+
707
+ this.tree$.next(rootNodes);
708
+
709
+ this.loading$.disable();
710
+
711
+ return rootNodes;
712
+ }
713
+
714
+ public selectNode(node: Node&lt;Data&gt;): Promise&lt;void&gt; {
715
+ if (!this.selected.isMultipleSelection()) {
716
+ if (this.selected.hasValue()) {
717
+ const currentSelectedNode &#x3D; this.selected.selected[0];
718
+ currentSelectedNode.deselect();
719
+ }
720
+ }
721
+ this.selected.select(node);
722
+ node.parent?.expand();
723
+ return Promise.resolve();
724
+ }
725
+
726
+ public setTreeControl(treeControl: FlatTreeControl&lt;Node&lt;Data&gt;&gt;): void {
727
+ this.treeControl &#x3D; treeControl;
728
+ }
729
+
730
+ public setMatchFilter(matchFilter: (node: Node&lt;Data&gt;) &#x3D;&gt; boolean): void {
731
+ this.matchFilter &#x3D; matchFilter;
732
+ }
733
+
734
+ public setToDisplay(
735
+ toDisplay: NodeToDisplayFunction&lt;Data&gt; &#x3D; this.toDisplay,
736
+ ): void {
737
+ this.toDisplay &#x3D; toDisplay;
738
+ }
739
+
740
+ public setGetIcon(getIcon: NodeGetIconFunction&lt;Data&gt; &#x3D; this.getIcon): void {
741
+ this.getIcon &#x3D; getIcon;
742
+ }
743
+
744
+ public setHasDetails(
745
+ hasDetails: NodeHasDetailsFunction&lt;Data&gt; &#x3D; this.hasDetails,
746
+ ): void {
747
+ this.hasDetails &#x3D; hasDetails;
748
+ }
749
+
750
+ public deselectNode(node: Node&lt;Data&gt;): Promise&lt;void&gt; {
751
+ this.selected.deselect(node);
752
+ return Promise.resolve();
753
+ }
754
+
755
+ public async expandNode(node: Node&lt;Data&gt;, options?: EventOptions): Promise&lt;void&gt; {
756
+ if (node.parent &amp;&amp; !node.parent.expanded) {
757
+ console.log(&#x27;expand parent&#x27;, node.parent.display);
758
+ node.parent?.expand({quite: true});
759
+ }
760
+ if (!options?.onlySelf) {
761
+ // required to sync the expanstion state with the tree control
762
+ // if the collpase is trigged by node.expand this state is not
763
+ // sync with the tree control
764
+ this.treeControl.expansionModel.select(node);
765
+ }
766
+
767
+ if (node.item.hasChildren &amp;&amp; !node.item.children?.length) {
768
+ node.isLoading$.enable();
769
+
770
+ const children &#x3D; await this.getChildren(node);
771
+
772
+ // add the loaded children to the item object
773
+ node.item.children &#x3D; children;
774
+
775
+ node.addChildren(
776
+ await Promise.all(children.map((child) &#x3D;&gt;
777
+ this.toNode(node, child, node.depth + 1, node.onExpand, node.onCollapse),
778
+ )),
779
+ );
780
+
781
+ node.isLoading$.disable();
782
+ }
783
+
784
+ console.log(&#x27;expand node&#x27;, node.display);
785
+ this.expanded.select(node.id);
786
+
787
+ // node.parent?.expand({quite: true});
788
+
789
+ if (!options?.quite) {
790
+ this.tree$.next(this.tree$.value);
791
+ }
792
+
793
+ }
794
+
795
+ public async getChildren(node: Node&lt;Data&gt;): Promise&lt;Data[]&gt; {
796
+ if (!this.childrenRemoteMethod) {
797
+ throw new Error(
798
+ &#x60;The node &#x27;${ node.id }&#x27; has unloaded children but the RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD is not provided.&#x60;);
799
+ }
800
+ return this.childrenRemoteMethod.call(node);
801
+ }
802
+
803
+ public async getRoot(options: { cache?: boolean } &#x3D; {}): Promise&lt;Data | Data[]&gt; {
804
+ const rootParameters &#x3D; await this.getRootParameters(options);
805
+ return this.rootRemoteMethod.call(rootParameters);
806
+ }
807
+
808
+ public async getRootParameters(options: { cache?: boolean } &#x3D; {}): Promise&lt;RootParameters&gt; {
809
+ return options as any;
810
+ }
811
+
812
+ // TODO : find better solution to allow the overwrite of the toNode method
813
+ // without losing the custom preselect and preexpand function
814
+
815
+ public getNodeById(id: string): Node&lt;Data&gt; | null {
816
+ function getNodeById(node: Node&lt;Data&gt;, nodeId: string) {
817
+ if (node.id &#x3D;&#x3D;&#x3D; nodeId) {
818
+ return node;
819
+ }
820
+ if (node.hasNode(nodeId)) {
821
+ return node.getNode(nodeId);
822
+ } else {
823
+ return null;
824
+ }
825
+ }
826
+
827
+ return (
828
+ this.tree$.value
829
+ .map((node) &#x3D;&gt; getNodeById(node, id))
830
+ .filter(Boolean)[0] || null
831
+ );
832
+ }
833
+
834
+ public async toNode(
835
+ parent: Node&lt;Data&gt; | null,
836
+ item: Data,
837
+ depth &#x3D; 0,
838
+ onExpand: ExpandNodeFunction&lt;Data&gt; &#x3D; this.expandNode.bind(this),
839
+ onCollapse: ExpandNodeFunction&lt;Data&gt; &#x3D; this.collapseNode.bind(this),
840
+ onSelect: ExpandNodeFunction&lt;Data&gt; &#x3D; this.selectNode.bind(this),
841
+ onDeselect: ExpandNodeFunction&lt;Data&gt; &#x3D; this.deselectNode.bind(this),
842
+ ): Promise&lt;Node&lt;Data&gt;&gt; {
843
+ return Node.ToNode(
844
+ parent,
845
+ item,
846
+ depth,
847
+ onExpand,
848
+ onCollapse,
849
+ this.toDisplay,
850
+ this.getIcon,
851
+ this.getType,
852
+ onSelect,
853
+ onDeselect,
854
+ this.hasDetails,
855
+ this.getStyle,
856
+ this.nodeParameters,
857
+ );
858
+ }
859
+
860
+ public collapseNode(node: Node&lt;Data&gt;, options?: EventOptions): Promise&lt;void&gt; {
861
+
862
+ if (!options?.onlySelf) {
863
+ // required to sync the expanstion state with the tree control
864
+ // if the collpase is trigged by node.colapse this state is not
865
+ // sync with the tree control
866
+ this.treeControl.expansionModel.deselect(node);
867
+ }
868
+
869
+ this.expanded.deselect(node.id);
870
+
871
+ if (!options?.quite) {
872
+ this.tree$.next(this.tree$.value);
873
+ }
874
+
875
+ return Promise.resolve();
876
+ }
877
+
878
+ /**
879
+ * Converts the tree structure into a list.
880
+ *
881
+ * @param tree
882
+ * @param all true - include nodes children that are not expanded
883
+ */
884
+ public flatTree(tree: Node&lt;Data&gt;, all &#x3D; false): Array&lt;Node&lt;Data&gt;&gt; {
885
+ return flatTree(tree, all);
886
+ }
887
+
888
+ public override destroy(): void {
889
+ super.destroy();
890
+ // TODO : add subscription handler to BaseDataSource
891
+ if (this._expandedLocalStorageSubscription) {
892
+ this._expandedLocalStorageSubscription.unsubscribe();
893
+ }
894
+ if (this._selectedLocalStorageSubscription) {
895
+ this._selectedLocalStorageSubscription.unsubscribe();
896
+ }
897
+ }
898
+
899
+ public refreshMatchFilter(): void {
900
+ this._refreshMatchFilter.next();
901
+ }
902
+
903
+ public override async refresh(): Promise&lt;any&gt; {
904
+ console.log(&#x27;selected&#x27;, this.selected.selected.map((node) &#x3D;&gt; node.id));
905
+ console.log(&#x27;expanded&#x27;, this.expanded.selected.slice());
906
+ await this.getTreeRoot({cache: false});
907
+
908
+ // refresh all expanded nodes;
909
+
910
+ // const loadExpandedNodes &#x3D; async (children: ReadonlyArray&lt;Node&lt;Data&gt;&gt;) &#x3D;&gt; {
911
+ // for (const child of children) {
912
+ // if (this.expanded.isSelected(child.id)) {
913
+ // // call the node method to ensure that the expanded property of
914
+ // // Node is set.
915
+ // await child.expand();
916
+ // }
917
+ //
918
+ // if (child.hasChildren) {
919
+ // await loadExpandedNodes(child.children);
920
+ // }
921
+ // }
922
+ // };
923
+ //
924
+ // await Promise.all(
925
+ // rootNodes
926
+ // .filter((node) &#x3D;&gt; node.hasChildren)
927
+ // .map((node) &#x3D;&gt; loadExpandedNodes(node.children)),
928
+ // );
929
+
930
+ // console.log(&#x27;selected&#x27;, this.selected.selected.map((node) &#x3D;&gt; node.id));
931
+ //
932
+ // const preSelected &#x3D; this.selected.selected.slice();
933
+ // this.selected.clear();
934
+ // preSelected.forEach(node &#x3D;&gt; {
935
+ // node?.select();
936
+ // });
937
+
938
+ // const selected: Array&lt;Node&lt;Data&gt;&gt; &#x3D; this.selected.selected
939
+ // .map((node) &#x3D;&gt; this.getNodeById(node.id))
940
+ // .filter(Boolean) as any;
941
+ // this.selected.clear();
942
+ // this.selected.select(...selected);
943
+ }
944
+
945
+ public override reset(): any {
946
+ this.selected.clear();
947
+ this.expanded.clear();
948
+ return this.getTreeRoot();
949
+ }
950
+
951
+ public setGetStyle(getStyle: NodeGetStyleFunction&lt;any&gt; &#x3D; this.getStyle) {
952
+ this.getStyle &#x3D; getStyle;
953
+ }
954
+
955
+ public setGetType(getType: NodeGetTypeFunction&lt;any&gt; &#x3D; this.getType) {
956
+ this.getType &#x3D; getType;
957
+ }
958
+
959
+ /**
960
+ * recall the getStyle, getIcon and toDisplay methods
961
+ * and update the node objects
962
+ */
963
+ public updateNodes() {
964
+ this._data$.value.forEach(node &#x3D;&gt; {
965
+ node.style &#x3D; this.getStyle(node.item);
966
+ node.icon &#x3D; coerceArray(this.getIcon(node.item));
967
+ node.display &#x3D; this.toDisplay(node.item);
968
+ });
969
+ this._data$.next(this._data$.value);
970
+ }
971
+
972
+ protected override _connect(
973
+ collectionViewer: Required&lt;BaseDataSourceViewer&gt;,
974
+ ): Observable&lt;Array&lt;Node&lt;Data&gt;&gt;&gt; {
975
+ this.init();
976
+ this.treeControl.expansionModel.changed.pipe(
977
+ tap(async change &#x3D;&gt; {
978
+ if (isSelectionChange&lt;Node&lt;Data&gt;&gt;(change)) {
979
+ const promiseList: Array&lt;Promise&lt;any&gt;&gt; &#x3D; [];
980
+ if (change.added) {
981
+ promiseList.push(...change.added.map((node) &#x3D;&gt; node.expand({onlySelf: true, quite: true})));
982
+ }
983
+ if (change.removed) {
984
+ promiseList.push(...change.removed
985
+ .slice()
986
+ .reverse()
987
+ .map((node) &#x3D;&gt; node.collapse({onlySelf: true, quite: true})));
988
+ }
989
+ await Promise.all(promiseList);
990
+ this.tree$.next(this.tree$.value);
991
+ }
992
+ }),
993
+ ).subscribe();
994
+
995
+ let loadRoot: Promise&lt;Array&lt;Node&lt;Data&gt;&gt; | void&gt; &#x3D; Promise.resolve();
996
+
997
+ if (this.tree$.value.length &#x3D;&#x3D;&#x3D; 0) {
998
+ loadRoot &#x3D; this.getTreeRoot();
999
+ }
1000
+
1001
+ let autoRefreshExecuted &#x3D; false;
1002
+
1003
+ return from(loadRoot).pipe(
1004
+ // tap((rootNodes) &#x3D;&gt; {
1005
+ // if (rootNodes) {
1006
+ // const promises: Promise&lt;any&gt;[] &#x3D; [];
1007
+ // if (this.metadata.selectMultiple) {
1008
+ // // if (!this.selected.hasValue()) {
1009
+ // // promises.push(
1010
+ // // ...rootNodes
1011
+ // // .filter((node) &#x3D;&gt; node.hasDetails)
1012
+ // // .map((node) &#x3D;&gt; node.select()),
1013
+ // // );
1014
+ // // }
1015
+ // if (!this.expanded.hasValue()) {
1016
+ // promises.push(
1017
+ // ...rootNodes
1018
+ // .filter((node) &#x3D;&gt; node.hasChildren)
1019
+ // .map((node) &#x3D;&gt; node.expand()),
1020
+ // );
1021
+ // }
1022
+ // } else if (rootNodes.length) {
1023
+ // const rootNode &#x3D; rootNodes[0];
1024
+ // // if (!this.selected.hasValue()) {
1025
+ // // // TODO : rename hasDetails to isSelectable
1026
+ // // if (rootNode.hasDetails) {
1027
+ // // promises.push(rootNode.select());
1028
+ // // }
1029
+ // // }
1030
+ // if (!this.expanded.hasValue()) {
1031
+ // promises.push(rootNode.expand());
1032
+ // }
1033
+ // }
1034
+ // return Promise.all(promises);
1035
+ // }
1036
+ // return Promise.resolve();
1037
+ // }),
1038
+ switchMap(() &#x3D;&gt;
1039
+ merge(collectionViewer.viewChange, this._data$).pipe(
1040
+ map(() &#x3D;&gt; this._data$.value),
1041
+ ),
1042
+ ),
1043
+ switchMap(nodeList &#x3D;&gt; this._refreshMatchFilter.pipe(
1044
+ startWith(null),
1045
+ map(() &#x3D;&gt; nodeList.filter(node &#x3D;&gt; this.matchFilter(node))),
1046
+ )),
1047
+ tap(() &#x3D;&gt; {
1048
+ if (this._preSelected.length) {
1049
+ console.log(&#x27;restore selected&#x27;, this._preSelected);
1050
+ this.selected.clear();
1051
+ const nodes &#x3D; this._preSelected.map((id) &#x3D;&gt; this.getNodeById(id));
1052
+ this._preSelected &#x3D; [];
1053
+ nodes.forEach(node &#x3D;&gt; {
1054
+ node?.select();
1055
+ });
1056
+ }
1057
+ }),
1058
+ tap(() &#x3D;&gt; {
1059
+ if (this.metadata.autoRefreshWithoutCache) {
1060
+ if (!autoRefreshExecuted) {
1061
+ autoRefreshExecuted &#x3D; true;
1062
+ console.log(&#x27;auto refresh&#x27;);
1063
+ this.refresh();
1064
+ }
1065
+ }
1066
+ }),
1067
+ );
1068
+ }
1069
+
1070
+ private initSelected(): void {
1071
+ const key &#x3D; joinPath(&#x27;rxap/tree&#x27;, this.id, &#x27;selected&#x27;);
1072
+ if (this.metadata[&#x27;cacheSelected&#x27;]) {
1073
+ if (localStorage.getItem(key)) {
1074
+ try {
1075
+ this._preSelected &#x3D; JSON.parse(localStorage.getItem(key)!);
1076
+ } catch (e: any) {
1077
+ console.error(&#x27;parse expanded tree data source nodes failed&#x27;);
1078
+ }
1079
+ }
1080
+ }
1081
+
1082
+ this.selected &#x3D; new SelectionModel&lt;Node&lt;Data&gt;&gt;(
1083
+ !!this.metadata.selectMultiple,
1084
+ [],
1085
+ );
1086
+ if (this.metadata[&#x27;cacheSelected&#x27;]) {
1087
+ this._selectedLocalStorageSubscription &#x3D; this.selected.changed
1088
+ .pipe(
1089
+ tap(() &#x3D;&gt;
1090
+ localStorage.setItem(
1091
+ key,
1092
+ JSON.stringify(this.selected.selected.map((s) &#x3D;&gt; s.id)),
1093
+ ),
1094
+ ),
1095
+ )
1096
+ .subscribe();
1097
+ }
1098
+ }
1099
+
1100
+ private initExpanded(): void {
1101
+ const key &#x3D; joinPath(&#x27;rxap/tree&#x27;, this.id, &#x27;expanded&#x27;);
1102
+ let expanded &#x3D; [];
1103
+ if (this.metadata[&#x27;cacheExpanded&#x27;]) {
1104
+ if (localStorage.getItem(key)) {
1105
+ try {
1106
+ expanded &#x3D; JSON.parse(localStorage.getItem(key)!);
1107
+ } catch (e: any) {
1108
+ console.error(&#x27;parse expanded tree data source nodes failed&#x27;);
1109
+ }
1110
+ }
1111
+ }
1112
+
1113
+ this.expanded &#x3D; new SelectionModel&lt;string&gt;(
1114
+ this.metadata.expandMultiple !&#x3D;&#x3D; false,
1115
+ expanded,
1116
+ );
1117
+ if (this.metadata[&#x27;cacheExpanded&#x27;]) {
1118
+ this._expandedLocalStorageSubscription &#x3D; this.expanded.changed
1119
+ .pipe(
1120
+ tap(() &#x3D;&gt;
1121
+ localStorage.setItem(
1122
+ key,
1123
+ JSON.stringify(this.expanded.selected),
1124
+ ),
1125
+ ),
1126
+ )
1127
+ .subscribe();
1128
+ }
1129
+ }
1130
+
1131
+ }
1132
+ </code></pre>
1133
+ </div>
1134
+ </div>
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+ </div><div class="search-results">
1144
+ <div class="has-results">
1145
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
1146
+ <ul class="search-results-list"></ul>
1147
+ </div>
1148
+ <div class="no-results">
1149
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
1150
+ </div>
1151
+ </div>
1152
+ </div>
1153
+ <!-- END CONTENT -->
1154
+ </div>
1155
+ </div>
1156
+
1157
+ <label class="dark-mode-switch">
1158
+ <input type="checkbox">
1159
+ <span class="slider">
1160
+ <svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
1161
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
1162
+ </svg>
1163
+ </span>
1164
+ </label>
1165
+
1166
+ <script>
1167
+ var COMPODOC_CURRENT_PAGE_DEPTH = 1;
1168
+ var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
1169
+ var COMPODOC_CURRENT_PAGE_URL = 'TreeDataSourceMetadata.html';
1170
+ var MAX_SEARCH_RESULTS = 15;
1171
+ </script>
1172
+
1173
+ <script>
1174
+ $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
1175
+ checkToggle(darkModeState);
1176
+ if ($darkModeToggleSwitchers.length > 0) {
1177
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
1178
+ $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
1179
+ darkModeState = !darkModeState;
1180
+ toggleDarkMode(darkModeState);
1181
+ });
1182
+ }
1183
+ }
1184
+ </script>
1185
+
1186
+ <script src="../js/libs/custom-elements.min.js"></script>
1187
+ <script src="../js/libs/lit-html.js"></script>
1188
+
1189
+ <script src="../js/menu-wc.js" defer></script>
1190
+ <script nomodule src="../js/menu-wc_es5.js" defer></script>
1191
+
1192
+ <script src="../js/libs/bootstrap-native.js"></script>
1193
+
1194
+ <script src="../js/libs/es6-shim.min.js"></script>
1195
+ <script src="../js/libs/EventDispatcher.js"></script>
1196
+ <script src="../js/libs/promise.min.js"></script>
1197
+ <script src="../js/libs/zepto.min.js"></script>
1198
+
1199
+ <script src="../js/compodoc.js"></script>
1200
+
1201
+ <script src="../js/tabs.js"></script>
1202
+ <script src="../js/menu.js"></script>
1203
+ <script src="../js/libs/clipboard.min.js"></script>
1204
+ <script src="../js/libs/prism.js"></script>
1205
+ <script src="../js/sourceCode.js"></script>
1206
+ <script src="../js/search/search.js"></script>
1207
+ <script src="../js/search/lunr.min.js"></script>
1208
+ <script src="../js/search/search-lunr.js"></script>
1209
+ <script src="../js/search/search_index.js"></script>
1210
+ <script src="../js/lazy-load-graphs.js"></script>
1211
+
1212
+
1213
+ </body>
1214
+ </html>