@seniorsistemas/angular-components 16.12.3 → 16.12.4

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.
@@ -7963,38 +7963,6 @@ var CustomFieldsComponent = /** @class */ (function () {
7963
7963
  enumerable: true,
7964
7964
  configurable: true
7965
7965
  });
7966
- CustomFieldsComponent.prototype.registerOnChange = function (fn) {
7967
- var _this = this;
7968
- this.onChange = fn;
7969
- this.formGroup.valueChanges.subscribe(function () { return _this.onChange(_this.parseFieldsValues()); });
7970
- };
7971
- CustomFieldsComponent.prototype.registerOnTouched = function (fn) {
7972
- this.onTouched = fn;
7973
- };
7974
- CustomFieldsComponent.prototype.writeValue = function (value) {
7975
- if (this.ready) {
7976
- var newValue = this.parseValuesForFields(value);
7977
- this.formGroup.patchValue(newValue);
7978
- this.value = newValue;
7979
- this.createFilesIfSetFormValuesAfterInit();
7980
- }
7981
- else {
7982
- this.formGroup.patchValue(value || {});
7983
- this.value = value;
7984
- }
7985
- };
7986
- CustomFieldsComponent.prototype.setDisabledState = function (isDisabled) {
7987
- if (isDisabled)
7988
- this.formGroup.disable({ emitEvent: false });
7989
- else
7990
- this.formGroup.enable({ emitEvent: false });
7991
- };
7992
- CustomFieldsComponent.prototype.getCustomFields = function () {
7993
- if (this.entityObject && this.entityObject.entity_) {
7994
- return of(this.entityObject);
7995
- }
7996
- return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
7997
- };
7998
7966
  CustomFieldsComponent.prototype.ngOnInit = function () {
7999
7967
  var _this = this;
8000
7968
  if (!this.domain)
@@ -8067,10 +8035,50 @@ var CustomFieldsComponent = /** @class */ (function () {
8067
8035
  _this.ready = true;
8068
8036
  });
8069
8037
  };
8038
+ CustomFieldsComponent.prototype.ngAfterViewInit = function () {
8039
+ this.enableOrDisableFields(this.disableFields);
8040
+ };
8041
+ CustomFieldsComponent.prototype.ngOnChanges = function (changes) {
8042
+ if (changes.disableFields) {
8043
+ this.enableOrDisableFields(changes.disableFields.currentValue);
8044
+ }
8045
+ };
8070
8046
  CustomFieldsComponent.prototype.ngOnDestroy = function () {
8071
8047
  this.ngUsubscribe.next();
8072
8048
  this.ngUsubscribe.complete();
8073
8049
  };
8050
+ CustomFieldsComponent.prototype.registerOnChange = function (fn) {
8051
+ var _this = this;
8052
+ this.onChange = fn;
8053
+ this.formGroup.valueChanges.subscribe(function () { return _this.onChange(_this.parseFieldsValues()); });
8054
+ };
8055
+ CustomFieldsComponent.prototype.registerOnTouched = function (fn) {
8056
+ this.onTouched = fn;
8057
+ };
8058
+ CustomFieldsComponent.prototype.writeValue = function (value) {
8059
+ if (this.ready) {
8060
+ var newValue = this.parseValuesForFields(value);
8061
+ this.formGroup.patchValue(newValue);
8062
+ this.value = newValue;
8063
+ this.createFilesIfSetFormValuesAfterInit();
8064
+ }
8065
+ else {
8066
+ this.formGroup.patchValue(value || {});
8067
+ this.value = value;
8068
+ }
8069
+ };
8070
+ CustomFieldsComponent.prototype.setDisabledState = function (isDisabled) {
8071
+ if (isDisabled)
8072
+ this.formGroup.disable({ emitEvent: false });
8073
+ else
8074
+ this.formGroup.enable({ emitEvent: false });
8075
+ };
8076
+ CustomFieldsComponent.prototype.getCustomFields = function () {
8077
+ if (this.entityObject && this.entityObject.entity_) {
8078
+ return of(this.entityObject);
8079
+ }
8080
+ return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
8081
+ };
8074
8082
  CustomFieldsComponent.prototype.validate = function () {
8075
8083
  var _this = this;
8076
8084
  var errors = {};
@@ -8081,6 +8089,28 @@ var CustomFieldsComponent = /** @class */ (function () {
8081
8089
  });
8082
8090
  return errors;
8083
8091
  };
8092
+ CustomFieldsComponent.prototype.enableOrDisableFields = function (disabled) {
8093
+ var e_1, _a;
8094
+ if (!this.formGroup) {
8095
+ return;
8096
+ }
8097
+ try {
8098
+ for (var _b = __values(Object.keys(this.formGroup.value)), _c = _b.next(); !_c.done; _c = _b.next()) {
8099
+ var controlName = _c.value;
8100
+ disabled ? this.formGroup.get(controlName).disable() : this.formGroup.get(controlName).enable();
8101
+ }
8102
+ }
8103
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
8104
+ finally {
8105
+ try {
8106
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8107
+ }
8108
+ finally { if (e_1) throw e_1.error; }
8109
+ }
8110
+ };
8111
+ CustomFieldsComponent.prototype.cleanFields = function () {
8112
+ this.formGroup.reset();
8113
+ };
8084
8114
  CustomFieldsComponent.prototype.parseValuesForFields = function (values) {
8085
8115
  var parsedValues = __assign({}, values);
8086
8116
  this.fields.forEach(function (field) {
@@ -8468,6 +8498,9 @@ var CustomFieldsComponent = /** @class */ (function () {
8468
8498
  __decorate([
8469
8499
  Input()
8470
8500
  ], CustomFieldsComponent.prototype, "ready$", void 0);
8501
+ __decorate([
8502
+ Input()
8503
+ ], CustomFieldsComponent.prototype, "disableFields", void 0);
8471
8504
  CustomFieldsComponent = CustomFieldsComponent_1 = __decorate([
8472
8505
  Component({
8473
8506
  selector: "s-custom-fields",