@juantroconisf/lib 2.3.5 → 2.3.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/dist/index.js +1 -6
- package/dist/index.mjs +1 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -158,12 +158,7 @@ function useValidation() {
|
|
|
158
158
|
const { lang } = useComponentLanguage();
|
|
159
159
|
const getValidation = (value, isTouched, types, errorMessages) => {
|
|
160
160
|
const items = Object.entries(types), requiredIndex = items.findIndex(([key]) => key === "required"), isRequired = requiredIndex === -1 ? false : items[requiredIndex][1];
|
|
161
|
-
if (
|
|
162
|
-
return {
|
|
163
|
-
isValid: true,
|
|
164
|
-
validationProps: nxError()
|
|
165
|
-
};
|
|
166
|
-
if (value === "" && !isRequired)
|
|
161
|
+
if (value === "" && !isRequired || !isTouched)
|
|
167
162
|
return { isValid: true, validationProps: nxError() };
|
|
168
163
|
const validations = items.map(([name, opts]) => {
|
|
169
164
|
const { validate, msg: msg2 } = errors[name];
|
package/dist/index.mjs
CHANGED
|
@@ -140,12 +140,7 @@ function useValidation() {
|
|
|
140
140
|
const { lang } = useComponentLanguage();
|
|
141
141
|
const getValidation = (value, isTouched, types, errorMessages) => {
|
|
142
142
|
const items = Object.entries(types), requiredIndex = items.findIndex(([key]) => key === "required"), isRequired = requiredIndex === -1 ? false : items[requiredIndex][1];
|
|
143
|
-
if (
|
|
144
|
-
return {
|
|
145
|
-
isValid: true,
|
|
146
|
-
validationProps: nxError()
|
|
147
|
-
};
|
|
148
|
-
if (value === "" && !isRequired)
|
|
143
|
+
if (value === "" && !isRequired || !isTouched)
|
|
149
144
|
return { isValid: true, validationProps: nxError() };
|
|
150
145
|
const validations = items.map(([name, opts]) => {
|
|
151
146
|
const { validate, msg: msg2 } = errors[name];
|