@o3r/routing 15.3.0-prerelease.8 → 15.3.0-rc.1
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/fesm2022/o3r-routing.mjs +232 -287
- package/fesm2022/o3r-routing.mjs.map +1 -1
- package/package.json +5 -5
- package/schematics/ng-add/schema.json +0 -3
- package/types/o3r-routing.d.ts +111 -126
- package/types/o3r-routing.d.ts.map +1 -1
package/fesm2022/o3r-routing.mjs
CHANGED
|
@@ -1,333 +1,278 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { Actions, createEffect, ofType } from
|
|
4
|
-
import {
|
|
5
|
-
import { filter, map, switchMap } from
|
|
6
|
-
import * as i1 from
|
|
7
|
-
import {
|
|
8
|
-
import { createEntityAdapter } from
|
|
9
|
-
import { APP_BASE_HREF } from
|
|
10
|
-
import { DEFAULT_BUILD_PROPERTIES } from
|
|
11
|
-
import {
|
|
12
|
-
import { of } from
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const ACTION_CLEAR_FAILURE_REASON = '[RoutingGuard] clear failure reason for an entity';
|
|
21
|
-
const ACTION_SET_ENTITY_AS_FAILURE_WITH_REASON = '[RoutingGuard] set an entity state as FAILURE with a reason';
|
|
22
|
-
/**
|
|
23
|
-
* Register a new entity in routing guard store
|
|
24
|
-
*/
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable, InjectionToken, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
|
|
3
|
+
import { Actions, createEffect, ofType } from "@ngrx/effects";
|
|
4
|
+
import { ROUTER_NAVIGATED, ROUTER_REQUEST } from "@ngrx/router-store";
|
|
5
|
+
import { filter, map, switchMap } from "rxjs/operators";
|
|
6
|
+
import * as i1 from "@ngrx/store";
|
|
7
|
+
import { StoreModule, createAction, createFeatureSelector, createReducer, createSelector, on, props, provideState } from "@ngrx/store";
|
|
8
|
+
import { createEntityAdapter } from "@ngrx/entity";
|
|
9
|
+
import { APP_BASE_HREF } from "@angular/common";
|
|
10
|
+
import { DEFAULT_BUILD_PROPERTIES } from "@o3r/core";
|
|
11
|
+
import { NavigationEnd, Router } from "@angular/router";
|
|
12
|
+
import { of } from "rxjs";
|
|
13
|
+
const ACTION_REGISTER_ENTITY = "[RoutingGuard] register an entity";
|
|
14
|
+
const ACTION_SET_ENTITY_AS_FAILURE = "[RoutingGuard] set an entity state as FAILURE";
|
|
15
|
+
const ACTION_SET_ENTITY_AS_SUCCESS_AND_CLEAR_REASON = "[RoutingGuard] set an entity state as SUCCESS and clear reason";
|
|
16
|
+
const ACTION_SET_ENTITY_AS_PENDING = "[RoutingGuard] set an entity state as PENDING";
|
|
17
|
+
const ACTION_CLEAR_ENTITIES = "[RoutingGuard] clear entities";
|
|
18
|
+
const ACTION_CLEAR_FAILURE_REASON = "[RoutingGuard] clear failure reason for an entity";
|
|
19
|
+
const ACTION_SET_ENTITY_AS_FAILURE_WITH_REASON = "[RoutingGuard] set an entity state as FAILURE with a reason";
|
|
25
20
|
const registerRoutingGuardEntity = createAction(ACTION_REGISTER_ENTITY, props());
|
|
26
|
-
/**
|
|
27
|
-
* Set an entity in FAILURE status
|
|
28
|
-
*/
|
|
29
21
|
const setRoutingGuardEntityAsFailure = createAction(ACTION_SET_ENTITY_AS_FAILURE, props());
|
|
30
|
-
/**
|
|
31
|
-
* Set an entity in SUCCESS status and clear the reason
|
|
32
|
-
*/
|
|
33
22
|
const setRoutingGuardEntityAsSuccessAndClearReason = createAction(ACTION_SET_ENTITY_AS_SUCCESS_AND_CLEAR_REASON, props());
|
|
34
|
-
/**
|
|
35
|
-
* Set an entity in PENDING status
|
|
36
|
-
*/
|
|
37
23
|
const setRoutingGuardEntityAsPending = createAction(ACTION_SET_ENTITY_AS_PENDING, props());
|
|
38
|
-
/**
|
|
39
|
-
* Clear only the entities, keeps the other attributes in the state
|
|
40
|
-
*/
|
|
41
24
|
const clearRoutingGuardEntities = createAction(ACTION_CLEAR_ENTITIES);
|
|
42
|
-
/**
|
|
43
|
-
* Clear only the entities, keeps the other attributes in the state
|
|
44
|
-
*/
|
|
45
25
|
const clearRoutingGuardEntitiesFailureReason = createAction(ACTION_CLEAR_FAILURE_REASON, props());
|
|
46
|
-
/**
|
|
47
|
-
* Set entity in FAILURE status with a reason
|
|
48
|
-
*/
|
|
49
26
|
const setRoutingGuardEntityFailureWithReason = createAction(ACTION_SET_ENTITY_AS_FAILURE_WITH_REASON, props());
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
27
|
+
var NgrxStoreRouterEffect = class NgrxStoreRouterEffect {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.actions$ = inject(Actions);
|
|
30
|
+
this.resetRouterRegistrationOnRequest$ = createEffect(() => this.actions$.pipe(ofType(ROUTER_REQUEST), filter((action) => action.payload.event.navigationTrigger === "popstate"), map(() => clearRoutingGuardEntities())));
|
|
31
|
+
this.resetRouterRegistrationOnNavigated$ = createEffect(() => this.actions$.pipe(ofType(ROUTER_NAVIGATED), map(() => clearRoutingGuardEntities())));
|
|
32
|
+
}
|
|
33
|
+
static {
|
|
34
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
35
|
+
minVersion: "12.0.0",
|
|
36
|
+
version: "22.2.3",
|
|
37
|
+
ngImport: i0,
|
|
38
|
+
type: NgrxStoreRouterEffect,
|
|
39
|
+
deps: [],
|
|
40
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static {
|
|
44
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
45
|
+
minVersion: "12.0.0",
|
|
46
|
+
version: "22.2.3",
|
|
47
|
+
ngImport: i0,
|
|
48
|
+
type: NgrxStoreRouterEffect
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
53
|
+
minVersion: "12.0.0",
|
|
54
|
+
version: "22.2.3",
|
|
55
|
+
ngImport: i0,
|
|
56
|
+
type: NgrxStoreRouterEffect,
|
|
57
|
+
decorators: [{ type: Injectable }]
|
|
58
|
+
});
|
|
74
59
|
var RegisteredItemStatus;
|
|
75
|
-
(function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/** block received the async call result and it's a failure */
|
|
81
|
-
RegisteredItemStatus["FAILURE"] = "FAILURE";
|
|
82
|
-
/** block received the async call result and it's a success */
|
|
83
|
-
RegisteredItemStatus["SUCCESS"] = "SUCCESS";
|
|
60
|
+
(function(RegisteredItemStatus) {
|
|
61
|
+
RegisteredItemStatus["READY"] = "READY";
|
|
62
|
+
RegisteredItemStatus["PENDING"] = "PENDING";
|
|
63
|
+
RegisteredItemStatus["FAILURE"] = "FAILURE";
|
|
64
|
+
RegisteredItemStatus["SUCCESS"] = "SUCCESS";
|
|
84
65
|
})(RegisteredItemStatus || (RegisteredItemStatus = {}));
|
|
85
|
-
/** Identifies the failure reason for the registered block */
|
|
86
66
|
var RegisteredItemFailureReason;
|
|
87
|
-
(function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/** Routing failed because the changes to the form has not been saved */
|
|
91
|
-
RegisteredItemFailureReason["FORM_UNSAVED"] = "FORM_UNSAVED";
|
|
67
|
+
(function(RegisteredItemFailureReason) {
|
|
68
|
+
RegisteredItemFailureReason["ASYNC_CALL_FAILURE"] = "ASYNC_CALL_FAILURE";
|
|
69
|
+
RegisteredItemFailureReason["FORM_UNSAVED"] = "FORM_UNSAVED";
|
|
92
70
|
})(RegisteredItemFailureReason || (RegisteredItemFailureReason = {}));
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*/
|
|
96
|
-
const ROUTING_GUARD_STORE_NAME = 'routingGuard';
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* RoutingGuard Store adapter
|
|
100
|
-
*/
|
|
101
|
-
const routingGuardAdapter = createEntityAdapter({
|
|
102
|
-
selectId: (model) => model.id
|
|
103
|
-
});
|
|
104
|
-
/**
|
|
105
|
-
* RoutingGuard Store initial value
|
|
106
|
-
*/
|
|
71
|
+
const ROUTING_GUARD_STORE_NAME = "routingGuard";
|
|
72
|
+
const routingGuardAdapter = createEntityAdapter({ selectId: (model) => model.id });
|
|
107
73
|
const routingGuardInitialState = routingGuardAdapter.getInitialState({});
|
|
108
|
-
/**
|
|
109
|
-
* List of basic actions for RoutingGuard Store
|
|
110
|
-
*/
|
|
111
74
|
const routingGuardReducerFeatures = [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
75
|
+
on(registerRoutingGuardEntity, (state, payload) => routingGuardAdapter.addOne({
|
|
76
|
+
id: payload.id,
|
|
77
|
+
status: RegisteredItemStatus.READY
|
|
78
|
+
}, state)),
|
|
79
|
+
on(setRoutingGuardEntityAsPending, (state, payload) => routingGuardAdapter.updateOne({
|
|
80
|
+
id: payload.id,
|
|
81
|
+
changes: { status: RegisteredItemStatus.PENDING }
|
|
82
|
+
}, state)),
|
|
83
|
+
on(setRoutingGuardEntityAsFailure, (state, payload) => routingGuardAdapter.updateOne({
|
|
84
|
+
id: payload.id,
|
|
85
|
+
changes: { status: RegisteredItemStatus.FAILURE }
|
|
86
|
+
}, state)),
|
|
87
|
+
on(setRoutingGuardEntityAsSuccessAndClearReason, (state, payload) => routingGuardAdapter.updateOne({
|
|
88
|
+
id: payload.id,
|
|
89
|
+
changes: {
|
|
90
|
+
status: RegisteredItemStatus.SUCCESS,
|
|
91
|
+
blockingReason: void 0
|
|
92
|
+
}
|
|
93
|
+
}, state)),
|
|
94
|
+
on(clearRoutingGuardEntities, (state) => routingGuardAdapter.removeAll(state)),
|
|
95
|
+
on(clearRoutingGuardEntitiesFailureReason, (state, payload) => routingGuardAdapter.updateOne({
|
|
96
|
+
id: payload.id,
|
|
97
|
+
changes: {
|
|
98
|
+
status: RegisteredItemStatus.READY,
|
|
99
|
+
blockingReason: void 0
|
|
100
|
+
}
|
|
101
|
+
}, state)),
|
|
102
|
+
on(setRoutingGuardEntityFailureWithReason, (state, payload) => routingGuardAdapter.updateOne({
|
|
103
|
+
id: payload.id,
|
|
104
|
+
changes: {
|
|
105
|
+
status: RegisteredItemStatus.FAILURE,
|
|
106
|
+
blockingReason: payload.reason
|
|
107
|
+
}
|
|
108
|
+
}, state))
|
|
119
109
|
];
|
|
120
|
-
/**
|
|
121
|
-
* RoutingGuard Store reducer
|
|
122
|
-
*/
|
|
123
110
|
const routingGuardReducer = createReducer(routingGuardInitialState, ...routingGuardReducerFeatures);
|
|
124
|
-
|
|
125
|
-
/** Token of the RoutingGuard reducer */
|
|
126
|
-
const ROUTING_GUARD_REDUCER_TOKEN = new InjectionToken('Feature RoutingGuard Reducer');
|
|
127
|
-
/** Provide default reducer for RoutingGuard store */
|
|
111
|
+
const ROUTING_GUARD_REDUCER_TOKEN = new InjectionToken("Feature RoutingGuard Reducer");
|
|
128
112
|
function getDefaultRoutingGuardReducer() {
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* @deprecated Will be removed in v16. Use {@link provideRoutingGuardStore} instead.
|
|
133
|
-
*/
|
|
134
|
-
class RoutingGuardStoreModule {
|
|
135
|
-
static forRoot(reducerFactory) {
|
|
136
|
-
return {
|
|
137
|
-
ngModule: RoutingGuardStoreModule,
|
|
138
|
-
providers: [
|
|
139
|
-
{ provide: ROUTING_GUARD_REDUCER_TOKEN, useFactory: reducerFactory }
|
|
140
|
-
]
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: RoutingGuardStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
144
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.0", ngImport: i0, type: RoutingGuardStoreModule, imports: [i1.StoreFeatureModule] }); }
|
|
145
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: RoutingGuardStoreModule, providers: [
|
|
146
|
-
{ provide: ROUTING_GUARD_REDUCER_TOKEN, useFactory: getDefaultRoutingGuardReducer }
|
|
147
|
-
], imports: [StoreModule.forFeature(ROUTING_GUARD_STORE_NAME, ROUTING_GUARD_REDUCER_TOKEN)] }); }
|
|
113
|
+
return routingGuardReducer;
|
|
148
114
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
115
|
+
var RoutingGuardStoreModule = class RoutingGuardStoreModule {
|
|
116
|
+
static forRoot(reducerFactory) {
|
|
117
|
+
return {
|
|
118
|
+
ngModule: RoutingGuardStoreModule,
|
|
119
|
+
providers: [{
|
|
120
|
+
provide: ROUTING_GUARD_REDUCER_TOKEN,
|
|
121
|
+
useFactory: reducerFactory
|
|
122
|
+
}]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
static {
|
|
126
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
127
|
+
minVersion: "12.0.0",
|
|
128
|
+
version: "22.2.3",
|
|
129
|
+
ngImport: i0,
|
|
130
|
+
type: RoutingGuardStoreModule,
|
|
131
|
+
deps: [],
|
|
132
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
static {
|
|
136
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
137
|
+
minVersion: "14.0.0",
|
|
138
|
+
version: "22.2.3",
|
|
139
|
+
ngImport: i0,
|
|
140
|
+
type: RoutingGuardStoreModule,
|
|
141
|
+
imports: [i1.StoreFeatureModule]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
static {
|
|
145
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
146
|
+
minVersion: "12.0.0",
|
|
147
|
+
version: "22.2.3",
|
|
148
|
+
ngImport: i0,
|
|
149
|
+
type: RoutingGuardStoreModule,
|
|
150
|
+
providers: [{
|
|
151
|
+
provide: ROUTING_GUARD_REDUCER_TOKEN,
|
|
152
|
+
useFactory: getDefaultRoutingGuardReducer
|
|
153
|
+
}],
|
|
154
|
+
imports: [StoreModule.forFeature(ROUTING_GUARD_STORE_NAME, ROUTING_GUARD_REDUCER_TOKEN)]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
159
|
+
minVersion: "12.0.0",
|
|
160
|
+
version: "22.2.3",
|
|
161
|
+
ngImport: i0,
|
|
162
|
+
type: RoutingGuardStoreModule,
|
|
163
|
+
decorators: [{
|
|
164
|
+
type: NgModule,
|
|
165
|
+
args: [{
|
|
166
|
+
imports: [StoreModule.forFeature(ROUTING_GUARD_STORE_NAME, ROUTING_GUARD_REDUCER_TOKEN)],
|
|
167
|
+
providers: [{
|
|
168
|
+
provide: ROUTING_GUARD_REDUCER_TOKEN,
|
|
169
|
+
useFactory: getDefaultRoutingGuardReducer
|
|
170
|
+
}]
|
|
171
|
+
}]
|
|
172
|
+
}]
|
|
173
|
+
});
|
|
164
174
|
function provideRoutingGuardStore(reducerFactory) {
|
|
165
|
-
|
|
166
|
-
provideState(ROUTING_GUARD_STORE_NAME, reducerFactory ? reducerFactory() : routingGuardReducer)
|
|
167
|
-
]);
|
|
175
|
+
return makeEnvironmentProviders([provideState(ROUTING_GUARD_STORE_NAME, reducerFactory ? reducerFactory() : routingGuardReducer)]);
|
|
168
176
|
}
|
|
169
|
-
|
|
170
177
|
const { selectIds, selectEntities, selectAll, selectTotal } = routingGuardAdapter.getSelectors();
|
|
171
|
-
/** Select RoutingGuard State */
|
|
172
178
|
const selectRoutingGuardState = createFeatureSelector(ROUTING_GUARD_STORE_NAME);
|
|
173
|
-
/** Select the array of RoutingGuard ids */
|
|
174
179
|
const selectRoutingGuardIds = createSelector(selectRoutingGuardState, selectIds);
|
|
175
|
-
/** Select the array of RoutingGuard */
|
|
176
180
|
const selectAllRoutingGuard = createSelector(selectRoutingGuardState, selectAll);
|
|
177
|
-
/** Select the dictionary of RoutingGuard entities */
|
|
178
181
|
const selectRoutingGuardEntities = createSelector(selectRoutingGuardState, selectEntities);
|
|
179
|
-
/** Select the total RoutingGuard count */
|
|
180
182
|
const selectRoutingGuardTotal = createSelector(selectRoutingGuardState, selectTotal);
|
|
181
|
-
/**
|
|
182
|
-
* Selector used to retrieve the list of entities' status
|
|
183
|
-
*/
|
|
184
183
|
const selectRoutingGuardEntitiesStatusList = createSelector(selectRoutingGuardState, (state) => {
|
|
185
|
-
|
|
186
|
-
.filter((key) => !!state.entities[key])
|
|
187
|
-
.map((key) => state.entities[key].status);
|
|
184
|
+
return Object.keys(state.entities).filter((key) => !!state.entities[key]).map((key) => state.entities[key].status);
|
|
188
185
|
});
|
|
189
|
-
/**
|
|
190
|
-
* Selector used to retrieve the list of entities' blocking reasons for FAILURE status.
|
|
191
|
-
*/
|
|
192
186
|
const selectRoutingGuardEntitiesBlockingReasons = createSelector(selectRoutingGuardState, (state) => {
|
|
193
|
-
|
|
194
|
-
.filter((entity) => !!entity && !!entity.blockingReason)
|
|
195
|
-
.map((entity) => entity.blockingReason);
|
|
187
|
+
return Object.values(state.entities).filter((entity) => !!entity && !!entity.blockingReason).map((entity) => entity.blockingReason);
|
|
196
188
|
});
|
|
197
|
-
/**
|
|
198
|
-
* Selector used to check that no item is in PENDING state.
|
|
199
|
-
* For example, we will rely on this selector to trigger the canDeactivate logic in the RoutingGuard
|
|
200
|
-
*/
|
|
201
189
|
const hasNoEntitiesInPendingState = createSelector(selectRoutingGuardEntitiesStatusList, (statusList) => {
|
|
202
|
-
|
|
190
|
+
return !statusList.includes(RegisteredItemStatus.PENDING);
|
|
203
191
|
});
|
|
204
|
-
/**
|
|
205
|
-
* Selector used to check that no item is in FAILURE state.
|
|
206
|
-
* For example, we will rely on this selector to authorize or not the navigation in the RoutingGuard
|
|
207
|
-
*/
|
|
208
192
|
const hasNoEntitiesInFailureState = createSelector(selectRoutingGuardEntitiesStatusList, (statusList) => {
|
|
209
|
-
|
|
193
|
+
return !statusList.includes(RegisteredItemStatus.FAILURE);
|
|
210
194
|
});
|
|
211
|
-
/**
|
|
212
|
-
* Selector used to check that no item is in READY or FAILURE state.
|
|
213
|
-
* For example, we will rely on this selector to trigger the router navigation and display a loader
|
|
214
|
-
*/
|
|
215
195
|
const hasNoEntityInReadyOrFailureState = createSelector(selectRoutingGuardEntitiesStatusList, (statusList) => {
|
|
216
|
-
|
|
196
|
+
return !statusList.some((status) => status === RegisteredItemStatus.READY || status === RegisteredItemStatus.FAILURE);
|
|
217
197
|
});
|
|
218
|
-
/**
|
|
219
|
-
* Selector used to check that no item is in FAILURE state with a blocking reason provided.
|
|
220
|
-
* Takes `blockingReason: RegisteredItemFailureReason` as aproperty parameter.
|
|
221
|
-
*/
|
|
222
198
|
const hasNoEntityFailureStateWithReasons = createSelector(selectRoutingGuardEntitiesBlockingReasons, (reasons, properties) => {
|
|
223
|
-
|
|
199
|
+
return !reasons.includes(properties.blockingReason);
|
|
224
200
|
});
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* AppBaseHref factory function
|
|
228
|
-
* The APP_BASE_HREF will assume one of the following values (ordered by priority):
|
|
229
|
-
* 1- undefined (or disabled) if it's not a PROD environment
|
|
230
|
-
* 2- the content of the data tag data-appbasehref in the body if it exists
|
|
231
|
-
* 3- the content of config.APP_BASE_HREF if defined
|
|
232
|
-
* 4- otherwise, undefined
|
|
233
|
-
* @param config The application environment configuration
|
|
234
|
-
*/
|
|
235
201
|
function appBaseHrefFactory(config) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (typeof dynamicBaseHref !== 'undefined') {
|
|
241
|
-
return dynamicBaseHref;
|
|
242
|
-
}
|
|
243
|
-
return typeof config.APP_BASE_HREF === 'string' ? config.APP_BASE_HREF : undefined;
|
|
202
|
+
if (config.ENVIRONMENT !== "prod") return;
|
|
203
|
+
const dynamicBaseHref = document.body.dataset.appbasehref;
|
|
204
|
+
if (typeof dynamicBaseHref !== "undefined") return dynamicBaseHref;
|
|
205
|
+
return typeof config.APP_BASE_HREF === "string" ? config.APP_BASE_HREF : void 0;
|
|
244
206
|
}
|
|
245
|
-
const ENVIRONMENT_CONFIG_TOKEN = new InjectionToken(
|
|
246
|
-
/**
|
|
247
|
-
* Specify a custom base href
|
|
248
|
-
* @param baseHref
|
|
249
|
-
*/
|
|
207
|
+
const ENVIRONMENT_CONFIG_TOKEN = new InjectionToken("Environment config");
|
|
250
208
|
function withBaseHref(baseHref) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
};
|
|
209
|
+
return {
|
|
210
|
+
ɵkind: "base-href",
|
|
211
|
+
ɵproviders: [{
|
|
212
|
+
provide: APP_BASE_HREF,
|
|
213
|
+
...typeof baseHref === "function" ? {
|
|
214
|
+
useFactory: baseHref,
|
|
215
|
+
deps: [ENVIRONMENT_CONFIG_TOKEN]
|
|
216
|
+
} : { useValue: baseHref }
|
|
217
|
+
}]
|
|
218
|
+
};
|
|
262
219
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Provide environment configuration
|
|
265
|
-
* @note it will also provide APP_BASE_HREF based on the environment configuration
|
|
266
|
-
* @param config
|
|
267
|
-
* @param features
|
|
268
|
-
*/
|
|
269
220
|
function provideEnvironment(config, ...features) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
221
|
+
const additionalProviders = [];
|
|
222
|
+
const baseHrefFeature = features.find((f) => f.ɵkind === "base-href") ?? withBaseHref(appBaseHrefFactory);
|
|
223
|
+
additionalProviders.push(baseHrefFeature.ɵproviders);
|
|
224
|
+
return makeEnvironmentProviders([{
|
|
225
|
+
provide: ENVIRONMENT_CONFIG_TOKEN,
|
|
226
|
+
useValue: {
|
|
227
|
+
...DEFAULT_BUILD_PROPERTIES,
|
|
228
|
+
...config
|
|
229
|
+
}
|
|
230
|
+
}, additionalProviders]);
|
|
277
231
|
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Check if the route has preload instructions
|
|
281
|
-
* @param data Route data
|
|
282
|
-
*/
|
|
283
232
|
function hasPreloadingOnDemand(data) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
return (Array.isArray(data.preloadOn) && data.preloadOn.length > 0)
|
|
288
|
-
|| data.preloadOn === '*'
|
|
289
|
-
|| data.preloadOn instanceof RegExp;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Otter Preloading strategy base on previous route
|
|
293
|
-
* @inheritDoc
|
|
294
|
-
*/
|
|
295
|
-
class O3rOnNavigationPreloadingStrategy {
|
|
296
|
-
constructor() {
|
|
297
|
-
this.router = inject(Router);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Check if the module should be preloaded based on the data preload array of routes or regex value
|
|
301
|
-
* @param data Route data
|
|
302
|
-
* @param url URL of current page
|
|
303
|
-
*/
|
|
304
|
-
isUrlMatchingPreloadConfig(data, url) {
|
|
305
|
-
return (Array.isArray(data.preloadOn) && data.preloadOn.includes(url))
|
|
306
|
-
|| (data.preloadOn instanceof RegExp && data.preloadOn.test(url));
|
|
307
|
-
}
|
|
308
|
-
/** @inheritDoc */
|
|
309
|
-
preload(route, preload) {
|
|
310
|
-
if ((route.path || route.matcher) && hasPreloadingOnDemand(route.data)) {
|
|
311
|
-
// On application landing page, check the route to preload.
|
|
312
|
-
if (route.data.preloadOn === '*' || this.isUrlMatchingPreloadConfig(route.data, this.router.routerState.snapshot.url)) {
|
|
313
|
-
return preload();
|
|
314
|
-
}
|
|
315
|
-
// On route navigation end, load the routes to preload for the current route.
|
|
316
|
-
return this.router.events
|
|
317
|
-
.pipe(filter((r) => r instanceof NavigationEnd && this.isUrlMatchingPreloadConfig(route.data, r.url)), switchMap(() => preload()));
|
|
318
|
-
}
|
|
319
|
-
return of(null);
|
|
320
|
-
}
|
|
321
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: O3rOnNavigationPreloadingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
322
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: O3rOnNavigationPreloadingStrategy }); }
|
|
233
|
+
if (!data) return false;
|
|
234
|
+
return Array.isArray(data.preloadOn) && data.preloadOn.length > 0 || data.preloadOn === "*" || data.preloadOn instanceof RegExp;
|
|
323
235
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
236
|
+
var O3rOnNavigationPreloadingStrategy = class O3rOnNavigationPreloadingStrategy {
|
|
237
|
+
constructor() {
|
|
238
|
+
this.router = inject(Router);
|
|
239
|
+
}
|
|
240
|
+
isUrlMatchingPreloadConfig(data, url) {
|
|
241
|
+
return Array.isArray(data.preloadOn) && data.preloadOn.includes(url) || data.preloadOn instanceof RegExp && data.preloadOn.test(url);
|
|
242
|
+
}
|
|
243
|
+
preload(route, preload) {
|
|
244
|
+
if ((route.path || route.matcher) && hasPreloadingOnDemand(route.data)) {
|
|
245
|
+
if (route.data.preloadOn === "*" || this.isUrlMatchingPreloadConfig(route.data, this.router.routerState.snapshot.url)) return preload();
|
|
246
|
+
return this.router.events.pipe(filter((r) => r instanceof NavigationEnd && this.isUrlMatchingPreloadConfig(route.data, r.url)), switchMap(() => preload()));
|
|
247
|
+
}
|
|
248
|
+
return of(null);
|
|
249
|
+
}
|
|
250
|
+
static {
|
|
251
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
252
|
+
minVersion: "12.0.0",
|
|
253
|
+
version: "22.2.3",
|
|
254
|
+
ngImport: i0,
|
|
255
|
+
type: O3rOnNavigationPreloadingStrategy,
|
|
256
|
+
deps: [],
|
|
257
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
static {
|
|
261
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
262
|
+
minVersion: "12.0.0",
|
|
263
|
+
version: "22.2.3",
|
|
264
|
+
ngImport: i0,
|
|
265
|
+
type: O3rOnNavigationPreloadingStrategy
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
270
|
+
minVersion: "12.0.0",
|
|
271
|
+
version: "22.2.3",
|
|
272
|
+
ngImport: i0,
|
|
273
|
+
type: O3rOnNavigationPreloadingStrategy,
|
|
274
|
+
decorators: [{ type: Injectable }]
|
|
275
|
+
});
|
|
332
276
|
export { ENVIRONMENT_CONFIG_TOKEN, NgrxStoreRouterEffect, O3rOnNavigationPreloadingStrategy, ROUTING_GUARD_REDUCER_TOKEN, ROUTING_GUARD_STORE_NAME, RegisteredItemFailureReason, RegisteredItemStatus, RoutingGuardStoreModule, appBaseHrefFactory, clearRoutingGuardEntities, clearRoutingGuardEntitiesFailureReason, getDefaultRoutingGuardReducer, hasNoEntitiesInFailureState, hasNoEntitiesInPendingState, hasNoEntityFailureStateWithReasons, hasNoEntityInReadyOrFailureState, hasPreloadingOnDemand, provideEnvironment, provideRoutingGuardStore, registerRoutingGuardEntity, routingGuardAdapter, routingGuardInitialState, routingGuardReducer, routingGuardReducerFeatures, selectAllRoutingGuard, selectRoutingGuardEntities, selectRoutingGuardEntitiesBlockingReasons, selectRoutingGuardEntitiesStatusList, selectRoutingGuardIds, selectRoutingGuardState, selectRoutingGuardTotal, setRoutingGuardEntityAsFailure, setRoutingGuardEntityAsPending, setRoutingGuardEntityAsSuccessAndClearReason, setRoutingGuardEntityFailureWithReason, withBaseHref };
|
|
333
|
-
|
|
277
|
+
|
|
278
|
+
//# sourceMappingURL=o3r-routing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o3r-routing.mjs","sources":["../../src/stores/routing-guard/routing-guard.actions.ts","../../src/stores/routing-guard/extra-effects/ngrx-store-router.effect.ts","../../src/stores/routing-guard/routing-guard.state.ts","../../src/stores/routing-guard/routing-guard.reducer.ts","../../src/stores/routing-guard/routing-guard-module.ts","../../src/stores/routing-guard/routing-guard.selectors.ts","../../src/tools/app-server-routing-module.ts","../../src/tools/on-navigation-strategy-preloader.ts","../../src/o3r-routing.ts"],"sourcesContent":["import {\n createAction,\n props,\n} from '@ngrx/store';\nimport {\n RegisteredItemFailureReason,\n} from './routing-guard.state';\n\n/** Entity Actions */\nconst ACTION_REGISTER_ENTITY = '[RoutingGuard] register an entity';\nconst ACTION_SET_ENTITY_AS_FAILURE = '[RoutingGuard] set an entity state as FAILURE';\nconst ACTION_SET_ENTITY_AS_SUCCESS_AND_CLEAR_REASON = '[RoutingGuard] set an entity state as SUCCESS and clear reason';\nconst ACTION_SET_ENTITY_AS_PENDING = '[RoutingGuard] set an entity state as PENDING';\nconst ACTION_CLEAR_ENTITIES = '[RoutingGuard] clear entities';\nconst ACTION_CLEAR_FAILURE_REASON = '[RoutingGuard] clear failure reason for an entity';\nconst ACTION_SET_ENTITY_AS_FAILURE_WITH_REASON = '[RoutingGuard] set an entity state as FAILURE with a reason';\n\nexport interface RoutingGuardActionPayload {\n /** Id of the block instance */\n id: string;\n}\n\nexport interface RoutingGuardFailureReasonPayload {\n /** Id of the block instance */\n id: string;\n /** Reason for failure */\n reason: RegisteredItemFailureReason;\n}\n\n/**\n * Register a new entity in routing guard store\n */\nexport const registerRoutingGuardEntity = createAction(ACTION_REGISTER_ENTITY, props<RoutingGuardActionPayload>());\n\n/**\n * Set an entity in FAILURE status\n */\nexport const setRoutingGuardEntityAsFailure = createAction(ACTION_SET_ENTITY_AS_FAILURE, props<RoutingGuardActionPayload>());\n\n/**\n * Set an entity in SUCCESS status and clear the reason\n */\nexport const setRoutingGuardEntityAsSuccessAndClearReason = createAction(ACTION_SET_ENTITY_AS_SUCCESS_AND_CLEAR_REASON, props<RoutingGuardActionPayload>());\n\n/**\n * Set an entity in PENDING status\n */\nexport const setRoutingGuardEntityAsPending = createAction(ACTION_SET_ENTITY_AS_PENDING, props<RoutingGuardActionPayload>());\n\n/**\n * Clear only the entities, keeps the other attributes in the state\n */\nexport const clearRoutingGuardEntities = createAction(ACTION_CLEAR_ENTITIES);\n\n/**\n * Clear only the entities, keeps the other attributes in the state\n */\nexport const clearRoutingGuardEntitiesFailureReason = createAction(ACTION_CLEAR_FAILURE_REASON, props<RoutingGuardActionPayload>());\n\n/**\n * Set entity in FAILURE status with a reason\n */\nexport const setRoutingGuardEntityFailureWithReason = createAction(ACTION_SET_ENTITY_AS_FAILURE_WITH_REASON, props<RoutingGuardFailureReasonPayload>());\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport {\n BaseRouterStoreState,\n ROUTER_NAVIGATED,\n ROUTER_REQUEST,\n RouterRequestAction,\n} from '@ngrx/router-store';\nimport {\n filter,\n map,\n} from 'rxjs/operators';\nimport {\n clearRoutingGuardEntities,\n} from '../routing-guard.actions';\n\n/**\n * Effect to react on Ngrx router store actions\n */\n@Injectable()\nexport class NgrxStoreRouterEffect {\n protected actions$ = inject(Actions);\n\n /**\n * Clear Router registrations when the active history entry changes (ex : click on back/next button Action)\n */\n public resetRouterRegistrationOnRequest$ = createEffect(() =>\n this.actions$.pipe(\n ofType(ROUTER_REQUEST),\n filter((action: RouterRequestAction<BaseRouterStoreState>) => action.payload.event.navigationTrigger === 'popstate'),\n map(() => clearRoutingGuardEntities())\n )\n );\n\n /**\n * Clear Router registrations when navigation happened\n */\n public resetRouterRegistrationOnNavigated$ = createEffect(() =>\n this.actions$.pipe(\n ofType(ROUTER_NAVIGATED),\n map(() => clearRoutingGuardEntities())\n )\n );\n}\n","import {\n EntityState,\n} from '@ngrx/entity';\n\n/** Identifies the status of a registered block */\nexport enum RegisteredItemStatus {\n /** block is ready (async call has not been triggered) */\n READY = 'READY',\n /** block is waiting for async call to resolve */\n PENDING = 'PENDING',\n /** block received the async call result and it's a failure */\n FAILURE = 'FAILURE',\n /** block received the async call result and it's a success */\n SUCCESS = 'SUCCESS'\n}\n\n/** Identifies the failure reason for the registered block */\nexport enum RegisteredItemFailureReason {\n /** Routing Failed because the async call result is failure */\n ASYNC_CALL_FAILURE = 'ASYNC_CALL_FAILURE',\n /** Routing failed because the changes to the form has not been saved */\n FORM_UNSAVED = 'FORM_UNSAVED'\n}\n\n/**\n * RoutingGuard model\n */\nexport interface RoutingGuardModel {\n /** Id of the block instance */\n id: string;\n /** Routing status of the block */\n status: RegisteredItemStatus;\n /** Routing Guard blocking reason */\n blockingReason?: RegisteredItemFailureReason;\n}\n\n/**\n * RoutingGuard store state\n */\nexport interface RoutingGuardState extends EntityState<RoutingGuardModel> {}\n\n/**\n * Name of the RoutingGuard Store\n */\nexport const ROUTING_GUARD_STORE_NAME = 'routingGuard';\n\n/**\n * RoutingGuard Store Interface\n */\nexport interface RoutingGuardStore {\n /** RoutingGuard state */\n [ROUTING_GUARD_STORE_NAME]: RoutingGuardState;\n}\n","import {\n createEntityAdapter,\n EntityAdapter,\n} from '@ngrx/entity';\nimport {\n ActionCreator,\n createReducer,\n on,\n ReducerTypes,\n} from '@ngrx/store';\nimport * as actions from './routing-guard.actions';\nimport {\n RegisteredItemStatus,\n RoutingGuardModel,\n RoutingGuardState,\n} from './routing-guard.state';\n\n/**\n * RoutingGuard Store adapter\n */\nexport const routingGuardAdapter: EntityAdapter<RoutingGuardModel> = createEntityAdapter<RoutingGuardModel>({\n selectId: (model) => model.id\n});\n\n/**\n * RoutingGuard Store initial value\n */\nexport const routingGuardInitialState = routingGuardAdapter.getInitialState<RoutingGuardState>({});\n\n/**\n * List of basic actions for RoutingGuard Store\n */\nexport const routingGuardReducerFeatures: ReducerTypes<RoutingGuardState, ActionCreator[]>[] = [\n on(actions.registerRoutingGuardEntity, (state, payload) =>\n routingGuardAdapter.addOne({ id: payload.id, status: RegisteredItemStatus.READY }, state)),\n\n on(actions.setRoutingGuardEntityAsPending, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.PENDING } }, state)),\n\n on(actions.setRoutingGuardEntityAsFailure, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.FAILURE } }, state)),\n\n on(actions.setRoutingGuardEntityAsSuccessAndClearReason, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.SUCCESS, blockingReason: undefined } }, state)),\n\n on(actions.clearRoutingGuardEntities, (state) => routingGuardAdapter.removeAll(state)),\n\n on(actions.clearRoutingGuardEntitiesFailureReason, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.READY, blockingReason: undefined } }, state)),\n\n on(actions.setRoutingGuardEntityFailureWithReason, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.FAILURE, blockingReason: payload.reason } }, state))\n];\n\n/**\n * RoutingGuard Store reducer\n */\nexport const routingGuardReducer = createReducer(\n routingGuardInitialState,\n ...routingGuardReducerFeatures\n);\n","import {\n EnvironmentProviders,\n InjectionToken,\n makeEnvironmentProviders,\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport {\n Action,\n ActionReducer,\n provideState,\n StoreModule,\n} from '@ngrx/store';\nimport {\n routingGuardReducer,\n} from './routing-guard.reducer';\nimport {\n ROUTING_GUARD_STORE_NAME,\n RoutingGuardState,\n} from './routing-guard.state';\n\n/** Token of the RoutingGuard reducer */\nexport const ROUTING_GUARD_REDUCER_TOKEN = new InjectionToken<ActionReducer<RoutingGuardState, Action>>('Feature RoutingGuard Reducer');\n\n/** Provide default reducer for RoutingGuard store */\nexport function getDefaultRoutingGuardReducer() {\n return routingGuardReducer;\n}\n\n/**\n * @deprecated Will be removed in v16. Use {@link provideRoutingGuardStore} instead.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(ROUTING_GUARD_STORE_NAME, ROUTING_GUARD_REDUCER_TOKEN)\n ],\n providers: [\n { provide: ROUTING_GUARD_REDUCER_TOKEN, useFactory: getDefaultRoutingGuardReducer }\n ]\n})\nexport class RoutingGuardStoreModule {\n public static forRoot<T extends RoutingGuardState>(reducerFactory: () => ActionReducer<T, Action>): ModuleWithProviders<RoutingGuardStoreModule> {\n return {\n ngModule: RoutingGuardStoreModule,\n providers: [\n { provide: ROUTING_GUARD_REDUCER_TOKEN, useFactory: reducerFactory }\n ]\n };\n }\n}\n\n/**\n * Provide RoutingGuard feature store.\n * @param reducerFactory Optional factory to override the default reducer.\n */\nexport function provideRoutingGuardStore(reducerFactory?: () => ActionReducer<RoutingGuardState, Action>): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideState(ROUTING_GUARD_STORE_NAME, reducerFactory ? reducerFactory() : routingGuardReducer)\n ]);\n}\n","import {\n createFeatureSelector,\n createSelector,\n} from '@ngrx/store';\nimport {\n routingGuardAdapter,\n} from './routing-guard.reducer';\nimport {\n RegisteredItemFailureReason,\n RegisteredItemStatus,\n ROUTING_GUARD_STORE_NAME,\n RoutingGuardState,\n} from './routing-guard.state';\n\nconst { selectIds, selectEntities, selectAll, selectTotal } = routingGuardAdapter.getSelectors();\n\n/** Select RoutingGuard State */\nexport const selectRoutingGuardState = createFeatureSelector<RoutingGuardState>(ROUTING_GUARD_STORE_NAME);\n\n/** Select the array of RoutingGuard ids */\nexport const selectRoutingGuardIds = createSelector(selectRoutingGuardState, selectIds);\n\n/** Select the array of RoutingGuard */\nexport const selectAllRoutingGuard = createSelector(selectRoutingGuardState, selectAll);\n\n/** Select the dictionary of RoutingGuard entities */\nexport const selectRoutingGuardEntities = createSelector(selectRoutingGuardState, selectEntities);\n\n/** Select the total RoutingGuard count */\nexport const selectRoutingGuardTotal = createSelector(selectRoutingGuardState, selectTotal);\n\n/**\n * Selector used to retrieve the list of entities' status\n */\nexport const selectRoutingGuardEntitiesStatusList = createSelector(\n selectRoutingGuardState,\n (state: RoutingGuardState) => {\n return Object.keys(state.entities)\n .filter((key) => !!state.entities[key])\n .map((key) => state.entities[key]!.status);\n }\n);\n\n/**\n * Selector used to retrieve the list of entities' blocking reasons for FAILURE status.\n */\nexport const selectRoutingGuardEntitiesBlockingReasons = createSelector(\n selectRoutingGuardState,\n (state: RoutingGuardState) => {\n return Object.values(state.entities)\n .filter((entity) => !!entity && !!entity.blockingReason)\n .map((entity) => entity!.blockingReason!);\n }\n);\n\n/**\n * Selector used to check that no item is in PENDING state.\n * For example, we will rely on this selector to trigger the canDeactivate logic in the RoutingGuard\n */\nexport const hasNoEntitiesInPendingState = createSelector(\n selectRoutingGuardEntitiesStatusList,\n (statusList: string[]) => {\n return !statusList.includes(RegisteredItemStatus.PENDING);\n }\n);\n\n/**\n * Selector used to check that no item is in FAILURE state.\n * For example, we will rely on this selector to authorize or not the navigation in the RoutingGuard\n */\nexport const hasNoEntitiesInFailureState = createSelector(\n selectRoutingGuardEntitiesStatusList,\n (statusList: string[]) => {\n return !statusList.includes(RegisteredItemStatus.FAILURE);\n }\n);\n\n/**\n * Selector used to check that no item is in READY or FAILURE state.\n * For example, we will rely on this selector to trigger the router navigation and display a loader\n */\nexport const hasNoEntityInReadyOrFailureState = createSelector(\n selectRoutingGuardEntitiesStatusList,\n (statusList: RegisteredItemStatus[]) => {\n return !statusList.some((status) => status === RegisteredItemStatus.READY || status === RegisteredItemStatus.FAILURE);\n }\n);\n\n/**\n * Selector used to check that no item is in FAILURE state with a blocking reason provided.\n * Takes `blockingReason: RegisteredItemFailureReason` as aproperty parameter.\n */\nexport const hasNoEntityFailureStateWithReasons = createSelector(\n selectRoutingGuardEntitiesBlockingReasons,\n (reasons: RegisteredItemFailureReason[], properties: { blockingReason: RegisteredItemFailureReason }) => {\n return !reasons.includes(properties.blockingReason);\n }\n);\n","import {\n APP_BASE_HREF,\n} from '@angular/common';\nimport {\n InjectionToken,\n makeEnvironmentProviders,\n type Provider,\n} from '@angular/core';\nimport {\n type BuildTimeProperties,\n DEFAULT_BUILD_PROPERTIES,\n} from '@o3r/core';\n\n/**\n * AppBaseHref factory function\n * The APP_BASE_HREF will assume one of the following values (ordered by priority):\n * 1- undefined (or disabled) if it's not a PROD environment\n * 2- the content of the data tag data-appbasehref in the body if it exists\n * 3- the content of config.APP_BASE_HREF if defined\n * 4- otherwise, undefined\n * @param config The application environment configuration\n */\nexport function appBaseHrefFactory(config: BuildTimeProperties) {\n if (config.ENVIRONMENT !== 'prod') {\n return;\n }\n const dynamicBaseHref: string | undefined = document.body.dataset.appbasehref;\n if (typeof dynamicBaseHref !== 'undefined') {\n return dynamicBaseHref;\n }\n return typeof config.APP_BASE_HREF === 'string' ? config.APP_BASE_HREF : undefined;\n}\n\nexport const ENVIRONMENT_CONFIG_TOKEN = new InjectionToken<BuildTimeProperties>('Environment config');\n\ntype EnvironmentFeatureKind = 'base-href';\n\ninterface EnvironmentFeature<FeatureKind extends EnvironmentFeatureKind> {\n ɵkind: FeatureKind;\n ɵproviders: Provider[];\n}\n\ntype BaseHrefFeature = EnvironmentFeature<'base-href'>;\n\ntype EnvironmentFeatures = BaseHrefFeature;\n\n/**\n * Specify a custom base href\n * @param baseHref\n */\nexport function withBaseHref<T extends string | undefined>(baseHref: T | ((environmentConfig: BuildTimeProperties) => T)): EnvironmentFeatures {\n return {\n ɵkind: 'base-href',\n ɵproviders: [\n {\n provide: APP_BASE_HREF,\n ...(\n typeof baseHref === 'function'\n ? { useFactory: baseHref, deps: [ENVIRONMENT_CONFIG_TOKEN] }\n : { useValue: baseHref }\n )\n }\n ]\n };\n}\n\n/**\n * Provide environment configuration\n * @note it will also provide APP_BASE_HREF based on the environment configuration\n * @param config\n * @param features\n */\nexport function provideEnvironment(config: Partial<BuildTimeProperties>, ...features: EnvironmentFeatures[]) {\n const additionalProviders = [];\n const baseHrefFeature = features.find((f) => f.ɵkind === 'base-href') ?? withBaseHref(appBaseHrefFactory);\n additionalProviders.push(baseHrefFeature.ɵproviders);\n\n return makeEnvironmentProviders([\n { provide: ENVIRONMENT_CONFIG_TOKEN, useValue: { ...DEFAULT_BUILD_PROPERTIES, ...config } },\n additionalProviders\n ]);\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n NavigationEnd,\n PreloadingStrategy,\n Route,\n Router,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n filter,\n switchMap,\n} from 'rxjs/operators';\n\n/**\n * Data to inject to the route parameter to specify preloading strategy\n */\nexport interface O3rOnDemandPreloadingData {\n /** List of page reached that trigger preloading */\n preloadOn: string[] | '*' | RegExp;\n}\n\n/**\n * Check if the route has preload instructions\n * @param data Route data\n */\nexport function hasPreloadingOnDemand(data: any): data is O3rOnDemandPreloadingData {\n if (!data) {\n return false;\n }\n\n return (Array.isArray(data.preloadOn) && data.preloadOn.length > 0)\n || data.preloadOn === '*'\n || data.preloadOn instanceof RegExp;\n}\n\n/**\n * Otter Preloading strategy base on previous route\n * @inheritDoc\n */\n@Injectable()\nexport class O3rOnNavigationPreloadingStrategy implements PreloadingStrategy {\n private readonly router = inject(Router);\n\n /**\n * Check if the module should be preloaded based on the data preload array of routes or regex value\n * @param data Route data\n * @param url URL of current page\n */\n private isUrlMatchingPreloadConfig(data: any, url: string): boolean {\n return (Array.isArray(data.preloadOn) && data.preloadOn.includes(url))\n || (data.preloadOn instanceof RegExp && data.preloadOn.test(url));\n }\n\n /** @inheritDoc */\n public preload(route: Route, preload: () => Observable<any>): Observable<any> {\n if ((route.path || route.matcher) && hasPreloadingOnDemand(route.data)) {\n // On application landing page, check the route to preload.\n if (route.data.preloadOn === '*' || this.isUrlMatchingPreloadConfig(route.data, this.router.routerState.snapshot.url)) {\n return preload();\n }\n\n // On route navigation end, load the routes to preload for the current route.\n return this.router.events\n .pipe(\n filter((r) => r instanceof NavigationEnd && this.isUrlMatchingPreloadConfig(route.data, r.url)),\n switchMap(() => preload())\n );\n }\n return of(null);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["actions.registerRoutingGuardEntity","actions.setRoutingGuardEntityAsPending","actions.setRoutingGuardEntityAsFailure","actions.setRoutingGuardEntityAsSuccessAndClearReason","actions.clearRoutingGuardEntities","actions.clearRoutingGuardEntitiesFailureReason","actions.setRoutingGuardEntityFailureWithReason"],"mappings":";;;;;;;;;;;;;AAQA;AACA,MAAM,sBAAsB,GAAG,mCAAmC;AAClE,MAAM,4BAA4B,GAAG,+CAA+C;AACpF,MAAM,6CAA6C,GAAG,gEAAgE;AACtH,MAAM,4BAA4B,GAAG,+CAA+C;AACpF,MAAM,qBAAqB,GAAG,+BAA+B;AAC7D,MAAM,2BAA2B,GAAG,mDAAmD;AACvF,MAAM,wCAAwC,GAAG,6DAA6D;AAc9G;;AAEG;AACI,MAAM,0BAA0B,GAAG,YAAY,CAAC,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,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;AAChE,gBAAC,IAAI,CAAC,SAAS,YAAY,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE;;IAGO,OAAO,CAAC,KAAY,EAAE,OAA8B,EAAA;AACzD,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,KAAK,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;;YAEtE,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,IAAI,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrH,OAAO,OAAO,EAAE;YAClB;;AAGA,YAAA,OAAO,IAAI,CAAC,MAAM,CAAC;AAChB,iBAAA,IAAI,CACH,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,aAAa,IAAI,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAC/F,SAAS,CAAC,MAAM,OAAO,EAAE,CAAC,CAC3B;QACL;AACA,QAAA,OAAO,EAAE,CAAC,IAAI,CAAC;IACjB;iIA7BW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;qIAAjC,iCAAiC,EAAA,CAAA,CAAA;;2FAAjC,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAD7C;;;AC7CD;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"o3r-routing.mjs","names":["actions.registerRoutingGuardEntity","actions.setRoutingGuardEntityAsPending","actions.setRoutingGuardEntityAsFailure","actions.setRoutingGuardEntityAsSuccessAndClearReason","actions.clearRoutingGuardEntities","actions.clearRoutingGuardEntitiesFailureReason","actions.setRoutingGuardEntityFailureWithReason"],"sources":["../../src/stores/routing-guard/routing-guard.actions.ts","../../src/stores/routing-guard/extra-effects/ngrx-store-router.effect.ts","../../src/stores/routing-guard/routing-guard.state.ts","../../src/stores/routing-guard/routing-guard.reducer.ts","../../src/stores/routing-guard/routing-guard-module.ts","../../src/stores/routing-guard/routing-guard.selectors.ts","../../src/tools/app-server-routing-module.ts","../../src/tools/on-navigation-strategy-preloader.ts"],"sourcesContent":["import {\n createAction,\n props,\n} from '@ngrx/store';\nimport {\n RegisteredItemFailureReason,\n} from './routing-guard.state';\n\n/** Entity Actions */\nconst ACTION_REGISTER_ENTITY = '[RoutingGuard] register an entity';\nconst ACTION_SET_ENTITY_AS_FAILURE = '[RoutingGuard] set an entity state as FAILURE';\nconst ACTION_SET_ENTITY_AS_SUCCESS_AND_CLEAR_REASON = '[RoutingGuard] set an entity state as SUCCESS and clear reason';\nconst ACTION_SET_ENTITY_AS_PENDING = '[RoutingGuard] set an entity state as PENDING';\nconst ACTION_CLEAR_ENTITIES = '[RoutingGuard] clear entities';\nconst ACTION_CLEAR_FAILURE_REASON = '[RoutingGuard] clear failure reason for an entity';\nconst ACTION_SET_ENTITY_AS_FAILURE_WITH_REASON = '[RoutingGuard] set an entity state as FAILURE with a reason';\n\nexport interface RoutingGuardActionPayload {\n /** Id of the block instance */\n id: string;\n}\n\nexport interface RoutingGuardFailureReasonPayload {\n /** Id of the block instance */\n id: string;\n /** Reason for failure */\n reason: RegisteredItemFailureReason;\n}\n\n/**\n * Register a new entity in routing guard store\n */\nexport const registerRoutingGuardEntity = createAction(ACTION_REGISTER_ENTITY, props<RoutingGuardActionPayload>());\n\n/**\n * Set an entity in FAILURE status\n */\nexport const setRoutingGuardEntityAsFailure = createAction(ACTION_SET_ENTITY_AS_FAILURE, props<RoutingGuardActionPayload>());\n\n/**\n * Set an entity in SUCCESS status and clear the reason\n */\nexport const setRoutingGuardEntityAsSuccessAndClearReason = createAction(ACTION_SET_ENTITY_AS_SUCCESS_AND_CLEAR_REASON, props<RoutingGuardActionPayload>());\n\n/**\n * Set an entity in PENDING status\n */\nexport const setRoutingGuardEntityAsPending = createAction(ACTION_SET_ENTITY_AS_PENDING, props<RoutingGuardActionPayload>());\n\n/**\n * Clear only the entities, keeps the other attributes in the state\n */\nexport const clearRoutingGuardEntities = createAction(ACTION_CLEAR_ENTITIES);\n\n/**\n * Clear only the entities, keeps the other attributes in the state\n */\nexport const clearRoutingGuardEntitiesFailureReason = createAction(ACTION_CLEAR_FAILURE_REASON, props<RoutingGuardActionPayload>());\n\n/**\n * Set entity in FAILURE status with a reason\n */\nexport const setRoutingGuardEntityFailureWithReason = createAction(ACTION_SET_ENTITY_AS_FAILURE_WITH_REASON, props<RoutingGuardFailureReasonPayload>());\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport {\n BaseRouterStoreState,\n ROUTER_NAVIGATED,\n ROUTER_REQUEST,\n RouterRequestAction,\n} from '@ngrx/router-store';\nimport {\n filter,\n map,\n} from 'rxjs/operators';\nimport {\n clearRoutingGuardEntities,\n} from '../routing-guard.actions';\n\n/**\n * Effect to react on Ngrx router store actions\n */\n@Injectable()\nexport class NgrxStoreRouterEffect {\n protected actions$ = inject(Actions);\n\n /**\n * Clear Router registrations when the active history entry changes (ex : click on back/next button Action)\n */\n public resetRouterRegistrationOnRequest$ = createEffect(() =>\n this.actions$.pipe(\n ofType(ROUTER_REQUEST),\n filter((action: RouterRequestAction<BaseRouterStoreState>) => action.payload.event.navigationTrigger === 'popstate'),\n map(() => clearRoutingGuardEntities())\n )\n );\n\n /**\n * Clear Router registrations when navigation happened\n */\n public resetRouterRegistrationOnNavigated$ = createEffect(() =>\n this.actions$.pipe(\n ofType(ROUTER_NAVIGATED),\n map(() => clearRoutingGuardEntities())\n )\n );\n}\n","import {\n EntityState,\n} from '@ngrx/entity';\n\n/** Identifies the status of a registered block */\nexport enum RegisteredItemStatus {\n /** block is ready (async call has not been triggered) */\n READY = 'READY',\n /** block is waiting for async call to resolve */\n PENDING = 'PENDING',\n /** block received the async call result and it's a failure */\n FAILURE = 'FAILURE',\n /** block received the async call result and it's a success */\n SUCCESS = 'SUCCESS'\n}\n\n/** Identifies the failure reason for the registered block */\nexport enum RegisteredItemFailureReason {\n /** Routing Failed because the async call result is failure */\n ASYNC_CALL_FAILURE = 'ASYNC_CALL_FAILURE',\n /** Routing failed because the changes to the form has not been saved */\n FORM_UNSAVED = 'FORM_UNSAVED'\n}\n\n/**\n * RoutingGuard model\n */\nexport interface RoutingGuardModel {\n /** Id of the block instance */\n id: string;\n /** Routing status of the block */\n status: RegisteredItemStatus;\n /** Routing Guard blocking reason */\n blockingReason?: RegisteredItemFailureReason;\n}\n\n/**\n * RoutingGuard store state\n */\nexport interface RoutingGuardState extends EntityState<RoutingGuardModel> {}\n\n/**\n * Name of the RoutingGuard Store\n */\nexport const ROUTING_GUARD_STORE_NAME = 'routingGuard';\n\n/**\n * RoutingGuard Store Interface\n */\nexport interface RoutingGuardStore {\n /** RoutingGuard state */\n [ROUTING_GUARD_STORE_NAME]: RoutingGuardState;\n}\n","import {\n createEntityAdapter,\n EntityAdapter,\n} from '@ngrx/entity';\nimport {\n ActionCreator,\n createReducer,\n on,\n ReducerTypes,\n} from '@ngrx/store';\nimport * as actions from './routing-guard.actions';\nimport {\n RegisteredItemStatus,\n RoutingGuardModel,\n RoutingGuardState,\n} from './routing-guard.state';\n\n/**\n * RoutingGuard Store adapter\n */\nexport const routingGuardAdapter: EntityAdapter<RoutingGuardModel> = createEntityAdapter<RoutingGuardModel>({\n selectId: (model) => model.id\n});\n\n/**\n * RoutingGuard Store initial value\n */\nexport const routingGuardInitialState = routingGuardAdapter.getInitialState<RoutingGuardState>({});\n\n/**\n * List of basic actions for RoutingGuard Store\n */\nexport const routingGuardReducerFeatures: ReducerTypes<RoutingGuardState, ActionCreator[]>[] = [\n on(actions.registerRoutingGuardEntity, (state, payload) =>\n routingGuardAdapter.addOne({ id: payload.id, status: RegisteredItemStatus.READY }, state)),\n\n on(actions.setRoutingGuardEntityAsPending, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.PENDING } }, state)),\n\n on(actions.setRoutingGuardEntityAsFailure, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.FAILURE } }, state)),\n\n on(actions.setRoutingGuardEntityAsSuccessAndClearReason, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.SUCCESS, blockingReason: undefined } }, state)),\n\n on(actions.clearRoutingGuardEntities, (state) => routingGuardAdapter.removeAll(state)),\n\n on(actions.clearRoutingGuardEntitiesFailureReason, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.READY, blockingReason: undefined } }, state)),\n\n on(actions.setRoutingGuardEntityFailureWithReason, (state, payload) =>\n routingGuardAdapter.updateOne({ id: payload.id, changes: { status: RegisteredItemStatus.FAILURE, blockingReason: payload.reason } }, state))\n];\n\n/**\n * RoutingGuard Store reducer\n */\nexport const routingGuardReducer = createReducer(\n routingGuardInitialState,\n ...routingGuardReducerFeatures\n);\n","import {\n EnvironmentProviders,\n InjectionToken,\n makeEnvironmentProviders,\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport {\n Action,\n ActionReducer,\n provideState,\n StoreModule,\n} from '@ngrx/store';\nimport {\n routingGuardReducer,\n} from './routing-guard.reducer';\nimport {\n ROUTING_GUARD_STORE_NAME,\n RoutingGuardState,\n} from './routing-guard.state';\n\n/** Token of the RoutingGuard reducer */\nexport const ROUTING_GUARD_REDUCER_TOKEN = new InjectionToken<ActionReducer<RoutingGuardState, Action>>('Feature RoutingGuard Reducer');\n\n/** Provide default reducer for RoutingGuard store */\nexport function getDefaultRoutingGuardReducer() {\n return routingGuardReducer;\n}\n\n/**\n * @deprecated Will be removed in v16. Use {@link provideRoutingGuardStore} instead.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(ROUTING_GUARD_STORE_NAME, ROUTING_GUARD_REDUCER_TOKEN)\n ],\n providers: [\n { provide: ROUTING_GUARD_REDUCER_TOKEN, useFactory: getDefaultRoutingGuardReducer }\n ]\n})\nexport class RoutingGuardStoreModule {\n public static forRoot<T extends RoutingGuardState>(reducerFactory: () => ActionReducer<T, Action>): ModuleWithProviders<RoutingGuardStoreModule> {\n return {\n ngModule: RoutingGuardStoreModule,\n providers: [\n { provide: ROUTING_GUARD_REDUCER_TOKEN, useFactory: reducerFactory }\n ]\n };\n }\n}\n\n/**\n * Provide RoutingGuard feature store.\n * @param reducerFactory Optional factory to override the default reducer.\n */\nexport function provideRoutingGuardStore(reducerFactory?: () => ActionReducer<RoutingGuardState, Action>): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideState(ROUTING_GUARD_STORE_NAME, reducerFactory ? reducerFactory() : routingGuardReducer)\n ]);\n}\n","import {\n createFeatureSelector,\n createSelector,\n} from '@ngrx/store';\nimport {\n routingGuardAdapter,\n} from './routing-guard.reducer';\nimport {\n RegisteredItemFailureReason,\n RegisteredItemStatus,\n ROUTING_GUARD_STORE_NAME,\n RoutingGuardState,\n} from './routing-guard.state';\n\nconst { selectIds, selectEntities, selectAll, selectTotal } = routingGuardAdapter.getSelectors();\n\n/** Select RoutingGuard State */\nexport const selectRoutingGuardState = createFeatureSelector<RoutingGuardState>(ROUTING_GUARD_STORE_NAME);\n\n/** Select the array of RoutingGuard ids */\nexport const selectRoutingGuardIds = createSelector(selectRoutingGuardState, selectIds);\n\n/** Select the array of RoutingGuard */\nexport const selectAllRoutingGuard = createSelector(selectRoutingGuardState, selectAll);\n\n/** Select the dictionary of RoutingGuard entities */\nexport const selectRoutingGuardEntities = createSelector(selectRoutingGuardState, selectEntities);\n\n/** Select the total RoutingGuard count */\nexport const selectRoutingGuardTotal = createSelector(selectRoutingGuardState, selectTotal);\n\n/**\n * Selector used to retrieve the list of entities' status\n */\nexport const selectRoutingGuardEntitiesStatusList = createSelector(\n selectRoutingGuardState,\n (state: RoutingGuardState) => {\n return Object.keys(state.entities)\n .filter((key) => !!state.entities[key])\n .map((key) => state.entities[key]!.status);\n }\n);\n\n/**\n * Selector used to retrieve the list of entities' blocking reasons for FAILURE status.\n */\nexport const selectRoutingGuardEntitiesBlockingReasons = createSelector(\n selectRoutingGuardState,\n (state: RoutingGuardState) => {\n return Object.values(state.entities)\n .filter((entity) => !!entity && !!entity.blockingReason)\n .map((entity) => entity!.blockingReason!);\n }\n);\n\n/**\n * Selector used to check that no item is in PENDING state.\n * For example, we will rely on this selector to trigger the canDeactivate logic in the RoutingGuard\n */\nexport const hasNoEntitiesInPendingState = createSelector(\n selectRoutingGuardEntitiesStatusList,\n (statusList: string[]) => {\n return !statusList.includes(RegisteredItemStatus.PENDING);\n }\n);\n\n/**\n * Selector used to check that no item is in FAILURE state.\n * For example, we will rely on this selector to authorize or not the navigation in the RoutingGuard\n */\nexport const hasNoEntitiesInFailureState = createSelector(\n selectRoutingGuardEntitiesStatusList,\n (statusList: string[]) => {\n return !statusList.includes(RegisteredItemStatus.FAILURE);\n }\n);\n\n/**\n * Selector used to check that no item is in READY or FAILURE state.\n * For example, we will rely on this selector to trigger the router navigation and display a loader\n */\nexport const hasNoEntityInReadyOrFailureState = createSelector(\n selectRoutingGuardEntitiesStatusList,\n (statusList: RegisteredItemStatus[]) => {\n return !statusList.some((status) => status === RegisteredItemStatus.READY || status === RegisteredItemStatus.FAILURE);\n }\n);\n\n/**\n * Selector used to check that no item is in FAILURE state with a blocking reason provided.\n * Takes `blockingReason: RegisteredItemFailureReason` as aproperty parameter.\n */\nexport const hasNoEntityFailureStateWithReasons = createSelector(\n selectRoutingGuardEntitiesBlockingReasons,\n (reasons: RegisteredItemFailureReason[], properties: { blockingReason: RegisteredItemFailureReason }) => {\n return !reasons.includes(properties.blockingReason);\n }\n);\n","import {\n APP_BASE_HREF,\n} from '@angular/common';\nimport {\n InjectionToken,\n makeEnvironmentProviders,\n type Provider,\n} from '@angular/core';\nimport {\n type BuildTimeProperties,\n DEFAULT_BUILD_PROPERTIES,\n} from '@o3r/core';\n\n/**\n * AppBaseHref factory function\n * The APP_BASE_HREF will assume one of the following values (ordered by priority):\n * 1- undefined (or disabled) if it's not a PROD environment\n * 2- the content of the data tag data-appbasehref in the body if it exists\n * 3- the content of config.APP_BASE_HREF if defined\n * 4- otherwise, undefined\n * @param config The application environment configuration\n */\nexport function appBaseHrefFactory(config: BuildTimeProperties) {\n if (config.ENVIRONMENT !== 'prod') {\n return;\n }\n const dynamicBaseHref: string | undefined = document.body.dataset.appbasehref;\n if (typeof dynamicBaseHref !== 'undefined') {\n return dynamicBaseHref;\n }\n return typeof config.APP_BASE_HREF === 'string' ? config.APP_BASE_HREF : undefined;\n}\n\nexport const ENVIRONMENT_CONFIG_TOKEN = new InjectionToken<BuildTimeProperties>('Environment config');\n\ntype EnvironmentFeatureKind = 'base-href';\n\ninterface EnvironmentFeature<FeatureKind extends EnvironmentFeatureKind> {\n ɵkind: FeatureKind;\n ɵproviders: Provider[];\n}\n\ntype BaseHrefFeature = EnvironmentFeature<'base-href'>;\n\ntype EnvironmentFeatures = BaseHrefFeature;\n\n/**\n * Specify a custom base href\n * @param baseHref\n */\nexport function withBaseHref<T extends string | undefined>(baseHref: T | ((environmentConfig: BuildTimeProperties) => T)): EnvironmentFeatures {\n return {\n ɵkind: 'base-href',\n ɵproviders: [\n {\n provide: APP_BASE_HREF,\n ...(\n typeof baseHref === 'function'\n ? { useFactory: baseHref, deps: [ENVIRONMENT_CONFIG_TOKEN] }\n : { useValue: baseHref }\n )\n }\n ]\n };\n}\n\n/**\n * Provide environment configuration\n * @note it will also provide APP_BASE_HREF based on the environment configuration\n * @param config\n * @param features\n */\nexport function provideEnvironment(config: Partial<BuildTimeProperties>, ...features: EnvironmentFeatures[]) {\n const additionalProviders = [];\n const baseHrefFeature = features.find((f) => f.ɵkind === 'base-href') ?? withBaseHref(appBaseHrefFactory);\n additionalProviders.push(baseHrefFeature.ɵproviders);\n\n return makeEnvironmentProviders([\n { provide: ENVIRONMENT_CONFIG_TOKEN, useValue: { ...DEFAULT_BUILD_PROPERTIES, ...config } },\n additionalProviders\n ]);\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n NavigationEnd,\n PreloadingStrategy,\n Route,\n Router,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n filter,\n switchMap,\n} from 'rxjs/operators';\n\n/**\n * Data to inject to the route parameter to specify preloading strategy\n */\nexport interface O3rOnDemandPreloadingData {\n /** List of page reached that trigger preloading */\n preloadOn: string[] | '*' | RegExp;\n}\n\n/**\n * Check if the route has preload instructions\n * @param data Route data\n */\nexport function hasPreloadingOnDemand(data: any): data is O3rOnDemandPreloadingData {\n if (!data) {\n return false;\n }\n\n return (Array.isArray(data.preloadOn) && data.preloadOn.length > 0)\n || data.preloadOn === '*'\n || data.preloadOn instanceof RegExp;\n}\n\n/**\n * Otter Preloading strategy base on previous route\n * @inheritDoc\n */\n@Injectable()\nexport class O3rOnNavigationPreloadingStrategy implements PreloadingStrategy {\n private readonly router = inject(Router);\n\n /**\n * Check if the module should be preloaded based on the data preload array of routes or regex value\n * @param data Route data\n * @param url URL of current page\n */\n private isUrlMatchingPreloadConfig(data: any, url: string): boolean {\n return (Array.isArray(data.preloadOn) && data.preloadOn.includes(url))\n || (data.preloadOn instanceof RegExp && data.preloadOn.test(url));\n }\n\n /** @inheritDoc */\n public preload(route: Route, preload: () => Observable<any>): Observable<any> {\n if ((route.path || route.matcher) && hasPreloadingOnDemand(route.data)) {\n // On application landing page, check the route to preload.\n if (route.data.preloadOn === '*' || this.isUrlMatchingPreloadConfig(route.data, this.router.routerState.snapshot.url)) {\n return preload();\n }\n\n // On route navigation end, load the routes to preload for the current route.\n return this.router.events\n .pipe(\n filter((r) => r instanceof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SAAS,GAAG,GAClH,OAAO,QAAO;GAIhB,OAAO,KAAK,OAAO,OAChB,KACC,QAAQ,MAAM,aAAa,iBAAiB,KAAK,2BAA2B,MAAM,MAAM,EAAE,GAAG,CAAC,GAC9F,gBAAgB,QAAO,CAAE,CAAC;EAEhC;EACA,OAAO,GAAG,IAAI;CAChB;CA7BW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiC,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAjC;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAAiC,CAAA;CAAA;;AAAjC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiC,YAAA,CAAA,EAD7C,MAAA,W"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/routing",
|
|
3
|
-
"version": "15.3.0-
|
|
3
|
+
"version": "15.3.0-rc.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@ngrx/entity": "^22.0.0",
|
|
21
21
|
"@ngrx/router-store": "^22.0.0",
|
|
22
22
|
"@ngrx/store": "^22.0.0",
|
|
23
|
-
"@o3r/core": "~15.3.0-
|
|
24
|
-
"@o3r/routing": "~15.3.0-
|
|
25
|
-
"@o3r/schematics": "~15.3.0-
|
|
23
|
+
"@o3r/core": "~15.3.0-rc.1",
|
|
24
|
+
"@o3r/routing": "~15.3.0-rc.1",
|
|
25
|
+
"@o3r/schematics": "~15.3.0-rc.1",
|
|
26
26
|
"@schematics/angular": "^22.0.0",
|
|
27
27
|
"jasmine": "^5.0.0",
|
|
28
28
|
"rxjs": "^7.8.1",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@o3r/schematics": "~15.3.0-
|
|
49
|
+
"@o3r/schematics": "~15.3.0-rc.1",
|
|
50
50
|
"tslib": "^2.6.2"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
package/types/o3r-routing.d.ts
CHANGED
|
@@ -1,198 +1,186 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import * as
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { EntityState, EntityAdapter } from '@ngrx/entity';
|
|
11
|
-
import * as _o3r_routing from '@o3r/routing';
|
|
12
|
-
import { BuildTimeProperties } from '@o3r/core';
|
|
13
|
-
import { PreloadingStrategy, Route } from '@angular/router';
|
|
14
|
-
|
|
1
|
+
import { Actions } from "@ngrx/effects";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { EnvironmentProviders, InjectionToken, ModuleWithProviders, Provider } from "@angular/core";
|
|
4
|
+
import { EntityAdapter, EntityState } from "@ngrx/entity";
|
|
5
|
+
import * as i1 from "@ngrx/store";
|
|
6
|
+
import { Action, ActionCreator, ActionReducer, ReducerTypes } from "@ngrx/store";
|
|
7
|
+
import { BuildTimeProperties } from "@o3r/core";
|
|
8
|
+
import { PreloadingStrategy, Route } from "@angular/router";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
15
10
|
/**
|
|
16
11
|
* Effect to react on Ngrx router store actions
|
|
17
12
|
*/
|
|
18
|
-
declare class NgrxStoreRouterEffect {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
export declare class NgrxStoreRouterEffect {
|
|
14
|
+
protected actions$: Actions<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Clear Router registrations when the active history entry changes (ex : click on back/next button Action)
|
|
17
|
+
*/
|
|
18
|
+
resetRouterRegistrationOnRequest$: import("rxjs").Observable<import("@ngrx/store").Action<"[RoutingGuard] clear entities">> & import("@ngrx/effects").CreateEffectMetadata;
|
|
19
|
+
/**
|
|
20
|
+
* Clear Router registrations when navigation happened
|
|
21
|
+
*/
|
|
22
|
+
resetRouterRegistrationOnNavigated$: import("rxjs").Observable<import("@ngrx/store").Action<"[RoutingGuard] clear entities">> & import("@ngrx/effects").CreateEffectMetadata;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgrxStoreRouterEffect, never>;
|
|
24
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
/** Identifies the status of a registered block */
|
|
33
|
-
declare enum RegisteredItemStatus {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
export declare enum RegisteredItemStatus {
|
|
28
|
+
/** block is ready (async call has not been triggered) */
|
|
29
|
+
READY = "READY",
|
|
30
|
+
/** block is waiting for async call to resolve */
|
|
31
|
+
PENDING = "PENDING",
|
|
32
|
+
/** block received the async call result and it's a failure */
|
|
33
|
+
FAILURE = "FAILURE",
|
|
34
|
+
/** block received the async call result and it's a success */
|
|
35
|
+
SUCCESS = "SUCCESS"
|
|
42
36
|
}
|
|
43
37
|
/** Identifies the failure reason for the registered block */
|
|
44
|
-
declare enum RegisteredItemFailureReason {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
export declare enum RegisteredItemFailureReason {
|
|
39
|
+
/** Routing Failed because the async call result is failure */
|
|
40
|
+
ASYNC_CALL_FAILURE = "ASYNC_CALL_FAILURE",
|
|
41
|
+
/** Routing failed because the changes to the form has not been saved */
|
|
42
|
+
FORM_UNSAVED = "FORM_UNSAVED"
|
|
49
43
|
}
|
|
50
44
|
/**
|
|
51
45
|
* RoutingGuard model
|
|
52
46
|
*/
|
|
53
|
-
interface RoutingGuardModel {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
export interface RoutingGuardModel {
|
|
48
|
+
/** Id of the block instance */
|
|
49
|
+
id: string;
|
|
50
|
+
/** Routing status of the block */
|
|
51
|
+
status: RegisteredItemStatus;
|
|
52
|
+
/** Routing Guard blocking reason */
|
|
53
|
+
blockingReason?: RegisteredItemFailureReason;
|
|
60
54
|
}
|
|
61
55
|
/**
|
|
62
56
|
* RoutingGuard store state
|
|
63
57
|
*/
|
|
64
|
-
interface RoutingGuardState extends EntityState<RoutingGuardModel> {
|
|
65
|
-
}
|
|
58
|
+
export interface RoutingGuardState extends EntityState<RoutingGuardModel> {}
|
|
66
59
|
/**
|
|
67
60
|
* Name of the RoutingGuard Store
|
|
68
61
|
*/
|
|
69
|
-
declare const ROUTING_GUARD_STORE_NAME = "routingGuard";
|
|
62
|
+
export declare const ROUTING_GUARD_STORE_NAME = "routingGuard";
|
|
70
63
|
/**
|
|
71
64
|
* RoutingGuard Store Interface
|
|
72
65
|
*/
|
|
73
|
-
interface RoutingGuardStore {
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
export interface RoutingGuardStore {
|
|
67
|
+
/** RoutingGuard state */
|
|
68
|
+
[ROUTING_GUARD_STORE_NAME]: RoutingGuardState;
|
|
76
69
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
id: string;
|
|
70
|
+
export interface RoutingGuardActionPayload {
|
|
71
|
+
/** Id of the block instance */
|
|
72
|
+
id: string;
|
|
81
73
|
}
|
|
82
|
-
interface RoutingGuardFailureReasonPayload {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
export interface RoutingGuardFailureReasonPayload {
|
|
75
|
+
/** Id of the block instance */
|
|
76
|
+
id: string;
|
|
77
|
+
/** Reason for failure */
|
|
78
|
+
reason: RegisteredItemFailureReason;
|
|
87
79
|
}
|
|
88
80
|
/**
|
|
89
81
|
* Register a new entity in routing guard store
|
|
90
82
|
*/
|
|
91
|
-
declare const registerRoutingGuardEntity:
|
|
83
|
+
export declare const registerRoutingGuardEntity: import("@ngrx/store").ActionCreator<"[RoutingGuard] register an entity", (props: RoutingGuardActionPayload) => RoutingGuardActionPayload & import("@ngrx/store").Action<"[RoutingGuard] register an entity">>;
|
|
92
84
|
/**
|
|
93
85
|
* Set an entity in FAILURE status
|
|
94
86
|
*/
|
|
95
|
-
declare const setRoutingGuardEntityAsFailure:
|
|
87
|
+
export declare const setRoutingGuardEntityAsFailure: import("@ngrx/store").ActionCreator<"[RoutingGuard] set an entity state as FAILURE", (props: RoutingGuardActionPayload) => RoutingGuardActionPayload & import("@ngrx/store").Action<"[RoutingGuard] set an entity state as FAILURE">>;
|
|
96
88
|
/**
|
|
97
89
|
* Set an entity in SUCCESS status and clear the reason
|
|
98
90
|
*/
|
|
99
|
-
declare const setRoutingGuardEntityAsSuccessAndClearReason:
|
|
91
|
+
export declare const setRoutingGuardEntityAsSuccessAndClearReason: import("@ngrx/store").ActionCreator<"[RoutingGuard] set an entity state as SUCCESS and clear reason", (props: RoutingGuardActionPayload) => RoutingGuardActionPayload & import("@ngrx/store").Action<"[RoutingGuard] set an entity state as SUCCESS and clear reason">>;
|
|
100
92
|
/**
|
|
101
93
|
* Set an entity in PENDING status
|
|
102
94
|
*/
|
|
103
|
-
declare const setRoutingGuardEntityAsPending:
|
|
95
|
+
export declare const setRoutingGuardEntityAsPending: import("@ngrx/store").ActionCreator<"[RoutingGuard] set an entity state as PENDING", (props: RoutingGuardActionPayload) => RoutingGuardActionPayload & import("@ngrx/store").Action<"[RoutingGuard] set an entity state as PENDING">>;
|
|
104
96
|
/**
|
|
105
97
|
* Clear only the entities, keeps the other attributes in the state
|
|
106
98
|
*/
|
|
107
|
-
declare const clearRoutingGuardEntities:
|
|
99
|
+
export declare const clearRoutingGuardEntities: import("@ngrx/store").ActionCreator<"[RoutingGuard] clear entities", () => import("@ngrx/store").Action<"[RoutingGuard] clear entities">>;
|
|
108
100
|
/**
|
|
109
101
|
* Clear only the entities, keeps the other attributes in the state
|
|
110
102
|
*/
|
|
111
|
-
declare const clearRoutingGuardEntitiesFailureReason:
|
|
103
|
+
export declare const clearRoutingGuardEntitiesFailureReason: import("@ngrx/store").ActionCreator<"[RoutingGuard] clear failure reason for an entity", (props: RoutingGuardActionPayload) => RoutingGuardActionPayload & import("@ngrx/store").Action<"[RoutingGuard] clear failure reason for an entity">>;
|
|
112
104
|
/**
|
|
113
105
|
* Set entity in FAILURE status with a reason
|
|
114
106
|
*/
|
|
115
|
-
declare const setRoutingGuardEntityFailureWithReason:
|
|
116
|
-
|
|
107
|
+
export declare const setRoutingGuardEntityFailureWithReason: import("@ngrx/store").ActionCreator<"[RoutingGuard] set an entity state as FAILURE with a reason", (props: RoutingGuardFailureReasonPayload) => RoutingGuardFailureReasonPayload & import("@ngrx/store").Action<"[RoutingGuard] set an entity state as FAILURE with a reason">>;
|
|
117
108
|
/** Token of the RoutingGuard reducer */
|
|
118
|
-
declare const ROUTING_GUARD_REDUCER_TOKEN: InjectionToken<ActionReducer<RoutingGuardState, Action<string>>>;
|
|
109
|
+
export declare const ROUTING_GUARD_REDUCER_TOKEN: InjectionToken<ActionReducer<RoutingGuardState, Action<string>>>;
|
|
119
110
|
/** Provide default reducer for RoutingGuard store */
|
|
120
|
-
declare function getDefaultRoutingGuardReducer(): ActionReducer<RoutingGuardState, Action<string>>;
|
|
111
|
+
export declare function getDefaultRoutingGuardReducer(): ActionReducer<RoutingGuardState, Action<string>>;
|
|
121
112
|
/**
|
|
122
113
|
* @deprecated Will be removed in v16. Use {@link provideRoutingGuardStore} instead.
|
|
123
114
|
*/
|
|
124
|
-
declare class RoutingGuardStoreModule {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
export declare class RoutingGuardStoreModule {
|
|
116
|
+
static forRoot<T extends RoutingGuardState>(reducerFactory: () => ActionReducer<T, Action>): ModuleWithProviders<RoutingGuardStoreModule>;
|
|
117
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RoutingGuardStoreModule, never>;
|
|
118
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<RoutingGuardStoreModule, never, [typeof i1.StoreFeatureModule], never>;
|
|
119
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<RoutingGuardStoreModule>;
|
|
129
120
|
}
|
|
130
121
|
/**
|
|
131
122
|
* Provide RoutingGuard feature store.
|
|
132
123
|
* @param reducerFactory Optional factory to override the default reducer.
|
|
133
124
|
*/
|
|
134
|
-
declare function provideRoutingGuardStore(reducerFactory?: () => ActionReducer<RoutingGuardState, Action>): EnvironmentProviders;
|
|
135
|
-
|
|
125
|
+
export declare function provideRoutingGuardStore(reducerFactory?: () => ActionReducer<RoutingGuardState, Action>): EnvironmentProviders;
|
|
136
126
|
/**
|
|
137
127
|
* RoutingGuard Store adapter
|
|
138
128
|
*/
|
|
139
|
-
declare const routingGuardAdapter: EntityAdapter<RoutingGuardModel>;
|
|
129
|
+
export declare const routingGuardAdapter: EntityAdapter<RoutingGuardModel>;
|
|
140
130
|
/**
|
|
141
131
|
* RoutingGuard Store initial value
|
|
142
132
|
*/
|
|
143
|
-
declare const routingGuardInitialState: RoutingGuardState;
|
|
133
|
+
export declare const routingGuardInitialState: RoutingGuardState;
|
|
144
134
|
/**
|
|
145
135
|
* List of basic actions for RoutingGuard Store
|
|
146
136
|
*/
|
|
147
|
-
declare const routingGuardReducerFeatures: ReducerTypes<RoutingGuardState, ActionCreator[]>[];
|
|
137
|
+
export declare const routingGuardReducerFeatures: ReducerTypes<RoutingGuardState, ActionCreator[]>[];
|
|
148
138
|
/**
|
|
149
139
|
* RoutingGuard Store reducer
|
|
150
140
|
*/
|
|
151
|
-
declare const routingGuardReducer:
|
|
152
|
-
|
|
141
|
+
export declare const routingGuardReducer: import("@ngrx/store").ActionReducer<RoutingGuardState, import("@ngrx/store").Action<string>>;
|
|
153
142
|
/** Select RoutingGuard State */
|
|
154
|
-
declare const selectRoutingGuardState:
|
|
143
|
+
export declare const selectRoutingGuardState: import("@ngrx/store").MemoizedSelector<object, RoutingGuardState, import("@ngrx/store").DefaultProjectorFn<RoutingGuardState>>;
|
|
155
144
|
/** Select the array of RoutingGuard ids */
|
|
156
|
-
declare const selectRoutingGuardIds:
|
|
145
|
+
export declare const selectRoutingGuardIds: import("@ngrx/store").MemoizedSelector<object, string[] | number[], (s1: RoutingGuardState) => string[] | number[]>;
|
|
157
146
|
/** Select the array of RoutingGuard */
|
|
158
|
-
declare const selectAllRoutingGuard:
|
|
147
|
+
export declare const selectAllRoutingGuard: import("@ngrx/store").MemoizedSelector<object, import("@o3r/routing").RoutingGuardModel[], (s1: RoutingGuardState) => import("@o3r/routing").RoutingGuardModel[]>;
|
|
159
148
|
/** Select the dictionary of RoutingGuard entities */
|
|
160
|
-
declare const selectRoutingGuardEntities:
|
|
149
|
+
export declare const selectRoutingGuardEntities: import("@ngrx/store").MemoizedSelector<object, import("@ngrx/entity").Dictionary<import("@o3r/routing").RoutingGuardModel>, (s1: RoutingGuardState) => import("@ngrx/entity").Dictionary<import("@o3r/routing").RoutingGuardModel>>;
|
|
161
150
|
/** Select the total RoutingGuard count */
|
|
162
|
-
declare const selectRoutingGuardTotal:
|
|
151
|
+
export declare const selectRoutingGuardTotal: import("@ngrx/store").MemoizedSelector<object, number, (s1: RoutingGuardState) => number>;
|
|
163
152
|
/**
|
|
164
153
|
* Selector used to retrieve the list of entities' status
|
|
165
154
|
*/
|
|
166
|
-
declare const selectRoutingGuardEntitiesStatusList:
|
|
155
|
+
export declare const selectRoutingGuardEntitiesStatusList: import("@ngrx/store").MemoizedSelector<object, RegisteredItemStatus[], (s1: RoutingGuardState) => RegisteredItemStatus[]>;
|
|
167
156
|
/**
|
|
168
157
|
* Selector used to retrieve the list of entities' blocking reasons for FAILURE status.
|
|
169
158
|
*/
|
|
170
|
-
declare const selectRoutingGuardEntitiesBlockingReasons:
|
|
159
|
+
export declare const selectRoutingGuardEntitiesBlockingReasons: import("@ngrx/store").MemoizedSelector<object, RegisteredItemFailureReason[], (s1: RoutingGuardState) => RegisteredItemFailureReason[]>;
|
|
171
160
|
/**
|
|
172
161
|
* Selector used to check that no item is in PENDING state.
|
|
173
162
|
* For example, we will rely on this selector to trigger the canDeactivate logic in the RoutingGuard
|
|
174
163
|
*/
|
|
175
|
-
declare const hasNoEntitiesInPendingState:
|
|
164
|
+
export declare const hasNoEntitiesInPendingState: import("@ngrx/store").MemoizedSelector<object, boolean, (s1: RegisteredItemStatus[]) => boolean>;
|
|
176
165
|
/**
|
|
177
166
|
* Selector used to check that no item is in FAILURE state.
|
|
178
167
|
* For example, we will rely on this selector to authorize or not the navigation in the RoutingGuard
|
|
179
168
|
*/
|
|
180
|
-
declare const hasNoEntitiesInFailureState:
|
|
169
|
+
export declare const hasNoEntitiesInFailureState: import("@ngrx/store").MemoizedSelector<object, boolean, (s1: RegisteredItemStatus[]) => boolean>;
|
|
181
170
|
/**
|
|
182
171
|
* Selector used to check that no item is in READY or FAILURE state.
|
|
183
172
|
* For example, we will rely on this selector to trigger the router navigation and display a loader
|
|
184
173
|
*/
|
|
185
|
-
declare const hasNoEntityInReadyOrFailureState:
|
|
174
|
+
export declare const hasNoEntityInReadyOrFailureState: import("@ngrx/store").MemoizedSelector<object, boolean, (s1: RegisteredItemStatus[]) => boolean>;
|
|
186
175
|
/**
|
|
187
176
|
* Selector used to check that no item is in FAILURE state with a blocking reason provided.
|
|
188
177
|
* Takes `blockingReason: RegisteredItemFailureReason` as aproperty parameter.
|
|
189
178
|
*/
|
|
190
|
-
declare const hasNoEntityFailureStateWithReasons:
|
|
191
|
-
|
|
179
|
+
export declare const hasNoEntityFailureStateWithReasons: import("@ngrx/store").MemoizedSelectorWithProps<object, {
|
|
180
|
+
blockingReason: RegisteredItemFailureReason;
|
|
192
181
|
}, boolean, (s1: RegisteredItemFailureReason[], props: {
|
|
193
|
-
|
|
182
|
+
blockingReason: RegisteredItemFailureReason;
|
|
194
183
|
}) => boolean>;
|
|
195
|
-
|
|
196
184
|
/**
|
|
197
185
|
* AppBaseHref factory function
|
|
198
186
|
* The APP_BASE_HREF will assume one of the following values (ordered by priority):
|
|
@@ -202,12 +190,12 @@ declare const hasNoEntityFailureStateWithReasons: _ngrx_store.MemoizedSelectorWi
|
|
|
202
190
|
* 4- otherwise, undefined
|
|
203
191
|
* @param config The application environment configuration
|
|
204
192
|
*/
|
|
205
|
-
declare function appBaseHrefFactory(config: BuildTimeProperties): string | undefined;
|
|
206
|
-
declare const ENVIRONMENT_CONFIG_TOKEN: InjectionToken<BuildTimeProperties>;
|
|
193
|
+
export declare function appBaseHrefFactory(config: BuildTimeProperties): string | undefined;
|
|
194
|
+
export declare const ENVIRONMENT_CONFIG_TOKEN: InjectionToken<BuildTimeProperties>;
|
|
207
195
|
type EnvironmentFeatureKind = 'base-href';
|
|
208
196
|
interface EnvironmentFeature<FeatureKind extends EnvironmentFeatureKind> {
|
|
209
|
-
|
|
210
|
-
|
|
197
|
+
ɵkind: FeatureKind;
|
|
198
|
+
ɵproviders: Provider[];
|
|
211
199
|
}
|
|
212
200
|
type BaseHrefFeature = EnvironmentFeature<'base-href'>;
|
|
213
201
|
type EnvironmentFeatures = BaseHrefFeature;
|
|
@@ -215,45 +203,42 @@ type EnvironmentFeatures = BaseHrefFeature;
|
|
|
215
203
|
* Specify a custom base href
|
|
216
204
|
* @param baseHref
|
|
217
205
|
*/
|
|
218
|
-
declare function withBaseHref<T extends string | undefined>(baseHref: T | ((environmentConfig: BuildTimeProperties) => T)): EnvironmentFeatures;
|
|
206
|
+
export declare function withBaseHref<T extends string | undefined>(baseHref: T | ((environmentConfig: BuildTimeProperties) => T)): EnvironmentFeatures;
|
|
219
207
|
/**
|
|
220
208
|
* Provide environment configuration
|
|
221
209
|
* @note it will also provide APP_BASE_HREF based on the environment configuration
|
|
222
210
|
* @param config
|
|
223
211
|
* @param features
|
|
224
212
|
*/
|
|
225
|
-
declare function provideEnvironment(config: Partial<BuildTimeProperties>, ...features: EnvironmentFeatures[]):
|
|
226
|
-
|
|
213
|
+
export declare function provideEnvironment(config: Partial<BuildTimeProperties>, ...features: EnvironmentFeatures[]): import("@angular/core").EnvironmentProviders;
|
|
227
214
|
/**
|
|
228
215
|
* Data to inject to the route parameter to specify preloading strategy
|
|
229
216
|
*/
|
|
230
|
-
interface O3rOnDemandPreloadingData {
|
|
231
|
-
|
|
232
|
-
|
|
217
|
+
export interface O3rOnDemandPreloadingData {
|
|
218
|
+
/** List of page reached that trigger preloading */
|
|
219
|
+
preloadOn: string[] | '*' | RegExp;
|
|
233
220
|
}
|
|
234
221
|
/**
|
|
235
222
|
* Check if the route has preload instructions
|
|
236
223
|
* @param data Route data
|
|
237
224
|
*/
|
|
238
|
-
declare function hasPreloadingOnDemand(data: any): data is O3rOnDemandPreloadingData;
|
|
225
|
+
export declare function hasPreloadingOnDemand(data: any): data is O3rOnDemandPreloadingData;
|
|
239
226
|
/**
|
|
240
227
|
* Otter Preloading strategy base on previous route
|
|
241
228
|
* @inheritDoc
|
|
242
229
|
*/
|
|
243
|
-
declare class O3rOnNavigationPreloadingStrategy implements PreloadingStrategy {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
230
|
+
export declare class O3rOnNavigationPreloadingStrategy implements PreloadingStrategy {
|
|
231
|
+
private readonly router;
|
|
232
|
+
/**
|
|
233
|
+
* Check if the module should be preloaded based on the data preload array of routes or regex value
|
|
234
|
+
* @param data Route data
|
|
235
|
+
* @param url URL of current page
|
|
236
|
+
*/
|
|
237
|
+
private isUrlMatchingPreloadConfig;
|
|
238
|
+
/** @inheritDoc */
|
|
239
|
+
preload(route: Route, preload: () => Observable<any>): Observable<any>;
|
|
240
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<O3rOnNavigationPreloadingStrategy, never>;
|
|
241
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
255
242
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
export type { O3rOnDemandPreloadingData, RoutingGuardActionPayload, RoutingGuardFailureReasonPayload, RoutingGuardModel, RoutingGuardState, RoutingGuardStore };
|
|
259
|
-
//# sourceMappingURL=o3r-routing.d.ts.map
|
|
243
|
+
export {};
|
|
244
|
+
//# sourceMappingURL=o3r-routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o3r-routing.d.ts","sources":["../../src/stores/routing-guard/extra-effects/ngrx-store-router.effect.ts","../../src/stores/routing-guard/routing-guard.state.ts","../../src/stores/routing-guard/routing-guard.actions.ts","../../src/stores/routing-guard/routing-guard-module.ts","../../src/stores/routing-guard/routing-guard.reducer.ts","../../src/stores/routing-guard/routing-guard.selectors.ts","../../src/tools/app-server-routing-module.ts","../../src/tools/on-navigation-strategy-preloader.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"o3r-routing.d.ts","names":[],"sources":["../../src/stores/routing-guard/extra-effects/ngrx-store-router.effect.ts","../../src/stores/routing-guard/routing-guard.state.ts","../../src/stores/routing-guard/routing-guard.actions.ts","../../src/stores/routing-guard/routing-guard-module.ts","../../src/stores/routing-guard/routing-guard.reducer.ts","../../src/stores/routing-guard/routing-guard.selectors.ts","../../src/tools/app-server-routing-module.ts","../../src/tools/on-navigation-strategy-preloader.ts"],"mappings":";;;;;;;;;;;;qBA2Ba;YACD,UAAQ;;;;EAKX,kDAAiC,iCAAA,mEAAA;;;;EAWjC,oDAAmC,iCAAA,mEAAA;SAjB/B,MAAA,GAAA,qBAAA;;;;oBCtBD;;EAEV;;EAEA;;EAEA;;EAEA;;;oBAIU;;EAEV;;EAEA;;;;;iBAMe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