1 | import Vue, { VNode } from 'vue'
|
2 | import { MessageType } from './message'
|
3 |
|
4 | export type MessageBoxCloseAction = 'confirm' | 'cancel' | 'close'
|
5 | export type MessageBoxData = MessageBoxInputData
|
6 |
|
7 | export interface MessageBoxInputData {
|
8 | value: string,
|
9 | action: MessageBoxCloseAction
|
10 | }
|
11 |
|
12 | export interface MessageBoxInputValidator {
|
13 | (value: string): boolean | string
|
14 | }
|
15 |
|
16 | export declare class ElMessageBoxComponent extends Vue {
|
17 | title: string
|
18 | message: string
|
19 | type: MessageType
|
20 | iconClass: string
|
21 | customClass: string
|
22 | showInput: boolean
|
23 | showClose: boolean
|
24 | inputValue: string
|
25 | inputPlaceholder: string
|
26 | inputType: string
|
27 | inputPattern: RegExp
|
28 | inputValidator: MessageBoxInputValidator
|
29 | inputErrorMessage: string
|
30 | showConfirmButton: boolean
|
31 | showCancelButton: boolean
|
32 | action: MessageBoxCloseAction
|
33 | dangerouslyUseHTMLString: boolean
|
34 | confirmButtonText: string
|
35 | cancelButtonText: string
|
36 | confirmButtonLoading: boolean
|
37 | cancelButtonLoading: boolean
|
38 | confirmButtonClass: string
|
39 | confirmButtonDisabled: boolean
|
40 | cancelButtonClass: string
|
41 | editorErrorMessage: string
|
42 | }
|
43 |
|
44 |
|
45 | export interface ElMessageBoxOptions {
|
46 |
|
47 | title?: string
|
48 |
|
49 |
|
50 | message?: string | VNode
|
51 |
|
52 |
|
53 | type?: MessageType
|
54 |
|
55 |
|
56 | iconClass?: string
|
57 |
|
58 |
|
59 | customClass?: string
|
60 |
|
61 |
|
62 | callback?: (action: MessageBoxCloseAction, instance: ElMessageBoxComponent) => void
|
63 |
|
64 |
|
65 | beforeClose?: (action: MessageBoxCloseAction, instance: ElMessageBoxComponent, done: (() => void)) => void
|
66 |
|
67 |
|
68 | lockScroll?: boolean
|
69 |
|
70 |
|
71 | showCancelButton?: boolean
|
72 |
|
73 |
|
74 | showConfirmButton?: boolean
|
75 |
|
76 |
|
77 | showClose?: boolean
|
78 |
|
79 |
|
80 | cancelButtonText?: string
|
81 |
|
82 |
|
83 | confirmButtonText?: string
|
84 |
|
85 |
|
86 | cancelButtonClass?: string
|
87 |
|
88 |
|
89 | confirmButtonClass?: string
|
90 |
|
91 |
|
92 | center?: boolean
|
93 |
|
94 |
|
95 | dangerouslyUseHTMLString?: boolean
|
96 |
|
97 |
|
98 | roundButton?: boolean
|
99 |
|
100 |
|
101 | closeOnClickModal?: boolean
|
102 |
|
103 |
|
104 | closeOnPressEscape?: boolean
|
105 |
|
106 |
|
107 | closeOnHashChange?: boolean
|
108 |
|
109 |
|
110 | showInput?: boolean
|
111 |
|
112 |
|
113 | inputPlaceholder?: string
|
114 |
|
115 |
|
116 | inputValue?: string
|
117 |
|
118 |
|
119 | inputPattern?: RegExp
|
120 |
|
121 |
|
122 | inputType?: string
|
123 |
|
124 |
|
125 | inputValidator?: MessageBoxInputValidator
|
126 |
|
127 |
|
128 | inputErrorMessage?: string
|
129 |
|
130 |
|
131 | distinguishCancelAndClose?: boolean
|
132 | }
|
133 |
|
134 | export interface ElMessageBoxShortcutMethod {
|
135 | (message: string, title: string, options?: ElMessageBoxOptions): Promise<MessageBoxData>
|
136 | (message: string, options?: ElMessageBoxOptions): Promise<MessageBoxData>
|
137 | }
|
138 |
|
139 | export interface ElMessageBox {
|
140 |
|
141 | (message: string, title?: string, type?: string): Promise<MessageBoxData>
|
142 |
|
143 |
|
144 | (options: ElMessageBoxOptions): Promise<MessageBoxData>
|
145 |
|
146 |
|
147 | alert: ElMessageBoxShortcutMethod
|
148 |
|
149 |
|
150 | confirm: ElMessageBoxShortcutMethod
|
151 |
|
152 |
|
153 | prompt: ElMessageBoxShortcutMethod
|
154 |
|
155 |
|
156 | setDefaults (defaults: ElMessageBoxOptions): void
|
157 |
|
158 |
|
159 | close (): void
|
160 | }
|
161 |
|
162 | declare module 'vue/types/vue' {
|
163 | interface Vue {
|
164 |
|
165 | $msgbox: ElMessageBox
|
166 |
|
167 |
|
168 | $alert: ElMessageBoxShortcutMethod
|
169 |
|
170 |
|
171 | $confirm: ElMessageBoxShortcutMethod
|
172 |
|
173 |
|
174 | $prompt: ElMessageBoxShortcutMethod
|
175 | }
|
176 | }
|