/
index.d.ts
96 lines (80 loc) · 2.85 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import type { PluginOptions, UIPlugin, PluginTarget, UppyFile, GenericEventCallback, IndexedObject } from '@uppy/core'
import type { StatusBarLocale } from '@uppy/status-bar'
import type { ThumbnailOptions } from '@uppy/thumbnail-generator'
import DashboardLocale from './generatedLocale'
type FieldRenderOptions = {
value: string,
onChange: (newVal: string) => void
fieldCSSClasses: { text: string }
required: boolean
form: string
}
type PreactRender = (node: any, params: Record<string, unknown> | null, ...children: any[]) => any
interface MetaField {
id: string
name: string
placeholder?: string
render?: (field: FieldRenderOptions, h: PreactRender) => any
}
type Options = PluginOptions & ThumbnailOptions
export interface DashboardOptions extends Options {
animateOpenClose?: boolean
browserBackButtonClose?: boolean
closeAfterFinish?: boolean
closeModalOnClickOutside?: boolean
disableInformer?: boolean
disablePageScrollWhenModalOpen?: boolean
disableStatusBar?: boolean
disableThumbnailGenerator?: boolean
height?: string | number
hideCancelButton?: boolean
hidePauseResumeButton?: boolean
hideProgressAfterFinish?: boolean
hideRetryButton?: boolean
hideUploadButton?: boolean
inline?: boolean
locale?: DashboardLocale & StatusBarLocale
metaFields?: MetaField[] | ((file: UppyFile) => MetaField[])
note?: string | null
plugins?: string[]
fileManagerSelectionType?: 'files' | 'folders' | 'both';
proudlyDisplayPoweredByUppy?: boolean
showLinkToFileUploadResult?: boolean
showProgressDetails?: boolean
showSelectedFiles?: boolean
showRemoveButtonAfterComplete?: boolean
target?: PluginTarget
theme?: 'auto' | 'dark' | 'light'
trigger?: string
width?: string | number
autoOpenFileEditor?: boolean
disabled?: boolean
disableLocalFiles?: boolean
onRequestCloseModal?: () => void
doneButtonHandler?: () => void
onDragOver?: (event: DragEvent) => void
onDragLeave?: (event: DragEvent) => void
onDrop?: (event: DragEvent) => void
}
declare class Dashboard extends UIPlugin<DashboardOptions> {
addTarget (plugin: UIPlugin): HTMLElement
hideAllPanels (): void
openModal (): void
closeModal (): void
isModalOpen (): boolean
render (state: Record<string, unknown>): void
install (): void
uninstall (): void
}
export default Dashboard
// Events
export type DashboardFileEditStartCallback<TMeta extends IndexedObject<any>> = (file: UppyFile<TMeta>) => void;
export type DashboardFileEditCompleteCallback<TMeta extends IndexedObject<any>> = (file: UppyFile<TMeta>) => void;
declare module '@uppy/core' {
export interface UppyEventMap<TMeta> {
'dashboard:modal-open': GenericEventCallback
'dashboard:modal-closed': GenericEventCallback
'dashboard:file-edit-state': DashboardFileEditStartCallback<TMeta>
'dashboard:file-edit-complete': DashboardFileEditCompleteCallback<TMeta>
}
}