diff --git a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs index 76a6d0dfe60..1a671a8d13f 100644 --- a/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs +++ b/src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs @@ -135,6 +135,8 @@ private async Task OnClickItem(string val) { await OnBlurAsync(Value); } + + await TriggerFilter(val); } private List Rows => _filterItems ?? [.. Items]; diff --git a/src/BootstrapBlazor/Components/AutoFill/AutoFill.razor.cs b/src/BootstrapBlazor/Components/AutoFill/AutoFill.razor.cs index 28a7b744910..a9a4c43a2ec 100644 --- a/src/BootstrapBlazor/Components/AutoFill/AutoFill.razor.cs +++ b/src/BootstrapBlazor/Components/AutoFill/AutoFill.razor.cs @@ -232,6 +232,8 @@ private async Task OnClickItem(TValue val) { await OnBlurAsync(Value); } + + await TriggerFilter(_displayText!); } private string? GetDisplayText(TValue item) => OnGetDisplayText?.Invoke(item) ?? item?.ToString(); diff --git a/src/BootstrapBlazor/Components/Search/Search.razor.cs b/src/BootstrapBlazor/Components/Search/Search.razor.cs index cbb91e79851..f12f326fb85 100644 --- a/src/BootstrapBlazor/Components/Search/Search.razor.cs +++ b/src/BootstrapBlazor/Components/Search/Search.razor.cs @@ -8,142 +8,142 @@ namespace BootstrapBlazor.Components; /// -/// Search 组件 +/// Search component /// public partial class Search { /// - /// 获得/设置 图标模板 默认 null 未设置 + /// Gets or sets the icon template. Default is null if not set. /// [Parameter] public RenderFragment>? IconTemplate { get; set; } /// - /// 获得/设置 是否显示清空小按钮 默认 false + /// Gets or sets whether to show the clear button. Default is false. /// [Parameter] public bool IsClearable { get; set; } /// - /// 获得/设置 清空图标 默认为 null + /// Gets or sets the clear icon. Default is null. /// [Parameter] public string? ClearIcon { get; set; } /// - /// 获得/设置 是否显示清除按钮 默认为 false 不显示 + /// Gets or sets whether to show the clear button. Default is false. /// [Parameter] public bool ShowClearButton { get; set; } /// - /// Clear button icon + /// Gets or sets the icon of clear button. Default is null. /// [Parameter] public string? ClearButtonIcon { get; set; } /// - /// Clear button text + /// Gets or sets the text of clear button. Default is null. /// [Parameter] public string? ClearButtonText { get; set; } /// - /// Clear button color + /// Gets or sets the color of clear button. Default is . /// [Parameter] public Color ClearButtonColor { get; set; } = Color.Primary; /// - /// 获得/设置 是否显示搜索按钮 默认为 true 显示 + /// Gets or sets whether to show the search button. Default is true. /// [Parameter] public bool ShowSearchButton { get; set; } = true; /// - /// 获得/设置 搜索按钮颜色 + /// Gets or sets the search button color. Default is . /// [Parameter] public Color SearchButtonColor { get; set; } = Color.Primary; /// - /// 获得/设置 搜索按钮图标 + /// Gets or sets the search button icon. Default is null. /// [Parameter] public string? SearchButtonIcon { get; set; } /// - /// 获得/设置 正在搜索按钮图标 + /// Gets or sets the loading icon for the search button. Default is null. /// [Parameter] public string? SearchButtonLoadingIcon { get; set; } /// - /// 获得/设置 搜索按钮文字 + /// Gets or sets the search button text. Default is null. /// [Parameter] [NotNull] public string? SearchButtonText { get; set; } /// - /// 获得/设置 按钮模板 默认 null 未设置 + /// Gets or sets the button template. Default is null. /// [Parameter] public RenderFragment>? ButtonTemplate { get; set; } /// - /// 获得/设置 前置按钮模板 默认 null 未设置 + /// Gets or sets the prefix button template. Default is null. /// [Parameter] public RenderFragment>? PrefixButtonTemplate { get; set; } /// - /// 获得/设置 是否显示前缀图标 默认为 false 不显示 + /// Gets or sets whether to show the prefix icon. Default is false. /// [Parameter] public bool ShowPrefixIcon { get; set; } /// - /// 获得/设置 前缀图标 默认为 null + /// Gets or sets the prefix icon. Default is null. /// [Parameter] public string? PrefixIcon { get; set; } /// - /// 获得/设置 前缀图标模板 默认为 null + /// Gets or sets the prefix icon template. Default is null. /// [Parameter] public RenderFragment>? PrefixIconTemplate { get; set; } /// - /// 获得/设置 点击搜索后是否自动清空搜索框 + /// Gets or sets whether to automatically clear the search box after searching. Deprecated. /// [Parameter] - [Obsolete("已弃用,删除即可; Deprecated. Just delete it")] + [Obsolete("Deprecated. Just delete it.")] [ExcludeFromCodeCoverage] public bool IsAutoClearAfterSearch { get; set; } /// - /// 获得/设置 搜索模式是否为输入即触发 默认 true 值为 false 时需要点击搜索按钮触发 + /// Gets or sets whether the search is triggered by input. Default is true. If false, the search button must be clicked to trigger. /// [Parameter] public bool IsTriggerSearchByInput { get; set; } = true; /// - /// 获得/设置 点击搜索按钮时回调委托 + /// Gets or sets the callback delegate when the search button is clicked. /// [Parameter] public Func>>? OnSearch { get; set; } /// - /// 获得/设置 通过模型获得显示文本方法 默认使用 ToString 重载方法 + /// Gets or sets the callback method to get display text. Default is null, using ToString() method. /// [Parameter] [NotNull] public Func? OnGetDisplayText { get; set; } /// - /// 获得/设置 点击清空按钮时回调委托 + /// Gets or sets the event callback when the clear button is clicked. Default is null. /// [Parameter] public Func? OnClear { get; set; } @@ -163,9 +163,6 @@ public partial class Search [NotNull] private string? ButtonIcon { get; set; } - /// - /// 获得/设置 UI 呈现数据集合 - /// [NotNull] private List? _filterItems = null; @@ -210,10 +207,6 @@ protected override void OnParametersSet() } private string _displayText = ""; - /// - /// 点击搜索按钮时触发此方法 - /// - /// private async Task OnSearchClick() { if (OnSearch != null) @@ -232,10 +225,6 @@ private async Task OnSearchClick() } } - /// - /// 点击搜索按钮时触发此方法 - /// - /// private async Task OnClearClick() { if (OnClear != null) @@ -256,9 +245,6 @@ private async Task OnClearClick() return displayText; } - /// - /// 鼠标点击候选项时回调此方法 - /// private async Task OnClickItem(TValue val) { CurrentValue = val;