vee-validate 4.9.2 → 4.9.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vee-validate v4.9.2
2
+ * vee-validate v4.9.4
3
3
  * (c) 2023 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
@@ -1373,11 +1373,11 @@ function encodeNodeId(form, stateOrField) {
1373
1373
  const type = stateOrField ? ('path' in stateOrField ? 'pathState' : 'field') : 'form';
1374
1374
  const fieldPath = stateOrField ? ('path' in stateOrField ? stateOrField === null || stateOrField === void 0 ? void 0 : stateOrField.path : unref(stateOrField === null || stateOrField === void 0 ? void 0 : stateOrField.name)) : '';
1375
1375
  const idObject = { f: form === null || form === void 0 ? void 0 : form.formId, ff: fieldPath, type };
1376
- return btoa(JSON.stringify(idObject));
1376
+ return btoa(encodeURIComponent(JSON.stringify(idObject)));
1377
1377
  }
1378
1378
  function decodeNodeId(nodeId) {
1379
1379
  try {
1380
- const idObject = JSON.parse(atob(nodeId));
1380
+ const idObject = JSON.parse(decodeURIComponent(atob(nodeId)));
1381
1381
  const form = DEVTOOLS_FORMS[idObject.f];
1382
1382
  if (!form && idObject.ff) {
1383
1383
  const field = DEVTOOLS_FIELDS[idObject.ff];
@@ -1432,7 +1432,7 @@ function buildFieldState(state) {
1432
1432
  };
1433
1433
  }
1434
1434
  function buildFormState(form) {
1435
- const { errorBag, meta, values, isSubmitting, submitCount } = form;
1435
+ const { errorBag, meta, values, isSubmitting, isValidating, submitCount } = form;
1436
1436
  return {
1437
1437
  'Form state': [
1438
1438
  {
@@ -1443,6 +1443,10 @@ function buildFormState(form) {
1443
1443
  key: 'isSubmitting',
1444
1444
  value: isSubmitting.value,
1445
1445
  },
1446
+ {
1447
+ key: 'isValidating',
1448
+ value: isValidating.value,
1449
+ },
1446
1450
  {
1447
1451
  key: 'touched',
1448
1452
  value: meta.value.touched,
@@ -1576,10 +1580,7 @@ function _useField(path, rules, opts) {
1576
1580
  // Common input/change event handler
1577
1581
  function handleChange(e, shouldValidate = true) {
1578
1582
  const newValue = normalizeEventValue(e);
1579
- setValue(newValue, false);
1580
- if (!validateOnValueUpdate && shouldValidate) {
1581
- validateWithStateMutation();
1582
- }
1583
+ setValue(newValue, shouldValidate);
1583
1584
  }
1584
1585
  // Runs the initial validation
1585
1586
  onMounted(() => {
@@ -1608,12 +1609,13 @@ function _useField(path, rules, opts) {
1608
1609
  meta.validated = false;
1609
1610
  validateValidStateOnly();
1610
1611
  }
1611
- function setValue(newValue, validate = true) {
1612
+ function setValue(newValue, shouldValidate = true) {
1612
1613
  value.value = newValue;
1613
- if (!validate) {
1614
+ if (!shouldValidate) {
1615
+ validateValidStateOnly();
1614
1616
  return;
1615
1617
  }
1616
- const validateFn = validateOnValueUpdate ? validateWithStateMutation : validateValidStateOnly;
1618
+ const validateFn = shouldValidate ? validateWithStateMutation : validateValidStateOnly;
1617
1619
  validateFn();
1618
1620
  }
1619
1621
  function setErrors(errors) {
@@ -1862,7 +1864,7 @@ function getCurrentModelValue(vm, propName) {
1862
1864
  return vm.props[propName];
1863
1865
  }
1864
1866
 
1865
- const FieldImpl = defineComponent({
1867
+ const FieldImpl = /** #__PURE__ */ defineComponent({
1866
1868
  name: 'Field',
1867
1869
  inheritAttrs: false,
1868
1870
  props: {
@@ -1955,15 +1957,6 @@ const FieldImpl = defineComponent({
1955
1957
  handleChange(e, shouldValidate);
1956
1958
  ctx.emit('update:modelValue', value.value);
1957
1959
  };
1958
- const handleInput = (e) => {
1959
- if (!hasCheckedAttr(ctx.attrs.type)) {
1960
- value.value = normalizeEventValue(e);
1961
- }
1962
- };
1963
- const onInputHandler = function handleInputWithModel(e) {
1964
- handleInput(e);
1965
- ctx.emit('update:modelValue', value.value);
1966
- };
1967
1960
  const fieldProps = computed(() => {
1968
1961
  const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = resolveValidationTriggers(props);
1969
1962
  function baseOnBlur(e) {
@@ -2013,7 +2006,7 @@ const FieldImpl = defineComponent({
2013
2006
  validate: validateField,
2014
2007
  resetField,
2015
2008
  handleChange: onChangeHandler,
2016
- handleInput: onInputHandler,
2009
+ handleInput: e => onChangeHandler(e, false),
2017
2010
  handleReset,
2018
2011
  handleBlur,
2019
2012
  setTouched,
@@ -2081,6 +2074,8 @@ function useForm(opts) {
2081
2074
  let FIELD_ID_COUNTER = 0;
2082
2075
  // If the form is currently submitting
2083
2076
  const isSubmitting = ref(false);
2077
+ // If the form is currently validating
2078
+ const isValidating = ref(false);
2084
2079
  // The number of times the user tried to submit the form
2085
2080
  const submitCount = ref(0);
2086
2081
  // field arrays managed by this form
@@ -2095,7 +2090,9 @@ function useForm(opts) {
2095
2090
  function setFieldError(field, message) {
2096
2091
  const state = findPathState(field);
2097
2092
  if (!state) {
2098
- extraErrorsBag.value[field] = normalizeErrorItem(message);
2093
+ if (typeof field === 'string') {
2094
+ extraErrorsBag.value[field] = normalizeErrorItem(message);
2095
+ }
2099
2096
  return;
2100
2097
  }
2101
2098
  state.errors = normalizeErrorItem(message);
@@ -2241,11 +2238,11 @@ function useForm(opts) {
2241
2238
  // this ensures we have a complete key map of all the fields
2242
2239
  const paths = [
2243
2240
  ...new Set([...keysOf(formResult.results), ...pathStates.value.map(p => p.path), ...currentErrorsPaths]),
2244
- ];
2241
+ ].sort();
2245
2242
  // aggregates the paths into a single result object while applying the results on the fields
2246
2243
  return paths.reduce((validation, _path) => {
2247
2244
  const path = _path;
2248
- const pathState = findPathState(path);
2245
+ const pathState = findPathState(path) || findHoistedPath(path);
2249
2246
  const messages = (formResult.results[path] || { errors: [] }).errors;
2250
2247
  const fieldResult = {
2251
2248
  errors: messages,
@@ -2283,6 +2280,15 @@ function useForm(opts) {
2283
2280
  const pathState = typeof path === 'string' ? pathStates.value.find(state => state.path === path) : path;
2284
2281
  return pathState;
2285
2282
  }
2283
+ function findHoistedPath(path) {
2284
+ const candidates = pathStates.value.filter(state => path.startsWith(state.path));
2285
+ return candidates.reduce((bestCandidate, candidate) => {
2286
+ if (!bestCandidate) {
2287
+ return candidate;
2288
+ }
2289
+ return (candidate.path.length > bestCandidate.path.length ? candidate : bestCandidate);
2290
+ }, undefined);
2291
+ }
2286
2292
  let UNSET_BATCH = [];
2287
2293
  let PENDING_UNSET;
2288
2294
  function unsetPathValue(path) {
@@ -2395,6 +2401,7 @@ function useForm(opts) {
2395
2401
  submitCount,
2396
2402
  meta,
2397
2403
  isSubmitting,
2404
+ isValidating,
2398
2405
  fieldArrays,
2399
2406
  keepValuesOnUnmount,
2400
2407
  validateSchema: unref(schema) ? validateSchema : undefined,
@@ -2517,6 +2524,7 @@ function useForm(opts) {
2517
2524
  if (formCtx.validateSchema) {
2518
2525
  return formCtx.validateSchema(mode);
2519
2526
  }
2527
+ isValidating.value = true;
2520
2528
  // No schema, each field is responsible to validate itself
2521
2529
  const validations = await Promise.all(pathStates.value.map(state => {
2522
2530
  if (!state.validate) {
@@ -2534,6 +2542,7 @@ function useForm(opts) {
2534
2542
  };
2535
2543
  });
2536
2544
  }));
2545
+ isValidating.value = false;
2537
2546
  const results = {};
2538
2547
  const errors = {};
2539
2548
  for (const validation of validations) {
@@ -2589,12 +2598,14 @@ function useForm(opts) {
2589
2598
  if (!schemaValue) {
2590
2599
  return { valid: true, results: {}, errors: {} };
2591
2600
  }
2601
+ isValidating.value = true;
2592
2602
  const formResult = isYupValidator(schemaValue) || isTypedSchema(schemaValue)
2593
2603
  ? await validateTypedSchema(schemaValue, formValues)
2594
2604
  : await validateObjectSchema(schemaValue, formValues, {
2595
2605
  names: fieldNames.value,
2596
2606
  bailsMap: fieldBailsMap.value,
2597
2607
  });
2608
+ isValidating.value = false;
2598
2609
  return formResult;
2599
2610
  }
2600
2611
  const submitForm = handleSubmit((_, { evt }) => {
@@ -2631,7 +2642,7 @@ function useForm(opts) {
2631
2642
  provide(FormContextKey, formCtx);
2632
2643
  if ((process.env.NODE_ENV !== 'production')) {
2633
2644
  registerFormWithDevTools(formCtx);
2634
- watch(() => (Object.assign(Object.assign({ errors: errorBag.value }, meta.value), { values: formValues, isSubmitting: isSubmitting.value, submitCount: submitCount.value })), refreshInspector, {
2645
+ watch(() => (Object.assign(Object.assign({ errors: errorBag.value }, meta.value), { values: formValues, isSubmitting: isSubmitting.value, isValidating: isValidating.value, submitCount: submitCount.value })), refreshInspector, {
2635
2646
  deep: true,
2636
2647
  });
2637
2648
  }
@@ -2786,7 +2797,9 @@ function useFormInitialValues(pathsState, formValues, opts) {
2786
2797
  }
2787
2798
  if (isRef(providedValues)) {
2788
2799
  watch(providedValues, value => {
2789
- setInitialValues(value, true);
2800
+ if (value) {
2801
+ setInitialValues(value, true);
2802
+ }
2790
2803
  }, {
2791
2804
  deep: true,
2792
2805
  });
@@ -2798,7 +2811,7 @@ function useFormInitialValues(pathsState, formValues, opts) {
2798
2811
  };
2799
2812
  }
2800
2813
 
2801
- const FormImpl = defineComponent({
2814
+ const FormImpl = /** #__PURE__ */ defineComponent({
2802
2815
  name: 'Form',
2803
2816
  inheritAttrs: false,
2804
2817
  props: {
@@ -2843,7 +2856,7 @@ const FormImpl = defineComponent({
2843
2856
  const initialValues = toRef(props, 'initialValues');
2844
2857
  const validationSchema = toRef(props, 'validationSchema');
2845
2858
  const keepValues = toRef(props, 'keepValues');
2846
- const { errors, errorBag, values, meta, isSubmitting, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2859
+ const { errors, errorBag, values, meta, isSubmitting, isValidating, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2847
2860
  validationSchema: validationSchema.value ? validationSchema : undefined,
2848
2861
  initialValues,
2849
2862
  initialErrors: props.initialErrors,
@@ -2887,6 +2900,7 @@ const FormImpl = defineComponent({
2887
2900
  errorBag: errorBag.value,
2888
2901
  values,
2889
2902
  isSubmitting: isSubmitting.value,
2903
+ isValidating: isValidating.value,
2890
2904
  submitCount: submitCount.value,
2891
2905
  controlledValues: controlledValues.value,
2892
2906
  validate,
@@ -3166,7 +3180,7 @@ function useFieldArray(arrayPath) {
3166
3180
  return fieldArrayCtx;
3167
3181
  }
3168
3182
 
3169
- const FieldArrayImpl = defineComponent({
3183
+ const FieldArrayImpl = /** #__PURE__ */ defineComponent({
3170
3184
  name: 'FieldArray',
3171
3185
  inheritAttrs: false,
3172
3186
  props: {
@@ -3208,7 +3222,7 @@ const FieldArrayImpl = defineComponent({
3208
3222
  });
3209
3223
  const FieldArray = FieldArrayImpl;
3210
3224
 
3211
- const ErrorMessageImpl = defineComponent({
3225
+ const ErrorMessageImpl = /** #__PURE__ */ defineComponent({
3212
3226
  name: 'ErrorMessage',
3213
3227
  props: {
3214
3228
  as: {
@@ -3323,6 +3337,20 @@ function useIsSubmitting() {
3323
3337
  });
3324
3338
  }
3325
3339
 
3340
+ /**
3341
+ * If the form is validating or not
3342
+ */
3343
+ function useIsValidating() {
3344
+ const form = injectWithSelf(FormContextKey);
3345
+ if (!form) {
3346
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
3347
+ }
3348
+ return computed(() => {
3349
+ var _a;
3350
+ return (_a = form === null || form === void 0 ? void 0 : form.isValidating.value) !== null && _a !== void 0 ? _a : false;
3351
+ });
3352
+ }
3353
+
3326
3354
  /**
3327
3355
  * Validates a single field
3328
3356
  */
@@ -3486,4 +3514,4 @@ function useSubmitForm(cb) {
3486
3514
  };
3487
3515
  }
3488
3516
 
3489
- export { ErrorMessage, Field, FieldArray, FieldContextKey, Form, FormContextKey, IS_ABSENT, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };
3517
+ export { ErrorMessage, Field, FieldArray, FieldContextKey, Form, FormContextKey, IS_ABSENT, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useIsValidating, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vee-validate v4.9.2
2
+ * vee-validate v4.9.4
3
3
  * (c) 2023 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
@@ -1182,10 +1182,7 @@
1182
1182
  // Common input/change event handler
1183
1183
  function handleChange(e, shouldValidate = true) {
1184
1184
  const newValue = normalizeEventValue(e);
1185
- setValue(newValue, false);
1186
- if (!validateOnValueUpdate && shouldValidate) {
1187
- validateWithStateMutation();
1188
- }
1185
+ setValue(newValue, shouldValidate);
1189
1186
  }
1190
1187
  // Runs the initial validation
1191
1188
  vue.onMounted(() => {
@@ -1214,12 +1211,13 @@
1214
1211
  meta.validated = false;
1215
1212
  validateValidStateOnly();
1216
1213
  }
1217
- function setValue(newValue, validate = true) {
1214
+ function setValue(newValue, shouldValidate = true) {
1218
1215
  value.value = newValue;
1219
- if (!validate) {
1216
+ if (!shouldValidate) {
1217
+ validateValidStateOnly();
1220
1218
  return;
1221
1219
  }
1222
- const validateFn = validateOnValueUpdate ? validateWithStateMutation : validateValidStateOnly;
1220
+ const validateFn = shouldValidate ? validateWithStateMutation : validateValidStateOnly;
1223
1221
  validateFn();
1224
1222
  }
1225
1223
  function setErrors(errors) {
@@ -1446,7 +1444,7 @@
1446
1444
  return vm.props[propName];
1447
1445
  }
1448
1446
 
1449
- const FieldImpl = vue.defineComponent({
1447
+ const FieldImpl = /** #__PURE__ */ vue.defineComponent({
1450
1448
  name: 'Field',
1451
1449
  inheritAttrs: false,
1452
1450
  props: {
@@ -1539,15 +1537,6 @@
1539
1537
  handleChange(e, shouldValidate);
1540
1538
  ctx.emit('update:modelValue', value.value);
1541
1539
  };
1542
- const handleInput = (e) => {
1543
- if (!hasCheckedAttr(ctx.attrs.type)) {
1544
- value.value = normalizeEventValue(e);
1545
- }
1546
- };
1547
- const onInputHandler = function handleInputWithModel(e) {
1548
- handleInput(e);
1549
- ctx.emit('update:modelValue', value.value);
1550
- };
1551
1540
  const fieldProps = vue.computed(() => {
1552
1541
  const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = resolveValidationTriggers(props);
1553
1542
  function baseOnBlur(e) {
@@ -1597,7 +1586,7 @@
1597
1586
  validate: validateField,
1598
1587
  resetField,
1599
1588
  handleChange: onChangeHandler,
1600
- handleInput: onInputHandler,
1589
+ handleInput: e => onChangeHandler(e, false),
1601
1590
  handleReset,
1602
1591
  handleBlur,
1603
1592
  setTouched,
@@ -1665,6 +1654,8 @@
1665
1654
  let FIELD_ID_COUNTER = 0;
1666
1655
  // If the form is currently submitting
1667
1656
  const isSubmitting = vue.ref(false);
1657
+ // If the form is currently validating
1658
+ const isValidating = vue.ref(false);
1668
1659
  // The number of times the user tried to submit the form
1669
1660
  const submitCount = vue.ref(0);
1670
1661
  // field arrays managed by this form
@@ -1679,7 +1670,9 @@
1679
1670
  function setFieldError(field, message) {
1680
1671
  const state = findPathState(field);
1681
1672
  if (!state) {
1682
- extraErrorsBag.value[field] = normalizeErrorItem(message);
1673
+ if (typeof field === 'string') {
1674
+ extraErrorsBag.value[field] = normalizeErrorItem(message);
1675
+ }
1683
1676
  return;
1684
1677
  }
1685
1678
  state.errors = normalizeErrorItem(message);
@@ -1825,11 +1818,11 @@
1825
1818
  // this ensures we have a complete key map of all the fields
1826
1819
  const paths = [
1827
1820
  ...new Set([...keysOf(formResult.results), ...pathStates.value.map(p => p.path), ...currentErrorsPaths]),
1828
- ];
1821
+ ].sort();
1829
1822
  // aggregates the paths into a single result object while applying the results on the fields
1830
1823
  return paths.reduce((validation, _path) => {
1831
1824
  const path = _path;
1832
- const pathState = findPathState(path);
1825
+ const pathState = findPathState(path) || findHoistedPath(path);
1833
1826
  const messages = (formResult.results[path] || { errors: [] }).errors;
1834
1827
  const fieldResult = {
1835
1828
  errors: messages,
@@ -1867,6 +1860,15 @@
1867
1860
  const pathState = typeof path === 'string' ? pathStates.value.find(state => state.path === path) : path;
1868
1861
  return pathState;
1869
1862
  }
1863
+ function findHoistedPath(path) {
1864
+ const candidates = pathStates.value.filter(state => path.startsWith(state.path));
1865
+ return candidates.reduce((bestCandidate, candidate) => {
1866
+ if (!bestCandidate) {
1867
+ return candidate;
1868
+ }
1869
+ return (candidate.path.length > bestCandidate.path.length ? candidate : bestCandidate);
1870
+ }, undefined);
1871
+ }
1870
1872
  let UNSET_BATCH = [];
1871
1873
  let PENDING_UNSET;
1872
1874
  function unsetPathValue(path) {
@@ -1979,6 +1981,7 @@
1979
1981
  submitCount,
1980
1982
  meta,
1981
1983
  isSubmitting,
1984
+ isValidating,
1982
1985
  fieldArrays,
1983
1986
  keepValuesOnUnmount,
1984
1987
  validateSchema: vue.unref(schema) ? validateSchema : undefined,
@@ -2101,6 +2104,7 @@
2101
2104
  if (formCtx.validateSchema) {
2102
2105
  return formCtx.validateSchema(mode);
2103
2106
  }
2107
+ isValidating.value = true;
2104
2108
  // No schema, each field is responsible to validate itself
2105
2109
  const validations = await Promise.all(pathStates.value.map(state => {
2106
2110
  if (!state.validate) {
@@ -2118,6 +2122,7 @@
2118
2122
  };
2119
2123
  });
2120
2124
  }));
2125
+ isValidating.value = false;
2121
2126
  const results = {};
2122
2127
  const errors = {};
2123
2128
  for (const validation of validations) {
@@ -2173,12 +2178,14 @@
2173
2178
  if (!schemaValue) {
2174
2179
  return { valid: true, results: {}, errors: {} };
2175
2180
  }
2181
+ isValidating.value = true;
2176
2182
  const formResult = isYupValidator(schemaValue) || isTypedSchema(schemaValue)
2177
2183
  ? await validateTypedSchema(schemaValue, formValues)
2178
2184
  : await validateObjectSchema(schemaValue, formValues, {
2179
2185
  names: fieldNames.value,
2180
2186
  bailsMap: fieldBailsMap.value,
2181
2187
  });
2188
+ isValidating.value = false;
2182
2189
  return formResult;
2183
2190
  }
2184
2191
  const submitForm = handleSubmit((_, { evt }) => {
@@ -2364,7 +2371,9 @@
2364
2371
  }
2365
2372
  if (vue.isRef(providedValues)) {
2366
2373
  vue.watch(providedValues, value => {
2367
- setInitialValues(value, true);
2374
+ if (value) {
2375
+ setInitialValues(value, true);
2376
+ }
2368
2377
  }, {
2369
2378
  deep: true,
2370
2379
  });
@@ -2376,7 +2385,7 @@
2376
2385
  };
2377
2386
  }
2378
2387
 
2379
- const FormImpl = vue.defineComponent({
2388
+ const FormImpl = /** #__PURE__ */ vue.defineComponent({
2380
2389
  name: 'Form',
2381
2390
  inheritAttrs: false,
2382
2391
  props: {
@@ -2421,7 +2430,7 @@
2421
2430
  const initialValues = vue.toRef(props, 'initialValues');
2422
2431
  const validationSchema = vue.toRef(props, 'validationSchema');
2423
2432
  const keepValues = vue.toRef(props, 'keepValues');
2424
- const { errors, errorBag, values, meta, isSubmitting, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2433
+ const { errors, errorBag, values, meta, isSubmitting, isValidating, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2425
2434
  validationSchema: validationSchema.value ? validationSchema : undefined,
2426
2435
  initialValues,
2427
2436
  initialErrors: props.initialErrors,
@@ -2465,6 +2474,7 @@
2465
2474
  errorBag: errorBag.value,
2466
2475
  values,
2467
2476
  isSubmitting: isSubmitting.value,
2477
+ isValidating: isValidating.value,
2468
2478
  submitCount: submitCount.value,
2469
2479
  controlledValues: controlledValues.value,
2470
2480
  validate,
@@ -2744,7 +2754,7 @@
2744
2754
  return fieldArrayCtx;
2745
2755
  }
2746
2756
 
2747
- const FieldArrayImpl = vue.defineComponent({
2757
+ const FieldArrayImpl = /** #__PURE__ */ vue.defineComponent({
2748
2758
  name: 'FieldArray',
2749
2759
  inheritAttrs: false,
2750
2760
  props: {
@@ -2786,7 +2796,7 @@
2786
2796
  });
2787
2797
  const FieldArray = FieldArrayImpl;
2788
2798
 
2789
- const ErrorMessageImpl = vue.defineComponent({
2799
+ const ErrorMessageImpl = /** #__PURE__ */ vue.defineComponent({
2790
2800
  name: 'ErrorMessage',
2791
2801
  props: {
2792
2802
  as: {
@@ -2901,6 +2911,20 @@
2901
2911
  });
2902
2912
  }
2903
2913
 
2914
+ /**
2915
+ * If the form is validating or not
2916
+ */
2917
+ function useIsValidating() {
2918
+ const form = injectWithSelf(FormContextKey);
2919
+ if (!form) {
2920
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
2921
+ }
2922
+ return vue.computed(() => {
2923
+ var _a;
2924
+ return (_a = form === null || form === void 0 ? void 0 : form.isValidating.value) !== null && _a !== void 0 ? _a : false;
2925
+ });
2926
+ }
2927
+
2904
2928
  /**
2905
2929
  * Validates a single field
2906
2930
  */
@@ -3087,6 +3111,7 @@
3087
3111
  exports.useIsFormTouched = useIsFormTouched;
3088
3112
  exports.useIsFormValid = useIsFormValid;
3089
3113
  exports.useIsSubmitting = useIsSubmitting;
3114
+ exports.useIsValidating = useIsValidating;
3090
3115
  exports.useResetForm = useResetForm;
3091
3116
  exports.useSubmitCount = useSubmitCount;
3092
3117
  exports.useSubmitForm = useSubmitForm;