@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.
@@ -8109,38 +8109,6 @@
8109
8109
  enumerable: true,
8110
8110
  configurable: true
8111
8111
  });
8112
- CustomFieldsComponent.prototype.registerOnChange = function (fn) {
8113
- var _this = this;
8114
- this.onChange = fn;
8115
- this.formGroup.valueChanges.subscribe(function () { return _this.onChange(_this.parseFieldsValues()); });
8116
- };
8117
- CustomFieldsComponent.prototype.registerOnTouched = function (fn) {
8118
- this.onTouched = fn;
8119
- };
8120
- CustomFieldsComponent.prototype.writeValue = function (value) {
8121
- if (this.ready) {
8122
- var newValue = this.parseValuesForFields(value);
8123
- this.formGroup.patchValue(newValue);
8124
- this.value = newValue;
8125
- this.createFilesIfSetFormValuesAfterInit();
8126
- }
8127
- else {
8128
- this.formGroup.patchValue(value || {});
8129
- this.value = value;
8130
- }
8131
- };
8132
- CustomFieldsComponent.prototype.setDisabledState = function (isDisabled) {
8133
- if (isDisabled)
8134
- this.formGroup.disable({ emitEvent: false });
8135
- else
8136
- this.formGroup.enable({ emitEvent: false });
8137
- };
8138
- CustomFieldsComponent.prototype.getCustomFields = function () {
8139
- if (this.entityObject && this.entityObject.entity_) {
8140
- return rxjs.of(this.entityObject);
8141
- }
8142
- return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
8143
- };
8144
8112
  CustomFieldsComponent.prototype.ngOnInit = function () {
8145
8113
  var _this = this;
8146
8114
  if (!this.domain)
@@ -8213,10 +8181,50 @@
8213
8181
  _this.ready = true;
8214
8182
  });
8215
8183
  };
8184
+ CustomFieldsComponent.prototype.ngAfterViewInit = function () {
8185
+ this.enableOrDisableFields(this.disableFields);
8186
+ };
8187
+ CustomFieldsComponent.prototype.ngOnChanges = function (changes) {
8188
+ if (changes.disableFields) {
8189
+ this.enableOrDisableFields(changes.disableFields.currentValue);
8190
+ }
8191
+ };
8216
8192
  CustomFieldsComponent.prototype.ngOnDestroy = function () {
8217
8193
  this.ngUsubscribe.next();
8218
8194
  this.ngUsubscribe.complete();
8219
8195
  };
8196
+ CustomFieldsComponent.prototype.registerOnChange = function (fn) {
8197
+ var _this = this;
8198
+ this.onChange = fn;
8199
+ this.formGroup.valueChanges.subscribe(function () { return _this.onChange(_this.parseFieldsValues()); });
8200
+ };
8201
+ CustomFieldsComponent.prototype.registerOnTouched = function (fn) {
8202
+ this.onTouched = fn;
8203
+ };
8204
+ CustomFieldsComponent.prototype.writeValue = function (value) {
8205
+ if (this.ready) {
8206
+ var newValue = this.parseValuesForFields(value);
8207
+ this.formGroup.patchValue(newValue);
8208
+ this.value = newValue;
8209
+ this.createFilesIfSetFormValuesAfterInit();
8210
+ }
8211
+ else {
8212
+ this.formGroup.patchValue(value || {});
8213
+ this.value = value;
8214
+ }
8215
+ };
8216
+ CustomFieldsComponent.prototype.setDisabledState = function (isDisabled) {
8217
+ if (isDisabled)
8218
+ this.formGroup.disable({ emitEvent: false });
8219
+ else
8220
+ this.formGroup.enable({ emitEvent: false });
8221
+ };
8222
+ CustomFieldsComponent.prototype.getCustomFields = function () {
8223
+ if (this.entityObject && this.entityObject.entity_) {
8224
+ return rxjs.of(this.entityObject);
8225
+ }
8226
+ return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
8227
+ };
8220
8228
  CustomFieldsComponent.prototype.validate = function () {
8221
8229
  var _this = this;
8222
8230
  var errors = {};
@@ -8227,6 +8235,28 @@
8227
8235
  });
8228
8236
  return errors;
8229
8237
  };
8238
+ CustomFieldsComponent.prototype.enableOrDisableFields = function (disabled) {
8239
+ var e_1, _a;
8240
+ if (!this.formGroup) {
8241
+ return;
8242
+ }
8243
+ try {
8244
+ for (var _b = __values(Object.keys(this.formGroup.value)), _c = _b.next(); !_c.done; _c = _b.next()) {
8245
+ var controlName = _c.value;
8246
+ disabled ? this.formGroup.get(controlName).disable() : this.formGroup.get(controlName).enable();
8247
+ }
8248
+ }
8249
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
8250
+ finally {
8251
+ try {
8252
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8253
+ }
8254
+ finally { if (e_1) throw e_1.error; }
8255
+ }
8256
+ };
8257
+ CustomFieldsComponent.prototype.cleanFields = function () {
8258
+ this.formGroup.reset();
8259
+ };
8230
8260
  CustomFieldsComponent.prototype.parseValuesForFields = function (values) {
8231
8261
  var parsedValues = __assign({}, values);
8232
8262
  this.fields.forEach(function (field) {
@@ -8614,6 +8644,9 @@
8614
8644
  __decorate([
8615
8645
  core.Input()
8616
8646
  ], CustomFieldsComponent.prototype, "ready$", void 0);
8647
+ __decorate([
8648
+ core.Input()
8649
+ ], CustomFieldsComponent.prototype, "disableFields", void 0);
8617
8650
  CustomFieldsComponent = CustomFieldsComponent_1 = __decorate([
8618
8651
  core.Component({
8619
8652
  selector: "s-custom-fields",