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"
|
|
|
|
|
OverlayEnterCls="slide-up-enter slide-up-enter-active slide-up"
|
|
|
|
|
OverlayLeaveCls="slide-up-leave slide-up-leave-active slide-up"
|
|
|
|
|
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">
|
|
|
|
|
@if (ChildContent == null)
|
|
|
|
|
{
|
|
|
|
|
<AutoCompleteInput RefBack="context" @bind-Value="@CurrentValue" Placeholder="@Placeholder" Disabled="@Disabled" Style="@Style" Id="@Id" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<CascadingValue Value="context" Name="OverlayTriggerContext">
|
2020-08-26 22:37:08 +08:00
|
|
|
|
@ChildContent
|
2021-01-21 17:20:10 +08:00
|
|
|
|
</CascadingValue>
|
|
|
|
|
}
|
|
|
|
|
</CascadingValue>
|
|
|
|
|
</Unbound>
|
|
|
|
|
</OverlayTrigger>
|
|
|
|
|
</CascadingValue>
|