Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,27 @@
<ul class={listClass} >
<template for:each={menuItems} for:item="item">
<li key={item.label}>
<a href="#" data-value={item.label} tabindex="0" title={item.title} onclick={handleLinkClick}>{item.label}</a>
<template lwc:if={item.isLink}>
<a href="#" data-value={item.label} tabindex="0" title={item.title} onclick={handleLinkClick}>{item.label}</a>
</template>
<template lwc:else>
{item.label}
</template>
<!-- Submenu for MenuLabel items -->
<template if:true={item.hasChildren}>
<ul class={listClass}>
<template for:each={item.children} for:item="child">
<li key={child.label}>
<template lwc:if={child.isLink}>
<a href="#" data-value={child.label} tabindex="0" title={child.title} onclick={handleLinkClick}>{child.label}</a>
</template>
<template lwc:else>
{child.label}
</template>
</li>
</template>
</ul>
</template>
</li>
</template>
</ul>
Expand All @@ -46,7 +66,27 @@
<ol class={listClass}>
<template for:each={menuItems} for:item="item">
<li key={item.label}>
<a href="#" data-value={item.label} tabindex="0" title={item.title} onclick={handleLinkClick}>{item.label}</a>
<template lwc:if={item.isLink}>
<a href="#" data-value={item.label} tabindex="0" title={item.title} onclick={handleLinkClick}>{item.label}</a>
</template>
<template lwc:else>
{item.label}
</template>
<!-- Submenu for MenuLabel items -->
<template if:true={item.hasChildren}>
<ul class={listClass}>
<template for:each={item.children} for:item="child">
<li key={child.label}>
<template lwc:if={child.isLink}>
<a href="#" data-value={child.label} tabindex="0" title={child.title} onclick={handleLinkClick}>{child.label}</a>
</template>
<template lwc:else>
{child.label}
</template>
</li>
</template>
</ul>
</template>
</li>
</template>
</ol>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down