feat: support clearing the searching text
All checks were successful
Caddy Manager CI build / docker (push) Successful in 1m15s
All checks were successful
Caddy Manager CI build / docker (push) Successful in 1m15s
This commit is contained in:
@@ -21,7 +21,8 @@
|
|||||||
<MudSpacer />
|
<MudSpacer />
|
||||||
<MudTextField T="string" Placeholder="Search..." Adornment="Adornment.End" DebounceInterval="500"
|
<MudTextField T="string" Placeholder="Search..." Adornment="Adornment.End" DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="HandleIntervalElapsed" @bind-Value="_debouncedText"
|
OnDebounceIntervalElapsed="HandleIntervalElapsed" @bind-Value="_debouncedText"
|
||||||
AdornmentIcon="@Icons.Material.Filled.Search"/>
|
AdornmentIcon="@(string.IsNullOrWhiteSpace(_debouncedText) ? Icons.Material.Filled.Search : Icons.Material.Filled.Close)"
|
||||||
|
OnAdornmentClick="HandleSearchBarAdornmentClick" />
|
||||||
</MudContainer>
|
</MudContainer>
|
||||||
<MudList T="string" Style="padding-top: 16px;" SelectionMode="SelectionMode.MultiSelection"
|
<MudList T="string" Style="padding-top: 16px;" SelectionMode="SelectionMode.MultiSelection"
|
||||||
@bind-SelectedValues="_selectedCaddyConfigurations">
|
@bind-SelectedValues="_selectedCaddyConfigurations">
|
||||||
|
|||||||
@@ -144,4 +144,18 @@ public partial class CaddyReverseProxiesPage : ComponentBase
|
|||||||
// Simply refresh the page with the new debounced text
|
// Simply refresh the page with the new debounced text
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle the click event for the search bar adornment. If the debounced text is empty, then simply refresh
|
||||||
|
/// to have the search be effective, otherwise, clear the debounced text to reset the search.
|
||||||
|
/// </summary>
|
||||||
|
private void HandleSearchBarAdornmentClick()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(_debouncedText))
|
||||||
|
{
|
||||||
|
_debouncedText = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user