From e8b824c6a0ee986bae213469647f47b41e3cf1d8 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 26 Jan 2020 12:37:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=94=B9=20Table=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B1=9E=E6=80=A7=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/EditPageBase.cs | 6 - .../Bootstrap.Admin/Components/TableBase.cs | 34 +++- .../Bootstrap.Admin/Pages/Admin/Dicts.razor | 2 +- .../Bootstrap.Admin/Pages/Admin/Groups.razor | 2 +- .../Bootstrap.Admin/Pages/Admin/Menus.razor | 2 +- .../Bootstrap.Admin/Pages/Admin/Roles.razor | 2 +- .../Bootstrap.Admin/Pages/Admin/Users.razor | 2 +- .../Bootstrap.Admin/Shared/EditPage.razor | 2 +- src/admin/Bootstrap.Admin/Shared/Table.razor | 176 ++++++++++-------- 9 files changed, 138 insertions(+), 90 deletions(-) diff --git a/src/admin/Bootstrap.Admin/Components/EditPageBase.cs b/src/admin/Bootstrap.Admin/Components/EditPageBase.cs index 6bf0df74..49ef57bd 100644 --- a/src/admin/Bootstrap.Admin/Components/EditPageBase.cs +++ b/src/admin/Bootstrap.Admin/Components/EditPageBase.cs @@ -90,12 +90,6 @@ namespace Bootstrap.Admin.Components [Parameter] public bool FixedHeader { get; set; } - /// - /// 获得/设置 是否显示搜索框 默认为 false 不显示搜索框 - /// - [Parameter] - public bool ShowSearch { get; set; } - /// /// 获得/设置 Table 实例 /// diff --git a/src/admin/Bootstrap.Admin/Components/TableBase.cs b/src/admin/Bootstrap.Admin/Components/TableBase.cs index af41822f..6447c497 100644 --- a/src/admin/Bootstrap.Admin/Components/TableBase.cs +++ b/src/admin/Bootstrap.Admin/Components/TableBase.cs @@ -105,19 +105,43 @@ namespace Bootstrap.Admin.Components /// 获得/设置 是否显示行号 /// [Parameter] - public bool ShowLineNo { get; set; } = true; + public bool ShowLineNo { get; set; } /// - /// 获得/设置 是否显示选择列 默认为 true + /// 获得/设置 是否显示选择列 默认为 false /// [Parameter] - public bool ShowCheckbox { get; set; } = true; + public bool ShowCheckbox { get; set; } /// - /// 获得/设置 是否显示按钮列 默认为 true + /// 获得/设置 是否显示按钮列 默认为 false /// [Parameter] - public bool ShowButtons { get; set; } = true; + public bool ShowDefaultButtons { get; set; } + + /// + /// 获得/设置 是否显示表脚 默认为 false + /// + [Parameter] + public bool ShowFooter { get; set; } + + /// + /// 获得/设置 是否显示扩展按钮 默认为 true + /// + [Parameter] + public bool ShowExtendButtons { get; set; } = true; + + /// + /// 获得/设置 是否显示刷新按钮 默认为 true + /// + [Parameter] + public bool ShowRefresh { get; set; } = true; + + /// + /// 获得/设置 是否分页组件 默认为 false + /// + [Parameter] + public bool ShowPagination { get; set; } /// /// 获得/设置 是否显示工具栏 默认为 true diff --git a/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor b/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor index 714bbf0d..2ec1ddad 100644 --- a/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor +++ b/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor @@ -1,6 +1,6 @@ @inherits DictsBase - + -
- - - + @if(ShowSearch) + { + -
+ }
@@ -51,7 +66,7 @@ 行号 } @TableHeader?.Invoke(EditModel) - @if (ShowButtons) + @if (ShowExtendButtons) { @ButtonTemplateHeaderText } @@ -72,7 +87,7 @@ 行号 } @TableHeader?.Invoke(EditModel) - @if (ShowButtons) + @if (ShowExtendButtons) { @ButtonTemplateHeaderText } @@ -91,7 +106,7 @@ @(index + 1 + (PageIndex - 1) * PageItems) } @RowTemplate?.Invoke(Items.ElementAt(index)) - @if (ShowButtons) + @if (ShowExtendButtons) { @ButtonTemplate?.Invoke(Items.ElementAt(index)) } @@ -118,7 +133,7 @@ 行号 } @TableHeader?.Invoke(EditModel) - @if (ShowButtons) + @if (ShowExtendButtons) { @ButtonTemplateHeaderText } @@ -137,62 +152,77 @@ @(index + 1 + (PageIndex - 1) * PageItems) } @RowTemplate?.Invoke(Items.ElementAt(index)) - @if (ShowButtons) + @if (ShowExtendButtons) { @ButtonTemplate?.Invoke(Items.ElementAt(index)) } } - - @TableFooter - + @if(ShowFooter) + { + + @TableFooter + + } }
- + @if(ShowPagination) + { + + } - - - - - - - - - +@if(OnDelete != null) +{ + + + + + + + + + +} - - - @EditTemplate?.Invoke(EditModel) - - +@if(OnSave != null) +{ + + + @EditTemplate?.Invoke(EditModel) + + +} - - - -
- @SearchTemplate?.Invoke(QueryModel) -
-
-
- - - - -
+@if(ShowSearch) +{ + + + +
+ @SearchTemplate?.Invoke(QueryModel) +
+
+
+ + + + +
+}