@bigbinary/neeto-form-frontend 3.14.8 → 4.0.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/README.md +5 -3
- package/dist/BuildForm.js +21 -11
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +4 -4
- package/dist/Submission.js +1 -1
- package/dist/UrlBuilder.js +4 -4
- package/dist/{buildForm-CXy5L1RP.js → buildForm-BwhLCvEE.js} +2 -2
- package/dist/{buildForm-CXy5L1RP.js.map → buildForm-BwhLCvEE.js.map} +1 -1
- package/dist/{buildForm-DNCW7prR.js → buildForm-CsVQHcC7.js} +2 -2
- package/dist/{buildForm-DNCW7prR.js.map → buildForm-CsVQHcC7.js.map} +1 -1
- package/dist/cjs/BuildForm.js +21 -11
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +4 -4
- package/dist/cjs/Submission.js +1 -1
- package/dist/cjs/UrlBuilder.js +4 -4
- package/dist/cjs/hooks.js +4 -4
- package/dist/cjs/index.js +6 -6
- package/dist/{constants-b1EQ6-AS.js → constants-51SEJjzI.js} +2 -2
- package/dist/constants-51SEJjzI.js.map +1 -0
- package/dist/{constants-BVZZfXua.js → constants-C9wKMfgo.js} +2 -2
- package/dist/constants-C9wKMfgo.js.map +1 -0
- package/dist/{constants-CrLEqZUc.js → constants-Dmtgr5z3.js} +3 -3
- package/dist/{constants-CrLEqZUc.js.map → constants-Dmtgr5z3.js.map} +1 -1
- package/dist/{constants-CuzR2B5C.js → constants-gYwz1n9Z.js} +3 -3
- package/dist/{constants-CuzR2B5C.js.map → constants-gYwz1n9Z.js.map} +1 -1
- package/dist/hooks.js +4 -4
- package/dist/{index-BARvqe7c.js → index-D4URTv1p.js} +2 -2
- package/dist/{index-BARvqe7c.js.map → index-D4URTv1p.js.map} +1 -1
- package/dist/{index-BkNaYmLc.js → index-DnHrq-hl.js} +2 -2
- package/dist/{index-BkNaYmLc.js.map → index-DnHrq-hl.js.map} +1 -1
- package/dist/index.js +6 -6
- package/dist/{useFormSubmission-CYqHLtkA.js → useFormSubmission-BGNEnxvm.js} +2 -2
- package/dist/{useFormSubmission-CYqHLtkA.js.map → useFormSubmission-BGNEnxvm.js.map} +1 -1
- package/dist/{useFormSubmission-DMoyM44A.js → useFormSubmission-BUPnuOSG.js} +2 -2
- package/dist/{useFormSubmission-DMoyM44A.js.map → useFormSubmission-BUPnuOSG.js.map} +1 -1
- package/dist/{utils-3vf7iBuC.js → utils-Bhu45zuy.js} +4 -4
- package/dist/{utils-3vf7iBuC.js.map → utils-Bhu45zuy.js.map} +1 -1
- package/dist/{utils-E-UQc-9z.js → utils-DsI2Nrwl.js} +4 -4
- package/dist/{utils-E-UQc-9z.js.map → utils-DsI2Nrwl.js.map} +1 -1
- package/package.json +12 -12
- package/dist/constants-BVZZfXua.js.map +0 -1
- package/dist/constants-b1EQ6-AS.js.map +0 -1
package/README.md
CHANGED
|
@@ -56,13 +56,15 @@ model. It also stores submissions.
|
|
|
56
56
|
bundle exec rails db:migrate
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
5. Add this line to your application's `config/routes.rb` file
|
|
60
|
-
your desired route):
|
|
59
|
+
5. Add this line to your application's `config/routes.rb` file.
|
|
61
60
|
|
|
62
61
|
```ruby
|
|
63
|
-
mount NeetoFormEngine::Engine, at: "/
|
|
62
|
+
mount NeetoFormEngine::Engine, at: "/neeto_form"
|
|
64
63
|
```
|
|
65
64
|
|
|
65
|
+
**NOTE: The mount point must be `/neeto_form` and cannot be changed to any
|
|
66
|
+
other path.**
|
|
67
|
+
|
|
66
68
|
6. Create file `neeto_form_engine.rb` under `config/initializers` to provide the
|
|
67
69
|
`owner_class` information
|
|
68
70
|
|
package/dist/BuildForm.js
CHANGED
|
@@ -3,14 +3,14 @@ import classnames from 'classnames';
|
|
|
3
3
|
import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, hyphenate, noop, nullSafe, removeBy } from '@bigbinary/neeto-cist';
|
|
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
|
-
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-
|
|
7
|
-
import { e as buildDisplayLabel, f as INDEPENDENT_LABELS_MAP, h as QUESTION_ACTIONS, i as isElementOverflowing, D as Drag, j as SELECTABLE_KINDS, k as isAutoGeneratedQuestion, l as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, m as RESERVED_FIELD_CODES, L as LABEL_FIELDS, n as isDefaultLanguage, o as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, p as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, q as NON_HIDEABLE_FIELDS, r as NON_READ_ONLY_FIELDS, s as RICH_TEXT_QUESTIONS, t as FILE_TYPES_MAP, u as FILE_GROUPS, M as MINIMUM_OPTIONS, w as RATING_OPTIONS, x as STAR_RATING_MIN_VALUE_OPTIONS, y as STAR_RATING_MAX_VALUE_OPTIONS, z as STAR_RATING_ICONS_MAP, A as buildDisabledAddButtonHelpPopoverProps, B as buildReorderPayload, G as isMandatoryField, H as QUESTION_KINDS, a as QUESTION_KIND, J as getActiveQuestionKindDetails, K as DEFAULT_AVAILABLE_LANGUAGES, O as DEFAULT_ADVANCED_FEATURES, P as QUESTIONS_INITIAL_VALUE } from './constants-
|
|
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 { e as buildDisplayLabel, f as INDEPENDENT_LABELS_MAP, h as QUESTION_ACTIONS, i as isElementOverflowing, D as Drag, j as SELECTABLE_KINDS, k as isAutoGeneratedQuestion, l as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, m as RESERVED_FIELD_CODES, L as LABEL_FIELDS, n as isDefaultLanguage, o as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, p as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, q as NON_HIDEABLE_FIELDS, r as NON_READ_ONLY_FIELDS, s as RICH_TEXT_QUESTIONS, t as FILE_TYPES_MAP, u as FILE_GROUPS, M as MINIMUM_OPTIONS, w as RATING_OPTIONS, x as STAR_RATING_MIN_VALUE_OPTIONS, y as STAR_RATING_MAX_VALUE_OPTIONS, z as STAR_RATING_ICONS_MAP, A as buildDisabledAddButtonHelpPopoverProps, B as buildReorderPayload, G as isMandatoryField, H as QUESTION_KINDS, a as QUESTION_KIND, J as getActiveQuestionKindDetails, K as DEFAULT_AVAILABLE_LANGUAGES, O as DEFAULT_ADVANCED_FEATURES, P as QUESTIONS_INITIAL_VALUE } from './constants-gYwz1n9Z.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-CsVQHcC7.js';
|
|
14
14
|
import { shallow } from 'zustand/shallow';
|
|
15
15
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
16
16
|
import { useTranslation, Trans } from 'react-i18next';
|
|
@@ -21,7 +21,7 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
|
21
21
|
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
22
22
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
23
23
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
24
|
-
import { i as isFunction, f as fieldWithFallback, c as isNameQuestion } from './index-
|
|
24
|
+
import { i as isFunction, f as fieldWithFallback, c as isNameQuestion } from './index-DnHrq-hl.js';
|
|
25
25
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
26
26
|
import { t } from 'i18next';
|
|
27
27
|
import { v4 } from 'uuid';
|
|
@@ -247,7 +247,8 @@ var Card = function Card(_ref) {
|
|
|
247
247
|
onSelect = _ref.onSelect,
|
|
248
248
|
onEdit = _ref.onEdit,
|
|
249
249
|
onClone = _ref.onClone,
|
|
250
|
-
onDelete = _ref.onDelete
|
|
250
|
+
onDelete = _ref.onDelete,
|
|
251
|
+
canManageQuestions = _ref.canManageQuestions;
|
|
251
252
|
var _useState = useState(false),
|
|
252
253
|
_useState2 = _slicedToArray(_useState, 2),
|
|
253
254
|
isTooltipEnabled = _useState2[0],
|
|
@@ -276,7 +277,7 @@ var Card = function Card(_ref) {
|
|
|
276
277
|
},
|
|
277
278
|
children: [/*#__PURE__*/jsxs("div", {
|
|
278
279
|
className: "flex min-w-0 flex-grow items-center gap-1",
|
|
279
|
-
children: [/*#__PURE__*/jsx(Drag, {
|
|
280
|
+
children: [canManageQuestions && /*#__PURE__*/jsx(Drag, {
|
|
280
281
|
className: "neeto-ui-text-gray-600 flex-shrink-0"
|
|
281
282
|
}), /*#__PURE__*/jsx(Tooltip, {
|
|
282
283
|
content: questionLabel,
|
|
@@ -292,7 +293,7 @@ var Card = function Card(_ref) {
|
|
|
292
293
|
children: questionLabel
|
|
293
294
|
})
|
|
294
295
|
})]
|
|
295
|
-
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
296
|
+
}), canManageQuestions && /*#__PURE__*/jsx(MoreDropdown, {
|
|
296
297
|
dropdownButtonProps: {
|
|
297
298
|
className: "shrink-0"
|
|
298
299
|
},
|
|
@@ -334,9 +335,11 @@ var Questions = function Questions(_ref) {
|
|
|
334
335
|
onEdit = _ref.onEdit,
|
|
335
336
|
onClone = _ref.onClone,
|
|
336
337
|
onDelete = _ref.onDelete,
|
|
337
|
-
onSelect = _ref.onSelect
|
|
338
|
+
onSelect = _ref.onSelect,
|
|
339
|
+
canManageQuestions = _ref.canManageQuestions;
|
|
338
340
|
return /*#__PURE__*/jsx(Droppable, {
|
|
339
341
|
droppableId: "droppable",
|
|
342
|
+
isDropDisabled: !canManageQuestions,
|
|
340
343
|
children: function children(_ref2) {
|
|
341
344
|
var droppableProps = _ref2.droppableProps,
|
|
342
345
|
placeholder = _ref2.placeholder,
|
|
@@ -349,6 +352,7 @@ var Questions = function Questions(_ref) {
|
|
|
349
352
|
return /*#__PURE__*/createElement(Draggable, {
|
|
350
353
|
index: index,
|
|
351
354
|
draggableId: "question-".concat((_question$id = question.id) !== null && _question$id !== void 0 ? _question$id : question.nodeId),
|
|
355
|
+
isDragDisabled: !canManageQuestions,
|
|
352
356
|
key: "question-".concat((_question$id2 = question.id) !== null && _question$id2 !== void 0 ? _question$id2 : question.nodeId)
|
|
353
357
|
}, function (_ref3) {
|
|
354
358
|
var draggableProps = _ref3.draggableProps,
|
|
@@ -358,6 +362,7 @@ var Questions = function Questions(_ref) {
|
|
|
358
362
|
ref: innerRef,
|
|
359
363
|
children: /*#__PURE__*/jsx(Card, {
|
|
360
364
|
allQuestionKinds: allQuestionKinds,
|
|
365
|
+
canManageQuestions: canManageQuestions,
|
|
361
366
|
getActiveKindDetails: getActiveKindDetails,
|
|
362
367
|
onClone: onClone,
|
|
363
368
|
onEdit: onEdit,
|
|
@@ -2164,6 +2169,7 @@ var Form = function Form(_ref) {
|
|
|
2164
2169
|
isDisabledFieldLabel = _ref.isDisabledFieldLabel,
|
|
2165
2170
|
disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps,
|
|
2166
2171
|
isFormEnabled = _ref.isFormEnabled,
|
|
2172
|
+
canManageQuestions = _ref.canManageQuestions,
|
|
2167
2173
|
savedTitle = _ref.savedTitle,
|
|
2168
2174
|
formTitle = _ref.formTitle,
|
|
2169
2175
|
formDescription = _ref.formDescription,
|
|
@@ -2353,6 +2359,7 @@ var Form = function Form(_ref) {
|
|
|
2353
2359
|
});
|
|
2354
2360
|
},
|
|
2355
2361
|
children: /*#__PURE__*/jsx(Questions, {
|
|
2362
|
+
canManageQuestions: canManageQuestions,
|
|
2356
2363
|
getActiveKindDetails: getActiveKindDetails,
|
|
2357
2364
|
isDeletable: isDeletable,
|
|
2358
2365
|
questions: questions,
|
|
@@ -2363,7 +2370,7 @@ var Form = function Form(_ref) {
|
|
|
2363
2370
|
onEdit: handleEdit,
|
|
2364
2371
|
onSelect: handleSelect
|
|
2365
2372
|
})
|
|
2366
|
-
}), /*#__PURE__*/jsx("div", {
|
|
2373
|
+
}), canManageQuestions && /*#__PURE__*/jsx("div", {
|
|
2367
2374
|
className: "mb-8 flex w-full items-center gap-x-1",
|
|
2368
2375
|
children: /*#__PURE__*/jsx(AddQuestion, {
|
|
2369
2376
|
addQuestionHelpProps: addQuestionHelpProps,
|
|
@@ -2374,7 +2381,7 @@ var Form = function Form(_ref) {
|
|
|
2374
2381
|
})]
|
|
2375
2382
|
}) : /*#__PURE__*/jsx(AddFirstQuestion, {
|
|
2376
2383
|
disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
|
|
2377
|
-
isDisabled: isEmpty(availableQuestionKinds),
|
|
2384
|
+
isDisabled: isEmpty(availableQuestionKinds) || !canManageQuestions,
|
|
2378
2385
|
onAdd: handleAdd
|
|
2379
2386
|
})
|
|
2380
2387
|
}), /*#__PURE__*/jsx(ManageQuestionPane, {
|
|
@@ -2435,7 +2442,9 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2435
2442
|
usesCustomSubmissionComponent = _ref$usesCustomSubmis === void 0 ? false : _ref$usesCustomSubmis,
|
|
2436
2443
|
_ref$onMutateSuccess = _ref.onMutateSuccess,
|
|
2437
2444
|
onMutateSuccess = _ref$onMutateSuccess === void 0 ? noop : _ref$onMutateSuccess,
|
|
2438
|
-
hostSpecificData = _ref.hostSpecificData
|
|
2445
|
+
hostSpecificData = _ref.hostSpecificData,
|
|
2446
|
+
_ref$canManageQuestio = _ref.canManageQuestions,
|
|
2447
|
+
canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio;
|
|
2439
2448
|
var queryClient = useQueryClient();
|
|
2440
2449
|
var _useForm = useForm({
|
|
2441
2450
|
formId: id,
|
|
@@ -2477,6 +2486,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2477
2486
|
additionalActionOptions: additionalActionOptions,
|
|
2478
2487
|
advancedFeatures: advancedFeatures,
|
|
2479
2488
|
availableLanguages: availableLanguages,
|
|
2489
|
+
canManageQuestions: canManageQuestions,
|
|
2480
2490
|
disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
|
|
2481
2491
|
formDescription: formDescription,
|
|
2482
2492
|
formTitle: formTitle,
|