Skip to content

Commit

Permalink
Fixes Forms when using .Net 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jbomhold3 committed Sep 7, 2024
1 parent 2cf2781 commit 8e024bd
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 38 deletions.
1 change: 1 addition & 0 deletions BlazorStrap.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
&lt;/Patterns&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XL/@EntryIndexedValue">XL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XXL/@EntryIndexedValue">XXL</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=blazorstrap/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=clickforward/@EntryIndexedValue">True</s:Boolean>
Expand Down
4 changes: 2 additions & 2 deletions src/BlazorStrap-Docs/BlazorStrap-Docs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>BlazorStrap_Docs</RootNamespace>
Expand All @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="Markdig.SyntaxHighlighting" Version="1.0.0-custom" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.*" />
<PackageReference Include="Markdig" Version="0.26.0" />

</ItemGroup>
Expand Down
7 changes: 1 addition & 6 deletions src/BlazorStrap-Docs/Pages/WIP.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
@page "/wip"
@layout WipLayout
<div class="container p-4">
<div class="mb-4">
<BlazorStrap_Docs.Samples.V5.Components.Modal.Modal9 />
</div>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<BSInputCheckbox @bind-Value="OIsActive" IsToggle="true" IsOutlined="true" Color="BSColor.Primary" CheckedValue="true" UnCheckedValue="false">TRIsActive</BSInputCheckbox>
</div>
<!--//-->
<!-- Options Form not shown
<!-- Options Form not shown-->
@code {
// BSTable Parameters
private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</BSForm>
<!--//-->
@code {
<!--\\-->
//<!--\\-->
private Customer customer = new Customer();

void SaveCustomer()
Expand All @@ -53,7 +53,7 @@
public string Postcode { get; set; }
}

<!--//-->
//<!--//-->
public class CustomerValidator : AbstractValidator<Customer>
{
public CustomerValidator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<BSInputCheckbox @bind-Value="OIsActive" IsToggle="true" IsOutlined="true" Color="BSColor.Primary" CheckedValue="true" UnCheckedValue="false">TRIsActive</BSInputCheckbox>
</div>
<!--//-->
<!-- Options Form not shown
<!-- Options Form not shown-->
@code {
// BSTable Parameters
private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</BSForm>
<!--//-->
@code {
<!--\\-->
//<!--\\-->
private Customer customer = new Customer();

void SaveCustomer()
Expand All @@ -52,7 +52,7 @@
public string Postcode { get; set; }
}

<!--//-->
//<!--//-->
public class CustomerValidator : AbstractValidator<Customer>
{
public CustomerValidator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<BSInputCheckbox @bind-Value="OIsActive" IsToggle="true" IsOutlined="true" Color="BSColor.Primary" CheckedValue="true" UnCheckedValue="false">TRIsActive</BSInputCheckbox>
</div>
<!--//-->
<!-- Options Form not shown
<!-- Options Form not shown-->
@code {
// BSTable Parameters
private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</BSForm>
<!--//-->
@code {
<!--\\-->
//<!--\\-->
private Customer customer = new Customer();

void SaveCustomer()
Expand All @@ -53,7 +53,7 @@
public string Postcode { get; set; }
}

<!--//-->
//<!--//-->
public class CustomerValidator : AbstractValidator<Customer>
{
public CustomerValidator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<BSInputCheckbox @bind-Value="OIsActive" IsToggle="true" IsOutlined="true" Color="BSColor.Primary" CheckedValue="true" UnCheckedValue="false">TRIsActive</BSInputCheckbox>
</div>
<!--//-->
<!-- Options Form not shown
<!-- Options Form not shown-->
@code {
// BSTable Parameters
private BSColor OTableColor { get; set; } = BSColor.Default; // Not Set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</BSForm>
<!--//-->
@code {
<!--\\-->
//<!--\\-->
private Customer customer = new Customer();

void SaveCustomer()
Expand All @@ -52,7 +52,7 @@
public string Postcode { get; set; }
}

<!--//-->
//<!--//-->
public class CustomerValidator : AbstractValidator<Customer>
{
public CustomerValidator()
Expand Down
20 changes: 10 additions & 10 deletions src/BlazorStrap-Docs/wwwroot/Static/V5/Content/Tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 \<BSTR\>
Expand Down
6 changes: 3 additions & 3 deletions src/BlazorStrap-WASM/BlazorStrap.WASM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<InvariantGlobalization>true</InvariantGlobalization>
<BlazorCacheBootResources>false</BlazorCacheBootResources>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>BlazorStrap.WASM</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.*" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.*" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorStrap.Server/BlazorStrap.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>BlazorStrap.Server</RootNamespace>
Expand Down
1 change: 1 addition & 0 deletions src/BlazorStrap.V5/Components/Forms/BSInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
builder.AddAttribute(4, "onchange", EventCallback.Factory.CreateBinder<string?>(this, OnChangeEvent, CurrentValueAsString));
builder.AddAttribute(5, "oninput", EventCallback.Factory.CreateBinder<string?>(this, OnInputEvent, CurrentValueAsString));
}

builder.AddAttribute(6, "disabled", IsDisabled);
builder.AddAttribute(7, "readonly", IsReadonly);
builder.AddAttribute(8, "onblur", OnBlurEvent);
Expand Down
6 changes: 3 additions & 3 deletions src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorStrap/BlazorStrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://blazorstrap.io/</PackageProjectUrl>
<RepositoryUrl>https://github.com/chanan/BlazorStrap</RepositoryUrl>
<RootNamespace>BlazorStrap</RootNamespace>
<PackageVersion>5.2.102-Preview3a</PackageVersion>
<PackageVersion>5.2.102-Preview3b</PackageVersion>
<AnalysisLevel>6.0</AnalysisLevel><!--Next Use 5.2.200-Preview1-->
</PropertyGroup>

Expand Down
6 changes: 6 additions & 0 deletions src/BlazorStrap/Shared/Components/DataGrid/BSDataGridBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace BlazorStrap.Shared.Components.DataGrid;

public class BSDataGridBase
{

}
12 changes: 12 additions & 0 deletions src/BlazorStrap/Utilities/BlazorInputBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ namespace BlazorStrap.Utilities;
#if NET8_0
public abstract class BlazorInputBase<TValue> : InputBase<TValue>
{
[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<TValue> : ComponentBase, IDisposable
Expand Down

0 comments on commit 8e024bd

Please sign in to comment.