@acorex/platform 19.1.1 → 19.1.2
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/app/application.types.d.ts +4 -1
- package/common/lib/settings/settings.types.d.ts +1 -0
- package/fesm2022/acorex-platform-common.mjs +1 -1
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +9 -2
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +125 -115
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-setting.mjs +2 -2
- package/fesm2022/acorex-platform-layout-setting.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-CJ_HVKX-.mjs → acorex-platform-themes-default-entity-master-create-view.component-B13KvLX4.mjs} +3 -3
- package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-CJ_HVKX-.mjs.map → acorex-platform-themes-default-entity-master-create-view.component-B13KvLX4.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-BJ-ELNnN.mjs → acorex-platform-themes-default-entity-master-list-view.component-B6MXHPWi.mjs} +11 -11
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-BJ-ELNnN.mjs.map → acorex-platform-themes-default-entity-master-list-view.component-B6MXHPWi.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-DveB-N1Z.mjs → acorex-platform-themes-default-entity-master-modify-view.component-tKCGSRQT.mjs} +3 -3
- package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-DveB-N1Z.mjs.map → acorex-platform-themes-default-entity-master-modify-view.component-tKCGSRQT.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-q_DOP0cT.mjs → acorex-platform-themes-default-entity-master-single-view.component-CHvC0IAV.mjs} +8 -8
- package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-q_DOP0cT.mjs.map → acorex-platform-themes-default-entity-master-single-view.component-CHvC0IAV.mjs.map} +1 -1
- package/fesm2022/acorex-platform-themes-default.mjs +88 -65
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared.mjs +99 -6
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs → acorex-platform-widgets-checkbox-widget-designer.component-juhKoygA.mjs} +3 -3
- package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-juhKoygA.mjs.map +1 -0
- package/fesm2022/acorex-platform-widgets.mjs +168 -79
- package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
- package/layout/builder/lib/builder/widget.types.d.ts +1 -0
- package/layout/entity/lib/entity-master-create.viewmodel.d.ts +3 -3
- package/layout/entity/lib/entity.viewmodel.d.ts +1 -0
- package/layout/setting/lib/setting.viewmodel.d.ts +1 -1
- package/package.json +5 -5
- package/themes/default/lib/layouts/base/simple-page/simple-page.layout.d.ts +47 -2
- package/themes/default/lib/layouts/setting-layout/index.d.ts +0 -1
- package/themes/default/lib/layouts/setting-layout/setting-page/setting-page.component.d.ts +6 -0
- package/themes/shared/lib/components/layout-elements/index.d.ts +2 -0
- package/themes/shared/lib/components/layout-elements/layout-blocks.component.d.ts +1 -1
- package/themes/shared/lib/components/layout-elements/layout-page-actions.component.d.ts +20 -0
- package/themes/shared/lib/components/layout-elements/layout-page-side.component.d.ts +5 -0
- package/widgets/lib/properties/layout.props.d.ts +2 -0
- package/widgets/lib/widgets/index.d.ts +1 -0
- package/widgets/lib/widgets/property-editors/border/border-widget-editor.component.d.ts +11 -0
- package/widgets/lib/widgets/property-editors/border/border-widget-type.d.ts +18 -0
- package/widgets/lib/widgets/property-editors/border/border-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/property-editors/border/index.d.ts +2 -0
- package/widgets/lib/widgets/property-editors/spacing/spacing-widget-editor.component.d.ts +2 -3
- package/widgets/lib/widgets/property-editors/spacing/spacing-widget-type.d.ts +3 -3
- package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs.map +0 -1
- package/themes/default/lib/layouts/setting-layout/setting-menu/setting-menu.component.d.ts +0 -10
|
@@ -6,16 +6,16 @@ import * as i1$3 from '@acorex/platform/workflow';
|
|
|
6
6
|
import { AXPWorkflowService, createWorkFlowEvent, AXPWorkflowAction, ofType, 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
|
-
import { cloneDeep, set, merge, isNil, get, sortBy } from 'lodash-es';
|
|
10
9
|
import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
|
|
10
|
+
import { cloneDeep, set, merge, isNil, get, sortBy } from 'lodash-es';
|
|
11
11
|
import { AXPSessionService, AXPAuthGuard } from '@acorex/platform/auth';
|
|
12
12
|
import { Subject, takeUntil } from 'rxjs';
|
|
13
|
-
import { AXDialogService } from '@acorex/components/dialog';
|
|
14
|
-
import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
|
|
15
|
-
import * as i8 from '@acorex/core/translation';
|
|
16
|
-
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
17
13
|
import { AXPopupService } from '@acorex/components/popup';
|
|
18
14
|
import { AXPlatform } from '@acorex/core/platform';
|
|
15
|
+
import * as i8 from '@acorex/core/translation';
|
|
16
|
+
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
17
|
+
import { AXDialogService } from '@acorex/components/dialog';
|
|
18
|
+
import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
|
|
19
19
|
import * as i7 from '@acorex/platform/layout/builder';
|
|
20
20
|
import { AXPWidgetComponent, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPColumnWidgetComponent, AXP_WIDGETS_EDITOR_GROUP, AXPWidgetsCatalog, AXPWidgetRegistryService } from '@acorex/platform/layout/builder';
|
|
21
21
|
import { RouterModule, ROUTES } from '@angular/router';
|
|
@@ -77,7 +77,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
77
77
|
|
|
78
78
|
class AXPEntityCommandTriggerViewModel {
|
|
79
79
|
constructor(entity, action) {
|
|
80
|
-
this.name = action.command;
|
|
80
|
+
this.name = typeof action.command === 'string' ? action.command : action.command.name;
|
|
81
|
+
this.options = typeof action.command === 'object' ? action.command.options : undefined;
|
|
81
82
|
const resolvedLook = resolveActionLook(action);
|
|
82
83
|
this.priority = action.priority;
|
|
83
84
|
this.title = action.title;
|
|
@@ -354,28 +355,25 @@ class AXPEntityCreateViewSectionViewModel {
|
|
|
354
355
|
constructor(entity, section) {
|
|
355
356
|
this.entity = entity;
|
|
356
357
|
this.section = section;
|
|
357
|
-
this.group = this.entity.groups?.find(c => c.id == this.section.id);
|
|
358
|
+
this.group = this.entity.groups?.find((c) => c.id == this.section.id);
|
|
358
359
|
this.name = signal(this.group.id);
|
|
359
360
|
this.title = computed(() => {
|
|
360
361
|
return this.group.title ?? this.group.id;
|
|
361
362
|
});
|
|
362
363
|
this.description = computed(() => {
|
|
363
364
|
return this.group.description;
|
|
364
|
-
;
|
|
365
365
|
});
|
|
366
366
|
this.layout = computed(() => {
|
|
367
367
|
const source = cloneDeep(this.section.layout ?? {});
|
|
368
|
-
set(source,
|
|
368
|
+
set(source, 'positions.default.colSpan', 12);
|
|
369
369
|
return source;
|
|
370
370
|
});
|
|
371
371
|
this.elements = computed(() => {
|
|
372
372
|
const { interfaces, properties } = this.entity;
|
|
373
373
|
const createProps = interfaces?.master?.create?.properties ?? [];
|
|
374
374
|
const createPropNames = new Set(createProps.map(({ name }) => name));
|
|
375
|
-
const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id &&
|
|
376
|
-
|
|
377
|
-
createPropNames.has(name));
|
|
378
|
-
return filteredProperties.map(property => {
|
|
375
|
+
const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id && !schema.hidden && createPropNames.has(name));
|
|
376
|
+
return filteredProperties.map((property) => {
|
|
379
377
|
const createProp = createProps.find(({ name }) => name === property.name);
|
|
380
378
|
return new AXPEntityCreateViewElementViewModel(this.entity, this, property, createProp);
|
|
381
379
|
});
|
|
@@ -395,11 +393,11 @@ class AXPEntityCreateViewElementViewModel {
|
|
|
395
393
|
return !(this.property.schema.readonly ?? false);
|
|
396
394
|
});
|
|
397
395
|
this.isRequired = computed(() => {
|
|
398
|
-
return this.property.validations?.some(c => c.rule == 'required') || false;
|
|
396
|
+
return this.property.validations?.some((c) => c.rule == 'required') || false;
|
|
399
397
|
});
|
|
400
398
|
this.layout = computed(() => {
|
|
401
399
|
const source = cloneDeep(this.createProp.layout ?? {});
|
|
402
|
-
set(source,
|
|
400
|
+
set(source, 'positions.default.colSpan', 12);
|
|
403
401
|
return source;
|
|
404
402
|
});
|
|
405
403
|
this.node = computed(() => {
|
|
@@ -414,7 +412,7 @@ class AXPEntityCreateViewElementViewModel {
|
|
|
414
412
|
triggers: widget.triggers,
|
|
415
413
|
options: merge(schema.interface?.options,
|
|
416
414
|
//this.property.options?.create?.widget,
|
|
417
|
-
{ validationRules: this.property.validations })
|
|
415
|
+
{ validationRules: this.property.validations }),
|
|
418
416
|
};
|
|
419
417
|
});
|
|
420
418
|
}
|
|
@@ -435,13 +433,13 @@ class AXPEntityMasterCreateViewModel {
|
|
|
435
433
|
const createProps = interfaces?.master?.create?.properties?.map(({ name }) => name) ?? [];
|
|
436
434
|
const visibleProperties = properties.filter(({ groupId, schema, name }) => groupId && !schema.hidden && createProps.includes(name));
|
|
437
435
|
const sections = interfaces?.master?.create?.sections?.filter(({ id }) => visibleProperties.some(({ groupId }) => groupId === id)) ?? [];
|
|
438
|
-
return sections.map(section => new AXPEntityCreateViewSectionViewModel(this.entityDef, section));
|
|
436
|
+
return sections.map((section) => new AXPEntityCreateViewSectionViewModel(this.entityDef, section));
|
|
439
437
|
});
|
|
440
438
|
if (!initialData)
|
|
441
439
|
initialData = {};
|
|
442
440
|
this.config.properties
|
|
443
|
-
.filter(c => c.schema.defaultValue != null)
|
|
444
|
-
.forEach(p => {
|
|
441
|
+
.filter((c) => c.schema.defaultValue != null)
|
|
442
|
+
.forEach((p) => {
|
|
445
443
|
if (typeof p.schema.defaultValue === 'function') {
|
|
446
444
|
const func = p.schema.defaultValue;
|
|
447
445
|
set(initialData, p.name, func(initialData));
|
|
@@ -459,7 +457,7 @@ class AXPEntityMasterCreateViewModel {
|
|
|
459
457
|
try {
|
|
460
458
|
this.isInProgress.set(true);
|
|
461
459
|
const exec = this.entityDef.commands?.create?.execute;
|
|
462
|
-
return await exec(
|
|
460
|
+
return await exec(this.context());
|
|
463
461
|
}
|
|
464
462
|
finally {
|
|
465
463
|
this.isInProgress.set(false);
|
|
@@ -467,7 +465,11 @@ class AXPEntityMasterCreateViewModel {
|
|
|
467
465
|
}
|
|
468
466
|
async createNewOne() {
|
|
469
467
|
await this.workflow.execute('create-entity', {
|
|
470
|
-
entity: getEntityInfo(this.entityDef).source
|
|
468
|
+
entity: getEntityInfo(this.entityDef).source,
|
|
469
|
+
options: {
|
|
470
|
+
redirect: false,
|
|
471
|
+
canCreateNewOne: this.canCreateNewOne,
|
|
472
|
+
},
|
|
471
473
|
});
|
|
472
474
|
}
|
|
473
475
|
}
|
|
@@ -478,6 +480,7 @@ class AXPEntityCreateViewModelFactory {
|
|
|
478
480
|
this.injector = inject(Injector);
|
|
479
481
|
}
|
|
480
482
|
async create(moduleName, entityName, initialData = null, options = { canCreateNewOne: false, redirect: true }) {
|
|
483
|
+
console.log(options);
|
|
481
484
|
this.layout.setNavigationLoading(true);
|
|
482
485
|
const config = await this.entityService.resolve(moduleName, entityName);
|
|
483
486
|
this.layout.setNavigationLoading(false);
|
|
@@ -491,6 +494,97 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
491
494
|
args: [{ providedIn: 'root' }]
|
|
492
495
|
}] });
|
|
493
496
|
|
|
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
|
+
}
|
|
530
|
+
}
|
|
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
|
+
}
|
|
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') }));
|
|
540
|
+
}
|
|
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',
|
|
565
|
+
},
|
|
566
|
+
nextSteps: [
|
|
567
|
+
{
|
|
568
|
+
conditions: [],
|
|
569
|
+
nextStepId: 'dispatch-event',
|
|
570
|
+
},
|
|
571
|
+
],
|
|
572
|
+
},
|
|
573
|
+
'dispatch-event': {
|
|
574
|
+
action: 'AXPEntityCreateSubmittedAction',
|
|
575
|
+
nextSteps: [
|
|
576
|
+
{
|
|
577
|
+
conditions: [{ type: 'SINGLE', expression: 'context.getVariable("options")?.redirect != false' }],
|
|
578
|
+
nextStepId: 'show-entity',
|
|
579
|
+
},
|
|
580
|
+
],
|
|
581
|
+
},
|
|
582
|
+
'show-entity': {
|
|
583
|
+
action: 'AXPShowDetailViewAction',
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
};
|
|
587
|
+
|
|
494
588
|
const AXPEntityDeletedEvent = createWorkFlowEvent('[Entity] Deleted');
|
|
495
589
|
class AXPEntityPerformDeleteAction extends AXPWorkflowAction {
|
|
496
590
|
constructor() {
|
|
@@ -659,9 +753,6 @@ class AXPEntityMasterListViewModel {
|
|
|
659
753
|
//****************** Views ******************//
|
|
660
754
|
this.views = computed(() => {
|
|
661
755
|
const views = this.entityDef.interfaces?.master?.list?.views ?? [];
|
|
662
|
-
console.log(views.map((v) => {
|
|
663
|
-
return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
|
|
664
|
-
}));
|
|
665
756
|
return views.map((v) => {
|
|
666
757
|
return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
|
|
667
758
|
});
|
|
@@ -796,7 +887,7 @@ class AXPEntityMasterListViewModel {
|
|
|
796
887
|
};
|
|
797
888
|
this.sortedFields = signal([]);
|
|
798
889
|
this.workflow.events$
|
|
799
|
-
.pipe(ofType(AXPEntityDeletedEvent))
|
|
890
|
+
.pipe(ofType(AXPEntityDeletedEvent, AXPEntityCreateEvent))
|
|
800
891
|
.pipe(takeUntil(this.destroyed))
|
|
801
892
|
.subscribe((event) => {
|
|
802
893
|
if (event.payload.entity == getEntityInfo(this.entityDef).source) {
|
|
@@ -924,9 +1015,18 @@ class AXPEntityMasterListViewModel {
|
|
|
924
1015
|
? c.scope == AXPEntityCommandScope.Selected
|
|
925
1016
|
: c.scope == AXPEntityCommandScope.Individual) ||
|
|
926
1017
|
c.scope == AXPEntityCommandScope.TypeLevel));
|
|
1018
|
+
console.log('action: ', action);
|
|
927
1019
|
await this.workflow.execute(commandName, {
|
|
928
1020
|
entity: getEntityInfo(this.entityDef).source,
|
|
1021
|
+
entityInfo: {
|
|
1022
|
+
name: this.entityDef.name,
|
|
1023
|
+
module: this.entityDef.module,
|
|
1024
|
+
title: this.entityDef.title,
|
|
1025
|
+
parentKey: this.entityDef.parentKey,
|
|
1026
|
+
source: this.entityDef.source,
|
|
1027
|
+
},
|
|
929
1028
|
data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
|
|
1029
|
+
options: action?.options,
|
|
930
1030
|
});
|
|
931
1031
|
}
|
|
932
1032
|
//
|
|
@@ -2276,96 +2376,6 @@ const AXPWidgetSelectorWidget = {
|
|
|
2276
2376
|
},
|
|
2277
2377
|
};
|
|
2278
2378
|
|
|
2279
|
-
const AXPEntityCreateEvent = createWorkFlowEvent('[Entity] Created!');
|
|
2280
|
-
class AXPEntityCreatePopupAction extends AXPWorkflowAction {
|
|
2281
|
-
constructor() {
|
|
2282
|
-
super(...arguments);
|
|
2283
|
-
this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
|
|
2284
|
-
this.popupService = inject(AXPopupService);
|
|
2285
|
-
this.platform = inject(AXPlatform);
|
|
2286
|
-
this.factory = inject(AXPEntityCreateViewModelFactory);
|
|
2287
|
-
this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
|
|
2288
|
-
this.translateService = inject(AXTranslationService);
|
|
2289
|
-
}
|
|
2290
|
-
async execute(context) {
|
|
2291
|
-
const [module, entity] = context.getVariable('entity').split('.');
|
|
2292
|
-
const data = context.getVariable('data');
|
|
2293
|
-
const canCreateNewOne = context.getVariable('canCreateNewOne') ?? false;
|
|
2294
|
-
const redirect = context.getVariable('redirect') ?? true;
|
|
2295
|
-
const entityRef = await this.entityRegistery.resolve(module, entity);
|
|
2296
|
-
const com = await this.config.viewers.master.create();
|
|
2297
|
-
const result = await this.popupService.open(com, {
|
|
2298
|
-
title: `${await this.translateService.translateAsync('create-new')} ${await this.translateService.translateAsync(entityRef.formats.individual)}`,
|
|
2299
|
-
size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
|
|
2300
|
-
data: {
|
|
2301
|
-
vm: await this.factory.create(module, entity, data, { canCreateNewOne, redirect }),
|
|
2302
|
-
entity,
|
|
2303
|
-
},
|
|
2304
|
-
});
|
|
2305
|
-
context.setOutput('result', false);
|
|
2306
|
-
if (result.data?.save) {
|
|
2307
|
-
context.setOutput('result', true);
|
|
2308
|
-
const prevData = context.getVariable('data');
|
|
2309
|
-
context.setVariable('data', { ...prevData, ...result.data.item });
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2313
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction }); }
|
|
2314
|
-
}
|
|
2315
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreatePopupAction, decorators: [{
|
|
2316
|
-
type: Injectable
|
|
2317
|
-
}] });
|
|
2318
|
-
class AXPEntityCreateSubmittedAction extends AXPWorkflowAction {
|
|
2319
|
-
async execute(context) {
|
|
2320
|
-
this.dispatch(AXPEntityCreateEvent({ entity: context.getVariable('entity'), meta: context.getVariable('meta') }));
|
|
2321
|
-
}
|
|
2322
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2323
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction }); }
|
|
2324
|
-
}
|
|
2325
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPEntityCreateSubmittedAction, decorators: [{
|
|
2326
|
-
type: Injectable
|
|
2327
|
-
}] });
|
|
2328
|
-
const AXPCreateEntityWorkflow = {
|
|
2329
|
-
startStepId: 'show-popup',
|
|
2330
|
-
steps: {
|
|
2331
|
-
'show-popup': {
|
|
2332
|
-
action: 'AXPEntityCreatePopupAction',
|
|
2333
|
-
nextSteps: [
|
|
2334
|
-
{
|
|
2335
|
-
conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
|
|
2336
|
-
nextStepId: 'show-toast',
|
|
2337
|
-
},
|
|
2338
|
-
],
|
|
2339
|
-
},
|
|
2340
|
-
'show-toast': {
|
|
2341
|
-
action: 'AXPToastAction',
|
|
2342
|
-
input: {
|
|
2343
|
-
color: 'success',
|
|
2344
|
-
title: 'workflow.entity-created',
|
|
2345
|
-
content: 'workflow.entity-created-body',
|
|
2346
|
-
},
|
|
2347
|
-
nextSteps: [
|
|
2348
|
-
{
|
|
2349
|
-
conditions: [],
|
|
2350
|
-
nextStepId: 'dispatch-event',
|
|
2351
|
-
},
|
|
2352
|
-
],
|
|
2353
|
-
},
|
|
2354
|
-
'dispatch-event': {
|
|
2355
|
-
action: 'AXPEntityCreateSubmittedAction',
|
|
2356
|
-
nextSteps: [
|
|
2357
|
-
{
|
|
2358
|
-
conditions: [{ type: 'SINGLE', expression: 'context.getVariable("redirect") != false' }],
|
|
2359
|
-
nextStepId: 'show-entity',
|
|
2360
|
-
},
|
|
2361
|
-
],
|
|
2362
|
-
},
|
|
2363
|
-
'show-entity': {
|
|
2364
|
-
action: 'AXPShowDetailViewAction',
|
|
2365
|
-
},
|
|
2366
|
-
},
|
|
2367
|
-
};
|
|
2368
|
-
|
|
2369
2379
|
class AXPShowDetailViewAction extends AXPWorkflowAction {
|
|
2370
2380
|
constructor() {
|
|
2371
2381
|
super(...arguments);
|