@acorex/platform 19.1.3 → 19.1.5

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 (157) hide show
  1. package/common/index.d.ts +1 -0
  2. package/common/lib/app/application.types.d.ts +2 -2
  3. package/common/lib/file-storage/file-storage.service.d.ts +13 -0
  4. package/common/lib/file-storage/file-storage.types.d.ts +143 -0
  5. package/common/lib/file-storage/index.d.ts +2 -0
  6. package/common/lib/filters/filters.types.d.ts +2 -1
  7. package/common/lib/settings/setting-definition.provider.d.ts +12 -5
  8. package/common/lib/settings/setting.builder.d.ts +4 -3
  9. package/common/lib/settings/settings.provider.d.ts +2 -7
  10. package/common/lib/settings/settings.service.d.ts +19 -7
  11. package/common/lib/settings/settings.types.d.ts +15 -2
  12. package/common/lib/workflows/common.workflow.d.ts +11 -0
  13. package/core/utils/highlighter.d.ts +1 -1
  14. package/fesm2022/acorex-platform-common.mjs +194 -74
  15. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  16. package/fesm2022/acorex-platform-core.mjs +2 -2
  17. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  18. package/fesm2022/acorex-platform-layout-builder.mjs +290 -456
  19. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  20. package/fesm2022/acorex-platform-layout-designer.mjs +13 -13
  21. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  22. package/fesm2022/acorex-platform-layout-entity.mjs +595 -584
  23. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  24. package/fesm2022/acorex-platform-layout-filters.mjs +82 -6
  25. package/fesm2022/acorex-platform-layout-filters.mjs.map +1 -1
  26. package/fesm2022/acorex-platform-layout-setting.mjs +73 -91
  27. package/fesm2022/acorex-platform-layout-setting.mjs.map +1 -1
  28. package/fesm2022/acorex-platform-layouts.mjs +3 -4
  29. package/fesm2022/acorex-platform-layouts.mjs.map +1 -1
  30. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-K9B_-q_K.mjs +108 -0
  31. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-K9B_-q_K.mjs.map +1 -0
  32. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-xlBBA76O.mjs +369 -0
  33. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-xlBBA76O.mjs.map +1 -0
  34. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Cd2gxLZt.mjs +87 -0
  35. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Cd2gxLZt.mjs.map +1 -0
  36. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-6sZdw013.mjs +130 -0
  37. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-6sZdw013.mjs.map +1 -0
  38. package/fesm2022/acorex-platform-themes-default-setting-page.component-BYpCgHZb.mjs +74 -0
  39. package/fesm2022/acorex-platform-themes-default-setting-page.component-BYpCgHZb.mjs.map +1 -0
  40. package/fesm2022/acorex-platform-themes-default-setting-view.component-CdmIphX1.mjs +73 -0
  41. package/fesm2022/acorex-platform-themes-default-setting-view.component-CdmIphX1.mjs.map +1 -0
  42. package/fesm2022/acorex-platform-themes-default.mjs +20 -20
  43. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  44. package/fesm2022/acorex-platform-themes-shared.mjs +288 -81
  45. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  46. package/fesm2022/{acorex-platform-widgets-checkbox-widget-column.component-05nKV-UV.mjs → acorex-platform-widgets-checkbox-widget-column.component-jeZBOEhl.mjs} +18 -14
  47. package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-jeZBOEhl.mjs.map +1 -0
  48. package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs → acorex-platform-widgets-checkbox-widget-designer.component-D8KErkus.mjs} +3 -3
  49. package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs.map → acorex-platform-widgets-checkbox-widget-designer.component-D8KErkus.mjs.map} +1 -1
  50. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-DU1niJES.mjs +64 -0
  51. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-DU1niJES.mjs.map +1 -0
  52. package/fesm2022/acorex-platform-widgets.mjs +2306 -549
  53. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  54. package/fesm2022/acorex-platform-workflow.mjs +9 -3
  55. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  56. package/layout/builder/lib/builder/builder.module.d.ts +10 -10
  57. package/layout/builder/lib/builder/builder.service.d.ts +9 -10
  58. package/layout/builder/lib/builder/context-store.service.d.ts +33 -0
  59. package/layout/builder/lib/builder/index.d.ts +4 -2
  60. package/layout/builder/lib/builder/widget-catalog.d.ts +1 -1
  61. package/layout/builder/lib/builder/widget-container.component.d.ts +34 -9
  62. package/layout/builder/lib/builder/widget-groups.d.ts +1 -0
  63. package/layout/builder/lib/builder/widget-map.d.ts +48 -0
  64. package/layout/builder/lib/builder/widget-placeholder.component.d.ts +5 -0
  65. package/layout/builder/lib/builder/{widget-renderer.component.directive.d.ts → widget-renderer.directive.d.ts} +27 -1
  66. package/layout/builder/lib/builder/widget-status.types.d.ts +14 -0
  67. package/layout/builder/lib/builder/widget.types.d.ts +45 -55
  68. package/layout/designer/lib/preview/preview-viewer.component.d.ts +2 -2
  69. package/layout/designer/lib/property-viewer/widget-property-viewer.component.d.ts +2 -2
  70. package/layout/entity/lib/entity-master-list.viewmodel.d.ts +7 -2
  71. package/layout/entity/lib/widgets/lookup-widget/lookup-widget-edit.component.d.ts +0 -1
  72. package/layout/filters/lib/filters.viewmodel.d.ts +13 -3
  73. package/layout/setting/lib/convert-setting-data.d.ts +0 -20
  74. package/layout/setting/lib/setting.viewmodel.d.ts +65 -4
  75. package/layouts/lib/admin/entity-layout/entity-details-view/entity-details-view.component.d.ts +15 -5
  76. package/package.json +9 -9
  77. package/themes/default/lib/layouts/base/simple-page/simple-page.layout.d.ts +15 -5
  78. package/themes/default/lib/layouts/entity-layouts/entity-detail-list-view/entity-detail-list-view.component.d.ts +15 -5
  79. package/themes/default/lib/layouts/entity-layouts/entity-master-create-view/entity-master-create-view.component.d.ts +2 -1
  80. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +17 -6
  81. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/list-view-option-filters/list-view-option-filters.component.d.ts +6 -3
  82. package/themes/default/lib/layouts/entity-layouts/entity-master-modify-view/entity-master-modify-view.component.d.ts +2 -1
  83. package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +15 -5
  84. package/themes/default/lib/layouts/filters-layout/simple-filter-builder/filters-view.component.d.ts +6 -5
  85. package/themes/default/lib/layouts/root-layout/components/header/header.component.d.ts +15 -5
  86. package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +15 -5
  87. package/themes/default/lib/layouts/setting-layout/setting-page/setting-page.component.d.ts +0 -47
  88. package/themes/default/lib/layouts/setting-layout/setting-view/setting-view.component.d.ts +19 -5
  89. package/themes/shared/index.d.ts +3 -1
  90. package/themes/shared/lib/components/theme-slot.component.d.ts +23 -13
  91. package/themes/shared/lib/palette.provider.d.ts +9 -0
  92. package/themes/shared/lib/setting.keys.d.ts +7 -2
  93. package/themes/shared/lib/setting.provider.d.ts +1 -0
  94. package/themes/shared/lib/shared.module.d.ts +2 -1
  95. package/themes/shared/lib/{services/theme.service.d.ts → theme.service.d.ts} +16 -24
  96. package/themes/shared/lib/theme.types.d.ts +25 -0
  97. package/themes/shared/lib/widgets/theme-color-selection/index.d.ts +2 -0
  98. package/themes/shared/lib/widgets/theme-color-selection/theme-color-selection-widget-edit.component.d.ts +6 -0
  99. package/themes/shared/lib/widgets/theme-color-selection/theme-color-selection-widget.config.d.ts +7 -0
  100. package/widgets/lib/properties/layout.props.d.ts +1 -0
  101. package/widgets/lib/widgets/advance/avatar/avatar-widget-column.component.d.ts +6 -0
  102. package/widgets/lib/widgets/advance/avatar/avatar-widget-designer.component.d.ts +6 -0
  103. package/widgets/lib/widgets/advance/avatar/avatar-widget-edit.component.d.ts +18 -0
  104. package/widgets/lib/widgets/advance/avatar/avatar-widget-print.component.d.ts +6 -0
  105. package/widgets/lib/widgets/advance/avatar/avatar-widget-view.component.d.ts +6 -0
  106. package/widgets/lib/widgets/advance/avatar/avatar-widget.config.d.ts +7 -0
  107. package/widgets/lib/widgets/advance/avatar/index.d.ts +6 -0
  108. package/widgets/lib/widgets/advance/map/map-box-widget-edit.component.d.ts +9 -5
  109. package/widgets/lib/widgets/advance/map/map-box-widget-view.component.d.ts +6 -4
  110. package/widgets/lib/widgets/editors/number/number-box-widget-edit.component.d.ts +1 -7
  111. package/widgets/lib/widgets/editors/select/select-box-widget-edit.component.d.ts +1 -1
  112. package/widgets/lib/widgets/editors/toggle/toggle-widget-edit.component.d.ts +0 -2
  113. package/widgets/lib/widgets/filters/boolean-filter/boolean-filter-widget-edit.component.d.ts +18 -0
  114. package/widgets/lib/widgets/filters/boolean-filter/boolean-filter-widget.config.d.ts +7 -0
  115. package/widgets/lib/widgets/filters/boolean-filter/index.d.ts +2 -0
  116. package/widgets/lib/widgets/filters/date-time-filter/date-time-filter-widget-edit.component.d.ts +20 -0
  117. package/widgets/lib/widgets/filters/date-time-filter/date-time-filter-widget.config.d.ts +7 -0
  118. package/widgets/lib/widgets/filters/date-time-filter/index.d.ts +2 -0
  119. package/widgets/lib/widgets/filters/number-filter/index.d.ts +2 -0
  120. package/widgets/lib/widgets/filters/number-filter/number-filter-widget-edit.component.d.ts +12 -0
  121. package/widgets/lib/widgets/filters/number-filter/number-filter-widget.config.d.ts +7 -0
  122. package/widgets/lib/widgets/filters/operations/operations.component.d.ts +9 -0
  123. package/widgets/lib/widgets/filters/select-filter/index.d.ts +2 -0
  124. package/widgets/lib/widgets/filters/select-filter/select-filter-widget-edit.component.d.ts +16 -0
  125. package/widgets/lib/widgets/filters/select-filter/select-filter-widget.config.d.ts +7 -0
  126. package/widgets/lib/widgets/filters/string-filter/index.d.ts +2 -0
  127. package/widgets/lib/widgets/filters/string-filter/string-filter-widget-edit.component.d.ts +12 -0
  128. package/widgets/lib/widgets/filters/string-filter/string-filter-widget.config.d.ts +7 -0
  129. package/widgets/lib/widgets/index.d.ts +5 -1
  130. package/widgets/lib/widgets/property-editors/border/border-widget-editor.component.d.ts +29 -7
  131. package/widgets/lib/widgets/property-editors/border/index.d.ts +0 -1
  132. package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget-editor.component.d.ts +36 -0
  133. package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget.config.d.ts +7 -0
  134. package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget.type.d.ts +18 -0
  135. package/widgets/lib/widgets/property-editors/flex-options/index.d.ts +3 -0
  136. package/widgets/lib/widgets/property-editors/property-editor-helper.d.ts +82 -0
  137. package/widgets/lib/widgets/property-editors/property-editor.type.d.ts +35 -0
  138. package/widgets/lib/widgets/property-editors/spacing/index.d.ts +0 -1
  139. package/widgets/lib/widgets/property-editors/spacing/spacing-widget-editor.component.d.ts +11 -9
  140. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-CSyR4pYp.mjs +0 -108
  141. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-CSyR4pYp.mjs.map +0 -1
  142. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-xHWp2Lk-.mjs +0 -368
  143. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-xHWp2Lk-.mjs.map +0 -1
  144. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-n7mYNduJ.mjs +0 -87
  145. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-n7mYNduJ.mjs.map +0 -1
  146. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-DjyYU0Gy.mjs +0 -130
  147. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-DjyYU0Gy.mjs.map +0 -1
  148. package/fesm2022/acorex-platform-themes-default-setting-page.component-6Dd8MGqr.mjs +0 -78
  149. package/fesm2022/acorex-platform-themes-default-setting-page.component-6Dd8MGqr.mjs.map +0 -1
  150. package/fesm2022/acorex-platform-themes-default-setting-view.component-BgiMClew.mjs +0 -58
  151. package/fesm2022/acorex-platform-themes-default-setting-view.component-BgiMClew.mjs.map +0 -1
  152. package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-05nKV-UV.mjs.map +0 -1
  153. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-BkWcZ4K9.mjs +0 -72
  154. package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-BkWcZ4K9.mjs.map +0 -1
  155. package/layout/builder/lib/builder/widget-renderer.component.d.ts +0 -48
  156. package/widgets/lib/widgets/property-editors/border/border-widget-type.d.ts +0 -18
  157. package/widgets/lib/widgets/property-editors/spacing/spacing-widget-type.d.ts +0 -16
