@angular/router 14.0.1 → 14.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/apply_redirects.mjs +33 -93
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/create_url_tree.mjs +127 -4
- package/esm2020/src/directives/router_link.mjs +6 -6
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/index.mjs +2 -1
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/operators/check_guards.mjs +48 -4
- package/esm2020/src/operators/recognize.mjs +3 -3
- package/esm2020/src/page_title_strategy.mjs +3 -3
- package/esm2020/src/recognize.mjs +135 -111
- package/esm2020/src/router.mjs +8 -37
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +11 -11
- package/esm2020/src/router_preloader.mjs +3 -3
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/url_tree.mjs +39 -1
- package/esm2020/src/utils/config_matching.mjs +12 -1
- package/esm2020/src/utils/type_guards.mjs +4 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +4 -4
- package/fesm2015/router.mjs +2559 -2406
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +2558 -2408
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +155 -1
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2020/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.1
|
|
2
|
+
* @license Angular v14.1.0-next.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -101,9 +101,9 @@ class RouterTestingModule {
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
105
|
-
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
|
|
106
|
-
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterTestingModule, providers: [
|
|
104
|
+
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
105
|
+
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
|
|
106
|
+
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterTestingModule, providers: [
|
|
107
107
|
ɵROUTER_PROVIDERS,
|
|
108
108
|
EXTRA_ROUTER_TESTING_PROVIDERS,
|
|
109
109
|
{ provide: Location, useClass: SpyLocation },
|
|
@@ -128,7 +128,7 @@ RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
|
128
128
|
{ provide: PreloadingStrategy, useExisting: NoPreloading },
|
|
129
129
|
provideRoutes([]),
|
|
130
130
|
], imports: [RouterModule] });
|
|
131
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterTestingModule, decorators: [{
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterTestingModule, decorators: [{
|
|
132
132
|
type: NgModule,
|
|
133
133
|
args: [{
|
|
134
134
|
exports: [RouterModule],
|
package/fesm2020/upgrade.mjs
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.1
|
|
2
|
+
* @license Angular v14.1.0-next.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -579,6 +579,101 @@ export declare interface CanLoad {
|
|
|
579
579
|
canLoad(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
+
/**
|
|
583
|
+
* @description
|
|
584
|
+
*
|
|
585
|
+
* Interface that a class can implement to be a guard deciding if a `Route` can be matched.
|
|
586
|
+
* If all guards return `true`, navigation continues and the `Router` will use the `Route` during
|
|
587
|
+
* activation. If any guard returns `false`, the `Route` is skipped for matching and other `Route`
|
|
588
|
+
* configurations are processed instead.
|
|
589
|
+
*
|
|
590
|
+
* The following example implements a `CanMatch` function that decides whether the
|
|
591
|
+
* current user has permission to access the users page.
|
|
592
|
+
*
|
|
593
|
+
*
|
|
594
|
+
* ```
|
|
595
|
+
* class UserToken {}
|
|
596
|
+
* class Permissions {
|
|
597
|
+
* canAccess(user: UserToken, id: string, segments: UrlSegment[]): boolean {
|
|
598
|
+
* return true;
|
|
599
|
+
* }
|
|
600
|
+
* }
|
|
601
|
+
*
|
|
602
|
+
* @Injectable()
|
|
603
|
+
* class CanMatchTeamSection implements CanMatch {
|
|
604
|
+
* constructor(private permissions: Permissions, private currentUser: UserToken) {}
|
|
605
|
+
*
|
|
606
|
+
* canLoad(route: Route, segments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean {
|
|
607
|
+
* return this.permissions.canAccess(this.currentUser, route, segments);
|
|
608
|
+
* }
|
|
609
|
+
* }
|
|
610
|
+
* ```
|
|
611
|
+
*
|
|
612
|
+
* Here, the defined guard function is provided as part of the `Route` object
|
|
613
|
+
* in the router configuration:
|
|
614
|
+
*
|
|
615
|
+
* ```
|
|
616
|
+
*
|
|
617
|
+
* @NgModule({
|
|
618
|
+
* imports: [
|
|
619
|
+
* RouterModule.forRoot([
|
|
620
|
+
* {
|
|
621
|
+
* path: 'team/:id',
|
|
622
|
+
* component: TeamComponent,
|
|
623
|
+
* loadChildren: () => import('./team').then(mod => mod.TeamModule),
|
|
624
|
+
* canMatch: [CanMatchTeamSection]
|
|
625
|
+
* },
|
|
626
|
+
* {
|
|
627
|
+
* path: '**',
|
|
628
|
+
* component: NotFoundComponent
|
|
629
|
+
* }
|
|
630
|
+
* ])
|
|
631
|
+
* ],
|
|
632
|
+
* providers: [CanMatchTeamSection, UserToken, Permissions]
|
|
633
|
+
* })
|
|
634
|
+
* class AppModule {}
|
|
635
|
+
* ```
|
|
636
|
+
*
|
|
637
|
+
* If the `CanMatchTeamSection` were to return `false`, the router would continue navigating to the
|
|
638
|
+
* `team/:id` URL, but would load the `NotFoundComponent` because the `Route` for `'team/:id'`
|
|
639
|
+
* could not be used for a URL match but the catch-all `**` `Route` did instead.
|
|
640
|
+
*
|
|
641
|
+
* You can alternatively provide an in-line function with the `canMatch` signature:
|
|
642
|
+
*
|
|
643
|
+
* ```
|
|
644
|
+
* @NgModule({
|
|
645
|
+
* imports: [
|
|
646
|
+
* RouterModule.forRoot([
|
|
647
|
+
* {
|
|
648
|
+
* path: 'team/:id',
|
|
649
|
+
* component: TeamComponent,
|
|
650
|
+
* loadChildren: () => import('./team').then(mod => mod.TeamModule),
|
|
651
|
+
* canMatch: ['canMatchTeamSection']
|
|
652
|
+
* },
|
|
653
|
+
* {
|
|
654
|
+
* path: '**',
|
|
655
|
+
* component: NotFoundComponent
|
|
656
|
+
* }
|
|
657
|
+
* ])
|
|
658
|
+
* ],
|
|
659
|
+
* providers: [
|
|
660
|
+
* {
|
|
661
|
+
* provide: 'canMatchTeamSection',
|
|
662
|
+
* useValue: (route: Route, segments: UrlSegment[]) => true
|
|
663
|
+
* }
|
|
664
|
+
* ]
|
|
665
|
+
* })
|
|
666
|
+
* class AppModule {}
|
|
667
|
+
* ```
|
|
668
|
+
*
|
|
669
|
+
* @publicApi
|
|
670
|
+
*/
|
|
671
|
+
export declare interface CanMatch {
|
|
672
|
+
canMatch(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
declare type CanMatchFn = (route: Route, segments: UrlSegment[]) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean;
|
|
676
|
+
|
|
582
677
|
/**
|
|
583
678
|
* An event triggered at the end of the child-activation part
|
|
584
679
|
* of the Resolve phase of routing.
|
|
@@ -648,6 +743,59 @@ export declare class ChildrenOutletContexts {
|
|
|
648
743
|
*/
|
|
649
744
|
export declare function convertToParamMap(params: Params): ParamMap;
|
|
650
745
|
|
|
746
|
+
/**
|
|
747
|
+
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
748
|
+
*
|
|
749
|
+
* @publicApi
|
|
750
|
+
*
|
|
751
|
+
*
|
|
752
|
+
* @param relativeTo The `ActivatedRouteSnapshot` to apply the commands to
|
|
753
|
+
* @param commands An array of URL fragments with which to construct the new URL tree.
|
|
754
|
+
* If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
|
|
755
|
+
* segments, followed by the parameters for each segment.
|
|
756
|
+
* The fragments are applied to the one provided in the `relativeTo` parameter.
|
|
757
|
+
* @param queryParams The query parameters for the `UrlTree`. `null` if the `UrlTree` does not have
|
|
758
|
+
* any query parameters.
|
|
759
|
+
* @param fragment The fragment for the `UrlTree`. `null` if the `UrlTree` does not have a fragment.
|
|
760
|
+
*
|
|
761
|
+
* @usageNotes
|
|
762
|
+
*
|
|
763
|
+
* ```
|
|
764
|
+
* // create /team/33/user/11
|
|
765
|
+
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, 'user', 11]);
|
|
766
|
+
*
|
|
767
|
+
* // create /team/33;expand=true/user/11
|
|
768
|
+
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, {expand: true}, 'user', 11]);
|
|
769
|
+
*
|
|
770
|
+
* // you can collapse static segments like this (this works only with the first passed-in value):
|
|
771
|
+
* createUrlTreeFromSnapshot(snapshot, ['/team/33/user', userId]);
|
|
772
|
+
*
|
|
773
|
+
* // If the first segment can contain slashes, and you do not want the router to split it,
|
|
774
|
+
* // you can do the following:
|
|
775
|
+
* createUrlTreeFromSnapshot(snapshot, [{segmentPath: '/one/two'}]);
|
|
776
|
+
*
|
|
777
|
+
* // create /team/33/(user/11//right:chat)
|
|
778
|
+
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right:
|
|
779
|
+
* 'chat'}}], null, null);
|
|
780
|
+
*
|
|
781
|
+
* // remove the right secondary node
|
|
782
|
+
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
|
|
783
|
+
*
|
|
784
|
+
* // For the examples below, assume the current URL is for the `/team/33/user/11` and the
|
|
785
|
+
* `ActivatedRouteSnapshot` points to `user/11`:
|
|
786
|
+
*
|
|
787
|
+
* // navigate to /team/33/user/11/details
|
|
788
|
+
* createUrlTreeFromSnapshot(snapshot, ['details']);
|
|
789
|
+
*
|
|
790
|
+
* // navigate to /team/33/user/22
|
|
791
|
+
* createUrlTreeFromSnapshot(snapshot, ['../22']);
|
|
792
|
+
*
|
|
793
|
+
* // navigate to /team/44/user/22
|
|
794
|
+
* createUrlTreeFromSnapshot(snapshot, ['../../team/44/user/22']);
|
|
795
|
+
* ```
|
|
796
|
+
*/
|
|
797
|
+
export declare function createUrlTreeFromSnapshot(relativeTo: ActivatedRouteSnapshot, commands: any[], queryParams?: Params | null, fragment?: string | null): UrlTree;
|
|
798
|
+
|
|
651
799
|
/**
|
|
652
800
|
*
|
|
653
801
|
* Represents static data associated with a particular route.
|
|
@@ -2078,6 +2226,12 @@ export declare interface Route {
|
|
|
2078
2226
|
* activate the component. By default, any user can activate.
|
|
2079
2227
|
*/
|
|
2080
2228
|
canActivate?: any[];
|
|
2229
|
+
/**
|
|
2230
|
+
* An array of DI tokens used to look up `CanMatch()`
|
|
2231
|
+
* handlers, in order to determine if the current user is allowed to
|
|
2232
|
+
* match the `Route`. By default, any route can match.
|
|
2233
|
+
*/
|
|
2234
|
+
canMatch?: Array<Type<CanMatch> | InjectionToken<CanMatchFn>>;
|
|
2081
2235
|
/**
|
|
2082
2236
|
* An array of DI tokens used to look up `CanActivateChild()` handlers,
|
|
2083
2237
|
* in order to determine if the current user is allowed to activate
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/router",
|
|
3
|
-
"version": "14.0.1",
|
|
3
|
+
"version": "14.1.0-next.1",
|
|
4
4
|
"description": "Angular - the routing library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"tslib": "^2.3.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@angular/core": "14.0.1",
|
|
28
|
-
"@angular/common": "14.0.1",
|
|
29
|
-
"@angular/platform-browser": "14.0.1",
|
|
27
|
+
"@angular/core": "14.1.0-next.1",
|
|
28
|
+
"@angular/common": "14.1.0-next.1",
|
|
29
|
+
"@angular/platform-browser": "14.1.0-next.1",
|
|
30
30
|
"rxjs": "^6.5.3 || ^7.4.0"
|
|
31
31
|
},
|
|
32
32
|
"ng-update": {
|
package/testing/index.d.ts
CHANGED
package/upgrade/index.d.ts
CHANGED