vee-validate 4.12.0-alpha.1 → 4.12.0

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.12.0-alpha.1
2
+ * vee-validate v4.12.0
3
3
  * (c) 2023 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
@@ -487,8 +487,7 @@
487
487
  return result;
488
488
  }
489
489
  latestRun = undefined;
490
- onDone(result, args);
491
- return result;
490
+ return onDone(result, args);
492
491
  };
493
492
  }
494
493
  function computedDeep({ get, set }) {
@@ -990,7 +989,7 @@
990
989
  if (!init.form) {
991
990
  const { errors, setErrors } = createFieldErrors();
992
991
  const id = ID_COUNTER >= Number.MAX_SAFE_INTEGER ? 0 : ++ID_COUNTER;
993
- const meta = createFieldMeta(value, initialValue, errors);
992
+ const meta = createFieldMeta(value, initialValue, errors, init.schema);
994
993
  function setState(state) {
995
994
  var _a;
996
995
  if ('value' in state) {
@@ -1022,6 +1021,7 @@
1022
1021
  label: init.label,
1023
1022
  type: init.type,
1024
1023
  validate: init.validate,
1024
+ schema: init.schema,
1025
1025
  });
1026
1026
  const errors = vue.computed(() => state.errors);
1027
1027
  function setState(state) {
@@ -1117,11 +1117,14 @@
1117
1117
  /**
1118
1118
  * Creates meta flags state and some associated effects with them
1119
1119
  */
1120
- function createFieldMeta(currentValue, initialValue, errors) {
1120
+ function createFieldMeta(currentValue, initialValue, errors, schema) {
1121
+ var _a, _b;
1122
+ const isRequired = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.describe) === null || _a === void 0 ? void 0 : _a.call(schema).required) !== null && _b !== void 0 ? _b : false;
1121
1123
  const meta = vue.reactive({
1122
1124
  touched: false,
1123
1125
  pending: false,
1124
1126
  valid: true,
1127
+ required: isRequired,
1125
1128
  validated: !!vue.unref(errors).length,
1126
1129
  initialValue: vue.computed(() => vue.unref(initialValue)),
1127
1130
  dirty: vue.computed(() => {
@@ -1184,6 +1187,7 @@
1184
1187
  label,
1185
1188
  type,
1186
1189
  validate: validator.value ? validate$1 : undefined,
1190
+ schema: isTypedSchema(rules) ? rules : undefined,
1187
1191
  });
1188
1192
  const errorMessage = vue.computed(() => errors.value[0]);
1189
1193
  if (syncVModel) {
@@ -1206,7 +1210,8 @@
1206
1210
  async function validateCurrentValue(mode) {
1207
1211
  var _a, _b;
1208
1212
  if (form === null || form === void 0 ? void 0 : form.validateSchema) {
1209
- return (_a = (await form.validateSchema(mode)).results[vue.toValue(name)]) !== null && _a !== void 0 ? _a : { valid: true, errors: [] };
1213
+ const { results } = await form.validateSchema(mode);
1214
+ return (_a = results[vue.toValue(name)]) !== null && _a !== void 0 ? _a : { valid: true, errors: [] };
1210
1215
  }
1211
1216
  if (validator.value) {
1212
1217
  return validate(value.value, validator.value, {
@@ -1224,7 +1229,7 @@
1224
1229
  return validateCurrentValue('validated-only');
1225
1230
  }, result => {
1226
1231
  if (flags.pendingUnmount[field.id]) {
1227
- return;
1232
+ return result;
1228
1233
  }
1229
1234
  setState({ errors: result.errors });
1230
1235
  meta.pending = false;
@@ -1660,6 +1665,10 @@
1660
1665
  };
1661
1666
  }
1662
1667
  ctx.expose({
1668
+ value,
1669
+ meta,
1670
+ errors,
1671
+ errorMessage,
1663
1672
  setErrors,
1664
1673
  setTouched,
1665
1674
  reset: resetField,
@@ -1706,7 +1715,7 @@
1706
1715
  let FORM_COUNTER = 0;
1707
1716
  const PRIVATE_PATH_STATE_KEYS = ['bails', 'fieldsCount', 'id', 'multiple', 'type', 'validate'];
1708
1717
  function resolveInitialValues(opts) {
1709
- const providedValues = vue.unref(opts === null || opts === void 0 ? void 0 : opts.initialValues) || {};
1718
+ const providedValues = (opts === null || opts === void 0 ? void 0 : opts.initialValues) || {};
1710
1719
  const schema = vue.unref(opts === null || opts === void 0 ? void 0 : opts.validationSchema);
1711
1720
  if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
1712
1721
  return klona(schema.cast(providedValues) || {});
@@ -1824,10 +1833,9 @@
1824
1833
  var _a, _b;
1825
1834
  const initialValue = vue.computed(() => getFromPath(initialValues.value, vue.toValue(path)));
1826
1835
  const pathStateExists = pathStateLookup.value[vue.toValue(path)];
1827
- if (pathStateExists) {
1828
- if ((config === null || config === void 0 ? void 0 : config.type) === 'checkbox' || (config === null || config === void 0 ? void 0 : config.type) === 'radio') {
1829
- pathStateExists.multiple = true;
1830
- }
1836
+ const isCheckboxOrRadio = (config === null || config === void 0 ? void 0 : config.type) === 'checkbox' || (config === null || config === void 0 ? void 0 : config.type) === 'radio';
1837
+ if (pathStateExists && isCheckboxOrRadio) {
1838
+ pathStateExists.multiple = true;
1831
1839
  const id = FIELD_ID_COUNTER++;
1832
1840
  if (Array.isArray(pathStateExists.id)) {
1833
1841
  pathStateExists.id.push(id);
@@ -1841,6 +1849,17 @@
1841
1849
  }
1842
1850
  const currentValue = vue.computed(() => getFromPath(formValues, vue.toValue(path)));
1843
1851
  const pathValue = vue.toValue(path);
1852
+ const isRequired = vue.computed(() => {
1853
+ var _a, _b, _c, _d, _e, _f;
1854
+ if (isTypedSchema(schema)) {
1855
+ return (_c = (_b = (_a = schema).describe) === null || _b === void 0 ? void 0 : _b.call(_a, vue.toValue(path)).required) !== null && _c !== void 0 ? _c : false;
1856
+ }
1857
+ // Path own schema
1858
+ if (isTypedSchema(config === null || config === void 0 ? void 0 : config.schema)) {
1859
+ return (_f = (_e = (_d = (config === null || config === void 0 ? void 0 : config.schema)).describe) === null || _e === void 0 ? void 0 : _e.call(_d).required) !== null && _f !== void 0 ? _f : false;
1860
+ }
1861
+ return false;
1862
+ });
1844
1863
  const id = FIELD_ID_COUNTER++;
1845
1864
  const state = vue.reactive({
1846
1865
  id,
@@ -1849,6 +1868,7 @@
1849
1868
  pending: false,
1850
1869
  valid: true,
1851
1870
  validated: !!((_a = initialErrors[pathValue]) === null || _a === void 0 ? void 0 : _a.length),
1871
+ required: isRequired,
1852
1872
  initialValue,
1853
1873
  errors: vue.shallowRef([]),
1854
1874
  bails: (_b = config === null || config === void 0 ? void 0 : config.bails) !== null && _b !== void 0 ? _b : false,
@@ -1894,7 +1914,9 @@
1894
1914
  const debouncedSilentValidation = debounceAsync(_validateSchema, 5);
1895
1915
  const debouncedValidation = debounceAsync(_validateSchema, 5);
1896
1916
  const validateSchema = withLatest(async (mode) => {
1897
- return (await mode) === 'silent' ? debouncedSilentValidation() : debouncedValidation();
1917
+ return (await (mode === 'silent'
1918
+ ? debouncedSilentValidation()
1919
+ : debouncedValidation()));
1898
1920
  }, (formResult, [mode]) => {
1899
1921
  // fields by id lookup
1900
1922
  // errors fields names, we need it to also check if custom errors are updated
@@ -1905,14 +1927,16 @@
1905
1927
  ...new Set([...keysOf(formResult.results), ...pathStates.value.map(p => p.path), ...currentErrorsPaths]),
1906
1928
  ].sort();
1907
1929
  // aggregates the paths into a single result object while applying the results on the fields
1908
- return paths.reduce((validation, _path) => {
1909
- const path = _path;
1910
- const pathState = findPathState(path) || findHoistedPath(path);
1911
- const messages = (formResult.results[path] || { errors: [] }).errors;
1912
- const fieldResult = {
1913
- errors: messages,
1914
- valid: !messages.length,
1915
- };
1930
+ const results = paths.reduce((validation, _path) => {
1931
+ var _a;
1932
+ const expectedPath = _path;
1933
+ const pathState = findPathState(expectedPath) || findHoistedPath(expectedPath);
1934
+ const messages = ((_a = formResult.results[expectedPath]) === null || _a === void 0 ? void 0 : _a.errors) || [];
1935
+ // This is the real path of the field, because it might've been a hoisted field
1936
+ const path = (vue.toValue(pathState === null || pathState === void 0 ? void 0 : pathState.path) || expectedPath);
1937
+ // It is possible that multiple paths are collected across loops
1938
+ // We want to merge them to avoid overriding any iteration's results
1939
+ const fieldResult = mergeValidationResults({ errors: messages, valid: !messages.length }, validation.results[path]);
1916
1940
  validation.results[path] = fieldResult;
1917
1941
  if (!fieldResult.valid) {
1918
1942
  validation.errors[path] = fieldResult.errors[0];
@@ -1937,6 +1961,7 @@
1937
1961
  setFieldError(pathState, fieldResult.errors);
1938
1962
  return validation;
1939
1963
  }, { valid: formResult.valid, results: {}, errors: {} });
1964
+ return results;
1940
1965
  });
1941
1966
  function mutateAllPathState(mutation) {
1942
1967
  pathStates.value.forEach(mutation);
@@ -2053,14 +2078,16 @@
2053
2078
  delete pathStateLookup.value[path];
2054
2079
  }
2055
2080
  }
2056
- function markForUnmount(path) {
2057
- return mutateAllPathState(s => {
2058
- if (s.path.startsWith(path)) {
2059
- keysOf(s.__flags.pendingUnmount).forEach(id => {
2060
- s.__flags.pendingUnmount[id] = true;
2061
- });
2081
+ function destroyPath(path) {
2082
+ keysOf(pathStateLookup.value).forEach(key => {
2083
+ if (key.startsWith(path)) {
2084
+ delete pathStateLookup.value[key];
2062
2085
  }
2063
2086
  });
2087
+ pathStates.value = pathStates.value.filter(s => !s.path.startsWith(path));
2088
+ vue.nextTick(() => {
2089
+ rebuildPathLookup();
2090
+ });
2064
2091
  }
2065
2092
  const formCtx = {
2066
2093
  formId,
@@ -2087,6 +2114,10 @@
2087
2114
  resetForm,
2088
2115
  resetField,
2089
2116
  handleSubmit,
2117
+ useFieldModel,
2118
+ defineInputBinds,
2119
+ defineComponentBinds: defineComponentBinds,
2120
+ defineField,
2090
2121
  stageInitialValue,
2091
2122
  unsetInitialValue,
2092
2123
  setFieldInitialValue,
@@ -2096,7 +2127,7 @@
2096
2127
  removePathState,
2097
2128
  initialValues: initialValues,
2098
2129
  getAllPathStates: () => pathStates.value,
2099
- markForUnmount,
2130
+ destroyPath,
2100
2131
  isFieldTouched,
2101
2132
  isFieldDirty,
2102
2133
  isFieldValid,
@@ -2209,7 +2240,7 @@
2209
2240
  * Resets all fields
2210
2241
  */
2211
2242
  function resetForm(resetState, opts) {
2212
- let newValues = (resetState === null || resetState === void 0 ? void 0 : resetState.values) ? resetState.values : originalInitialValues.value;
2243
+ let newValues = klona((resetState === null || resetState === void 0 ? void 0 : resetState.values) ? resetState.values : originalInitialValues.value);
2213
2244
  newValues = isTypedSchema(schema) && isCallable(schema.cast) ? schema.cast(newValues) : newValues;
2214
2245
  setInitialValues(newValues);
2215
2246
  mutateAllPathState(state => {
@@ -2354,7 +2385,8 @@
2354
2385
  // Provide injections
2355
2386
  vue.provide(FormContextKey, formCtx);
2356
2387
  function defineField(path, config) {
2357
- const pathState = (findPathState(vue.toValue(path)) || createPathState(path));
2388
+ const label = isCallable(config) ? undefined : config === null || config === void 0 ? void 0 : config.label;
2389
+ const pathState = (findPathState(vue.toValue(path)) || createPathState(path, { label }));
2358
2390
  const evalConfig = () => (isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {});
2359
2391
  function onBlur() {
2360
2392
  var _a;
@@ -2396,10 +2428,54 @@
2396
2428
  }
2397
2429
  return base;
2398
2430
  });
2399
- return [createModel(path, () => { var _a; return (_a = evalConfig().validateOnModelUpdate) !== null && _a !== void 0 ? _a : true; }), props];
2431
+ const model = createModel(path, () => { var _a; return (_a = evalConfig().validateOnModelUpdate) !== null && _a !== void 0 ? _a : true; });
2432
+ return [model, props];
2433
+ }
2434
+ function useFieldModel(pathOrPaths) {
2435
+ if (!Array.isArray(pathOrPaths)) {
2436
+ return createModel(pathOrPaths);
2437
+ }
2438
+ return pathOrPaths.map(p => createModel(p, true));
2439
+ }
2440
+ /**
2441
+ * @deprecated use defineField instead
2442
+ */
2443
+ function defineInputBinds(path, config) {
2444
+ const [model, props] = defineField(path, config);
2445
+ function onBlur(e) {
2446
+ props.value.onBlur(e);
2447
+ }
2448
+ function onInput(e) {
2449
+ const value = normalizeEventValue(e);
2450
+ setFieldValue(vue.toValue(path), value, false);
2451
+ props.value.onInput(e);
2452
+ }
2453
+ function onChange(e) {
2454
+ const value = normalizeEventValue(e);
2455
+ setFieldValue(vue.toValue(path), value, false);
2456
+ props.value.onChange(e);
2457
+ }
2458
+ return vue.computed(() => {
2459
+ return Object.assign(Object.assign({}, props.value), { onBlur,
2460
+ onInput,
2461
+ onChange, value: model.value });
2462
+ });
2463
+ }
2464
+ /**
2465
+ * @deprecated use defineField instead
2466
+ */
2467
+ function defineComponentBinds(path, config) {
2468
+ const [model, props] = defineField(path, config);
2469
+ const pathState = findPathState(vue.toValue(path));
2470
+ function onUpdateModelValue(value) {
2471
+ model.value = value;
2472
+ }
2473
+ return vue.computed(() => {
2474
+ const conf = isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {};
2475
+ return Object.assign({ [conf.model || 'modelValue']: model.value, [`onUpdate:${conf.model || 'modelValue'}`]: onUpdateModelValue }, props.value);
2476
+ });
2400
2477
  }
2401
- return Object.assign(Object.assign({}, formCtx), { values: vue.readonly(formValues), handleReset: () => resetForm(), submitForm,
2402
- defineField });
2478
+ return Object.assign(Object.assign({}, formCtx), { values: vue.readonly(formValues), handleReset: () => resetForm(), submitForm });
2403
2479
  }
2404
2480
  /**
2405
2481
  * Manages form meta aggregation
@@ -2437,7 +2513,6 @@
2437
2513
  */
2438
2514
  function useFormInitialValues(pathsState, formValues, opts) {
2439
2515
  const values = resolveInitialValues(opts);
2440
- const providedValues = opts === null || opts === void 0 ? void 0 : opts.initialValues;
2441
2516
  // these are the mutable initial values as the fields are mounted/unmounted
2442
2517
  const initialValues = vue.ref(values);
2443
2518
  // these are the original initial value as provided by the user initially, they don't keep track of conditional fields
@@ -2465,21 +2540,21 @@
2465
2540
  setInPath(formValues, state.path, klona(newValue));
2466
2541
  });
2467
2542
  }
2468
- if (vue.isRef(providedValues)) {
2469
- vue.watch(providedValues, value => {
2470
- if (value) {
2471
- setInitialValues(value, true);
2472
- }
2473
- }, {
2474
- deep: true,
2475
- });
2476
- }
2477
2543
  return {
2478
2544
  initialValues,
2479
2545
  originalInitialValues,
2480
2546
  setInitialValues,
2481
2547
  };
2482
2548
  }
2549
+ function mergeValidationResults(a, b) {
2550
+ if (!b) {
2551
+ return a;
2552
+ }
2553
+ return {
2554
+ valid: a.valid && b.valid,
2555
+ errors: [...a.errors, ...b.errors],
2556
+ };
2557
+ }
2483
2558
 
2484
2559
  const FormImpl = /** #__PURE__ */ vue.defineComponent({
2485
2560
  name: 'Form',
@@ -2523,12 +2598,11 @@
2523
2598
  },
2524
2599
  },
2525
2600
  setup(props, ctx) {
2526
- const initialValues = vue.toRef(props, 'initialValues');
2527
2601
  const validationSchema = vue.toRef(props, 'validationSchema');
2528
2602
  const keepValues = vue.toRef(props, 'keepValues');
2529
2603
  const { errors, errorBag, values, meta, isSubmitting, isValidating, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2530
2604
  validationSchema: validationSchema.value ? validationSchema : undefined,
2531
- initialValues,
2605
+ initialValues: props.initialValues,
2532
2606
  initialErrors: props.initialErrors,
2533
2607
  initialTouched: props.initialTouched,
2534
2608
  validateOnMount: props.validateOnMount,
@@ -2655,7 +2729,7 @@
2655
2729
  }
2656
2730
  let entryCounter = 0;
2657
2731
  function getCurrentValues() {
2658
- return getFromPath(form === null || form === void 0 ? void 0 : form.values, vue.unref(arrayPath), []) || [];
2732
+ return getFromPath(form === null || form === void 0 ? void 0 : form.values, vue.toValue(arrayPath), []) || [];
2659
2733
  }
2660
2734
  function initFields() {
2661
2735
  const currentValues = getCurrentValues();
@@ -2686,7 +2760,7 @@
2686
2760
  key,
2687
2761
  value: computedDeep({
2688
2762
  get() {
2689
- const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, vue.unref(arrayPath), []) || [];
2763
+ const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, vue.toValue(arrayPath), []) || [];
2690
2764
  const idx = fields.value.findIndex(e => e.key === key);
2691
2765
  return idx === -1 ? value : currentValues[idx];
2692
2766
  },
@@ -2697,7 +2771,7 @@
2697
2771
  }
2698
2772
  update(idx, value);
2699
2773
  },
2700
- }),
2774
+ }), // will be auto unwrapped
2701
2775
  isFirst: false,
2702
2776
  isLast: false,
2703
2777
  };
@@ -2709,7 +2783,7 @@
2709
2783
  form === null || form === void 0 ? void 0 : form.validate({ mode: 'silent' });
2710
2784
  }
2711
2785
  function remove(idx) {
2712
- const pathName = vue.unref(arrayPath);
2786
+ const pathName = vue.toValue(arrayPath);
2713
2787
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
2714
2788
  if (!pathValue || !Array.isArray(pathValue)) {
2715
2789
  return;
@@ -2717,7 +2791,7 @@
2717
2791
  const newValue = [...pathValue];
2718
2792
  newValue.splice(idx, 1);
2719
2793
  const fieldPath = pathName + `[${idx}]`;
2720
- form.markForUnmount(fieldPath);
2794
+ form.destroyPath(fieldPath);
2721
2795
  form.unsetInitialValue(fieldPath);
2722
2796
  setInPath(form.values, pathName, newValue);
2723
2797
  fields.value.splice(idx, 1);
@@ -2725,7 +2799,7 @@
2725
2799
  }
2726
2800
  function push(initialValue) {
2727
2801
  const value = klona(initialValue);
2728
- const pathName = vue.unref(arrayPath);
2802
+ const pathName = vue.toValue(arrayPath);
2729
2803
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
2730
2804
  const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
2731
2805
  if (!Array.isArray(normalizedPathValue)) {
@@ -2739,7 +2813,7 @@
2739
2813
  afterMutation();
2740
2814
  }
2741
2815
  function swap(indexA, indexB) {
2742
- const pathName = vue.unref(arrayPath);
2816
+ const pathName = vue.toValue(arrayPath);
2743
2817
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
2744
2818
  if (!Array.isArray(pathValue) || !(indexA in pathValue) || !(indexB in pathValue)) {
2745
2819
  return;
@@ -2759,7 +2833,7 @@
2759
2833
  }
2760
2834
  function insert(idx, initialValue) {
2761
2835
  const value = klona(initialValue);
2762
- const pathName = vue.unref(arrayPath);
2836
+ const pathName = vue.toValue(arrayPath);
2763
2837
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
2764
2838
  if (!Array.isArray(pathValue) || pathValue.length < idx) {
2765
2839
  return;
@@ -2773,14 +2847,14 @@
2773
2847
  afterMutation();
2774
2848
  }
2775
2849
  function replace(arr) {
2776
- const pathName = vue.unref(arrayPath);
2850
+ const pathName = vue.toValue(arrayPath);
2777
2851
  form.stageInitialValue(pathName, arr);
2778
2852
  setInPath(form.values, pathName, arr);
2779
2853
  initFields();
2780
2854
  afterMutation();
2781
2855
  }
2782
2856
  function update(idx, value) {
2783
- const pathName = vue.unref(arrayPath);
2857
+ const pathName = vue.toValue(arrayPath);
2784
2858
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
2785
2859
  if (!Array.isArray(pathValue) || pathValue.length - 1 < idx) {
2786
2860
  return;
@@ -2790,20 +2864,20 @@
2790
2864
  }
2791
2865
  function prepend(initialValue) {
2792
2866
  const value = klona(initialValue);
2793
- const pathName = vue.unref(arrayPath);
2867
+ const pathName = vue.toValue(arrayPath);
2794
2868
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
2795
2869
  const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
2796
2870
  if (!Array.isArray(normalizedPathValue)) {
2797
2871
  return;
2798
2872
  }
2799
2873
  const newValue = [value, ...normalizedPathValue];
2800
- form.stageInitialValue(pathName + `[${newValue.length - 1}]`, value);
2801
2874
  setInPath(form.values, pathName, newValue);
2875
+ form.stageInitialValue(pathName + `[0]`, value);
2802
2876
  fields.value.unshift(createEntry(value));
2803
2877
  afterMutation();
2804
2878
  }
2805
2879
  function move(oldIdx, newIdx) {
2806
- const pathName = vue.unref(arrayPath);
2880
+ const pathName = vue.toValue(arrayPath);
2807
2881
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
2808
2882
  const newValue = isNullOrUndefined(pathValue) ? [] : [...pathValue];
2809
2883
  if (!Array.isArray(pathValue) || !(oldIdx in pathValue) || !(newIdx in pathValue)) {
@@ -2833,7 +2907,7 @@
2833
2907
  };
2834
2908
  form.fieldArrays.push(Object.assign({ path: arrayPath, reset: initFields }, fieldArrayCtx));
2835
2909
  vue.onBeforeUnmount(() => {
2836
- const idx = form.fieldArrays.findIndex(i => vue.unref(i.path) === vue.unref(arrayPath));
2910
+ const idx = form.fieldArrays.findIndex(i => vue.toValue(i.path) === vue.toValue(arrayPath));
2837
2911
  if (idx >= 0) {
2838
2912
  form.fieldArrays.splice(idx, 1);
2839
2913
  }
@@ -2860,7 +2934,7 @@
2860
2934
  },
2861
2935
  },
2862
2936
  setup(props, ctx) {
2863
- const { push, remove, swap, insert, replace, update, prepend, move, fields } = useFieldArray(vue.toRef(props, 'name'));
2937
+ const { push, remove, swap, insert, replace, update, prepend, move, fields } = useFieldArray(() => props.name);
2864
2938
  function slotProps() {
2865
2939
  return {
2866
2940
  fields: fields.value,
@@ -3256,8 +3330,10 @@
3256
3330
  exports.Form = Form;
3257
3331
  exports.FormContextKey = FormContextKey;
3258
3332
  exports.IS_ABSENT = IS_ABSENT;
3333
+ exports.cleanupNonNestedPath = cleanupNonNestedPath;
3259
3334
  exports.configure = configure;
3260
3335
  exports.defineRule = defineRule;
3336
+ exports.isNotNestedPath = isNotNestedPath;
3261
3337
  exports.normalizeRules = normalizeRules;
3262
3338
  exports.useField = useField;
3263
3339
  exports.useFieldArray = useFieldArray;