@angular/router 6.0.3 → 6.0.7

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.
Files changed (84) hide show
  1. package/bundles/router-testing.umd.js +21 -15
  2. package/bundles/router-testing.umd.js.map +1 -1
  3. package/bundles/router-testing.umd.min.js +2 -2
  4. package/bundles/router-testing.umd.min.js.map +1 -1
  5. package/bundles/router-upgrade.umd.js +10 -1
  6. package/bundles/router-upgrade.umd.js.map +1 -1
  7. package/bundles/router-upgrade.umd.min.js +1 -1
  8. package/bundles/router-upgrade.umd.min.js.map +1 -1
  9. package/bundles/router.umd.js +348 -706
  10. package/bundles/router.umd.js.map +1 -1
  11. package/bundles/router.umd.min.js +18 -18
  12. package/bundles/router.umd.min.js.map +1 -1
  13. package/esm2015/index.js +2 -2
  14. package/esm2015/public_api.js +2 -2
  15. package/esm2015/src/components/empty_outlet.js +28 -0
  16. package/esm2015/src/config.js +13 -6
  17. package/esm2015/src/directives/router_link.js +29 -47
  18. package/esm2015/src/directives/router_link_active.js +9 -18
  19. package/esm2015/src/directives/router_outlet.js +8 -17
  20. package/esm2015/src/index.js +2 -2
  21. package/esm2015/src/private_export.js +2 -1
  22. package/esm2015/src/router.js +4 -4
  23. package/esm2015/src/router_config_loader.js +3 -3
  24. package/esm2015/src/router_module.js +11 -22
  25. package/esm2015/src/router_preloader.js +6 -13
  26. package/esm2015/src/version.js +1 -1
  27. package/esm2015/testing/src/router_testing_module.js +2 -20
  28. package/esm5/index.js +5 -1
  29. package/esm5/public_api.js +6 -1
  30. package/esm5/src/apply_redirects.js +14 -26
  31. package/esm5/src/components/empty_outlet.js +28 -0
  32. package/esm5/src/config.js +15 -6
  33. package/esm5/src/create_router_state.js +1 -1
  34. package/esm5/src/create_url_tree.js +2 -4
  35. package/esm5/src/directives/router_link.js +33 -33
  36. package/esm5/src/directives/router_link_active.js +9 -9
  37. package/esm5/src/directives/router_outlet.js +10 -22
  38. package/esm5/src/events.js +86 -340
  39. package/esm5/src/index.js +1 -1
  40. package/esm5/src/interfaces.js +1 -1
  41. package/esm5/src/pre_activation.js +12 -68
  42. package/esm5/src/private_export.js +2 -1
  43. package/esm5/src/recognize.js +5 -5
  44. package/esm5/src/route_reuse_strategy.js +3 -23
  45. package/esm5/src/router.js +49 -311
  46. package/esm5/src/router_config_loader.js +5 -4
  47. package/esm5/src/router_module.js +15 -44
  48. package/esm5/src/router_outlet_context.js +6 -46
  49. package/esm5/src/router_preloader.js +10 -71
  50. package/esm5/src/router_state.js +49 -231
  51. package/esm5/src/shared.js +1 -1
  52. package/esm5/src/url_handling_strategy.js +3 -23
  53. package/esm5/src/url_tree.js +33 -239
  54. package/esm5/src/utils/collection.js +1 -1
  55. package/esm5/src/utils/tree.js +6 -36
  56. package/esm5/src/version.js +7 -2
  57. package/esm5/testing/index.js +5 -1
  58. package/esm5/testing/public_api.js +6 -1
  59. package/esm5/testing/src/router_testing_module.js +7 -15
  60. package/esm5/testing/src/testing.js +6 -1
  61. package/esm5/upgrade/index.js +5 -1
  62. package/esm5/upgrade/public_api.js +6 -1
  63. package/esm5/upgrade/src/upgrade.js +1 -1
  64. package/fesm2015/router.js +100 -64
  65. package/fesm2015/router.js.map +1 -1
  66. package/fesm2015/testing.js +2 -4
  67. package/fesm2015/testing.js.map +1 -1
  68. package/fesm2015/upgrade.js +1 -1
  69. package/fesm2015/upgrade.js.map +1 -1
  70. package/fesm5/router.js +349 -708
  71. package/fesm5/router.js.map +1 -1
  72. package/fesm5/testing.js +21 -15
  73. package/fesm5/testing.js.map +1 -1
  74. package/fesm5/upgrade.js +10 -1
  75. package/fesm5/upgrade.js.map +1 -1
  76. package/package.json +4 -4
  77. package/router.metadata.json +1 -1
  78. package/src/components/empty_outlet.d.ts +11 -0
  79. package/src/config.d.ts +4 -1
  80. package/src/private_export.d.ts +1 -0
  81. package/testing.d.ts +0 -5
  82. package/testing.metadata.json +1 -1
  83. package/upgrade.d.ts +0 -5
  84. package/upgrade.metadata.json +1 -1
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v6.0.3
2
+ * @license Angular v6.0.7
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import { APP_BASE_HREF, HashLocationStrategy, LOCATION_INITIALIZED, Location, LocationStrategy, PathLocationStrategy, PlatformLocation } from '@angular/common';
8
- import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ApplicationRef, Attribute, ChangeDetectorRef, Compiler, ComponentFactoryResolver, ContentChildren, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Injectable, InjectionToken, Injector, Input, NgModule, NgModuleFactory, NgModuleFactoryLoader, NgModuleRef, NgProbeToken, Optional, Output, Renderer2, SkipSelf, SystemJsNgModuleLoader, Version, ViewContainerRef, isDevMode, ɵisObservable, ɵisPromise } from '@angular/core';
8
+ import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ApplicationRef, Attribute, ChangeDetectorRef, Compiler, Component, ComponentFactoryResolver, ContentChildren, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Injectable, InjectionToken, Injector, Input, NgModule, NgModuleFactory, NgModuleFactoryLoader, NgModuleRef, NgProbeToken, Optional, Output, Renderer2, SkipSelf, SystemJsNgModuleLoader, Version, ViewContainerRef, isDevMode, ɵisObservable, ɵisPromise } from '@angular/core';
9
9
  import { BehaviorSubject, EmptyError, Observable, Subject, from, of } from 'rxjs';
