@angular/router 15.0.0-next.4 → 15.0.0-next.6
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 +11 -0
- package/esm2020/src/directives/router_link.mjs +86 -178
- package/esm2020/src/directives/router_link_active.mjs +10 -18
- package/esm2020/src/directives/router_outlet.mjs +59 -31
- package/esm2020/src/index.mjs +1 -1
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/page_title_strategy.mjs +6 -6
- package/esm2020/src/patchable_relative_link_resolution.mjs +1 -1
- package/esm2020/src/private_export.mjs +1 -1
- package/esm2020/src/provide_router.mjs +4 -4
- package/esm2020/src/router.mjs +7 -11
- package/esm2020/src/router_config.mjs +1 -1
- package/esm2020/src/router_config_loader.mjs +23 -6
- package/esm2020/src/router_module.mjs +7 -7
- package/esm2020/src/router_outlet_context.mjs +3 -3
- package/esm2020/src/router_preloader.mjs +9 -9
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/url_tree.mjs +3 -3
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +9 -11
- package/fesm2015/router.mjs +220 -277
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +9 -11
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +216 -273
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +9 -11
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +88 -178
- package/package.json +5 -5
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
- package/esm2020/testing/src/provide_router_for_testing.mjs +0 -51
package/fesm2020/router.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.0.0-next.
|
|
2
|
+
* @license Angular v15.0.0-next.6
|
|
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, Directive,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ApplicationRef, APP_INITIALIZER, ENVIRONMENT_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.0.0-next.
|
|
465
|
-
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
466
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
464
|
+
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
465
|
+
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
|
|
466
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: UrlSerializer, decorators: [{
|
|
467
467
|
type: Injectable,
|
|
468
468
|
args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
|
|
469
469
|
}] });
|
|
@@ -2388,9 +2388,9 @@ class ChildrenOutletContexts {
|
|
|
2388
2388
|
return this.contexts.get(childName) || null;
|
|
2389
2389
|
}
|
|
2390
2390
|
}
|
|
2391
|
-
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2392
|
-
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2393
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2391
|
+
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2392
|
+
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
|
|
2393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
2394
2394
|
type: Injectable,
|
|
2395
2395
|
args: [{ providedIn: 'root' }]
|
|
2396
2396
|
}] });
|
|
@@ -2455,13 +2455,15 @@ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
|
2455
2455
|
* @publicApi
|
|
2456
2456
|
*/
|
|
2457
2457
|
class RouterOutlet {
|
|
2458
|
-
constructor(
|
|
2459
|
-
this.parentContexts = parentContexts;
|
|
2460
|
-
this.location = location;
|
|
2461
|
-
this.changeDetector = changeDetector;
|
|
2462
|
-
this.environmentInjector = environmentInjector;
|
|
2458
|
+
constructor() {
|
|
2463
2459
|
this.activated = null;
|
|
2464
2460
|
this._activatedRoute = null;
|
|
2461
|
+
/**
|
|
2462
|
+
* The name of the outlet
|
|
2463
|
+
*
|
|
2464
|
+
* @see [named outlets](guide/router-tutorial-toh#displaying-multiple-routes-in-named-outlets)
|
|
2465
|
+
*/
|
|
2466
|
+
this.name = PRIMARY_OUTLET;
|
|
2465
2467
|
this.activateEvents = new EventEmitter();
|
|
2466
2468
|
this.deactivateEvents = new EventEmitter();
|
|
2467
2469
|
/**
|
|
@@ -2474,31 +2476,59 @@ class RouterOutlet {
|
|
|
2474
2476
|
* subtree.
|
|
2475
2477
|
*/
|
|
2476
2478
|
this.detachEvents = new EventEmitter();
|
|
2477
|
-
this.
|
|
2478
|
-
|
|
2479
|
+
this.parentContexts = inject(ChildrenOutletContexts);
|
|
2480
|
+
this.location = inject(ViewContainerRef);
|
|
2481
|
+
this.changeDetector = inject(ChangeDetectorRef);
|
|
2482
|
+
this.environmentInjector = inject(EnvironmentInjector);
|
|
2483
|
+
}
|
|
2484
|
+
/** @nodoc */
|
|
2485
|
+
ngOnChanges(changes) {
|
|
2486
|
+
if (changes['name']) {
|
|
2487
|
+
const { firstChange, previousValue } = changes['name'];
|
|
2488
|
+
if (firstChange) {
|
|
2489
|
+
// The first change is handled by ngOnInit. Because ngOnChanges doesn't get called when no
|
|
2490
|
+
// input is set at all, we need to centrally handle the first change there.
|
|
2491
|
+
return;
|
|
2492
|
+
}
|
|
2493
|
+
// unregister with the old name
|
|
2494
|
+
if (this.isTrackedInParentContexts(previousValue)) {
|
|
2495
|
+
this.deactivate();
|
|
2496
|
+
this.parentContexts.onChildOutletDestroyed(previousValue);
|
|
2497
|
+
}
|
|
2498
|
+
// register the new name
|
|
2499
|
+
this.initializeOutletWithName();
|
|
2500
|
+
}
|
|
2479
2501
|
}
|
|
2480
2502
|
/** @nodoc */
|
|
2481
2503
|
ngOnDestroy() {
|
|
2482
2504
|
// Ensure that the registered outlet is this one before removing it on the context.
|
|
2483
|
-
if (this.
|
|
2505
|
+
if (this.isTrackedInParentContexts(this.name)) {
|
|
2484
2506
|
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
2485
2507
|
}
|
|
2486
2508
|
}
|
|
2509
|
+
isTrackedInParentContexts(outletName) {
|
|
2510
|
+
return this.parentContexts.getContext(outletName)?.outlet === this;
|
|
2511
|
+
}
|
|
2487
2512
|
/** @nodoc */
|
|
2488
2513
|
ngOnInit() {
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2514
|
+
this.initializeOutletWithName();
|
|
2515
|
+
}
|
|
2516
|
+
initializeOutletWithName() {
|
|
2517
|
+
this.parentContexts.onChildOutletCreated(this.name, this);
|
|
2518
|
+
if (this.activated) {
|
|
2519
|
+
return;
|
|
2520
|
+
}
|
|
2521
|
+
// If the outlet was not instantiated at the time the route got activated we need to populate
|
|
2522
|
+
// the outlet when it is initialized (ie inside a NgIf)
|
|
2523
|
+
const context = this.parentContexts.getContext(this.name);
|
|
2524
|
+
if (context?.route) {
|
|
2525
|
+
if (context.attachRef) {
|
|
2526
|
+
// `attachRef` is populated when there is an existing component to mount
|
|
2527
|
+
this.attach(context.attachRef, context.route);
|
|
2528
|
+
}
|
|
2529
|
+
else {
|
|
2530
|
+
// otherwise the component defined in the configuration is created
|
|
2531
|
+
this.activateWith(context.route, context.injector);
|
|
2502
2532
|
}
|
|
2503
2533
|
}
|
|
2504
2534
|
}
|
|
@@ -2580,19 +2610,18 @@ class RouterOutlet {
|
|
|
2580
2610
|
this.activateEvents.emit(this.activated.instance);
|
|
2581
2611
|
}
|
|
2582
2612
|
}
|
|
2583
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2584
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.
|
|
2585
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2613
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2614
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.6", 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 });
|
|
2615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2586
2616
|
type: Directive,
|
|
2587
2617
|
args: [{
|
|
2588
2618
|
selector: 'router-outlet',
|
|
2589
2619
|
exportAs: 'outlet',
|
|
2590
2620
|
standalone: true,
|
|
2591
2621
|
}]
|
|
2592
|
-
}],
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
}] }, { type: i0.ChangeDetectorRef }, { type: i0.EnvironmentInjector }]; }, propDecorators: { activateEvents: [{
|
|
2622
|
+
}], propDecorators: { name: [{
|
|
2623
|
+
type: Input
|
|
2624
|
+
}], activateEvents: [{
|
|
2596
2625
|
type: Output,
|
|
2597
2626
|
args: ['activate']
|
|
2598
2627
|
}], deactivateEvents: [{
|
|
@@ -2643,9 +2672,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2643
2672
|
*/
|
|
2644
2673
|
class ɵEmptyOutletComponent {
|
|
2645
2674
|
}
|
|
2646
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2647
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0-next.
|
|
2648
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2675
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2676
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0-next.6", 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"] }] });
|
|
2677
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2649
2678
|
type: Component,
|
|
2650
2679
|
args: [{
|
|
2651
2680
|
template: `<router-outlet></router-outlet>`,
|
|
@@ -4331,9 +4360,9 @@ class TitleStrategy {
|
|
|
4331
4360
|
return snapshot.data[RouteTitleKey];
|
|
4332
4361
|
}
|
|
4333
4362
|
}
|
|
4334
|
-
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4335
|
-
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4363
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4364
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4337
4366
|
type: Injectable,
|
|
4338
4367
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4339
4368
|
}] });
|
|
@@ -4357,9 +4386,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
4357
4386
|
}
|
|
4358
4387
|
}
|
|
4359
4388
|
}
|
|
4360
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4361
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4389
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4390
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4363
4392
|
type: Injectable,
|
|
4364
4393
|
args: [{ providedIn: 'root' }]
|
|
4365
4394
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -4459,6 +4488,17 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config'
|
|
|
4459
4488
|
factory: () => ({}),
|
|
4460
4489
|
});
|
|
4461
4490
|
|
|
4491
|
+
/**
|
|
4492
|
+
* @license
|
|
4493
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4494
|
+
*
|
|
4495
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4496
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4497
|
+
*/
|
|
4498
|
+
function deprecatedLoadChildrenString(injector, loadChildren) {
|
|
4499
|
+
return null;
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4462
4502
|
/**
|
|
4463
4503
|
* @license
|
|
4464
4504
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4496,7 +4536,7 @@ class RouterConfigLoader {
|
|
|
4496
4536
|
this.onLoadStartListener(route);
|
|
4497
4537
|
}
|
|
4498
4538
|
const loadRunner = wrapIntoObservable(route.loadComponent())
|
|
4499
|
-
.pipe(tap(component => {
|
|
4539
|
+
.pipe(map(maybeUnwrapDefaultExport), tap(component => {
|
|
4500
4540
|
if (this.onLoadEndListener) {
|
|
4501
4541
|
this.onLoadEndListener(route);
|
|
4502
4542
|
}
|
|
@@ -4555,7 +4595,12 @@ class RouterConfigLoader {
|
|
|
4555
4595
|
return loader;
|
|
4556
4596
|
}
|
|
4557
4597
|
loadModuleFactoryOrRoutes(loadChildren) {
|
|
4558
|
-
|
|
4598
|
+
const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
|
|
4599
|
+
if (deprecatedResult) {
|
|
4600
|
+
return deprecatedResult;
|
|
4601
|
+
}
|
|
4602
|
+
return wrapIntoObservable(loadChildren())
|
|
4603
|
+
.pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
|
|
4559
4604
|
if (t instanceof NgModuleFactory || Array.isArray(t)) {
|
|
4560
4605
|
return of(t);
|
|
4561
4606
|
}
|
|
@@ -4565,12 +4610,23 @@ class RouterConfigLoader {
|
|
|
4565
4610
|
}));
|
|
4566
4611
|
}
|
|
4567
4612
|
}
|
|
4568
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4569
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4570
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
4613
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4614
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4571
4616
|
type: Injectable,
|
|
4572
4617
|
args: [{ providedIn: 'root' }]
|
|
4573
4618
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4619
|
+
function isWrappedDefaultExport(value) {
|
|
4620
|
+
// We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
|
|
4621
|
+
// dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
|
|
4622
|
+
// `default` will be a renamed property.
|
|
4623
|
+
return value && typeof value === 'object' && 'default' in value;
|
|
4624
|
+
}
|
|
4625
|
+
function maybeUnwrapDefaultExport(input) {
|
|
4626
|
+
// As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
|
|
4627
|
+
// subject to property renaming, so we reference it with bracket access.
|
|
4628
|
+
return isWrappedDefaultExport(input) ? input['default'] : input;
|
|
4629
|
+
}
|
|
4574
4630
|
|
|
4575
4631
|
/**
|
|
4576
4632
|
* @license
|
|
@@ -4650,9 +4706,6 @@ function assignExtraOptionsToRouter(opts, router) {
|
|
|
4650
4706
|
if (opts.paramsInheritanceStrategy) {
|
|
4651
4707
|
router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
|
4652
4708
|
}
|
|
4653
|
-
if (opts.relativeLinkResolution) {
|
|
4654
|
-
router.relativeLinkResolution = opts.relativeLinkResolution;
|
|
4655
|
-
}
|
|
4656
4709
|
if (opts.urlUpdateStrategy) {
|
|
4657
4710
|
router.urlUpdateStrategy = opts.urlUpdateStrategy;
|
|
4658
4711
|
}
|
|
@@ -4791,10 +4844,9 @@ class Router {
|
|
|
4791
4844
|
*/
|
|
4792
4845
|
this.urlUpdateStrategy = 'deferred';
|
|
4793
4846
|
/**
|
|
4794
|
-
*
|
|
4795
|
-
*
|
|
4796
|
-
*
|
|
4797
|
-
* @deprecated
|
|
4847
|
+
* TODO(atscott): Remove all references to relativeLinkResolution when internal cleanup is
|
|
4848
|
+
* finished.
|
|
4849
|
+
* @internal
|
|
4798
4850
|
*/
|
|
4799
4851
|
this.relativeLinkResolution = 'corrected';
|
|
4800
4852
|
/**
|
|
@@ -5595,9 +5647,9 @@ class Router {
|
|
|
5595
5647
|
return { navigationId };
|
|
5596
5648
|
}
|
|
5597
5649
|
}
|
|
5598
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
5599
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
5600
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
5650
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5651
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
|
|
5652
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: Router, decorators: [{
|
|
5601
5653
|
type: Injectable,
|
|
5602
5654
|
args: [{
|
|
5603
5655
|
providedIn: 'root',
|
|
@@ -5721,19 +5773,36 @@ function isBrowserTriggeredNavigation(source) {
|
|
|
5721
5773
|
* @publicApi
|
|
5722
5774
|
*/
|
|
5723
5775
|
class RouterLink {
|
|
5724
|
-
constructor(router, route, tabIndexAttribute, renderer, el) {
|
|
5776
|
+
constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) {
|
|
5725
5777
|
this.router = router;
|
|
5726
5778
|
this.route = route;
|
|
5727
5779
|
this.tabIndexAttribute = tabIndexAttribute;
|
|
5728
5780
|
this.renderer = renderer;
|
|
5729
5781
|
this.el = el;
|
|
5782
|
+
this.locationStrategy = locationStrategy;
|
|
5730
5783
|
this._preserveFragment = false;
|
|
5731
5784
|
this._skipLocationChange = false;
|
|
5732
5785
|
this._replaceUrl = false;
|
|
5786
|
+
/**
|
|
5787
|
+
* Represents an `href` attribute value applied to a host element,
|
|
5788
|
+
* when a host element is `<a>`. For other tags, the value is `null`.
|
|
5789
|
+
*/
|
|
5790
|
+
this.href = null;
|
|
5733
5791
|
this.commands = null;
|
|
5734
5792
|
/** @internal */
|
|
5735
5793
|
this.onChanges = new Subject();
|
|
5736
|
-
|
|
5794
|
+
const tagName = el.nativeElement.tagName;
|
|
5795
|
+
this.isAnchorElement = tagName === 'A' || tagName === 'AREA';
|
|
5796
|
+
if (this.isAnchorElement) {
|
|
5797
|
+
this.subscription = router.events.subscribe((s) => {
|
|
5798
|
+
if (s instanceof NavigationEnd) {
|
|
5799
|
+
this.updateHref();
|
|
5800
|
+
}
|
|
5801
|
+
});
|
|
5802
|
+
}
|
|
5803
|
+
else {
|
|
5804
|
+
this.setTabIndexIfNotOnNativeEl('0');
|
|
5805
|
+
}
|
|
5737
5806
|
}
|
|
5738
5807
|
/**
|
|
5739
5808
|
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
@@ -5776,20 +5845,16 @@ class RouterLink {
|
|
|
5776
5845
|
* instantiation.
|
|
5777
5846
|
*/
|
|
5778
5847
|
setTabIndexIfNotOnNativeEl(newTabIndex) {
|
|
5779
|
-
if (this.tabIndexAttribute != null /* both `null` and `undefined` */) {
|
|
5848
|
+
if (this.tabIndexAttribute != null /* both `null` and `undefined` */ || this.isAnchorElement) {
|
|
5780
5849
|
return;
|
|
5781
5850
|
}
|
|
5782
|
-
|
|
5783
|
-
const nativeElement = this.el.nativeElement;
|
|
5784
|
-
if (newTabIndex !== null) {
|
|
5785
|
-
renderer.setAttribute(nativeElement, 'tabindex', newTabIndex);
|
|
5786
|
-
}
|
|
5787
|
-
else {
|
|
5788
|
-
renderer.removeAttribute(nativeElement, 'tabindex');
|
|
5789
|
-
}
|
|
5851
|
+
this.applyAttributeValue('tabindex', newTabIndex);
|
|
5790
5852
|
}
|
|
5791
5853
|
/** @nodoc */
|
|
5792
5854
|
ngOnChanges(changes) {
|
|
5855
|
+
if (this.isAnchorElement) {
|
|
5856
|
+
this.updateHref();
|
|
5857
|
+
}
|
|
5793
5858
|
// This is subscribed to by `RouterLinkActive` so that it knows to update when there are changes
|
|
5794
5859
|
// to the RouterLinks it's tracking.
|
|
5795
5860
|
this.onChanges.next(this);
|
|
@@ -5812,178 +5877,61 @@ class RouterLink {
|
|
|
5812
5877
|
}
|
|
5813
5878
|
}
|
|
5814
5879
|
/** @nodoc */
|
|
5815
|
-
onClick() {
|
|
5880
|
+
onClick(button, ctrlKey, shiftKey, altKey, metaKey) {
|
|
5816
5881
|
if (this.urlTree === null) {
|
|
5817
5882
|
return true;
|
|
5818
5883
|
}
|
|
5884
|
+
if (this.isAnchorElement) {
|
|
5885
|
+
if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {
|
|
5886
|
+
return true;
|
|
5887
|
+
}
|
|
5888
|
+
if (typeof this.target === 'string' && this.target != '_self') {
|
|
5889
|
+
return true;
|
|
5890
|
+
}
|
|
5891
|
+
}
|
|
5819
5892
|
const extras = {
|
|
5820
5893
|
skipLocationChange: this.skipLocationChange,
|
|
5821
5894
|
replaceUrl: this.replaceUrl,
|
|
5822
5895
|
state: this.state,
|
|
5823
5896
|
};
|
|
5824
5897
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
return null;
|
|
5830
|
-
}
|
|
5831
|
-
return this.router.createUrlTree(this.commands, {
|
|
5832
|
-
// If the `relativeTo` input is not defined, we want to use `this.route` by default.
|
|
5833
|
-
// Otherwise, we should use the value provided by the user in the input.
|
|
5834
|
-
relativeTo: this.relativeTo !== undefined ? this.relativeTo : this.route,
|
|
5835
|
-
queryParams: this.queryParams,
|
|
5836
|
-
fragment: this.fragment,
|
|
5837
|
-
queryParamsHandling: this.queryParamsHandling,
|
|
5838
|
-
preserveFragment: this.preserveFragment,
|
|
5839
|
-
});
|
|
5840
|
-
}
|
|
5841
|
-
}
|
|
5842
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.4", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5843
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.4", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
5844
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.4", ngImport: i0, type: RouterLink, decorators: [{
|
|
5845
|
-
type: Directive,
|
|
5846
|
-
args: [{
|
|
5847
|
-
selector: ':not(a):not(area)[routerLink]',
|
|
5848
|
-
standalone: true,
|
|
5849
|
-
}]
|
|
5850
|
-
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
5851
|
-
type: Attribute,
|
|
5852
|
-
args: ['tabindex']
|
|
5853
|
-
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { queryParams: [{
|
|
5854
|
-
type: Input
|
|
5855
|
-
}], fragment: [{
|
|
5856
|
-
type: Input
|
|
5857
|
-
}], queryParamsHandling: [{
|
|
5858
|
-
type: Input
|
|
5859
|
-
}], state: [{
|
|
5860
|
-
type: Input
|
|
5861
|
-
}], relativeTo: [{
|
|
5862
|
-
type: Input
|
|
5863
|
-
}], preserveFragment: [{
|
|
5864
|
-
type: Input
|
|
5865
|
-
}], skipLocationChange: [{
|
|
5866
|
-
type: Input
|
|
5867
|
-
}], replaceUrl: [{
|
|
5868
|
-
type: Input
|
|
5869
|
-
}], routerLink: [{
|
|
5870
|
-
type: Input
|
|
5871
|
-
}], onClick: [{
|
|
5872
|
-
type: HostListener,
|
|
5873
|
-
args: ['click']
|
|
5874
|
-
}] } });
|
|
5875
|
-
/**
|
|
5876
|
-
* @description
|
|
5877
|
-
*
|
|
5878
|
-
* Lets you link to specific routes in your app.
|
|
5879
|
-
*
|
|
5880
|
-
* See `RouterLink` for more information.
|
|
5881
|
-
*
|
|
5882
|
-
* @ngModule RouterModule
|
|
5883
|
-
*
|
|
5884
|
-
* @publicApi
|
|
5885
|
-
*/
|
|
5886
|
-
class RouterLinkWithHref {
|
|
5887
|
-
constructor(router, route, locationStrategy) {
|
|
5888
|
-
this.router = router;
|
|
5889
|
-
this.route = route;
|
|
5890
|
-
this.locationStrategy = locationStrategy;
|
|
5891
|
-
this._preserveFragment = false;
|
|
5892
|
-
this._skipLocationChange = false;
|
|
5893
|
-
this._replaceUrl = false;
|
|
5894
|
-
this.commands = null;
|
|
5895
|
-
// the url displayed on the anchor element.
|
|
5896
|
-
// @HostBinding('attr.href') is used rather than @HostBinding() because it removes the
|
|
5897
|
-
// href attribute when it becomes `null`.
|
|
5898
|
-
this.href = null;
|
|
5899
|
-
/** @internal */
|
|
5900
|
-
this.onChanges = new Subject();
|
|
5901
|
-
this.subscription = router.events.subscribe((s) => {
|
|
5902
|
-
if (s instanceof NavigationEnd) {
|
|
5903
|
-
this.updateTargetUrlAndHref();
|
|
5904
|
-
}
|
|
5905
|
-
});
|
|
5906
|
-
}
|
|
5907
|
-
/**
|
|
5908
|
-
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5909
|
-
* `UrlCreationOptions`.
|
|
5910
|
-
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5911
|
-
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5912
|
-
*/
|
|
5913
|
-
set preserveFragment(preserveFragment) {
|
|
5914
|
-
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5915
|
-
}
|
|
5916
|
-
get preserveFragment() {
|
|
5917
|
-
return this._preserveFragment;
|
|
5918
|
-
}
|
|
5919
|
-
/**
|
|
5920
|
-
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5921
|
-
* `NavigationBehaviorOptions`.
|
|
5922
|
-
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5923
|
-
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5924
|
-
*/
|
|
5925
|
-
set skipLocationChange(skipLocationChange) {
|
|
5926
|
-
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5927
|
-
}
|
|
5928
|
-
get skipLocationChange() {
|
|
5929
|
-
return this._skipLocationChange;
|
|
5930
|
-
}
|
|
5931
|
-
/**
|
|
5932
|
-
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5933
|
-
* `NavigationBehaviorOptions`.
|
|
5934
|
-
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5935
|
-
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5936
|
-
*/
|
|
5937
|
-
set replaceUrl(replaceUrl) {
|
|
5938
|
-
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5939
|
-
}
|
|
5940
|
-
get replaceUrl() {
|
|
5941
|
-
return this._replaceUrl;
|
|
5942
|
-
}
|
|
5943
|
-
/**
|
|
5944
|
-
* Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
5945
|
-
* - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
5946
|
-
* - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
|
|
5947
|
-
* - **null|undefined**: Disables the link by removing the `href`
|
|
5948
|
-
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5949
|
-
*/
|
|
5950
|
-
set routerLink(commands) {
|
|
5951
|
-
if (commands != null) {
|
|
5952
|
-
this.commands = Array.isArray(commands) ? commands : [commands];
|
|
5953
|
-
}
|
|
5954
|
-
else {
|
|
5955
|
-
this.commands = null;
|
|
5956
|
-
}
|
|
5957
|
-
}
|
|
5958
|
-
/** @nodoc */
|
|
5959
|
-
ngOnChanges(changes) {
|
|
5960
|
-
this.updateTargetUrlAndHref();
|
|
5961
|
-
this.onChanges.next(this);
|
|
5898
|
+
// Return `false` for `<a>` elements to prevent default action
|
|
5899
|
+
// and cancel the native behavior, since the navigation is handled
|
|
5900
|
+
// by the Router.
|
|
5901
|
+
return !this.isAnchorElement;
|
|
5962
5902
|
}
|
|
5963
5903
|
/** @nodoc */
|
|
5964
5904
|
ngOnDestroy() {
|
|
5965
|
-
this.subscription
|
|
5905
|
+
this.subscription?.unsubscribe();
|
|
5966
5906
|
}
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5907
|
+
updateHref() {
|
|
5908
|
+
this.href = this.urlTree !== null && this.locationStrategy ?
|
|
5909
|
+
this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(this.urlTree)) :
|
|
5910
|
+
null;
|
|
5911
|
+
const sanitizedValue = this.href === null ?
|
|
5912
|
+
null :
|
|
5913
|
+
// This class represents a directive that can be added to both `<a>` elements,
|
|
5914
|
+
// as well as other elements. As a result, we can't define security context at
|
|
5915
|
+
// compile time. So the security context is deferred to runtime.
|
|
5916
|
+
// The `ɵɵsanitizeUrlOrResourceUrl` selects the necessary sanitizer function
|
|
5917
|
+
// based on the tag and property names. The logic mimics the one from
|
|
5918
|
+
// `packages/compiler/src/schema/dom_security_schema.ts`, which is used at compile time.
|
|
5919
|
+
//
|
|
5920
|
+
// Note: we should investigate whether we can switch to using `@HostBinding('attr.href')`
|
|
5921
|
+
// instead of applying a value via a renderer, after a final merge of the
|
|
5922
|
+
// `RouterLinkWithHref` directive.
|
|
5923
|
+
ɵɵsanitizeUrlOrResourceUrl(this.href, this.el.nativeElement.tagName.toLowerCase(), 'href');
|
|
5924
|
+
this.applyAttributeValue('href', sanitizedValue);
|
|
5925
|
+
}
|
|
5926
|
+
applyAttributeValue(attrName, attrValue) {
|
|
5927
|
+
const renderer = this.renderer;
|
|
5928
|
+
const nativeElement = this.el.nativeElement;
|
|
5929
|
+
if (attrValue !== null) {
|
|
5930
|
+
renderer.setAttribute(nativeElement, attrName, attrValue);
|
|
5971
5931
|
}
|
|
5972
|
-
|
|
5973
|
-
|
|
5932
|
+
else {
|
|
5933
|
+
renderer.removeAttribute(nativeElement, attrName);
|
|
5974
5934
|
}
|
|
5975
|
-
const extras = {
|
|
5976
|
-
skipLocationChange: this.skipLocationChange,
|
|
5977
|
-
replaceUrl: this.replaceUrl,
|
|
5978
|
-
state: this.state
|
|
5979
|
-
};
|
|
5980
|
-
this.router.navigateByUrl(this.urlTree, extras);
|
|
5981
|
-
return false;
|
|
5982
|
-
}
|
|
5983
|
-
updateTargetUrlAndHref() {
|
|
5984
|
-
this.href = this.urlTree !== null ?
|
|
5985
|
-
this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.urlTree)) :
|
|
5986
|
-
null;
|
|
5987
5935
|
}
|
|
5988
5936
|
get urlTree() {
|
|
5989
5937
|
if (this.commands === null) {
|
|
@@ -6000,12 +5948,18 @@ class RouterLinkWithHref {
|
|
|
6000
5948
|
});
|
|
6001
5949
|
}
|
|
6002
5950
|
}
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
5951
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", 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 });
|
|
5952
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.6", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink],a[routerLink],area[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 });
|
|
5953
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterLink, decorators: [{
|
|
6006
5954
|
type: Directive,
|
|
6007
|
-
args: [{
|
|
6008
|
-
|
|
5955
|
+
args: [{
|
|
5956
|
+
selector: ':not(a):not(area)[routerLink],a[routerLink],area[routerLink]',
|
|
5957
|
+
standalone: true,
|
|
5958
|
+
}]
|
|
5959
|
+
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
5960
|
+
type: Attribute,
|
|
5961
|
+
args: ['tabindex']
|
|
5962
|
+
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
6009
5963
|
type: HostBinding,
|
|
6010
5964
|
args: ['attr.target']
|
|
6011
5965
|
}, {
|
|
@@ -6020,9 +5974,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.4",
|
|
|
6020
5974
|
type: Input
|
|
6021
5975
|
}], relativeTo: [{
|
|
6022
5976
|
type: Input
|
|
6023
|
-
}], href: [{
|
|
6024
|
-
type: HostBinding,
|
|
6025
|
-
args: ['attr.href']
|
|
6026
5977
|
}], preserveFragment: [{
|
|
6027
5978
|
type: Input
|
|
6028
5979
|
}], skipLocationChange: [{
|
|
@@ -6114,13 +6065,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.4",
|
|
|
6114
6065
|
* @publicApi
|
|
6115
6066
|
*/
|
|
6116
6067
|
class RouterLinkActive {
|
|
6117
|
-
constructor(router, element, renderer, cdr, link
|
|
6068
|
+
constructor(router, element, renderer, cdr, link) {
|
|
6118
6069
|
this.router = router;
|
|
6119
6070
|
this.element = element;
|
|
6120
6071
|
this.renderer = renderer;
|
|
6121
6072
|
this.cdr = cdr;
|
|
6122
6073
|
this.link = link;
|
|
6123
|
-
this.linkWithHref = linkWithHref;
|
|
6124
6074
|
this.classes = [];
|
|
6125
6075
|
this.isActive = false;
|
|
6126
6076
|
/**
|
|
@@ -6157,14 +6107,14 @@ class RouterLinkActive {
|
|
|
6157
6107
|
/** @nodoc */
|
|
6158
6108
|
ngAfterContentInit() {
|
|
6159
6109
|
// `of(null)` is used to force subscribe body to execute once immediately (like `startWith`).
|
|
6160
|
-
of(this.links.changes,
|
|
6110
|
+
of(this.links.changes, of(null)).pipe(mergeAll()).subscribe(_ => {
|
|
6161
6111
|
this.update();
|
|
6162
6112
|
this.subscribeToEachLinkOnChanges();
|
|
6163
6113
|
});
|
|
6164
6114
|
}
|
|
6165
6115
|
subscribeToEachLinkOnChanges() {
|
|
6166
6116
|
this.linkInputChangesSubscription?.unsubscribe();
|
|
6167
|
-
const allLinkChanges = [...this.links.toArray(),
|
|
6117
|
+
const allLinkChanges = [...this.links.toArray(), this.link]
|
|
6168
6118
|
.filter((link) => !!link)
|
|
6169
6119
|
.map(link => link.onChanges);
|
|
6170
6120
|
this.linkInputChangesSubscription = from(allLinkChanges).pipe(mergeAll()).subscribe(link => {
|
|
@@ -6187,7 +6137,7 @@ class RouterLinkActive {
|
|
|
6187
6137
|
this.linkInputChangesSubscription?.unsubscribe();
|
|
6188
6138
|
}
|
|
6189
6139
|
update() {
|
|
6190
|
-
if (!this.links || !this.
|
|
6140
|
+
if (!this.links || !this.router.navigated)
|
|
6191
6141
|
return;
|
|
6192
6142
|
Promise.resolve().then(() => {
|
|
6193
6143
|
const hasActiveLinks = this.hasActiveLinks();
|
|
@@ -6222,14 +6172,12 @@ class RouterLinkActive {
|
|
|
6222
6172
|
}
|
|
6223
6173
|
hasActiveLinks() {
|
|
6224
6174
|
const isActiveCheckFn = this.isLinkActive(this.router);
|
|
6225
|
-
return this.link && isActiveCheckFn(this.link) ||
|
|
6226
|
-
this.linkWithHref && isActiveCheckFn(this.linkWithHref) ||
|
|
6227
|
-
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
6175
|
+
return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
|
|
6228
6176
|
}
|
|
6229
6177
|
}
|
|
6230
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6231
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.
|
|
6232
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6178
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
6179
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.6", 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 });
|
|
6180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
6233
6181
|
type: Directive,
|
|
6234
6182
|
args: [{
|
|
6235
6183
|
selector: '[routerLinkActive]',
|
|
@@ -6238,14 +6186,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.4",
|
|
|
6238
6186
|
}]
|
|
6239
6187
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
|
|
6240
6188
|
type: Optional
|
|
6241
|
-
}] }, { type: RouterLinkWithHref, decorators: [{
|
|
6242
|
-
type: Optional
|
|
6243
6189
|
}] }]; }, propDecorators: { links: [{
|
|
6244
6190
|
type: ContentChildren,
|
|
6245
6191
|
args: [RouterLink, { descendants: true }]
|
|
6246
|
-
}], linksWithHrefs: [{
|
|
6247
|
-
type: ContentChildren,
|
|
6248
|
-
args: [RouterLinkWithHref, { descendants: true }]
|
|
6249
6192
|
}], routerLinkActiveOptions: [{
|
|
6250
6193
|
type: Input
|
|
6251
6194
|
}], ariaCurrentWhenActive: [{
|
|
@@ -6294,9 +6237,9 @@ class PreloadAllModules {
|
|
|
6294
6237
|
return fn().pipe(catchError(() => of(null)));
|
|
6295
6238
|
}
|
|
6296
6239
|
}
|
|
6297
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6298
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6299
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6240
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6241
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6300
6243
|
type: Injectable,
|
|
6301
6244
|
args: [{ providedIn: 'root' }]
|
|
6302
6245
|
}] });
|
|
@@ -6314,9 +6257,9 @@ class NoPreloading {
|
|
|
6314
6257
|
return of(null);
|
|
6315
6258
|
}
|
|
6316
6259
|
}
|
|
6317
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6318
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6319
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6260
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6261
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6320
6263
|
type: Injectable,
|
|
6321
6264
|
args: [{ providedIn: 'root' }]
|
|
6322
6265
|
}] });
|
|
@@ -6410,9 +6353,9 @@ class RouterPreloader {
|
|
|
6410
6353
|
});
|
|
6411
6354
|
}
|
|
6412
6355
|
}
|
|
6413
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6414
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6415
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6356
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6357
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
|
|
6358
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6416
6359
|
type: Injectable,
|
|
6417
6360
|
args: [{ providedIn: 'root' }]
|
|
6418
6361
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
@@ -6500,9 +6443,9 @@ class RouterScroller {
|
|
|
6500
6443
|
}
|
|
6501
6444
|
}
|
|
6502
6445
|
}
|
|
6503
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6504
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6505
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6446
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6447
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterScroller });
|
|
6448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6506
6449
|
type: Injectable
|
|
6507
6450
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6508
6451
|
|
|
@@ -6552,7 +6495,7 @@ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
|
6552
6495
|
* @returns A set of providers to setup a Router.
|
|
6553
6496
|
*/
|
|
6554
6497
|
function provideRouter(routes, ...features) {
|
|
6555
|
-
return [
|
|
6498
|
+
return makeEnvironmentProviders([
|
|
6556
6499
|
provideRoutes(routes), { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6557
6500
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
6558
6501
|
features.map(feature => feature.ɵproviders),
|
|
@@ -6560,7 +6503,7 @@ function provideRouter(routes, ...features) {
|
|
|
6560
6503
|
// how we want them to be configured. This API doesn't currently have a way to configure them
|
|
6561
6504
|
// and we should decide what the _best_ way to do that is rather than just sticking with the
|
|
6562
6505
|
// status quo of how it's done today.
|
|
6563
|
-
];
|
|
6506
|
+
]);
|
|
6564
6507
|
}
|
|
6565
6508
|
function rootRoute(router) {
|
|
6566
6509
|
return router.routerState.root;
|
|
@@ -6926,7 +6869,7 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
|
6926
6869
|
/**
|
|
6927
6870
|
* The directives defined in the `RouterModule`.
|
|
6928
6871
|
*/
|
|
6929
|
-
const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink,
|
|
6872
|
+
const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent];
|
|
6930
6873
|
/**
|
|
6931
6874
|
* @docsNotRequired
|
|
6932
6875
|
*/
|
|
@@ -7029,10 +6972,10 @@ class RouterModule {
|
|
|
7029
6972
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
7030
6973
|
}
|
|
7031
6974
|
}
|
|
7032
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
7033
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.
|
|
7034
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
7035
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
6975
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6976
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6977
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
|
|
6978
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: RouterModule, decorators: [{
|
|
7036
6979
|
type: NgModule,
|
|
7037
6980
|
args: [{
|
|
7038
6981
|
imports: ROUTER_DIRECTIVES,
|
|
@@ -7116,7 +7059,7 @@ function provideRouterInitializer() {
|
|
|
7116
7059
|
/**
|
|
7117
7060
|
* @publicApi
|
|
7118
7061
|
*/
|
|
7119
|
-
const VERSION = new Version('15.0.0-next.
|
|
7062
|
+
const VERSION = new Version('15.0.0-next.6');
|
|
7120
7063
|
|
|
7121
7064
|
/**
|
|
7122
7065
|
* @license
|
|
@@ -7155,5 +7098,5 @@ const VERSION = new Version('15.0.0-next.4');
|
|
|
7155
7098
|
* Generated bundle index. Do not edit.
|
|
7156
7099
|
*/
|
|
7157
7100
|
|
|
7158
|
-
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, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
|
|
7101
|
+
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, 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, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
|
|
7159
7102
|
//# sourceMappingURL=router.mjs.map
|