1
1
import React from 'react' ;
2
2
import { TextPrompt , PasswordPrompt , DialogPrompt , DialogPromptOptions } from './Prompts' ;
3
3
import PromptInput from './PromptInput' ;
4
- import DialogAction , { DialogActionCallback } from './DialogAction' ;
4
+ import DialogAction , { DialogActionCallback , DialogActionLabel } from './DialogAction' ;
5
5
declare type DialogTitle = React . ReactNode ;
6
6
declare type DialogBody = React . ReactNode ;
7
+ declare type DialogOnHideClalback = ( ( dialog : Dialog ) => void ) ;
7
8
interface DialogKeyBinds {
8
9
[ id : string ] : Function ;
9
10
}
@@ -16,23 +17,29 @@ interface DialogKeyBinds {
16
17
* v4 later has "sm"
17
18
*/
18
19
declare type DialogBsSize = any ;
19
- export interface DialogOptions {
20
- showModal ?: boolean ;
21
- actions ?: DialogAction [ ] ;
22
- defaultOkLabel ?: string ;
23
- defaultCancelLabel ?: string ;
20
+ export interface DialogGlobalOptions {
21
+ defaultOkLabel ?: DialogActionLabel ;
22
+ defaultCancelLabel ?: DialogActionLabel ;
24
23
primaryClassName ?: string ;
25
24
defaultButtonClassName ?: string ;
26
25
}
26
+ export interface DialogOptions {
27
+ title ?: DialogTitle | null ;
28
+ body ?: DialogBody | null ;
29
+ actions ?: DialogAction [ ] | null ;
30
+ bsSize ?: DialogBsSize | null ;
31
+ onHide ?: DialogOnHideClalback | null ;
32
+ prompt ?: DialogPrompt | null ;
33
+ }
27
34
interface Props {
28
35
}
29
36
interface State {
30
37
title ?: DialogTitle | null ;
31
38
body ?: DialogBody | null ;
32
39
showModal ?: boolean ;
33
- actions ?: DialogAction [ ] ;
34
- bsSize ?: DialogBsSize ;
35
- onHide ?: ( ( dialog : Dialog ) => void ) | null ;
40
+ actions ?: DialogAction [ ] | null ;
41
+ bsSize ?: DialogBsSize | null ;
42
+ onHide ?: DialogOnHideClalback | null ;
36
43
prompt ?: DialogPrompt | null ;
37
44
}
38
45
/**
@@ -48,7 +55,7 @@ export default class Dialog extends React.Component<Props, State> {
48
55
primaryClassName : string ;
49
56
defaultButtonClassName : string ;
50
57
} ;
51
- static options : DialogOptions ;
58
+ static options : DialogGlobalOptions ;
52
59
promptInput : PromptInput | null ;
53
60
keyBinds : DialogKeyBinds | null ;
54
61
static Action : ( label : React . ReactNode , func : DialogActionCallback | null | undefined , className : string | null | undefined , key : string ) => DialogAction ;
@@ -63,7 +70,7 @@ export default class Dialog extends React.Component<Props, State> {
63
70
* Set default options for applying to all dialogs.
64
71
* @param options
65
72
*/
66
- static setOptions ( options : DialogOptions ) : void ;
73
+ static setOptions ( options : DialogGlobalOptions ) : void ;
67
74
/**
68
75
* Reset default options to presets.
69
76
*/
0 commit comments