@angular/router 13.3.0 → 14.0.0-next.10
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/esm2020/src/apply_redirects.mjs +2 -2
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/directives/router_link.mjs +15 -18
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +4 -4
- package/esm2020/src/events.mjs +1 -1
- package/esm2020/src/index.mjs +2 -1
- package/esm2020/src/models.mjs +14 -0
- package/esm2020/src/operators/activate_routes.mjs +1 -1
- package/esm2020/src/operators/apply_redirects.mjs +1 -1
- package/esm2020/src/operators/check_guards.mjs +1 -1
- package/esm2020/src/operators/recognize.mjs +1 -1
- package/esm2020/src/operators/resolve_data.mjs +20 -4
- package/esm2020/src/page_title_strategy.mjs +84 -0
- package/esm2020/src/recognize.mjs +1 -1
- package/esm2020/src/router.mjs +9 -6
- package/esm2020/src/router_config_loader.mjs +2 -2
- package/esm2020/src/router_module.mjs +13 -11
- package/esm2020/src/router_preloader.mjs +4 -4
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/router_state.mjs +1 -1
- package/esm2020/src/shared.mjs +1 -1
- package/esm2020/src/url_tree.mjs +2 -2
- package/esm2020/src/utils/config.mjs +1 -4
- package/esm2020/src/utils/config_matching.mjs +1 -1
- package/esm2020/src/utils/preactivation.mjs +1 -1
- package/esm2020/src/utils/type_guards.mjs +1 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +39 -15
- package/fesm2015/router.mjs +151 -56
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +40 -16
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2015/upgrade.mjs.map +1 -1
- package/fesm2020/router.mjs +149 -56
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +40 -16
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/fesm2020/upgrade.mjs.map +1 -1
- package/package.json +5 -5
- package/router.d.ts +97 -8
- package/testing/testing.d.ts +10 -2
- package/upgrade/upgrade.d.ts +1 -1
- package/esm2020/src/config.mjs +0 -14
- package/esm2020/src/interfaces.mjs +0 -9
package/fesm2020/router.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v14.0.0-next.10
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
import * as i3 from '@angular/common';
|
|
8
8
|
import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
|
-
import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, NgModuleRef, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, Injectable, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
|
|
10
|
+
import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, NgModuleRef, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, Injectable, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
|
|
11
11
|
import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
12
12
|
import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, refCount, finalize, mergeAll } from 'rxjs/operators';
|
|
13
|
+
import * as i1 from '@angular/platform-browser';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @license
|
|
@@ -1130,7 +1131,7 @@ class UrlParser {
|
|
|
1130
1131
|
}
|
|
1131
1132
|
let outletName = undefined;
|
|
1132
1133
|
if (path.indexOf(':') > -1) {
|
|
1133
|
-
outletName = path.
|
|
1134
|
+
outletName = path.slice(0, path.indexOf(':'));
|
|
1134
1135
|
this.capture(outletName);
|
|
1135
1136
|
this.capture(':');
|
|
1136
1137
|
}
|
|
@@ -2525,9 +2526,9 @@ class RouterOutlet {
|
|
|
2525
2526
|
this.activateEvents.emit(this.activated.instance);
|
|
2526
2527
|
}
|
|
2527
2528
|
}
|
|
2528
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2529
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
2530
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2529
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2530
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.10", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2531
2532
|
type: Directive,
|
|
2532
2533
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2533
2534
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
|
|
@@ -2581,9 +2582,9 @@ class OutletInjector {
|
|
|
2581
2582
|
*/
|
|
2582
2583
|
class ɵEmptyOutletComponent {
|
|
2583
2584
|
}
|
|
2584
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2585
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "
|
|
2586
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2585
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2586
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "14.0.0-next.10", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, directives: [{ type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2587
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2587
2588
|
type: Component,
|
|
2588
2589
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2589
2590
|
}] });
|
|
@@ -2657,9 +2658,6 @@ function validateNode(route, fullPath) {
|
|
|
2657
2658
|
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
|
|
2658
2659
|
throw new Error(`Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
|
2659
2660
|
}
|
|
2660
|
-
if (route.pathMatch !== void 0 && route.pathMatch !== 'full' && route.pathMatch !== 'prefix') {
|
|
2661
|
-
throw new Error(`Invalid configuration of route '${fullPath}': pathMatch can only be set to 'prefix' or 'full'`);
|
|
2662
|
-
}
|
|
2663
2661
|
}
|
|
2664
2662
|
if (route.children) {
|
|
2665
2663
|
validateConfig(route.children, fullPath);
|
|
@@ -3786,6 +3784,12 @@ function recognize(rootComponentType, config, serializer, paramsInheritanceStrat
|
|
|
3786
3784
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3787
3785
|
* found in the LICENSE file at https://angular.io/license
|
|
3788
3786
|
*/
|
|
3787
|
+
/**
|
|
3788
|
+
* A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
|
|
3789
|
+
* static string or `Route.resolve` if anything else. This allows us to reuse the existing route
|
|
3790
|
+
* data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
|
|
3791
|
+
*/
|
|
3792
|
+
const RouteTitle = Symbol('RouteTitle');
|
|
3789
3793
|
function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
3790
3794
|
return mergeMap(t => {
|
|
3791
3795
|
const { targetSnapshot, guards: { canActivateChecks } } = t;
|
|
@@ -3798,12 +3802,22 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
|
3798
3802
|
});
|
|
3799
3803
|
}
|
|
3800
3804
|
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) {
|
|
3805
|
+
const config = futureARS.routeConfig;
|
|
3801
3806
|
const resolve = futureARS._resolve;
|
|
3807
|
+
const data = { ...futureARS.data };
|
|
3808
|
+
if (config?.title !== undefined) {
|
|
3809
|
+
if (typeof config.title === 'string' || config.title === null) {
|
|
3810
|
+
data[RouteTitle] = config.title;
|
|
3811
|
+
}
|
|
3812
|
+
else {
|
|
3813
|
+
resolve[RouteTitle] = config.title;
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3802
3816
|
return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
|
|
3803
3817
|
.pipe(map((resolvedData) => {
|
|
3804
3818
|
futureARS._resolvedData = resolvedData;
|
|
3805
3819
|
futureARS.data = {
|
|
3806
|
-
...
|
|
3820
|
+
...data,
|
|
3807
3821
|
...inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve
|
|
3808
3822
|
};
|
|
3809
3823
|
return null;
|
|
@@ -3816,7 +3830,7 @@ function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
|
|
|
3816
3830
|
}
|
|
3817
3831
|
const data = {};
|
|
3818
3832
|
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, moduleInjector)
|
|
3819
|
-
.pipe(tap((value) => {
|
|
3833
|
+
.pipe(take(1), tap((value) => {
|
|
3820
3834
|
data[key] = value;
|
|
3821
3835
|
}))), takeLast(1), mergeMap(() => {
|
|
3822
3836
|
// Ensure all resolvers returned values, otherwise don't emit any "next" and just complete
|
|
@@ -4149,7 +4163,7 @@ class Router {
|
|
|
4149
4163
|
*/
|
|
4150
4164
|
this.onSameUrlNavigation = 'ignore';
|
|
4151
4165
|
/**
|
|
4152
|
-
* How to merge parameters, data,
|
|
4166
|
+
* How to merge parameters, data, resolved data, and title from parent to child
|
|
4153
4167
|
* routes. One of:
|
|
4154
4168
|
*
|
|
4155
4169
|
* - `'emptyOnly'` : Inherit parent parameters, data, and resolved data
|
|
@@ -4169,6 +4183,8 @@ class Router {
|
|
|
4169
4183
|
/**
|
|
4170
4184
|
* Enables a bug fix that corrects relative link resolution in components with empty paths.
|
|
4171
4185
|
* @see `RouterModule`
|
|
4186
|
+
*
|
|
4187
|
+
* @deprecated
|
|
4172
4188
|
*/
|
|
4173
4189
|
this.relativeLinkResolution = 'corrected';
|
|
4174
4190
|
/**
|
|
@@ -4252,7 +4268,7 @@ class Router {
|
|
|
4252
4268
|
tap(t => {
|
|
4253
4269
|
this.currentNavigation = {
|
|
4254
4270
|
id: t.id,
|
|
4255
|
-
initialUrl: t.
|
|
4271
|
+
initialUrl: t.rawUrl,
|
|
4256
4272
|
extractedUrl: t.extractedUrl,
|
|
4257
4273
|
trigger: t.source,
|
|
4258
4274
|
extras: t.extras,
|
|
@@ -4821,6 +4837,7 @@ class Router {
|
|
|
4821
4837
|
this.events
|
|
4822
4838
|
.next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
|
|
4823
4839
|
this.lastSuccessfulNavigation = this.currentNavigation;
|
|
4840
|
+
this.titleStrategy?.updateTitle(this.routerState.snapshot);
|
|
4824
4841
|
t.resolve(true);
|
|
4825
4842
|
}, e => {
|
|
4826
4843
|
this.console.warn(`Unhandled Navigation Error: ${e}`);
|
|
@@ -4971,9 +4988,9 @@ class Router {
|
|
|
4971
4988
|
return { navigationId };
|
|
4972
4989
|
}
|
|
4973
4990
|
}
|
|
4974
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4975
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
4976
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4991
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
4992
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: Router });
|
|
4993
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: Router, decorators: [{
|
|
4977
4994
|
type: Injectable
|
|
4978
4995
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
4979
4996
|
function validateCommands(commands) {
|
|
@@ -5012,7 +5029,7 @@ function isBrowserTriggeredNavigation(source) {
|
|
|
5012
5029
|
* For example, `['/team', teamId, 'user', userName, {details: true}]`
|
|
5013
5030
|
* generates a link to `/team/11/user/bob;details=true`.
|
|
5014
5031
|
*
|
|
5015
|
-
* Multiple static segments can be merged into one term and combined with dynamic
|
|
5032
|
+
* Multiple static segments can be merged into one term and combined with dynamic segments.
|
|
5016
5033
|
* For example, `['/team/11/user', userName, {details: true}]`
|
|
5017
5034
|
*
|
|
5018
5035
|
* The input that you provide to the link is treated as a delta to the current URL.
|
|
@@ -5150,8 +5167,8 @@ class RouterLink {
|
|
|
5150
5167
|
return true;
|
|
5151
5168
|
}
|
|
5152
5169
|
const extras = {
|
|
5153
|
-
skipLocationChange:
|
|
5154
|
-
replaceUrl:
|
|
5170
|
+
skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
|
|
5171
|
+
replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
|
|
5155
5172
|
state: this.state,
|
|
5156
5173
|
};
|
|
5157
5174
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5168,13 +5185,13 @@ class RouterLink {
|
|
|
5168
5185
|
queryParams: this.queryParams,
|
|
5169
5186
|
fragment: this.fragment,
|
|
5170
5187
|
queryParamsHandling: this.queryParamsHandling,
|
|
5171
|
-
preserveFragment:
|
|
5188
|
+
preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
|
|
5172
5189
|
});
|
|
5173
5190
|
}
|
|
5174
5191
|
}
|
|
5175
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5176
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
5177
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5192
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5193
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.10", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
5194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterLink, decorators: [{
|
|
5178
5195
|
type: Directive,
|
|
5179
5196
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5180
5197
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
@@ -5264,8 +5281,8 @@ class RouterLinkWithHref {
|
|
|
5264
5281
|
return true;
|
|
5265
5282
|
}
|
|
5266
5283
|
const extras = {
|
|
5267
|
-
skipLocationChange:
|
|
5268
|
-
replaceUrl:
|
|
5284
|
+
skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
|
|
5285
|
+
replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
|
|
5269
5286
|
state: this.state
|
|
5270
5287
|
};
|
|
5271
5288
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5287,13 +5304,13 @@ class RouterLinkWithHref {
|
|
|
5287
5304
|
queryParams: this.queryParams,
|
|
5288
5305
|
fragment: this.fragment,
|
|
5289
5306
|
queryParamsHandling: this.queryParamsHandling,
|
|
5290
|
-
preserveFragment:
|
|
5307
|
+
preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
|
|
5291
5308
|
});
|
|
5292
5309
|
}
|
|
5293
5310
|
}
|
|
5294
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5295
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
5296
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5311
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5312
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.10", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
|
|
5313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5297
5314
|
type: Directive,
|
|
5298
5315
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5299
5316
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5327,9 +5344,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
5327
5344
|
args: ['click',
|
|
5328
5345
|
['$event.button', '$event.ctrlKey', '$event.shiftKey', '$event.altKey', '$event.metaKey']]
|
|
5329
5346
|
}] } });
|
|
5330
|
-
function attrBoolValue(s) {
|
|
5331
|
-
return s === '' || !!s;
|
|
5332
|
-
}
|
|
5333
5347
|
|
|
5334
5348
|
/**
|
|
5335
5349
|
* @license
|
|
@@ -5505,9 +5519,9 @@ class RouterLinkActive {
|
|
|
5505
5519
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5506
5520
|
}
|
|
5507
5521
|
}
|
|
5508
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5509
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
5510
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5522
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5523
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.10", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
5524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5511
5525
|
type: Directive,
|
|
5512
5526
|
args: [{
|
|
5513
5527
|
selector: '[routerLinkActive]',
|
|
@@ -5537,6 +5551,84 @@ function isActiveMatchOptions(options) {
|
|
|
5537
5551
|
return !!options.paths;
|
|
5538
5552
|
}
|
|
5539
5553
|
|
|
5554
|
+
/**
|
|
5555
|
+
* @license
|
|
5556
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5557
|
+
*
|
|
5558
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5559
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5560
|
+
*/
|
|
5561
|
+
/**
|
|
5562
|
+
* Provides a strategy for setting the page title after a router navigation.
|
|
5563
|
+
*
|
|
5564
|
+
* The built-in implementation traverses the router state snapshot and finds the deepest primary
|
|
5565
|
+
* outlet with `title` property. Given the `Routes` below, navigating to
|
|
5566
|
+
* `/base/child(popup:aux)` would result in the document title being set to "child".
|
|
5567
|
+
* ```
|
|
5568
|
+
* [
|
|
5569
|
+
* {path: 'base', title: 'base', children: [
|
|
5570
|
+
* {path: 'child', title: 'child'},
|
|
5571
|
+
* ],
|
|
5572
|
+
* {path: 'aux', outlet: 'popup', title: 'popupTitle'}
|
|
5573
|
+
* ]
|
|
5574
|
+
* ```
|
|
5575
|
+
*
|
|
5576
|
+
* This class can be used as a base class for custom title strategies. That is, you can create your
|
|
5577
|
+
* own class that extends the `TitleStrategy`. Note that in the above example, the `title`
|
|
5578
|
+
* from the named outlet is never used. However, a custom strategy might be implemented to
|
|
5579
|
+
* incorporate titles in named outlets.
|
|
5580
|
+
*
|
|
5581
|
+
* @publicApi
|
|
5582
|
+
* @see [Page title guide](guide/router#setting-the-page-title)
|
|
5583
|
+
*/
|
|
5584
|
+
class TitleStrategy {
|
|
5585
|
+
/**
|
|
5586
|
+
* @returns The `title` of the deepest primary route.
|
|
5587
|
+
*/
|
|
5588
|
+
buildTitle(snapshot) {
|
|
5589
|
+
let pageTitle;
|
|
5590
|
+
let route = snapshot.root;
|
|
5591
|
+
while (route !== undefined) {
|
|
5592
|
+
pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
|
|
5593
|
+
route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
|
|
5594
|
+
}
|
|
5595
|
+
return pageTitle;
|
|
5596
|
+
}
|
|
5597
|
+
/**
|
|
5598
|
+
* Given an `ActivatedRouteSnapshot`, returns the final value of the
|
|
5599
|
+
* `Route.title` property, which can either be a static string or a resolved value.
|
|
5600
|
+
*/
|
|
5601
|
+
getResolvedTitleForRoute(snapshot) {
|
|
5602
|
+
return snapshot.data[RouteTitle];
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5605
|
+
/**
|
|
5606
|
+
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
5607
|
+
*/
|
|
5608
|
+
class DefaultTitleStrategy extends TitleStrategy {
|
|
5609
|
+
constructor(title) {
|
|
5610
|
+
super();
|
|
5611
|
+
this.title = title;
|
|
5612
|
+
}
|
|
5613
|
+
/**
|
|
5614
|
+
* Sets the title of the browser to the given value.
|
|
5615
|
+
*
|
|
5616
|
+
* @param title The `pageTitle` from the deepest primary route.
|
|
5617
|
+
*/
|
|
5618
|
+
updateTitle(snapshot) {
|
|
5619
|
+
const title = this.buildTitle(snapshot);
|
|
5620
|
+
if (title !== undefined) {
|
|
5621
|
+
this.title.setTitle(title);
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5626
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
5627
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
5628
|
+
type: Injectable,
|
|
5629
|
+
args: [{ providedIn: 'root' }]
|
|
5630
|
+
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
5631
|
+
|
|
5540
5632
|
/**
|
|
5541
5633
|
* @license
|
|
5542
5634
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -5650,9 +5742,9 @@ class RouterPreloader {
|
|
|
5650
5742
|
});
|
|
5651
5743
|
}
|
|
5652
5744
|
}
|
|
5653
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5654
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
5655
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5745
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.Injector }, { token: PreloadingStrategy }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5746
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterPreloader });
|
|
5747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
5656
5748
|
type: Injectable
|
|
5657
5749
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.Injector }, { type: PreloadingStrategy }]; } });
|
|
5658
5750
|
|
|
@@ -5738,9 +5830,9 @@ class RouterScroller {
|
|
|
5738
5830
|
}
|
|
5739
5831
|
}
|
|
5740
5832
|
}
|
|
5741
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5742
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
5743
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5833
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5834
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterScroller });
|
|
5835
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterScroller, decorators: [{
|
|
5744
5836
|
type: Injectable
|
|
5745
5837
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
5746
5838
|
|
|
@@ -5773,8 +5865,8 @@ const ROUTER_PROVIDERS = [
|
|
|
5773
5865
|
useFactory: setupRouter,
|
|
5774
5866
|
deps: [
|
|
5775
5867
|
UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
|
|
5776
|
-
ROUTER_CONFIGURATION, [
|
|
5777
|
-
[RouteReuseStrategy, new Optional()]
|
|
5868
|
+
ROUTER_CONFIGURATION, DefaultTitleStrategy, [TitleStrategy, new Optional()],
|
|
5869
|
+
[UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
|
|
5778
5870
|
]
|
|
5779
5871
|
},
|
|
5780
5872
|
ChildrenOutletContexts,
|
|
@@ -5881,10 +5973,10 @@ class RouterModule {
|
|
|
5881
5973
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
5882
5974
|
}
|
|
5883
5975
|
}
|
|
5884
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5885
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
5886
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
5887
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5976
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5977
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
5978
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterModule });
|
|
5979
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterModule, decorators: [{
|
|
5888
5980
|
type: NgModule,
|
|
5889
5981
|
args: [{
|
|
5890
5982
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -5936,7 +6028,7 @@ function provideRoutes(routes) {
|
|
|
5936
6028
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
5937
6029
|
];
|
|
5938
6030
|
}
|
|
5939
|
-
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
|
|
6031
|
+
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, defaultTitleStrategy, titleStrategy, urlHandlingStrategy, routeReuseStrategy) {
|
|
5940
6032
|
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
5941
6033
|
if (urlHandlingStrategy) {
|
|
5942
6034
|
router.urlHandlingStrategy = urlHandlingStrategy;
|
|
@@ -5944,6 +6036,7 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
5944
6036
|
if (routeReuseStrategy) {
|
|
5945
6037
|
router.routeReuseStrategy = routeReuseStrategy;
|
|
5946
6038
|
}
|
|
6039
|
+
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
5947
6040
|
assignExtraOptionsToRouter(opts, router);
|
|
5948
6041
|
if (opts.enableTracing) {
|
|
5949
6042
|
router.events.subscribe((e) => {
|
|
@@ -6062,9 +6155,9 @@ class RouterInitializer {
|
|
|
6062
6155
|
this.destroyed = true;
|
|
6063
6156
|
}
|
|
6064
6157
|
}
|
|
6065
|
-
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
6066
|
-
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
6067
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
6158
|
+
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6159
|
+
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterInitializer });
|
|
6160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.10", ngImport: i0, type: RouterInitializer, decorators: [{
|
|
6068
6161
|
type: Injectable
|
|
6069
6162
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
6070
6163
|
function getAppInitializer(r) {
|
|
@@ -6104,7 +6197,7 @@ function provideRouterInitializer() {
|
|
|
6104
6197
|
/**
|
|
6105
6198
|
* @publicApi
|
|
6106
6199
|
*/
|
|
6107
|
-
const VERSION = new Version('
|
|
6200
|
+
const VERSION = new Version('14.0.0-next.10');
|
|
6108
6201
|
|
|
6109
6202
|
/**
|
|
6110
6203
|
* @license
|
|
@@ -6143,5 +6236,5 @@ const VERSION = new Version('13.3.0');
|
|
|
6143
6236
|
* Generated bundle index. Do not edit.
|
|
6144
6237
|
*/
|
|
6145
6238
|
|
|
6146
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
|
|
6239
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
|
|
6147
6240
|
//# sourceMappingURL=router.mjs.map
|