@coolon/angular-ui-powerups 0.0.96 → 0.0.98
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 +2960 -2288
- 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 +17 -20
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +17 -20
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +16 -52
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +16 -47
- package/esm2015/lib/interaction/index.js +4 -2
- package/esm2015/lib/interaction/interaction-context-base.js +158 -0
- package/esm2015/lib/interaction/interaction-context.js +58 -78
- package/esm2015/lib/interaction/interaction.module.js +1 -1
- package/esm2015/lib/interaction/services/dialog-interaction-context.js +163 -0
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +68 -181
- package/esm2015/lib/interaction/services/modal-interaction.service.js +109 -0
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +9 -43
- package/esm2015/lib/place/guards/abstract-place.guard.js +165 -0
- package/esm2015/lib/place/guards/consolidated-param-map.js +133 -0
- package/esm2015/lib/place/guards/interaction.guard.js +113 -0
- package/esm2015/lib/place/guards/navigation-state.js +613 -0
- package/esm2015/lib/place/guards/place-component-deactivation-handler.js +87 -0
- package/esm2015/lib/place/index.js +7 -5
- package/esm2015/lib/place/place-component.js +1 -1
- package/esm2015/lib/place/place-router.js +162 -236
- package/esm2015/lib/place/place.module.js +2 -4
- package/esm2015/lib/place/route/visit-sanitiser.js +2 -2
- package/esm2015/lib/place/url-snapshot.js +96 -0
- package/esm2015/public_api.js +3 -3
- package/esm5/coolon-angular-ui-powerups.js +17 -20
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +23 -74
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +26 -76
- package/esm5/lib/interaction/index.js +4 -2
- package/esm5/lib/interaction/interaction-context-base.js +211 -0
- package/esm5/lib/interaction/interaction-context.js +72 -94
- package/esm5/lib/interaction/interaction.module.js +1 -1
- package/esm5/lib/interaction/services/dialog-interaction-context.js +188 -0
- package/esm5/lib/interaction/services/dialog-interaction.service.js +83 -232
- package/esm5/lib/interaction/services/modal-interaction.service.js +153 -0
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +9 -43
- package/esm5/lib/place/guards/abstract-place.guard.js +212 -0
- package/esm5/lib/place/guards/consolidated-param-map.js +161 -0
- package/esm5/lib/place/guards/interaction.guard.js +125 -0
- package/esm5/lib/place/guards/navigation-state.js +764 -0
- package/esm5/lib/place/guards/place-component-deactivation-handler.js +104 -0
- package/esm5/lib/place/index.js +7 -5
- package/esm5/lib/place/place-component.js +1 -1
- package/esm5/lib/place/place-router.js +191 -294
- package/esm5/lib/place/place.module.js +2 -4
- package/esm5/lib/place/route/visit-sanitiser.js +2 -2
- package/esm5/lib/place/url-snapshot.js +120 -0
- package/esm5/public_api.js +3 -3
- package/fesm2015/coolon-angular-ui-powerups.js +2135 -1587
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +3083 -2412
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +6 -11
- package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +4 -9
- package/lib/interaction/index.d.ts +3 -1
- package/lib/interaction/interaction-context-base.d.ts +27 -0
- package/lib/interaction/interaction-context.d.ts +18 -15
- package/lib/interaction/services/dialog-interaction-context.d.ts +18 -0
- package/lib/interaction/services/dialog-interaction.service.d.ts +14 -23
- package/lib/interaction/services/modal-interaction.service.d.ts +15 -0
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +1 -4
- package/lib/place/guards/abstract-place.guard.d.ts +19 -0
- package/lib/place/guards/consolidated-param-map.d.ts +14 -0
- package/lib/{interaction/guards/interaction-guard.service.d.ts → place/guards/interaction.guard.d.ts} +8 -4
- package/lib/place/guards/navigation-state.d.ts +96 -0
- package/lib/place/guards/place-component-deactivation-handler.d.ts +12 -0
- package/lib/place/index.d.ts +6 -4
- package/lib/place/place-component.d.ts +1 -1
- package/lib/place/place-router.d.ts +25 -33
- package/lib/place/url-snapshot.d.ts +16 -0
- package/package.json +1 -1
- package/schematics/place-routes/place-def.js +2 -2
- package/schematics/place-routes/templates/place-routes.ts.template +9 -16
- package/esm2015/lib/interaction/guards/interaction-guard.service.js +0 -85
- package/esm2015/lib/place/guards/abstract-enter-place.guard.js +0 -315
- package/esm2015/lib/place/guards/leave-place.guard.js +0 -47
- package/esm2015/lib/place/navigation-session.js +0 -279
- package/esm2015/lib/place/places/noop-gateway-place.component.js +0 -58
- package/esm5/lib/interaction/guards/interaction-guard.service.js +0 -94
- package/esm5/lib/place/guards/abstract-enter-place.guard.js +0 -387
- package/esm5/lib/place/guards/leave-place.guard.js +0 -55
- package/esm5/lib/place/navigation-session.js +0 -353
- package/esm5/lib/place/places/noop-gateway-place.component.js +0 -61
- package/lib/place/guards/abstract-enter-place.guard.d.ts +0 -33
- package/lib/place/guards/leave-place.guard.d.ts +0 -8
- package/lib/place/navigation-session.d.ts +0 -43
- package/lib/place/places/noop-gateway-place.component.d.ts +0 -10
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { AfterViewInit, EventEmitter, OnInit, QueryList } from '@angular/core';
|
|
2
2
|
import { MatTabGroup } from '@angular/material';
|
|
3
|
-
import { Constructable, MutableListModel } from '@coolon/pectin';
|
|
3
|
+
import { Constructable, MutableListModel, ValueModel } from '@coolon/pectin';
|
|
4
4
|
import { Activity } from '../../activity';
|
|
5
|
-
import { Alert } from '../../alert';
|
|
6
|
-
import { Confirm } from '../../confirm';
|
|
7
5
|
import { InteractionContext } from '../../interaction-context';
|
|
6
|
+
import { InteractionContextBase } from '../../interaction-context-base';
|
|
8
7
|
import { ActivityOutletContext } from '../activity-outlet/activity-outlet-context';
|
|
9
8
|
import { ActivityOutletComponent } from '../activity-outlet/activity-outlet.component';
|
|
10
9
|
/**
|
|
@@ -27,25 +26,21 @@ declare class TabContext<D, R, E> implements ActivityOutletContext<D, R, E> {
|
|
|
27
26
|
onDone(result: R): void;
|
|
28
27
|
onCancel(error: E): void;
|
|
29
28
|
}
|
|
30
|
-
export declare class ActivityContainerComponent<D, R, E> extends
|
|
29
|
+
export declare class ActivityContainerComponent<D, R, E> extends InteractionContextBase implements OnInit, AfterViewInit {
|
|
31
30
|
private readonly throttledNestedActivityFinishEvents;
|
|
32
|
-
private _initialActivityOutletContext;
|
|
31
|
+
private readonly _initialActivityOutletContext;
|
|
33
32
|
initialActivityOutletContext: ActivityOutletContext<D, R, E>;
|
|
34
33
|
initialActivityOutletContextEvent: EventEmitter<ActivityOutletContext<D, R, E>>;
|
|
35
34
|
dynamicHeight: boolean;
|
|
36
35
|
tabs: MatTabGroup;
|
|
37
36
|
outlets: QueryList<ActivityOutletComponent<any, any, any>>;
|
|
38
37
|
readonly activityTabs: MutableListModel<TabContext<any, any, any>>;
|
|
38
|
+
readonly active: ValueModel<boolean>;
|
|
39
39
|
private readonly _activityList;
|
|
40
40
|
constructor();
|
|
41
|
-
isActive(): boolean;
|
|
42
|
-
readonly isFinished: boolean;
|
|
43
41
|
ngOnInit(): void;
|
|
44
42
|
ngAfterViewInit(): void;
|
|
45
|
-
|
|
46
|
-
alert(alert: Alert): Promise<void>;
|
|
47
|
-
confirmOrReject(confirm: Confirm): Promise<void>;
|
|
48
|
-
confirmThen<D1, R1, E1>(confirm: Confirm, activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
43
|
+
_startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
49
44
|
private finishInitialActivity;
|
|
50
45
|
private onNestedActivityFinished;
|
|
51
46
|
private cleanupStaleNestedActivities;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { AfterViewInit } from '@angular/core';
|
|
2
2
|
import { Constructable } from '@coolon/pectin';
|
|
3
3
|
import { Activity } from '../../activity';
|
|
4
|
-
import {
|
|
5
|
-
import { Confirm } from '../../confirm';
|
|
6
|
-
import { InteractionContext } from '../../interaction-context';
|
|
4
|
+
import { InteractionContextBase } from '../../interaction-context-base';
|
|
7
5
|
import { ActivityContainerComponent } from '../activity-container/activity-container.component';
|
|
8
6
|
import { ActivityOutletContext } from '../activity-outlet/activity-outlet-context';
|
|
9
|
-
export declare class InplaceInteractionContextComponent<D, R, E> extends
|
|
7
|
+
export declare class InplaceInteractionContextComponent<D, R, E> extends InteractionContextBase implements AfterViewInit {
|
|
10
8
|
interactionContext: ActivityContainerComponent<any, any, any>;
|
|
11
9
|
initialActivityContext: ActivityOutletContext<D, R, E>;
|
|
10
|
+
private _active;
|
|
12
11
|
constructor();
|
|
13
12
|
ngAfterViewInit(): void;
|
|
14
|
-
|
|
15
|
-
alert(alert: Alert): Promise<void>;
|
|
16
|
-
confirmOrReject(confirm: Confirm): Promise<void>;
|
|
17
|
-
confirmThen<D1, R1, E1>(confirm: Confirm, activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
18
|
-
startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
13
|
+
readonly active: import("@coolon/pectin").ValueModel<boolean>;
|
|
19
14
|
protected _startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
20
15
|
}
|
|
@@ -5,6 +5,7 @@ export * from "./abstract-activity";
|
|
|
5
5
|
export * from "./activity";
|
|
6
6
|
export * from "./alert";
|
|
7
7
|
export * from "./confirm";
|
|
8
|
+
export * from "./interaction-context-base";
|
|
8
9
|
export * from "./interaction-context";
|
|
9
10
|
export * from "./interaction.module";
|
|
10
11
|
export * from "./result";
|
|
@@ -16,5 +17,6 @@ export * from "./components/confirm-then-dialog/confirm-then-dialog.component";
|
|
|
16
17
|
export * from "./components/confirmation-dialog/confirmation-dialog.component";
|
|
17
18
|
export * from "./components/inplace-interaction-context/inplace-interaction-context.component";
|
|
18
19
|
export * from "./components/interaction-outlet/interaction-outlet.component";
|
|
19
|
-
export * from "./
|
|
20
|
+
export * from "./services/dialog-interaction-context";
|
|
20
21
|
export * from "./services/dialog-interaction.service";
|
|
22
|
+
export * from "./services/modal-interaction.service";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Constructable, ListModel } from '@coolon/pectin';
|
|
2
|
+
import { Activity } from './activity';
|
|
3
|
+
import { Alert } from './alert';
|
|
4
|
+
import { Confirm } from './confirm';
|
|
5
|
+
import { InteractionContext } from './interaction-context';
|
|
6
|
+
export declare abstract class InteractionContextBase extends InteractionContext {
|
|
7
|
+
/**
|
|
8
|
+
* Returns the current list of activities that are in progress.
|
|
9
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
10
|
+
*/
|
|
11
|
+
private readonly _activityListDelegate;
|
|
12
|
+
private deferredGetCurrentActivity;
|
|
13
|
+
protected constructor();
|
|
14
|
+
protected setActivityList(activityList: ListModel<Activity<any, any>>): void;
|
|
15
|
+
readonly activityList: ListModel<Activity<any, any, any>>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the activity that is currently active.
|
|
18
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
19
|
+
*/
|
|
20
|
+
getCurrentActivity(): Promise<Activity<any, any>>;
|
|
21
|
+
protected abstract _startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D, disableClose?: boolean): Promise<R>;
|
|
22
|
+
startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
23
|
+
confirm(confirm: Confirm): Promise<boolean>;
|
|
24
|
+
alert(alert: Alert): Promise<void>;
|
|
25
|
+
confirmOrReject(confirm: Confirm): Promise<void>;
|
|
26
|
+
confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
27
|
+
}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { Constructable, GarbageCollector, ListModel } from '@coolon/pectin';
|
|
1
|
+
import { Constructable, Disposable, 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
|
+
abstract readonly activityList: ListModel<Activity<any, any, any>>;
|
|
8
|
+
abstract readonly active: ValueModel<boolean>;
|
|
6
9
|
/**
|
|
7
|
-
* Returns
|
|
8
|
-
* This model is only updated in the next tick after the view has been updated.
|
|
10
|
+
* Returns true if an activity is currently running.
|
|
9
11
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
protected
|
|
13
|
-
protected
|
|
14
|
-
readonly activityList: ListModel<Activity<any, any, any>>;
|
|
12
|
+
isActive(): boolean;
|
|
13
|
+
addActivityListener(listener: InteractionContext.Listener): Disposable;
|
|
14
|
+
protected notifyActivityStarted(): void;
|
|
15
|
+
protected notifyActivityFinished(): void;
|
|
15
16
|
/**
|
|
16
17
|
* Returns the activity that is currently active.
|
|
17
18
|
* This model is only updated in the next tick after the view has been updated.
|
|
18
19
|
*/
|
|
19
|
-
getCurrentActivity(): Promise<Activity<any, any>>;
|
|
20
|
-
/**
|
|
21
|
-
* Returns true if an activity is currently running.
|
|
22
|
-
*/
|
|
23
|
-
abstract isActive(): boolean;
|
|
20
|
+
abstract getCurrentActivity(): Promise<Activity<any, any>>;
|
|
24
21
|
abstract startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
25
|
-
|
|
22
|
+
abstract alert(alert: Alert): Promise<void>;
|
|
23
|
+
abstract confirm(confirm: Confirm): Promise<boolean>;
|
|
26
24
|
abstract confirmOrReject(confirm: Confirm): Promise<void>;
|
|
27
25
|
/**
|
|
28
26
|
* Presents the confirmation to the user and runs the activity only if the user confirms.
|
|
@@ -31,5 +29,10 @@ export declare abstract class InteractionContext extends GarbageCollector {
|
|
|
31
29
|
* @param data the activity data.
|
|
32
30
|
*/
|
|
33
31
|
abstract confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
34
|
-
|
|
32
|
+
}
|
|
33
|
+
export declare namespace InteractionContext {
|
|
34
|
+
interface Listener {
|
|
35
|
+
onActivityStarted(): void;
|
|
36
|
+
onActivityFinished(): void;
|
|
37
|
+
}
|
|
35
38
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MatDialog } from '@angular/material';
|
|
2
|
+
import { MatDialogConfig } from '@angular/material/dialog';
|
|
3
|
+
import { Constructable, ListModel, ValueModel } from '@coolon/pectin';
|
|
4
|
+
import { Activity } from '../activity';
|
|
5
|
+
import { InteractionContextBase } from '../interaction-context-base';
|
|
6
|
+
export declare class DialogInteractionContext extends InteractionContextBase {
|
|
7
|
+
private readonly dialogService;
|
|
8
|
+
readonly config: MatDialogConfig<any>;
|
|
9
|
+
private readonly _activeModel;
|
|
10
|
+
constructor(dialogService: MatDialog, config: MatDialogConfig<any>);
|
|
11
|
+
readonly active: ValueModel<boolean>;
|
|
12
|
+
protected _startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data: D, disableClose?: boolean): Promise<R>;
|
|
13
|
+
/**
|
|
14
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
15
|
+
* @param delegate
|
|
16
|
+
*/
|
|
17
|
+
safelyUpdateActivityListDelegate(delegate: ListModel<Activity<any, any>>): void;
|
|
18
|
+
}
|
|
@@ -1,33 +1,24 @@
|
|
|
1
|
-
import { Location } from '@angular/common';
|
|
2
1
|
import { InjectionToken } from '@angular/core';
|
|
3
2
|
import { MatDialog } from '@angular/material';
|
|
4
3
|
import { MatDialogConfig } from '@angular/material/dialog';
|
|
5
|
-
import {
|
|
6
|
-
import { Constructable, ListModel, ValueModel } from '@coolon/pectin';
|
|
4
|
+
import { BooleanValueModelChain, Disposable } from '@coolon/pectin';
|
|
7
5
|
import { Activity } from '../activity';
|
|
8
|
-
import { Alert } from '../alert';
|
|
9
|
-
import { Confirm } from '../confirm';
|
|
10
6
|
import { InteractionContext } from '../interaction-context';
|
|
7
|
+
import { DialogInteractionContext } from './dialog-interaction-context';
|
|
8
|
+
import { ModalInteractionService } from './modal-interaction.service';
|
|
11
9
|
export declare const DIALOG_INTERACTION_SERVICE_DEFAULTS: InjectionToken<MatDialogConfig<any>>;
|
|
12
|
-
export declare class DialogInteractionService extends
|
|
10
|
+
export declare class DialogInteractionService extends ModalInteractionService {
|
|
13
11
|
private readonly dialogService;
|
|
14
|
-
readonly location: Location;
|
|
15
|
-
readonly router: Router;
|
|
16
12
|
readonly dialogServiceDefaults: MatDialogConfig<any>;
|
|
17
13
|
readonly matDialogDefaultConfig: MatDialogConfig<any>;
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
safelyUpdateActivityListDelegate(delegate: ListModel<Activity<any, any>>): void;
|
|
30
|
-
alert(alert: Alert): Promise<void>;
|
|
31
|
-
confirmOrReject(confirm: Confirm): Promise<void>;
|
|
32
|
-
confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
14
|
+
private _activeInteractionContextModel;
|
|
15
|
+
readonly active: BooleanValueModelChain;
|
|
16
|
+
private exclusiveContext;
|
|
17
|
+
constructor(dialogService: MatDialog, dialogServiceDefaults: MatDialogConfig<any>, matDialogDefaultConfig: MatDialogConfig<any>);
|
|
18
|
+
createInteractionContextFor(disposable: Disposable.Collector): InteractionContext;
|
|
19
|
+
_createInteractionContext(): InteractionContext;
|
|
20
|
+
createExclusiveInteractionContext(): InteractionContext;
|
|
21
|
+
onActivityStarted(dialogInteractionContext: DialogInteractionContext): void;
|
|
22
|
+
onActivityFinished(dialogInteractionContext: DialogInteractionContext): void;
|
|
23
|
+
getCurrentActivity(): Promise<Activity<any, any, any>>;
|
|
33
24
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Disposable, GarbageCollector, ValueModel } from '@coolon/pectin';
|
|
2
|
+
import { Activity } from '../activity';
|
|
3
|
+
import { InteractionContext } from '../interaction-context';
|
|
4
|
+
export declare abstract class ModalInteractionService extends GarbageCollector {
|
|
5
|
+
private readonly _activityListeners;
|
|
6
|
+
constructor();
|
|
7
|
+
abstract readonly active: ValueModel<boolean>;
|
|
8
|
+
isActive(): boolean;
|
|
9
|
+
abstract createInteractionContextFor(disposable: Disposable.Collector): InteractionContext;
|
|
10
|
+
abstract createExclusiveInteractionContext(): InteractionContext;
|
|
11
|
+
abstract getCurrentActivity(): Promise<Activity<any, any, any>>;
|
|
12
|
+
addActivityListener(listener: InteractionContext.Listener): Disposable;
|
|
13
|
+
protected notifyActivityStarted(): void;
|
|
14
|
+
protected notifyActivityFinished(): void;
|
|
15
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
|
|
3
|
-
import {
|
|
3
|
+
import { Constructable, ListModel, ValueModel, ValueModelChain } from '@coolon/pectin';
|
|
4
4
|
import { DisposableComponent } from '../../../components/disposable-component';
|
|
5
5
|
import { PlaceComponent } from '../../place-component';
|
|
6
6
|
import { PlaceConfig } from '../../place-config';
|
|
@@ -17,7 +17,6 @@ export declare class PlaceOutletComponent extends DisposableComponent implements
|
|
|
17
17
|
readonly placeChanged: EventEmitter<PlaceComponent>;
|
|
18
18
|
routerOut: RouterOutlet;
|
|
19
19
|
private readonly _activePlace;
|
|
20
|
-
private readonly _previousPlace;
|
|
21
20
|
private readonly _activePlaceVisitModel;
|
|
22
21
|
private readonly _inOutletActivation;
|
|
23
22
|
private readonly _inOutletDeactivation;
|
|
@@ -29,8 +28,6 @@ export declare class PlaceOutletComponent extends DisposableComponent implements
|
|
|
29
28
|
readonly placeAnimationOrder: ValueModelChain<number>;
|
|
30
29
|
private initialPlaceIndex;
|
|
31
30
|
private routerVisit;
|
|
32
|
-
readonly ready: ValueModelChain<boolean>;
|
|
33
|
-
readonly enableAnimation: BooleanValueModelChain;
|
|
34
31
|
constructor(router: Router, placeRouter: PlaceRouter, placeConfig: PlaceConfig, parentOutlet: PlaceOutletComponent);
|
|
35
32
|
ngOnInit(): void;
|
|
36
33
|
getAnimationOrder(): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, CanActivate, CanDeactivate, Router, RouterStateSnapshot, UrlSerializer, UrlTree } from '@angular/router';
|
|
3
|
+
import { PlaceComponent } from '../place-component';
|
|
4
|
+
import { PlaceDefinition } from '../place-definition';
|
|
5
|
+
import { PlaceHistory } from '../place-history';
|
|
6
|
+
import { PlaceRouter } from '../place-router';
|
|
7
|
+
export declare abstract class AbstractPlaceGuard implements CanActivate, CanDeactivate<PlaceComponent> {
|
|
8
|
+
private readonly router;
|
|
9
|
+
private urlSerializer;
|
|
10
|
+
private readonly placeRouter;
|
|
11
|
+
private readonly placeHistory;
|
|
12
|
+
private readonly injector;
|
|
13
|
+
constructor(router: Router, urlSerializer: UrlSerializer, placeRouter: PlaceRouter, placeHistory: PlaceHistory, injector: Injector);
|
|
14
|
+
canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
15
|
+
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean>;
|
|
16
|
+
protected authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, canActivate: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree>;
|
|
17
|
+
isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
18
|
+
abstract getAuthGuard(injector: Injector): CanActivate;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ParamMap, UrlSegment } from '@angular/router';
|
|
2
|
+
/**
|
|
3
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
4
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
5
|
+
* param map even when `parameter`s has content.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ConsolidatedParameterMap implements ParamMap {
|
|
8
|
+
private paramMaps;
|
|
9
|
+
constructor(paramMap: ParamMap, urlSegments: UrlSegment[]);
|
|
10
|
+
get(name: string): string | null;
|
|
11
|
+
getAll(name: string): string[];
|
|
12
|
+
has(name: string): boolean;
|
|
13
|
+
readonly keys: string[];
|
|
14
|
+
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
1
2
|
import { Injector } from '@angular/core';
|
|
2
3
|
import { ActivatedRouteSnapshot, CanActivate, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
3
4
|
import { Observable } from 'rxjs';
|
|
4
5
|
import { NoopComponent } from '../../components/noop/noop.component';
|
|
5
|
-
import {
|
|
6
|
+
import { ModalInteractionService } from '../../interaction/services/modal-interaction.service';
|
|
7
|
+
import { PlaceRouter } from '../place-router';
|
|
6
8
|
export declare class InteractionGuard implements CanDeactivate<NoopComponent>, CanActivate {
|
|
7
9
|
private router;
|
|
8
10
|
private injector;
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
+
private placeRouter;
|
|
12
|
+
private readonly angularLocation;
|
|
13
|
+
private readonly modalInteractionService;
|
|
14
|
+
constructor(router: Router, injector: Injector, placeRouter: PlaceRouter, angularLocation: Location, modalInteractionService: ModalInteractionService);
|
|
11
15
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
12
|
-
canDeactivate(component: NoopComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot):
|
|
16
|
+
canDeactivate(component: NoopComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
13
17
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
2
|
+
import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router, RouterEvent } from '@angular/router';
|
|
3
|
+
import { GarbageCollector } from '@coolon/pectin';
|
|
4
|
+
import { InteractionContext } from '../../interaction/interaction-context';
|
|
5
|
+
import { ModalInteractionService } from '../../interaction/services/modal-interaction.service';
|
|
6
|
+
import { PlaceComponent } from '../place-component';
|
|
7
|
+
import { PlaceDefinition } from '../place-definition';
|
|
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 isPopState: boolean;
|
|
14
|
+
abstract readonly active: boolean;
|
|
15
|
+
abstract readonly startingUrl: string;
|
|
16
|
+
constructor(context: NavigationState.Context);
|
|
17
|
+
readonly interactionContext: InteractionContext;
|
|
18
|
+
storeVisit(visit: Visit): void;
|
|
19
|
+
getVisitFor(placeDef: PlaceDefinition): Visit;
|
|
20
|
+
abstract onStart(event: NavigationStart): NavigationState;
|
|
21
|
+
abstract onCancel(event: NavigationCancel): NavigationState;
|
|
22
|
+
abstract onError(event: NavigationError): NavigationState;
|
|
23
|
+
abstract onEnd(event: NavigationEnd): NavigationState;
|
|
24
|
+
onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState;
|
|
25
|
+
abstract canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
|
|
26
|
+
getVisits(): Visit[];
|
|
27
|
+
protected illegalTransition<R>(message: string | RouterEvent): R;
|
|
28
|
+
protected currentRouterUrl(): string;
|
|
29
|
+
protected createActiveSession(event: NavigationStart): NavigationState.Active;
|
|
30
|
+
protected updateLocation(url: any): void;
|
|
31
|
+
toString(): string;
|
|
32
|
+
}
|
|
33
|
+
export declare namespace NavigationState {
|
|
34
|
+
class Context {
|
|
35
|
+
readonly router: Router;
|
|
36
|
+
readonly modalInteractionService: ModalInteractionService;
|
|
37
|
+
readonly angularLocation: Location;
|
|
38
|
+
readonly notifySuccess: (success: NavigationState) => void;
|
|
39
|
+
constructor(router: Router, modalInteractionService: ModalInteractionService, angularLocation: Location, notifySuccess: (success: NavigationState) => void);
|
|
40
|
+
}
|
|
41
|
+
class Idle extends NavigationState {
|
|
42
|
+
readonly isPopState: boolean;
|
|
43
|
+
readonly active = false;
|
|
44
|
+
readonly startingUrl: any;
|
|
45
|
+
constructor(context: Context);
|
|
46
|
+
canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
|
|
47
|
+
onStart(event: NavigationStart): NavigationState;
|
|
48
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
49
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
50
|
+
onError(event: NavigationError): NavigationState;
|
|
51
|
+
}
|
|
52
|
+
class Active extends NavigationState {
|
|
53
|
+
readonly isPopState: boolean;
|
|
54
|
+
readonly startingUrl: string;
|
|
55
|
+
readonly active = 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
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
63
|
+
onError(event: NavigationError): NavigationState;
|
|
64
|
+
onBackClickedDuringNavigationInteraction(locationTriggerUrl: string): NavigationState;
|
|
65
|
+
canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
|
|
66
|
+
private detachInteractionContext;
|
|
67
|
+
toString(): string;
|
|
68
|
+
}
|
|
69
|
+
class ModalInteractionSession extends NavigationState {
|
|
70
|
+
readonly startingUrl: string;
|
|
71
|
+
readonly active = false;
|
|
72
|
+
readonly isPopState = false;
|
|
73
|
+
static hasInteraction(url: string): boolean;
|
|
74
|
+
constructor(context: Context, startingUrl: string);
|
|
75
|
+
onStart(event: NavigationStart): NavigationState;
|
|
76
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
77
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
78
|
+
onError(event: NavigationError): NavigationState;
|
|
79
|
+
canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
|
|
80
|
+
}
|
|
81
|
+
class CancelledDuringNavigationInteraction extends NavigationState {
|
|
82
|
+
readonly startingUrl: string;
|
|
83
|
+
readonly locationChangeTriggerUrl: string;
|
|
84
|
+
readonly active = false;
|
|
85
|
+
readonly isPopState: boolean;
|
|
86
|
+
private capturedFauxRouterStart;
|
|
87
|
+
constructor(context: Context, startingUrl: string, locationChangeTriggerUrl: string);
|
|
88
|
+
canDeactivatePlace(component: PlaceComponent, nextState: UrlSnapshot): Promise<boolean>;
|
|
89
|
+
onCancel(event: NavigationCancel): NavigationState;
|
|
90
|
+
onEnd(event: NavigationEnd): NavigationState;
|
|
91
|
+
onError(event: NavigationError): NavigationState;
|
|
92
|
+
onStart(event: NavigationStart): NavigationState;
|
|
93
|
+
ignore(event: RouterEvent, reason?: string): NavigationState;
|
|
94
|
+
toString(): string;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PlaceComponent } from '../place-component';
|
|
2
|
+
import { UrlSnapshot } from '../url-snapshot';
|
|
3
|
+
import { NavigationState } from './navigation-state';
|
|
4
|
+
export declare class PlaceComponentDeactivationHandler {
|
|
5
|
+
readonly component: PlaceComponent;
|
|
6
|
+
readonly navigationSession: NavigationState;
|
|
7
|
+
private canDeactivatePromise;
|
|
8
|
+
constructor(component: PlaceComponent, navigationSession: NavigationState);
|
|
9
|
+
canDeactivate(nextState: UrlSnapshot): Promise<boolean>;
|
|
10
|
+
protected canDeactivateComponent(nextState: UrlSnapshot): Promise<boolean>;
|
|
11
|
+
protected isNotJustAChangeInRouteId(nextState: UrlSnapshot): boolean;
|
|
12
|
+
}
|
package/lib/place/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @file Automatically generated by barrelsby.
|
|
3
3
|
*/
|
|
4
4
|
export * from "./nav-item";
|
|
5
|
-
export * from "./navigation-session";
|
|
6
5
|
export * from "./place-component";
|
|
7
6
|
export * from "./place-config";
|
|
8
7
|
export * from "./place-definition";
|
|
@@ -10,6 +9,7 @@ export * from "./place-history";
|
|
|
10
9
|
export * from "./place-router";
|
|
11
10
|
export * from "./place.decorator";
|
|
12
11
|
export * from "./place.module";
|
|
12
|
+
export * from "./url-snapshot";
|
|
13
13
|
export * from "./visit";
|
|
14
14
|
export * from "./components/abstract-place-navigation.component";
|
|
15
15
|
export * from "./components/busy-overlay/busy-overlay.component";
|
|
@@ -18,10 +18,12 @@ export * from "./components/list-place-nav/list-place-nav.component";
|
|
|
18
18
|
export * from "./components/place-outlet/place-outlet.component";
|
|
19
19
|
export * from "./components/place-outlet/route-animations";
|
|
20
20
|
export * from "./components/tabbed-place-navigation/tabbed-place-navigation.component";
|
|
21
|
-
export * from "./guards/abstract-
|
|
22
|
-
export * from "./guards/
|
|
21
|
+
export * from "./guards/abstract-place.guard";
|
|
22
|
+
export * from "./guards/consolidated-param-map";
|
|
23
|
+
export * from "./guards/interaction.guard";
|
|
24
|
+
export * from "./guards/navigation-state";
|
|
23
25
|
export * from "./guards/noop-auth-guard.service";
|
|
24
|
-
export * from "./
|
|
26
|
+
export * from "./guards/place-component-deactivation-handler";
|
|
25
27
|
export * from "./route/formatter";
|
|
26
28
|
export * from "./route/json-types";
|
|
27
29
|
export * from "./route/parameter-decorators";
|
|
@@ -10,7 +10,7 @@ export declare const ROUTE_PARAMETER_LIST_KEY: unique symbol;
|
|
|
10
10
|
export declare class PlaceComponent extends DisposableComponent {
|
|
11
11
|
private visit;
|
|
12
12
|
interactionContext?: InteractionContext;
|
|
13
|
-
canDeactivate?(): boolean | Promise<boolean>;
|
|
13
|
+
canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;
|
|
14
14
|
constructor();
|
|
15
15
|
initialiseBindings(visit: ValueModel<Visit>): void;
|
|
16
16
|
private installBinding;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { Location } from '@angular/common';
|
|
2
|
-
import { ActivatedRoute, ActivatedRouteSnapshot,
|
|
3
|
-
import {
|
|
2
|
+
import { ActivatedRoute, ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlSerializer } from '@angular/router';
|
|
3
|
+
import { GarbageCollector, HasOneIndexChain, ListModel, ValueModel } from '@coolon/pectin';
|
|
4
4
|
import { InteractionContext } from '../interaction/interaction-context';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ModalInteractionService } from '../interaction/services/modal-interaction.service';
|
|
6
|
+
import { NavigationState } from './guards/navigation-state';
|
|
7
7
|
import { PlaceHistory } from './place-history';
|
|
8
|
+
import { UrlSnapshot } from './url-snapshot';
|
|
8
9
|
import { Visit } from './visit';
|
|
9
10
|
export declare class PlaceRouter extends GarbageCollector {
|
|
10
11
|
private readonly router;
|
|
11
12
|
private readonly urlSerializer;
|
|
12
|
-
private
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
13
|
+
private readonly angularLocation;
|
|
14
|
+
private readonly placeHistory;
|
|
15
|
+
private readonly modalInteractionService;
|
|
15
16
|
private firstRoute;
|
|
16
17
|
private readonly _navigationSessionModel;
|
|
17
18
|
private readonly _activeVisits;
|
|
18
|
-
readonly navigationSessionActive:
|
|
19
|
+
readonly navigationSessionActive: ValueModel<boolean>;
|
|
19
20
|
readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
readonly
|
|
25
|
-
readonly navigationSessionModel: ValueModel<NavigationSession>;
|
|
21
|
+
private _navigationSessionContext;
|
|
22
|
+
constructor(router: Router, urlSerializer: UrlSerializer, angularLocation: Location, placeHistory: PlaceHistory, modalInteractionService: ModalInteractionService);
|
|
23
|
+
private processNavigationSuccess;
|
|
24
|
+
readonly navigationSession: NavigationState;
|
|
25
|
+
readonly navigationSessionModel: ValueModel<NavigationState>;
|
|
26
26
|
readonly activeVisits: ListModel<Visit>;
|
|
27
27
|
/**
|
|
28
28
|
* placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
|
|
@@ -31,29 +31,21 @@ export declare class PlaceRouter extends GarbageCollector {
|
|
|
31
31
|
navigate(visit: Visit, options?: {
|
|
32
32
|
relativeTo: ActivatedRoute;
|
|
33
33
|
}): Promise<void>;
|
|
34
|
-
createRedirectFor(visit: Visit, navigationExtras?: NavigationExtras): UrlTree;
|
|
35
34
|
pushVisitChangesToRoute(activatedRoute: ActivatedRoute, previous: Visit, next: Visit): Promise<void>;
|
|
36
|
-
doNavigation(visit: Visit,
|
|
35
|
+
doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any): Promise<void>;
|
|
36
|
+
protected runStateTransition(transition: (navigationSession: NavigationState) => NavigationState): void;
|
|
37
37
|
private createRouteParameters;
|
|
38
|
-
private onAngularRouterStarted;
|
|
39
|
-
private onAngularRouterFinished;
|
|
40
38
|
extractChildPath(activatedRoute: ActivatedRouteSnapshot): any[];
|
|
41
|
-
parseUrl(snapshot: RouterStateSnapshot):
|
|
42
|
-
performInitialNavigationIntercept(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): UrlTree;
|
|
43
|
-
isInitialNavigation(): boolean;
|
|
39
|
+
parseUrl(snapshot: RouterStateSnapshot): UrlSnapshot;
|
|
44
40
|
}
|
|
45
41
|
export declare namespace PlaceRouter {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
convertToUrlSegments(visit: Visit): UrlSegment[];
|
|
56
|
-
createRedirectCommandsFor(visit: Visit): any[];
|
|
57
|
-
includesPathOf(placeDef: PlaceDefinition): UrlSegment;
|
|
42
|
+
const INTERACTION_ROUTER_OUTLET = "aup-interaction";
|
|
43
|
+
class InteractionRouteMediator implements InteractionContext.Listener {
|
|
44
|
+
readonly navigationSessionModelActive: ValueModel<boolean>;
|
|
45
|
+
readonly router: Router;
|
|
46
|
+
constructor(navigationSessionModelActive: ValueModel<boolean>, router: Router);
|
|
47
|
+
readonly isNavigating: boolean;
|
|
48
|
+
onActivityStarted(): void;
|
|
49
|
+
onActivityFinished(): void;
|
|
58
50
|
}
|
|
59
51
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UrlSegment, UrlTree } from '@angular/router';
|
|
2
|
+
import { PlaceDefinition } from './place-definition';
|
|
3
|
+
import { Visit } from './visit';
|
|
4
|
+
export declare class UrlSnapshot {
|
|
5
|
+
readonly urlTree: UrlTree;
|
|
6
|
+
constructor(urlTree: UrlTree);
|
|
7
|
+
cloneUrlSegmentList(): UrlSegment[];
|
|
8
|
+
updateVisitSegments(visit: Visit): UrlSegment[];
|
|
9
|
+
/**
|
|
10
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
11
|
+
* @param visit
|
|
12
|
+
*/
|
|
13
|
+
convertToUrlSegments(visit: Visit): UrlSegment[];
|
|
14
|
+
createRedirectCommandsFor(visit: Visit): any[];
|
|
15
|
+
includesPathOf(placeDef: PlaceDefinition): UrlSegment;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -96,8 +96,8 @@ class PlaceDef {
|
|
|
96
96
|
bits.push(`{
|
|
97
97
|
path: "${this.fullPath}",
|
|
98
98
|
component: ${this.componentClass},
|
|
99
|
-
canActivate: [
|
|
100
|
-
canDeactivate: [
|
|
99
|
+
canActivate: [PlaceGuard],
|
|
100
|
+
canDeactivate: [PlaceGuard],
|
|
101
101
|
children:[
|
|
102
102
|
${this.getChildRouteTemplates().join(', ')}
|
|
103
103
|
]
|