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
|
@@ -2565,6 +2565,7 @@ class BasicFormComponent {
|
|
|
2565
2565
|
this._formRoute = null;
|
|
2566
2566
|
this._definitionObtained = false;
|
|
2567
2567
|
// Eventos de acciones y campos
|
|
2568
|
+
this._formChangeState = [];
|
|
2568
2569
|
this._formSectionsCanDeactivate = {};
|
|
2569
2570
|
this._formSectionsActivate = {};
|
|
2570
2571
|
this._formSectionsInactivate = {};
|
|
@@ -2607,7 +2608,6 @@ class BasicFormComponent {
|
|
|
2607
2608
|
cleanData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData(); }
|
|
2608
2609
|
getCurrentState() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getCurrentState(); }
|
|
2609
2610
|
supportState(state) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state !== null && state !== void 0 ? state : '')) !== null && _b !== void 0 ? _b : false; }
|
|
2610
|
-
changeState(state) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state)) !== null && _b !== void 0 ? _b : false; }
|
|
2611
2611
|
getStates() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states; }
|
|
2612
2612
|
getImmutableElement(name) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name); }
|
|
2613
2613
|
getExtraInfo(name) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name); }
|
|
@@ -2868,6 +2868,7 @@ class BasicFormComponent {
|
|
|
2868
2868
|
// Se limpian los manejadores de eventos
|
|
2869
2869
|
this.visible = false;
|
|
2870
2870
|
this.busy = false;
|
|
2871
|
+
this._formChangeState = [];
|
|
2871
2872
|
this._formSectionsCanDeactivate = {};
|
|
2872
2873
|
this._formSectionsActivate = {};
|
|
2873
2874
|
this._formSectionsInactivate = {};
|
|
@@ -2897,7 +2898,7 @@ class BasicFormComponent {
|
|
|
2897
2898
|
get form() { return this._formStructure; }
|
|
2898
2899
|
get state() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state) !== null && _b !== void 0 ? _b : null; }
|
|
2899
2900
|
get currentState() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state) !== null && _b !== void 0 ? _b : ''; }
|
|
2900
|
-
set currentState(state) {
|
|
2901
|
+
set currentState(state) { this === null || this === void 0 ? void 0 : this.changeState(state); }
|
|
2901
2902
|
get immutableData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; }
|
|
2902
2903
|
get extraInfo() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.extraInfo; }
|
|
2903
2904
|
get visibleSections() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections) !== null && _b !== void 0 ? _b : null; }
|
|
@@ -3074,7 +3075,7 @@ class BasicFormComponent {
|
|
|
3074
3075
|
}
|
|
3075
3076
|
}
|
|
3076
3077
|
formInit(params, forceReload = false) {
|
|
3077
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
3078
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3078
3079
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3079
3080
|
let initialState = this.preocessInputParams(params);
|
|
3080
3081
|
if (!this.name) {
|
|
@@ -3107,15 +3108,28 @@ class BasicFormComponent {
|
|
|
3107
3108
|
this.subscribeActionSubjects();
|
|
3108
3109
|
this.subscribeTableSubjects();
|
|
3109
3110
|
// Se define el estado inicial y se solicita la acción inicial
|
|
3110
|
-
|
|
3111
|
+
this.changeState(initialState || ((_f = this._formStructure) === null || _f === void 0 ? void 0 : _f.defaultState));
|
|
3111
3112
|
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
3112
3113
|
this.checkErrorRecordReceived(recordResponse);
|
|
3113
3114
|
this.visible = true;
|
|
3114
|
-
this.enabledSections = (
|
|
3115
|
+
this.enabledSections = (_h = (_g = this._formStructure) === null || _g === void 0 ? void 0 : _g.visibleSections) !== null && _h !== void 0 ? _h : [];
|
|
3115
3116
|
this.start();
|
|
3116
3117
|
this.customFormStart();
|
|
3117
3118
|
});
|
|
3118
3119
|
}
|
|
3120
|
+
changeState(state) {
|
|
3121
|
+
var _a, _b;
|
|
3122
|
+
const stateChanged = (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state !== null && state !== void 0 ? state : '')) !== null && _b !== void 0 ? _b : false;
|
|
3123
|
+
if (stateChanged) {
|
|
3124
|
+
const clientActionMethods = this._formChangeState;
|
|
3125
|
+
if (clientActionMethods && clientActionMethods.length > 0) {
|
|
3126
|
+
for (const callback of clientActionMethods) {
|
|
3127
|
+
callback(state);
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
return stateChanged;
|
|
3132
|
+
}
|
|
3119
3133
|
checkErrorRecordReceived(recordResponse) {
|
|
3120
3134
|
const { error } = recordResponse;
|
|
3121
3135
|
if (!error) {
|
|
@@ -3230,6 +3244,9 @@ class BasicFormComponent {
|
|
|
3230
3244
|
/**
|
|
3231
3245
|
* Manejo de event handlers para acciones sobre el formulario
|
|
3232
3246
|
*/
|
|
3247
|
+
onFormChange(callback) {
|
|
3248
|
+
this._formChangeState.push(callback);
|
|
3249
|
+
}
|
|
3233
3250
|
onSectionCanDeactivate(codes, callback, properties = null) {
|
|
3234
3251
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3235
3252
|
sectionSet.forEach((sectionName) => {
|