@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.
@@ -4033,20 +4033,19 @@ NavigationState = /** @class */ (function (_super) {
4033
4033
  new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
4034
4034
  new NavigationState.Idle(this.context);
4035
4035
  };
4036
- //
4037
- //
4038
4036
  /**
4039
4037
  * @param {?} url
4038
+ * @param {?=} options
4040
4039
  * @return {?}
4041
4040
  */
4042
- NavigationState.prototype.resetBrowserLocation =
4043
- //
4044
- /**
4041
+ NavigationState.prototype.resetBrowserLocation = /**
4045
4042
  * @param {?} url
4043
+ * @param {?=} options
4046
4044
  * @return {?}
4047
4045
  */
4048
- function (url) {
4049
- this.placeRouter.resetBrowserLocation(url);
4046
+ function (url, options) {
4047
+ if (options === void 0) { options = { replaceCurrent: false }; }
4048
+ this.placeRouter.resetBrowserLocation(url, options);
4050
4049
  };
4051
4050
  /**
4052
4051
  * @param {?} event
@@ -4092,6 +4091,25 @@ NavigationState = /** @class */ (function (_super) {
4092
4091
  return p + ": " + _this[p];
4093
4092
  })).join(', ');
4094
4093
  };
4094
+ /**
4095
+ * @protected
4096
+ * @param {?} url
4097
+ * @return {?}
4098
+ */
4099
+ NavigationState.prototype.replaceBuggeredUrlAfterAngularRouterCancelled = /**
4100
+ * @protected
4101
+ * @param {?} url
4102
+ * @return {?}
4103
+ */
4104
+ function (url) {
4105
+ // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
4106
+ // 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
4107
+ // it before the cancel event fired.
4108
+ // So we need to:
4109
+ // - replace the just inserted url with the one that used to be there.
4110
+ // - push our actual url back onto the top of the stack.
4111
+ this.resetBrowserLocation(url, { replaceCurrent: true });
4112
+ };
4095
4113
  return NavigationState;
4096
4114
  }(GarbageCollector));
