UNPKG

1.96 kBTypeScriptView Raw
1import { ElementUIComponent } from './component'
2
3export type SuggestionPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end'
4
5export interface FetchSuggestionsCallback {
6 /**
7 * Callback function used in fetch-suggestions function
8 *
9 * @param data Suggestions to use
10 */
11 (data: any[]): void
12}
13
14export interface FetchSuggestions {
15 /**
16 * The function passed into the fetch-suggestions property
17 *
18 * @param queryString Current value of the text input
19 * @param callback Callback function used to indicate that suggestions have completely fetched
20 */
21 (queryString: string, callback: FetchSuggestionsCallback): void
22}
23
24/** Autocomplete Component */
25export declare class ElAutocomplete extends ElementUIComponent {
26 /** The placeholder of Autocomplete */
27 placeholder: string
28
29 /** Whether Autocomplete is disabled */
30 disabled: boolean
31
32 /** Binding value */
33 value: string
34
35 /** Debounce delay when typing */
36 debounce: number
37
38 /** Placement of the popup menu */
39 placement: SuggestionPlacement
40
41 /** Name for the inner native input */
42 name: string
43
44 /** Key name of the input suggestion object for display */
45 valueKey: string
46
47 /** Whether to emit select event on enter when there is no autocomplete match */
48 selectWhenUnmatched: boolean
49
50 /** A method to fetch input suggestions. When suggestions are ready, invoke callback(data:[]) to return them to Autocomplete */
51 fetchSuggestions: FetchSuggestions
52
53 /** Custom class name for autocomplete's dropdown */
54 popperClass: string
55
56 /** Whether show suggestions when input focus */
57 triggerOnFocus: boolean
58
59 /** Prefix icon class */
60 prefixIcon: string
61
62 /** Suffix icon class */
63 suffixIcon: string
64
65 /** Whether to hide the loading icon in remote search */
66 hideLoading: boolean
67
68 /** Whether to append the dropdown to body */
69 popperAppendToBody: boolean
70
71 /**
72 * Focus the Input component
73 */
74 focus (): void
75}