@bigbinary/neeto-form-frontend 4.4.48 → 4.4.49
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 +3 -0
- 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/ExternalForm.js
CHANGED
|
@@ -25,8 +25,8 @@ import { a as isBlank, g as getComponentDisplayName, p as parseServerError } fro
|
|
|
25
25
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
26
26
|
import Check from '@bigbinary/neeto-icons/Check';
|
|
27
27
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
28
|
-
import { C as CALLOUT_POSITIONS, b as CALLOUT_STYLES, L as LAST_ELEMENTS_THRESHOLD, Q as QUESTION_KIND } from './yup-
|
|
29
|
-
import { c as clientI18nInstance, d as getWithExpiry, e as clearEmailVerificationDetails, F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, a as generateInitValues, f as generateFormResponse, h as clearLocalStorageValues } from './utils-
|
|
28
|
+
import { C as CALLOUT_POSITIONS, b as CALLOUT_STYLES, L as LAST_ELEMENTS_THRESHOLD, Q as QUESTION_KIND } from './yup-CWzW88_S.js';
|
|
29
|
+
import { c as clientI18nInstance, d as getWithExpiry, e as clearEmailVerificationDetails, F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, a as generateInitValues, f as generateFormResponse, h as clearLocalStorageValues } from './utils-B1PS7L37.js';
|
|
30
30
|
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
31
31
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
32
32
|
import '@bigbinary/neeto-commons-frontend/constants';
|
package/dist/UrlBuilder.js
CHANGED
|
@@ -10,10 +10,10 @@ import Button from '@bigbinary/neetoui/Button';
|
|
|
10
10
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
11
11
|
import { mergeLeft, map, filter, pluck, isEmpty } from 'ramda';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
|
-
import { F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs, a as generateInitValues } from './utils-
|
|
13
|
+
import { F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs, a as generateInitValues } from './utils-B1PS7L37.js';
|
|
14
14
|
import { d as usePublicForm } from './constants-ClqQe4qZ.js';
|
|
15
15
|
import { parsePhoneNumber } from 'libphonenumber-js';
|
|
16
|
-
import { Q as QUESTION_KIND, a as QUESTIONS_WITHOUT_FIELD_CODE } from './yup-
|
|
16
|
+
import { Q as QUESTION_KIND, a as QUESTIONS_WITHOUT_FIELD_CODE } from './yup-CWzW88_S.js';
|
|
17
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
18
18
|
import './index-CAR9-spo.js';
|
|
19
19
|
import '@babel/runtime/helpers/typeof';
|
package/dist/cjs/BuildForm.js
CHANGED
|
@@ -6,7 +6,7 @@ var neetoCist = require('@bigbinary/neeto-cist');
|
|
|
6
6
|
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
7
7
|
var ramda = require('ramda');
|
|
8
8
|
var constants = require('./constants-D3en9KhN.js');
|
|
9
|
-
var yup = require('./yup-
|
|
9
|
+
var yup = require('./yup-BxKE7dIP.js');
|
|
10
10
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
11
11
|
var React = require('react');
|
|
12
12
|
var dnd = require('@hello-pangea/dnd');
|
|
@@ -1254,11 +1254,13 @@ var Form$1 = function Form(_ref) {
|
|
|
1254
1254
|
var shouldShowHideSwitch = isFieldCodeEnabled && !usesCustomSubmissionComponent && !ramda.includes(kind, yup.NON_HIDEABLE_FIELDS);
|
|
1255
1255
|
var canRestrictResponseVisibilityToHost = restrictResponseVisibilityToHost && !ramda.includes(kind, yup.NON_HIDEABLE_FIELDS);
|
|
1256
1256
|
var canMarkResponsesAsReadOnly = markResponsesAsReadOnly && !ramda.includes(kind, yup.NON_READ_ONLY_FIELDS);
|
|
1257
|
+
var isNumber = ramda.includes(kind, [constants.QUESTION_TYPES.INTEGER, constants.QUESTION_TYPES.DECIMAL]);
|
|
1258
|
+
var canConfigureDecimals = isUsingDefaultQuestionKinds && isNumber;
|
|
1257
1259
|
var isTextarea = kind === constants.QUESTION_TYPES.TEXTAREA;
|
|
1258
1260
|
var shouldShowSendSmsUpdatesSwitch = kind === constants.QUESTION_TYPES.PHONE && showSmsUpdatesToggle;
|
|
1259
1261
|
var isBasicSettingsVisible = !isRequired && (!isImmutable || shouldShowHideSwitch);
|
|
1260
1262
|
var shouldShowRequiredSwitch = isBasicSettingsVisible && !isImmutable && !ramda.includes(kind, [constants.QUESTION_TYPES.PARAGRAPH, constants.QUESTION_TYPES.ADDRESS, constants.QUESTION_TYPES.SPOT]);
|
|
1261
|
-
var isSettingsBlockVisible = kind !== constants.QUESTION_TYPES.SPOT && (isBasicSettingsVisible || canMarkResponsesAsReadOnly || isTextarea || shouldShowSendSmsUpdatesSwitch);
|
|
1263
|
+
var isSettingsBlockVisible = kind !== constants.QUESTION_TYPES.SPOT && (isBasicSettingsVisible || canMarkResponsesAsReadOnly || isTextarea || canConfigureDecimals || shouldShowSendSmsUpdatesSwitch);
|
|
1262
1264
|
var handleKindChange = function handleKindChange(option) {
|
|
1263
1265
|
var data = buildQuestionData(option);
|
|
1264
1266
|
updateFormState(data);
|
|
@@ -1313,12 +1315,15 @@ var Form$1 = function Form(_ref) {
|
|
|
1313
1315
|
innerRef: initialFocusRef,
|
|
1314
1316
|
isDisabled: isEdit,
|
|
1315
1317
|
name: "kind",
|
|
1316
|
-
options: buildKindOptions(questionKinds),
|
|
1317
1318
|
formatOptionLabel: function formatOptionLabel(option, _ref3) {
|
|
1318
1319
|
var context = _ref3.context;
|
|
1319
1320
|
return context === "menu" ? /*#__PURE__*/jsxRuntime.jsx(KindOption, _objectSpread$d({}, option)) : option.label;
|
|
1320
1321
|
},
|
|
1321
1322
|
label: t("neetoForm.questions.common.questionFields.field.questionType"),
|
|
1323
|
+
options: buildKindOptions(isUsingDefaultQuestionKinds && !isEdit ? questionKinds.filter(function (_ref4) {
|
|
1324
|
+
var type = _ref4.type;
|
|
1325
|
+
return type !== constants.QUESTION_TYPES.DECIMAL;
|
|
1326
|
+
}) : questionKinds),
|
|
1322
1327
|
onChange: handleKindChange
|
|
1323
1328
|
}), yup.isRichTextQuestion(kind) ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1324
1329
|
children: [/*#__PURE__*/jsxRuntime.jsx(Editor, {
|
|
@@ -1353,6 +1358,9 @@ var Form$1 = function Form(_ref) {
|
|
|
1353
1358
|
label: t("neetoForm.common.sendSmsUpdates"),
|
|
1354
1359
|
name: "sendSmsUpdates",
|
|
1355
1360
|
labelProps: sendSmsUpdatesSwitchLabelProps(sendSmsUpdatesHelpDocUrl)
|
|
1361
|
+
}), canConfigureDecimals && /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1362
|
+
label: t("neetoForm.questions.common.allowDecimals"),
|
|
1363
|
+
name: "allowDecimals"
|
|
1356
1364
|
}), isTextarea && enforceMinWordsInMultiLineTexts && /*#__PURE__*/jsxRuntime.jsx(Textarea, {})]
|
|
1357
1365
|
}), shouldShowFieldCode && /*#__PURE__*/jsxRuntime.jsx(Accordion, {
|
|
1358
1366
|
className: "neeto-form-nano-advanced-properties-accordion",
|
|
@@ -1467,16 +1475,18 @@ var Add = function Add(_ref) {
|
|
|
1467
1475
|
isOpen = _ref.isOpen,
|
|
1468
1476
|
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
1469
1477
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
1470
|
-
var _store$formState, _store$formState2, _store$formState3;
|
|
1478
|
+
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
1471
1479
|
return {
|
|
1472
1480
|
formId: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["formId"],
|
|
1473
1481
|
selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"],
|
|
1474
|
-
onMutateSuccess: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["onMutateSuccess"]
|
|
1482
|
+
onMutateSuccess: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["onMutateSuccess"],
|
|
1483
|
+
isUsingDefaultQuestionKinds: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["isUsingDefaultQuestionKinds"]
|
|
1475
1484
|
};
|
|
1476
1485
|
}, shallow.shallow),
|
|
1477
1486
|
formId = _useBuildFormStore.formId,
|
|
1478
1487
|
language = _useBuildFormStore.selectedLanguage,
|
|
1479
|
-
onMutateSuccess = _useBuildFormStore.onMutateSuccess
|
|
1488
|
+
onMutateSuccess = _useBuildFormStore.onMutateSuccess,
|
|
1489
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
1480
1490
|
var isFieldCodeEnabled = buildForm.useBuildFormStore(ramda.path(["advancedFeatures", "fieldCode"]));
|
|
1481
1491
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1482
1492
|
t = _useTranslation.t;
|
|
@@ -1500,7 +1510,8 @@ var Add = function Add(_ref) {
|
|
|
1500
1510
|
neetoFormQuestion: ramda.mergeLeft({
|
|
1501
1511
|
displayOrder: displayOrder
|
|
1502
1512
|
}, transformValues(values, {
|
|
1503
|
-
includeDefaultKeys: true
|
|
1513
|
+
includeDefaultKeys: true,
|
|
1514
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
1504
1515
|
}))
|
|
1505
1516
|
}, {
|
|
1506
1517
|
onSuccess: function onSuccess(_ref2) {
|
|
@@ -1557,14 +1568,16 @@ var Edit = function Edit(_ref) {
|
|
|
1557
1568
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1558
1569
|
t = _useTranslation.t;
|
|
1559
1570
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
1560
|
-
var _store$formState, _store$formState2;
|
|
1571
|
+
var _store$formState, _store$formState2, _store$formState3;
|
|
1561
1572
|
return {
|
|
1562
1573
|
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
1563
|
-
onMutateSuccess: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["onMutateSuccess"]
|
|
1574
|
+
onMutateSuccess: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["onMutateSuccess"],
|
|
1575
|
+
isUsingDefaultQuestionKinds: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["isUsingDefaultQuestionKinds"]
|
|
1564
1576
|
};
|
|
1565
1577
|
}, shallow.shallow),
|
|
1566
1578
|
language = _useBuildFormStore.selectedLanguage,
|
|
1567
|
-
onMutateSuccess = _useBuildFormStore.onMutateSuccess
|
|
1579
|
+
onMutateSuccess = _useBuildFormStore.onMutateSuccess,
|
|
1580
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
1568
1581
|
var isFieldCodeEnabled = buildForm.useBuildFormStore(ramda.path(["advancedFeatures", "fieldCode"]));
|
|
1569
1582
|
var _useUpdateQuestion = constants.useUpdateQuestion(question === null || question === void 0 ? void 0 : question.formId, language),
|
|
1570
1583
|
updateQuestion = _useUpdateQuestion.mutate,
|
|
@@ -1574,7 +1587,9 @@ var Edit = function Edit(_ref) {
|
|
|
1574
1587
|
if (isUpdating || !isOpen) return;
|
|
1575
1588
|
var payload = {
|
|
1576
1589
|
language: language,
|
|
1577
|
-
neetoFormQuestion: transformValues(values
|
|
1590
|
+
neetoFormQuestion: transformValues(values, {
|
|
1591
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
1592
|
+
})
|
|
1578
1593
|
};
|
|
1579
1594
|
updateQuestion({
|
|
1580
1595
|
questionId: question.id,
|
|
@@ -1603,6 +1618,7 @@ var Edit = function Edit(_ref) {
|
|
|
1603
1618
|
}), /*#__PURE__*/jsxRuntime.jsx(Form$2, {
|
|
1604
1619
|
formikProps: {
|
|
1605
1620
|
initialValues: _objectSpread$b(_objectSpread$b({}, question), {}, {
|
|
1621
|
+
allowDecimals: question.kind === constants.QUESTION_TYPES.DECIMAL,
|
|
1606
1622
|
isMinWordsEnabled: neetoCist.isPresent(question.minWords)
|
|
1607
1623
|
}),
|
|
1608
1624
|
validationSchema: formValidationSchema(question, isFieldCodeEnabled),
|
|
@@ -2898,17 +2914,15 @@ var buildKindOptions = function buildKindOptions(kinds) {
|
|
|
2898
2914
|
}),
|
|
2899
2915
|
icon: icon,
|
|
2900
2916
|
description: description,
|
|
2901
|
-
searchTerms: searchTerms
|
|
2917
|
+
searchTerms: ramda.union([label, description !== null && description !== void 0 ? description : ""], searchTerms !== null && searchTerms !== void 0 ? searchTerms : [])
|
|
2902
2918
|
};
|
|
2903
2919
|
});
|
|
2904
2920
|
};
|
|
2905
2921
|
var filterKindOption = function filterKindOption(option, rawInput) {
|
|
2906
|
-
var _option$data$searchTe, _option$data;
|
|
2907
2922
|
var query = rawInput === null || rawInput === void 0 ? void 0 : rawInput.trim().toLowerCase();
|
|
2908
2923
|
if (!query) return true;
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
return term.includes(query);
|
|
2924
|
+
return option.data.searchTerms.some(function (term) {
|
|
2925
|
+
return term.toLowerCase().includes(query);
|
|
2912
2926
|
});
|
|
2913
2927
|
};
|
|
2914
2928
|
var extractKindFromOption = ramda.pipe(ramda.split("-"), ramda.last);
|
|
@@ -2976,13 +2990,21 @@ var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
|
|
|
2976
2990
|
};
|
|
2977
2991
|
};
|
|
2978
2992
|
var transformValues = function transformValues(_ref4) {
|
|
2993
|
+
var _values$allowDecimals;
|
|
2979
2994
|
var minWords = _ref4.minWords,
|
|
2980
2995
|
values = _objectWithoutProperties(_ref4, _excluded$1);
|
|
2981
2996
|
var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
2982
2997
|
_ref5$includeDefaultK = _ref5.includeDefaultKeys,
|
|
2983
|
-
includeDefaultKeys = _ref5$includeDefaultK === void 0 ? false : _ref5$includeDefaultK
|
|
2984
|
-
|
|
2998
|
+
includeDefaultKeys = _ref5$includeDefaultK === void 0 ? false : _ref5$includeDefaultK,
|
|
2999
|
+
isUsingDefaultQuestionKinds = _ref5.isUsingDefaultQuestionKinds;
|
|
3000
|
+
var rest = ramda.omit(["isMinWordsEnabled", "allowDecimals"], values);
|
|
2985
3001
|
switch (rest.kind) {
|
|
3002
|
+
case constants.QUESTION_TYPES.INTEGER:
|
|
3003
|
+
case constants.QUESTION_TYPES.DECIMAL:
|
|
3004
|
+
if (!isUsingDefaultQuestionKinds) return rest;
|
|
3005
|
+
return _objectSpread$2(_objectSpread$2({}, rest), {}, {
|
|
3006
|
+
kind: ((_values$allowDecimals = values.allowDecimals) !== null && _values$allowDecimals !== void 0 ? _values$allowDecimals : rest.kind === constants.QUESTION_TYPES.DECIMAL) ? constants.QUESTION_TYPES.DECIMAL : constants.QUESTION_TYPES.INTEGER
|
|
3007
|
+
});
|
|
2986
3008
|
case constants.QUESTION_TYPES.TEXTAREA:
|
|
2987
3009
|
return _objectSpread$2(_objectSpread$2({}, rest), {}, {
|
|
2988
3010
|
minWords: minWords !== null && minWords !== void 0 ? minWords : ""
|