vee-validate 4.12.0-alpha.0 → 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.0
2
+ * vee-validate v4.12.0
3
3
  * (c) 2023 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
@@ -505,8 +505,7 @@ function withLatest(fn, onDone) {
505
505
  return result;
506
506
  }
507
507
  latestRun = undefined;
508
- onDone(result, args);
509
- return result;
508
+ return onDone(result, args);
510
509
  };
511
510
  }
512
511
  function computedDeep({ get, set }) {
@@ -1012,7 +1011,7 @@ function useFieldState(path, init) {
1012
1011
  if (!init.form) {
1013
1012
  const { errors, setErrors } = createFieldErrors();
1014
1013
  const id = ID_COUNTER >= Number.MAX_SAFE_INTEGER ? 0 : ++ID_COUNTER;
1015
- const meta = createFieldMeta(value, initialValue, errors);
1014
+ const meta = createFieldMeta(value, initialValue, errors, init.schema);
1016
1015
  function setState(state) {
1017
1016
  var _a;
1018
1017
  if ('value' in state) {
@@ -1044,6 +1043,7 @@ function useFieldState(path, init) {
1044
1043
  label: init.label,
1045
1044
  type: init.type,
1046
1045
  validate: init.validate,
1046
+ schema: init.schema,
1047
1047
  });
1048
1048
  const errors = computed(() => state.errors);
1049
1049
  function setState(state) {
@@ -1139,11 +1139,14 @@ function resolveModelValue(modelValue, form, initialValue, path) {
1139
1139
  /**
1140
1140
  * Creates meta flags state and some associated effects with them
1141
1141
  */
1142
- function createFieldMeta(currentValue, initialValue, errors) {
1142
+ function createFieldMeta(currentValue, initialValue, errors, schema) {
1143
+ var _a, _b;
1144
+ 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;
1143
1145
  const meta = reactive({
1144
1146
  touched: false,
1145
1147
  pending: false,
1146
1148
  valid: true,
1149
+ required: isRequired,
1147
1150
  validated: !!unref(errors).length,
1148
1151
  initialValue: computed(() => unref(initialValue)),
1149
1152
  dirty: computed(() => {
@@ -1589,6 +1592,7 @@ function _useField(path, rules, opts) {
1589
1592
  label,
1590
1593
  type,
1591
1594
  validate: validator.value ? validate$1 : undefined,
1595
+ schema: isTypedSchema(rules) ? rules : undefined,
1592
1596
  });
1593
1597
  const errorMessage = computed(() => errors.value[0]);
1594
1598
  if (syncVModel) {
@@ -1611,7 +1615,8 @@ function _useField(path, rules, opts) {
1611
1615
  async function validateCurrentValue(mode) {
1612
1616
  var _a, _b;
1613
1617
  if (form === null || form === void 0 ? void 0 : form.validateSchema) {
1614
- return (_a = (await form.validateSchema(mode)).results[toValue(name)]) !== null && _a !== void 0 ? _a : { valid: true, errors: [] };
1618
+ const { results } = await form.validateSchema(mode);
1619
+ return (_a = results[toValue(name)]) !== null && _a !== void 0 ? _a : { valid: true, errors: [] };
1615
1620
  }
1616
1621
  if (validator.value) {
1617
1622
  return validate(value.value, validator.value, {
@@ -1629,7 +1634,7 @@ function _useField(path, rules, opts) {
1629
1634
  return validateCurrentValue('validated-only');
1630
1635
  }, result => {
1631
1636
  if (flags.pendingUnmount[field.id]) {
1632
- return;
1637
+ return result;
1633
1638
  }
1634
1639
  setState({ errors: result.errors });
1635
1640
  meta.pending = false;
@@ -2087,6 +2092,10 @@ const FieldImpl = /** #__PURE__ */ defineComponent({
2087
2092
  };
2088
2093
  }
2089
2094
  ctx.expose({
2095
+ value,
2096
+ meta,
2097
+ errors,
2098
+ errorMessage,
2090
2099
  setErrors,
2091
2100
  setTouched,
2092
2101
  reset: resetField,
@@ -2133,7 +2142,7 @@ const Field = FieldImpl;
2133
2142
  let FORM_COUNTER = 0;
2134
2143
  const PRIVATE_PATH_STATE_KEYS = ['bails', 'fieldsCount', 'id', 'multiple', 'type', 'validate'];
2135
2144
  function resolveInitialValues(opts) {
2136
- const providedValues = unref(opts === null || opts === void 0 ? void 0 : opts.initialValues) || {};
2145
+ const providedValues = (opts === null || opts === void 0 ? void 0 : opts.initialValues) || {};
2137
2146
  const schema = unref(opts === null || opts === void 0 ? void 0 : opts.validationSchema);
2138
2147
  if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
2139
2148
  return klona(schema.cast(providedValues) || {});
@@ -2251,10 +2260,9 @@ function useForm(opts) {
2251
2260
  var _a, _b;
2252
2261
  const initialValue = computed(() => getFromPath(initialValues.value, toValue(path)));
2253
2262
  const pathStateExists = pathStateLookup.value[toValue(path)];
2254
- if (pathStateExists) {
2255
- if ((config === null || config === void 0 ? void 0 : config.type) === 'checkbox' || (config === null || config === void 0 ? void 0 : config.type) === 'radio') {
2256
- pathStateExists.multiple = true;
2257
- }
2263
+ const isCheckboxOrRadio = (config === null || config === void 0 ? void 0 : config.type) === 'checkbox' || (config === null || config === void 0 ? void 0 : config.type) === 'radio';
2264
+ if (pathStateExists && isCheckboxOrRadio) {
2265
+ pathStateExists.multiple = true;
2258
2266
  const id = FIELD_ID_COUNTER++;
2259
2267
  if (Array.isArray(pathStateExists.id)) {
2260
2268
  pathStateExists.id.push(id);
@@ -2268,6 +2276,17 @@ function useForm(opts) {
2268
2276
  }
2269
2277
  const currentValue = computed(() => getFromPath(formValues, toValue(path)));
2270
2278
  const pathValue = toValue(path);
2279
+ const isRequired = computed(() => {
2280
+ var _a, _b, _c, _d, _e, _f;
2281
+ if (isTypedSchema(schema)) {
2282
+ return (_c = (_b = (_a = schema).describe) === null || _b === void 0 ? void 0 : _b.call(_a, toValue(path)).required) !== null && _c !== void 0 ? _c : false;
2283
+ }
2284
+ // Path own schema
2285
+ if (isTypedSchema(config === null || config === void 0 ? void 0 : config.schema)) {
2286
+ 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;
2287
+ }
2288
+ return false;
2289
+ });
2271
2290
  const id = FIELD_ID_COUNTER++;
2272
2291
  const state = reactive({
2273
2292
  id,
@@ -2276,6 +2295,7 @@ function useForm(opts) {
2276
2295
  pending: false,
2277
2296
  valid: true,
2278
2297
  validated: !!((_a = initialErrors[pathValue]) === null || _a === void 0 ? void 0 : _a.length),
2298
+ required: isRequired,
2279
2299
  initialValue,
2280
2300
  errors: shallowRef([]),
2281
2301
  bails: (_b = config === null || config === void 0 ? void 0 : config.bails) !== null && _b !== void 0 ? _b : false,
@@ -2321,7 +2341,9 @@ function useForm(opts) {
2321
2341
  const debouncedSilentValidation = debounceAsync(_validateSchema, 5);
2322
2342
  const debouncedValidation = debounceAsync(_validateSchema, 5);
2323
2343
  const validateSchema = withLatest(async (mode) => {
2324
- return (await mode) === 'silent' ? debouncedSilentValidation() : debouncedValidation();
2344
+ return (await (mode === 'silent'
2345
+ ? debouncedSilentValidation()
2346
+ : debouncedValidation()));
2325
2347
  }, (formResult, [mode]) => {
2326
2348
  // fields by id lookup
2327
2349
  // errors fields names, we need it to also check if custom errors are updated
@@ -2332,14 +2354,16 @@ function useForm(opts) {
2332
2354
  ...new Set([...keysOf(formResult.results), ...pathStates.value.map(p => p.path), ...currentErrorsPaths]),
2333
2355
  ].sort();
2334
2356
  // aggregates the paths into a single result object while applying the results on the fields
2335
- return paths.reduce((validation, _path) => {
2336
- const path = _path;
2337
- const pathState = findPathState(path) || findHoistedPath(path);
2338
- const messages = (formResult.results[path] || { errors: [] }).errors;
2339
- const fieldResult = {
2340
- errors: messages,
2341
- valid: !messages.length,
2342
- };
2357
+ const results = paths.reduce((validation, _path) => {
2358
+ var _a;
2359
+ const expectedPath = _path;
2360
+ const pathState = findPathState(expectedPath) || findHoistedPath(expectedPath);
2361
+ const messages = ((_a = formResult.results[expectedPath]) === null || _a === void 0 ? void 0 : _a.errors) || [];
2362
+ // This is the real path of the field, because it might've been a hoisted field
2363
+ const path = (toValue(pathState === null || pathState === void 0 ? void 0 : pathState.path) || expectedPath);
2364
+ // It is possible that multiple paths are collected across loops
2365
+ // We want to merge them to avoid overriding any iteration's results
2366
+ const fieldResult = mergeValidationResults({ errors: messages, valid: !messages.length }, validation.results[path]);
2343
2367
  validation.results[path] = fieldResult;
2344
2368
  if (!fieldResult.valid) {
2345
2369
  validation.errors[path] = fieldResult.errors[0];
@@ -2364,6 +2388,7 @@ function useForm(opts) {
2364
2388
  setFieldError(pathState, fieldResult.errors);
2365
2389
  return validation;
2366
2390
  }, { valid: formResult.valid, results: {}, errors: {} });
2391
+ return results;
2367
2392
  });
2368
2393
  function mutateAllPathState(mutation) {
2369
2394
  pathStates.value.forEach(mutation);
@@ -2480,14 +2505,16 @@ function useForm(opts) {
2480
2505
  delete pathStateLookup.value[path];
2481
2506
  }
2482
2507
  }
2483
- function markForUnmount(path) {
2484
- return mutateAllPathState(s => {
2485
- if (s.path.startsWith(path)) {
2486
- keysOf(s.__flags.pendingUnmount).forEach(id => {
2487
- s.__flags.pendingUnmount[id] = true;
2488
- });
2508
+ function destroyPath(path) {
2509
+ keysOf(pathStateLookup.value).forEach(key => {
2510
+ if (key.startsWith(path)) {
2511
+ delete pathStateLookup.value[key];
2489
2512
  }
2490
2513
  });
2514
+ pathStates.value = pathStates.value.filter(s => !s.path.startsWith(path));
2515
+ nextTick(() => {
2516
+ rebuildPathLookup();
2517
+ });
2491
2518
  }
2492
2519
  const formCtx = {
2493
2520
  formId,
@@ -2514,6 +2541,10 @@ function useForm(opts) {
2514
2541
  resetForm,
2515
2542
  resetField,
2516
2543
  handleSubmit,
2544
+ useFieldModel,
2545
+ defineInputBinds,
2546
+ defineComponentBinds: defineComponentBinds,
2547
+ defineField,
2517
2548
  stageInitialValue,
2518
2549
  unsetInitialValue,
2519
2550
  setFieldInitialValue,
@@ -2523,7 +2554,7 @@ function useForm(opts) {
2523
2554
  removePathState,
2524
2555
  initialValues: initialValues,
2525
2556
  getAllPathStates: () => pathStates.value,
2526
- markForUnmount,
2557
+ destroyPath,
2527
2558
  isFieldTouched,
2528
2559
  isFieldDirty,
2529
2560
  isFieldValid,
@@ -2636,7 +2667,7 @@ function useForm(opts) {
2636
2667
  * Resets all fields
2637
2668
  */
2638
2669
  function resetForm(resetState, opts) {
2639
- let newValues = (resetState === null || resetState === void 0 ? void 0 : resetState.values) ? resetState.values : originalInitialValues.value;
2670
+ let newValues = klona((resetState === null || resetState === void 0 ? void 0 : resetState.values) ? resetState.values : originalInitialValues.value);
2640
2671
  newValues = isTypedSchema(schema) && isCallable(schema.cast) ? schema.cast(newValues) : newValues;
2641
2672
  setInitialValues(newValues);
2642
2673
  mutateAllPathState(state => {
@@ -2792,7 +2823,8 @@ function useForm(opts) {
2792
2823
  });
2793
2824
  }
2794
2825
  function defineField(path, config) {
2795
- const pathState = (findPathState(toValue(path)) || createPathState(path));
2826
+ const label = isCallable(config) ? undefined : config === null || config === void 0 ? void 0 : config.label;
2827
+ const pathState = (findPathState(toValue(path)) || createPathState(path, { label }));
2796
2828
  const evalConfig = () => (isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {});
2797
2829
  function onBlur() {
2798
2830
  var _a;
@@ -2834,10 +2866,54 @@ function useForm(opts) {
2834
2866
  }
2835
2867
  return base;
2836
2868
  });
2837
- return [createModel(path, () => { var _a; return (_a = evalConfig().validateOnModelUpdate) !== null && _a !== void 0 ? _a : false; }), props];
2869
+ const model = createModel(path, () => { var _a; return (_a = evalConfig().validateOnModelUpdate) !== null && _a !== void 0 ? _a : true; });
2870
+ return [model, props];
2871
+ }
2872
+ function useFieldModel(pathOrPaths) {
2873
+ if (!Array.isArray(pathOrPaths)) {
2874
+ return createModel(pathOrPaths);
2875
+ }
2876
+ return pathOrPaths.map(p => createModel(p, true));
2877
+ }
2878
+ /**
2879
+ * @deprecated use defineField instead
2880
+ */
2881
+ function defineInputBinds(path, config) {
2882
+ const [model, props] = defineField(path, config);
2883
+ function onBlur(e) {
2884
+ props.value.onBlur(e);
2885
+ }
2886
+ function onInput(e) {
2887
+ const value = normalizeEventValue(e);
2888
+ setFieldValue(toValue(path), value, false);
2889
+ props.value.onInput(e);
2890
+ }
2891
+ function onChange(e) {
2892
+ const value = normalizeEventValue(e);
2893
+ setFieldValue(toValue(path), value, false);
2894
+ props.value.onChange(e);
2895
+ }
2896
+ return computed(() => {
2897
+ return Object.assign(Object.assign({}, props.value), { onBlur,
2898
+ onInput,
2899
+ onChange, value: model.value });
2900
+ });
2901
+ }
2902
+ /**
2903
+ * @deprecated use defineField instead
2904
+ */
2905
+ function defineComponentBinds(path, config) {
2906
+ const [model, props] = defineField(path, config);
2907
+ const pathState = findPathState(toValue(path));
2908
+ function onUpdateModelValue(value) {
2909
+ model.value = value;
2910
+ }
2911
+ return computed(() => {
2912
+ const conf = isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {};
2913
+ return Object.assign({ [conf.model || 'modelValue']: model.value, [`onUpdate:${conf.model || 'modelValue'}`]: onUpdateModelValue }, props.value);
2914
+ });
2838
2915
  }
2839
- return Object.assign(Object.assign({}, formCtx), { values: readonly(formValues), handleReset: () => resetForm(), submitForm,
2840
- defineField });
2916
+ return Object.assign(Object.assign({}, formCtx), { values: readonly(formValues), handleReset: () => resetForm(), submitForm });
2841
2917
  }
2842
2918
  /**
2843
2919
  * Manages form meta aggregation
@@ -2875,7 +2951,6 @@ function useFormMeta(pathsState, currentValues, initialValues, errors) {
2875
2951
  */
2876
2952
  function useFormInitialValues(pathsState, formValues, opts) {
2877
2953
  const values = resolveInitialValues(opts);
2878
- const providedValues = opts === null || opts === void 0 ? void 0 : opts.initialValues;
2879
2954
  // these are the mutable initial values as the fields are mounted/unmounted
2880
2955
  const initialValues = ref(values);
2881
2956
  // these are the original initial value as provided by the user initially, they don't keep track of conditional fields
@@ -2903,21 +2978,21 @@ function useFormInitialValues(pathsState, formValues, opts) {
2903
2978
  setInPath(formValues, state.path, klona(newValue));
2904
2979
  });
2905
2980
  }
2906
- if (isRef(providedValues)) {
2907
- watch(providedValues, value => {
2908
- if (value) {
2909
- setInitialValues(value, true);
2910
- }
2911
- }, {
2912
- deep: true,
2913
- });
2914
- }
2915
2981
  return {
2916
2982
  initialValues,
2917
2983
  originalInitialValues,
2918
2984
  setInitialValues,
2919
2985
  };
2920
2986
  }
2987
+ function mergeValidationResults(a, b) {
2988
+ if (!b) {
2989
+ return a;
2990
+ }
2991
+ return {
2992
+ valid: a.valid && b.valid,
2993
+ errors: [...a.errors, ...b.errors],
2994
+ };
2995
+ }
2921
2996
 
2922
2997
  const FormImpl = /** #__PURE__ */ defineComponent({
2923
2998
  name: 'Form',
@@ -2961,12 +3036,11 @@ const FormImpl = /** #__PURE__ */ defineComponent({
2961
3036
  },
2962
3037
  },
2963
3038
  setup(props, ctx) {
2964
- const initialValues = toRef(props, 'initialValues');
2965
3039
  const validationSchema = toRef(props, 'validationSchema');
2966
3040
  const keepValues = toRef(props, 'keepValues');
2967
3041
  const { errors, errorBag, values, meta, isSubmitting, isValidating, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2968
3042
  validationSchema: validationSchema.value ? validationSchema : undefined,
2969
- initialValues,
3043
+ initialValues: props.initialValues,
2970
3044
  initialErrors: props.initialErrors,
2971
3045
  initialTouched: props.initialTouched,
2972
3046
  validateOnMount: props.validateOnMount,
@@ -3099,7 +3173,7 @@ function useFieldArray(arrayPath) {
3099
3173
  }
3100
3174
  let entryCounter = 0;
3101
3175
  function getCurrentValues() {
3102
- return getFromPath(form === null || form === void 0 ? void 0 : form.values, unref(arrayPath), []) || [];
3176
+ return getFromPath(form === null || form === void 0 ? void 0 : form.values, toValue(arrayPath), []) || [];
3103
3177
  }
3104
3178
  function initFields() {
3105
3179
  const currentValues = getCurrentValues();
@@ -3130,7 +3204,7 @@ function useFieldArray(arrayPath) {
3130
3204
  key,
3131
3205
  value: computedDeep({
3132
3206
  get() {
3133
- const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, unref(arrayPath), []) || [];
3207
+ const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, toValue(arrayPath), []) || [];
3134
3208
  const idx = fields.value.findIndex(e => e.key === key);
3135
3209
  return idx === -1 ? value : currentValues[idx];
3136
3210
  },
@@ -3144,7 +3218,7 @@ function useFieldArray(arrayPath) {
3144
3218
  }
3145
3219
  update(idx, value);
3146
3220
  },
3147
- }),
3221
+ }), // will be auto unwrapped
3148
3222
  isFirst: false,
3149
3223
  isLast: false,
3150
3224
  };
@@ -3156,7 +3230,7 @@ function useFieldArray(arrayPath) {
3156
3230
  form === null || form === void 0 ? void 0 : form.validate({ mode: 'silent' });
3157
3231
  }
3158
3232
  function remove(idx) {
3159
- const pathName = unref(arrayPath);
3233
+ const pathName = toValue(arrayPath);
3160
3234
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
3161
3235
  if (!pathValue || !Array.isArray(pathValue)) {
3162
3236
  return;
@@ -3164,7 +3238,7 @@ function useFieldArray(arrayPath) {
3164
3238
  const newValue = [...pathValue];
3165
3239
  newValue.splice(idx, 1);
3166
3240
  const fieldPath = pathName + `[${idx}]`;
3167
- form.markForUnmount(fieldPath);
3241
+ form.destroyPath(fieldPath);
3168
3242
  form.unsetInitialValue(fieldPath);
3169
3243
  setInPath(form.values, pathName, newValue);
3170
3244
  fields.value.splice(idx, 1);
@@ -3172,7 +3246,7 @@ function useFieldArray(arrayPath) {
3172
3246
  }
3173
3247
  function push(initialValue) {
3174
3248
  const value = klona(initialValue);
3175
- const pathName = unref(arrayPath);
3249
+ const pathName = toValue(arrayPath);
3176
3250
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
3177
3251
  const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
3178
3252
  if (!Array.isArray(normalizedPathValue)) {
@@ -3186,7 +3260,7 @@ function useFieldArray(arrayPath) {
3186
3260
  afterMutation();
3187
3261
  }
3188
3262
  function swap(indexA, indexB) {
3189
- const pathName = unref(arrayPath);
3263
+ const pathName = toValue(arrayPath);
3190
3264
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
3191
3265
  if (!Array.isArray(pathValue) || !(indexA in pathValue) || !(indexB in pathValue)) {
3192
3266
  return;
@@ -3206,7 +3280,7 @@ function useFieldArray(arrayPath) {
3206
3280
  }
3207
3281
  function insert(idx, initialValue) {
3208
3282
  const value = klona(initialValue);
3209
- const pathName = unref(arrayPath);
3283
+ const pathName = toValue(arrayPath);
3210
3284
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
3211
3285
  if (!Array.isArray(pathValue) || pathValue.length < idx) {
3212
3286
  return;
@@ -3220,14 +3294,14 @@ function useFieldArray(arrayPath) {
3220
3294
  afterMutation();
3221
3295
  }
3222
3296
  function replace(arr) {
3223
- const pathName = unref(arrayPath);
3297
+ const pathName = toValue(arrayPath);
3224
3298
  form.stageInitialValue(pathName, arr);
3225
3299
  setInPath(form.values, pathName, arr);
3226
3300
  initFields();
3227
3301
  afterMutation();
3228
3302
  }
3229
3303
  function update(idx, value) {
3230
- const pathName = unref(arrayPath);
3304
+ const pathName = toValue(arrayPath);
3231
3305
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
3232
3306
  if (!Array.isArray(pathValue) || pathValue.length - 1 < idx) {
3233
3307
  return;
@@ -3237,20 +3311,20 @@ function useFieldArray(arrayPath) {
3237
3311
  }
3238
3312
  function prepend(initialValue) {
3239
3313
  const value = klona(initialValue);
3240
- const pathName = unref(arrayPath);
3314
+ const pathName = toValue(arrayPath);
3241
3315
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
3242
3316
  const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
3243
3317
  if (!Array.isArray(normalizedPathValue)) {
3244
3318
  return;
3245
3319
  }
3246
3320
  const newValue = [value, ...normalizedPathValue];
3247
- form.stageInitialValue(pathName + `[${newValue.length - 1}]`, value);
3248
3321
  setInPath(form.values, pathName, newValue);
3322
+ form.stageInitialValue(pathName + `[0]`, value);
3249
3323
  fields.value.unshift(createEntry(value));
3250
3324
  afterMutation();
3251
3325
  }
3252
3326
  function move(oldIdx, newIdx) {
3253
- const pathName = unref(arrayPath);
3327
+ const pathName = toValue(arrayPath);
3254
3328
  const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
3255
3329
  const newValue = isNullOrUndefined(pathValue) ? [] : [...pathValue];
3256
3330
  if (!Array.isArray(pathValue) || !(oldIdx in pathValue) || !(newIdx in pathValue)) {
@@ -3280,7 +3354,7 @@ function useFieldArray(arrayPath) {
3280
3354
  };
3281
3355
  form.fieldArrays.push(Object.assign({ path: arrayPath, reset: initFields }, fieldArrayCtx));
3282
3356
  onBeforeUnmount(() => {
3283
- const idx = form.fieldArrays.findIndex(i => unref(i.path) === unref(arrayPath));
3357
+ const idx = form.fieldArrays.findIndex(i => toValue(i.path) === toValue(arrayPath));
3284
3358
  if (idx >= 0) {
3285
3359
  form.fieldArrays.splice(idx, 1);
3286
3360
  }
@@ -3307,7 +3381,7 @@ const FieldArrayImpl = /** #__PURE__ */ defineComponent({
3307
3381
  },
3308
3382
  },
3309
3383
  setup(props, ctx) {
3310
- const { push, remove, swap, insert, replace, update, prepend, move, fields } = useFieldArray(toRef(props, 'name'));
3384
+ const { push, remove, swap, insert, replace, update, prepend, move, fields } = useFieldArray(() => props.name);
3311
3385
  function slotProps() {
3312
3386
  return {
3313
3387
  fields: fields.value,
@@ -3772,4 +3846,4 @@ function useSetFormValues() {
3772
3846
  return setFormValues;
3773
3847
  }
3774
3848
 
3775
- export { ErrorMessage, Field, FieldArray, FieldContextKey, Form, FormContextKey, IS_ABSENT, configure, defineRule, normalizeRules, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useIsValidating, useResetForm, useSetFieldError, useSetFieldTouched, useSetFieldValue, useSetFormErrors, useSetFormTouched, useSetFormValues, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };
3849
+ export { ErrorMessage, Field, FieldArray, FieldContextKey, Form, FormContextKey, IS_ABSENT, cleanupNonNestedPath, configure, defineRule, isNotNestedPath, normalizeRules, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useIsValidating, useResetForm, useSetFieldError, useSetFieldTouched, useSetFieldValue, useSetFormErrors, useSetFormTouched, useSetFormValues, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };