@bigbinary/neeto-form-frontend 3.2.0 → 3.2.1

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/index.js CHANGED
@@ -7,7 +7,7 @@ import { useFormikContext, useField, FieldArray, Form as Form$3, Formik, Field,
7
7
  import { filterNonNull, noop, findBy, toLabelAndValue, isPresent, truncate, slugify, filterBy, hyphenate, removeBy, isNotPresent, isNotEmpty, findById, getRandomInt, randomPick, notEqualsDeep } from '@bigbinary/neeto-cist';
8
8
  import { buildUrl, showThumbsUpToastr, withEventTargetValue, getQueryParams, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
9
9
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
10
- import { assoc, mergeLeft, compose, isEmpty, trim, useWith, path, split, isNotNil, either, isNil, values, equals, modify, prop, range, includes, __, reduce, reject, keys, pick, omit, pluck, without, difference, pipe, last, concat, not, toLower, map, clamp, identity, filter } from 'ramda';
10
+ import { assoc, mergeLeft, compose, isEmpty, trim, useWith, path, split, isNotNil, either, isNil, values, equals, modify, prop, range, includes, __, reduce, when, reject, keys, pick, omit, pluck, without, difference, pipe, last, concat, not, toLower, map, clamp, identity, filter } from 'ramda';
11
11
  import i18next, { t as t$3 } from 'i18next';
12
12
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
13
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -1750,6 +1750,9 @@ var arrayHelpers = {
1750
1750
 
1751
1751
  function ownKeys$v(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; }
1752
1752
  function _objectSpread$v(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$v(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$v(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1753
+ var isChoiceQuestion = function isChoiceQuestion(question) {
1754
+ return includes(question === null || question === void 0 ? void 0 : question.kind, SELECTABLE_KINDS);
1755
+ };
1753
1756
  var generateUniqueFieldCode = function generateUniqueFieldCode(type, questions) {
1754
1757
  var fieldCodes = pluck("fieldCode", filterBy({
1755
1758
  kind: type
@@ -1847,6 +1850,7 @@ var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref5) {
1847
1850
  });
1848
1851
  }, allQuestionKinds);
1849
1852
  };
1853
+ var formatQuestionAttributesForClone = when(isChoiceQuestion, assoc("isCloning", true));
1850
1854
 
1851
1855
  var _path$2, _path2, _path3, _path4, _path5, _path6, _path7;
1852
1856
  function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
@@ -3004,12 +3008,11 @@ var Form = function Form(_ref) {
3004
3008
  });
3005
3009
  var displayOrder = selectedQuestion.displayOrder + 1;
3006
3010
  var attributes = mergeLeft({
3007
- displayOrder: displayOrder,
3008
- isCloning: true
3011
+ displayOrder: displayOrder
3009
3012
  }, values);
3010
3013
  var payload = _objectSpread$n({
3011
3014
  language: selectedLanguage,
3012
- neetoFormQuestion: attributes
3015
+ neetoFormQuestion: formatQuestionAttributesForClone(attributes)
3013
3016
  }, buildRequestArgs);
3014
3017
  createQuestion(payload, {
3015
3018
  onSuccess: function onSuccess(_ref2) {
@@ -8570,7 +8573,7 @@ var getValue = function getValue(_ref) {
8570
8573
  return value === null || value === void 0 ? void 0 : value.join(", ");
8571
8574
  }
8572
8575
  if (kind === QUESTION_KIND.CONDITION.value) {
8573
- return value ? t$3("neetoForm.common.yes") : t$3("neetoForm.common.no");
8576
+ return (value === null || value === void 0 ? void 0 : value.toLowerCase()) === "true" ? t$3("neetoForm.common.yes") : t$3("neetoForm.common.no");
8574
8577
  }
8575
8578
  return value;
8576
8579
  };