@acorex/platform 19.4.11 → 19.4.13

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,239 @@ 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
+ master: {
501
+ get: () => entity.interfaces?.master,
502
+ update: (updater) => {
503
+ entity.interfaces ??= {};
504
+ entity.interfaces.master = updater(entity.interfaces.master);
505
+ return ctx;
506
+ },
507
+ create: {
508
+ get: () => entity.interfaces?.master?.create,
509
+ update: (updater) => {
510
+ entity.interfaces ??= {};
511
+ entity.interfaces.master ??= {};
512
+ entity.interfaces.master.create = updater(entity.interfaces.master.create);
513
+ return ctx;
514
+ },
515
+ },
516
+ modify: {
517
+ get: () => entity.interfaces?.master?.create,
518
+ update: (updater) => {
519
+ entity.interfaces ??= {};
520
+ entity.interfaces.master ??= {};
521
+ entity.interfaces.master.update = updater(entity.interfaces.master.update);
522
+ return ctx;
523
+ },
524
+ },
525
+ single: {
526
+ get: () => entity.interfaces?.master?.single,
527
+ update: (updater) => {
528
+ entity.interfaces ??= {};
529
+ entity.interfaces.master ??= {};
530
+ entity.interfaces.master.single = updater(entity.interfaces.master.single);
531
+ return ctx;
532
+ },
533
+ },
534
+ },
535
+ detail: {
536
+ get: () => entity.interfaces?.detail,
537
+ update: (updater) => {
538
+ entity.interfaces ??= {};
539
+ entity.interfaces.detail = updater(entity.interfaces.detail);
540
+ return ctx;
541
+ },
542
+ list: {
543
+ get: () => entity.interfaces?.detail?.list,
544
+ update: (updater) => {
545
+ entity.interfaces ??= {};
546
+ entity.interfaces.detail ??= {};
547
+ entity.interfaces.detail.list = updater(entity.interfaces.detail.list);
548
+ return ctx;
549
+ },
550
+ },
551
+ },
552
+ },
553
+ toEntity: () => entity,
554
+ };
555
+ return ctx;
354
556
  }
355
- class AXPEntityMiddlewareDefault extends AXPEntityMiddleware {
356
- process(entity) {
357
- return entity;
557
+
558
+ const AXP_ENTITY_MODIFIER = new InjectionToken('AXP_ENTITY_MODIFIER');
559
+
560
+ class AXPEntityMiddleware {
561
+ constructor() {
562
+ this.modifiers = new Map();
563
+ this.providedModifiers = inject(AXP_ENTITY_MODIFIER, { optional: true }) || [];
564
+ for (const { entityName, modifier } of this.providedModifiers) {
565
+ this.register(entityName, modifier);
566
+ }
358
567
  }
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' }); }
568
+ register(entityName, modifier) {
569
+ this.modifiers.set(entityName, modifier);
570
+ }
571
+ process(entity) {
572
+ const modifier = this.modifiers.get(entity.name);
573
+ if (!modifier)
574
+ return entity;
575
+ const context = createModifierContext(entity);
576
+ modifier(context);
577
+ return context.toEntity();
578
+ }
579
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddleware, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
580
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddleware, providedIn: 'root' }); }
361
581
  }
362
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddlewareDefault, decorators: [{
582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityMiddleware, decorators: [{
363
583
  type: Injectable,
364
584
  args: [{ providedIn: 'root' }]
365
- }] });
585
+ }], ctorParameters: () => [] });
366
586
 
367
587
  class AXPEntityDefinitionRegistryService {
368
588
  constructor() {
@@ -3397,36 +3617,6 @@ const AXPShowDetailsViewWorkflow = {
3397
3617
  },
3398
3618
  };
3399
3619
 
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
3620
  class AXPShowFileUploaderPopupAction extends AXPWorkflowAction {
3431
3621
  constructor() {
3432
3622
  super(...arguments);
@@ -3505,6 +3695,36 @@ const AXPShowFileUploaderPopupWorkflow = {
3505
3695
  },
3506
3696
  };
3507
3697
 
3698
+ class AXPShowListViewAction extends AXPWorkflowAction {
3699
+ constructor() {
3700
+ super(...arguments);
3701
+ this.navigation = inject(AXPWorkflowNavigateAction);
3702
+ this.sessionService = inject(AXPSessionService);
3703
+ }
3704
+ async execute(context) {
3705
+ const [moduleName, entityName] = context.getVariable('entity').split(".");
3706
+ const newPayload = {
3707
+ commands: `/${this.sessionService.application?.name}/m/${moduleName}/e/${entityName}/list`,
3708
+ };
3709
+ context.setVariable('payload', newPayload);
3710
+ this.navigation.execute(context);
3711
+ }
3712
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
3713
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction }); }
3714
+ }
3715
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPShowListViewAction, decorators: [{
3716
+ type: Injectable
3717
+ }] });
3718
+ const AXPShowListViewWorkflow = {
3719
+ startStepId: 'showListView',
3720
+ steps: {
3721
+ showListView: {
3722
+ id: 'showListView',
3723
+ action: 'AXPShowListViewAction',
3724
+ },
3725
+ },
3726
+ };
3727
+
3508
3728
  function routesFacory() {
3509
3729
  const config = inject(AXP_ENTITY_CONFIG_TOKEN);
3510
3730
  let routes = [];
@@ -3570,6 +3790,7 @@ class AXPEntityModule {
3570
3790
  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
3791
  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
3792
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPEntityModule, providers: [
3793
+ // CUSTOMER_MODIFIER_PROVIDER,
3573
3794
  {
3574
3795
  provide: ROUTES,
3575
3796
  multi: true,
@@ -3585,10 +3806,6 @@ class AXPEntityModule {
3585
3806
  useClass: AXPEntityCommandSearchDefinitionProvider,
3586
3807
  multi: true,
3587
3808
  },
3588
- {
3589
- provide: AXPEntityMiddleware,
3590
- useClass: AXPEntityMiddlewareDefault,
3591
- },
3592
3809
  ], imports: [RouterModule,
3593
3810
  AXPWorkflowModule.forChild({
3594
3811
  actions: {
@@ -3660,6 +3877,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3660
3877
  exports: [],
3661
3878
  declarations: [],
3662
3879
  providers: [
3880
+ // CUSTOMER_MODIFIER_PROVIDER,
3663
3881
  {
3664
3882
  provide: ROUTES,
3665
3883
  multi: true,
@@ -3675,10 +3893,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3675
3893
  useClass: AXPEntityCommandSearchDefinitionProvider,
3676
3894
  multi: true,
3677
3895
  },
3678
- {
3679
- provide: AXPEntityMiddleware,
3680
- useClass: AXPEntityMiddlewareDefault,
3681
- },
3682
3896
  ],
3683
3897
  }]
3684
3898
  }], ctorParameters: () => [{ type: i1$4.AXPAppStartUpService }, { type: i0.Injector }] });
@@ -3702,5 +3916,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3702
3916
  * Generated bundle index. Do not edit.
3703
3917
  */
3704
3918
 
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 };
3919
+ 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
3920
  //# sourceMappingURL=acorex-platform-layout-entity.mjs.map