admin_lsac 2.0.5 → 2.0.6
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/admin_lsac.d.ts
CHANGED
|
@@ -9,12 +9,14 @@ function parseValidation(fields) {
|
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
11
|
return fields.reduce((acc, field) => {
|
|
12
|
-
if (field.type !== '
|
|
13
|
-
acc[field.name] = field.validationSchema;
|
|
12
|
+
if (field.type !== 'object' && field.type !== 'array') {
|
|
13
|
+
acc[field.name] = field.validationSchema ? field.validationSchema : '';
|
|
14
14
|
}
|
|
15
15
|
else if (field.type === 'array') {
|
|
16
16
|
if (field.element.type === 'dropdown') {
|
|
17
|
-
acc[field.name] =
|
|
17
|
+
acc[field.name] = field.element.validationSchema
|
|
18
|
+
? Yup.array().of(field.element.validationSchema)
|
|
19
|
+
: '';
|
|
18
20
|
}
|
|
19
21
|
else if (field.element.type === 'object') {
|
|
20
22
|
acc[field.name] = Yup.array().of(Yup.object(parseValidation(field.element.fields)));
|
|
@@ -26,9 +28,6 @@ function parseValidation(fields) {
|
|
|
26
28
|
else if (field.type === 'object') {
|
|
27
29
|
acc[field.name] = Yup.object(parseValidation(field.fields));
|
|
28
30
|
}
|
|
29
|
-
if (field.type === 'dropdown') {
|
|
30
|
-
acc[field.name] = Yup.string().required();
|
|
31
|
-
}
|
|
32
31
|
return acc;
|
|
33
32
|
}, {});
|
|
34
33
|
}
|
package/dist/esm/src/schema.d.ts
CHANGED