@acorex/platform 19.2.8 → 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 (106) hide show
  1. package/common/lib/app/application.types.d.ts +10 -2
  2. package/common/lib/utils/expression-evaluator.service.d.ts +3 -1
  3. package/common/lib/utils/index.d.ts +2 -0
  4. package/common/lib/utils/regional-util.service.d.ts +15 -0
  5. package/common/lib/utils/regional.types.d.ts +55 -0
  6. package/fesm2022/acorex-platform-common.mjs +30 -14
  7. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-core.mjs +35 -16
  9. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-layout-builder.mjs +91 -24
  11. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-layout-designer.mjs +48 -28
  13. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-layout-entity.mjs +105 -78
  15. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  16. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-Bl9f4Rtk.mjs → acorex-platform-themes-default-entity-master-create-view.component-Bvwr0PVk.mjs} +9 -5
  17. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Bvwr0PVk.mjs.map +1 -0
  18. 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
  19. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-BzLgFr7D.mjs.map +1 -0
  20. 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
  21. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BAU_s90_.mjs.map +1 -0
  22. package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-B4aBmc5H.mjs → acorex-platform-themes-default-entity-master-single-view.component-BGUrwL2P.mjs} +3 -3
  23. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-BGUrwL2P.mjs.map +1 -0
  24. package/fesm2022/acorex-platform-themes-default-setting-page.component-DYumYm5k.mjs +74 -0
  25. package/fesm2022/acorex-platform-themes-default-setting-page.component-DYumYm5k.mjs.map +1 -0
  26. package/fesm2022/acorex-platform-themes-default-setting-view.component-CsCug3Vu.mjs +71 -0
  27. package/fesm2022/acorex-platform-themes-default-setting-view.component-CsCug3Vu.mjs.map +1 -0
  28. package/fesm2022/acorex-platform-themes-default.mjs +25 -16
  29. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  30. package/fesm2022/acorex-platform-themes-shared.mjs +10 -1
  31. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  32. package/fesm2022/{acorex-platform-widgets-tabular-data-edit-popup.component-B90if8wb.mjs → acorex-platform-widgets-tabular-data-edit-popup.component-BiCinIok.mjs} +13 -11
  33. package/fesm2022/acorex-platform-widgets-tabular-data-edit-popup.component-BiCinIok.mjs.map +1 -0
  34. package/fesm2022/acorex-platform-widgets.mjs +597 -534
  35. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  36. package/layout/builder/lib/builder/datasource-provider.service.d.ts +3 -1
  37. package/layout/builder/lib/builder/widget-map.d.ts +1 -0
  38. package/layout/builder/lib/builder/widget.types.d.ts +15 -0
  39. package/layout/designer/lib/designer/components/drawers/data-sources/data-sources.component.d.ts +3 -0
  40. package/layout/designer/lib/property-viewer/widget-property-viewer.component.d.ts +2 -0
  41. package/layout/entity/lib/entity-detail-list.viewmodel.d.ts +3 -0
  42. package/layout/entity/lib/entity-master-create.viewmodel.d.ts +5 -2
  43. package/layout/entity/lib/entity-master-single.viewmodel.d.ts +1 -1
  44. package/layout/entity/lib/entity-master-update.viewmodel.d.ts +4 -3
  45. package/layout/entity/lib/entity.viewmodel.d.ts +2 -0
  46. package/layout/entity/lib/widgets/lookup-widget/lookup-widget-edit.component.d.ts +0 -2
  47. package/layout/entity/lib/widgets/widget-selector/widget-selector-widget-edit.component.d.ts +0 -2
  48. package/layout/setting/lib/setting.viewmodel.d.ts +3 -0
  49. package/package.json +9 -9
  50. package/themes/default/lib/layouts/base/simple-page/simple-page.layout.d.ts +3 -0
  51. package/themes/default/lib/layouts/entity-layouts/entity-detail-list-view/entity-detail-list-view.component.d.ts +3 -0
  52. package/themes/default/lib/layouts/entity-layouts/entity-master-create-view/entity-master-create-view.component.d.ts +2 -0
  53. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +5 -1
  54. package/themes/default/lib/layouts/entity-layouts/entity-master-modify-view/entity-master-modify-view.component.d.ts +2 -0
  55. package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +3 -0
  56. package/themes/default/lib/layouts/root-layout/components/header/header.component.d.ts +3 -0
  57. package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +5 -0
  58. package/themes/default/lib/layouts/root-layout/root-layout.module.d.ts +2 -1
  59. package/themes/default/lib/layouts/setting-layout/setting-view/setting-view.component.d.ts +3 -0
  60. package/themes/default/lib/pages/theme-palette-preview/theme-palette-preview.page.d.ts +3 -0
  61. package/themes/shared/lib/components/slots/theme-slot.component.d.ts +3 -0
  62. package/themes/shared/lib/setting.keys.d.ts +2 -1
  63. package/themes/shared/lib/theme.service.d.ts +3 -0
  64. package/widgets/lib/properties/data-source.props.d.ts +3 -0
  65. package/widgets/lib/properties/editors.props.d.ts +0 -1
  66. package/widgets/lib/properties/index.d.ts +1 -0
  67. package/widgets/lib/widgets/advance/file/file-box-widget-edit.component.d.ts +6 -4
  68. package/widgets/lib/widgets/charts/bar-chart/bar-chart-widget-edit.component.d.ts +3 -8
  69. package/widgets/lib/widgets/charts/bar-chart/bar-chart.type.d.ts +1 -1
  70. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart-widget-edit.component.d.ts +14 -0
  71. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart-widget.config.d.ts +7 -0
  72. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart.type.d.ts +17 -0
  73. package/widgets/lib/widgets/charts/gauge-chart/index.d.ts +2 -0
  74. package/widgets/lib/widgets/editors/checkbox/checkbox-widget-edit.component.d.ts +0 -2
  75. package/widgets/lib/widgets/editors/color/color-box-widget-edit.component.d.ts +0 -2
  76. package/widgets/lib/widgets/editors/contact/contact-widget-edit.component.d.ts +0 -4
  77. package/widgets/lib/widgets/editors/date-time/date-time-box-widget-edit.component.d.ts +0 -2
  78. package/widgets/lib/widgets/editors/email/email-box-widget-edit.component.d.ts +0 -4
  79. package/widgets/lib/widgets/editors/large-text/large-text-widget-edit.component.d.ts +0 -2
  80. package/widgets/lib/widgets/editors/link/link-widget-edit.component.d.ts +0 -4
  81. package/widgets/lib/widgets/editors/number/number-box-widget-edit.component.d.ts +0 -2
  82. package/widgets/lib/widgets/editors/phone/phone-box-widget-edit.component.d.ts +0 -4
  83. package/widgets/lib/widgets/editors/rich-text/rich-text-widget-edit.component.d.ts +0 -2
  84. package/widgets/lib/widgets/editors/select/select-box-widget-edit.component.d.ts +0 -2
  85. package/widgets/lib/widgets/editors/selection-list/selection-list-widget-edit.component.d.ts +0 -2
  86. package/widgets/lib/widgets/editors/tabular-data/tabular-data-edit-popup.component.d.ts +0 -1
  87. package/widgets/lib/widgets/editors/text/text-box-widget-edit.component.d.ts +0 -2
  88. package/widgets/lib/widgets/validations/base-validation/base-validation.d.ts +3 -2
  89. package/widgets/lib/widgets/validations/between-validation/between-validation-widget-edit.component.d.ts +1 -7
  90. package/widgets/lib/widgets/validations/callback-validation/callback-validation-widget-edit.component.d.ts +1 -7
  91. package/widgets/lib/widgets/validations/equal-validation/equal-validation-widget-edit.component.d.ts +1 -7
  92. package/widgets/lib/widgets/validations/greater-than-validation/greater-than-validation-widget-edit.component.d.ts +1 -7
  93. package/widgets/lib/widgets/validations/less-than-validation/less-than-validation-widget-edit.component.d.ts +1 -7
  94. package/widgets/lib/widgets/validations/max-length-validation/max-length-validation-widget-edit.component.d.ts +1 -7
  95. package/widgets/lib/widgets/validations/min-length-validation/min-length-validation-widget-edit.component.d.ts +1 -7
  96. package/widgets/lib/widgets/validations/regular-expression-validation/regular-expression-validation-widget-edit.component.d.ts +1 -7
  97. package/widgets/lib/widgets/validations/required-validation/required-validation-widget-edit.component.d.ts +1 -7
  98. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Bl9f4Rtk.mjs.map +0 -1
  99. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-De61n012.mjs.map +0 -1
  100. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-U8aBv1Ql.mjs.map +0 -1
  101. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-B4aBmc5H.mjs.map +0 -1
  102. package/fesm2022/acorex-platform-themes-default-setting-page.component-BERYnJnp.mjs +0 -74
  103. package/fesm2022/acorex-platform-themes-default-setting-page.component-BERYnJnp.mjs.map +0 -1
  104. package/fesm2022/acorex-platform-themes-default-setting-view.component-BagAWM4W.mjs +0 -71
  105. package/fesm2022/acorex-platform-themes-default-setting-view.component-BagAWM4W.mjs.map +0 -1
  106. package/fesm2022/acorex-platform-widgets-tabular-data-edit-popup.component-B90if8wb.mjs.map +0 -1
