@bigbinary/neeto-form-frontend 3.12.5 → 3.12.7
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/cjs/BuildForm.js
CHANGED
|
@@ -1001,6 +1001,10 @@ var Form$1 = function Form(_ref) {
|
|
|
1001
1001
|
additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
|
|
1002
1002
|
_ref$isEdit = _ref.isEdit,
|
|
1003
1003
|
isEdit = _ref$isEdit === void 0 ? false : _ref$isEdit;
|
|
1004
|
+
var _useState = React.useState(false),
|
|
1005
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1006
|
+
isFieldCodeInvalid = _useState2[0],
|
|
1007
|
+
setIsFieldCodeInvalid = _useState2[1];
|
|
1004
1008
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1005
1009
|
t = _useTranslation.t;
|
|
1006
1010
|
var _useFormikContext = formik.useFormikContext(),
|
|
@@ -1008,7 +1012,9 @@ var Form$1 = function Form(_ref) {
|
|
|
1008
1012
|
setValues = _useFormikContext.setValues,
|
|
1009
1013
|
setErrors = _useFormikContext.setErrors,
|
|
1010
1014
|
setTouched = _useFormikContext.setTouched,
|
|
1011
|
-
setFieldValue = _useFormikContext.setFieldValue
|
|
1015
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
1016
|
+
errors = _useFormikContext.errors,
|
|
1017
|
+
submitCount = _useFormikContext.submitCount;
|
|
1012
1018
|
var hideQuestionHelpDoc = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", "hideQuestion"]));
|
|
1013
1019
|
var readOnlyHelpDoc = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", "readOnly"]));
|
|
1014
1020
|
var responseVisibleOnlyToHostHelpDoc = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", "responseVisibleOnlyToHost"]));
|
|
@@ -1039,6 +1045,11 @@ var Form$1 = function Form(_ref) {
|
|
|
1039
1045
|
}) : {},
|
|
1040
1046
|
_ref2$questionProps = _ref2.questionProps,
|
|
1041
1047
|
questionProps = _ref2$questionProps === void 0 ? {} : _ref2$questionProps;
|
|
1048
|
+
React.useEffect(function () {
|
|
1049
|
+
if (submitCount > 0 && neetoCist.isPresent(errors === null || errors === void 0 ? void 0 : errors.fieldCode)) {
|
|
1050
|
+
setIsFieldCodeInvalid(true);
|
|
1051
|
+
}
|
|
1052
|
+
}, [submitCount]);
|
|
1042
1053
|
var isRequired = questionKind && isRequiredField(questionKind);
|
|
1043
1054
|
var isLabelDisabled = questionKind && isDisabledFieldLabel(questionKind);
|
|
1044
1055
|
var isImmutable = questionKind && constants$1.isImmutableField(questionKind);
|
|
@@ -1121,6 +1132,8 @@ var Form$1 = function Form(_ref) {
|
|
|
1121
1132
|
labelProps: responseVisibleOnlyToHostSwitchLabelProps(responseVisibleOnlyToHostHelpDoc)
|
|
1122
1133
|
})]
|
|
1123
1134
|
}), (shouldShowFieldCode || shouldShowReadOnlySwitch) && /*#__PURE__*/jsxRuntime.jsx(Accordion, {
|
|
1135
|
+
defaultActiveKey: isFieldCodeInvalid ? 0 : null // This is to open the accordion when field code is invalid
|
|
1136
|
+
,
|
|
1124
1137
|
className: "neeto-form-nano-advanced-properties-accordion",
|
|
1125
1138
|
"data-cy": "advanced-properties-card",
|
|
1126
1139
|
children: /*#__PURE__*/jsxRuntime.jsx(Accordion.Item, {
|
|
@@ -2181,7 +2194,7 @@ var Form = function Form(_ref) {
|
|
|
2181
2194
|
var _useTranslation = reactI18next.useTranslation(),
|
|
2182
2195
|
t = _useTranslation.t;
|
|
2183
2196
|
var formikContext = formik.useFormikContext();
|
|
2184
|
-
var _useState = React.useState(
|
|
2197
|
+
var _useState = React.useState({}),
|
|
2185
2198
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2186
2199
|
selectedQuestion = _useState2[0],
|
|
2187
2200
|
setSelectedQuestion = _useState2[1];
|
|
@@ -2281,7 +2294,7 @@ var Form = function Form(_ref) {
|
|
|
2281
2294
|
}
|
|
2282
2295
|
};
|
|
2283
2296
|
reactUtils.useOnClickOutside(containerRef, function () {
|
|
2284
|
-
return handleSelect(
|
|
2297
|
+
return handleSelect({});
|
|
2285
2298
|
}, {
|
|
2286
2299
|
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
|
|
2287
2300
|
});
|