Fixed #1836 - For SelectButton
parent
7ec9d396e9
commit
6b46bb49c3
|
@ -1,33 +1,117 @@
|
||||||
|
import { VNode } from 'vue';
|
||||||
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||||
|
|
||||||
type SelectButtonOptionLabelType = string | ((data: any) => string) | undefined;
|
type SelectButtonOptionLabelType = string | ((data: any) => string) | undefined;
|
||||||
|
|
||||||
type SelectButtonOptionValueType = string | ((data: any) => any) | undefined;
|
type SelectButtonOptionValueType = string | ((data: any) => any) | undefined;
|
||||||
|
|
||||||
type SelectButtonOptionDisabledType = string | ((data: any) => boolean) | undefined;
|
type SelectButtonOptionDisabledType = string | ((data: any) => boolean) | undefined;
|
||||||
|
|
||||||
interface SelectButtonProps {
|
export interface SelectButtonChangeEvent {
|
||||||
|
/**
|
||||||
|
* Browser event.
|
||||||
|
*/
|
||||||
|
originalEvent: Event;
|
||||||
|
/**
|
||||||
|
* Single value or an array of values that are selected.
|
||||||
|
*/
|
||||||
|
value: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SelectButtonProps {
|
||||||
|
/**
|
||||||
|
* Value of the component.
|
||||||
|
*/
|
||||||
modelValue?: any;
|
modelValue?: any;
|
||||||
options?: 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.
|
||||||
|
*/
|
||||||
optionLabel?: SelectButtonOptionLabelType;
|
optionLabel?: SelectButtonOptionLabelType;
|
||||||
|
/**
|
||||||
|
* Property name or getter function to use as the value of an option, defaults to the option itself when not defined.
|
||||||
|
*/
|
||||||
optionValue?: SelectButtonOptionValueType;
|
optionValue?: SelectButtonOptionValueType;
|
||||||
|
/**
|
||||||
|
* Property name or getter function to use as the disabled flag of an option, defaults to false when not defined.
|
||||||
|
*/
|
||||||
optionDisabled?: SelectButtonOptionDisabledType;
|
optionDisabled?: SelectButtonOptionDisabledType;
|
||||||
multiple?: boolean;
|
/**
|
||||||
disabled?: boolean;
|
* When specified, allows selecting multiple values.
|
||||||
dataKey?: string;
|
*/
|
||||||
ariaLabelledBy?: string;
|
multiple?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* When present, it specifies that the element should be disabled.
|
||||||
|
*/
|
||||||
|
disabled?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* A property to uniquely identify an option.
|
||||||
|
*/
|
||||||
|
dataKey?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
||||||
|
*/
|
||||||
|
ariaLabelledBy?: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SelectButtonOptionSlotInterface {
|
export interface SelectButtonSlots {
|
||||||
|
/**
|
||||||
|
* Custom content for each option.
|
||||||
|
* @param {Object} scope - option slot's params.
|
||||||
|
*/
|
||||||
|
option: (scope: {
|
||||||
|
/**
|
||||||
|
* Option instance
|
||||||
|
*/
|
||||||
option: any;
|
option: any;
|
||||||
|
/**
|
||||||
|
* Index of the option
|
||||||
|
*/
|
||||||
index: number;
|
index: number;
|
||||||
|
}) => VNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class SelectButton {
|
export declare type SelectButtonEmits = {
|
||||||
$props: SelectButtonProps;
|
/**
|
||||||
$emit(eventName: 'update:modelValue', value: any): this;
|
* Emitted when the value changes.
|
||||||
$emit(eventName: 'change', event: {originalEvent: Event, value: any}): this;
|
* @param {*} value - New value.
|
||||||
$emit(eventName: 'focus', event: Event): this;
|
*/
|
||||||
$emit(eventName: 'blur', event: Event): this;
|
'update:modelValue': (value: any) => void;
|
||||||
$slots: {
|
/**
|
||||||
option: SelectButtonOptionSlotInterface;
|
* Callback to invoke on value change.
|
||||||
|
* @param {SelectButtonChangeEvent} event - Custom change event.
|
||||||
|
*/
|
||||||
|
'change': (event: SelectButtonChangeEvent) => void;
|
||||||
|
/**
|
||||||
|
* Callback to invoke on focus.
|
||||||
|
* @param {SelectButtonChangeEvent} event - Browser event.
|
||||||
|
*/
|
||||||
|
'focus': (event: Event) => void;
|
||||||
|
/**
|
||||||
|
* Callback to invoke on blur.
|
||||||
|
* @param {Event} event - Browser event.
|
||||||
|
*/
|
||||||
|
'blur': (event: Event) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare class SelectButton extends ClassComponent<SelectButtonProps, SelectButtonSlots, SelectButtonEmits> { }
|
||||||
|
|
||||||
|
declare module '@vue/runtime-core' {
|
||||||
|
interface GlobalComponents {
|
||||||
|
SelectButton: GlobalComponentConstructor<SelectButton>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* SelectButton is a form component to choose a value from a list of options using button elements.
|
||||||
|
*
|
||||||
|
* Demos:
|
||||||
|
*
|
||||||
|
* - [SelectButton](https://www.primefaces.org/primevue/showcase/#/selectbutton)
|
||||||
|
*
|
||||||
|
*/
|
||||||
export default SelectButton;
|
export default SelectButton;
|
||||||
|
|
Loading…
Reference in New Issue