From fce857ae8c58f0c5ee24654eb355d8c075412ff3 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Fri, 29 Mar 2024 08:32:58 +0300 Subject: [PATCH] Fixed #5470 - Dropdown Pass Through: item --- components/lib/dropdown/Dropdown.d.ts | 10 +++++++++- components/lib/dropdown/Dropdown.vue | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/lib/dropdown/Dropdown.d.ts b/components/lib/dropdown/Dropdown.d.ts index 5df3aa518..bf77cd77f 100755 --- a/components/lib/dropdown/Dropdown.d.ts +++ b/components/lib/dropdown/Dropdown.d.ts @@ -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 = DropdownPassThroughAttributes | ((options: DropdownPassThroughMethodOptions) => DropdownPassThroughAttributes | string) | string | null | undefined; @@ -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 diff --git a/components/lib/dropdown/Dropdown.vue b/components/lib/dropdown/Dropdown.vue index d85de8e33..cb3d13e78 100755 --- a/components/lib/dropdown/Dropdown.vue +++ b/components/lib/dropdown/Dropdown.vue @@ -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)