@acorex/platform 19.4.11 → 19.4.12

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.
@@ -350,19 +350,187 @@ class AXPEntityDetailListViewModel {
350
350
  }
351
351
  }
352
352
 
353
- class AXPEntityMiddleware {
353
+ function createModifierContext(entity) {
354
+ const ctx = {
355
+ entity,
356
+ title: {
357
+ get: () => entity.title,
358
+ set: (newTitle) => {
359
+ entity.title = newTitle;
360
+ return ctx;
361
+ },
362
+ },
363
+ module: {
364
+ get: () => entity.module,
365
+ set: (newValue) => {
366
+ entity.module = newValue;
367
+ return ctx;
368
+ },
369
+ },
370
+ name: {
371
+ get: () => entity.name,
372
+ set: (newValue) => {
373
+ entity.name = newValue;
374
+ return ctx;
375
+ },
376
+ },
377
+ source: {
378
+ get: () => entity.source,
379
+ set: (newValue) => {
380
+ entity.source = newValue;
381
+ return ctx;
382
+ },
383
+ },
384
+ parentKey: {
385
+ get: () => entity.parentKey,
386
+ set: (newValue) => {
387
+ entity.parentKey = newValue;
388
+ return ctx;
389
+ },
390
+ },
391
+ category: {
392
+ get: () => entity.category,
393
+ update: (updater) => {
394
+ entity.category = updater(entity.category);
395
+ return ctx;
396
+ },
397
+ },
398
+ properties: {
399
+ list: () => entity.properties,
400
+ add: (...props) => {
401
+ entity.properties.push(...props);
402
+ return ctx;
403
+ },
404
+ remove: (predicate) => {
405
+ entity.properties = entity.properties.filter((p) => !predicate(p));
406
+ return ctx;
407
+ },
408
+ find: (name) => ({
409
+ get: () => entity.properties.find((p) => p.name === name),
410
+ update: (updater) => {
411
+ const index = entity.properties.findIndex((p) => p.name === name);
412
+ if (index !== -1)
413
+ entity.properties[index] = updater(entity.properties[index]);
414
+ return ctx;
415
+ },
416
+ }),
417
+ },
418
+ columns: {
419
+ list: () => entity.columns,
420
+ add: (...cols) => {
421
+ entity.columns ??= [];
422
+ entity.columns.push(...cols);
423
+ return ctx;
424
+ },
425
+ remove: (predicate) => {
426
+ if (entity.columns)
427
+ entity.columns = entity.columns.filter((c) => !predicate(c));
428
+ return ctx;
429
+ },
430
+ find: (name) => ({
431
+ get: () => entity.columns?.find((c) => c.name === name),
432
+ update: (updater) => {
433
+ const index = entity.columns?.findIndex((c) => c.name === name);
434
+ if (index !== undefined && index !== -1 && entity.columns)
435
+ entity.columns[index] = updater(entity.columns[index]);
436
+ return ctx;
437
+ },
438
+ }),
439
+ },
440
+ formats: {
441
+ get: () => entity.formats,
442
+ update: (updater) => {
443
+ entity.formats = updater(entity.formats);
444
+ return ctx;
445
+ },
446
+ },
447
+ relatedEntities: {
448
+ list: () => entity.relatedEntities,
449
+ add: (...items) => {
450
+ entity.relatedEntities ??= [];
451
+ entity.relatedEntities.push(...items);
452
+ return ctx;
453
+ },
454
+ remove: (predicate) => {
455
+ if (entity.relatedEntities)
456
+ entity.relatedEntities = entity.relatedEntities.filter((r) => !predicate(r));
457
+ return ctx;
458
+ },
459
+ },
460
+ groups: {
461
+ list: () => entity.groups,
462
+ add: (...items) => {
463
+ entity.groups ??= [];
464
+ entity.groups.push(...items);
465
+ return ctx;
466
+ },
467
+ remove: (predicate) => {
468
+ if (entity.groups)
469
+ entity.groups = entity.groups.filter((g) => !predicate(g));
470
+ return ctx;
471
+ },
472
+ },
473
+ commands: {
474
+ get: () => entity.commands,
475
+ update: (updater) => {
476
+ entity.commands = updater(entity.commands);
477
+ return ctx;
478
+ },
479
+ },
480
+ queries: {
481
+ get: () => entity.queries,
482
+ update: (updater) => {
483
+ entity.queries = updater(entity.queries);
484
+ return ctx;
485
+ },
486
+ },
487
+ validations: {
488
+ get: () => entity.validations,
489
+ update: (updater) => {
490
+ entity.validations = updater(entity.validations);
491
+ return ctx;
492
+ },
493
+ },
494
+ interfaces: {
495
+ get: () => entity.interfaces,
496
+ update: (updater) => {
497
+ entity.interfaces = updater(entity.interfaces);
498
+ return ctx;
499
+ },
500
+ },
501
+ toEntity: () => entity,
502
+ };
503
+ return ctx;
354
504
  }
355
- class AXPEntityMiddlewareDefault extends AXPEntityMiddleware {
356
- process(entity) {
357
- return entity;
505
+
506
+ const AXP_ENTITY_MODIFIER = new InjectionToken('AXP_ENTITY_MODIFIER');
507
+
508
+ class AXPEntityMiddleware {
509
+ constructor() {
510
+ this.modifiers = new Map();
511
+ this.providedModifiers = inject(AXP_ENTITY_MODIFIER, { optional: true }) || [];
512
+ for (const { entityName, modifier } of this.providedModifiers) {
513
+ this.register(entityName, modifier);
514
+ }
515
+ }
516
+ register(entityName, modifier) {
517
+ this.modifiers.set(entityName, modifier);
358
518
  }
359
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddlewareDefault, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
360
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddlewareDefault, providedIn: 'root' }); }
519
+ process(entity) {
520
+ const modifier = this.modifiers.get(entity.name);
521
+ if (!modifier)
522
+ return entity;
523
+ const context = createModifierContext(entity);
524
+ modifier(context);
525
+ return context.toEntity();
526
+ }
527
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddleware, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
528
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddleware, providedIn: 'root' }); }
361
529
  }
