ant-design-vue/types/notification.d.ts
Akshay Jat 0e499ee908 feat: typescript support (#359)
* feat: typescript support

Added typing files for better support in Typescript

* feat: typescript support

Adding declare keywords left in last commit

* feat: typescript support

Added support to add Ant Design globally (Vue.use(Antd))

* feat: typescript support

Fix wrong import file

* fix: typescript support

changed aobject[] to object[]

* feat: typescript support

Removed Library version from comments & corrected few incorrect types

* fix: typescript support

Tree : xxxKeys should support number[]

* fix: typescript support

table: updated return type for customXXX

* fix: typescript support

Fix spelling mistake (plcement => placement)
2019-01-01 12:13:51 +08:00

126 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 { AntdComponent } from './component';
import { VNode } from "vue";
export interface NotificationOptions {
/**
* Customized close button
* @type VNode | Function
*/
btn?: VNode | Function;
/**
* Customized CSS class
* @type string
*/
class?: string;
/**
* The content of notification box (required)
* @type string | VNode | Function
*/
description: string | VNode | Function;
/**
* Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically
* @default 4.5
* @type number
*/
duration?: number;
/**
* Customized icon
* @type VNode | Function
*/
icon?: VNode | Function;
/**
* The unique identifier of the Notification
* @type string
*/
key?: string;
/**
* The title of notification box (required)
* @type string | VNode | Function
*/
message: string | VNode | Function;
/**
* Position of Notification, can be one of topLeft topRight bottomLeft bottomRight
* @default 'topRight'
* @type string
*/
placement?: string;
/**
* Customized inline style
* @type object | string
*/
style?: object | string;
/**
* Specify a function that will be called when the close button is clicked
* @type Function
*/
onClose?: Function;
}
export interface NotificationConfigOptions {
/**
* Distance from the bottom of the viewport, when placement is bottomRight or bottomLeft (unit: pixels).
* @default '24px'
* @type string
*/
bottom?: string;
/**
* Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically
* @default 4.5
* @type number
*/
duration?: number;
/**
* Return the mount node for Notification
* @default () => document.body
* @type Function
*/
getContainer?: () => HTMLElement;
/**
* Position of Notification, can be one of topLeft topRight bottomLeft bottomRight
* @default 'topRight'
* @type string
*/
placement?: string;
/**
* Distance from the top of the viewport, when placement is topRight or topLeft (unit: pixels).
* @default '24px'
* @type string
*/
top?: string;
}
export declare class Notification {
success(config: NotificationOptions): void;
warning(config: NotificationOptions): void;
warn(config: NotificationOptions): void;
info(config: NotificationOptions): void;
error(config: NotificationOptions): void;
open(config: NotificationOptions): void;
config(options: NotificationConfigOptions): void;
close(key: string): void;
destroy(): void;
}
declare module "vue/types/vue" {
interface Vue {
$notification: Notification;
}
}