@betterstart/cli 0.1.55 → 0.1.57
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/cli.js +15 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2714,15 +2714,24 @@ ${formComponentDecl}() {
|
|
|
2714
2714
|
${p7.defaults}
|
|
2715
2715
|
},
|
|
2716
2716
|
})
|
|
2717
|
+
|
|
2717
2718
|
${p7.fieldArraySetup}${p7.watchSetup}
|
|
2718
2719
|
async function handleNext() {
|
|
2719
|
-
const
|
|
2720
|
-
|
|
2721
|
-
)
|
|
2720
|
+
const stepFields = STEPS[currentStep].fields as (keyof FormValues)[]
|
|
2721
|
+
const values = form.getValues()
|
|
2722
|
+
form.clearErrors(stepFields)
|
|
2723
|
+
let isValid = true
|
|
2724
|
+
for (const fieldName of stepFields) {
|
|
2725
|
+
const fieldSchema = formSchema.shape[fieldName]
|
|
2726
|
+
if (!fieldSchema) continue
|
|
2727
|
+
const result = fieldSchema.safeParse(values[fieldName])
|
|
2728
|
+
if (!result.success) {
|
|
2729
|
+
form.setError(fieldName, { type: 'validate', message: result.error.issues[0].message })
|
|
2730
|
+
isValid = false
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2722
2733
|
if (isValid) {
|
|
2723
|
-
|
|
2724
|
-
form.clearErrors(STEPS[next].fields as (keyof FormValues)[])
|
|
2725
|
-
setCurrentStep(next)
|
|
2734
|
+
setCurrentStep(currentStep + 1)
|
|
2726
2735
|
}
|
|
2727
2736
|
}
|
|
2728
2737
|
|