From c67833f7ac8118c2cfed2f3f4239e09a29ef5b46 Mon Sep 17 00:00:00 2001 From: Feng Bo Zhou Date: Wed, 12 Apr 2023 22:18:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ColSpan=E8=AE=BE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Attributes/AutoGenerateColumnAttribute.cs | 5 +++++ .../Components/EditorForm/EditorForm.razor.cs | 2 +- src/BootstrapBlazor/Components/EditorForm/EditorItem.cs | 6 ++++++ src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs | 5 +++++ src/BootstrapBlazor/Components/Table/InternalTableColumn.cs | 2 ++ src/BootstrapBlazor/Components/Table/TableColumn.cs | 6 ++++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs b/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs index 071a3effd..de5aade48 100644 --- a/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs +++ b/src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs @@ -155,6 +155,11 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu /// public int Rows { get; set; } + /// + /// 获得/设置 控件跨列数量 + /// + public int ColSpan { get; set; } + /// /// 获得/设置 列过滤器 /// diff --git a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs index 26cb02048..956a1bc6c 100644 --- a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs +++ b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs @@ -25,7 +25,7 @@ public partial class EditorForm : IShowLabel /// /// private string? GetCssString(IEditorItem item) => CssBuilder.Default("col-12") - .AddClass($"col-sm-6 col-md-{Math.Floor(12d / (ItemsPerRow ?? 1))}", item.Items == null && ItemsPerRow != null && item.Rows == 0) + .AddClass($"col-sm-6 col-md-{Math.Floor(12d / ((ItemsPerRow ?? 1) / (item.ColSpan == 0 ? 1 : item.ColSpan)))}", item.Items == null && ItemsPerRow != null && item.Rows == 0) .Build(); private string? FormClassString => CssBuilder.Default("row g-3") diff --git a/src/BootstrapBlazor/Components/EditorForm/EditorItem.cs b/src/BootstrapBlazor/Components/EditorForm/EditorItem.cs index 76b4280f5..82d5009b2 100644 --- a/src/BootstrapBlazor/Components/EditorForm/EditorItem.cs +++ b/src/BootstrapBlazor/Components/EditorForm/EditorItem.cs @@ -94,6 +94,12 @@ public class EditorItem : ComponentBase, IEditorItem [Parameter] public int Rows { get; set; } + /// + /// 获得/设置 控件跨列数量 + /// + [Parameter] + public int ColSpan { get; set; } + /// /// 获得/设置 编辑模板 /// diff --git a/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs b/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs index 031b01450..386af1e70 100644 --- a/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs +++ b/src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs @@ -139,4 +139,9 @@ public interface IEditorItem /// 获得/设置 当前属性分组排序 默认 0 /// int GroupOrder { get; set; } + + /// + /// 获得/设置 控件跨列数量 + /// + int ColSpan { get; set; } } diff --git a/src/BootstrapBlazor/Components/Table/InternalTableColumn.cs b/src/BootstrapBlazor/Components/Table/InternalTableColumn.cs index 0c89cc98f..36812a280 100644 --- a/src/BootstrapBlazor/Components/Table/InternalTableColumn.cs +++ b/src/BootstrapBlazor/Components/Table/InternalTableColumn.cs @@ -88,6 +88,8 @@ internal class InternalTableColumn : ITableColumn public int Rows { get; set; } + public int ColSpan { get; set; } + [NotNull] public string? Text { get; set; } diff --git a/src/BootstrapBlazor/Components/Table/TableColumn.cs b/src/BootstrapBlazor/Components/Table/TableColumn.cs index aafb23ece..6c6305f68 100644 --- a/src/BootstrapBlazor/Components/Table/TableColumn.cs +++ b/src/BootstrapBlazor/Components/Table/TableColumn.cs @@ -123,6 +123,12 @@ public class TableColumn : BootstrapComponentBase, ITableColumn [Parameter] public int Rows { get; set; } + /// + /// 获得/设置 控件跨列数量 + /// + [Parameter] + public int ColSpan { get; set; } + /// /// 获得/设置 是否为默认排序规则 默认为 SortOrder.Unset /// -- Gitee