From 751bc91b3819bce2a7da3008e37cd7e6d6ef827c Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 6 Feb 2025 00:13:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E9=98=B2=E6=8A=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/AutoComplete/AutoComplete.razor.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js index 8734f49db3a..4feca07aaa3 100644 --- a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js +++ b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js @@ -58,15 +58,23 @@ export function init(id, invoke) { invoke.invokeMethodAsync('TriggerChange', e.target.value); }); - Input.composition(input, async v => { + let filterDuration = duration; + if (filterDuration === 0) { + filterDuration = 200; + } + const filterCallback = debounce(async v => { + await invoke.invokeMethodAsync('TriggerFilter', v); + el.classList.remove('is-loading'); + }, filterDuration); + + Input.composition(input, v => { const useInput = input.getAttribute('data-bb-input') !== 'false'; if (isPopover === false && useInput) { el.classList.add('show'); } el.classList.add('is-loading'); - await invoke.invokeMethodAsync('TriggerFilter', v); - el.classList.remove('is-loading'); + filterCallback(v); }); if (window.BootstrapBlazor.AutoComplete === void 0) { From f4b161a5edd971ebe2b794ba311a863b0962fed2 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 6 Feb 2025 00:13:21 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=98=B2?= =?UTF-8?q?=E6=8A=96=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Search/Search.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Search/Search.razor b/src/BootstrapBlazor/Components/Search/Search.razor index bfa7c74f82f..38049461d0f 100644 --- a/src/BootstrapBlazor/Components/Search/Search.razor +++ b/src/BootstrapBlazor/Components/Search/Search.razor @@ -25,7 +25,7 @@ Date: Thu, 6 Feb 2025 00:13:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E9=98=B2=E6=8A=96?= =?UTF-8?q?=20200=20=E6=AF=AB=E7=A7=92=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Components/Samples/Searches.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Searches.razor b/src/BootstrapBlazor.Server/Components/Samples/Searches.razor index 43f89c4eb7b..913d2338af5 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Searches.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Searches.razor @@ -186,7 +186,7 @@ private async Task OnClickClear()
From 0e26d5eabc440e175625c53b2e722bd128f8ff49 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 6 Feb 2025 00:16:14 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=98=B2?= =?UTF-8?q?=E6=8A=96=E9=BB=98=E8=AE=A4=E5=80=BC=20200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Search/Search.razor.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BootstrapBlazor/Components/Search/Search.razor.cs b/src/BootstrapBlazor/Components/Search/Search.razor.cs index 062ec8d3ca2..1e466edf07e 100644 --- a/src/BootstrapBlazor/Components/Search/Search.razor.cs +++ b/src/BootstrapBlazor/Components/Search/Search.razor.cs @@ -198,6 +198,11 @@ protected override void OnParametersSet() ButtonIcon ??= SearchButtonIcon; NoDataTip ??= Localizer[nameof(NoDataTip)]; _filterItems ??= []; + + if (Debounce == 0) + { + Debounce = 200; + } } private string _displayText = "";