@acorex/platform 20.2.4-next.9 → 20.3.0-next.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 (90) hide show
  1. package/common/index.d.ts +5 -119
  2. package/core/index.d.ts +67 -71
  3. package/fesm2022/acorex-platform-common.mjs +9 -19
  4. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-core.mjs +158 -113
  6. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-builder.mjs +638 -1168
  8. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-components.mjs +46 -1087
  10. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-layout-designer.mjs +137 -92
  12. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-layout-entity.mjs +1064 -3100
  14. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-layout-views.mjs +72 -332
  16. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-themes-default-create-entity-view.component-SY0oMDoH.mjs +22 -0
  18. package/fesm2022/acorex-platform-themes-default-create-entity-view.component-SY0oMDoH.mjs.map +1 -0
  19. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-I7Eq8Nti.mjs → acorex-platform-themes-default-entity-master-create-view.component-hHXxHlFG.mjs} +3 -3
  20. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-I7Eq8Nti.mjs.map → acorex-platform-themes-default-entity-master-create-view.component-hHXxHlFG.mjs.map} +1 -1
  21. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-hf4QOz_4.mjs +665 -0
  22. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-hf4QOz_4.mjs.map +1 -0
  23. package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-16sdMBvH.mjs → acorex-platform-themes-default-entity-master-modify-view.component-DC3MrDtI.mjs} +10 -3
  24. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-DC3MrDtI.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-Bb90PeHq.mjs +236 -0
  26. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-Bb90PeHq.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-themes-default.mjs +484 -39
  28. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  29. package/fesm2022/{acorex-platform-themes-shared-theme-color-chooser-column.component-DjKLg513.mjs → acorex-platform-themes-shared-color-chooser-column.component-DjKLg513.mjs} +1 -1
  30. package/fesm2022/acorex-platform-themes-shared-color-chooser-column.component-DjKLg513.mjs.map +1 -0
  31. package/fesm2022/{acorex-platform-themes-shared-theme-color-chooser-view.component-DE0wO98F.mjs → acorex-platform-themes-shared-color-chooser-view.component-DE0wO98F.mjs} +1 -1
  32. package/fesm2022/acorex-platform-themes-shared-color-chooser-view.component-DE0wO98F.mjs.map +1 -0
  33. package/fesm2022/acorex-platform-themes-shared.mjs +13 -11
  34. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  35. package/fesm2022/{acorex-platform-widgets-button-widget-designer.component-BJtkWusr.mjs → acorex-platform-widgets-button-widget-designer.component-lNF95FJv.mjs} +3 -3
  36. package/fesm2022/acorex-platform-widgets-button-widget-designer.component-lNF95FJv.mjs.map +1 -0
  37. package/fesm2022/{acorex-platform-widgets-checkbox-widget-column.component-DeKpl0uK.mjs → acorex-platform-widgets-checkbox-widget-column.component-BNBOATPB.mjs} +2 -1
  38. package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-BNBOATPB.mjs.map +1 -0
  39. package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-Cv7dEMCm.mjs → acorex-platform-widgets-checkbox-widget-designer.component-BI18uzNZ.mjs} +2 -2
  40. package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-BI18uzNZ.mjs.map +1 -0
  41. package/fesm2022/{acorex-platform-widgets-color-box-widget-designer.component-CohkI1w1.mjs → acorex-platform-widgets-color-box-widget-designer.component-pYOQv5g8.mjs} +2 -2
  42. package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-pYOQv5g8.mjs.map +1 -0
  43. package/fesm2022/{acorex-platform-widgets-file-list-popup.component-BafU5Lfl.mjs → acorex-platform-widgets-file-list-popup.component-DFbPO0ud.mjs} +4 -69
  44. package/fesm2022/acorex-platform-widgets-file-list-popup.component-DFbPO0ud.mjs.map +1 -0
  45. package/fesm2022/{acorex-platform-widgets-page-widget-designer.component-Cw9WcZze.mjs → acorex-platform-widgets-page-widget-designer.component-DRsLkulH.mjs} +64 -74
  46. package/fesm2022/acorex-platform-widgets-page-widget-designer.component-DRsLkulH.mjs.map +1 -0
  47. package/fesm2022/{acorex-platform-widgets-tabular-data-edit-popup.component-BDQIfr0g.mjs → acorex-platform-widgets-tabular-data-edit-popup.component-nLZYiPnF.mjs} +5 -5
  48. package/fesm2022/{acorex-platform-widgets-tabular-data-edit-popup.component-BDQIfr0g.mjs.map → acorex-platform-widgets-tabular-data-edit-popup.component-nLZYiPnF.mjs.map} +1 -1
  49. package/fesm2022/{acorex-platform-widgets-tabular-data-view-popup.component-CmPqtt0G.mjs → acorex-platform-widgets-tabular-data-view-popup.component-D6kiasYM.mjs} +3 -3
  50. package/fesm2022/{acorex-platform-widgets-tabular-data-view-popup.component-CmPqtt0G.mjs.map → acorex-platform-widgets-tabular-data-view-popup.component-D6kiasYM.mjs.map} +1 -1
  51. package/fesm2022/{acorex-platform-widgets-text-block-widget-designer.component-DaR4Nkv4.mjs → acorex-platform-widgets-text-block-widget-designer.component-CCMQtH3e.mjs} +12 -8
  52. package/fesm2022/acorex-platform-widgets-text-block-widget-designer.component-CCMQtH3e.mjs.map +1 -0
  53. package/fesm2022/acorex-platform-widgets.mjs +1442 -2641
  54. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  55. package/fesm2022/acorex-platform-workflow.mjs +0 -3
  56. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  57. package/layout/builder/index.d.ts +181 -367
  58. package/layout/components/index.d.ts +20 -217
  59. package/layout/designer/index.d.ts +47 -16
  60. package/layout/entity/index.d.ts +336 -196
  61. package/layout/views/index.d.ts +21 -118
  62. package/package.json +37 -23
  63. package/widgets/index.d.ts +224 -275
  64. package/workflow/index.d.ts +1 -3
  65. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-D3VUh8K8.mjs +0 -707
  66. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-D3VUh8K8.mjs.map +0 -1
  67. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-16sdMBvH.mjs.map +0 -1
  68. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-BMkhNfF4.mjs +0 -244
  69. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-BMkhNfF4.mjs.map +0 -1
  70. package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-column.component-DjKLg513.mjs.map +0 -1
  71. package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-view.component-DE0wO98F.mjs.map +0 -1
  72. package/fesm2022/acorex-platform-widgets-button-widget-designer.component-BJtkWusr.mjs.map +0 -1
  73. package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-DeKpl0uK.mjs.map +0 -1
  74. package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-Cv7dEMCm.mjs.map +0 -1
  75. package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-CohkI1w1.mjs.map +0 -1
  76. package/fesm2022/acorex-platform-widgets-extra-properties-schema-widget-edit.component-B3SJUnGQ.mjs +0 -50
  77. package/fesm2022/acorex-platform-widgets-extra-properties-schema-widget-edit.component-B3SJUnGQ.mjs.map +0 -1
  78. package/fesm2022/acorex-platform-widgets-extra-properties-schema-widget-view.component-BLR0JkRt.mjs +0 -42
  79. package/fesm2022/acorex-platform-widgets-extra-properties-schema-widget-view.component-BLR0JkRt.mjs.map +0 -1
  80. package/fesm2022/acorex-platform-widgets-extra-properties-values-widget-edit.component-hzR2FgOm.mjs +0 -55
  81. package/fesm2022/acorex-platform-widgets-extra-properties-values-widget-edit.component-hzR2FgOm.mjs.map +0 -1
  82. package/fesm2022/acorex-platform-widgets-extra-properties-values-widget-view.component-IDm6Clua.mjs +0 -50
  83. package/fesm2022/acorex-platform-widgets-extra-properties-values-widget-view.component-IDm6Clua.mjs.map +0 -1
  84. package/fesm2022/acorex-platform-widgets-extra-properties-widget-edit.component-BRO9tYDa.mjs +0 -48
  85. package/fesm2022/acorex-platform-widgets-extra-properties-widget-edit.component-BRO9tYDa.mjs.map +0 -1
  86. package/fesm2022/acorex-platform-widgets-extra-properties-widget-view.component-CkpLimyW.mjs +0 -42
  87. package/fesm2022/acorex-platform-widgets-extra-properties-widget-view.component-CkpLimyW.mjs.map +0 -1
  88. package/fesm2022/acorex-platform-widgets-file-list-popup.component-BafU5Lfl.mjs.map +0 -1
  89. package/fesm2022/acorex-platform-widgets-page-widget-designer.component-Cw9WcZze.mjs.map +0 -1
  90. package/fesm2022/acorex-platform-widgets-text-block-widget-designer.component-DaR4Nkv4.mjs.map +0 -1
@@ -1,19 +1,18 @@
1
- import * as i0 from '@angular/core';
2
- import { signal, computed, Injectable, InjectionToken, inject, ElementRef, effect, Injector, ChangeDetectorRef, ViewChild, Input, ChangeDetectionStrategy, Component, EventEmitter, Output, input, output, ViewContainerRef, Directive, Optional, Inject, NgModule } from '@angular/core';
3
- import { convertArrayToDataSource, AXDataSource } from '@acorex/cdk/common';
4
- import { setSmart, AXPDataSourceDefinitionProviderService, extractValue, getSmart, AXPExpressionEvaluatorService } from '@acorex/platform/core';
5
- import { set, cloneDeep, isEqual, get, merge, isNil, isUndefined, isObjectLike, sum, isEmpty, isString } from 'lodash-es';
6
- import { Subject, BehaviorSubject, filter } from 'rxjs';
7
- import { signalStore, withState, withComputed, withMethods, patchState } from '@ngrx/signals';
8
1
  import * as i1$1 from '@acorex/components/skeleton';
9
2
  import { AXSkeletonModule } from '@acorex/components/skeleton';
10
- import * as i2 from '@acorex/core/translation';
11
- import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
12
3
  import { PortalModule } from '@angular/cdk/portal';
13
4
  import * as i1 from '@angular/common';
14
5
  import { CommonModule } from '@angular/common';
6
+ import * as i0 from '@angular/core';
7
+ import { signal, computed, Injectable, InjectionToken, inject, Injector, ChangeDetectorRef, ViewChild, Input, ChangeDetectionStrategy, Component, EventEmitter, effect, Output, input, output, ViewContainerRef, Directive, Optional, Inject, NgModule, ElementRef } from '@angular/core';
15
8
  import { AXDataTableColumnComponent, AXBaseDataTable } from '@acorex/components/data-table';
9
+ import { set, merge, cloneDeep, isNil, isEqual, get, sum, isEmpty, isString, isUndefined, isObjectLike } from 'lodash-es';
10
+ import { Subject, filter, BehaviorSubject } from 'rxjs';
11
+ import { getSmart, setSmart, AXPExpressionEvaluatorService, AXPDataSourceDefinitionProviderService, extractValue } from '@acorex/platform/core';
12
+ import { signalStore, withState, withComputed, withMethods, patchState } from '@ngrx/signals';
13
+ import { AXTranslationService } from '@acorex/core/translation';
16
14
  import { AXUnsubscriber } from '@acorex/core/utils';
15
+ import { convertArrayToDataSource, AXDataSource } from '@acorex/cdk/common';
17
16
 
18
17
  var AXPPageStatus;
