@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@coolon/pectin'), require('@angular/cdk/portal'), require('@coolon/typescript-utilities'), require('@angular/material/dialog'), require('@angular/
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material', '@angular/material/tabs', '@angular/platform-browser/animations', '@coolon/pectin', '@angular/cdk/portal', '@coolon/typescript-utilities', '@angular/material/dialog', '@angular/
|
|
4
|
-
(global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material, global.ng.material.tabs, global.ng.platformBrowser.animations, global.pectin, global.ng.cdk.portal, global.typescriptUtilities, global.ng.material.dialog, global.ng.
|
|
5
|
-
}(this, function (exports, common, core, forms, material, tabs, animations, pectin, portal, typescriptUtilities, dialog, icon, list, tooltip,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@coolon/pectin'), require('@angular/cdk/portal'), require('@coolon/typescript-utilities'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('lodash'), require('@angular/animations'), require('resize-observer-polyfill')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material', '@angular/material/tabs', '@angular/platform-browser/animations', '@coolon/pectin', '@angular/cdk/portal', '@coolon/typescript-utilities', '@angular/material/dialog', '@angular/router', '@angular/material/icon', '@angular/material/list', '@angular/material/tooltip', '@typescript-plus/fast-memoize-decorator/dist/src', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', 'lodash', '@angular/animations', 'resize-observer-polyfill'], factory) :
|
|
4
|
+
(global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material, global.ng.material.tabs, global.ng.platformBrowser.animations, global.pectin, global.ng.cdk.portal, global.typescriptUtilities, global.ng.material.dialog, global.ng.router, global.ng.material.icon, global.ng.material.list, global.ng.material.tooltip, global.src, global.fastMemoizeDecorator, null, global.___default, global.ng.animations, global.ResizeObserver));
|
|
5
|
+
}(this, function (exports, common, core, forms, material, tabs, animations, pectin, portal, typescriptUtilities, dialog, router, icon, list, tooltip, src, fastMemoizeDecorator, reflectMetadata, ___default, animations$1, ResizeObserver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var ___default__default = 'default' in ___default ? ___default['default'] : ___default;
|
|
8
8
|
ResizeObserver = ResizeObserver && ResizeObserver.hasOwnProperty('default') ? ResizeObserver['default'] : ResizeObserver;
|
|
@@ -980,20 +980,46 @@
|
|
|
980
980
|
* @fileoverview added by tsickle
|
|
981
981
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
982
982
|
*/
|
|
983
|
-
/** @type {?} */
|
|
984
|
-
var INTERACTION_CONTEXT = new core.InjectionToken('InteractionContext');
|
|
985
983
|
/**
|
|
986
984
|
* @abstract
|
|
987
985
|
*/
|
|
988
986
|
var /**
|
|
989
987
|
* @abstract
|
|
990
988
|
*/
|
|
991
|
-
InteractionContext = /** @class */ (function () {
|
|
989
|
+
InteractionContext = /** @class */ (function (_super) {
|
|
990
|
+
__extends(InteractionContext, _super);
|
|
992
991
|
function InteractionContext() {
|
|
992
|
+
return _super.call(this) || this;
|
|
993
993
|
}
|
|
994
|
+
/**
|
|
995
|
+
* Returns true if an activity is currently running.
|
|
996
|
+
*/
|
|
997
|
+
/**
|
|
998
|
+
* Returns true if an activity is currently running.
|
|
999
|
+
* @return {?}
|
|
1000
|
+
*/
|
|
1001
|
+
InteractionContext.prototype.isActive = /**
|
|
1002
|
+
* Returns true if an activity is currently running.
|
|
1003
|
+
* @return {?}
|
|
1004
|
+
*/
|
|
1005
|
+
function () {
|
|
1006
|
+
return this.activityList.length > 0;
|
|
1007
|
+
};
|
|
994
1008
|
return InteractionContext;
|
|
995
|
-
}());
|
|
1009
|
+
}(pectin.GarbageCollector));
|
|
996
1010
|
if (false) {
|
|
1011
|
+
/**
|
|
1012
|
+
* Returns the activity that is currently active.
|
|
1013
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
1014
|
+
* @type {?}
|
|
1015
|
+
*/
|
|
1016
|
+
InteractionContext.prototype.currentActivity;
|
|
1017
|
+
/**
|
|
1018
|
+
* Returns the current list of activities that are in progress.
|
|
1019
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
1020
|
+
* @type {?}
|
|
1021
|
+
*/
|
|
1022
|
+
InteractionContext.prototype.activityList;
|
|
997
1023
|
/**
|
|
998
1024
|
* @abstract
|
|
999
1025
|
* @template D, R, E
|
|
@@ -1008,6 +1034,16 @@
|
|
|
1008
1034
|
* @return {?}
|
|
1009
1035
|
*/
|
|
1010
1036
|
InteractionContext.prototype.confirm = function (confirm) { };
|
|
1037
|
+
/**
|
|
1038
|
+
* Presents the confirmation to the user and runs the activity only if the user confirms.
|
|
1039
|
+
* @abstract
|
|
1040
|
+
* @template D, R, E
|
|
1041
|
+
* @param {?} confirm
|
|
1042
|
+
* @param {?} activityType the activity to run if confirmed.
|
|
1043
|
+
* @param {?=} data the activity data.
|
|
1044
|
+
* @return {?}
|
|
1045
|
+
*/
|
|
1046
|
+
InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
|
|
1011
1047
|
/**
|
|
1012
1048
|
* @abstract
|
|
1013
1049
|
* @param {?} alert
|
|
@@ -1035,6 +1071,16 @@
|
|
|
1035
1071
|
* @return {?}
|
|
1036
1072
|
*/
|
|
1037
1073
|
Activity.prototype.initialise = function (activityContext) { };
|
|
1074
|
+
/**
|
|
1075
|
+
* @param {?} result
|
|
1076
|
+
* @return {?}
|
|
1077
|
+
*/
|
|
1078
|
+
Activity.prototype.done = function (result) { };
|
|
1079
|
+
/**
|
|
1080
|
+
* @param {?} e
|
|
1081
|
+
* @return {?}
|
|
1082
|
+
*/
|
|
1083
|
+
Activity.prototype.cancel = function (e) { };
|
|
1038
1084
|
}
|
|
1039
1085
|
|
|
1040
1086
|
/**
|
|
@@ -1049,7 +1095,7 @@
|
|
|
1049
1095
|
* <activity-view [activityClass]="...", [activityData]="..." (done)=".." (cancel)="..."></activity-view>
|
|
1050
1096
|
* @template D, R, E
|
|
1051
1097
|
*/
|
|
1052
|
-
|
|
1098
|
+
var ActivityOutletComponent = /** @class */ (function () {
|
|
1053
1099
|
function ActivityOutletComponent(componentFactoryResolver, viewContainerRef, injector) {
|
|
1054
1100
|
this.componentFactoryResolver = componentFactoryResolver;
|
|
1055
1101
|
this.viewContainerRef = viewContainerRef;
|
|
@@ -1101,6 +1147,16 @@
|
|
|
1101
1147
|
this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
|
|
1102
1148
|
this.activityComponentRef.instance.initialise(activityContext);
|
|
1103
1149
|
};
|
|
1150
|
+
Object.defineProperty(ActivityOutletComponent.prototype, "component", {
|
|
1151
|
+
get: /**
|
|
1152
|
+
* @return {?}
|
|
1153
|
+
*/
|
|
1154
|
+
function () {
|
|
1155
|
+
return this.activityComponentRef.instance;
|
|
1156
|
+
},
|
|
1157
|
+
enumerable: true,
|
|
1158
|
+
configurable: true
|
|
1159
|
+
});
|
|
1104
1160
|
/**
|
|
1105
1161
|
* @param {?} alert
|
|
1106
1162
|
* @return {?}
|
|
@@ -1123,6 +1179,23 @@
|
|
|
1123
1179
|
function (confirm) {
|
|
1124
1180
|
return this.interactionContext.confirm(confirm);
|
|
1125
1181
|
};
|
|
1182
|
+
/**
|
|
1183
|
+
* @template D1, R1, E1
|
|
1184
|
+
* @param {?} confirm
|
|
1185
|
+
* @param {?} activityType
|
|
1186
|
+
* @param {?=} data
|
|
1187
|
+
* @return {?}
|
|
1188
|
+
*/
|
|
1189
|
+
ActivityOutletComponent.prototype.confirmThen = /**
|
|
1190
|
+
* @template D1, R1, E1
|
|
1191
|
+
* @param {?} confirm
|
|
1192
|
+
* @param {?} activityType
|
|
1193
|
+
* @param {?=} data
|
|
1194
|
+
* @return {?}
|
|
1195
|
+
*/
|
|
1196
|
+
function (confirm, activityType, data) {
|
|
1197
|
+
return this.interactionContext.confirmThen(confirm, activityType, data);
|
|
1198
|
+
};
|
|
1126
1199
|
/**
|
|
1127
1200
|
* @template D1, R1, E1
|
|
1128
1201
|
* @param {?} activityType
|
|
@@ -1166,98 +1239,33 @@
|
|
|
1166
1239
|
interactionContext: [{ type: core.Input }],
|
|
1167
1240
|
activityContext: [{ type: core.Input }]
|
|
1168
1241
|
};
|
|
1169
|
-
__decorate([
|
|
1170
|
-
pectin.Trace(),
|
|
1171
|
-
__metadata("design:type", Function),
|
|
1172
|
-
__metadata("design:paramtypes", [Object]),
|
|
1173
|
-
__metadata("design:returntype", void 0)
|
|
1174
|
-
], ActivityOutletComponent.prototype, "loadActivity", null);
|
|
1175
1242
|
return ActivityOutletComponent;
|
|
1176
1243
|
}());
|
|
1177
1244
|
if (false) {
|
|
1178
1245
|
/** @type {?} */
|
|
1179
|
-
|
|
1246
|
+
ActivityOutletComponent.prototype.interactionContext;
|
|
1180
1247
|
/**
|
|
1181
1248
|
* @type {?}
|
|
1182
1249
|
* @private
|
|
1183
1250
|
*/
|
|
1184
|
-
|
|
1251
|
+
ActivityOutletComponent.prototype.activityComponentRef;
|
|
1185
1252
|
/**
|
|
1186
1253
|
* @type {?}
|
|
1187
1254
|
* @private
|
|
1188
1255
|
*/
|
|
1189
|
-
|
|
1256
|
+
ActivityOutletComponent.prototype.componentFactoryResolver;
|
|
1190
1257
|
/**
|
|
1191
1258
|
* @type {?}
|
|
1192
1259
|
* @private
|
|
1193
1260
|
*/
|
|
1194
|
-
|
|
1261
|
+
ActivityOutletComponent.prototype.viewContainerRef;
|
|
1195
1262
|
/**
|
|
1196
1263
|
* @type {?}
|
|
1197
1264
|
* @private
|
|
1198
1265
|
*/
|
|
1199
|
-
|
|
1266
|
+
ActivityOutletComponent.prototype.injector;
|
|
1200
1267
|
/* Skipping unhandled member: ;*/
|
|
1201
1268
|
}
|
|
1202
|
-
(function (ActivityOutletComponent) {
|
|
1203
|
-
/**
|
|
1204
|
-
* @template D, R, E
|
|
1205
|
-
*/
|
|
1206
|
-
var /**
|
|
1207
|
-
* @template D, R, E
|
|
1208
|
-
*/
|
|
1209
|
-
OutletInteractionContext = /** @class */ (function () {
|
|
1210
|
-
function OutletInteractionContext(context) {
|
|
1211
|
-
this.context = context;
|
|
1212
|
-
}
|
|
1213
|
-
/**
|
|
1214
|
-
* @param {?} alert
|
|
1215
|
-
* @return {?}
|
|
1216
|
-
*/
|
|
1217
|
-
OutletInteractionContext.prototype.alert = /**
|
|
1218
|
-
* @param {?} alert
|
|
1219
|
-
* @return {?}
|
|
1220
|
-
*/
|
|
1221
|
-
function (alert) {
|
|
1222
|
-
return pectin.lang.notImplemented();
|
|
1223
|
-
};
|
|
1224
|
-
/**
|
|
1225
|
-
* @param {?} confirm
|
|
1226
|
-
* @return {?}
|
|
1227
|
-
*/
|
|
1228
|
-
OutletInteractionContext.prototype.confirm = /**
|
|
1229
|
-
* @param {?} confirm
|
|
1230
|
-
* @return {?}
|
|
1231
|
-
*/
|
|
1232
|
-
function (confirm) {
|
|
1233
|
-
return pectin.lang.notImplemented();
|
|
1234
|
-
};
|
|
1235
|
-
/**
|
|
1236
|
-
* @template D1, R1, E1
|
|
1237
|
-
* @param {?} activityType
|
|
1238
|
-
* @param {?=} data
|
|
1239
|
-
* @return {?}
|
|
1240
|
-
*/
|
|
1241
|
-
OutletInteractionContext.prototype.startActivity = /**
|
|
1242
|
-
* @template D1, R1, E1
|
|
1243
|
-
* @param {?} activityType
|
|
1244
|
-
* @param {?=} data
|
|
1245
|
-
* @return {?}
|
|
1246
|
-
*/
|
|
1247
|
-
function (activityType, data) {
|
|
1248
|
-
return pectin.lang.notImplemented();
|
|
1249
|
-
};
|
|
1250
|
-
return OutletInteractionContext;
|
|
1251
|
-
}());
|
|
1252
|
-
ActivityOutletComponent.OutletInteractionContext = OutletInteractionContext;
|
|
1253
|
-
if (false) {
|
|
1254
|
-
/**
|
|
1255
|
-
* @type {?}
|
|
1256
|
-
* @private
|
|
1257
|
-
*/
|
|
1258
|
-
OutletInteractionContext.prototype.context;
|
|
1259
|
-
}
|
|
1260
|
-
})(exports.ɵv || (exports.ɵv = {}));
|
|
1261
1269
|
|
|
1262
1270
|
/**
|
|
1263
1271
|
* @fileoverview added by tsickle
|
|
@@ -1266,7 +1274,10 @@
|
|
|
1266
1274
|
/**
|
|
1267
1275
|
* @template D, R, E
|
|
1268
1276
|
*/
|
|
1269
|
-
var
|
|
1277
|
+
var /**
|
|
1278
|
+
* @template D, R, E
|
|
1279
|
+
*/
|
|
1280
|
+
AbstractActivity = /** @class */ (function (_super) {
|
|
1270
1281
|
__extends(AbstractActivity, _super);
|
|
1271
1282
|
function AbstractActivity() {
|
|
1272
1283
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -1349,12 +1360,6 @@
|
|
|
1349
1360
|
function () {
|
|
1350
1361
|
return this._busyModel.value;
|
|
1351
1362
|
};
|
|
1352
|
-
__decorate([
|
|
1353
|
-
pectin.Trace(),
|
|
1354
|
-
__metadata("design:type", Function),
|
|
1355
|
-
__metadata("design:paramtypes", [Object]),
|
|
1356
|
-
__metadata("design:returntype", void 0)
|
|
1357
|
-
], AbstractActivity.prototype, "initialise", null);
|
|
1358
1363
|
return AbstractActivity;
|
|
1359
1364
|
}(DisposableComponent));
|
|
1360
1365
|
if (false) {
|
|
@@ -1407,6 +1412,106 @@
|
|
|
1407
1412
|
AlertDialogComponent.prototype.alert;
|
|
1408
1413
|
}
|
|
1409
1414
|
|
|
1415
|
+
/**
|
|
1416
|
+
* @fileoverview added by tsickle
|
|
1417
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1418
|
+
*/
|
|
1419
|
+
/**
|
|
1420
|
+
* @template D, R, E
|
|
1421
|
+
*/
|
|
1422
|
+
exports.ɵba = /** @class */ (function (_super) {
|
|
1423
|
+
__extends(ConfirmThenDialogComponent, _super);
|
|
1424
|
+
function ConfirmThenDialogComponent(config, interactionContext) {
|
|
1425
|
+
var _this = _super.call(this) || this;
|
|
1426
|
+
_this.config = config;
|
|
1427
|
+
_this.interactionContext = interactionContext;
|
|
1428
|
+
pectin.assert.notNil(config);
|
|
1429
|
+
return _this;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* @return {?}
|
|
1433
|
+
*/
|
|
1434
|
+
ConfirmThenDialogComponent.prototype.ngOnInit = /**
|
|
1435
|
+
* @return {?}
|
|
1436
|
+
*/
|
|
1437
|
+
function () {
|
|
1438
|
+
};
|
|
1439
|
+
Object.defineProperty(ConfirmThenDialogComponent.prototype, "confirm", {
|
|
1440
|
+
get: /**
|
|
1441
|
+
* @return {?}
|
|
1442
|
+
*/
|
|
1443
|
+
function () {
|
|
1444
|
+
return this.config.confirm;
|
|
1445
|
+
},
|
|
1446
|
+
enumerable: true,
|
|
1447
|
+
configurable: true
|
|
1448
|
+
});
|
|
1449
|
+
/**
|
|
1450
|
+
* @return {?}
|
|
1451
|
+
*/
|
|
1452
|
+
ConfirmThenDialogComponent.prototype.isDestructive = /**
|
|
1453
|
+
* @return {?}
|
|
1454
|
+
*/
|
|
1455
|
+
function () {
|
|
1456
|
+
return this.confirm.destructive && this.confirm.destructive();
|
|
1457
|
+
};
|
|
1458
|
+
/**
|
|
1459
|
+
* @return {?}
|
|
1460
|
+
*/
|
|
1461
|
+
ConfirmThenDialogComponent.prototype.onConfirm = /**
|
|
1462
|
+
* @return {?}
|
|
1463
|
+
*/
|
|
1464
|
+
function () {
|
|
1465
|
+
var _this = this;
|
|
1466
|
+
this.interactionContext.startActivity(this.config.activityType, this.config.data)
|
|
1467
|
+
.then((/**
|
|
1468
|
+
* @param {?} result
|
|
1469
|
+
* @return {?}
|
|
1470
|
+
*/
|
|
1471
|
+
function (result) { return _this.done(result); }))
|
|
1472
|
+
.catch((/**
|
|
1473
|
+
* @param {?} error
|
|
1474
|
+
* @return {?}
|
|
1475
|
+
*/
|
|
1476
|
+
function (error) { return _this.cancel(error); }));
|
|
1477
|
+
};
|
|
1478
|
+
ConfirmThenDialogComponent.decorators = [
|
|
1479
|
+
{ type: core.Component, args: [{
|
|
1480
|
+
selector: 'angular-ui-powerups-confirmation-dialog',
|
|
1481
|
+
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\">{{confirm.ok()}}</button>\n</p>\n\n",
|
|
1482
|
+
styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1483
|
+
}] }
|
|
1484
|
+
];
|
|
1485
|
+
/** @nocollapse */
|
|
1486
|
+
ConfirmThenDialogComponent.ctorParameters = function () { return [
|
|
1487
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] },
|
|
1488
|
+
{ type: InteractionContext }
|
|
1489
|
+
]; };
|
|
1490
|
+
return ConfirmThenDialogComponent;
|
|
1491
|
+
}(AbstractActivity));
|
|
1492
|
+
if (false) {
|
|
1493
|
+
/** @type {?} */
|
|
1494
|
+
exports.ɵba.prototype.config;
|
|
1495
|
+
/** @type {?} */
|
|
1496
|
+
exports.ɵba.prototype.interactionContext;
|
|
1497
|
+
}
|
|
1498
|
+
(function (ConfirmThenDialogComponent) {
|
|
1499
|
+
/**
|
|
1500
|
+
* @record
|
|
1501
|
+
* @template D, R, E
|
|
1502
|
+
*/
|
|
1503
|
+
function Data() { }
|
|
1504
|
+
ConfirmThenDialogComponent.Data = Data;
|
|
1505
|
+
if (false) {
|
|
1506
|
+
/** @type {?} */
|
|
1507
|
+
Data.prototype.confirm;
|
|
1508
|
+
/** @type {?} */
|
|
1509
|
+
Data.prototype.activityType;
|
|
1510
|
+
/** @type {?} */
|
|
1511
|
+
Data.prototype.data;
|
|
1512
|
+
}
|
|
1513
|
+
})(exports.ɵba || (exports.ɵba = {}));
|
|
1514
|
+
|
|
1410
1515
|
/**
|
|
1411
1516
|
* @fileoverview added by tsickle
|
|
1412
1517
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -1465,8 +1570,28 @@
|
|
|
1465
1570
|
_this.activityOutletTabs = new pectin.MutableListModel();
|
|
1466
1571
|
_this.obsoleteTabs = [];
|
|
1467
1572
|
_this.finished = false;
|
|
1573
|
+
_this._activityList = new pectin.MutableListModel();
|
|
1468
1574
|
return _this;
|
|
1469
1575
|
}
|
|
1576
|
+
/**
|
|
1577
|
+
* @return {?}
|
|
1578
|
+
*/
|
|
1579
|
+
ActivityContainerComponent.prototype.isActive = /**
|
|
1580
|
+
* @return {?}
|
|
1581
|
+
*/
|
|
1582
|
+
function () {
|
|
1583
|
+
return this.parentInteractionContext.isActive();
|
|
1584
|
+
};
|
|
1585
|
+
Object.defineProperty(ActivityContainerComponent.prototype, "activityList", {
|
|
1586
|
+
get: /**
|
|
1587
|
+
* @return {?}
|
|
1588
|
+
*/
|
|
1589
|
+
function () {
|
|
1590
|
+
return this._activityList.readonly;
|
|
1591
|
+
},
|
|
1592
|
+
enumerable: true,
|
|
1593
|
+
configurable: true
|
|
1594
|
+
});
|
|
1470
1595
|
/**
|
|
1471
1596
|
* @return {?}
|
|
1472
1597
|
*/
|
|
@@ -1484,11 +1609,50 @@
|
|
|
1484
1609
|
function () {
|
|
1485
1610
|
var _this = this;
|
|
1486
1611
|
var observe = pectin.Dsl.disposeWith(this).observe;
|
|
1612
|
+
this._activityList.value = this.outlets.toArray().map((/**
|
|
1613
|
+
* @param {?} c
|
|
1614
|
+
* @return {?}
|
|
1615
|
+
*/
|
|
1616
|
+
function (c) { return c.component; }));
|
|
1617
|
+
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1618
|
+
* @param {?} change
|
|
1619
|
+
* @return {?}
|
|
1620
|
+
*/
|
|
1621
|
+
function (change) {
|
|
1622
|
+
_this.safelyUpdateActivityList(change.map((/**
|
|
1623
|
+
* @param {?} c
|
|
1624
|
+
* @return {?}
|
|
1625
|
+
*/
|
|
1626
|
+
function (c) { return c.component; })));
|
|
1627
|
+
}));
|
|
1487
1628
|
observe.valuesFrom(this.tabs.animationDone).subscribe((/**
|
|
1488
1629
|
* @return {?}
|
|
1489
1630
|
*/
|
|
1490
1631
|
function () { return _this.onAnimationFinished(); }));
|
|
1491
1632
|
};
|
|
1633
|
+
/**
|
|
1634
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1635
|
+
* @param activities
|
|
1636
|
+
*/
|
|
1637
|
+
/**
|
|
1638
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1639
|
+
* @private
|
|
1640
|
+
* @param {?} activities
|
|
1641
|
+
* @return {?}
|
|
1642
|
+
*/
|
|
1643
|
+
ActivityContainerComponent.prototype.safelyUpdateActivityList = /**
|
|
1644
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1645
|
+
* @private
|
|
1646
|
+
* @param {?} activities
|
|
1647
|
+
* @return {?}
|
|
1648
|
+
*/
|
|
1649
|
+
function (activities) {
|
|
1650
|
+
var _this = this;
|
|
1651
|
+
setTimeout((/**
|
|
1652
|
+
* @return {?}
|
|
1653
|
+
*/
|
|
1654
|
+
function () { return _this._activityList.value = activities; }));
|
|
1655
|
+
};
|
|
1492
1656
|
/**
|
|
1493
1657
|
* @template D, R, E
|
|
1494
1658
|
* @param {?} initialContext
|
|
@@ -1606,6 +1770,27 @@
|
|
|
1606
1770
|
function (confirm) {
|
|
1607
1771
|
return this.startActivity(ConfirmationDialogComponent, confirm);
|
|
1608
1772
|
};
|
|
1773
|
+
/**
|
|
1774
|
+
* @template D, R, E
|
|
1775
|
+
* @param {?} confirm
|
|
1776
|
+
* @param {?} activityType
|
|
1777
|
+
* @param {?=} data
|
|
1778
|
+
* @return {?}
|
|
1779
|
+
*/
|
|
1780
|
+
ActivityContainerComponent.prototype.confirmThen = /**
|
|
1781
|
+
* @template D, R, E
|
|
1782
|
+
* @param {?} confirm
|
|
1783
|
+
* @param {?} activityType
|
|
1784
|
+
* @param {?=} data
|
|
1785
|
+
* @return {?}
|
|
1786
|
+
*/
|
|
1787
|
+
function (confirm, activityType, data) {
|
|
1788
|
+
return this.startActivity(exports.ɵba, {
|
|
1789
|
+
confirm: confirm,
|
|
1790
|
+
activityType: activityType,
|
|
1791
|
+
data: data
|
|
1792
|
+
});
|
|
1793
|
+
};
|
|
1609
1794
|
/**
|
|
1610
1795
|
* @private
|
|
1611
1796
|
* @return {?}
|
|
@@ -1652,7 +1837,7 @@
|
|
|
1652
1837
|
parentInteractionContext: [{ type: core.Input }],
|
|
1653
1838
|
initialActivityOutletContext: [{ type: core.Input }],
|
|
1654
1839
|
tabs: [{ type: core.ViewChild, args: ['tabs', { static: true },] }],
|
|
1655
|
-
outlets: [{ type: core.ViewChildren, args: [
|
|
1840
|
+
outlets: [{ type: core.ViewChildren, args: [ActivityOutletComponent,] }]
|
|
1656
1841
|
};
|
|
1657
1842
|
return ActivityContainerComponent;
|
|
1658
1843
|
}(DisposableComponent));
|
|
@@ -1662,6 +1847,8 @@
|
|
|
1662
1847
|
/** @type {?} */
|
|
1663
1848
|
exports.ɵu.prototype.initialActivityOutletContext;
|
|
1664
1849
|
/** @type {?} */
|
|
1850
|
+
exports.ɵu.prototype.currentActivity;
|
|
1851
|
+
/** @type {?} */
|
|
1665
1852
|
exports.ɵu.prototype.tabs;
|
|
1666
1853
|
/** @type {?} */
|
|
1667
1854
|
exports.ɵu.prototype.outlets;
|
|
@@ -1677,6 +1864,11 @@
|
|
|
1677
1864
|
* @private
|
|
1678
1865
|
*/
|
|
1679
1866
|
exports.ɵu.prototype.finished;
|
|
1867
|
+
/**
|
|
1868
|
+
* @type {?}
|
|
1869
|
+
* @private
|
|
1870
|
+
*/
|
|
1871
|
+
exports.ɵu.prototype._activityList;
|
|
1680
1872
|
}
|
|
1681
1873
|
(function (ActivityContainerComponent) {
|
|
1682
1874
|
/**
|
|
@@ -1705,14 +1897,60 @@
|
|
|
1705
1897
|
var DIALOG_INTERACTION_SERVICE_DEFAULTS = new core.InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
|
|
1706
1898
|
var DialogInteractionService = /** @class */ (function (_super) {
|
|
1707
1899
|
__extends(DialogInteractionService, _super);
|
|
1708
|
-
function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1900
|
+
function DialogInteractionService(dialogService, router, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1709
1901
|
var _this = _super.call(this) || this;
|
|
1710
1902
|
_this.dialogService = dialogService;
|
|
1903
|
+
_this.router = router;
|
|
1711
1904
|
_this.dialogServiceDefaults = dialogServiceDefaults;
|
|
1712
1905
|
_this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
1906
|
+
_this._activityList = new pectin.DelegatingListModel();
|
|
1907
|
+
_this._active = false;
|
|
1713
1908
|
typescriptUtilities.assert.notNil(dialogService);
|
|
1909
|
+
var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
|
|
1910
|
+
_this.currentActivity = chain(_this.activityList).last();
|
|
1714
1911
|
return _this;
|
|
1912
|
+
// observe.valuesFrom(this.router.events)
|
|
1913
|
+
// .tap((event:RouterEvent) => {
|
|
1914
|
+
// const nav = router.getCurrentNavigation();
|
|
1915
|
+
// console.log({
|
|
1916
|
+
// previousUrl: nav.previousNavigation && nav.previousNavigation.finalUrl,
|
|
1917
|
+
// initialUrl: nav.initialUrl,
|
|
1918
|
+
// finalUrl: nav.finalUrl,
|
|
1919
|
+
// });
|
|
1920
|
+
//
|
|
1921
|
+
// })
|
|
1922
|
+
// .filter(event => event instanceof NavigationStart)
|
|
1923
|
+
// .subscribe((event: NavigationStart) => {
|
|
1924
|
+
// console.log(event.navigationTrigger);
|
|
1925
|
+
// if (event.navigationTrigger === 'popstate' && this.isActive()) {
|
|
1926
|
+
// const prev = router.getCurrentNavigation().previousNavigation.finalUrl;
|
|
1927
|
+
// // this.router.navigateByUrl(prev.toString(), {
|
|
1928
|
+
// // replaceUrl: true,
|
|
1929
|
+
// // skipLocationChange: false
|
|
1930
|
+
// // });
|
|
1931
|
+
// // this.cancelActivity();
|
|
1932
|
+
// }
|
|
1933
|
+
// });
|
|
1715
1934
|
}
|
|
1935
|
+
/**
|
|
1936
|
+
* @return {?}
|
|
1937
|
+
*/
|
|
1938
|
+
DialogInteractionService.prototype.cancelActivity = /**
|
|
1939
|
+
* @return {?}
|
|
1940
|
+
*/
|
|
1941
|
+
function () {
|
|
1942
|
+
this.currentActivity.value.cancel(null);
|
|
1943
|
+
};
|
|
1944
|
+
Object.defineProperty(DialogInteractionService.prototype, "activityList", {
|
|
1945
|
+
get: /**
|
|
1946
|
+
* @return {?}
|
|
1947
|
+
*/
|
|
1948
|
+
function () {
|
|
1949
|
+
return this._activityList.readonly;
|
|
1950
|
+
},
|
|
1951
|
+
enumerable: true,
|
|
1952
|
+
configurable: true
|
|
1953
|
+
});
|
|
1716
1954
|
/**
|
|
1717
1955
|
* @template D, R, E
|
|
1718
1956
|
* @param {?} activityType
|
|
@@ -1747,8 +1985,18 @@
|
|
|
1747
1985
|
function (activityType, data, disableClose) {
|
|
1748
1986
|
var _this = this;
|
|
1749
1987
|
if (disableClose === void 0) { disableClose = true; }
|
|
1988
|
+
if (this.isActive()) {
|
|
1989
|
+
pectin.lang.illegalState("Activity already in progress: " + this.activityList.value.map((/**
|
|
1990
|
+
* @param {?} a
|
|
1991
|
+
* @return {?}
|
|
1992
|
+
*/
|
|
1993
|
+
function (a) { return a.constructor.name; })).join(', '));
|
|
1994
|
+
}
|
|
1995
|
+
this._active = true;
|
|
1750
1996
|
/** @type {?} */
|
|
1751
|
-
var
|
|
1997
|
+
var self = this;
|
|
1998
|
+
/** @type {?} */
|
|
1999
|
+
var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults, {
|
|
1752
2000
|
data: data,
|
|
1753
2001
|
disableClose: disableClose,
|
|
1754
2002
|
panelClass: 'dialog-interaction-service'
|
|
@@ -1764,6 +2012,7 @@
|
|
|
1764
2012
|
/** @type {?} */
|
|
1765
2013
|
var activityContainer = matDialogRef.componentInstance;
|
|
1766
2014
|
activityContainer.parentInteractionContext = _this;
|
|
2015
|
+
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
1767
2016
|
activityContainer.initialise({
|
|
1768
2017
|
activityClass: activityType,
|
|
1769
2018
|
activityData: data,
|
|
@@ -1787,8 +2036,35 @@
|
|
|
1787
2036
|
}
|
|
1788
2037
|
});
|
|
1789
2038
|
matDialogRef.updateSize();
|
|
2039
|
+
})).finally((/**
|
|
2040
|
+
* @return {?}
|
|
2041
|
+
*/
|
|
2042
|
+
function () {
|
|
2043
|
+
self.safelyUpdateActivityListDelegate(null);
|
|
2044
|
+
self._active = false;
|
|
1790
2045
|
}));
|
|
1791
2046
|
};
|
|
2047
|
+
/**
|
|
2048
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
2049
|
+
* @param delegate
|
|
2050
|
+
*/
|
|
2051
|
+
/**
|
|
2052
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
2053
|
+
* @param {?} delegate
|
|
2054
|
+
* @return {?}
|
|
2055
|
+
*/
|
|
2056
|
+
DialogInteractionService.prototype.safelyUpdateActivityListDelegate = /**
|
|
2057
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
2058
|
+
* @param {?} delegate
|
|
2059
|
+
* @return {?}
|
|
2060
|
+
*/
|
|
2061
|
+
function (delegate) {
|
|
2062
|
+
var _this = this;
|
|
2063
|
+
setTimeout((/**
|
|
2064
|
+
* @return {?}
|
|
2065
|
+
*/
|
|
2066
|
+
function () { return _this._activityList.setDelegate(delegate); }));
|
|
2067
|
+
};
|
|
1792
2068
|
/**
|
|
1793
2069
|
* @param {?} alert
|
|
1794
2070
|
* @return {?}
|
|
@@ -1811,6 +2087,27 @@
|
|
|
1811
2087
|
function (confirm) {
|
|
1812
2088
|
return this._startActivity(ConfirmationDialogComponent, confirm, true);
|
|
1813
2089
|
};
|
|
2090
|
+
/**
|
|
2091
|
+
* @template D, R, E
|
|
2092
|
+
* @param {?} confirm
|
|
2093
|
+
* @param {?} activityType
|
|
2094
|
+
* @param {?=} data
|
|
2095
|
+
* @return {?}
|
|
2096
|
+
*/
|
|
2097
|
+
DialogInteractionService.prototype.confirmThen = /**
|
|
2098
|
+
* @template D, R, E
|
|
2099
|
+
* @param {?} confirm
|
|
2100
|
+
* @param {?} activityType
|
|
2101
|
+
* @param {?=} data
|
|
2102
|
+
* @return {?}
|
|
2103
|
+
*/
|
|
2104
|
+
function (confirm, activityType, data) {
|
|
2105
|
+
return this._startActivity(exports.ɵba, {
|
|
2106
|
+
confirm: confirm,
|
|
2107
|
+
activityType: activityType,
|
|
2108
|
+
data: data
|
|
2109
|
+
}, true);
|
|
2110
|
+
};
|
|
1814
2111
|
DialogInteractionService.decorators = [
|
|
1815
2112
|
{ type: core.Injectable, args: [{
|
|
1816
2113
|
providedIn: 'root'
|
|
@@ -1819,18 +2116,36 @@
|
|
|
1819
2116
|
/** @nocollapse */
|
|
1820
2117
|
DialogInteractionService.ctorParameters = function () { return [
|
|
1821
2118
|
{ type: material.MatDialog },
|
|
2119
|
+
{ type: router.Router },
|
|
1822
2120
|
{ type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
1823
2121
|
{ type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [dialog.MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
1824
2122
|
]; };
|
|
1825
|
-
/** @nocollapse */ DialogInteractionService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(core.ɵɵinject(dialog.MatDialog), core.ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), core.ɵɵinject(dialog.MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
2123
|
+
/** @nocollapse */ DialogInteractionService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(core.ɵɵinject(dialog.MatDialog), core.ɵɵinject(router.Router), core.ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), core.ɵɵinject(dialog.MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
1826
2124
|
return DialogInteractionService;
|
|
1827
2125
|
}(InteractionContext));
|
|
1828
2126
|
if (false) {
|
|
2127
|
+
/** @type {?} */
|
|
2128
|
+
DialogInteractionService.prototype.currentActivity;
|
|
2129
|
+
/**
|
|
2130
|
+
* @type {?}
|
|
2131
|
+
* @private
|
|
2132
|
+
*/
|
|
2133
|
+
DialogInteractionService.prototype._activityList;
|
|
2134
|
+
/**
|
|
2135
|
+
* @type {?}
|
|
2136
|
+
* @private
|
|
2137
|
+
*/
|
|
2138
|
+
DialogInteractionService.prototype._active;
|
|
1829
2139
|
/**
|
|
1830
2140
|
* @type {?}
|
|
1831
2141
|
* @private
|
|
1832
2142
|
*/
|
|
1833
2143
|
DialogInteractionService.prototype.dialogService;
|
|
2144
|
+
/**
|
|
2145
|
+
* @type {?}
|
|
2146
|
+
* @private
|
|
2147
|
+
*/
|
|
2148
|
+
DialogInteractionService.prototype.router;
|
|
1834
2149
|
/** @type {?} */
|
|
1835
2150
|
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
1836
2151
|
/** @type {?} */
|
|
@@ -1856,16 +2171,18 @@
|
|
|
1856
2171
|
declarations: [
|
|
1857
2172
|
exports.ɵu,
|
|
1858
2173
|
ConfirmationDialogComponent,
|
|
2174
|
+
exports.ɵba,
|
|
1859
2175
|
AlertDialogComponent,
|
|
1860
|
-
|
|
2176
|
+
ActivityOutletComponent
|
|
1861
2177
|
],
|
|
1862
2178
|
exports: [
|
|
1863
2179
|
exports.ɵu,
|
|
1864
|
-
|
|
2180
|
+
ActivityOutletComponent,
|
|
1865
2181
|
],
|
|
1866
2182
|
entryComponents: [
|
|
1867
2183
|
exports.ɵu,
|
|
1868
2184
|
ConfirmationDialogComponent,
|
|
2185
|
+
exports.ɵba,
|
|
1869
2186
|
AlertDialogComponent
|
|
1870
2187
|
],
|
|
1871
2188
|
providers: [
|
|
@@ -4309,6 +4626,65 @@
|
|
|
4309
4626
|
ActivityOutletContext.prototype.onCancel;
|
|
4310
4627
|
}
|
|
4311
4628
|
|
|
4629
|
+
/**
|
|
4630
|
+
* @fileoverview added by tsickle
|
|
4631
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4632
|
+
*/
|
|
4633
|
+
var CloseInteractionGuard = /** @class */ (function () {
|
|
4634
|
+
function CloseInteractionGuard(router, injector, interactionContext) {
|
|
4635
|
+
this.router = router;
|
|
4636
|
+
this.injector = injector;
|
|
4637
|
+
this.interactionContext = interactionContext;
|
|
4638
|
+
}
|
|
4639
|
+
/**
|
|
4640
|
+
* @param {?} component
|
|
4641
|
+
* @param {?} currentRoute
|
|
4642
|
+
* @param {?} currentState
|
|
4643
|
+
* @param {?=} nextState
|
|
4644
|
+
* @return {?}
|
|
4645
|
+
*/
|
|
4646
|
+
CloseInteractionGuard.prototype.canDeactivate = /**
|
|
4647
|
+
* @param {?} component
|
|
4648
|
+
* @param {?} currentRoute
|
|
4649
|
+
* @param {?} currentState
|
|
4650
|
+
* @param {?=} nextState
|
|
4651
|
+
* @return {?}
|
|
4652
|
+
*/
|
|
4653
|
+
function (component, currentRoute, currentState, nextState) {
|
|
4654
|
+
return !this.interactionContext.isActive();
|
|
4655
|
+
};
|
|
4656
|
+
CloseInteractionGuard.decorators = [
|
|
4657
|
+
{ type: core.Injectable, args: [{
|
|
4658
|
+
providedIn: 'root'
|
|
4659
|
+
},] }
|
|
4660
|
+
];
|
|
4661
|
+
/** @nocollapse */
|
|
4662
|
+
CloseInteractionGuard.ctorParameters = function () { return [
|
|
4663
|
+
{ type: router.Router },
|
|
4664
|
+
{ type: core.Injector },
|
|
4665
|
+
{ type: InteractionContext }
|
|
4666
|
+
]; };
|
|
4667
|
+
/** @nocollapse */ CloseInteractionGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CloseInteractionGuard_Factory() { return new CloseInteractionGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(InteractionContext)); }, token: CloseInteractionGuard, providedIn: "root" });
|
|
4668
|
+
return CloseInteractionGuard;
|
|
4669
|
+
}());
|
|
4670
|
+
if (false) {
|
|
4671
|
+
/**
|
|
4672
|
+
* @type {?}
|
|
4673
|
+
* @private
|
|
4674
|
+
*/
|
|
4675
|
+
CloseInteractionGuard.prototype.router;
|
|
4676
|
+
/**
|
|
4677
|
+
* @type {?}
|
|
4678
|
+
* @private
|
|
4679
|
+
*/
|
|
4680
|
+
CloseInteractionGuard.prototype.injector;
|
|
4681
|
+
/**
|
|
4682
|
+
* @type {?}
|
|
4683
|
+
* @private
|
|
4684
|
+
*/
|
|
4685
|
+
CloseInteractionGuard.prototype.interactionContext;
|
|
4686
|
+
}
|
|
4687
|
+
|
|
4312
4688
|
/**
|
|
4313
4689
|
* @fileoverview added by tsickle
|
|
4314
4690
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4410,9 +4786,33 @@
|
|
|
4410
4786
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4411
4787
|
*/
|
|
4412
4788
|
var LeavePlaceGuard = /** @class */ (function () {
|
|
4413
|
-
function LeavePlaceGuard(router, injector) {
|
|
4414
|
-
this.router = router;
|
|
4789
|
+
function LeavePlaceGuard(router$1, injector, interactionContext, location) {
|
|
4790
|
+
this.router = router$1;
|
|
4415
4791
|
this.injector = injector;
|
|
4792
|
+
this.interactionContext = interactionContext;
|
|
4793
|
+
this.location = location;
|
|
4794
|
+
// TODO: should probably replace this with a RouteTracker thingy.
|
|
4795
|
+
this._alreadyAccepted = [];
|
|
4796
|
+
console.log('***** Created new guard ******');
|
|
4797
|
+
/** @type {?} */
|
|
4798
|
+
var self = this;
|
|
4799
|
+
this.router.events.subscribe((/**
|
|
4800
|
+
* @param {?} event
|
|
4801
|
+
* @return {?}
|
|
4802
|
+
*/
|
|
4803
|
+
function (event) {
|
|
4804
|
+
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
4805
|
+
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
4806
|
+
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
4807
|
+
if (event instanceof router.NavigationEnd) {
|
|
4808
|
+
console.log("navigation ended");
|
|
4809
|
+
self._alreadyAccepted = [];
|
|
4810
|
+
}
|
|
4811
|
+
if (event instanceof router.NavigationError) {
|
|
4812
|
+
console.log("navigation errored");
|
|
4813
|
+
self._alreadyAccepted = [];
|
|
4814
|
+
}
|
|
4815
|
+
}));
|
|
4416
4816
|
}
|
|
4417
4817
|
/**
|
|
4418
4818
|
* @param {?} component
|
|
@@ -4429,27 +4829,90 @@
|
|
|
4429
4829
|
* @return {?}
|
|
4430
4830
|
*/
|
|
4431
4831
|
function (component, currentRoute, currentState, nextState) {
|
|
4432
|
-
|
|
4832
|
+
var _this = this;
|
|
4433
4833
|
/** @type {?} */
|
|
4434
|
-
var
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
//
|
|
4442
|
-
//
|
|
4443
|
-
//
|
|
4444
|
-
//
|
|
4445
|
-
//
|
|
4446
|
-
|
|
4447
|
-
|
|
4834
|
+
var placeDefinitionPath = "/" + component.placeDefinition.path;
|
|
4835
|
+
console.log('canDeactivate', {
|
|
4836
|
+
staticPath: placeDefinitionPath,
|
|
4837
|
+
currentStateUrl: currentState.url,
|
|
4838
|
+
nextStateUrl: nextState.url,
|
|
4839
|
+
alreadyDeclined: this._alreadyAccepted
|
|
4840
|
+
});
|
|
4841
|
+
// Example of the above when navigating to a different child route.
|
|
4842
|
+
// canDeactivate {staticPath: "/hero-details",
|
|
4843
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
4844
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
4845
|
+
// }
|
|
4846
|
+
// Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
|
|
4847
|
+
// canDeactivate {
|
|
4848
|
+
// staticPath: "/hero-stats",
|
|
4849
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4850
|
+
// nextStateUrl: "/route-parameters/"
|
|
4851
|
+
// }
|
|
4852
|
+
// canDeactivate {
|
|
4853
|
+
// staticPath: "/route-parameters",
|
|
4854
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4855
|
+
// nextStateUrl: "/route-parameters/"
|
|
4856
|
+
// }
|
|
4857
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
4858
|
+
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
4859
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4860
|
+
// canDeactivate {
|
|
4861
|
+
// staticPath: "/hero-stats",
|
|
4862
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4863
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
4864
|
+
// }
|
|
4865
|
+
// canDeactivate {
|
|
4866
|
+
// staticPath: "/route-parameters",
|
|
4867
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4868
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
4869
|
+
// }
|
|
4870
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
4871
|
+
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
4872
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4873
|
+
// canDeactivate {
|
|
4874
|
+
// staticPath: "/hero-stats",
|
|
4875
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4876
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4877
|
+
// }
|
|
4878
|
+
// HACK: this will break with child routes...
|
|
4879
|
+
if (this.alreadyAccepted(component)) {
|
|
4880
|
+
return true;
|
|
4448
4881
|
}
|
|
4449
4882
|
else {
|
|
4883
|
+
if (!nextState.url.startsWith(placeDefinitionPath)) {
|
|
4884
|
+
/** @type {?} */
|
|
4885
|
+
var self_1 = this;
|
|
4886
|
+
return Promise.resolve(component.canDeactivate()).then((/**
|
|
4887
|
+
* @param {?} canLeave
|
|
4888
|
+
* @return {?}
|
|
4889
|
+
*/
|
|
4890
|
+
function (canLeave) {
|
|
4891
|
+
if (!canLeave) {
|
|
4892
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4893
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4894
|
+
_this.location.go(currentState.url);
|
|
4895
|
+
}
|
|
4896
|
+
else {
|
|
4897
|
+
self_1._alreadyAccepted.push(component);
|
|
4898
|
+
}
|
|
4899
|
+
return canLeave;
|
|
4900
|
+
}));
|
|
4901
|
+
}
|
|
4450
4902
|
return true;
|
|
4451
4903
|
}
|
|
4452
4904
|
};
|
|
4905
|
+
/**
|
|
4906
|
+
* @param {?} placeComponent
|
|
4907
|
+
* @return {?}
|
|
4908
|
+
*/
|
|
4909
|
+
LeavePlaceGuard.prototype.alreadyAccepted = /**
|
|
4910
|
+
* @param {?} placeComponent
|
|
4911
|
+
* @return {?}
|
|
4912
|
+
*/
|
|
4913
|
+
function (placeComponent) {
|
|
4914
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
4915
|
+
};
|
|
4453
4916
|
LeavePlaceGuard.decorators = [
|
|
4454
4917
|
{ type: core.Injectable, args: [{
|
|
4455
4918
|
providedIn: 'root'
|
|
@@ -4458,12 +4921,25 @@
|
|
|
4458
4921
|
/** @nocollapse */
|
|
4459
4922
|
LeavePlaceGuard.ctorParameters = function () { return [
|
|
4460
4923
|
{ type: router.Router },
|
|
4461
|
-
{ type: core.Injector }
|
|
4924
|
+
{ type: core.Injector },
|
|
4925
|
+
{ type: InteractionContext },
|
|
4926
|
+
{ type: common.Location }
|
|
4462
4927
|
]; };
|
|
4463
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4928
|
+
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(InteractionContext), core.ɵɵinject(common.Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4929
|
+
__decorate([
|
|
4930
|
+
pectin.Trace(),
|
|
4931
|
+
__metadata("design:type", Function),
|
|
4932
|
+
__metadata("design:paramtypes", [exports.PlaceComponent]),
|
|
4933
|
+
__metadata("design:returntype", Boolean)
|
|
4934
|
+
], LeavePlaceGuard.prototype, "alreadyAccepted", null);
|
|
4464
4935
|
return LeavePlaceGuard;
|
|
4465
4936
|
}());
|
|
4466
4937
|
if (false) {
|
|
4938
|
+
/**
|
|
4939
|
+
* @type {?}
|
|
4940
|
+
* @private
|
|
4941
|
+
*/
|
|
4942
|
+
LeavePlaceGuard.prototype._alreadyAccepted;
|
|
4467
4943
|
/**
|
|
4468
4944
|
* @type {?}
|
|
4469
4945
|
* @private
|
|
@@ -4474,6 +4950,10 @@
|
|
|
4474
4950
|
* @private
|
|
4475
4951
|
*/
|
|
4476
4952
|
LeavePlaceGuard.prototype.injector;
|
|
4953
|
+
/** @type {?} */
|
|
4954
|
+
LeavePlaceGuard.prototype.interactionContext;
|
|
4955
|
+
/** @type {?} */
|
|
4956
|
+
LeavePlaceGuard.prototype.location;
|
|
4477
4957
|
}
|
|
4478
4958
|
|
|
4479
4959
|
/**
|
|
@@ -4767,11 +5247,13 @@
|
|
|
4767
5247
|
exports.AbstractInputComponent = AbstractInputComponent;
|
|
4768
5248
|
exports.AbstractPlaceNavigationComponent = AbstractPlaceNavigationComponent;
|
|
4769
5249
|
exports.ActivityContainerComponent = exports.ɵu;
|
|
4770
|
-
exports.ActivityOutletComponent =
|
|
5250
|
+
exports.ActivityOutletComponent = ActivityOutletComponent;
|
|
4771
5251
|
exports.AlertDialogComponent = AlertDialogComponent;
|
|
4772
5252
|
exports.AngularUiPowerupsModule = AngularUiPowerupsModule;
|
|
4773
5253
|
exports.BusyOverlayComponent = BusyOverlayComponent;
|
|
5254
|
+
exports.CloseInteractionGuard = CloseInteractionGuard;
|
|
4774
5255
|
exports.CommandDirective = CommandDirective;
|
|
5256
|
+
exports.ConfirmThenDialogComponent = exports.ɵba;
|
|
4775
5257
|
exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
|
|
4776
5258
|
exports.DEFINITION_META_DATA_KEY = DEFINITION_META_DATA_KEY;
|
|
4777
5259
|
exports.DIALOG_INTERACTION_SERVICE_DEFAULTS = DIALOG_INTERACTION_SERVICE_DEFAULTS;
|
|
@@ -4780,7 +5262,6 @@
|
|
|
4780
5262
|
exports.DisposableComponent = DisposableComponent;
|
|
4781
5263
|
exports.EmptyStateComponent = EmptyStateComponent;
|
|
4782
5264
|
exports.FocusBindingDirective = FocusBindingDirective;
|
|
4783
|
-
exports.INTERACTION_CONTEXT = INTERACTION_CONTEXT;
|
|
4784
5265
|
exports.InteractionContext = InteractionContext;
|
|
4785
5266
|
exports.InteractionModule = InteractionModule;
|
|
4786
5267
|
exports.LEFT_RIGHT_PLACE_ANIMATION = LEFT_RIGHT_PLACE_ANIMATION;
|
|
@@ -4808,10 +5289,10 @@
|
|
|
4808
5289
|
exports.slideDownAndUpAnimation = slideDownAndUpAnimation;
|
|
4809
5290
|
exports.ɵa = CommandDirective;
|
|
4810
5291
|
exports.ɵb = FocusBindingDirective;
|
|
4811
|
-
exports.ɵ
|
|
4812
|
-
exports.ɵbc =
|
|
4813
|
-
exports.ɵ
|
|
4814
|
-
exports.ɵ
|
|
5292
|
+
exports.ɵbb = InteractionContext;
|
|
5293
|
+
exports.ɵbc = AlertDialogComponent;
|
|
5294
|
+
exports.ɵbe = DIALOG_INTERACTION_SERVICE_DEFAULTS;
|
|
5295
|
+
exports.ɵbf = DialogInteractionService;
|
|
4815
5296
|
exports.ɵc = DisposableComponent;
|
|
4816
5297
|
exports.ɵd = NumberInputComponent;
|
|
4817
5298
|
exports.ɵe = AbstractInputComponent;
|
|
@@ -4830,6 +5311,7 @@
|
|
|
4830
5311
|
exports.ɵr = AbstractPlaceNavigationComponent;
|
|
4831
5312
|
exports.ɵs = ListPlaceNavComponent;
|
|
4832
5313
|
exports.ɵt = InteractionModule;
|
|
5314
|
+
exports.ɵv = ActivityOutletComponent;
|
|
4833
5315
|
exports.ɵw = ConfirmationDialogComponent;
|
|
4834
5316
|
exports.ɵx = AbstractActivity;
|
|
4835
5317
|
exports.ɵy = ACTIVITY_DATA;
|