@angular/router 15.1.0-next.0 → 15.1.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/components/empty_outlet.mjs +3 -3
- package/esm2020/src/deprecated_load_children.mjs +3 -1
- package/esm2020/src/directives/router_link.mjs +3 -3
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/index.mjs +1 -1
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/navigation_transition.mjs +145 -84
- package/esm2020/src/page_title_strategy.mjs +6 -6
- package/esm2020/src/private_export.mjs +1 -2
- package/esm2020/src/provide_router.mjs +6 -7
- package/esm2020/src/route_reuse_strategy.mjs +6 -6
- package/esm2020/src/router.mjs +58 -165
- package/esm2020/src/router_config.mjs +1 -1
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +11 -9
- package/esm2020/src/router_outlet_context.mjs +3 -3
- package/esm2020/src/router_preloader.mjs +9 -9
- package/esm2020/src/router_scroller.mjs +20 -21
- package/esm2020/src/router_state.mjs +7 -7
- package/esm2020/src/url_handling_strategy.mjs +6 -6
- package/esm2020/src/url_tree.mjs +4 -4
- package/esm2020/src/utils/config.mjs +2 -2
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +56 -17
- package/fesm2015/router.mjs +428 -471
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +56 -17
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +419 -467
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +56 -17
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +76 -58
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2020/router.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.1.0-next.
|
|
2
|
+
* @license Angular v15.1.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, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, isStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
|
|
9
9
|
import { from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import * as i3 from '@angular/common';
|
|
11
11
|
import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
|
|
@@ -461,9 +461,9 @@ function mapChildrenIntoArray(segment, fn) {
|
|
|
461
461
|
*/
|
|
462
462
|
class UrlSerializer {
|
|
463
463
|
}
|
|
464
|
-
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
465
|
-
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
466
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
464
|
+
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
465
|
+
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
|
|
466
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: UrlSerializer, decorators: [{
|
|
467
467
|
type: Injectable,
|
|
468
468
|
args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
|
|
469
469
|
}] });
|
|
@@ -2078,6 +2078,12 @@ function flattenInherited(pathFromRoot) {
|
|
|
2078
2078
|
* @publicApi
|
|
2079
2079
|
*/
|
|
2080
2080
|
class ActivatedRouteSnapshot {
|
|
2081
|
+
/** The resolved route title */
|
|
2082
|
+
get title() {
|
|
2083
|
+
// Note: This _must_ be a getter because the data is mutated in the resolvers. Title will not be
|
|
2084
|
+
// available at the time of class instantiation.
|
|
2085
|
+
return this.data?.[RouteTitleKey];
|
|
2086
|
+
}
|
|
2081
2087
|
/** @internal */
|
|
2082
2088
|
constructor(
|
|
2083
2089
|
/** The URL segments matched by this route */
|
|
@@ -2124,12 +2130,6 @@ class ActivatedRouteSnapshot {
|
|
|
2124
2130
|
this._lastPathIndex = lastPathIndex;
|
|
2125
2131
|
this._resolve = resolve;
|
|
2126
2132
|
}
|
|
2127
|
-
/** The resolved route title */
|
|
2128
|
-
get title() {
|
|
2129
|
-
// Note: This _must_ be a getter because the data is mutated in the resolvers. Title will not be
|
|
2130
|
-
// available at the time of class instantiation.
|
|
2131
|
-
return this.data?.[RouteTitleKey];
|
|
2132
|
-
}
|
|
2133
2133
|
/** The root of the router state */
|
|
2134
2134
|
get root() {
|
|
2135
2135
|
return this._routerState.root;
|
|
@@ -2413,9 +2413,9 @@ class ChildrenOutletContexts {
|
|
|
2413
2413
|
return this.contexts.get(childName) || null;
|
|
2414
2414
|
}
|
|
2415
2415
|
}
|
|
2416
|
-
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
2417
|
-
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
2418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
2416
|
+
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2417
|
+
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
|
|
2418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
2419
2419
|
type: Injectable,
|
|
2420
2420
|
args: [{ providedIn: 'root' }]
|
|
2421
2421
|
}] });
|
|
@@ -2635,9 +2635,9 @@ class RouterOutlet {
|
|
|
2635
2635
|
this.activateEvents.emit(this.activated.instance);
|
|
2636
2636
|
}
|
|
2637
2637
|
}
|
|
2638
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
2639
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.
|
|
2640
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
2638
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2639
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.2", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
|
|
2640
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2641
2641
|
type: Directive,
|
|
2642
2642
|
args: [{
|
|
2643
2643
|
selector: 'router-outlet',
|
|
@@ -2697,9 +2697,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2697
2697
|
*/
|
|
2698
2698
|
class ɵEmptyOutletComponent {
|
|
2699
2699
|
}
|
|
2700
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
2701
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.0-next.
|
|
2702
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
2700
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2701
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.0-next.2", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2702
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2703
2703
|
type: Component,
|
|
2704
2704
|
args: [{
|
|
2705
2705
|
template: `<router-outlet></router-outlet>`,
|
|
@@ -2751,7 +2751,7 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
|
|
|
2751
2751
|
}
|
|
2752
2752
|
}
|
|
2753
2753
|
function assertStandalone(fullPath, component) {
|
|
2754
|
-
if (component &&
|
|
2754
|
+
if (component && !isStandalone(component)) {
|
|
2755
2755
|
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
|
|
2756
2756
|
}
|
|
2757
2757
|
}
|
|
@@ -4318,6 +4318,19 @@ function switchTap(next) {
|
|
|
4318
4318
|
});
|
|
4319
4319
|
}
|
|
4320
4320
|
|
|
4321
|
+
/**
|
|
4322
|
+
* @license
|
|
4323
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4324
|
+
*
|
|
4325
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4326
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4327
|
+
*/
|
|
4328
|
+
// This file exists to support the legacy `loadChildren: string` behavior being patched back into
|
|
4329
|
+
// Angular.
|
|
4330
|
+
function deprecatedLoadChildrenString(injector, loadChildren) {
|
|
4331
|
+
return null;
|
|
4332
|
+
}
|
|
4333
|
+
|
|
4321
4334
|
/**
|
|
4322
4335
|
* @license
|
|
4323
4336
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4326,16 +4339,185 @@ function switchTap(next) {
|
|
|
4326
4339
|
* found in the LICENSE file at https://angular.io/license
|
|
4327
4340
|
*/
|
|
4328
4341
|
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4342
|
+
/**
|
|
4343
|
+
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4344
|
+
*
|
|
4345
|
+
* `ROUTES` is a low level API for router configuration via dependency injection.
|
|
4346
|
+
*
|
|
4347
|
+
* We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
|
|
4348
|
+
* `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
|
|
4349
|
+
*
|
|
4350
|
+
* @publicApi
|
|
4351
|
+
*/
|
|
4352
|
+
const ROUTES = new InjectionToken('ROUTES');
|
|
4353
|
+
class RouterConfigLoader {
|
|
4354
|
+
constructor(injector, compiler) {
|
|
4355
|
+
this.injector = injector;
|
|
4356
|
+
this.compiler = compiler;
|
|
4357
|
+
this.componentLoaders = new WeakMap();
|
|
4358
|
+
this.childrenLoaders = new WeakMap();
|
|
4359
|
+
}
|
|
4360
|
+
loadComponent(route) {
|
|
4361
|
+
if (this.componentLoaders.get(route)) {
|
|
4362
|
+
return this.componentLoaders.get(route);
|
|
4363
|
+
}
|
|
4364
|
+
else if (route._loadedComponent) {
|
|
4365
|
+
return of(route._loadedComponent);
|
|
4366
|
+
}
|
|
4367
|
+
if (this.onLoadStartListener) {
|
|
4368
|
+
this.onLoadStartListener(route);
|
|
4369
|
+
}
|
|
4370
|
+
const loadRunner = wrapIntoObservable(route.loadComponent())
|
|
4371
|
+
.pipe(map(maybeUnwrapDefaultExport), tap(component => {
|
|
4372
|
+
if (this.onLoadEndListener) {
|
|
4373
|
+
this.onLoadEndListener(route);
|
|
4374
|
+
}
|
|
4375
|
+
NG_DEV_MODE$5 && assertStandalone(route.path ?? '', component);
|
|
4376
|
+
route._loadedComponent = component;
|
|
4377
|
+
}), finalize(() => {
|
|
4378
|
+
this.componentLoaders.delete(route);
|
|
4379
|
+
}));
|
|
4380
|
+
// Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
|
|
4381
|
+
const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
|
|
4382
|
+
this.componentLoaders.set(route, loader);
|
|
4383
|
+
return loader;
|
|
4384
|
+
}
|
|
4385
|
+
loadChildren(parentInjector, route) {
|
|
4386
|
+
if (this.childrenLoaders.get(route)) {
|
|
4387
|
+
return this.childrenLoaders.get(route);
|
|
4388
|
+
}
|
|
4389
|
+
else if (route._loadedRoutes) {
|
|
4390
|
+
return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
|
|
4391
|
+
}
|
|
4392
|
+
if (this.onLoadStartListener) {
|
|
4393
|
+
this.onLoadStartListener(route);
|
|
4394
|
+
}
|
|
4395
|
+
const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
|
|
4396
|
+
const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
|
|
4397
|
+
if (this.onLoadEndListener) {
|
|
4398
|
+
this.onLoadEndListener(route);
|
|
4399
|
+
}
|
|
4400
|
+
// This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
|
|
4401
|
+
// injector associated with lazy loading a `Route` array.
|
|
4402
|
+
let injector;
|
|
4403
|
+
let rawRoutes;
|
|
4404
|
+
let requireStandaloneComponents = false;
|
|
4405
|
+
if (Array.isArray(factoryOrRoutes)) {
|
|
4406
|
+
rawRoutes = factoryOrRoutes;
|
|
4407
|
+
requireStandaloneComponents = true;
|
|
4408
|
+
}
|
|
4409
|
+
else {
|
|
4410
|
+
injector = factoryOrRoutes.create(parentInjector).injector;
|
|
4411
|
+
// When loading a module that doesn't provide `RouterModule.forChild()` preloader
|
|
4412
|
+
// will get stuck in an infinite loop. The child module's Injector will look to
|
|
4413
|
+
// its parent `Injector` when it doesn't find any ROUTES so it will return routes
|
|
4414
|
+
// for it's parent module instead.
|
|
4415
|
+
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4416
|
+
}
|
|
4417
|
+
const routes = rawRoutes.map(standardizeConfig);
|
|
4418
|
+
NG_DEV_MODE$5 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4419
|
+
return { routes, injector };
|
|
4420
|
+
}), finalize(() => {
|
|
4421
|
+
this.childrenLoaders.delete(route);
|
|
4422
|
+
}));
|
|
4423
|
+
// Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
|
|
4424
|
+
const loader = new ConnectableObservable(loadRunner, () => new Subject())
|
|
4425
|
+
.pipe(refCount());
|
|
4426
|
+
this.childrenLoaders.set(route, loader);
|
|
4427
|
+
return loader;
|
|
4428
|
+
}
|
|
4429
|
+
loadModuleFactoryOrRoutes(loadChildren) {
|
|
4430
|
+
const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
|
|
4431
|
+
if (deprecatedResult) {
|
|
4432
|
+
return deprecatedResult;
|
|
4433
|
+
}
|
|
4434
|
+
return wrapIntoObservable(loadChildren())
|
|
4435
|
+
.pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
|
|
4436
|
+
if (t instanceof NgModuleFactory || Array.isArray(t)) {
|
|
4437
|
+
return of(t);
|
|
4438
|
+
}
|
|
4439
|
+
else {
|
|
4440
|
+
return from(this.compiler.compileModuleAsync(t));
|
|
4441
|
+
}
|
|
4442
|
+
}));
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4446
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4447
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4448
|
+
type: Injectable,
|
|
4449
|
+
args: [{ providedIn: 'root' }]
|
|
4450
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4451
|
+
function isWrappedDefaultExport(value) {
|
|
4452
|
+
// We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
|
|
4453
|
+
// dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
|
|
4454
|
+
// `default` will be a renamed property.
|
|
4455
|
+
return value && typeof value === 'object' && 'default' in value;
|
|
4456
|
+
}
|
|
4457
|
+
function maybeUnwrapDefaultExport(input) {
|
|
4458
|
+
// As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
|
|
4459
|
+
// subject to property renaming, so we reference it with bracket access.
|
|
4460
|
+
return isWrappedDefaultExport(input) ? input['default'] : input;
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4463
|
+
/**
|
|
4464
|
+
* @license
|
|
4465
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4466
|
+
*
|
|
4467
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4468
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4469
|
+
*/
|
|
4470
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4329
4471
|
class NavigationTransitions {
|
|
4330
|
-
|
|
4331
|
-
this.
|
|
4472
|
+
get hasRequestedNavigation() {
|
|
4473
|
+
return this.navigationId !== 0;
|
|
4474
|
+
}
|
|
4475
|
+
constructor() {
|
|
4332
4476
|
this.currentNavigation = null;
|
|
4477
|
+
this.lastSuccessfulNavigation = null;
|
|
4478
|
+
this.events = new Subject();
|
|
4479
|
+
this.configLoader = inject(RouterConfigLoader);
|
|
4480
|
+
this.environmentInjector = inject(EnvironmentInjector);
|
|
4481
|
+
this.urlSerializer = inject(UrlSerializer);
|
|
4482
|
+
this.rootContexts = inject(ChildrenOutletContexts);
|
|
4483
|
+
this.navigationId = 0;
|
|
4484
|
+
const onLoadStart = (r) => this.events.next(new RouteConfigLoadStart(r));
|
|
4485
|
+
const onLoadEnd = (r) => this.events.next(new RouteConfigLoadEnd(r));
|
|
4486
|
+
this.configLoader.onLoadEndListener = onLoadEnd;
|
|
4487
|
+
this.configLoader.onLoadStartListener = onLoadStart;
|
|
4488
|
+
}
|
|
4489
|
+
complete() {
|
|
4490
|
+
this.transitions?.complete();
|
|
4491
|
+
}
|
|
4492
|
+
handleNavigationRequest(request) {
|
|
4493
|
+
const id = ++this.navigationId;
|
|
4494
|
+
this.transitions?.next({ ...this.transitions.value, ...request, id });
|
|
4333
4495
|
}
|
|
4334
|
-
setupNavigations(
|
|
4335
|
-
|
|
4336
|
-
|
|
4496
|
+
setupNavigations(router) {
|
|
4497
|
+
this.transitions = new BehaviorSubject({
|
|
4498
|
+
id: 0,
|
|
4499
|
+
targetPageId: 0,
|
|
4500
|
+
currentUrlTree: router.currentUrlTree,
|
|
4501
|
+
currentRawUrl: router.currentUrlTree,
|
|
4502
|
+
extractedUrl: router.urlHandlingStrategy.extract(router.currentUrlTree),
|
|
4503
|
+
urlAfterRedirects: router.urlHandlingStrategy.extract(router.currentUrlTree),
|
|
4504
|
+
rawUrl: router.currentUrlTree,
|
|
4505
|
+
extras: {},
|
|
4506
|
+
resolve: null,
|
|
4507
|
+
reject: null,
|
|
4508
|
+
promise: Promise.resolve(true),
|
|
4509
|
+
source: 'imperative',
|
|
4510
|
+
restoredState: null,
|
|
4511
|
+
currentSnapshot: router.routerState.snapshot,
|
|
4512
|
+
targetSnapshot: null,
|
|
4513
|
+
currentRouterState: router.routerState,
|
|
4514
|
+
targetRouterState: null,
|
|
4515
|
+
guards: { canActivateChecks: [], canDeactivateChecks: [] },
|
|
4516
|
+
guardsResult: null,
|
|
4517
|
+
});
|
|
4518
|
+
return this.transitions.pipe(filter(t => t.id !== 0),
|
|
4337
4519
|
// Extract URL
|
|
4338
|
-
map(t => ({ ...t, extractedUrl:
|
|
4520
|
+
map(t => ({ ...t, extractedUrl: router.urlHandlingStrategy.extract(t.rawUrl) })),
|
|
4339
4521
|
// Using switchMap so we cancel executing navigations when a new one comes in
|
|
4340
4522
|
switchMap(overallTransitionState => {
|
|
4341
4523
|
let completed = false;
|
|
@@ -4350,41 +4532,42 @@ class NavigationTransitions {
|
|
|
4350
4532
|
extractedUrl: t.extractedUrl,
|
|
4351
4533
|
trigger: t.source,
|
|
4352
4534
|
extras: t.extras,
|
|
4353
|
-
previousNavigation: !this.
|
|
4354
|
-
...this.
|
|
4535
|
+
previousNavigation: !this.lastSuccessfulNavigation ? null : {
|
|
4536
|
+
...this.lastSuccessfulNavigation,
|
|
4355
4537
|
previousNavigation: null,
|
|
4356
4538
|
},
|
|
4357
4539
|
};
|
|
4358
4540
|
}), switchMap(t => {
|
|
4359
|
-
const browserUrlTree =
|
|
4360
|
-
const urlTransition = !
|
|
4541
|
+
const browserUrlTree = router.browserUrlTree.toString();
|
|
4542
|
+
const urlTransition = !router.navigated ||
|
|
4361
4543
|
t.extractedUrl.toString() !== browserUrlTree ||
|
|
4362
4544
|
// Navigations which succeed or ones which fail and are cleaned up
|
|
4363
4545
|
// correctly should result in `browserUrlTree` and `currentUrlTree`
|
|
4364
4546
|
// matching. If this is not the case, assume something went wrong and
|
|
4365
4547
|
// try processing the URL again.
|
|
4366
|
-
browserUrlTree !==
|
|
4367
|
-
|
|
4368
|
-
|
|
4548
|
+
browserUrlTree !== router.currentUrlTree.toString();
|
|
4549
|
+
const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;
|
|
4550
|
+
if (!urlTransition && onSameUrlNavigation !== 'reload') {
|
|
4551
|
+
const reason = NG_DEV_MODE$4 ?
|
|
4369
4552
|
`Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` :
|
|
4370
4553
|
'';
|
|
4371
|
-
this.
|
|
4372
|
-
|
|
4554
|
+
this.events.next(new NavigationSkipped(t.id, router.serializeUrl(overallTransitionState.rawUrl), reason, 0 /* NavigationSkippedCode.IgnoredSameUrlNavigation */));
|
|
4555
|
+
router.rawUrlTree = t.rawUrl;
|
|
4373
4556
|
t.resolve(null);
|
|
4374
4557
|
return EMPTY;
|
|
4375
4558
|
}
|
|
4376
|
-
if (
|
|
4559
|
+
if (router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {
|
|
4377
4560
|
// If the source of the navigation is from a browser event, the URL is
|
|
4378
4561
|
// already updated. We already need to sync the internal state.
|
|
4379
4562
|
if (isBrowserTriggeredNavigation(t.source)) {
|
|
4380
|
-
|
|
4563
|
+
router.browserUrlTree = t.extractedUrl;
|
|
4381
4564
|
}
|
|
4382
4565
|
return of(t).pipe(
|
|
4383
4566
|
// Fire NavigationStart event
|
|
4384
4567
|
switchMap(t => {
|
|
4385
|
-
const transition = this.
|
|
4386
|
-
|
|
4387
|
-
if (transition !== this.
|
|
4568
|
+
const transition = this.transitions?.getValue();
|
|
4569
|
+
this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));
|
|
4570
|
+
if (transition !== this.transitions?.getValue()) {
|
|
4388
4571
|
return EMPTY;
|
|
4389
4572
|
}
|
|
4390
4573
|
// This delay is required to match old behavior that forced
|
|
@@ -4392,7 +4575,7 @@ class NavigationTransitions {
|
|
|
4392
4575
|
return Promise.resolve(t);
|
|
4393
4576
|
}),
|
|
4394
4577
|
// ApplyRedirects
|
|
4395
|
-
applyRedirects(this.
|
|
4578
|
+
applyRedirects(this.environmentInjector, this.configLoader, this.urlSerializer, router.config),
|
|
4396
4579
|
// Update the currentNavigation
|
|
4397
4580
|
// `urlAfterRedirects` is guaranteed to be set after this point
|
|
4398
4581
|
tap(t => {
|
|
@@ -4403,32 +4586,31 @@ class NavigationTransitions {
|
|
|
4403
4586
|
overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
|
|
4404
4587
|
}),
|
|
4405
4588
|
// Recognize
|
|
4406
|
-
recognize(this.
|
|
4589
|
+
recognize(this.environmentInjector, router.rootComponentType, router.config, this.urlSerializer, router.paramsInheritanceStrategy),
|
|
4407
4590
|
// Update URL if in `eager` update mode
|
|
4408
4591
|
tap(t => {
|
|
4409
4592
|
overallTransitionState.targetSnapshot = t.targetSnapshot;
|
|
4410
|
-
if (
|
|
4593
|
+
if (router.urlUpdateStrategy === 'eager') {
|
|
4411
4594
|
if (!t.extras.skipLocationChange) {
|
|
4412
|
-
const rawUrl =
|
|
4413
|
-
|
|
4595
|
+
const rawUrl = router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
|
|
4596
|
+
router.setBrowserUrl(rawUrl, t);
|
|
4414
4597
|
}
|
|
4415
|
-
|
|
4598
|
+
router.browserUrlTree = t.urlAfterRedirects;
|
|
4416
4599
|
}
|
|
4417
4600
|
// Fire RoutesRecognized
|
|
4418
|
-
const routesRecognized = new RoutesRecognized(t.id, this.
|
|
4419
|
-
|
|
4601
|
+
const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4602
|
+
this.events.next(routesRecognized);
|
|
4420
4603
|
}));
|
|
4421
4604
|
}
|
|
4422
4605
|
else if (urlTransition &&
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4606
|
+
router.urlHandlingStrategy.shouldProcessUrl(router.rawUrlTree)) {
|
|
4607
|
+
/* When the current URL shouldn't be processed, but the previous one
|
|
4608
|
+
* was, we handle this "error condition" by navigating to the
|
|
4609
|
+
* previously successful URL, but leaving the URL intact.*/
|
|
4427
4610
|
const { id, extractedUrl, source, restoredState, extras } = t;
|
|
4428
|
-
const navStart = new NavigationStart(id, this.
|
|
4429
|
-
|
|
4430
|
-
const targetSnapshot = createEmptyState(extractedUrl,
|
|
4431
|
-
.snapshot;
|
|
4611
|
+
const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
|
|
4612
|
+
this.events.next(navStart);
|
|
4613
|
+
const targetSnapshot = createEmptyState(extractedUrl, router.rootComponentType).snapshot;
|
|
4432
4614
|
overallTransitionState = {
|
|
4433
4615
|
...t,
|
|
4434
4616
|
targetSnapshot,
|
|
@@ -4443,37 +4625,37 @@ class NavigationTransitions {
|
|
|
4443
4625
|
* current "settled" URL. This way the next navigation will be coming
|
|
4444
4626
|
* from the current URL in the browser.
|
|
4445
4627
|
*/
|
|
4446
|
-
const reason = NG_DEV_MODE$
|
|
4628
|
+
const reason = NG_DEV_MODE$4 ?
|
|
4447
4629
|
`Navigation was ignored because the UrlHandlingStrategy` +
|
|
4448
|
-
` indicated neither the current URL ${
|
|
4630
|
+
` indicated neither the current URL ${router.rawUrlTree} nor target URL ${t.rawUrl} should be processed.` :
|
|
4449
4631
|
'';
|
|
4450
|
-
this.
|
|
4451
|
-
|
|
4632
|
+
this.events.next(new NavigationSkipped(t.id, router.serializeUrl(overallTransitionState.extractedUrl), reason, 1 /* NavigationSkippedCode.IgnoredByUrlHandlingStrategy */));
|
|
4633
|
+
router.rawUrlTree = t.rawUrl;
|
|
4452
4634
|
t.resolve(null);
|
|
4453
4635
|
return EMPTY;
|
|
4454
4636
|
}
|
|
4455
4637
|
}),
|
|
4456
4638
|
// --- GUARDS ---
|
|
4457
4639
|
tap(t => {
|
|
4458
|
-
const guardsStart = new GuardsCheckStart(t.id, this.
|
|
4459
|
-
this.
|
|
4640
|
+
const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4641
|
+
this.events.next(guardsStart);
|
|
4460
4642
|
}), map(t => {
|
|
4461
4643
|
overallTransitionState = {
|
|
4462
4644
|
...t,
|
|
4463
|
-
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.
|
|
4645
|
+
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
|
|
4464
4646
|
};
|
|
4465
4647
|
return overallTransitionState;
|
|
4466
|
-
}), checkGuards(this.
|
|
4648
|
+
}), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap(t => {
|
|
4467
4649
|
overallTransitionState.guardsResult = t.guardsResult;
|
|
4468
4650
|
if (isUrlTree(t.guardsResult)) {
|
|
4469
|
-
throw redirectingNavigationError(this.
|
|
4651
|
+
throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
|
|
4470
4652
|
}
|
|
4471
|
-
const guardsEnd = new GuardsCheckEnd(t.id, this.
|
|
4472
|
-
this.
|
|
4653
|
+
const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
|
|
4654
|
+
this.events.next(guardsEnd);
|
|
4473
4655
|
}), filter(t => {
|
|
4474
4656
|
if (!t.guardsResult) {
|
|
4475
|
-
|
|
4476
|
-
this.
|
|
4657
|
+
router.restoreHistory(t);
|
|
4658
|
+
this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */, router);
|
|
4477
4659
|
return false;
|
|
4478
4660
|
}
|
|
4479
4661
|
return true;
|
|
@@ -4482,24 +4664,24 @@ class NavigationTransitions {
|
|
|
4482
4664
|
switchTap(t => {
|
|
4483
4665
|
if (t.guards.canActivateChecks.length) {
|
|
4484
4666
|
return of(t).pipe(tap(t => {
|
|
4485
|
-
const resolveStart = new ResolveStart(t.id, this.
|
|
4486
|
-
this.
|
|
4667
|
+
const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4668
|
+
this.events.next(resolveStart);
|
|
4487
4669
|
}), switchMap(t => {
|
|
4488
4670
|
let dataResolved = false;
|
|
4489
|
-
return of(t).pipe(resolveData(
|
|
4671
|
+
return of(t).pipe(resolveData(router.paramsInheritanceStrategy, this.environmentInjector), tap({
|
|
4490
4672
|
next: () => dataResolved = true,
|
|
4491
4673
|
complete: () => {
|
|
4492
4674
|
if (!dataResolved) {
|
|
4493
|
-
|
|
4494
|
-
this.
|
|
4675
|
+
router.restoreHistory(t);
|
|
4676
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$4 ?
|
|
4495
4677
|
`At least one route resolver didn't emit any value.` :
|
|
4496
|
-
'', 2 /* NavigationCancellationCode.NoDataFromResolver
|
|
4678
|
+
'', 2 /* NavigationCancellationCode.NoDataFromResolver */, router);
|
|
4497
4679
|
}
|
|
4498
4680
|
}
|
|
4499
4681
|
}));
|
|
4500
4682
|
}), tap(t => {
|
|
4501
|
-
const resolveEnd = new ResolveEnd(t.id, this.
|
|
4502
|
-
this.
|
|
4683
|
+
const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
|
|
4684
|
+
this.events.next(resolveEnd);
|
|
4503
4685
|
}));
|
|
4504
4686
|
}
|
|
4505
4687
|
return undefined;
|
|
@@ -4510,7 +4692,7 @@ class NavigationTransitions {
|
|
|
4510
4692
|
const loaders = [];
|
|
4511
4693
|
if (route.routeConfig?.loadComponent &&
|
|
4512
4694
|
!route.routeConfig._loadedComponent) {
|
|
4513
|
-
loaders.push(this.
|
|
4695
|
+
loaders.push(this.configLoader.loadComponent(route.routeConfig)
|
|
4514
4696
|
.pipe(tap(loadedComponent => {
|
|
4515
4697
|
route.component = loadedComponent;
|
|
4516
4698
|
}), map(() => void 0)));
|
|
@@ -4522,8 +4704,8 @@ class NavigationTransitions {
|
|
|
4522
4704
|
};
|
|
4523
4705
|
return combineLatest(loadComponents(t.targetSnapshot.root))
|
|
4524
4706
|
.pipe(defaultIfEmpty(), take(1));
|
|
4525
|
-
}), switchTap(() =>
|
|
4526
|
-
const targetRouterState = createRouterState(
|
|
4707
|
+
}), switchTap(() => router.afterPreactivation()), map((t) => {
|
|
4708
|
+
const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4527
4709
|
overallTransitionState = { ...t, targetRouterState };
|
|
4528
4710
|
return (overallTransitionState);
|
|
4529
4711
|
}),
|
|
@@ -4533,21 +4715,27 @@ class NavigationTransitions {
|
|
|
4533
4715
|
the current URL and the RouterState, as well as updated the browser URL.
|
|
4534
4716
|
All this should happen *before* activating. */
|
|
4535
4717
|
tap((t) => {
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4718
|
+
router.currentUrlTree = t.urlAfterRedirects;
|
|
4719
|
+
router.rawUrlTree =
|
|
4720
|
+
router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
|
|
4721
|
+
router.routerState =
|
|
4539
4722
|
t.targetRouterState;
|
|
4540
|
-
if (
|
|
4723
|
+
if (router.urlUpdateStrategy === 'deferred') {
|
|
4541
4724
|
if (!t.extras.skipLocationChange) {
|
|
4542
|
-
|
|
4725
|
+
router.setBrowserUrl(router.rawUrlTree, t);
|
|
4543
4726
|
}
|
|
4544
|
-
|
|
4727
|
+
router.browserUrlTree = t.urlAfterRedirects;
|
|
4545
4728
|
}
|
|
4546
|
-
}), activateRoutes(this.
|
|
4547
|
-
next() {
|
|
4729
|
+
}), activateRoutes(this.rootContexts, router.routeReuseStrategy, (evt) => this.events.next(evt)), tap({
|
|
4730
|
+
next: (t) => {
|
|
4548
4731
|
completed = true;
|
|
4732
|
+
this.lastSuccessfulNavigation = this.currentNavigation;
|
|
4733
|
+
router.navigated = true;
|
|
4734
|
+
this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(router.currentUrlTree)));
|
|
4735
|
+
router.titleStrategy?.updateTitle(t.targetRouterState.snapshot);
|
|
4736
|
+
t.resolve(true);
|
|
4549
4737
|
},
|
|
4550
|
-
complete() {
|
|
4738
|
+
complete: () => {
|
|
4551
4739
|
completed = true;
|
|
4552
4740
|
}
|
|
4553
4741
|
}), finalize(() => {
|
|
@@ -4558,11 +4746,11 @@ class NavigationTransitions {
|
|
|
4558
4746
|
* catch-all to make sure the NavigationCancel event is fired when a
|
|
4559
4747
|
* navigation gets cancelled but not caught by other means. */
|
|
4560
4748
|
if (!completed && !errored) {
|
|
4561
|
-
const cancelationReason = NG_DEV_MODE$
|
|
4749
|
+
const cancelationReason = NG_DEV_MODE$4 ?
|
|
4562
4750
|
`Navigation ID ${overallTransitionState
|
|
4563
|
-
.id} is not equal to the current navigation id ${this.
|
|
4751
|
+
.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
4564
4752
|
'';
|
|
4565
|
-
this.
|
|
4753
|
+
this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */, router);
|
|
4566
4754
|
}
|
|
4567
4755
|
// Only clear current navigation if it is still set to the one that
|
|
4568
4756
|
// finalized.
|
|
@@ -4581,28 +4769,28 @@ class NavigationTransitions {
|
|
|
4581
4769
|
// navigate. This is only applicable with initial navigation, so
|
|
4582
4770
|
// setting `navigated` only when not redirecting resolves this
|
|
4583
4771
|
// scenario.
|
|
4584
|
-
|
|
4585
|
-
|
|
4772
|
+
router.navigated = true;
|
|
4773
|
+
router.restoreHistory(overallTransitionState, true);
|
|
4586
4774
|
}
|
|
4587
|
-
const navCancel = new NavigationCancel(overallTransitionState.id, this.
|
|
4588
|
-
|
|
4775
|
+
const navCancel = new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
|
|
4776
|
+
this.events.next(navCancel);
|
|
4589
4777
|
// When redirecting, we need to delay resolving the navigation
|
|
4590
4778
|
// promise and push it to the redirect navigation
|
|
4591
4779
|
if (!isRedirectingNavigationCancelingError$1(e)) {
|
|
4592
4780
|
overallTransitionState.resolve(false);
|
|
4593
4781
|
}
|
|
4594
4782
|
else {
|
|
4595
|
-
const mergedTree =
|
|
4783
|
+
const mergedTree = router.urlHandlingStrategy.merge(e.url, router.rawUrlTree);
|
|
4596
4784
|
const extras = {
|
|
4597
4785
|
skipLocationChange: overallTransitionState.extras.skipLocationChange,
|
|
4598
4786
|
// The URL is already updated at this point if we have 'eager' URL
|
|
4599
4787
|
// updates or if the navigation was triggered by the browser (back
|
|
4600
4788
|
// button, URL bar, etc). We want to replace that item in history
|
|
4601
4789
|
// if the navigation is rejected.
|
|
4602
|
-
replaceUrl:
|
|
4790
|
+
replaceUrl: router.urlUpdateStrategy === 'eager' ||
|
|
4603
4791
|
isBrowserTriggeredNavigation(overallTransitionState.source)
|
|
4604
4792
|
};
|
|
4605
|
-
|
|
4793
|
+
router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
|
|
4606
4794
|
resolve: overallTransitionState.resolve,
|
|
4607
4795
|
reject: overallTransitionState.reject,
|
|
4608
4796
|
promise: overallTransitionState.promise
|
|
@@ -4612,11 +4800,11 @@ class NavigationTransitions {
|
|
|
4612
4800
|
* to the pre-error state. */
|
|
4613
4801
|
}
|
|
4614
4802
|
else {
|
|
4615
|
-
|
|
4616
|
-
const navError = new NavigationError(overallTransitionState.id, this.
|
|
4617
|
-
|
|
4803
|
+
router.restoreHistory(overallTransitionState, true);
|
|
4804
|
+
const navError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
|
|
4805
|
+
this.events.next(navError);
|
|
4618
4806
|
try {
|
|
4619
|
-
overallTransitionState.resolve(
|
|
4807
|
+
overallTransitionState.resolve(router.errorHandler(e));
|
|
4620
4808
|
}
|
|
4621
4809
|
catch (ee) {
|
|
4622
4810
|
overallTransitionState.reject(ee);
|
|
@@ -4627,7 +4815,18 @@ class NavigationTransitions {
|
|
|
4627
4815
|
// TODO(jasonaden): remove cast once g3 is on updated TypeScript
|
|
4628
4816
|
}));
|
|
4629
4817
|
}
|
|
4818
|
+
cancelNavigationTransition(t, reason, code, router) {
|
|
4819
|
+
const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);
|
|
4820
|
+
this.events.next(navCancel);
|
|
4821
|
+
t.resolve(false);
|
|
4822
|
+
}
|
|
4630
4823
|
}
|
|
4824
|
+
NavigationTransitions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4825
|
+
NavigationTransitions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: NavigationTransitions, providedIn: 'root' });
|
|
4826
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: NavigationTransitions, decorators: [{
|
|
4827
|
+
type: Injectable,
|
|
4828
|
+
args: [{ providedIn: 'root' }]
|
|
4829
|
+
}], ctorParameters: function () { return []; } });
|
|
4631
4830
|
function isBrowserTriggeredNavigation(source) {
|
|
4632
4831
|
return source !== 'imperative';
|
|
4633
4832
|
}
|
|
@@ -4683,9 +4882,9 @@ class TitleStrategy {
|
|
|
4683
4882
|
return snapshot.data[RouteTitleKey];
|
|
4684
4883
|
}
|
|
4685
4884
|
}
|
|
4686
|
-
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4687
|
-
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4688
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4885
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4886
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4887
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4689
4888
|
type: Injectable,
|
|
4690
4889
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4691
4890
|
}] });
|
|
@@ -4709,9 +4908,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
4709
4908
|
}
|
|
4710
4909
|
}
|
|
4711
4910
|
}
|
|
4712
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4713
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4714
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4911
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4912
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4715
4914
|
type: Injectable,
|
|
4716
4915
|
args: [{ providedIn: 'root' }]
|
|
4717
4916
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -4732,9 +4931,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0",
|
|
|
4732
4931
|
*/
|
|
4733
4932
|
class RouteReuseStrategy {
|
|
4734
4933
|
}
|
|
4735
|
-
RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4736
|
-
RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4737
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4934
|
+
RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4935
|
+
RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
|
|
4936
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouteReuseStrategy, decorators: [{
|
|
4738
4937
|
type: Injectable,
|
|
4739
4938
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
|
|
4740
4939
|
}] });
|
|
@@ -4786,9 +4985,9 @@ class BaseRouteReuseStrategy {
|
|
|
4786
4985
|
}
|
|
4787
4986
|
class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
4788
4987
|
}
|
|
4789
|
-
DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4790
|
-
DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4791
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4988
|
+
DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
4989
|
+
DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
|
|
4990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
|
|
4792
4991
|
type: Injectable,
|
|
4793
4992
|
args: [{ providedIn: 'root' }]
|
|
4794
4993
|
}] });
|
|
@@ -4800,157 +4999,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0",
|
|
|
4800
4999
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4801
5000
|
* found in the LICENSE file at https://angular.io/license
|
|
4802
5001
|
*/
|
|
4803
|
-
const NG_DEV_MODE$
|
|
5002
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4804
5003
|
/**
|
|
4805
5004
|
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
4806
5005
|
*
|
|
4807
5006
|
* @publicApi
|
|
4808
5007
|
*/
|
|
4809
|
-
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$
|
|
5008
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
|
|
4810
5009
|
providedIn: 'root',
|
|
4811
5010
|
factory: () => ({}),
|
|
4812
5011
|
});
|
|
4813
5012
|
|
|
4814
|
-
/**
|
|
4815
|
-
* @license
|
|
4816
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4817
|
-
*
|
|
4818
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4819
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4820
|
-
*/
|
|
4821
|
-
function deprecatedLoadChildrenString(injector, loadChildren) {
|
|
4822
|
-
return null;
|
|
4823
|
-
}
|
|
4824
|
-
|
|
4825
|
-
/**
|
|
4826
|
-
* @license
|
|
4827
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4828
|
-
*
|
|
4829
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4830
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4831
|
-
*/
|
|
4832
|
-
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4833
|
-
/**
|
|
4834
|
-
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4835
|
-
*
|
|
4836
|
-
* `ROUTES` is a low level API for router configuration via dependency injection.
|
|
4837
|
-
*
|
|
4838
|
-
* We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
|
|
4839
|
-
* `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
|
|
4840
|
-
*
|
|
4841
|
-
* @publicApi
|
|
4842
|
-
*/
|
|
4843
|
-
const ROUTES = new InjectionToken('ROUTES');
|
|
4844
|
-
class RouterConfigLoader {
|
|
4845
|
-
constructor(injector, compiler) {
|
|
4846
|
-
this.injector = injector;
|
|
4847
|
-
this.compiler = compiler;
|
|
4848
|
-
this.componentLoaders = new WeakMap();
|
|
4849
|
-
this.childrenLoaders = new WeakMap();
|
|
4850
|
-
}
|
|
4851
|
-
loadComponent(route) {
|
|
4852
|
-
if (this.componentLoaders.get(route)) {
|
|
4853
|
-
return this.componentLoaders.get(route);
|
|
4854
|
-
}
|
|
4855
|
-
else if (route._loadedComponent) {
|
|
4856
|
-
return of(route._loadedComponent);
|
|
4857
|
-
}
|
|
4858
|
-
if (this.onLoadStartListener) {
|
|
4859
|
-
this.onLoadStartListener(route);
|
|
4860
|
-
}
|
|
4861
|
-
const loadRunner = wrapIntoObservable(route.loadComponent())
|
|
4862
|
-
.pipe(map(maybeUnwrapDefaultExport), tap(component => {
|
|
4863
|
-
if (this.onLoadEndListener) {
|
|
4864
|
-
this.onLoadEndListener(route);
|
|
4865
|
-
}
|
|
4866
|
-
NG_DEV_MODE$3 && assertStandalone(route.path ?? '', component);
|
|
4867
|
-
route._loadedComponent = component;
|
|
4868
|
-
}), finalize(() => {
|
|
4869
|
-
this.componentLoaders.delete(route);
|
|
4870
|
-
}));
|
|
4871
|
-
// Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
|
|
4872
|
-
const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
|
|
4873
|
-
this.componentLoaders.set(route, loader);
|
|
4874
|
-
return loader;
|
|
4875
|
-
}
|
|
4876
|
-
loadChildren(parentInjector, route) {
|
|
4877
|
-
if (this.childrenLoaders.get(route)) {
|
|
4878
|
-
return this.childrenLoaders.get(route);
|
|
4879
|
-
}
|
|
4880
|
-
else if (route._loadedRoutes) {
|
|
4881
|
-
return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
|
|
4882
|
-
}
|
|
4883
|
-
if (this.onLoadStartListener) {
|
|
4884
|
-
this.onLoadStartListener(route);
|
|
4885
|
-
}
|
|
4886
|
-
const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
|
|
4887
|
-
const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
|
|
4888
|
-
if (this.onLoadEndListener) {
|
|
4889
|
-
this.onLoadEndListener(route);
|
|
4890
|
-
}
|
|
4891
|
-
// This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
|
|
4892
|
-
// injector associated with lazy loading a `Route` array.
|
|
4893
|
-
let injector;
|
|
4894
|
-
let rawRoutes;
|
|
4895
|
-
let requireStandaloneComponents = false;
|
|
4896
|
-
if (Array.isArray(factoryOrRoutes)) {
|
|
4897
|
-
rawRoutes = factoryOrRoutes;
|
|
4898
|
-
requireStandaloneComponents = true;
|
|
4899
|
-
}
|
|
4900
|
-
else {
|
|
4901
|
-
injector = factoryOrRoutes.create(parentInjector).injector;
|
|
4902
|
-
// When loading a module that doesn't provide `RouterModule.forChild()` preloader
|
|
4903
|
-
// will get stuck in an infinite loop. The child module's Injector will look to
|
|
4904
|
-
// its parent `Injector` when it doesn't find any ROUTES so it will return routes
|
|
4905
|
-
// for it's parent module instead.
|
|
4906
|
-
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4907
|
-
}
|
|
4908
|
-
const routes = rawRoutes.map(standardizeConfig);
|
|
4909
|
-
NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4910
|
-
return { routes, injector };
|
|
4911
|
-
}), finalize(() => {
|
|
4912
|
-
this.childrenLoaders.delete(route);
|
|
4913
|
-
}));
|
|
4914
|
-
// Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
|
|
4915
|
-
const loader = new ConnectableObservable(loadRunner, () => new Subject())
|
|
4916
|
-
.pipe(refCount());
|
|
4917
|
-
this.childrenLoaders.set(route, loader);
|
|
4918
|
-
return loader;
|
|
4919
|
-
}
|
|
4920
|
-
loadModuleFactoryOrRoutes(loadChildren) {
|
|
4921
|
-
const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
|
|
4922
|
-
if (deprecatedResult) {
|
|
4923
|
-
return deprecatedResult;
|
|
4924
|
-
}
|
|
4925
|
-
return wrapIntoObservable(loadChildren())
|
|
4926
|
-
.pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
|
|
4927
|
-
if (t instanceof NgModuleFactory || Array.isArray(t)) {
|
|
4928
|
-
return of(t);
|
|
4929
|
-
}
|
|
4930
|
-
else {
|
|
4931
|
-
return from(this.compiler.compileModuleAsync(t));
|
|
4932
|
-
}
|
|
4933
|
-
}));
|
|
4934
|
-
}
|
|
4935
|
-
}
|
|
4936
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4937
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4938
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4939
|
-
type: Injectable,
|
|
4940
|
-
args: [{ providedIn: 'root' }]
|
|
4941
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4942
|
-
function isWrappedDefaultExport(value) {
|
|
4943
|
-
// We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
|
|
4944
|
-
// dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
|
|
4945
|
-
// `default` will be a renamed property.
|
|
4946
|
-
return value && typeof value === 'object' && 'default' in value;
|
|
4947
|
-
}
|
|
4948
|
-
function maybeUnwrapDefaultExport(input) {
|
|
4949
|
-
// As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
|
|
4950
|
-
// subject to property renaming, so we reference it with bracket access.
|
|
4951
|
-
return isWrappedDefaultExport(input) ? input['default'] : input;
|
|
4952
|
-
}
|
|
4953
|
-
|
|
4954
5013
|
/**
|
|
4955
5014
|
* @license
|
|
4956
5015
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4967,9 +5026,9 @@ function maybeUnwrapDefaultExport(input) {
|
|
|
4967
5026
|
*/
|
|
4968
5027
|
class UrlHandlingStrategy {
|
|
4969
5028
|
}
|
|
4970
|
-
UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4971
|
-
UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4972
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
5029
|
+
UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5030
|
+
UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
|
|
5031
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
|
|
4973
5032
|
type: Injectable,
|
|
4974
5033
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
|
|
4975
5034
|
}] });
|
|
@@ -4987,9 +5046,9 @@ class DefaultUrlHandlingStrategy {
|
|
|
4987
5046
|
return newUrlPart;
|
|
4988
5047
|
}
|
|
4989
5048
|
}
|
|
4990
|
-
DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4991
|
-
DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
4992
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
5049
|
+
DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5050
|
+
DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
|
|
5051
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
|
|
4993
5052
|
type: Injectable,
|
|
4994
5053
|
args: [{ providedIn: 'root' }]
|
|
4995
5054
|
}] });
|
|
@@ -5028,38 +5087,6 @@ const subsetMatchOptions = {
|
|
|
5028
5087
|
matrixParams: 'ignored',
|
|
5029
5088
|
queryParams: 'subset'
|
|
5030
5089
|
};
|
|
5031
|
-
function assignExtraOptionsToRouter(opts, router) {
|
|
5032
|
-
if (opts.errorHandler) {
|
|
5033
|
-
router.errorHandler = opts.errorHandler;
|
|
5034
|
-
}
|
|
5035
|
-
if (opts.malformedUriErrorHandler) {
|
|
5036
|
-
router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
|
|
5037
|
-
}
|
|
5038
|
-
if (opts.onSameUrlNavigation) {
|
|
5039
|
-
router.onSameUrlNavigation = opts.onSameUrlNavigation;
|
|
5040
|
-
}
|
|
5041
|
-
if (opts.paramsInheritanceStrategy) {
|
|
5042
|
-
router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
|
5043
|
-
}
|
|
5044
|
-
if (opts.urlUpdateStrategy) {
|
|
5045
|
-
router.urlUpdateStrategy = opts.urlUpdateStrategy;
|
|
5046
|
-
}
|
|
5047
|
-
if (opts.canceledNavigationResolution) {
|
|
5048
|
-
router.canceledNavigationResolution = opts.canceledNavigationResolution;
|
|
5049
|
-
}
|
|
5050
|
-
}
|
|
5051
|
-
function setupRouter() {
|
|
5052
|
-
const urlSerializer = inject(UrlSerializer);
|
|
5053
|
-
const contexts = inject(ChildrenOutletContexts);
|
|
5054
|
-
const location = inject(Location);
|
|
5055
|
-
const injector = inject(Injector);
|
|
5056
|
-
const compiler = inject(Compiler);
|
|
5057
|
-
const config = inject(ROUTES, { optional: true }) ?? [];
|
|
5058
|
-
const opts = inject(ROUTER_CONFIGURATION, { optional: true }) ?? {};
|
|
5059
|
-
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
5060
|
-
assignExtraOptionsToRouter(opts, router);
|
|
5061
|
-
return router;
|
|
5062
|
-
}
|
|
5063
5090
|
/**
|
|
5064
5091
|
* @description
|
|
5065
5092
|
*
|
|
@@ -5073,29 +5100,31 @@ function setupRouter() {
|
|
|
5073
5100
|
* @publicApi
|
|
5074
5101
|
*/
|
|
5075
5102
|
class Router {
|
|
5103
|
+
// TODO(b/260747083): This should not exist and navigationId should be private in
|
|
5104
|
+
// `NavigationTransitions`
|
|
5105
|
+
get navigationId() {
|
|
5106
|
+
return this.navigationTransitions.navigationId;
|
|
5107
|
+
}
|
|
5076
5108
|
/**
|
|
5077
|
-
*
|
|
5109
|
+
* The ɵrouterPageId of whatever page is currently active in the browser history. This is
|
|
5110
|
+
* important for computing the target page id for new navigations because we need to ensure each
|
|
5111
|
+
* page id in the browser history is 1 more than the previous entry.
|
|
5078
5112
|
*/
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
this.
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
this.config = config;
|
|
5094
|
-
/** @internal */
|
|
5095
|
-
this.lastSuccessfulNavigation = null;
|
|
5113
|
+
get browserPageId() {
|
|
5114
|
+
return this.location.getState()?.ɵrouterPageId;
|
|
5115
|
+
}
|
|
5116
|
+
/**
|
|
5117
|
+
* An event stream for routing events.
|
|
5118
|
+
*/
|
|
5119
|
+
get events() {
|
|
5120
|
+
// TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal
|
|
5121
|
+
// cleanup: tests are doing `(route.events as Subject<Event>).next(...)`. This isn't
|
|
5122
|
+
// allowed/supported but we still have to fix these or file bugs against the teams before making
|
|
5123
|
+
// the change.
|
|
5124
|
+
return this.navigationTransitions.events;
|
|
5125
|
+
}
|
|
5126
|
+
constructor() {
|
|
5096
5127
|
this.disposed = false;
|
|
5097
|
-
/** @internal */
|
|
5098
|
-
this.navigationId = 0;
|
|
5099
5128
|
/**
|
|
5100
5129
|
* The id of the currently active page in the router.
|
|
5101
5130
|
* Updated to the transition's target id on a successful navigation.
|
|
@@ -5105,17 +5134,15 @@ class Router {
|
|
|
5105
5134
|
* page.
|
|
5106
5135
|
*/
|
|
5107
5136
|
this.currentPageId = 0;
|
|
5137
|
+
this.console = inject(ɵConsole);
|
|
5108
5138
|
this.isNgZoneEnabled = false;
|
|
5109
|
-
|
|
5110
|
-
* An event stream for routing events in this NgModule.
|
|
5111
|
-
*/
|
|
5112
|
-
this.events = new Subject();
|
|
5139
|
+
this.options = inject(ROUTER_CONFIGURATION, { optional: true }) || {};
|
|
5113
5140
|
/**
|
|
5114
5141
|
* A handler for navigation errors in this NgModule.
|
|
5115
5142
|
*
|
|
5116
5143
|
* @deprecated Subscribe to the `Router` events and watch for `NavigationError` instead.
|
|
5117
5144
|
*/
|
|
5118
|
-
this.errorHandler = defaultErrorHandler;
|
|
5145
|
+
this.errorHandler = this.options.errorHandler || defaultErrorHandler;
|
|
5119
5146
|
/**
|
|
5120
5147
|
* A handler for errors thrown by `Router.parseUrl(url)`
|
|
5121
5148
|
* when `url` contains an invalid character.
|
|
@@ -5126,7 +5153,7 @@ class Router {
|
|
|
5126
5153
|
* `RouterModule.forRoot(routes, {malformedUriErrorHandler: myHandler})`
|
|
5127
5154
|
* @see `RouterModule`
|
|
5128
5155
|
*/
|
|
5129
|
-
this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
|
|
5156
|
+
this.malformedUriErrorHandler = this.options.malformedUriErrorHandler || defaultMalformedUriErrorHandler;
|
|
5130
5157
|
/**
|
|
5131
5158
|
* True if at least one navigation event has occurred,
|
|
5132
5159
|
* false otherwise.
|
|
@@ -5163,24 +5190,15 @@ class Router {
|
|
|
5163
5190
|
*/
|
|
5164
5191
|
this.titleStrategy = inject(TitleStrategy);
|
|
5165
5192
|
/**
|
|
5166
|
-
* How to handle a navigation request to the current URL.
|
|
5193
|
+
* How to handle a navigation request to the current URL.
|
|
5167
5194
|
*
|
|
5168
|
-
* - `'ignore'` : The router ignores the request.
|
|
5169
|
-
* - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature.
|
|
5170
|
-
*
|
|
5171
|
-
* Note that this only configures whether the Route reprocesses the URL and triggers related
|
|
5172
|
-
* action and events like redirects, guards, and resolvers. By default, the router re-uses a
|
|
5173
|
-
* component instance when it re-navigates to the same component type without visiting a different
|
|
5174
|
-
* component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
|
|
5175
|
-
* routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
|
|
5176
|
-
* _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
|
|
5177
5195
|
*
|
|
5178
5196
|
* @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
|
|
5179
5197
|
* @see `withRouterConfig`
|
|
5180
5198
|
* @see `provideRouter`
|
|
5181
5199
|
* @see `RouterModule`
|
|
5182
5200
|
*/
|
|
5183
|
-
this.onSameUrlNavigation = 'ignore';
|
|
5201
|
+
this.onSameUrlNavigation = this.options.onSameUrlNavigation || 'ignore';
|
|
5184
5202
|
/**
|
|
5185
5203
|
* How to merge parameters, data, resolved data, and title from parent to child
|
|
5186
5204
|
* routes. One of:
|
|
@@ -5195,7 +5213,7 @@ class Router {
|
|
|
5195
5213
|
* @see `provideRouter`
|
|
5196
5214
|
* @see `RouterModule`
|
|
5197
5215
|
*/
|
|
5198
|
-
this.paramsInheritanceStrategy = 'emptyOnly';
|
|
5216
|
+
this.paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || 'emptyOnly';
|
|
5199
5217
|
/**
|
|
5200
5218
|
* Determines when the router updates the browser URL.
|
|
5201
5219
|
* By default (`"deferred"`), updates the browser URL after navigation has finished.
|
|
@@ -5208,7 +5226,7 @@ class Router {
|
|
|
5208
5226
|
* @see `provideRouter`
|
|
5209
5227
|
* @see `RouterModule`
|
|
5210
5228
|
*/
|
|
5211
|
-
this.urlUpdateStrategy = 'deferred';
|
|
5229
|
+
this.urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';
|
|
5212
5230
|
/**
|
|
5213
5231
|
* Configures how the Router attempts to restore state when a navigation is cancelled.
|
|
5214
5232
|
*
|
|
@@ -5235,72 +5253,39 @@ class Router {
|
|
|
5235
5253
|
* @see `provideRouter`
|
|
5236
5254
|
* @see `RouterModule`
|
|
5237
5255
|
*/
|
|
5238
|
-
this.canceledNavigationResolution = 'replace';
|
|
5239
|
-
this.
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
this.
|
|
5243
|
-
|
|
5244
|
-
this.
|
|
5245
|
-
this.
|
|
5246
|
-
this.
|
|
5247
|
-
const ngZone = injector.get(NgZone);
|
|
5248
|
-
this.isNgZoneEnabled = ngZone instanceof NgZone && NgZone.isInAngularZone();
|
|
5249
|
-
this.resetConfig(config);
|
|
5256
|
+
this.canceledNavigationResolution = this.options.canceledNavigationResolution || 'replace';
|
|
5257
|
+
this.config = flatten(inject(ROUTES, { optional: true }) ?? []);
|
|
5258
|
+
this.navigationTransitions = inject(NavigationTransitions);
|
|
5259
|
+
this.urlSerializer = inject(UrlSerializer);
|
|
5260
|
+
this.location = inject(Location);
|
|
5261
|
+
/** @internal */
|
|
5262
|
+
this.rootComponentType = null;
|
|
5263
|
+
this.isNgZoneEnabled = inject(NgZone) instanceof NgZone && NgZone.isInAngularZone();
|
|
5264
|
+
this.resetConfig(this.config);
|
|
5250
5265
|
this.currentUrlTree = new UrlTree();
|
|
5251
5266
|
this.rawUrlTree = this.currentUrlTree;
|
|
5252
5267
|
this.browserUrlTree = this.currentUrlTree;
|
|
5253
5268
|
this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
|
|
5254
|
-
this.
|
|
5255
|
-
id
|
|
5256
|
-
targetPageId
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
|
|
5260
|
-
rawUrl: this.currentUrlTree,
|
|
5261
|
-
extras: {},
|
|
5262
|
-
resolve: null,
|
|
5263
|
-
reject: null,
|
|
5264
|
-
promise: Promise.resolve(true),
|
|
5265
|
-
source: 'imperative',
|
|
5266
|
-
restoredState: null,
|
|
5267
|
-
currentSnapshot: this.routerState.snapshot,
|
|
5268
|
-
targetSnapshot: null,
|
|
5269
|
-
currentRouterState: this.routerState,
|
|
5270
|
-
targetRouterState: null,
|
|
5271
|
-
guards: { canActivateChecks: [], canDeactivateChecks: [] },
|
|
5272
|
-
guardsResult: null,
|
|
5269
|
+
this.navigationTransitions.setupNavigations(this).subscribe(t => {
|
|
5270
|
+
this.lastSuccessfulId = t.id;
|
|
5271
|
+
this.currentPageId = t.targetPageId;
|
|
5272
|
+
}, e => {
|
|
5273
|
+
this.console.warn(`Unhandled Navigation Error: ${e}`);
|
|
5273
5274
|
});
|
|
5274
|
-
this.navigations = this.navigationTransitions.setupNavigations(this.transitions);
|
|
5275
|
-
this.processNavigations();
|
|
5276
|
-
}
|
|
5277
|
-
/**
|
|
5278
|
-
* The ɵrouterPageId of whatever page is currently active in the browser history. This is
|
|
5279
|
-
* important for computing the target page id for new navigations because we need to ensure each
|
|
5280
|
-
* page id in the browser history is 1 more than the previous entry.
|
|
5281
|
-
*/
|
|
5282
|
-
get browserPageId() {
|
|
5283
|
-
return this.location.getState()?.ɵrouterPageId;
|
|
5284
5275
|
}
|
|
5285
|
-
/**
|
|
5286
|
-
* @internal
|
|
5287
|
-
* TODO: this should be removed once the constructor of the router made internal
|
|
5288
|
-
*/
|
|
5276
|
+
/** @internal */
|
|
5289
5277
|
resetRootComponentType(rootComponentType) {
|
|
5290
5278
|
this.rootComponentType = rootComponentType;
|
|
5291
5279
|
// TODO: vsavkin router 4.0 should make the root component set to null
|
|
5292
5280
|
// this will simplify the lifecycle of the router.
|
|
5293
5281
|
this.routerState.root.component = this.rootComponentType;
|
|
5294
5282
|
}
|
|
5295
|
-
setTransition(t) {
|
|
5296
|
-
this.transitions.next({ ...this.transitions.value, ...t });
|
|
5297
|
-
}
|
|
5298
5283
|
/**
|
|
5299
5284
|
* Sets up the location change listener and performs the initial navigation.
|
|
5300
5285
|
*/
|
|
5301
5286
|
initialNavigation() {
|
|
5302
5287
|
this.setUpLocationChangeListener();
|
|
5303
|
-
if (this.
|
|
5288
|
+
if (!this.navigationTransitions.hasRequestedNavigation) {
|
|
5304
5289
|
this.navigateByUrl(this.location.path(true), { replaceUrl: true });
|
|
5305
5290
|
}
|
|
5306
5291
|
}
|
|
@@ -5357,10 +5342,6 @@ class Router {
|
|
|
5357
5342
|
getCurrentNavigation() {
|
|
5358
5343
|
return this.navigationTransitions.currentNavigation;
|
|
5359
5344
|
}
|
|
5360
|
-
/** @internal */
|
|
5361
|
-
triggerEvent(event) {
|
|
5362
|
-
this.events.next(event);
|
|
5363
|
-
}
|
|
5364
5345
|
/**
|
|
5365
5346
|
* Resets the route configuration used for navigation and generating links.
|
|
5366
5347
|
*
|
|
@@ -5389,7 +5370,7 @@ class Router {
|
|
|
5389
5370
|
}
|
|
5390
5371
|
/** Disposes of the router. */
|
|
5391
5372
|
dispose() {
|
|
5392
|
-
this.
|
|
5373
|
+
this.navigationTransitions.complete();
|
|
5393
5374
|
if (this.locationSubscription) {
|
|
5394
5375
|
this.locationSubscription.unsubscribe();
|
|
5395
5376
|
this.locationSubscription = undefined;
|
|
@@ -5574,20 +5555,6 @@ class Router {
|
|
|
5574
5555
|
return result;
|
|
5575
5556
|
}, {});
|
|
5576
5557
|
}
|
|
5577
|
-
processNavigations() {
|
|
5578
|
-
this.navigations.subscribe(t => {
|
|
5579
|
-
this.navigated = true;
|
|
5580
|
-
this.lastSuccessfulId = t.id;
|
|
5581
|
-
this.currentPageId = t.targetPageId;
|
|
5582
|
-
this.events
|
|
5583
|
-
.next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
|
|
5584
|
-
this.lastSuccessfulNavigation = this.getCurrentNavigation();
|
|
5585
|
-
this.titleStrategy?.updateTitle(this.routerState.snapshot);
|
|
5586
|
-
t.resolve(true);
|
|
5587
|
-
}, e => {
|
|
5588
|
-
this.console.warn(`Unhandled Navigation Error: ${e}`);
|
|
5589
|
-
});
|
|
5590
|
-
}
|
|
5591
5558
|
/** @internal */
|
|
5592
5559
|
scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
|
|
5593
5560
|
if (this.disposed) {
|
|
@@ -5607,7 +5574,6 @@ class Router {
|
|
|
5607
5574
|
reject = rej;
|
|
5608
5575
|
});
|
|
5609
5576
|
}
|
|
5610
|
-
const id = ++this.navigationId;
|
|
5611
5577
|
let targetPageId;
|
|
5612
5578
|
if (this.canceledNavigationResolution === 'computed') {
|
|
5613
5579
|
const isInitialPage = this.currentPageId === 0;
|
|
@@ -5635,12 +5601,12 @@ class Router {
|
|
|
5635
5601
|
// This is unused when `canceledNavigationResolution` is not computed.
|
|
5636
5602
|
targetPageId = 0;
|
|
5637
5603
|
}
|
|
5638
|
-
this.
|
|
5639
|
-
id,
|
|
5604
|
+
this.navigationTransitions.handleNavigationRequest({
|
|
5640
5605
|
targetPageId,
|
|
5641
5606
|
source,
|
|
5642
5607
|
restoredState,
|
|
5643
5608
|
currentUrlTree: this.currentUrlTree,
|
|
5609
|
+
currentRawUrl: this.currentUrlTree,
|
|
5644
5610
|
rawUrl,
|
|
5645
5611
|
extras,
|
|
5646
5612
|
resolve,
|
|
@@ -5727,12 +5693,6 @@ class Router {
|
|
|
5727
5693
|
resetUrlToCurrentUrlTree() {
|
|
5728
5694
|
this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
|
|
5729
5695
|
}
|
|
5730
|
-
/** @internal */
|
|
5731
|
-
cancelNavigationTransition(transition, reason, code) {
|
|
5732
|
-
const navCancel = new NavigationCancel(transition.id, this.serializeUrl(transition.extractedUrl), reason, code);
|
|
5733
|
-
this.triggerEvent(navCancel);
|
|
5734
|
-
transition.resolve(false);
|
|
5735
|
-
}
|
|
5736
5696
|
generateNgRouterState(navigationId, routerPageId) {
|
|
5737
5697
|
if (this.canceledNavigationResolution === 'computed') {
|
|
5738
5698
|
return { navigationId, ɵrouterPageId: routerPageId };
|
|
@@ -5740,15 +5700,12 @@ class Router {
|
|
|
5740
5700
|
return { navigationId };
|
|
5741
5701
|
}
|
|
5742
5702
|
}
|
|
5743
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
5744
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
5745
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
5703
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5704
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: Router, providedIn: 'root' });
|
|
5705
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: Router, decorators: [{
|
|
5746
5706
|
type: Injectable,
|
|
5747
|
-
args: [{
|
|
5748
|
-
|
|
5749
|
-
useFactory: setupRouter,
|
|
5750
|
-
}]
|
|
5751
|
-
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5707
|
+
args: [{ providedIn: 'root' }]
|
|
5708
|
+
}], ctorParameters: function () { return []; } });
|
|
5752
5709
|
function validateCommands(commands) {
|
|
5753
5710
|
for (let i = 0; i < commands.length; i++) {
|
|
5754
5711
|
const cmd = commands[i];
|
|
@@ -6038,9 +5995,9 @@ class RouterLink {
|
|
|
6038
5995
|
});
|
|
6039
5996
|
}
|
|
6040
5997
|
}
|
|
6041
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6042
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.
|
|
6043
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
5998
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5999
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.2", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
|
|
6000
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterLink, decorators: [{
|
|
6044
6001
|
type: Directive,
|
|
6045
6002
|
args: [{
|
|
6046
6003
|
selector: '[routerLink]',
|
|
@@ -6265,9 +6222,9 @@ class RouterLinkActive {
|
|
|
6265
6222
|
return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
|
|
6266
6223
|
}
|
|
6267
6224
|
}
|
|
6268
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6269
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.
|
|
6270
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6225
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
6226
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.2", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
6227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
6271
6228
|
type: Directive,
|
|
6272
6229
|
args: [{
|
|
6273
6230
|
selector: '[routerLinkActive]',
|
|
@@ -6327,9 +6284,9 @@ class PreloadAllModules {
|
|
|
6327
6284
|
return fn().pipe(catchError(() => of(null)));
|
|
6328
6285
|
}
|
|
6329
6286
|
}
|
|
6330
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6331
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6332
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6287
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6288
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6333
6290
|
type: Injectable,
|
|
6334
6291
|
args: [{ providedIn: 'root' }]
|
|
6335
6292
|
}] });
|
|
@@ -6347,9 +6304,9 @@ class NoPreloading {
|
|
|
6347
6304
|
return of(null);
|
|
6348
6305
|
}
|
|
6349
6306
|
}
|
|
6350
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6351
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6352
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6307
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6308
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6353
6310
|
type: Injectable,
|
|
6354
6311
|
args: [{ providedIn: 'root' }]
|
|
6355
6312
|
}] });
|
|
@@ -6443,9 +6400,9 @@ class RouterPreloader {
|
|
|
6443
6400
|
});
|
|
6444
6401
|
}
|
|
6445
6402
|
}
|
|
6446
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6447
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6448
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6403
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6404
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
|
|
6405
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6449
6406
|
type: Injectable,
|
|
6450
6407
|
args: [{ providedIn: 'root' }]
|
|
6451
6408
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
@@ -6459,9 +6416,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0",
|
|
|
6459
6416
|
*/
|
|
6460
6417
|
const ROUTER_SCROLLER = new InjectionToken('');
|
|
6461
6418
|
class RouterScroller {
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
this.
|
|
6419
|
+
/** @nodoc */
|
|
6420
|
+
constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
|
|
6421
|
+
this.urlSerializer = urlSerializer;
|
|
6422
|
+
this.transitions = transitions;
|
|
6465
6423
|
this.viewportScroller = viewportScroller;
|
|
6466
6424
|
this.zone = zone;
|
|
6467
6425
|
this.options = options;
|
|
@@ -6484,7 +6442,7 @@ class RouterScroller {
|
|
|
6484
6442
|
this.scrollEventsSubscription = this.consumeScrollEvents();
|
|
6485
6443
|
}
|
|
6486
6444
|
createScrollEvents() {
|
|
6487
|
-
return this.
|
|
6445
|
+
return this.transitions.events.subscribe(e => {
|
|
6488
6446
|
if (e instanceof NavigationStart) {
|
|
6489
6447
|
// store the scroll position of the current stable navigations.
|
|
6490
6448
|
this.store[this.lastId] = this.viewportScroller.getScrollPosition();
|
|
@@ -6493,12 +6451,12 @@ class RouterScroller {
|
|
|
6493
6451
|
}
|
|
6494
6452
|
else if (e instanceof NavigationEnd) {
|
|
6495
6453
|
this.lastId = e.id;
|
|
6496
|
-
this.scheduleScrollEvent(e, this.
|
|
6454
|
+
this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
|
|
6497
6455
|
}
|
|
6498
6456
|
});
|
|
6499
6457
|
}
|
|
6500
6458
|
consumeScrollEvents() {
|
|
6501
|
-
return this.
|
|
6459
|
+
return this.transitions.events.subscribe(e => {
|
|
6502
6460
|
if (!(e instanceof Scroll))
|
|
6503
6461
|
return;
|
|
6504
6462
|
// a popstate event. The pop state event will always ignore anchor scrolling.
|
|
@@ -6528,26 +6486,22 @@ class RouterScroller {
|
|
|
6528
6486
|
// component by executing its update block of the template function.
|
|
6529
6487
|
setTimeout(() => {
|
|
6530
6488
|
this.zone.run(() => {
|
|
6531
|
-
this.
|
|
6489
|
+
this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
|
|
6532
6490
|
});
|
|
6533
6491
|
}, 0);
|
|
6534
6492
|
});
|
|
6535
6493
|
}
|
|
6536
6494
|
/** @nodoc */
|
|
6537
6495
|
ngOnDestroy() {
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
}
|
|
6541
|
-
if (this.scrollEventsSubscription) {
|
|
6542
|
-
this.scrollEventsSubscription.unsubscribe();
|
|
6543
|
-
}
|
|
6496
|
+
this.routerEventsSubscription?.unsubscribe();
|
|
6497
|
+
this.scrollEventsSubscription?.unsubscribe();
|
|
6544
6498
|
}
|
|
6545
6499
|
}
|
|
6546
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6547
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
6500
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6501
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterScroller });
|
|
6502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6549
6503
|
type: Injectable
|
|
6550
|
-
}], ctorParameters: function () { return [{ type:
|
|
6504
|
+
}], ctorParameters: function () { return [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
|
|
6551
6505
|
|
|
6552
6506
|
/**
|
|
6553
6507
|
* @license
|
|
@@ -6600,10 +6554,6 @@ function provideRouter(routes, ...features) {
|
|
|
6600
6554
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6601
6555
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
6602
6556
|
features.map(feature => feature.ɵproviders),
|
|
6603
|
-
// TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
|
|
6604
|
-
// how we want them to be configured. This API doesn't currently have a way to configure them
|
|
6605
|
-
// and we should decide what the _best_ way to do that is rather than just sticking with the
|
|
6606
|
-
// status quo of how it's done today.
|
|
6607
6557
|
]);
|
|
6608
6558
|
}
|
|
6609
6559
|
function rootRoute(router) {
|
|
@@ -6684,10 +6634,11 @@ function withInMemoryScrolling(options = {}) {
|
|
|
6684
6634
|
const providers = [{
|
|
6685
6635
|
provide: ROUTER_SCROLLER,
|
|
6686
6636
|
useFactory: () => {
|
|
6687
|
-
const router = inject(Router);
|
|
6688
6637
|
const viewportScroller = inject(ViewportScroller);
|
|
6689
6638
|
const zone = inject(NgZone);
|
|
6690
|
-
|
|
6639
|
+
const transitions = inject(NavigationTransitions);
|
|
6640
|
+
const urlSerializer = inject(UrlSerializer);
|
|
6641
|
+
return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);
|
|
6691
6642
|
},
|
|
6692
6643
|
}];
|
|
6693
6644
|
return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
|
|
@@ -6990,7 +6941,7 @@ const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate
|
|
|
6990
6941
|
const ROUTER_PROVIDERS = [
|
|
6991
6942
|
Location,
|
|
6992
6943
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
6993
|
-
|
|
6944
|
+
Router,
|
|
6994
6945
|
ChildrenOutletContexts,
|
|
6995
6946
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6996
6947
|
RouterConfigLoader,
|
|
@@ -7087,10 +7038,10 @@ class RouterModule {
|
|
|
7087
7038
|
};
|
|
7088
7039
|
}
|
|
7089
7040
|
}
|
|
7090
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
7091
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0-next.
|
|
7092
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
7093
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.
|
|
7041
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
7042
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
7043
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
|
|
7044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.2", ngImport: i0, type: RouterModule, decorators: [{
|
|
7094
7045
|
type: NgModule,
|
|
7095
7046
|
args: [{
|
|
7096
7047
|
imports: ROUTER_DIRECTIVES,
|
|
@@ -7110,14 +7061,15 @@ function provideRouterScroller() {
|
|
|
7110
7061
|
return {
|
|
7111
7062
|
provide: ROUTER_SCROLLER,
|
|
7112
7063
|
useFactory: () => {
|
|
7113
|
-
const router = inject(Router);
|
|
7114
7064
|
const viewportScroller = inject(ViewportScroller);
|
|
7115
7065
|
const zone = inject(NgZone);
|
|
7116
7066
|
const config = inject(ROUTER_CONFIGURATION);
|
|
7067
|
+
const transitions = inject(NavigationTransitions);
|
|
7068
|
+
const urlSerializer = inject(UrlSerializer);
|
|
7117
7069
|
if (config.scrollOffset) {
|
|
7118
7070
|
viewportScroller.setOffset(config.scrollOffset);
|
|
7119
7071
|
}
|
|
7120
|
-
return new RouterScroller(
|
|
7072
|
+
return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);
|
|
7121
7073
|
},
|
|
7122
7074
|
};
|
|
7123
7075
|
}
|
|
@@ -7175,7 +7127,7 @@ function provideRouterInitializer() {
|
|
|
7175
7127
|
/**
|
|
7176
7128
|
* @publicApi
|
|
7177
7129
|
*/
|
|
7178
|
-
const VERSION = new Version('15.1.0-next.
|
|
7130
|
+
const VERSION = new Version('15.1.0-next.2');
|
|
7179
7131
|
|
|
7180
7132
|
/**
|
|
7181
7133
|
* @license
|
|
@@ -7214,5 +7166,5 @@ const VERSION = new Version('15.1.0-next.0');
|
|
|
7214
7166
|
* Generated bundle index. Do not edit.
|
|
7215
7167
|
*/
|
|
7216
7168
|
|
|
7217
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationSkipped, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS,
|
|
7169
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationSkipped, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, flatten as ɵflatten, withPreloading as ɵwithPreloading };
|
|
7218
7170
|
//# sourceMappingURL=router.mjs.map
|