@@ -1,23 +1,23 @@
1
1
  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
- import { resolveActionLook, AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPSettingValueProviderService, AXPWorkflowNavigateAction } from '@acorex/platform/common';
4
+ import { resolveActionLook, AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPSettingScope, AXPSettingValueProviderService, AXPRefreshEvent, AXPWorkflowNavigateAction } from '@acorex/platform/common';
5
5
  import * as i1$3 from '@acorex/platform/workflow';
6
- import { AXPWorkflowService, createWorkFlowEvent, AXPWorkflowAction, ofType, AXPWorkflowModule } from '@acorex/platform/workflow';
6
+ import { AXPWorkflowService, ofType, createWorkFlowEvent, AXPWorkflowAction, AXPWorkflowModule } from '@acorex/platform/workflow';
7
7
  import * as i0 from '@angular/core';
8
8
  import { InjectionToken, inject, Injectable, computed, signal, Injector, effect, Component, ChangeDetectionStrategy, HostBinding, DestroyRef, ViewChild, NgModule } from '@angular/core';
9
9
  import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
10
10
  import { cloneDeep, set, merge, isNil, get, sortBy } from 'lodash-es';
11
11
  import { AXPSessionService, AXPAuthGuard } from '@acorex/platform/auth';
12
+ import * as i7 from '@acorex/platform/layout/builder';
13
+ import { AXPWidgetRegistryService, AXPWidgetComponent, AXPLayoutBuilderModule, AXPColumnWidgetComponent, AXP_WIDGETS_EDITOR_GROUP, AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
12
14
  import { Subject, takeUntil } from 'rxjs';
13
- import { AXPopupService } from '@acorex/components/popup';
14
- import { AXPlatform } from '@acorex/core/platform';
15
- import * as i8 from '@acorex/core/translation';
16
- import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
17
15
  import { AXDialogService } from '@acorex/components/dialog';
18
16
  import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
19
- import * as i7 from '@acorex/platform/layout/builder';
20
- import { AXPWidgetComponent, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPColumnWidgetComponent, AXP_WIDGETS_EDITOR_GROUP, AXPWidgetsCatalog, AXPWidgetRegistryService } from '@acorex/platform/layout/builder';
17
+ import * as i8 from '@acorex/core/translation';
18
+ import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
19
+ import { AXPopupService } from '@acorex/components/popup';
20
+ import { AXPlatform } from '@acorex/core/platform';
21
21
  import { RouterModule, ROUTES } from '@angular/router';
22
22
  import * as i1 from '@acorex/components/loading';
23
23
  import { AXLoadingModule } from '@acorex/components/loading';
@@ -35,7 +35,6 @@ import { AXSelectBoxModule } from '@acorex/components/select-box';
35
35
  import * as i2$2 from '@acorex/components/text-box';
36
36
  import { AXTextBoxComponent, AXTextBoxModule } from '@acorex/components/text-box';
37
37
  import { AXValidationModule } from '@acorex/core/validation';
38
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
39
38
  import * as i1$2 from '@angular/forms';
40
39
  import { FormsModule } from '@angular/forms';
41
40
  import * as i5 from '@acorex/components/data-table';
@@ -494,505 +493,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
494
493
  args: [{ providedIn: 'root' }]
495
494
  }] });
496
495
 
497
- const AXPEntityCreateEvent = createWorkFlowEvent('[Entity] Created!');
498
- class AXPEntityCreatePopupAction extends AXPWorkflowAction {
499
- constructor() {
500
- super(...arguments);
501
- this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
502
- this.popupService = inject(AXPopupService);
503
- this.platform = inject(AXPlatform);
504
- this.factory = inject(AXPEntityCreateViewModelFactory);
505
- this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
506
- this.translateService = inject(AXTranslationService);
507
- }
508
- async execute(context) {
509
- const [module, entity] = context.getVariable('entity').split('.');
510
- const data = context.getVariable('data');
511
- const options = context.getVariable('options');
512
- const redirect = options?.['redirect'];
513
- const canCreateNewOne = options?.['canCreateNewOne'];
514
- const entityRef = await this.entityRegistery.resolve(module, entity);
515
- const com = await this.config.viewers.master.create();
516
- const result = await this.popupService.open(com, {
517
- title: `${await this.translateService.translateAsync('create-new')} ${await this.translateService.translateAsync(entityRef.formats.individual)}`,
518
- size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
519
- data: {
520
- vm: await this.factory.create(module, entity, data, { canCreateNewOne, redirect }),
521
- entity,
522
- },
523
- });
524
- context.setOutput('result', false);
525
- if (result.data?.save) {
526
- context.setOutput('result', true);
527
- const prevData = context.getVariable('data');
528
- context.setVariable('data', { ...prevData, ...result.data.item });
529
- }
496
+ class AXPEntityMasterListViewQueryViewModel {
497
+ constructor(entity, section, view) {
498
+ this.entity = entity;
499
+ this.section = section;
500
+ this.view = view;
501
+ this.name = this.view.name;
502
+ this.title = this.view.title;
503
+ this.sorts = this.view.sorts;
504
+ this.columns = this.view.columns;
505
+ this.conditions = this.view.conditions;
506
+ this.indexCol = this.view.indexCol;
507
+ this.pageSize = this.view.pageSize;
530
508
  }
531
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
532
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction }); }
533
509
  }
