@bigbinary/neeto-form-frontend 2.2.0-beta2 → 2.2.0-beta4
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 +16 -0
- package/dist/index.cjs.js +35 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +27 -28
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
|
21
21
|
import { useTranslation, Trans, I18nextProvider } from 'react-i18next';
|
|
22
22
|
import { create } from 'zustand';
|
|
23
23
|
import '@babel/runtime/helpers/typeof';
|
|
24
|
-
import { isEditorEmpty
|
|
24
|
+
import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
|
|
25
25
|
import { shallow } from 'zustand/shallow';
|
|
26
26
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
27
27
|
import DOMPurify from 'dompurify';
|
|
@@ -33,6 +33,7 @@ import Pane from '@bigbinary/neetoui/Pane';
|
|
|
33
33
|
import Form$2 from '@bigbinary/neetoui/formik/Form';
|
|
34
34
|
import Select from '@bigbinary/neetoui/formik/Select';
|
|
35
35
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
36
|
+
import NeetoEditor from '@bigbinary/neeto-editor/Editor';
|
|
36
37
|
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
37
38
|
import Button$1 from '@bigbinary/neetoui/Button';
|
|
38
39
|
import Accordion from '@bigbinary/neetoui/Accordion';
|
|
@@ -49,6 +50,7 @@ import Toastr from '@bigbinary/neetoui/Toastr';
|
|
|
49
50
|
import Spinner$2 from '@bigbinary/neetoui/Spinner';
|
|
50
51
|
import dayjs from 'dayjs';
|
|
51
52
|
import { parsePhoneNumber } from 'libphonenumber-js';
|
|
53
|
+
import EditorContent from '@bigbinary/neeto-editor/EditorContent';
|
|
52
54
|
import NeetoUIMultiEmailInput from '@bigbinary/neetoui/MultiEmailInput';
|
|
53
55
|
import { validation, PhoneNumberInput, PhoneNumber } from '@bigbinary/neeto-molecules/PhoneNumber';
|
|
54
56
|
import localeData from 'dayjs/plugin/localeData';
|
|
@@ -555,10 +557,10 @@ var handleQuestionMutationSuccess = function handleQuestionMutationSuccess(_ref)
|
|
|
555
557
|
var _args = _slicedToArray$2(args, 1),
|
|
556
558
|
data = _args[0];
|
|
557
559
|
queryClient.invalidateQueries({
|
|
558
|
-
queryKey: [QUERY_KEYS.QUESTIONS, formId
|
|
560
|
+
queryKey: [QUERY_KEYS.QUESTIONS, formId]
|
|
559
561
|
});
|
|
560
562
|
queryClient.invalidateQueries({
|
|
561
|
-
queryKey: [QUERY_KEYS.QUESTIONS, "preview/".concat(formId)
|
|
563
|
+
queryKey: [QUERY_KEYS.QUESTIONS, "preview/".concat(formId)]
|
|
562
564
|
});
|
|
563
565
|
queryClient.setQueryData([QUERY_KEYS.QUESTIONS, formId, language], assoc("questions", data.questions));
|
|
564
566
|
queryClient.setQueryData([QUERY_KEYS.QUESTIONS, "preview/".concat(formId), language], assoc("questions", data.questions));
|
|
@@ -882,8 +884,17 @@ var DEFAULT_AVAILABLE_LANGUAGES = [{
|
|
|
882
884
|
var QUESTIONS_WITHOUT_FIELD_CODE = [PARAGRAPH$1, TERMS_AND_CONDITION$1, CONDITION$1, FILE_UPLOAD$3];
|
|
883
885
|
var QUESTIONS_INITIAL_VALUE = {
|
|
884
886
|
enabled: false,
|
|
885
|
-
questions: [
|
|
886
|
-
|
|
887
|
+
questions: [{
|
|
888
|
+
label: "",
|
|
889
|
+
kind: "text",
|
|
890
|
+
nodeId: "1"
|
|
891
|
+
}, {
|
|
892
|
+
label: "",
|
|
893
|
+
kind: "email",
|
|
894
|
+
nodeId: "2"
|
|
895
|
+
}],
|
|
896
|
+
title: "",
|
|
897
|
+
isQuestionsLoading: true
|
|
887
898
|
};
|
|
888
899
|
var RESERVED_FIELD_CODES = ["month", "date", "time"];
|
|
889
900
|
var SELECTABLE_KINDS = [RADIO$2, CHECKBOX$2, DROPDOWN$2];
|
|
@@ -2025,7 +2036,7 @@ var Editor = function Editor() {
|
|
|
2025
2036
|
});
|
|
2026
2037
|
return /*#__PURE__*/jsx("div", {
|
|
2027
2038
|
className: "w-full cursor-auto",
|
|
2028
|
-
children: /*#__PURE__*/jsx(
|
|
2039
|
+
children: /*#__PURE__*/jsx(NeetoEditor, {
|
|
2029
2040
|
required: true,
|
|
2030
2041
|
error: touched ? error : "",
|
|
2031
2042
|
id: "editor",
|
|
@@ -3116,22 +3127,11 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
3116
3127
|
isReordering = _useReorderQuestions.isPending;
|
|
3117
3128
|
var _useFetchQuestions = useFetchQuestions({
|
|
3118
3129
|
formId: id,
|
|
3119
|
-
language: selectedLanguage
|
|
3120
|
-
placeholderData: {
|
|
3121
|
-
isQuestionsLoading: true,
|
|
3122
|
-
questions: [{
|
|
3123
|
-
label: "",
|
|
3124
|
-
kind: "text",
|
|
3125
|
-
nodeId: "1"
|
|
3126
|
-
}, {
|
|
3127
|
-
label: "",
|
|
3128
|
-
kind: "email",
|
|
3129
|
-
nodeId: "2"
|
|
3130
|
-
}]
|
|
3131
|
-
}
|
|
3130
|
+
language: selectedLanguage
|
|
3132
3131
|
}),
|
|
3133
3132
|
data = _useFetchQuestions.data,
|
|
3134
|
-
isLoading = _useFetchQuestions.isLoading
|
|
3133
|
+
isLoading = _useFetchQuestions.isLoading,
|
|
3134
|
+
isQuestionsPending = _useFetchQuestions.isPending;
|
|
3135
3135
|
var _ref2 = data || QUESTIONS_INITIAL_VALUE,
|
|
3136
3136
|
isFormEnabled = _ref2.enabled,
|
|
3137
3137
|
savedTitle = _ref2.title,
|
|
@@ -3142,7 +3142,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
3142
3142
|
onUpdate === null || onUpdate === void 0 || onUpdate(data);
|
|
3143
3143
|
}
|
|
3144
3144
|
}, [data]);
|
|
3145
|
-
if (isLoading || showLoader && isQuestionsLoading) {
|
|
3145
|
+
if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
|
|
3146
3146
|
return /*#__PURE__*/jsx("div", {
|
|
3147
3147
|
className: "flex h-full w-full items-center justify-center py-6",
|
|
3148
3148
|
children: /*#__PURE__*/jsx(PageLoader, {})
|
|
@@ -3226,7 +3226,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
3226
3226
|
}
|
|
3227
3227
|
}));
|
|
3228
3228
|
}
|
|
3229
|
-
}), isQuestionsLoading && /*#__PURE__*/jsx("div", {
|
|
3229
|
+
}), isQuestionsLoading && !isQuestionsPending && /*#__PURE__*/jsx("div", {
|
|
3230
3230
|
className: "neeto-ui-bg-white absolute inset-0 flex items-center justify-center",
|
|
3231
3231
|
children: /*#__PURE__*/jsx(PageLoader, {})
|
|
3232
3232
|
})]
|
|
@@ -13758,7 +13758,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
13758
13758
|
var field = _ref2.field,
|
|
13759
13759
|
form = _ref2.form,
|
|
13760
13760
|
meta = _ref2.meta;
|
|
13761
|
-
return /*#__PURE__*/jsx(
|
|
13761
|
+
return /*#__PURE__*/jsx(NeetoEditor, _objectSpread$8({
|
|
13762
13762
|
className: "neeto-form-engine-rich-text-input",
|
|
13763
13763
|
error: meta.touched ? meta.error : "",
|
|
13764
13764
|
initialValue: field.value,
|
|
@@ -14317,15 +14317,14 @@ var ExternalForm = function ExternalForm(_ref) {
|
|
|
14317
14317
|
var _useForm = useForm({
|
|
14318
14318
|
formId: formId,
|
|
14319
14319
|
language: language,
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
isQuestionsLoading: true
|
|
14323
|
-
}
|
|
14320
|
+
preview: preview,
|
|
14321
|
+
enabled: !preview
|
|
14324
14322
|
}),
|
|
14325
14323
|
_useForm$data = _useForm.data,
|
|
14326
14324
|
form = _useForm$data === void 0 ? {
|
|
14327
14325
|
title: "",
|
|
14328
|
-
questions: []
|
|
14326
|
+
questions: [],
|
|
14327
|
+
isQuestionsLoading: true
|
|
14329
14328
|
} : _useForm$data,
|
|
14330
14329
|
isLoading = _useForm.isLoading;
|
|
14331
14330
|
var _queryClient$getQuery = queryClient.getQueryState([QUERY_KEYS.QUESTIONS, formId, language]),
|