Skip to content

Commit 1200ca4

Browse files
committed
refactor: 移动 DropdownMenuClassString 到基类
1 parent ff5b881 commit 1200ca4

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,9 @@ public partial class MultiSelect<TValue>
4040
.AddClass("d-none", SelectedItems.Count != 0)
4141
.Build();
4242

43-
/// <summary>
44-
/// 获得 SearchLoadingIcon 图标字符串
45-
/// </summary>
4643
private string? SearchLoadingIconString => CssBuilder.Default("icon searching-icon")
4744
.AddClass(SearchLoadingIcon)
4845
.Build();
49-
private string? DropdownMenuClassString => CssBuilder.Default("dropdown-menu")
50-
.AddClass("is-fixed-search", ShowSearch && IsFixedSearch)
51-
.Build();
5246

5347
/// <summary>
5448
/// 获得/设置 绑定数据集

src/BootstrapBlazor/Components/Select/Select.razor.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ public partial class Select<TValue> : ISelect, ILookup
4747
.AddClass(SearchLoadingIcon)
4848
.Build();
4949

50-
private string? DropdownMenuClassString => CssBuilder.Default("dropdown-menu")
51-
.AddClass("is-fixed-search", ShowSearch && IsFixedSearch)
52-
.Build();
53-
5450
private readonly List<SelectedItem> _children = [];
5551

5652
private string? ScrollIntoViewBehaviorString => ScrollIntoViewBehavior == ScrollIntoViewBehavior.Smooth ? null : ScrollIntoViewBehavior.ToDescriptionString();
@@ -100,7 +96,7 @@ public partial class Select<TValue> : ISelect, ILookup
10096
public RenderFragment<SelectedItem?>? DisplayTemplate { get; set; }
10197

10298
/// <summary>
103-
/// Gets or sets whether virtual scrolling is enabled. Default is false. Note: When virtual scrolling is enabled, <see cref="SelectBase{TValue}.ShowSearch"/>, <see cref="PopoverSelectBase{TValue}.IsPopover"/>, and <seealso cref="IsFixedSearch"/> are not supported. Set <see cref="DefaultVirtualizeItemText"/> when setting initial values.
99+
/// Gets or sets whether virtual scrolling is enabled. Default is false.
104100
/// </summary>
105101
[Parameter]
106102
public bool IsVirtualize { get; set; }

src/BootstrapBlazor/Components/Select/SelectBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ public abstract class SelectBase<TValue> : PopoverSelectBase<TValue>
121121
.AddClass($"text-danger", IsValid.HasValue && !IsValid.Value)
122122
.Build();
123123

124+
/// <summary>
125+
/// Gets the dropdown menu class string.
126+
/// </summary>
127+
protected string? DropdownMenuClassString => CssBuilder.Default("dropdown-menu")
128+
.AddClass("is-fixed-search", ShowSearch && IsFixedSearch)
129+
.Build();
130+
124131
/// <summary>
125132
/// <inheritdoc/>
126133
/// </summary>

0 commit comments

Comments
 (0)