@acorex/platform 19.1.2 → 19.1.4

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 (162) hide show
  1. package/common/index.d.ts +2 -0
  2. package/common/lib/app/application.types.d.ts +12 -10
  3. package/common/lib/configs/app.config.d.ts +0 -1
  4. package/common/lib/file-storage/file-storage.service.d.ts +13 -0
  5. package/common/lib/file-storage/file-storage.types.d.ts +143 -0
  6. package/common/lib/file-storage/index.d.ts +2 -0
  7. package/common/lib/filters/filters.service.d.ts +8 -0
  8. package/common/lib/filters/filters.types.d.ts +19 -0
  9. package/common/lib/filters/index.d.ts +2 -0
  10. package/common/lib/settings/setting-definition.provider.d.ts +13 -4
  11. package/common/lib/settings/setting.builder.d.ts +7 -8
  12. package/common/lib/settings/settings.provider.d.ts +2 -7
  13. package/common/lib/settings/settings.service.d.ts +19 -7
  14. package/common/lib/settings/settings.types.d.ts +15 -2
  15. package/core/utils/highlighter.d.ts +1 -1
  16. package/fesm2022/acorex-platform-auth.mjs +5 -4
  17. package/fesm2022/acorex-platform-auth.mjs.map +1 -1
  18. package/fesm2022/acorex-platform-common.mjs +264 -87
  19. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  20. package/fesm2022/acorex-platform-core.mjs +2 -2
  21. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  22. package/fesm2022/acorex-platform-layout-builder.mjs +286 -440
  23. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  24. package/fesm2022/acorex-platform-layout-designer.mjs +18 -18
  25. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  26. package/fesm2022/acorex-platform-layout-entity.mjs +335 -232
  27. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  28. package/fesm2022/acorex-platform-layout-filters.mjs +124 -0
  29. package/fesm2022/acorex-platform-layout-filters.mjs.map +1 -0
  30. package/fesm2022/acorex-platform-layout-setting.mjs +219 -132
  31. package/fesm2022/acorex-platform-layout-setting.mjs.map +1 -1
  32. package/fesm2022/acorex-platform-layouts.mjs +4 -5
  33. package/fesm2022/acorex-platform-layouts.mjs.map +1 -1
  34. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-K9B_-q_K.mjs +108 -0
  35. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-K9B_-q_K.mjs.map +1 -0
  36. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DAmHq1bt.mjs +369 -0
  37. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DAmHq1bt.mjs.map +1 -0
  38. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Cd2gxLZt.mjs +87 -0
  39. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Cd2gxLZt.mjs.map +1 -0
  40. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-6sZdw013.mjs +130 -0
  41. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-6sZdw013.mjs.map +1 -0
  42. package/fesm2022/acorex-platform-themes-default-setting-page.component-BYpCgHZb.mjs +74 -0
  43. package/fesm2022/acorex-platform-themes-default-setting-page.component-BYpCgHZb.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-themes-default-setting-view.component-CdmIphX1.mjs +73 -0
  45. package/fesm2022/acorex-platform-themes-default-setting-view.component-CdmIphX1.mjs.map +1 -0
  46. package/fesm2022/acorex-platform-themes-default.mjs +40 -114
  47. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  48. package/fesm2022/acorex-platform-themes-shared.mjs +465 -157
  49. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  50. package/fesm2022/{acorex-platform-widgets-checkbox-widget-column.component-05nKV-UV.mjs → acorex-platform-widgets-checkbox-widget-column.component-jeZBOEhl.mjs} +18 -14
  51. package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-jeZBOEhl.mjs.map +1 -0
  52. package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-juhKoygA.mjs → acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs} +5 -5
  53. package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs.map +1 -0
  54. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-DU1niJES.mjs +64 -0
  55. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-DU1niJES.mjs.map +1 -0
  56. package/fesm2022/{acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs → acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs} +4 -4
  57. package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs.map +1 -0
  58. package/fesm2022/acorex-platform-widgets.mjs +1396 -286
  59. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  60. package/fesm2022/acorex-platform-workflow.mjs +9 -3
  61. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  62. package/layout/builder/lib/builder/builder.module.d.ts +6 -7
  63. package/layout/builder/lib/builder/builder.service.d.ts +9 -10
  64. package/layout/builder/lib/builder/context-store.service.d.ts +33 -0
  65. package/layout/builder/lib/builder/index.d.ts +4 -2
  66. package/layout/builder/lib/builder/widget-catalog.d.ts +1 -1
  67. package/layout/builder/lib/builder/widget-container.component.d.ts +34 -9
  68. package/layout/builder/lib/builder/widget-groups.d.ts +1 -0
  69. package/layout/builder/lib/builder/widget-map.d.ts +43 -0
  70. package/layout/builder/lib/builder/{widget-renderer.component.directive.d.ts → widget-renderer.directive.d.ts} +29 -4
  71. package/layout/builder/lib/builder/widget-status.types.d.ts +14 -0
  72. package/layout/builder/lib/builder/widget.types.d.ts +51 -59
  73. package/layout/designer/lib/preview/preview-viewer.component.d.ts +2 -2
  74. package/layout/designer/lib/property-viewer/widget-property-viewer.component.d.ts +2 -2
  75. package/layout/entity/lib/entity-master-list.viewmodel.d.ts +8 -2
  76. package/layout/entity/lib/widgets/lookup-widget/lookup-widget-edit.component.d.ts +0 -1
  77. package/layout/entity/lib/workflows/modify-entity.workflow.d.ts +14 -0
  78. package/layout/filters/README.md +3 -0
  79. package/layout/filters/index.d.ts +1 -0
  80. package/layout/filters/lib/filters.viewmodel.d.ts +30 -0
  81. package/layout/setting/lib/convert-setting-data.d.ts +0 -20
  82. package/layout/setting/lib/setting.viewmodel.d.ts +85 -22
  83. package/layouts/lib/admin/entity-layout/entity-details-view/entity-details-view.component.d.ts +15 -5
  84. package/package.json +13 -9
  85. package/themes/default/index.d.ts +0 -1
  86. package/themes/default/lib/layouts/base/simple-page/simple-page.layout.d.ts +20 -10
  87. package/themes/default/lib/layouts/entity-layouts/entity-detail-list-view/entity-detail-list-view.component.d.ts +15 -5
  88. package/themes/default/lib/layouts/entity-layouts/entity-master-create-view/entity-master-create-view.component.d.ts +2 -1
  89. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +17 -6
  90. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/list-view-option-filters/list-view-option-filters.component.d.ts +14 -0
  91. package/themes/default/lib/layouts/entity-layouts/entity-master-modify-view/entity-master-modify-view.component.d.ts +2 -1
  92. package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +15 -5
  93. package/themes/default/lib/layouts/filters-layout/simple-filter-builder/filters-view.component.d.ts +13 -0
  94. package/themes/default/lib/layouts/root-layout/components/header/header.component.d.ts +15 -5
  95. package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +15 -5
  96. package/themes/default/lib/layouts/setting-layout/setting-page/setting-page.component.d.ts +2 -4
  97. package/themes/default/lib/layouts/setting-layout/setting-view/setting-view.component.d.ts +57 -0
  98. package/themes/shared/index.d.ts +3 -1
  99. package/themes/shared/lib/components/layout-elements/index.d.ts +5 -3
  100. package/themes/shared/lib/components/layout-elements/{layout-page-actions.component.d.ts → layout-actions.component.d.ts} +5 -5
  101. package/themes/shared/lib/components/layout-elements/layout-blocks.component.d.ts +1 -1
  102. package/themes/shared/lib/components/layout-elements/layout-header.component.d.ts +12 -0
  103. package/themes/shared/lib/components/layout-elements/layout-list-component.d.ts +13 -0
  104. package/themes/shared/lib/components/layout-elements/layout-section.component.d.ts +9 -0
  105. package/themes/shared/lib/components/layout-elements/layout-side.component.d.ts +9 -0
  106. package/themes/shared/lib/components/theme-slot.component.d.ts +23 -13
  107. package/themes/shared/lib/palette.provider.d.ts +9 -0
  108. package/themes/shared/lib/setting.keys.d.ts +7 -2
  109. package/themes/shared/lib/setting.provider.d.ts +1 -0
  110. package/themes/shared/lib/shared.module.d.ts +5 -2
  111. package/themes/shared/lib/{services/theme.service.d.ts → theme.service.d.ts} +16 -24
  112. package/themes/shared/lib/theme.types.d.ts +25 -0
  113. package/themes/shared/lib/widgets/theme-color-selection/index.d.ts +2 -0
  114. package/themes/shared/lib/widgets/theme-color-selection/theme-color-selection-widget-edit.component.d.ts +6 -0
  115. package/themes/shared/lib/widgets/theme-color-selection/theme-color-selection-widget.config.d.ts +7 -0
  116. package/widgets/lib/properties/editors.props.d.ts +2 -0
  117. package/widgets/lib/properties/layout.props.d.ts +1 -0
  118. package/widgets/lib/widgets/advance/avatar/avatar-widget-column.component.d.ts +6 -0
  119. package/widgets/lib/widgets/advance/avatar/avatar-widget-designer.component.d.ts +6 -0
  120. package/widgets/lib/widgets/advance/avatar/avatar-widget-edit.component.d.ts +18 -0
  121. package/widgets/lib/widgets/advance/avatar/avatar-widget-print.component.d.ts +6 -0
  122. package/widgets/lib/widgets/advance/avatar/avatar-widget-view.component.d.ts +6 -0
  123. package/widgets/lib/widgets/advance/avatar/avatar-widget.config.d.ts +7 -0
  124. package/widgets/lib/widgets/advance/avatar/index.d.ts +6 -0
  125. package/widgets/lib/widgets/advance/map/map-box-widget-edit.component.d.ts +9 -5
  126. package/widgets/lib/widgets/advance/map/map-box-widget-view.component.d.ts +6 -4
  127. package/widgets/lib/widgets/editors/number/number-box-widget-edit.component.d.ts +1 -7
  128. package/widgets/lib/widgets/editors/select/select-box-widget-edit.component.d.ts +1 -0
  129. package/widgets/lib/widgets/editors/toggle/toggle-widget-edit.component.d.ts +0 -2
  130. package/widgets/lib/widgets/filters/operations/operations.component.d.ts +9 -0
  131. package/widgets/lib/widgets/filters/string-filter/index.d.ts +2 -0
  132. package/widgets/lib/widgets/filters/string-filter/string-filter-widget-edit.component.d.ts +11 -0
  133. package/widgets/lib/widgets/filters/string-filter/string-filter-widget.config.d.ts +7 -0
  134. package/widgets/lib/widgets/index.d.ts +5 -1
  135. package/widgets/lib/widgets/property-editors/border/border-widget-editor.component.d.ts +29 -6
  136. package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget-editor.component.d.ts +31 -0
  137. package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget.config.d.ts +7 -0
  138. package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget.type.d.ts +15 -0
  139. package/widgets/lib/widgets/property-editors/flex-options/index.d.ts +3 -0
  140. package/widgets/lib/widgets/property-editors/property-editor-helper.d.ts +72 -0
  141. package/widgets/lib/widgets/property-editors/property-editor.type.d.ts +35 -0
  142. package/widgets/lib/widgets/property-editors/spacing/index.d.ts +0 -1
  143. package/widgets/lib/widgets/property-editors/spacing/spacing-widget-editor.component.d.ts +20 -7
  144. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-B13KvLX4.mjs +0 -108
  145. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-B13KvLX4.mjs.map +0 -1
  146. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-B6MXHPWi.mjs +0 -305
  147. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-B6MXHPWi.mjs.map +0 -1
  148. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-tKCGSRQT.mjs +0 -87
  149. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-tKCGSRQT.mjs.map +0 -1
  150. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-CHvC0IAV.mjs +0 -130
  151. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-CHvC0IAV.mjs.map +0 -1
  152. package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-05nKV-UV.mjs.map +0 -1
  153. package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-juhKoygA.mjs.map +0 -1
  154. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-BkWcZ4K9.mjs +0 -72
  155. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-BkWcZ4K9.mjs.map +0 -1
  156. package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs.map +0 -1
  157. package/layout/builder/lib/builder/widget-renderer.component.d.ts +0 -48
  158. package/themes/default/lib/layouts/setting-layout/index.d.ts +0 -1
  159. package/themes/shared/lib/components/layout-elements/layout-page-header.component.d.ts +0 -11
  160. package/themes/shared/lib/components/layout-elements/layout-page-side.component.d.ts +0 -5
  161. package/widgets/lib/widgets/property-editors/border/border-widget-type.d.ts +0 -18
  162. package/widgets/lib/widgets/property-editors/spacing/spacing-widget-type.d.ts +0 -10
