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.js
CHANGED
|
@@ -1193,7 +1193,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1193
1193
|
// src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
|
|
1194
1194
|
var import_date_fns = require("date-fns");
|
|
1195
1195
|
var hasQuestionValidationError = (question, questions) => {
|
|
1196
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1196
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1197
1197
|
let error = false;
|
|
1198
1198
|
if (question.isQuestionMandatory) {
|
|
1199
1199
|
if (question.isTouched === false) {
|
|
@@ -1206,34 +1206,28 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1206
1206
|
error = true;
|
|
1207
1207
|
}
|
|
1208
1208
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
return e === "maxLength" && ((_a2 = question.questionExtraAttribute) == null ? void 0 : _a2.answerMaxLength);
|
|
1213
|
-
}
|
|
1214
|
-
)) {
|
|
1215
|
-
if (question.answer.length > question.questionExtraAttribute.answerMaxLength) {
|
|
1216
|
-
error = true;
|
|
1217
|
-
}
|
|
1209
|
+
const maxLength = (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.answerMaxLength) != null ? _c : 1e3;
|
|
1210
|
+
if (((_d = question.validationType) == null ? void 0 : _d.includes("maxLength")) && question.answer.length > maxLength) {
|
|
1211
|
+
error = true;
|
|
1218
1212
|
}
|
|
1219
1213
|
if (question.questionType === "TextField") {
|
|
1220
1214
|
if (question.answer.length > 100) {
|
|
1221
1215
|
error = true;
|
|
1222
1216
|
}
|
|
1223
1217
|
}
|
|
1224
|
-
if (((
|
|
1218
|
+
if (((_e = question.validationType) == null ? void 0 : _e.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1225
1219
|
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1226
1220
|
if (!emailRegex.test(question.answer)) {
|
|
1227
1221
|
error = true;
|
|
1228
1222
|
}
|
|
1229
1223
|
}
|
|
1230
|
-
if (((
|
|
1224
|
+
if (((_f = question.validationType) == null ? void 0 : _f.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1231
1225
|
const fourNumbersRegex = /^\d{4}$/.test(question.answer);
|
|
1232
1226
|
if (!fourNumbersRegex) {
|
|
1233
1227
|
error = true;
|
|
1234
1228
|
}
|
|
1235
1229
|
}
|
|
1236
|
-
if (((
|
|
1230
|
+
if (((_g = question.validationType) == null ? void 0 : _g.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
|
|
1237
1231
|
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
1238
1232
|
if (!regex.test(question.answer)) {
|
|
1239
1233
|
error = true;
|
|
@@ -1247,7 +1241,7 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1247
1241
|
error = true;
|
|
1248
1242
|
}
|
|
1249
1243
|
}
|
|
1250
|
-
const groupCheckError = (
|
|
1244
|
+
const groupCheckError = (_h = question.validationType) == null ? void 0 : _h.find((e) => e.startsWith("groupCheck-"));
|
|
1251
1245
|
if (groupCheckError) {
|
|
1252
1246
|
const ids = groupCheckError.replace("groupCheck-", "").split("-");
|
|
1253
1247
|
const relatedAnswers = ids.map(
|