@acorex-platform/framework-client 0.0.14 → 0.0.18

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 (34) hide show
  1. package/fesm2022/acorex-platform-framework-client-auth.mjs.map +1 -1
  2. package/fesm2022/acorex-platform-framework-client-common.mjs +25 -211
  3. package/fesm2022/acorex-platform-framework-client-common.mjs.map +1 -1
  4. package/fesm2022/acorex-platform-framework-client-core.mjs +8 -104
  5. package/fesm2022/acorex-platform-framework-client-core.mjs.map +1 -1
  6. package/fesm2022/acorex-platform-framework-client-layout-builder.mjs +57 -12
  7. package/fesm2022/acorex-platform-framework-client-layout-builder.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-framework-client-layout-components.mjs +494 -561
  9. package/fesm2022/acorex-platform-framework-client-layout-components.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-framework-client-layout-designer.mjs +8 -8
  11. package/fesm2022/acorex-platform-framework-client-layout-designer.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-framework-client-layout-entity.mjs +1333 -1023
  13. package/fesm2022/acorex-platform-framework-client-layout-entity.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-framework-client-layout-views.mjs +51 -9
  15. package/fesm2022/acorex-platform-framework-client-layout-views.mjs.map +1 -1
  16. package/fesm2022/acorex-platform-framework-client-layout-widget-core.mjs +29 -9
  17. package/fesm2022/acorex-platform-framework-client-layout-widget-core.mjs.map +1 -1
  18. package/fesm2022/acorex-platform-framework-client-layout-widgets.mjs +48 -15
  19. package/fesm2022/acorex-platform-framework-client-layout-widgets.mjs.map +1 -1
  20. package/fesm2022/acorex-platform-framework-client-themes-default.mjs +41 -26
  21. package/fesm2022/acorex-platform-framework-client-themes-default.mjs.map +1 -1
  22. package/fesm2022/acorex-platform-framework-client-themes-shared.mjs +4 -4
  23. package/fesm2022/acorex-platform-framework-client-themes-shared.mjs.map +1 -1
  24. package/fesm2022/acorex-platform-framework-client-workflow.mjs.map +1 -1
  25. package/package.json +7 -7
  26. package/types/acorex-platform-framework-client-auth.d.ts +2 -2
  27. package/types/acorex-platform-framework-client-common.d.ts +12 -125
  28. package/types/acorex-platform-framework-client-core.d.ts +5 -22
  29. package/types/acorex-platform-framework-client-layout-builder.d.ts +10 -0
  30. package/types/acorex-platform-framework-client-layout-components.d.ts +17 -68
  31. package/types/acorex-platform-framework-client-layout-entity.d.ts +80 -7
  32. package/types/acorex-platform-framework-client-layout-views.d.ts +11 -6
  33. package/types/acorex-platform-framework-client-layout-widgets.d.ts +1 -1
  34. package/types/acorex-platform-framework-client-workflow.d.ts +1 -2
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, inject, Injectable, Directive, computed, Injector, ChangeDetectionStrategy, Component, input, ElementRef, ViewContainerRef, signal, effect, runInInjectionContext, Optional, Inject, NgModule, EventEmitter, HostListener, Output, DestroyRef, untracked, provideAppInitializer, Pipe } from '@angular/core';
3
3
  import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';
4
4
  import { AXDataSource, convertArrayToDataSource } from '@acorex/cdk/common';
5
- import { AXPPlatformCoreDataSourceKeys, isFormContextDirty, getSmart, isSelectionValueEqual, isFormValueEqual, setSmart, extractValue, AXPKeyboardShortcutPriority, getSystemActions, isLocaleStringMap } from '@acorex-platform/framework-shared/core';
5
+ import { AXPPlatformCoreDataSourceKeys, isFormContextDirty, getSmart, isSelectionValueEqual, isFormValueEqual, setSmart, AXPExpressionEvaluatorScopeProviderContext, ExpressionEvaluatorEngine, extractValue, AXPKeyboardShortcutPriority, getSystemActions, isLocaleStringMap } from '@acorex-platform/framework-shared/core';
6
6
  import { cloneDeep, isEmpty, isEqual, has, unset, isPlainObject, get, sortBy, set, isNil, castArray, isString, isUndefined, endsWith, startsWith, includes, lte, gte, lt, gt, orderBy } from 'lodash-es';
