Skip to content

Commit 7ac44fb

Browse files
feat(IEditorItem): add IsFixedSearchWhenSelect parameter (#5636)
* refactor: 增加 IsFixedSearchWhenSelect 参数 * doc: 文档翻译 * refactor: 增加 IsFixedSearchWhenSelect 参数支持 * test: 更新单元测试 * chore: bump version 9.4.9-beta08 Co-Authored-By: BBFish <[email protected]> --------- Co-authored-by: BBFish <[email protected]>
1 parent d8336a6 commit 7ac44fb

File tree

17 files changed

+162
-73
lines changed

17 files changed

+162
-73
lines changed

src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu
230230
/// </summary>
231231
public bool ShowSearchWhenSelect { get; set; }
232232

233+
/// <summary>
234+
/// <inheritdoc/>
235+
/// </summary>
236+
public bool IsFixedSearchWhenSelect { get; set; }
237+
233238
/// <summary>
234239
/// <inheritdoc/>
235240
/// </summary>

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-beta07</Version>
4+
<Version>9.4.9-beta08</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/EditorForm/EditorItem.cs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
namespace BootstrapBlazor.Components;
1010

1111
/// <summary>
12-
/// EditorItem 组件
12+
/// EditorItem component
1313
/// </summary>
14-
/// <remarks>用于 EditorForm 的 FieldItems 模板内</remarks>
1514
public class EditorItem<TModel, TValue> : ComponentBase, IEditorItem
1615
{
1716
/// <summary>
@@ -27,7 +26,7 @@ public class EditorItem<TModel, TValue> : ComponentBase, IEditorItem
2726
public EventCallback<TValue> FieldChanged { get; set; }
2827

2928
/// <summary>
30-
/// 获得/设置 绑定列类型
29+
/// <inheritdoc/>
3130
/// </summary>
3231
[NotNull]
3332
public Type? PropertyType { get; set; }
@@ -71,19 +70,19 @@ public class EditorItem<TModel, TValue> : ComponentBase, IEditorItem
7170
public string? RequiredErrorMessage { get; set; }
7271

7372
/// <summary>
74-
/// 获得/设置 是否不进行验证 默认为 false
73+
/// <inheritdoc/>
7574
/// </summary>
7675
[Parameter]
7776
public bool SkipValidate { get; set; }
7877

7978
/// <summary>
80-
/// 获得/设置 是否显示标签 Tooltip 多用于标签文字过长导致裁减时使用 默认 null
79+
/// <inheritdoc/>
8180
/// </summary>
8281
[Parameter]
8382
public bool? ShowLabelTooltip { get; set; }
8483

8584
/// <summary>
86-
/// 获得/设置 表头显示文字
85+
/// <inheritdoc/>
8786
/// </summary>
8887
[Parameter]
8988
public string? Text { get; set; }
@@ -95,13 +94,13 @@ public class EditorItem<TModel, TValue> : ComponentBase, IEditorItem
9594
public string? Step { get; set; }
9695

9796
/// <summary>
98-
/// 获得/设置 Textarea行数
97+
/// <inheritdoc/>
9998
/// </summary>
10099
[Parameter]
101100
public int Rows { get; set; }
102101

103102
/// <summary>
104-
/// 获得/设置 编辑模板
103+
/// <inheritdoc/>
105104
/// </summary>
106105
[Parameter]
107106
public RenderFragment<TModel>? EditTemplate { get; set; }
@@ -121,47 +120,53 @@ public class EditorItem<TModel, TValue> : ComponentBase, IEditorItem
121120
}
122121

123122
/// <summary>
124-
/// 获得/设置 组件类型 默认为 null
123+
/// <inheritdoc/>
125124
/// </summary>
126125
[Parameter]
127126
public Type? ComponentType { get; set; }
128127

129128
/// <summary>
130-
/// 获得/设置 组件自定义类型参数集合 默认为 null
129+
/// <inheritdoc/>
131130
/// </summary>
132131
[Parameter]
133132
public IEnumerable<KeyValuePair<string, object>>? ComponentParameters { get; set; }
134133

135134
/// <summary>
136-
/// 获得/设置 placeholder 文本 默认为 null
135+
/// <inheritdoc/>
137136
/// </summary>
138137
[Parameter]
139138
public string? PlaceHolder { get; set; }
140139

141140
/// <summary>
142-
/// 获得/设置 显示顺序
141+
/// <inheritdoc/>
143142
/// </summary>
144143
[Parameter]
145144
public int Order { get; set; }
146145

147146
/// <summary>
148-
/// 获得/设置 额外数据源一般用于下拉框或者 CheckboxList 这种需要额外配置数据源组件使用
147+
/// <inheritdoc/>
149148
/// </summary>
150149
[Parameter]
151150
public IEnumerable<SelectedItem>? Items { get; set; }
152151

153152
/// <summary>
154-
/// 获得/设置 字典数据源 常用于外键自动转换为名称操作
153+
/// <inheritdoc/>
155154
/// </summary>
156155
[Parameter]
157156
public IEnumerable<SelectedItem>? Lookup { get; set; }
158157

159158
/// <summary>
160-
/// 获得/设置 字段数据源下拉框是否显示搜索栏 默认 false 不显示
159+
/// <inheritdoc/>
161160
/// </summary>
162161
[Parameter]
163162
public bool ShowSearchWhenSelect { get; set; }
164163

164+
/// <summary>
165+
/// <inheritdoc/>
166+
/// </summary>
167+
[Parameter]
168+
public bool IsFixedSearchWhenSelect { get; set; }
169+
165170
/// <summary>
166171
/// <inheritdoc/>
167172
/// </summary>
@@ -193,32 +198,28 @@ public class EditorItem<TModel, TValue> : ComponentBase, IEditorItem
193198
public ILookupService? LookupService { get; set; }
194199

195200
/// <summary>
196-
/// 获得/设置 自定义验证集合
201+
/// <inheritdoc/>
197202
/// </summary>
198203
[Parameter]
199204
public List<IValidator>? ValidateRules { get; set; }
200205

201-
/// <summary>
202-
/// 获得/设置 IEditorItem 集合实例
203-
/// </summary>
204-
/// <remarks>EditorForm 组件级联传参下来的值</remarks>
205206
[CascadingParameter]
206207
private List<IEditorItem>? EditorItems { get; set; }
207208

208209
/// <summary>
209-
/// 获得/设置 当前属性分组
210+
/// <inheritdoc/>
210211
/// </summary>
211212
[Parameter]
212213
public string? GroupName { get; set; }
213214

214215
/// <summary>
215-
/// 获得/设置 当前属性分组排序 默认 0
216+
/// <inheritdoc/>
216217
/// </summary>
217218
[Parameter]
218219
public int GroupOrder { get; set; }
219220

220221
/// <summary>
221-
/// OnInitialized 方法
222+
/// <inheritdoc/>
222223
/// </summary>
223224
protected override void OnInitialized()
224225
{
@@ -235,13 +236,14 @@ protected override void OnInitialized()
235236
}
236237

237238
private FieldIdentifier? _fieldIdentifier;
239+
238240
/// <summary>
239-
/// 获取绑定字段显示名称方法
241+
/// Gets the display name for the field.
240242
/// </summary>
241243
public virtual string GetDisplayName() => Text ?? _fieldIdentifier?.GetDisplayName() ?? string.Empty;
242244

243245
/// <summary>
244-
/// 获取绑定字段信息方法
246+
/// Gets the field name for the field.
245247
/// </summary>
246248
public string GetFieldName() => _fieldIdentifier?.FieldName ?? string.Empty;
247249
}

