tuain-ng-forms-lib 14.4.95 → 14.4.96
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/components/forms/basic-form.mjs +20 -4
- package/fesm2015/tuain-ng-forms-lib.mjs +22 -5
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +19 -3
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/components/forms/basic-form.d.ts +3 -1
- package/package.json +1 -1
|
@@ -2517,6 +2517,7 @@ class BasicFormComponent {
|
|
|
2517
2517
|
this._formRoute = null;
|
|
2518
2518
|
this._definitionObtained = false;
|
|
2519
2519
|
// Eventos de acciones y campos
|
|
2520
|
+
this._formChangeState = [];
|
|
2520
2521
|
this._formSectionsCanDeactivate = {};
|
|
2521
2522
|
this._formSectionsActivate = {};
|
|
2522
2523
|
this._formSectionsInactivate = {};
|
|
@@ -2559,7 +2560,6 @@ class BasicFormComponent {
|
|
|
2559
2560
|
cleanData() { return this._formStructure?.cleanData(); }
|
|
2560
2561
|
getCurrentState() { return this._formStructure?.getCurrentState(); }
|
|
2561
2562
|
supportState(state) { return this._formStructure?.supportState(state ?? '') ?? false; }
|
|
2562
|
-
changeState(state) { return this._formStructure?.changeState(state) ?? false; }
|
|
2563
2563
|
getStates() { return this._formStructure?.states; }
|
|
2564
2564
|
getImmutableElement(name) { return this._formStructure?.getImmutableElement(name); }
|
|
2565
2565
|
getExtraInfo(name) { return this._formStructure?.getExtraInfo(name); }
|
|
@@ -2767,6 +2767,7 @@ class BasicFormComponent {
|
|
|
2767
2767
|
// Se limpian los manejadores de eventos
|
|
2768
2768
|
this.visible = false;
|
|
2769
2769
|
this.busy = false;
|
|
2770
|
+
this._formChangeState = [];
|
|
2770
2771
|
this._formSectionsCanDeactivate = {};
|
|
2771
2772
|
this._formSectionsActivate = {};
|
|
2772
2773
|
this._formSectionsInactivate = {};
|
|
@@ -2796,7 +2797,7 @@ class BasicFormComponent {
|
|
|
2796
2797
|
get form() { return this._formStructure; }
|
|
2797
2798
|
get state() { return this._formStructure?.state ?? null; }
|
|
2798
2799
|
get currentState() { return this._formStructure?.state ?? ''; }
|
|
2799
|
-
set currentState(state) { this?.
|
|
2800
|
+
set currentState(state) { this?.changeState(state); }
|
|
2800
2801
|
get immutableData() { return this._formStructure?.immutableData; }
|
|
2801
2802
|
get extraInfo() { return this._formStructure?.extraInfo; }
|
|
2802
2803
|
get visibleSections() { return this._formStructure?.visibleSections ?? null; }
|
|
@@ -2994,7 +2995,7 @@ class BasicFormComponent {
|
|
|
2994
2995
|
this.subscribeActionSubjects();
|
|
2995
2996
|
this.subscribeTableSubjects();
|
|
2996
2997
|
// Se define el estado inicial y se solicita la acción inicial
|
|
2997
|
-
this.
|
|
2998
|
+
this.changeState(initialState || this._formStructure?.defaultState);
|
|
2998
2999
|
const recordResponse = await this.requestFormAction(formActions.getData);
|
|
2999
3000
|
this.checkErrorRecordReceived(recordResponse);
|
|
3000
3001
|
this.visible = true;
|
|
@@ -3002,6 +3003,18 @@ class BasicFormComponent {
|
|
|
3002
3003
|
this.start();
|
|
3003
3004
|
this.customFormStart();
|
|
3004
3005
|
}
|
|
3006
|
+
changeState(state) {
|
|
3007
|
+
const stateChanged = this._formStructure?.changeState(state ?? '') ?? false;
|
|
3008
|
+
if (stateChanged) {
|
|
3009
|
+
const clientActionMethods = this._formChangeState;
|
|
3010
|
+
if (clientActionMethods && clientActionMethods.length > 0) {
|
|
3011
|
+
for (const callback of clientActionMethods) {
|
|
3012
|
+
callback(state);
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
return stateChanged;
|
|
3017
|
+
}
|
|
3005
3018
|
checkErrorRecordReceived(recordResponse) {
|
|
3006
3019
|
const { error } = recordResponse;
|
|
3007
3020
|
if (!error) {
|
|
@@ -3113,6 +3126,9 @@ class BasicFormComponent {
|
|
|
3113
3126
|
/**
|
|
3114
3127
|
* Manejo de event handlers para acciones sobre el formulario
|
|
3115
3128
|
*/
|
|
3129
|
+
onFormChange(callback) {
|
|
3130
|
+
this._formChangeState.push(callback);
|
|
3131
|
+
}
|
|
3116
3132
|
onSectionCanDeactivate(codes, callback, properties = null) {
|
|
3117
3133
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3118
3134
|
sectionSet.forEach((sectionName) => {
|