mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Refactor #5437 - For DataViewLayoutOptions
This commit is contained in:
parent
d6f209ad08
commit
fd7245da44
6 changed files with 44 additions and 65 deletions
14
components/lib/selectbutton/SelectButton.d.ts
vendored
14
components/lib/selectbutton/SelectButton.d.ts
vendored
|
@ -12,12 +12,12 @@ import { ComponentHooks } from '../basecomponent';
|
|||
import { PassThroughOptions } from '../passthrough';
|
||||
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
||||
|
||||
export declare type SelectButtonPassThroughOptionType = SelectButtonPassThroughAttributes | ((options: SelectButtonPassThroughMethodOptions) => SelectButtonPassThroughAttributes | string) | string | null | undefined;
|
||||
export declare type SelectButtonPassThroughOptionType<T = any> = SelectButtonPassThroughAttributes | ((options: SelectButtonPassThroughMethodOptions<T>) => SelectButtonPassThroughAttributes | string) | string | null | undefined;
|
||||
|
||||
/**
|
||||
* Custom passthrough(pt) option method.
|
||||
*/
|
||||
export interface SelectButtonPassThroughMethodOptions {
|
||||
export interface SelectButtonPassThroughMethodOptions<T = any> {
|
||||
/**
|
||||
* Defines instance.
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ export interface SelectButtonPassThroughMethodOptions {
|
|||
/**
|
||||
* Defines parent options.
|
||||
*/
|
||||
parent: any;
|
||||
parent: T;
|
||||
/**
|
||||
* Defines passthrough(pt) options in global config.
|
||||
*/
|
||||
|
@ -52,19 +52,19 @@ export interface SelectButtonPassThroughMethodOptions {
|
|||
* Custom passthrough(pt) options.
|
||||
* @see {@link SelectButtonProps.pt}
|
||||
*/
|
||||
export interface SelectButtonPassThroughOptions {
|
||||
export interface SelectButtonPassThroughOptions<T = any> {
|
||||
/**
|
||||
* Used to pass attributes to the root's DOM element.
|
||||
*/
|
||||
root?: SelectButtonPassThroughOptionType;
|
||||
root?: SelectButtonPassThroughOptionType<T>;
|
||||
/**
|
||||
* Used to pass attributes to the button's DOM element.
|
||||
*/
|
||||
button?: SelectButtonPassThroughOptionType;
|
||||
button?: SelectButtonPassThroughOptionType<T>;
|
||||
/**
|
||||
* Used to pass attributes to the label's DOM element.
|
||||
*/
|
||||
label?: SelectButtonPassThroughOptionType;
|
||||
label?: SelectButtonPassThroughOptionType<T>;
|
||||
/**
|
||||
* Used to manage all lifecycle hooks.
|
||||
* @see {@link BaseComponent.ComponentHooks}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:key="getOptionRenderKey(option)"
|
||||
v-ripple
|
||||
:tabindex="findTabindex(option, i)"
|
||||
:aria-label="getOptionLabel(option)"
|
||||
:aria-label="getOptionLabel(option, i)"
|
||||
:role="multiple ? 'checkbox' : 'radio'"
|
||||
:aria-checked="isSelected(option)"
|
||||
:aria-disabled="isOptionDisabled(option)"
|
||||
|
@ -54,7 +54,11 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
getOptionLabel(option) {
|
||||
getOptionLabel(option, index) {
|
||||
if (this.$parent.$name === 'DataViewLayoutOptions') {
|
||||
return index === 0 ? this.$parent.listViewAriaLabel : this.$parent.gridViewAriaLabel;
|
||||
}
|
||||
|
||||
return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
|
||||
},
|
||||
getOptionValue(option) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue