@acorex/platform 19.2.9 → 19.2.10

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 (42) hide show
  1. package/common/lib/app/application.types.d.ts +3 -2
  2. package/common/lib/utils/expression-evaluator.service.d.ts +3 -1
  3. package/fesm2022/acorex-platform-common.mjs +26 -12
  4. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-layout-builder.mjs +20 -4
  6. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-designer.mjs +31 -12
  8. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-entity.mjs +45 -64
  10. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  11. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-BK8BItxL.mjs → acorex-platform-themes-default-entity-master-create-view.component-Bvwr0PVk.mjs} +8 -4
  12. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Bvwr0PVk.mjs.map +1 -0
  13. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-De61n012.mjs → acorex-platform-themes-default-entity-master-list-view.component-BzLgFr7D.mjs} +8 -3
  14. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-BzLgFr7D.mjs.map +1 -0
  15. package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-U8aBv1Ql.mjs → acorex-platform-themes-default-entity-master-modify-view.component-BAU_s90_.mjs} +8 -4
  16. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BAU_s90_.mjs.map +1 -0
  17. package/fesm2022/{acorex-platform-themes-default-setting-page.component-CN2NCgUv.mjs → acorex-platform-themes-default-setting-page.component-DYumYm5k.mjs} +3 -3
  18. package/fesm2022/{acorex-platform-themes-default-setting-page.component-CN2NCgUv.mjs.map → acorex-platform-themes-default-setting-page.component-DYumYm5k.mjs.map} +1 -1
  19. package/fesm2022/acorex-platform-themes-default.mjs +14 -15
  20. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  21. package/fesm2022/acorex-platform-widgets.mjs +215 -124
  22. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  23. package/layout/builder/lib/builder/widget-map.d.ts +1 -0
  24. package/layout/builder/lib/builder/widget.types.d.ts +13 -0
  25. package/layout/designer/lib/designer/components/drawers/data-sources/data-sources.component.d.ts +3 -0
  26. package/layout/entity/lib/entity-master-create.viewmodel.d.ts +2 -1
  27. package/layout/entity/lib/entity-master-update.viewmodel.d.ts +4 -3
  28. package/layout/entity/lib/entity.viewmodel.d.ts +2 -0
  29. package/package.json +5 -5
  30. package/themes/default/lib/layouts/entity-layouts/entity-master-create-view/entity-master-create-view.component.d.ts +2 -0
  31. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +2 -1
  32. package/themes/default/lib/layouts/entity-layouts/entity-master-modify-view/entity-master-modify-view.component.d.ts +2 -0
  33. package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +0 -1
  34. package/widgets/lib/widgets/advance/file/file-box-widget-edit.component.d.ts +6 -4
  35. package/widgets/lib/widgets/charts/bar-chart/bar-chart-widget-edit.component.d.ts +3 -3
  36. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart-widget-edit.component.d.ts +14 -0
  37. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart-widget.config.d.ts +7 -0
  38. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart.type.d.ts +17 -0
  39. package/widgets/lib/widgets/charts/gauge-chart/index.d.ts +2 -0
  40. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-BK8BItxL.mjs.map +0 -1
  41. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-De61n012.mjs.map +0 -1
  42. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-U8aBv1Ql.mjs.map +0 -1
