@angular/router 13.2.0 → 14.0.0-next.2
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 +14 -17
- 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 +18 -2
- package/esm2020/src/page_title_strategy.mjs +84 -0
- package/esm2020/src/private_export.mjs +1 -1
- package/esm2020/src/recognize.mjs +1 -1
- package/esm2020/src/router.mjs +7 -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/utils/config.mjs +1 -1
- 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/esm2020/upgrade/src/upgrade.mjs +15 -5
- package/fesm2015/router.mjs +146 -50
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +40 -16
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +16 -5
- package/fesm2015/upgrade.mjs.map +1 -1
- package/fesm2020/router.mjs +144 -50
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +40 -16
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +15 -5
- package/fesm2020/upgrade.mjs.map +1 -1
- package/package.json +4 -4
- package/router.d.ts +77 -6
- 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/fesm2015/router.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v14.0.0-next.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
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';
|
|
8
|
+
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';
|
|
9
9
|
import { from, of, BehaviorSubject, combineLatest, Observable, EmptyError, concat, defer, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, refCount, finalize, mergeAll } from 'rxjs/operators';
|
|
11
11
|
import * as i3 from '@angular/common';
|
|
12
12
|
import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
|
|
13
|
+
import * as i1 from '@angular/platform-browser';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @license
|
|
@@ -2524,9 +2525,9 @@ class RouterOutlet {
|
|
|
2524
2525
|
this.activateEvents.emit(this.activated.instance);
|
|
2525
2526
|
}
|
|
2526
2527
|
}
|
|
2527
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2528
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
2529
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2528
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2529
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.2", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2530
2531
|
type: Directive,
|
|
2531
2532
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2532
2533
|
}], ctorParameters: function () {
|
|
@@ -2582,9 +2583,9 @@ class OutletInjector {
|
|
|
2582
2583
|
*/
|
|
2583
2584
|
class ɵEmptyOutletComponent {
|
|
2584
2585
|
}
|
|
2585
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2586
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "
|
|
2587
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2586
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2587
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "14.0.0-next.2", 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"] }] });
|
|
2588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2588
2589
|
type: Component,
|
|
2589
2590
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2590
2591
|
}] });
|
|
@@ -3788,6 +3789,12 @@ function recognize(rootComponentType, config, serializer, paramsInheritanceStrat
|
|
|
3788
3789
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3789
3790
|
* found in the LICENSE file at https://angular.io/license
|
|
3790
3791
|
*/
|
|
3792
|
+
/**
|
|
3793
|
+
* A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
|
|
3794
|
+
* static string or `Route.resolve` if anything else. This allows us to reuse the existing route
|
|
3795
|
+
* data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
|
|
3796
|
+
*/
|
|
3797
|
+
const RouteTitle = Symbol('RouteTitle');
|
|
3791
3798
|
function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
3792
3799
|
return mergeMap(t => {
|
|
3793
3800
|
const { targetSnapshot, guards: { canActivateChecks } } = t;
|
|
@@ -3800,11 +3807,21 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
|
3800
3807
|
});
|
|
3801
3808
|
}
|
|
3802
3809
|
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) {
|
|
3810
|
+
const config = futureARS.routeConfig;
|
|
3803
3811
|
const resolve = futureARS._resolve;
|
|
3812
|
+
const data = Object.assign({}, futureARS.data);
|
|
3813
|
+
if ((config === null || config === void 0 ? void 0 : config.title) !== undefined) {
|
|
3814
|
+
if (typeof config.title === 'string' || config.title === null) {
|
|
3815
|
+
data[RouteTitle] = config.title;
|
|
3816
|
+
}
|
|
3817
|
+
else {
|
|
3818
|
+
resolve[RouteTitle] = config.title;
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3804
3821
|
return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
|
|
3805
3822
|
.pipe(map((resolvedData) => {
|
|
3806
3823
|
futureARS._resolvedData = resolvedData;
|
|
3807
|
-
futureARS.data = Object.assign(Object.assign({},
|
|
3824
|
+
futureARS.data = Object.assign(Object.assign({}, data), inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve);
|
|
3808
3825
|
return null;
|
|
3809
3826
|
}));
|
|
3810
3827
|
}
|
|
@@ -4141,7 +4158,7 @@ class Router {
|
|
|
4141
4158
|
*/
|
|
4142
4159
|
this.onSameUrlNavigation = 'ignore';
|
|
4143
4160
|
/**
|
|
4144
|
-
* How to merge parameters, data,
|
|
4161
|
+
* How to merge parameters, data, resolved data, and title from parent to child
|
|
4145
4162
|
* routes. One of:
|
|
4146
4163
|
*
|
|
4147
4164
|
* - `'emptyOnly'` : Inherit parent parameters, data, and resolved data
|
|
@@ -4245,7 +4262,7 @@ class Router {
|
|
|
4245
4262
|
tap(t => {
|
|
4246
4263
|
this.currentNavigation = {
|
|
4247
4264
|
id: t.id,
|
|
4248
|
-
initialUrl: t.
|
|
4265
|
+
initialUrl: t.rawUrl,
|
|
4249
4266
|
extractedUrl: t.extractedUrl,
|
|
4250
4267
|
trigger: t.source,
|
|
4251
4268
|
extras: t.extras,
|
|
@@ -4798,12 +4815,14 @@ class Router {
|
|
|
4798
4815
|
}
|
|
4799
4816
|
processNavigations() {
|
|
4800
4817
|
this.navigations.subscribe(t => {
|
|
4818
|
+
var _a;
|
|
4801
4819
|
this.navigated = true;
|
|
4802
4820
|
this.lastSuccessfulId = t.id;
|
|
4803
4821
|
this.currentPageId = t.targetPageId;
|
|
4804
4822
|
this.events
|
|
4805
4823
|
.next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
|
|
4806
4824
|
this.lastSuccessfulNavigation = this.currentNavigation;
|
|
4825
|
+
(_a = this.titleStrategy) === null || _a === void 0 ? void 0 : _a.updateTitle(this.routerState.snapshot);
|
|
4807
4826
|
t.resolve(true);
|
|
4808
4827
|
}, e => {
|
|
4809
4828
|
this.console.warn(`Unhandled Navigation Error: ${e}`);
|
|
@@ -4970,9 +4989,9 @@ class Router {
|
|
|
4970
4989
|
return { navigationId };
|
|
4971
4990
|
}
|
|
4972
4991
|
}
|
|
4973
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4974
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
4975
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4992
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
4993
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: Router });
|
|
4994
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: Router, decorators: [{
|
|
4976
4995
|
type: Injectable
|
|
4977
4996
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
4978
4997
|
function validateCommands(commands) {
|
|
@@ -5142,8 +5161,8 @@ class RouterLink {
|
|
|
5142
5161
|
return true;
|
|
5143
5162
|
}
|
|
5144
5163
|
const extras = {
|
|
5145
|
-
skipLocationChange:
|
|
5146
|
-
replaceUrl:
|
|
5164
|
+
skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
|
|
5165
|
+
replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
|
|
5147
5166
|
state: this.state,
|
|
5148
5167
|
};
|
|
5149
5168
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5160,13 +5179,13 @@ class RouterLink {
|
|
|
5160
5179
|
queryParams: this.queryParams,
|
|
5161
5180
|
fragment: this.fragment,
|
|
5162
5181
|
queryParamsHandling: this.queryParamsHandling,
|
|
5163
|
-
preserveFragment:
|
|
5182
|
+
preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
|
|
5164
5183
|
});
|
|
5165
5184
|
}
|
|
5166
5185
|
}
|
|
5167
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5168
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
5169
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5186
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5187
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.2", 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 });
|
|
5188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterLink, decorators: [{
|
|
5170
5189
|
type: Directive,
|
|
5171
5190
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5172
5191
|
}], ctorParameters: function () {
|
|
@@ -5258,8 +5277,8 @@ class RouterLinkWithHref {
|
|
|
5258
5277
|
return true;
|
|
5259
5278
|
}
|
|
5260
5279
|
const extras = {
|
|
5261
|
-
skipLocationChange:
|
|
5262
|
-
replaceUrl:
|
|
5280
|
+
skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
|
|
5281
|
+
replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
|
|
5263
5282
|
state: this.state
|
|
5264
5283
|
};
|
|
5265
5284
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5281,13 +5300,13 @@ class RouterLinkWithHref {
|
|
|
5281
5300
|
queryParams: this.queryParams,
|
|
5282
5301
|
fragment: this.fragment,
|
|
5283
5302
|
queryParamsHandling: this.queryParamsHandling,
|
|
5284
|
-
preserveFragment:
|
|
5303
|
+
preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
|
|
5285
5304
|
});
|
|
5286
5305
|
}
|
|
5287
5306
|
}
|
|
5288
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5289
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
5290
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5307
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5308
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.2", 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 });
|
|
5309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5291
5310
|
type: Directive,
|
|
5292
5311
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5293
5312
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5321,9 +5340,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
|
|
|
5321
5340
|
args: ['click',
|
|
5322
5341
|
['$event.button', '$event.ctrlKey', '$event.shiftKey', '$event.altKey', '$event.metaKey']]
|
|
5323
5342
|
}] } });
|
|
5324
|
-
function attrBoolValue(s) {
|
|
5325
|
-
return s === '' || !!s;
|
|
5326
|
-
}
|
|
5327
5343
|
|
|
5328
5344
|
/**
|
|
5329
5345
|
* @license
|
|
@@ -5501,9 +5517,9 @@ class RouterLinkActive {
|
|
|
5501
5517
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5502
5518
|
}
|
|
5503
5519
|
}
|
|
5504
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5505
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
5506
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5520
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", 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 });
|
|
5521
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.2", 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 });
|
|
5522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5507
5523
|
type: Directive,
|
|
5508
5524
|
args: [{
|
|
5509
5525
|
selector: '[routerLinkActive]',
|
|
@@ -5535,6 +5551,85 @@ function isActiveMatchOptions(options) {
|
|
|
5535
5551
|
return !!options.paths;
|
|
5536
5552
|
}
|
|
5537
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
|
+
var _a;
|
|
5590
|
+
let pageTitle;
|
|
5591
|
+
let route = snapshot.root;
|
|
5592
|
+
while (route !== undefined) {
|
|
5593
|
+
pageTitle = (_a = this.getResolvedTitleForRoute(route)) !== null && _a !== void 0 ? _a : pageTitle;
|
|
5594
|
+
route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
|
|
5595
|
+
}
|
|
5596
|
+
return pageTitle;
|
|
5597
|
+
}
|
|
5598
|
+
/**
|
|
5599
|
+
* Given an `ActivatedRouteSnapshot`, returns the final value of the
|
|
5600
|
+
* `Route.title` property, which can either be a static string or a resolved value.
|
|
5601
|
+
*/
|
|
5602
|
+
getResolvedTitleForRoute(snapshot) {
|
|
5603
|
+
return snapshot.data[RouteTitle];
|
|
5604
|
+
}
|
|
5605
|
+
}
|
|
5606
|
+
/**
|
|
5607
|
+
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
5608
|
+
*/
|
|
5609
|
+
class DefaultTitleStrategy extends TitleStrategy {
|
|
5610
|
+
constructor(title) {
|
|
5611
|
+
super();
|
|
5612
|
+
this.title = title;
|
|
5613
|
+
}
|
|
5614
|
+
/**
|
|
5615
|
+
* Sets the title of the browser to the given value.
|
|
5616
|
+
*
|
|
5617
|
+
* @param title The `pageTitle` from the deepest primary route.
|
|
5618
|
+
*/
|
|
5619
|
+
updateTitle(snapshot) {
|
|
5620
|
+
const title = this.buildTitle(snapshot);
|
|
5621
|
+
if (title !== undefined) {
|
|
5622
|
+
this.title.setTitle(title);
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5626
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5627
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
5628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
5629
|
+
type: Injectable,
|
|
5630
|
+
args: [{ providedIn: 'root' }]
|
|
5631
|
+
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
5632
|
+
|
|
5538
5633
|
/**
|
|
5539
5634
|
* @license
|
|
5540
5635
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -5648,9 +5743,9 @@ class RouterPreloader {
|
|
|
5648
5743
|
});
|
|
5649
5744
|
}
|
|
5650
5745
|
}
|
|
5651
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5652
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
5653
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5746
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.Injector }, { token: PreloadingStrategy }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5747
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterPreloader });
|
|
5748
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
5654
5749
|
type: Injectable
|
|
5655
5750
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.Injector }, { type: PreloadingStrategy }]; } });
|
|
5656
5751
|
|
|
@@ -5729,9 +5824,9 @@ class RouterScroller {
|
|
|
5729
5824
|
}
|
|
5730
5825
|
}
|
|
5731
5826
|
}
|
|
5732
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5733
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
5734
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5827
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5828
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterScroller });
|
|
5829
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterScroller, decorators: [{
|
|
5735
5830
|
type: Injectable
|
|
5736
5831
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
5737
5832
|
|
|
@@ -5764,8 +5859,8 @@ const ROUTER_PROVIDERS = [
|
|
|
5764
5859
|
useFactory: setupRouter,
|
|
5765
5860
|
deps: [
|
|
5766
5861
|
UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
|
|
5767
|
-
ROUTER_CONFIGURATION, [
|
|
5768
|
-
[RouteReuseStrategy, new Optional()]
|
|
5862
|
+
ROUTER_CONFIGURATION, DefaultTitleStrategy, [TitleStrategy, new Optional()],
|
|
5863
|
+
[UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
|
|
5769
5864
|
]
|
|
5770
5865
|
},
|
|
5771
5866
|
ChildrenOutletContexts,
|
|
@@ -5872,10 +5967,10 @@ class RouterModule {
|
|
|
5872
5967
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
5873
5968
|
}
|
|
5874
5969
|
}
|
|
5875
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5876
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
5877
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
5878
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5970
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5971
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
5972
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterModule });
|
|
5973
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterModule, decorators: [{
|
|
5879
5974
|
type: NgModule,
|
|
5880
5975
|
args: [{
|
|
5881
5976
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -5929,7 +6024,7 @@ function provideRoutes(routes) {
|
|
|
5929
6024
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
5930
6025
|
];
|
|
5931
6026
|
}
|
|
5932
|
-
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
|
|
6027
|
+
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, defaultTitleStrategy, titleStrategy, urlHandlingStrategy, routeReuseStrategy) {
|
|
5933
6028
|
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
5934
6029
|
if (urlHandlingStrategy) {
|
|
5935
6030
|
router.urlHandlingStrategy = urlHandlingStrategy;
|
|
@@ -5937,6 +6032,7 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
5937
6032
|
if (routeReuseStrategy) {
|
|
5938
6033
|
router.routeReuseStrategy = routeReuseStrategy;
|
|
5939
6034
|
}
|
|
6035
|
+
router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
|
|
5940
6036
|
assignExtraOptionsToRouter(opts, router);
|
|
5941
6037
|
if (opts.enableTracing) {
|
|
5942
6038
|
router.events.subscribe((e) => {
|
|
@@ -6056,9 +6152,9 @@ class RouterInitializer {
|
|
|
6056
6152
|
this.destroyed = true;
|
|
6057
6153
|
}
|
|
6058
6154
|
}
|
|
6059
|
-
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
6060
|
-
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
6061
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
6155
|
+
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6156
|
+
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterInitializer });
|
|
6157
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.2", ngImport: i0, type: RouterInitializer, decorators: [{
|
|
6062
6158
|
type: Injectable
|
|
6063
6159
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
6064
6160
|
function getAppInitializer(r) {
|
|
@@ -6098,7 +6194,7 @@ function provideRouterInitializer() {
|
|
|
6098
6194
|
/**
|
|
6099
6195
|
* @publicApi
|
|
6100
6196
|
*/
|
|
6101
|
-
const VERSION = new Version('
|
|
6197
|
+
const VERSION = new Version('14.0.0-next.2');
|
|
6102
6198
|
|
|
6103
6199
|
/**
|
|
6104
6200
|
* @license
|
|
@@ -6137,5 +6233,5 @@ const VERSION = new Version('13.2.0');
|
|
|
6137
6233
|
* Generated bundle index. Do not edit.
|
|
6138
6234
|
*/
|
|
6139
6235
|
|
|
6140
|
-
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 };
|
|
6236
|
+
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 };
|
|
6141
6237
|
//# sourceMappingURL=router.mjs.map
|