tuain-ng-forms-lib 15.1.14 → 15.1.16

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) { console.log('tableSelectionToggle 1'); this.table?.notifyRecordSelection(recordId); }
463
+ tableSelectionToggle(recordId) { 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); }
@@ -912,6 +912,16 @@ class FieldDescriptor extends FormElement {
912
912
  return true;
913
913
  }
914
914
  ;
915
+ if (this._fieldType === this._formConfig.fieldTypes.daterange) {
916
+ if (!Array.isArray(fieldCurrentValue)) {
917
+ return true;
918
+ }
919
+ if (fieldCurrentValue.length !== 2 || !fieldCurrentValue[0] || !fieldCurrentValue[1]) {
920
+ return true;
921
+ }
922
+ return false;
923
+ }
924
+ ;
915
925
  if (this._fieldType === this._formConfig.fieldTypes.phone) {
916
926
  if (!Array.isArray(fieldCurrentValue)) {
917
927
  return true;
@@ -1580,15 +1590,11 @@ class RecordTable extends FormElement {
1580
1590
  this._inlineActionTrigger.next(tableEvent);
1581
1591
  }
1582
1592
  notifyRecordSelection(recordId) {
1583
- console.log('notifyRecordSelection 1');
1584
1593
  const record = this.getTableRecord(recordId);
1585
- console.log('notifyRecordSelection 2');
1586
1594
  if (!record) {
1587
1595
  return;
1588
1596
  }
1589
- console.log('notifyRecordSelection 3');
1590
1597
  record.toggleSelect();
1591
- console.log('notifyRecordSelection 4');
1592
1598
  this.requestedPage = this.currentPage ?? 1;
1593
1599
  const tableEvent = {
1594
1600
  tableCode: this.tableCode,
@@ -1598,7 +1604,6 @@ class RecordTable extends FormElement {
1598
1604
  recordData: record.recordData
1599
1605
  }
1600
1606
  };
1601
- console.log(`notifyRecordSelection 5 ${JSON.stringify(tableEvent, null, 2)}`);
1602
1607
  this.recordSelectionTrigger.next(tableEvent);
1603
1608
  }
1604
1609
  notifySelectionAction(actionCode) {
@@ -3002,10 +3007,7 @@ class BasicFormComponent extends FormStructureAndData {
3002
3007
  formTables.forEach(table => {
3003
3008
  table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
3004
3009
  table.globalActionTrigger.subscribe(event => this.startTableGlobalAction(event));
3005
- table.recordSelectionTrigger.subscribe(event => {
3006
- console.log(`recordSelectionTrigger subscribe ${JSON.stringify(event, null, 2)}`);
3007
- this.startTableRecordSelection(event);
3008
- });
3010
+ table.recordSelectionTrigger.subscribe(event => this.startTableRecordSelection(event));
3009
3011
  table.selectionActionTrigger.subscribe(event => this.startTableSelectionAction(event));
3010
3012
  table.getDataTrigger.subscribe(event => this.startTableGetData(event));
3011
3013
  // Adicionalmente se le pide a la tabla se subscriba al cambio de estado del formulario
@@ -3710,16 +3712,12 @@ class BasicFormComponent extends FormStructureAndData {
3710
3712
  }
3711
3713
  }
3712
3714
  async startTableRecordSelection(tableActionEvent) {
3713
- console.log(`startTableRecordSelection ${JSON.stringify(tableActionEvent, null, 2)}`);
3714
3715
  this.notifyFormActivity();
3715
- console.log(`startTableRecordSelection 2`);
3716
3716
  const { tableCode, actionDetail } = tableActionEvent;
3717
3717
  const tableObject = this.getTable(tableCode);
3718
- console.log(`startTableRecordSelection 3`);
3719
3718
  if (!tableObject) {
3720
3719
  return;
3721
3720
  }
3722
- console.log(`startTableRecordSelection 4`);
3723
3721
  this.resetError();
3724
3722
  const { recordId, recordData } = actionDetail;
3725
3723
  const tableSelectionDetail = {
@@ -3728,31 +3726,23 @@ class BasicFormComponent extends FormStructureAndData {
3728
3726
  recordId,
3729
3727
  recordData
3730
3728
  };
3731
- console.log(`startTableRecordSelection 5`);
3732
3729
  const tableEventHandlers = this._tableSelectionsStart[tableCode];
3733
- console.log(`startTableRecordSelection 6 ${tableEventHandlers?.length}`);
3734
3730
  if (tableEventHandlers) {
3735
3731
  const clientActionPromises = [];
3736
3732
  for (const tableSelectionMethod of tableEventHandlers) {
3737
3733
  const { callback, properties } = tableSelectionMethod;
3738
- console.log(`startTableRecordSelection 7`);
3739
- console.log(callback);
3740
3734
  const clientActionPromise = callback(tableSelectionDetail);
3741
3735
  clientActionPromises.push(clientActionPromise);
3742
3736
  }
3743
3737
  const clientActionResults = await Promise.all(clientActionPromises);
3744
3738
  const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
3745
- console.log(`startTableRecordSelection 8 ${continueAction}`);
3746
3739
  if (!continueAction) {
3747
3740
  return;
3748
3741
  }
3749
3742
  }
3750
- console.log(`startTableRecordSelection 9`);
3751
3743
  this.startTableServerRecordSelection(tableSelectionDetail);
3752
3744
  }
3753
3745
  async startTableServerRecordSelection(tableSelectionDetail) {
3754
- console.log(`startTableServerRecordSelection 1`);
3755
- console.log(tableSelectionDetail);
3756
3746
  const { tableObject, tableCode, recordId, recordData } = tableSelectionDetail;
3757
3747
  if (!tableObject) {
3758
3748
  return;
@@ -3768,17 +3758,14 @@ class BasicFormComponent extends FormStructureAndData {
3768
3758
  tableRecordId: recordId,
3769
3759
  tableRecordData: recordData
3770
3760
  };
3771
- console.log(`startTableServerRecordSelection 2 ${JSON.stringify(actionSubject, null, 2)}`);
3772
3761
  actionResult = await this
3773
3762
  .requestFormAction(formActions.tableAction, actionSubject);
3774
3763
  serverError = !!this.errorOccured();
3775
3764
  }
3776
- console.log(`startTableServerRecordSelection 3`);
3777
3765
  await this.finishTableRecordSelection(tableSelectionDetail, actionResult, serverError);
3778
3766
  if (serverError) {
3779
3767
  this.displayTableServerError();
3780
3768
  }
3781
- console.log(`startTableServerRecordSelection 4`);
3782
3769
  tableObject.freeWaiting();
3783
3770
  }
3784
3771
  async finishTableRecordSelection(tableSelectionDetail, actionResult, serverError = false) {
@@ -3991,7 +3978,6 @@ class BasicFormComponent extends FormStructureAndData {
3991
3978
  }
3992
3979
  notifyFormActivity() {
3993
3980
  if (this._notifyFormActivity) {
3994
- console.log(`notifyFormActivity ${this.name}`);
3995
3981
  this._eventEmiter.next('formActivity', { code: this.formCode });
3996
3982
  }
3997
3983
  }