tuain-ng-forms-lib 17.2.8 → 17.2.11
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/table/table.mjs +9 -3
- package/esm2022/lib/components/elements/tables/table-record-action.component.mjs +1 -7
- package/esm2022/lib/components/forms/basic-form.mjs +13 -11
- package/fesm2022/tuain-ng-forms-lib.mjs +20 -18
- package/fesm2022/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/table/table.d.ts +2 -1
- package/package.json +1 -1
|
@@ -436,9 +436,6 @@ class LibTableRecordActionComponent extends PieceComponent {
|
|
|
436
436
|
if (this.action && this.action.restrictedOnField && this.recordData) {
|
|
437
437
|
const relatedField = this.action.restrictedOnField;
|
|
438
438
|
if (relatedField) {
|
|
439
|
-
console.log('this.action.actionCode');
|
|
440
|
-
console.log(this.action.actionCode);
|
|
441
|
-
console.log(this.action);
|
|
442
439
|
const relatedFieldValue = this.recordData[relatedField];
|
|
443
440
|
const restrictionOper = this.action.restrictedOnOperator;
|
|
444
441
|
const restrictionValue = this.action.restrictedOnValue;
|
|
@@ -449,9 +446,6 @@ class LibTableRecordActionComponent extends PieceComponent {
|
|
|
449
446
|
else if ((restrictionOper === '!=' || restrictionOper === '!==') && relatedFieldValue !== restrictionValue) {
|
|
450
447
|
visibility = true;
|
|
451
448
|
}
|
|
452
|
-
console.log({
|
|
453
|
-
relatedField, relatedFieldValue, restrictionOper, restrictionValue, visibility
|
|
454
|
-
});
|
|
455
449
|
this.visible.set(visibility);
|
|
456
450
|
}
|
|
457
451
|
}
|
|
@@ -1895,7 +1889,7 @@ class RecordTable extends FormElement {
|
|
|
1895
1889
|
this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
|
|
1896
1890
|
return true;
|
|
1897
1891
|
}
|
|
1898
|
-
setTableRecords(tableRecords, append) {
|
|
1892
|
+
setTableRecords(tableRecords, append = false, prepend = false) {
|
|
1899
1893
|
if (!append) {
|
|
1900
1894
|
this._tableRecords = [];
|
|
1901
1895
|
this._tableRecordObj = {};
|
|
@@ -1907,13 +1901,19 @@ class RecordTable extends FormElement {
|
|
|
1907
1901
|
for (const tableRecord of tableRecords) {
|
|
1908
1902
|
const recordReceived = new TableRecordData(tableRecord, this._columns, this._selectionField);
|
|
1909
1903
|
const recordIdKey = recordReceived.recordIdKey;
|
|
1910
|
-
|
|
1904
|
+
if (prepend) {
|
|
1905
|
+
newRecords.unshift(recordReceived);
|
|
1906
|
+
}
|
|
1907
|
+
else {
|
|
1908
|
+
newRecords.push(recordReceived);
|
|
1909
|
+
}
|
|
1911
1910
|
newRecordsObj[recordIdKey] = recordReceived;
|
|
1912
1911
|
}
|
|
1913
1912
|
this._tableRecords = newRecords;
|
|
1914
1913
|
this._tableRecordObj = newRecordsObj;
|
|
1915
1914
|
}
|
|
1916
1915
|
appendRecords(records) { this.setTableRecords(records, true); }
|
|
1916
|
+
prependRecords(records) { this.setTableRecords(records, true, true); }
|
|
1917
1917
|
replaceRecords(records) { this.setTableRecords(records, false); }
|
|
1918
1918
|
setTableAppend(append) { this._appendPages = append; }
|
|
1919
1919
|
changePage(requestedPage) {
|
|
@@ -3645,6 +3645,13 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3645
3645
|
if (!actionObject) {
|
|
3646
3646
|
return;
|
|
3647
3647
|
}
|
|
3648
|
+
if (this._actionsInProgress[code]) {
|
|
3649
|
+
const { sent } = this._actionsInProgress[code];
|
|
3650
|
+
console.log(`Acción ${code} en ejecución desde ${sent}`);
|
|
3651
|
+
return;
|
|
3652
|
+
}
|
|
3653
|
+
console.log(`Acción ${code} arranca desde ${new Date()}`);
|
|
3654
|
+
this._actionsInProgress[code] = { sent: new Date() };
|
|
3648
3655
|
this.resetError();
|
|
3649
3656
|
actionObject.start();
|
|
3650
3657
|
const clientActionMethods = this._formActionsStart[code];
|
|
@@ -3659,10 +3666,14 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3659
3666
|
const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3660
3667
|
if (!continueAction) {
|
|
3661
3668
|
actionObject.stop();
|
|
3669
|
+
this._actionsInProgress[code] = null;
|
|
3670
|
+
delete this._actionsInProgress[code];
|
|
3662
3671
|
return;
|
|
3663
3672
|
}
|
|
3664
3673
|
}
|
|
3665
3674
|
this.startServerAction(actionObject);
|
|
3675
|
+
this._actionsInProgress[code] = null;
|
|
3676
|
+
delete this._actionsInProgress[code];
|
|
3666
3677
|
}
|
|
3667
3678
|
async startServerAction(actionInput) {
|
|
3668
3679
|
const action = (typeof actionInput === 'string')
|
|
@@ -3673,16 +3684,7 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3673
3684
|
let serverError = false;
|
|
3674
3685
|
let actionResult = null;
|
|
3675
3686
|
if (action.backend) {
|
|
3676
|
-
|
|
3677
|
-
const { sent } = this._actionsInProgress[action.actionCode];
|
|
3678
|
-
console.log(`Acción ${action.actionCode} en ejecución desde ${sent}`);
|
|
3679
|
-
}
|
|
3680
|
-
else {
|
|
3681
|
-
this._actionsInProgress[action.actionCode] = { sent: new Date() };
|
|
3682
|
-
actionResult = await this.requestFormAction(action.actionCode);
|
|
3683
|
-
this._actionsInProgress[action.actionCode] = null;
|
|
3684
|
-
delete this._actionsInProgress[action.actionCode];
|
|
3685
|
-
}
|
|
3687
|
+
actionResult = await this.requestFormAction(action.actionCode);
|
|
3686
3688
|
}
|
|
3687
3689
|
await this.finishAction(action, actionResult, serverError);
|
|
3688
3690
|
serverError = !!this.errorOccured();
|