@coolon/angular-ui-powerups 0.0.67 → 0.0.69
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/bundles/coolon-angular-ui-powerups.umd.js +2723 -2285
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.d.ts +24 -22
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +24 -22
- package/esm2015/index.js +2 -2
- package/esm2015/lib/angular-ui-powerups.module.js +6 -3
- package/esm2015/lib/components/index.js +2 -1
- package/esm2015/lib/components/noop/noop.component.js +19 -0
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -2
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +2 -2
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
- package/esm2015/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +19 -0
- package/esm2015/lib/interaction/guards/interaction-guard.service.js +85 -0
- package/esm2015/lib/interaction/index.js +3 -2
- package/esm2015/lib/interaction/interaction.module.js +8 -3
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +30 -5
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +5 -5
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +2 -2
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +60 -66
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +2 -2
- package/esm2015/lib/place/index.js +9 -8
- package/esm2015/lib/place/navigation-session.js +147 -0
- package/esm2015/lib/place/place-component.js +18 -14
- package/esm2015/lib/place/place-definition.js +207 -5
- package/esm2015/lib/place/place-history.js +3 -2
- package/esm2015/lib/place/place-router.js +184 -89
- package/esm2015/lib/place/route/formatter.js +63 -0
- package/esm2015/lib/place/route/guards/leave-place.guard.js +193 -0
- package/esm2015/lib/place/route/guards/place-route.guard.js +243 -0
- package/esm2015/lib/place/route/parameter-decorators.js +35 -18
- package/esm2015/lib/place/route/parameter-definition.class.js +123 -67
- package/esm2015/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm2015/lib/place/route/parameter-snapshot.js +11 -388
- package/esm2015/lib/place/route/visit-sanitiser.js +88 -0
- package/esm2015/lib/place/visit.js +107 -8
- package/esm2015/public_api.js +4 -4
- package/esm5/coolon-angular-ui-powerups.js +24 -22
- package/esm5/index.js +2 -2
- package/esm5/lib/angular-ui-powerups.module.js +6 -3
- package/esm5/lib/components/index.js +2 -1
- package/esm5/lib/components/noop/noop.component.js +21 -0
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -2
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +2 -2
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
- package/esm5/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +21 -0
- package/esm5/lib/interaction/guards/interaction-guard.service.js +94 -0
- package/esm5/lib/interaction/index.js +3 -2
- package/esm5/lib/interaction/interaction.module.js +8 -3
- package/esm5/lib/interaction/services/dialog-interaction.service.js +28 -5
- package/esm5/lib/place/components/abstract-place-navigation.component.js +5 -5
- package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +2 -2
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +70 -82
- package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +2 -2
- package/esm5/lib/place/index.js +9 -8
- package/esm5/lib/place/navigation-session.js +193 -0
- package/esm5/lib/place/place-component.js +19 -15
- package/esm5/lib/place/place-definition.js +263 -5
- package/esm5/lib/place/place-history.js +7 -3
- package/esm5/lib/place/place-router.js +241 -108
- package/esm5/lib/place/route/formatter.js +96 -0
- package/esm5/lib/place/route/guards/leave-place.guard.js +152 -0
- package/esm5/lib/place/route/guards/place-route.guard.js +273 -0
- package/esm5/lib/place/route/parameter-decorators.js +35 -18
- package/esm5/lib/place/route/parameter-definition.class.js +179 -76
- package/esm5/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm5/lib/place/route/parameter-snapshot.js +11 -480
- package/esm5/lib/place/route/visit-sanitiser.js +99 -0
- package/esm5/lib/place/visit.js +160 -8
- package/esm5/public_api.js +4 -4
- package/fesm2015/coolon-angular-ui-powerups.js +1452 -1108
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +2715 -2281
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/noop/noop.component.d.ts +3 -0
- package/lib/interaction/components/interaction-outlet/interaction-outlet.component.d.ts +3 -0
- package/lib/interaction/guards/interaction-guard.service.d.ts +13 -0
- package/lib/interaction/index.d.ts +2 -1
- package/lib/interaction/services/dialog-interaction.service.d.ts +5 -1
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +12 -12
- package/lib/place/index.d.ts +5 -4
- package/lib/place/navigation-session.d.ts +26 -0
- package/lib/place/place-component.d.ts +3 -3
- package/lib/place/place-definition.d.ts +30 -3
- package/lib/place/place-history.d.ts +3 -3
- package/lib/place/place-router.d.ts +25 -19
- package/lib/place/route/{parameter-type.d.ts → formatter.d.ts} +5 -5
- package/lib/place/{guards → route/guards}/leave-place.guard.d.ts +3 -3
- package/lib/place/route/guards/place-route.guard.d.ts +27 -0
- package/lib/place/route/parameter-decorators.d.ts +14 -6
- package/lib/place/route/parameter-definition.class.d.ts +21 -17
- package/lib/place/route/parameter-sanitiser.d.ts +3 -2
- package/lib/place/route/parameter-snapshot.d.ts +4 -26
- package/lib/place/route/visit-sanitiser.d.ts +12 -0
- package/lib/place/visit.d.ts +24 -3
- package/package.json +1 -1
- package/schematics/place-routes/place-class-scanner.d.ts +2 -2
- package/schematics/place-routes/place-class-scanner.js +7 -7
- package/schematics/place-routes/place-class-scanner.js.map +1 -1
- package/schematics/place-routes/place-def.d.ts +3 -2
- package/schematics/place-routes/place-def.js +21 -12
- package/schematics/place-routes/place-def.js.map +1 -1
- package/schematics/place-routes/templates/place-destinations.ts.template +5 -3
- package/schematics/place-routes/templates/place-routes.ts.template +10 -1
- package/schematics/place-routes/templates/place-visits.ts.template +21 -0
- package/esm2015/lib/interaction/guards/close-interaction.guard.js +0 -62
- package/esm2015/lib/place/guards/leave-place.guard.js +0 -194
- package/esm2015/lib/place/guards/place-route.guard.js +0 -74
- package/esm2015/lib/place/route/parameter-type.js +0 -61
- package/esm2015/lib/place/route/route-parameter-value.js +0 -230
- package/esm5/lib/interaction/guards/close-interaction.guard.js +0 -66
- package/esm5/lib/place/guards/leave-place.guard.js +0 -159
- package/esm5/lib/place/guards/place-route.guard.js +0 -78
- package/esm5/lib/place/route/parameter-type.js +0 -94
- package/esm5/lib/place/route/route-parameter-value.js +0 -316
- package/lib/interaction/guards/close-interaction.guard.d.ts +0 -12
- package/lib/place/guards/place-route.guard.d.ts +0 -10
- package/lib/place/route/route-parameter-value.d.ts +0 -42
|
@@ -8,6 +8,7 @@ export * from "./forms/number-input/number-input.component";
|
|
|
8
8
|
export * from "./forms/password-input/password-input.component";
|
|
9
9
|
export * from "./forms/select-input/select-input.component";
|
|
10
10
|
export * from "./forms/string-input/string-input.component";
|
|
11
|
+
export * from "./noop/noop.component";
|
|
11
12
|
export * from "./types/bounds.class";
|
|
12
13
|
export * from "./types/dimension.class";
|
|
13
14
|
export * from "./types/point.class";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, CanActivate, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { NoopComponent } from '../../components/noop/noop.component';
|
|
5
|
+
import { InteractionContext } from '../interaction-context';
|
|
6
|
+
export declare class InteractionGuard implements CanDeactivate<NoopComponent>, CanActivate {
|
|
7
|
+
private router;
|
|
8
|
+
private injector;
|
|
9
|
+
private readonly interactionContext;
|
|
10
|
+
constructor(router: Router, injector: Injector, interactionContext: InteractionContext);
|
|
11
|
+
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
12
|
+
canDeactivate(component: NoopComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
13
|
+
}
|
|
@@ -14,5 +14,6 @@ export * from "./components/activity-outlet/activity-outlet.component";
|
|
|
14
14
|
export * from "./components/alert-dialog/alert-dialog.component";
|
|
15
15
|
export * from "./components/confirm-then-dialog/confirm-then-dialog.component";
|
|
16
16
|
export * from "./components/confirmation-dialog/confirmation-dialog.component";
|
|
17
|
-
export * from "./
|
|
17
|
+
export * from "./components/interaction-outlet/interaction-outlet.component";
|
|
18
|
+
export * from "./guards/interaction-guard.service";
|
|
18
19
|
export * from "./services/dialog-interaction.service";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
1
2
|
import { InjectionToken } from '@angular/core';
|
|
2
3
|
import { MatDialog } from '@angular/material';
|
|
3
4
|
import { MatDialogConfig } from '@angular/material/dialog';
|
|
5
|
+
import { Router } from '@angular/router';
|
|
4
6
|
import { Constructable, ListModel } from '@coolon/pectin';
|
|
5
7
|
import { Activity } from '../activity';
|
|
6
8
|
import { Alert } from '../alert';
|
|
@@ -9,12 +11,14 @@ import { InteractionContext } from '../interaction-context';
|
|
|
9
11
|
export declare const DIALOG_INTERACTION_SERVICE_DEFAULTS: InjectionToken<MatDialogConfig<any>>;
|
|
10
12
|
export declare class DialogInteractionService extends InteractionContext {
|
|
11
13
|
private readonly dialogService;
|
|
14
|
+
readonly location: Location;
|
|
15
|
+
readonly router: Router;
|
|
12
16
|
readonly dialogServiceDefaults: MatDialogConfig<any>;
|
|
13
17
|
readonly matDialogDefaultConfig: MatDialogConfig<any>;
|
|
14
18
|
private readonly _activityList;
|
|
15
19
|
private startingGuard;
|
|
16
20
|
private currentActivityId;
|
|
17
|
-
constructor(dialogService: MatDialog, dialogServiceDefaults: MatDialogConfig<any>, matDialogDefaultConfig: MatDialogConfig<any>);
|
|
21
|
+
constructor(dialogService: MatDialog, location: Location, router: Router, dialogServiceDefaults: MatDialogConfig<any>, matDialogDefaultConfig: MatDialogConfig<any>);
|
|
18
22
|
isActive(): boolean;
|
|
19
23
|
cancelActivity(): void;
|
|
20
24
|
readonly activityList: ListModel<Activity<any, any>>;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
2
|
-
import { RouterOutlet } from '@angular/router';
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { Router, RouterOutlet } from '@angular/router';
|
|
3
3
|
import { MutableValueModel, ValueModel } from '@coolon/pectin';
|
|
4
4
|
import { DisposableComponent } from '../../../components/disposable-component';
|
|
5
5
|
import { PlaceComponent } from '../../place-component';
|
|
6
6
|
import { PlaceDefinition } from '../../place-definition';
|
|
7
7
|
import { PlaceHistory } from '../../place-history';
|
|
8
8
|
import { PlaceRouter } from '../../place-router';
|
|
9
|
-
import {
|
|
9
|
+
import { Visit } from '../../visit';
|
|
10
10
|
interface PlaceRef {
|
|
11
11
|
readonly placeDefinition: PlaceDefinition;
|
|
12
|
-
initialiseBindings(param: ValueModel<
|
|
12
|
+
initialiseBindings(param: ValueModel<Visit>): void;
|
|
13
13
|
onPlaceReady(): void;
|
|
14
14
|
}
|
|
15
15
|
export declare class PlaceOutletComponent extends DisposableComponent implements OnInit {
|
|
16
16
|
private readonly router;
|
|
17
|
+
private readonly placeRouter;
|
|
17
18
|
private readonly placeHistory;
|
|
18
19
|
animate: boolean;
|
|
20
|
+
readonly placeChanged: EventEmitter<PlaceComponent>;
|
|
19
21
|
routerOut: RouterOutlet;
|
|
20
22
|
private readonly _activePlace;
|
|
21
|
-
private readonly _incomingRouteChange;
|
|
22
23
|
private readonly _inOutletUpdate;
|
|
23
24
|
private readonly _activatedRouteModel;
|
|
24
25
|
private readonly _placeDefinition;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor(router: PlaceRouter, placeHistory: PlaceHistory);
|
|
26
|
+
/** TODO: This is now really a visit */
|
|
27
|
+
readonly _placeVisit: MutableValueModel<Visit>;
|
|
28
|
+
constructor(router: Router, placeRouter: PlaceRouter, placeHistory: PlaceHistory);
|
|
28
29
|
ngOnInit(): void;
|
|
29
|
-
|
|
30
|
-
readonly
|
|
30
|
+
pushVisitChangesToRoute(next: Visit, previous: Visit): void;
|
|
31
|
+
readonly activePlaceModel: ValueModel<PlaceComponent>;
|
|
31
32
|
onOutletActivated(routerOutlet: RouterOutlet, place: PlaceComponent): void;
|
|
32
33
|
onOutletDeactivated(routerOutlet: RouterOutlet, $event: PlaceRef): void;
|
|
33
34
|
getPlaceOrder(outlet: RouterOutlet): any;
|
|
34
35
|
animationDone(): void;
|
|
35
|
-
|
|
36
|
-
sanitise(snapshot: ParameterSnapshot, callback: (sanitised: ParameterSnapshot) => void): ParameterSnapshot;
|
|
36
|
+
activate(placeDestination: Visit): void;
|
|
37
37
|
}
|
|
38
38
|
export {};
|
package/lib/place/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @file Automatically generated by barrelsby.
|
|
3
3
|
*/
|
|
4
4
|
export * from "./nav-item";
|
|
5
|
+
export * from "./navigation-session";
|
|
5
6
|
export * from "./place-component";
|
|
6
7
|
export * from "./place-definition";
|
|
7
8
|
export * from "./place-history";
|
|
@@ -16,12 +17,12 @@ export * from "./components/list-place-nav/list-place-nav.component";
|
|
|
16
17
|
export * from "./components/place-outlet/place-outlet.component";
|
|
17
18
|
export * from "./components/place-outlet/route-animations";
|
|
18
19
|
export * from "./components/tabbed-place-navigation/tabbed-place-navigation.component";
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./guards/place-route.guard";
|
|
20
|
+
export * from "./route/formatter";
|
|
21
21
|
export * from "./route/json-types";
|
|
22
22
|
export * from "./route/parameter-decorators";
|
|
23
23
|
export * from "./route/parameter-definition.class";
|
|
24
24
|
export * from "./route/parameter-sanitiser";
|
|
25
25
|
export * from "./route/parameter-snapshot";
|
|
26
|
-
export * from "./route/
|
|
27
|
-
export * from "./route/
|
|
26
|
+
export * from "./route/visit-sanitiser";
|
|
27
|
+
export * from "./route/guards/leave-place.guard";
|
|
28
|
+
export * from "./route/guards/place-route.guard";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PlaceComponent } from './place-component';
|
|
2
|
+
import { PlaceDefinition } from './place-definition';
|
|
3
|
+
import { Visit } from './visit';
|
|
4
|
+
export declare abstract class NavigationSession {
|
|
5
|
+
readonly firstNavigation: boolean;
|
|
6
|
+
private _alreadyAccepted;
|
|
7
|
+
private _visits;
|
|
8
|
+
private _popStateReturnUrl;
|
|
9
|
+
abstract readonly isExternal: boolean;
|
|
10
|
+
protected constructor(firstNavigation: boolean);
|
|
11
|
+
storeVisit(visit: Visit): void;
|
|
12
|
+
getVisitFor(placeDef: PlaceDefinition): Visit;
|
|
13
|
+
mergePrivatePlaceParameters(params: {
|
|
14
|
+
[p: string]: any;
|
|
15
|
+
}): NavigationSession;
|
|
16
|
+
alreadyAccepted(placeComponent: PlaceComponent): boolean;
|
|
17
|
+
rememberAcceptanceOf(component: PlaceComponent): void;
|
|
18
|
+
setPopstateReturn(url: string): void;
|
|
19
|
+
readonly isPopState: boolean;
|
|
20
|
+
readonly popStateReturnUrl: string;
|
|
21
|
+
getVisits(): Visit[];
|
|
22
|
+
}
|
|
23
|
+
export declare namespace NavigationSession {
|
|
24
|
+
function createInternal(visit: Visit): NavigationSession;
|
|
25
|
+
function createExternal(firstTimeRoute: boolean): NavigationSession;
|
|
26
|
+
}
|
|
@@ -3,13 +3,13 @@ import 'reflect-metadata';
|
|
|
3
3
|
import { DisposableComponent } from '../components/disposable-component';
|
|
4
4
|
import { PlaceDefinition } from './place-definition';
|
|
5
5
|
import { ParameterDefinition } from './route/parameter-definition.class';
|
|
6
|
-
import {
|
|
6
|
+
import { Visit } from './visit';
|
|
7
7
|
export declare const DEFINITION_META_DATA_KEY = "PLACE_DEFINITION_OPTIONS";
|
|
8
8
|
export declare const ROUTE_PARAMETER_LIST_KEY: unique symbol;
|
|
9
9
|
export declare class PlaceComponent extends DisposableComponent {
|
|
10
|
-
private
|
|
10
|
+
private visit;
|
|
11
11
|
constructor();
|
|
12
|
-
initialiseBindings(
|
|
12
|
+
initialiseBindings(visit: ValueModel<Visit>): void;
|
|
13
13
|
private installBinding;
|
|
14
14
|
readonly placeDefinition: PlaceDefinition;
|
|
15
15
|
readonly childPlaces: Constructable<PlaceComponent>[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ParamMap } from '@angular/router';
|
|
1
2
|
import { Constructable } from '@coolon/pectin';
|
|
2
3
|
import { PlaceComponent } from './place-component';
|
|
3
4
|
import { ParameterDefinition } from './route/parameter-definition.class';
|
|
5
|
+
import { Visit } from './visit';
|
|
4
6
|
export declare class PlaceDefinition {
|
|
5
7
|
readonly component: Constructable<PlaceComponent>;
|
|
6
8
|
readonly path: string;
|
|
@@ -14,7 +16,32 @@ export declare class PlaceDefinition {
|
|
|
14
16
|
constructor(component: Constructable<PlaceComponent>, path: string, authenticate: boolean, order: number, data: {
|
|
15
17
|
[key: string]: any;
|
|
16
18
|
}, routeParameters: ParameterDefinition<any>[], children: PlaceDefinition[]);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
hasRouteId(): boolean;
|
|
20
|
+
getRouteIdParameterDef(): ParameterDefinition<any>;
|
|
21
|
+
getRouteParameterDefs(includeRouteId?: boolean): ParameterDefinition<any>[];
|
|
22
|
+
getVisitParameterDefs(include?: PlaceDefinition.ParameterOptions): ParameterDefinition<any>[];
|
|
23
|
+
getPlaceData<T>(key: string, defaultValue?: T): T;
|
|
24
|
+
searchPlaceData<T>(keys: string[], defaultValue?: T): T;
|
|
25
|
+
getRouteIdFrom(visit: Visit): any;
|
|
26
|
+
/**
|
|
27
|
+
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
28
|
+
* not include any path information.
|
|
29
|
+
*/
|
|
30
|
+
getFormattedRouteId(visit: Visit): any;
|
|
31
|
+
getFormattedRouteParameters(visit: Visit, includeRouteId?: boolean): {
|
|
32
|
+
[p: string]: string;
|
|
33
|
+
};
|
|
34
|
+
getNonRouteParameters(visit: Visit): {
|
|
35
|
+
[p: string]: string;
|
|
36
|
+
};
|
|
37
|
+
parseRouteParams(params: ParamMap): {
|
|
38
|
+
[p: string]: any;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare namespace PlaceDefinition {
|
|
42
|
+
interface ParameterOptions {
|
|
43
|
+
includeRouteId?: boolean;
|
|
44
|
+
includeRouteParameters?: boolean;
|
|
45
|
+
includeNonRouteParameters?: boolean;
|
|
46
|
+
}
|
|
20
47
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Router } from '@angular/router';
|
|
2
2
|
import { PlaceDefinition } from './place-definition';
|
|
3
|
-
import {
|
|
3
|
+
import { Visit } from './visit';
|
|
4
4
|
export declare class PlaceHistory {
|
|
5
5
|
private readonly router;
|
|
6
6
|
private _history;
|
|
7
7
|
constructor(router: Router);
|
|
8
|
-
add(state:
|
|
9
|
-
getHistory(placeDef: PlaceDefinition):
|
|
8
|
+
add(state: Visit): void;
|
|
9
|
+
getHistory(placeDef: PlaceDefinition): Visit[];
|
|
10
10
|
private setHistory;
|
|
11
11
|
}
|
|
12
12
|
export declare namespace VisitHistory {
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import { Location } from '@angular/common';
|
|
2
|
-
import { ActivatedRoute, ActivatedRouteSnapshot, Router
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private _alreadyAccepted;
|
|
9
|
-
constructor(isPopState: boolean, initialUrl: string);
|
|
10
|
-
alreadyAccepted(placeComponent: PlaceComponent): boolean;
|
|
11
|
-
rememberAcceptanceOf(component: PlaceComponent): void;
|
|
12
|
-
}
|
|
13
|
-
export declare class PlaceRouter {
|
|
2
|
+
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
|
|
3
|
+
import { BooleanValueModelChain, GarbageCollector, HasOneIndexChain, ListModel, ValueModel } from '@coolon/pectin';
|
|
4
|
+
import { NavigationSession } from './navigation-session';
|
|
5
|
+
import { PlaceHistory } from './place-history';
|
|
6
|
+
import { Visit } from './visit';
|
|
7
|
+
export declare class PlaceRouter extends GarbageCollector {
|
|
14
8
|
private readonly router;
|
|
15
9
|
readonly angularLocation: Location;
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
readonly placeHistory: PlaceHistory;
|
|
11
|
+
private firstRoute;
|
|
12
|
+
private readonly _navigationSessionModel;
|
|
13
|
+
private readonly _activeVisits;
|
|
14
|
+
readonly navigationSessionActive: BooleanValueModelChain;
|
|
15
|
+
readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;
|
|
16
|
+
constructor(router: Router, angularLocation: Location, placeHistory: PlaceHistory);
|
|
18
17
|
readonly navigationSession: NavigationSession;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
readonly navigationSessionModel: ValueModel<NavigationSession>;
|
|
19
|
+
readonly activeVisits: ListModel<Visit>;
|
|
20
|
+
/**
|
|
21
|
+
* placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
|
|
22
|
+
* @param visit
|
|
23
|
+
*/
|
|
24
|
+
navigate(visit: Visit): Promise<void>;
|
|
25
|
+
pushVisitChangesToRoute(activatedRoute: ActivatedRoute, previous: Visit, next: Visit): Promise<void>;
|
|
26
|
+
doNavigation(visit: Visit, customNavigation?: (router: Router) => any): Promise<void>;
|
|
27
|
+
private onAngularRouterStarted;
|
|
28
|
+
private onAngularRouterFinished;
|
|
29
|
+
getChildPath(activatedRoute: ActivatedRouteSnapshot): any[];
|
|
23
30
|
}
|
|
24
|
-
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface Formatter<T> {
|
|
2
2
|
format(value: T): string;
|
|
3
3
|
parse(value: string): T;
|
|
4
4
|
}
|
|
5
|
-
export declare namespace
|
|
6
|
-
class StringType implements
|
|
5
|
+
export declare namespace Formatter {
|
|
6
|
+
class StringType implements Formatter<string> {
|
|
7
7
|
format(value: string): string;
|
|
8
8
|
parse(value: string): string;
|
|
9
9
|
}
|
|
10
|
-
class NumberType implements
|
|
10
|
+
class NumberType implements Formatter<number> {
|
|
11
11
|
format(value: number): string;
|
|
12
12
|
parse(value: string): number;
|
|
13
13
|
}
|
|
14
|
-
class BooleanType implements
|
|
14
|
+
class BooleanType implements Formatter<boolean> {
|
|
15
15
|
format(value: boolean): string;
|
|
16
16
|
parse(value: string): boolean;
|
|
17
17
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Location } from '@angular/common';
|
|
2
2
|
import { Injector } from '@angular/core';
|
|
3
3
|
import { ActivatedRouteSnapshot, CanDeactivate, Router, RouterStateSnapshot } from '@angular/router';
|
|
4
|
-
import { InteractionContext } from '
|
|
5
|
-
import { PlaceComponent } from '
|
|
6
|
-
import { PlaceRouter } from '
|
|
4
|
+
import { InteractionContext } from '../../../interaction/interaction-context';
|
|
5
|
+
import { PlaceComponent } from '../../place-component';
|
|
6
|
+
import { PlaceRouter } from '../../place-router';
|
|
7
7
|
export declare class LeavePlaceGuard implements CanDeactivate<PlaceComponent> {
|
|
8
8
|
private router;
|
|
9
9
|
private injector;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, CanActivate, ParamMap, Router, RouterStateSnapshot, UrlSegment, UrlTree } from '@angular/router';
|
|
3
|
+
import { PlaceHistory } from '../../place-history';
|
|
4
|
+
import { PlaceRouter } from '../../place-router';
|
|
5
|
+
export declare class PlaceRouteGuard implements CanActivate {
|
|
6
|
+
private readonly router;
|
|
7
|
+
private readonly placeRouter;
|
|
8
|
+
private readonly placeHistory;
|
|
9
|
+
private readonly injector;
|
|
10
|
+
constructor(router: Router, placeRouter: PlaceRouter, placeHistory: PlaceHistory, injector: Injector);
|
|
11
|
+
canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace PlaceRouteGuard {
|
|
14
|
+
/**
|
|
15
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
16
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
17
|
+
* param map even when `parameter`s has content.
|
|
18
|
+
*/
|
|
19
|
+
class ConsolidatedParameterMap implements ParamMap {
|
|
20
|
+
private paramMaps;
|
|
21
|
+
constructor(paramMap: ParamMap, urlSegments: UrlSegment[]);
|
|
22
|
+
get(name: string): string | null;
|
|
23
|
+
getAll(name: string): string[];
|
|
24
|
+
has(name: string): boolean;
|
|
25
|
+
readonly keys: string[];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface
|
|
1
|
+
import { Formatter } from './formatter';
|
|
2
|
+
export interface RouteIdOptions<T> {
|
|
3
3
|
as?: string;
|
|
4
4
|
optional?: boolean;
|
|
5
5
|
remember?: boolean;
|
|
6
6
|
defaultValue?: T;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface RouteParameterOptions<T> {
|
|
9
|
+
as?: string;
|
|
10
|
+
optional?: boolean;
|
|
11
|
+
remember?: boolean;
|
|
12
|
+
defaultValue?: T;
|
|
13
|
+
storeInUrl?: Formatter<T>;
|
|
14
|
+
}
|
|
15
|
+
export interface RouteListParameterOptions<T> {
|
|
9
16
|
as?: string;
|
|
10
17
|
optional?: boolean;
|
|
11
18
|
remember?: boolean;
|
|
12
19
|
defaultValue?: T[];
|
|
20
|
+
storeInUrl?: Formatter<T>;
|
|
13
21
|
}
|
|
14
|
-
export declare function RouteId<T extends string | number>(type:
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
22
|
+
export declare function RouteId<T extends string | number>(type: Formatter<T>, options?: RouteIdOptions<T>): PropertyDecorator;
|
|
23
|
+
export declare function VisitParameter<T>(options?: RouteParameterOptions<T>): PropertyDecorator;
|
|
24
|
+
export declare function VisitParameterList<E>(options?: RouteListParameterOptions<E>): PropertyDecorator;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { Injector } from '@angular/core';
|
|
2
2
|
import { PlaceHistory } from '../place-history';
|
|
3
3
|
import { Visit } from '../visit';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { RouteParameterValue } from './route-parameter-value';
|
|
7
|
-
export declare abstract class ParameterDefinition<T, S = T> {
|
|
4
|
+
import { Formatter } from './formatter';
|
|
5
|
+
export declare abstract class ParameterDefinition<T, E = T> {
|
|
8
6
|
readonly propertyName: string;
|
|
9
|
-
readonly
|
|
7
|
+
readonly urlFormat?: Formatter<E>;
|
|
10
8
|
abstract readonly isRouteId: boolean;
|
|
11
9
|
abstract readonly isArray: boolean;
|
|
10
|
+
readonly remember: boolean;
|
|
11
|
+
readonly defaultValue: T;
|
|
12
|
+
private options;
|
|
13
|
+
constructor(propertyName: string, options: ParameterDefinition.Options<T>, urlFormat?: Formatter<E>);
|
|
12
14
|
readonly name: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
readonly isRouteParameter: boolean;
|
|
16
|
+
abstract isEmptyValue(value: T): boolean;
|
|
17
|
+
abstract hasChanged(a: any, b: any): boolean;
|
|
18
|
+
protected getOptionValue<K extends keyof ParameterDefinition.Options<T>>(key: K): ParameterDefinition.Options<T>[K];
|
|
19
|
+
sanitise(value: T, visit: Visit, placeHistory: PlaceHistory, injector: Injector): Promise<T>;
|
|
20
|
+
private isMissingFrom;
|
|
17
21
|
}
|
|
18
22
|
export declare namespace ParameterDefinition {
|
|
19
23
|
interface Options<T> {
|
|
@@ -25,20 +29,20 @@ export declare namespace ParameterDefinition {
|
|
|
25
29
|
class RouteId<T> extends ParameterDefinition<T> {
|
|
26
30
|
readonly isRouteId = true;
|
|
27
31
|
readonly isArray = false;
|
|
32
|
+
isEmptyValue(value: T): boolean;
|
|
33
|
+
hasChanged(a: any, b: any): boolean;
|
|
28
34
|
}
|
|
29
35
|
class ValueParameter<T> extends ParameterDefinition<T> {
|
|
30
36
|
readonly isRouteId = false;
|
|
31
37
|
readonly isArray = false;
|
|
38
|
+
isEmptyValue(value: T): boolean;
|
|
39
|
+
hasChanged(a: any, b: any): boolean;
|
|
32
40
|
}
|
|
33
|
-
class ArrayParameter<T> extends ParameterDefinition<T, T
|
|
41
|
+
class ArrayParameter<T> extends ParameterDefinition<T[], T> {
|
|
34
42
|
readonly isRouteId = false;
|
|
35
43
|
readonly isArray = true;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
readonly defaultValue: S;
|
|
40
|
-
readonly placeHistory: PlaceHistory;
|
|
41
|
-
constructor(remember: boolean, defaultValue: S, placeHistory: PlaceHistory);
|
|
42
|
-
sanitise(parameter: RouteParameterValue<S, any, any>, visit?: Visit): Promise<S> | S;
|
|
44
|
+
constructor(parameterName: string, options: Options<T[]>, urlFormat: Formatter<T>);
|
|
45
|
+
isEmptyValue(value: T[]): boolean;
|
|
46
|
+
hasChanged(a: T[], b: T[]): boolean;
|
|
43
47
|
}
|
|
44
48
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
1
2
|
import { Visit } from '../visit';
|
|
2
|
-
import {
|
|
3
|
+
import { ParameterSnapshot } from './parameter-snapshot';
|
|
3
4
|
export interface ParameterSanitiser<S> {
|
|
4
|
-
sanitise(
|
|
5
|
+
sanitise(parameterValue: ParameterSnapshot<S>, visit?: Visit, injector?: Injector): Promise<S> | S;
|
|
5
6
|
}
|
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
import { Injector } from '@angular/core';
|
|
2
|
-
import { ParamMap, UrlSegment } from '@angular/router';
|
|
3
|
-
import { PlaceDefinition } from '../place-definition';
|
|
4
|
-
import { Visit } from '../visit';
|
|
5
1
|
import { ParameterDefinition } from './parameter-definition.class';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
constructor(placeDefinition: PlaceDefinition, parameters: RouteParameterValue<any, any, any>[]);
|
|
11
|
-
hasChanged(other: ParameterSnapshot, debug?: boolean): boolean;
|
|
12
|
-
getParameter<T, S>(parameterDef: ParameterDefinition<T, S>): RouteParameterValue<S, T, any>;
|
|
13
|
-
getValueOf<T, S>(parameterDef: ParameterDefinition<T, S>): S;
|
|
14
|
-
getRouteIdValue(): any;
|
|
15
|
-
getParameterValue(name: string): any;
|
|
16
|
-
private getRouteIdParameter;
|
|
17
|
-
private getRouteParameters;
|
|
18
|
-
hasRouteId(): boolean;
|
|
19
|
-
getFormattedRouteId(): string;
|
|
20
|
-
getNonEmptyParameters(): RouteParameterValue<any, any, any>[];
|
|
21
|
-
getFormattedParameters(): {};
|
|
22
|
-
getAllParameters(): {};
|
|
23
|
-
replace<T, S>(parameter: ParameterDefinition<T, S>, value: S): ParameterSnapshot;
|
|
24
|
-
sanitise(injector: Injector): Promise<ParameterSnapshot>;
|
|
25
|
-
}
|
|
26
|
-
export declare namespace ParameterSnapshot {
|
|
27
|
-
function create(placeDef: PlaceDefinition, params: ParamMap, urlSegments: UrlSegment[]): ParameterSnapshot;
|
|
2
|
+
export interface ParameterSnapshot<T> {
|
|
3
|
+
definition: ParameterDefinition<T, any>;
|
|
4
|
+
readonly value: T;
|
|
5
|
+
isMissing(): boolean;
|
|
28
6
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
|
3
|
+
import { PlaceHistory } from '../place-history';
|
|
4
|
+
import { Visit } from '../visit';
|
|
5
|
+
export declare class VisitSanitiser {
|
|
6
|
+
private activatedRoute;
|
|
7
|
+
private router;
|
|
8
|
+
private placeHistory;
|
|
9
|
+
private injector;
|
|
10
|
+
constructor(activatedRoute: ActivatedRouteSnapshot, router: Router, placeHistory: PlaceHistory, injector: Injector);
|
|
11
|
+
sanitise(visit: Visit): Promise<Visit>;
|
|
12
|
+
}
|
package/lib/place/visit.d.ts
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { PlaceDefinition } from './place-definition';
|
|
2
|
-
|
|
2
|
+
import { ParameterDefinition } from './route/parameter-definition.class';
|
|
3
|
+
interface Params {
|
|
4
|
+
[p: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export declare class Visit {
|
|
3
7
|
readonly placeDefinition: PlaceDefinition;
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
private readonly visitParameters;
|
|
9
|
+
constructor(placeDefinition: PlaceDefinition, visitParameters?: Params);
|
|
10
|
+
getRouteId(): any;
|
|
11
|
+
hasRouteId(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
14
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
15
|
+
* same as the the ValueModel property name.
|
|
16
|
+
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
17
|
+
*/
|
|
18
|
+
getParameter(parameterName: string): any;
|
|
19
|
+
hasParameter(parameterName: string): boolean;
|
|
20
|
+
replace<S>(parameter: ParameterDefinition<any, S>, value: S): Visit;
|
|
21
|
+
mergeRouteParameters<S>(routeParams: {
|
|
22
|
+
[p: string]: any;
|
|
23
|
+
}): Visit;
|
|
24
|
+
hasRoutingChangedFrom(other: Visit): boolean;
|
|
25
|
+
hasChangedFrom(other: Visit): boolean;
|
|
6
26
|
}
|
|
27
|
+
export {};
|
package/package.json
CHANGED
|
@@ -16,8 +16,8 @@ export declare class PlaceClassScanner {
|
|
|
16
16
|
private extractChildComponentClassNames;
|
|
17
17
|
protected getRouteIdParameter(): PlaceClassScanner.RouteParameterInfo;
|
|
18
18
|
protected getRouteParameters(): PlaceDef.Parameter[];
|
|
19
|
-
private
|
|
20
|
-
private
|
|
19
|
+
private getVisitValueParameters;
|
|
20
|
+
private getVisitListParameters;
|
|
21
21
|
protected getDecoratedProperties(annotation: string): {
|
|
22
22
|
decorator: Decorator;
|
|
23
23
|
property: PropertyDeclaration;
|
|
@@ -94,23 +94,23 @@ class PlaceClassScanner {
|
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
96
|
getRouteParameters() {
|
|
97
|
-
return this.
|
|
97
|
+
return this.getVisitValueParameters().concat(this.getVisitListParameters());
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
return this.getDecoratedProperties('@
|
|
99
|
+
getVisitValueParameters() {
|
|
100
|
+
return this.getDecoratedProperties('@VisitParameter')
|
|
101
101
|
.map(p => {
|
|
102
102
|
const routeOptions = PlaceClassScanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
|
|
103
|
-
position:
|
|
103
|
+
position: 0,
|
|
104
104
|
required: false
|
|
105
105
|
});
|
|
106
106
|
return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, p.property);
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
return this.getDecoratedProperties('@
|
|
109
|
+
getVisitListParameters() {
|
|
110
|
+
return this.getDecoratedProperties('@VisitParameterList')
|
|
111
111
|
.map(p => {
|
|
112
112
|
const routeOptions = PlaceClassScanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
|
|
113
|
-
position:
|
|
113
|
+
position: 0,
|
|
114
114
|
required: false
|
|
115
115
|
});
|
|
116
116
|
return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, p.property);
|