@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,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,
|
|
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,46 @@ 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
|
+
/**
|
|
811
|
+
* Returns true if an activity is currently running.
|
|
812
|
+
*/
|
|
813
|
+
/**
|
|
814
|
+
* Returns true if an activity is currently running.
|
|
815
|
+
* @return {?}
|
|
816
|
+
*/
|
|
817
|
+
InteractionContext.prototype.isActive = /**
|
|
818
|
+
* Returns true if an activity is currently running.
|
|
819
|
+
* @return {?}
|
|
820
|
+
*/
|
|
821
|
+
function () {
|
|
822
|
+
return this.activityList.length > 0;
|
|
823
|
+
};
|
|
810
824
|
return InteractionContext;
|
|
811
|
-
}());
|
|
825
|
+
}(GarbageCollector));
|
|
812
826
|
if (false) {
|
|
827
|
+
/**
|
|
828
|
+
* Returns the activity that is currently active.
|
|
829
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
830
|
+
* @type {?}
|
|
831
|
+
*/
|
|
832
|
+
InteractionContext.prototype.currentActivity;
|
|
833
|
+
/**
|
|
834
|
+
* Returns the current list of activities that are in progress.
|
|
835
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
836
|
+
* @type {?}
|
|
837
|
+
*/
|
|
838
|
+
InteractionContext.prototype.activityList;
|
|
813
839
|
/**
|
|
814
840
|
* @abstract
|
|
815
841
|
* @template D, R, E
|
|
@@ -824,6 +850,16 @@ if (false) {
|
|
|
824
850
|
* @return {?}
|
|
825
851
|
*/
|
|
826
852
|
InteractionContext.prototype.confirm = function (confirm) { };
|
|
853
|
+
/**
|
|
854
|
+
* Presents the confirmation to the user and runs the activity only if the user confirms.
|
|
855
|
+
* @abstract
|
|
856
|
+
* @template D, R, E
|
|
857
|
+
* @param {?} confirm
|
|
858
|
+
* @param {?} activityType the activity to run if confirmed.
|
|
859
|
+
* @param {?=} data the activity data.
|
|
860
|
+
* @return {?}
|
|
861
|
+
*/
|
|
862
|
+
InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
|
|
827
863
|
/**
|
|
828
864
|
* @abstract
|
|
829
865
|
* @param {?} alert
|
|
@@ -851,6 +887,16 @@ if (false) {
|
|
|
851
887
|
* @return {?}
|
|
852
888
|
*/
|
|
853
889
|
Activity.prototype.initialise = function (activityContext) { };
|
|
890
|
+
/**
|
|
891
|
+
* @param {?} result
|
|
892
|
+
* @return {?}
|
|
893
|
+
*/
|
|
894
|
+
Activity.prototype.done = function (result) { };
|
|
895
|
+
/**
|
|
896
|
+
* @param {?} e
|
|
897
|
+
* @return {?}
|
|
898
|
+
*/
|
|
899
|
+
Activity.prototype.cancel = function (e) { };
|
|
854
900
|
}
|
|
855
901
|
|
|
856
902
|
/**
|
|
@@ -917,6 +963,16 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
917
963
|
this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
|
|
918
964
|
this.activityComponentRef.instance.initialise(activityContext);
|
|
919
965
|
};
|
|
966
|
+
Object.defineProperty(ActivityOutletComponent.prototype, "component", {
|
|
967
|
+
get: /**
|
|
968
|
+
* @return {?}
|
|
969
|
+
*/
|
|
970
|
+
function () {
|
|
971
|
+
return this.activityComponentRef.instance;
|
|
972
|
+
},
|
|
973
|
+
enumerable: true,
|
|
974
|
+
configurable: true
|
|
975
|
+
});
|
|
920
976
|
/**
|
|
921
977
|
* @param {?} alert
|
|
922
978
|
* @return {?}
|
|
@@ -939,6 +995,23 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
939
995
|
function (confirm) {
|
|
940
996
|
return this.interactionContext.confirm(confirm);
|
|
941
997
|
};
|
|
998
|
+
/**
|
|
999
|
+
* @template D1, R1, E1
|
|
1000
|
+
* @param {?} confirm
|
|
1001
|
+
* @param {?} activityType
|
|
1002
|
+
* @param {?=} data
|
|
1003
|
+
* @return {?}
|
|
1004
|
+
*/
|
|
1005
|
+
ActivityOutletComponent.prototype.confirmThen = /**
|
|
1006
|
+
* @template D1, R1, E1
|
|
1007
|
+
* @param {?} confirm
|
|
1008
|
+
* @param {?} activityType
|
|
1009
|
+
* @param {?=} data
|
|
1010
|
+
* @return {?}
|
|
1011
|
+
*/
|
|
1012
|
+
function (confirm, activityType, data) {
|
|
1013
|
+
return this.interactionContext.confirmThen(confirm, activityType, data);
|
|
1014
|
+
};
|
|
942
1015
|
/**
|
|
943
1016
|
* @template D1, R1, E1
|
|
944
1017
|
* @param {?} activityType
|
|
@@ -982,12 +1055,6 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
982
1055
|
interactionContext: [{ type: Input }],
|
|
983
1056
|
activityContext: [{ type: Input }]
|
|
984
1057
|
};
|
|
985
|
-
__decorate([
|
|
986
|
-
Trace(),
|
|
987
|
-
__metadata("design:type", Function),
|
|
988
|
-
__metadata("design:paramtypes", [Object]),
|
|
989
|
-
__metadata("design:returntype", void 0)
|
|
990
|
-
], ActivityOutletComponent.prototype, "loadActivity", null);
|
|
991
1058
|
return ActivityOutletComponent;
|
|
992
1059
|
}());
|
|
993
1060
|
if (false) {
|
|
@@ -1015,65 +1082,6 @@ if (false) {
|
|
|
1015
1082
|
ActivityOutletComponent.prototype.injector;
|
|
1016
1083
|
/* Skipping unhandled member: ;*/
|
|
1017
1084
|
}
|
|
1018
|
-
(function (ActivityOutletComponent) {
|
|
1019
|
-
/**
|
|
1020
|
-
* @template D, R, E
|
|
1021
|
-
*/
|
|
1022
|
-
var /**
|
|
1023
|
-
* @template D, R, E
|
|
1024
|
-
*/
|
|
1025
|
-
OutletInteractionContext = /** @class */ (function () {
|
|
1026
|
-
function OutletInteractionContext(context) {
|
|
1027
|
-
this.context = context;
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* @param {?} alert
|
|
1031
|
-
* @return {?}
|
|
1032
|
-
*/
|
|
1033
|
-
OutletInteractionContext.prototype.alert = /**
|
|
1034
|
-
* @param {?} alert
|
|
1035
|
-
* @return {?}
|
|
1036
|
-
*/
|
|
1037
|
-
function (alert) {
|
|
1038
|
-
return lang.notImplemented();
|
|
1039
|
-
};
|
|
1040
|
-
/**
|
|
1041
|
-
* @param {?} confirm
|
|
1042
|
-
* @return {?}
|
|
1043
|
-
*/
|
|
1044
|
-
OutletInteractionContext.prototype.confirm = /**
|
|
1045
|
-
* @param {?} confirm
|
|
1046
|
-
* @return {?}
|
|
1047
|
-
*/
|
|
1048
|
-
function (confirm) {
|
|
1049
|
-
return lang.notImplemented();
|
|
1050
|
-
};
|
|
1051
|
-
/**
|
|
1052
|
-
* @template D1, R1, E1
|
|
1053
|
-
* @param {?} activityType
|
|
1054
|
-
* @param {?=} data
|
|
1055
|
-
* @return {?}
|
|
1056
|
-
*/
|
|
1057
|
-
OutletInteractionContext.prototype.startActivity = /**
|
|
1058
|
-
* @template D1, R1, E1
|
|
1059
|
-
* @param {?} activityType
|
|
1060
|
-
* @param {?=} data
|
|
1061
|
-
* @return {?}
|
|
1062
|
-
*/
|
|
1063
|
-
function (activityType, data) {
|
|
1064
|
-
return lang.notImplemented();
|
|
1065
|
-
};
|
|
1066
|
-
return OutletInteractionContext;
|
|
1067
|
-
}());
|
|
1068
|
-
ActivityOutletComponent.OutletInteractionContext = OutletInteractionContext;
|
|
1069
|
-
if (false) {
|
|
1070
|
-
/**
|
|
1071
|
-
* @type {?}
|
|
1072
|
-
* @private
|
|
1073
|
-
*/
|
|
1074
|
-
OutletInteractionContext.prototype.context;
|
|
1075
|
-
}
|
|
1076
|
-
})(ActivityOutletComponent || (ActivityOutletComponent = {}));
|
|
1077
1085
|
|
|
1078
1086
|
/**
|
|
1079
1087
|
* @fileoverview added by tsickle
|
|
@@ -1082,7 +1090,10 @@ if (false) {
|
|
|
1082
1090
|
/**
|
|
1083
1091
|
* @template D, R, E
|
|
1084
1092
|
*/
|
|
1085
|
-
var
|
|
1093
|
+
var /**
|
|
1094
|
+
* @template D, R, E
|
|
1095
|
+
*/
|
|
1096
|
+
AbstractActivity = /** @class */ (function (_super) {
|
|
1086
1097
|
__extends(AbstractActivity, _super);
|
|
1087
1098
|
function AbstractActivity() {
|
|
1088
1099
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -1165,12 +1176,6 @@ var AbstractActivity = /** @class */ (function (_super) {
|
|
|
1165
1176
|
function () {
|
|
1166
1177
|
return this._busyModel.value;
|
|
1167
1178
|
};
|
|
1168
|
-
__decorate([
|
|
1169
|
-
Trace(),
|
|
1170
|
-
__metadata("design:type", Function),
|
|
1171
|
-
__metadata("design:paramtypes", [Object]),
|
|
1172
|
-
__metadata("design:returntype", void 0)
|
|
1173
|
-
], AbstractActivity.prototype, "initialise", null);
|
|
1174
1179
|
return AbstractActivity;
|
|
1175
1180
|
}(DisposableComponent));
|
|
1176
1181
|
if (false) {
|
|
@@ -1223,6 +1228,106 @@ if (false) {
|
|
|
1223
1228
|
AlertDialogComponent.prototype.alert;
|
|
1224
1229
|
}
|
|
1225
1230
|
|
|
1231
|
+
/**
|
|
1232
|
+
* @fileoverview added by tsickle
|
|
1233
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1234
|
+
*/
|
|
1235
|
+
/**
|
|
1236
|
+
* @template D, R, E
|
|
1237
|
+
*/
|
|
1238
|
+
var ConfirmThenDialogComponent = /** @class */ (function (_super) {
|
|
1239
|
+
__extends(ConfirmThenDialogComponent, _super);
|
|
1240
|
+
function ConfirmThenDialogComponent(config, interactionContext) {
|
|
1241
|
+
var _this = _super.call(this) || this;
|
|
1242
|
+
_this.config = config;
|
|
1243
|
+
_this.interactionContext = interactionContext;
|
|
1244
|
+
assert.notNil(config);
|
|
1245
|
+
return _this;
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* @return {?}
|
|
1249
|
+
*/
|
|
1250
|
+
ConfirmThenDialogComponent.prototype.ngOnInit = /**
|
|
1251
|
+
* @return {?}
|
|
1252
|
+
*/
|
|
1253
|
+
function () {
|
|
1254
|
+
};
|
|
1255
|
+
Object.defineProperty(ConfirmThenDialogComponent.prototype, "confirm", {
|
|
1256
|
+
get: /**
|
|
1257
|
+
* @return {?}
|
|
1258
|
+
*/
|
|
1259
|
+
function () {
|
|
1260
|
+
return this.config.confirm;
|
|
1261
|
+
},
|
|
1262
|
+
enumerable: true,
|
|
1263
|
+
configurable: true
|
|
1264
|
+
});
|
|
1265
|
+
/**
|
|
1266
|
+
* @return {?}
|
|
1267
|
+
*/
|
|
1268
|
+
ConfirmThenDialogComponent.prototype.isDestructive = /**
|
|
1269
|
+
* @return {?}
|
|
1270
|
+
*/
|
|
1271
|
+
function () {
|
|
1272
|
+
return this.confirm.destructive && this.confirm.destructive();
|
|
1273
|
+
};
|
|
1274
|
+
/**
|
|
1275
|
+
* @return {?}
|
|
1276
|
+
*/
|
|
1277
|
+
ConfirmThenDialogComponent.prototype.onConfirm = /**
|
|
1278
|
+
* @return {?}
|
|
1279
|
+
*/
|
|
1280
|
+
function () {
|
|
1281
|
+
var _this = this;
|
|
1282
|
+
this.interactionContext.startActivity(this.config.activityType, this.config.data)
|
|
1283
|
+
.then((/**
|
|
1284
|
+
* @param {?} result
|
|
1285
|
+
* @return {?}
|
|
1286
|
+
*/
|
|
1287
|
+
function (result) { return _this.done(result); }))
|
|
1288
|
+
.catch((/**
|
|
1289
|
+
* @param {?} error
|
|
1290
|
+
* @return {?}
|
|
1291
|
+
*/
|
|
1292
|
+
function (error) { return _this.cancel(error); }));
|
|
1293
|
+
};
|
|
1294
|
+
ConfirmThenDialogComponent.decorators = [
|
|
1295
|
+
{ type: Component, args: [{
|
|
1296
|
+
selector: 'angular-ui-powerups-confirmation-dialog',
|
|
1297
|
+
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",
|
|
1298
|
+
styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1299
|
+
}] }
|
|
1300
|
+
];
|
|
1301
|
+
/** @nocollapse */
|
|
1302
|
+
ConfirmThenDialogComponent.ctorParameters = function () { return [
|
|
1303
|
+
{ type: undefined, decorators: [{ type: Inject, args: [ACTIVITY_DATA,] }] },
|
|
1304
|
+
{ type: InteractionContext }
|
|
1305
|
+
]; };
|
|
1306
|
+
return ConfirmThenDialogComponent;
|
|
1307
|
+
}(AbstractActivity));
|
|
1308
|
+
if (false) {
|
|
1309
|
+
/** @type {?} */
|
|
1310
|
+
ConfirmThenDialogComponent.prototype.config;
|
|
1311
|
+
/** @type {?} */
|
|
1312
|
+
ConfirmThenDialogComponent.prototype.interactionContext;
|
|
1313
|
+
}
|
|
1314
|
+
(function (ConfirmThenDialogComponent) {
|
|
1315
|
+
/**
|
|
1316
|
+
* @record
|
|
1317
|
+
* @template D, R, E
|
|
1318
|
+
*/
|
|
1319
|
+
function Data() { }
|
|
1320
|
+
ConfirmThenDialogComponent.Data = Data;
|
|
1321
|
+
if (false) {
|
|
1322
|
+
/** @type {?} */
|
|
1323
|
+
Data.prototype.confirm;
|
|
1324
|
+
/** @type {?} */
|
|
1325
|
+
Data.prototype.activityType;
|
|
1326
|
+
/** @type {?} */
|
|
1327
|
+
Data.prototype.data;
|
|
1328
|
+
}
|
|
1329
|
+
})(ConfirmThenDialogComponent || (ConfirmThenDialogComponent = {}));
|
|
1330
|
+
|
|
1226
1331
|
/**
|
|
1227
1332
|
* @fileoverview added by tsickle
|
|
1228
1333
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -1281,8 +1386,28 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1281
1386
|
_this.activityOutletTabs = new MutableListModel();
|
|
1282
1387
|
_this.obsoleteTabs = [];
|
|
1283
1388
|
_this.finished = false;
|
|
1389
|
+
_this._activityList = new MutableListModel();
|
|
1284
1390
|
return _this;
|
|
1285
1391
|
}
|
|
1392
|
+
/**
|
|
1393
|
+
* @return {?}
|
|
1394
|
+
*/
|
|
1395
|
+
ActivityContainerComponent.prototype.isActive = /**
|
|
1396
|
+
* @return {?}
|
|
1397
|
+
*/
|
|
1398
|
+
function () {
|
|
1399
|
+
return this.parentInteractionContext.isActive();
|
|
1400
|
+
};
|
|
1401
|
+
Object.defineProperty(ActivityContainerComponent.prototype, "activityList", {
|
|
1402
|
+
get: /**
|
|
1403
|
+
* @return {?}
|
|
1404
|
+
*/
|
|
1405
|
+
function () {
|
|
1406
|
+
return this._activityList.readonly;
|
|
1407
|
+
},
|
|
1408
|
+
enumerable: true,
|
|
1409
|
+
configurable: true
|
|
1410
|
+
});
|
|
1286
1411
|
/**
|
|
1287
1412
|
* @return {?}
|
|
1288
1413
|
*/
|
|
@@ -1300,11 +1425,50 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1300
1425
|
function () {
|
|
1301
1426
|
var _this = this;
|
|
1302
1427
|
var observe = Dsl.disposeWith(this).observe;
|
|
1428
|
+
this._activityList.value = this.outlets.toArray().map((/**
|
|
1429
|
+
* @param {?} c
|
|
1430
|
+
* @return {?}
|
|
1431
|
+
*/
|
|
1432
|
+
function (c) { return c.component; }));
|
|
1433
|
+
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1434
|
+
* @param {?} change
|
|
1435
|
+
* @return {?}
|
|
1436
|
+
*/
|
|
1437
|
+
function (change) {
|
|
1438
|
+
_this.safelyUpdateActivityList(change.map((/**
|
|
1439
|
+
* @param {?} c
|
|
1440
|
+
* @return {?}
|
|
1441
|
+
*/
|
|
1442
|
+
function (c) { return c.component; })));
|
|
1443
|
+
}));
|
|
1303
1444
|
observe.valuesFrom(this.tabs.animationDone).subscribe((/**
|
|
1304
1445
|
* @return {?}
|
|
1305
1446
|
*/
|
|
1306
1447
|
function () { return _this.onAnimationFinished(); }));
|
|
1307
1448
|
};
|
|
1449
|
+
/**
|
|
1450
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1451
|
+
* @param activities
|
|
1452
|
+
*/
|
|
1453
|
+
/**
|
|
1454
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1455
|
+
* @private
|
|
1456
|
+
* @param {?} activities
|
|
1457
|
+
* @return {?}
|
|
1458
|
+
*/
|
|
1459
|
+
ActivityContainerComponent.prototype.safelyUpdateActivityList = /**
|
|
1460
|
+
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1461
|
+
* @private
|
|
1462
|
+
* @param {?} activities
|
|
1463
|
+
* @return {?}
|
|
1464
|
+
*/
|
|
1465
|
+
function (activities) {
|
|
1466
|
+
var _this = this;
|
|
1467
|
+
setTimeout((/**
|
|
1468
|
+
* @return {?}
|
|
1469
|
+
*/
|
|
1470
|
+
function () { return _this._activityList.value = activities; }));
|
|
1471
|
+
};
|
|
1308
1472
|
/**
|
|
1309
1473
|
* @template D, R, E
|
|
1310
1474
|
* @param {?} initialContext
|
|
@@ -1422,6 +1586,27 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1422
1586
|
function (confirm) {
|
|
1423
1587
|
return this.startActivity(ConfirmationDialogComponent, confirm);
|
|
1424
1588
|
};
|
|
1589
|
+
/**
|
|
1590
|
+
* @template D, R, E
|
|
1591
|
+
* @param {?} confirm
|
|
1592
|
+
* @param {?} activityType
|
|
1593
|
+
* @param {?=} data
|
|
1594
|
+
* @return {?}
|
|
1595
|
+
*/
|
|
1596
|
+
ActivityContainerComponent.prototype.confirmThen = /**
|
|
1597
|
+
* @template D, R, E
|
|
1598
|
+
* @param {?} confirm
|
|
1599
|
+
* @param {?} activityType
|
|
1600
|
+
* @param {?=} data
|
|
1601
|
+
* @return {?}
|
|
1602
|
+
*/
|
|
1603
|
+
function (confirm, activityType, data) {
|
|
1604
|
+
return this.startActivity(ConfirmThenDialogComponent, {
|
|
1605
|
+
confirm: confirm,
|
|
1606
|
+
activityType: activityType,
|
|
1607
|
+
data: data
|
|
1608
|
+
});
|
|
1609
|
+
};
|
|
1425
1610
|
/**
|
|
1426
1611
|
* @private
|
|
1427
1612
|
* @return {?}
|
|
@@ -1478,6 +1663,8 @@ if (false) {
|
|
|
1478
1663
|
/** @type {?} */
|
|
1479
1664
|
ActivityContainerComponent.prototype.initialActivityOutletContext;
|
|
1480
1665
|
/** @type {?} */
|
|
1666
|
+
ActivityContainerComponent.prototype.currentActivity;
|
|
1667
|
+
/** @type {?} */
|
|
1481
1668
|
ActivityContainerComponent.prototype.tabs;
|
|
1482
1669
|
/** @type {?} */
|
|
1483
1670
|
ActivityContainerComponent.prototype.outlets;
|
|
@@ -1493,6 +1680,11 @@ if (false) {
|
|
|
1493
1680
|
* @private
|
|
1494
1681
|
*/
|
|
1495
1682
|
ActivityContainerComponent.prototype.finished;
|
|
1683
|
+
/**
|
|
1684
|
+
* @type {?}
|
|
1685
|
+
* @private
|
|
1686
|
+
*/
|
|
1687
|
+
ActivityContainerComponent.prototype._activityList;
|
|
1496
1688
|
}
|
|
1497
1689
|
(function (ActivityContainerComponent) {
|
|
1498
1690
|
/**
|
|
@@ -1521,14 +1713,60 @@ if (false) {
|
|
|
1521
1713
|
var DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
|
|
1522
1714
|
var DialogInteractionService = /** @class */ (function (_super) {
|
|
1523
1715
|
__extends(DialogInteractionService, _super);
|
|
1524
|
-
function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1716
|
+
function DialogInteractionService(dialogService, router, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1525
1717
|
var _this = _super.call(this) || this;
|
|
1526
1718
|
_this.dialogService = dialogService;
|
|
1719
|
+
_this.router = router;
|
|
1527
1720
|
_this.dialogServiceDefaults = dialogServiceDefaults;
|
|
1528
1721
|
_this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
1722
|
+
_this._activityList = new DelegatingListModel();
|
|
1723
|
+
_this._active = false;
|
|
1529
1724
|
assert$1.notNil(dialogService);
|
|
1725
|
+
var _a = Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
|
|
1726
|
+
_this.currentActivity = chain(_this.activityList).last();
|
|
1530
1727
|
return _this;
|
|
1728
|
+
// observe.valuesFrom(this.router.events)
|
|
1729
|
+
// .tap((event:RouterEvent) => {
|
|
1730
|
+
// const nav = router.getCurrentNavigation();
|
|
1731
|
+
// console.log({
|
|
1732
|
+
// previousUrl: nav.previousNavigation && nav.previousNavigation.finalUrl,
|
|
1733
|
+
// initialUrl: nav.initialUrl,
|
|
1734
|
+
// finalUrl: nav.finalUrl,
|
|
1735
|
+
// });
|
|
1736
|
+
//
|
|
1737
|
+
// })
|
|
1738
|
+
// .filter(event => event instanceof NavigationStart)
|
|
1739
|
+
// .subscribe((event: NavigationStart) => {
|
|
1740
|
+
// console.log(event.navigationTrigger);
|
|
1741
|
+
// if (event.navigationTrigger === 'popstate' && this.isActive()) {
|
|
1742
|
+
// const prev = router.getCurrentNavigation().previousNavigation.finalUrl;
|
|
1743
|
+
// // this.router.navigateByUrl(prev.toString(), {
|
|
1744
|
+
// // replaceUrl: true,
|
|
1745
|
+
// // skipLocationChange: false
|
|
1746
|
+
// // });
|
|
1747
|
+
// // this.cancelActivity();
|
|
1748
|
+
// }
|
|
1749
|
+
// });
|
|
1531
1750
|
}
|
|
1751
|
+
/**
|
|
1752
|
+
* @return {?}
|
|
1753
|
+
*/
|
|
1754
|
+
DialogInteractionService.prototype.cancelActivity = /**
|
|
1755
|
+
* @return {?}
|
|
1756
|
+
*/
|
|
1757
|
+
function () {
|
|
1758
|
+
this.currentActivity.value.cancel(null);
|
|
1759
|
+
};
|
|
1760
|
+
Object.defineProperty(DialogInteractionService.prototype, "activityList", {
|
|
1761
|
+
get: /**
|
|
1762
|
+
* @return {?}
|
|
1763
|
+
*/
|
|
1764
|
+
function () {
|
|
1765
|
+
return this._activityList.readonly;
|
|
1766
|
+
},
|
|
1767
|
+
enumerable: true,
|
|
1768
|
+
configurable: true
|
|
1769
|
+
});
|
|
1532
1770
|
/**
|
|
1533
1771
|
* @template D, R, E
|
|
1534
1772
|
* @param {?} activityType
|
|
@@ -1563,8 +1801,18 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1563
1801
|
function (activityType, data, disableClose) {
|
|
1564
1802
|
var _this = this;
|
|
1565
1803
|
if (disableClose === void 0) { disableClose = true; }
|
|
1804
|
+
if (this.isActive()) {
|
|
1805
|
+
lang.illegalState("Activity already in progress: " + this.activityList.value.map((/**
|
|
1806
|
+
* @param {?} a
|
|
1807
|
+
* @return {?}
|
|
1808
|
+
*/
|
|
1809
|
+
function (a) { return a.constructor.name; })).join(', '));
|
|
1810
|
+
}
|
|
1811
|
+
this._active = true;
|
|
1566
1812
|
/** @type {?} */
|
|
1567
|
-
var
|
|
1813
|
+
var self = this;
|
|
1814
|
+
/** @type {?} */
|
|
1815
|
+
var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults, {
|
|
1568
1816
|
data: data,
|
|
1569
1817
|
disableClose: disableClose,
|
|
1570
1818
|
panelClass: 'dialog-interaction-service'
|
|
@@ -1580,6 +1828,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1580
1828
|
/** @type {?} */
|
|
1581
1829
|
var activityContainer = matDialogRef.componentInstance;
|
|
1582
1830
|
activityContainer.parentInteractionContext = _this;
|
|
1831
|
+
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
1583
1832
|
activityContainer.initialise({
|
|
1584
1833
|
activityClass: activityType,
|
|
1585
1834
|
activityData: data,
|
|
@@ -1603,8 +1852,35 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1603
1852
|
}
|
|
1604
1853
|
});
|
|
1605
1854
|
matDialogRef.updateSize();
|
|
1855
|
+
})).finally((/**
|
|
1856
|
+
* @return {?}
|
|
1857
|
+
*/
|
|
1858
|
+
function () {
|
|
1859
|
+
self.safelyUpdateActivityListDelegate(null);
|
|
1860
|
+
self._active = false;
|
|
1606
1861
|
}));
|
|
1607
1862
|
};
|
|
1863
|
+
/**
|
|
1864
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
1865
|
+
* @param delegate
|
|
1866
|
+
*/
|
|
1867
|
+
/**
|
|
1868
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
1869
|
+
* @param {?} delegate
|
|
1870
|
+
* @return {?}
|
|
1871
|
+
*/
|
|
1872
|
+
DialogInteractionService.prototype.safelyUpdateActivityListDelegate = /**
|
|
1873
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
1874
|
+
* @param {?} delegate
|
|
1875
|
+
* @return {?}
|
|
1876
|
+
*/
|
|
1877
|
+
function (delegate) {
|
|
1878
|
+
var _this = this;
|
|
1879
|
+
setTimeout((/**
|
|
1880
|
+
* @return {?}
|
|
1881
|
+
*/
|
|
1882
|
+
function () { return _this._activityList.setDelegate(delegate); }));
|
|
1883
|
+
};
|
|
1608
1884
|
/**
|
|
1609
1885
|
* @param {?} alert
|
|
1610
1886
|
* @return {?}
|
|
@@ -1627,6 +1903,27 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1627
1903
|
function (confirm) {
|
|
1628
1904
|
return this._startActivity(ConfirmationDialogComponent, confirm, true);
|
|
1629
1905
|
};
|
|
1906
|
+
/**
|
|
1907
|
+
* @template D, R, E
|
|
1908
|
+
* @param {?} confirm
|
|
1909
|
+
* @param {?} activityType
|
|
1910
|
+
* @param {?=} data
|
|
1911
|
+
* @return {?}
|
|
1912
|
+
*/
|
|
1913
|
+
DialogInteractionService.prototype.confirmThen = /**
|
|
1914
|
+
* @template D, R, E
|
|
1915
|
+
* @param {?} confirm
|
|
1916
|
+
* @param {?} activityType
|
|
1917
|
+
* @param {?=} data
|
|
1918
|
+
* @return {?}
|
|
1919
|
+
*/
|
|
1920
|
+
function (confirm, activityType, data) {
|
|
1921
|
+
return this._startActivity(ConfirmThenDialogComponent, {
|
|
1922
|
+
confirm: confirm,
|
|
1923
|
+
activityType: activityType,
|
|
1924
|
+
data: data
|
|
1925
|
+
}, true);
|
|
1926
|
+
};
|
|
1630
1927
|
DialogInteractionService.decorators = [
|
|
1631
1928
|
{ type: Injectable, args: [{
|
|
1632
1929
|
providedIn: 'root'
|
|
@@ -1635,18 +1932,36 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1635
1932
|
/** @nocollapse */
|
|
1636
1933
|
DialogInteractionService.ctorParameters = function () { return [
|
|
1637
1934
|
{ type: MatDialog },
|
|
1935
|
+
{ type: Router },
|
|
1638
1936
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
1639
1937
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
1640
1938
|
]; };
|
|
1641
|
-
/** @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" });
|
|
1939
|
+
/** @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" });
|
|
1642
1940
|
return DialogInteractionService;
|
|
1643
1941
|
}(InteractionContext));
|
|
1644
1942
|
if (false) {
|
|
1943
|
+
/** @type {?} */
|
|
1944
|
+
DialogInteractionService.prototype.currentActivity;
|
|
1945
|
+
/**
|
|
1946
|
+
* @type {?}
|
|
1947
|
+
* @private
|
|
1948
|
+
*/
|
|
1949
|
+
DialogInteractionService.prototype._activityList;
|
|
1950
|
+
/**
|
|
1951
|
+
* @type {?}
|
|
1952
|
+
* @private
|
|
1953
|
+
*/
|
|
1954
|
+
DialogInteractionService.prototype._active;
|
|
1645
1955
|
/**
|
|
1646
1956
|
* @type {?}
|
|
1647
1957
|
* @private
|
|
1648
1958
|
*/
|
|
1649
1959
|
DialogInteractionService.prototype.dialogService;
|
|
1960
|
+
/**
|
|
1961
|
+
* @type {?}
|
|
1962
|
+
* @private
|
|
1963
|
+
*/
|
|
1964
|
+
DialogInteractionService.prototype.router;
|
|
1650
1965
|
/** @type {?} */
|
|
1651
1966
|
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
1652
1967
|
/** @type {?} */
|
|
@@ -1672,16 +1987,18 @@ var InteractionModule = /** @class */ (function () {
|
|
|
1672
1987
|
declarations: [
|
|
1673
1988
|
ActivityContainerComponent,
|
|
1674
1989
|
ConfirmationDialogComponent,
|
|
1990
|
+
ConfirmThenDialogComponent,
|
|
1675
1991
|
AlertDialogComponent,
|
|
1676
1992
|
ActivityOutletComponent
|
|
1677
1993
|
],
|
|
1678
1994
|
exports: [
|
|
1679
1995
|
ActivityContainerComponent,
|
|
1680
|
-
ActivityOutletComponent
|
|
1996
|
+
ActivityOutletComponent,
|
|
1681
1997
|
],
|
|
1682
1998
|
entryComponents: [
|
|
1683
1999
|
ActivityContainerComponent,
|
|
1684
2000
|
ConfirmationDialogComponent,
|
|
2001
|
+
ConfirmThenDialogComponent,
|
|
1685
2002
|
AlertDialogComponent
|
|
1686
2003
|
],
|
|
1687
2004
|
providers: [
|
|
@@ -4125,6 +4442,65 @@ if (false) {
|
|
|
4125
4442
|
ActivityOutletContext.prototype.onCancel;
|
|
4126
4443
|
}
|
|
4127
4444
|
|
|
4445
|
+
/**
|
|
4446
|
+
* @fileoverview added by tsickle
|
|
4447
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4448
|
+
*/
|
|
4449
|
+
var CloseInteractionGuard = /** @class */ (function () {
|
|
4450
|
+
function CloseInteractionGuard(router, injector, interactionContext) {
|
|
4451
|
+
this.router = router;
|
|
4452
|
+
this.injector = injector;
|
|
4453
|
+
this.interactionContext = interactionContext;
|
|
4454
|
+
}
|
|
4455
|
+
/**
|
|
4456
|
+
* @param {?} component
|
|
4457
|
+
* @param {?} currentRoute
|
|
4458
|
+
* @param {?} currentState
|
|
4459
|
+
* @param {?=} nextState
|
|
4460
|
+
* @return {?}
|
|
4461
|
+
*/
|
|
4462
|
+
CloseInteractionGuard.prototype.canDeactivate = /**
|
|
4463
|
+
* @param {?} component
|
|
4464
|
+
* @param {?} currentRoute
|
|
4465
|
+
* @param {?} currentState
|
|
4466
|
+
* @param {?=} nextState
|
|
4467
|
+
* @return {?}
|
|
4468
|
+
*/
|
|
4469
|
+
function (component, currentRoute, currentState, nextState) {
|
|
4470
|
+
return !this.interactionContext.isActive();
|
|
4471
|
+
};
|
|
4472
|
+
CloseInteractionGuard.decorators = [
|
|
4473
|
+
{ type: Injectable, args: [{
|
|
4474
|
+
providedIn: 'root'
|
|
4475
|
+
},] }
|
|
4476
|
+
];
|
|
4477
|
+
/** @nocollapse */
|
|
4478
|
+
CloseInteractionGuard.ctorParameters = function () { return [
|
|
4479
|
+
{ type: Router },
|
|
4480
|
+
{ type: Injector },
|
|
4481
|
+
{ type: InteractionContext }
|
|
4482
|
+
]; };
|
|
4483
|
+
/** @nocollapse */ CloseInteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function CloseInteractionGuard_Factory() { return new CloseInteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: CloseInteractionGuard, providedIn: "root" });
|
|
4484
|
+
return CloseInteractionGuard;
|
|
4485
|
+
}());
|
|
4486
|
+
if (false) {
|
|
4487
|
+
/**
|
|
4488
|
+
* @type {?}
|
|
4489
|
+
* @private
|
|
4490
|
+
*/
|
|
4491
|
+
CloseInteractionGuard.prototype.router;
|
|
4492
|
+
/**
|
|
4493
|
+
* @type {?}
|
|
4494
|
+
* @private
|
|
4495
|
+
*/
|
|
4496
|
+
CloseInteractionGuard.prototype.injector;
|
|
4497
|
+
/**
|
|
4498
|
+
* @type {?}
|
|
4499
|
+
* @private
|
|
4500
|
+
*/
|
|
4501
|
+
CloseInteractionGuard.prototype.interactionContext;
|
|
4502
|
+
}
|
|
4503
|
+
|
|
4128
4504
|
/**
|
|
4129
4505
|
* @fileoverview added by tsickle
|
|
4130
4506
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4226,9 +4602,33 @@ if (false) {
|
|
|
4226
4602
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4227
4603
|
*/
|
|
4228
4604
|
var LeavePlaceGuard = /** @class */ (function () {
|
|
4229
|
-
function LeavePlaceGuard(router, injector) {
|
|
4605
|
+
function LeavePlaceGuard(router, injector, interactionContext, location) {
|
|
4230
4606
|
this.router = router;
|
|
4231
4607
|
this.injector = injector;
|
|
4608
|
+
this.interactionContext = interactionContext;
|
|
4609
|
+
this.location = location;
|
|
4610
|
+
// TODO: should probably replace this with a RouteTracker thingy.
|
|
4611
|
+
this._alreadyAccepted = [];
|
|
4612
|
+
console.log('***** Created new guard ******');
|
|
4613
|
+
/** @type {?} */
|
|
4614
|
+
var self = this;
|
|
4615
|
+
this.router.events.subscribe((/**
|
|
4616
|
+
* @param {?} event
|
|
4617
|
+
* @return {?}
|
|
4618
|
+
*/
|
|
4619
|
+
function (event) {
|
|
4620
|
+
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
4621
|
+
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
4622
|
+
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
4623
|
+
if (event instanceof NavigationEnd) {
|
|
4624
|
+
console.log("navigation ended");
|
|
4625
|
+
self._alreadyAccepted = [];
|
|
4626
|
+
}
|
|
4627
|
+
if (event instanceof NavigationError) {
|
|
4628
|
+
console.log("navigation errored");
|
|
4629
|
+
self._alreadyAccepted = [];
|
|
4630
|
+
}
|
|
4631
|
+
}));
|
|
4232
4632
|
}
|
|
4233
4633
|
/**
|
|
4234
4634
|
* @param {?} component
|
|
@@ -4245,27 +4645,90 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4245
4645
|
* @return {?}
|
|
4246
4646
|
*/
|
|
4247
4647
|
function (component, currentRoute, currentState, nextState) {
|
|
4248
|
-
|
|
4648
|
+
var _this = this;
|
|
4249
4649
|
/** @type {?} */
|
|
4250
|
-
var
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
//
|
|
4258
|
-
//
|
|
4259
|
-
//
|
|
4260
|
-
//
|
|
4261
|
-
//
|
|
4262
|
-
|
|
4263
|
-
|
|
4650
|
+
var placeDefinitionPath = "/" + component.placeDefinition.path;
|
|
4651
|
+
console.log('canDeactivate', {
|
|
4652
|
+
staticPath: placeDefinitionPath,
|
|
4653
|
+
currentStateUrl: currentState.url,
|
|
4654
|
+
nextStateUrl: nextState.url,
|
|
4655
|
+
alreadyDeclined: this._alreadyAccepted
|
|
4656
|
+
});
|
|
4657
|
+
// Example of the above when navigating to a different child route.
|
|
4658
|
+
// canDeactivate {staticPath: "/hero-details",
|
|
4659
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
4660
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
4661
|
+
// }
|
|
4662
|
+
// Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
|
|
4663
|
+
// canDeactivate {
|
|
4664
|
+
// staticPath: "/hero-stats",
|
|
4665
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4666
|
+
// nextStateUrl: "/route-parameters/"
|
|
4667
|
+
// }
|
|
4668
|
+
// canDeactivate {
|
|
4669
|
+
// staticPath: "/route-parameters",
|
|
4670
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4671
|
+
// nextStateUrl: "/route-parameters/"
|
|
4672
|
+
// }
|
|
4673
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
4674
|
+
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
4675
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4676
|
+
// canDeactivate {
|
|
4677
|
+
// staticPath: "/hero-stats",
|
|
4678
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4679
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
4680
|
+
// }
|
|
4681
|
+
// canDeactivate {
|
|
4682
|
+
// staticPath: "/route-parameters",
|
|
4683
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4684
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
4685
|
+
// }
|
|
4686
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
4687
|
+
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
4688
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4689
|
+
// canDeactivate {
|
|
4690
|
+
// staticPath: "/hero-stats",
|
|
4691
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4692
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4693
|
+
// }
|
|
4694
|
+
// HACK: this will break with child routes...
|
|
4695
|
+
if (this.alreadyAccepted(component)) {
|
|
4696
|
+
return true;
|
|
4264
4697
|
}
|
|
4265
4698
|
else {
|
|
4699
|
+
if (!nextState.url.startsWith(placeDefinitionPath)) {
|
|
4700
|
+
/** @type {?} */
|
|
4701
|
+
var self_1 = this;
|
|
4702
|
+
return Promise.resolve(component.canDeactivate()).then((/**
|
|
4703
|
+
* @param {?} canLeave
|
|
4704
|
+
* @return {?}
|
|
4705
|
+
*/
|
|
4706
|
+
function (canLeave) {
|
|
4707
|
+
if (!canLeave) {
|
|
4708
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4709
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4710
|
+
_this.location.go(currentState.url);
|
|
4711
|
+
}
|
|
4712
|
+
else {
|
|
4713
|
+
self_1._alreadyAccepted.push(component);
|
|
4714
|
+
}
|
|
4715
|
+
return canLeave;
|
|
4716
|
+
}));
|
|
4717
|
+
}
|
|
4266
4718
|
return true;
|
|
4267
4719
|
}
|
|
4268
4720
|
};
|
|
4721
|
+
/**
|
|
4722
|
+
* @param {?} placeComponent
|
|
4723
|
+
* @return {?}
|
|
4724
|
+
*/
|
|
4725
|
+
LeavePlaceGuard.prototype.alreadyAccepted = /**
|
|
4726
|
+
* @param {?} placeComponent
|
|
4727
|
+
* @return {?}
|
|
4728
|
+
*/
|
|
4729
|
+
function (placeComponent) {
|
|
4730
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
4731
|
+
};
|
|
4269
4732
|
LeavePlaceGuard.decorators = [
|
|
4270
4733
|
{ type: Injectable, args: [{
|
|
4271
4734
|
providedIn: 'root'
|
|
@@ -4274,12 +4737,25 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4274
4737
|
/** @nocollapse */
|
|
4275
4738
|
LeavePlaceGuard.ctorParameters = function () { return [
|
|
4276
4739
|
{ type: Router },
|
|
4277
|
-
{ type: Injector }
|
|
4740
|
+
{ type: Injector },
|
|
4741
|
+
{ type: InteractionContext },
|
|
4742
|
+
{ type: Location }
|
|
4278
4743
|
]; };
|
|
4279
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4744
|
+
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4745
|
+
__decorate([
|
|
4746
|
+
Trace(),
|
|
4747
|
+
__metadata("design:type", Function),
|
|
4748
|
+
__metadata("design:paramtypes", [PlaceComponent]),
|
|
4749
|
+
__metadata("design:returntype", Boolean)
|
|
4750
|
+
], LeavePlaceGuard.prototype, "alreadyAccepted", null);
|
|
4280
4751
|
return LeavePlaceGuard;
|
|
4281
4752
|
}());
|
|
4282
4753
|
if (false) {
|
|
4754
|
+
/**
|
|
4755
|
+
* @type {?}
|
|
4756
|
+
* @private
|
|
4757
|
+
*/
|
|
4758
|
+
LeavePlaceGuard.prototype._alreadyAccepted;
|
|
4283
4759
|
/**
|
|
4284
4760
|
* @type {?}
|
|
4285
4761
|
* @private
|
|
@@ -4290,6 +4766,10 @@ if (false) {
|
|
|
4290
4766
|
* @private
|
|
4291
4767
|
*/
|
|
4292
4768
|
LeavePlaceGuard.prototype.injector;
|
|
4769
|
+
/** @type {?} */
|
|
4770
|
+
LeavePlaceGuard.prototype.interactionContext;
|
|
4771
|
+
/** @type {?} */
|
|
4772
|
+
LeavePlaceGuard.prototype.location;
|
|
4293
4773
|
}
|
|
4294
4774
|
|
|
4295
4775
|
/**
|
|
@@ -4598,5 +5078,5 @@ var ParameterType;
|
|
|
4598
5078
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4599
5079
|
*/
|
|
4600
5080
|
|
|
4601
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective,
|
|
5081
|
+
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 };
|
|
4602
5082
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|