@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
@@ -18,7 +18,7 @@ import { MatTableModule } from '@angular/material/table';
18
18
  import { MatTooltipModule } from '@angular/material/tooltip';
19
19
  import { FaIconLibrary, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
20
20
  import { fas } from '@fortawesome/free-solid-svg-icons';
21
- import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, TrackExternal, Command, MutableListModel, Disposable, MutableValueModel, StoreInValueModel, ListModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, StoreInListModel, ValueModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Functions } from '@coolon/pectin';
21
+ import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, TrackExternal, Command, MutableListModel, Disposable, MutableValueModel, StoreInValueModel, ListModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, StoreInListModel, ValueModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Trace, Functions } from '@coolon/pectin';
22
22
  import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
23
23
  import ___default, { isEqual, isNil } from 'lodash';
24
24
  import { Enum } from 'typescript-string-enums';
@@ -3332,7 +3332,7 @@ var ActivityActionsComponent = /** @class */ (function (_super) {
3332
3332
  Component({
3333
3333
  selector: 'aup-activity-actions',
3334
3334
  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",
3335
- 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}"]
3335
+ 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}"]
3336
3336
  })
3337
3337
  ], ActivityActionsComponent);
3338
3338
  return ActivityActionsComponent;
@@ -3693,10 +3693,6 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
3693
3693
  _this.dynamicHeight = false;
3694
3694
  _this.activityRefs = [];
3695
3695
  _this.garbage = new GarbageCollector();
3696
- // We have issues where angular is triggering a leave animation when an
3697
- // new activity is started, but is not running the enter animation
3698
- // when it is scrolled back into view. So we track the tab changes and
3699
- // disable all animations inside the tab while we're animating.
3700
3696
  _this.inAnimation = new MutableValueModel(false);
3701
3697
  return _this;
3702
3698
  }
@@ -3854,6 +3850,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
3854
3850
  var newIndex = this.getActiveActivityCount() - 1;
