diff --git a/src/admin/Bootstrap.Admin/Components/EditPageBase.cs b/src/admin/Bootstrap.Admin/Components/EditPageBase.cs index 7745121e..f96af2e7 100644 --- a/src/admin/Bootstrap.Admin/Components/EditPageBase.cs +++ b/src/admin/Bootstrap.Admin/Components/EditPageBase.cs @@ -40,7 +40,7 @@ namespace Bootstrap.Admin.Components /// /// [Parameter] - public RenderFragment? TableHeader { get; set; } + public RenderFragment? TableHeader { get; set; } /// /// diff --git a/src/admin/Bootstrap.Admin/Components/LgbTableHeader.cs b/src/admin/Bootstrap.Admin/Components/LgbTableHeader.cs new file mode 100644 index 00000000..fe3a641b --- /dev/null +++ b/src/admin/Bootstrap.Admin/Components/LgbTableHeader.cs @@ -0,0 +1,45 @@ +using Bootstrap.Admin.Extensions; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Rendering; +using System; +using System.Linq.Expressions; + +namespace Bootstrap.Admin.Components +{ + /// + /// + /// + public class LgbTableHeader : ComponentBase + { +#nullable disable + /// + /// + /// + [Parameter] public TItem Value { get; set; } +#nullable restore + + /// + /// + /// + [Parameter] public EventCallback ValueChanged { get; set; } + + /// + /// + /// + [Parameter] public Expression>? ValueExpression { get; set; } + + /// + /// + /// + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) + { + var filed = FieldIdentifier.Create(ValueExpression); + var text = filed.GetDisplayName(); + builder.OpenElement(0, "th"); + builder.AddContent(1, text); + builder.CloseElement(); + } + } +} diff --git a/src/admin/Bootstrap.Admin/Components/TableBase.cs b/src/admin/Bootstrap.Admin/Components/TableBase.cs index 52c493ed..bb6e2841 100644 --- a/src/admin/Bootstrap.Admin/Components/TableBase.cs +++ b/src/admin/Bootstrap.Admin/Components/TableBase.cs @@ -28,7 +28,7 @@ namespace Bootstrap.Admin.Components /// /// [Parameter] - public RenderFragment? TableHeader { get; set; } + public RenderFragment? TableHeader { get; set; } /// /// @@ -224,7 +224,6 @@ namespace Bootstrap.Admin.Components /// /// /// - /// /// protected CheckBoxState CheckState(TItem item) { diff --git a/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor b/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor index 76b4b623..a2276093 100644 --- a/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor +++ b/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor @@ -7,10 +7,10 @@ - 字典标签 - 字典名称 - 字典代码 - 字典类型 + + + + @context.Category diff --git a/src/admin/Bootstrap.Admin/Shared/EditPage.razor b/src/admin/Bootstrap.Admin/Shared/EditPage.razor index 53c715c3..b93bef10 100644 --- a/src/admin/Bootstrap.Admin/Shared/EditPage.razor +++ b/src/admin/Bootstrap.Admin/Shared/EditPage.razor @@ -11,7 +11,7 @@
- @TableHeader + @TableHeader?.Invoke(context) @RowTemplate?.Invoke(context) diff --git a/src/admin/Bootstrap.Admin/Shared/Table.razor b/src/admin/Bootstrap.Admin/Shared/Table.razor index fa32fa1d..f354d77c 100644 --- a/src/admin/Bootstrap.Admin/Shared/Table.razor +++ b/src/admin/Bootstrap.Admin/Shared/Table.razor @@ -29,7 +29,7 @@ { } - @TableHeader + @TableHeader?.Invoke(EditModel) @if (ShowButtons) {
@ButtonTemplateHeaderText