@bigbinary/neeto-form-frontend 3.3.1 → 3.3.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.
- package/README.md +11 -11
- package/dist/index.cjs.js +18 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2983,6 +2983,13 @@ var Options = function Options(_ref) {
|
|
|
2983
2983
|
var questionProps = _ref.questionProps;
|
|
2984
2984
|
var _useTranslation = useTranslation(),
|
|
2985
2985
|
t = _useTranslation.t;
|
|
2986
|
+
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
2987
|
+
var _store$formState;
|
|
2988
|
+
return {
|
|
2989
|
+
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
|
|
2990
|
+
};
|
|
2991
|
+
}, shallow),
|
|
2992
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage;
|
|
2986
2993
|
var _useField = useField("optionsAttributes"),
|
|
2987
2994
|
_useField2 = _slicedToArray(_useField, 3),
|
|
2988
2995
|
optionsAttributes = _useField2[0].value;
|
|
@@ -2992,11 +2999,18 @@ var Options = function Options(_ref) {
|
|
|
2992
2999
|
_ref2$optionLabelProp = _ref2.optionLabelProps,
|
|
2993
3000
|
optionLabelProps = _ref2$optionLabelProp === void 0 ? {} : _ref2$optionLabelProp,
|
|
2994
3001
|
_ref2$freezeOptions = _ref2.freezeOptions,
|
|
2995
|
-
freezeOptions = _ref2$freezeOptions === void 0 ? false : _ref2$freezeOptions
|
|
3002
|
+
freezeOptions = _ref2$freezeOptions === void 0 ? false : _ref2$freezeOptions,
|
|
3003
|
+
_ref2$disableAddOptio = _ref2.disableAddOption,
|
|
3004
|
+
disableAddOption = _ref2$disableAddOptio === void 0 ? false : _ref2$disableAddOptio,
|
|
3005
|
+
_ref2$disableRemoveOp = _ref2.disableRemoveOption,
|
|
3006
|
+
disableRemoveOption = _ref2$disableRemoveOp === void 0 ? false : _ref2$disableRemoveOp;
|
|
2996
3007
|
var handleRemoveOption = function handleRemoveOption(index) {
|
|
2997
3008
|
var nextOptions = formHelpers.destroyFromList(optionsAttributes, index);
|
|
2998
3009
|
setOptionsAttributes(nextOptions);
|
|
2999
3010
|
};
|
|
3011
|
+
var isManageOptionDisabled = isFunction$1(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
3012
|
+
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
3013
|
+
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
3000
3014
|
return /*#__PURE__*/jsx("div", {
|
|
3001
3015
|
className: "w-full",
|
|
3002
3016
|
children: /*#__PURE__*/jsx(FieldArray, {
|
|
@@ -3017,12 +3031,12 @@ var Options = function Options(_ref) {
|
|
|
3017
3031
|
"data-cy": "neeto-form-engine-option-".concat(index),
|
|
3018
3032
|
children: [/*#__PURE__*/jsx(InputWithMaxLength, {
|
|
3019
3033
|
required: true,
|
|
3020
|
-
disabled:
|
|
3034
|
+
disabled: isManageOptionDisabled,
|
|
3021
3035
|
name: "optionsAttributes.".concat(index, ".label"),
|
|
3022
3036
|
placeholder: t("neetoForm.questions.common.questionFields.field.numberedOption", {
|
|
3023
3037
|
number: index + 1
|
|
3024
3038
|
})
|
|
3025
|
-
}), !
|
|
3039
|
+
}), !isRemoveOptionDisabled && /*#__PURE__*/jsx(Button$1, {
|
|
3026
3040
|
"data-cy": "neeto-form-engine-delete-option-button",
|
|
3027
3041
|
icon: Delete,
|
|
3028
3042
|
size: "small",
|
|
@@ -3040,7 +3054,7 @@ var Options = function Options(_ref) {
|
|
|
3040
3054
|
})]
|
|
3041
3055
|
}, "question-option-".concat((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : index));
|
|
3042
3056
|
})
|
|
3043
|
-
}), !
|
|
3057
|
+
}), !isAddOptionDisabled && /*#__PURE__*/jsx("div", {
|
|
3044
3058
|
className: "mt-3 w-full",
|
|
3045
3059
|
children: /*#__PURE__*/jsx(Button$1, {
|
|
3046
3060
|
"data-cy": "neeto-form-engine-add-option-button",
|