Skip to content

Commit

Permalink
Merge branch 'master' into pr/899
Browse files Browse the repository at this point in the history
  • Loading branch information
hakenr committed Nov 25, 2024
2 parents 2468d13 + 4b52fca commit 1caa069
Show file tree
Hide file tree
Showing 304 changed files with 5,868 additions and 2,786 deletions.
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "daily"

- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
12 changes: 4 additions & 8 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup .NET 7
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Setup .NET 6
dotnet-version: 9.0.x
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions BlazorAppTest/BlazorAppTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<!-- For local use only. Build fails with Error NETSDK1129: The 'Publish' target is not supported without specifying a target framework. -->
<!--<TargetFrameworks>net8.0;net6.0</TargetFrameworks>-->
<TargetFramework>net8.0</TargetFramework>
<!--<TargetFrameworks>net9.0;net8.0</TargetFrameworks>-->
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<!-- VSTHRD003: Avoid awaiting or returning a Task representing work that was not started within your context as that can lead to deadlocks. -->
<!-- VSTHRD200: Allow HandleXyClick methods (without Async) -> Suppress 'Use "Async" suffix in names of methods that return an awaitable type' -->
Expand Down
2 changes: 1 addition & 1 deletion BlazorAppTest/Pages/HxGridTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<p>Clicked context menu item: @clickedItem?.DisplayName</p>

<h2>Server paging, server sorting</h2>
<HxGrid TItem="CultureInfo" @ref="serverSideGrid" @bind-SelectedDataItem="@serverSideCurrentCultureInfo" DataProvider="@ServerCultureInfosDataProvider" @bind-CurrentUserState="serverSideGridUserState" PageSize="@PageSize" MultiSelectionEnabled="@multiSelectionEnabled" SelectionEnabled="false">
<HxGrid TItem="CultureInfo" PreserveSelection="true" @ref="serverSideGrid" @bind-SelectedDataItem="@serverSideCurrentCultureInfo" DataProvider="@ServerCultureInfosDataProvider" @bind-CurrentUserState="serverSideGridUserState" PageSize="@PageSize" MultiSelectionEnabled="@multiSelectionEnabled" SelectionEnabled="false">
<Columns>
<HxGridColumn TItem="CultureInfo" HeaderText="Display Name" ItemTextSelector="@(item => item.DisplayName)" SortString="@nameof(CultureInfo.DisplayName)" FooterText="This is a footer" />
<HxGridColumn TItem="CultureInfo" HeaderText="Name" ItemTextSelector="@(item => item.Name)" SortString="@nameof(CultureInfo.Name)" />
Expand Down
16 changes: 16 additions & 0 deletions BlazorAppTest/Pages/HxInputDate_Issue859_OnBlur_Test.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@page "/hxinputdate_issue859_onblur_test"

<h3>HxInputDate_Issue859_OnBlur_Test</h3>

<HxInputDate Label="Date" @bind-Value="@_value" @onblur="Test" />
<HxFormValue Label="Value" Value="@_value.ToShortDateString()" />

@code {
public DateTime _value { get; set; }

private Task Test()
{
Console.WriteLine("Test");
return Task.CompletedTask;
}
}
2 changes: 1 addition & 1 deletion BlazorAppTest/Pages/InputsTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
@bind-Value="@model.CultureInfoMultiSelectNames" />


<HxSwitch Text="Switch" @bind-Value="@context.BoolSwitch" ValidationMessageMode="@validationMessageMode" />
<HxSwitch Label="Settings" Text="Switch" @bind-Value="@context.BoolSwitch" ValidationMessageMode="@validationMessageMode" />

<HxSubmit Icon="@BootstrapIcon.Check" Color="ThemeColor.Primary">Submit</HxSubmit>
</HxFilterForm>
Expand Down
8 changes: 5 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
<Product>HAVIT Blazor Library</Product>
<AssemblyTitle>HAVIT Blazor Library</AssemblyTitle>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>

<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>

