@coolon/angular-ui-powerups 0.0.63 → 0.0.66
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 +725 -561
- 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 +10 -10
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +10 -10
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/abstract-activity.js +5 -68
- package/esm2015/lib/interaction/activity.js +72 -11
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +213 -120
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js +6 -7
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +19 -43
- package/esm2015/lib/interaction/index.js +2 -2
- package/esm2015/lib/interaction/interaction-context.js +11 -5
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +94 -65
- package/esm2015/lib/place/guards/leave-place.guard.js +95 -131
- package/esm2015/lib/place/place-router.js +87 -6
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +10 -10
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/abstract-activity.js +10 -96
- package/esm5/lib/interaction/activity.js +114 -11
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +285 -143
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js +6 -7
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +19 -67
- package/esm5/lib/interaction/index.js +2 -2
- package/esm5/lib/interaction/interaction-context.js +18 -7
- package/esm5/lib/interaction/services/dialog-interaction.service.js +112 -64
- package/esm5/lib/place/guards/leave-place.guard.js +51 -137
- package/esm5/lib/place/place-router.js +96 -6
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +583 -439
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +698 -535
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/abstract-activity.d.ts +4 -13
- package/lib/interaction/activity.d.ts +14 -7
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +37 -25
- package/lib/interaction/components/activity-outlet/activity-outlet-context.d.ts +2 -5
- package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +1 -10
- package/lib/interaction/interaction-context.d.ts +6 -6
- package/lib/interaction/services/dialog-interaction.service.d.ts +4 -6
- package/lib/place/guards/leave-place.guard.d.ts +6 -7
- package/lib/place/place-router.d.ts +14 -1
- package/package.json +1 -1
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { ValueModel } from '@coolon/pectin';
|
|
2
|
-
import { DisposableComponent } from '../components/disposable-component';
|
|
3
1
|
import { Activity } from './activity';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
initialise(activityContext: ActivityOutletContext<D, R, E>): void;
|
|
9
|
-
done(result?: R): void;
|
|
10
|
-
cancel(error?: E): void;
|
|
11
|
-
onActivityReady(): void;
|
|
12
|
-
readonly busy: ValueModel<boolean>;
|
|
13
|
-
busyWhile(busyModel: ValueModel<boolean>): void;
|
|
14
|
-
isBusy(): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Deprecated. You can now extend the Activity class directly.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class AbstractActivity<D, R, E = any> extends Activity<D, R, E> {
|
|
15
6
|
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { ValueModel } from '@coolon/pectin';
|
|
3
|
-
import { ActivityOutletContext } from './components/activity-outlet/activity-outlet-context';
|
|
2
|
+
import { GarbageCollector, ValueModel } from '@coolon/pectin';
|
|
4
3
|
export declare const ACTIVITY_DATA: InjectionToken<any>;
|
|
5
|
-
export
|
|
4
|
+
export declare abstract class Activity<D, R, E = any> extends GarbageCollector {
|
|
5
|
+
private readonly _busyModel;
|
|
6
|
+
private _activityContext;
|
|
7
|
+
initialise(activityContext: Activity.Callbacks<R, E>): void;
|
|
8
|
+
done(result?: R): void;
|
|
9
|
+
cancel(error?: E): void;
|
|
10
|
+
onActivityReady(): void;
|
|
6
11
|
readonly busy: ValueModel<boolean>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
cancel(e: E): any;
|
|
12
|
+
busyWhile(busyModel: ValueModel<boolean>): void;
|
|
13
|
+
isBusy(): boolean;
|
|
10
14
|
}
|
|
11
15
|
export declare namespace Activity {
|
|
12
|
-
|
|
16
|
+
interface Callbacks<R, E> {
|
|
17
|
+
onDone: (result: R) => void;
|
|
18
|
+
onCancel: (error: E) => void;
|
|
19
|
+
}
|
|
13
20
|
}
|
|
@@ -1,46 +1,58 @@
|
|
|
1
1
|
import { AfterViewInit, OnInit, QueryList } from '@angular/core';
|
|
2
2
|
import { MatTabGroup } from '@angular/material';
|
|
3
|
-
import { Constructable, ListModel, MutableListModel
|
|
4
|
-
import { DisposableComponent } from '../../../components/disposable-component';
|
|
3
|
+
import { Constructable, ListModel, MutableListModel } from '@coolon/pectin';
|
|
5
4
|
import { Activity } from '../../activity';
|
|
6
5
|
import { Alert } from '../../alert';
|
|
7
6
|
import { Confirm } from '../../confirm';
|
|
8
7
|
import { InteractionContext } from '../../interaction-context';
|
|
9
8
|
import { ActivityOutletContext } from '../activity-outlet/activity-outlet-context';
|
|
10
9
|
import { ActivityOutletComponent } from '../activity-outlet/activity-outlet.component';
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Note: this class is mutable and is stored in a list model. This is normally a big no no but
|
|
12
|
+
* we're manually deriving other models from the list after view state changes. I.e. we not
|
|
13
|
+
* using pectin chains on any of the mutable fields.
|
|
14
|
+
*/
|
|
15
|
+
declare class TabContext<D, R, E> implements ActivityOutletContext<D, R, E> {
|
|
16
|
+
readonly activityData: D;
|
|
17
|
+
readonly activityClass: Constructable<Activity<D, R, E>>;
|
|
18
|
+
readonly interactionContext: InteractionContext;
|
|
19
|
+
readonly activityCallbacks: Activity.Callbacks<R, E>;
|
|
20
|
+
private _complete;
|
|
21
|
+
private _component;
|
|
22
|
+
constructor(activityData: D, activityClass: Constructable<Activity<D, R, E>>, interactionContext: InteractionContext, activityCallbacks: Activity.Callbacks<R, E>);
|
|
23
|
+
isComponentRealised(): boolean;
|
|
24
|
+
isComplete(): boolean;
|
|
25
|
+
componentReady(component: Activity<D, R, E>): void;
|
|
26
|
+
readonly component: Activity<D, R, E>;
|
|
27
|
+
onDone(result: R): void;
|
|
28
|
+
onCancel(error: E): void;
|
|
29
|
+
}
|
|
30
|
+
export declare class ActivityContainerComponent<D, R, E> extends InteractionContext implements OnInit, AfterViewInit {
|
|
31
|
+
private readonly activityFinishedEvents;
|
|
12
32
|
parentInteractionContext: InteractionContext;
|
|
13
|
-
initialActivityOutletContext: ActivityOutletContext<
|
|
14
|
-
readonly currentActivity: ValueModel<Activity<any, any>>;
|
|
33
|
+
initialActivityOutletContext: ActivityOutletContext<D, R, E>;
|
|
15
34
|
tabs: MatTabGroup;
|
|
16
35
|
outlets: QueryList<ActivityOutletComponent<any, any, any>>;
|
|
17
|
-
readonly
|
|
18
|
-
private obsoleteTabs;
|
|
36
|
+
readonly activityTabs: MutableListModel<TabContext<any, any, any>>;
|
|
19
37
|
private finished;
|
|
20
38
|
private readonly _activityList;
|
|
21
39
|
constructor();
|
|
22
40
|
isActive(): boolean;
|
|
23
|
-
readonly activityList: ListModel<Activity<any, any>>;
|
|
41
|
+
readonly activityList: ListModel<Activity<any, any, any>>;
|
|
24
42
|
ngOnInit(): void;
|
|
25
43
|
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;
|
|
31
|
-
initialise<D, R, E>(initialContext: ActivityContainerComponent.ActivityContext<D, R, E>): void;
|
|
32
|
-
startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R>;
|
|
44
|
+
startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
33
45
|
alert(alert: Alert): Promise<void>;
|
|
34
46
|
confirm(confirm: Confirm): Promise<void>;
|
|
35
|
-
confirmThen<
|
|
47
|
+
confirmThen<D1, R1, E1>(confirm: Confirm, activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
48
|
+
private onActivityFinished;
|
|
49
|
+
private cleanupStaleActivities;
|
|
50
|
+
/**
|
|
51
|
+
* Synchronises the selected tab index. Returns true if there was no change to the selected index.
|
|
52
|
+
*/
|
|
53
|
+
private synchroniseSelectedTabIndex;
|
|
36
54
|
private onAnimationFinished;
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
export declare namespace ActivityContainerComponent {
|
|
40
|
-
interface ActivityContext<D, R, E> {
|
|
41
|
-
activityClass: Constructable<Activity<D, R, E>>;
|
|
42
|
-
activityData: D;
|
|
43
|
-
onDone: (result: R) => void;
|
|
44
|
-
onCancel: (error: E) => void;
|
|
45
|
-
}
|
|
55
|
+
private updateActivityList;
|
|
56
|
+
private getSelectedOutlet;
|
|
46
57
|
}
|
|
58
|
+
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Constructable } from '@coolon/pectin';
|
|
2
2
|
import { Activity } from '../../activity';
|
|
3
|
-
|
|
4
|
-
export interface ActivityOutletContext<D, R, E> {
|
|
5
|
-
interactionContext: InteractionContext;
|
|
3
|
+
export interface ActivityOutletContext<D, R, E> extends Activity.Callbacks<R, E> {
|
|
6
4
|
activityClass: Constructable<Activity<D, R, E>>;
|
|
7
5
|
activityData: D;
|
|
8
|
-
|
|
9
|
-
onCancel: (error: E) => void;
|
|
6
|
+
componentReady?(component: Activity<D, R, E>): any;
|
|
10
7
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { ComponentFactoryResolver, Injector, OnInit, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import { Constructable } from '@coolon/pectin';
|
|
3
2
|
import { Activity } from '../../activity';
|
|
4
|
-
import { Alert } from '../../alert';
|
|
5
|
-
import { Confirm } from '../../confirm';
|
|
6
3
|
import { InteractionContext } from '../../interaction-context';
|
|
7
4
|
import { ActivityOutletContext } from './activity-outlet-context';
|
|
8
5
|
/**
|
|
@@ -17,17 +14,11 @@ export declare class ActivityOutletComponent<D, R, E> implements OnInit {
|
|
|
17
14
|
private viewContainerRef;
|
|
18
15
|
private injector;
|
|
19
16
|
interactionContext: InteractionContext;
|
|
17
|
+
private _activityContext;
|
|
20
18
|
activityContext: ActivityOutletContext<D, R, E>;
|
|
21
19
|
private activityComponentRef;
|
|
22
20
|
constructor(componentFactoryResolver: ComponentFactoryResolver, viewContainerRef: ViewContainerRef, injector: Injector);
|
|
23
21
|
ngOnInit(): void;
|
|
24
22
|
loadActivity(activityContext: ActivityOutletContext<D, R, E>): void;
|
|
25
23
|
readonly component: Activity<D, R, E>;
|
|
26
|
-
alert(alert: Alert): Promise<void>;
|
|
27
|
-
confirm(confirm: Confirm): Promise<void>;
|
|
28
|
-
confirmThen<D1, R1, E1>(confirm: Confirm, activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
29
|
-
startActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data?: D1): Promise<R1>;
|
|
30
|
-
notifyReady(): void;
|
|
31
|
-
}
|
|
32
|
-
export declare namespace ActivityOutletComponent {
|
|
33
24
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Constructable, GarbageCollector, ListModel
|
|
1
|
+
import { Constructable, GarbageCollector, ListModel } 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
6
|
/**
|
|
7
|
-
* Returns the
|
|
7
|
+
* Returns the current list of activities that are in progress.
|
|
8
8
|
* This model is only updated in the next tick after the view has been updated.
|
|
9
9
|
*/
|
|
10
|
-
abstract readonly
|
|
10
|
+
abstract readonly activityList: ListModel<Activity<any, any>>;
|
|
11
|
+
protected constructor();
|
|
11
12
|
/**
|
|
12
|
-
* Returns the
|
|
13
|
+
* Returns the activity that is currently active.
|
|
13
14
|
* This model is only updated in the next tick after the view has been updated.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
constructor();
|
|
16
|
+
readonly currentActivity: Activity<any, any>;
|
|
17
17
|
/**
|
|
18
18
|
* Returns true if an activity is currently running.
|
|
19
19
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
2
|
import { MatDialog } from '@angular/material';
|
|
3
3
|
import { MatDialogConfig } from '@angular/material/dialog';
|
|
4
|
-
import {
|
|
5
|
-
import { Constructable, ListModel, ValueModel } from '@coolon/pectin';
|
|
4
|
+
import { Constructable, ListModel } from '@coolon/pectin';
|
|
6
5
|
import { Activity } from '../activity';
|
|
7
6
|
import { Alert } from '../alert';
|
|
8
7
|
import { Confirm } from '../confirm';
|
|
@@ -10,13 +9,12 @@ import { InteractionContext } from '../interaction-context';
|
|
|
10
9
|
export declare const DIALOG_INTERACTION_SERVICE_DEFAULTS: InjectionToken<MatDialogConfig<any>>;
|
|
11
10
|
export declare class DialogInteractionService extends InteractionContext {
|
|
12
11
|
private readonly dialogService;
|
|
13
|
-
private readonly router;
|
|
14
12
|
readonly dialogServiceDefaults: MatDialogConfig<any>;
|
|
15
13
|
readonly matDialogDefaultConfig: MatDialogConfig<any>;
|
|
16
|
-
readonly currentActivity: ValueModel<Activity<any, any>>;
|
|
17
14
|
private readonly _activityList;
|
|
18
|
-
private
|
|
19
|
-
|
|
15
|
+
private startingGuard;
|
|
16
|
+
private currentActivityId;
|
|
17
|
+
constructor(dialogService: MatDialog, dialogServiceDefaults: MatDialogConfig<any>, matDialogDefaultConfig: MatDialogConfig<any>);
|
|
20
18
|
isActive(): boolean;
|
|
21
19
|
cancelActivity(): void;
|
|
22
20
|
readonly activityList: ListModel<Activity<any, any>>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Location } from '@angular/common';
|
|
2
2
|
import { Injector } from '@angular/core';
|
|
3
|
-
import { ActivatedRouteSnapshot, CanDeactivate, Router, RouterStateSnapshot
|
|
4
|
-
import { Observable } from 'rxjs';
|
|
3
|
+
import { ActivatedRouteSnapshot, CanDeactivate, Router, RouterStateSnapshot } from '@angular/router';
|
|
5
4
|
import { InteractionContext } from '../../interaction/interaction-context';
|
|
6
5
|
import { PlaceComponent } from '../place-component';
|
|
6
|
+
import { PlaceRouter } from '../place-router';
|
|
7
7
|
export declare class LeavePlaceGuard implements CanDeactivate<PlaceComponent> {
|
|
8
8
|
private router;
|
|
9
9
|
private injector;
|
|
10
|
+
private placeRouter;
|
|
10
11
|
readonly interactionContext: InteractionContext;
|
|
11
|
-
readonly
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
15
|
-
alreadyAccepted(placeComponent: PlaceComponent): boolean;
|
|
12
|
+
readonly angularLocation: Location;
|
|
13
|
+
constructor(router: Router, injector: Injector, placeRouter: PlaceRouter, interactionContext: InteractionContext, angularLocation: Location);
|
|
14
|
+
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean>;
|
|
16
15
|
}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
1
2
|
import { ActivatedRoute, ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router';
|
|
3
|
+
import { PlaceComponent } from './place-component';
|
|
2
4
|
import { ParameterSnapshot } from './route/parameter-snapshot';
|
|
5
|
+
declare class NavigationSession {
|
|
6
|
+
readonly isPopState: boolean;
|
|
7
|
+
readonly initialUrl: string;
|
|
8
|
+
private _alreadyAccepted;
|
|
9
|
+
constructor(isPopState: boolean, initialUrl: string);
|
|
10
|
+
alreadyAccepted(placeComponent: PlaceComponent): boolean;
|
|
11
|
+
rememberAcceptanceOf(component: PlaceComponent): void;
|
|
12
|
+
}
|
|
3
13
|
export declare class PlaceRouter {
|
|
4
14
|
private readonly router;
|
|
5
|
-
|
|
15
|
+
private readonly _navigationSession;
|
|
16
|
+
constructor(router: Router, angularLocation: Location);
|
|
17
|
+
readonly navigationSession: NavigationSession;
|
|
6
18
|
pushParameterChangesToRoute(activatedRoute: ActivatedRoute, previous: ParameterSnapshot, next: ParameterSnapshot): void;
|
|
7
19
|
getRedirectUrlTree(activatedRoute: ActivatedRouteSnapshot, sanitised: ParameterSnapshot): UrlTree;
|
|
8
20
|
protected getChildPath(activatedRoute: ActivatedRouteSnapshot): any[];
|
|
9
21
|
protected createRouteParameters(parameters: ParameterSnapshot): any[];
|
|
10
22
|
}
|
|
23
|
+
export {};
|