2021-02-07 18:13:27 +08:00
|
|
|
|
@using AntDesign.Internal
|
|
|
|
|
@namespace AntDesign
|
2020-06-02 13:34:26 +08:00
|
|
|
|
@inherits AntInputComponentBase<string>
|
|
|
|
|
|
2021-02-07 18:13:27 +08:00
|
|
|
|
<CascadingValue Value=@("ant-cascader-menus") Name="PrefixCls">
|
|
|
|
|
<OverlayTrigger Visible="@(ToggleState && _nodelist != null && _nodelist.Any())"
|
|
|
|
|
ComplexAutoCloseAndVisible="true"
|
|
|
|
|
Trigger="new[] { TriggerType.Click }"
|
|
|
|
|
PopupContainerSelector="@PopupContainerSelector"
|
2021-03-12 15:46:48 +08:00
|
|
|
|
OverlayEnterCls="ant-slide-up-enter ant-slide-up-enter-active ant-slide-up"
|
|
|
|
|
OverlayLeaveCls="ant-slide-up-leave ant-slide-up-leave-active ant-slide-up">
|
2021-02-07 18:13:27 +08:00
|
|
|
|
<Unbound>
|
2021-03-23 12:59:20 +08:00
|
|
|
|
<span @ref="context.Current" style="@Style" id="@Id" class="@ClassMapper.Class" tabindex="1" @onclick="InputOnToggle" @onblur="CascaderOnBlur" @onmouseover="InputOnMouseOver" @onmouseout="InputOnMouseOut">
|
2021-02-07 18:13:27 +08:00
|
|
|
|
<span class="ant-cascader-picker-label"></span>
|
2021-03-23 12:59:20 +08:00
|
|
|
|
<input autocomplete="off" tabindex="-1" placeholder="@PlaceHolder" class="@_inputClassMapper.Class" readonly="@Readonly" type="text" value="@_displayText">
|
2021-02-07 18:13:27 +08:00
|
|
|
|
@if (string.IsNullOrWhiteSpace(Value) || !ShowClearIcon)
|
2020-06-02 13:34:26 +08:00
|
|
|
|
{
|
2021-02-07 18:13:27 +08:00
|
|
|
|
<Icon Type="down" Class="@($"ant-cascader-picker-arrow {(ToggleState ? "ant-cascader-picker-arrow-expand" : string.Empty)}")" />
|
2020-06-02 13:34:26 +08:00
|
|
|
|
}
|
2021-02-07 18:13:27 +08:00
|
|
|
|
else
|
2020-06-02 13:34:26 +08:00
|
|
|
|
{
|
2021-02-07 18:13:27 +08:00
|
|
|
|
<Icon Type="close-circle" Class="ant-cascader-picker-clear" OnClick="ClearSelected" StopPropagation />
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
</Unbound>
|
|
|
|
|
<Overlay>
|
|
|
|
|
<div class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft" tabindex="-1" @onblur="CascaderOnBlur">
|
|
|
|
|
<div @onmouseover="NodesOnMouseOver" @onmouseout="NodesOnMouseOut">
|
2021-03-12 17:02:11 +08:00
|
|
|
|
<ul class="@_menuClassMapper.Class">
|
2021-02-07 18:13:27 +08:00
|
|
|
|
@foreach (CascaderNode nd in _nodelist)
|
2020-06-02 13:34:26 +08:00
|
|
|
|
{
|
2021-02-07 18:13:27 +08:00
|
|
|
|
bool isActive = _renderNodes.Where(n => n == nd).Any();
|
2020-06-02 13:34:26 +08:00
|
|
|
|
string activeClass = isActive ? "ant-cascader-menu-item-active" : string.Empty;
|
|
|
|
|
|
2021-02-07 18:13:27 +08:00
|
|
|
|
<li class="ant-cascader-menu-item ant-cascader-menu-item-expand @activeClass @(nd.Disabled ? "ant-cascader-menu-item-disabled" : string.Empty)" title="@nd.Label" role="menuitem"
|
|
|
|
|
@onclick="@(e => NodeOnClick(nd))" @onmouseover="@(e => NodeOnMouseOver(nd))">
|
|
|
|
|
@nd.Label
|
|
|
|
|
@if (nd.HasChildren)
|
2020-06-02 13:34:26 +08:00
|
|
|
|
{
|
|
|
|
|
<span class="ant-cascader-menu-item-expand-icon">
|
2020-06-28 10:54:27 +08:00
|
|
|
|
<Icon Type="right" />
|
2020-06-02 13:34:26 +08:00
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
</li>
|
|
|
|
|
}
|
|
|
|
|
</ul>
|
2021-02-07 18:13:27 +08:00
|
|
|
|
@foreach (CascaderNode node in _renderNodes)
|
|
|
|
|
{
|
|
|
|
|
if (node.HasChildren)
|
|
|
|
|
{
|
|
|
|
|
<ul class="ant-cascader-menu">
|
|
|
|
|
@foreach (CascaderNode m in node.Children)
|
|
|
|
|
{
|
|
|
|
|
bool isActive = _renderNodes.Where(n => n == m).Any();
|
|
|
|
|
string activeClass = isActive ? "ant-cascader-menu-item-active" : string.Empty;
|
|
|
|
|
|
|
|
|
|
<li class="ant-cascader-menu-item ant-cascader-menu-item-expand @activeClass @(m.Disabled ? "ant-cascader-menu-item-disabled" : string.Empty)" title="@m.Label" role="menuitem"
|
|
|
|
|
@onclick="@(e => NodeOnClick(m))" @onmouseover="@(e => NodeOnMouseOver(m))">
|
|
|
|
|
@m.Label
|
|
|
|
|
@if (m.HasChildren)
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-cascader-menu-item-expand-icon">
|
|
|
|
|
<Icon Type="right" />
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
</li>
|
|
|
|
|
}
|
|
|
|
|
</ul>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Overlay>
|
|
|
|
|
</OverlayTrigger>
|
|
|
|
|
</CascadingValue>
|