ant-design-vue/types/message.d.ts
tangjinzhou 518cc852af Merge remote-tracking branch 'origin/master' into 2.0
# Conflicts:
#	antdv-demo
#	components/alert/__tests__/__snapshots__/demo.test.js.snap
#	components/auto-complete/__tests__/__snapshots__/demo.test.js.snap
#	components/avatar/__tests__/__snapshots__/demo.test.js.snap
#	components/badge/__tests__/__snapshots__/demo.test.js.snap
#	components/calendar/__tests__/__snapshots__/demo.test.js.snap
#	components/calendar/__tests__/__snapshots__/index.test.js.snap
#	components/card/__tests__/__snapshots__/demo.test.js.snap
#	components/cascader/__tests__/__snapshots__/demo.test.js.snap
#	components/cascader/__tests__/__snapshots__/index.test.js.snap
#	components/collapse/__tests__/__snapshots__/demo.test.js.snap
#	components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap
#	components/date-picker/__tests__/__snapshots__/demo.test.js.snap
#	components/date-picker/__tests__/__snapshots__/other.test.js.snap
#	components/dropdown/__tests__/__snapshots__/demo.test.js.snap
#	components/empty/__tests__/__snapshots__/demo.test.js.snap
#	components/form-model/__tests__/__snapshots__/demo.test.js.snap
#	components/form/__tests__/__snapshots__/demo.test.js.snap
#	components/icon/__tests__/__snapshots__/index.test.js.snap
#	components/icon/index.js
#	components/input-number/__tests__/__snapshots__/demo.test.js.snap
#	components/input/__tests__/__snapshots__/demo.test.js.snap
#	components/input/__tests__/__snapshots__/index.test.js.snap
#	components/locale-provider/__tests__/__snapshots__/demo.test.js.snap
#	components/locale-provider/__tests__/__snapshots__/index.test.js.snap
#	components/modal/__tests__/__snapshots__/Modal.test.js.snap
#	components/page-header/__tests__/__snapshots__/demo.test.js.snap
#	components/page-header/index.jsx
#	components/pagination/__tests__/__snapshots__/demo.test.js.snap
#	components/rate/__tests__/__snapshots__/demo.test.js.snap
#	components/select/__tests__/__snapshots__/demo.test.js.snap
#	components/select/__tests__/__snapshots__/index.test.js.snap
#	components/slider/__tests__/__snapshots__/demo.test.js.snap
#	components/spin/__tests__/__snapshots__/demo.test.js.snap
#	components/steps/__tests__/__snapshots__/demo.test.js.snap
#	components/switch/__tests__/__snapshots__/demo.test.js.snap
#	components/table/__tests__/__snapshots__/Table.filter.test.js.snap
#	components/table/__tests__/__snapshots__/Table.sorter.test.js.snap
#	components/table/__tests__/__snapshots__/demo.test.js.snap
#	components/tabs/__tests__/__snapshots__/demo.test.js.snap
#	components/tabs/__tests__/__snapshots__/index.test.js.snap
#	components/time-picker/__tests__/__snapshots__/demo.test.js.snap
#	components/time-picker/__tests__/__snapshots__/index.test.js.snap
#	components/timeline/__tests__/__snapshots__/demo.test.js.snap
#	components/tree-select/__tests__/__snapshots__/demo.test.js.snap
#	components/tree/__tests__/__snapshots__/demo.test.js.snap
#	components/upload/__tests__/__snapshots__/demo.test.js.snap
#	components/upload/__tests__/__snapshots__/uploadlist.test.js.snap
#	types/message.d.ts
2020-04-05 15:09:21 +08:00

105 lines
2.8 KiB
TypeScript

// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// 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 = VNode | ((h: CreateElement) => VNode);
export type ConfigDuration = number | (() => void);
export type ConfigOnClose = () => void;
export interface MessageOptions {
/**
* content of the message
* @type any (string | VNode | (h) => VNode)
*/
content: ConfigType;
/**
* time(seconds) before auto-dismiss, don't dismiss if set to 0
* @default 3
* @type number
*/
duration?: number;
/**
* type of message
* @type string
*/
type?: 'success' | 'info' | 'warning' | 'error' | 'loading';
/**
* Customized Icon
* @type any (VNode | (h) => VNode)
*/
icon?: ConfigType;
/**
* Specify a function that will be called when the message is closed
* @type Function
*/
onClose?: ConfigOnClose;
key?: string | number;
}
export interface MessageConfigOptions {
/**
* time before auto-dismiss, in seconds
* @default 1.5
* @type number
*/
duration?: number;
/**
* Return the mount node for Message
* @default () => document.body
* @type Function
*/
getContainer?: () => HTMLElement;
/**
* max message show, drop oldest if exceed limit
* @type number
*/
maxCount?: number;
/**
* distance from top
* @default '24px'
* @type string
*/
top?: string;
}
export declare interface Message {
success(content: MessageOptions): MessageType;
success(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
warning(content: MessageOptions): MessageType;
warning(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
warn(content: MessageOptions): MessageType;
warn(content: ConfigType, duration?: ConfigDuration, onClose?: ConfigOnClose): MessageType;
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;
destroy: () => void;
}
declare module 'vue/types/vue' {
interface Vue {
$message: Message;
}
}