2023-03-01 10:43:09 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Dropdown also known as Select, is used to choose an item from a collection of options.
|
|
|
|
*
|
2023-03-01 13:05:44 +00:00
|
|
|
* [Live Demo](https://www.primevue.org/dropdown/)
|
2023-03-01 10:43:09 +00:00
|
|
|
*
|
|
|
|
* @module dropdown
|
|
|
|
*
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
2023-05-07 20:37:26 +00:00
|
|
|
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';
|
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type DropdownPassThroughOptionType = DropdownPassThroughAttributes | ((options: DropdownPassThroughMethodOptions) => DropdownPassThroughAttributes | string) | string | null | undefined;
|
2023-05-07 20:37:26 +00:00
|
|
|
|
2023-08-02 14:07:22 +00:00
|
|
|
export declare type DropdownPassThroughTransitionType = TransitionProps | ((options: DropdownPassThroughMethodOptions) => TransitionProps) | undefined;
|
|
|
|
|
2023-05-07 20:37:26 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface DropdownPassThroughMethodOptions {
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-05-07 20:37:26 +00:00
|
|
|
props: DropdownProps;
|
|
|
|
state: DropdownState;
|
|
|
|
context: DropdownContext;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 10:43:09 +00:00
|
|
|
/**
|
|
|
|
* Custom change event.
|
2023-03-06 20:35:39 +00:00
|
|
|
* @see {@link DropdownEmits.change}
|
2023-03-01 10:43:09 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DropdownChangeEvent {
|
|
|
|
/**
|
|
|
|
* Browser event.
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Selected option value
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
}
|
|
|
|
|
2023-03-01 10:43:09 +00:00
|
|
|
/**
|
2023-03-03 14:17:03 +00:00
|
|
|
* Custom filter event.
|
2023-03-06 20:35:39 +00:00
|
|
|
* @see {@link DropdownEmits.filter}
|
2023-03-01 10:43:09 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DropdownFilterEvent {
|
|
|
|
/**
|
|
|
|
* Browser event.
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Filter value
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
}
|
|
|
|
|
2023-05-07 20:37:26 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link DropdownProps.pt}
|
|
|
|
*/
|
|
|
|
export interface DropdownPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
root?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the input's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
input?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the clear icon's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
clearIcon?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the trigger' DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
trigger?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the loading icon's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
loadingIcon?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the panel's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
panel?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
header?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the filter container's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
filterContainer?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the filter input's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
filterInput?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the filter icon's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
filterIcon?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the wrapper's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
wrapper?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the VirtualScroller component.
|
2023-05-07 20:37:26 +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-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
list?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the item group's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
itemGroup?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the item's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
item?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the empty message's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
emptyMessage?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden first focusable element's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
hiddenFirstFocusableEl?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden filter result's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
hiddenFilterResult?: DropdownPassThroughOptionType;
|
2023-05-23 09:13:26 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden empty message's DOM element.
|
2023-05-23 09:13:26 +00:00
|
|
|
*/
|
|
|
|
hiddenEmptyMessage?: DropdownPassThroughOptionType;
|
2023-05-07 20:37:26 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden selected message's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
hiddenSelectedMessage?: DropdownPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden last focusable element's DOM element.
|
2023-05-07 20:37:26 +00:00
|
|
|
*/
|
|
|
|
hiddenLastFocusableEl?: DropdownPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +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 12:00:49 +00:00
|
|
|
/**
|
|
|
|
* Used to control Vue Transition API.
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
transition?: DropdownPassThroughTransitionType;
|
2023-05-07 20:37:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface DropdownPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in Dropdown component.
|
|
|
|
*/
|
|
|
|
export interface DropdownState {
|
|
|
|
/**
|
|
|
|
* 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 filter value state as a string.
|
|
|
|
*/
|
|
|
|
filterValue: string;
|
|
|
|
/**
|
|
|
|
* Current overlay visible state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
overlayVisible: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current options in Dropdown component.
|
|
|
|
*/
|
|
|
|
export interface DropdownContext {
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
disabled: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 10:43:09 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Dropdown component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DropdownProps {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
|
|
|
*/
|
|
|
|
modelValue?: any;
|
|
|
|
/**
|
|
|
|
* An array of selectitems to display as the available options.
|
|
|
|
*/
|
|
|
|
options?: any[];
|
|
|
|
/**
|
|
|
|
* Property name or getter function to use as the label of an option.
|
|
|
|
*/
|
2023-03-01 10:43:09 +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 value of an option, defaults to the option itself when not defined.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
optionValue?: string | ((data: any) => any) | 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:43:09 +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:43:09 +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:43:09 +00:00
|
|
|
optionGroupChildren?: string | ((data: any) => any[]) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Height of the viewport, a scrollbar is defined if height of list exceeds this value.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue 200px
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
scrollHeight?: string | undefined;
|
|
|
|
/**
|
|
|
|
* When specified, displays a filter input at header.
|
2023-03-10 14:00:58 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
filter?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Placeholder text to show when filter input is empty.
|
|
|
|
*/
|
|
|
|
filterPlaceholder?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Locale to use in filtering. The default locale is the host environment's current locale.
|
|
|
|
*/
|
|
|
|
filterLocale?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Defines the filtering algorithm to use when searching the options.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue contains
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-27 08:09:36 +00:00
|
|
|
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith' | string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Fields used when filtering the options, defaults to optionLabel.
|
|
|
|
*/
|
|
|
|
filterFields?: string[] | undefined;
|
|
|
|
/**
|
|
|
|
* When present, custom value instead of predefined options can be entered using the editable input field.
|
2023-03-10 14:00:58 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
editable?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Default text to display when no option is selected.
|
|
|
|
*/
|
|
|
|
placeholder?: string | undefined;
|
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
2023-03-10 14:00:58 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* A property to uniquely identify an option.
|
|
|
|
*/
|
|
|
|
dataKey?: string | undefined;
|
|
|
|
/**
|
|
|
|
* When enabled, a clear icon is displayed to clear the value.
|
2023-03-10 14:00:58 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
showClear?: 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/HTMLSpanElement to the focusable input element inside the component.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
inputProps?: InputHTMLAttributes | HTMLAttributes | undefined;
|
|
|
|
/**
|
|
|
|
* Inline style of the overlay panel.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
panelStyle?: object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Style class of the overlay panel.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
panelClass?: 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 HTMLDivElement to the overlay panel inside the component.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
panelProps?: HTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLInputElement to the filter input inside the component.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
filterInputProps?: InputHTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLElement to the clear icon inside the component.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.26.0. Use 'pt' peroperty.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
clearIconProps?: HTMLAttributes | undefined;
|
|
|
|
/**
|
2023-03-01 10:43:09 +00:00
|
|
|
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue body
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether the dropdown is in loading state.
|
2023-03-10 14:00:58 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
loading?: boolean | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in clear button.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'clearicon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
clearIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in the dropdown.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'dropdownicon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
dropdownIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in filter input.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'filtericon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
filterIcon?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in loading state.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'loadingicon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
loadingIcon?: string | undefined;
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
|
|
|
* Clears the filter value when hiding the dropdown.
|
2023-03-10 14:00:58 +00:00
|
|
|
* @defaultValue false
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
resetFilterOnHide?: boolean;
|
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.
|
|
|
|
*/
|
|
|
|
virtualScrollerOptions?: VirtualScrollerProps;
|
|
|
|
/**
|
|
|
|
* Whether to focus on the first visible or selected element when the overlay panel is shown.
|
2023-03-01 10:43:09 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
autoOptionFocus?: boolean | undefined;
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
|
|
|
* Whether to focus on the filter element when the overlay panel is shown.
|
2023-03-01 10:43:09 +00:00
|
|
|
* @defaultValue false
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
autoFilterFocus?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* When enabled, the focused option is selected.
|
2023-03-01 10:43:09 +00:00
|
|
|
* @defaultValue false
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
selectOnFocus?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
*/
|
|
|
|
filterMessage?: 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
|
|
|
*/
|
|
|
|
emptyFilterMessage?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text to display when there are no options available. Defaults to value from PrimeVue locale configuration.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue No results foun
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
emptyMessage?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
|
|
|
*/
|
|
|
|
tabindex?: number | string | undefined;
|
|
|
|
/**
|
|
|
|
* Defines a string value that labels an interactive element.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
'aria-label'?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Identifier of the underlying input element.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
'aria-labelledby'?: string | undefined;
|
2023-05-07 20:37:26 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-07 20:37:26 +00:00
|
|
|
* @type {DropdownPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: DropdownPassThroughOptions;
|
2023-05-23 09:13:26 +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:43:09 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Dropdown component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DropdownSlots {
|
|
|
|
/**
|
|
|
|
* Custom value template.
|
|
|
|
* @param {Object} scope - value slot's params.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
value(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the component
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
/**
|
|
|
|
* Placeholder prop value
|
|
|
|
*/
|
|
|
|
placeholder: string;
|
2023-03-01 10:43:09 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom indicator template.
|
2023-04-18 12:09:35 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'dropdownicon or loadingicon' slots.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
indicator(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom header template of panel.
|
|
|
|
* @param {Object} scope - header slot's params.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
header(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the component
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
/**
|
|
|
|
* Displayed options
|
|
|
|
*/
|
|
|
|
options: any[];
|
2023-03-01 10:43:09 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom footer template of panel.
|
|
|
|
* @param {Object} scope - footer slot's params.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
footer(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the component
|
|
|
|
*/
|
|
|
|
value: any;
|
|
|
|
/**
|
|
|
|
* Displayed options
|
|
|
|
*/
|
|
|
|
options: any[];
|
2023-03-01 10:43:09 +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:43:09 +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:43:09 +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:43:09 +00:00
|
|
|
optiongroup(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Option instance
|
|
|
|
*/
|
|
|
|
option: any;
|
|
|
|
/**
|
|
|
|
* Index of the option
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-03-01 10:43:09 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom empty filter template.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
emptyfilter(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom empty template.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
empty(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom content template.
|
|
|
|
* @param {Object} scope - content slot's params.
|
|
|
|
*/
|
2023-03-01 10:43:09 +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
|
|
|
|
*/
|
|
|
|
contentRef(el: any): void;
|
|
|
|
/**
|
|
|
|
* Options of the items
|
|
|
|
* @param {number} index - Rendered index
|
|
|
|
* @return {@link VirtualScroller.VirtualScrollerItemOptions}
|
|
|
|
*/
|
|
|
|
getItemOptions(index: number): VirtualScrollerItemOptions;
|
2023-03-01 10:43:09 +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:43:09 +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:43:09 +00:00
|
|
|
}): VNode[];
|
2023-04-18 10:51:10 +00:00
|
|
|
/**
|
|
|
|
* Custom clear icon template.
|
|
|
|
* @param {Object} scope - clear icon slot's params.
|
|
|
|
*/
|
|
|
|
clearicon(scope: {
|
2023-08-15 15:23:09 +00:00
|
|
|
/**
|
|
|
|
* Style class of the clear icon
|
|
|
|
*/
|
|
|
|
class: any;
|
2023-04-18 10:51:10 +00:00
|
|
|
/**
|
|
|
|
* Clear icon click function.
|
2023-08-15 16:00:19 +00:00
|
|
|
* @param {Event} event - Browser event
|
2023-04-18 10:51:10 +00:00
|
|
|
*/
|
2023-08-15 16:00:19 +00:00
|
|
|
onClick(event: Event): void;
|
2023-04-18 10:51:10 +00:00
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom dropdown icon template.
|
|
|
|
* @param {Object} scope - dropdown icon slot's params.
|
|
|
|
*/
|
|
|
|
dropdownicon(scope: {
|
|
|
|
/**
|
2023-08-15 15:23:09 +00:00
|
|
|
* Style class of the dropdown icon
|
2023-04-18 10:51:10 +00:00
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom loading icon template.
|
|
|
|
* @param {Object} scope - loading icon slot's params.
|
|
|
|
*/
|
|
|
|
loadingicon(scope: {
|
|
|
|
/**
|
2023-08-15 15:23:09 +00:00
|
|
|
* Style class of the loading icon
|
2023-04-18 10:51:10 +00:00
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom filter icon template.
|
2023-08-15 15:23:09 +00:00
|
|
|
* @param {Object} scope - filter icon slot's params.
|
2023-04-18 10:51:10 +00:00
|
|
|
*/
|
2023-08-15 15:23:09 +00:00
|
|
|
filtericon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the filter icon
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 10:43:09 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Dropdown component.
|
|
|
|
*/
|
|
|
|
export interface DropdownEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {*} value - New value.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
'update:modelValue'(value: any): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke on value change.
|
|
|
|
* @param {DropdownChangeEvent} event - Custom change event.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
change(event: DropdownChangeEvent): 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:43:09 +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:43:09 +00:00
|
|
|
blur(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke before the overlay is shown.
|
|
|
|
*/
|
2023-03-01 10:43:09 +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:43:09 +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:43:09 +00:00
|
|
|
show(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the overlay is hidden.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
hide(): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke on filter input.
|
|
|
|
* @param {DropdownFilterEvent} event - Custom filter event.
|
|
|
|
*/
|
2023-03-01 10:43:09 +00:00
|
|
|
filter(event: DropdownFilterEvent): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 10:43:09 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Dropdown**
|
|
|
|
*
|
|
|
|
* _Dropdown also known as Select, is used to choose an item from a collection of options._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/dropdown/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*/
|
2023-03-01 14:48:23 +00:00
|
|
|
declare class Dropdown extends ClassComponent<DropdownProps, DropdownSlots, DropdownEmits> {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Shows the overlay.
|
2023-03-01 10:43:09 +00:00
|
|
|
* @param {boolean} [isFocus] - Decides whether to focus on the component. @defaultValue false.
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
* @memberof Dropdown
|
|
|
|
*/
|
|
|
|
show: (isFocus?: boolean) => void;
|
|
|
|
/**
|
|
|
|
* Hides the overlay.
|
2023-03-01 10:43:09 +00:00
|
|
|
* @param {boolean} [isFocus] - Decides whether to focus on the component. @defaultValue false.
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
* @memberof Dropdown
|
|
|
|
*/
|
|
|
|
hide: (isFocus?: boolean) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Dropdown: GlobalComponentConstructor<Dropdown>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Dropdown;
|