Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Table/Table.razor
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
@TableToolbarTemplate
}
</TableToolbar>
@if (ToolbarTemplate != null)
{
<div class="float-start table-toolbar-template">
@ToolbarTemplate
</div>
}
<div class="float-end table-toolbar-button btn-group table-column-right">
@if (TableExtensionToolbarBeforeTemplate != null)
{
Expand Down
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public partial class Table<TItem>
[Parameter]
public bool ShowToolbar { get; set; }

/// <summary>
/// Gets or sets the template of table toolbar. Default is null.
/// </summary>
[Parameter]
public RenderFragment? ToolbarTemplate { get; set; }

/// <summary>
/// 获得/设置 首次加载是否显示加载骨架屏 默认 false 不显示 使用 <see cref="ShowLoadingInFirstRender" /> 参数值
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions src/BootstrapBlazor/Components/Table/Table.razor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,15 @@ form .table .table-cell > textarea {
}
}

.table-toolbar-template {
margin-block-end: .5rem;
min-height: 35px;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
}

@media (min-width: 576px) {
.table-search .card-header .card-title {
display: initial;
Expand Down
2 changes: 2 additions & 0 deletions test/UnitTest/Components/TableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,11 @@ public void ShowToolbar_Ok()
builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string)));
builder.CloseComponent();
});
pb.Add(a => a.ToolbarTemplate, builder => builder.AddContent(0, "table-toolbar-template-content"));
});
});
cut.Contains("float-end table-toolbar-button");
cut.Contains("float-start table-toolbar-button");
}

[Fact]
Expand Down