@@ -2,16 +2,16 @@ import * as i2$1 from '@acorex/components/common';
2
2
  import { AXDataSource, AXCommonModule } from '@acorex/components/common';
3
3
  import { AXFormatService } from '@acorex/core/format';
4
4
  import * as i1$3 from '@acorex/platform/common';
5
- import { resolveActionLook, AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPSettingScope, AXPSettingService, AXPExpressionEvaluatorService, AXPRefreshEvent, AXPWorkflowNavigateAction, AXP_SEARCH_DEFINITION_PROVIDER, AXPToastAction } from '@acorex/platform/common';
5
+ import { resolveActionLook, AXPFilterOperatorMiddlewareService, AXPExpressionEvaluatorService, AXPEntityCommandScope, getEntityInfo, AXPSettingScope, AXPSettingService, AXPRefreshEvent, AXPWorkflowNavigateAction, AXP_SEARCH_DEFINITION_PROVIDER, AXPToastAction } from '@acorex/platform/common';
6
6
  import * as i2$3 from '@acorex/platform/workflow';
7
7
  import { AXPWorkflowService, ofType, createWorkFlowEvent, AXPWorkflowAction, AXPWorkflowModule } from '@acorex/platform/workflow';
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
+ 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';
10
13
  import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
11
- import { cloneDeep, set, merge, get, isNil, sortBy } from 'lodash-es';
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;
@@ -119,6 +120,7 @@ class AXPEntityDetailListViewModel {
119
120
  this.formatService = this.injector.get(AXFormatService);
120
121
  this.workflow = this.injector.get(AXPWorkflowService);
121
122
  this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
123
+ this.expressionEvaluator = this.injector.get(AXPExpressionEvaluatorService);
122
124
  this.dataSource = new AXDataSource({
123
125
  byKey: (key) => {
124
126
  const func = this.detailEntity()?.queries.byKey.execute;
@@ -144,6 +146,22 @@ class AXPEntityDetailListViewModel {
144
146
  this.detailEntity()?.interfaces?.detail?.list?.title ??
145
147
  this.detailEntity()?.formats.plural);
146
148
  });
149
+ //****************** Visibility ******************//
150
+ this.hidden = computed(async () => {
151
+ if (typeof this.detailEntityConfig.hidden == 'string') {
152
+ const scope = {
153
+ context: {
154
+ eval: (path) => {
155
+ return get(this.parent.data, path);
156
+ },
157
+ },
158
+ };
159
+ return await this.expressionEvaluator.evaluateExpression(this.parent.data, this.detailEntityConfig.hidden, scope);
160
+ }
161
+ else {
162
+ return this.detailEntityConfig.hidden ?? false;
163
+ }
164
+ });
147
165
  //****************** Inline filter ******************//
148
166
  this.inlineFiltersPlaceholders = computed(() => {
149
167
  //return this.entityDef.properties.filter(p => p.options?.filter?.inline?.enabled).map(c => c.title);
@@ -155,7 +173,16 @@ class AXPEntityDetailListViewModel {
155
173
  //****************** Actions ******************//
156
174
  this.allActions = computed(() => {
157
175
  const list = this.detailEntity()?.interfaces?.master?.list?.actions ?? [];
158
- return list.map((tr) => new AXPEntityCommandTriggerViewModel(this.detailEntity(), tr)) ?? [];
176
+ const detailEntityActionList = this.detailEntityConfig.actions ?? [];
177
+ const mergedActions = list.map((tr) => {
178
+ const commandName = typeof tr.command === 'string' ? tr.command : tr.command.name;
179
+ const overrideAction = detailEntityActionList.find((action) => {
180
+ const actionCommandName = typeof action.command === 'string' ? action.command : action.command.name;
181
+ return actionCommandName === commandName && action.name === tr.name;
182
+ });
183
+ return new AXPEntityCommandTriggerViewModel(this.detailEntity(), overrideAction ?? tr);
184
+ });
185
+ return mergedActions;
159
186
  });
160
187
  this.selectedScopeActionsCount = computed(() => {
161
188
  return this.allActions().filter((a) => a.scope == AXPEntityCommandScope.Selected).length;
@@ -192,6 +219,17 @@ class AXPEntityDetailListViewModel {
192
219
  }
193
220
  return [];
194
221
  });
222
+ this.evaluateExpressions = async (actionData) => {
223
+ const parentData = this.parent.data;
224
+ const scope = {
225
+ context: {
226
+ eval: (path) => {
227
+ return get(parentData, path);
228
+ },
229
+ },
230
+ };
231
+ return await this.expressionEvaluator.evaluateExpression(parentData, actionData, scope);
232
+ };
195
233
  this.initialize();
196
234
  }
197
235
  async initialize() {
@@ -264,30 +302,19 @@ class AXPEntityDetailListViewModel {
264
302
  }
265
303
  //****************** Commands ******************//
266
304
  async executeCommand(commandName, data = null) {
267
- const action = this.allActions().find((c) => c.name == commandName &&
268
- ((this.selectedItems().length
305
+ const action = this.allActions().find((c) => {
306
+ const isSelectedScope = this.selectedItems().length
269
307
  ? c.scope == AXPEntityCommandScope.Selected
270
- : c.scope == AXPEntityCommandScope.Individual) ||
271
- c.scope == AXPEntityCommandScope.TypeLevel));
272
- if (action?.scope == AXPEntityCommandScope.TypeLevel) {
273
- if (data == null) {
274
- data = {};
275
- }
276
- let relatedColumn = null;
277
- this.detailEntityConfig.conditions?.forEach((condition) => {
278
- if (condition.value == 'id') {
279
- relatedColumn = condition.name;
280
- }
281
- });
282
- if (relatedColumn != null) {
283
- data[relatedColumn] = this.parent.data['id'];
284
- }
285
- }
286
- console.log({ action, detailEntity: this.detailEntity });
287
- const command = commandName.split('&')[0];
288
- 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], {
289
316
  entity: getEntityInfo(this.detailEntity()).source,
290
- data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
317
+ data: action.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : initialData,
291
318
  entityInfo: {
292
319
  name: this.detailEntity()?.name,
293
320
  module: this.detailEntity()?.module,
@@ -295,7 +322,7 @@ class AXPEntityDetailListViewModel {
295
322
  parentKey: this.detailEntity()?.parentKey,
296
323
  source: this.detailEntity()?.source,
297
324
  },
298
- options: action?.options,
325
+ options: action.options,
299
326
  });
300
327
  }
301
328
  }
@@ -468,24 +495,26 @@ class AXPEntityCreateViewElementViewModel {
468
495
  formula: widget.formula,
469
496
  triggers: widget.triggers,
470
497
  valueTransforms: widget.valueTransforms,
471
- options: merge(schema.interface?.options,
472
- //this.property.options?.create?.widget,
473
- { validationRules: this.property.validations }),
498
+ options: merge(schema.interface?.options, {
499
+ validations: this.property.validations?.map((c) => ({ rule: c.rule, message: c.message, options: c.options })),
500
+ }),
474
501
  };
475
502
  });
476
503
  }
477
504
  }
478
505
  class AXPEntityMasterCreateViewModel {
479
- constructor(injector, config, initialData = {}, canCreateNewOne = true, redirect = false) {
506
+ constructor(injector, config, initialData = {}, commandOptions) {
480
507
  this.injector = injector;
481
508
  this.config = config;
482
509
  this.initialData = initialData;
510
+ this.commandOptions = commandOptions;
483
511
  this.entityDef = cloneDeep(this.config);
484
512
  this.workflow = this.injector.get(AXPWorkflowService);
485
513
  this.context = signal(this.initialData ?? {});
514
+ this.options = signal(this.commandOptions ?? {});
486
515
  this.isInProgress = signal(false);
487
- this.canCreateNewOne = signal(false);
488
- this.redirect = signal(false);
516
+ this.canCreateNewOne = signal(true);
517
+ this.redirect = signal(true);
489
518
  this.sections = computed(() => {
490
519
  const { interfaces, properties } = this.entityDef;
491
520
  const createProps = interfaces?.master?.create?.properties?.map(({ name }) => name) ?? [];
@@ -507,15 +536,23 @@ class AXPEntityMasterCreateViewModel {
507
536
  }
508
537
  });
509
538
  this.context.set(initialData);
539
+ this.options.set(commandOptions);
510
540
  //
541
+ const { redirect = true, canCreateNewOne = true } = commandOptions?.['process'] ?? {};
511
542
  this.canCreateNewOne.set(canCreateNewOne);
512
543
  this.redirect.set(redirect);
513
544
  }
514
545
  async save() {
515
546
  try {
516
547
  this.isInProgress.set(true);
548
+ this.builder.setStatus(AXPPageStatus.Submitting);
517
549
  const exec = this.entityDef.commands?.create?.execute;
518
- 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);
519
556
  }
520
557
  finally {
521
558
  this.isInProgress.set(false);
@@ -524,12 +561,9 @@ class AXPEntityMasterCreateViewModel {
524
561
  async createNewOne() {
525
562
  await this.workflow.execute('create-entity', {
526
563
  entity: getEntityInfo(this.entityDef).source,
527
- options: {
528
- process: {
529
- redirect: this.redirect(),
530
- canCreateNewOne: this.canCreateNewOne(),
531
- },
532
- },
564
+ options: this.options(),
565
+ data: this.initialData,
566
+ // entityInfo
533
567
  });
534
568
  }
535
569
  }
@@ -539,12 +573,11 @@ class AXPEntityCreateViewModelFactory {
539
573
  this.layout = inject(AXPLayoutThemeService);
540
574
  this.injector = inject(Injector);
541
575
  }
542
- async create(moduleName, entityName, initialData = null, options = { canCreateNewOne: false, redirect: true }) {
543
- console.log(options);
576
+ async create(moduleName, entityName, initialData = null, options = { canCreateNewOne: true, redirect: true }) {
544
577
  this.layout.setNavigationLoading(true);
545
578
  const config = await this.entityService.resolve(moduleName, entityName);
546
579
  this.layout.setNavigationLoading(false);
547
- return new AXPEntityMasterCreateViewModel(this.injector, config, initialData, options.canCreateNewOne, options.redirect);
580
+ return new AXPEntityMasterCreateViewModel(this.injector, config, initialData, options);
548
581
  }
549
582
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
550
583
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateViewModelFactory, providedIn: 'root' }); }
@@ -776,14 +809,10 @@ class AXPEntityMasterListViewModel {
776
809
  const actions = await Promise.all(this.allActions()
777
810
  .filter((a) => a.scope === AXPEntityCommandScope.Individual && a.priority === 'secondary')
778
811
  .map(async (a) => {
779
- const isHidden = typeof a.hidden === 'string' && a.hidden.includes('{{')
780
- ? await this.expressionEvaluator.evaluateExpression(rowData, a.hidden, scope)
781
- : a.hidden;
812
+ const isHidden = await this.expressionEvaluator.evaluateExpression(rowData, a.hidden, scope);
782
813
  if (isHidden)
783
814
  return null;
784
- const disabled = typeof a.disabled === 'string' && a.disabled.includes('{{')
785
- ? await this.expressionEvaluator.evaluateExpression(rowData, a.disabled, scope)
786
- : a.disabled;
815
+ const disabled = await this.expressionEvaluator.evaluateExpression(rowData, a.disabled, scope);
787
816
  return { ...a, disabled };
788
817
  }));
789
818
  return actions.filter(Boolean);
@@ -896,7 +925,7 @@ class AXPEntityMasterListViewModel {
896
925
  filters: cleanedNestedFilters.filter(Boolean),
897
926
  };
898
927
  }
899
- if (filter.value === null || filter.value === undefined || filter.value === 'unknown') {
928
+ if (!filter.value || filter.value === 'unknown') {
900
929
  return undefined;
901
930
  }
902
931
  return filter;
@@ -975,6 +1004,7 @@ class AXPEntityMasterListViewModel {
975
1004
  },
976
1005
  data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
977
1006
  options: action?.options,
1007
+ metadata: action?.metadata,
978
1008
  });
979
1009
  }
