tuain-ng-forms-lib 17.2.20 → 17.2.26
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/esm2022/lib/classes/forms/field.mjs +2 -1
- package/esm2022/lib/classes/forms/table/table.mjs +12 -15
- package/esm2022/lib/components/elements/tables/table.component.mjs +3 -2
- package/esm2022/lib/components/forms/basic-form.mjs +15 -4
- package/fesm2022/tuain-ng-forms-lib.mjs +28 -18
- package/fesm2022/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/table/table.d.ts +3 -1
- package/lib/components/elements/tables/table.component.d.ts +1 -0
- package/lib/components/forms/basic-form.d.ts +1 -0
- package/package.json +1 -1
|
@@ -510,7 +510,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
510
510
|
|
|
511
511
|
const CUSTOM_ATTRIBUTES = 'customAttributes';
|
|
512
512
|
const signaledAttributes = [
|
|
513
|
-
'allSelected', 'code', 'globalSearch', 'recordsPerPage', 'layout',
|
|
513
|
+
'allSelected', 'code', 'globalSearch', 'restrictedId', 'recordsPerPage', 'layout',
|
|
514
514
|
'columns', 'selectedRecords', 'currentPage', 'totalRecordsNumber', 'visibleRecords',
|
|
515
515
|
'waiting', 'visible', 'disabled',
|
|
516
516
|
];
|
|
@@ -520,6 +520,7 @@ class LibTableComponent extends ElementComponent {
|
|
|
520
520
|
allSelected = signal(null);
|
|
521
521
|
code = signal('');
|
|
522
522
|
globalSearch = signal(null);
|
|
523
|
+
restrictedId = signal(null);
|
|
523
524
|
recordsPerPage = signal(null);
|
|
524
525
|
layout = signal(null);
|
|
525
526
|
columns = signal(null);
|
|
@@ -1361,6 +1362,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1361
1362
|
(attrName === 'fieldTypeCode') && (this.type = attrValue);
|
|
1362
1363
|
(attrName === 'fieldType') && (this.type = attrValue);
|
|
1363
1364
|
(attrName === 'tooltipText') && (this.tooltip = attrValue);
|
|
1365
|
+
(attrName === 'customAttributes') && (this.setCustomAttributes(attrValue));
|
|
1364
1366
|
}
|
|
1365
1367
|
}
|
|
1366
1368
|
}
|
|
@@ -1636,6 +1638,7 @@ const attrs = {
|
|
|
1636
1638
|
tableCode: { name: 'tableCode', propagate: 'code' },
|
|
1637
1639
|
clientPaging: { name: 'clientPaging', propagate: null },
|
|
1638
1640
|
globalSearch: { name: 'globalSearch', propagate: 'globalSearch' },
|
|
1641
|
+
restrictedId: { name: 'restrictedId', propagate: 'restrictedId' },
|
|
1639
1642
|
globalFilterString: { name: '_globalFilterString', propagate: 'globalFilterString' },
|
|
1640
1643
|
sorting: { name: 'sorting', propagate: null },
|
|
1641
1644
|
recordsPerPage: { name: 'recordsPerPage', propagate: 'recordsPerPage' },
|
|
@@ -1661,8 +1664,8 @@ class RecordTable extends FormElement {
|
|
|
1661
1664
|
_globalFilterString = '';
|
|
1662
1665
|
globalFilterStrings = [];
|
|
1663
1666
|
selectedRecords;
|
|
1664
|
-
restrictedId;
|
|
1665
1667
|
layout = null;
|
|
1668
|
+
_restrictedId;
|
|
1666
1669
|
_globalSearch;
|
|
1667
1670
|
_tableRecords;
|
|
1668
1671
|
_tableRecordObj = {};
|
|
@@ -1698,7 +1701,7 @@ class RecordTable extends FormElement {
|
|
|
1698
1701
|
this._actionsObj = {};
|
|
1699
1702
|
this._tableRecords = [];
|
|
1700
1703
|
this._globalSearch = false;
|
|
1701
|
-
this.
|
|
1704
|
+
this._restrictedId = null;
|
|
1702
1705
|
this._tableTitle = tableReceived.tableTitle;
|
|
1703
1706
|
this._appendPages = tableReceived?.append ?? false;
|
|
1704
1707
|
this._selectable = tableReceived?.selectable ?? false;
|
|
@@ -1761,6 +1764,7 @@ class RecordTable extends FormElement {
|
|
|
1761
1764
|
get recordSelectionTrigger() { return this._recordSelectionTrigger.asObservable(); }
|
|
1762
1765
|
get getDataTrigger() { return this._getDataTrigger.asObservable(); }
|
|
1763
1766
|
get globalSearch() { return this._globalSearch; }
|
|
1767
|
+
get restrictedId() { return this._restrictedId; }
|
|
1764
1768
|
get tableRecords() { return this._tableRecords; }
|
|
1765
1769
|
get tableRecordObj() { return this._tableRecordObj; }
|
|
1766
1770
|
get visibleRecords() { return this._visibleRecords; }
|
|
@@ -1784,6 +1788,7 @@ class RecordTable extends FormElement {
|
|
|
1784
1788
|
get globalFilterString() { return this._globalFilterString; }
|
|
1785
1789
|
set globalFilterString(globalFilterString) { this._globalFilterString = globalFilterString; }
|
|
1786
1790
|
set globalSearch(globalSearch) { this._globalSearch = globalSearch; }
|
|
1791
|
+
set restrictedId(restrictedId) { this._restrictedId = restrictedId; }
|
|
1787
1792
|
set tableRecords(tableRecords) { this._tableRecords = tableRecords; }
|
|
1788
1793
|
set tableRecordObj(tableRecordObj) { this._tableRecordObj = tableRecordObj; }
|
|
1789
1794
|
set visibleRecords(visibleRecords) { this._visibleRecords = visibleRecords ?? []; }
|
|
@@ -1902,12 +1907,6 @@ class RecordTable extends FormElement {
|
|
|
1902
1907
|
tableRecord.tableRecordId = tableRecord.tableRecordId ?? tableRecord.recordId ?? tableRecord.recordIdKey;
|
|
1903
1908
|
const recordReceived = new TableRecordData(tableRecord, this._columns, this._selectionField);
|
|
1904
1909
|
const recordIdKey = recordReceived.recordIdKey ?? recordReceived.recordIdKey;
|
|
1905
|
-
if (!recordIdKey) {
|
|
1906
|
-
console.log(`Registro recibido sin idKey`);
|
|
1907
|
-
console.log(recordReceived);
|
|
1908
|
-
console.log(`Origen`);
|
|
1909
|
-
console.log(tableRecord);
|
|
1910
|
-
}
|
|
1911
1910
|
if (newRecordsObj[recordIdKey]) {
|
|
1912
1911
|
continue;
|
|
1913
1912
|
}
|
|
@@ -2041,17 +2040,17 @@ class RecordTable extends FormElement {
|
|
|
2041
2040
|
}
|
|
2042
2041
|
// Filtros
|
|
2043
2042
|
setFilterById(id) {
|
|
2044
|
-
if (this.
|
|
2043
|
+
if (this._restrictedId === id) {
|
|
2045
2044
|
return;
|
|
2046
2045
|
}
|
|
2047
|
-
this.
|
|
2046
|
+
this._restrictedId = id;
|
|
2048
2047
|
this.updateVisibleRecords();
|
|
2049
2048
|
}
|
|
2050
2049
|
cleanIdFilter() {
|
|
2051
|
-
if (this.
|
|
2050
|
+
if (this._restrictedId === null) {
|
|
2052
2051
|
return;
|
|
2053
2052
|
}
|
|
2054
|
-
this.
|
|
2053
|
+
this._restrictedId = null;
|
|
2055
2054
|
this.updateVisibleRecords();
|
|
2056
2055
|
}
|
|
2057
2056
|
setGlobalFilterString(text, notifyComponent = true) {
|
|
@@ -2069,8 +2068,8 @@ class RecordTable extends FormElement {
|
|
|
2069
2068
|
}
|
|
2070
2069
|
getFilteredRecords() {
|
|
2071
2070
|
let filteredRecords = this._tableRecords;
|
|
2072
|
-
if (this.
|
|
2073
|
-
filteredRecords = filteredRecords.filter(record => record.recordId === this.
|
|
2071
|
+
if (this._restrictedId) {
|
|
2072
|
+
filteredRecords = filteredRecords.filter(record => record.recordId === this._restrictedId);
|
|
2074
2073
|
}
|
|
2075
2074
|
if (this.globalFilterStrings.length > 0) {
|
|
2076
2075
|
filteredRecords = filteredRecords.filter(record => record.hasPattern(this.globalFilterStrings, this._tableColumnObj));
|
|
@@ -3180,6 +3179,7 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3180
3179
|
_tableServerError = [];
|
|
3181
3180
|
// Acciones en curso dentro del formulario
|
|
3182
3181
|
_actionsInProgress = {};
|
|
3182
|
+
_serverActionsInProgress = {};
|
|
3183
3183
|
// Datos complementarios del formulario
|
|
3184
3184
|
inputDataFields = {};
|
|
3185
3185
|
extraData = {};
|
|
@@ -3680,19 +3680,27 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3680
3680
|
return;
|
|
3681
3681
|
}
|
|
3682
3682
|
}
|
|
3683
|
-
this.startServerAction(actionObject);
|
|
3683
|
+
await this.startServerAction(actionObject);
|
|
3684
3684
|
this._actionsInProgress[code] = null;
|
|
3685
3685
|
delete this._actionsInProgress[code];
|
|
3686
3686
|
}
|
|
3687
3687
|
async startServerAction(actionInput) {
|
|
3688
3688
|
const action = (typeof actionInput === 'string')
|
|
3689
3689
|
? this.getAction(actionInput) : actionInput;
|
|
3690
|
-
|
|
3690
|
+
const { actionCode: code, backend } = action ?? {};
|
|
3691
|
+
if (!action || !code) {
|
|
3691
3692
|
return;
|
|
3692
3693
|
}
|
|
3693
3694
|
let serverError = false;
|
|
3694
3695
|
let actionResult = null;
|
|
3695
|
-
if (
|
|
3696
|
+
if (backend) {
|
|
3697
|
+
if (this._serverActionsInProgress[code]) {
|
|
3698
|
+
const { sent } = this._serverActionsInProgress[code];
|
|
3699
|
+
console.log(`Reingreso server en acción ${code} con ejecución previa ${sent}`);
|
|
3700
|
+
return;
|
|
3701
|
+
}
|
|
3702
|
+
this._serverActionsInProgress[code] = { sent: new Date() };
|
|
3703
|
+
// Se inicia la parte server de la acción
|
|
3696
3704
|
actionResult = await this.requestFormAction(action.actionCode);
|
|
3697
3705
|
}
|
|
3698
3706
|
await this.finishAction(action, actionResult, serverError);
|
|
@@ -3706,6 +3714,8 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3706
3714
|
callback(action);
|
|
3707
3715
|
}
|
|
3708
3716
|
}
|
|
3717
|
+
this._serverActionsInProgress[code] = null;
|
|
3718
|
+
delete this._serverActionsInProgress[code];
|
|
3709
3719
|
action.stop();
|
|
3710
3720
|
}
|
|
3711
3721
|
async finishAction(action, actionResult, serverError = false) {
|