diff --git a/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.html b/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.html index d2d87de..fc018be 100644 --- a/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.html +++ b/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.html @@ -33,7 +33,27 @@ @@ -46,7 +66,27 @@
diff --git a/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.js b/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.js index 12efd44..11508c4 100644 --- a/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.js +++ b/force-app/navigation/lwc/sfpegNavigationMenuCmp/sfpegNavigationMenuCmp.js @@ -111,13 +111,37 @@ export default class SfpegNavigationMenuCmp extends NavigationMixin(LightningEle if (this.isDebug) console.log('wiredMenu: processing menu item ',item); let newItem = {... item}; newItem.labelOrig = item.label; - //newItem.title = this.titlePrefix + ' ' + this.navLabel; - newItem.title = this.titlePrefix + ' ' + item.label; + newItem.title = this.titlePrefix + ' ' + newItem.label; + newItem.hasChildren = false; + newItem.children = []; + newItem.isLink = true; if (newItem.label?.includes('&')) { if (this.isDebug) console.log('wiredHeaderMenus: unescaping label'); newItem.label = this.htmlDecode(newItem.label); } + if (newItem.actionValue === null) { + newItem.isLink = false; + } + // Process submenu items + if (item.subMenu && item.subMenu.length > 0) { + newItem.hasChildren = true; + item.subMenu.forEach(subItem => { + let childItem = { ...subItem }; + childItem.labelOrig = subItem.label; + childItem.title = this.titlePrefix + ' ' + childItem.label; + childItem.isChild = true; + childItem.isLink = true; + + if (childItem.label?.includes('&')) { + childItem.label = this.htmlDecode(childItem.label); + } + if (childItem.actionValue === null) { + childItem.isLink = false; + } + newItem.children.push(childItem); + }); + } menuItems.push(newItem); }); if (this.isDebug) console.log('wiredMenu: menuItems reworked',JSON.stringify(menuItems));