Add game header #5
@@ -3,16 +3,17 @@
|
|||||||
@typeparam TItem
|
@typeparam TItem
|
||||||
|
|
||||||
<div class="select-list">
|
<div class="select-list">
|
||||||
<div class="select-button" @onfocusin=HandleFocusIn>
|
<div class="select-button" @onfocusin=HandleFocusIn @onfocusout=HandleFocusOut>
|
||||||
<SearchInput @ref=SearchInput
|
<SearchInput @ref=SearchInput
|
||||||
Icon="SearchInputIcon.Dropdown"
|
Icon="SearchInputIcon.Dropdown"
|
||||||
TextChanged="HandleTextChanged"
|
TextChanged="HandleTextChanged"
|
||||||
ClearClicked="HandleTextChanged"
|
ClearClicked="HandleTextChanged"
|
||||||
SearchClicked="Toggle" />
|
SearchClicked="HandleSearchClicked" />
|
||||||
</div>
|
</div>
|
||||||
<div @onfocusout=HandleFocusOut
|
<div class="select-container @(AlignRight ? "align-right" : "")"
|
||||||
class="select-container @(AlignRight ? "align-right" : "")"
|
tabindex="1000"
|
||||||
tabindex="1000">
|
@onfocusin=HandleContentFocusIn
|
||||||
|
@onfocusout=HandleContentFocusOut>
|
||||||
|
|
||||||
@if (ContentVisile)
|
@if (ContentVisile)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,14 +14,24 @@ public partial class MultipleSelectList<TItem>
|
|||||||
|
|
||||||
private bool ContentVisile = false;
|
private bool ContentVisile = false;
|
||||||
private SearchInput? SearchInput;
|
private SearchInput? SearchInput;
|
||||||
|
private bool ShouldClose = false;
|
||||||
|
|
||||||
public void Open() => ContentVisile = true;
|
public void Open() => ContentVisile = true;
|
||||||
|
|
||||||
public void Close() => ContentVisile = false;
|
public async Task Close()
|
||||||
|
{
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(0.2));
|
||||||
|
|
||||||
|
if (ShouldClose)
|
||||||
|
{
|
||||||
|
ContentVisile = false;
|
||||||
|
ShouldClose = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Toggle() => ContentVisile = !ContentVisile;
|
public void Toggle() => ContentVisile = !ContentVisile;
|
||||||
|
|
||||||
private void HandleFocusOut() => Close();
|
private async Task HandleFocusOut() => await Close();
|
||||||
|
|
||||||
private void HandleFocusIn() => Open();
|
private void HandleFocusIn() => Open();
|
||||||
|
|
||||||
@@ -33,13 +43,31 @@ public partial class MultipleSelectList<TItem>
|
|||||||
await ValuesChanged.InvokeAsync(Values);
|
await ValuesChanged.InvokeAsync(Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleTextChanged()
|
private async Task HandleTextChanged()
|
||||||
{
|
{
|
||||||
foreach (var item in Items)
|
foreach (var item in Items)
|
||||||
{
|
{
|
||||||
item.IsSelected = false;
|
item.IsSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Close();
|
await Close();
|
||||||
|
}
|
||||||
|
private void HandleContentFocusOut(Microsoft.AspNetCore.Components.Web.FocusEventArgs args)
|
||||||
|
{
|
||||||
|
ShouldClose = true;
|
||||||
|
ContentVisile = false;
|
||||||
|
}
|
||||||
|
private void HandleContentFocusIn(Microsoft.AspNetCore.Components.Web.FocusEventArgs args)
|
||||||
|
{
|
||||||
|
ShouldClose = true;
|
||||||
|
}
|
||||||
|
private void HandleSearchClicked()
|
||||||
|
{
|
||||||
|
if (ContentVisile)
|
||||||
|
{
|
||||||
|
ShouldClose = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentVisile = !ContentVisile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user