@bigbinary/neeto-form-frontend 3.9.8 → 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/app/javascript/src/translations/en.json +2 -2
- 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-CTksPRTK.js → constants-AohkxnRH.js} +79 -29
- package/dist/constants-AohkxnRH.js.map +1 -0
- package/dist/{constants-DJU-cGmW.js → constants-CCpt0hVT.js} +84 -27
- 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-DFVwFXit.js → utils-7pVcPOD3.js} +26 -26
- package/dist/utils-7pVcPOD3.js.map +1 -0
- package/dist/{utils-j65yuCTn.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-CTksPRTK.js.map +0 -1
- package/dist/constants-DJU-cGmW.js.map +0 -1
- package/dist/useFormApi-BS-TCKwR.js.map +0 -1
- package/dist/useFormApi-DAiOGCeD.js.map +0 -1
- package/dist/utils-DFVwFXit.js.map +0 -1
- package/dist/utils-j65yuCTn.js.map +0 -1
package/dist/BuildForm.js
CHANGED
|
@@ -2,14 +2,14 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import { useState, useRef, useEffect, createElement } from 'react';
|
|
3
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { useFormikContext, useField,
|
|
5
|
+
import { useFormikContext, useField, Form as Form$3, Formik } from 'formik';
|
|
6
6
|
import { isPresent, truncate, findBy, isNotPresent, slugify, hyphenate, noop, nullSafe, filterBy, removeBy } from '@bigbinary/neeto-cist';
|
|
7
7
|
import { showThumbsUpToastr, withEventTargetValue, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
8
8
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
9
|
-
import { equals,
|
|
10
|
-
import { h as useDeleteQuestion, i as useFetchQuestions, j as useCreateQuestion, k as useUpdateQuestion, l as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-
|
|
9
|
+
import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, modify, without, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, difference, prop, split, last, __, concat, F } from 'ramda';
|
|
10
|
+
import { h as useDeleteQuestion, i as useFetchQuestions, j as useCreateQuestion, k as useUpdateQuestion, l as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-DtoxIPE7.js';
|
|
11
11
|
import { Q as QUESTION_KIND } from './constants-DlRX5mcQ.js';
|
|
12
|
-
import { I as INDEPENDENT_LABELS_MAP,
|
|
12
|
+
import { I as INDEPENDENT_LABELS_MAP, i as isRichTextQuestion, h as htmlToPlainText, a as isElementOverflowing, D as Drag, b as QUESTION_TYPES, S as SELECTABLE_KINDS, c as isAutoGeneratedQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, R as RESERVED_FIELD_CODES, d as isDefaultLanguage, e as buildDisabledAddButtonTooltipProps, f as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, j as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, k as NON_HIDEABLE_FIELDS, l as RICH_TEXT_QUESTIONS, C as CAPTCHA_TYPES, m as FILE_TYPES_MAP, n as FILE_GROUPS, M as MINIMUM_OPTIONS, o as RATING_OPTIONS, p as STAR_RATING_MIN_VALUE_OPTIONS, q as STAR_RATING_MAX_VALUE_OPTIONS, r as STAR_RATING_ICONS_MAP, s as QUESTION_ACTIONS, t as QUESTION_KINDS, u as getActiveQuestionKindDetails, w as DEFAULT_AVAILABLE_LANGUAGES, x as QUESTIONS_INITIAL_VALUE, y as buildReorderPayload, z as IMMUTABLE_KINDS, A as MANDATORY_KINDS } from './constants-AohkxnRH.js';
|
|
13
13
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
14
14
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
15
15
|
import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
|
|
@@ -17,7 +17,7 @@ import { isMetaKeyPressed, withT, useStateWithDependency, useOnClickOutside } fr
|
|
|
17
17
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
18
18
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
19
19
|
import { useTranslation, Trans } from 'react-i18next';
|
|
20
|
-
import { a as useBuildFormStore } from './buildForm-
|
|
20
|
+
import { a as useBuildFormStore } from './buildForm-Zw1xpuBS.js';
|
|
21
21
|
import { shallow } from 'zustand/shallow';
|
|
22
22
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
23
23
|
import { f as fieldWithFallback, i as isFunction } from './index-BL5SirYx.js';
|
|
@@ -26,9 +26,8 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
|
26
26
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
27
27
|
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
28
28
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
29
|
-
import { t } from 'i18next';
|
|
30
|
-
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
31
29
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
30
|
+
import { t } from 'i18next';
|
|
32
31
|
import { v4 } from 'uuid';
|
|
33
32
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
34
33
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
@@ -53,10 +52,11 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
53
52
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
54
53
|
import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
|
|
55
54
|
import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
56
|
-
import
|
|
55
|
+
import OptionFields from '@bigbinary/neeto-molecules/OptionFields';
|
|
57
56
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
58
57
|
import 'axios';
|
|
59
58
|
import 'dompurify';
|
|
59
|
+
import '@bigbinary/neeto-icons/Plus';
|
|
60
60
|
import 'zustand';
|
|
61
61
|
import '@babel/runtime/helpers/typeof';
|
|
62
62
|
|
|
@@ -233,50 +233,8 @@ var Overview = function Overview(_ref) {
|
|
|
233
233
|
});
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
function ownKeys$
|
|
237
|
-
function _objectSpread$
|
|
238
|
-
var validateEditorContent = function validateEditorContent(editorRef) {
|
|
239
|
-
return function () {
|
|
240
|
-
var _editorRef$current, _editorRef$current$ed;
|
|
241
|
-
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 ? t("neetoForm.common.thisFieldIsRequired") : "";
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
var buildReorderPayload = function buildReorderPayload(questions) {
|
|
245
|
-
return reduce(function (acc, _ref) {
|
|
246
|
-
var id = _ref.id,
|
|
247
|
-
displayOrder = _ref.displayOrder;
|
|
248
|
-
return assoc(id, displayOrder, acc);
|
|
249
|
-
}, {}, questions);
|
|
250
|
-
};
|
|
251
|
-
var isRichTextQuestion = includes(__, RICH_TEXT_QUESTIONS);
|
|
252
|
-
var isAutoGeneratedQuestion = includes(__, AUTO_GENERATED_KINDS);
|
|
253
|
-
var isImmutableField = function isImmutableField(field) {
|
|
254
|
-
return IMMUTABLE_KINDS.includes(field.kind);
|
|
255
|
-
};
|
|
256
|
-
var buildAddQuestionButtonProps = function buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps) {
|
|
257
|
-
return _objectSpread$h({
|
|
258
|
-
"data-cy": "neeto-form-engine-add-question-button",
|
|
259
|
-
disabled: isDisabled,
|
|
260
|
-
label: t("neetoForm.questions.common.primaryPanel.addQuestion"),
|
|
261
|
-
icon: Plus,
|
|
262
|
-
iconPosition: "left",
|
|
263
|
-
style: "link",
|
|
264
|
-
onClick: onAdd
|
|
265
|
-
}, isDisabled && {
|
|
266
|
-
tooltipProps: tooltipProps
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
var buildDisabledAddButtonTooltipProps = function buildDisabledAddButtonTooltipProps(isDisabled) {
|
|
270
|
-
var disabledAddButtonTooltipProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
271
|
-
return _objectSpread$h({
|
|
272
|
-
disabled: !isDisabled,
|
|
273
|
-
position: "top",
|
|
274
|
-
content: t("neetoForm.questions.common.primaryPanel.noQuestionLeft")
|
|
275
|
-
}, disabledAddButtonTooltipProps);
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
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; }
|
|
279
|
-
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; }
|
|
236
|
+
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; }
|
|
237
|
+
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; }
|
|
280
238
|
var Card = function Card(_ref) {
|
|
281
239
|
var _ref$question = _ref.question,
|
|
282
240
|
question = _ref$question === void 0 ? {} : _ref$question,
|
|
@@ -336,7 +294,7 @@ var Card = function Card(_ref) {
|
|
|
336
294
|
})]
|
|
337
295
|
}), /*#__PURE__*/jsxs("div", {
|
|
338
296
|
className: "flex items-center gap-1",
|
|
339
|
-
children: [isSmsReminderQuestion && /*#__PURE__*/jsx(HelpPopover, _objectSpread$
|
|
297
|
+
children: [isSmsReminderQuestion && /*#__PURE__*/jsx(HelpPopover, _objectSpread$f({
|
|
340
298
|
description: t("neetoForm.smsReminder.popoverDescription"),
|
|
341
299
|
popoverProps: {
|
|
342
300
|
position: "top"
|
|
@@ -375,8 +333,8 @@ var Card = function Card(_ref) {
|
|
|
375
333
|
});
|
|
376
334
|
};
|
|
377
335
|
|
|
378
|
-
function ownKeys$
|
|
379
|
-
function _objectSpread$
|
|
336
|
+
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; }
|
|
337
|
+
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; }
|
|
380
338
|
var Questions = function Questions(_ref) {
|
|
381
339
|
var questions = _ref.questions,
|
|
382
340
|
isDeletable = _ref.isDeletable,
|
|
@@ -393,7 +351,7 @@ var Questions = function Questions(_ref) {
|
|
|
393
351
|
var droppableProps = _ref2.droppableProps,
|
|
394
352
|
placeholder = _ref2.placeholder,
|
|
395
353
|
innerRef = _ref2.innerRef;
|
|
396
|
-
return /*#__PURE__*/jsxs("div", _objectSpread$
|
|
354
|
+
return /*#__PURE__*/jsxs("div", _objectSpread$e(_objectSpread$e({}, droppableProps), {}, {
|
|
397
355
|
className: "space-y-2",
|
|
398
356
|
ref: innerRef,
|
|
399
357
|
children: [questions.map(function (question, index) {
|
|
@@ -406,7 +364,7 @@ var Questions = function Questions(_ref) {
|
|
|
406
364
|
var draggableProps = _ref3.draggableProps,
|
|
407
365
|
dragHandleProps = _ref3.dragHandleProps,
|
|
408
366
|
innerRef = _ref3.innerRef;
|
|
409
|
-
return /*#__PURE__*/jsx("div", _objectSpread$
|
|
367
|
+
return /*#__PURE__*/jsx("div", _objectSpread$e(_objectSpread$e(_objectSpread$e({}, draggableProps), dragHandleProps), {}, {
|
|
410
368
|
ref: innerRef,
|
|
411
369
|
children: /*#__PURE__*/jsx(Card, {
|
|
412
370
|
allQuestionKinds: allQuestionKinds,
|
|
@@ -438,8 +396,8 @@ var arrayHelpers = {
|
|
|
438
396
|
moveItem: moveItem
|
|
439
397
|
};
|
|
440
398
|
|
|
441
|
-
function ownKeys$
|
|
442
|
-
function _objectSpread$
|
|
399
|
+
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; }
|
|
400
|
+
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; }
|
|
443
401
|
var isChoiceQuestion = function isChoiceQuestion(question) {
|
|
444
402
|
return includes(question === null || question === void 0 ? void 0 : question.kind, SELECTABLE_KINDS);
|
|
445
403
|
};
|
|
@@ -466,12 +424,24 @@ var generateFieldCodePrefix = function generateFieldCodePrefix(label, kind) {
|
|
|
466
424
|
}
|
|
467
425
|
return addSuffixForReservedFieldCode(prefix) || "";
|
|
468
426
|
};
|
|
469
|
-
var
|
|
470
|
-
var
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
427
|
+
var modifyDefaultValues = function modifyDefaultValues(_ref) {
|
|
428
|
+
var values = _ref.values,
|
|
429
|
+
kind = _ref.kind,
|
|
430
|
+
selectedLanguage = _ref.selectedLanguage,
|
|
431
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds;
|
|
432
|
+
if (!includes(kind, SELECTABLE_KINDS) || isDefaultLanguage(selectedLanguage) || !isUsingDefaultQuestionKinds) {
|
|
433
|
+
return values;
|
|
434
|
+
}
|
|
435
|
+
return evolve({
|
|
436
|
+
optionsAttributes: map(assoc("label", ""))
|
|
437
|
+
}, values);
|
|
438
|
+
};
|
|
439
|
+
var generateUniqueFieldCode = function generateUniqueFieldCode(_ref2) {
|
|
440
|
+
var questions = _ref2.questions,
|
|
441
|
+
_ref2$label = _ref2.label,
|
|
442
|
+
label = _ref2$label === void 0 ? "" : _ref2$label,
|
|
443
|
+
_ref2$kind = _ref2.kind,
|
|
444
|
+
kind = _ref2$kind === void 0 ? "" : _ref2$kind;
|
|
475
445
|
var prefix = generateFieldCodePrefix(label, kind);
|
|
476
446
|
var uniqueNumber = Math.max.apply(Math, [0].concat(_toConsumableArray(getUniqueNumbersFromExistingFieldCodes(prefix, questions))));
|
|
477
447
|
var candidateFieldCode = "";
|
|
@@ -487,37 +457,45 @@ var generateUniqueFieldCode = function generateUniqueFieldCode(_ref) {
|
|
|
487
457
|
}
|
|
488
458
|
return candidateFieldCode;
|
|
489
459
|
};
|
|
490
|
-
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(
|
|
491
|
-
var activeQuestions =
|
|
492
|
-
kind =
|
|
460
|
+
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(_ref3) {
|
|
461
|
+
var activeQuestions = _ref3.activeQuestions,
|
|
462
|
+
kind = _ref3.kind;
|
|
493
463
|
return activeQuestions.some(function (activeQuestion) {
|
|
494
464
|
return activeQuestion.kind === kind.type && activeQuestion._destroy !== true;
|
|
495
465
|
});
|
|
496
466
|
};
|
|
497
|
-
var handleFieldDragEnd = function handleFieldDragEnd(
|
|
498
|
-
var items =
|
|
499
|
-
setValue =
|
|
500
|
-
source =
|
|
501
|
-
destination =
|
|
467
|
+
var handleFieldDragEnd = function handleFieldDragEnd(_ref4) {
|
|
468
|
+
var items = _ref4.items,
|
|
469
|
+
setValue = _ref4.setValue,
|
|
470
|
+
source = _ref4.source,
|
|
471
|
+
destination = _ref4.destination;
|
|
502
472
|
if (!(destination && items instanceof Array)) return;
|
|
503
473
|
var nextItems = _toConsumableArray(items);
|
|
504
474
|
arrayHelpers.moveItem(nextItems, source.index, destination.index);
|
|
505
475
|
var orderedItems = nextItems.map(function (item, index) {
|
|
506
|
-
return _objectSpread$
|
|
476
|
+
return _objectSpread$d(_objectSpread$d({}, item), {}, {
|
|
507
477
|
displayOrder: index
|
|
508
478
|
});
|
|
509
479
|
});
|
|
510
480
|
setValue("questions", orderedItems);
|
|
511
481
|
};
|
|
512
|
-
var createFieldData = function createFieldData(
|
|
513
|
-
var
|
|
514
|
-
defaults =
|
|
515
|
-
type =
|
|
516
|
-
metadata =
|
|
517
|
-
|
|
518
|
-
isRequired =
|
|
519
|
-
questions =
|
|
520
|
-
|
|
482
|
+
var createFieldData = function createFieldData(_ref5) {
|
|
483
|
+
var _ref5$kind = _ref5.kind,
|
|
484
|
+
defaults = _ref5$kind.defaults,
|
|
485
|
+
type = _ref5$kind.type,
|
|
486
|
+
metadata = _ref5$kind.metadata,
|
|
487
|
+
_ref5$isRequired = _ref5.isRequired,
|
|
488
|
+
isRequired = _ref5$isRequired === void 0 ? undefined : _ref5$isRequired,
|
|
489
|
+
questions = _ref5.questions,
|
|
490
|
+
selectedLanguage = _ref5.selectedLanguage,
|
|
491
|
+
isUsingDefaultQuestionKinds = _ref5.isUsingDefaultQuestionKinds;
|
|
492
|
+
var modifiedDefaultValues = modifyDefaultValues({
|
|
493
|
+
values: defaults,
|
|
494
|
+
kind: type,
|
|
495
|
+
selectedLanguage: selectedLanguage,
|
|
496
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
497
|
+
});
|
|
498
|
+
return _objectSpread$d(_objectSpread$d({}, modifiedDefaultValues), {}, {
|
|
521
499
|
metadata: metadata,
|
|
522
500
|
isRequired: isRequired,
|
|
523
501
|
kind: type,
|
|
@@ -529,10 +507,10 @@ var createFieldData = function createFieldData(_ref4) {
|
|
|
529
507
|
})
|
|
530
508
|
});
|
|
531
509
|
};
|
|
532
|
-
var duplicateFieldData = function duplicateFieldData(
|
|
533
|
-
var item =
|
|
534
|
-
questionKinds =
|
|
535
|
-
questions =
|
|
510
|
+
var duplicateFieldData = function duplicateFieldData(_ref6) {
|
|
511
|
+
var item = _ref6.item,
|
|
512
|
+
questionKinds = _ref6.questionKinds,
|
|
513
|
+
questions = _ref6.questions;
|
|
536
514
|
var isRequired = item.isRequired,
|
|
537
515
|
kind = item.kind,
|
|
538
516
|
optionsAttributes = item.optionsAttributes;
|
|
@@ -545,7 +523,7 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
545
523
|
var newQuestionLabel = isRichTextQuestion(kind) ? label : t("neetoForm.common.clonedElementLabel", {
|
|
546
524
|
label: label
|
|
547
525
|
});
|
|
548
|
-
return _objectSpread$
|
|
526
|
+
return _objectSpread$d(_objectSpread$d({}, defaultAttributes), {}, {
|
|
549
527
|
isRequired: isRequired,
|
|
550
528
|
kind: kind,
|
|
551
529
|
label: newQuestionLabel,
|
|
@@ -559,11 +537,11 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
559
537
|
displayOrder: item.displayOrder + 1
|
|
560
538
|
});
|
|
561
539
|
};
|
|
562
|
-
var getAvailableQuestionKinds = function getAvailableQuestionKinds(
|
|
563
|
-
var allQuestionKinds =
|
|
564
|
-
|
|
565
|
-
activeQuestions =
|
|
566
|
-
isKindAlreadyActive =
|
|
540
|
+
var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref7) {
|
|
541
|
+
var allQuestionKinds = _ref7.allQuestionKinds,
|
|
542
|
+
_ref7$activeQuestions = _ref7.activeQuestions,
|
|
543
|
+
activeQuestions = _ref7$activeQuestions === void 0 ? [] : _ref7$activeQuestions,
|
|
544
|
+
isKindAlreadyActive = _ref7.isKindAlreadyActive;
|
|
567
545
|
if (isEmpty(activeQuestions)) return allQuestionKinds;
|
|
568
546
|
return reject(function (kind) {
|
|
569
547
|
var isSingularKind = kind.isSingular;
|
|
@@ -629,8 +607,8 @@ var INITIAL_VALUES = {
|
|
|
629
607
|
var VALID_FIELD_CODE_REGEX = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
630
608
|
|
|
631
609
|
var _excluded$8 = ["label", "name"];
|
|
632
|
-
function ownKeys$
|
|
633
|
-
function _objectSpread$
|
|
610
|
+
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; }
|
|
611
|
+
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; }
|
|
634
612
|
var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
635
613
|
var label = _ref.label,
|
|
636
614
|
name = _ref.name,
|
|
@@ -649,7 +627,7 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
649
627
|
var end = element.value.length;
|
|
650
628
|
element.setSelectionRange(end, end);
|
|
651
629
|
};
|
|
652
|
-
return /*#__PURE__*/jsx(Textarea, _objectSpread$
|
|
630
|
+
return /*#__PURE__*/jsx(Textarea, _objectSpread$c({
|
|
653
631
|
label: label,
|
|
654
632
|
name: name,
|
|
655
633
|
className: "neeto-form-nano-adaptive-input",
|
|
@@ -715,8 +693,8 @@ var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
|
|
|
715
693
|
return store.formState.richTextFieldsToReset.includes(fieldCode);
|
|
716
694
|
});
|
|
717
695
|
var setEditorContent = function setEditorContent(content) {
|
|
718
|
-
var _editorRef$current$ed
|
|
719
|
-
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0
|
|
696
|
+
var _editorRef$current$ed;
|
|
697
|
+
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);
|
|
720
698
|
};
|
|
721
699
|
if (shouldReset) {
|
|
722
700
|
setEditorContent(initialValue);
|
|
@@ -804,8 +782,8 @@ var RequiredSwitch = withT(function (_ref) {
|
|
|
804
782
|
});
|
|
805
783
|
|
|
806
784
|
var _excluded$7 = ["maxLength"];
|
|
807
|
-
function ownKeys$
|
|
808
|
-
function _objectSpread$
|
|
785
|
+
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; }
|
|
786
|
+
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; }
|
|
809
787
|
var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
810
788
|
var maxLength = _ref.maxLength,
|
|
811
789
|
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
@@ -819,7 +797,7 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
|
819
797
|
}
|
|
820
798
|
}, [value, maxLength, setValue]);
|
|
821
799
|
var shouldShowMaxLength = value && value.length > maxLength - 10;
|
|
822
|
-
return /*#__PURE__*/jsx(Input, _objectSpread$
|
|
800
|
+
return /*#__PURE__*/jsx(Input, _objectSpread$b(_objectSpread$b({}, props), shouldShowMaxLength && {
|
|
823
801
|
maxLength: maxLength
|
|
824
802
|
}));
|
|
825
803
|
};
|
|
@@ -876,14 +854,18 @@ var Form$1 = function Form(_ref) {
|
|
|
876
854
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
877
855
|
var hideQuestionHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "hideQuestion"]));
|
|
878
856
|
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
879
|
-
var _store$formState, _store$formState2;
|
|
857
|
+
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
880
858
|
return {
|
|
881
859
|
enableDomainWhitelisting: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["enableDomainWhitelisting"],
|
|
882
|
-
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"]
|
|
860
|
+
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"],
|
|
861
|
+
selectedLanguage: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["selectedLanguage"],
|
|
862
|
+
isUsingDefaultQuestionKinds: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["isUsingDefaultQuestionKinds"]
|
|
883
863
|
};
|
|
884
864
|
}, shallow),
|
|
885
865
|
enableDomainWhitelisting = _useBuildFormStore.enableDomainWhitelisting,
|
|
886
|
-
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting
|
|
866
|
+
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting,
|
|
867
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
868
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
887
869
|
var kind = values.kind;
|
|
888
870
|
var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
|
|
889
871
|
var questionKindUniquenessPattern = mergeLeft(isEdit && additionalQuestionKindPattern ? additionalQuestionKindPattern(values) : {}, {
|
|
@@ -924,7 +906,9 @@ var Form$1 = function Form(_ref) {
|
|
|
924
906
|
return createFieldData({
|
|
925
907
|
kind: questionKind,
|
|
926
908
|
isRequired: isRequired,
|
|
927
|
-
questions: questions
|
|
909
|
+
questions: questions,
|
|
910
|
+
selectedLanguage: selectedLanguage,
|
|
911
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
928
912
|
});
|
|
929
913
|
};
|
|
930
914
|
var updateFormState = function updateFormState(data) {
|
|
@@ -1024,15 +1008,13 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1024
1008
|
fieldCode: yup.string().trim().notOneOf(RESERVED_FIELD_CODES, t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
|
|
1025
1009
|
return enableFieldCode && !includes(kind, QUESTIONS_WITHOUT_FIELD_CODE) ? fieldCodeValidation(schema, t("neetoForm.questions.common.questionFields.field.fieldCode")) : schema.notRequired();
|
|
1026
1010
|
}),
|
|
1027
|
-
optionsAttributes: yup.array().when("
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1011
|
+
optionsAttributes: yup.array().when("kind", function (kind, schema) {
|
|
1012
|
+
return includes(kind, SELECTABLE_KINDS) ? schema.of(yup.object().shape({
|
|
1013
|
+
label: yup.string().when("_destroy", {
|
|
1014
|
+
is: true,
|
|
1015
|
+
otherwise: requiredLabelValidation(yup.string(), t("neetoForm.questions.common.questionFields.field.option"))
|
|
1016
|
+
})
|
|
1017
|
+
})) : schema.notRequired();
|
|
1036
1018
|
}),
|
|
1037
1019
|
highestRatingLabel: yup.string().nullable(),
|
|
1038
1020
|
averageRatingLabel: yup.string().nullable(),
|
|
@@ -1041,8 +1023,8 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1041
1023
|
};
|
|
1042
1024
|
|
|
1043
1025
|
var _excluded$6 = ["question", "onClose", "questions", "handleSelect", "buildRequestArgs", "isOpen"];
|
|
1044
|
-
function ownKeys$
|
|
1045
|
-
function _objectSpread$
|
|
1026
|
+
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; }
|
|
1027
|
+
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; }
|
|
1046
1028
|
var Add = function Add(_ref) {
|
|
1047
1029
|
var question = _ref.question,
|
|
1048
1030
|
onClose = _ref.onClose,
|
|
@@ -1073,7 +1055,7 @@ var Add = function Add(_ref) {
|
|
|
1073
1055
|
var handleSubmit = function handleSubmit(values) {
|
|
1074
1056
|
if (isCreating || !isOpen) return;
|
|
1075
1057
|
var displayOrder = question ? question.displayOrder + 1 : questions.length;
|
|
1076
|
-
createQuestion(_objectSpread$
|
|
1058
|
+
createQuestion(_objectSpread$a({
|
|
1077
1059
|
language: language,
|
|
1078
1060
|
neetoFormQuestion: mergeLeft({
|
|
1079
1061
|
displayOrder: displayOrder
|
|
@@ -1102,7 +1084,7 @@ var Add = function Add(_ref) {
|
|
|
1102
1084
|
onSubmit: handleSubmit
|
|
1103
1085
|
},
|
|
1104
1086
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
1105
|
-
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$
|
|
1087
|
+
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$a({}, _objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
1106
1088
|
question: question,
|
|
1107
1089
|
questions: questions
|
|
1108
1090
|
}))), /*#__PURE__*/jsx(Pane.Footer, {
|
|
@@ -1119,8 +1101,8 @@ var Add = function Add(_ref) {
|
|
|
1119
1101
|
};
|
|
1120
1102
|
|
|
1121
1103
|
var _excluded$5 = ["question", "isOpen", "onClose"];
|
|
1122
|
-
function ownKeys$
|
|
1123
|
-
function _objectSpread$
|
|
1104
|
+
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; }
|
|
1105
|
+
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; }
|
|
1124
1106
|
var Edit = function Edit(_ref) {
|
|
1125
1107
|
var question = _ref.question,
|
|
1126
1108
|
isOpen = _ref.isOpen,
|
|
@@ -1172,7 +1154,7 @@ var Edit = function Edit(_ref) {
|
|
|
1172
1154
|
onSubmit: handleSubmit
|
|
1173
1155
|
},
|
|
1174
1156
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
1175
|
-
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$
|
|
1157
|
+
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$9(_objectSpread$9({}, _objectSpread$9({
|
|
1176
1158
|
question: question
|
|
1177
1159
|
}, props)), {}, {
|
|
1178
1160
|
isEdit: true
|
|
@@ -1208,8 +1190,8 @@ var Captcha = withT(function (_ref) {
|
|
|
1208
1190
|
});
|
|
1209
1191
|
|
|
1210
1192
|
var _excluded$4 = ["name", "title", "className"];
|
|
1211
|
-
function ownKeys$
|
|
1212
|
-
function _objectSpread$
|
|
1193
|
+
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; }
|
|
1194
|
+
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; }
|
|
1213
1195
|
var SwitchBlock = function SwitchBlock(_ref) {
|
|
1214
1196
|
var name = _ref.name,
|
|
1215
1197
|
title = _ref.title,
|
|
@@ -1219,7 +1201,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1219
1201
|
return /*#__PURE__*/jsxs(Label, {
|
|
1220
1202
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1221
1203
|
"data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-toggle-label"),
|
|
1222
|
-
children: [/*#__PURE__*/jsx(Switch, _objectSpread$
|
|
1204
|
+
children: [/*#__PURE__*/jsx(Switch, _objectSpread$8(_objectSpread$8({}, _objectSpread$8(_objectSpread$8({}, otherProps), {}, {
|
|
1223
1205
|
name: name
|
|
1224
1206
|
})), {}, {
|
|
1225
1207
|
"data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-switch")
|
|
@@ -1231,15 +1213,15 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1231
1213
|
});
|
|
1232
1214
|
};
|
|
1233
1215
|
|
|
1234
|
-
function ownKeys$
|
|
1235
|
-
function _objectSpread$
|
|
1216
|
+
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; }
|
|
1217
|
+
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; }
|
|
1236
1218
|
var TitleWithHelpPopover = function TitleWithHelpPopover(_ref) {
|
|
1237
1219
|
var title = _ref.title,
|
|
1238
1220
|
description = _ref.description,
|
|
1239
1221
|
helpLink = _ref.helpLink;
|
|
1240
1222
|
return /*#__PURE__*/jsxs("div", {
|
|
1241
1223
|
className: "flex gap-2",
|
|
1242
|
-
children: [title, /*#__PURE__*/jsx(HelpPopover, _objectSpread$
|
|
1224
|
+
children: [title, /*#__PURE__*/jsx(HelpPopover, _objectSpread$7({
|
|
1243
1225
|
description: description,
|
|
1244
1226
|
popoverProps: {
|
|
1245
1227
|
position: "top"
|
|
@@ -1266,8 +1248,8 @@ var DOMAIN_RESTRICTION_TRANSLATIONS = {
|
|
|
1266
1248
|
};
|
|
1267
1249
|
|
|
1268
1250
|
var _excluded$3 = ["children"];
|
|
1269
|
-
function ownKeys$
|
|
1270
|
-
function _objectSpread$
|
|
1251
|
+
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; }
|
|
1252
|
+
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; }
|
|
1271
1253
|
var STYLES = {
|
|
1272
1254
|
border: {
|
|
1273
1255
|
"default": "1px solid rgb(var(--neeto-ui-gray-400))",
|
|
@@ -1279,8 +1261,8 @@ var STYLES = {
|
|
|
1279
1261
|
}
|
|
1280
1262
|
};
|
|
1281
1263
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1282
|
-
return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$
|
|
1283
|
-
innerProps: _objectSpread$
|
|
1264
|
+
return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1265
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(hyphenize(props.data.label), "-remove-icon"))),
|
|
1284
1266
|
children: /*#__PURE__*/jsx(Close, {
|
|
1285
1267
|
size: 16
|
|
1286
1268
|
})
|
|
@@ -1300,8 +1282,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1300
1282
|
firstChild = _children[0],
|
|
1301
1283
|
rest = _children.slice(1);
|
|
1302
1284
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1303
|
-
return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$
|
|
1304
|
-
innerProps: _objectSpread$
|
|
1285
|
+
return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1286
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
|
|
1305
1287
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsx(Tag, {
|
|
1306
1288
|
style: "secondary",
|
|
1307
1289
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1311,8 +1293,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1311
1293
|
}));
|
|
1312
1294
|
};
|
|
1313
1295
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1314
|
-
return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$
|
|
1315
|
-
innerProps: _objectSpread$
|
|
1296
|
+
return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1297
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
|
|
1316
1298
|
children: /*#__PURE__*/jsx(Close, {
|
|
1317
1299
|
className: "cursor-pointer",
|
|
1318
1300
|
size: 16
|
|
@@ -1333,7 +1315,7 @@ var CUSTOM_STYLES = {
|
|
|
1333
1315
|
input: assoc("overflow", "hidden"),
|
|
1334
1316
|
multiValue: function multiValue(styles, _ref2) {
|
|
1335
1317
|
var valid = _ref2.data.valid;
|
|
1336
|
-
return _objectSpread$
|
|
1318
|
+
return _objectSpread$6(_objectSpread$6({}, styles), {}, {
|
|
1337
1319
|
border: valid ? STYLES.border["default"] : STYLES.border.error,
|
|
1338
1320
|
color: valid ? STYLES.color["default"] : STYLES.color.error
|
|
1339
1321
|
});
|
|
@@ -1376,8 +1358,8 @@ var formatErrorMessage = function formatErrorMessage(error) {
|
|
|
1376
1358
|
};
|
|
1377
1359
|
|
|
1378
1360
|
var _excluded$2 = ["label", "value", "onChange", "error", "onBlur"];
|
|
1379
|
-
function ownKeys$
|
|
1380
|
-
function _objectSpread$
|
|
1361
|
+
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; }
|
|
1362
|
+
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; }
|
|
1381
1363
|
var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
1382
1364
|
var _ref$label = _ref.label,
|
|
1383
1365
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -1436,7 +1418,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1436
1418
|
"data-cy": "".concat(hyphenize(label), "-input-label"),
|
|
1437
1419
|
children: label
|
|
1438
1420
|
})
|
|
1439
|
-
}), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$
|
|
1421
|
+
}), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$5({
|
|
1440
1422
|
isMulti: true,
|
|
1441
1423
|
required: true,
|
|
1442
1424
|
classNamePrefix: "neeto-ui-react-select",
|
|
@@ -1446,7 +1428,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1446
1428
|
className: classnames("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
|
|
1447
1429
|
"neeto-ui-react-select__container--error": !!error
|
|
1448
1430
|
}),
|
|
1449
|
-
styles: _objectSpread$
|
|
1431
|
+
styles: _objectSpread$5(_objectSpread$5({}, CUSTOM_STYLES), {}, {
|
|
1450
1432
|
control: mergeLeft({
|
|
1451
1433
|
maxHeight: "200px",
|
|
1452
1434
|
overflowY: "auto"
|
|
@@ -1458,7 +1440,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1458
1440
|
},
|
|
1459
1441
|
onInputChange: setInputValue,
|
|
1460
1442
|
onKeyDown: handleKeyDown
|
|
1461
|
-
}, _objectSpread$
|
|
1443
|
+
}, _objectSpread$5({
|
|
1462
1444
|
inputValue: inputValue,
|
|
1463
1445
|
isFocused: isFocused,
|
|
1464
1446
|
onChange: onChange,
|
|
@@ -1685,73 +1667,6 @@ var FileUpload = function FileUpload() {
|
|
|
1685
1667
|
});
|
|
1686
1668
|
};
|
|
1687
1669
|
|
|
1688
|
-
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; }
|
|
1689
|
-
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; }
|
|
1690
|
-
var defaultConfig = {
|
|
1691
|
-
strict: true,
|
|
1692
|
-
matchKey: "value"
|
|
1693
|
-
};
|
|
1694
|
-
var findOptionByValue = function findOptionByValue(value) {
|
|
1695
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1696
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1697
|
-
var configObject = _objectSpread$5(_objectSpread$5({}, defaultConfig), config);
|
|
1698
|
-
var matchKey = configObject.matchKey,
|
|
1699
|
-
strict = configObject.strict;
|
|
1700
|
-
return options.find(function (option) {
|
|
1701
|
-
return (
|
|
1702
|
-
// eslint-disable-next-line eqeqeq
|
|
1703
|
-
strict ? option[matchKey] === value : option[matchKey] == value
|
|
1704
|
-
);
|
|
1705
|
-
});
|
|
1706
|
-
};
|
|
1707
|
-
var filterOptionsByValues = function filterOptionsByValues() {
|
|
1708
|
-
var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1709
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1710
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1711
|
-
var configObject = _objectSpread$5(_objectSpread$5({}, defaultConfig), config);
|
|
1712
|
-
var matchKey = configObject.matchKey,
|
|
1713
|
-
strict = configObject.strict;
|
|
1714
|
-
return options.filter(function (option) {
|
|
1715
|
-
return values.some(function (value) {
|
|
1716
|
-
return (
|
|
1717
|
-
// eslint-disable-next-line eqeqeq
|
|
1718
|
-
strict ? option[matchKey] === value : option[matchKey] == value
|
|
1719
|
-
);
|
|
1720
|
-
});
|
|
1721
|
-
});
|
|
1722
|
-
};
|
|
1723
|
-
var destroyFromList = function destroyFromList(items, index) {
|
|
1724
|
-
var itemToRemove = items[index];
|
|
1725
|
-
if (itemToRemove) {
|
|
1726
|
-
var nextItems = _toConsumableArray(items);
|
|
1727
|
-
nextItems.splice(index, 1);
|
|
1728
|
-
if (itemToRemove.id) {
|
|
1729
|
-
nextItems.push(_objectSpread$5(_objectSpread$5({}, itemToRemove), {}, {
|
|
1730
|
-
_destroy: true
|
|
1731
|
-
}));
|
|
1732
|
-
}
|
|
1733
|
-
return nextItems;
|
|
1734
|
-
}
|
|
1735
|
-
return items;
|
|
1736
|
-
};
|
|
1737
|
-
var insertToList = function insertToList(items, item, index) {
|
|
1738
|
-
var nextItems = _toConsumableArray(items !== null && items !== void 0 ? items : []);
|
|
1739
|
-
nextItems.splice(index, 0, item);
|
|
1740
|
-
return nextItems;
|
|
1741
|
-
};
|
|
1742
|
-
var pushToList = function pushToList(items, item) {
|
|
1743
|
-
var nextItems = _toConsumableArray(items !== null && items !== void 0 ? items : []);
|
|
1744
|
-
nextItems.push(item);
|
|
1745
|
-
return nextItems;
|
|
1746
|
-
};
|
|
1747
|
-
var formHelpers = {
|
|
1748
|
-
findOptionByValue: findOptionByValue,
|
|
1749
|
-
filterOptionsByValues: filterOptionsByValues,
|
|
1750
|
-
destroyFromList: destroyFromList,
|
|
1751
|
-
insertToList: insertToList,
|
|
1752
|
-
pushToList: pushToList
|
|
1753
|
-
};
|
|
1754
|
-
|
|
1755
1670
|
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; }
|
|
1756
1671
|
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; }
|
|
1757
1672
|
var Options = function Options(_ref) {
|
|
@@ -1765,9 +1680,10 @@ var Options = function Options(_ref) {
|
|
|
1765
1680
|
};
|
|
1766
1681
|
}, shallow),
|
|
1767
1682
|
selectedLanguage = _useBuildFormStore.selectedLanguage;
|
|
1768
|
-
var
|
|
1769
|
-
|
|
1770
|
-
|
|
1683
|
+
var name = "optionsAttributes";
|
|
1684
|
+
var _useField = useField(name),
|
|
1685
|
+
_useField2 = _slicedToArray(_useField, 3);
|
|
1686
|
+
_useField2[0];
|
|
1771
1687
|
_useField2[1];
|
|
1772
1688
|
var setOptionsAttributes = _useField2[2].setValue;
|
|
1773
1689
|
var _ref2 = questionProps || {},
|
|
@@ -1779,73 +1695,28 @@ var Options = function Options(_ref) {
|
|
|
1779
1695
|
disableAddOption = _ref2$disableAddOptio === void 0 ? false : _ref2$disableAddOptio,
|
|
1780
1696
|
_ref2$disableRemoveOp = _ref2.disableRemoveOption,
|
|
1781
1697
|
disableRemoveOption = _ref2$disableRemoveOp === void 0 ? false : _ref2$disableRemoveOp;
|
|
1782
|
-
var handleRemoveOption = function handleRemoveOption(index) {
|
|
1783
|
-
var nextOptions = formHelpers.destroyFromList(optionsAttributes, index);
|
|
1784
|
-
setOptionsAttributes(nextOptions);
|
|
1785
|
-
};
|
|
1786
1698
|
var isManageOptionDisabled = isFunction(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
1787
1699
|
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
1788
1700
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1789
|
-
return /*#__PURE__*/
|
|
1701
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1790
1702
|
className: "w-full",
|
|
1791
|
-
children: /*#__PURE__*/jsx(
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
required: true,
|
|
1809
|
-
disabled: isManageOptionDisabled,
|
|
1810
|
-
name: "optionsAttributes.".concat(index, ".label"),
|
|
1811
|
-
placeholder: t("neetoForm.questions.common.questionFields.field.numberedOption", {
|
|
1812
|
-
number: index + 1
|
|
1813
|
-
})
|
|
1814
|
-
}), !isRemoveOptionDisabled && /*#__PURE__*/jsx(Button, {
|
|
1815
|
-
"data-cy": "neeto-form-engine-delete-option-button",
|
|
1816
|
-
icon: Delete,
|
|
1817
|
-
size: "small",
|
|
1818
|
-
style: "text",
|
|
1819
|
-
className: classnames({
|
|
1820
|
-
invisible: index < MINIMUM_OPTIONS
|
|
1821
|
-
}),
|
|
1822
|
-
tooltipProps: {
|
|
1823
|
-
position: "top",
|
|
1824
|
-
content: t("neetoForm.common.delete")
|
|
1825
|
-
},
|
|
1826
|
-
onClick: function onClick() {
|
|
1827
|
-
return handleRemoveOption(index);
|
|
1828
|
-
}
|
|
1829
|
-
})]
|
|
1830
|
-
}, "question-option-".concat((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : index));
|
|
1831
|
-
})
|
|
1832
|
-
}), !isAddOptionDisabled && /*#__PURE__*/jsx("div", {
|
|
1833
|
-
className: "mt-3 w-full",
|
|
1834
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
1835
|
-
"data-cy": "neeto-form-engine-add-option-button",
|
|
1836
|
-
icon: Plus,
|
|
1837
|
-
iconPosition: "left",
|
|
1838
|
-
size: "small",
|
|
1839
|
-
style: "text",
|
|
1840
|
-
label: t("neetoForm.questions.common.questionFields.field.addOption"),
|
|
1841
|
-
onClick: handlePush({
|
|
1842
|
-
label: ""
|
|
1843
|
-
})
|
|
1844
|
-
})
|
|
1845
|
-
})]
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
})
|
|
1703
|
+
children: [/*#__PURE__*/jsx(Label, _objectSpread$4(_objectSpread$4({
|
|
1704
|
+
className: "mb-2 block"
|
|
1705
|
+
}, optionLabelProps), {}, {
|
|
1706
|
+
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
1707
|
+
})), /*#__PURE__*/jsx(OptionFields, {
|
|
1708
|
+
name: name,
|
|
1709
|
+
shouldDestroy: true,
|
|
1710
|
+
destroyFlagName: "_destroy",
|
|
1711
|
+
disabled: isManageOptionDisabled,
|
|
1712
|
+
draggable: !isManageOptionDisabled,
|
|
1713
|
+
isAddOptionEnabled: !isAddOptionDisabled,
|
|
1714
|
+
isDeleteOptionEnabled: !isRemoveOptionDisabled,
|
|
1715
|
+
isNewItemsPrefilled: isDefaultLanguage(selectedLanguage),
|
|
1716
|
+
minOptions: MINIMUM_OPTIONS,
|
|
1717
|
+
shouldResetEmptyOptionOnBlur: false,
|
|
1718
|
+
onChange: setOptionsAttributes
|
|
1719
|
+
})]
|
|
1849
1720
|
});
|
|
1850
1721
|
};
|
|
1851
1722
|
|
|
@@ -2061,7 +1932,7 @@ var AddQuestion = function AddQuestion(_ref) {
|
|
|
2061
1932
|
}));
|
|
2062
1933
|
};
|
|
2063
1934
|
|
|
2064
|
-
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"];
|
|
1935
|
+
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"];
|
|
2065
1936
|
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; }
|
|
2066
1937
|
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; }
|
|
2067
1938
|
var Form = function Form(_ref) {
|
|
@@ -2093,6 +1964,7 @@ var Form = function Form(_ref) {
|
|
|
2093
1964
|
enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
2094
1965
|
helpDocUrls = _ref.helpDocUrls,
|
|
2095
1966
|
questionsHelpProps = _ref.questionsHelpProps,
|
|
1967
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds,
|
|
2096
1968
|
formDomProps = _objectWithoutProperties(_ref, _excluded);
|
|
2097
1969
|
var containerRef = useRef();
|
|
2098
1970
|
var _useTranslation = useTranslation(),
|
|
@@ -2142,9 +2014,10 @@ var Form = function Form(_ref) {
|
|
|
2142
2014
|
selectedLanguage: selectedLanguage,
|
|
2143
2015
|
helpDocUrls: helpDocUrls,
|
|
2144
2016
|
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2145
|
-
enableDomainWhitelisting: enableDomainWhitelisting
|
|
2017
|
+
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
2018
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
2146
2019
|
});
|
|
2147
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting]);
|
|
2020
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds]);
|
|
2148
2021
|
var questions = values.questions;
|
|
2149
2022
|
var handleSelect = function handleSelect(question) {
|
|
2150
2023
|
setSelectedQuestion(question);
|
|
@@ -2190,7 +2063,7 @@ var Form = function Form(_ref) {
|
|
|
2190
2063
|
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
|
|
2191
2064
|
});
|
|
2192
2065
|
useEffect(function () {
|
|
2193
|
-
onValueChange === null || onValueChange === void 0
|
|
2066
|
+
onValueChange === null || onValueChange === void 0 || onValueChange(questions);
|
|
2194
2067
|
}, [questions]);
|
|
2195
2068
|
var availableQuestionKinds = getAvailableQuestionKinds({
|
|
2196
2069
|
allQuestionKinds: questionKinds,
|
|
@@ -2379,7 +2252,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2379
2252
|
isQuestionsLoading = _ref2.isQuestionsLoading;
|
|
2380
2253
|
useEffect(function () {
|
|
2381
2254
|
if (data) {
|
|
2382
|
-
onUpdate === null || onUpdate === void 0
|
|
2255
|
+
onUpdate === null || onUpdate === void 0 || onUpdate(data);
|
|
2383
2256
|
}
|
|
2384
2257
|
}, [data]);
|
|
2385
2258
|
if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
|
|
@@ -2422,6 +2295,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2422
2295
|
var defaultQuestionKinds = allowAdditionalGuests ? QUESTION_KINDS : removeBy({
|
|
2423
2296
|
type: QUESTION_KIND.ADDITIONAL_GUESTS.value
|
|
2424
2297
|
}, QUESTION_KINDS);
|
|
2298
|
+
var isUsingDefaultQuestionKinds = isNil(questionKinds);
|
|
2425
2299
|
return /*#__PURE__*/jsxs("div", {
|
|
2426
2300
|
className: classnames("neeto-form-nano-form-outer-wrapper relative", className),
|
|
2427
2301
|
children: [/*#__PURE__*/jsx(Formik, {
|
|
@@ -2453,6 +2327,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2453
2327
|
isKindAlreadyActive: isKindAlreadyActive,
|
|
2454
2328
|
isReordering: isReordering,
|
|
2455
2329
|
isRequiredField: isRequiredField,
|
|
2330
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2456
2331
|
kindUniqueOn: kindUniqueOn,
|
|
2457
2332
|
onLanguageChange: onLanguageChange,
|
|
2458
2333
|
onValueChange: onValueChange,
|
|
@@ -2463,7 +2338,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2463
2338
|
submitButtonProps: submitButtonProps
|
|
2464
2339
|
})), {}, {
|
|
2465
2340
|
formId: id,
|
|
2466
|
-
questionKinds:
|
|
2341
|
+
questionKinds: isUsingDefaultQuestionKinds ? defaultQuestionKinds : questionKinds,
|
|
2467
2342
|
onChange: function onChange(event) {
|
|
2468
2343
|
if (isEmpty(errors)) return;
|
|
2469
2344
|
setFieldError(event.target.name);
|