@coolon/angular-ui-powerups 0.0.97 → 0.0.101
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 +1405 -1305
- 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 +19 -19
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +19 -19
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +20 -6
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +18 -7
- package/esm2015/lib/interaction/index.js +5 -4
- package/esm2015/lib/interaction/interaction-context.js +7 -53
- package/esm2015/lib/interaction/interaction.module.js +3 -3
- package/esm2015/lib/interaction/services/interaction.service.js +228 -0
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +62 -0
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +145 -0
- package/esm2015/lib/interaction/services/modal-interaction-context.factory.js +17 -0
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +3 -3
- package/esm2015/lib/place/guards/abstract-place.guard.js +13 -12
- package/esm2015/lib/place/guards/interaction.guard.js +27 -19
- package/esm2015/lib/place/guards/navigation-state.js +676 -0
- package/esm2015/lib/place/guards/place-component-deactivation-handler.js +14 -37
- package/esm2015/lib/place/index.js +2 -2
- package/esm2015/lib/place/place-router.js +163 -161
- package/esm2015/lib/place/url-snapshot.js +91 -19
- package/esm2015/public_api.js +3 -3
- package/esm5/coolon-angular-ui-powerups.js +19 -19
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +24 -15
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +15 -7
- package/esm5/lib/interaction/index.js +5 -4
- package/esm5/lib/interaction/interaction-context.js +8 -61
- package/esm5/lib/interaction/interaction.module.js +3 -3
- package/esm5/lib/interaction/services/interaction.service.js +271 -0
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +65 -0
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +170 -0
- package/esm5/lib/interaction/services/modal-interaction-context.factory.js +27 -0
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +3 -3
- package/esm5/lib/place/guards/abstract-place.guard.js +15 -14
- package/esm5/lib/place/guards/interaction.guard.js +25 -17
- package/esm5/lib/place/guards/navigation-state.js +894 -0
- package/esm5/lib/place/guards/place-component-deactivation-handler.js +21 -55
- package/esm5/lib/place/index.js +2 -2
- package/esm5/lib/place/place-router.js +186 -269
- package/esm5/lib/place/url-snapshot.js +105 -21
- package/esm5/public_api.js +3 -3
- package/fesm2015/coolon-angular-ui-powerups.js +1142 -990
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +1350 -1250
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +2 -1
- package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +3 -1
- package/lib/interaction/index.d.ts +4 -3
- package/lib/interaction/interaction-context.d.ts +2 -11
- package/lib/interaction/services/interaction.service.d.ts +46 -0
- package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.d.ts +15 -0
- package/lib/interaction/services/{dialog-interaction-context.d.ts → mat-dialog-interaction/dialog-interaction-context.d.ts} +2 -2
- package/lib/interaction/services/modal-interaction-context.factory.d.ts +4 -0
- package/lib/place/guards/abstract-place.guard.d.ts +1 -1
- package/lib/place/guards/interaction.guard.d.ts +3 -3
- package/lib/place/guards/navigation-state.d.ts +124 -0
- package/lib/place/guards/place-component-deactivation-handler.d.ts +3 -5
- package/lib/place/index.d.ts +1 -1
- package/lib/place/place-router.d.ts +17 -24
- package/lib/place/url-snapshot.d.ts +18 -6
- package/package.json +1 -1
- package/schematics/place-routes/templates/place-routes.ts.template +3 -3
- package/styles/styles.scss +1 -1
- package/esm2015/lib/interaction/services/dialog-interaction-context.js +0 -163
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +0 -151
- package/esm2015/lib/interaction/services/modal-interaction.service.js +0 -109
- package/esm2015/lib/place/guards/navigation-session.js +0 -590
- package/esm5/lib/interaction/services/dialog-interaction-context.js +0 -188
- package/esm5/lib/interaction/services/dialog-interaction.service.js +0 -179
- package/esm5/lib/interaction/services/modal-interaction.service.js +0 -153
- package/esm5/lib/place/guards/navigation-session.js +0 -741
- package/lib/interaction/services/dialog-interaction.service.d.ts +0 -24
- package/lib/interaction/services/modal-interaction.service.d.ts +0 -15
- package/lib/place/guards/navigation-session.d.ts +0 -96
|
@@ -25,10 +25,11 @@ declare class TabContext<D, R, E> implements ActivityOutletContext<D, R, E> {
|
|
|
25
25
|
readonly component: Activity<D, R, E>;
|
|
26
26
|
onDone(result: R): void;
|
|
27
27
|
onCancel(error: E): void;
|
|
28
|
+
dispose(): void;
|
|
28
29
|
}
|
|
29
30
|
export declare class ActivityContainerComponent<D, R, E> extends InteractionContextBase implements OnInit, AfterViewInit {
|
|
30
31
|
private readonly throttledNestedActivityFinishEvents;
|
|
31
|
-
private _initialActivityOutletContext;
|
|
32
|
+
private readonly _initialActivityOutletContext;
|
|
32
33
|
initialActivityOutletContext: ActivityOutletContext<D, R, E>;
|
|
33
34
|
initialActivityOutletContextEvent: EventEmitter<ActivityOutletContext<D, R, E>>;
|
|
34
35
|
dynamicHeight: boolean;
|
|
@@ -2,13 +2,15 @@ import { AfterViewInit } from '@angular/core';
|
|
|
2
2
|
import { Constructable } from '@coolon/pectin';
|
|
3
3
|
import { Activity } from '../../activity';
|
|
4
4
|
import { InteractionContextBase } from '../../interaction-context-base';
|
|
5
|
+
import { InteractionService } from '../../services/interaction.service';
|
|
5
6
|
import { ActivityContainerComponent } from '../activity-container/activity-container.component';
|
|
6
7
|
import { ActivityOutletContext } from '../activity-outlet/activity-outlet-context';
|
|
7
8
|
export declare class InplaceInteractionContextComponent<D, R, E> extends InteractionContextBase implements AfterViewInit {
|
|
9
|
+
readonly interactionService: InteractionService;
|
|
8
10
|
interactionContext: ActivityContainerComponent<any, any, any>;
|
|
9
11
|
initialActivityContext: ActivityOutletContext<D, R, E>;
|
|
10
12
|
private _active;
|
|
11
|
-
constructor();
|
|
13
|
+
constructor(interactionService: InteractionService);
|
|
12
14
|
ngAfterViewInit(): void;
|
|
13
15
|
readonly active: import("@coolon/pectin").ValueModel<boolean>;
|
|
14
16
|
protected _startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
@@ -17,6 +17,7 @@ export * from "./components/confirm-then-dialog/confirm-then-dialog.component";
|
|
|
17
17
|
export * from "./components/confirmation-dialog/confirmation-dialog.component";
|
|
18
18
|
export * from "./components/inplace-interaction-context/inplace-interaction-context.component";
|
|
19
19
|
export * from "./components/interaction-outlet/interaction-outlet.component";
|
|
20
|
-
export * from "./services/
|
|
21
|
-
export * from "./services/
|
|
22
|
-
export * from "./services/
|
|
20
|
+
export * from "./services/interaction.service";
|
|
21
|
+
export * from "./services/modal-interaction-context.factory";
|
|
22
|
+
export * from "./services/mat-dialog-interaction/dialog-interaction-context-factory";
|
|
23
|
+
export * from "./services/mat-dialog-interaction/dialog-interaction-context";
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { Constructable,
|
|
1
|
+
import { Constructable, GarbageCollector, ListModel, ValueModel } from '@coolon/pectin';
|
|
2
2
|
import { Activity } from './activity';
|
|
3
3
|
import { Alert } from './alert';
|
|
4
4
|
import { Confirm } from './confirm';
|
|
5
5
|
export declare abstract class InteractionContext extends GarbageCollector {
|
|
6
|
-
private readonly activityListeners;
|
|
7
6
|
abstract readonly activityList: ListModel<Activity<any, any, any>>;
|
|
8
7
|
abstract readonly active: ValueModel<boolean>;
|
|
9
8
|
/**
|
|
10
9
|
* Returns true if an activity is currently running.
|
|
11
10
|
*/
|
|
12
11
|
isActive(): boolean;
|
|
13
|
-
|
|
14
|
-
protected notifyActivityStarted(): void;
|
|
15
|
-
protected notifyActivityFinished(): void;
|
|
12
|
+
dispose(): void;
|
|
16
13
|
/**
|
|
17
14
|
* Returns the activity that is currently active.
|
|
18
15
|
* This model is only updated in the next tick after the view has been updated.
|
|
@@ -30,9 +27,3 @@ export declare abstract class InteractionContext extends GarbageCollector {
|
|
|
30
27
|
*/
|
|
31
28
|
abstract confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
32
29
|
}
|
|
33
|
-
export declare namespace InteractionContext {
|
|
34
|
-
interface Listener {
|
|
35
|
-
onActivityStarted(): void;
|
|
36
|
-
onActivityFinished(): void;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BooleanValueModelChain, Disposable, GarbageCollector, ListModelChain, MutableValueModel, ValueModel } from '@coolon/pectin';
|
|
2
|
+
import { Activity } from '../activity';
|
|
3
|
+
import { InteractionContext } from '../interaction-context';
|
|
4
|
+
import { ModalInteractionContextFactory } from './modal-interaction-context.factory';
|
|
5
|
+
export declare class InteractionService {
|
|
6
|
+
readonly modelInteractionContextFactory: ModalInteractionContextFactory;
|
|
7
|
+
private readonly garbage;
|
|
8
|
+
readonly active: BooleanValueModelChain;
|
|
9
|
+
private readonly exclusiveContext;
|
|
10
|
+
private readonly _activeModalInteractionContextModel;
|
|
11
|
+
private readonly _activeInlineInteractionContextModel;
|
|
12
|
+
private readonly _activeInteractionContext;
|
|
13
|
+
readonly activeInteractionContextIds: ListModelChain<string>;
|
|
14
|
+
readonly modelInteractionActive: BooleanValueModelChain;
|
|
15
|
+
readonly inlineInteractionActive: BooleanValueModelChain;
|
|
16
|
+
constructor(modelInteractionContextFactory: ModalInteractionContextFactory);
|
|
17
|
+
isActive(): boolean;
|
|
18
|
+
createModalInteractionContextFor(disposable: Disposable.Collector): InteractionContext;
|
|
19
|
+
_registerInplaceInteractionContext(interactionContext: InteractionContext): void;
|
|
20
|
+
getCurrentActivity(): Promise<Activity<any, any, any>>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an interaction context that will prevent any other contexts from starting an
|
|
23
|
+
* activity until it is disposed. This is intended for use by the router for passing
|
|
24
|
+
* to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
|
|
25
|
+
* try and interact in a way that we can't track and synchronise with the browser back
|
|
26
|
+
* button.
|
|
27
|
+
*/
|
|
28
|
+
_createExclusiveModalInteractionContext(): InteractionContext;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace InteractionService {
|
|
31
|
+
interface Callback {
|
|
32
|
+
onStarted(monitor: Monitor): any;
|
|
33
|
+
onFinished(monitor: Monitor): any;
|
|
34
|
+
}
|
|
35
|
+
class Monitor extends GarbageCollector {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly interactionContext: InteractionContext;
|
|
38
|
+
readonly currentActiveMonitor: MutableValueModel<Monitor>;
|
|
39
|
+
readonly exclusiveContext: ValueModel<InteractionContext>;
|
|
40
|
+
constructor(id: string, interactionContext: InteractionContext, currentActiveMonitor: MutableValueModel<Monitor>, exclusiveContext: ValueModel<InteractionContext>);
|
|
41
|
+
protected onStarted(): void;
|
|
42
|
+
private assertCanStart;
|
|
43
|
+
protected onFinished(): void;
|
|
44
|
+
private assertCurrentlyActive;
|
|
45
|
+
}
|
|
46
|
+
}
|
package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { MatDialog } from '@angular/material';
|
|
3
|
+
import { MatDialogConfig } from '@angular/material/dialog';
|
|
4
|
+
import { BooleanValueModelChain } from '@coolon/pectin';
|
|
5
|
+
import { InteractionContext } from '../../interaction-context';
|
|
6
|
+
import { ModalInteractionContextFactory } from '../modal-interaction-context.factory';
|
|
7
|
+
export declare const DIALOG_INTERACTION_SERVICE_DEFAULTS: InjectionToken<MatDialogConfig<any>>;
|
|
8
|
+
export declare class DialogInteractionContextFactory extends ModalInteractionContextFactory {
|
|
9
|
+
private readonly dialogService;
|
|
10
|
+
readonly dialogServiceDefaults: MatDialogConfig<any>;
|
|
11
|
+
readonly matDialogDefaultConfig: MatDialogConfig<any>;
|
|
12
|
+
readonly active: BooleanValueModelChain;
|
|
13
|
+
constructor(dialogService: MatDialog, dialogServiceDefaults: MatDialogConfig<any>, matDialogDefaultConfig: MatDialogConfig<any>);
|
|
14
|
+
createInteractionContext(): InteractionContext;
|
|
15
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MatDialog } from '@angular/material';
|
|
2
2
|
import { MatDialogConfig } from '@angular/material/dialog';
|
|
3
3
|
import { Constructable, ListModel, ValueModel } from '@coolon/pectin';
|
|
4
|
-
import { Activity } from '
|
|
5
|
-
import { InteractionContextBase } from '
|
|
4
|
+
import { Activity } from '../../activity';
|
|
5
|
+
import { InteractionContextBase } from '../../interaction-context-base';
|
|
6
6
|
export declare class DialogInteractionContext extends InteractionContextBase {
|
|
7
7
|
private readonly dialogService;
|
|
8
8
|
readonly config: MatDialogConfig<any>;
|
|
@@ -13,7 +13,7 @@ export declare abstract class AbstractPlaceGuard implements CanActivate, CanDeac
|
|
|
13
13
|
constructor(router: Router, urlSerializer: UrlSerializer, placeRouter: PlaceRouter, placeHistory: PlaceHistory, injector: Injector);
|
|
14
14
|
canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
15
15
|
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean>;
|
|
16
|
-
protected authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot,
|
|
16
|
+
protected authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, runPlaceGuards: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree>;
|
|
17
17
|
isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
18
18
|
abstract getAuthGuard(injector: Injector): CanActivate;
|
|
19
19
|
}
|
|
@@ -3,15 +3,15 @@ import { Injector } from '@angular/core';
|
|
|
3
3
|
import { ActivatedRouteSnapshot, CanActivate, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { NoopComponent } from '../../components/noop/noop.component';
|
|
6
|
-
import {
|
|
6
|
+
import { InteractionService } from '../../interaction/services/interaction.service';
|
|
7
7
|
import { PlaceRouter } from '../place-router';
|
|
8
8
|
export declare class InteractionGuard implements CanDeactivate<NoopComponent>, CanActivate {
|
|
9
9
|
private router;
|
|
10
10
|
private injector;
|
|
11
11
|
private placeRouter;
|
|
12
12
|
private readonly angularLocation;
|
|
13
|
-
private readonly
|
|
14
|
-
constructor(router: Router, injector: Injector, placeRouter: PlaceRouter, angularLocation: Location,
|
|
13
|
+
private readonly interactionService;
|
|
14
|
+
constructor(router: Router, injector: Injector, placeRouter: PlaceRouter, angularLocation: Location, interactionService: InteractionService);
|
|
15
15
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
16
16
|
canDeactivate(component: NoopComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
17
17
|
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, RouterEvent } from '@angular/router';
|
|
2
|
+
import { GarbageCollector } from '@coolon/pectin';
|
|
3
|
+
import { InteractionContext } from '../../interaction/interaction-context';
|
|
4
|
+
import { InteractionService } from '../../interaction/services/interaction.service';
|
|
5
|
+
import { PlaceComponent } from '../place-component';
|
|
6
|
+
import { PlaceDefinition } from '../place-definition';
|
|
7
|
+
import { PlaceRouter } from '../place-router';
|
|
8
|
+
import { UrlSnapshot } from '../url-snapshot';
|
|
9
|
+
import { Visit } from '../visit';
|
|
10
|
+
export declare abstract class NavigationState extends GarbageCollector {
|
|
11
|
+
protected readonly context: NavigationState.Context;
|
|
12
|
+
private _visits;
|
|
13
|
+
abstract readonly isTransitional: boolean;
|
|
14
|
+
abstract readonly startingUrl: string;
|
|
15
|
+
abstract readonly isPopState: boolean;
|
|
16
|
+
constructor(context: NavigationState.Context);
|
|
17
|
+
readonly idle: boolean;
|
|
18
|
+
readonly placeRouter: PlaceRouter;
|
|
19
|
+
readonly interactionService: InteractionService;
|
|
20
|
+
readonly interactionContext: InteractionContext;
|
|
21
|
+
storeVisit(visit: Visit): void;
|
|
22
|
+
getVisitFor(placeDef: PlaceDefinition): Visit;
|
|
23
|
+
onPopState(event: NavigationStart): NavigationState;
|
|
24
|
+
onStart(event: NavigationStart): NavigationState;
|
|
25
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
26
|
+
onError(event: NavigationError): NavigationState;
|
|
27
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
28
|
+
onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState;
|
|
29
|
+
canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
|
|
30
|
+
getVisits(): Visit[];
|
|
31
|
+
protected illegalTransition<R>(message: string | RouterEvent): R;
|
|
32
|
+
protected currentRouterUrl(): string;
|
|
33
|
+
protected createTransitionStateFor(event: NavigationStart): NavigationState.NavigationBackTransition | NavigationState.NavigationTransition;
|
|
34
|
+
resetBrowserLocation(url: any): void;
|
|
35
|
+
toString(): string;
|
|
36
|
+
}
|
|
37
|
+
export declare namespace NavigationState {
|
|
38
|
+
class Context {
|
|
39
|
+
readonly placeRouter: PlaceRouter;
|
|
40
|
+
readonly interactionService: InteractionService;
|
|
41
|
+
readonly notifySuccess: (success: NavigationState) => void;
|
|
42
|
+
constructor(placeRouter: PlaceRouter, interactionService: InteractionService, notifySuccess: (success: NavigationState) => void);
|
|
43
|
+
}
|
|
44
|
+
class Idle extends NavigationState {
|
|
45
|
+
readonly isTransitional = false;
|
|
46
|
+
readonly startingUrl: any;
|
|
47
|
+
readonly isPopState = false;
|
|
48
|
+
constructor(context: Context);
|
|
49
|
+
onStart(event: NavigationStart): NavigationState;
|
|
50
|
+
onPopState(event: NavigationStart): NavigationState;
|
|
51
|
+
}
|
|
52
|
+
abstract class AbstractNavigationTransition extends NavigationState {
|
|
53
|
+
readonly isPopState: boolean;
|
|
54
|
+
readonly startingUrl: string;
|
|
55
|
+
readonly isTransitional = true;
|
|
56
|
+
private componentDeactivationHandlers;
|
|
57
|
+
private _interactionContext;
|
|
58
|
+
constructor(context: Context, isPopState: boolean, startingUrl: string);
|
|
59
|
+
readonly interactionContext: InteractionContext;
|
|
60
|
+
onStart(event: NavigationStart): NavigationState;
|
|
61
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
62
|
+
onBackClickedDuringNavigationInteraction(locationTriggerUrl: string): NavigationState;
|
|
63
|
+
canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
|
|
64
|
+
private detachInteractionContext;
|
|
65
|
+
}
|
|
66
|
+
class NavigationTransition extends AbstractNavigationTransition {
|
|
67
|
+
readonly isPopState = false;
|
|
68
|
+
onStart(event: NavigationStart): NavigationState;
|
|
69
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
70
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
71
|
+
onError(event: NavigationError): NavigationState;
|
|
72
|
+
toString(): string;
|
|
73
|
+
}
|
|
74
|
+
class NavigationBackTransition extends AbstractNavigationTransition {
|
|
75
|
+
readonly isPopState = true;
|
|
76
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
77
|
+
onError(event: NavigationError): NavigationState;
|
|
78
|
+
}
|
|
79
|
+
abstract class AbstractInteractionTransition extends NavigationState {
|
|
80
|
+
readonly startingUrl: string;
|
|
81
|
+
readonly isTransitional = true;
|
|
82
|
+
constructor(context: Context, startingUrl: string);
|
|
83
|
+
protected reinstateInteractionRoute(): void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
87
|
+
* happily ignore interaction contexts.
|
|
88
|
+
*/
|
|
89
|
+
class InteractionTransition extends AbstractInteractionTransition {
|
|
90
|
+
readonly isPopState = false;
|
|
91
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
95
|
+
* happily ignore interaction contexts.
|
|
96
|
+
*/
|
|
97
|
+
class InteractionBackTransition extends AbstractInteractionTransition {
|
|
98
|
+
readonly isPopState = true;
|
|
99
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
100
|
+
}
|
|
101
|
+
class IdleDuringInteraction extends NavigationState {
|
|
102
|
+
readonly startingUrl: string;
|
|
103
|
+
readonly isTransitional = false;
|
|
104
|
+
readonly isPopState = false;
|
|
105
|
+
constructor(context: Context, startingUrl: string);
|
|
106
|
+
onStart(event: NavigationStart): NavigationState;
|
|
107
|
+
onPopState(event: NavigationStart): NavigationState;
|
|
108
|
+
}
|
|
109
|
+
class CancelledDuringNavigationInteraction extends NavigationState {
|
|
110
|
+
readonly startingUrl: string;
|
|
111
|
+
readonly locationChangeTriggerUrl: string;
|
|
112
|
+
readonly isPopState = false;
|
|
113
|
+
private capturedFauxRouterStart;
|
|
114
|
+
constructor(context: Context, startingUrl: string, locationChangeTriggerUrl: string);
|
|
115
|
+
readonly isTransitional: boolean;
|
|
116
|
+
onStart(event: NavigationStart): NavigationState;
|
|
117
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
118
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
119
|
+
onError(event: NavigationError): NavigationState;
|
|
120
|
+
onPopState(event: NavigationStart): NavigationState;
|
|
121
|
+
ignore(event: RouterEvent, reason?: string): NavigationState;
|
|
122
|
+
toString(): string;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { InteractionContext } from '../../interaction/interaction-context';
|
|
2
1
|
import { PlaceComponent } from '../place-component';
|
|
3
2
|
import { UrlSnapshot } from '../url-snapshot';
|
|
4
|
-
import {
|
|
3
|
+
import { NavigationState } from './navigation-state';
|
|
5
4
|
export declare class PlaceComponentDeactivationHandler {
|
|
6
5
|
readonly component: PlaceComponent;
|
|
7
|
-
readonly navigationSession:
|
|
6
|
+
readonly navigationSession: NavigationState;
|
|
8
7
|
private canDeactivatePromise;
|
|
9
|
-
constructor(component: PlaceComponent, navigationSession:
|
|
8
|
+
constructor(component: PlaceComponent, navigationSession: NavigationState);
|
|
10
9
|
canDeactivate(nextState: UrlSnapshot): Promise<boolean>;
|
|
11
10
|
protected canDeactivateComponent(nextState: UrlSnapshot): Promise<boolean>;
|
|
12
|
-
protected cancelCurrentActivityOf(interactionContext: InteractionContext): Promise<void>;
|
|
13
11
|
protected isNotJustAChangeInRouteId(nextState: UrlSnapshot): boolean;
|
|
14
12
|
}
|
package/lib/place/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export * from "./components/tabbed-place-navigation/tabbed-place-navigation.comp
|
|
|
21
21
|
export * from "./guards/abstract-place.guard";
|
|
22
22
|
export * from "./guards/consolidated-param-map";
|
|
23
23
|
export * from "./guards/interaction.guard";
|
|
24
|
-
export * from "./guards/navigation-
|
|
24
|
+
export * from "./guards/navigation-state";
|
|
25
25
|
export * from "./guards/noop-auth-guard.service";
|
|
26
26
|
export * from "./guards/place-component-deactivation-handler";
|
|
27
27
|
export * from "./route/formatter";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Location } from '@angular/common';
|
|
2
|
-
import { ActivatedRoute, ActivatedRouteSnapshot, Router,
|
|
2
|
+
import { ActivatedRoute, ActivatedRouteSnapshot, Router, UrlSerializer } from '@angular/router';
|
|
3
3
|
import { GarbageCollector, HasOneIndexChain, ListModel, ValueModel } from '@coolon/pectin';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { NavigationSession } from './guards/navigation-session';
|
|
4
|
+
import { InteractionService } from '../interaction/services/interaction.service';
|
|
5
|
+
import { NavigationState } from './guards/navigation-state';
|
|
7
6
|
import { PlaceHistory } from './place-history';
|
|
8
7
|
import { UrlSnapshot } from './url-snapshot';
|
|
9
8
|
import { Visit } from './visit';
|
|
@@ -12,17 +11,17 @@ export declare class PlaceRouter extends GarbageCollector {
|
|
|
12
11
|
private readonly urlSerializer;
|
|
13
12
|
private readonly angularLocation;
|
|
14
13
|
private readonly placeHistory;
|
|
15
|
-
private readonly
|
|
16
|
-
private
|
|
17
|
-
private readonly _navigationSessionModel;
|
|
14
|
+
private readonly interactionService;
|
|
15
|
+
private readonly _navigationStateModel;
|
|
18
16
|
private readonly _activeVisits;
|
|
19
|
-
readonly
|
|
17
|
+
readonly navigationInProgress: ValueModel<boolean>;
|
|
20
18
|
readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;
|
|
21
19
|
private _navigationSessionContext;
|
|
22
|
-
|
|
20
|
+
private _navigationStateTypeModel;
|
|
21
|
+
constructor(router: Router, urlSerializer: UrlSerializer, angularLocation: Location, placeHistory: PlaceHistory, interactionService: InteractionService);
|
|
23
22
|
private processNavigationSuccess;
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
23
|
+
readonly navigationState: NavigationState;
|
|
24
|
+
readonly navigationStateModel: ValueModel<NavigationState>;
|
|
26
25
|
readonly activeVisits: ListModel<Visit>;
|
|
27
26
|
/**
|
|
28
27
|
* placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
|
|
@@ -33,19 +32,13 @@ export declare class PlaceRouter extends GarbageCollector {
|
|
|
33
32
|
}): Promise<void>;
|
|
34
33
|
pushVisitChangesToRoute(activatedRoute: ActivatedRoute, previous: Visit, next: Visit): Promise<void>;
|
|
35
34
|
doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any): Promise<void>;
|
|
36
|
-
protected runStateTransition(transition: (navigationSession:
|
|
35
|
+
protected runStateTransition(transition: (navigationSession: NavigationState) => NavigationState): void;
|
|
37
36
|
private createRouteParameters;
|
|
38
37
|
extractChildPath(activatedRoute: ActivatedRouteSnapshot): any[];
|
|
39
|
-
parseUrl(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
readonly router: Router;
|
|
46
|
-
constructor(navigationSessionModelActive: ValueModel<boolean>, router: Router);
|
|
47
|
-
readonly isNavigating: boolean;
|
|
48
|
-
onActivityStarted(): void;
|
|
49
|
-
onActivityFinished(): void;
|
|
50
|
-
}
|
|
38
|
+
parseUrl(url: string): UrlSnapshot;
|
|
39
|
+
resetBrowserLocation(url: string): void;
|
|
40
|
+
getCurrentRouterUrl(): string;
|
|
41
|
+
getActiveInteractionIdsFromUrl(url: string): string[];
|
|
42
|
+
hasActiveInteractionIds(url: string): boolean;
|
|
43
|
+
syncInteractionIdsWithRouter(): void;
|
|
51
44
|
}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import { UrlSegment,
|
|
1
|
+
import { UrlSegment, UrlSerializer } from '@angular/router';
|
|
2
2
|
import { PlaceDefinition } from './place-definition';
|
|
3
3
|
import { Visit } from './visit';
|
|
4
4
|
export declare class UrlSnapshot {
|
|
5
|
-
readonly
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
readonly urlSerializer: UrlSerializer;
|
|
6
|
+
readonly url: string;
|
|
7
|
+
private readonly urlTree;
|
|
8
|
+
constructor(urlSerializer: UrlSerializer, url: string);
|
|
9
|
+
protected replaceExistingVisitSegmentsWith(visit: Visit): UrlSegment[];
|
|
10
|
+
private getPrimarySegments;
|
|
9
11
|
/**
|
|
10
12
|
* Converts the visit into segments. Please not that these segments are not e
|
|
11
13
|
* @param visit
|
|
12
14
|
*/
|
|
13
|
-
|
|
15
|
+
protected getSegmentsFor(visit: Visit): UrlSegment[];
|
|
14
16
|
createRedirectCommandsFor(visit: Visit): any[];
|
|
15
17
|
includesPathOf(placeDef: PlaceDefinition): UrlSegment;
|
|
18
|
+
getInteractionIds(): string[];
|
|
19
|
+
addOrReplaceInteractionIds(ids: string[]): UrlSnapshot;
|
|
20
|
+
}
|
|
21
|
+
export declare namespace UrlSnapshot {
|
|
22
|
+
const INTERACTION_ROUTER_OUTLET = "aup-interactions";
|
|
23
|
+
const INTERACTION_ROUTER_PATH = "active";
|
|
24
|
+
const INTERACTION_ID_SEPARATOR = "--";
|
|
25
|
+
function parseInteractionIds(path: string): string[];
|
|
26
|
+
function createPathIdFor(interactionIds: string[]): string;
|
|
27
|
+
function createInteractionOutletRouterCommands(interactionIds: string[]): string[];
|
|
16
28
|
}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import { Injectable, Injector } from '@angular/core';
|
|
15
15
|
import { Router, UrlSerializer } from '@angular/router';
|
|
16
|
-
import { AbstractPlaceGuard, PlaceHistory, PlaceRouter, InteractionGuard, NoopComponent } from '@coolon/angular-ui-powerups';
|
|
16
|
+
import { AbstractPlaceGuard, PlaceHistory, PlaceRouter, InteractionGuard, NoopComponent, UrlSnapshot } from '@coolon/angular-ui-powerups';
|
|
17
17
|
import { <%= config.authGuard.className %> } from '<%= config.authGuard.importPath %>';
|
|
18
18
|
|
|
19
19
|
<% placeDefs.forEach(def => { %>import {<%= def.componentClass %>} from "<%= def.importPath %>";
|
|
@@ -41,8 +41,8 @@ export const placeRoutes = [<% placeDefs.filter(def=> !def.isChild()).forEach(de
|
|
|
41
41
|
<%= def.getRouteTemplate() %>,
|
|
42
42
|
<% }) %>
|
|
43
43
|
{
|
|
44
|
-
path: "
|
|
45
|
-
outlet:
|
|
44
|
+
path: "active/:ids", // Must match `${UrlSnapshot.INTERACTION_ROUTER_PATH}/:ids`
|
|
45
|
+
outlet:UrlSnapshot.INTERACTION_ROUTER_OUTLET,
|
|
46
46
|
component: NoopComponent,
|
|
47
47
|
canDeactivate: [InteractionGuard],
|
|
48
48
|
canActivate: [InteractionGuard]
|