SelectButton d.ts updated

pull/3689/head
Tuğçe Küçükoğlu 2023-03-01 11:50:58 +03:00
parent 5d77bd334e
commit a136ffd1a0
1 changed files with 47 additions and 27 deletions

View File

@ -1,12 +1,18 @@
/**
*
* SelectButton is used to choose single or multiple items from a list using buttons.
*
* [Live Demo](https://www.primevue.org/selectbutton/)
*
* @module selectbutton
*
*/
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
type SelectButtonOptionLabelType = string | ((data: any) => string) | undefined; /**
* Custom change event.
type SelectButtonOptionValueType = string | ((data: any) => any) | undefined; */
type SelectButtonOptionDisabledType = string | ((data: any) => boolean) | undefined;
export interface SelectButtonChangeEvent { export interface SelectButtonChangeEvent {
/** /**
* Browser event. * Browser event.
@ -18,6 +24,9 @@ export interface SelectButtonChangeEvent {
value: any; value: any;
} }
/**
* Defines valid properties in SelectButton component.
*/
export interface SelectButtonProps { export interface SelectButtonProps {
/** /**
* Value of the component. * Value of the component.
@ -30,21 +39,23 @@ export interface SelectButtonProps {
/** /**
* Property name or getter function to use as the label of an option. * Property name or getter function to use as the label of an option.
*/ */
optionLabel?: SelectButtonOptionLabelType; 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. * Property name or getter function to use as the value of an option, defaults to the option itself when not defined.
*/ */
optionValue?: SelectButtonOptionValueType; 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. * Property name or getter function to use as the disabled flag of an option, defaults to false when not defined.
*/ */
optionDisabled?: SelectButtonOptionDisabledType; optionDisabled?: string | ((data: any) => boolean) | undefined;
/** /**
* When specified, allows selecting multiple values. * When specified, allows selecting multiple values.
* @defaultValue false
*/ */
multiple?: boolean | undefined; multiple?: boolean | undefined;
/** /**
* When present, it specifies that the element should be disabled. * When present, it specifies that the element should be disabled.
* @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/** /**
@ -53,6 +64,7 @@ export interface SelectButtonProps {
dataKey?: string | undefined; dataKey?: string | undefined;
/** /**
* Whether selection can be cleared. * Whether selection can be cleared.
* @defaultValue true
*/ */
unselectable?: boolean | undefined; unselectable?: boolean | undefined;
/** /**
@ -61,12 +73,15 @@ export interface SelectButtonProps {
'aria-labelledby'?: string | undefined; 'aria-labelledby'?: string | undefined;
} }
/**
* Defines valid slots in SelectButton component.
*/
export interface SelectButtonSlots { export interface SelectButtonSlots {
/** /**
* Custom content for each option. * Custom content for each option.
* @param {Object} scope - option slot's params. * @param {Object} scope - option slot's params.
*/ */
option: (scope: { option(scope: {
/** /**
* Option instance * Option instance
*/ */
@ -75,33 +90,47 @@ export interface SelectButtonSlots {
* Index of the option * Index of the option
*/ */
index: number; index: number;
}) => VNode[]; }): VNode[];
} }
export declare type SelectButtonEmits = { /**
* Defines valid emits in SelectButton component.
*/
export interface SelectButtonEmits {
/** /**
* Emitted when the value changes. * Emitted when the value changes.
* @param {*} value - New value. * @param {*} value - New value.
*/ */
'update:modelValue': (value: any) => void; 'update:modelValue'(value: any): void;
/** /**
* Callback to invoke on value change. * Callback to invoke on value change.
* @param {SelectButtonChangeEvent} event - Custom change event. * @param {SelectButtonChangeEvent} event - Custom change event.
*/ */
change: (event: SelectButtonChangeEvent) => void; change(event: SelectButtonChangeEvent): void;
/** /**
* Callback to invoke on focus. * Callback to invoke on focus.
* @param {SelectButtonChangeEvent} event - Browser event. * @param {SelectButtonChangeEvent} event - Browser event.
*/ */
focus: (event: Event) => void; focus(event: Event): void;
/** /**
* Callback to invoke on blur. * Callback to invoke on blur.
* @param {Event} event - Browser event. * @param {Event} event - Browser event.
*/ */
blur: (event: Event) => void; blur(event: Event): void;
}; }
declare class SelectButton extends ClassComponent<SelectButtonProps, SelectButtonSlots, SelectButtonEmits> {} /**
* **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
*/
export declare class SelectButton extends ClassComponent<SelectButtonProps, SelectButtonSlots, SelectButtonEmits> {}
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
interface GlobalComponents { interface GlobalComponents {
@ -109,13 +138,4 @@ declare module '@vue/runtime-core' {
} }
} }
/**
*
* SelectButton is a form component to choose a value from a list of options using button elements.
*
* Demos:
*
* - [SelectButton](https://www.primefaces.org/primevue/selectbutton)
*
*/
export default SelectButton; export default SelectButton;