3855
3851
  if (previousIndex !== newIndex) {
3856
3852
  this.inAnimation.value = true;
3853
+ this.activityRefs[newIndex].setFocused(false);
3857
3854
  this.tabs.selectedIndex = newIndex;
3858
3855
  this.onAnimationFinishedJob = function () {
3859
3856
  _this.activityRefs = _this.activityRefs.filter(function (tab) { return !tab.isComplete(); });
@@ -3897,7 +3894,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
3897
3894
  ActivityContainerComponent = __decorate([
3898
3895
  Component({
3899
3896
  selector: 'aup-activity-container',
3900
- 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",
3897
+ 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",
3901
3898
  styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
3902
3899
  }),
3903
3900
  __metadata("design:paramtypes", [])
@@ -4968,6 +4965,9 @@ var PlaceComponent = /** @class */ (function (_super) {
4968
4965
  var _this = _super.call(this) || this;
4969
4966
  _this.visitModel = new MutableValueModel();
4970
4967
  _this._inVisitUpdate = new Guard();
4968
+ _this._active = new MutableValueModel(false);
4969
+ var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4970
+ when(_this._active).becomesTruthy(function () { return _this.onPlaceReady(); });
4971
4971
  return _this;
4972
4972
  }
4973
4973
  PlaceComponent_1 = PlaceComponent;
@@ -5025,6 +5025,19 @@ var PlaceComponent = /** @class */ (function (_super) {
5025
5025
  enumerable: true,
5026
5026
  configurable: true
5027
5027
  });
5028
+ Object.defineProperty(PlaceComponent.prototype, "active", {
5029
+ get: function () {
5030
+ return this._active.readonly;
5031
+ },
5032
+ enumerable: true,
5033
+ configurable: true
5034
+ });
5035
+ /**
5036
+ * Called by the router when the place is ready to interact after any animations have run.
5037
+ */
5038
+ PlaceComponent.prototype._notifyActive = function (active) {
5039
+ this._active.value = active;
5040
+ };
5028
5041
  PlaceComponent.prototype.onPlaceReady = function () {
5029
5042
  };
5030
5043
  var PlaceComponent_1;
@@ -6562,6 +6575,7 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6562
6575
  _this._activePlaceModel = new MutableValueModel();
6563
6576
  _this.initialPlaceIndex = null;
6564
6577
  _this._isPushingVisitToRoute = new MutableValueModel(false);
6578
+ _this.isVeryFirstLoad = true;
6565
6579
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
6566
6580
  _this.parentOutletModel = new MutableValueModel(parentOutlet);
6567
6581
  var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
@@ -6570,8 +6584,9 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6570
6584
  .pluckList('children')
6571
6585
  .pluck('component');
6572
6586
  var activatePlaceType = chain(_this.activePlaceModel).map(function (p) { return p.constructor; });
6573
- _this.placeAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
6574
- .otherwise(defaultPlaceAnimationOrder)
6587
+ _this.placesInAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
6588
+ .otherwise(defaultPlaceAnimationOrder);
6589
+ _this.activePlaceAnimationPosition = _this.placesInAnimationOrder
6575
6590
  .reduce(function (placesInOrder) {
6576
6591
  var placeIndex = 0;
6577
6592
  if (activatePlaceType.value) {
@@ -6582,14 +6597,16 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6582
6597
  }
6583
6598
  return isNil(_this.initialPlaceIndex) ? 0 : placeIndex - _this.initialPlaceIndex;
6584
6599
  }, { dependsOn: activatePlaceType });
6600
+ _this.animationSupported = _this.placesInAnimationOrder.count().isGreaterThan(0);
6601
+ _this.animationEnabled = valueOf.all(_this.animateModel, _this.animationSupported).areTruthy();
6585
6602
  // Extract our visit model from the place router.
6586
6603
  _this._activePlaceDefinition = chain(_this._activePlaceModel).pluck('placeDefinition');
6587
6604
  _this.routerVisitModel = _this._activePlaceDefinition.findIn(chain(placeRouter.activeVisitsByPlaceDefinition));
6588
6605
  _this.navigationInProgress = chain(_this.placeRouter.navigationInProgress);
6589
- when.valueOf(_this.navigationInProgress).becomesFalsey(function () {
6606
+ when(_this.navigationInProgress).becomesFalsey(function () {
6590
6607
  _this.checkStateAndInitialise();
6591
6608
  });
6592
- when.valueOf(_this.outletActivated).becomesTruthy(function () {
6609
+ when(_this.outletActivated).becomesTruthy(function () {
6593
6610
  _this.checkStateAndInitialise();
6594
6611
  });
6595
6612
  chain(_this._activePlaceModel)
@@ -6602,7 +6619,7 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6602
6619
  };
6603
6620
  // @Trace()
6604
6621
  PlaceOutletComponent.prototype.getAnimationOrder = function () {
6605
- return this.placeAnimationOrder.value;
6622
+ return this.activePlaceAnimationPosition.value;
6606
6623
  };
6607
6624
  Object.defineProperty(PlaceOutletComponent.prototype, "animationDuration", {
6608
6625
  get: function () {
@@ -6613,7 +6630,10 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6613
6630
  });
6614
6631
  // @Trace()
6615
6632
  PlaceOutletComponent.prototype.navigate = function (visit) {
6616
- // console.log({ activatedRoute: this._activatedRouteModel.value });
6633
+ // const place = this.placesInAnimationOrder.query().findMatching(p => visit.placeDefinition.component === p);
6634
+ // if (!place) {
6635
+ // lang.illegalState()
6636
+ // }
6617
6637
  this.placeRouter.navigate(visit, {
6618
6638
  relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
6619
6639
  });
@@ -6639,14 +6659,25 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6639
6659
  enumerable: true,
6640
6660
  configurable: true
6641
6661
  });
6642
- // @Trace()
6643
6662
  PlaceOutletComponent.prototype.onOutletActivated = function (routerOutlet, place) {
6644
6663
  this._activatedRouteModel.value = routerOutlet.activatedRoute;
6645
6664
  this._activePlaceModel.value = place;
6665
+ this.validateAnimationState(place);
6646
6666
  this.outletActivated.value = true;
6647
6667
  this.checkStateAndInitialise();
6648
6668
  };
6649
- // @Trace()
6669
+ PlaceOutletComponent.prototype.validateAnimationState = function (place) {
6670
+ if (this.animateModel.value) {
6671
+ if (this.placesInAnimationOrder.length < 1) {
6672
+ console.error('PlaceOutlet.animate === true but placeAnimationOrder has not been set. Animation is disabled.');
6673
+ }
6674
+ else {
6675
+ if (!this.placesInAnimationOrder.query().includes(place.placeDefinition.component)) {
6676
+ console.error("PlaceOutlet.animate === true but placeAnimationOrder doesn't contain " + place.placeDefinition.component.name + ".");
6677
+ }
6678
+ }
6679
+ }
6680
+ };
6650
6681
  PlaceOutletComponent.prototype.onOutletDeactivated = function () {
6651
6682
  this.outletActivated.value = false;
6652
6683
  this._activePlaceModel.value = null;
@@ -6663,7 +6694,6 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6663
6694
  this.initialisePlace(routerVisit, activePlace);
6664
6695
  }
6665
6696
  };
6666
- // @Trace()
6667
6697
  PlaceOutletComponent.prototype.initialisePlace = function (routerVisit, activePlace) {
6668
6698
  var _this = this;
6669
6699
  var visitModel = new MutableValueModel(routerVisit);
@@ -6671,9 +6701,18 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6671
6701
  activePlace.initialiseVisit(routerVisit, function (current, previous) {
6672
6702
  _this.pushVisitChangeToRoute(previous, current);
6673
6703
  });
6674
- if (!this.animateModel.value) {
6675
- // we're not animating so trigger any post animation callbacks now.
6676
- this.animationDone();
6704
+ var finishPlaceLoad = function () {
6705
+ _this._activePlaceModel.value._notifyActive(true);
6706
+ };
6707
+ if (!this.animationEnabled.value || this.isVeryFirstLoad) {
6708
+ // if animation is disabled or this is the very first load then
6709
+ // we won't get our animation done callback so we finish the
6710
+ // process here and now.
6711
+ this.isVeryFirstLoad = false;
6712
+ finishPlaceLoad();
6713
+ }
6714
+ else {
6715
+ this.onAnimationFinishedJob = finishPlaceLoad;
6677
6716
  }
6678
6717
  var _a = Dsl.disposeWith(activePlace), when = _a.when, chain = _a.chain, valueOf = _a.valueOf;
6679
6718
  when.valueOf(this.routerVisitModel)
@@ -6696,8 +6735,9 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6696
6735
  };
6697
6736
  // @Trace()
6698
6737
  PlaceOutletComponent.prototype.animationDone = function () {
6699
- if (this._activePlaceModel.value) {
6700
- this._activePlaceModel.value.onPlaceReady();
6738
+ if (this.onAnimationFinishedJob) {
6739
+ this.onAnimationFinishedJob();
6740
+ this.onAnimationFinishedJob = undefined;
6701
6741
  }
6702
6742
  };
6703
6743
  PlaceOutletComponent.ctorParameters = function () { return [
@@ -6730,10 +6770,22 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6730
6770
  ViewChild('routeOutlet', { static: true }),
6731
6771
  __metadata("design:type", RouterOutlet)
6732
6772
  ], PlaceOutletComponent.prototype, "routerOut", void 0);
6773
+ __decorate([
6774
+ Trace(),
6775
+ __metadata("design:type", Function),
6776
+ __metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
6777
+ __metadata("design:returntype", void 0)
6778
+ ], PlaceOutletComponent.prototype, "onOutletActivated", null);
6779
+ __decorate([
6780
+ Trace(),
6781
+ __metadata("design:type", Function),
6782
+ __metadata("design:paramtypes", []),
6783
+ __metadata("design:returntype", void 0)
6784
+ ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
6733
6785
  PlaceOutletComponent = __decorate([
6734
6786
  Component({
6735
6787
  selector: 'aup-place-outlet',
6736
- 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",
6788
+ 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",
6737
6789
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
6738
6790
  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}"]
6739
6791
  }),