@bigbinary/neeto-form-frontend 1.2.52 → 1.2.54
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 +3 -1
- package/dist/index.cjs.js +26 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +26 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -768,6 +768,7 @@ var QUESTIONS_INITIAL_VALUE = {
|
|
|
768
768
|
title: ""
|
|
769
769
|
};
|
|
770
770
|
var RESERVED_FIELD_CODES = ["month", "date", "time"];
|
|
771
|
+
var SELECTABLE_KINDS = ["radio", "checkbox", "dropdown"];
|
|
771
772
|
|
|
772
773
|
function _arrayWithHoles$3(arr) {
|
|
773
774
|
if (Array.isArray(arr)) return arr;
|
|
@@ -11968,13 +11969,23 @@ var formValidationSchema = object().shape({
|
|
|
11968
11969
|
}
|
|
11969
11970
|
}),
|
|
11970
11971
|
kind: string().required(),
|
|
11971
|
-
fieldCode: string().
|
|
11972
|
-
|
|
11972
|
+
fieldCode: string().when("_destroy", {
|
|
11973
|
+
is: true,
|
|
11974
|
+
otherwise: function otherwise(schema) {
|
|
11975
|
+
return schema.trim().notOneOf(RESERVED_FIELD_CODES, i18next.t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
|
|
11976
|
+
return QUESTIONS_WITHOUT_FIELD_CODE.includes(kind) ? schema.notRequired() : requiredLabelValidation(schema, i18next.t("neetoForm.questions.common.questionFields.field.fieldCode"));
|
|
11977
|
+
});
|
|
11978
|
+
}
|
|
11973
11979
|
}),
|
|
11974
|
-
optionsAttributes: array().when("
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11980
|
+
optionsAttributes: array().when("_destroy", {
|
|
11981
|
+
is: true,
|
|
11982
|
+
otherwise: function otherwise(schema) {
|
|
11983
|
+
return schema.when("kind", function (kind, schema) {
|
|
11984
|
+
return SELECTABLE_KINDS.includes(kind) ? schema.of(object().shape({
|
|
11985
|
+
label: requiredLabelValidation(string(), i18next.t("neetoForm.questions.common.questionFields.field.option"))
|
|
11986
|
+
})) : schema.notRequired();
|
|
11987
|
+
});
|
|
11988
|
+
}
|
|
11978
11989
|
}),
|
|
11979
11990
|
highestRatingLabel: string().nullable(),
|
|
11980
11991
|
averageRatingLabel: string().nullable(),
|
|
@@ -15953,6 +15964,7 @@ var validateFieldValue = function validateFieldValue(_ref12) {
|
|
|
15953
15964
|
};
|
|
15954
15965
|
|
|
15955
15966
|
var MultipleEmailInput = function MultipleEmailInput(_ref) {
|
|
15967
|
+
var _React$createElement;
|
|
15956
15968
|
var question = _ref.question,
|
|
15957
15969
|
customValidator = _ref.customValidator;
|
|
15958
15970
|
var name = question.id,
|
|
@@ -15960,6 +15972,8 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
|
|
|
15960
15972
|
isRequired = question.isRequired,
|
|
15961
15973
|
nodeId = question.nodeId;
|
|
15962
15974
|
var label = fieldWithFallback(question, "label");
|
|
15975
|
+
var _useTranslation = useTranslation(),
|
|
15976
|
+
t = _useTranslation.t;
|
|
15963
15977
|
var _useField = useField({
|
|
15964
15978
|
name: name || nodeId,
|
|
15965
15979
|
validate: validateFieldValue({
|
|
@@ -15987,6 +16001,7 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
|
|
|
15987
16001
|
isRequired: isRequired,
|
|
15988
16002
|
label: label,
|
|
15989
16003
|
error: meta.touched ? meta.error : "",
|
|
16004
|
+
helpText: t("neetoForm.common.addGuestsHelper"),
|
|
15990
16005
|
name: field.name,
|
|
15991
16006
|
placeholder: fieldWithFallback(question, "placeholder"),
|
|
15992
16007
|
value: field.value,
|
|
@@ -15994,13 +16009,11 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
|
|
|
15994
16009
|
return setTouched(true);
|
|
15995
16010
|
},
|
|
15996
16011
|
onChange: setValue
|
|
15997
|
-
}) : /*#__PURE__*/React__default.createElement(Button$1, {
|
|
15998
|
-
label: label
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
}
|
|
16003
|
-
})));
|
|
16012
|
+
}) : /*#__PURE__*/React__default.createElement(Button$1, (_React$createElement = {
|
|
16013
|
+
label: label
|
|
16014
|
+
}, _defineProperty$6(_React$createElement, "label", t("neetoForm.common.addGuests")), _defineProperty$6(_React$createElement, "style", "secondary"), _defineProperty$6(_React$createElement, "onClick", function onClick() {
|
|
16015
|
+
return setIsInputVisible(true);
|
|
16016
|
+
}), _React$createElement))));
|
|
16004
16017
|
};
|
|
16005
16018
|
|
|
16006
16019
|
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; }
|