optimized-react-component-library-xyz123 0.19.24 → 0.19.25
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 +8 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1111,7 +1111,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1111
1111
|
// src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
|
|
1112
1112
|
import { isValid, parseISO } from "date-fns";
|
|
1113
1113
|
var hasQuestionValidationError = (question, questions) => {
|
|
1114
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1114
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1115
1115
|
let error = false;
|
|
1116
1116
|
if (question.isQuestionMandatory) {
|
|
1117
1117
|
if (question.isTouched === false) {
|
|
@@ -1124,34 +1124,28 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1124
1124
|
error = true;
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
return e === "maxLength" && ((_a2 = question.questionExtraAttribute) == null ? void 0 : _a2.answerMaxLength);
|
|
1131
|
-
}
|
|
1132
|
-
)) {
|
|
1133
|
-
if (question.answer.length > question.questionExtraAttribute.answerMaxLength) {
|
|
1134
|
-
error = true;
|
|
1135
|
-
}
|
|
1127
|
+
const maxLength = (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.answerMaxLength) != null ? _c : 1e3;
|
|
1128
|
+
if (((_d = question.validationType) == null ? void 0 : _d.includes("maxLength")) && question.answer.length > maxLength) {
|
|
1129
|
+
error = true;
|
|
1136
1130
|
}
|
|
1137
1131
|
if (question.questionType === "TextField") {
|
|
1138
1132
|
if (question.answer.length > 100) {
|
|
1139
1133
|
error = true;
|
|
1140
1134
|
}
|
|
1141
1135
|
}
|
|
1142
|
-
if (((
|
|
1136
|
+
if (((_e = question.validationType) == null ? void 0 : _e.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1143
1137
|
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1144
1138
|
if (!emailRegex.test(question.answer)) {
|
|
1145
1139
|
error = true;
|
|
1146
1140
|
}
|
|
1147
1141
|
}
|
|
1148
|
-
if (((
|
|
1142
|
+
if (((_f = question.validationType) == null ? void 0 : _f.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1149
1143
|
const fourNumbersRegex = /^\d{4}$/.test(question.answer);
|
|
1150
1144
|
if (!fourNumbersRegex) {
|
|
1151
1145
|
error = true;
|
|
1152
1146
|
}
|
|
1153
1147
|
}
|
|
1154
|
-
if (((
|
|
1148
|
+
if (((_g = question.validationType) == null ? void 0 : _g.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
|
|
1155
1149
|
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
1156
1150
|
if (!regex.test(question.answer)) {
|
|
1157
1151
|
error = true;
|
|
@@ -1165,7 +1159,7 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1165
1159
|
error = true;
|
|
1166
1160
|
}
|
|
1167
1161
|
}
|
|
1168
|
-
const groupCheckError = (
|
|
1162
|
+
const groupCheckError = (_h = question.validationType) == null ? void 0 : _h.find((e) => e.startsWith("groupCheck-"));
|
|
1169
1163
|
if (groupCheckError) {
|
|
1170
1164
|
const ids = groupCheckError.replace("groupCheck-", "").split("-");
|
|
1171
1165
|
const relatedAnswers = ids.map(
|