33// Definitions: https://github.com/vueComponent/ant-design-vue/types
44
55import { AntdComponent } from './component' ;
6- import { VNode } from 'vue' ;
7-
8- export interface NotificationOptions {
6+ import { VNodeChild , CSSProperties } from 'vue' ;
7+ export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' ;
8+ export interface NotificationOptions extends NotificationConfigOptions {
99 /**
1010 * Customized close button
1111 * @type VNode | Function
1212 */
13- btn ?: VNode | Function ;
13+ btn ?: VNodeChild | JSX . Element | Function ;
1414
1515 /**
1616 * Customized CSS class
@@ -22,20 +22,13 @@ export interface NotificationOptions {
2222 * The content of notification box (required)
2323 * @type string | VNode | Function
2424 */
25- description : string | VNode | Function ;
26-
27- /**
28- * Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically
29- * @default 4.5
30- * @type number
31- */
32- duration ?: number ;
25+ description : VNodeChild | JSX . Element | Function ;
3326
3427 /**
3528 * Customized icon
3629 * @type VNode | Function
3730 */
38- icon ?: VNode | Function ;
31+ icon ?: VNodeChild | JSX . Element | Function ;
3932
4033 /**
4134 * The unique identifier of the Notification
@@ -47,38 +40,25 @@ export interface NotificationOptions {
4740 * The title of notification box (required)
4841 * @type string | VNode | Function
4942 */
50- message : string | VNode | Function ;
51-
52- /**
53- * Position of Notification, can be one of topLeft topRight bottomLeft bottomRight
54- * @default 'topRight'
55- * @type string
56- */
57- placement ?: string ;
43+ message : VNodeChild | JSX . Element | Function ;
5844
5945 /**
6046 * Customized inline style
6147 * @type object | string
6248 */
63- style ?: object | string ;
49+ style ?: CSSProperties | string ;
6450
6551 /**
6652 * Specify a function that will be called when the close button is clicked
6753 * @type Function
6854 */
69- onClose ?: Function ;
55+ onClose ?: ( ) => void ;
7056
7157 /**
7258 * Specify a function that will be called when the notification is clicked
7359 * @type Function
7460 */
75- onClick ?: Function ;
76-
77- closeIcon ?: any ;
78-
79- getContainer ?: ( ) => HTMLElement ;
80- bottom ?: string ;
81- top ?: string ;
61+ onClick ?: ( ) => void ;
8262}
8363
8464export interface NotificationConfigOptions {
@@ -94,7 +74,7 @@ export interface NotificationConfigOptions {
9474 * @default 4.5
9575 * @type number
9676 */
97- duration ?: number ;
77+ duration ?: number | null ;
9878
9979 /**
10080 * Return the mount node for Notification
@@ -108,19 +88,22 @@ export interface NotificationConfigOptions {
10888 * @default 'topRight'
10989 * @type string
11090 */
111- placement ?: string ;
91+ placement ?: NotificationPlacement ;
11292
11393 /**
11494 * Distance from the top of the viewport, when placement is topRight or topLeft (unit: pixels).
11595 * @default '24px'
11696 * @type string
11797 */
11898 top ?: string ;
119-
120- closeIcon ?: any ;
99+ /**
100+ * custom close icon
101+ * @type VNode | function
102+ */
103+ closeIcon ?: VNodeChild | JSX . Element | Function ;
121104}
122105
123- export declare class Notification {
106+ export interface NotificationApi {
124107 success ( config : NotificationOptions ) : void ;
125108 warning ( config : NotificationOptions ) : void ;
126109 warn ( config : NotificationOptions ) : void ;
@@ -132,8 +115,3 @@ export declare class Notification {
132115 destroy ( ) : void ;
133116}
134117
135- declare module 'vue/types/vue' {
136- interface Vue {
137- $notification : Notification ;
138- }
139- }
0 commit comments