980
1010
  //
@@ -1158,12 +1188,12 @@ class AXPEntityMasterUpdateElementViewModel {
1158
1188
  return !(this.property.schema.readonly ?? false);
1159
1189
  });
1160
1190
  this.isRequired = computed(() => {
1161
- return this.property.validations?.some(c => c.rule == 'required') || false;
1191
+ return this.property.validations?.some((c) => c.rule == 'required') || false;
1162
1192
  });
1163
1193
  this.layout = computed(() => {
1164
- 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);
1165
1195
  const source = cloneDeep(updateProp?.layout ?? {});
1166
- set(source, "positions.default.colSpan", 12);
1196
+ set(source, 'positions.default.colSpan', 12);
1167
1197
  return source;
1168
1198
  });
1169
1199
  this.node = computed(() => {
@@ -1177,9 +1207,9 @@ class AXPEntityMasterUpdateElementViewModel {
1177
1207
  formula: widget.formula,
1178
1208
  triggers: widget.triggers,
1179
1209
  valueTransforms: widget.valueTransforms,
1180
- options: merge(schema.interface?.options,
1181
- //this.property.options?.create?.widget,
1182
- { validationRules: this.property.validations })
1210
+ options: merge(schema.interface?.options, {
1211
+ validations: this.property.validations?.map((c) => ({ rule: c.rule, message: c.message, options: c.options })),
1212
+ }),
1183
1213
  };
1184
1214
  });
