@coolon/angular-ui-powerups 2.0.0-alpha.33 → 2.0.0-alpha.34

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +73 -21
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +2 -2
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/interaction/components/activity-actions/activity-actions.component.js +1 -1
  8. package/esm2015/lib/interaction/components/activity-actions/activity-actions.component.metadata.json +1 -1
  9. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -5
  10. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
  11. package/esm2015/lib/interaction/components/activity-container/activity-container.component.metadata.json +1 -1
  12. package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  13. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +56 -16
  14. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  15. package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
  16. package/esm2015/lib/place/place-component.js +12 -0
  17. package/esm2015/lib/place/place-component.js.map +1 -1
  18. package/esm2015/lib/place/place-component.metadata.json +1 -1
  19. package/esm2015/lib/place/place.module.ngfactory.js.map +1 -1
  20. package/esm5/lib/interaction/components/activity-actions/activity-actions.component.js +1 -1
  21. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -5
  22. package/esm5/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
  23. package/esm5/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  24. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +56 -16
  25. package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  26. package/esm5/lib/place/place-component.js +16 -0
  27. package/esm5/lib/place/place-component.js.map +1 -1
  28. package/esm5/lib/place/place.module.ngfactory.js.map +1 -1
  29. package/fesm2015/coolon-angular-ui-powerups.js +70 -22
  30. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  31. package/fesm5/coolon-angular-ui-powerups.js +74 -22
  32. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  33. package/lib/place/components/place-outlet/place-outlet.component.d.ts +8 -2
  34. package/lib/place/place-component.d.ts +6 -0
  35. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [2.0.0-alpha.34](https://bitbucket.org/coolon/angular-ui-powerups/compare/v2.0.0-alpha.33...v2.0.0-alpha.34) (2020-08-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * place ready notifications now work when animation is disabled ([8f49791](https://bitbucket.org/coolon/angular-ui-powerups/commit/8f49791d97182405f0aa7c25ca72e48de49dde59))
11
+
5
12
  ## [2.0.0-alpha.33](https://bitbucket.org/coolon/angular-ui-powerups/compare/v2.0.0-alpha.32...v2.0.0-alpha.33) (2020-08-26)
6
13
 
7
14
 
@@ -3501,7 +3501,7 @@
3501
3501
  core.Component({
3502
3502
  selector: 'aup-activity-actions',
3503
3503
  template: "<ng-container *ngIf=\"hasCancelCommand()\">\n <button class=\"cancel\" *ngIf=\"!hasCancelText()\" mat-icon-button [pectinCommand]=\"cancelCommand\">\n <aup-icon icon=\"mat:clear\"></aup-icon>\n </button>\n <button class=\"cancel\" *ngIf=\"hasCancelText()\" mat-button [pectinCommand]=\"cancelCommand\">{{cancelText}}</button>\n</ng-container>\n<ng-container *ngIf=\"hasConfirmCommand()\">\n <button class=\"confirm\" *ngIf=\"!hasConfirmText()\" mat-icon-button [pectinCommand]=\"confirmCommand\">\n <aup-icon icon=\"mat:done\"></aup-icon>\n </button>\n <button class=\"confirm\" *ngIf=\"hasConfirmText()\" mat-button [pectinCommand]=\"confirmCommand\">{{confirmText}}</button>\n</ng-container>\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n",
3504
- styles: [":host{display:-ms-grid;display:grid;grid-template-areas:\"cancel confirm content\";-ms-grid-columns:auto auto 1fr;grid-template-columns:auto auto 1fr;-ms-grid-rows:auto;grid-template-rows:auto;align-items:center;justify-content:end}:host.align-end{grid-template-areas:\"content cancel confirm\";-ms-grid-columns:1fr auto auto;grid-template-columns:1fr auto auto}:host.align-stretch{grid-template-areas:\"cancel content confirm\";-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto}.cancel{-ms-grid-row:1;-ms-grid-column:1;grid-area:cancel}:host.align-end>.cancel{-ms-grid-row:1;-ms-grid-column:2}:host.align-stretch>.cancel{-ms-grid-row:1;-ms-grid-column:1}.confirm{-ms-grid-row:1;-ms-grid-column:2;grid-area:confirm}:host.align-end>.confirm{-ms-grid-row:1;-ms-grid-column:3}:host.align-stretch>.confirm{-ms-grid-row:1;-ms-grid-column:3}.content{-ms-grid-row:1;-ms-grid-column:3;grid-area:content;text-align:left}:host.align-end>.content{-ms-grid-row:1;-ms-grid-column:1}:host.align-stretch>.content{-ms-grid-row:1;-ms-grid-column:2}"]
3504
+ styles: [":host{display:-ms-grid;display:grid;grid-template-areas:\"cancel confirm content\";-ms-grid-columns:auto auto 1fr;grid-template-columns:auto auto 1fr;-ms-grid-rows:auto;grid-template-rows:auto;align-items:center;justify-content:end}:host.align-end{grid-template-areas:\"content cancel confirm\";-ms-grid-columns:1fr auto auto;grid-template-columns:1fr auto auto}:host.align-stretch{grid-template-areas:\"cancel content confirm\";-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto}.cancel{-ms-grid-row:1;-ms-grid-column:1;grid-area:cancel}:host.align-end>.cancel{-ms-grid-row:1;-ms-grid-column:2}:host.align-stretch>.cancel{-ms-grid-row:1;-ms-grid-column:1}.confirm{-ms-grid-row:1;-ms-grid-column:2;grid-area:confirm}:host.align-end>.confirm{-ms-grid-row:1;-ms-grid-column:3}:host.align-stretch>.confirm{-ms-grid-row:1;-ms-grid-column:3}.column{-ms-grid-row:1;-ms-grid-column:3;grid-area:content;text-align:left}:host.align-end>.column{-ms-grid-row:1;-ms-grid-column:1}:host.align-stretch>.column{-ms-grid-row:1;-ms-grid-column:2}"]
3505
3505
  })
3506
3506
  ], ActivityActionsComponent);