534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction, decorators: [{
535
- type: Injectable
536
- }] });
537
- class AXPEntityCreateSubmittedAction extends AXPWorkflowAction {
538
- async execute(context) {
539
- this.dispatch(AXPEntityCreateEvent({ entity: context.getVariable('entity'), meta: context.getVariable('meta') }));
510
+ class AXPEntityMasterListViewModel {
511
+ async setView(viewName = null) {
512
+ this.settingSelectedViewKey = `${this.config.module}:${this.config.name}:selected-view`;
513
+ const savedViewName = await this.settings.get(this.settingSelectedViewKey);
514
+ // this.settings.set()
515
+ if (viewName != this.view().name) {
516
+ this.view.set(this.views().find((c) => c.name == (viewName || savedViewName)) ?? this.views()[0]);
517
+ this.settings.scope(AXPSettingScope.User).set(this.settingSelectedViewKey, this.view().name);
518
+ this.applyViewSorts();
519
+ this.applyViewColumns();
520
+ this.applyViewFilters();
521
+ this.applyFilterAndSort();
522
+ this.applySettings();
523
+ }
540
524
  }
541
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
542
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction }); }
543
- }
544
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction, decorators: [{
545
- type: Injectable
546
- }] });
547
- const AXPCreateEntityWorkflow = {
548
- startStepId: 'show-popup',
549
- steps: {
550
- 'show-popup': {
551
- action: 'AXPEntityCreatePopupAction',
552
- nextSteps: [
553
- {
554
- conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
555
- nextStepId: 'show-toast',
556
- },
557
- ],
558
- },
559
- 'show-toast': {
560
- action: 'AXPToastAction',
561
- input: {
562
- color: 'success',
563
- title: 'workflow.entity-created',
564
- content: 'workflow.entity-created-body',
525
+ constructor(injector, config) {
526
+ this.injector = injector;
527
+ this.config = config;
528
+ this.entityDef = cloneDeep(this.config);
529
+ this._viewDef = cloneDeep(this.entityDef.interfaces?.master?.list);
530
+ this.formatService = this.injector.get(AXFormatService);
531
+ this.session = this.injector.get(AXPSessionService);
532
+ this.workflow = this.injector.get(AXPWorkflowService);
533
+ this.settings = this.injector.get(AXPSettingValueProviderService);
534
+ this.widgetResolver = this.injector.get(AXPWidgetRegistryService);
535
+ this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
536
+ this.settingListViewKey = '';
537
+ this.settingSelectedViewKey = '';
538
+ this.destroyed = new Subject();
539
+ this.events$ = new Subject();
540
+ //****************** Views ******************//
541
+ this.views = computed(() => {
542
+ const views = this.entityDef.interfaces?.master?.list?.views ?? [];
543
+ return views.map((v) => {
544
+ return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
545
+ });
546
+ });
547
+ this.view = signal(this.views()[0]);
548
+ this.dataSource = new AXDataSource({
549
+ byKey: (key) => {
550
+ const func = this.entityDef.queries.byKey.execute;
551
+ return func();
565
552
  },
566
- nextSteps: [
567
- {
568
- conditions: [],
569
- nextStepId: 'dispatch-event',
570
- },
571
- ],
572
- },
573
- 'dispatch-event': {
574
- action: 'AXPEntityCreateSubmittedAction',
575
- nextSteps: [
553
+ load: (e) => {
554
+ const func = this.entityDef.queries.list?.execute;
555
+ return func(e);
556
+ },
557
+ pageSize: this.view().pageSize || 10,
558
+ key: 'id',
559
+ });
560
+ this.selectedItems = signal([]);
561
+ this.parentKey = computed(() => {
562
+ return this.entityDef.parentKey;
563
+ });
564
+ this.hasSelectedItems = computed(() => {
565
+ return this.selectedItems().length > 0;
566
+ });
567
+ //****************** Title ******************//
568
+ this.title = computed(() => {
569
+ return this._viewDef.title ?? this.entityDef.formats.plural;
570
+ });
571
+ //****************** Description ******************//
572
+ this.description = computed(() => {
573
+ return this._viewDef.description ?? null;
574
+ });
575
+ //****************** Inline filter ******************//
576
+ this.inlineFiltersPlaceholders = computed(() => {
577
+ return this.entityDef.properties.filter((p) => p.options?.filter?.inline?.enabled).map((c) => c.title ?? c.name);
578
+ });
579
+ this.hasInlineFilters = computed(() => {
580
+ return this.inlineFiltersPlaceholders().length > 0;
581
+ });
582
+ //****************** Beardcrumbs ******************//
583
+ this.beardcrumbs = computed(() => {
584
+ return [
576
585
  {
577
- conditions: [{ type: 'SINGLE', expression: 'context.getVariable("options")?.redirect != false' }],
578
- nextStepId: 'show-entity',
586
+ title: 'entity.home',
587
+ icon: 'fa-solid fa-home ax-text-xs ax-me-2',
588
+ url: [`/${this.session.application?.name}`],
579
589
  },
580
- ],
581
- },
582
- 'show-entity': {
583
- action: 'AXPShowDetailViewAction',
584
- },
585
- },
586
- };
587
-
588
- const AXPEntityDeletedEvent = createWorkFlowEvent('[Entity] Deleted');
589
- class AXPEntityPerformDeleteAction extends AXPWorkflowAction {
590
- constructor() {
591
- super(...arguments);
592
- this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
593
- this.dialogService = inject(AXDialogService);
594
- this.loadingDialog = inject(AXLoadingDialogService);
595
- this.translationService = inject(AXTranslationService);
596
- }
597
- async execute(context) {
598
- const moduleEntity = context.getVariable('entity');
599
- const [moduleName, entityName] = moduleEntity.split('.');
600
- const data = context.getVariable('data');
601
- const meta = context.getVariable('meta');
602
- const ids = Array.isArray(data) ? data.map((c) => c.id) : [data.id];
603
- const entity = await this.entityRegistery.resolve(moduleName, entityName);
604
- let deletedCount = 0;
605
- context.setVariable('deleteSuccessful', false);
606
- const dialog = this.loadingDialog.show({
607
- title: await this.translationService.translateAsync('workflow.deleting'),
608
- mode: 'determinate',
609
- status: 'Deleting...',
610
- progressValue: 0,
611
- text: `0/${ids.length}`,
612
- buttons: [
613
590
  {
614
- text: await this.translationService.translateAsync('cancel'),
615
- color: 'danger',
616
- onClick: () => {
617
- dialog.close();
618
- },
591
+ title: this.title(),
592
+ url: [
593
+ `/${this.session.application?.name}`,
594
+ 'm',
595
+ `${this.entityDef.module}`,
596
+ 'e',
597
+ `${this.entityDef.name}`,
598
+ 'list',
599
+ ],
619
600
  },
620
- ],
621
- });
622
- if (entity.commands?.delete != null) {
623
- const deleteExec = entity.commands?.delete?.execute;
624
- const wrappedPromises = ids
625
- .map((id, i) => {
626
- return new Promise((resolve) => {
627
- setTimeout(() => {
628
- resolve(deleteExec(id));
629
- }, i * 200);
630
- });
631
- })
632
- .map((p) => p?.then((value) => {
633
- deletedCount++;
634
- dialog.setProgressText(`${deletedCount}/${ids.length}`);
635
- dialog.setProgressValue((deletedCount / ids.length) * 100);
636
- return { status: 'fulfilled', value };
637
- }, (reason) => ({ status: 'rejected', reason })));
638
- const results = await Promise.all(wrappedPromises);
639
- const successfulPromises = results.filter((result) => result?.status === 'fulfilled').length;
640
- const failedPromises = results.filter((result) => result?.status === 'rejected').length;
641
- setTimeout(() => {
642
- dialog.close();
643
- }, 300);
644
- // Handle different scenarios for alerts
645
- if (successfulPromises > 0 && failedPromises === 0) {
646
- // All items deleted successfully
647
- await this.dialogService.alert(await this.translationService.translateAsync('workflow.success-delete-title'), await this.translationService.translateAsync('workflow.success-delete-body', {
648
- params: { item: successfulPromises },
649
- }), //TODO test translation
650
- 'success');
651
- // Dispatch actions
652
- this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids, meta: meta }));
653
- }
654
- else if (successfulPromises > 0 && failedPromises > 0) {
655
- // Some items deleted successfully, some failed
656
- await this.dialogService.alert(await this.translationService.translateAsync('workflow.success-partial-delete-title'), await this.translationService.translateAsync('workflow.partial-delete-body', {
657
- params: { success: successfulPromises, fail: failedPromises },
658
- }), 'warning');
659
- // Dispatch actions
660
- this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids, meta: meta }));
661
- }
662
- else if (successfulPromises === 0 && failedPromises > 0) {
663
- // No items deleted, all failed
664
- await this.dialogService.alert(await this.translationService.translateAsync('workflow.fail-delete-title'), await this.translationService.translateAsync('workflow.fail-delete-body', {
665
- params: { item: failedPromises },
666
- }), 'danger');
667
- }
668
- else {
669
- // No items to delete (no successful or failed promises)
670
- await this.dialogService.alert(await this.translationService.translateAsync('workflow.no-need'), await this.translationService.translateAsync('workflow.no-item'), 'info');
671
- }
672
- }
673
- else {
674
- throw new Error(`The delete operation cannot be performed on ${entity.title}. This action might be restricted or not applicable for the selected item.`);
675
- }
676
- }
677
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
678
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction }); }
679
- }
680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction, decorators: [{
681
- type: Injectable
682
- }] });
683
- const AXPDeleteEntityWorkflow = {
684
- startStepId: 'confirm-delete',
685
- steps: {
686
- 'confirm-delete': {
687
- action: 'show-prompt-dialog',
688
- input: {
689
- title: 'workflow.warning',
690
- message: `workflow.confirm-delete`,
691
- type: 'danger',
692
- },
693
- nextSteps: [
694
- {
695
- conditions: [
696
- {
697
- type: 'AND',
698
- conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
699
- },
700
- ],
701
- nextStepId: 'perform-delete',
702
- },
703
- ],
704
- },
705
- 'perform-delete': {
706
- action: 'entity-perform-delete',
707
- },
708
- },
709
- };
710
-
711
- class AXPEntityMasterUpdateElementViewModel {
712
- constructor(entity, property) {
713
- this.entity = entity;
714
- this.property = property;
715
- this.name = signal(this.property.name);
716
- this.title = signal(this.property.title);
717
- this.description = signal(this.property.description);
718
- this.editable = computed(() => {
719
- return !(this.property.schema.readonly ?? false);
720
- });
721
- this.isRequired = computed(() => {
722
- return this.property.validations?.some(c => c.rule == 'required') || false;
723
- });
724
- this.layout = computed(() => {
725
- const updateProp = this.entity.interfaces?.master?.update?.properties?.find(c => c.name == this.property.name);
726
- const source = cloneDeep(updateProp?.layout ?? {});
727
- set(source, "positions.default.colSpan", 12);
728
- return source;
729
- });
730
- this.node = computed(() => {
731
- const schema = this.property.schema;
732
- const widget = schema.interface;
733
- return {
734
- type: widget.type,
735
- mode: this.editable() ? 'edit' : 'view',
736
- path: this.name(),
737
- children: widget.children,
738
- formula: widget.formula,
739
- triggers: widget.triggers,
740
- options: merge(schema.interface?.options,
741
- //this.property.options?.create?.widget,
742
- { validationRules: this.property.validations })
743
- };
744
- });
745
- }
746
- }
747
- class AXPEntityMasterUpdateViewModel {
748
- constructor(injector, config, entityData, props) {
749
- this.injector = injector;
750
- this.config = config;
751
- this.entityData = entityData;
752
- this.props = props;
753
- this.entityDef = cloneDeep(this.config);
754
- this.workflow = this.injector.get(AXPWorkflowService);
755
- this.isInProgress = signal(false);
756
- this.context = signal(cloneDeep(this.entityData));
757
- this.elements = computed(() => {
758
- const props = this.entityDef.properties.filter(c => this.props.includes(c.name) &&
759
- c.schema.hidden != true);
760
- return props.map(e => {
761
- return new AXPEntityMasterUpdateElementViewModel(this.entityDef, e);
762
- });
763
- });
764
- }
765
- async save() {
766
- this.isInProgress.set(true);
767
- try {
768
- const com = this.entityDef.commands?.update;
769
- if (com) {
770
- const exec = com.execute;
771
- return await exec(this.context());
772
- }
773
- }
774
- finally {
775
- this.isInProgress.set(false);
776
- }
777
- }
778
- reset() {
779
- this.context.set(cloneDeep(this.entityData));
780
- }
781
- }
782
- class AXPEntityMasterUpdateViewModelFactory {
783
- constructor() {
784
- this.entityService = inject(AXPEntityDefinitionRegistryService);
785
- this.layout = inject(AXPLayoutThemeService);
786
- this.injector = inject(Injector);
787
- }
788
- async create(moduleName, entityName, id, props) {
789
- const config = await this.entityService.resolve(moduleName, entityName);
790
- this.layout.setNavigationLoading(true);
791
- if (config.queries.byKey) {
792
- const func = config.queries.byKey.execute;
793
- const data = await func(id);
794
- this.layout.setNavigationLoading(false);
795
- return new AXPEntityMasterUpdateViewModel(this.injector, config, data, props);
796
- }
797
- this.layout.setNavigationLoading(false);
798
- return Promise.reject('cannot fetch ');
799
- }
800
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
801
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, providedIn: 'root' }); }
802
- }
803
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, decorators: [{
804
- type: Injectable,
805
- args: [{ providedIn: 'root' }]
806
- }] });
807
-
808
- const AXPEntityModifyEvent = createWorkFlowEvent('[Entity] Modified');
809
- class AXPEntityModifySectionPopupAction extends AXPWorkflowAction {
810
- constructor() {
811
- super(...arguments);
812
- this.popupService = inject(AXPopupService);
813
- this.platform = inject(AXPlatform);
814
- this.translateService = inject(AXTranslationService);
815
- this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
816
- this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
817
- this.factory = inject(AXPEntityMasterUpdateViewModelFactory);
818
- }
819
- async execute(context) {
820
- const [moduleName, entityName] = context.getVariable('entity').split('.');
821
- const { properties, id, title } = context.getVariable('data');
822
- const entityRef = await this.entityRegistery.resolve(moduleName, entityName);
823
- const vm = await this.factory.create(moduleName, entityName, id, properties);
824
- const com = await this.config.viewers.master.modify();
825
- const popup = await this.popupService.open(com, {
826
- title: title ?? `${this.translateService.translateSync('entity.modify')} ${this.translateService.translateSync(entityRef.formats.individual)}`,
827
- size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
828
- data: {
829
- vm,
830
- properties,
831
- entity: entityRef,
832
- },
833
- });
834
- context.setOutput('result', false);
835
- if (popup.data?.result == true) {
836
- context.setOutput('result', true);
837
- context.setVariable('data', cloneDeep(popup.data.context));
838
- }
839
- }
840
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
841
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction }); }
842
- }
843
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction, decorators: [{
844
- type: Injectable
845
- }] });
846
- class AXPEntityModifyConfirmedAction extends AXPWorkflowAction {
847
- async execute(context) {
848
- const updatedData = context.getVariable('data');
849
- this.dispatch(AXPEntityModifyEvent({ entity: context.getVariable('entity'), values: updatedData }));
850
- }
851
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
852
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction }); }
853
- }
854
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction, decorators: [{
855
- type: Injectable
856
- }] });
857
- const AXPModifyEntitySectionWorkflow = {
858
- startStepId: 'modifyPopup',
859
- steps: {
860
- modifyPopup: {
861
- id: 'modifyPopup',
862
- action: 'AXPEntityModifySectionPopupAction',
863
- nextSteps: [
864
- {
865
- conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
866
- nextStepId: 'successToast',
867
- },
868
- ],
869
- },
870
- successToast: {
871
- id: 'successToast',
872
- action: 'AXPToastAction',
873
- input: {
874
- color: 'success',
875
- title: 'workflow.entity-modified-title',
876
- content: 'workflow.entity-modified-body',
877
- },
878
- nextSteps: [
879
- {
880
- conditions: [],
881
- nextStepId: 'modifyConfirmed',
882
- },
883
- ],
884
- },
885
- modifyConfirmed: {
886
- id: 'modifyConfirmed',
887
- action: 'AXPEntityModifyConfirmedAction',
888
- },
889
- },
890
- };
891
-
892
- class AXPEntityMasterListViewQueryViewModel {
893
- constructor(entity, section, view) {
894
- this.entity = entity;
895
- this.section = section;
896
- this.view = view;
897
- this.name = this.view.name;
898
- this.title = this.view.title;
899
- this.sorts = this.view.sorts;
900
- this.columns = this.view.columns;
901
- this.conditions = this.view.conditions;
902
- this.indexCol = this.view.indexCol;
903
- this.pageSize = this.view.pageSize;
904
- }
905
- }
906
- class AXPEntityMasterListViewModel {
907
- async setView(viewName = null) {
908
- this.settingSelectedViewKey = `${this.config.module}:${this.config.name}:selected-view`;
909
- const savedViewName = await this.settings.get(this.settingSelectedViewKey);
910
- // this.settings.set()
911
- if (viewName != this.view().name) {
912
- this.view.set(this.views().find((c) => c.name == (viewName || savedViewName)) ?? this.views()[0]);
913
- this.settings.set(this.settingSelectedViewKey, this.view().name);
914
- this.applyViewSorts();
915
- this.applyViewColumns();
916
- this.applyFilterAndSort();
917
- this.applySettings();
918
- }
919
- }
920
- constructor(injector, config) {
921
- this.injector = injector;
922
- this.config = config;
923
- this.entityDef = cloneDeep(this.config);
924
- this._viewDef = cloneDeep(this.entityDef.interfaces?.master?.list);
925
- this.formatService = this.injector.get(AXFormatService);
926
- this.session = this.injector.get(AXPSessionService);
927
- this.workflow = this.injector.get(AXPWorkflowService);
928
- this.settings = this.injector.get(AXPSettingValueProviderService);
929
- this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
930
- this.settingListViewKey = '';
931
- this.settingSelectedViewKey = '';
932
- this.destroyed = new Subject();
933
- this.events$ = new Subject();
934
- //****************** Views ******************//
935
- this.views = computed(() => {
936
- const views = this.entityDef.interfaces?.master?.list?.views ?? [];
937
- return views.map((v) => {
938
- return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
939
- });
940
- });
941
- this.view = signal(this.views()[0]);
942
- this.dataSource = new AXDataSource({
943
- byKey: (key) => {
944
- const func = this.entityDef.queries.byKey.execute;
945
- return func();
946
- },
947
- load: (e) => {
948
- const func = this.entityDef.queries.list?.execute;
949
- return func(e);
950
- },
951
- pageSize: this.view().pageSize || 10,
952
- key: 'id',
953
- });
954
- this.selectedItems = signal([]);
955
- this.parentKey = computed(() => {
956
- return this.entityDef.parentKey;
957
- });
958
- this.hasSelectedItems = computed(() => {
959
- return this.selectedItems().length > 0;
960
- });
961
- //****************** Title ******************//
962
- this.title = computed(() => {
963
- return this._viewDef.title ?? this.entityDef.formats.plural;
964
- });
965
- //****************** Description ******************//
966
- this.description = computed(() => {
967
- return this._viewDef.description ?? null;
968
- });
969
- //****************** Inline filter ******************//
970
- this.inlineFiltersPlaceholders = computed(() => {
971
- return this.entityDef.properties.filter((p) => p.options?.filter?.inline?.enabled).map((c) => c.title ?? c.name);
972
- });
973
- this.hasInlineFilters = computed(() => {
974
- return this.inlineFiltersPlaceholders().length > 0;
975
- });
976
- //****************** Beardcrumbs ******************//
977
- this.beardcrumbs = computed(() => {
978
- return [
979
- {
980
- title: 'entity.home',
981
- icon: 'fa-solid fa-home ax-text-xs ax-me-2',
982
- url: [`/${this.session.application?.name}`],
983
- },
984
- {
985
- title: this.title(),
986
- url: [
987
- `/${this.session.application?.name}`,
988
- 'm',
989
- `${this.entityDef.module}`,
990
- 'e',
991
- `${this.entityDef.name}`,
992
- 'list',
993
- ],
994
- },
995
- ];
601
+ ];
996
602
  });
997
603
  //****************** Actions ******************//
998
604
  this.allActions = computed(() => {
@@ -1015,15 +621,20 @@ class AXPEntityMasterListViewModel {
1015
621
  this.primaryRowActions = computed(() => this.allActions().filter((a) => a.scope == AXPEntityCommandScope.Individual && a.priority === 'primary'));
1016
622
  this.secondaryRowActions = computed(() => this.allActions().filter((a) => a.scope == AXPEntityCommandScope.Individual && a.priority === 'secondary'));
1017
623
  //****************** Filter ******************//
1018
- this.inlineFilters = {
624
+ this.simpleFilters = signal({
1019
625
  field: null,
1020
- logic: 'or',
626
+ logic: 'and',
1021
627
  operator: null,
1022
- filters: [],
1023
- };
1024
- this.advanceFilters = {
628
+ filters: this.view().conditions.map((f) => ({
629
+ field: f.name,
630
+ operator: f.operator,
631
+ value: f.value,
632
+ })),
633
+ });
634
+ this.lastFiltersApplied = signal(this.simpleFilters());
635
+ this.inlineFilters = {
1025
636
  field: null,
1026
- logic: 'and',
637
+ logic: 'or',
1027
638
  operator: null,
1028
639
  filters: [],
1029
640
  };
@@ -1068,10 +679,9 @@ class AXPEntityMasterListViewModel {
1068
679
  };
1069
680
  this.sortedFields = signal([]);
1070
681
  this.workflow.events$
1071
- .pipe(ofType(AXPEntityDeletedEvent, AXPEntityCreateEvent, AXPEntityModifyEvent))
682
+ .pipe(ofType(AXPRefreshEvent))
1072
683
  .pipe(takeUntil(this.destroyed))
1073
684
  .subscribe((event) => {
1074
- console.log('omed');
1075
685
  if (event.payload.entity == getEntityInfo(this.entityDef).source) {
1076
686
  this.selectedItems.set([]);
1077
687
  this.events$.next({ action: 'refresh' });
@@ -1096,20 +706,36 @@ class AXPEntityMasterListViewModel {
1096
706
  get filtersDef() {
1097
707
  const props = this.entityDef.properties.filter((c) => c.options?.filter?.advance?.enabled);
1098
708
  return props.map((e) => {
709
+ const widgetConfig = this.widgetResolver.resolve(e.schema.interface?.type);
710
+ const type = (e.options?.filter?.advance?.widgetType ||
711
+ widgetConfig?.defaultFilterWidgetName ||
712
+ e.schema.interface?.type);
1099
713
  return {
1100
714
  title: e.title,
1101
715
  field: e.name,
1102
716
  operator: {
1103
717
  type: 'equal',
1104
718
  },
1105
- widget: {
1106
- type: e.schema.interface?.type,
1107
- },
719
+ widget: { ...e.schema.interface, path: e.name, type },
1108
720
  filters: [],
1109
721
  isParametric: false,
1110
722
  };
1111
723
  });
1112
724
  }
725
+ applyViewFilters() {
726
+ const viewFilters = this.view().conditions.map((f) => ({
727
+ field: f.name,
728
+ operator: f.operator,
729
+ value: f.value,
730
+ }));
731
+ this.simpleFilters.update((prev) => ({ ...prev, filters: viewFilters }));
732
+ }
733
+ resetFilters() {
734
+ this.applyViewFilters();
735
+ }
736
+ discardFilters() {
737
+ this.simpleFilters.set(this.lastFiltersApplied());
738
+ }
1113
739
  applyInlineFilter(value) {
1114
740
  const props = this.entityDef.properties.filter((c) => c.options?.filter?.inline?.enabled);
1115
741
  this.inlineFilters.filters = [];
@@ -1128,32 +754,18 @@ class AXPEntityMasterListViewModel {
1128
754
  }
1129
755
  applyFilterAndSort() {
1130
756
  this.dataSource.clearFilter();
1131
- //
1132
757
  this.dataSource.sort(...this.sortedFields().map((s) => ({ dir: s.dir, field: s.name })));
1133
- //
1134
- this.advanceFilters.filters = this.view().conditions.map((f) => ({
1135
- field: f.name,
1136
- operator: f.operator,
1137
- value: f.value,
758
+ const allFilters = [
759
+ this.inlineFilters.filters?.length && this.inlineFilters,
760
+ this.simpleFilters().filters?.length && this.simpleFilters(),
761
+ ].filter(Boolean);
762
+ this.lastFiltersApplied.set(this.simpleFilters());
763
+ this.dataSource.filter(this.filterOperatorMiddleware.transformFilter({
764
+ field: null,
765
+ logic: 'and',
766
+ operator: null,
767
+ filters: allFilters,
1138
768
  }));
1139
- //
1140
- const inline = this.inlineFilters.filters?.length ?? 0;
1141
- const advance = this.advanceFilters.filters?.length ?? 0;
1142
- if (inline && !advance) {
1143
- this.dataSource.filter(this.filterOperatorMiddleware.transformFilter(this.inlineFilters));
1144
- }
1145
- else if (!inline && advance) {
1146
- this.dataSource.filter(this.filterOperatorMiddleware.transformFilter(this.advanceFilters));
1147
- }
1148
- else if (inline && advance) {
1149
- this.dataSource.filter(this.filterOperatorMiddleware.transformFilter({
1150
- field: null,
1151
- logic: 'and',
1152
- operator: null,
1153
- filters: [this.inlineFilters, this.advanceFilters],
1154
- }));
1155
- }
1156
- //
1157
769
  this.dataSource.refresh();
1158
770
  }
1159
771
  resetColumns() {
@@ -1162,7 +774,7 @@ class AXPEntityMasterListViewModel {
1162
774
  async onColumnsChanged(columns) {
1163
775
  const listViewSetting = await this.settings.get(this.settingListViewKey);
1164
776
  if (this.settingListViewKey) {
1165
- this.settings.set(this.settingListViewKey, {
777
+ this.settings.scope(AXPSettingScope.User).set(this.settingListViewKey, {
1166
778
  ...listViewSetting,
1167
779
  columns: columns.map((c) => ({ name: c.name, visible: c.visible })),
1168
780
  });
@@ -1207,57 +819,363 @@ class AXPEntityMasterListViewModel {
1207
819
  });
1208
820
  });
1209
821
  }
1210
- //****************** Commands ******************//
1211
- async executeCommand(commandName, data = null) {
1212
- const action = this.allActions().find((c) => c.name == commandName &&
1213
- ((this.selectedItems().length
1214
- ? c.scope == AXPEntityCommandScope.Selected
1215
- : c.scope == AXPEntityCommandScope.Individual) ||
1216
- c.scope == AXPEntityCommandScope.TypeLevel));
1217
- console.log('action: ', action);
1218
- await this.workflow.execute(commandName, {
1219
- entity: getEntityInfo(this.entityDef).source,
1220
- entityInfo: {
1221
- name: this.entityDef.name,
1222
- module: this.entityDef.module,
1223
- title: this.entityDef.title,
1224
- parentKey: this.entityDef.parentKey,
1225
- source: this.entityDef.source,
1226
- },
1227
- data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
1228
- options: action?.options,
1229
- });
822
+ //****************** Commands ******************//
823
+ async executeCommand(commandName, data = null) {
824
+ const action = this.allActions().find((c) => c.name == commandName &&
825
+ ((this.selectedItems().length
826
+ ? c.scope == AXPEntityCommandScope.Selected
827
+ : c.scope == AXPEntityCommandScope.Individual) ||
828
+ c.scope == AXPEntityCommandScope.TypeLevel));
829
+ await this.workflow.execute(commandName, {
830
+ entity: getEntityInfo(this.entityDef).source,
831
+ entityInfo: {
832
+ name: this.entityDef.name,
833
+ module: this.entityDef.module,
834
+ title: this.entityDef.title,
835
+ parentKey: this.entityDef.parentKey,
836
+ source: this.entityDef.source,
837
+ },
838
+ data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
839
+ options: action?.options,
840
+ });
841
+ }
842
+ //
843
+ destroy() {
844
+ this.destroyed.next();
845
+ this.destroyed.complete();
846
+ }
847
+ }
848
+ class AXPEntityListViewModelFactory {
849
+ constructor() {
850
+ this.entityService = inject(AXPEntityDefinitionRegistryService);
851
+ this.layout = inject(AXPLayoutThemeService);
852
+ this.injector = inject(Injector);
853
+ }
854
+ async create(moduleName, entityName) {
855
+ this.layout.setNavigationLoading(true);
856
+ const config = await this.entityService.resolve(moduleName, entityName);
857
+ this.layout.setNavigationLoading(false);
858
+ return new AXPEntityMasterListViewModel(this.injector, config);
859
+ }
860
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityListViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
861
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityListViewModelFactory, providedIn: 'root' }); }
862
+ }
863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityListViewModelFactory, decorators: [{
864
+ type: Injectable,
865
+ args: [{ providedIn: 'root' }]
866
+ }] });
867
+ const AXPEntityListViewModelResolver = (route, state, service = inject(AXPEntityListViewModelFactory)) => {
868
+ const moduleName = route.parent?.paramMap.get('module');
869
+ const entityName = route.paramMap.get('entity');
870
+ //
871
+ return service.create(moduleName, entityName);
872
+ };
873
+
874
+ const AXPEntityDeletedEvent = createWorkFlowEvent('[Entity] Deleted');
875
+ class AXPEntityPerformDeleteAction extends AXPWorkflowAction {
876
+ constructor() {
877
+ super(...arguments);
878
+ this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
879
+ this.dialogService = inject(AXDialogService);
880
+ this.loadingDialog = inject(AXLoadingDialogService);
881
+ this.translationService = inject(AXTranslationService);
882
+ }
883
+ async execute(context) {
884
+ const moduleEntity = context.getVariable('entity');
885
+ const [moduleName, entityName] = moduleEntity.split('.');
886
+ const data = context.getVariable('data');
887
+ const meta = context.getVariable('meta');
888
+ const ids = Array.isArray(data) ? data.map((c) => c.id) : [data.id];
889
+ const entity = await this.entityRegistery.resolve(moduleName, entityName);
890
+ let deletedCount = 0;
891
+ context.setVariable('deleteSuccessful', false);
892
+ const dialog = this.loadingDialog.show({
893
+ title: await this.translationService.translateAsync('workflow.deleting'),
894
+ mode: 'determinate',
895
+ status: 'Deleting...',
896
+ progressValue: 0,
897
+ text: `0/${ids.length}`,
898
+ buttons: [
899
+ {
900
+ text: await this.translationService.translateAsync('cancel'),
901
+ color: 'danger',
902
+ onClick: () => {
903
+ dialog.close();
904
+ },
905
+ },
906
+ ],
907
+ });
908
+ if (entity.commands?.delete != null) {
909
+ const deleteExec = entity.commands?.delete?.execute;
910
+ const wrappedPromises = ids
911
+ .map((id, i) => {
912
+ return new Promise((resolve) => {
913
+ setTimeout(() => {
914
+ resolve(deleteExec(id));
915
+ }, i * 200);
916
+ });
917
+ })
918
+ .map((p) => p?.then((value) => {
919
+ deletedCount++;
920
+ dialog.setProgressText(`${deletedCount}/${ids.length}`);
921
+ dialog.setProgressValue((deletedCount / ids.length) * 100);
922
+ return { status: 'fulfilled', value };
923
+ }, (reason) => ({ status: 'rejected', reason })));
924
+ const results = await Promise.all(wrappedPromises);
925
+ const successfulPromises = results.filter((result) => result?.status === 'fulfilled').length;
926
+ const failedPromises = results.filter((result) => result?.status === 'rejected').length;
927
+ setTimeout(() => {
928
+ dialog.close();
929
+ }, 300);
930
+ // Handle different scenarios for alerts
931
+ if (successfulPromises > 0 && failedPromises === 0) {
932
+ // All items deleted successfully
933
+ await this.dialogService.alert(await this.translationService.translateAsync('workflow.success-delete-title'), await this.translationService.translateAsync('workflow.success-delete-body', {
934
+ params: { item: successfulPromises },
935
+ }), //TODO test translation
936
+ 'success');
937
+ // Dispatch actions
938
+ this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids, meta: meta }));
939
+ this.dispatch(AXPRefreshEvent({ entity: moduleEntity }));
940
+ }
941
+ else if (successfulPromises > 0 && failedPromises > 0) {
942
+ // Some items deleted successfully, some failed
943
+ await this.dialogService.alert(await this.translationService.translateAsync('workflow.success-partial-delete-title'), await this.translationService.translateAsync('workflow.partial-delete-body', {
944
+ params: { success: successfulPromises, fail: failedPromises },
945
+ }), 'warning');
946
+ // Dispatch actions
947
+ this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids, meta: meta }));
948
+ }
949
+ else if (successfulPromises === 0 && failedPromises > 0) {
950
+ // No items deleted, all failed
951
+ await this.dialogService.alert(await this.translationService.translateAsync('workflow.fail-delete-title'), await this.translationService.translateAsync('workflow.fail-delete-body', {
952
+ params: { item: failedPromises },
953
+ }), 'danger');
954
+ }
955
+ else {
956
+ // No items to delete (no successful or failed promises)
957
+ await this.dialogService.alert(await this.translationService.translateAsync('workflow.no-need'), await this.translationService.translateAsync('workflow.no-item'), 'primary');
958
+ }
959
+ }
960
+ else {
961
+ throw new Error(`The delete operation cannot be performed on ${entity.title}. This action might be restricted or not applicable for the selected item.`);
962
+ }
963
+ }
964
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
965
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction }); }
966
+ }
967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction, decorators: [{
968
+ type: Injectable
969
+ }] });
970
+ const AXPDeleteEntityWorkflow = {
971
+ startStepId: 'confirm-delete',
972
+ steps: {
973
+ 'confirm-delete': {
974
+ action: 'show-prompt-dialog',
975
+ input: {
976
+ title: 'workflow.warning',
977
+ message: `workflow.confirm-delete`,
978
+ type: 'danger',
979
+ },
980
+ nextSteps: [
981
+ {
982
+ conditions: [
983
+ {
984
+ type: 'AND',
985
+ conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
986
+ },
987
+ ],
988
+ nextStepId: 'perform-delete',
989
+ },
990
+ ],
991
+ },
992
+ 'perform-delete': {
993
+ action: 'entity-perform-delete',
994
+ },
995
+ },
996
+ };
997
+
998
+ class AXPEntityMasterUpdateElementViewModel {
999
+ constructor(entity, property) {
1000
+ this.entity = entity;
1001
+ this.property = property;
1002
+ this.name = signal(this.property.name);
1003
+ this.title = signal(this.property.title);
1004
+ this.description = signal(this.property.description);
1005
+ this.editable = computed(() => {
1006
+ return !(this.property.schema.readonly ?? false);
1007
+ });
1008
+ this.isRequired = computed(() => {
1009
+ return this.property.validations?.some(c => c.rule == 'required') || false;
1010
+ });
1011
+ this.layout = computed(() => {
1012
+ const updateProp = this.entity.interfaces?.master?.update?.properties?.find(c => c.name == this.property.name);
1013
+ const source = cloneDeep(updateProp?.layout ?? {});
1014
+ set(source, "positions.default.colSpan", 12);
1015
+ return source;
1016
+ });
1017
+ this.node = computed(() => {
1018
+ const schema = this.property.schema;
1019
+ const widget = schema.interface;
1020
+ return {
1021
+ type: widget.type,
1022
+ mode: this.editable() ? 'edit' : 'view',
1023
+ path: this.name(),
1024
+ children: widget.children,
1025
+ formula: widget.formula,
1026
+ triggers: widget.triggers,
1027
+ options: merge(schema.interface?.options,
1028
+ //this.property.options?.create?.widget,
1029
+ { validationRules: this.property.validations })
1030
+ };
1031
+ });
1032
+ }
1033
+ }
1034
+ class AXPEntityMasterUpdateViewModel {
1035
+ constructor(injector, config, entityData, props) {
1036
+ this.injector = injector;
1037
+ this.config = config;
1038
+ this.entityData = entityData;
1039
+ this.props = props;
1040
+ this.entityDef = cloneDeep(this.config);
1041
+ this.workflow = this.injector.get(AXPWorkflowService);
1042
+ this.isInProgress = signal(false);
1043
+ this.context = signal(cloneDeep(this.entityData));
1044
+ this.elements = computed(() => {
1045
+ const props = this.entityDef.properties.filter(c => this.props.includes(c.name) &&
1046
+ c.schema.hidden != true);
1047
+ return props.map(e => {
1048
+ return new AXPEntityMasterUpdateElementViewModel(this.entityDef, e);
1049
+ });
1050
+ });
1051
+ }
1052
+ async save() {
1053
+ this.isInProgress.set(true);
1054
+ try {
1055
+ const com = this.entityDef.commands?.update;
1056
+ if (com) {
1057
+ const exec = com.execute;
1058
+ return await exec(this.context());
1059
+ }
1060
+ }
1061
+ finally {
1062
+ this.isInProgress.set(false);
1063
+ }
1230
1064
  }
1231
- //
1232
- destroy() {
1233
- this.destroyed.next();
1234
- this.destroyed.complete();
1065
+ reset() {
1066
+ this.context.set(cloneDeep(this.entityData));
1235
1067
  }
1236
1068
  }
1237
- class AXPEntityListViewModelFactory {
1069
+ class AXPEntityMasterUpdateViewModelFactory {
1238
1070
  constructor() {
1239
1071
  this.entityService = inject(AXPEntityDefinitionRegistryService);
1240
1072
  this.layout = inject(AXPLayoutThemeService);
1241
1073
  this.injector = inject(Injector);
1242
1074
  }
1243
- async create(moduleName, entityName) {
1244
- this.layout.setNavigationLoading(true);
1075
+ async create(moduleName, entityName, id, props) {
1245
1076
  const config = await this.entityService.resolve(moduleName, entityName);
1077
+ this.layout.setNavigationLoading(true);
1078
+ if (config.queries.byKey) {
1079
+ const func = config.queries.byKey.execute;
1080
+ const data = await func(id);
1081
+ this.layout.setNavigationLoading(false);
1082
+ return new AXPEntityMasterUpdateViewModel(this.injector, config, data, props);
1083
+ }
1246
1084
  this.layout.setNavigationLoading(false);
1247
- return new AXPEntityMasterListViewModel(this.injector, config);
1085
+ return Promise.reject('cannot fetch ');
1248
1086
  }
1249
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityListViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1250
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityListViewModelFactory, providedIn: 'root' }); }
1087
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1088
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, providedIn: 'root' }); }
1251
1089
  }
