Adding a TimeProvider service via dependency injection.
+
The default TimeProvider.System time provider.
+
+
+
+ One use for this is for server rendered blazor components where the server local timezone is different to the client timezone.
+ See the following smaple:
+
+
+
Then add the following to your Program.cs. Please expand to provide appropriate error handling, caching, etc. depending on your needs.
+
+
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_RegisterServices.CodeSnippet.cs b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_RegisterServices.CodeSnippet.cs
new file mode 100644
index 00000000..c5e24ddc
--- /dev/null
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_RegisterServices.CodeSnippet.cs
@@ -0,0 +1,39 @@
+using Havit.Blazor.Components.Web; // <------ ADD THIS LINE
+using Havit.Blazor.Components.Web.Bootstrap; // <------ ADD THIS LINE
+using System; // <------ ADD THIS LINE
+
+public static async Task Main(string[] args)
+{
+ var builder = WebAssemblyHostBuilder.CreateDefault(args);
+ builder.RootComponents.Add("app");
+
+ // ... shortened for brevity
+
+ // So the provider can access the context
+ builder.Services.AddHttpContextAccessor(); // <------ ADD THIS LINE
+
+ // Do this before AddHxServices
+ builder.Services.AddScoped(provider => // <------ ADD THIS BLOCK
+ {
+ NavigationManager? navigationManager = provider.GetService();
+ TimeZoneInfo ? requestTimeZoneInfo = null;
+ try
+ {
+ var uri = navigationManager?.ToAbsoluteUri(navigationManager.Uri);
+ if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("tz", out var vals))
+ {
+ requestTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(vals.FirstOrDefault() ?? "Not Found");
+ }
+ }
+ catch (Exception)
+ {
+ // Ignore and fallback to local timezone
+ }
+ requestTimeZoneInfo ??= TimeZoneInfo.Local;
+ return ZonedTimeProvider(requestTimeZoneInfo);
+ });
+
+ builder.Services.AddHxServices(); // <------ ADD THIS LINE
+
+ await builder.Build().RunAsync();
+}
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.cs b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.cs
new file mode 100644
index 00000000..ada1f641
--- /dev/null
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.cs
@@ -0,0 +1,16 @@
+using System;
+
+public class ZonedTimeProvider
+{
+ // Create a time provider that work with a time zone different than the local time zone
+ public class ZonedTimeProvider : TimeProvider
+ {
+ private TimeZoneInfo _zoneInfo;
+ public ZonedTimeProvider(TimeZoneInfo zoneInfo) : base()
+ {
+ _zoneInfo = zoneInfo ?? TimeZoneInfo.Local;
+ }
+ public override TimeZoneInfo LocalTimeZone { get => _zoneInfo; }
+ public static TimeProvider FromLocalTimeZone(TimeZoneInfo zoneInfo) => new ZonedTimeProvider(zoneInfo);
+ }
+}
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.csproj b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.csproj
new file mode 100644
index 00000000..050f4dc7
--- /dev/null
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.csproj
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor
index 864001a9..b23b3249 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor
@@ -37,4 +37,9 @@
(Enabled="false") or set specific CSS class (CssClass="...").
+
+
+
+ You can customize the dropdown calendar timezone by supplying a custom TimeProvider. See HxCalendar TimeZones for more details.
+
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor
index 374f7979..3fd476c9 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor
@@ -36,4 +36,9 @@
(Enabled="false") or set specific CSS class (CssClass="...").
+
+
+
+ You can customize the dropdown calendar timezone by supplying a custom TimeProvider. See HxCalendar TimeZones for more details.
+
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
index 7f0a1ebf..56d1269f 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
@@ -735,6 +735,15 @@
Default is true (tabindex attribute is not rendered).
+
+
+ TimeProvider is resolved in the following order:
+ 1. TimeProvider from this parameter
+ 2. TimeProvider from a CascadingValue
+ 3. TimeProvider from DependencyInjection
+ 4. Default TimeProvider.System
+
+
Refreshes the calendar.
@@ -2695,6 +2704,15 @@
Input-group at the end of the input.
+
+
+ TimeProvider is resolved in the following order:
+ 1. TimeProvider from this parameter
+ 2. TimeProvider from a CascadingValue
+ 3. TimeProvider from DependencyInjection
+ 4. Default TimeProvider.System
+
+
@@ -3875,6 +3893,15 @@
Input-group at the end of the input.
+
+
+ TimeProvider is resolved in the following order:
+ 1. TimeProvider from this parameter
+ 2. TimeProvider from a CascadingValue
+ 3. TimeProvider from DependencyInjection
+ 4. Default TimeProvider.System
+
+
@@ -3975,6 +4002,15 @@
Default customization is configurable with .
+
+
+ TimeProvider is resolved in the following order:
+ 1. TimeProvider from this parameter
+ 2. TimeProvider from a CascadingValue
+ 3. TimeProvider from DependencyInjection
+ 4. Default TimeProvider.System
+
+
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
index 5e610f54..0226a9b8 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
@@ -1,4 +1,5 @@
using System.Globalization;
+using Microsoft.Extensions.DependencyInjection;
namespace Havit.Blazor.Components.Web.Bootstrap;
@@ -105,6 +106,22 @@ static HxCalendar()
///
[Parameter] public bool KeyboardNavigation { get; set; } = true;
+ // Set during SetParameterSetAsync to make it optional
+ protected TimeProvider? TimeProviderFromServices { get; set; }
+ [CascadingParameter] protected TimeProvider? TimeProviderFromCascade { get; set; } = null;
+ ///
+ /// TimeProvider is resolved in the following order:
+ /// 1. TimeProvider from this parameter
+ /// 2. TimeProvider from a CascadingValue
+ /// 3. TimeProvider from DependencyInjection
+ /// 4. Default TimeProvider.System
+ ///
+ [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
+
+ protected TimeProvider TimeProviderEffective => TimeProvider ?? TimeProviderFromCascade ?? TimeProviderFromServices ?? TimeProvider.System;
+
+ [Inject] protected IServiceProvider ServiceProvider { get; set; }
+
private CultureInfo Culture => CultureInfo.CurrentUICulture;
private DayOfWeek FirstDayOfWeek => Culture.DateTimeFormat.FirstDayOfWeek;
protected DateTime DisplayMonthFirstDay => new DateTime(DisplayMonth.Year, DisplayMonth.Month, 1);
@@ -129,6 +146,13 @@ protected DateTime FirstDayToDisplay
private RenderData renderData;
private DateTime? lastKnownValue;
+ public override Task SetParametersAsync(ParameterView parameters)
+ {
+ TimeProviderFromServices = ServiceProvider.GetService();
+ return base.SetParametersAsync(parameters);
+
+ }
+
protected override async Task OnParametersSetAsync()
{
await base.OnParametersSetAsync();
@@ -138,7 +162,7 @@ protected override async Task OnParametersSetAsync()
if (DisplayMonth == default)
{
- await SetDisplayMonthAsync(Value ?? DateTime.Today);
+ await SetDisplayMonthAsync(Value ?? TimeProviderEffective.GetLocalNow().Date);
}
else if ((Value != null) && lastKnownValueChanged && ((DisplayMonth.Year != Value.Value.Year) || (DisplayMonth.Month != Value.Value.Month)))
{
@@ -191,7 +215,7 @@ private void UpdateRenderData()
DateTime currentDay = FirstDayToDisplay;
DateTime valueDay = Value?.Date ?? default;
- DateTime today = DateTime.Today;
+ DateTime today = TimeProviderEffective.GetLocalNow().Date;
for (var week = 0; week < 6; week++)
{
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
index bd394c65..eedafe0d 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
@@ -124,6 +124,14 @@ public class HxInputDate : HxInputBase, IInputWithPlaceholder, I
/// Input-group at the end of the input.
///
[Parameter] public RenderFragment InputGroupEndTemplate { get; set; }
+ ///
+ /// TimeProvider is resolved in the following order:
+ /// 1. TimeProvider from this parameter
+ /// 2. TimeProvider from a CascadingValue
+ /// 3. TimeProvider from DependencyInjection
+ /// 4. Default TimeProvider.System
+ ///
+ [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
[Inject] private IStringLocalizer StringLocalizer { get; set; }
@@ -169,6 +177,7 @@ protected virtual void BuildRenderInputCore(RenderTreeBuilder builder)
builder.AddAttribute(211, nameof(HxInputDateInternal.CalendarDateCustomizationProviderEffective), CalendarDateCustomizationProviderEffective);
builder.AddAttribute(212, nameof(HxInputDateInternal.LabelTypeEffective), labelTypeEffective);
builder.AddAttribute(213, nameof(HxInputDateInternal.FormValueComponent), this);
+ builder.AddAttribute(214, nameof(HxInputDateInternal.TimeProvider), TimeProvider);
builder.AddAttribute(214, nameof(HxInputDateInternal.InputGroupStartText), this.InputGroupStartText);
builder.AddAttribute(215, nameof(HxInputDateInternal.InputGroupEndText), this.InputGroupEndText);
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
index 0106d5a4..f6da7af1 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
@@ -105,6 +105,14 @@ static HxInputDateRange()
///
[Parameter] public CalendarDateCustomizationProviderDelegate CalendarDateCustomizationProvider { get; set; }
protected CalendarDateCustomizationProviderDelegate CalendarDateCustomizationProviderEffective => this.CalendarDateCustomizationProvider ?? this.GetSettings()?.CalendarDateCustomizationProvider ?? GetDefaults().CalendarDateCustomizationProvider;
+ ///
+ /// TimeProvider is resolved in the following order:
+ /// 1. TimeProvider from this parameter
+ /// 2. TimeProvider from a CascadingValue
+ /// 3. TimeProvider from DependencyInjection
+ /// 4. Default TimeProvider.System
+ ///
+ [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
[Inject] private IStringLocalizer StringLocalizer { get; set; }
@@ -134,6 +142,7 @@ protected virtual void BuildRenderInputCore(RenderTreeBuilder builder)
builder.AddAttribute(211, nameof(HxInputDateRangeInternal.MinDateEffective), MinDateEffective);
builder.AddAttribute(212, nameof(HxInputDateRangeInternal.MaxDateEffective), MaxDateEffective);
builder.AddAttribute(220, nameof(HxInputDateRangeInternal.CalendarDateCustomizationProviderEffective), CalendarDateCustomizationProviderEffective);
+ builder.AddAttribute(221, nameof(HxInputDateRangeInternal.TimeProvider), TimeProvider);
builder.AddMultipleAttributes(300, this.AdditionalAttributes);
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
index f4edee4b..c8d51378 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
@@ -50,7 +50,7 @@
@if (EnabledEffective)
{
-
+
@if (ShowClearButtonEffective)
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor.cs
index 1193bbed..8eb06ca3 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor.cs
@@ -56,6 +56,14 @@ public partial class HxInputDateInternal : InputBase, IAsyncDisp
[Parameter] public RenderFragment InputGroupEndTemplate { get; set; }
[Parameter] public IFormValueComponent FormValueComponent { get; set; }
+ ///
+ /// TimeProvider is resolved in the following order:
+ /// 1. TimeProvider from this parameter
+ /// 2. TimeProvider from a CascadingValue
+ /// 3. TimeProvider from DependencyInjection
+ /// 4. Default TimeProvider.System
+ ///
+ [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
[Inject] protected IStringLocalizerFactory StringLocalizerFactory { get; set; }
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateRangeInternal.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateRangeInternal.razor
index bafd15b1..5e73349c 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateRangeInternal.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateRangeInternal.razor
@@ -28,7 +28,7 @@
@if (EnabledEffective)
{
- You can change the timezone used by the calendar by providing a custom TimeZoneProvider.
+ You can change the timezone used by the calendar by providing a custom TimeProvider.
TimeProvider is resolved in the following order:
Adding a TimeProvider service via dependency injection.
The default TimeProvider.System time provider.
One use for this is for server rendered blazor components where the server local timezone is different to the client timezone.
- See the following smaple:
+ See the following sample:
Then add the following to your Program.cs. Please expand to provide appropriate error handling, caching, etc. depending on your needs.
-
+
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_RegisterServices.CodeSnippet.cs b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_RegisterServices.CodeSnippet.cs
deleted file mode 100644
index c5e24ddc..00000000
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_RegisterServices.CodeSnippet.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using Havit.Blazor.Components.Web; // <------ ADD THIS LINE
-using Havit.Blazor.Components.Web.Bootstrap; // <------ ADD THIS LINE
-using System; // <------ ADD THIS LINE
-
-public static async Task Main(string[] args)
-{
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
- builder.RootComponents.Add("app");
-
- // ... shortened for brevity
-
- // So the provider can access the context
- builder.Services.AddHttpContextAccessor(); // <------ ADD THIS LINE
-
- // Do this before AddHxServices
- builder.Services.AddScoped(provider => // <------ ADD THIS BLOCK
- {
- NavigationManager? navigationManager = provider.GetService();
- TimeZoneInfo ? requestTimeZoneInfo = null;
- try
- {
- var uri = navigationManager?.ToAbsoluteUri(navigationManager.Uri);
- if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("tz", out var vals))
- {
- requestTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(vals.FirstOrDefault() ?? "Not Found");
- }
- }
- catch (Exception)
- {
- // Ignore and fallback to local timezone
- }
- requestTimeZoneInfo ??= TimeZoneInfo.Local;
- return ZonedTimeProvider(requestTimeZoneInfo);
- });
-
- builder.Services.AddHxServices(); // <------ ADD THIS LINE
-
- await builder.Build().RunAsync();
-}
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_TimeProvider.CodeSnippet.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_TimeProvider.CodeSnippet.razor
new file mode 100644
index 00000000..0fcad43e
--- /dev/null
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_TimeProvider.CodeSnippet.razor
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+@code {
+
+ static TimeProvider usersTimeProvider = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("UTC-11"));
+
+ // OR
+
+ public static CalendarSettings UsersCalendarSettings => new()
+ {
+ TimeProvider = usersTimeProvider,
+ };
+
+ // OR
+
+ HxCalendar.Defaults.TimeProvider = usersTimeProvider
+
+}
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.cs b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.cs
index ada1f641..9fe4401f 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.cs
@@ -11,6 +11,5 @@ public ZonedTimeProvider(TimeZoneInfo zoneInfo) : base()
_zoneInfo = zoneInfo ?? TimeZoneInfo.Local;
}
public override TimeZoneInfo LocalTimeZone { get => _zoneInfo; }
- public static TimeProvider FromLocalTimeZone(TimeZoneInfo zoneInfo) => new ZonedTimeProvider(zoneInfo);
}
}
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
index b0a7d857..c82f149c 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
@@ -742,11 +742,11 @@
- TimeProvider is resolved in the following order:
- 1. TimeProvider from this parameter
- 2. GetSettings TimeProvider
- 3. DefaultSettings TimeProvider
- 4. TimeProvider from DependencyInjection
+ TimeProvider is resolved in the following order:
+ 1. TimeProvider from this parameter
+ 2. Settings TimeProvider (configurable from )
+ 3. Defaults TimeProvider (configurable from )
+ 4. TimeProvider from DependencyInjection
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
index 1266153f..5754d747 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
@@ -109,11 +109,11 @@ static HxCalendar()
// Set during SetParameterSetAsync to make it optional
[Inject] public TimeProvider TimeProviderFromServices { get; set; }
///
- /// TimeProvider is resolved in the following order:
- /// 1. TimeProvider from this parameter
- /// 2. GetSettings TimeProvider
- /// 3. DefaultSettings TimeProvider
- /// 4. TimeProvider from DependencyInjection
+ /// TimeProvider is resolved in the following order:
+ /// 1. TimeProvider from this parameter
+ /// 2. Settings TimeProvider (configurable from )
+ /// 3. Defaults TimeProvider (configurable from )
+ /// 4. TimeProvider from DependencyInjection
///
[Parameter] public TimeProvider? TimeProvider { get; set; } = null;
From 9336cb99ec1c96beba2dd2ffcb2a207697744b43 Mon Sep 17 00:00:00 2001
From: Glen Blanchard
Date: Thu, 21 Sep 2023 08:08:17 +1000
Subject: [PATCH 07/40] Address code review changes
---
BlazorAppTest/BlazorAppTest.csproj | 4 ---
.../Pages/HxCalendar_Issue597_Test.razor | 31 ++++++++-----------
BlazorAppTest/Startup.cs | 1 -
.../HxCalendar_Documentation.razor | 16 +++++-----
.../HxCalendar_TimeProvider.CodeSnippet.razor | 15 ++++-----
...endar_ZonedTimeProvider.CodeSnippet.csproj | 3 --
.../HxInputDate_Documentation.razor | 4 +--
.../HxInputDateRange_Documentation.razor | 4 +--
.../Havit.Blazor.Components.Web.Bootstrap.xml | 30 ++++++++++++++++--
.../Calendar/HxCalendar.razor.cs | 3 +-
.../Forms/HxInputDate.cs | 13 ++++++--
.../Forms/HxInputDate.nongeneric.cs | 2 +-
.../Forms/HxInputDateRange.cs | 13 +++++++-
.../Forms/InputDatePredefinedDatesItem.cs | 15 +++++++--
.../Forms/Internal/HxInputDateInternal.razor | 2 +-
...vit.Blazor.Components.Web.Bootstrap.csproj | 1 -
16 files changed, 102 insertions(+), 55 deletions(-)
delete mode 100644 Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.csproj
diff --git a/BlazorAppTest/BlazorAppTest.csproj b/BlazorAppTest/BlazorAppTest.csproj
index d36a0e48..d9f5491d 100644
--- a/BlazorAppTest/BlazorAppTest.csproj
+++ b/BlazorAppTest/BlazorAppTest.csproj
@@ -21,8 +21,4 @@
-
-
-
-
diff --git a/BlazorAppTest/Pages/HxCalendar_Issue597_Test.razor b/BlazorAppTest/Pages/HxCalendar_Issue597_Test.razor
index 512d20f8..fa476de1 100644
--- a/BlazorAppTest/Pages/HxCalendar_Issue597_Test.razor
+++ b/BlazorAppTest/Pages/HxCalendar_Issue597_Test.razor
@@ -20,30 +20,25 @@
@code {
+ private static TimeProvider timeProviderUtc = new ZonedTimeProvider(TimeZoneInfo.Utc);
- public class AppCalendarSettings
+ private class AppCalendarSettings
{
- public static TimeProvider timeProviderUtc = new ZonedTimeProvider(TimeZoneInfo.Utc);
- public static TimeProvider timeProviderUtc11 = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("UTC-11"));
- public static TimeProvider timeProviderUtc13 = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("Samoa Standard Time"));
+ private static TimeProvider timeProviderUtc11 = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("UTC-11"));
+ private static TimeProvider timeProviderUtc13 = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("Samoa Standard Time"));
public static CalendarSettings AmericanSamoa => new()
- {
- TimeProvider = timeProviderUtc11,
- };
+ {
+ TimeProvider = timeProviderUtc11,
+ };
public static CalendarSettings Samoa => new()
- {
- TimeProvider = timeProviderUtc13,
- };
+ {
+ TimeProvider = timeProviderUtc13,
+ };
}
-
- protected override void OnInitialized()
- {
- base.OnInitialized();
- }
-
+
}
diff --git a/BlazorAppTest/Startup.cs b/BlazorAppTest/Startup.cs
index 10e5ead1..4deb3c12 100644
--- a/BlazorAppTest/Startup.cs
+++ b/BlazorAppTest/Startup.cs
@@ -1,6 +1,5 @@
using System.Globalization;
using BlazorAppTest.Resources;
-using BlazorAppTest.Pages.HxCalendarComponents;
using Havit.Blazor.Components.Web;
using Havit.Blazor.GoogleTagManager;
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_Documentation.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_Documentation.razor
index cd86884a..b52cdf8e 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_Documentation.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_Documentation.razor
@@ -21,25 +21,27 @@
and HxInputDateRange components. See their documentation for more info.
-
+
- You can change the timezone used by the calendar by providing a custom TimeProvider.
+ You can change the time zone used by the calendar by providing a custom TimeProvider.
TimeProvider is resolved in the following order:
Adding a TimeProvider service via dependency injection.
The default TimeProvider.System time provider.
- One use for this is for server rendered blazor components where the server local timezone is different to the client timezone.
+ One use for this is for server rendered blazor components where the server local time zone is different to the client time zone.
See the following sample:
-
Then add the following to your Program.cs. Please expand to provide appropriate error handling, caching, etc. depending on your needs.
+
Use the ZonedTimeProvider. Ensure that Defaults are configured in Program.cs or where you maintain your other defaults.
+ Please expand to provide appropriate error handling, caching, etc. depending on your needs.
+
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_TimeProvider.CodeSnippet.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_TimeProvider.CodeSnippet.razor
index 0fcad43e..b7565113 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_TimeProvider.CodeSnippet.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_TimeProvider.CodeSnippet.razor
@@ -1,24 +1,25 @@
-
+
-
+
@code {
- static TimeProvider usersTimeProvider = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("UTC-11"));
+ TimeProvider usersTimeProvider = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("UTC-11"));
// OR
public static CalendarSettings UsersCalendarSettings => new()
- {
- TimeProvider = usersTimeProvider,
- };
+ {
+ TimeProvider = usersTimeProvider,
+ };
// OR
- HxCalendar.Defaults.TimeProvider = usersTimeProvider
+ // Program.cs or somewhere where you maintain the defaults
+ HxCalendar.Defaults.TimeProvider = new ZonedTimeProvider(TimeZoneInfo.FindSystemTimeZoneById("E. Australia Standard Time"));
}
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.csproj b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.csproj
deleted file mode 100644
index 050f4dc7..00000000
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxCalendarDoc/HxCalendar_ZonedTimeProvider.CodeSnippet.csproj
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor
index b23b3249..6771e6a2 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateDoc/HxInputDate_Documentation.razor
@@ -38,8 +38,8 @@
-
+
- You can customize the dropdown calendar timezone by supplying a custom TimeProvider. See HxCalendar TimeZones for more details.
+ You can customize the dropdown calendar time zone by supplying a custom TimeProvider. See HxCalendar time zones for more details.
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor
index 3fd476c9..bddb9093 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxInputDateRangeDoc/HxInputDateRange_Documentation.razor
@@ -37,8 +37,8 @@
-
+
- You can customize the dropdown calendar timezone by supplying a custom TimeProvider. See HxCalendar TimeZones for more details.
+ You can customize the dropdown calendar time zone by supplying a custom TimeProvider. See HxCalendar time zones for more details.
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
index c82f149c..a776584f 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
@@ -3889,6 +3889,15 @@
Input-group at the end of the input.
+
+
+ TimeProvider is resolved in the following order:
+ 1. TimeProvider from this parameter
+ 2. Settings TimeProvider (configurable from )
+ 3. Defaults TimeProvider (configurable from )
+ 4. TimeProvider from DependencyInjection
+
+
@@ -3989,6 +3998,15 @@
Default customization is configurable with .
+
+
+ TimeProvider is resolved in the following order:
+ 1. TimeProvider from this parameter
+ 2. Settings TimeProvider (configurable from )
+ 3. Defaults TimeProvider (configurable from )
+ 4. TimeProvider from DependencyInjection
+
+
@@ -4837,15 +4855,23 @@
- Date.
+ Date. Overrides any
Used to supply the date at runtime especially to use
- a TimeProvider
+ a TimeProvider. Not used if is set.
+
+
+ Defaults to returning the otherwise calls .
+ Used to resolve the date at runtime, particularly when a TimeProvider is needed.
+
+
+
+
Item for .
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
index 5754d747..cabe7edc 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
@@ -107,7 +107,8 @@ static HxCalendar()
[Parameter] public bool KeyboardNavigation { get; set; } = true;
// Set during SetParameterSetAsync to make it optional
- [Inject] public TimeProvider TimeProviderFromServices { get; set; }
+ [Inject] protected TimeProvider TimeProviderFromServices { get; set; }
+
///
/// TimeProvider is resolved in the following order:
/// 1. TimeProvider from this parameter
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
index 899d3fa8..8b00d364 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
@@ -125,9 +125,18 @@ public class HxInputDate : HxInputBase, IInputWithPlaceholder, I
///
[Parameter] public RenderFragment InputGroupEndTemplate { get; set; }
- [Inject] public TimeProvider TimeProviderFromServices { get; set; }
+ [Inject] protected TimeProvider TimeProviderFromServices { get; set; }
- protected TimeProvider TimeProviderEffective => GetSettings()?.TimeProvider ?? GetDefaults().TimeProvider ?? TimeProviderFromServices;
+ ///
+ /// TimeProvider is resolved in the following order:
+ /// 1. TimeProvider from this parameter
+ /// 2. Settings TimeProvider (configurable from )
+ /// 3. Defaults TimeProvider (configurable from )
+ /// 4. TimeProvider from DependencyInjection
+ ///
+ [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
+
+ protected TimeProvider TimeProviderEffective => TimeProvider ?? GetSettings()?.TimeProvider ?? GetDefaults().TimeProvider ?? TimeProviderFromServices;
[Inject] private IStringLocalizer StringLocalizer { get; set; }
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.nongeneric.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.nongeneric.cs
index 940912c9..92ac69c1 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.nongeneric.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.nongeneric.cs
@@ -20,7 +20,7 @@ static HxInputDate()
MaxDate = HxCalendar.DefaultMaxDate,
ShowClearButton = true,
ShowPredefinedDates = true,
- PredefinedDates = new List() { new InputDatePredefinedDatesItem() { Label = "Today", ResourceType = typeof(HxInputDate), DateSelector = (timeProvider) => timeProvider.GetLocalNow().LocalDateTime } },
+ PredefinedDates = new List() { new InputDatePredefinedDatesItem() { Label = "Today", ResourceType = typeof(HxInputDate), DateSelector = (timeProvider) => timeProvider.GetLocalNow().LocalDateTime.Date } },
};
}
}
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
index 4e79ebd8..9cb588a9 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
@@ -105,7 +105,18 @@ static HxInputDateRange()
///
[Parameter] public CalendarDateCustomizationProviderDelegate CalendarDateCustomizationProvider { get; set; }
protected CalendarDateCustomizationProviderDelegate CalendarDateCustomizationProviderEffective => this.CalendarDateCustomizationProvider ?? this.GetSettings()?.CalendarDateCustomizationProvider ?? GetDefaults().CalendarDateCustomizationProvider;
- protected TimeProvider TimeProviderEffective => GetSettings()?.TimeProvider ?? GetDefaults().TimeProvider;
+
+ [Inject] protected TimeProvider TimeProviderFromServices { get; set; }
+
+ ///
+ /// TimeProvider is resolved in the following order:
+ /// 1. TimeProvider from this parameter
+ /// 2. Settings TimeProvider (configurable from )
+ /// 3. Defaults TimeProvider (configurable from )
+ /// 4. TimeProvider from DependencyInjection
+ ///
+ [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
+ protected TimeProvider TimeProviderEffective => TimeProvider ?? GetSettings()?.TimeProvider ?? GetDefaults().TimeProvider ?? TimeProviderFromServices;
[Inject] private IStringLocalizer StringLocalizer { get; set; }
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDatePredefinedDatesItem.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDatePredefinedDatesItem.cs
index 2df49215..91be57ab 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDatePredefinedDatesItem.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDatePredefinedDatesItem.cs
@@ -16,13 +16,24 @@ public class InputDatePredefinedDatesItem
public Type ResourceType { get; set; }
///
- /// Date.
+ /// Date. Overrides any
///
public DateTime? Date { get; set; }
///
/// Used to supply the date at runtime especially to use
- /// a TimeProvider
+ /// a TimeProvider. Not used if is set.
///
public Func DateSelector { get; set; }
+
+ ///
+ /// Defaults to returning the otherwise calls .
+ /// Used to resolve the date at runtime, particularly when a TimeProvider is needed.
+ ///
+ ///
+ ///
+ public DateTime GetDateEffective(TimeProvider timeProvider)
+ {
+ return Date ?? DateSelector(timeProvider);
+ }
}
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
index 77b5ef01..90ab6953 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
@@ -61,7 +61,7 @@
{
foreach (var item in PredefinedDatesEffective)
{
-
+
}
}
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj b/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj
index 2734a0cc..d7e67ed7 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj
+++ b/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj
@@ -38,7 +38,6 @@
-
From c285708a1c496d26eb10cce91096b2ecd7a57350 Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Mon, 25 Sep 2023 14:59:16 +0200
Subject: [PATCH 08/40] release 4.2.1-TimeProvider (from branch)
---
Directory.Build.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 6f1b04d8..aafd2eb7 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -11,7 +11,7 @@
latest
- 4.2.1
+ 4.2.1-TimeProvider1.4.4
From 968ad209de925420278544ebc94105b0d29dc2e0 Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Mon, 25 Sep 2023 15:54:30 +0200
Subject: [PATCH 09/40] #597 [HxCalendar] Add TimeZone support - code cleanup
---
.../XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml | 4 ++--
.../Calendar/CalendarSettings.cs | 4 ++--
.../Calendar/HxCalendar.razor.cs | 2 +-
Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs | 5 ++---
.../Forms/HxInputDateRange.cs | 2 +-
.../Forms/InputDateRangeSettings.cs | 2 +-
.../Forms/InputDateSettings.cs | 2 +-
7 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
index 865963a2..e96b055d 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
+++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml
@@ -644,7 +644,7 @@
- TimeProvider to customise the today date
+ TimeProvider to customize the today date
@@ -3893,7 +3893,7 @@
TimeProvider is resolved in the following order:
1. TimeProvider from this parameter
- 2. Settings TimeProvider (configurable from )
+ 2. Settings TimeProvider (configurable from )
3. Defaults TimeProvider (configurable from )
4. TimeProvider from DependencyInjection
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Calendar/CalendarSettings.cs b/Havit.Blazor.Components.Web.Bootstrap/Calendar/CalendarSettings.cs
index 6a8c5632..6814ae4a 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Calendar/CalendarSettings.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Calendar/CalendarSettings.cs
@@ -21,8 +21,8 @@ public record CalendarSettings
public CalendarDateCustomizationProviderDelegate DateCustomizationProvider { get; set; }
///
- /// TimeProvider to customise the today date
+ /// TimeProvider to customize the today date
///
- public TimeProvider? TimeProvider { get; set; }
+ public TimeProvider TimeProvider { get; set; }
}
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
index cabe7edc..a10d758c 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Calendar/HxCalendar.razor.cs
@@ -116,7 +116,7 @@ static HxCalendar()
/// 3. Defaults TimeProvider (configurable from )
/// 4. TimeProvider from DependencyInjection
///
- [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
+ [Parameter] public TimeProvider TimeProvider { get; set; } = null;
protected TimeProvider TimeProviderEffective => TimeProvider ?? GetSettings()?.TimeProvider ?? GetDefaults()?.TimeProvider ?? TimeProviderFromServices;
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
index 8b00d364..94357d48 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDate.cs
@@ -130,12 +130,11 @@ public class HxInputDate : HxInputBase, IInputWithPlaceholder, I
///
/// TimeProvider is resolved in the following order:
/// 1. TimeProvider from this parameter
- /// 2. Settings TimeProvider (configurable from )
+ /// 2. Settings TimeProvider (configurable from )
/// 3. Defaults TimeProvider (configurable from )
/// 4. TimeProvider from DependencyInjection
///
- [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
-
+ [Parameter] public TimeProvider TimeProvider { get; set; } = null;
protected TimeProvider TimeProviderEffective => TimeProvider ?? GetSettings()?.TimeProvider ?? GetDefaults().TimeProvider ?? TimeProviderFromServices;
[Inject] private IStringLocalizer StringLocalizer { get; set; }
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
index 9cb588a9..793c7add 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputDateRange.cs
@@ -115,7 +115,7 @@ static HxInputDateRange()
/// 3. Defaults TimeProvider (configurable from )
/// 4. TimeProvider from DependencyInjection
///
- [Parameter] public TimeProvider? TimeProvider { get; set; } = null;
+ [Parameter] public TimeProvider TimeProvider { get; set; } = null;
protected TimeProvider TimeProviderEffective => TimeProvider ?? GetSettings()?.TimeProvider ?? GetDefaults().TimeProvider ?? TimeProviderFromServices;
[Inject] private IStringLocalizer StringLocalizer { get; set; }
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateRangeSettings.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateRangeSettings.cs
index 36bf2dbd..fbc1b4bc 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateRangeSettings.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateRangeSettings.cs
@@ -45,5 +45,5 @@ public record InputDateRangeSettings : InputSettings, IInputSettingsWithSize
///
/// TimeProvider used to get DateTime.Today
///
- public TimeProvider? TimeProvider { get; set; }
+ public TimeProvider TimeProvider { get; set; }
}
\ No newline at end of file
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateSettings.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateSettings.cs
index 9cf9175d..5ca41e75 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateSettings.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/InputDateSettings.cs
@@ -50,5 +50,5 @@ public record InputDateSettings : InputSettings, IInputSettingsWithSize
///
/// TimeProvider to use, note: override the 'Today' in PredefinedDates
///
- public TimeProvider? TimeProvider { get; set; }
+ public TimeProvider TimeProvider { get; set; }
}
\ No newline at end of file
From c3e109e768fa41c82ab7be6680cd80dcae3a38f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikul=C3=A1=C5=A1=20Hobl=C3=ADk?=
Date: Wed, 8 Nov 2023 17:38:32 +0100
Subject: [PATCH 10/40] [HxMultiSelect] The italian resource for the component
has a wrong name #652
---
.../{HxMultiSelect-it-IT.resx => HxMultiSelect.it-IT.resx} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename Havit.Blazor.Components.Web.Bootstrap/Resources/{HxMultiSelect-it-IT.resx => HxMultiSelect.it-IT.resx} (100%)
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Resources/HxMultiSelect-it-IT.resx b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxMultiSelect.it-IT.resx
similarity index 100%
rename from Havit.Blazor.Components.Web.Bootstrap/Resources/HxMultiSelect-it-IT.resx
rename to Havit.Blazor.Components.Web.Bootstrap/Resources/HxMultiSelect.it-IT.resx
From 97147438768f989660880c5bc6944da32e5bd529 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clavek=2C=20Ond=C5=99ej?=
Date: Thu, 9 Nov 2023 22:12:49 +0100
Subject: [PATCH 11/40] HxSearchBox - fix clear button padding if there is
delete icon
---
.../Forms/SearchBox/HxSearchBox.razor | 1 +
.../Forms/SearchBox/HxSearchBox.razor.cs | 5 +++++
.../Forms/SearchBox/HxSearchBox.razor.css | 8 ++++++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor
index c3c0a844..f9ef6573 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor
@@ -43,6 +43,7 @@
class="@CssClassHelper.Combine(
"form-control",
(!HasInputGroupEnd && HasInputGroups ? "hx-search-box-input-with-search-icon" : null),
+ (HasClearButton ? "hx-search-box-input-with-clear-icon" : null),
InputCssClassEffective)" />
@if (!string.IsNullOrEmpty(Label) && LabelType == Havit.Blazor.Components.Web.Bootstrap.LabelType.Floating)
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.cs
index 878ec232..29891ed1 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.cs
@@ -218,6 +218,10 @@ public partial class HxSearchBox : IAsyncDisposable
protected bool HasInputGroups => HasInputGroupStart || HasInputGroupEnd;
private bool HasInputGroupStart => !String.IsNullOrWhiteSpace(InputGroupStartText) || (InputGroupStartTemplate is not null);
private bool HasInputGroupEnd => !String.IsNullOrWhiteSpace(InputGroupEndText) || (InputGroupEndTemplate is not null);
+ private bool HasClearButton => !HasInputGroupEnd
+ && !dataProviderInProgress
+ && !string.IsNullOrEmpty(TextQuery)
+ && (ClearIconEffective is not null);
private string dropdownToggleElementId = "hx" + Guid.NewGuid().ToString("N");
private string dropdownId = "hx" + Guid.NewGuid().ToString("N");
@@ -239,6 +243,7 @@ public partial class HxSearchBox : IAsyncDisposable
private DotNetObjectReference> dotnetObjectReference;
private bool clickIsComing;
private bool disposed = false;
+
public HxSearchBox()
{
dotnetObjectReference = DotNetObjectReference.Create(this);
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css
index f99c4def..9012104c 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css
@@ -18,8 +18,12 @@
}
::deep .hx-search-box-input-with-search-icon {
- border-top-right-radius: 0.375rem !important;
- border-bottom-right-radius: 0.375rem !important;
+ border-top-right-radius: 0.375rem !important;
+ border-bottom-right-radius: 0.375rem !important;
+}
+
+::deep .hx-search-box-input-with-clear-icon {
+ padding-right: 2rem;
}
.dropdown-item:not(:active) ::deep .hx-search-box-item-title {
From bfa7e68cfbe7f9e1f767d98e8a77acdfab20914f Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Fri, 10 Nov 2023 13:09:17 +0100
Subject: [PATCH 12/40] static dictionarties - typos
---
.../Services/DataStores/DictionaryStaticDataStore.cs | 10 +++++-----
.../Services/DataStores/IDictionaryStaticDataStore.cs | 4 ++--
.../Services/DataStores/IStaticDataStore.cs | 4 ++--
.../Services/DataStores/StaticDataStore.cs | 10 +++++-----
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/Havit.Blazor.Components.Web/Services/DataStores/DictionaryStaticDataStore.cs b/Havit.Blazor.Components.Web/Services/DataStores/DictionaryStaticDataStore.cs
index 801a1305..41161b15 100644
--- a/Havit.Blazor.Components.Web/Services/DataStores/DictionaryStaticDataStore.cs
+++ b/Havit.Blazor.Components.Web/Services/DataStores/DictionaryStaticDataStore.cs
@@ -5,15 +5,15 @@
///
///
/// Uses in-memory Dictionary to store the data.
-/// Does not preload data, the data get loaded within first data-retriaval call.
-/// Does not implement any memory-release logic, the data get refreshed within data-retrivals where returns true.
+/// Does not preload data, the data get loaded within first data-retrieval call.
+/// Does not implement any memory-release logic, the data get refreshed within data-retrievals where returns true.
///
public abstract class DictionaryStaticDataStore : IDictionaryStaticDataStore
{
protected Dictionary Data;
///
- /// Template method to implement the data retrival logic.
+ /// Template method to implement the data retrieval logic.
/// You should never call this method directly, use to load data.
/// This method is sequential (does not allow parallel runs), just take care of the data retrieval.
/// Must return non-null value, use Enumerable.Empty if needed.
@@ -116,9 +116,9 @@ public void Clear()
}
///
- /// To be called before any data-retrival to load/refresh the data.
+ /// To be called before any data-retrieval to load/refresh the data.
/// Is automatically called before all asynchronous data-retrieval calls.
- /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronous API.
/// Uses to check for refreshment request.
/// Uses lock to prevent multiple parallel loads.
///
diff --git a/Havit.Blazor.Components.Web/Services/DataStores/IDictionaryStaticDataStore.cs b/Havit.Blazor.Components.Web/Services/DataStores/IDictionaryStaticDataStore.cs
index c8d1e1c0..2d6c929d 100644
--- a/Havit.Blazor.Components.Web/Services/DataStores/IDictionaryStaticDataStore.cs
+++ b/Havit.Blazor.Components.Web/Services/DataStores/IDictionaryStaticDataStore.cs
@@ -6,9 +6,9 @@
public interface IDictionaryStaticDataStore
{
///
- /// To be called before any data-retrival to load/refresh the data.
+ /// To be called before any data-retrieval to load/refresh the data.
/// Is automatically called before all asynchronous data-retrieval calls.
- /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any synchronous API.
///
Task EnsureDataAsync();
diff --git a/Havit.Blazor.Components.Web/Services/DataStores/IStaticDataStore.cs b/Havit.Blazor.Components.Web/Services/DataStores/IStaticDataStore.cs
index 63391d4c..80ba59ef 100644
--- a/Havit.Blazor.Components.Web/Services/DataStores/IStaticDataStore.cs
+++ b/Havit.Blazor.Components.Web/Services/DataStores/IStaticDataStore.cs
@@ -4,9 +4,9 @@ public interface IStaticDataStore
{
///
- /// To be called before any data-retrival to load/refresh the data.
+ /// To be called before any data-retrieval to load/refresh the data.
/// Is automatically called before all asynchronous data-retrieval calls.
- /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronous API.
///
Task EnsureDataAsync();
diff --git a/Havit.Blazor.Components.Web/Services/DataStores/StaticDataStore.cs b/Havit.Blazor.Components.Web/Services/DataStores/StaticDataStore.cs
index 8cd4b143..4fcf9466 100644
--- a/Havit.Blazor.Components.Web/Services/DataStores/StaticDataStore.cs
+++ b/Havit.Blazor.Components.Web/Services/DataStores/StaticDataStore.cs
@@ -5,8 +5,8 @@
///
///
/// Uses in-memory static field to store the data.
-/// Does not preload data, the data get loaded within first data-retriaval call.
-/// Does not implement any memory-release logic, the data get refreshed within data-retrivals where returns true.
+/// Does not preload data, the data get loaded within first data-retrieval call.
+/// Does not implement any memory-release logic, the data get refreshed within data-retrievals where returns true.
///
public abstract class StaticDataStore : IStaticDataStore
{
@@ -14,7 +14,7 @@ public abstract class StaticDataStore : IStaticDataStore
protected TValue Data;
///
- /// Template method to implement the data retrival logic.
+ /// Template method to implement the data retrieval logic.
/// You should never call this method directly, use to load data.
/// This method is sequential (does not allow parallel runs), just take care of the data retrieval.
/// Must return non-default value.
@@ -64,9 +64,9 @@ public void Clear()
}
///
- /// To be called before any data-retrival to load/refresh the data.
+ /// To be called before any data-retrieval to load/refresh the data.
/// Is automatically called before all asynchronous data-retrieval calls.
- /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ /// You have to call this method on your own (e.g. in OnInitializedAsync) before calling any synchronous API.
/// Uses to check for refreshment request.
/// Uses lock to prevent multiple parallel loads.
///
From e9c7082d481167b95a3365dbe0dd4be2dbf3ea73 Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Sat, 11 Nov 2023 01:42:27 +0100
Subject: [PATCH 13/40] fix #659 [HxInputText] Generates chip for String.Empty
value
---
.../Forms/HxInputBase.cs | 5 ++++
.../XmlDoc/Havit.Blazor.Components.Web.xml | 28 +++++++++----------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs
index 5d3896fe..e268a544 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs
@@ -352,6 +352,11 @@ protected virtual void RenderChipGenerator(RenderTreeBuilder builder)
///
protected virtual bool ShouldRenderChipGenerator()
{
+ if (CurrentValue is string currentValueString)
+ {
+ // fixes #659 [HxInputText] Generates chip for String.Empty value
+ return !String.IsNullOrEmpty(currentValueString);
+ }
return !EqualityComparer.Default.Equals(CurrentValue, default(TValue));
}
diff --git a/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.xml b/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.xml
index bcebf7b8..4da8c7b0 100644
--- a/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.xml
+++ b/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.xml
@@ -871,13 +871,13 @@
Uses in-memory Dictionary to store the data.
- Does not preload data, the data get loaded within first data-retriaval call.
- Does not implement any memory-release logic, the data get refreshed within data-retrivals where returns true.
+ Does not preload data, the data get loaded within first data-retrieval call.
+ Does not implement any memory-release logic, the data get refreshed within data-retrievals where returns true.
- Template method to implement the data retrival logic.
+ Template method to implement the data retrieval logic.
You should never call this method directly, use to load data.
This method is sequential (does not allow parallel runs), just take care of the data retrieval.
Must return non-null value, use Enumerable.Empty if needed.
@@ -937,9 +937,9 @@
- To be called before any data-retrival to load/refresh the data.
+ To be called before any data-retrieval to load/refresh the data.
Is automatically called before all asynchronous data-retrieval calls.
- You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronous API.
Uses to check for refreshment request.
Uses lock to prevent multiple parallel loads.
@@ -951,9 +951,9 @@
- To be called before any data-retrival to load/refresh the data.
+ To be called before any data-retrieval to load/refresh the data.
Is automatically called before all asynchronous data-retrieval calls.
- You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ You have to call this method on your own (e.g. in OnInitializedAsync) before calling any synchronous API.
@@ -998,9 +998,9 @@
- To be called before any data-retrival to load/refresh the data.
+ To be called before any data-retrieval to load/refresh the data.
Is automatically called before all asynchronous data-retrieval calls.
- You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronous API.
@@ -1029,13 +1029,13 @@
Uses in-memory static field to store the data.
- Does not preload data, the data get loaded within first data-retriaval call.
- Does not implement any memory-release logic, the data get refreshed within data-retrivals where returns true.
+ Does not preload data, the data get loaded within first data-retrieval call.
+ Does not implement any memory-release logic, the data get refreshed within data-retrievals where returns true.
- Template method to implement the data retrival logic.
+ Template method to implement the data retrieval logic.
You should never call this method directly, use to load data.
This method is sequential (does not allow parallel runs), just take care of the data retrieval.
Must return non-default value.
@@ -1070,9 +1070,9 @@
- To be called before any data-retrival to load/refresh the data.
+ To be called before any data-retrieval to load/refresh the data.
Is automatically called before all asynchronous data-retrieval calls.
- You have to call this method on your own (e.g. in OnInitializedAsync) before calling any sychronnous API.
+ You have to call this method on your own (e.g. in OnInitializedAsync) before calling any synchronous API.
Uses to check for refreshment request.
Uses lock to prevent multiple parallel loads.
From 7bb25b315ae020db7f08b6d8d8f4757170a32e6e Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Sat, 11 Nov 2023 01:42:55 +0100
Subject: [PATCH 14/40] release 4.2.7
---
Directory.Build.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 56683500..7454d0ac 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -11,7 +11,7 @@
latest
- 4.2.6
+ 4.2.71.4.4
From 3a2ae7c54dc010d82b418e80f3dae58bd70d5b50 Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Tue, 14 Nov 2023 12:39:33 +0100
Subject: [PATCH 15/40] net8.0 targeting
---
.github/workflows/dotnet.yml | 4 ++++
BlazorAppTest/BlazorAppTest.csproj | 2 +-
BlazorRTLAppTest/BlazorRTLAppTest.csproj | 2 +-
.../Havit.Blazor.Components.Web.Bootstrap.Tests.csproj | 2 +-
.../Havit.Blazor.Components.Web.Bootstrap.csproj | 2 +-
.../Havit.Blazor.Components.Web.Tests.csproj | 2 +-
.../Havit.Blazor.Components.Web.csproj | 3 ++-
.../Havit.Blazor.Documentation.Server.csproj | 4 ++--
.../Properties/PublishProfiles/TfsPublish.pubxml | 2 +-
.../Havit.Blazor.Documentation.Tests.csproj | 2 +-
.../Havit.Blazor.Documentation.csproj | 10 +++++-----
.../Havit.Blazor.GoogleTagManager.csproj | 3 ++-
.../Havit.Blazor.Grpc.Client.Tests.csproj | 2 +-
.../Havit.Blazor.Grpc.Client.WebAssembly.csproj | 3 ++-
.../Havit.Blazor.Grpc.Client.csproj | 4 ++--
.../Havit.Blazor.Grpc.Core.Tests.csproj | 2 +-
Havit.Blazor.Grpc.Core/Havit.Blazor.Grpc.Core.csproj | 2 +-
.../Havit.Blazor.Grpc.Server.csproj | 2 +-
.../Havit.Blazor.Grpc.TestContracts.csproj | 2 +-
19 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index c159fb72..ef059b2b 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -13,6 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v4
+ - name: Setup .NET 8
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 8.0.x
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
diff --git a/BlazorAppTest/BlazorAppTest.csproj b/BlazorAppTest/BlazorAppTest.csproj
index 0d9db993..643433d3 100644
--- a/BlazorAppTest/BlazorAppTest.csproj
+++ b/BlazorAppTest/BlazorAppTest.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0enable
diff --git a/BlazorRTLAppTest/BlazorRTLAppTest.csproj b/BlazorRTLAppTest/BlazorRTLAppTest.csproj
index 0c4b1eae..8078911f 100644
--- a/BlazorRTLAppTest/BlazorRTLAppTest.csproj
+++ b/BlazorRTLAppTest/BlazorRTLAppTest.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0enableenablefalse
diff --git a/Havit.Blazor.Components.Web.Bootstrap.Tests/Havit.Blazor.Components.Web.Bootstrap.Tests.csproj b/Havit.Blazor.Components.Web.Bootstrap.Tests/Havit.Blazor.Components.Web.Bootstrap.Tests.csproj
index 292eebbc..5f10cd19 100644
--- a/Havit.Blazor.Components.Web.Bootstrap.Tests/Havit.Blazor.Components.Web.Bootstrap.Tests.csproj
+++ b/Havit.Blazor.Components.Web.Bootstrap.Tests/Havit.Blazor.Components.Web.Bootstrap.Tests.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0falseenable
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj b/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj
index 911f9eaa..243666c4 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj
+++ b/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable1591;1701;1702;SA1134;BL0007true
diff --git a/Havit.Blazor.Components.Web.Tests/Havit.Blazor.Components.Web.Tests.csproj b/Havit.Blazor.Components.Web.Tests/Havit.Blazor.Components.Web.Tests.csproj
index f9876d46..f6cf0c9c 100644
--- a/Havit.Blazor.Components.Web.Tests/Havit.Blazor.Components.Web.Tests.csproj
+++ b/Havit.Blazor.Components.Web.Tests/Havit.Blazor.Components.Web.Tests.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enablefalse
diff --git a/Havit.Blazor.Components.Web/Havit.Blazor.Components.Web.csproj b/Havit.Blazor.Components.Web/Havit.Blazor.Components.Web.csproj
index b8c56081..caddbb17 100644
--- a/Havit.Blazor.Components.Web/Havit.Blazor.Components.Web.csproj
+++ b/Havit.Blazor.Components.Web/Havit.Blazor.Components.Web.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable1591;1701;1702;SA1134true
@@ -26,6 +26,7 @@
+
diff --git a/Havit.Blazor.Documentation.Server/Havit.Blazor.Documentation.Server.csproj b/Havit.Blazor.Documentation.Server/Havit.Blazor.Documentation.Server.csproj
index 9ff7d682..e8533b50 100644
--- a/Havit.Blazor.Documentation.Server/Havit.Blazor.Documentation.Server.csproj
+++ b/Havit.Blazor.Documentation.Server/Havit.Blazor.Documentation.Server.csproj
@@ -1,12 +1,12 @@
- net7.0
+ net8.0enable
-
+
diff --git a/Havit.Blazor.Documentation.Server/Properties/PublishProfiles/TfsPublish.pubxml b/Havit.Blazor.Documentation.Server/Properties/PublishProfiles/TfsPublish.pubxml
index e5869d51..2a8ab281 100644
--- a/Havit.Blazor.Documentation.Server/Properties/PublishProfiles/TfsPublish.pubxml
+++ b/Havit.Blazor.Documentation.Server/Properties/PublishProfiles/TfsPublish.pubxml
@@ -15,7 +15,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
truehavit.blazor.eufalse
- net7.0
+ net8.0c4cc1c76-bcc9-403a-917d-144868f1215e
\ No newline at end of file
diff --git a/Havit.Blazor.Documentation.Tests/Havit.Blazor.Documentation.Tests.csproj b/Havit.Blazor.Documentation.Tests/Havit.Blazor.Documentation.Tests.csproj
index 56ee793b..1a10c428 100644
--- a/Havit.Blazor.Documentation.Tests/Havit.Blazor.Documentation.Tests.csproj
+++ b/Havit.Blazor.Documentation.Tests/Havit.Blazor.Documentation.Tests.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0enablefalse
diff --git a/Havit.Blazor.Documentation/Havit.Blazor.Documentation.csproj b/Havit.Blazor.Documentation/Havit.Blazor.Documentation.csproj
index 4826524f..a7cb980c 100644
--- a/Havit.Blazor.Documentation/Havit.Blazor.Documentation.csproj
+++ b/Havit.Blazor.Documentation/Havit.Blazor.Documentation.csproj
@@ -1,17 +1,17 @@
- net7.0
+ net8.0enable1701;1702;SA1134
-
-
-
-
+
+
+
+
diff --git a/Havit.Blazor.GoogleTagManager/Havit.Blazor.GoogleTagManager.csproj b/Havit.Blazor.GoogleTagManager/Havit.Blazor.GoogleTagManager.csproj
index 8452074b..cce792ab 100644
--- a/Havit.Blazor.GoogleTagManager/Havit.Blazor.GoogleTagManager.csproj
+++ b/Havit.Blazor.GoogleTagManager/Havit.Blazor.GoogleTagManager.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable1591;1701;1702;SA1134true
@@ -22,6 +22,7 @@
+
diff --git a/Havit.Blazor.Grpc.Client.Tests/Havit.Blazor.Grpc.Client.Tests.csproj b/Havit.Blazor.Grpc.Client.Tests/Havit.Blazor.Grpc.Client.Tests.csproj
index 1e21d958..16c94e81 100644
--- a/Havit.Blazor.Grpc.Client.Tests/Havit.Blazor.Grpc.Client.Tests.csproj
+++ b/Havit.Blazor.Grpc.Client.Tests/Havit.Blazor.Grpc.Client.Tests.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enablefalse
diff --git a/Havit.Blazor.Grpc.Client.WebAssembly/Havit.Blazor.Grpc.Client.WebAssembly.csproj b/Havit.Blazor.Grpc.Client.WebAssembly/Havit.Blazor.Grpc.Client.WebAssembly.csproj
index c6aeed77..b2410f7b 100644
--- a/Havit.Blazor.Grpc.Client.WebAssembly/Havit.Blazor.Grpc.Client.WebAssembly.csproj
+++ b/Havit.Blazor.Grpc.Client.WebAssembly/Havit.Blazor.Grpc.Client.WebAssembly.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable
@@ -16,6 +16,7 @@
+
diff --git a/Havit.Blazor.Grpc.Client/Havit.Blazor.Grpc.Client.csproj b/Havit.Blazor.Grpc.Client/Havit.Blazor.Grpc.Client.csproj
index 7179aab8..bf50d62a 100644
--- a/Havit.Blazor.Grpc.Client/Havit.Blazor.Grpc.Client.csproj
+++ b/Havit.Blazor.Grpc.Client/Havit.Blazor.Grpc.Client.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable
@@ -18,9 +18,9 @@
+
-
diff --git a/Havit.Blazor.Grpc.Core.Tests/Havit.Blazor.Grpc.Core.Tests.csproj b/Havit.Blazor.Grpc.Core.Tests/Havit.Blazor.Grpc.Core.Tests.csproj
index d57246ff..ac7e60cd 100644
--- a/Havit.Blazor.Grpc.Core.Tests/Havit.Blazor.Grpc.Core.Tests.csproj
+++ b/Havit.Blazor.Grpc.Core.Tests/Havit.Blazor.Grpc.Core.Tests.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enablefalse
diff --git a/Havit.Blazor.Grpc.Core/Havit.Blazor.Grpc.Core.csproj b/Havit.Blazor.Grpc.Core/Havit.Blazor.Grpc.Core.csproj
index 41ee0183..5155ea75 100644
--- a/Havit.Blazor.Grpc.Core/Havit.Blazor.Grpc.Core.csproj
+++ b/Havit.Blazor.Grpc.Core/Havit.Blazor.Grpc.Core.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable
diff --git a/Havit.Blazor.Grpc.Server/Havit.Blazor.Grpc.Server.csproj b/Havit.Blazor.Grpc.Server/Havit.Blazor.Grpc.Server.csproj
index f41ce474..ed5592ca 100644
--- a/Havit.Blazor.Grpc.Server/Havit.Blazor.Grpc.Server.csproj
+++ b/Havit.Blazor.Grpc.Server/Havit.Blazor.Grpc.Server.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable
diff --git a/Havit.Blazor.Grpc.TestContracts/Havit.Blazor.Grpc.TestContracts.csproj b/Havit.Blazor.Grpc.TestContracts/Havit.Blazor.Grpc.TestContracts.csproj
index e833ae30..3e94ba54 100644
--- a/Havit.Blazor.Grpc.TestContracts/Havit.Blazor.Grpc.TestContracts.csproj
+++ b/Havit.Blazor.Grpc.TestContracts/Havit.Blazor.Grpc.TestContracts.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0
+ net8.0;net7.0;net6.0enable
From dcfc3a072ce9e3eace2a1f6d03a187155f60fd02 Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Tue, 14 Nov 2023 13:15:14 +0100
Subject: [PATCH 16/40] add net8.0 to documentation
---
Havit.Blazor.Documentation/Pages/Index.razor | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Havit.Blazor.Documentation/Pages/Index.razor b/Havit.Blazor.Documentation/Pages/Index.razor
index fa171975..42f8411b 100644
--- a/Havit.Blazor.Documentation/Pages/Index.razor
+++ b/Havit.Blazor.Documentation/Pages/Index.razor
@@ -21,8 +21,8 @@
Havit.Blazor components have the following requirements:
-
.NET 6.0 or newer (net6.0 and net7.0 multitargeting; net5.0 support dropped in v3.2)
-
Blazor WebAssembly or Blazor Server hosting model (other options not tested yet)
+
.NET 6.0 or newer (net8.0, net7.0 and net6.0 multitargeting; net5.0 support dropped in v3.2)
+
Blazor WebAssembly (preferred) or Blazor Server hosting models (other options at your own risk)
The scrollspy navigation has to use custom HxScrollspyNavLink to workaround the <base> Blazor requirement and inability of Bootstrap to interpret the page#fragment form of link.
-
For anchor-fragment navigation (<a href="#id">) to work the page have to host HxAnchorFragmentNavigation component.
+
For anchor-fragment navigation (<a href="#id">) to work in net7.0 and earlier the page has to host HxAnchorFragmentNavigation component.
Current component design expects the scrollspy to by used in dedicated scrollable container
diff --git a/Havit.Blazor.Documentation/Shared/MainLayout.razor b/Havit.Blazor.Documentation/Shared/MainLayout.razor
index b49205d9..a8ed68c0 100644
--- a/Havit.Blazor.Documentation/Shared/MainLayout.razor
+++ b/Havit.Blazor.Documentation/Shared/MainLayout.razor
@@ -15,6 +15,4 @@
Use the ZonedTimeProvider. Ensure that Defaults are configured in Program.cs or where you maintain your other defaults.
Please expand to provide appropriate error handling, caching, etc. depending on your needs.
-
+
@@ -96,7 +96,7 @@
Background of today.
-
+
Background opacity of today.
diff --git a/Havit.Blazor.Documentation/Pages/Components/HxInputFileDropZoneDoc/HxInputFileDropZone_Documentation.razor b/Havit.Blazor.Documentation/Pages/Components/HxInputFileDropZoneDoc/HxInputFileDropZone_Documentation.razor
index a9d3c16b..c8e04494 100644
--- a/Havit.Blazor.Documentation/Pages/Components/HxInputFileDropZoneDoc/HxInputFileDropZone_Documentation.razor
+++ b/Havit.Blazor.Documentation/Pages/Components/HxInputFileDropZoneDoc/HxInputFileDropZone_Documentation.razor
@@ -29,7 +29,7 @@
Background color.
-
+
Background color on hover.
diff --git a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor
index e7288590..a7f3a4c2 100644
--- a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor
+++ b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor
@@ -82,7 +82,7 @@
Background color of the items on hover.
-
+
Background opacity of the items on hover.
@@ -91,10 +91,7 @@
Color of the active item icon.
-
- Background opacity of the active item.
-
-
+
Background opacity of the active item.
From e77d7d0a4a1d5904a7c617aa50abcb60a3bd7bd0 Mon Sep 17 00:00:00 2001
From: dominikcrha
Date: Sun, 19 Nov 2023 23:16:39 +0100
Subject: [PATCH 31/40] To align btn size in Sidebar header to Sidebar nav
items
---
.../Components/DocColorMode/DocColorModeSwitcher.razor.css | 4 ++--
.../Shared/Components/GitHubLink.razor.css | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Havit.Blazor.Documentation/Shared/Components/DocColorMode/DocColorModeSwitcher.razor.css b/Havit.Blazor.Documentation/Shared/Components/DocColorMode/DocColorModeSwitcher.razor.css
index 6a97269c..fc2f2877 100644
--- a/Havit.Blazor.Documentation/Shared/Components/DocColorMode/DocColorModeSwitcher.razor.css
+++ b/Havit.Blazor.Documentation/Shared/Components/DocColorMode/DocColorModeSwitcher.razor.css
@@ -2,6 +2,6 @@
--bs-btn-hover-bg: var(--bs-secondary-bg);
--bs-btn-active-bg: var(--bs-secondary-bg);
--bs-btn-active-border-color: transparent;
- --bs-btn-padding-x: .5rem;
- --bs-btn-padding-y: .25rem;
+ --bs-btn-padding-x: 11px;
+ --bs-btn-padding-y: 7px;
}
\ No newline at end of file
diff --git a/Havit.Blazor.Documentation/Shared/Components/GitHubLink.razor.css b/Havit.Blazor.Documentation/Shared/Components/GitHubLink.razor.css
index 9ed11d39..67ce77b8 100644
--- a/Havit.Blazor.Documentation/Shared/Components/GitHubLink.razor.css
+++ b/Havit.Blazor.Documentation/Shared/Components/GitHubLink.razor.css
@@ -2,6 +2,6 @@
--bs-btn-hover-bg: var(--bs-secondary-bg);
--bs-btn-active-bg: var(--bs-secondary-bg);
--bs-btn-active-border-color: transparent;
- --bs-btn-padding-x: .5rem;
- --bs-btn-padding-y: 0.25rem;
+ --bs-btn-padding-x: 11px;
+ --bs-btn-padding-y: 7px;
}
\ No newline at end of file
From 2d5f760dd7981af96c19af8e64b5706ba1fdc375 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clavek=2C=20Ond=C5=99ej?=
Date: Tue, 21 Nov 2023 20:09:25 +0100
Subject: [PATCH 32/40] HxSearchBox - fix right button padding and test page
---
BlazorAppTest/Pages/HxSearchBoxTest.razor | 14 +++++++++++++-
.../Forms/SearchBox/HxSearchBox.razor.css | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/BlazorAppTest/Pages/HxSearchBoxTest.razor b/BlazorAppTest/Pages/HxSearchBoxTest.razor
index 6faa5a44..f9db4a8d 100644
--- a/BlazorAppTest/Pages/HxSearchBoxTest.razor
+++ b/BlazorAppTest/Pages/HxSearchBoxTest.razor
@@ -1,6 +1,18 @@
@page "/HxSearchBoxTest"
-
+
+
+
Search for Mouse, Table or Door...
+
+
+
+
+
+
Search for Mouse, Table or Door...
+
+
+
+
Search for Mouse, Table or Door...
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css
index 9012104c..9125bc8b 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor.css
@@ -23,7 +23,7 @@
}
::deep .hx-search-box-input-with-clear-icon {
- padding-right: 2rem;
+ padding-right: 2.375rem;
}
.dropdown-item:not(:active) ::deep .hx-search-box-item-title {
From cf624e86a7408bd7af1cc33cfac6cf1500070b5f Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Thu, 23 Nov 2023 14:49:58 +0100
Subject: [PATCH 33/40] doc Getting started update (net8)
---
...ingStarted_RegisterServices.CodeSnippet.cs | 14 -----
Havit.Blazor.Documentation/Pages/Index.razor | 52 +++++++++++--------
2 files changed, 30 insertions(+), 36 deletions(-)
delete mode 100644 Havit.Blazor.Documentation/Pages/GettingStarted_RegisterServices.CodeSnippet.cs
diff --git a/Havit.Blazor.Documentation/Pages/GettingStarted_RegisterServices.CodeSnippet.cs b/Havit.Blazor.Documentation/Pages/GettingStarted_RegisterServices.CodeSnippet.cs
deleted file mode 100644
index d3f6c719..00000000
--- a/Havit.Blazor.Documentation/Pages/GettingStarted_RegisterServices.CodeSnippet.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Havit.Blazor.Components.Web; // <------ ADD THIS LINE
-using Havit.Blazor.Components.Web.Bootstrap; // <------ ADD THIS LINE
-
-public static async Task Main(string[] args)
-{
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
- builder.RootComponents.Add("app");
-
- // ... shortened for brevity
-
- builder.Services.AddHxServices(); // <------ ADD THIS LINE
-
- await builder.Build().RunAsync();
-}
\ No newline at end of file
diff --git a/Havit.Blazor.Documentation/Pages/Index.razor b/Havit.Blazor.Documentation/Pages/Index.razor
index 42f8411b..902ed8d1 100644
--- a/Havit.Blazor.Documentation/Pages/Index.razor
+++ b/Havit.Blazor.Documentation/Pages/Index.razor
@@ -32,54 +32,62 @@
-
To incorporate the Havit.Blazor.Components.Web.Bootstrap package into your project, you can use the NuGet Package Manager or execute the following command:
This package should be added to the project where the components will be utilized, typically in the user interface layer. For instance, in Visual Studio Blazor templates, this would be YourApp.Client.
-
-
Add CSS & JavaScript references.
+
+
To ensure proper styling and functionality, add references to CSS and JavaScript in your project.
-
Add the following to your HTML <head> section, it's either index.html or _Host.cshtml/_Layout.cshtml depending on whether you're running WebAssembly or Server:
+
Insert the following line into the <head> section of your HTML file. The specific file to modify depends on your project's configuration. This could be App.razor, index.html, or _Host.cshtml/_Layout.cshtml:
-
If you want to use our custom Bootstrap theme (used in this documentation and demos), replace the first link with:
+
[ALTERNATIVE] If you prefer to utilize our custom Bootstrap theme, which is used in this documentation and our demos, substitute the first link with the following:
-
You can reference your own or any other Bootstrap build/theme in a same way.
+
Similarly, you can reference your custom Bootstrap build or any other Bootstrap theme in the same manner.
- If you're using a standard Blazor template make sure to remove unnecessary code from site.css and remove the bootstrap.min.css completely from either index.html or _Host.cshtml/_Layout.cshtml.
+ If you're utilizing a standard Blazor template, it's important to clean up your CSS files. Specifically, you should remove any unnecessary code from site.css and completely delete the bootstrap.min.css reference from either App.razor, index.html or _Host.cshtml/_Layout.cshtml.
-
At the end of HTML <body> section of either index.html add this (Bootstrap JavaScript Bundle with Popper):
-<!-- JavaScript Bundle with Popper -->
@HxSetup.RenderBootstrapJavaScriptReference()
-
It you are hosting you Blazor app in ASP.NET Core server-generated HTML file (e.g. _Host.cshtml/_Layout.cshtml), you can use our helper-method to emit the <script /> tag and automate versioning:
+
In the same HTML file, add the following line at the end of the <body> section. This includes the Bootstrap JavaScript Bundle with Popper:
[ALTERNATIVE] If your Blazor app is hosted using an ASP.NET Core Razor Page (for example, using _Host.cshtml/_Layout.cshtml), take advantage of our helper method. This method automatically emits the <script /> tag and handles versioning for you:
<!-- JavaScript Bundle with Popper -->
@@Html.Raw(HxSetup.RenderBootstrapJavaScriptReference())
-
Add following to your _Imports.razor file:
+
Add following code to your _Imports.razor file:
-
For Blazor WebAssembly add the following to your Program.Main:
-
+
Add the following line of code to your services registration, typically found in the Program.cs file of your Blazor client project:
+builder.Services.AddHxServices();
- For Blazor Server (or WASM with server pre-rendering) add those registrations to your Startup.cs file, ConfigureServices() method.
- (You won't use the builder there, register the services to the services collection.)
+ For projects that originated from earlier Blazor templates, these service registrations may be found in the Startup.cs file,
+ specifically within the ConfigureServices() method. Note that in this case, you will not use the builder;
+ instead, register the services directly to the services collection.
-
[OPTIONAL] Some of the components need a specific project setup to work. This usually includes registering a service and adding a host-component to App.razor or layout component.
-
For instructions see documentation of those components:
+
+ [OPTIONAL] Some components require a specific project setup to function correctly.
+ This typically involves registering a service and adding a host component to App.razor or a MainLayout.razor component.
+
+
For detailed instructions, please refer to the documentation of the respective components:
@nameof(HxMessenger) - Facilitates the display of new toast messages from your code with ease.
+
@nameof(HxMessageBoxHost) - Enables opening message boxes (and awaiting results) directly from your code.
-
Now you are ready to use all the components in your razor files. They come with Hx prefix. IntelliSense will be your friend...
+
You are now all set to utilize the full range of components in your Razor files. These components are prefixed with Hx. Rely on IntelliSense to guide you through their usage.
- This whole documentation is built using the Havit.Blazor library and is running as Blazor WebAssembly ASP.NET Core Hosted project with server-prerendering.
- See documentation source code on GitHub.
+ This entire documentation is created using the Havit.Blazor library and operates as a Blazor WebAssembly ASP.NET Core Hosted project
+ with server-side prerendering. You can view the source code of this documentation on GitHub.
From 0352dded91438c3fff66f3408f1ea61754c54c09 Mon Sep 17 00:00:00 2001
From: Robert Haken
Date: Thu, 23 Nov 2023 18:36:23 +0100
Subject: [PATCH 34/40] #668 [HxInputBase] Not binding to properties in net8's
server-side rendering (SSR)
---
.../Forms/Autosuggests/HxAutosuggest.cs | 3 +
.../Internal/HxAutosuggestInputInternal.razor | 1 +
.../HxAutosuggestInputInternal.razor.cs | 2 +
.../Internal/HxAutosuggestInternal.razor | 1 +
.../Internal/HxAutosuggestInternal.razor.cs | 2 +
.../Forms/HxInputBase.cs | 16 ++-
.../Forms/HxInputRange.cs | 6 +
.../Forms/HxInputTextBase.cs | 14 ++-
.../Forms/Internal/HxInputDateInternal.razor | 117 +++++++++---------
.../Internal/HxInputDateInternal.razor.cs | 9 ++
.../TreeViews/HxTreeView.razor | 38 +++---
11 files changed, 123 insertions(+), 86 deletions(-)
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/HxAutosuggest.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/HxAutosuggest.cs
index 90e6577c..d555e488 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/HxAutosuggest.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/HxAutosuggest.cs
@@ -172,6 +172,9 @@ protected override void BuildRenderInput(RenderTreeBuilder builder)
builder.AddAttribute(1023, nameof(HxAutosuggestInternal.InputGroupStartTemplate), this.InputGroupStartTemplate);
builder.AddAttribute(1024, nameof(HxAutosuggestInternal.InputGroupEndText), this.InputGroupEndText);
builder.AddAttribute(1025, nameof(HxAutosuggestInternal.InputGroupEndTemplate), this.InputGroupEndTemplate);
+#if NET8_0_OR_GREATER
+ builder.AddAttribute(1026, nameof(HxAutosuggestInternal.NameAttributeValue), NameAttributeValue);
+#endif
builder.AddMultipleAttributes(2000, this.AdditionalAttributes);
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInputInternal.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInputInternal.razor
index 7110e47d..245f8e97 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInputInternal.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInputInternal.razor
@@ -2,6 +2,7 @@
[Parameter] public (int Skidding, int Distance) DropdownOffset { get; set; }
+ [Parameter] public string NameAttributeValue { get; set; }
+
///
/// Additional attributes to be splatted onto an underlying HTML element.
///
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInternal.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInternal.razor
index 87c3a6a4..25fe8d76 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInternal.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Autosuggests/Internal/HxAutosuggestInternal.razor
@@ -13,6 +13,7 @@
: IAsyncDisposable
///
[Parameter] public RenderFragment InputGroupEndTemplate { get; set; }
+ [Parameter] public string NameAttributeValue { get; set; }
+
///
/// Additional attributes to be splatted onto an underlying HTML element.
///
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs
index e268a544..e3e2e253 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs
@@ -295,16 +295,22 @@ private protected virtual void BuildRenderInput_AddCommonAttributes(RenderTreeBu
{
builder.AddMultipleAttributes(1, AdditionalAttributes);
builder.AddAttribute(2, "id", InputId);
- builder.AddAttribute(3, "type", typeValue);
- builder.AddAttribute(4, "class", GetInputCssClassToRender());
- builder.AddAttribute(5, "disabled", !EnabledEffective);
+#if NET8_0_OR_GREATER
+ if (!String.IsNullOrEmpty(this.NameAttributeValue))
+ {
+ builder.AddAttribute(3, "name", NameAttributeValue);
+ }
+#endif
+ builder.AddAttribute(4, "type", typeValue);
+ builder.AddAttribute(5, "class", GetInputCssClassToRender());
+ builder.AddAttribute(6, "disabled", !EnabledEffective);
if ((this is IInputWithLabelType inputWithLabelType) && (inputWithLabelType.LabelTypeEffective == LabelType.Floating))
{
- builder.AddAttribute(6, "placeholder", "placeholder"); // there must be a nonempty value (which is not visible)
+ builder.AddAttribute(7, "placeholder", "placeholder"); // there must be a nonempty value (which is not visible)
}
else if (this is IInputWithPlaceholder inputWithPlaceholder)
{
- builder.AddAttribute(7, "placeholder", inputWithPlaceholder.Placeholder);
+ builder.AddAttribute(8, "placeholder", inputWithPlaceholder.Placeholder);
}
}
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputRange.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputRange.cs
index 5c8780cf..70cbfa60 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputRange.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputRange.cs
@@ -96,6 +96,12 @@ protected override void BuildRenderInput(RenderTreeBuilder builder)
builder.AddAttribute(20, "disabled", !EnabledEffective);
builder.AddAttribute(30, "id", InputId);
+#if NET8_0_OR_GREATER
+ if (!String.IsNullOrEmpty(NameAttributeValue))
+ {
+ builder.AddAttribute(31, "name", NameAttributeValue);
+ }
+#endif
// Capture ElementReference to the input to make focusing it programmatically possible.
builder.AddElementReferenceCapture(40, value => InputElement = value);
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputTextBase.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputTextBase.cs
index 6401109c..9ff52bdd 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputTextBase.cs
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputTextBase.cs
@@ -77,13 +77,19 @@ protected override void BuildRenderInput(RenderTreeBuilder builder)
builder.AddAttribute(1002, "value", FormatValueAsString(Value));
builder.AddAttribute(1003, BindEvent.ToEventName(), EventCallback.Factory.CreateBinder(this, value => CurrentValueAsString = value, CurrentValueAsString));
- if (this.InputModeEffective is not null)
+#if NET8_0_OR_GREATER
+ if (!String.IsNullOrEmpty(this.NameAttributeValue))
{
- builder.AddAttribute(1004, "inputmode", this.InputModeEffective.Value.ToString("f").ToLower());
+ builder.AddAttribute(1004, "name", NameAttributeValue);
}
+#endif
- builder.AddEventStopPropagationAttribute(1005, "onclick", true);
- builder.AddElementReferenceCapture(1006, elementReference => InputElement = elementReference);
+ if (this.InputModeEffective is not null)
+ {
+ builder.AddAttribute(1005, "inputmode", this.InputModeEffective.Value.ToString("f").ToLower());
+ }
+ builder.AddEventStopPropagationAttribute(1006, "onclick", true);
+ builder.AddElementReferenceCapture(1007, elementReference => InputElement = elementReference);
builder.CloseElement();
}
diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
index fc7264e9..f76a0ce0 100644
--- a/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
+++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/HxInputDateInternal.razor
@@ -4,77 +4,78 @@
@if (FieldIdentifier.Model != null)
{
-