4097
4115
  if (false) {
@@ -4425,11 +4443,11 @@ if (false) {
4425
4443
  * @return {?}
4426
4444
  */
4427
4445
  function (event) {
4446
+ this.replaceBuggeredUrlAfterAngularRouterCancelled(this.poppedHistoryUrl);
4428
4447
  // Angular doesn't preserve the url when a guard cancels the back button.
4429
4448
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4430
4449
  Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4431
- this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
4432
- this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4450
+ this.resetBrowserLocation(this.startingUrl);
4433
4451
  return new Idle(this.context);
4434
4452
  };
4435
4453
  /**
@@ -4441,15 +4459,18 @@ if (false) {
4441
4459
  * @return {?}
4442
4460
  */
4443
4461
  function (event) {
4444
- // navigation was aborted.
4445
- if (this.currentRouterUrl() !== this.startingUrl) {
4446
- // Angular doesn't preserve the url when a guard cancels the back button.
4447
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4448
- Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4449
- this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
4450
- this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4451
- }
4452
- return new Idle(this.context);
4462
+ // // navigation was aborted.
4463
+ // if (this.currentRouterUrl() !== this.startingUrl) {
4464
+ // // Angular doesn't preserve the url when a guard cancels the back button.
4465
+ // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4466
+ // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4467
+ // this.restoreHistory([
4468
+ // this.poppedHistoryUrl,
4469
+ // this.startingUrl
4470
+ // ]);
4471
+ // }
4472
+ // return new Idle(this.context);
4473
+ return this.illegalTransition("when do I get this???");
4453
4474
  };
4454
4475
  /**
4455
4476
  * @param {?} locationTriggerUrl
@@ -4598,6 +4619,7 @@ if (false) {
4598
4619
  * @return {?}
4599
4620
  */
4600
4621
  function (event) {
4622
+ // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
4601
4623
  if (this.context.interactionService.isActive()) {
4602
4624
  /** @type {?} */
4603
4625
  var interactionIds = this.interactionService.activeInteractionContextIds.value;
@@ -4719,6 +4741,7 @@ if (false) {
4719
4741
  this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
4720
4742
  }
4721
4743
  else {
4744
+ // this.replaceBuggeredUrlAfterAngularRouterCancells(this.start)
4722
4745
  this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4723
4746
  }
4724
4747
  return this.createIdleState();
@@ -4819,6 +4842,7 @@ if (false) {
4819
4842
  * @return {?}
4820
4843
  */
4821
4844
  function (event) {
4845
+ // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
4822
4846
  if (this.interactionService.isActive()) {
4823
4847
  /** @type {?} */
4824
4848
  var interactionIds = this.interactionService.activeInteractionContextIds.value;
@@ -4854,7 +4878,7 @@ if (false) {
4854
4878
  * @return {?}
4855
4879
  */
4856
4880
  function (newUrl) {
4857
- return this.illegalTransition("Leaving interaction after pop-state should't block so should never see a back button click");
4881
+ return this.illegalTransition('Leaving interaction after pop-state should\'t block so should never see a back button click');
4858
4882
  };
4859
4883
  return LeavingInteractionAfterPopStateTransition;
4860
4884
  }(AbstractInteractionTransition));
@@ -4865,74 +4889,6 @@ if (false) {
4865
4889
  /** @type {?} */
4866
4890
  LeavingInteractionAfterPopStateTransition.prototype.poppedHistoryUrl;
4867
4891
  }
4868
- // See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
4869
- //
4870
- // export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
4871
- //
4872
- // readonly isPopState = false;
4873
- // firstCancelHandled = false;
4874
- // popStateHandled = false;
4875
- // popStateEventUrl: string;
4876
- // debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
4877
- //
4878
- // constructor(context: Context,
4879
- // readonly startingUrl: string,
4880
- // readonly locationChangeTriggerUrl: string,
4881
- // readonly poppedHistoryUrl: string) {
4882
- // super(context);
4883
- // }
4884
- //
4885
- // get isTransitional() {
4886
- // return true;
4887
- // }
4888
- //
4889
- // onRouterStarted(event: NavigationStart): NavigationState {
4890
- // return this.ignore(event);
4891
- // }
4892
- //
4893
- //
4894
- // onRouterCancelled(event: NavigationCancel): NavigationState {
4895
- //
4896
- // // if (this.firstCancelHandled && this.popStateHandled) {
4897
- // // // Angular doesn't preserve the url when a guard cancels the back button.
4898
- // // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4899
- // // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4900
- // // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
4901
- // // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
4902
- // // if (this.interactionService.isActive()) {
4903
- // // const interactionIds = this.interactionService.activeInteractionContextIds.value;
4904
- // // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
4905
- // // } else {
4906
- // // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4907
- // // }
4908
- // // return this.createIdleState();
4909
- // // } else {
4910
- // // this.firstCancelHandled = true;
4911
- // return this.ignore(event);
4912
- // // }
4913
- // }
4914
- //
4915
- //
4916
- // onRouterEnd(event: NavigationEnd): NavigationState {
4917
- // return this.ignore(event);
4918
- // }
4919
- //
4920
- //
4921
- // onRouterError(event: NavigationError): NavigationState {
4922
- // return this.ignore(event);
4923
- // }
4924
- //
4925
- //
4926
- // onPopState(event: NavigationStart): NavigationState {
4927
- // // this.popStateHandled = true;
4928
- // // this.popStateEventUrl = event.url;
4929
- // return this.ignore(event);
4930
- // }
4931
- //
4932
- // async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
4933
- // return false;
4934
- // }
4935
- // }
4936
4892
  /**
4937
4893
  * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
4938
4894
  * The routing event sequence is different depending on the link that was clicked.
@@ -4955,76 +4911,7 @@ if (false) {
4955
4911
  * -> PopState
4956
4912
  * -> NavigationCancel
4957
4913
  */
4958
- var
4959
- // See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
4960
- //
4961
- // export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
4962
- //
4963
- // readonly isPopState = false;
4964
- // firstCancelHandled = false;
4965
- // popStateHandled = false;
4966
- // popStateEventUrl: string;
4967
- // debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
4968
- //
4969
- // constructor(context: Context,
4970
- // readonly startingUrl: string,
4971
- // readonly locationChangeTriggerUrl: string,
4972
- // readonly poppedHistoryUrl: string) {
4973
- // super(context);
4974
- // }
4975
- //
4976
- // get isTransitional() {
4977
- // return true;
4978
- // }
4979
- //
4980
- // onRouterStarted(event: NavigationStart): NavigationState {
4981
- // return this.ignore(event);
4982
- // }
4983
- //
4984
- //
4985
- // onRouterCancelled(event: NavigationCancel): NavigationState {
4986
- //
4987
- // // if (this.firstCancelHandled && this.popStateHandled) {
4988
- // // // Angular doesn't preserve the url when a guard cancels the back button.
4989
- // // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4990
- // // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4991
- // // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
4992
- // // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
4993
- // // if (this.interactionService.isActive()) {
4994
- // // const interactionIds = this.interactionService.activeInteractionContextIds.value;
4995
- // // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
4996
- // // } else {
4997
- // // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4998
- // // }
4999
- // // return this.createIdleState();
5000
- // // } else {
5001
- // // this.firstCancelHandled = true;
5002
- // return this.ignore(event);
5003
- // // }
5004
- // }
5005
- //
5006
- //
5007
- // onRouterEnd(event: NavigationEnd): NavigationState {
5008
- // return this.ignore(event);
5009
- // }
5010
- //
5011
- //
5012
- // onRouterError(event: NavigationError): NavigationState {
5013
- // return this.ignore(event);
5014
- // }
5015
- //
5016
- //
5017
- // onPopState(event: NavigationStart): NavigationState {
5018
- // // this.popStateHandled = true;
5019
- // // this.popStateEventUrl = event.url;
5020
- // return this.ignore(event);
5021
- // }
5022
- //
5023
- // async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
5024
- // return false;
5025
- // }
5026
- // }
5027
- /**
4914
+ var /**
5028
4915
  * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
5029
4916
  * The routing event sequence is different depending on the link that was clicked.
5030
4917
  *
@@ -5147,7 +5034,7 @@ if (false) {
5147
5034
  */
5148
5035
  function () {
5149
5036
  Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
5150
- this.resetBrowserLocation(this.clickedLinkUrl); // put the back click one back in.
5037
+ this.replaceBuggeredUrlAfterAngularRouterCancelled(this.clickedLinkUrl); // put the back click one back in.
5151
5038
  if (this.interactionService.isActive()) {
5152
5039
  /** @type {?} */
5153
5040
  var interactionIds = this.interactionService.activeInteractionContextIds.value;
@@ -5267,7 +5154,13 @@ if (false) {
5267
5154
  // Angular doesn't preserve the url when a guard cancels the back button.
5268
5155
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5269
5156
  Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
5270
- // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
5157
+ // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
5158
+ // 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
5159
+ // it before the cancel event fired.
5160
+ // So we need to:
5161
+ // - replace the just inserted url with the one that used to be there.
5162
+ // - push our actual url back onto the top of the stack.
5163
+ this.replaceBuggeredUrlAfterAngularRouterCancelled(this.locationChangeTriggerUrl);
5271
5164
  this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
5272
5165
  if (this.interactionService.isActive()) {
5273
5166
  /** @type {?} */
@@ -6029,14 +5922,25 @@ var PlaceRouter = /** @class */ (function (_super) {
6029
5922
  };
6030
5923
  /**
6031
5924
  * @param {?} url
5925
+ * @param {?} options
6032
5926
  * @return {?}
6033
5927
  */
6034
5928
  PlaceRouter.prototype.resetBrowserLocation = /**
6035
5929
  * @param {?} url
5930
+ * @param {?} options
6036
5931
  * @return {?}
6037
5932
  */
6038
- function (url) {
6039
- this.angularLocation.go(url);
5933
+ function (url, options) {
5934
+ options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);
5935
+ };
5936
+ /**
5937
+ * @return {?}
5938
+ */
5939
+ PlaceRouter.prototype.forward = /**
5940
+ * @return {?}
5941
+ */
5942
+ function () {
5943
+ this.angularLocation.forward();
6040
5944
  };
6041
5945
  /**
6042
5946
  * @param {...?} visits