19
18
  (function (AXPPageStatus) {
@@ -55,7 +54,6 @@ class AXPLayoutBuilderService {
55
54
  this.functions$ = signal({}, ...(ngDevMode ? [{ debugName: "functions$" }] : []));
56
55
  this.onRefresh = new Subject();
57
56
  this.widgets = new Map();
58
- this.onWidgetRegistered = new Subject();
59
57
  this.status$ = signal(AXPPageStatus.Rendering, ...(ngDevMode ? [{ debugName: "status$" }] : []));
60
58
  this.status = this.status$.asReadonly();
61
59
  this.isBusy = computed(() => {
@@ -72,7 +70,7 @@ class AXPLayoutBuilderService {
72
70
  this.status$.update(() => this.detectStatus());
73
71
  }
74
72
  detectStatus() {
75
- const statuses = Array.from(this.widgets.values()).map((c) => c.status());
73
+ const statuses = Array.from(this.widgets.values()).map(c => c.status());
76
74
  // Rendering statuses
77
75
  if (statuses.some((status) => status === AXPWidgetStatus.Rendering)) {
78
76
  return AXPPageStatus.Rendering;
@@ -118,46 +116,12 @@ class AXPLayoutBuilderService {
118
116
  }
119
117
  registerWidget(id, widget) {
120
118
  this.widgets.set(id, widget);
121
- this.onWidgetRegistered.next({ id, widget });
122
119
  }
123
120
  getWidget(id) {
124
121
  return this.widgets.get(id);
125
122
  }
126
- /**
127
- * Waits until a widget with the given id is registered, then resolves with it.
128
- * If the widget is already registered, resolves immediately.
129
- * Optionally accepts a timeout (in ms) after which it resolves with undefined.
130
- */
131
- async waitForWidget(id, timeoutMs) {
132
- const existing = this.widgets.get(id);
133
- if (existing) {
134
- return existing;
135
- }
136
- return new Promise((resolve) => {
137
- let resolved = false;
138
- let timer = null;
139
- const sub = this.onWidgetRegistered.subscribe(({ id: registeredId, widget }) => {
140
- if (registeredId === id && !resolved) {
141
- resolved = true;
142
- sub.unsubscribe();
143
- if (timer) {
144
- clearTimeout(timer);
145
- }
146
- resolve(widget);
147
- }
148
- });
149
- if (timeoutMs != null && timeoutMs > 0) {
150
- timer = setTimeout(() => {
151
- if (!resolved) {
152
- resolved = true;
153
- sub.unsubscribe();
154
- resolve(undefined);
155
- }
156
- }, timeoutMs);
157
- }
158
- });
123
+ ngOnDestroy() {
159
124
  }
160
- ngOnDestroy() { }
161
125
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
162
126
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderService }); }
163
127
  }
@@ -165,117 +129,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
165
129
  type: Injectable
166
130
  }] });
167
131
 
168
- class AXPLayoutContextChangeEvent {
169
- }
170
- const AXPLayoutBuilderContextStore = signalStore(
171
- // Initial State
172
- withState(() => ({
173
- data: {}, // Shared context data
174
- state: 'initiated', // Current state
175
- initialSnapshot: {}, // Snapshot of the first initialized state
176
- previousSnapshot: {}, // Snapshot of the previous state
177
- lastChange: {
178
- state: 'initiated',
179
- }, // Last change event
180
- })),
181
- // Computed Signals
182
- withComputed(({ data, state, lastChange, initialSnapshot, previousSnapshot }) => ({
183
- isChanged: computed(() => state() === 'changed'),
184
- isReset: computed(() => state() === 'restored'),
185
- isInitiated: computed(() => state() === 'initiated'),
186
- isEmpty: computed(() => Object.keys(data()).length === 0),
187
- isDirty: computed(() => !isEqual(data(), previousSnapshot())),
188
- snapshot: computed(() => cloneDeep(data())), // Current data snapshot
189
- initial: computed(() => cloneDeep(initialSnapshot())), // Initial snapshot
190
- previous: computed(() => cloneDeep(previousSnapshot())), // Previous snapshot
191
- changeEvent: computed(() => lastChange()), // Reactive last change event
192
- })),
193
- // Methods for State Management
194
- withMethods((store) => ({
195
- // Update a specific value
196
- update(path, value) {
197
- const currentData = cloneDeep(store.data());
198
- const oldValue = get(currentData, path);
199
- // Skip if the value hasn't changed
200
- if (isEqual(oldValue, value)) {
201
- return;
202
- }
203
- // Update the value and prepare the change event
204
- const updatedData = setSmart(currentData, path, value);
205
- const changeEvent = {
206
- oldValue,
207
- newValue: value,
208
- path,
209
- state: 'changed',
210
- data: updatedData,
211
- };
212
- // Patch the state
213
- patchState(store, {
214
- previousSnapshot: store.snapshot(), // Save the previous state
215
- data: updatedData,
216
- state: 'changed',
217
- lastChange: changeEvent,
218
- });
219
- },
220
- patch(context) {
221
- const currentData = cloneDeep(store.data());
222
- // Update the value and prepare the change event
223
- const updatedData = { ...currentData, ...context };
224
- const changeEvent = {
225
- state: 'patch',
226
- data: updatedData,
227
- };
228
- // Patch the state
229
- patchState(store, {
230
- previousSnapshot: store.snapshot(), // Save the previous state
231
- data: updatedData,
232
- state: 'changed',
233
- lastChange: changeEvent,
234
- });
235
- },
236
- // Reset to the initial state
237
- reset() {
238
- const initialData = store.initial();
239
- const changeEvent = {
240
- oldValue: cloneDeep(store.data()), // Current data becomes old value
241
- newValue: cloneDeep(initialData), // Reset to the initial state
242
- path: '',
243
- state: 'restored',
244
- data: initialData,
245
- };
246
- patchState(store, {
247
- previousSnapshot: store.snapshot(), // Save the previous state
248
- data: initialData,
249
- state: 'restored',
250
- lastChange: changeEvent,
251
- });
252
- },
253
- // Initialize the state
254
- set(initialData) {
255
- const currentData = store.data();
256
- if (isEqual(currentData, initialData)) {
257
- return; // Skip if the current state matches the initial state
132
+ class AXPWidgetRegistryService {
133
+ /**
134
+ *
135
+ */
136
+ constructor() {
137
+ this.types = new Map();
138
+ AXPWidgetRegistryService.instance = this;
139
+ }
140
+ register(widget) {
141
+ this.types.set(widget.name, widget);
142
+ }
143
+ extend(parentName, widget) {
144
+ const parentWidget = this.resolve(parentName);
145
+ const newWidget = merge({}, parentWidget, widget);
146
+ newWidget.name = widget.name;
147
+ this.register(newWidget);
148
+ }
149
+ resolve(name) {
150
+ const widget = this.types.get(name);
151
+ if (!widget) {
152
+ throw new Error(`Widget with name "${name}" does not exist.`);
258
153
  }
259
- const changeEvent = {
260
- oldValue: null,
261
- newValue: cloneDeep(initialData),
262
- path: '',
263
- state: 'initiated',
264
- data: initialData,
265
- };
266
- patchState(store, {
267
- initialSnapshot: cloneDeep(initialData), // Save the initial state
268
- previousSnapshot: store.snapshot(), // Save the current state as the previous
269
- data: initialData,
270
- state: 'initiated',
271
- lastChange: changeEvent,
272
- });
273
- },
274
- // Get a specific value
275
- getValue(path) {
276
- return get(store.data(), path);
277
- },
278
- })));
154
+ return widget;
155
+ }
156
+ all() {
157
+ return Array.from(this.types.values());
158
+ }
159
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
160
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, providedIn: 'root' }); }
161
+ }
162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, decorators: [{
163
+ type: Injectable,
164
+ args: [{
165
+ providedIn: 'root',
166
+ }]
167
+ }], ctorParameters: () => [] });
279
168
 
