@inertiajs/vue3 2.3.13 → 2.3.14
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/dist/index.esm.js +10 -9
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +9 -9
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
- package/types/form.d.ts +3 -3
- package/types/useForm.d.ts +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -120,7 +120,7 @@ function useForm(...args) {
|
|
|
120
120
|
withPrecognition(...args2) {
|
|
121
121
|
precognitionEndpoint = UseFormUtils.createWayfinderCallback(...args2);
|
|
122
122
|
const formWithPrecognition = this;
|
|
123
|
-
let withAllErrors =
|
|
123
|
+
let withAllErrors = null;
|
|
124
124
|
const validator = createValidator((client) => {
|
|
125
125
|
const { method, url } = precognitionEndpoint();
|
|
126
126
|
const transformedData = cloneDeep2(transform(this.data()));
|
|
@@ -134,7 +134,7 @@ function useForm(...args) {
|
|
|
134
134
|
}).on("touchedChanged", () => {
|
|
135
135
|
formWithPrecognition.__touched = validator.touched();
|
|
136
136
|
}).on("errorsChanged", () => {
|
|
137
|
-
const validationErrors = withAllErrors ? validator.errors() : toSimpleValidationErrors(validator.errors());
|
|
137
|
+
const validationErrors = withAllErrors ?? config.get("form.withAllErrors") ? validator.errors() : toSimpleValidationErrors(validator.errors());
|
|
138
138
|
this.errors = {};
|
|
139
139
|
this.setError(validationErrors);
|
|
140
140
|
formWithPrecognition.__valid = validator.valid();
|
|
@@ -165,17 +165,17 @@ function useForm(...args) {
|
|
|
165
165
|
return formWithPrecognition;
|
|
166
166
|
},
|
|
167
167
|
touched: (field) => typeof field === "string" ? formWithPrecognition.__touched.includes(field) : formWithPrecognition.__touched.length > 0,
|
|
168
|
-
validate: (field,
|
|
168
|
+
validate: (field, config3) => {
|
|
169
169
|
if (typeof field === "object" && !("target" in field)) {
|
|
170
|
-
|
|
170
|
+
config3 = field;
|
|
171
171
|
field = void 0;
|
|
172
172
|
}
|
|
173
173
|
if (field === void 0) {
|
|
174
|
-
validator.validate(
|
|
174
|
+
validator.validate(config3);
|
|
175
175
|
} else {
|
|
176
176
|
const fieldName = resolveName(field);
|
|
177
177
|
const transformedData = transform(this.data());
|
|
178
|
-
validator.validate(fieldName, get(transformedData, fieldName),
|
|
178
|
+
validator.validate(fieldName, get(transformedData, fieldName), config3);
|
|
179
179
|
}
|
|
180
180
|
return formWithPrecognition;
|
|
181
181
|
},
|
|
@@ -603,6 +603,7 @@ var deferred_default = defineComponent2({
|
|
|
603
603
|
|
|
604
604
|
// src/form.ts
|
|
605
605
|
import {
|
|
606
|
+
config as config2,
|
|
606
607
|
FormComponentResetSymbol,
|
|
607
608
|
formDataToObject,
|
|
608
609
|
isUrlMethodPair,
|
|
@@ -726,7 +727,7 @@ var Form = defineComponent3({
|
|
|
726
727
|
},
|
|
727
728
|
withAllErrors: {
|
|
728
729
|
type: Boolean,
|
|
729
|
-
default:
|
|
730
|
+
default: null
|
|
730
731
|
}
|
|
731
732
|
},
|
|
732
733
|
setup(props, { slots, attrs, expose }) {
|
|
@@ -741,7 +742,7 @@ var Form = defineComponent3({
|
|
|
741
742
|
if (props.validateFiles) {
|
|
742
743
|
form.validateFiles();
|
|
743
744
|
}
|
|
744
|
-
if (props.withAllErrors) {
|
|
745
|
+
if (props.withAllErrors ?? config2.get("form.withAllErrors")) {
|
|
745
746
|
form.withAllErrors();
|
|
746
747
|
}
|
|
747
748
|
const formElement = ref2();
|
|
@@ -880,7 +881,7 @@ var Form = defineComponent3({
|
|
|
880
881
|
valid: form.valid,
|
|
881
882
|
invalid: form.invalid,
|
|
882
883
|
touched: form.touched,
|
|
883
|
-
validate: (field,
|
|
884
|
+
validate: (field, config3) => form.validate(...UseFormUtils2.mergeHeadersForValidation(field, config3, props.headers)),
|
|
884
885
|
validator: () => form.validator()
|
|
885
886
|
};
|
|
886
887
|
expose(exposed);
|