10
10
  import { catchError, concatAll, concatMap, every, filter, first, last, map, mergeAll, mergeMap, reduce } from 'rxjs/operators';
11
11
  import { ɵgetDOM } from '@angular/platform-browser';
@@ -457,6 +457,32 @@ class ActivationEnd {
457
457
  }
458
458
  }
459
459
 
460
+ /**
461
+ * @fileoverview added by tsickle
462
+ * @suppress {checkTypes} checked by tsc
463
+ */
464
+ /**
465
+ * @license
466
+ * Copyright Google Inc. All Rights Reserved.
467
+ *
468
+ * Use of this source code is governed by an MIT-style license that can be
469
+ * found in the LICENSE file at https://angular.io/license
470
+ */
471
+ /**
472
+ * This component is used internally within the router to be a placeholder when an empty
473
+ * router-outlet is needed. For example, with a config such as:
474
+ *
475
+ * `{path: 'parent', outlet: 'nav', children: [...]}`
476
+ *
477
+ * In order to render, there needs to be a component on this config, which will default
478
+ * to this `EmptyOutletComponent`.
479
+ */
480
+ class EmptyOutletComponent {
481
+ }
482
+ EmptyOutletComponent.decorators = [
483
+ { type: Component, args: [{ template: `<router-outlet></router-outlet>` }] }
484
+ ];
485
+
460
486
  /**
461
487
  * @fileoverview added by tsickle
462
488
  * @suppress {checkTypes} checked by tsc
@@ -650,8 +676,9 @@ function validateNode(route, fullPath) {
650
676
  if (Array.isArray(route)) {
651
677
  throw new Error(`Invalid configuration of route '${fullPath}': Array cannot be specified`);
652
678
  }
653
- if (!route.component && (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
654
- throw new Error(`Invalid configuration of route '${fullPath}': a componentless route cannot have a named outlet set`);
679
+ if (!route.component && !route.children && !route.loadChildren &&
680
+ (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
681
+ throw new Error(`Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
655
682
  }
656
683
  if (route.redirectTo && route.children) {
657
684
  throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
@@ -711,12 +738,17 @@ function getFullPath(parentPath, currentRoute) {
711
738
  }
712
739
  }
713
740
  /**
741
+ * Makes a copy of the config and adds any default required properties.
714
742
  * @param {?} r
715
743
  * @return {?}
716
744
  */
