Listbox d.ts updated

pull/3689/head
mertsincan 2023-03-01 10:20:57 +00:00
parent 8397013d5d
commit 83b4a7b818
2 changed files with 82 additions and 61 deletions

View File

@ -410,7 +410,7 @@ export interface AutoCompleteSlots {
/**
* Defines valid emits in AutoComplete component.
*/
export declare interface AutoCompleteEmits {
export interface AutoCompleteEmits {
/**
* Emitted when the value changes.
* @param {*} value - New value.

View File

@ -1,17 +1,20 @@
/**
*
* ListBox is used to select one or more values from a list of items.
*
* [Live Demo](https://www.primevue.org/listbox/)
*
* @module listbox
*
*/
import { InputHTMLAttributes, VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
import { VirtualScrollerProps, VirtualScrollerItemOptions } from '../virtualscroller';
type ListboxOptionLabelType = string | ((data: any) => string) | undefined;
type ListboxOptionValueType = string | ((data: any) => any) | undefined;
type ListboxOptionDisabledType = string | ((data: any) => boolean) | undefined;
type ListboxOptionChildrenType = string | ((data: any) => any[]) | undefined;
type ListboxFilterMatchModeType = 'contains' | 'startsWith' | 'endsWith' | undefined;
import { VirtualScrollerItemOptions, VirtualScrollerProps } from '../virtualscroller';
/**
* Custom change event.
* @see {@link ListboxEmits.change}
*/
export interface ListboxChangeEvent {
/**
* Original event
@ -23,6 +26,10 @@ export interface ListboxChangeEvent {
value: any;
}
/**
* Custom filter event.
* @see {@link ListboxEmits.filter}
*/
export interface ListboxFilterEvent {
/**
* Original event
@ -34,6 +41,9 @@ export interface ListboxFilterEvent {
value: string;
}
/**
* Defines valid properties in Listbox component.
*/
export interface ListboxProps {
/**
* Value of the component.
@ -46,29 +56,30 @@ export interface ListboxProps {
/**
* Property name or getter function to use as the label of an option.
*/
optionLabel?: ListboxOptionLabelType;
optionLabel?: string | ((data: any) => string) | undefined;
/**
* Property name or getter function to use as the value of an option, defaults to the option itself when not defined.
*/
optionValue?: ListboxOptionValueType;
optionValue?: string | ((data: any) => any) | undefined;
/**
* Property name or getter function to use as the disabled flag of an option, defaults to false when not defined.
*/
optionDisabled?: ListboxOptionDisabledType;
optionDisabled?: string | ((data: any) => boolean) | undefined;
/**
* Property name or getter function to use as the label of an option group.
*/
optionGroupLabel?: ListboxOptionLabelType;
optionGroupLabel?: string | ((data: any) => string) | undefined;
/**
* Property name or getter function that refers to the children options of option group.
*/
optionGroupChildren?: ListboxOptionChildrenType;
optionGroupChildren?: string | ((data: any) => any[]) | undefined;
/**
* Inline style of inner list element.
*/
listStyle?: string | undefined;
/**
* When specified, disables the component.
* @defaultValue false
*/
disabled?: boolean | undefined;
/**
@ -77,16 +88,18 @@ export interface ListboxProps {
dataKey?: string | undefined;
/**
* When specified, allows selecting multiple values.
* @defaultValue false
*/
multiple?: boolean | undefined;
/**
* Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item can be toggled individually.
* On touch enabled devices, metaKeySelection is turned off automatically.
* Default value is true.
* @defaultValue true
*/
metaKeySelection?: boolean | undefined;
/**
* When specified, displays a filter input at header.
* @defaultValue false
*/
filter?: boolean | undefined;
/**
@ -99,10 +112,9 @@ export interface ListboxProps {
filterLocale?: string | undefined;
/**
* Defines the filtering algorithm to use when searching the options.
* @see ListboxFilterMatchModeType
* Default value is 'contains'.
* @defaultValue contains
*/
filterMatchMode?: ListboxFilterMatchModeType;
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith' | undefined;
/**
* Fields used when filtering the options, defaults to optionLabel.
*/
@ -113,42 +125,42 @@ export interface ListboxProps {
filterInputProps?: InputHTMLAttributes | undefined;
/**
* Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it.
* @see VirtualScroller.VirtualScrollerProps
* @type {VirtualScrollerProps}
*/
virtualScrollerOptions?: VirtualScrollerProps;
/**
* Whether to focus on the first visible or selected element.
* Default value is true.
* @defaultValue true
*/
autoOptionFocus?: boolean | undefined;
/**
* When enabled, the focused option is selected.
* Default value is false.
* @defaultValue false
*/
selectOnFocus?: boolean | undefined;
/**
* Text to be displayed in hidden accessible field when filtering returns any results. Defaults to value from PrimeVue locale configuration.
* Default value is '{0} results are available'.
* @defaultValue {0} results are available
*/
filterMessage?: string | undefined;
/**
* Text to be displayed in hidden accessible field when options are selected. Defaults to value from PrimeVue locale configuration.
* Default value is '{0} items selected'.
* @defaultValue {0} items selected
*/
selectionMessage?: string | undefined;
/**
* Text to be displayed in hidden accessible field when any option is not selected. Defaults to value from PrimeVue locale configuration.
* Default value is 'No selected item'.
* @defaultValue No selected item
*/
emptySelectionMessage?: string | undefined;
/**
* Text to display when filtering does not return any results. Defaults to value from PrimeVue locale configuration.
* Default value is 'No results found'.
* @defaultValue No results found
*/
emptyFilterMessage?: string | undefined;
/**
* Text to display when there are no options available. Defaults to value from PrimeVue locale configuration.
* Default value is 'No results found'.
* @defaultValue No results found
*/
emptyMessage?: string | undefined;
/**
@ -157,7 +169,7 @@ export interface ListboxProps {
tabindex?: number | string | undefined;
/**
* Icon to display in filter input.
* Default value is 'pi pi-search'.
* @defaultValue pi pi-search
*/
filterIcon?: string | undefined;
/**
@ -170,12 +182,15 @@ export interface ListboxProps {
'aria-labelledby'?: string | undefined;
}
/**
* Defines valid slots in Listbox component.
*/
export interface ListboxSlots {
/**
* Custom header template.
* @param {Object} scope - header slot's params.
*/
header: (scope: {
header(scope: {
/**
* Value of the component
*/
@ -184,12 +199,12 @@ export interface ListboxSlots {
* Displayed options
*/
options: any[];
}) => VNode[];
}): VNode[];
/**
* Custom footer template.
* @param {Object} scope - footer slot's params.
*/
footer: (scope: {
footer(scope: {
/**
* Value of the component
*/
@ -198,12 +213,12 @@ export interface ListboxSlots {
* Displayed options
*/
options: any[];
}) => VNode[];
}): VNode[];
/**
* Custom option template.
* @param {Object} scope - option slot's params.
*/
option: (scope: {
option(scope: {
/**
* Option instance
*/
@ -212,12 +227,12 @@ export interface ListboxSlots {
* Index of the option
*/
index: number;
}) => VNode[];
}): VNode[];
/**
* Custom optiongroup template.
* @param {Object} scope - optiongroup slot's params.
*/
optiongroup: (scope: {
optiongroup(scope: {
/**
* Option instance
*/
@ -226,20 +241,20 @@ export interface ListboxSlots {
* Index of the option
*/
index: number;
}) => VNode[];
}): VNode[];
/**
* Custom emptyfilter template.
*/
emptyfilter: () => VNode[];
emptyfilter(): VNode[];
/**
* Custom empty template.
*/
empty: () => VNode[];
empty(): VNode[];
/**
* Custom content template.
* @param {Object} scope - content slot's params.
*/
content: (scope: {
content(scope: {
/**
* An array of objects to display for virtualscroller
*/
@ -256,50 +271,65 @@ export interface ListboxSlots {
/**
* Options of the items
* @param {number} index - Rendered index
* @return {@link VirtualScroller.VirtualScrollerItemOptions}
* @return {VirtualScrollerItemOptions}
*/
getItemOptions(index: number): VirtualScrollerItemOptions;
}) => VNode[];
}): VNode[];
/**
* Custom loader template.
* @param {Object} scope - loader slot's params.
*/
loader: (scope: {
loader(scope: {
/**
* Options of the loader items for virtualscroller
*/
options: any[];
}) => VNode[];
}): VNode[];
}
export declare type ListboxEmits = {
/**
* Defines valid emits in Listbox component.
*/
export interface ListboxEmits {
/**
* Emitted when the value changes.
* @param {*} value - New value.
*/
'update:modelValue': (value: any) => void;
'update:modelValue'(value: any): void;
/**
* Callback to invoke on value change.
* @param {ListboxChangeEvent} event - Custom change event.
*/
change: (event: ListboxChangeEvent) => void;
change(event: ListboxChangeEvent): void;
/**
* Callback to invoke when the component receives focus.
* @param {Event} event - Browser event.
*/
focus: (event: Event) => void;
focus(event: Event): void;
/**
* Callback to invoke when the component loses focus.
* @param {Event} event - Browser event.
*/
blur: (event: Event) => void;
blur(event: Event): void;
/**
* Callback to invoke on filter input.
* @param {ListboxFilterEvent} event - Custom filter event.
*/
filter: (event: ListboxFilterEvent) => void;
};
filter(event: ListboxFilterEvent): void;
}
/**
* **PrimeVue - Listbox**
*
* _ListBox is used to select one or more values from a list of items._
*
* [Live Demo](https://www.primevue.org/listbox/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo.svg)
*
* @group Component
*
*/
declare class Listbox extends ClassComponent<ListboxProps, ListboxSlots, ListboxEmits> {}
declare module '@vue/runtime-core' {
@ -308,13 +338,4 @@ declare module '@vue/runtime-core' {
}
}
/**
*
* Listbox is used to select one or more values from a list of items.
*
* Demos:
*
* - [Listbox](https://www.primefaces.org/primevue/listbox)
*
*/
export default Listbox;