tuain-ng-forms-lib 17.1.19 → 17.1.21
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/element.mjs +4 -7
- package/esm2022/lib/classes/forms/form.mjs +13 -11
- package/esm2022/lib/components/forms/basic-form.mjs +14 -4
- package/fesm2022/tuain-ng-forms-lib.mjs +28 -19
- package/fesm2022/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/element.d.ts +3 -3
- package/lib/classes/forms/form.d.ts +8 -7
- package/lib/components/forms/basic-form.d.ts +8 -1
- package/package.json +1 -1
|
@@ -763,14 +763,8 @@ class FormPiecePropagate extends FormPiece {
|
|
|
763
763
|
|
|
764
764
|
class FormElement extends FormPiecePropagate {
|
|
765
765
|
elementType = null;
|
|
766
|
-
isField = false;
|
|
767
|
-
isAction = false;
|
|
768
|
-
isTable = false;
|
|
769
766
|
constructor(elementDefinition, formConfig) {
|
|
770
767
|
super(elementDefinition, formConfig);
|
|
771
|
-
this.isField = this.elementType === elementTypes.field;
|
|
772
|
-
this.isAction = this.elementType === elementTypes.action;
|
|
773
|
-
this.isTable = this.elementType === elementTypes.table;
|
|
774
768
|
}
|
|
775
769
|
setAttr(attr, value) {
|
|
776
770
|
const { name: attrName, propagate: name } = attr;
|
|
@@ -785,6 +779,9 @@ class FormElement extends FormPiecePropagate {
|
|
|
785
779
|
console.log(`Atributo ${attrName} no presente o valor ${value} inconsistente. ${e}`);
|
|
786
780
|
}
|
|
787
781
|
}
|
|
782
|
+
isField() { return this.elementType === elementTypes.field; }
|
|
783
|
+
isAction() { return this.elementType === elementTypes.action; }
|
|
784
|
+
isTable() { return this.elementType === elementTypes.table; }
|
|
788
785
|
}
|
|
789
786
|
|
|
790
787
|
const HEADER = 'HEADER';
|
|
@@ -2352,10 +2349,10 @@ const neverVisible = 'NONE';
|
|
|
2352
2349
|
const onStatesVisible = 'ONSTATES';
|
|
2353
2350
|
class FormStructureAndData {
|
|
2354
2351
|
_stateChange = new Subject();
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2352
|
+
_immutableData = {};
|
|
2353
|
+
_extraInfo = {};
|
|
2354
|
+
_exclusiveSectionsByAttr = {};
|
|
2355
|
+
loadInitialData = true;
|
|
2359
2356
|
subject = null;
|
|
2360
2357
|
stateFlow;
|
|
2361
2358
|
fields = {};
|
|
@@ -2366,10 +2363,11 @@ class FormStructureAndData {
|
|
|
2366
2363
|
actionArray;
|
|
2367
2364
|
tableArray;
|
|
2368
2365
|
sectionArray;
|
|
2369
|
-
_immutableData = {};
|
|
2370
|
-
_extraInfo = {};
|
|
2371
|
-
_exclusiveSectionsByAttr = {};
|
|
2372
2366
|
customAttributes = {};
|
|
2367
|
+
formConfig;
|
|
2368
|
+
state;
|
|
2369
|
+
name = '';
|
|
2370
|
+
title = '';
|
|
2373
2371
|
constructor() {
|
|
2374
2372
|
this.state = '';
|
|
2375
2373
|
this.actionArray = [];
|
|
@@ -2405,9 +2403,10 @@ class FormStructureAndData {
|
|
|
2405
2403
|
if (!definitionReceived) {
|
|
2406
2404
|
return;
|
|
2407
2405
|
}
|
|
2408
|
-
|
|
2409
|
-
this.
|
|
2410
|
-
|
|
2406
|
+
const { form = {} } = definitionReceived;
|
|
2407
|
+
this.name = this.name ?? form.formCode;
|
|
2408
|
+
this.title = form.formTitle ?? this.name;
|
|
2409
|
+
this.loadInitialData = form.loadInitialData ?? true;
|
|
2411
2410
|
allStates = definitionReceived?.states;
|
|
2412
2411
|
this.setStateFlow(definitionReceived?.states, definitionReceived?.transitions, definitionReceived?.defaultState, definitionReceived?.stateDescriptions);
|
|
2413
2412
|
this.immutableData = definitionReceived.immutableData;
|
|
@@ -3103,6 +3102,7 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3103
3102
|
this.fileMgmtServices = fileMgmtServices;
|
|
3104
3103
|
this._eventEmiter = this._eventManager;
|
|
3105
3104
|
this.cleanStart();
|
|
3105
|
+
this.preStart();
|
|
3106
3106
|
this.customPreProcessing();
|
|
3107
3107
|
}
|
|
3108
3108
|
cleanStart() {
|
|
@@ -3144,8 +3144,15 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3144
3144
|
get formVisible() { return this.visible; }
|
|
3145
3145
|
get form() { return this; }
|
|
3146
3146
|
// Métodos virtuales
|
|
3147
|
-
|
|
3147
|
+
preStart() { }
|
|
3148
3148
|
start() { }
|
|
3149
|
+
/**
|
|
3150
|
+
* @deprecated Use preStart
|
|
3151
|
+
*/
|
|
3152
|
+
customPreProcessing() { }
|
|
3153
|
+
/**
|
|
3154
|
+
* @deprecated Overload start
|
|
3155
|
+
*/
|
|
3149
3156
|
customFormStart() { }
|
|
3150
3157
|
displayActionServerError() { }
|
|
3151
3158
|
displayValidationServerError() { }
|
|
@@ -3297,8 +3304,10 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3297
3304
|
this.subscribeTableSubjects();
|
|
3298
3305
|
// Se define el estado inicial y se solicita la acción inicial
|
|
3299
3306
|
this.changeState(initialState || this.defaultState);
|
|
3300
|
-
|
|
3301
|
-
|
|
3307
|
+
if (this.loadInitialData) {
|
|
3308
|
+
const recordResponse = await this.requestFormAction(formActions.getData);
|
|
3309
|
+
this.checkErrorRecordReceived(recordResponse);
|
|
3310
|
+
}
|
|
3302
3311
|
this.visible = true;
|
|
3303
3312
|
this.enabledSections = this.visibleSections ?? [];
|
|
3304
3313
|
this.start();
|