vee-validate 4.15.1 → 5.0.0-beta.1

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/README.md CHANGED
@@ -18,7 +18,7 @@ Painless Vue forms
18
18
  <img src="https://img.shields.io/npm/dm/vee-validate.svg?color=05bd6d&label=">
19
19
  </a>
20
20
 
21
- <a href="https://vee-validate.logaretm.com/v4/" target="_blank">
21
+ <a href="https://vee-validate.logaretm.com/v5/" target="_blank">
22
22
  <img src="https://img.shields.io/badge/-docs%20and%20demos-009f53">
23
23
  </a>
24
24
 
@@ -69,7 +69,7 @@ The main v4 version supports Vue 3.x only, for previous versions of Vue, check t
69
69
  | vue Version | vee-validate version | Documentation Link |
70
70
  | ----------- | -------------------- | ---------------------------------------------------------------------------------------- |
71
71
  | `2.x` | `2.x` or `3.x` | [v2](https://vee-validate.logaretm.com/v2) or [v3](https://vee-validate.logaretm.com/v3) |
72
- | `3.x` | `4.x` | [v4](https://vee-validate.logaretm.com/v4) |
72
+ | `3.x` | `4.x` or `5.x` | [v4](https://vee-validate.logaretm.com/v4) or [v5](https://vee-validate.logaretm.com/v5) |
73
73
 
74
74
  ### Usage
75
75
 
@@ -117,7 +117,7 @@ const onSubmit = handleSubmit(values => {
117
117
  </template>
118
118
  ```
119
119
 
120
- You can do so much more than this, for more info [check the composition API documentation](https://vee-validate.logaretm.com/v4/guide/composition-api/getting-started/).
120
+ You can do so much more than this, for more info [check the composition API documentation](https://vee-validate.logaretm.com/v5/guide/composition-api/getting-started/).
121
121
 
122
122
  #### Declarative Components
123
123
 
@@ -150,7 +150,7 @@ function onSubmit(values) {
150
150
  </template>
151
151
  ```
152
152
 
153
- The `Field` component renders an `input` of type `text` by default but you can [control that](https://vee-validate.logaretm.com/v4/api/field#rendering-fields)
153
+ The `Field` component renders an `input` of type `text` by default but you can [control that](https://vee-validate.logaretm.com/v5/api/field#rendering-fields)
154
154
 
155
155
  ## 📚 Documentation
156
156
 
@@ -1,6 +1,6 @@
1
1
  /**
2
- * vee-validate v4.15.1
3
- * (c) 2025 Abdelrahman Awad
2
+ * vee-validate v5.0.0-beta.1
3
+ * (c) 2026 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
6
6
  'use strict';
@@ -164,11 +164,8 @@ const isClient = typeof window !== 'undefined';
164
164
  function isLocator(value) {
165
165
  return isCallable(value) && !!value.__locatorRef;
166
166
  }
167
- function isTypedSchema(value) {
168
- return !!value && isCallable(value.parse) && value.__type === 'VVTypedSchema';
169
- }
170
- function isYupValidator(value) {
171
- return !!value && isCallable(value.validate);
167
+ function isStandardSchema(value) {
168
+ return isObject(value) && '~standard' in value;
172
169
  }
173
170
  function hasCheckedAttr(type) {
174
171
  return type === 'checkbox' || type === 'radio';
@@ -348,6 +345,27 @@ function isFile(a) {
348
345
  return a instanceof File;
349
346
  }
350
347
 
348
+ // src/getDotPath/getDotPath.ts
349
+ function getDotPath(issue) {
350
+ if (issue.path?.length) {
351
+ let dotPath = "";
352
+ for (const item of issue.path) {
353
+ const key = typeof item === "object" ? item.key : item;
354
+ if (typeof key === "string" || typeof key === "number") {
355
+ if (dotPath) {
356
+ dotPath += `.${key}`;
357
+ } else {
358
+ dotPath += key;
359
+ }
360
+ } else {
361
+ return null;
362
+ }
363
+ }
364
+ return dotPath;
365
+ }
366
+ return null;
367
+ }
368
+
351
369
  function cleanupNonNestedPath(path) {
352
370
  if (isNotNestedPath(path)) {
353
371
  return path.replace(/\[|\]/gi, '');
@@ -563,6 +581,31 @@ function debounceNextTick(inner) {
563
581
  return new Promise(resolve => resolves.push(resolve));
564
582
  };
565
583
  }
584
+ function _combineIssueItems(items, getPath) {
585
+ const issueMap = {};
586
+ for (const item of items) {
587
+ const path = getPath(item);
588
+ if (!issueMap[path]) {
589
+ issueMap[path] = {
590
+ path,
591
+ messages: [],
592
+ };
593
+ }
594
+ if ('messages' in item) {
595
+ issueMap[path].messages.push(...item.messages);
596
+ }
597
+ else {
598
+ issueMap[path].messages.push(item.message);
599
+ }
600
+ }
601
+ return Object.values(issueMap);
602
+ }
603
+ /**
604
+ * Aggregates standard schema issues by path.
605
+ */
606
+ function combineStandardIssues(issues) {
607
+ return _combineIssueItems(issues, issue => { var _a; return (issue.path ? (_a = getDotPath(issue)) !== null && _a !== void 0 ? _a : '' : ''); });
608
+ }
566
609
 
567
610
  function normalizeChildren(tag, context, slotProps) {
568
611
  if (!context.slots.default) {
@@ -594,9 +637,6 @@ function hasValueBinding(el) {
594
637
  }
595
638
 
596
639
  function parseInputValue(el) {
597
- if (el.type === 'number') {
598
- return Number.isNaN(el.valueAsNumber) ? el.value : el.valueAsNumber;
599
- }
600
640
  if (el.type === 'range') {
601
641
  return Number.isNaN(el.valueAsNumber) ? el.value : el.valueAsNumber;
602
642
  }
@@ -769,8 +809,8 @@ async function validate(value, rules, options = {}) {
769
809
  */
770
810
  async function _validate(field, value) {
771
811
  const rules = field.rules;
772
- if (isTypedSchema(rules) || isYupValidator(rules)) {
773
- return validateFieldWithTypedSchema(value, Object.assign(Object.assign({}, field), { rules }));
812
+ if (isStandardSchema(rules)) {
813
+ return validateFieldWithStandardSchema(value, Object.assign(Object.assign({}, field), { rules }));
774
814
  }
775
815
  // if a generic function or chain of generic functions
776
816
  if (isCallable(rules) || Array.isArray(rules)) {
@@ -832,58 +872,24 @@ async function _validate(field, value) {
832
872
  errors,
833
873
  };
834
874
  }
835
- function isYupError(err) {
836
- return !!err && err.name === 'ValidationError';
837
- }
838
- function yupToTypedSchema(yupSchema) {
839
- const schema = {
840
- __type: 'VVTypedSchema',
841
- async parse(values, context) {
842
- var _a;
843
- try {
844
- const output = await yupSchema.validate(values, { abortEarly: false, context: (context === null || context === void 0 ? void 0 : context.formData) || {} });
845
- return {
846
- output,
847
- errors: [],
848
- };
849
- }
850
- catch (err) {
851
- // Yup errors have a name prop one them.
852
- // https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
853
- if (!isYupError(err)) {
854
- throw err;
855
- }
856
- if (!((_a = err.inner) === null || _a === void 0 ? void 0 : _a.length) && err.errors.length) {
857
- return { errors: [{ path: err.path, errors: err.errors }] };
858
- }
859
- const errors = err.inner.reduce((acc, curr) => {
860
- const path = curr.path || '';
861
- if (!acc[path]) {
862
- acc[path] = { errors: [], path };
863
- }
864
- acc[path].errors.push(...curr.errors);
865
- return acc;
866
- }, {});
867
- return { errors: Object.values(errors) };
868
- }
869
- },
870
- };
871
- return schema;
872
- }
873
875
  /**
874
876
  * Handles yup validation
875
877
  */
876
- async function validateFieldWithTypedSchema(value, context) {
877
- const typedSchema = isTypedSchema(context.rules) ? context.rules : yupToTypedSchema(context.rules);
878
- const result = await typedSchema.parse(value, { formData: context.formData });
878
+ async function validateFieldWithStandardSchema(value, context) {
879
+ const result = await context.rules['~standard'].validate(value);
880
+ if (!result.issues) {
881
+ return {
882
+ value: result.value,
883
+ errors: [],
884
+ };
885
+ }
879
886
  const messages = [];
880
- for (const error of result.errors) {
881
- if (error.errors.length) {
882
- messages.push(...error.errors);
887
+ for (const error of result.issues) {
888
+ if (error.message) {
889
+ messages.push(error.message);
883
890
  }
884
891
  }
885
892
  return {
886
- value: result.value,
887
893
  errors: messages,
888
894
  };
889
895
  }
@@ -939,27 +945,33 @@ function fillTargetValues(params, crossTable) {
939
945
  return acc;
940
946
  }, {});
941
947
  }
942
- async function validateTypedSchema(schema, values) {
943
- const typedSchema = isTypedSchema(schema) ? schema : yupToTypedSchema(schema);
944
- const validationResult = await typedSchema.parse(klona(values), { formData: klona(values) });
948
+ async function validateStandardSchema(schema, values) {
949
+ const validationResult = await schema['~standard'].validate(klona(values));
945
950
  const results = {};
946
951
  const errors = {};
947
- for (const error of validationResult.errors) {
948
- const messages = error.errors;
949
- // Fixes issue with path mapping with Yup 1.0 including quotes around array indices
950
- const path = (error.path || '').replace(/\["(\d+)"\]/g, (_, m) => {
951
- return `[${m}]`;
952
- });
952
+ if (!validationResult.issues) {
953
+ return {
954
+ valid: true,
955
+ results: {},
956
+ errors: {},
957
+ values: validationResult.value,
958
+ source: 'schema',
959
+ };
960
+ }
961
+ const combinedIssues = combineStandardIssues(validationResult.issues || []);
962
+ for (const error of combinedIssues) {
963
+ const messages = error.messages;
964
+ const path = error.path;
953
965
  results[path] = { valid: !messages.length, errors: messages };
954
966
  if (messages.length) {
955
967
  errors[path] = messages[0];
956
968
  }
957
969
  }
958
970
  return {
959
- valid: !validationResult.errors.length,
971
+ valid: !combinedIssues.length,
960
972
  results,
961
973
  errors,
962
- values: validationResult.value,
974
+ values: undefined,
963
975
  source: 'schema',
964
976
  };
965
977
  }
@@ -1004,7 +1016,7 @@ function useFieldState(path, init) {
1004
1016
  if (!init.form) {
1005
1017
  const { errors, setErrors } = createFieldErrors();
1006
1018
  const id = ID_COUNTER >= Number.MAX_SAFE_INTEGER ? 0 : ++ID_COUNTER;
1007
- const meta = createFieldMeta(value, initialValue, errors, init.schema);
1019
+ const meta = createFieldMeta(value, initialValue, errors);
1008
1020
  function setState(state) {
1009
1021
  var _a;
1010
1022
  if ('value' in state) {
@@ -1036,7 +1048,6 @@ function useFieldState(path, init) {
1036
1048
  label: init.label,
1037
1049
  type: init.type,
1038
1050
  validate: init.validate,
1039
- schema: init.schema,
1040
1051
  });
1041
1052
  const errors = vue.computed(() => state.errors);
1042
1053
  function setState(state) {
@@ -1132,13 +1143,11 @@ function resolveModelValue(modelValue, form, initialValue, path) {
1132
1143
  /**
1133
1144
  * Creates meta flags state and some associated effects with them
1134
1145
  */
1135
- function createFieldMeta(currentValue, initialValue, errors, schema) {
1136
- const isRequired = vue.computed(() => { var _a, _b, _c; return (_c = (_b = (_a = vue.toValue(schema)) === null || _a === void 0 ? void 0 : _a.describe) === null || _b === void 0 ? void 0 : _b.call(_a).required) !== null && _c !== void 0 ? _c : false; });
1146
+ function createFieldMeta(currentValue, initialValue, errors) {
1137
1147
  const meta = vue.reactive({
1138
1148
  touched: false,
1139
1149
  pending: false,
1140
1150
  valid: true,
1141
- required: isRequired,
1142
1151
  validated: !!vue.unref(errors).length,
1143
1152
  initialValue: vue.computed(() => vue.unref(initialValue)),
1144
1153
  dirty: vue.computed(() => {
@@ -1186,15 +1195,11 @@ function _useField(path, rules, opts) {
1186
1195
  return undefined;
1187
1196
  }
1188
1197
  const rulesValue = vue.unref(rules);
1189
- if (isYupValidator(rulesValue) ||
1190
- isTypedSchema(rulesValue) ||
1191
- isCallable(rulesValue) ||
1192
- Array.isArray(rulesValue)) {
1198
+ if (isStandardSchema(rulesValue) || isCallable(rulesValue) || Array.isArray(rulesValue)) {
1193
1199
  return rulesValue;
1194
1200
  }
1195
1201
  return normalizeRules(rulesValue);
1196
1202
  });
1197
- const isTyped = !isCallable(validator.value) && isTypedSchema(vue.toValue(rules));
1198
1203
  const { id, value, initialValue, meta, setState, errors, flags } = useFieldState(name, {
1199
1204
  modelValue,
1200
1205
  form,
@@ -1202,7 +1207,6 @@ function _useField(path, rules, opts) {
1202
1207
  label,
1203
1208
  type,
1204
1209
  validate: validator.value ? validate$1 : undefined,
1205
- schema: isTyped ? rules : undefined,
1206
1210
  });
1207
1211
  const errorMessage = vue.computed(() => errors.value[0]);
1208
1212
  if (syncVModel) {
@@ -1354,12 +1358,8 @@ function _useField(path, rules, opts) {
1354
1358
  // extract cross-field dependencies in a computed prop
1355
1359
  const dependencies = vue.computed(() => {
1356
1360
  const rulesVal = validator.value;
1357
- // is falsy, a function schema or a yup schema
1358
- if (!rulesVal ||
1359
- isCallable(rulesVal) ||
1360
- isYupValidator(rulesVal) ||
1361
- isTypedSchema(rulesVal) ||
1362
- Array.isArray(rulesVal)) {
1361
+ // is falsy, a function schema or a standard schema
1362
+ if (!rulesVal || isCallable(rulesVal) || isStandardSchema(rulesVal) || Array.isArray(rulesVal)) {
1363
1363
  return {};
1364
1364
  }
1365
1365
  return Object.keys(rulesVal).reduce((acc, rule) => {
@@ -1425,6 +1425,7 @@ function _useField(path, rules, opts) {
1425
1425
  * Normalizes partial field options to include the full options
1426
1426
  */
1427
1427
  function normalizeOptions(opts) {
1428
+ var _a;
1428
1429
  const defaults = () => ({
1429
1430
  initialValue: undefined,
1430
1431
  validateOnMount: false,
@@ -1436,22 +1437,19 @@ function normalizeOptions(opts) {
1436
1437
  controlled: true,
1437
1438
  });
1438
1439
  const isVModelSynced = !!(opts === null || opts === void 0 ? void 0 : opts.syncVModel);
1439
- const modelPropName = typeof (opts === null || opts === void 0 ? void 0 : opts.syncVModel) === 'string' ? opts.syncVModel : (opts === null || opts === void 0 ? void 0 : opts.modelPropName) || 'modelValue';
1440
+ const modelPropName = typeof (opts === null || opts === void 0 ? void 0 : opts.syncVModel) === 'string' ? opts.syncVModel : 'modelValue';
1440
1441
  const initialValue = isVModelSynced && !('initialValue' in (opts || {}))
1441
1442
  ? getCurrentModelValue(vue.getCurrentInstance(), modelPropName)
1442
1443
  : opts === null || opts === void 0 ? void 0 : opts.initialValue;
1443
1444
  if (!opts) {
1444
1445
  return Object.assign(Object.assign({}, defaults()), { initialValue });
1445
1446
  }
1446
- // TODO: Deprecate this in next major release
1447
- const checkedValue = 'valueProp' in opts ? opts.valueProp : opts.checkedValue;
1448
- const controlled = 'standalone' in opts ? !opts.standalone : opts.controlled;
1449
- const syncVModel = (opts === null || opts === void 0 ? void 0 : opts.modelPropName) || (opts === null || opts === void 0 ? void 0 : opts.syncVModel) || false;
1450
- return Object.assign(Object.assign(Object.assign({}, defaults()), (opts || {})), { initialValue, controlled: controlled !== null && controlled !== void 0 ? controlled : true, checkedValue,
1451
- syncVModel });
1447
+ const controlled = (_a = opts.controlled) !== null && _a !== void 0 ? _a : true;
1448
+ const syncVModel = (opts === null || opts === void 0 ? void 0 : opts.syncVModel) || false;
1449
+ return Object.assign(Object.assign(Object.assign({}, defaults()), (opts || {})), { initialValue, controlled: controlled !== null && controlled !== void 0 ? controlled : true, checkedValue: opts === null || opts === void 0 ? void 0 : opts.checkedValue, syncVModel });
1452
1450
  }
1453
1451
  function useFieldWithChecked(name, rules, opts) {
1454
- const form = !(opts === null || opts === void 0 ? void 0 : opts.standalone) ? injectWithSelf(FormContextKey) : undefined;
1452
+ const form = (opts === null || opts === void 0 ? void 0 : opts.controlled) ? injectWithSelf(FormContextKey) : undefined;
1455
1453
  const checkedValue = opts === null || opts === void 0 ? void 0 : opts.checkedValue;
1456
1454
  const uncheckedValue = opts === null || opts === void 0 ? void 0 : opts.uncheckedValue;
1457
1455
  function patchCheckedApi(field) {
@@ -1585,9 +1583,9 @@ const FieldImpl = /** #__PURE__ */ vue.defineComponent({
1585
1583
  type: null,
1586
1584
  default: undefined,
1587
1585
  },
1588
- standalone: {
1586
+ controlled: {
1589
1587
  type: Boolean,
1590
- default: false,
1588
+ default: true,
1591
1589
  },
1592
1590
  keepValue: {
1593
1591
  type: Boolean,
@@ -1603,7 +1601,7 @@ const FieldImpl = /** #__PURE__ */ vue.defineComponent({
1603
1601
  const { errors, value, errorMessage, validate: validateField, handleChange, handleBlur, setTouched, resetField, handleReset, meta, checked, setErrors, setValue, } = useField(name, rules, {
1604
1602
  validateOnMount: props.validateOnMount,
1605
1603
  bails: props.bails,
1606
- standalone: props.standalone,
1604
+ controlled: props.controlled,
1607
1605
  type: ctx.attrs.type,
1608
1606
  initialValue: resolveInitialValue(props, ctx),
1609
1607
  // Only for checkboxes and radio buttons
@@ -1734,10 +1732,6 @@ const PRIVATE_PATH_STATE_KEYS = ['bails', 'fieldsCount', 'id', 'multiple', 'type
1734
1732
  function resolveInitialValues(opts) {
1735
1733
  const givenInitial = (opts === null || opts === void 0 ? void 0 : opts.initialValues) || {};
1736
1734
  const providedValues = Object.assign({}, vue.toValue(givenInitial));
1737
- const schema = vue.unref(opts === null || opts === void 0 ? void 0 : opts.validationSchema);
1738
- if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
1739
- return klona(schema.cast(providedValues) || {});
1740
- }
1741
1735
  return klona(providedValues);
1742
1736
  }
1743
1737
  function useForm(opts) {
@@ -1872,19 +1866,6 @@ function useForm(opts) {
1872
1866
  if (unsetBatchIndex !== -1) {
1873
1867
  UNSET_BATCH.splice(unsetBatchIndex, 1);
1874
1868
  }
1875
- const isRequired = vue.computed(() => {
1876
- var _a, _b, _c, _d;
1877
- const schemaValue = vue.toValue(schema);
1878
- if (isTypedSchema(schemaValue)) {
1879
- return (_b = (_a = schemaValue.describe) === null || _a === void 0 ? void 0 : _a.call(schemaValue, vue.toValue(path)).required) !== null && _b !== void 0 ? _b : false;
1880
- }
1881
- // Path own schema
1882
- const configSchemaValue = vue.toValue(config === null || config === void 0 ? void 0 : config.schema);
1883
- if (isTypedSchema(configSchemaValue)) {
1884
- return (_d = (_c = configSchemaValue.describe) === null || _c === void 0 ? void 0 : _c.call(configSchemaValue).required) !== null && _d !== void 0 ? _d : false;
1885
- }
1886
- return false;
1887
- });
1888
1869
  const id = FIELD_ID_COUNTER++;
1889
1870
  const state = vue.reactive({
1890
1871
  id,
@@ -1893,7 +1874,6 @@ function useForm(opts) {
1893
1874
  pending: false,
1894
1875
  valid: true,
1895
1876
  validated: !!((_a = initialErrors[pathValue]) === null || _a === void 0 ? void 0 : _a.length),
1896
- required: isRequired,
1897
1877
  initialValue,
1898
1878
  errors: vue.shallowRef([]),
1899
1879
  bails: (_b = config === null || config === void 0 ? void 0 : config.bails) !== null && _b !== void 0 ? _b : false,
@@ -2168,9 +2148,6 @@ function useForm(opts) {
2168
2148
  resetForm,
2169
2149
  resetField,
2170
2150
  handleSubmit,
2171
- useFieldModel,
2172
- defineInputBinds,
2173
- defineComponentBinds: defineComponentBinds,
2174
2151
  defineField,
2175
2152
  stageInitialValue,
2176
2153
  unsetInitialValue,
@@ -2306,7 +2283,6 @@ function useForm(opts) {
2306
2283
  function resetForm(resetState, opts) {
2307
2284
  let newValues = klona((resetState === null || resetState === void 0 ? void 0 : resetState.values) ? resetState.values : originalInitialValues.value);
2308
2285
  newValues = (opts === null || opts === void 0 ? void 0 : opts.force) ? newValues : merge(originalInitialValues.value, newValues);
2309
- newValues = isTypedSchema(schema) && isCallable(schema.cast) ? schema.cast(newValues) : newValues;
2310
2286
  setInitialValues(newValues, { force: opts === null || opts === void 0 ? void 0 : opts.force });
2311
2287
  mutateAllPathState(state => {
2312
2288
  var _a;
@@ -2419,8 +2395,8 @@ function useForm(opts) {
2419
2395
  return { valid: true, results: {}, errors: {}, source: 'none' };
2420
2396
  }
2421
2397
  isValidating.value = true;
2422
- const formResult = isYupValidator(schemaValue) || isTypedSchema(schemaValue)
2423
- ? await validateTypedSchema(schemaValue, formValues)
2398
+ const formResult = isStandardSchema(schemaValue)
2399
+ ? await validateStandardSchema(schemaValue, formValues)
2424
2400
  : await validateObjectSchema(schemaValue, formValues, {
2425
2401
  names: fieldNames.value,
2426
2402
  bailsMap: fieldBailsMap.value,
@@ -2507,50 +2483,6 @@ function useForm(opts) {
2507
2483
  const model = createModel(path, () => { var _a, _b, _c; return (_c = (_a = evalConfig().validateOnModelUpdate) !== null && _a !== void 0 ? _a : (_b = getConfig()) === null || _b === void 0 ? void 0 : _b.validateOnModelUpdate) !== null && _c !== void 0 ? _c : true; });
2508
2484
  return [model, props];
2509
2485
  }
2510
- function useFieldModel(pathOrPaths) {
2511
- if (!Array.isArray(pathOrPaths)) {
2512
- return createModel(pathOrPaths);
2513
- }
2514
- return pathOrPaths.map(p => createModel(p, true));
2515
- }
2516
- /**
2517
- * @deprecated use defineField instead
2518
- */
2519
- function defineInputBinds(path, config) {
2520
- const [model, props] = defineField(path, config);
2521
- function onBlur() {
2522
- props.value.onBlur();
2523
- }
2524
- function onInput(e) {
2525
- const value = normalizeEventValue(e);
2526
- setFieldValue(vue.toValue(path), value, false);
2527
- props.value.onInput();
2528
- }
2529
- function onChange(e) {
2530
- const value = normalizeEventValue(e);
2531
- setFieldValue(vue.toValue(path), value, false);
2532
- props.value.onChange();
2533
- }
2534
- return vue.computed(() => {
2535
- return Object.assign(Object.assign({}, props.value), { onBlur,
2536
- onInput,
2537
- onChange, value: model.value });
2538
- });
2539
- }
2540
- /**
2541
- * @deprecated use defineField instead
2542
- */
2543
- function defineComponentBinds(path, config) {
2544
- const [model, props] = defineField(path, config);
2545
- const pathState = findPathState(vue.toValue(path));
2546
- function onUpdateModelValue(value) {
2547
- model.value = value;
2548
- }
2549
- return vue.computed(() => {
2550
- const conf = isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {};
2551
- return Object.assign({ [conf.model || 'modelValue']: model.value, [`onUpdate:${conf.model || 'modelValue'}`]: onUpdateModelValue }, props.value);
2552
- });
2553
- }
2554
2486
  const ctx = Object.assign(Object.assign({}, formCtx), { values: vue.readonly(formValues), handleReset: () => resetForm(), submitForm });
2555
2487
  vue.provide(PublicFormContextKey, ctx);
2556
2488
  return ctx;
@@ -3428,6 +3360,7 @@ exports.PublicFormContextKey = PublicFormContextKey;
3428
3360
  exports.cleanupNonNestedPath = cleanupNonNestedPath;
3429
3361
  exports.configure = configure;
3430
3362
  exports.defineRule = defineRule;
3363
+ exports.getConfig = getConfig;
3431
3364
  exports.isNotNestedPath = isNotNestedPath;
3432
3365
  exports.normalizeRules = normalizeRules;
3433
3366
  exports.useField = useField;