1252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityListViewModelFactory, decorators: [{
1090
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, decorators: [{
1253
1091
  type: Injectable,
1254
1092
  args: [{ providedIn: 'root' }]
1255
1093
  }] });
1256
- const AXPEntityListViewModelResolver = (route, state, service = inject(AXPEntityListViewModelFactory)) => {
1257
- const moduleName = route.parent?.paramMap.get('module');
1258
- const entityName = route.paramMap.get('entity');
1259
- //
1260
- return service.create(moduleName, entityName);
1094
+
1095
+ const AXPEntityModifyEvent = createWorkFlowEvent('[Entity] Modified');
1096
+ class AXPEntityModifySectionPopupAction extends AXPWorkflowAction {
1097
+ constructor() {
1098
+ super(...arguments);
1099
+ this.popupService = inject(AXPopupService);
1100
+ this.platform = inject(AXPlatform);
1101
+ this.translateService = inject(AXTranslationService);
1102
+ this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
1103
+ this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
1104
+ this.factory = inject(AXPEntityMasterUpdateViewModelFactory);
1105
+ }
1106
+ async execute(context) {
1107
+ const [moduleName, entityName] = context.getVariable('entity').split('.');
1108
+ const { properties, id, title } = context.getVariable('data');
1109
+ const entityRef = await this.entityRegistery.resolve(moduleName, entityName);
1110
+ const vm = await this.factory.create(moduleName, entityName, id, properties);
1111
+ const com = await this.config.viewers.master.modify();
1112
+ const popup = await this.popupService.open(com, {
1113
+ title: title ??
1114
+ `${this.translateService.translateSync('entity.modify')} ${this.translateService.translateSync(entityRef.formats.individual)}`,
1115
+ size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
1116
+ data: {
1117
+ vm,
1118
+ properties,
1119
+ entity: entityRef,
1120
+ },
1121
+ });
1122
+ context.setOutput('result', false);
1123
+ if (popup.data?.result == true) {
1124
+ context.setOutput('result', true);
1125
+ context.setVariable('data', cloneDeep(popup.data.context));
1126
+ }
1127
+ }
1128
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1129
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction }); }
1130
+ }
1131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction, decorators: [{
1132
+ type: Injectable
1133
+ }] });
1134
+ class AXPEntityModifyConfirmedAction extends AXPWorkflowAction {
1135
+ async execute(context) {
1136
+ const updatedData = context.getVariable('data');
1137
+ this.dispatch(AXPEntityModifyEvent({ entity: context.getVariable('entity'), values: updatedData }));
1138
+ this.dispatch(AXPRefreshEvent({ entity: context.getVariable('entity') }));
1139
+ }
1140
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1141
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction }); }
1142
+ }
1143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction, decorators: [{
1144
+ type: Injectable
1145
+ }] });
1146
+ const AXPModifyEntitySectionWorkflow = {
1147
+ startStepId: 'modifyPopup',
1148
+ steps: {
1149
+ modifyPopup: {
1150
+ id: 'modifyPopup',
1151
+ action: 'AXPEntityModifySectionPopupAction',
1152
+ nextSteps: [
1153
+ {
1154
+ conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
1155
+ nextStepId: 'successToast',
1156
+ },
1157
+ ],
1158
+ },
1159
+ successToast: {
1160
+ id: 'successToast',
1161
+ action: 'AXPToastAction',
1162
+ input: {
1163
+ color: 'success',
1164
+ title: 'workflow.entity-modified-title',
1165
+ content: 'workflow.entity-modified-body',
1166
+ },
1167
+ nextSteps: [
1168
+ {
1169
+ conditions: [],
1170
+ nextStepId: 'modifyConfirmed',
1171
+ },
1172
+ ],
1173
+ },
1174
+ modifyConfirmed: {
1175
+ id: 'modifyConfirmed',
1176
+ action: 'AXPEntityModifyConfirmedAction',
1177
+ },
1178
+ },
1261
1179
  };
