tuain-ng-forms-lib 14.0.14 → 14.0.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.
- package/esm2020/lib/classes/forms/field.mjs +7 -3
- package/esm2020/lib/classes/forms/table/table.mjs +13 -1
- package/fesm2015/tuain-ng-forms-lib.mjs +18 -2
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +18 -2
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/table/table.d.ts +2 -2
- package/package.json +1 -1
|
@@ -705,7 +705,9 @@ class FieldDescriptor extends FormElement {
|
|
|
705
705
|
notifyEditionFinish() {
|
|
706
706
|
const fieldValue = this.getValue();
|
|
707
707
|
this.resetError();
|
|
708
|
-
const
|
|
708
|
+
const validationConfig = this._formConfig.fieldValidations?.[this.fieldType] ?? {};
|
|
709
|
+
const { type, validation } = validationConfig;
|
|
710
|
+
let message = validationConfig?.message;
|
|
709
711
|
let intrinsicValidation = true;
|
|
710
712
|
if (fieldValue && (validation || this.fieldFormat)) {
|
|
711
713
|
if (type === 'regexp') {
|
|
@@ -713,7 +715,9 @@ class FieldDescriptor extends FormElement {
|
|
|
713
715
|
&& (this.fieldFormat?.test(fieldValue) ?? true);
|
|
714
716
|
}
|
|
715
717
|
else if (type === 'function' && typeof validation === 'function') {
|
|
716
|
-
|
|
718
|
+
const { valid, message: customMessage } = validation(fieldValue, this);
|
|
719
|
+
intrinsicValidation = valid;
|
|
720
|
+
message = customMessage;
|
|
717
721
|
}
|
|
718
722
|
if (!intrinsicValidation) {
|
|
719
723
|
this.setError('99', message ?? this._intrinsicErrorMessage);
|
|
@@ -1125,8 +1129,15 @@ class RecordTable extends FormElement {
|
|
|
1125
1129
|
this._actionsObj = {};
|
|
1126
1130
|
// Mecanismos de filtrado nueva versión
|
|
1127
1131
|
this.globalFilterStrings = [];
|
|
1132
|
+
this.layout = null;
|
|
1128
1133
|
this.tableRecordObj = {};
|
|
1134
|
+
this.visibleRecords = null;
|
|
1129
1135
|
this.allSelected = false;
|
|
1136
|
+
this.tableCode = '';
|
|
1137
|
+
this.recordsPerPage = 10;
|
|
1138
|
+
this.totalRecordsNumber = 0;
|
|
1139
|
+
this.recordsNumber = 0;
|
|
1140
|
+
this.clientPaging = true;
|
|
1130
1141
|
this.elementType = elementTypes.table;
|
|
1131
1142
|
this.waiting = false;
|
|
1132
1143
|
this.currentPage = 1;
|
|
@@ -1320,6 +1331,11 @@ class RecordTable extends FormElement {
|
|
|
1320
1331
|
let filteredRecords = this.getFilteredRecords();
|
|
1321
1332
|
this.setAttr('totalRecordsNumber', filteredRecords.length);
|
|
1322
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;
|
|
1338
|
+
}
|
|
1323
1339
|
}
|
|
1324
1340
|
else {
|
|
1325
1341
|
visibleRecords = this.tableRecords;
|