-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathDialog.ts
40 lines (37 loc) · 1017 Bytes
/
Dialog.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
import { GetPropsAddString, GetTransformFnKeys } from './common'
/** IDialog type */
export interface IDialogBtn {
text?: string
active?: boolean
disabled?: boolean
href?: string
}
export interface DialogProps {
type?: string
icon?: string
title?: string
content?: string
showClose?: boolean
confirmBtn?: string|IDialogBtn
cancelBtn?: string|IDialogBtn
visible?: boolean
maskClosable?: boolean
zIndex?: number
prompt?: {
value?: string|number
placeholder?: string
}
}
type DialogCloseEventHandler = (e: MouseEvent) => void
type DialogConfirmEventHandler = (e: MouseEvent, promptValue: string) => void
interface EventsProps {
cancel: DialogCloseEventHandler
confirm: DialogConfirmEventHandler
close: DialogCloseEventHandler
}
type TransfromEventsProps = GetTransformFnKeys<EventsProps>
type AddStringProps = GetPropsAddString<DialogProps>
export interface IDialog extends DialogProps, TransfromEventsProps {
$props?: AddStringProps
$events?: Partial<EventsProps>
}