2020-05-29 00:33:49 +08:00
|
|
|
|
@namespace AntDesign
|
2020-05-18 14:46:42 +08:00
|
|
|
|
@inherits AntDomComponentBase
|
2020-05-29 00:33:49 +08:00
|
|
|
|
@using AntDesign.Internal
|
2020-05-18 14:46:42 +08:00
|
|
|
|
|
2020-05-19 20:35:48 +08:00
|
|
|
|
@{
|
2020-05-18 14:46:42 +08:00
|
|
|
|
string prefixCls = $"{RootMenu.PrefixCls}-submenu";
|
|
|
|
|
}
|
2020-05-19 20:35:48 +08:00
|
|
|
|
|
2020-05-18 14:46:42 +08:00
|
|
|
|
@if (RootMenu.InternalMode == MenuMode.Inline)
|
|
|
|
|
{
|
2021-01-21 17:20:10 +08:00
|
|
|
|
<li class="@ClassMapper.Class" role="menuitem" @key="Key" style="position:relative;@Style" @ref="Ref">
|
2020-06-04 14:48:13 +08:00
|
|
|
|
<div class="@(prefixCls)-title" style="padding-left: @(PaddingLeft)px; " role="button" @onclick="HandleOnTitleClick" aria-haspopup="true">
|
2020-09-16 13:58:16 +08:00
|
|
|
|
@if (TitleTemplate != null)
|
2020-05-18 14:46:42 +08:00
|
|
|
|
{
|
2020-09-16 13:58:16 +08:00
|
|
|
|
@TitleTemplate
|
2020-05-18 14:46:42 +08:00
|
|
|
|
}
|
2020-09-16 13:58:16 +08:00
|
|
|
|
else if (Title != null)
|
2020-05-18 14:46:42 +08:00
|
|
|
|
{
|
2020-09-16 13:58:16 +08:00
|
|
|
|
<span>@Title</span>
|
2020-05-18 14:46:42 +08:00
|
|
|
|
}
|
|
|
|
|
<i class="@(prefixCls)-arrow"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<ul direction="ltr" class="@SubMenuMapper.Class" role="menu" aria-expanded="@IsOpen">
|
2021-01-21 17:20:10 +08:00
|
|
|
|
<CascadingValue Value="this" IsFixed="@true">
|
2020-05-18 14:46:42 +08:00
|
|
|
|
@ChildContent
|
|
|
|
|
</CascadingValue>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
}
|
2021-09-16 22:46:45 +08:00
|
|
|
|
else if (RootMenu.InlineCollapsed || RootMenu.InternalMode == MenuMode.Horizontal || Level == 0)
|
2020-05-18 14:46:42 +08:00
|
|
|
|
{
|
2020-12-25 13:28:17 +08:00
|
|
|
|
if (Placement == null)
|
|
|
|
|
{
|
2021-09-10 19:06:50 +08:00
|
|
|
|
Placement = (RootMenu.Mode == MenuMode.Horizontal && Parent == null) ? AntDesign.Placement.BottomLeft : AntDesign.Placement.RightTop;
|
2020-12-25 13:28:17 +08:00
|
|
|
|
}
|
2021-09-16 22:46:45 +08:00
|
|
|
|
<CascadingValue Value="this" Name="SubMenu" IsFixed>
|
|
|
|
|
<CascadingValue Value="@prefixCls" Name="PrefixCls" IsFixed>
|
|
|
|
|
<SubMenuTrigger @ref="_overlayTrigger"
|
|
|
|
|
TriggerClass="@ClassMapper.Class"
|
|
|
|
|
Visible="IsOpen"
|
|
|
|
|
ComplexAutoCloseAndVisible="true"
|
|
|
|
|
BoundaryAdjustMode="@TriggerBoundaryAdjustMode.None"
|
|
|
|
|
Disabled="Disabled"
|
|
|
|
|
Placement="Placement.Value"
|
|
|
|
|
OnVisibleChange="OnOverlayVisibleChange"
|
|
|
|
|
OnOverlayHiding="OnOverlayHiding"
|
|
|
|
|
Trigger="new Trigger[] { RootMenu?.TriggerSubMenuAction ?? AntDesign.Trigger.Hover }"
|
|
|
|
|
PlacementCls="@($"{prefixCls}-popup {RootMenu.PrefixCls} {RootMenu.PrefixCls}-{RootMenu.Theme} {prefixCls}-placement-{_placement.Name}")"
|
|
|
|
|
OverlayEnterCls="@($"{prefixCls}-{RootMenu.Theme} ")"
|
|
|
|
|
OverlayLeaveCls="@($"{prefixCls}-{RootMenu.Theme} ")"
|
|
|
|
|
OverlayHiddenCls="@($"{prefixCls}-hidden")">
|
|
|
|
|
<ChildContent>
|
|
|
|
|
<div class="@(prefixCls)-title" role="button">
|
|
|
|
|
@if (TitleTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@TitleTemplate
|
|
|
|
|
}
|
|
|
|
|
else if (Title != null)
|
|
|
|
|
{
|
|
|
|
|
<span>@Title</span>
|
|
|
|
|
}
|
|
|
|
|
@GetArrow()
|
|
|
|
|
</div>
|
|
|
|
|
</ChildContent>
|
|
|
|
|
<Overlay>
|
|
|
|
|
<ul direction="ltr" class="@(SubMenuMapper.Class)" style="@_popupMinWidthStyle" role="menu">
|
|
|
|
|
<CascadingValue Value="this" IsFixed="@true">
|
|
|
|
|
@ChildContent
|
|
|
|
|
</CascadingValue>
|
|
|
|
|
</ul>
|
|
|
|
|
</Overlay>
|
|
|
|
|
</SubMenuTrigger>
|
|
|
|
|
</CascadingValue>
|
2020-05-18 14:46:42 +08:00
|
|
|
|
</CascadingValue>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@code
|
|
|
|
|
{
|
|
|
|
|
private RenderFragment GetArrow()
|
2021-09-16 22:46:45 +08:00
|
|
|
|
{
|
2020-05-18 14:46:42 +08:00
|
|
|
|
string prefixCls = $"{RootMenu.PrefixCls}-submenu";
|
|
|
|
|
if (RootMenu.PrefixCls.Contains("dropdown"))
|
|
|
|
|
{
|
2021-09-16 22:46:45 +08:00
|
|
|
|
return @<span class="@(prefixCls)-arrow">
|
|
|
|
|
<span role="img" aria-label="right" class="anticon anticon-right @(prefixCls)-arrow-icon">
|
|
|
|
|
<svg viewBox="64 64 896 896" focusable="false" class="" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true">
|
|
|
|
|
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"></path>
|
|
|
|
|
</svg>
|
|
|
|
|
</span>
|
|
|
|
|
</span>;
|
|
|
|
|
}
|
|
|
|
|
else if (Parent is AntDesign.SubMenu || RootMenu.Mode == MenuMode.Vertical)
|
|
|
|
|
{
|
|
|
|
|
return @<i class="@(prefixCls)-arrow"></i>;
|
|
|
|
|
}
|
|
|
|
|
return default;
|
|
|
|
|
}
|
2020-05-18 14:46:42 +08:00
|
|
|
|
}
|