PromoCursed/node_modules/antd/lib/message/interface.d.ts

67 lines
2.2 KiB
TypeScript
Raw Normal View History

2024-08-20 23:25:37 +04:00
import type * as React from 'react';
export type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading';
export interface ConfigOptions {
top?: number;
duration?: number;
prefixCls?: string;
getContainer?: () => HTMLElement;
transitionName?: string;
maxCount?: number;
rtl?: boolean;
}
export interface ArgsProps {
/**
* @descCN
* @descEN The content of the message notification, receiving component or string
*/
content: React.ReactNode;
/**
* @descCN
* @descEN How long the message notification remains displayed
*/
duration?: number;
/**
* @descCN 'info''success''error''warning' 'loading'
* @descEN The type of message notification, which can be 'info', 'success', 'error', 'warning' or 'loading'
*/
type?: NoticeType;
/**
* @descCN
* @descEN The callback function called when the message notification is closed
*/
onClose?: () => void;
icon?: React.ReactNode;
key?: string | number;
style?: React.CSSProperties;
className?: string;
/**
* @descCN
* @descEN Callback function when message notification is clicked
*/
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
}
export type JointContent = React.ReactNode | ArgsProps;
export interface MessageType extends PromiseLike<boolean> {
(): void;
}
export type TypeOpen = (content: JointContent,
/**
* @descCN 使 onClose
* @descEN You can also use onClose directly to determine how long the message notification continues to be displayed.
*/
duration?: number | VoidFunction,
/**
* @descCN
* @descEN The callback function called when the message notification is closed
*/
onClose?: VoidFunction) => MessageType;
export interface MessageInstance {
info: TypeOpen;
success: TypeOpen;
error: TypeOpen;
warning: TypeOpen;
loading: TypeOpen;
open(args: ArgsProps): MessageType;
destroy(key?: React.Key): void;
}