@bigbinary/neeto-form-frontend 1.2.52 → 1.2.53
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.cjs.js +17 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +17 -6
- 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(),
|