import type UserMenuItem from "./UserMenuItem.js"; import MenuItemTemplate from "@ui5/webcomponents/dist/MenuItemTemplate.js"; import type { MenuItemHooks } from "@ui5/webcomponents/dist/MenuItemTemplate.js"; import ListItemTemplate from "@ui5/webcomponents/dist/ListItemTemplate.js"; import type { ListItemHooks } from "@ui5/webcomponents/dist/ListItemTemplate.js"; import ResponsivePopover from "@ui5/webcomponents/dist/ResponsivePopover.js"; import Button from "@ui5/webcomponents/dist/Button.js"; import List from "@ui5/webcomponents/dist/List.js"; import BusyIndicator from "@ui5/webcomponents/dist/BusyIndicator.js"; import Icon from "@ui5/webcomponents/dist/Icon.js"; import PopoverPlacement from "@ui5/webcomponents/dist/types/PopoverPlacement.js"; import navBackIcon from "@ui5/webcomponents-icons/dist/nav-back.js"; import declineIcon from "@ui5/webcomponents-icons/dist/decline.js"; import checkIcon from "@ui5/webcomponents-icons/dist/accept.js"; import slimArrowRight from "@ui5/webcomponents-icons/dist/slim-arrow-right.js"; export default function UserMenuItemTemplate(this: UserMenuItem) { if (this.isPhone) { return phoneTemplate.call(this); } const hooks: Partial = {}; if (this.showSelection) { hooks.menuItemTextContent = userMenuItemTextContent; } return [MenuItemTemplate.call(this, hooks)]; } function phoneTemplate(this: UserMenuItem) { const hooks: Partial = { iconBegin(this: UserMenuItem) { if (this.hasIcon) { return ; } if (this._siblingsWithIcon) { return
; } }, listItemContent(this: UserMenuItem) { return (<> {this.showSelection ? (
{this.text &&
{this.text}
} {this._selectedSubItemText &&
{this._selectedSubItemText}
}
) : ( <>{this.text &&
{this.text}
} )} {rightContent.call(this)} {checkmarkContent.call(this)} ); }, }; return [ ListItemTemplate.call(this, hooks), phoneSubmenuPopover.call(this), ]; } function checkmarkContent(this: UserMenuItem) { return !this._markChecked ? "" : (
); } function rightContent(this: UserMenuItem) { switch (true) { case this.hasSubmenu: return (
); case this.hasEndContent: return (
); case !!this.additionalText: return ( {this.additionalText} ); } } function phoneSubmenuPopover(this: UserMenuItem) { return this.hasSubmenu &&
{this.items.length ? ( ) : this.loading && }
; } function userMenuItemTextContent(this: UserMenuItem) { return (
{this.text &&
{this.text}
} {this._selectedSubItemText &&
{this._selectedSubItemText}
}
); }