@teamnovu/kit-vue-forms 0.1.3 → 0.1.4
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 +6 -3
- package/dist/utils/rc.d.ts +3 -0
- package/package.json +1 -1
- package/src/composables/useValidation.ts +7 -3
- package/src/utils/rc.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -286,8 +286,11 @@ function he(r, e) {
|
|
|
286
286
|
errors: f(e.errors) ?? m.errors
|
|
287
287
|
});
|
|
288
288
|
F(() => f(e.errors), async () => {
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
if (t.isValidated) {
|
|
290
|
+
const l = await o();
|
|
291
|
+
n(l.errors);
|
|
292
|
+
} else
|
|
293
|
+
n();
|
|
291
294
|
}, { immediate: !0 }), F(
|
|
292
295
|
[() => t.validators],
|
|
293
296
|
async (l) => {
|
|
@@ -324,7 +327,7 @@ function he(r, e) {
|
|
|
324
327
|
isValid: c
|
|
325
328
|
};
|
|
326
329
|
}
|
|
327
|
-
const n = (l) => {
|
|
330
|
+
const n = (l = m.errors) => {
|
|
328
331
|
t.errors = S(f(e.errors) ?? m.errors, l);
|
|
329
332
|
}, h = async () => {
|
|
330
333
|
const l = await o();
|
package/dist/utils/rc.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -124,9 +124,13 @@ export function useValidation<T extends FormDataDefault>(
|
|
|
124
124
|
|
|
125
125
|
// Watch for changes in the error bag and update validation state
|
|
126
126
|
watch(() => unref(options.errors), async () => {
|
|
127
|
-
|
|
127
|
+
if (validationState.isValidated) {
|
|
128
|
+
const validationResults = await getValidationResults()
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
updateErrors(validationResults.errors)
|
|
131
|
+
} else {
|
|
132
|
+
updateErrors()
|
|
133
|
+
}
|
|
130
134
|
}, { immediate: true })
|
|
131
135
|
|
|
132
136
|
// Watch for changes in validation function or schema
|
|
@@ -194,7 +198,7 @@ export function useValidation<T extends FormDataDefault>(
|
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
200
|
|
|
197
|
-
const updateErrors = (newErrors: ErrorBag) => {
|
|
201
|
+
const updateErrors = (newErrors: ErrorBag = SuccessValidationResult.errors) => {
|
|
198
202
|
validationState.errors = mergeErrors(unref(options.errors) ?? SuccessValidationResult.errors, newErrors)
|
|
199
203
|
}
|
|
200
204
|
|