From 8fae24417017bb1d27f744efc7bae49d0294b810 Mon Sep 17 00:00:00 2001 From: Argo Window10 Date: Tue, 10 Dec 2019 18:20:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A8=E5=A4=B4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=8E=B7=E5=8F=96=E6=98=BE=E7=A4=BA=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/EditPageBase.cs | 2 +- .../Components/LgbTableHeader.cs | 45 +++++++++++++++++++ .../Bootstrap.Admin/Components/TableBase.cs | 3 +- .../Bootstrap.Admin/Pages/Admin/Dicts.razor | 8 ++-- .../Bootstrap.Admin/Shared/EditPage.razor | 2 +- src/admin/Bootstrap.Admin/Shared/Table.razor | 2 +- 6 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 src/admin/Bootstrap.Admin/Components/LgbTableHeader.cs 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