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.
@@ -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
- formConfig;
2356
- state;
2357
- name = '';
2358
- title = '';
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
- this.name = this.name ?? definitionReceived?.form?.formCode;
2409
- this.title = (definitionReceived.form && definitionReceived.form.formTitle)
2410
- ? definitionReceived.form.formTitle : '';
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
- customPreProcessing() { }
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
- const recordResponse = await this.requestFormAction(formActions.getData);
3301
- this.checkErrorRecordReceived(recordResponse);
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();