@bigbinary/neeto-form-frontend 3.15.0-beta1 → 4.0.0-beta1
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/dist/BuildForm.js +23 -13
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +1 -1
- package/dist/ExternalForm.js.map +1 -1
- package/dist/Submission.js +1 -1
- package/dist/Submission.js.map +1 -1
- package/dist/cjs/BuildForm.js +23 -13
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +1 -1
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/Submission.js +1 -1
- package/dist/cjs/Submission.js.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/package.json +13 -12
package/dist/BuildForm.js
CHANGED
|
@@ -205,7 +205,7 @@ var Overview = function Overview(_ref) {
|
|
|
205
205
|
availableLanguages = _ref.availableLanguages,
|
|
206
206
|
additionalActionOptions = _ref.additionalActionOptions;
|
|
207
207
|
return /*#__PURE__*/jsxs("div", {
|
|
208
|
-
className: "neeto-form-nano-form-wrapper__overview mb-4 w-full
|
|
208
|
+
className: "neeto-form-nano-form-wrapper__overview mb-4 w-full shrink-0 space-y-4 pt-6",
|
|
209
209
|
children: [/*#__PURE__*/jsxs("div", {
|
|
210
210
|
className: "flex items-center justify-between",
|
|
211
211
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
@@ -215,7 +215,7 @@ var Overview = function Overview(_ref) {
|
|
|
215
215
|
weight: "neeto-ui-font-semibold",
|
|
216
216
|
children: title
|
|
217
217
|
}), /*#__PURE__*/jsxs("div", {
|
|
218
|
-
className: "flex
|
|
218
|
+
className: "flex shrink-0 items-center justify-between space-x-1",
|
|
219
219
|
children: [availableLanguages.length > 1 && /*#__PURE__*/jsx(ChangeLanguageDropdown, {
|
|
220
220
|
availableLanguages: availableLanguages
|
|
221
221
|
}), isPresent(additionalActionOptions) && /*#__PURE__*/jsx(MoreDropdown, {
|
|
@@ -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],
|
|
@@ -275,15 +276,15 @@ var Card = function Card(_ref) {
|
|
|
275
276
|
return onSelect(question);
|
|
276
277
|
},
|
|
277
278
|
children: [/*#__PURE__*/jsxs("div", {
|
|
278
|
-
className: "flex min-w-0
|
|
279
|
-
children: [/*#__PURE__*/jsx(Drag, {
|
|
280
|
-
className: "neeto-ui-text-gray-600
|
|
279
|
+
className: "flex min-w-0 grow items-center gap-1",
|
|
280
|
+
children: [canManageQuestions && /*#__PURE__*/jsx(Drag, {
|
|
281
|
+
className: "neeto-ui-text-gray-600 shrink-0"
|
|
281
282
|
}), /*#__PURE__*/jsx(Tooltip, {
|
|
282
283
|
content: questionLabel,
|
|
283
284
|
disabled: !isTooltipEnabled,
|
|
284
285
|
position: "top",
|
|
285
286
|
children: /*#__PURE__*/jsx(Typography, {
|
|
286
|
-
className: "line-clamp-2 min-w-0
|
|
287
|
+
className: "line-clamp-2 min-w-0 grow truncate break-words",
|
|
287
288
|
"data-cy": "".concat(slugify(questionLabel), "-question-card-label"),
|
|
288
289
|
lineHeight: "snug",
|
|
289
290
|
ref: questionLabelRef,
|
|
@@ -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,
|
|
@@ -2334,7 +2340,7 @@ var Form = function Form(_ref) {
|
|
|
2334
2340
|
description: formDescription,
|
|
2335
2341
|
title: formTitle
|
|
2336
2342
|
}), /*#__PURE__*/jsx("div", {
|
|
2337
|
-
className: "neeto-form-nano-form-wrapper__body min-h-0 w-full
|
|
2343
|
+
className: "neeto-form-nano-form-wrapper__body min-h-0 w-full grow space-y-6 overflow-y-auto pb-6",
|
|
2338
2344
|
children: isPresent(questions) ? /*#__PURE__*/jsxs("div", {
|
|
2339
2345
|
className: "space-y-6",
|
|
2340
2346
|
ref: containerRef,
|
|
@@ -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,
|