diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index b795e294dd3..6b632e85feb 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.4.9-beta08 + 9.4.9-beta09 diff --git a/src/BootstrapBlazor/Components/Select/Select.razor b/src/BootstrapBlazor/Components/Select/Select.razor index f41bc4f7ff9..2a22b35824f 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor +++ b/src/BootstrapBlazor/Components/Select/Select.razor @@ -48,7 +48,7 @@ } else { - + } } diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.cs b/src/BootstrapBlazor/Components/Select/Select.razor.cs index 8001f578e9e..6d7e87e5176 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor.cs +++ b/src/BootstrapBlazor/Components/Select/Select.razor.cs @@ -144,9 +144,6 @@ public partial class Select : ISelect, ILookup [Parameter] public bool DisableItemChangedWhenFirstRender { get; set; } - [NotNull] - private Virtualize? VirtualizeElement { get; set; } - /// /// Gets or sets the bound data set. /// @@ -247,6 +244,9 @@ public partial class Select : ISelect, ILookup /// protected override string? RetrieveId() => InputId; + [NotNull] + private Virtualize? _virtualizeElement = default; + private string? InputId => $"{Id}_input"; private string _lastSelectedValueString = string.Empty; @@ -409,7 +409,7 @@ private async Task RefreshVirtualizeElement() if (IsVirtualize && OnQueryAsync != null) { // 通过 ItemProvider 提供数据 - await VirtualizeElement.RefreshDataAsync(); + await _virtualizeElement.RefreshDataAsync(); } } @@ -556,7 +556,7 @@ private async Task OnClearValue() if (OnQueryAsync != null) { - await VirtualizeElement.RefreshDataAsync(); + await _virtualizeElement.RefreshDataAsync(); } _lastSelectedValueString = string.Empty; diff --git a/src/BootstrapBlazor/Components/Select/SelectBase.cs b/src/BootstrapBlazor/Components/Select/SelectBase.cs index 467a044add8..c1e20e4a8e3 100644 --- a/src/BootstrapBlazor/Components/Select/SelectBase.cs +++ b/src/BootstrapBlazor/Components/Select/SelectBase.cs @@ -6,99 +6,100 @@ namespace BootstrapBlazor.Components; /// -/// SelectBase 组件基类 +/// SelectBase component base class /// +/// The type of the value. public abstract class SelectBase : PopoverSelectBase { /// - /// 获得/设置 颜色 默认 Color.None 无设置 + /// Gets or sets the color. The default is (no color). /// [Parameter] public Color Color { get; set; } /// - /// 获得/设置 是否显示搜索框 默认为 false 不显示 + /// Gets or sets a value indicating whether to show the search box. The default is false. /// [Parameter] public bool ShowSearch { get; set; } /// - /// 获得/设置 设置搜索图标 + /// Gets or sets the search icon. /// [Parameter] public string? SearchIcon { get; set; } /// - /// 获得/设置 设置正在搜索图标 + /// Gets or sets the search loading icon. /// [Parameter] public string? SearchLoadingIcon { get; set; } /// - /// 获得/设置 搜索框文本 + /// Gets or sets the search text. /// [NotNull] protected string? SearchText { get; set; } /// - /// 获得/设置 无搜索结果时显示文字 + /// Gets or sets the text to display when no search results are found. /// [Parameter] public string? NoSearchDataText { get; set; } /// - /// 获得/设置 右侧下拉箭头图标 默认 fa-solid fa-angle-up + /// Gets or sets the dropdown icon. The default is "fa-solid fa-angle-up". /// [Parameter] [NotNull] public string? DropdownIcon { get; set; } /// - /// 获得/设置 是否为 MarkupString 默认 false + /// Gets or sets a value indicating whether the content is a . The default is false. /// [Parameter] public bool IsMarkupString { get; set; } /// - /// 获得/设置 字符串比较规则 默认 StringComparison.OrdinalIgnoreCase 大小写不敏感 + /// Gets or sets the string comparison rule. The default is . /// [Parameter] public StringComparison StringComparison { get; set; } = StringComparison.OrdinalIgnoreCase; /// - /// 获得/设置 分组项模板 + /// Gets or sets the group item template. /// [Parameter] public RenderFragment? GroupItemTemplate { get; set; } /// - /// 获得/设置 滚动行为 默认 + /// Gets or sets the scroll behavior. The default is . /// [Parameter] public ScrollIntoViewBehavior ScrollIntoViewBehavior { get; set; } = ScrollIntoViewBehavior.Smooth; /// - /// 获得/设置 IIconTheme 服务实例 + /// Gets or sets the service instance. /// [Inject] [NotNull] protected IIconTheme? IconTheme { get; set; } /// - /// 获得 PlaceHolder 属性 + /// Gets or sets the placeholder text. /// [Parameter] public string? PlaceHolder { get; set; } /// - /// 获得 SearchIcon 图标字符串 默认增加 icon 样式 + /// Gets the search icon string with default "icon search-icon" class. /// protected string? SearchIconString => CssBuilder.Default("icon search-icon") .AddClass(SearchIcon) .Build(); /// - /// + /// Gets the custom class string. /// protected override string? CustomClassString => CssBuilder.Default() .AddClass("select", IsPopover) @@ -106,7 +107,7 @@ public abstract class SelectBase : PopoverSelectBase .Build(); /// - /// 获得 样式集合 + /// Gets the append class string. /// protected string? AppendClassString => CssBuilder.Default("form-select-append") .AddClass($"text-{Color.ToDescriptionString()}", Color != Color.None && !IsDisabled && !IsValid.HasValue) @@ -126,14 +127,14 @@ protected override void OnParametersSet() } /// - /// 显示下拉框方法 + /// Shows the dropdown. /// - /// + /// A representing the asynchronous operation. public Task Show() => InvokeVoidAsync("show", Id); /// - /// 关闭下拉框方法 + /// Hides the dropdown. /// - /// + /// A representing the asynchronous operation. public Task Hide() => InvokeVoidAsync("hide", Id); } diff --git a/src/BootstrapBlazor/Components/Select/SelectOption.cs b/src/BootstrapBlazor/Components/Select/SelectOption.cs index 4841fb76b4f..5e4180a1bbc 100644 --- a/src/BootstrapBlazor/Components/Select/SelectOption.cs +++ b/src/BootstrapBlazor/Components/Select/SelectOption.cs @@ -6,48 +6,45 @@ namespace BootstrapBlazor.Components; /// -/// SelectOption 组件 +/// SelectOption component /// public class SelectOption : ComponentBase { /// - /// 获得/设置 显示名称 + /// Gets or sets the display name. /// [Parameter] public string? Text { get; set; } /// - /// 获得/设置 选项值 + /// Gets or sets the option value. /// [Parameter] public string? Value { get; set; } /// - /// 获得/设置 是否选中 默认 false + /// Gets or sets a value indicating whether the option is selected. Default is false. /// [Parameter] public bool Active { get; set; } /// - /// 获得/设置 是否禁用 默认 false + /// Gets or sets a value indicating whether the option is disabled. Default is false. /// [Parameter] public bool IsDisabled { get; set; } /// - /// 获得/设置 分组名称 + /// Gets or sets the group name. /// [Parameter] public string? GroupName { get; set; } - /// - /// 父组件通过级联参数获得 - /// [CascadingParameter] private ISelect? Container { get; set; } /// - /// OnInitialized 方法 + /// /// protected override void OnInitialized() { @@ -56,6 +53,10 @@ protected override void OnInitialized() Container?.Add(ToSelectedItem()); } + /// + /// Converts the current instance to a . + /// + /// A instance. private SelectedItem ToSelectedItem() => new() { Active = Active,