tdesign-mobile-vue
Version:
tdesign-mobile-vue
50 lines (49 loc) • 1.65 kB
TypeScript
import { ButtonProps } from '../button';
import { OverlayProps } from '../overlay';
import { TNode, Styles } from '../common';
export interface TdDialogProps {
actions?: Array<ButtonProps>;
buttonLayout?: 'horizontal' | 'vertical';
cancelBtn?: string | ButtonProps | TNode | null;
closeBtn?: boolean;
closeOnOverlayClick?: boolean;
confirmBtn?: string | ButtonProps | TNode | null;
content?: string | TNode;
destroyOnClose?: boolean;
overlayProps?: OverlayProps;
preventScrollThrough?: boolean;
showOverlay?: boolean;
title?: string | TNode;
visible?: boolean;
width?: string | number;
zIndex?: number;
onCancel?: (context: {
e: MouseEvent;
}) => void;
onClose?: (context: DialogCloseContext) => void;
onClosed?: () => void;
onConfirm?: (context: {
e: MouseEvent;
}) => void;
onOverlayClick?: (context: {
e: MouseEvent;
}) => void;
}
export interface DialogOptions extends Omit<TdDialogProps, 'attach'> {
className?: string;
style?: string | Styles;
}
export interface DialogInstance {
destroy: () => void;
hide: () => void;
show: () => void;
update: (props: DialogOptions) => void;
}
export declare type DialogEventSource = 'cancel' | 'overlay';
export interface DialogCloseContext {
trigger: DialogEventSource;
e: MouseEvent;
}
export declare type DialogMethod = (options?: DialogOptions) => DialogInstance;
export declare type DialogConfirmMethod = (options?: DialogOptions) => DialogInstance;
export declare type DialogAlertMethod = (options?: Omit<DialogOptions, 'cancelBtn'>) => DialogInstance;