@angular/router 14.1.0-next.0 → 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 +31 -56
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- 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 +1 -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/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 +571 -544
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +569 -545
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +102 -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.1.0-next.
|
|
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.1.0-next.
|
|
105
|
-
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.
|
|
106
|
-
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
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.1.0-next.
|
|
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.1.0-next.
|
|
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.
|
|
@@ -2131,6 +2226,12 @@ export declare interface Route {
|
|
|
2131
2226
|
* activate the component. By default, any user can activate.
|
|
2132
2227
|
*/
|
|
2133
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>>;
|
|
2134
2235
|
/**
|
|
2135
2236
|
* An array of DI tokens used to look up `CanActivateChild()` handlers,
|
|
2136
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.1.0-next.
|
|
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.1.0-next.
|
|
28
|
-
"@angular/common": "14.1.0-next.
|
|
29
|
-
"@angular/platform-browser": "14.1.0-next.
|
|
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