From 850aca274a127ca356e8208eac6b238ff8ab5338 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 23 Feb 2025 11:19:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Extensions/ObjectExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Extensions/ObjectExtensions.cs b/src/BootstrapBlazor/Extensions/ObjectExtensions.cs index f5271bf5fd4..d86bc9e4762 100644 --- a/src/BootstrapBlazor/Extensions/ObjectExtensions.cs +++ b/src/BootstrapBlazor/Extensions/ObjectExtensions.cs @@ -185,13 +185,13 @@ public static bool TryConvertTo(this string? source, [MaybeNullWhen(fals } else if (source == string.Empty) { - ret = BindConverter.TryConvertTo(source, CultureInfo.CurrentCulture, out val); + ret = BindConverter.TryConvertTo(source, CultureInfo.CurrentCulture, out val); } else { var isBoolean = type == typeof(bool); var v = isBoolean ? (object)source.Equals("true", StringComparison.CurrentCultureIgnoreCase) : source; - ret = BindConverter.TryConvertTo(v, CultureInfo.CurrentCulture, out val); + ret = BindConverter.TryConvertTo(v, CultureInfo.CurrentCulture, out val); } } catch From 7168d1563f76d13570388fd1ad52509664991345 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 23 Feb 2025 11:19:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9=20Enum=20Value?= =?UTF-8?q?=20=E6=95=B0=E5=AD=97=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Select/Select.razor.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.cs b/src/BootstrapBlazor/Components/Select/Select.razor.cs index b64311d2f70..4eb459cacb1 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor.cs +++ b/src/BootstrapBlazor/Components/Select/Select.razor.cs @@ -294,7 +294,8 @@ private SelectedItem? SelectedRow private SelectedItem? GetSelectedRow() { - var item = Rows.Find(i => i.Value == CurrentValueAsString) + var item = GetItemWidthEnumValue() + ?? Rows.Find(i => i.Value == CurrentValueAsString) ?? Rows.Find(i => i.Active) ?? Rows.FirstOrDefault(i => !i.IsDisabled) ?? GetVirtualizeItem(CurrentValueAsString); @@ -314,6 +315,10 @@ private SelectedItem? SelectedRow return item; } + private SelectedItem? GetItemWidthEnumValue() => ValueType.IsEnum + ? Rows.Find(i => i.Value == Convert.ToInt32(Value).ToString()) + : null; + private List GetRowsByItems() { var items = new List(); @@ -328,7 +333,7 @@ private List GetRowsByItems() private List GetRowsBySearch() { var items = OnSearchTextChanged?.Invoke(SearchText) ?? FilterBySearchText(GetRowsByItems()); - return items.ToList(); + return [.. items]; } private IEnumerable FilterBySearchText(IEnumerable source) => string.IsNullOrEmpty(SearchText) From 52ad5b872c9cac87227839803ab66e3a46f24b63 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 23 Feb 2025 11:24:40 +0800 Subject: [PATCH 3/3] chore: bump version 9.3.1-beta33 --- 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 ecd08152c9f..96cbdeff417 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 9.3.1-beta32 + 9.3.1-beta33