33// See the LICENSE file in the project root for more information.
44// Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 55
6- using Microsoft . AspNetCore . Components ;
76using Microsoft . AspNetCore . Components . Web . Virtualization ;
87using Microsoft . Extensions . Localization ;
9- using System . ComponentModel . DataAnnotations ;
108
119namespace BootstrapBlazor . Components ;
1210
@@ -57,10 +55,6 @@ public partial class SelectGeneric<TValue> : ISelectGeneric<TValue>, IModelEqual
5755 . AddClass ( "disabled" , item . IsDisabled )
5856 . Build ( ) ;
5957
60- private string ? SearchClassString => CssBuilder . Default ( "search" )
61- . AddClass ( "is-fixed" , IsFixedSearch )
62- . Build ( ) ;
63-
6458 private readonly List < SelectedItem < TValue > > _children = [ ] ;
6559
6660 /// <summary>
@@ -76,12 +70,6 @@ public partial class SelectGeneric<TValue> : ISelectGeneric<TValue>, IModelEqual
7670 [ Parameter ]
7771 public Func < string , IEnumerable < SelectedItem < TValue > > > ? OnSearchTextChanged { get ; set ; }
7872
79- /// <summary>
80- /// 获得/设置 是否固定下拉框中的搜索栏 默认 false
81- /// </summary>
82- [ Parameter ]
83- public bool IsFixedSearch { get ; set ; }
84-
8573 /// <summary>
8674 /// 获得/设置 是否可编辑 默认 false
8775 /// </summary>
@@ -121,7 +109,7 @@ public partial class SelectGeneric<TValue> : ISelectGeneric<TValue>, IModelEqual
121109 public RenderFragment < SelectedItem < TValue > ? > ? DisplayTemplate { get ; set ; }
122110
123111 /// <summary>
124- /// 获得/设置 是否开启虚拟滚动 默认 false 未开启 注意:开启虚拟滚动后不支持 <see cref="SelectBase{TValue}.ShowSearch"/> <see cref="PopoverSelectBase{TValue}.IsPopover"/> <seealso cref="IsFixedSearch"/> 参数设置,设置初始值时请设置 <see cref="DefaultVirtualizeItemText"/>
112+ /// 获得/设置 是否开启虚拟滚动 默认 false 未开启
125113 /// </summary>
126114 [ Parameter ]
127115 public bool IsVirtualize { get ; set ; }
@@ -312,7 +300,7 @@ private List<SelectedItem<TValue>> GetRowsByItems()
312300 private List < SelectedItem < TValue > > GetRowsBySearch ( )
313301 {
314302 var items = OnSearchTextChanged ? . Invoke ( SearchText ) ?? FilterBySearchText ( GetRowsByItems ( ) ) ;
315- return items . ToList ( ) ;
303+ return [ .. items ] ;
316304 }
317305
318306 private IEnumerable < SelectedItem < TValue > > FilterBySearchText ( IEnumerable < SelectedItem < TValue > > source ) => string . IsNullOrEmpty ( SearchText )
@@ -363,7 +351,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
363351 /// </summary>
364352 private int TotalCount { get ; set ; }
365353
366- private List < SelectedItem < TValue > > GetVirtualItems ( ) => FilterBySearchText ( GetRowsByItems ( ) ) . ToList ( ) ;
354+ private List < SelectedItem < TValue > > GetVirtualItems ( ) => [ .. FilterBySearchText ( GetRowsByItems ( ) ) ] ;
367355
368356 /// <summary>
369357 /// 虚拟滚动数据加载回调方法
0 commit comments