88namespace BootstrapBlazor . Components ;
99
1010/// <summary>
11- /// AutoComplete 组件
11+ /// AutoComplete component
1212/// </summary>
1313public partial class AutoComplete
1414{
1515 /// <summary>
16- /// 获得 组件样式
16+ /// Gets the component style
1717 /// </summary>
1818 private string ? ClassString => CssBuilder . Default ( "auto-complete" )
1919 . AddClassFromAttributes ( AdditionalAttributes )
2020 . Build ( ) ;
2121
2222 /// <summary>
23- /// 获得/设置 通过输入字符串获得匹配数据集合
23+ /// Gets or sets the collection of matching data obtained by inputting a string
2424 /// </summary>
2525 [ Parameter ]
2626 [ NotNull ]
2727 public IEnumerable < string > ? Items { get ; set ; }
2828
2929 /// <summary>
30- /// 获得/设置 自定义集合过滤规则 默认 null
30+ /// Gets or sets custom collection filtering rules, default is null
3131 /// </summary>
3232 [ Parameter ]
3333 public Func < string , Task < IEnumerable < string > > > ? OnCustomFilter { get ; set ; }
3434
3535 /// <summary>
36- /// 获得/设置 图标
36+ /// Gets or sets the icon
3737 /// </summary>
3838 [ Parameter ]
3939 public string ? Icon { get ; set ; }
4040
4141 /// <summary>
42- /// 获得/设置 加载图标
42+ /// Gets or sets the loading icon
4343 /// </summary>
4444 [ Parameter ]
4545 public string ? LoadingIcon { get ; set ; }
4646
4747 /// <summary>
48- /// 获得/设置 匹配数据时显示的数量
48+ /// Gets or sets the number of items to display when matching data
4949 /// </summary>
5050 [ Parameter ]
5151 [ NotNull ]
5252 public int ? DisplayCount { get ; set ; }
5353
5454 /// <summary>
55- /// 获得/设置 是否开启模糊查询,默认为 false
55+ /// Gets or sets whether to enable fuzzy search, default is false
5656 /// </summary>
5757 [ Parameter ]
5858 public bool IsLikeMatch { get ; set ; }
5959
6060 /// <summary>
61- /// 获得/设置 匹配时是否忽略大小写,默认为 true
61+ /// Gets or sets whether to ignore case when matching, default is true
6262 /// </summary>
6363 [ Parameter ]
6464 public bool IgnoreCase { get ; set ; } = true ;
6565
6666 /// <summary>
67- /// 获得/设置 获得焦点时是否展开下拉候选菜单 默认 true
67+ /// Gets or sets whether to expand the dropdown candidate menu when focused, default is true
6868 /// </summary>
6969 [ Parameter ]
7070 public bool ShowDropdownListOnFocus { get ; set ; } = true ;
7171
7272 /// <summary>
73- /// 获得/设置 是否显示无匹配数据选项 默认 true 显示
73+ /// Gets or sets whether to show the no matching data option, default is true
7474 /// </summary>
7575 [ Parameter ]
7676 public bool ShowNoDataTip { get ; set ; } = true ;
7777
7878 /// <summary>
79- /// IStringLocalizer 服务实例
79+ /// IStringLocalizer service instance
8080 /// </summary>
8181 [ Inject ]
8282 [ NotNull ]
8383 private IStringLocalizer < AutoComplete > ? Localizer { get ; set ; }
8484
8585 /// <summary>
86- /// 获得 获得焦点自动显示下拉框设置字符串
86+ /// Gets the string setting for automatically displaying the dropdown when focused
8787 /// </summary>
8888 private string ? ShowDropdownListOnFocusString => ShowDropdownListOnFocus ? "true" : null ;
8989
@@ -115,7 +115,7 @@ protected override void OnParametersSet()
115115 }
116116
117117 /// <summary>
118- /// 鼠标点击候选项时回调此方法
118+ /// Callback method when a candidate item is clicked
119119 /// </summary>
120120 private async Task OnClickItem ( string val )
121121 {
@@ -129,15 +129,15 @@ private async Task OnClickItem(string val)
129129 private List < string > Rows => _filterItems ?? [ .. Items ] ;
130130
131131 /// <summary>
132- /// TriggerFilter 方法
132+ /// TriggerFilter method
133133 /// </summary>
134134 /// <param name="val"></param>
135135 [ JSInvokable ]
136136 public override async Task TriggerFilter ( string val )
137137 {
138138 // Store the current input value to prevent it from being overwritten
139139 var currentInputValue = val ;
140-
140+
141141 if ( OnCustomFilter != null )
142142 {
143143 var items = await OnCustomFilter ( val ) ;
@@ -155,15 +155,15 @@ public override async Task TriggerFilter(string val)
155155 : Items . Where ( s => s . StartsWith ( val , comparison ) ) ;
156156 _filterItems = [ .. items ] ;
157157 }
158-
158+
159159 if ( DisplayCount != null )
160160 {
161161 _filterItems = [ .. _filterItems . Take ( DisplayCount . Value ) ] ;
162162 }
163-
163+
164164 // Use currentInputValue here instead of potentially stale val
165165 CurrentValue = currentInputValue ;
166-
166+
167167 // Only trigger StateHasChanged if no binding is present
168168 if ( ! ValueChanged . HasDelegate )
169169 {
@@ -172,7 +172,7 @@ public override async Task TriggerFilter(string val)
172172 }
173173
174174 /// <summary>
175- /// TriggerChange 方法
175+ /// TriggerChange method
176176 /// </summary>
177177 /// <param name="val"></param>
178178 [ JSInvokable ]
0 commit comments