From b701c0443eca978dd9a752c4e9736a1e4184e1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 25 Jul 2023 12:12:10 +0300 Subject: [PATCH] Refactor #4190 - For TieredMenu --- components/lib/tieredmenu/TieredMenu.d.ts | 8 +++++++ components/lib/tieredmenu/TieredMenuSub.vue | 24 +++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/components/lib/tieredmenu/TieredMenu.d.ts b/components/lib/tieredmenu/TieredMenu.d.ts index 90da29753..6b935a5c3 100755 --- a/components/lib/tieredmenu/TieredMenu.d.ts +++ b/components/lib/tieredmenu/TieredMenu.d.ts @@ -135,6 +135,14 @@ export interface TieredMenuState { * Defines current options in TieredMenu component. */ export interface TieredMenuContext { + /** + * Current menuitem + */ + item: any; + /** + * Index of the menuitem. + */ + index: number; /** * Current active state of menuitem as a boolean. * @defaultValue false diff --git a/components/lib/tieredmenu/TieredMenuSub.vue b/components/lib/tieredmenu/TieredMenuSub.vue index 0c85a83c8..a7173748a 100755 --- a/components/lib/tieredmenu/TieredMenuSub.vue +++ b/components/lib/tieredmenu/TieredMenuSub.vue @@ -14,27 +14,27 @@ :aria-level="level + 1" :aria-setsize="getAriaSetSize()" :aria-posinset="getAriaPosInset(index)" - v-bind="getPTOptions(processedItem, 'menuitem')" + v-bind="getPTOptions(processedItem, index, 'menuitem')" :data-p-highlight="isItemActive(processedItem)" :data-p-focused="isItemFocused(processedItem)" :data-p-disabled="isItemDisabled(processedItem)" > -
+
@@ -127,9 +127,11 @@ export default { getItemLabel(processedItem) { return this.getItemProp(processedItem, 'label'); }, - getPTOptions(processedItem, key) { + getPTOptions(processedItem, index, key) { return this.ptm(key, { context: { + item: processedItem, + index, active: this.isItemActive(processedItem), focused: this.isItemFocused(processedItem) }