@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.
@@ -807,20 +807,6 @@ InteractionContext = /** @class */ (function (_super) {
807
807
  function InteractionContext() {
808
808
  return _super.call(this) || this;
809
809
  }
810
- /**
811
- * Returns true if an activity is currently running.
812
- */
813
- /**
814
- * Returns true if an activity is currently running.
815
- * @return {?}
816
- */
817
- InteractionContext.prototype.isActive = /**
818
- * Returns true if an activity is currently running.
819
- * @return {?}
820
- */
821
- function () {
822
- return this.activityList.length > 0;
823
- };
824
810
  return InteractionContext;
825
811
  }(GarbageCollector));
826
812
  if (false) {
@@ -836,6 +822,12 @@ if (false) {
836
822
  * @type {?}
837
823
  */
838
824
  InteractionContext.prototype.activityList;
825
+ /**
826
+ * Returns true if an activity is currently running.
827
+ * @abstract
828
+ * @return {?}
829
+ */
830
+ InteractionContext.prototype.isActive = function () { };
839
831
  /**
840
832
  * @abstract
841
833
  * @template D, R, E
@@ -1725,29 +1717,16 @@ var DialogInteractionService = /** @class */ (function (_super) {
1725
1717
  var _a = Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
1726
1718
  _this.currentActivity = chain(_this.activityList).last();
1727
1719
  return _this;
1728
- // observe.valuesFrom(this.router.events)
1729
- // .tap((event:RouterEvent) => {
1730
- // const nav = router.getCurrentNavigation();
1731
- // console.log({
1732
- // previousUrl: nav.previousNavigation && nav.previousNavigation.finalUrl,
1733
- // initialUrl: nav.initialUrl,
1734
- // finalUrl: nav.finalUrl,
1735
- // });
1736
- //
1737
- // })
1738
- // .filter(event => event instanceof NavigationStart)
1739
- // .subscribe((event: NavigationStart) => {
1740
- // console.log(event.navigationTrigger);
1741
- // if (event.navigationTrigger === 'popstate' && this.isActive()) {
1742
- // const prev = router.getCurrentNavigation().previousNavigation.finalUrl;
1743
- // // this.router.navigateByUrl(prev.toString(), {
1744
- // // replaceUrl: true,
1745
- // // skipLocationChange: false
1746
- // // });
1747
- // // this.cancelActivity();
1748
- // }
1749
- // });
1750
1720
  }
1721
+ /**
1722
+ * @return {?}
1723
+ */
1724
+ DialogInteractionService.prototype.isActive = /**
1725
+ * @return {?}
1726
+ */
1727
+ function () {
1728
+ return this._active;
1729
+ };
1751
1730
  /**
1752
1731
  * @return {?}
1753
1732
  */
@@ -4621,11 +4600,11 @@ var LeavePlaceGuard = /** @class */ (function () {
4621
4600
  // NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
4622
4601
  // NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
4623
4602
  if (event instanceof NavigationEnd) {
4624
- console.log("navigation ended");
4603
+ console.log('navigation ended');
4625
4604
  self._alreadyAccepted = [];
4626
4605
  }
4627
4606
  if (event instanceof NavigationError) {
4628
- console.log("navigation errored");
4607
+ console.log('navigation errored');
4629
4608
  self._alreadyAccepted = [];
4630
4609
  }
4631
4610
  }));
@@ -4699,7 +4678,8 @@ var LeavePlaceGuard = /** @class */ (function () {
4699
4678
  if (!nextState.url.startsWith(placeDefinitionPath)) {
4700
4679
  /** @type {?} */
4701
4680
  var self_1 = this;
4702
- return Promise.resolve(component.canDeactivate()).then((/**
4681
+ return Promise.resolve(component.canDeactivate())
4682
+ .then((/**
4703
4683
  * @param {?} canLeave
4704
4684
  * @return {?}
4705
4685
  */
@@ -4708,11 +4688,26 @@ var LeavePlaceGuard = /** @class */ (function () {
4708
4688
  // Angular doesn't preserve the url when a guard cancels the back button.
4709
4689
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4710
4690
  _this.location.go(currentState.url);
4691
+ return false;
4711
4692
  }
4712
4693
  else {
4694
+ if (_this.interactionContext.isActive()) {
4695
+ _this.interactionContext.currentActivity.value.cancel(null);
4696
+ return false;
4697
+ }
4698
+ else {
4699
+ return true;
4700
+ }
4701
+ }
4702
+ })).then((/**
4703
+ * @param {?} canDeactivate
4704
+ * @return {?}
4705
+ */
4706
+ function (canDeactivate) {
4707
+ if (canDeactivate) {
4713
4708
  self_1._alreadyAccepted.push(component);
4714
4709
  }
4715
- return canLeave;
4710
+ return canDeactivate;
4716
4711
  }));
4717
4712
  }
4718
4713
  return true;