@ngxs/router-plugin 3.7.6-dev.master-fb318b1 → 3.7.6-dev.master-dcdd391
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/bundles/ngxs-router-plugin.umd.js +481 -833
- package/bundles/ngxs-router-plugin.umd.js.map +1 -1
- package/esm2015/index.js +2 -6
- package/esm2015/ngxs-router-plugin.js +2 -7
- package/esm2015/src/public_api.js +2 -6
- package/esm2015/src/router.actions.js +1 -129
- package/esm2015/src/router.module.js +12 -14
- package/esm2015/src/router.state.js +46 -232
- package/esm2015/src/serializer.js +4 -44
- package/esm2015/src/symbols.js +3 -33
- package/fesm2015/ngxs-router-plugin.js +42 -433
- package/fesm2015/ngxs-router-plugin.js.map +1 -1
- package/ngxs-router-plugin.d.ts +1 -2
- package/package.json +3 -6
- package/src/router.actions.d.ts +7 -7
- package/src/router.module.d.ts +5 -0
- package/src/router.state.d.ts +3 -0
- package/bundles/ngxs-router-plugin.umd.min.js +0 -16
- package/bundles/ngxs-router-plugin.umd.min.js.map +0 -1
- package/esm5/index.js +0 -9
- package/esm5/ngxs-router-plugin.js +0 -10
- package/esm5/src/public_api.js +0 -9
- package/esm5/src/router.actions.js +0 -309
- package/esm5/src/router.module.js +0 -43
- package/esm5/src/router.state.js +0 -496
- package/esm5/src/serializer.js +0 -98
- package/esm5/src/symbols.js +0 -39
- package/fesm5/ngxs-router-plugin.js +0 -946
- package/fesm5/ngxs-router-plugin.js.map +0 -1
- package/ngxs-router-plugin.metadata.json +0 -1
|
@@ -1,946 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, NgZone, Injector, Injectable, NgModule } from '@angular/core';
|
|
2
|
-
import { Store, Action, Selector, State, NgxsModule } from '@ngxs/store';
|
|
3
|
-
import { __assign, __decorate, __metadata } from 'tslib';
|
|
4
|
-
import { NavigationStart, RoutesRecognized, ResolveEnd, NavigationCancel, NavigationError, NavigationEnd, Router } from '@angular/router';
|
|
5
|
-
import { Subscription } from 'rxjs';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview added by tsickle
|
|
9
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Public event api of the router
|
|
13
|
-
*/
|
|
14
|
-
var /**
|
|
15
|
-
* Public event api of the router
|
|
16
|
-
*/
|
|
17
|
-
Navigate = /** @class */ (function () {
|
|
18
|
-
function Navigate(path, queryParams, extras) {
|
|
19
|
-
this.path = path;
|
|
20
|
-
this.queryParams = queryParams;
|
|
21
|
-
this.extras = extras;
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(Navigate, "type", {
|
|
24
|
-
get: /**
|
|
25
|
-
* @return {?}
|
|
26
|
-
*/
|
|
27
|
-
function () {
|
|
28
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
29
|
-
return '[Router] Navigate';
|
|
30
|
-
},
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true
|
|
33
|
-
});
|
|
34
|
-
return Navigate;
|
|
35
|
-
}());
|
|
36
|
-
if (false) {
|
|
37
|
-
/** @type {?} */
|
|
38
|
-
Navigate.prototype.path;
|
|
39
|
-
/** @type {?} */
|
|
40
|
-
Navigate.prototype.queryParams;
|
|
41
|
-
/** @type {?} */
|
|
42
|
-
Navigate.prototype.extras;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* Angular Routers internal state events
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
/**
|
|
50
|
-
* An action dispatched when the router starts the navigation.
|
|
51
|
-
* @template T
|
|
52
|
-
*/
|
|
53
|
-
var /**
|
|
54
|
-
*
|
|
55
|
-
* Angular Routers internal state events
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
/**
|
|
59
|
-
* An action dispatched when the router starts the navigation.
|
|
60
|
-
* @template T
|
|
61
|
-
*/
|
|
62
|
-
RouterRequest = /** @class */ (function () {
|
|
63
|
-
function RouterRequest(routerState, event, trigger) {
|
|
64
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
65
|
-
this.routerState = routerState;
|
|
66
|
-
this.event = event;
|
|
67
|
-
this.trigger = trigger;
|
|
68
|
-
}
|
|
69
|
-
Object.defineProperty(RouterRequest, "type", {
|
|
70
|
-
get: /**
|
|
71
|
-
* @return {?}
|
|
72
|
-
*/
|
|
73
|
-
function () {
|
|
74
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
75
|
-
return '[Router] RouterRequest';
|
|
76
|
-
},
|
|
77
|
-
enumerable: true,
|
|
78
|
-
configurable: true
|
|
79
|
-
});
|
|
80
|
-
return RouterRequest;
|
|
81
|
-
}());
|
|
82
|
-
if (false) {
|
|
83
|
-
/** @type {?} */
|
|
84
|
-
RouterRequest.prototype.routerState;
|
|
85
|
-
/** @type {?} */
|
|
86
|
-
RouterRequest.prototype.event;
|
|
87
|
-
/** @type {?} */
|
|
88
|
-
RouterRequest.prototype.trigger;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* An action dispatched when the router navigates.
|
|
92
|
-
* @template T
|
|
93
|
-
*/
|
|
94
|
-
var /**
|
|
95
|
-
* An action dispatched when the router navigates.
|
|
96
|
-
* @template T
|
|
97
|
-
*/
|
|
98
|
-
RouterNavigation = /** @class */ (function () {
|
|
99
|
-
function RouterNavigation(routerState, event, trigger) {
|
|
100
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
101
|
-
this.routerState = routerState;
|
|
102
|
-
this.event = event;
|
|
103
|
-
this.trigger = trigger;
|
|
104
|
-
}
|
|
105
|
-
Object.defineProperty(RouterNavigation, "type", {
|
|
106
|
-
get: /**
|
|
107
|
-
* @return {?}
|
|
108
|
-
*/
|
|
109
|
-
function () {
|
|
110
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
111
|
-
return '[Router] RouterNavigation';
|
|
112
|
-
},
|
|
113
|
-
enumerable: true,
|
|
114
|
-
configurable: true
|
|
115
|
-
});
|
|
116
|
-
return RouterNavigation;
|
|
117
|
-
}());
|
|
118
|
-
if (false) {
|
|
119
|
-
/** @type {?} */
|
|
120
|
-
RouterNavigation.prototype.routerState;
|
|
121
|
-
/** @type {?} */
|
|
122
|
-
RouterNavigation.prototype.event;
|
|
123
|
-
/** @type {?} */
|
|
124
|
-
RouterNavigation.prototype.trigger;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* An action dispatched when the router cancel navigation.
|
|
128
|
-
* @template T, V
|
|
129
|
-
*/
|
|
130
|
-
var /**
|
|
131
|
-
* An action dispatched when the router cancel navigation.
|
|
132
|
-
* @template T, V
|
|
133
|
-
*/
|
|
134
|
-
RouterCancel = /** @class */ (function () {
|
|
135
|
-
function RouterCancel(routerState, storeState, event, trigger) {
|
|
136
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
137
|
-
this.routerState = routerState;
|
|
138
|
-
this.storeState = storeState;
|
|
139
|
-
this.event = event;
|
|
140
|
-
this.trigger = trigger;
|
|
141
|
-
}
|
|
142
|
-
Object.defineProperty(RouterCancel, "type", {
|
|
143
|
-
get: /**
|
|
144
|
-
* @return {?}
|
|
145
|
-
*/
|
|
146
|
-
function () {
|
|
147
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
148
|
-
return '[Router] RouterCancel';
|
|
149
|
-
},
|
|
150
|
-
enumerable: true,
|
|
151
|
-
configurable: true
|
|
152
|
-
});
|
|
153
|
-
return RouterCancel;
|
|
154
|
-
}());
|
|
155
|
-
if (false) {
|
|
156
|
-
/** @type {?} */
|
|
157
|
-
RouterCancel.prototype.routerState;
|
|
158
|
-
/** @type {?} */
|
|
159
|
-
RouterCancel.prototype.storeState;
|
|
160
|
-
/** @type {?} */
|
|
161
|
-
RouterCancel.prototype.event;
|
|
162
|
-
/** @type {?} */
|
|
163
|
-
RouterCancel.prototype.trigger;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* An action dispatched when the router errors.
|
|
167
|
-
* @template T, V
|
|
168
|
-
*/
|
|
169
|
-
var /**
|
|
170
|
-
* An action dispatched when the router errors.
|
|
171
|
-
* @template T, V
|
|
172
|
-
*/
|
|
173
|
-
RouterError = /** @class */ (function () {
|
|
174
|
-
function RouterError(routerState, storeState, event, trigger) {
|
|
175
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
176
|
-
this.routerState = routerState;
|
|
177
|
-
this.storeState = storeState;
|
|
178
|
-
this.event = event;
|
|
179
|
-
this.trigger = trigger;
|
|
180
|
-
}
|
|
181
|
-
Object.defineProperty(RouterError, "type", {
|
|
182
|
-
get: /**
|
|
183
|
-
* @return {?}
|
|
184
|
-
*/
|
|
185
|
-
function () {
|
|
186
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
187
|
-
return '[Router] RouterError';
|
|
188
|
-
},
|
|
189
|
-
enumerable: true,
|
|
190
|
-
configurable: true
|
|
191
|
-
});
|
|
192
|
-
return RouterError;
|
|
193
|
-
}());
|
|
194
|
-
if (false) {
|
|
195
|
-
/** @type {?} */
|
|
196
|
-
RouterError.prototype.routerState;
|
|
197
|
-
/** @type {?} */
|
|
198
|
-
RouterError.prototype.storeState;
|
|
199
|
-
/** @type {?} */
|
|
200
|
-
RouterError.prototype.event;
|
|
201
|
-
/** @type {?} */
|
|
202
|
-
RouterError.prototype.trigger;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
206
|
-
* @template T
|
|
207
|
-
*/
|
|
208
|
-
var /**
|
|
209
|
-
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
210
|
-
* @template T
|
|
211
|
-
*/
|
|
212
|
-
RouterDataResolved = /** @class */ (function () {
|
|
213
|
-
function RouterDataResolved(routerState, event, trigger) {
|
|
214
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
215
|
-
this.routerState = routerState;
|
|
216
|
-
this.event = event;
|
|
217
|
-
this.trigger = trigger;
|
|
218
|
-
}
|
|
219
|
-
Object.defineProperty(RouterDataResolved, "type", {
|
|
220
|
-
get: /**
|
|
221
|
-
* @return {?}
|
|
222
|
-
*/
|
|
223
|
-
function () {
|
|
224
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
225
|
-
return '[Router] RouterDataResolved';
|
|
226
|
-
},
|
|
227
|
-
enumerable: true,
|
|
228
|
-
configurable: true
|
|
229
|
-
});
|
|
230
|
-
return RouterDataResolved;
|
|
231
|
-
}());
|
|
232
|
-
if (false) {
|
|
233
|
-
/** @type {?} */
|
|
234
|
-
RouterDataResolved.prototype.routerState;
|
|
235
|
-
/** @type {?} */
|
|
236
|
-
RouterDataResolved.prototype.event;
|
|
237
|
-
/** @type {?} */
|
|
238
|
-
RouterDataResolved.prototype.trigger;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* An action dispatched when the router navigation has been finished successfully.
|
|
242
|
-
* @template T
|
|
243
|
-
*/
|
|
244
|
-
var /**
|
|
245
|
-
* An action dispatched when the router navigation has been finished successfully.
|
|
246
|
-
* @template T
|
|
247
|
-
*/
|
|
248
|
-
RouterNavigated = /** @class */ (function () {
|
|
249
|
-
function RouterNavigated(routerState, event, trigger) {
|
|
250
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
251
|
-
this.routerState = routerState;
|
|
252
|
-
this.event = event;
|
|
253
|
-
this.trigger = trigger;
|
|
254
|
-
}
|
|
255
|
-
Object.defineProperty(RouterNavigated, "type", {
|
|
256
|
-
get: /**
|
|
257
|
-
* @return {?}
|
|
258
|
-
*/
|
|
259
|
-
function () {
|
|
260
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
261
|
-
return '[Router] RouterNavigated';
|
|
262
|
-
},
|
|
263
|
-
enumerable: true,
|
|
264
|
-
configurable: true
|
|
265
|
-
});
|
|
266
|
-
return RouterNavigated;
|
|
267
|
-
}());
|
|
268
|
-
if (false) {
|
|
269
|
-
/** @type {?} */
|
|
270
|
-
RouterNavigated.prototype.routerState;
|
|
271
|
-
/** @type {?} */
|
|
272
|
-
RouterNavigated.prototype.event;
|
|
273
|
-
/** @type {?} */
|
|
274
|
-
RouterNavigated.prototype.trigger;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* @fileoverview added by tsickle
|
|
279
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
280
|
-
*/
|
|
281
|
-
/**
|
|
282
|
-
* @abstract
|
|
283
|
-
* @template T
|
|
284
|
-
*/
|
|
285
|
-
var /**
|
|
286
|
-
* @abstract
|
|
287
|
-
* @template T
|
|
288
|
-
*/
|
|
289
|
-
RouterStateSerializer = /** @class */ (function () {
|
|
290
|
-
function RouterStateSerializer() {
|
|
291
|
-
}
|
|
292
|
-
return RouterStateSerializer;
|
|
293
|
-
}());
|
|
294
|
-
if (false) {
|
|
295
|
-
/**
|
|
296
|
-
* @abstract
|
|
297
|
-
* @param {?} routerState
|
|
298
|
-
* @return {?}
|
|
299
|
-
*/
|
|
300
|
-
RouterStateSerializer.prototype.serialize = function (routerState) { };
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* @record
|
|
304
|
-
*/
|
|
305
|
-
function SerializedRouterStateSnapshot() { }
|
|
306
|
-
if (false) {
|
|
307
|
-
/** @type {?} */
|
|
308
|
-
SerializedRouterStateSnapshot.prototype.root;
|
|
309
|
-
/** @type {?} */
|
|
310
|
-
SerializedRouterStateSnapshot.prototype.url;
|
|
311
|
-
}
|
|
312
|
-
var DefaultRouterStateSerializer = /** @class */ (function () {
|
|
313
|
-
function DefaultRouterStateSerializer() {
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* @param {?} routerState
|
|
317
|
-
* @return {?}
|
|
318
|
-
*/
|
|
319
|
-
DefaultRouterStateSerializer.prototype.serialize = /**
|
|
320
|
-
* @param {?} routerState
|
|
321
|
-
* @return {?}
|
|
322
|
-
*/
|
|
323
|
-
function (routerState) {
|
|
324
|
-
return {
|
|
325
|
-
root: this.serializeRoute(routerState.root),
|
|
326
|
-
url: routerState.url
|
|
327
|
-
};
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* @private
|
|
331
|
-
* @param {?} route
|
|
332
|
-
* @return {?}
|
|
333
|
-
*/
|
|
334
|
-
DefaultRouterStateSerializer.prototype.serializeRoute = /**
|
|
335
|
-
* @private
|
|
336
|
-
* @param {?} route
|
|
337
|
-
* @return {?}
|
|
338
|
-
*/
|
|
339
|
-
function (route) {
|
|
340
|
-
var _this = this;
|
|
341
|
-
/** @type {?} */
|
|
342
|
-
var children = route.children.map((/**
|
|
343
|
-
* @param {?} c
|
|
344
|
-
* @return {?}
|
|
345
|
-
*/
|
|
346
|
-
function (c) { return _this.serializeRoute(c); }));
|
|
347
|
-
return {
|
|
348
|
-
url: route.url,
|
|
349
|
-
params: route.params,
|
|
350
|
-
queryParams: route.queryParams,
|
|
351
|
-
fragment: route.fragment,
|
|
352
|
-
data: route.data,
|
|
353
|
-
outlet: route.outlet,
|
|
354
|
-
component: null,
|
|
355
|
-
routeConfig: null,
|
|
356
|
-
root: (/** @type {?} */ (null)),
|
|
357
|
-
parent: null,
|
|
358
|
-
firstChild: children[0],
|
|
359
|
-
children: children,
|
|
360
|
-
pathFromRoot: (/** @type {?} */ (null)),
|
|
361
|
-
paramMap: route.paramMap,
|
|
362
|
-
queryParamMap: route.queryParamMap,
|
|
363
|
-
toString: route.toString
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
return DefaultRouterStateSerializer;
|
|
367
|
-
}());
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* @fileoverview added by tsickle
|
|
371
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
372
|
-
*/
|
|
373
|
-
/** @enum {number} */
|
|
374
|
-
var NavigationActionTiming = {
|
|
375
|
-
PreActivation: 1,
|
|
376
|
-
PostActivation: 2,
|
|
377
|
-
};
|
|
378
|
-
/**
|
|
379
|
-
* @record
|
|
380
|
-
*/
|
|
381
|
-
function NgxsRouterPluginOptions() { }
|
|
382
|
-
if (false) {
|
|
383
|
-
/** @type {?|undefined} */
|
|
384
|
-
NgxsRouterPluginOptions.prototype.navigationActionTiming;
|
|
385
|
-
}
|
|
386
|
-
/** @type {?} */
|
|
387
|
-
var USER_OPTIONS = new InjectionToken('USER_OPTIONS', { providedIn: 'root', factory: (/**
|
|
388
|
-
* @return {?}
|
|
389
|
-
*/
|
|
390
|
-
function () { return undefined; }) });
|
|
391
|
-
/** @type {?} */
|
|
392
|
-
var NGXS_ROUTER_PLUGIN_OPTIONS = new InjectionToken('NGXS_ROUTER_PLUGIN_OPTIONS', { providedIn: 'root', factory: (/**
|
|
393
|
-
* @return {?}
|
|
394
|
-
*/
|
|
395
|
-
function () { return ({}); }) });
|
|
396
|
-
/**
|
|
397
|
-
* @param {?} options
|
|
398
|
-
* @return {?}
|
|
399
|
-
*/
|
|
400
|
-
function createRouterPluginOptions(options) {
|
|
401
|
-
return {
|
|
402
|
-
navigationActionTiming: (options && options.navigationActionTiming) || 1 /* PreActivation */
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* @fileoverview added by tsickle
|
|
408
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
409
|
-
*/
|
|
410
|
-
/**
|
|
411
|
-
* @record
|
|
412
|
-
* @template T
|
|
413
|
-
*/
|
|
414
|
-
function RouterStateModel() { }
|
|
415
|
-
if (false) {
|
|
416
|
-
/** @type {?|undefined} */
|
|
417
|
-
RouterStateModel.prototype.state;
|
|
418
|
-
/** @type {?|undefined} */
|
|
419
|
-
RouterStateModel.prototype.navigationId;
|
|
420
|
-
/** @type {?} */
|
|
421
|
-
RouterStateModel.prototype.trigger;
|
|
422
|
-
}
|
|
423
|
-
var RouterState = /** @class */ (function () {
|
|
424
|
-
function RouterState(_store, _router, _serializer, _ngZone, injector) {
|
|
425
|
-
this._store = _store;
|
|
426
|
-
this._router = _router;
|
|
427
|
-
this._serializer = _serializer;
|
|
428
|
-
this._ngZone = _ngZone;
|
|
429
|
-
/**
|
|
430
|
-
* Determines how navigation was performed by the `RouterState` itself
|
|
431
|
-
* or outside via `new Navigate(...)`
|
|
432
|
-
*/
|
|
433
|
-
this._trigger = 'none';
|
|
434
|
-
/**
|
|
435
|
-
* That's the serialized state from the `Router` class
|
|
436
|
-
*/
|
|
437
|
-
this._routerState = null;
|
|
438
|
-
/**
|
|
439
|
-
* That's the value of the `RouterState` state
|
|
440
|
-
*/
|
|
441
|
-
this._storeState = null;
|
|
442
|
-
this._lastEvent = null;
|
|
443
|
-
this._subscription = new Subscription();
|
|
444
|
-
this._options = null;
|
|
445
|
-
// Note: do not use `@Inject` since it fails on lower versions of Angular with Jest
|
|
446
|
-
// integration, it cannot resolve the token provider.
|
|
447
|
-
this._options = injector.get(NGXS_ROUTER_PLUGIN_OPTIONS, null);
|
|
448
|
-
this._setUpStoreListener();
|
|
449
|
-
this._setUpRouterEventsListener();
|
|
450
|
-
}
|
|
451
|
-
RouterState_1 = RouterState;
|
|
452
|
-
/**
|
|
453
|
-
* @template T
|
|
454
|
-
* @param {?} state
|
|
455
|
-
* @return {?}
|
|
456
|
-
*/
|
|
457
|
-
RouterState.state = /**
|
|
458
|
-
* @template T
|
|
459
|
-
* @param {?} state
|
|
460
|
-
* @return {?}
|
|
461
|
-
*/
|
|
462
|
-
function (state) {
|
|
463
|
-
return state && state.state;
|
|
464
|
-
};
|
|
465
|
-
/**
|
|
466
|
-
* @param {?} state
|
|
467
|
-
* @return {?}
|
|
468
|
-
*/
|
|
469
|
-
RouterState.url = /**
|
|
470
|
-
* @param {?} state
|
|
471
|
-
* @return {?}
|
|
472
|
-
*/
|
|
473
|
-
function (state) {
|
|
474
|
-
return state && state.state && state.state.url;
|
|
475
|
-
};
|
|
476
|
-
/**
|
|
477
|
-
* @return {?}
|
|
478
|
-
*/
|
|
479
|
-
RouterState.prototype.ngOnDestroy = /**
|
|
480
|
-
* @return {?}
|
|
481
|
-
*/
|
|
482
|
-
function () {
|
|
483
|
-
this._subscription.unsubscribe();
|
|
484
|
-
};
|
|
485
|
-
/**
|
|
486
|
-
* @param {?} _
|
|
487
|
-
* @param {?} action
|
|
488
|
-
* @return {?}
|
|
489
|
-
*/
|
|
490
|
-
RouterState.prototype.navigate = /**
|
|
491
|
-
* @param {?} _
|
|
492
|
-
* @param {?} action
|
|
493
|
-
* @return {?}
|
|
494
|
-
*/
|
|
495
|
-
function (_, action) {
|
|
496
|
-
var _this = this;
|
|
497
|
-
return this._ngZone.run((/**
|
|
498
|
-
* @return {?}
|
|
499
|
-
*/
|
|
500
|
-
function () {
|
|
501
|
-
return _this._router.navigate(action.path, __assign({ queryParams: action.queryParams }, action.extras));
|
|
502
|
-
}));
|
|
503
|
-
};
|
|
504
|
-
/**
|
|
505
|
-
* @param {?} ctx
|
|
506
|
-
* @param {?} action
|
|
507
|
-
* @return {?}
|
|
508
|
-
*/
|
|
509
|
-
RouterState.prototype.angularRouterAction = /**
|
|
510
|
-
* @param {?} ctx
|
|
511
|
-
* @param {?} action
|
|
512
|
-
* @return {?}
|
|
513
|
-
*/
|
|
514
|
-
function (ctx, action) {
|
|
515
|
-
ctx.setState({
|
|
516
|
-
trigger: action.trigger,
|
|
517
|
-
state: action.routerState,
|
|
518
|
-
navigationId: action.event.id
|
|
519
|
-
});
|
|
520
|
-
};
|
|
521
|
-
/**
|
|
522
|
-
* @private
|
|
523
|
-
* @return {?}
|
|
524
|
-
*/
|
|
525
|
-
RouterState.prototype._setUpStoreListener = /**
|
|
526
|
-
* @private
|
|
527
|
-
* @return {?}
|
|
528
|
-
*/
|
|
529
|
-
function () {
|
|
530
|
-
var _this = this;
|
|
531
|
-
/** @type {?} */
|
|
532
|
-
var subscription = this._store
|
|
533
|
-
.select(RouterState_1)
|
|
534
|
-
.subscribe((/**
|
|
535
|
-
* @param {?} state
|
|
536
|
-
* @return {?}
|
|
537
|
-
*/
|
|
538
|
-
function (state) {
|
|
539
|
-
_this._navigateIfNeeded(state);
|
|
540
|
-
}));
|
|
541
|
-
this._subscription.add(subscription);
|
|
542
|
-
};
|
|
543
|
-
/**
|
|
544
|
-
* @private
|
|
545
|
-
* @param {?} routerState
|
|
546
|
-
* @return {?}
|
|
547
|
-
*/
|
|
548
|
-
RouterState.prototype._navigateIfNeeded = /**
|
|
549
|
-
* @private
|
|
550
|
-
* @param {?} routerState
|
|
551
|
-
* @return {?}
|
|
552
|
-
*/
|
|
553
|
-
function (routerState) {
|
|
554
|
-
var _this = this;
|
|
555
|
-
if (routerState && routerState.trigger === 'devtools') {
|
|
556
|
-
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
557
|
-
}
|
|
558
|
-
/** @type {?} */
|
|
559
|
-
var canSkipNavigation = !this._storeState ||
|
|
560
|
-
!this._storeState.state ||
|
|
561
|
-
!routerState ||
|
|
562
|
-
routerState.trigger === 'router' ||
|
|
563
|
-
this._router.url === this._storeState.state.url ||
|
|
564
|
-
this._lastEvent instanceof NavigationStart;
|
|
565
|
-
if (canSkipNavigation) {
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
569
|
-
this._trigger = 'store';
|
|
570
|
-
this._ngZone.run((/**
|
|
571
|
-
* @return {?}
|
|
572
|
-
*/
|
|
573
|
-
function () { return _this._router.navigateByUrl((/** @type {?} */ ((/** @type {?} */ (_this._storeState)).state)).url); }));
|
|
574
|
-
};
|
|
575
|
-
/**
|
|
576
|
-
* @private
|
|
577
|
-
* @return {?}
|
|
578
|
-
*/
|
|
579
|
-
RouterState.prototype._setUpRouterEventsListener = /**
|
|
580
|
-
* @private
|
|
581
|
-
* @return {?}
|
|
582
|
-
*/
|
|
583
|
-
function () {
|
|
584
|
-
var _this = this;
|
|
585
|
-
/** @type {?} */
|
|
586
|
-
var dispatchRouterNavigationLate = this._options != null &&
|
|
587
|
-
this._options.navigationActionTiming === 2 /* PostActivation */;
|
|
588
|
-
/** @type {?} */
|
|
589
|
-
var lastRoutesRecognized;
|
|
590
|
-
/** @type {?} */
|
|
591
|
-
var subscription = this._router.events.subscribe((/**
|
|
592
|
-
* @param {?} event
|
|
593
|
-
* @return {?}
|
|
594
|
-
*/
|
|
595
|
-
function (event) {
|
|
596
|
-
_this._lastEvent = event;
|
|
597
|
-
if (event instanceof NavigationStart) {
|
|
598
|
-
_this._navigationStart(event);
|
|
599
|
-
}
|
|
600
|
-
else if (event instanceof RoutesRecognized) {
|
|
601
|
-
lastRoutesRecognized = event;
|
|
602
|
-
if (!dispatchRouterNavigationLate && _this._trigger !== 'store') {
|
|
603
|
-
_this._dispatchRouterNavigation(lastRoutesRecognized);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
else if (event instanceof ResolveEnd) {
|
|
607
|
-
_this._dispatchRouterDataResolved(event);
|
|
608
|
-
}
|
|
609
|
-
else if (event instanceof NavigationCancel) {
|
|
610
|
-
_this._dispatchRouterCancel(event);
|
|
611
|
-
_this._reset();
|
|
612
|
-
}
|
|
613
|
-
else if (event instanceof NavigationError) {
|
|
614
|
-
_this._dispatchRouterError(event);
|
|
615
|
-
_this._reset();
|
|
616
|
-
}
|
|
617
|
-
else if (event instanceof NavigationEnd) {
|
|
618
|
-
if (_this._trigger !== 'store') {
|
|
619
|
-
if (dispatchRouterNavigationLate) {
|
|
620
|
-
_this._dispatchRouterNavigation(lastRoutesRecognized);
|
|
621
|
-
}
|
|
622
|
-
_this._dispatchRouterNavigated(event);
|
|
623
|
-
}
|
|
624
|
-
_this._reset();
|
|
625
|
-
}
|
|
626
|
-
}));
|
|
627
|
-
this._subscription.add(subscription);
|
|
628
|
-
};
|
|
629
|
-
/** Reacts to `NavigationStart`. */
|
|
630
|
-
/**
|
|
631
|
-
* Reacts to `NavigationStart`.
|
|
632
|
-
* @private
|
|
633
|
-
* @param {?} event
|
|
634
|
-
* @return {?}
|
|
635
|
-
*/
|
|
636
|
-
RouterState.prototype._navigationStart = /**
|
|
637
|
-
* Reacts to `NavigationStart`.
|
|
638
|
-
* @private
|
|
639
|
-
* @param {?} event
|
|
640
|
-
* @return {?}
|
|
641
|
-
*/
|
|
642
|
-
function (event) {
|
|
643
|
-
this._routerState = this._serializer.serialize(this._router.routerState.snapshot);
|
|
644
|
-
if (this._trigger !== 'none') {
|
|
645
|
-
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
646
|
-
this._dispatchRouterAction(new RouterRequest(this._routerState, event, this._trigger));
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
/** Reacts to `ResolveEnd`. */
|
|
650
|
-
/**
|
|
651
|
-
* Reacts to `ResolveEnd`.
|
|
652
|
-
* @private
|
|
653
|
-
* @param {?} event
|
|
654
|
-
* @return {?}
|
|
655
|
-
*/
|
|
656
|
-
RouterState.prototype._dispatchRouterDataResolved = /**
|
|
657
|
-
* Reacts to `ResolveEnd`.
|
|
658
|
-
* @private
|
|
659
|
-
* @param {?} event
|
|
660
|
-
* @return {?}
|
|
661
|
-
*/
|
|
662
|
-
function (event) {
|
|
663
|
-
/** @type {?} */
|
|
664
|
-
var routerState = this._serializer.serialize(event.state);
|
|
665
|
-
this._dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));
|
|
666
|
-
};
|
|
667
|
-
/** Reacts to `RoutesRecognized` or `NavigationEnd`, depends on the `navigationActionTiming`. */
|
|
668
|
-
/**
|
|
669
|
-
* Reacts to `RoutesRecognized` or `NavigationEnd`, depends on the `navigationActionTiming`.
|
|
670
|
-
* @private
|
|
671
|
-
* @param {?} lastRoutesRecognized
|
|
672
|
-
* @return {?}
|
|
673
|
-
*/
|
|
674
|
-
RouterState.prototype._dispatchRouterNavigation = /**
|
|
675
|
-
* Reacts to `RoutesRecognized` or `NavigationEnd`, depends on the `navigationActionTiming`.
|
|
676
|
-
* @private
|
|
677
|
-
* @param {?} lastRoutesRecognized
|
|
678
|
-
* @return {?}
|
|
679
|
-
*/
|
|
680
|
-
function (lastRoutesRecognized) {
|
|
681
|
-
/** @type {?} */
|
|
682
|
-
var nextRouterState = this._serializer.serialize(lastRoutesRecognized.state);
|
|
683
|
-
this._dispatchRouterAction(new RouterNavigation(nextRouterState, new RoutesRecognized(lastRoutesRecognized.id, lastRoutesRecognized.url, lastRoutesRecognized.urlAfterRedirects, nextRouterState), this._trigger));
|
|
684
|
-
};
|
|
685
|
-
/** Reacts to `NavigationCancel`. */
|
|
686
|
-
/**
|
|
687
|
-
* Reacts to `NavigationCancel`.
|
|
688
|
-
* @private
|
|
689
|
-
* @param {?} event
|
|
690
|
-
* @return {?}
|
|
691
|
-
*/
|
|
692
|
-
RouterState.prototype._dispatchRouterCancel = /**
|
|
693
|
-
* Reacts to `NavigationCancel`.
|
|
694
|
-
* @private
|
|
695
|
-
* @param {?} event
|
|
696
|
-
* @return {?}
|
|
697
|
-
*/
|
|
698
|
-
function (event) {
|
|
699
|
-
this._dispatchRouterAction(new RouterCancel((/** @type {?} */ (this._routerState)), this._storeState, event, this._trigger));
|
|
700
|
-
};
|
|
701
|
-
/** Reacts to `NavigationEnd`. */
|
|
702
|
-
/**
|
|
703
|
-
* Reacts to `NavigationEnd`.
|
|
704
|
-
* @private
|
|
705
|
-
* @param {?} event
|
|
706
|
-
* @return {?}
|
|
707
|
-
*/
|
|
708
|
-
RouterState.prototype._dispatchRouterError = /**
|
|
709
|
-
* Reacts to `NavigationEnd`.
|
|
710
|
-
* @private
|
|
711
|
-
* @param {?} event
|
|
712
|
-
* @return {?}
|
|
713
|
-
*/
|
|
714
|
-
function (event) {
|
|
715
|
-
this._dispatchRouterAction(new RouterError((/** @type {?} */ (this._routerState)), this._storeState, new NavigationError(event.id, event.url, "" + event), this._trigger));
|
|
716
|
-
};
|
|
717
|
-
/** Reacts to `NavigationEnd`. */
|
|
718
|
-
/**
|
|
719
|
-
* Reacts to `NavigationEnd`.
|
|
720
|
-
* @private
|
|
721
|
-
* @param {?} event
|
|
722
|
-
* @return {?}
|
|
723
|
-
*/
|
|
724
|
-
RouterState.prototype._dispatchRouterNavigated = /**
|
|
725
|
-
* Reacts to `NavigationEnd`.
|
|
726
|
-
* @private
|
|
727
|
-
* @param {?} event
|
|
728
|
-
* @return {?}
|
|
729
|
-
*/
|
|
730
|
-
function (event) {
|
|
731
|
-
/** @type {?} */
|
|
732
|
-
var routerState = this._serializer.serialize(this._router.routerState.snapshot);
|
|
733
|
-
this._dispatchRouterAction(new RouterNavigated(routerState, event, this._trigger));
|
|
734
|
-
};
|
|
735
|
-
/**
|
|
736
|
-
* @private
|
|
737
|
-
* @template T
|
|
738
|
-
* @param {?} action
|
|
739
|
-
* @return {?}
|
|
740
|
-
*/
|
|
741
|
-
RouterState.prototype._dispatchRouterAction = /**
|
|
742
|
-
* @private
|
|
743
|
-
* @template T
|
|
744
|
-
* @param {?} action
|
|
745
|
-
* @return {?}
|
|
746
|
-
*/
|
|
747
|
-
function (action) {
|
|
748
|
-
this._trigger = 'router';
|
|
749
|
-
try {
|
|
750
|
-
this._store.dispatch(action);
|
|
751
|
-
}
|
|
752
|
-
finally {
|
|
753
|
-
this._trigger = 'none';
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
/**
|
|
757
|
-
* @private
|
|
758
|
-
* @return {?}
|
|
759
|
-
*/
|
|
760
|
-
RouterState.prototype._reset = /**
|
|
761
|
-
* @private
|
|
762
|
-
* @return {?}
|
|
763
|
-
*/
|
|
764
|
-
function () {
|
|
765
|
-
this._trigger = 'none';
|
|
766
|
-
this._storeState = null;
|
|
767
|
-
this._routerState = null;
|
|
768
|
-
};
|
|
769
|
-
var RouterState_1;
|
|
770
|
-
RouterState.ctorParameters = function () { return [
|
|
771
|
-
{ type: Store },
|
|
772
|
-
{ type: Router },
|
|
773
|
-
{ type: RouterStateSerializer },
|
|
774
|
-
{ type: NgZone },
|
|
775
|
-
{ type: Injector }
|
|
776
|
-
]; };
|
|
777
|
-
RouterState.decorators = [
|
|
778
|
-
{ type: Injectable }
|
|
779
|
-
];
|
|
780
|
-
/** @nocollapse */
|
|
781
|
-
RouterState.ctorParameters = function () { return [
|
|
782
|
-
{ type: Store },
|
|
783
|
-
{ type: Router },
|
|
784
|
-
{ type: RouterStateSerializer },
|
|
785
|
-
{ type: NgZone },
|
|
786
|
-
{ type: Injector }
|
|
787
|
-
]; };
|
|
788
|
-
__decorate([
|
|
789
|
-
Action(Navigate),
|
|
790
|
-
__metadata("design:type", Function),
|
|
791
|
-
__metadata("design:paramtypes", [Object, Navigate]),
|
|
792
|
-
__metadata("design:returntype", void 0)
|
|
793
|
-
], RouterState.prototype, "navigate", null);
|
|
794
|
-
__decorate([
|
|
795
|
-
Action([
|
|
796
|
-
RouterRequest,
|
|
797
|
-
RouterNavigation,
|
|
798
|
-
RouterError,
|
|
799
|
-
RouterCancel,
|
|
800
|
-
RouterDataResolved,
|
|
801
|
-
RouterNavigated
|
|
802
|
-
]),
|
|
803
|
-
__metadata("design:type", Function),
|
|
804
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
805
|
-
__metadata("design:returntype", void 0)
|
|
806
|
-
], RouterState.prototype, "angularRouterAction", null);
|
|
807
|
-
__decorate([
|
|
808
|
-
Selector(),
|
|
809
|
-
__metadata("design:type", Function),
|
|
810
|
-
__metadata("design:paramtypes", [Object]),
|
|
811
|
-
__metadata("design:returntype", void 0)
|
|
812
|
-
], RouterState, "state", null);
|
|
813
|
-
__decorate([
|
|
814
|
-
Selector(),
|
|
815
|
-
__metadata("design:type", Function),
|
|
816
|
-
__metadata("design:paramtypes", [Object]),
|
|
817
|
-
__metadata("design:returntype", Object)
|
|
818
|
-
], RouterState, "url", null);
|
|
819
|
-
RouterState = RouterState_1 = __decorate([
|
|
820
|
-
State({
|
|
821
|
-
name: 'router',
|
|
822
|
-
defaults: {
|
|
823
|
-
state: undefined,
|
|
824
|
-
navigationId: undefined,
|
|
825
|
-
trigger: 'none'
|
|
826
|
-
}
|
|
827
|
-
}),
|
|
828
|
-
__metadata("design:paramtypes", [Store,
|
|
829
|
-
Router,
|
|
830
|
-
RouterStateSerializer,
|
|
831
|
-
NgZone,
|
|
832
|
-
Injector])
|
|
833
|
-
], RouterState);
|
|
834
|
-
return RouterState;
|
|
835
|
-
}());
|
|
836
|
-
if (false) {
|
|
837
|
-
/**
|
|
838
|
-
* Determines how navigation was performed by the `RouterState` itself
|
|
839
|
-
* or outside via `new Navigate(...)`
|
|
840
|
-
* @type {?}
|
|
841
|
-
* @private
|
|
842
|
-
*/
|
|
843
|
-
RouterState.prototype._trigger;
|
|
844
|
-
/**
|
|
845
|
-
* That's the serialized state from the `Router` class
|
|
846
|
-
* @type {?}
|
|
847
|
-
* @private
|
|
848
|
-
*/
|
|
849
|
-
RouterState.prototype._routerState;
|
|
850
|
-
/**
|
|
851
|
-
* That's the value of the `RouterState` state
|
|
852
|
-
* @type {?}
|
|
853
|
-
* @private
|
|
854
|
-
*/
|
|
855
|
-
RouterState.prototype._storeState;
|
|
856
|
-
/**
|
|
857
|
-
* @type {?}
|
|
858
|
-
* @private
|
|
859
|
-
*/
|
|
860
|
-
RouterState.prototype._lastEvent;
|
|
861
|
-
/**
|
|
862
|
-
* @type {?}
|
|
863
|
-
* @private
|
|
864
|
-
*/
|
|
865
|
-
RouterState.prototype._subscription;
|
|
866
|
-
/**
|
|
867
|
-
* @type {?}
|
|
868
|
-
* @private
|
|
869
|
-
*/
|
|
870
|
-
RouterState.prototype._options;
|
|
871
|
-
/**
|
|
872
|
-
* @type {?}
|
|
873
|
-
* @private
|
|
874
|
-
*/
|
|
875
|
-
RouterState.prototype._store;
|
|
876
|
-
/**
|
|
877
|
-
* @type {?}
|
|
878
|
-
* @private
|
|
879
|
-
*/
|
|
880
|
-
RouterState.prototype._router;
|
|
881
|
-
/**
|
|
882
|
-
* @type {?}
|
|
883
|
-
* @private
|
|
884
|
-
*/
|
|
885
|
-
RouterState.prototype._serializer;
|
|
886
|
-
/**
|
|
887
|
-
* @type {?}
|
|
888
|
-
* @private
|
|
889
|
-
*/
|
|
890
|
-
RouterState.prototype._ngZone;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* @fileoverview added by tsickle
|
|
895
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
896
|
-
*/
|
|
897
|
-
var NgxsRouterPluginModule = /** @class */ (function () {
|
|
898
|
-
function NgxsRouterPluginModule() {
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* @param {?=} options
|
|
902
|
-
* @return {?}
|
|
903
|
-
*/
|
|
904
|
-
NgxsRouterPluginModule.forRoot = /**
|
|
905
|
-
* @param {?=} options
|
|
906
|
-
* @return {?}
|
|
907
|
-
*/
|
|
908
|
-
function (options) {
|
|
909
|
-
return {
|
|
910
|
-
ngModule: NgxsRouterPluginModule,
|
|
911
|
-
providers: [
|
|
912
|
-
{ provide: USER_OPTIONS, useValue: options },
|
|
913
|
-
{
|
|
914
|
-
provide: NGXS_ROUTER_PLUGIN_OPTIONS,
|
|
915
|
-
useFactory: createRouterPluginOptions,
|
|
916
|
-
deps: [USER_OPTIONS]
|
|
917
|
-
},
|
|
918
|
-
{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }
|
|
919
|
-
]
|
|
920
|
-
};
|
|
921
|
-
};
|
|
922
|
-
NgxsRouterPluginModule.decorators = [
|
|
923
|
-
{ type: NgModule, args: [{
|
|
924
|
-
imports: [NgxsModule.forFeature([RouterState])]
|
|
925
|
-
},] }
|
|
926
|
-
];
|
|
927
|
-
return NgxsRouterPluginModule;
|
|
928
|
-
}());
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* @fileoverview added by tsickle
|
|
932
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
933
|
-
*/
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* @fileoverview added by tsickle
|
|
937
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
938
|
-
*/
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
* @fileoverview added by tsickle
|
|
942
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
943
|
-
*/
|
|
944
|
-
|
|
945
|
-
export { DefaultRouterStateSerializer, Navigate, NgxsRouterPluginModule, RouterCancel, RouterDataResolved, RouterError, RouterNavigated, RouterNavigation, RouterRequest, RouterState, RouterStateSerializer, USER_OPTIONS as ɵb, NGXS_ROUTER_PLUGIN_OPTIONS as ɵc, createRouterPluginOptions as ɵd };
|
|
946
|
-
//# sourceMappingURL=ngxs-router-plugin.js.map
|