Skip to content

Commit ab74cb4

Browse files
doc(Select): update documentation (#5638)
* refactor: 重构组件变量改用私有字段 * refactor: 文档注释更改英文 * chore: bump version 9.4.9-beta09 Co-Authored-By: trycatchfinnally <[email protected]> --------- Co-authored-by: trycatchfinnally <[email protected]>
1 parent 7ac44fb commit ab74cb4

File tree

5 files changed

+40
-38
lines changed

5 files changed

+40
-38
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.4.9-beta08</Version>
4+
<Version>9.4.9-beta09</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Select/Select.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
}
4949
else
5050
{
51-
<Virtualize ItemSize="RowHeight" OverscanCount="OverscanCount" ItemsProvider="LoadItems" Placeholder="RenderPlaceHolderRow" ItemContent="RenderRow" @ref="VirtualizeElement" />
51+
<Virtualize ItemSize="RowHeight" OverscanCount="OverscanCount" ItemsProvider="LoadItems" Placeholder="RenderPlaceHolderRow" ItemContent="RenderRow" @ref="_virtualizeElement" />
5252
}
5353
</div>
5454
}

src/BootstrapBlazor/Components/Select/Select.razor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ public partial class Select<TValue> : ISelect, ILookup
144144
[Parameter]
145145
public bool DisableItemChangedWhenFirstRender { get; set; }
146146

147-
[NotNull]
148-
private Virtualize<SelectedItem>? VirtualizeElement { get; set; }
149-
150147
/// <summary>
151148
/// Gets or sets the bound data set.
152149
/// </summary>
@@ -247,6 +244,9 @@ public partial class Select<TValue> : ISelect, ILookup
247244
/// </summary>
248245
protected override string? RetrieveId() => InputId;
249246

247+
[NotNull]
248+
private Virtualize<SelectedItem>? _virtualizeElement = default;
249+
250250
private string? InputId => $"{Id}_input";
251251

252252
private string _lastSelectedValueString = string.Empty;
@@ -409,7 +409,7 @@ private async Task RefreshVirtualizeElement()
409409
if (IsVirtualize && OnQueryAsync != null)
410410
{
411411
// 通过 ItemProvider 提供数据
412-
await VirtualizeElement.RefreshDataAsync();
412+
await _virtualizeElement.RefreshDataAsync();
413413
}
414414
}
415415

@@ -556,7 +556,7 @@ private async Task OnClearValue()
556556

557557
if (OnQueryAsync != null)
558558
{
559-
await VirtualizeElement.RefreshDataAsync();
559+
await _virtualizeElement.RefreshDataAsync();
560560
}
561561

562562
_lastSelectedValueString = string.Empty;

src/BootstrapBlazor/Components/Select/SelectBase.cs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,107 +6,108 @@
66
namespace BootstrapBlazor.Components;
77