@@ -1,16 +1,39 @@
1
- import * as i3 from '@acorex/components/skeleton';
2
1
  import { AXSkeletonModule } from '@acorex/components/skeleton';
3
- import * as i2 from '@angular/cdk/portal';
4
- import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
2
+ import { PortalModule } from '@angular/cdk/portal';
5
3
  import * as i1 from '@angular/common';
6
4
  import { CommonModule } from '@angular/common';
7
5
  import * as i0 from '@angular/core';
8
- import { signal, Injectable, InjectionToken, inject, ElementRef, afterNextRender, computed, effect, Injector, Component, ChangeDetectionStrategy, Input, EventEmitter, model, Output, ChangeDetectorRef, ViewChild, input, ViewContainerRef, Directive, NgModule, Optional, Inject } from '@angular/core';
9
- import { AXUnsubscriber } from '@acorex/core/utils';
10
- import { set, get, isEqual, clone, merge, cloneDeep, isNil, isUndefined, sum } from 'lodash-es';
11
- import { Subject, debounceTime, filter } from 'rxjs';
12
- import { convertArrayToDataSource, AXDataSource } from '@acorex/components/common';
6
+ import { signal, computed, Injectable, inject, EventEmitter, effect, Component, ChangeDetectionStrategy, Output, Input, InjectionToken, ElementRef, Injector, ChangeDetectorRef, ViewChild, input, ViewContainerRef, Directive, NgModule, Optional, Inject } from '@angular/core';
7
+ import { set, cloneDeep, get, isEqual, merge, isNil, isUndefined, sum } from 'lodash-es';
8
+ import { Subject, BehaviorSubject, filter } from 'rxjs';
9
+ import { signalStore, withState, withComputed, withMethods, patchState } from '@ngrx/signals';
13
10
  import { AXDataTableColumnComponent, AXBaseDataTable } from '@acorex/components/data-table';
