autocomplete.d.ts 2.0 KB

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