primevue-mirror/components/selectbutton/SelectButton.d.ts

142 lines
3.5 KiB
TypeScript
Raw Normal View History

2023-03-01 08:50:58 +00:00
/**
*
* SelectButton is used to choose single or multiple items from a list using buttons.
*
* [Live Demo](https://www.primevue.org/selectbutton/)
*
* @module selectbutton
*
*/
2022-09-06 12:03:37 +00:00
import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2023-03-01 08:50:58 +00:00
/**
* Custom change event.
2023-03-06 20:35:39 +00:00
* @see {@link SelectButtonEmits.change}
2023-03-01 08:50:58 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface SelectButtonChangeEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Single value or an array of values that are selected.
*/
value: any;
}
2023-03-01 08:50:58 +00:00
/**
* Defines valid properties in SelectButton component.
*/
2022-09-06 12:03:37 +00:00
export interface SelectButtonProps {
/**
* Value of the component.
*/
modelValue?: any;
/**
* An array of selectitems to display as the available options.
*/
options?: any[] | undefined;
/**
* Property name or getter function to use as the label of an option.
*/
2023-03-01 08:50:58 +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 08:50:58 +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 08:50:58 +00:00
optionDisabled?: string | ((data: any) => boolean) | undefined;
2022-09-06 12:03:37 +00:00
/**
* When specified, allows selecting multiple values.
2023-03-01 08:50:58 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
multiple?: boolean | undefined;
/**
* When present, it specifies that the element should be disabled.
2023-03-01 08:50: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;
/**
* Whether selection can be cleared.
2023-03-01 08:50:58 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
unselectable?: boolean | undefined;
/**
* Identifier of the underlying element.
*/
2022-09-14 11:26:01 +00:00
'aria-labelledby'?: string | undefined;
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:50:58 +00:00
/**
* Defines valid slots in SelectButton component.
*/
2022-09-06 12:03:37 +00:00
export interface SelectButtonSlots {
/**
* Custom content for each option.
* @param {Object} scope - option slot's params.
*/
2023-03-01 08:50:58 +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 08:50:58 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:50:58 +00:00
/**
* Defines valid emits in SelectButton component.
*/
export interface SelectButtonEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the value changes.
* @param {*} value - New value.
*/
2023-03-01 08:50:58 +00:00
'update:modelValue'(value: any): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on value change.
* @param {SelectButtonChangeEvent} event - Custom change event.
*/
2023-03-01 08:50:58 +00:00
change(event: SelectButtonChangeEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on focus.
*/
2023-03-01 08:50:58 +00:00
focus(event: Event): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on blur.
* @param {Event} event - Browser event.
*/
2023-03-01 08:50:58 +00:00
blur(event: Event): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 08:50:58 +00:00
/**
* **PrimeVue - SelectButton**
*
* _SelectButton is used to choose single or multiple items from a list using buttons._
*
* [Live Demo](https://www.primevue.org/selectbutton/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2023-03-01 14:48:23 +00:00
declare class SelectButton extends ClassComponent<SelectButtonProps, SelectButtonSlots, SelectButtonEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
SelectButton: GlobalComponentConstructor<SelectButton>;
2022-09-06 12:03:37 +00:00
}
}
export default SelectButton;