717
- function copyConfig(r) {
718
- const /** @type {?} */ children = r.children && r.children.map(copyConfig);
719
- return children ? Object.assign({}, r, { children }) : Object.assign({}, r);
745
+ function standardizeConfig(r) {
746
+ const /** @type {?} */ children = r.children && r.children.map(standardizeConfig);
747
+ const /** @type {?} */ c = children ? Object.assign({}, r, { children }) : Object.assign({}, r);
748
+ if (!c.component && (children || c.loadChildren) && (c.outlet && c.outlet !== PRIMARY_OUTLET)) {
749
+ c.component = EmptyOutletComponent;
750
+ }
751
+ return c;
720
752
  }
721
753
 
722
754
  /**
@@ -4066,7 +4098,7 @@ class RouterConfigLoader {
4066
4098
  this.onLoadEndListener(route);
4067
4099
  }
4068
4100
  const /** @type {?} */ module = factory.create(parentInjector);
4069
- return new LoadedRouterConfig(flatten(module.injector.get(ROUTES)).map(copyConfig), module);
4101
+ return new LoadedRouterConfig(flatten(module.injector.get(ROUTES)).map(standardizeConfig), module);
4070
4102
  }));
4071
4103
  }
4072
4104
  /**
@@ -4321,7 +4353,7 @@ class Router {
4321
4353
  */
4322
4354
  resetConfig(config) {
4323
4355
  validateConfig(config);
4324
- this.config = config.map(copyConfig);
4356
+ this.config = config.map(standardizeConfig);
4325
4357
  this.navigated = false;
4326
4358
  this.lastSuccessfulId = -1;
4327
4359
  }
@@ -5169,22 +5201,22 @@ RouterLink.decorators = [
5169
5201
  ];
5170
5202
  /** @nocollapse */
