Skip to content

Commit 1477777

Browse files
committed
feat: 增加 Loading 图标
1 parent 38714bf commit 1477777

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

src/BootstrapBlazor/Components/Select/Select.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<div class="@SearchClassString">
3535
<input type="text" class="search-text form-control" autocomplete="off" value="@SearchText" aria-label="Search">
3636
<i class="@SearchIconString"></i>
37+
<i class="@SearchLoadingIconString"></i>
3738
</div>
3839
@if (IsVirtualize)
3940
{

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public partial class Select<TValue> : ISelect, ILookup
5959
.AddClass("is-fixed", IsFixedSearch)
6060
.Build();
6161

62+
/// <summary>
63+
/// 获得 SearchLoadingIcon 图标字符串
64+
/// </summary>
65+
private string? SearchLoadingIconString => CssBuilder.Default("icon searching-icon")
66+
.AddClass(SearchLoadingIcon)
67+
.Build();
68+
6269
private readonly List<SelectedItem> _children = [];
6370

6471
/// <summary>

src/BootstrapBlazor/Components/Select/Select.razor.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@
216216
&:not(.show) {
217217
display: none;
218218
}
219+
220+
&.l {
221+
.search-icon {
222+
display: none;
223+
}
224+
225+
.searching-icon {
226+
display: block;
227+
}
228+
}
229+
230+
.searching-icon {
231+
display: none;
232+
}
219233
}
220234

221235
.dropdown-menu .search.is-fixed {

src/BootstrapBlazor/Components/Select/SelectBase.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public abstract class SelectBase<TValue> : PopoverSelectBase<TValue>
2828
[Parameter]
2929
public string? SearchIcon { get; set; }
3030

31+
/// <summary>
32+
/// 获得/设置 设置正在搜索图标
33+
/// </summary>
34+
[Parameter]
35+
public string? SearchLoadingIcon { get; set; }
36+
3137
/// <summary>
3238
/// 获得/设置 右侧下拉箭头图标 默认 fa-solid fa-angle-up
3339
/// </summary>
@@ -69,7 +75,7 @@ public abstract class SelectBase<TValue> : PopoverSelectBase<TValue>
6975
/// <summary>
7076
/// 获得 SearchIcon 图标字符串 默认增加 icon 样式
7177
/// </summary>
72-
protected string? SearchIconString => CssBuilder.Default("icon")
78+
protected string? SearchIconString => CssBuilder.Default("icon search-icon")
7379
.AddClass(SearchIcon)
7480
.Build();
7581

@@ -98,6 +104,7 @@ protected override void OnParametersSet()
98104
base.OnParametersSet();
99105

100106
SearchIcon ??= IconTheme.GetIconByKey(ComponentIcons.SelectSearchIcon);
107+
SearchLoadingIcon ??= IconTheme.GetIconByKey(ComponentIcons.SearchButtonLoadingIcon);
101108
}
102109

103110
/// <summary>

0 commit comments

Comments
 (0)