mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
feat(Form): add prop to disable state transformation (#3356)
This commit is contained in:
@@ -20,6 +20,7 @@ export interface FormProps<T extends object> {
|
||||
disabled?: boolean
|
||||
validateOnInputDelay?: number
|
||||
class?: any
|
||||
transform?: boolean
|
||||
onSubmit?: ((event: FormSubmitEvent<T>) => void | Promise<void>) | (() => void | Promise<void>)
|
||||
}
|
||||
|
||||
@@ -46,8 +47,10 @@ const props = withDefaults(defineProps<FormProps<T>>(), {
|
||||
validateOn() {
|
||||
return ['input', 'blur', 'change'] as FormInputEvents[]
|
||||
},
|
||||
validateOnInputDelay: 300
|
||||
validateOnInputDelay: 300,
|
||||
transform: true
|
||||
})
|
||||
|
||||
const emits = defineEmits<FormEmits<T>>()
|
||||
defineSlots<FormSlots>()
|
||||
|
||||
@@ -195,7 +198,7 @@ async function onSubmitWrapper(payload: Event) {
|
||||
const event = payload as FormSubmitEvent<any>
|
||||
|
||||
try {
|
||||
event.data = await _validate({ nested: true, transform: true })
|
||||
event.data = await _validate({ nested: true, transform: props.transform })
|
||||
await props.onSubmit?.(event)
|
||||
} catch (error) {
|
||||
if (!(error instanceof FormValidationException)) {
|
||||
|
||||
Reference in New Issue
Block a user