tuain-ng-forms-lib 14.0.15 → 14.0.17

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.
@@ -1129,8 +1129,15 @@ class RecordTable extends FormElement {
1129
1129
  this._actionsObj = {};
1130
1130
  // Mecanismos de filtrado nueva versión
1131
1131
  this.globalFilterStrings = [];
1132
+ this.layout = null;
1132
1133
  this.tableRecordObj = {};
1134
+ this.visibleRecords = null;
1133
1135
  this.allSelected = false;
1136
+ this.tableCode = '';
1137
+ this.recordsPerPage = 10;
1138
+ this.totalRecordsNumber = 0;
1139
+ this.recordsNumber = 0;
1140
+ this.clientPaging = true;
1134
1141
  this.elementType = elementTypes.table;
1135
1142
  this.waiting = false;
1136
1143
  this.currentPage = 1;
@@ -1262,7 +1269,7 @@ class RecordTable extends FormElement {
1262
1269
  }
1263
1270
  notifyGetDataAction(requestedPage = null) {
1264
1271
  this.updateVisibleRecords();
1265
- this.requestedPage = requestedPage || this.currentPage;
1272
+ this.requestedPage = requestedPage || this.currentPage || 1;
1266
1273
  const tableEvent = {
1267
1274
  tableCode: this.tableCode,
1268
1275
  actionCode: null,
@@ -1324,6 +1331,11 @@ class RecordTable extends FormElement {
1324
1331
  let filteredRecords = this.getFilteredRecords();
1325
1332
  this.setAttr('totalRecordsNumber', filteredRecords.length);
1326
1333
  visibleRecords = filteredRecords.slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
1334
+ const recordsLastPage = this.totalRecordsNumber % this.recordsPerPage;
1335
+ const totalPages = this.totalRecordsNumber / this.recordsPerPage + (recordsLastPage ? 1 : 0);
1336
+ if (this.currentPage > totalPages) {
1337
+ this.currentPage = totalPages || 1;
1338
+ }
1327
1339
  }
1328
1340
  else {
1329
1341
  visibleRecords = this.tableRecords;
@@ -1336,7 +1348,7 @@ class RecordTable extends FormElement {
1336
1348
  this.visible = tableReceived?.visible || true;
1337
1349
  this.totalPages = tableReceived.totalPages || 1;
1338
1350
  this.recordsNumber = tableReceived.recordsNumber;
1339
- this.setAttr('currentPage', +tableReceived?.currentPage ?? 1);
1351
+ this.setAttr('currentPage', +tableReceived?.currentPage || 1);
1340
1352
  this.setAttr('recordsPerPage', +tableReceived.recordsPerPage);
1341
1353
  this.setAttr('totalRecordsNumber', (this.clientPaging) ? tableReceived.tableRecords.length : +tableReceived.totalRecordsNumber);
1342
1354
  this.setAttr('sorting', {