@acorex/platform 20.7.7 → 20.7.8

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.
@@ -5012,7 +5012,9 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
5012
5012
  };
5013
5013
  return await context.expressionEvaluator.evaluate(actionData, scope);
5014
5014
  };
5015
- const evaluatedActions = await evaluateExpressions(relatedEntity?.actions);
5015
+ // Don't evaluate actions here - keep expression strings for lazy evaluation at execution time
5016
+ // This ensures actions use the latest context data when executed
5017
+ const actions = relatedEntity?.actions ?? [];
5016
5018
  const filters = await Promise.all(relatedEntity.conditions?.map(async (c) => {
5017
5019
  const value = await evaluateExpressions(c.value);
5018
5020
  return {
@@ -5027,7 +5029,7 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
5027
5029
  title: `${context.rootTitle}`,
5028
5030
  label: relatedEntity.title,
5029
5031
  icon: relatedEntity.icon || entityDef.icon,
5030
- actions: this.mergeActions(entityDef, evaluatedActions)
5032
+ actions: this.mergeActions(entityDef, actions)
5031
5033
  ?.filter((a) => a.priority === 'primary')
5032
5034
  ?.map((a) => {
5033
5035
  return {
@@ -5051,7 +5053,7 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
5051
5053
  execute: async (command, executeContext) => {
5052
5054
  try {
5053
5055
  const commandName = command.name.split('&')[0];
5054
- const mergedActions = this.mergeActions(entityDef, evaluatedActions);
5056
+ const mergedActions = this.mergeActions(entityDef, actions);
5055
5057
  const action = mergedActions.find((a) => {
5056
5058
  return a.name === commandName || a.name.split('&')[0] === commandName;
5057
5059
  });
@@ -5065,6 +5067,28 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
5065
5067
  },
5066
5068
  };
5067
5069
  }
5070
+ // Evaluate action options with current root context for lazy evaluation
5071
+ // This ensures actions use the latest context data when executed
5072
+ let evaluatedOptions = action.options;
5073
+ if (action.options && context.context && context.expressionEvaluator) {
5074
+ try {
5075
+ const scope = {
5076
+ context: {
5077
+ eval: (path) => {
5078
+ return get(context.context, path);
5079
+ },
5080
+ },
5081
+ };
5082
+ evaluatedOptions = await context.expressionEvaluator.evaluate(action.options, scope);
5083
+ }
5084
+ catch {
5085
+ // Keep original options if evaluation fails
5086
+ evaluatedOptions = action.options;
5087
+ }
5088
+ }
5089
+ const actionData = action.scope == AXPEntityCommandScope.Selected
5090
+ ? executeContext
5091
+ : evaluatedOptions?.['process']?.data || null;
5068
5092
  if (context.commandService.exists(commandName)) {
5069
5093
  // check options for evaluation
5070
5094
  await context.commandService.execute(commandName, {
@@ -5077,13 +5101,11 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
5077
5101
  parentKey: entityDef.parentKey,
5078
5102
  source: `${entityDef.module}.${entityDef.name}`,
5079
5103
  },
5080
- data: action.scope == AXPEntityCommandScope.Selected
5081
- ? executeContext
5082
- : action.options?.['process']?.data || null,
5083
- options: action.options,
5104
+ data: actionData,
5105
+ options: evaluatedOptions,
5084
5106
  metadata: action.metadata,
5085
5107
  },
5086
- options: action.options,
5108
+ options: evaluatedOptions,
5087
5109
  metadata: action.metadata,
5088
5110
  });
5089
5111
  }
@@ -5097,10 +5119,8 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
5097
5119
  parentKey: entityDef.parentKey,
5098
5120
  source: `${entityDef.module}.${entityDef.name}`,
5099
5121
  },
5100
- data: action.scope == AXPEntityCommandScope.Selected
5101
- ? executeContext
5102
- : action.options?.['process']?.data || null,
5103
- options: action.options,
5122
+ data: actionData,
5123
+ options: evaluatedOptions,
5104
5124
  metadata: action.metadata,
5105
5125
  });
5106
5126
  }
@@ -5129,7 +5149,7 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
5129
5149
  options: {
5130
5150
  entity: relatedEntity.entity,
5131
5151
  showEntityActions: false,
5132
- actions: evaluatedActions,
5152
+ actions: actions,
5133
5153
  includeColumns: relatedEntity.columns,
5134
5154
  },
5135
5155
  },
@@ -5216,7 +5236,9 @@ class AXPTabListConverter extends AXPBaseRelatedEntityConverter {
5216
5236
  hidden: true,
5217
5237
  };
5218
5238
  }) ?? []);
