2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* AutoComplete is an input component that provides real-time suggestions while being typed.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/autocomplete/)
|
|
|
|
*
|
|
|
|
* @module autocomplete
|
|
|
|
*
|
|
|
|
*/
|
2023-08-02 14:38:22 +00:00
|
|
|
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-12-05 07:06:55 +00:00
|
|
|
import { ButtonPassThroughOptions } from '../button';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2023-05-05 06:40:09 +00:00
|
|
|
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';
|
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type AutoCompletePassThroughOptionType = AutoCompletePassThroughAttributes | ((options: AutoCompletePassThroughMethodOptions) => AutoCompletePassThroughAttributes | string) | string | null | undefined;
|
2023-05-05 06:40:09 +00:00
|
|
|
|
2023-08-02 14:38:22 +00:00
|
|
|
export declare type AutoCompletePassThroughTransitionType = TransitionProps | ((options: AutoCompletePassThroughMethodOptions) => TransitionProps) | undefined;
|
|
|
|
|
2023-05-05 06:40:09 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface AutoCompletePassThroughMethodOptions {
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-05-05 06:40:09 +00:00
|
|
|
props: AutoCompleteProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-05-05 06:40:09 +00:00
|
|
|
state: AutoCompleteState;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current options.
|
|
|
|
*/
|
2023-05-08 07:12:02 +00:00
|
|
|
context: AutoCompleteContext;
|
2023-12-10 21:41:17 +00:00
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
2023-12-05 11:06:32 +00:00
|
|
|
/**
|
|
|
|
* Defines parent options.
|
|
|
|
*/
|
|
|
|
parent: any;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-05-05 06:40:09 +00:00
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-12-05 07:06:55 +00:00
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface AutoCompleteSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: AutoCompleteProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: AutoCompleteState;
|
|
|
|
}
|
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* Custom change event.
|
|
|
|
* @see {@link AutoCompleteEmits.change}
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface AutoCompleteChangeEvent {
|
|
|
|
/**
|
|
|
|
* Browser event.
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Selected option value
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
}
|
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* Custom item select event.
|
2023-03-01 11:03:53 +00:00
|
|
|
* @see {@link AutoCompleteEmits['item-select']}
|
2023-03-01 10:07:21 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface AutoCompleteItemSelectEvent {
|
|
|
|
/**
|
|
|
|
* Browser event
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Selected item
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-03-01 10:07:21 +00:00
|
|
|
* Custom item unselect event.
|
2023-03-01 11:03:53 +00:00
|
|
|
* @see {@link AutoCompleteEmits['item-unselect']}
|
2022-09-06 12:03:37 +00:00
|
|
|
* @extends AutoCompleteItemSelectEvent
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
export interface AutoCompleteItemUnselectEvent extends AutoCompleteItemSelectEvent {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* Custom dropdown click event.
|
2023-03-01 11:03:53 +00:00
|
|
|
* @see {@link AutoCompleteEmits['dropdown-click']}
|
2023-03-01 10:07:21 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface AutoCompleteDropdownClickEvent {
|
|
|
|
/**
|
|
|
|
* Browser mouse event
|
|
|
|
*/
|
|
|
|
originalEvent: MouseEvent;
|
|
|
|
/**
|
|
|
|
* Current value of the input field
|
|
|
|
*/
|
|
|
|
query: string;
|
|
|
|
}
|
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* Custom complete event.
|
|
|
|
* @see {@link AutoCompleteEmits.complete}
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface AutoCompleteCompleteEvent {
|
|
|
|
/**
|
|
|
|
* Browser event
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Value to search with
|
|
|
|
*/
|
|
|
|
query: string;
|
|
|
|
}
|
|
|
|
|
2023-05-05 06:40:09 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link AutoCompleteProps.pt}
|
|
|
|
*/
|
|
|
|
export interface AutoCompletePassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
root?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the input's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
input?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the container's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
container?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the token's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
token?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the token label's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
tokenLabel?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the remove token icon's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
removeTokenIcon?: AutoCompletePassThroughOptionType;
|
2023-05-23 12:44:11 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the input token's DOM element.
|
2023-05-23 12:44:11 +00:00
|
|
|
*/
|
|
|
|
inputToken?: AutoCompletePassThroughOptionType;
|
2023-05-05 06:40:09 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the loading icon's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
loadingIcon?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-12-05 07:06:55 +00:00
|
|
|
* @see {@link ButtonPassThroughOptions}
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
dropdownButton?: ButtonPassThroughOptions<AutoCompleteSharedPassThroughMethodOptions>;
|
2023-05-05 06:40:09 +00:00
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Used to pass attributes to the panel's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
2023-08-02 15:35:09 +00:00
|
|
|
panel?: AutoCompletePassThroughOptionType;
|
2023-05-05 06:40:09 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the VirtualScroller component.
|
2023-05-05 06:40:09 +00:00
|
|
|
* @see {@link VirtualScrollerPassThroughOptionType}
|
|
|
|
*/
|
|
|
|
virtualScroller?: VirtualScrollerPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the list's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
list?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the item group's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
itemGroup?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the item's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
item?: AutoCompletePassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the empty message's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
emptyMessage?: AutoCompletePassThroughOptionType;
|
2023-05-12 11:04:27 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the search result message's DOM element.
|
2023-05-12 11:04:27 +00:00
|
|
|
*/
|
|
|
|
searchResultMessage?: AutoCompletePassThroughOptionType;
|
2023-05-05 06:40:09 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the selected message's DOM element.
|
2023-05-05 06:40:09 +00:00
|
|
|
*/
|
|
|
|
selectedMessage?: AutoCompletePassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-11-07 06:16:39 +00:00
|
|
|
* Used to manage all lifecycle hooks.
|
2023-07-06 11:09:01 +00:00
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-08-02 11:59:40 +00:00
|
|
|
/**
|
|
|
|
* Used to control Vue Transition API.
|
|
|
|
*/
|
2023-08-02 14:38:22 +00:00
|
|
|
transition?: AutoCompletePassThroughTransitionType;
|
2023-05-05 06:40:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface AutoCompletePassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in AutoComplete component.
|
|
|
|
*/
|
|
|
|
export interface AutoCompleteState {
|
|
|
|
/**
|
2023-05-08 07:12:02 +00:00
|
|
|
* Current id state as a string.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
/**
|
|
|
|
* Current focused state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current focused item index as a number.
|
|
|
|
* @defaultvalue -1
|
|
|
|
*/
|
|
|
|
focusedOptionIndex: number;
|
|
|
|
/**
|
|
|
|
* Current focused item index as a number.
|
|
|
|
* @defaultvalue -1
|
|
|
|
*/
|
|
|
|
focusedMultipleOptionIndex: number;
|
|
|
|
/**
|
|
|
|
* Current overlay visible state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
overlayVisible: boolean;
|
|
|
|
/**
|
|
|
|
* Current search state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
searching: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current options in AutoComplete component.
|
|
|
|
*/
|
|
|
|
export interface AutoCompleteContext {
|
|
|
|
/**
|
|
|
|
* Current selection state of the item as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
selected: boolean;
|
|
|
|
/**
|
|
|
|
* Current focus state of the item as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current disabled state of the item as a boolean.
|
2023-05-05 06:40:09 +00:00
|
|
|
* @defaultValue false
|
|
|
|
*/
|
2023-05-08 07:12:02 +00:00
|
|
|
disabled: boolean;
|
2023-05-05 06:40:09 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in AutoComplete component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface AutoCompleteProps {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
|
|
|
*/
|
|
|
|
modelValue?: any;
|
|
|
|
/**
|
|
|
|
* An array of suggestions to display.
|
|
|
|
*/
|
|
|
|
suggestions?: any[];
|
|
|
|
/**
|
|
|
|
* @deprecated since v3.16.0. Use 'optionLabel' property instead.
|
|
|
|
* Property name or getter function of a suggested object to resolve and display.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
field?: string | ((data: any) => string) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Property name or getter function to use as the label of an option.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
optionLabel?: string | ((data: any) => string) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Property name or getter function to use as the disabled flag of an option, defaults to false when not defined.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
optionDisabled?: string | ((data: any) => boolean) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Property name or getter function to use as the label of an option group.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
optionGroupLabel?: string | ((data: any) => string) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Property name or getter function that refers to the children options of option group.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
optionGroupChildren?: string | ((data: any) => any[]) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Maximum height of the suggestions panel.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue 200px
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
scrollHeight?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Displays a button next to the input field when enabled.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
dropdown?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Specifies the behavior dropdown button. Default 'blank' mode sends an empty string and 'current' mode sends the input value.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue blank
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
dropdownMode?: 'blank' | 'current' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v3.16.0
|
|
|
|
* Highlights automatically the first item of the dropdown to be selected.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
autoHighlight?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Specifies if multiple values can be selected.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
multiple?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Default text to display when no option is selected.
|
|
|
|
*/
|
|
|
|
placeholder?: string | undefined;
|
2023-08-10 08:38:09 +00:00
|
|
|
/**
|
2023-08-11 11:18:24 +00:00
|
|
|
* Whether the autocomplete is in loading state.
|
2023-08-10 08:38:09 +00:00
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
loading?: boolean | undefined;
|
2024-01-30 11:27:56 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should have invalid state style.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
invalid?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
2024-01-31 08:02:53 +00:00
|
|
|
/**
|
|
|
|
* Specifies the input variant of the component.
|
|
|
|
* @defaultValue outlined
|
|
|
|
*/
|
|
|
|
variant?: 'outlined' | 'filled' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* A property to uniquely identify an option.
|
|
|
|
*/
|
|
|
|
dataKey?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Minimum number of characters to initiate a search.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue 1
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
minLength?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Delay between keystrokes to wait before sending a query.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue 300
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
delay?: number | undefined;
|
|
|
|
/**
|
|
|
|
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
|
|
|
|
* Special keywords are 'body' for document body and 'self' for the element itself.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue body
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* When present, autocomplete clears the manual input if it does not match of the suggestions to force only accepting values from the suggestions.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
forceSelection?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether to run a query when input receives focus.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
completeOnFocus?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Identifier of the underlying input element.
|
|
|
|
*/
|
|
|
|
inputId?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Inline style of the input field.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
inputStyle?: object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Style class of the input field.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
inputClass?: string | object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLInputElement to the focusable input element inside the component.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
inputProps?: InputHTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Inline style of the overlay panel.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-08-02 15:35:09 +00:00
|
|
|
panelStyle?: object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Style class of the overlay panel.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-08-02 15:35:09 +00:00
|
|
|
panelClass?: string | object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Used to pass all properties of the HTMLDivElement to the overlay panel inside the component.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-08-02 15:35:09 +00:00
|
|
|
panelProps?: HTMLAttributes | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in the dropdown.
|
2023-04-18 07:37:05 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'dropdownicon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
dropdownIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Style class of the dropdown button.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
dropdownClass?: string | object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in loading state.
|
2023-04-18 07:37:05 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'loadingicon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
loadingIcon?: string | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in chip remove action.
|
2023-04-18 07:37:05 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'removetokenicon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
removeTokenIcon?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @type {VirtualScrollerProps}
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
virtualScrollerOptions?: VirtualScrollerProps;
|
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Whether to focus on the first visible or selected element when the overlay panel is shown.
|
2024-01-17 09:44:08 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
autoOptionFocus?: boolean | undefined;
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
|
|
|
* When enabled, the focused option is selected.
|
2023-03-01 10:07:21 +00:00
|
|
|
* @defaultValue false
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
selectOnFocus?: boolean | undefined;
|
2024-01-23 13:08:06 +00:00
|
|
|
/**
|
|
|
|
* When enabled, the focus is placed on the hovered option.
|
|
|
|
* @defaultValue true
|
|
|
|
*/
|
|
|
|
focusOnHover?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Locale to use in searching. The default locale is the host environment's current locale.
|
|
|
|
*/
|
|
|
|
searchLocale?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text to be displayed in hidden accessible field when filtering returns any results. Defaults to value from PrimeVue locale configuration.
|
2023-03-08 11:02:08 +00:00
|
|
|
* @defaultValue '{0} results are available'
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
searchMessage?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text to be displayed in hidden accessible field when options are selected. Defaults to value from PrimeVue locale configuration.
|
2023-03-08 11:02:08 +00:00
|
|
|
* @defaultValue '{0} items selected'
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
selectionMessage?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text to be displayed in hidden accessible field when any option is not selected. Defaults to value from PrimeVue locale configuration.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue No selected item
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
emptySelectionMessage?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text to display when filtering does not return any results. Defaults to value from PrimeVue locale configuration.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue No results found
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
emptySearchMessage?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
|
|
|
*/
|
|
|
|
tabindex?: number | string | undefined;
|
|
|
|
/**
|
|
|
|
* Defines a string value that labels an interactive element.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabel?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Identifier of the underlying input element.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabelledby?: string | undefined;
|
2023-05-05 06:40:09 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-05 06:40:09 +00:00
|
|
|
* @type {AutoCompletePassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<AutoCompletePassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-23 12:44:11 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in AutoComplete component.
|
2023-03-07 13:37:45 +00:00
|
|
|
* @todo Next release we should complete types for all slots
|
2023-03-01 10:07:21 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface AutoCompleteSlots {
|
|
|
|
/**
|
|
|
|
* Custom chip template.
|
|
|
|
* @param {Object} scope - chip slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
chip(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* A value in the selection
|
|
|
|
*/
|
|
|
|
value: any;
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Custom header template of panel.
|
2022-09-06 12:03:37 +00:00
|
|
|
* @param {Object} scope - header slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
header(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the component
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
/**
|
|
|
|
* Displayed options
|
|
|
|
*/
|
|
|
|
suggestions: any[];
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Custom footer template of panel.
|
2022-09-06 12:03:37 +00:00
|
|
|
* @param {Object} scope - footer slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
footer(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the component
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
/**
|
|
|
|
* Displayed options
|
|
|
|
*/
|
|
|
|
suggestions: any[];
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v3.16.0
|
|
|
|
* Custom content for each item.
|
|
|
|
* @param {Object} scope - item slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
item(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Option instance
|
|
|
|
*/
|
|
|
|
item: any;
|
|
|
|
/**
|
|
|
|
* Index of the option
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom option template.
|
|
|
|
* @param {Object} scope - option slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
option(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Option instance
|
|
|
|
*/
|
|
|
|
option: any;
|
|
|
|
/**
|
|
|
|
* Index of the option
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom option group template.
|
|
|
|
* @param {Object} scope - option group slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
optiongroup(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v3.16.0. Use the 'option' instead.
|
|
|
|
* Option instance
|
|
|
|
*/
|
|
|
|
item: any;
|
|
|
|
/**
|
|
|
|
* Option instance
|
|
|
|
*/
|
|
|
|
option: any;
|
|
|
|
/**
|
|
|
|
* Index of the option
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-08-02 15:35:09 +00:00
|
|
|
* Custom content template.
|
2022-09-06 12:03:37 +00:00
|
|
|
* @param {Object} scope - content slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
content(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* An array of objects to display for virtualscroller
|
|
|
|
*/
|
|
|
|
items: any;
|
|
|
|
/**
|
|
|
|
* Style class of the component
|
|
|
|
*/
|
|
|
|
styleClass: string;
|
|
|
|
/**
|
|
|
|
* Referance of the content
|
|
|
|
* @param {HTMLElement} el - Element of 'ref' property
|
|
|
|
*/
|
2023-08-17 07:16:25 +00:00
|
|
|
contentRef: (el: any) => void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Options of the items
|
|
|
|
* @param {number} index - Rendered index
|
2023-03-01 10:07:21 +00:00
|
|
|
* @return {VirtualScrollerItemOptions}
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-08-17 07:16:25 +00:00
|
|
|
getItemOptions: (index: number) => VirtualScrollerItemOptions;
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom loader template.
|
|
|
|
* @param {Object} scope - loader slot's params.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
loader(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Options of the loader items for virtualscroller
|
|
|
|
*/
|
|
|
|
options: any[];
|
2023-03-01 10:07:21 +00:00
|
|
|
}): VNode[];
|
2023-01-09 14:41:49 +00:00
|
|
|
/**
|
|
|
|
* Custom empty template when there is no data to display.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
empty(): VNode[];
|
2023-04-04 12:38:11 +00:00
|
|
|
/**
|
|
|
|
* Custom dropdown icon template.
|
|
|
|
*/
|
2023-05-23 12:44:11 +00:00
|
|
|
dropdownicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-04-04 12:38:11 +00:00
|
|
|
/**
|
|
|
|
* Custom remove token icon template in multiple mode.
|
|
|
|
*/
|
2023-04-26 11:02:00 +00:00
|
|
|
removetokenicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
2023-08-16 06:24:31 +00:00
|
|
|
/**
|
|
|
|
* Index of the token.
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-04-26 11:02:00 +00:00
|
|
|
/**
|
|
|
|
* Remove token icon function.
|
2023-08-16 06:24:31 +00:00
|
|
|
* @param {Event} event - Browser event
|
2023-10-31 17:21:47 +00:00
|
|
|
* @deprecated since v3.39.0. Use 'removeCallback' property instead.
|
2023-04-26 11:02:00 +00:00
|
|
|
*/
|
2023-08-17 07:16:25 +00:00
|
|
|
onClick: (event: Event, index: number) => void;
|
2023-10-31 17:21:47 +00:00
|
|
|
/**
|
|
|
|
* Remove token icon function.
|
|
|
|
* @param {Event} event - Browser event
|
|
|
|
*/
|
|
|
|
removeCallback: (event: Event, index: number) => void;
|
2023-04-26 11:02:00 +00:00
|
|
|
}): VNode[];
|
2023-04-04 12:38:11 +00:00
|
|
|
/**
|
|
|
|
* Custom loading icon template.
|
|
|
|
*/
|
2023-08-16 06:24:31 +00:00
|
|
|
loadingicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the loading icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in AutoComplete component.
|
|
|
|
*/
|
2023-03-01 10:20:57 +00:00
|
|
|
export interface AutoCompleteEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {*} value - New value.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
'update:modelValue'(value: any): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke on value change.
|
|
|
|
* @param {AutoCompleteChangeEvent} event - Custom change event.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
change(event: AutoCompleteChangeEvent): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component receives focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
focus(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component loses focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
blur(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a suggestion is selected.
|
|
|
|
* @param {AutoCompleteItemSelectEvent} event - Custom item select event.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
'item-select'(event: AutoCompleteItemSelectEvent): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a selected value is removed.
|
|
|
|
* @param {AutoCompleteItemUnselectEvent} event - Custom item unselect event.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
'item-unselect'(event: AutoCompleteItemUnselectEvent): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke to when dropdown button is clicked.
|
|
|
|
* @param {AutoCompleteDropdownClickEvent} event - Custom dropdown click event.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
'dropdown-click'(event: AutoCompleteDropdownClickEvent): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when input is cleared by the user.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
clear(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke to search for suggestions.
|
|
|
|
* @param {AutoCompleteCompleteEvent} event - Custom complete event.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
complete(event: AutoCompleteCompleteEvent): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke before the overlay is shown.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
'before-show'(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke before the overlay is hidden.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
'before-hide'(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the overlay is shown.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
show(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the overlay is hidden.
|
|
|
|
*/
|
2023-03-01 10:07:21 +00:00
|
|
|
hide(): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 10:07:21 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - AutoComplete**
|
|
|
|
*
|
|
|
|
* _AutoComplete is an input component that provides real-time suggestions while being typed._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/autocomplete/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 10:07:21 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2023-03-01 10:58:06 +00:00
|
|
|
declare class AutoComplete extends ClassComponent<AutoCompleteProps, AutoCompleteSlots, AutoCompleteEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
AutoComplete: GlobalComponentConstructor<AutoComplete>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default AutoComplete;
|