Refactor #3965 - Menubar & TieredMenu item object fixes
parent
79e5a5745c
commit
503f9df280
|
@ -92,7 +92,6 @@ const classes = {
|
|||
menu: 'p-menubar-root-list',
|
||||
menuitem: ({ context, processedItem }) => [
|
||||
'p-menuitem',
|
||||
context.getItemProp(processedItem, 'class'),
|
||||
{
|
||||
'p-menuitem-active p-highlight': context.isItemActive(processedItem),
|
||||
'p-focus': context.isItemFocused(processedItem),
|
||||
|
@ -107,11 +106,11 @@ const classes = {
|
|||
'router-link-active-exact': context.exact && isExactActive
|
||||
}
|
||||
],
|
||||
icon: ({ context, processedItem }) => ['p-menuitem-icon', context.getItemProp(processedItem, 'icon')],
|
||||
icon: 'p-menuitem-icon',
|
||||
label: 'p-menuitem-text',
|
||||
submenuIcon: 'p-submenu-icon',
|
||||
submenu: 'p-submenu-list',
|
||||
separator: ({ context, processedItem }) => ['p-menuitem-separator', context.getItemProp(processedItem, 'class')],
|
||||
separator: 'p-menuitem-separator',
|
||||
end: 'p-menubar-end'
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
v-if="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')"
|
||||
:id="getItemId(processedItem)"
|
||||
:style="getItemProp(processedItem, 'style')"
|
||||
:class="getCXOptions('menuitem', { processedItem })"
|
||||
:class="[getCXOptions('menuitem', { processedItem }), getItemProp(processedItem, 'class')]"
|
||||
role="menuitem"
|
||||
:aria-label="getItemLabel(processedItem)"
|
||||
:aria-disabled="isItemDisabled(processedItem) || undefined"
|
||||
|
@ -23,14 +23,14 @@
|
|||
<template v-if="!templates.item">
|
||||
<router-link v-if="getItemProp(processedItem, 'to') && !isItemDisabled(processedItem)" v-slot="{ navigate, href, isActive, isExactActive }" :to="getItemProp(processedItem, 'to')" custom>
|
||||
<a v-ripple :href="href" :class="getCXOptions('action', { isActive, isExactActive })" tabindex="-1" aria-hidden="true" @click="onItemActionClick($event, navigate)" v-bind="getPTOptions(processedItem, 'action')">
|
||||
<component v-if="templates.itemicon" :is="templates.itemicon" :item="processedItem.item" :class="getCXOptions('icon', { processedItem })" />
|
||||
<span v-else-if="getItemProp(processedItem, 'icon')" :class="getCXOptions('icon', { processedItem })" v-bind="getPTOptions(processedItem, 'icon')" />
|
||||
<component v-if="templates.itemicon" :is="templates.itemicon" :item="processedItem.item" :class="[getCXOptions('icon'), getItemProp(processedItem, 'icon')]" />
|
||||
<span v-else-if="getItemProp(processedItem, 'icon')" :class="[getCXOptions('icon'), getItemProp(processedItem, 'icon')]" v-bind="getPTOptions(processedItem, 'icon')" />
|
||||
<span :class="getCXOptions('label')" v-bind="getPTOptions(processedItem, 'label')">{{ getItemLabel(processedItem) }}</span>
|
||||
</a>
|
||||
</router-link>
|
||||
<a v-else v-ripple :href="getItemProp(processedItem, 'url')" :class="getCXOptions('action')" :target="getItemProp(processedItem, 'target')" tabindex="-1" aria-hidden="true" v-bind="getPTOptions(processedItem, 'action')">
|
||||
<component v-if="templates.itemicon" :is="templates.itemicon" :item="processedItem.item" :class="getCXOptions('icon', { processedItem })" />
|
||||
<span v-else-if="getItemProp(processedItem, 'icon')" :class="getCXOptions('icon', { processedItem })" v-bind="getPTOptions(processedItem, 'icon')" />
|
||||
<component v-if="templates.itemicon" :is="templates.itemicon" :item="processedItem.item" :class="[getCXOptions('icon'), getItemProp(processedItem, 'icon')]" />
|
||||
<span v-else-if="getItemProp(processedItem, 'icon')" :class="[getCXOptions('icon'), getItemProp(processedItem, 'icon')]" v-bind="getPTOptions(processedItem, 'icon')" />
|
||||
<span :class="getCXOptions('label')" v-bind="getPTOptions(processedItem, 'label')">{{ getItemLabel(processedItem) }}</span>
|
||||
<template v-if="getItemProp(processedItem, 'items')">
|
||||
<component v-if="templates.submenuicon" :is="templates.submenuicon" :root="root" :active="isItemActive(processedItem)" :class="getCXOptions('submenuIcon')" />
|
||||
|
@ -60,8 +60,8 @@
|
|||
<li
|
||||
v-if="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
|
||||
:id="getItemId(processedItem)"
|
||||
:class="[getCXOptions('separator'), getItemProp(processedItem, 'class')]"
|
||||
:style="getItemProp(processedItem, 'style')"
|
||||
:class="getCXOptions('separator', { processedItem })"
|
||||
role="separator"
|
||||
v-bind="ptm('separator')"
|
||||
></li>
|
||||
|
|
|
@ -77,7 +77,8 @@ const classes = {
|
|||
icon: 'p-menuitem-icon',
|
||||
text: 'p-menuitem-text',
|
||||
submenuIcon: 'p-submenu-icon',
|
||||
submenu: 'p-submenu-list'
|
||||
submenu: 'p-submenu-list',
|
||||
separator: 'p-menuitem-separator'
|
||||
};
|
||||
|
||||
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_tieredmenu_style', manual: true });
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
v-if="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
|
||||
:id="getItemId(processedItem)"
|
||||
:style="getItemProp(processedItem, 'style')"
|
||||
:class="getSeparatorItemClass(processedItem)"
|
||||
:class="[getCXOptions('separator'), getItemProp(processedItem, 'class')]"
|
||||
role="separator"
|
||||
v-bind="ptm('separator')"
|
||||
></li>
|
||||
|
@ -176,9 +176,6 @@ export default {
|
|||
},
|
||||
getAriaPosInset(index) {
|
||||
return index - this.items.slice(0, index).filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length + 1;
|
||||
},
|
||||
getSeparatorItemClass(processedItem) {
|
||||
return ['p-menuitem-separator', this.getItemProp(processedItem, 'class')];
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
Loading…
Reference in New Issue