@smartsoft001/crud-shell-angular 2.179.0 → 2.181.0
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.
|
@@ -18,7 +18,7 @@ import moment from 'moment';
|
|
|
18
18
|
import * as _ from 'lodash';
|
|
19
19
|
import { NgComponentOutlet, CommonModule, NgTemplateOutlet, Location } from '@angular/common';
|
|
20
20
|
import { DynamicIoDirective, DynamicIoModule } from 'ng-dynamic-component';
|
|
21
|
-
import * as
|
|
21
|
+
import * as i4 from '@angular/router';
|
|
22
22
|
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
|
23
23
|
import { SpecificationService } from '@smartsoft001/utils';
|
|
24
24
|
|
|
@@ -434,6 +434,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
434
434
|
type: Injectable
|
|
435
435
|
}] });
|
|
436
436
|
|
|
437
|
+
/**
|
|
438
|
+
* Entities whose effects are already subscribed, per `ActionsSubject`.
|
|
439
|
+
* Keyed by the app's own `ActionsSubject` so each app instance (e.g. every SSR
|
|
440
|
+
* render in one Node process) gets its own effects, while repeated module
|
|
441
|
+
* instances within one app still subscribe only once per entity.
|
|
442
|
+
*/
|
|
443
|
+
const initializedEntities = new WeakMap();
|
|
437
444
|
class CrudEffects {
|
|
438
445
|
actions$;
|
|
439
446
|
service;
|
|
@@ -448,10 +455,14 @@ class CrudEffects {
|
|
|
448
455
|
this.state = state;
|
|
449
456
|
}
|
|
450
457
|
init() {
|
|
451
|
-
|
|
452
|
-
if (
|
|
458
|
+
let entities = initializedEntities.get(this.actions$);
|
|
459
|
+
if (!entities) {
|
|
460
|
+
entities = new Set();
|
|
461
|
+
initializedEntities.set(this.actions$, entities);
|
|
462
|
+
}
|
|
463
|
+
if (entities.has(this.config.entity))
|
|
453
464
|
return;
|
|
454
|
-
|
|
465
|
+
entities.add(this.config.entity);
|
|
455
466
|
this.actions$.subscribe((action) => {
|
|
456
467
|
switch (action.type) {
|
|
457
468
|
case `[${this.config.entity}] Create`:
|
|
@@ -617,7 +628,9 @@ class CrudFacade {
|
|
|
617
628
|
constructor(store, config) {
|
|
618
629
|
this.store = store;
|
|
619
630
|
this.config = config;
|
|
620
|
-
|
|
631
|
+
// Prefer the app's own Store (SSR renders many apps in one process);
|
|
632
|
+
// fall back to the static store only when none was injected.
|
|
633
|
+
if (!this.store && NgrxStoreService.store) {
|
|
621
634
|
this.store = NgrxStoreService.store;
|
|
622
635
|
}
|
|
623
636
|
// Initialize all signals in the constructor (injection context)
|
|
@@ -676,9 +689,7 @@ class CrudFacade {
|
|
|
676
689
|
this.getStore().dispatch(deleteItem(this.config.entity, id));
|
|
677
690
|
}
|
|
678
691
|
getStore() {
|
|
679
|
-
|
|
680
|
-
return NgrxStoreService.store;
|
|
681
|
-
return this.store;
|
|
692
|
+
return this.store ?? NgrxStoreService.store;
|
|
682
693
|
}
|
|
683
694
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudFacade, deps: [{ token: i1.Store }, { token: CrudConfig }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
684
695
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudFacade });
|
|
@@ -4038,18 +4049,18 @@ const PAGES = [
|
|
|
4038
4049
|
ItemStandardComponent,
|
|
4039
4050
|
];
|
|
4040
4051
|
class CrudFullModule {
|
|
4041
|
-
constructor(config, effects) {
|
|
4052
|
+
constructor(config, effects, store) {
|
|
4042
4053
|
NgrxStoreService.addReducer(config.entity, config.reducerFactory
|
|
4043
4054
|
? config.reducerFactory()
|
|
4044
|
-
: getReducer(config.entity));
|
|
4055
|
+
: getReducer(config.entity), store);
|
|
4045
4056
|
effects.init();
|
|
4046
4057
|
}
|
|
4047
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudFullModule, deps: [{ token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4058
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudFullModule, deps: [{ token: CrudConfig }, { token: CrudEffects }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4048
4059
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: CrudFullModule, imports: [ItemComponent,
|
|
4049
4060
|
ListComponent,
|
|
4050
4061
|
ListStandardComponent,
|
|
4051
4062
|
ItemStandardComponent, SharedModule,
|
|
4052
|
-
CrudPipesModule,
|
|
4063
|
+
CrudPipesModule, i4.RouterModule, FormsModule,
|
|
4053
4064
|
CommonModule,
|
|
4054
4065
|
CrudComponentsModule], exports: [ItemComponent,
|
|
4055
4066
|
ListComponent,
|
|
@@ -4099,16 +4110,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
4099
4110
|
CrudListPaginationFactory,
|
|
4100
4111
|
],
|
|
4101
4112
|
}]
|
|
4102
|
-
}], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }] });
|
|
4113
|
+
}], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }, { type: i1.Store }] });
|
|
4103
4114
|
|
|
4104
4115
|
class CrudCoreModule {
|
|
4105
|
-
constructor(config, effects) {
|
|
4116
|
+
constructor(config, effects, store) {
|
|
4106
4117
|
NgrxStoreService.addReducer(config.entity, config.reducerFactory
|
|
4107
4118
|
? config.reducerFactory()
|
|
4108
|
-
: getReducer(config.entity));
|
|
4119
|
+
: getReducer(config.entity), store);
|
|
4109
4120
|
effects.init();
|
|
4110
4121
|
}
|
|
4111
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudCoreModule, deps: [{ token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4122
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudCoreModule, deps: [{ token: CrudConfig }, { token: CrudEffects }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4112
4123
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: CrudCoreModule, imports: [SharedModule,
|
|
4113
4124
|
CrudPipesModule,
|
|
4114
4125
|
FormsModule,
|
|
@@ -4151,7 +4162,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
4151
4162
|
{ provide: IModelLabelProvider, useClass: CrudModelLabelProvider },
|
|
4152
4163
|
],
|
|
4153
4164
|
}]
|
|
4154
|
-
}], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }] });
|
|
4165
|
+
}], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }, { type: i1.Store }] });
|
|
4155
4166
|
class CrudModule {
|
|
4156
4167
|
static forFeature(options) {
|
|
4157
4168
|
return {
|
|
@@ -4169,13 +4180,13 @@ class CrudModule {
|
|
|
4169
4180
|
],
|
|
4170
4181
|
};
|
|
4171
4182
|
}
|
|
4172
|
-
constructor(config, effects) {
|
|
4183
|
+
constructor(config, effects, store) {
|
|
4173
4184
|
NgrxStoreService.addReducer(config.entity, config.reducerFactory
|
|
4174
4185
|
? config.reducerFactory()
|
|
4175
|
-
: getReducer(config.entity));
|
|
4186
|
+
: getReducer(config.entity), store);
|
|
4176
4187
|
effects.init();
|
|
4177
4188
|
}
|
|
4178
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudModule, deps: [{ token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4189
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudModule, deps: [{ token: CrudConfig }, { token: CrudEffects }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4179
4190
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: CrudModule });
|
|
4180
4191
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: CrudModule, providers: [
|
|
4181
4192
|
CrudService,
|
|
@@ -4198,7 +4209,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
4198
4209
|
CrudListPaginationFactory,
|
|
4199
4210
|
],
|
|
4200
4211
|
}]
|
|
4201
|
-
}], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }] });
|
|
4212
|
+
}], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }, { type: i1.Store }] });
|
|
4202
4213
|
|
|
4203
4214
|
/**
|
|
4204
4215
|
* Generated bundle index. Do not edit.
|