@coolon/angular-ui-powerups 0.0.119 → 0.0.120
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 +65 -161
- 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/place/guards/navigation-state.js +43 -85
- package/esm2015/lib/place/guards/navigation-state.js.map +1 -1
- package/esm2015/lib/place/guards/navigation-state.metadata.json +1 -1
- package/esm2015/lib/place/place-router.js +9 -2
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm5/lib/place/guards/navigation-state.js +52 -159
- package/esm5/lib/place/guards/navigation-state.js.map +1 -1
- package/esm5/lib/place/place-router.js +13 -2
- package/esm5/lib/place/place-router.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +52 -87
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +65 -161
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/guards/navigation-state.d.ts +4 -1
- package/lib/place/place-router.d.ts +4 -1
- package/package.json +1 -1
|
@@ -4216,20 +4216,19 @@
|
|
|
4216
4216
|
new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
|
|
4217
4217
|
new NavigationState.Idle(this.context);
|
|
4218
4218
|
};
|
|
4219
|
-
//
|
|
4220
|
-
//
|
|
4221
4219
|
/**
|
|
4222
4220
|
* @param {?} url
|
|
4221
|
+
* @param {?=} options
|
|
4223
4222
|
* @return {?}
|
|
4224
4223
|
*/
|
|
4225
|
-
NavigationState.prototype.resetBrowserLocation =
|
|
4226
|
-
//
|
|
4227
|
-
/**
|
|
4224
|
+
NavigationState.prototype.resetBrowserLocation = /**
|
|
4228
4225
|
* @param {?} url
|
|
4226
|
+
* @param {?=} options
|
|
4229
4227
|
* @return {?}
|
|
4230
4228
|
*/
|
|
4231
|
-
function (url) {
|
|
4232
|
-
|
|
4229
|
+
function (url, options) {
|
|
4230
|
+
if (options === void 0) { options = { replaceCurrent: false }; }
|
|
4231
|
+
this.placeRouter.resetBrowserLocation(url, options);
|
|
4233
4232
|
};
|
|
4234
4233
|
/**
|
|
4235
4234
|
* @param {?} event
|
|
@@ -4275,6 +4274,25 @@
|
|
|
4275
4274
|
return p + ": " + _this[p];
|
|
4276
4275
|
})).join(', ');
|
|
4277
4276
|
};
|
|
4277
|
+
/**
|
|
4278
|
+
* @protected
|
|
4279
|
+
* @param {?} url
|
|
4280
|
+
* @return {?}
|
|
4281
|
+
*/
|
|
4282
|
+
NavigationState.prototype.replaceBuggeredUrlAfterAngularRouterCancelled = /**
|
|
4283
|
+
* @protected
|
|
4284
|
+
* @param {?} url
|
|
4285
|
+
* @return {?}
|
|
4286
|
+
*/
|
|
4287
|
+
function (url) {
|
|
4288
|
+
// Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
|
|
4289
|
+
// So this means that the top of the stack is the url we want to go back to, and not the one that was on
|
|
4290
|
+
// it before the cancel event fired.
|
|
4291
|
+
// So we need to:
|
|
4292
|
+
// - replace the just inserted url with the one that used to be there.
|
|
4293
|
+
// - push our actual url back onto the top of the stack.
|
|
4294
|
+
this.resetBrowserLocation(url, { replaceCurrent: true });
|
|
4295
|
+
};
|
|
4278
4296
|
return NavigationState;
|
|
4279
4297
|
}(pectin.GarbageCollector));
|
|
4280
4298
|
if (false) {
|
|
@@ -4608,11 +4626,11 @@
|
|
|
4608
4626
|
* @return {?}
|
|
4609
4627
|
*/
|
|
4610
4628
|
function (event) {
|
|
4629
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.poppedHistoryUrl);
|
|
4611
4630
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4612
4631
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4613
4632
|
pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
4614
|
-
this.resetBrowserLocation(this.
|
|
4615
|
-
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
4633
|
+
this.resetBrowserLocation(this.startingUrl);
|
|
4616
4634
|
return new Idle(this.context);
|
|
4617
4635
|
};
|
|
4618
4636
|
/**
|
|
@@ -4624,15 +4642,18 @@
|
|
|
4624
4642
|
* @return {?}
|
|
4625
4643
|
*/
|
|
4626
4644
|
function (event) {
|
|
4627
|
-
// navigation was aborted.
|
|
4628
|
-
if (this.currentRouterUrl() !== this.startingUrl) {
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4645
|
+
// // navigation was aborted.
|
|
4646
|
+
// if (this.currentRouterUrl() !== this.startingUrl) {
|
|
4647
|
+
// // Angular doesn't preserve the url when a guard cancels the back button.
|
|
4648
|
+
// // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4649
|
+
// Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
4650
|
+
// this.restoreHistory([
|
|
4651
|
+
// this.poppedHistoryUrl,
|
|
4652
|
+
// this.startingUrl
|
|
4653
|
+
// ]);
|
|
4654
|
+
// }
|
|
4655
|
+
// return new Idle(this.context);
|
|
4656
|
+
return this.illegalTransition("when do I get this???");
|
|
4636
4657
|
};
|
|
4637
4658
|
/**
|
|
4638
4659
|
* @param {?} locationTriggerUrl
|
|
@@ -4781,6 +4802,7 @@
|
|
|
4781
4802
|
* @return {?}
|
|
4782
4803
|
*/
|
|
4783
4804
|
function (event) {
|
|
4805
|
+
// TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
|
|
4784
4806
|
if (this.context.interactionService.isActive()) {
|
|
4785
4807
|
/** @type {?} */
|
|
4786
4808
|
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -4902,6 +4924,7 @@
|
|
|
4902
4924
|
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
4903
4925
|
}
|
|
4904
4926
|
else {
|
|
4927
|
+
// this.replaceBuggeredUrlAfterAngularRouterCancells(this.start)
|
|
4905
4928
|
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
4906
4929
|
}
|
|
4907
4930
|
return this.createIdleState();
|
|
@@ -5002,6 +5025,7 @@
|
|
|
5002
5025
|
* @return {?}
|
|
5003
5026
|
*/
|
|
5004
5027
|
function (event) {
|
|
5028
|
+
// TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
|
|
5005
5029
|
if (this.interactionService.isActive()) {
|
|
5006
5030
|
/** @type {?} */
|
|
5007
5031
|
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -5037,7 +5061,7 @@
|
|
|
5037
5061
|
* @return {?}
|
|
5038
5062
|
*/
|
|
5039
5063
|
function (newUrl) {
|
|
5040
|
-
return this.illegalTransition(
|
|
5064
|
+
return this.illegalTransition('Leaving interaction after pop-state should\'t block so should never see a back button click');
|
|
5041
5065
|
};
|
|
5042
5066
|
return LeavingInteractionAfterPopStateTransition;
|
|
5043
5067
|
}(AbstractInteractionTransition));
|
|
@@ -5048,74 +5072,6 @@
|
|
|
5048
5072
|
/** @type {?} */
|
|
5049
5073
|
LeavingInteractionAfterPopStateTransition.prototype.poppedHistoryUrl;
|
|
5050
5074
|
}
|
|
5051
|
-
// See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
|
|
5052
|
-
//
|
|
5053
|
-
// export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
|
|
5054
|
-
//
|
|
5055
|
-
// readonly isPopState = false;
|
|
5056
|
-
// firstCancelHandled = false;
|
|
5057
|
-
// popStateHandled = false;
|
|
5058
|
-
// popStateEventUrl: string;
|
|
5059
|
-
// debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
5060
|
-
//
|
|
5061
|
-
// constructor(context: Context,
|
|
5062
|
-
// readonly startingUrl: string,
|
|
5063
|
-
// readonly locationChangeTriggerUrl: string,
|
|
5064
|
-
// readonly poppedHistoryUrl: string) {
|
|
5065
|
-
// super(context);
|
|
5066
|
-
// }
|
|
5067
|
-
//
|
|
5068
|
-
// get isTransitional() {
|
|
5069
|
-
// return true;
|
|
5070
|
-
// }
|
|
5071
|
-
//
|
|
5072
|
-
// onRouterStarted(event: NavigationStart): NavigationState {
|
|
5073
|
-
// return this.ignore(event);
|
|
5074
|
-
// }
|
|
5075
|
-
//
|
|
5076
|
-
//
|
|
5077
|
-
// onRouterCancelled(event: NavigationCancel): NavigationState {
|
|
5078
|
-
//
|
|
5079
|
-
// // if (this.firstCancelHandled && this.popStateHandled) {
|
|
5080
|
-
// // // Angular doesn't preserve the url when a guard cancels the back button.
|
|
5081
|
-
// // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
5082
|
-
// // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
5083
|
-
// // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
5084
|
-
// // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
5085
|
-
// // if (this.interactionService.isActive()) {
|
|
5086
|
-
// // const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
5087
|
-
// // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
5088
|
-
// // } else {
|
|
5089
|
-
// // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
5090
|
-
// // }
|
|
5091
|
-
// // return this.createIdleState();
|
|
5092
|
-
// // } else {
|
|
5093
|
-
// // this.firstCancelHandled = true;
|
|
5094
|
-
// return this.ignore(event);
|
|
5095
|
-
// // }
|
|
5096
|
-
// }
|
|
5097
|
-
//
|
|
5098
|
-
//
|
|
5099
|
-
// onRouterEnd(event: NavigationEnd): NavigationState {
|
|
5100
|
-
// return this.ignore(event);
|
|
5101
|
-
// }
|
|
5102
|
-
//
|
|
5103
|
-
//
|
|
5104
|
-
// onRouterError(event: NavigationError): NavigationState {
|
|
5105
|
-
// return this.ignore(event);
|
|
5106
|
-
// }
|
|
5107
|
-
//
|
|
5108
|
-
//
|
|
5109
|
-
// onPopState(event: NavigationStart): NavigationState {
|
|
5110
|
-
// // this.popStateHandled = true;
|
|
5111
|
-
// // this.popStateEventUrl = event.url;
|
|
5112
|
-
// return this.ignore(event);
|
|
5113
|
-
// }
|
|
5114
|
-
//
|
|
5115
|
-
// async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
|
|
5116
|
-
// return false;
|
|
5117
|
-
// }
|
|
5118
|
-
// }
|
|
5119
5075
|
/**
|
|
5120
5076
|
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
5121
5077
|
* The routing event sequence is different depending on the link that was clicked.
|
|
@@ -5138,76 +5094,7 @@
|
|
|
5138
5094
|
* -> PopState
|
|
5139
5095
|
* -> NavigationCancel
|
|
5140
5096
|
*/
|
|
5141
|
-
var
|
|
5142
|
-
// See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
|
|
5143
|
-
//
|
|
5144
|
-
// export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
|
|
5145
|
-
//
|
|
5146
|
-
// readonly isPopState = false;
|
|
5147
|
-
// firstCancelHandled = false;
|
|
5148
|
-
// popStateHandled = false;
|
|
5149
|
-
// popStateEventUrl: string;
|
|
5150
|
-
// debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
5151
|
-
//
|
|
5152
|
-
// constructor(context: Context,
|
|
5153
|
-
// readonly startingUrl: string,
|
|
5154
|
-
// readonly locationChangeTriggerUrl: string,
|
|
5155
|
-
// readonly poppedHistoryUrl: string) {
|
|
5156
|
-
// super(context);
|
|
5157
|
-
// }
|
|
5158
|
-
//
|
|
5159
|
-
// get isTransitional() {
|
|
5160
|
-
// return true;
|
|
5161
|
-
// }
|
|
5162
|
-
//
|
|
5163
|
-
// onRouterStarted(event: NavigationStart): NavigationState {
|
|
5164
|
-
// return this.ignore(event);
|
|
5165
|
-
// }
|
|
5166
|
-
//
|
|
5167
|
-
//
|
|
5168
|
-
// onRouterCancelled(event: NavigationCancel): NavigationState {
|
|
5169
|
-
//
|
|
5170
|
-
// // if (this.firstCancelHandled && this.popStateHandled) {
|
|
5171
|
-
// // // Angular doesn't preserve the url when a guard cancels the back button.
|
|
5172
|
-
// // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
5173
|
-
// // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
5174
|
-
// // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
5175
|
-
// // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
5176
|
-
// // if (this.interactionService.isActive()) {
|
|
5177
|
-
// // const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
5178
|
-
// // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
5179
|
-
// // } else {
|
|
5180
|
-
// // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
5181
|
-
// // }
|
|
5182
|
-
// // return this.createIdleState();
|
|
5183
|
-
// // } else {
|
|
5184
|
-
// // this.firstCancelHandled = true;
|
|
5185
|
-
// return this.ignore(event);
|
|
5186
|
-
// // }
|
|
5187
|
-
// }
|
|
5188
|
-
//
|
|
5189
|
-
//
|
|
5190
|
-
// onRouterEnd(event: NavigationEnd): NavigationState {
|
|
5191
|
-
// return this.ignore(event);
|
|
5192
|
-
// }
|
|
5193
|
-
//
|
|
5194
|
-
//
|
|
5195
|
-
// onRouterError(event: NavigationError): NavigationState {
|
|
5196
|
-
// return this.ignore(event);
|
|
5197
|
-
// }
|
|
5198
|
-
//
|
|
5199
|
-
//
|
|
5200
|
-
// onPopState(event: NavigationStart): NavigationState {
|
|
5201
|
-
// // this.popStateHandled = true;
|
|
5202
|
-
// // this.popStateEventUrl = event.url;
|
|
5203
|
-
// return this.ignore(event);
|
|
5204
|
-
// }
|
|
5205
|
-
//
|
|
5206
|
-
// async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
|
|
5207
|
-
// return false;
|
|
5208
|
-
// }
|
|
5209
|
-
// }
|
|
5210
|
-
/**
|
|
5097
|
+
var /**
|
|
5211
5098
|
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
5212
5099
|
* The routing event sequence is different depending on the link that was clicked.
|
|
5213
5100
|
*
|
|
@@ -5330,7 +5217,7 @@
|
|
|
5330
5217
|
*/
|
|
5331
5218
|
function () {
|
|
5332
5219
|
pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
5333
|
-
this.
|
|
5220
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.clickedLinkUrl); // put the back click one back in.
|
|
5334
5221
|
if (this.interactionService.isActive()) {
|
|
5335
5222
|
/** @type {?} */
|
|
5336
5223
|
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -5450,7 +5337,13 @@
|
|
|
5450
5337
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
5451
5338
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
5452
5339
|
pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
5453
|
-
//
|
|
5340
|
+
// Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
|
|
5341
|
+
// So this means that the top of the stack is the url we want to go back to, and not the one that was on
|
|
5342
|
+
// it before the cancel event fired.
|
|
5343
|
+
// So we need to:
|
|
5344
|
+
// - replace the just inserted url with the one that used to be there.
|
|
5345
|
+
// - push our actual url back onto the top of the stack.
|
|
5346
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.locationChangeTriggerUrl);
|
|
5454
5347
|
this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
5455
5348
|
if (this.interactionService.isActive()) {
|
|
5456
5349
|
/** @type {?} */
|
|
@@ -6212,14 +6105,25 @@
|
|
|
6212
6105
|
};
|
|
6213
6106
|
/**
|
|
6214
6107
|
* @param {?} url
|
|
6108
|
+
* @param {?} options
|
|
6215
6109
|
* @return {?}
|
|
6216
6110
|
*/
|
|
6217
6111
|
PlaceRouter.prototype.resetBrowserLocation = /**
|
|
6218
6112
|
* @param {?} url
|
|
6113
|
+
* @param {?} options
|
|
6219
6114
|
* @return {?}
|
|
6220
6115
|
*/
|
|
6221
|
-
function (url) {
|
|
6222
|
-
this.angularLocation.go(url);
|
|
6116
|
+
function (url, options) {
|
|
6117
|
+
options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);
|
|
6118
|
+
};
|
|
6119
|
+
/**
|
|
6120
|
+
* @return {?}
|
|
6121
|
+
*/
|
|
6122
|
+
PlaceRouter.prototype.forward = /**
|
|
6123
|
+
* @return {?}
|
|
6124
|
+
*/
|
|
6125
|
+
function () {
|
|
6126
|
+
this.angularLocation.forward();
|
|
6223
6127
|
};
|
|
6224
6128
|
/**
|
|
6225
6129
|
* @param {...?} visits
|