@coolon/angular-ui-powerups 0.0.65 → 0.0.67
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 +57 -11
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/interaction/activity.js +4 -3
- package/esm2015/lib/place/guards/leave-place.guard.js +57 -22
- package/esm2015/lib/place/place-router.js +4 -1
- package/esm5/lib/interaction/activity.js +9 -5
- package/esm5/lib/place/guards/leave-place.guard.js +52 -10
- package/esm5/lib/place/place-router.js +4 -1
- package/fesm2015/coolon-angular-ui-powerups.js +60 -23
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +59 -13
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/activity.d.ts +2 -2
- package/lib/place/guards/leave-place.guard.d.ts +1 -0
- package/lib/place/place-router.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1068,9 +1068,12 @@
|
|
|
1068
1068
|
* @abstract
|
|
1069
1069
|
* @template D, R, E
|
|
1070
1070
|
*/
|
|
1071
|
-
exports.ɵba = /** @class */ (function () {
|
|
1071
|
+
exports.ɵba = /** @class */ (function (_super) {
|
|
1072
|
+
__extends(Activity, _super);
|
|
1072
1073
|
function Activity() {
|
|
1073
|
-
|
|
1074
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1075
|
+
_this._busyModel = new pectin.DelegatingValueModel().withDefault(false);
|
|
1076
|
+
return _this;
|
|
1074
1077
|
}
|
|
1075
1078
|
/**
|
|
1076
1079
|
* @param {?} activityContext
|
|
@@ -1149,7 +1152,7 @@
|
|
|
1149
1152
|
return this._busyModel.value;
|
|
1150
1153
|
};
|
|
1151
1154
|
return Activity;
|
|
1152
|
-
}());
|
|
1155
|
+
}(pectin.GarbageCollector));
|
|
1153
1156
|
if (false) {
|
|
1154
1157
|
/**
|
|
1155
1158
|
* @type {?}
|
|
@@ -2919,6 +2922,7 @@
|
|
|
2919
2922
|
function PlaceRouter(router$1, angularLocation) {
|
|
2920
2923
|
var _this = this;
|
|
2921
2924
|
this.router = router$1;
|
|
2925
|
+
this.angularLocation = angularLocation;
|
|
2922
2926
|
this._navigationSession = new pectin.MutableValueModel();
|
|
2923
2927
|
angularLocation.onUrlChange((/**
|
|
2924
2928
|
* @param {?} url
|
|
@@ -3061,6 +3065,8 @@
|
|
|
3061
3065
|
* @private
|
|
3062
3066
|
*/
|
|
3063
3067
|
PlaceRouter.prototype.router;
|
|
3068
|
+
/** @type {?} */
|
|
3069
|
+
PlaceRouter.prototype.angularLocation;
|
|
3064
3070
|
}
|
|
3065
3071
|
|
|
3066
3072
|
/**
|
|
@@ -5017,6 +5023,22 @@
|
|
|
5017
5023
|
this.interactionContext = interactionContext;
|
|
5018
5024
|
this.angularLocation = angularLocation;
|
|
5019
5025
|
}
|
|
5026
|
+
/**
|
|
5027
|
+
* @private
|
|
5028
|
+
* @param {?} nextState
|
|
5029
|
+
* @param {?} placeDefinitionPath
|
|
5030
|
+
* @return {?}
|
|
5031
|
+
*/
|
|
5032
|
+
LeavePlaceGuard.prototype.isLeavingTheCurrentPlace = /**
|
|
5033
|
+
* @private
|
|
5034
|
+
* @param {?} nextState
|
|
5035
|
+
* @param {?} placeDefinitionPath
|
|
5036
|
+
* @return {?}
|
|
5037
|
+
*/
|
|
5038
|
+
function (nextState, placeDefinitionPath) {
|
|
5039
|
+
// TODO: this will break with child routes... need to examine the router states properly.
|
|
5040
|
+
return !nextState.url.startsWith(placeDefinitionPath);
|
|
5041
|
+
};
|
|
5020
5042
|
/**
|
|
5021
5043
|
* @param {?} component
|
|
5022
5044
|
* @param {?} currentRoute
|
|
@@ -5039,23 +5061,42 @@
|
|
|
5039
5061
|
case 0:
|
|
5040
5062
|
placeDefinitionPath = "/" + component.placeDefinition.path;
|
|
5041
5063
|
if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
|
|
5064
|
+
// We'll get called multiple times if there's any parameter sanitisation so
|
|
5065
|
+
// we always return true if we accepted on a previous cycle of the current
|
|
5066
|
+
// navigation session.
|
|
5042
5067
|
return [2 /*return*/, true];
|
|
5043
5068
|
case 1:
|
|
5044
|
-
if (!!nextState.url.startsWith(placeDefinitionPath)) return [3 /*break*/, 3];
|
|
5045
5069
|
self_1 = this;
|
|
5070
|
+
canLeave = true;
|
|
5071
|
+
if (!this.isLeavingTheCurrentPlace(nextState, placeDefinitionPath)) return [3 /*break*/, 4];
|
|
5072
|
+
// we check the interaction first, so that components that don't need to check if they're in an
|
|
5073
|
+
// interaction during the canDeactivate cycle.
|
|
5074
|
+
if (this.interactionContext.isActive()) {
|
|
5075
|
+
canLeave = false;
|
|
5076
|
+
console.log("cancelling", { activity: this.interactionContext.currentActivity });
|
|
5077
|
+
this.interactionContext.currentActivity.cancel(null);
|
|
5078
|
+
}
|
|
5079
|
+
if (!canLeave) return [3 /*break*/, 3];
|
|
5046
5080
|
return [4 /*yield*/, component.canDeactivate()];
|
|
5047
5081
|
case 2:
|
|
5048
5082
|
canLeave = _a.sent();
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5083
|
+
_a.label = 3;
|
|
5084
|
+
case 3: return [3 /*break*/, 5];
|
|
5085
|
+
case 4:
|
|
5086
|
+
// this is a parameter change.
|
|
5087
|
+
if (this.interactionContext.isActive()) {
|
|
5053
5088
|
console.log("cancelling", { activity: this.interactionContext.currentActivity });
|
|
5054
5089
|
this.interactionContext.currentActivity.cancel(null);
|
|
5090
|
+
canLeave = false;
|
|
5055
5091
|
}
|
|
5056
|
-
|
|
5057
|
-
|
|
5092
|
+
else {
|
|
5093
|
+
canLeave = true;
|
|
5094
|
+
}
|
|
5095
|
+
_a.label = 5;
|
|
5096
|
+
case 5:
|
|
5058
5097
|
if (canLeave) {
|
|
5098
|
+
// We'll get called multiple times if there's any parameter sanitisation so
|
|
5099
|
+
// we remember the acceptance for the duration of the current routing session.
|
|
5059
5100
|
self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
5060
5101
|
}
|
|
5061
5102
|
else {
|
|
@@ -5067,7 +5108,6 @@
|
|
|
5067
5108
|
}
|
|
5068
5109
|
}
|
|
5069
5110
|
return [2 /*return*/, canLeave];
|
|
5070
|
-
case 3: return [2 /*return*/, true];
|
|
5071
5111
|
}
|
|
5072
5112
|
});
|
|
5073
5113
|
});
|
|
@@ -5086,6 +5126,12 @@
|
|
|
5086
5126
|
{ type: common.Location }
|
|
5087
5127
|
]; };
|
|
5088
5128
|
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(PlaceRouter), core.ɵɵinject(InteractionContext), core.ɵɵinject(common.Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
5129
|
+
__decorate([
|
|
5130
|
+
pectin.Trace(),
|
|
5131
|
+
__metadata("design:type", Function),
|
|
5132
|
+
__metadata("design:paramtypes", [exports.PlaceComponent, router.ActivatedRouteSnapshot, router.RouterStateSnapshot, router.RouterStateSnapshot]),
|
|
5133
|
+
__metadata("design:returntype", Promise)
|
|
5134
|
+
], LeavePlaceGuard.prototype, "canDeactivate", null);
|
|
5089
5135
|
return LeavePlaceGuard;
|
|
5090
5136
|
}());
|
|
5091
5137
|
if (false) {
|