88
/// <summary>
9-
/// SelectBase 组件基类
9+
/// SelectBase component base class
1010
/// </summary>
11+
/// <typeparam name="TValue">The type of the value.</typeparam>
1112
public abstract class SelectBase<TValue> : PopoverSelectBase<TValue>
1213
{
1314
/// <summary>
14-
/// 获得/设置 颜色 默认 Color.None 无设置
15+
/// Gets or sets the color. The default is <see cref="Color.None"/> (no color).
1516
/// </summary>
1617
[Parameter]
1718
public Color Color { get; set; }
1819

1920
/// <summary>
20-
/// 获得/设置 是否显示搜索框 默认为 false 不显示
21+
/// Gets or sets a value indicating whether to show the search box. The default is <c>false</c>.
2122
/// </summary>
2223
[Parameter]
2324
public bool ShowSearch { get; set; }
2425

2526
/// <summary>
26-
/// 获得/设置 设置搜索图标
27+
/// Gets or sets the search icon.
2728
/// </summary>
2829
[Parameter]
2930
public string? SearchIcon { get; set; }
3031

3132
/// <summary>
32-
/// 获得/设置 设置正在搜索图标
33+
/// Gets or sets the search loading icon.
3334
/// </summary>
3435
[Parameter]
3536
public string? SearchLoadingIcon { get; set; }
3637

3738
/// <summary>
38-
/// 获得/设置 搜索框文本
39+
/// Gets or sets the search text.
3940
/// </summary>
4041
[NotNull]
4142
protected string? SearchText { get; set; }
4243

4344
/// <summary>
44-
/// 获得/设置 无搜索结果时显示文字
45+
/// Gets or sets the text to display when no search results are found.
4546
/// </summary>
4647
[Parameter]
4748
public string? NoSearchDataText { get; set; }
4849

4950
/// <summary>
50-
/// 获得/设置 右侧下拉箭头图标 默认 fa-solid fa-angle-up
51+
/// Gets or sets the dropdown icon. The default is "fa-solid fa-angle-up".
5152
/// </summary>
5253
[Parameter]
5354
[NotNull]
5455
public string? DropdownIcon { get; set; }
5556

5657
/// <summary>
57-
/// 获得/设置 是否为 MarkupString 默认 false
58+
/// Gets or sets a value indicating whether the content is a <see cref="MarkupString"/>. The default is <c>false</c>.
5859
/// </summary>
5960
[Parameter]
6061
public bool IsMarkupString { get; set; }
6162

6263
/// <summary>
63-
/// 获得/设置 字符串比较规则 默认 StringComparison.OrdinalIgnoreCase 大小写不敏感
64+
/// Gets or sets the string comparison rule. The default is <see cref="StringComparison.OrdinalIgnoreCase"/>.
6465
/// </summary>
6566
[Parameter]
6667
public StringComparison StringComparison { get; set; } = StringComparison.OrdinalIgnoreCase;
6768

6869
/// <summary>
69-
/// 获得/设置 分组项模板
70+
/// Gets or sets the group item template.
7071
/// </summary>
7172
[Parameter]
7273
public RenderFragment<string>? GroupItemTemplate { get; set; }
7374

7475
/// <summary>
75-
/// 获得/设置 滚动行为 默认 <see cref="ScrollIntoViewBehavior.Smooth"/>
76+
/// Gets or sets the scroll behavior. The default is <see cref="ScrollIntoViewBehavior.Smooth"/>.
7677
/// </summary>
7778
[Parameter]
7879
public ScrollIntoViewBehavior ScrollIntoViewBehavior { get; set; } = ScrollIntoViewBehavior.Smooth;
7980

8081
/// <summary>
81-
/// 获得/设置 IIconTheme 服务实例
82+
/// Gets or sets the <see cref="IIconTheme"/> service instance.
8283
/// </summary>
8384
[Inject]
8485
[NotNull]
8586
protected IIconTheme? IconTheme { get; set; }
8687

8788
/// <summary>
88-
/// 获得 PlaceHolder 属性
89+
/// Gets or sets the placeholder text.
8990
/// </summary>
9091
[Parameter]
9192
public string? PlaceHolder { get; set; }
9293

9394
/// <summary>
94-
/// 获得 SearchIcon 图标字符串 默认增加 icon 样式
95+
/// Gets the search icon string with default "icon search-icon" class.
9596
/// </summary>
9697
protected string? SearchIconString => CssBuilder.Default("icon search-icon")
9798
.AddClass(SearchIcon)
9899
.Build();
99100

100101
/// <summary>
101-
/// <inheritdoc/>
102+
/// Gets the custom class string.
102103
/// </summary>
103104
protected override string? CustomClassString => CssBuilder.Default()
104105
.AddClass("select", IsPopover)
105106
.AddClass(base.CustomClassString)
106107
.Build();
107108

108109
/// <summary>
109-
/// 获得 样式集合
110+
/// Gets the append class string.
110111
/// </summary>
111112
protected string? AppendClassString => CssBuilder.Default("form-select-append")
112113
.AddClass($"text-{Color.ToDescriptionString()}", Color != Color.None && !IsDisabled && !IsValid.HasValue)
@@ -126,14 +127,14 @@ protected override void OnParametersSet()
126127
}
127128

128129
/// <summary>
129-
/// 显示下拉框方法
130+
/// Shows the dropdown.
130131
/// </summary>
131-
/// <returns></returns>
132+
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
132133
public Task Show() => InvokeVoidAsync("show", Id);
133134

134135
/// <summary>
135-
/// 关闭下拉框方法
136+
/// Hides the dropdown.
136137
/// </summary>
137-
/// <returns></returns>
138+
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
138139
public Task Hide() => InvokeVoidAsync("hide", Id);
139140
}

src/BootstrapBlazor/Components/Select/SelectOption.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,45 @@
66
namespace BootstrapBlazor.Components;
77

88
/// <summary>
9-
/// SelectOption 组件
9+
/// SelectOption component
1010
/// </summary>
1111
public class SelectOption : ComponentBase
1212
{
1313
/// <summary>
14-
/// 获得/设置 显示名称
14+
/// Gets or sets the display name.
1515
/// </summary>
1616
[Parameter]
1717
public string? Text { get; set; }
1818

1919
/// <summary>
20-
/// 获得/设置 选项值
20+
/// Gets or sets the option value.
2121
/// </summary>
2222
[Parameter]
2323
public string? Value { get; set; }
2424

2525
/// <summary>
26-
/// 获得/设置 是否选中 默认 false
26+
/// Gets or sets a value indicating whether the option is selected. Default is <c>false</c>.
2727
/// </summary>
2828
[Parameter]
2929
public bool Active { get; set; }
3030

3131
/// <summary>
32-
/// 获得/设置 是否禁用 默认 false
32+
/// Gets or sets a value indicating whether the option is disabled. Default is <c>false</c>.
3333
/// </summary>
3434
[Parameter]
3535
public bool IsDisabled { get; set; }
3636

3737
/// <summary>
38-
/// 获得/设置 分组名称
38+
/// Gets or sets the group name.
3939
/// </summary>
4040
[Parameter]
4141
public string? GroupName { get; set; }
4242

43-
/// <summary>
44-
/// 父组件通过级联参数获得
45-
/// </summary>
4643
[CascadingParameter]
4744
private ISelect? Container { get; set; }
4845

4946
/// <summary>
50-
/// OnInitialized 方法
47+
/// <inheritdoc/>
5148
/// </summary>
5249
protected override void OnInitialized()
5350
{
@@ -56,6 +53,10 @@ protected override void OnInitialized()
5653
Container?.Add(ToSelectedItem());
5754
}
5855

56+
/// <summary>
57+
/// Converts the current instance to a <see cref="SelectedItem"/>.
58+
/// </summary>
59+
/// <returns>A <see cref="SelectedItem"/> instance.</returns>
5960
private SelectedItem ToSelectedItem() => new()
6061
{
6162
Active = Active,

0 commit comments

Comments
 (0)