tuain-ng-forms-lib 15.1.5 → 15.1.8

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.
@@ -156,9 +156,13 @@ class FieldComponent extends ElementComponent {
156
156
  }
157
157
  // Subscripción a cambios en atributos
158
158
  this.field?.attributeChange.subscribe(event => {
159
- const { name: componentAttr, value } = event;
160
- this.defaultProcessAttributeChange(componentAttr, value);
161
- this.customProcessAttributeChange(componentAttr, value);
159
+ console.log('FieldComponent attributeChange');
160
+ console.log(event);
161
+ const { name: componentAttr, value = null } = event ?? {};
162
+ if (componentAttr) {
163
+ this.defaultProcessAttributeChange(componentAttr, value);
164
+ this.customProcessAttributeChange(componentAttr, value);
165
+ }
162
166
  });
163
167
  if (this.field) {
164
168
  this.field.widget = this;
@@ -260,9 +264,13 @@ class SectionComponent extends PieceComponent {
260
264
  }
261
265
  // Subscripción a cambios en atributos
262
266
  this.section?.attributeChange.subscribe(event => {
263
- const { name: attrName, value } = event;
264
- this.defaultProcessAttributeChange(attrName, value);
265
- this.customProcessAttributeChange(attrName, value);
267
+ console.log('SectionComponent attributeChange');
268
+ console.log(event);
269
+ const { name: attrName, value = null } = event ?? {};
270
+ if (attrName) {
271
+ this.defaultProcessAttributeChange(attrName, value);
272
+ this.customProcessAttributeChange(attrName, value);
273
+ }
266
274
  });
267
275
  this.start();
268
276
  }
@@ -294,9 +302,13 @@ class SubSectionComponent extends PieceComponent {
294
302
  }
295
303
  // Subscripción a cambios en atributos
296
304
  this.subSection?.attributeChange.subscribe(event => {
297
- const { name: attrName, value } = event;
298
- this.defaultProcessAttributeChange(attrName, value);
299
- this.customProcessAttributeChange(attrName, value);
305
+ console.log('SubSectionComponent attributeChange');
306
+ console.log(event);
307
+ const { name: attrName, value = null } = event ?? {};
308
+ if (attrName) {
309
+ this.defaultProcessAttributeChange(attrName, value);
310
+ this.customProcessAttributeChange(attrName, value);
311
+ }
300
312
  });
301
313
  this.start();
302
314
  }
@@ -442,9 +454,13 @@ class LibTableComponent extends ElementComponent {
442
454
  }
443
455
  // Subscripción a cambios en atributos
444
456
  this.table?.attributeChange.subscribe(event => {
445
- const { name: attrName, value } = event;
446
- this.defaultProcessAttributeChange(attrName, value);
447
- this.customProcessAttributeChange(attrName, value);
457
+ console.log('LibTableComponent attributeChange');
458
+ console.log(event);
459
+ const { name: attrName, value = null } = event ?? {};
460
+ if (attrName) {
461
+ this.defaultProcessAttributeChange(attrName, value);
462
+ this.customProcessAttributeChange(attrName, value);
463
+ }
448
464
  });
449
465
  this.start();
450
466
  }
@@ -654,27 +670,33 @@ class FormPiecePropagate extends FormPiece {
654
670
  }
655
671
  get attributeChange() { return this._attributeChange; }
656
672
  propagateAttribute(name, value) {
673
+ console.log(`Propagación ${name} : ${JSON.stringify(value)}`);
657
674
  this._attributeChange?.next({ name, value });
658
675
  }
659
676
  setCustomAttribute(name, value) {
660
677
  super.setCustomAttribute(name, value);
661
678
  if (this.propagationCustomAttributes?.includes(name)) {
662
679
  const fullName = `customAttributes.${name}`;
680
+ console.log('piece setCustomAttribute');
663
681
  this.propagateAttribute(fullName, value);
664
682
  }
665
683
  }
666
684
  setVisibility(visible, forced = null) {
667
685
  super.setVisibility(visible, forced);
686
+ console.log('piece setVisibility');
668
687
  this.propagateAttribute(VISIBLE, this._visible);
669
688
  }
670
689
  set enabled(enabled) {
671
690
  super.enabled = enabled;
691
+ console.log('piece enabled');
672
692
  this.propagateAttribute(DISABLED, this._disabled);
673
693
  }
674
694
  formStateChange(state) {
675
695
  super.formStateChange(state);
676
696
  if (state) {
697
+ console.log('piece 1 formStateChange');
677
698
  this.propagateAttribute(VISIBLE, this._visible);
699
+ console.log('piece 2 formStateChange');
678
700
  this.propagateAttribute(DISABLED, this._disabled);
679
701
  }
680
702
  }
@@ -689,6 +711,8 @@ class FormElement extends FormPiecePropagate {
689
711
  setAttr(attr, value) {
690
712
  const { name: attrName, propagate: name } = attr;
691
713
  this[attrName] = value;
714
+ console.log(`Element setAttr name: ${name}`);
715
+ console.log(value);
692
716
  name && this.propagateAttribute(name, value);
693
717
  }
694
718
  isField() { return this.elementType === elementTypes.field; }