@coolon/angular-ui-powerups 12.4.0-alpha.33 → 12.4.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.
@@ -25,7 +25,10 @@ aup-inline-string-editor {
25
25
  flex: 1;
26
26
  padding: 1px 0 0 0;
27
27
  margin: 0;
28
- cursor: pointer;
28
+
29
+ &.editing-enabled {
30
+ cursor: pointer;
31
+ }
29
32
 
30
33
  &.place-holder {
31
34
  color: rgba(0,0,0,0.5); // TODO: get the angular theme value for disabled form elements...
@@ -6741,13 +6741,35 @@
6741
6741
  _interactionContext: [{ type: i0.ViewChild, args: [PopupInteractionContextComponent, { static: true },] }]
6742
6742
  };
6743
6743
 
6744
- exports.InlineEditorModel = /** @class */ (function () {
6744
+ exports.InlineEditorModel = /** @class */ (function (_super) {
6745
+ __extends(InlineEditorModel, _super);
6745
6746
  function InlineEditorModel(valueModel, saveCallback) {
6746
- this.valueModel = valueModel;
6747
- this.saveCallback = saveCallback;
6748
- this.editing = new pectin.MutableValueModel(false);
6749
- this._validators = new pectin.MutableListModel();
6747
+ var _this = _super.call(this) || this;
6748
+ _this.valueModel = valueModel;
6749
+ _this.saveCallback = saveCallback;
6750
+ _this.editing = new pectin.MutableValueModel(false);
6751
+ _this._validators = new pectin.MutableListModel();
6752
+ _this._editingEnabled = _this.registerDisposable(new pectin.DelegatingValueModel().withDefault(true));
6753
+ var when = pectin.Dsl.disposeWith(_this).when;
6754
+ when(_this.editingEnabled).becomesFalsey(function () { return _this.cancelEdit(); });
6755
+ return _this;
6750
6756
  }
6757
+ Object.defineProperty(InlineEditorModel.prototype, "editingEnabled", {
6758
+ get: function () {
6759
+ return this._editingEnabled.readonly;
6760
+ },
6761
+ enumerable: false,
6762
+ configurable: true
6763
+ });
6764
+ InlineEditorModel.prototype.disableWhile = function (condition) {
6765
+ var chain = pectin.Dsl.disposeWith(this).chain;
6766
+ this.enableWhile(chain(condition).isFalsey());
6767
+ return this;
6768
+ };
6769
+ InlineEditorModel.prototype.enableWhile = function (condition) {
6770
+ this._editingEnabled.setDelegate(condition);
6771
+ return this;
6772
+ };
6751
6773
  Object.defineProperty(InlineEditorModel.prototype, "validators", {
6752
6774
  get: function () {
6753
6775
  return this._validators.readonly;
@@ -6770,7 +6792,7 @@
6770
6792
  this.editing.value = true;
6771
6793
  };
6772
6794
  return InlineEditorModel;
6773
- }());
6795
+ }(pectin.GarbageCollector));
6774
6796
  (function (InlineEditorModel) {
6775
6797
  function create(valueModel, options) {
6776
6798
  return new InlineEditorModel(valueModel, options.save);
@@ -6801,6 +6823,7 @@
6801
6823
  __extends(InlineStringEditorComponent, _super);
6802
6824
  function InlineStringEditorComponent(interactionService) {
6803
6825
  var _this = _super.call(this) || this;
6826
+ _this.editingEnabled = _this.registerDisposable(new pectin.DelegatingValueModel());
6804
6827
  var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, when = _a.when, valueOf = _a.valueOf;
6805
6828
  var modalIC = interactionService.createModalInteractionContextDisposedWith(_this);
6806
6829
  var resolvedFacesModel = chain(_this.facesModel).map(function (userFaces) {
@@ -6832,7 +6855,7 @@
6832
6855
  case 5: return [2 /*return*/];
6833
6856
  }
6834
6857
  });
6835
- }); });
6858
+ }); }).enableWhile(_this.editingEnabled);
6836
6859
  _this.onDispose(function () { return _this.cancelEdit(); });
6837
6860
  return _this;
6838
6861
  }
@@ -6844,6 +6867,7 @@
6844
6867
  if (!this.editorModel) {
6845
6868
  typescriptUtilities.lang.illegalState('editorModel is required');
6846
6869
  }
6870
+ this.editingEnabled.setDelegate(this.editorModel.editingEnabled);
6847
6871
  when(this.editorModel.editing).becomesTruthy(function () {
6848
6872
  _this.editCommand.execute();
6849
6873
  }, { asLongAs: this.editCommand.enabled });
@@ -6899,7 +6923,7 @@
6899
6923
  exports.InlineStringEditorComponent.decorators = [
6900
6924
  { type: i0.Component, args: [{
6901
6925
  selector: 'aup-inline-string-editor',
6902
- template: "<ng-container *ngIf=\"!editorModel.isEditing()\">\n <div class=\"content\" [class.editable]=\"editCommand.enabled.value\">\n <label>{{label}}</label>\n <p [class.place-holder]=\"empty.value\" (click)=\"editCommand.execute()\">{{displayValue.value}}</p>\n <aup-command *ngIf=\"editCommand.enabled.value\" [command]=\"editCommand\" [faceModel]=\"editFaceModel\"></aup-command>\n </div>\n</ng-container>\n<aup-in-place-interaction-context #interactionContext [animateFirstActivity]=\"false\"></aup-in-place-interaction-context>\n\n"
6926
+ template: "<ng-container *ngIf=\"!editorModel.isEditing()\">\n <div class=\"content\" [class.editable]=\"editCommand.enabled.value\">\n <label>{{label}}</label>\n <p [class.place-holder]=\"empty.value\" [class.editing-enabled]=\"editingEnabled.value\" (click)=\"editCommand.execute()\">{{displayValue.value}}</p>\n <aup-command *ngIf=\"editCommand.enabled.value\" [command]=\"editCommand\" [faceModel]=\"editFaceModel\"></aup-command>\n </div>\n</ng-container>\n<aup-in-place-interaction-context #interactionContext [animateFirstActivity]=\"false\"></aup-in-place-interaction-context>\n\n"
6903
6927
  },] }
6904
6928
  ];
6905
6929
  exports.InlineStringEditorComponent.ctorParameters = function () { return [