From 8e024bd0ca569d29d748271bebf1fb021c5a7c4c Mon Sep 17 00:00:00 2001 From: John Bomhold Date: Sat, 7 Sep 2024 00:26:45 -1000 Subject: [PATCH] Fixes Forms when using .Net 8 --- BlazorStrap.sln.DotSettings | 1 + src/BlazorStrap-Docs/BlazorStrap-Docs.csproj | 4 ++-- src/BlazorStrap-Docs/Pages/WIP.razor | 7 +------ .../Samples/V4/Content/Tables/Tables1.razor | 2 +- .../Extensions/FluentValidationRuleSets.razor | 4 ++-- .../Samples/V5/Content/Tables/Tables1.razor | 2 +- .../Extensions/FluentValidationRuleSets.razor | 4 ++-- .../Samples/V4/Content/Tables/Tables1.md | 2 +- .../V4/Extensions/FluentValidationRuleSets.md | 4 ++-- .../Samples/V5/Content/Tables/Tables1.md | 2 +- .../V5/Extensions/FluentValidationRuleSets.md | 4 ++-- .../wwwroot/Static/V5/Content/Tables.md | 20 +++++++++---------- src/BlazorStrap-WASM/BlazorStrap.WASM.csproj | 6 +++--- .../BlazorStrap.Server.csproj | 2 +- .../Components/Forms/BSInput.cs | 1 + .../Components/Forms/BSInputCheckbox.cs | 6 +++--- src/BlazorStrap/BlazorStrap.csproj | 2 +- .../Components/DataGrid/BSDataGridBase.cs | 6 ++++++ src/BlazorStrap/Utilities/BlazorInputBase.cs | 12 +++++++++++ 19 files changed, 53 insertions(+), 38 deletions(-) create mode 100644 src/BlazorStrap/Shared/Components/DataGrid/BSDataGridBase.cs diff --git a/BlazorStrap.sln.DotSettings b/BlazorStrap.sln.DotSettings index ab84144e..43101bac 100644 --- a/BlazorStrap.sln.DotSettings +++ b/BlazorStrap.sln.DotSettings @@ -279,6 +279,7 @@ </Patterns> XL XXL + True True True True diff --git a/src/BlazorStrap-Docs/BlazorStrap-Docs.csproj b/src/BlazorStrap-Docs/BlazorStrap-Docs.csproj index d7e854cd..c6cf5cc5 100644 --- a/src/BlazorStrap-Docs/BlazorStrap-Docs.csproj +++ b/src/BlazorStrap-Docs/BlazorStrap-Docs.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 enable enable BlazorStrap_Docs @@ -15,7 +15,7 @@ - + diff --git a/src/BlazorStrap-Docs/Pages/WIP.razor b/src/BlazorStrap-Docs/Pages/WIP.razor index ff806019..1d734603 100644 --- a/src/BlazorStrap-Docs/Pages/WIP.razor +++ b/src/BlazorStrap-Docs/Pages/WIP.razor @@ -1,7 +1,2 @@ @page "/wip" -@layout WipLayout -
-
- -
-
+ diff --git a/src/BlazorStrap-Docs/Samples/V4/Content/Tables/Tables1.razor b/src/BlazorStrap-Docs/Samples/V4/Content/Tables/Tables1.razor index 97c495e4..d3111ef5 100644 --- a/src/BlazorStrap-Docs/Samples/V4/Content/Tables/Tables1.razor +++ b/src/BlazorStrap-Docs/Samples/V4/Content/Tables/Tables1.razor @@ -93,7 +93,7 @@ TRIsActive - @code { // BSTable Parameters private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set diff --git a/src/BlazorStrap-Docs/Samples/V4/Extensions/FluentValidationRuleSets.razor b/src/BlazorStrap-Docs/Samples/V4/Extensions/FluentValidationRuleSets.razor index 8335a985..7206f10c 100644 --- a/src/BlazorStrap-Docs/Samples/V4/Extensions/FluentValidationRuleSets.razor +++ b/src/BlazorStrap-Docs/Samples/V4/Extensions/FluentValidationRuleSets.razor @@ -30,7 +30,7 @@ @code { - + // private Customer customer = new Customer(); void SaveCustomer() @@ -53,7 +53,7 @@ public string Postcode { get; set; } } - + // public class CustomerValidator : AbstractValidator { public CustomerValidator() diff --git a/src/BlazorStrap-Docs/Samples/V5/Content/Tables/Tables1.razor b/src/BlazorStrap-Docs/Samples/V5/Content/Tables/Tables1.razor index 97c495e4..d3111ef5 100644 --- a/src/BlazorStrap-Docs/Samples/V5/Content/Tables/Tables1.razor +++ b/src/BlazorStrap-Docs/Samples/V5/Content/Tables/Tables1.razor @@ -93,7 +93,7 @@ TRIsActive - @code { // BSTable Parameters private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set diff --git a/src/BlazorStrap-Docs/Samples/V5/Extensions/FluentValidationRuleSets.razor b/src/BlazorStrap-Docs/Samples/V5/Extensions/FluentValidationRuleSets.razor index 9d9a36a7..b66e0e1a 100644 --- a/src/BlazorStrap-Docs/Samples/V5/Extensions/FluentValidationRuleSets.razor +++ b/src/BlazorStrap-Docs/Samples/V5/Extensions/FluentValidationRuleSets.razor @@ -29,7 +29,7 @@ @code { - + // private Customer customer = new Customer(); void SaveCustomer() @@ -52,7 +52,7 @@ public string Postcode { get; set; } } - + // public class CustomerValidator : AbstractValidator { public CustomerValidator() diff --git a/src/BlazorStrap-Docs/wwwroot/Samples/V4/Content/Tables/Tables1.md b/src/BlazorStrap-Docs/wwwroot/Samples/V4/Content/Tables/Tables1.md index 97c495e4..d3111ef5 100644 --- a/src/BlazorStrap-Docs/wwwroot/Samples/V4/Content/Tables/Tables1.md +++ b/src/BlazorStrap-Docs/wwwroot/Samples/V4/Content/Tables/Tables1.md @@ -93,7 +93,7 @@ TRIsActive - @code { // BSTable Parameters private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set diff --git a/src/BlazorStrap-Docs/wwwroot/Samples/V4/Extensions/FluentValidationRuleSets.md b/src/BlazorStrap-Docs/wwwroot/Samples/V4/Extensions/FluentValidationRuleSets.md index 8335a985..7206f10c 100644 --- a/src/BlazorStrap-Docs/wwwroot/Samples/V4/Extensions/FluentValidationRuleSets.md +++ b/src/BlazorStrap-Docs/wwwroot/Samples/V4/Extensions/FluentValidationRuleSets.md @@ -30,7 +30,7 @@ @code { - + // private Customer customer = new Customer(); void SaveCustomer() @@ -53,7 +53,7 @@ public string Postcode { get; set; } } - + // public class CustomerValidator : AbstractValidator { public CustomerValidator() diff --git a/src/BlazorStrap-Docs/wwwroot/Samples/V5/Content/Tables/Tables1.md b/src/BlazorStrap-Docs/wwwroot/Samples/V5/Content/Tables/Tables1.md index 97c495e4..d3111ef5 100644 --- a/src/BlazorStrap-Docs/wwwroot/Samples/V5/Content/Tables/Tables1.md +++ b/src/BlazorStrap-Docs/wwwroot/Samples/V5/Content/Tables/Tables1.md @@ -93,7 +93,7 @@ TRIsActive - @code { // BSTable Parameters private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set diff --git a/src/BlazorStrap-Docs/wwwroot/Samples/V5/Extensions/FluentValidationRuleSets.md b/src/BlazorStrap-Docs/wwwroot/Samples/V5/Extensions/FluentValidationRuleSets.md index 9d9a36a7..b66e0e1a 100644 --- a/src/BlazorStrap-Docs/wwwroot/Samples/V5/Extensions/FluentValidationRuleSets.md +++ b/src/BlazorStrap-Docs/wwwroot/Samples/V5/Extensions/FluentValidationRuleSets.md @@ -29,7 +29,7 @@ @code { - + // private Customer customer = new Customer(); void SaveCustomer() @@ -52,7 +52,7 @@ public string Postcode { get; set; } } - + // public class CustomerValidator : AbstractValidator { public CustomerValidator() diff --git a/src/BlazorStrap-Docs/wwwroot/Static/V5/Content/Tables.md b/src/BlazorStrap-Docs/wwwroot/Static/V5/Content/Tables.md index 1d9ef5a0..c4a298d3 100644 --- a/src/BlazorStrap-Docs/wwwroot/Static/V5/Content/Tables.md +++ b/src/BlazorStrap-Docs/wwwroot/Static/V5/Content/Tables.md @@ -3,19 +3,19 @@ See [shared](layout/shared) for additional parameters ::: -| Parameter | Type | Valid | Remarks/Output | +| 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` | +| 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 | +| ResponsiveWrapperClass | string | string | Adds string to class | ::: #### Component \ diff --git a/src/BlazorStrap-WASM/BlazorStrap.WASM.csproj b/src/BlazorStrap-WASM/BlazorStrap.WASM.csproj index 4580f35e..37543481 100644 --- a/src/BlazorStrap-WASM/BlazorStrap.WASM.csproj +++ b/src/BlazorStrap-WASM/BlazorStrap.WASM.csproj @@ -3,15 +3,15 @@ true false - net7.0 + net8.0 enable enable BlazorStrap.WASM - - + + diff --git a/src/BlazorStrap.Server/BlazorStrap.Server.csproj b/src/BlazorStrap.Server/BlazorStrap.Server.csproj index c7939718..40b517b0 100644 --- a/src/BlazorStrap.Server/BlazorStrap.Server.csproj +++ b/src/BlazorStrap.Server/BlazorStrap.Server.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable BlazorStrap.Server diff --git a/src/BlazorStrap.V5/Components/Forms/BSInput.cs b/src/BlazorStrap.V5/Components/Forms/BSInput.cs index e4ea6ebc..0c666f8d 100644 --- a/src/BlazorStrap.V5/Components/Forms/BSInput.cs +++ b/src/BlazorStrap.V5/Components/Forms/BSInput.cs @@ -45,6 +45,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.AddAttribute(4, "onchange", EventCallback.Factory.CreateBinder(this, OnChangeEvent, CurrentValueAsString)); builder.AddAttribute(5, "oninput", EventCallback.Factory.CreateBinder(this, OnInputEvent, CurrentValueAsString)); } + builder.AddAttribute(6, "disabled", IsDisabled); builder.AddAttribute(7, "readonly", IsReadonly); builder.AddAttribute(8, "onblur", OnBlurEvent); diff --git a/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs b/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs index da07741e..ccbf96ed 100644 --- a/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs +++ b/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs @@ -57,13 +57,13 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.AddAttribute(10, "id", Helper.Id); } builder.AddAttribute(11, "disabled", IsDisabled); +#if NET8_0_OR_GREATER + builder.AddAttribute(19, "name", NameAttributeValue ); +#endif if (IsToggle) builder.AddAttribute(12, "id", id); builder.AddMultipleAttributes(13, AdditionalAttributes); builder.AddElementReferenceCapture(14, elReference => Element = elReference); -#if NET8_0_OR_GREATER - builder.AddAttribute(15, "name",NameAttributeValue ); -#endif builder.CloseElement(); if (IsToggle) { diff --git a/src/BlazorStrap/BlazorStrap.csproj b/src/BlazorStrap/BlazorStrap.csproj index 882d0e66..e4e119f8 100644 --- a/src/BlazorStrap/BlazorStrap.csproj +++ b/src/BlazorStrap/BlazorStrap.csproj @@ -13,7 +13,7 @@ https://blazorstrap.io/ https://github.com/chanan/BlazorStrap BlazorStrap - 5.2.102-Preview3a + 5.2.102-Preview3b 6.0 diff --git a/src/BlazorStrap/Shared/Components/DataGrid/BSDataGridBase.cs b/src/BlazorStrap/Shared/Components/DataGrid/BSDataGridBase.cs new file mode 100644 index 00000000..73874ebc --- /dev/null +++ b/src/BlazorStrap/Shared/Components/DataGrid/BSDataGridBase.cs @@ -0,0 +1,6 @@ +namespace BlazorStrap.Shared.Components.DataGrid; + +public class BSDataGridBase +{ + +} \ No newline at end of file diff --git a/src/BlazorStrap/Utilities/BlazorInputBase.cs b/src/BlazorStrap/Utilities/BlazorInputBase.cs index 6e789e76..bde8f4f8 100644 --- a/src/BlazorStrap/Utilities/BlazorInputBase.cs +++ b/src/BlazorStrap/Utilities/BlazorInputBase.cs @@ -23,6 +23,18 @@ namespace BlazorStrap.Utilities; #if NET8_0 public abstract class BlazorInputBase : InputBase { + [CascadingParameter] private EditContext? CascadeEditContext { get; set; } + private TValue? _value => Value; + + public override Task SetParametersAsync(ParameterView parameters) + { + if (CascadeEditContext == null && ValueExpression == null) + { + ValueExpression = () => _value; + } + + return base.SetParametersAsync(parameters); + } } #else public abstract class BlazorInputBase : ComponentBase, IDisposable