mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-20 06:51:46 +01:00
feat(Form): improve form control and input validation trigger (#487)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
committed by
Benjamin Canac
parent
60bb74675c
commit
6d7973f6e1
12
src/runtime/types/form.d.ts
vendored
12
src/runtime/types/form.d.ts
vendored
@@ -4,10 +4,18 @@ export interface FormError {
|
||||
}
|
||||
|
||||
export interface Form<T> {
|
||||
validate(): Promise<T>
|
||||
validate(path?: string, opts: { silent?: boolean } = { silent: false }): Promise<T>
|
||||
clear(path?: string): void
|
||||
errors: Ref<FormError[]>
|
||||
setErrors(errs: FormError[], path?: string): void
|
||||
getErrors(path?: string): FormError[]
|
||||
}
|
||||
|
||||
export type FormSubmitEvent<T> = SubmitEvent & { data: T }
|
||||
|
||||
export type FormEventType = 'blur' | 'input' | 'change' | 'submit'
|
||||
|
||||
export interface FormEvent {
|
||||
type: 'blur' // | 'change' | 'focus'
|
||||
type: FormEventType
|
||||
path: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user