5171
5203
  RouterLink.ctorParameters = () => [
5172
- { type: Router, },
5173
- { type: ActivatedRoute, },
5174
- { type: undefined, decorators: [{ type: Attribute, args: ['tabindex',] },] },
5175
- { type: Renderer2, },
5176
- { type: ElementRef, },
5204
+ { type: Router },
5205
+ { type: ActivatedRoute },
5206
+ { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
5207
+ { type: Renderer2 },
5208
+ { type: ElementRef }
5177
5209
  ];
5178
5210
  RouterLink.propDecorators = {
5179
- "queryParams": [{ type: Input },],
5180
- "fragment": [{ type: Input },],
5181
- "queryParamsHandling": [{ type: Input },],
5182
- "preserveFragment": [{ type: Input },],
5183
- "skipLocationChange": [{ type: Input },],
5184
- "replaceUrl": [{ type: Input },],
5185
- "routerLink": [{ type: Input },],
5186
- "preserveQueryParams": [{ type: Input },],
5187
- "onClick": [{ type: HostListener, args: ['click',] },],
5211
+ queryParams: [{ type: Input }],
5212
+ fragment: [{ type: Input }],
5213
+ queryParamsHandling: [{ type: Input }],
5214
+ preserveFragment: [{ type: Input }],
5215
+ skipLocationChange: [{ type: Input }],
5216
+ replaceUrl: [{ type: Input }],
5217
+ routerLink: [{ type: Input }],
5218
+ preserveQueryParams: [{ type: Input }],
5219
+ onClick: [{ type: HostListener, args: ['click',] }]
5188
5220
  };
5189
5221
  /**
5190
5222
  * \@description
@@ -5291,22 +5323,22 @@ RouterLinkWithHref.decorators = [
5291
5323
  ];
5292
5324
  /** @nocollapse */
5293
5325
  RouterLinkWithHref.ctorParameters = () => [
5294
- { type: Router, },
5295
- { type: ActivatedRoute, },
5296
- { type: LocationStrategy, },
5326
+ { type: Router },
5327
+ { type: ActivatedRoute },
5328
+ { type: LocationStrategy }
5297
5329
  ];
5298
5330
  RouterLinkWithHref.propDecorators = {
5299
- "target": [{ type: HostBinding, args: ['attr.target',] }, { type: Input },],
5300
- "queryParams": [{ type: Input },],
5301
- "fragment": [{ type: Input },],
5302
- "queryParamsHandling": [{ type: Input },],
5303
- "preserveFragment": [{ type: Input },],
5304
- "skipLocationChange": [{ type: Input },],
5305
- "replaceUrl": [{ type: Input },],
5306
- "href": [{ type: HostBinding },],
5307
- "routerLink": [{ type: Input },],
5308
- "preserveQueryParams": [{ type: Input },],
5309
- "onClick": [{ type: HostListener, args: ['click', ['$event.button', '$event.ctrlKey', '$event.metaKey', '$event.shiftKey'],] },],
5331
+ target: [{ type: HostBinding, args: ['attr.target',] }, { type: Input }],
5332
+ queryParams: [{ type: Input }],
5333
+ fragment: [{ type: Input }],
5334
+ queryParamsHandling: [{ type: Input }],
5335
+ preserveFragment: [{ type: Input }],
5336
+ skipLocationChange: [{ type: Input }],
5337
+ replaceUrl: [{ type: Input }],
5338
+ href: [{ type: HostBinding }],
5339
+ routerLink: [{ type: Input }],
5340
+ preserveQueryParams: [{ type: Input }],
5341
+ onClick: [{ type: HostListener, args: ['click', ['$event.button', '$event.ctrlKey', '$event.metaKey', '$event.shiftKey'],] }]
5310
5342
  };
5311
5343
  /**
5312
5344
  * @param {?} s
@@ -5474,16 +5506,16 @@ RouterLinkActive.decorators = [
5474
5506
  ];
5475
5507
  /** @nocollapse */
5476
5508
  RouterLinkActive.ctorParameters = () => [
5477
- { type: Router, },
5478
- { type: ElementRef, },
5479
- { type: Renderer2, },
5480
- { type: ChangeDetectorRef, },
5509
+ { type: Router },
5510
+ { type: ElementRef },
5511
+ { type: Renderer2 },
5512
+ { type: ChangeDetectorRef }
5481
5513
  ];
5482
5514
  RouterLinkActive.propDecorators = {
5483
- "links": [{ type: ContentChildren, args: [RouterLink, { descendants: true },] },],
5484
- "linksWithHrefs": [{ type: ContentChildren, args: [RouterLinkWithHref, { descendants: true },] },],
5485
- "routerLinkActiveOptions": [{ type: Input },],
5486
- "routerLinkActive": [{ type: Input },],
5515
+ links: [{ type: ContentChildren, args: [RouterLink, { descendants: true },] }],
5516
+ linksWithHrefs: [{ type: ContentChildren, args: [RouterLinkWithHref, { descendants: true },] }],
5517
+ routerLinkActiveOptions: [{ type: Input }],
5518
+ routerLinkActive: [{ type: Input }]
5487
5519
  };
5488
5520
 
5489
5521
  /**
@@ -5749,15 +5781,15 @@ RouterOutlet.decorators = [
5749
5781
  ];
5750
5782
  /** @nocollapse */
5751
5783
  RouterOutlet.ctorParameters = () => [
5752
- { type: ChildrenOutletContexts, },
5753
- { type: ViewContainerRef, },
5754
- { type: ComponentFactoryResolver, },
5755
- { type: undefined, decorators: [{ type: Attribute, args: ['name',] },] },
5756
- { type: ChangeDetectorRef, },
5784
+ { type: ChildrenOutletContexts },
5785
+ { type: ViewContainerRef },
5786
+ { type: ComponentFactoryResolver },
5787
+ { type: String, decorators: [{ type: Attribute, args: ['name',] }] },
5788
+ { type: ChangeDetectorRef }
5757
5789
  ];
5758
5790
  RouterOutlet.propDecorators = {
5759
- "activateEvents": [{ type: Output, args: ['activate',] },],
5760
- "deactivateEvents": [{ type: Output, args: ['deactivate',] },],
5791
+ activateEvents: [{ type: Output, args: ['activate',] }],
5792
+ deactivateEvents: [{ type: Output, args: ['deactivate',] }]
5761
5793
  };
5762
5794
  class OutletInjector {
5763
5795
  /**
@@ -5937,11 +5969,11 @@ RouterPreloader.decorators = [
5937
5969
  ];
5938
5970
  /** @nocollapse */
5939
5971
  RouterPreloader.ctorParameters = () => [
5940
- { type: Router, },
5941
- { type: NgModuleFactoryLoader, },
5942
- { type: Compiler, },
5943
- { type: Injector, },
5944
- { type: PreloadingStrategy, },
5972
+ { type: Router },
5973
+ { type: NgModuleFactoryLoader },
5974
+ { type: Compiler },
5975
+ { type: Injector },
5976
+ { type: PreloadingStrategy }
5945
5977
  ];
5946
5978
 
5947
5979
  /**
@@ -5962,7 +5994,7 @@ RouterPreloader.ctorParameters = () => [
5962
5994
  *
5963
5995
  *
5964
5996
  */
5965
- const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive];
5997
+ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, EmptyOutletComponent];
5966
5998
  /**
5967
5999
  * \@description
5968
6000
  *
@@ -6114,12 +6146,16 @@ class RouterModule {
6114
6146
  }
6115
6147
  }
6116
6148
  RouterModule.decorators = [
6117
- { type: NgModule, args: [{ declarations: ROUTER_DIRECTIVES, exports: ROUTER_DIRECTIVES },] }
6149
+ { type: NgModule, args: [{
6150
+ declarations: ROUTER_DIRECTIVES,
6151
+ exports: ROUTER_DIRECTIVES,
6152
+ entryComponents: [EmptyOutletComponent]
6153
+ },] }
6118
6154
  ];
6119
6155
  /** @nocollapse */
