1 | import { RenderFunction, SetupContext, ComponentPublicInstance, Ref } from 'vue'
|
2 | import { VXEComponent, VxeComponentBase, SizeType, VNodeStyle, ValueOf } from './component'
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export const VxeInput: VXEComponent<VxeInputProps, VxeInputEventProps, VxeInputSlots>
|
11 |
|
12 |
|
13 |
|
14 | export const Input: typeof VxeInput
|
15 |
|
16 | export type VxeInputInstance = ComponentPublicInstance<VxeInputProps, VxeInputConstructor>
|
17 |
|
18 | export interface VxeInputConstructor extends VxeComponentBase, VxeInputMethods {
|
19 | props: VxeInputProps
|
20 | context: SetupContext<VxeInputEmits>
|
21 | reactData: InputReactData
|
22 | getRefMaps(): InputPrivateRef
|
23 | renderVN: RenderFunction
|
24 | }
|
25 |
|
26 | export interface InputPrivateRef {
|
27 | refElem: Ref<HTMLDivElement>
|
28 | refInput: Ref<HTMLInputElement>
|
29 | }
|
30 | export interface VxeInputPrivateRef extends InputPrivateRef { }
|
31 |
|
32 | type DatePanelType = 'year' | 'quarter' | 'month' | 'week' | 'day'
|
33 |
|
34 | export interface InputReactData {
|
35 | inited: boolean
|
36 | panelIndex: number
|
37 | showPwd: boolean
|
38 | visiblePanel: boolean
|
39 | animatVisible: boolean
|
40 | panelStyle: VNodeStyle | null
|
41 | panelPlacement: VxeInputPropTypes.Placement
|
42 | isActivated: boolean
|
43 | inputValue: any
|
44 | datetimePanelValue: any
|
45 | datePanelValue: Date | null
|
46 | datePanelLabel: string
|
47 | datePanelType: DatePanelType
|
48 | selectMonth: any
|
49 | currentDate: any
|
50 | }
|
51 |
|
52 | export namespace VxeInputPropTypes {
|
53 | export type Size = SizeType
|
54 | export type ModelValue = string | number | Date | null
|
55 | export type ClassName = string
|
56 | export type Immediate = boolean
|
57 | export type Name = string
|
58 | export type Type = 'text' | 'search' | 'number' | 'integer' | 'float' | 'password' | 'date' | 'time' | 'datetime' | 'week' | 'month' | 'quarter' | 'year'
|
59 | export type Clearable = boolean
|
60 | export type Readonly = boolean
|
61 | export type Disabled = boolean
|
62 | export type Placeholder = string
|
63 | export type Maxlength = string | number
|
64 | export type Multiple = boolean
|
65 | export type ShowWordCount = boolean
|
66 | export type CountMethod = (params: {
|
67 | value: string
|
68 | }) => number
|
69 | export type Autocomplete = string
|
70 | export type Align = string
|
71 | export type Form = string
|
72 | export type Min = string | number
|
73 | export type Max = string | number
|
74 | export type Step = string | number
|
75 | export type Exponential = boolean
|
76 | export type Controls = boolean
|
77 | export type Digits = string | number
|
78 | export type StartDate = string | number | Date
|
79 | export type EndDate = string | number | Date
|
80 | export type MinDate = string | number | Date
|
81 | export type MaxDate = string | number | Date
|
82 | export type StartDay = 0 | 1 | 2 | 3 | 4 | 5 | 6
|
83 | export type SelectDay = 0 | 1 | 2 | 3 | 4 | 5 | 6
|
84 | export type LabelFormat = string
|
85 | export type ValueFormat = string
|
86 | export type Editable = boolean
|
87 | export type FestivalMethod = (params: VxeInputDefines.DateFestivalParams) => VxeInputDefines.DateFestivalInfo | null | void
|
88 | export type DisabledMethod = (params: VxeInputDefines.DateDisabledParams) => boolean
|
89 | export type PrefixIcon = string
|
90 | export type SuffixIcon = string
|
91 | export type Placement = 'top' | 'bottom' | '' | null
|
92 | export type Transfer = boolean
|
93 | }
|
94 |
|
95 | export type VxeInputProps = {
|
96 | size?: VxeInputPropTypes.Size
|
97 | modelValue?: VxeInputPropTypes.ModelValue
|
98 | className?: VxeInputPropTypes.ClassName
|
99 | immediate?: VxeInputPropTypes.Immediate
|
100 | name?: VxeInputPropTypes.Name
|
101 | type?: VxeInputPropTypes.Type
|
102 | clearable?: VxeInputPropTypes.Clearable
|
103 | readonly?: VxeInputPropTypes.Readonly
|
104 | disabled?: VxeInputPropTypes.Disabled
|
105 | placeholder?: VxeInputPropTypes.Placeholder
|
106 | maxlength?: VxeInputPropTypes.Maxlength
|
107 | multiple?: VxeInputPropTypes.Multiple
|
108 | |
109 |
|
110 |
|
111 | showWordCount?: VxeInputPropTypes.ShowWordCount
|
112 | |
113 |
|
114 |
|
115 | countMethod?: VxeInputPropTypes.CountMethod
|
116 | autocomplete?: VxeInputPropTypes.Autocomplete
|
117 | align?: VxeInputPropTypes.Align
|
118 | form?: VxeInputPropTypes.Form
|
119 |
|
120 |
|
121 | min?: VxeInputPropTypes.Min
|
122 | max?: VxeInputPropTypes.Max
|
123 | step?: VxeInputPropTypes.Step
|
124 | exponential?: VxeInputPropTypes.Exponential
|
125 |
|
126 |
|
127 | controls?: VxeInputPropTypes.Controls
|
128 |
|
129 |
|
130 | digits?: VxeInputPropTypes.Digits
|
131 |
|
132 |
|
133 | startDate?: VxeInputPropTypes.StartDate
|
134 | endDate?: VxeInputPropTypes.EndDate
|
135 | minDate?: VxeInputPropTypes.MinDate
|
136 | maxDate?: VxeInputPropTypes.MaxDate
|
137 | |
138 |
|
139 |
|
140 | startWeek?: VxeInputPropTypes.StartDay
|
141 | startDay?: VxeInputPropTypes.StartDay
|
142 | labelFormat?: VxeInputPropTypes.LabelFormat
|
143 | valueFormat?: VxeInputPropTypes.ValueFormat
|
144 | editable?: VxeInputPropTypes.Editable
|
145 | festivalMethod?: VxeInputPropTypes.FestivalMethod
|
146 | disabledMethod?: VxeInputPropTypes.DisabledMethod
|
147 |
|
148 |
|
149 | selectDay?: VxeInputPropTypes.SelectDay
|
150 |
|
151 | prefixIcon?: VxeInputPropTypes.PrefixIcon
|
152 | suffixIcon?: VxeInputPropTypes.SuffixIcon
|
153 | placement?: VxeInputPropTypes.Placement
|
154 | transfer?: VxeInputPropTypes.Transfer
|
155 | }
|
156 |
|
157 | export interface InputMethods {
|
158 | dispatchEvent: (type: ValueOf<VxeInputEmits>, params: any, evnt?: Event | { type: string }) => void
|
159 | |
160 |
|
161 |
|
162 | focus(): Promise<any>
|
163 | |
164 |
|
165 |
|
166 | blur(): Promise<any>
|
167 | |
168 |
|
169 |
|
170 | select(): Promise<any>
|
171 | |
172 |
|
173 |
|
174 | showPanel(): Promise<any>
|
175 | |
176 |
|
177 |
|
178 | hidePanel(): Promise<any>
|
179 | updatePlacement(): Promise<any>
|
180 | }
|
181 | export interface VxeInputMethods extends InputMethods { }
|
182 |
|
183 | export interface InputPrivateMethods { }
|
184 | export interface VxeInputPrivateMethods extends InputPrivateMethods { }
|
185 |
|
186 | export type VxeInputEmits = [
|
187 | 'update:modelValue',
|
188 | 'input',
|
189 | 'change',
|
190 | 'keydown',
|
191 | 'keyup',
|
192 | 'wheel',
|
193 | 'click',
|
194 | 'focus',
|
195 | 'blur',
|
196 | 'clear',
|
197 | 'search-click',
|
198 | 'toggle-visible',
|
199 | 'prev-number',
|
200 | 'next-number',
|
201 | 'prefix-click',
|
202 | 'suffix-click',
|
203 | 'date-prev',
|
204 | 'date-today',
|
205 | 'date-next'
|
206 | ]
|
207 |
|
208 | export namespace VxeInputDefines {
|
209 |
|
210 | interface DateFestivalItem {
|
211 | |
212 |
|
213 |
|
214 | label?: string
|
215 | |
216 |
|
217 |
|
218 | important?: boolean
|
219 | className?: string
|
220 | style?: VNodeStyle
|
221 | }
|
222 |
|
223 | |
224 |
|
225 |
|
226 | export interface DateFestivalInfo extends DateFestivalItem {
|
227 | |
228 |
|
229 |
|
230 | notice?: boolean
|
231 | |
232 |
|
233 |
|
234 | extra?: string | DateFestivalItem
|
235 | }
|
236 |
|
237 | export interface DateFestivalParams {
|
238 | $input: VxeInputConstructor
|
239 | type: string
|
240 | viewType: DatePanelType
|
241 | date: Date
|
242 | }
|
243 |
|
244 | export interface DateDisabledParams {
|
245 | $input: VxeInputConstructor
|
246 | type: string
|
247 | viewType: DatePanelType
|
248 | date: Date
|
249 | }
|
250 |
|
251 | interface InputKeyboardEventParams {
|
252 | $input: VxeInputConstructor
|
253 | $event: KeyboardEvent
|
254 | }
|
255 |
|
256 | export interface InputParams {
|
257 | value: string
|
258 | }
|
259 | export interface InputEventParams extends InputKeyboardEventParams, InputParams { }
|
260 |
|
261 | export interface ChangeParams extends InputParams {}
|
262 | export interface ChangeEventParams extends InputKeyboardEventParams, ChangeParams { }
|
263 |
|
264 | export interface KeyupParams extends InputParams {}
|
265 | export interface KeyupEventParams extends InputKeyboardEventParams, KeyupParams { }
|
266 |
|
267 | export interface KeydownParams extends InputParams {}
|
268 | export interface KeydownEventParams extends InputKeyboardEventParams, KeydownParams { }
|
269 |
|
270 | export interface ClickParams extends InputParams {}
|
271 | export interface ClickEventParams extends InputKeyboardEventParams, ClickParams { }
|
272 |
|
273 | export interface FocusParams extends InputParams {}
|
274 | export interface FocusEventParams extends InputKeyboardEventParams, FocusParams { }
|
275 |
|
276 | export interface BlurParams extends InputParams {}
|
277 | export interface BlurEventParams extends InputKeyboardEventParams, BlurParams { }
|
278 |
|
279 | export interface ClearParams extends InputParams {}
|
280 | export interface ClearEventParams extends InputKeyboardEventParams, ClearParams { }
|
281 |
|
282 | export interface SearchClickParams extends InputParams {}
|
283 | export interface SearchClickEventParams extends InputKeyboardEventParams, SearchClickParams { }
|
284 |
|
285 | export interface ToggleVisibleParams extends InputParams {}
|
286 | export interface ToggleVisibleEventParams extends InputKeyboardEventParams, ToggleVisibleParams { }
|
287 |
|
288 | export interface PrevNumberParams extends InputParams {}
|
289 | export interface PrevNumberEventParams extends InputKeyboardEventParams, PrevNumberParams { }
|
290 |
|
291 | export interface NextNumberParams extends InputParams {}
|
292 | export interface NextNumberEventParams extends InputKeyboardEventParams, NextNumberParams { }
|
293 |
|
294 | export interface PrefixClickParams extends InputParams {}
|
295 | export interface PrefixClickEventParams extends InputKeyboardEventParams, PrefixClickParams { }
|
296 |
|
297 | export interface SuffixClickParams extends InputParams {}
|
298 | export interface SuffixClickEventParams extends InputKeyboardEventParams, SuffixClickParams { }
|
299 |
|
300 | export interface DatePrevParams extends InputParams {}
|
301 | export interface DatePrevEventParams extends InputKeyboardEventParams, DatePrevParams { }
|
302 |
|
303 | export interface DateTodayParams extends InputParams {}
|
304 | export interface DateTodayEventParams extends InputKeyboardEventParams, DateTodayParams { }
|
305 |
|
306 | export interface DateNextParams extends InputParams {}
|
307 | export interface DateNextEventParams extends InputKeyboardEventParams, DateNextParams { }
|
308 | }
|
309 |
|
310 | export type VxeInputEventProps = {
|
311 | onInput?: VxeInputEvents.Input
|
312 | onChange?: VxeInputEvents.Change
|
313 | onKeydown?: VxeInputEvents.Keydown
|
314 | onKeyup?: VxeInputEvents.Keyup
|
315 | onClick?: VxeInputEvents.Click
|
316 | onFocus?: VxeInputEvents.Focus
|
317 | onBlur?: VxeInputEvents.Blur
|
318 | onClear?: VxeInputEvents.Clear
|
319 | onSearchClick?: VxeInputEvents.SearchClick
|
320 | onToggleVisible?: VxeInputEvents.ToggleVisible
|
321 | onPrevNumber?: VxeInputEvents.PrevNumber
|
322 | onNextNumber?: VxeInputEvents.NextNumber
|
323 | onPrefixClick?: VxeInputEvents.PrefixClick
|
324 | onSuffixClick?: VxeInputEvents.SuffixClick
|
325 | onDatePrev?: VxeInputEvents.DatePrev
|
326 | onDateToday?: VxeInputEvents.DateToday
|
327 | onDateNext?: VxeInputEvents.DateNext
|
328 | }
|
329 |
|
330 | export interface VxeInputListeners {
|
331 | input?: VxeInputEvents.Input
|
332 | change?: VxeInputEvents.Change
|
333 | keydown?: VxeInputEvents.Keydown
|
334 | keyup?: VxeInputEvents.Keyup
|
335 | click?: VxeInputEvents.Click
|
336 | focus?: VxeInputEvents.Focus
|
337 | blur?: VxeInputEvents.Blur
|
338 | clear?: VxeInputEvents.Clear
|
339 | searchClick?: VxeInputEvents.SearchClick
|
340 | toggleVisible?: VxeInputEvents.ToggleVisible
|
341 | prevNumber?: VxeInputEvents.PrevNumber
|
342 | nextNumber?: VxeInputEvents.NextNumber
|
343 | prefixClick?: VxeInputEvents.PrefixClick
|
344 | suffixClick?: VxeInputEvents.SuffixClick
|
345 | datePrev?: VxeInputEvents.DatePrev
|
346 | dateToday?: VxeInputEvents.DateToday
|
347 | dateNext?: VxeInputEvents.DateNext
|
348 | }
|
349 |
|
350 | export namespace VxeInputEvents {
|
351 | export type Input = (params: VxeInputDefines.InputEventParams) => void
|
352 | export type Change = (params: VxeInputDefines.ChangeEventParams) => void
|
353 | export type Keydown = (params: VxeInputDefines.KeydownEventParams) => void
|
354 | export type Keyup = (params: VxeInputDefines.KeyupEventParams) => void
|
355 | export type Click = (params: VxeInputDefines.ClickEventParams) => void
|
356 | export type Focus = (params: VxeInputDefines.FocusEventParams) => void
|
357 | export type Blur = (params: VxeInputDefines.BlurEventParams) => void
|
358 | export type Clear = (params: VxeInputDefines.ClearEventParams) => void
|
359 | export type SearchClick = (params: VxeInputDefines.SearchClickEventParams) => void
|
360 | export type ToggleVisible = (params: VxeInputDefines.ToggleVisibleEventParams) => void
|
361 | export type PrevNumber = (params: VxeInputDefines.PrevNumberEventParams) => void
|
362 | export type NextNumber = (params: VxeInputDefines.NextNumberEventParams) => void
|
363 | export type PrefixClick = (params: VxeInputDefines.PrefixClickEventParams) => void
|
364 | export type SuffixClick = (params: VxeInputDefines.SuffixClickEventParams) => void
|
365 | export type DatePrev = (params: VxeInputDefines.DatePrevEventParams) => void
|
366 | export type DateToday = (params: VxeInputDefines.DateTodayEventParams) => void
|
367 | export type DateNext = (params: VxeInputDefines.DateNextEventParams) => void
|
368 | }
|
369 |
|
370 | export interface VxeInputSlots {
|
371 | |
372 |
|
373 |
|
374 | [key: string]: ((params: {
|
375 | [key: string]: any
|
376 | }) => any) | undefined
|
377 | }
|