@acorex/components 18.15.3 → 18.16.0-next.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/audio-wave/lib/audio-wave.component.d.ts +1 -0
  2. package/comment/lib/comment-container/comment-container.component.d.ts +1 -0
  3. package/common/lib/components/value-component.class.d.ts +1 -0
  4. package/common/lib/directives/auto-focus.directive.d.ts +1 -0
  5. package/common/lib/directives/inverted-color.directive.d.ts +1 -0
  6. package/common/lib/directives/ripple.directive.d.ts +1 -0
  7. package/conversation/lib/conversation-messages/conversation-message-voice/conversation-message-voice.component.d.ts +1 -0
  8. package/data-table/lib/columns/data-table-column-resizable.directive.d.ts +1 -0
  9. package/data-table/lib/data-table/data-table.component.d.ts +1 -0
  10. package/data-table/lib/infinite-scroll-data-table/infinite-scroll-data-table.component.d.ts +1 -0
  11. package/drawer/lib/drawer/drawer-item/drawer.component.d.ts +1 -0
  12. package/esm2022/audio-wave/lib/audio-wave.component.mjs +18 -14
  13. package/esm2022/button/lib/button-item-list.component.mjs +2 -2
  14. package/esm2022/calendar/lib/calendar.component.mjs +17 -14
  15. package/esm2022/comment/lib/comment-container/comment-container.component.mjs +18 -15
  16. package/esm2022/common/lib/components/value-component.class.mjs +5 -4
  17. package/esm2022/common/lib/directives/auto-focus.directive.mjs +8 -5
  18. package/esm2022/common/lib/directives/inverted-color.directive.mjs +23 -19
  19. package/esm2022/common/lib/directives/ripple.directive.mjs +18 -15
  20. package/esm2022/conversation/lib/conversation-messages/conversation-message-voice/conversation-message-voice.component.mjs +13 -9
  21. package/esm2022/data-pager/lib/data-pager-pagesize-dropdown.component.mjs +19 -5
  22. package/esm2022/data-pager/lib/data-pager.component.mjs +3 -3
  23. package/esm2022/data-table/lib/columns/data-table-column-resizable.directive.mjs +13 -13
  24. package/esm2022/data-table/lib/data-table/data-table.component.mjs +14 -9
  25. package/esm2022/data-table/lib/infinite-scroll-data-table/infinite-scroll-data-table.component.mjs +13 -10
  26. package/esm2022/drawer/lib/drawer/drawer-item/drawer.component.mjs +5 -4
  27. package/esm2022/list/lib/list.component.mjs +14 -9
  28. package/esm2022/menu/lib/context-menu.component.mjs +40 -32
  29. package/esm2022/picker/lib/picker.component.mjs +11 -4
  30. package/esm2022/popover/lib/popover.component.mjs +7 -6
  31. package/esm2022/range-slider/lib/range-slider.component.mjs +15 -9
  32. package/esm2022/rate-picker/lib/rate-picker.component.mjs +8 -2
  33. package/esm2022/tree-view/acorex-components-tree-view.mjs +5 -0
  34. package/esm2022/tree-view/index.mjs +4 -0
  35. package/esm2022/tree-view/lib/tree-view-item.component.mjs +86 -0
  36. package/esm2022/tree-view/lib/tree-view.class.mjs +4 -0
  37. package/esm2022/tree-view/lib/tree-view.component.mjs +299 -0
  38. package/esm2022/tree-view/lib/tree-view.component.module.mjs +50 -0
  39. package/esm2022/uploader/lib/uploader-zone.directive.mjs +21 -16
  40. package/fesm2022/acorex-components-audio-wave.mjs +18 -15
  41. package/fesm2022/acorex-components-audio-wave.mjs.map +1 -1
  42. package/fesm2022/acorex-components-button.mjs +2 -2
  43. package/fesm2022/acorex-components-button.mjs.map +1 -1
  44. package/fesm2022/acorex-components-calendar.mjs +16 -14
  45. package/fesm2022/acorex-components-calendar.mjs.map +1 -1
  46. package/fesm2022/acorex-components-comment.mjs +17 -14
  47. package/fesm2022/acorex-components-comment.mjs.map +1 -1
  48. package/fesm2022/acorex-components-common.mjs +44 -34
  49. package/fesm2022/acorex-components-common.mjs.map +1 -1
  50. package/fesm2022/acorex-components-conversation.mjs +12 -9
  51. package/fesm2022/acorex-components-conversation.mjs.map +1 -1
  52. package/fesm2022/acorex-components-data-pager.mjs +20 -6
  53. package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
  54. package/fesm2022/acorex-components-data-table.mjs +33 -25
  55. package/fesm2022/acorex-components-data-table.mjs.map +1 -1
  56. package/fesm2022/acorex-components-drawer.mjs +4 -3
  57. package/fesm2022/acorex-components-drawer.mjs.map +1 -1
  58. package/fesm2022/acorex-components-list.mjs +14 -10
  59. package/fesm2022/acorex-components-list.mjs.map +1 -1
  60. package/fesm2022/acorex-components-menu.mjs +39 -31
  61. package/fesm2022/acorex-components-menu.mjs.map +1 -1
  62. package/fesm2022/acorex-components-picker.mjs +10 -4
  63. package/fesm2022/acorex-components-picker.mjs.map +1 -1
  64. package/fesm2022/acorex-components-popover.mjs +6 -5
  65. package/fesm2022/acorex-components-popover.mjs.map +1 -1
  66. package/fesm2022/acorex-components-range-slider.mjs +14 -8
  67. package/fesm2022/acorex-components-range-slider.mjs.map +1 -1
  68. package/fesm2022/acorex-components-rate-picker.mjs +7 -1
  69. package/fesm2022/acorex-components-rate-picker.mjs.map +1 -1
  70. package/fesm2022/acorex-components-tree-view.mjs +433 -0
  71. package/fesm2022/acorex-components-tree-view.mjs.map +1 -0
  72. package/fesm2022/acorex-components-uploader.mjs +20 -15
  73. package/fesm2022/acorex-components-uploader.mjs.map +1 -1
  74. package/menu/lib/context-menu.component.d.ts +1 -0
  75. package/package.json +7 -1
  76. package/picker/lib/picker.component.d.ts +1 -0
  77. package/popover/lib/popover.component.d.ts +1 -0
  78. package/rate-picker/lib/rate-picker.component.d.ts +1 -0
  79. package/tree-view/README.md +3 -0
  80. package/tree-view/index.d.ts +3 -0
  81. package/tree-view/lib/tree-view-item.component.d.ts +23 -0
  82. package/tree-view/lib/tree-view.class.d.ts +20 -0
  83. package/tree-view/lib/tree-view.component.d.ts +80 -0
  84. package/tree-view/lib/tree-view.component.module.d.ts +16 -0
  85. package/uploader/lib/uploader-zone.directive.d.ts +1 -0
