@angular/router 21.0.4 → 21.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/_router-chunk.mjs +314 -293
- package/fesm2022/_router-chunk.mjs.map +1 -1
- package/fesm2022/_router_module-chunk.mjs +254 -68
- package/fesm2022/_router_module-chunk.mjs.map +1 -1
- package/fesm2022/router.mjs +2 -2
- package/fesm2022/router.mjs.map +1 -1
- package/fesm2022/testing.mjs +11 -11
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +1 -1
- package/fesm2022/upgrade.mjs.map +1 -1
- package/package.json +7 -4
- package/types/_router_module-chunk.d.ts +22 -3
- package/types/router.d.ts +1 -1
- package/types/testing.d.ts +1 -1
- package/types/upgrade.d.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.
|
|
2
|
+
* @license Angular v21.1.0-next.1
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { DOCUMENT, Location } from '@angular/common';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
|
-
import { ɵisPromise as _isPromise, ɵRuntimeError as _RuntimeError, Injectable,
|
|
9
|
+
import { ɵisPromise as _isPromise, ɵRuntimeError as _RuntimeError, Injectable, InjectionToken, EventEmitter, input, inject, ViewContainerRef, ChangeDetectorRef, Directive, Input, Output, reflectComponentType, Component, runInInjectionContext, ɵisInjectable as _isInjectable, ɵisNgModule as _isNgModule, isStandalone, createEnvironmentInjector, makeEnvironmentProviders, Compiler, NgModuleFactory, ɵresolveComponentResources as _resolveComponentResources, afterNextRender, signal, EnvironmentInjector, DestroyRef, untracked, ɵConsole as _Console, ɵPendingTasksInternal as _PendingTasksInternal, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, ɵformatRuntimeError as _formatRuntimeError } from '@angular/core';
|
|
10
10
|
import { isObservable, from, of, BehaviorSubject, combineLatest, EmptyError, Observable, concat, defer, pipe, throwError, EMPTY, Subject, Subscription } from 'rxjs';
|
|
11
11
|
import { first, map, switchMap, take, startWith, filter, takeUntil, mergeMap, concatMap, tap, catchError, scan, defaultIfEmpty, last as last$1, takeLast, finalize } from 'rxjs/operators';
|
|
12
12
|
import * as i1 from '@angular/platform-browser';
|
|
@@ -42,27 +42,59 @@ class ParamsAsMap {
|
|
|
42
42
|
function convertToParamMap(params) {
|
|
43
43
|
return new ParamsAsMap(params);
|
|
44
44
|
}
|
|
45
|
+
function matchParts(routeParts, urlSegments, posParams) {
|
|
46
|
+
for (let i = 0; i < routeParts.length; i++) {
|
|
47
|
+
const part = routeParts[i];
|
|
48
|
+
const segment = urlSegments[i];
|
|
49
|
+
const isParameter = part[0] === ':';
|
|
50
|
+
if (isParameter) {
|
|
51
|
+
posParams[part.substring(1)] = segment;
|
|
52
|
+
} else if (part !== segment.path) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
45
58
|
function defaultUrlMatcher(segments, segmentGroup, route) {
|
|
46
59
|
const parts = route.path.split('/');
|
|
47
|
-
|
|
60
|
+
const wildcardIndex = parts.indexOf('**');
|
|
61
|
+
if (wildcardIndex === -1) {
|
|
62
|
+
if (parts.length > segments.length) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const posParams = {};
|
|
69
|
+
const consumed = segments.slice(0, parts.length);
|
|
70
|
+
if (!matchParts(parts, consumed, posParams)) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
consumed,
|
|
75
|
+
posParams
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (wildcardIndex !== parts.lastIndexOf('**')) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const pre = parts.slice(0, wildcardIndex);
|
|
82
|
+
const post = parts.slice(wildcardIndex + 1);
|
|
83
|
+
if (pre.length + post.length > segments.length) {
|
|
48
84
|
return null;
|
|
49
85
|
}
|
|
50
|
-
if (route.pathMatch === 'full' &&
|
|
86
|
+
if (route.pathMatch === 'full' && segmentGroup.hasChildren() && route.path !== '**') {
|
|
51
87
|
return null;
|
|
52
88
|
}
|
|
53
89
|
const posParams = {};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
posParams[part.substring(1)] = segment;
|
|
60
|
-
} else if (part !== segment.path) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
90
|
+
if (!matchParts(pre, segments.slice(0, pre.length), posParams)) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
if (!matchParts(post, segments.slice(segments.length - post.length), posParams)) {
|
|
94
|
+
return null;
|
|
63
95
|
}
|
|
64
96
|
return {
|
|
65
|
-
consumed: segments
|
|
97
|
+
consumed: segments,
|
|
66
98
|
posParams
|
|
67
99
|
};
|
|
68
100
|
}
|
|
@@ -276,7 +308,7 @@ function mapChildrenIntoArray(segment, fn) {
|
|
|
276
308
|
class UrlSerializer {
|
|
277
309
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
278
310
|
minVersion: "12.0.0",
|
|
279
|
-
version: "21.0.
|
|
311
|
+
version: "21.1.0-next.1",
|
|
280
312
|
ngImport: i0,
|
|
281
313
|
type: UrlSerializer,
|
|
282
314
|
deps: [],
|
|
@@ -284,7 +316,7 @@ class UrlSerializer {
|
|
|
284
316
|
});
|
|
285
317
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
286
318
|
minVersion: "12.0.0",
|
|
287
|
-
version: "21.0.
|
|
319
|
+
version: "21.1.0-next.1",
|
|
288
320
|
ngImport: i0,
|
|
289
321
|
type: UrlSerializer,
|
|
290
322
|
providedIn: 'root',
|
|
@@ -293,7 +325,7 @@ class UrlSerializer {
|
|
|
293
325
|
}
|
|
294
326
|
i0.ɵɵngDeclareClassMetadata({
|
|
295
327
|
minVersion: "12.0.0",
|
|
296
|
-
version: "21.0.
|
|
328
|
+
version: "21.1.0-next.1",
|
|
297
329
|
ngImport: i0,
|
|
298
330
|
type: UrlSerializer,
|
|
299
331
|
decorators: [{
|
|
@@ -967,6 +999,9 @@ class NavigationCancel extends RouterEvent {
|
|
|
967
999
|
return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;
|
|
968
1000
|
}
|
|
969
1001
|
}
|
|
1002
|
+
function isRedirectingEvent(event) {
|
|
1003
|
+
return event instanceof NavigationCancel && (event.code === NavigationCancellationCode.Redirect || event.code === NavigationCancellationCode.SupersededByNewNavigation);
|
|
1004
|
+
}
|
|
970
1005
|
class NavigationSkipped extends RouterEvent {
|
|
971
1006
|
reason;
|
|
972
1007
|
code;
|
|
@@ -1125,11 +1160,13 @@ class Scroll {
|
|
|
1125
1160
|
routerEvent;
|
|
1126
1161
|
position;
|
|
1127
1162
|
anchor;
|
|
1163
|
+
scrollBehavior;
|
|
1128
1164
|
type = EventType.Scroll;
|
|
1129
|
-
constructor(routerEvent, position, anchor) {
|
|
1165
|
+
constructor(routerEvent, position, anchor, scrollBehavior) {
|
|
1130
1166
|
this.routerEvent = routerEvent;
|
|
1131
1167
|
this.position = position;
|
|
1132
1168
|
this.anchor = anchor;
|
|
1169
|
+
this.scrollBehavior = scrollBehavior;
|
|
1133
1170
|
}
|
|
1134
1171
|
toString() {
|
|
1135
1172
|
const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null;
|
|
@@ -1188,126 +1225,6 @@ function stringifyEvent(routerEvent) {
|
|
|
1188
1225
|
}
|
|
1189
1226
|
}
|
|
1190
1227
|
|
|
1191
|
-
function getOrCreateRouteInjectorIfNeeded(route, currentInjector) {
|
|
1192
|
-
if (route.providers && !route._injector) {
|
|
1193
|
-
route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
|
|
1194
|
-
}
|
|
1195
|
-
return route._injector ?? currentInjector;
|
|
1196
|
-
}
|
|
1197
|
-
function validateConfig(config, parentPath = '', requireStandaloneComponents = false) {
|
|
1198
|
-
for (let i = 0; i < config.length; i++) {
|
|
1199
|
-
const route = config[i];
|
|
1200
|
-
const fullPath = getFullPath(parentPath, route);
|
|
1201
|
-
validateNode(route, fullPath, requireStandaloneComponents);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
function assertStandalone(fullPath, component) {
|
|
1205
|
-
if (component && _isNgModule(component)) {
|
|
1206
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` + `but it must be used with standalone components. Use 'loadChildren' instead.`);
|
|
1207
|
-
} else if (component && !isStandalone(component)) {
|
|
1208
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
1212
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1213
|
-
if (!route) {
|
|
1214
|
-
throw new _RuntimeError(4014, `
|
|
1215
|
-
Invalid configuration of route '${fullPath}': Encountered undefined route.
|
|
1216
|
-
The reason might be an extra comma.
|
|
1217
|
-
|
|
1218
|
-
Example:
|
|
1219
|
-
const routes: Routes = [
|
|
1220
|
-
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
|
|
1221
|
-
{ path: 'dashboard', component: DashboardComponent },, << two commas
|
|
1222
|
-
{ path: 'detail/:id', component: HeroDetailComponent }
|
|
1223
|
-
];
|
|
1224
|
-
`);
|
|
1225
|
-
}
|
|
1226
|
-
if (Array.isArray(route)) {
|
|
1227
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
|
|
1228
|
-
}
|
|
1229
|
-
if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {
|
|
1230
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
|
|
1231
|
-
}
|
|
1232
|
-
if (route.redirectTo && route.children) {
|
|
1233
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
|
|
1234
|
-
}
|
|
1235
|
-
if (route.redirectTo && route.loadChildren) {
|
|
1236
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
|
|
1237
|
-
}
|
|
1238
|
-
if (route.children && route.loadChildren) {
|
|
1239
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
|
|
1240
|
-
}
|
|
1241
|
-
if (route.component && route.loadComponent) {
|
|
1242
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
|
|
1243
|
-
}
|
|
1244
|
-
if (route.redirectTo) {
|
|
1245
|
-
if (route.component || route.loadComponent) {
|
|
1246
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
|
|
1247
|
-
}
|
|
1248
|
-
if (route.canMatch || route.canActivate) {
|
|
1249
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and ${route.canMatch ? 'canMatch' : 'canActivate'} cannot be used together.` + `Redirects happen before guards are executed.`);
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
if (route.path && route.matcher) {
|
|
1253
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
|
|
1254
|
-
}
|
|
1255
|
-
if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {
|
|
1256
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
|
|
1257
|
-
}
|
|
1258
|
-
if (route.path === void 0 && route.matcher === void 0) {
|
|
1259
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
|
|
1260
|
-
}
|
|
1261
|
-
if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
|
|
1262
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
|
|
1263
|
-
}
|
|
1264
|
-
if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
|
|
1265
|
-
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
|
|
1266
|
-
throw new _RuntimeError(4014, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
|
1267
|
-
}
|
|
1268
|
-
if (requireStandaloneComponents) {
|
|
1269
|
-
assertStandalone(fullPath, route.component);
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
if (route.children) {
|
|
1273
|
-
validateConfig(route.children, fullPath, requireStandaloneComponents);
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
function getFullPath(parentPath, currentRoute) {
|
|
1277
|
-
if (!currentRoute) {
|
|
1278
|
-
return parentPath;
|
|
1279
|
-
}
|
|
1280
|
-
if (!parentPath && !currentRoute.path) {
|
|
1281
|
-
return '';
|
|
1282
|
-
} else if (parentPath && !currentRoute.path) {
|
|
1283
|
-
return `${parentPath}/`;
|
|
1284
|
-
} else if (!parentPath && currentRoute.path) {
|
|
1285
|
-
return currentRoute.path;
|
|
1286
|
-
} else {
|
|
1287
|
-
return `${parentPath}/${currentRoute.path}`;
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
function getOutlet(route) {
|
|
1291
|
-
return route.outlet || PRIMARY_OUTLET;
|
|
1292
|
-
}
|
|
1293
|
-
function sortByMatchingOutlets(routes, outletName) {
|
|
1294
|
-
const sortedConfig = routes.filter(r => getOutlet(r) === outletName);
|
|
1295
|
-
sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));
|
|
1296
|
-
return sortedConfig;
|
|
1297
|
-
}
|
|
1298
|
-
function getClosestRouteInjector(snapshot) {
|
|
1299
|
-
if (!snapshot) return null;
|
|
1300
|
-
if (snapshot.routeConfig?._injector) {
|
|
1301
|
-
return snapshot.routeConfig._injector;
|
|
1302
|
-
}
|
|
1303
|
-
for (let s = snapshot.parent; s; s = s.parent) {
|
|
1304
|
-
const route = s.routeConfig;
|
|
1305
|
-
if (route?._loadedInjector) return route._loadedInjector;
|
|
1306
|
-
if (route?._injector) return route._injector;
|
|
1307
|
-
}
|
|
1308
|
-
return null;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
1228
|
class OutletContext {
|
|
1312
1229
|
rootInjector;
|
|
1313
1230
|
outlet = null;
|
|
@@ -1315,7 +1232,7 @@ class OutletContext {
|
|
|
1315
1232
|
children;
|
|
1316
1233
|
attachRef = null;
|
|
1317
1234
|
get injector() {
|
|
1318
|
-
return
|
|
1235
|
+
return this.route?.snapshot._environmentInjector ?? this.rootInjector;
|
|
1319
1236
|
}
|
|
1320
1237
|
constructor(rootInjector) {
|
|
1321
1238
|
this.rootInjector = rootInjector;
|
|
@@ -1361,7 +1278,7 @@ class ChildrenOutletContexts {
|
|
|
1361
1278
|
}
|
|
1362
1279
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1363
1280
|
minVersion: "12.0.0",
|
|
1364
|
-
version: "21.0.
|
|
1281
|
+
version: "21.1.0-next.1",
|
|
1365
1282
|
ngImport: i0,
|
|
1366
1283
|
type: ChildrenOutletContexts,
|
|
1367
1284
|
deps: [{
|
|
@@ -1371,7 +1288,7 @@ class ChildrenOutletContexts {
|
|
|
1371
1288
|
});
|
|
1372
1289
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1373
1290
|
minVersion: "12.0.0",
|
|
1374
|
-
version: "21.0.
|
|
1291
|
+
version: "21.1.0-next.1",
|
|
1375
1292
|
ngImport: i0,
|
|
1376
1293
|
type: ChildrenOutletContexts,
|
|
1377
1294
|
providedIn: 'root'
|
|
@@ -1379,7 +1296,7 @@ class ChildrenOutletContexts {
|
|
|
1379
1296
|
}
|
|
1380
1297
|
i0.ɵɵngDeclareClassMetadata({
|
|
1381
1298
|
minVersion: "12.0.0",
|
|
1382
|
-
version: "21.0.
|
|
1299
|
+
version: "21.1.0-next.1",
|
|
1383
1300
|
ngImport: i0,
|
|
1384
1301
|
type: ChildrenOutletContexts,
|
|
1385
1302
|
decorators: [{
|
|
@@ -1472,8 +1389,8 @@ class RouterState extends Tree {
|
|
|
1472
1389
|
return this.snapshot.toString();
|
|
1473
1390
|
}
|
|
1474
1391
|
}
|
|
1475
|
-
function createEmptyState(rootComponent) {
|
|
1476
|
-
const snapshot = createEmptyStateSnapshot(rootComponent);
|
|
1392
|
+
function createEmptyState(rootComponent, injector) {
|
|
1393
|
+
const snapshot = createEmptyStateSnapshot(rootComponent, injector);
|
|
1477
1394
|
const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);
|
|
1478
1395
|
const emptyParams = new BehaviorSubject({});
|
|
1479
1396
|
const emptyData = new BehaviorSubject({});
|
|
@@ -1483,12 +1400,12 @@ function createEmptyState(rootComponent) {
|
|
|
1483
1400
|
activated.snapshot = snapshot.root;
|
|
1484
1401
|
return new RouterState(new TreeNode(activated, []), snapshot);
|
|
1485
1402
|
}
|
|
1486
|
-
function createEmptyStateSnapshot(rootComponent) {
|
|
1403
|
+
function createEmptyStateSnapshot(rootComponent, injector) {
|
|
1487
1404
|
const emptyParams = {};
|
|
1488
1405
|
const emptyData = {};
|
|
1489
1406
|
const emptyQueryParams = {};
|
|
1490
1407
|
const fragment = '';
|
|
1491
|
-
const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});
|
|
1408
|
+
const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {}, injector);
|
|
1492
1409
|
return new RouterStateSnapshot('', new TreeNode(activated, []));
|
|
1493
1410
|
}
|
|
1494
1411
|
class ActivatedRoute {
|
|
@@ -1611,10 +1528,11 @@ class ActivatedRouteSnapshot {
|
|
|
1611
1528
|
_routerState;
|
|
1612
1529
|
_paramMap;
|
|
1613
1530
|
_queryParamMap;
|
|
1531
|
+
_environmentInjector;
|
|
1614
1532
|
get title() {
|
|
1615
1533
|
return this.data?.[RouteTitleKey];
|
|
1616
1534
|
}
|
|
1617
|
-
constructor(url, params, queryParams, fragment, data, outlet, component, routeConfig, resolve) {
|
|
1535
|
+
constructor(url, params, queryParams, fragment, data, outlet, component, routeConfig, resolve, environmentInjector) {
|
|
1618
1536
|
this.url = url;
|
|
1619
1537
|
this.params = params;
|
|
1620
1538
|
this.queryParams = queryParams;
|
|
@@ -1624,6 +1542,7 @@ class ActivatedRouteSnapshot {
|
|
|
1624
1542
|
this.component = component;
|
|
1625
1543
|
this.routeConfig = routeConfig;
|
|
1626
1544
|
this._resolve = resolve;
|
|
1545
|
+
this._environmentInjector = environmentInjector;
|
|
1627
1546
|
}
|
|
1628
1547
|
get root() {
|
|
1629
1548
|
return this._routerState.root;
|
|
@@ -1707,7 +1626,7 @@ function hasStaticTitle(config) {
|
|
|
1707
1626
|
return typeof config.title === 'string' || config.title === null;
|
|
1708
1627
|
}
|
|
1709
1628
|
|
|
1710
|
-
const ROUTER_OUTLET_DATA = new InjectionToken(typeof ngDevMode !==
|
|
1629
|
+
const ROUTER_OUTLET_DATA = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'RouterOutlet data' : '');
|
|
1711
1630
|
class RouterOutlet {
|
|
1712
1631
|
activated = null;
|
|
1713
1632
|
get activatedComponentRef() {
|
|
@@ -1834,7 +1753,7 @@ class RouterOutlet {
|
|
|
1834
1753
|
}
|
|
1835
1754
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1836
1755
|
minVersion: "12.0.0",
|
|
1837
|
-
version: "21.0.
|
|
1756
|
+
version: "21.1.0-next.1",
|
|
1838
1757
|
ngImport: i0,
|
|
1839
1758
|
type: RouterOutlet,
|
|
1840
1759
|
deps: [],
|
|
@@ -1842,7 +1761,7 @@ class RouterOutlet {
|
|
|
1842
1761
|
});
|
|
1843
1762
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1844
1763
|
minVersion: "17.1.0",
|
|
1845
|
-
version: "21.0.
|
|
1764
|
+
version: "21.1.0-next.1",
|
|
1846
1765
|
type: RouterOutlet,
|
|
1847
1766
|
isStandalone: true,
|
|
1848
1767
|
selector: "router-outlet",
|
|
@@ -1875,7 +1794,7 @@ class RouterOutlet {
|
|
|
1875
1794
|
}
|
|
1876
1795
|
i0.ɵɵngDeclareClassMetadata({
|
|
1877
1796
|
minVersion: "12.0.0",
|
|
1878
|
-
version: "21.0.
|
|
1797
|
+
version: "21.1.0-next.1",
|
|
1879
1798
|
ngImport: i0,
|
|
1880
1799
|
type: RouterOutlet,
|
|
1881
1800
|
decorators: [{
|
|
@@ -1984,7 +1903,7 @@ class RoutedComponentInputBinder {
|
|
|
1984
1903
|
}
|
|
1985
1904
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1986
1905
|
minVersion: "12.0.0",
|
|
1987
|
-
version: "21.0.
|
|
1906
|
+
version: "21.1.0-next.1",
|
|
1988
1907
|
ngImport: i0,
|
|
1989
1908
|
type: RoutedComponentInputBinder,
|
|
1990
1909
|
deps: [],
|
|
@@ -1992,14 +1911,14 @@ class RoutedComponentInputBinder {
|
|
|
1992
1911
|
});
|
|
1993
1912
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1994
1913
|
minVersion: "12.0.0",
|
|
1995
|
-
version: "21.0.
|
|
1914
|
+
version: "21.1.0-next.1",
|
|
1996
1915
|
ngImport: i0,
|
|
1997
1916
|
type: RoutedComponentInputBinder
|
|
1998
1917
|
});
|
|
1999
1918
|
}
|
|
2000
1919
|
i0.ɵɵngDeclareClassMetadata({
|
|
2001
1920
|
minVersion: "12.0.0",
|
|
2002
|
-
version: "21.0.
|
|
1921
|
+
version: "21.1.0-next.1",
|
|
2003
1922
|
ngImport: i0,
|
|
2004
1923
|
type: RoutedComponentInputBinder,
|
|
2005
1924
|
decorators: [{
|
|
@@ -2010,7 +1929,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2010
1929
|
class ɵEmptyOutletComponent {
|
|
2011
1930
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2012
1931
|
minVersion: "12.0.0",
|
|
2013
|
-
version: "21.0.
|
|
1932
|
+
version: "21.1.0-next.1",
|
|
2014
1933
|
ngImport: i0,
|
|
2015
1934
|
type: ɵEmptyOutletComponent,
|
|
2016
1935
|
deps: [],
|
|
@@ -2018,7 +1937,7 @@ class ɵEmptyOutletComponent {
|
|
|
2018
1937
|
});
|
|
2019
1938
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2020
1939
|
minVersion: "14.0.0",
|
|
2021
|
-
version: "21.0.
|
|
1940
|
+
version: "21.1.0-next.1",
|
|
2022
1941
|
type: ɵEmptyOutletComponent,
|
|
2023
1942
|
isStandalone: true,
|
|
2024
1943
|
selector: "ng-component",
|
|
@@ -2038,7 +1957,7 @@ class ɵEmptyOutletComponent {
|
|
|
2038
1957
|
}
|
|
2039
1958
|
i0.ɵɵngDeclareClassMetadata({
|
|
2040
1959
|
minVersion: "12.0.0",
|
|
2041
|
-
version: "21.0.
|
|
1960
|
+
version: "21.1.0-next.1",
|
|
2042
1961
|
ngImport: i0,
|
|
2043
1962
|
type: ɵEmptyOutletComponent,
|
|
2044
1963
|
decorators: [{
|
|
@@ -2140,10 +2059,6 @@ function isNavigationCancelingError(error) {
|
|
|
2140
2059
|
}
|
|
2141
2060
|
|
|
2142
2061
|
let warnedAboutUnsupportedInputBinding = false;
|
|
2143
|
-
const activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map(t => {
|
|
2144
|
-
new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled).activate(rootContexts);
|
|
2145
|
-
return t;
|
|
2146
|
-
});
|
|
2147
2062
|
class ActivateRoutes {
|
|
2148
2063
|
routeReuseStrategy;
|
|
2149
2064
|
futureState;
|
|
@@ -2382,7 +2297,7 @@ function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks
|
|
|
2382
2297
|
}
|
|
2383
2298
|
function shouldRunGuardsAndResolvers(curr, future, mode) {
|
|
2384
2299
|
if (typeof mode === 'function') {
|
|
2385
|
-
return mode(curr, future);
|
|
2300
|
+
return runInInjectionContext(future._environmentInjector, () => mode(curr, future));
|
|
2386
2301
|
}
|
|
2387
2302
|
switch (mode) {
|
|
2388
2303
|
case 'pathParamsChange':
|
|
@@ -2482,7 +2397,7 @@ function takeUntilAbort(signal) {
|
|
|
2482
2397
|
return takeUntil(abortSignalToObservable(signal));
|
|
2483
2398
|
}
|
|
2484
2399
|
|
|
2485
|
-
function checkGuards(
|
|
2400
|
+
function checkGuards(forwardEvent) {
|
|
2486
2401
|
return mergeMap(t => {
|
|
2487
2402
|
const {
|
|
2488
2403
|
targetSnapshot,
|
|
@@ -2498,22 +2413,22 @@ function checkGuards(injector, forwardEvent) {
|
|
|
2498
2413
|
guardsResult: true
|
|
2499
2414
|
});
|
|
2500
2415
|
}
|
|
2501
|
-
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot
|
|
2502
|
-
return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks,
|
|
2416
|
+
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot).pipe(mergeMap(canDeactivate => {
|
|
2417
|
+
return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, forwardEvent) : of(canDeactivate);
|
|
2503
2418
|
}), map(guardsResult => ({
|
|
2504
2419
|
...t,
|
|
2505
2420
|
guardsResult
|
|
2506
2421
|
})));
|
|
2507
2422
|
});
|
|
2508
2423
|
}
|
|
2509
|
-
function runCanDeactivateChecks(checks, futureRSS, currRSS
|
|
2510
|
-
return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS
|
|
2424
|
+
function runCanDeactivateChecks(checks, futureRSS, currRSS) {
|
|
2425
|
+
return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS)), first(result => {
|
|
2511
2426
|
return result !== true;
|
|
2512
2427
|
}, true));
|
|
2513
2428
|
}
|
|
2514
|
-
function runCanActivateChecks(futureSnapshot, checks,
|
|
2429
|
+
function runCanActivateChecks(futureSnapshot, checks, forwardEvent) {
|
|
2515
2430
|
return from(checks).pipe(concatMap(check => {
|
|
2516
|
-
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path
|
|
2431
|
+
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path), runCanActivate(futureSnapshot, check.route));
|
|
2517
2432
|
}), first(result => {
|
|
2518
2433
|
return result !== true;
|
|
2519
2434
|
}, true));
|
|
@@ -2530,12 +2445,12 @@ function fireChildActivationStart(snapshot, forwardEvent) {
|
|
|
2530
2445
|
}
|
|
2531
2446
|
return of(true);
|
|
2532
2447
|
}
|
|
2533
|
-
function runCanActivate(futureRSS, futureARS
|
|
2448
|
+
function runCanActivate(futureRSS, futureARS) {
|
|
2534
2449
|
const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
|
|
2535
2450
|
if (!canActivate || canActivate.length === 0) return of(true);
|
|
2536
2451
|
const canActivateObservables = canActivate.map(canActivate => {
|
|
2537
2452
|
return defer(() => {
|
|
2538
|
-
const closestInjector =
|
|
2453
|
+
const closestInjector = futureARS._environmentInjector;
|
|
2539
2454
|
const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
|
|
2540
2455
|
const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
|
|
2541
2456
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
@@ -2543,13 +2458,13 @@ function runCanActivate(futureRSS, futureARS, injector) {
|
|
|
2543
2458
|
});
|
|
2544
2459
|
return of(canActivateObservables).pipe(prioritizedGuardValue());
|
|
2545
2460
|
}
|
|
2546
|
-
function runCanActivateChild(futureRSS, path
|
|
2461
|
+
function runCanActivateChild(futureRSS, path) {
|
|
2547
2462
|
const futureARS = path[path.length - 1];
|
|
2548
2463
|
const canActivateChildGuards = path.slice(0, path.length - 1).reverse().map(p => getCanActivateChild(p)).filter(_ => _ !== null);
|
|
2549
2464
|
const canActivateChildGuardsMapped = canActivateChildGuards.map(d => {
|
|
2550
2465
|
return defer(() => {
|
|
2551
2466
|
const guardsMapped = d.guards.map(canActivateChild => {
|
|
2552
|
-
const closestInjector =
|
|
2467
|
+
const closestInjector = d.node._environmentInjector;
|
|
2553
2468
|
const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
|
|
2554
2469
|
const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
|
|
2555
2470
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
@@ -2559,11 +2474,11 @@ function runCanActivateChild(futureRSS, path, injector) {
|
|
|
2559
2474
|
});
|
|
2560
2475
|
return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
|
|
2561
2476
|
}
|
|
2562
|
-
function runCanDeactivate(component, currARS, currRSS, futureRSS
|
|
2477
|
+
function runCanDeactivate(component, currARS, currRSS, futureRSS) {
|
|
2563
2478
|
const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
|
|
2564
2479
|
if (!canDeactivate || canDeactivate.length === 0) return of(true);
|
|
2565
2480
|
const canDeactivateObservables = canDeactivate.map(c => {
|
|
2566
|
-
const closestInjector =
|
|
2481
|
+
const closestInjector = currARS._environmentInjector;
|
|
2567
2482
|
const guard = getTokenOrFunctionIdentity(c, closestInjector);
|
|
2568
2483
|
const guardVal = isCanDeactivate(guard) ? guard.canDeactivate(component, currARS, currRSS, futureRSS) : runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));
|
|
2569
2484
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
@@ -2727,6 +2642,114 @@ function getRedirectResult$1(redirectTo, currentSnapshot, injector) {
|
|
|
2727
2642
|
}))));
|
|
2728
2643
|
}
|
|
2729
2644
|
|
|
2645
|
+
function getOrCreateRouteInjectorIfNeeded(route, currentInjector) {
|
|
2646
|
+
if (route.providers && !route._injector) {
|
|
2647
|
+
route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
|
|
2648
|
+
}
|
|
2649
|
+
return route._injector ?? currentInjector;
|
|
2650
|
+
}
|
|
2651
|
+
function validateConfig(config, parentPath = '', requireStandaloneComponents = false) {
|
|
2652
|
+
for (let i = 0; i < config.length; i++) {
|
|
2653
|
+
const route = config[i];
|
|
2654
|
+
const fullPath = getFullPath(parentPath, route);
|
|
2655
|
+
validateNode(route, fullPath, requireStandaloneComponents);
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
function assertStandalone(fullPath, component) {
|
|
2659
|
+
if (component && _isNgModule(component)) {
|
|
2660
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` + `but it must be used with standalone components. Use 'loadChildren' instead.`);
|
|
2661
|
+
} else if (component && !isStandalone(component)) {
|
|
2662
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
2666
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2667
|
+
if (!route) {
|
|
2668
|
+
throw new _RuntimeError(4014, `
|
|
2669
|
+
Invalid configuration of route '${fullPath}': Encountered undefined route.
|
|
2670
|
+
The reason might be an extra comma.
|
|
2671
|
+
|
|
2672
|
+
Example:
|
|
2673
|
+
const routes: Routes = [
|
|
2674
|
+
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
|
|
2675
|
+
{ path: 'dashboard', component: DashboardComponent },, << two commas
|
|
2676
|
+
{ path: 'detail/:id', component: HeroDetailComponent }
|
|
2677
|
+
];
|
|
2678
|
+
`);
|
|
2679
|
+
}
|
|
2680
|
+
if (Array.isArray(route)) {
|
|
2681
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
|
|
2682
|
+
}
|
|
2683
|
+
if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {
|
|
2684
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
|
|
2685
|
+
}
|
|
2686
|
+
if (route.redirectTo && route.children) {
|
|
2687
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
|
|
2688
|
+
}
|
|
2689
|
+
if (route.redirectTo && route.loadChildren) {
|
|
2690
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
|
|
2691
|
+
}
|
|
2692
|
+
if (route.children && route.loadChildren) {
|
|
2693
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
|
|
2694
|
+
}
|
|
2695
|
+
if (route.component && route.loadComponent) {
|
|
2696
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
|
|
2697
|
+
}
|
|
2698
|
+
if (route.redirectTo) {
|
|
2699
|
+
if (route.component || route.loadComponent) {
|
|
2700
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
|
|
2701
|
+
}
|
|
2702
|
+
if (route.canMatch || route.canActivate) {
|
|
2703
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and ${route.canMatch ? 'canMatch' : 'canActivate'} cannot be used together.` + `Redirects happen before guards are executed.`);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
if (route.path && route.matcher) {
|
|
2707
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
|
|
2708
|
+
}
|
|
2709
|
+
if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {
|
|
2710
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
|
|
2711
|
+
}
|
|
2712
|
+
if (route.path === void 0 && route.matcher === void 0) {
|
|
2713
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
|
|
2714
|
+
}
|
|
2715
|
+
if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
|
|
2716
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
|
|
2717
|
+
}
|
|
2718
|
+
if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
|
|
2719
|
+
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
|
|
2720
|
+
throw new _RuntimeError(4014, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
|
2721
|
+
}
|
|
2722
|
+
if (requireStandaloneComponents) {
|
|
2723
|
+
assertStandalone(fullPath, route.component);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
if (route.children) {
|
|
2727
|
+
validateConfig(route.children, fullPath, requireStandaloneComponents);
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
function getFullPath(parentPath, currentRoute) {
|
|
2731
|
+
if (!currentRoute) {
|
|
2732
|
+
return parentPath;
|
|
2733
|
+
}
|
|
2734
|
+
if (!parentPath && !currentRoute.path) {
|
|
2735
|
+
return '';
|
|
2736
|
+
} else if (parentPath && !currentRoute.path) {
|
|
2737
|
+
return `${parentPath}/`;
|
|
2738
|
+
} else if (!parentPath && currentRoute.path) {
|
|
2739
|
+
return currentRoute.path;
|
|
2740
|
+
} else {
|
|
2741
|
+
return `${parentPath}/${currentRoute.path}`;
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
function getOutlet(route) {
|
|
2745
|
+
return route.outlet || PRIMARY_OUTLET;
|
|
2746
|
+
}
|
|
2747
|
+
function sortByMatchingOutlets(routes, outletName) {
|
|
2748
|
+
const sortedConfig = routes.filter(r => getOutlet(r) === outletName);
|
|
2749
|
+
sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));
|
|
2750
|
+
return sortedConfig;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2730
2753
|
const noMatch$1 = {
|
|
2731
2754
|
matched: false,
|
|
2732
2755
|
consumedSegments: [],
|
|
@@ -2745,9 +2768,6 @@ function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer,
|
|
|
2745
2768
|
}));
|
|
2746
2769
|
}
|
|
2747
2770
|
function match(segmentGroup, route, segments) {
|
|
2748
|
-
if (route.path === '**') {
|
|
2749
|
-
return createWildcardMatchResult(segments);
|
|
2750
|
-
}
|
|
2751
2771
|
if (route.path === '') {
|
|
2752
2772
|
if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
|
|
2753
2773
|
return {
|
|
@@ -2783,15 +2803,6 @@ function match(segmentGroup, route, segments) {
|
|
|
2783
2803
|
positionalParamSegments: res.posParams ?? {}
|
|
2784
2804
|
};
|
|
2785
2805
|
}
|
|
2786
|
-
function createWildcardMatchResult(segments) {
|
|
2787
|
-
return {
|
|
2788
|
-
matched: true,
|
|
2789
|
-
parameters: segments.length > 0 ? last(segments).parameters : {},
|
|
2790
|
-
consumedSegments: segments,
|
|
2791
|
-
remainingSegments: [],
|
|
2792
|
-
positionalParamSegments: {}
|
|
2793
|
-
};
|
|
2794
|
-
}
|
|
2795
2806
|
function split(segmentGroup, consumedSegments, slicedSegments, config) {
|
|
2796
2807
|
if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {
|
|
2797
2808
|
const s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
|
|
@@ -2903,7 +2914,7 @@ let Recognizer$1 = class Recognizer {
|
|
|
2903
2914
|
async match(rootSegmentGroup) {
|
|
2904
2915
|
const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({
|
|
2905
2916
|
...this.urlTree.queryParams
|
|
2906
|
-
}), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});
|
|
2917
|
+
}), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {}, this.injector);
|
|
2907
2918
|
try {
|
|
2908
2919
|
const children = await this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot);
|
|
2909
2920
|
return {
|
|
@@ -2999,7 +3010,7 @@ let Recognizer$1 = class Recognizer {
|
|
|
2999
3010
|
}
|
|
3000
3011
|
const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze({
|
|
3001
3012
|
...this.urlTree.queryParams
|
|
3002
|
-
}), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route));
|
|
3013
|
+
}), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route), injector);
|
|
3003
3014
|
const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);
|
|
3004
3015
|
currentSnapshot.params = Object.freeze(inherited.params);
|
|
3005
3016
|
currentSnapshot.data = Object.freeze(inherited.data);
|
|
@@ -3033,7 +3044,7 @@ let Recognizer$1 = class Recognizer {
|
|
|
3033
3044
|
} = result;
|
|
3034
3045
|
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({
|
|
3035
3046
|
...this.urlTree.queryParams
|
|
3036
|
-
}), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route));
|
|
3047
|
+
}), this.urlTree.fragment, getData$1(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve$1(route), injector);
|
|
3037
3048
|
const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);
|
|
3038
3049
|
snapshot.params = Object.freeze(inherited.params);
|
|
3039
3050
|
snapshot.data = Object.freeze(inherited.data);
|
|
@@ -3312,7 +3323,7 @@ class Recognizer {
|
|
|
3312
3323
|
match(rootSegmentGroup) {
|
|
3313
3324
|
const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({
|
|
3314
3325
|
...this.urlTree.queryParams
|
|
3315
|
-
}), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});
|
|
3326
|
+
}), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {}, this.injector);
|
|
3316
3327
|
return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot).pipe(map(children => {
|
|
3317
3328
|
return {
|
|
3318
3329
|
children,
|
|
@@ -3411,7 +3422,7 @@ class Recognizer {
|
|
|
3411
3422
|
}
|
|
3412
3423
|
const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze({
|
|
3413
3424
|
...this.urlTree.queryParams
|
|
3414
|
-
}), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
|
|
3425
|
+
}), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route), injector);
|
|
3415
3426
|
const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);
|
|
3416
3427
|
currentSnapshot.params = Object.freeze(inherited.params);
|
|
3417
3428
|
currentSnapshot.data = Object.freeze(inherited.data);
|
|
@@ -3441,7 +3452,7 @@ class Recognizer {
|
|
|
3441
3452
|
} = result;
|
|
3442
3453
|
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({
|
|
3443
3454
|
...this.urlTree.queryParams
|
|
3444
|
-
}), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
|
|
3455
|
+
}), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route), injector);
|
|
3445
3456
|
const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);
|
|
3446
3457
|
snapshot.params = Object.freeze(inherited.params);
|
|
3447
3458
|
snapshot.data = Object.freeze(inherited.data);
|
|
@@ -3571,7 +3582,7 @@ function recognize(injector, configLoader, rootComponentType, config, serializer
|
|
|
3571
3582
|
})));
|
|
3572
3583
|
}
|
|
3573
3584
|
|
|
3574
|
-
function resolveData(paramsInheritanceStrategy
|
|
3585
|
+
function resolveData(paramsInheritanceStrategy) {
|
|
3575
3586
|
return mergeMap(t => {
|
|
3576
3587
|
const {
|
|
3577
3588
|
targetSnapshot,
|
|
@@ -3595,7 +3606,7 @@ function resolveData(paramsInheritanceStrategy, injector) {
|
|
|
3595
3606
|
let routesProcessed = 0;
|
|
3596
3607
|
return from(routesNeedingDataUpdates).pipe(concatMap(route => {
|
|
3597
3608
|
if (routesWithResolversToRun.has(route)) {
|
|
3598
|
-
return runResolve(route, targetSnapshot, paramsInheritanceStrategy
|
|
3609
|
+
return runResolve(route, targetSnapshot, paramsInheritanceStrategy);
|
|
3599
3610
|
} else {
|
|
3600
3611
|
route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;
|
|
3601
3612
|
return of(void 0);
|
|
@@ -3607,7 +3618,7 @@ function flattenRouteTree(route) {
|
|
|
3607
3618
|
const descendants = route.children.map(child => flattenRouteTree(child)).flat();
|
|
3608
3619
|
return [route, ...descendants];
|
|
3609
3620
|
}
|
|
3610
|
-
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy
|
|
3621
|
+
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy) {
|
|
3611
3622
|
const config = futureARS.routeConfig;
|
|
3612
3623
|
const resolve = futureARS._resolve;
|
|
3613
3624
|
if (config?.title !== undefined && !hasStaticTitle(config)) {
|
|
@@ -3615,7 +3626,7 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
|
|
|
3615
3626
|
}
|
|
3616
3627
|
return defer(() => {
|
|
3617
3628
|
futureARS.data = getInherited(futureARS, futureARS.parent, paramsInheritanceStrategy).resolve;
|
|
3618
|
-
return resolveNode(resolve, futureARS, futureRSS
|
|
3629
|
+
return resolveNode(resolve, futureARS, futureRSS).pipe(map(resolvedData => {
|
|
3619
3630
|
futureARS._resolvedData = resolvedData;
|
|
3620
3631
|
futureARS.data = {
|
|
3621
3632
|
...futureARS.data,
|
|
@@ -3625,21 +3636,21 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
|
|
|
3625
3636
|
}));
|
|
3626
3637
|
});
|
|
3627
3638
|
}
|
|
3628
|
-
function resolveNode(resolve, futureARS, futureRSS
|
|
3639
|
+
function resolveNode(resolve, futureARS, futureRSS) {
|
|
3629
3640
|
const keys = getDataKeys(resolve);
|
|
3630
3641
|
if (keys.length === 0) {
|
|
3631
3642
|
return of({});
|
|
3632
3643
|
}
|
|
3633
3644
|
const data = {};
|
|
3634
|
-
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS
|
|
3645
|
+
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS).pipe(first(), tap(value => {
|
|
3635
3646
|
if (value instanceof RedirectCommand) {
|
|
3636
3647
|
throw redirectingNavigationError(new DefaultUrlSerializer(), value);
|
|
3637
3648
|
}
|
|
3638
3649
|
data[key] = value;
|
|
3639
3650
|
}))), takeLast(1), map(() => data), catchError(e => isEmptyError(e) ? EMPTY : throwError(e)));
|
|
3640
3651
|
}
|
|
3641
|
-
function getResolver(injectionToken, futureARS, futureRSS
|
|
3642
|
-
const closestInjector =
|
|
3652
|
+
function getResolver(injectionToken, futureARS, futureRSS) {
|
|
3653
|
+
const closestInjector = futureARS._environmentInjector;
|
|
3643
3654
|
const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
|
|
3644
3655
|
const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));
|
|
3645
3656
|
return wrapIntoObservable(resolverValue);
|
|
@@ -3670,7 +3681,7 @@ class TitleStrategy {
|
|
|
3670
3681
|
}
|
|
3671
3682
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
3672
3683
|
minVersion: "12.0.0",
|
|
3673
|
-
version: "21.0.
|
|
3684
|
+
version: "21.1.0-next.1",
|
|
3674
3685
|
ngImport: i0,
|
|
3675
3686
|
type: TitleStrategy,
|
|
3676
3687
|
deps: [],
|
|
@@ -3678,7 +3689,7 @@ class TitleStrategy {
|
|
|
3678
3689
|
});
|
|
3679
3690
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
3680
3691
|
minVersion: "12.0.0",
|
|
3681
|
-
version: "21.0.
|
|
3692
|
+
version: "21.1.0-next.1",
|
|
3682
3693
|
ngImport: i0,
|
|
3683
3694
|
type: TitleStrategy,
|
|
3684
3695
|
providedIn: 'root',
|
|
@@ -3687,7 +3698,7 @@ class TitleStrategy {
|
|
|
3687
3698
|
}
|
|
3688
3699
|
i0.ɵɵngDeclareClassMetadata({
|
|
3689
3700
|
minVersion: "12.0.0",
|
|
3690
|
-
version: "21.0.
|
|
3701
|
+
version: "21.1.0-next.1",
|
|
3691
3702
|
ngImport: i0,
|
|
3692
3703
|
type: TitleStrategy,
|
|
3693
3704
|
decorators: [{
|
|
@@ -3712,7 +3723,7 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
3712
3723
|
}
|
|
3713
3724
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
3714
3725
|
minVersion: "12.0.0",
|
|
3715
|
-
version: "21.0.
|
|
3726
|
+
version: "21.1.0-next.1",
|
|
3716
3727
|
ngImport: i0,
|
|
3717
3728
|
type: DefaultTitleStrategy,
|
|
3718
3729
|
deps: [{
|
|
@@ -3722,7 +3733,7 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
3722
3733
|
});
|
|
3723
3734
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
3724
3735
|
minVersion: "12.0.0",
|
|
3725
|
-
version: "21.0.
|
|
3736
|
+
version: "21.1.0-next.1",
|
|
3726
3737
|
ngImport: i0,
|
|
3727
3738
|
type: DefaultTitleStrategy,
|
|
3728
3739
|
providedIn: 'root'
|
|
@@ -3730,7 +3741,7 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
3730
3741
|
}
|
|
3731
3742
|
i0.ɵɵngDeclareClassMetadata({
|
|
3732
3743
|
minVersion: "12.0.0",
|
|
3733
|
-
version: "21.0.
|
|
3744
|
+
version: "21.1.0-next.1",
|
|
3734
3745
|
ngImport: i0,
|
|
3735
3746
|
type: DefaultTitleStrategy,
|
|
3736
3747
|
decorators: [{
|
|
@@ -3748,7 +3759,7 @@ const ROUTER_CONFIGURATION = new InjectionToken(typeof ngDevMode === 'undefined'
|
|
|
3748
3759
|
factory: () => ({})
|
|
3749
3760
|
});
|
|
3750
3761
|
|
|
3751
|
-
const ROUTES = new InjectionToken(typeof ngDevMode !==
|
|
3762
|
+
const ROUTES = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'ROUTES' : '');
|
|
3752
3763
|
class RouterConfigLoader {
|
|
3753
3764
|
componentLoaders = new WeakMap();
|
|
3754
3765
|
childrenLoaders = new WeakMap();
|
|
@@ -3808,7 +3819,7 @@ class RouterConfigLoader {
|
|
|
3808
3819
|
}
|
|
3809
3820
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
3810
3821
|
minVersion: "12.0.0",
|
|
3811
|
-
version: "21.0.
|
|
3822
|
+
version: "21.1.0-next.1",
|
|
3812
3823
|
ngImport: i0,
|
|
3813
3824
|
type: RouterConfigLoader,
|
|
3814
3825
|
deps: [],
|
|
@@ -3816,7 +3827,7 @@ class RouterConfigLoader {
|
|
|
3816
3827
|
});
|
|
3817
3828
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
3818
3829
|
minVersion: "12.0.0",
|
|
3819
|
-
version: "21.0.
|
|
3830
|
+
version: "21.1.0-next.1",
|
|
3820
3831
|
ngImport: i0,
|
|
3821
3832
|
type: RouterConfigLoader,
|
|
3822
3833
|
providedIn: 'root'
|
|
@@ -3824,7 +3835,7 @@ class RouterConfigLoader {
|
|
|
3824
3835
|
}
|
|
3825
3836
|
i0.ɵɵngDeclareClassMetadata({
|
|
3826
3837
|
minVersion: "12.0.0",
|
|
3827
|
-
version: "21.0.
|
|
3838
|
+
version: "21.1.0-next.1",
|
|
3828
3839
|
ngImport: i0,
|
|
3829
3840
|
type: RouterConfigLoader,
|
|
3830
3841
|
decorators: [{
|
|
@@ -3886,7 +3897,7 @@ async function maybeResolveResources(value) {
|
|
|
3886
3897
|
class UrlHandlingStrategy {
|
|
3887
3898
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
3888
3899
|
minVersion: "12.0.0",
|
|
3889
|
-
version: "21.0.
|
|
3900
|
+
version: "21.1.0-next.1",
|
|
3890
3901
|
ngImport: i0,
|
|
3891
3902
|
type: UrlHandlingStrategy,
|
|
3892
3903
|
deps: [],
|
|
@@ -3894,7 +3905,7 @@ class UrlHandlingStrategy {
|
|
|
3894
3905
|
});
|
|
3895
3906
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
3896
3907
|
minVersion: "12.0.0",
|
|
3897
|
-
version: "21.0.
|
|
3908
|
+
version: "21.1.0-next.1",
|
|
3898
3909
|
ngImport: i0,
|
|
3899
3910
|
type: UrlHandlingStrategy,
|
|
3900
3911
|
providedIn: 'root',
|
|
@@ -3903,7 +3914,7 @@ class UrlHandlingStrategy {
|
|
|
3903
3914
|
}
|
|
3904
3915
|
i0.ɵɵngDeclareClassMetadata({
|
|
3905
3916
|
minVersion: "12.0.0",
|
|
3906
|
-
version: "21.0.
|
|
3917
|
+
version: "21.1.0-next.1",
|
|
3907
3918
|
ngImport: i0,
|
|
3908
3919
|
type: UrlHandlingStrategy,
|
|
3909
3920
|
decorators: [{
|
|
@@ -3926,7 +3937,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
3926
3937
|
}
|
|
3927
3938
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
3928
3939
|
minVersion: "12.0.0",
|
|
3929
|
-
version: "21.0.
|
|
3940
|
+
version: "21.1.0-next.1",
|
|
3930
3941
|
ngImport: i0,
|
|
3931
3942
|
type: DefaultUrlHandlingStrategy,
|
|
3932
3943
|
deps: [],
|
|
@@ -3934,7 +3945,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
3934
3945
|
});
|
|
3935
3946
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
3936
3947
|
minVersion: "12.0.0",
|
|
3937
|
-
version: "21.0.
|
|
3948
|
+
version: "21.1.0-next.1",
|
|
3938
3949
|
ngImport: i0,
|
|
3939
3950
|
type: DefaultUrlHandlingStrategy,
|
|
3940
3951
|
providedIn: 'root'
|
|
@@ -3942,7 +3953,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
3942
3953
|
}
|
|
3943
3954
|
i0.ɵɵngDeclareClassMetadata({
|
|
3944
3955
|
minVersion: "12.0.0",
|
|
3945
|
-
version: "21.0.
|
|
3956
|
+
version: "21.1.0-next.1",
|
|
3946
3957
|
ngImport: i0,
|
|
3947
3958
|
type: DefaultUrlHandlingStrategy,
|
|
3948
3959
|
decorators: [{
|
|
@@ -3953,8 +3964,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
3953
3964
|
}]
|
|
3954
3965
|
});
|
|
3955
3966
|
|
|
3956
|
-
const CREATE_VIEW_TRANSITION = new InjectionToken(typeof ngDevMode !==
|
|
3957
|
-
const VIEW_TRANSITION_OPTIONS = new InjectionToken(typeof ngDevMode !==
|
|
3967
|
+
const CREATE_VIEW_TRANSITION = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'view transition helper' : '');
|
|
3968
|
+
const VIEW_TRANSITION_OPTIONS = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'view transition options' : '');
|
|
3958
3969
|
function createViewTransition(injector, from, to) {
|
|
3959
3970
|
const transitionOptions = injector.get(VIEW_TRANSITION_OPTIONS);
|
|
3960
3971
|
const document = injector.get(DOCUMENT);
|
|
@@ -4080,6 +4091,9 @@ class NavigationTransitions {
|
|
|
4080
4091
|
return this.transitions.pipe(filter(t => t !== null), switchMap(overallTransitionState => {
|
|
4081
4092
|
let completedOrAborted = false;
|
|
4082
4093
|
const abortController = new AbortController();
|
|
4094
|
+
const shouldContinueNavigation = () => {
|
|
4095
|
+
return !completedOrAborted && this.currentTransition?.id === overallTransitionState.id;
|
|
4096
|
+
};
|
|
4083
4097
|
return of(overallTransitionState).pipe(switchMap(t => {
|
|
4084
4098
|
if (this.navigationId > overallTransitionState.id) {
|
|
4085
4099
|
const cancellationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';
|
|
@@ -4136,7 +4150,7 @@ class NavigationTransitions {
|
|
|
4136
4150
|
} = t;
|
|
4137
4151
|
const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
|
|
4138
4152
|
this.events.next(navStart);
|
|
4139
|
-
const targetSnapshot = createEmptyState(this.rootComponentType).snapshot;
|
|
4153
|
+
const targetSnapshot = createEmptyState(this.rootComponentType, this.environmentInjector).snapshot;
|
|
4140
4154
|
this.currentTransition = overallTransitionState = {
|
|
4141
4155
|
...t,
|
|
4142
4156
|
targetSnapshot,
|
|
@@ -4158,48 +4172,48 @@ class NavigationTransitions {
|
|
|
4158
4172
|
t.resolve(false);
|
|
4159
4173
|
return EMPTY;
|
|
4160
4174
|
}
|
|
4161
|
-
}),
|
|
4175
|
+
}), map(t => {
|
|
4162
4176
|
const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4163
4177
|
this.events.next(guardsStart);
|
|
4164
|
-
}), map(t => {
|
|
4165
4178
|
this.currentTransition = overallTransitionState = {
|
|
4166
4179
|
...t,
|
|
4167
4180
|
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
|
|
4168
4181
|
};
|
|
4169
4182
|
return overallTransitionState;
|
|
4170
|
-
}), checkGuards(
|
|
4183
|
+
}), checkGuards(evt => this.events.next(evt)), switchMap(t => {
|
|
4171
4184
|
overallTransitionState.guardsResult = t.guardsResult;
|
|
4172
4185
|
if (t.guardsResult && typeof t.guardsResult !== 'boolean') {
|
|
4173
4186
|
throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
|
|
4174
4187
|
}
|
|
4175
4188
|
const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
|
|
4176
4189
|
this.events.next(guardsEnd);
|
|
4177
|
-
|
|
4190
|
+
if (!shouldContinueNavigation()) {
|
|
4191
|
+
return EMPTY;
|
|
4192
|
+
}
|
|
4178
4193
|
if (!t.guardsResult) {
|
|
4179
4194
|
this.cancelNavigationTransition(t, '', NavigationCancellationCode.GuardRejected);
|
|
4180
|
-
return
|
|
4195
|
+
return EMPTY;
|
|
4181
4196
|
}
|
|
4182
|
-
return true;
|
|
4183
|
-
}), switchTap(t => {
|
|
4184
4197
|
if (t.guards.canActivateChecks.length === 0) {
|
|
4185
|
-
return
|
|
4198
|
+
return of(t);
|
|
4199
|
+
}
|
|
4200
|
+
const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4201
|
+
this.events.next(resolveStart);
|
|
4202
|
+
if (!shouldContinueNavigation()) {
|
|
4203
|
+
return EMPTY;
|
|
4186
4204
|
}
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
}
|
|
4205
|
+
let dataResolved = false;
|
|
4206
|
+
return of(t).pipe(resolveData(this.paramsInheritanceStrategy), tap({
|
|
4207
|
+
next: () => {
|
|
4208
|
+
dataResolved = true;
|
|
4209
|
+
const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4210
|
+
this.events.next(resolveEnd);
|
|
4211
|
+
},
|
|
4212
|
+
complete: () => {
|
|
4213
|
+
if (!dataResolved) {
|
|
4214
|
+
this.cancelNavigationTransition(t, typeof ngDevMode === 'undefined' || ngDevMode ? `At least one route resolver didn't emit any value.` : '', NavigationCancellationCode.NoDataFromResolver);
|
|
4198
4215
|
}
|
|
4199
|
-
}
|
|
4200
|
-
}), tap(t => {
|
|
4201
|
-
const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4202
|
-
this.events.next(resolveEnd);
|
|
4216
|
+
}
|
|
4203
4217
|
}));
|
|
4204
4218
|
}), switchTap(t => {
|
|
4205
4219
|
const loadComponents = route => {
|
|
@@ -4207,7 +4221,7 @@ class NavigationTransitions {
|
|
|
4207
4221
|
if (route.routeConfig?._loadedComponent) {
|
|
4208
4222
|
route.component = route.routeConfig?._loadedComponent;
|
|
4209
4223
|
} else if (route.routeConfig?.loadComponent) {
|
|
4210
|
-
const injector =
|
|
4224
|
+
const injector = route._environmentInjector;
|
|
4211
4225
|
loaders.push(this.configLoader.loadComponent(injector, route.routeConfig).then(loadedComponent => {
|
|
4212
4226
|
route.component = loadedComponent;
|
|
4213
4227
|
}));
|
|
@@ -4226,9 +4240,9 @@ class NavigationTransitions {
|
|
|
4226
4240
|
} = overallTransitionState;
|
|
4227
4241
|
const viewTransitionStarted = this.createViewTransition?.(this.environmentInjector, currentSnapshot.root, targetSnapshot.root);
|
|
4228
4242
|
return viewTransitionStarted ? from(viewTransitionStarted).pipe(map(() => overallTransitionState)) : of(overallTransitionState);
|
|
4229
|
-
}), map(t => {
|
|
4243
|
+
}), take(1), map(t => {
|
|
4230
4244
|
const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4231
|
-
this.currentTransition = overallTransitionState = {
|
|
4245
|
+
this.currentTransition = overallTransitionState = t = {
|
|
4232
4246
|
...t,
|
|
4233
4247
|
targetRouterState
|
|
4234
4248
|
};
|
|
@@ -4236,23 +4250,26 @@ class NavigationTransitions {
|
|
|
4236
4250
|
nav.targetRouterState = targetRouterState;
|
|
4237
4251
|
return nav;
|
|
4238
4252
|
});
|
|
4239
|
-
return overallTransitionState;
|
|
4240
|
-
}), tap(() => {
|
|
4241
4253
|
this.events.next(new BeforeActivateRoutes());
|
|
4242
|
-
|
|
4254
|
+
if (!shouldContinueNavigation()) {
|
|
4255
|
+
return;
|
|
4256
|
+
}
|
|
4257
|
+
new ActivateRoutes(router.routeReuseStrategy, overallTransitionState.targetRouterState, overallTransitionState.currentRouterState, evt => this.events.next(evt), this.inputBindingEnabled).activate(this.rootContexts);
|
|
4258
|
+
if (!shouldContinueNavigation()) {
|
|
4259
|
+
return;
|
|
4260
|
+
}
|
|
4261
|
+
completedOrAborted = true;
|
|
4262
|
+
this.currentNavigation.update(nav => {
|
|
4263
|
+
nav.abort = noop;
|
|
4264
|
+
return nav;
|
|
4265
|
+
});
|
|
4266
|
+
this.lastSuccessfulNavigation.set(untracked(this.currentNavigation));
|
|
4267
|
+
this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects)));
|
|
4268
|
+
this.titleStrategy?.updateTitle(t.targetRouterState.snapshot);
|
|
4269
|
+
t.resolve(true);
|
|
4270
|
+
}), takeUntil(abortSignalToObservable(abortController.signal).pipe(filter(() => !completedOrAborted && !overallTransitionState.targetRouterState), tap(() => {
|
|
4243
4271
|
this.cancelNavigationTransition(overallTransitionState, abortController.signal.reason + '', NavigationCancellationCode.Aborted);
|
|
4244
4272
|
}))), tap({
|
|
4245
|
-
next: t => {
|
|
4246
|
-
completedOrAborted = true;
|
|
4247
|
-
this.currentNavigation.update(nav => {
|
|
4248
|
-
nav.abort = noop;
|
|
4249
|
-
return nav;
|
|
4250
|
-
});
|
|
4251
|
-
this.lastSuccessfulNavigation.set(untracked(this.currentNavigation));
|
|
4252
|
-
this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects)));
|
|
4253
|
-
this.titleStrategy?.updateTitle(t.targetRouterState.snapshot);
|
|
4254
|
-
t.resolve(true);
|
|
4255
|
-
},
|
|
4256
4273
|
complete: () => {
|
|
4257
4274
|
completedOrAborted = true;
|
|
4258
4275
|
}
|
|
@@ -4269,11 +4286,11 @@ class NavigationTransitions {
|
|
|
4269
4286
|
this.currentTransition = null;
|
|
4270
4287
|
}
|
|
4271
4288
|
}), catchError(e => {
|
|
4289
|
+
completedOrAborted = true;
|
|
4272
4290
|
if (this.destroyed) {
|
|
4273
4291
|
overallTransitionState.resolve(false);
|
|
4274
4292
|
return EMPTY;
|
|
4275
4293
|
}
|
|
4276
|
-
completedOrAborted = true;
|
|
4277
4294
|
if (isNavigationCancelingError(e)) {
|
|
4278
4295
|
this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode));
|
|
4279
4296
|
if (!isRedirectingNavigationCancelingError(e)) {
|
|
@@ -4324,7 +4341,7 @@ class NavigationTransitions {
|
|
|
4324
4341
|
}
|
|
4325
4342
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
4326
4343
|
minVersion: "12.0.0",
|
|
4327
|
-
version: "21.0.
|
|
4344
|
+
version: "21.1.0-next.1",
|
|
4328
4345
|
ngImport: i0,
|
|
4329
4346
|
type: NavigationTransitions,
|
|
4330
4347
|
deps: [],
|
|
@@ -4332,7 +4349,7 @@ class NavigationTransitions {
|
|
|
4332
4349
|
});
|
|
4333
4350
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
4334
4351
|
minVersion: "12.0.0",
|
|
4335
|
-
version: "21.0.
|
|
4352
|
+
version: "21.1.0-next.1",
|
|
4336
4353
|
ngImport: i0,
|
|
4337
4354
|
type: NavigationTransitions,
|
|
4338
4355
|
providedIn: 'root'
|
|
@@ -4340,7 +4357,7 @@ class NavigationTransitions {
|
|
|
4340
4357
|
}
|
|
4341
4358
|
i0.ɵɵngDeclareClassMetadata({
|
|
4342
4359
|
minVersion: "12.0.0",
|
|
4343
|
-
version: "21.0.
|
|
4360
|
+
version: "21.1.0-next.1",
|
|
4344
4361
|
ngImport: i0,
|
|
4345
4362
|
type: NavigationTransitions,
|
|
4346
4363
|
decorators: [{
|
|
@@ -4358,7 +4375,7 @@ function isBrowserTriggeredNavigation(source) {
|
|
|
4358
4375
|
class RouteReuseStrategy {
|
|
4359
4376
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
4360
4377
|
minVersion: "12.0.0",
|
|
4361
|
-
version: "21.0.
|
|
4378
|
+
version: "21.1.0-next.1",
|
|
4362
4379
|
ngImport: i0,
|
|
4363
4380
|
type: RouteReuseStrategy,
|
|
4364
4381
|
deps: [],
|
|
@@ -4366,7 +4383,7 @@ class RouteReuseStrategy {
|
|
|
4366
4383
|
});
|
|
4367
4384
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
4368
4385
|
minVersion: "12.0.0",
|
|
4369
|
-
version: "21.0.
|
|
4386
|
+
version: "21.1.0-next.1",
|
|
4370
4387
|
ngImport: i0,
|
|
4371
4388
|
type: RouteReuseStrategy,
|
|
4372
4389
|
providedIn: 'root',
|
|
@@ -4375,7 +4392,7 @@ class RouteReuseStrategy {
|
|
|
4375
4392
|
}
|
|
4376
4393
|
i0.ɵɵngDeclareClassMetadata({
|
|
4377
4394
|
minVersion: "12.0.0",
|
|
4378
|
-
version: "21.0.
|
|
4395
|
+
version: "21.1.0-next.1",
|
|
4379
4396
|
ngImport: i0,
|
|
4380
4397
|
type: RouteReuseStrategy,
|
|
4381
4398
|
decorators: [{
|
|
@@ -4404,7 +4421,7 @@ class BaseRouteReuseStrategy {
|
|
|
4404
4421
|
class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
4405
4422
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
4406
4423
|
minVersion: "12.0.0",
|
|
4407
|
-
version: "21.0.
|
|
4424
|
+
version: "21.1.0-next.1",
|
|
4408
4425
|
ngImport: i0,
|
|
4409
4426
|
type: DefaultRouteReuseStrategy,
|
|
4410
4427
|
deps: null,
|
|
@@ -4412,7 +4429,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4412
4429
|
});
|
|
4413
4430
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
4414
4431
|
minVersion: "12.0.0",
|
|
4415
|
-
version: "21.0.
|
|
4432
|
+
version: "21.1.0-next.1",
|
|
4416
4433
|
ngImport: i0,
|
|
4417
4434
|
type: DefaultRouteReuseStrategy,
|
|
4418
4435
|
providedIn: 'root'
|
|
@@ -4420,7 +4437,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4420
4437
|
}
|
|
4421
4438
|
i0.ɵɵngDeclareClassMetadata({
|
|
4422
4439
|
minVersion: "12.0.0",
|
|
4423
|
-
version: "21.0.
|
|
4440
|
+
version: "21.1.0-next.1",
|
|
4424
4441
|
ngImport: i0,
|
|
4425
4442
|
type: DefaultRouteReuseStrategy,
|
|
4426
4443
|
decorators: [{
|
|
@@ -4471,13 +4488,16 @@ class StateManager {
|
|
|
4471
4488
|
this.rawUrlTree = initialUrl;
|
|
4472
4489
|
}
|
|
4473
4490
|
}
|
|
4474
|
-
routerState = createEmptyState(null);
|
|
4491
|
+
routerState = createEmptyState(null, inject(EnvironmentInjector));
|
|
4475
4492
|
getRouterState() {
|
|
4476
4493
|
return this.routerState;
|
|
4477
4494
|
}
|
|
4478
|
-
|
|
4495
|
+
_stateMemento = this.createStateMemento();
|
|
4496
|
+
get stateMemento() {
|
|
4497
|
+
return this._stateMemento;
|
|
4498
|
+
}
|
|
4479
4499
|
updateStateMemento() {
|
|
4480
|
-
this.
|
|
4500
|
+
this._stateMemento = this.createStateMemento();
|
|
4481
4501
|
}
|
|
4482
4502
|
createStateMemento() {
|
|
4483
4503
|
return {
|
|
@@ -4486,16 +4506,12 @@ class StateManager {
|
|
|
4486
4506
|
routerState: this.routerState
|
|
4487
4507
|
};
|
|
4488
4508
|
}
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
}) {
|
|
4492
|
-
this.routerState = this.stateMemento.routerState;
|
|
4493
|
-
this.currentUrlTree = this.stateMemento.currentUrlTree;
|
|
4494
|
-
this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, finalUrl ?? this.rawUrlTree);
|
|
4509
|
+
restoredState() {
|
|
4510
|
+
return this.location.getState();
|
|
4495
4511
|
}
|
|
4496
4512
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
4497
4513
|
minVersion: "12.0.0",
|
|
4498
|
-
version: "21.0.
|
|
4514
|
+
version: "21.1.0-next.1",
|
|
4499
4515
|
ngImport: i0,
|
|
4500
4516
|
type: StateManager,
|
|
4501
4517
|
deps: [],
|
|
@@ -4503,7 +4519,7 @@ class StateManager {
|
|
|
4503
4519
|
});
|
|
4504
4520
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
4505
4521
|
minVersion: "12.0.0",
|
|
4506
|
-
version: "21.0.
|
|
4522
|
+
version: "21.1.0-next.1",
|
|
4507
4523
|
ngImport: i0,
|
|
4508
4524
|
type: StateManager,
|
|
4509
4525
|
providedIn: 'root',
|
|
@@ -4512,7 +4528,7 @@ class StateManager {
|
|
|
4512
4528
|
}
|
|
4513
4529
|
i0.ɵɵngDeclareClassMetadata({
|
|
4514
4530
|
minVersion: "12.0.0",
|
|
4515
|
-
version: "21.0.
|
|
4531
|
+
version: "21.1.0-next.1",
|
|
4516
4532
|
ngImport: i0,
|
|
4517
4533
|
type: StateManager,
|
|
4518
4534
|
decorators: [{
|
|
@@ -4526,9 +4542,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4526
4542
|
class HistoryStateManager extends StateManager {
|
|
4527
4543
|
currentPageId = 0;
|
|
4528
4544
|
lastSuccessfulId = -1;
|
|
4529
|
-
restoredState() {
|
|
4530
|
-
return this.location.getState();
|
|
4531
|
-
}
|
|
4532
4545
|
get browserPageId() {
|
|
4533
4546
|
if (this.canceledNavigationResolution !== 'computed') {
|
|
4534
4547
|
return this.currentPageId;
|
|
@@ -4560,7 +4573,7 @@ class HistoryStateManager extends StateManager {
|
|
|
4560
4573
|
if (this.urlUpdateStrategy === 'deferred' && !currentTransition.extras.skipLocationChange) {
|
|
4561
4574
|
this.setBrowserUrl(this.createBrowserPath(currentTransition), currentTransition);
|
|
4562
4575
|
}
|
|
4563
|
-
} else if (e instanceof NavigationCancel && e
|
|
4576
|
+
} else if (e instanceof NavigationCancel && !isRedirectingEvent(e)) {
|
|
4564
4577
|
this.restoreHistory(currentTransition);
|
|
4565
4578
|
} else if (e instanceof NavigationError) {
|
|
4566
4579
|
this.restoreHistory(currentTransition, true);
|
|
@@ -4609,6 +4622,13 @@ class HistoryStateManager extends StateManager {
|
|
|
4609
4622
|
this.resetUrlToCurrentUrlTree();
|
|
4610
4623
|
}
|
|
4611
4624
|
}
|
|
4625
|
+
resetInternalState({
|
|
4626
|
+
finalUrl
|
|
4627
|
+
}) {
|
|
4628
|
+
this.routerState = this.stateMemento.routerState;
|
|
4629
|
+
this.currentUrlTree = this.stateMemento.currentUrlTree;
|
|
4630
|
+
this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, finalUrl ?? this.rawUrlTree);
|
|
4631
|
+
}
|
|
4612
4632
|
resetUrlToCurrentUrlTree() {
|
|
4613
4633
|
this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
|
|
4614
4634
|
}
|
|
@@ -4625,7 +4645,7 @@ class HistoryStateManager extends StateManager {
|
|
|
4625
4645
|
}
|
|
4626
4646
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
4627
4647
|
minVersion: "12.0.0",
|
|
4628
|
-
version: "21.0.
|
|
4648
|
+
version: "21.1.0-next.1",
|
|
4629
4649
|
ngImport: i0,
|
|
4630
4650
|
type: HistoryStateManager,
|
|
4631
4651
|
deps: null,
|
|
@@ -4633,7 +4653,7 @@ class HistoryStateManager extends StateManager {
|
|
|
4633
4653
|
});
|
|
4634
4654
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
4635
4655
|
minVersion: "12.0.0",
|
|
4636
|
-
version: "21.0.
|
|
4656
|
+
version: "21.1.0-next.1",
|
|
4637
4657
|
ngImport: i0,
|
|
4638
4658
|
type: HistoryStateManager,
|
|
4639
4659
|
providedIn: 'root'
|
|
@@ -4641,7 +4661,7 @@ class HistoryStateManager extends StateManager {
|
|
|
4641
4661
|
}
|
|
4642
4662
|
i0.ɵɵngDeclareClassMetadata({
|
|
4643
4663
|
minVersion: "12.0.0",
|
|
4644
|
-
version: "21.0.
|
|
4664
|
+
version: "21.1.0-next.1",
|
|
4645
4665
|
ngImport: i0,
|
|
4646
4666
|
type: HistoryStateManager,
|
|
4647
4667
|
decorators: [{
|
|
@@ -4739,6 +4759,7 @@ class Router {
|
|
|
4739
4759
|
const opts = e.navigationBehaviorOptions;
|
|
4740
4760
|
const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);
|
|
4741
4761
|
const extras = {
|
|
4762
|
+
scroll: currentTransition.extras.scroll,
|
|
4742
4763
|
browserUrl: currentTransition.extras.browserUrl,
|
|
4743
4764
|
info: currentTransition.extras.info,
|
|
4744
4765
|
skipLocationChange: currentTransition.extras.skipLocationChange,
|
|
@@ -4955,7 +4976,7 @@ class Router {
|
|
|
4955
4976
|
}
|
|
4956
4977
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
4957
4978
|
minVersion: "12.0.0",
|
|
4958
|
-
version: "21.0.
|
|
4979
|
+
version: "21.1.0-next.1",
|
|
4959
4980
|
ngImport: i0,
|
|
4960
4981
|
type: Router,
|
|
4961
4982
|
deps: [],
|
|
@@ -4963,7 +4984,7 @@ class Router {
|
|
|
4963
4984
|
});
|
|
4964
4985
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
4965
4986
|
minVersion: "12.0.0",
|
|
4966
|
-
version: "21.0.
|
|
4987
|
+
version: "21.1.0-next.1",
|
|
4967
4988
|
ngImport: i0,
|
|
4968
4989
|
type: Router,
|
|
4969
4990
|
providedIn: 'root'
|
|
@@ -4971,7 +4992,7 @@ class Router {
|
|
|
4971
4992
|
}
|
|
4972
4993
|
i0.ɵɵngDeclareClassMetadata({
|
|
4973
4994
|
minVersion: "12.0.0",
|
|
4974
|
-
version: "21.0.
|
|
4995
|
+
version: "21.1.0-next.1",
|
|
4975
4996
|
ngImport: i0,
|
|
4976
4997
|
type: Router,
|
|
4977
4998
|
decorators: [{
|
|
@@ -4991,5 +5012,5 @@ function validateCommands(commands) {
|
|
|
4991
5012
|
}
|
|
4992
5013
|
}
|
|
4993
5014
|
|
|
4994
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, CREATE_VIEW_TRANSITION, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart,
|
|
5015
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, BeforeActivateRoutes, CREATE_VIEW_TRANSITION, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, IMPERATIVE_NAVIGATION, INPUT_BINDER, NAVIGATION_ERROR_HANDLER, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NavigationTransitions, OutletContext, PRIMARY_OUTLET, ROUTER_CONFIGURATION, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, RoutedComponentInputBinder, Router, RouterConfigLoader, RouterEvent, RouterOutlet, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, StateManager, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VIEW_TRANSITION_OPTIONS, afterNextNavigation, convertToParamMap, createUrlTreeFromSnapshot, createViewTransition, defaultUrlMatcher, isRedirectingEvent, isUrlTree, loadChildren, provideSometimesSyncRecognize, stringifyEvent, ɵEmptyOutletComponent };
|
|
4995
5016
|
//# sourceMappingURL=_router-chunk.mjs.map
|