280
169
  const AXPWidgetsCatalog = {
281
170
  timeDuration: 'time-duration',
@@ -305,7 +194,6 @@ const AXPWidgetsCatalog = {
305
194
  fileTypeExtension: 'file-type-extension',
306
195
  map: 'map',
307
196
  imageMarker: 'image-marker',
308
- image: 'image',
309
197
  gallery: 'gallery',
310
198
  signature: 'signature',
311
199
  buttonAction: 'button-action',
@@ -326,7 +214,6 @@ const AXPWidgetsCatalog = {
326
214
  direction: 'direction',
327
215
  border: 'border',
328
216
  flexLayout: 'flex-layout',
329
- flexItem: 'flex-item-layout',
330
217
  avatar: 'avatar',
331
218
  themePaletteChooser: 'theme-palette-chooser',
332
219
  themeModeChooser: 'theme-mode-chooser',
@@ -334,9 +221,8 @@ const AXPWidgetsCatalog = {
334
221
  fontStyleChooser: 'font-style-chooser',
335
222
  fontSizeChooser: 'font-size-chooser',
336
223
  iconChooser: 'icon-chooser',
337
- themeColorChooser: 'theme-color-chooser',
224
+ colorChooser: 'color-chooser',
338
225
  gridOptions: 'grid-options',
339
- gridItemOptions: 'grid-item-options',
340
226
  advancedGridOptions: 'advanced-grid-options',
341
227
  stringFilter: 'string-filter',
342
228
  numberFilter: 'number-filter',
@@ -344,7 +230,6 @@ const AXPWidgetsCatalog = {
344
230
  booleanFilter: 'boolean-filter',
345
231
  lookupFilter: 'lookup-filter',
346
232
  flexOptions: 'flex-options',
347
- flexItemOptions: 'flex-item-options',
348
233
  selectFilter: 'select-filter',
349
234
  requiredValidation: 'required-validation',
350
235
  regularExpressionValidation: 'regular-expression-validation',
@@ -369,12 +254,8 @@ const AXPWidgetsCatalog = {
369
254
  templateEditor: 'template-box-editor',
370
255
  panel: 'panel',
371
256
  notification: 'notification',
372
- taskBoard: 'task-board',
257
+ taskList: 'task-list',
373
258
  comment: 'comment',
374
- list: 'list',
375
- listToolbar: 'list-toolbar',
376
- entityList: 'entity-list',
377
- documentUploader: 'document-uploader',
378
259
  };
379
260
 
380
261
  function cloneProperty(property, values) {
@@ -459,685 +340,44 @@ function createSelectProperty(ctor) {
459
340
  const AXP_WIDGET_TOKEN = new InjectionToken('AXP_WIDGET_TOKEN');
460
341
  const AXP_WIDGET_COLUMN_TOKEN = new InjectionToken('AXP_WIDGET_COLUMN_TOKEN');
461
342
 
462
- class AXPBaseWidgetComponent extends AXPLayoutElement {
343
+ class AXPWidgetColumnRendererComponent extends AXDataTableColumnComponent {
463
344
  constructor() {
464
345
  super(...arguments);
465
- this.token = inject(AXP_WIDGET_TOKEN);
466
- this.host = inject(ElementRef).nativeElement;
467
- this.layoutService = inject(AXPLayoutBuilderService);
468
- this.contextService = inject(AXPLayoutBuilderContextStore);
469
- this.config = this.token.config;
470
- this.node = this.token.node;
471
- this.name = this.token.node.name;
472
- this._options = signal(this.token.options ?? {}, ...(ngDevMode ? [{ debugName: "_options" }] : []));
473
- this.options = this._options.asReadonly();
474
- this.onOptionsChanged = new Subject();
475
- this._status = signal(AXPWidgetStatus.Rendering, ...(ngDevMode ? [{ debugName: "_status" }] : []));
476
- this.status = this._status.asReadonly();
477
- this.onStatusChanged = new BehaviorSubject(this._status());
478
- this.#statusEffect = effect(() => {
479
- this.onStatusChanged.next(this.status());
480
- }, ...(ngDevMode ? [{ debugName: "#statusEffect" }] : []));
481
- this.isBusy = computed(() => [AXPWidgetStatus.Rendering, AXPWidgetStatus.Processing].includes(this.status()), ...(ngDevMode ? [{ debugName: "isBusy" }] : []));
482
- this._children = signal(this.token.node.children ?? [], ...(ngDevMode ? [{ debugName: "_children" }] : []));
483
- this.children = this._children.asReadonly();
346
+ this.widgetRegistery = inject(AXPWidgetRegistryService);
347
+ this.grid = inject(AXBaseDataTable);
348
+ this.mergedOptions = signal({}, ...(ngDevMode ? [{ debugName: "mergedOptions" }] : []));
349
+ this.loadingRow = signal(null, ...(ngDevMode ? [{ debugName: "loadingRow" }] : []));
350
+ this.injector = inject(Injector);
351
+ this.cdr = inject(ChangeDetectorRef);
484
352
  }
485
- get id() {
486
- return this._id;
353
+ get node() {
354
+ return this._node;
487
355
  }
488
- #statusEffect;
489
- outputs() {
490
- return [];
356
+ set node(v) {
357
+ this._node = v;
491
358
  }
492
- ngOnInit() {
493
- if (get(this.node, '__meta__.added')) {
494
- this.onAdded();
495
- }
496
- this.setStatus(AXPWidgetStatus.Rendered);
359
+ get renderFooterTemplate() {
360
+ return this.footerTemplate ?? this._contentFooterTemplate;
497
361
  }
498
- setStatus(status) {
499
- this._status.set(status);
500
- this.layoutService.updateStatus();
362
+ get renderCellTemplate() {
363
+ return this.cellTemplate ?? this._contentCellTemplate;
501
364
  }
502
- setOptions(values) {
503
- const oldValue = this.options();
504
- const value = cloneDeep(values);
505
- this._options.set({ ...oldValue, ...value });
506
- this.onOptionsChanged.next({ sender: this });
365
+ async handleExpandRow(row) {
366
+ this.loadingRow.set(row);
367
+ await this.grid.expandRow(row);
368
+ this.loadingRow.set(null);
369
+ // if (row.data?.__meta__?.expanded === undefined) {
370
+ // this.width = `${parseInt(this.width as string) + 24}px`;
371
+ // }
507
372
  }
508
- output(name) {
509
- const outputs = this.outputs().map((c) => (typeof c == 'string' ? { name: c, value: c } : c));
510
- if (outputs.some((c) => c.name == name)) {
511
- const opt = get(this, name);
512
- if (typeof opt == 'function') {
513
- return opt();
514
- }
515
- return opt;
516
- }
517
- return null;
373
+ get renderHeaderTemplate() {
374
+ return this.headerTemplate ?? this._contentHeaderTemplate;
518
375
  }
519
- call(name, ...args) {
520
- const fn = get(this, name);
521
- if (fn && typeof fn == 'function') {
522
- fn.bind(this)(...args);
523
- }
376
+ get loadingEnabled() {
377
+ return true;
524
378
  }
525
- setChildren(children) {
526
- this._children.set([...children]);
527
- }
528
- onAdded() { }
529
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
530
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent }); }
531
- }
532
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent, decorators: [{
533
- type: Injectable
534
- }] });
535
- class AXPLayoutBaseWidgetComponent extends AXPBaseWidgetComponent {
536
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBaseWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
537
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBaseWidgetComponent }); }
538
- }
539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBaseWidgetComponent, decorators: [{
540
- type: Injectable
541
- }] });
542
- class AXPValueWidgetComponent extends AXPLayoutBaseWidgetComponent {
543
- constructor() {
544
- super(...arguments);
545
- this.path = this.token.node.path;
546
- this.defaultValue = this.token.defaultValue ?? this.token.node.defaultValue;
547
- this._isValueWidget = false;
548
- this.isValueWidget = () => this._isValueWidget;
549
- this.onValueChanged = new Subject();
550
- this.fullPath = signal(null, ...(ngDevMode ? [{ debugName: "fullPath" }] : []));
551
- this.parentPath = signal(null, ...(ngDevMode ? [{ debugName: "parentPath" }] : []));
552
- this.getValue = computed(() => {
553
- return this.fullPath() ? this.extractValue(this.fullPath()) : null;
554
- }, ...(ngDevMode ? [{ debugName: "getValue", equal: isEqual }] : [{ equal: isEqual }]));
555
- this.validationRules = computed(() => {
556
- const validationsRaw = this.options()['validations'];
557
- if (validationsRaw == null) {
558
- return [];
559
- }
560
- return Object.values(this.options()['validations'])
561
- .filter((c) => c != null)
562
- .map((c) => ({
563
- rule: c.rule,
564
- message: c.message,
565
- options: c.options,
566
- }));
567
- }, ...(ngDevMode ? [{ debugName: "validationRules" }] : []));
568
- }
569
- ngOnInit() {
570
- this._isValueWidget = this.config.properties?.some((c) => c.name == 'path') ?? false;
571
- if (this.isValueWidget()) {
572
- this.detectFullPath();
573
- if (!isNil(this.defaultValue) && isNil(this.getValue())) {
574
- this.setValue(this.defaultValue);
575
- }
576
- }
577
- //
578
- super.ngOnInit();
579
- }
580
- extractValue(path) {
581
- const rawValue = this.contextService.getValue(path);
582
- if (this.node.valueTransforms?.getter) {
583
- return this.node.valueTransforms?.getter(rawValue);
584
- }
585
- return rawValue;
586
- }
587
- setValue(value) {
588
- if (this.node.valueTransforms?.setter) {
589
- value = this.node.valueTransforms?.setter(value);
590
- }
591
- const oldValue = this.getValue();
592
- value = isUndefined(value) ? null : value;
593
- if (isNil(value) && isNil(oldValue)) {
594
- return;
595
- }
596
- if (isEqual(oldValue, value)) {
597
- return;
598
- }
599
- if (this.fullPath()) {
600
- this.contextService.update(this.fullPath(), value);
601
- this.onValueChanged.next({ sender: this });
602
- }
603
- }
604
- detectFullPath() {
605
- const sections = [];
606
- const ids = [];
607
- //
608
- let parent = this;
609
- //
610
- while (parent) {
611
- const isValueWidget = parent instanceof AXPValueWidgetComponent && parent.isValueWidget();
612
- const valueParent = parent;
613
- const path = valueParent.path ?? (isValueWidget ? valueParent.name : null);
614
- const id = valueParent.name;
615
- //
616
- if (path) {
617
- sections.push(path);
618
- }
619
- if (parent.index != null && isValueWidget) {
620
- sections.push(`[${parent.index}]`);
621
- }
622
- if (id) {
623
- ids.push(id);
624
- if (parent.index != null) {
625
- ids.push(`${parent.index}`);
626
- }
627
- }
628
- parent = parent.parent;
629
- }
630
- //
631
- this.fullPath.set(sections.reverse().join('.'));
632
- this.parentPath.set(sections.slice(0, sections.length - 1).join('.'));
633
- this._id = this.name || this.parent ? ids.reverse().join('_') : null;
634
- if (this._id) {
635
- this.layoutService.registerWidget(this._id, this);
636
- }
637
- }
638
- handleValueChanged(e) {
639
- if (e.isUserInteraction) {
640
- this.setValue(e.value);
641
- }
642
- }
643
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPValueWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
644
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPValueWidgetComponent }); }
645
- }
646
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPValueWidgetComponent, decorators: [{
647
- type: Injectable
648
- }] });
649
- class AXPDataListWidgetComponent extends AXPValueWidgetComponent {
650
- constructor() {
651
- super(...arguments);
652
- this.dataService = inject(AXPDataSourceDefinitionProviderService);
653
- this.textField = computed(() => this.options()['textField'] ?? 'title', ...(ngDevMode ? [{ debugName: "textField" }] : []));
654
- this.valueField = computed(() => this.options()['valueField'] ?? 'id', ...(ngDevMode ? [{ debugName: "valueField" }] : []));
655
- this.dataSource = signal(convertArrayToDataSource([]), ...(ngDevMode ? [{ debugName: "dataSource" }] : []));
656
- this.isReady = computed(() => {
657
- const key = this.dataSource().config?.key;
658
- const valueField = this.valueField();
659
- const result = key == valueField;
660
- return result;
661
- }, ...(ngDevMode ? [{ debugName: "isReady" }] : []));
662
- this.selectedItems = signal([], ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
663
- this.rf = effect(async () => {
664
- const rawValue = this.options()['dataSource'];
665
- // static datasource class
666
- if (rawValue instanceof AXDataSource) {
667
- this.dataSource.set(rawValue);
668
- }
669
- // static array datasource
670
- else if (Array.isArray(rawValue)) {
671
- const ds = new AXDataSource({
672
- key: this.valueField(),
673
- pageSize: 10,
674
- load: async (e) => {
675
- const raw = this.options()['dataSource'];
676
- return {
677
- items: raw,
678
- total: raw.length,
679
- };
680
- },
681
- byKey: (key) => {
682
- const raw = this.options()['dataSource'];
683
- const item = raw.filter((c) => c[this.valueField()] == key);
684
- return Promise.resolve(item[0]);
685
- },
686
- });
687
- this.dataSource.set(ds);
688
- }
689
- // resolve data source by name
690
- else if (rawValue && (typeof rawValue == 'string' || typeof rawValue == 'object')) {
691
- const id = typeof rawValue == 'object' ? rawValue['id'] : rawValue;
692
- const c = await this.dataService.get(id);
693
- if (this.mode == 'designer' && c?.samples?.length) {
694
- this.dataSource.set(convertArrayToDataSource(c.samples, {
695
- key: this.valueField(),
696
- pageSize: 500,
697
- }));
698
- }
699
- else {
700
- const ds = c?.source();
701
- if (ds && ds instanceof Promise) {
702
- const d = await ds;
703
- this.dataSource.set(d);
704
- }
705
- else if (ds) {
706
- this.dataSource.set(ds);
707
- }
708
- // empty datasource
709
- else {
710
- this.dataSource.set(convertArrayToDataSource([]));
711
- }
712
- }
713
- }
714
- // empty datasource
715
- else {
716
- this.dataSource.set(convertArrayToDataSource([]));
717
- }
718
- }, ...(ngDevMode ? [{ debugName: "rf" }] : []));
719
- this.effect2 = effect(async () => {
720
- const value = this.getValue();
721
- const items = [];
722
- if (Array.isArray(value)) {
723
- items.push(...(await Promise.all(value.map((item) => this.extractItem(item)))));
724
- }
725
- else {
726
- items.push(await this.extractItem(value));
727
- }
728
- this.selectedItems.set(items.filter((c) => c != null));
729
- }, ...(ngDevMode ? [{ debugName: "effect2" }] : []));
730
- }
731
- async extractItem(item) {
732
- if (isNil(item)) {
733
- return null;
734
- }
735
- if (isObjectLike(item) && get(item, this.textField()) != null) {
736
- return item;
737
- }
738
- const key = extractValue(item, this.valueField());
739
- const ds = this.dataSource();
740
- if (ds.config?.byKey) {
741
- const found = await ds.config?.byKey(key);
742
- if (found) {
743
- return found;
744
- }
745
- }
746
- return isObjectLike(item)
747
- ? item
748
- : {
749
- [this.valueField()]: item,
750
- [this.textField()]: item,
751
- };
752
- }
753
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPDataListWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
754
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPDataListWidgetComponent }); }
755
- }
756
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPDataListWidgetComponent, decorators: [{
757
- type: Injectable
758
- }] });
759
- class AXPColumnWidgetComponent {
760
- constructor() {
761
- this.token = inject(AXP_WIDGET_COLUMN_TOKEN);
762
- this.path = this.token.path;
763
- this.options = this.token.options ?? {};
764
- this.rawValue = null;
765
- this.nullText = this.options['nullText'];
766
- this.nullValue = this.options['nullValue'];
767
- this.value = computed(() => {
768
- if (isNil(this.rawValue) && !isNil(this.nullValue)) {
769
- return this.nullValue;
770
- }
771
- return this.rawValue;
772
- }, ...(ngDevMode ? [{ debugName: "value" }] : []));
773
- }
774
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPColumnWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
775
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPColumnWidgetComponent }); }
776
- }
777
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPColumnWidgetComponent, decorators: [{
778
- type: Injectable
779
- }] });
780
-
781
- class AXPBoxModelLayoutWidgetComponent extends AXPLayoutBaseWidgetComponent {
782
- constructor() {
783
- super(...arguments);
784
- this.hostBoxStyle = computed(() => {
785
- const options = this.options();
786
- const style = {};
787
- const spacing = options?.['spacing'];
788
- const border = options?.['border'];
789
- const backgroundColor = options?.['backgroundColor'];
790
- const direction = options?.['direction'];
791
- const overflow = options?.['overflow'];
792
- const overflowX = options?.['overflowX'];
793
- const overflowY = options?.['overflowY'];
794
- style['background-color'] = backgroundColor ?? '';
795
- style['padding'] = spacing?.padding ?? '';
796
- style['margin'] = spacing?.margin ?? '';
797
- style['border-radius'] = border?.radius ?? '';
798
- style['border-width'] = border?.width ?? '';
799
- style['border-color'] = border?.color ?? '';
800
- style['border-style'] = border?.style ?? '';
801
- style['overflow'] = overflow ?? '';
802
- style['overflow-x'] = overflowX ?? '';
803
- style['overflow-y'] = overflowY ?? '';
804
- style['direction'] = direction ?? '';
805
- return style;
806
- }, ...(ngDevMode ? [{ debugName: "hostBoxStyle" }] : []));
807
- this.blockStyle = computed(() => {
808
- const options = this.options();
809
- const style = { ...this.hostBoxStyle() };
810
- const width = options?.['width'];
811
- const minWidth = options?.['minWidth'];
812
- const maxWidth = options?.['maxWidth'];
813
- const height = options?.['height'];
814
- const minHeight = options?.['minHeight'];
815
- const maxHeight = options?.['maxHeight'];
816
- style['min-width'] = minWidth ?? '';
817
- style['width'] = width ?? '';
818
- style['max-width'] = maxWidth ?? '';
819
- style['min-height'] = minHeight ?? '';
820
- style['height'] = height ?? '';
821
- style['max-height'] = maxHeight ?? '';
822
- return style;
823
- }, ...(ngDevMode ? [{ debugName: "blockStyle" }] : []));
824
- this.inlineStyle = computed(() => {
825
- return { ...this.hostBoxStyle() };
826
- }, ...(ngDevMode ? [{ debugName: "inlineStyle" }] : []));
827
- this.blockClass = computed(() => {
828
- return {
829
- 'ax-block': true,
830
- 'ax-w-full': true,
831
- 'ax-widget-outline': true,
832
- };
833
- }, ...(ngDevMode ? [{ debugName: "blockClass" }] : []));
834
- this.inlineClass = computed(() => {
835
- return {
836
- 'ax-inline-block': true,
837
- };
838
- }, ...(ngDevMode ? [{ debugName: "inlineClass" }] : []));
839
- }
840
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBoxModelLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
841
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBoxModelLayoutWidgetComponent }); }
842
- }
843
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBoxModelLayoutWidgetComponent, decorators: [{
844
- type: Injectable
845
- }] });
846
-
847
- class AXPBlockBaseLayoutWidgetComponent extends AXPBoxModelLayoutWidgetComponent {
848
- constructor() {
849
- super(...arguments);
850
- this.hostClass = computed(() => this.blockClass(), ...(ngDevMode ? [{ debugName: "hostClass" }] : []));
851
- this.hostStyle = computed(() => this.blockStyle(), ...(ngDevMode ? [{ debugName: "hostStyle" }] : []));
852
- }
853
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBlockBaseLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
854
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBlockBaseLayoutWidgetComponent }); }
855
- }
856
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBlockBaseLayoutWidgetComponent, decorators: [{
857
- type: Injectable
858
- }] });
859
-
860
- class AXPFlexBaseLayoutWidgetComponent extends AXPBlockBaseLayoutWidgetComponent {
861
- constructor() {
862
- super(...arguments);
863
- this.flex = computed(() => this.options(), ...(ngDevMode ? [{ debugName: "flex" }] : []));
864
- this.hostFlexStyle = computed(() => {
865
- const blockStyle = this.blockStyle();
866
- const style = { ...blockStyle };
867
- const flex = this.flex();
868
- if (isNil(flex?.flexDirection)) {
869
- style['flex-direction'] = '';
870
- }
871
- else {
872
- style['flex-direction'] = flex.flexDirection;
873
- }
874
- if (isNil(flex?.flexWrap)) {
875
- style['flex-wrap'] = '';
876
- }
877
- else {
878
- style['flex-wrap'] = flex.flexWrap;
879
- }
880
- //TODO NEED TO FIX LATER
881
- style['overflow'] = flex?.flexWrap === 'nowrap' ? 'auto' : '';
882
- //END
883
- if (isNil(flex?.justifyContent)) {
884
- style['justify-content'] = '';
885
- }
886
- else {
887
- style['justify-content'] = flex.justifyContent;
888
- }
889
- if (isNil(flex?.alignItems)) {
890
- style['align-items'] = '';
891
- }
892
- else {
893
- style['align-items'] = flex.alignItems;
894
- }
895
- if (isNil(flex?.gap)) {
896
- style['gap'] = '';
897
- }
898
- else {
899
- style['gap'] = flex.gap;
900
- }
901
- return style;
902
- }, ...(ngDevMode ? [{ debugName: "hostFlexStyle" }] : []));
903
- this.hostFlexClass = computed(() => {
904
- return {
905
- ...this.blockClass(),
906
- 'ax-flex': true,
907
- };
908
- }, ...(ngDevMode ? [{ debugName: "hostFlexClass" }] : []));
909
- this.hostClass = computed(() => {
910
- return this.hostFlexClass();
911
- }, ...(ngDevMode ? [{ debugName: "hostClass" }] : []));
912
- this.hostStyle = computed(() => {
913
- return this.hostFlexStyle();
914
- }, ...(ngDevMode ? [{ debugName: "hostStyle" }] : []));
915
- }
916
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPFlexBaseLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
917
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPFlexBaseLayoutWidgetComponent }); }
918
- }
919
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPFlexBaseLayoutWidgetComponent, decorators: [{
920
- type: Injectable
921
- }] });
922
-
923
- class AXPInlineBaseLayoutWidgetComponent extends AXPBoxModelLayoutWidgetComponent {
924
- constructor() {
925
- super(...arguments);
926
- this.hostClass = computed(() => this.inlineClass(), ...(ngDevMode ? [{ debugName: "hostClass" }] : []));
927
- this.hostStyle = computed(() => this.inlineStyle(), ...(ngDevMode ? [{ debugName: "hostStyle" }] : []));
928
- }
929
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPInlineBaseLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
930
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPInlineBaseLayoutWidgetComponent }); }
931
- }
932
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPInlineBaseLayoutWidgetComponent, decorators: [{
933
- type: Injectable
934
- }] });
935
-
936
- class AXPFlexItemBaseLayoutWidgetComponent extends AXPInlineBaseLayoutWidgetComponent {
937
- constructor() {
938
- super(...arguments);
939
- this.flexItem = computed(() => this.options(), ...(ngDevMode ? [{ debugName: "flexItem" }] : []));
940
- this.hostFlexItemStyle = computed(() => {
941
- const inlineStyle = this.blockStyle();
942
- const style = { ...inlineStyle };
943
- const fi = this.flexItem();
944
- if (isNil(fi?.order)) {
945
- style['order'] = '';
946
- }
947
- else {
948
- style['order'] = fi.order;
949
- }
950
- if (isNil(fi?.grow)) {
951
- style['flex-grow'] = '';
952
- }
953
- else {
954
- style['flex-grow'] = fi.grow;
955
- }
956
- if (isNil(fi?.shrink)) {
957
- style['flex-shrink'] = '';
958
- }
959
- else {
960
- style['flex-shrink'] = fi.shrink;
961
- }
962
- if (isNil(fi?.basis)) {
963
- style['flex-basis'] = '';
964
- }
965
- else {
966
- style['flex-basis'] = fi.basis;
967
- }
968
- if (isNil(fi?.alignSelf)) {
969
- style['align-self'] = '';
970
- }
971
- else {
972
- style['align-self'] = fi.alignSelf;
973
- }
974
- return style;
975
- }, ...(ngDevMode ? [{ debugName: "hostFlexItemStyle" }] : []));
976
- this.hostFlexItemClass = computed(() => {
977
- return {
978
- ...this.blockClass(),
979
- };
980
- }, ...(ngDevMode ? [{ debugName: "hostFlexItemClass" }] : []));
981
- this.hostClass = computed(() => {
982
- return this.hostFlexItemClass();
983
- }, ...(ngDevMode ? [{ debugName: "hostClass" }] : []));
984
- this.hostStyle = computed(() => {
985
- return this.hostFlexItemStyle();
986
- }, ...(ngDevMode ? [{ debugName: "hostStyle" }] : []));
987
- }
988
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPFlexItemBaseLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
989
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPFlexItemBaseLayoutWidgetComponent }); }
990
- }
991
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPFlexItemBaseLayoutWidgetComponent, decorators: [{
992
- type: Injectable
993
- }] });
994
-
995
- class AXPGridBaseLayoutWidgetComponent extends AXPBlockBaseLayoutWidgetComponent {
996
- constructor() {
997
- super(...arguments);
998
- this.grid = computed(() => this.options()?.grid, ...(ngDevMode ? [{ debugName: "grid" }] : []));
999
- this.hostGridStyle = computed(() => {
1000
- const style = { ...this.inlineStyle() };
1001
- const g = this.grid()?.default;
1002
- if (g?.gap)
1003
- style['gap'] = g.gap;
1004
- return style;
1005
- }, ...(ngDevMode ? [{ debugName: "hostGridStyle" }] : []));
1006
- this.hostGridClass = computed(() => {
1007
- const cls = {
1008
- ...this.inlineClass(),
1009
- 'ax-grid': true,
1010
- };
1011
- const g = this.grid()?.default;
1012
- if (g?.columns)
1013
- cls[`lg:ax-grid-cols-${g.columns}`] = true;
1014
- if (g?.rows)
1015
- cls[`lg:ax-grid-rows-${g.rows}`] = true;
1016
- if (g?.justifyItems)
1017
- cls[`lg:ax-justify-items-${g.justifyItems}`] = true;
1018
- if (g?.alignItems)
1019
- cls[`lg:ax-align-items-${g.alignItems}`] = true;
1020
- if (g?.autoFlow)
1021
- cls[`lg:ax-grid-flow-${g.autoFlow}`] = true;
1022
- return cls;
1023
- }, ...(ngDevMode ? [{ debugName: "hostGridClass" }] : []));
1024
- this.hostClass = computed(() => this.hostGridClass(), ...(ngDevMode ? [{ debugName: "hostClass" }] : []));
1025
- this.hostStyle = computed(() => this.hostGridStyle(), ...(ngDevMode ? [{ debugName: "hostStyle" }] : []));
1026
- }
1027
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPGridBaseLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1028
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPGridBaseLayoutWidgetComponent }); }
1029
- }
1030
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPGridBaseLayoutWidgetComponent, decorators: [{
1031
- type: Injectable
1032
- }] });
1033
-
1034
- class AXPGridItemBaseLayoutWidgetComponent extends AXPBlockBaseLayoutWidgetComponent {
1035
- constructor() {
1036
- super(...arguments);
1037
- this.gridItem = computed(() => this.options(), ...(ngDevMode ? [{ debugName: "gridItem" }] : []));
1038
- this.hostGridItemStyle = computed(() => ({ ...this.inlineStyle() }), ...(ngDevMode ? [{ debugName: "hostGridItemStyle" }] : []));
1039
- this.hostGridItemClass = computed(() => {
1040
- const cls = { ...this.inlineClass() };
1041
- const g = this.gridItem();
1042
- if (g?.colSpan)
1043
- cls[`lg:ax-col-span-${g.colSpan}`] = true;
1044
- if (g?.colStart)
1045
- cls[`lg:ax-col-start-${g.colStart}`] = true;
1046
- if (g?.colEnd)
1047
- cls[`lg:ax-col-end-${g.colEnd}`] = true;
1048
- if (g?.rowSpan)
1049
- cls[`lg:ax-row-span-${g.rowSpan}`] = true;
1050
- if (g?.rowStart)
1051
- cls[`lg:ax-row-start-${g.rowStart}`] = true;
1052
- if (g?.rowEnd)
1053
- cls[`lg:ax-row-end-${g.rowEnd}`] = true;
1054
- return cls;
1055
- }, ...(ngDevMode ? [{ debugName: "hostGridItemClass" }] : []));
1056
- this.hostClass = computed(() => this.hostGridItemClass(), ...(ngDevMode ? [{ debugName: "hostClass" }] : []));
1057
- this.hostStyle = computed(() => this.hostGridItemStyle(), ...(ngDevMode ? [{ debugName: "hostStyle" }] : []));
1058
- }
1059
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPGridItemBaseLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1060
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPGridItemBaseLayoutWidgetComponent }); }
1061
- }
1062
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPGridItemBaseLayoutWidgetComponent, decorators: [{
1063
- type: Injectable
1064
- }] });
1065
-
1066
- class AXPWidgetRegistryService {
1067
- /**
1068
- *
1069
- */
1070
- constructor() {
1071
- this.types = new Map();
1072
- AXPWidgetRegistryService.instance = this;
1073
- }
1074
- register(widget) {
1075
- this.types.set(widget.name, widget);
1076
- }
1077
- extend(parentName, widget) {
1078
- const parentWidget = this.resolve(parentName);
1079
- const newWidget = merge({}, parentWidget, widget);
1080
- newWidget.name = widget.name;
1081
- this.register(newWidget);
1082
- }
1083
- resolve(name) {
1084
- const widget = this.types.get(name);
1085
- if (!widget) {
1086
- throw new Error(`Widget with name "${name}" does not exist.`);
1087
- }
1088
- return widget;
1089
- }
1090
- all() {
1091
- return Array.from(this.types.values());
1092
- }
1093
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1094
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, providedIn: 'root' }); }
1095
- }
1096
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, decorators: [{
1097
- type: Injectable,
1098
- args: [{
1099
- providedIn: 'root',
1100
- }]
1101
- }], ctorParameters: () => [] });
1102
-
1103
- class AXPWidgetColumnRendererComponent extends AXDataTableColumnComponent {
1104
- constructor() {
1105
- super(...arguments);
1106
- this.widgetRegistery = inject(AXPWidgetRegistryService);
1107
- this.grid = inject(AXBaseDataTable);
1108
- this.mergedOptions = signal({}, ...(ngDevMode ? [{ debugName: "mergedOptions" }] : []));
1109
- this.loadingRow = signal(null, ...(ngDevMode ? [{ debugName: "loadingRow" }] : []));
1110
- this.injector = inject(Injector);
1111
- this.cdr = inject(ChangeDetectorRef);
1112
- }
1113
- get node() {
1114
- return this._node;
1115
- }
1116
- set node(v) {
1117
- this._node = v;
1118
- }
1119
- get renderFooterTemplate() {
1120
- return this.footerTemplate ?? this._contentFooterTemplate;
1121
- }
1122
- get renderCellTemplate() {
1123
- return this.cellTemplate ?? this._contentCellTemplate;
1124
- }
1125
- async handleExpandRow(row) {
1126
- this.loadingRow.set(row);
1127
- await this.grid.expandRow(row);
1128
- this.loadingRow.set(null);
1129
- // if (row.data?.__meta__?.expanded === undefined) {
1130
- // this.width = `${parseInt(this.width as string) + 24}px`;
1131
- // }
1132
- }
1133
- get renderHeaderTemplate() {
1134
- return this.headerTemplate ?? this._contentHeaderTemplate;
1135
- }
1136
- get loadingEnabled() {
1137
- return true;
1138
- }
1139
- get name() {
1140
- return `col-${this.node.path}`;
379
+ get name() {
380
+ return `col-${this.node.path}`;
1141
381
  }
1142
382
  async ngOnInit() {
1143
383
  const widget = this.widgetRegistery.resolve(this.node.type);
@@ -1165,124 +405,230 @@ class AXPWidgetColumnRendererComponent extends AXDataTableColumnComponent {
1165
405
  },
1166
406
  ],
1167
407
  });
