@angular/router 13.0.0-next.9 → 13.0.0-rc.3
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/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/esm2020/router.mjs +5 -0
- package/{esm2015/src/apply_redirects.js → esm2020/src/apply_redirects.mjs} +0 -0
- package/esm2020/src/components/empty_outlet.mjs +29 -0
- package/{esm2015/src/config.js → esm2020/src/config.mjs} +0 -0
- package/esm2020/src/create_router_state.mjs +52 -0
- package/{esm2015/src/create_url_tree.js → esm2020/src/create_url_tree.mjs} +0 -0
- package/esm2020/src/directives/router_link.mjs +353 -0
- package/esm2020/src/directives/router_link_active.mjs +215 -0
- package/esm2020/src/directives/router_outlet.mjs +219 -0
- package/{esm2015/src/events.js → esm2020/src/events.mjs} +0 -0
- package/{esm2015/src/index.js → esm2020/src/index.mjs} +0 -0
- package/{esm2015/src/interfaces.js → esm2020/src/interfaces.mjs} +0 -0
- package/{esm2015/src/operators/activate_routes.js → esm2020/src/operators/activate_routes.mjs} +8 -6
- package/esm2020/src/operators/apply_redirects.mjs +14 -0
- package/esm2020/src/operators/check_guards.mjs +138 -0
- package/{esm2015/src/operators/prioritized_guard_value.js → esm2020/src/operators/prioritized_guard_value.mjs} +0 -0
- package/esm2020/src/operators/recognize.mjs +14 -0
- package/esm2020/src/operators/resolve_data.mjs +59 -0
- package/{esm2015/src/operators/switch_tap.js → esm2020/src/operators/switch_tap.mjs} +0 -0
- package/{esm2015/src/private_export.js → esm2020/src/private_export.mjs} +0 -0
- package/esm2020/src/recognize.mjs +262 -0
- package/{esm2015/src/route_reuse_strategy.js → esm2020/src/route_reuse_strategy.mjs} +0 -0
- package/esm2020/src/router.mjs +1009 -0
- package/{esm2015/src/router_config_loader.js → esm2020/src/router_config_loader.mjs} +0 -0
- package/esm2020/src/router_module.mjs +370 -0
- package/esm2020/src/router_outlet_context.mjs +74 -0
- package/esm2020/src/router_preloader.mjs +127 -0
- package/esm2020/src/router_scroller.mjs +95 -0
- package/esm2020/src/router_state.mjs +404 -0
- package/{esm2015/src/shared.js → esm2020/src/shared.mjs} +0 -0
- package/{esm2015/src/url_handling_strategy.js → esm2020/src/url_handling_strategy.mjs} +0 -0
- package/{esm2015/src/url_tree.js → esm2020/src/url_tree.mjs} +0 -0
- package/{esm2015/src/utils/collection.js → esm2020/src/utils/collection.mjs} +0 -0
- package/{esm2015/src/utils/config.js → esm2020/src/utils/config.mjs} +2 -2
- package/esm2020/src/utils/config_matching.mjs +145 -0
- package/{esm2015/src/utils/preactivation.js → esm2020/src/utils/preactivation.mjs} +0 -0
- package/{esm2015/src/utils/tree.js → esm2020/src/utils/tree.mjs} +0 -0
- package/{esm2015/src/utils/type_guards.js → esm2020/src/utils/type_guards.mjs} +0 -0
- package/{esm2015/src/version.js → esm2020/src/version.mjs} +1 -1
- package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
- package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
- package/esm2020/testing/src/extra_router_testing_providers.mjs +10 -0
- package/esm2020/testing/src/router_testing_module.mjs +122 -0
- package/esm2020/testing/src/spy_ng_module_factory_loader.mjs +10 -0
- package/esm2020/testing/src/testing.mjs +15 -0
- package/{esm2015/testing/testing.js → esm2020/testing/testing.mjs} +0 -0
- package/{esm2015/upgrade/index.js → esm2020/upgrade/index.mjs} +0 -0
- package/{esm2015/upgrade/public_api.js → esm2020/upgrade/public_api.mjs} +0 -0
- package/esm2020/upgrade/src/upgrade.mjs +120 -0
- package/{esm2015/upgrade/upgrade.js → esm2020/upgrade/upgrade.mjs} +0 -0
- package/fesm2015/{router.js → router.mjs} +507 -505
- package/fesm2015/router.mjs.map +1 -0
- package/fesm2015/{testing.js → testing.mjs} +66 -21
- package/fesm2015/testing.mjs.map +1 -0
- package/fesm2015/{upgrade.js → upgrade.mjs} +4 -5
- package/fesm2015/upgrade.mjs.map +1 -0
- package/fesm2020/router.mjs +6157 -0
- package/fesm2020/router.mjs.map +1 -0
- package/fesm2020/testing.mjs +179 -0
- package/fesm2020/testing.mjs.map +1 -0
- package/fesm2020/upgrade.mjs +150 -0
- package/fesm2020/upgrade.mjs.map +1 -0
- package/package.json +41 -11
- package/router.d.ts +84 -93
- package/testing/package.json +5 -5
- package/testing/testing.d.ts +6 -1
- package/upgrade/package.json +5 -5
- package/upgrade/upgrade.d.ts +1 -1
- package/bundles/router-testing.umd.js +0 -143
- package/bundles/router-testing.umd.js.map +0 -1
- package/bundles/router-upgrade.umd.js +0 -157
- package/bundles/router-upgrade.umd.js.map +0 -1
- package/bundles/router.umd.js +0 -6878
- package/bundles/router.umd.js.map +0 -1
- package/esm2015/router.externs.js +0 -6
- package/esm2015/router.js +0 -9
- package/esm2015/src/components/empty_outlet.js +0 -24
- package/esm2015/src/create_router_state.js +0 -63
- package/esm2015/src/directives/router_link.js +0 -328
- package/esm2015/src/directives/router_link_active.js +0 -210
- package/esm2015/src/directives/router_outlet.js +0 -212
- package/esm2015/src/operators/apply_redirects.js +0 -14
- package/esm2015/src/operators/check_guards.js +0 -138
- package/esm2015/src/operators/recognize.js +0 -14
- package/esm2015/src/operators/resolve_data.js +0 -56
- package/esm2015/src/recognize.js +0 -262
- package/esm2015/src/router.js +0 -1011
- package/esm2015/src/router_module.js +0 -362
- package/esm2015/src/router_outlet_context.js +0 -73
- package/esm2015/src/router_preloader.js +0 -129
- package/esm2015/src/router_scroller.js +0 -95
- package/esm2015/src/router_state.js +0 -404
- package/esm2015/src/utils/config_matching.js +0 -145
- package/esm2015/testing/src/router_testing_module.js +0 -96
- package/esm2015/testing/src/testing.js +0 -14
- package/esm2015/testing/testing.externs.js +0 -6
- package/esm2015/upgrade/src/upgrade.js +0 -122
- package/esm2015/upgrade/upgrade.externs.js +0 -6
- package/fesm2015/router.js.map +0 -1
- package/fesm2015/testing.js.map +0 -1
- package/fesm2015/upgrade.js.map +0 -1
- package/router.metadata.json +0 -1
- package/testing/testing.metadata.json +0 -1
- package/testing.d.ts +0 -7
- package/testing.metadata.json +0 -1
- package/upgrade/upgrade.metadata.json +0 -1
- package/upgrade.d.ts +0 -7
- package/upgrade.metadata.json +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.0.0-
|
|
2
|
+
* @license Angular v13.0.0-rc.3
|
|
3
3
|
* (c) 2010-2021 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import { ɵisObservable, ɵisPromise, Component, NgModuleRef, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, Injectable,
|
|
7
|
+
import * as i0 from '@angular/core';
|
|
8
|
+
import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, NgModuleRef, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, Injectable, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
|
|
9
9
|
import { from, of, BehaviorSubject, combineLatest, Observable, EmptyError, concat, defer, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, refCount, finalize, mergeAll } from 'rxjs/operators';
|
|
11
|
+
import * as i3 from '@angular/common';
|
|
12
|
+
import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @license
|
|
@@ -1677,7 +1679,8 @@ function createNode(routeReuseStrategy, curr, prevState) {
|
|
|
1677
1679
|
const detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);
|
|
1678
1680
|
if (detachedRouteHandle !== null) {
|
|
1679
1681
|
const tree = detachedRouteHandle.route;
|
|
1680
|
-
|
|
1682
|
+
tree.value._futureSnapshot = curr.value;
|
|
1683
|
+
tree.children = curr.children.map(c => createNode(routeReuseStrategy, c));
|
|
1681
1684
|
return tree;
|
|
1682
1685
|
}
|
|
1683
1686
|
}
|
|
@@ -1686,18 +1689,6 @@ function createNode(routeReuseStrategy, curr, prevState) {
|
|
|
1686
1689
|
return new TreeNode(value, children);
|
|
1687
1690
|
}
|
|
1688
1691
|
}
|
|
1689
|
-
function setFutureSnapshotsOfActivatedRoutes(curr, result) {
|
|
1690
|
-
if (curr.value.routeConfig !== result.value.routeConfig) {
|
|
1691
|
-
throw new Error('Cannot reattach ActivatedRouteSnapshot created from a different route');
|
|
1692
|
-
}
|
|
1693
|
-
if (curr.children.length !== result.children.length) {
|
|
1694
|
-
throw new Error('Cannot reattach ActivatedRouteSnapshot with a different number of children');
|
|
1695
|
-
}
|
|
1696
|
-
result.value._futureSnapshot = curr.value;
|
|
1697
|
-
for (let i = 0; i < curr.children.length; ++i) {
|
|
1698
|
-
setFutureSnapshotsOfActivatedRoutes(curr.children[i], result.children[i]);
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
1692
|
function createOrReuseChildren(routeReuseStrategy, curr, prevState) {
|
|
1702
1693
|
return curr.children.map(child => {
|
|
1703
1694
|
for (const p of prevState.children) {
|
|
@@ -2079,6 +2070,11 @@ class ActivateRoutes {
|
|
|
2079
2070
|
}
|
|
2080
2071
|
detachAndStoreRouteSubtree(route, parentContexts) {
|
|
2081
2072
|
const context = parentContexts.getContext(route.value.outlet);
|
|
2073
|
+
const contexts = context && route.value.component ? context.children : parentContexts;
|
|
2074
|
+
const children = nodeChildrenAsMap(route);
|
|
2075
|
+
for (const childOutlet of Object.keys(children)) {
|
|
2076
|
+
this.deactivateRouteAndItsChildren(children[childOutlet], contexts);
|
|
2077
|
+
}
|
|
2082
2078
|
if (context && context.outlet) {
|
|
2083
2079
|
const componentRef = context.outlet.detach();
|
|
2084
2080
|
const contexts = context.children.onOutletDeactivated();
|
|
@@ -2147,7 +2143,8 @@ class ActivateRoutes {
|
|
|
2147
2143
|
// Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated
|
|
2148
2144
|
context.outlet.attach(stored.componentRef, stored.route.value);
|
|
2149
2145
|
}
|
|
2150
|
-
|
|
2146
|
+
advanceActivatedRoute(stored.route.value);
|
|
2147
|
+
this.activateChildRoutes(futureNode, null, context.children);
|
|
2151
2148
|
}
|
|
2152
2149
|
else {
|
|
2153
2150
|
const config = parentLoadedConfig(future.snapshot);
|
|
@@ -2170,10 +2167,6 @@ class ActivateRoutes {
|
|
|
2170
2167
|
}
|
|
2171
2168
|
}
|
|
2172
2169
|
}
|
|
2173
|
-
function advanceActivatedRouteNodeAndItsChildren(node) {
|
|
2174
|
-
advanceActivatedRoute(node.value);
|
|
2175
|
-
node.children.forEach(advanceActivatedRouteNodeAndItsChildren);
|
|
2176
|
-
}
|
|
2177
2170
|
function parentLoadedConfig(snapshot) {
|
|
2178
2171
|
for (let s = snapshot.parent; s; s = s.parent) {
|
|
2179
2172
|
const route = s.routeConfig;
|
|
@@ -2280,6 +2273,295 @@ function prioritizedGuardValue() {
|
|
|
2280
2273
|
});
|
|
2281
2274
|
}
|
|
2282
2275
|
|
|
2276
|
+
/**
|
|
2277
|
+
* @license
|
|
2278
|
+
* Copyright Google LLC All Rights Reserved.
|
|
2279
|
+
*
|
|
2280
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
2281
|
+
* found in the LICENSE file at https://angular.io/license
|
|
2282
|
+
*/
|
|
2283
|
+
/**
|
|
2284
|
+
* Store contextual information about a `RouterOutlet`
|
|
2285
|
+
*
|
|
2286
|
+
* @publicApi
|
|
2287
|
+
*/
|
|
2288
|
+
class OutletContext {
|
|
2289
|
+
constructor() {
|
|
2290
|
+
this.outlet = null;
|
|
2291
|
+
this.route = null;
|
|
2292
|
+
this.resolver = null;
|
|
2293
|
+
this.children = new ChildrenOutletContexts();
|
|
2294
|
+
this.attachRef = null;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Store contextual information about the children (= nested) `RouterOutlet`
|
|
2299
|
+
*
|
|
2300
|
+
* @publicApi
|
|
2301
|
+
*/
|
|
2302
|
+
class ChildrenOutletContexts {
|
|
2303
|
+
constructor() {
|
|
2304
|
+
// contexts for child outlets, by name.
|
|
2305
|
+
this.contexts = new Map();
|
|
2306
|
+
}
|
|
2307
|
+
/** Called when a `RouterOutlet` directive is instantiated */
|
|
2308
|
+
onChildOutletCreated(childName, outlet) {
|
|
2309
|
+
const context = this.getOrCreateContext(childName);
|
|
2310
|
+
context.outlet = outlet;
|
|
2311
|
+
this.contexts.set(childName, context);
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Called when a `RouterOutlet` directive is destroyed.
|
|
2315
|
+
* We need to keep the context as the outlet could be destroyed inside a NgIf and might be
|
|
2316
|
+
* re-created later.
|
|
2317
|
+
*/
|
|
2318
|
+
onChildOutletDestroyed(childName) {
|
|
2319
|
+
const context = this.getContext(childName);
|
|
2320
|
+
if (context) {
|
|
2321
|
+
context.outlet = null;
|
|
2322
|
+
context.attachRef = null;
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
/**
|
|
2326
|
+
* Called when the corresponding route is deactivated during navigation.
|
|
2327
|
+
* Because the component get destroyed, all children outlet are destroyed.
|
|
2328
|
+
*/
|
|
2329
|
+
onOutletDeactivated() {
|
|
2330
|
+
const contexts = this.contexts;
|
|
2331
|
+
this.contexts = new Map();
|
|
2332
|
+
return contexts;
|
|
2333
|
+
}
|
|
2334
|
+
onOutletReAttached(contexts) {
|
|
2335
|
+
this.contexts = contexts;
|
|
2336
|
+
}
|
|
2337
|
+
getOrCreateContext(childName) {
|
|
2338
|
+
let context = this.getContext(childName);
|
|
2339
|
+
if (!context) {
|
|
2340
|
+
context = new OutletContext();
|
|
2341
|
+
this.contexts.set(childName, context);
|
|
2342
|
+
}
|
|
2343
|
+
return context;
|
|
2344
|
+
}
|
|
2345
|
+
getContext(childName) {
|
|
2346
|
+
return this.contexts.get(childName) || null;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
/**
|
|
2351
|
+
* @license
|
|
2352
|
+
* Copyright Google LLC All Rights Reserved.
|
|
2353
|
+
*
|
|
2354
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
2355
|
+
* found in the LICENSE file at https://angular.io/license
|
|
2356
|
+
*/
|
|
2357
|
+
/**
|
|
2358
|
+
* @description
|
|
2359
|
+
*
|
|
2360
|
+
* Acts as a placeholder that Angular dynamically fills based on the current router state.
|
|
2361
|
+
*
|
|
2362
|
+
* Each outlet can have a unique name, determined by the optional `name` attribute.
|
|
2363
|
+
* The name cannot be set or changed dynamically. If not set, default value is "primary".
|
|
2364
|
+
*
|
|
2365
|
+
* ```
|
|
2366
|
+
* <router-outlet></router-outlet>
|
|
2367
|
+
* <router-outlet name='left'></router-outlet>
|
|
2368
|
+
* <router-outlet name='right'></router-outlet>
|
|
2369
|
+
* ```
|
|
2370
|
+
*
|
|
2371
|
+
* Named outlets can be the targets of secondary routes.
|
|
2372
|
+
* The `Route` object for a secondary route has an `outlet` property to identify the target outlet:
|
|
2373
|
+
*
|
|
2374
|
+
* `{path: <base-path>, component: <component>, outlet: <target_outlet_name>}`
|
|
2375
|
+
*
|
|
2376
|
+
* Using named outlets and secondary routes, you can target multiple outlets in
|
|
2377
|
+
* the same `RouterLink` directive.
|
|
2378
|
+
*
|
|
2379
|
+
* The router keeps track of separate branches in a navigation tree for each named outlet and
|
|
2380
|
+
* generates a representation of that tree in the URL.
|
|
2381
|
+
* The URL for a secondary route uses the following syntax to specify both the primary and secondary
|
|
2382
|
+
* routes at the same time:
|
|
2383
|
+
*
|
|
2384
|
+
* `http://base-path/primary-route-path(outlet-name:route-path)`
|
|
2385
|
+
*
|
|
2386
|
+
* A router outlet emits an activate event when a new component is instantiated,
|
|
2387
|
+
* deactivate event when a component is destroyed.
|
|
2388
|
+
* An attached event emits when the `RouteReuseStrategy` instructs the outlet to reattach the
|
|
2389
|
+
* subtree, and the detached event emits when the `RouteReuseStrategy` instructs the outlet to
|
|
2390
|
+
* detach the subtree.
|
|
2391
|
+
*
|
|
2392
|
+
* ```
|
|
2393
|
+
* <router-outlet
|
|
2394
|
+
* (activate)='onActivate($event)'
|
|
2395
|
+
* (deactivate)='onDeactivate($event)'
|
|
2396
|
+
* (attach)='onAttach($event)'
|
|
2397
|
+
* (detach)='onDetach($event)'></router-outlet>
|
|
2398
|
+
* ```
|
|
2399
|
+
*
|
|
2400
|
+
* @see [Routing tutorial](guide/router-tutorial-toh#named-outlets "Example of a named
|
|
2401
|
+
* outlet and secondary route configuration").
|
|
2402
|
+
* @see `RouterLink`
|
|
2403
|
+
* @see `Route`
|
|
2404
|
+
* @ngModule RouterModule
|
|
2405
|
+
*
|
|
2406
|
+
* @publicApi
|
|
2407
|
+
*/
|
|
2408
|
+
class RouterOutlet {
|
|
2409
|
+
constructor(parentContexts, location, resolver, name, changeDetector) {
|
|
2410
|
+
this.parentContexts = parentContexts;
|
|
2411
|
+
this.location = location;
|
|
2412
|
+
this.resolver = resolver;
|
|
2413
|
+
this.changeDetector = changeDetector;
|
|
2414
|
+
this.activated = null;
|
|
2415
|
+
this._activatedRoute = null;
|
|
2416
|
+
this.activateEvents = new EventEmitter();
|
|
2417
|
+
this.deactivateEvents = new EventEmitter();
|
|
2418
|
+
/**
|
|
2419
|
+
* Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a
|
|
2420
|
+
* previously detached subtree.
|
|
2421
|
+
**/
|
|
2422
|
+
this.attachEvents = new EventEmitter();
|
|
2423
|
+
/**
|
|
2424
|
+
* Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the
|
|
2425
|
+
* subtree.
|
|
2426
|
+
*/
|
|
2427
|
+
this.detachEvents = new EventEmitter();
|
|
2428
|
+
this.name = name || PRIMARY_OUTLET;
|
|
2429
|
+
parentContexts.onChildOutletCreated(this.name, this);
|
|
2430
|
+
}
|
|
2431
|
+
/** @nodoc */
|
|
2432
|
+
ngOnDestroy() {
|
|
2433
|
+
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
2434
|
+
}
|
|
2435
|
+
/** @nodoc */
|
|
2436
|
+
ngOnInit() {
|
|
2437
|
+
if (!this.activated) {
|
|
2438
|
+
// If the outlet was not instantiated at the time the route got activated we need to populate
|
|
2439
|
+
// the outlet when it is initialized (ie inside a NgIf)
|
|
2440
|
+
const context = this.parentContexts.getContext(this.name);
|
|
2441
|
+
if (context && context.route) {
|
|
2442
|
+
if (context.attachRef) {
|
|
2443
|
+
// `attachRef` is populated when there is an existing component to mount
|
|
2444
|
+
this.attach(context.attachRef, context.route);
|
|
2445
|
+
}
|
|
2446
|
+
else {
|
|
2447
|
+
// otherwise the component defined in the configuration is created
|
|
2448
|
+
this.activateWith(context.route, context.resolver || null);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
get isActivated() {
|
|
2454
|
+
return !!this.activated;
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* @returns The currently activated component instance.
|
|
2458
|
+
* @throws An error if the outlet is not activated.
|
|
2459
|
+
*/
|
|
2460
|
+
get component() {
|
|
2461
|
+
if (!this.activated)
|
|
2462
|
+
throw new Error('Outlet is not activated');
|
|
2463
|
+
return this.activated.instance;
|
|
2464
|
+
}
|
|
2465
|
+
get activatedRoute() {
|
|
2466
|
+
if (!this.activated)
|
|
2467
|
+
throw new Error('Outlet is not activated');
|
|
2468
|
+
return this._activatedRoute;
|
|
2469
|
+
}
|
|
2470
|
+
get activatedRouteData() {
|
|
2471
|
+
if (this._activatedRoute) {
|
|
2472
|
+
return this._activatedRoute.snapshot.data;
|
|
2473
|
+
}
|
|
2474
|
+
return {};
|
|
2475
|
+
}
|
|
2476
|
+
/**
|
|
2477
|
+
* Called when the `RouteReuseStrategy` instructs to detach the subtree
|
|
2478
|
+
*/
|
|
2479
|
+
detach() {
|
|
2480
|
+
if (!this.activated)
|
|
2481
|
+
throw new Error('Outlet is not activated');
|
|
2482
|
+
this.location.detach();
|
|
2483
|
+
const cmp = this.activated;
|
|
2484
|
+
this.activated = null;
|
|
2485
|
+
this._activatedRoute = null;
|
|
2486
|
+
this.detachEvents.emit(cmp.instance);
|
|
2487
|
+
return cmp;
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
|
|
2491
|
+
*/
|
|
2492
|
+
attach(ref, activatedRoute) {
|
|
2493
|
+
this.activated = ref;
|
|
2494
|
+
this._activatedRoute = activatedRoute;
|
|
2495
|
+
this.location.insert(ref.hostView);
|
|
2496
|
+
this.attachEvents.emit(ref.instance);
|
|
2497
|
+
}
|
|
2498
|
+
deactivate() {
|
|
2499
|
+
if (this.activated) {
|
|
2500
|
+
const c = this.component;
|
|
2501
|
+
this.activated.destroy();
|
|
2502
|
+
this.activated = null;
|
|
2503
|
+
this._activatedRoute = null;
|
|
2504
|
+
this.deactivateEvents.emit(c);
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
activateWith(activatedRoute, resolver) {
|
|
2508
|
+
if (this.isActivated) {
|
|
2509
|
+
throw new Error('Cannot activate an already activated outlet');
|
|
2510
|
+
}
|
|
2511
|
+
this._activatedRoute = activatedRoute;
|
|
2512
|
+
const snapshot = activatedRoute._futureSnapshot;
|
|
2513
|
+
const component = snapshot.routeConfig.component;
|
|
2514
|
+
resolver = resolver || this.resolver;
|
|
2515
|
+
const factory = resolver.resolveComponentFactory(component);
|
|
2516
|
+
const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
|
|
2517
|
+
const injector = new OutletInjector(activatedRoute, childContexts, this.location.injector);
|
|
2518
|
+
this.activated = this.location.createComponent(factory, this.location.length, injector);
|
|
2519
|
+
// Calling `markForCheck` to make sure we will run the change detection when the
|
|
2520
|
+
// `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
|
|
2521
|
+
this.changeDetector.markForCheck();
|
|
2522
|
+
this.activateEvents.emit(this.activated.instance);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2526
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.3", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2527
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2528
|
+
type: Directive,
|
|
2529
|
+
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2530
|
+
}], ctorParameters: function () {
|
|
2531
|
+
return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
|
|
2532
|
+
type: Attribute,
|
|
2533
|
+
args: ['name']
|
|
2534
|
+
}] }, { type: i0.ChangeDetectorRef }];
|
|
2535
|
+
}, propDecorators: { activateEvents: [{
|
|
2536
|
+
type: Output,
|
|
2537
|
+
args: ['activate']
|
|
2538
|
+
}], deactivateEvents: [{
|
|
2539
|
+
type: Output,
|
|
2540
|
+
args: ['deactivate']
|
|
2541
|
+
}], attachEvents: [{
|
|
2542
|
+
type: Output,
|
|
2543
|
+
args: ['attach']
|
|
2544
|
+
}], detachEvents: [{
|
|
2545
|
+
type: Output,
|
|
2546
|
+
args: ['detach']
|
|
2547
|
+
}] } });
|
|
2548
|
+
class OutletInjector {
|
|
2549
|
+
constructor(route, childContexts, parent) {
|
|
2550
|
+
this.route = route;
|
|
2551
|
+
this.childContexts = childContexts;
|
|
2552
|
+
this.parent = parent;
|
|
2553
|
+
}
|
|
2554
|
+
get(token, notFoundValue) {
|
|
2555
|
+
if (token === ActivatedRoute) {
|
|
2556
|
+
return this.route;
|
|
2557
|
+
}
|
|
2558
|
+
if (token === ChildrenOutletContexts) {
|
|
2559
|
+
return this.childContexts;
|
|
2560
|
+
}
|
|
2561
|
+
return this.parent.get(token, notFoundValue);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2283
2565
|
/**
|
|
2284
2566
|
* @license
|
|
2285
2567
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -2298,9 +2580,12 @@ function prioritizedGuardValue() {
|
|
|
2298
2580
|
*/
|
|
2299
2581
|
class ɵEmptyOutletComponent {
|
|
2300
2582
|
}
|
|
2301
|
-
ɵEmptyOutletComponent
|
|
2302
|
-
|
|
2303
|
-
|
|
2583
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2584
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0-rc.3", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, directives: [{ type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2585
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2586
|
+
type: Component,
|
|
2587
|
+
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2588
|
+
}] });
|
|
2304
2589
|
|
|
2305
2590
|
/**
|
|
2306
2591
|
* @license
|
|
@@ -2428,7 +2713,7 @@ function sortByMatchingOutlets(routes, outletName) {
|
|
|
2428
2713
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2429
2714
|
* found in the LICENSE file at https://angular.io/license
|
|
2430
2715
|
*/
|
|
2431
|
-
const noMatch = {
|
|
2716
|
+
const noMatch$1 = {
|
|
2432
2717
|
matched: false,
|
|
2433
2718
|
consumedSegments: [],
|
|
2434
2719
|
lastChild: 0,
|
|
@@ -2439,7 +2724,7 @@ function match(segmentGroup, route, segments) {
|
|
|
2439
2724
|
var _a;
|
|
2440
2725
|
if (route.path === '') {
|
|
2441
2726
|
if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
|
|
2442
|
-
return Object.assign({}, noMatch);
|
|
2727
|
+
return Object.assign({}, noMatch$1);
|
|
2443
2728
|
}
|
|
2444
2729
|
return {
|
|
2445
2730
|
matched: true,
|
|
@@ -2452,7 +2737,7 @@ function match(segmentGroup, route, segments) {
|
|
|
2452
2737
|
const matcher = route.matcher || defaultUrlMatcher;
|
|
2453
2738
|
const res = matcher(segments, segmentGroup, route);
|
|
2454
2739
|
if (!res)
|
|
2455
|
-
return Object.assign({}, noMatch);
|
|
2740
|
+
return Object.assign({}, noMatch$1);
|
|
2456
2741
|
const posParams = {};
|
|
2457
2742
|
forEach(res.posParams, (v, k) => {
|
|
2458
2743
|
posParams[k] = v.path;
|
|
@@ -2569,7 +2854,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
2569
2854
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2570
2855
|
* found in the LICENSE file at https://angular.io/license
|
|
2571
2856
|
*/
|
|
2572
|
-
class NoMatch {
|
|
2857
|
+
class NoMatch$1 {
|
|
2573
2858
|
constructor(segmentGroup) {
|
|
2574
2859
|
this.segmentGroup = segmentGroup || null;
|
|
2575
2860
|
}
|
|
@@ -2579,8 +2864,8 @@ class AbsoluteRedirect {
|
|
|
2579
2864
|
this.urlTree = urlTree;
|
|
2580
2865
|
}
|
|
2581
2866
|
}
|
|
2582
|
-
function noMatch
|
|
2583
|
-
return new Observable((obs) => obs.error(new NoMatch(segmentGroup)));
|
|
2867
|
+
function noMatch(segmentGroup) {
|
|
2868
|
+
return new Observable((obs) => obs.error(new NoMatch$1(segmentGroup)));
|
|
2584
2869
|
}
|
|
2585
2870
|
function absoluteRedirect(newTree) {
|
|
2586
2871
|
return new Observable((obs) => obs.error(new AbsoluteRedirect(newTree)));
|
|
@@ -2596,7 +2881,7 @@ function canLoadFails(route) {
|
|
|
2596
2881
|
*
|
|
2597
2882
|
* Lazy modules are loaded along the way.
|
|
2598
2883
|
*/
|
|
2599
|
-
function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {
|
|
2884
|
+
function applyRedirects$1(moduleInjector, configLoader, urlSerializer, urlTree, config) {
|
|
2600
2885
|
return new ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply();
|
|
2601
2886
|
}
|
|
2602
2887
|
class ApplyRedirects {
|
|
@@ -2629,7 +2914,7 @@ class ApplyRedirects {
|
|
|
2629
2914
|
// we need to run matching, so we can fetch all lazy-loaded modules
|
|
2630
2915
|
return this.match(e.urlTree);
|
|
2631
2916
|
}
|
|
2632
|
-
if (e instanceof NoMatch) {
|
|
2917
|
+
if (e instanceof NoMatch$1) {
|
|
2633
2918
|
throw this.noMatchError(e);
|
|
2634
2919
|
}
|
|
2635
2920
|
throw e;
|
|
@@ -2641,7 +2926,7 @@ class ApplyRedirects {
|
|
|
2641
2926
|
return this.createUrlTree(squashSegmentGroup(rootSegmentGroup), tree.queryParams, tree.fragment);
|
|
2642
2927
|
}));
|
|
2643
2928
|
return mapped$.pipe(catchError((e) => {
|
|
2644
|
-
if (e instanceof NoMatch) {
|
|
2929
|
+
if (e instanceof NoMatch$1) {
|
|
2645
2930
|
throw this.noMatchError(e);
|
|
2646
2931
|
}
|
|
2647
2932
|
throw e;
|
|
@@ -2694,7 +2979,7 @@ class ApplyRedirects {
|
|
|
2694
2979
|
return from(routes).pipe(concatMap((r) => {
|
|
2695
2980
|
const expanded$ = this.expandSegmentAgainstRoute(ngModule, segmentGroup, routes, r, segments, outlet, allowRedirects);
|
|
2696
2981
|
return expanded$.pipe(catchError((e) => {
|
|
2697
|
-
if (e instanceof NoMatch) {
|
|
2982
|
+
if (e instanceof NoMatch$1) {
|
|
2698
2983
|
return of(null);
|
|
2699
2984
|
}
|
|
2700
2985
|
throw e;
|
|
@@ -2704,14 +2989,14 @@ class ApplyRedirects {
|
|
|
2704
2989
|
if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
|
|
2705
2990
|
return of(new UrlSegmentGroup([], {}));
|
|
2706
2991
|
}
|
|
2707
|
-
throw new NoMatch(segmentGroup);
|
|
2992
|
+
throw new NoMatch$1(segmentGroup);
|
|
2708
2993
|
}
|
|
2709
2994
|
throw e;
|
|
2710
2995
|
}));
|
|
2711
2996
|
}
|
|
2712
2997
|
expandSegmentAgainstRoute(ngModule, segmentGroup, routes, route, paths, outlet, allowRedirects) {
|
|
2713
2998
|
if (!isImmediateMatch(route, segmentGroup, paths, outlet)) {
|
|
2714
|
-
return noMatch
|
|
2999
|
+
return noMatch(segmentGroup);
|
|
2715
3000
|
}
|
|
2716
3001
|
if (route.redirectTo === undefined) {
|
|
2717
3002
|
return this.matchSegmentAgainstRoute(ngModule, segmentGroup, route, paths, outlet);
|
|
@@ -2719,7 +3004,7 @@ class ApplyRedirects {
|
|
|
2719
3004
|
if (allowRedirects && this.allowRedirects) {
|
|
2720
3005
|
return this.expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, paths, outlet);
|
|
2721
3006
|
}
|
|
2722
|
-
return noMatch
|
|
3007
|
+
return noMatch(segmentGroup);
|
|
2723
3008
|
}
|
|
2724
3009
|
expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) {
|
|
2725
3010
|
if (route.path === '**') {
|
|
@@ -2740,7 +3025,7 @@ class ApplyRedirects {
|
|
|
2740
3025
|
expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) {
|
|
2741
3026
|
const { matched, consumedSegments, lastChild, positionalParamSegments } = match(segmentGroup, route, segments);
|
|
2742
3027
|
if (!matched)
|
|
2743
|
-
return noMatch
|
|
3028
|
+
return noMatch(segmentGroup);
|
|
2744
3029
|
const newTree = this.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
|
|
2745
3030
|
if (route.redirectTo.startsWith('/')) {
|
|
2746
3031
|
return absoluteRedirect(newTree);
|
|
@@ -2763,7 +3048,7 @@ class ApplyRedirects {
|
|
|
2763
3048
|
}
|
|
2764
3049
|
const { matched, consumedSegments, lastChild } = match(rawSegmentGroup, route, segments);
|
|
2765
3050
|
if (!matched)
|
|
2766
|
-
return noMatch
|
|
3051
|
+
return noMatch(rawSegmentGroup);
|
|
2767
3052
|
const rawSlicedSegments = segments.slice(lastChild);
|
|
2768
3053
|
const childConfig$ = this.getChildConfig(ngModule, route, segments);
|
|
2769
3054
|
return childConfig$.pipe(mergeMap((routerConfig) => {
|
|
@@ -2941,8 +3226,8 @@ function squashSegmentGroup(segmentGroup) {
|
|
|
2941
3226
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2942
3227
|
* found in the LICENSE file at https://angular.io/license
|
|
2943
3228
|
*/
|
|
2944
|
-
function applyRedirects
|
|
2945
|
-
return switchMap(t => applyRedirects(moduleInjector, configLoader, urlSerializer, t.extractedUrl, config)
|
|
3229
|
+
function applyRedirects(moduleInjector, configLoader, urlSerializer, config) {
|
|
3230
|
+
return switchMap(t => applyRedirects$1(moduleInjector, configLoader, urlSerializer, t.extractedUrl, config)
|
|
2946
3231
|
.pipe(map(urlAfterRedirects => (Object.assign(Object.assign({}, t), { urlAfterRedirects })))));
|
|
2947
3232
|
}
|
|
2948
3233
|
|
|
@@ -3234,18 +3519,18 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3234
3519
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3235
3520
|
* found in the LICENSE file at https://angular.io/license
|
|
3236
3521
|
*/
|
|
3237
|
-
class NoMatch
|
|
3522
|
+
class NoMatch {
|
|
3238
3523
|
}
|
|
3239
3524
|
function newObservableError(e) {
|
|
3240
3525
|
// TODO(atscott): This pattern is used throughout the router code and can be `throwError` instead.
|
|
3241
3526
|
return new Observable((obs) => obs.error(e));
|
|
3242
3527
|
}
|
|
3243
|
-
function recognize(rootComponentType, config, urlTree, url, paramsInheritanceStrategy = 'emptyOnly', relativeLinkResolution = 'legacy') {
|
|
3528
|
+
function recognize$1(rootComponentType, config, urlTree, url, paramsInheritanceStrategy = 'emptyOnly', relativeLinkResolution = 'legacy') {
|
|
3244
3529
|
try {
|
|
3245
3530
|
const result = new Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution)
|
|
3246
3531
|
.recognize();
|
|
3247
3532
|
if (result === null) {
|
|
3248
|
-
return newObservableError(new NoMatch
|
|
3533
|
+
return newObservableError(new NoMatch());
|
|
3249
3534
|
}
|
|
3250
3535
|
else {
|
|
3251
3536
|
return of(result);
|
|
@@ -3489,8 +3774,8 @@ function getResolve(route) {
|
|
|
3489
3774
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3490
3775
|
* found in the LICENSE file at https://angular.io/license
|
|
3491
3776
|
*/
|
|
3492
|
-
function recognize
|
|
3493
|
-
return mergeMap(t => recognize(rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects), paramsInheritanceStrategy, relativeLinkResolution)
|
|
3777
|
+
function recognize(rootComponentType, config, serializer, paramsInheritanceStrategy, relativeLinkResolution) {
|
|
3778
|
+
return mergeMap(t => recognize$1(rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects), paramsInheritanceStrategy, relativeLinkResolution)
|
|
3494
3779
|
.pipe(map(targetSnapshot => (Object.assign(Object.assign({}, t), { targetSnapshot })))));
|
|
3495
3780
|
}
|
|
3496
3781
|
|
|
@@ -3677,97 +3962,24 @@ class RouterConfigLoader {
|
|
|
3677
3962
|
// for it's parent module instead.
|
|
3678
3963
|
return new LoadedRouterConfig(flatten(module.injector.get(ROUTES, undefined, InjectFlags.Self | InjectFlags.Optional))
|
|
3679
3964
|
.map(standardizeConfig), module);
|
|
3680
|
-
}), catchError((err) => {
|
|
3681
|
-
route._loader$ = undefined;
|
|
3682
|
-
throw err;
|
|
3683
|
-
}));
|
|
3684
|
-
// Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
|
|
3685
|
-
route._loader$ = new ConnectableObservable(loadRunner, () => new Subject())
|
|
3686
|
-
.pipe(refCount());
|
|
3687
|
-
return route._loader$;
|
|
3688
|
-
}
|
|
3689
|
-
loadModuleFactory(loadChildren) {
|
|
3690
|
-
return wrapIntoObservable(loadChildren()).pipe(mergeMap((t) => {
|
|
3691
|
-
if (t instanceof NgModuleFactory) {
|
|
3692
|
-
return of(t);
|
|
3693
|
-
}
|
|
3694
|
-
else {
|
|
3695
|
-
return from(this.compiler.compileModuleAsync(t));
|
|
3696
|
-
}
|
|
3697
|
-
}));
|
|
3698
|
-
}
|
|
3699
|
-
}
|
|
3700
|
-
|
|
3701
|
-
/**
|
|
3702
|
-
* @license
|
|
3703
|
-
* Copyright Google LLC All Rights Reserved.
|
|
3704
|
-
*
|
|
3705
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
3706
|
-
* found in the LICENSE file at https://angular.io/license
|
|
3707
|
-
*/
|
|
3708
|
-
/**
|
|
3709
|
-
* Store contextual information about a `RouterOutlet`
|
|
3710
|
-
*
|
|
3711
|
-
* @publicApi
|
|
3712
|
-
*/
|
|
3713
|
-
class OutletContext {
|
|
3714
|
-
constructor() {
|
|
3715
|
-
this.outlet = null;
|
|
3716
|
-
this.route = null;
|
|
3717
|
-
this.resolver = null;
|
|
3718
|
-
this.children = new ChildrenOutletContexts();
|
|
3719
|
-
this.attachRef = null;
|
|
3720
|
-
}
|
|
3721
|
-
}
|
|
3722
|
-
/**
|
|
3723
|
-
* Store contextual information about the children (= nested) `RouterOutlet`
|
|
3724
|
-
*
|
|
3725
|
-
* @publicApi
|
|
3726
|
-
*/
|
|
3727
|
-
class ChildrenOutletContexts {
|
|
3728
|
-
constructor() {
|
|
3729
|
-
// contexts for child outlets, by name.
|
|
3730
|
-
this.contexts = new Map();
|
|
3731
|
-
}
|
|
3732
|
-
/** Called when a `RouterOutlet` directive is instantiated */
|
|
3733
|
-
onChildOutletCreated(childName, outlet) {
|
|
3734
|
-
const context = this.getOrCreateContext(childName);
|
|
3735
|
-
context.outlet = outlet;
|
|
3736
|
-
this.contexts.set(childName, context);
|
|
3737
|
-
}
|
|
3738
|
-
/**
|
|
3739
|
-
* Called when a `RouterOutlet` directive is destroyed.
|
|
3740
|
-
* We need to keep the context as the outlet could be destroyed inside a NgIf and might be
|
|
3741
|
-
* re-created later.
|
|
3742
|
-
*/
|
|
3743
|
-
onChildOutletDestroyed(childName) {
|
|
3744
|
-
const context = this.getContext(childName);
|
|
3745
|
-
if (context) {
|
|
3746
|
-
context.outlet = null;
|
|
3747
|
-
}
|
|
3748
|
-
}
|
|
3749
|
-
/**
|
|
3750
|
-
* Called when the corresponding route is deactivated during navigation.
|
|
3751
|
-
* Because the component get destroyed, all children outlet are destroyed.
|
|
3752
|
-
*/
|
|
3753
|
-
onOutletDeactivated() {
|
|
3754
|
-
const contexts = this.contexts;
|
|
3755
|
-
this.contexts = new Map();
|
|
3756
|
-
return contexts;
|
|
3757
|
-
}
|
|
3758
|
-
onOutletReAttached(contexts) {
|
|
3759
|
-
this.contexts = contexts;
|
|
3760
|
-
}
|
|
3761
|
-
getOrCreateContext(childName) {
|
|
3762
|
-
let context = this.getContext(childName);
|
|
3763
|
-
if (!context) {
|
|
3764
|
-
context = new OutletContext();
|
|
3765
|
-
this.contexts.set(childName, context);
|
|
3766
|
-
}
|
|
3767
|
-
return context;
|
|
3965
|
+
}), catchError((err) => {
|
|
3966
|
+
route._loader$ = undefined;
|
|
3967
|
+
throw err;
|
|
3968
|
+
}));
|
|
3969
|
+
// Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
|
|
3970
|
+
route._loader$ = new ConnectableObservable(loadRunner, () => new Subject())
|
|
3971
|
+
.pipe(refCount());
|
|
3972
|
+
return route._loader$;
|
|
3768
3973
|
}
|
|
3769
|
-
|
|
3770
|
-
return
|
|
3974
|
+
loadModuleFactory(loadChildren) {
|
|
3975
|
+
return wrapIntoObservable(loadChildren()).pipe(mergeMap((t) => {
|
|
3976
|
+
if (t instanceof NgModuleFactory) {
|
|
3977
|
+
return of(t);
|
|
3978
|
+
}
|
|
3979
|
+
else {
|
|
3980
|
+
return from(this.compiler.compileModuleAsync(t));
|
|
3981
|
+
}
|
|
3982
|
+
}));
|
|
3771
3983
|
}
|
|
3772
3984
|
}
|
|
3773
3985
|
|
|
@@ -3802,13 +4014,6 @@ class DefaultUrlHandlingStrategy {
|
|
|
3802
4014
|
}
|
|
3803
4015
|
}
|
|
3804
4016
|
|
|
3805
|
-
/**
|
|
3806
|
-
* @license
|
|
3807
|
-
* Copyright Google LLC All Rights Reserved.
|
|
3808
|
-
*
|
|
3809
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
3810
|
-
* found in the LICENSE file at https://angular.io/license
|
|
3811
|
-
*/
|
|
3812
4017
|
function defaultErrorHandler(error) {
|
|
3813
4018
|
throw error;
|
|
3814
4019
|
}
|
|
@@ -4072,14 +4277,14 @@ class Router {
|
|
|
4072
4277
|
return Promise.resolve(t);
|
|
4073
4278
|
}),
|
|
4074
4279
|
// ApplyRedirects
|
|
4075
|
-
applyRedirects
|
|
4280
|
+
applyRedirects(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config),
|
|
4076
4281
|
// Update the currentNavigation
|
|
4077
4282
|
// `urlAfterRedirects` is guaranteed to be set after this point
|
|
4078
4283
|
tap(t => {
|
|
4079
4284
|
this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
|
|
4080
4285
|
}),
|
|
4081
4286
|
// Recognize
|
|
4082
|
-
recognize
|
|
4287
|
+
recognize(this.rootComponentType, this.config, (url) => this.serializeUrl(url), this.paramsInheritanceStrategy, this.relativeLinkResolution),
|
|
4083
4288
|
// Update URL if in `eager` update mode
|
|
4084
4289
|
tap(t => {
|
|
4085
4290
|
if (this.urlUpdateStrategy === 'eager') {
|
|
@@ -4212,6 +4417,7 @@ class Router {
|
|
|
4212
4417
|
completed = true;
|
|
4213
4418
|
}
|
|
4214
4419
|
}), finalize(() => {
|
|
4420
|
+
var _a;
|
|
4215
4421
|
/* When the navigation stream finishes either through error or success, we
|
|
4216
4422
|
* set the `completed` or `errored` flag. However, there are some situations
|
|
4217
4423
|
* where we could get here without either of those being set. For instance, a
|
|
@@ -4223,10 +4429,11 @@ class Router {
|
|
|
4223
4429
|
const cancelationReason = `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}`;
|
|
4224
4430
|
this.cancelNavigationTransition(t, cancelationReason);
|
|
4225
4431
|
}
|
|
4226
|
-
//
|
|
4227
|
-
//
|
|
4228
|
-
|
|
4229
|
-
|
|
4432
|
+
// Only clear current navigation if it is still set to the one that
|
|
4433
|
+
// finalized.
|
|
4434
|
+
if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === t.id) {
|
|
4435
|
+
this.currentNavigation = null;
|
|
4436
|
+
}
|
|
4230
4437
|
}), catchError((e) => {
|
|
4231
4438
|
// TODO(atscott): The NavigationTransition `t` used here does not accurately
|
|
4232
4439
|
// reflect the current state of the whole transition because some operations
|
|
@@ -4602,26 +4809,18 @@ class Router {
|
|
|
4602
4809
|
if (this.disposed) {
|
|
4603
4810
|
return Promise.resolve(false);
|
|
4604
4811
|
}
|
|
4605
|
-
//
|
|
4606
|
-
// router states.
|
|
4607
|
-
//
|
|
4608
|
-
// the user follows that with a navigation using the back/forward button or manual URL change,
|
|
4609
|
-
// the destination may be the same as the previous imperative attempt. We should not skip
|
|
4610
|
-
// these navigations because it's a separate case from the one above -- it's not a duplicate
|
|
4611
|
-
// navigation.
|
|
4812
|
+
// Duplicate navigations may be triggered by attempts to sync AngularJS and
|
|
4813
|
+
// Angular router states. We have the setTimeout in the location listener to
|
|
4814
|
+
// ensure the imperative nav is scheduled before the browser nav.
|
|
4612
4815
|
const lastNavigation = this.transitions.value;
|
|
4613
|
-
// We don't want to skip duplicate successful navs if they're imperative because
|
|
4614
|
-
// onSameUrlNavigation could be 'reload' (so the duplicate is intended).
|
|
4615
4816
|
const browserNavPrecededByRouterNav = isBrowserTriggeredNavigation(source) && lastNavigation &&
|
|
4616
4817
|
!isBrowserTriggeredNavigation(lastNavigation.source);
|
|
4617
|
-
const
|
|
4618
|
-
|
|
4619
|
-
//
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
const duplicateNav = lastNavigationUrl.toString() === rawUrl.toString();
|
|
4624
|
-
if (browserNavPrecededByRouterNav && duplicateNav) {
|
|
4818
|
+
const navToSameUrl = lastNavigation.rawUrl.toString() === rawUrl.toString();
|
|
4819
|
+
const lastNavigationInProgress = lastNavigation.id === ((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id);
|
|
4820
|
+
// We consider duplicates as ones that goes to the same URL while the first
|
|
4821
|
+
// is still processing.
|
|
4822
|
+
const isDuplicateNav = navToSameUrl && lastNavigationInProgress;
|
|
4823
|
+
if (browserNavPrecededByRouterNav && isDuplicateNav) {
|
|
4625
4824
|
return Promise.resolve(true); // return value is not used
|
|
4626
4825
|
}
|
|
4627
4826
|
let resolve;
|
|
@@ -4766,18 +4965,11 @@ class Router {
|
|
|
4766
4965
|
return { navigationId };
|
|
4767
4966
|
}
|
|
4768
4967
|
}
|
|
4769
|
-
Router
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
{ type: UrlSerializer },
|
|
4775
|
-
{ type: ChildrenOutletContexts },
|
|
4776
|
-
{ type: Location },
|
|
4777
|
-
{ type: Injector },
|
|
4778
|
-
{ type: Compiler },
|
|
4779
|
-
{ type: undefined }
|
|
4780
|
-
];
|
|
4968
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
4969
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: Router });
|
|
4970
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: Router, decorators: [{
|
|
4971
|
+
type: Injectable
|
|
4972
|
+
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
4781
4973
|
function validateCommands(commands) {
|
|
4782
4974
|
for (let i = 0; i < commands.length; i++) {
|
|
4783
4975
|
const cmd = commands[i];
|
|
@@ -4790,13 +4982,6 @@ function isBrowserTriggeredNavigation(source) {
|
|
|
4790
4982
|
return source !== 'imperative';
|
|
4791
4983
|
}
|
|
4792
4984
|
|
|
4793
|
-
/**
|
|
4794
|
-
* @license
|
|
4795
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4796
|
-
*
|
|
4797
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4798
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4799
|
-
*/
|
|
4800
4985
|
/**
|
|
4801
4986
|
* @description
|
|
4802
4987
|
*
|
|
@@ -4974,28 +5159,38 @@ class RouterLink {
|
|
|
4974
5159
|
});
|
|
4975
5160
|
}
|
|
4976
5161
|
}
|
|
4977
|
-
RouterLink
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
];
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
5162
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5163
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.3", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
5164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterLink, decorators: [{
|
|
5165
|
+
type: Directive,
|
|
5166
|
+
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5167
|
+
}], ctorParameters: function () {
|
|
5168
|
+
return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
5169
|
+
type: Attribute,
|
|
5170
|
+
args: ['tabindex']
|
|
5171
|
+
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }];
|
|
5172
|
+
}, propDecorators: { queryParams: [{
|
|
5173
|
+
type: Input
|
|
5174
|
+
}], fragment: [{
|
|
5175
|
+
type: Input
|
|
5176
|
+
}], queryParamsHandling: [{
|
|
5177
|
+
type: Input
|
|
5178
|
+
}], preserveFragment: [{
|
|
5179
|
+
type: Input
|
|
5180
|
+
}], skipLocationChange: [{
|
|
5181
|
+
type: Input
|
|
5182
|
+
}], replaceUrl: [{
|
|
5183
|
+
type: Input
|
|
5184
|
+
}], state: [{
|
|
5185
|
+
type: Input
|
|
5186
|
+
}], relativeTo: [{
|
|
5187
|
+
type: Input
|
|
5188
|
+
}], routerLink: [{
|
|
5189
|
+
type: Input
|
|
5190
|
+
}], onClick: [{
|
|
5191
|
+
type: HostListener,
|
|
5192
|
+
args: ['click']
|
|
5193
|
+
}] } });
|
|
4999
5194
|
/**
|
|
5000
5195
|
* @description
|
|
5001
5196
|
*
|
|
@@ -5085,29 +5280,42 @@ class RouterLinkWithHref {
|
|
|
5085
5280
|
});
|
|
5086
5281
|
}
|
|
5087
5282
|
}
|
|
5088
|
-
RouterLinkWithHref
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
]
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
}
|
|
5283
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5284
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.3", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
|
|
5285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5286
|
+
type: Directive,
|
|
5287
|
+
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5288
|
+
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
5289
|
+
type: HostBinding,
|
|
5290
|
+
args: ['attr.target']
|
|
5291
|
+
}, {
|
|
5292
|
+
type: Input
|
|
5293
|
+
}], queryParams: [{
|
|
5294
|
+
type: Input
|
|
5295
|
+
}], fragment: [{
|
|
5296
|
+
type: Input
|
|
5297
|
+
}], queryParamsHandling: [{
|
|
5298
|
+
type: Input
|
|
5299
|
+
}], preserveFragment: [{
|
|
5300
|
+
type: Input
|
|
5301
|
+
}], skipLocationChange: [{
|
|
5302
|
+
type: Input
|
|
5303
|
+
}], replaceUrl: [{
|
|
5304
|
+
type: Input
|
|
5305
|
+
}], state: [{
|
|
5306
|
+
type: Input
|
|
5307
|
+
}], relativeTo: [{
|
|
5308
|
+
type: Input
|
|
5309
|
+
}], href: [{
|
|
5310
|
+
type: HostBinding,
|
|
5311
|
+
args: ['attr.href']
|
|
5312
|
+
}], routerLink: [{
|
|
5313
|
+
type: Input
|
|
5314
|
+
}], onClick: [{
|
|
5315
|
+
type: HostListener,
|
|
5316
|
+
args: ['click',
|
|
5317
|
+
['$event.button', '$event.ctrlKey', '$event.shiftKey', '$event.altKey', '$event.metaKey']]
|
|
5318
|
+
}] } });
|
|
5111
5319
|
function attrBoolValue(s) {
|
|
5112
5320
|
return s === '' || !!s;
|
|
5113
5321
|
}
|
|
@@ -5288,27 +5496,33 @@ class RouterLinkActive {
|
|
|
5288
5496
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5289
5497
|
}
|
|
5290
5498
|
}
|
|
5291
|
-
RouterLinkActive
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
]
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
];
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
}
|
|
5499
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5500
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.3", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
5501
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5502
|
+
type: Directive,
|
|
5503
|
+
args: [{
|
|
5504
|
+
selector: '[routerLinkActive]',
|
|
5505
|
+
exportAs: 'routerLinkActive',
|
|
5506
|
+
}]
|
|
5507
|
+
}], ctorParameters: function () {
|
|
5508
|
+
return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
|
|
5509
|
+
type: Optional
|
|
5510
|
+
}] }, { type: RouterLinkWithHref, decorators: [{
|
|
5511
|
+
type: Optional
|
|
5512
|
+
}] }];
|
|
5513
|
+
}, propDecorators: { links: [{
|
|
5514
|
+
type: ContentChildren,
|
|
5515
|
+
args: [RouterLink, { descendants: true }]
|
|
5516
|
+
}], linksWithHrefs: [{
|
|
5517
|
+
type: ContentChildren,
|
|
5518
|
+
args: [RouterLinkWithHref, { descendants: true }]
|
|
5519
|
+
}], routerLinkActiveOptions: [{
|
|
5520
|
+
type: Input
|
|
5521
|
+
}], isActiveChange: [{
|
|
5522
|
+
type: Output
|
|
5523
|
+
}], routerLinkActive: [{
|
|
5524
|
+
type: Input
|
|
5525
|
+
}] } });
|
|
5312
5526
|
/**
|
|
5313
5527
|
* Use instead of `'paths' in options` to be compatible with property renaming
|
|
5314
5528
|
*/
|
|
@@ -5316,214 +5530,6 @@ function isActiveMatchOptions(options) {
|
|
|
5316
5530
|
return !!options.paths;
|
|
5317
5531
|
}
|
|
5318
5532
|
|
|
5319
|
-
/**
|
|
5320
|
-
* @license
|
|
5321
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5322
|
-
*
|
|
5323
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
5324
|
-
* found in the LICENSE file at https://angular.io/license
|
|
5325
|
-
*/
|
|
5326
|
-
/**
|
|
5327
|
-
* @description
|
|
5328
|
-
*
|
|
5329
|
-
* Acts as a placeholder that Angular dynamically fills based on the current router state.
|
|
5330
|
-
*
|
|
5331
|
-
* Each outlet can have a unique name, determined by the optional `name` attribute.
|
|
5332
|
-
* The name cannot be set or changed dynamically. If not set, default value is "primary".
|
|
5333
|
-
*
|
|
5334
|
-
* ```
|
|
5335
|
-
* <router-outlet></router-outlet>
|
|
5336
|
-
* <router-outlet name='left'></router-outlet>
|
|
5337
|
-
* <router-outlet name='right'></router-outlet>
|
|
5338
|
-
* ```
|
|
5339
|
-
*
|
|
5340
|
-
* Named outlets can be the targets of secondary routes.
|
|
5341
|
-
* The `Route` object for a secondary route has an `outlet` property to identify the target outlet:
|
|
5342
|
-
*
|
|
5343
|
-
* `{path: <base-path>, component: <component>, outlet: <target_outlet_name>}`
|
|
5344
|
-
*
|
|
5345
|
-
* Using named outlets and secondary routes, you can target multiple outlets in
|
|
5346
|
-
* the same `RouterLink` directive.
|
|
5347
|
-
*
|
|
5348
|
-
* The router keeps track of separate branches in a navigation tree for each named outlet and
|
|
5349
|
-
* generates a representation of that tree in the URL.
|
|
5350
|
-
* The URL for a secondary route uses the following syntax to specify both the primary and secondary
|
|
5351
|
-
* routes at the same time:
|
|
5352
|
-
*
|
|
5353
|
-
* `http://base-path/primary-route-path(outlet-name:route-path)`
|
|
5354
|
-
*
|
|
5355
|
-
* A router outlet emits an activate event when a new component is instantiated,
|
|
5356
|
-
* deactivate event when a component is destroyed.
|
|
5357
|
-
* An attached event emits when the `RouteReuseStrategy` instructs the outlet to reattach the
|
|
5358
|
-
* subtree, and the detached event emits when the `RouteReuseStrategy` instructs the outlet to
|
|
5359
|
-
* detach the subtree.
|
|
5360
|
-
*
|
|
5361
|
-
* ```
|
|
5362
|
-
* <router-outlet
|
|
5363
|
-
* (activate)='onActivate($event)'
|
|
5364
|
-
* (deactivate)='onDeactivate($event)'
|
|
5365
|
-
* (attach)='onAttach($event)'
|
|
5366
|
-
* (detach)='onDetach($event)'></router-outlet>
|
|
5367
|
-
* ```
|
|
5368
|
-
*
|
|
5369
|
-
* @see [Routing tutorial](guide/router-tutorial-toh#named-outlets "Example of a named
|
|
5370
|
-
* outlet and secondary route configuration").
|
|
5371
|
-
* @see `RouterLink`
|
|
5372
|
-
* @see `Route`
|
|
5373
|
-
* @ngModule RouterModule
|
|
5374
|
-
*
|
|
5375
|
-
* @publicApi
|
|
5376
|
-
*/
|
|
5377
|
-
class RouterOutlet {
|
|
5378
|
-
constructor(parentContexts, location, resolver, name, changeDetector) {
|
|
5379
|
-
this.parentContexts = parentContexts;
|
|
5380
|
-
this.location = location;
|
|
5381
|
-
this.resolver = resolver;
|
|
5382
|
-
this.changeDetector = changeDetector;
|
|
5383
|
-
this.activated = null;
|
|
5384
|
-
this._activatedRoute = null;
|
|
5385
|
-
this.activateEvents = new EventEmitter();
|
|
5386
|
-
this.deactivateEvents = new EventEmitter();
|
|
5387
|
-
/**
|
|
5388
|
-
* Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a
|
|
5389
|
-
* previously detached subtree.
|
|
5390
|
-
**/
|
|
5391
|
-
this.attachEvents = new EventEmitter();
|
|
5392
|
-
/**
|
|
5393
|
-
* Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the
|
|
5394
|
-
* subtree.
|
|
5395
|
-
*/
|
|
5396
|
-
this.detachEvents = new EventEmitter();
|
|
5397
|
-
this.name = name || PRIMARY_OUTLET;
|
|
5398
|
-
parentContexts.onChildOutletCreated(this.name, this);
|
|
5399
|
-
}
|
|
5400
|
-
/** @nodoc */
|
|
5401
|
-
ngOnDestroy() {
|
|
5402
|
-
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
5403
|
-
}
|
|
5404
|
-
/** @nodoc */
|
|
5405
|
-
ngOnInit() {
|
|
5406
|
-
if (!this.activated) {
|
|
5407
|
-
// If the outlet was not instantiated at the time the route got activated we need to populate
|
|
5408
|
-
// the outlet when it is initialized (ie inside a NgIf)
|
|
5409
|
-
const context = this.parentContexts.getContext(this.name);
|
|
5410
|
-
if (context && context.route) {
|
|
5411
|
-
if (context.attachRef) {
|
|
5412
|
-
// `attachRef` is populated when there is an existing component to mount
|
|
5413
|
-
this.attach(context.attachRef, context.route);
|
|
5414
|
-
}
|
|
5415
|
-
else {
|
|
5416
|
-
// otherwise the component defined in the configuration is created
|
|
5417
|
-
this.activateWith(context.route, context.resolver || null);
|
|
5418
|
-
}
|
|
5419
|
-
}
|
|
5420
|
-
}
|
|
5421
|
-
}
|
|
5422
|
-
get isActivated() {
|
|
5423
|
-
return !!this.activated;
|
|
5424
|
-
}
|
|
5425
|
-
/**
|
|
5426
|
-
* @returns The currently activated component instance.
|
|
5427
|
-
* @throws An error if the outlet is not activated.
|
|
5428
|
-
*/
|
|
5429
|
-
get component() {
|
|
5430
|
-
if (!this.activated)
|
|
5431
|
-
throw new Error('Outlet is not activated');
|
|
5432
|
-
return this.activated.instance;
|
|
5433
|
-
}
|
|
5434
|
-
get activatedRoute() {
|
|
5435
|
-
if (!this.activated)
|
|
5436
|
-
throw new Error('Outlet is not activated');
|
|
5437
|
-
return this._activatedRoute;
|
|
5438
|
-
}
|
|
5439
|
-
get activatedRouteData() {
|
|
5440
|
-
if (this._activatedRoute) {
|
|
5441
|
-
return this._activatedRoute.snapshot.data;
|
|
5442
|
-
}
|
|
5443
|
-
return {};
|
|
5444
|
-
}
|
|
5445
|
-
/**
|
|
5446
|
-
* Called when the `RouteReuseStrategy` instructs to detach the subtree
|
|
5447
|
-
*/
|
|
5448
|
-
detach() {
|
|
5449
|
-
if (!this.activated)
|
|
5450
|
-
throw new Error('Outlet is not activated');
|
|
5451
|
-
this.location.detach();
|
|
5452
|
-
const cmp = this.activated;
|
|
5453
|
-
this.activated = null;
|
|
5454
|
-
this._activatedRoute = null;
|
|
5455
|
-
this.detachEvents.emit(cmp.instance);
|
|
5456
|
-
return cmp;
|
|
5457
|
-
}
|
|
5458
|
-
/**
|
|
5459
|
-
* Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
|
|
5460
|
-
*/
|
|
5461
|
-
attach(ref, activatedRoute) {
|
|
5462
|
-
this.activated = ref;
|
|
5463
|
-
this._activatedRoute = activatedRoute;
|
|
5464
|
-
this.location.insert(ref.hostView);
|
|
5465
|
-
this.attachEvents.emit(ref.instance);
|
|
5466
|
-
}
|
|
5467
|
-
deactivate() {
|
|
5468
|
-
if (this.activated) {
|
|
5469
|
-
const c = this.component;
|
|
5470
|
-
this.activated.destroy();
|
|
5471
|
-
this.activated = null;
|
|
5472
|
-
this._activatedRoute = null;
|
|
5473
|
-
this.deactivateEvents.emit(c);
|
|
5474
|
-
}
|
|
5475
|
-
}
|
|
5476
|
-
activateWith(activatedRoute, resolver) {
|
|
5477
|
-
if (this.isActivated) {
|
|
5478
|
-
throw new Error('Cannot activate an already activated outlet');
|
|
5479
|
-
}
|
|
5480
|
-
this._activatedRoute = activatedRoute;
|
|
5481
|
-
const snapshot = activatedRoute._futureSnapshot;
|
|
5482
|
-
const component = snapshot.routeConfig.component;
|
|
5483
|
-
resolver = resolver || this.resolver;
|
|
5484
|
-
const factory = resolver.resolveComponentFactory(component);
|
|
5485
|
-
const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
|
|
5486
|
-
const injector = new OutletInjector(activatedRoute, childContexts, this.location.injector);
|
|
5487
|
-
this.activated = this.location.createComponent(factory, this.location.length, injector);
|
|
5488
|
-
// Calling `markForCheck` to make sure we will run the change detection when the
|
|
5489
|
-
// `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
|
|
5490
|
-
this.changeDetector.markForCheck();
|
|
5491
|
-
this.activateEvents.emit(this.activated.instance);
|
|
5492
|
-
}
|
|
5493
|
-
}
|
|
5494
|
-
RouterOutlet.decorators = [
|
|
5495
|
-
{ type: Directive, args: [{ selector: 'router-outlet', exportAs: 'outlet' },] }
|
|
5496
|
-
];
|
|
5497
|
-
RouterOutlet.ctorParameters = () => [
|
|
5498
|
-
{ type: ChildrenOutletContexts },
|
|
5499
|
-
{ type: ViewContainerRef },
|
|
5500
|
-
{ type: ComponentFactoryResolver },
|
|
5501
|
-
{ type: String, decorators: [{ type: Attribute, args: ['name',] }] },
|
|
5502
|
-
{ type: ChangeDetectorRef }
|
|
5503
|
-
];
|
|
5504
|
-
RouterOutlet.propDecorators = {
|
|
5505
|
-
activateEvents: [{ type: Output, args: ['activate',] }],
|
|
5506
|
-
deactivateEvents: [{ type: Output, args: ['deactivate',] }],
|
|
5507
|
-
attachEvents: [{ type: Output, args: ['attach',] }],
|
|
5508
|
-
detachEvents: [{ type: Output, args: ['detach',] }]
|
|
5509
|
-
};
|
|
5510
|
-
class OutletInjector {
|
|
5511
|
-
constructor(route, childContexts, parent) {
|
|
5512
|
-
this.route = route;
|
|
5513
|
-
this.childContexts = childContexts;
|
|
5514
|
-
this.parent = parent;
|
|
5515
|
-
}
|
|
5516
|
-
get(token, notFoundValue) {
|
|
5517
|
-
if (token === ActivatedRoute) {
|
|
5518
|
-
return this.route;
|
|
5519
|
-
}
|
|
5520
|
-
if (token === ChildrenOutletContexts) {
|
|
5521
|
-
return this.childContexts;
|
|
5522
|
-
}
|
|
5523
|
-
return this.parent.get(token, notFoundValue);
|
|
5524
|
-
}
|
|
5525
|
-
}
|
|
5526
|
-
|
|
5527
5533
|
/**
|
|
5528
5534
|
* @license
|
|
5529
5535
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -5637,23 +5643,12 @@ class RouterPreloader {
|
|
|
5637
5643
|
});
|
|
5638
5644
|
}
|
|
5639
5645
|
}
|
|
5640
|
-
RouterPreloader
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
{ type: Compiler },
|
|
5646
|
-
{ type: Injector },
|
|
5647
|
-
{ type: PreloadingStrategy }
|
|
5648
|
-
];
|
|
5646
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.Injector }, { token: PreloadingStrategy }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5647
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterPreloader });
|
|
5648
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
5649
|
+
type: Injectable
|
|
5650
|
+
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.Injector }, { type: PreloadingStrategy }]; } });
|
|
5649
5651
|
|
|
5650
|
-
/**
|
|
5651
|
-
* @license
|
|
5652
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5653
|
-
*
|
|
5654
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
5655
|
-
* found in the LICENSE file at https://angular.io/license
|
|
5656
|
-
*/
|
|
5657
5652
|
class RouterScroller {
|
|
5658
5653
|
constructor(router,
|
|
5659
5654
|
/** @docsNotRequired */ viewportScroller, options = {}) {
|
|
@@ -5729,14 +5724,11 @@ class RouterScroller {
|
|
|
5729
5724
|
}
|
|
5730
5725
|
}
|
|
5731
5726
|
}
|
|
5732
|
-
RouterScroller
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
{ type: ViewportScroller },
|
|
5738
|
-
{ type: undefined }
|
|
5739
|
-
];
|
|
5727
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5728
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterScroller });
|
|
5729
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterScroller, decorators: [{
|
|
5730
|
+
type: Injectable
|
|
5731
|
+
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
5740
5732
|
|
|
5741
5733
|
/**
|
|
5742
5734
|
* @license
|
|
@@ -5759,7 +5751,6 @@ const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION');
|
|
|
5759
5751
|
* @docsNotRequired
|
|
5760
5752
|
*/
|
|
5761
5753
|
const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
|
|
5762
|
-
const ɵ0 = { enableTracing: false };
|
|
5763
5754
|
const ROUTER_PROVIDERS = [
|
|
5764
5755
|
Location,
|
|
5765
5756
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
@@ -5777,7 +5768,7 @@ const ROUTER_PROVIDERS = [
|
|
|
5777
5768
|
RouterPreloader,
|
|
5778
5769
|
NoPreloading,
|
|
5779
5770
|
PreloadAllModules,
|
|
5780
|
-
{ provide: ROUTER_CONFIGURATION, useValue:
|
|
5771
|
+
{ provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
|
|
5781
5772
|
];
|
|
5782
5773
|
function routerNgProbeToken() {
|
|
5783
5774
|
return new NgProbeToken('Router', Router);
|
|
@@ -5876,17 +5867,26 @@ class RouterModule {
|
|
|
5876
5867
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
5877
5868
|
}
|
|
5878
5869
|
}
|
|
5879
|
-
RouterModule
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
]
|
|
5870
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5871
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
5872
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterModule });
|
|
5873
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterModule, decorators: [{
|
|
5874
|
+
type: NgModule,
|
|
5875
|
+
args: [{
|
|
5876
|
+
declarations: ROUTER_DIRECTIVES,
|
|
5877
|
+
exports: ROUTER_DIRECTIVES,
|
|
5878
|
+
entryComponents: [ɵEmptyOutletComponent]
|
|
5879
|
+
}]
|
|
5880
|
+
}], ctorParameters: function () {
|
|
5881
|
+
return [{ type: undefined, decorators: [{
|
|
5882
|
+
type: Optional
|
|
5883
|
+
}, {
|
|
5884
|
+
type: Inject,
|
|
5885
|
+
args: [ROUTER_FORROOT_GUARD]
|
|
5886
|
+
}] }, { type: Router, decorators: [{
|
|
5887
|
+
type: Optional
|
|
5888
|
+
}] }];
|
|
5889
|
+
} });
|
|
5890
5890
|
function createRouterScroller(router, viewportScroller, config) {
|
|
5891
5891
|
if (config.scrollOffset) {
|
|
5892
5892
|
viewportScroller.setOffset(config.scrollOffset);
|
|
@@ -5966,6 +5966,9 @@ function assignExtraOptionsToRouter(opts, router) {
|
|
|
5966
5966
|
if (opts.urlUpdateStrategy) {
|
|
5967
5967
|
router.urlUpdateStrategy = opts.urlUpdateStrategy;
|
|
5968
5968
|
}
|
|
5969
|
+
if (opts.canceledNavigationResolution) {
|
|
5970
|
+
router.canceledNavigationResolution = opts.canceledNavigationResolution;
|
|
5971
|
+
}
|
|
5969
5972
|
}
|
|
5970
5973
|
function rootRoute(router) {
|
|
5971
5974
|
return router.routerState.root;
|
|
@@ -6049,12 +6052,11 @@ class RouterInitializer {
|
|
|
6049
6052
|
this.destroyed = true;
|
|
6050
6053
|
}
|
|
6051
6054
|
}
|
|
6052
|
-
RouterInitializer
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
];
|
|
6055
|
+
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6056
|
+
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterInitializer });
|
|
6057
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: RouterInitializer, decorators: [{
|
|
6058
|
+
type: Injectable
|
|
6059
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
6058
6060
|
function getAppInitializer(r) {
|
|
6059
6061
|
return r.appInitializer.bind(r);
|
|
6060
6062
|
}
|
|
@@ -6092,7 +6094,7 @@ function provideRouterInitializer() {
|
|
|
6092
6094
|
/**
|
|
6093
6095
|
* @publicApi
|
|
6094
6096
|
*/
|
|
6095
|
-
const VERSION = new Version('13.0.0-
|
|
6097
|
+
const VERSION = new Version('13.0.0-rc.3');
|
|
6096
6098
|
|
|
6097
6099
|
/**
|
|
6098
6100
|
* @license
|
|
@@ -6131,5 +6133,5 @@ const VERSION = new Version('13.0.0-next.9');
|
|
|
6131
6133
|
* Generated bundle index. Do not edit.
|
|
6132
6134
|
*/
|
|
6133
6135
|
|
|
6134
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS,
|
|
6135
|
-
//# sourceMappingURL=router.
|
|
6136
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
|
|
6137
|
+
//# sourceMappingURL=router.mjs.map
|