Skip to content

Commit

Permalink
Fix #7261: Menu separator respect visible property (#7263)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Sep 27, 2024
1 parent 92de1eb commit a280a57
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions components/lib/contextmenu/ContextMenuSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ export const ContextMenuSub = React.memo(
};

const createItem = (processedItem, index) => {
if (processedItem.visible === false) {
return null;
}

return processedItem.separator ? createSeparator(index) : createMenuItem(processedItem, index);
};

Expand Down
8 changes: 4 additions & 4 deletions components/lib/menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,6 @@ export const Menu = React.memo(
};

const createMenuItem = (item, index, parentId = null) => {
if (item.visible === false) {
return null;
}

const menuContext = { item, index, parentId };
const linkClassName = classNames('p-menuitem-link', { 'p-disabled': item.disabled });
const iconClassName = classNames('p-menuitem-icon', item.icon);
Expand Down Expand Up @@ -427,6 +423,10 @@ export const Menu = React.memo(
};

const createItem = (item, index) => {
if (item.visible === false) {
return null;
}

return item.separator ? createSeparator(item, index) : item.items ? createSubmenu(item, index) : createMenuItem(item, index);
};

Expand Down
4 changes: 4 additions & 0 deletions components/lib/menubar/MenubarSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ export const MenubarSub = React.memo(
};

const createItem = (processedItem, index) => {
if (processedItem.visible === false) {
return null;
}

return getItemProp(processedItem, 'separator') ? createSeparator(processedItem, index) : createMenuitem(processedItem, index);
};

Expand Down
4 changes: 4 additions & 0 deletions components/lib/panelmenu/PanelMenuSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ export const PanelMenuSub = React.memo(
};

const createItem = (item, index) => {
if (item.visible === false) {
return null;
}

return getItemProp(item, 'separator') ? createSeparator(index) : createMenuItem(item, index);
};

Expand Down
4 changes: 4 additions & 0 deletions components/lib/slidemenu/SlideMenuSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ export const SlideMenuSub = React.memo((props) => {
};

const createItem = (item, index) => {
if (item.visible === false) {
return null;
}

return item.separator ? createSeparator(index) : createMenuitem(item, index);
};

Expand Down
4 changes: 4 additions & 0 deletions components/lib/tieredmenu/TieredMenuSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ export const TieredMenuSub = React.memo(
};

const createItem = (processedItem, index) => {
if (processedItem.visible === false) {
return null;
}

return getItemProp(processedItem, 'separator') ? createSeparator(index) : createMenuItem(processedItem, index);
};

Expand Down

0 comments on commit a280a57

Please sign in to comment.