fix(types): update [message] types (#1933)
parent
185241472a
commit
0036db2ea6
|
@ -2,12 +2,26 @@
|
||||||
// Definitions by: akki-jat <https://github.com/akki-jat>
|
// Definitions by: akki-jat <https://github.com/akki-jat>
|
||||||
// Definitions: https://github.com/vueComponent/ant-design-vue/types
|
// Definitions: https://github.com/vueComponent/ant-design-vue/types
|
||||||
|
|
||||||
|
import { VNode, CreateElement } from 'vue'
|
||||||
|
|
||||||
|
export interface ThenableArgument {
|
||||||
|
(val: any): void;
|
||||||
|
}
|
||||||
|
export interface MessageType {
|
||||||
|
(): void;
|
||||||
|
then: (fill: ThenableArgument, reject: ThenableArgument) => Promise<void>;
|
||||||
|
promise: Promise<void>;
|
||||||
|
}
|
||||||
|
export type ConfigType = string | VNode | ((h: CreateElement) => VNode);
|
||||||
|
export type ConfigDuration = number | (() => void);
|
||||||
|
export type ConfigOnClose = () => void;
|
||||||
|
|
||||||
export interface MessageOptions {
|
export interface MessageOptions {
|
||||||
/**
|
/**
|
||||||
* content of the message
|
* content of the message
|
||||||
* @type any (string | VNode | (h) => VNode)
|
* @type any (string | VNode | (h) => VNode)
|
||||||
*/
|
*/
|
||||||
content: any;
|
content: ConfigType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* time(seconds) before auto-dismiss, don't dismiss if set to 0
|
* time(seconds) before auto-dismiss, don't dismiss if set to 0
|
||||||
|
@ -26,13 +40,13 @@ export interface MessageOptions {
|
||||||
* Customized Icon
|
* Customized Icon
|
||||||
* @type any (string | VNode | (h) => VNode)
|
* @type any (string | VNode | (h) => VNode)
|
||||||
*/
|
*/
|
||||||
icon?: any;
|
icon?: ConfigType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify a function that will be called when the message is closed
|
* Specify a function that will be called when the message is closed
|
||||||
* @type Function
|
* @type Function
|
||||||
*/
|
*/
|
||||||
onClose?: () => void;
|
onClose?: ConfigOnClose;
|
||||||
key?: string | number;
|
key?: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,14 +79,20 @@ export interface MessageConfigOptions {
|
||||||
top?: string;
|
top?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare class Message {
|
export declare interface Message {
|
||||||
success(content: any, duration?: number, onClose?: () => void): Promise<any>;
|
success(content: MessageOptions): MessageType;
|
||||||
warning(content: any, duration?: number, onClose?: () => void): Promise<any>;
|
success(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
|
||||||
warn(content: any, duration?: number, onClose?: () => void): Promise<any>;
|
warning(content: MessageOptions): MessageType;
|
||||||
info(content: any, duration?: number, onClose?: () => void): Promise<any>;
|
warning(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
|
||||||
error(content: any, duration?: number, onClose?: () => void): Promise<any>;
|
warn(content: MessageOptions): MessageType;
|
||||||
loading(content: any, duration?: number, onClose?: () => void): Promise<any>;
|
warn(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
|
||||||
open: (config: MessageOptions) => Promise<any>;
|
info(content: MessageOptions): MessageType;
|
||||||
|
info(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
|
||||||
|
error(content: MessageOptions): MessageType;
|
||||||
|
error(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
|
||||||
|
loading(content: MessageOptions): MessageType;
|
||||||
|
loading(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
|
||||||
|
open: (config: MessageOptions) => MessageType;
|
||||||
config: (options: MessageConfigOptions) => void;
|
config: (options: MessageConfigOptions) => void;
|
||||||
destroy: () => void;
|
destroy: () => void;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue