@bigbinary/neeto-form-frontend 3.9.9 → 3.10.3
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 +156 -280
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +8 -8
- package/dist/ExternalForm.js.map +1 -1
- package/dist/NeetoFormProvider.js.map +1 -1
- package/dist/Submission.js +1 -1
- package/dist/Submission.js.map +1 -1
- package/dist/UrlBuilder.js +7 -7
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/{buildForm-CthgTgsm.js → buildForm-12iKiorQ.js} +3 -2
- package/dist/buildForm-12iKiorQ.js.map +1 -0
- package/dist/{buildForm-GdQQ62ve.js → buildForm-Zw1xpuBS.js} +3 -2
- package/dist/buildForm-Zw1xpuBS.js.map +1 -0
- package/dist/cjs/BuildForm.js +166 -290
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +8 -8
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/NeetoFormProvider.js.map +1 -1
- package/dist/cjs/Submission.js +1 -1
- package/dist/cjs/Submission.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +7 -7
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +3 -3
- package/dist/cjs/index.js +7 -7
- package/dist/{constants-C5wOjKeR.js → constants-AohkxnRH.js} +78 -28
- package/dist/constants-AohkxnRH.js.map +1 -0
- package/dist/{constants-BCiFseWW.js → constants-CCpt0hVT.js} +83 -26
- package/dist/constants-CCpt0hVT.js.map +1 -0
- package/dist/constants-D-XSuLo2.js.map +1 -1
- package/dist/constants-DlRX5mcQ.js.map +1 -1
- package/dist/hooks.js +3 -3
- package/dist/index-2caW4Cx0.js.map +1 -1
- package/dist/index-BL5SirYx.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/{useFormApi-DAiOGCeD.js → useFormApi-CWHgrz3I.js} +6 -6
- package/dist/useFormApi-CWHgrz3I.js.map +1 -0
- package/dist/{useFormApi-BS-TCKwR.js → useFormApi-DtoxIPE7.js} +6 -6
- package/dist/useFormApi-DtoxIPE7.js.map +1 -0
- package/dist/{useFormSubmission-B2aaxL1m.js → useFormSubmission-Bb1kpT-Z.js} +2 -2
- package/dist/{useFormSubmission-B2aaxL1m.js.map → useFormSubmission-Bb1kpT-Z.js.map} +1 -1
- package/dist/{useFormSubmission-DeaBHZs7.js → useFormSubmission-CU-i51el.js} +2 -2
- package/dist/{useFormSubmission-DeaBHZs7.js.map → useFormSubmission-CU-i51el.js.map} +1 -1
- package/dist/{utils-DvTIh9-Y.js → utils-ClGaz0cq.js} +27 -26
- package/dist/utils-ClGaz0cq.js.map +1 -0
- package/dist/{utils-DjiqVQzl.js → utils-DI6tmFqX.js} +27 -26
- package/dist/utils-DI6tmFqX.js.map +1 -0
- package/package.json +60 -57
- package/types.d.ts +1 -1
- package/dist/buildForm-CthgTgsm.js.map +0 -1
- package/dist/buildForm-GdQQ62ve.js.map +0 -1
- package/dist/constants-BCiFseWW.js.map +0 -1
- package/dist/constants-C5wOjKeR.js.map +0 -1
- package/dist/useFormApi-BS-TCKwR.js.map +0 -1
- package/dist/useFormApi-DAiOGCeD.js.map +0 -1
- package/dist/utils-DjiqVQzl.js.map +0 -1
- package/dist/utils-DvTIh9-Y.js.map +0 -1
package/dist/cjs/BuildForm.js
CHANGED
|
@@ -9,9 +9,9 @@ var neetoCist = require('@bigbinary/neeto-cist');
|
|
|
9
9
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
10
10
|
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
11
11
|
var ramda = require('ramda');
|
|
12
|
-
var useFormApi = require('../useFormApi-
|
|
12
|
+
var useFormApi = require('../useFormApi-CWHgrz3I.js');
|
|
13
13
|
var constants$1 = require('../constants-D-XSuLo2.js');
|
|
14
|
-
var constants = require('../constants-
|
|
14
|
+
var constants = require('../constants-CCpt0hVT.js');
|
|
15
15
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
16
16
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
17
17
|
var dnd = require('@hello-pangea/dnd');
|
|
@@ -19,7 +19,7 @@ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
|
19
19
|
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
20
20
|
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
21
21
|
var reactI18next = require('react-i18next');
|
|
22
|
-
var buildForm = require('../buildForm-
|
|
22
|
+
var buildForm = require('../buildForm-12iKiorQ.js');
|
|
23
23
|
var shallow = require('zustand/shallow');
|
|
24
24
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
25
25
|
var index = require('../index-2caW4Cx0.js');
|
|
@@ -28,9 +28,8 @@ var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
|
28
28
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
29
29
|
var Dropdown = require('@bigbinary/neetoui/Dropdown');
|
|
30
30
|
var Tooltip = require('@bigbinary/neetoui/Tooltip');
|
|
31
|
-
var i18next = require('i18next');
|
|
32
|
-
var Plus = require('@bigbinary/neeto-icons/Plus');
|
|
33
31
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
32
|
+
var i18next = require('i18next');
|
|
34
33
|
var uuid = require('uuid');
|
|
35
34
|
var NoData = require('@bigbinary/neetoui/NoData');
|
|
36
35
|
var Pane = require('@bigbinary/neetoui/Pane');
|
|
@@ -55,10 +54,11 @@ var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
|
55
54
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
56
55
|
var Checkbox$1 = require('@bigbinary/neetoui/formik/Checkbox');
|
|
57
56
|
var Checkbox = require('@bigbinary/neetoui/Checkbox');
|
|
58
|
-
var
|
|
57
|
+
var OptionFields = require('@bigbinary/neeto-molecules/OptionFields');
|
|
59
58
|
require('@bigbinary/neeto-commons-frontend/constants');
|
|
60
59
|
require('axios');
|
|
61
60
|
require('dompurify');
|
|
61
|
+
require('@bigbinary/neeto-icons/Plus');
|
|
62
62
|
require('zustand');
|
|
63
63
|
require('@babel/runtime/helpers/typeof');
|
|
64
64
|
|
|
@@ -254,50 +254,8 @@ var Overview = function Overview(_ref) {
|
|
|
254
254
|
});
|
|
255
255
|
};
|
|
256
256
|
|
|
257
|
-
function ownKeys$
|
|
258
|
-
function _objectSpread$
|
|
259
|
-
var validateEditorContent = function validateEditorContent(editorRef) {
|
|
260
|
-
return function () {
|
|
261
|
-
var _editorRef$current, _editorRef$current$ed;
|
|
262
|
-
return (_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && (_editorRef$current$ed = _editorRef$current.editor) !== null && _editorRef$current$ed !== void 0 && _editorRef$current$ed.isEmpty ? i18next.t("neetoForm.common.thisFieldIsRequired") : "";
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
var buildReorderPayload = function buildReorderPayload(questions) {
|
|
266
|
-
return ramda.reduce(function (acc, _ref) {
|
|
267
|
-
var id = _ref.id,
|
|
268
|
-
displayOrder = _ref.displayOrder;
|
|
269
|
-
return ramda.assoc(id, displayOrder, acc);
|
|
270
|
-
}, {}, questions);
|
|
271
|
-
};
|
|
272
|
-
var isRichTextQuestion = ramda.includes(ramda.__, constants.RICH_TEXT_QUESTIONS);
|
|
273
|
-
var isAutoGeneratedQuestion = ramda.includes(ramda.__, constants.AUTO_GENERATED_KINDS);
|
|
274
|
-
var isImmutableField = function isImmutableField(field) {
|
|
275
|
-
return constants.IMMUTABLE_KINDS.includes(field.kind);
|
|
276
|
-
};
|
|
277
|
-
var buildAddQuestionButtonProps = function buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps) {
|
|
278
|
-
return _objectSpread$h({
|
|
279
|
-
"data-cy": "neeto-form-engine-add-question-button",
|
|
280
|
-
disabled: isDisabled,
|
|
281
|
-
label: i18next.t("neetoForm.questions.common.primaryPanel.addQuestion"),
|
|
282
|
-
icon: Plus,
|
|
283
|
-
iconPosition: "left",
|
|
284
|
-
style: "link",
|
|
285
|
-
onClick: onAdd
|
|
286
|
-
}, isDisabled && {
|
|
287
|
-
tooltipProps: tooltipProps
|
|
288
|
-
});
|
|
289
|
-
};
|
|
290
|
-
var buildDisabledAddButtonTooltipProps = function buildDisabledAddButtonTooltipProps(isDisabled) {
|
|
291
|
-
var disabledAddButtonTooltipProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
292
|
-
return _objectSpread$h({
|
|
293
|
-
disabled: !isDisabled,
|
|
294
|
-
position: "top",
|
|
295
|
-
content: i18next.t("neetoForm.questions.common.primaryPanel.noQuestionLeft")
|
|
296
|
-
}, disabledAddButtonTooltipProps);
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
function ownKeys$g(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; }
|
|
300
|
-
function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$g(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$g(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
257
|
+
function ownKeys$f(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; }
|
|
258
|
+
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$f(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$f(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
301
259
|
var Card = function Card(_ref) {
|
|
302
260
|
var _ref$question = _ref.question,
|
|
303
261
|
question = _ref$question === void 0 ? {} : _ref$question,
|
|
@@ -324,7 +282,7 @@ var Card = function Card(_ref) {
|
|
|
324
282
|
isSingular = _getActiveKindDetails.isSingular;
|
|
325
283
|
var isSmsReminderQuestion = kind === constants.QUESTION_TYPES.SMS_REMINDER;
|
|
326
284
|
var label = index.fieldWithFallback(question, "label");
|
|
327
|
-
var questionLabel = isRichTextQuestion(kind) ? constants.htmlToPlainText(label) : label;
|
|
285
|
+
var questionLabel = constants.isRichTextQuestion(kind) ? constants.htmlToPlainText(label) : label;
|
|
328
286
|
React.useEffect(function () {
|
|
329
287
|
var element = questionLabelRef.current;
|
|
330
288
|
if (neetoCist.isNotPresent(element)) return;
|
|
@@ -348,6 +306,7 @@ var Card = function Card(_ref) {
|
|
|
348
306
|
position: "top",
|
|
349
307
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
350
308
|
className: "line-clamp-2 min-w-0 flex-grow truncate break-words",
|
|
309
|
+
"data-cy": "".concat(neetoCist.slugify(questionLabel), "-question-card-label"),
|
|
351
310
|
lineHeight: "snug",
|
|
352
311
|
ref: questionLabelRef,
|
|
353
312
|
style: "body2",
|
|
@@ -357,7 +316,7 @@ var Card = function Card(_ref) {
|
|
|
357
316
|
})]
|
|
358
317
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
359
318
|
className: "flex items-center gap-1",
|
|
360
|
-
children: [isSmsReminderQuestion && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$
|
|
319
|
+
children: [isSmsReminderQuestion && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$f({
|
|
361
320
|
description: t("neetoForm.smsReminder.popoverDescription"),
|
|
362
321
|
popoverProps: {
|
|
363
322
|
position: "top"
|
|
@@ -396,8 +355,8 @@ var Card = function Card(_ref) {
|
|
|
396
355
|
});
|
|
397
356
|
};
|
|
398
357
|
|
|
399
|
-
function ownKeys$
|
|
400
|
-
function _objectSpread$
|
|
358
|
+
function ownKeys$e(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; }
|
|
359
|
+
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$e(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$e(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
401
360
|
var Questions = function Questions(_ref) {
|
|
402
361
|
var questions = _ref.questions,
|
|
403
362
|
isDeletable = _ref.isDeletable,
|
|
@@ -414,7 +373,7 @@ var Questions = function Questions(_ref) {
|
|
|
414
373
|
var droppableProps = _ref2.droppableProps,
|
|
415
374
|
placeholder = _ref2.placeholder,
|
|
416
375
|
innerRef = _ref2.innerRef;
|
|
417
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$
|
|
376
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$e(_objectSpread$e({}, droppableProps), {}, {
|
|
418
377
|
className: "space-y-2",
|
|
419
378
|
ref: innerRef,
|
|
420
379
|
children: [questions.map(function (question, index) {
|
|
@@ -427,7 +386,7 @@ var Questions = function Questions(_ref) {
|
|
|
427
386
|
var draggableProps = _ref3.draggableProps,
|
|
428
387
|
dragHandleProps = _ref3.dragHandleProps,
|
|
429
388
|
innerRef = _ref3.innerRef;
|
|
430
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$
|
|
389
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$e(_objectSpread$e(_objectSpread$e({}, draggableProps), dragHandleProps), {}, {
|
|
431
390
|
ref: innerRef,
|
|
432
391
|
children: /*#__PURE__*/jsxRuntime.jsx(Card, {
|
|
433
392
|
allQuestionKinds: allQuestionKinds,
|
|
@@ -459,8 +418,8 @@ var arrayHelpers = {
|
|
|
459
418
|
moveItem: moveItem
|
|
460
419
|
};
|
|
461
420
|
|
|
462
|
-
function ownKeys$
|
|
463
|
-
function _objectSpread$
|
|
421
|
+
function ownKeys$d(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; }
|
|
422
|
+
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
464
423
|
var isChoiceQuestion = function isChoiceQuestion(question) {
|
|
465
424
|
return ramda.includes(question === null || question === void 0 ? void 0 : question.kind, constants.SELECTABLE_KINDS);
|
|
466
425
|
};
|
|
@@ -487,12 +446,24 @@ var generateFieldCodePrefix = function generateFieldCodePrefix(label, kind) {
|
|
|
487
446
|
}
|
|
488
447
|
return addSuffixForReservedFieldCode(prefix) || "";
|
|
489
448
|
};
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
449
|
+
var modifyDefaultValues = function modifyDefaultValues(_ref) {
|
|
450
|
+
var values = _ref.values,
|
|
451
|
+
kind = _ref.kind,
|
|
452
|
+
selectedLanguage = _ref.selectedLanguage,
|
|
453
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds;
|
|
454
|
+
if (!ramda.includes(kind, constants.SELECTABLE_KINDS) || constants.isDefaultLanguage(selectedLanguage) || !isUsingDefaultQuestionKinds) {
|
|
455
|
+
return values;
|
|
456
|
+
}
|
|
457
|
+
return ramda.evolve({
|
|
458
|
+
optionsAttributes: ramda.map(ramda.assoc("label", ""))
|
|
459
|
+
}, values);
|
|
460
|
+
};
|
|
461
|
+
var generateUniqueFieldCode = function generateUniqueFieldCode(_ref2) {
|
|
462
|
+
var questions = _ref2.questions,
|
|
463
|
+
_ref2$label = _ref2.label,
|
|
464
|
+
label = _ref2$label === void 0 ? "" : _ref2$label,
|
|
465
|
+
_ref2$kind = _ref2.kind,
|
|
466
|
+
kind = _ref2$kind === void 0 ? "" : _ref2$kind;
|
|
496
467
|
var prefix = generateFieldCodePrefix(label, kind);
|
|
497
468
|
var uniqueNumber = Math.max.apply(Math, [0].concat(_toConsumableArray(getUniqueNumbersFromExistingFieldCodes(prefix, questions))));
|
|
498
469
|
var candidateFieldCode = "";
|
|
@@ -508,37 +479,45 @@ var generateUniqueFieldCode = function generateUniqueFieldCode(_ref) {
|
|
|
508
479
|
}
|
|
509
480
|
return candidateFieldCode;
|
|
510
481
|
};
|
|
511
|
-
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(
|
|
512
|
-
var activeQuestions =
|
|
513
|
-
kind =
|
|
482
|
+
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(_ref3) {
|
|
483
|
+
var activeQuestions = _ref3.activeQuestions,
|
|
484
|
+
kind = _ref3.kind;
|
|
514
485
|
return activeQuestions.some(function (activeQuestion) {
|
|
515
486
|
return activeQuestion.kind === kind.type && activeQuestion._destroy !== true;
|
|
516
487
|
});
|
|
517
488
|
};
|
|
518
|
-
var handleFieldDragEnd = function handleFieldDragEnd(
|
|
519
|
-
var items =
|
|
520
|
-
setValue =
|
|
521
|
-
source =
|
|
522
|
-
destination =
|
|
489
|
+
var handleFieldDragEnd = function handleFieldDragEnd(_ref4) {
|
|
490
|
+
var items = _ref4.items,
|
|
491
|
+
setValue = _ref4.setValue,
|
|
492
|
+
source = _ref4.source,
|
|
493
|
+
destination = _ref4.destination;
|
|
523
494
|
if (!(destination && items instanceof Array)) return;
|
|
524
495
|
var nextItems = _toConsumableArray(items);
|
|
525
496
|
arrayHelpers.moveItem(nextItems, source.index, destination.index);
|
|
526
497
|
var orderedItems = nextItems.map(function (item, index) {
|
|
527
|
-
return _objectSpread$
|
|
498
|
+
return _objectSpread$d(_objectSpread$d({}, item), {}, {
|
|
528
499
|
displayOrder: index
|
|
529
500
|
});
|
|
530
501
|
});
|
|
531
502
|
setValue("questions", orderedItems);
|
|
532
503
|
};
|
|
533
|
-
var createFieldData = function createFieldData(
|
|
534
|
-
var
|
|
535
|
-
defaults =
|
|
536
|
-
type =
|
|
537
|
-
metadata =
|
|
538
|
-
|
|
539
|
-
isRequired =
|
|
540
|
-
questions =
|
|
541
|
-
|
|
504
|
+
var createFieldData = function createFieldData(_ref5) {
|
|
505
|
+
var _ref5$kind = _ref5.kind,
|
|
506
|
+
defaults = _ref5$kind.defaults,
|
|
507
|
+
type = _ref5$kind.type,
|
|
508
|
+
metadata = _ref5$kind.metadata,
|
|
509
|
+
_ref5$isRequired = _ref5.isRequired,
|
|
510
|
+
isRequired = _ref5$isRequired === void 0 ? undefined : _ref5$isRequired,
|
|
511
|
+
questions = _ref5.questions,
|
|
512
|
+
selectedLanguage = _ref5.selectedLanguage,
|
|
513
|
+
isUsingDefaultQuestionKinds = _ref5.isUsingDefaultQuestionKinds;
|
|
514
|
+
var modifiedDefaultValues = modifyDefaultValues({
|
|
515
|
+
values: defaults,
|
|
516
|
+
kind: type,
|
|
517
|
+
selectedLanguage: selectedLanguage,
|
|
518
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
519
|
+
});
|
|
520
|
+
return _objectSpread$d(_objectSpread$d({}, modifiedDefaultValues), {}, {
|
|
542
521
|
metadata: metadata,
|
|
543
522
|
isRequired: isRequired,
|
|
544
523
|
kind: type,
|
|
@@ -550,10 +529,10 @@ var createFieldData = function createFieldData(_ref4) {
|
|
|
550
529
|
})
|
|
551
530
|
});
|
|
552
531
|
};
|
|
553
|
-
var duplicateFieldData = function duplicateFieldData(
|
|
554
|
-
var item =
|
|
555
|
-
questionKinds =
|
|
556
|
-
questions =
|
|
532
|
+
var duplicateFieldData = function duplicateFieldData(_ref6) {
|
|
533
|
+
var item = _ref6.item,
|
|
534
|
+
questionKinds = _ref6.questionKinds,
|
|
535
|
+
questions = _ref6.questions;
|
|
557
536
|
var isRequired = item.isRequired,
|
|
558
537
|
kind = item.kind,
|
|
559
538
|
optionsAttributes = item.optionsAttributes;
|
|
@@ -563,10 +542,10 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
563
542
|
var label = index.fieldWithFallback(item, "label");
|
|
564
543
|
var defaultAttributeNames = ramda.keys(questionKind.defaults || {});
|
|
565
544
|
var defaultAttributes = ramda.pick(defaultAttributeNames, item);
|
|
566
|
-
var newQuestionLabel = isRichTextQuestion(kind) ? label : i18next.t("neetoForm.common.clonedElementLabel", {
|
|
545
|
+
var newQuestionLabel = constants.isRichTextQuestion(kind) ? label : i18next.t("neetoForm.common.clonedElementLabel", {
|
|
567
546
|
label: label
|
|
568
547
|
});
|
|
569
|
-
return _objectSpread$
|
|
548
|
+
return _objectSpread$d(_objectSpread$d({}, defaultAttributes), {}, {
|
|
570
549
|
isRequired: isRequired,
|
|
571
550
|
kind: kind,
|
|
572
551
|
label: newQuestionLabel,
|
|
@@ -580,15 +559,15 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
580
559
|
displayOrder: item.displayOrder + 1
|
|
581
560
|
});
|
|
582
561
|
};
|
|
583
|
-
var getAvailableQuestionKinds = function getAvailableQuestionKinds(
|
|
584
|
-
var allQuestionKinds =
|
|
585
|
-
|
|
586
|
-
activeQuestions =
|
|
587
|
-
isKindAlreadyActive =
|
|
562
|
+
var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref7) {
|
|
563
|
+
var allQuestionKinds = _ref7.allQuestionKinds,
|
|
564
|
+
_ref7$activeQuestions = _ref7.activeQuestions,
|
|
565
|
+
activeQuestions = _ref7$activeQuestions === void 0 ? [] : _ref7$activeQuestions,
|
|
566
|
+
isKindAlreadyActive = _ref7.isKindAlreadyActive;
|
|
588
567
|
if (ramda.isEmpty(activeQuestions)) return allQuestionKinds;
|
|
589
568
|
return ramda.reject(function (kind) {
|
|
590
569
|
var isSingularKind = kind.isSingular;
|
|
591
|
-
return isAutoGeneratedQuestion(kind.type) || isSingularKind && isKindAlreadyActive({
|
|
570
|
+
return constants.isAutoGeneratedQuestion(kind.type) || isSingularKind && isKindAlreadyActive({
|
|
592
571
|
activeQuestions: activeQuestions,
|
|
593
572
|
kind: kind
|
|
594
573
|
});
|
|
@@ -602,14 +581,14 @@ var AddFirstQuestion = function AddFirstQuestion(_ref) {
|
|
|
602
581
|
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps;
|
|
603
582
|
var _useTranslation = reactI18next.useTranslation(),
|
|
604
583
|
t = _useTranslation.t;
|
|
605
|
-
var tooltipProps = buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
584
|
+
var tooltipProps = constants.buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
606
585
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
607
586
|
className: "flex h-full flex-col items-center justify-center py-8",
|
|
608
587
|
children: /*#__PURE__*/jsxRuntime.jsx(NoData, {
|
|
609
588
|
showTooltipWhenButtonDisabled: true,
|
|
610
589
|
className: "min-h-80",
|
|
611
590
|
title: t("neetoForm.questions.common.noData"),
|
|
612
|
-
primaryButtonProps: buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps)
|
|
591
|
+
primaryButtonProps: constants.buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps)
|
|
613
592
|
})
|
|
614
593
|
});
|
|
615
594
|
};
|
|
@@ -650,8 +629,8 @@ var INITIAL_VALUES = {
|
|
|
650
629
|
var VALID_FIELD_CODE_REGEX = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
651
630
|
|
|
652
631
|
var _excluded$8 = ["label", "name"];
|
|
653
|
-
function ownKeys$
|
|
654
|
-
function _objectSpread$
|
|
632
|
+
function ownKeys$c(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; }
|
|
633
|
+
function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
655
634
|
var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
656
635
|
var label = _ref.label,
|
|
657
636
|
name = _ref.name,
|
|
@@ -670,7 +649,7 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
670
649
|
var end = element.value.length;
|
|
671
650
|
element.setSelectionRange(end, end);
|
|
672
651
|
};
|
|
673
|
-
return /*#__PURE__*/jsxRuntime.jsx(Textarea, _objectSpread$
|
|
652
|
+
return /*#__PURE__*/jsxRuntime.jsx(Textarea, _objectSpread$c({
|
|
674
653
|
label: label,
|
|
675
654
|
name: name,
|
|
676
655
|
className: "neeto-form-nano-adaptive-input",
|
|
@@ -736,8 +715,8 @@ var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
|
|
|
736
715
|
return store.formState.richTextFieldsToReset.includes(fieldCode);
|
|
737
716
|
});
|
|
738
717
|
var setEditorContent = function setEditorContent(content) {
|
|
739
|
-
var _editorRef$current$ed
|
|
740
|
-
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0
|
|
718
|
+
var _editorRef$current$ed;
|
|
719
|
+
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0 || (_editorRef$current$ed = _editorRef$current$ed.commands) === null || _editorRef$current$ed === void 0 ? void 0 : _editorRef$current$ed.setContent(content);
|
|
741
720
|
};
|
|
742
721
|
if (shouldReset) {
|
|
743
722
|
setEditorContent(initialValue);
|
|
@@ -778,7 +757,7 @@ var Editor = function Editor() {
|
|
|
778
757
|
var fieldName = "label";
|
|
779
758
|
var _useField = formik.useField({
|
|
780
759
|
name: fieldName,
|
|
781
|
-
validate: validateEditorContent(editorRef)
|
|
760
|
+
validate: constants.validateEditorContent(editorRef)
|
|
782
761
|
}),
|
|
783
762
|
_useField2 = _slicedToArray(_useField, 3),
|
|
784
763
|
value = _useField2[0].value,
|
|
@@ -825,8 +804,8 @@ var RequiredSwitch = reactUtils.withT(function (_ref) {
|
|
|
825
804
|
});
|
|
826
805
|
|
|
827
806
|
var _excluded$7 = ["maxLength"];
|
|
828
|
-
function ownKeys$
|
|
829
|
-
function _objectSpread$
|
|
807
|
+
function ownKeys$b(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; }
|
|
808
|
+
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
830
809
|
var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
831
810
|
var maxLength = _ref.maxLength,
|
|
832
811
|
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
@@ -840,7 +819,7 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
|
840
819
|
}
|
|
841
820
|
}, [value, maxLength, setValue]);
|
|
842
821
|
var shouldShowMaxLength = value && value.length > maxLength - 10;
|
|
843
|
-
return /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$
|
|
822
|
+
return /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$b(_objectSpread$b({}, props), shouldShowMaxLength && {
|
|
844
823
|
maxLength: maxLength
|
|
845
824
|
}));
|
|
846
825
|
};
|
|
@@ -897,14 +876,18 @@ var Form$1 = function Form(_ref) {
|
|
|
897
876
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
898
877
|
var hideQuestionHelpDoc = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", "hideQuestion"]));
|
|
899
878
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
900
|
-
var _store$formState, _store$formState2;
|
|
879
|
+
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
901
880
|
return {
|
|
902
881
|
enableDomainWhitelisting: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["enableDomainWhitelisting"],
|
|
903
|
-
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"]
|
|
882
|
+
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"],
|
|
883
|
+
selectedLanguage: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["selectedLanguage"],
|
|
884
|
+
isUsingDefaultQuestionKinds: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["isUsingDefaultQuestionKinds"]
|
|
904
885
|
};
|
|
905
886
|
}, shallow.shallow),
|
|
906
887
|
enableDomainWhitelisting = _useBuildFormStore.enableDomainWhitelisting,
|
|
907
|
-
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting
|
|
888
|
+
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting,
|
|
889
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
890
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
908
891
|
var kind = values.kind;
|
|
909
892
|
var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
|
|
910
893
|
var questionKindUniquenessPattern = ramda.mergeLeft(isEdit && additionalQuestionKindPattern ? additionalQuestionKindPattern(values) : {}, {
|
|
@@ -921,7 +904,7 @@ var Form$1 = function Form(_ref) {
|
|
|
921
904
|
questionProps = _ref2$questionProps === void 0 ? {} : _ref2$questionProps;
|
|
922
905
|
var isRequired = questionKind && isRequiredField(questionKind);
|
|
923
906
|
var isLabelDisabled = questionKind && isDisabledFieldLabel(questionKind);
|
|
924
|
-
var isImmutable = questionKind && isImmutableField(questionKind);
|
|
907
|
+
var isImmutable = questionKind && constants.isImmutableField(questionKind);
|
|
925
908
|
var shouldShowPlaceholder = ramda.includes(kind, QUESTIONS_WITH_PLACEHOLDERS);
|
|
926
909
|
var hasAdditionalData = ramda.includes(kind, QUESTIONS_WITH_ADDITIONAL_DATA);
|
|
927
910
|
var shouldShowFieldCode = enableFieldCode && !ramda.includes(kind, constants.QUESTIONS_WITHOUT_FIELD_CODE);
|
|
@@ -945,7 +928,9 @@ var Form$1 = function Form(_ref) {
|
|
|
945
928
|
return createFieldData({
|
|
946
929
|
kind: questionKind,
|
|
947
930
|
isRequired: isRequired,
|
|
948
|
-
questions: questions
|
|
931
|
+
questions: questions,
|
|
932
|
+
selectedLanguage: selectedLanguage,
|
|
933
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
949
934
|
});
|
|
950
935
|
};
|
|
951
936
|
var updateFormState = function updateFormState(data) {
|
|
@@ -976,7 +961,7 @@ var Form$1 = function Form(_ref) {
|
|
|
976
961
|
options: buildKindOptions(questionKinds),
|
|
977
962
|
label: t("neetoForm.questions.common.questionFields.field.questionType"),
|
|
978
963
|
onChange: handleKindChange
|
|
979
|
-
}), isRichTextQuestion(kind) ? /*#__PURE__*/jsxRuntime.jsx(Editor, {
|
|
964
|
+
}), constants.isRichTextQuestion(kind) ? /*#__PURE__*/jsxRuntime.jsx(Editor, {
|
|
980
965
|
isLabelDisabled: isLabelDisabled
|
|
981
966
|
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
982
967
|
className: "space-y-6",
|
|
@@ -1045,15 +1030,13 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1045
1030
|
fieldCode: yup__namespace.string().trim().notOneOf(constants.RESERVED_FIELD_CODES, i18next.t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
|
|
1046
1031
|
return enableFieldCode && !ramda.includes(kind, constants.QUESTIONS_WITHOUT_FIELD_CODE) ? fieldCodeValidation(schema, i18next.t("neetoForm.questions.common.questionFields.field.fieldCode")) : schema.notRequired();
|
|
1047
1032
|
}),
|
|
1048
|
-
optionsAttributes: yup__namespace.array().when("
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1033
|
+
optionsAttributes: yup__namespace.array().when("kind", function (kind, schema) {
|
|
1034
|
+
return ramda.includes(kind, constants.SELECTABLE_KINDS) ? schema.of(yup__namespace.object().shape({
|
|
1035
|
+
label: yup__namespace.string().when("_destroy", {
|
|
1036
|
+
is: true,
|
|
1037
|
+
otherwise: requiredLabelValidation(yup__namespace.string(), i18next.t("neetoForm.questions.common.questionFields.field.option"))
|
|
1038
|
+
})
|
|
1039
|
+
})) : schema.notRequired();
|
|
1057
1040
|
}),
|
|
1058
1041
|
highestRatingLabel: yup__namespace.string().nullable(),
|
|
1059
1042
|
averageRatingLabel: yup__namespace.string().nullable(),
|
|
@@ -1062,8 +1045,8 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1062
1045
|
};
|
|
1063
1046
|
|
|
1064
1047
|
var _excluded$6 = ["question", "onClose", "questions", "handleSelect", "buildRequestArgs", "isOpen"];
|
|
1065
|
-
function ownKeys$
|
|
1066
|
-
function _objectSpread$
|
|
1048
|
+
function ownKeys$a(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; }
|
|
1049
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1067
1050
|
var Add = function Add(_ref) {
|
|
1068
1051
|
var question = _ref.question,
|
|
1069
1052
|
onClose = _ref.onClose,
|
|
@@ -1094,7 +1077,7 @@ var Add = function Add(_ref) {
|
|
|
1094
1077
|
var handleSubmit = function handleSubmit(values) {
|
|
1095
1078
|
if (isCreating || !isOpen) return;
|
|
1096
1079
|
var displayOrder = question ? question.displayOrder + 1 : questions.length;
|
|
1097
|
-
createQuestion(_objectSpread$
|
|
1080
|
+
createQuestion(_objectSpread$a({
|
|
1098
1081
|
language: language,
|
|
1099
1082
|
neetoFormQuestion: ramda.mergeLeft({
|
|
1100
1083
|
displayOrder: displayOrder
|
|
@@ -1123,7 +1106,7 @@ var Add = function Add(_ref) {
|
|
|
1123
1106
|
onSubmit: handleSubmit
|
|
1124
1107
|
},
|
|
1125
1108
|
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1126
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$
|
|
1109
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$a({}, _objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
1127
1110
|
question: question,
|
|
1128
1111
|
questions: questions
|
|
1129
1112
|
}))), /*#__PURE__*/jsxRuntime.jsx(Pane.Footer, {
|
|
@@ -1140,8 +1123,8 @@ var Add = function Add(_ref) {
|
|
|
1140
1123
|
};
|
|
1141
1124
|
|
|
1142
1125
|
var _excluded$5 = ["question", "isOpen", "onClose"];
|
|
1143
|
-
function ownKeys$
|
|
1144
|
-
function _objectSpread$
|
|
1126
|
+
function ownKeys$9(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; }
|
|
1127
|
+
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1145
1128
|
var Edit = function Edit(_ref) {
|
|
1146
1129
|
var question = _ref.question,
|
|
1147
1130
|
isOpen = _ref.isOpen,
|
|
@@ -1193,7 +1176,7 @@ var Edit = function Edit(_ref) {
|
|
|
1193
1176
|
onSubmit: handleSubmit
|
|
1194
1177
|
},
|
|
1195
1178
|
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1196
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$
|
|
1179
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$9(_objectSpread$9({}, _objectSpread$9({
|
|
1197
1180
|
question: question
|
|
1198
1181
|
}, props)), {}, {
|
|
1199
1182
|
isEdit: true
|
|
@@ -1229,8 +1212,8 @@ var Captcha = reactUtils.withT(function (_ref) {
|
|
|
1229
1212
|
});
|
|
1230
1213
|
|
|
1231
1214
|
var _excluded$4 = ["name", "title", "className"];
|
|
1232
|
-
function ownKeys$
|
|
1233
|
-
function _objectSpread$
|
|
1215
|
+
function ownKeys$8(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; }
|
|
1216
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1234
1217
|
var SwitchBlock = function SwitchBlock(_ref) {
|
|
1235
1218
|
var name = _ref.name,
|
|
1236
1219
|
title = _ref.title,
|
|
@@ -1240,7 +1223,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1240
1223
|
return /*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
1241
1224
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1242
1225
|
"data-cy": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-toggle-label"),
|
|
1243
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$
|
|
1226
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$8(_objectSpread$8({}, _objectSpread$8(_objectSpread$8({}, otherProps), {}, {
|
|
1244
1227
|
name: name
|
|
1245
1228
|
})), {}, {
|
|
1246
1229
|
"data-cy": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-switch")
|
|
@@ -1252,15 +1235,15 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1252
1235
|
});
|
|
1253
1236
|
};
|
|
1254
1237
|
|
|
1255
|
-
function ownKeys$
|
|
1256
|
-
function _objectSpread$
|
|
1238
|
+
function ownKeys$7(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; }
|
|
1239
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1257
1240
|
var TitleWithHelpPopover = function TitleWithHelpPopover(_ref) {
|
|
1258
1241
|
var title = _ref.title,
|
|
1259
1242
|
description = _ref.description,
|
|
1260
1243
|
helpLink = _ref.helpLink;
|
|
1261
1244
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1262
1245
|
className: "flex gap-2",
|
|
1263
|
-
children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$
|
|
1246
|
+
children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$7({
|
|
1264
1247
|
description: description,
|
|
1265
1248
|
popoverProps: {
|
|
1266
1249
|
position: "top"
|
|
@@ -1287,8 +1270,8 @@ var DOMAIN_RESTRICTION_TRANSLATIONS = {
|
|
|
1287
1270
|
};
|
|
1288
1271
|
|
|
1289
1272
|
var _excluded$3 = ["children"];
|
|
1290
|
-
function ownKeys$
|
|
1291
|
-
function _objectSpread$
|
|
1273
|
+
function ownKeys$6(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; }
|
|
1274
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1292
1275
|
var STYLES = {
|
|
1293
1276
|
border: {
|
|
1294
1277
|
"default": "1px solid rgb(var(--neeto-ui-gray-400))",
|
|
@@ -1300,8 +1283,8 @@ var STYLES = {
|
|
|
1300
1283
|
}
|
|
1301
1284
|
};
|
|
1302
1285
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1303
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$
|
|
1304
|
-
innerProps: _objectSpread$
|
|
1286
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1287
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(utils.hyphenize(props.data.label), "-remove-icon"))),
|
|
1305
1288
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1306
1289
|
size: 16
|
|
1307
1290
|
})
|
|
@@ -1321,8 +1304,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1321
1304
|
firstChild = _children[0],
|
|
1322
1305
|
rest = _children.slice(1);
|
|
1323
1306
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1324
|
-
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$
|
|
1325
|
-
innerProps: _objectSpread$
|
|
1307
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1308
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
|
|
1326
1309
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
1327
1310
|
style: "secondary",
|
|
1328
1311
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1332,8 +1315,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1332
1315
|
}));
|
|
1333
1316
|
};
|
|
1334
1317
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1335
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$
|
|
1336
|
-
innerProps: _objectSpread$
|
|
1318
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1319
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
|
|
1337
1320
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1338
1321
|
className: "cursor-pointer",
|
|
1339
1322
|
size: 16
|
|
@@ -1354,7 +1337,7 @@ var CUSTOM_STYLES = {
|
|
|
1354
1337
|
input: ramda.assoc("overflow", "hidden"),
|
|
1355
1338
|
multiValue: function multiValue(styles, _ref2) {
|
|
1356
1339
|
var valid = _ref2.data.valid;
|
|
1357
|
-
return _objectSpread$
|
|
1340
|
+
return _objectSpread$6(_objectSpread$6({}, styles), {}, {
|
|
1358
1341
|
border: valid ? STYLES.border["default"] : STYLES.border.error,
|
|
1359
1342
|
color: valid ? STYLES.color["default"] : STYLES.color.error
|
|
1360
1343
|
});
|
|
@@ -1397,8 +1380,8 @@ var formatErrorMessage = function formatErrorMessage(error) {
|
|
|
1397
1380
|
};
|
|
1398
1381
|
|
|
1399
1382
|
var _excluded$2 = ["label", "value", "onChange", "error", "onBlur"];
|
|
1400
|
-
function ownKeys$
|
|
1401
|
-
function _objectSpread$
|
|
1383
|
+
function ownKeys$5(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; }
|
|
1384
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1402
1385
|
var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
1403
1386
|
var _ref$label = _ref.label,
|
|
1404
1387
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -1457,7 +1440,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1457
1440
|
"data-cy": "".concat(utils.hyphenize(label), "-input-label"),
|
|
1458
1441
|
children: label
|
|
1459
1442
|
})
|
|
1460
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$
|
|
1443
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$5({
|
|
1461
1444
|
isMulti: true,
|
|
1462
1445
|
required: true,
|
|
1463
1446
|
classNamePrefix: "neeto-ui-react-select",
|
|
@@ -1467,7 +1450,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1467
1450
|
className: classnames("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
|
|
1468
1451
|
"neeto-ui-react-select__container--error": !!error
|
|
1469
1452
|
}),
|
|
1470
|
-
styles: _objectSpread$
|
|
1453
|
+
styles: _objectSpread$5(_objectSpread$5({}, CUSTOM_STYLES), {}, {
|
|
1471
1454
|
control: ramda.mergeLeft({
|
|
1472
1455
|
maxHeight: "200px",
|
|
1473
1456
|
overflowY: "auto"
|
|
@@ -1479,7 +1462,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1479
1462
|
},
|
|
1480
1463
|
onInputChange: setInputValue,
|
|
1481
1464
|
onKeyDown: handleKeyDown
|
|
1482
|
-
}, _objectSpread$
|
|
1465
|
+
}, _objectSpread$5({
|
|
1483
1466
|
inputValue: inputValue,
|
|
1484
1467
|
isFocused: isFocused,
|
|
1485
1468
|
onChange: onChange,
|
|
@@ -1706,73 +1689,6 @@ var FileUpload = function FileUpload() {
|
|
|
1706
1689
|
});
|
|
1707
1690
|
};
|
|
1708
1691
|
|
|
1709
|
-
function ownKeys$5(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; }
|
|
1710
|
-
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1711
|
-
var defaultConfig = {
|
|
1712
|
-
strict: true,
|
|
1713
|
-
matchKey: "value"
|
|
1714
|
-
};
|
|
1715
|
-
var findOptionByValue = function findOptionByValue(value) {
|
|
1716
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1717
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1718
|
-
var configObject = _objectSpread$5(_objectSpread$5({}, defaultConfig), config);
|
|
1719
|
-
var matchKey = configObject.matchKey,
|
|
1720
|
-
strict = configObject.strict;
|
|
1721
|
-
return options.find(function (option) {
|
|
1722
|
-
return (
|
|
1723
|
-
// eslint-disable-next-line eqeqeq
|
|
1724
|
-
strict ? option[matchKey] === value : option[matchKey] == value
|
|
1725
|
-
);
|
|
1726
|
-
});
|
|
1727
|
-
};
|
|
1728
|
-
var filterOptionsByValues = function filterOptionsByValues() {
|
|
1729
|
-
var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1730
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1731
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1732
|
-
var configObject = _objectSpread$5(_objectSpread$5({}, defaultConfig), config);
|
|
1733
|
-
var matchKey = configObject.matchKey,
|
|
1734
|
-
strict = configObject.strict;
|
|
1735
|
-
return options.filter(function (option) {
|
|
1736
|
-
return values.some(function (value) {
|
|
1737
|
-
return (
|
|
1738
|
-
// eslint-disable-next-line eqeqeq
|
|
1739
|
-
strict ? option[matchKey] === value : option[matchKey] == value
|
|
1740
|
-
);
|
|
1741
|
-
});
|
|
1742
|
-
});
|
|
1743
|
-
};
|
|
1744
|
-
var destroyFromList = function destroyFromList(items, index) {
|
|
1745
|
-
var itemToRemove = items[index];
|
|
1746
|
-
if (itemToRemove) {
|
|
1747
|
-
var nextItems = _toConsumableArray(items);
|
|
1748
|
-
nextItems.splice(index, 1);
|
|
1749
|
-
if (itemToRemove.id) {
|
|
1750
|
-
nextItems.push(_objectSpread$5(_objectSpread$5({}, itemToRemove), {}, {
|
|
1751
|
-
_destroy: true
|
|
1752
|
-
}));
|
|
1753
|
-
}
|
|
1754
|
-
return nextItems;
|
|
1755
|
-
}
|
|
1756
|
-
return items;
|
|
1757
|
-
};
|
|
1758
|
-
var insertToList = function insertToList(items, item, index) {
|
|
1759
|
-
var nextItems = _toConsumableArray(items !== null && items !== void 0 ? items : []);
|
|
1760
|
-
nextItems.splice(index, 0, item);
|
|
1761
|
-
return nextItems;
|
|
1762
|
-
};
|
|
1763
|
-
var pushToList = function pushToList(items, item) {
|
|
1764
|
-
var nextItems = _toConsumableArray(items !== null && items !== void 0 ? items : []);
|
|
1765
|
-
nextItems.push(item);
|
|
1766
|
-
return nextItems;
|
|
1767
|
-
};
|
|
1768
|
-
var formHelpers = {
|
|
1769
|
-
findOptionByValue: findOptionByValue,
|
|
1770
|
-
filterOptionsByValues: filterOptionsByValues,
|
|
1771
|
-
destroyFromList: destroyFromList,
|
|
1772
|
-
insertToList: insertToList,
|
|
1773
|
-
pushToList: pushToList
|
|
1774
|
-
};
|
|
1775
|
-
|
|
1776
1692
|
function ownKeys$4(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; }
|
|
1777
1693
|
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1778
1694
|
var Options = function Options(_ref) {
|
|
@@ -1786,9 +1702,10 @@ var Options = function Options(_ref) {
|
|
|
1786
1702
|
};
|
|
1787
1703
|
}, shallow.shallow),
|
|
1788
1704
|
selectedLanguage = _useBuildFormStore.selectedLanguage;
|
|
1789
|
-
var
|
|
1790
|
-
|
|
1791
|
-
|
|
1705
|
+
var name = "optionsAttributes";
|
|
1706
|
+
var _useField = formik.useField(name),
|
|
1707
|
+
_useField2 = _slicedToArray(_useField, 3);
|
|
1708
|
+
_useField2[0];
|
|
1792
1709
|
_useField2[1];
|
|
1793
1710
|
var setOptionsAttributes = _useField2[2].setValue;
|
|
1794
1711
|
var _ref2 = questionProps || {},
|
|
@@ -1800,73 +1717,28 @@ var Options = function Options(_ref) {
|
|
|
1800
1717
|
disableAddOption = _ref2$disableAddOptio === void 0 ? false : _ref2$disableAddOptio,
|
|
1801
1718
|
_ref2$disableRemoveOp = _ref2.disableRemoveOption,
|
|
1802
1719
|
disableRemoveOption = _ref2$disableRemoveOp === void 0 ? false : _ref2$disableRemoveOp;
|
|
1803
|
-
var handleRemoveOption = function handleRemoveOption(index) {
|
|
1804
|
-
var nextOptions = formHelpers.destroyFromList(optionsAttributes, index);
|
|
1805
|
-
setOptionsAttributes(nextOptions);
|
|
1806
|
-
};
|
|
1807
1720
|
var isManageOptionDisabled = index.isFunction(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
1808
1721
|
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
1809
1722
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1810
|
-
return /*#__PURE__*/jsxRuntime.
|
|
1723
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1811
1724
|
className: "w-full",
|
|
1812
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
required: true,
|
|
1830
|
-
disabled: isManageOptionDisabled,
|
|
1831
|
-
name: "optionsAttributes.".concat(index, ".label"),
|
|
1832
|
-
placeholder: t("neetoForm.questions.common.questionFields.field.numberedOption", {
|
|
1833
|
-
number: index + 1
|
|
1834
|
-
})
|
|
1835
|
-
}), !isRemoveOptionDisabled && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
1836
|
-
"data-cy": "neeto-form-engine-delete-option-button",
|
|
1837
|
-
icon: Delete,
|
|
1838
|
-
size: "small",
|
|
1839
|
-
style: "text",
|
|
1840
|
-
className: classnames({
|
|
1841
|
-
invisible: index < constants.MINIMUM_OPTIONS
|
|
1842
|
-
}),
|
|
1843
|
-
tooltipProps: {
|
|
1844
|
-
position: "top",
|
|
1845
|
-
content: t("neetoForm.common.delete")
|
|
1846
|
-
},
|
|
1847
|
-
onClick: function onClick() {
|
|
1848
|
-
return handleRemoveOption(index);
|
|
1849
|
-
}
|
|
1850
|
-
})]
|
|
1851
|
-
}, "question-option-".concat((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : index));
|
|
1852
|
-
})
|
|
1853
|
-
}), !isAddOptionDisabled && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1854
|
-
className: "mt-3 w-full",
|
|
1855
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
1856
|
-
"data-cy": "neeto-form-engine-add-option-button",
|
|
1857
|
-
icon: Plus,
|
|
1858
|
-
iconPosition: "left",
|
|
1859
|
-
size: "small",
|
|
1860
|
-
style: "text",
|
|
1861
|
-
label: t("neetoForm.questions.common.questionFields.field.addOption"),
|
|
1862
|
-
onClick: handlePush({
|
|
1863
|
-
label: ""
|
|
1864
|
-
})
|
|
1865
|
-
})
|
|
1866
|
-
})]
|
|
1867
|
-
});
|
|
1868
|
-
}
|
|
1869
|
-
})
|
|
1725
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Label, _objectSpread$4(_objectSpread$4({
|
|
1726
|
+
className: "mb-2 block"
|
|
1727
|
+
}, optionLabelProps), {}, {
|
|
1728
|
+
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
1729
|
+
})), /*#__PURE__*/jsxRuntime.jsx(OptionFields, {
|
|
1730
|
+
name: name,
|
|
1731
|
+
shouldDestroy: true,
|
|
1732
|
+
destroyFlagName: "_destroy",
|
|
1733
|
+
disabled: isManageOptionDisabled,
|
|
1734
|
+
draggable: !isManageOptionDisabled,
|
|
1735
|
+
isAddOptionEnabled: !isAddOptionDisabled,
|
|
1736
|
+
isDeleteOptionEnabled: !isRemoveOptionDisabled,
|
|
1737
|
+
isNewItemsPrefilled: constants.isDefaultLanguage(selectedLanguage),
|
|
1738
|
+
minOptions: constants.MINIMUM_OPTIONS,
|
|
1739
|
+
shouldResetEmptyOptionOnBlur: false,
|
|
1740
|
+
onChange: setOptionsAttributes
|
|
1741
|
+
})]
|
|
1870
1742
|
});
|
|
1871
1743
|
};
|
|
1872
1744
|
|
|
@@ -2074,15 +1946,15 @@ var AddQuestion = function AddQuestion(_ref) {
|
|
|
2074
1946
|
var onAdd = _ref.onAdd,
|
|
2075
1947
|
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
|
|
2076
1948
|
isDisabled = _ref.isDisabled;
|
|
2077
|
-
var tooltipProps = buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
1949
|
+
var tooltipProps = constants.buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
2078
1950
|
return /*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread$2(_objectSpread$2({}, tooltipProps), {}, {
|
|
2079
1951
|
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2080
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$2({}, buildAddQuestionButtonProps(onAdd, isDisabled)))
|
|
1952
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$2({}, constants.buildAddQuestionButtonProps(onAdd, isDisabled)))
|
|
2081
1953
|
})
|
|
2082
1954
|
}));
|
|
2083
1955
|
};
|
|
2084
1956
|
|
|
2085
|
-
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", "questionsHelpProps"];
|
|
1957
|
+
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", "questionsHelpProps", "isUsingDefaultQuestionKinds"];
|
|
2086
1958
|
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; }
|
|
2087
1959
|
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; }
|
|
2088
1960
|
var Form = function Form(_ref) {
|
|
@@ -2114,6 +1986,7 @@ var Form = function Form(_ref) {
|
|
|
2114
1986
|
enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
2115
1987
|
helpDocUrls = _ref.helpDocUrls,
|
|
2116
1988
|
questionsHelpProps = _ref.questionsHelpProps,
|
|
1989
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds,
|
|
2117
1990
|
formDomProps = _objectWithoutProperties(_ref, _excluded);
|
|
2118
1991
|
var containerRef = React.useRef();
|
|
2119
1992
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -2163,9 +2036,10 @@ var Form = function Form(_ref) {
|
|
|
2163
2036
|
selectedLanguage: selectedLanguage,
|
|
2164
2037
|
helpDocUrls: helpDocUrls,
|
|
2165
2038
|
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2166
|
-
enableDomainWhitelisting: enableDomainWhitelisting
|
|
2039
|
+
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
2040
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
2167
2041
|
});
|
|
2168
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting]);
|
|
2042
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds]);
|
|
2169
2043
|
var questions = values.questions;
|
|
2170
2044
|
var handleSelect = function handleSelect(question) {
|
|
2171
2045
|
setSelectedQuestion(question);
|
|
@@ -2211,7 +2085,7 @@ var Form = function Form(_ref) {
|
|
|
2211
2085
|
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
|
|
2212
2086
|
});
|
|
2213
2087
|
React.useEffect(function () {
|
|
2214
|
-
onValueChange === null || onValueChange === void 0
|
|
2088
|
+
onValueChange === null || onValueChange === void 0 || onValueChange(questions);
|
|
2215
2089
|
}, [questions]);
|
|
2216
2090
|
var availableQuestionKinds = getAvailableQuestionKinds({
|
|
2217
2091
|
allQuestionKinds: questionKinds,
|
|
@@ -2400,7 +2274,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2400
2274
|
isQuestionsLoading = _ref2.isQuestionsLoading;
|
|
2401
2275
|
React.useEffect(function () {
|
|
2402
2276
|
if (data) {
|
|
2403
|
-
onUpdate === null || onUpdate === void 0
|
|
2277
|
+
onUpdate === null || onUpdate === void 0 || onUpdate(data);
|
|
2404
2278
|
}
|
|
2405
2279
|
}, [data]);
|
|
2406
2280
|
if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
|
|
@@ -2414,7 +2288,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2414
2288
|
var setSubmitting = _ref4.setSubmitting;
|
|
2415
2289
|
var payload = {
|
|
2416
2290
|
neetoFormQuestions: {
|
|
2417
|
-
questions: buildReorderPayload(questions)
|
|
2291
|
+
questions: constants.buildReorderPayload(questions)
|
|
2418
2292
|
}
|
|
2419
2293
|
};
|
|
2420
2294
|
reorderQuestions(payload, {
|
|
@@ -2438,11 +2312,12 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2438
2312
|
return ramda.concat(constants.MANDATORY_KINDS, requiredFields).includes(kind);
|
|
2439
2313
|
};
|
|
2440
2314
|
var isDisabledFieldLabel = function isDisabledFieldLabel(field) {
|
|
2441
|
-
return isImmutableField(field) || (isFieldLabelDisabled !== null && isFieldLabelDisabled !== void 0 ? isFieldLabelDisabled : ramda.F)(field);
|
|
2315
|
+
return constants.isImmutableField(field) || (isFieldLabelDisabled !== null && isFieldLabelDisabled !== void 0 ? isFieldLabelDisabled : ramda.F)(field);
|
|
2442
2316
|
};
|
|
2443
2317
|
var defaultQuestionKinds = allowAdditionalGuests ? constants.QUESTION_KINDS : neetoCist.removeBy({
|
|
2444
2318
|
type: constants$1.QUESTION_KIND.ADDITIONAL_GUESTS.value
|
|
2445
2319
|
}, constants.QUESTION_KINDS);
|
|
2320
|
+
var isUsingDefaultQuestionKinds = ramda.isNil(questionKinds);
|
|
2446
2321
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2447
2322
|
className: classnames("neeto-form-nano-form-outer-wrapper relative", className),
|
|
2448
2323
|
children: [/*#__PURE__*/jsxRuntime.jsx(formik.Formik, {
|
|
@@ -2474,6 +2349,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2474
2349
|
isKindAlreadyActive: isKindAlreadyActive,
|
|
2475
2350
|
isReordering: isReordering,
|
|
2476
2351
|
isRequiredField: isRequiredField,
|
|
2352
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2477
2353
|
kindUniqueOn: kindUniqueOn,
|
|
2478
2354
|
onLanguageChange: onLanguageChange,
|
|
2479
2355
|
onValueChange: onValueChange,
|
|
@@ -2484,7 +2360,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2484
2360
|
submitButtonProps: submitButtonProps
|
|
2485
2361
|
})), {}, {
|
|
2486
2362
|
formId: id,
|
|
2487
|
-
questionKinds:
|
|
2363
|
+
questionKinds: isUsingDefaultQuestionKinds ? defaultQuestionKinds : questionKinds,
|
|
2488
2364
|
onChange: function onChange(event) {
|
|
2489
2365
|
if (ramda.isEmpty(errors)) return;
|
|
2490
2366
|
setFieldError(event.target.name);
|