11
+ import { convertArrayToDataSource, AXDataSource } from '@acorex/components/common';
12
+ import { AXUnsubscriber } from '@acorex/core/utils';
13
+
14
+ var AXPPageStatus;
15
+ (function (AXPPageStatus) {
16
+ // Rendering statuses
17
+ AXPPageStatus["Rendering"] = "rendering";
18
+ AXPPageStatus["Rendered"] = "rendered";
19
+ // Processing statuses
20
+ AXPPageStatus["Processing"] = "processing";
21
+ // Submission statuses
22
+ AXPPageStatus["Submitting"] = "submitting";
23
+ AXPPageStatus["Submitted"] = "submitted";
24
+ // Error handling
25
+ AXPPageStatus["Error"] = "error";
26
+ })(AXPPageStatus || (AXPPageStatus = {}));
27
+ var AXPWidgetStatus;
28
+ (function (AXPWidgetStatus) {
29
+ // Rendering statuses
30
+ AXPWidgetStatus["Rendering"] = "rendering";
31
+ AXPWidgetStatus["Rendered"] = "rendered";
32
+ // Processing statuses
33
+ AXPWidgetStatus["Processing"] = "processing";
34
+ // Error handling
35
+ AXPWidgetStatus["Error"] = "error";
36
+ })(AXPWidgetStatus || (AXPWidgetStatus = {}));
14
37
 
15
38
  class AXPLayoutElement {
16
39
  api() {
@@ -19,15 +42,15 @@ class AXPLayoutElement {
19
42
  }
20
43
  class AXPLayoutBuilderService {
21
44
  constructor() {
22
- this.context$ = signal({});
23
45
  this.variables$ = signal({});
24
46
  this.functions$ = signal({});
25
- this.onChanged = new Subject();
26
47
  this.onRefresh = new Subject();
27
- this.debouncers = {};
28
- this.debouncerSubscriptions = {};
29
48
  this.widgets = new Map();
30
- this.context = this.context$.asReadonly();
49
+ this.status$ = signal(AXPPageStatus.Rendering);
50
+ this.status = this.status$.asReadonly();
51
+ this.isBusy = computed(() => {
52
+ return [AXPPageStatus.Processing, AXPPageStatus.Submitting, AXPPageStatus.Rendering].includes(this.status());
53
+ });
31
54
  }
32
55
  get variables() {
33
56
  return this.variables$();
@@ -35,15 +58,36 @@ class AXPLayoutBuilderService {
35
58
  get functions() {
36
59
  return this.functions$();
37
60
  }
38
- initial(value) {
39
- this.context$.set(value);
40
- this.refresh();
61
+ updateStatus() {
62
+ this.status$.update(() => this.detectStatus());
63
+ }
64
+ detectStatus() {
65
+ const statuses = Array.from(this.widgets.values()).map(c => c.status());
66
+ // Rendering statuses
67
+ if (statuses.some((status) => status === AXPWidgetStatus.Rendering)) {
68
+ return AXPPageStatus.Rendering;
69
+ }
70
+ if (statuses.every((status) => status === AXPWidgetStatus.Rendered)) {
71
+ return AXPPageStatus.Rendered;
72
+ }
73
+ // Processing statuses
74
+ if (statuses.some((status) => status === AXPWidgetStatus.Processing)) {
75
+ return AXPPageStatus.Processing;
76
+ }
77
+ // Error handling
78
+ if (statuses.some((status) => status === AXPWidgetStatus.Error)) {
79
+ return AXPPageStatus.Error;
80
+ }
81
+ return AXPPageStatus.Rendered; // Default to Loaded when all widgets are in a completed state
41
82
  }
42
83
  refresh() {
43
84
  setTimeout(() => {
44
85
  this.onRefresh.next();
45
86
  }, 0);
46
87
  }
88
+ setStatus(status) {
89
+ this.status$.set(status);
90
+ }
47
91
  setVariables(...args) {
48
92
  if (args.length == 0)
49
93
  return;
@@ -62,49 +106,13 @@ class AXPLayoutBuilderService {
62
106
  this.functions$.update((v) => set(v, args[0], args[1]));
63
107
  }
64
108
  }
65
- setValue(path, value, init = false) {
66
- const oldValue = get(this.context$(), path);
67
- if (isEqual(oldValue, value)) {
68
- return;
69
- }
70
- if (!this.debouncers[path]) {
71
- // Create a new Subject for debouncing if it doesn't exist
72
- this.debouncers[path] = new Subject();
73
- // Subscribe to the subject with debounceTime
74
- this.debouncerSubscriptions[path] = this.debouncers[path].pipe(debounceTime(150)).subscribe(({ value, init }) => {
75
- // Only emit onChanged event after debounce time
76
- this.onChanged.next({
77
- oldValue: oldValue,
78
- newValue: value,
79
- data: this.context(),
80
- path,
81
- init,
82
- });
83
- });
84
- }
85
- // Update context immediately
86
- this.context$.update((ctx) => set(clone(ctx), path, value));
87
- // Emit value through the debouncer subject
88
- this.debouncers[path].next({ path, value, init });
89
- }
90
- getValue(path) {
91
- return get(this.context(), path);
92
- }
93
109
  registerWidget(id, widget) {
94
110
  this.widgets.set(id, widget);
95
111
  }
96
112
  getWidget(id) {
97
113
  return this.widgets.get(id);
98
114
  }
99
- unsubscribeDebouncers() {
100
- Object.keys(this.debouncerSubscriptions).forEach((path) => {
101
- this.debouncerSubscriptions[path].unsubscribe();
102
- delete this.debouncerSubscriptions[path]; // Clean up the reference
103
- delete this.debouncers[path]; // Also clean up the debouncer subject
104
- });
105
- }
106
115
  ngOnDestroy() {
107
- this.unsubscribeDebouncers();
108
116
  }
109
117
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLayoutBuilderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
110
118
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLayoutBuilderService }); }
@@ -113,6 +121,145 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
113
121
  type: Injectable
114
122
  }] });
115
123
 
