mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-22 07:50:36 +01:00
Merge branch 'main' of https://github.com/benjamincanac/nuxt-ui3 into dev
This commit is contained in:
5
src/runtime/types/app.config.d.ts
vendored
Normal file
5
src/runtime/types/app.config.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare module '#build/app.config' {
|
||||
import type { AppConfig } from '@nuxt/schema'
|
||||
const _default: AppConfig
|
||||
export default _default
|
||||
}
|
||||
82
src/runtime/types/form.d.ts
vendored
82
src/runtime/types/form.d.ts
vendored
@@ -1,7 +1,25 @@
|
||||
import type { Ref } from 'vue'
|
||||
import type { ComputedRef, Ref } from 'vue'
|
||||
|
||||
export interface FormError<T extends string = string> {
|
||||
path: T
|
||||
export interface Form<T> {
|
||||
validate (opts?: { name: string | string[], silent?: false, nested?: boolean }): Promise<T | false>
|
||||
clear (path?: string): void
|
||||
errors: Ref<FormError[]>
|
||||
setErrors (errs: FormError[], path?: string): void
|
||||
getErrors (path?: string): FormError[]
|
||||
submit (): Promise<void>
|
||||
disabled: ComputedRef<boolean>
|
||||
}
|
||||
|
||||
export type FormSchema<T extends object> =
|
||||
| ZodSchema
|
||||
| YupObjectSchema<T>
|
||||
| ValibotObjectSchema<T>
|
||||
| JoiSchema<T>
|
||||
|
||||
export type FormInputEvents = 'input' | 'blur' | 'change'
|
||||
|
||||
export interface FormError<P extends string = string> {
|
||||
name: P
|
||||
message: string
|
||||
}
|
||||
|
||||
@@ -9,30 +27,48 @@ export interface FormErrorWithId extends FormError {
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface Form<T> {
|
||||
validate(path?: string | string[], opts?: { silent?: true }): Promise<T | false>;
|
||||
validate(path?: string | string[], opts?: { silent?: false }): Promise<T>;
|
||||
clear(path?: string): void
|
||||
errors: Ref<FormError[]>
|
||||
setErrors(errs: FormError[], path?: string): void
|
||||
getErrors(path?: string): FormError[]
|
||||
submit(): Promise<void>
|
||||
}
|
||||
|
||||
export type FormSubmitEvent<T> = SubmitEvent & { data: T }
|
||||
export type FormErrorEvent = SubmitEvent & { errors: FormErrorWithId[] }
|
||||
|
||||
export type FormEventType = 'blur' | 'input' | 'change' | 'submit'
|
||||
export type FormValidationError = {
|
||||
errors: FormErrorWithId[]
|
||||
childrens: FormValidationError[]
|
||||
}
|
||||
|
||||
export interface FormEvent {
|
||||
export type FormErrorEvent = SubmitEvent & FormValidationError
|
||||
|
||||
export type FormEventType = FormInputEvents
|
||||
|
||||
export type FormChildAttachEvent = {
|
||||
type: 'attach'
|
||||
formId: string | number
|
||||
validate: Form<any>['validate']
|
||||
}
|
||||
|
||||
export type FormChildDetachEvent = {
|
||||
type: 'detach'
|
||||
formId: string | number
|
||||
}
|
||||
|
||||
export type FormInputEvent = {
|
||||
type: FormEventType
|
||||
path?: string
|
||||
name?: string
|
||||
}
|
||||
|
||||
export interface InjectedFormGroupValue {
|
||||
inputId: Ref<string | undefined>
|
||||
name: Ref<string>
|
||||
size: Ref<string | number | symbol>
|
||||
error: Ref<string | boolean | undefined>
|
||||
eagerValidation: Ref<boolean>
|
||||
export type FormEvent =
|
||||
| FormInputEvent
|
||||
| FormChildAttachEvent
|
||||
| FormChildDetachEvent
|
||||
|
||||
export interface FormInjectedOptions {
|
||||
disabled?: ComputedRef<boolean>
|
||||
validateOnInputDelay?: ComputedRef<number>
|
||||
}
|
||||
|
||||
export interface FormFieldInjectedOptions<T> {
|
||||
inputId: Ref<string | undefined>
|
||||
name: ComputedRef<string | undefined>
|
||||
size: ComputedRef<T['size']>
|
||||
error: ComputedRef<string | boolean | undefined>
|
||||
eagerValidation: ComputedRef<boolean | undefined>
|
||||
validateOnInputDelay: ComputedRef<number | undefined>
|
||||
}
|
||||
|
||||
31
src/runtime/types/index.d.ts
vendored
31
src/runtime/types/index.d.ts
vendored
@@ -1,31 +0,0 @@
|
||||
export * from './accordion'
|
||||
export * from './alert'
|
||||
export * from './avatar'
|
||||
export * from './badge'
|
||||
export * from './breadcrumb'
|
||||
export * from './button'
|
||||
export * from './chip'
|
||||
export * from './clipboard'
|
||||
export * from './command-palette'
|
||||
export * from './divider'
|
||||
export * from './dropdown'
|
||||
export * from './form-group'
|
||||
export * from './form'
|
||||
export * from './horizontal-navigation'
|
||||
export * from './input'
|
||||
export * from './kbd'
|
||||
export * from './link'
|
||||
export * from './meter'
|
||||
export * from './modal'
|
||||
export * from './slideover'
|
||||
export * from './notification'
|
||||
export * from './popper'
|
||||
export * from './progress'
|
||||
export * from './range'
|
||||
export * from './select'
|
||||
export * from './tabs'
|
||||
export * from './textarea'
|
||||
export * from './toggle'
|
||||
export * from './tooltip'
|
||||
export * from './vertical-navigation'
|
||||
export * from './utils'
|
||||
|
||||
Reference in New Issue
Block a user