@@ -8,10 +8,10 @@ import { AXPWorkflowService, ofType, createWorkFlowEvent, AXPWorkflowAction, AXP
8
8
  import * as i0 from '@angular/core';
9
9
  import { InjectionToken, inject, Injectable, computed, signal, Injector, effect, Component, ChangeDetectionStrategy, HostBinding, DestroyRef, ViewChild, NgModule } from '@angular/core';
10
10
  import { get, cloneDeep, set, merge, isNil, sortBy } from 'lodash-es';
11
+ import * as i7 from '@acorex/platform/layout/builder';
12
+ import { AXPPageStatus, AXPWidgetRegistryService, AXPWidgetComponent, AXPLayoutBuilderModule, AXPColumnWidgetComponent, AXP_WIDGETS_EDITOR_GROUP, AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
11
13
  import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
12
14
  import { AXPSessionService, AXPAuthGuard } from '@acorex/platform/auth';
13
- import * as i7 from '@acorex/platform/layout/builder';
14
- import { AXPWidgetRegistryService, AXPWidgetComponent, AXPLayoutBuilderModule, AXPColumnWidgetComponent, AXP_WIDGETS_EDITOR_GROUP, AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
15
15
  import { Subject, takeUntil } from 'rxjs';
16
16
  import * as i8 from '@acorex/core/translation';
17
17
  import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
@@ -79,6 +79,7 @@ class AXPEntityCommandTriggerViewModel {
79
79
  constructor(entity, action) {
80
80
  this.name = `${typeof action.command === 'string' ? action.command : action.command.name}&${action.name}`;
81
81
  this.options = typeof action.command === 'object' ? action.command.options : undefined;
82
+ this.metadata = typeof action.command === 'object' ? action.command.metadata : undefined;
82
83
  const resolvedLook = resolveActionLook(action);
83
84
  this.priority = action.priority;
84
85
  this.title = action.title;
@@ -227,22 +228,7 @@ class AXPEntityDetailListViewModel {
227
228
  },
228
229
  },
229
230
  };
230
- const evaluateRecursive = async (data) => {
231
- const evaluatedData = {};
232
- for (const key in data) {
233
- if (typeof data[key] === 'object' && data[key] !== null) {
234
- evaluatedData[key] = await evaluateRecursive(data[key]);
235
- }
236
- else if (typeof data[key] === 'string' && data[key].includes('{{')) {
237
- evaluatedData[key] = await this.expressionEvaluator.evaluateExpression(parentData, data[key], scope);
238
- }
239
- else {
240
- evaluatedData[key] = data[key];
241
- }
242
- }
243
- return evaluatedData;
244
- };
245
- return await evaluateRecursive(actionData);
231
+ return await this.expressionEvaluator.evaluateExpression(parentData, actionData, scope);
246
232
  };
247
233
  this.initialize();
248
234
  }
@@ -316,34 +302,19 @@ class AXPEntityDetailListViewModel {
316
302
  }
317
303
  //****************** Commands ******************//
318
304
  async executeCommand(commandName, data = null) {
319
- const action = this.allActions().find((c) => c.name == commandName &&
320
- ((this.selectedItems().length
305
+ const action = this.allActions().find((c) => {
306
+ const isSelectedScope = this.selectedItems().length
321
307
  ? c.scope == AXPEntityCommandScope.Selected
322
- : c.scope == AXPEntityCommandScope.Individual) ||
323
- c.scope == AXPEntityCommandScope.TypeLevel));
324
- // if (action?.scope == AXPEntityCommandScope.TypeLevel) {
325
- // if (data == null) {
326
- // data = {};
327
- // }
328
- // let relatedColumn: string | null = null;
329
- // this.detailEntityConfig.conditions?.forEach((condition) => {
330
- // if (condition.value == 'id') {
331
- // relatedColumn = condition.name;
332
- // }
333
- // });
334
- // if (relatedColumn != null) {
335
- // data[relatedColumn] = this.parent.data['id'];
336
- // }
337
- // }
338
- const actionData = action?.options?.process?.data;
339
- let initialData = {};
340
- if (actionData) {
341
- initialData = await this.evaluateExpressions(actionData);
342
- }
343
- const command = commandName.split('&')[0];
344
- await this.workflow.execute(command, {
308
+ : c.scope == AXPEntityCommandScope.Individual;
309
+ return c.name == commandName && (isSelectedScope || c.scope == AXPEntityCommandScope.TypeLevel);
310
+ });
311
+ if (!action)
312
+ return;
313
+ const actionData = action.options?.process?.data;
314
+ const initialData = actionData ? { ...data, ...(await this.evaluateExpressions(actionData)) } : data;
315
+ await this.workflow.execute(commandName.split('&')[0], {
345
316
  entity: getEntityInfo(this.detailEntity()).source,
346
- data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : initialData,
317
+ data: action.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : initialData,
347
318
  entityInfo: {
348
319
  name: this.detailEntity()?.name,
349
320
  module: this.detailEntity()?.module,
@@ -351,7 +322,7 @@ class AXPEntityDetailListViewModel {
351
322
  parentKey: this.detailEntity()?.parentKey,
352
323
  source: this.detailEntity()?.source,
353
324
  },
354
- options: action?.options,
325
+ options: action.options,
355
326
  });
356
327
  }
357
328
  }
@@ -542,8 +513,8 @@ class AXPEntityMasterCreateViewModel {
542
513
  this.context = signal(this.initialData ?? {});
543
514
  this.options = signal(this.commandOptions ?? {});
544
515
  this.isInProgress = signal(false);
545
- this.canCreateNewOne = signal(false);
546
- this.redirect = signal(false);
516
+ this.canCreateNewOne = signal(true);
517
+ this.redirect = signal(true);
547
518
  this.sections = computed(() => {
548
519
  const { interfaces, properties } = this.entityDef;
549
520
  const createProps = interfaces?.master?.create?.properties?.map(({ name }) => name) ?? [];
@@ -567,15 +538,21 @@ class AXPEntityMasterCreateViewModel {
567
538
  this.context.set(initialData);
568
539
  this.options.set(commandOptions);
569
540
  //
570
- const { redirect = false, canCreateNewOne = false } = commandOptions['process'];
541
+ const { redirect = true, canCreateNewOne = true } = commandOptions?.['process'] ?? {};
571
542
  this.canCreateNewOne.set(canCreateNewOne);
572
543
  this.redirect.set(redirect);
573
544
  }
574
545
  async save() {
575
546
  try {
576
547
  this.isInProgress.set(true);
548
+ this.builder.setStatus(AXPPageStatus.Submitting);
577
549
  const exec = this.entityDef.commands?.create?.execute;
578
- return await exec(this.context());
550
+ const result = await exec(this.context());
551
+ this.builder.setStatus(AXPPageStatus.Submitted);
552
+ return result;
553
+ }
554
+ catch (error) {
555
+ this.builder.setStatus(AXPPageStatus.Error);
579
556
  }
580
557
  finally {
581
558
  this.isInProgress.set(false);
@@ -596,7 +573,7 @@ class AXPEntityCreateViewModelFactory {
596
573
  this.layout = inject(AXPLayoutThemeService);
597
574
  this.injector = inject(Injector);
598
575
  }
599
- async create(moduleName, entityName, initialData = null, options = { canCreateNewOne: false, redirect: true }) {
576
+ async create(moduleName, entityName, initialData = null, options = { canCreateNewOne: true, redirect: true }) {
600
577
  this.layout.setNavigationLoading(true);
601
578
  const config = await this.entityService.resolve(moduleName, entityName);
602
579
  this.layout.setNavigationLoading(false);
@@ -832,14 +809,10 @@ class AXPEntityMasterListViewModel {
832
809
  const actions = await Promise.all(this.allActions()
833
810
  .filter((a) => a.scope === AXPEntityCommandScope.Individual && a.priority === 'secondary')
834
811
  .map(async (a) => {
835
- const isHidden = typeof a.hidden === 'string' && a.hidden.includes('{{')
836
- ? await this.expressionEvaluator.evaluateExpression(rowData, a.hidden, scope)
837
- : a.hidden;
812
+ const isHidden = await this.expressionEvaluator.evaluateExpression(rowData, a.hidden, scope);
838
813
  if (isHidden)
839
814
  return null;
840
- const disabled = typeof a.disabled === 'string' && a.disabled.includes('{{')
841
- ? await this.expressionEvaluator.evaluateExpression(rowData, a.disabled, scope)
842
- : a.disabled;
815
+ const disabled = await this.expressionEvaluator.evaluateExpression(rowData, a.disabled, scope);
843
816
  return { ...a, disabled };
844
817
  }));
845
818
  return actions.filter(Boolean);
@@ -1031,6 +1004,7 @@ class AXPEntityMasterListViewModel {
1031
1004
  },
1032
1005
  data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
1033
1006
  options: action?.options,
1007
+ metadata: action?.metadata,
1034
1008
  });
1035
1009
  }
1036
1010
  //
@@ -1214,12 +1188,12 @@ class AXPEntityMasterUpdateElementViewModel {
1214
1188
  return !(this.property.schema.readonly ?? false);
1215
1189
  });
1216
1190
  this.isRequired = computed(() => {
1217
- return this.property.validations?.some(c => c.rule == 'required') || false;
1191
+ return this.property.validations?.some((c) => c.rule == 'required') || false;
1218
1192
  });
1219
1193
  this.layout = computed(() => {
1220
- const updateProp = this.entity.interfaces?.master?.update?.properties?.find(c => c.name == this.property.name);
1194
+ const updateProp = this.entity.interfaces?.master?.update?.properties?.find((c) => c.name == this.property.name);
1221
1195
  const source = cloneDeep(updateProp?.layout ?? {});
1222
- set(source, "positions.default.colSpan", 12);
1196
+ set(source, 'positions.default.colSpan', 12);
1223
1197
  return source;
1224
1198
  });
1225
1199
  this.node = computed(() => {
@@ -1233,7 +1207,9 @@ class AXPEntityMasterUpdateElementViewModel {
1233
1207
  formula: widget.formula,
1234
1208
  triggers: widget.triggers,
1235
1209
  valueTransforms: widget.valueTransforms,
1236
- options: merge(schema.interface?.options, { validations: this.property.validations?.map(c => ({ rule: c.rule, message: c.message, options: c.options })) })
1210
+ options: merge(schema.interface?.options, {
1211
+ validations: this.property.validations?.map((c) => ({ rule: c.rule, message: c.message, options: c.options })),
1212
+ }),
1237
1213
  };
1238
1214
  });
1239
1215
  }
@@ -1249,22 +1225,27 @@ class AXPEntityMasterUpdateViewModel {
1249
1225
  this.isInProgress = signal(false);
1250
1226
  this.context = signal(cloneDeep(this.entityData));
1251
1227
  this.elements = computed(() => {
1252
- const props = this.entityDef.properties.filter(c => this.props.includes(c.name) &&
1253
- c.schema.hidden != true);
1254
- return props.map(e => {
1228
+ const props = this.entityDef.properties.filter((c) => this.props.includes(c.name) && c.schema.hidden != true);
1229
+ return props.map((e) => {
1255
1230
  return new AXPEntityMasterUpdateElementViewModel(this.entityDef, e);
1256
1231
  });
1257
1232
  });
1258
1233
  }
1259
1234
  async save() {
1260
1235
  this.isInProgress.set(true);
1236
+ this.builder.setStatus(AXPPageStatus.Submitting);
1261
1237
  try {
1262
1238
  const com = this.entityDef.commands?.update;
1263
1239
  if (com) {
1264
1240
  const exec = com.execute;
1265
- return await exec(this.context());
1241
+ const result = await exec(this.context());
1242
+ this.builder.setStatus(AXPPageStatus.Submitted);
1243
+ return result;
1266
1244
  }
1267
1245
  }
1246
+ catch (error) {
1247
+ this.builder.setStatus(AXPPageStatus.Error);
1248
+ }
1268
1249
  finally {
1269
1250
  this.isInProgress.set(false);
1270
1251
  }