@bigbinary/neeto-form-frontend 3.10.9 → 3.10.12
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 +2 -0
- package/dist/BuildForm.js +62 -33
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +2 -2
- package/dist/UrlBuilder.js +7 -4
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/{buildForm-Zw1xpuBS.js → buildForm-D5-1L1Je.js} +3 -2
- package/dist/buildForm-D5-1L1Je.js.map +1 -0
- package/dist/{buildForm-12iKiorQ.js → buildForm-ZqO8kJoo.js} +3 -2
- package/dist/buildForm-ZqO8kJoo.js.map +1 -0
- package/dist/cjs/BuildForm.js +62 -33
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +2 -2
- package/dist/cjs/UrlBuilder.js +6 -3
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +5 -5
- package/dist/{constants-BL-0uUwk.js → constants-DwXbiMSR.js} +6 -3
- package/dist/constants-DwXbiMSR.js.map +1 -0
- package/dist/{constants-BUAlqO79.js → constants-awsxzvM-.js} +6 -2
- package/dist/constants-awsxzvM-.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/index.js +5 -5
- package/dist/{utils-Bo2ljfJm.js → utils-BfdHlZ_G.js} +52 -13
- package/dist/utils-BfdHlZ_G.js.map +1 -0
- package/dist/{utils-D6IWgDHF.js → utils-BrgDSuZe.js} +52 -13
- package/dist/utils-BrgDSuZe.js.map +1 -0
- package/package.json +12 -12
- package/types.d.ts +1 -0
- package/dist/buildForm-12iKiorQ.js.map +0 -1
- package/dist/buildForm-Zw1xpuBS.js.map +0 -1
- package/dist/constants-BL-0uUwk.js.map +0 -1
- package/dist/constants-BUAlqO79.js.map +0 -1
- package/dist/utils-Bo2ljfJm.js.map +0 -1
- package/dist/utils-D6IWgDHF.js.map +0 -1
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"selectOne": "Select one",
|
|
27
27
|
"required": "Required",
|
|
28
28
|
"hideQuestion": "Hide question",
|
|
29
|
+
"readOnly": "Mark question as read-only",
|
|
29
30
|
"invalidURL": "Invalid URL",
|
|
30
31
|
"generateLink": "Generate link",
|
|
31
32
|
"paragraphCantBeEmpty": "Paragraph can't be empty",
|
|
@@ -131,6 +132,7 @@
|
|
|
131
132
|
"fieldCodeHelpDescription": "If you change the field code, any existing shared links containing the old field code as query parameter, will not work correctly. <Link>View help article</Link> for more information.",
|
|
132
133
|
"questionType": "Question type",
|
|
133
134
|
"hideQuestionHelpDescription": "When enabled, this question will not be visible in the created form. It can be used for tracking UTM parameters.",
|
|
135
|
+
"readOnlyHelpDescription": "When enabled, the response for this question will not be editable. It can be used for pre-filled forms.",
|
|
134
136
|
"verifyHuman": "Verify that you are a human"
|
|
135
137
|
}
|
|
136
138
|
}
|
package/dist/BuildForm.js
CHANGED
|
@@ -9,7 +9,7 @@ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
|
9
9
|
import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, modify, without, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, difference, prop, split, last, __, concat, F } from 'ramda';
|
|
10
10
|
import { h as useDeleteQuestion, i as useFetchQuestions, j as useCreateQuestion, k as useUpdateQuestion, l as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-DtoxIPE7.js';
|
|
11
11
|
import { Q as QUESTION_KIND } from './constants-DlRX5mcQ.js';
|
|
12
|
-
import { I as INDEPENDENT_LABELS_MAP, i as isRichTextQuestion, h as htmlToPlainText, a as isElementOverflowing, D as Drag, S as SELECTABLE_KINDS, b as isAutoGeneratedQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, R as RESERVED_FIELD_CODES, c as isDefaultLanguage, d as buildDisabledAddButtonTooltipProps, e as buildAddQuestionButtonProps, f as QUESTION_TYPES, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, j as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, k as NON_HIDEABLE_FIELDS, l as RICH_TEXT_QUESTIONS, C as CAPTCHA_TYPES,
|
|
12
|
+
import { I as INDEPENDENT_LABELS_MAP, i as isRichTextQuestion, h as htmlToPlainText, a as isElementOverflowing, D as Drag, S as SELECTABLE_KINDS, b as isAutoGeneratedQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, R as RESERVED_FIELD_CODES, c as isDefaultLanguage, d as buildDisabledAddButtonTooltipProps, e as buildAddQuestionButtonProps, f as QUESTION_TYPES, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, j as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, k as NON_HIDEABLE_FIELDS, l as NON_READ_ONLY_FIELDS, m as RICH_TEXT_QUESTIONS, C as CAPTCHA_TYPES, n as FILE_TYPES_MAP, o as FILE_GROUPS, M as MINIMUM_OPTIONS, p as RATING_OPTIONS, q as STAR_RATING_MIN_VALUE_OPTIONS, r as STAR_RATING_MAX_VALUE_OPTIONS, s as STAR_RATING_ICONS_MAP, t as QUESTION_ACTIONS, u as QUESTION_KINDS, w as getActiveQuestionKindDetails, x as DEFAULT_AVAILABLE_LANGUAGES, y as QUESTIONS_INITIAL_VALUE, z as buildReorderPayload, A as MANDATORY_KINDS } from './constants-DwXbiMSR.js';
|
|
13
13
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
14
14
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
15
15
|
import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
|
|
@@ -17,7 +17,7 @@ import { isMetaKeyPressed, withT, useStateWithDependency, useOnClickOutside } fr
|
|
|
17
17
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
18
18
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
19
19
|
import { useTranslation, Trans } from 'react-i18next';
|
|
20
|
-
import { a as useBuildFormStore } from './buildForm-
|
|
20
|
+
import { a as useBuildFormStore } from './buildForm-D5-1L1Je.js';
|
|
21
21
|
import { shallow } from 'zustand/shallow';
|
|
22
22
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
23
23
|
import { f as fieldWithFallback, i as isFunction } from './index-BL5SirYx.js';
|
|
@@ -33,12 +33,12 @@ import { v4 } from 'uuid';
|
|
|
33
33
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
34
34
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
35
35
|
import Form$2 from '@bigbinary/neetoui/formik/Form';
|
|
36
|
+
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
37
|
+
import Accordion from '@bigbinary/neetoui/Accordion';
|
|
36
38
|
import Select from '@bigbinary/neetoui/formik/Select';
|
|
37
39
|
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
38
|
-
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
39
40
|
import NeetoEditor from '@bigbinary/neeto-editor/Editor';
|
|
40
41
|
import Button from '@bigbinary/neetoui/Button';
|
|
41
|
-
import Accordion from '@bigbinary/neetoui/Accordion';
|
|
42
42
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
43
43
|
import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
|
|
44
44
|
import * as yup from 'yup';
|
|
@@ -819,28 +819,21 @@ var FieldCode = function FieldCode() {
|
|
|
819
819
|
var helpDocUrl = useBuildFormStore(path(["formState", "helpDocUrls", "fieldCode"]));
|
|
820
820
|
var _useTranslation = useTranslation(),
|
|
821
821
|
t = _useTranslation.t;
|
|
822
|
-
return /*#__PURE__*/jsx(
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
Link: /*#__PURE__*/jsx(Button, {
|
|
836
|
-
className: "text-xs",
|
|
837
|
-
href: helpDocUrl,
|
|
838
|
-
style: "link",
|
|
839
|
-
target: "_blank"
|
|
840
|
-
})
|
|
841
|
-
}
|
|
822
|
+
return /*#__PURE__*/jsx(InputWithMaxLength, {
|
|
823
|
+
required: true,
|
|
824
|
+
label: t("neetoForm.questions.common.questionFields.field.fieldCode"),
|
|
825
|
+
name: "fieldCode",
|
|
826
|
+
rejectCharsRegex: FIELD_CODES_REJECT_CHARS_REGEX,
|
|
827
|
+
helpText: helpDocUrl && /*#__PURE__*/jsx(Trans, {
|
|
828
|
+
i18nKey: "neetoForm.questions.common.questionFields.field.fieldCodeHelpDescription",
|
|
829
|
+
components: {
|
|
830
|
+
Link: /*#__PURE__*/jsx(Button, {
|
|
831
|
+
className: "text-xs",
|
|
832
|
+
href: helpDocUrl,
|
|
833
|
+
style: "link",
|
|
834
|
+
target: "_blank"
|
|
842
835
|
})
|
|
843
|
-
}
|
|
836
|
+
}
|
|
844
837
|
})
|
|
845
838
|
});
|
|
846
839
|
};
|
|
@@ -866,17 +859,20 @@ var Form$1 = function Form(_ref) {
|
|
|
866
859
|
setTouched = _useFormikContext.setTouched,
|
|
867
860
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
868
861
|
var hideQuestionHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "hideQuestion"]));
|
|
862
|
+
var readOnlyHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "readOnly"]));
|
|
869
863
|
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
870
|
-
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
864
|
+
var _store$formState, _store$formState2, _store$formState3, _store$formState4, _store$formState5;
|
|
871
865
|
return {
|
|
872
866
|
enableDomainWhitelisting: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["enableDomainWhitelisting"],
|
|
873
867
|
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"],
|
|
874
|
-
|
|
875
|
-
|
|
868
|
+
showReadOnlySwitch: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["showReadOnlySwitch"],
|
|
869
|
+
selectedLanguage: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["selectedLanguage"],
|
|
870
|
+
isUsingDefaultQuestionKinds: (_store$formState5 = store["formState"]) === null || _store$formState5 === void 0 ? void 0 : _store$formState5["isUsingDefaultQuestionKinds"]
|
|
876
871
|
};
|
|
877
872
|
}, shallow),
|
|
878
873
|
enableDomainWhitelisting = _useBuildFormStore.enableDomainWhitelisting,
|
|
879
874
|
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting,
|
|
875
|
+
showReadOnlySwitch = _useBuildFormStore.showReadOnlySwitch,
|
|
880
876
|
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
881
877
|
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
882
878
|
var kind = values.kind;
|
|
@@ -900,6 +896,7 @@ var Form$1 = function Form(_ref) {
|
|
|
900
896
|
var hasAdditionalData = includes(kind, QUESTIONS_WITH_ADDITIONAL_DATA);
|
|
901
897
|
var shouldShowFieldCode = enableFieldCode && !includes(kind, QUESTIONS_WITHOUT_FIELD_CODE);
|
|
902
898
|
var shouldShowHideSwitch = !includes(kind, NON_HIDEABLE_FIELDS);
|
|
899
|
+
var shouldShowReadOnlySwitch = showReadOnlySwitch && !includes(kind, NON_READ_ONLY_FIELDS);
|
|
903
900
|
var isSettingsBlockVisible = !isRequired && (!isImmutable || shouldShowHideSwitch);
|
|
904
901
|
var handleKindChange = function handleKindChange(option) {
|
|
905
902
|
var data = buildQuestionData(option);
|
|
@@ -981,8 +978,22 @@ var Form$1 = function Form(_ref) {
|
|
|
981
978
|
label: t("neetoForm.common.hideQuestion"),
|
|
982
979
|
labelProps: hideSwitchLabelProps(hideQuestionHelpDoc),
|
|
983
980
|
name: "isHidden"
|
|
981
|
+
}), shouldShowReadOnlySwitch && /*#__PURE__*/jsx(Switch, {
|
|
982
|
+
label: t("neetoForm.common.readOnly"),
|
|
983
|
+
labelProps: readOnlySwitchLabelProps(readOnlyHelpDoc),
|
|
984
|
+
name: "isReadOnly"
|
|
984
985
|
})]
|
|
985
|
-
}), shouldShowFieldCode && /*#__PURE__*/jsx(
|
|
986
|
+
}), (shouldShowFieldCode || shouldShowReadOnlySwitch) && /*#__PURE__*/jsx(Accordion, {
|
|
987
|
+
className: "neeto-form-nano-advanced-properties-accordion",
|
|
988
|
+
"data-cy": "advanced-properties-card",
|
|
989
|
+
children: /*#__PURE__*/jsx(Accordion.Item, {
|
|
990
|
+
title: t("neetoForm.common.advancedProperties"),
|
|
991
|
+
children: /*#__PURE__*/jsx("div", {
|
|
992
|
+
className: "flex flex-col space-y-4",
|
|
993
|
+
children: shouldShowFieldCode && /*#__PURE__*/jsx(FieldCode, {})
|
|
994
|
+
})
|
|
995
|
+
})
|
|
996
|
+
})]
|
|
986
997
|
})]
|
|
987
998
|
})
|
|
988
999
|
});
|
|
@@ -1904,6 +1915,19 @@ var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
|
|
|
1904
1915
|
}
|
|
1905
1916
|
} : undefined;
|
|
1906
1917
|
};
|
|
1918
|
+
var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
|
|
1919
|
+
return {
|
|
1920
|
+
helpIconProps: {
|
|
1921
|
+
popoverProps: {
|
|
1922
|
+
description: t("neetoForm.questions.common.questionFields.field.readOnlyHelpDescription"),
|
|
1923
|
+
helpLinkProps: helpUrl ? {
|
|
1924
|
+
href: helpUrl,
|
|
1925
|
+
label: t("neetoForm.common.viewHelpArticle")
|
|
1926
|
+
} : undefined
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
};
|
|
1907
1931
|
|
|
1908
1932
|
var _excluded$1 = ["isOpen", "onClose", "action", "question", "availableQuestionKinds"];
|
|
1909
1933
|
function ownKeys$3(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; }
|
|
@@ -1945,7 +1969,7 @@ var AddQuestion = function AddQuestion(_ref) {
|
|
|
1945
1969
|
}));
|
|
1946
1970
|
};
|
|
1947
1971
|
|
|
1948
|
-
var _excluded = ["questionKinds", "onValueChange", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "isDisabledFieldLabel", "disabledAddButtonTooltipProps", "enableFieldCode", "isFormEnabled", "savedTitle", "formTitle", "formDescription", "selectedLanguage", "availableLanguages", "onLanguageChange", "additionalActionOptions", "isReordering", "additionalQuestionKindPattern", "showActionBlock", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls", "hostSpecificData", "questionsHelpProps", "isUsingDefaultQuestionKinds"];
|
|
1972
|
+
var _excluded = ["questionKinds", "onValueChange", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "isDisabledFieldLabel", "disabledAddButtonTooltipProps", "enableFieldCode", "isFormEnabled", "savedTitle", "formTitle", "formDescription", "selectedLanguage", "availableLanguages", "onLanguageChange", "additionalActionOptions", "isReordering", "additionalQuestionKindPattern", "showActionBlock", "showReadOnlySwitch", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls", "hostSpecificData", "questionsHelpProps", "isUsingDefaultQuestionKinds"];
|
|
1949
1973
|
function ownKeys$1(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; }
|
|
1950
1974
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1951
1975
|
var Form = function Form(_ref) {
|
|
@@ -1972,6 +1996,7 @@ var Form = function Form(_ref) {
|
|
|
1972
1996
|
isReordering = _ref.isReordering,
|
|
1973
1997
|
additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
|
|
1974
1998
|
showActionBlock = _ref.showActionBlock,
|
|
1999
|
+
showReadOnlySwitch = _ref.showReadOnlySwitch,
|
|
1975
2000
|
buildRequestArgs = _ref.buildRequestArgs,
|
|
1976
2001
|
enableDomainBlacklisting = _ref.enableDomainBlacklisting,
|
|
1977
2002
|
enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
@@ -2033,9 +2058,10 @@ var Form = function Form(_ref) {
|
|
|
2033
2058
|
helpDocUrls: helpDocUrls,
|
|
2034
2059
|
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2035
2060
|
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
2036
|
-
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
2061
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2062
|
+
showReadOnlySwitch: showReadOnlySwitch
|
|
2037
2063
|
});
|
|
2038
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds]);
|
|
2064
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds, showReadOnlySwitch]);
|
|
2039
2065
|
var questions = values.questions;
|
|
2040
2066
|
var handleSelect = function handleSelect(question) {
|
|
2041
2067
|
setSelectedQuestion(question);
|
|
@@ -2261,7 +2287,9 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2261
2287
|
_ref$questionsHelpPro = _ref.questionsHelpProps,
|
|
2262
2288
|
questionsHelpProps = _ref$questionsHelpPro === void 0 ? {} : _ref$questionsHelpPro,
|
|
2263
2289
|
_ref$hostSpecificData = _ref.hostSpecificData,
|
|
2264
|
-
hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData
|
|
2290
|
+
hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData,
|
|
2291
|
+
_ref$showReadOnlySwit = _ref.showReadOnlySwitch,
|
|
2292
|
+
showReadOnlySwitch = _ref$showReadOnlySwit === void 0 ? false : _ref$showReadOnlySwit;
|
|
2265
2293
|
var queryClient = useQueryClient();
|
|
2266
2294
|
var _useReorderQuestions = useReorderQuestions(id, {
|
|
2267
2295
|
onSuccess: showThumbsUpToastr
|
|
@@ -2366,6 +2394,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2366
2394
|
savedTitle: savedTitle,
|
|
2367
2395
|
selectedLanguage: selectedLanguage,
|
|
2368
2396
|
showActionBlock: showActionBlock,
|
|
2397
|
+
showReadOnlySwitch: showReadOnlySwitch,
|
|
2369
2398
|
submitButtonProps: submitButtonProps
|
|
2370
2399
|
})), {}, {
|
|
2371
2400
|
formId: id,
|