tdesign-vue
Version:
41 lines (40 loc) • 2.21 kB
TypeScript
import { TNode, AttachNode } from '../common';
export interface TdMessageProps {
closeBtn?: string | boolean | TNode;
content?: string | TNode;
duration?: number;
icon?: boolean | TNode;
theme?: MessageThemeList;
onClose?: (context: {
trigger: 'close-click' | 'duration-end';
e?: MouseEvent;
}) => void;
onCloseBtnClick?: (context: {
e: MouseEvent;
}) => void;
onDurationEnd?: () => void;
}
export interface MessageOptions extends TdMessageProps {
attach?: AttachNode;
className?: string;
offset?: Array<string | number>;
placement?: MessagePlacementList;
style?: object;
zIndex?: number;
}
export declare type MessageThemeList = 'info' | 'success' | 'warning' | 'error' | 'question' | 'loading';
export declare type MessagePlacementList = 'center' | 'top' | 'left' | 'right' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
export interface MessageInstance {
close: () => void;
}
export declare type MessageMethod = (theme: MessageThemeList, message: string | MessageOptions, duration?: number) => Promise<MessageInstance>;
export declare type MessageInfoOptions = Omit<MessageOptions, 'theme'>;
export declare type MessageInfoMethod = (message: string | MessageInfoOptions, duration?: number) => Promise<MessageInstance>;
export declare type MessageErrorMethod = (message: string | MessageInfoOptions, duration?: number) => Promise<MessageInstance>;
export declare type MessageWarningMethod = (message: string | MessageInfoOptions, duration?: number) => Promise<MessageInstance>;
export declare type MessageSuccessMethod = (message: string | MessageInfoOptions, duration?: number) => Promise<MessageInstance>;
export declare type MessageLoadingMethod = (message: string | MessageInfoOptions, duration?: number) => Promise<MessageInstance>;
export declare type MessageQuestionMethod = (message: string | MessageInfoOptions, duration?: number) => Promise<MessageInstance>;
export declare type MessageCloseMethod = (options: Promise<MessageInstance>) => void;
export declare type MessageCloseAllMethod = () => void;
export declare type MessageConfigMethod = (message: MessageOptions) => void;