2020-09-09 22:12:12 +08:00
|
|
|
@using AntDesign.Internal
|
2020-11-27 13:13:26 +08:00
|
|
|
@using AntDesign.Select.Internal
|
|
|
|
@namespace AntDesign
|
|
|
|
@inherits AntInputComponentBase<TItemValue>
|
|
|
|
@typeparam TItemValue
|
|
|
|
@typeparam TItem
|
2020-06-14 18:54:14 +08:00
|
|
|
|
2020-11-27 13:13:26 +08:00
|
|
|
<CascadingValue Value="this" IsFixed="true">
|
2020-09-09 22:12:12 +08:00
|
|
|
<CascadingValue Value=@("ant-select-dropdown") Name="PrefixCls">
|
2020-11-27 13:13:26 +08:00
|
|
|
<div class="@ClassMapper.Class" style="@Style" id="@Id" tabindex="-1" @ref="Ref">
|
2020-09-09 22:12:12 +08:00
|
|
|
<OverlayTrigger @ref="@_dropDown"
|
|
|
|
Visible="Open"
|
|
|
|
Disabled="Disabled"
|
2020-11-27 13:13:26 +08:00
|
|
|
Trigger="new[] { TriggerType.Click }"
|
2021-01-21 17:20:10 +08:00
|
|
|
HiddenMode
|
2020-11-27 13:13:26 +08:00
|
|
|
OnMouseEnter="@(() => { OnMouseEnter?.Invoke(); })"
|
|
|
|
OnMouseLeave="@(() => { OnMouseLeave?.Invoke(); })"
|
|
|
|
OnVisibleChange="@OnOverlayVisibleChangeAsync"
|
2020-09-17 10:37:47 +08:00
|
|
|
PopupContainerSelector="@PopupContainerSelector"
|
2020-09-10 08:27:48 +08:00
|
|
|
OverlayEnterCls="slide-up-enter slide-up-enter-active slide-up"
|
2020-09-17 10:37:47 +08:00
|
|
|
OverlayLeaveCls="slide-up-leave slide-up-leave-active slide-up">
|
2020-09-09 22:12:12 +08:00
|
|
|
<Overlay>
|
|
|
|
<div style="@_dropdownStyle">
|
2020-11-27 13:13:26 +08:00
|
|
|
@if (SelectOptions != null)
|
|
|
|
{
|
|
|
|
<div class="" style="max-height: @PopupContainerMaxHeight; overflow-y: auto;">
|
|
|
|
<div>
|
|
|
|
<div class="" role="listbox" style="display: flex; flex-direction: column;">
|
2021-02-04 23:40:47 +08:00
|
|
|
@if (CustomTagSelectOptionItem != null)
|
|
|
|
{
|
|
|
|
<CascadingValue Value="@ItemTemplate" Name="ItemTemplate">
|
|
|
|
<CascadingValue Value="@CustomTagSelectOptionItem" Name="Model">
|
|
|
|
<SelectOption
|
|
|
|
@key="@CustomTagSelectOptionItem.InternalId"
|
|
|
|
TItemValue="TItemValue"
|
|
|
|
TItem="TItem">
|
|
|
|
</SelectOption>
|
|
|
|
</CascadingValue>
|
|
|
|
</CascadingValue>
|
|
|
|
}
|
2020-11-27 13:13:26 +08:00
|
|
|
@SelectOptions
|
2021-02-04 23:40:47 +08:00
|
|
|
@if (AddedTags != null)
|
|
|
|
{
|
|
|
|
foreach (var selectOption in AddedTags)
|
|
|
|
{
|
|
|
|
<CascadingValue Value="@ItemTemplate" Name="ItemTemplate">
|
|
|
|
<CascadingValue Value="@selectOption" Name="Model">
|
|
|
|
<SelectOption
|
|
|
|
@key="@selectOption.InternalId"
|
|
|
|
TItemValue="TItemValue"
|
|
|
|
TItem="TItem">
|
|
|
|
</SelectOption>
|
|
|
|
</CascadingValue>
|
|
|
|
</CascadingValue>
|
|
|
|
}
|
|
|
|
}
|
2020-11-27 13:13:26 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
2021-02-04 23:40:47 +08:00
|
|
|
else if (SelectOptions == null)
|
2020-11-27 13:13:26 +08:00
|
|
|
{
|
|
|
|
<div class="" style="max-height: @PopupContainerMaxHeight; overflow-y: auto;">
|
|
|
|
<div>
|
|
|
|
<div class="" role="listbox" style="display: flex; flex-direction: column;">
|
|
|
|
@{
|
|
|
|
@if (!IsGroupingEnabled)
|
|
|
|
{
|
|
|
|
foreach (var selectOption in SortedSelectOptionItems)
|
|
|
|
{
|
|
|
|
<CascadingValue Value="@ItemTemplate" Name="ItemTemplate">
|
|
|
|
<CascadingValue Value="@selectOption.InternalId" Name="InternalId">
|
|
|
|
<SelectOption
|
|
|
|
@key="@selectOption.InternalId"
|
|
|
|
TItemValue="TItemValue"
|
|
|
|
TItem="TItem">
|
|
|
|
</SelectOption>
|
|
|
|
</CascadingValue>
|
|
|
|
</CascadingValue>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<CascadingValue Value="@ItemTemplate" Name="ItemTemplate">
|
|
|
|
<SelectOptionGroup TItemValue="TItemValue" TItem="TItem"></SelectOptionGroup>
|
|
|
|
</CascadingValue>
|
|
|
|
}
|
2020-06-14 18:54:14 +08:00
|
|
|
}
|
2020-11-27 13:13:26 +08:00
|
|
|
</div>
|
2020-06-14 18:54:14 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-27 13:13:26 +08:00
|
|
|
}
|
|
|
|
@if (AllOptionsHidden())
|
2020-09-09 22:12:12 +08:00
|
|
|
{
|
|
|
|
<div role="listbox" id="@(Id)_list" class="@ClassPrefix-item-empty">
|
|
|
|
@if (NotFoundContent != null)
|
|
|
|
{
|
|
|
|
@NotFoundContent
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-27 13:13:26 +08:00
|
|
|
<Empty Simple Small/>
|
2020-09-09 22:12:12 +08:00
|
|
|
}
|
|
|
|
</div>
|
2020-11-27 13:13:26 +08:00
|
|
|
}
|
2020-09-19 09:15:16 +08:00
|
|
|
|
2020-09-09 22:12:12 +08:00
|
|
|
@if (DropdownRender != null)
|
2020-06-14 18:54:14 +08:00
|
|
|
{
|
2020-11-27 13:13:26 +08:00
|
|
|
@DropdownRender(default)
|
2020-06-14 18:54:14 +08:00
|
|
|
}
|
2020-11-27 13:13:26 +08:00
|
|
|
</div>
|
2020-09-09 22:12:12 +08:00
|
|
|
</Overlay>
|
2021-01-21 17:20:10 +08:00
|
|
|
<Unbound>
|
2020-11-27 13:13:26 +08:00
|
|
|
<CascadingValue Value="this" Name=@("ParentSelect") IsFixed="true">
|
|
|
|
<CascadingValue Value="@LabelTemplate" Name="ParentLabelTemplate">
|
|
|
|
<CascadingValue Value="@ShowSearchIcon" Name="ShowSearchIcon">
|
|
|
|
<CascadingValue Value="@ShowArrowIcon" Name="ShowArrowIcon">
|
2021-01-21 17:20:10 +08:00
|
|
|
<SelectContent Prefix="@ClassPrefix"
|
|
|
|
RefBack="@context"
|
2021-02-04 23:40:47 +08:00
|
|
|
@ref="_selectContent"
|
2020-11-27 13:13:26 +08:00
|
|
|
TItemValue="TItemValue"
|
|
|
|
TItem="TItem"
|
|
|
|
SearchValue="@_searchValue"
|
|
|
|
IsOverlayShow="@_dropDown.IsOverlayShow()"
|
|
|
|
OnInput="@OnInputAsync"
|
|
|
|
OnKeyUp="@OnKeyUpAsync"
|
|
|
|
OnKeyDown="@OnKeyDownAsync"
|
|
|
|
OnFocus="@OnInputFocusAsync"
|
|
|
|
OnBlur="@OnInputBlurAsync"
|
2021-01-21 17:20:10 +08:00
|
|
|
OnClearClick="@OnInputClearClickAsync"
|
2020-11-27 13:13:26 +08:00
|
|
|
OnRemoveSelected="@OnRemoveSelectedAsync"
|
|
|
|
Placeholder="@Placeholder"
|
|
|
|
ShowPlaceholder="@ShowPlaceholder"/>
|
|
|
|
</CascadingValue>
|
|
|
|
</CascadingValue>
|
|
|
|
</CascadingValue>
|
2020-09-09 22:12:12 +08:00
|
|
|
</CascadingValue>
|
2021-01-21 17:20:10 +08:00
|
|
|
</Unbound>
|
2020-09-09 22:12:12 +08:00
|
|
|
</OverlayTrigger>
|
2020-06-14 18:54:14 +08:00
|
|
|
</div>
|
2020-09-09 22:12:12 +08:00
|
|
|
</CascadingValue>
|
2020-06-14 18:54:14 +08:00
|
|
|
</CascadingValue>
|