@acorex/platform 20.6.0-next.9 → 20.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/common/index.d.ts +9 -2
  2. package/core/index.d.ts +209 -55
  3. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  4. package/fesm2022/acorex-platform-core.mjs +225 -24
  5. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  6. package/fesm2022/acorex-platform-domain.mjs +49 -4
  7. package/fesm2022/acorex-platform-domain.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-layout-builder.mjs +39 -118
  9. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-layout-components.mjs +1011 -257
  11. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-layout-designer.mjs +2 -2
  13. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-layout-entity.mjs +9318 -4439
  15. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  16. package/fesm2022/acorex-platform-layout-views.mjs +30 -24
  17. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  18. package/fesm2022/acorex-platform-layout-widget-core.mjs +4 -8
  19. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  20. package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs +30 -0
  21. package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs.map +1 -0
  22. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-C1l2KSDa.mjs → acorex-platform-layout-widgets-tabular-data-edit-popup.component-m8rHZP8L.mjs} +2 -2
  23. package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-m8rHZP8L.mjs.map +1 -0
  24. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-D-31ej0C.mjs → acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs} +2 -2
  25. package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs.map +1 -0
  26. package/fesm2022/acorex-platform-layout-widgets.mjs +2081 -1238
  27. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  28. package/fesm2022/acorex-platform-runtime.mjs +79 -3
  29. package/fesm2022/acorex-platform-runtime.mjs.map +1 -1
  30. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-mARj77Mr.mjs +136 -0
  31. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-mARj77Mr.mjs.map +1 -0
  32. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-Cym8pq0v.mjs +1543 -0
  33. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-Cym8pq0v.mjs.map +1 -0
  34. package/fesm2022/acorex-platform-themes-default.mjs +124 -21
  35. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  36. package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs +55 -0
  37. package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs.map +1 -0
  38. package/fesm2022/acorex-platform-themes-shared.mjs +15 -110
  39. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  40. package/fesm2022/acorex-platform-workflow.mjs +658 -45
  41. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  42. package/layout/builder/index.d.ts +6 -33
  43. package/layout/components/index.d.ts +301 -60
  44. package/layout/designer/index.d.ts +1 -1
  45. package/layout/entity/index.d.ts +650 -86
  46. package/layout/views/index.d.ts +5 -58
  47. package/layout/widget-core/index.d.ts +24 -26
  48. package/layout/widgets/README.md +0 -1
  49. package/layout/widgets/index.d.ts +134 -84
  50. package/package.json +1 -1
  51. package/runtime/index.d.ts +36 -8
  52. package/themes/default/index.d.ts +29 -73
  53. package/themes/shared/index.d.ts +1 -39
  54. package/workflow/index.d.ts +401 -90
  55. package/fesm2022/acorex-platform-layout-entity-create-entity.command-DGeylNSY.mjs +0 -52
  56. package/fesm2022/acorex-platform-layout-entity-create-entity.command-DGeylNSY.mjs.map +0 -1
  57. package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-C1l2KSDa.mjs.map +0 -1
  58. package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-D-31ej0C.mjs.map +0 -1
  59. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-WbPPqDON.mjs +0 -115
  60. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-WbPPqDON.mjs.map +0 -1
  61. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CD7rJIMh.mjs +0 -803
  62. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CD7rJIMh.mjs.map +0 -1
