@bigbinary/neeto-form-frontend 4.4.48 → 4.4.50
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/ar.json +6 -3
- package/app/javascript/src/translations/bg.json +6 -3
- package/app/javascript/src/translations/ca.json +6 -3
- package/app/javascript/src/translations/cs.json +6 -3
- package/app/javascript/src/translations/da.json +6 -3
- package/app/javascript/src/translations/de.json +6 -3
- package/app/javascript/src/translations/en.json +3 -0
- package/app/javascript/src/translations/es-MX.json +6 -3
- package/app/javascript/src/translations/es.json +6 -3
- package/app/javascript/src/translations/et.json +6 -3
- package/app/javascript/src/translations/fi.json +6 -3
- package/app/javascript/src/translations/fil.json +6 -3
- package/app/javascript/src/translations/fr.json +6 -3
- package/app/javascript/src/translations/he.json +6 -3
- package/app/javascript/src/translations/hi.json +6 -3
- package/app/javascript/src/translations/hr.json +6 -3
- package/app/javascript/src/translations/hu.json +6 -3
- package/app/javascript/src/translations/id.json +6 -3
- package/app/javascript/src/translations/it.json +6 -3
- package/app/javascript/src/translations/ja.json +6 -3
- package/app/javascript/src/translations/ko.json +6 -3
- package/app/javascript/src/translations/lv.json +6 -3
- package/app/javascript/src/translations/nl.json +6 -3
- package/app/javascript/src/translations/pl.json +6 -3
- package/app/javascript/src/translations/pt-BR.json +6 -3
- package/app/javascript/src/translations/pt.json +6 -3
- package/app/javascript/src/translations/ro.json +6 -3
- package/app/javascript/src/translations/ru.json +6 -3
- package/app/javascript/src/translations/sk.json +6 -3
- package/app/javascript/src/translations/sl.json +6 -3
- package/app/javascript/src/translations/sv.json +6 -3
- package/app/javascript/src/translations/th.json +6 -3
- package/app/javascript/src/translations/tr.json +6 -3
- package/app/javascript/src/translations/uk.json +6 -3
- package/app/javascript/src/translations/vi.json +6 -3
- package/app/javascript/src/translations/zh-CN.json +6 -3
- package/app/javascript/src/translations/zh-TW.json +6 -3
- package/dist/.ready +1 -1
- package/dist/BuildForm.js +41 -19
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +2 -2
- package/dist/UrlBuilder.js +2 -2
- package/dist/cjs/BuildForm.js +40 -18
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +2 -2
- package/dist/cjs/UrlBuilder.js +2 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{utils-CvWFiOOa.js → utils-fwFV6wY2.js} +20 -4
- package/dist/cjs/utils-fwFV6wY2.js.map +1 -0
- package/dist/cjs/v2/BuildForm.js +71 -23
- package/dist/cjs/v2/BuildForm.js.map +1 -1
- package/dist/cjs/v2/ExternalForm.js +2 -2
- package/dist/cjs/v2/UrlBuilder.js +2 -2
- package/dist/cjs/v2/index.js +2 -2
- package/dist/cjs/v2/{utils-B6gAGQwC.js → utils-ByVT_m97.js} +20 -4
- package/dist/cjs/v2/utils-ByVT_m97.js.map +1 -0
- package/dist/cjs/v2/{yup-Rnk6JNb8.js → yup-B8wj6wiJ.js} +22 -9
- package/dist/cjs/v2/yup-B8wj6wiJ.js.map +1 -0
- package/dist/cjs/{yup-DvB9BGdG.js → yup-BxKE7dIP.js} +22 -9
- package/dist/cjs/yup-BxKE7dIP.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{utils-Dk_rwO1y.js → utils-B1PS7L37.js} +20 -4
- package/dist/utils-B1PS7L37.js.map +1 -0
- package/dist/v2/BuildForm.js +73 -25
- package/dist/v2/BuildForm.js.map +1 -1
- package/dist/v2/ExternalForm.js +2 -2
- package/dist/v2/UrlBuilder.js +2 -2
- package/dist/v2/index.js +2 -2
- package/dist/v2/{utils-CJ9PZpF1.js → utils-B7UPP2PR.js} +20 -4
- package/dist/v2/utils-B7UPP2PR.js.map +1 -0
- package/dist/v2/{yup-DItlKUzb.js → yup-Dxe5WpM2.js} +21 -10
- package/dist/v2/yup-Dxe5WpM2.js.map +1 -0
- package/dist/{yup-7qmI_2fI.js → yup-CWzW88_S.js} +21 -10
- package/dist/yup-CWzW88_S.js.map +1 -0
- package/package.json +3 -3
- package/dist/cjs/utils-CvWFiOOa.js.map +0 -1
- package/dist/cjs/v2/utils-B6gAGQwC.js.map +0 -1
- package/dist/cjs/v2/yup-Rnk6JNb8.js.map +0 -1
- package/dist/cjs/yup-DvB9BGdG.js.map +0 -1
- package/dist/utils-Dk_rwO1y.js.map +0 -1
- package/dist/v2/utils-CJ9PZpF1.js.map +0 -1
- package/dist/v2/yup-DItlKUzb.js.map +0 -1
- package/dist/yup-7qmI_2fI.js.map +0 -1
package/dist/v2/BuildForm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Alert, Dialog, Typography, Tooltip, DropdownMenu, Button, Empty, Switch as Switch$1, Sheet, Select, Accordion, Label, MultiEmailInput, Checkbox, Slider, Spinner } from '@bigbinary/neeto-atoms';
|
|
2
2
|
import { useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import { isPresent, truncate, findBy, slugify, existsBy, isNotPresent, findById, findIndexById, hyphenate, nullSafe, modifyBy,
|
|
5
|
-
import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, prop, pipe, filter, isNotNil, values, uniq, join, pathSatisfies, assocPath, dissoc, isNil, append, pluck, paths, difference, startsWith, split, last, either, F, T } from 'ramda';
|
|
4
|
+
import { isPresent, truncate, findBy, slugify, existsBy, removeBy, isNotPresent, findById, findIndexById, hyphenate, nullSafe, modifyBy, noop } from '@bigbinary/neeto-cist';
|
|
5
|
+
import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, prop, pipe, filter, isNotNil, values, uniq, join, pathSatisfies, assocPath, dissoc, isNil, append, pluck, paths, difference, startsWith, split, last, union, either, F, T } from 'ramda';
|
|
6
6
|
import { j as useDeleteQuestion, b as useForm, k as useCreateQuestion, l as useUpdateQuestion, m as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-B5a0zkAT.js';
|
|
7
|
-
import {
|
|
7
|
+
import { r as QUESTION_ACTIONS, s as INDEPENDENT_LABELS_MAP, t as buildDisplayLabel, c as isFunction, u as SELECTABLE_KINDS, v as isAutoGeneratedQuestion, g as fieldWithFallback, w as isRichTextQuestion, x as SPOT_QUESTION_FIELD_CODE, y as isNameQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, z as RESERVED_FIELD_CODES, B as renameKey, j as LABEL_FIELDS, F as isDefaultLanguage, G as buildAddQuestionButtonProps, H as validateEditorContent, J as FIELD_CODES_REJECT_CHARS_REGEX, M as MIN_WORDS_SWITCH_LABEL_PROPS, K as MIN_WORDS, O as isImmutableField, a as QUESTIONS_WITHOUT_FIELD_CODE, T as NON_HIDEABLE_FIELDS, U as NON_READ_ONLY_FIELDS, V as OPINION_LABEL_MAX_LENGTH, W as RICH_TEXT_QUESTIONS, h as ADDRESS_FIELD_WIDTHS, A as ADDRESS_FIELD_TYPES, X as generateDefaultOptions, Z as MINIMUM_ADDRESS_FIELDS, _ as getDeletedRecords, $ as randomId, a0 as getActiveRecords, a1 as FILE_TYPES_MAP, a2 as FILE_GROUPS, a3 as OPINION_SCALE_MIN_VALUE_OPTIONS, a4 as OPINION_SCALE_MAX_VALUE_OPTIONS, l as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, a5 as MINIMUM_OPTIONS, a6 as IMAGE_HEIGHT_SLIDER_DEFAULTS, a7 as RATING_OPTIONS, a8 as STAR_RATING_MIN_VALUE_OPTIONS, a9 as STAR_RATING_MAX_VALUE_OPTIONS, aa as STAR_RATING_ICONS_MAP, ab as YES_NO_ICONS_MAP, ac as buildDisabledAddButtonHelpPopoverProps, ad as buildReorderPayload, ae as QUESTIONS_INITIAL_VALUE, af as isMandatoryField, ag as QUESTION_KINDS, Q as QUESTION_KIND, ah as getActiveQuestionKindDetails, ai as DEFAULT_AVAILABLE_LANGUAGES, aj as DEFAULT_ADVANCED_FEATURES } from './yup-Dxe5WpM2.js';
|
|
8
8
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
9
9
|
import { createElement, useRef, useEffect, useState } from 'react';
|
|
10
10
|
import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
|
|
@@ -1035,6 +1035,7 @@ var Textarea = function Textarea() {
|
|
|
1035
1035
|
function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1036
1036
|
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1037
1037
|
var Form$1 = function Form(_ref) {
|
|
1038
|
+
var _findBy;
|
|
1038
1039
|
var questions = _ref.questions,
|
|
1039
1040
|
initialFocusRef = _ref.initialFocusRef,
|
|
1040
1041
|
isRequiredField = _ref.isRequiredField,
|
|
@@ -1049,6 +1050,10 @@ var Form$1 = function Form(_ref) {
|
|
|
1049
1050
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1050
1051
|
isFieldCodeInvalid = _useState2[0],
|
|
1051
1052
|
setIsFieldCodeInvalid = _useState2[1];
|
|
1053
|
+
var _useState3 = useState(""),
|
|
1054
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1055
|
+
selectedKindValue = _useState4[0],
|
|
1056
|
+
setSelectedKindValue = _useState4[1];
|
|
1052
1057
|
var _useTranslation = useTranslation(),
|
|
1053
1058
|
t = _useTranslation.t;
|
|
1054
1059
|
var _useFormikContext = useFormikContext(),
|
|
@@ -1085,13 +1090,18 @@ var Form$1 = function Form(_ref) {
|
|
|
1085
1090
|
isSmsUpdatesEnabledByDefault = advancedFeatures.smsUpdatesEnabledByDefault;
|
|
1086
1091
|
var kind = values.kind;
|
|
1087
1092
|
var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
|
|
1088
|
-
var kindOptions = buildKindOptions(
|
|
1093
|
+
var kindOptions = buildKindOptions(isUsingDefaultQuestionKinds && !isEdit ? removeBy({
|
|
1094
|
+
type: QUESTION_TYPES.DECIMAL
|
|
1095
|
+
}, questionKinds) : questionKinds);
|
|
1089
1096
|
var questionKindUniquenessPattern = mergeLeft(isEdit && kindUniqueOn ? kindUniqueOn(values) : {}, {
|
|
1090
1097
|
type: kind
|
|
1091
1098
|
});
|
|
1092
|
-
var
|
|
1093
|
-
|
|
1094
|
-
|
|
1099
|
+
var questionKind = getQuestionKind(questionKinds, isEdit ? questionKindUniquenessPattern : {
|
|
1100
|
+
type: kind,
|
|
1101
|
+
label: (_findBy = findBy({
|
|
1102
|
+
value: selectedKindValue
|
|
1103
|
+
}, kindOptions)) === null || _findBy === void 0 ? void 0 : _findBy.label
|
|
1104
|
+
});
|
|
1095
1105
|
var _ref2 = questionKind ? getActiveKindDetails({
|
|
1096
1106
|
allQuestionKinds: allQuestionKinds,
|
|
1097
1107
|
item: questionKind
|
|
@@ -1110,26 +1120,29 @@ var Form$1 = function Form(_ref) {
|
|
|
1110
1120
|
var shouldShowHideSwitch = isFieldCodeEnabled && !usesCustomSubmissionComponent && !includes(kind, NON_HIDEABLE_FIELDS);
|
|
1111
1121
|
var canRestrictResponseVisibilityToHost = restrictResponseVisibilityToHost && !includes(kind, NON_HIDEABLE_FIELDS);
|
|
1112
1122
|
var canMarkResponsesAsReadOnly = markResponsesAsReadOnly && !includes(kind, NON_READ_ONLY_FIELDS);
|
|
1123
|
+
var isNumber = includes(kind, [QUESTION_TYPES.INTEGER, QUESTION_TYPES.DECIMAL]);
|
|
1124
|
+
var canConfigureDecimals = isUsingDefaultQuestionKinds && isNumber;
|
|
1113
1125
|
var isTextarea = kind === QUESTION_TYPES.TEXTAREA;
|
|
1114
1126
|
var shouldShowSendSmsUpdatesSwitch = kind === QUESTION_TYPES.PHONE && showSmsUpdatesToggle;
|
|
1115
1127
|
var isBasicSettingsVisible = !isRequired && (!isImmutable || shouldShowHideSwitch);
|
|
1116
1128
|
var shouldShowRequiredSwitch = isBasicSettingsVisible && !isImmutable && !includes(kind, [QUESTION_TYPES.PARAGRAPH, QUESTION_TYPES.ADDRESS, QUESTION_TYPES.SPOT]);
|
|
1117
|
-
var isSettingsBlockVisible = kind !== QUESTION_TYPES.SPOT && (isBasicSettingsVisible || canMarkResponsesAsReadOnly || isTextarea || shouldShowSendSmsUpdatesSwitch);
|
|
1129
|
+
var isSettingsBlockVisible = kind !== QUESTION_TYPES.SPOT && (isBasicSettingsVisible || canMarkResponsesAsReadOnly || isTextarea || canConfigureDecimals || shouldShowSendSmsUpdatesSwitch);
|
|
1118
1130
|
var handleKindChange = function handleKindChange(value) {
|
|
1119
1131
|
var data = buildQuestionData(value);
|
|
1132
|
+
setSelectedKindValue(value);
|
|
1120
1133
|
updateFormState(data);
|
|
1121
1134
|
};
|
|
1122
1135
|
|
|
1123
1136
|
// atoms Select reports the option's value, not the option object, and
|
|
1124
1137
|
// clears to "" rather than null.
|
|
1125
1138
|
var buildQuestionData = function buildQuestionData(value) {
|
|
1126
|
-
var
|
|
1139
|
+
var _findBy2;
|
|
1127
1140
|
if (isNotPresent(value)) {
|
|
1128
1141
|
return INITIAL_VALUES;
|
|
1129
1142
|
}
|
|
1130
|
-
var _ref3 = (
|
|
1143
|
+
var _ref3 = (_findBy2 = findBy({
|
|
1131
1144
|
value: value
|
|
1132
|
-
}, kindOptions)) !== null &&
|
|
1145
|
+
}, kindOptions)) !== null && _findBy2 !== void 0 ? _findBy2 : {},
|
|
1133
1146
|
label = _ref3.label;
|
|
1134
1147
|
var kind = extractKindFromOption(value);
|
|
1135
1148
|
var questionKind = getQuestionKind(availableQuestionKinds, {
|
|
@@ -1170,16 +1183,21 @@ var Form$1 = function Form(_ref) {
|
|
|
1170
1183
|
children: [/*#__PURE__*/jsx(Select, {
|
|
1171
1184
|
isClearable: true,
|
|
1172
1185
|
isSearchable: true,
|
|
1186
|
+
defaultOptions: kindOptions,
|
|
1173
1187
|
formatOptionLabel: function formatOptionLabel(option) {
|
|
1174
1188
|
return /*#__PURE__*/jsx(KindOption, _objectSpread$b({}, option));
|
|
1175
1189
|
},
|
|
1176
1190
|
formatTriggerLabel: prop("label"),
|
|
1177
1191
|
isDisabled: isEdit,
|
|
1178
|
-
options: kindOptions,
|
|
1179
1192
|
ref: initialFocusRef,
|
|
1180
1193
|
size: "large",
|
|
1181
1194
|
value: buildDefaultValueForKind(questionKind),
|
|
1182
1195
|
label: t("neetoForm.questions.common.questionFields.field.questionType"),
|
|
1196
|
+
loadOptions: function loadOptions(query) {
|
|
1197
|
+
return Promise.resolve(kindOptions.filter(function (option) {
|
|
1198
|
+
return filterKindOption(option, query);
|
|
1199
|
+
}));
|
|
1200
|
+
},
|
|
1183
1201
|
onChange: handleKindChange
|
|
1184
1202
|
}), isRichTextQuestion(kind) ? /*#__PURE__*/jsxs(Fragment, {
|
|
1185
1203
|
children: [/*#__PURE__*/jsx(Editor, {
|
|
@@ -1218,6 +1236,9 @@ var Form$1 = function Form(_ref) {
|
|
|
1218
1236
|
name: "sendSmsUpdates",
|
|
1219
1237
|
size: "default",
|
|
1220
1238
|
labelProps: sendSmsUpdatesSwitchLabelProps(sendSmsUpdatesHelpDocUrl)
|
|
1239
|
+
}), canConfigureDecimals && /*#__PURE__*/jsx(Switch, {
|
|
1240
|
+
label: t("neetoForm.questions.common.allowDecimals"),
|
|
1241
|
+
name: "allowDecimals"
|
|
1221
1242
|
}), isTextarea && enforceMinWordsInMultiLineTexts && /*#__PURE__*/jsx(Textarea, {})]
|
|
1222
1243
|
}), shouldShowFieldCode && /*#__PURE__*/jsx(Accordion, {
|
|
1223
1244
|
className: "neeto-form-nano-advanced-properties-accordion",
|
|
@@ -1331,16 +1352,18 @@ var Add = function Add(_ref) {
|
|
|
1331
1352
|
isOpen = _ref.isOpen,
|
|
1332
1353
|
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1333
1354
|
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
1334
|
-
var _store$formState, _store$formState2, _store$formState3;
|
|
1355
|
+
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
1335
1356
|
return {
|
|
1336
1357
|
formId: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["formId"],
|
|
1337
1358
|
selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"],
|
|
1338
|
-
onMutateSuccess: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["onMutateSuccess"]
|
|
1359
|
+
onMutateSuccess: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["onMutateSuccess"],
|
|
1360
|
+
isUsingDefaultQuestionKinds: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["isUsingDefaultQuestionKinds"]
|
|
1339
1361
|
};
|
|
1340
1362
|
}, shallow),
|
|
1341
1363
|
formId = _useBuildFormStore.formId,
|
|
1342
1364
|
language = _useBuildFormStore.selectedLanguage,
|
|
1343
|
-
onMutateSuccess = _useBuildFormStore.onMutateSuccess
|
|
1365
|
+
onMutateSuccess = _useBuildFormStore.onMutateSuccess,
|
|
1366
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
1344
1367
|
var isFieldCodeEnabled = useBuildFormStore(path(["advancedFeatures", "fieldCode"]));
|
|
1345
1368
|
var _useTranslation = useTranslation(),
|
|
1346
1369
|
t = _useTranslation.t;
|
|
@@ -1363,7 +1386,9 @@ var Add = function Add(_ref) {
|
|
|
1363
1386
|
language: language,
|
|
1364
1387
|
neetoFormQuestion: mergeLeft({
|
|
1365
1388
|
displayOrder: displayOrder
|
|
1366
|
-
}, transformValues(values
|
|
1389
|
+
}, transformValues(values, {
|
|
1390
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
1391
|
+
}))
|
|
1367
1392
|
}, {
|
|
1368
1393
|
onSuccess: function onSuccess(_ref2) {
|
|
1369
1394
|
var questions = _ref2.questions;
|
|
@@ -1411,14 +1436,16 @@ var Edit = function Edit(_ref) {
|
|
|
1411
1436
|
var _useTranslation = useTranslation(),
|
|
1412
1437
|
t = _useTranslation.t;
|
|
1413
1438
|
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
1414
|
-
var _store$formState, _store$formState2;
|
|
1439
|
+
var _store$formState, _store$formState2, _store$formState3;
|
|
1415
1440
|
return {
|
|
1416
1441
|
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
1417
|
-
onMutateSuccess: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["onMutateSuccess"]
|
|
1442
|
+
onMutateSuccess: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["onMutateSuccess"],
|
|
1443
|
+
isUsingDefaultQuestionKinds: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["isUsingDefaultQuestionKinds"]
|
|
1418
1444
|
};
|
|
1419
1445
|
}, shallow),
|
|
1420
1446
|
language = _useBuildFormStore.selectedLanguage,
|
|
1421
|
-
onMutateSuccess = _useBuildFormStore.onMutateSuccess
|
|
1447
|
+
onMutateSuccess = _useBuildFormStore.onMutateSuccess,
|
|
1448
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
1422
1449
|
var isFieldCodeEnabled = useBuildFormStore(path(["advancedFeatures", "fieldCode"]));
|
|
1423
1450
|
var _useUpdateQuestion = useUpdateQuestion(question === null || question === void 0 ? void 0 : question.formId, language),
|
|
1424
1451
|
updateQuestion = _useUpdateQuestion.mutate,
|
|
@@ -1428,7 +1455,9 @@ var Edit = function Edit(_ref) {
|
|
|
1428
1455
|
if (isUpdating || !isOpen) return;
|
|
1429
1456
|
var payload = {
|
|
1430
1457
|
language: language,
|
|
1431
|
-
neetoFormQuestion: transformValues(values
|
|
1458
|
+
neetoFormQuestion: transformValues(values, {
|
|
1459
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
1460
|
+
})
|
|
1432
1461
|
};
|
|
1433
1462
|
updateQuestion({
|
|
1434
1463
|
questionId: question.id,
|
|
@@ -1454,6 +1483,7 @@ var Edit = function Edit(_ref) {
|
|
|
1454
1483
|
// question is selected; without this those empty values stick.
|
|
1455
1484
|
enableReinitialize: true,
|
|
1456
1485
|
initialValues: _objectSpread$9(_objectSpread$9({}, question), {}, {
|
|
1486
|
+
allowDecimals: question.kind === QUESTION_TYPES.DECIMAL,
|
|
1457
1487
|
isMinWordsEnabled: isPresent(question.minWords)
|
|
1458
1488
|
}),
|
|
1459
1489
|
validationSchema: formValidationSchema(question, isFieldCodeEnabled),
|
|
@@ -2551,10 +2581,18 @@ var buildKindOptions = function buildKindOptions(kinds) {
|
|
|
2551
2581
|
}),
|
|
2552
2582
|
icon: icon,
|
|
2553
2583
|
description: description,
|
|
2554
|
-
searchTerms: searchTerms
|
|
2584
|
+
searchTerms: union([label, description !== null && description !== void 0 ? description : ""], searchTerms !== null && searchTerms !== void 0 ? searchTerms : [])
|
|
2555
2585
|
};
|
|
2556
2586
|
});
|
|
2557
2587
|
};
|
|
2588
|
+
var filterKindOption = function filterKindOption(_ref4, rawInput) {
|
|
2589
|
+
var searchTerms = _ref4.searchTerms;
|
|
2590
|
+
var query = rawInput === null || rawInput === void 0 ? void 0 : rawInput.trim().toLowerCase();
|
|
2591
|
+
if (!query) return true;
|
|
2592
|
+
return searchTerms.some(function (term) {
|
|
2593
|
+
return term.toLowerCase().includes(query);
|
|
2594
|
+
});
|
|
2595
|
+
};
|
|
2558
2596
|
var extractKindFromOption = pipe(split("-"), last);
|
|
2559
2597
|
|
|
2560
2598
|
// atoms Select takes a scalar value, not a `{ value }` object.
|
|
@@ -2619,11 +2657,20 @@ var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
|
|
|
2619
2657
|
}
|
|
2620
2658
|
};
|
|
2621
2659
|
};
|
|
2622
|
-
var transformValues = function transformValues(
|
|
2623
|
-
var
|
|
2624
|
-
|
|
2625
|
-
|
|
2660
|
+
var transformValues = function transformValues(_ref5) {
|
|
2661
|
+
var _values$allowDecimals;
|
|
2662
|
+
var minWords = _ref5.minWords,
|
|
2663
|
+
values = _objectWithoutProperties(_ref5, _excluded$1);
|
|
2664
|
+
var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
2665
|
+
isUsingDefaultQuestionKinds = _ref6.isUsingDefaultQuestionKinds;
|
|
2666
|
+
var rest = omit(["isMinWordsEnabled", "allowDecimals"], values);
|
|
2626
2667
|
switch (rest.kind) {
|
|
2668
|
+
case QUESTION_TYPES.INTEGER:
|
|
2669
|
+
case QUESTION_TYPES.DECIMAL:
|
|
2670
|
+
if (!isUsingDefaultQuestionKinds) return rest;
|
|
2671
|
+
return _objectSpread$2(_objectSpread$2({}, rest), {}, {
|
|
2672
|
+
kind: ((_values$allowDecimals = values.allowDecimals) !== null && _values$allowDecimals !== void 0 ? _values$allowDecimals : rest.kind === QUESTION_TYPES.DECIMAL) ? QUESTION_TYPES.DECIMAL : QUESTION_TYPES.INTEGER
|
|
2673
|
+
});
|
|
2627
2674
|
case QUESTION_TYPES.TEXTAREA:
|
|
2628
2675
|
return _objectSpread$2(_objectSpread$2({}, rest), {}, {
|
|
2629
2676
|
minWords: minWords !== null && minWords !== void 0 ? minWords : ""
|
|
@@ -2845,6 +2892,7 @@ var Form = function Form(_ref) {
|
|
|
2845
2892
|
});
|
|
2846
2893
|
};
|
|
2847
2894
|
var handleDelete = function handleDelete(question) {
|
|
2895
|
+
setSelectedQuestion(question);
|
|
2848
2896
|
if (question.kind === QUESTION_TYPES.SMS_REMINDER) {
|
|
2849
2897
|
setIsDeleteSmsReminderModalOpen(true);
|
|
2850
2898
|
} else if (question.kind === QUESTION_TYPES.SPOT) {
|