1168
- this.width = this.customWidth ? this.customWidth : (this.mergedOptions().width ?? '200px');
408
+ this.width = this.customWidth ? this.customWidth : this.mergedOptions().width ?? '200px';
1169
409
  this.allowResizing = this.mergedOptions().allowResizing || true;
1170
410
  this.cdr.detectChanges();
1171
411
  }
1172
412
  getInputs(data) {
1173
413
  return {
1174
414
  rawValue: getSmart(data, this.node.path),
1175
- rowData: data,
415
+ rowData: data
416
+ };
417
+ }
418
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetColumnRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
419
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: AXPWidgetColumnRendererComponent, isStandalone: false, selector: "axp-widget-column-renderer", inputs: { caption: "caption", customExpandIcon: "customExpandIcon", customCollapseIcon: "customCollapseIcon", customWidth: "customWidth", node: "node", footerTemplate: "footerTemplate", expandHandler: "expandHandler", cellTemplate: "cellTemplate", headerTemplate: "headerTemplate" }, providers: [
420
+ AXPLayoutBuilderService,
421
+ { provide: AXDataTableColumnComponent, useExisting: AXPWidgetColumnRendererComponent },
422
+ ], viewQueries: [{ propertyName: "_contentFooterTemplate", first: true, predicate: ["footer"], descendants: true }, { propertyName: "_contentCellTemplate", first: true, predicate: ["cell"], descendants: true }, { propertyName: "_contentHeaderTemplate", first: true, predicate: ["header"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
423
+ <ng-template #header>{{ caption }}</ng-template>
424
+ <ng-template #cell let-row>
425
+ <div class="ax-flex ax-gap-2 ax-items-center">
426
+ @if (expandHandler) {
427
+ <div
428
+ (click)="handleExpandRow(row)"
429
+ class="ax-expand-handler"
430
+ [class.ax-invisible]="row.data.hasChild === false"
431
+ id="ax-expand-handler-container"
432
+ [style.padding-inline-start.rem]="row.data?.__meta__?.level * 2"
433
+ >
434
+ @if (loadingRow() === row) {
435
+ <i class="fas fa-spinner-third ax-animate-twSpin ax-animate-infinite"></i>
436
+ } @else { @if (row.data?.__meta__?.expanded) {
437
+ <i [class]="customCollapseIcon || 'far fa-minus-square ax-text-md ax-opacity-75'"></i>
438
+ } @else {
439
+ <i [class]="customExpandIcon || 'far fa-plus-square ax-text-md ax-opacity-75'"></i>
440
+ } }
441
+ </div>
442
+ } @if(component && widgetInjector && row?.data) {
443
+ <ng-container
444
+ *ngComponentOutlet="component; injector: widgetInjector; inputs: getInputs(row.data)"
445
+ ></ng-container>
446
+ }
447
+ </div>
448
+ </ng-template>
449
+ <ng-template #footer></ng-template>
450
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
451
+ }
452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetColumnRendererComponent, decorators: [{
453
+ type: Component,
454
+ args: [{
455
+ selector: 'axp-widget-column-renderer',
456
+ template: `
457
+ <ng-template #header>{{ caption }}</ng-template>
458
+ <ng-template #cell let-row>
459
+ <div class="ax-flex ax-gap-2 ax-items-center">
460
+ @if (expandHandler) {
461
+ <div
462
+ (click)="handleExpandRow(row)"
463
+ class="ax-expand-handler"
464
+ [class.ax-invisible]="row.data.hasChild === false"
465
+ id="ax-expand-handler-container"
466
+ [style.padding-inline-start.rem]="row.data?.__meta__?.level * 2"
467
+ >
468
+ @if (loadingRow() === row) {
469
+ <i class="fas fa-spinner-third ax-animate-twSpin ax-animate-infinite"></i>
470
+ } @else { @if (row.data?.__meta__?.expanded) {
471
+ <i [class]="customCollapseIcon || 'far fa-minus-square ax-text-md ax-opacity-75'"></i>
472
+ } @else {
473
+ <i [class]="customExpandIcon || 'far fa-plus-square ax-text-md ax-opacity-75'"></i>
474
+ } }
475
+ </div>
476
+ } @if(component && widgetInjector && row?.data) {
477
+ <ng-container
478
+ *ngComponentOutlet="component; injector: widgetInjector; inputs: getInputs(row.data)"
479
+ ></ng-container>
480
+ }
481
+ </div>
482
+ </ng-template>
483
+ <ng-template #footer></ng-template>
484
+ `,
485
+ providers: [
486
+ AXPLayoutBuilderService,
487
+ { provide: AXDataTableColumnComponent, useExisting: AXPWidgetColumnRendererComponent },
488
+ ],
489
+ changeDetection: ChangeDetectionStrategy.OnPush,
490
+ inputs: ['caption'],
491
+ standalone: false,
492
+ }]
493
+ }], propDecorators: { customExpandIcon: [{
494
+ type: Input
495
+ }], customCollapseIcon: [{
496
+ type: Input
497
+ }], customWidth: [{
498
+ type: Input
499
+ }], node: [{
500
+ type: Input,
501
+ args: [{ required: true }]
502
+ }], footerTemplate: [{
503
+ type: Input
504
+ }], _contentFooterTemplate: [{
505
+ type: ViewChild,
506
+ args: ['footer']
507
+ }], expandHandler: [{
508
+ type: Input
509
+ }], cellTemplate: [{
510
+ type: Input
511
+ }], _contentCellTemplate: [{
512
+ type: ViewChild,
513
+ args: ['cell']
514
+ }], headerTemplate: [{
515
+ type: Input
516
+ }], _contentHeaderTemplate: [{
517
+ type: ViewChild,
518
+ args: ['header']
519
+ }] } });
520
+
521
+ class AXPLayoutContextChangeEvent {
522
+ }
523
+ const AXPLayoutBuilderContextStore = signalStore(
524
+ // Initial State
525
+ withState(() => ({
526
+ data: {}, // Shared context data
527
+ state: 'initiated', // Current state
528
+ initialSnapshot: {}, // Snapshot of the first initialized state
529
+ previousSnapshot: {}, // Snapshot of the previous state
530
+ lastChange: {
531
+ state: 'initiated',
532
+ }, // Last change event
533
+ })),
534
+ // Computed Signals
535
+ withComputed(({ data, state, lastChange, initialSnapshot, previousSnapshot }) => ({
536
+ isChanged: computed(() => state() === 'changed'),
537
+ isReset: computed(() => state() === 'restored'),
538
+ isInitiated: computed(() => state() === 'initiated'),
539
+ isEmpty: computed(() => Object.keys(data()).length === 0),
540
+ isDirty: computed(() => !isEqual(data(), previousSnapshot())),
541
+ snapshot: computed(() => cloneDeep(data())), // Current data snapshot
542
+ initial: computed(() => cloneDeep(initialSnapshot())), // Initial snapshot
543
+ previous: computed(() => cloneDeep(previousSnapshot())), // Previous snapshot
544
+ changeEvent: computed(() => lastChange()), // Reactive last change event
545
+ })),
546
+ // Methods for State Management
547
+ withMethods((store) => ({
548
+ // Update a specific value
549
+ update(path, value) {
550
+ const currentData = cloneDeep(store.data());
551
+ const oldValue = get(currentData, path);
552
+ // Skip if the value hasn't changed
553
+ if (isEqual(oldValue, value)) {
554
+ return;
555
+ }
556
+ // Update the value and prepare the change event
557
+ const updatedData = setSmart(currentData, path, value);
558
+ const changeEvent = {
559
+ oldValue,
560
+ newValue: value,
561
+ path,
562
+ state: 'changed',
563
+ data: updatedData,
564
+ };
565
+ // Patch the state
566
+ patchState(store, {
567
+ previousSnapshot: store.snapshot(), // Save the previous state
568
+ data: updatedData,
569
+ state: 'changed',
570
+ lastChange: changeEvent,
571
+ });
572
+ },
573
+ patch(context) {
574
+ const currentData = cloneDeep(store.data());
575
+ // Update the value and prepare the change event
576
+ const updatedData = { ...currentData, ...context };
577
+ const changeEvent = {
578
+ state: 'patch',
579
+ data: updatedData,
580
+ };
581
+ // Patch the state
582
+ patchState(store, {
583
+ previousSnapshot: store.snapshot(), // Save the previous state
584
+ data: updatedData,
585
+ state: 'changed',
586
+ lastChange: changeEvent,
587
+ });
588
+ },
589
+ // Reset to the initial state
590
+ reset() {
591
+ const initialData = store.initial();
592
+ const changeEvent = {
593
+ oldValue: cloneDeep(store.data()), // Current data becomes old value
594
+ newValue: cloneDeep(initialData), // Reset to the initial state
595
+ path: '',
596
+ state: 'restored',
597
+ data: initialData,
1176
598
  };
1177
- }
1178
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetColumnRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1179
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: AXPWidgetColumnRendererComponent, isStandalone: false, selector: "axp-widget-column-renderer", inputs: { caption: "caption", customExpandIcon: "customExpandIcon", customCollapseIcon: "customCollapseIcon", customWidth: "customWidth", node: "node", footerTemplate: "footerTemplate", expandHandler: "expandHandler", cellTemplate: "cellTemplate", headerTemplate: "headerTemplate" }, providers: [
1180
- AXPLayoutBuilderService,
1181
- { provide: AXDataTableColumnComponent, useExisting: AXPWidgetColumnRendererComponent },
1182
- ], viewQueries: [{ propertyName: "_contentFooterTemplate", first: true, predicate: ["footer"], descendants: true }, { propertyName: "_contentCellTemplate", first: true, predicate: ["cell"], descendants: true }, { propertyName: "_contentHeaderTemplate", first: true, predicate: ["header"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
1183
- <ng-template #header>{{ caption | translate | async }}</ng-template>
1184
- <ng-template #cell let-row>
1185
- <div class="ax-flex ax-gap-2 ax-items-center">
1186
- @if (expandHandler) {
1187
- <div
1188
- (click)="handleExpandRow(row)"
1189
- class="ax-expand-handler"
1190
- [class.ax-invisible]="row.data.hasChild === false"
1191
- id="ax-expand-handler-container"
1192
- [style.padding-inline-start.rem]="row.data?.__meta__?.level * 2"
1193
- >
1194
- @if (loadingRow() === row) {
1195
- <i class="fas fa-spinner-third ax-animate-twSpin ax-animate-infinite"></i>
1196
- } @else {
1197
- @if (row.data?.__meta__?.expanded) {
1198
- <i [class]="customCollapseIcon || 'far fa-minus-square ax-text-md ax-opacity-75'"></i>
1199
- } @else {
1200
- <i [class]="customExpandIcon || 'far fa-plus-square ax-text-md ax-opacity-75'"></i>
1201
- }
1202
- }
1203
- </div>
1204
- }
1205
- @if (component && widgetInjector && row?.data) {
1206
- <ng-container
1207
- *ngComponentOutlet="component; injector: widgetInjector; inputs: getInputs(row.data)"
1208
- ></ng-container>
1209
- }
1210
- </div>
1211
- </ng-template>
1212
- <ng-template #footer></ng-template>
1213
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1214
- }
1215
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetColumnRendererComponent, decorators: [{
1216
- type: Component,
1217
- args: [{
1218
- selector: 'axp-widget-column-renderer',
1219
- template: `
1220
- <ng-template #header>{{ caption | translate | async }}</ng-template>
1221
- <ng-template #cell let-row>
1222
- <div class="ax-flex ax-gap-2 ax-items-center">
1223
- @if (expandHandler) {
1224
- <div
1225
- (click)="handleExpandRow(row)"
1226
- class="ax-expand-handler"
1227
- [class.ax-invisible]="row.data.hasChild === false"
1228
- id="ax-expand-handler-container"
1229
- [style.padding-inline-start.rem]="row.data?.__meta__?.level * 2"
1230
- >
1231
- @if (loadingRow() === row) {
1232
- <i class="fas fa-spinner-third ax-animate-twSpin ax-animate-infinite"></i>
1233
- } @else {
1234
- @if (row.data?.__meta__?.expanded) {
1235
- <i [class]="customCollapseIcon || 'far fa-minus-square ax-text-md ax-opacity-75'"></i>
1236
- } @else {
1237
- <i [class]="customExpandIcon || 'far fa-plus-square ax-text-md ax-opacity-75'"></i>
1238
- }
1239
- }
1240
- </div>
1241
- }
1242
- @if (component && widgetInjector && row?.data) {
1243
- <ng-container
1244
- *ngComponentOutlet="component; injector: widgetInjector; inputs: getInputs(row.data)"
1245
- ></ng-container>
599
+ patchState(store, {
600
+ previousSnapshot: store.snapshot(), // Save the previous state
601
+ data: initialData,
602
+ state: 'restored',
603
+ lastChange: changeEvent,
604
+ });
605
+ },
606
+ // Initialize the state
607
+ set(initialData) {
608
+ const currentData = store.data();
609
+ if (isEqual(currentData, initialData)) {
610
+ return; // Skip if the current state matches the initial state
1246
611
  }
1247
- </div>
1248
- </ng-template>
1249
- <ng-template #footer></ng-template>
1250
- `,
1251
- providers: [
1252
- AXPLayoutBuilderService,
1253
- { provide: AXDataTableColumnComponent, useExisting: AXPWidgetColumnRendererComponent },
1254
- ],
1255
- changeDetection: ChangeDetectionStrategy.OnPush,
1256
- inputs: ['caption'],
1257
- standalone: false,
1258
- }]
1259
- }], propDecorators: { customExpandIcon: [{
1260
- type: Input
1261
- }], customCollapseIcon: [{
1262
- type: Input
1263
- }], customWidth: [{
1264
- type: Input
1265
- }], node: [{
1266
- type: Input,
1267
- args: [{ required: true }]
1268
- }], footerTemplate: [{
1269
- type: Input
1270
- }], _contentFooterTemplate: [{
1271
- type: ViewChild,
1272
- args: ['footer']
1273
- }], expandHandler: [{
1274
- type: Input
1275
- }], cellTemplate: [{
1276
- type: Input
1277
- }], _contentCellTemplate: [{
1278
- type: ViewChild,
1279
- args: ['cell']
1280
- }], headerTemplate: [{
1281
- type: Input
1282
- }], _contentHeaderTemplate: [{
1283
- type: ViewChild,
1284
- args: ['header']
1285
- }] } });
612
+ const changeEvent = {
613
+ oldValue: null,
614
+ newValue: cloneDeep(initialData),
615
+ path: '',
616
+ state: 'initiated',
617
+ data: initialData,
618
+ };
619
+ patchState(store, {
620
+ initialSnapshot: cloneDeep(initialData), // Save the initial state
621
+ previousSnapshot: store.snapshot(), // Save the current state as the previous
622
+ data: initialData,
623
+ state: 'initiated',
624
+ lastChange: changeEvent,
625
+ });
626
+ },
627
+ // Get a specific value
628
+ getValue(path) {
629
+ return get(store.data(), path);
630
+ },
631
+ })));
1286
632
 
