Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.3.2</Version>
<Version>10.3.3-beta01</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/Components/Empty/Empty.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@namespace BootstrapBlazor.Components
@namespace BootstrapBlazor.Components
Comment thread
ArgoZhang marked this conversation as resolved.
@inherits BootstrapComponentBase

<div @attributes="AdditionalAttributes" class="@ClassString">
@if (Template != null)
{
<div class="empty-telemplate">
<div class="empty-template">
@Template
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/Components/Empty/Empty.razor.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "../../wwwroot/scss/variables" as *;
@use "../../wwwroot/scss/variables" as *;
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UTF-8 BOM character () should be preserved at the beginning of this file to maintain consistency with the codebase convention. All .scss files that start with @use in the codebase use UTF-8 BOM encoding (see examples: src/BootstrapBlazor/Components/Alert/Alert.razor.scss:1, src/BootstrapBlazor/Components/Avatar/Avatar.razor.scss:1, and many others). The line should start with @use instead of @use.

Copilot uses AI. Check for mistakes.

.empty {
--bb-empty-image-margin: #{$bb-empty-image-margin};
Expand All @@ -9,7 +9,7 @@
margin: var(--bb-empty-image-margin);
}

.empty-telemplate {
.empty-template {
margin: var(--bb-empty-template-margin);
}
}
3 changes: 3 additions & 0 deletions src/BootstrapBlazor/Components/Select/SelectTable.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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"></Table>
</div>
</RenderTemplate>
Expand Down
25 changes: 23 additions & 2 deletions src/BootstrapBlazor/Components/Select/SelectTable.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ namespace BootstrapBlazor.Components;
public bool ShowAppendArrow { get; set; } = true;

/// <summary>
/// <para lang="zh">获得/设置 弹窗表格最小宽度 默认为 null 未设置使用样式中的默认值</para>
/// <para lang="en">Gets or sets Dropdown Table Min Width. Default null (use style default)</para>
/// <para lang="zh">获得/设置 弹窗表格最小宽度 默认为 null 未设置使用样式中的默认值 602px</para>
/// <para lang="en">Gets or sets Dropdown Table Min Width. Default null (use style default 602px)</para>
/// </summary>
[Parameter]
public int? TableMinWidth { get; set; }
Expand Down Expand Up @@ -139,6 +139,27 @@ namespace BootstrapBlazor.Components;
[Parameter]
public string? MultiSelectedItemMaxWidth { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否显示工具栏 默认 false 不显示</para>
/// <para lang="en">Gets or sets Whether to show toolbar. Default false</para>
/// </summary>
[Parameter]
public bool ShowToolbar { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 表格 Toolbar 工具栏模板</para>
/// <para lang="en">Gets or sets the table toolbar template, content appears center of toolbar</para>
/// </summary>
[Parameter]
public RenderFragment? ToolbarTemplate { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 表格 Toolbar 工具栏右侧按钮模板,模板中内容出现在默认按钮后面</para>
/// <para lang="en">Gets or sets the table toolbar right-side button template, content appears after the default buttons</para>
/// </summary>
[Parameter]
public RenderFragment? TableExtensionToolbarTemplate { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 IIconTheme 服务实例</para>
/// <para lang="en">Gets or sets IIconTheme Service Instance</para>
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Select/SelectTable.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
55 changes: 54 additions & 1 deletion test/UnitTest/Components/SelectTableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public void EmptyTemplate_OK()
});
});

cut.Contains("<div class=\"empty\"><div class=\"empty-telemplate\">empty-template</div></div>");
cut.Contains("<div class=\"empty\"><div class=\"empty-template\">empty-template</div></div>");
}

[Fact]
Expand Down Expand Up @@ -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<IStringLocalizer<Foo>>();
var items = Foo.GenerateFoo(localizer);
var cut = Context.Render<BootstrapBlazorRoot>(pb =>
{
pb.AddChildContent<SelectTable<Foo>>(pb =>
{
pb.Add(a => a.OnQueryAsync, options =>
{
return Task.FromResult(new QueryData<Foo>()
{
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<TableColumn<Foo, string>>(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<SelectTable<Foo>>();
table.Render(pb =>
{
pb.Add(a => a.ShowToolbar, false);
});
cut.DoesNotContain("toolbar-template");
cut.DoesNotContain("toolbar-extension-template");
}

private static Task<QueryData<Foo>> OnFilterQueryAsync(QueryPageOptions options, IEnumerable<Foo> _filterItems)
{
_filterItems = _filterItems.Where(options.ToFilterFunc<Foo>());
Expand Down
Loading