@angular/router 10.0.0 → 10.0.4

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v10.0.0
2
+ * @license Angular v10.0.4
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import { Location, LocationStrategy, ViewportScroller, PlatformLocation, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, ɵgetDOM, LOCATION_INITIALIZED } from '@angular/common';
8
- import { Component, ɵisObservable, ɵisPromise, NgModuleRef, InjectionToken, NgModuleFactory, ɵConsole, NgZone, isDevMode, Injectable, Type, Injector, NgModuleFactoryLoader, Compiler, Directive, Attribute, Renderer2, ElementRef, Input, HostListener, HostBinding, Optional, ContentChildren, EventEmitter, ViewContainerRef, ComponentFactoryResolver, ChangeDetectorRef, Output, SystemJsNgModuleLoader, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
8
+ import { Component, ɵisObservable, ɵisPromise, NgModuleRef, InjectionToken, NgModuleFactory, ɵConsole, NgZone, isDevMode, Injectable, Type, Injector, NgModuleFactoryLoader, Compiler, Directive, Attribute, Renderer2, ElementRef, Input, HostListener, HostBinding, ChangeDetectorRef, Optional, ContentChildren, EventEmitter, ViewContainerRef, ComponentFactoryResolver, Output, SystemJsNgModuleLoader, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
9
9
  import { of, from, BehaviorSubject, Observable, EmptyError, combineLatest, defer, EMPTY, Subject } from 'rxjs';
10
10
  import { map, concatAll, last as last$1, catchError, first, mergeMap, tap, every, switchMap, take, startWith, scan, filter, concatMap, takeLast, finalize, mergeAll } from 'rxjs/operators';
11
11
 
@@ -95,7 +95,7 @@ class NavigationEnd extends RouterEvent {
95
95
  /**
96
96
  * An event triggered when a navigation is canceled, directly or indirectly.
97
97
  *
98
- * This can happen when a [route guard](guide/router#milestone-5-route-guards)
98
+ * This can happen when a [route guard](guide/router-tutorial-toh#milestone-5-route-guards)
99
99
  * returns `false` or initiates a redirect by returning a `UrlTree`.
100
100
  *
101
101
  * @publicApi
@@ -428,7 +428,7 @@ class ParamsAsMap {
428
428
  this.params = params || {};
429
429
  }
430
430
  has(name) {
431
- return this.params.hasOwnProperty(name);
431
+ return Object.prototype.hasOwnProperty.call(this.params, name);
432
432
  }
433
433
  get(name) {
434
434
  if (this.has(name)) {
@@ -1933,11 +1933,10 @@ function getPath(command) {
1933
1933
  return `${command}`;
1934
1934
  }
1935
1935
  function getOutlets(commands) {
1936
- if (!(typeof commands[0] === 'object'))
1937
- return { [PRIMARY_OUTLET]: commands };
1938
- if (commands[0].outlets === undefined)
1939
- return { [PRIMARY_OUTLET]: commands };
1940
- return commands[0].outlets;
1936
+ if (typeof commands[0] === 'object' && commands[0] !== null && commands[0].outlets) {
1937
+ return commands[0].outlets;
1938
+ }
1939
+ return { [PRIMARY_OUTLET]: commands };
1941
1940
  }
1942
1941
  function updateSegmentGroup(segmentGroup, startIndex, commands) {
1943
1942
  if (!segmentGroup) {
@@ -2017,7 +2016,8 @@ function createNewSegmentGroup(segmentGroup, startIndex, commands) {
2017
2016
  const paths = segmentGroup.segments.slice(0, startIndex);
2018
2017
  let i = 0;
2019
2018
  while (i < commands.length) {
2020
- if (typeof commands[i] === 'object' && commands[i].outlets !== undefined) {
2019
+ if (typeof commands[i] === 'object' && commands[i] !== null &&
2020
+ commands[i].outlets !== undefined) {
2021
2021
  const children = createNewSegmentChildren(commands[i].outlets);
2022
2022
  return new UrlSegmentGroup(paths, children);
2023
2023
  }
@@ -4422,8 +4422,7 @@ class RouterLink {
4422
4422
  }
4423
4423
  }
4424
4424
  /**
4425
- * @param commands An array of commands to pass to {@link Router#createUrlTree
4426
- * Router#createUrlTree}.
4425
+ * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4427
4426
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4428
4427
  * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
4429
4428
  * - **null|undefined**: shorthand for an empty array of commands, i.e. `[]`
@@ -4512,8 +4511,7 @@ class RouterLinkWithHref {
4512
4511
  });
4513
4512
  }
4514
4513
  /**
4515
- * @param commands An array of commands to pass to {@link Router#createUrlTree
4516
- * Router#createUrlTree}.
4514
+ * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4517
4515
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4518
4516
  * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
4519
4517
  * - **null|undefined**: shorthand for an empty array of commands, i.e. `[]`
@@ -4662,10 +4660,11 @@ function attrBoolValue(s) {
4662
4660
  * @publicApi
4663
4661
  */
4664
4662
  class RouterLinkActive {
4665
- constructor(router, element, renderer, link, linkWithHref) {
4663
+ constructor(router, element, renderer, cdr, link, linkWithHref) {
4666
4664
  this.router = router;
4667
4665
  this.element = element;
4668
4666
  this.renderer = renderer;
4667
+ this.cdr = cdr;
4669
4668
  this.link = link;
4670
4669
  this.linkWithHref = linkWithHref;
4671
4670
  this.classes = [];
@@ -4699,6 +4698,7 @@ class RouterLinkActive {
4699
4698
  const hasActiveLinks = this.hasActiveLinks();
4700
4699
  if (this.isActive !== hasActiveLinks) {
4701
4700
  this.isActive = hasActiveLinks;
4701
+ this.cdr.markForCheck();
4702
4702
  this.classes.forEach((c) => {
4703
4703
  if (hasActiveLinks) {
4704
4704
  this.renderer.addClass(this.element.nativeElement, c);
@@ -4730,6 +4730,7 @@ RouterLinkActive.ctorParameters = () => [
4730
4730
  { type: Router },
4731
4731
  { type: ElementRef },
4732
4732
  { type: Renderer2 },
4733
+ { type: ChangeDetectorRef },
4733
4734
  { type: RouterLink, decorators: [{ type: Optional }] },
4734
4735
  { type: RouterLinkWithHref, decorators: [{ type: Optional }] }
4735
4736
  ];
@@ -5475,7 +5476,7 @@ function provideRouterInitializer() {
5475
5476
  /**
5476
5477
  * @publicApi
5477
5478
  */
5478
- const VERSION = new Version('10.0.0');
5479
+ const VERSION = new Version('10.0.4');
5479
5480
 
5480
5481
  /**
5481
5482
  * @license