src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public interface IEditorItem : ILookup
8686
/// </summary>
8787
bool ShowSearchWhenSelect { get; set; }
8888

89+
/// <summary>
90+
/// Gets or sets whether to allow fixed search box within dropdown. Default is false.
91+
/// </summary>
92+
bool IsFixedSearchWhenSelect { get; set; }
93+
8994
/// <summary>
9095
/// Gets or sets whether to use Popover to render the dropdown list. Default is false.
9196
/// </summary>

src/BootstrapBlazor/Components/Filters/LookupFilter.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
{
66
if (IsHeaderRow)
77
{
8-
<Select Items="@Items" StringComparison="LookupStringComparison" @bind-Value="@Value" OnSelectedItemChanged="_ => OnFilterValueChanged()" IsPopover="true" ShowSearch="IsShowSearch"></Select>
8+
<Select Items="@Items" StringComparison="LookupStringComparison" @bind-Value="@Value" OnSelectedItemChanged="_ => OnFilterValueChanged()" IsPopover="true" ShowSearch="IsShowSearch" IsFixedSearch="IsFixedSearch"></Select>
99
}
1010
else
1111
{
12-
<Select Items="@Items" StringComparison="LookupStringComparison" @bind-Value="@Value" ShowSearch="IsShowSearch" ></Select>
12+
<Select Items="@Items" StringComparison="LookupStringComparison" @bind-Value="@Value" ShowSearch="IsShowSearch" IsFixedSearch="IsFixedSearch" ></Select>
1313
}
1414
}

src/BootstrapBlazor/Components/Filters/LookupFilter.razor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public partial class LookupFilter : ILookup
5858
[Parameter]
5959
public bool IsShowSearch { get; set; }
6060

61+
/// <summary>
62+
/// 获得 是否为 ShowSearch 呈现模式 默认为 false
63+
/// </summary>
64+
[Parameter]
65+
public bool IsFixedSearch { get; set; }
66+
6167
[Inject]
6268
[NotNull]
6369
private IStringLocalizer<TableFilter>? Localizer { get; set; }

src/BootstrapBlazor/Components/Filters/TableFilter.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ else
4646
}
4747
else if (Column.IsLookup())
4848
{
49-
<LookupFilter Lookup="Column.Lookup" LookupService="Column.LookupService" LookupServiceKey="@Column.LookupServiceKey" LookupServiceData="Column.LookupServiceData" LookupStringComparison="Column.LookupStringComparison" Type="Column.PropertyType" IsShowSearch="Column.ShowSearchWhenSelect"></LookupFilter>
49+
<LookupFilter Lookup="Column.Lookup" LookupService="Column.LookupService" LookupServiceKey="@Column.LookupServiceKey" LookupServiceData="Column.LookupServiceData" LookupStringComparison="Column.LookupStringComparison" Type="Column.PropertyType" IsShowSearch="Column.ShowSearchWhenSelect" IsFixedSearch="Column.IsFixedSearchWhenSelect"></LookupFilter>
5050
}
5151
else
5252
{

0 commit comments

Comments
 (0)