@@ -0,0 +1,433 @@
1
+ import { NXComponent, AXCommonModule } from '@acorex/components/common';
2
+ import { AXPlatform } from '@acorex/core/platform';
3
+ import { trigger, state, style, transition, animate } from '@angular/animations';
4
+ import * as i0 from '@angular/core';
5
+ import { input, output, model, inject, computed, Component, ViewEncapsulation, ChangeDetectionStrategy, signal, effect, NgModule } from '@angular/core';
6
+ import * as i1 from '@acorex/components/tooltip';
7
+ import { AXTooltipModule } from '@acorex/components/tooltip';
8
+ import * as i2 from '@acorex/components/loading';
9
+ import { AXLoadingModule } from '@acorex/components/loading';
10
+ import * as i1$1 from '@angular/common';
11
+ import { CommonModule } from '@angular/common';
12
+ import * as i2$1 from '@acorex/components/decorators';
13
+ import { AXDecoratorModule } from '@acorex/components/decorators';
14
+ import * as i3 from '@acorex/components/check-box';
15
+ import { AXCheckBoxModule } from '@acorex/components/check-box';
16
+ import * as i4 from '@angular/forms';
17
+ import { FormsModule } from '@angular/forms';
18
+ import { AXFormModule } from '@acorex/components/form';
19
+
20
+ class AXTreeViewItemComponent extends NXComponent {
21
+ constructor() {
22
+ super();
23
+ this.item = input();
24
+ this.onNodeExpand = output();
25
+ this.onNodeClick = output();
26
+ this.isExpanded = model(false);
27
+ this.hasChildField = input();
28
+ this.isActive = model(false);
29
+ this.onNodeDbClick = output();
30
+ this.isLoading = input(false);
31
+ this.disableField = input();
32
+ this.platformService = inject(AXPlatform);
33
+ this.arrowIcon = computed(() => {
34
+ if (this.isExpanded()) {
35
+ return 'ax-tree-view-arrow ax-icon ax-icon-solid ax-icon-chevron-down';
36
+ }
37
+ else {
38
+ return this.platformService.isRtl()
39
+ ? 'ax-tree-view-arrow ax-icon ax-icon-solid ax-icon-chevron-left'
40
+ : 'ax-tree-view-arrow ax-icon ax-icon-solid ax-icon-chevron-right';
41
+ }
42
+ });
43
+ }
44
+ handleArrowNodeClick() {
45
+ if (this.item()[this.disableField()] || this.isLoading()) {
46
+ return;
47
+ }
48
+ this.isExpanded.set(!this.isExpanded());
49
+ this.onNodeExpand.emit({ component: this, data: this.item(), nativeElement: this.nativeElement });
50
+ }
51
+ handleTextClick(item) {
52
+ this.onNodeClick.emit({ component: this, data: item, nativeElement: this.nativeElement });
53
+ }
54
+ handleTextDbClick(item) {
55
+ if (item[this.disableField()]) {
56
+ return;
57
+ }
58
+ if (item?.childrens?.length || item[this.hasChildField()]) {
59
+ this.isExpanded.set(!this.isExpanded());
60
+ this.onNodeDbClick.emit({ component: this, data: item, nativeElement: this.nativeElement });
61
+ }
62
+ }
63
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
64
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: AXTreeViewItemComponent, selector: "ax-tree-view-item", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, isExpanded: { classPropertyName: "isExpanded", publicName: "isExpanded", isSignal: true, isRequired: false, transformFunction: null }, hasChildField: { classPropertyName: "hasChildField", publicName: "hasChildField", isSignal: true, isRequired: false, transformFunction: null }, isActive: { classPropertyName: "isActive", publicName: "isActive", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, disableField: { classPropertyName: "disableField", publicName: "disableField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onNodeExpand: "onNodeExpand", onNodeClick: "onNodeClick", isExpanded: "isExpandedChange", isActive: "isActiveChange", onNodeDbClick: "onNodeDbClick" }, usesInheritance: true, ngImport: i0, template: "<div class=\"ax-tree-view-container\">\n @if ((item().childrens && !isLoading()) || (item()[hasChildField()] && !isLoading())) {\n <i\n [class.ax-state-disabled]=\"item()[disableField()]\"\n (click)=\"handleArrowNodeClick()\"\n class=\"{{ arrowIcon() }}\"\n ></i>\n } @else if (isLoading()) {\n <ax-loading></ax-loading>\n } @else {\n <i class=\"ax-icon\"></i>\n }\n\n <div class=\"ax-tree-view-items\">\n <ng-content select=\"ax-check-box\"></ng-content>\n <div\n [class.ax-state-disabled]=\"item()[disableField()]\"\n [axTooltip]=\"item().tooltip\"\n axTooltipPlacement=\"end-bottom\"\n (click)=\"handleTextClick(item())\"\n (dblclick)=\"handleTextDbClick(item())\"\n class=\"ax-tree-view-items-prefix noselect-tree-view\"\n [class.ax-state-tree-view-active]=\"item().active\"\n >\n <ng-content select=\"ax-prefix\"></ng-content>\n <ng-content select=\"ax-text\"></ng-content>\n <ng-content select=\"ax-suffix\"></ng-content>\n </div>\n </div>\n</div>\n\n<div\n class=\"{{ platformService.isRtl() ? 'ax-state-tree-view-rtl' : 'ax-state-tree-view-ltr' }}\"\n [@collapseExpand]=\"isExpanded() ? 'expanded' : 'collapsed'\"\n>\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: i1.AXTooltipDirective, selector: "[axTooltip]", inputs: ["axTooltip", "axTooltipPlacement", "axTooltipOpenAfter", "axTooltipCloseAfter"] }, { kind: "component", type: i2.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }], animations: [
65
+ trigger('collapseExpand', [
66
+ state('collapsed', style({
67
+ height: '0',
68
+ overflow: 'hidden',
69
+ opacity: 0,
70
+ })),
71
+ state('expanded', style({
72
+ height: '*',
73
+ overflow: 'hidden',
74
+ opacity: 1,
75
+ })),
76
+ transition('collapsed <=> expanded', [animate('300ms ease-in-out')]),
77
+ ]),
78
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
79
+ }
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewItemComponent, decorators: [{
81
+ type: Component,
82
+ args: [{ selector: 'ax-tree-view-item', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [
83
+ trigger('collapseExpand', [
84
+ state('collapsed', style({
85
+ height: '0',
86
+ overflow: 'hidden',
87
+ opacity: 0,
88
+ })),
89
+ state('expanded', style({
90
+ height: '*',
91
+ overflow: 'hidden',
92
+ opacity: 1,
93
+ })),
94
+ transition('collapsed <=> expanded', [animate('300ms ease-in-out')]),
95
+ ]),
96
+ ], template: "<div class=\"ax-tree-view-container\">\n @if ((item().childrens && !isLoading()) || (item()[hasChildField()] && !isLoading())) {\n <i\n [class.ax-state-disabled]=\"item()[disableField()]\"\n (click)=\"handleArrowNodeClick()\"\n class=\"{{ arrowIcon() }}\"\n ></i>\n } @else if (isLoading()) {\n <ax-loading></ax-loading>\n } @else {\n <i class=\"ax-icon\"></i>\n }\n\n <div class=\"ax-tree-view-items\">\n <ng-content select=\"ax-check-box\"></ng-content>\n <div\n [class.ax-state-disabled]=\"item()[disableField()]\"\n [axTooltip]=\"item().tooltip\"\n axTooltipPlacement=\"end-bottom\"\n (click)=\"handleTextClick(item())\"\n (dblclick)=\"handleTextDbClick(item())\"\n class=\"ax-tree-view-items-prefix noselect-tree-view\"\n [class.ax-state-tree-view-active]=\"item().active\"\n >\n <ng-content select=\"ax-prefix\"></ng-content>\n <ng-content select=\"ax-text\"></ng-content>\n <ng-content select=\"ax-suffix\"></ng-content>\n </div>\n </div>\n</div>\n\n<div\n class=\"{{ platformService.isRtl() ? 'ax-state-tree-view-rtl' : 'ax-state-tree-view-ltr' }}\"\n [@collapseExpand]=\"isExpanded() ? 'expanded' : 'collapsed'\"\n>\n <ng-content></ng-content>\n</div>\n" }]
97
+ }], ctorParameters: () => [] });
98
+
99
+ class AXTreeViewComponent extends NXComponent {
100
+ constructor() {
101
+ super();
102
+ this.itemsSignal = signal([]);
103
+ this.#effect = effect(() => {
104
+ const itemsInput = this.items();
105
+ if (typeof itemsInput === 'function') {
106
+ const result = itemsInput();
107
+ if (result instanceof Promise) {
108
+ this.itemsPromise = (options) => itemsInput(options);
109
+ this.fetchData();
110
+ }
111
+ else {
112
+ this.itemsSignal.set(result);
113
+ this.itemsPromise = null;
114
+ }
115
+ }
116
+ else {
117
+ this.itemsSignal.set(itemsInput);
118
+ this.itemsPromise = null;
119
+ }
120
+ }, { allowSignalWrites: true });
121
+ this.items = input();
122
+ this.selectable = input(true);
123
+ this.selectionMode = input('single');
124
+ this.selectionBehavior = input(null);
125
+ this.showActiveNode = signal(true);
126
+ this.valueField = input('id');
127
+ this.textField = input('text');
128
+ this.visibleField = input('visible');
129
+ this.disableField = input('disabled');
130
+ this.hasChildField = input();
131
+ this.iconField = input('icon');
132
+ this.onSelectionChange = output();
133
+ this.onItemClick = output();
134
+ this.onNodeClick = output();
135
+ this.loadingState = signal({});
136
+ }
137
+ #effect;
138
+ get resolvedItems() {
139
+ return this.itemsSignal();
140
+ }
141
+ handleNodeSelectionClick(event, item) {
142
+ if (item[this.disableField()] || this.isNodeLoading(item.id)) {
143
+ return;
144
+ }
145
+ if (this.selectionMode() === 'single' && event.isUserInteraction) {
146
+ this.handleUnSelectNode(this.itemsSignal());
147
+ }
148
+ item.selected = event.value;
149
+ if (event.value != null) {
150
+ switch (this.selectionBehavior()) {
151
+ case 'autoExpand':
152
+ if (event.value) {
153
+ if (this.itemsPromise && item[this.hasChildField()] && !item?.childrens?.length) {
154
+ this.fetchData(item.id);
155
+ this.setNodeLoading(item.id, true);
156
+ }
157
+ this.toggleExpand(item);
158
+ }
159
+ break;
160
+ case 'expandAndSelectAllOrUnSelect':
161
+ if (this.itemsPromise) {
162
+ console.error('This mode only available client Side');
163
+ return;
164
+ }
165
+ this.expandAndToggleSelection(item, event.value);
166
+ break;
167
+ case 'indeterminate':
168
+ if (item?.childrens?.length) {
169
+ this.applySelectionToChildren(item, event.value, item[this.valueField()]);
170
+ }
171
+ this.updateParentSelection(item, event.value);
172
+ break;
173
+ default:
174
+ break;
175
+ }
176
+ }
177
+ if (event.isUserInteraction) {
178
+ const result = this.findSelectedNodes(this.itemsSignal());
179
+ this.onSelectionChange.emit({
180
+ component: this,
181
+ data: result,
182
+ nativeElement: this.nativeElement,
183
+ });
184
+ this.onItemClick.emit({ component: this, data: item, nativeElement: this.nativeElement });
185
+ }
186
+ }
187
+ /**
188
+ *
189
+ * auto expand
190
+ *
191
+ */
192
+ toggleExpand(item) {
193
+ if (!item.isExpanded) {
194
+ item.isExpanded = true;
195
+ }
196
+ }
197
+ /**
198
+ *
199
+ * expand and change value parent change
200
+ *
201
+ */
202
+ expandAndToggleSelection(item, selected) {
203
+ this.toggleExpand(item);
204
+ if (item.childrens?.length) {
205
+ this.applySelectionToChildren(item, selected, item[this.valueField()]);
206
+ }
207
+ }
208
+ applySelectionToChildren(item, isSelected, parentId) {
209
+ item.childrens.forEach((child) => {
210
+ child.parentId = parentId;
211
+ child.selected = isSelected;
212
+ if (child.childrens?.length) {
213
+ this.applySelectionToChildren(child, isSelected, child.id);
214
+ }
215
+ });
216
+ }
217
+ /**
218
+ *
219
+ * indeterminate logic
220
+ *
221
+ */
222
+ updateParentSelection(item, selected) {
223
+ item.selected = selected;
224
+ let parent = this.findParent(item, this.itemsSignal());
225
+ while ((parent && parent.selected != false) || (parent && item.selected)) {
226
+ const allSelected = parent?.childrens?.every((child) => child.selected);
227
+ const someSelected = parent?.childrens?.some((child) => child.selected || child.indeterminate);
228
+ if (!allSelected && !someSelected) {
229
+ parent.selected = false;
230
+ parent.indeterminate = null;
231
+ }
232
+ else if (!allSelected) {
233
+ parent.indeterminate = true;
234
+ parent.selected = null;
235
+ }
236
+ else if (allSelected) {
237
+ parent.selected = true;
238
+ parent.indeterminate = false;
239
+ }
240
+ else {
241
+ parent.indeterminate = false;
242
+ parent.selected = true;
243
+ }
244
+ parent = this.findParent(parent, this.itemsSignal());
245
+ }
246
+ }
247
+ findParent(item, nodes) {
248
+ for (let node of nodes) {
249
+ if (node.childrens?.includes(item)) {
250
+ return node;
251
+ }
252
+ else if (node.childrens) {
253
+ const parent = this.findParent(item, node.childrens);
254
+ if (parent)
255
+ return parent;
256
+ }
257
+ }
258
+ return null;
259
+ }
260
+ /**
261
+ *
262
+ * find node selected true for emit Selections
263
+ *
264
+ */
265
+ findSelectedNodes(nodes) {
266
+ let selectedNodes = [];
267
+ nodes.forEach((node) => {
268
+ if (node.selected) {
269
+ selectedNodes.push(node);
270
+ }
271
+ if (node.childrens) {
272
+ selectedNodes = selectedNodes.concat(this.findSelectedNodes(node.childrens));
273
+ }
274
+ });
275
+ return selectedNodes;
276
+ }
277
+ /**
278
+ *
279
+ * find for emit Selections single mode
280
+ *
281
+ */
282
+ handleUnSelectNode(items) {
283
+ items.forEach((child) => {
284
+ child.selected = false;
285
+ if (child?.childrens?.length) {
286
+ this.handleUnSelectNode(child.childrens);
287
+ }
288
+ });
289
+ }
290
+ /**
291
+ *
292
+ * lazy load logic
293
+ *
294
+ */
295
+ fetchData(parentId) {
296
+ this.itemsPromise({ parentId })
297
+ .then((data) => {
298
+ if (Array.isArray(data)) {
299
+ if (parentId) {
300
+ this.findNode(parentId, data, this.itemsSignal());
301
+ }
302
+ else {
303
+ this.itemsSignal.set(data);
304
+ }
305
+ }
306
+ })
307
+ .finally(() => {
308
+ this.setNodeLoading(parentId, false);
309
+ });
310
+ }
311
+ findNode(parentId, _children, source) {
312
+ if (source.length) {
313
+ source.forEach((element) => {
314
+ if (element[this.valueField()] == parentId) {
315
+ element.childrens = _children;
316
+ }
317
+ else {
318
+ if (element?.childrens)
319
+ this.findNode(parentId, _children, element.childrens);
320
+ }
321
+ });
322
+ }
323
+ }
324
+ /**
325
+ *
326
+ * emit when arrow click
327
+ *
328
+ */
329
+ handleNodeExpandClick(node) {
330
+ const parentId = node.data.id;
331
+ if (this.itemsPromise && node.data.isExpanded && !node?.data.childrens?.length) {
332
+ this.fetchData(parentId);
333
+ this.setNodeLoading(node.data.id, true);
334
+ }
335
+ this.onItemClick.emit({ component: this, data: node.data, nativeElement: this.nativeElement });
336
+ }
337
+ handleNodeClick(node) {
338
+ if (node.data[this.disableField()]) {
339
+ return;
340
+ }
341
+ if (this.showActiveNode()) {
342
+ this.handleUnActiveNode(this.itemsSignal());
343
+ node.data.active = true;
344
+ }
345
+ ///to do
346
+ // switch (this.selectionBehavior()) {
347
+ // case 'activeAndSelect':
348
+ // if (this.selectionMode() === 'single') {
349
+ // this.handleUnselectNode(this.itemsSignal());
350
+ // }
351
+ // node.selected = true;
352
+ // break;
353
+ // default:
354
+ // break;
355
+ // }
356
+ this.onNodeClick.emit({ component: this, data: node.data, nativeElement: this.nativeElement });
357
+ }
358
+ handleUnActiveNode(unActiveSource) {
359
+ unActiveSource.forEach((child) => {
360
+ child.active = false;
361
+ if (child?.childrens?.length) {
362
+ this.handleUnActiveNode(child.childrens);
363
+ }
364
+ });
365
+ }
366
+ handleNodeDbClick(node) {
367
+ if (this.itemsPromise) {
368
+ const nodeParentId = node.data.id;
369
+ this.fetchData(nodeParentId);
370
+ this.setNodeLoading(node.data.id, true);
371
+ }
372
+ }
373
+ isNodeLoading(nodeId) {
374
+ return this.loadingState()[nodeId] || false;
375
+ }
376
+ setNodeLoading(nodeId, isLoading) {
377
+ this.loadingState.update((state) => ({
378
+ ...state,
379
+ [nodeId]: isLoading,
380
+ }));
381
+ }
382
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
383
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: AXTreeViewComponent, selector: "ax-tree-view", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selectionBehavior: { classPropertyName: "selectionBehavior", publicName: "selectionBehavior", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, visibleField: { classPropertyName: "visibleField", publicName: "visibleField", isSignal: true, isRequired: false, transformFunction: null }, disableField: { classPropertyName: "disableField", publicName: "disableField", isSignal: true, isRequired: false, transformFunction: null }, hasChildField: { classPropertyName: "hasChildField", publicName: "hasChildField", isSignal: true, isRequired: false, transformFunction: null }, iconField: { classPropertyName: "iconField", publicName: "iconField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelectionChange: "onSelectionChange", onItemClick: "onItemClick", onNodeClick: "onNodeClick" }, usesInheritance: true, ngImport: i0, template: "@for (node of resolvedItems; track $index) {\n <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: node }\"></ng-container>\n}\n\n<ng-template #Recursion let-item>\n @if (item[visibleField()] !== false) {\n <ax-tree-view-item\n [item]=\"item\"\n [(isExpanded)]=\"item.isExpanded\"\n [(isActive)]=\"item.active\"\n [isLoading]=\"isNodeLoading(item.id)\"\n [disableField]=\"disableField()\"\n [hasChildField]=\"hasChildField()\"\n (onNodeExpand)=\"handleNodeExpandClick($event)\"\n (onNodeClick)=\"handleNodeClick($event)\"\n (onNodeDbClick)=\"handleNodeDbClick($event)\"\n >\n @if (this.selectable()) {\n <ax-check-box\n [disabled]=\"item[disableField()]\"\n [indeterminate]=\"item.indeterminate\"\n [(ngModel)]=\"item.selected\"\n (onValueChanged)=\"handleNodeSelectionClick($event, item)\"\n ></ax-check-box>\n }\n <ax-prefix>\n @if (item[iconField()]) {\n <ax-icon [icon]=\"item[iconField()]\"></ax-icon>\n } @else {\n <i></i>\n }\n </ax-prefix>\n @if (item[textField()]) {\n <ax-text>{{ item[textField()] }}</ax-text>\n }\n\n <ax-suffix></ax-suffix>\n @for (child of item?.childrens; track $index) {\n <ng-container\n [ngTemplateOutlet]=\"Recursion\"\n [ngTemplateOutletContext]=\"{ $implicit: child }\"\n ></ng-container>\n }\n </ax-tree-view-item>\n }\n</ng-template>\n", styles: ["ax-tree-view ax-tree-view-item .ax-tree-view-container{display:flex;align-items:center;margin-bottom:.125rem;cursor:pointer}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-checkbox-end-side{display:none!important}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-arrow{font-size:.875rem!important}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items{display:flex;align-items:center;gap:.5rem}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix{display:flex;align-items:center;gap:.5rem;padding:.375rem;padding-inline-end:.5rem!important;border-radius:.25rem}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix.noselect-tree-view{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix.ax-state-tree-view-active{background-color:rgba(var(--ax-color-primary-500));color:#fff}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix.ax-state-tree-view-active:hover{background-color:rgba(var(--ax-color-primary-500))}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix:hover{background-color:rgba(var(--ax-color-on-surface))}ax-tree-view ax-tree-view-item .ax-state-tree-view-rtl{padding-inline-end:.5rem}ax-tree-view ax-tree-view-item .ax-state-tree-view-ltr{padding-inline-start:.5rem}ax-tree-view ax-tree-view-item .ax-state-disabled{cursor:not-allowed!important;opacity:.5!important}ax-tree-view ax-tree-view-item .arrow-container{position:relative;display:flex;align-items:center}ax-tree-view ax-tree-view-item .vertical-line{width:.125rem;height:100%;background-color:#ccc;position:absolute;bottom:-10px;left:50%;transform:translate(-50%)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2$1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2$1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "component", type: i3.AXCheckBoxComponent, selector: "ax-check-box", inputs: ["disabled", "tabIndex", "readonly", "color", "value", "name", "id", "checked", "indeterminate"], outputs: ["onBlur", "onFocus", "valueChange", "onValueChanged"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AXTreeViewItemComponent, selector: "ax-tree-view-item", inputs: ["item", "isExpanded", "hasChildField", "isActive", "isLoading", "disableField"], outputs: ["onNodeExpand", "onNodeClick", "isExpandedChange", "isActiveChange", "onNodeDbClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
384
+ }
385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewComponent, decorators: [{
386
+ type: Component,
387
+ args: [{ selector: 'ax-tree-view', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (node of resolvedItems; track $index) {\n <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: node }\"></ng-container>\n}\n\n<ng-template #Recursion let-item>\n @if (item[visibleField()] !== false) {\n <ax-tree-view-item\n [item]=\"item\"\n [(isExpanded)]=\"item.isExpanded\"\n [(isActive)]=\"item.active\"\n [isLoading]=\"isNodeLoading(item.id)\"\n [disableField]=\"disableField()\"\n [hasChildField]=\"hasChildField()\"\n (onNodeExpand)=\"handleNodeExpandClick($event)\"\n (onNodeClick)=\"handleNodeClick($event)\"\n (onNodeDbClick)=\"handleNodeDbClick($event)\"\n >\n @if (this.selectable()) {\n <ax-check-box\n [disabled]=\"item[disableField()]\"\n [indeterminate]=\"item.indeterminate\"\n [(ngModel)]=\"item.selected\"\n (onValueChanged)=\"handleNodeSelectionClick($event, item)\"\n ></ax-check-box>\n }\n <ax-prefix>\n @if (item[iconField()]) {\n <ax-icon [icon]=\"item[iconField()]\"></ax-icon>\n } @else {\n <i></i>\n }\n </ax-prefix>\n @if (item[textField()]) {\n <ax-text>{{ item[textField()] }}</ax-text>\n }\n\n <ax-suffix></ax-suffix>\n @for (child of item?.childrens; track $index) {\n <ng-container\n [ngTemplateOutlet]=\"Recursion\"\n [ngTemplateOutletContext]=\"{ $implicit: child }\"\n ></ng-container>\n }\n </ax-tree-view-item>\n }\n</ng-template>\n", styles: ["ax-tree-view ax-tree-view-item .ax-tree-view-container{display:flex;align-items:center;margin-bottom:.125rem;cursor:pointer}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-checkbox-end-side{display:none!important}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-arrow{font-size:.875rem!important}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items{display:flex;align-items:center;gap:.5rem}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix{display:flex;align-items:center;gap:.5rem;padding:.375rem;padding-inline-end:.5rem!important;border-radius:.25rem}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix.noselect-tree-view{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix.ax-state-tree-view-active{background-color:rgba(var(--ax-color-primary-500));color:#fff}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix.ax-state-tree-view-active:hover{background-color:rgba(var(--ax-color-primary-500))}ax-tree-view ax-tree-view-item .ax-tree-view-container .ax-tree-view-items .ax-tree-view-items-prefix:hover{background-color:rgba(var(--ax-color-on-surface))}ax-tree-view ax-tree-view-item .ax-state-tree-view-rtl{padding-inline-end:.5rem}ax-tree-view ax-tree-view-item .ax-state-tree-view-ltr{padding-inline-start:.5rem}ax-tree-view ax-tree-view-item .ax-state-disabled{cursor:not-allowed!important;opacity:.5!important}ax-tree-view ax-tree-view-item .arrow-container{position:relative;display:flex;align-items:center}ax-tree-view ax-tree-view-item .vertical-line{width:.125rem;height:100%;background-color:#ccc;position:absolute;bottom:-10px;left:50%;transform:translate(-50%)}\n"] }]
388
+ }], ctorParameters: () => [] });
389
+
390
+ class AXTreeViewModule {
391
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
392
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewModule, declarations: [AXTreeViewComponent, AXTreeViewItemComponent], imports: [CommonModule,
393
+ AXCommonModule,
394
+ AXDecoratorModule,
395
+ AXCheckBoxModule,
396
+ AXFormModule,
397
+ FormsModule,
398
+ AXTooltipModule,
399
+ AXLoadingModule], exports: [AXTreeViewComponent, AXTreeViewItemComponent] }); }
400
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewModule, imports: [CommonModule,
401
+ AXCommonModule,
402
+ AXDecoratorModule,
403
+ AXCheckBoxModule,
404
+ AXFormModule,
405
+ FormsModule,
406
+ AXTooltipModule,
407
+ AXLoadingModule] }); }
408
+ }
409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTreeViewModule, decorators: [{
410
+ type: NgModule,
411
+ args: [{
412
+ imports: [
413
+ CommonModule,
414
+ AXCommonModule,
415
+ AXDecoratorModule,
416
+ AXCheckBoxModule,
417
+ AXFormModule,
418
+ FormsModule,
419
+ AXTooltipModule,
420
+ AXLoadingModule,
421
+ ],
422
+ exports: [AXTreeViewComponent, AXTreeViewItemComponent],
423
+ declarations: [AXTreeViewComponent, AXTreeViewItemComponent],
424
+ providers: [],
425
+ }]
426
+ }] });
427
+
428
+ /**
429
+ * Generated bundle index. Do not edit.
430
+ */
431
+
432
+ export { AXTreeViewComponent, AXTreeViewItemComponent, AXTreeViewModule };
433
+ //# sourceMappingURL=acorex-components-tree-view.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-components-tree-view.mjs","sources":["../../../../libs/components/tree-view/src/lib/tree-view-item.component.ts","../../../../libs/components/tree-view/src/lib/tree-view-item.component.html","../../../../libs/components/tree-view/src/lib/tree-view.component.ts","../../../../libs/components/tree-view/src/lib/tree-view.component.html","../../../../libs/components/tree-view/src/lib/tree-view.component.module.ts","../../../../libs/components/tree-view/src/acorex-components-tree-view.ts"],"sourcesContent":["import { NXComponent } from '@acorex/components/common';\nimport { AXPlatform } from '@acorex/core/platform';\nimport { animate, state, style, transition, trigger } from '@angular/animations';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n model,\n output,\n ViewEncapsulation,\n} from '@angular/core';\nimport { AXTreeItemClickBaseEvent, AXTreeViewSchema } from './tree-view.class';\n\n@Component({\n selector: 'ax-tree-view-item',\n templateUrl: 'tree-view-item.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [\n trigger('collapseExpand', [\n state(\n 'collapsed',\n style({\n height: '0',\n overflow: 'hidden',\n opacity: 0,\n }),\n ),\n state(\n 'expanded',\n style({\n height: '*',\n overflow: 'hidden',\n opacity: 1,\n }),\n ),\n transition('collapsed <=> expanded', [animate('300ms ease-in-out')]),\n ]),\n ],\n})\nexport class AXTreeViewItemComponent extends NXComponent {\n constructor() {\n super();\n }\n\n item = input<AXTreeViewSchema>();\n\n onNodeExpand = output<AXTreeItemClickBaseEvent>();\n\n onNodeClick = output<AXTreeItemClickBaseEvent>();\n\n isExpanded = model<boolean>(false);\n\n hasChildField = input<string>();\n\n isActive = model<boolean>(false);\n\n onNodeDbClick = output<AXTreeItemClickBaseEvent>();\n\n isLoading = input<boolean>(false);\n\n disableField = input<string>();\n\n protected platformService = inject(AXPlatform);\n\n protected arrowIcon = computed(() => {\n if (this.isExpanded()) {\n return 'ax-tree-view-arrow ax-icon ax-icon-solid ax-icon-chevron-down';\n } else {\n return this.platformService.isRtl()\n ? 'ax-tree-view-arrow ax-icon ax-icon-solid ax-icon-chevron-left'\n : 'ax-tree-view-arrow ax-icon ax-icon-solid ax-icon-chevron-right';\n }\n });\n\n protected handleArrowNodeClick() {\n if (this.item()[this.disableField()] || this.isLoading()) {\n return;\n }\n\n this.isExpanded.set(!this.isExpanded());\n\n this.onNodeExpand.emit({ component: this, data: this.item(), nativeElement: this.nativeElement });\n }\n\n protected handleTextClick(item: AXTreeViewSchema) {\n this.onNodeClick.emit({ component: this, data: item, nativeElement: this.nativeElement });\n }\n\n protected handleTextDbClick(item: AXTreeViewSchema) {\n if (item[this.disableField()]) {\n return;\n }\n if (item?.childrens?.length || item[this.hasChildField()]) {\n this.isExpanded.set(!this.isExpanded());\n this.onNodeDbClick.emit({ component: this, data: item, nativeElement: this.nativeElement });\n }\n }\n}\n","<div class=\"ax-tree-view-container\">\n @if ((item().childrens && !isLoading()) || (item()[hasChildField()] && !isLoading())) {\n <i\n [class.ax-state-disabled]=\"item()[disableField()]\"\n (click)=\"handleArrowNodeClick()\"\n class=\"{{ arrowIcon() }}\"\n ></i>\n } @else if (isLoading()) {\n <ax-loading></ax-loading>\n } @else {\n <i class=\"ax-icon\"></i>\n }\n\n <div class=\"ax-tree-view-items\">\n <ng-content select=\"ax-check-box\"></ng-content>\n <div\n [class.ax-state-disabled]=\"item()[disableField()]\"\n [axTooltip]=\"item().tooltip\"\n axTooltipPlacement=\"end-bottom\"\n (click)=\"handleTextClick(item())\"\n (dblclick)=\"handleTextDbClick(item())\"\n class=\"ax-tree-view-items-prefix noselect-tree-view\"\n [class.ax-state-tree-view-active]=\"item().active\"\n >\n <ng-content select=\"ax-prefix\"></ng-content>\n <ng-content select=\"ax-text\"></ng-content>\n <ng-content select=\"ax-suffix\"></ng-content>\n </div>\n </div>\n</div>\n\n<div\n class=\"{{ platformService.isRtl() ? 'ax-state-tree-view-rtl' : 'ax-state-tree-view-ltr' }}\"\n [@collapseExpand]=\"isExpanded() ? 'expanded' : 'collapsed'\"\n>\n <ng-content></ng-content>\n</div>\n","import { AXValueChangedEvent, NXComponent } from '@acorex/components/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n effect,\n input,\n output,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport { AXTreeItemClickBaseEvent, AXTreeViewSchema, SelectionBehaviorType } from './tree-view.class';\n\n@Component({\n selector: 'ax-tree-view',\n templateUrl: 'tree-view.component.html',\n styleUrls: ['tree-view.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AXTreeViewComponent extends NXComponent {\n constructor() {\n super();\n }\n\n private itemsSignal = signal<AXTreeViewSchema[]>([]);\n\n private itemsPromise: any;\n\n #effect = effect(\n () => {\n const itemsInput = this.items();\n\n if (typeof itemsInput === 'function') {\n const result = itemsInput();\n if (result instanceof Promise) {\n this.itemsPromise = (options) => itemsInput(options);\n this.fetchData();\n } else {\n this.itemsSignal.set(result);\n this.itemsPromise = null;\n }\n } else {\n this.itemsSignal.set(itemsInput);\n this.itemsPromise = null;\n }\n },\n { allowSignalWrites: true },\n );\n\n items = input<\n | AXTreeViewSchema[]\n | ((options?: { parentId: string | number }) => AXTreeViewSchema[] | Promise<AXTreeViewSchema[]>)\n >();\n\n protected get resolvedItems() {\n return this.itemsSignal();\n }\n\n selectable = input<boolean>(true);\n\n selectionMode = input<'single' | 'multiple'>('single');\n\n selectionBehavior = input<SelectionBehaviorType>(null);\n\n showActiveNode = signal<boolean>(true);\n\n valueField = input<string>('id');\n\n textField = input<string>('text');\n\n visibleField = input<string>('visible');\n\n disableField = input<string>('disabled');\n\n hasChildField = input<string>();\n\n iconField = input<string>('icon');\n\n onSelectionChange = output<AXTreeItemClickBaseEvent>();\n\n onItemClick = output<AXTreeItemClickBaseEvent>();\n\n onNodeClick = output<AXTreeItemClickBaseEvent>();\n\n protected handleNodeSelectionClick(event: AXValueChangedEvent, item: AXTreeViewSchema) {\n if (item[this.disableField()] || this.isNodeLoading(item.id)) {\n return;\n }\n\n if (this.selectionMode() === 'single' && event.isUserInteraction) {\n this.handleUnSelectNode(this.itemsSignal());\n }\n item.selected = event.value;\n\n if (event.value != null) {\n switch (this.selectionBehavior()) {\n case 'autoExpand':\n if (event.value) {\n if (this.itemsPromise && item[this.hasChildField()] && !item?.childrens?.length) {\n this.fetchData(item.id);\n this.setNodeLoading(item.id, true);\n }\n\n this.toggleExpand(item);\n }\n break;\n case 'expandAndSelectAllOrUnSelect':\n if (this.itemsPromise) {\n console.error('This mode only available client Side');\n return;\n }\n this.expandAndToggleSelection(item, event.value);\n break;\n case 'indeterminate':\n if (item?.childrens?.length) {\n this.applySelectionToChildren(item, event.value, item[this.valueField()]);\n }\n this.updateParentSelection(item, event.value);\n break;\n default:\n break;\n }\n }\n\n if (event.isUserInteraction) {\n const result: AXTreeViewSchema[] = this.findSelectedNodes(this.itemsSignal());\n\n this.onSelectionChange.emit({\n component: this,\n data: result,\n nativeElement: this.nativeElement,\n });\n\n this.onItemClick.emit({ component: this, data: item, nativeElement: this.nativeElement });\n }\n }\n\n /**\n *\n * auto expand\n *\n */\n private toggleExpand(item: AXTreeViewSchema) {\n if (!item.isExpanded) {\n item.isExpanded = true;\n }\n }\n\n /**\n *\n * expand and change value parent change\n *\n */\n\n private expandAndToggleSelection(item: AXTreeViewSchema, selected: boolean) {\n this.toggleExpand(item);\n\n if (item.childrens?.length) {\n this.applySelectionToChildren(item, selected, item[this.valueField()]);\n }\n }\n\n private applySelectionToChildren(item: AXTreeViewSchema, isSelected: boolean, parentId?: number | string) {\n item.childrens.forEach((child) => {\n child.parentId = parentId;\n child.selected = isSelected;\n if (child.childrens?.length) {\n this.applySelectionToChildren(child, isSelected, child.id);\n }\n });\n }\n\n /**\n *\n * indeterminate logic\n *\n */\n\n private updateParentSelection(item: AXTreeViewSchema, selected: boolean) {\n item.selected = selected;\n\n let parent = this.findParent(item, this.itemsSignal());\n\n while ((parent && parent.selected != false) || (parent && item.selected)) {\n const allSelected = parent?.childrens?.every((child) => child.selected);\n\n const someSelected = parent?.childrens?.some((child) => child.selected || child.indeterminate);\n\n if (!allSelected && !someSelected) {\n parent.selected = false;\n parent.indeterminate = null;\n } else if (!allSelected) {\n parent.indeterminate = true;\n parent.selected = null;\n } else if (allSelected) {\n parent.selected = true;\n parent.indeterminate = false;\n } else {\n parent.indeterminate = false;\n parent.selected = true;\n }\n\n parent = this.findParent(parent, this.itemsSignal());\n }\n }\n\n private findParent(item: AXTreeViewSchema, nodes: AXTreeViewSchema[]): AXTreeViewSchema | null {\n for (let node of nodes) {\n if (node.childrens?.includes(item)) {\n return node;\n } else if (node.childrens) {\n const parent = this.findParent(item, node.childrens);\n if (parent) return parent;\n }\n }\n return null;\n }\n\n /**\n *\n * find node selected true for emit Selections\n *\n */\n\n private findSelectedNodes(nodes: AXTreeViewSchema[]): AXTreeViewSchema[] {\n let selectedNodes: AXTreeViewSchema[] = [];\n\n nodes.forEach((node) => {\n if (node.selected) {\n selectedNodes.push(node);\n }\n\n if (node.childrens) {\n selectedNodes = selectedNodes.concat(this.findSelectedNodes(node.childrens));\n }\n });\n\n return selectedNodes;\n }\n\n /**\n *\n * find for emit Selections single mode\n *\n */\n\n private handleUnSelectNode(items: AXTreeViewSchema[]) {\n items.forEach((child) => {\n child.selected = false;\n if (child?.childrens?.length) {\n this.handleUnSelectNode(child.childrens);\n }\n });\n }\n\n /**\n *\n * lazy load logic\n *\n */\n\n private fetchData(parentId?: number | string) {\n this.itemsPromise({ parentId })\n .then((data: AXTreeViewSchema[]) => {\n if (Array.isArray(data)) {\n if (parentId) {\n this.findNode(parentId, data, this.itemsSignal());\n } else {\n this.itemsSignal.set(data);\n }\n }\n })\n .finally(() => {\n this.setNodeLoading(parentId, false);\n });\n }\n\n private findNode(parentId: number | string, _children: AXTreeViewSchema[], source: AXTreeViewSchema[]) {\n if (source.length) {\n source.forEach((element) => {\n if (element[this.valueField()] == parentId) {\n element.childrens = _children;\n } else {\n if (element?.childrens) this.findNode(parentId, _children, element.childrens);\n }\n });\n }\n }\n\n /**\n *\n * emit when arrow click\n *\n */\n\n protected handleNodeExpandClick(node: AXTreeItemClickBaseEvent) {\n const parentId = node.data.id;\n if (this.itemsPromise && node.data.isExpanded && !node?.data.childrens?.length) {\n this.fetchData(parentId);\n this.setNodeLoading(node.data.id, true);\n }\n this.onItemClick.emit({ component: this, data: node.data, nativeElement: this.nativeElement });\n }\n\n protected handleNodeClick(node: AXTreeItemClickBaseEvent) {\n if (node.data[this.disableField()]) {\n return;\n }\n if (this.showActiveNode()) {\n this.handleUnActiveNode(this.itemsSignal());\n node.data.active = true;\n }\n ///to do\n // switch (this.selectionBehavior()) {\n // case 'activeAndSelect':\n // if (this.selectionMode() === 'single') {\n // this.handleUnselectNode(this.itemsSignal());\n // }\n // node.selected = true;\n\n // break;\n\n // default:\n // break;\n // }\n this.onNodeClick.emit({ component: this, data: node.data, nativeElement: this.nativeElement });\n }\n\n private handleUnActiveNode(unActiveSource: AXTreeViewSchema[]) {\n unActiveSource.forEach((child) => {\n child.active = false;\n if (child?.childrens?.length) {\n this.handleUnActiveNode(child.childrens);\n }\n });\n }\n\n protected handleNodeDbClick(node: AXTreeItemClickBaseEvent) {\n if (this.itemsPromise) {\n const nodeParentId = node.data.id;\n this.fetchData(nodeParentId);\n this.setNodeLoading(node.data.id, true);\n }\n }\n\n private loadingState = signal<Record<string | number, boolean>>({});\n\n isNodeLoading(nodeId: string | number): boolean {\n return this.loadingState()[nodeId] || false;\n }\n\n setNodeLoading(nodeId: string | number, isLoading: boolean): void {\n this.loadingState.update((state) => ({\n ...state,\n [nodeId]: isLoading,\n }));\n }\n}\n","@for (node of resolvedItems; track $index) {\n <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: node }\"></ng-container>\n}\n\n<ng-template #Recursion let-item>\n @if (item[visibleField()] !== false) {\n <ax-tree-view-item\n [item]=\"item\"\n [(isExpanded)]=\"item.isExpanded\"\n [(isActive)]=\"item.active\"\n [isLoading]=\"isNodeLoading(item.id)\"\n [disableField]=\"disableField()\"\n [hasChildField]=\"hasChildField()\"\n (onNodeExpand)=\"handleNodeExpandClick($event)\"\n (onNodeClick)=\"handleNodeClick($event)\"\n (onNodeDbClick)=\"handleNodeDbClick($event)\"\n >\n @if (this.selectable()) {\n <ax-check-box\n [disabled]=\"item[disableField()]\"\n [indeterminate]=\"item.indeterminate\"\n [(ngModel)]=\"item.selected\"\n (onValueChanged)=\"handleNodeSelectionClick($event, item)\"\n ></ax-check-box>\n }\n <ax-prefix>\n @if (item[iconField()]) {\n <ax-icon [icon]=\"item[iconField()]\"></ax-icon>\n } @else {\n <i></i>\n }\n </ax-prefix>\n @if (item[textField()]) {\n <ax-text>{{ item[textField()] }}</ax-text>\n }\n\n <ax-suffix></ax-suffix>\n @for (child of item?.childrens; track $index) {\n <ng-container\n [ngTemplateOutlet]=\"Recursion\"\n [ngTemplateOutletContext]=\"{ $implicit: child }\"\n ></ng-container>\n }\n </ax-tree-view-item>\n }\n</ng-template>\n","import { AXCheckBoxModule } from '@acorex/components/check-box';\nimport { AXCommonModule } from '@acorex/components/common';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXFormModule } from '@acorex/components/form';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTooltipModule } from '@acorex/components/tooltip';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { AXTreeViewItemComponent } from './tree-view-item.component';\nimport { AXTreeViewComponent } from './tree-view.component';\n@NgModule({\n imports: [\n CommonModule,\n AXCommonModule,\n AXDecoratorModule,\n AXCheckBoxModule,\n AXFormModule,\n FormsModule,\n AXTooltipModule,\n AXLoadingModule,\n ],\n exports: [AXTreeViewComponent, AXTreeViewItemComponent],\n declarations: [AXTreeViewComponent, AXTreeViewItemComponent],\n providers: [],\n})\nexport class AXTreeViewModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2","i5.AXTreeViewItemComponent"],"mappings":";;;;;;;;;;;;;;;;;;;AA0CM,MAAO,uBAAwB,SAAQ,WAAW,CAAA;AACtD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;QAGT,IAAI,CAAA,IAAA,GAAG,KAAK,EAAoB;QAEhC,IAAY,CAAA,YAAA,GAAG,MAAM,EAA4B;QAEjD,IAAW,CAAA,WAAA,GAAG,MAAM,EAA4B;AAEhD,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAU,KAAK,CAAC;QAElC,IAAa,CAAA,aAAA,GAAG,KAAK,EAAU;AAE/B,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;QAEhC,IAAa,CAAA,aAAA,GAAG,MAAM,EAA4B;AAElD,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAU,KAAK,CAAC;QAEjC,IAAY,CAAA,YAAA,GAAG,KAAK,EAAU;AAEpB,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC;AAEpC,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAK;AAClC,YAAA,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;AACrB,gBAAA,OAAO,+DAA+D;;iBACjE;AACL,gBAAA,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK;AAC/B,sBAAE;sBACA,gEAAgE;;AAExE,SAAC,CAAC;;IAEQ,oBAAoB,GAAA;AAC5B,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE;YACxD;;QAGF,IAAI,CAAC,UAAU,CAAC,GAAG,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,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,cAAc;wBACd,iBAAiB;wBACjB,gBAAgB;wBAChB,YAAY;wBACZ,WAAW;wBACX,eAAe;wBACf,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;AACvD,oBAAA,YAAY,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;AAC5D,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;ACzBD;;AAEG;;;;"}
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, computed, inject, Injectable, ChangeDetectorRef, EventEmitter, Directive, Input, Output, HostBinding, ElementRef, Component, ViewEncapsulation, input, NgModule } from '@angular/core';
2
+ import { signal, computed, inject, Injectable, ChangeDetectorRef, PLATFORM_ID, EventEmitter, Directive, Input, Output, HostBinding, ElementRef, Component, ViewEncapsulation, input, NgModule } from '@angular/core';
3
3
  import * as i3 from '@acorex/core/translation';