1287
633
  class AXPWidgetContainerComponent {
1288
634
  set context(value) {
@@ -1307,12 +653,6 @@ class AXPWidgetContainerComponent {
1307
653
  }
1308
654
  });
1309
655
  }
1310
- refresh() {
1311
- this.builderService.refresh();
1312
- }
1313
- find(name) {
1314
- return this.builderService.waitForWidget(name);
1315
- }
1316
656
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1317
657
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: AXPWidgetContainerComponent, isStandalone: false, selector: "axp-widgets-container", inputs: { context: "context", functions: "functions" }, outputs: { onContextChanged: "onContextChanged" }, host: { styleAttribute: "display: contents;" }, providers: [AXPLayoutBuilderService, AXPLayoutBuilderContextStore], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1318
658
  }
@@ -1446,10 +786,8 @@ class AXPWidgetRendererDirective {
1446
786
  //
1447
787
  const widget = this.widgetRegistery.resolve(this.node().type);
1448
788
  //
1449
- const propertiesToProcess = [
1450
- ...(widget?.properties ?? []),
1451
- ...(widget?.components[this.mode()]?.properties ?? []),
1452
- ]?.filter((c) => c.schema.defaultValue != null);
789
+ const propertiesToProcess = [...(widget?.properties ?? []), ...(widget?.components[this.mode()]?.properties ?? [])]
790
+ ?.filter((c) => c.schema.defaultValue != null);
1453
791
  // Process default values (evaluate expressions if needed)
1454
792
  const props = {};
1455
793
  for (const property of propertiesToProcess) {
@@ -1555,7 +893,7 @@ class AXPWidgetRendererDirective {
1555
893
  Object.entries(obj).forEach(([key, value]) => {
1556
894
  const currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;
1557
895
  // CRITICAL FIX: Skip trigger actions during options processing
1558
- //
896
+ //
1559
897
  // PROBLEM: Trigger actions were being evaluated immediately during widget setup/options processing,
1560
898
  // causing them to execute before the actual trigger event occurred. This meant triggers would fire
1561
899
  // during initialization instead of when the specified context path actually changed.
@@ -1856,240 +1194,372 @@ class AXPLayoutBuilderModule {
1856
1194
  f();
1857
1195
  });
1858
1196
  }
1859
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, deps: [{ token: 'AXPLayoutBuilderModuleFactory', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
1860
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, declarations: [AXPWidgetContainerComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective], imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule, AXTranslationModule], exports: [AXPWidgetContainerComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective] }); }
1861
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule, AXTranslationModule] }); }
1862
- }
1863
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, decorators: [{
1864
- type: NgModule,
1865
- args: [{
1866
- imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule, AXTranslationModule],
1867
- exports: [...COMPONENTS],
1868
- declarations: [...COMPONENTS],
1869
- }]
1870
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1871
- type: Optional
1872
- }, {
1873
- type: Inject,
1874
- args: ['AXPLayoutBuilderModuleFactory']
1875
- }] }] });
1876
-
1877
- class AXPPropertyEditorHelper {
1878
- static expandShorthand(values) {
1879
- switch (values.length) {
1880
- case 1:
1881
- return [values[0], values[0], values[0], values[0]];
1882
- case 2:
1883
- return [values[0], values[1], values[0], values[1]];
1884
- case 3:
1885
- return [values[0], values[1], values[2], values[1]];
1886
- case 4:
1887
- return values;
1888
- default:
1889
- throw new Error(`Invalid shorthand value count. Input: ${values}`);
1197
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, deps: [{ token: 'AXPLayoutBuilderModuleFactory', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
1198
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, declarations: [AXPWidgetContainerComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective], imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule], exports: [AXPWidgetContainerComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective] }); }
1199
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule] }); }
1200
+ }
1201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, decorators: [{
1202
+ type: NgModule,
1203
+ args: [{
1204
+ imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule],
1205
+ exports: [...COMPONENTS],
1206
+ declarations: [...COMPONENTS],
1207
+ }]
1208
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
1209
+ type: Optional
1210
+ }, {
1211
+ type: Inject,
1212
+ args: ['AXPLayoutBuilderModuleFactory']
1213
+ }] }] });
1214
+
1215
+ const AXP_WIDGETS_LAYOUT_CATEGORY = {
1216
+ name: 'layout',
1217
+ order: 1,
1218
+ title: 'Layout',
1219
+ };
1220
+ const AXP_WIDGETS_EDITOR_CATEGORY = {
1221
+ name: 'editor',
1222
+ order: 2,
1223
+ title: 'Editors',
1224
+ };
1225
+ const AXP_WIDGETS_ACTION_CATEGORY = {
1226
+ name: 'action',
1227
+ order: 3,
1228
+ title: 'Action',
1229
+ };
1230
+ const AXP_WIDGETS_ADVANCE_CATEGORY = {
1231
+ name: 'advance',
1232
+ order: 4,
1233
+ title: 'Advance',
1234
+ };
1235
+ const AXP_WIDGETS_CATEGORIES = [
1236
+ AXP_WIDGETS_LAYOUT_CATEGORY,
1237
+ AXP_WIDGETS_EDITOR_CATEGORY,
1238
+ AXP_WIDGETS_ACTION_CATEGORY,
1239
+ AXP_WIDGETS_ADVANCE_CATEGORY,
1240
+ ];
1241
+
1242
+ var AXPWidgetGroupEnum;
1243
+ (function (AXPWidgetGroupEnum) {
1244
+ AXPWidgetGroupEnum["FormElement"] = "form-element";
1245
+ AXPWidgetGroupEnum["DashboardWidget"] = "dashboard-widget";
1246
+ AXPWidgetGroupEnum["FormTemplate"] = "form-template";
1247
+ AXPWidgetGroupEnum["PropertyEditor"] = "property-editor";
1248
+ AXPWidgetGroupEnum["MetaData"] = "meta-data";
1249
+ AXPWidgetGroupEnum["SettingWidget"] = "setting-widget";
1250
+ AXPWidgetGroupEnum["EntityWidget"] = "entity-widget";
1251
+ })(AXPWidgetGroupEnum || (AXPWidgetGroupEnum = {}));
1252
+
1253
+ class AXPBaseWidgetComponent extends AXPLayoutElement {
1254
+ constructor() {
1255
+ super(...arguments);
1256
+ this.token = inject(AXP_WIDGET_TOKEN);
1257
+ this.host = inject(ElementRef).nativeElement;
1258
+ this.layoutService = inject(AXPLayoutBuilderService);
1259
+ this.contextService = inject(AXPLayoutBuilderContextStore);
1260
+ this.config = this.token.config;
1261
+ this.node = this.token.node;
1262
+ this.name = this.token.node.name;
1263
+ this._options = signal(this.token.options ?? {}, ...(ngDevMode ? [{ debugName: "_options" }] : []));
1264
+ this.options = this._options.asReadonly();
1265
+ this.onOptionsChanged = new Subject();
1266
+ this._status = signal(AXPWidgetStatus.Rendering, ...(ngDevMode ? [{ debugName: "_status" }] : []));
1267
+ this.status = this._status.asReadonly();
1268
+ this.onStatusChanged = new BehaviorSubject(this._status());
1269
+ this.#statusEffect = effect(() => {
1270
+ this.onStatusChanged.next(this.status());
1271
+ }, ...(ngDevMode ? [{ debugName: "#statusEffect" }] : []));
1272
+ this.isBusy = computed(() => [AXPWidgetStatus.Rendering, AXPWidgetStatus.Processing].includes(this.status()), ...(ngDevMode ? [{ debugName: "isBusy" }] : []));
1273
+ this._children = signal(this.token.node.children ?? [], ...(ngDevMode ? [{ debugName: "_children" }] : []));
1274
+ this.children = this._children.asReadonly();
1275
+ }
1276
+ get id() {
1277
+ return this._id;
1278
+ }
1279
+ #statusEffect;
1280
+ outputs() {
1281
+ return [];
1282
+ }
1283
+ ngOnInit() {
1284
+ if (get(this.node, '__meta__.added')) {
1285
+ this.onAdded();
1286
+ }
1287
+ this.setStatus(AXPWidgetStatus.Rendered);
1288
+ }
1289
+ setStatus(status) {
1290
+ this._status.set(status);
1291
+ this.layoutService.updateStatus();
1292
+ }
1293
+ setOptions(values) {
1294
+ this._options.set({ ...this.options(), ...values });
1295
+ this.onOptionsChanged.next({ sender: this });
1296
+ }
1297
+ output(name) {
1298
+ const outputs = this.outputs().map((c) => (typeof c == 'string' ? { name: c, value: c } : c));
1299
+ if (outputs.some((c) => c.name == name)) {
1300
+ const opt = get(this, name);
1301
+ if (typeof opt == 'function') {
1302
+ return opt();
1303
+ }
1304
+ return opt;
1305
+ }
1306
+ return null;
1307
+ }
1308
+ call(name, ...args) {
1309
+ const fn = get(this, name);
1310
+ if (fn && typeof fn == 'function') {
1311
+ fn.bind(this)(...args);
1312
+ }
1313
+ }
1314
+ setChildren(children) {
1315
+ this._children.set([...children]);
1316
+ }
1317
+ onAdded() { }
1318
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1319
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent }); }
1320
+ }
1321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent, decorators: [{
1322
+ type: Injectable
1323
+ }] });
1324
+ class AXPLayoutWidgetComponent extends AXPBaseWidgetComponent {
1325
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1326
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutWidgetComponent }); }
1327
+ }
1328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutWidgetComponent, decorators: [{
1329
+ type: Injectable
1330
+ }] });
1331
+ class AXPValueWidgetComponent extends AXPLayoutWidgetComponent {
1332
+ constructor() {
1333
+ super(...arguments);
1334
+ this.path = this.token.node.path;
1335
+ this.defaultValue = this.token.defaultValue ?? this.token.node.defaultValue;
1336
+ this._isValueWidget = false;
1337
+ this.isValueWidget = () => this._isValueWidget;
1338
+ this.onValueChanged = new Subject();
1339
+ this.fullPath = signal(null, ...(ngDevMode ? [{ debugName: "fullPath" }] : []));
1340
+ this.parentPath = signal(null, ...(ngDevMode ? [{ debugName: "parentPath" }] : []));
1341
+ this.getValue = computed(() => {
1342
+ return this.fullPath() ? this.extractValue(this.fullPath()) : null;
1343
+ }, ...(ngDevMode ? [{ debugName: "getValue", equal: isEqual }] : [{ equal: isEqual }]));
1344
+ this.validationRules = computed(() => {
1345
+ const validationsRaw = this.options()['validations'];
1346
+ if (validationsRaw == null) {
1347
+ return [];
1348
+ }
1349
+ return Object.values(this.options()['validations'])
1350
+ .filter((c) => c != null)
1351
+ .map((c) => ({
1352
+ rule: c.rule,
1353
+ message: c.message,
1354
+ options: c.options,
1355
+ }));
1356
+ }, ...(ngDevMode ? [{ debugName: "validationRules" }] : []));
1357
+ }
1358
+ ngOnInit() {
1359
+ this._isValueWidget = this.config.properties?.some((c) => c.name == 'path') ?? false;
1360
+ if (this.isValueWidget()) {
1361
+ this.detectFullPath();
1362
+ if (!isNil(this.defaultValue) && isNil(this.getValue())) {
1363
+ this.setValue(this.defaultValue);
1364
+ }
1890
1365
  }
1366
+ //
1367
+ super.ngOnInit();
1891
1368
  }
1892
- static condenseShorthand(values) {
1893
- if (values.length !== 4) {
1894
- throw new Error('Expected 4 values for condensation.');
1369
+ extractValue(path) {
1370
+ const rawValue = this.contextService.getValue(path);
1371
+ if (this.node.valueTransforms?.getter) {
1372
+ return this.node.valueTransforms?.getter(rawValue);
1895
1373
  }
1896
- if (values[0] === values[1] && values[1] === values[2] && values[2] === values[3]) {
1897
- return `${values[0]}`;
1374
+ return rawValue;
1375
+ }
1376
+ setValue(value) {
1377
+ if (this.node.valueTransforms?.setter) {
1378
+ value = this.node.valueTransforms?.setter(value);
1898
1379
  }
1899
- else if (values[0] === values[2] && values[1] === values[3]) {
1900
- return `${values[0]} ${values[1]}`;
1380
+ const oldValue = this.getValue();
1381
+ value = isUndefined(value) ? null : value;
1382
+ if (isNil(value) && isNil(oldValue)) {
1383
+ return;
1901
1384
  }
1902
- else if (values[1] === values[3]) {
1903
- return `${values[0]} ${values[1]} ${values[2]}`;
1385
+ if (isEqual(oldValue, value)) {
1386
+ return;
1904
1387
  }
1905
- else {
1906
- return `${values[0]} ${values[1]} ${values[2]} ${values[3]}`;
1388
+ if (this.fullPath()) {
1389
+ this.contextService.update(this.fullPath(), value);
1390
+ this.onValueChanged.next({ sender: this });
1907
1391
  }
1908
1392
  }
1909
- static parseSides(input) {
1910
- const values = this.expandShorthand(input.match(/(?:rgb\([^)]+\)|[^ ]+)/g)?.map((value) => value.trim()) || []);
1911
- return { top: values[0], right: values[1], bottom: values[2], left: values[3] };
1912
- }
1913
- static parseSidesWithUnits(input) {
1914
- const values = this.expandShorthand(input.match(/(?:rgb\([^)]+\)|[^ ]+)/g)?.map((value) => value.trim()) || []);
1915
- return {
1916
- top: AXPPropertyEditorHelper.getValueWithUnit(values[0]).value,
1917
- right: AXPPropertyEditorHelper.getValueWithUnit(values[1]).value,
1918
- bottom: AXPPropertyEditorHelper.getValueWithUnit(values[2]).value,
1919
- left: AXPPropertyEditorHelper.getValueWithUnit(values[3]).value,
1920
- };
1921
- }
1922
- static parseCorners(input) {
1923
- const values = this.expandShorthand(input.split(' ').map((value) => value.trim()));
1924
- return {
1925
- 'top-left': AXPPropertyEditorHelper.getValueWithUnit(values[0]).value,
1926
- 'top-right': AXPPropertyEditorHelper.getValueWithUnit(values[1]).value,
1927
- 'bottom-left': AXPPropertyEditorHelper.getValueWithUnit(values[2]).value,
1928
- 'bottom-right': AXPPropertyEditorHelper.getValueWithUnit(values[3]).value,
1929
- };
1930
- }
1931
- static parseSpacingBox(input) {
1932
- return {
1933
- margin: this.parseSidesWithUnits(input.margin),
1934
- padding: this.parseSidesWithUnits(input.padding),
1935
- };
1936
- }
1937
- static parseBorderBox(input) {
1938
- return {
1939
- width: this.parseSidesWithUnits(input.width),
1940
- radius: this.parseCorners(input.radius),
1941
- color: this.parseSides(input.color),
1942
- style: this.parseSides(input.style),
1943
- };
1393
+ detectFullPath() {
1394
+ const sections = [];
1395
+ const ids = [];
1396
+ //
1397
+ let parent = this;
1398
+ //
1399
+ while (parent) {
1400
+ const isValueWidget = parent instanceof AXPValueWidgetComponent && parent.isValueWidget();
1401
+ const valueParent = parent;
1402
+ const path = valueParent.path ?? (isValueWidget ? valueParent.name : null);
1403
+ const id = valueParent.name;
1404
+ //
1405
+ if (path) {
1406
+ sections.push(path);
1407
+ }
1408
+ if (parent.index != null && isValueWidget) {
1409
+ sections.push(`[${parent.index}]`);
1410
+ }
1411
+ if (id) {
1412
+ ids.push(id);
1413
+ if (parent.index != null) {
1414
+ ids.push(`${parent.index}`);
1415
+ }
1416
+ }
1417
+ parent = parent.parent;
1418
+ }
1419
+ //
1420
+ this.fullPath.set(sections.reverse().join('.'));
1421
+ this.parentPath.set(sections.slice(0, sections.length - 1).join('.'));
1422
+ this._id = this.name || this.parent ? ids.reverse().join('_') : null;
1423
+ if (this._id) {
1424
+ this.layoutService.registerWidget(this._id, this);
1425
+ }
1944
1426
  }
1945
- static parseSpacingBoxReverse(input, units) {
1946
- const format = (value, unit) => `${value}${unit}`;
1947
- return {
1948
- margin: AXPPropertyEditorHelper.condenseShorthand([
1949
- format(input.margin.top, units.margin.top),
1950
- format(input.margin.right, units.margin.right),
1951
- format(input.margin.bottom, units.margin.bottom),
1952
- format(input.margin.left, units.margin.left),
1953
- ]),
1954
- padding: AXPPropertyEditorHelper.condenseShorthand([
1955
- format(input.padding.top, units.padding.top),
1956
- format(input.padding.right, units.padding.right),
1957
- format(input.padding.bottom, units.padding.bottom),
1958
- format(input.padding.left, units.padding.left),
1959
- ]),
1960
- };
1427
+ handleValueChanged(e) {
1428
+ if (e.isUserInteraction) {
1429
+ this.setValue(e.value);
1430
+ }
1961
1431
  }
1962
- static parseBorderBoxReverse(input, units) {
1963
- const format = (value, unit) => `${value}${unit}`;
1964
- return {
1965
- width: AXPPropertyEditorHelper.condenseShorthand([
1966
- format(input.width.top, units.width.top),
1967
- format(input.width.right, units.width.right),
1968
- format(input.width.bottom, units.width.bottom),
1969
- format(input.width.left, units.width.left),
1970
- ]),
1971
- radius: AXPPropertyEditorHelper.condenseShorthand([
1972
- format(input.radius['top-left'], units.radius['top-left']),
1973
- format(input.radius['top-right'], units.radius['top-right']),
1974
- format(input.radius['bottom-right'], units.radius['bottom-right']),
1975
- format(input.radius['bottom-left'], units.radius['bottom-left']),
1976
- ]),
1977
- color: AXPPropertyEditorHelper.condenseShorthand([
1978
- `${input.color.top}${units.color.top}`,
1979
- `${input.color.right}${units.color.right}`,
1980
- `${input.color.bottom}${units.color.bottom}`,
1981
- `${input.color.left}${units.color.left}`,
1982
- ]),
1983
- style: AXPPropertyEditorHelper.condenseShorthand([
1984
- `${input.style.top}${units.style.top}`,
1985
- `${input.style.right}${units.style.right}`,
1986
- `${input.style.bottom}${units.style.bottom}`,
1987
- `${input.style.left}${units.style.left}`,
1988
- ]),
1989
- };
1432
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPValueWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1433
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPValueWidgetComponent }); }
1434
+ }
1435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPValueWidgetComponent, decorators: [{
1436
+ type: Injectable
1437
+ }] });
1438
+ class AXPDataListWidgetComponent extends AXPValueWidgetComponent {
1439
+ constructor() {
1440
+ super(...arguments);
1441
+ this.dataService = inject(AXPDataSourceDefinitionProviderService);
1442
+ this.textField = computed(() => this.options()['textField'] ?? 'title', ...(ngDevMode ? [{ debugName: "textField" }] : []));
1443
+ this.valueField = computed(() => this.options()['valueField'] ?? 'id', ...(ngDevMode ? [{ debugName: "valueField" }] : []));
1444
+ this.dataSource = signal(convertArrayToDataSource([]), ...(ngDevMode ? [{ debugName: "dataSource" }] : []));
1445
+ this.isReady = computed(() => {
1446
+ const key = this.dataSource().config?.key;
1447
+ const valueField = this.valueField();
1448
+ const result = key == valueField;
1449
+ return result;
1450
+ }, ...(ngDevMode ? [{ debugName: "isReady" }] : []));
1451
+ this.selectedItems = signal([], ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
1452
+ this.rf = effect(async () => {
1453
+ const rawValue = this.options()['dataSource'];
1454
+ // static datasource class
1455
+ if (rawValue instanceof AXDataSource) {
1456
+ this.dataSource.set(rawValue);
1457
+ }
1458
+ // static array datasource
1459
+ else if (Array.isArray(rawValue)) {
1460
+ const ds = new AXDataSource({
1461
+ key: this.valueField(),
1462
+ pageSize: 10,
1463
+ load: async (e) => {
1464
+ const raw = this.options()['dataSource'];
1465
+ return {
1466
+ items: raw,
1467
+ total: raw.length,
1468
+ };
1469
+ },
1470
+ byKey: (key) => {
1471
+ const raw = this.options()['dataSource'];
1472
+ const item = raw.filter((c) => c[this.valueField()] == key);
1473
+ return Promise.resolve(item[0]);
1474
+ },
1475
+ });
1476
+ this.dataSource.set(ds);
1477
+ }
1478
+ // resolve data source by name
1479
+ else if (rawValue && (typeof rawValue == 'string' || typeof rawValue == 'object')) {
1480
+ const id = typeof rawValue == 'object' ? rawValue['id'] : rawValue;
1481
+ const c = await this.dataService.get(id);
1482
+ if (this.mode == 'designer' && c?.samples?.length) {
1483
+ this.dataSource.set(convertArrayToDataSource(c.samples, {
1484
+ key: this.valueField(),
1485
+ pageSize: 500,
1486
+ }));
1487
+ }
1488
+ else {
1489
+ const ds = c?.source();
1490
+ if (ds && ds instanceof Promise) {
1491
+ const d = await ds;
1492
+ this.dataSource.set(d);
1493
+ }
1494
+ else if (ds) {
1495
+ this.dataSource.set(ds);
1496
+ }
1497
+ // empty datasource
1498
+ else {
1499
+ this.dataSource.set(convertArrayToDataSource([]));
1500
+ }
1501
+ }
1502
+ }
1503
+ // empty datasource
1504
+ else {
1505
+ this.dataSource.set(convertArrayToDataSource([]));
1506
+ }
1507
+ }, ...(ngDevMode ? [{ debugName: "rf" }] : []));
1508
+ this.effect2 = effect(async () => {
1509
+ const value = this.getValue();
1510
+ const items = [];
1511
+ if (Array.isArray(value)) {
1512
+ items.push(...await Promise.all(value.map((item) => this.extractItem(item))));
1513
+ }
1514
+ else {
1515
+ items.push(await this.extractItem(value));
1516
+ }
1517
+ this.selectedItems.set(items.filter((c) => c != null));
1518
+ }, ...(ngDevMode ? [{ debugName: "effect2" }] : []));
1990
1519
  }
1991
- static getValueWithUnit(input) {
1992
- if (typeof input === 'number')
1993
- return { value: input, unit: 'px' };
1994
- if (input === 'auto')
1995
- return { value: 0, unit: 'px' };
1996
- const match = input.match(/^([0-9.]+)([a-z%]*)$/i);
1997
- if (!match)
1998
- throw new Error(`Invalid unit format: ${input}`);
1999
- return { value: parseFloat(match[1]), unit: match[2] || '' };
2000
- }
2001
- static getValueFromUnit(value, unit) {
2002
- return unit ? `${value}${unit}` : `${value}`;
2003
- }
2004
- static parseGap(gap) {
2005
- const parts = gap.split(/\s+/);
2006
- const match = parts[0].match(/^(\d+\.?\d*)([a-z%]+)$/);
2007
- if (!match) {
2008
- throw new Error('Invalid gap format');
1520
+ async extractItem(item) {
1521
+ if (isNil(item)) {
1522
+ return null;
1523
+ }
1524
+ if (isObjectLike(item) && get(item, this.textField()) != null) {
1525
+ return item;
2009
1526
  }
2010
- const [, xValue, unit] = match;
2011
- let yValue = parseFloat(xValue);
2012
- if (parts.length === 2) {
2013
- const secondMatch = parts[1].match(/^(\d+\.?\d*)[a-z%]+$/);
2014
- if (!secondMatch) {
2015
- throw new Error('Invalid gap format');
1527
+ const key = extractValue(item, this.valueField());
1528
+ const ds = this.dataSource();
1529
+ if (ds.config?.byKey) {
1530
+ const found = await ds.config?.byKey(key);
1531
+ if (found) {
1532
+ return found;
2016
1533
  }
2017
- yValue = parseFloat(secondMatch[1]);
2018
1534
  }
2019
- return {
2020
- values: {
2021
- x: parseFloat(xValue),
2022
- y: yValue,
2023
- },
2024
- unit,
1535
+ return isObjectLike(item) ? item : {
1536
+ [this.valueField()]: item,
1537
+ [this.textField()]: item,
2025
1538
  };
2026
1539
  }
2027
- static parseGridTemplate(gridTemplate) {
2028
- const match = gridTemplate.match(/^repeat\((\d+),\s*(?:1fr|auto|minmax\([^)]*\))\)$/);
2029
- if (!match) {
2030
- throw new Error("Invalid grid template format. Expected 'repeat(N, 1fr|auto|minmax(...))'.");
2031
- }
2032
- return parseInt(match[1], 10);
2033
- }
2034
- static createGridTemplate(repetitionCount) {
2035
- if (repetitionCount <= 0) {
2036
- throw new Error('Repetition count must be a positive integer.');
2037
- }
2038
- return `repeat(${repetitionCount}, 1fr)`;
2039
- }
1540
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPDataListWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1541
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPDataListWidgetComponent }); }
2040
1542
  }
2041
- function findNonEmptyBreakpoints(values) {
2042
- const breakpoints = ['default', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'];
2043
- const nonEmptyBreakpoints = [];
2044
- for (const breakpoint of breakpoints) {
2045
- if (values[breakpoint] !== undefined) {
2046
- nonEmptyBreakpoints.push(breakpoint);
2047
- }
1543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPDataListWidgetComponent, decorators: [{
1544
+ type: Injectable
1545
+ }] });
1546
+ class AXPColumnWidgetComponent {
1547
+ constructor() {
1548
+ this.token = inject(AXP_WIDGET_COLUMN_TOKEN);
1549
+ this.path = this.token.path;
1550
+ this.options = this.token.options ?? {};
1551
+ this.rawValue = null;
2048
1552
  }
2049
- return nonEmptyBreakpoints;
1553
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPColumnWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1554
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPColumnWidgetComponent }); }
2050
1555
  }
2051
-
2052
- const AXP_WIDGETS_LAYOUT_CATEGORY = {
2053
- name: 'layout',
2054
- order: 1,
2055
- title: 'Layout',
2056
- };
2057
- const AXP_WIDGETS_EDITOR_CATEGORY = {
2058
- name: 'editor',
2059
- order: 2,
2060
- title: 'Editors',
2061
- };
2062
- const AXP_WIDGETS_ACTION_CATEGORY = {
2063
- name: 'action',
2064
- order: 3,
2065
- title: 'Action',
2066
- };
2067
- const AXP_WIDGETS_ADVANCE_CATEGORY = {
2068
- name: 'advance',
2069
- order: 4,
2070
- title: 'Advance',
2071
- };
2072
- const AXP_WIDGETS_CATEGORIES = [
2073
- AXP_WIDGETS_LAYOUT_CATEGORY,
2074
- AXP_WIDGETS_EDITOR_CATEGORY,
2075
- AXP_WIDGETS_ACTION_CATEGORY,
2076
- AXP_WIDGETS_ADVANCE_CATEGORY,
2077
- ];
2078
-
2079
- var AXPWidgetGroupEnum;
2080
- (function (AXPWidgetGroupEnum) {
2081
- AXPWidgetGroupEnum["FormElement"] = "form-element";
2082
- AXPWidgetGroupEnum["DashboardWidget"] = "dashboard-widget";
2083
- AXPWidgetGroupEnum["FormTemplate"] = "form-template";
2084
- AXPWidgetGroupEnum["PropertyEditor"] = "property-editor";
2085
- AXPWidgetGroupEnum["MetaData"] = "meta-data";
2086
- AXPWidgetGroupEnum["SettingWidget"] = "setting-widget";
2087
- AXPWidgetGroupEnum["EntityWidget"] = "entity-widget";
2088
- })(AXPWidgetGroupEnum || (AXPWidgetGroupEnum = {}));
1556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPColumnWidgetComponent, decorators: [{
1557
+ type: Injectable
1558
+ }] });
2089
1559
 
