@coolon/angular-ui-powerups 0.0.60 → 0.0.62
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 +599 -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.d.ts +5 -4
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +6 -5
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/abstract-activity.js +2 -9
- package/esm2015/lib/interaction/activity.js +11 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +64 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +17 -53
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +92 -0
- package/esm2015/lib/interaction/guards/close-interaction.guard.js +62 -0
- package/esm2015/lib/interaction/index.js +4 -2
- package/esm2015/lib/interaction/interaction-context.js +35 -5
- package/esm2015/lib/interaction/interaction.module.js +5 -2
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +108 -4
- package/esm2015/lib/place/guards/leave-place.guard.js +128 -20
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +6 -5
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/abstract-activity.js +9 -9
- package/esm5/lib/interaction/activity.js +11 -1
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +89 -1
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +28 -68
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +107 -0
- package/esm5/lib/interaction/guards/close-interaction.guard.js +66 -0
- package/esm5/lib/interaction/index.js +4 -2
- package/esm5/lib/interaction/interaction-context.js +43 -6
- package/esm5/lib/interaction/interaction.module.js +5 -2
- package/esm5/lib/interaction/services/dialog-interaction.service.js +131 -4
- package/esm5/lib/place/guards/leave-place.guard.js +131 -20
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +493 -85
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +582 -102
- 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 +11 -1
- package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +3 -8
- package/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.d.ts +22 -0
- package/lib/interaction/guards/close-interaction.guard.d.ts +12 -0
- package/lib/interaction/index.d.ts +2 -0
- package/lib/interaction/interaction-context.d.ts +24 -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,18 +11,28 @@ 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>;
|
|
25
34
|
confirm(confirm: Confirm): Promise<void>;
|
|
35
|
+
confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
26
36
|
private onAnimationFinished;
|
|
27
37
|
private animateTabs;
|
|
28
38
|
}
|
|
@@ -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,17 +22,12 @@ 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>;
|
|
28
|
+
confirmThen<D1, R1, E1>(confirm: Confirm, activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
27
29
|
startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
28
30
|
notifyReady(): void;
|
|
29
31
|
}
|
|
30
32
|
export declare namespace ActivityOutletComponent {
|
|
31
|
-
class OutletInteractionContext<D, R, E> implements InteractionContext {
|
|
32
|
-
private readonly context;
|
|
33
|
-
constructor(context: ActivityOutletContext<D, R, E>);
|
|
34
|
-
alert(alert: Alert): Promise<void>;
|
|
35
|
-
confirm(confirm: Confirm): Promise<void>;
|
|
36
|
-
startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
37
|
-
}
|
|
38
33
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { Constructable } from '@coolon/pectin';
|
|
3
|
+
import { AbstractActivity } from '../../abstract-activity';
|
|
4
|
+
import { Activity } from '../../activity';
|
|
5
|
+
import { Confirm } from '../../confirm';
|
|
6
|
+
import { InteractionContext } from '../../interaction-context';
|
|
7
|
+
export declare class ConfirmThenDialogComponent<D, R, E> extends AbstractActivity<ConfirmThenDialogComponent.Data<D, R, E>, R, E> implements OnInit {
|
|
8
|
+
readonly config: ConfirmThenDialogComponent.Data<D, R, E>;
|
|
9
|
+
readonly interactionContext: InteractionContext;
|
|
10
|
+
constructor(config: ConfirmThenDialogComponent.Data<D, R, E>, interactionContext: InteractionContext);
|
|
11
|
+
ngOnInit(): void;
|
|
12
|
+
readonly confirm: Confirm;
|
|
13
|
+
isDestructive(): boolean;
|
|
14
|
+
onConfirm(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare namespace ConfirmThenDialogComponent {
|
|
17
|
+
interface Data<D, R, E> {
|
|
18
|
+
confirm: Confirm;
|
|
19
|
+
activityType: Constructable<Activity<D, R, E>>;
|
|
20
|
+
data: D;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -12,5 +12,7 @@ export * from "./components/activity-container/activity-container.component";
|
|
|
12
12
|
export * from "./components/activity-outlet/activity-outlet-context";
|
|
13
13
|
export * from "./components/activity-outlet/activity-outlet.component";
|
|
14
14
|
export * from "./components/alert-dialog/alert-dialog.component";
|
|
15
|
+
export * from "./components/confirm-then-dialog/confirm-then-dialog.component";
|
|
15
16
|
export * from "./components/confirmation-dialog/confirmation-dialog.component";
|
|
17
|
+
export * from "./guards/close-interaction.guard";
|
|
16
18
|
export * from "./services/dialog-interaction.service";
|
|
@@ -1,11 +1,31 @@
|
|
|
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
|
+
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>;
|
|
23
|
+
/**
|
|
24
|
+
* Presents the confirmation to the user and runs the activity only if the user confirms.
|
|
25
|
+
* @param confirm:Confirm the confirmation to display.
|
|
26
|
+
* @param activityType the activity to run if confirmed.
|
|
27
|
+
* @param data the activity data.
|
|
28
|
+
*/
|
|
29
|
+
abstract confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
10
30
|
abstract alert(alert: Alert): Promise<void>;
|
|
11
31
|
}
|
|
@@ -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
|
+
cancelActivity(): void;
|
|
21
|
+
readonly activityList: ListModel<Activity<any, any>>;
|
|
15
22
|
startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
16
23
|
private _startActivity;
|
|
24
|
+
/**
|
|
25
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
26
|
+
* @param delegate
|
|
27
|
+
*/
|
|
28
|
+
safelyUpdateActivityListDelegate(delegate: ListModel<Activity<any, any>>): void;
|
|
17
29
|
alert(alert: Alert): Promise<void>;
|
|
18
30
|
confirm(confirm: Confirm): Promise<void>;
|
|
31
|
+
confirmThen<D, R, E>(confirm: Confirm, activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
19
32
|
}
|
|
@@ -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
|
}
|