forked from vueComponent/ant-design-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modal.d.ts
299 lines (256 loc) · 6.01 KB
/
modal.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
import { VNode } from 'vue';
import { TreeNode } from './tree-node';
import { Button } from './button/button';
export interface ModalOptions {
/**
* Specify which button to autofocus
* @default 'ok'
* @type string | null
*/
autoFocusButton?: string | null;
/**
* Text of the Cancel button
* @default 'cancel'
* @type string
*/
cancelText?: string;
/**
* Centered Modal
* @default false
* @type boolean
*/
centered?: boolean;
/**
* class of container
* @type string
*/
class?: string;
/**
* Modal content
* @type string | VNode
*/
content?: string | VNode;
/**
* Icon type of the Icon component
* @default 'question-circle'
* @type string
*/
iconType?: string;
/**
* Whether support press esc to close
* @default true
* @type boolean
*/
keyboard?: boolean;
/**
* Whether to close the modal dialog when the mask (area outside the modal) is clicked
* @default false
* @type boolean
*/
maskClosable?: boolean;
/**
* Text of the OK button
* @default 'OK'
* @type string
*/
okText?: string;
/**
* Button type of the OK button
* @default 'primary'
* @type string
*/
okType?: string;
/**
* The ok button props
* @type object
*/
okButtonProps?: Button;
/**
* The cancel button props
* @type object
*/
cancelButtonProps?: Button;
/**
* Title
* @type string | VNode
*/
title?: string | VNode;
/**
* Width of the modal dialog
* @default 416
* @type string | number
*/
width?: string | number;
/**
* The z-index of the Modal
* @default 100
* @type number
*/
zIndex?: number;
/**
* Specify a function that will be called when the user clicks the Cancel button.
* The parameter of this function is a function whose execution should include closing the dialog.
* You can also just return a promise and when the promise is resolved, the modal dialog will also be closed
* @type Function
*/
onCancel?: () => any;
/**
* Specify a function that will be called when the user clicks the OK button.
* The parameter of this function is a function whose execution should include closing the dialog.
* You can also just return a promise and when the promise is resolved, the modal dialog will also be closed
* @type Function
*/
onOk?: () => any;
}
export interface ModalConfirm {
/**
* Updates modal options
* @param modalOptions modal option
*/
update(modalOptions: ModalOptions): void;
/**
* Destroy the current model instace
*/
destroy(): void;
}
export declare class Modal extends AntdComponent {
/**
* Specify a function that will be called when modal is closed completely.
* @type Function
*/
afterClose: () => any;
/**
* Body style for modal body element. Such as height, padding etc.
* @default {}
* @type object
*/
bodyStyle: object;
/**
* Text of the Cancel button
* @default 'cancel'
* @type string
*/
cancelText: string;
/**
* Centered Modal
* @default false
* @type boolean
*/
centered: boolean;
/**
* Whether a close (x) button is visible on top right of the modal dialog or not
* @default true
* @type boolean
*/
closable: boolean;
/**
* Whether to apply loading visual effect for OK button or not
* @default false
* @type boolean
*/
confirmLoading: boolean;
/**
* Whether to unmount child components on onClose
* @default false
* @type boolean
*/
destroyOnClose: boolean;
/**
* Footer content, set as :footer="null" when you don't need default buttons
* @default OK and Cancel buttons
* @type any (string | slot)
*/
footer: any;
/**
* Return the mount node for Modal
* @default () => document.body
* @type Function
*/
getContainer: (instance: any) => HTMLElement;
/**
* Whether show mask or not.
* @default true
* @type boolean
*/
mask: boolean;
/**
* Whether to close the modal dialog when the mask (area outside the modal) is clicked
* @default true
* @type boolean
*/
maskClosable: boolean;
/**
* Style for modal's mask element.
* @default {}
* @type object
*/
maskStyle: object;
/**
* Text of the OK button
* @default 'OK'
* @type string
*/
okText: string;
/**
* Button type of the OK button
* @default 'primary'
* @type string
*/
okType: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default';
/**
* The ok button props, follow jsx rules
* @type object
*/
okButtonProps: { props: Button; on: {} };
/**
* The cancel button props, follow jsx rules
* @type object
*/
cancelButtonProps: { props: Button; on: {} };
/**
* The modal dialog's title
* @type any (string | slot)
*/
title: any;
/**
* Whether the modal dialog is visible or not
* @default false
* @type boolean
*/
visible: boolean;
/**
* Width of the modal dialog
* @default 520
* @type string | number
*/
width: string | number;
/**
* The class name of the container of the modal dialog
* @type string
*/
wrapClassName: string;
/**
* The z-index of the Modal
* @default 1000
* @type number
*/
zIndex: number;
static info(options: ModalOptions): ModalConfirm;
static success(options: ModalOptions): ModalConfirm;
static error(options: ModalOptions): ModalConfirm;
static warning(options: ModalOptions): ModalConfirm;
static confirm(options: ModalOptions): ModalConfirm;
}
declare module 'vue/types/vue' {
interface Vue {
$info: (modalOptios: ModalOptions) => ModalConfirm;
$success: (modalOptios: ModalOptions) => ModalConfirm;
$error: (modalOptios: ModalOptions) => ModalConfirm;
$warning: (modalOptios: ModalOptions) => ModalConfirm;
$confirm: (modalOptios: ModalOptions) => ModalConfirm;
}
}