From e2ff70ed034496b28939fe5e35d55a2ec75aea87 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Tue, 27 Feb 2024 12:51:40 +0800 Subject: [PATCH 1/3] feat(select): add OnInputChangedChallback parameter --- .../Components/Select/Select.razor.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.cs b/src/BootstrapBlazor/Components/Select/Select.razor.cs index d93c442bf89..20c789093f9 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor.cs +++ b/src/BootstrapBlazor/Components/Select/Select.razor.cs @@ -107,6 +107,13 @@ public partial class Select : ISelect [Parameter] public bool IsEditable { get; set; } + /// + /// 获得/设置 选项输入更新后回调方法 默认 null + /// + /// 设置 后生效 + [Parameter] + public Func? OnInputChangedCallback { get; set; } + /// /// 获得/设置 无搜索结果时显示文字 /// @@ -436,7 +443,7 @@ private void OnClearValue() CurrentValue = default; } - private void OnChange(ChangeEventArgs args) + private async Task OnChange(ChangeEventArgs args) { if (args.Value is string v) { @@ -451,6 +458,11 @@ private void OnChange(ChangeEventArgs args) Items = items; } CurrentValueAsString = v; + + if (OnInputChangedCallback != null) + { + await OnInputChangedCallback(v); + } } } } From 886f7f5e2612826a2d26b1cccff056a43cdefd99 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Tue, 27 Feb 2024 13:10:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/SelectTest.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/UnitTest/Components/SelectTest.cs b/test/UnitTest/Components/SelectTest.cs index 3a593fc6a18..05b7bd1b494 100644 --- a/test/UnitTest/Components/SelectTest.cs +++ b/test/UnitTest/Components/SelectTest.cs @@ -817,9 +817,15 @@ public async Task IsEditable_Ok() var input = cut.Find(".form-select"); Assert.True(input.IsReadOnly()); + var updated = false; cut.SetParametersAndRender(pb => { pb.Add(a => a.IsEditable, true); + pb.Add(a => a.OnInputChangedCallback, v => + { + updated = true; + return Task.CompletedTask; + }); }); Assert.False(input.IsReadOnly()); @@ -828,5 +834,6 @@ await cut.InvokeAsync(() => input.Change("Test3"); }); Assert.Equal("Test3", cut.Instance.Value); + Assert.True(updated); } } From 42287e134b11479dc1055fb06841da3da1448a48 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Tue, 27 Feb 2024 13:10:48 +0800 Subject: [PATCH 3/3] chore: bump version 8.2.6-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 7533b66be05..1d6ae9ca8d3 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.2.5 + 8.2.6-beta01