@coolon/angular-ui-powerups 0.0.61 → 0.0.63
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 +414 -117
- 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.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +2 -2
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/activity.js +11 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +49 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +7 -56
- package/esm2015/lib/interaction/guards/close-interaction.guard.js +62 -0
- package/esm2015/lib/interaction/index.js +3 -2
- package/esm2015/lib/interaction/interaction-context.js +24 -5
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +77 -4
- package/esm2015/lib/place/guards/leave-place.guard.js +144 -20
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +2 -2
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/activity.js +11 -1
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +67 -1
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +11 -78
- package/esm5/lib/interaction/guards/close-interaction.guard.js +66 -0
- package/esm5/lib/interaction/index.js +3 -2
- package/esm5/lib/interaction/interaction-context.js +25 -6
- package/esm5/lib/interaction/services/dialog-interaction.service.js +96 -4
- package/esm5/lib/place/guards/leave-place.guard.js +147 -20
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +354 -82
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +401 -105
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/activity.d.ts +2 -0
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +10 -1
- package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +2 -9
- package/lib/interaction/guards/close-interaction.guard.d.ts +12 -0
- package/lib/interaction/index.d.ts +1 -0
- package/lib/interaction/interaction-context.d.ts +17 -4
- package/lib/interaction/services/dialog-interaction.service.d.ts +15 -2
- package/lib/place/guards/leave-place.guard.d.ts +7 -1
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ export declare const ACTIVITY_DATA: InjectionToken<any>;
|
|
|
5
5
|
export interface Activity<D, R, E = any> {
|
|
6
6
|
readonly busy: ValueModel<boolean>;
|
|
7
7
|
initialise(activityContext: ActivityOutletContext<D, R, E>): void;
|
|
8
|
+
done(result: R): any;
|
|
9
|
+
cancel(e: E): any;
|
|
8
10
|
}
|
|
9
11
|
export declare namespace Activity {
|
|
10
12
|
type CallBack<T> = (value: T) => void | Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AfterViewInit, OnInit, QueryList } from '@angular/core';
|
|
2
2
|
import { MatTabGroup } from '@angular/material';
|
|
3
|
-
import { Constructable, MutableListModel } from '@coolon/pectin';
|
|
3
|
+
import { Constructable, ListModel, MutableListModel, ValueModel } from '@coolon/pectin';
|
|
4
4
|
import { DisposableComponent } from '../../../components/disposable-component';
|
|
5
5
|
import { Activity } from '../../activity';
|
|
6
6
|
import { Alert } from '../../alert';
|
|
@@ -11,14 +11,23 @@ import { ActivityOutletComponent } from '../activity-outlet/activity-outlet.comp
|
|
|
11
11
|
export declare class ActivityContainerComponent extends DisposableComponent implements OnInit, AfterViewInit, InteractionContext {
|
|
12
12
|
parentInteractionContext: InteractionContext;
|
|
13
13
|
initialActivityOutletContext: ActivityOutletContext<any, any, any>;
|
|
14
|
+
readonly currentActivity: ValueModel<Activity<any, any>>;
|
|
14
15
|
tabs: MatTabGroup;
|
|
15
16
|
outlets: QueryList<ActivityOutletComponent<any, any, any>>;
|
|
16
17
|
readonly activityOutletTabs: MutableListModel<ActivityOutletContext<any, any, any>>;
|
|
17
18
|
private obsoleteTabs;
|
|
18
19
|
private finished;
|
|
20
|
+
private readonly _activityList;
|
|
19
21
|
constructor();
|
|
22
|
+
isActive(): boolean;
|
|
23
|
+
readonly activityList: ListModel<Activity<any, any>>;
|
|
20
24
|
ngOnInit(): void;
|
|
21
25
|
ngAfterViewInit(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
28
|
+
* @param activities
|
|
29
|
+
*/
|
|
30
|
+
private safelyUpdateActivityList;
|
|
22
31
|
initialise<D, R, E>(initialContext: ActivityContainerComponent.ActivityContext<D, R, E>): void;
|
|
23
32
|
startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
24
33
|
alert(alert: Alert): Promise<void>;
|
|
@@ -12,7 +12,7 @@ import { ActivityOutletContext } from './activity-outlet-context';
|
|
|
12
12
|
* It might be nice to have wrapper component that allows more declarative use, i.e.
|
|
13
13
|
* <activity-view [activityClass]="...", [activityData]="..." (done)=".." (cancel)="..."></activity-view>
|
|
14
14
|
*/
|
|
15
|
-
export declare class ActivityOutletComponent<D, R, E> implements OnInit
|
|
15
|
+
export declare class ActivityOutletComponent<D, R, E> implements OnInit {
|
|
16
16
|
private componentFactoryResolver;
|
|
17
17
|
private viewContainerRef;
|
|
18
18
|
private injector;
|
|
@@ -22,6 +22,7 @@ export declare class ActivityOutletComponent<D, R, E> implements OnInit, Interac
|
|
|
22
22
|
constructor(componentFactoryResolver: ComponentFactoryResolver, viewContainerRef: ViewContainerRef, injector: Injector);
|
|
23
23
|
ngOnInit(): void;
|
|
24
24
|
loadActivity(activityContext: ActivityOutletContext<D, R, E>): void;
|
|
25
|
+
readonly component: Activity<D, R, E>;
|
|
25
26
|
alert(alert: Alert): Promise<void>;
|
|
26
27
|
confirm(confirm: Confirm): Promise<void>;
|
|
27
28
|
confirmThen<D1, R1, E1>(confirm: Confirm, activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
@@ -29,12 +30,4 @@ export declare class ActivityOutletComponent<D, R, E> implements OnInit, Interac
|
|
|
29
30
|
notifyReady(): void;
|
|
30
31
|
}
|
|
31
32
|
export declare namespace ActivityOutletComponent {
|
|
32
|
-
class OutletInteractionContext<D, R, E> implements InteractionContext {
|
|
33
|
-
private readonly context;
|
|
34
|
-
constructor(context: ActivityOutletContext<D, R, E>);
|
|
35
|
-
alert(alert: Alert): Promise<void>;
|
|
36
|
-
confirm(confirm: Confirm): Promise<void>;
|
|
37
|
-
confirmThen<D1, R1, E1>(confirm: Confirm, activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
38
|
-
startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
39
|
-
}
|
|
40
33
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { PlaceComponent } from '../../place/place-component';
|
|
5
|
+
import { InteractionContext } from '../interaction-context';
|
|
6
|
+
export declare class CloseInteractionGuard implements CanDeactivate<PlaceComponent> {
|
|
7
|
+
private router;
|
|
8
|
+
private injector;
|
|
9
|
+
private readonly interactionContext;
|
|
10
|
+
constructor(router: Router, injector: Injector, interactionContext: InteractionContext);
|
|
11
|
+
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
12
|
+
}
|
|
@@ -14,4 +14,5 @@ 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 "./guards/close-interaction.guard";
|
|
17
18
|
export * from "./services/dialog-interaction.service";
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Constructable } from '@coolon/pectin';
|
|
1
|
+
import { Constructable, GarbageCollector, ListModel, ValueModel } from '@coolon/pectin';
|
|
3
2
|
import { Activity } from './activity';
|
|
4
3
|
import { Alert } from './alert';
|
|
5
4
|
import { Confirm } from './confirm';
|
|
6
|
-
export declare
|
|
7
|
-
|
|
5
|
+
export declare abstract class InteractionContext extends GarbageCollector {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the activity that is currently active.
|
|
8
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
9
|
+
*/
|
|
10
|
+
abstract readonly currentActivity: ValueModel<Activity<any, any>>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current list of activities that are in progress.
|
|
13
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
14
|
+
*/
|
|
15
|
+
abstract readonly activityList: ListModel<Activity<any, any>>;
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Returns true if an activity is currently running.
|
|
19
|
+
*/
|
|
20
|
+
abstract isActive(): boolean;
|
|
8
21
|
abstract startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
9
22
|
abstract confirm(confirm: Confirm): Promise<void>;
|
|
10
23
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
2
|
import { MatDialog } from '@angular/material';
|
|
3
3
|
import { MatDialogConfig } from '@angular/material/dialog';
|
|
4
|
-
import {
|
|
4
|
+
import { Router } from '@angular/router';
|
|
5
|
+
import { Constructable, ListModel, ValueModel } from '@coolon/pectin';
|
|
5
6
|
import { Activity } from '../activity';
|
|
6
7
|
import { Alert } from '../alert';
|
|
7
8
|
import { Confirm } from '../confirm';
|
|
@@ -9,11 +10,23 @@ import { InteractionContext } from '../interaction-context';
|
|
|
9
10
|
export declare const DIALOG_INTERACTION_SERVICE_DEFAULTS: InjectionToken<MatDialogConfig<any>>;
|
|
10
11
|
export declare class DialogInteractionService extends InteractionContext {
|
|
11
12
|
private readonly dialogService;
|
|
13
|
+
private readonly router;
|
|
12
14
|
readonly dialogServiceDefaults: MatDialogConfig<any>;
|
|
13
15
|
readonly matDialogDefaultConfig: MatDialogConfig<any>;
|
|
14
|
-
|
|
16
|
+
readonly currentActivity: ValueModel<Activity<any, any>>;
|
|
17
|
+
private readonly _activityList;
|
|
18
|
+
private _active;
|
|
19
|
+
constructor(dialogService: MatDialog, router: Router, dialogServiceDefaults: MatDialogConfig<any>, matDialogDefaultConfig: MatDialogConfig<any>);
|
|
20
|
+
isActive(): boolean;
|
|
21
|
+
cancelActivity(): void;
|
|
22
|
+
readonly activityList: ListModel<Activity<any, any>>;
|
|
15
23
|
startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
16
24
|
private _startActivity;
|
|
25
|
+
/**
|
|
26
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
27
|
+
* @param delegate
|
|
28
|
+
*/
|
|
29
|
+
safelyUpdateActivityListDelegate(delegate: ListModel<Activity<any, any>>): void;
|
|
17
30
|
alert(alert: Alert): Promise<void>;
|
|
18
31
|
confirm(confirm: Confirm): Promise<void>;
|
|
19
32
|
confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
1
2
|
import { Injector } from '@angular/core';
|
|
2
3
|
import { ActivatedRouteSnapshot, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
3
4
|
import { Observable } from 'rxjs';
|
|
5
|
+
import { InteractionContext } from '../../interaction/interaction-context';
|
|
4
6
|
import { PlaceComponent } from '../place-component';
|
|
5
7
|
export declare class LeavePlaceGuard implements CanDeactivate<PlaceComponent> {
|
|
6
8
|
private router;
|
|
7
9
|
private injector;
|
|
8
|
-
|
|
10
|
+
readonly interactionContext: InteractionContext;
|
|
11
|
+
readonly location: Location;
|
|
12
|
+
private _alreadyAccepted;
|
|
13
|
+
constructor(router: Router, injector: Injector, interactionContext: InteractionContext, location: Location);
|
|
9
14
|
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
15
|
+
alreadyAccepted(placeComponent: PlaceComponent): boolean;
|
|
10
16
|
}
|