tuain-form-manager 1.1.16 → 1.1.19

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/lib/form.js CHANGED
@@ -116,7 +116,10 @@ class Form {
116
116
  }
117
117
 
118
118
  getImmutableElement(name) {
119
- const { value, signature } = this._responseData.immutableData[name];
119
+ if (!this._responseData?.immutableData) {
120
+ return null;
121
+ }
122
+ const { value, signature } = this._responseData?.immutableData?.[name] ?? {};
120
123
  const content = JSON.stringify({ name, value });
121
124
  const signatureKey = this._requestContext.signatureKey ?? this._requestContext.deviceKey ?? '1234567890';
122
125
  const checkSignature = crypto.createHmac('sha256', signatureKey).update(content).digest('hex');
@@ -166,11 +169,13 @@ class Form {
166
169
  }
167
170
  if (!this.state) {
168
171
  this.state = newState;
172
+ this.responseData.currentMode = newState;
169
173
  } else {
170
174
  const transitionToChange = this._formDefinition.transitions
171
175
  .find(trns => trns.source === this.state && trns.destination === newState);
172
176
  if (transitionToChange) {
173
177
  this.state = newState;
178
+ this.responseData.currentMode = newState;
174
179
  }
175
180
  }
176
181
  return (this.state === newState);
@@ -213,11 +218,11 @@ class Form {
213
218
 
214
219
  addTableRequest(tableRequest) {
215
220
  const {
216
- tableCode, visible, currentPage, requestedPage,
221
+ tableCode, visible, currentPage, requestedPage, currentFilter,
217
222
  recordsPerPage, sortingColumn, sortingDirection,
218
223
  } = tableRequest;
219
224
  this._requestData.formData.tables[tableCode] = tableRequest;
220
- const constraints = { visible, currentPage, requestedPage, recordsPerPage, sortingColumn, sortingDirection };
225
+ const constraints = { visible, currentPage, requestedPage, recordsPerPage, sortingColumn, sortingDirection, currentFilter };
221
226
  this.setTableConstraints(tableCode, constraints);
222
227
  }
223
228
 
@@ -358,7 +363,7 @@ class Form {
358
363
  const {
359
364
  visible = true, currentPage = 1, requestedPage = 1,
360
365
  recordsPerPage = DEFAULT_RECORDS_PAGE,
361
- sortingColumn, sortingDirection,
366
+ sortingColumn, sortingDirection, currentFilter
362
367
  } = constraints;
363
368
  const tableDef = this.getTableDefinition(tableCode);
364
369
  if (!tableDef) { return; }
@@ -371,6 +376,7 @@ class Form {
371
376
  sortingDirection,
372
377
  totalRecordsNumber: 0,
373
378
  recordsNumber: 0,
379
+ currentFilter,
374
380
  };
375
381
  }
376
382
 
@@ -38,7 +38,6 @@ function exportExchange(form) {
38
38
  const { requestVersion } = form;
39
39
  if (requestVersion === 'TUAINEXCHANGE_1.0') {
40
40
  if (formExportData.formSubject) {
41
- // Se retorna el subject
42
41
  exchangeFormInfo.formSubject = formExportData.formSubject;
43
42
  }
44
43
  exchangeFormInfo.actions = formExportData.actions;
@@ -46,6 +45,7 @@ function exportExchange(form) {
46
45
  exchangeFormInfo.immutableData = formExportData.immutableData;
47
46
  exchangeFormInfo.returnedFile = formExportData.returnedFile;
48
47
  exchangeFormInfo.extraInfo = formExportData.extraInfo;
48
+ exchangeFormInfo.currentMode = formExportData.currentMode;
49
49
  exchangeFormInfo.fields = [];
50
50
  const fieldNames = Object.keys(formExportData.fields);
51
51
  for (let index = 0; index < fieldNames.length; index++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuain-form-manager",
3
- "version": "1.1.16",
3
+ "version": "1.1.19",
4
4
  "description": "Component library to perform operations on Tuain Development Framework forms to interchange information on web or mobile applications based on the data interchange of abstract forms making trnasformation on the data upon actions required on both sides (front and back)",
5
5
  "main": "index.js",
6
6
  "scripts": {