diff --git a/src/BootstrapBlazor/Components/Table/Table.razor b/src/BootstrapBlazor/Components/Table/Table.razor
index 30a99f97191..83633714169 100644
--- a/src/BootstrapBlazor/Components/Table/Table.razor
+++ b/src/BootstrapBlazor/Components/Table/Table.razor
@@ -2,7 +2,7 @@
@typeparam TItem
@inherits BootstrapModuleComponentBase
-
+
@TableColumns?.Invoke(new TItem())
@@ -842,7 +842,7 @@ RenderFragment
RenderRowExtendButtons => item =>
;
RenderFragment RenderSearch =>
-@
+@
@if (ShowSearchText)
{
diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.FixHeader.cs b/src/BootstrapBlazor/Components/Table/Table.razor.FixHeader.cs
deleted file mode 100644
index e73cce32329..00000000000
--- a/src/BootstrapBlazor/Components/Table/Table.razor.FixHeader.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-// Website: https://www.blazor.zone or https://argozhang.github.io/
-
-namespace BootstrapBlazor.Components;
-
-public partial class Table
-{
- ///
- /// 获得/设置 Table 组件引用
- ///
- ///
- protected ElementReference TableElement { get; set; }
-
- ///
- /// 获得/设置 Table 高度 默认为 null
- ///
- /// 开启固定表头功能时生效
- [Parameter]
- public int? Height { get; set; }
-
- ///
- /// 获得/设置 固定表头 默认 false
- ///
- /// 固定表头时设置 即可出现滚动条,未设置时尝试自适应
- [Parameter]
- public bool IsFixedHeader { get; set; }
-
- ///
- /// 获得/设置 多表头模板
- ///
- [Parameter]
- public RenderFragment? MultiHeaderTemplate { get; set; }
-}
diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.cs b/src/BootstrapBlazor/Components/Table/Table.razor.cs
index 4822d117359..17da095e971 100644
--- a/src/BootstrapBlazor/Components/Table/Table.razor.cs
+++ b/src/BootstrapBlazor/Components/Table/Table.razor.cs
@@ -133,6 +133,26 @@ namespace BootstrapBlazor.Components;
private static string? GetColWidthString(int? width) => width.HasValue ? $"width: {width.Value}px;" : null;
+ ///
+ /// 获得/设置 Table 高度 默认为 null
+ ///
+ /// 开启固定表头功能时生效
+ [Parameter]
+ public int? Height { get; set; }
+
+ ///
+ /// 获得/设置 固定表头 默认 false
+ ///
+ /// 固定表头时设置 即可出现滚动条,未设置时尝试自适应
+ [Parameter]
+ public bool IsFixedHeader { get; set; }
+
+ ///
+ /// 获得/设置 多表头模板
+ ///
+ [Parameter]
+ public RenderFragment? MultiHeaderTemplate { get; set; }
+
///
/// 获得/设置 列拷贝 Tooltip 文字
///
diff --git a/test/UnitTest/Components/TableDialogTest.cs b/test/UnitTest/Components/TableDialogTest.cs
index ffbd5a53f59..034db681a3d 100644
--- a/test/UnitTest/Components/TableDialogTest.cs
+++ b/test/UnitTest/Components/TableDialogTest.cs
@@ -127,10 +127,12 @@ public async Task EditAsync_Ok()
{
itemsChanged = true;
});
+ pb.Add(a => a.EditFooterTemplate, foo => builder => builder.AddContent(0, "test_edit_footer"));
});
// Add 弹窗
await cut.InvokeAsync(() => table.Instance.AddAsync());
+ cut.Contains("test_edit_footer");
// 编辑弹窗逻辑
input = cut.Find(".modal-body form input.form-control");
diff --git a/test/UnitTest/Components/TableTest.cs b/test/UnitTest/Components/TableTest.cs
index eb525415de0..31720091328 100644
--- a/test/UnitTest/Components/TableTest.cs
+++ b/test/UnitTest/Components/TableTest.cs
@@ -443,6 +443,46 @@ public async Task ShowTopSearch_Ok()
await cut.InvokeAsync(() => searchButton.Click());
}
+ [Fact]
+ public void CollapsedTopSearch_Ok()
+ {
+ var localizer = Context.Services.GetRequiredService>();
+ var cut = Context.RenderComponent(pb =>
+ {
+ pb.AddChildContent>(pb =>
+ {
+ pb.Add(a => a.ShowSearch, true);
+ pb.Add(a => a.CollapsedTopSearch, true);
+ pb.Add(a => a.SearchMode, SearchMode.Top);
+ pb.Add(a => a.OnQueryAsync, OnQueryAsync(localizer));
+ 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.TableColumns, foo => builder =>
+ {
+ builder.OpenComponent>(0);
+ builder.AddAttribute(1, "Field", foo.Count);
+ builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Count", typeof(int)));
+ builder.AddAttribute(3, "Searchable", true);
+ builder.CloseComponent();
+ });
+ });
+ });
+ cut.DoesNotContain("card-body collapse show");
+
+ var table = cut.FindComponent>();
+ table.SetParametersAndRender(pb =>
+ {
+ pb.Add(a => a.CollapsedTopSearch, false);
+ });
+ cut.Contains("card-body collapse show");
+ }
+
[Fact]
public void ShowToolbar_Ok()
{