From 5a2c26f1185096fcf1b2f799a237e7e0f6d4926b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Mon, 9 Oct 2023 22:55:27 +0300 Subject: [PATCH] Fixed #13827 - Update conditionals for disabled menu item --- src/app/components/panelmenu/panelmenu.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/app/components/panelmenu/panelmenu.ts b/src/app/components/panelmenu/panelmenu.ts index df4b029ee24..35f3a0aff04 100644 --- a/src/app/components/panelmenu/panelmenu.ts +++ b/src/app/components/panelmenu/panelmenu.ts @@ -51,7 +51,7 @@ import { ObjectUtils, UniqueComponentId } from 'primeng/utils';
  • @@ -200,6 +201,13 @@ export class PanelMenuSub { return this.getItemId(processedItem); } + getItemClass(processedItem) { + return { + 'p-menuitem': true, + 'p-disabled': this.isItemDisabled(processedItem) + } + } + getItemProp(processedItem, name?, params?) { return processedItem && processedItem.item ? ObjectUtils.getItemValue(processedItem.item[name], params) : undefined; } @@ -245,8 +253,10 @@ export class PanelMenuSub { } onItemClick(event, processedItem) { - this.getItemProp(processedItem, 'command', { originalEvent: event, item: processedItem.item }); - this.itemToggle.emit({ processedItem, expanded: !this.isItemActive(processedItem) }); + if(!this.isItemDisabled(processedItem)) { + this.getItemProp(processedItem, 'command', { originalEvent: event, item: processedItem.item }); + this.itemToggle.emit({ processedItem, expanded: !this.isItemActive(processedItem) }); + } } onItemToggle(event) { @@ -1060,4 +1070,4 @@ export class PanelMenu implements AfterContentInit { exports: [PanelMenu, RouterModule, TooltipModule, SharedModule], declarations: [PanelMenu, PanelMenuSub, PanelMenuList] }) -export class PanelMenuModule {} +export class PanelMenuModule {} \ No newline at end of file