tuain-ng-forms-lib 15.1.10 → 15.1.12

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,13 +156,11 @@ class FieldComponent extends ElementComponent {
156
156
  }
157
157
  // Subscripción a cambios en atributos
158
158
  this.field?.attributeChange.subscribe(event => {
159
- console.log('FieldComponent attributeChange');
160
- console.log(event);
161
159
  const { name: componentAttr, value = null } = event ?? {};
162
- // if (componentAttr) {
163
- this.defaultProcessAttributeChange(componentAttr, value);
164
- this.customProcessAttributeChange(componentAttr, value);
165
- // }
160
+ if (componentAttr) {
161
+ this.defaultProcessAttributeChange(componentAttr, value);
162
+ this.customProcessAttributeChange(componentAttr, value);
163
+ }
166
164
  });
167
165
  if (this.field) {
168
166
  this.field.widget = this;
@@ -264,13 +262,11 @@ class SectionComponent extends PieceComponent {
264
262
  }
265
263
  // Subscripción a cambios en atributos
266
264
  this.section?.attributeChange.subscribe(event => {
267
- console.log('SectionComponent attributeChange');
268
- console.log(event);
269
265
  const { name: attrName, value = null } = event ?? {};
270
- // if (attrName) {
271
- this.defaultProcessAttributeChange(attrName, value);
272
- this.customProcessAttributeChange(attrName, value);
273
- // }
266
+ if (attrName) {
267
+ this.defaultProcessAttributeChange(attrName, value);
268
+ this.customProcessAttributeChange(attrName, value);
269
+ }
274
270
  });
275
271
  this.start();
276
272
  }
@@ -302,13 +298,11 @@ class SubSectionComponent extends PieceComponent {
302
298
  }
303
299
  // Subscripción a cambios en atributos
304
300
  this.subSection?.attributeChange.subscribe(event => {
305
- console.log('SubSectionComponent attributeChange');
306
- console.log(event);
307
301
  const { name: attrName, value = null } = event ?? {};
308
- // if (attrName) {
309
- this.defaultProcessAttributeChange(attrName, value);
310
- this.customProcessAttributeChange(attrName, value);
311
- // }
302
+ if (attrName) {
303
+ this.defaultProcessAttributeChange(attrName, value);
304
+ this.customProcessAttributeChange(attrName, value);
305
+ }
312
306
  });
313
307
  this.start();
314
308
  }
@@ -454,13 +448,11 @@ class LibTableComponent extends ElementComponent {
454
448
  }
455
449
  // Subscripción a cambios en atributos
456
450
  this.table?.attributeChange.subscribe(event => {
457
- console.log('LibTableComponent attributeChange');
458
- console.log(event);
459
451
  const { name: attrName, value = null } = event ?? {};
460
- // if (attrName) {
461
- this.defaultProcessAttributeChange(attrName, value);
462
- this.customProcessAttributeChange(attrName, value);
463
- // }
452
+ if (attrName) {
453
+ this.defaultProcessAttributeChange(attrName, value);
454
+ this.customProcessAttributeChange(attrName, value);
455
+ }
464
456
  });
465
457
  this.start();
466
458
  }