1185
1215
  }
@@ -1195,22 +1225,27 @@ class AXPEntityMasterUpdateViewModel {
1195
1225
  this.isInProgress = signal(false);
1196
1226
  this.context = signal(cloneDeep(this.entityData));
1197
1227
  this.elements = computed(() => {
1198
- const props = this.entityDef.properties.filter(c => this.props.includes(c.name) &&
1199
- c.schema.hidden != true);
1200
- 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) => {
1201
1230
  return new AXPEntityMasterUpdateElementViewModel(this.entityDef, e);
1202
1231
  });
1203
1232
  });
1204
1233
  }
1205
1234
  async save() {
1206
1235
  this.isInProgress.set(true);
1236
+ this.builder.setStatus(AXPPageStatus.Submitting);
1207
1237
  try {
1208
1238
  const com = this.entityDef.commands?.update;
1209
1239
  if (com) {
1210
1240
  const exec = com.execute;
1211
- return await exec(this.context());
1241
+ const result = await exec(this.context());
1242
+ this.builder.setStatus(AXPPageStatus.Submitted);
1243
+ return result;
1212
1244
  }
1213
1245
  }
1246
+ catch (error) {
1247
+ this.builder.setStatus(AXPPageStatus.Error);
1248
+ }
1214
1249
  finally {
1215
1250
  this.isInProgress.set(false);
1216
1251
  }
@@ -1362,7 +1397,6 @@ class AXPEntityMasterSingleViewGroupViewModel {
1362
1397
  });
