datasync-dynamic-form 1.1.11 → 1.1.13
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/dist/components/DsDynamicForm.js +16 -12
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
25
25
|
|
|
26
26
|
// reactstrap components
|
|
27
27
|
|
|
28
|
-
const debugging =
|
|
28
|
+
const debugging = false;
|
|
29
29
|
const local = true;
|
|
30
30
|
const production = !local;
|
|
31
31
|
const globals = {
|
|
@@ -130,18 +130,18 @@ class DsDynamicForm extends _react.Component {
|
|
|
130
130
|
getFieldError = pFieldObject => {
|
|
131
131
|
/** Return data value form field object */
|
|
132
132
|
try {
|
|
133
|
-
|
|
133
|
+
if (globals.parameters.debugging) console.log(`getFieldError(${JSON.stringify(pFieldObject)}) -> ${this.state.fieldError}`);
|
|
134
|
+
let dbg = this.state.fieldError[pFieldObject.name] ? this.state.fieldError[pFieldObject.name] : "";
|
|
135
|
+
return `${dbg}`;
|
|
134
136
|
} catch (e) {
|
|
135
|
-
|
|
137
|
+
console.error(`getFieldError raises -> ${e}`);
|
|
138
|
+
return ``;
|
|
136
139
|
}
|
|
137
140
|
};
|
|
138
141
|
_error_label = field => {
|
|
139
142
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
140
143
|
className: "dynamic-form-error"
|
|
141
|
-
}, this.
|
|
142
|
-
};
|
|
143
|
-
getfieldErrorLabel = pFieldObject => {
|
|
144
|
-
return this.getFieldError(pFieldObject);
|
|
144
|
+
}, this.getFieldError(field));
|
|
145
145
|
};
|
|
146
146
|
getFieldLabelTitle = pFieldObject => {
|
|
147
147
|
return /*#__PURE__*/_react.default.createElement("h6", {
|
|
@@ -261,12 +261,14 @@ class DsDynamicForm extends _react.Component {
|
|
|
261
261
|
}), this._error_label(field));
|
|
262
262
|
};
|
|
263
263
|
_combo_field = field => {
|
|
264
|
-
return /*#__PURE__*/_react.default.createElement("div", null, this.getFieldLabelTitle(field),
|
|
264
|
+
return /*#__PURE__*/_react.default.createElement("div", null, this.getFieldLabelTitle(field), () => {
|
|
265
|
+
alert("Combo");
|
|
266
|
+
}, /*#__PURE__*/_react.default.createElement(_multiselectReactDropdown.default, {
|
|
265
267
|
showArrow: true,
|
|
266
268
|
options: field.combo_list,
|
|
267
269
|
isObject: false,
|
|
268
270
|
displayValue: "key",
|
|
269
|
-
selectedValues: this.getFieldData(field.name) ? this.getFieldData(field.name
|
|
271
|
+
selectedValues: this.getFieldData(field.name) ? this.getFieldData(field.name).split(";") : [],
|
|
270
272
|
placeholder: field.placeholder,
|
|
271
273
|
emptyRecordMsg: "",
|
|
272
274
|
onSelect: (selectedList, selectedItem) => {
|
|
@@ -526,13 +528,10 @@ class DsDynamicForm extends _react.Component {
|
|
|
526
528
|
}
|
|
527
529
|
};
|
|
528
530
|
checkValidation = pFieldObject => {
|
|
529
|
-
let fieldName = pFieldObject.name;
|
|
530
|
-
|
|
531
531
|
/** Get field properties */
|
|
532
532
|
let min = pFieldObject.min_length;
|
|
533
533
|
let max = pFieldObject.max_length;
|
|
534
534
|
let fieldValue = this.getFieldData(pFieldObject.name);
|
|
535
|
-
let errorsFieldName = `err_${fieldName}`; /** Error data displayed in dedicated error label, beside input field in Form */
|
|
536
535
|
let nextErrors = [];
|
|
537
536
|
|
|
538
537
|
/** Check basic field validity except combo and radio */
|
|
@@ -554,6 +553,11 @@ class DsDynamicForm extends _react.Component {
|
|
|
554
553
|
if (!fieldValue.match(/^(\d{2}\/\d{2}\/\d{4})$/i)) nextErrors.push(`Format de date incorrect !`);
|
|
555
554
|
}
|
|
556
555
|
if (max > 0 && fieldValue.trim().length > max) nextErrors.push(`trop long, ${fieldValue.trim().length - max} caractères en trop.`);
|
|
556
|
+
if (globals.parameters.debugging) {
|
|
557
|
+
console.log(`pFieldObject.name->`, JSON.stringify(pFieldObject.name));
|
|
558
|
+
console.log(`nextErrors->`, JSON.stringify(nextErrors));
|
|
559
|
+
console.log(`-----------`);
|
|
560
|
+
}
|
|
557
561
|
|
|
558
562
|
//update error field
|
|
559
563
|
this.setFieldError(pFieldObject, nextErrors.join("/"));
|