2020-05-29 00:33:49 +08:00
|
|
|
|
@namespace AntDesign
|
2020-04-23 17:13:56 +08:00
|
|
|
|
@inherits AntDomComponentBase
|
2019-12-09 00:25:22 +08:00
|
|
|
|
|
2021-01-22 10:15:24 +08:00
|
|
|
|
<CascadingValue Value="this" IsFixed>
|
2022-09-16 14:17:30 +08:00
|
|
|
|
@* There is no need to render the tooltip if there is no inline mode. Tooltip will be only showing menu content if menu is collapsed to icon version && only for root menu *@
|
|
|
|
|
@if (RootMenu.Mode == MenuMode.Inline && ParentMenu is null)
|
|
|
|
|
{
|
|
|
|
|
<Tooltip TitleTemplate="@content(this)" Placement="@Placement.Right" Disabled="TooltipDisabled">
|
|
|
|
|
<Unbound Context="tooltip">
|
2021-10-08 23:38:46 +08:00
|
|
|
|
<li class="@ClassMapper.Class" role="menuitem" style="@((PaddingLeft>0? $"padding-left:{PaddingLeft}px;":"")+@Style)" @onclick="HandleOnClick" @key="Key" @ref="tooltip.Current">
|
2022-05-15 12:45:14 +08:00
|
|
|
|
@icon(this)
|
2021-10-08 23:38:46 +08:00
|
|
|
|
<span class="ant-menu-title-content">
|
|
|
|
|
@if (RouterLink == null)
|
|
|
|
|
{
|
|
|
|
|
@content(this)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<MenuLink Href="@RouterLink" Match="@RouterMatch">@content(this)</MenuLink>
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
</li>
|
2022-09-16 14:17:30 +08:00
|
|
|
|
</Unbound>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<li class="@ClassMapper.Class" role="menuitem" style="@((PaddingLeft>0? $"padding-left:{PaddingLeft}px;":"")+@Style)" @onclick="HandleOnClick" @key="Key">
|
|
|
|
|
@icon(this)
|
|
|
|
|
<span class="ant-menu-title-content">
|
|
|
|
|
@if (RouterLink == null)
|
|
|
|
|
{
|
|
|
|
|
@content(this)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<MenuLink Href="@RouterLink" Match="@RouterMatch">@content(this)</MenuLink>
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
</li>
|
|
|
|
|
}
|
2021-02-04 16:21:56 +08:00
|
|
|
|
</CascadingValue>
|
|
|
|
|
|
|
|
|
|
@code {
|
2022-09-16 14:17:30 +08:00
|
|
|
|
RenderFragment<MenuItem> content = item =>
|
|
|
|
|
@<Template>
|
|
|
|
|
@if (item.Title != null)
|
|
|
|
|
{
|
|
|
|
|
@item.Title
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@item.ChildContent
|
|
|
|
|
}
|
2022-05-15 12:45:14 +08:00
|
|
|
|
</Template>
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
RenderFragment<MenuItem> icon = item =>
|
|
|
|
|
@<Template>
|
|
|
|
|
@if (item.IconTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
<span role="img" class=" anticon anticon-container">
|
|
|
|
|
@item.IconTemplate
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
else if (item.Icon != null)
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="@item.Icon" />
|
|
|
|
|
}
|
|
|
|
|
</Template>
|
|
|
|
|
;
|
2022-09-16 14:17:30 +08:00
|
|
|
|
}
|