Skip to content

Commit 69509e9

Browse files
author
binhaoCen
authored
chore: update type modal (#2711)
1 parent 0c15958 commit 69509e9

File tree

1 file changed

+164
-149
lines changed

1 file changed

+164
-149
lines changed

types/modal.d.ts

+164-149
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

55
import { AntdComponent } from './component';
6-
import { VNode } from 'vue';
6+
import { VNode, CSSProperties, VNodeChild } from 'vue';
77
import { TreeNode } from './tree-node';
88
import { Button } from './button/button';
99

@@ -39,10 +39,15 @@ export interface ModalOptions {
3939
* Modal content
4040
* @type string | VNode | (h) => VNode
4141
*/
42-
content?: any;
43-
42+
content?: VNodeChild | JSX.Element;
43+
/**
44+
* custom icon (Added in 1.14.0)
45+
*/
4446
icon?: VNode | Function;
45-
47+
/**
48+
* Whether show mask or not.
49+
* @default true
50+
*/
4651
mask?: boolean;
4752

4853
/**
@@ -89,7 +94,7 @@ export interface ModalOptions {
8994
* Title
9095
* @type string | VNode | (h) => VNode
9196
*/
92-
title?: any;
97+
title?: VNodeChild | JSX.Element;
9398

9499
/**
95100
* Width of the modal dialog
@@ -104,8 +109,13 @@ export interface ModalOptions {
104109
* @type number
105110
*/
106111
zIndex?: number;
107-
108-
dialogStyle?: object;
112+
/**
113+
* Style of floating layer, typically used at least for adjusting the position.
114+
*/
115+
dialogStyle?: CSSProperties
116+
/**
117+
* className of floating layer.
118+
*/
109119
dialogClass?: string;
110120

111121
/**
@@ -123,7 +133,9 @@ export interface ModalOptions {
123133
* @type Function
124134
*/
125135
onOk?: () => any;
126-
136+
/**
137+
* The parent context of the popup is generally used to get the parent provider, such as the configuration of ConfigProvider
138+
*/
127139
parentContext?: object;
128140
}
129141

@@ -141,150 +153,153 @@ export interface ModalConfirm {
141153
}
142154

143155
export declare class Modal extends AntdComponent {
144-
/**
156+
$props: {
157+
/**
145158
* Specify a function that will be called when modal is closed completely.
146159
* @type Function
147160
*/
148-
afterClose: () => any;
149-
150-
/**
151-
* Body style for modal body element. Such as height, padding etc.
152-
* @default {}
153-
* @type object
154-
*/
155-
bodyStyle: object;
156-
157-
/**
158-
* Text of the Cancel button
159-
* @default 'cancel'
160-
* @type string
161-
*/
162-
cancelText: string;
163-
164-
/**
165-
* Centered Modal
166-
* @default false
167-
* @type boolean
168-
*/
169-
centered: boolean;
170-
171-
/**
172-
* Whether a close (x) button is visible on top right of the modal dialog or not
173-
* @default true
174-
* @type boolean
175-
*/
176-
closable: boolean;
177-
178-
closeIcon: any;
179-
180-
/**
181-
* Whether to apply loading visual effect for OK button or not
182-
* @default false
183-
* @type boolean
184-
*/
185-
confirmLoading: boolean;
186-
187-
/**
188-
* Whether to unmount child components on onClose
189-
* @default false
190-
* @type boolean
191-
*/
192-
destroyOnClose: boolean;
193-
194-
/**
195-
* Footer content, set as :footer="null" when you don't need default buttons
196-
* @default OK and Cancel buttons
197-
* @type any (string | slot)
198-
*/
199-
footer: any;
200-
201-
/**
202-
* Return the mount node for Modal
203-
* @default () => document.body
204-
* @type Function
205-
*/
206-
getContainer: (instance: any) => HTMLElement;
207-
208-
/**
209-
* Whether show mask or not.
210-
* @default true
211-
* @type boolean
212-
*/
213-
mask: boolean;
214-
215-
/**
216-
* Whether to close the modal dialog when the mask (area outside the modal) is clicked
217-
* @default true
218-
* @type boolean
219-
*/
220-
maskClosable: boolean;
221-
222-
/**
223-
* Style for modal's mask element.
224-
* @default {}
225-
* @type object
226-
*/
227-
maskStyle: object;
228-
229-
/**
230-
* Text of the OK button
231-
* @default 'OK'
232-
* @type string
233-
*/
234-
okText: string;
235-
236-
/**
237-
* Button type of the OK button
238-
* @default 'primary'
239-
* @type string
240-
*/
241-
okType: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default';
242-
243-
/**
244-
* The ok button props, follow jsx rules
245-
* @type object
246-
*/
247-
okButtonProps: { props: Button; on: {} };
248-
249-
/**
250-
* The cancel button props, follow jsx rules
251-
* @type object
252-
*/
253-
cancelButtonProps: { props: Button; on: {} };
254-
255-
/**
256-
* The modal dialog's title
257-
* @type any (string | slot)
258-
*/
259-
title: any;
260-
261-
/**
262-
* Whether the modal dialog is visible or not
263-
* @default false
264-
* @type boolean
265-
*/
266-
visible: boolean;
267-
268-
/**
269-
* Width of the modal dialog
270-
* @default 520
271-
* @type string | number
272-
*/
273-
width: string | number;
274-
275-
/**
276-
* The class name of the container of the modal dialog
277-
* @type string
278-
*/
279-
wrapClassName: string;
280-
281-
/**
282-
* The z-index of the Modal
283-
* @default 1000
284-
* @type number
285-
*/
286-
zIndex: number;
287-
161+
afterClose?: () => any;
162+
163+
/**
164+
* Body style for modal body element. Such as height, padding etc.
165+
* @default {}
166+
* @type object
167+
*/
168+
bodyStyle?: CSSProperties;
169+
170+
/**
171+
* Text of the Cancel button
172+
* @default 'cancel'
173+
* @type string
174+
*/
175+
cancelText?: string;
176+
177+
/**
178+
* Centered Modal
179+
* @default false
180+
* @type boolean
181+
*/
182+
centered?: boolean;
183+
184+
/**
185+
* Whether a close (x) button is visible on top right of the modal dialog or not
186+
* @default true
187+
* @type boolean
188+
*/
189+
closable?: boolean;
190+
/**
191+
* Whether a close (x) button is visible on top right of the modal dialog or not
192+
*/
193+
closeIcon?: VNodeChild | JSX.Element;
194+
195+
/**
196+
* Whether to apply loading visual effect for OK button or not
197+
* @default false
198+
* @type boolean
199+
*/
200+
confirmLoading?: boolean;
201+
202+
/**
203+
* Whether to unmount child components on onClose
204+
* @default false
205+
* @type boolean
206+
*/
207+
destroyOnClose?: boolean;
208+
209+
/**
210+
* Footer content, set as :footer="null" when you don't need default buttons
211+
* @default OK and Cancel buttons
212+
* @type any (string | slot)
213+
*/
214+
footer?: VNodeChild | JSX.Element;
215+
216+
/**
217+
* Return the mount node for Modal
218+
* @default () => document.body
219+
* @type Function
220+
*/
221+
getContainer?: (instance: any) => HTMLElement;
222+
223+
/**
224+
* Whether show mask or not.
225+
* @default true
226+
* @type boolean
227+
*/
228+
mask?: boolean;
229+
230+
/**
231+
* Whether to close the modal dialog when the mask (area outside the modal) is clicked
232+
* @default true
233+
* @type boolean
234+
*/
235+
maskClosable?: boolean;
236+
237+
/**
238+
* Style for modal's mask element.
239+
* @default {}
240+
* @type object
241+
*/
242+
maskStyle?: CSSProperties;
243+
244+
/**
245+
* Text of the OK button
246+
* @default 'OK'
247+
* @type string
248+
*/
249+
okText?: string;
250+
251+
/**
252+
* Button type of the OK button
253+
* @default 'primary'
254+
* @type string
255+
*/
256+
okType?: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default';
257+
258+
/**
259+
* The ok button props, follow jsx rules
260+
* @type object
261+
*/
262+
okButtonProps?: { props: Button; on: {} };
263+
264+
/**
265+
* The cancel button props, follow jsx rules
266+
* @type object
267+
*/
268+
cancelButtonProps?: { props: Button; on: {} };
269+
270+
/**
271+
* The modal dialog's title
272+
* @type any (string | slot)
273+
*/
274+
title?: VNodeChild | JSX.Element;
275+
276+
/**
277+
* Whether the modal dialog is visible or not
278+
* @default false
279+
* @type boolean
280+
*/
281+
visible?: boolean;
282+
283+
/**
284+
* Width of the modal dialog
285+
* @default 520
286+
* @type string | number
287+
*/
288+
width?: string | number;
289+
290+
/**
291+
* The class name of the container of the modal dialog
292+
* @type string
293+
*/
294+
wrapClassName?: string;
295+
296+
/**
297+
* The z-index of the Modal
298+
* @default 1000
299+
* @type number
300+
*/
301+
zIndex?: number;
302+
}
288303
static info(options: ModalOptions): ModalConfirm;
289304
static success(options: ModalOptions): ModalConfirm;
290305
static error(options: ModalOptions): ModalConfirm;

0 commit comments

Comments
 (0)