@@ -57,90 +57,90 @@ public partial class Select<TValue> : ISelect, ILookup
5757 private string ? ScrollIntoViewBehaviorString => ScrollIntoViewBehavior == ScrollIntoViewBehavior . Smooth ? null : ScrollIntoViewBehavior . ToDescriptionString ( ) ;
5858
5959 /// <summary>
60- /// 获得/设置 右侧清除图标 默认 fa-solid fa-angle-up
60+ /// Gets or sets the right-side clear icon. Default is fa-solid fa-angle-up.
6161 /// </summary>
6262 [ Parameter ]
6363 [ NotNull ]
6464 public string ? ClearIcon { get ; set ; }
6565
6666 /// <summary>
67- /// 获得/设置 搜索文本发生变化时回调此方法
67+ /// Gets or sets the callback method when the search text changes.
6868 /// </summary>
6969 [ Parameter ]
7070 public Func < string , IEnumerable < SelectedItem > > ? OnSearchTextChanged { get ; set ; }
7171
7272 /// <summary>
73- /// 获得/设置 是否固定下拉框中的搜索栏 默认 false
73+ /// Gets or sets whether the search bar in the dropdown is fixed. Default is false.
7474 /// </summary>
7575 [ Parameter ]
7676 public bool IsFixedSearch { get ; set ; }
7777
7878 /// <summary>
79- /// 获得/设置 是否可编辑 默认 false
79+ /// Gets or sets whether the select component is editable. Default is false.
8080 /// </summary>
8181 [ Parameter ]
8282 public bool IsEditable { get ; set ; }
8383
8484 /// <summary>
85- /// 获得/设置 选项输入更新后回调方法 默认 null
85+ /// Gets or sets the callback method when the input value changes. Default is null.
8686 /// </summary>
87- /// <remarks>设置 <see cref="IsEditable"/> 后生效 </remarks>
87+ /// <remarks>Effective when <see cref="IsEditable"/> is set. </remarks>
8888 [ Parameter ]
8989 public Func < string , Task > ? OnInputChangedCallback { get ; set ; }
9090
9191 /// <summary>
92- /// 获得/设置 是否可清除 默认 false
92+ /// Gets or sets whether the select component is clearable. Default is false.
9393 /// </summary>
9494 [ Parameter ]
9595 public bool IsClearable { get ; set ; }
9696
9797 /// <summary>
98- /// 获得/设置 选项模板支持静态数据
98+ /// Gets or sets the options template for static data.
9999 /// </summary>
100100 [ Parameter ]
101101 public RenderFragment ? Options { get ; set ; }
102102
103103 /// <summary>
104- /// 获得/设置 显示部分模板 默认 null
104+ /// Gets or sets the display template. Default is null.
105105 /// </summary>
106106 [ Parameter ]
107107 public RenderFragment < SelectedItem ? > ? DisplayTemplate { get ; set ; }
108108
109109 /// <summary>
110- /// 获得/设置 是否开启虚拟滚动 默认 false 未开启 注意:开启虚拟滚动后不支持 <see cref="SelectBase{TValue}.ShowSearch"/> <see cref="PopoverSelectBase{TValue}.IsPopover"/> <seealso cref="IsFixedSearch"/> 参数设置,设置初始值时请设置 <see cref="DefaultVirtualizeItemText"/>
110+ /// 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.
111111 /// </summary>
112112 [ Parameter ]
113113 public bool IsVirtualize { get ; set ; }
114114
115115 /// <summary>
116- /// 获得/设置 虚拟滚动行高 默认为 33
116+ /// Gets or sets the row height for virtual scrolling. Default is 33.
117117 /// </summary>
118- /// <remarks>需要设置 <see cref="IsVirtualize"/> 值为 true 时生效 </remarks>
118+ /// <remarks>Effective when <see cref="IsVirtualize"/> is set to true. </remarks>
119119 [ Parameter ]
120120 public float RowHeight { get ; set ; } = 33f ;
121121
122122 /// <summary>
123- /// 获得/设置 过载阈值数 默认为 4
123+ /// Gets or sets the overscan count for virtual scrolling. Default is 4.
124124 /// </summary>
125- /// <remarks>需要设置 <see cref="IsVirtualize"/> 值为 true 时生效 </remarks>
125+ /// <remarks>Effective when <see cref="IsVirtualize"/> is set to true. </remarks>
126126 [ Parameter ]
127127 public int OverscanCount { get ; set ; } = 4 ;
128128
129129 /// <summary>
130- /// 获得/设置 默认文本 <see cref="IsVirtualize"/> 时生效 默认 null
130+ /// Gets or sets the default text for virtualized items. Default is null.
131131 /// </summary>
132- /// <remarks>开启 <see cref="IsVirtualize"/> 并且通过 <see cref="OnQueryAsync"/> 提供数据源时,由于渲染时还未调用或者调用后数据集未包含 <see cref="DisplayBase{TValue}.Value"/> 选项值,此时使用 DefaultText 值渲染 </remarks>
132+ /// <remarks>Effective when <see cref="IsVirtualize"/> is enabled and data source is provided via <see cref="OnQueryAsync"/>. If the data set does not contain the <see cref="DisplayBase{TValue}.Value"/> option value during rendering, the DefaultText value is used. </remarks>
133133 [ Parameter ]
134134 public string ? DefaultVirtualizeItemText { get ; set ; }
135135
136136 /// <summary>
137- /// 获得/设置 清除文本内容 OnClear 回调方法 默认 null
137+ /// Gets or sets the callback method when the clear button is clicked. Default is null.
138138 /// </summary>
139139 [ Parameter ]
140140 public Func < Task > ? OnClearAsync { get ; set ; }
141141
142142 /// <summary>
143- /// 获得/设置 禁止首次加载时触发 OnSelectedItemChanged 回调方法 默认 false
143+ /// Gets or sets whether to disable the OnSelectedItemChanged callback method on first render. Default is false.
144144 /// </summary>
145145 [ Parameter ]
146146 public bool DisableItemChangedWhenFirstRender { get ; set ; }
@@ -149,50 +149,50 @@ public partial class Select<TValue> : ISelect, ILookup
149149 private Virtualize < SelectedItem > ? VirtualizeElement { get ; set ; }
150150
151151 /// <summary>
152- /// 获得/设置 绑定数据集
152+ /// Gets or sets the bound data set.
153153 /// </summary>
154154 [ Parameter ]
155155 [ NotNull ]
156156 public IEnumerable < SelectedItem > ? Items { get ; set ; }
157157
158158 /// <summary>
159- /// 获得/设置 选项模板
159+ /// Gets or sets the item template.
160160 /// </summary>
161161 [ Parameter ]
162162 public RenderFragment < SelectedItem > ? ItemTemplate { get ; set ; }
163163
164164 /// <summary>
165- /// 获得/设置 下拉框项目改变前回调委托方法 返回 true 时选项值改变,否则选项值不变
165+ /// Gets or sets the callback method before the selected item changes. Returns true to change the selected item value; otherwise, the selected item value does not change.
166166 /// </summary>
167167 [ Parameter ]
168168 public Func < SelectedItem , Task < bool > > ? OnBeforeSelectedItemChange { get ; set ; }
169169
170170 /// <summary>
171- /// SelectedItemChanged 回调方法
171+ /// Gets or sets the callback method when the selected item changes.
172172 /// </summary>
173173 [ Parameter ]
174174 public Func < SelectedItem , Task > ? OnSelectedItemChanged { get ; set ; }
175175
176176 /// <summary>
177- /// 获得/设置 Swal 图标 默认 Question
177+ /// Gets or sets the Swal category. Default is Question.
178178 /// </summary>
179179 [ Parameter ]
180180 public SwalCategory SwalCategory { get ; set ; } = SwalCategory . Question ;
181181
182182 /// <summary>
183- /// 获得/设置 Swal 标题 默认 null
183+ /// Gets or sets the Swal title. Default is null.
184184 /// </summary>
185185 [ Parameter ]
186186 public string ? SwalTitle { get ; set ; }
187187
188188 /// <summary>
189- /// 获得/设置 Swal 内容 默认 null
189+ /// Gets or sets the Swal content. Default is null.
190190 /// </summary>
191191 [ Parameter ]
192192 public string ? SwalContent { get ; set ; }
193193
194194 /// <summary>
195- /// 获得/设置 Footer 默认 null
195+ /// Gets or sets the Swal footer. Default is null.
196196 /// </summary>
197197 [ Parameter ]
198198 public string ? SwalFooter { get ; set ; }
@@ -215,6 +215,13 @@ public partial class Select<TValue> : ISelect, ILookup
215215 [ Parameter ]
216216 public object ? LookupServiceData { get ; set ; }
217217
218+ /// <summary>
219+ /// Gets or sets the callback method for loading virtualized items.
220+ /// </summary>
221+ [ Parameter ]
222+ [ NotNull ]
223+ public Func < VirtualizeQueryOption , Task < QueryData < SelectedItem > > > ? OnQueryAsync { get ; set ; }
224+
218225 /// <summary>
219226 /// <inheritdoc/>
220227 /// </summary>
@@ -230,21 +237,17 @@ public partial class Select<TValue> : ISelect, ILookup
230237 private IStringLocalizer < Select < TValue > > ? Localizer { get ; set ; }
231238
232239 /// <summary>
233- /// 获得/设置 <see cref="ILookupService"/> 服务实例
240+ /// Gets or sets the injected lookup service instance.
234241 /// </summary>
235242 [ Inject ]
236243 [ NotNull ]
237244 private ILookupService ? InjectLookupService { get ; set ; }
238245
239246 /// <summary>
240- /// 获得 input 组件 Id 方法
247+ /// <inheritdoc/>
241248 /// </summary>
242- /// <returns></returns>
243249 protected override string ? RetrieveId ( ) => InputId ;
244250
245- /// <summary>
246- /// 获得/设置 Select 内部 Input 组件 Id
247- /// </summary>
248251 private string ? InputId => $ "{ Id } _input";
249252
250253 private string _lastSelectedValueString = string . Empty ;
@@ -255,9 +258,6 @@ public partial class Select<TValue> : ISelect, ILookup
255258
256259 private ItemsProviderResult < SelectedItem > _result ;
257260
258- /// <summary>
259- /// 当前选择项实例
260- /// </summary>
261261 private SelectedItem ? SelectedItem { get ; set ; }
262262
263263 private List < SelectedItem > Rows
@@ -383,13 +383,6 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
383383
384384 private List < SelectedItem > GetVirtualItems ( ) => [ .. FilterBySearchText ( GetRowsByItems ( ) ) ] ;
385385
386- /// <summary>
387- /// 虚拟滚动数据加载回调方法
388- /// </summary>
389- [ Parameter ]
390- [ NotNull ]
391- public Func < VirtualizeQueryOption , Task < QueryData < SelectedItem > > > ? OnQueryAsync { get ; set ; }
392-
393386 private async ValueTask < ItemsProviderResult < SelectedItem > > LoadItems ( ItemsProviderRequest request )
394387 {
395388 // 有搜索条件时使用原生请求数量
@@ -456,14 +449,13 @@ private bool TryParseSelectItem(string value, [MaybeNullWhen(false)] out TValue
456449 /// <summary>
457450 /// <inheritdoc/>
458451 /// </summary>
459- /// <returns></returns>
460452 protected override Task InvokeInitAsync ( ) => InvokeVoidAsync ( "init" , Id , Interop , new { ConfirmMethodCallback = nameof ( ConfirmSelectedItem ) , SearchMethodCallback = nameof ( TriggerOnSearch ) } ) ;
461453
462454 /// <summary>
463- /// 客户端回车回调方法
455+ /// Confirms the selected item.
464456 /// </summary>
465- /// <param name="index"></param>
466- /// <returns></returns>
457+ /// <param name="index">The index of the selected item. </param>
458+ /// <returns>A task that represents the asynchronous operation. </returns>
467459 [ JSInvokable ]
468460 public async Task ConfirmSelectedItem ( int index )
469461 {
@@ -475,17 +467,22 @@ public async Task ConfirmSelectedItem(int index)
475467 }
476468
477469 /// <summary>
478- /// 客户端搜索栏回调方法
470+ /// Triggers the search callback method.
479471 /// </summary>
480- /// <param name="searchText"></param>
481- /// <returns></returns>
472+ /// <param name="searchText">The search text. </param>
473+ /// <returns>A task that represents the asynchronous operation. </returns>
482474 [ JSInvokable ]
483475 public async Task TriggerOnSearch ( string searchText )
484476 {
485477 await SearchTextChanged ( searchText ) ;
486478 StateHasChanged ( ) ;
487479 }
488480
481+ /// <summary>
482+ /// Handles the click event for a dropdown item.
483+ /// </summary>
484+ /// <param name="item">The selected item.</param>
485+ /// <returns>A task that represents the asynchronous operation.</returns>
489486 private async Task OnClickItem ( SelectedItem item )
490487 {
491488 var ret = true ;
@@ -494,7 +491,7 @@ private async Task OnClickItem(SelectedItem item)
494491 ret = await OnBeforeSelectedItemChange ( item ) ;
495492 if ( ret )
496493 {
497- // 返回 True 弹窗提示
494+ // Return true to show modal
498495 var option = new SwalOption ( )
499496 {
500497 Category = SwalCategory ,
@@ -510,7 +507,7 @@ private async Task OnClickItem(SelectedItem item)
510507 }
511508 else
512509 {
513- // 返回 False 直接运行
510+ // Return false to proceed
514511 ret = true ;
515512 }
516513 }
@@ -540,11 +537,10 @@ private async Task SelectedItemChanged(SelectedItem item)
540537 /// <summary>
541538 /// <inheritdoc/>
542539 /// </summary>
543- /// <param name="item"></param>
544540 public void Add ( SelectedItem item ) => _children . Add ( item ) ;
545541
546542 /// <summary>
547- /// 清空搜索栏文本内容
543+ /// Clears the search text.
548544 /// </summary>
549545 public void ClearSearchText ( ) => SearchText = null ;
550546
0 commit comments