@ngxs/router-plugin 3.7.3-dev.master-5175b98 → 3.7.3
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 +826 -854
- package/bundles/ngxs-router-plugin.umd.js.map +1 -1
- package/bundles/ngxs-router-plugin.umd.min.js +2 -2
- 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 +437 -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 +523 -552
- package/esm5/src/serializer.js +98 -98
- package/fesm2015/ngxs-router-plugin.js +689 -715
- package/fesm2015/ngxs-router-plugin.js.map +1 -1
- package/fesm5/ngxs-router-plugin.js +831 -860
- package/fesm5/ngxs-router-plugin.js.map +1 -1
- package/index.d.ts +4 -4
- package/ngxs-router-plugin.d.ts +5 -5
- package/ngxs-router-plugin.metadata.json +1 -1
- 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 +58 -60
- package/src/serializer.d.ts +12 -12
|
@@ -4,735 +4,709 @@ import { __decorate, __metadata } from 'tslib';
|
|
|
4
4
|
import { NavigationStart, RoutesRecognized, ResolveEnd, NavigationCancel, NavigationError, NavigationEnd, Router, UrlSerializer } from '@angular/router';
|
|
5
5
|
import { LocationStrategy, Location } from '@angular/common';
|
|
6
6
|
import { isAngularInTestMode } from '@ngxs/store/internals';
|
|
7
|
-
import { Subscription } from 'rxjs';
|
|
8
7
|
import { first } from 'rxjs/operators';
|
|
9
8
|
|
|
10
|
-
/**
|
|
11
|
-
* @fileoverview added by tsickle
|
|
12
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Public event api of the router
|
|
16
|
-
*/
|
|
17
|
-
class Navigate {
|
|
18
|
-
/**
|
|
19
|
-
* @param {?} path
|
|
20
|
-
* @param {?=} queryParams
|
|
21
|
-
* @param {?=} extras
|
|
22
|
-
*/
|
|
23
|
-
constructor(path, queryParams, extras) {
|
|
24
|
-
this.path = path;
|
|
25
|
-
this.queryParams = queryParams;
|
|
26
|
-
this.extras = extras;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @return {?}
|
|
30
|
-
*/
|
|
31
|
-
static get type() {
|
|
32
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
33
|
-
return '[Router] Navigate';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (false) {
|
|
37
|
-
/** @type {?} */
|
|
38
|
-
Navigate.prototype.path;
|
|
39
|
-
/** @type {?} */
|
|
40
|
-
Navigate.prototype.queryParams;
|
|
41
|
-
/** @type {?} */
|
|
42
|
-
Navigate.prototype.extras;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* Angular Routers internal state events
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
/**
|
|
50
|
-
* An action dispatched when the router navigates.
|
|
51
|
-
* @template T
|
|
52
|
-
*/
|
|
53
|
-
class RouterNavigation {
|
|
54
|
-
/**
|
|
55
|
-
* @param {?} routerState
|
|
56
|
-
* @param {?} event
|
|
57
|
-
* @param {?=} trigger
|
|
58
|
-
*/
|
|
59
|
-
constructor(routerState, event, trigger = 'none') {
|
|
60
|
-
this.routerState = routerState;
|
|
61
|
-
this.event = event;
|
|
62
|
-
this.trigger = trigger;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* @return {?}
|
|
66
|
-
*/
|
|
67
|
-
static get type() {
|
|
68
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
69
|
-
return '[Router] RouterNavigation';
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (false) {
|
|
73
|
-
/** @type {?} */
|
|
74
|
-
RouterNavigation.prototype.routerState;
|
|
75
|
-
/** @type {?} */
|
|
76
|
-
RouterNavigation.prototype.event;
|
|
77
|
-
/** @type {?} */
|
|
78
|
-
RouterNavigation.prototype.trigger;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* An action dispatched when the router cancel navigation.
|
|
82
|
-
* @template T, V
|
|
83
|
-
*/
|
|
84
|
-
class RouterCancel {
|
|
85
|
-
/**
|
|
86
|
-
* @param {?} routerState
|
|
87
|
-
* @param {?} storeState
|
|
88
|
-
* @param {?} event
|
|
89
|
-
* @param {?=} trigger
|
|
90
|
-
*/
|
|
91
|
-
constructor(routerState, storeState, event, trigger = 'none') {
|
|
92
|
-
this.routerState = routerState;
|
|
93
|
-
this.storeState = storeState;
|
|
94
|
-
this.event = event;
|
|
95
|
-
this.trigger = trigger;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* @return {?}
|
|
99
|
-
*/
|
|
100
|
-
static get type() {
|
|
101
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
102
|
-
return '[Router] RouterCancel';
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (false) {
|
|
106
|
-
/** @type {?} */
|
|
107
|
-
RouterCancel.prototype.routerState;
|
|
108
|
-
/** @type {?} */
|
|
109
|
-
RouterCancel.prototype.storeState;
|
|
110
|
-
/** @type {?} */
|
|
111
|
-
RouterCancel.prototype.event;
|
|
112
|
-
/** @type {?} */
|
|
113
|
-
RouterCancel.prototype.trigger;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* An action dispatched when the router errors.
|
|
117
|
-
* @template T, V
|
|
118
|
-
*/
|
|
119
|
-
class RouterError {
|
|
120
|
-
/**
|
|
121
|
-
* @param {?} routerState
|
|
122
|
-
* @param {?} storeState
|
|
123
|
-
* @param {?} event
|
|
124
|
-
* @param {?=} trigger
|
|
125
|
-
*/
|
|
126
|
-
constructor(routerState, storeState, event, trigger = 'none') {
|
|
127
|
-
this.routerState = routerState;
|
|
128
|
-
this.storeState = storeState;
|
|
129
|
-
this.event = event;
|
|
130
|
-
this.trigger = trigger;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @return {?}
|
|
134
|
-
*/
|
|
135
|
-
static get type() {
|
|
136
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
137
|
-
return '[Router] RouterError';
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (false) {
|
|
141
|
-
/** @type {?} */
|
|
142
|
-
RouterError.prototype.routerState;
|
|
143
|
-
/** @type {?} */
|
|
144
|
-
RouterError.prototype.storeState;
|
|
145
|
-
/** @type {?} */
|
|
146
|
-
RouterError.prototype.event;
|
|
147
|
-
/** @type {?} */
|
|
148
|
-
RouterError.prototype.trigger;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
152
|
-
* @template T
|
|
153
|
-
*/
|
|
154
|
-
class RouterDataResolved {
|
|
155
|
-
/**
|
|
156
|
-
* @param {?} routerState
|
|
157
|
-
* @param {?} event
|
|
158
|
-
* @param {?=} trigger
|
|
159
|
-
*/
|
|
160
|
-
constructor(routerState, event, trigger = 'none') {
|
|
161
|
-
this.routerState = routerState;
|
|
162
|
-
this.event = event;
|
|
163
|
-
this.trigger = trigger;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* @return {?}
|
|
167
|
-
*/
|
|
168
|
-
static get type() {
|
|
169
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
170
|
-
return '[Router] RouterDataResolved';
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (false) {
|
|
174
|
-
/** @type {?} */
|
|
175
|
-
RouterDataResolved.prototype.routerState;
|
|
176
|
-
/** @type {?} */
|
|
177
|
-
RouterDataResolved.prototype.event;
|
|
178
|
-
/** @type {?} */
|
|
179
|
-
RouterDataResolved.prototype.trigger;
|
|
9
|
+
/**
|
|
10
|
+
* @fileoverview added by tsickle
|
|
11
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Public event api of the router
|
|
15
|
+
*/
|
|
16
|
+
class Navigate {
|
|
17
|
+
/**
|
|
18
|
+
* @param {?} path
|
|
19
|
+
* @param {?=} queryParams
|
|
20
|
+
* @param {?=} extras
|
|
21
|
+
*/
|
|
22
|
+
constructor(path, queryParams, extras) {
|
|
23
|
+
this.path = path;
|
|
24
|
+
this.queryParams = queryParams;
|
|
25
|
+
this.extras = extras;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @return {?}
|
|
29
|
+
*/
|
|
30
|
+
static get type() {
|
|
31
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
32
|
+
return '[Router] Navigate';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (false) {
|
|
36
|
+
/** @type {?} */
|
|
37
|
+
Navigate.prototype.path;
|
|
38
|
+
/** @type {?} */
|
|
39
|
+
Navigate.prototype.queryParams;
|
|
40
|
+
/** @type {?} */
|
|
41
|
+
Navigate.prototype.extras;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* Angular Routers internal state events
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* An action dispatched when the router navigates.
|
|
50
|
+
* @template T
|
|
51
|
+
*/
|
|
52
|
+
class RouterNavigation {
|
|
53
|
+
/**
|
|
54
|
+
* @param {?} routerState
|
|
55
|
+
* @param {?} event
|
|
56
|
+
* @param {?=} trigger
|
|
57
|
+
*/
|
|
58
|
+
constructor(routerState, event, trigger = 'none') {
|
|
59
|
+
this.routerState = routerState;
|
|
60
|
+
this.event = event;
|
|
61
|
+
this.trigger = trigger;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @return {?}
|
|
65
|
+
*/
|
|
66
|
+
static get type() {
|
|
67
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
68
|
+
return '[Router] RouterNavigation';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (false) {
|
|
72
|
+
/** @type {?} */
|
|
73
|
+
RouterNavigation.prototype.routerState;
|
|
74
|
+
/** @type {?} */
|
|
75
|
+
RouterNavigation.prototype.event;
|
|
76
|
+
/** @type {?} */
|
|
77
|
+
RouterNavigation.prototype.trigger;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* An action dispatched when the router cancel navigation.
|
|
81
|
+
* @template T, V
|
|
82
|
+
*/
|
|
83
|
+
class RouterCancel {
|
|
84
|
+
/**
|
|
85
|
+
* @param {?} routerState
|
|
86
|
+
* @param {?} storeState
|
|
87
|
+
* @param {?} event
|
|
88
|
+
* @param {?=} trigger
|
|
89
|
+
*/
|
|
90
|
+
constructor(routerState, storeState, event, trigger = 'none') {
|
|
91
|
+
this.routerState = routerState;
|
|
92
|
+
this.storeState = storeState;
|
|
93
|
+
this.event = event;
|
|
94
|
+
this.trigger = trigger;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @return {?}
|
|
98
|
+
*/
|
|
99
|
+
static get type() {
|
|
100
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
101
|
+
return '[Router] RouterCancel';
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (false) {
|
|
105
|
+
/** @type {?} */
|
|
106
|
+
RouterCancel.prototype.routerState;
|
|
107
|
+
/** @type {?} */
|
|
108
|
+
RouterCancel.prototype.storeState;
|
|
109
|
+
/** @type {?} */
|
|
110
|
+
RouterCancel.prototype.event;
|
|
111
|
+
/** @type {?} */
|
|
112
|
+
RouterCancel.prototype.trigger;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* An action dispatched when the router errors.
|
|
116
|
+
* @template T, V
|
|
117
|
+
*/
|
|
118
|
+
class RouterError {
|
|
119
|
+
/**
|
|
120
|
+
* @param {?} routerState
|
|
121
|
+
* @param {?} storeState
|
|
122
|
+
* @param {?} event
|
|
123
|
+
* @param {?=} trigger
|
|
124
|
+
*/
|
|
125
|
+
constructor(routerState, storeState, event, trigger = 'none') {
|
|
126
|
+
this.routerState = routerState;
|
|
127
|
+
this.storeState = storeState;
|
|
128
|
+
this.event = event;
|
|
129
|
+
this.trigger = trigger;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @return {?}
|
|
133
|
+
*/
|
|
134
|
+
static get type() {
|
|
135
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
136
|
+
return '[Router] RouterError';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (false) {
|
|
140
|
+
/** @type {?} */
|
|
141
|
+
RouterError.prototype.routerState;
|
|
142
|
+
/** @type {?} */
|
|
143
|
+
RouterError.prototype.storeState;
|
|
144
|
+
/** @type {?} */
|
|
145
|
+
RouterError.prototype.event;
|
|
146
|
+
/** @type {?} */
|
|
147
|
+
RouterError.prototype.trigger;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* An action dispatched when the `ResolveEnd` event is triggered.
|
|
151
|
+
* @template T
|
|
152
|
+
*/
|
|
153
|
+
class RouterDataResolved {
|
|
154
|
+
/**
|
|
155
|
+
* @param {?} routerState
|
|
156
|
+
* @param {?} event
|
|
157
|
+
* @param {?=} trigger
|
|
158
|
+
*/
|
|
159
|
+
constructor(routerState, event, trigger = 'none') {
|
|
160
|
+
this.routerState = routerState;
|
|
161
|
+
this.event = event;
|
|
162
|
+
this.trigger = trigger;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @return {?}
|
|
166
|
+
*/
|
|
167
|
+
static get type() {
|
|
168
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
169
|
+
return '[Router] RouterDataResolved';
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (false) {
|
|
173
|
+
/** @type {?} */
|
|
174
|
+
RouterDataResolved.prototype.routerState;
|
|
175
|
+
/** @type {?} */
|
|
176
|
+
RouterDataResolved.prototype.event;
|
|
177
|
+
/** @type {?} */
|
|
178
|
+
RouterDataResolved.prototype.trigger;
|
|
180
179
|
}
|
|
181
180
|
|
|
182
|
-
/**
|
|
183
|
-
* @fileoverview added by tsickle
|
|
184
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
185
|
-
*/
|
|
186
|
-
/**
|
|
187
|
-
* @abstract
|
|
188
|
-
* @template T
|
|
189
|
-
*/
|
|
190
|
-
class RouterStateSerializer {
|
|
191
|
-
}
|
|
192
|
-
if (false) {
|
|
193
|
-
/**
|
|
194
|
-
* @abstract
|
|
195
|
-
* @param {?} routerState
|
|
196
|
-
* @return {?}
|
|
197
|
-
*/
|
|
198
|
-
RouterStateSerializer.prototype.serialize = function (routerState) { };
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* @record
|
|
202
|
-
*/
|
|
203
|
-
function SerializedRouterStateSnapshot() { }
|
|
204
|
-
if (false) {
|
|
205
|
-
/** @type {?} */
|
|
206
|
-
SerializedRouterStateSnapshot.prototype.root;
|
|
207
|
-
/** @type {?} */
|
|
208
|
-
SerializedRouterStateSnapshot.prototype.url;
|
|
209
|
-
}
|
|
210
|
-
class DefaultRouterStateSerializer {
|
|
211
|
-
/**
|
|
212
|
-
* @param {?} routerState
|
|
213
|
-
* @return {?}
|
|
214
|
-
*/
|
|
215
|
-
serialize(routerState) {
|
|
216
|
-
return {
|
|
217
|
-
root: this.serializeRoute(routerState.root),
|
|
218
|
-
url: routerState.url
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* @private
|
|
223
|
-
* @param {?} route
|
|
224
|
-
* @return {?}
|
|
225
|
-
*/
|
|
226
|
-
serializeRoute(route) {
|
|
227
|
-
/** @type {?} */
|
|
228
|
-
const children = route.children.map((/**
|
|
229
|
-
* @param {?} c
|
|
230
|
-
* @return {?}
|
|
231
|
-
*/
|
|
232
|
-
c => this.serializeRoute(c)));
|
|
233
|
-
return {
|
|
234
|
-
url: route.url,
|
|
235
|
-
params: route.params,
|
|
236
|
-
queryParams: route.queryParams,
|
|
237
|
-
fragment: route.fragment,
|
|
238
|
-
data: route.data,
|
|
239
|
-
outlet: route.outlet,
|
|
240
|
-
component: null,
|
|
241
|
-
routeConfig: null,
|
|
242
|
-
root: (/** @type {?} */ (null)),
|
|
243
|
-
parent: null,
|
|
244
|
-
firstChild: children[0],
|
|
245
|
-
children: children,
|
|
246
|
-
pathFromRoot: (/** @type {?} */ (null)),
|
|
247
|
-
paramMap: route.paramMap,
|
|
248
|
-
queryParamMap: route.queryParamMap,
|
|
249
|
-
toString: route.toString
|
|
250
|
-
};
|
|
251
|
-
}
|
|
181
|
+
/**
|
|
182
|
+
* @fileoverview added by tsickle
|
|
183
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* @abstract
|
|
187
|
+
* @template T
|
|
188
|
+
*/
|
|
189
|
+
class RouterStateSerializer {
|
|
190
|
+
}
|
|
191
|
+
if (false) {
|
|
192
|
+
/**
|
|
193
|
+
* @abstract
|
|
194
|
+
* @param {?} routerState
|
|
195
|
+
* @return {?}
|
|
196
|
+
*/
|
|
197
|
+
RouterStateSerializer.prototype.serialize = function (routerState) { };
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @record
|
|
201
|
+
*/
|
|
202
|
+
function SerializedRouterStateSnapshot() { }
|
|
203
|
+
if (false) {
|
|
204
|
+
/** @type {?} */
|
|
205
|
+
SerializedRouterStateSnapshot.prototype.root;
|
|
206
|
+
/** @type {?} */
|
|
207
|
+
SerializedRouterStateSnapshot.prototype.url;
|
|
208
|
+
}
|
|
209
|
+
class DefaultRouterStateSerializer {
|
|
210
|
+
/**
|
|
211
|
+
* @param {?} routerState
|
|
212
|
+
* @return {?}
|
|
213
|
+
*/
|
|
214
|
+
serialize(routerState) {
|
|
215
|
+
return {
|
|
216
|
+
root: this.serializeRoute(routerState.root),
|
|
217
|
+
url: routerState.url
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @private
|
|
222
|
+
* @param {?} route
|
|
223
|
+
* @return {?}
|
|
224
|
+
*/
|
|
225
|
+
serializeRoute(route) {
|
|
226
|
+
/** @type {?} */
|
|
227
|
+
const children = route.children.map((/**
|
|
228
|
+
* @param {?} c
|
|
229
|
+
* @return {?}
|
|
230
|
+
*/
|
|
231
|
+
c => this.serializeRoute(c)));
|
|
232
|
+
return {
|
|
233
|
+
url: route.url,
|
|
234
|
+
params: route.params,
|
|
235
|
+
queryParams: route.queryParams,
|
|
236
|
+
fragment: route.fragment,
|
|
237
|
+
data: route.data,
|
|
238
|
+
outlet: route.outlet,
|
|
239
|
+
component: null,
|
|
240
|
+
routeConfig: null,
|
|
241
|
+
root: (/** @type {?} */ (null)),
|
|
242
|
+
parent: null,
|
|
243
|
+
firstChild: children[0],
|
|
244
|
+
children: children,
|
|
245
|
+
pathFromRoot: (/** @type {?} */ (null)),
|
|
246
|
+
paramMap: route.paramMap,
|
|
247
|
+
queryParamMap: route.queryParamMap,
|
|
248
|
+
toString: route.toString
|
|
249
|
+
};
|
|
250
|
+
}
|
|
252
251
|
}
|
|
253
252
|
|
|
254
|
-
var RouterState_1;
|
|
255
|
-
/**
|
|
256
|
-
* @record
|
|
257
|
-
* @template T
|
|
258
|
-
*/
|
|
259
|
-
function RouterStateModel() { }
|
|
260
|
-
if (false) {
|
|
261
|
-
/** @type {?|undefined} */
|
|
262
|
-
RouterStateModel.prototype.state;
|
|
263
|
-
/** @type {?|undefined} */
|
|
264
|
-
RouterStateModel.prototype.navigationId;
|
|
265
|
-
/** @type {?} */
|
|
266
|
-
RouterStateModel.prototype.trigger;
|
|
267
|
-
}
|
|
268
|
-
let RouterState = RouterState_1 = class RouterState {
|
|
269
|
-
/**
|
|
270
|
-
* @param {?} _store
|
|
271
|
-
* @param {?} _router
|
|
272
|
-
* @param {?} _serializer
|
|
273
|
-
* @param {?} _ngZone
|
|
274
|
-
* @param {?} _urlSerializer
|
|
275
|
-
* @param {?} _locationStrategy
|
|
276
|
-
* @param {?} _location
|
|
277
|
-
*/
|
|
278
|
-
constructor(_store, _router, _serializer, _ngZone, _urlSerializer, _locationStrategy, _location) {
|
|
279
|
-
this._store = _store;
|
|
280
|
-
this._router = _router;
|
|
281
|
-
this._serializer = _serializer;
|
|
282
|
-
this._ngZone = _ngZone;
|
|
283
|
-
this._urlSerializer = _urlSerializer;
|
|
284
|
-
this._locationStrategy = _locationStrategy;
|
|
285
|
-
this._location = _location;
|
|
286
|
-
/**
|
|
287
|
-
* Determines how navigation was performed by the `RouterState` itself
|
|
288
|
-
* or outside via `new Navigate(...)`
|
|
289
|
-
*/
|
|
290
|
-
this._trigger = 'none';
|
|
291
|
-
/**
|
|
292
|
-
* That's the serialized state from the `Router` class
|
|
293
|
-
*/
|
|
294
|
-
this._routerState = null;
|
|
295
|
-
/**
|
|
296
|
-
* That's the value of the `RouterState` state
|
|
297
|
-
*/
|
|
298
|
-
this._storeState = null;
|
|
299
|
-
this._lastRoutesRecognized = (/** @type {?} */ (null));
|
|
300
|
-
this.
|
|
301
|
-
this.
|
|
302
|
-
this.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
* @
|
|
307
|
-
* @
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
* @
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
* @
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
* @
|
|
340
|
-
* @return {?}
|
|
341
|
-
*/
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
this.
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
this.
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
* @
|
|
477
|
-
* @
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* @
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
this.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
//
|
|
519
|
-
//
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
.
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
.
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
//
|
|
540
|
-
//
|
|
541
|
-
//
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
//
|
|
545
|
-
//
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
]
|
|
584
|
-
|
|
585
|
-
RouterState.
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
__metadata("design:
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
*
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
* @
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
* @type {?}
|
|
652
|
-
* @private
|
|
653
|
-
*/
|
|
654
|
-
RouterState.prototype.
|
|
655
|
-
/**
|
|
656
|
-
* @type {?}
|
|
657
|
-
* @private
|
|
658
|
-
*/
|
|
659
|
-
RouterState.prototype.
|
|
660
|
-
/**
|
|
661
|
-
* @type {?}
|
|
662
|
-
* @private
|
|
663
|
-
*/
|
|
664
|
-
RouterState.prototype.
|
|
665
|
-
/**
|
|
666
|
-
* @type {?}
|
|
667
|
-
* @private
|
|
668
|
-
*/
|
|
669
|
-
RouterState.prototype.
|
|
670
|
-
/**
|
|
671
|
-
* @type {?}
|
|
672
|
-
* @private
|
|
673
|
-
*/
|
|
674
|
-
RouterState.prototype.
|
|
675
|
-
/**
|
|
676
|
-
* @type {?}
|
|
677
|
-
* @private
|
|
678
|
-
*/
|
|
679
|
-
RouterState.prototype._serializer;
|
|
680
|
-
/**
|
|
681
|
-
* @type {?}
|
|
682
|
-
* @private
|
|
683
|
-
*/
|
|
684
|
-
RouterState.prototype._ngZone;
|
|
685
|
-
/**
|
|
686
|
-
* @type {?}
|
|
687
|
-
* @private
|
|
688
|
-
*/
|
|
689
|
-
RouterState.prototype._urlSerializer;
|
|
690
|
-
/**
|
|
691
|
-
* @type {?}
|
|
692
|
-
* @private
|
|
693
|
-
*/
|
|
694
|
-
RouterState.prototype._locationStrategy;
|
|
695
|
-
/**
|
|
696
|
-
* @type {?}
|
|
697
|
-
* @private
|
|
698
|
-
*/
|
|
699
|
-
RouterState.prototype._location;
|
|
253
|
+
var RouterState_1;
|
|
254
|
+
/**
|
|
255
|
+
* @record
|
|
256
|
+
* @template T
|
|
257
|
+
*/
|
|
258
|
+
function RouterStateModel() { }
|
|
259
|
+
if (false) {
|
|
260
|
+
/** @type {?|undefined} */
|
|
261
|
+
RouterStateModel.prototype.state;
|
|
262
|
+
/** @type {?|undefined} */
|
|
263
|
+
RouterStateModel.prototype.navigationId;
|
|
264
|
+
/** @type {?} */
|
|
265
|
+
RouterStateModel.prototype.trigger;
|
|
266
|
+
}
|
|
267
|
+
let RouterState = RouterState_1 = class RouterState {
|
|
268
|
+
/**
|
|
269
|
+
* @param {?} _store
|
|
270
|
+
* @param {?} _router
|
|
271
|
+
* @param {?} _serializer
|
|
272
|
+
* @param {?} _ngZone
|
|
273
|
+
* @param {?} _urlSerializer
|
|
274
|
+
* @param {?} _locationStrategy
|
|
275
|
+
* @param {?} _location
|
|
276
|
+
*/
|
|
277
|
+
constructor(_store, _router, _serializer, _ngZone, _urlSerializer, _locationStrategy, _location) {
|
|
278
|
+
this._store = _store;
|
|
279
|
+
this._router = _router;
|
|
280
|
+
this._serializer = _serializer;
|
|
281
|
+
this._ngZone = _ngZone;
|
|
282
|
+
this._urlSerializer = _urlSerializer;
|
|
283
|
+
this._locationStrategy = _locationStrategy;
|
|
284
|
+
this._location = _location;
|
|
285
|
+
/**
|
|
286
|
+
* Determines how navigation was performed by the `RouterState` itself
|
|
287
|
+
* or outside via `new Navigate(...)`
|
|
288
|
+
*/
|
|
289
|
+
this._trigger = 'none';
|
|
290
|
+
/**
|
|
291
|
+
* That's the serialized state from the `Router` class
|
|
292
|
+
*/
|
|
293
|
+
this._routerState = null;
|
|
294
|
+
/**
|
|
295
|
+
* That's the value of the `RouterState` state
|
|
296
|
+
*/
|
|
297
|
+
this._storeState = null;
|
|
298
|
+
this._lastRoutesRecognized = (/** @type {?} */ (null));
|
|
299
|
+
this.setUpStoreListener();
|
|
300
|
+
this.setUpRouterEventsListener();
|
|
301
|
+
this.checkInitialNavigationOnce();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @template T
|
|
305
|
+
* @param {?} state
|
|
306
|
+
* @return {?}
|
|
307
|
+
*/
|
|
308
|
+
static state(state) {
|
|
309
|
+
return state && state.state;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* @param {?} state
|
|
313
|
+
* @return {?}
|
|
314
|
+
*/
|
|
315
|
+
static url(state) {
|
|
316
|
+
return state && state.state && state.state.url;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* @param {?} _
|
|
320
|
+
* @param {?} action
|
|
321
|
+
* @return {?}
|
|
322
|
+
*/
|
|
323
|
+
navigate(_, action) {
|
|
324
|
+
return this._ngZone.run((/**
|
|
325
|
+
* @return {?}
|
|
326
|
+
*/
|
|
327
|
+
() => this._router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras))));
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* @param {?} ctx
|
|
331
|
+
* @param {?} action
|
|
332
|
+
* @return {?}
|
|
333
|
+
*/
|
|
334
|
+
angularRouterAction(ctx, action) {
|
|
335
|
+
ctx.setState(Object.assign({}, ctx.getState(), { trigger: action.trigger, state: action.routerState, navigationId: action.event.id }));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* @private
|
|
339
|
+
* @return {?}
|
|
340
|
+
*/
|
|
341
|
+
setUpStoreListener() {
|
|
342
|
+
this._store.select(RouterState_1).subscribe((/**
|
|
343
|
+
* @param {?} state
|
|
344
|
+
* @return {?}
|
|
345
|
+
*/
|
|
346
|
+
(state) => {
|
|
347
|
+
this.navigateIfNeeded(state);
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* @private
|
|
352
|
+
* @return {?}
|
|
353
|
+
*/
|
|
354
|
+
setUpRouterEventsListener() {
|
|
355
|
+
this._router.events.subscribe((/**
|
|
356
|
+
* @param {?} event
|
|
357
|
+
* @return {?}
|
|
358
|
+
*/
|
|
359
|
+
event => {
|
|
360
|
+
if (event instanceof NavigationStart) {
|
|
361
|
+
this.navigationStart();
|
|
362
|
+
}
|
|
363
|
+
else if (event instanceof RoutesRecognized) {
|
|
364
|
+
this._lastRoutesRecognized = event;
|
|
365
|
+
}
|
|
366
|
+
else if (event instanceof ResolveEnd) {
|
|
367
|
+
this.dispatchRouterDataResolved(event);
|
|
368
|
+
}
|
|
369
|
+
else if (event instanceof NavigationCancel) {
|
|
370
|
+
this.dispatchRouterCancel(event);
|
|
371
|
+
this.reset();
|
|
372
|
+
}
|
|
373
|
+
else if (event instanceof NavigationError) {
|
|
374
|
+
this.dispatchRouterError(event);
|
|
375
|
+
this.reset();
|
|
376
|
+
}
|
|
377
|
+
else if (event instanceof NavigationEnd) {
|
|
378
|
+
this.navigationEnd();
|
|
379
|
+
this.reset();
|
|
380
|
+
}
|
|
381
|
+
}));
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* @private
|
|
385
|
+
* @return {?}
|
|
386
|
+
*/
|
|
387
|
+
navigationStart() {
|
|
388
|
+
this._routerState = this._serializer.serialize(this._router.routerState.snapshot);
|
|
389
|
+
if (this._trigger !== 'none') {
|
|
390
|
+
this._storeState = this._store.selectSnapshot(RouterState_1);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* @private
|
|
395
|
+
* @return {?}
|
|
396
|
+
*/
|
|
397
|
+
navigationEnd() {
|
|
398
|
+
if (this.shouldDispatchRouterNavigation()) {
|
|
399
|
+
this.dispatchRouterNavigation();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* @private
|
|
404
|
+
* @return {?}
|
|
405
|
+
*/
|
|
406
|
+
shouldDispatchRouterNavigation() {
|
|
407
|
+
if (!this._storeState)
|
|
408
|
+
return true;
|
|
409
|
+
return this._trigger !== 'store';
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* @private
|
|
413
|
+
* @param {?} state
|
|
414
|
+
* @return {?}
|
|
415
|
+
*/
|
|
416
|
+
navigateIfNeeded(state) {
|
|
417
|
+
/** @type {?} */
|
|
418
|
+
const canSkipNavigation = !this._storeState ||
|
|
419
|
+
!this._storeState.state ||
|
|
420
|
+
!state ||
|
|
421
|
+
state.trigger === 'router' ||
|
|
422
|
+
this._router.url === this._storeState.state.url;
|
|
423
|
+
if (canSkipNavigation) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
this._trigger = 'store';
|
|
427
|
+
this._ngZone.run((/**
|
|
428
|
+
* @return {?}
|
|
429
|
+
*/
|
|
430
|
+
() => {
|
|
431
|
+
this._router.navigateByUrl((/** @type {?} */ ((/** @type {?} */ (this._storeState)).state)).url);
|
|
432
|
+
}));
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* @private
|
|
436
|
+
* @return {?}
|
|
437
|
+
*/
|
|
438
|
+
dispatchRouterNavigation() {
|
|
439
|
+
/** @type {?} */
|
|
440
|
+
const nextRouterState = this._serializer.serialize(this._lastRoutesRecognized.state);
|
|
441
|
+
this.dispatchRouterAction(new RouterNavigation(nextRouterState, new RoutesRecognized(this._lastRoutesRecognized.id, this._lastRoutesRecognized.url, this._lastRoutesRecognized.urlAfterRedirects, nextRouterState), this._trigger));
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @private
|
|
445
|
+
* @param {?} event
|
|
446
|
+
* @return {?}
|
|
447
|
+
*/
|
|
448
|
+
dispatchRouterCancel(event) {
|
|
449
|
+
this.dispatchRouterAction(new RouterCancel((/** @type {?} */ (this._routerState)), this._storeState, event, this._trigger));
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* @private
|
|
453
|
+
* @param {?} event
|
|
454
|
+
* @return {?}
|
|
455
|
+
*/
|
|
456
|
+
dispatchRouterError(event) {
|
|
457
|
+
this.dispatchRouterAction(new RouterError((/** @type {?} */ (this._routerState)), this._storeState, new NavigationError(event.id, event.url, `${event}`), this._trigger));
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* @private
|
|
461
|
+
* @template T
|
|
462
|
+
* @param {?} action
|
|
463
|
+
* @return {?}
|
|
464
|
+
*/
|
|
465
|
+
dispatchRouterAction(action) {
|
|
466
|
+
this._trigger = 'router';
|
|
467
|
+
try {
|
|
468
|
+
this._store.dispatch(action);
|
|
469
|
+
}
|
|
470
|
+
finally {
|
|
471
|
+
this._trigger = 'none';
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* @private
|
|
476
|
+
* @param {?} event
|
|
477
|
+
* @return {?}
|
|
478
|
+
*/
|
|
479
|
+
dispatchRouterDataResolved(event) {
|
|
480
|
+
/** @type {?} */
|
|
481
|
+
const routerState = this._serializer.serialize(event.state);
|
|
482
|
+
this.dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* @private
|
|
486
|
+
* @return {?}
|
|
487
|
+
*/
|
|
488
|
+
reset() {
|
|
489
|
+
this._trigger = 'none';
|
|
490
|
+
this._storeState = null;
|
|
491
|
+
this._routerState = null;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
495
|
+
* to perform this check only once and unsubscribe after the first event
|
|
496
|
+
* is triggered
|
|
497
|
+
* @private
|
|
498
|
+
* @return {?}
|
|
499
|
+
*/
|
|
500
|
+
checkInitialNavigationOnce() {
|
|
501
|
+
if (isAngularInTestMode()) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
this._router.events
|
|
505
|
+
.pipe(first((/**
|
|
506
|
+
* @param {?} event
|
|
507
|
+
* @return {?}
|
|
508
|
+
*/
|
|
509
|
+
(event) => event instanceof RoutesRecognized)))
|
|
510
|
+
.subscribe((/**
|
|
511
|
+
* @param {?} __0
|
|
512
|
+
* @return {?}
|
|
513
|
+
*/
|
|
514
|
+
({ url }) => {
|
|
515
|
+
// `location.pathname` always equals manually entered URL in the address bar
|
|
516
|
+
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
517
|
+
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
518
|
+
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
519
|
+
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
520
|
+
// `location.pathname` always equals manually entered URL in the address bar
|
|
521
|
+
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
522
|
+
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
523
|
+
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
524
|
+
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
525
|
+
// `url` is a recognized URL by the Angular's router, while `currentUrl` is an actual URL
|
|
526
|
+
// entered in the browser's address bar
|
|
527
|
+
// `PathLocationStrategy.prototype.path()` returns a concatenation of
|
|
528
|
+
// `PlatformLocation.pathname` and normalized `PlatformLocation.search`.
|
|
529
|
+
// `Location.prototype.normalize` strips base href from the URL,
|
|
530
|
+
// if `baseHref` (declared in angular.json) for example is `/en`
|
|
531
|
+
// and the URL is `/test#anchor` - then `_locationStrategy.path(true)` will return `/en/test#anchor`,
|
|
532
|
+
// but `/en/test#anchor` is not known to the Angular's router, so we have to strip `/en`
|
|
533
|
+
// from the URL
|
|
534
|
+
/** @type {?} */
|
|
535
|
+
const currentUrl = this._location.normalize(this._locationStrategy.path(true));
|
|
536
|
+
/** @type {?} */
|
|
537
|
+
const currentUrlTree = this._urlSerializer.parse(currentUrl);
|
|
538
|
+
// We need to serialize the URL because in that example `/test/?redirect=https://google.com/`
|
|
539
|
+
// Angular will recognize it as `/test?redirect=https:%2F%2Fwww.google.com%2F`
|
|
540
|
+
// so we have to run the `currentUrl` via the `UrlSerializer` that will encode characters
|
|
541
|
+
/** @type {?} */
|
|
542
|
+
const currentSerializedUrl = this._urlSerializer.serialize(currentUrlTree);
|
|
543
|
+
// If URLs differ from each other - we've got to perform a redirect to the manually entered URL
|
|
544
|
+
// in the address bar, as it must have a priority
|
|
545
|
+
if (currentSerializedUrl !== url) {
|
|
546
|
+
this._router.navigateByUrl(currentUrl);
|
|
547
|
+
}
|
|
548
|
+
}));
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
RouterState.ctorParameters = () => [
|
|
552
|
+
{ type: Store },
|
|
553
|
+
{ type: Router },
|
|
554
|
+
{ type: RouterStateSerializer },
|
|
555
|
+
{ type: NgZone },
|
|
556
|
+
{ type: UrlSerializer },
|
|
557
|
+
{ type: LocationStrategy },
|
|
558
|
+
{ type: Location }
|
|
559
|
+
];
|
|
560
|
+
RouterState.decorators = [
|
|
561
|
+
{ type: Injectable }
|
|
562
|
+
];
|
|
563
|
+
/** @nocollapse */
|
|
564
|
+
RouterState.ctorParameters = () => [
|
|
565
|
+
{ type: Store },
|
|
566
|
+
{ type: Router },
|
|
567
|
+
{ type: RouterStateSerializer },
|
|
568
|
+
{ type: NgZone },
|
|
569
|
+
{ type: UrlSerializer },
|
|
570
|
+
{ type: LocationStrategy },
|
|
571
|
+
{ type: Location }
|
|
572
|
+
];
|
|
573
|
+
__decorate([
|
|
574
|
+
Action(Navigate),
|
|
575
|
+
__metadata("design:type", Function),
|
|
576
|
+
__metadata("design:paramtypes", [Object, Navigate]),
|
|
577
|
+
__metadata("design:returntype", void 0)
|
|
578
|
+
], RouterState.prototype, "navigate", null);
|
|
579
|
+
__decorate([
|
|
580
|
+
Action([RouterNavigation, RouterError, RouterCancel, RouterDataResolved]),
|
|
581
|
+
__metadata("design:type", Function),
|
|
582
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
583
|
+
__metadata("design:returntype", void 0)
|
|
584
|
+
], RouterState.prototype, "angularRouterAction", null);
|
|
585
|
+
__decorate([
|
|
586
|
+
Selector(),
|
|
587
|
+
__metadata("design:type", Function),
|
|
588
|
+
__metadata("design:paramtypes", [Object]),
|
|
589
|
+
__metadata("design:returntype", void 0)
|
|
590
|
+
], RouterState, "state", null);
|
|
591
|
+
__decorate([
|
|
592
|
+
Selector(),
|
|
593
|
+
__metadata("design:type", Function),
|
|
594
|
+
__metadata("design:paramtypes", [Object]),
|
|
595
|
+
__metadata("design:returntype", Object)
|
|
596
|
+
], RouterState, "url", null);
|
|
597
|
+
RouterState = RouterState_1 = __decorate([
|
|
598
|
+
State({
|
|
599
|
+
name: 'router',
|
|
600
|
+
defaults: {
|
|
601
|
+
state: undefined,
|
|
602
|
+
navigationId: undefined,
|
|
603
|
+
trigger: 'none'
|
|
604
|
+
}
|
|
605
|
+
}),
|
|
606
|
+
__metadata("design:paramtypes", [Store,
|
|
607
|
+
Router,
|
|
608
|
+
RouterStateSerializer,
|
|
609
|
+
NgZone,
|
|
610
|
+
UrlSerializer,
|
|
611
|
+
LocationStrategy,
|
|
612
|
+
Location])
|
|
613
|
+
], RouterState);
|
|
614
|
+
if (false) {
|
|
615
|
+
/**
|
|
616
|
+
* Determines how navigation was performed by the `RouterState` itself
|
|
617
|
+
* or outside via `new Navigate(...)`
|
|
618
|
+
* @type {?}
|
|
619
|
+
* @private
|
|
620
|
+
*/
|
|
621
|
+
RouterState.prototype._trigger;
|
|
622
|
+
/**
|
|
623
|
+
* That's the serialized state from the `Router` class
|
|
624
|
+
* @type {?}
|
|
625
|
+
* @private
|
|
626
|
+
*/
|
|
627
|
+
RouterState.prototype._routerState;
|
|
628
|
+
/**
|
|
629
|
+
* That's the value of the `RouterState` state
|
|
630
|
+
* @type {?}
|
|
631
|
+
* @private
|
|
632
|
+
*/
|
|
633
|
+
RouterState.prototype._storeState;
|
|
634
|
+
/**
|
|
635
|
+
* @type {?}
|
|
636
|
+
* @private
|
|
637
|
+
*/
|
|
638
|
+
RouterState.prototype._lastRoutesRecognized;
|
|
639
|
+
/**
|
|
640
|
+
* @type {?}
|
|
641
|
+
* @private
|
|
642
|
+
*/
|
|
643
|
+
RouterState.prototype._store;
|
|
644
|
+
/**
|
|
645
|
+
* @type {?}
|
|
646
|
+
* @private
|
|
647
|
+
*/
|
|
648
|
+
RouterState.prototype._router;
|
|
649
|
+
/**
|
|
650
|
+
* @type {?}
|
|
651
|
+
* @private
|
|
652
|
+
*/
|
|
653
|
+
RouterState.prototype._serializer;
|
|
654
|
+
/**
|
|
655
|
+
* @type {?}
|
|
656
|
+
* @private
|
|
657
|
+
*/
|
|
658
|
+
RouterState.prototype._ngZone;
|
|
659
|
+
/**
|
|
660
|
+
* @type {?}
|
|
661
|
+
* @private
|
|
662
|
+
*/
|
|
663
|
+
RouterState.prototype._urlSerializer;
|
|
664
|
+
/**
|
|
665
|
+
* @type {?}
|
|
666
|
+
* @private
|
|
667
|
+
*/
|
|
668
|
+
RouterState.prototype._locationStrategy;
|
|
669
|
+
/**
|
|
670
|
+
* @type {?}
|
|
671
|
+
* @private
|
|
672
|
+
*/
|
|
673
|
+
RouterState.prototype._location;
|
|
700
674
|
}
|
|
701
675
|
|
|
702
|
-
/**
|
|
703
|
-
* @fileoverview added by tsickle
|
|
704
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
705
|
-
*/
|
|
706
|
-
class NgxsRouterPluginModule {
|
|
707
|
-
/**
|
|
708
|
-
* @return {?}
|
|
709
|
-
*/
|
|
710
|
-
static forRoot() {
|
|
711
|
-
return {
|
|
712
|
-
ngModule: NgxsRouterPluginModule,
|
|
713
|
-
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
NgxsRouterPluginModule.decorators = [
|
|
718
|
-
{ type: NgModule, args: [{
|
|
719
|
-
imports: [NgxsModule.forFeature([RouterState])]
|
|
720
|
-
},] }
|
|
676
|
+
/**
|
|
677
|
+
* @fileoverview added by tsickle
|
|
678
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
679
|
+
*/
|
|
680
|
+
class NgxsRouterPluginModule {
|
|
681
|
+
/**
|
|
682
|
+
* @return {?}
|
|
683
|
+
*/
|
|
684
|
+
static forRoot() {
|
|
685
|
+
return {
|
|
686
|
+
ngModule: NgxsRouterPluginModule,
|
|
687
|
+
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
NgxsRouterPluginModule.decorators = [
|
|
692
|
+
{ type: NgModule, args: [{
|
|
693
|
+
imports: [NgxsModule.forFeature([RouterState])]
|
|
694
|
+
},] }
|
|
721
695
|
];
|
|
722
696
|
|
|
723
|
-
/**
|
|
724
|
-
* @fileoverview added by tsickle
|
|
725
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
697
|
+
/**
|
|
698
|
+
* @fileoverview added by tsickle
|
|
699
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
726
700
|
*/
|
|
727
701
|
|
|
728
|
-
/**
|
|
729
|
-
* @fileoverview added by tsickle
|
|
730
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
702
|
+
/**
|
|
703
|
+
* @fileoverview added by tsickle
|
|
704
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
731
705
|
*/
|
|
732
706
|
|
|
733
|
-
/**
|
|
734
|
-
* @fileoverview added by tsickle
|
|
735
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
707
|
+
/**
|
|
708
|
+
* @fileoverview added by tsickle
|
|
709
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
736
710
|
*/
|
|
737
711
|
|
|
738
712
|
export { DefaultRouterStateSerializer, Navigate, NgxsRouterPluginModule, RouterCancel, RouterDataResolved, RouterError, RouterNavigation, RouterState, RouterStateSerializer };
|