Skip to content

Commit

Permalink
Fixed #5470 - Dropdown Pass Through: item
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Mar 29, 2024
1 parent 45a4b25 commit fce857a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/lib/dropdown/Dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers';
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';

export declare type DropdownPassThroughOptionType<T = any> = DropdownPassThroughAttributes | ((options: DropdownPassThroughMethodOptions<T>) => DropdownPassThroughAttributes | string) | string | null | undefined;
Expand Down Expand Up @@ -234,6 +234,14 @@ export interface DropdownState {
* Defines current options in Dropdown component.
*/
export interface DropdownContext {
/**
* Current item option.
*/
option: any;
/**
* Current item index.
*/
index: number;
/**
* Current selection state of the item as a boolean.
* @defaultValue false
Expand Down
2 changes: 2 additions & 0 deletions components/lib/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ export default {
getPTItemOptions(option, itemOptions, index, key) {
return this.ptm(key, {
context: {
option,
index,
selected: this.isSelected(option),
focused: this.focusedOptionIndex === this.getOptionIndex(index, itemOptions),
disabled: this.isOptionDisabled(option)
Expand Down

0 comments on commit fce857a

Please sign in to comment.