362
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddlewareDefault, decorators: [{
530
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddleware, decorators: [{
363
531
  type: Injectable,
364
532
  args: [{ providedIn: 'root' }]
365
- }] });
533
+ }], ctorParameters: () => [] });
366
534
 
367
535
  class AXPEntityDefinitionRegistryService {
368
536
  constructor() {
@@ -3397,36 +3565,6 @@ const AXPShowDetailsViewWorkflow = {
3397
3565
  },
3398
3566
  };
3399
3567
 
3400
- class AXPShowListViewAction extends AXPWorkflowAction {
3401
- constructor() {
3402
- super(...arguments);
3403
- this.navigation = inject(AXPWorkflowNavigateAction);
3404
- this.sessionService = inject(AXPSessionService);
3405
- }
3406
- async execute(context) {
3407
- const [moduleName, entityName] = context.getVariable('entity').split(".");
3408
- const newPayload = {
3409
- commands: `/${this.sessionService.application?.name}/m/${moduleName}/e/${entityName}/list`,
3410
- };
3411
- context.setVariable('payload', newPayload);
3412
- this.navigation.execute(context);
3413
- }
3414
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
3415
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction }); }
3416
- }
3417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction, decorators: [{
3418
- type: Injectable
3419
- }] });
3420
- const AXPShowListViewWorkflow = {
3421
- startStepId: 'showListView',
3422
- steps: {
3423
- showListView: {
3424
- id: 'showListView',
3425
- action: 'AXPShowListViewAction',
3426
- },
3427
- },
3428
- };
3429
-
3430
3568
  class AXPShowFileUploaderPopupAction extends AXPWorkflowAction {
3431
3569
  constructor() {
3432
3570
  super(...arguments);
@@ -3505,6 +3643,36 @@ const AXPShowFileUploaderPopupWorkflow = {
3505
3643
  },
3506
3644
  };
3507
3645
 
3646
+ class AXPShowListViewAction extends AXPWorkflowAction {
3647
+ constructor() {
3648
+ super(...arguments);
3649
+ this.navigation = inject(AXPWorkflowNavigateAction);
3650
+ this.sessionService = inject(AXPSessionService);
3651
+ }
3652
+ async execute(context) {
3653
+ const [moduleName, entityName] = context.getVariable('entity').split(".");
3654
+ const newPayload = {
3655
+ commands: `/${this.sessionService.application?.name}/m/${moduleName}/e/${entityName}/list`,
3656
+ };
3657
+ context.setVariable('payload', newPayload);
3658
+ this.navigation.execute(context);
3659
+ }
3660
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
3661
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction }); }
3662
+ }
3663
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction, decorators: [{
3664
+ type: Injectable
3665
+ }] });
3666
+ const AXPShowListViewWorkflow = {
3667
+ startStepId: 'showListView',
3668
+ steps: {
3669
+ showListView: {
3670
+ id: 'showListView',
3671
+ action: 'AXPShowListViewAction',
3672
+ },
3673
+ },
3674
+ };
3675
+
3508
3676
  function routesFacory() {
3509
3677
  const config = inject(AXP_ENTITY_CONFIG_TOKEN);
3510
3678
  let routes = [];
@@ -3570,6 +3738,7 @@ class AXPEntityModule {
3570
3738
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityModule, deps: [{ token: i1$4.AXPAppStartUpService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule }); }
3571
3739
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityModule, imports: [RouterModule, i2$2.AXPWorkflowModule, i7.AXPLayoutBuilderModule] }); }
3572
3740
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityModule, providers: [
3741
+ // CUSTOMER_MODIFIER_PROVIDER,
3573
3742
  {
3574
3743
  provide: ROUTES,
3575
3744
  multi: true,
@@ -3585,10 +3754,6 @@ class AXPEntityModule {
3585
3754
  useClass: AXPEntityCommandSearchDefinitionProvider,
3586
3755
  multi: true,
3587
3756
  },
3588
- {
3589
- provide: AXPEntityMiddleware,
3590
- useClass: AXPEntityMiddlewareDefault,
3591
- },
3592
3757
  ], imports: [RouterModule,
3593
3758
  AXPWorkflowModule.forChild({
3594
3759
  actions: {
@@ -3660,6 +3825,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3660
3825
  exports: [],
3661
3826
  declarations: [],
3662
3827
  providers: [
3828
+ // CUSTOMER_MODIFIER_PROVIDER,
3663
3829
  {
3664
3830
  provide: ROUTES,
3665
3831
  multi: true,
@@ -3675,10 +3841,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3675
3841
  useClass: AXPEntityCommandSearchDefinitionProvider,
3676
3842
  multi: true,
3677
3843
  },
3678
- {
3679
- provide: AXPEntityMiddleware,
3680
- useClass: AXPEntityMiddlewareDefault,
3681
- },
3682
3844
  ],
3683
3845
  }]
3684
3846
  }], ctorParameters: () => [{ type: i1$4.AXPAppStartUpService }, { type: i0.Injector }] });
@@ -3702,5 +3864,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3702
3864
  * Generated bundle index. Do not edit.
3703
3865
  */
3704
3866
 
3705
- export { AXMEntityCrudService, AXMEntityCrudServiceImpl, AXPCreateEntityWorkflow, AXPDataSeederService, AXPDeleteEntityWorkflow, AXPEntityApplyUpdatesAction, AXPEntityCommandTriggerViewModel, AXPEntityCreateEvent, AXPEntityCreatePopupAction, AXPEntityCreateSubmittedAction, AXPEntityCreateViewElementViewModel, AXPEntityCreateViewModelFactory, AXPEntityCreateViewSectionViewModel, AXPEntityDataProvider, AXPEntityDataProviderImpl, AXPEntityDefinitionRegistryService, AXPEntityDeletedEvent, AXPEntityDetailListViewModel, AXPEntityDetailViewModelFactory, AXPEntityDetailViewModelResolver, AXPEntityListViewColumnViewModel, AXPEntityListViewModelFactory, AXPEntityListViewModelResolver, AXPEntityMasterCreateViewModel, AXPEntityMasterListViewModel, AXPEntityMasterListViewQueryViewModel, AXPEntityMasterSingleElementViewModel, AXPEntityMasterSingleViewGroupViewModel, AXPEntityMasterSingleViewModel, AXPEntityMasterUpdateElementViewModel, AXPEntityMasterUpdateViewModel, AXPEntityMasterUpdateViewModelFactory, AXPEntityMiddleware, AXPEntityMiddlewareDefault, AXPEntityModifyConfirmedAction, AXPEntityModifyEvent, AXPEntityModifySectionPopupAction, AXPEntityModule, AXPEntityPerformDeleteAction, AXPEntityResolver, AXPEntityService, AXPEntityStorageService, AXPModifyEntitySectionWorkflow, AXPQuickEntityModifyPopupAction, AXPQuickModifyEntityWorkflow, AXPShowDetailViewAction, AXPShowDetailsViewWorkflow, AXPShowListViewAction, AXPShowListViewWorkflow, AXP_DATA_SEEDER_TOKEN, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_DEFINITION_LOADER };
3867
+ export { AXMEntityCrudService, AXMEntityCrudServiceImpl, AXPCreateEntityWorkflow, AXPDataSeederService, AXPDeleteEntityWorkflow, AXPEntityApplyUpdatesAction, AXPEntityCommandTriggerViewModel, AXPEntityCreateEvent, AXPEntityCreatePopupAction, AXPEntityCreateSubmittedAction, AXPEntityCreateViewElementViewModel, AXPEntityCreateViewModelFactory, AXPEntityCreateViewSectionViewModel, AXPEntityDataProvider, AXPEntityDataProviderImpl, AXPEntityDefinitionRegistryService, AXPEntityDeletedEvent, AXPEntityDetailListViewModel, AXPEntityDetailViewModelFactory, AXPEntityDetailViewModelResolver, AXPEntityListViewColumnViewModel, AXPEntityListViewModelFactory, AXPEntityListViewModelResolver, AXPEntityMasterCreateViewModel, AXPEntityMasterListViewModel, AXPEntityMasterListViewQueryViewModel, AXPEntityMasterSingleElementViewModel, AXPEntityMasterSingleViewGroupViewModel, AXPEntityMasterSingleViewModel, AXPEntityMasterUpdateElementViewModel, AXPEntityMasterUpdateViewModel, AXPEntityMasterUpdateViewModelFactory, AXPEntityMiddleware, AXPEntityModifyConfirmedAction, AXPEntityModifyEvent, AXPEntityModifySectionPopupAction, AXPEntityModule, AXPEntityPerformDeleteAction, AXPEntityResolver, AXPEntityService, AXPEntityStorageService, AXPModifyEntitySectionWorkflow, AXPQuickEntityModifyPopupAction, AXPQuickModifyEntityWorkflow, AXPShowDetailViewAction, AXPShowDetailsViewWorkflow, AXPShowListViewAction, AXPShowListViewWorkflow, AXP_DATA_SEEDER_TOKEN, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_DEFINITION_LOADER, AXP_ENTITY_MODIFIER, createModifierContext };
3706
3868
  //# sourceMappingURL=acorex-platform-layout-entity.mjs.map