@coolon/angular-ui-powerups 2.0.0-alpha.36 → 2.0.0-alpha.37

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 (24) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +18 -16
  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/components/commands/command/command.component.js +17 -4
  8. package/esm2015/lib/components/commands/command/command.component.js.map +1 -1
  9. package/esm2015/lib/components/commands/command/command.component.metadata.json +1 -1
  10. package/esm2015/lib/components/commands/group/command-group.js +1 -13
  11. package/esm2015/lib/components/commands/group/command-group.js.map +1 -1
  12. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  13. package/esm5/lib/components/commands/command/command.component.js +17 -4
  14. package/esm5/lib/components/commands/command/command.component.js.map +1 -1
  15. package/esm5/lib/components/commands/group/command-group.js +1 -13
  16. package/esm5/lib/components/commands/group/command-group.js.map +1 -1
  17. package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
  18. package/fesm2015/coolon-angular-ui-powerups.js +18 -16
  19. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  20. package/fesm5/coolon-angular-ui-powerups.js +18 -16
  21. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  22. package/lib/components/commands/command/command.component.d.ts +4 -0
  23. package/lib/components/commands/group/command-group.d.ts +2 -5
  24. package/package.json +1 -1
@@ -728,16 +728,7 @@ class CommandGroup extends GarbageCollector {
728
728
  this.parent = parent;
729
729
  this._rootTemplate = new MutableValueModel();
730
730
  this._registrations = new MutableListModel();
731
- this._childFaceModels = new MutableListModel();
732
- this._faceChangeCount = new MutableValueModel(0);
733
731
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
734
- const childFaces = chain(this._childFaceModels)
735
- .map(m => m.value, { dependsOn: this._faceChangeCount })
736
- .rejectNil();
737
- const iconCount = childFaces
738
- .select(face => !!CommandFace.getIconOf(face))
739
- .count();
740
- this.hasMixedIcons = valueOf.all(iconCount.isGreaterThan(0), iconCount.doesNotEqual(childFaces.length)).areTruthy();
741
732
  this.childTemplates = chain(this._rootTemplate).pluckList('children');
742
733
  this.initialised = chain(this._rootTemplate).isNotNil();
743
734
  }
@@ -785,12 +776,10 @@ class CommandGroup extends GarbageCollector {
785
776
  register(registration) {
786
777
  this._registrations.push(registration);
787
778
  if (registration instanceof Registration.FaceRegistration) {
788
- this._childFaceModels.push(registration.faceModel);
789
779
  const { when } = Dsl.disposeWith(registration);
790
780
  when(registration.faceModel).changes((is, was) => {
791
- this.notifyChildFaceChanged(new CommandFace.Adapter(is), new CommandFace.Adapter(was));
781
+ this.notifyChildFaceChanged(is, was);
792
782
  }, { asLongAs: this.initialised });
793
- registration.onDispose(() => this._childFaceModels.remove(registration.faceModel));
794
783
  }
795
784
  registration.onDispose(() => this._registrations.remove(registration));
796
785
  return registration;
@@ -964,10 +953,15 @@ let CommandComponent = class CommandComponent extends DisposableComponent {
964
953
  super();
965
954
  this.parent = parent;
966
955
  this.CommandFace = CommandFace;
967
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
968
- this.buttonStyle = chain(this.faceModel).map(f => CommandFace.getStyleOf(f));
956
+ const { chain, switchOn } = Dsl.disposeWith(this);
957
+ this.activeFaceModel = switchOn(this.command.busy).toValue(when => {
958
+ when.equalTo(true, this.busyFaceModel);
959
+ when.otherwise(this.faceModel);
960
+ }).otherwise(this.faceModel);
961
+ this.buttonStyle = chain(this.activeFaceModel).map(f => CommandFace.getStyleOf(f));
962
+ this.colorModel = chain(this.activeFaceModel).map(f => CommandFace.getColorOf(f));
969
963
  if (parent) {
970
- this.registerDisposable(this.parent.registerCommand(this.command, this.faceModel));
964
+ this.registerDisposable(this.parent.registerCommand(this.command, this.activeFaceModel));
971
965
  }
972
966
  }
973
967
  ngOnInit() {
@@ -988,10 +982,18 @@ __decorate([
988
982
  Input(), StoreInValueModel('faceModel'),
989
983
  __metadata("design:type", Object)
990
984
  ], CommandComponent.prototype, "face", void 0);
985
+ __decorate([
986
+ Input(), TrackExternal(),
987
+ __metadata("design:type", ValueModel)
988
+ ], CommandComponent.prototype, "busyFaceModel", void 0);
989
+ __decorate([
990
+ Input(), StoreInValueModel('busyFaceModel'),
991
+ __metadata("design:type", Object)
992
+ ], CommandComponent.prototype, "busyFace", void 0);
991
993
  CommandComponent = __decorate([
992
994
  Component({
993
995
  selector: 'aup-command',
994
- template: "<ng-container *ngIf=\"!parent\">\n <ng-container [ngSwitch]=\"buttonStyle.value\">\n <button *ngSwitchCase=\"CommandFace.Style.STROKED\" mat-stroked-button [pectinCommand]=\"command\" [color]=\"CommandFace.getColorOf(face)\">\n <aup-command-face [face]=\"face\"></aup-command-face>\n </button>\n <button *ngSwitchCase=\"CommandFace.Style.RAISED\" mat-raised-button [pectinCommand]=\"command\" [color]=\"CommandFace.getColorOf(face)\">\n <aup-command-face [face]=\"face\"></aup-command-face>\n </button>\n <button *ngSwitchDefault mat-button [pectinCommand]=\"command\" [color]=\"CommandFace.getColorOf(face)\">\n <aup-command-face [face]=\"face\"></aup-command-face>\n </button>\n </ng-container>\n</ng-container>\n"
996
+ template: "<ng-container *ngIf=\"!parent\">\n <ng-container [ngSwitch]=\"buttonStyle.value\">\n <button *ngSwitchCase=\"CommandFace.Style.STROKED\" mat-stroked-button [pectinCommand]=\"command\" [color]=\"colorModel.value\">\n <aup-command-face [face]=\"activeFaceModel.value\"></aup-command-face>\n </button>\n <button *ngSwitchCase=\"CommandFace.Style.RAISED\" mat-raised-button [pectinCommand]=\"command\" [color]=\"colorModel.value\">\n <aup-command-face [face]=\"activeFaceModel.value\"></aup-command-face>\n </button>\n <button *ngSwitchDefault mat-button [pectinCommand]=\"command\" [color]=\"colorModel.value\">\n <aup-command-face [face]=\"activeFaceModel.value\"></aup-command-face>\n </button>\n </ng-container>\n</ng-container>\n"
995
997
  }),
996
998
  __param(0, Optional()),
997
999
  __metadata("design:paramtypes", [CommandGroup])