3
3
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4
4
5
5
import { 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 {
9
9
/**
10
10
* Customized close button
11
11
* @type VNode | Function
12
12
*/
13
- btn ?: VNode | Function ;
13
+ btn ?: VNodeChild | JSX . Element | Function ;
14
14
15
15
/**
16
16
* Customized CSS class
@@ -22,20 +22,13 @@ export interface NotificationOptions {
22
22
* The content of notification box (required)
23
23
* @type string | VNode | Function
24
24
*/
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 ;
33
26
34
27
/**
35
28
* Customized icon
36
29
* @type VNode | Function
37
30
*/
38
- icon ?: VNode | Function ;
31
+ icon ?: VNodeChild | JSX . Element | Function ;
39
32
40
33
/**
41
34
* The unique identifier of the Notification
@@ -47,38 +40,25 @@ export interface NotificationOptions {
47
40
* The title of notification box (required)
48
41
* @type string | VNode | Function
49
42
*/
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 ;
58
44
59
45
/**
60
46
* Customized inline style
61
47
* @type object | string
62
48
*/
63
- style ?: object | string ;
49
+ style ?: CSSProperties | string ;
64
50
65
51
/**
66
52
* Specify a function that will be called when the close button is clicked
67
53
* @type Function
68
54
*/
69
- onClose ?: Function ;
55
+ onClose ?: ( ) => void ;
70
56
71
57
/**
72
58
* Specify a function that will be called when the notification is clicked
73
59
* @type Function
74
60
*/
75
- onClick ?: Function ;
76
-
77
- closeIcon ?: any ;
78
-
79
- getContainer ?: ( ) => HTMLElement ;
80
- bottom ?: string ;
81
- top ?: string ;
61
+ onClick ?: ( ) => void ;
82
62
}
83
63
84
64
export interface NotificationConfigOptions {
@@ -94,7 +74,7 @@ export interface NotificationConfigOptions {
94
74
* @default 4.5
95
75
* @type number
96
76
*/
97
- duration ?: number ;
77
+ duration ?: number | null ;
98
78
99
79
/**
100
80
* Return the mount node for Notification
@@ -108,19 +88,22 @@ export interface NotificationConfigOptions {
108
88
* @default 'topRight'
109
89
* @type string
110
90
*/
111
- placement ?: string ;
91
+ placement ?: NotificationPlacement ;
112
92
113
93
/**
114
94
* Distance from the top of the viewport, when placement is topRight or topLeft (unit: pixels).
115
95
* @default '24px'
116
96
* @type string
117
97
*/
118
98
top ?: string ;
119
-
120
- closeIcon ?: any ;
99
+ /**
100
+ * custom close icon
101
+ * @type VNode | function
102
+ */
103
+ closeIcon ?: VNodeChild | JSX . Element | Function ;
121
104
}
122
105
123
- export declare class Notification {
106
+ export interface NotificationApi {
124
107
success ( config : NotificationOptions ) : void ;
125
108
warning ( config : NotificationOptions ) : void ;
126
109
warn ( config : NotificationOptions ) : void ;
@@ -132,8 +115,3 @@ export declare class Notification {
132
115
destroy ( ) : void ;
133
116
}
134
117
135
- declare module 'vue/types/vue' {
136
- interface Vue {
137
- $notification : Notification ;
138
- }
139
- }
0 commit comments