@@ -468,7 +460,7 @@ class LibTableComponent extends ElementComponent {
468
460
  tableGlobalAction(actionCode) { this.table?.notifyGlobalAction(actionCode); }
469
461
  tableSelectionAction(actionCode) { this.table?.notifySelectionAction(actionCode); }
470
462
  tableActionSelected(actionEvent) { this.table?.notifyInlineAction(actionEvent); }
471
- tableSelectionToggle(recordId) { this.table?.notifyRecordSelection(recordId); }
463
+ tableSelectionToggle(recordId) { console.log('tableSelectionToggle 1'); this.table?.notifyRecordSelection(recordId); }
472
464
  toggleSelectAll() { return (this.table?.allSelected) ? this.table?.unSelectAll() : this.table?.selectAll(); }
473
465
  globalFilterCompleted() { this.changePage(1); }
474
466
  changePage(requestedPage) { this.table?.changePage(requestedPage); }
@@ -670,33 +662,27 @@ class FormPiecePropagate extends FormPiece {
670
662
  }
671
663
  get attributeChange() { return this._attributeChange; }
672
664
  propagateAttribute(name, value) {
673
- console.log(`Propagación ${name} : ${JSON.stringify(value)}`);
674
665
  this._attributeChange?.next({ name, value });
675
666
  }
676
667
  setCustomAttribute(name, value) {
677
668
  super.setCustomAttribute(name, value);
678
669
  if (this.propagationCustomAttributes?.includes(name)) {
679
670
  const fullName = `customAttributes.${name}`;
680
- console.log('piece setCustomAttribute');
681
671
  this.propagateAttribute(fullName, value);
682
672
  }
683
673
  }
684
674
  setVisibility(visible, forced = null) {
685
675
  super.setVisibility(visible, forced);
686
- console.log('piece setVisibility');
687
676
  this.propagateAttribute(VISIBLE, this._visible);
688
677
  }
689
678
  set enabled(enabled) {
690
679
  super.enabled = enabled;
691
- console.log('piece enabled');
692
680
  this.propagateAttribute(DISABLED, this._disabled);
693
681
  }
694
682
  formStateChange(state) {
695
683
  super.formStateChange(state);
696
684
  if (state) {
697
- console.log('piece 1 formStateChange');
698
685
  this.propagateAttribute(VISIBLE, this._visible);
699
- console.log('piece 2 formStateChange');
700
686
  this.propagateAttribute(DISABLED, this._disabled);
701
687
  }
702
688
  }
@@ -711,8 +697,6 @@ class FormElement extends FormPiecePropagate {
711
697
  setAttr(attr, value) {
712
698
  const { name: attrName, propagate: name } = attr;
713
699
  this[attrName] = value;
714
- console.log(`Element setAttr name: ${name}`);
715
- console.log(value);
716
700
  name && this.propagateAttribute(name, value);
717
701
  }
718
702
  isField() { return this.elementType === elementTypes.field; }
@@ -1596,11 +1580,15 @@ class RecordTable extends FormElement {
1596
1580
  this._inlineActionTrigger.next(tableEvent);
1597
1581
  }
1598
1582
  notifyRecordSelection(recordId) {
1583
+ console.log('notifyRecordSelection 1');
1599
1584
  const record = this.getTableRecord(recordId);
1585
+ console.log('notifyRecordSelection 2');
1600
1586
  if (!record) {
1601
1587
  return;
1602
1588
  }
1589
+ console.log('notifyRecordSelection 3');
1603
1590
  record.toggleSelect();
1591
+ console.log('notifyRecordSelection 4');
1604
1592
  this.requestedPage = this.currentPage ?? 1;
1605
1593
  const tableEvent = {
1606
1594
  tableCode: this.tableCode,
@@ -1610,6 +1598,7 @@ class RecordTable extends FormElement {
1610
1598
  recordData: record.recordData
1611
1599
  }
1612
1600
  };
1601
+ console.log(`notifyRecordSelection 5 ${JSON.stringify(tableEvent, null, 2)}`);
1613
1602
  this.recordSelectionTrigger.next(tableEvent);
1614
1603
  }
1615
1604
  notifySelectionAction(actionCode) {
@@ -3013,7 +3002,10 @@ class BasicFormComponent extends FormStructureAndData {
3013
3002
  formTables.forEach(table => {
3014
3003
  table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
3015
3004
  table.globalActionTrigger.subscribe(event => this.startTableGlobalAction(event));
3016
- table.recordSelectionTrigger.subscribe(event => this.startTableRecordSelection(event));
3005
+ table.recordSelectionTrigger.subscribe(event => {
3006
+ console.log(`recordSelectionTrigger subscribe ${JSON.stringify(event, null, 2)}`);
3007
+ this.startTableRecordSelection(event);
3008
+ });
3017
3009
  table.selectionActionTrigger.subscribe(event => this.startTableSelectionAction(event));
3018
3010
  table.getDataTrigger.subscribe(event => this.startTableGetData(event));
3019
3011
  // Adicionalmente se le pide a la tabla se subscriba al cambio de estado del formulario
@@ -3718,12 +3710,16 @@ class BasicFormComponent extends FormStructureAndData {
3718
3710
  }
3719
3711
  }
3720
3712
  async startTableRecordSelection(tableActionEvent) {
3713
+ console.log(`startTableRecordSelection ${JSON.stringify(tableActionEvent, null, 2)}`);
3721
3714
  this.notifyFormActivity();
3715
+ console.log(`startTableRecordSelection 2`);
3722
3716
  const { tableCode, actionDetail } = tableActionEvent;
3723
3717
  const tableObject = this.getTable(tableCode);
3718
+ console.log(`startTableRecordSelection 3`);
3724
3719
  if (!tableObject) {
3725
3720
  return;
3726
3721
  }
3722
+ console.log(`startTableRecordSelection 4`);
3727
3723
  this.resetError();
3728
3724
  const { recordId, recordData } = actionDetail;
3729
3725
  const tableSelectionDetail = {
@@ -3732,23 +3728,30 @@ class BasicFormComponent extends FormStructureAndData {
3732
3728
  recordId,
3733
3729
  recordData
3734
3730
  };
3731
+ console.log(`startTableRecordSelection 5`);
3735
3732
  const tableEventHandlers = this._tableSelectionsStart[tableCode];
3733
+ console.log(`startTableRecordSelection 6 ${tableEventHandlers?.length}`);
3736
3734
  if (tableEventHandlers) {
3737
3735
  const clientActionPromises = [];
3738
3736
  for (const tableSelectionMethod of tableEventHandlers) {
3739
3737
  const { callback, properties } = tableSelectionMethod;
3738
+ console.log(`startTableRecordSelection 7`);
3739
+ console.log(callback);
3740
3740
  const clientActionPromise = callback(tableSelectionDetail);
3741
3741
  clientActionPromises.push(clientActionPromise);
3742
3742
  }
3743
3743
  const clientActionResults = await Promise.all(clientActionPromises);
3744
3744
  const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
3745
+ console.log(`startTableRecordSelection 8 ${continueAction}`);
3745
3746
  if (!continueAction) {
3746
3747
  return;
3747
3748
  }
3748
3749
  }
3750
+ console.log(`startTableRecordSelection 9 ${JSON.stringify(tableSelectionDetail, null, 2)}`);
3749
3751
  this.startTableServerRecordSelection(tableSelectionDetail);
3750
3752
  }
3751
3753
  async startTableServerRecordSelection(tableSelectionDetail) {
3754
+ console.log(`startTableServerRecordSelection 1 ${JSON.stringify(tableSelectionDetail, null, 2)}`);
3752
3755
  const { tableObject, tableCode, recordId, recordData } = tableSelectionDetail;
3753
3756
  if (!tableObject) {
3754
3757
  return;
@@ -3764,14 +3767,17 @@ class BasicFormComponent extends FormStructureAndData {
3764
3767
  tableRecordId: recordId,
3765
3768
  tableRecordData: recordData
3766
3769
  };
3770
+ console.log(`startTableServerRecordSelection 2 ${JSON.stringify(actionSubject, null, 2)}`);
3767
3771
  actionResult = await this
3768
3772
  .requestFormAction(formActions.tableAction, actionSubject);
3769
3773
  serverError = !!this.errorOccured();
3770
3774
  }
3775
+ console.log(`startTableServerRecordSelection 3`);
3771
3776
  await this.finishTableRecordSelection(tableSelectionDetail, actionResult, serverError);
3772
3777
  if (serverError) {
3773
3778
  this.displayTableServerError();
3774
3779
  }
3780
+ console.log(`startTableServerRecordSelection 4`);
3775
3781
  tableObject.freeWaiting();
3776
3782
  }
3777
3783
  async finishTableRecordSelection(tableSelectionDetail, actionResult, serverError = false) {
@@ -3984,6 +3990,7 @@ class BasicFormComponent extends FormStructureAndData {
3984
3990
  }
3985
3991
  notifyFormActivity() {
3986
3992
  if (this._notifyFormActivity) {
3993
+ console.log(`notifyFormActivity ${this.name}`);
3987
3994
  this._eventEmiter.next('formActivity', { code: this.formCode });
3988
3995
  }
3989
3996
  }