6120
6156
  RouterModule.ctorParameters = () => [
6121
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [ROUTER_FORROOT_GUARD,] },] },
6122
- { type: Router, decorators: [{ type: Optional },] },
6157
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [ROUTER_FORROOT_GUARD,] }] },
6158
+ { type: Router, decorators: [{ type: Optional }] }
6123
6159
  ];
6124
6160
  /**
6125
6161
  * @param {?} platformLocationStrategy
@@ -6326,7 +6362,7 @@ RouterInitializer.decorators = [
6326
6362
  ];
6327
6363
  /** @nocollapse */
6328
6364
  RouterInitializer.ctorParameters = () => [
6329
- { type: Injector, },
6365
+ { type: Injector }
6330
6366
  ];
6331
6367
  /**
6332
6368
  * @param {?} r
@@ -6376,7 +6412,7 @@ function provideRouterInitializer() {
6376
6412
  * Use of this source code is governed by an MIT-style license that can be
6377
6413
  * found in the LICENSE file at https://angular.io/license
6378
6414
  */
6379
- const VERSION = new Version('6.0.3');
6415
+ const VERSION = new Version('6.0.7');
6380
6416
 
6381
6417
  /**
6382
6418
  * @fileoverview added by tsickle
@@ -6441,5 +6477,5 @@ const VERSION = new Version('6.0.3');
6441
6477
  * Generated bundle index. Do not edit.
6442
6478
  */
6443
6479
 
6444
- export { ROUTER_FORROOT_GUARD as ɵangular_packages_router_router_a, RouterInitializer as ɵangular_packages_router_router_g, getAppInitializer as ɵangular_packages_router_router_h, getBootstrapListener as ɵangular_packages_router_router_i, provideForRootGuard as ɵangular_packages_router_router_d, provideLocationStrategy as ɵangular_packages_router_router_c, provideRouterInitializer as ɵangular_packages_router_router_j, rootRoute as ɵangular_packages_router_router_f, routerNgProbeToken as ɵangular_packages_router_router_b, setupRouter as ɵangular_packages_router_router_e, Tree as ɵangular_packages_router_router_k, TreeNode as ɵangular_packages_router_router_l, RouterLink, RouterLinkWithHref, RouterLinkActive, RouterOutlet, ActivationEnd, ActivationStart, ChildActivationEnd, ChildActivationStart, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouterEvent, RoutesRecognized, RouteReuseStrategy, Router, ROUTES, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, RouterModule, provideRoutes, ChildrenOutletContexts, OutletContext, NoPreloading, PreloadAllModules, PreloadingStrategy, RouterPreloader, ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot, PRIMARY_OUTLET, convertToParamMap, UrlHandlingStrategy, DefaultUrlSerializer, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, flatten as ɵflatten };
6480
+ export { ROUTER_FORROOT_GUARD as ɵangular_packages_router_router_a, RouterInitializer as ɵangular_packages_router_router_g, getAppInitializer as ɵangular_packages_router_router_h, getBootstrapListener as ɵangular_packages_router_router_i, provideForRootGuard as ɵangular_packages_router_router_d, provideLocationStrategy as ɵangular_packages_router_router_c, provideRouterInitializer as ɵangular_packages_router_router_j, rootRoute as ɵangular_packages_router_router_f, routerNgProbeToken as ɵangular_packages_router_router_b, setupRouter as ɵangular_packages_router_router_e, Tree as ɵangular_packages_router_router_k, TreeNode as ɵangular_packages_router_router_l, RouterLink, RouterLinkWithHref, RouterLinkActive, RouterOutlet, ActivationEnd, ActivationStart, ChildActivationEnd, ChildActivationStart, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouterEvent, RoutesRecognized, RouteReuseStrategy, Router, ROUTES, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, RouterModule, provideRoutes, ChildrenOutletContexts, OutletContext, NoPreloading, PreloadAllModules, PreloadingStrategy, RouterPreloader, ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot, PRIMARY_OUTLET, convertToParamMap, UrlHandlingStrategy, DefaultUrlSerializer, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, EmptyOutletComponent as ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, flatten as ɵflatten };
6445
6481
  //# sourceMappingURL=router.js.map