tuain-ng-forms-lib 15.1.11 → 15.1.13

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.
@@ -460,7 +460,7 @@ class LibTableComponent extends ElementComponent {
460
460
  tableGlobalAction(actionCode) { this.table?.notifyGlobalAction(actionCode); }
461
461
  tableSelectionAction(actionCode) { this.table?.notifySelectionAction(actionCode); }
462
462
  tableActionSelected(actionEvent) { this.table?.notifyInlineAction(actionEvent); }
463
- tableSelectionToggle(recordId) { this.table?.notifyRecordSelection(recordId); }
463
+ tableSelectionToggle(recordId) { console.log('tableSelectionToggle 1'); this.table?.notifyRecordSelection(recordId); }
464
464
  toggleSelectAll() { return (this.table?.allSelected) ? this.table?.unSelectAll() : this.table?.selectAll(); }
465
465
  globalFilterCompleted() { this.changePage(1); }
466
466
  changePage(requestedPage) { this.table?.changePage(requestedPage); }
@@ -1580,11 +1580,15 @@ class RecordTable extends FormElement {
1580
1580
  this._inlineActionTrigger.next(tableEvent);
1581
1581
  }
1582
1582
  notifyRecordSelection(recordId) {
1583
+ console.log('notifyRecordSelection 1');
1583
1584
  const record = this.getTableRecord(recordId);
1585
+ console.log('notifyRecordSelection 2');
1584
1586
  if (!record) {
1585
1587
  return;
1586
1588
  }
1589
+ console.log('notifyRecordSelection 3');
1587
1590
  record.toggleSelect();
1591
+ console.log('notifyRecordSelection 4');
1588
1592
  this.requestedPage = this.currentPage ?? 1;
1589
1593
  const tableEvent = {
1590
1594
  tableCode: this.tableCode,
@@ -1594,6 +1598,7 @@ class RecordTable extends FormElement {
1594
1598
  recordData: record.recordData
1595
1599
  }
1596
1600
  };
1601
+ console.log(`notifyRecordSelection 5 ${JSON.stringify(tableEvent, null, 2)}`);
1597
1602
  this.recordSelectionTrigger.next(tableEvent);
1598
1603
  }
1599
1604
  notifySelectionAction(actionCode) {
@@ -2997,7 +3002,10 @@ class BasicFormComponent extends FormStructureAndData {
2997
3002
  formTables.forEach(table => {
2998
3003
  table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
2999
3004
  table.globalActionTrigger.subscribe(event => this.startTableGlobalAction(event));
3000
- 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
+ });
3001
3009
  table.selectionActionTrigger.subscribe(event => this.startTableSelectionAction(event));
3002
3010
  table.getDataTrigger.subscribe(event => this.startTableGetData(event));
3003
3011
  // Adicionalmente se le pide a la tabla se subscriba al cambio de estado del formulario
@@ -3702,12 +3710,16 @@ class BasicFormComponent extends FormStructureAndData {
3702
3710
  }
3703
3711
  }
3704
3712
  async startTableRecordSelection(tableActionEvent) {
3713
+ console.log(`startTableRecordSelection ${JSON.stringify(tableActionEvent, null, 2)}`);
3705
3714
  this.notifyFormActivity();
3715
+ console.log(`startTableRecordSelection 2`);
3706
3716
  const { tableCode, actionDetail } = tableActionEvent;
3707
3717
  const tableObject = this.getTable(tableCode);
3718
+ console.log(`startTableRecordSelection 3`);
3708
3719
  if (!tableObject) {
3709
3720
  return;
3710
3721
  }
3722
+ console.log(`startTableRecordSelection 4`);
3711
3723
  this.resetError();
3712
3724
  const { recordId, recordData } = actionDetail;
3713
3725
  const tableSelectionDetail = {
@@ -3716,23 +3728,30 @@ class BasicFormComponent extends FormStructureAndData {
3716
3728
  recordId,
3717
3729
  recordData
3718
3730
  };
3731
+ console.log(`startTableRecordSelection 5`);
3719
3732
  const tableEventHandlers = this._tableSelectionsStart[tableCode];
3733
+ console.log(`startTableRecordSelection 6 ${tableEventHandlers?.length}`);
3720
3734
  if (tableEventHandlers) {
3721
3735
  const clientActionPromises = [];
3722
3736
  for (const tableSelectionMethod of tableEventHandlers) {
3723
3737
  const { callback, properties } = tableSelectionMethod;
3738
+ console.log(`startTableRecordSelection 7`);
3739
+ console.log(callback);
3724
3740
  const clientActionPromise = callback(tableSelectionDetail);
3725
3741
  clientActionPromises.push(clientActionPromise);
3726
3742
  }
3727
3743
  const clientActionResults = await Promise.all(clientActionPromises);
3728
3744
  const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
3745
+ console.log(`startTableRecordSelection 8 ${continueAction}`);
3729
3746
  if (!continueAction) {
3730
3747
  return;
3731
3748
  }
3732
3749
  }
3750
+ console.log(`startTableRecordSelection 9`);
3733
3751
  this.startTableServerRecordSelection(tableSelectionDetail);
3734
3752
  }
3735
3753
  async startTableServerRecordSelection(tableSelectionDetail) {
3754
+ console.log(`startTableServerRecordSelection 1 ${JSON.stringify(tableSelectionDetail, null, 2)}`);
3736
3755
  const { tableObject, tableCode, recordId, recordData } = tableSelectionDetail;
3737
3756
  if (!tableObject) {
3738
3757
  return;
@@ -3748,14 +3767,17 @@ class BasicFormComponent extends FormStructureAndData {
3748
3767
  tableRecordId: recordId,
3749
3768
  tableRecordData: recordData
3750
3769
  };
3770
+ console.log(`startTableServerRecordSelection 2 ${JSON.stringify(actionSubject, null, 2)}`);
3751
3771
  actionResult = await this
3752
3772
  .requestFormAction(formActions.tableAction, actionSubject);
3753
3773
  serverError = !!this.errorOccured();
3754
3774
  }
3775
+ console.log(`startTableServerRecordSelection 3`);
3755
3776
  await this.finishTableRecordSelection(tableSelectionDetail, actionResult, serverError);
3756
3777
  if (serverError) {
3757
3778
  this.displayTableServerError();
3758
3779
  }
3780
+ console.log(`startTableServerRecordSelection 4`);
3759
3781
  tableObject.freeWaiting();
3760
3782
  }
3761
3783
  async finishTableRecordSelection(tableSelectionDetail, actionResult, serverError = false) {
@@ -3968,6 +3990,7 @@ class BasicFormComponent extends FormStructureAndData {
3968
3990
  }
3969
3991
  notifyFormActivity() {
3970
3992
  if (this._notifyFormActivity) {
3993
+ console.log(`notifyFormActivity ${this.name}`);
3971
3994
  this._eventEmiter.next('formActivity', { code: this.formCode });
3972
3995
  }
3973
3996
  }