@bigbinary/neeto-form-frontend 4.1.10 → 4.2.0
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/app/javascript/src/translations/en.json +5 -1
- package/dist/BuildForm.js +69 -26
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +3 -2
- package/dist/ExternalForm.js.map +1 -1
- package/dist/UrlBuilder.js +3 -2
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/{buildForm-BwhLCvEE.js → buildForm-CooylMLL.js} +3 -2
- package/dist/buildForm-CooylMLL.js.map +1 -0
- package/dist/{buildForm-CsVQHcC7.js → buildForm-DcE5kFvR.js} +3 -2
- package/dist/buildForm-DcE5kFvR.js.map +1 -0
- package/dist/cjs/BuildForm.js +69 -26
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +3 -2
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +3 -2
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/{constants-BSbkmQ4t.js → constants-BjWWA3Oq.js} +10 -1
- package/dist/constants-BjWWA3Oq.js.map +1 -0
- package/dist/{constants-Da_Y-J4N.js → constants-QPLZ_r-D.js} +9 -2
- package/dist/constants-QPLZ_r-D.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/{utils-BdTASoGp.js → utils-BwFLBXs2.js} +88 -13
- package/dist/utils-BwFLBXs2.js.map +1 -0
- package/dist/{utils-BUXD94aD.js → utils-GRfGBny0.js} +88 -13
- package/dist/utils-GRfGBny0.js.map +1 -0
- package/package.json +17 -17
- package/dist/buildForm-BwhLCvEE.js.map +0 -1
- package/dist/buildForm-CsVQHcC7.js.map +0 -1
- package/dist/constants-BSbkmQ4t.js.map +0 -1
- package/dist/constants-Da_Y-J4N.js.map +0 -1
- package/dist/utils-BUXD94aD.js.map +0 -1
- package/dist/utils-BdTASoGp.js.map +0 -1
|
@@ -140,7 +140,11 @@
|
|
|
140
140
|
"hideQuestionHelpDescription": "When enabled, this question will not be visible in the created form. It can be used to track \"reference ids\" and UTM parameters.",
|
|
141
141
|
"responseVisibleOnlyToHostHelpDescription": "When enabled, the response to this question will only be visible to the host",
|
|
142
142
|
"readOnlyHelpDescription": "When enabled, the client will only be able to see the answer of this question, but will not be able to change the answer of this question. Since you are marking this question as \"read-only\" you should pre-fill the question with an answer.",
|
|
143
|
-
"verifyHuman": "Verify that you are a human"
|
|
143
|
+
"verifyHuman": "Verify that you are a human",
|
|
144
|
+
"pictureChoiceSettings": "Picture choice settings",
|
|
145
|
+
"addPicturesToOptions": "Add pictures to options",
|
|
146
|
+
"fitImages": "Fit images",
|
|
147
|
+
"imageHeight": "Image height"
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
},
|
package/dist/BuildForm.js
CHANGED
|
@@ -4,13 +4,13 @@ import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, hyphenate
|
|
|
4
4
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
5
5
|
import { equals, path, curry, assoc, prop, dissoc, when, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, paths, difference, split, last, either, T, F } from 'ramda';
|
|
6
6
|
import { k as useDeleteQuestion, Q as QUESTION_TYPES, a as useForm, l as useCreateQuestion, m as useUpdateQuestion, C as CAPTCHA_TYPES, n as useReorderQuestions, i as QUERY_KEYS } from './constants-51SEJjzI.js';
|
|
7
|
-
import { f as buildDisplayLabel, h as INDEPENDENT_LABELS_MAP, i as QUESTION_ACTIONS, j as isElementOverflowing,
|
|
7
|
+
import { f as buildDisplayLabel, h as INDEPENDENT_LABELS_MAP, i as QUESTION_ACTIONS, j as isElementOverflowing, k as Drag, l as SELECTABLE_KINDS, m as isAutoGeneratedQuestion, n as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, o as RESERVED_FIELD_CODES, d as LABEL_FIELDS, p as isDefaultLanguage, q as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, r as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, s as NON_HIDEABLE_FIELDS, t as NON_READ_ONLY_FIELDS, u as RICH_TEXT_QUESTIONS, w as FILE_TYPES_MAP, x as FILE_GROUPS, D as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, M as MINIMUM_OPTIONS, y as IMAGE_HEIGHT_SLIDER_DEFAULTS, z as RATING_OPTIONS, A as STAR_RATING_MIN_VALUE_OPTIONS, B as STAR_RATING_MAX_VALUE_OPTIONS, G as STAR_RATING_ICONS_MAP, H as buildDisabledAddButtonHelpPopoverProps, J as buildReorderPayload, K as isMandatoryField, O as QUESTION_KINDS, a as QUESTION_KIND, T as getActiveQuestionKindDetails, U as DEFAULT_AVAILABLE_LANGUAGES, V as DEFAULT_ADVANCED_FEATURES, W as QUESTIONS_INITIAL_VALUE } from './constants-QPLZ_r-D.js';
|
|
8
8
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
9
9
|
import { useState, useRef, useEffect, createElement } from 'react';
|
|
10
10
|
import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
|
|
11
11
|
import { withT, isMetaKeyPressed, useStateWithDependency, useFuncDebounce, useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
12
12
|
import { showThumbsUpToastr, withEventTargetValue, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
13
|
-
import { a as useBuildFormStore } from './buildForm-
|
|
13
|
+
import { a as useBuildFormStore } from './buildForm-DcE5kFvR.js';
|
|
14
14
|
import { shallow } from 'zustand/shallow';
|
|
15
15
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
16
16
|
import { useTranslation, Trans } from 'react-i18next';
|
|
@@ -53,6 +53,7 @@ import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
|
53
53
|
import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
|
|
54
54
|
import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
55
55
|
import OptionFields from '@bigbinary/neeto-molecules/OptionFields';
|
|
56
|
+
import Slider from '@bigbinary/neetoui/Slider';
|
|
56
57
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
57
58
|
import 'axios';
|
|
58
59
|
import 'dompurify';
|
|
@@ -1874,12 +1875,17 @@ var Options = function Options(_ref) {
|
|
|
1874
1875
|
var _useTranslation = useTranslation(),
|
|
1875
1876
|
t = _useTranslation.t;
|
|
1876
1877
|
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
1877
|
-
var _store$formState;
|
|
1878
|
+
var _store$formState, _store$formState2;
|
|
1878
1879
|
return {
|
|
1879
|
-
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
|
|
1880
|
+
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
1881
|
+
isPictureChoiceEnabled: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["isPictureChoiceEnabled"]
|
|
1880
1882
|
};
|
|
1881
1883
|
}, shallow),
|
|
1882
|
-
selectedLanguage = _useBuildFormStore.selectedLanguage
|
|
1884
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
1885
|
+
isPictureChoiceEnabled = _useBuildFormStore.isPictureChoiceEnabled;
|
|
1886
|
+
var _useFormikContext = useFormikContext(),
|
|
1887
|
+
values = _useFormikContext.values,
|
|
1888
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
1883
1889
|
var name = "optionsAttributes";
|
|
1884
1890
|
var _useField = useField(name),
|
|
1885
1891
|
_useField2 = _slicedToArray(_useField, 3);
|
|
@@ -1898,24 +1904,56 @@ var Options = function Options(_ref) {
|
|
|
1898
1904
|
var isManageOptionDisabled = isFunction(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
1899
1905
|
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
1900
1906
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1907
|
+
var isDropdown = values.kind === QUESTION_TYPES.DROPDOWN;
|
|
1908
|
+
var isPictureChoice = isPictureChoiceEnabled && !isDropdown && (values.isPictureChoice || DEFAULT_CHOICE_QUESTION_ATTRIBUTES.isPictureChoice);
|
|
1909
|
+
var imageHeight = values.imageHeight || DEFAULT_CHOICE_QUESTION_ATTRIBUTES.imageHeight;
|
|
1910
|
+
var handleImageHeightChange = function handleImageHeightChange(value) {
|
|
1911
|
+
setFieldValue("imageHeight", value);
|
|
1912
|
+
};
|
|
1901
1913
|
return /*#__PURE__*/jsxs("div", {
|
|
1902
|
-
className: "w-full",
|
|
1903
|
-
children: [/*#__PURE__*/
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1914
|
+
className: "w-full space-y-4",
|
|
1915
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1916
|
+
children: [/*#__PURE__*/jsx(Label, _objectSpread$2(_objectSpread$2({
|
|
1917
|
+
className: "mb-2 block"
|
|
1918
|
+
}, optionLabelProps), {}, {
|
|
1919
|
+
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
1920
|
+
})), /*#__PURE__*/jsx(OptionFields, {
|
|
1921
|
+
isPictureChoice: isPictureChoice,
|
|
1922
|
+
name: name,
|
|
1923
|
+
shouldDestroy: true,
|
|
1924
|
+
destroyFlagName: "_destroy",
|
|
1925
|
+
disabled: isManageOptionDisabled,
|
|
1926
|
+
draggable: !isManageOptionDisabled,
|
|
1927
|
+
isAddOptionEnabled: !isAddOptionDisabled,
|
|
1928
|
+
isDeleteOptionEnabled: !isRemoveOptionDisabled,
|
|
1929
|
+
isNewItemsPrefilled: isDefaultLanguage(selectedLanguage),
|
|
1930
|
+
minOptions: MINIMUM_OPTIONS,
|
|
1931
|
+
shouldResetEmptyOptionOnBlur: false,
|
|
1932
|
+
onChange: setOptionsAttributes
|
|
1933
|
+
})]
|
|
1934
|
+
}), !isDropdown && isPictureChoiceEnabled && /*#__PURE__*/jsxs(Block, {
|
|
1935
|
+
title: t("neetoForm.questions.common.questionFields.field.pictureChoiceSettings"),
|
|
1936
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
1937
|
+
name: "isPictureChoice",
|
|
1938
|
+
label: t("neetoForm.questions.common.questionFields.field.addPicturesToOptions")
|
|
1939
|
+
}), isPictureChoice && /*#__PURE__*/jsxs(Fragment, {
|
|
1940
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
1941
|
+
name: "shouldFitImages",
|
|
1942
|
+
label: t("neetoForm.questions.common.questionFields.field.fitImages")
|
|
1943
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1944
|
+
className: "mt-4",
|
|
1945
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1946
|
+
style: "body2",
|
|
1947
|
+
weight: "medium",
|
|
1948
|
+
children: t("neetoForm.questions.common.questionFields.field.imageHeight")
|
|
1949
|
+
}), /*#__PURE__*/jsx(Slider, {
|
|
1950
|
+
max: IMAGE_HEIGHT_SLIDER_DEFAULTS.max,
|
|
1951
|
+
min: IMAGE_HEIGHT_SLIDER_DEFAULTS.min,
|
|
1952
|
+
value: imageHeight,
|
|
1953
|
+
onChange: handleImageHeightChange
|
|
1954
|
+
})]
|
|
1955
|
+
})]
|
|
1956
|
+
})]
|
|
1919
1957
|
})]
|
|
1920
1958
|
});
|
|
1921
1959
|
};
|
|
@@ -2188,7 +2226,8 @@ var Form = function Form(_ref) {
|
|
|
2188
2226
|
usesCustomSubmissionComponent = _ref.usesCustomSubmissionComponent,
|
|
2189
2227
|
questionsFromCache = _ref.questionsFromCache,
|
|
2190
2228
|
onMutateSuccess = _ref.onMutateSuccess,
|
|
2191
|
-
advancedFeatures = _ref.advancedFeatures
|
|
2229
|
+
advancedFeatures = _ref.advancedFeatures,
|
|
2230
|
+
isPictureChoiceEnabled = _ref.isPictureChoiceEnabled;
|
|
2192
2231
|
var containerRef = useRef();
|
|
2193
2232
|
var _useStateWithDependen = useStateWithDependency(questionsFromCache),
|
|
2194
2233
|
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
@@ -2262,9 +2301,10 @@ var Form = function Form(_ref) {
|
|
|
2262
2301
|
hostSpecificData: hostSpecificData,
|
|
2263
2302
|
onMutateSuccess: onMutateSuccess,
|
|
2264
2303
|
advancedFeatures: advancedFeatures,
|
|
2265
|
-
onLanguageChange: onLanguageChange
|
|
2304
|
+
onLanguageChange: onLanguageChange,
|
|
2305
|
+
isPictureChoiceEnabled: isPictureChoiceEnabled
|
|
2266
2306
|
});
|
|
2267
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, selectedLanguage, helpDocUrls, isUsingDefaultQuestionKinds, usesCustomSubmissionComponent, hostSpecificData, onMutateSuccess, advancedFeatures, onLanguageChange]);
|
|
2307
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, selectedLanguage, helpDocUrls, isUsingDefaultQuestionKinds, usesCustomSubmissionComponent, hostSpecificData, onMutateSuccess, advancedFeatures, onLanguageChange, isPictureChoiceEnabled]);
|
|
2268
2308
|
var handleSelect = function handleSelect(question) {
|
|
2269
2309
|
setSelectedQuestion(question);
|
|
2270
2310
|
};
|
|
@@ -2447,7 +2487,9 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2447
2487
|
onMutateSuccess = _ref$onMutateSuccess === void 0 ? noop : _ref$onMutateSuccess,
|
|
2448
2488
|
hostSpecificData = _ref.hostSpecificData,
|
|
2449
2489
|
_ref$canManageQuestio = _ref.canManageQuestions,
|
|
2450
|
-
canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio
|
|
2490
|
+
canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio,
|
|
2491
|
+
_ref$isPictureChoiceE = _ref.isPictureChoiceEnabled,
|
|
2492
|
+
isPictureChoiceEnabled = _ref$isPictureChoiceE === void 0 ? false : _ref$isPictureChoiceE;
|
|
2451
2493
|
var queryClient = useQueryClient();
|
|
2452
2494
|
var _useForm = useForm({
|
|
2453
2495
|
formId: id,
|
|
@@ -2499,6 +2541,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2499
2541
|
isDisabledFieldLabel: isDisabledFieldLabel,
|
|
2500
2542
|
isFormEnabled: isFormEnabled,
|
|
2501
2543
|
isKindAlreadyActive: isKindAlreadyActive,
|
|
2544
|
+
isPictureChoiceEnabled: isPictureChoiceEnabled,
|
|
2502
2545
|
isRequiredField: isRequiredField,
|
|
2503
2546
|
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2504
2547
|
kindUniqueOn: kindUniqueOn,
|