tuain-form-manager 1.2.0 → 1.2.2

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.
Files changed (2) hide show
  1. package/lib/form.js +15 -5
  2. package/package.json +1 -1
package/lib/form.js CHANGED
@@ -26,7 +26,7 @@ const FIELD_ASSIGN_ATTRIBUTES = [
26
26
  'defaultEditable', 'defaultValue', 'alignment', 'required', 'errorCode', 'errorMessage', 'errorType',
27
27
  'tooltip', 'info', 'format', 'intrinsicErrorMessage', 'outputOnly', 'captureType', 'title', 'type',
28
28
  'maxLength', 'maxValue', 'minLength', 'minValue', 'validateOnServer', 'serverAction', 'visibleLabel',
29
- 'options',
29
+ 'options', 'editable',
30
30
  ];
31
31
 
32
32
  const SESSION_ATTRIBUTES = {
@@ -229,7 +229,9 @@ class Form {
229
229
  recordsPerPage, sortingColumn, sortingDirection,
230
230
  } = tableRequest;
231
231
  this._requestData.formData.tables[tableCode] = tableRequest;
232
- const constraints = { visible, currentPage, requestedPage, recordsPerPage, sortingColumn, sortingDirection, currentFilter };
232
+ const constraints = {
233
+ visible, currentPage, requestedPage, recordsPerPage, sortingColumn, sortingDirection, currentFilter,
234
+ };
233
235
  this.setTableConstraints(tableCode, constraints);
234
236
  }
235
237
 
@@ -448,12 +450,20 @@ class Form {
448
450
  const fieldObject = this.getField(code);
449
451
  if (!fieldObject) { return; }
450
452
  fieldObject.fieldOptions = [];
453
+ const numSeparators = (Array.isArray(valueField)) ? (valueField.length - 1) : 0;
451
454
  for (let i = 0; i < options?.length; i++) {
452
455
  const optionObj = options[i];
453
456
  const fieldOptionId = optionObj?.[idField];
454
- const fieldOptionValue = Array.isArray(valueField)
455
- ? valueField.reduce((acum, valFld) => `${acum}${optionObj?.[valFld] ?? ''}${saparator}`, '')
456
- : optionObj?.[valueField] ?? null;
457
+ let fieldOptionValue = '';
458
+ if (Array.isArray(valueField)) {
459
+ for (let index = 0; index < valueField.length; index++) {
460
+ const textPart = valueField[index];
461
+ fieldOptionValue += (index < numSeparators)
462
+ ? `${optionObj?.[textPart]} ${saparator} ` : optionObj?.[textPart];
463
+ }
464
+ } else {
465
+ fieldOptionValue = optionObj?.[valueField];
466
+ }
457
467
  if (fieldOptionId && fieldOptionValue) {
458
468
  fieldObject.fieldOptions.push({ fieldOptionId, fieldOptionValue });
459
469
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuain-form-manager",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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": {