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 +4 -4
- package/dist/vee-validate.cjs +97 -164
- package/dist/vee-validate.d.ts +21 -71
- package/dist/vee-validate.iife.js +97 -164
- package/dist/vee-validate.iife.prod.js.mjs +3 -3
- package/dist/vee-validate.mjs +107 -168
- package/package.json +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vee-validate
|
|
3
|
-
* (c)
|
|
2
|
+
* vee-validate v5.0.0-beta.1
|
|
3
|
+
* (c) 2026 Abdelrahman Awad
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
var VeeValidate = (function (exports, vue) {
|
|
@@ -163,11 +163,8 @@ var VeeValidate = (function (exports, vue) {
|
|
|
163
163
|
function isLocator(value) {
|
|
164
164
|
return isCallable(value) && !!value.__locatorRef;
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
return
|
|
168
|
-
}
|
|
169
|
-
function isYupValidator(value) {
|
|
170
|
-
return !!value && isCallable(value.validate);
|
|
166
|
+
function isStandardSchema(value) {
|
|
167
|
+
return isObject(value) && '~standard' in value;
|
|
171
168
|
}
|
|
172
169
|
function hasCheckedAttr(type) {
|
|
173
170
|
return type === 'checkbox' || type === 'radio';
|
|
@@ -347,6 +344,27 @@ var VeeValidate = (function (exports, vue) {
|
|
|
347
344
|
return a instanceof File;
|
|
348
345
|
}
|
|
349
346
|
|
|
347
|
+
// src/getDotPath/getDotPath.ts
|
|
348
|
+
function getDotPath(issue) {
|
|
349
|
+
if (issue.path?.length) {
|
|
350
|
+
let dotPath = "";
|
|
351
|
+
for (const item of issue.path) {
|
|
352
|
+
const key = typeof item === "object" ? item.key : item;
|
|
353
|
+
if (typeof key === "string" || typeof key === "number") {
|
|
354
|
+
if (dotPath) {
|
|
355
|
+
dotPath += `.${key}`;
|
|
356
|
+
} else {
|
|
357
|
+
dotPath += key;
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return dotPath;
|
|
364
|
+
}
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
|
|
350
368
|
function cleanupNonNestedPath(path) {
|
|
351
369
|
if (isNotNestedPath(path)) {
|
|
352
370
|
return path.replace(/\[|\]/gi, '');
|
|
@@ -562,6 +580,31 @@ var VeeValidate = (function (exports, vue) {
|
|
|
562
580
|
return new Promise(resolve => resolves.push(resolve));
|
|
563
581
|
};
|
|
564
582
|
}
|
|
583
|
+
function _combineIssueItems(items, getPath) {
|
|
584
|
+
const issueMap = {};
|
|
585
|
+
for (const item of items) {
|
|
586
|
+
const path = getPath(item);
|
|
587
|
+
if (!issueMap[path]) {
|
|
588
|
+
issueMap[path] = {
|
|
589
|
+
path,
|
|
590
|
+
messages: [],
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
if ('messages' in item) {
|
|
594
|
+
issueMap[path].messages.push(...item.messages);
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
issueMap[path].messages.push(item.message);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return Object.values(issueMap);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Aggregates standard schema issues by path.
|
|
604
|
+
*/
|
|
605
|
+
function combineStandardIssues(issues) {
|
|
606
|
+
return _combineIssueItems(issues, issue => { var _a; return (issue.path ? (_a = getDotPath(issue)) !== null && _a !== void 0 ? _a : '' : ''); });
|
|
607
|
+
}
|
|
565
608
|
|
|
566
609
|
function normalizeChildren(tag, context, slotProps) {
|
|
567
610
|
if (!context.slots.default) {
|
|
@@ -593,9 +636,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
593
636
|
}
|
|
594
637
|
|
|
595
638
|
function parseInputValue(el) {
|
|
596
|
-
if (el.type === 'number') {
|
|
597
|
-
return Number.isNaN(el.valueAsNumber) ? el.value : el.valueAsNumber;
|
|
598
|
-
}
|
|
599
639
|
if (el.type === 'range') {
|
|
600
640
|
return Number.isNaN(el.valueAsNumber) ? el.value : el.valueAsNumber;
|
|
601
641
|
}
|
|
@@ -768,8 +808,8 @@ var VeeValidate = (function (exports, vue) {
|
|
|
768
808
|
*/
|
|
769
809
|
async function _validate(field, value) {
|
|
770
810
|
const rules = field.rules;
|
|
771
|
-
if (
|
|
772
|
-
return
|
|
811
|
+
if (isStandardSchema(rules)) {
|
|
812
|
+
return validateFieldWithStandardSchema(value, Object.assign(Object.assign({}, field), { rules }));
|
|
773
813
|
}
|
|
774
814
|
// if a generic function or chain of generic functions
|
|
775
815
|
if (isCallable(rules) || Array.isArray(rules)) {
|
|
@@ -831,58 +871,24 @@ var VeeValidate = (function (exports, vue) {
|
|
|
831
871
|
errors,
|
|
832
872
|
};
|
|
833
873
|
}
|
|
834
|
-
function isYupError(err) {
|
|
835
|
-
return !!err && err.name === 'ValidationError';
|
|
836
|
-
}
|
|
837
|
-
function yupToTypedSchema(yupSchema) {
|
|
838
|
-
const schema = {
|
|
839
|
-
__type: 'VVTypedSchema',
|
|
840
|
-
async parse(values, context) {
|
|
841
|
-
var _a;
|
|
842
|
-
try {
|
|
843
|
-
const output = await yupSchema.validate(values, { abortEarly: false, context: (context === null || context === void 0 ? void 0 : context.formData) || {} });
|
|
844
|
-
return {
|
|
845
|
-
output,
|
|
846
|
-
errors: [],
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
catch (err) {
|
|
850
|
-
// Yup errors have a name prop one them.
|
|
851
|
-
// https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
|
|
852
|
-
if (!isYupError(err)) {
|
|
853
|
-
throw err;
|
|
854
|
-
}
|
|
855
|
-
if (!((_a = err.inner) === null || _a === void 0 ? void 0 : _a.length) && err.errors.length) {
|
|
856
|
-
return { errors: [{ path: err.path, errors: err.errors }] };
|
|
857
|
-
}
|
|
858
|
-
const errors = err.inner.reduce((acc, curr) => {
|
|
859
|
-
const path = curr.path || '';
|
|
860
|
-
if (!acc[path]) {
|
|
861
|
-
acc[path] = { errors: [], path };
|
|
862
|
-
}
|
|
863
|
-
acc[path].errors.push(...curr.errors);
|
|
864
|
-
return acc;
|
|
865
|
-
}, {});
|
|
866
|
-
return { errors: Object.values(errors) };
|
|
867
|
-
}
|
|
868
|
-
},
|
|
869
|
-
};
|
|
870
|
-
return schema;
|
|
871
|
-
}
|
|
872
874
|
/**
|
|
873
875
|
* Handles yup validation
|
|
874
876
|
*/
|
|
875
|
-
async function
|
|
876
|
-
const
|
|
877
|
-
|
|
877
|
+
async function validateFieldWithStandardSchema(value, context) {
|
|
878
|
+
const result = await context.rules['~standard'].validate(value);
|
|
879
|
+
if (!result.issues) {
|
|
880
|
+
return {
|
|
881
|
+
value: result.value,
|
|
882
|
+
errors: [],
|
|
883
|
+
};
|
|
884
|
+
}
|
|
878
885
|
const messages = [];
|
|
879
|
-
for (const error of result.
|
|
880
|
-
if (error.
|
|
881
|
-
messages.push(
|
|
886
|
+
for (const error of result.issues) {
|
|
887
|
+
if (error.message) {
|
|
888
|
+
messages.push(error.message);
|
|
882
889
|
}
|
|
883
890
|
}
|
|
884
891
|
return {
|
|
885
|
-
value: result.value,
|
|
886
892
|
errors: messages,
|
|
887
893
|
};
|
|
888
894
|
}
|
|
@@ -938,27 +944,33 @@ var VeeValidate = (function (exports, vue) {
|
|
|
938
944
|
return acc;
|
|
939
945
|
}, {});
|
|
940
946
|
}
|
|
941
|
-
async function
|
|
942
|
-
const
|
|
943
|
-
const validationResult = await typedSchema.parse(klona(values), { formData: klona(values) });
|
|
947
|
+
async function validateStandardSchema(schema, values) {
|
|
948
|
+
const validationResult = await schema['~standard'].validate(klona(values));
|
|
944
949
|
const results = {};
|
|
945
950
|
const errors = {};
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
951
|
+
if (!validationResult.issues) {
|
|
952
|
+
return {
|
|
953
|
+
valid: true,
|
|
954
|
+
results: {},
|
|
955
|
+
errors: {},
|
|
956
|
+
values: validationResult.value,
|
|
957
|
+
source: 'schema',
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
const combinedIssues = combineStandardIssues(validationResult.issues || []);
|
|
961
|
+
for (const error of combinedIssues) {
|
|
962
|
+
const messages = error.messages;
|
|
963
|
+
const path = error.path;
|
|
952
964
|
results[path] = { valid: !messages.length, errors: messages };
|
|
953
965
|
if (messages.length) {
|
|
954
966
|
errors[path] = messages[0];
|
|
955
967
|
}
|
|
956
968
|
}
|
|
957
969
|
return {
|
|
958
|
-
valid: !
|
|
970
|
+
valid: !combinedIssues.length,
|
|
959
971
|
results,
|
|
960
972
|
errors,
|
|
961
|
-
values:
|
|
973
|
+
values: undefined,
|
|
962
974
|
source: 'schema',
|
|
963
975
|
};
|
|
964
976
|
}
|
|
@@ -1003,7 +1015,7 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1003
1015
|
if (!init.form) {
|
|
1004
1016
|
const { errors, setErrors } = createFieldErrors();
|
|
1005
1017
|
const id = ID_COUNTER >= Number.MAX_SAFE_INTEGER ? 0 : ++ID_COUNTER;
|
|
1006
|
-
const meta = createFieldMeta(value, initialValue, errors
|
|
1018
|
+
const meta = createFieldMeta(value, initialValue, errors);
|
|
1007
1019
|
function setState(state) {
|
|
1008
1020
|
var _a;
|
|
1009
1021
|
if ('value' in state) {
|
|
@@ -1035,7 +1047,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1035
1047
|
label: init.label,
|
|
1036
1048
|
type: init.type,
|
|
1037
1049
|
validate: init.validate,
|
|
1038
|
-
schema: init.schema,
|
|
1039
1050
|
});
|
|
1040
1051
|
const errors = vue.computed(() => state.errors);
|
|
1041
1052
|
function setState(state) {
|
|
@@ -1131,13 +1142,11 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1131
1142
|
/**
|
|
1132
1143
|
* Creates meta flags state and some associated effects with them
|
|
1133
1144
|
*/
|
|
1134
|
-
function createFieldMeta(currentValue, initialValue, errors
|
|
1135
|
-
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; });
|
|
1145
|
+
function createFieldMeta(currentValue, initialValue, errors) {
|
|
1136
1146
|
const meta = vue.reactive({
|
|
1137
1147
|
touched: false,
|
|
1138
1148
|
pending: false,
|
|
1139
1149
|
valid: true,
|
|
1140
|
-
required: isRequired,
|
|
1141
1150
|
validated: !!vue.unref(errors).length,
|
|
1142
1151
|
initialValue: vue.computed(() => vue.unref(initialValue)),
|
|
1143
1152
|
dirty: vue.computed(() => {
|
|
@@ -1185,15 +1194,11 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1185
1194
|
return undefined;
|
|
1186
1195
|
}
|
|
1187
1196
|
const rulesValue = vue.unref(rules);
|
|
1188
|
-
if (
|
|
1189
|
-
isTypedSchema(rulesValue) ||
|
|
1190
|
-
isCallable(rulesValue) ||
|
|
1191
|
-
Array.isArray(rulesValue)) {
|
|
1197
|
+
if (isStandardSchema(rulesValue) || isCallable(rulesValue) || Array.isArray(rulesValue)) {
|
|
1192
1198
|
return rulesValue;
|
|
1193
1199
|
}
|
|
1194
1200
|
return normalizeRules(rulesValue);
|
|
1195
1201
|
});
|
|
1196
|
-
const isTyped = !isCallable(validator.value) && isTypedSchema(vue.toValue(rules));
|
|
1197
1202
|
const { id, value, initialValue, meta, setState, errors, flags } = useFieldState(name, {
|
|
1198
1203
|
modelValue,
|
|
1199
1204
|
form,
|
|
@@ -1201,7 +1206,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1201
1206
|
label,
|
|
1202
1207
|
type,
|
|
1203
1208
|
validate: validator.value ? validate$1 : undefined,
|
|
1204
|
-
schema: isTyped ? rules : undefined,
|
|
1205
1209
|
});
|
|
1206
1210
|
const errorMessage = vue.computed(() => errors.value[0]);
|
|
1207
1211
|
if (syncVModel) {
|
|
@@ -1353,12 +1357,8 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1353
1357
|
// extract cross-field dependencies in a computed prop
|
|
1354
1358
|
const dependencies = vue.computed(() => {
|
|
1355
1359
|
const rulesVal = validator.value;
|
|
1356
|
-
// is falsy, a function schema or a
|
|
1357
|
-
if (!rulesVal ||
|
|
1358
|
-
isCallable(rulesVal) ||
|
|
1359
|
-
isYupValidator(rulesVal) ||
|
|
1360
|
-
isTypedSchema(rulesVal) ||
|
|
1361
|
-
Array.isArray(rulesVal)) {
|
|
1360
|
+
// is falsy, a function schema or a standard schema
|
|
1361
|
+
if (!rulesVal || isCallable(rulesVal) || isStandardSchema(rulesVal) || Array.isArray(rulesVal)) {
|
|
1362
1362
|
return {};
|
|
1363
1363
|
}
|
|
1364
1364
|
return Object.keys(rulesVal).reduce((acc, rule) => {
|
|
@@ -1424,6 +1424,7 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1424
1424
|
* Normalizes partial field options to include the full options
|
|
1425
1425
|
*/
|
|
1426
1426
|
function normalizeOptions(opts) {
|
|
1427
|
+
var _a;
|
|
1427
1428
|
const defaults = () => ({
|
|
1428
1429
|
initialValue: undefined,
|
|
1429
1430
|
validateOnMount: false,
|
|
@@ -1435,22 +1436,19 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1435
1436
|
controlled: true,
|
|
1436
1437
|
});
|
|
1437
1438
|
const isVModelSynced = !!(opts === null || opts === void 0 ? void 0 : opts.syncVModel);
|
|
1438
|
-
const modelPropName = typeof (opts === null || opts === void 0 ? void 0 : opts.syncVModel) === 'string' ? opts.syncVModel :
|
|
1439
|
+
const modelPropName = typeof (opts === null || opts === void 0 ? void 0 : opts.syncVModel) === 'string' ? opts.syncVModel : 'modelValue';
|
|
1439
1440
|
const initialValue = isVModelSynced && !('initialValue' in (opts || {}))
|
|
1440
1441
|
? getCurrentModelValue(vue.getCurrentInstance(), modelPropName)
|
|
1441
1442
|
: opts === null || opts === void 0 ? void 0 : opts.initialValue;
|
|
1442
1443
|
if (!opts) {
|
|
1443
1444
|
return Object.assign(Object.assign({}, defaults()), { initialValue });
|
|
1444
1445
|
}
|
|
1445
|
-
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
const syncVModel = (opts === null || opts === void 0 ? void 0 : opts.modelPropName) || (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,
|
|
1450
|
-
syncVModel });
|
|
1446
|
+
const controlled = (_a = opts.controlled) !== null && _a !== void 0 ? _a : true;
|
|
1447
|
+
const syncVModel = (opts === null || opts === void 0 ? void 0 : opts.syncVModel) || false;
|
|
1448
|
+
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 });
|
|
1451
1449
|
}
|
|
1452
1450
|
function useFieldWithChecked(name, rules, opts) {
|
|
1453
|
-
const form =
|
|
1451
|
+
const form = (opts === null || opts === void 0 ? void 0 : opts.controlled) ? injectWithSelf(FormContextKey) : undefined;
|
|
1454
1452
|
const checkedValue = opts === null || opts === void 0 ? void 0 : opts.checkedValue;
|
|
1455
1453
|
const uncheckedValue = opts === null || opts === void 0 ? void 0 : opts.uncheckedValue;
|
|
1456
1454
|
function patchCheckedApi(field) {
|
|
@@ -1584,9 +1582,9 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1584
1582
|
type: null,
|
|
1585
1583
|
default: undefined,
|
|
1586
1584
|
},
|
|
1587
|
-
|
|
1585
|
+
controlled: {
|
|
1588
1586
|
type: Boolean,
|
|
1589
|
-
default:
|
|
1587
|
+
default: true,
|
|
1590
1588
|
},
|
|
1591
1589
|
keepValue: {
|
|
1592
1590
|
type: Boolean,
|
|
@@ -1602,7 +1600,7 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1602
1600
|
const { errors, value, errorMessage, validate: validateField, handleChange, handleBlur, setTouched, resetField, handleReset, meta, checked, setErrors, setValue, } = useField(name, rules, {
|
|
1603
1601
|
validateOnMount: props.validateOnMount,
|
|
1604
1602
|
bails: props.bails,
|
|
1605
|
-
|
|
1603
|
+
controlled: props.controlled,
|
|
1606
1604
|
type: ctx.attrs.type,
|
|
1607
1605
|
initialValue: resolveInitialValue(props, ctx),
|
|
1608
1606
|
// Only for checkboxes and radio buttons
|
|
@@ -1733,10 +1731,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1733
1731
|
function resolveInitialValues(opts) {
|
|
1734
1732
|
const givenInitial = (opts === null || opts === void 0 ? void 0 : opts.initialValues) || {};
|
|
1735
1733
|
const providedValues = Object.assign({}, vue.toValue(givenInitial));
|
|
1736
|
-
const schema = vue.unref(opts === null || opts === void 0 ? void 0 : opts.validationSchema);
|
|
1737
|
-
if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
|
|
1738
|
-
return klona(schema.cast(providedValues) || {});
|
|
1739
|
-
}
|
|
1740
1734
|
return klona(providedValues);
|
|
1741
1735
|
}
|
|
1742
1736
|
function useForm(opts) {
|
|
@@ -1871,19 +1865,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1871
1865
|
if (unsetBatchIndex !== -1) {
|
|
1872
1866
|
UNSET_BATCH.splice(unsetBatchIndex, 1);
|
|
1873
1867
|
}
|
|
1874
|
-
const isRequired = vue.computed(() => {
|
|
1875
|
-
var _a, _b, _c, _d;
|
|
1876
|
-
const schemaValue = vue.toValue(schema);
|
|
1877
|
-
if (isTypedSchema(schemaValue)) {
|
|
1878
|
-
return (_b = (_a = schemaValue.describe) === null || _a === void 0 ? void 0 : _a.call(schemaValue, vue.toValue(path)).required) !== null && _b !== void 0 ? _b : false;
|
|
1879
|
-
}
|
|
1880
|
-
// Path own schema
|
|
1881
|
-
const configSchemaValue = vue.toValue(config === null || config === void 0 ? void 0 : config.schema);
|
|
1882
|
-
if (isTypedSchema(configSchemaValue)) {
|
|
1883
|
-
return (_d = (_c = configSchemaValue.describe) === null || _c === void 0 ? void 0 : _c.call(configSchemaValue).required) !== null && _d !== void 0 ? _d : false;
|
|
1884
|
-
}
|
|
1885
|
-
return false;
|
|
1886
|
-
});
|
|
1887
1868
|
const id = FIELD_ID_COUNTER++;
|
|
1888
1869
|
const state = vue.reactive({
|
|
1889
1870
|
id,
|
|
@@ -1892,7 +1873,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
1892
1873
|
pending: false,
|
|
1893
1874
|
valid: true,
|
|
1894
1875
|
validated: !!((_a = initialErrors[pathValue]) === null || _a === void 0 ? void 0 : _a.length),
|
|
1895
|
-
required: isRequired,
|
|
1896
1876
|
initialValue,
|
|
1897
1877
|
errors: vue.shallowRef([]),
|
|
1898
1878
|
bails: (_b = config === null || config === void 0 ? void 0 : config.bails) !== null && _b !== void 0 ? _b : false,
|
|
@@ -2167,9 +2147,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
2167
2147
|
resetForm,
|
|
2168
2148
|
resetField,
|
|
2169
2149
|
handleSubmit,
|
|
2170
|
-
useFieldModel,
|
|
2171
|
-
defineInputBinds,
|
|
2172
|
-
defineComponentBinds: defineComponentBinds,
|
|
2173
2150
|
defineField,
|
|
2174
2151
|
stageInitialValue,
|
|
2175
2152
|
unsetInitialValue,
|
|
@@ -2305,7 +2282,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
2305
2282
|
function resetForm(resetState, opts) {
|
|
2306
2283
|
let newValues = klona((resetState === null || resetState === void 0 ? void 0 : resetState.values) ? resetState.values : originalInitialValues.value);
|
|
2307
2284
|
newValues = (opts === null || opts === void 0 ? void 0 : opts.force) ? newValues : merge(originalInitialValues.value, newValues);
|
|
2308
|
-
newValues = isTypedSchema(schema) && isCallable(schema.cast) ? schema.cast(newValues) : newValues;
|
|
2309
2285
|
setInitialValues(newValues, { force: opts === null || opts === void 0 ? void 0 : opts.force });
|
|
2310
2286
|
mutateAllPathState(state => {
|
|
2311
2287
|
var _a;
|
|
@@ -2418,8 +2394,8 @@ var VeeValidate = (function (exports, vue) {
|
|
|
2418
2394
|
return { valid: true, results: {}, errors: {}, source: 'none' };
|
|
2419
2395
|
}
|
|
2420
2396
|
isValidating.value = true;
|
|
2421
|
-
const formResult =
|
|
2422
|
-
? await
|
|
2397
|
+
const formResult = isStandardSchema(schemaValue)
|
|
2398
|
+
? await validateStandardSchema(schemaValue, formValues)
|
|
2423
2399
|
: await validateObjectSchema(schemaValue, formValues, {
|
|
2424
2400
|
names: fieldNames.value,
|
|
2425
2401
|
bailsMap: fieldBailsMap.value,
|
|
@@ -2506,50 +2482,6 @@ var VeeValidate = (function (exports, vue) {
|
|
|
2506
2482
|
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; });
|
|
2507
2483
|
return [model, props];
|
|
2508
2484
|
}
|
|
2509
|
-
function useFieldModel(pathOrPaths) {
|
|
2510
|
-
if (!Array.isArray(pathOrPaths)) {
|
|
2511
|
-
return createModel(pathOrPaths);
|
|
2512
|
-
}
|
|
2513
|
-
return pathOrPaths.map(p => createModel(p, true));
|
|
2514
|
-
}
|
|
2515
|
-
/**
|
|
2516
|
-
* @deprecated use defineField instead
|
|
2517
|
-
*/
|
|
2518
|
-
function defineInputBinds(path, config) {
|
|
2519
|
-
const [model, props] = defineField(path, config);
|
|
2520
|
-
function onBlur() {
|
|
2521
|
-
props.value.onBlur();
|
|
2522
|
-
}
|
|
2523
|
-
function onInput(e) {
|
|
2524
|
-
const value = normalizeEventValue(e);
|
|
2525
|
-
setFieldValue(vue.toValue(path), value, false);
|
|
2526
|
-
props.value.onInput();
|
|
2527
|
-
}
|
|
2528
|
-
function onChange(e) {
|
|
2529
|
-
const value = normalizeEventValue(e);
|
|
2530
|
-
setFieldValue(vue.toValue(path), value, false);
|
|
2531
|
-
props.value.onChange();
|
|
2532
|
-
}
|
|
2533
|
-
return vue.computed(() => {
|
|
2534
|
-
return Object.assign(Object.assign({}, props.value), { onBlur,
|
|
2535
|
-
onInput,
|
|
2536
|
-
onChange, value: model.value });
|
|
2537
|
-
});
|
|
2538
|
-
}
|
|
2539
|
-
/**
|
|
2540
|
-
* @deprecated use defineField instead
|
|
2541
|
-
*/
|
|
2542
|
-
function defineComponentBinds(path, config) {
|
|
2543
|
-
const [model, props] = defineField(path, config);
|
|
2544
|
-
const pathState = findPathState(vue.toValue(path));
|
|
2545
|
-
function onUpdateModelValue(value) {
|
|
2546
|
-
model.value = value;
|
|
2547
|
-
}
|
|
2548
|
-
return vue.computed(() => {
|
|
2549
|
-
const conf = isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {};
|
|
2550
|
-
return Object.assign({ [conf.model || 'modelValue']: model.value, [`onUpdate:${conf.model || 'modelValue'}`]: onUpdateModelValue }, props.value);
|
|
2551
|
-
});
|
|
2552
|
-
}
|
|
2553
2485
|
const ctx = Object.assign(Object.assign({}, formCtx), { values: vue.readonly(formValues), handleReset: () => resetForm(), submitForm });
|
|
2554
2486
|
vue.provide(PublicFormContextKey, ctx);
|
|
2555
2487
|
return ctx;
|
|
@@ -3427,6 +3359,7 @@ var VeeValidate = (function (exports, vue) {
|
|
|
3427
3359
|
exports.cleanupNonNestedPath = cleanupNonNestedPath;
|
|
3428
3360
|
exports.configure = configure;
|
|
3429
3361
|
exports.defineRule = defineRule;
|
|
3362
|
+
exports.getConfig = getConfig;
|
|
3430
3363
|
exports.isNotNestedPath = isNotNestedPath;
|
|
3431
3364
|
exports.normalizeRules = normalizeRules;
|
|
3432
3365
|
exports.useField = useField;
|