From f4777982ce86e8705710ff123721d105b1710b85 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Tue, 14 Jan 2025 10:07:43 +0300 Subject: [PATCH] Fixed ##7073 - AutoComplete: context option updates --- packages/primevue/src/autocomplete/AutoComplete.d.ts | 8 ++++++++ packages/primevue/src/autocomplete/AutoComplete.vue | 2 ++ 2 files changed, 10 insertions(+) diff --git a/packages/primevue/src/autocomplete/AutoComplete.d.ts b/packages/primevue/src/autocomplete/AutoComplete.d.ts index 7894c1531..10272b087 100755 --- a/packages/primevue/src/autocomplete/AutoComplete.d.ts +++ b/packages/primevue/src/autocomplete/AutoComplete.d.ts @@ -280,6 +280,14 @@ export interface AutoCompleteState { * Defines current options in AutoComplete component. */ export interface AutoCompleteContext { + /** + * Current option. + */ + option?: any; + /** + * Index of the current option. + */ + index: number; /** * Current selection state of the item as a boolean. * @defaultValue false diff --git a/packages/primevue/src/autocomplete/AutoComplete.vue b/packages/primevue/src/autocomplete/AutoComplete.vue index 2c8ecd7fd..e131b0aeb 100755 --- a/packages/primevue/src/autocomplete/AutoComplete.vue +++ b/packages/primevue/src/autocomplete/AutoComplete.vue @@ -278,6 +278,8 @@ export default { getPTOptions(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)