@coolon/angular-ui-powerups 0.0.97 → 0.0.98
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 +99 -241
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +2 -2
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -2
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +6 -5
- package/esm2015/lib/place/guards/navigation-state.js +613 -0
- package/esm2015/lib/place/guards/place-component-deactivation-handler.js +14 -37
- package/esm2015/lib/place/index.js +2 -2
- package/esm2015/lib/place/place-router.js +11 -54
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +2 -2
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -2
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +6 -5
- package/esm5/lib/place/guards/navigation-state.js +764 -0
- package/esm5/lib/place/guards/place-component-deactivation-handler.js +21 -55
- package/esm5/lib/place/index.js +2 -2
- package/esm5/lib/place/place-router.js +12 -144
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +80 -122
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +101 -243
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -1
- package/lib/place/guards/{navigation-session.d.ts → navigation-state.d.ts} +34 -34
- package/lib/place/guards/place-component-deactivation-handler.d.ts +3 -5
- package/lib/place/index.d.ts +1 -1
- package/lib/place/place-router.d.ts +4 -4
- package/package.json +1 -1
- package/esm2015/lib/place/guards/navigation-session.js +0 -590
- package/esm5/lib/place/guards/navigation-session.js +0 -741
|
@@ -2184,7 +2184,7 @@
|
|
|
2184
2184
|
* @return {?}
|
|
2185
2185
|
*/
|
|
2186
2186
|
function () {
|
|
2187
|
-
this._initialActivityOutletContext = null;
|
|
2187
|
+
this._initialActivityOutletContext.value = null;
|
|
2188
2188
|
this.initialActivityOutletContextEvent.emit(null);
|
|
2189
2189
|
};
|
|
2190
2190
|
// @Trace()
|
|
@@ -2361,8 +2361,7 @@
|
|
|
2361
2361
|
__extends(InplaceInteractionContextComponent, _super);
|
|
2362
2362
|
function InplaceInteractionContextComponent() {
|
|
2363
2363
|
var _this = _super.call(this) || this;
|
|
2364
|
-
_this._active = new pectin.
|
|
2365
|
-
var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
2364
|
+
_this._active = new pectin.MutableValueModel(false);
|
|
2366
2365
|
return _this;
|
|
2367
2366
|
}
|
|
2368
2367
|
/**
|
|
@@ -2373,7 +2372,6 @@
|
|
|
2373
2372
|
*/
|
|
2374
2373
|
function () {
|
|
2375
2374
|
this.setActivityList(this.interactionContext.activityList);
|
|
2376
|
-
this._active.setDelegate(this.interactionContext.active);
|
|
2377
2375
|
};
|
|
2378
2376
|
Object.defineProperty(InplaceInteractionContextComponent.prototype, "active", {
|
|
2379
2377
|
get: /**
|
|
@@ -2401,6 +2399,7 @@
|
|
|
2401
2399
|
*/
|
|
2402
2400
|
function (activityType, data) {
|
|
2403
2401
|
var _this = this;
|
|
2402
|
+
this._active.value = true;
|
|
2404
2403
|
/** @type {?} */
|
|
2405
2404
|
var self = this;
|
|
2406
2405
|
return new Promise((/**
|
|
@@ -2417,6 +2416,7 @@
|
|
|
2417
2416
|
* @return {?}
|
|
2418
2417
|
*/
|
|
2419
2418
|
function (result) {
|
|
2419
|
+
self._active.value = false;
|
|
2420
2420
|
resolve(result);
|
|
2421
2421
|
},
|
|
2422
2422
|
onCancel: /**
|
|
@@ -2424,6 +2424,7 @@
|
|
|
2424
2424
|
* @return {?}
|
|
2425
2425
|
*/
|
|
2426
2426
|
function (error) {
|
|
2427
|
+
self._active.value = false;
|
|
2427
2428
|
reject(error);
|
|
2428
2429
|
}
|
|
2429
2430
|
};
|
|
@@ -4014,67 +4015,33 @@
|
|
|
4014
4015
|
* @return {?}
|
|
4015
4016
|
*/
|
|
4016
4017
|
function (nextState) {
|
|
4017
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4018
|
-
return __generator(this, function (_a) {
|
|
4019
|
-
// Automatically cancel any active activities if the navigation session was triggered
|
|
4020
|
-
// by the back button.
|
|
4021
|
-
if (this.navigationSession.isPopState && this.component.interactionContext && this.component.interactionContext.isActive()) {
|
|
4022
|
-
// Note: any modal interactions run in a different router outlet so we should never get place deactivated while
|
|
4023
|
-
// one is active. This is because:
|
|
4024
|
-
// 1. the user can't click anything to navigate away
|
|
4025
|
-
// 2. clicking the back button will only change the outlet route and will leave the component route alone. This
|
|
4026
|
-
// is all handled by the InteractionGuard and so the component guards will never run.
|
|
4027
|
-
// TODO: how will I handle this now??
|
|
4028
|
-
// BUT: activities could call navigate while they're still active.. but we'll barf and tell them
|
|
4029
|
-
// to call activity.done(newVisitToNavigateTo) and let the caller do the navigate after the
|
|
4030
|
-
// dialog has closed.
|
|
4031
|
-
// Can I capture this in placeRouter.navigate(..) ? i.e. navigationSession && navigationSession.interactionContext.isActive()
|
|
4032
|
-
// Or can I just ignore it altogether?
|
|
4033
|
-
// 1. I no longer have a singleton dialog interaction that can be returned from any component in the deactivation cycle.
|
|
4034
|
-
// 2. We only ever check the component once per nav cycle
|
|
4035
|
-
// 3. The navigation session interaction context will barf if multiple components try and use it at once.
|
|
4036
|
-
// if (this.component.interactionContext instanceof DialogInteractionContext) {
|
|
4037
|
-
// // BUT: activities could call navigate while they're still active.. but we'll barf and tell them
|
|
4038
|
-
// // to call activity.done(newVisitToNavigateTo) and let the caller do the navigate after the
|
|
4039
|
-
// // dialog has closed.
|
|
4040
|
-
// lang.illegalState('Navigation started from an activity in a modal dialog. Have your activity return a Visit instead and navigate after the activity has finished');
|
|
4041
|
-
// }
|
|
4042
|
-
// Now we just cancel the current activity and stay where we are
|
|
4043
|
-
this.cancelCurrentActivityOf(this.component.interactionContext);
|
|
4044
|
-
return [2 /*return*/, false];
|
|
4045
|
-
}
|
|
4046
|
-
// Ok, so now we're really leaving, so we ask the component if we should.;
|
|
4047
|
-
if (this.isNotJustAChangeInRouteId(nextState) && this.component.canDeactivate) {
|
|
4048
|
-
// No interaction in progress, so ask the component .
|
|
4049
|
-
// This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
|
|
4050
|
-
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
|
|
4051
|
-
return [2 /*return*/, this.component.canDeactivate(this.navigationSession.interactionContext)];
|
|
4052
|
-
}
|
|
4053
|
-
return [2 /*return*/, true];
|
|
4054
|
-
});
|
|
4055
|
-
});
|
|
4056
|
-
};
|
|
4057
|
-
/**
|
|
4058
|
-
* @protected
|
|
4059
|
-
* @param {?} interactionContext
|
|
4060
|
-
* @return {?}
|
|
4061
|
-
*/
|
|
4062
|
-
PlaceComponentDeactivationHandler.prototype.cancelCurrentActivityOf = /**
|
|
4063
|
-
* @protected
|
|
4064
|
-
* @param {?} interactionContext
|
|
4065
|
-
* @return {?}
|
|
4066
|
-
*/
|
|
4067
|
-
function (interactionContext) {
|
|
4068
4018
|
return __awaiter(this, void 0, void 0, function () {
|
|
4069
4019
|
var activity;
|
|
4070
4020
|
return __generator(this, function (_a) {
|
|
4071
4021
|
switch (_a.label) {
|
|
4072
|
-
case 0:
|
|
4022
|
+
case 0:
|
|
4023
|
+
if (!(this.navigationSession.isPopState && this.component.interactionContext && this.component.interactionContext.isActive())) return [3 /*break*/, 2];
|
|
4024
|
+
// Note: Modal interactions are run in a different router outlet so we never get place deactivating while
|
|
4025
|
+
// a model interaction is active. This is because:
|
|
4026
|
+
// 1. the user can't click anything to navigate away
|
|
4027
|
+
// 2. clicking the back button will only change the outlet route portion of the URL. This
|
|
4028
|
+
// is all handled by the InteractionGuard and so the component guards will never run.
|
|
4029
|
+
//
|
|
4030
|
+
// Now we just cancel the current activity...
|
|
4031
|
+
return [4 /*yield*/, this.component.interactionContext.getCurrentActivity()];
|
|
4073
4032
|
case 1:
|
|
4074
4033
|
activity = _a.sent();
|
|
4075
|
-
console.log('cancelling', { activity: activity });
|
|
4076
4034
|
activity.cancel(null);
|
|
4077
|
-
return [2 /*return
|
|
4035
|
+
return [2 /*return*/, false]; // ..and stay where we are.
|
|
4036
|
+
case 2:
|
|
4037
|
+
// Ok, so now we're really leaving, so we ask the component if we should.;
|
|
4038
|
+
if (this.isNotJustAChangeInRouteId(nextState) && this.component.canDeactivate) {
|
|
4039
|
+
// No interaction in progress, so ask the component .
|
|
4040
|
+
// This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
|
|
4041
|
+
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
|
|
4042
|
+
return [2 /*return*/, this.component.canDeactivate(this.navigationSession.interactionContext)];
|
|
4043
|
+
}
|
|
4044
|
+
return [2 /*return*/, true];
|
|
4078
4045
|
}
|
|
4079
4046
|
});
|
|
4080
4047
|
});
|
|
@@ -4116,15 +4083,15 @@
|
|
|
4116
4083
|
/**
|
|
4117
4084
|
* @abstract
|
|
4118
4085
|
*/
|
|
4119
|
-
exports.
|
|
4120
|
-
__extends(
|
|
4121
|
-
function
|
|
4086
|
+
exports.NavigationState = /** @class */ (function (_super) {
|
|
4087
|
+
__extends(NavigationState, _super);
|
|
4088
|
+
function NavigationState(context) {
|
|
4122
4089
|
var _this = _super.call(this) || this;
|
|
4123
4090
|
_this.context = context;
|
|
4124
4091
|
_this._visits = new Map();
|
|
4125
4092
|
return _this;
|
|
4126
4093
|
}
|
|
4127
|
-
Object.defineProperty(
|
|
4094
|
+
Object.defineProperty(NavigationState.prototype, "interactionContext", {
|
|
4128
4095
|
get: /**
|
|
4129
4096
|
* @return {?}
|
|
4130
4097
|
*/
|
|
@@ -4138,7 +4105,7 @@
|
|
|
4138
4105
|
* @param {?} visit
|
|
4139
4106
|
* @return {?}
|
|
4140
4107
|
*/
|
|
4141
|
-
|
|
4108
|
+
NavigationState.prototype.storeVisit = /**
|
|
4142
4109
|
* @param {?} visit
|
|
4143
4110
|
* @return {?}
|
|
4144
4111
|
*/
|
|
@@ -4149,7 +4116,7 @@
|
|
|
4149
4116
|
* @param {?} placeDef
|
|
4150
4117
|
* @return {?}
|
|
4151
4118
|
*/
|
|
4152
|
-
|
|
4119
|
+
NavigationState.prototype.getVisitFor = /**
|
|
4153
4120
|
* @param {?} placeDef
|
|
4154
4121
|
* @return {?}
|
|
4155
4122
|
*/
|
|
@@ -4160,7 +4127,7 @@
|
|
|
4160
4127
|
* @param {?} newUrl
|
|
4161
4128
|
* @return {?}
|
|
4162
4129
|
*/
|
|
4163
|
-
|
|
4130
|
+
NavigationState.prototype.onBackClickedDuringNavigationInteraction = /**
|
|
4164
4131
|
* @param {?} newUrl
|
|
4165
4132
|
* @return {?}
|
|
4166
4133
|
*/
|
|
@@ -4170,7 +4137,7 @@
|
|
|
4170
4137
|
/**
|
|
4171
4138
|
* @return {?}
|
|
4172
4139
|
*/
|
|
4173
|
-
|
|
4140
|
+
NavigationState.prototype.getVisits = /**
|
|
4174
4141
|
* @return {?}
|
|
4175
4142
|
*/
|
|
4176
4143
|
function () {
|
|
@@ -4182,7 +4149,7 @@
|
|
|
4182
4149
|
* @param {?} message
|
|
4183
4150
|
* @return {?}
|
|
4184
4151
|
*/
|
|
4185
|
-
|
|
4152
|
+
NavigationState.prototype.illegalTransition = /**
|
|
4186
4153
|
* @protected
|
|
4187
4154
|
* @template R
|
|
4188
4155
|
* @param {?} message
|
|
@@ -4195,7 +4162,7 @@
|
|
|
4195
4162
|
* @protected
|
|
4196
4163
|
* @return {?}
|
|
4197
4164
|
*/
|
|
4198
|
-
|
|
4165
|
+
NavigationState.prototype.currentRouterUrl = /**
|
|
4199
4166
|
* @protected
|
|
4200
4167
|
* @return {?}
|
|
4201
4168
|
*/
|
|
@@ -4207,21 +4174,21 @@
|
|
|
4207
4174
|
* @param {?} event
|
|
4208
4175
|
* @return {?}
|
|
4209
4176
|
*/
|
|
4210
|
-
|
|
4177
|
+
NavigationState.prototype.createActiveSession = /**
|
|
4211
4178
|
* @protected
|
|
4212
4179
|
* @param {?} event
|
|
4213
4180
|
* @return {?}
|
|
4214
4181
|
*/
|
|
4215
4182
|
function (event) {
|
|
4216
4183
|
// TODO: check if the event is purely for interaction context changes.
|
|
4217
|
-
return new
|
|
4184
|
+
return new NavigationState.Active(this.context, event.navigationTrigger === 'popstate', this.currentRouterUrl());
|
|
4218
4185
|
};
|
|
4219
4186
|
/**
|
|
4220
4187
|
* @protected
|
|
4221
4188
|
* @param {?} url
|
|
4222
4189
|
* @return {?}
|
|
4223
4190
|
*/
|
|
4224
|
-
|
|
4191
|
+
NavigationState.prototype.updateLocation = /**
|
|
4225
4192
|
* @protected
|
|
4226
4193
|
* @param {?} url
|
|
4227
4194
|
* @return {?}
|
|
@@ -4232,7 +4199,7 @@
|
|
|
4232
4199
|
/**
|
|
4233
4200
|
* @return {?}
|
|
4234
4201
|
*/
|
|
4235
|
-
|
|
4202
|
+
NavigationState.prototype.toString = /**
|
|
4236
4203
|
* @return {?}
|
|
4237
4204
|
*/
|
|
4238
4205
|
function () {
|
|
@@ -4243,59 +4210,59 @@
|
|
|
4243
4210
|
__metadata("design:type", Function),
|
|
4244
4211
|
__metadata("design:paramtypes", [Object]),
|
|
4245
4212
|
__metadata("design:returntype", void 0)
|
|
4246
|
-
],
|
|
4247
|
-
return
|
|
4213
|
+
], NavigationState.prototype, "updateLocation", null);
|
|
4214
|
+
return NavigationState;
|
|
4248
4215
|
}(pectin.GarbageCollector));
|
|
4249
4216
|
if (false) {
|
|
4250
4217
|
/**
|
|
4251
4218
|
* @type {?}
|
|
4252
4219
|
* @private
|
|
4253
4220
|
*/
|
|
4254
|
-
exports.
|
|
4221
|
+
exports.NavigationState.prototype._visits;
|
|
4255
4222
|
/** @type {?} */
|
|
4256
|
-
exports.
|
|
4223
|
+
exports.NavigationState.prototype.isPopState;
|
|
4257
4224
|
/** @type {?} */
|
|
4258
|
-
exports.
|
|
4225
|
+
exports.NavigationState.prototype.active;
|
|
4259
4226
|
/** @type {?} */
|
|
4260
|
-
exports.
|
|
4227
|
+
exports.NavigationState.prototype.startingUrl;
|
|
4261
4228
|
/**
|
|
4262
4229
|
* @type {?}
|
|
4263
4230
|
* @protected
|
|
4264
4231
|
*/
|
|
4265
|
-
exports.
|
|
4232
|
+
exports.NavigationState.prototype.context;
|
|
4266
4233
|
/**
|
|
4267
4234
|
* @abstract
|
|
4268
4235
|
* @param {?} event
|
|
4269
4236
|
* @return {?}
|
|
4270
4237
|
*/
|
|
4271
|
-
exports.
|
|
4238
|
+
exports.NavigationState.prototype.onStart = function (event) { };
|
|
4272
4239
|
/**
|
|
4273
4240
|
* @abstract
|
|
4274
4241
|
* @param {?} event
|
|
4275
4242
|
* @return {?}
|
|
4276
4243
|
*/
|
|
4277
|
-
exports.
|
|
4244
|
+
exports.NavigationState.prototype.onCancel = function (event) { };
|
|
4278
4245
|
/**
|
|
4279
4246
|
* @abstract
|
|
4280
4247
|
* @param {?} event
|
|
4281
4248
|
* @return {?}
|
|
4282
4249
|
*/
|
|
4283
|
-
exports.
|
|
4250
|
+
exports.NavigationState.prototype.onError = function (event) { };
|
|
4284
4251
|
/**
|
|
4285
4252
|
* @abstract
|
|
4286
4253
|
* @param {?} event
|
|
4287
4254
|
* @return {?}
|
|
4288
4255
|
*/
|
|
4289
|
-
exports.
|
|
4256
|
+
exports.NavigationState.prototype.onEnd = function (event) { };
|
|
4290
4257
|
/**
|
|
4291
4258
|
* @abstract
|
|
4292
4259
|
* @param {?} component
|
|
4293
4260
|
* @param {?} nextState
|
|
4294
4261
|
* @return {?}
|
|
4295
4262
|
*/
|
|
4296
|
-
exports.
|
|
4263
|
+
exports.NavigationState.prototype.canDeactivatePlace = function (component, nextState) { };
|
|
4297
4264
|
}
|
|
4298
|
-
(function (
|
|
4265
|
+
(function (NavigationState) {
|
|
4299
4266
|
var Context = /** @class */ (function () {
|
|
4300
4267
|
function Context(router, modalInteractionService, angularLocation, notifySuccess) {
|
|
4301
4268
|
this.router = router;
|
|
@@ -4305,7 +4272,7 @@
|
|
|
4305
4272
|
}
|
|
4306
4273
|
return Context;
|
|
4307
4274
|
}());
|
|
4308
|
-
|
|
4275
|
+
NavigationState.Context = Context;
|
|
4309
4276
|
if (false) {
|
|
4310
4277
|
/** @type {?} */
|
|
4311
4278
|
Context.prototype.router;
|
|
@@ -4395,8 +4362,8 @@
|
|
|
4395
4362
|
return this.illegalTransition(event);
|
|
4396
4363
|
};
|
|
4397
4364
|
return Idle;
|
|
4398
|
-
}(
|
|
4399
|
-
|
|
4365
|
+
}(NavigationState));
|
|
4366
|
+
NavigationState.Idle = Idle;
|
|
4400
4367
|
if (false) {
|
|
4401
4368
|
/** @type {?} */
|
|
4402
4369
|
Idle.prototype.isPopState;
|
|
@@ -4472,8 +4439,13 @@
|
|
|
4472
4439
|
* @return {?}
|
|
4473
4440
|
*/
|
|
4474
4441
|
function (event) {
|
|
4475
|
-
//
|
|
4476
|
-
|
|
4442
|
+
if (this.isPopState) { // back button clicked and a guard cancelled
|
|
4443
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4444
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4445
|
+
pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
4446
|
+
this.updateLocation(this.startingUrl);
|
|
4447
|
+
}
|
|
4448
|
+
return this.isPopState ? new Idle(this.context) : this;
|
|
4477
4449
|
};
|
|
4478
4450
|
/**
|
|
4479
4451
|
* @param {?} event
|
|
@@ -4574,9 +4546,27 @@
|
|
|
4574
4546
|
function () {
|
|
4575
4547
|
return this.constructor.name + "(startingUrl: " + this.startingUrl + ", isPopState:" + this.isPopState + ")";
|
|
4576
4548
|
};
|
|
4549
|
+
__decorate([
|
|
4550
|
+
pectin.Trace(),
|
|
4551
|
+
__metadata("design:type", Function),
|
|
4552
|
+
__metadata("design:paramtypes", [router.NavigationStart]),
|
|
4553
|
+
__metadata("design:returntype", NavigationState)
|
|
4554
|
+
], Active.prototype, "onStart", null);
|
|
4555
|
+
__decorate([
|
|
4556
|
+
pectin.Trace(),
|
|
4557
|
+
__metadata("design:type", Function),
|
|
4558
|
+
__metadata("design:paramtypes", [router.NavigationCancel]),
|
|
4559
|
+
__metadata("design:returntype", NavigationState)
|
|
4560
|
+
], Active.prototype, "onCancel", null);
|
|
4561
|
+
__decorate([
|
|
4562
|
+
pectin.Trace(),
|
|
4563
|
+
__metadata("design:type", Function),
|
|
4564
|
+
__metadata("design:paramtypes", [router.NavigationError]),
|
|
4565
|
+
__metadata("design:returntype", NavigationState)
|
|
4566
|
+
], Active.prototype, "onError", null);
|
|
4577
4567
|
return Active;
|
|
4578
|
-
}(
|
|
4579
|
-
|
|
4568
|
+
}(NavigationState));
|
|
4569
|
+
NavigationState.Active = Active;
|
|
4580
4570
|
if (false) {
|
|
4581
4571
|
/** @type {?} */
|
|
4582
4572
|
Active.prototype.active;
|
|
@@ -4697,23 +4687,23 @@
|
|
|
4697
4687
|
pectin.Trace(),
|
|
4698
4688
|
__metadata("design:type", Function),
|
|
4699
4689
|
__metadata("design:paramtypes", [router.NavigationStart]),
|
|
4700
|
-
__metadata("design:returntype",
|
|
4690
|
+
__metadata("design:returntype", NavigationState)
|
|
4701
4691
|
], ModalInteractionSession.prototype, "onStart", null);
|
|
4702
4692
|
__decorate([
|
|
4703
4693
|
pectin.Trace(),
|
|
4704
4694
|
__metadata("design:type", Function),
|
|
4705
4695
|
__metadata("design:paramtypes", [router.NavigationCancel]),
|
|
4706
|
-
__metadata("design:returntype",
|
|
4696
|
+
__metadata("design:returntype", NavigationState)
|
|
4707
4697
|
], ModalInteractionSession.prototype, "onCancel", null);
|
|
4708
4698
|
__decorate([
|
|
4709
4699
|
pectin.Trace(),
|
|
4710
4700
|
__metadata("design:type", Function),
|
|
4711
4701
|
__metadata("design:paramtypes", [router.NavigationEnd]),
|
|
4712
|
-
__metadata("design:returntype",
|
|
4702
|
+
__metadata("design:returntype", NavigationState)
|
|
4713
4703
|
], ModalInteractionSession.prototype, "onEnd", null);
|
|
4714
4704
|
return ModalInteractionSession;
|
|
4715
|
-
}(
|
|
4716
|
-
|
|
4705
|
+
}(NavigationState));
|
|
4706
|
+
NavigationState.ModalInteractionSession = ModalInteractionSession;
|
|
4717
4707
|
if (false) {
|
|
4718
4708
|
/** @type {?} */
|
|
4719
4709
|
ModalInteractionSession.prototype.active;
|
|
@@ -4826,8 +4816,8 @@
|
|
|
4826
4816
|
return this.constructor.name + "(startingUrl: " + this.startingUrl + ", locationChangeTriggerUrl:" + this.locationChangeTriggerUrl + ")";
|
|
4827
4817
|
};
|
|
4828
4818
|
return CancelledDuringNavigationInteraction;
|
|
4829
|
-
}(
|
|
4830
|
-
|
|
4819
|
+
}(NavigationState));
|
|
4820
|
+
NavigationState.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
|
|
4831
4821
|
if (false) {
|
|
4832
4822
|
/** @type {?} */
|
|
4833
4823
|
CancelledDuringNavigationInteraction.prototype.active;
|
|
@@ -4843,7 +4833,7 @@
|
|
|
4843
4833
|
/** @type {?} */
|
|
4844
4834
|
CancelledDuringNavigationInteraction.prototype.locationChangeTriggerUrl;
|
|
4845
4835
|
}
|
|
4846
|
-
})(exports.
|
|
4836
|
+
})(exports.NavigationState || (exports.NavigationState = {}));
|
|
4847
4837
|
|
|
4848
4838
|
/**
|
|
4849
4839
|
* @fileoverview added by tsickle
|
|
@@ -5061,14 +5051,14 @@
|
|
|
5061
5051
|
var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
5062
5052
|
_this.activeVisitIndex = chain(_this._activeVisits).indexBy('placeDefinition');
|
|
5063
5053
|
_this.navigationSessionActive = chain(_this.navigationSessionModel).pluck('active');
|
|
5064
|
-
_this._navigationSessionContext = new exports.
|
|
5054
|
+
_this._navigationSessionContext = new exports.NavigationState.Context(_this.router, _this.modalInteractionService, _this.angularLocation, (/**
|
|
5065
5055
|
* @param {?} session
|
|
5066
5056
|
* @return {?}
|
|
5067
5057
|
*/
|
|
5068
5058
|
function (session) {
|
|
5069
5059
|
_this.processNavigationSuccess(session);
|
|
5070
5060
|
}));
|
|
5071
|
-
_this._navigationSessionModel.value = new exports.
|
|
5061
|
+
_this._navigationSessionModel.value = new exports.NavigationState.Idle(_this._navigationSessionContext);
|
|
5072
5062
|
// TODO: make setup the callbacks in during module initiation to make this testable.
|
|
5073
5063
|
_this.router.events.subscribe((/**
|
|
5074
5064
|
* @param {?} event
|
|
@@ -5119,7 +5109,7 @@
|
|
|
5119
5109
|
* @return {?}
|
|
5120
5110
|
*/
|
|
5121
5111
|
function (url) {
|
|
5122
|
-
console.log("#### url changed ->
|
|
5112
|
+
console.log("#### url changed ->", { url: url, navIsActive: _this.navigationSessionActive.value });
|
|
5123
5113
|
/** @type {?} */
|
|
5124
5114
|
var interactionContext = _this.navigationSessionActive.value && _this.navigationSession.interactionContext;
|
|
5125
5115
|
if (interactionContext && interactionContext.isActive()) {
|
|
@@ -5145,6 +5135,9 @@
|
|
|
5145
5135
|
*/
|
|
5146
5136
|
function (session) {
|
|
5147
5137
|
var _this = this;
|
|
5138
|
+
// We need to update the visits before the session finishes. This allows the placeOutets to ignore visit
|
|
5139
|
+
// changes that occur while routerNavigationActive is true.
|
|
5140
|
+
pectin.assert.isTruthy(this.navigationSessionActive.value);
|
|
5148
5141
|
/** @type {?} */
|
|
5149
5142
|
var visits = session.getVisits();
|
|
5150
5143
|
visits.forEach((/**
|
|
@@ -5152,8 +5145,6 @@
|
|
|
5152
5145
|
* @return {?}
|
|
5153
5146
|
*/
|
|
5154
5147
|
function (v) { return _this.placeHistory.add(v); }));
|
|
5155
|
-
// Update visits before we end the navigation session. This allows the placeOutets to
|
|
5156
|
-
// ignore visit changes that occur while the navigation is in progress
|
|
5157
5148
|
this._activeVisits.value = visits;
|
|
5158
5149
|
};
|
|
5159
5150
|
Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
|
|
@@ -5296,7 +5287,7 @@
|
|
|
5296
5287
|
*/
|
|
5297
5288
|
function (current) {
|
|
5298
5289
|
/** @type {?} */
|
|
5299
|
-
var session = new exports.
|
|
5290
|
+
var session = new exports.NavigationState.Active(_this._navigationSessionContext, false, _this.router.routerState.snapshot.url);
|
|
5300
5291
|
session.storeVisit(visit);
|
|
5301
5292
|
return session;
|
|
5302
5293
|
}));
|
|
@@ -5361,144 +5352,11 @@
|
|
|
5361
5352
|
[def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
|
|
5362
5353
|
[def.getFormattedRouteParameters(visit)];
|
|
5363
5354
|
};
|
|
5364
|
-
// private onAngularRouterStarted(event: NavigationStart) {
|
|
5365
|
-
// if (!this.navigationSession) {
|
|
5366
|
-
// // We been activated by an external route rather than placeRouter.go(visit)
|
|
5367
|
-
// this._navigationSessionModel.value = this.createExternalNavigationSession(event);
|
|
5368
|
-
// }
|
|
5369
|
-
// this.firstRoute = false;
|
|
5370
|
-
// }
|
|
5371
|
-
//
|
|
5372
|
-
// private createExternalNavigationSession(event: NavigationStart) {
|
|
5373
|
-
// return new NavigationSession.Active(
|
|
5374
|
-
// this.modalInteractionService,
|
|
5375
|
-
// this.angularLocation,
|
|
5376
|
-
// // event.url,
|
|
5377
|
-
// event.navigationTrigger === 'popstate'
|
|
5378
|
-
// );
|
|
5379
|
-
// }
|
|
5380
|
-
// private onAngularRouterFinished(cancelled: boolean) {
|
|
5381
|
-
// const session = this._navigationSessionModel.value;
|
|
5382
|
-
// if (session.backClickedDuringCanDeactivateInteraction) {
|
|
5383
|
-
// // we swallow this finished event but keep the session alive as we're going to
|
|
5384
|
-
// // get another route started event, which will trigger anohter canDeactivate dialog
|
|
5385
|
-
// // if we start a new session.
|
|
5386
|
-
// // session.resetInteractionSession()
|
|
5387
|
-
// } else {
|
|
5388
|
-
// if (!cancelled) {
|
|
5389
|
-
// const visits = session.getVisits();
|
|
5390
|
-
// visits.forEach(v => this.placeHistory.add(v));
|
|
5391
|
-
// // Update visits before we end the navigation session. This allows the placeOutets to
|
|
5392
|
-
// // ignore visit changes that occur while the navigation is in progress
|
|
5393
|
-
// this._activeVisits.value = visits;
|
|
5394
|
-
// } else {
|
|
5395
|
-
// // TODO: move this to the navigation session
|
|
5396
|
-
// // Angular doesn't preserve the url when a guard cancels the back button.
|
|
5397
|
-
// // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
5398
|
-
// // session.rememberPopStateReturnUrl(this.router.routerState.snapshot.url);
|
|
5399
|
-
// if (session.isPopState) {
|
|
5400
|
-
// console.log('cancelled during popstate');
|
|
5401
|
-
// // this.angularLocation.go(session.previousUrl);
|
|
5402
|
-
// }
|
|
5403
|
-
// }
|
|
5404
|
-
// session.dispose();
|
|
5405
|
-
// this._navigationSessionModel.value = null;
|
|
5406
|
-
// }
|
|
5407
|
-
// }
|
|
5408
|
-
// private onAngularRouterStarted(event: NavigationStart) {
|
|
5409
|
-
// if (!this.navigationSession) {
|
|
5410
|
-
// // We been activated by an external route rather than placeRouter.go(visit)
|
|
5411
|
-
// this._navigationSessionModel.value = this.createExternalNavigationSession(event);
|
|
5412
|
-
// }
|
|
5413
|
-
// this.firstRoute = false;
|
|
5414
|
-
// }
|
|
5415
|
-
//
|
|
5416
|
-
// private createExternalNavigationSession(event: NavigationStart) {
|
|
5417
|
-
// return new NavigationSession.Active(
|
|
5418
|
-
// this.modalInteractionService,
|
|
5419
|
-
// this.angularLocation,
|
|
5420
|
-
// // event.url,
|
|
5421
|
-
// event.navigationTrigger === 'popstate'
|
|
5422
|
-
// );
|
|
5423
|
-
// }
|
|
5424
|
-
// private onAngularRouterFinished(cancelled: boolean) {
|
|
5425
|
-
// const session = this._navigationSessionModel.value;
|
|
5426
|
-
// if (session.backClickedDuringCanDeactivateInteraction) {
|
|
5427
|
-
// // we swallow this finished event but keep the session alive as we're going to
|
|
5428
|
-
// // get another route started event, which will trigger anohter canDeactivate dialog
|
|
5429
|
-
// // if we start a new session.
|
|
5430
|
-
// // session.resetInteractionSession()
|
|
5431
|
-
// } else {
|
|
5432
|
-
// if (!cancelled) {
|
|
5433
|
-
// const visits = session.getVisits();
|
|
5434
|
-
// visits.forEach(v => this.placeHistory.add(v));
|
|
5435
|
-
// // Update visits before we end the navigation session. This allows the placeOutets to
|
|
5436
|
-
// // ignore visit changes that occur while the navigation is in progress
|
|
5437
|
-
// this._activeVisits.value = visits;
|
|
5438
|
-
// } else {
|
|
5439
|
-
// // TODO: move this to the navigation session
|
|
5440
|
-
// // Angular doesn't preserve the url when a guard cancels the back button.
|
|
5441
|
-
// // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
5442
|
-
// // session.rememberPopStateReturnUrl(this.router.routerState.snapshot.url);
|
|
5443
|
-
// if (session.isPopState) {
|
|
5444
|
-
// console.log('cancelled during popstate');
|
|
5445
|
-
// // this.angularLocation.go(session.previousUrl);
|
|
5446
|
-
// }
|
|
5447
|
-
// }
|
|
5448
|
-
// session.dispose();
|
|
5449
|
-
// this._navigationSessionModel.value = null;
|
|
5450
|
-
// }
|
|
5451
|
-
// }
|
|
5452
5355
|
/**
|
|
5453
5356
|
* @param {?} activatedRoute
|
|
5454
5357
|
* @return {?}
|
|
5455
5358
|
*/
|
|
5456
|
-
PlaceRouter.prototype.extractChildPath =
|
|
5457
|
-
// private onAngularRouterStarted(event: NavigationStart) {
|
|
5458
|
-
// if (!this.navigationSession) {
|
|
5459
|
-
// // We been activated by an external route rather than placeRouter.go(visit)
|
|
5460
|
-
// this._navigationSessionModel.value = this.createExternalNavigationSession(event);
|
|
5461
|
-
// }
|
|
5462
|
-
// this.firstRoute = false;
|
|
5463
|
-
// }
|
|
5464
|
-
//
|
|
5465
|
-
// private createExternalNavigationSession(event: NavigationStart) {
|
|
5466
|
-
// return new NavigationSession.Active(
|
|
5467
|
-
// this.modalInteractionService,
|
|
5468
|
-
// this.angularLocation,
|
|
5469
|
-
// // event.url,
|
|
5470
|
-
// event.navigationTrigger === 'popstate'
|
|
5471
|
-
// );
|
|
5472
|
-
// }
|
|
5473
|
-
// private onAngularRouterFinished(cancelled: boolean) {
|
|
5474
|
-
// const session = this._navigationSessionModel.value;
|
|
5475
|
-
// if (session.backClickedDuringCanDeactivateInteraction) {
|
|
5476
|
-
// // we swallow this finished event but keep the session alive as we're going to
|
|
5477
|
-
// // get another route started event, which will trigger anohter canDeactivate dialog
|
|
5478
|
-
// // if we start a new session.
|
|
5479
|
-
// // session.resetInteractionSession()
|
|
5480
|
-
// } else {
|
|
5481
|
-
// if (!cancelled) {
|
|
5482
|
-
// const visits = session.getVisits();
|
|
5483
|
-
// visits.forEach(v => this.placeHistory.add(v));
|
|
5484
|
-
// // Update visits before we end the navigation session. This allows the placeOutets to
|
|
5485
|
-
// // ignore visit changes that occur while the navigation is in progress
|
|
5486
|
-
// this._activeVisits.value = visits;
|
|
5487
|
-
// } else {
|
|
5488
|
-
// // TODO: move this to the navigation session
|
|
5489
|
-
// // Angular doesn't preserve the url when a guard cancels the back button.
|
|
5490
|
-
// // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
5491
|
-
// // session.rememberPopStateReturnUrl(this.router.routerState.snapshot.url);
|
|
5492
|
-
// if (session.isPopState) {
|
|
5493
|
-
// console.log('cancelled during popstate');
|
|
5494
|
-
// // this.angularLocation.go(session.previousUrl);
|
|
5495
|
-
// }
|
|
5496
|
-
// }
|
|
5497
|
-
// session.dispose();
|
|
5498
|
-
// this._navigationSessionModel.value = null;
|
|
5499
|
-
// }
|
|
5500
|
-
// }
|
|
5501
|
-
/**
|
|
5359
|
+
PlaceRouter.prototype.extractChildPath = /**
|
|
5502
5360
|
* @param {?} activatedRoute
|
|
5503
5361
|
* @return {?}
|
|
5504
5362
|
*/
|
|
@@ -5626,7 +5484,7 @@
|
|
|
5626
5484
|
,
|
|
5627
5485
|
_a)
|
|
5628
5486
|
}], {
|
|
5629
|
-
replaceUrl: false
|
|
5487
|
+
replaceUrl: false
|
|
5630
5488
|
});
|
|
5631
5489
|
}
|
|
5632
5490
|
};
|