Skip to content

Commit

Permalink
feat(ui/types): uploader提供jsx,tsx类型支持
Browse files Browse the repository at this point in the history
affects: @varlet/ui
  • Loading branch information
haoziqaq committed Apr 24, 2021
1 parent 8818998 commit b156587
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion packages/varlet-ui/types/uploader.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
import { VarComponent } from './varComponent'

export class Uploader extends VarComponent {}
interface VarFile {
file?: File
name?: string
url?: string
cover?: string
fit?: string
state?: 'loading' | 'success' | 'error'
}

type ValidateTriggers = 'onChange' | 'onRemove'

interface UploaderProps {
modelValue?: VarFile[]
accept?: string
capture?: string
multiple?: boolean
readonly?: boolean
disabled?: boolean
removable?: boolean
maxlength?: string | number
maxsize?: string | number
previewed?: boolean
ripple?: boolean
validateTrigger?: Array<ValidateTriggers>
rules?: Array<(v: VarFile) => any>
onBeforeRead?: (file: VarFile) => Promise<boolean> | boolean
onAfterRead?: (file: VarFile) => any
onOversize?: (file: VarFile) => any
onRemove?: (file: VarFile) => any
'onUpdate:modelValue'?: (files: VarFile[]) => any
}

export class Uploader extends VarComponent {
$props: UploaderProps

getLoading(varFiles: VarFile[]): VarFile[]

getSuccess(varFiles: VarFile[]): VarFile[]

getError(varFiles: VarFile[]): VarFile[]

validate(): Promise<boolean>

resetValidation(): void

reset(): void
}

0 comments on commit b156587

Please sign in to comment.