2090
1560
  /**
2091
1561
  * Generated bundle index. Do not edit.
2092
1562
  */
2093
1563
 
2094
- export { AXPBaseWidgetComponent, AXPBlockBaseLayoutWidgetComponent, AXPBoxModelLayoutWidgetComponent, AXPColumnWidgetComponent, AXPDataListWidgetComponent, AXPFlexBaseLayoutWidgetComponent, AXPFlexItemBaseLayoutWidgetComponent, AXPGridBaseLayoutWidgetComponent, AXPGridItemBaseLayoutWidgetComponent, AXPInlineBaseLayoutWidgetComponent, AXPLayoutBaseWidgetComponent, AXPLayoutBuilderContextStore, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPLayoutContextChangeEvent, AXPLayoutElement, AXPPageStatus, AXPPropertyEditorHelper, AXPValueWidgetComponent, AXPWidgetColumnRendererComponent, AXPWidgetContainerComponent, AXPWidgetGroupEnum, AXPWidgetRegistryService, AXPWidgetRendererDirective, AXPWidgetStatus, AXPWidgetsCatalog, AXP_WIDGETS_ACTION_CATEGORY, AXP_WIDGETS_ADVANCE_CATEGORY, AXP_WIDGETS_CATEGORIES, AXP_WIDGETS_EDITOR_CATEGORY, AXP_WIDGETS_LAYOUT_CATEGORY, AXP_WIDGET_COLUMN_TOKEN, AXP_WIDGET_TOKEN, cloneProperty, createBooleanProperty, createNumberProperty, createSelectProperty, createStringProperty, findNonEmptyBreakpoints };
1564
+ export { AXPBaseWidgetComponent, AXPColumnWidgetComponent, AXPDataListWidgetComponent, AXPLayoutBuilderContextStore, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPLayoutContextChangeEvent, AXPLayoutElement, AXPLayoutWidgetComponent, AXPPageStatus, AXPValueWidgetComponent, AXPWidgetColumnRendererComponent, AXPWidgetContainerComponent, AXPWidgetGroupEnum, AXPWidgetRegistryService, AXPWidgetRendererDirective, AXPWidgetStatus, AXPWidgetsCatalog, AXP_WIDGETS_ACTION_CATEGORY, AXP_WIDGETS_ADVANCE_CATEGORY, AXP_WIDGETS_CATEGORIES, AXP_WIDGETS_EDITOR_CATEGORY, AXP_WIDGETS_LAYOUT_CATEGORY, AXP_WIDGET_COLUMN_TOKEN, AXP_WIDGET_TOKEN, cloneProperty, createBooleanProperty, createNumberProperty, createSelectProperty, createStringProperty };
2095
1565
  //# sourceMappingURL=acorex-platform-layout-builder.mjs.map