hongluan-ui
Version:
Hongluan Component Library for Vue 3
133 lines (132 loc) • 4.11 kB
TypeScript
import type { ExtractPropTypes, PropType } from 'vue';
import type { Awaitable } from 'hongluan-ui/es/utils';
import type { Placement } from 'hongluan-ui/es/components/popper';
import type Autocomplete from './autocomplete.vue';
export declare type AutocompleteData = Record<string, any>[];
export declare type AutocompleteFetchSuggestionsCallback = (data: AutocompleteData) => void;
export declare type AutocompleteFetchSuggestions = ((queryString: string, cb: AutocompleteFetchSuggestionsCallback) => Awaitable<AutocompleteData> | void) | AutocompleteData;
export declare const autocompleteProps: {
ariaLabel: StringConstructor;
/**
* @description key name of the input suggestion object for display
*/
valueKey: {
type: StringConstructor;
default: string;
};
/**
* @description binding value
*/
modelValue: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
/**
* @description debounce delay when typing, in milliseconds
*/
debounce: {
type: NumberConstructor;
default: number;
};
/**
* @description placement of the popup menu
*/
placement: {
type: PropType<Placement>;
validator: (val: string) => boolean;
default: string;
};
/**
* @description a method to fetch input suggestions. When suggestions are ready, invoke `callback(data:[])` to return them to Autocomplete
*/
fetchSuggestions: {
type: PropType<AutocompleteFetchSuggestions>;
default: () => void;
};
/**
* @description custom class name for autocomplete's dropdown
*/
popperClass: {
type: StringConstructor;
default: string;
};
/**
* @description whether show suggestions when input focus
*/
triggerOnFocus: {
type: BooleanConstructor;
default: boolean;
};
/**
* @description whether to emit a `select` event on enter when there is no autocomplete match
*/
selectWhenUnmatched: {
type: BooleanConstructor;
default: boolean;
};
/**
* @description whether to hide the loading icon in remote search
*/
hideLoading: {
type: BooleanConstructor;
default: boolean;
};
popperAppendToBody: {
type: BooleanConstructor;
default: any;
};
teleported: import("hongluan-ui/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
/**
* @description whether to highlight first item in remote search suggestions by default
*/
highlightFirstItem: {
type: BooleanConstructor;
default: boolean;
};
block: {
type: BooleanConstructor;
default: boolean;
};
size: {
type: PropType<"xxxs" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl">;
validator: (val: string) => boolean;
};
/**
* @description whether to show clear button
*/
clearable: {
type: BooleanConstructor;
default: boolean;
};
disabled: BooleanConstructor;
fill: BooleanConstructor;
thin: BooleanConstructor;
popperOffset: {
type: NumberConstructor;
default: number;
};
fitInputWidth: {
type: BooleanConstructor;
default: boolean;
};
transition: {
type: StringConstructor;
default: string;
};
/**
* @description same as `name` in native input
*/
name: StringConstructor;
};
export declare const autocompleteEmits: {
"update:modelValue": (value: string) => boolean;
input: (value: string) => boolean;
change: (value: string) => boolean;
focus: (evt: FocusEvent) => boolean;
blur: (evt: FocusEvent) => boolean;
clear: () => boolean;
select: (item: Record<string, any>) => boolean;
};
export declare type AutocompleteProps = ExtractPropTypes<typeof autocompleteProps>;
export declare type AutocompleteEmits = typeof autocompleteEmits;
export declare type AutocompleteInstance = InstanceType<typeof Autocomplete>;