@bigbinary/neeto-form-frontend 3.9.9 → 3.10.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/dist/BuildForm.js +155 -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 +165 -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-DjiqVQzl.js → utils-7pVcPOD3.js} +26 -26
- package/dist/utils-7pVcPOD3.js.map +1 -0
- package/dist/{utils-DvTIh9-Y.js → utils-CIAVK18Y.js} +26 -26
- package/dist/utils-CIAVK18Y.js.map +1 -0
- package/package.json +56 -55
- 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;
|
|
@@ -357,7 +315,7 @@ var Card = function Card(_ref) {
|
|
|
357
315
|
})]
|
|
358
316
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
359
317
|
className: "flex items-center gap-1",
|
|
360
|
-
children: [isSmsReminderQuestion && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$
|
|
318
|
+
children: [isSmsReminderQuestion && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$f({
|
|
361
319
|
description: t("neetoForm.smsReminder.popoverDescription"),
|
|
362
320
|
popoverProps: {
|
|
363
321
|
position: "top"
|
|
@@ -396,8 +354,8 @@ var Card = function Card(_ref) {
|
|
|
396
354
|
});
|
|
397
355
|
};
|
|
398
356
|
|
|
399
|
-
function ownKeys$
|
|
400
|
-
function _objectSpread$
|
|
357
|
+
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; }
|
|
358
|
+
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
359
|
var Questions = function Questions(_ref) {
|
|
402
360
|
var questions = _ref.questions,
|
|
403
361
|
isDeletable = _ref.isDeletable,
|
|
@@ -414,7 +372,7 @@ var Questions = function Questions(_ref) {
|
|
|
414
372
|
var droppableProps = _ref2.droppableProps,
|
|
415
373
|
placeholder = _ref2.placeholder,
|
|
416
374
|
innerRef = _ref2.innerRef;
|
|
417
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$
|
|
375
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$e(_objectSpread$e({}, droppableProps), {}, {
|
|
418
376
|
className: "space-y-2",
|
|
419
377
|
ref: innerRef,
|
|
420
378
|
children: [questions.map(function (question, index) {
|
|
@@ -427,7 +385,7 @@ var Questions = function Questions(_ref) {
|
|
|
427
385
|
var draggableProps = _ref3.draggableProps,
|
|
428
386
|
dragHandleProps = _ref3.dragHandleProps,
|
|
429
387
|
innerRef = _ref3.innerRef;
|
|
430
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$
|
|
388
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$e(_objectSpread$e(_objectSpread$e({}, draggableProps), dragHandleProps), {}, {
|
|
431
389
|
ref: innerRef,
|
|
432
390
|
children: /*#__PURE__*/jsxRuntime.jsx(Card, {
|
|
433
391
|
allQuestionKinds: allQuestionKinds,
|
|
@@ -459,8 +417,8 @@ var arrayHelpers = {
|
|
|
459
417
|
moveItem: moveItem
|
|
460
418
|
};
|
|
461
419
|
|
|
462
|
-
function ownKeys$
|
|
463
|
-
function _objectSpread$
|
|
420
|
+
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; }
|
|
421
|
+
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
422
|
var isChoiceQuestion = function isChoiceQuestion(question) {
|
|
465
423
|
return ramda.includes(question === null || question === void 0 ? void 0 : question.kind, constants.SELECTABLE_KINDS);
|
|
466
424
|
};
|
|
@@ -487,12 +445,24 @@ var generateFieldCodePrefix = function generateFieldCodePrefix(label, kind) {
|
|
|
487
445
|
}
|
|
488
446
|
return addSuffixForReservedFieldCode(prefix) || "";
|
|
489
447
|
};
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
448
|
+
var modifyDefaultValues = function modifyDefaultValues(_ref) {
|
|
449
|
+
var values = _ref.values,
|
|
450
|
+
kind = _ref.kind,
|
|
451
|
+
selectedLanguage = _ref.selectedLanguage,
|
|
452
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds;
|
|
453
|
+
if (!ramda.includes(kind, constants.SELECTABLE_KINDS) || constants.isDefaultLanguage(selectedLanguage) || !isUsingDefaultQuestionKinds) {
|
|
454
|
+
return values;
|
|
455
|
+
}
|
|
456
|
+
return ramda.evolve({
|
|
457
|
+
optionsAttributes: ramda.map(ramda.assoc("label", ""))
|
|
458
|
+
}, values);
|
|
459
|
+
};
|
|
460
|
+
var generateUniqueFieldCode = function generateUniqueFieldCode(_ref2) {
|
|
461
|
+
var questions = _ref2.questions,
|
|
462
|
+
_ref2$label = _ref2.label,
|
|
463
|
+
label = _ref2$label === void 0 ? "" : _ref2$label,
|
|
464
|
+
_ref2$kind = _ref2.kind,
|
|
465
|
+
kind = _ref2$kind === void 0 ? "" : _ref2$kind;
|
|
496
466
|
var prefix = generateFieldCodePrefix(label, kind);
|
|
497
467
|
var uniqueNumber = Math.max.apply(Math, [0].concat(_toConsumableArray(getUniqueNumbersFromExistingFieldCodes(prefix, questions))));
|
|
498
468
|
var candidateFieldCode = "";
|
|
@@ -508,37 +478,45 @@ var generateUniqueFieldCode = function generateUniqueFieldCode(_ref) {
|
|
|
508
478
|
}
|
|
509
479
|
return candidateFieldCode;
|
|
510
480
|
};
|
|
511
|
-
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(
|
|
512
|
-
var activeQuestions =
|
|
513
|
-
kind =
|
|
481
|
+
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(_ref3) {
|
|
482
|
+
var activeQuestions = _ref3.activeQuestions,
|
|
483
|
+
kind = _ref3.kind;
|
|
514
484
|
return activeQuestions.some(function (activeQuestion) {
|
|
515
485
|
return activeQuestion.kind === kind.type && activeQuestion._destroy !== true;
|
|
516
486
|
});
|
|
517
487
|
};
|
|
518
|
-
var handleFieldDragEnd = function handleFieldDragEnd(
|
|
519
|
-
var items =
|
|
520
|
-
setValue =
|
|
521
|
-
source =
|
|
522
|
-
destination =
|
|
488
|
+
var handleFieldDragEnd = function handleFieldDragEnd(_ref4) {
|
|
489
|
+
var items = _ref4.items,
|
|
490
|
+
setValue = _ref4.setValue,
|
|
491
|
+
source = _ref4.source,
|
|
492
|
+
destination = _ref4.destination;
|
|
523
493
|
if (!(destination && items instanceof Array)) return;
|
|
524
494
|
var nextItems = _toConsumableArray(items);
|
|
525
495
|
arrayHelpers.moveItem(nextItems, source.index, destination.index);
|
|
526
496
|
var orderedItems = nextItems.map(function (item, index) {
|
|
527
|
-
return _objectSpread$
|
|
497
|
+
return _objectSpread$d(_objectSpread$d({}, item), {}, {
|
|
528
498
|
displayOrder: index
|
|
529
499
|
});
|
|
530
500
|
});
|
|
531
501
|
setValue("questions", orderedItems);
|
|
532
502
|
};
|
|
533
|
-
var createFieldData = function createFieldData(
|
|
534
|
-
var
|
|
535
|
-
defaults =
|
|
536
|
-
type =
|
|
537
|
-
metadata =
|
|
538
|
-
|
|
539
|
-
isRequired =
|
|
540
|
-
questions =
|
|
541
|
-
|
|
503
|
+
var createFieldData = function createFieldData(_ref5) {
|
|
504
|
+
var _ref5$kind = _ref5.kind,
|
|
505
|
+
defaults = _ref5$kind.defaults,
|
|
506
|
+
type = _ref5$kind.type,
|
|
507
|
+
metadata = _ref5$kind.metadata,
|
|
508
|
+
_ref5$isRequired = _ref5.isRequired,
|
|
509
|
+
isRequired = _ref5$isRequired === void 0 ? undefined : _ref5$isRequired,
|
|
510
|
+
questions = _ref5.questions,
|
|
511
|
+
selectedLanguage = _ref5.selectedLanguage,
|
|
512
|
+
isUsingDefaultQuestionKinds = _ref5.isUsingDefaultQuestionKinds;
|
|
513
|
+
var modifiedDefaultValues = modifyDefaultValues({
|
|
514
|
+
values: defaults,
|
|
515
|
+
kind: type,
|
|
516
|
+
selectedLanguage: selectedLanguage,
|
|
517
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
518
|
+
});
|
|
519
|
+
return _objectSpread$d(_objectSpread$d({}, modifiedDefaultValues), {}, {
|
|
542
520
|
metadata: metadata,
|
|
543
521
|
isRequired: isRequired,
|
|
544
522
|
kind: type,
|
|
@@ -550,10 +528,10 @@ var createFieldData = function createFieldData(_ref4) {
|
|
|
550
528
|
})
|
|
551
529
|
});
|
|
552
530
|
};
|
|
553
|
-
var duplicateFieldData = function duplicateFieldData(
|
|
554
|
-
var item =
|
|
555
|
-
questionKinds =
|
|
556
|
-
questions =
|
|
531
|
+
var duplicateFieldData = function duplicateFieldData(_ref6) {
|
|
532
|
+
var item = _ref6.item,
|
|
533
|
+
questionKinds = _ref6.questionKinds,
|
|
534
|
+
questions = _ref6.questions;
|
|
557
535
|
var isRequired = item.isRequired,
|
|
558
536
|
kind = item.kind,
|
|
559
537
|
optionsAttributes = item.optionsAttributes;
|
|
@@ -563,10 +541,10 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
563
541
|
var label = index.fieldWithFallback(item, "label");
|
|
564
542
|
var defaultAttributeNames = ramda.keys(questionKind.defaults || {});
|
|
565
543
|
var defaultAttributes = ramda.pick(defaultAttributeNames, item);
|
|
566
|
-
var newQuestionLabel = isRichTextQuestion(kind) ? label : i18next.t("neetoForm.common.clonedElementLabel", {
|
|
544
|
+
var newQuestionLabel = constants.isRichTextQuestion(kind) ? label : i18next.t("neetoForm.common.clonedElementLabel", {
|
|
567
545
|
label: label
|
|
568
546
|
});
|
|
569
|
-
return _objectSpread$
|
|
547
|
+
return _objectSpread$d(_objectSpread$d({}, defaultAttributes), {}, {
|
|
570
548
|
isRequired: isRequired,
|
|
571
549
|
kind: kind,
|
|
572
550
|
label: newQuestionLabel,
|
|
@@ -580,15 +558,15 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
580
558
|
displayOrder: item.displayOrder + 1
|
|
581
559
|
});
|
|
582
560
|
};
|
|
583
|
-
var getAvailableQuestionKinds = function getAvailableQuestionKinds(
|
|
584
|
-
var allQuestionKinds =
|
|
585
|
-
|
|
586
|
-
activeQuestions =
|
|
587
|
-
isKindAlreadyActive =
|
|
561
|
+
var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref7) {
|
|
562
|
+
var allQuestionKinds = _ref7.allQuestionKinds,
|
|
563
|
+
_ref7$activeQuestions = _ref7.activeQuestions,
|
|
564
|
+
activeQuestions = _ref7$activeQuestions === void 0 ? [] : _ref7$activeQuestions,
|
|
565
|
+
isKindAlreadyActive = _ref7.isKindAlreadyActive;
|
|
588
566
|
if (ramda.isEmpty(activeQuestions)) return allQuestionKinds;
|
|
589
567
|
return ramda.reject(function (kind) {
|
|
590
568
|
var isSingularKind = kind.isSingular;
|
|
591
|
-
return isAutoGeneratedQuestion(kind.type) || isSingularKind && isKindAlreadyActive({
|
|
569
|
+
return constants.isAutoGeneratedQuestion(kind.type) || isSingularKind && isKindAlreadyActive({
|
|
592
570
|
activeQuestions: activeQuestions,
|
|
593
571
|
kind: kind
|
|
594
572
|
});
|
|
@@ -602,14 +580,14 @@ var AddFirstQuestion = function AddFirstQuestion(_ref) {
|
|
|
602
580
|
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps;
|
|
603
581
|
var _useTranslation = reactI18next.useTranslation(),
|
|
604
582
|
t = _useTranslation.t;
|
|
605
|
-
var tooltipProps = buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
583
|
+
var tooltipProps = constants.buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
606
584
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
607
585
|
className: "flex h-full flex-col items-center justify-center py-8",
|
|
608
586
|
children: /*#__PURE__*/jsxRuntime.jsx(NoData, {
|
|
609
587
|
showTooltipWhenButtonDisabled: true,
|
|
610
588
|
className: "min-h-80",
|
|
611
589
|
title: t("neetoForm.questions.common.noData"),
|
|
612
|
-
primaryButtonProps: buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps)
|
|
590
|
+
primaryButtonProps: constants.buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps)
|
|
613
591
|
})
|
|
614
592
|
});
|
|
615
593
|
};
|
|
@@ -650,8 +628,8 @@ var INITIAL_VALUES = {
|
|
|
650
628
|
var VALID_FIELD_CODE_REGEX = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
651
629
|
|
|
652
630
|
var _excluded$8 = ["label", "name"];
|
|
653
|
-
function ownKeys$
|
|
654
|
-
function _objectSpread$
|
|
631
|
+
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; }
|
|
632
|
+
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
633
|
var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
656
634
|
var label = _ref.label,
|
|
657
635
|
name = _ref.name,
|
|
@@ -670,7 +648,7 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
670
648
|
var end = element.value.length;
|
|
671
649
|
element.setSelectionRange(end, end);
|
|
672
650
|
};
|
|
673
|
-
return /*#__PURE__*/jsxRuntime.jsx(Textarea, _objectSpread$
|
|
651
|
+
return /*#__PURE__*/jsxRuntime.jsx(Textarea, _objectSpread$c({
|
|
674
652
|
label: label,
|
|
675
653
|
name: name,
|
|
676
654
|
className: "neeto-form-nano-adaptive-input",
|
|
@@ -736,8 +714,8 @@ var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
|
|
|
736
714
|
return store.formState.richTextFieldsToReset.includes(fieldCode);
|
|
737
715
|
});
|
|
738
716
|
var setEditorContent = function setEditorContent(content) {
|
|
739
|
-
var _editorRef$current$ed
|
|
740
|
-
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0
|
|
717
|
+
var _editorRef$current$ed;
|
|
718
|
+
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
719
|
};
|
|
742
720
|
if (shouldReset) {
|
|
743
721
|
setEditorContent(initialValue);
|
|
@@ -778,7 +756,7 @@ var Editor = function Editor() {
|
|
|
778
756
|
var fieldName = "label";
|
|
779
757
|
var _useField = formik.useField({
|
|
780
758
|
name: fieldName,
|
|
781
|
-
validate: validateEditorContent(editorRef)
|
|
759
|
+
validate: constants.validateEditorContent(editorRef)
|
|
782
760
|
}),
|
|
783
761
|
_useField2 = _slicedToArray(_useField, 3),
|
|
784
762
|
value = _useField2[0].value,
|
|
@@ -825,8 +803,8 @@ var RequiredSwitch = reactUtils.withT(function (_ref) {
|
|
|
825
803
|
});
|
|
826
804
|
|
|
827
805
|
var _excluded$7 = ["maxLength"];
|
|
828
|
-
function ownKeys$
|
|
829
|
-
function _objectSpread$
|
|
806
|
+
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; }
|
|
807
|
+
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
808
|
var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
831
809
|
var maxLength = _ref.maxLength,
|
|
832
810
|
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
@@ -840,7 +818,7 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
|
840
818
|
}
|
|
841
819
|
}, [value, maxLength, setValue]);
|
|
842
820
|
var shouldShowMaxLength = value && value.length > maxLength - 10;
|
|
843
|
-
return /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$
|
|
821
|
+
return /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$b(_objectSpread$b({}, props), shouldShowMaxLength && {
|
|
844
822
|
maxLength: maxLength
|
|
845
823
|
}));
|
|
846
824
|
};
|
|
@@ -897,14 +875,18 @@ var Form$1 = function Form(_ref) {
|
|
|
897
875
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
898
876
|
var hideQuestionHelpDoc = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", "hideQuestion"]));
|
|
899
877
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
900
|
-
var _store$formState, _store$formState2;
|
|
878
|
+
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
901
879
|
return {
|
|
902
880
|
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"]
|
|
881
|
+
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"],
|
|
882
|
+
selectedLanguage: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["selectedLanguage"],
|
|
883
|
+
isUsingDefaultQuestionKinds: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["isUsingDefaultQuestionKinds"]
|
|
904
884
|
};
|
|
905
885
|
}, shallow.shallow),
|
|
906
886
|
enableDomainWhitelisting = _useBuildFormStore.enableDomainWhitelisting,
|
|
907
|
-
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting
|
|
887
|
+
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting,
|
|
888
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
889
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
908
890
|
var kind = values.kind;
|
|
909
891
|
var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
|
|
910
892
|
var questionKindUniquenessPattern = ramda.mergeLeft(isEdit && additionalQuestionKindPattern ? additionalQuestionKindPattern(values) : {}, {
|
|
@@ -921,7 +903,7 @@ var Form$1 = function Form(_ref) {
|
|
|
921
903
|
questionProps = _ref2$questionProps === void 0 ? {} : _ref2$questionProps;
|
|
922
904
|
var isRequired = questionKind && isRequiredField(questionKind);
|
|
923
905
|
var isLabelDisabled = questionKind && isDisabledFieldLabel(questionKind);
|
|
924
|
-
var isImmutable = questionKind && isImmutableField(questionKind);
|
|
906
|
+
var isImmutable = questionKind && constants.isImmutableField(questionKind);
|
|
925
907
|
var shouldShowPlaceholder = ramda.includes(kind, QUESTIONS_WITH_PLACEHOLDERS);
|
|
926
908
|
var hasAdditionalData = ramda.includes(kind, QUESTIONS_WITH_ADDITIONAL_DATA);
|
|
927
909
|
var shouldShowFieldCode = enableFieldCode && !ramda.includes(kind, constants.QUESTIONS_WITHOUT_FIELD_CODE);
|
|
@@ -945,7 +927,9 @@ var Form$1 = function Form(_ref) {
|
|
|
945
927
|
return createFieldData({
|
|
946
928
|
kind: questionKind,
|
|
947
929
|
isRequired: isRequired,
|
|
948
|
-
questions: questions
|
|
930
|
+
questions: questions,
|
|
931
|
+
selectedLanguage: selectedLanguage,
|
|
932
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
949
933
|
});
|
|
950
934
|
};
|
|
951
935
|
var updateFormState = function updateFormState(data) {
|
|
@@ -976,7 +960,7 @@ var Form$1 = function Form(_ref) {
|
|
|
976
960
|
options: buildKindOptions(questionKinds),
|
|
977
961
|
label: t("neetoForm.questions.common.questionFields.field.questionType"),
|
|
978
962
|
onChange: handleKindChange
|
|
979
|
-
}), isRichTextQuestion(kind) ? /*#__PURE__*/jsxRuntime.jsx(Editor, {
|
|
963
|
+
}), constants.isRichTextQuestion(kind) ? /*#__PURE__*/jsxRuntime.jsx(Editor, {
|
|
980
964
|
isLabelDisabled: isLabelDisabled
|
|
981
965
|
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
982
966
|
className: "space-y-6",
|
|
@@ -1045,15 +1029,13 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1045
1029
|
fieldCode: yup__namespace.string().trim().notOneOf(constants.RESERVED_FIELD_CODES, i18next.t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
|
|
1046
1030
|
return enableFieldCode && !ramda.includes(kind, constants.QUESTIONS_WITHOUT_FIELD_CODE) ? fieldCodeValidation(schema, i18next.t("neetoForm.questions.common.questionFields.field.fieldCode")) : schema.notRequired();
|
|
1047
1031
|
}),
|
|
1048
|
-
optionsAttributes: yup__namespace.array().when("
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1032
|
+
optionsAttributes: yup__namespace.array().when("kind", function (kind, schema) {
|
|
1033
|
+
return ramda.includes(kind, constants.SELECTABLE_KINDS) ? schema.of(yup__namespace.object().shape({
|
|
1034
|
+
label: yup__namespace.string().when("_destroy", {
|
|
1035
|
+
is: true,
|
|
1036
|
+
otherwise: requiredLabelValidation(yup__namespace.string(), i18next.t("neetoForm.questions.common.questionFields.field.option"))
|
|
1037
|
+
})
|
|
1038
|
+
})) : schema.notRequired();
|
|
1057
1039
|
}),
|
|
1058
1040
|
highestRatingLabel: yup__namespace.string().nullable(),
|
|
1059
1041
|
averageRatingLabel: yup__namespace.string().nullable(),
|
|
@@ -1062,8 +1044,8 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1062
1044
|
};
|
|
1063
1045
|
|
|
1064
1046
|
var _excluded$6 = ["question", "onClose", "questions", "handleSelect", "buildRequestArgs", "isOpen"];
|
|
1065
|
-
function ownKeys$
|
|
1066
|
-
function _objectSpread$
|
|
1047
|
+
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; }
|
|
1048
|
+
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
1049
|
var Add = function Add(_ref) {
|
|
1068
1050
|
var question = _ref.question,
|
|
1069
1051
|
onClose = _ref.onClose,
|
|
@@ -1094,7 +1076,7 @@ var Add = function Add(_ref) {
|
|
|
1094
1076
|
var handleSubmit = function handleSubmit(values) {
|
|
1095
1077
|
if (isCreating || !isOpen) return;
|
|
1096
1078
|
var displayOrder = question ? question.displayOrder + 1 : questions.length;
|
|
1097
|
-
createQuestion(_objectSpread$
|
|
1079
|
+
createQuestion(_objectSpread$a({
|
|
1098
1080
|
language: language,
|
|
1099
1081
|
neetoFormQuestion: ramda.mergeLeft({
|
|
1100
1082
|
displayOrder: displayOrder
|
|
@@ -1123,7 +1105,7 @@ var Add = function Add(_ref) {
|
|
|
1123
1105
|
onSubmit: handleSubmit
|
|
1124
1106
|
},
|
|
1125
1107
|
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1126
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$
|
|
1108
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$a({}, _objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
1127
1109
|
question: question,
|
|
1128
1110
|
questions: questions
|
|
1129
1111
|
}))), /*#__PURE__*/jsxRuntime.jsx(Pane.Footer, {
|
|
@@ -1140,8 +1122,8 @@ var Add = function Add(_ref) {
|
|
|
1140
1122
|
};
|
|
1141
1123
|
|
|
1142
1124
|
var _excluded$5 = ["question", "isOpen", "onClose"];
|
|
1143
|
-
function ownKeys$
|
|
1144
|
-
function _objectSpread$
|
|
1125
|
+
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; }
|
|
1126
|
+
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
1127
|
var Edit = function Edit(_ref) {
|
|
1146
1128
|
var question = _ref.question,
|
|
1147
1129
|
isOpen = _ref.isOpen,
|
|
@@ -1193,7 +1175,7 @@ var Edit = function Edit(_ref) {
|
|
|
1193
1175
|
onSubmit: handleSubmit
|
|
1194
1176
|
},
|
|
1195
1177
|
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1196
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$
|
|
1178
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$9(_objectSpread$9({}, _objectSpread$9({
|
|
1197
1179
|
question: question
|
|
1198
1180
|
}, props)), {}, {
|
|
1199
1181
|
isEdit: true
|
|
@@ -1229,8 +1211,8 @@ var Captcha = reactUtils.withT(function (_ref) {
|
|
|
1229
1211
|
});
|
|
1230
1212
|
|
|
1231
1213
|
var _excluded$4 = ["name", "title", "className"];
|
|
1232
|
-
function ownKeys$
|
|
1233
|
-
function _objectSpread$
|
|
1214
|
+
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; }
|
|
1215
|
+
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
1216
|
var SwitchBlock = function SwitchBlock(_ref) {
|
|
1235
1217
|
var name = _ref.name,
|
|
1236
1218
|
title = _ref.title,
|
|
@@ -1240,7 +1222,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1240
1222
|
return /*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
1241
1223
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1242
1224
|
"data-cy": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-toggle-label"),
|
|
1243
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$
|
|
1225
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$8(_objectSpread$8({}, _objectSpread$8(_objectSpread$8({}, otherProps), {}, {
|
|
1244
1226
|
name: name
|
|
1245
1227
|
})), {}, {
|
|
1246
1228
|
"data-cy": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-switch")
|
|
@@ -1252,15 +1234,15 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1252
1234
|
});
|
|
1253
1235
|
};
|
|
1254
1236
|
|
|
1255
|
-
function ownKeys$
|
|
1256
|
-
function _objectSpread$
|
|
1237
|
+
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; }
|
|
1238
|
+
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
1239
|
var TitleWithHelpPopover = function TitleWithHelpPopover(_ref) {
|
|
1258
1240
|
var title = _ref.title,
|
|
1259
1241
|
description = _ref.description,
|
|
1260
1242
|
helpLink = _ref.helpLink;
|
|
1261
1243
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1262
1244
|
className: "flex gap-2",
|
|
1263
|
-
children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$
|
|
1245
|
+
children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$7({
|
|
1264
1246
|
description: description,
|
|
1265
1247
|
popoverProps: {
|
|
1266
1248
|
position: "top"
|
|
@@ -1287,8 +1269,8 @@ var DOMAIN_RESTRICTION_TRANSLATIONS = {
|
|
|
1287
1269
|
};
|
|
1288
1270
|
|
|
1289
1271
|
var _excluded$3 = ["children"];
|
|
1290
|
-
function ownKeys$
|
|
1291
|
-
function _objectSpread$
|
|
1272
|
+
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; }
|
|
1273
|
+
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
1274
|
var STYLES = {
|
|
1293
1275
|
border: {
|
|
1294
1276
|
"default": "1px solid rgb(var(--neeto-ui-gray-400))",
|
|
@@ -1300,8 +1282,8 @@ var STYLES = {
|
|
|
1300
1282
|
}
|
|
1301
1283
|
};
|
|
1302
1284
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1303
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$
|
|
1304
|
-
innerProps: _objectSpread$
|
|
1285
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1286
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(utils.hyphenize(props.data.label), "-remove-icon"))),
|
|
1305
1287
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1306
1288
|
size: 16
|
|
1307
1289
|
})
|
|
@@ -1321,8 +1303,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1321
1303
|
firstChild = _children[0],
|
|
1322
1304
|
rest = _children.slice(1);
|
|
1323
1305
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1324
|
-
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$
|
|
1325
|
-
innerProps: _objectSpread$
|
|
1306
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1307
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
|
|
1326
1308
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
1327
1309
|
style: "secondary",
|
|
1328
1310
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1332,8 +1314,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1332
1314
|
}));
|
|
1333
1315
|
};
|
|
1334
1316
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1335
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$
|
|
1336
|
-
innerProps: _objectSpread$
|
|
1317
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1318
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
|
|
1337
1319
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1338
1320
|
className: "cursor-pointer",
|
|
1339
1321
|
size: 16
|
|
@@ -1354,7 +1336,7 @@ var CUSTOM_STYLES = {
|
|
|
1354
1336
|
input: ramda.assoc("overflow", "hidden"),
|
|
1355
1337
|
multiValue: function multiValue(styles, _ref2) {
|
|
1356
1338
|
var valid = _ref2.data.valid;
|
|
1357
|
-
return _objectSpread$
|
|
1339
|
+
return _objectSpread$6(_objectSpread$6({}, styles), {}, {
|
|
1358
1340
|
border: valid ? STYLES.border["default"] : STYLES.border.error,
|
|
1359
1341
|
color: valid ? STYLES.color["default"] : STYLES.color.error
|
|
1360
1342
|
});
|
|
@@ -1397,8 +1379,8 @@ var formatErrorMessage = function formatErrorMessage(error) {
|
|
|
1397
1379
|
};
|
|
1398
1380
|
|
|
1399
1381
|
var _excluded$2 = ["label", "value", "onChange", "error", "onBlur"];
|
|
1400
|
-
function ownKeys$
|
|
1401
|
-
function _objectSpread$
|
|
1382
|
+
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; }
|
|
1383
|
+
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
1384
|
var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
1403
1385
|
var _ref$label = _ref.label,
|
|
1404
1386
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -1457,7 +1439,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1457
1439
|
"data-cy": "".concat(utils.hyphenize(label), "-input-label"),
|
|
1458
1440
|
children: label
|
|
1459
1441
|
})
|
|
1460
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$
|
|
1442
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$5({
|
|
1461
1443
|
isMulti: true,
|
|
1462
1444
|
required: true,
|
|
1463
1445
|
classNamePrefix: "neeto-ui-react-select",
|
|
@@ -1467,7 +1449,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1467
1449
|
className: classnames("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
|
|
1468
1450
|
"neeto-ui-react-select__container--error": !!error
|
|
1469
1451
|
}),
|
|
1470
|
-
styles: _objectSpread$
|
|
1452
|
+
styles: _objectSpread$5(_objectSpread$5({}, CUSTOM_STYLES), {}, {
|
|
1471
1453
|
control: ramda.mergeLeft({
|
|
1472
1454
|
maxHeight: "200px",
|
|
1473
1455
|
overflowY: "auto"
|
|
@@ -1479,7 +1461,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1479
1461
|
},
|
|
1480
1462
|
onInputChange: setInputValue,
|
|
1481
1463
|
onKeyDown: handleKeyDown
|
|
1482
|
-
}, _objectSpread$
|
|
1464
|
+
}, _objectSpread$5({
|
|
1483
1465
|
inputValue: inputValue,
|
|
1484
1466
|
isFocused: isFocused,
|
|
1485
1467
|
onChange: onChange,
|
|
@@ -1706,73 +1688,6 @@ var FileUpload = function FileUpload() {
|
|
|
1706
1688
|
});
|
|
1707
1689
|
};
|
|
1708
1690
|
|
|
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
1691
|
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
1692
|
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
1693
|
var Options = function Options(_ref) {
|
|
@@ -1786,9 +1701,10 @@ var Options = function Options(_ref) {
|
|
|
1786
1701
|
};
|
|
1787
1702
|
}, shallow.shallow),
|
|
1788
1703
|
selectedLanguage = _useBuildFormStore.selectedLanguage;
|
|
1789
|
-
var
|
|
1790
|
-
|
|
1791
|
-
|
|
1704
|
+
var name = "optionsAttributes";
|
|
1705
|
+
var _useField = formik.useField(name),
|
|
1706
|
+
_useField2 = _slicedToArray(_useField, 3);
|
|
1707
|
+
_useField2[0];
|
|
1792
1708
|
_useField2[1];
|
|
1793
1709
|
var setOptionsAttributes = _useField2[2].setValue;
|
|
1794
1710
|
var _ref2 = questionProps || {},
|
|
@@ -1800,73 +1716,28 @@ var Options = function Options(_ref) {
|
|
|
1800
1716
|
disableAddOption = _ref2$disableAddOptio === void 0 ? false : _ref2$disableAddOptio,
|
|
1801
1717
|
_ref2$disableRemoveOp = _ref2.disableRemoveOption,
|
|
1802
1718
|
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
1719
|
var isManageOptionDisabled = index.isFunction(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
1808
1720
|
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
1809
1721
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1810
|
-
return /*#__PURE__*/jsxRuntime.
|
|
1722
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1811
1723
|
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
|
-
})
|
|
1724
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Label, _objectSpread$4(_objectSpread$4({
|
|
1725
|
+
className: "mb-2 block"
|
|
1726
|
+
}, optionLabelProps), {}, {
|
|
1727
|
+
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
1728
|
+
})), /*#__PURE__*/jsxRuntime.jsx(OptionFields, {
|
|
1729
|
+
name: name,
|
|
1730
|
+
shouldDestroy: true,
|
|
1731
|
+
destroyFlagName: "_destroy",
|
|
1732
|
+
disabled: isManageOptionDisabled,
|
|
1733
|
+
draggable: !isManageOptionDisabled,
|
|
1734
|
+
isAddOptionEnabled: !isAddOptionDisabled,
|
|
1735
|
+
isDeleteOptionEnabled: !isRemoveOptionDisabled,
|
|
1736
|
+
isNewItemsPrefilled: constants.isDefaultLanguage(selectedLanguage),
|
|
1737
|
+
minOptions: constants.MINIMUM_OPTIONS,
|
|
1738
|
+
shouldResetEmptyOptionOnBlur: false,
|
|
1739
|
+
onChange: setOptionsAttributes
|
|
1740
|
+
})]
|
|
1870
1741
|
});
|
|
1871
1742
|
};
|
|
1872
1743
|
|
|
@@ -2074,15 +1945,15 @@ var AddQuestion = function AddQuestion(_ref) {
|
|
|
2074
1945
|
var onAdd = _ref.onAdd,
|
|
2075
1946
|
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
|
|
2076
1947
|
isDisabled = _ref.isDisabled;
|
|
2077
|
-
var tooltipProps = buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
1948
|
+
var tooltipProps = constants.buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
2078
1949
|
return /*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread$2(_objectSpread$2({}, tooltipProps), {}, {
|
|
2079
1950
|
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2080
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$2({}, buildAddQuestionButtonProps(onAdd, isDisabled)))
|
|
1951
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$2({}, constants.buildAddQuestionButtonProps(onAdd, isDisabled)))
|
|
2081
1952
|
})
|
|
2082
1953
|
}));
|
|
2083
1954
|
};
|
|
2084
1955
|
|
|
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"];
|
|
1956
|
+
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
1957
|
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
1958
|
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
1959
|
var Form = function Form(_ref) {
|
|
@@ -2114,6 +1985,7 @@ var Form = function Form(_ref) {
|
|
|
2114
1985
|
enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
2115
1986
|
helpDocUrls = _ref.helpDocUrls,
|
|
2116
1987
|
questionsHelpProps = _ref.questionsHelpProps,
|
|
1988
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds,
|
|
2117
1989
|
formDomProps = _objectWithoutProperties(_ref, _excluded);
|
|
2118
1990
|
var containerRef = React.useRef();
|
|
2119
1991
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -2163,9 +2035,10 @@ var Form = function Form(_ref) {
|
|
|
2163
2035
|
selectedLanguage: selectedLanguage,
|
|
2164
2036
|
helpDocUrls: helpDocUrls,
|
|
2165
2037
|
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2166
|
-
enableDomainWhitelisting: enableDomainWhitelisting
|
|
2038
|
+
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
2039
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
2167
2040
|
});
|
|
2168
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting]);
|
|
2041
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds]);
|
|
2169
2042
|
var questions = values.questions;
|
|
2170
2043
|
var handleSelect = function handleSelect(question) {
|
|
2171
2044
|
setSelectedQuestion(question);
|
|
@@ -2211,7 +2084,7 @@ var Form = function Form(_ref) {
|
|
|
2211
2084
|
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
|
|
2212
2085
|
});
|
|
2213
2086
|
React.useEffect(function () {
|
|
2214
|
-
onValueChange === null || onValueChange === void 0
|
|
2087
|
+
onValueChange === null || onValueChange === void 0 || onValueChange(questions);
|
|
2215
2088
|
}, [questions]);
|
|
2216
2089
|
var availableQuestionKinds = getAvailableQuestionKinds({
|
|
2217
2090
|
allQuestionKinds: questionKinds,
|
|
@@ -2400,7 +2273,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2400
2273
|
isQuestionsLoading = _ref2.isQuestionsLoading;
|
|
2401
2274
|
React.useEffect(function () {
|
|
2402
2275
|
if (data) {
|
|
2403
|
-
onUpdate === null || onUpdate === void 0
|
|
2276
|
+
onUpdate === null || onUpdate === void 0 || onUpdate(data);
|
|
2404
2277
|
}
|
|
2405
2278
|
}, [data]);
|
|
2406
2279
|
if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
|
|
@@ -2414,7 +2287,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2414
2287
|
var setSubmitting = _ref4.setSubmitting;
|
|
2415
2288
|
var payload = {
|
|
2416
2289
|
neetoFormQuestions: {
|
|
2417
|
-
questions: buildReorderPayload(questions)
|
|
2290
|
+
questions: constants.buildReorderPayload(questions)
|
|
2418
2291
|
}
|
|
2419
2292
|
};
|
|
2420
2293
|
reorderQuestions(payload, {
|
|
@@ -2438,11 +2311,12 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2438
2311
|
return ramda.concat(constants.MANDATORY_KINDS, requiredFields).includes(kind);
|
|
2439
2312
|
};
|
|
2440
2313
|
var isDisabledFieldLabel = function isDisabledFieldLabel(field) {
|
|
2441
|
-
return isImmutableField(field) || (isFieldLabelDisabled !== null && isFieldLabelDisabled !== void 0 ? isFieldLabelDisabled : ramda.F)(field);
|
|
2314
|
+
return constants.isImmutableField(field) || (isFieldLabelDisabled !== null && isFieldLabelDisabled !== void 0 ? isFieldLabelDisabled : ramda.F)(field);
|
|
2442
2315
|
};
|
|
2443
2316
|
var defaultQuestionKinds = allowAdditionalGuests ? constants.QUESTION_KINDS : neetoCist.removeBy({
|
|
2444
2317
|
type: constants$1.QUESTION_KIND.ADDITIONAL_GUESTS.value
|
|
2445
2318
|
}, constants.QUESTION_KINDS);
|
|
2319
|
+
var isUsingDefaultQuestionKinds = ramda.isNil(questionKinds);
|
|
2446
2320
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2447
2321
|
className: classnames("neeto-form-nano-form-outer-wrapper relative", className),
|
|
2448
2322
|
children: [/*#__PURE__*/jsxRuntime.jsx(formik.Formik, {
|
|
@@ -2474,6 +2348,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2474
2348
|
isKindAlreadyActive: isKindAlreadyActive,
|
|
2475
2349
|
isReordering: isReordering,
|
|
2476
2350
|
isRequiredField: isRequiredField,
|
|
2351
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2477
2352
|
kindUniqueOn: kindUniqueOn,
|
|
2478
2353
|
onLanguageChange: onLanguageChange,
|
|
2479
2354
|
onValueChange: onValueChange,
|
|
@@ -2484,7 +2359,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2484
2359
|
submitButtonProps: submitButtonProps
|
|
2485
2360
|
})), {}, {
|
|
2486
2361
|
formId: id,
|
|
2487
|
-
questionKinds:
|
|
2362
|
+
questionKinds: isUsingDefaultQuestionKinds ? defaultQuestionKinds : questionKinds,
|
|
2488
2363
|
onChange: function onChange(event) {
|
|
2489
2364
|
if (ramda.isEmpty(errors)) return;
|
|
2490
2365
|
setFieldError(event.target.name);
|