@ngxs/router-plugin 3.7.3-dev.master-10b0883 → 3.7.4
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/README.md +4 -4
- package/bundles/ngxs-router-plugin.umd.js +850 -850
- package/bundles/ngxs-router-plugin.umd.js.map +1 -1
- package/bundles/ngxs-router-plugin.umd.min.js.map +1 -1
- package/esm2015/index.js +9 -9
- package/esm2015/ngxs-router-plugin.js +8 -8
- package/esm2015/src/public_api.js +9 -9
- package/esm2015/src/router.actions.js +172 -172
- package/esm2015/src/router.module.js +25 -25
- package/esm2015/src/router.state.js +463 -463
- package/esm2015/src/serializer.js +72 -72
- package/esm5/index.js +9 -9
- package/esm5/ngxs-router-plugin.js +8 -8
- package/esm5/src/public_api.js +9 -9
- package/esm5/src/router.actions.js +227 -227
- package/esm5/src/router.module.js +32 -32
- package/esm5/src/router.state.js +552 -552
- package/esm5/src/serializer.js +98 -98
- package/fesm2015/ngxs-router-plugin.js +714 -714
- package/fesm2015/ngxs-router-plugin.js.map +1 -1
- package/fesm5/ngxs-router-plugin.js +859 -859
- package/fesm5/ngxs-router-plugin.js.map +1 -1
- package/index.d.ts +4 -4
- package/ngxs-router-plugin.d.ts +5 -5
- package/package.json +3 -3
- package/src/public_api.d.ts +4 -4
- package/src/router.actions.d.ts +63 -63
- package/src/router.module.d.ts +4 -4
- package/src/router.state.d.ts +60 -60
- package/src/serializer.d.ts +12 -12
|
@@ -223,862 +223,862 @@
|
|
|
223
223
|
return value;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
/**
|
|
227
|
-
* @fileoverview added by tsickle
|
|
228
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
229
|
-
*/
|
|
230
|
-
/**
|
|
231
|
-
* Public event api of the router
|
|
232
|
-
*/
|
|
233
|
-
var /**
|
|
234
|
-
* Public event api of the router
|
|
235
|
-
*/
|
|
236
|
-
Navigate = /** @class */ (function () {
|
|
237
|
-
function Navigate(path, queryParams, extras) {
|
|
238
|
-
this.path = path;
|
|
239
|
-
this.queryParams = queryParams;
|
|
240
|
-
this.extras = extras;
|
|
241
|
-
}
|
|
242
|
-
Object.defineProperty(Navigate, "type", {
|
|
243
|
-
get: /**
|
|
244
|
-
* @return {?}
|
|
245
|
-
*/
|
|
246
|
-
function () {
|
|
247
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
248
|
-
return '[Router] Navigate';
|
|
249
|
-
},
|
|
250
|
-
enumerable: true,
|
|
251
|
-
configurable: true
|
|
252
|
-
});
|
|
253
|
-
return Navigate;
|
|
254
|
-
}());
|
|
255
|
-
if (false) {
|
|
256
|
-
/** @type {?} */
|
|
257
|
-
Navigate.prototype.path;
|
|
258
|
-
/** @type {?} */
|
|
259
|
-
Navigate.prototype.queryParams;
|
|
260
|
-
/** @type {?} */
|
|
261
|
-
Navigate.prototype.extras;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
*
|
|
265
|
-
* Angular Routers internal state events
|
|
266
|
-
*
|
|
267
|
-
*/
|
|
268
|
-
/**
|
|
269
|
-
* An action dispatched when the router navigates.
|
|
270
|
-
* @template T
|
|
271
|
-
*/
|
|
272
|
-
var /**
|
|
273
|
-
*
|
|
274
|
-
* Angular Routers internal state events
|
|
275
|
-
*
|
|
276
|
-
*/
|
|
277
|
-
/**
|
|
278
|
-
* An action dispatched when the router navigates.
|
|
279
|
-
* @template T
|
|
280
|
-
*/
|
|
281
|
-
RouterNavigation = /** @class */ (function () {
|
|
282
|
-
function RouterNavigation(routerState, event, trigger) {
|
|
283
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
284
|
-
this.routerState = routerState;
|
|
285
|
-
this.event = event;
|
|
286
|
-
this.trigger = trigger;
|
|
287
|
-
}
|
|
288
|
-
Object.defineProperty(RouterNavigation, "type", {
|
|
289
|
-
get: /**
|
|
290
|
-
* @return {?}
|
|
291
|
-
*/
|
|
292
|
-
function () {
|
|
293
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
294
|
-
return '[Router] RouterNavigation';
|
|
295
|
-
},
|
|
296
|
-
enumerable: true,
|
|
297
|
-
configurable: true
|
|
298
|
-
});
|
|
299
|
-
return RouterNavigation;
|
|
300
|
-
}());
|
|
301
|
-
if (false) {
|
|
302
|
-
/** @type {?} */
|
|
303
|
-
RouterNavigation.prototype.routerState;
|
|
304
|
-
/** @type {?} */
|
|
305
|
-
RouterNavigation.prototype.event;
|
|
306
|
-
/** @type {?} */
|
|
307
|
-
RouterNavigation.prototype.trigger;
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* An action dispatched when the router cancel navigation.
|
|
311
|
-
* @template T, V
|
|
312
|
-
*/
|
|
313
|
-
var /**
|
|
314
|
-
* An action dispatched when the router cancel navigation.
|
|
315
|
-
* @template T, V
|
|
316
|
-
*/
|
|
317
|
-
RouterCancel = /** @class */ (function () {
|
|
318
|
-
function RouterCancel(routerState, storeState, event, trigger) {
|
|
319
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
320
|
-
this.routerState = routerState;
|
|
321
|
-
this.storeState = storeState;
|
|
322
|
-
this.event = event;
|
|
323
|
-
this.trigger = trigger;
|
|
324
|
-
}
|
|
325
|
-
Object.defineProperty(RouterCancel, "type", {
|
|
326
|
-
get: /**
|
|
327
|
-
* @return {?}
|
|
328
|
-
*/
|
|
329
|
-
function () {
|
|
330
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
331
|
-
return '[Router] RouterCancel';
|
|
332
|
-
},
|
|
333
|
-
enumerable: true,
|
|
334
|
-
configurable: true
|
|
335
|
-
});
|
|
336
|
-
return RouterCancel;
|
|
337
|
-
}());
|
|
338
|
-
if (false) {
|
|
339
|
-
/** @type {?} */
|
|
340
|
-
RouterCancel.prototype.routerState;
|
|
341
|
-
/** @type {?} */
|
|
342
|
-
RouterCancel.prototype.storeState;
|
|
343
|
-
/** @type {?} */
|
|
344
|
-
RouterCancel.prototype.event;
|
|
345
|
-
/** @type {?} */
|
|
346
|
-
RouterCancel.prototype.trigger;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* An action dispatched when the router errors.
|
|
350
|
-
* @template T, V
|
|
351
|
-
*/
|
|
352
|
-
var /**
|
|
353
|
-
* An action dispatched when the router errors.
|
|
354
|
-
* @template T, V
|
|
355
|
-
*/
|
|
356
|
-
RouterError = /** @class */ (function () {
|
|
357
|
-
function RouterError(routerState, storeState, event, trigger) {
|
|
358
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
359
|
-
this.routerState = routerState;
|
|
360
|
-
this.storeState = storeState;
|
|
361
|
-
this.event = event;
|
|
362
|
-
this.trigger = trigger;
|
|
363
|
-
}
|
|
364
|
-
Object.defineProperty(RouterError, "type", {
|
|
365
|
-
get: /**
|
|
366
|
-
* @return {?}
|
|
367
|
-
*/
|
|
368
|
-
function () {
|
|
369
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
370
|
-
return '[Router] RouterError';
|
|
371
|
-
},
|
|
372
|
-
enumerable: true,
|
|
373
|
-
configurable: true
|
|
374
|
-
});
|
|
375
|
-
return RouterError;
|
|
376
|
-
}());
|
|
377
|
-
if (false) {
|
|
378
|
-
/** @type {?} */
|
|
379
|
-
RouterError.prototype.routerState;
|
|
380
|
-
/** @type {?} */
|
|
381
|
-
RouterError.prototype.storeState;
|
|
382
|
-
/** @type {?} */
|
|
383
|
-
RouterError.prototype.event;
|
|
384
|
-
/** @type {?} */
|
|
385
|
-
RouterError.prototype.trigger;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
389
|
-
* @template T
|
|
390
|
-
*/
|
|
391
|
-
var /**
|
|
392
|
-
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
393
|
-
* @template T
|
|
394
|
-
*/
|
|
395
|
-
RouterDataResolved = /** @class */ (function () {
|
|
396
|
-
function RouterDataResolved(routerState, event, trigger) {
|
|
397
|
-
if (trigger === void 0) { trigger = 'none'; }
|
|
398
|
-
this.routerState = routerState;
|
|
399
|
-
this.event = event;
|
|
400
|
-
this.trigger = trigger;
|
|
401
|
-
}
|
|
402
|
-
Object.defineProperty(RouterDataResolved, "type", {
|
|
403
|
-
get: /**
|
|
404
|
-
* @return {?}
|
|
405
|
-
*/
|
|
406
|
-
function () {
|
|
407
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
408
|
-
return '[Router] RouterDataResolved';
|
|
409
|
-
},
|
|
410
|
-
enumerable: true,
|
|
411
|
-
configurable: true
|
|
412
|
-
});
|
|
413
|
-
return RouterDataResolved;
|
|
414
|
-
}());
|
|
415
|
-
if (false) {
|
|
416
|
-
/** @type {?} */
|
|
417
|
-
RouterDataResolved.prototype.routerState;
|
|
418
|
-
/** @type {?} */
|
|
419
|
-
RouterDataResolved.prototype.event;
|
|
420
|
-
/** @type {?} */
|
|
421
|
-
RouterDataResolved.prototype.trigger;
|
|
226
|
+
/**
|
|
227
|
+
* @fileoverview added by tsickle
|
|
228
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
229
|
+
*/
|
|
230
|
+
/**
|
|
231
|
+
* Public event api of the router
|
|
232
|
+
*/
|
|
233
|
+
var /**
|
|
234
|
+
* Public event api of the router
|
|
235
|
+
*/
|
|
236
|
+
Navigate = /** @class */ (function () {
|
|
237
|
+
function Navigate(path, queryParams, extras) {
|
|
238
|
+
this.path = path;
|
|
239
|
+
this.queryParams = queryParams;
|
|
240
|
+
this.extras = extras;
|
|
241
|
+
}
|
|
242
|
+
Object.defineProperty(Navigate, "type", {
|
|
243
|
+
get: /**
|
|
244
|
+
* @return {?}
|
|
245
|
+
*/
|
|
246
|
+
function () {
|
|
247
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
248
|
+
return '[Router] Navigate';
|
|
249
|
+
},
|
|
250
|
+
enumerable: true,
|
|
251
|
+
configurable: true
|
|
252
|
+
});
|
|
253
|
+
return Navigate;
|
|
254
|
+
}());
|
|
255
|
+
if (false) {
|
|
256
|
+
/** @type {?} */
|
|
257
|
+
Navigate.prototype.path;
|
|
258
|
+
/** @type {?} */
|
|
259
|
+
Navigate.prototype.queryParams;
|
|
260
|
+
/** @type {?} */
|
|
261
|
+
Navigate.prototype.extras;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
*
|
|
265
|
+
* Angular Routers internal state events
|
|
266
|
+
*
|
|
267
|
+
*/
|
|
268
|
+
/**
|
|
269
|
+
* An action dispatched when the router navigates.
|
|
270
|
+
* @template T
|
|
271
|
+
*/
|
|
272
|
+
var /**
|
|
273
|
+
*
|
|
274
|
+
* Angular Routers internal state events
|
|
275
|
+
*
|
|
276
|
+
*/
|
|
277
|
+
/**
|
|
278
|
+
* An action dispatched when the router navigates.
|
|
279
|
+
* @template T
|
|
280
|
+
*/
|
|
281
|
+
RouterNavigation = /** @class */ (function () {
|
|
282
|
+
function RouterNavigation(routerState, event, trigger) {
|
|
283
|
+
if (trigger === void 0) { trigger = 'none'; }
|
|
284
|
+
this.routerState = routerState;
|
|
285
|
+
this.event = event;
|
|
286
|
+
this.trigger = trigger;
|
|
287
|
+
}
|
|
288
|
+
Object.defineProperty(RouterNavigation, "type", {
|
|
289
|
+
get: /**
|
|
290
|
+
* @return {?}
|
|
291
|
+
*/
|
|
292
|
+
function () {
|
|
293
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
294
|
+
return '[Router] RouterNavigation';
|
|
295
|
+
},
|
|
296
|
+
enumerable: true,
|
|
297
|
+
configurable: true
|
|
298
|
+
});
|
|
299
|
+
return RouterNavigation;
|
|
300
|
+
}());
|
|
301
|
+
if (false) {
|
|
302
|
+
/** @type {?} */
|
|
303
|
+
RouterNavigation.prototype.routerState;
|
|
304
|
+
/** @type {?} */
|
|
305
|
+
RouterNavigation.prototype.event;
|
|
306
|
+
/** @type {?} */
|
|
307
|
+
RouterNavigation.prototype.trigger;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* An action dispatched when the router cancel navigation.
|
|
311
|
+
* @template T, V
|
|
312
|
+
*/
|
|
313
|
+
var /**
|
|
314
|
+
* An action dispatched when the router cancel navigation.
|
|
315
|
+
* @template T, V
|
|
316
|
+
*/
|
|
317
|
+
RouterCancel = /** @class */ (function () {
|
|
318
|
+
function RouterCancel(routerState, storeState, event, trigger) {
|
|
319
|
+
if (trigger === void 0) { trigger = 'none'; }
|
|
320
|
+
this.routerState = routerState;
|
|
321
|
+
this.storeState = storeState;
|
|
322
|
+
this.event = event;
|
|
323
|
+
this.trigger = trigger;
|
|
324
|
+
}
|
|
325
|
+
Object.defineProperty(RouterCancel, "type", {
|
|
326
|
+
get: /**
|
|
327
|
+
* @return {?}
|
|
328
|
+
*/
|
|
329
|
+
function () {
|
|
330
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
331
|
+
return '[Router] RouterCancel';
|
|
332
|
+
},
|
|
333
|
+
enumerable: true,
|
|
334
|
+
configurable: true
|
|
335
|
+
});
|
|
336
|
+
return RouterCancel;
|
|
337
|
+
}());
|
|
338
|
+
if (false) {
|
|
339
|
+
/** @type {?} */
|
|
340
|
+
RouterCancel.prototype.routerState;
|
|
341
|
+
/** @type {?} */
|
|
342
|
+
RouterCancel.prototype.storeState;
|
|
343
|
+
/** @type {?} */
|
|
344
|
+
RouterCancel.prototype.event;
|
|
345
|
+
/** @type {?} */
|
|
346
|
+
RouterCancel.prototype.trigger;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* An action dispatched when the router errors.
|
|
350
|
+
* @template T, V
|
|
351
|
+
*/
|
|
352
|
+
var /**
|
|
353
|
+
* An action dispatched when the router errors.
|
|
354
|
+
* @template T, V
|
|
355
|
+
*/
|
|
356
|
+
RouterError = /** @class */ (function () {
|
|
357
|
+
function RouterError(routerState, storeState, event, trigger) {
|
|
358
|
+
if (trigger === void 0) { trigger = 'none'; }
|
|
359
|
+
this.routerState = routerState;
|
|
360
|
+
this.storeState = storeState;
|
|
361
|
+
this.event = event;
|
|
362
|
+
this.trigger = trigger;
|
|
363
|
+
}
|
|
364
|
+
Object.defineProperty(RouterError, "type", {
|
|
365
|
+
get: /**
|
|
366
|
+
* @return {?}
|
|
367
|
+
*/
|
|
368
|
+
function () {
|
|
369
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
370
|
+
return '[Router] RouterError';
|
|
371
|
+
},
|
|
372
|
+
enumerable: true,
|
|
373
|
+
configurable: true
|
|
374
|
+
});
|
|
375
|
+
return RouterError;
|
|
376
|
+
}());
|
|
377
|
+
if (false) {
|
|
378
|
+
/** @type {?} */
|
|
379
|
+
RouterError.prototype.routerState;
|
|
380
|
+
/** @type {?} */
|
|
381
|
+
RouterError.prototype.storeState;
|
|
382
|
+
/** @type {?} */
|
|
383
|
+
RouterError.prototype.event;
|
|
384
|
+
/** @type {?} */
|
|
385
|
+
RouterError.prototype.trigger;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
389
|
+
* @template T
|
|
390
|
+
*/
|
|
391
|
+
var /**
|
|
392
|
+
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
393
|
+
* @template T
|
|
394
|
+
*/
|
|
395
|
+
RouterDataResolved = /** @class */ (function () {
|
|
396
|
+
function RouterDataResolved(routerState, event, trigger) {
|
|
397
|
+
if (trigger === void 0) { trigger = 'none'; }
|
|
398
|
+
this.routerState = routerState;
|
|
399
|
+
this.event = event;
|
|
400
|
+
this.trigger = trigger;
|
|
401
|
+
}
|
|
402
|
+
Object.defineProperty(RouterDataResolved, "type", {
|
|
403
|
+
get: /**
|
|
404
|
+
* @return {?}
|
|
405
|
+
*/
|
|
406
|
+
function () {
|
|
407
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
408
|
+
return '[Router] RouterDataResolved';
|
|
409
|
+
},
|
|
410
|
+
enumerable: true,
|
|
411
|
+
configurable: true
|
|
412
|
+
});
|
|
413
|
+
return RouterDataResolved;
|
|
414
|
+
}());
|
|
415
|
+
if (false) {
|
|
416
|
+
/** @type {?} */
|
|
417
|
+
RouterDataResolved.prototype.routerState;
|
|
418
|
+
/** @type {?} */
|
|
419
|
+
RouterDataResolved.prototype.event;
|
|
420
|
+
/** @type {?} */
|
|
421
|
+
RouterDataResolved.prototype.trigger;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
/**
|
|
425
|
-
* @fileoverview added by tsickle
|
|
426
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
427
|
-
*/
|
|
428
|
-
/**
|
|
429
|
-
* @abstract
|
|
430
|
-
* @template T
|
|
431
|
-
*/
|
|
432
|
-
var /**
|
|
433
|
-
* @abstract
|
|
434
|
-
* @template T
|
|
435
|
-
*/
|
|
436
|
-
RouterStateSerializer = /** @class */ (function () {
|
|
437
|
-
function RouterStateSerializer() {
|
|
438
|
-
}
|
|
439
|
-
return RouterStateSerializer;
|
|
440
|
-
}());
|
|
441
|
-
if (false) {
|
|
442
|
-
/**
|
|
443
|
-
* @abstract
|
|
444
|
-
* @param {?} routerState
|
|
445
|
-
* @return {?}
|
|
446
|
-
*/
|
|
447
|
-
RouterStateSerializer.prototype.serialize = function (routerState) { };
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* @record
|
|
451
|
-
*/
|
|
452
|
-
function SerializedRouterStateSnapshot() { }
|
|
453
|
-
if (false) {
|
|
454
|
-
/** @type {?} */
|
|
455
|
-
SerializedRouterStateSnapshot.prototype.root;
|
|
456
|
-
/** @type {?} */
|
|
457
|
-
SerializedRouterStateSnapshot.prototype.url;
|
|
458
|
-
}
|
|
459
|
-
var DefaultRouterStateSerializer = /** @class */ (function () {
|
|
460
|
-
function DefaultRouterStateSerializer() {
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* @param {?} routerState
|
|
464
|
-
* @return {?}
|
|
465
|
-
*/
|
|
466
|
-
DefaultRouterStateSerializer.prototype.serialize = /**
|
|
467
|
-
* @param {?} routerState
|
|
468
|
-
* @return {?}
|
|
469
|
-
*/
|
|
470
|
-
function (routerState) {
|
|
471
|
-
return {
|
|
472
|
-
root: this.serializeRoute(routerState.root),
|
|
473
|
-
url: routerState.url
|
|
474
|
-
};
|
|
475
|
-
};
|
|
476
|
-
/**
|
|
477
|
-
* @private
|
|
478
|
-
* @param {?} route
|
|
479
|
-
* @return {?}
|
|
480
|
-
*/
|
|
481
|
-
DefaultRouterStateSerializer.prototype.serializeRoute = /**
|
|
482
|
-
* @private
|
|
483
|
-
* @param {?} route
|
|
484
|
-
* @return {?}
|
|
485
|
-
*/
|
|
486
|
-
function (route) {
|
|
487
|
-
var _this = this;
|
|
488
|
-
/** @type {?} */
|
|
489
|
-
var children = route.children.map((/**
|
|
490
|
-
* @param {?} c
|
|
491
|
-
* @return {?}
|
|
492
|
-
*/
|
|
493
|
-
function (c) { return _this.serializeRoute(c); }));
|
|
494
|
-
return {
|
|
495
|
-
url: route.url,
|
|
496
|
-
params: route.params,
|
|
497
|
-
queryParams: route.queryParams,
|
|
498
|
-
fragment: route.fragment,
|
|
499
|
-
data: route.data,
|
|
500
|
-
outlet: route.outlet,
|
|
501
|
-
component: null,
|
|
502
|
-
routeConfig: null,
|
|
503
|
-
root: (/** @type {?} */ (null)),
|
|
504
|
-
parent: null,
|
|
505
|
-
firstChild: children[0],
|
|
506
|
-
children: children,
|
|
507
|
-
pathFromRoot: (/** @type {?} */ (null)),
|
|
508
|
-
paramMap: route.paramMap,
|
|
509
|
-
queryParamMap: route.queryParamMap,
|
|
510
|
-
toString: route.toString
|
|
511
|
-
};
|
|
512
|
-
};
|
|
513
|
-
return DefaultRouterStateSerializer;
|
|
424
|
+
/**
|
|
425
|
+
* @fileoverview added by tsickle
|
|
426
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
427
|
+
*/
|
|
428
|
+
/**
|
|
429
|
+
* @abstract
|
|
430
|
+
* @template T
|
|
431
|
+
*/
|
|
432
|
+
var /**
|
|
433
|
+
* @abstract
|
|
434
|
+
* @template T
|
|
435
|
+
*/
|
|
436
|
+
RouterStateSerializer = /** @class */ (function () {
|
|
437
|
+
function RouterStateSerializer() {
|
|
438
|
+
}
|
|
439
|
+
return RouterStateSerializer;
|
|
440
|
+
}());
|
|
441
|
+
if (false) {
|
|
442
|
+
/**
|
|
443
|
+
* @abstract
|
|
444
|
+
* @param {?} routerState
|
|
445
|
+
* @return {?}
|
|
446
|
+
*/
|
|
447
|
+
RouterStateSerializer.prototype.serialize = function (routerState) { };
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* @record
|
|
451
|
+
*/
|
|
452
|
+
function SerializedRouterStateSnapshot() { }
|
|
453
|
+
if (false) {
|
|
454
|
+
/** @type {?} */
|
|
455
|
+
SerializedRouterStateSnapshot.prototype.root;
|
|
456
|
+
/** @type {?} */
|
|
457
|
+
SerializedRouterStateSnapshot.prototype.url;
|
|
458
|
+
}
|
|
459
|
+
var DefaultRouterStateSerializer = /** @class */ (function () {
|
|
460
|
+
function DefaultRouterStateSerializer() {
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @param {?} routerState
|
|
464
|
+
* @return {?}
|
|
465
|
+
*/
|
|
466
|
+
DefaultRouterStateSerializer.prototype.serialize = /**
|
|
467
|
+
* @param {?} routerState
|
|
468
|
+
* @return {?}
|
|
469
|
+
*/
|
|
470
|
+
function (routerState) {
|
|
471
|
+
return {
|
|
472
|
+
root: this.serializeRoute(routerState.root),
|
|
473
|
+
url: routerState.url
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* @private
|
|
478
|
+
* @param {?} route
|
|
479
|
+
* @return {?}
|
|
480
|
+
*/
|
|
481
|
+
DefaultRouterStateSerializer.prototype.serializeRoute = /**
|
|
482
|
+
* @private
|
|
483
|
+
* @param {?} route
|
|
484
|
+
* @return {?}
|
|
485
|
+
*/
|
|
486
|
+
function (route) {
|
|
487
|
+
var _this = this;
|
|
488
|
+
/** @type {?} */
|
|
489
|
+
var children = route.children.map((/**
|
|
490
|
+
* @param {?} c
|
|
491
|
+
* @return {?}
|
|
492
|
+
*/
|
|
493
|
+
function (c) { return _this.serializeRoute(c); }));
|
|
494
|
+
return {
|
|
495
|
+
url: route.url,
|
|
496
|
+
params: route.params,
|
|
497
|
+
queryParams: route.queryParams,
|
|
498
|
+
fragment: route.fragment,
|
|
499
|
+
data: route.data,
|
|
500
|
+
outlet: route.outlet,
|
|
501
|
+
component: null,
|
|
502
|
+
routeConfig: null,
|
|
503
|
+
root: (/** @type {?} */ (null)),
|
|
504
|
+
parent: null,
|
|
505
|
+
firstChild: children[0],
|
|
506
|
+
children: children,
|
|
507
|
+
pathFromRoot: (/** @type {?} */ (null)),
|
|
508
|
+
paramMap: route.paramMap,
|
|
509
|
+
queryParamMap: route.queryParamMap,
|
|
510
|
+
toString: route.toString
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
return DefaultRouterStateSerializer;
|
|
514
514
|
}());
|
|
515
515
|
|
|
516
|
-
/**
|
|
517
|
-
* @fileoverview added by tsickle
|
|
518
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
519
|
-
*/
|
|
520
|
-
/**
|
|
521
|
-
* @record
|
|
522
|
-
* @template T
|
|
523
|
-
*/
|
|
524
|
-
function RouterStateModel() { }
|
|
525
|
-
if (false) {
|
|
526
|
-
/** @type {?|undefined} */
|
|
527
|
-
RouterStateModel.prototype.state;
|
|
528
|
-
/** @type {?|undefined} */
|
|
529
|
-
RouterStateModel.prototype.navigationId;
|
|
530
|
-
/** @type {?} */
|
|
531
|
-
RouterStateModel.prototype.trigger;
|
|
532
|
-
}
|
|
533
|
-
var RouterState = /** @class */ (function () {
|
|
534
|
-
function RouterState(_store, _router, _serializer, _ngZone, _urlSerializer, _locationStrategy, _location) {
|
|
535
|
-
this._store = _store;
|
|
536
|
-
this._router = _router;
|
|
537
|
-
this._serializer = _serializer;
|
|
538
|
-
this._ngZone = _ngZone;
|
|
539
|
-
this._urlSerializer = _urlSerializer;
|
|
540
|
-
this._locationStrategy = _locationStrategy;
|
|
541
|
-
this._location = _location;
|
|
542
|
-
/**
|
|
543
|
-
* Determines how navigation was performed by the `RouterState` itself
|
|
544
|
-
* or outside via `new Navigate(...)`
|
|
545
|
-
*/
|
|
546
|
-
this._trigger = 'none';
|
|
547
|
-
/**
|
|
548
|
-
* That's the serialized state from the `Router` class
|
|
549
|
-
*/
|
|
550
|
-
this._routerState = null;
|
|
551
|
-
/**
|
|
552
|
-
* That's the value of the `RouterState` state
|
|
553
|
-
*/
|
|
554
|
-
this._storeState = null;
|
|
555
|
-
this._lastRoutesRecognized = (/** @type {?} */ (null));
|
|
556
|
-
this._subscription = new rxjs.Subscription();
|
|
557
|
-
this.setUpStoreListener();
|
|
558
|
-
this.setUpRouterEventsListener();
|
|
559
|
-
this.checkInitialNavigationOnce();
|
|
560
|
-
}
|
|
561
|
-
RouterState_1 = RouterState;
|
|
562
|
-
/**
|
|
563
|
-
* @template T
|
|
564
|
-
* @param {?} state
|
|
565
|
-
* @return {?}
|
|
566
|
-
*/
|
|
567
|
-
RouterState.state = /**
|
|
568
|
-
* @template T
|
|
569
|
-
* @param {?} state
|
|
570
|
-
* @return {?}
|
|
571
|
-
*/
|
|
572
|
-
function (state) {
|
|
573
|
-
return state && state.state;
|
|
574
|
-
};
|
|
575
|
-
/**
|
|
576
|
-
* @param {?} state
|
|
577
|
-
* @return {?}
|
|
578
|
-
*/
|
|
579
|
-
RouterState.url = /**
|
|
580
|
-
* @param {?} state
|
|
581
|
-
* @return {?}
|
|
582
|
-
*/
|
|
583
|
-
function (state) {
|
|
584
|
-
return state && state.state && state.state.url;
|
|
585
|
-
};
|
|
586
|
-
/**
|
|
587
|
-
* @return {?}
|
|
588
|
-
*/
|
|
589
|
-
RouterState.prototype.ngOnDestroy = /**
|
|
590
|
-
* @return {?}
|
|
591
|
-
*/
|
|
592
|
-
function () {
|
|
593
|
-
this._subscription.unsubscribe();
|
|
594
|
-
};
|
|
595
|
-
/**
|
|
596
|
-
* @param {?} _
|
|
597
|
-
* @param {?} action
|
|
598
|
-
* @return {?}
|
|
599
|
-
*/
|
|
600
|
-
RouterState.prototype.navigate = /**
|
|
601
|
-
* @param {?} _
|
|
602
|
-
* @param {?} action
|
|
603
|
-
* @return {?}
|
|
604
|
-
*/
|
|
605
|
-
function (_, action) {
|
|
606
|
-
var _this = this;
|
|
607
|
-
return this._ngZone.run((/**
|
|
608
|
-
* @return {?}
|
|
609
|
-
*/
|
|
610
|
-
function () {
|
|
611
|
-
return _this._router.navigate(action.path, __assign({ queryParams: action.queryParams }, action.extras));
|
|
612
|
-
}));
|
|
613
|
-
};
|
|
614
|
-
/**
|
|
615
|
-
* @param {?} ctx
|
|
616
|
-
* @param {?} action
|
|
617
|
-
* @return {?}
|
|
618
|
-
*/
|
|
619
|
-
RouterState.prototype.angularRouterAction = /**
|
|
620
|
-
* @param {?} ctx
|
|
621
|
-
* @param {?} action
|
|
622
|
-
* @return {?}
|
|
623
|
-
*/
|
|
624
|
-
function (ctx, action) {
|
|
625
|
-
ctx.setState(__assign({}, ctx.getState(), { trigger: action.trigger, state: action.routerState, navigationId: action.event.id }));
|
|
626
|
-
};
|
|
627
|
-
/**
|
|
628
|
-
* @private
|
|
629
|
-
* @return {?}
|
|
630
|
-
*/
|
|
631
|
-
RouterState.prototype.setUpStoreListener = /**
|
|
632
|
-
* @private
|
|
633
|
-
* @return {?}
|
|
634
|
-
*/
|
|
635
|
-
function () {
|
|
636
|
-
var _this = this;
|
|
637
|
-
/** @type {?} */
|
|
638
|
-
var subscription = this._store
|
|
639
|
-
.select(RouterState_1)
|
|
640
|
-
.subscribe((/**
|
|
641
|
-
* @param {?} state
|
|
642
|
-
* @return {?}
|
|
643
|
-
*/
|
|
644
|
-
function (state) {
|
|
645
|
-
_this.navigateIfNeeded(state);
|
|
646
|
-
}));
|
|
647
|
-
this._subscription.add(subscription);
|
|
648
|
-
};
|
|
649
|
-
/**
|
|
650
|
-
* @private
|
|
651
|
-
* @return {?}
|
|
652
|
-
*/
|
|
653
|
-
RouterState.prototype.setUpRouterEventsListener = /**
|
|
654
|
-
* @private
|
|
655
|
-
* @return {?}
|
|
656
|
-
*/
|
|
657
|
-
function () {
|
|
658
|
-
var _this = this;
|
|
659
|
-
/** @type {?} */
|
|
660
|
-
var subscription = this._router.events.subscribe((/**
|
|
661
|
-
* @param {?} event
|
|
662
|
-
* @return {?}
|
|
663
|
-
*/
|
|
664
|
-
function (event) {
|
|
665
|
-
if (event instanceof router.NavigationStart) {
|
|
666
|
-
_this.navigationStart();
|
|
667
|
-
}
|
|
668
|
-
else if (event instanceof router.RoutesRecognized) {
|
|
669
|
-
_this._lastRoutesRecognized = event;
|
|
670
|
-
}
|
|
671
|
-
else if (event instanceof router.ResolveEnd) {
|
|
672
|
-
_this.dispatchRouterDataResolved(event);
|
|
673
|
-
}
|
|
674
|
-
else if (event instanceof router.NavigationCancel) {
|
|
675
|
-
_this.dispatchRouterCancel(event);
|
|
676
|
-
_this.reset();
|
|
677
|
-
}
|
|
678
|
-
else if (event instanceof router.NavigationError) {
|
|
679
|
-
_this.dispatchRouterError(event);
|
|
680
|
-
_this.reset();
|
|
681
|
-
}
|
|
682
|
-
else if (event instanceof router.NavigationEnd) {
|
|
683
|
-
_this.navigationEnd();
|
|
684
|
-
_this.reset();
|
|
685
|
-
}
|
|
686
|
-
}));
|
|
687
|
-
this._subscription.add(subscription);
|
|
688
|
-
};
|
|
689
|
-
/**
|
|
690
|
-
* @private
|
|
691
|
-
* @return {?}
|
|
692
|
-
*/
|
|
693
|
-
RouterState.prototype.navigationStart = /**
|
|
694
|
-
* @private
|
|
695
|
-
* @return {?}
|
|
696
|
-
*/
|
|
697
|
-
function () {
|
|
698
|
-
this._routerState = this._serializer.serialize(this._router.routerState.snapshot);
|
|
699
|
-
if (this._trigger !== 'none') {
|
|
700
|
-
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
/**
|
|
704
|
-
* @private
|
|
705
|
-
* @return {?}
|
|
706
|
-
*/
|
|
707
|
-
RouterState.prototype.navigationEnd = /**
|
|
708
|
-
* @private
|
|
709
|
-
* @return {?}
|
|
710
|
-
*/
|
|
711
|
-
function () {
|
|
712
|
-
if (this.shouldDispatchRouterNavigation()) {
|
|
713
|
-
this.dispatchRouterNavigation();
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
/**
|
|
717
|
-
* @private
|
|
718
|
-
* @return {?}
|
|
719
|
-
*/
|
|
720
|
-
RouterState.prototype.shouldDispatchRouterNavigation = /**
|
|
721
|
-
* @private
|
|
722
|
-
* @return {?}
|
|
723
|
-
*/
|
|
724
|
-
function () {
|
|
725
|
-
if (!this._storeState)
|
|
726
|
-
return true;
|
|
727
|
-
return this._trigger !== 'store';
|
|
728
|
-
};
|
|
729
|
-
/**
|
|
730
|
-
* @private
|
|
731
|
-
* @param {?} state
|
|
732
|
-
* @return {?}
|
|
733
|
-
*/
|
|
734
|
-
RouterState.prototype.navigateIfNeeded = /**
|
|
735
|
-
* @private
|
|
736
|
-
* @param {?} state
|
|
737
|
-
* @return {?}
|
|
738
|
-
*/
|
|
739
|
-
function (state) {
|
|
740
|
-
var _this = this;
|
|
741
|
-
/** @type {?} */
|
|
742
|
-
var canSkipNavigation = !this._storeState ||
|
|
743
|
-
!this._storeState.state ||
|
|
744
|
-
!state ||
|
|
745
|
-
state.trigger === 'router' ||
|
|
746
|
-
this._router.url === this._storeState.state.url;
|
|
747
|
-
if (canSkipNavigation) {
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
this._trigger = 'store';
|
|
751
|
-
this._ngZone.run((/**
|
|
752
|
-
* @return {?}
|
|
753
|
-
*/
|
|
754
|
-
function () {
|
|
755
|
-
_this._router.navigateByUrl((/** @type {?} */ ((/** @type {?} */ (_this._storeState)).state)).url);
|
|
756
|
-
}));
|
|
757
|
-
};
|
|
758
|
-
/**
|
|
759
|
-
* @private
|
|
760
|
-
* @return {?}
|
|
761
|
-
*/
|
|
762
|
-
RouterState.prototype.dispatchRouterNavigation = /**
|
|
763
|
-
* @private
|
|
764
|
-
* @return {?}
|
|
765
|
-
*/
|
|
766
|
-
function () {
|
|
767
|
-
/** @type {?} */
|
|
768
|
-
var nextRouterState = this._serializer.serialize(this._lastRoutesRecognized.state);
|
|
769
|
-
this.dispatchRouterAction(new RouterNavigation(nextRouterState, new router.RoutesRecognized(this._lastRoutesRecognized.id, this._lastRoutesRecognized.url, this._lastRoutesRecognized.urlAfterRedirects, nextRouterState), this._trigger));
|
|
770
|
-
};
|
|
771
|
-
/**
|
|
772
|
-
* @private
|
|
773
|
-
* @param {?} event
|
|
774
|
-
* @return {?}
|
|
775
|
-
*/
|
|
776
|
-
RouterState.prototype.dispatchRouterCancel = /**
|
|
777
|
-
* @private
|
|
778
|
-
* @param {?} event
|
|
779
|
-
* @return {?}
|
|
780
|
-
*/
|
|
781
|
-
function (event) {
|
|
782
|
-
this.dispatchRouterAction(new RouterCancel((/** @type {?} */ (this._routerState)), this._storeState, event, this._trigger));
|
|
783
|
-
};
|
|
784
|
-
/**
|
|
785
|
-
* @private
|
|
786
|
-
* @param {?} event
|
|
787
|
-
* @return {?}
|
|
788
|
-
*/
|
|
789
|
-
RouterState.prototype.dispatchRouterError = /**
|
|
790
|
-
* @private
|
|
791
|
-
* @param {?} event
|
|
792
|
-
* @return {?}
|
|
793
|
-
*/
|
|
794
|
-
function (event) {
|
|
795
|
-
this.dispatchRouterAction(new RouterError((/** @type {?} */ (this._routerState)), this._storeState, new router.NavigationError(event.id, event.url, "" + event), this._trigger));
|
|
796
|
-
};
|
|
797
|
-
/**
|
|
798
|
-
* @private
|
|
799
|
-
* @template T
|
|
800
|
-
* @param {?} action
|
|
801
|
-
* @return {?}
|
|
802
|
-
*/
|
|
803
|
-
RouterState.prototype.dispatchRouterAction = /**
|
|
804
|
-
* @private
|
|
805
|
-
* @template T
|
|
806
|
-
* @param {?} action
|
|
807
|
-
* @return {?}
|
|
808
|
-
*/
|
|
809
|
-
function (action) {
|
|
810
|
-
this._trigger = 'router';
|
|
811
|
-
try {
|
|
812
|
-
this._store.dispatch(action);
|
|
813
|
-
}
|
|
814
|
-
finally {
|
|
815
|
-
this._trigger = 'none';
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
/**
|
|
819
|
-
* @private
|
|
820
|
-
* @param {?} event
|
|
821
|
-
* @return {?}
|
|
822
|
-
*/
|
|
823
|
-
RouterState.prototype.dispatchRouterDataResolved = /**
|
|
824
|
-
* @private
|
|
825
|
-
* @param {?} event
|
|
826
|
-
* @return {?}
|
|
827
|
-
*/
|
|
828
|
-
function (event) {
|
|
829
|
-
/** @type {?} */
|
|
830
|
-
var routerState = this._serializer.serialize(event.state);
|
|
831
|
-
this.dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));
|
|
832
|
-
};
|
|
833
|
-
/**
|
|
834
|
-
* @private
|
|
835
|
-
* @return {?}
|
|
836
|
-
*/
|
|
837
|
-
RouterState.prototype.reset = /**
|
|
838
|
-
* @private
|
|
839
|
-
* @return {?}
|
|
840
|
-
*/
|
|
841
|
-
function () {
|
|
842
|
-
this._trigger = 'none';
|
|
843
|
-
this._storeState = null;
|
|
844
|
-
this._routerState = null;
|
|
845
|
-
};
|
|
846
|
-
/**
|
|
847
|
-
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
848
|
-
* to perform this check only once and unsubscribe after the first event
|
|
849
|
-
* is triggered
|
|
850
|
-
*/
|
|
851
|
-
/**
|
|
852
|
-
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
853
|
-
* to perform this check only once and unsubscribe after the first event
|
|
854
|
-
* is triggered
|
|
855
|
-
* @private
|
|
856
|
-
* @return {?}
|
|
857
|
-
*/
|
|
858
|
-
RouterState.prototype.checkInitialNavigationOnce = /**
|
|
859
|
-
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
860
|
-
* to perform this check only once and unsubscribe after the first event
|
|
861
|
-
* is triggered
|
|
862
|
-
* @private
|
|
863
|
-
* @return {?}
|
|
864
|
-
*/
|
|
865
|
-
function () {
|
|
866
|
-
var _this = this;
|
|
867
|
-
// Caretaker note: we have still left the `typeof` condition in order to avoid
|
|
868
|
-
// creating a breaking change for projects that still use the View Engine.
|
|
869
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
870
|
-
// Angular is running tests in development mode thus we can be sure that this method will be
|
|
871
|
-
// skipped in tests.
|
|
872
|
-
internals.isAngularInTestMode()) {
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
/** @type {?} */
|
|
876
|
-
var subscription = this._router.events
|
|
877
|
-
.pipe(operators.first((/**
|
|
878
|
-
* @param {?} event
|
|
879
|
-
* @return {?}
|
|
880
|
-
*/
|
|
881
|
-
function (event) { return event instanceof router.RoutesRecognized; })))
|
|
882
|
-
.subscribe((/**
|
|
883
|
-
* @param {?} __0
|
|
884
|
-
* @return {?}
|
|
885
|
-
*/
|
|
886
|
-
function (_a) {
|
|
887
|
-
// `location.pathname` always equals manually entered URL in the address bar
|
|
888
|
-
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
889
|
-
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
890
|
-
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
891
|
-
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
892
|
-
var url = _a.url;
|
|
893
|
-
// `location.pathname` always equals manually entered URL in the address bar
|
|
894
|
-
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
895
|
-
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
896
|
-
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
897
|
-
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
898
|
-
// `url` is a recognized URL by the Angular's router, while `currentUrl` is an actual URL
|
|
899
|
-
// entered in the browser's address bar
|
|
900
|
-
// `PathLocationStrategy.prototype.path()` returns a concatenation of
|
|
901
|
-
// `PlatformLocation.pathname` and normalized `PlatformLocation.search`.
|
|
902
|
-
// `Location.prototype.normalize` strips base href from the URL,
|
|
903
|
-
// if `baseHref` (declared in angular.json) for example is `/en`
|
|
904
|
-
// and the URL is `/test#anchor` - then `_locationStrategy.path(true)` will return `/en/test#anchor`,
|
|
905
|
-
// but `/en/test#anchor` is not known to the Angular's router, so we have to strip `/en`
|
|
906
|
-
// from the URL
|
|
907
|
-
/** @type {?} */
|
|
908
|
-
var currentUrl = _this._location.normalize(_this._locationStrategy.path(true));
|
|
909
|
-
/** @type {?} */
|
|
910
|
-
var currentUrlTree = _this._urlSerializer.parse(currentUrl);
|
|
911
|
-
// We need to serialize the URL because in that example `/test/?redirect=https://google.com/`
|
|
912
|
-
// Angular will recognize it as `/test?redirect=https:%2F%2Fwww.google.com%2F`
|
|
913
|
-
// so we have to run the `currentUrl` via the `UrlSerializer` that will encode characters
|
|
914
|
-
/** @type {?} */
|
|
915
|
-
var currentSerializedUrl = _this._urlSerializer.serialize(currentUrlTree);
|
|
916
|
-
// If URLs differ from each other - we've got to perform a redirect to the manually entered URL
|
|
917
|
-
// in the address bar, as it must have a priority
|
|
918
|
-
if (currentSerializedUrl !== url) {
|
|
919
|
-
_this._router.navigateByUrl(currentUrl);
|
|
920
|
-
}
|
|
921
|
-
}));
|
|
922
|
-
this._subscription.add(subscription);
|
|
923
|
-
};
|
|
924
|
-
var RouterState_1;
|
|
925
|
-
RouterState.ctorParameters = function () { return [
|
|
926
|
-
{ type: store.Store },
|
|
927
|
-
{ type: router.Router },
|
|
928
|
-
{ type: RouterStateSerializer },
|
|
929
|
-
{ type: core.NgZone },
|
|
930
|
-
{ type: router.UrlSerializer },
|
|
931
|
-
{ type: common.LocationStrategy },
|
|
932
|
-
{ type: common.Location }
|
|
933
|
-
]; };
|
|
934
|
-
RouterState.decorators = [
|
|
935
|
-
{ type: core.Injectable }
|
|
936
|
-
];
|
|
937
|
-
/** @nocollapse */
|
|
938
|
-
RouterState.ctorParameters = function () { return [
|
|
939
|
-
{ type: store.Store },
|
|
940
|
-
{ type: router.Router },
|
|
941
|
-
{ type: RouterStateSerializer },
|
|
942
|
-
{ type: core.NgZone },
|
|
943
|
-
{ type: router.UrlSerializer },
|
|
944
|
-
{ type: common.LocationStrategy },
|
|
945
|
-
{ type: common.Location }
|
|
946
|
-
]; };
|
|
947
|
-
__decorate([
|
|
948
|
-
store.Action(Navigate),
|
|
949
|
-
__metadata("design:type", Function),
|
|
950
|
-
__metadata("design:paramtypes", [Object, Navigate]),
|
|
951
|
-
__metadata("design:returntype", void 0)
|
|
952
|
-
], RouterState.prototype, "navigate", null);
|
|
953
|
-
__decorate([
|
|
954
|
-
store.Action([RouterNavigation, RouterError, RouterCancel, RouterDataResolved]),
|
|
955
|
-
__metadata("design:type", Function),
|
|
956
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
957
|
-
__metadata("design:returntype", void 0)
|
|
958
|
-
], RouterState.prototype, "angularRouterAction", null);
|
|
959
|
-
__decorate([
|
|
960
|
-
store.Selector(),
|
|
961
|
-
__metadata("design:type", Function),
|
|
962
|
-
__metadata("design:paramtypes", [Object]),
|
|
963
|
-
__metadata("design:returntype", void 0)
|
|
964
|
-
], RouterState, "state", null);
|
|
965
|
-
__decorate([
|
|
966
|
-
store.Selector(),
|
|
967
|
-
__metadata("design:type", Function),
|
|
968
|
-
__metadata("design:paramtypes", [Object]),
|
|
969
|
-
__metadata("design:returntype", Object)
|
|
970
|
-
], RouterState, "url", null);
|
|
971
|
-
RouterState = RouterState_1 = __decorate([
|
|
972
|
-
store.State({
|
|
973
|
-
name: 'router',
|
|
974
|
-
defaults: {
|
|
975
|
-
state: undefined,
|
|
976
|
-
navigationId: undefined,
|
|
977
|
-
trigger: 'none'
|
|
978
|
-
}
|
|
979
|
-
}),
|
|
980
|
-
__metadata("design:paramtypes", [store.Store,
|
|
981
|
-
router.Router,
|
|
982
|
-
RouterStateSerializer,
|
|
983
|
-
core.NgZone,
|
|
984
|
-
router.UrlSerializer,
|
|
985
|
-
common.LocationStrategy,
|
|
986
|
-
common.Location])
|
|
987
|
-
], RouterState);
|
|
988
|
-
return RouterState;
|
|
989
|
-
}());
|
|
990
|
-
if (false) {
|
|
991
|
-
/**
|
|
992
|
-
* Determines how navigation was performed by the `RouterState` itself
|
|
993
|
-
* or outside via `new Navigate(...)`
|
|
994
|
-
* @type {?}
|
|
995
|
-
* @private
|
|
996
|
-
*/
|
|
997
|
-
RouterState.prototype._trigger;
|
|
998
|
-
/**
|
|
999
|
-
* That's the serialized state from the `Router` class
|
|
1000
|
-
* @type {?}
|
|
1001
|
-
* @private
|
|
1002
|
-
*/
|
|
1003
|
-
RouterState.prototype._routerState;
|
|
1004
|
-
/**
|
|
1005
|
-
* That's the value of the `RouterState` state
|
|
1006
|
-
* @type {?}
|
|
1007
|
-
* @private
|
|
1008
|
-
*/
|
|
1009
|
-
RouterState.prototype._storeState;
|
|
1010
|
-
/**
|
|
1011
|
-
* @type {?}
|
|
1012
|
-
* @private
|
|
1013
|
-
*/
|
|
1014
|
-
RouterState.prototype._lastRoutesRecognized;
|
|
1015
|
-
/**
|
|
1016
|
-
* @type {?}
|
|
1017
|
-
* @private
|
|
1018
|
-
*/
|
|
1019
|
-
RouterState.prototype._subscription;
|
|
1020
|
-
/**
|
|
1021
|
-
* @type {?}
|
|
1022
|
-
* @private
|
|
1023
|
-
*/
|
|
1024
|
-
RouterState.prototype._store;
|
|
1025
|
-
/**
|
|
1026
|
-
* @type {?}
|
|
1027
|
-
* @private
|
|
1028
|
-
*/
|
|
1029
|
-
RouterState.prototype._router;
|
|
1030
|
-
/**
|
|
1031
|
-
* @type {?}
|
|
1032
|
-
* @private
|
|
1033
|
-
*/
|
|
1034
|
-
RouterState.prototype._serializer;
|
|
1035
|
-
/**
|
|
1036
|
-
* @type {?}
|
|
1037
|
-
* @private
|
|
1038
|
-
*/
|
|
1039
|
-
RouterState.prototype._ngZone;
|
|
1040
|
-
/**
|
|
1041
|
-
* @type {?}
|
|
1042
|
-
* @private
|
|
1043
|
-
*/
|
|
1044
|
-
RouterState.prototype._urlSerializer;
|
|
1045
|
-
/**
|
|
1046
|
-
* @type {?}
|
|
1047
|
-
* @private
|
|
1048
|
-
*/
|
|
1049
|
-
RouterState.prototype._locationStrategy;
|
|
1050
|
-
/**
|
|
1051
|
-
* @type {?}
|
|
1052
|
-
* @private
|
|
1053
|
-
*/
|
|
1054
|
-
RouterState.prototype._location;
|
|
516
|
+
/**
|
|
517
|
+
* @fileoverview added by tsickle
|
|
518
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
519
|
+
*/
|
|
520
|
+
/**
|
|
521
|
+
* @record
|
|
522
|
+
* @template T
|
|
523
|
+
*/
|
|
524
|
+
function RouterStateModel() { }
|
|
525
|
+
if (false) {
|
|
526
|
+
/** @type {?|undefined} */
|
|
527
|
+
RouterStateModel.prototype.state;
|
|
528
|
+
/** @type {?|undefined} */
|
|
529
|
+
RouterStateModel.prototype.navigationId;
|
|
530
|
+
/** @type {?} */
|
|
531
|
+
RouterStateModel.prototype.trigger;
|
|
532
|
+
}
|
|
533
|
+
var RouterState = /** @class */ (function () {
|
|
534
|
+
function RouterState(_store, _router, _serializer, _ngZone, _urlSerializer, _locationStrategy, _location) {
|
|
535
|
+
this._store = _store;
|
|
536
|
+
this._router = _router;
|
|
537
|
+
this._serializer = _serializer;
|
|
538
|
+
this._ngZone = _ngZone;
|
|
539
|
+
this._urlSerializer = _urlSerializer;
|
|
540
|
+
this._locationStrategy = _locationStrategy;
|
|
541
|
+
this._location = _location;
|
|
542
|
+
/**
|
|
543
|
+
* Determines how navigation was performed by the `RouterState` itself
|
|
544
|
+
* or outside via `new Navigate(...)`
|
|
545
|
+
*/
|
|
546
|
+
this._trigger = 'none';
|
|
547
|
+
/**
|
|
548
|
+
* That's the serialized state from the `Router` class
|
|
549
|
+
*/
|
|
550
|
+
this._routerState = null;
|
|
551
|
+
/**
|
|
552
|
+
* That's the value of the `RouterState` state
|
|
553
|
+
*/
|
|
554
|
+
this._storeState = null;
|
|
555
|
+
this._lastRoutesRecognized = (/** @type {?} */ (null));
|
|
556
|
+
this._subscription = new rxjs.Subscription();
|
|
557
|
+
this.setUpStoreListener();
|
|
558
|
+
this.setUpRouterEventsListener();
|
|
559
|
+
this.checkInitialNavigationOnce();
|
|
560
|
+
}
|
|
561
|
+
RouterState_1 = RouterState;
|
|
562
|
+
/**
|
|
563
|
+
* @template T
|
|
564
|
+
* @param {?} state
|
|
565
|
+
* @return {?}
|
|
566
|
+
*/
|
|
567
|
+
RouterState.state = /**
|
|
568
|
+
* @template T
|
|
569
|
+
* @param {?} state
|
|
570
|
+
* @return {?}
|
|
571
|
+
*/
|
|
572
|
+
function (state) {
|
|
573
|
+
return state && state.state;
|
|
574
|
+
};
|
|
575
|
+
/**
|
|
576
|
+
* @param {?} state
|
|
577
|
+
* @return {?}
|
|
578
|
+
*/
|
|
579
|
+
RouterState.url = /**
|
|
580
|
+
* @param {?} state
|
|
581
|
+
* @return {?}
|
|
582
|
+
*/
|
|
583
|
+
function (state) {
|
|
584
|
+
return state && state.state && state.state.url;
|
|
585
|
+
};
|
|
586
|
+
/**
|
|
587
|
+
* @return {?}
|
|
588
|
+
*/
|
|
589
|
+
RouterState.prototype.ngOnDestroy = /**
|
|
590
|
+
* @return {?}
|
|
591
|
+
*/
|
|
592
|
+
function () {
|
|
593
|
+
this._subscription.unsubscribe();
|
|
594
|
+
};
|
|
595
|
+
/**
|
|
596
|
+
* @param {?} _
|
|
597
|
+
* @param {?} action
|
|
598
|
+
* @return {?}
|
|
599
|
+
*/
|
|
600
|
+
RouterState.prototype.navigate = /**
|
|
601
|
+
* @param {?} _
|
|
602
|
+
* @param {?} action
|
|
603
|
+
* @return {?}
|
|
604
|
+
*/
|
|
605
|
+
function (_, action) {
|
|
606
|
+
var _this = this;
|
|
607
|
+
return this._ngZone.run((/**
|
|
608
|
+
* @return {?}
|
|
609
|
+
*/
|
|
610
|
+
function () {
|
|
611
|
+
return _this._router.navigate(action.path, __assign({ queryParams: action.queryParams }, action.extras));
|
|
612
|
+
}));
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* @param {?} ctx
|
|
616
|
+
* @param {?} action
|
|
617
|
+
* @return {?}
|
|
618
|
+
*/
|
|
619
|
+
RouterState.prototype.angularRouterAction = /**
|
|
620
|
+
* @param {?} ctx
|
|
621
|
+
* @param {?} action
|
|
622
|
+
* @return {?}
|
|
623
|
+
*/
|
|
624
|
+
function (ctx, action) {
|
|
625
|
+
ctx.setState(__assign({}, ctx.getState(), { trigger: action.trigger, state: action.routerState, navigationId: action.event.id }));
|
|
626
|
+
};
|
|
627
|
+
/**
|
|
628
|
+
* @private
|
|
629
|
+
* @return {?}
|
|
630
|
+
*/
|
|
631
|
+
RouterState.prototype.setUpStoreListener = /**
|
|
632
|
+
* @private
|
|
633
|
+
* @return {?}
|
|
634
|
+
*/
|
|
635
|
+
function () {
|
|
636
|
+
var _this = this;
|
|
637
|
+
/** @type {?} */
|
|
638
|
+
var subscription = this._store
|
|
639
|
+
.select(RouterState_1)
|
|
640
|
+
.subscribe((/**
|
|
641
|
+
* @param {?} state
|
|
642
|
+
* @return {?}
|
|
643
|
+
*/
|
|
644
|
+
function (state) {
|
|
645
|
+
_this.navigateIfNeeded(state);
|
|
646
|
+
}));
|
|
647
|
+
this._subscription.add(subscription);
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* @private
|
|
651
|
+
* @return {?}
|
|
652
|
+
*/
|
|
653
|
+
RouterState.prototype.setUpRouterEventsListener = /**
|
|
654
|
+
* @private
|
|
655
|
+
* @return {?}
|
|
656
|
+
*/
|
|
657
|
+
function () {
|
|
658
|
+
var _this = this;
|
|
659
|
+
/** @type {?} */
|
|
660
|
+
var subscription = this._router.events.subscribe((/**
|
|
661
|
+
* @param {?} event
|
|
662
|
+
* @return {?}
|
|
663
|
+
*/
|
|
664
|
+
function (event) {
|
|
665
|
+
if (event instanceof router.NavigationStart) {
|
|
666
|
+
_this.navigationStart();
|
|
667
|
+
}
|
|
668
|
+
else if (event instanceof router.RoutesRecognized) {
|
|
669
|
+
_this._lastRoutesRecognized = event;
|
|
670
|
+
}
|
|
671
|
+
else if (event instanceof router.ResolveEnd) {
|
|
672
|
+
_this.dispatchRouterDataResolved(event);
|
|
673
|
+
}
|
|
674
|
+
else if (event instanceof router.NavigationCancel) {
|
|
675
|
+
_this.dispatchRouterCancel(event);
|
|
676
|
+
_this.reset();
|
|
677
|
+
}
|
|
678
|
+
else if (event instanceof router.NavigationError) {
|
|
679
|
+
_this.dispatchRouterError(event);
|
|
680
|
+
_this.reset();
|
|
681
|
+
}
|
|
682
|
+
else if (event instanceof router.NavigationEnd) {
|
|
683
|
+
_this.navigationEnd();
|
|
684
|
+
_this.reset();
|
|
685
|
+
}
|
|
686
|
+
}));
|
|
687
|
+
this._subscription.add(subscription);
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* @private
|
|
691
|
+
* @return {?}
|
|
692
|
+
*/
|
|
693
|
+
RouterState.prototype.navigationStart = /**
|
|
694
|
+
* @private
|
|
695
|
+
* @return {?}
|
|
696
|
+
*/
|
|
697
|
+
function () {
|
|
698
|
+
this._routerState = this._serializer.serialize(this._router.routerState.snapshot);
|
|
699
|
+
if (this._trigger !== 'none') {
|
|
700
|
+
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* @private
|
|
705
|
+
* @return {?}
|
|
706
|
+
*/
|
|
707
|
+
RouterState.prototype.navigationEnd = /**
|
|
708
|
+
* @private
|
|
709
|
+
* @return {?}
|
|
710
|
+
*/
|
|
711
|
+
function () {
|
|
712
|
+
if (this.shouldDispatchRouterNavigation()) {
|
|
713
|
+
this.dispatchRouterNavigation();
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
/**
|
|
717
|
+
* @private
|
|
718
|
+
* @return {?}
|
|
719
|
+
*/
|
|
720
|
+
RouterState.prototype.shouldDispatchRouterNavigation = /**
|
|
721
|
+
* @private
|
|
722
|
+
* @return {?}
|
|
723
|
+
*/
|
|
724
|
+
function () {
|
|
725
|
+
if (!this._storeState)
|
|
726
|
+
return true;
|
|
727
|
+
return this._trigger !== 'store';
|
|
728
|
+
};
|
|
729
|
+
/**
|
|
730
|
+
* @private
|
|
731
|
+
* @param {?} state
|
|
732
|
+
* @return {?}
|
|
733
|
+
*/
|
|
734
|
+
RouterState.prototype.navigateIfNeeded = /**
|
|
735
|
+
* @private
|
|
736
|
+
* @param {?} state
|
|
737
|
+
* @return {?}
|
|
738
|
+
*/
|
|
739
|
+
function (state) {
|
|
740
|
+
var _this = this;
|
|
741
|
+
/** @type {?} */
|
|
742
|
+
var canSkipNavigation = !this._storeState ||
|
|
743
|
+
!this._storeState.state ||
|
|
744
|
+
!state ||
|
|
745
|
+
state.trigger === 'router' ||
|
|
746
|
+
this._router.url === this._storeState.state.url;
|
|
747
|
+
if (canSkipNavigation) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
this._trigger = 'store';
|
|
751
|
+
this._ngZone.run((/**
|
|
752
|
+
* @return {?}
|
|
753
|
+
*/
|
|
754
|
+
function () {
|
|
755
|
+
_this._router.navigateByUrl((/** @type {?} */ ((/** @type {?} */ (_this._storeState)).state)).url);
|
|
756
|
+
}));
|
|
757
|
+
};
|
|
758
|
+
/**
|
|
759
|
+
* @private
|
|
760
|
+
* @return {?}
|
|
761
|
+
*/
|
|
762
|
+
RouterState.prototype.dispatchRouterNavigation = /**
|
|
763
|
+
* @private
|
|
764
|
+
* @return {?}
|
|
765
|
+
*/
|
|
766
|
+
function () {
|
|
767
|
+
/** @type {?} */
|
|
768
|
+
var nextRouterState = this._serializer.serialize(this._lastRoutesRecognized.state);
|
|
769
|
+
this.dispatchRouterAction(new RouterNavigation(nextRouterState, new router.RoutesRecognized(this._lastRoutesRecognized.id, this._lastRoutesRecognized.url, this._lastRoutesRecognized.urlAfterRedirects, nextRouterState), this._trigger));
|
|
770
|
+
};
|
|
771
|
+
/**
|
|
772
|
+
* @private
|
|
773
|
+
* @param {?} event
|
|
774
|
+
* @return {?}
|
|
775
|
+
*/
|
|
776
|
+
RouterState.prototype.dispatchRouterCancel = /**
|
|
777
|
+
* @private
|
|
778
|
+
* @param {?} event
|
|
779
|
+
* @return {?}
|
|
780
|
+
*/
|
|
781
|
+
function (event) {
|
|
782
|
+
this.dispatchRouterAction(new RouterCancel((/** @type {?} */ (this._routerState)), this._storeState, event, this._trigger));
|
|
783
|
+
};
|
|
784
|
+
/**
|
|
785
|
+
* @private
|
|
786
|
+
* @param {?} event
|
|
787
|
+
* @return {?}
|
|
788
|
+
*/
|
|
789
|
+
RouterState.prototype.dispatchRouterError = /**
|
|
790
|
+
* @private
|
|
791
|
+
* @param {?} event
|
|
792
|
+
* @return {?}
|
|
793
|
+
*/
|
|
794
|
+
function (event) {
|
|
795
|
+
this.dispatchRouterAction(new RouterError((/** @type {?} */ (this._routerState)), this._storeState, new router.NavigationError(event.id, event.url, "" + event), this._trigger));
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* @private
|
|
799
|
+
* @template T
|
|
800
|
+
* @param {?} action
|
|
801
|
+
* @return {?}
|
|
802
|
+
*/
|
|
803
|
+
RouterState.prototype.dispatchRouterAction = /**
|
|
804
|
+
* @private
|
|
805
|
+
* @template T
|
|
806
|
+
* @param {?} action
|
|
807
|
+
* @return {?}
|
|
808
|
+
*/
|
|
809
|
+
function (action) {
|
|
810
|
+
this._trigger = 'router';
|
|
811
|
+
try {
|
|
812
|
+
this._store.dispatch(action);
|
|
813
|
+
}
|
|
814
|
+
finally {
|
|
815
|
+
this._trigger = 'none';
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
/**
|
|
819
|
+
* @private
|
|
820
|
+
* @param {?} event
|
|
821
|
+
* @return {?}
|
|
822
|
+
*/
|
|
823
|
+
RouterState.prototype.dispatchRouterDataResolved = /**
|
|
824
|
+
* @private
|
|
825
|
+
* @param {?} event
|
|
826
|
+
* @return {?}
|
|
827
|
+
*/
|
|
828
|
+
function (event) {
|
|
829
|
+
/** @type {?} */
|
|
830
|
+
var routerState = this._serializer.serialize(event.state);
|
|
831
|
+
this.dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));
|
|
832
|
+
};
|
|
833
|
+
/**
|
|
834
|
+
* @private
|
|
835
|
+
* @return {?}
|
|
836
|
+
*/
|
|
837
|
+
RouterState.prototype.reset = /**
|
|
838
|
+
* @private
|
|
839
|
+
* @return {?}
|
|
840
|
+
*/
|
|
841
|
+
function () {
|
|
842
|
+
this._trigger = 'none';
|
|
843
|
+
this._storeState = null;
|
|
844
|
+
this._routerState = null;
|
|
845
|
+
};
|
|
846
|
+
/**
|
|
847
|
+
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
848
|
+
* to perform this check only once and unsubscribe after the first event
|
|
849
|
+
* is triggered
|
|
850
|
+
*/
|
|
851
|
+
/**
|
|
852
|
+
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
853
|
+
* to perform this check only once and unsubscribe after the first event
|
|
854
|
+
* is triggered
|
|
855
|
+
* @private
|
|
856
|
+
* @return {?}
|
|
857
|
+
*/
|
|
858
|
+
RouterState.prototype.checkInitialNavigationOnce = /**
|
|
859
|
+
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
860
|
+
* to perform this check only once and unsubscribe after the first event
|
|
861
|
+
* is triggered
|
|
862
|
+
* @private
|
|
863
|
+
* @return {?}
|
|
864
|
+
*/
|
|
865
|
+
function () {
|
|
866
|
+
var _this = this;
|
|
867
|
+
// Caretaker note: we have still left the `typeof` condition in order to avoid
|
|
868
|
+
// creating a breaking change for projects that still use the View Engine.
|
|
869
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
870
|
+
// Angular is running tests in development mode thus we can be sure that this method will be
|
|
871
|
+
// skipped in tests.
|
|
872
|
+
internals.isAngularInTestMode()) {
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
/** @type {?} */
|
|
876
|
+
var subscription = this._router.events
|
|
877
|
+
.pipe(operators.first((/**
|
|
878
|
+
* @param {?} event
|
|
879
|
+
* @return {?}
|
|
880
|
+
*/
|
|
881
|
+
function (event) { return event instanceof router.RoutesRecognized; })))
|
|
882
|
+
.subscribe((/**
|
|
883
|
+
* @param {?} __0
|
|
884
|
+
* @return {?}
|
|
885
|
+
*/
|
|
886
|
+
function (_a) {
|
|
887
|
+
// `location.pathname` always equals manually entered URL in the address bar
|
|
888
|
+
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
889
|
+
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
890
|
+
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
891
|
+
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
892
|
+
var url = _a.url;
|
|
893
|
+
// `location.pathname` always equals manually entered URL in the address bar
|
|
894
|
+
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
895
|
+
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
896
|
+
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
897
|
+
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
898
|
+
// `url` is a recognized URL by the Angular's router, while `currentUrl` is an actual URL
|
|
899
|
+
// entered in the browser's address bar
|
|
900
|
+
// `PathLocationStrategy.prototype.path()` returns a concatenation of
|
|
901
|
+
// `PlatformLocation.pathname` and normalized `PlatformLocation.search`.
|
|
902
|
+
// `Location.prototype.normalize` strips base href from the URL,
|
|
903
|
+
// if `baseHref` (declared in angular.json) for example is `/en`
|
|
904
|
+
// and the URL is `/test#anchor` - then `_locationStrategy.path(true)` will return `/en/test#anchor`,
|
|
905
|
+
// but `/en/test#anchor` is not known to the Angular's router, so we have to strip `/en`
|
|
906
|
+
// from the URL
|
|
907
|
+
/** @type {?} */
|
|
908
|
+
var currentUrl = _this._location.normalize(_this._locationStrategy.path(true));
|
|
909
|
+
/** @type {?} */
|
|
910
|
+
var currentUrlTree = _this._urlSerializer.parse(currentUrl);
|
|
911
|
+
// We need to serialize the URL because in that example `/test/?redirect=https://google.com/`
|
|
912
|
+
// Angular will recognize it as `/test?redirect=https:%2F%2Fwww.google.com%2F`
|
|
913
|
+
// so we have to run the `currentUrl` via the `UrlSerializer` that will encode characters
|
|
914
|
+
/** @type {?} */
|
|
915
|
+
var currentSerializedUrl = _this._urlSerializer.serialize(currentUrlTree);
|
|
916
|
+
// If URLs differ from each other - we've got to perform a redirect to the manually entered URL
|
|
917
|
+
// in the address bar, as it must have a priority
|
|
918
|
+
if (currentSerializedUrl !== url) {
|
|
919
|
+
_this._router.navigateByUrl(currentUrl);
|
|
920
|
+
}
|
|
921
|
+
}));
|
|
922
|
+
this._subscription.add(subscription);
|
|
923
|
+
};
|
|
924
|
+
var RouterState_1;
|
|
925
|
+
RouterState.ctorParameters = function () { return [
|
|
926
|
+
{ type: store.Store },
|
|
927
|
+
{ type: router.Router },
|
|
928
|
+
{ type: RouterStateSerializer },
|
|
929
|
+
{ type: core.NgZone },
|
|
930
|
+
{ type: router.UrlSerializer },
|
|
931
|
+
{ type: common.LocationStrategy },
|
|
932
|
+
{ type: common.Location }
|
|
933
|
+
]; };
|
|
934
|
+
RouterState.decorators = [
|
|
935
|
+
{ type: core.Injectable }
|
|
936
|
+
];
|
|
937
|
+
/** @nocollapse */
|
|
938
|
+
RouterState.ctorParameters = function () { return [
|
|
939
|
+
{ type: store.Store },
|
|
940
|
+
{ type: router.Router },
|
|
941
|
+
{ type: RouterStateSerializer },
|
|
942
|
+
{ type: core.NgZone },
|
|
943
|
+
{ type: router.UrlSerializer },
|
|
944
|
+
{ type: common.LocationStrategy },
|
|
945
|
+
{ type: common.Location }
|
|
946
|
+
]; };
|
|
947
|
+
__decorate([
|
|
948
|
+
store.Action(Navigate),
|
|
949
|
+
__metadata("design:type", Function),
|
|
950
|
+
__metadata("design:paramtypes", [Object, Navigate]),
|
|
951
|
+
__metadata("design:returntype", void 0)
|
|
952
|
+
], RouterState.prototype, "navigate", null);
|
|
953
|
+
__decorate([
|
|
954
|
+
store.Action([RouterNavigation, RouterError, RouterCancel, RouterDataResolved]),
|
|
955
|
+
__metadata("design:type", Function),
|
|
956
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
957
|
+
__metadata("design:returntype", void 0)
|
|
958
|
+
], RouterState.prototype, "angularRouterAction", null);
|
|
959
|
+
__decorate([
|
|
960
|
+
store.Selector(),
|
|
961
|
+
__metadata("design:type", Function),
|
|
962
|
+
__metadata("design:paramtypes", [Object]),
|
|
963
|
+
__metadata("design:returntype", void 0)
|
|
964
|
+
], RouterState, "state", null);
|
|
965
|
+
__decorate([
|
|
966
|
+
store.Selector(),
|
|
967
|
+
__metadata("design:type", Function),
|
|
968
|
+
__metadata("design:paramtypes", [Object]),
|
|
969
|
+
__metadata("design:returntype", Object)
|
|
970
|
+
], RouterState, "url", null);
|
|
971
|
+
RouterState = RouterState_1 = __decorate([
|
|
972
|
+
store.State({
|
|
973
|
+
name: 'router',
|
|
974
|
+
defaults: {
|
|
975
|
+
state: undefined,
|
|
976
|
+
navigationId: undefined,
|
|
977
|
+
trigger: 'none'
|
|
978
|
+
}
|
|
979
|
+
}),
|
|
980
|
+
__metadata("design:paramtypes", [store.Store,
|
|
981
|
+
router.Router,
|
|
982
|
+
RouterStateSerializer,
|
|
983
|
+
core.NgZone,
|
|
984
|
+
router.UrlSerializer,
|
|
985
|
+
common.LocationStrategy,
|
|
986
|
+
common.Location])
|
|
987
|
+
], RouterState);
|
|
988
|
+
return RouterState;
|
|
989
|
+
}());
|
|
990
|
+
if (false) {
|
|
991
|
+
/**
|
|
992
|
+
* Determines how navigation was performed by the `RouterState` itself
|
|
993
|
+
* or outside via `new Navigate(...)`
|
|
994
|
+
* @type {?}
|
|
995
|
+
* @private
|
|
996
|
+
*/
|
|
997
|
+
RouterState.prototype._trigger;
|
|
998
|
+
/**
|
|
999
|
+
* That's the serialized state from the `Router` class
|
|
1000
|
+
* @type {?}
|
|
1001
|
+
* @private
|
|
1002
|
+
*/
|
|
1003
|
+
RouterState.prototype._routerState;
|
|
1004
|
+
/**
|
|
1005
|
+
* That's the value of the `RouterState` state
|
|
1006
|
+
* @type {?}
|
|
1007
|
+
* @private
|
|
1008
|
+
*/
|
|
1009
|
+
RouterState.prototype._storeState;
|
|
1010
|
+
/**
|
|
1011
|
+
* @type {?}
|
|
1012
|
+
* @private
|
|
1013
|
+
*/
|
|
1014
|
+
RouterState.prototype._lastRoutesRecognized;
|
|
1015
|
+
/**
|
|
1016
|
+
* @type {?}
|
|
1017
|
+
* @private
|
|
1018
|
+
*/
|
|
1019
|
+
RouterState.prototype._subscription;
|
|
1020
|
+
/**
|
|
1021
|
+
* @type {?}
|
|
1022
|
+
* @private
|
|
1023
|
+
*/
|
|
1024
|
+
RouterState.prototype._store;
|
|
1025
|
+
/**
|
|
1026
|
+
* @type {?}
|
|
1027
|
+
* @private
|
|
1028
|
+
*/
|
|
1029
|
+
RouterState.prototype._router;
|
|
1030
|
+
/**
|
|
1031
|
+
* @type {?}
|
|
1032
|
+
* @private
|
|
1033
|
+
*/
|
|
1034
|
+
RouterState.prototype._serializer;
|
|
1035
|
+
/**
|
|
1036
|
+
* @type {?}
|
|
1037
|
+
* @private
|
|
1038
|
+
*/
|
|
1039
|
+
RouterState.prototype._ngZone;
|
|
1040
|
+
/**
|
|
1041
|
+
* @type {?}
|
|
1042
|
+
* @private
|
|
1043
|
+
*/
|
|
1044
|
+
RouterState.prototype._urlSerializer;
|
|
1045
|
+
/**
|
|
1046
|
+
* @type {?}
|
|
1047
|
+
* @private
|
|
1048
|
+
*/
|
|
1049
|
+
RouterState.prototype._locationStrategy;
|
|
1050
|
+
/**
|
|
1051
|
+
* @type {?}
|
|
1052
|
+
* @private
|
|
1053
|
+
*/
|
|
1054
|
+
RouterState.prototype._location;
|
|
1055
1055
|
}
|
|
1056
1056
|
|
|
1057
|
-
/**
|
|
1058
|
-
* @fileoverview added by tsickle
|
|
1059
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1060
|
-
*/
|
|
1061
|
-
var NgxsRouterPluginModule = /** @class */ (function () {
|
|
1062
|
-
function NgxsRouterPluginModule() {
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* @return {?}
|
|
1066
|
-
*/
|
|
1067
|
-
NgxsRouterPluginModule.forRoot = /**
|
|
1068
|
-
* @return {?}
|
|
1069
|
-
*/
|
|
1070
|
-
function () {
|
|
1071
|
-
return {
|
|
1072
|
-
ngModule: NgxsRouterPluginModule,
|
|
1073
|
-
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
|
|
1074
|
-
};
|
|
1075
|
-
};
|
|
1076
|
-
NgxsRouterPluginModule.decorators = [
|
|
1077
|
-
{ type: core.NgModule, args: [{
|
|
1078
|
-
imports: [store.NgxsModule.forFeature([RouterState])]
|
|
1079
|
-
},] }
|
|
1080
|
-
];
|
|
1081
|
-
return NgxsRouterPluginModule;
|
|
1057
|
+
/**
|
|
1058
|
+
* @fileoverview added by tsickle
|
|
1059
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1060
|
+
*/
|
|
1061
|
+
var NgxsRouterPluginModule = /** @class */ (function () {
|
|
1062
|
+
function NgxsRouterPluginModule() {
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* @return {?}
|
|
1066
|
+
*/
|
|
1067
|
+
NgxsRouterPluginModule.forRoot = /**
|
|
1068
|
+
* @return {?}
|
|
1069
|
+
*/
|
|
1070
|
+
function () {
|
|
1071
|
+
return {
|
|
1072
|
+
ngModule: NgxsRouterPluginModule,
|
|
1073
|
+
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1076
|
+
NgxsRouterPluginModule.decorators = [
|
|
1077
|
+
{ type: core.NgModule, args: [{
|
|
1078
|
+
imports: [store.NgxsModule.forFeature([RouterState])]
|
|
1079
|
+
},] }
|
|
1080
|
+
];
|
|
1081
|
+
return NgxsRouterPluginModule;
|
|
1082
1082
|
}());
|
|
1083
1083
|
|
|
1084
1084
|
exports.DefaultRouterStateSerializer = DefaultRouterStateSerializer;
|