tuain-form-manager 1.1.22 → 1.1.30
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 +20 -2
- package/package.json +1 -1
package/lib/form.js
CHANGED
|
@@ -22,6 +22,13 @@ const ROWSELECTION = 'ROWSELECTION';
|
|
|
22
22
|
const DEFAULT_RECORDS_PAGE = 10;
|
|
23
23
|
const RESTRICTED_ATTRIBUTES = ['actions', 'fields', 'recordTables', 'cookiesToSet', 'immutableData', 'returnedFile'];
|
|
24
24
|
|
|
25
|
+
const FIELD_ASSIGN_ATTRIBUTES = [
|
|
26
|
+
'defaultEditable', 'defaultValue', 'alignment', 'required', 'errorCode', 'errorMessage', 'errorType',
|
|
27
|
+
'tooltip', 'info', 'format', 'intrinsicErrorMessage', 'outputOnly', 'captureType', 'title', 'type',
|
|
28
|
+
'maxLength', 'maxValue', 'minLength', 'minValue', 'validateOnServer', 'serverAction', 'visibleLabel',
|
|
29
|
+
'options',
|
|
30
|
+
];
|
|
31
|
+
|
|
25
32
|
const SESSION_ATTRIBUTES = {
|
|
26
33
|
sessionCode: 'sessionCode',
|
|
27
34
|
profileCode: 'profileCode',
|
|
@@ -236,6 +243,17 @@ class Form {
|
|
|
236
243
|
return inputField;
|
|
237
244
|
}
|
|
238
245
|
|
|
246
|
+
setFieldAttributes(code, attrObj) {
|
|
247
|
+
const field = this.getField(code);
|
|
248
|
+
if (field) {
|
|
249
|
+
Object.entries(attrObj ?? {}).forEach(([attr, value]) => {
|
|
250
|
+
if (FIELD_ASSIGN_ATTRIBUTES.includes(attr)) {
|
|
251
|
+
field[attr] = value;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
239
257
|
setFieldAttribute(fieldCode, attr, value) {
|
|
240
258
|
const fieldObject = this.getField(fieldCode);
|
|
241
259
|
if (fieldObject) { fieldObject[attr] = value; }
|
|
@@ -426,7 +444,7 @@ class Form {
|
|
|
426
444
|
}
|
|
427
445
|
}
|
|
428
446
|
|
|
429
|
-
setFieldOptions(code, options, idField, valueField) {
|
|
447
|
+
setFieldOptions(code, options, idField, valueField, saparator = '-') {
|
|
430
448
|
const fieldObject = this.getField(code);
|
|
431
449
|
if (!fieldObject) { return; }
|
|
432
450
|
fieldObject.fieldOptions = [];
|
|
@@ -434,7 +452,7 @@ class Form {
|
|
|
434
452
|
const optionObj = options[i];
|
|
435
453
|
const fieldOptionId = optionObj?.[idField];
|
|
436
454
|
const fieldOptionValue = Array.isArray(valueField)
|
|
437
|
-
? valueField.reduce((acum, valFld) => `${acum}${optionObj?.[valFld] ?? ''}
|
|
455
|
+
? valueField.reduce((acum, valFld) => `${acum}${optionObj?.[valFld] ?? ''}${saparator}`, '')
|
|
438
456
|
: optionObj?.[valueField] ?? null;
|
|
439
457
|
if (fieldOptionId && fieldOptionValue) {
|
|
440
458
|
fieldObject.fieldOptions.push({ fieldOptionId, fieldOptionValue });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tuain-form-manager",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.30",
|
|
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": {
|