3507
3507
  return ActivityActionsComponent;
@@ -3862,10 +3862,6 @@
3862
3862
  _this.dynamicHeight = false;
3863
3863
  _this.activityRefs = [];
3864
3864
  _this.garbage = new pectin.GarbageCollector();
3865
- // We have issues where angular is triggering a leave animation when an
3866
- // new activity is started, but is not running the enter animation
3867
- // when it is scrolled back into view. So we track the tab changes and
3868
- // disable all animations inside the tab while we're animating.
3869
3865
  _this.inAnimation = new pectin.MutableValueModel(false);
3870
3866
  return _this;
3871
3867
  }
@@ -4023,6 +4019,7 @@
4023
4019
  var newIndex = this.getActiveActivityCount() - 1;
4024
4020
  if (previousIndex !== newIndex) {
4025
4021
  this.inAnimation.value = true;
4022
+ this.activityRefs[newIndex].setFocused(false);
4026
4023
  this.tabs.selectedIndex = newIndex;
4027
4024
  this.onAnimationFinishedJob = function () {
4028
4025
  _this.activityRefs = _this.activityRefs.filter(function (tab) { return !tab.isComplete(); });
@@ -4066,7 +4063,7 @@
4066
4063
  ActivityContainerComponent = __decorate([
4067
4064
  core.Component({
4068
4065
  selector: 'aup-activity-container',
4069
- template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let tab of activityRefs; let i = index; trackBy: activityIndex\">\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"inAnimation.value || !tab.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\"\n [activityRef]=\"tab\"></aup-activity-outlet>\n </div>\n </mat-tab>\n</mat-tab-group>\n",
4066
+ template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let activityRef of activityRefs; let i = index; trackBy: activityIndex\">\n <!--\n We have issues where angular is triggering a leave animation when an\n new activity is started, but is not running the enter animation\n when it is scrolled back into view. So we track the tab changes and\n disable all animations inside the tab while we're animating.\n -->\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"!activityRef.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"activityRef\"></aup-activity-outlet>\n </div>\n </mat-tab>\n</mat-tab-group>\n",
4070
4067
  styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
4071
4068
  }),
4072
4069
  __metadata("design:paramtypes", [])
@@ -5137,6 +5134,9 @@
5137
5134
  var _this = _super.call(this) || this;
5138
5135
  _this.visitModel = new pectin.MutableValueModel();
5139
5136
  _this._inVisitUpdate = new pectin.Guard();
5137
+ _this._active = new pectin.MutableValueModel(false);
5138
+ 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;
5139
+ when(_this._active).becomesTruthy(function () { return _this.onPlaceReady(); });
5140
5140
  return _this;
5141
5141
  }
5142
5142
  PlaceComponent_1 = PlaceComponent;
@@ -5194,6 +5194,19 @@
5194
5194
  enumerable: true,
5195
5195
  configurable: true
5196
5196
  });
5197
+ Object.defineProperty(PlaceComponent.prototype, "active", {
5198
+ get: function () {
5199
+ return this._active.readonly;
5200
+ },
5201
+ enumerable: true,
5202
+ configurable: true
5203
+ });
5204
+ /**
5205
+ * Called by the router when the place is ready to interact after any animations have run.
5206
+ */
5207
+ PlaceComponent.prototype._notifyActive = function (active) {
5208
+ this._active.value = active;
5209
+ };
5197
5210
  PlaceComponent.prototype.onPlaceReady = function () {
5198
5211
  };
5199
5212
  var PlaceComponent_1;
@@ -6731,6 +6744,7 @@
6731
6744
  _this._activePlaceModel = new pectin.MutableValueModel();
6732
6745
  _this.initialPlaceIndex = null;
6733
6746
  _this._isPushingVisitToRoute = new pectin.MutableValueModel(false);
6747
+ _this.isVeryFirstLoad = true;
6734
6748
  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;
6735
6749
  _this.parentOutletModel = new pectin.MutableValueModel(parentOutlet);
6736
6750
  var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
@@ -6739,8 +6753,9 @@
6739
6753
  .pluckList('children')
6740
6754
  .pluck('component');
6741
6755
  var activatePlaceType = chain(_this.activePlaceModel).map(function (p) { return p.constructor; });
6742
- _this.placeAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
6743
- .otherwise(defaultPlaceAnimationOrder)
6756
+ _this.placesInAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
6757
+ .otherwise(defaultPlaceAnimationOrder);
6758
+ _this.activePlaceAnimationPosition = _this.placesInAnimationOrder
6744
6759
  .reduce(function (placesInOrder) {
6745
6760
  var placeIndex = 0;
6746
6761
  if (activatePlaceType.value) {
@@ -6751,14 +6766,16 @@
6751
6766
  }
6752
6767
  return ___default.isNil(_this.initialPlaceIndex) ? 0 : placeIndex - _this.initialPlaceIndex;
6753
6768
  }, { dependsOn: activatePlaceType });
6769
+ _this.animationSupported = _this.placesInAnimationOrder.count().isGreaterThan(0);
6770
+ _this.animationEnabled = valueOf.all(_this.animateModel, _this.animationSupported).areTruthy();
6754
6771
  // Extract our visit model from the place router.
6755
6772
  _this._activePlaceDefinition = chain(_this._activePlaceModel).pluck('placeDefinition');
6756
6773
  _this.routerVisitModel = _this._activePlaceDefinition.findIn(chain(placeRouter.activeVisitsByPlaceDefinition));
6757
6774
  _this.navigationInProgress = chain(_this.placeRouter.navigationInProgress);
6758
- when.valueOf(_this.navigationInProgress).becomesFalsey(function () {
6775
+ when(_this.navigationInProgress).becomesFalsey(function () {
6759
6776
  _this.checkStateAndInitialise();
6760
6777
  });
6761
- when.valueOf(_this.outletActivated).becomesTruthy(function () {
6778
+ when(_this.outletActivated).becomesTruthy(function () {
6762
6779
  _this.checkStateAndInitialise();
6763
6780
  });
6764
6781
  chain(_this._activePlaceModel)
@@ -6771,7 +6788,7 @@
6771
6788
  };
6772
6789
  // @Trace()
6773
6790
  PlaceOutletComponent.prototype.getAnimationOrder = function () {
6774
- return this.placeAnimationOrder.value;
6791
+ return this.activePlaceAnimationPosition.value;
6775
6792
  };
6776
6793
  Object.defineProperty(PlaceOutletComponent.prototype, "animationDuration", {
6777
6794
  get: function () {
@@ -6782,7 +6799,10 @@
6782
6799
  });
6783
6800
  // @Trace()
6784
6801
  PlaceOutletComponent.prototype.navigate = function (visit) {
6785
- // console.log({ activatedRoute: this._activatedRouteModel.value });
6802
+ // const place = this.placesInAnimationOrder.query().findMatching(p => visit.placeDefinition.component === p);
6803
+ // if (!place) {
6804
+ // lang.illegalState()
6805
+ // }
6786
6806
  this.placeRouter.navigate(visit, {
6787
6807
  relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
6788
6808
  });
@@ -6808,14 +6828,25 @@
6808
6828
  enumerable: true,
6809
6829
  configurable: true
6810
6830
  });
6811
- // @Trace()
6812
6831
  PlaceOutletComponent.prototype.onOutletActivated = function (routerOutlet, place) {
6813
6832
  this._activatedRouteModel.value = routerOutlet.activatedRoute;
6814
6833
  this._activePlaceModel.value = place;
6834
+ this.validateAnimationState(place);
6815
6835
  this.outletActivated.value = true;
6816
6836
  this.checkStateAndInitialise();
6817
6837
  };
6818
- // @Trace()
6838
+ PlaceOutletComponent.prototype.validateAnimationState = function (place) {
6839
+ if (this.animateModel.value) {
6840
+ if (this.placesInAnimationOrder.length < 1) {
6841
+ console.error('PlaceOutlet.animate === true but placeAnimationOrder has not been set. Animation is disabled.');
6842
+ }
6843
+ else {
6844
+ if (!this.placesInAnimationOrder.query().includes(place.placeDefinition.component)) {
6845
+ console.error("PlaceOutlet.animate === true but placeAnimationOrder doesn't contain " + place.placeDefinition.component.name + ".");
6846
+ }
6847
+ }
6848
+ }
6849
+ };
6819
6850
  PlaceOutletComponent.prototype.onOutletDeactivated = function () {
6820
6851
  this.outletActivated.value = false;
6821
6852
  this._activePlaceModel.value = null;
@@ -6832,7 +6863,6 @@
6832
6863
  this.initialisePlace(routerVisit, activePlace);
6833
6864
  }
6834
6865
  };
6835
- // @Trace()
6836
6866
  PlaceOutletComponent.prototype.initialisePlace = function (routerVisit, activePlace) {
6837
6867
  var _this = this;
6838
6868
  var visitModel = new pectin.MutableValueModel(routerVisit);
@@ -6840,9 +6870,18 @@
6840
6870
  activePlace.initialiseVisit(routerVisit, function (current, previous) {
6841
6871
  _this.pushVisitChangeToRoute(previous, current);
6842
6872
  });
6843
- if (!this.animateModel.value) {
6844
- // we're not animating so trigger any post animation callbacks now.
6845
- this.animationDone();
6873
+ var finishPlaceLoad = function () {
6874
+ _this._activePlaceModel.value._notifyActive(true);
6875
+ };
6876
+ if (!this.animationEnabled.value || this.isVeryFirstLoad) {
6877
+ // if animation is disabled or this is the very first load then
6878
+ // we won't get our animation done callback so we finish the
6879
+ // process here and now.
6880
+ this.isVeryFirstLoad = false;
6881
+ finishPlaceLoad();
6882
+ }
6883
+ else {
6884
+ this.onAnimationFinishedJob = finishPlaceLoad;
6846
6885
  }
6847
6886
  var _a = pectin.Dsl.disposeWith(activePlace), when = _a.when, chain = _a.chain, valueOf = _a.valueOf;
6848
6887
  when.valueOf(this.routerVisitModel)
@@ -6865,8 +6904,9 @@
6865
6904
  };
6866
6905
  // @Trace()
6867
6906
  PlaceOutletComponent.prototype.animationDone = function () {
6868
- if (this._activePlaceModel.value) {
6869
- this._activePlaceModel.value.onPlaceReady();
6907
+ if (this.onAnimationFinishedJob) {
6908
+ this.onAnimationFinishedJob();
6909
+ this.onAnimationFinishedJob = undefined;
6870
6910
  }
6871
6911
  };
6872
6912
  PlaceOutletComponent.ctorParameters = function () { return [
@@ -6899,10 +6939,22 @@
6899
6939
  core.ViewChild('routeOutlet', { static: true }),
6900
6940
  __metadata("design:type", router.RouterOutlet)
6901
6941
  ], PlaceOutletComponent.prototype, "routerOut", void 0);
6942
+ __decorate([
6943
+ pectin.Trace(),
6944
+ __metadata("design:type", Function),
6945
+ __metadata("design:paramtypes", [router.RouterOutlet, exports.PlaceComponent]),
6946
+ __metadata("design:returntype", void 0)
6947
+ ], PlaceOutletComponent.prototype, "onOutletActivated", null);
6948
+ __decorate([
6949
+ pectin.Trace(),
6950
+ __metadata("design:type", Function),
6951
+ __metadata("design:paramtypes", []),
6952
+ __metadata("design:returntype", void 0)
6953
+ ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
6902
6954
  PlaceOutletComponent = __decorate([
6903
6955
  core.Component({
6904
6956
  selector: 'aup-place-outlet',
6905
- template: "<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\" cdkScrollable\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animateModel.value\">\n <div class=\"router-outlet-container\" cdkScrollable>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
6957
+ template: "<ng-container *ngIf=\"animationEnabled.value\">\n <div class=\"router-outlet-container\" cdkScrollable\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animationEnabled.value\">\n <div class=\"router-outlet-container\" cdkScrollable>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
6906
6958
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
6907
6959
  styles: [":host{display:flex;flex-direction:column;min-height:0}.router-outlet-container{flex:1;display:block;position:relative;min-height:0;overflow-x:hidden;overflow-y:scroll}router-outlet{display:none}"]
6908
6960
  }),