5219
- const actions = await evaluateExpressions(relatedEntity.actions);
5239
+ // Don't evaluate actions here - keep expression strings for lazy evaluation at execution time
5240
+ // This ensures actions use the latest context data when executed
5241
+ const actions = relatedEntity.actions;
5220
5242
  return {
5221
5243
  id: entityDef?.name ?? '',
5222
5244
  title: relatedEntity.title ?? entityDef?.title ?? '',
@@ -10742,6 +10764,7 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
10742
10764
  this.deviceService = inject(AXPDeviceService);
10743
10765
  this.commandService = inject(AXPCommandService);
10744
10766
  this.eventService = inject(AXPBroadcastEventService);
10767
+ this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
10745
10768
  this.isMounted = signal(false, ...(ngDevMode ? [{ debugName: "isMounted" }] : []));
10746
10769
  this.entity = signal(null, ...(ngDevMode ? [{ debugName: "entity" }] : []));
10747
10770
  this.listNode = signal(null, ...(ngDevMode ? [{ debugName: "listNode" }] : []));
@@ -10870,7 +10893,32 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
10870
10893
  c.scope == AXPEntityCommandScope.TypeLevel));
10871
10894
  });
10872
10895
  const command = commandName.split('&')[0];
10873
- // const options = await this.evaluateExpressions(action?.options, data);
10896
+ // Get current context from contextService for lazy evaluation
10897
+ const currentContext = this.contextService.initial();
10898
+ console.log('currentContext', currentContext);
10899
+ // Evaluate action options with current context if they contain expressions
10900
+ let evaluatedOptions = action?.options;
10901
+ if (action?.options && currentContext) {
10902
+ try {
10903
+ const scope = {
10904
+ context: {
10905
+ eval: (path) => {
10906
+ console.log({ path });
10907
+ return get(currentContext, path);
10908
+ },
10909
+ },
10910
+ };
10911
+ evaluatedOptions = await this.expressionEvaluator.evaluate(action.options, scope);
10912
+ }
10913
+ catch {
10914
+ // Keep original options if evaluation fails
10915
+ evaluatedOptions = action?.options;
10916
+ }
10917
+ }
10918
+ debugger;
10919
+ const actionData = action?.scope == AXPEntityCommandScope.Selected
10920
+ ? this.selectedItems()
10921
+ : evaluatedOptions?.['process']?.data || null;
10874
10922
  if (this.commandService.exists(command)) {
10875
10923
  await this.commandService.execute(command, {
10876
10924
  __context__: {
@@ -10882,10 +10930,8 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
10882
10930
  parentKey: this.entity()?.parentKey,
10883
10931
  source: `${this.entity()?.module}.${this.entity()?.name}`,
10884
10932
  },
10885
- data: action?.scope == AXPEntityCommandScope.Selected
10886
- ? this.selectedItems()
10887
- : action?.options?.['process']?.data || null,
10888
- options: action?.options,
10933
+ data: actionData,
10934
+ options: evaluatedOptions,
10889
10935
  metadata: action?.metadata,
10890
10936
  },
10891
10937
  });
@@ -10900,10 +10946,8 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
10900
10946
  parentKey: this.entity()?.parentKey,
10901
10947
  source: `${this.entity()?.module}.${this.entity()?.name}`,
10902
10948
  },
10903
- data: action?.scope == AXPEntityCommandScope.Selected
10904
- ? this.selectedItems()
10905
- : action?.options?.['process']?.data || null,
10906
- options: action?.options,
10949
+ data: actionData,
10950
+ options: evaluatedOptions,
10907
10951
  metadata: action?.metadata,
10908
10952
  });
10909
10953
  }
@@ -12401,7 +12445,7 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
12401
12445
  //#region ---- Computed Properties ----
12402
12446
  this.expose = computed(() => this.options()['expose'], ...(ngDevMode ? [{ debugName: "expose" }] : []));
12403
12447
  this.entity = computed(() => this.options()['entity'], ...(ngDevMode ? [{ debugName: "entity" }] : []));
12404
- this.disabled = computed(() => this.options()['disabled'], ...(ngDevMode ? [{ debugName: "disabled" }] : []));
12448
+ this.disabled = computed(() => this.filterMode() ? false : this.options()['disabled'], ...(ngDevMode ? [{ debugName: "disabled" }] : []));
12405
12449
  this.columns = computed(() => this.options()['columns'] ?? [], ...(ngDevMode ? [{ debugName: "columns" }] : []));
12406
12450
  this.textField = computed(() => this.options()['textField'] ?? '', ...(ngDevMode ? [{ debugName: "textField" }] : []));
12407
12451
  this.hasClearButton = computed(() => this.options()['hasClearButton'] ?? false, ...(ngDevMode ? [{ debugName: "hasClearButton" }] : []));
@@ -12485,7 +12529,7 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
12485
12529
  value: newValue,
12486
12530
  displayText: text,
12487
12531
  operation: {
12488
- type: this.multiple() ? 'in' : 'contains',
12532
+ type: this.multiple() ? 'in' : 'equal',
12489
12533
  },
12490
12534
  });
12491
12535
  }
@@ -15043,6 +15087,7 @@ function entityDetailsCreateActions(parentId) {
15043
15087
  canCreateNewOne: true,
15044
15088
  data: {
15045
15089
  [parentId]: '{{context.eval("id")}}',
15090
+ notes: '{{context.eval("displayName")}}',
15046
15091
  },
15047
15092
  },
15048
15093
  },