diff --git a/components/lib/contextmenu/BaseContextMenu.vue b/components/lib/contextmenu/BaseContextMenu.vue
index e62cfe3ce..887dce3f6 100644
--- a/components/lib/contextmenu/BaseContextMenu.vue
+++ b/components/lib/contextmenu/BaseContextMenu.vue
@@ -56,6 +56,7 @@ const classes = {
menu: 'p-contextmenu-root-list',
menuitem: ({ context, processedItem }) => [
'p-menuitem',
+ context.getItemProp(processedItem, 'class'),
{
'p-menuitem-active p-highlight': context.isItemActive(processedItem),
'p-focus': context.isItemFocused(processedItem),
@@ -70,11 +71,11 @@ const classes = {
'router-link-active-exact': context.exact && isExactActive
}
],
- icon: 'p-menuitem-icon',
+ icon: ({ context, processedItem }) => ['p-menuitem-icon', context.getItemProp(processedItem, 'icon')],
label: 'p-menuitem-text',
submenuIcon: 'p-submenu-icon',
submenu: 'p-submenu-list',
- separator: 'p-menuitem-separator'
+ separator: ({ context, processedItem }) => ['p-menuitem-separator', context.getItemProp(processedItem, 'class')]
};
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_contextmenu_style', manual: true });
diff --git a/components/lib/contextmenu/ContextMenuSub.vue b/components/lib/contextmenu/ContextMenuSub.vue
index 37b933854..06b6252de 100755
--- a/components/lib/contextmenu/ContextMenuSub.vue
+++ b/components/lib/contextmenu/ContextMenuSub.vue
@@ -6,7 +6,7 @@
v-if="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')"
:id="getItemId(processedItem)"
:style="getItemProp(processedItem, 'style')"
- :class="[getCXOptions('menuitem', { processedItem }), getItemProp(processedItem, 'class')]"
+ :class="getCXOptions('menuitem', { processedItem })"
role="menuitem"
:aria-label="getItemLabel(processedItem)"
:aria-disabled="isItemDisabled(processedItem) || undefined"
@@ -24,14 +24,14 @@
-
-
+
+
{{ getItemLabel(processedItem) }}
-
-
+
+
{{ getItemLabel(processedItem) }}
@@ -64,7 +64,7 @@
v-if="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
:id="getItemId(processedItem)"
:style="getItemProp(processedItem, 'style')"
- :class="[getCXOptions('separator'), getItemProp(processedItem, 'class')]"
+ :class="getCXOptions('separator', { processedItem })"
role="separator"
v-bind="ptm('separator')"
>
diff --git a/components/lib/menu/BaseMenu.vue b/components/lib/menu/BaseMenu.vue
index 9bcc3d4f9..14b58ff9c 100644
--- a/components/lib/menu/BaseMenu.vue
+++ b/components/lib/menu/BaseMenu.vue
@@ -35,10 +35,11 @@ const classes = {
start: 'p-menu-start',
menu: 'p-menu-list p-reset',
submenuHeader: 'p-submenu-header',
- separator: 'p-menuitem-separator',
+ separator: ({ item }) => ['p-menuitem-separator', item.class],
end: 'p-menu-end',
- menuitem: ({ context }) => [
+ menuitem: ({ context, item }) => [
'p-menuitem',
+ item.class,
{
'p-focus': context.id === context.focusedOptionId,
'p-disabled': context.disabled()
@@ -52,7 +53,7 @@ const classes = {
'router-link-active-exact': context.exact && isExactActive
}
],
- icon: 'p-menuitem-icon',
+ icon: ({ item }) => ['p-menuitem-icon', item.icon],
label: 'p-menuitem-text'
};
diff --git a/components/lib/menu/Menu.vue b/components/lib/menu/Menu.vue
index 8d57cdf0d..3c494daf4 100644
--- a/components/lib/menu/Menu.vue
+++ b/components/lib/menu/Menu.vue
@@ -26,10 +26,10 @@
-
+
-
+
diff --git a/components/lib/menu/Menuitem.vue b/components/lib/menu/Menuitem.vue
index 9bd715539..d9ce19b72 100644
--- a/components/lib/menu/Menuitem.vue
+++ b/components/lib/menu/Menuitem.vue
@@ -2,7 +2,7 @@
-
-
+
+
{{ label() }}
-
-
+
+
{{ label() }}
diff --git a/components/lib/tieredmenu/BaseTieredMenu.vue b/components/lib/tieredmenu/BaseTieredMenu.vue
index 8757cd979..0c692148c 100644
--- a/components/lib/tieredmenu/BaseTieredMenu.vue
+++ b/components/lib/tieredmenu/BaseTieredMenu.vue
@@ -60,6 +60,7 @@ const classes = {
menu: 'p-tieredmenu-root-list',
menuitem: ({ context, processedItem }) => [
'p-menuitem',
+ context.getItemProp(processedItem, 'class'),
{
'p-menuitem-active p-highlight': context.isItemActive(processedItem),
'p-focus': context.isItemFocused(processedItem),
@@ -74,10 +75,11 @@ const classes = {
'router-link-active-exact': context.exact && isExactActive
}
],
- icon: 'p-menuitem-icon',
+ icon: ({ context, processedItem }) => ['p-menuitem-icon', context.getItemProp(processedItem, 'icon')],
text: 'p-menuitem-text',
submenuIcon: 'p-submenu-icon',
- submenu: 'p-submenu-list'
+ submenu: 'p-submenu-list',
+ separator: ({ context, processedItem }) => ['p-menuitem-separator', context.getItemProp(processedItem, 'class')]
};
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_tieredmenu_style', manual: true });
diff --git a/components/lib/tieredmenu/TieredMenuSub.vue b/components/lib/tieredmenu/TieredMenuSub.vue
index 68e1ca6d4..cad3d7aba 100755
--- a/components/lib/tieredmenu/TieredMenuSub.vue
+++ b/components/lib/tieredmenu/TieredMenuSub.vue
@@ -5,7 +5,7 @@
v-if="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')"
:id="getItemId(processedItem)"
:style="getItemProp(processedItem, 'style')"
- :class="[getCXOptions('menuitem', { processedItem }), getItemProp(processedItem, 'class')]"
+ :class="getCXOptions('menuitem', { processedItem })"
role="menuitem"
:aria-label="getItemLabel(processedItem)"
:aria-disabled="isItemDisabled(processedItem) || undefined"
@@ -23,14 +23,14 @@
-
-
+
+
{{ getItemLabel(processedItem) }}
-
-
+
+
{{ getItemLabel(processedItem) }}
@@ -61,7 +61,7 @@
v-if="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
:id="getItemId(processedItem)"
:style="getItemProp(processedItem, 'style')"
- :class="getSeparatorItemClass(processedItem)"
+ :class="getCXOptions('separator', { processedItem })"
role="separator"
v-bind="ptm('separator')"
>
@@ -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: {