@angular/router 17.2.0-rc.0 → 17.2.0
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/esm2022/src/apply_redirects.mjs +4 -3
- package/esm2022/src/components/empty_outlet.mjs +4 -4
- package/esm2022/src/create_router_state.mjs +5 -5
- package/esm2022/src/create_url_tree.mjs +17 -15
- package/esm2022/src/directives/router_link.mjs +29 -23
- package/esm2022/src/directives/router_link_active.mjs +18 -14
- package/esm2022/src/directives/router_outlet.mjs +14 -12
- package/esm2022/src/events.mjs +8 -6
- package/esm2022/src/index.mjs +9 -9
- package/esm2022/src/models.mjs +1 -1
- package/esm2022/src/models_deprecated.mjs +1 -1
- package/esm2022/src/navigation_canceling_error.mjs +6 -4
- package/esm2022/src/navigation_transition.mjs +64 -66
- package/esm2022/src/operators/activate_routes.mjs +10 -9
- package/esm2022/src/operators/check_guards.mjs +36 -38
- package/esm2022/src/operators/prioritized_guard_value.mjs +3 -4
- package/esm2022/src/operators/recognize.mjs +2 -3
- package/esm2022/src/operators/resolve_data.mjs +13 -15
- package/esm2022/src/operators/switch_tap.mjs +2 -2
- package/esm2022/src/page_title_strategy.mjs +8 -8
- package/esm2022/src/private_export.mjs +1 -1
- package/esm2022/src/provide_router.mjs +39 -34
- package/esm2022/src/recognize.mjs +28 -40
- package/esm2022/src/route_reuse_strategy.mjs +7 -7
- package/esm2022/src/router.mjs +21 -19
- package/esm2022/src/router_config.mjs +2 -2
- package/esm2022/src/router_config_loader.mjs +8 -11
- package/esm2022/src/router_module.mjs +24 -20
- package/esm2022/src/router_outlet_context.mjs +4 -4
- package/esm2022/src/router_preloader.mjs +15 -17
- package/esm2022/src/router_scroller.mjs +7 -7
- package/esm2022/src/router_state.mjs +9 -9
- package/esm2022/src/shared.mjs +1 -1
- package/esm2022/src/statemanager/state_manager.mjs +12 -14
- package/esm2022/src/url_handling_strategy.mjs +6 -6
- package/esm2022/src/url_tree.mjs +25 -22
- package/esm2022/src/utils/collection.mjs +1 -1
- package/esm2022/src/utils/config.mjs +22 -12
- package/esm2022/src/utils/config_matching.mjs +10 -11
- package/esm2022/src/utils/functional_guards.mjs +5 -5
- package/esm2022/src/utils/navigations.mjs +10 -8
- package/esm2022/src/utils/preactivation.mjs +9 -11
- package/esm2022/src/utils/tree.mjs +6 -6
- package/esm2022/src/utils/type_guards.mjs +1 -1
- package/esm2022/src/utils/view_transition.mjs +3 -3
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/router_testing_harness.mjs +9 -9
- package/esm2022/testing/src/router_testing_module.mjs +8 -8
- package/esm2022/upgrade/src/upgrade.mjs +6 -6
- package/fesm2022/router.mjs +449 -433
- package/fesm2022/router.mjs.map +1 -1
- package/fesm2022/testing.mjs +15 -15
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +6 -6
- package/fesm2022/upgrade.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2022/router.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.2.0
|
|
2
|
+
* @license Angular v17.2.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -178,9 +178,9 @@ const paramCompareMap = {
|
|
|
178
178
|
'ignored': () => true,
|
|
179
179
|
};
|
|
180
180
|
function containsTree(container, containee, options) {
|
|
181
|
-
return pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) &&
|
|
181
|
+
return (pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) &&
|
|
182
182
|
paramCompareMap[options.queryParams](container.queryParams, containee.queryParams) &&
|
|
183
|
-
!(options.fragment === 'exact' && container.fragment !== containee.fragment);
|
|
183
|
+
!(options.fragment === 'exact' && container.fragment !== containee.fragment));
|
|
184
184
|
}
|
|
185
185
|
function equalParams(container, containee) {
|
|
186
186
|
// TODO: This does not handle array params correctly.
|
|
@@ -203,8 +203,8 @@ function equalSegmentGroups(container, containee, matrixParams) {
|
|
|
203
203
|
return true;
|
|
204
204
|
}
|
|
205
205
|
function containsParams(container, containee) {
|
|
206
|
-
return Object.keys(containee).length <= Object.keys(container).length &&
|
|
207
|
-
Object.keys(containee).every(key => equalArraysOrString(container[key], containee[key]));
|
|
206
|
+
return (Object.keys(containee).length <= Object.keys(container).length &&
|
|
207
|
+
Object.keys(containee).every((key) => equalArraysOrString(container[key], containee[key])));
|
|
208
208
|
}
|
|
209
209
|
function containsSegmentGroup(container, containee, matrixParams) {
|
|
210
210
|
return containsSegmentGroupHelper(container, containee, containee.segments, matrixParams);
|
|
@@ -421,10 +421,10 @@ function mapChildrenIntoArray(segment, fn) {
|
|
|
421
421
|
* @publicApi
|
|
422
422
|
*/
|
|
423
423
|
class UrlSerializer {
|
|
424
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
425
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
424
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
425
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }); }
|
|
426
426
|
}
|
|
427
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
427
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: UrlSerializer, decorators: [{
|
|
428
428
|
type: Injectable,
|
|
429
429
|
args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
|
|
430
430
|
}] });
|
|
@@ -462,16 +462,16 @@ class DefaultUrlSerializer {
|
|
|
462
462
|
}
|
|
463
463
|
const DEFAULT_SERIALIZER = new DefaultUrlSerializer();
|
|
464
464
|
function serializePaths(segment) {
|
|
465
|
-
return segment.segments.map(p => serializePath(p)).join('/');
|
|
465
|
+
return segment.segments.map((p) => serializePath(p)).join('/');
|
|
466
466
|
}
|
|
467
467
|
function serializeSegment(segment, root) {
|
|
468
468
|
if (!segment.hasChildren()) {
|
|
469
469
|
return serializePaths(segment);
|
|
470
470
|
}
|
|
471
471
|
if (root) {
|
|
472
|
-
const primary = segment.children[PRIMARY_OUTLET]
|
|
473
|
-
serializeSegment(segment.children[PRIMARY_OUTLET], false)
|
|
474
|
-
'';
|
|
472
|
+
const primary = segment.children[PRIMARY_OUTLET]
|
|
473
|
+
? serializeSegment(segment.children[PRIMARY_OUTLET], false)
|
|
474
|
+
: '';
|
|
475
475
|
const children = [];
|
|
476
476
|
Object.entries(segment.children).forEach(([k, v]) => {
|
|
477
477
|
if (k !== PRIMARY_OUTLET) {
|
|
@@ -554,11 +554,11 @@ function serializeMatrixParams(params) {
|
|
|
554
554
|
function serializeQueryParams(params) {
|
|
555
555
|
const strParams = Object.entries(params)
|
|
556
556
|
.map(([name, value]) => {
|
|
557
|
-
return Array.isArray(value)
|
|
558
|
-
value.map(v => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&')
|
|
559
|
-
`${encodeUriQuery(name)}=${encodeUriQuery(value)}`;
|
|
557
|
+
return Array.isArray(value)
|
|
558
|
+
? value.map((v) => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&')
|
|
559
|
+
: `${encodeUriQuery(name)}=${encodeUriQuery(value)}`;
|
|
560
560
|
})
|
|
561
|
-
.filter(s => s);
|
|
561
|
+
.filter((s) => s);
|
|
562
562
|
return strParams.length ? `?${strParams.join('&')}` : '';
|
|
563
563
|
}
|
|
564
564
|
const SEGMENT_RE = /^[^\/()?;#]+/;
|
|
@@ -722,8 +722,10 @@ class UrlParser {
|
|
|
722
722
|
outletName = PRIMARY_OUTLET;
|
|
723
723
|
}
|
|
724
724
|
const children = this.parseChildren();
|
|
725
|
-
segments[outletName] =
|
|
726
|
-
|
|
725
|
+
segments[outletName] =
|
|
726
|
+
Object.keys(children).length === 1
|
|
727
|
+
? children[PRIMARY_OUTLET]
|
|
728
|
+
: new UrlSegmentGroup([], children);
|
|
727
729
|
this.consumeOptional('//');
|
|
728
730
|
}
|
|
729
731
|
return segments;
|
|
@@ -746,9 +748,9 @@ class UrlParser {
|
|
|
746
748
|
}
|
|
747
749
|
}
|
|
748
750
|
function createRoot(rootCandidate) {
|
|
749
|
-
return rootCandidate.segments.length > 0
|
|
750
|
-
new UrlSegmentGroup([], { [PRIMARY_OUTLET]: rootCandidate })
|
|
751
|
-
rootCandidate;
|
|
751
|
+
return rootCandidate.segments.length > 0
|
|
752
|
+
? new UrlSegmentGroup([], { [PRIMARY_OUTLET]: rootCandidate })
|
|
753
|
+
: rootCandidate;
|
|
752
754
|
}
|
|
753
755
|
/**
|
|
754
756
|
* Recursively
|
|
@@ -765,7 +767,8 @@ function squashSegmentGroup(segmentGroup) {
|
|
|
765
767
|
for (const [childOutlet, child] of Object.entries(segmentGroup.children)) {
|
|
766
768
|
const childCandidate = squashSegmentGroup(child);
|
|
767
769
|
// moves named children in an empty path primary child into this group
|
|
768
|
-
if (childOutlet === PRIMARY_OUTLET &&
|
|
770
|
+
if (childOutlet === PRIMARY_OUTLET &&
|
|
771
|
+
childCandidate.segments.length === 0 &&
|
|
769
772
|
childCandidate.hasChildren()) {
|
|
770
773
|
for (const [grandChildOutlet, grandChild] of Object.entries(childCandidate.children)) {
|
|
771
774
|
newChildren[grandChildOutlet] = grandChild;
|
|
@@ -886,9 +889,9 @@ function createUrlTreeFromSegmentGroup(relativeTo, commands, queryParams, fragme
|
|
|
886
889
|
return tree(root, root, new UrlSegmentGroup([], {}), queryParams, fragment);
|
|
887
890
|
}
|
|
888
891
|
const position = findStartingPositionForTargetGroup(nav, root, relativeTo);
|
|
889
|
-
const newSegmentGroup = position.processChildren
|
|
890
|
-
updateSegmentGroupChildren(position.segmentGroup, position.index, nav.commands)
|
|
891
|
-
updateSegmentGroup(position.segmentGroup, position.index, nav.commands);
|
|
892
|
+
const newSegmentGroup = position.processChildren
|
|
893
|
+
? updateSegmentGroupChildren(position.segmentGroup, position.index, nav.commands)
|
|
894
|
+
: updateSegmentGroup(position.segmentGroup, position.index, nav.commands);
|
|
892
895
|
return tree(root, position.segmentGroup, newSegmentGroup, queryParams, fragment);
|
|
893
896
|
}
|
|
894
897
|
function isMatrixParams(command) {
|
|
@@ -958,7 +961,7 @@ class Navigation {
|
|
|
958
961
|
}
|
|
959
962
|
/** Transforms commands to a normalized `Navigation` */
|
|
960
963
|
function computeNavigation(commands) {
|
|
961
|
-
if (
|
|
964
|
+
if (typeof commands[0] === 'string' && commands.length === 1 && commands[0] === '/') {
|
|
962
965
|
return new Navigation(true, 0, commands);
|
|
963
966
|
}
|
|
964
967
|
let numberOfDoubleDots = 0;
|
|
@@ -984,10 +987,12 @@ function computeNavigation(commands) {
|
|
|
984
987
|
if (partIndex == 0 && urlPart === '.') {
|
|
985
988
|
// skip './a'
|
|
986
989
|
}
|
|
987
|
-
else if (partIndex == 0 && urlPart === '') {
|
|
990
|
+
else if (partIndex == 0 && urlPart === '') {
|
|
991
|
+
// '/a'
|
|
988
992
|
isAbsolute = true;
|
|
989
993
|
}
|
|
990
|
-
else if (urlPart === '..') {
|
|
994
|
+
else if (urlPart === '..') {
|
|
995
|
+
// '../a'
|
|
991
996
|
numberOfDoubleDots++;
|
|
992
997
|
}
|
|
993
998
|
else if (urlPart != '') {
|
|
@@ -1033,7 +1038,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1033
1038
|
dd -= ci;
|
|
1034
1039
|
g = g.parent;
|
|
1035
1040
|
if (!g) {
|
|
1036
|
-
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
1041
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, (typeof ngDevMode === 'undefined' || ngDevMode) && "Invalid number of '../'");
|
|
1037
1042
|
}
|
|
1038
1043
|
ci = g.segments.length;
|
|
1039
1044
|
}
|
|
@@ -1054,8 +1059,7 @@ function updateSegmentGroup(segmentGroup, startIndex, commands) {
|
|
|
1054
1059
|
const slicedCommands = commands.slice(m.commandIndex);
|
|
1055
1060
|
if (m.match && m.pathIndex < segmentGroup.segments.length) {
|
|
1056
1061
|
const g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});
|
|
1057
|
-
g.children[PRIMARY_OUTLET] =
|
|
1058
|
-
new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);
|
|
1062
|
+
g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);
|
|
1059
1063
|
return updateSegmentGroupChildren(g, 0, slicedCommands);
|
|
1060
1064
|
}
|
|
1061
1065
|
else if (m.match && slicedCommands.length === 0) {
|
|
@@ -1099,8 +1103,9 @@ function updateSegmentGroupChildren(segmentGroup, startIndex, commands) {
|
|
|
1099
1103
|
// `UrlSegmentGroup` that is created from an "unsquashed"/expanded `ActivatedRoute` tree.
|
|
1100
1104
|
// This code effectively "squashes" empty path primary routes when they have no siblings on
|
|
1101
1105
|
// the same level of the tree.
|
|
1102
|
-
if (Object.keys(outlets).some(o => o !== PRIMARY_OUTLET) &&
|
|
1103
|
-
segmentGroup.children[PRIMARY_OUTLET] &&
|
|
1106
|
+
if (Object.keys(outlets).some((o) => o !== PRIMARY_OUTLET) &&
|
|
1107
|
+
segmentGroup.children[PRIMARY_OUTLET] &&
|
|
1108
|
+
segmentGroup.numberOfChildren === 1 &&
|
|
1104
1109
|
segmentGroup.children[PRIMARY_OUTLET].segments.length === 0) {
|
|
1105
1110
|
const childrenOfEmptyChild = updateSegmentGroupChildren(segmentGroup.children[PRIMARY_OUTLET], startIndex, commands);
|
|
1106
1111
|
return new UrlSegmentGroup(segmentGroup.segments, childrenOfEmptyChild.children);
|
|
@@ -1140,7 +1145,7 @@ function prefixedWith(segmentGroup, startIndex, commands) {
|
|
|
1140
1145
|
const next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;
|
|
1141
1146
|
if (currentPathIndex > 0 && curr === undefined)
|
|
1142
1147
|
break;
|
|
1143
|
-
if (curr && next &&
|
|
1148
|
+
if (curr && next && typeof next === 'object' && next.outlets === undefined) {
|
|
1144
1149
|
if (!compare(curr, next, path))
|
|
1145
1150
|
return noMatch;
|
|
1146
1151
|
currentCommandIndex += 2;
|
|
@@ -1171,7 +1176,7 @@ function createNewSegmentGroup(segmentGroup, startIndex, commands) {
|
|
|
1171
1176
|
continue;
|
|
1172
1177
|
}
|
|
1173
1178
|
const curr = isCommandWithOutlets(command) ? command.outlets[PRIMARY_OUTLET] : `${command}`;
|
|
1174
|
-
const next =
|
|
1179
|
+
const next = i < commands.length - 1 ? commands[i + 1] : null;
|
|
1175
1180
|
if (curr && next && isMatrixParams(next)) {
|
|
1176
1181
|
paths.push(new UrlSegment(curr, stringify(next)));
|
|
1177
1182
|
i += 2;
|
|
@@ -1197,7 +1202,7 @@ function createNewSegmentChildren(outlets) {
|
|
|
1197
1202
|
}
|
|
1198
1203
|
function stringify(params) {
|
|
1199
1204
|
const res = {};
|
|
1200
|
-
Object.entries(params).forEach(([k, v]) => res[k] = `${v}`);
|
|
1205
|
+
Object.entries(params).forEach(([k, v]) => (res[k] = `${v}`));
|
|
1201
1206
|
return res;
|
|
1202
1207
|
}
|
|
1203
1208
|
function compare(path, params, segment) {
|
|
@@ -1649,7 +1654,7 @@ class ChildActivationStart {
|
|
|
1649
1654
|
this.type = EventType.ChildActivationStart;
|
|
1650
1655
|
}
|
|
1651
1656
|
toString() {
|
|
1652
|
-
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
|
1657
|
+
const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || '';
|
|
1653
1658
|
return `ChildActivationStart(path: '${path}')`;
|
|
1654
1659
|
}
|
|
1655
1660
|
}
|
|
@@ -1668,7 +1673,7 @@ class ChildActivationEnd {
|
|
|
1668
1673
|
this.type = EventType.ChildActivationEnd;
|
|
1669
1674
|
}
|
|
1670
1675
|
toString() {
|
|
1671
|
-
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
|
1676
|
+
const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || '';
|
|
1672
1677
|
return `ChildActivationEnd(path: '${path}')`;
|
|
1673
1678
|
}
|
|
1674
1679
|
}
|
|
@@ -1688,7 +1693,7 @@ class ActivationStart {
|
|
|
1688
1693
|
this.type = EventType.ActivationStart;
|
|
1689
1694
|
}
|
|
1690
1695
|
toString() {
|
|
1691
|
-
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
|
1696
|
+
const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || '';
|
|
1692
1697
|
return `ActivationStart(path: '${path}')`;
|
|
1693
1698
|
}
|
|
1694
1699
|
}
|
|
@@ -1708,7 +1713,7 @@ class ActivationEnd {
|
|
|
1708
1713
|
this.type = EventType.ActivationEnd;
|
|
1709
1714
|
}
|
|
1710
1715
|
toString() {
|
|
1711
|
-
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
|
1716
|
+
const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || '';
|
|
1712
1717
|
return `ActivationEnd(path: '${path}')`;
|
|
1713
1718
|
}
|
|
1714
1719
|
}
|
|
@@ -1777,7 +1782,9 @@ function stringifyEvent(routerEvent) {
|
|
|
1777
1782
|
case EventType.RoutesRecognized:
|
|
1778
1783
|
return `RoutesRecognized(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
|
|
1779
1784
|
case EventType.Scroll:
|
|
1780
|
-
const pos = routerEvent.position
|
|
1785
|
+
const pos = routerEvent.position
|
|
1786
|
+
? `${routerEvent.position[0]}, ${routerEvent.position[1]}`
|
|
1787
|
+
: null;
|
|
1781
1788
|
return `Scroll(anchor: '${routerEvent.anchor}', position: '${pos}')`;
|
|
1782
1789
|
}
|
|
1783
1790
|
}
|
|
@@ -1847,10 +1854,10 @@ class ChildrenOutletContexts {
|
|
|
1847
1854
|
getContext(childName) {
|
|
1848
1855
|
return this.contexts.get(childName) || null;
|
|
1849
1856
|
}
|
|
1850
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
1851
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
1857
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1858
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' }); }
|
|
1852
1859
|
}
|
|
1853
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
1860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
1854
1861
|
type: Injectable,
|
|
1855
1862
|
args: [{ providedIn: 'root' }]
|
|
1856
1863
|
}] });
|
|
@@ -1874,7 +1881,7 @@ class Tree {
|
|
|
1874
1881
|
*/
|
|
1875
1882
|
children(t) {
|
|
1876
1883
|
const n = findNode(t, this._root);
|
|
1877
|
-
return n ? n.children.map(t => t.value) : [];
|
|
1884
|
+
return n ? n.children.map((t) => t.value) : [];
|
|
1878
1885
|
}
|
|
1879
1886
|
/**
|
|
1880
1887
|
* @internal
|
|
@@ -1890,14 +1897,14 @@ class Tree {
|
|
|
1890
1897
|
const p = findPath(t, this._root);
|
|
1891
1898
|
if (p.length < 2)
|
|
1892
1899
|
return [];
|
|
1893
|
-
const c = p[p.length - 2].children.map(c => c.value);
|
|
1894
|
-
return c.filter(cc => cc !== t);
|
|
1900
|
+
const c = p[p.length - 2].children.map((c) => c.value);
|
|
1901
|
+
return c.filter((cc) => cc !== t);
|
|
1895
1902
|
}
|
|
1896
1903
|
/**
|
|
1897
1904
|
* @internal
|
|
1898
1905
|
*/
|
|
1899
1906
|
pathFromRoot(t) {
|
|
1900
|
-
return findPath(t, this._root).map(s => s.value);
|
|
1907
|
+
return findPath(t, this._root).map((s) => s.value);
|
|
1901
1908
|
}
|
|
1902
1909
|
}
|
|
1903
1910
|
// DFS for the node matching the value
|
|
@@ -1937,7 +1944,7 @@ class TreeNode {
|
|
|
1937
1944
|
function nodeChildrenAsMap(node) {
|
|
1938
1945
|
const map = {};
|
|
1939
1946
|
if (node) {
|
|
1940
|
-
node.children.forEach(child => map[child.value.outlet] = child);
|
|
1947
|
+
node.children.forEach((child) => (map[child.value.outlet] = child));
|
|
1941
1948
|
}
|
|
1942
1949
|
return map;
|
|
1943
1950
|
}
|
|
@@ -2095,8 +2102,7 @@ class ActivatedRoute {
|
|
|
2095
2102
|
* The map supports retrieving single and multiple values from the query parameter.
|
|
2096
2103
|
*/
|
|
2097
2104
|
get queryParamMap() {
|
|
2098
|
-
this._queryParamMap ??=
|
|
2099
|
-
this.queryParams.pipe(map((p) => convertToParamMap(p)));
|
|
2105
|
+
this._queryParamMap ??= this.queryParams.pipe(map((p) => convertToParamMap(p)));
|
|
2100
2106
|
return this._queryParamMap;
|
|
2101
2107
|
}
|
|
2102
2108
|
toString() {
|
|
@@ -2135,14 +2141,14 @@ function getInherited(route, parent, paramsInheritanceStrategy = 'emptyOnly') {
|
|
|
2135
2141
|
...routeConfig?.data,
|
|
2136
2142
|
// resolved data from current route overrides everything
|
|
2137
2143
|
...route._resolvedData,
|
|
2138
|
-
}
|
|
2144
|
+
},
|
|
2139
2145
|
};
|
|
2140
2146
|
}
|
|
2141
2147
|
else {
|
|
2142
2148
|
inherited = {
|
|
2143
2149
|
params: { ...route.params },
|
|
2144
2150
|
data: { ...route.data },
|
|
2145
|
-
resolve: { ...route.data, ...(route._resolvedData ?? {}) }
|
|
2151
|
+
resolve: { ...route.data, ...(route._resolvedData ?? {}) },
|
|
2146
2152
|
};
|
|
2147
2153
|
}
|
|
2148
2154
|
if (routeConfig && hasStaticTitle(routeConfig)) {
|
|
@@ -2253,7 +2259,7 @@ class ActivatedRouteSnapshot {
|
|
|
2253
2259
|
return this._queryParamMap;
|
|
2254
2260
|
}
|
|
2255
2261
|
toString() {
|
|
2256
|
-
const url = this.url.map(segment => segment.toString()).join('/');
|
|
2262
|
+
const url = this.url.map((segment) => segment.toString()).join('/');
|
|
2257
2263
|
const matched = this.routeConfig ? this.routeConfig.path : '';
|
|
2258
2264
|
return `Route(url:'${url}', path:'${matched}')`;
|
|
2259
2265
|
}
|
|
@@ -2300,7 +2306,7 @@ class RouterStateSnapshot extends Tree {
|
|
|
2300
2306
|
}
|
|
2301
2307
|
function setRouterState(state, node) {
|
|
2302
2308
|
node.value._routerState = state;
|
|
2303
|
-
node.children.forEach(c => setRouterState(state, c));
|
|
2309
|
+
node.children.forEach((c) => setRouterState(state, c));
|
|
2304
2310
|
}
|
|
2305
2311
|
function serializeNode(node) {
|
|
2306
2312
|
const c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(', ')} } ` : '';
|
|
@@ -2341,8 +2347,9 @@ function advanceActivatedRoute(route) {
|
|
|
2341
2347
|
function equalParamsAndUrlSegments(a, b) {
|
|
2342
2348
|
const equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);
|
|
2343
2349
|
const parentsMismatch = !a.parent !== !b.parent;
|
|
2344
|
-
return equalUrlParams &&
|
|
2345
|
-
|
|
2350
|
+
return (equalUrlParams &&
|
|
2351
|
+
!parentsMismatch &&
|
|
2352
|
+
(!a.parent || equalParamsAndUrlSegments(a.parent, b.parent)));
|
|
2346
2353
|
}
|
|
2347
2354
|
function hasStaticTitle(config) {
|
|
2348
2355
|
return typeof config.title === 'string' || config.title === null;
|
|
@@ -2554,7 +2561,7 @@ class RouterOutlet {
|
|
|
2554
2561
|
this.activated = location.createComponent(component, {
|
|
2555
2562
|
index: location.length,
|
|
2556
2563
|
injector,
|
|
2557
|
-
environmentInjector: environmentInjector ?? this.environmentInjector
|
|
2564
|
+
environmentInjector: environmentInjector ?? this.environmentInjector,
|
|
2558
2565
|
});
|
|
2559
2566
|
// Calling `markForCheck` to make sure we will run the change detection when the
|
|
2560
2567
|
// `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
|
|
@@ -2562,10 +2569,10 @@ class RouterOutlet {
|
|
|
2562
2569
|
this.inputBinder?.bindActivatedRouteToOutletComponent(this);
|
|
2563
2570
|
this.activateEvents.emit(this.activated.instance);
|
|
2564
2571
|
}
|
|
2565
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
2566
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0
|
|
2572
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2573
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 }); }
|
|
2567
2574
|
}
|
|
2568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
2575
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2569
2576
|
type: Directive,
|
|
2570
2577
|
args: [{
|
|
2571
2578
|
selector: 'router-outlet',
|
|
@@ -2620,7 +2627,7 @@ const INPUT_BINDER = new InjectionToken('');
|
|
|
2620
2627
|
*/
|
|
2621
2628
|
class RoutedComponentInputBinder {
|
|
2622
2629
|
constructor() {
|
|
2623
|
-
this.outletDataSubscriptions = new Map;
|
|
2630
|
+
this.outletDataSubscriptions = new Map();
|
|
2624
2631
|
}
|
|
2625
2632
|
bindActivatedRouteToOutletComponent(outlet) {
|
|
2626
2633
|
this.unsubscribeFromRouteData(outlet);
|
|
@@ -2649,11 +2656,13 @@ class RoutedComponentInputBinder {
|
|
|
2649
2656
|
// another.
|
|
2650
2657
|
return Promise.resolve(data);
|
|
2651
2658
|
}))
|
|
2652
|
-
.subscribe(data => {
|
|
2659
|
+
.subscribe((data) => {
|
|
2653
2660
|
// Outlet may have been deactivated or changed names to be associated with a different
|
|
2654
2661
|
// route
|
|
2655
|
-
if (!outlet.isActivated ||
|
|
2656
|
-
outlet.
|
|
2662
|
+
if (!outlet.isActivated ||
|
|
2663
|
+
!outlet.activatedComponentRef ||
|
|
2664
|
+
outlet.activatedRoute !== activatedRoute ||
|
|
2665
|
+
activatedRoute.component === null) {
|
|
2657
2666
|
this.unsubscribeFromRouteData(outlet);
|
|
2658
2667
|
return;
|
|
2659
2668
|
}
|
|
@@ -2668,10 +2677,10 @@ class RoutedComponentInputBinder {
|
|
|
2668
2677
|
});
|
|
2669
2678
|
this.outletDataSubscriptions.set(outlet, dataSubscription);
|
|
2670
2679
|
}
|
|
2671
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
2672
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
2680
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RoutedComponentInputBinder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2681
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RoutedComponentInputBinder }); }
|
|
2673
2682
|
}
|
|
2674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
2683
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RoutedComponentInputBinder, decorators: [{
|
|
2675
2684
|
type: Injectable
|
|
2676
2685
|
}] });
|
|
2677
2686
|
|
|
@@ -2694,17 +2703,17 @@ function createNode(routeReuseStrategy, curr, prevState) {
|
|
|
2694
2703
|
if (detachedRouteHandle !== null) {
|
|
2695
2704
|
const tree = detachedRouteHandle.route;
|
|
2696
2705
|
tree.value._futureSnapshot = curr.value;
|
|
2697
|
-
tree.children = curr.children.map(c => createNode(routeReuseStrategy, c));
|
|
2706
|
+
tree.children = curr.children.map((c) => createNode(routeReuseStrategy, c));
|
|
2698
2707
|
return tree;
|
|
2699
2708
|
}
|
|
2700
2709
|
}
|
|
2701
2710
|
const value = createActivatedRoute(curr.value);
|
|
2702
|
-
const children = curr.children.map(c => createNode(routeReuseStrategy, c));
|
|
2711
|
+
const children = curr.children.map((c) => createNode(routeReuseStrategy, c));
|
|
2703
2712
|
return new TreeNode(value, children);
|
|
2704
2713
|
}
|
|
2705
2714
|
}
|
|
2706
2715
|
function createOrReuseChildren(routeReuseStrategy, curr, prevState) {
|
|
2707
|
-
return curr.children.map(child => {
|
|
2716
|
+
return curr.children.map((child) => {
|
|
2708
2717
|
for (const p of prevState.children) {
|
|
2709
2718
|
if (routeReuseStrategy.shouldReuseRoute(child.value, p.value.snapshot)) {
|
|
2710
2719
|
return createNode(routeReuseStrategy, child, p);
|
|
@@ -2719,7 +2728,9 @@ function createActivatedRoute(c) {
|
|
|
2719
2728
|
|
|
2720
2729
|
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
|
2721
2730
|
function redirectingNavigationError(urlSerializer, redirect) {
|
|
2722
|
-
const { redirectTo, navigationBehaviorOptions } = isUrlTree(redirect)
|
|
2731
|
+
const { redirectTo, navigationBehaviorOptions } = isUrlTree(redirect)
|
|
2732
|
+
? { redirectTo: redirect, navigationBehaviorOptions: undefined }
|
|
2733
|
+
: redirect;
|
|
2723
2734
|
const error = navigationCancelingError(ngDevMode && `Redirecting to "${urlSerializer.serialize(redirectTo)}"`, NavigationCancellationCode.Redirect);
|
|
2724
2735
|
error.url = redirectTo;
|
|
2725
2736
|
error.navigationBehaviorOptions = navigationBehaviorOptions;
|
|
@@ -2732,8 +2743,8 @@ function navigationCancelingError(message, code) {
|
|
|
2732
2743
|
return error;
|
|
2733
2744
|
}
|
|
2734
2745
|
function isRedirectingNavigationCancelingError(error) {
|
|
2735
|
-
return isNavigationCancelingError(error) &&
|
|
2736
|
-
isUrlTree(error.url);
|
|
2746
|
+
return (isNavigationCancelingError(error) &&
|
|
2747
|
+
isUrlTree(error.url));
|
|
2737
2748
|
}
|
|
2738
2749
|
function isNavigationCancelingError(error) {
|
|
2739
2750
|
return !!error && error[NAVIGATION_CANCELING_ERROR];
|
|
@@ -2749,10 +2760,10 @@ function isNavigationCancelingError(error) {
|
|
|
2749
2760
|
* to this `EmptyOutletComponent`.
|
|
2750
2761
|
*/
|
|
2751
2762
|
class ɵEmptyOutletComponent {
|
|
2752
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
2753
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0
|
|
2763
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2764
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
|
|
2754
2765
|
}
|
|
2755
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
2766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2756
2767
|
type: Component,
|
|
2757
2768
|
args: [{
|
|
2758
2769
|
template: `<router-outlet></router-outlet>`,
|
|
@@ -2771,8 +2782,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0-rc.0", ng
|
|
|
2771
2782
|
*/
|
|
2772
2783
|
function getOrCreateRouteInjectorIfNeeded(route, currentInjector) {
|
|
2773
2784
|
if (route.providers && !route._injector) {
|
|
2774
|
-
route._injector =
|
|
2775
|
-
createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
|
|
2785
|
+
route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
|
|
2776
2786
|
}
|
|
2777
2787
|
return route._injector ?? currentInjector;
|
|
2778
2788
|
}
|
|
@@ -2823,8 +2833,13 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
|
2823
2833
|
if (Array.isArray(route)) {
|
|
2824
2834
|
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
|
|
2825
2835
|
}
|
|
2826
|
-
if (!route.redirectTo &&
|
|
2827
|
-
!route.
|
|
2836
|
+
if (!route.redirectTo &&
|
|
2837
|
+
!route.component &&
|
|
2838
|
+
!route.loadComponent &&
|
|
2839
|
+
!route.children &&
|
|
2840
|
+
!route.loadChildren &&
|
|
2841
|
+
route.outlet &&
|
|
2842
|
+
route.outlet !== PRIMARY_OUTLET) {
|
|
2828
2843
|
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
|
|
2829
2844
|
}
|
|
2830
2845
|
if (route.redirectTo && route.children) {
|
|
@@ -2849,8 +2864,11 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
|
2849
2864
|
if (route.path && route.matcher) {
|
|
2850
2865
|
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
|
|
2851
2866
|
}
|
|
2852
|
-
if (route.redirectTo === void 0 &&
|
|
2853
|
-
!route.
|
|
2867
|
+
if (route.redirectTo === void 0 &&
|
|
2868
|
+
!route.component &&
|
|
2869
|
+
!route.loadComponent &&
|
|
2870
|
+
!route.children &&
|
|
2871
|
+
!route.loadChildren) {
|
|
2854
2872
|
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
|
|
2855
2873
|
}
|
|
2856
2874
|
if (route.path === void 0 && route.matcher === void 0) {
|
|
@@ -2894,8 +2912,11 @@ function getFullPath(parentPath, currentRoute) {
|
|
|
2894
2912
|
function standardizeConfig(r) {
|
|
2895
2913
|
const children = r.children && r.children.map(standardizeConfig);
|
|
2896
2914
|
const c = children ? { ...r, children } : { ...r };
|
|
2897
|
-
if (
|
|
2898
|
-
|
|
2915
|
+
if (!c.component &&
|
|
2916
|
+
!c.loadComponent &&
|
|
2917
|
+
(children || c.loadChildren) &&
|
|
2918
|
+
c.outlet &&
|
|
2919
|
+
c.outlet !== PRIMARY_OUTLET) {
|
|
2899
2920
|
c.component = ɵEmptyOutletComponent;
|
|
2900
2921
|
}
|
|
2901
2922
|
return c;
|
|
@@ -2909,8 +2930,8 @@ function getOutlet(route) {
|
|
|
2909
2930
|
* The order of the configs is otherwise preserved.
|
|
2910
2931
|
*/
|
|
2911
2932
|
function sortByMatchingOutlets(routes, outletName) {
|
|
2912
|
-
const sortedConfig = routes.filter(r => getOutlet(r) === outletName);
|
|
2913
|
-
sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));
|
|
2933
|
+
const sortedConfig = routes.filter((r) => getOutlet(r) === outletName);
|
|
2934
|
+
sortedConfig.push(...routes.filter((r) => getOutlet(r) !== outletName));
|
|
2914
2935
|
return sortedConfig;
|
|
2915
2936
|
}
|
|
2916
2937
|
/**
|
|
@@ -2949,9 +2970,8 @@ function getClosestRouteInjector(snapshot) {
|
|
|
2949
2970
|
}
|
|
2950
2971
|
|
|
2951
2972
|
let warnedAboutUnsupportedInputBinding = false;
|
|
2952
|
-
const activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map(t => {
|
|
2953
|
-
new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled)
|
|
2954
|
-
.activate(rootContexts);
|
|
2973
|
+
const activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map((t) => {
|
|
2974
|
+
new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled).activate(rootContexts);
|
|
2955
2975
|
return t;
|
|
2956
2976
|
});
|
|
2957
2977
|
class ActivateRoutes {
|
|
@@ -2973,7 +2993,7 @@ class ActivateRoutes {
|
|
|
2973
2993
|
deactivateChildRoutes(futureNode, currNode, contexts) {
|
|
2974
2994
|
const children = nodeChildrenAsMap(currNode);
|
|
2975
2995
|
// Recurse on the routes active in the future state to de-activate deeper children
|
|
2976
|
-
futureNode.children.forEach(futureChild => {
|
|
2996
|
+
futureNode.children.forEach((futureChild) => {
|
|
2977
2997
|
const childOutletName = futureChild.value.outlet;
|
|
2978
2998
|
this.deactivateRoutes(futureChild, children[childOutletName], contexts);
|
|
2979
2999
|
delete children[childOutletName];
|
|
@@ -3055,7 +3075,7 @@ class ActivateRoutes {
|
|
|
3055
3075
|
}
|
|
3056
3076
|
activateChildRoutes(futureNode, currNode, contexts) {
|
|
3057
3077
|
const children = nodeChildrenAsMap(currNode);
|
|
3058
|
-
futureNode.children.forEach(c => {
|
|
3078
|
+
futureNode.children.forEach((c) => {
|
|
3059
3079
|
this.activateRoutes(c, children[c.value.outlet], contexts);
|
|
3060
3080
|
this.forwardEvent(new ActivationEnd(c.value.snapshot));
|
|
3061
3081
|
});
|
|
@@ -3084,7 +3104,7 @@ class ActivateRoutes {
|
|
|
3084
3104
|
// if we have a normal route, we need to place the component into the outlet and recurse.
|
|
3085
3105
|
const context = parentContexts.getOrCreateContext(future.outlet);
|
|
3086
3106
|
if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {
|
|
3087
|
-
const stored = this.routeReuseStrategy.retrieve(future.snapshot);
|
|
3107
|
+
const stored = (this.routeReuseStrategy.retrieve(future.snapshot));
|
|
3088
3108
|
this.routeReuseStrategy.store(future.snapshot, null);
|
|
3089
3109
|
context.children.onOutletReAttached(stored.contexts);
|
|
3090
3110
|
context.attachRef = stored.componentRef;
|
|
@@ -3115,10 +3135,12 @@ class ActivateRoutes {
|
|
|
3115
3135
|
this.activateChildRoutes(futureNode, null, parentContexts);
|
|
3116
3136
|
}
|
|
3117
3137
|
}
|
|
3118
|
-
if (
|
|
3138
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
3119
3139
|
const context = parentContexts.getOrCreateContext(future.outlet);
|
|
3120
3140
|
const outlet = context.outlet;
|
|
3121
|
-
if (outlet &&
|
|
3141
|
+
if (outlet &&
|
|
3142
|
+
this.inputBindingEnabled &&
|
|
3143
|
+
!outlet.supportsBindingToComponentInputs &&
|
|
3122
3144
|
!warnedAboutUnsupportedInputBinding) {
|
|
3123
3145
|
console.warn(`'withComponentInputBinding' feature is enabled but ` +
|
|
3124
3146
|
`this application is using an outlet that may not support binding to component inputs.`);
|
|
@@ -3168,22 +3190,21 @@ function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
|
|
|
3168
3190
|
}
|
|
3169
3191
|
function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
|
|
3170
3192
|
canDeactivateChecks: [],
|
|
3171
|
-
canActivateChecks: []
|
|
3193
|
+
canActivateChecks: [],
|
|
3172
3194
|
}) {
|
|
3173
3195
|
const prevChildren = nodeChildrenAsMap(currNode);
|
|
3174
3196
|
// Process the children of the future route
|
|
3175
|
-
futureNode.children.forEach(c => {
|
|
3197
|
+
futureNode.children.forEach((c) => {
|
|
3176
3198
|
getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);
|
|
3177
3199
|
delete prevChildren[c.value.outlet];
|
|
3178
3200
|
});
|
|
3179
3201
|
// Process any children left from the current route (not active for the future route)
|
|
3180
|
-
Object.entries(prevChildren)
|
|
3181
|
-
.forEach(([k, v]) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));
|
|
3202
|
+
Object.entries(prevChildren).forEach(([k, v]) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));
|
|
3182
3203
|
return checks;
|
|
3183
3204
|
}
|
|
3184
3205
|
function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {
|
|
3185
3206
|
canDeactivateChecks: [],
|
|
3186
|
-
canActivateChecks: []
|
|
3207
|
+
canActivateChecks: [],
|
|
3187
3208
|
}) {
|
|
3188
3209
|
const future = futureNode.value;
|
|
3189
3210
|
const curr = currNode ? currNode.value : null;
|
|
@@ -3235,13 +3256,12 @@ function shouldRunGuardsAndResolvers(curr, future, mode) {
|
|
|
3235
3256
|
case 'pathParamsChange':
|
|
3236
3257
|
return !equalPath(curr.url, future.url);
|
|
3237
3258
|
case 'pathParamsOrQueryParamsChange':
|
|
3238
|
-
return !equalPath(curr.url, future.url) ||
|
|
3239
|
-
!shallowEqual(curr.queryParams, future.queryParams);
|
|
3259
|
+
return (!equalPath(curr.url, future.url) || !shallowEqual(curr.queryParams, future.queryParams));
|
|
3240
3260
|
case 'always':
|
|
3241
3261
|
return true;
|
|
3242
3262
|
case 'paramsOrQueryParamsChange':
|
|
3243
|
-
return !equalParamsAndUrlSegments(curr, future) ||
|
|
3244
|
-
!shallowEqual(curr.queryParams, future.queryParams);
|
|
3263
|
+
return (!equalParamsAndUrlSegments(curr, future) ||
|
|
3264
|
+
!shallowEqual(curr.queryParams, future.queryParams));
|
|
3245
3265
|
case 'paramsChange':
|
|
3246
3266
|
default:
|
|
3247
3267
|
return !equalParamsAndUrlSegments(curr, future);
|
|
@@ -3312,9 +3332,8 @@ function isEmptyError(e) {
|
|
|
3312
3332
|
|
|
3313
3333
|
const INITIAL_VALUE = /* @__PURE__ */ Symbol('INITIAL_VALUE');
|
|
3314
3334
|
function prioritizedGuardValue() {
|
|
3315
|
-
return switchMap(obs => {
|
|
3316
|
-
return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE))))
|
|
3317
|
-
.pipe(map((results) => {
|
|
3335
|
+
return switchMap((obs) => {
|
|
3336
|
+
return combineLatest(obs.map((o) => o.pipe(take(1), startWith(INITIAL_VALUE)))).pipe(map((results) => {
|
|
3318
3337
|
for (const result of results) {
|
|
3319
3338
|
if (result === true) {
|
|
3320
3339
|
// If result is true, check the next one
|
|
@@ -3338,28 +3357,27 @@ function prioritizedGuardValue() {
|
|
|
3338
3357
|
}
|
|
3339
3358
|
|
|
3340
3359
|
function checkGuards(injector, forwardEvent) {
|
|
3341
|
-
return mergeMap(t => {
|
|
3342
|
-
const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
|
|
3360
|
+
return mergeMap((t) => {
|
|
3361
|
+
const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks }, } = t;
|
|
3343
3362
|
if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
|
|
3344
3363
|
return of({ ...t, guardsResult: true });
|
|
3345
3364
|
}
|
|
3346
|
-
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector)
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
}), map(guardsResult => ({ ...t, guardsResult })));
|
|
3365
|
+
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector).pipe(mergeMap((canDeactivate) => {
|
|
3366
|
+
return canDeactivate && isBoolean(canDeactivate)
|
|
3367
|
+
? runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent)
|
|
3368
|
+
: of(canDeactivate);
|
|
3369
|
+
}), map((guardsResult) => ({ ...t, guardsResult })));
|
|
3352
3370
|
});
|
|
3353
3371
|
}
|
|
3354
3372
|
function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
|
|
3355
|
-
return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {
|
|
3373
|
+
return from(checks).pipe(mergeMap((check) => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first((result) => {
|
|
3356
3374
|
return result !== true;
|
|
3357
3375
|
}, true));
|
|
3358
3376
|
}
|
|
3359
3377
|
function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
|
|
3360
3378
|
return from(checks).pipe(concatMap((check) => {
|
|
3361
3379
|
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
|
|
3362
|
-
}), first(result => {
|
|
3380
|
+
}), first((result) => {
|
|
3363
3381
|
return result !== true;
|
|
3364
3382
|
}, true));
|
|
3365
3383
|
}
|
|
@@ -3399,9 +3417,9 @@ function runCanActivate(futureRSS, futureARS, injector) {
|
|
|
3399
3417
|
return defer(() => {
|
|
3400
3418
|
const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
|
|
3401
3419
|
const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
|
|
3402
|
-
const guardVal = isCanActivate(guard)
|
|
3403
|
-
guard.canActivate(futureARS, futureRSS)
|
|
3404
|
-
runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
|
|
3420
|
+
const guardVal = isCanActivate(guard)
|
|
3421
|
+
? guard.canActivate(futureARS, futureRSS)
|
|
3422
|
+
: runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
|
|
3405
3423
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3406
3424
|
});
|
|
3407
3425
|
});
|
|
@@ -3409,18 +3427,19 @@ function runCanActivate(futureRSS, futureARS, injector) {
|
|
|
3409
3427
|
}
|
|
3410
3428
|
function runCanActivateChild(futureRSS, path, injector) {
|
|
3411
3429
|
const futureARS = path[path.length - 1];
|
|
3412
|
-
const canActivateChildGuards = path
|
|
3430
|
+
const canActivateChildGuards = path
|
|
3431
|
+
.slice(0, path.length - 1)
|
|
3413
3432
|
.reverse()
|
|
3414
|
-
.map(p => getCanActivateChild(p))
|
|
3415
|
-
.filter(_ => _ !== null);
|
|
3433
|
+
.map((p) => getCanActivateChild(p))
|
|
3434
|
+
.filter((_) => _ !== null);
|
|
3416
3435
|
const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
|
|
3417
3436
|
return defer(() => {
|
|
3418
3437
|
const guardsMapped = d.guards.map((canActivateChild) => {
|
|
3419
3438
|
const closestInjector = getClosestRouteInjector(d.node) ?? injector;
|
|
3420
3439
|
const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
|
|
3421
|
-
const guardVal = isCanActivateChild(guard)
|
|
3422
|
-
guard.canActivateChild(futureARS, futureRSS)
|
|
3423
|
-
runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
|
|
3440
|
+
const guardVal = isCanActivateChild(guard)
|
|
3441
|
+
? guard.canActivateChild(futureARS, futureRSS)
|
|
3442
|
+
: runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
|
|
3424
3443
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3425
3444
|
});
|
|
3426
3445
|
return of(guardsMapped).pipe(prioritizedGuardValue());
|
|
@@ -3435,9 +3454,9 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
|
|
|
3435
3454
|
const canDeactivateObservables = canDeactivate.map((c) => {
|
|
3436
3455
|
const closestInjector = getClosestRouteInjector(currARS) ?? injector;
|
|
3437
3456
|
const guard = getTokenOrFunctionIdentity(c, closestInjector);
|
|
3438
|
-
const guardVal = isCanDeactivate(guard)
|
|
3439
|
-
guard.canDeactivate(component, currARS, currRSS, futureRSS)
|
|
3440
|
-
runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));
|
|
3457
|
+
const guardVal = isCanDeactivate(guard)
|
|
3458
|
+
? guard.canDeactivate(component, currARS, currRSS, futureRSS)
|
|
3459
|
+
: runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));
|
|
3441
3460
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3442
3461
|
});
|
|
3443
3462
|
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
|
@@ -3449,34 +3468,32 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
|
|
|
3449
3468
|
}
|
|
3450
3469
|
const canLoadObservables = canLoad.map((injectionToken) => {
|
|
3451
3470
|
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
|
|
3452
|
-
const guardVal = isCanLoad(guard)
|
|
3453
|
-
guard.canLoad(route, segments)
|
|
3454
|
-
runInInjectionContext(injector, () => guard(route, segments));
|
|
3471
|
+
const guardVal = isCanLoad(guard)
|
|
3472
|
+
? guard.canLoad(route, segments)
|
|
3473
|
+
: runInInjectionContext(injector, () => guard(route, segments));
|
|
3455
3474
|
return wrapIntoObservable(guardVal);
|
|
3456
3475
|
});
|
|
3457
|
-
return of(canLoadObservables)
|
|
3458
|
-
.pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
|
|
3476
|
+
return of(canLoadObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
|
|
3459
3477
|
}
|
|
3460
3478
|
function redirectIfUrlTree(urlSerializer) {
|
|
3461
3479
|
return pipe(tap((result) => {
|
|
3462
3480
|
if (!isUrlTree(result))
|
|
3463
3481
|
return;
|
|
3464
3482
|
throw redirectingNavigationError(urlSerializer, result);
|
|
3465
|
-
}), map(result => result === true));
|
|
3483
|
+
}), map((result) => result === true));
|
|
3466
3484
|
}
|
|
3467
3485
|
function runCanMatchGuards(injector, route, segments, urlSerializer) {
|
|
3468
3486
|
const canMatch = route.canMatch;
|
|
3469
3487
|
if (!canMatch || canMatch.length === 0)
|
|
3470
3488
|
return of(true);
|
|
3471
|
-
const canMatchObservables = canMatch.map(injectionToken => {
|
|
3489
|
+
const canMatchObservables = canMatch.map((injectionToken) => {
|
|
3472
3490
|
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
|
|
3473
|
-
const guardVal = isCanMatch(guard)
|
|
3474
|
-
guard.canMatch(route, segments)
|
|
3475
|
-
runInInjectionContext(injector, () => guard(route, segments));
|
|
3491
|
+
const guardVal = isCanMatch(guard)
|
|
3492
|
+
? guard.canMatch(route, segments)
|
|
3493
|
+
: runInInjectionContext(injector, () => guard(route, segments));
|
|
3476
3494
|
return wrapIntoObservable(guardVal);
|
|
3477
3495
|
});
|
|
3478
|
-
return of(canMatchObservables)
|
|
3479
|
-
.pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
|
|
3496
|
+
return of(canMatchObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
|
|
3480
3497
|
}
|
|
3481
3498
|
|
|
3482
3499
|
class NoMatch {
|
|
@@ -3557,8 +3574,9 @@ class ApplyRedirects {
|
|
|
3557
3574
|
return new UrlSegmentGroup(updatedSegments, children);
|
|
3558
3575
|
}
|
|
3559
3576
|
createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
|
|
3560
|
-
return redirectToSegments.map(s => s.path.startsWith(':')
|
|
3561
|
-
this.
|
|
3577
|
+
return redirectToSegments.map((s) => s.path.startsWith(':')
|
|
3578
|
+
? this.findPosParam(redirectTo, s, posParams)
|
|
3579
|
+
: this.findOrReturn(s, actualSegments));
|
|
3562
3580
|
}
|
|
3563
3581
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3564
3582
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
@@ -3585,7 +3603,7 @@ const noMatch = {
|
|
|
3585
3603
|
consumedSegments: [],
|
|
3586
3604
|
remainingSegments: [],
|
|
3587
3605
|
parameters: {},
|
|
3588
|
-
positionalParamSegments: {}
|
|
3606
|
+
positionalParamSegments: {},
|
|
3589
3607
|
};
|
|
3590
3608
|
function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer) {
|
|
3591
3609
|
const result = match(segmentGroup, route, segments);
|
|
@@ -3595,8 +3613,7 @@ function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer)
|
|
|
3595
3613
|
// Only create the Route's `EnvironmentInjector` if it matches the attempted
|
|
3596
3614
|
// navigation
|
|
3597
3615
|
injector = getOrCreateRouteInjectorIfNeeded(route, injector);
|
|
3598
|
-
return runCanMatchGuards(injector, route, segments, urlSerializer)
|
|
3599
|
-
.pipe(map((v) => v === true ? result : { ...noMatch }));
|
|
3616
|
+
return runCanMatchGuards(injector, route, segments, urlSerializer).pipe(map((v) => (v === true ? result : { ...noMatch })));
|
|
3600
3617
|
}
|
|
3601
3618
|
function match(segmentGroup, route, segments) {
|
|
3602
3619
|
if (route.path === '**') {
|
|
@@ -3611,7 +3628,7 @@ function match(segmentGroup, route, segments) {
|
|
|
3611
3628
|
consumedSegments: [],
|
|
3612
3629
|
remainingSegments: segments,
|
|
3613
3630
|
parameters: {},
|
|
3614
|
-
positionalParamSegments: {}
|
|
3631
|
+
positionalParamSegments: {},
|
|
3615
3632
|
};
|
|
3616
3633
|
}
|
|
3617
3634
|
const matcher = route.matcher || defaultUrlMatcher;
|
|
@@ -3622,16 +3639,16 @@ function match(segmentGroup, route, segments) {
|
|
|
3622
3639
|
Object.entries(res.posParams ?? {}).forEach(([k, v]) => {
|
|
3623
3640
|
posParams[k] = v.path;
|
|
3624
3641
|
});
|
|
3625
|
-
const parameters = res.consumed.length > 0
|
|
3626
|
-
{ ...posParams, ...res.consumed[res.consumed.length - 1].parameters }
|
|
3627
|
-
posParams;
|
|
3642
|
+
const parameters = res.consumed.length > 0
|
|
3643
|
+
? { ...posParams, ...res.consumed[res.consumed.length - 1].parameters }
|
|
3644
|
+
: posParams;
|
|
3628
3645
|
return {
|
|
3629
3646
|
matched: true,
|
|
3630
3647
|
consumedSegments: res.consumed,
|
|
3631
3648
|
remainingSegments: segments.slice(res.consumed.length),
|
|
3632
3649
|
// TODO(atscott): investigate combining parameters and positionalParamSegments
|
|
3633
3650
|
parameters,
|
|
3634
|
-
positionalParamSegments: res.posParams ?? {}
|
|
3651
|
+
positionalParamSegments: res.posParams ?? {},
|
|
3635
3652
|
};
|
|
3636
3653
|
}
|
|
3637
3654
|
function createWildcardMatchResult(segments) {
|
|
@@ -3679,10 +3696,10 @@ function createChildrenForEmptyPaths(routes, primarySegment) {
|
|
|
3679
3696
|
return res;
|
|
3680
3697
|
}
|
|
3681
3698
|
function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) {
|
|
3682
|
-
return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet(r) !== PRIMARY_OUTLET);
|
|
3699
|
+
return routes.some((r) => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet(r) !== PRIMARY_OUTLET);
|
|
3683
3700
|
}
|
|
3684
3701
|
function containsEmptyPathMatches(segmentGroup, slicedSegments, routes) {
|
|
3685
|
-
return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r));
|
|
3702
|
+
return routes.some((r) => emptyPathMatch(segmentGroup, slicedSegments, r));
|
|
3686
3703
|
}
|
|
3687
3704
|
function emptyPathMatch(segmentGroup, slicedSegments, r) {
|
|
3688
3705
|
if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') {
|
|
@@ -3725,8 +3742,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3725
3742
|
class NoLeftoversInUrl {
|
|
3726
3743
|
}
|
|
3727
3744
|
function recognize$1(injector, configLoader, rootComponentType, config, urlTree, urlSerializer, paramsInheritanceStrategy = 'emptyOnly') {
|
|
3728
|
-
return new Recognizer(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer)
|
|
3729
|
-
.recognize();
|
|
3745
|
+
return new Recognizer(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer).recognize();
|
|
3730
3746
|
}
|
|
3731
3747
|
const MAX_ALLOWED_REDIRECTS = 31;
|
|
3732
3748
|
class Recognizer {
|
|
@@ -3743,13 +3759,13 @@ class Recognizer {
|
|
|
3743
3759
|
this.allowRedirects = true;
|
|
3744
3760
|
}
|
|
3745
3761
|
noMatchError(e) {
|
|
3746
|
-
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */,
|
|
3747
|
-
`Cannot match any routes. URL Segment: '${e.segmentGroup}'`
|
|
3748
|
-
`'${e.segmentGroup}'`);
|
|
3762
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, typeof ngDevMode === 'undefined' || ngDevMode
|
|
3763
|
+
? `Cannot match any routes. URL Segment: '${e.segmentGroup}'`
|
|
3764
|
+
: `'${e.segmentGroup}'`);
|
|
3749
3765
|
}
|
|
3750
3766
|
recognize() {
|
|
3751
3767
|
const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
|
|
3752
|
-
return this.match(rootSegmentGroup).pipe(map(children => {
|
|
3768
|
+
return this.match(rootSegmentGroup).pipe(map((children) => {
|
|
3753
3769
|
// Use Object.freeze to prevent readers of the Router state from modifying it outside
|
|
3754
3770
|
// of a navigation, resulting in the router being out of sync with the browser.
|
|
3755
3771
|
const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, {});
|
|
@@ -3783,14 +3799,13 @@ class Recognizer {
|
|
|
3783
3799
|
const i = getInherited(route, parent, this.paramsInheritanceStrategy);
|
|
3784
3800
|
route.params = Object.freeze(i.params);
|
|
3785
3801
|
route.data = Object.freeze(i.data);
|
|
3786
|
-
routeNode.children.forEach(n => this.inheritParamsAndData(n, route));
|
|
3802
|
+
routeNode.children.forEach((n) => this.inheritParamsAndData(n, route));
|
|
3787
3803
|
}
|
|
3788
3804
|
processSegmentGroup(injector, config, segmentGroup, outlet) {
|
|
3789
3805
|
if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
|
|
3790
3806
|
return this.processChildren(injector, config, segmentGroup);
|
|
3791
3807
|
}
|
|
3792
|
-
return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true)
|
|
3793
|
-
.pipe(map(child => child instanceof TreeNode ? [child] : []));
|
|
3808
|
+
return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true).pipe(map((child) => (child instanceof TreeNode ? [child] : [])));
|
|
3794
3809
|
}
|
|
3795
3810
|
/**
|
|
3796
3811
|
* Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if
|
|
@@ -3812,8 +3827,7 @@ class Recognizer {
|
|
|
3812
3827
|
childOutlets.push(child);
|
|
3813
3828
|
}
|
|
3814
3829
|
}
|
|
3815
|
-
return from(childOutlets)
|
|
3816
|
-
.pipe(concatMap(childOutlet => {
|
|
3830
|
+
return from(childOutlets).pipe(concatMap((childOutlet) => {
|
|
3817
3831
|
const child = segmentGroup.children[childOutlet];
|
|
3818
3832
|
// Sort the config so that routes with outlets that match the one being activated
|
|
3819
3833
|
// appear first, followed by routes for other outlets, which might match if they have
|
|
@@ -3823,7 +3837,7 @@ class Recognizer {
|
|
|
3823
3837
|
}), scan((children, outletChildren) => {
|
|
3824
3838
|
children.push(...outletChildren);
|
|
3825
3839
|
return children;
|
|
3826
|
-
}), defaultIfEmpty(null), last$1(), mergeMap(children => {
|
|
3840
|
+
}), defaultIfEmpty(null), last$1(), mergeMap((children) => {
|
|
3827
3841
|
if (children === null)
|
|
3828
3842
|
return noMatch$1(segmentGroup);
|
|
3829
3843
|
// Because we may have matched two outlets to the same empty path segment, we can have
|
|
@@ -3840,16 +3854,14 @@ class Recognizer {
|
|
|
3840
3854
|
}));
|
|
3841
3855
|
}
|
|
3842
3856
|
processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects) {
|
|
3843
|
-
return from(routes).pipe(concatMap(r => {
|
|
3844
|
-
return this
|
|
3845
|
-
.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects)
|
|
3846
|
-
.pipe(catchError((e) => {
|
|
3857
|
+
return from(routes).pipe(concatMap((r) => {
|
|
3858
|
+
return this.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects).pipe(catchError((e) => {
|
|
3847
3859
|
if (e instanceof NoMatch) {
|
|
3848
3860
|
return of(null);
|
|
3849
3861
|
}
|
|
3850
3862
|
throw e;
|
|
3851
3863
|
}));
|
|
3852
|
-
}), first((x) => !!x), catchError(e => {
|
|
3864
|
+
}), first((x) => !!x), catchError((e) => {
|
|
3853
3865
|
if (isEmptyError(e)) {
|
|
3854
3866
|
if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
|
|
3855
3867
|
return of(new NoLeftoversInUrl());
|
|
@@ -3871,7 +3883,7 @@ class Recognizer {
|
|
|
3871
3883
|
return noMatch$1(rawSegment);
|
|
3872
3884
|
}
|
|
3873
3885
|
expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet) {
|
|
3874
|
-
const { matched, consumedSegments, positionalParamSegments, remainingSegments
|
|
3886
|
+
const { matched, consumedSegments, positionalParamSegments, remainingSegments } = match(segmentGroup, route, segments);
|
|
3875
3887
|
if (!matched)
|
|
3876
3888
|
return noMatch$1(segmentGroup);
|
|
3877
3889
|
// TODO(atscott): Move all of this under an if(ngDevMode) as a breaking change and allow stack
|
|
@@ -3888,8 +3900,7 @@ class Recognizer {
|
|
|
3888
3900
|
}
|
|
3889
3901
|
}
|
|
3890
3902
|
const newTree = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
|
|
3891
|
-
return this.applyRedirects.lineralizeSegments(route, newTree)
|
|
3892
|
-
.pipe(mergeMap((newSegments) => {
|
|
3903
|
+
return this.applyRedirects.lineralizeSegments(route, newTree).pipe(mergeMap((newSegments) => {
|
|
3893
3904
|
return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false);
|
|
3894
3905
|
}));
|
|
3895
3906
|
}
|
|
@@ -3908,15 +3919,13 @@ class Recognizer {
|
|
|
3908
3919
|
}
|
|
3909
3920
|
// If the route has an injector created from providers, we should start using that.
|
|
3910
3921
|
injector = route._injector ?? injector;
|
|
3911
|
-
return this.getChildConfig(injector, route, segments)
|
|
3912
|
-
.pipe(switchMap(({ routes: childConfig }) => {
|
|
3922
|
+
return this.getChildConfig(injector, route, segments).pipe(switchMap(({ routes: childConfig }) => {
|
|
3913
3923
|
const childInjector = route._loadedInjector ?? injector;
|
|
3914
3924
|
const { consumedSegments, remainingSegments, parameters } = result;
|
|
3915
3925
|
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
|
|
3916
3926
|
const { segmentGroup, slicedSegments } = split(rawSegment, consumedSegments, remainingSegments, childConfig);
|
|
3917
3927
|
if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
|
|
3918
|
-
return this.processChildren(childInjector, childConfig, segmentGroup)
|
|
3919
|
-
.pipe(map(children => {
|
|
3928
|
+
return this.processChildren(childInjector, childConfig, segmentGroup).pipe(map((children) => {
|
|
3920
3929
|
if (children === null) {
|
|
3921
3930
|
return null;
|
|
3922
3931
|
}
|
|
@@ -3935,9 +3944,7 @@ class Recognizer {
|
|
|
3935
3944
|
// {path: 'c', component: C},
|
|
3936
3945
|
// ]}
|
|
3937
3946
|
// Notice that the children of the named outlet are configured with the primary outlet
|
|
3938
|
-
return this
|
|
3939
|
-
.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true)
|
|
3940
|
-
.pipe(map(child => {
|
|
3947
|
+
return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true).pipe(map((child) => {
|
|
3941
3948
|
return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);
|
|
3942
3949
|
}));
|
|
3943
3950
|
}));
|
|
@@ -3953,11 +3960,9 @@ class Recognizer {
|
|
|
3953
3960
|
if (route._loadedRoutes !== undefined) {
|
|
3954
3961
|
return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
|
|
3955
3962
|
}
|
|
3956
|
-
return runCanLoadGuards(injector, route, segments, this.urlSerializer)
|
|
3957
|
-
.pipe(mergeMap((shouldLoadResult) => {
|
|
3963
|
+
return runCanLoadGuards(injector, route, segments, this.urlSerializer).pipe(mergeMap((shouldLoadResult) => {
|
|
3958
3964
|
if (shouldLoadResult) {
|
|
3959
|
-
return this.configLoader.loadChildren(injector, route)
|
|
3960
|
-
.pipe(tap((cfg) => {
|
|
3965
|
+
return this.configLoader.loadChildren(injector, route).pipe(tap((cfg) => {
|
|
3961
3966
|
route._loadedRoutes = cfg.routes;
|
|
3962
3967
|
route._loadedInjector = cfg.injector;
|
|
3963
3968
|
}));
|
|
@@ -3995,7 +4000,7 @@ function mergeEmptyPathMatches(nodes) {
|
|
|
3995
4000
|
result.push(node);
|
|
3996
4001
|
continue;
|
|
3997
4002
|
}
|
|
3998
|
-
const duplicateEmptyPathNode = result.find(resultNode => node.value.routeConfig === resultNode.value.routeConfig);
|
|
4003
|
+
const duplicateEmptyPathNode = result.find((resultNode) => node.value.routeConfig === resultNode.value.routeConfig);
|
|
3999
4004
|
if (duplicateEmptyPathNode !== undefined) {
|
|
4000
4005
|
duplicateEmptyPathNode.children.push(...node.children);
|
|
4001
4006
|
mergedNodes.add(duplicateEmptyPathNode);
|
|
@@ -4012,15 +4017,15 @@ function mergeEmptyPathMatches(nodes) {
|
|
|
4012
4017
|
const mergedChildren = mergeEmptyPathMatches(mergedNode.children);
|
|
4013
4018
|
result.push(new TreeNode(mergedNode.value, mergedChildren));
|
|
4014
4019
|
}
|
|
4015
|
-
return result.filter(n => !mergedNodes.has(n));
|
|
4020
|
+
return result.filter((n) => !mergedNodes.has(n));
|
|
4016
4021
|
}
|
|
4017
4022
|
function checkOutletNameUniqueness(nodes) {
|
|
4018
4023
|
const names = {};
|
|
4019
|
-
nodes.forEach(n => {
|
|
4024
|
+
nodes.forEach((n) => {
|
|
4020
4025
|
const routeWithSameOutletName = names[n.value.outlet];
|
|
4021
4026
|
if (routeWithSameOutletName) {
|
|
4022
|
-
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4023
|
-
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4027
|
+
const p = routeWithSameOutletName.url.map((s) => s.toString()).join('/');
|
|
4028
|
+
const c = n.value.url.map((s) => s.toString()).join('/');
|
|
4024
4029
|
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
4025
4030
|
`Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
|
|
4026
4031
|
}
|
|
@@ -4035,22 +4040,21 @@ function getResolve(route) {
|
|
|
4035
4040
|
}
|
|
4036
4041
|
|
|
4037
4042
|
function recognize(injector, configLoader, rootComponentType, config, serializer, paramsInheritanceStrategy) {
|
|
4038
|
-
return mergeMap(t => recognize$1(injector, configLoader, rootComponentType, config, t.extractedUrl, serializer, paramsInheritanceStrategy)
|
|
4039
|
-
.pipe(map(({ state: targetSnapshot, tree: urlAfterRedirects }) => {
|
|
4043
|
+
return mergeMap((t) => recognize$1(injector, configLoader, rootComponentType, config, t.extractedUrl, serializer, paramsInheritanceStrategy).pipe(map(({ state: targetSnapshot, tree: urlAfterRedirects }) => {
|
|
4040
4044
|
return { ...t, targetSnapshot, urlAfterRedirects };
|
|
4041
4045
|
})));
|
|
4042
4046
|
}
|
|
4043
4047
|
|
|
4044
4048
|
function resolveData(paramsInheritanceStrategy, injector) {
|
|
4045
|
-
return mergeMap(t => {
|
|
4046
|
-
const { targetSnapshot, guards: { canActivateChecks } } = t;
|
|
4049
|
+
return mergeMap((t) => {
|
|
4050
|
+
const { targetSnapshot, guards: { canActivateChecks }, } = t;
|
|
4047
4051
|
if (!canActivateChecks.length) {
|
|
4048
4052
|
return of(t);
|
|
4049
4053
|
}
|
|
4050
4054
|
// Iterating a Set in javascript happens in insertion order so it is safe to use a `Set` to
|
|
4051
4055
|
// preserve the correct order that the resolvers should run in.
|
|
4052
4056
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#description
|
|
4053
|
-
const routesWithResolversToRun = new Set(canActivateChecks.map(check => check.route));
|
|
4057
|
+
const routesWithResolversToRun = new Set(canActivateChecks.map((check) => check.route));
|
|
4054
4058
|
const routesNeedingDataUpdates = new Set();
|
|
4055
4059
|
for (const route of routesWithResolversToRun) {
|
|
4056
4060
|
if (routesNeedingDataUpdates.has(route)) {
|
|
@@ -4062,8 +4066,7 @@ function resolveData(paramsInheritanceStrategy, injector) {
|
|
|
4062
4066
|
}
|
|
4063
4067
|
}
|
|
4064
4068
|
let routesProcessed = 0;
|
|
4065
|
-
return from(routesNeedingDataUpdates)
|
|
4066
|
-
.pipe(concatMap(route => {
|
|
4069
|
+
return from(routesNeedingDataUpdates).pipe(concatMap((route) => {
|
|
4067
4070
|
if (routesWithResolversToRun.has(route)) {
|
|
4068
4071
|
return runResolve(route, targetSnapshot, paramsInheritanceStrategy, injector);
|
|
4069
4072
|
}
|
|
@@ -4071,14 +4074,14 @@ function resolveData(paramsInheritanceStrategy, injector) {
|
|
|
4071
4074
|
route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;
|
|
4072
4075
|
return of(void 0);
|
|
4073
4076
|
}
|
|
4074
|
-
}), tap(() => routesProcessed++), takeLast(1), mergeMap(_ => routesProcessed === routesNeedingDataUpdates.size ? of(t) : EMPTY));
|
|
4077
|
+
}), tap(() => routesProcessed++), takeLast(1), mergeMap((_) => (routesProcessed === routesNeedingDataUpdates.size ? of(t) : EMPTY)));
|
|
4075
4078
|
});
|
|
4076
4079
|
}
|
|
4077
4080
|
/**
|
|
4078
4081
|
* Returns the `ActivatedRouteSnapshot` tree as an array, using DFS to traverse the route tree.
|
|
4079
4082
|
*/
|
|
4080
4083
|
function flattenRouteTree(route) {
|
|
4081
|
-
const descendants = route.children.map(child => flattenRouteTree(child)).flat();
|
|
4084
|
+
const descendants = route.children.map((child) => flattenRouteTree(child)).flat();
|
|
4082
4085
|
return [route, ...descendants];
|
|
4083
4086
|
}
|
|
4084
4087
|
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
|
|
@@ -4099,17 +4102,16 @@ function resolveNode(resolve, futureARS, futureRSS, injector) {
|
|
|
4099
4102
|
return of({});
|
|
4100
4103
|
}
|
|
4101
4104
|
const data = {};
|
|
4102
|
-
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector)
|
|
4103
|
-
.pipe(first(), tap((value) => {
|
|
4105
|
+
return from(keys).pipe(mergeMap((key) => getResolver(resolve[key], futureARS, futureRSS, injector).pipe(first(), tap((value) => {
|
|
4104
4106
|
data[key] = value;
|
|
4105
|
-
}))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
|
|
4107
|
+
}))), takeLast(1), mapTo(data), catchError((e) => (isEmptyError(e) ? EMPTY : throwError(e))));
|
|
4106
4108
|
}
|
|
4107
4109
|
function getResolver(injectionToken, futureARS, futureRSS, injector) {
|
|
4108
4110
|
const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
|
|
4109
4111
|
const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
|
|
4110
|
-
const resolverValue = resolver.resolve
|
|
4111
|
-
resolver.resolve(futureARS, futureRSS)
|
|
4112
|
-
runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));
|
|
4112
|
+
const resolverValue = resolver.resolve
|
|
4113
|
+
? resolver.resolve(futureARS, futureRSS)
|
|
4114
|
+
: runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));
|
|
4113
4115
|
return wrapIntoObservable(resolverValue);
|
|
4114
4116
|
}
|
|
4115
4117
|
|
|
@@ -4120,7 +4122,7 @@ function getResolver(injectionToken, futureARS, futureRSS, injector) {
|
|
|
4120
4122
|
* it will wait before continuing with the original value.
|
|
4121
4123
|
*/
|
|
4122
4124
|
function switchTap(next) {
|
|
4123
|
-
return switchMap(v => {
|
|
4125
|
+
return switchMap((v) => {
|
|
4124
4126
|
const nextResult = next(v);
|
|
4125
4127
|
if (nextResult) {
|
|
4126
4128
|
return from(nextResult).pipe(map(() => v));
|
|
@@ -4161,7 +4163,7 @@ class TitleStrategy {
|
|
|
4161
4163
|
let route = snapshot.root;
|
|
4162
4164
|
while (route !== undefined) {
|
|
4163
4165
|
pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
|
|
4164
|
-
route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
|
|
4166
|
+
route = route.children.find((child) => child.outlet === PRIMARY_OUTLET);
|
|
4165
4167
|
}
|
|
4166
4168
|
return pageTitle;
|
|
4167
4169
|
}
|
|
@@ -4172,10 +4174,10 @@ class TitleStrategy {
|
|
|
4172
4174
|
getResolvedTitleForRoute(snapshot) {
|
|
4173
4175
|
return snapshot.data[RouteTitleKey];
|
|
4174
4176
|
}
|
|
4175
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4176
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4177
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4178
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }); }
|
|
4177
4179
|
}
|
|
4178
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4179
4181
|
type: Injectable,
|
|
4180
4182
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4181
4183
|
}] });
|
|
@@ -4198,10 +4200,10 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
4198
4200
|
this.title.setTitle(title);
|
|
4199
4201
|
}
|
|
4200
4202
|
}
|
|
4201
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4202
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4203
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4204
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' }); }
|
|
4203
4205
|
}
|
|
4204
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4205
4207
|
type: Injectable,
|
|
4206
4208
|
args: [{ providedIn: 'root' }]
|
|
4207
4209
|
}], ctorParameters: () => [{ type: i1.Title }] });
|
|
@@ -4211,7 +4213,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0-rc.0", ng
|
|
|
4211
4213
|
*
|
|
4212
4214
|
* @publicApi
|
|
4213
4215
|
*/
|
|
4214
|
-
const ROUTER_CONFIGURATION = new InjectionToken(
|
|
4216
|
+
const ROUTER_CONFIGURATION = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router config' : '', {
|
|
4215
4217
|
providedIn: 'root',
|
|
4216
4218
|
factory: () => ({}),
|
|
4217
4219
|
});
|
|
@@ -4243,8 +4245,7 @@ class RouterConfigLoader {
|
|
|
4243
4245
|
if (this.onLoadStartListener) {
|
|
4244
4246
|
this.onLoadStartListener(route);
|
|
4245
4247
|
}
|
|
4246
|
-
const loadRunner = wrapIntoObservable(route.loadComponent())
|
|
4247
|
-
.pipe(map(maybeUnwrapDefaultExport), tap(component => {
|
|
4248
|
+
const loadRunner = wrapIntoObservable(route.loadComponent()).pipe(map(maybeUnwrapDefaultExport), tap((component) => {
|
|
4248
4249
|
if (this.onLoadEndListener) {
|
|
4249
4250
|
this.onLoadEndListener(route);
|
|
4250
4251
|
}
|
|
@@ -4274,15 +4275,14 @@ class RouterConfigLoader {
|
|
|
4274
4275
|
this.childrenLoaders.delete(route);
|
|
4275
4276
|
}));
|
|
4276
4277
|
// Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
|
|
4277
|
-
const loader = new ConnectableObservable(loadRunner, () => new Subject())
|
|
4278
|
-
.pipe(refCount());
|
|
4278
|
+
const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
|
|
4279
4279
|
this.childrenLoaders.set(route, loader);
|
|
4280
4280
|
return loader;
|
|
4281
4281
|
}
|
|
4282
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4283
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4282
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterConfigLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4283
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' }); }
|
|
4284
4284
|
}
|
|
4285
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4286
4286
|
type: Injectable,
|
|
4287
4287
|
args: [{ providedIn: 'root' }]
|
|
4288
4288
|
}] });
|
|
@@ -4295,8 +4295,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0-rc.0", ng
|
|
|
4295
4295
|
* an update to the extractor.
|
|
4296
4296
|
*/
|
|
4297
4297
|
function loadChildren(route, compiler, parentInjector, onLoadEndListener) {
|
|
4298
|
-
return wrapIntoObservable(route.loadChildren())
|
|
4299
|
-
.pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
|
|
4298
|
+
return wrapIntoObservable(route.loadChildren()).pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
|
|
4300
4299
|
if (t instanceof NgModuleFactory || Array.isArray(t)) {
|
|
4301
4300
|
return of(t);
|
|
4302
4301
|
}
|
|
@@ -4350,10 +4349,10 @@ function maybeUnwrapDefaultExport(input) {
|
|
|
4350
4349
|
* @publicApi
|
|
4351
4350
|
*/
|
|
4352
4351
|
class UrlHandlingStrategy {
|
|
4353
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4354
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4352
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4353
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }); }
|
|
4355
4354
|
}
|
|
4356
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
|
|
4357
4356
|
type: Injectable,
|
|
4358
4357
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
|
|
4359
4358
|
}] });
|
|
@@ -4370,10 +4369,10 @@ class DefaultUrlHandlingStrategy {
|
|
|
4370
4369
|
merge(newUrlPart, wholeUrl) {
|
|
4371
4370
|
return newUrlPart;
|
|
4372
4371
|
}
|
|
4373
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4374
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4372
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4373
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' }); }
|
|
4375
4374
|
}
|
|
4376
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
|
|
4377
4376
|
type: Injectable,
|
|
4378
4377
|
args: [{ providedIn: 'root' }]
|
|
4379
4378
|
}] });
|
|
@@ -4419,7 +4418,7 @@ function createViewTransition(injector, from, to) {
|
|
|
4419
4418
|
* Creates a promise that resolves after next render.
|
|
4420
4419
|
*/
|
|
4421
4420
|
function createRenderPromise(injector) {
|
|
4422
|
-
return new Promise(resolve => {
|
|
4421
|
+
return new Promise((resolve) => {
|
|
4423
4422
|
afterNextRender(resolve, { injector });
|
|
4424
4423
|
});
|
|
4425
4424
|
}
|
|
@@ -4496,37 +4495,40 @@ class NavigationTransitions {
|
|
|
4496
4495
|
guards: { canActivateChecks: [], canDeactivateChecks: [] },
|
|
4497
4496
|
guardsResult: null,
|
|
4498
4497
|
});
|
|
4499
|
-
return this.transitions.pipe(filter(t => t.id !== 0),
|
|
4498
|
+
return this.transitions.pipe(filter((t) => t.id !== 0),
|
|
4500
4499
|
// Extract URL
|
|
4501
|
-
map(t => ({
|
|
4500
|
+
map((t) => ({
|
|
4501
|
+
...t,
|
|
4502
|
+
extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl),
|
|
4503
|
+
})),
|
|
4502
4504
|
// Using switchMap so we cancel executing navigations when a new one comes in
|
|
4503
|
-
switchMap(overallTransitionState => {
|
|
4505
|
+
switchMap((overallTransitionState) => {
|
|
4504
4506
|
this.currentTransition = overallTransitionState;
|
|
4505
4507
|
let completed = false;
|
|
4506
4508
|
let errored = false;
|
|
4507
|
-
return of(overallTransitionState)
|
|
4508
|
-
.pipe(
|
|
4509
|
+
return of(overallTransitionState).pipe(
|
|
4509
4510
|
// Store the Navigation object
|
|
4510
|
-
tap(t => {
|
|
4511
|
+
tap((t) => {
|
|
4511
4512
|
this.currentNavigation = {
|
|
4512
4513
|
id: t.id,
|
|
4513
4514
|
initialUrl: t.rawUrl,
|
|
4514
4515
|
extractedUrl: t.extractedUrl,
|
|
4515
4516
|
trigger: t.source,
|
|
4516
4517
|
extras: t.extras,
|
|
4517
|
-
previousNavigation: !this.lastSuccessfulNavigation
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4518
|
+
previousNavigation: !this.lastSuccessfulNavigation
|
|
4519
|
+
? null
|
|
4520
|
+
: {
|
|
4521
|
+
...this.lastSuccessfulNavigation,
|
|
4522
|
+
previousNavigation: null,
|
|
4523
|
+
},
|
|
4521
4524
|
};
|
|
4522
|
-
}), switchMap(t => {
|
|
4523
|
-
const urlTransition = !router.navigated ||
|
|
4524
|
-
this.isUpdatingInternalState() || this.isUpdatedBrowserUrl();
|
|
4525
|
+
}), switchMap((t) => {
|
|
4526
|
+
const urlTransition = !router.navigated || this.isUpdatingInternalState() || this.isUpdatedBrowserUrl();
|
|
4525
4527
|
const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;
|
|
4526
4528
|
if (!urlTransition && onSameUrlNavigation !== 'reload') {
|
|
4527
|
-
const reason =
|
|
4528
|
-
`Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.`
|
|
4529
|
-
'';
|
|
4529
|
+
const reason = typeof ngDevMode === 'undefined' || ngDevMode
|
|
4530
|
+
? `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.`
|
|
4531
|
+
: '';
|
|
4530
4532
|
this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.rawUrl), reason, NavigationSkippedCode.IgnoredSameUrlNavigation));
|
|
4531
4533
|
t.resolve(null);
|
|
4532
4534
|
return EMPTY;
|
|
@@ -4534,7 +4536,7 @@ class NavigationTransitions {
|
|
|
4534
4536
|
if (this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {
|
|
4535
4537
|
return of(t).pipe(
|
|
4536
4538
|
// Fire NavigationStart event
|
|
4537
|
-
switchMap(t => {
|
|
4539
|
+
switchMap((t) => {
|
|
4538
4540
|
const transition = this.transitions?.getValue();
|
|
4539
4541
|
this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));
|
|
4540
4542
|
if (transition !== this.transitions?.getValue()) {
|
|
@@ -4547,12 +4549,12 @@ class NavigationTransitions {
|
|
|
4547
4549
|
// Recognize
|
|
4548
4550
|
recognize(this.environmentInjector, this.configLoader, this.rootComponentType, router.config, this.urlSerializer, this.paramsInheritanceStrategy),
|
|
4549
4551
|
// Update URL if in `eager` update mode
|
|
4550
|
-
tap(t => {
|
|
4552
|
+
tap((t) => {
|
|
4551
4553
|
overallTransitionState.targetSnapshot = t.targetSnapshot;
|
|
4552
4554
|
overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
|
|
4553
4555
|
this.currentNavigation = {
|
|
4554
4556
|
...this.currentNavigation,
|
|
4555
|
-
finalUrl: t.urlAfterRedirects
|
|
4557
|
+
finalUrl: t.urlAfterRedirects,
|
|
4556
4558
|
};
|
|
4557
4559
|
// Fire RoutesRecognized
|
|
4558
4560
|
const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
@@ -4583,33 +4585,33 @@ class NavigationTransitions {
|
|
|
4583
4585
|
* current "settled" URL. This way the next navigation will be coming
|
|
4584
4586
|
* from the current URL in the browser.
|
|
4585
4587
|
*/
|
|
4586
|
-
const reason =
|
|
4587
|
-
`Navigation was ignored because the UrlHandlingStrategy` +
|
|
4588
|
-
` indicated neither the current URL ${t.currentRawUrl} nor target URL ${t.rawUrl} should be processed.`
|
|
4589
|
-
'';
|
|
4588
|
+
const reason = typeof ngDevMode === 'undefined' || ngDevMode
|
|
4589
|
+
? `Navigation was ignored because the UrlHandlingStrategy` +
|
|
4590
|
+
` indicated neither the current URL ${t.currentRawUrl} nor target URL ${t.rawUrl} should be processed.`
|
|
4591
|
+
: '';
|
|
4590
4592
|
this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, NavigationSkippedCode.IgnoredByUrlHandlingStrategy));
|
|
4591
4593
|
t.resolve(null);
|
|
4592
4594
|
return EMPTY;
|
|
4593
4595
|
}
|
|
4594
4596
|
}),
|
|
4595
4597
|
// --- GUARDS ---
|
|
4596
|
-
tap(t => {
|
|
4598
|
+
tap((t) => {
|
|
4597
4599
|
const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4598
4600
|
this.events.next(guardsStart);
|
|
4599
|
-
}), map(t => {
|
|
4601
|
+
}), map((t) => {
|
|
4600
4602
|
this.currentTransition = overallTransitionState = {
|
|
4601
4603
|
...t,
|
|
4602
|
-
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
|
|
4604
|
+
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts),
|
|
4603
4605
|
};
|
|
4604
4606
|
return overallTransitionState;
|
|
4605
|
-
}), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap(t => {
|
|
4607
|
+
}), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap((t) => {
|
|
4606
4608
|
overallTransitionState.guardsResult = t.guardsResult;
|
|
4607
4609
|
if (isUrlTree(t.guardsResult)) {
|
|
4608
4610
|
throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
|
|
4609
4611
|
}
|
|
4610
4612
|
const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
|
|
4611
4613
|
this.events.next(guardsEnd);
|
|
4612
|
-
}), filter(t => {
|
|
4614
|
+
}), filter((t) => {
|
|
4613
4615
|
if (!t.guardsResult) {
|
|
4614
4616
|
this.cancelNavigationTransition(t, '', NavigationCancellationCode.GuardRejected);
|
|
4615
4617
|
return false;
|
|
@@ -4617,24 +4619,24 @@ class NavigationTransitions {
|
|
|
4617
4619
|
return true;
|
|
4618
4620
|
}),
|
|
4619
4621
|
// --- RESOLVE ---
|
|
4620
|
-
switchTap(t => {
|
|
4622
|
+
switchTap((t) => {
|
|
4621
4623
|
if (t.guards.canActivateChecks.length) {
|
|
4622
|
-
return of(t).pipe(tap(t => {
|
|
4624
|
+
return of(t).pipe(tap((t) => {
|
|
4623
4625
|
const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4624
4626
|
this.events.next(resolveStart);
|
|
4625
|
-
}), switchMap(t => {
|
|
4627
|
+
}), switchMap((t) => {
|
|
4626
4628
|
let dataResolved = false;
|
|
4627
4629
|
return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.environmentInjector), tap({
|
|
4628
|
-
next: () => dataResolved = true,
|
|
4630
|
+
next: () => (dataResolved = true),
|
|
4629
4631
|
complete: () => {
|
|
4630
4632
|
if (!dataResolved) {
|
|
4631
|
-
this.cancelNavigationTransition(t,
|
|
4632
|
-
`At least one route resolver didn't emit any value.`
|
|
4633
|
-
'', NavigationCancellationCode.NoDataFromResolver);
|
|
4633
|
+
this.cancelNavigationTransition(t, typeof ngDevMode === 'undefined' || ngDevMode
|
|
4634
|
+
? `At least one route resolver didn't emit any value.`
|
|
4635
|
+
: '', NavigationCancellationCode.NoDataFromResolver);
|
|
4634
4636
|
}
|
|
4635
|
-
}
|
|
4637
|
+
},
|
|
4636
4638
|
}));
|
|
4637
|
-
}), tap(t => {
|
|
4639
|
+
}), tap((t) => {
|
|
4638
4640
|
const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4639
4641
|
this.events.next(resolveEnd);
|
|
4640
4642
|
}));
|
|
@@ -4645,10 +4647,8 @@ class NavigationTransitions {
|
|
|
4645
4647
|
switchTap((t) => {
|
|
4646
4648
|
const loadComponents = (route) => {
|
|
4647
4649
|
const loaders = [];
|
|
4648
|
-
if (route.routeConfig?.loadComponent &&
|
|
4649
|
-
|
|
4650
|
-
loaders.push(this.configLoader.loadComponent(route.routeConfig)
|
|
4651
|
-
.pipe(tap(loadedComponent => {
|
|
4650
|
+
if (route.routeConfig?.loadComponent && !route.routeConfig._loadedComponent) {
|
|
4651
|
+
loaders.push(this.configLoader.loadComponent(route.routeConfig).pipe(tap((loadedComponent) => {
|
|
4652
4652
|
route.component = loadedComponent;
|
|
4653
4653
|
}), map(() => void 0)));
|
|
4654
4654
|
}
|
|
@@ -4657,20 +4657,18 @@ class NavigationTransitions {
|
|
|
4657
4657
|
}
|
|
4658
4658
|
return loaders;
|
|
4659
4659
|
};
|
|
4660
|
-
return combineLatest(loadComponents(t.targetSnapshot.root))
|
|
4661
|
-
.pipe(defaultIfEmpty(null), take(1));
|
|
4660
|
+
return combineLatest(loadComponents(t.targetSnapshot.root)).pipe(defaultIfEmpty(null), take(1));
|
|
4662
4661
|
}), switchTap(() => this.afterPreactivation()), switchMap(() => {
|
|
4663
4662
|
const { currentSnapshot, targetSnapshot } = overallTransitionState;
|
|
4664
4663
|
const viewTransitionStarted = this.createViewTransition?.(this.environmentInjector, currentSnapshot.root, targetSnapshot.root);
|
|
4665
4664
|
// If view transitions are enabled, block the navigation until the view
|
|
4666
4665
|
// transition callback starts. Otherwise, continue immediately.
|
|
4667
|
-
return viewTransitionStarted
|
|
4668
|
-
from(viewTransitionStarted).pipe(map(() => overallTransitionState))
|
|
4669
|
-
of(overallTransitionState);
|
|
4666
|
+
return viewTransitionStarted
|
|
4667
|
+
? from(viewTransitionStarted).pipe(map(() => overallTransitionState))
|
|
4668
|
+
: of(overallTransitionState);
|
|
4670
4669
|
}), map((t) => {
|
|
4671
4670
|
const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4672
|
-
this.currentTransition =
|
|
4673
|
-
overallTransitionState = { ...t, targetRouterState };
|
|
4671
|
+
this.currentTransition = overallTransitionState = { ...t, targetRouterState };
|
|
4674
4672
|
this.currentNavigation.targetRouterState = targetRouterState;
|
|
4675
4673
|
return overallTransitionState;
|
|
4676
4674
|
}), tap(() => {
|
|
@@ -4689,7 +4687,7 @@ class NavigationTransitions {
|
|
|
4689
4687
|
},
|
|
4690
4688
|
complete: () => {
|
|
4691
4689
|
completed = true;
|
|
4692
|
-
}
|
|
4690
|
+
},
|
|
4693
4691
|
}),
|
|
4694
4692
|
// There used to be a lot more logic happening directly within the
|
|
4695
4693
|
// transition Observable. Some of this logic has been refactored out to
|
|
@@ -4698,7 +4696,7 @@ class NavigationTransitions {
|
|
|
4698
4696
|
// required in the future to support something like the abort signal of the
|
|
4699
4697
|
// Navigation API where the navigation gets aborted from outside the
|
|
4700
4698
|
// transition.
|
|
4701
|
-
takeUntil(this.transitionAbortSubject.pipe(tap(err => {
|
|
4699
|
+
takeUntil(this.transitionAbortSubject.pipe(tap((err) => {
|
|
4702
4700
|
throw err;
|
|
4703
4701
|
}))), finalize(() => {
|
|
4704
4702
|
/* When the navigation stream finishes either through error or success,
|
|
@@ -4708,10 +4706,9 @@ class NavigationTransitions {
|
|
|
4708
4706
|
* catch-all to make sure the NavigationCancel event is fired when a
|
|
4709
4707
|
* navigation gets cancelled but not caught by other means. */
|
|
4710
4708
|
if (!completed && !errored) {
|
|
4711
|
-
const cancelationReason =
|
|
4712
|
-
`Navigation ID ${overallTransitionState
|
|
4713
|
-
|
|
4714
|
-
'';
|
|
4709
|
+
const cancelationReason = typeof ngDevMode === 'undefined' || ngDevMode
|
|
4710
|
+
? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}`
|
|
4711
|
+
: '';
|
|
4715
4712
|
this.cancelNavigationTransition(overallTransitionState, cancelationReason, NavigationCancellationCode.SupersededByNewNavigation);
|
|
4716
4713
|
}
|
|
4717
4714
|
// Only clear current navigation if it is still set to the one that
|
|
@@ -4780,8 +4777,8 @@ class NavigationTransitions {
|
|
|
4780
4777
|
// [Object object] with the custom serializer and be "the same" when they
|
|
4781
4778
|
// aren't).
|
|
4782
4779
|
// (Same for isUpdatedBrowserUrl)
|
|
4783
|
-
return this.currentTransition?.extractedUrl.toString() !==
|
|
4784
|
-
this.currentTransition?.currentUrlTree.toString();
|
|
4780
|
+
return (this.currentTransition?.extractedUrl.toString() !==
|
|
4781
|
+
this.currentTransition?.currentUrlTree.toString());
|
|
4785
4782
|
}
|
|
4786
4783
|
/**
|
|
4787
4784
|
* @returns Whether we're updating the browser URL to something new (navigation is going
|
|
@@ -4793,13 +4790,13 @@ class NavigationTransitions {
|
|
|
4793
4790
|
// return only part of the browser URL and that part may have not changed even if some other
|
|
4794
4791
|
// portion of the URL did.
|
|
4795
4792
|
const extractedBrowserUrl = this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true)));
|
|
4796
|
-
return extractedBrowserUrl.toString() !== this.currentTransition?.extractedUrl.toString() &&
|
|
4797
|
-
!this.currentTransition?.extras.skipLocationChange;
|
|
4793
|
+
return (extractedBrowserUrl.toString() !== this.currentTransition?.extractedUrl.toString() &&
|
|
4794
|
+
!this.currentTransition?.extras.skipLocationChange);
|
|
4798
4795
|
}
|
|
4799
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4800
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4796
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4797
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: NavigationTransitions, providedIn: 'root' }); }
|
|
4801
4798
|
}
|
|
4802
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4799
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: NavigationTransitions, decorators: [{
|
|
4803
4800
|
type: Injectable,
|
|
4804
4801
|
args: [{ providedIn: 'root' }]
|
|
4805
4802
|
}], ctorParameters: () => [] });
|
|
@@ -4815,10 +4812,10 @@ function isBrowserTriggeredNavigation(source) {
|
|
|
4815
4812
|
* @publicApi
|
|
4816
4813
|
*/
|
|
4817
4814
|
class RouteReuseStrategy {
|
|
4818
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4819
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4815
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4816
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }); }
|
|
4820
4817
|
}
|
|
4821
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4818
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouteReuseStrategy, decorators: [{
|
|
4822
4819
|
type: Injectable,
|
|
4823
4820
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
|
|
4824
4821
|
}] });
|
|
@@ -4869,19 +4866,19 @@ class BaseRouteReuseStrategy {
|
|
|
4869
4866
|
}
|
|
4870
4867
|
}
|
|
4871
4868
|
class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
4872
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4873
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4869
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4870
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' }); }
|
|
4874
4871
|
}
|
|
4875
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4872
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
|
|
4876
4873
|
type: Injectable,
|
|
4877
4874
|
args: [{ providedIn: 'root' }]
|
|
4878
4875
|
}] });
|
|
4879
4876
|
|
|
4880
4877
|
class StateManager {
|
|
4881
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
4882
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
4878
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: StateManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4879
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: StateManager, providedIn: 'root', useFactory: () => inject(HistoryStateManager) }); }
|
|
4883
4880
|
}
|
|
4884
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
4881
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: StateManager, decorators: [{
|
|
4885
4882
|
type: Injectable,
|
|
4886
4883
|
args: [{ providedIn: 'root', useFactory: () => inject(HistoryStateManager) }]
|
|
4887
4884
|
}] });
|
|
@@ -4940,7 +4937,7 @@ class HistoryStateManager extends StateManager {
|
|
|
4940
4937
|
};
|
|
4941
4938
|
}
|
|
4942
4939
|
registerNonRouterCurrentEntryChangeListener(listener) {
|
|
4943
|
-
return this.location.subscribe(event => {
|
|
4940
|
+
return this.location.subscribe((event) => {
|
|
4944
4941
|
if (event['type'] === 'popstate') {
|
|
4945
4942
|
listener(event['url'], event.state);
|
|
4946
4943
|
}
|
|
@@ -4963,8 +4960,7 @@ class HistoryStateManager extends StateManager {
|
|
|
4963
4960
|
}
|
|
4964
4961
|
else if (e instanceof BeforeActivateRoutes) {
|
|
4965
4962
|
this.currentUrlTree = currentTransition.finalUrl;
|
|
4966
|
-
this.rawUrlTree =
|
|
4967
|
-
this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);
|
|
4963
|
+
this.rawUrlTree = this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);
|
|
4968
4964
|
this.routerState = currentTransition.targetRouterState;
|
|
4969
4965
|
if (this.urlUpdateStrategy === 'deferred') {
|
|
4970
4966
|
if (!currentTransition.extras.skipLocationChange) {
|
|
@@ -4992,14 +4988,14 @@ class HistoryStateManager extends StateManager {
|
|
|
4992
4988
|
const currentBrowserPageId = this.browserPageId;
|
|
4993
4989
|
const state = {
|
|
4994
4990
|
...transition.extras.state,
|
|
4995
|
-
...this.generateNgRouterState(transition.id, currentBrowserPageId)
|
|
4991
|
+
...this.generateNgRouterState(transition.id, currentBrowserPageId),
|
|
4996
4992
|
};
|
|
4997
4993
|
this.location.replaceState(path, '', state);
|
|
4998
4994
|
}
|
|
4999
4995
|
else {
|
|
5000
4996
|
const state = {
|
|
5001
4997
|
...transition.extras.state,
|
|
5002
|
-
...this.generateNgRouterState(transition.id, this.browserPageId + 1)
|
|
4998
|
+
...this.generateNgRouterState(transition.id, this.browserPageId + 1),
|
|
5003
4999
|
};
|
|
5004
5000
|
this.location.go(path, '', state);
|
|
5005
5001
|
}
|
|
@@ -5046,8 +5042,7 @@ class HistoryStateManager extends StateManager {
|
|
|
5046
5042
|
// the part of the navigation handled by the Angular router rather than the whole URL. In
|
|
5047
5043
|
// addition, the URLHandlingStrategy may be configured to specifically preserve parts of the URL
|
|
5048
5044
|
// when merging, such as the query params so they are not lost on a refresh.
|
|
5049
|
-
this.rawUrlTree =
|
|
5050
|
-
this.urlHandlingStrategy.merge(this.currentUrlTree, navigation.finalUrl ?? this.rawUrlTree);
|
|
5045
|
+
this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, navigation.finalUrl ?? this.rawUrlTree);
|
|
5051
5046
|
}
|
|
5052
5047
|
resetUrlToCurrentUrlTree() {
|
|
5053
5048
|
this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
|
|
@@ -5058,10 +5053,10 @@ class HistoryStateManager extends StateManager {
|
|
|
5058
5053
|
}
|
|
5059
5054
|
return { navigationId };
|
|
5060
5055
|
}
|
|
5061
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
5062
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
5056
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: HistoryStateManager, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5057
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: HistoryStateManager, providedIn: 'root' }); }
|
|
5063
5058
|
}
|
|
5064
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
5059
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: HistoryStateManager, decorators: [{
|
|
5065
5060
|
type: Injectable,
|
|
5066
5061
|
args: [{ providedIn: 'root' }]
|
|
5067
5062
|
}] });
|
|
@@ -5083,15 +5078,17 @@ var NavigationResult;
|
|
|
5083
5078
|
*/
|
|
5084
5079
|
function afterNextNavigation(router, action) {
|
|
5085
5080
|
router.events
|
|
5086
|
-
.pipe(filter((e) => e instanceof NavigationEnd ||
|
|
5087
|
-
e instanceof
|
|
5081
|
+
.pipe(filter((e) => e instanceof NavigationEnd ||
|
|
5082
|
+
e instanceof NavigationCancel ||
|
|
5083
|
+
e instanceof NavigationError ||
|
|
5084
|
+
e instanceof NavigationSkipped), map((e) => {
|
|
5088
5085
|
if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {
|
|
5089
5086
|
return NavigationResult.COMPLETE;
|
|
5090
5087
|
}
|
|
5091
|
-
const redirecting = e instanceof NavigationCancel
|
|
5092
|
-
|
|
5093
|
-
e.code === NavigationCancellationCode.SupersededByNewNavigation
|
|
5094
|
-
false;
|
|
5088
|
+
const redirecting = e instanceof NavigationCancel
|
|
5089
|
+
? e.code === NavigationCancellationCode.Redirect ||
|
|
5090
|
+
e.code === NavigationCancellationCode.SupersededByNewNavigation
|
|
5091
|
+
: false;
|
|
5095
5092
|
return redirecting ? NavigationResult.REDIRECTING : NavigationResult.FAILED;
|
|
5096
5093
|
}), filter((result) => result !== NavigationResult.REDIRECTING), take(1))
|
|
5097
5094
|
.subscribe(() => {
|
|
@@ -5110,7 +5107,7 @@ const exactMatchOptions = {
|
|
|
5110
5107
|
paths: 'exact',
|
|
5111
5108
|
fragment: 'ignored',
|
|
5112
5109
|
matrixParams: 'ignored',
|
|
5113
|
-
queryParams: 'exact'
|
|
5110
|
+
queryParams: 'exact',
|
|
5114
5111
|
};
|
|
5115
5112
|
/**
|
|
5116
5113
|
* The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `false`
|
|
@@ -5120,7 +5117,7 @@ const subsetMatchOptions = {
|
|
|
5120
5117
|
paths: 'subset',
|
|
5121
5118
|
fragment: 'ignored',
|
|
5122
5119
|
matrixParams: 'ignored',
|
|
5123
|
-
queryParams: 'subset'
|
|
5120
|
+
queryParams: 'subset',
|
|
5124
5121
|
};
|
|
5125
5122
|
/**
|
|
5126
5123
|
* @description
|
|
@@ -5216,22 +5213,24 @@ class Router {
|
|
|
5216
5213
|
this.eventsSubscription = new Subscription();
|
|
5217
5214
|
this.isNgZoneEnabled = inject(NgZone) instanceof NgZone && NgZone.isInAngularZone();
|
|
5218
5215
|
this.resetConfig(this.config);
|
|
5219
|
-
this.navigationTransitions
|
|
5216
|
+
this.navigationTransitions
|
|
5217
|
+
.setupNavigations(this, this.currentUrlTree, this.routerState)
|
|
5220
5218
|
.subscribe({
|
|
5221
5219
|
error: (e) => {
|
|
5222
5220
|
this.console.warn(ngDevMode ? `Unhandled Navigation Error: ${e}` : e);
|
|
5223
|
-
}
|
|
5221
|
+
},
|
|
5224
5222
|
});
|
|
5225
5223
|
this.subscribeToNavigationEvents();
|
|
5226
5224
|
}
|
|
5227
5225
|
subscribeToNavigationEvents() {
|
|
5228
|
-
const subscription = this.navigationTransitions.events.subscribe(e => {
|
|
5226
|
+
const subscription = this.navigationTransitions.events.subscribe((e) => {
|
|
5229
5227
|
try {
|
|
5230
5228
|
const currentTransition = this.navigationTransitions.currentTransition;
|
|
5231
5229
|
const currentNavigation = this.navigationTransitions.currentNavigation;
|
|
5232
5230
|
if (currentTransition !== null && currentNavigation !== null) {
|
|
5233
5231
|
this.stateManager.handleRouterEvent(e, currentNavigation);
|
|
5234
|
-
if (e instanceof NavigationCancel &&
|
|
5232
|
+
if (e instanceof NavigationCancel &&
|
|
5233
|
+
e.code !== NavigationCancellationCode.Redirect &&
|
|
5235
5234
|
e.code !== NavigationCancellationCode.SupersededByNewNavigation) {
|
|
5236
5235
|
// It seems weird that `navigated` is set to `true` when the navigation is rejected,
|
|
5237
5236
|
// however it's how things were written initially. Investigation would need to be done
|
|
@@ -5252,12 +5251,12 @@ class Router {
|
|
|
5252
5251
|
// button, URL bar, etc). We want to replace that item in history
|
|
5253
5252
|
// if the navigation is rejected.
|
|
5254
5253
|
replaceUrl: this.urlUpdateStrategy === 'eager' ||
|
|
5255
|
-
isBrowserTriggeredNavigation(currentTransition.source)
|
|
5254
|
+
isBrowserTriggeredNavigation(currentTransition.source),
|
|
5256
5255
|
};
|
|
5257
5256
|
this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras, {
|
|
5258
5257
|
resolve: currentTransition.resolve,
|
|
5259
5258
|
reject: currentTransition.reject,
|
|
5260
|
-
promise: currentTransition.promise
|
|
5259
|
+
promise: currentTransition.promise,
|
|
5261
5260
|
});
|
|
5262
5261
|
}
|
|
5263
5262
|
}
|
|
@@ -5506,7 +5505,7 @@ class Router {
|
|
|
5506
5505
|
*
|
|
5507
5506
|
*/
|
|
5508
5507
|
navigateByUrl(url, extras = {
|
|
5509
|
-
skipLocationChange: false
|
|
5508
|
+
skipLocationChange: false,
|
|
5510
5509
|
}) {
|
|
5511
5510
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
5512
5511
|
if (this.isNgZoneEnabled && !NgZone.isInAngularZone()) {
|
|
@@ -5625,7 +5624,7 @@ class Router {
|
|
|
5625
5624
|
reject,
|
|
5626
5625
|
promise,
|
|
5627
5626
|
currentSnapshot: this.routerState.snapshot,
|
|
5628
|
-
currentRouterState: this.routerState
|
|
5627
|
+
currentRouterState: this.routerState,
|
|
5629
5628
|
});
|
|
5630
5629
|
// Make sure that the error is propagated even though `processNavigations` catch
|
|
5631
5630
|
// handler does not rethrow
|
|
@@ -5633,10 +5632,10 @@ class Router {
|
|
|
5633
5632
|
return Promise.reject(e);
|
|
5634
5633
|
});
|
|
5635
5634
|
}
|
|
5636
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
5637
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
5635
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5636
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: Router, providedIn: 'root' }); }
|
|
5638
5637
|
}
|
|
5639
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
5638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: Router, decorators: [{
|
|
5640
5639
|
type: Injectable,
|
|
5641
5640
|
args: [{ providedIn: 'root' }]
|
|
5642
5641
|
}], ctorParameters: () => [] });
|
|
@@ -5650,7 +5649,7 @@ function validateCommands(commands) {
|
|
|
5650
5649
|
}
|
|
5651
5650
|
}
|
|
5652
5651
|
function isPublicRouterEvent(e) {
|
|
5653
|
-
return
|
|
5652
|
+
return !(e instanceof BeforeActivateRoutes) && !(e instanceof RedirectRequest);
|
|
5654
5653
|
}
|
|
5655
5654
|
|
|
5656
5655
|
/**
|
|
@@ -5868,22 +5867,23 @@ class RouterLink {
|
|
|
5868
5867
|
}
|
|
5869
5868
|
updateHref() {
|
|
5870
5869
|
const urlTree = this.urlTree;
|
|
5871
|
-
this.href =
|
|
5872
|
-
this.locationStrategy
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
//
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5870
|
+
this.href =
|
|
5871
|
+
urlTree !== null && this.locationStrategy
|
|
5872
|
+
? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree))
|
|
5873
|
+
: null;
|
|
5874
|
+
const sanitizedValue = this.href === null
|
|
5875
|
+
? null
|
|
5876
|
+
: // This class represents a directive that can be added to both `<a>` elements,
|
|
5877
|
+
// as well as other elements. As a result, we can't define security context at
|
|
5878
|
+
// compile time. So the security context is deferred to runtime.
|
|
5879
|
+
// The `ɵɵsanitizeUrlOrResourceUrl` selects the necessary sanitizer function
|
|
5880
|
+
// based on the tag and property names. The logic mimics the one from
|
|
5881
|
+
// `packages/compiler/src/schema/dom_security_schema.ts`, which is used at compile time.
|
|
5882
|
+
//
|
|
5883
|
+
// Note: we should investigate whether we can switch to using `@HostBinding('attr.href')`
|
|
5884
|
+
// instead of applying a value via a renderer, after a final merge of the
|
|
5885
|
+
// `RouterLinkWithHref` directive.
|
|
5886
|
+
ɵɵsanitizeUrlOrResourceUrl(this.href, this.el.nativeElement.tagName.toLowerCase(), 'href');
|
|
5887
5887
|
this.applyAttributeValue('href', sanitizedValue);
|
|
5888
5888
|
}
|
|
5889
5889
|
applyAttributeValue(attrName, attrValue) {
|
|
@@ -5910,10 +5910,10 @@ class RouterLink {
|
|
|
5910
5910
|
preserveFragment: this.preserveFragment,
|
|
5911
5911
|
});
|
|
5912
5912
|
}
|
|
5913
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
5914
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.2.0
|
|
5913
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
5914
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.2.0", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", info: "info", relativeTo: "relativeTo", preserveFragment: ["preserveFragment", "preserveFragment", booleanAttribute], skipLocationChange: ["skipLocationChange", "skipLocationChange", booleanAttribute], replaceUrl: ["replaceUrl", "replaceUrl", booleanAttribute], routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 }); }
|
|
5915
5915
|
}
|
|
5916
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
5916
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterLink, decorators: [{
|
|
5917
5917
|
type: Directive,
|
|
5918
5918
|
args: [{
|
|
5919
5919
|
selector: '[routerLink]',
|
|
@@ -5952,8 +5952,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0-rc.0", ng
|
|
|
5952
5952
|
type: Input
|
|
5953
5953
|
}], onClick: [{
|
|
5954
5954
|
type: HostListener,
|
|
5955
|
-
args: ['click',
|
|
5956
|
-
|
|
5955
|
+
args: ['click', [
|
|
5956
|
+
'$event.button',
|
|
5957
|
+
'$event.ctrlKey',
|
|
5958
|
+
'$event.shiftKey',
|
|
5959
|
+
'$event.altKey',
|
|
5960
|
+
'$event.metaKey',
|
|
5961
|
+
]]
|
|
5957
5962
|
}] } });
|
|
5958
5963
|
|
|
5959
5964
|
/**
|
|
@@ -6071,7 +6076,9 @@ class RouterLinkActive {
|
|
|
6071
6076
|
/** @nodoc */
|
|
6072
6077
|
ngAfterContentInit() {
|
|
6073
6078
|
// `of(null)` is used to force subscribe body to execute once immediately (like `startWith`).
|
|
6074
|
-
of(this.links.changes, of(null))
|
|
6079
|
+
of(this.links.changes, of(null))
|
|
6080
|
+
.pipe(mergeAll())
|
|
6081
|
+
.subscribe((_) => {
|
|
6075
6082
|
this.update();
|
|
6076
6083
|
this.subscribeToEachLinkOnChanges();
|
|
6077
6084
|
});
|
|
@@ -6080,8 +6087,10 @@ class RouterLinkActive {
|
|
|
6080
6087
|
this.linkInputChangesSubscription?.unsubscribe();
|
|
6081
6088
|
const allLinkChanges = [...this.links.toArray(), this.link]
|
|
6082
6089
|
.filter((link) => !!link)
|
|
6083
|
-
.map(link => link.onChanges);
|
|
6084
|
-
this.linkInputChangesSubscription = from(allLinkChanges)
|
|
6090
|
+
.map((link) => link.onChanges);
|
|
6091
|
+
this.linkInputChangesSubscription = from(allLinkChanges)
|
|
6092
|
+
.pipe(mergeAll())
|
|
6093
|
+
.subscribe((link) => {
|
|
6085
6094
|
if (this._isActive !== this.isLinkActive(this.router)(link)) {
|
|
6086
6095
|
this.update();
|
|
6087
6096
|
}
|
|
@@ -6089,7 +6098,7 @@ class RouterLinkActive {
|
|
|
6089
6098
|
}
|
|
6090
6099
|
set routerLinkActive(data) {
|
|
6091
6100
|
const classes = Array.isArray(data) ? data : data.split(' ');
|
|
6092
|
-
this.classes = classes.filter(c => !!c);
|
|
6101
|
+
this.classes = classes.filter((c) => !!c);
|
|
6093
6102
|
}
|
|
6094
6103
|
/** @nodoc */
|
|
6095
6104
|
ngOnChanges(changes) {
|
|
@@ -6128,10 +6137,10 @@ class RouterLinkActive {
|
|
|
6128
6137
|
});
|
|
6129
6138
|
}
|
|
6130
6139
|
isLinkActive(router) {
|
|
6131
|
-
const options = isActiveMatchOptions(this.routerLinkActiveOptions)
|
|
6132
|
-
this.routerLinkActiveOptions
|
|
6133
|
-
// While the types should disallow `undefined` here, it's possible without strict inputs
|
|
6134
|
-
|
|
6140
|
+
const options = isActiveMatchOptions(this.routerLinkActiveOptions)
|
|
6141
|
+
? this.routerLinkActiveOptions
|
|
6142
|
+
: // While the types should disallow `undefined` here, it's possible without strict inputs
|
|
6143
|
+
this.routerLinkActiveOptions.exact || false;
|
|
6135
6144
|
return (link) => {
|
|
6136
6145
|
const urlTree = link.urlTree;
|
|
6137
6146
|
return urlTree ? router.isActive(urlTree, options) : false;
|
|
@@ -6139,12 +6148,12 @@ class RouterLinkActive {
|
|
|
6139
6148
|
}
|
|
6140
6149
|
hasActiveLinks() {
|
|
6141
6150
|
const isActiveCheckFn = this.isLinkActive(this.router);
|
|
6142
|
-
return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
|
|
6151
|
+
return (this.link && isActiveCheckFn(this.link)) || this.links.some(isActiveCheckFn);
|
|
6143
6152
|
}
|
|
6144
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
6145
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0
|
|
6153
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
6154
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 }); }
|
|
6146
6155
|
}
|
|
6147
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
6156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
6148
6157
|
type: Directive,
|
|
6149
6158
|
args: [{
|
|
6150
6159
|
selector: '[routerLinkActive]',
|
|
@@ -6196,10 +6205,10 @@ class PreloadAllModules {
|
|
|
6196
6205
|
preload(route, fn) {
|
|
6197
6206
|
return fn().pipe(catchError(() => of(null)));
|
|
6198
6207
|
}
|
|
6199
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
6200
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
6208
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6209
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' }); }
|
|
6201
6210
|
}
|
|
6202
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
6211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6203
6212
|
type: Injectable,
|
|
6204
6213
|
args: [{ providedIn: 'root' }]
|
|
6205
6214
|
}] });
|
|
@@ -6216,10 +6225,10 @@ class NoPreloading {
|
|
|
6216
6225
|
preload(route, fn) {
|
|
6217
6226
|
return of(null);
|
|
6218
6227
|
}
|
|
6219
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
6220
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
6228
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6229
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: NoPreloading, providedIn: 'root' }); }
|
|
6221
6230
|
}
|
|
6222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
6231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6223
6232
|
type: Injectable,
|
|
6224
6233
|
args: [{ providedIn: 'root' }]
|
|
6225
6234
|
}] });
|
|
@@ -6243,10 +6252,9 @@ class RouterPreloader {
|
|
|
6243
6252
|
this.loader = loader;
|
|
6244
6253
|
}
|
|
6245
6254
|
setUpPreloading() {
|
|
6246
|
-
this.subscription =
|
|
6247
|
-
this.
|
|
6248
|
-
|
|
6249
|
-
.subscribe(() => { });
|
|
6255
|
+
this.subscription = this.router.events
|
|
6256
|
+
.pipe(filter((e) => e instanceof NavigationEnd), concatMap(() => this.preload()))
|
|
6257
|
+
.subscribe(() => { });
|
|
6250
6258
|
}
|
|
6251
6259
|
preload() {
|
|
6252
6260
|
return this.processRoutes(this.injector, this.router.config);
|
|
@@ -6261,8 +6269,7 @@ class RouterPreloader {
|
|
|
6261
6269
|
const res = [];
|
|
6262
6270
|
for (const route of routes) {
|
|
6263
6271
|
if (route.providers && !route._injector) {
|
|
6264
|
-
route._injector =
|
|
6265
|
-
createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);
|
|
6272
|
+
route._injector = createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);
|
|
6266
6273
|
}
|
|
6267
6274
|
const injectorForCurrentRoute = route._injector ?? injector;
|
|
6268
6275
|
const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;
|
|
@@ -6312,10 +6319,10 @@ class RouterPreloader {
|
|
|
6312
6319
|
}
|
|
6313
6320
|
});
|
|
6314
6321
|
}
|
|
6315
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
6316
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
6322
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6323
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' }); }
|
|
6317
6324
|
}
|
|
6318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
6325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6319
6326
|
type: Injectable,
|
|
6320
6327
|
args: [{ providedIn: 'root' }]
|
|
6321
6328
|
}], ctorParameters: () => [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }] });
|
|
@@ -6348,7 +6355,7 @@ class RouterScroller {
|
|
|
6348
6355
|
this.scrollEventsSubscription = this.consumeScrollEvents();
|
|
6349
6356
|
}
|
|
6350
6357
|
createScrollEvents() {
|
|
6351
|
-
return this.transitions.events.subscribe(e => {
|
|
6358
|
+
return this.transitions.events.subscribe((e) => {
|
|
6352
6359
|
if (e instanceof NavigationStart) {
|
|
6353
6360
|
// store the scroll position of the current stable navigations.
|
|
6354
6361
|
this.store[this.lastId] = this.viewportScroller.getScrollPosition();
|
|
@@ -6368,7 +6375,7 @@ class RouterScroller {
|
|
|
6368
6375
|
});
|
|
6369
6376
|
}
|
|
6370
6377
|
consumeScrollEvents() {
|
|
6371
|
-
return this.transitions.events.subscribe(e => {
|
|
6378
|
+
return this.transitions.events.subscribe((e) => {
|
|
6372
6379
|
if (!(e instanceof Scroll))
|
|
6373
6380
|
return;
|
|
6374
6381
|
// a popstate event. The pop state event will always ignore anchor scrolling.
|
|
@@ -6408,10 +6415,10 @@ class RouterScroller {
|
|
|
6408
6415
|
this.routerEventsSubscription?.unsubscribe();
|
|
6409
6416
|
this.scrollEventsSubscription?.unsubscribe();
|
|
6410
6417
|
}
|
|
6411
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
6412
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0
|
|
6418
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6419
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterScroller }); }
|
|
6413
6420
|
}
|
|
6414
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
6421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6415
6422
|
type: Injectable
|
|
6416
6423
|
}], ctorParameters: () => [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }] });
|
|
6417
6424
|
|
|
@@ -6454,12 +6461,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0-rc.0", ng
|
|
|
6454
6461
|
function provideRouter(routes, ...features) {
|
|
6455
6462
|
return makeEnvironmentProviders([
|
|
6456
6463
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6457
|
-
|
|
6458
|
-
{ provide: ROUTER_IS_PROVIDED, useValue: true }
|
|
6459
|
-
[],
|
|
6464
|
+
typeof ngDevMode === 'undefined' || ngDevMode
|
|
6465
|
+
? { provide: ROUTER_IS_PROVIDED, useValue: true }
|
|
6466
|
+
: [],
|
|
6460
6467
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6461
6468
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
6462
|
-
features.map(feature => feature.ɵproviders),
|
|
6469
|
+
features.map((feature) => feature.ɵproviders),
|
|
6463
6470
|
]);
|
|
6464
6471
|
}
|
|
6465
6472
|
function rootRoute(router) {
|
|
@@ -6475,7 +6482,10 @@ function routerFeature(kind, providers) {
|
|
|
6475
6482
|
* An Injection token used to indicate whether `provideRouter` or `RouterModule.forRoot` was ever
|
|
6476
6483
|
* called.
|
|
6477
6484
|
*/
|
|
6478
|
-
const ROUTER_IS_PROVIDED = new InjectionToken('', {
|
|
6485
|
+
const ROUTER_IS_PROVIDED = new InjectionToken('', {
|
|
6486
|
+
providedIn: 'root',
|
|
6487
|
+
factory: () => false,
|
|
6488
|
+
});
|
|
6479
6489
|
const routerIsProvidedDevModeCheck = {
|
|
6480
6490
|
provide: ENVIRONMENT_INITIALIZER,
|
|
6481
6491
|
multi: true,
|
|
@@ -6486,7 +6496,7 @@ const routerIsProvidedDevModeCheck = {
|
|
|
6486
6496
|
'This is likely a mistake.');
|
|
6487
6497
|
}
|
|
6488
6498
|
};
|
|
6489
|
-
}
|
|
6499
|
+
},
|
|
6490
6500
|
};
|
|
6491
6501
|
/**
|
|
6492
6502
|
* Registers a [DI provider](guide/glossary#provider) for a set of routes.
|
|
@@ -6508,7 +6518,7 @@ const routerIsProvidedDevModeCheck = {
|
|
|
6508
6518
|
function provideRoutes(routes) {
|
|
6509
6519
|
return [
|
|
6510
6520
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6511
|
-
|
|
6521
|
+
typeof ngDevMode === 'undefined' || ngDevMode ? routerIsProvidedDevModeCheck : [],
|
|
6512
6522
|
];
|
|
6513
6523
|
}
|
|
6514
6524
|
/**
|
|
@@ -6537,7 +6547,8 @@ function provideRoutes(routes) {
|
|
|
6537
6547
|
* @returns A set of providers for use with `provideRouter`.
|
|
6538
6548
|
*/
|
|
6539
6549
|
function withInMemoryScrolling(options = {}) {
|
|
6540
|
-
const providers = [
|
|
6550
|
+
const providers = [
|
|
6551
|
+
{
|
|
6541
6552
|
provide: ROUTER_SCROLLER,
|
|
6542
6553
|
useFactory: () => {
|
|
6543
6554
|
const viewportScroller = inject(ViewportScroller);
|
|
@@ -6546,7 +6557,8 @@ function withInMemoryScrolling(options = {}) {
|
|
|
6546
6557
|
const urlSerializer = inject(UrlSerializer);
|
|
6547
6558
|
return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);
|
|
6548
6559
|
},
|
|
6549
|
-
}
|
|
6560
|
+
},
|
|
6561
|
+
];
|
|
6550
6562
|
return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
|
|
6551
6563
|
}
|
|
6552
6564
|
function getBootstrapListener() {
|
|
@@ -6576,12 +6588,12 @@ function getBootstrapListener() {
|
|
|
6576
6588
|
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6577
6589
|
* to the activation phase.
|
|
6578
6590
|
*/
|
|
6579
|
-
const BOOTSTRAP_DONE = new InjectionToken(
|
|
6591
|
+
const BOOTSTRAP_DONE = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'bootstrap done indicator' : '', {
|
|
6580
6592
|
factory: () => {
|
|
6581
6593
|
return new Subject();
|
|
6582
|
-
}
|
|
6594
|
+
},
|
|
6583
6595
|
});
|
|
6584
|
-
const INITIAL_NAVIGATION = new InjectionToken(
|
|
6596
|
+
const INITIAL_NAVIGATION = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6585
6597
|
/**
|
|
6586
6598
|
* Configures initial navigation to start before the root component is created.
|
|
6587
6599
|
*
|
|
@@ -6618,7 +6630,7 @@ function withEnabledBlockingInitialNavigation() {
|
|
|
6618
6630
|
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());
|
|
6619
6631
|
return () => {
|
|
6620
6632
|
return locationInitialized.then(() => {
|
|
6621
|
-
return new Promise(resolve => {
|
|
6633
|
+
return new Promise((resolve) => {
|
|
6622
6634
|
const router = injector.get(Router);
|
|
6623
6635
|
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6624
6636
|
afterNextNavigation(router, () => {
|
|
@@ -6637,7 +6649,7 @@ function withEnabledBlockingInitialNavigation() {
|
|
|
6637
6649
|
});
|
|
6638
6650
|
});
|
|
6639
6651
|
};
|
|
6640
|
-
}
|
|
6652
|
+
},
|
|
6641
6653
|
},
|
|
6642
6654
|
];
|
|
6643
6655
|
return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);
|
|
@@ -6678,9 +6690,9 @@ function withDisabledInitialNavigation() {
|
|
|
6678
6690
|
return () => {
|
|
6679
6691
|
router.setUpLocationChangeListener();
|
|
6680
6692
|
};
|
|
6681
|
-
}
|
|
6693
|
+
},
|
|
6682
6694
|
},
|
|
6683
|
-
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6695
|
+
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ },
|
|
6684
6696
|
];
|
|
6685
6697
|
return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);
|
|
6686
6698
|
}
|
|
@@ -6711,7 +6723,8 @@ function withDisabledInitialNavigation() {
|
|
|
6711
6723
|
function withDebugTracing() {
|
|
6712
6724
|
let providers = [];
|
|
6713
6725
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
6714
|
-
providers = [
|
|
6726
|
+
providers = [
|
|
6727
|
+
{
|
|
6715
6728
|
provide: ENVIRONMENT_INITIALIZER,
|
|
6716
6729
|
multi: true,
|
|
6717
6730
|
useFactory: () => {
|
|
@@ -6724,15 +6737,16 @@ function withDebugTracing() {
|
|
|
6724
6737
|
console.groupEnd?.();
|
|
6725
6738
|
// tslint:enable:no-console
|
|
6726
6739
|
});
|
|
6727
|
-
}
|
|
6728
|
-
}
|
|
6740
|
+
},
|
|
6741
|
+
},
|
|
6742
|
+
];
|
|
6729
6743
|
}
|
|
6730
6744
|
else {
|
|
6731
6745
|
providers = [];
|
|
6732
6746
|
}
|
|
6733
6747
|
return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
|
|
6734
6748
|
}
|
|
6735
|
-
const ROUTER_PRELOADER = new InjectionToken(
|
|
6749
|
+
const ROUTER_PRELOADER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router preloader' : '');
|
|
6736
6750
|
/**
|
|
6737
6751
|
* Allows to configure a preloading strategy to use. The strategy is configured by providing a
|
|
6738
6752
|
* reference to a class that implements a `PreloadingStrategy`.
|
|
@@ -6794,9 +6808,7 @@ function withPreloading(preloadingStrategy) {
|
|
|
6794
6808
|
* @publicApi
|
|
6795
6809
|
*/
|
|
6796
6810
|
function withRouterConfig(options) {
|
|
6797
|
-
const providers = [
|
|
6798
|
-
{ provide: ROUTER_CONFIGURATION, useValue: options },
|
|
6799
|
-
];
|
|
6811
|
+
const providers = [{ provide: ROUTER_CONFIGURATION, useValue: options }];
|
|
6800
6812
|
return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);
|
|
6801
6813
|
}
|
|
6802
6814
|
/**
|
|
@@ -6824,9 +6836,7 @@ function withRouterConfig(options) {
|
|
|
6824
6836
|
* @publicApi
|
|
6825
6837
|
*/
|
|
6826
6838
|
function withHashLocation() {
|
|
6827
|
-
const providers = [
|
|
6828
|
-
{ provide: LocationStrategy, useClass: HashLocationStrategy },
|
|
6829
|
-
];
|
|
6839
|
+
const providers = [{ provide: LocationStrategy, useClass: HashLocationStrategy }];
|
|
6830
6840
|
return routerFeature(6 /* RouterFeatureKind.RouterHashLocationFeature */, providers);
|
|
6831
6841
|
}
|
|
6832
6842
|
/**
|
|
@@ -6860,7 +6870,8 @@ function withHashLocation() {
|
|
|
6860
6870
|
* @publicApi
|
|
6861
6871
|
*/
|
|
6862
6872
|
function withNavigationErrorHandler(fn) {
|
|
6863
|
-
const providers = [
|
|
6873
|
+
const providers = [
|
|
6874
|
+
{
|
|
6864
6875
|
provide: ENVIRONMENT_INITIALIZER,
|
|
6865
6876
|
multi: true,
|
|
6866
6877
|
useValue: () => {
|
|
@@ -6870,8 +6881,9 @@ function withNavigationErrorHandler(fn) {
|
|
|
6870
6881
|
runInInjectionContext(injector, () => fn(e));
|
|
6871
6882
|
}
|
|
6872
6883
|
});
|
|
6873
|
-
}
|
|
6874
|
-
}
|
|
6884
|
+
},
|
|
6885
|
+
},
|
|
6886
|
+
];
|
|
6875
6887
|
return routerFeature(7 /* RouterFeatureKind.NavigationErrorHandlerFeature */, providers);
|
|
6876
6888
|
}
|
|
6877
6889
|
/**
|
|
@@ -6933,7 +6945,7 @@ function withViewTransitions(options) {
|
|
|
6933
6945
|
{ provide: CREATE_VIEW_TRANSITION, useValue: createViewTransition },
|
|
6934
6946
|
{
|
|
6935
6947
|
provide: VIEW_TRANSITION_OPTIONS,
|
|
6936
|
-
useValue: { skipNextTransition: !!options?.skipInitialTransition, ...options }
|
|
6948
|
+
useValue: { skipNextTransition: !!options?.skipInitialTransition, ...options },
|
|
6937
6949
|
},
|
|
6938
6950
|
];
|
|
6939
6951
|
return routerFeature(9 /* RouterFeatureKind.ViewTransitionsFeature */, providers);
|
|
@@ -6946,8 +6958,9 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOu
|
|
|
6946
6958
|
/**
|
|
6947
6959
|
* @docsNotRequired
|
|
6948
6960
|
*/
|
|
6949
|
-
const ROUTER_FORROOT_GUARD = new InjectionToken(
|
|
6950
|
-
'
|
|
6961
|
+
const ROUTER_FORROOT_GUARD = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode
|
|
6962
|
+
? 'router duplicate forRoot guard'
|
|
6963
|
+
: 'ROUTER_FORROOT_GUARD');
|
|
6951
6964
|
// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
|
|
6952
6965
|
// here to avoid a breaking change whereby the provider order matters based on where the
|
|
6953
6966
|
// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
|
|
@@ -6961,8 +6974,9 @@ const ROUTER_PROVIDERS = [
|
|
|
6961
6974
|
RouterConfigLoader,
|
|
6962
6975
|
// Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can
|
|
6963
6976
|
// be removed when `provideRoutes` is removed.
|
|
6964
|
-
|
|
6965
|
-
|
|
6977
|
+
typeof ngDevMode === 'undefined' || ngDevMode
|
|
6978
|
+
? { provide: ROUTER_IS_PROVIDED, useValue: true }
|
|
6979
|
+
: [],
|
|
6966
6980
|
];
|
|
6967
6981
|
/**
|
|
6968
6982
|
* @description
|
|
@@ -7010,14 +7024,16 @@ class RouterModule {
|
|
|
7010
7024
|
ngModule: RouterModule,
|
|
7011
7025
|
providers: [
|
|
7012
7026
|
ROUTER_PROVIDERS,
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7027
|
+
typeof ngDevMode === 'undefined' || ngDevMode
|
|
7028
|
+
? config?.enableTracing
|
|
7029
|
+
? withDebugTracing().ɵproviders
|
|
7030
|
+
: []
|
|
7031
|
+
: [],
|
|
7016
7032
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
7017
7033
|
{
|
|
7018
7034
|
provide: ROUTER_FORROOT_GUARD,
|
|
7019
7035
|
useFactory: provideForRootGuard,
|
|
7020
|
-
deps: [[Router, new Optional(), new SkipSelf()]]
|
|
7036
|
+
deps: [[Router, new Optional(), new SkipSelf()]],
|
|
7021
7037
|
},
|
|
7022
7038
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
7023
7039
|
config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
@@ -7052,11 +7068,11 @@ class RouterModule {
|
|
|
7052
7068
|
providers: [{ provide: ROUTES, multi: true, useValue: routes }],
|
|
7053
7069
|
};
|
|
7054
7070
|
}
|
|
7055
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0
|
|
7056
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.0
|
|
7057
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.0
|
|
7071
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
7072
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] }); }
|
|
7073
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterModule }); }
|
|
7058
7074
|
}
|
|
7059
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0
|
|
7075
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: RouterModule, decorators: [{
|
|
7060
7076
|
type: NgModule,
|
|
7061
7077
|
args: [{
|
|
7062
7078
|
imports: ROUTER_DIRECTIVES,
|
|
@@ -7110,9 +7126,9 @@ function provideForRootGuard(router) {
|
|
|
7110
7126
|
function provideInitialNavigation(config) {
|
|
7111
7127
|
return [
|
|
7112
7128
|
config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [],
|
|
7113
|
-
config.initialNavigation === 'enabledBlocking'
|
|
7114
|
-
withEnabledBlockingInitialNavigation().ɵproviders
|
|
7115
|
-
[],
|
|
7129
|
+
config.initialNavigation === 'enabledBlocking'
|
|
7130
|
+
? withEnabledBlockingInitialNavigation().ɵproviders
|
|
7131
|
+
: [],
|
|
7116
7132
|
];
|
|
7117
7133
|
}
|
|
7118
7134
|
// TODO(atscott): This should not be in the public API
|
|
@@ -7122,7 +7138,7 @@ function provideInitialNavigation(config) {
|
|
|
7122
7138
|
*
|
|
7123
7139
|
* @publicApi
|
|
7124
7140
|
*/
|
|
7125
|
-
const ROUTER_INITIALIZER = new InjectionToken(
|
|
7141
|
+
const ROUTER_INITIALIZER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Router Initializer' : '');
|
|
7126
7142
|
function provideRouterInitializer() {
|
|
7127
7143
|
return [
|
|
7128
7144
|
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
@@ -7142,7 +7158,7 @@ function provideRouterInitializer() {
|
|
|
7142
7158
|
* @see {@link Route}
|
|
7143
7159
|
*/
|
|
7144
7160
|
function mapToCanMatch(providers) {
|
|
7145
|
-
return providers.map(provider => (...params) => inject(provider).canMatch(...params));
|
|
7161
|
+
return providers.map((provider) => (...params) => inject(provider).canMatch(...params));
|
|
7146
7162
|
}
|
|
7147
7163
|
/**
|
|
7148
7164
|
* Maps an array of injectable classes with canActivate functions to an array of equivalent
|
|
@@ -7154,7 +7170,7 @@ function mapToCanMatch(providers) {
|
|
|
7154
7170
|
* @see {@link Route}
|
|
7155
7171
|
*/
|
|
7156
7172
|
function mapToCanActivate(providers) {
|
|
7157
|
-
return providers.map(provider => (...params) => inject(provider).canActivate(...params));
|
|
7173
|
+
return providers.map((provider) => (...params) => inject(provider).canActivate(...params));
|
|
7158
7174
|
}
|
|
7159
7175
|
/**
|
|
7160
7176
|
* Maps an array of injectable classes with canActivateChild functions to an array of equivalent
|
|
@@ -7166,7 +7182,7 @@ function mapToCanActivate(providers) {
|
|
|
7166
7182
|
* @see {@link Route}
|
|
7167
7183
|
*/
|
|
7168
7184
|
function mapToCanActivateChild(providers) {
|
|
7169
|
-
return providers.map(provider => (...params) => inject(provider).canActivateChild(...params));
|
|
7185
|
+
return providers.map((provider) => (...params) => inject(provider).canActivateChild(...params));
|
|
7170
7186
|
}
|
|
7171
7187
|
/**
|
|
7172
7188
|
* Maps an array of injectable classes with canDeactivate functions to an array of equivalent
|
|
@@ -7178,7 +7194,7 @@ function mapToCanActivateChild(providers) {
|
|
|
7178
7194
|
* @see {@link Route}
|
|
7179
7195
|
*/
|
|
7180
7196
|
function mapToCanDeactivate(providers) {
|
|
7181
|
-
return providers.map(provider => (...params) => inject(provider).canDeactivate(...params));
|
|
7197
|
+
return providers.map((provider) => (...params) => inject(provider).canDeactivate(...params));
|
|
7182
7198
|
}
|
|
7183
7199
|
/**
|
|
7184
7200
|
* Maps an injectable class with a resolve function to an equivalent `ResolveFn`
|
|
@@ -7201,7 +7217,7 @@ function mapToResolve(provider) {
|
|
|
7201
7217
|
/**
|
|
7202
7218
|
* @publicApi
|
|
7203
7219
|
*/
|
|
7204
|
-
const VERSION = new Version('17.2.0
|
|
7220
|
+
const VERSION = new Version('17.2.0');
|
|
7205
7221
|
|
|
7206
7222
|
/**
|
|
7207
7223
|
* @module
|