1363
1398
  this.props = computed(() => {
1364
1399
  const { properties, interfaces } = this.entity;
1365
- console.log({ properties });
1366
1400
  const groupProperties = properties
1367
1401
  .filter(({ groupId, schema }) => groupId === this.group.id && !schema.hidden)
1368
1402
  .map(({ name }) => name);
@@ -1406,10 +1440,7 @@ class AXPEntityMasterSingleElementViewModel {
1406
1440
  children: widget.children,
1407
1441
  formula: widget.formula,
1408
1442
  valueTransforms: widget.valueTransforms,
1409
- options: merge(schema.interface?.options
1410
- //this.property.options?.create?.widget,
1411
- //{ validationRules: this.property.validations },
1412
- ),
1443
+ options: merge(schema.interface?.options),
1413
1444
  };
1414
1445
  });
1415
1446
  }
@@ -1481,8 +1512,10 @@ class AXPEntityMasterSingleViewModel {
1481
1512
  },
1482
1513
  ];
1483
1514
  });
1484
- this.relatedEntities = computed(() => {
1485
- return (this.entityDef.relatedEntities?.map((re) => new AXPEntityDetailListViewModel(this.injector, re, { entity: this.entityDef, data: this.entityData })) ?? []);
1515
+ this.relatedEntities = computed(async () => {
1516
+ const relatedEntities = this.entityDef.relatedEntities?.map((re) => new AXPEntityDetailListViewModel(this.injector, re, { entity: this.entityDef, data: this.entityData })) ?? [];
1517
+ const filteredEntities = await Promise.all(relatedEntities.map(async (re) => ((await re.hidden()) ? null : re)));
1518
+ return filteredEntities.filter((re) => re !== null);
1486
1519
  });
1487
1520
  this.workflow.events$
1488
1521
  .pipe(ofType(AXPEntityDeletedEvent))
@@ -2026,7 +2059,6 @@ class AXPLookupWidgetEditComponent extends AXPWidgetComponent {
2026
2059
  this.translateService = inject(AXTranslationService);
2027
2060
  this.expose = computed(() => this.options()['expose']);
2028
2061
  this.entity = computed(() => this.options()['entity']);
2029
- this.validationRules = computed(() => this.options()['validationRules'] ?? []);
2030
2062
  this.textField = computed(() => {
2031
2063
  return (this.entityDef()?.formats.lookup ?? this.entityDef()?.properties.find((c) => c.name != 'id')?.name ?? 'title');
2032
2064
  });
@@ -2394,7 +2426,6 @@ class AXPWidgetSelectorWidgetEditComponent extends AXPWidgetComponent {
2394
2426
  this.selectedItem = signal(null);
2395
2427
  this.placeholder = computed(() => this.options()['placeholder'] ?? '');
2396
2428
  this.loading = computed(() => this.options()['loading'] ?? false);
2397
- this.validationRules = computed(() => this.options()['validationRules']);
2398
2429
  }
2399
2430
  ngAfterViewInit() {
2400
2431
  if (this.getValue()) {
@@ -2549,9 +2580,9 @@ class AXPEntityCreatePopupAction extends AXPWorkflowAction {
2549
2580
  console.log('data', data);
2550
2581
  const process = options?.['process'];
2551
2582
  const decoration = options?.['decoration'];
2583
+ const layout = options?.['layout'];
2552
2584
  const headerTitle = decoration?.header?.title;
2553
- const redirect = process?.redirect;
2554
- const canCreateNewOne = process?.canCreateNewOne;
2585
+ const size = layout?.size;
2555
2586
  const entityRef = await this.entityRegistery.resolve(module, entity);
2556
2587
  const com = await this.config.viewers.master.create();
2557
2588
  if (entityRef.parentKey) {
@@ -2561,18 +2592,14 @@ class AXPEntityCreatePopupAction extends AXPWorkflowAction {
2561
2592
  title: headerTitle
2562
2593
  ? headerTitle
2563
2594
  : `${await this.translateService.translateAsync('create-new')} ${await this.translateService.translateAsync(entityRef.formats.individual)}`,
2564
- size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
2595
+ size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : size ? size : 'md',
2565
2596
  data: {
2566
- vm: await this.factory.create(module, entity, data, {
2567
- canCreateNewOne,
2568
- redirect,
2569
- }),
2597
+ vm: await this.factory.create(module, entity, data, options),
2570
2598
  entity,
2571
2599
  },
2572
2600
  });
2573
2601
  context.setOutput('result', false);
2574
2602
  if (result.data?.save) {
2575
- console.log(result);
2576
2603
  context.setOutput('result', true);
2577
2604
  const prevData = context.getVariable('data');
2578
2605
  const prevMeta = context.getVariable('meta');