ant-design-vue/types/modal.d.ts

305 lines
6.5 KiB
TypeScript
Raw Normal View History

// 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
2020-08-31 14:59:56 +08:00
import { AntdComponent, AntdProps } from './component';
2020-09-08 13:33:55 +08:00
import { CSSProperties, VNodeChild } from 'vue';
import { ButtonProps } 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 | (h) => VNode
*/
2020-08-22 10:21:34 +08:00
content?: VNodeChild | JSX.Element;
2020-08-19 10:08:24 +08:00
/**
* custom icon (Added in 1.14.0)
*/
2020-09-08 14:26:39 +08:00
icon?: VNodeChild | JSX.Element | Function;
2020-08-19 10:08:24 +08:00
/**
* Whether show mask or not.
* @default true
*/
2019-09-11 18:11:48 +08:00
mask?: boolean;
/**
* 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
*/
2020-09-08 13:33:55 +08:00
okButtonProps?: ButtonProps;
/**
* The cancel button props
* @type object
*/
2020-09-08 13:33:55 +08:00
cancelButtonProps?: ButtonProps;
/**
* Title
* @type string | VNode | (h) => VNode
*/
2020-08-22 10:21:34 +08:00
title?: VNodeChild | JSX.Element;
/**
* 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;
2020-08-19 10:08:24 +08:00
/**
* Style of floating layer, typically used at least for adjusting the position.
*/
2020-08-22 10:21:34 +08:00
dialogStyle?: CSSProperties;
2020-08-19 10:08:24 +08:00
/**
* className of floating layer.
*/
2020-05-24 22:08:32 +08:00
dialogClass?: string;
/**
* 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 {
2020-08-31 14:59:56 +08:00
$props: AntdProps & {
2020-08-19 10:08:24 +08:00
/**
2020-08-22 10:21:34 +08:00
* Specify a function that will be called when modal is closed completely.
* @type Function
*/
2020-08-19 10:08:24 +08:00
afterClose?: () => any;
/**
* Body style for modal body element. Such as height, padding etc.
* @default {}
* @type object
*/
bodyStyle?: CSSProperties;
/**
* 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 a close (x) button is visible on top right of the modal dialog or not
*/
closeIcon?: VNodeChild | JSX.Element;
/**
* 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?: VNodeChild | JSX.Element;
/**
* 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?: CSSProperties;
/**
* 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
*/
2020-09-08 13:33:55 +08:00
okButtonProps?: ButtonProps;
2020-08-19 10:08:24 +08:00
/**
* The cancel button props, follow jsx rules
* @type object
*/
2020-09-08 13:33:55 +08:00
cancelButtonProps?: ButtonProps;
2020-08-19 10:08:24 +08:00
/**
* The modal dialog's title
* @type any (string | slot)
*/
2020-08-22 10:21:34 +08:00
title?: VNodeChild | JSX.Element;
2020-08-19 10:08:24 +08:00
/**
* 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;
2020-08-22 10:21:34 +08:00
};
2019-02-21 22:16:21 +08:00
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;
static destroyAll(): void;
}