@using AntDesign
@namespace AntDesign.Select.Internal
@typeparam TItemValue
@typeparam TItem
@{
bool showPrefixAsSeparate = false;
bool showPrefixInSelected = false;
if (ParentSelect.PrefixIcon != null)
{
showPrefixAsSeparate = ParentSelect.PrefixIcon != null && !(ParentSelect.SelectMode != SelectMode.Default && ParentSelect.SelectedOptionItems.Any());
showPrefixInSelected = !showPrefixAsSeparate;
}
}
@if (showPrefixAsSeparate)
{
@ParentSelect.PrefixIcon
}
@if (ShowPlaceholder)
{
@if (showPrefixAsSeparate)
{
@Placeholder
}
else
{
@Placeholder
}
}
else
{
@if (ParentSelect.SelectMode == SelectMode.Default)
{
var selectedItem = ParentSelect.SelectedOptionItems.FirstOrDefault();
//Console.WriteLine($"({ParentSelect.Id}): {selectedItem.Value} => {selectedItem.Label}");
if (string.IsNullOrEmpty(SearchValue) && selectedItem != null)
{
@if (ParentLabelTemplate != null)
{
@ParentLabelTemplate(selectedItem.Item)
}
else
{
@selectedItem.Label
}
}
}
else
{
var selectedItems = ParentSelect.SelectedOptionItems;
@if (showPrefixInSelected)
{
@ParentSelect.PrefixIcon
}
@foreach (var selectedOption in selectedItems)
{
@if (ParentLabelTemplate != null)
{
@ParentLabelTemplate(selectedOption.Item)
}
else
{
@selectedOption.Label
OnRemoveSelected.InvokeAsync(selectedOption)" @onclick:stopPropagation="true">
}
}
}
}
@if (ParentSelect.SelectMode != SelectMode.Default)
{
}
@if (ParentSelect.SelectMode == SelectMode.Default)
{
if (ParentSelect.SuffixIcon != null)
{
@ParentSelect.SuffixIcon
}
else if (ParentSelect.Loading)
{
}
else
{
if (ShowArrowIcon)
{
@if (ParentSelect.IsSearchEnabled && IsOverlayShow)
{
if (ShowSearchIcon)
{
}
}
else
{
}
}
else
{
@if (ParentSelect.IsSearchEnabled && IsOverlayShow)
{
if (ShowSearchIcon)
{
}
}
}
@if (!ParentSelect.Disabled && ParentSelect.AllowClear && ParentSelect.HasValue)
{
}
}
}
else
{
@if (ParentSelect.SuffixIcon != null)
{
@ParentSelect.SuffixIcon
}
@if (!ParentSelect.Disabled && ParentSelect.AllowClear && ParentSelect.HasValue)
{
}
}