@@ -5,10 +5,9 @@ import { inject, Injectable, input, model, signal, effect, output, viewChild, Ch
5
5
  import { AXPopupService } from '@acorex/components/popup';
6
6
  import * as i2 from '@acorex/components/form';
7
7
  import { AXFormComponent, AXFormModule } from '@acorex/components/form';
8
- import { AXPExpressionEvaluatorService } from '@acorex/platform/core';
9
8
  import * as i1 from '@acorex/platform/layout/widget-core';
10
9
  import { AXPWidgetContainerComponent, AXPPageStatus, AXPWidgetCoreModule } from '@acorex/platform/layout/widget-core';
11
- import { isEqual, get, cloneDeep } from 'lodash-es';
10
+ import { isEqual, cloneDeep } from 'lodash-es';
12
11
  import { Subject, debounceTime, distinctUntilChanged, startWith } from 'rxjs';
13
12
  import * as i1$1 from '@acorex/components/button';
14
13
  import { AXButtonModule } from '@acorex/components/button';
@@ -19,6 +18,7 @@ import { AXLoadingModule } from '@acorex/components/loading';
19
18
  import { AXBasePageComponent } from '@acorex/components/page';
20
19
  import * as i5 from '@acorex/core/translation';
21
20
  import { AXTranslationModule } from '@acorex/core/translation';
21
+ import { AXPExpressionEvaluatorService } from '@acorex/platform/core';
22
22
 
23
23
  //#region ---- Inheritance Utilities ----
24
24
  /**
@@ -725,6 +725,14 @@ class FormFieldBuilder extends LayoutContainerMixin {
725
725
  setShowLabel(showLabel) {
726
726
  return this.setOptions({ showLabel });
727
727
  }
728
+ defaultValue(value) {
729
+ this.containerState.defaultValue = value;
730
+ this.inheritanceContext.defaultValue = value;
731
+ if (this.childWidget) {
732
+ this.childWidget.withInheritanceContext(this.inheritanceContext);
733
+ }
734
+ return this;
735
+ }
728
736
  // Single widget methods with automatic path generation
729
737
  addSingleWidget(type, options) {
730
738
  if (this.hasWidget) {
@@ -916,7 +924,7 @@ class FieldsetContainerBuilder extends LayoutContainerMixin {
916
924
  */
917
925
  class ListWidgetBuilder extends WidgetContainerMixin {
918
926
  constructor() {
919
- super('list');
927
+ super('data-list');
920
928
  }
921
929
  setOptions(options) {
922
930
  this.containerState.options = { ...this.containerState.options, ...options };
@@ -1201,6 +1209,10 @@ class WidgetBuilder {
1201
1209
  this.inheritanceContext.disabled = condition;
1202
1210
  return this;
1203
1211
  }
1212
+ defaultValue(defaultValue) {
1213
+ this.widgetState.defaultValue = defaultValue;
1214
+ return this;
1215
+ }
1204
1216
  readonly(condition) {
1205
1217
  if (!this.widgetState.options) {
1206
1218
  this.widgetState.options = {};
@@ -1241,6 +1253,9 @@ class WidgetBuilder {
1241
1253
  if (resolved.visible !== undefined) {
1242
1254
  this.widgetState.options['visible'] = resolved.visible;
1243
1255
  }
1256
+ if (context.defaultValue !== undefined) {
1257
+ this.widgetState.defaultValue = context.defaultValue;
1258
+ }
1244
1259
  return this;
1245
1260
  }
1246
1261
  getInheritanceContext() {
@@ -1691,29 +1706,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
1691
1706
 
1692
1707
  class AXPLayoutRendererComponent {
1693
1708
  constructor() {
1694
- this.evaluatorService = inject(AXPExpressionEvaluatorService);
1695
1709
  this.conversionService = inject(AXPLayoutConversionService);
1696
- /**
1697
- * Tracks the latest scheduled evaluation to ensure last-write-wins for async evaluate
1698
- */
1699
- this.evaluationRunId = 0;
1700
1710
  /**
1701
1711
  * RxJS subjects for context management
1702
1712
  */
1703
1713
  this.contextUpdateSubject = new Subject();
1704
1714
  this.contextChangeSubject = new Subject();
1705
- /**
1706
- * Cache for expression evaluation results
1707
- */
1708
- this.expressionCache = new Map();
1709
- /**
1710
- * Cache for widget tree comparisons
1711
- */
1712
- this.widgetTreeCache = new Map();
1713
- /**
1714
- * Last layout hash for change detection
1715
- */
1716
- this.lastLayoutHash = '';
1717
1715
  //#region ---- Inputs ----
1718
1716
  /**
1719
1717
  * Form definition containing groups and fields OR widget tree
@@ -1735,36 +1733,29 @@ class AXPLayoutRendererComponent {
1735
1733
  //#region ---- Widget Tree Conversion ----
1736
1734
  this.widgetTree = signal(null, ...(ngDevMode ? [{ debugName: "widgetTree" }] : []));
1737
1735
  /**
1738
- * Convert and evaluate data when inputs change (optimized with RxJS)
1736
+ * Convert layout data to widget tree when inputs change
1739
1737
  */
1740
1738
  this.conversionEffect = effect(() => {
1741
1739
  const inputData = this.layout();
1742
- const ctx = this.internalContext();
1743
- const look = this.look();
1744
- const runId = ++this.evaluationRunId;
1745
- // Generate layout hash for change detection
1746
- const layoutHash = this.generateLayoutHash(inputData, look);
1747
- // Skip if layout hasn't changed
1748
- if (layoutHash === this.lastLayoutHash && this.widgetTree()) {
1740
+ // Convert to widget tree
1741
+ let tree;
1742
+ if (this.isFormDefinition(inputData)) {
1743
+ // Convert form definition to widget tree
1744
+ tree = this.conversionService.convertFormDefinition(inputData);
1745
+ }
1746
+ else if (this.isWidgetNode(inputData)) {
1747
+ // Use widget tree directly
1748
+ tree = inputData;
1749
+ }
1750
+ else {
1751
+ console.warn('AXPLayoutRendererComponent: Invalid layout input. Expected AXPDynamicFormDefinition or AXPWidgetNode.', inputData);
1749
1752
  return;
1750
1753
  }
1751
- this.lastLayoutHash = layoutHash;
1752
- (async () => {
1753
- // First evaluate expressions if needed
1754
- const evaluated = await this.expressionEvaluator(inputData, ctx);
1755
- // Ignore stale results
1756
- if (runId !== this.evaluationRunId) {
1757
- return;
1758
- }
1759
- // Convert to widget tree (this will also apply the layout look)
1760
- const tree = evaluated;
1761
- // Update widget tree
1762
- const prev = this.widgetTree();
1763
- if (!isEqual(prev, tree)) {
1764
- tree.mode = this.mode();
1765
- this.widgetTree.set(tree);
1766
- }
1767
- })();
1754
+ // Update widget tree only if changed (Angular effect already prevents unnecessary runs)
1755
+ const prev = this.widgetTree();
1756
+ if (!isEqual(prev, tree)) {
1757
+ this.widgetTree.set(tree);
1758
+ }
1768
1759
  }, ...(ngDevMode ? [{ debugName: "conversionEffect" }] : []));
1769
1760
  //#endregion
1770
1761
  //#region ---- Outputs ----
@@ -1807,32 +1798,6 @@ class AXPLayoutRendererComponent {
1807
1798
  }
1808
1799
  }, ...(ngDevMode ? [{ debugName: "#widgetStatusEffect" }] : []));
1809
1800
  }
1810
- async expressionEvaluator(expression, context) {
1811
- // Check if it's a form definition that needs conversion
1812
- if (this.isFormDefinition(expression)) {
1813
- return this.conversionService.convertFormDefinition(expression);
1814
- }
1815
- // Generate cache key using a more efficient method
1816
- const cacheKey = this.generateCacheKey(expression, context);
1817
- // Check cache first
1818
- if (this.expressionCache.has(cacheKey)) {
1819
- return this.expressionCache.get(cacheKey);
1820
- }
1821
- const scope = {
1822
- context: {
1823
- eval: (path) => get(context, path),
1824
- },
1825
- };
1826
- const result = await this.evaluatorService.evaluate(expression, scope);
1827
- // Cache result with LRU-like behavior
1828
- if (this.expressionCache.size > 50) {
1829
- // Clear half the cache when it gets too large
1830
- const keysToDelete = Array.from(this.expressionCache.keys()).slice(0, 25);
1831
- keysToDelete.forEach((key) => this.expressionCache.delete(key));
1832
- }
1833
- this.expressionCache.set(cacheKey, result);
1834
- return result;
1835
- }
1836
1801
  //#endregion
1837
1802
  //#region ---- Lifecycle Methods ----
1838
1803
  ngOnInit() {
@@ -1965,55 +1930,11 @@ class AXPLayoutRendererComponent {
1965
1930
  isFormDefinition(data) {
1966
1931
  return data && typeof data === 'object' && 'groups' in data && Array.isArray(data.groups);
1967
1932
  }
1968
- //#endregion
1969
- //#region ---- Utility Methods ----
1970
- /**
1971
- * Generate layout hash for change detection (short hash)
1972
- */
1973
- generateLayoutHash(layout, look) {
1974
- if (!layout)
1975
- return '';
1976
- // Generate short hash for large layout strings
1977
- const layoutStr = typeof layout === 'string' ? layout : JSON.stringify(layout);
1978
- const layoutHash = this.simpleHash(layoutStr);
1979
- return `${layoutHash}|${look}`;
1980
- }
1981
- /**
1982
- * Generate cache key for expression evaluation (short hash)
1983
- */
1984
- generateCacheKey(expression, context) {
1985
- // Use short hash for better performance
1986
- const exprStr = typeof expression === 'string' ? expression : JSON.stringify(expression);
1987
- const exprHash = this.simpleHash(exprStr);
1988
- const ctxHash = this.generateContextHash(context);
1989
- return `${exprHash}|${ctxHash}`;
1990
- }
1991
1933
  /**
1992
- * Generate a simple hash for context change detection
1934
+ * Type guard to check if the input is a widget node
1993
1935
  */
1994
- generateContextHash(context) {
1995
- if (!context || typeof context !== 'object') {
1996
- return String(context);
1997
- }
1998
- // Generate short hash for context
1999
- const keys = Object.keys(context).sort();
2000
- const contextStr = keys.map((key) => `${key}:${context[key]}`).join('|');
2001
- return this.simpleHash(contextStr);
2002
- }
2003
- /**
2004
- * Simple hash function for generating short keys
2005
- */
2006
- simpleHash(str) {
2007
- let hash = 0;
2008
- if (str.length === 0)
2009
- return hash.toString();
2010
- for (let i = 0; i < str.length; i++) {
2011
- const char = str.charCodeAt(i);
2012
- hash = (hash << 5) - hash + char;
2013
- hash = hash & hash; // Convert to 32-bit integer
2014
- }
2015
- // Convert to positive hex string
2016
- return Math.abs(hash).toString(16);
1936
+ isWidgetNode(data) {
1937
+ return data && typeof data === 'object' && 'type' in data && typeof data.type === 'string';
2017
1938
  }
2018
1939
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPLayoutRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2019
1940
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: AXPLayoutRendererComponent, isStandalone: true, selector: "axp-layout-renderer", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: true, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { context: "contextChange", contextInitiated: "contextInitiated", validityChange: "validityChange" }, viewQueries: [{ propertyName: "form", first: true, predicate: AXFormComponent, descendants: true, isSignal: true }, { propertyName: "container", first: true, predicate: AXPWidgetContainerComponent, descendants: true, isSignal: true }], ngImport: i0, template: `