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
|
|
|
|
|
2020-08-26 22:37:08 +08:00
|
|
|
|
<div @ref="@_divRef" style="@Style" id="@Id">
|
|
|
|
|
<CascadingValue Value='$"ant-select-dropdown"' Name="PrefixCls">
|
2020-11-13 00:22:41 +08:00
|
|
|
|
<OverlayTrigger @ref="_overlayTrigger"
|
|
|
|
|
Style="display: inline"
|
2020-08-26 22:37:08 +08:00
|
|
|
|
IsButton="@true"
|
|
|
|
|
Disabled="false"
|
|
|
|
|
Trigger="new TriggerType[] { TriggerType.Click }"
|
2020-09-17 10:37:47 +08:00
|
|
|
|
PopupContainerSelector="@PopupContainerSelector"
|
2020-08-26 22:37:08 +08:00
|
|
|
|
OverlayEnterCls="slide-up-enter slide-up-enter-active slide-up"
|
|
|
|
|
OverlayLeaveCls="slide-up-leave slide-up-leave-active slide-up"
|
|
|
|
|
OverlayClassName="@OverlayClassName"
|
2020-09-27 23:05:23 +08:00
|
|
|
|
OverlayStyle="@OverlayStyle"
|
|
|
|
|
OnVisibleChange="@OnOverlayTriggerVisibleChange">
|
2020-08-26 22:37:08 +08:00
|
|
|
|
<Overlay>
|
|
|
|
|
<CascadingValue Value="this">
|
2020-11-13 00:22:41 +08:00
|
|
|
|
@if (ShowPanel && !_isOptionsZero)
|
2020-10-16 13:08:43 +08:00
|
|
|
|
{
|
|
|
|
|
<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
|
|
|
|
|
|
|
|
|
@if (OverlayTemplate != null)
|
2020-08-26 22:37:08 +08:00
|
|
|
|
{
|
2020-11-02 23:05:17 +08:00
|
|
|
|
@OverlayTemplate
|
2020-08-26 22:37:08 +08:00
|
|
|
|
}
|
2020-10-16 13:08:43 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-02 23:05:17 +08:00
|
|
|
|
@if (OptionTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@foreach (var option in GetOptionItems())
|
|
|
|
|
{
|
|
|
|
|
@OptionTemplate(option)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@foreach (var option in GetOptionItems())
|
|
|
|
|
{
|
|
|
|
|
var label = OptionFormat == null ? option.Label : OptionFormat(option);
|
|
|
|
|
<AutoCompleteOption Value="@option.Value" Label="@option.Label" Disabled="option.IsDisabled">
|
|
|
|
|
@label
|
|
|
|
|
</AutoCompleteOption>
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-16 13:08:43 +08:00
|
|
|
|
}
|
|
|
|
|
</div>
|
2020-06-27 18:24:21 +08:00
|
|
|
|
</div>
|
2020-10-16 13:08:43 +08:00
|
|
|
|
}
|
2020-08-26 22:37:08 +08:00
|
|
|
|
</CascadingValue>
|
|
|
|
|
</Overlay>
|
|
|
|
|
<ChildContent>
|
|
|
|
|
<CascadingValue Value="this">
|
|
|
|
|
@if (ChildContent == null)
|
|
|
|
|
{
|
2020-10-16 13:08:43 +08:00
|
|
|
|
<AutoCompleteInput @bind-Value="@CurrentValue" Placeholder="@Placeholder" Disabled="@Disabled" />
|
2020-08-26 22:37:08 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ChildContent
|
|
|
|
|
}
|
|
|
|
|
</CascadingValue>
|
|
|
|
|
</ChildContent>
|
|
|
|
|
</OverlayTrigger>
|
|
|
|
|
</CascadingValue>
|
2020-07-16 13:00:23 +08:00
|
|
|
|
</div>
|