xdesign-vue-next
Version:
XDesign Component for vue-next
65 lines (64 loc) • 2.18 kB
TypeScript
import { ButtonProps } from '../button';
import { TNode, Styles, AttachNode } from '../common';
export interface TdDialogProps {
attach?: AttachNode;
body?: string | TNode;
cancelBtn?: string | ButtonProps | TNode | null;
closeBtn?: string | boolean | TNode;
closeOnEscKeydown?: boolean;
closeOnOverlayClick?: boolean;
confirmBtn?: string | ButtonProps | TNode | null;
confirmOnEnter?: boolean;
default?: string | TNode;
destroyOnClose?: boolean;
draggable?: boolean;
footer?: boolean | TNode;
header?: string | boolean | TNode;
mode?: 'modal' | 'modeless' | 'normal' | 'full-screen';
placement?: 'top' | 'center';
preventScrollThrough?: boolean;
showInAttachedElement?: boolean;
showOverlay?: boolean;
theme?: 'default' | 'info' | 'warning' | 'danger' | 'success';
top?: string | number;
visible?: boolean;
width?: string | number;
zIndex?: number;
onCancel?: (context: {
e: MouseEvent;
}) => void;
onClose?: (context: DialogCloseContext) => void;
onCloseBtnClick?: (context: {
e: MouseEvent;
}) => void;
onClosed?: () => void;
onConfirm?: (context: {
e: MouseEvent | KeyboardEvent;
}) => void;
onEscKeydown?: (context: {
e: KeyboardEvent;
}) => void;
onOpened?: () => void;
onOverlayClick?: (context: {
e: MouseEvent;
}) => void;
}
export interface DialogOptions extends Omit<TdDialogProps, 'attach'> {
attach?: AttachNode;
className?: string;
style?: string | Styles;
}
export interface DialogInstance {
destroy: () => void;
hide: () => void;
show: () => void;
update: (props: DialogOptions) => void;
}
export declare type DialogEventSource = 'esc' | 'close-btn' | 'cancel' | 'overlay';
export interface DialogCloseContext {
trigger: DialogEventSource;
e: MouseEvent | KeyboardEvent;
}
export declare type DialogMethod = (options?: DialogOptions) => DialogInstance;
export declare type DialogConfirmMethod = (options?: DialogOptions) => DialogInstance;
export declare type DialogAlertMethod = (options?: Omit<DialogOptions, 'cancelBtn'>) => DialogInstance;