7
7
  import { signalStore, withState, withComputed, withMethods, patchState } from '@ngrx/signals';
8
8
  import { AXFormatService } from '@acorex/core/format';
@@ -1048,17 +1048,6 @@ function normalizeExpressionTemplate(template) {
1048
1048
  }
1049
1049
  //#endregion
1050
1050
 
1051
- class AXPExpressionEvaluatorScopeProviderContext {
1052
- constructor() {
1053
- this.scopes = {};
1054
- }
1055
- addScope(namespace, functions) {
1056
- this.scopes[namespace] = { ...this.scopes[namespace], ...functions };
1057
- }
1058
- getScopes() {
1059
- return this.scopes;
1060
- }
1061
- }
1062
1051
  const AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER = new InjectionToken('AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER');
1063
1052
  class AXPExpressionEvaluatorScopeProviderService {
1064
1053
  constructor() {
@@ -1099,108 +1088,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1099
1088
 
1100
1089
  class AXPExpressionEvaluatorService {
1101
1090
  constructor() {
1102
- // Memoization cache for compiled expressions
1103
- this.expressionCache = new Map();
1091
+ this.engine = new ExpressionEvaluatorEngine();
1104
1092
  this.providerService = inject(AXPExpressionEvaluatorScopeProviderService);
1105
1093
  }
1106
- getOrCompileFunction(expression) {
1107
- if (!this.expressionCache.has(expression)) {
1108
- // Check if expression contains multiple statements (has semicolons or newlines)
1109
- const hasMultipleStatements = expression.includes(';') || expression.includes('\n');
1110
- let fn;
1111
- if (hasMultipleStatements) {
1112
- // For multiple statements, execute them in sequence and return the last expression
1113
- fn = new Function('scope', `with (scope) { return (async function() { ${expression} })(); }`);
1114
- }
1115
- else {
1116
- // For single expressions, use return
1117
- fn = new Function('scope', `with (scope) { return (async function() { return ${expression}; })(); }`);
1118
- }
1119
- this.expressionCache.set(expression, fn);
1120
- }
1121
- return this.expressionCache.get(expression);
1122
- }
1123
1094
  async getMergedScope(userScope) {
1124
1095
  const pluginScopes = await this.providerService.getScopesAsync();
1125
1096
  // Merge pluginScopes and userScope (userScope takes precedence)
1126
1097
  return { ...pluginScopes, ...userScope };
1127
1098
  }
1128
1099
  async evaluate(source, scope = {}) {
1129
- try {
1130
- const mergedScope = await this.getMergedScope(scope);
1131
- if (typeof source === 'string' && source.includes('{{')) {
1132
- return await this.evaluateStringExpression(source, mergedScope);
1133
- }
1134
- else if (Array.isArray(source)) {
1135
- const evaluatedArray = [];
1136
- for (const item of source) {
1137
- evaluatedArray.push(await this.evaluate(item, mergedScope));
1138
- }
1139
- return evaluatedArray;
1140
- }
1141
- else if (typeof source === 'object' && source !== null) {
1142
- const evaluatedObject = {};
1143
- for (const key in source) {
1144
- if (source.hasOwnProperty(key)) {
1145
- evaluatedObject[key] = await this.evaluate(source[key], mergedScope);
1146
- }
1147
- }
1148
- return evaluatedObject;
1149
- }
1150
- else {
1151
- return source;
1152
- }
1153
- }
1154
- catch (error) {
1155
- console.error('Expression evaluator - Error evaluating expression:', source, error);
1156
- return false;
1157
- }
1158
- }
1159
- async evaluateStringExpression(templateExpression, scope) {
1160
- const normalizedTemplate = normalizeExpressionTemplate(templateExpression);
1161
- // Check if the input is exactly a single {{ ... }} expression (handle multiline)
1162
- const exactMatch = normalizedTemplate.match(/^\s*\{\{\s*([\s\S]*?)\s*\}\}\s*$/);
1163
- if (exactMatch) {
1164
- const expression = exactMatch[1];
1165
- const sandbox = this.getOrCompileFunction(expression);
1166
- const result = await sandbox(scope);
1167
- return result;
1168
- }
1169
- // Otherwise, interpolate all {{ ... }} expressions in the string
1170
- const regex = /\{\{\s*([\s\S]*?)\s*\}\}/g;
1171
- // Collect all matches and their positions
1172
- const matches = [];
1173
- let match;
1174
- while ((match = regex.exec(normalizedTemplate)) !== null) {
1175
- matches.push({
1176
- expression: match[1],
1177
- start: match.index,
1178
- end: regex.lastIndex,
1179
- raw: match[0],
1180
- });
1181
- }
1182
- // Evaluate all expressions in parallel
1183
- const values = await Promise.all(matches.map((m) => {
1184
- const sandbox = this.getOrCompileFunction(m.expression);
1185
- return sandbox(scope);
1186
- }));
1187
- // Reconstruct the string with evaluated values
1188
- let result = '';
1189
- let lastIndex = 0;
1190
- matches.forEach((m, i) => {
1191
- result += normalizedTemplate.slice(lastIndex, m.start);
1192
- const value = values[i];
1193
- result += value !== undefined && value !== null ? value : '';
1194
- lastIndex = m.end;
1100
+ const mergedScope = await this.getMergedScope(scope);
1101
+ return this.engine.evaluate(source, mergedScope, {
1102
+ normalizeTemplate: normalizeExpressionTemplate,
1103
+ swallowErrors: true,
1195
1104
  });
1196
- result += normalizedTemplate.slice(lastIndex);
1197
- return result;
1198
1105
  }
1199
1106
  isExpression(expression) {
1200
- if (typeof expression === 'string') {
1201
- return expression.trim().startsWith('{{') && expression.trim().endsWith('}}');
1202
- }
1203
- return false;
1107
+ return this.engine.isExpression(expression);
1204
1108
  }
1205
1109
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPExpressionEvaluatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1206
1110
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPExpressionEvaluatorService, providedIn: 'root' }); }
@@ -5187,5 +5091,5 @@ function provideLazyProvider(token, loader, multi = true) {
5187
5091
  * Generated bundle index. Do not edit.
5188
5092
  */
5189
5093
 
5190
- export { AXHighlightService, AXPActivityLogProvider, AXPActivityLogService, AXPAppStartUpProvider, AXPAppStartUpService, AXPBroadcastEventService, AXPCatalogScopeDefinitionProviderService, AXPCatalogScopeDefinitionsDataSourceDefinition, AXPColorPaletteProvider, AXPColorPaletteService, AXPColumnWidthService, AXPComponentLogoConfig, AXPComponentSlot, AXPComponentSlotDirective, AXPComponentSlotModule, AXPComponentSlotRegistryService, AXPContentCheckerDirective, AXPContextDefinitionProviderService, AXPContextEvalFactory, AXPContextStore, AXPCountdownPipe, AXPDataGenerator, AXPDataSourceDefinitionProviderService, AXPDataSourceQueryService, AXPDblClickDirective, AXPDebugService, AXPDefaultColorPalettesProvider, AXPDeviceService, AXPDeviceType, AXPDistributedEventListenerService, AXPElementDataDirective, AXPEntityLogoRegistrationService, AXPExpressionEvaluatorScopeProviderContext, AXPExpressionEvaluatorScopeProviderService, AXPExpressionEvaluatorService, AXPFeatureDefinitionProviderContext, AXPGridLayoutDirective, AXPHookService, AXPIconLogoConfig, AXPIdleSchedulerService, AXPImageUrlLogoConfig, AXPKeyboardShortcutRegistry, AXPLogoComponent, AXPLogoRegistryService, AXPModuleManifestModule, AXPModuleManifestRegistry, AXPModuleManifestsDataSourceDefinition, AXPScreenSize, AXPTagProvider, AXPTagService, AXP_ACTIVITY_LOG_PROVIDER, AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, AXP_COLOR_PALETTE_PROVIDER, AXP_COLUMN_WIDTH_PROVIDER, AXP_CONTEXT_DEFINITION_PROVIDER, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER, AXP_ENTITY_LOGO_FALLBACK_RESOLVER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, AXP_FEATURE_DEFINITION_PROVIDER, AXP_LOGO_IMAGE_SRC_RESOLVER, AXP_LOGO_PROVIDER, AXP_LOGO_THEME_RESOLVER, AXP_MODULE_MANIFEST_PROVIDER, AXP_PLATFORM_LOGO_KEY, AXP_SESSION_SERVICE, AXP_SETTINGS_DEFINITION_DIALOG_OPENER, AXP_TAG_PROVIDER, AX_OVERLAY_CONTAINER_SELECTOR, AX_OVERLAY_PANE_SELECTOR, DEFAULT_CANCEL_DIALOG_ACTION_SHORTCUTS, DEFAULT_SUBMIT_DIALOG_ACTION_SHORTCUTS, FORM_DIRTY_TRACE_NS, OVERLAY_DETAILS_VIEW_TRACE_NS, OVERLAY_LAYOUT_TRACE_NS, OVERLAY_ROOT_LAYOUT_TRACE_NS, OVERLAY_WIDGET_SETTLE_TRACE_NS, applyContextEvalPipes, applyFilterArray, applyPagination, applyQueryArray, applySortArray, applySystemActionDefault, axpApplicationLogoKey, axpExtractLogoUrl, axpSsoLogoKey, axpTenantLogoKey, chordToKbdItemKeys, contextEvalWithPipes, createProviderWithInjectionContext, defaultColumnWidthProvider, findOverlayContainerAncestor, formatKeyboardShortcutChord, formatKeyboardShortcutChords, getNestedVisibleOverlayPanes, getPrimaryKeyboardShortcutChord, getTopVisibleOverlayContainer, getVisibleAnchoredOverlayPanes, getVisibleOverlayContainers, hasForegroundOverlayLayer, instantiateWithInjectionContext, isDialogShortcutAllowedInEditableField, isHorizontalDirectionalShortcutKey, isKeyboardTargetInsideEditableField, isMacPlatform, isVisibleOverlayElement, matchesDialogActionShortcut, matchesKeyboardShortcutChord, mirrorHorizontalDirectionalKey, normalizeContextEvalPipes, normalizeDialogActionShortcutChord, normalizeExpressionTemplate, normalizeKeyboardShortcut, normalizeKeyboardShortcuts, objectKeyValueTransforms, parseDialogActionShortcut, parseKeyboardShortcutChord, provideLazyProvider, registerPopupFooterKeyboardShortcuts, resolveConfiguredFooterActionShortcuts, resolveDialogActionShortcuts, resolveDisplayShortcutChord, resolveEffectiveDirectionBehavior, resolveSemanticDirectionalKey, setupPopupFooterKeyboardShortcuts, shouldDeferEscapeToOpenOverlay, shouldTriggerDialogActionShortcut };
5094
+ export { AXHighlightService, AXPActivityLogProvider, AXPActivityLogService, AXPAppStartUpProvider, AXPAppStartUpService, AXPBroadcastEventService, AXPCatalogScopeDefinitionProviderService, AXPCatalogScopeDefinitionsDataSourceDefinition, AXPColorPaletteProvider, AXPColorPaletteService, AXPColumnWidthService, AXPComponentLogoConfig, AXPComponentSlot, AXPComponentSlotDirective, AXPComponentSlotModule, AXPComponentSlotRegistryService, AXPContentCheckerDirective, AXPContextDefinitionProviderService, AXPContextEvalFactory, AXPContextStore, AXPCountdownPipe, AXPDataGenerator, AXPDataSourceDefinitionProviderService, AXPDataSourceQueryService, AXPDblClickDirective, AXPDebugService, AXPDefaultColorPalettesProvider, AXPDeviceService, AXPDeviceType, AXPDistributedEventListenerService, AXPElementDataDirective, AXPEntityLogoRegistrationService, AXPExpressionEvaluatorScopeProviderService, AXPExpressionEvaluatorService, AXPFeatureDefinitionProviderContext, AXPGridLayoutDirective, AXPHookService, AXPIconLogoConfig, AXPIdleSchedulerService, AXPImageUrlLogoConfig, AXPKeyboardShortcutRegistry, AXPLogoComponent, AXPLogoRegistryService, AXPModuleManifestModule, AXPModuleManifestRegistry, AXPModuleManifestsDataSourceDefinition, AXPScreenSize, AXPTagProvider, AXPTagService, AXP_ACTIVITY_LOG_PROVIDER, AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, AXP_COLOR_PALETTE_PROVIDER, AXP_COLUMN_WIDTH_PROVIDER, AXP_CONTEXT_DEFINITION_PROVIDER, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER, AXP_ENTITY_LOGO_FALLBACK_RESOLVER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, AXP_FEATURE_DEFINITION_PROVIDER, AXP_LOGO_IMAGE_SRC_RESOLVER, AXP_LOGO_PROVIDER, AXP_LOGO_THEME_RESOLVER, AXP_MODULE_MANIFEST_PROVIDER, AXP_PLATFORM_LOGO_KEY, AXP_SESSION_SERVICE, AXP_SETTINGS_DEFINITION_DIALOG_OPENER, AXP_TAG_PROVIDER, AX_OVERLAY_CONTAINER_SELECTOR, AX_OVERLAY_PANE_SELECTOR, DEFAULT_CANCEL_DIALOG_ACTION_SHORTCUTS, DEFAULT_SUBMIT_DIALOG_ACTION_SHORTCUTS, FORM_DIRTY_TRACE_NS, OVERLAY_DETAILS_VIEW_TRACE_NS, OVERLAY_LAYOUT_TRACE_NS, OVERLAY_ROOT_LAYOUT_TRACE_NS, OVERLAY_WIDGET_SETTLE_TRACE_NS, applyContextEvalPipes, applyFilterArray, applyPagination, applyQueryArray, applySortArray, applySystemActionDefault, axpApplicationLogoKey, axpExtractLogoUrl, axpSsoLogoKey, axpTenantLogoKey, chordToKbdItemKeys, contextEvalWithPipes, createProviderWithInjectionContext, defaultColumnWidthProvider, findOverlayContainerAncestor, formatKeyboardShortcutChord, formatKeyboardShortcutChords, getNestedVisibleOverlayPanes, getPrimaryKeyboardShortcutChord, getTopVisibleOverlayContainer, getVisibleAnchoredOverlayPanes, getVisibleOverlayContainers, hasForegroundOverlayLayer, instantiateWithInjectionContext, isDialogShortcutAllowedInEditableField, isHorizontalDirectionalShortcutKey, isKeyboardTargetInsideEditableField, isMacPlatform, isVisibleOverlayElement, matchesDialogActionShortcut, matchesKeyboardShortcutChord, mirrorHorizontalDirectionalKey, normalizeContextEvalPipes, normalizeDialogActionShortcutChord, normalizeExpressionTemplate, normalizeKeyboardShortcut, normalizeKeyboardShortcuts, objectKeyValueTransforms, parseDialogActionShortcut, parseKeyboardShortcutChord, provideLazyProvider, registerPopupFooterKeyboardShortcuts, resolveConfiguredFooterActionShortcuts, resolveDialogActionShortcuts, resolveDisplayShortcutChord, resolveEffectiveDirectionBehavior, resolveSemanticDirectionalKey, setupPopupFooterKeyboardShortcuts, shouldDeferEscapeToOpenOverlay, shouldTriggerDialogActionShortcut };
5191
5095
  //# sourceMappingURL=acorex-platform-framework-client-core.mjs.map