From 75936f85b2b6363beb3fa8b40f71018c4d212968 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 1 Mar 2025 00:42:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=E4=BB=A3=E7=A0=81=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/AutoComplete/AutoComplete.razor.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs index 2833c259eca..e39b44e3e03 100644 --- a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs +++ b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs @@ -126,7 +126,7 @@ private async Task OnClickItem(string val) } } - private List Rows => _filterItems ?? Items.ToList(); + private List Rows => _filterItems ?? [.. Items]; /// /// TriggerFilter 方法 @@ -138,11 +138,11 @@ public override async Task TriggerFilter(string val) if (OnCustomFilter != null) { var items = await OnCustomFilter(val); - _filterItems = items.ToList(); + _filterItems = [.. items]; } else if (string.IsNullOrEmpty(val)) { - _filterItems = Items.ToList(); + _filterItems = [.. Items]; } else { @@ -150,12 +150,12 @@ public override async Task TriggerFilter(string val) var items = IsLikeMatch ? Items.Where(s => s.Contains(val, comparison)) : Items.Where(s => s.StartsWith(val, comparison)); - _filterItems = items.ToList(); + _filterItems = [.. items]; } if (DisplayCount != null) { - _filterItems = _filterItems.Take(DisplayCount.Value).ToList(); + _filterItems = [.. _filterItems.Take(DisplayCount.Value)]; } StateHasChanged(); } From b72729e6c8442f4995b6f8c8097a902def805f46 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 1 Mar 2025 00:54:27 +0800 Subject: [PATCH 2/3] refactor: support Enter/Esc key event --- .../Components/AutoComplete/AutoComplete.razor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js index c544d05f5ad..875d30aeed4 100644 --- a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js +++ b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js @@ -107,7 +107,7 @@ export function init(id, invoke) { const handlerKeyup = (ac, e) => { const key = e.key; - const { el, input, menu } = ac; + const { el, input, invoke, menu } = ac; if (key === 'Enter' || key === 'NumpadEnter') { const skipEnter = el.getAttribute('data-bb-skip-enter') === 'true'; if (!skipEnter) { @@ -116,12 +116,14 @@ const handlerKeyup = (ac, e) => { el.triggerEnter = true; current.click(); } + invoke.invokeMethodAsync('EnterCallback', input.value); } } else if (key === 'Escape') { const skipEsc = el.getAttribute('data-bb-skip-esc') === 'true'; if (skipEsc === false) { EventHandler.trigger(menu, 'click'); + invoke.invokeMethodAsync('EscCallback'); } } else if (key === 'ArrowUp' || key === 'ArrowDown') { From 50cd3ca946d2510c5d6f6ddd9d11e32ef7a2d96b Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 1 Mar 2025 00:54:40 +0800 Subject: [PATCH 3/3] chore: bump version 9.4.3-beta01 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index b420c7850d6..42e81f0df11 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 9.4.2 + 9.4.3-beta01