@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
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
1
|
+
import { DOCUMENT, CommonModule, Location } from '@angular/common';
|
|
2
2
|
import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, Optional, ɵɵdefineInjectable, ɵɵinject, NgModule, HostBinding, INJECTOR } from '@angular/core';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
4
|
import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgressSpinnerModule, MatInputModule, MatFormFieldModule, MatSelectModule } from '@angular/material';
|
|
5
5
|
import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
7
|
import { __extends, __decorate, __metadata, __assign, __awaiter, __generator } from 'tslib';
|
|
8
|
-
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableListModel, StoreInValueModel, Binding, MutableValueModel, Guard, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
8
|
+
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Guard, OptionsHelper, ValueHolder, Trace } from '@coolon/pectin';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
10
|
import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
|
|
11
11
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
12
|
+
import { Router, RouterModule, NavigationEnd, NavigationError } from '@angular/router';
|
|
12
13
|
import { MatIconModule } from '@angular/material/icon';
|
|
13
14
|
import { MatListModule } from '@angular/material/list';
|
|
14
15
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
15
|
-
import { Router, RouterModule } from '@angular/router';
|
|
16
16
|
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
17
17
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
18
18
|
import 'reflect-metadata';
|
|
@@ -796,20 +796,38 @@ if (false) {
|
|
|
796
796
|
* @fileoverview added by tsickle
|
|
797
797
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
798
798
|
*/
|
|
799
|
-
/** @type {?} */
|
|
800
|
-
var INTERACTION_CONTEXT = new InjectionToken('InteractionContext');
|
|
801
799
|
/**
|
|
802
800
|
* @abstract
|
|
803
801
|
*/
|
|
804
802
|
var /**
|
|
805
803
|
* @abstract
|
|
806
804
|
*/
|
|
807
|
-
InteractionContext = /** @class */ (function () {
|
|
805
|
+
InteractionContext = /** @class */ (function (_super) {
|
|
806
|
+
__extends(InteractionContext, _super);
|
|
808
807
|
function InteractionContext() {
|
|
808
|
+
return _super.call(this) || this;
|
|
809
809
|
}
|
|
810
810
|
return InteractionContext;
|
|
811
|
-
}());
|
|
811
|
+
}(GarbageCollector));
|
|
812
812
|
if (false) {
|
|
813
|
+
/**
|
|
814
|
+
* Returns the activity that is currently active.
|
|
815
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
816
|
+
* @type {?}
|
|
817
|
+
*/
|
|
818
|
+
InteractionContext.prototype.currentActivity;
|
|
819
|
+
/**
|
|
820
|
+
* Returns the current list of activities that are in progress.
|
|
821
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
822
|
+
* @type {?}
|
|
823
|
+
*/
|
|
824
|
+
InteractionContext.prototype.activityList;
|
|
825
|
+
/**
|
|
826
|
+
* Returns true if an activity is currently running.
|
|
827
|
+
* @abstract
|
|
828
|
+
* @return {?}
|
|
829
|
+
*/
|
|
830
|
+
InteractionContext.prototype.isActive = function () { };
|
|
813
831
|
/**
|
|
814
832
|
* @abstract
|
|
815
833
|
* @template D, R, E
|
|
@@ -861,6 +879,16 @@ if (false) {
|
|
|
861
879
|
* @return {?}
|
|
862
880
|
*/
|
|
863
881
|
Activity.prototype.initialise = function (activityContext) { };
|
|
882
|
+
/**
|
|
883
|
+
* @param {?} result
|
|
884
|
+
* @return {?}
|
|
885
|
+
*/
|
|
886
|
+
Activity.prototype.done = function (result) { };
|
|
887
|
+
/**
|
|
888
|
+
* @param {?} e
|
|
889
|
+
* @return {?}
|
|
890
|
+
*/
|
|
891
|
+
Activity.prototype.cancel = function (e) { };
|
|
864
892
|
}
|
|
865
893
|
|
|
866
894
|
/**
|
|
@@ -927,6 +955,16 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
927
955
|
this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
|
|
928
956
|
this.activityComponentRef.instance.initialise(activityContext);
|
|
929
957
|
};
|
|
958
|
+
Object.defineProperty(ActivityOutletComponent.prototype, "component", {
|
|
959
|
+
get: /**
|
|
960
|
+
* @return {?}
|
|
961
|
+
*/
|
|
962
|
+
function () {
|
|
963
|
+
return this.activityComponentRef.instance;
|
|
964
|
+
},
|
|
965
|
+
enumerable: true,
|
|
966
|
+
configurable: true
|
|
967
|
+
});
|
|
930
968
|
/**
|
|
931
969
|
* @param {?} alert
|
|
932
970
|
* @return {?}
|
|
@@ -1036,82 +1074,6 @@ if (false) {
|
|
|
1036
1074
|
ActivityOutletComponent.prototype.injector;
|
|
1037
1075
|
/* Skipping unhandled member: ;*/
|
|
1038
1076
|
}
|
|
1039
|
-
(function (ActivityOutletComponent) {
|
|
1040
|
-
/**
|
|
1041
|
-
* @template D, R, E
|
|
1042
|
-
*/
|
|
1043
|
-
var /**
|
|
1044
|
-
* @template D, R, E
|
|
1045
|
-
*/
|
|
1046
|
-
OutletInteractionContext = /** @class */ (function () {
|
|
1047
|
-
function OutletInteractionContext(context) {
|
|
1048
|
-
this.context = context;
|
|
1049
|
-
}
|
|
1050
|
-
/**
|
|
1051
|
-
* @param {?} alert
|
|
1052
|
-
* @return {?}
|
|
1053
|
-
*/
|
|
1054
|
-
OutletInteractionContext.prototype.alert = /**
|
|
1055
|
-
* @param {?} alert
|
|
1056
|
-
* @return {?}
|
|
1057
|
-
*/
|
|
1058
|
-
function (alert) {
|
|
1059
|
-
return lang.notImplemented();
|
|
1060
|
-
};
|
|
1061
|
-
/**
|
|
1062
|
-
* @param {?} confirm
|
|
1063
|
-
* @return {?}
|
|
1064
|
-
*/
|
|
1065
|
-
OutletInteractionContext.prototype.confirm = /**
|
|
1066
|
-
* @param {?} confirm
|
|
1067
|
-
* @return {?}
|
|
1068
|
-
*/
|
|
1069
|
-
function (confirm) {
|
|
1070
|
-
return lang.notImplemented();
|
|
1071
|
-
};
|
|
1072
|
-
/**
|
|
1073
|
-
* @template D1, R1, E1
|
|
1074
|
-
* @param {?} confirm
|
|
1075
|
-
* @param {?} activityType
|
|
1076
|
-
* @param {?=} data
|
|
1077
|
-
* @return {?}
|
|
1078
|
-
*/
|
|
1079
|
-
OutletInteractionContext.prototype.confirmThen = /**
|
|
1080
|
-
* @template D1, R1, E1
|
|
1081
|
-
* @param {?} confirm
|
|
1082
|
-
* @param {?} activityType
|
|
1083
|
-
* @param {?=} data
|
|
1084
|
-
* @return {?}
|
|
1085
|
-
*/
|
|
1086
|
-
function (confirm, activityType, data) {
|
|
1087
|
-
return lang.notImplemented();
|
|
1088
|
-
};
|
|
1089
|
-
/**
|
|
1090
|
-
* @template D1, R1, E1
|
|
1091
|
-
* @param {?} activityType
|
|
1092
|
-
* @param {?=} data
|
|
1093
|
-
* @return {?}
|
|
1094
|
-
*/
|
|
1095
|
-
OutletInteractionContext.prototype.startActivity = /**
|
|
1096
|
-
* @template D1, R1, E1
|
|
1097
|
-
* @param {?} activityType
|
|
1098
|
-
* @param {?=} data
|
|
1099
|
-
* @return {?}
|
|
1100
|
-
*/
|
|
1101
|
-
function (activityType, data) {
|
|
1102
|
-
return lang.notImplemented();
|
|
1103
|
-
};
|
|
1104
|
-
return OutletInteractionContext;
|
|
1105
|
-
}());
|
|
1106
|
-
ActivityOutletComponent.OutletInteractionContext = OutletInteractionContext;
|
|
1107
|
-
if (false) {
|
|
1108
|
-
/**
|
|
1109
|
-
* @type {?}
|
|
1110
|
-
* @private
|
|
1111
|
-
*/
|
|
1112
|
-
OutletInteractionContext.prototype.context;
|
|
1113
|
-
}
|
|
1114
|
-
})(ActivityOutletComponent || (ActivityOutletComponent = {}));
|
|
1115
1077
|
|
|
1116
1078
|
/**
|
|
1117
1079
|
* @fileoverview added by tsickle
|
|
@@ -1416,8 +1378,28 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1416
1378
|
_this.activityOutletTabs = new MutableListModel();
|
|
1417
1379
|
_this.obsoleteTabs = [];
|
|
1418
1380
|
_this.finished = false;
|
|
1381
|
+
_this._activityList = new MutableListModel();
|
|
1419
1382
|
return _this;
|
|
1420
1383
|
}
|
|
1384
|
+
/**
|
|
1385
|
+
* @return {?}
|
|
1386
|
+
*/
|
|
1387
|
+
ActivityContainerComponent.prototype.isActive = /**
|
|
1388
|
+
* @return {?}
|
|
1389
|
+
*/
|
|
1390
|
+
function () {
|
|
1391
|
+
return this.parentInteractionContext.isActive();
|
|
1392
|
+
};
|
|
1393
|
+
Object.defineProperty(ActivityContainerComponent.prototype, "activityList", {
|
|
1394
|
+
get: /**
|
|
1395
|
+
* @return {?}
|
|
1396
|
+
*/
|
|
1397
|
+
function () {
|
|
1398
|
+
return this._activityList.readonly;
|
|
1399
|
+
},
|
|
1400
|
+
enumerable: true,
|
|
1401
|
+
configurable: true
|
|
1402
|
+
});
|
|
1421
1403
|
/**
|
|
1422
1404
|
* @return {?}
|
|
1423
1405
|
*/
|
|
@@ -1435,11 +1417,50 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1435
1417
|
function () {
|
|
1436
1418
|
var _this = this;
|
|
1437
1419
|
var observe = Dsl.disposeWith(this).observe;
|
|
1420
|
+
this._activityList.value = this.outlets.toArray().map((/**
|
|
1421
|
+
* @param {?} c
|
|
1422
|
+
* @return {?}
|
|
1423
|
+
*/
|
|
1424
|
+
function (c) { return c.component; }));
|
|
1425
|
+
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1426
|
+
* @param {?} change
|
|
1427
|
+
* @return {?}
|
|
1428
|
+
*/
|
|
1429
|
+
function (change) {
|
|
1430
|
+
_this.safelyUpdateActivityList(change.map((/**
|
|
1431
|
+
* @param {?} c
|
|
1432
|
+
* @return {?}
|
|
1433
|
+
*/
|
|
1434
|
+
function (c) { return c.component; })));
|
|
1435
|
+
}));
|
|
1438
1436
|
observe.valuesFrom(this.tabs.animationDone).subscribe((/**
|
|
1439
1437
|
* @return {?}
|
|
1440
1438
|
*/
|
|
1441
1439
|
function () { return _this.onAnimationFinished(); }));
|
|
1442
1440
|
};
|
|
1441
|
+
/**
|
|
1442
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1443
|
+
* @param activities
|
|
1444
|
+
*/
|
|
1445
|
+
/**
|
|
1446
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1447
|
+
* @private
|
|
1448
|
+
* @param {?} activities
|
|
1449
|
+
* @return {?}
|
|
1450
|
+
*/
|
|
1451
|
+
ActivityContainerComponent.prototype.safelyUpdateActivityList = /**
|
|
1452
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1453
|
+
* @private
|
|
1454
|
+
* @param {?} activities
|
|
1455
|
+
* @return {?}
|
|
1456
|
+
*/
|
|
1457
|
+
function (activities) {
|
|
1458
|
+
var _this = this;
|
|
1459
|
+
setTimeout((/**
|
|
1460
|
+
* @return {?}
|
|
1461
|
+
*/
|
|
1462
|
+
function () { return _this._activityList.value = activities; }));
|
|
1463
|
+
};
|
|
1443
1464
|
/**
|
|
1444
1465
|
* @template D, R, E
|
|
1445
1466
|
* @param {?} initialContext
|
|
@@ -1634,6 +1655,8 @@ if (false) {
|
|
|
1634
1655
|
/** @type {?} */
|
|
1635
1656
|
ActivityContainerComponent.prototype.initialActivityOutletContext;
|
|
1636
1657
|
/** @type {?} */
|
|
1658
|
+
ActivityContainerComponent.prototype.currentActivity;
|
|
1659
|
+
/** @type {?} */
|
|
1637
1660
|
ActivityContainerComponent.prototype.tabs;
|
|
1638
1661
|
/** @type {?} */
|
|
1639
1662
|
ActivityContainerComponent.prototype.outlets;
|
|
@@ -1649,6 +1672,11 @@ if (false) {
|
|
|
1649
1672
|
* @private
|
|
1650
1673
|
*/
|
|
1651
1674
|
ActivityContainerComponent.prototype.finished;
|
|
1675
|
+
/**
|
|
1676
|
+
* @type {?}
|
|
1677
|
+
* @private
|
|
1678
|
+
*/
|
|
1679
|
+
ActivityContainerComponent.prototype._activityList;
|
|
1652
1680
|
}
|
|
1653
1681
|
(function (ActivityContainerComponent) {
|
|
1654
1682
|
/**
|
|
@@ -1677,14 +1705,47 @@ if (false) {
|
|
|
1677
1705
|
var DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
|
|
1678
1706
|
var DialogInteractionService = /** @class */ (function (_super) {
|
|
1679
1707
|
__extends(DialogInteractionService, _super);
|
|
1680
|
-
function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1708
|
+
function DialogInteractionService(dialogService, router, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1681
1709
|
var _this = _super.call(this) || this;
|
|
1682
1710
|
_this.dialogService = dialogService;
|
|
1711
|
+
_this.router = router;
|
|
1683
1712
|
_this.dialogServiceDefaults = dialogServiceDefaults;
|
|
1684
1713
|
_this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
1714
|
+
_this._activityList = new DelegatingListModel();
|
|
1715
|
+
_this._active = false;
|
|
1685
1716
|
assert$1.notNil(dialogService);
|
|
1717
|
+
var _a = Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
|
|
1718
|
+
_this.currentActivity = chain(_this.activityList).last();
|
|
1686
1719
|
return _this;
|
|
1687
1720
|
}
|
|
1721
|
+
/**
|
|
1722
|
+
* @return {?}
|
|
1723
|
+
*/
|
|
1724
|
+
DialogInteractionService.prototype.isActive = /**
|
|
1725
|
+
* @return {?}
|
|
1726
|
+
*/
|
|
1727
|
+
function () {
|
|
1728
|
+
return this._active;
|
|
1729
|
+
};
|
|
1730
|
+
/**
|
|
1731
|
+
* @return {?}
|
|
1732
|
+
*/
|
|
1733
|
+
DialogInteractionService.prototype.cancelActivity = /**
|
|
1734
|
+
* @return {?}
|
|
1735
|
+
*/
|
|
1736
|
+
function () {
|
|
1737
|
+
this.currentActivity.value.cancel(null);
|
|
1738
|
+
};
|
|
1739
|
+
Object.defineProperty(DialogInteractionService.prototype, "activityList", {
|
|
1740
|
+
get: /**
|
|
1741
|
+
* @return {?}
|
|
1742
|
+
*/
|
|
1743
|
+
function () {
|
|
1744
|
+
return this._activityList.readonly;
|
|
1745
|
+
},
|
|
1746
|
+
enumerable: true,
|
|
1747
|
+
configurable: true
|
|
1748
|
+
});
|
|
1688
1749
|
/**
|
|
1689
1750
|
* @template D, R, E
|
|
1690
1751
|
* @param {?} activityType
|
|
@@ -1719,8 +1780,18 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1719
1780
|
function (activityType, data, disableClose) {
|
|
1720
1781
|
var _this = this;
|
|
1721
1782
|
if (disableClose === void 0) { disableClose = true; }
|
|
1783
|
+
if (this.isActive()) {
|
|
1784
|
+
lang.illegalState("Activity already in progress: " + this.activityList.value.map((/**
|
|
1785
|
+
* @param {?} a
|
|
1786
|
+
* @return {?}
|
|
1787
|
+
*/
|
|
1788
|
+
function (a) { return a.constructor.name; })).join(', '));
|
|
1789
|
+
}
|
|
1790
|
+
this._active = true;
|
|
1791
|
+
/** @type {?} */
|
|
1792
|
+
var self = this;
|
|
1722
1793
|
/** @type {?} */
|
|
1723
|
-
var config = __assign({ autoFocus: false, hasBackdrop: true }, this.matDialogDefaultConfig, this.dialogServiceDefaults, {
|
|
1794
|
+
var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults, {
|
|
1724
1795
|
data: data,
|
|
1725
1796
|
disableClose: disableClose,
|
|
1726
1797
|
panelClass: 'dialog-interaction-service'
|
|
@@ -1736,6 +1807,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1736
1807
|
/** @type {?} */
|
|
1737
1808
|
var activityContainer = matDialogRef.componentInstance;
|
|
1738
1809
|
activityContainer.parentInteractionContext = _this;
|
|
1810
|
+
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
1739
1811
|
activityContainer.initialise({
|
|
1740
1812
|
activityClass: activityType,
|
|
1741
1813
|
activityData: data,
|
|
@@ -1759,8 +1831,35 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1759
1831
|
}
|
|
1760
1832
|
});
|
|
1761
1833
|
matDialogRef.updateSize();
|
|
1834
|
+
})).finally((/**
|
|
1835
|
+
* @return {?}
|
|
1836
|
+
*/
|
|
1837
|
+
function () {
|
|
1838
|
+
self.safelyUpdateActivityListDelegate(null);
|
|
1839
|
+
self._active = false;
|
|
1762
1840
|
}));
|
|
1763
1841
|
};
|
|
1842
|
+
/**
|
|
1843
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
1844
|
+
* @param delegate
|
|
1845
|
+
*/
|
|
1846
|
+
/**
|
|
1847
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
1848
|
+
* @param {?} delegate
|
|
1849
|
+
* @return {?}
|
|
1850
|
+
*/
|
|
1851
|
+
DialogInteractionService.prototype.safelyUpdateActivityListDelegate = /**
|
|
1852
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
1853
|
+
* @param {?} delegate
|
|
1854
|
+
* @return {?}
|
|
1855
|
+
*/
|
|
1856
|
+
function (delegate) {
|
|
1857
|
+
var _this = this;
|
|
1858
|
+
setTimeout((/**
|
|
1859
|
+
* @return {?}
|
|
1860
|
+
*/
|
|
1861
|
+
function () { return _this._activityList.setDelegate(delegate); }));
|
|
1862
|
+
};
|
|
1764
1863
|
/**
|
|
1765
1864
|
* @param {?} alert
|
|
1766
1865
|
* @return {?}
|
|
@@ -1812,18 +1911,36 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1812
1911
|
/** @nocollapse */
|
|
1813
1912
|
DialogInteractionService.ctorParameters = function () { return [
|
|
1814
1913
|
{ type: MatDialog },
|
|
1914
|
+
{ type: Router },
|
|
1815
1915
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
1816
1916
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
1817
1917
|
]; };
|
|
1818
|
-
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
1918
|
+
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(Router), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
1819
1919
|
return DialogInteractionService;
|
|
1820
1920
|
}(InteractionContext));
|
|
1821
1921
|
if (false) {
|
|
1922
|
+
/** @type {?} */
|
|
1923
|
+
DialogInteractionService.prototype.currentActivity;
|
|
1924
|
+
/**
|
|
1925
|
+
* @type {?}
|
|
1926
|
+
* @private
|
|
1927
|
+
*/
|
|
1928
|
+
DialogInteractionService.prototype._activityList;
|
|
1929
|
+
/**
|
|
1930
|
+
* @type {?}
|
|
1931
|
+
* @private
|
|
1932
|
+
*/
|
|
1933
|
+
DialogInteractionService.prototype._active;
|
|
1822
1934
|
/**
|
|
1823
1935
|
* @type {?}
|
|
1824
1936
|
* @private
|
|
1825
1937
|
*/
|
|
1826
1938
|
DialogInteractionService.prototype.dialogService;
|
|
1939
|
+
/**
|
|
1940
|
+
* @type {?}
|
|
1941
|
+
* @private
|
|
1942
|
+
*/
|
|
1943
|
+
DialogInteractionService.prototype.router;
|
|
1827
1944
|
/** @type {?} */
|
|
1828
1945
|
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
1829
1946
|
/** @type {?} */
|
|
@@ -4304,6 +4421,65 @@ if (false) {
|
|
|
4304
4421
|
ActivityOutletContext.prototype.onCancel;
|
|
4305
4422
|
}
|
|
4306
4423
|
|
|
4424
|
+
/**
|
|
4425
|
+
* @fileoverview added by tsickle
|
|
4426
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4427
|
+
*/
|
|
4428
|
+
var CloseInteractionGuard = /** @class */ (function () {
|
|
4429
|
+
function CloseInteractionGuard(router, injector, interactionContext) {
|
|
4430
|
+
this.router = router;
|
|
4431
|
+
this.injector = injector;
|
|
4432
|
+
this.interactionContext = interactionContext;
|
|
4433
|
+
}
|
|
4434
|
+
/**
|
|
4435
|
+
* @param {?} component
|
|
4436
|
+
* @param {?} currentRoute
|
|
4437
|
+
* @param {?} currentState
|
|
4438
|
+
* @param {?=} nextState
|
|
4439
|
+
* @return {?}
|
|
4440
|
+
*/
|
|
4441
|
+
CloseInteractionGuard.prototype.canDeactivate = /**
|
|
4442
|
+
* @param {?} component
|
|
4443
|
+
* @param {?} currentRoute
|
|
4444
|
+
* @param {?} currentState
|
|
4445
|
+
* @param {?=} nextState
|
|
4446
|
+
* @return {?}
|
|
4447
|
+
*/
|
|
4448
|
+
function (component, currentRoute, currentState, nextState) {
|
|
4449
|
+
return !this.interactionContext.isActive();
|
|
4450
|
+
};
|
|
4451
|
+
CloseInteractionGuard.decorators = [
|
|
4452
|
+
{ type: Injectable, args: [{
|
|
4453
|
+
providedIn: 'root'
|
|
4454
|
+
},] }
|
|
4455
|
+
];
|
|
4456
|
+
/** @nocollapse */
|
|
4457
|
+
CloseInteractionGuard.ctorParameters = function () { return [
|
|
4458
|
+
{ type: Router },
|
|
4459
|
+
{ type: Injector },
|
|
4460
|
+
{ type: InteractionContext }
|
|
4461
|
+
]; };
|
|
4462
|
+
/** @nocollapse */ CloseInteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function CloseInteractionGuard_Factory() { return new CloseInteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: CloseInteractionGuard, providedIn: "root" });
|
|
4463
|
+
return CloseInteractionGuard;
|
|
4464
|
+
}());
|
|
4465
|
+
if (false) {
|
|
4466
|
+
/**
|
|
4467
|
+
* @type {?}
|
|
4468
|
+
* @private
|
|
4469
|
+
*/
|
|
4470
|
+
CloseInteractionGuard.prototype.router;
|
|
4471
|
+
/**
|
|
4472
|
+
* @type {?}
|
|
4473
|
+
* @private
|
|
4474
|
+
*/
|
|
4475
|
+
CloseInteractionGuard.prototype.injector;
|
|
4476
|
+
/**
|
|
4477
|
+
* @type {?}
|
|
4478
|
+
* @private
|
|
4479
|
+
*/
|
|
4480
|
+
CloseInteractionGuard.prototype.interactionContext;
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4307
4483
|
/**
|
|
4308
4484
|
* @fileoverview added by tsickle
|
|
4309
4485
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4405,9 +4581,33 @@ if (false) {
|
|
|
4405
4581
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4406
4582
|
*/
|
|
4407
4583
|
var LeavePlaceGuard = /** @class */ (function () {
|
|
4408
|
-
function LeavePlaceGuard(router, injector) {
|
|
4584
|
+
function LeavePlaceGuard(router, injector, interactionContext, location) {
|
|
4409
4585
|
this.router = router;
|
|
4410
4586
|
this.injector = injector;
|
|
4587
|
+
this.interactionContext = interactionContext;
|
|
4588
|
+
this.location = location;
|
|
4589
|
+
// TODO: should probably replace this with a RouteTracker thingy.
|
|
4590
|
+
this._alreadyAccepted = [];
|
|
4591
|
+
console.log('***** Created new guard ******');
|
|
4592
|
+
/** @type {?} */
|
|
4593
|
+
var self = this;
|
|
4594
|
+
this.router.events.subscribe((/**
|
|
4595
|
+
* @param {?} event
|
|
4596
|
+
* @return {?}
|
|
4597
|
+
*/
|
|
4598
|
+
function (event) {
|
|
4599
|
+
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
4600
|
+
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
4601
|
+
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
4602
|
+
if (event instanceof NavigationEnd) {
|
|
4603
|
+
console.log('navigation ended');
|
|
4604
|
+
self._alreadyAccepted = [];
|
|
4605
|
+
}
|
|
4606
|
+
if (event instanceof NavigationError) {
|
|
4607
|
+
console.log('navigation errored');
|
|
4608
|
+
self._alreadyAccepted = [];
|
|
4609
|
+
}
|
|
4610
|
+
}));
|
|
4411
4611
|
}
|
|
4412
4612
|
/**
|
|
4413
4613
|
* @param {?} component
|
|
@@ -4424,27 +4624,106 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4424
4624
|
* @return {?}
|
|
4425
4625
|
*/
|
|
4426
4626
|
function (component, currentRoute, currentState, nextState) {
|
|
4427
|
-
|
|
4627
|
+
var _this = this;
|
|
4428
4628
|
/** @type {?} */
|
|
4429
|
-
var
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
//
|
|
4437
|
-
//
|
|
4438
|
-
//
|
|
4439
|
-
//
|
|
4440
|
-
//
|
|
4441
|
-
|
|
4442
|
-
|
|
4629
|
+
var placeDefinitionPath = "/" + component.placeDefinition.path;
|
|
4630
|
+
console.log('canDeactivate', {
|
|
4631
|
+
staticPath: placeDefinitionPath,
|
|
4632
|
+
currentStateUrl: currentState.url,
|
|
4633
|
+
nextStateUrl: nextState.url,
|
|
4634
|
+
alreadyDeclined: this._alreadyAccepted
|
|
4635
|
+
});
|
|
4636
|
+
// Example of the above when navigating to a different child route.
|
|
4637
|
+
// canDeactivate {staticPath: "/hero-details",
|
|
4638
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
4639
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
4640
|
+
// }
|
|
4641
|
+
// Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
|
|
4642
|
+
// canDeactivate {
|
|
4643
|
+
// staticPath: "/hero-stats",
|
|
4644
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4645
|
+
// nextStateUrl: "/route-parameters/"
|
|
4646
|
+
// }
|
|
4647
|
+
// canDeactivate {
|
|
4648
|
+
// staticPath: "/route-parameters",
|
|
4649
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4650
|
+
// nextStateUrl: "/route-parameters/"
|
|
4651
|
+
// }
|
|
4652
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
4653
|
+
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
4654
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4655
|
+
// canDeactivate {
|
|
4656
|
+
// staticPath: "/hero-stats",
|
|
4657
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4658
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
4659
|
+
// }
|
|
4660
|
+
// canDeactivate {
|
|
4661
|
+
// staticPath: "/route-parameters",
|
|
4662
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4663
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
4664
|
+
// }
|
|
4665
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
4666
|
+
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
4667
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4668
|
+
// canDeactivate {
|
|
4669
|
+
// staticPath: "/hero-stats",
|
|
4670
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4671
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4672
|
+
// }
|
|
4673
|
+
// HACK: this will break with child routes...
|
|
4674
|
+
if (this.alreadyAccepted(component)) {
|
|
4675
|
+
return true;
|
|
4443
4676
|
}
|
|
4444
4677
|
else {
|
|
4678
|
+
if (!nextState.url.startsWith(placeDefinitionPath)) {
|
|
4679
|
+
/** @type {?} */
|
|
4680
|
+
var self_1 = this;
|
|
4681
|
+
return Promise.resolve(component.canDeactivate())
|
|
4682
|
+
.then((/**
|
|
4683
|
+
* @param {?} canLeave
|
|
4684
|
+
* @return {?}
|
|
4685
|
+
*/
|
|
4686
|
+
function (canLeave) {
|
|
4687
|
+
if (!canLeave) {
|
|
4688
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4689
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4690
|
+
_this.location.go(currentState.url);
|
|
4691
|
+
return false;
|
|
4692
|
+
}
|
|
4693
|
+
else {
|
|
4694
|
+
if (_this.interactionContext.isActive()) {
|
|
4695
|
+
_this.interactionContext.currentActivity.value.cancel(null);
|
|
4696
|
+
return false;
|
|
4697
|
+
}
|
|
4698
|
+
else {
|
|
4699
|
+
return true;
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
})).then((/**
|
|
4703
|
+
* @param {?} canDeactivate
|
|
4704
|
+
* @return {?}
|
|
4705
|
+
*/
|
|
4706
|
+
function (canDeactivate) {
|
|
4707
|
+
if (canDeactivate) {
|
|
4708
|
+
self_1._alreadyAccepted.push(component);
|
|
4709
|
+
}
|
|
4710
|
+
return canDeactivate;
|
|
4711
|
+
}));
|
|
4712
|
+
}
|
|
4445
4713
|
return true;
|
|
4446
4714
|
}
|
|
4447
4715
|
};
|
|
4716
|
+
/**
|
|
4717
|
+
* @param {?} placeComponent
|
|
4718
|
+
* @return {?}
|
|
4719
|
+
*/
|
|
4720
|
+
LeavePlaceGuard.prototype.alreadyAccepted = /**
|
|
4721
|
+
* @param {?} placeComponent
|
|
4722
|
+
* @return {?}
|
|
4723
|
+
*/
|
|
4724
|
+
function (placeComponent) {
|
|
4725
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
4726
|
+
};
|
|
4448
4727
|
LeavePlaceGuard.decorators = [
|
|
4449
4728
|
{ type: Injectable, args: [{
|
|
4450
4729
|
providedIn: 'root'
|
|
@@ -4453,12 +4732,25 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4453
4732
|
/** @nocollapse */
|
|
4454
4733
|
LeavePlaceGuard.ctorParameters = function () { return [
|
|
4455
4734
|
{ type: Router },
|
|
4456
|
-
{ type: Injector }
|
|
4735
|
+
{ type: Injector },
|
|
4736
|
+
{ type: InteractionContext },
|
|
4737
|
+
{ type: Location }
|
|
4457
4738
|
]; };
|
|
4458
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4739
|
+
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4740
|
+
__decorate([
|
|
4741
|
+
Trace(),
|
|
4742
|
+
__metadata("design:type", Function),
|
|
4743
|
+
__metadata("design:paramtypes", [PlaceComponent]),
|
|
4744
|
+
__metadata("design:returntype", Boolean)
|
|
4745
|
+
], LeavePlaceGuard.prototype, "alreadyAccepted", null);
|
|
4459
4746
|
return LeavePlaceGuard;
|
|
4460
4747
|
}());
|
|
4461
4748
|
if (false) {
|
|
4749
|
+
/**
|
|
4750
|
+
* @type {?}
|
|
4751
|
+
* @private
|
|
4752
|
+
*/
|
|
4753
|
+
LeavePlaceGuard.prototype._alreadyAccepted;
|
|
4462
4754
|
/**
|
|
4463
4755
|
* @type {?}
|
|
4464
4756
|
* @private
|
|
@@ -4469,6 +4761,10 @@ if (false) {
|
|
|
4469
4761
|
* @private
|
|
4470
4762
|
*/
|
|
4471
4763
|
LeavePlaceGuard.prototype.injector;
|
|
4764
|
+
/** @type {?} */
|
|
4765
|
+
LeavePlaceGuard.prototype.interactionContext;
|
|
4766
|
+
/** @type {?} */
|
|
4767
|
+
LeavePlaceGuard.prototype.location;
|
|
4472
4768
|
}
|
|
4473
4769
|
|
|
4474
4770
|
/**
|
|
@@ -4777,5 +5073,5 @@ var ParameterType;
|
|
|
4777
5073
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4778
5074
|
*/
|
|
4779
5075
|
|
|
4780
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective,
|
|
5076
|
+
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CloseInteractionGuard, CommandDirective, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NumberInputComponent, ParameterDefinition, ParameterSnapshot, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, RouteParameter, RouteParameterList, RouteParameterValue, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, ConfirmThenDialogComponent as ɵba, InteractionContext as ɵbb, AlertDialogComponent as ɵbc, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbe, DialogInteractionService as ɵbf, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, PlaceModule as ɵi, EmptyStateComponent as ɵj, BusyOverlayComponent as ɵk, PlaceOutletComponent as ɵl, leftRightPlaceAnimation as ɵm, LEFT_RIGHT_PLACE_ANIMATION as ɵn, PlaceRouter as ɵo, PlaceHistory as ɵp, TabbedPlaceNavigationComponent as ɵq, AbstractPlaceNavigationComponent as ɵr, ListPlaceNavComponent as ɵs, InteractionModule as ɵt, ActivityContainerComponent as ɵu, ActivityOutletComponent as ɵv, ConfirmationDialogComponent as ɵw, AbstractActivity as ɵx, ACTIVITY_DATA as ɵy };
|
|
4781
5077
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|