diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index f16614e9a0d..8282d81085d 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 10.3.2 + 10.3.3-beta01 diff --git a/src/BootstrapBlazor/Components/Select/SelectTable.razor b/src/BootstrapBlazor/Components/Select/SelectTable.razor index 2030f8ac355..1f0029a5499 100644 --- a/src/BootstrapBlazor/Components/Select/SelectTable.razor +++ b/src/BootstrapBlazor/Components/Select/SelectTable.razor @@ -80,6 +80,9 @@ IsPagination="IsPagination" PageItemsSource="PageItemsSource" ShowGotoNavigator="false" MaxPageLinkCount="3" OnClickRowCallback="OnClickRowCallback" OnQueryAsync="OnQueryAsync" IsMultipleSelect="IsMultipleSelect" @bind-SelectedRows="SelectedItems" + ShowToolbar="ShowToolbar" ToolbarTemplate="ToolbarTemplate" + TableExtensionToolbarTemplate="TableExtensionToolbarTemplate" + ShowDefaultButtons="false" ShowRefresh="false" ShowEmpty="ShowEmpty" EmptyTemplate="EmptyTemplate"> diff --git a/src/BootstrapBlazor/Components/Select/SelectTable.razor.cs b/src/BootstrapBlazor/Components/Select/SelectTable.razor.cs index f7f976dd469..dd924d2c5ea 100644 --- a/src/BootstrapBlazor/Components/Select/SelectTable.razor.cs +++ b/src/BootstrapBlazor/Components/Select/SelectTable.razor.cs @@ -88,8 +88,8 @@ namespace BootstrapBlazor.Components; public bool ShowAppendArrow { get; set; } = true; /// - /// 获得/设置 弹窗表格最小宽度 默认为 null 未设置使用样式中的默认值 - /// Gets or sets Dropdown Table Min Width. Default null (use style default) + /// 获得/设置 弹窗表格最小宽度 默认为 null 未设置使用样式中的默认值 602px + /// Gets or sets Dropdown Table Min Width. Default null (use style default 602px) /// [Parameter] public int? TableMinWidth { get; set; } @@ -139,6 +139,27 @@ namespace BootstrapBlazor.Components; [Parameter] public string? MultiSelectedItemMaxWidth { get; set; } + /// + /// 获得/设置 是否显示工具栏 默认 false 不显示 + /// Gets or sets Whether to show toolbar. Default false + /// + [Parameter] + public bool ShowToolbar { get; set; } + + /// + /// 获得/设置 表格 Toolbar 工具栏模板 + /// Gets or sets the table toolbar template, content appears center of toolbar + /// + [Parameter] + public RenderFragment? ToolbarTemplate { get; set; } + + /// + /// 获得/设置 表格 Toolbar 工具栏右侧按钮模板,模板中内容出现在默认按钮后面 + /// Gets or sets the table toolbar right-side button template, content appears after the default buttons + /// + [Parameter] + public RenderFragment? TableExtensionToolbarTemplate { get; set; } + /// /// 获得/设置 IIconTheme 服务实例 /// Gets or sets IIconTheme Service Instance diff --git a/src/BootstrapBlazor/Components/Select/SelectTable.razor.js b/src/BootstrapBlazor/Components/Select/SelectTable.razor.js index ea17546e99f..b9e20d337d0 100644 --- a/src/BootstrapBlazor/Components/Select/SelectTable.razor.js +++ b/src/BootstrapBlazor/Components/Select/SelectTable.razor.js @@ -10,7 +10,7 @@ export function init(id, invoke) { } const setWidth = () => { - const minWidth = parseFloat(el.dataset.bbMinWidth || '580'); + const minWidth = parseFloat(el.dataset.bbMinWidth || '602'); let width = getWidth(el); if (width < minWidth) { width = minWidth; diff --git a/test/UnitTest/Components/SelectTableTest.cs b/test/UnitTest/Components/SelectTableTest.cs index 5b42b65cf33..c39ab0c4127 100644 --- a/test/UnitTest/Components/SelectTableTest.cs +++ b/test/UnitTest/Components/SelectTableTest.cs @@ -686,6 +686,59 @@ public async Task IsMultipleSelect_Ok() cut.Contains("multi-select-item-ph"); } + [Fact] + public void ToolbarTemplate_Ok() + { + var localizer = Context.Services.GetRequiredService>(); + var items = Foo.GenerateFoo(localizer); + var cut = Context.Render(pb => + { + pb.AddChildContent>(pb => + { + pb.Add(a => a.OnQueryAsync, options => + { + return Task.FromResult(new QueryData() + { + Items = items, + IsAdvanceSearch = true, + IsFiltered = true, + IsSearch = true, + IsSorted = true + }); + }); + pb.Add(a => a.GetTextCallback, foo => foo.Name); + pb.Add(a => a.TableColumns, foo => builder => + { + builder.OpenComponent>(0); + builder.AddAttribute(1, "Field", "Name"); + builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string))); + builder.AddAttribute(3, "Searchable", true); + builder.CloseComponent(); + }); + pb.Add(a => a.ShowToolbar, true); + pb.Add(a => a.ToolbarTemplate, builder => + { + builder.AddContent(0, "toolbar-template"); + }); + pb.Add(a => a.TableExtensionToolbarTemplate, builder => + { + builder.AddContent(0, "toolbar-extension-template"); + }); + }); + }); + + cut.Contains("toolbar-template"); + cut.Contains("toolbar-extension-template"); + + var table = cut.FindComponent>(); + table.Render(pb => + { + pb.Add(a => a.ShowToolbar, false); + }); + cut.DoesNotContain("toolbar-template"); + cut.DoesNotContain("toolbar-extension-template"); + } + private static Task> OnFilterQueryAsync(QueryPageOptions options, IEnumerable _filterItems) { _filterItems = _filterItems.Where(options.ToFilterFunc());