@acorex/platform 20.2.4-next.7 → 20.2.4-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/index.d.ts +3 -10
- package/fesm2022/acorex-platform-layout-builder.mjs +1097 -630
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-designer.mjs +79 -17
- package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +16 -16
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/{acorex-platform-widgets-button-widget-designer.component-lNF95FJv.mjs → acorex-platform-widgets-button-widget-designer.component-BJtkWusr.mjs} +3 -3
- package/fesm2022/acorex-platform-widgets-button-widget-designer.component-BJtkWusr.mjs.map +1 -0
- package/fesm2022/{acorex-platform-widgets-page-widget-designer.component-DRsLkulH.mjs → acorex-platform-widgets-page-widget-designer.component-Cw9WcZze.mjs} +74 -64
- package/fesm2022/acorex-platform-widgets-page-widget-designer.component-Cw9WcZze.mjs.map +1 -0
- package/fesm2022/{acorex-platform-widgets-text-block-widget-designer.component-CCMQtH3e.mjs → acorex-platform-widgets-text-block-widget-designer.component-DaR4Nkv4.mjs} +8 -12
- package/fesm2022/acorex-platform-widgets-text-block-widget-designer.component-DaR4Nkv4.mjs.map +1 -0
- package/fesm2022/acorex-platform-widgets.mjs +3405 -3540
- package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
- package/layout/builder/index.d.ts +355 -187
- package/layout/components/index.d.ts +2 -2
- package/layout/designer/index.d.ts +15 -3
- package/package.json +17 -31
- package/widgets/index.d.ts +152 -220
- package/fesm2022/acorex-platform-widgets-button-widget-designer.component-lNF95FJv.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-page-widget-designer.component-DRsLkulH.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-text-block-widget-designer.component-CCMQtH3e.mjs.map +0 -1
|
@@ -1,3 +1,10 @@
|
|
|
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';
|
|
1
8
|
import * as i1$1 from '@acorex/components/skeleton';
|
|
2
9
|
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
|
3
10
|
import * as i2 from '@acorex/core/translation';
|
|
@@ -5,15 +12,8 @@ import { AXTranslationService, AXTranslationModule } from '@acorex/core/translat
|
|
|
5
12
|
import { PortalModule } from '@angular/cdk/portal';
|
|
6
13
|
import * as i1 from '@angular/common';
|
|
7
14
|
import { CommonModule } from '@angular/common';
|
|
8
|
-
import * as i0 from '@angular/core';
|
|
9
|
-
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';
|
|
10
15
|
import { AXDataTableColumnComponent, AXBaseDataTable } from '@acorex/components/data-table';
|
|
11
|
-
import { getSmart, setSmart, AXPExpressionEvaluatorService, AXPDataSourceDefinitionProviderService, extractValue } from '@acorex/platform/core';
|
|
12
|
-
import { set, merge, cloneDeep, isNil, isEqual, get, sum, isEmpty, isString, isUndefined, isObjectLike } from 'lodash-es';
|
|
13
|
-
import { Subject, filter, BehaviorSubject } from 'rxjs';
|
|
14
|
-
import { signalStore, withState, withComputed, withMethods, patchState } from '@ngrx/signals';
|
|
15
16
|
import { AXUnsubscriber } from '@acorex/core/utils';
|
|
16
|
-
import { convertArrayToDataSource, AXDataSource } from '@acorex/cdk/common';
|
|
17
17
|
|
|
18
18
|
var AXPPageStatus;
|
|
19
19
|
(function (AXPPageStatus) {
|
|
@@ -165,42 +165,117 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
165
165
|
type: Injectable
|
|
166
166
|
}] });
|
|
167
167
|
|
|
168
|
-
class
|
|
169
|
-
/**
|
|
170
|
-
*
|
|
171
|
-
*/
|
|
172
|
-
constructor() {
|
|
173
|
-
this.types = new Map();
|
|
174
|
-
AXPWidgetRegistryService.instance = this;
|
|
175
|
-
}
|
|
176
|
-
register(widget) {
|
|
177
|
-
this.types.set(widget.name, widget);
|
|
178
|
-
}
|
|
179
|
-
extend(parentName, widget) {
|
|
180
|
-
const parentWidget = this.resolve(parentName);
|
|
181
|
-
const newWidget = merge({}, parentWidget, widget);
|
|
182
|
-
newWidget.name = widget.name;
|
|
183
|
-
this.register(newWidget);
|
|
184
|
-
}
|
|
185
|
-
resolve(name) {
|
|
186
|
-
const widget = this.types.get(name);
|
|
187
|
-
if (!widget) {
|
|
188
|
-
throw new Error(`Widget with name "${name}" does not exist.`);
|
|
189
|
-
}
|
|
190
|
-
return widget;
|
|
191
|
-
}
|
|
192
|
-
all() {
|
|
193
|
-
return Array.from(this.types.values());
|
|
194
|
-
}
|
|
195
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
196
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetRegistryService, providedIn: 'root' }); }
|
|
168
|
+
class AXPLayoutContextChangeEvent {
|
|
197
169
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
|
258
|
+
}
|
|
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
|
+
})));
|
|
204
279
|
|
|
205
280
|
const AXPWidgetsCatalog = {
|
|
206
281
|
timeDuration: 'time-duration',
|
|
@@ -251,6 +326,7 @@ const AXPWidgetsCatalog = {
|
|
|
251
326
|
direction: 'direction',
|
|
252
327
|
border: 'border',
|
|
253
328
|
flexLayout: 'flex-layout',
|
|
329
|
+
flexItem: 'flex-item-layout',
|
|
254
330
|
avatar: 'avatar',
|
|
255
331
|
themePaletteChooser: 'theme-palette-chooser',
|
|
256
332
|
themeModeChooser: 'theme-mode-chooser',
|
|
@@ -260,6 +336,7 @@ const AXPWidgetsCatalog = {
|
|
|
260
336
|
iconChooser: 'icon-chooser',
|
|
261
337
|
themeColorChooser: 'theme-color-chooser',
|
|
262
338
|
gridOptions: 'grid-options',
|
|
339
|
+
gridItemOptions: 'grid-item-options',
|
|
263
340
|
advancedGridOptions: 'advanced-grid-options',
|
|
264
341
|
stringFilter: 'string-filter',
|
|
265
342
|
numberFilter: 'number-filter',
|
|
@@ -267,6 +344,7 @@ const AXPWidgetsCatalog = {
|
|
|
267
344
|
booleanFilter: 'boolean-filter',
|
|
268
345
|
lookupFilter: 'lookup-filter',
|
|
269
346
|
flexOptions: 'flex-options',
|
|
347
|
+
flexItemOptions: 'flex-item-options',
|
|
270
348
|
selectFilter: 'select-filter',
|
|
271
349
|
requiredValidation: 'required-validation',
|
|
272
350
|
regularExpressionValidation: 'regular-expression-validation',
|
|
@@ -381,70 +459,711 @@ function createSelectProperty(ctor) {
|
|
|
381
459
|
const AXP_WIDGET_TOKEN = new InjectionToken('AXP_WIDGET_TOKEN');
|
|
382
460
|
const AXP_WIDGET_COLUMN_TOKEN = new InjectionToken('AXP_WIDGET_COLUMN_TOKEN');
|
|
383
461
|
|
|
384
|
-
class
|
|
462
|
+
class AXPBaseWidgetComponent extends AXPLayoutElement {
|
|
385
463
|
constructor() {
|
|
386
464
|
super(...arguments);
|
|
387
|
-
this.
|
|
388
|
-
this.
|
|
389
|
-
this.
|
|
390
|
-
this.
|
|
391
|
-
this.
|
|
392
|
-
this.
|
|
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();
|
|
393
484
|
}
|
|
394
|
-
get
|
|
395
|
-
return this.
|
|
485
|
+
get id() {
|
|
486
|
+
return this._id;
|
|
396
487
|
}
|
|
397
|
-
|
|
398
|
-
|
|
488
|
+
#statusEffect;
|
|
489
|
+
outputs() {
|
|
490
|
+
return [];
|
|
399
491
|
}
|
|
400
|
-
|
|
401
|
-
|
|
492
|
+
ngOnInit() {
|
|
493
|
+
if (get(this.node, '__meta__.added')) {
|
|
494
|
+
this.onAdded();
|
|
495
|
+
}
|
|
496
|
+
this.setStatus(AXPWidgetStatus.Rendered);
|
|
402
497
|
}
|
|
403
|
-
|
|
404
|
-
|
|
498
|
+
setStatus(status) {
|
|
499
|
+
this._status.set(status);
|
|
500
|
+
this.layoutService.updateStatus();
|
|
405
501
|
}
|
|
406
|
-
|
|
407
|
-
this.
|
|
408
|
-
|
|
409
|
-
this.
|
|
410
|
-
|
|
411
|
-
// this.width = `${parseInt(this.width as string) + 24}px`;
|
|
412
|
-
// }
|
|
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 });
|
|
413
507
|
}
|
|
414
|
-
|
|
415
|
-
|
|
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;
|
|
416
518
|
}
|
|
417
|
-
|
|
418
|
-
|
|
519
|
+
call(name, ...args) {
|
|
520
|
+
const fn = get(this, name);
|
|
521
|
+
if (fn && typeof fn == 'function') {
|
|
522
|
+
fn.bind(this)(...args);
|
|
523
|
+
}
|
|
419
524
|
}
|
|
420
|
-
|
|
421
|
-
|
|
525
|
+
setChildren(children) {
|
|
526
|
+
this._children.set([...children]);
|
|
422
527
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
this.
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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}`;
|
|
1141
|
+
}
|
|
1142
|
+
async ngOnInit() {
|
|
1143
|
+
const widget = this.widgetRegistery.resolve(this.node.type);
|
|
1144
|
+
const mode = 'column';
|
|
1145
|
+
this.component = await widget?.components[mode]?.component();
|
|
1146
|
+
//
|
|
1147
|
+
const props = widget?.components[mode]?.properties
|
|
1148
|
+
?.filter((c) => c.schema.defaultValue)
|
|
1149
|
+
.map((c) => ({ [c.name]: c.schema.defaultValue }))
|
|
1150
|
+
.reduce((acc, curr) => {
|
|
1151
|
+
return { ...acc, ...curr };
|
|
1152
|
+
}, {});
|
|
1153
|
+
//
|
|
1154
|
+
this.mergedOptions.set(merge(props, this.node.options) || {});
|
|
1155
|
+
const tokenValue = {
|
|
1156
|
+
path: this.node.path,
|
|
1157
|
+
options: this.mergedOptions(),
|
|
1158
|
+
};
|
|
1159
|
+
this.widgetInjector = Injector.create({
|
|
1160
|
+
parent: this.injector,
|
|
1161
|
+
providers: [
|
|
1162
|
+
{
|
|
1163
|
+
provide: AXP_WIDGET_COLUMN_TOKEN,
|
|
1164
|
+
useValue: tokenValue,
|
|
1165
|
+
},
|
|
1166
|
+
],
|
|
448
1167
|
});
|
|
449
1168
|
this.width = this.customWidth ? this.customWidth : (this.mergedOptions().width ?? '200px');
|
|
450
1169
|
this.allowResizing = this.mergedOptions().allowResizing || true;
|
|
@@ -493,189 +1212,77 @@ class AXPWidgetColumnRendererComponent extends AXDataTableColumnComponent {
|
|
|
493
1212
|
<ng-template #footer></ng-template>
|
|
494
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 }); }
|
|
495
1214
|
}
|
|
496
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPWidgetColumnRendererComponent, decorators: [{
|
|
497
|
-
type: Component,
|
|
498
|
-
args: [{
|
|
499
|
-
selector: 'axp-widget-column-renderer',
|
|
500
|
-
template: `
|
|
501
|
-
<ng-template #header>{{ caption | translate | async }}</ng-template>
|
|
502
|
-
<ng-template #cell let-row>
|
|
503
|
-
<div class="ax-flex ax-gap-2 ax-items-center">
|
|
504
|
-
@if (expandHandler) {
|
|
505
|
-
<div
|
|
506
|
-
(click)="handleExpandRow(row)"
|
|
507
|
-
class="ax-expand-handler"
|
|
508
|
-
[class.ax-invisible]="row.data.hasChild === false"
|
|
509
|
-
id="ax-expand-handler-container"
|
|
510
|
-
[style.padding-inline-start.rem]="row.data?.__meta__?.level * 2"
|
|
511
|
-
>
|
|
512
|
-
@if (loadingRow() === row) {
|
|
513
|
-
<i class="fas fa-spinner-third ax-animate-twSpin ax-animate-infinite"></i>
|
|
514
|
-
} @else {
|
|
515
|
-
@if (row.data?.__meta__?.expanded) {
|
|
516
|
-
<i [class]="customCollapseIcon || 'far fa-minus-square ax-text-md ax-opacity-75'"></i>
|
|
517
|
-
} @else {
|
|
518
|
-
<i [class]="customExpandIcon || 'far fa-plus-square ax-text-md ax-opacity-75'"></i>
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
</div>
|
|
522
|
-
}
|
|
523
|
-
@if (component && widgetInjector && row?.data) {
|
|
524
|
-
<ng-container
|
|
525
|
-
*ngComponentOutlet="component; injector: widgetInjector; inputs: getInputs(row.data)"
|
|
526
|
-
></ng-container>
|
|
527
|
-
}
|
|
528
|
-
</div>
|
|
529
|
-
</ng-template>
|
|
530
|
-
<ng-template #footer></ng-template>
|
|
531
|
-
`,
|
|
532
|
-
providers: [
|
|
533
|
-
AXPLayoutBuilderService,
|
|
534
|
-
{ provide: AXDataTableColumnComponent, useExisting: AXPWidgetColumnRendererComponent },
|
|
535
|
-
],
|
|
536
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
537
|
-
inputs: ['caption'],
|
|
538
|
-
standalone: false,
|
|
539
|
-
}]
|
|
540
|
-
}], propDecorators: { customExpandIcon: [{
|
|
541
|
-
type: Input
|
|
542
|
-
}], customCollapseIcon: [{
|
|
543
|
-
type: Input
|
|
544
|
-
}], customWidth: [{
|
|
545
|
-
type: Input
|
|
546
|
-
}], node: [{
|
|
547
|
-
type: Input,
|
|
548
|
-
args: [{ required: true }]
|
|
549
|
-
}], footerTemplate: [{
|
|
550
|
-
type: Input
|
|
551
|
-
}], _contentFooterTemplate: [{
|
|
552
|
-
type: ViewChild,
|
|
553
|
-
args: ['footer']
|
|
554
|
-
}], expandHandler: [{
|
|
555
|
-
type: Input
|
|
556
|
-
}], cellTemplate: [{
|
|
557
|
-
type: Input
|
|
558
|
-
}], _contentCellTemplate: [{
|
|
559
|
-
type: ViewChild,
|
|
560
|
-
args: ['cell']
|
|
561
|
-
}], headerTemplate: [{
|
|
562
|
-
type: Input
|
|
563
|
-
}], _contentHeaderTemplate: [{
|
|
564
|
-
type: ViewChild,
|
|
565
|
-
args: ['header']
|
|
566
|
-
}] } });
|
|
567
|
-
|
|
568
|
-
class AXPLayoutContextChangeEvent {
|
|
569
|
-
}
|
|
570
|
-
const AXPLayoutBuilderContextStore = signalStore(
|
|
571
|
-
// Initial State
|
|
572
|
-
withState(() => ({
|
|
573
|
-
data: {}, // Shared context data
|
|
574
|
-
state: 'initiated', // Current state
|
|
575
|
-
initialSnapshot: {}, // Snapshot of the first initialized state
|
|
576
|
-
previousSnapshot: {}, // Snapshot of the previous state
|
|
577
|
-
lastChange: {
|
|
578
|
-
state: 'initiated',
|
|
579
|
-
}, // Last change event
|
|
580
|
-
})),
|
|
581
|
-
// Computed Signals
|
|
582
|
-
withComputed(({ data, state, lastChange, initialSnapshot, previousSnapshot }) => ({
|
|
583
|
-
isChanged: computed(() => state() === 'changed'),
|
|
584
|
-
isReset: computed(() => state() === 'restored'),
|
|
585
|
-
isInitiated: computed(() => state() === 'initiated'),
|
|
586
|
-
isEmpty: computed(() => Object.keys(data()).length === 0),
|
|
587
|
-
isDirty: computed(() => !isEqual(data(), previousSnapshot())),
|
|
588
|
-
snapshot: computed(() => cloneDeep(data())), // Current data snapshot
|
|
589
|
-
initial: computed(() => cloneDeep(initialSnapshot())), // Initial snapshot
|
|
590
|
-
previous: computed(() => cloneDeep(previousSnapshot())), // Previous snapshot
|
|
591
|
-
changeEvent: computed(() => lastChange()), // Reactive last change event
|
|
592
|
-
})),
|
|
593
|
-
// Methods for State Management
|
|
594
|
-
withMethods((store) => ({
|
|
595
|
-
// Update a specific value
|
|
596
|
-
update(path, value) {
|
|
597
|
-
const currentData = cloneDeep(store.data());
|
|
598
|
-
const oldValue = get(currentData, path);
|
|
599
|
-
// Skip if the value hasn't changed
|
|
600
|
-
if (isEqual(oldValue, value)) {
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
|
-
// Update the value and prepare the change event
|
|
604
|
-
const updatedData = setSmart(currentData, path, value);
|
|
605
|
-
const changeEvent = {
|
|
606
|
-
oldValue,
|
|
607
|
-
newValue: value,
|
|
608
|
-
path,
|
|
609
|
-
state: 'changed',
|
|
610
|
-
data: updatedData,
|
|
611
|
-
};
|
|
612
|
-
// Patch the state
|
|
613
|
-
patchState(store, {
|
|
614
|
-
previousSnapshot: store.snapshot(), // Save the previous state
|
|
615
|
-
data: updatedData,
|
|
616
|
-
state: 'changed',
|
|
617
|
-
lastChange: changeEvent,
|
|
618
|
-
});
|
|
619
|
-
},
|
|
620
|
-
patch(context) {
|
|
621
|
-
const currentData = cloneDeep(store.data());
|
|
622
|
-
// Update the value and prepare the change event
|
|
623
|
-
const updatedData = { ...currentData, ...context };
|
|
624
|
-
const changeEvent = {
|
|
625
|
-
state: 'patch',
|
|
626
|
-
data: updatedData,
|
|
627
|
-
};
|
|
628
|
-
// Patch the state
|
|
629
|
-
patchState(store, {
|
|
630
|
-
previousSnapshot: store.snapshot(), // Save the previous state
|
|
631
|
-
data: updatedData,
|
|
632
|
-
state: 'changed',
|
|
633
|
-
lastChange: changeEvent,
|
|
634
|
-
});
|
|
635
|
-
},
|
|
636
|
-
// Reset to the initial state
|
|
637
|
-
reset() {
|
|
638
|
-
const initialData = store.initial();
|
|
639
|
-
const changeEvent = {
|
|
640
|
-
oldValue: cloneDeep(store.data()), // Current data becomes old value
|
|
641
|
-
newValue: cloneDeep(initialData), // Reset to the initial state
|
|
642
|
-
path: '',
|
|
643
|
-
state: 'restored',
|
|
644
|
-
data: initialData,
|
|
645
|
-
};
|
|
646
|
-
patchState(store, {
|
|
647
|
-
previousSnapshot: store.snapshot(), // Save the previous state
|
|
648
|
-
data: initialData,
|
|
649
|
-
state: 'restored',
|
|
650
|
-
lastChange: changeEvent,
|
|
651
|
-
});
|
|
652
|
-
},
|
|
653
|
-
// Initialize the state
|
|
654
|
-
set(initialData) {
|
|
655
|
-
const currentData = store.data();
|
|
656
|
-
if (isEqual(currentData, initialData)) {
|
|
657
|
-
return; // Skip if the current state matches the initial state
|
|
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>
|
|
658
1241
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
}
|
|
1242
|
+
@if (component && widgetInjector && row?.data) {
|
|
1243
|
+
<ng-container
|
|
1244
|
+
*ngComponentOutlet="component; injector: widgetInjector; inputs: getInputs(row.data)"
|
|
1245
|
+
></ng-container>
|
|
1246
|
+
}
|
|
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
|
+
}] } });
|
|
679
1286
|
|
|
680
1287
|
class AXPWidgetContainerComponent {
|
|
681
1288
|
set context(value) {
|
|
@@ -1249,380 +1856,240 @@ class AXPLayoutBuilderModule {
|
|
|
1249
1856
|
f();
|
|
1250
1857
|
});
|
|
1251
1858
|
}
|
|
1252
|
-
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 }); }
|
|
1253
|
-
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] }); }
|
|
1254
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule, AXTranslationModule] }); }
|
|
1255
|
-
}
|
|
1256
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutBuilderModule, decorators: [{
|
|
1257
|
-
type: NgModule,
|
|
1258
|
-
args: [{
|
|
1259
|
-
imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule, AXTranslationModule],
|
|
1260
|
-
exports: [...COMPONENTS],
|
|
1261
|
-
declarations: [...COMPONENTS],
|
|
1262
|
-
}]
|
|
1263
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1264
|
-
type: Optional
|
|
1265
|
-
}, {
|
|
1266
|
-
type: Inject,
|
|
1267
|
-
args: ['AXPLayoutBuilderModuleFactory']
|
|
1268
|
-
}] }] });
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
title: 'Action',
|
|
1284
|
-
};
|
|
1285
|
-
const AXP_WIDGETS_ADVANCE_CATEGORY = {
|
|
1286
|
-
name: 'advance',
|
|
1287
|
-
order: 4,
|
|
1288
|
-
title: 'Advance',
|
|
1289
|
-
};
|
|
1290
|
-
const AXP_WIDGETS_CATEGORIES = [
|
|
1291
|
-
AXP_WIDGETS_LAYOUT_CATEGORY,
|
|
1292
|
-
AXP_WIDGETS_EDITOR_CATEGORY,
|
|
1293
|
-
AXP_WIDGETS_ACTION_CATEGORY,
|
|
1294
|
-
AXP_WIDGETS_ADVANCE_CATEGORY,
|
|
1295
|
-
];
|
|
1296
|
-
|
|
1297
|
-
var AXPWidgetGroupEnum;
|
|
1298
|
-
(function (AXPWidgetGroupEnum) {
|
|
1299
|
-
AXPWidgetGroupEnum["FormElement"] = "form-element";
|
|
1300
|
-
AXPWidgetGroupEnum["DashboardWidget"] = "dashboard-widget";
|
|
1301
|
-
AXPWidgetGroupEnum["FormTemplate"] = "form-template";
|
|
1302
|
-
AXPWidgetGroupEnum["PropertyEditor"] = "property-editor";
|
|
1303
|
-
AXPWidgetGroupEnum["MetaData"] = "meta-data";
|
|
1304
|
-
AXPWidgetGroupEnum["SettingWidget"] = "setting-widget";
|
|
1305
|
-
AXPWidgetGroupEnum["EntityWidget"] = "entity-widget";
|
|
1306
|
-
})(AXPWidgetGroupEnum || (AXPWidgetGroupEnum = {}));
|
|
1307
|
-
|
|
1308
|
-
class AXPBaseWidgetComponent extends AXPLayoutElement {
|
|
1309
|
-
constructor() {
|
|
1310
|
-
super(...arguments);
|
|
1311
|
-
this.token = inject(AXP_WIDGET_TOKEN);
|
|
1312
|
-
this.host = inject(ElementRef).nativeElement;
|
|
1313
|
-
this.layoutService = inject(AXPLayoutBuilderService);
|
|
1314
|
-
this.contextService = inject(AXPLayoutBuilderContextStore);
|
|
1315
|
-
this.config = this.token.config;
|
|
1316
|
-
this.node = this.token.node;
|
|
1317
|
-
this.name = this.token.node.name;
|
|
1318
|
-
this._options = signal(this.token.options ?? {}, ...(ngDevMode ? [{ debugName: "_options" }] : []));
|
|
1319
|
-
this.options = this._options.asReadonly();
|
|
1320
|
-
this.onOptionsChanged = new Subject();
|
|
1321
|
-
this._status = signal(AXPWidgetStatus.Rendering, ...(ngDevMode ? [{ debugName: "_status" }] : []));
|
|
1322
|
-
this.status = this._status.asReadonly();
|
|
1323
|
-
this.onStatusChanged = new BehaviorSubject(this._status());
|
|
1324
|
-
this.#statusEffect = effect(() => {
|
|
1325
|
-
this.onStatusChanged.next(this.status());
|
|
1326
|
-
}, ...(ngDevMode ? [{ debugName: "#statusEffect" }] : []));
|
|
1327
|
-
this.isBusy = computed(() => [AXPWidgetStatus.Rendering, AXPWidgetStatus.Processing].includes(this.status()), ...(ngDevMode ? [{ debugName: "isBusy" }] : []));
|
|
1328
|
-
this._children = signal(this.token.node.children ?? [], ...(ngDevMode ? [{ debugName: "_children" }] : []));
|
|
1329
|
-
this.children = this._children.asReadonly();
|
|
1330
|
-
}
|
|
1331
|
-
get id() {
|
|
1332
|
-
return this._id;
|
|
1333
|
-
}
|
|
1334
|
-
#statusEffect;
|
|
1335
|
-
outputs() {
|
|
1336
|
-
return [];
|
|
1337
|
-
}
|
|
1338
|
-
ngOnInit() {
|
|
1339
|
-
if (get(this.node, '__meta__.added')) {
|
|
1340
|
-
this.onAdded();
|
|
1341
|
-
}
|
|
1342
|
-
this.setStatus(AXPWidgetStatus.Rendered);
|
|
1343
|
-
}
|
|
1344
|
-
setStatus(status) {
|
|
1345
|
-
this._status.set(status);
|
|
1346
|
-
this.layoutService.updateStatus();
|
|
1347
|
-
}
|
|
1348
|
-
setOptions(values) {
|
|
1349
|
-
this._options.set({ ...this.options(), ...values });
|
|
1350
|
-
this.onOptionsChanged.next({ sender: this });
|
|
1351
|
-
}
|
|
1352
|
-
output(name) {
|
|
1353
|
-
const outputs = this.outputs().map((c) => (typeof c == 'string' ? { name: c, value: c } : c));
|
|
1354
|
-
if (outputs.some((c) => c.name == name)) {
|
|
1355
|
-
const opt = get(this, name);
|
|
1356
|
-
if (typeof opt == 'function') {
|
|
1357
|
-
return opt();
|
|
1358
|
-
}
|
|
1359
|
-
return opt;
|
|
1360
|
-
}
|
|
1361
|
-
return null;
|
|
1362
|
-
}
|
|
1363
|
-
call(name, ...args) {
|
|
1364
|
-
const fn = get(this, name);
|
|
1365
|
-
if (fn && typeof fn == 'function') {
|
|
1366
|
-
fn.bind(this)(...args);
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
setChildren(children) {
|
|
1370
|
-
this._children.set([...children]);
|
|
1371
|
-
}
|
|
1372
|
-
onAdded() { }
|
|
1373
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1374
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent }); }
|
|
1375
|
-
}
|
|
1376
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBaseWidgetComponent, decorators: [{
|
|
1377
|
-
type: Injectable
|
|
1378
|
-
}] });
|
|
1379
|
-
class AXPLayoutWidgetComponent extends AXPBaseWidgetComponent {
|
|
1380
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1381
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutWidgetComponent }); }
|
|
1382
|
-
}
|
|
1383
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPLayoutWidgetComponent, decorators: [{
|
|
1384
|
-
type: Injectable
|
|
1385
|
-
}] });
|
|
1386
|
-
class AXPValueWidgetComponent extends AXPLayoutWidgetComponent {
|
|
1387
|
-
constructor() {
|
|
1388
|
-
super(...arguments);
|
|
1389
|
-
this.path = this.token.node.path;
|
|
1390
|
-
this.defaultValue = this.token.defaultValue ?? this.token.node.defaultValue;
|
|
1391
|
-
this._isValueWidget = false;
|
|
1392
|
-
this.isValueWidget = () => this._isValueWidget;
|
|
1393
|
-
this.onValueChanged = new Subject();
|
|
1394
|
-
this.fullPath = signal(null, ...(ngDevMode ? [{ debugName: "fullPath" }] : []));
|
|
1395
|
-
this.parentPath = signal(null, ...(ngDevMode ? [{ debugName: "parentPath" }] : []));
|
|
1396
|
-
this.getValue = computed(() => {
|
|
1397
|
-
return this.fullPath() ? this.extractValue(this.fullPath()) : null;
|
|
1398
|
-
}, ...(ngDevMode ? [{ debugName: "getValue", equal: isEqual }] : [{ equal: isEqual }]));
|
|
1399
|
-
this.validationRules = computed(() => {
|
|
1400
|
-
const validationsRaw = this.options()['validations'];
|
|
1401
|
-
if (validationsRaw == null) {
|
|
1402
|
-
return [];
|
|
1403
|
-
}
|
|
1404
|
-
return Object.values(this.options()['validations'])
|
|
1405
|
-
.filter((c) => c != null)
|
|
1406
|
-
.map((c) => ({
|
|
1407
|
-
rule: c.rule,
|
|
1408
|
-
message: c.message,
|
|
1409
|
-
options: c.options,
|
|
1410
|
-
}));
|
|
1411
|
-
}, ...(ngDevMode ? [{ debugName: "validationRules" }] : []));
|
|
1412
|
-
}
|
|
1413
|
-
ngOnInit() {
|
|
1414
|
-
this._isValueWidget = this.config.properties?.some((c) => c.name == 'path') ?? false;
|
|
1415
|
-
if (this.isValueWidget()) {
|
|
1416
|
-
this.detectFullPath();
|
|
1417
|
-
if (!isNil(this.defaultValue) && isNil(this.getValue())) {
|
|
1418
|
-
this.setValue(this.defaultValue);
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
//
|
|
1422
|
-
super.ngOnInit();
|
|
1423
|
-
}
|
|
1424
|
-
extractValue(path) {
|
|
1425
|
-
const rawValue = this.contextService.getValue(path);
|
|
1426
|
-
if (this.node.valueTransforms?.getter) {
|
|
1427
|
-
return this.node.valueTransforms?.getter(rawValue);
|
|
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}`);
|
|
1428
1890
|
}
|
|
1429
|
-
return rawValue;
|
|
1430
1891
|
}
|
|
1431
|
-
|
|
1432
|
-
if (
|
|
1433
|
-
|
|
1434
|
-
}
|
|
1435
|
-
const oldValue = this.getValue();
|
|
1436
|
-
value = isUndefined(value) ? null : value;
|
|
1437
|
-
if (isNil(value) && isNil(oldValue)) {
|
|
1438
|
-
return;
|
|
1892
|
+
static condenseShorthand(values) {
|
|
1893
|
+
if (values.length !== 4) {
|
|
1894
|
+
throw new Error('Expected 4 values for condensation.');
|
|
1439
1895
|
}
|
|
1440
|
-
if (
|
|
1441
|
-
return
|
|
1896
|
+
if (values[0] === values[1] && values[1] === values[2] && values[2] === values[3]) {
|
|
1897
|
+
return `${values[0]}`;
|
|
1442
1898
|
}
|
|
1443
|
-
if (
|
|
1444
|
-
|
|
1445
|
-
this.onValueChanged.next({ sender: this });
|
|
1899
|
+
else if (values[0] === values[2] && values[1] === values[3]) {
|
|
1900
|
+
return `${values[0]} ${values[1]}`;
|
|
1446
1901
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
const sections = [];
|
|
1450
|
-
const ids = [];
|
|
1451
|
-
//
|
|
1452
|
-
let parent = this;
|
|
1453
|
-
//
|
|
1454
|
-
while (parent) {
|
|
1455
|
-
const isValueWidget = parent instanceof AXPValueWidgetComponent && parent.isValueWidget();
|
|
1456
|
-
const valueParent = parent;
|
|
1457
|
-
const path = valueParent.path ?? (isValueWidget ? valueParent.name : null);
|
|
1458
|
-
const id = valueParent.name;
|
|
1459
|
-
//
|
|
1460
|
-
if (path) {
|
|
1461
|
-
sections.push(path);
|
|
1462
|
-
}
|
|
1463
|
-
if (parent.index != null && isValueWidget) {
|
|
1464
|
-
sections.push(`[${parent.index}]`);
|
|
1465
|
-
}
|
|
1466
|
-
if (id) {
|
|
1467
|
-
ids.push(id);
|
|
1468
|
-
if (parent.index != null) {
|
|
1469
|
-
ids.push(`${parent.index}`);
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
parent = parent.parent;
|
|
1902
|
+
else if (values[1] === values[3]) {
|
|
1903
|
+
return `${values[0]} ${values[1]} ${values[2]}`;
|
|
1473
1904
|
}
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
this.parentPath.set(sections.slice(0, sections.length - 1).join('.'));
|
|
1477
|
-
this._id = this.name || this.parent ? ids.reverse().join('_') : null;
|
|
1478
|
-
if (this._id) {
|
|
1479
|
-
this.layoutService.registerWidget(this._id, this);
|
|
1905
|
+
else {
|
|
1906
|
+
return `${values[0]} ${values[1]} ${values[2]} ${values[3]}`;
|
|
1480
1907
|
}
|
|
1481
1908
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
}
|
|
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] };
|
|
1486
1912
|
}
|
|
1487
|
-
static
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
super(...arguments);
|
|
1496
|
-
this.dataService = inject(AXPDataSourceDefinitionProviderService);
|
|
1497
|
-
this.textField = computed(() => this.options()['textField'] ?? 'title', ...(ngDevMode ? [{ debugName: "textField" }] : []));
|
|
1498
|
-
this.valueField = computed(() => this.options()['valueField'] ?? 'id', ...(ngDevMode ? [{ debugName: "valueField" }] : []));
|
|
1499
|
-
this.dataSource = signal(convertArrayToDataSource([]), ...(ngDevMode ? [{ debugName: "dataSource" }] : []));
|
|
1500
|
-
this.isReady = computed(() => {
|
|
1501
|
-
const key = this.dataSource().config?.key;
|
|
1502
|
-
const valueField = this.valueField();
|
|
1503
|
-
const result = key == valueField;
|
|
1504
|
-
return result;
|
|
1505
|
-
}, ...(ngDevMode ? [{ debugName: "isReady" }] : []));
|
|
1506
|
-
this.selectedItems = signal([], ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
|
|
1507
|
-
this.rf = effect(async () => {
|
|
1508
|
-
const rawValue = this.options()['dataSource'];
|
|
1509
|
-
// static datasource class
|
|
1510
|
-
if (rawValue instanceof AXDataSource) {
|
|
1511
|
-
this.dataSource.set(rawValue);
|
|
1512
|
-
}
|
|
1513
|
-
// static array datasource
|
|
1514
|
-
else if (Array.isArray(rawValue)) {
|
|
1515
|
-
const ds = new AXDataSource({
|
|
1516
|
-
key: this.valueField(),
|
|
1517
|
-
pageSize: 10,
|
|
1518
|
-
load: async (e) => {
|
|
1519
|
-
const raw = this.options()['dataSource'];
|
|
1520
|
-
return {
|
|
1521
|
-
items: raw,
|
|
1522
|
-
total: raw.length,
|
|
1523
|
-
};
|
|
1524
|
-
},
|
|
1525
|
-
byKey: (key) => {
|
|
1526
|
-
const raw = this.options()['dataSource'];
|
|
1527
|
-
const item = raw.filter((c) => c[this.valueField()] == key);
|
|
1528
|
-
return Promise.resolve(item[0]);
|
|
1529
|
-
},
|
|
1530
|
-
});
|
|
1531
|
-
this.dataSource.set(ds);
|
|
1532
|
-
}
|
|
1533
|
-
// resolve data source by name
|
|
1534
|
-
else if (rawValue && (typeof rawValue == 'string' || typeof rawValue == 'object')) {
|
|
1535
|
-
const id = typeof rawValue == 'object' ? rawValue['id'] : rawValue;
|
|
1536
|
-
const c = await this.dataService.get(id);
|
|
1537
|
-
if (this.mode == 'designer' && c?.samples?.length) {
|
|
1538
|
-
this.dataSource.set(convertArrayToDataSource(c.samples, {
|
|
1539
|
-
key: this.valueField(),
|
|
1540
|
-
pageSize: 500,
|
|
1541
|
-
}));
|
|
1542
|
-
}
|
|
1543
|
-
else {
|
|
1544
|
-
const ds = c?.source();
|
|
1545
|
-
if (ds && ds instanceof Promise) {
|
|
1546
|
-
const d = await ds;
|
|
1547
|
-
this.dataSource.set(d);
|
|
1548
|
-
}
|
|
1549
|
-
else if (ds) {
|
|
1550
|
-
this.dataSource.set(ds);
|
|
1551
|
-
}
|
|
1552
|
-
// empty datasource
|
|
1553
|
-
else {
|
|
1554
|
-
this.dataSource.set(convertArrayToDataSource([]));
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
// empty datasource
|
|
1559
|
-
else {
|
|
1560
|
-
this.dataSource.set(convertArrayToDataSource([]));
|
|
1561
|
-
}
|
|
1562
|
-
}, ...(ngDevMode ? [{ debugName: "rf" }] : []));
|
|
1563
|
-
this.effect2 = effect(async () => {
|
|
1564
|
-
const value = this.getValue();
|
|
1565
|
-
const items = [];
|
|
1566
|
-
if (Array.isArray(value)) {
|
|
1567
|
-
items.push(...await Promise.all(value.map((item) => this.extractItem(item))));
|
|
1568
|
-
}
|
|
1569
|
-
else {
|
|
1570
|
-
items.push(await this.extractItem(value));
|
|
1571
|
-
}
|
|
1572
|
-
this.selectedItems.set(items.filter((c) => c != null));
|
|
1573
|
-
}, ...(ngDevMode ? [{ debugName: "effect2" }] : []));
|
|
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
|
+
};
|
|
1574
1921
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
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
|
+
};
|
|
1944
|
+
}
|
|
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
|
+
};
|
|
1961
|
+
}
|
|
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
|
+
};
|
|
1990
|
+
}
|
|
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');
|
|
1581
2009
|
}
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
if (
|
|
1585
|
-
const
|
|
1586
|
-
if (
|
|
1587
|
-
|
|
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');
|
|
1588
2016
|
}
|
|
2017
|
+
yValue = parseFloat(secondMatch[1]);
|
|
1589
2018
|
}
|
|
1590
|
-
return
|
|
1591
|
-
|
|
1592
|
-
|
|
2019
|
+
return {
|
|
2020
|
+
values: {
|
|
2021
|
+
x: parseFloat(xValue),
|
|
2022
|
+
y: yValue,
|
|
2023
|
+
},
|
|
2024
|
+
unit,
|
|
1593
2025
|
};
|
|
1594
2026
|
}
|
|
1595
|
-
static
|
|
1596
|
-
|
|
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
|
+
}
|
|
1597
2040
|
}
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
this.options = this.token.options ?? {};
|
|
1606
|
-
this.rawValue = null;
|
|
1607
|
-
this.nullText = this.options['nullText'];
|
|
1608
|
-
this.nullValue = this.options['nullValue'];
|
|
1609
|
-
this.value = computed(() => {
|
|
1610
|
-
if (isNil(this.rawValue) && !isNil(this.nullValue)) {
|
|
1611
|
-
return this.nullValue;
|
|
1612
|
-
}
|
|
1613
|
-
return this.rawValue;
|
|
1614
|
-
}, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
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
|
+
}
|
|
1615
2048
|
}
|
|
1616
|
-
|
|
1617
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPColumnWidgetComponent }); }
|
|
2049
|
+
return nonEmptyBreakpoints;
|
|
1618
2050
|
}
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
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 = {}));
|
|
1622
2089
|
|
|
1623
2090
|
/**
|
|
1624
2091
|
* Generated bundle index. Do not edit.
|
|
1625
2092
|
*/
|
|
1626
2093
|
|
|
1627
|
-
export { AXPBaseWidgetComponent, AXPColumnWidgetComponent, AXPDataListWidgetComponent, AXPLayoutBuilderContextStore, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPLayoutContextChangeEvent, AXPLayoutElement,
|
|
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 };
|
|
1628
2095
|
//# sourceMappingURL=acorex-platform-layout-builder.mjs.map
|