@angular/router 14.0.0-next.0 → 14.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/config.mjs +1 -1
- package/esm2020/src/directives/router_link.mjs +6 -6
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/index.mjs +2 -1
- package/esm2020/src/interfaces.mjs +1 -1
- package/esm2020/src/operators/resolve_data.mjs +18 -2
- package/esm2020/src/page_title_strategy.mjs +84 -0
- package/esm2020/src/router.mjs +6 -5
- package/esm2020/src/router_module.mjs +13 -11
- package/esm2020/src/router_preloader.mjs +3 -3
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +39 -15
- package/fesm2015/router.mjs +138 -39
- 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/fesm2020/router.mjs +136 -39
- 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/package.json +4 -4
- package/router.d.ts +68 -3
- package/testing/testing.d.ts +10 -2
- package/upgrade/upgrade.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -8,7 +8,7 @@ import { Location, LocationStrategy } from '@angular/common';
|
|
|
8
8
|
import { SpyLocation, MockLocationStrategy } from '@angular/common/testing';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
10
|
import { Compiler, Injector, Optional, NgModule } from '@angular/core';
|
|
11
|
-
import { Router, ɵflatten, ɵassignExtraOptionsToRouter, provideRoutes, ROUTER_CONFIGURATION, RouterModule, ɵROUTER_PROVIDERS, UrlSerializer, ChildrenOutletContexts, ROUTES, UrlHandlingStrategy, RouteReuseStrategy, PreloadingStrategy, NoPreloading } from '@angular/router';
|
|
11
|
+
import { Router, ɵflatten, ɵassignExtraOptionsToRouter, provideRoutes, ROUTER_CONFIGURATION, RouterModule, ɵROUTER_PROVIDERS, UrlSerializer, ChildrenOutletContexts, ROUTES, UrlHandlingStrategy, RouteReuseStrategy, DefaultTitleStrategy, TitleStrategy, PreloadingStrategy, NoPreloading } from '@angular/router';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -32,12 +32,19 @@ function isUrlHandlingStrategy(opts) {
|
|
|
32
32
|
// runtime.
|
|
33
33
|
return 'shouldProcessUrl' in opts;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Router setup factory function used for testing. Only used internally to keep the factory that's
|
|
37
|
+
* marked as publicApi cleaner (i.e. not having _both_ `TitleStrategy` and `DefaultTitleStrategy`).
|
|
38
|
+
*/
|
|
39
|
+
function setupTestingRouterInternal(urlSerializer, contexts, location, compiler, injector, routes, opts, urlHandlingStrategy, routeReuseStrategy, defaultTitleStrategy, titleStrategy) {
|
|
40
|
+
return setupTestingRouter(urlSerializer, contexts, location, compiler, injector, routes, opts, urlHandlingStrategy, routeReuseStrategy, titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy);
|
|
41
|
+
}
|
|
35
42
|
/**
|
|
36
43
|
* Router setup factory function used for testing.
|
|
37
44
|
*
|
|
38
45
|
* @publicApi
|
|
39
46
|
*/
|
|
40
|
-
function setupTestingRouter(urlSerializer, contexts, location, compiler, injector, routes, opts, urlHandlingStrategy, routeReuseStrategy) {
|
|
47
|
+
function setupTestingRouter(urlSerializer, contexts, location, compiler, injector, routes, opts, urlHandlingStrategy, routeReuseStrategy, titleStrategy) {
|
|
41
48
|
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, ɵflatten(routes));
|
|
42
49
|
if (opts) {
|
|
43
50
|
// Handle deprecated argument ordering.
|
|
@@ -55,6 +62,7 @@ function setupTestingRouter(urlSerializer, contexts, location, compiler, injecto
|
|
|
55
62
|
if (routeReuseStrategy) {
|
|
56
63
|
router.routeReuseStrategy = routeReuseStrategy;
|
|
57
64
|
}
|
|
65
|
+
router.titleStrategy = titleStrategy;
|
|
58
66
|
return router;
|
|
59
67
|
}
|
|
60
68
|
/**
|
|
@@ -93,26 +101,34 @@ class RouterTestingModule {
|
|
|
93
101
|
};
|
|
94
102
|
}
|
|
95
103
|
}
|
|
96
|
-
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
97
|
-
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
98
|
-
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
104
|
+
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
105
|
+
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
|
|
106
|
+
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterTestingModule, providers: [
|
|
99
107
|
ɵROUTER_PROVIDERS,
|
|
100
108
|
EXTRA_ROUTER_TESTING_PROVIDERS,
|
|
101
109
|
{ provide: Location, useClass: SpyLocation },
|
|
102
110
|
{ provide: LocationStrategy, useClass: MockLocationStrategy },
|
|
103
111
|
{
|
|
104
112
|
provide: Router,
|
|
105
|
-
useFactory:
|
|
113
|
+
useFactory: setupTestingRouterInternal,
|
|
106
114
|
deps: [
|
|
107
|
-
UrlSerializer,
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
UrlSerializer,
|
|
116
|
+
ChildrenOutletContexts,
|
|
117
|
+
Location,
|
|
118
|
+
Compiler,
|
|
119
|
+
Injector,
|
|
120
|
+
ROUTES,
|
|
121
|
+
ROUTER_CONFIGURATION,
|
|
122
|
+
[UrlHandlingStrategy, new Optional()],
|
|
123
|
+
[RouteReuseStrategy, new Optional()],
|
|
124
|
+
[DefaultTitleStrategy, new Optional()],
|
|
125
|
+
[TitleStrategy, new Optional()],
|
|
110
126
|
]
|
|
111
127
|
},
|
|
112
128
|
{ provide: PreloadingStrategy, useExisting: NoPreloading },
|
|
113
129
|
provideRoutes([]),
|
|
114
130
|
], imports: [RouterModule] });
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterTestingModule, decorators: [{
|
|
116
132
|
type: NgModule,
|
|
117
133
|
args: [{
|
|
118
134
|
exports: [RouterModule],
|
|
@@ -123,11 +139,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.0",
|
|
|
123
139
|
{ provide: LocationStrategy, useClass: MockLocationStrategy },
|
|
124
140
|
{
|
|
125
141
|
provide: Router,
|
|
126
|
-
useFactory:
|
|
142
|
+
useFactory: setupTestingRouterInternal,
|
|
127
143
|
deps: [
|
|
128
|
-
UrlSerializer,
|
|
129
|
-
|
|
130
|
-
|
|
144
|
+
UrlSerializer,
|
|
145
|
+
ChildrenOutletContexts,
|
|
146
|
+
Location,
|
|
147
|
+
Compiler,
|
|
148
|
+
Injector,
|
|
149
|
+
ROUTES,
|
|
150
|
+
ROUTER_CONFIGURATION,
|
|
151
|
+
[UrlHandlingStrategy, new Optional()],
|
|
152
|
+
[RouteReuseStrategy, new Optional()],
|
|
153
|
+
[DefaultTitleStrategy, new Optional()],
|
|
154
|
+
[TitleStrategy, new Optional()],
|
|
131
155
|
]
|
|
132
156
|
},
|
|
133
157
|
{ provide: PreloadingStrategy, useExisting: NoPreloading },
|
|
@@ -175,5 +199,5 @@ var spy_ng_module_factory_loader = {};
|
|
|
175
199
|
* Generated bundle index. Do not edit.
|
|
176
200
|
*/
|
|
177
201
|
|
|
178
|
-
export { RouterTestingModule, setupTestingRouter };
|
|
202
|
+
export { RouterTestingModule, setupTestingRouter, setupTestingRouterInternal };
|
|
179
203
|
//# sourceMappingURL=testing.mjs.map
|
package/fesm2015/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../packages/router/testing/src/extra_router_testing_providers.ts","../../../../../../packages/router/testing/src/router_testing_module.ts","../../../../../../packages/router/testing/src/spy_ng_module_factory_loader.ts","../../../../../../packages/router/testing/src/testing.ts","../../../../../../packages/router/testing/public_api.ts","../../../../../../packages/router/testing/index.ts","../../../../../../packages/router/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file exists to easily patch the SpyNgModuleFactoryLoader into g3\nexport const EXTRA_ROUTER_TESTING_PROVIDERS = [];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Location, LocationStrategy} from '@angular/common';\nimport {MockLocationStrategy, SpyLocation} from '@angular/common/testing';\nimport {Compiler, Injector, ModuleWithProviders, NgModule, Optional} from '@angular/core';\nimport {ChildrenOutletContexts, ExtraOptions, NoPreloading, PreloadingStrategy, provideRoutes, Route, Router, ROUTER_CONFIGURATION, RouteReuseStrategy, RouterModule, ROUTES, Routes, UrlHandlingStrategy, UrlSerializer, ɵassignExtraOptionsToRouter as assignExtraOptionsToRouter, ɵflatten as flatten, ɵROUTER_PROVIDERS as ROUTER_PROVIDERS} from '@angular/router';\nimport {EXTRA_ROUTER_TESTING_PROVIDERS} from './extra_router_testing_providers';\n\nfunction isUrlHandlingStrategy(opts: ExtraOptions|\n UrlHandlingStrategy): opts is UrlHandlingStrategy {\n // This property check is needed because UrlHandlingStrategy is an interface and doesn't exist at\n // runtime.\n return 'shouldProcessUrl' in opts;\n}\n\n/**\n * Router setup factory function used for testing.\n *\n * @publicApi\n */\nexport function setupTestingRouter(\n urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location,\n compiler: Compiler, injector: Injector, routes: Route[][],\n opts?: ExtraOptions|UrlHandlingStrategy, urlHandlingStrategy?: UrlHandlingStrategy,\n routeReuseStrategy?: RouteReuseStrategy) {\n const router =\n new Router(null!, urlSerializer, contexts, location, injector, compiler, flatten(routes));\n if (opts) {\n // Handle deprecated argument ordering.\n if (isUrlHandlingStrategy(opts)) {\n router.urlHandlingStrategy = opts;\n } else {\n // Handle ExtraOptions\n assignExtraOptionsToRouter(opts, router);\n }\n }\n\n if (urlHandlingStrategy) {\n router.urlHandlingStrategy = urlHandlingStrategy;\n }\n\n if (routeReuseStrategy) {\n router.routeReuseStrategy = routeReuseStrategy;\n }\n\n return router;\n}\n\n/**\n * @description\n *\n * Sets up the router to be used for testing.\n *\n * The modules sets up the router to be used for testing.\n * It provides spy implementations of `Location` and `LocationStrategy`.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * beforeEach(() => {\n * TestBed.configureTestingModule({\n * imports: [\n * RouterTestingModule.withRoutes(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n */\n@NgModule({\n exports: [RouterModule],\n providers: [\n ROUTER_PROVIDERS,\n EXTRA_ROUTER_TESTING_PROVIDERS,\n {provide: Location, useClass: SpyLocation},\n {provide: LocationStrategy, useClass: MockLocationStrategy},\n {\n provide: Router,\n useFactory: setupTestingRouter,\n deps: [\n UrlSerializer, ChildrenOutletContexts, Location, Compiler, Injector, ROUTES,\n ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()],\n [RouteReuseStrategy, new Optional()]\n ]\n },\n {provide: PreloadingStrategy, useExisting: NoPreloading},\n provideRoutes([]),\n ]\n})\nexport class RouterTestingModule {\n static withRoutes(routes: Routes, config?: ExtraOptions):\n ModuleWithProviders<RouterTestingModule> {\n return {\n ngModule: RouterTestingModule,\n providers: [\n provideRoutes(routes),\n {provide: ROUTER_CONFIGURATION, useValue: config ? config : {}},\n ]\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file exists for easily patching SpyNgModuleFactoryLoader in g3\nexport default {};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router/testing package.\n */\nexport * from './router_testing_module';\nexport * from './spy_ng_module_factory_loader';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated b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E,YAAY,EAAC;wBACxD,aAAa,CAAC,EAAE,CAAC;qBAClB;iBACF;;;AClGD;;;;;;;AAQA;AACA,mCAAe,EAAE;;ACTjB;;;;;;;;ACAA;;;;;;;AAeA;;ACfA;;;;;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../packages/router/testing/src/extra_router_testing_providers.ts","../../../../../../packages/router/testing/src/router_testing_module.ts","../../../../../../packages/router/testing/src/spy_ng_module_factory_loader.ts","../../../../../../packages/router/testing/src/testing.ts","../../../../../../packages/router/testing/public_api.ts","../../../../../../packages/router/testing/index.ts","../../../../../../packages/router/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file exists to easily patch the SpyNgModuleFactoryLoader into g3\nexport const EXTRA_ROUTER_TESTING_PROVIDERS = [];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Location, LocationStrategy} from '@angular/common';\nimport {MockLocationStrategy, SpyLocation} from '@angular/common/testing';\nimport {Compiler, Injector, ModuleWithProviders, NgModule, Optional} from '@angular/core';\nimport {ChildrenOutletContexts, DefaultTitleStrategy, ExtraOptions, NoPreloading, PreloadingStrategy, provideRoutes, Route, Router, ROUTER_CONFIGURATION, RouteReuseStrategy, RouterModule, ROUTES, Routes, TitleStrategy, UrlHandlingStrategy, UrlSerializer, ɵassignExtraOptionsToRouter as assignExtraOptionsToRouter, ɵflatten as flatten, ɵROUTER_PROVIDERS as ROUTER_PROVIDERS} from '@angular/router';\n\nimport {EXTRA_ROUTER_TESTING_PROVIDERS} from './extra_router_testing_providers';\n\nfunction isUrlHandlingStrategy(opts: ExtraOptions|\n UrlHandlingStrategy): opts is UrlHandlingStrategy {\n // This property check is needed because UrlHandlingStrategy is an interface and doesn't exist at\n // runtime.\n return 'shouldProcessUrl' in opts;\n}\n\n/**\n * Router setup factory function used for testing. Only used internally to keep the factory that's\n * marked as publicApi cleaner (i.e. not having _both_ `TitleStrategy` and `DefaultTitleStrategy`).\n */\nexport function setupTestingRouterInternal(\n urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location,\n compiler: Compiler, injector: Injector, routes: Route[][],\n opts?: ExtraOptions|UrlHandlingStrategy, urlHandlingStrategy?: UrlHandlingStrategy,\n routeReuseStrategy?: RouteReuseStrategy, defaultTitleStrategy?: DefaultTitleStrategy,\n titleStrategy?: TitleStrategy) {\n return setupTestingRouter(\n urlSerializer, contexts, location, compiler, injector, routes, opts, urlHandlingStrategy,\n routeReuseStrategy, titleStrategy ?? defaultTitleStrategy);\n}\n\n/**\n * Router setup factory function used for testing.\n *\n * @publicApi\n */\nexport function setupTestingRouter(\n urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location,\n compiler: Compiler, injector: Injector, routes: Route[][],\n opts?: ExtraOptions|UrlHandlingStrategy, urlHandlingStrategy?: UrlHandlingStrategy,\n routeReuseStrategy?: RouteReuseStrategy, titleStrategy?: TitleStrategy) {\n const router =\n new Router(null!, urlSerializer, contexts, location, injector, compiler, flatten(routes));\n if (opts) {\n // Handle deprecated argument ordering.\n if (isUrlHandlingStrategy(opts)) {\n router.urlHandlingStrategy = opts;\n } else {\n // Handle ExtraOptions\n assignExtraOptionsToRouter(opts, router);\n }\n }\n\n if (urlHandlingStrategy) {\n router.urlHandlingStrategy = urlHandlingStrategy;\n }\n\n if (routeReuseStrategy) {\n router.routeReuseStrategy = routeReuseStrategy;\n }\n\n router.titleStrategy = titleStrategy;\n\n return router;\n}\n\n/**\n * @description\n *\n * Sets up the router to be used for testing.\n *\n * The modules sets up the router to be used for testing.\n * It provides spy implementations of `Location` and `LocationStrategy`.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * beforeEach(() => {\n * TestBed.configureTestingModule({\n * imports: [\n * RouterTestingModule.withRoutes(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n */\n@NgModule({\n exports: [RouterModule],\n providers: [\n ROUTER_PROVIDERS,\n EXTRA_ROUTER_TESTING_PROVIDERS,\n {provide: Location, useClass: SpyLocation},\n {provide: LocationStrategy, useClass: MockLocationStrategy},\n {\n provide: Router,\n useFactory: setupTestingRouterInternal,\n deps: [\n UrlSerializer,\n ChildrenOutletContexts,\n Location,\n Compiler,\n Injector,\n ROUTES,\n ROUTER_CONFIGURATION,\n [UrlHandlingStrategy, new Optional()],\n [RouteReuseStrategy, new Optional()],\n [DefaultTitleStrategy, new Optional()],\n [TitleStrategy, new Optional()],\n ]\n },\n {provide: PreloadingStrategy, useExisting: NoPreloading},\n provideRoutes([]),\n ]\n})\nexport class RouterTestingModule {\n static withRoutes(routes: Routes, config?: ExtraOptions):\n ModuleWithProviders<RouterTestingModule> {\n return {\n ngModule: RouterTestingModule,\n providers: [\n provideRoutes(routes),\n {provide: ROUTER_CONFIGURATION, useValue: config ? config : {}},\n ]\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file exists for easily patching SpyNgModuleFactoryLoader in g3\nexport default {};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router/testing package.\n */\nexport * from './router_testing_module';\nexport * from './spy_ng_module_factory_loader';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["flatten","assignExtraOptionsToRouter","ROUTER_PROVIDERS"],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAQA;AACO,MAAM,8BAA8B,GAAG,EAAE;;ACThD;;;;;;;AAeA,SAAS,qBAAqB,CAAC,IACmB;;;IAGhD,OAAO,kBAAkB,IAAI,IAAI,CAAC;AACpC,CAAC;AAED;;;;SAIgB,0BAA0B,CACtC,aAA4B,EAAE,QAAgC,EAAE,QAAkB,EAClF,QAAkB,EAAE,QAAkB,EAAE,MAAiB,EACzD,IAAuC,EAAE,mBAAyC,EAClF,kBAAuC,EAAE,oBAA2C,EACpF,aAA6B;IAC/B,OAAO,kBAAkB,CACrB,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EACxF,kBAAkB,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,oBAAoB,CAAC,CAAC;AACjE,CAAC;AAED;;;;;SAKgB,kBAAkB,CAC9B,aAA4B,EAAE,QAAgC,EAAE,QAAkB,EAClF,QAAkB,EAAE,QAAkB,EAAE,MAAiB,EACzD,IAAuC,EAAE,mBAAyC,EAClF,kBAAuC,EAAE,aAA6B;IACxE,MAAM,MAAM,GACR,IAAI,MAAM,CAAC,IAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAEA,QAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9F,IAAI,IAAI,EAAE;;QAER,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAA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AE,IAAI,QAAQ,EAAE,CAAC;aAChC;SACF;QACD,EAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAC;QACxD,aAAa,CAAC,EAAE,CAAC;KAClB,YAzBS,YAAY;sGA2BX,mBAAmB;kBA5B/B,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,SAAS,EAAE;wBACTA,iBAAgB;wBAChB,8BAA8B;wBAC9B,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAC;wBAC1C,EAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,oBAAoB,EAAC;wBAC3D;4BACE,OAAO,EAAE,MAAM;4BACf,UAAU,EAAE,0BAA0B;4BACtC,IAAI,EAAE;gCACJ,aAAa;gCACb,sBAAsB;gCACtB,QAAQ;gCACR,QAAQ;gCACR,QAAQ;gCACR,MAAM;gCACN,oBAAoB;gCACpB,CAAC,mBAAmB,EAAE,IAAI,QAAQ,EAAE,CAAC;gCACrC,CAAC,kBAAkB,EAAE,IAAI,QAAQ,EAAE,CAAC;gCACpC,CAAC,oBAAoB,EAAE,IAAI,QAAQ,EAAE,CAAC;gCACtC,CAAC,aAAa,EAAE,IAAI,QAAQ,EAAE,CAAC;6BAChC;yBACF;wBACD,EAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAC;wBACxD,aAAa,CAAC,EAAE,CAAC;qBAClB;iBACF;;;AC5HD;;;;;;;AAQA;AACA,mCAAe,EAAE;;ACTjB;;;;;;;;ACAA;;;;;;;AAeA;;ACfA;;;;;;;;ACAA;;;;;;"}
|
package/fesm2015/upgrade.mjs
CHANGED
package/fesm2020/router.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -10,6 +10,7 @@ import * as i0 from '@angular/core';
|
|
|
10
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';
|
|
11
11
|
import { from, of, BehaviorSubject, combineLatest, Observable, EmptyError, concat, defer, 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
|
|
@@ -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: "14.0.0-next.
|
|
2528
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
2529
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
2528
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", 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.1", 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.1", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2530
2531
|
type: Directive,
|
|
2531
2532
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2532
2533
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
|
|
@@ -2580,9 +2581,9 @@ class OutletInjector {
|
|
|
2580
2581
|
*/
|
|
2581
2582
|
class ɵEmptyOutletComponent {
|
|
2582
2583
|
}
|
|
2583
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
2584
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
2585
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
2584
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2585
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "14.0.0-next.1", 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"] }] });
|
|
2586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2586
2587
|
type: Component,
|
|
2587
2588
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2588
2589
|
}] });
|
|
@@ -3786,6 +3787,12 @@ function recognize(rootComponentType, config, serializer, paramsInheritanceStrat
|
|
|
3786
3787
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3787
3788
|
* found in the LICENSE file at https://angular.io/license
|
|
3788
3789
|
*/
|
|
3790
|
+
/**
|
|
3791
|
+
* A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
|
|
3792
|
+
* static string or `Route.resolve` if anything else. This allows us to reuse the existing route
|
|
3793
|
+
* data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
|
|
3794
|
+
*/
|
|
3795
|
+
const RouteTitle = Symbol('RouteTitle');
|
|
3789
3796
|
function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
3790
3797
|
return mergeMap(t => {
|
|
3791
3798
|
const { targetSnapshot, guards: { canActivateChecks } } = t;
|
|
@@ -3798,12 +3805,22 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
|
3798
3805
|
});
|
|
3799
3806
|
}
|
|
3800
3807
|
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) {
|
|
3808
|
+
const config = futureARS.routeConfig;
|
|
3801
3809
|
const resolve = futureARS._resolve;
|
|
3810
|
+
const data = { ...futureARS.data };
|
|
3811
|
+
if (config?.title !== undefined) {
|
|
3812
|
+
if (typeof config.title === 'string' || config.title === null) {
|
|
3813
|
+
data[RouteTitle] = config.title;
|
|
3814
|
+
}
|
|
3815
|
+
else {
|
|
3816
|
+
resolve[RouteTitle] = config.title;
|
|
3817
|
+
}
|
|
3818
|
+
}
|
|
3802
3819
|
return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
|
|
3803
3820
|
.pipe(map((resolvedData) => {
|
|
3804
3821
|
futureARS._resolvedData = resolvedData;
|
|
3805
3822
|
futureARS.data = {
|
|
3806
|
-
...
|
|
3823
|
+
...data,
|
|
3807
3824
|
...inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve
|
|
3808
3825
|
};
|
|
3809
3826
|
return null;
|
|
@@ -4149,7 +4166,7 @@ class Router {
|
|
|
4149
4166
|
*/
|
|
4150
4167
|
this.onSameUrlNavigation = 'ignore';
|
|
4151
4168
|
/**
|
|
4152
|
-
* How to merge parameters, data,
|
|
4169
|
+
* How to merge parameters, data, resolved data, and title from parent to child
|
|
4153
4170
|
* routes. One of:
|
|
4154
4171
|
*
|
|
4155
4172
|
* - `'emptyOnly'` : Inherit parent parameters, data, and resolved data
|
|
@@ -4821,6 +4838,7 @@ class Router {
|
|
|
4821
4838
|
this.events
|
|
4822
4839
|
.next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
|
|
4823
4840
|
this.lastSuccessfulNavigation = this.currentNavigation;
|
|
4841
|
+
this.titleStrategy?.updateTitle(this.routerState.snapshot);
|
|
4824
4842
|
t.resolve(true);
|
|
4825
4843
|
}, e => {
|
|
4826
4844
|
this.console.warn(`Unhandled Navigation Error: ${e}`);
|
|
@@ -4985,9 +5003,9 @@ class Router {
|
|
|
4985
5003
|
return { navigationId };
|
|
4986
5004
|
}
|
|
4987
5005
|
}
|
|
4988
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
4989
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
4990
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5006
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5007
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: Router });
|
|
5008
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: Router, decorators: [{
|
|
4991
5009
|
type: Injectable
|
|
4992
5010
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
4993
5011
|
function validateCommands(commands) {
|
|
@@ -5186,9 +5204,9 @@ class RouterLink {
|
|
|
5186
5204
|
});
|
|
5187
5205
|
}
|
|
5188
5206
|
}
|
|
5189
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5190
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5191
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5207
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5208
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.1", 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 });
|
|
5209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterLink, decorators: [{
|
|
5192
5210
|
type: Directive,
|
|
5193
5211
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5194
5212
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
@@ -5305,9 +5323,9 @@ class RouterLinkWithHref {
|
|
|
5305
5323
|
});
|
|
5306
5324
|
}
|
|
5307
5325
|
}
|
|
5308
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5309
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5310
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5326
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5327
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.1", 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 });
|
|
5328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5311
5329
|
type: Directive,
|
|
5312
5330
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5313
5331
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5519,9 +5537,9 @@ class RouterLinkActive {
|
|
|
5519
5537
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5520
5538
|
}
|
|
5521
5539
|
}
|
|
5522
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5523
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5524
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5540
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", 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 });
|
|
5541
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "14.0.0-next.1", 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 });
|
|
5542
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5525
5543
|
type: Directive,
|
|
5526
5544
|
args: [{
|
|
5527
5545
|
selector: '[routerLinkActive]',
|
|
@@ -5551,6 +5569,84 @@ function isActiveMatchOptions(options) {
|
|
|
5551
5569
|
return !!options.paths;
|
|
5552
5570
|
}
|
|
5553
5571
|
|
|
5572
|
+
/**
|
|
5573
|
+
* @license
|
|
5574
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5575
|
+
*
|
|
5576
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5577
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5578
|
+
*/
|
|
5579
|
+
/**
|
|
5580
|
+
* Provides a strategy for setting the page title after a router navigation.
|
|
5581
|
+
*
|
|
5582
|
+
* The built-in implementation traverses the router state snapshot and finds the deepest primary
|
|
5583
|
+
* outlet with `title` property. Given the `Routes` below, navigating to
|
|
5584
|
+
* `/base/child(popup:aux)` would result in the document title being set to "child".
|
|
5585
|
+
* ```
|
|
5586
|
+
* [
|
|
5587
|
+
* {path: 'base', title: 'base', children: [
|
|
5588
|
+
* {path: 'child', title: 'child'},
|
|
5589
|
+
* ],
|
|
5590
|
+
* {path: 'aux', outlet: 'popup', title: 'popupTitle'}
|
|
5591
|
+
* ]
|
|
5592
|
+
* ```
|
|
5593
|
+
*
|
|
5594
|
+
* This class can be used as a base class for custom title strategies. That is, you can create your
|
|
5595
|
+
* own class that extends the `TitleStrategy`. Note that in the above example, the `title`
|
|
5596
|
+
* from the named outlet is never used. However, a custom strategy might be implemented to
|
|
5597
|
+
* incorporate titles in named outlets.
|
|
5598
|
+
*
|
|
5599
|
+
* @publicApi
|
|
5600
|
+
* @see [Page title guide](guide/router#setting-the-page-title)
|
|
5601
|
+
*/
|
|
5602
|
+
class TitleStrategy {
|
|
5603
|
+
/**
|
|
5604
|
+
* @returns The `title` of the deepest primary route.
|
|
5605
|
+
*/
|
|
5606
|
+
buildTitle(snapshot) {
|
|
5607
|
+
let pageTitle;
|
|
5608
|
+
let route = snapshot.root;
|
|
5609
|
+
while (route !== undefined) {
|
|
5610
|
+
pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
|
|
5611
|
+
route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
|
|
5612
|
+
}
|
|
5613
|
+
return pageTitle;
|
|
5614
|
+
}
|
|
5615
|
+
/**
|
|
5616
|
+
* Given an `ActivatedRouteSnapshot`, returns the final value of the
|
|
5617
|
+
* `Route.title` property, which can either be a static string or a resolved value.
|
|
5618
|
+
*/
|
|
5619
|
+
getResolvedTitleForRoute(snapshot) {
|
|
5620
|
+
return snapshot.data[RouteTitle];
|
|
5621
|
+
}
|
|
5622
|
+
}
|
|
5623
|
+
/**
|
|
5624
|
+
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
5625
|
+
*/
|
|
5626
|
+
class DefaultTitleStrategy extends TitleStrategy {
|
|
5627
|
+
constructor(title) {
|
|
5628
|
+
super();
|
|
5629
|
+
this.title = title;
|
|
5630
|
+
}
|
|
5631
|
+
/**
|
|
5632
|
+
* Sets the title of the browser to the given value.
|
|
5633
|
+
*
|
|
5634
|
+
* @param title The `pageTitle` from the deepest primary route.
|
|
5635
|
+
*/
|
|
5636
|
+
updateTitle(snapshot) {
|
|
5637
|
+
const title = this.buildTitle(snapshot);
|
|
5638
|
+
if (title !== undefined) {
|
|
5639
|
+
this.title.setTitle(title);
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5644
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
5645
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
5646
|
+
type: Injectable,
|
|
5647
|
+
args: [{ providedIn: 'root' }]
|
|
5648
|
+
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
5649
|
+
|
|
5554
5650
|
/**
|
|
5555
5651
|
* @license
|
|
5556
5652
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -5664,9 +5760,9 @@ class RouterPreloader {
|
|
|
5664
5760
|
});
|
|
5665
5761
|
}
|
|
5666
5762
|
}
|
|
5667
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5668
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5669
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5763
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.Injector }, { token: PreloadingStrategy }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5764
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterPreloader });
|
|
5765
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
5670
5766
|
type: Injectable
|
|
5671
5767
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.Injector }, { type: PreloadingStrategy }]; } });
|
|
5672
5768
|
|
|
@@ -5752,9 +5848,9 @@ class RouterScroller {
|
|
|
5752
5848
|
}
|
|
5753
5849
|
}
|
|
5754
5850
|
}
|
|
5755
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5756
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5757
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5851
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5852
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterScroller });
|
|
5853
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterScroller, decorators: [{
|
|
5758
5854
|
type: Injectable
|
|
5759
5855
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
5760
5856
|
|
|
@@ -5787,8 +5883,8 @@ const ROUTER_PROVIDERS = [
|
|
|
5787
5883
|
useFactory: setupRouter,
|
|
5788
5884
|
deps: [
|
|
5789
5885
|
UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
|
|
5790
|
-
ROUTER_CONFIGURATION, [
|
|
5791
|
-
[RouteReuseStrategy, new Optional()]
|
|
5886
|
+
ROUTER_CONFIGURATION, DefaultTitleStrategy, [TitleStrategy, new Optional()],
|
|
5887
|
+
[UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
|
|
5792
5888
|
]
|
|
5793
5889
|
},
|
|
5794
5890
|
ChildrenOutletContexts,
|
|
@@ -5895,10 +5991,10 @@ class RouterModule {
|
|
|
5895
5991
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
5896
5992
|
}
|
|
5897
5993
|
}
|
|
5898
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5899
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5900
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5901
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
5994
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5995
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
5996
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterModule });
|
|
5997
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterModule, decorators: [{
|
|
5902
5998
|
type: NgModule,
|
|
5903
5999
|
args: [{
|
|
5904
6000
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -5950,7 +6046,7 @@ function provideRoutes(routes) {
|
|
|
5950
6046
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
5951
6047
|
];
|
|
5952
6048
|
}
|
|
5953
|
-
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
|
|
6049
|
+
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, defaultTitleStrategy, titleStrategy, urlHandlingStrategy, routeReuseStrategy) {
|
|
5954
6050
|
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
5955
6051
|
if (urlHandlingStrategy) {
|
|
5956
6052
|
router.urlHandlingStrategy = urlHandlingStrategy;
|
|
@@ -5958,6 +6054,7 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
5958
6054
|
if (routeReuseStrategy) {
|
|
5959
6055
|
router.routeReuseStrategy = routeReuseStrategy;
|
|
5960
6056
|
}
|
|
6057
|
+
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
5961
6058
|
assignExtraOptionsToRouter(opts, router);
|
|
5962
6059
|
if (opts.enableTracing) {
|
|
5963
6060
|
router.events.subscribe((e) => {
|
|
@@ -6076,9 +6173,9 @@ class RouterInitializer {
|
|
|
6076
6173
|
this.destroyed = true;
|
|
6077
6174
|
}
|
|
6078
6175
|
}
|
|
6079
|
-
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
6080
|
-
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
6081
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
6176
|
+
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6177
|
+
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterInitializer });
|
|
6178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.1", ngImport: i0, type: RouterInitializer, decorators: [{
|
|
6082
6179
|
type: Injectable
|
|
6083
6180
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
6084
6181
|
function getAppInitializer(r) {
|
|
@@ -6118,7 +6215,7 @@ function provideRouterInitializer() {
|
|
|
6118
6215
|
/**
|
|
6119
6216
|
* @publicApi
|
|
6120
6217
|
*/
|
|
6121
|
-
const VERSION = new Version('14.0.0-next.
|
|
6218
|
+
const VERSION = new Version('14.0.0-next.1');
|
|
6122
6219
|
|
|
6123
6220
|
/**
|
|
6124
6221
|
* @license
|
|
@@ -6157,5 +6254,5 @@ const VERSION = new Version('14.0.0-next.0');
|
|
|
6157
6254
|
* Generated bundle index. Do not edit.
|
|
6158
6255
|
*/
|
|
6159
6256
|
|
|
6160
|
-
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 };
|
|
6257
|
+
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 };
|
|
6161
6258
|
//# sourceMappingURL=router.mjs.map
|