From 3e2df652ccd4c75204b0bff568114249ef27e166 Mon Sep 17 00:00:00 2001 From: John Bomhold Date: Tue, 3 May 2022 01:44:08 -0500 Subject: [PATCH] Expose Wrapper Class for Tables Additional Request of #513 --- .../Samples/Content/Tables/Tables1b.razor | 30 +++++++++++++++++++ .../Samples/Content/Tables/Tables1b.md | 30 +++++++++++++++++++ .../wwwroot/Static/Content/Tables.md | 29 ++++++++++-------- .../Components/Content/BSTable.razor.cs | 2 ++ 4 files changed, 79 insertions(+), 12 deletions(-) create mode 100644 src/BlazorStrap-Docs/Samples/Content/Tables/Tables1b.razor create mode 100644 src/BlazorStrap-Docs/wwwroot/Samples/Content/Tables/Tables1b.md diff --git a/src/BlazorStrap-Docs/Samples/Content/Tables/Tables1b.razor b/src/BlazorStrap-Docs/Samples/Content/Tables/Tables1b.razor new file mode 100644 index 00000000..b9e7b7aa --- /dev/null +++ b/src/BlazorStrap-Docs/Samples/Content/Tables/Tables1b.razor @@ -0,0 +1,30 @@ + + + + # + First + Last + Handle + + + + + 1 + John + Doe + JohnDoe
media.com
+
+ + 2 + Jane + Doe + JaneDoe
media.com
+
+
+ + + Spanned Table Footer Here + + + +
\ No newline at end of file diff --git a/src/BlazorStrap-Docs/wwwroot/Samples/Content/Tables/Tables1b.md b/src/BlazorStrap-Docs/wwwroot/Samples/Content/Tables/Tables1b.md new file mode 100644 index 00000000..b9e7b7aa --- /dev/null +++ b/src/BlazorStrap-Docs/wwwroot/Samples/Content/Tables/Tables1b.md @@ -0,0 +1,30 @@ + + + + # + First + Last + Handle + + + + + 1 + John + Doe + JohnDoe
media.com
+
+ + 2 + Jane + Doe + JaneDoe
media.com
+
+
+ + + Spanned Table Footer Here + + + +
\ No newline at end of file diff --git a/src/BlazorStrap-Docs/wwwroot/Static/Content/Tables.md b/src/BlazorStrap-Docs/wwwroot/Static/Content/Tables.md index aa5b6913..a57e5b57 100644 --- a/src/BlazorStrap-Docs/wwwroot/Static/Content/Tables.md +++ b/src/BlazorStrap-Docs/wwwroot/Static/Content/Tables.md @@ -3,18 +3,19 @@ See [shared](layout/shared) for additional parameters ::: -| Parameter | Type | Valid | Remarks/Output | -|-----------------|------|------------|-----------------------| -| Color | Enum | BSColor | `.table-[]` | {.table-striped .p-2} -| IsBordered | bool | true/false | `.table-bordered` | -| IsBorderLess | bool | true/false | `.table-borderless` | -| IsHoverable | bool | true/false | `.table-hover` | -| IsCaptionTop | bool | true/false | `.caption-top` | -| IsDark | bool | true/false | `.table-dark` | -| IsSmall | bool | true/false | `.table-sm` | -| IsStriped | bool | true/false | `.table-striped` | -| IsResponsive | bool | true/false | `.table-responsive` | -| ResponsiveSize | bool | true/false | `.table-responsive-#` | +| Parameter | Type | Valid | Remarks/Output | +|------------------------|--------|------------|-----------------------| +| Color | Enum | BSColor | `.table-[]` | {.table-striped .p-2} +| IsBordered | bool | true/false | `.table-bordered` | +| IsBorderLess | bool | true/false | `.table-borderless` | +| IsHoverable | bool | true/false | `.table-hover` | +| IsCaptionTop | bool | true/false | `.caption-top` | +| IsDark | bool | true/false | `.table-dark` | +| IsSmall | bool | true/false | `.table-sm` | +| IsStriped | bool | true/false | `.table-striped` | +| IsResponsive | bool | true/false | `.table-responsive` | +| ResponsiveSize | bool | true/false | `.table-responsive-#` | +| ResponsiveWrapperClass | string | string | Adds string to class | ::: #### Component \ @@ -46,6 +47,10 @@ Shared Parameters only {{sample=Content/Tables/Tables1}} +### Responsive Tables Example + +{{sample=Content/Tables/Tables1b}} + #### Component \\> (Version >= 5.0.105-Preview2) See [shared](layout/shared) for additional parameters ::: diff --git a/src/BlazorStrap/Components/Content/BSTable.razor.cs b/src/BlazorStrap/Components/Content/BSTable.razor.cs index 576f28bb..fa698dfb 100644 --- a/src/BlazorStrap/Components/Content/BSTable.razor.cs +++ b/src/BlazorStrap/Components/Content/BSTable.razor.cs @@ -9,6 +9,7 @@ public partial class BSTable : BlazorStrapBase [Parameter] public bool IsDark { get; set; } [Parameter] public bool IsHoverable { get; set; } [Parameter] public bool IsResponsive { get; set; } + [Parameter] public string? ResponsiveWrapperClass { get; set; } [Parameter] public Size ResponsiveSize { get; set; } = Size.None; [Parameter] public bool IsSmall { get; set; } [Parameter] public bool IsBordered { get; set; } @@ -32,6 +33,7 @@ public partial class BSTable : BlazorStrapBase internal string? WrapperClassBuilder => new CssBuilder("bs-table-responsive") .AddClass("table-responsive", ResponsiveSize == Size.None) .AddClass($"table-responsive-{ResponsiveSize.ToDescriptionString()}", ResponsiveSize != Size.None) + .AddClass(ResponsiveWrapperClass, !string.IsNullOrEmpty(ResponsiveWrapperClass)) .Build().ToNullString(); }