@bigbinary/neeto-form-frontend 4.4.16 → 4.4.18

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.
@@ -23,9 +23,9 @@ var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
23
23
  var Dropdown = require('@bigbinary/neetoui/Dropdown');
24
24
  var Tooltip = require('@bigbinary/neetoui/Tooltip');
25
25
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
26
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
26
27
  var index = require('../index-Beo6ztaM.js');
27
28
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
28
- var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
29
29
  var i18next = require('i18next');
30
30
  var uuid = require('uuid');
31
31
  var NoData = require('@bigbinary/neetoui/NoData');
@@ -299,7 +299,9 @@ var Card = function Card(_ref) {
299
299
  onEdit = _ref.onEdit,
300
300
  onClone = _ref.onClone,
301
301
  onDelete = _ref.onDelete,
302
- canManageQuestions = _ref.canManageQuestions;
302
+ canManageQuestions = _ref.canManageQuestions,
303
+ _ref$extraMenuItems = _ref.extraMenuItems,
304
+ extraMenuItems = _ref$extraMenuItems === void 0 ? [] : _ref$extraMenuItems;
303
305
  var _useState = React.useState(false),
304
306
  _useState2 = _slicedToArray(_useState, 2),
305
307
  isTooltipEnabled = _useState2[0],
@@ -365,7 +367,7 @@ var Card = function Card(_ref) {
365
367
  label: t("neetoForm.common.clone"),
366
368
  isVisible: !isSingular && index.isFunction(onClone),
367
369
  onClick: onClone
368
- }, {
370
+ }].concat(_toConsumableArray(extraMenuItems), [{
369
371
  "data-testid": "delete-question",
370
372
  key: "delete",
371
373
  label: t("neetoForm.common.delete"),
@@ -373,7 +375,7 @@ var Card = function Card(_ref) {
373
375
  onClick: function onClick() {
374
376
  return onDelete(question);
375
377
  }
376
- }]
378
+ }])
377
379
  })]
378
380
  })]
379
381
  });
@@ -386,6 +388,7 @@ var Questions = function Questions(_ref) {
386
388
  isDeletable = _ref.isDeletable,
387
389
  allQuestionKinds = _ref.allQuestionKinds,
388
390
  getActiveKindDetails = _ref.getActiveKindDetails,
391
+ getQuestionMenuExtras = _ref.getQuestionMenuExtras,
389
392
  selectedQuestion = _ref.selectedQuestion,
390
393
  onEdit = _ref.onEdit,
391
394
  onClone = _ref.onClone,
@@ -410,6 +413,7 @@ var Questions = function Questions(_ref) {
410
413
  isDragDisabled: !canManageQuestions,
411
414
  key: "question-".concat((_question$id2 = question.id) !== null && _question$id2 !== void 0 ? _question$id2 : question.nodeId)
412
415
  }, function (_ref3) {
416
+ var _getQuestionMenuExtra;
413
417
  var draggableProps = _ref3.draggableProps,
414
418
  dragHandleProps = _ref3.dragHandleProps,
415
419
  innerRef = _ref3.innerRef;
@@ -423,6 +427,7 @@ var Questions = function Questions(_ref) {
423
427
  onEdit: onEdit,
424
428
  onSelect: onSelect,
425
429
  question: question,
430
+ extraMenuItems: (_getQuestionMenuExtra = getQuestionMenuExtras === null || getQuestionMenuExtras === void 0 ? void 0 : getQuestionMenuExtras(question)) !== null && _getQuestionMenuExtra !== void 0 ? _getQuestionMenuExtra : [],
426
431
  isActive: ramda.equals(selectedQuestion, question),
427
432
  onDelete: isDeletable(question) && onDelete
428
433
  })
@@ -2811,7 +2816,8 @@ var Form = function Form(_ref) {
2811
2816
  questionsFromCache = _ref.questionsFromCache,
2812
2817
  onMutateSuccess = _ref.onMutateSuccess,
2813
2818
  advancedFeatures = _ref.advancedFeatures,
2814
- isPictureChoiceEnabled = _ref.isPictureChoiceEnabled;
2819
+ isPictureChoiceEnabled = _ref.isPictureChoiceEnabled,
2820
+ getQuestionMenuExtras = _ref.getQuestionMenuExtras;
2815
2821
  var containerRef = React.useRef();
2816
2822
  var _useStateWithDependen = reactUtils.useStateWithDependency(questionsFromCache),
2817
2823
  _useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
@@ -3000,6 +3006,7 @@ var Form = function Form(_ref) {
3000
3006
  children: /*#__PURE__*/jsxRuntime.jsx(Questions, {
3001
3007
  canManageQuestions: canManageQuestions,
3002
3008
  getActiveKindDetails: getActiveKindDetails,
3009
+ getQuestionMenuExtras: getQuestionMenuExtras,
3003
3010
  isDeletable: isDeletable,
3004
3011
  questions: questions,
3005
3012
  selectedQuestion: selectedQuestion,
@@ -3085,7 +3092,8 @@ var BuildForm = function BuildForm(_ref) {
3085
3092
  _ref$canManageQuestio = _ref.canManageQuestions,
3086
3093
  canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio,
3087
3094
  _ref$isPictureChoiceE = _ref.isPictureChoiceEnabled,
3088
- isPictureChoiceEnabled = _ref$isPictureChoiceE === void 0 ? false : _ref$isPictureChoiceE;
3095
+ isPictureChoiceEnabled = _ref$isPictureChoiceE === void 0 ? false : _ref$isPictureChoiceE,
3096
+ getQuestionMenuExtras = _ref.getQuestionMenuExtras;
3089
3097
  var queryClient = reactQuery.useQueryClient();
3090
3098
  var _useForm = constants.useForm({
3091
3099
  formId: id,
@@ -3132,6 +3140,7 @@ var BuildForm = function BuildForm(_ref) {
3132
3140
  formDescription: formDescription,
3133
3141
  formTitle: formTitle,
3134
3142
  getActiveKindDetails: getActiveKindDetails,
3143
+ getQuestionMenuExtras: getQuestionMenuExtras,
3135
3144
  helpDocUrls: helpDocUrls,
3136
3145
  hostSpecificData: hostSpecificData,
3137
3146
  isDisabledFieldLabel: isDisabledFieldLabel,