<!-- aligned NuGet PackageVersion for package-bundles -->
<ComponentsPackagesVersion>4.6.15</ComponentsPackagesVersion>
<GrpcPackagesVersion>1.5.6</GrpcPackagesVersion>
<ComponentsPackagesVersion>4.7.2-pre02</ComponentsPackagesVersion>
<GrpcPackagesVersion>1.6.0</GrpcPackagesVersion>
</PropertyGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" Condition="Exists($([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../')))"/>
Expand Down
100 changes: 52 additions & 48 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,50 +1,54 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Blazored.FluentValidation" Version="2.2.0" />
<PackageVersion Include="bunit.web" Version="1.31.3" />
<PackageVersion Include="Grpc.AspNetCore.Web" Version="2.66.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.66.0" />
<PackageVersion Include="Grpc.Net.Client.Web" Version="2.66.0" />
<PackageVersion Include="Havit.Core" Version="2.0.30" />
<PackageVersion Include="Havit.AspNetCore" Version="2.0.20" />
<PackageVersion Include="LoxSmoke.DocXml" Version="3.7.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="6.0.33" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.8" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.32" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.8" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageVersion Include="Microsoft.Extensions.Localization" Version="8.0.8" />
<PackageVersion Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.8" />
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" Condition="'$(TargetFramework)' != 'net8.0'" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="MSTest" Version="3.6.0" />
<PackageVersion Include="protobuf-net" Version="3.2.30" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Grpc.ClientFactory" Version="1.1.1" />
<PackageVersion Include="SmartComponents.AspNetCore" Version="0.1.0-preview10148" />
<PackageVersion Include="SmartComponents.AspNetCore.Components" Version="0.1.0-preview10148" />
<PackageVersion Include="SmartComponents.Inference.OpenAI" Version="0.1.0-preview10148" />
<PackageVersion Include="SmartComponents.LocalEmbeddings" Version="0.1.0-preview10148" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
<ItemGroup>
<!-- https://github.com/microsoft/MSBuildSdks/tree/main/src/CopyOnWrite -->
<GlobalPackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.322">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</GlobalPackageReference>
</ItemGroup>
<ItemGroup Condition="'$(ProjectName.EndsWith(`Tests`))' == 'False'">
<GlobalPackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</GlobalPackageReference>
</ItemGroup>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<AspNetCoreVersion8>8.0.11</AspNetCoreVersion8>
<AspNetCoreVersion9>9.0.0</AspNetCoreVersion9>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Blazored.FluentValidation" Version="2.2.0" />
<PackageVersion Include="bunit.web" Version="1.36.0" />
<PackageVersion Include="Grpc.AspNetCore.Web" Version="2.67.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.67.0" />
<PackageVersion Include="Grpc.Net.Client.Web" Version="2.67.0" />
<PackageVersion Include="Havit.Core" Version="2.0.31" />
<PackageVersion Include="Havit.AspNetCore" Version="2.0.22" />
<PackageVersion Include="LoxSmoke.DocXml" Version="3.8.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="$(AspNetCoreVersion9)" Condition="'$(TargetFramework)' == 'net9.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="$(AspNetCoreVersion8)" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(AspNetCoreVersion9)" Condition="'$(TargetFramework)' == 'net9.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(AspNetCoreVersion8)" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(AspNetCoreVersion9)" Condition="'$(TargetFramework)' == 'net9.0'"/>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(AspNetCoreVersion8)" Condition="'$(TargetFramework)' == 'net8.0'"/>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="$(AspNetCoreVersion9)" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="$(AspNetCoreVersion9)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Localization" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Localization.Abstractions" Version="9.0.0" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="MSTest" Version="3.6.3" />
<PackageVersion Include="protobuf-net" Version="3.2.45" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.2.2" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.2.2" />
<PackageVersion Include="protobuf-net.Grpc.ClientFactory" Version="1.2.2" />
<PackageVersion Include="SmartComponents.AspNetCore" Version="0.1.0-preview10148" />
<PackageVersion Include="SmartComponents.AspNetCore.Components" Version="0.1.0-preview10148" />
<PackageVersion Include="SmartComponents.Inference.OpenAI" Version="0.1.0-preview10148" />
<PackageVersion Include="SmartComponents.LocalEmbeddings" Version="0.1.0-preview10148" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<!-- https://github.com/microsoft/MSBuildSdks/tree/main/src/CopyOnWrite -->
<GlobalPackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.334">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</GlobalPackageReference>
</ItemGroup>
<ItemGroup Condition="'$(ProjectName.EndsWith(`Tests`))' == 'False'">
<GlobalPackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</GlobalPackageReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace Havit.Blazor.Components.Web.Bootstrap.Tests.Grids;

[TestClass]
public class GridDataProviderRequestExtensionsTests
{
[TestMethod]
public void GridDataProviderRequestExtensions_ApplyGridDataProviderRequest_EntityFrameworkCore_CanBeCompiledForSqlServer()
{
// Arrange
var gridDataProviderRequest = new GridDataProviderRequest<Item>
{
Sorting = new List<SortingItem<Item>>
{
new SortingItem<Item>(null, item => item.A, Collections.SortDirection.Ascending),
new SortingItem<Item>(null, item => item.B, Collections.SortDirection.Descending),
},
StartIndex = 1, // zero based (skipping first item)
Count = 3
};

var dbContext = new TestDbContext();
var query = dbContext.Items.ApplyGridDataProviderRequest(gridDataProviderRequest);

#pragma warning disable EF1001 // Internal EF Core API usage.

// Act

// We just want to check if EF Core is able to compile the query.
// We don't want to execute the query against the database (otherwise we need code migrations, database cleanup, etc.)
_ = dbContext.GetService<IDatabase>().CompileQuery<SingleQueryingEnumerable<Item>>(query.Expression, false);

#pragma warning restore EF1001 // Internal EF Core API usage.

// Assert
// No exception "(IComparable)...) could not be translated. Either rewrite the query in a form that can be translated, ..." was thrown.
}

private class TestDbContext : DbContext // nested class
{
public DbSet<Item> Items { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);

// fake connection string (we don't need a real database connection for this test)
optionsBuilder.UseSqlServer("Data Source=FAKE");
}
}

private class Item // nested class
{
public int Id { get; set; }

public string A { get; set; }
public int B { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="MSTest" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Havit.Blazor.Components.Web.Bootstrap\Havit.Blazor.Components.Web.Bootstrap.csproj" />
<ProjectReference Include="..\Havit.Blazor.Components.Web\Havit.Blazor.Components.Web.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>1591;1701;1702;SA1134;BL0007</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<Content Include="css\lib.css" />
</ItemGroup>

<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
Expand Down Expand Up @@ -42,5 +46,18 @@
<Copy SourceFiles="$(TargetDir)\Havit.Blazor.Components.Web.Bootstrap.Smart.xml" DestinationFolder="$(OutDir)\..\..\..\..\Havit.Blazor.Documentation\xmldoc" />
</Target>

<!-- Causes CSS file to be included in the bundle of scoped CSS, even though it's not scoped -->
<Target Name="AttachCssAsScoped" BeforeTargets="ComputeCssScope">
<ItemGroup>
<_CssToAttach Include="css\lib.css" />
<_CssToAttachWithIntermediatePath Include="@(_CssToAttach)">
<IntermediatePath>$(IntermediateOutputPath)scopedcss\%(Filename).rz.scp.css</IntermediatePath>
</_CssToAttachWithIntermediatePath>
</ItemGroup>
<Copy SourceFiles="@(_CssToAttachWithIntermediatePath)" DestinationFiles="@(_CssToAttachWithIntermediatePath->'%(IntermediatePath)')" />
<ItemGroup>
<_ScopedCssCandidateFile Include="@(_CssToAttachWithIntermediatePath->'%(IntermediatePath)')" RelativePath="@(_CssToAttachWithIntermediatePath->'%(Filename).rz.scp.css')" OriginalItemSpec="@(_CssToAttachWithIntermediatePath->'%(Filename)')" />
</ItemGroup>
</Target>

</Project>
5 changes: 5 additions & 0 deletions Havit.Blazor.Components.Web.Bootstrap.Smart/css/Ignored.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@*
This file is not used at runtime.
It exists only so that the build system will activate the logic that bundles scoped CSS files.
It can be removed if there is any other component with CSS isolation in the project.
*@
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Ignored */
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ public void HxInputDate_NonNullable_EmptyInputShouldRaiseParsingError_Issue892()

// Assert
Assert.AreEqual(new DateTime(2020, 2, 10), myValue, "Model value should remain unchanged.");
#if NET8_0_OR_GREATER
Assert.AreEqual("", cut.Find("input").GetAttribute("value"), "Input value should be empty.");
#endif
Assert.IsNotNull(cut.Find($"div.{HxInputBase<object>.InvalidCssClass}"));
Assert.AreEqual("TestParsingErrorMessage", cut.Find("div.invalid-feedback").TextContent, "ParsingValidationError should be displayed.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ public class HxInputNumberTests : BunitTestBase
[DataRow("cs-CZ", "15 81,549", 1581.55, "1581,55")]
[DataRow("cs-CZ", "1.234", 1.23, "1,23")] // Replace . with , (if possible)
[DataRow("en-US", "1.237", 1.24, "1.24")] // rounding
#if NET8_0_OR_GREATER
[DataRow("en-US", "abc", null, "abc")] // invalid input
#else
// Blazor bug - missing SetUpdatesAttributeName
// https://github.com/havit/Havit.Blazor/issues/468
// https://github.com/dotnet/aspnetcore/pull/46434
[DataRow("en-US", "abc", null, null)] // invalid input
#endif
[DataRow("en-US", "", null, null)] // empty input
public void HxInputNumber_NullableDecimal_ValueConversions(string culture, string input, double? expectedValue, string expectedInputText)
{
Expand Down Expand Up @@ -75,9 +68,7 @@ public void HxInputNumber_NonNullable_EmptyInputShouldRaiseParsingError_Issue892

// Assert
Assert.AreEqual(15, myValue, "Model value should remain unchanged.");
#if NET8_0_OR_GREATER
Assert.AreEqual("", cut.Find("input").GetAttribute("value"), "Input value should be empty.");
#endif
Assert.IsNotNull(cut.Find($"div.{HxInputBase<object>.InvalidCssClass}"));
Assert.AreEqual("TestParsingErrorMessage", cut.Find("div.invalid-feedback").TextContent, "ParsingValidationError should be displayed.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Havit.Blazor.Components.Web.Bootstrap.Tests.Forms;
[TestClass]
public class HxInputTextTests : BunitTestBase
{
#if NET8_0_OR_GREATER
[TestMethod]
public void HxInputText_BindingToArrayOfString_Issue874()
{
Expand Down Expand Up @@ -54,8 +53,6 @@ public void HxInputText_BindingToListOfString_Issue874()
// Assert
Assert.IsFalse(cut.Markup.Contains("maxlength"));
}
#endif


[TestMethod]
public void HxInputText_BindingToArrayOfModel_Issue874()
Expand Down
Loading

0 comments on commit 1caa069

Please sign in to comment.