@coolon/angular-ui-powerups 0.0.62 → 0.0.63

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.
@@ -991,20 +991,6 @@
991
991
  function InteractionContext() {
992
992
  return _super.call(this) || this;
993
993
  }
994
- /**
995
- * Returns true if an activity is currently running.
996
- */
997
- /**
998
- * Returns true if an activity is currently running.
999
- * @return {?}
1000
- */
1001
- InteractionContext.prototype.isActive = /**
1002
- * Returns true if an activity is currently running.
1003
- * @return {?}
1004
- */
1005
- function () {
1006
- return this.activityList.length > 0;
1007
- };
1008
994
  return InteractionContext;
1009
995
  }(pectin.GarbageCollector));
1010
996
  if (false) {
@@ -1020,6 +1006,12 @@
1020
1006
  * @type {?}
1021
1007
  */
1022
1008
  InteractionContext.prototype.activityList;
1009
+ /**
1010
+ * Returns true if an activity is currently running.
1011
+ * @abstract
1012
+ * @return {?}
1013
+ */
1014
+ InteractionContext.prototype.isActive = function () { };
1023
1015
  /**
1024
1016
  * @abstract
1025
1017
  * @template D, R, E
@@ -1909,29 +1901,16 @@
1909
1901
  var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
1910
1902
  _this.currentActivity = chain(_this.activityList).last();
1911
1903
  return _this;
1912
- // observe.valuesFrom(this.router.events)
1913
- // .tap((event:RouterEvent) => {
1914
- // const nav = router.getCurrentNavigation();
1915
- // console.log({
1916
- // previousUrl: nav.previousNavigation && nav.previousNavigation.finalUrl,
1917
- // initialUrl: nav.initialUrl,
1918
- // finalUrl: nav.finalUrl,
1919
- // });
1920
- //
1921
- // })
1922
- // .filter(event => event instanceof NavigationStart)
1923
- // .subscribe((event: NavigationStart) => {
1924
- // console.log(event.navigationTrigger);
1925
- // if (event.navigationTrigger === 'popstate' && this.isActive()) {
1926
- // const prev = router.getCurrentNavigation().previousNavigation.finalUrl;
1927
- // // this.router.navigateByUrl(prev.toString(), {
1928
- // // replaceUrl: true,
1929
- // // skipLocationChange: false
1930
- // // });
1931
- // // this.cancelActivity();
1932
- // }
1933
- // });
1934
1904
  }
1905
+ /**
1906
+ * @return {?}
1907
+ */
1908
+ DialogInteractionService.prototype.isActive = /**
1909
+ * @return {?}
1910
+ */
1911
+ function () {
1912
+ return this._active;
1913
+ };
1935
1914
  /**
1936
1915
  * @return {?}
1937
1916
  */
@@ -4805,11 +4784,11 @@
4805
4784
  // NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
4806
4785
  // NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
4807
4786
  if (event instanceof router.NavigationEnd) {
4808
- console.log("navigation ended");
4787
+ console.log('navigation ended');
4809
4788
  self._alreadyAccepted = [];
4810
4789
  }
4811
4790
  if (event instanceof router.NavigationError) {
4812
- console.log("navigation errored");
4791
+ console.log('navigation errored');
4813
4792
  self._alreadyAccepted = [];
4814
4793
  }
4815
4794
  }));
@@ -4883,7 +4862,8 @@
4883
4862
  if (!nextState.url.startsWith(placeDefinitionPath)) {
4884
4863
  /** @type {?} */
4885
4864
  var self_1 = this;
4886
- return Promise.resolve(component.canDeactivate()).then((/**
4865
+ return Promise.resolve(component.canDeactivate())
4866
+ .then((/**
4887
4867
  * @param {?} canLeave
4888
4868
  * @return {?}
4889
4869
  */
@@ -4892,11 +4872,26 @@
4892
4872
  // Angular doesn't preserve the url when a guard cancels the back button.
4893
4873
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4894
4874
  _this.location.go(currentState.url);
4875
+ return false;
4895
4876
  }
4896
4877
  else {
4878
+ if (_this.interactionContext.isActive()) {
4879
+ _this.interactionContext.currentActivity.value.cancel(null);
4880
+ return false;
4881
+ }
4882
+ else {
4883
+ return true;
4884
+ }
4885
+ }
4886
+ })).then((/**
4887
+ * @param {?} canDeactivate
4888
+ * @return {?}
4889
+ */
4890
+ function (canDeactivate) {
4891
+ if (canDeactivate) {
4897
4892
  self_1._alreadyAccepted.push(component);
4898
4893
  }
4899
- return canLeave;
4894
+ return canDeactivate;
4900
4895
  }));
4901
4896
  }
4902
4897
  return true;