@acorex/platform 19.1.4 → 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.
- package/common/lib/workflows/common.workflow.d.ts +11 -0
- package/fesm2022/acorex-platform-common.mjs +4 -4
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +127 -94
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +540 -534
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-filters.mjs +0 -1
- package/fesm2022/acorex-platform-layout-filters.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-DAmHq1bt.mjs → acorex-platform-themes-default-entity-master-list-view.component-xlBBA76O.mjs} +3 -3
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-xlBBA76O.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +2 -2
- package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs → acorex-platform-widgets-checkbox-widget-designer.component-D8KErkus.mjs} +4 -4
- package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs.map → acorex-platform-widgets-checkbox-widget-designer.component-D8KErkus.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs → acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs} +4 -4
- package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs.map +1 -0
- package/fesm2022/acorex-platform-widgets.mjs +942 -160
- package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
- package/layout/builder/lib/builder/builder.module.d.ts +4 -3
- package/layout/builder/lib/builder/widget-map.d.ts +5 -0
- package/layout/builder/lib/builder/widget-placeholder.component.d.ts +5 -0
- package/layout/builder/lib/builder/widget-renderer.directive.d.ts +1 -1
- package/layout/builder/lib/builder/widget.types.d.ts +6 -2
- package/package.json +13 -13
- package/widgets/lib/widgets/editors/select/select-box-widget-edit.component.d.ts +1 -1
- package/widgets/lib/widgets/filters/boolean-filter/boolean-filter-widget-edit.component.d.ts +18 -0
- package/widgets/lib/widgets/filters/boolean-filter/boolean-filter-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/filters/boolean-filter/index.d.ts +2 -0
- package/widgets/lib/widgets/filters/date-time-filter/date-time-filter-widget-edit.component.d.ts +20 -0
- package/widgets/lib/widgets/filters/date-time-filter/date-time-filter-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/filters/date-time-filter/index.d.ts +2 -0
- package/widgets/lib/widgets/filters/number-filter/index.d.ts +2 -0
- package/widgets/lib/widgets/filters/number-filter/number-filter-widget-edit.component.d.ts +12 -0
- package/widgets/lib/widgets/filters/number-filter/number-filter-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/filters/select-filter/index.d.ts +2 -0
- package/widgets/lib/widgets/filters/select-filter/select-filter-widget-edit.component.d.ts +16 -0
- package/widgets/lib/widgets/filters/select-filter/select-filter-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/filters/string-filter/string-filter-widget-edit.component.d.ts +1 -0
- package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget-editor.component.d.ts +22 -17
- package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget.type.d.ts +16 -13
- package/widgets/lib/widgets/property-editors/property-editor-helper.d.ts +10 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DAmHq1bt.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
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, AXPSettingScope, 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,
|
|
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';
|
|
@@ -12,12 +12,12 @@ import { AXPSessionService, AXPAuthGuard } from '@acorex/platform/auth';
|
|
|
12
12
|
import * as i7 from '@acorex/platform/layout/builder';
|
|
13
13
|
import { AXPWidgetRegistryService, AXPWidgetComponent, AXPLayoutBuilderModule, AXPColumnWidgetComponent, AXP_WIDGETS_EDITOR_GROUP, AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
|
|
14
14
|
import { Subject, takeUntil } from 'rxjs';
|
|
15
|
-
import { AXPopupService } from '@acorex/components/popup';
|
|
16
|
-
import { AXPlatform } from '@acorex/core/platform';
|
|
17
|
-
import * as i8 from '@acorex/core/translation';
|
|
18
|
-
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
19
15
|
import { AXDialogService } from '@acorex/components/dialog';
|
|
20
16
|
import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
|
|
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';
|
|
@@ -493,507 +493,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
493
493
|
args: [{ providedIn: 'root' }]
|
|
494
494
|
}] });
|
|
495
495
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
this.
|
|
501
|
-
this.
|
|
502
|
-
this.
|
|
503
|
-
this.
|
|
504
|
-
this.
|
|
505
|
-
this.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
const [module, entity] = context.getVariable('entity').split('.');
|
|
509
|
-
const data = context.getVariable('data');
|
|
510
|
-
const options = context.getVariable('options');
|
|
511
|
-
const redirect = options?.['redirect'];
|
|
512
|
-
const canCreateNewOne = options?.['canCreateNewOne'];
|
|
513
|
-
const entityRef = await this.entityRegistery.resolve(module, entity);
|
|
514
|
-
const com = await this.config.viewers.master.create();
|
|
515
|
-
const result = await this.popupService.open(com, {
|
|
516
|
-
title: `${await this.translateService.translateAsync('create-new')} ${await this.translateService.translateAsync(entityRef.formats.individual)}`,
|
|
517
|
-
size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
|
|
518
|
-
data: {
|
|
519
|
-
vm: await this.factory.create(module, entity, data, { canCreateNewOne, redirect }),
|
|
520
|
-
entity,
|
|
521
|
-
},
|
|
522
|
-
});
|
|
523
|
-
context.setOutput('result', false);
|
|
524
|
-
if (result.data?.save) {
|
|
525
|
-
context.setOutput('result', true);
|
|
526
|
-
const prevData = context.getVariable('data');
|
|
527
|
-
context.setVariable('data', { ...prevData, ...result.data.item });
|
|
528
|
-
}
|
|
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;
|
|
529
508
|
}
|
|
530
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
531
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction }); }
|
|
532
509
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
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
|
+
}
|
|
539
524
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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();
|
|
564
552
|
},
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
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 [
|
|
575
585
|
{
|
|
576
|
-
|
|
577
|
-
|
|
586
|
+
title: 'entity.home',
|
|
587
|
+
icon: 'fa-solid fa-home ax-text-xs ax-me-2',
|
|
588
|
+
url: [`/${this.session.application?.name}`],
|
|
578
589
|
},
|
|
579
|
-
],
|
|
580
|
-
},
|
|
581
|
-
'show-entity': {
|
|
582
|
-
action: 'AXPShowDetailViewAction',
|
|
583
|
-
},
|
|
584
|
-
},
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
const AXPEntityDeletedEvent = createWorkFlowEvent('[Entity] Deleted');
|
|
588
|
-
class AXPEntityPerformDeleteAction extends AXPWorkflowAction {
|
|
589
|
-
constructor() {
|
|
590
|
-
super(...arguments);
|
|
591
|
-
this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
|
|
592
|
-
this.dialogService = inject(AXDialogService);
|
|
593
|
-
this.loadingDialog = inject(AXLoadingDialogService);
|
|
594
|
-
this.translationService = inject(AXTranslationService);
|
|
595
|
-
}
|
|
596
|
-
async execute(context) {
|
|
597
|
-
const moduleEntity = context.getVariable('entity');
|
|
598
|
-
const [moduleName, entityName] = moduleEntity.split('.');
|
|
599
|
-
const data = context.getVariable('data');
|
|
600
|
-
const meta = context.getVariable('meta');
|
|
601
|
-
const ids = Array.isArray(data) ? data.map((c) => c.id) : [data.id];
|
|
602
|
-
const entity = await this.entityRegistery.resolve(moduleName, entityName);
|
|
603
|
-
let deletedCount = 0;
|
|
604
|
-
context.setVariable('deleteSuccessful', false);
|
|
605
|
-
const dialog = this.loadingDialog.show({
|
|
606
|
-
title: await this.translationService.translateAsync('workflow.deleting'),
|
|
607
|
-
mode: 'determinate',
|
|
608
|
-
status: 'Deleting...',
|
|
609
|
-
progressValue: 0,
|
|
610
|
-
text: `0/${ids.length}`,
|
|
611
|
-
buttons: [
|
|
612
590
|
{
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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
|
+
],
|
|
618
600
|
},
|
|
619
|
-
]
|
|
620
|
-
});
|
|
621
|
-
if (entity.commands?.delete != null) {
|
|
622
|
-
const deleteExec = entity.commands?.delete?.execute;
|
|
623
|
-
const wrappedPromises = ids
|
|
624
|
-
.map((id, i) => {
|
|
625
|
-
return new Promise((resolve) => {
|
|
626
|
-
setTimeout(() => {
|
|
627
|
-
resolve(deleteExec(id));
|
|
628
|
-
}, i * 200);
|
|
629
|
-
});
|
|
630
|
-
})
|
|
631
|
-
.map((p) => p?.then((value) => {
|
|
632
|
-
deletedCount++;
|
|
633
|
-
dialog.setProgressText(`${deletedCount}/${ids.length}`);
|
|
634
|
-
dialog.setProgressValue((deletedCount / ids.length) * 100);
|
|
635
|
-
return { status: 'fulfilled', value };
|
|
636
|
-
}, (reason) => ({ status: 'rejected', reason })));
|
|
637
|
-
const results = await Promise.all(wrappedPromises);
|
|
638
|
-
const successfulPromises = results.filter((result) => result?.status === 'fulfilled').length;
|
|
639
|
-
const failedPromises = results.filter((result) => result?.status === 'rejected').length;
|
|
640
|
-
setTimeout(() => {
|
|
641
|
-
dialog.close();
|
|
642
|
-
}, 300);
|
|
643
|
-
// Handle different scenarios for alerts
|
|
644
|
-
if (successfulPromises > 0 && failedPromises === 0) {
|
|
645
|
-
// All items deleted successfully
|
|
646
|
-
await this.dialogService.alert(await this.translationService.translateAsync('workflow.success-delete-title'), await this.translationService.translateAsync('workflow.success-delete-body', {
|
|
647
|
-
params: { item: successfulPromises },
|
|
648
|
-
}), //TODO test translation
|
|
649
|
-
'success');
|
|
650
|
-
// Dispatch actions
|
|
651
|
-
this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids, meta: meta }));
|
|
652
|
-
}
|
|
653
|
-
else if (successfulPromises > 0 && failedPromises > 0) {
|
|
654
|
-
// Some items deleted successfully, some failed
|
|
655
|
-
await this.dialogService.alert(await this.translationService.translateAsync('workflow.success-partial-delete-title'), await this.translationService.translateAsync('workflow.partial-delete-body', {
|
|
656
|
-
params: { success: successfulPromises, fail: failedPromises },
|
|
657
|
-
}), 'warning');
|
|
658
|
-
// Dispatch actions
|
|
659
|
-
this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids, meta: meta }));
|
|
660
|
-
}
|
|
661
|
-
else if (successfulPromises === 0 && failedPromises > 0) {
|
|
662
|
-
// No items deleted, all failed
|
|
663
|
-
await this.dialogService.alert(await this.translationService.translateAsync('workflow.fail-delete-title'), await this.translationService.translateAsync('workflow.fail-delete-body', {
|
|
664
|
-
params: { item: failedPromises },
|
|
665
|
-
}), 'danger');
|
|
666
|
-
}
|
|
667
|
-
else {
|
|
668
|
-
// No items to delete (no successful or failed promises)
|
|
669
|
-
await this.dialogService.alert(await this.translationService.translateAsync('workflow.no-need'), await this.translationService.translateAsync('workflow.no-item'), 'primary');
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
throw new Error(`The delete operation cannot be performed on ${entity.title}. This action might be restricted or not applicable for the selected item.`);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
677
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction }); }
|
|
678
|
-
}
|
|
679
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityPerformDeleteAction, decorators: [{
|
|
680
|
-
type: Injectable
|
|
681
|
-
}] });
|
|
682
|
-
const AXPDeleteEntityWorkflow = {
|
|
683
|
-
startStepId: 'confirm-delete',
|
|
684
|
-
steps: {
|
|
685
|
-
'confirm-delete': {
|
|
686
|
-
action: 'show-prompt-dialog',
|
|
687
|
-
input: {
|
|
688
|
-
title: 'workflow.warning',
|
|
689
|
-
message: `workflow.confirm-delete`,
|
|
690
|
-
type: 'danger',
|
|
691
|
-
},
|
|
692
|
-
nextSteps: [
|
|
693
|
-
{
|
|
694
|
-
conditions: [
|
|
695
|
-
{
|
|
696
|
-
type: 'AND',
|
|
697
|
-
conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
|
|
698
|
-
},
|
|
699
|
-
],
|
|
700
|
-
nextStepId: 'perform-delete',
|
|
701
|
-
},
|
|
702
|
-
],
|
|
703
|
-
},
|
|
704
|
-
'perform-delete': {
|
|
705
|
-
action: 'entity-perform-delete',
|
|
706
|
-
},
|
|
707
|
-
},
|
|
708
|
-
};
|
|
709
|
-
|
|
710
|
-
class AXPEntityMasterUpdateElementViewModel {
|
|
711
|
-
constructor(entity, property) {
|
|
712
|
-
this.entity = entity;
|
|
713
|
-
this.property = property;
|
|
714
|
-
this.name = signal(this.property.name);
|
|
715
|
-
this.title = signal(this.property.title);
|
|
716
|
-
this.description = signal(this.property.description);
|
|
717
|
-
this.editable = computed(() => {
|
|
718
|
-
return !(this.property.schema.readonly ?? false);
|
|
719
|
-
});
|
|
720
|
-
this.isRequired = computed(() => {
|
|
721
|
-
return this.property.validations?.some(c => c.rule == 'required') || false;
|
|
722
|
-
});
|
|
723
|
-
this.layout = computed(() => {
|
|
724
|
-
const updateProp = this.entity.interfaces?.master?.update?.properties?.find(c => c.name == this.property.name);
|
|
725
|
-
const source = cloneDeep(updateProp?.layout ?? {});
|
|
726
|
-
set(source, "positions.default.colSpan", 12);
|
|
727
|
-
return source;
|
|
728
|
-
});
|
|
729
|
-
this.node = computed(() => {
|
|
730
|
-
const schema = this.property.schema;
|
|
731
|
-
const widget = schema.interface;
|
|
732
|
-
return {
|
|
733
|
-
type: widget.type,
|
|
734
|
-
mode: this.editable() ? 'edit' : 'view',
|
|
735
|
-
path: this.name(),
|
|
736
|
-
children: widget.children,
|
|
737
|
-
formula: widget.formula,
|
|
738
|
-
triggers: widget.triggers,
|
|
739
|
-
options: merge(schema.interface?.options,
|
|
740
|
-
//this.property.options?.create?.widget,
|
|
741
|
-
{ validationRules: this.property.validations })
|
|
742
|
-
};
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
class AXPEntityMasterUpdateViewModel {
|
|
747
|
-
constructor(injector, config, entityData, props) {
|
|
748
|
-
this.injector = injector;
|
|
749
|
-
this.config = config;
|
|
750
|
-
this.entityData = entityData;
|
|
751
|
-
this.props = props;
|
|
752
|
-
this.entityDef = cloneDeep(this.config);
|
|
753
|
-
this.workflow = this.injector.get(AXPWorkflowService);
|
|
754
|
-
this.isInProgress = signal(false);
|
|
755
|
-
this.context = signal(cloneDeep(this.entityData));
|
|
756
|
-
this.elements = computed(() => {
|
|
757
|
-
const props = this.entityDef.properties.filter(c => this.props.includes(c.name) &&
|
|
758
|
-
c.schema.hidden != true);
|
|
759
|
-
return props.map(e => {
|
|
760
|
-
return new AXPEntityMasterUpdateElementViewModel(this.entityDef, e);
|
|
761
|
-
});
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
async save() {
|
|
765
|
-
this.isInProgress.set(true);
|
|
766
|
-
try {
|
|
767
|
-
const com = this.entityDef.commands?.update;
|
|
768
|
-
if (com) {
|
|
769
|
-
const exec = com.execute;
|
|
770
|
-
return await exec(this.context());
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
finally {
|
|
774
|
-
this.isInProgress.set(false);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
reset() {
|
|
778
|
-
this.context.set(cloneDeep(this.entityData));
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
class AXPEntityMasterUpdateViewModelFactory {
|
|
782
|
-
constructor() {
|
|
783
|
-
this.entityService = inject(AXPEntityDefinitionRegistryService);
|
|
784
|
-
this.layout = inject(AXPLayoutThemeService);
|
|
785
|
-
this.injector = inject(Injector);
|
|
786
|
-
}
|
|
787
|
-
async create(moduleName, entityName, id, props) {
|
|
788
|
-
const config = await this.entityService.resolve(moduleName, entityName);
|
|
789
|
-
this.layout.setNavigationLoading(true);
|
|
790
|
-
if (config.queries.byKey) {
|
|
791
|
-
const func = config.queries.byKey.execute;
|
|
792
|
-
const data = await func(id);
|
|
793
|
-
this.layout.setNavigationLoading(false);
|
|
794
|
-
return new AXPEntityMasterUpdateViewModel(this.injector, config, data, props);
|
|
795
|
-
}
|
|
796
|
-
this.layout.setNavigationLoading(false);
|
|
797
|
-
return Promise.reject('cannot fetch ');
|
|
798
|
-
}
|
|
799
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
800
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, providedIn: 'root' }); }
|
|
801
|
-
}
|
|
802
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, decorators: [{
|
|
803
|
-
type: Injectable,
|
|
804
|
-
args: [{ providedIn: 'root' }]
|
|
805
|
-
}] });
|
|
806
|
-
|
|
807
|
-
const AXPEntityModifyEvent = createWorkFlowEvent('[Entity] Modified');
|
|
808
|
-
class AXPEntityModifySectionPopupAction extends AXPWorkflowAction {
|
|
809
|
-
constructor() {
|
|
810
|
-
super(...arguments);
|
|
811
|
-
this.popupService = inject(AXPopupService);
|
|
812
|
-
this.platform = inject(AXPlatform);
|
|
813
|
-
this.translateService = inject(AXTranslationService);
|
|
814
|
-
this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
|
|
815
|
-
this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
|
|
816
|
-
this.factory = inject(AXPEntityMasterUpdateViewModelFactory);
|
|
817
|
-
}
|
|
818
|
-
async execute(context) {
|
|
819
|
-
const [moduleName, entityName] = context.getVariable('entity').split('.');
|
|
820
|
-
const { properties, id, title } = context.getVariable('data');
|
|
821
|
-
const entityRef = await this.entityRegistery.resolve(moduleName, entityName);
|
|
822
|
-
const vm = await this.factory.create(moduleName, entityName, id, properties);
|
|
823
|
-
const com = await this.config.viewers.master.modify();
|
|
824
|
-
const popup = await this.popupService.open(com, {
|
|
825
|
-
title: title ?? `${this.translateService.translateSync('entity.modify')} ${this.translateService.translateSync(entityRef.formats.individual)}`,
|
|
826
|
-
size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
|
|
827
|
-
data: {
|
|
828
|
-
vm,
|
|
829
|
-
properties,
|
|
830
|
-
entity: entityRef,
|
|
831
|
-
},
|
|
832
|
-
});
|
|
833
|
-
context.setOutput('result', false);
|
|
834
|
-
if (popup.data?.result == true) {
|
|
835
|
-
context.setOutput('result', true);
|
|
836
|
-
context.setVariable('data', cloneDeep(popup.data.context));
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
840
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction }); }
|
|
841
|
-
}
|
|
842
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifySectionPopupAction, decorators: [{
|
|
843
|
-
type: Injectable
|
|
844
|
-
}] });
|
|
845
|
-
class AXPEntityModifyConfirmedAction extends AXPWorkflowAction {
|
|
846
|
-
async execute(context) {
|
|
847
|
-
const updatedData = context.getVariable('data');
|
|
848
|
-
this.dispatch(AXPEntityModifyEvent({ entity: context.getVariable('entity'), values: updatedData }));
|
|
849
|
-
}
|
|
850
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
851
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction }); }
|
|
852
|
-
}
|
|
853
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityModifyConfirmedAction, decorators: [{
|
|
854
|
-
type: Injectable
|
|
855
|
-
}] });
|
|
856
|
-
const AXPModifyEntitySectionWorkflow = {
|
|
857
|
-
startStepId: 'modifyPopup',
|
|
858
|
-
steps: {
|
|
859
|
-
modifyPopup: {
|
|
860
|
-
id: 'modifyPopup',
|
|
861
|
-
action: 'AXPEntityModifySectionPopupAction',
|
|
862
|
-
nextSteps: [
|
|
863
|
-
{
|
|
864
|
-
conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
|
|
865
|
-
nextStepId: 'successToast',
|
|
866
|
-
},
|
|
867
|
-
],
|
|
868
|
-
},
|
|
869
|
-
successToast: {
|
|
870
|
-
id: 'successToast',
|
|
871
|
-
action: 'AXPToastAction',
|
|
872
|
-
input: {
|
|
873
|
-
color: 'success',
|
|
874
|
-
title: 'workflow.entity-modified-title',
|
|
875
|
-
content: 'workflow.entity-modified-body',
|
|
876
|
-
},
|
|
877
|
-
nextSteps: [
|
|
878
|
-
{
|
|
879
|
-
conditions: [],
|
|
880
|
-
nextStepId: 'modifyConfirmed',
|
|
881
|
-
},
|
|
882
|
-
],
|
|
883
|
-
},
|
|
884
|
-
modifyConfirmed: {
|
|
885
|
-
id: 'modifyConfirmed',
|
|
886
|
-
action: 'AXPEntityModifyConfirmedAction',
|
|
887
|
-
},
|
|
888
|
-
},
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
class AXPEntityMasterListViewQueryViewModel {
|
|
892
|
-
constructor(entity, section, view) {
|
|
893
|
-
this.entity = entity;
|
|
894
|
-
this.section = section;
|
|
895
|
-
this.view = view;
|
|
896
|
-
this.name = this.view.name;
|
|
897
|
-
this.title = this.view.title;
|
|
898
|
-
this.sorts = this.view.sorts;
|
|
899
|
-
this.columns = this.view.columns;
|
|
900
|
-
this.conditions = this.view.conditions;
|
|
901
|
-
this.indexCol = this.view.indexCol;
|
|
902
|
-
this.pageSize = this.view.pageSize;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
class AXPEntityMasterListViewModel {
|
|
906
|
-
async setView(viewName = null) {
|
|
907
|
-
this.settingSelectedViewKey = `${this.config.module}:${this.config.name}:selected-view`;
|
|
908
|
-
const savedViewName = await this.settings.get(this.settingSelectedViewKey);
|
|
909
|
-
// this.settings.set()
|
|
910
|
-
if (viewName != this.view().name) {
|
|
911
|
-
this.view.set(this.views().find((c) => c.name == (viewName || savedViewName)) ?? this.views()[0]);
|
|
912
|
-
this.settings.scope(AXPSettingScope.User).set(this.settingSelectedViewKey, this.view().name);
|
|
913
|
-
this.applyViewSorts();
|
|
914
|
-
this.applyViewColumns();
|
|
915
|
-
this.applyViewFilters();
|
|
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.widgetResolver = this.injector.get(AXPWidgetRegistryService);
|
|
930
|
-
this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
|
|
931
|
-
this.settingListViewKey = '';
|
|
932
|
-
this.settingSelectedViewKey = '';
|
|
933
|
-
this.destroyed = new Subject();
|
|
934
|
-
this.events$ = new Subject();
|
|
935
|
-
//****************** Views ******************//
|
|
936
|
-
this.views = computed(() => {
|
|
937
|
-
const views = this.entityDef.interfaces?.master?.list?.views ?? [];
|
|
938
|
-
return views.map((v) => {
|
|
939
|
-
return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
|
|
940
|
-
});
|
|
941
|
-
});
|
|
942
|
-
this.view = signal(this.views()[0]);
|
|
943
|
-
this.dataSource = new AXDataSource({
|
|
944
|
-
byKey: (key) => {
|
|
945
|
-
const func = this.entityDef.queries.byKey.execute;
|
|
946
|
-
return func();
|
|
947
|
-
},
|
|
948
|
-
load: (e) => {
|
|
949
|
-
const func = this.entityDef.queries.list?.execute;
|
|
950
|
-
return func(e);
|
|
951
|
-
},
|
|
952
|
-
pageSize: this.view().pageSize || 10,
|
|
953
|
-
key: 'id',
|
|
954
|
-
});
|
|
955
|
-
this.selectedItems = signal([]);
|
|
956
|
-
this.parentKey = computed(() => {
|
|
957
|
-
return this.entityDef.parentKey;
|
|
958
|
-
});
|
|
959
|
-
this.hasSelectedItems = computed(() => {
|
|
960
|
-
return this.selectedItems().length > 0;
|
|
961
|
-
});
|
|
962
|
-
//****************** Title ******************//
|
|
963
|
-
this.title = computed(() => {
|
|
964
|
-
return this._viewDef.title ?? this.entityDef.formats.plural;
|
|
965
|
-
});
|
|
966
|
-
//****************** Description ******************//
|
|
967
|
-
this.description = computed(() => {
|
|
968
|
-
return this._viewDef.description ?? null;
|
|
969
|
-
});
|
|
970
|
-
//****************** Inline filter ******************//
|
|
971
|
-
this.inlineFiltersPlaceholders = computed(() => {
|
|
972
|
-
return this.entityDef.properties.filter((p) => p.options?.filter?.inline?.enabled).map((c) => c.title ?? c.name);
|
|
973
|
-
});
|
|
974
|
-
this.hasInlineFilters = computed(() => {
|
|
975
|
-
return this.inlineFiltersPlaceholders().length > 0;
|
|
976
|
-
});
|
|
977
|
-
//****************** Beardcrumbs ******************//
|
|
978
|
-
this.beardcrumbs = computed(() => {
|
|
979
|
-
return [
|
|
980
|
-
{
|
|
981
|
-
title: 'entity.home',
|
|
982
|
-
icon: 'fa-solid fa-home ax-text-xs ax-me-2',
|
|
983
|
-
url: [`/${this.session.application?.name}`],
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
title: this.title(),
|
|
987
|
-
url: [
|
|
988
|
-
`/${this.session.application?.name}`,
|
|
989
|
-
'm',
|
|
990
|
-
`${this.entityDef.module}`,
|
|
991
|
-
'e',
|
|
992
|
-
`${this.entityDef.name}`,
|
|
993
|
-
'list',
|
|
994
|
-
],
|
|
995
|
-
},
|
|
996
|
-
];
|
|
601
|
+
];
|
|
997
602
|
});
|
|
998
603
|
//****************** Actions ******************//
|
|
999
604
|
this.allActions = computed(() => {
|
|
@@ -1074,7 +679,7 @@ class AXPEntityMasterListViewModel {
|
|
|
1074
679
|
};
|
|
1075
680
|
this.sortedFields = signal([]);
|
|
1076
681
|
this.workflow.events$
|
|
1077
|
-
.pipe(ofType(
|
|
682
|
+
.pipe(ofType(AXPRefreshEvent))
|
|
1078
683
|
.pipe(takeUntil(this.destroyed))
|
|
1079
684
|
.subscribe((event) => {
|
|
1080
685
|
if (event.payload.entity == getEntityInfo(this.entityDef).source) {
|
|
@@ -1214,56 +819,363 @@ class AXPEntityMasterListViewModel {
|
|
|
1214
819
|
});
|
|
1215
820
|
});
|
|
1216
821
|
}
|
|
1217
|
-
//****************** Commands ******************//
|
|
1218
|
-
async executeCommand(commandName, data = null) {
|
|
1219
|
-
const action = this.allActions().find((c) => c.name == commandName &&
|
|
1220
|
-
((this.selectedItems().length
|
|
1221
|
-
? c.scope == AXPEntityCommandScope.Selected
|
|
1222
|
-
: c.scope == AXPEntityCommandScope.Individual) ||
|
|
1223
|
-
c.scope == AXPEntityCommandScope.TypeLevel));
|
|
1224
|
-
await this.workflow.execute(commandName, {
|
|
1225
|
-
entity: getEntityInfo(this.entityDef).source,
|
|
1226
|
-
entityInfo: {
|
|
1227
|
-
name: this.entityDef.name,
|
|
1228
|
-
module: this.entityDef.module,
|
|
1229
|
-
title: this.entityDef.title,
|
|
1230
|
-
parentKey: this.entityDef.parentKey,
|
|
1231
|
-
source: this.entityDef.source,
|
|
1232
|
-
},
|
|
1233
|
-
data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
|
|
1234
|
-
options: action?.options,
|
|
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
|
+
});
|
|
1235
1050
|
});
|
|
1236
1051
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
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
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
reset() {
|
|
1066
|
+
this.context.set(cloneDeep(this.entityData));
|
|
1241
1067
|
}
|
|
1242
1068
|
}
|
|
1243
|
-
class
|
|
1069
|
+
class AXPEntityMasterUpdateViewModelFactory {
|
|
1244
1070
|
constructor() {
|
|
1245
1071
|
this.entityService = inject(AXPEntityDefinitionRegistryService);
|
|
1246
1072
|
this.layout = inject(AXPLayoutThemeService);
|
|
1247
1073
|
this.injector = inject(Injector);
|
|
1248
1074
|
}
|
|
1249
|
-
async create(moduleName, entityName) {
|
|
1250
|
-
this.layout.setNavigationLoading(true);
|
|
1075
|
+
async create(moduleName, entityName, id, props) {
|
|
1251
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
|
+
}
|
|
1252
1084
|
this.layout.setNavigationLoading(false);
|
|
1253
|
-
return
|
|
1085
|
+
return Promise.reject('cannot fetch ');
|
|
1254
1086
|
}
|
|
1255
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1256
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
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' }); }
|
|
1257
1089
|
}
|
|
1258
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1090
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, decorators: [{
|
|
1259
1091
|
type: Injectable,
|
|
1260
1092
|
args: [{ providedIn: 'root' }]
|
|
1261
1093
|
}] });
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
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
|
+
},
|
|
1267
1179
|
};
|
|
1268
1180
|
|
|
1269
1181
|
class AXPEntityMasterSingleViewGroupViewModel {
|
|
@@ -1286,6 +1198,7 @@ class AXPEntityMasterSingleViewGroupViewModel {
|
|
|
1286
1198
|
});
|
|
1287
1199
|
this.props = computed(() => {
|
|
1288
1200
|
const { properties, interfaces } = this.entity;
|
|
1201
|
+
console.log({ properties });
|
|
1289
1202
|
const groupProperties = properties
|
|
1290
1203
|
.filter(({ groupId, schema }) => groupId === this.group.id && !schema.hidden)
|
|
1291
1204
|
.map(({ name }) => name);
|
|
@@ -2194,6 +2107,7 @@ const AXPLookupWidget = {
|
|
|
2194
2107
|
title: 'Lookup',
|
|
2195
2108
|
visible: false,
|
|
2196
2109
|
group: AXP_WIDGETS_EDITOR_GROUP,
|
|
2110
|
+
defaultFilterWidgetName: 'lookup-filter',
|
|
2197
2111
|
type: 'editor',
|
|
2198
2112
|
properties: [
|
|
2199
2113
|
AXP_DISABLED_PROPERTY,
|
|
@@ -2399,6 +2313,98 @@ const AXPWidgetSelectorWidget = {
|
|
|
2399
2313
|
},
|
|
2400
2314
|
};
|
|
2401
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
|
+
|
|
2402
2408
|
class AXPQuickEntityModifyPopupAction extends AXPWorkflowAction {
|
|
2403
2409
|
constructor() {
|
|
2404
2410
|
super(...arguments);
|