1262
1180
 
1263
1181
  class AXPEntityMasterSingleViewGroupViewModel {
@@ -1280,6 +1198,7 @@ class AXPEntityMasterSingleViewGroupViewModel {
1280
1198
  });
1281
1199
  this.props = computed(() => {
1282
1200
  const { properties, interfaces } = this.entity;
1201
+ console.log({ properties });
1283
1202
  const groupProperties = properties
1284
1203
  .filter(({ groupId, schema }) => groupId === this.group.id && !schema.hidden)
1285
1204
  .map(({ name }) => name);
@@ -1885,7 +1804,6 @@ class AXPLookupWidgetEditComponent extends AXPWidgetComponent {
1885
1804
  this.entityResolver = inject(AXPEntityResolver);
1886
1805
  this.formatService = inject(AXFormatService);
1887
1806
  this.popupService = inject(AXPopupService);
1888
- this.builderService = inject(AXPLayoutBuilderService);
1889
1807
  this.destroyRef = inject(DestroyRef);
1890
1808
  this.translateService = inject(AXTranslationService);
1891
1809
  this.expose = computed(() => this.options()['expose']);
@@ -1925,13 +1843,13 @@ class AXPLookupWidgetEditComponent extends AXPWidgetComponent {
1925
1843
  ngOnInit() {
1926
1844
  super.ngOnInit();
1927
1845
  //
1928
- this.builderService.onChanged.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(async (c) => {
1929
- if (c.path == this.path) {
1930
- if (this.getValue()) {
1931
- await this.findByValue();
1932
- }
1933
- }
1934
- });
1846
+ // this.builderService.onContextChanged.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(async (c) => {
1847
+ // if (c.path == this.path) {
1848
+ // if (this.getValue()) {
1849
+ // await this.findByValue();
1850
+ // }
1851
+ // }
1852
+ // });
1935
1853
  }
1936
1854
  async findByValue() {
1937
1855
  this.isLoading.set(true);
@@ -2007,18 +1925,18 @@ class AXPLookupWidgetEditComponent extends AXPWidgetComponent {
2007
1925
  // extract data from valueField and set context by expose path
2008
1926
  if (this.expose()) {
2009
1927
  if (typeof this.expose() == 'string') {
2010
- this.builderService.setValue(this.expose(), item);
1928
+ this.contextService.update(this.expose(), item);
2011
1929
  }
2012
1930
  // support multiple expose items
2013
1931
  else if (Array.isArray(this.expose())) {
2014
1932
  this.expose().forEach((i) => {
2015
1933
  if (typeof i == 'string') {
2016
- this.builderService.setValue(i, item);
1934
+ this.contextService.update(i, item);
2017
1935
  }
2018
1936
  else {
2019
1937
  // extract data from item by source path and set context by target path
2020
1938
  const key = get(item, i.source);
2021
- this.builderService.setValue(i.target, key);
1939
+ this.contextService.update(i.target, key);
2022
1940
  }
2023
1941
  });
2024
1942
  }
@@ -2026,7 +1944,7 @@ class AXPLookupWidgetEditComponent extends AXPWidgetComponent {
2026
1944
  else if (typeof this.expose() == 'object') {
2027
1945
  const i = this.expose();
2028
1946
  const key = get(item, i.source);
2029
- this.builderService.setValue(i.target, key);
1947
+ this.contextService.update(i.target, key);
2030
1948
  }
2031
1949
  }
2032
1950
  }
@@ -2189,6 +2107,7 @@ const AXPLookupWidget = {
2189
2107
  title: 'Lookup',
2190
2108
  visible: false,
2191
2109
  group: AXP_WIDGETS_EDITOR_GROUP,
2110
+ defaultFilterWidgetName: 'lookup-filter',
2192
2111
  type: 'editor',
2193
2112
  properties: [
2194
2113
  AXP_DISABLED_PROPERTY,
@@ -2394,6 +2313,98 @@ const AXPWidgetSelectorWidget = {
2394
2313
  },
2395
2314
  };
2396
2315
 
2316
+ const AXPEntityCreateEvent = createWorkFlowEvent('[Entity] Created!');
2317
+ class AXPEntityCreatePopupAction extends AXPWorkflowAction {
2318
+ constructor() {
2319
+ super(...arguments);
2320
+ this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
2321
+ this.popupService = inject(AXPopupService);
2322
+ this.platform = inject(AXPlatform);
2323
+ this.factory = inject(AXPEntityCreateViewModelFactory);
2324
+ this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
2325
+ this.translateService = inject(AXTranslationService);
2326
+ }
2327
+ async execute(context) {
2328
+ const [module, entity] = context.getVariable('entity').split('.');
2329
+ const data = context.getVariable('data');
2330
+ const options = context.getVariable('options');
2331
+ const redirect = options?.['redirect'];
2332
+ const canCreateNewOne = options?.['canCreateNewOne'];
2333
+ const entityRef = await this.entityRegistery.resolve(module, entity);
2334
+ const com = await this.config.viewers.master.create();
2335
+ const result = await this.popupService.open(com, {
2336
+ title: `${await this.translateService.translateAsync('create-new')} ${await this.translateService.translateAsync(entityRef.formats.individual)}`,
2337
+ size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
2338
+ data: {
2339
+ vm: await this.factory.create(module, entity, data, { canCreateNewOne, redirect }),
2340
+ entity,
2341
+ },
2342
+ });
2343
+ context.setOutput('result', false);
2344
+ if (result.data?.save) {
2345
+ context.setOutput('result', true);
2346
+ const prevData = context.getVariable('data');
2347
+ context.setVariable('data', { ...prevData, ...result.data.item });
2348
+ }
2349
+ }
2350
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
2351
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction }); }
2352
+ }
2353
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction, decorators: [{
2354
+ type: Injectable
2355
+ }] });
2356
+ class AXPEntityCreateSubmittedAction extends AXPWorkflowAction {
2357
+ async execute(context) {
2358
+ this.dispatch(AXPEntityCreateEvent({ entity: context.getVariable('entity'), meta: context.getVariable('meta') }));
2359
+ this.dispatch(AXPRefreshEvent({ entity: context.getVariable('entity') }));
2360
+ }
2361
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
2362
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction }); }
2363
+ }
2364
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction, decorators: [{
2365
+ type: Injectable
2366
+ }] });
2367
+ const AXPCreateEntityWorkflow = {
2368
+ startStepId: 'show-popup',
2369
+ steps: {
2370
+ 'show-popup': {
2371
+ action: 'AXPEntityCreatePopupAction',
2372
+ nextSteps: [
2373
+ {
2374
+ conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
2375
+ nextStepId: 'show-toast',
2376
+ },
2377
+ ],
2378
+ },
2379
+ 'show-toast': {
2380
+ action: 'AXPToastAction',
2381
+ input: {
2382
+ color: 'success',
2383
+ title: 'workflow.entity-created',
2384
+ content: 'workflow.entity-created-body',
2385
+ },
2386
+ nextSteps: [
2387
+ {
2388
+ conditions: [],
2389
+ nextStepId: 'dispatch-event',
2390
+ },
2391
+ ],
2392
+ },
2393
+ 'dispatch-event': {
2394
+ action: 'AXPEntityCreateSubmittedAction',
2395
+ nextSteps: [
2396
+ {
2397
+ conditions: [{ type: 'SINGLE', expression: 'context.getVariable("options")?.redirect != false' }],
2398
+ nextStepId: 'show-entity',
2399
+ },
2400
+ ],
2401
+ },
2402
+ 'show-entity': {
2403
+ action: 'AXPShowDetailViewAction',
2404
+ },
2405
+ },
2406
+ };
2407
+
2397
2408
  class AXPQuickEntityModifyPopupAction extends AXPWorkflowAction {
2398
2409
  constructor() {
2399
2410
  super(...arguments);