2020-06-27 18:24:21 +08:00
|
|
|
|
@namespace AntDesign
|
|
|
|
|
@inherits AntInputComponentBase<string>
|
2020-11-02 23:05:17 +08:00
|
|
|
|
@typeparam TOption
|
2020-08-26 22:37:08 +08:00
|
|
|
|
@using AntDesign.Internal
|
2020-06-27 18:24:21 +08:00
|
|
|
|
|
2021-01-21 17:20:10 +08:00
|
|
|
|
<CascadingValue Value='$"ant-select-dropdown"' Name="PrefixCls">
|
|
|
|
|
<OverlayTrigger @ref="_overlayTrigger"
|
|
|
|
|
Style="display: inline"
|
|
|
|
|
IsButton="@true"
|
|
|
|
|
Disabled="false"
|
|
|
|
|
Trigger="new TriggerType[] { 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-01-21 17:20:10 +08:00
|
|
|
|
OverlayClassName="@OverlayClassName"
|
|
|
|
|
OverlayStyle="@OverlayStyle"
|
|
|
|
|
OnVisibleChange="@OnOverlayTriggerVisibleChange">
|
|
|
|
|
<Overlay>
|
|
|
|
|
<CascadingValue Value="this" IsFixed="@true">
|
|
|
|
|
@if (ShowPanel && !_isOptionsZero)
|
|
|
|
|
{
|
|
|
|
|
<div style="max-height: 256px; overflow-y: auto; overflow-anchor: none; @_minWidth">
|
|
|
|
|
<div style="display: flex;flex-direction: column;">
|
2020-11-02 23:05:17 +08:00
|
|
|
|
|
2021-01-21 17:20:10 +08:00
|
|
|
|
@if (OverlayTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@OverlayTemplate
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@if (OptionTemplate != null)
|
2020-08-26 22:37:08 +08:00
|
|
|
|
{
|
2021-01-21 17:20:10 +08:00
|
|
|
|
@foreach (var option in GetOptionItems())
|
|
|
|
|
{
|
|
|
|
|
@OptionTemplate(option)
|
|
|
|
|
}
|
2020-08-26 22:37:08 +08:00
|
|
|
|
}
|
2020-10-16 13:08:43 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2021-01-21 17:20:10 +08:00
|
|
|
|
@foreach (var option in GetOptionItems())
|
2020-11-02 23:05:17 +08:00
|
|
|
|
{
|
2021-01-21 17:20:10 +08:00
|
|
|
|
var label = OptionFormat == null ? option.Label : OptionFormat(option);
|
|
|
|
|
<AutoCompleteOption Value="@option.Value" Label="@option.Label" Disabled="option.IsDisabled">
|
|
|
|
|
@label
|
|
|
|
|
</AutoCompleteOption>
|
2020-11-02 23:05:17 +08:00
|
|
|
|
}
|
2020-10-16 13:08:43 +08:00
|
|
|
|
}
|
2021-01-21 17:20:10 +08:00
|
|
|
|
}
|
2020-06-27 18:24:21 +08:00
|
|
|
|
</div>
|
2021-01-21 17:20:10 +08:00
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</CascadingValue>
|
|
|
|
|
</Overlay>
|
|
|
|
|
<Unbound>
|
|
|
|
|
<CascadingValue Value="this" IsFixed="@true">
|
2021-08-27 00:44:47 +08:00
|
|
|
|
<CascadingValue Value="context" Name="OverlayTriggerContext">
|
|
|
|
|
@if (ChildContent == null)
|
|
|
|
|
{
|
|
|
|
|
<AutoCompleteInput @bind-Value="@CurrentValue" Placeholder="@Placeholder" Disabled="@Disabled" Style="@Style" Id="@Id" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-08-26 22:37:08 +08:00
|
|
|
|
@ChildContent
|
2021-08-27 00:44:47 +08:00
|
|
|
|
}
|
|
|
|
|
</CascadingValue>
|
2021-01-21 17:20:10 +08:00
|
|
|
|
</CascadingValue>
|
|
|
|
|
</Unbound>
|
|
|
|
|
</OverlayTrigger>
|
|
|
|
|
</CascadingValue>
|