tuain-ng-forms-lib 14.3.0 → 14.3.20
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/element.mjs +6 -1
- package/esm2020/lib/classes/forms/field.mjs +2 -2
- package/esm2020/lib/classes/forms/section.mjs +6 -1
- package/esm2020/lib/classes/forms/table/action.mjs +10 -1
- package/esm2020/lib/classes/forms/table/column.mjs +23 -3
- package/esm2020/lib/classes/forms/table/table.mjs +11 -4
- package/esm2020/lib/components/elements/tables/table-record-field.component.mjs +7 -2
- package/esm2020/lib/components/forms/basic-form.mjs +3 -3
- package/fesm2015/tuain-ng-forms-lib.mjs +66 -9
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +60 -9
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/element.d.ts +1 -0
- package/lib/classes/forms/section.d.ts +1 -0
- package/lib/classes/forms/table/action.d.ts +3 -0
- package/lib/classes/forms/table/column.d.ts +5 -2
- package/lib/classes/forms/table/table.d.ts +2 -2
- package/lib/components/elements/tables/table-record-field.component.d.ts +2 -1
- package/lib/components/forms/basic-form.d.ts +1 -1
- package/package.json +1 -1
|
@@ -300,13 +300,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
300
300
|
}] } });
|
|
301
301
|
|
|
302
302
|
class LibTableRecordFieldComponent {
|
|
303
|
+
constructor() {
|
|
304
|
+
this.column = null;
|
|
305
|
+
}
|
|
303
306
|
ngOnInit() {
|
|
304
307
|
this.start();
|
|
305
308
|
}
|
|
306
309
|
start() { }
|
|
307
310
|
}
|
|
308
311
|
LibTableRecordFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
309
|
-
LibTableRecordFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: LibTableRecordFieldComponent, selector: "lib-table-record-field", inputs: { fieldCode: "fieldCode", fieldType: "fieldType", fieldValue: "fieldValue" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
312
|
+
LibTableRecordFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: LibTableRecordFieldComponent, selector: "lib-table-record-field", inputs: { fieldCode: "fieldCode", fieldType: "fieldType", fieldValue: "fieldValue", column: "column" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
310
313
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordFieldComponent, decorators: [{
|
|
311
314
|
type: Component,
|
|
312
315
|
args: [{
|
|
@@ -320,6 +323,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
320
323
|
type: Input
|
|
321
324
|
}], fieldValue: [{
|
|
322
325
|
type: Input
|
|
326
|
+
}], column: [{
|
|
327
|
+
type: Input
|
|
323
328
|
}] } });
|
|
324
329
|
|
|
325
330
|
const changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage'];
|
|
@@ -463,6 +468,11 @@ class FormElement {
|
|
|
463
468
|
setCustomAttribute(name, value) { if (name) {
|
|
464
469
|
this.customAttributes[name] = value;
|
|
465
470
|
} }
|
|
471
|
+
setCustomAttributes(attributes) {
|
|
472
|
+
Object.entries(attributes).forEach(([name, value]) => {
|
|
473
|
+
this.setCustomAttribute(name, value);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
466
476
|
matchAttribute(name, value) { return this.customAttributes?.[name] === value; }
|
|
467
477
|
isField() { return this.elementType === elementTypes.field; }
|
|
468
478
|
isAction() { return this.elementType === elementTypes.action; }
|
|
@@ -787,7 +797,7 @@ class FieldDescriptor extends FormElement {
|
|
|
787
797
|
get required() { return this._fieldRequired; }
|
|
788
798
|
set required(required) { this.setAttr(attrs._fieldRequired, required ?? false); }
|
|
789
799
|
get title() { return this._fieldTitle; }
|
|
790
|
-
set title(title) { this.setAttr(attrs._fieldTitle, title
|
|
800
|
+
set title(title) { this.setAttr(attrs._fieldTitle, title?.toString() ?? ''); }
|
|
791
801
|
get tooltip() { return this._tooltipText; }
|
|
792
802
|
set tooltip(tooltip) { this.setAttr(attrs._tooltipText, tooltip); }
|
|
793
803
|
get type() { return this._fieldType; }
|
|
@@ -1005,8 +1015,19 @@ class FieldDescriptor extends FormElement {
|
|
|
1005
1015
|
|
|
1006
1016
|
class RecordTableColumn {
|
|
1007
1017
|
constructor(recTableColReceived, formConfig) {
|
|
1018
|
+
this.fieldCode = '';
|
|
1019
|
+
this.fieldTitle = '';
|
|
1020
|
+
this.fieldType = '';
|
|
1021
|
+
this.fieldAlignment = '';
|
|
1022
|
+
this.fieldFormat = '';
|
|
1023
|
+
this.visible = true;
|
|
1024
|
+
this.sortable = true;
|
|
1025
|
+
this.sortDirections = [];
|
|
1026
|
+
this.customAttributes = {};
|
|
1008
1027
|
// Filtros
|
|
1009
1028
|
this.filterVisible = false;
|
|
1029
|
+
this.filterDef = null;
|
|
1030
|
+
this.filterSetup = null;
|
|
1010
1031
|
this._formConfig = formConfig;
|
|
1011
1032
|
this.filterDef = null;
|
|
1012
1033
|
if (recTableColReceived) {
|
|
@@ -1017,11 +1038,20 @@ class RecordTableColumn {
|
|
|
1017
1038
|
this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
|
|
1018
1039
|
this.visible = recTableColReceived?.visible ?? true;
|
|
1019
1040
|
this.sortable = recTableColReceived?.sortable ?? false;
|
|
1020
|
-
this.sortDirections = (this.sortable) ? ['ascend', 'descend'] : [
|
|
1041
|
+
this.sortDirections = (this.sortable) ? ['ascend', 'descend'] : [];
|
|
1021
1042
|
this.fieldFormat = recTableColReceived.format || '';
|
|
1022
1043
|
this.customAttributes = recTableColReceived?.customAttributes ?? {};
|
|
1023
1044
|
}
|
|
1024
1045
|
}
|
|
1046
|
+
getCustomAttribute(name) { return this.customAttributes?.[name] ?? null; }
|
|
1047
|
+
setCustomAttribute(name, value) { if (name) {
|
|
1048
|
+
this.customAttributes[name] = value;
|
|
1049
|
+
} }
|
|
1050
|
+
setCustomAttributes(attributes) {
|
|
1051
|
+
Object.entries(attributes).forEach(([name, value]) => {
|
|
1052
|
+
this.setCustomAttribute(name, value);
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1025
1055
|
hideFilter() {
|
|
1026
1056
|
this.filterVisible = false;
|
|
1027
1057
|
}
|
|
@@ -1037,7 +1067,7 @@ class RecordTableColumn {
|
|
|
1037
1067
|
addFilter(columnValues, operator) {
|
|
1038
1068
|
this.filterSetup = {
|
|
1039
1069
|
fieldCode: this.fieldCode,
|
|
1040
|
-
operator: operator ?? this.filterDef
|
|
1070
|
+
operator: operator ?? this.filterDef?.operators[0],
|
|
1041
1071
|
values: columnValues,
|
|
1042
1072
|
};
|
|
1043
1073
|
}
|
|
@@ -1081,6 +1111,15 @@ class TableAction {
|
|
|
1081
1111
|
this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
|
|
1082
1112
|
this.customAttributes = actionDefinition?.customAttributes ?? {};
|
|
1083
1113
|
}
|
|
1114
|
+
getCustomAttribute(name) { return this.customAttributes?.[name] ?? null; }
|
|
1115
|
+
setCustomAttribute(name, value) { if (name) {
|
|
1116
|
+
this.customAttributes[name] = value;
|
|
1117
|
+
} }
|
|
1118
|
+
setCustomAttributes(attributes) {
|
|
1119
|
+
Object.entries(attributes).forEach(([name, value]) => {
|
|
1120
|
+
this.setCustomAttribute(name, value);
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1084
1123
|
supportMode(state) { return this.viewOnState(state); }
|
|
1085
1124
|
viewOnState(state) { return this.visibleStates.includes(state); }
|
|
1086
1125
|
enabledOnState(state) { return this.enabledStates.includes(state); }
|
|
@@ -1329,6 +1368,7 @@ class RecordTable extends FormElement {
|
|
|
1329
1368
|
return;
|
|
1330
1369
|
}
|
|
1331
1370
|
record.toggleSelect();
|
|
1371
|
+
this.requestedPage = this.currentPage ?? 1;
|
|
1332
1372
|
const tableEvent = {
|
|
1333
1373
|
tableCode: this.tableCode,
|
|
1334
1374
|
actionCode: null,
|
|
@@ -1380,7 +1420,11 @@ class RecordTable extends FormElement {
|
|
|
1380
1420
|
}
|
|
1381
1421
|
setTableRecords(tableRecords, append) {
|
|
1382
1422
|
if (!append) {
|
|
1383
|
-
this.
|
|
1423
|
+
this.tableRecords = [];
|
|
1424
|
+
this.setAttr('allSelected', false);
|
|
1425
|
+
this.tableRecords.forEach(record => record.unselect());
|
|
1426
|
+
this.setAttr('selectedRecords', []);
|
|
1427
|
+
this.tableRecordObj = {};
|
|
1384
1428
|
}
|
|
1385
1429
|
const newRecordsObj = { ...this.tableRecordObj };
|
|
1386
1430
|
const newRecords = [...this.tableRecords];
|
|
@@ -1413,9 +1457,11 @@ class RecordTable extends FormElement {
|
|
|
1413
1457
|
if (this.clientPaging) {
|
|
1414
1458
|
let filteredRecords = this.getFilteredRecords();
|
|
1415
1459
|
this.setAttr('totalRecordsNumber', filteredRecords.length);
|
|
1416
|
-
|
|
1460
|
+
const sliceNumber1 = (this.currentPage - 1) * this.recordsPerPage;
|
|
1461
|
+
const sliceNumber2 = (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage;
|
|
1462
|
+
visibleRecords = filteredRecords.slice(sliceNumber1, sliceNumber2);
|
|
1417
1463
|
const recordsLastPage = this.totalRecordsNumber % this.recordsPerPage;
|
|
1418
|
-
const totalPages = this.totalRecordsNumber / this.recordsPerPage + (recordsLastPage ? 1 : 0);
|
|
1464
|
+
const totalPages = Math.trunc(this.totalRecordsNumber / this.recordsPerPage + (recordsLastPage ? 1 : 0));
|
|
1419
1465
|
if (this.currentPage > totalPages) {
|
|
1420
1466
|
this.currentPage = totalPages || 1;
|
|
1421
1467
|
}
|
|
@@ -1695,6 +1741,11 @@ class RecordFormSection {
|
|
|
1695
1741
|
}
|
|
1696
1742
|
getCustomAttribute(name) { return this.customAttributes?.[name] ?? null; }
|
|
1697
1743
|
setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
|
|
1744
|
+
setCustomAttributes(attributes) {
|
|
1745
|
+
Object.entries(attributes).forEach(([name, value]) => {
|
|
1746
|
+
this.setCustomAttribute(name, value);
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1698
1749
|
matchAttribute(name, value) { return this.customAttributes?.[name] === value; }
|
|
1699
1750
|
get code() { return this.sectionCode; }
|
|
1700
1751
|
get activation() { return this._activation; }
|
|
@@ -2754,12 +2805,12 @@ class BasicFormComponent {
|
|
|
2754
2805
|
});
|
|
2755
2806
|
}
|
|
2756
2807
|
}
|
|
2757
|
-
async formInit(params) {
|
|
2808
|
+
async formInit(params, forceReload = false) {
|
|
2758
2809
|
let initialState = this.preocessInputParams(params);
|
|
2759
2810
|
if (!this.name) {
|
|
2760
2811
|
return;
|
|
2761
2812
|
}
|
|
2762
|
-
if (!this._definitionObtained) {
|
|
2813
|
+
if (forceReload || !this._definitionObtained) {
|
|
2763
2814
|
this.busy = true;
|
|
2764
2815
|
const formDefinition = await this.formManagerService.getFormDefinition(this.name);
|
|
2765
2816
|
this.busy = false;
|