@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,43 +1,26 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
1
2
|
import { InjectionToken, NgZone, Injector, Injectable, NgModule } from '@angular/core';
|
|
2
|
-
import
|
|
3
|
+
import * as i1 from '@ngxs/store';
|
|
4
|
+
import { Action, Selector, State, Store, NgxsModule } from '@ngxs/store';
|
|
3
5
|
import { __decorate, __metadata } from 'tslib';
|
|
6
|
+
import * as i2 from '@angular/router';
|
|
4
7
|
import { NavigationStart, RoutesRecognized, ResolveEnd, NavigationCancel, NavigationError, NavigationEnd, Router } from '@angular/router';
|
|
5
8
|
import { Subscription } from 'rxjs';
|
|
6
9
|
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview added by tsickle
|
|
9
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
10
|
-
*/
|
|
11
10
|
/**
|
|
12
11
|
* Public event api of the router
|
|
13
12
|
*/
|
|
14
13
|
class Navigate {
|
|
15
|
-
/**
|
|
16
|
-
* @param {?} path
|
|
17
|
-
* @param {?=} queryParams
|
|
18
|
-
* @param {?=} extras
|
|
19
|
-
*/
|
|
20
14
|
constructor(path, queryParams, extras) {
|
|
21
15
|
this.path = path;
|
|
22
16
|
this.queryParams = queryParams;
|
|
23
17
|
this.extras = extras;
|
|
24
18
|
}
|
|
25
|
-
/**
|
|
26
|
-
* @return {?}
|
|
27
|
-
*/
|
|
28
19
|
static get type() {
|
|
29
20
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
30
21
|
return '[Router] Navigate';
|
|
31
22
|
}
|
|
32
23
|
}
|
|
33
|
-
if (false) {
|
|
34
|
-
/** @type {?} */
|
|
35
|
-
Navigate.prototype.path;
|
|
36
|
-
/** @type {?} */
|
|
37
|
-
Navigate.prototype.queryParams;
|
|
38
|
-
/** @type {?} */
|
|
39
|
-
Navigate.prototype.extras;
|
|
40
|
-
}
|
|
41
24
|
/**
|
|
42
25
|
*
|
|
43
26
|
* Angular Routers internal state events
|
|
@@ -45,250 +28,102 @@ if (false) {
|
|
|
45
28
|
*/
|
|
46
29
|
/**
|
|
47
30
|
* An action dispatched when the router starts the navigation.
|
|
48
|
-
* @template T
|
|
49
31
|
*/
|
|
50
32
|
class RouterRequest {
|
|
51
|
-
/**
|
|
52
|
-
* @param {?} routerState
|
|
53
|
-
* @param {?} event
|
|
54
|
-
* @param {?=} trigger
|
|
55
|
-
*/
|
|
56
33
|
constructor(routerState, event, trigger = 'none') {
|
|
57
34
|
this.routerState = routerState;
|
|
58
35
|
this.event = event;
|
|
59
36
|
this.trigger = trigger;
|
|
60
37
|
}
|
|
61
|
-
/**
|
|
62
|
-
* @return {?}
|
|
63
|
-
*/
|
|
64
38
|
static get type() {
|
|
65
39
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
66
40
|
return '[Router] RouterRequest';
|
|
67
41
|
}
|
|
68
42
|
}
|
|
69
|
-
if (false) {
|
|
70
|
-
/** @type {?} */
|
|
71
|
-
RouterRequest.prototype.routerState;
|
|
72
|
-
/** @type {?} */
|
|
73
|
-
RouterRequest.prototype.event;
|
|
74
|
-
/** @type {?} */
|
|
75
|
-
RouterRequest.prototype.trigger;
|
|
76
|
-
}
|
|
77
43
|
/**
|
|
78
44
|
* An action dispatched when the router navigates.
|
|
79
|
-
* @template T
|
|
80
45
|
*/
|
|
81
46
|
class RouterNavigation {
|
|
82
|
-
/**
|
|
83
|
-
* @param {?} routerState
|
|
84
|
-
* @param {?} event
|
|
85
|
-
* @param {?=} trigger
|
|
86
|
-
*/
|
|
87
47
|
constructor(routerState, event, trigger = 'none') {
|
|
88
48
|
this.routerState = routerState;
|
|
89
49
|
this.event = event;
|
|
90
50
|
this.trigger = trigger;
|
|
91
51
|
}
|
|
92
|
-
/**
|
|
93
|
-
* @return {?}
|
|
94
|
-
*/
|
|
95
52
|
static get type() {
|
|
96
53
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
97
54
|
return '[Router] RouterNavigation';
|
|
98
55
|
}
|
|
99
56
|
}
|
|
100
|
-
if (false) {
|
|
101
|
-
/** @type {?} */
|
|
102
|
-
RouterNavigation.prototype.routerState;
|
|
103
|
-
/** @type {?} */
|
|
104
|
-
RouterNavigation.prototype.event;
|
|
105
|
-
/** @type {?} */
|
|
106
|
-
RouterNavigation.prototype.trigger;
|
|
107
|
-
}
|
|
108
57
|
/**
|
|
109
58
|
* An action dispatched when the router cancel navigation.
|
|
110
|
-
* @template T, V
|
|
111
59
|
*/
|
|
112
60
|
class RouterCancel {
|
|
113
|
-
/**
|
|
114
|
-
* @param {?} routerState
|
|
115
|
-
* @param {?} storeState
|
|
116
|
-
* @param {?} event
|
|
117
|
-
* @param {?=} trigger
|
|
118
|
-
*/
|
|
119
61
|
constructor(routerState, storeState, event, trigger = 'none') {
|
|
120
62
|
this.routerState = routerState;
|
|
121
63
|
this.storeState = storeState;
|
|
122
64
|
this.event = event;
|
|
123
65
|
this.trigger = trigger;
|
|
124
66
|
}
|
|
125
|
-
/**
|
|
126
|
-
* @return {?}
|
|
127
|
-
*/
|
|
128
67
|
static get type() {
|
|
129
68
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
130
69
|
return '[Router] RouterCancel';
|
|
131
70
|
}
|
|
132
71
|
}
|
|
133
|
-
if (false) {
|
|
134
|
-
/** @type {?} */
|
|
135
|
-
RouterCancel.prototype.routerState;
|
|
136
|
-
/** @type {?} */
|
|
137
|
-
RouterCancel.prototype.storeState;
|
|
138
|
-
/** @type {?} */
|
|
139
|
-
RouterCancel.prototype.event;
|
|
140
|
-
/** @type {?} */
|
|
141
|
-
RouterCancel.prototype.trigger;
|
|
142
|
-
}
|
|
143
72
|
/**
|
|
144
73
|
* An action dispatched when the router errors.
|
|
145
|
-
* @template T, V
|
|
146
74
|
*/
|
|
147
75
|
class RouterError {
|
|
148
|
-
/**
|
|
149
|
-
* @param {?} routerState
|
|
150
|
-
* @param {?} storeState
|
|
151
|
-
* @param {?} event
|
|
152
|
-
* @param {?=} trigger
|
|
153
|
-
*/
|
|
154
76
|
constructor(routerState, storeState, event, trigger = 'none') {
|
|
155
77
|
this.routerState = routerState;
|
|
156
78
|
this.storeState = storeState;
|
|
157
79
|
this.event = event;
|
|
158
80
|
this.trigger = trigger;
|
|
159
81
|
}
|
|
160
|
-
/**
|
|
161
|
-
* @return {?}
|
|
162
|
-
*/
|
|
163
82
|
static get type() {
|
|
164
83
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
165
84
|
return '[Router] RouterError';
|
|
166
85
|
}
|
|
167
86
|
}
|
|
168
|
-
if (false) {
|
|
169
|
-
/** @type {?} */
|
|
170
|
-
RouterError.prototype.routerState;
|
|
171
|
-
/** @type {?} */
|
|
172
|
-
RouterError.prototype.storeState;
|
|
173
|
-
/** @type {?} */
|
|
174
|
-
RouterError.prototype.event;
|
|
175
|
-
/** @type {?} */
|
|
176
|
-
RouterError.prototype.trigger;
|
|
177
|
-
}
|
|
178
87
|
/**
|
|
179
88
|
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
180
|
-
* @template T
|
|
181
89
|
*/
|
|
182
90
|
class RouterDataResolved {
|
|
183
|
-
/**
|
|
184
|
-
* @param {?} routerState
|
|
185
|
-
* @param {?} event
|
|
186
|
-
* @param {?=} trigger
|
|
187
|
-
*/
|
|
188
91
|
constructor(routerState, event, trigger = 'none') {
|
|
189
92
|
this.routerState = routerState;
|
|
190
93
|
this.event = event;
|
|
191
94
|
this.trigger = trigger;
|
|
192
95
|
}
|
|
193
|
-
/**
|
|
194
|
-
* @return {?}
|
|
195
|
-
*/
|
|
196
96
|
static get type() {
|
|
197
97
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
198
98
|
return '[Router] RouterDataResolved';
|
|
199
99
|
}
|
|
200
100
|
}
|
|
201
|
-
if (false) {
|
|
202
|
-
/** @type {?} */
|
|
203
|
-
RouterDataResolved.prototype.routerState;
|
|
204
|
-
/** @type {?} */
|
|
205
|
-
RouterDataResolved.prototype.event;
|
|
206
|
-
/** @type {?} */
|
|
207
|
-
RouterDataResolved.prototype.trigger;
|
|
208
|
-
}
|
|
209
101
|
/**
|
|
210
102
|
* An action dispatched when the router navigation has been finished successfully.
|
|
211
|
-
* @template T
|
|
212
103
|
*/
|
|
213
104
|
class RouterNavigated {
|
|
214
|
-
/**
|
|
215
|
-
* @param {?} routerState
|
|
216
|
-
* @param {?} event
|
|
217
|
-
* @param {?=} trigger
|
|
218
|
-
*/
|
|
219
105
|
constructor(routerState, event, trigger = 'none') {
|
|
220
106
|
this.routerState = routerState;
|
|
221
107
|
this.event = event;
|
|
222
108
|
this.trigger = trigger;
|
|
223
109
|
}
|
|
224
|
-
/**
|
|
225
|
-
* @return {?}
|
|
226
|
-
*/
|
|
227
110
|
static get type() {
|
|
228
111
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
229
112
|
return '[Router] RouterNavigated';
|
|
230
113
|
}
|
|
231
114
|
}
|
|
232
|
-
if (false) {
|
|
233
|
-
/** @type {?} */
|
|
234
|
-
RouterNavigated.prototype.routerState;
|
|
235
|
-
/** @type {?} */
|
|
236
|
-
RouterNavigated.prototype.event;
|
|
237
|
-
/** @type {?} */
|
|
238
|
-
RouterNavigated.prototype.trigger;
|
|
239
|
-
}
|
|
240
115
|
|
|
241
|
-
/**
|
|
242
|
-
* @fileoverview added by tsickle
|
|
243
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
244
|
-
*/
|
|
245
|
-
/**
|
|
246
|
-
* @abstract
|
|
247
|
-
* @template T
|
|
248
|
-
*/
|
|
249
116
|
class RouterStateSerializer {
|
|
250
117
|
}
|
|
251
|
-
if (false) {
|
|
252
|
-
/**
|
|
253
|
-
* @abstract
|
|
254
|
-
* @param {?} routerState
|
|
255
|
-
* @return {?}
|
|
256
|
-
*/
|
|
257
|
-
RouterStateSerializer.prototype.serialize = function (routerState) { };
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* @record
|
|
261
|
-
*/
|
|
262
|
-
function SerializedRouterStateSnapshot() { }
|
|
263
|
-
if (false) {
|
|
264
|
-
/** @type {?} */
|
|
265
|
-
SerializedRouterStateSnapshot.prototype.root;
|
|
266
|
-
/** @type {?} */
|
|
267
|
-
SerializedRouterStateSnapshot.prototype.url;
|
|
268
|
-
}
|
|
269
118
|
class DefaultRouterStateSerializer {
|
|
270
|
-
/**
|
|
271
|
-
* @param {?} routerState
|
|
272
|
-
* @return {?}
|
|
273
|
-
*/
|
|
274
119
|
serialize(routerState) {
|
|
275
120
|
return {
|
|
276
121
|
root: this.serializeRoute(routerState.root),
|
|
277
122
|
url: routerState.url
|
|
278
123
|
};
|
|
279
124
|
}
|
|
280
|
-
/**
|
|
281
|
-
* @private
|
|
282
|
-
* @param {?} route
|
|
283
|
-
* @return {?}
|
|
284
|
-
*/
|
|
285
125
|
serializeRoute(route) {
|
|
286
|
-
|
|
287
|
-
const children = route.children.map((/**
|
|
288
|
-
* @param {?} c
|
|
289
|
-
* @return {?}
|
|
290
|
-
*/
|
|
291
|
-
c => this.serializeRoute(c)));
|
|
126
|
+
const children = route.children.map(c => this.serializeRoute(c));
|
|
292
127
|
return {
|
|
293
128
|
url: route.url,
|
|
294
129
|
params: route.params,
|
|
@@ -298,11 +133,11 @@ class DefaultRouterStateSerializer {
|
|
|
298
133
|
outlet: route.outlet,
|
|
299
134
|
component: null,
|
|
300
135
|
routeConfig: null,
|
|
301
|
-
root:
|
|
136
|
+
root: null,
|
|
302
137
|
parent: null,
|
|
303
138
|
firstChild: children[0],
|
|
304
139
|
children: children,
|
|
305
|
-
pathFromRoot:
|
|
140
|
+
pathFromRoot: null,
|
|
306
141
|
paramMap: route.paramMap,
|
|
307
142
|
queryParamMap: route.queryParamMap,
|
|
308
143
|
toString: route.toString
|
|
@@ -310,37 +145,8 @@ class DefaultRouterStateSerializer {
|
|
|
310
145
|
}
|
|
311
146
|
}
|
|
312
147
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
316
|
-
*/
|
|
317
|
-
/** @enum {number} */
|
|
318
|
-
const NavigationActionTiming = {
|
|
319
|
-
PreActivation: 1,
|
|
320
|
-
PostActivation: 2,
|
|
321
|
-
};
|
|
322
|
-
/**
|
|
323
|
-
* @record
|
|
324
|
-
*/
|
|
325
|
-
function NgxsRouterPluginOptions() { }
|
|
326
|
-
if (false) {
|
|
327
|
-
/** @type {?|undefined} */
|
|
328
|
-
NgxsRouterPluginOptions.prototype.navigationActionTiming;
|
|
329
|
-
}
|
|
330
|
-
/** @type {?} */
|
|
331
|
-
const USER_OPTIONS = new InjectionToken('USER_OPTIONS', { providedIn: 'root', factory: (/**
|
|
332
|
-
* @return {?}
|
|
333
|
-
*/
|
|
334
|
-
() => undefined) });
|
|
335
|
-
/** @type {?} */
|
|
336
|
-
const NGXS_ROUTER_PLUGIN_OPTIONS = new InjectionToken('NGXS_ROUTER_PLUGIN_OPTIONS', { providedIn: 'root', factory: (/**
|
|
337
|
-
* @return {?}
|
|
338
|
-
*/
|
|
339
|
-
() => ({})) });
|
|
340
|
-
/**
|
|
341
|
-
* @param {?} options
|
|
342
|
-
* @return {?}
|
|
343
|
-
*/
|
|
148
|
+
const USER_OPTIONS = new InjectionToken('USER_OPTIONS', { providedIn: 'root', factory: () => undefined });
|
|
149
|
+
const NGXS_ROUTER_PLUGIN_OPTIONS = new InjectionToken('NGXS_ROUTER_PLUGIN_OPTIONS', { providedIn: 'root', factory: () => ({}) });
|
|
344
150
|
function createRouterPluginOptions(options) {
|
|
345
151
|
return {
|
|
346
152
|
navigationActionTiming: (options && options.navigationActionTiming) || 1 /* PreActivation */
|
|
@@ -348,27 +154,7 @@ function createRouterPluginOptions(options) {
|
|
|
348
154
|
}
|
|
349
155
|
|
|
350
156
|
var RouterState_1;
|
|
351
|
-
/**
|
|
352
|
-
* @record
|
|
353
|
-
* @template T
|
|
354
|
-
*/
|
|
355
|
-
function RouterStateModel() { }
|
|
356
|
-
if (false) {
|
|
357
|
-
/** @type {?|undefined} */
|
|
358
|
-
RouterStateModel.prototype.state;
|
|
359
|
-
/** @type {?|undefined} */
|
|
360
|
-
RouterStateModel.prototype.navigationId;
|
|
361
|
-
/** @type {?} */
|
|
362
|
-
RouterStateModel.prototype.trigger;
|
|
363
|
-
}
|
|
364
157
|
let RouterState = RouterState_1 = class RouterState {
|
|
365
|
-
/**
|
|
366
|
-
* @param {?} _store
|
|
367
|
-
* @param {?} _router
|
|
368
|
-
* @param {?} _serializer
|
|
369
|
-
* @param {?} _ngZone
|
|
370
|
-
* @param {?} injector
|
|
371
|
-
*/
|
|
372
158
|
constructor(_store, _router, _serializer, _ngZone, injector) {
|
|
373
159
|
this._store = _store;
|
|
374
160
|
this._router = _router;
|
|
@@ -396,43 +182,18 @@ let RouterState = RouterState_1 = class RouterState {
|
|
|
396
182
|
this._setUpStoreListener();
|
|
397
183
|
this._setUpRouterEventsListener();
|
|
398
184
|
}
|
|
399
|
-
/**
|
|
400
|
-
* @template T
|
|
401
|
-
* @param {?} state
|
|
402
|
-
* @return {?}
|
|
403
|
-
*/
|
|
404
185
|
static state(state) {
|
|
405
186
|
return state && state.state;
|
|
406
187
|
}
|
|
407
|
-
/**
|
|
408
|
-
* @param {?} state
|
|
409
|
-
* @return {?}
|
|
410
|
-
*/
|
|
411
188
|
static url(state) {
|
|
412
189
|
return state && state.state && state.state.url;
|
|
413
190
|
}
|
|
414
|
-
/**
|
|
415
|
-
* @return {?}
|
|
416
|
-
*/
|
|
417
191
|
ngOnDestroy() {
|
|
418
192
|
this._subscription.unsubscribe();
|
|
419
193
|
}
|
|
420
|
-
/**
|
|
421
|
-
* @param {?} _
|
|
422
|
-
* @param {?} action
|
|
423
|
-
* @return {?}
|
|
424
|
-
*/
|
|
425
194
|
navigate(_, action) {
|
|
426
|
-
return this._ngZone.run((
|
|
427
|
-
* @return {?}
|
|
428
|
-
*/
|
|
429
|
-
() => this._router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras))));
|
|
195
|
+
return this._ngZone.run(() => this._router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras)));
|
|
430
196
|
}
|
|
431
|
-
/**
|
|
432
|
-
* @param {?} ctx
|
|
433
|
-
* @param {?} action
|
|
434
|
-
* @return {?}
|
|
435
|
-
*/
|
|
436
197
|
angularRouterAction(ctx, action) {
|
|
437
198
|
ctx.setState({
|
|
438
199
|
trigger: action.trigger,
|
|
@@ -440,33 +201,18 @@ let RouterState = RouterState_1 = class RouterState {
|
|
|
440
201
|
navigationId: action.event.id
|
|
441
202
|
});
|
|
442
203
|
}
|
|
443
|
-
/**
|
|
444
|
-
* @private
|
|
445
|
-
* @return {?}
|
|
446
|
-
*/
|
|
447
204
|
_setUpStoreListener() {
|
|
448
|
-
/** @type {?} */
|
|
449
205
|
const subscription = this._store
|
|
450
206
|
.select(RouterState_1)
|
|
451
|
-
.subscribe((
|
|
452
|
-
* @param {?} state
|
|
453
|
-
* @return {?}
|
|
454
|
-
*/
|
|
455
|
-
(state) => {
|
|
207
|
+
.subscribe((state) => {
|
|
456
208
|
this._navigateIfNeeded(state);
|
|
457
|
-
})
|
|
209
|
+
});
|
|
458
210
|
this._subscription.add(subscription);
|
|
459
211
|
}
|
|
460
|
-
/**
|
|
461
|
-
* @private
|
|
462
|
-
* @param {?} routerState
|
|
463
|
-
* @return {?}
|
|
464
|
-
*/
|
|
465
212
|
_navigateIfNeeded(routerState) {
|
|
466
213
|
if (routerState && routerState.trigger === 'devtools') {
|
|
467
214
|
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
468
215
|
}
|
|
469
|
-
/** @type {?} */
|
|
470
216
|
const canSkipNavigation = !this._storeState ||
|
|
471
217
|
!this._storeState.state ||
|
|
472
218
|
!routerState ||
|
|
@@ -478,27 +224,13 @@ let RouterState = RouterState_1 = class RouterState {
|
|
|
478
224
|
}
|
|
479
225
|
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
480
226
|
this._trigger = 'store';
|
|
481
|
-
this._ngZone.run((
|
|
482
|
-
* @return {?}
|
|
483
|
-
*/
|
|
484
|
-
() => this._router.navigateByUrl((/** @type {?} */ ((/** @type {?} */ (this._storeState)).state)).url)));
|
|
227
|
+
this._ngZone.run(() => this._router.navigateByUrl(this._storeState.state.url));
|
|
485
228
|
}
|
|
486
|
-
/**
|
|
487
|
-
* @private
|
|
488
|
-
* @return {?}
|
|
489
|
-
*/
|
|
490
229
|
_setUpRouterEventsListener() {
|
|
491
|
-
/** @type {?} */
|
|
492
230
|
const dispatchRouterNavigationLate = this._options != null &&
|
|
493
231
|
this._options.navigationActionTiming === 2 /* PostActivation */;
|
|
494
|
-
/** @type {?} */
|
|
495
232
|
let lastRoutesRecognized;
|
|
496
|
-
|
|
497
|
-
const subscription = this._router.events.subscribe((/**
|
|
498
|
-
* @param {?} event
|
|
499
|
-
* @return {?}
|
|
500
|
-
*/
|
|
501
|
-
event => {
|
|
233
|
+
const subscription = this._router.events.subscribe(event => {
|
|
502
234
|
this._lastEvent = event;
|
|
503
235
|
if (event instanceof NavigationStart) {
|
|
504
236
|
this._navigationStart(event);
|
|
@@ -529,15 +261,10 @@ let RouterState = RouterState_1 = class RouterState {
|
|
|
529
261
|
}
|
|
530
262
|
this._reset();
|
|
531
263
|
}
|
|
532
|
-
})
|
|
264
|
+
});
|
|
533
265
|
this._subscription.add(subscription);
|
|
534
266
|
}
|
|
535
|
-
/**
|
|
536
|
-
* Reacts to `NavigationStart`.
|
|
537
|
-
* @private
|
|
538
|
-
* @param {?} event
|
|
539
|
-
* @return {?}
|
|
540
|
-
*/
|
|
267
|
+
/** Reacts to `NavigationStart`. */
|
|
541
268
|
_navigationStart(event) {
|
|
542
269
|
this._routerState = this._serializer.serialize(this._router.routerState.snapshot);
|
|
543
270
|
if (this._trigger !== 'none') {
|
|
@@ -545,63 +272,29 @@ let RouterState = RouterState_1 = class RouterState {
|
|
|
545
272
|
this._dispatchRouterAction(new RouterRequest(this._routerState, event, this._trigger));
|
|
546
273
|
}
|
|
547
274
|
}
|
|
548
|
-
/**
|
|
549
|
-
* Reacts to `ResolveEnd`.
|
|
550
|
-
* @private
|
|
551
|
-
* @param {?} event
|
|
552
|
-
* @return {?}
|
|
553
|
-
*/
|
|
275
|
+
/** Reacts to `ResolveEnd`. */
|
|
554
276
|
_dispatchRouterDataResolved(event) {
|
|
555
|
-
/** @type {?} */
|
|
556
277
|
const routerState = this._serializer.serialize(event.state);
|
|
557
278
|
this._dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));
|
|
558
279
|
}
|
|
559
|
-
/**
|
|
560
|
-
* Reacts to `RoutesRecognized` or `NavigationEnd`, depends on the `navigationActionTiming`.
|
|
561
|
-
* @private
|
|
562
|
-
* @param {?} lastRoutesRecognized
|
|
563
|
-
* @return {?}
|
|
564
|
-
*/
|
|
280
|
+
/** Reacts to `RoutesRecognized` or `NavigationEnd`, depends on the `navigationActionTiming`. */
|
|
565
281
|
_dispatchRouterNavigation(lastRoutesRecognized) {
|
|
566
|
-
/** @type {?} */
|
|
567
282
|
const nextRouterState = this._serializer.serialize(lastRoutesRecognized.state);
|
|
568
283
|
this._dispatchRouterAction(new RouterNavigation(nextRouterState, new RoutesRecognized(lastRoutesRecognized.id, lastRoutesRecognized.url, lastRoutesRecognized.urlAfterRedirects, nextRouterState), this._trigger));
|
|
569
284
|
}
|
|
570
|
-
/**
|
|
571
|
-
* Reacts to `NavigationCancel`.
|
|
572
|
-
* @private
|
|
573
|
-
* @param {?} event
|
|
574
|
-
* @return {?}
|
|
575
|
-
*/
|
|
285
|
+
/** Reacts to `NavigationCancel`. */
|
|
576
286
|
_dispatchRouterCancel(event) {
|
|
577
|
-
this._dispatchRouterAction(new RouterCancel(
|
|
578
|
-
}
|
|
579
|
-
/**
|
|
580
|
-
* Reacts to `NavigationEnd`.
|
|
581
|
-
* @private
|
|
582
|
-
* @param {?} event
|
|
583
|
-
* @return {?}
|
|
584
|
-
*/
|
|
287
|
+
this._dispatchRouterAction(new RouterCancel(this._routerState, this._storeState, event, this._trigger));
|
|
288
|
+
}
|
|
289
|
+
/** Reacts to `NavigationEnd`. */
|
|
585
290
|
_dispatchRouterError(event) {
|
|
586
|
-
this._dispatchRouterAction(new RouterError(
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Reacts to `NavigationEnd`.
|
|
590
|
-
* @private
|
|
591
|
-
* @param {?} event
|
|
592
|
-
* @return {?}
|
|
593
|
-
*/
|
|
291
|
+
this._dispatchRouterAction(new RouterError(this._routerState, this._storeState, new NavigationError(event.id, event.url, `${event}`), this._trigger));
|
|
292
|
+
}
|
|
293
|
+
/** Reacts to `NavigationEnd`. */
|
|
594
294
|
_dispatchRouterNavigated(event) {
|
|
595
|
-
/** @type {?} */
|
|
596
295
|
const routerState = this._serializer.serialize(this._router.routerState.snapshot);
|
|
597
296
|
this._dispatchRouterAction(new RouterNavigated(routerState, event, this._trigger));
|
|
598
297
|
}
|
|
599
|
-
/**
|
|
600
|
-
* @private
|
|
601
|
-
* @template T
|
|
602
|
-
* @param {?} action
|
|
603
|
-
* @return {?}
|
|
604
|
-
*/
|
|
605
298
|
_dispatchRouterAction(action) {
|
|
606
299
|
this._trigger = 'router';
|
|
607
300
|
try {
|
|
@@ -611,34 +304,14 @@ let RouterState = RouterState_1 = class RouterState {
|
|
|
611
304
|
this._trigger = 'none';
|
|
612
305
|
}
|
|
613
306
|
}
|
|
614
|
-
/**
|
|
615
|
-
* @private
|
|
616
|
-
* @return {?}
|
|
617
|
-
*/
|
|
618
307
|
_reset() {
|
|
619
308
|
this._trigger = 'none';
|
|
620
309
|
this._storeState = null;
|
|
621
310
|
this._routerState = null;
|
|
622
311
|
}
|
|
623
312
|
};
|
|
624
|
-
RouterState
|
|
625
|
-
|
|
626
|
-
{ type: Router },
|
|
627
|
-
{ type: RouterStateSerializer },
|
|
628
|
-
{ type: NgZone },
|
|
629
|
-
{ type: Injector }
|
|
630
|
-
];
|
|
631
|
-
RouterState.decorators = [
|
|
632
|
-
{ type: Injectable }
|
|
633
|
-
];
|
|
634
|
-
/** @nocollapse */
|
|
635
|
-
RouterState.ctorParameters = () => [
|
|
636
|
-
{ type: Store },
|
|
637
|
-
{ type: Router },
|
|
638
|
-
{ type: RouterStateSerializer },
|
|
639
|
-
{ type: NgZone },
|
|
640
|
-
{ type: Injector }
|
|
641
|
-
];
|
|
313
|
+
/** @nocollapse */ RouterState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RouterState, deps: [{ token: i1.Store }, { token: i2.Router }, { token: RouterStateSerializer }, { token: i0.NgZone }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
314
|
+
/** @nocollapse */ RouterState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RouterState });
|
|
642
315
|
__decorate([
|
|
643
316
|
Action(Navigate),
|
|
644
317
|
__metadata("design:type", Function),
|
|
@@ -685,72 +358,11 @@ RouterState = RouterState_1 = __decorate([
|
|
|
685
358
|
NgZone,
|
|
686
359
|
Injector])
|
|
687
360
|
], RouterState);
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
* or outside via `new Navigate(...)`
|
|
692
|
-
* @type {?}
|
|
693
|
-
* @private
|
|
694
|
-
*/
|
|
695
|
-
RouterState.prototype._trigger;
|
|
696
|
-
/**
|
|
697
|
-
* That's the serialized state from the `Router` class
|
|
698
|
-
* @type {?}
|
|
699
|
-
* @private
|
|
700
|
-
*/
|
|
701
|
-
RouterState.prototype._routerState;
|
|
702
|
-
/**
|
|
703
|
-
* That's the value of the `RouterState` state
|
|
704
|
-
* @type {?}
|
|
705
|
-
* @private
|
|
706
|
-
*/
|
|
707
|
-
RouterState.prototype._storeState;
|
|
708
|
-
/**
|
|
709
|
-
* @type {?}
|
|
710
|
-
* @private
|
|
711
|
-
*/
|
|
712
|
-
RouterState.prototype._lastEvent;
|
|
713
|
-
/**
|
|
714
|
-
* @type {?}
|
|
715
|
-
* @private
|
|
716
|
-
*/
|
|
717
|
-
RouterState.prototype._subscription;
|
|
718
|
-
/**
|
|
719
|
-
* @type {?}
|
|
720
|
-
* @private
|
|
721
|
-
*/
|
|
722
|
-
RouterState.prototype._options;
|
|
723
|
-
/**
|
|
724
|
-
* @type {?}
|
|
725
|
-
* @private
|
|
726
|
-
*/
|
|
727
|
-
RouterState.prototype._store;
|
|
728
|
-
/**
|
|
729
|
-
* @type {?}
|
|
730
|
-
* @private
|
|
731
|
-
*/
|
|
732
|
-
RouterState.prototype._router;
|
|
733
|
-
/**
|
|
734
|
-
* @type {?}
|
|
735
|
-
* @private
|
|
736
|
-
*/
|
|
737
|
-
RouterState.prototype._serializer;
|
|
738
|
-
/**
|
|
739
|
-
* @type {?}
|
|
740
|
-
* @private
|
|
741
|
-
*/
|
|
742
|
-
RouterState.prototype._ngZone;
|
|
743
|
-
}
|
|
361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RouterState, decorators: [{
|
|
362
|
+
type: Injectable
|
|
363
|
+
}], ctorParameters: function () { return [{ type: i1.Store }, { type: i2.Router }, { type: RouterStateSerializer }, { type: i0.NgZone }, { type: i0.Injector }]; }, propDecorators: { navigate: [], angularRouterAction: [] } });
|
|
744
364
|
|
|
745
|
-
/**
|
|
746
|
-
* @fileoverview added by tsickle
|
|
747
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
748
|
-
*/
|
|
749
365
|
class NgxsRouterPluginModule {
|
|
750
|
-
/**
|
|
751
|
-
* @param {?=} options
|
|
752
|
-
* @return {?}
|
|
753
|
-
*/
|
|
754
366
|
static forRoot(options) {
|
|
755
367
|
return {
|
|
756
368
|
ngModule: NgxsRouterPluginModule,
|
|
@@ -766,26 +378,23 @@ class NgxsRouterPluginModule {
|
|
|
766
378
|
};
|
|
767
379
|
}
|
|
768
380
|
}
|
|
769
|
-
NgxsRouterPluginModule
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
*/
|
|
381
|
+
/** @nocollapse */ NgxsRouterPluginModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsRouterPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
382
|
+
/** @nocollapse */ NgxsRouterPluginModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsRouterPluginModule, imports: [i1.ɵNgxsFeatureModule] });
|
|
383
|
+
/** @nocollapse */ NgxsRouterPluginModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsRouterPluginModule, imports: [[NgxsModule.forFeature([RouterState])]] });
|
|
384
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsRouterPluginModule, decorators: [{
|
|
385
|
+
type: NgModule,
|
|
386
|
+
args: [{
|
|
387
|
+
imports: [NgxsModule.forFeature([RouterState])]
|
|
388
|
+
}]
|
|
389
|
+
}] });
|
|
779
390
|
|
|
780
391
|
/**
|
|
781
|
-
*
|
|
782
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
392
|
+
* The public api for consumers of @ngxs/router-plugin
|
|
783
393
|
*/
|
|
784
394
|
|
|
785
395
|
/**
|
|
786
|
-
*
|
|
787
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
396
|
+
* Generated bundle index. Do not edit.
|
|
788
397
|
*/
|
|
789
398
|
|
|
790
|
-
export { DefaultRouterStateSerializer, Navigate, NgxsRouterPluginModule, RouterCancel, RouterDataResolved, RouterError, RouterNavigated, RouterNavigation, RouterRequest, RouterState, RouterStateSerializer
|
|
399
|
+
export { DefaultRouterStateSerializer, Navigate, NgxsRouterPluginModule, RouterCancel, RouterDataResolved, RouterError, RouterNavigated, RouterNavigation, RouterRequest, RouterState, RouterStateSerializer };
|
|
791
400
|
//# sourceMappingURL=ngxs-router-plugin.js.map
|