124
+ class AXPLayoutContextChangeEvent {
125
+ }
126
+ const AXPLayoutBuilderContextStore = signalStore(
127
+ // Initial State
128
+ withState(() => ({
129
+ data: {}, // Shared context data
130
+ state: 'initiated', // Current state
131
+ initialSnapshot: {}, // Snapshot of the first initialized state
132
+ previousSnapshot: {}, // Snapshot of the previous state
133
+ lastChange: {
134
+ state: 'initiated',
135
+ }, // Last change event
136
+ })),
137
+ // Computed Signals
138
+ withComputed(({ data, state, lastChange, initialSnapshot, previousSnapshot }) => ({
139
+ isChanged: computed(() => state() === 'changed'),
140
+ isReset: computed(() => state() === 'restored'),
141
+ isInitiated: computed(() => state() === 'initiated'),
142
+ isEmpty: computed(() => Object.keys(data()).length === 0),
143
+ snapshot: computed(() => cloneDeep(data())), // Current data snapshot
144
+ initial: computed(() => cloneDeep(initialSnapshot())), // Initial snapshot
145
+ previous: computed(() => cloneDeep(previousSnapshot())), // Previous snapshot
146
+ changeEvent: computed(() => lastChange()), // Reactive last change event
147
+ })),
148
+ // Methods for State Management
149
+ withMethods((store) => ({
150
+ // Update a specific value
151
+ update(path, value) {
152
+ const currentData = cloneDeep(store.data());
153
+ const oldValue = get(currentData, path);
154
+ // Skip if the value hasn't changed
155
+ if (isEqual(oldValue, value)) {
156
+ return;
157
+ }
158
+ // Update the value and prepare the change event
159
+ const updatedData = set(currentData, path, value);
160
+ const changeEvent = {
161
+ oldValue,
162
+ newValue: value,
163
+ path,
164
+ state: 'changed',
165
+ data: updatedData,
166
+ };
167
+ // Patch the state
168
+ patchState(store, {
169
+ previousSnapshot: store.snapshot(), // Save the previous state
170
+ data: updatedData,
171
+ state: 'changed',
172
+ lastChange: changeEvent,
173
+ });
174
+ },
175
+ // Reset to the initial state
176
+ reset() {
177
+ const initialData = store.initial();
178
+ const changeEvent = {
179
+ oldValue: cloneDeep(store.data()), // Current data becomes old value
180
+ newValue: cloneDeep(initialData), // Reset to the initial state
181
+ path: '',
182
+ state: 'restored',
183
+ data: initialData,
184
+ };
185
+ patchState(store, {
186
+ previousSnapshot: store.snapshot(), // Save the previous state
187
+ data: initialData,
188
+ state: 'restored',
189
+ lastChange: changeEvent,
190
+ });
191
+ },
192
+ // Initialize the state
193
+ set(initialData) {
194
+ const currentData = store.data();
195
+ if (isEqual(currentData, initialData)) {
196
+ return; // Skip if the current state matches the initial state
197
+ }
198
+ const changeEvent = {
199
+ oldValue: null,
200
+ newValue: cloneDeep(initialData),
201
+ path: '',
202
+ state: 'initiated',
203
+ data: initialData,
204
+ };
205
+ patchState(store, {
206
+ initialSnapshot: cloneDeep(initialData), // Save the initial state
207
+ previousSnapshot: store.snapshot(), // Save the current state as the previous
208
+ data: initialData,
209
+ state: 'initiated',
210
+ lastChange: changeEvent,
211
+ });
212
+ },
213
+ // Get a specific value
214
+ getValue(path) {
215
+ return get(store.data(), path);
216
+ },
217
+ })));
218
+
219
+ class AXPWidgetContainerComponent {
220
+ set context(value) {
221
+ this.contextService.set(value);
222
+ }
223
+ set functions(v) {
224
+ this.builderService.setFunctions(v);
225
+ }
226
+ constructor() {
227
+ this.contextService = inject(AXPLayoutBuilderContextStore);
228
+ this.builderService = inject(AXPLayoutBuilderService);
229
+ this.onContextChanged = new EventEmitter();
230
+ this.status = computed(() => {
231
+ return this.builderService.status();
232
+ });
233
+ this.isBusy = computed(() => {
234
+ return this.builderService.isBusy();
235
+ });
236
+ effect(() => {
237
+ if (this.contextService.isChanged()) {
238
+ this.onContextChanged.emit(this.contextService.changeEvent());
239
+ }
240
+ });
241
+ }
242
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPWidgetContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
243
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", 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 }); }
244
+ }
245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPWidgetContainerComponent, decorators: [{
246
+ type: Component,
247
+ args: [{
248
+ selector: 'axp-widgets-container',
249
+ template: `<ng-content></ng-content>`,
250
+ changeDetection: ChangeDetectionStrategy.OnPush,
251
+ host: { style: 'display: contents;' },
252
+ providers: [AXPLayoutBuilderService, AXPLayoutBuilderContextStore],
253
+ standalone: false,
254
+ }]
255
+ }], ctorParameters: () => [], propDecorators: { onContextChanged: [{
256
+ type: Output
257
+ }], context: [{
258
+ type: Input
259
+ }], functions: [{
260
+ type: Input
261
+ }] } });
262
+
116
263
  class AXPWidgetRegistryService {
117
264
  constructor() {
118
265
  this.types = new Map();
@@ -209,8 +356,26 @@ const AXPWidgetsCatalog = {
209
356
  cronJob: 'cron-job',
210
357
  spacing: 'spacing',
211
358
  border: 'border',
359
+ avatar: 'avatar',
360
+ stringFilter: 'string-filter',
361
+ themeColorSelection: 'theme-color-selection',
362
+ flexOptions: 'flex-options',
212
363
  };
213
364
 
365
+ function objectKeyValueTransforms(keyName) {
366
+ return {
367
+ getter: (value) => {
368
+ if (isNil(value))
369
+ return undefined;
370
+ return typeof value == 'object' ? value[keyName] : value;
371
+ },
372
+ setter: (value) => {
373
+ if (isNil(value))
374
+ return undefined;
375
+ return typeof value == 'object' ? value[keyName] : value;
376
+ },
377
+ };
378
+ }
214
379
  function cloneProperty(property, values) {
215
380
  return merge(cloneDeep(property), values);
216
381
  }
@@ -288,22 +453,16 @@ class AXPWidgetComponent extends AXPLayoutElement {
288
453
  this.children = this._children.asReadonly();
289
454
  this._options = signal(this.token.options ?? {});
290
455
  this.options = this._options.asReadonly();
291
- this.contextService = inject(AXPLayoutBuilderService);
292
- this.onReady = new Subject();
293
- this.isRendered = false;
456
+ this.layoutService = inject(AXPLayoutBuilderService);
457
+ this.contextService = inject(AXPLayoutBuilderContextStore);
294
458
  this._isValueWidget = false;
295
459
  this.isValueWidget = () => this._isValueWidget;
460
+ this._status = signal(AXPWidgetStatus.Rendering);
461
+ this.status = this._status.asReadonly();
462
+ this.onStatusChanged = new BehaviorSubject(this._status());
463
+ this.#statusEffect = effect(() => { this.onStatusChanged.next(this.status()); });
464
+ this.isBusy = computed(() => [AXPWidgetStatus.Rendering, AXPWidgetStatus.Processing].includes(this.status()));
296
465
  this.fullPath = signal(null);
297
- this.nextRender = afterNextRender(() => {
298
- //
299
- if (!this.isRendered) {
300
- this.detectFullPath();
301
- //
302
- this.onReady.next();
303
- //
304
- this.isRendered = true;
305
- }
306
- });
307
466
  this.getValue = computed(() => {
308
467
  return this.fullPath() ? this.extractValue(this.fullPath()) : null;
309
468
  });
@@ -311,30 +470,32 @@ class AXPWidgetComponent extends AXPLayoutElement {
311
470
  get id() {
312
471
  return this._id;
313
472
  }
314
- ngOnInit() {
315
- this.initRender();
473
+ #statusEffect;
474
+ outputs() {
475
+ return [];
316
476
  }
317
- initRender() {
477
+ ngOnInit() {
318
478
  this._isValueWidget = this.config.properties?.some((c) => c.name == 'path') ?? false;
319
479
  if (this.isValueWidget()) {
320
480
  this.detectFullPath();
321
481
  if (!isNil(this.defaultValue) && isNil(this.getValue())) {
322
- this.setValue(this.defaultValue, true);
482
+ this.setValue(this.defaultValue);
323
483
  }
324
484
  }
325
485
  //
326
486
  if (get(this.node, '__meta__.added')) {
327
487
  this.onAdded();
328
488
  }
489
+ this.setStatus(AXPWidgetStatus.Rendered);
329
490
  }
330
491
  extractValue(path) {
331
- const rawValue = get(this.contextService.context(), path);
492
+ const rawValue = this.contextService.getValue(path);
332
493
  if (this.node.valueTransforms?.getter) {
333
494
  return this.node.valueTransforms?.getter(rawValue);
334
495
  }
335
496
  return rawValue;
336
497
  }
337
- setValue(value, init = false) {
498
+ setValue(value) {
338
499
  if (this.node.valueTransforms?.setter) {
339
500
  value = this.node.valueTransforms?.setter(value);
340
501
  }
@@ -347,13 +508,25 @@ class AXPWidgetComponent extends AXPLayoutElement {
347
508
  return;
348
509
  }
349
510
  if (this.fullPath()) {
350
- this.contextService.setValue(this.fullPath(), value, init);
511
+ this.contextService.update(this.fullPath(), value);
351
512
  }
352
- this.onValueChanged(oldValue, value);
513
+ }
514
+ setStatus(status) {
515
+ this._status.set(status);
516
+ this.layoutService.updateStatus();
353
517
  }
354
518
  setOptions(values) {
355
519
  this._options.set({ ...this.options(), ...values });
356
520
  }
521
+ output(name) {
522
+ if (this.outputs().includes(name)) {
523
+ const opt = get(this, name);
524
+ if (typeof opt == 'function') {
525
+ return opt();
526
+ }
527
+ }
528
+ return null;
529
+ }
357
530
  call(name, ...args) {
358
531
  const fn = get(this, name);
359
532
  if (fn && typeof fn == 'function') {
@@ -363,7 +536,6 @@ class AXPWidgetComponent extends AXPLayoutElement {
363
536
  setChildren(children) {
364
537
  this._children.set([...children]);
365
538
  }
366
- onValueChanged(oldValue, newValue) { }
367
539
  onAdded() { }
368
540
  detectFullPath() {
369
541
  const sections = [];
@@ -393,7 +565,7 @@ class AXPWidgetComponent extends AXPLayoutElement {
393
565
  this.fullPath.set(sections.reverse().join('.'));
394
566
  this._id = this.name || this.parent ? ids.reverse().join('_') : null;
395
567
  if (this._id) {
396
- this.contextService.registerWidget(this._id, this);
568
+ this.layoutService.registerWidget(this._id, this);
397
569
  }
398
570
  }
399
571
  handleValueChanged(e) {
@@ -412,9 +584,9 @@ class AXPDataListWidgetComponent extends AXPWidgetComponent {
412
584
  super(...arguments);
413
585
  this.dataService = inject(AXPWidgetDataSourceProviderService);
414
586
  this.dataSource = signal(convertArrayToDataSource([]));
415
- //protected items = computed<any[]>(() => this.options()['items'] ?? []);
416
587
  this.textField = computed(() => this.options()['textField'] ?? 'title');
417
588
  this.valueField = computed(() => this.options()['valueField'] ?? 'id');
589
+ this.selectedItems = signal([]);
418
590
  this.rf = effect(() => {
419
591
  const rawValue = this.options()['dataSource'];
420
592
  // static datasource class
@@ -433,7 +605,7 @@ class AXPDataListWidgetComponent extends AXPWidgetComponent {
433
605
  if (this.mode == 'designer' && c?.samples?.length) {
434
606
  this.dataSource.set(convertArrayToDataSource(c.samples, {
435
607
  key: this.valueField(),
436
- pageSize: 100,
608
+ pageSize: 500,
437
609
  }));
438
610
  }
439
611
  else {
@@ -474,358 +646,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
474
646
  type: Injectable
475
647
  }] });
476
648
 
477
- class AXPWidgetRendererComponent {
478
- get node() {
479
- return this._node;
480
- }
481
- set node(v) {
482
- this._node = v;
483
- this.loadComponent();
484
- }
485
- get mode() {
486
- return this._mode;
487
- }
488
- set mode(v) {
489
- this._mode = v;
490
- }
491
- constructor() {
492
- this._mode = 'edit';
493
- this.mergedOptions = signal({});
494
- this.injector = inject(Injector);
495
- this.builderService = inject(AXPLayoutBuilderService);
496
- this.widgetRegistery = inject(AXPWidgetRegistryService);
497
- this.unsubscriber = inject(AXUnsubscriber);
498
- this.isLoading = signal(true);
499
- this.expressionCache = new Map();
500
- this.expressionEvaluators = new Map();
501
- this.scope = null;
502
- this.builderService.onChanged.pipe(this.unsubscriber.takeUntilDestroy).subscribe(async (e) => {
503
- if ((await this.updateOptionsBasedOnContext()) > 0) {
504
- this.applyOptions();
505
- }
506
- if (this.checkFormulaForUpdate(this.node.formula, e.path)) {
507
- await this.updateValueBasedOnFormula();
508
- }
509
- });
510
- }
511
- async loadComponent() {
512
- this.isLoading.set(true);
513
- const widget = this.widgetRegistery.resolve(this.node.type);
514
- //
515
- const props = widget?.components[this.mode]?.properties
516
- ?.filter((c) => c.schema.defaultValue != null)
517
- .map((c) => ({ [c.name]: c.schema.defaultValue }))
518
- .reduce((acc, curr) => {
519
- return { ...acc, ...curr };
520
- }, {});
521
- //
522
- this.mergedOptions.set(merge(props, this.node.options) || {});
523
- this.preprocessAndInitialOptions(cloneDeep(this.node.options));
524
- await this.updateOptionsBasedOnContext();
525
- const tokenValue = {
526
- node: this.node,
527
- options: this.mergedOptions(),
528
- config: widget,
529
- };
530
- const token = Injector.create({
531
- parent: this.injector,
532
- providers: [
533
- {
534
- provide: AXP_WIDGET_TOKEN,
535
- useValue: tokenValue,
536
- },
537
- ],
538
- });
539
- var com = await widget?.components[this.mode]?.component();
540
- this.portal = new ComponentPortal(com, null, token);
541
- this.isLoading.set(false);
542
- }
543
- async handleAttached(portalOutletRef) {
544
- portalOutletRef = portalOutletRef;
545
- this.instance = portalOutletRef.instance;
546
- this.instance.parent = this.parentNode;
547
- this.instance.index = this.index;
548
- this.instance.mode = this.mode;
549
- await this.updateValueBasedOnFormula();
550
- await this.assignTriggers();
551
- }
552
- applyOptions() {
553
- if (!this.instance)
554
- return;
555
- this.instance.setOptions(this.mergedOptions());
556
- }
557
- checkFormulaForUpdate(formula, path) {
558
- if (formula) {
559
- const regex = /context\.eval\('([^']+)'\)/g;
560
- const matches = formula.match(regex);
561
- const nodes = matches ? matches.map((match) => match.match(/'([^']+)'/)[1]) : [];
562
- return nodes.includes(path);
563
- }
564
- else
565
- return false;
566
- }
567
- preprocessAndInitialOptions(obj, pathPrefix = '') {
568
- if (!obj)
569
- return;
570
- Object.entries(obj).forEach(([key, value]) => {
571
- const currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;
572
- if (typeof value === 'string' && value.includes('{{')) {
573
- // Cache dynamic expression for later evaluation
574
- this.expressionEvaluators.set(currentPath, () => this.evaluateExpression(value));
575
- }
576
- else if (typeof value === 'object' &&
577
- value !== null &&
578
- (value.constructor === Object || Array.isArray(value))) {
579
- // Recursively handle nested objects
580
- this.preprocessAndInitialOptions(value, currentPath);
581
- }
582
- else {
583
- // Apply static values directly
584
- this.mergedOptions.update((currentOptions) => {
585
- return set(currentOptions, currentPath, value);
586
- });
587
- }
588
- });
589
- }
590
- async updateOptionsBasedOnContext() {
591
- const updates = [];
592
- for (let [path, evaluator] of this.expressionEvaluators) {
593
- const newValue = await evaluator();
594
- updates.push({ path, newValue });
595
- }
596
- // Apply updates to mergedOptions
597
- if (updates.length > 0) {
598
- this.mergedOptions.update((o) => {
599
- const updatedOptions = { ...o };
600
- updates.forEach(({ path, newValue }) => {
601
- // Set the new value in the updatedOptions object by path
602
- set(updatedOptions, path, newValue); // Assuming 'set' can handle paths like 'property.subproperty'
603
- });
604
- return updatedOptions;
605
- });
606
- }
607
- return updates.length;
608
- }
609
- async updateValueBasedOnFormula() {
610
- if (this.node.formula) {
611
- const value = await this.evaluateExpression(this.node.formula);
612
- this.instance.setValue(value);
613
- }
614
- }
615
- async evaluateExpression(templateExpression) {
616
- try {
617
- // Check cache first, but cache the function for evaluation, not the evaluated value
618
- if (!this.expressionCache.has(templateExpression)) {
619
- const expressionMatch = templateExpression.match(/\{\{\s*(.*?)\s*\}\}/);
620
- if (!expressionMatch) {
621
- throw Error(`No valid expression found in "${templateExpression}"`);
622
- }
623
- const expression = expressionMatch[1];
624
- // Cache the evaluation function instead of the result
625
- const scope = this.getGlobalScope();
626
- const evaluationFunction = async () => {
627
- const sandbox = new Function('scope', `with (scope) { return (async function() { return ${expression}; })(); }`);
628
- return await sandbox(scope);
629
- };
630
- this.expressionCache.set(templateExpression, evaluationFunction);
631
- }
632
- // Retrieve the function from the cache and call it to evaluate the expression
633
- const evaluate = this.expressionCache.get(templateExpression);
634
- if (evaluate) {
635
- const result = await evaluate();
636
- return result;
637
- }
638
- else {
639
- throw Error(`Failed to retrieve evaluation function for expression: "${templateExpression}"`);
640
- }
641
- }
642
- catch (error) {
643
- console.error('Error evaluating expression:', error);
644
- return false;
645
- }
646
- }
647
- getGlobalScope() {
648
- if (this.scope)
649
- return this.scope;
650
- this.scope = {};
651
- set(this.scope, 'context', this.getContextScope());
652
- set(this.scope, 'events', this.getEventScope());
653
- set(this.scope, 'widget', this.getWidgetScope());
654
- set(this.scope, 'methods', this.getFunctionScope());
655
- set(this.scope, 'vars', this.getVariablesScope());
656
- return this.scope;
657
- }
658
- getContextScope() {
659
- const scope = {};
660
- set(scope, 'eval', (path) => this.builderService.getValue(path));
661
- return scope;
662
- }
663
- getEventScope() {
664
- const scope = {};
665
- set(scope, 'context', (path) => this.builderService.onChanged.pipe(filter((c) => c.path == path)));
666
- set(scope, 'from', (event) => get(this.instance.api(), event));
667
- return scope;
668
- }
669
- getWidgetScope() {
670
- const scope = {};
671
- set(scope, 'call', (name, ...args) => {
672
- this.instance.call(name, ...args);
673
- });
674
- set(scope, 'find', (id) => {
675
- return this.builderService.getWidget(id)?.api();
676
- });
677
- return scope;
678
- }
679
- getFunctionScope() {
680
- const scope = {};
681
- set(scope, 'sum', (values) => {
682
- return sum(values);
683
- });
684
- Object.entries(this.builderService.functions).forEach((i) => {
685
- set(scope, i[0], (...args) => {
686
- return i[1](...args);
687
- });
688
- });
689
- return scope;
690
- }
691
- getVariablesScope() {
692
- const scope = {};
693
- set(scope, 'eval', (path) => get(this.builderService.variables, path));
694
- return scope;
695
- }
696
- async assignTriggers() {
697
- this.node.triggers?.forEach((t) => {
698
- const event = this.evaluateTrigger(t.event);
699
- event?.pipe(this.unsubscriber.takeUntilDestroy).subscribe((c) => {
700
- this.evaluateAction(t.action);
701
- });
702
- });
703
- }
704
- evaluateTrigger(templateExpression) {
705
- try {
706
- const expressionMatch = templateExpression.match(/\{\{\s*(.*?)\s*\}\}/);
707
- if (!expressionMatch) {
708
- throw Error(`No valid expression found in "${templateExpression}"`);
709
- }
710
- const expression = expressionMatch[1];
711
- // Cache the evaluation function instead of the result
712
- const scope = this.getGlobalScope();
713
- const sandbox = new Function('scope', `with (scope) { return ( function() { return ${expression}; })(); }`);
714
- return sandbox(scope);
715
- }
716
- catch (error) {
717
- console.error('Error evaluating expression:', error);
718
- return null;
719
- }
720
- }
721
- evaluateAction(templateExpression) {
722
- try {
723
- const expressionMatch = templateExpression.match(/\{\{\s*(.*?)\s*\}\}/);
724
- if (!expressionMatch) {
725
- throw Error(`No valid expression found in "${templateExpression}"`);
726
- }
727
- const expression = expressionMatch[1];
728
- // Cache the evaluation function instead of the result
729
- const scope = this.getGlobalScope();
730
- const sandbox = new Function('scope', `with (scope) { ${expression} }`);
731
- sandbox(scope);
732
- }
733
- catch (error) {
734
- console.error('Error evaluating expression:', error);
735
- }
736
- }
737
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPWidgetRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
738
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AXPWidgetRendererComponent, isStandalone: false, selector: "axp-widget-renderer", inputs: { node: "node", mode: "mode", parentNode: "parentNode", index: "index" }, providers: [
739
- {
740
- provide: AXUnsubscriber,
741
- },
742
- ], ngImport: i0, template: `
743
- @if(mergedOptions().isVisible!=false) { @if(isLoading()){
744
- <ax-skeleton [animated]="true" class="ax-w-full lg:ax-w-[50%] ax-h-8 ax-rounded"></ax-skeleton>
745
- } @else {
746
- <ng-container *ngTemplateOutlet="tt"></ng-container>
747
- } }
748
- <ng-template #tt>
749
- <ng-template [cdkPortalOutlet]="portal" (attached)="handleAttached($event)"></ng-template>
750
- </ng-template>
751
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: i3.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
752
- }
753
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPWidgetRendererComponent, decorators: [{
754
- type: Component,
755
- args: [{
756
- selector: 'axp-widget-renderer',
757
- template: `
758
- @if(mergedOptions().isVisible!=false) { @if(isLoading()){
759
- <ax-skeleton [animated]="true" class="ax-w-full lg:ax-w-[50%] ax-h-8 ax-rounded"></ax-skeleton>
760
- } @else {
761
- <ng-container *ngTemplateOutlet="tt"></ng-container>
762
- } }
763
- <ng-template #tt>
764
- <ng-template [cdkPortalOutlet]="portal" (attached)="handleAttached($event)"></ng-template>
765
- </ng-template>
766
- `,
767
- changeDetection: ChangeDetectionStrategy.OnPush,
768
- providers: [
769
- {
770
- provide: AXUnsubscriber,
771
- },
772
- ],
773
- standalone: false
774
- }]
775
- }], ctorParameters: () => [], propDecorators: { node: [{
776
- type: Input,
777
- args: [{ required: true }]
778
- }], mode: [{
779
- type: Input
780
- }], parentNode: [{
781
- type: Input
782
- }], index: [{
783
- type: Input
784
- }] } });
785
-
786
- class AXPWidgetContainerComponent {
787
- constructor() {
788
- this.onChanged = new EventEmitter();
789
- this.context = model({});
790
- this.unsubscriber = inject(AXUnsubscriber);
791
- this.builderService = inject(AXPLayoutBuilderService);
792
- this.ef = effect(() => {
793
- this.builderService.initial(this.context());
794
- });
795
- }
796
- set variables(v) {
797
- this.builderService.setVariables(v);
798
- }
799
- set functions(v) {
800
- this.builderService.setFunctions(v);
801
- }
802
- ngOnInit() {
803
- this.builderService.onChanged.pipe(this.unsubscriber.takeUntilDestroy).subscribe((e) => {
804
- this.context.set(e.data);
805
- this.onChanged.emit(e);
806
- });
807
- }
808
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPWidgetContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
809
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: AXPWidgetContainerComponent, isStandalone: false, selector: "axp-widgets-container", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, variables: { classPropertyName: "variables", publicName: "variables", isSignal: false, isRequired: false, transformFunction: null }, functions: { classPropertyName: "functions", publicName: "functions", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanged: "onChanged", context: "contextChange" }, host: { styleAttribute: "display: contents;" }, providers: [AXPLayoutBuilderService, AXUnsubscriber], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
810
- }
811
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPWidgetContainerComponent, decorators: [{
812
- type: Component,
813
- args: [{
814
- selector: 'axp-widgets-container',
815
- template: `<ng-content></ng-content>`,
816
- changeDetection: ChangeDetectionStrategy.OnPush,
817
- host: { style: 'display: contents;' },
818
- providers: [AXPLayoutBuilderService, AXUnsubscriber],
819
- standalone: false
820
- }]
821
- }], propDecorators: { onChanged: [{
822
- type: Output
823
- }], variables: [{
824
- type: Input
825
- }], functions: [{
826
- type: Input
827
- }] } });
828
-
829
649
  class AXPWidgetColumnRendererComponent extends AXDataTableColumnComponent {
830
650
  constructor() {
831
651
  super(...arguments);
@@ -999,11 +819,12 @@ class AXPWidgetRendererDirective {
999
819
  this.index = input();
1000
820
  this.mode = input.required();
1001
821
  this.node = input.required();
1002
- this._options = signal({ needLabel: true });
822
+ this._options = signal({});
1003
823
  this.options = this._options.asReadonly();
1004
824
  this.mergedOptions = signal({});
1005
825
  this.injector = inject(Injector);
1006
826
  this.builderService = inject(AXPLayoutBuilderService);
827
+ this.contextService = inject(AXPLayoutBuilderContextStore);
1007
828
  this.widgetRegistery = inject(AXPWidgetRegistryService);
1008
829
  this.unsubscriber = inject(AXUnsubscriber);
1009
830
  this.viewContainerRef = inject(ViewContainerRef);
@@ -1011,13 +832,19 @@ class AXPWidgetRendererDirective {
1011
832
  this.expressionCache = new Map();
1012
833
  this.expressionEvaluators = new Map();
1013
834
  this.scope = null;
1014
- this.builderService.onChanged.pipe(this.unsubscriber.takeUntilDestroy).subscribe(async (e) => {
835
+ this.onContextChanged = new Subject();
836
+ effect(async () => {
837
+ const changed = this.contextService.changeEvent();
1015
838
  if ((await this.updateOptionsBasedOnContext()) > 0) {
1016
839
  this.applyOptions();
1017
840
  }
1018
- if (this.checkFormulaForUpdate(this.node().formula, e.path)) {
841
+ if (this.checkFormulaForUpdate(this.node().formula, changed.path)) {
1019
842
  await this.updateValueBasedOnFormula();
1020
843
  }
844
+ //
845
+ if (changed.path) {
846
+ this.onContextChanged.next({ path: changed.path });
847
+ }
1021
848
  });
1022
849
  this.builderService.onRefresh.pipe(this.unsubscriber.takeUntilDestroy).subscribe(async () => {
1023
850
  if ((await this.updateOptionsBasedOnContext()) > 0) {
@@ -1057,7 +884,6 @@ class AXPWidgetRendererDirective {
1057
884
  //
1058
885
  const widget = this.widgetRegistery.resolve(this.node().type);
1059
886
  //
1060
- this._options.update((val) => ({ ...val, ...widget?.options }));
1061
887
  //
1062
888
  const props = [...(widget?.properties ?? []), ...(widget?.components[this.mode()]?.properties ?? [])]
1063
889
  ?.filter((c) => c.schema.defaultValue != null)
@@ -1070,6 +896,8 @@ class AXPWidgetRendererDirective {
1070
896
  this.preprocessAndInitialOptions(cloneDeep(this.node().options));
1071
897
  await this.updateOptionsBasedOnContext();
1072
898
  //
899
+ this._options.update((val) => ({ ...val, ...this.mergedOptions() }));
900
+ //
1073
901
  const tokenValue = {
1074
902
  node: this.node(),
1075
903
  options: this.mergedOptions(),
@@ -1088,9 +916,11 @@ class AXPWidgetRendererDirective {
1088
916
  const com = await widget?.components[this.mode()]?.component();
1089
917
  this.componentRef = this.viewContainerRef.createComponent(com, { injector: token });
1090
918
  this.instance = this.componentRef.instance;
919
+ this.instance.setStatus(AXPWidgetStatus.Rendering);
1091
920
  this.instance.parent = this.parentNode();
1092
921
  this.instance.index = this.index();
1093
922
  this.instance.mode = this.mode();
923
+ this.instance.setStatus(AXPWidgetStatus.Rendered);
1094
924
  await this.updateValueBasedOnFormula();
1095
925
  await this.assignTriggers();
1096
926
  //
@@ -1099,6 +929,7 @@ class AXPWidgetRendererDirective {
1099
929
  applyOptions() {
1100
930
  if (!this.instance)
1101
931
  return;
932
+ this._options.update((val) => ({ ...val, ...this.mergedOptions() }));
1102
933
  this.instance.setOptions(this.mergedOptions());
1103
934
  }
1104
935
  checkFormulaForUpdate(formula, path) {
@@ -1206,12 +1037,15 @@ class AXPWidgetRendererDirective {
1206
1037
  }
1207
1038
  getContextScope() {
1208
1039
  const scope = {};
1209
- set(scope, 'eval', (path) => this.builderService.getValue(path));
1040
+ set(scope, 'eval', (path) => this.contextService.getValue(path));
1041
+ set(scope, 'set', (path, value) => {
1042
+ this.contextService.update(path, value);
1043
+ });
1210
1044
  return scope;
1211
1045
  }
1212
1046
  getEventScope() {
1213
1047
  const scope = {};
1214
- set(scope, 'context', (path) => this.builderService.onChanged.pipe(filter((c) => c.path == path)));
1048
+ set(scope, 'context', (path) => this.onContextChanged.pipe(filter((c) => c.path == path)));
1215
1049
  set(scope, 'from', (event) => get(this.instance.api(), event));
1216
1050
  return scope;
1217
1051
  }
@@ -1220,8 +1054,14 @@ class AXPWidgetRendererDirective {
1220
1054
  set(scope, 'call', (name, ...args) => {
1221
1055
  this.instance.call(name, ...args);
1222
1056
  });
1057
+ set(scope, 'setValue', (value) => {
1058
+ this.instance.setValue(value);
1059
+ });
1060
+ set(scope, 'output', (name) => {
1061
+ this.instance.output(name);
1062
+ });
1223
1063
  set(scope, 'find', (id) => {
1224
- return this.builderService.getWidget(id)?.api();
1064
+ return this.builderService.getWidget(id);
1225
1065
  });
1226
1066
  return scope;
1227
1067
  }
@@ -1294,7 +1134,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1294
1134
  type: Directive,
1295
1135
  args: [{
1296
1136
  selector: '[axp-widget-renderer]',
1297
- exportAs: 'widgetRenderer', // Add this line
1137
+ exportAs: 'widgetRenderer',
1298
1138
  providers: [
1299
1139
  {
1300
1140
  provide: AXUnsubscriber,
@@ -1304,7 +1144,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1304
1144
  }]
1305
1145
  }], ctorParameters: () => [] });
1306
1146
 
1307
- const COMPONENTS = [AXPWidgetContainerComponent, AXPWidgetRendererComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective];
1147
+ const COMPONENTS = [AXPWidgetContainerComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective];
1308
1148
  class AXPLayoutBuilderModule {
1309
1149
  static forRoot(config) {
1310
1150
  return {
@@ -1345,7 +1185,7 @@ class AXPLayoutBuilderModule {
1345
1185
  });
1346
1186
  }
1347
1187
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLayoutBuilderModule, deps: [{ token: 'AXPLayoutBuilderModuleFactory', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
1348
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXPLayoutBuilderModule, declarations: [AXPWidgetContainerComponent, AXPWidgetRendererComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective], imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule], exports: [AXPWidgetContainerComponent, AXPWidgetRendererComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective] }); }
1188
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXPLayoutBuilderModule, declarations: [AXPWidgetContainerComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective], imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule], exports: [AXPWidgetContainerComponent, AXPWidgetColumnRendererComponent, AXPWidgetRendererDirective] }); }
1349
1189
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLayoutBuilderModule, imports: [CommonModule, PortalModule, AXSkeletonModule, CommonModule] }); }
1350
1190
  }
1351
1191
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLayoutBuilderModule, decorators: [{
@@ -1382,16 +1222,22 @@ const AXP_WIDGETS_ADVANCE_GROUP = {
1382
1222
  order: 4,
1383
1223
  title: 'Advance',
1384
1224
  };
1225
+ const AXP_WIDGETS_FILTER_GROUP = {
1226
+ name: 'filter',
1227
+ order: 5,
1228
+ title: 'Filters',
1229
+ };
1385
1230
  const AXP_WIDGETS_GROUPS = [
1386
1231
  AXP_WIDGETS_EDITOR_GROUP,
1387
1232
  AXP_WIDGETS_ACTION_GROUP,
1388
1233
  AXP_WIDGETS_LAYOUT_GROUP,
1389
1234
  AXP_WIDGETS_ADVANCE_GROUP,
1235
+ AXP_WIDGETS_FILTER_GROUP,
1390
1236
  ];
1391
1237
 
1392
1238
  /**
1393
1239
  * Generated bundle index. Do not edit.
1394
1240
  */
1395
1241
 
1396
- export { AXPColumnWidgetComponent, AXPDataListWidgetComponent, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPLayoutElement, AXPWidgetColumnRendererComponent, AXPWidgetComponent, AXPWidgetContainerComponent, AXPWidgetDataSourceProviderService, AXPWidgetRegistryService, AXPWidgetRendererComponent, AXPWidgetRendererDirective, AXPWidgetsCatalog, AXP_WIDGETS_ACTION_GROUP, AXP_WIDGETS_ADVANCE_GROUP, AXP_WIDGETS_EDITOR_GROUP, AXP_WIDGETS_GROUPS, AXP_WIDGETS_LAYOUT_GROUP, AXP_WIDGET_COLUMN_TOKEN, AXP_WIDGET_DATASOURCE_PROVIDER, AXP_WIDGET_TOKEN, cloneProperty, createBooleanProperty, createSelectProperty, createStringProperty };
1242
+ export { AXPColumnWidgetComponent, AXPDataListWidgetComponent, AXPLayoutBuilderContextStore, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPLayoutContextChangeEvent, AXPLayoutElement, AXPPageStatus, AXPWidgetColumnRendererComponent, AXPWidgetComponent, AXPWidgetContainerComponent, AXPWidgetDataSourceProviderService, AXPWidgetRegistryService, AXPWidgetRendererDirective, AXPWidgetStatus, AXPWidgetsCatalog, AXP_WIDGETS_ACTION_GROUP, AXP_WIDGETS_ADVANCE_GROUP, AXP_WIDGETS_EDITOR_GROUP, AXP_WIDGETS_FILTER_GROUP, AXP_WIDGETS_GROUPS, AXP_WIDGETS_LAYOUT_GROUP, AXP_WIDGET_COLUMN_TOKEN, AXP_WIDGET_DATASOURCE_PROVIDER, AXP_WIDGET_TOKEN, cloneProperty, createBooleanProperty, createSelectProperty, createStringProperty, objectKeyValueTransforms };
1397
1243
  //# sourceMappingURL=acorex-platform-layout-builder.mjs.map