diff --git a/components/lib/panelmenu/PanelMenu.d.ts b/components/lib/panelmenu/PanelMenu.d.ts index 0ca71306a0..00629c012b 100755 --- a/components/lib/panelmenu/PanelMenu.d.ts +++ b/components/lib/panelmenu/PanelMenu.d.ts @@ -134,6 +134,10 @@ export interface PanelMenuState { * Defines current options in PanelMenu component. */ export interface PanelMenuContext { + /** + * Index of the menuitem. + */ + index: number; /** * Current active state of menuitem as a boolean. * @defaultValue false diff --git a/components/lib/panelmenu/PanelMenu.vue b/components/lib/panelmenu/PanelMenu.vue index ca14f67a31..53dfbc76d7 100644 --- a/components/lib/panelmenu/PanelMenu.vue +++ b/components/lib/panelmenu/PanelMenu.vue @@ -13,26 +13,26 @@ :aria-disabled="isItemDisabled(item)" @click="onHeaderClick($event, item)" @keydown="onHeaderKeyDown($event, item)" - v-bind="getPTOptions(item, 'header')" + v-bind="getPTOptions('header', item, index)" :data-p-highlight="isItemActive(item)" :data-p-disabled="isItemDisabled(item)" > -
+
@@ -91,9 +91,10 @@ export default { getItemLabel(item) { return this.getItemProp(item, 'label'); }, - getPTOptions(item, key) { + getPTOptions(key, item, index) { return this.ptm(key, { - options: { + context: { + index, active: this.isItemActive(item), focused: this.isItemFocused(item) } diff --git a/components/lib/panelmenu/PanelMenuSub.vue b/components/lib/panelmenu/PanelMenuSub.vue index e64324f111..8e9abff6c7 100755 --- a/components/lib/panelmenu/PanelMenuSub.vue +++ b/components/lib/panelmenu/PanelMenuSub.vue @@ -12,27 +12,27 @@ :aria-level="level + 1" :aria-setsize="getAriaSetSize()" :aria-posinset="getAriaPosInset(index)" - v-bind="getPTOptions(processedItem, 'menuitem')" + v-bind="getPTOptions('menuitem', processedItem, index)" :data-p-focused="isItemFocused(processedItem)" :data-p-disabled="isItemDisabled(processedItem)" > -
+
@@ -127,9 +127,10 @@ export default { getItemLabel(processedItem) { return this.getItemProp(processedItem, 'label'); }, - getPTOptions(processedItem, key) { + getPTOptions(key, processedItem, index) { return this.ptm(key, { context: { + index, active: this.isItemActive(processedItem), focused: this.isItemFocused(processedItem) }