4
4
  import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
5
5
  import { AXUnsubscriber } from '@acorex/core/utils';
6
6
  import * as i1$1 from '@angular/common';
7
- import { DOCUMENT, CommonModule } from '@angular/common';
7
+ import { DOCUMENT, isPlatformBrowser, CommonModule } from '@angular/common';
8
8
  import { AXPopupService, AXPopupModule } from '@acorex/components/popup';
9
9
  import { AXFileService, AXFileModule } from '@acorex/core/file';
10
10
  import { sumBy } from 'lodash-es';
@@ -243,6 +243,7 @@ class AXUploaderZoneDirective {
243
243
  this.accept = null;
244
244
  this.cdr = inject(ChangeDetectorRef);
245
245
  this.document = inject(DOCUMENT);
246
+ this.platformID = inject(PLATFORM_ID);
246
247
  this.uploadService = inject(AXUploaderService);
247
248
  this.unsubscriber = inject(AXUnsubscriber);
248
249
  this.translateService = inject(AXTranslationService);
@@ -295,21 +296,25 @@ class AXUploaderZoneDirective {
295
296
  event.stopImmediatePropagation();
296
297
  }
297
298
  createZone() {
298
- this.overlayElement = this.document.createElement('div');
299
- this.overlayElement.classList.add('ax-uploader-overlay-state', '-ax-z-1');
300
- this.overlayElement.id = 'ax-uploader-overlay-state';
301
- const icon = this.document.createElement('span');
302
- icon.classList.add('ax-icon', 'ax-icon-upload');
303
- const text = this.document.createElement('span');
304
- text.innerText = this.translateService.translateSync('uploader.zone.text');
305
- this.overlayElement.appendChild(icon);
306
- this.overlayElement.appendChild(text);
307
- this.element.appendChild(this.overlayElement);
299
+ if (isPlatformBrowser(this.platformID)) {
300
+ this.overlayElement = this.document.createElement('div');
301
+ this.overlayElement.classList.add('ax-uploader-overlay-state', '-ax-z-1');
302
+ this.overlayElement.id = 'ax-uploader-overlay-state';
303
+ const icon = this.document.createElement('span');
304
+ icon.classList.add('ax-icon', 'ax-icon-upload');
305
+ const text = this.document.createElement('span');
306
+ text.innerText = this.translateService.translateSync('uploader.zone.text');
307
+ this.overlayElement.appendChild(icon);
308
+ this.overlayElement.appendChild(text);
309
+ this.element.appendChild(this.overlayElement);
310
+ }
308
311
  }
309
312
  removeZone() {
310
- this.element.removeChild(this.document.getElementById('ax-uploader-overlay-state'));
311
- this.overlayElement.remove();
312
- //console.log(this.overlayElement);
313
+ if (isPlatformBrowser(this.platformID)) {
314
+ this.element.removeChild(this.document.getElementById('ax-uploader-overlay-state'));
315
+ this.overlayElement.remove();
316
+ //console.log(this.overlayElement);
317
+ }
313
318
  }
314
319
  async browser() {
315
320
  const requests = await this.uploadService.browse({ accept: this.accept, multiple: this.multiple });