Skip to content

Commit f1dbafc

Browse files
committed
Merge branch 'main' into taparik/disableNonWSTransportsByDefault
2 parents e03d084 + 602575e commit f1dbafc

16 files changed

+1672
-70
lines changed

src/Components/Components/src/BindConverter.cs

Lines changed: 392 additions & 2 deletions
Large diffs are not rendered by default.

src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,174 @@ public static EventCallback<ChangeEventArgs> CreateBinder(
491491
return CreateBinderCore<DateTimeOffset?>(factory, receiver, setter, culture, format, ConvertToNullableDateTimeOffsetWithFormat);
492492
}
493493

494+
/// <summary>
495+
/// For internal use only.
496+
/// </summary>
497+
/// <param name="factory"></param>
498+
/// <param name="receiver"></param>
499+
/// <param name="setter"></param>
500+
/// <param name="existingValue"></param>
501+
/// <param name="culture"></param>
502+
/// <returns></returns>
503+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
504+
public static EventCallback<ChangeEventArgs> CreateBinder(
505+
this EventCallbackFactory factory,
506+
object receiver,
507+
Action<DateOnly> setter,
508+
DateOnly existingValue,
509+
CultureInfo? culture = null)
510+
{
511+
return CreateBinderCore<DateOnly>(factory, receiver, setter, culture, ConvertToDateOnly);
512+
}
513+
514+
/// <summary>
515+
/// For internal use only.
516+
/// </summary>
517+
/// <param name="factory"></param>
518+
/// <param name="receiver"></param>
519+
/// <param name="setter"></param>
520+
/// <param name="existingValue"></param>
521+
/// <param name="format"></param>
522+
/// <param name="culture"></param>
523+
/// <returns></returns>
524+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
525+
public static EventCallback<ChangeEventArgs> CreateBinder(
526+
this EventCallbackFactory factory,
527+
object receiver,
528+
Action<DateOnly> setter,
529+
DateOnly existingValue,
530+
string format,
531+
CultureInfo? culture = null)
532+
{
533+
return CreateBinderCore<DateOnly>(factory, receiver, setter, culture, format, ConvertToDateOnlyWithFormat);
534+
}
535+
536+
/// <summary>
537+
/// For internal use only.
538+
/// </summary>
539+
/// <param name="factory"></param>
540+
/// <param name="receiver"></param>
541+
/// <param name="setter"></param>
542+
/// <param name="existingValue"></param>
543+
/// <param name="culture"></param>
544+
/// <returns></returns>
545+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
546+
public static EventCallback<ChangeEventArgs> CreateBinder(
547+
this EventCallbackFactory factory,
548+
object receiver,
549+
Action<DateOnly?> setter,
550+
DateOnly? existingValue,
551+
CultureInfo? culture = null)
552+
{
553+
return CreateBinderCore<DateOnly?>(factory, receiver, setter, culture, ConvertToNullableDateOnly);
554+
}
555+
556+
/// <summary>
557+
/// For internal use only.
558+
/// </summary>
559+
/// <param name="factory"></param>
560+
/// <param name="receiver"></param>
561+
/// <param name="setter"></param>
562+
/// <param name="existingValue"></param>
563+
/// <param name="format"></param>
564+
/// <param name="culture"></param>
565+
/// <returns></returns>
566+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
567+
public static EventCallback<ChangeEventArgs> CreateBinder(
568+
this EventCallbackFactory factory,
569+
object receiver,
570+
Action<DateOnly?> setter,
571+
DateOnly? existingValue,
572+
string format,
573+
CultureInfo? culture = null)
574+
{
575+
return CreateBinderCore<DateOnly?>(factory, receiver, setter, culture, format, ConvertToNullableDateOnlyWithFormat);
576+
}
577+
578+
/// <summary>
579+
/// For internal use only.
580+
/// </summary>
581+
/// <param name="factory"></param>
582+
/// <param name="receiver"></param>
583+
/// <param name="setter"></param>
584+
/// <param name="existingValue"></param>
585+
/// <param name="culture"></param>
586+
/// <returns></returns>
587+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
588+
public static EventCallback<ChangeEventArgs> CreateBinder(
589+
this EventCallbackFactory factory,
590+
object receiver,
591+
Action<TimeOnly> setter,
592+
TimeOnly existingValue,
593+
CultureInfo? culture = null)
594+
{
595+
return CreateBinderCore<TimeOnly>(factory, receiver, setter, culture, ConvertToTimeOnly);
596+
}
597+
598+
/// <summary>
599+
/// For internal use only.
600+
/// </summary>
601+
/// <param name="factory"></param>
602+
/// <param name="receiver"></param>
603+
/// <param name="setter"></param>
604+
/// <param name="existingValue"></param>
605+
/// <param name="format"></param>
606+
/// <param name="culture"></param>
607+
/// <returns></returns>
608+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
609+
public static EventCallback<ChangeEventArgs> CreateBinder(
610+
this EventCallbackFactory factory,
611+
object receiver,
612+
Action<TimeOnly> setter,
613+
TimeOnly existingValue,
614+
string format,
615+
CultureInfo? culture = null)
616+
{
617+
return CreateBinderCore<TimeOnly>(factory, receiver, setter, culture, format, ConvertToTimeOnlyWithFormat);
618+
}
619+
620+
/// <summary>
621+
/// For internal use only.
622+
/// </summary>
623+
/// <param name="factory"></param>
624+
/// <param name="receiver"></param>
625+
/// <param name="setter"></param>
626+
/// <param name="existingValue"></param>
627+
/// <param name="culture"></param>
628+
/// <returns></returns>
629+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
630+
public static EventCallback<ChangeEventArgs> CreateBinder(
631+
this EventCallbackFactory factory,
632+
object receiver,
633+
Action<TimeOnly?> setter,
634+
TimeOnly? existingValue,
635+
CultureInfo? culture = null)
636+
{
637+
return CreateBinderCore<TimeOnly?>(factory, receiver, setter, culture, ConvertToNullableTimeOnly);
638+
}
639+
640+
/// <summary>
641+
/// For internal use only.
642+
/// </summary>
643+
/// <param name="factory"></param>
644+
/// <param name="receiver"></param>
645+
/// <param name="setter"></param>
646+
/// <param name="existingValue"></param>
647+
/// <param name="format"></param>
648+
/// <param name="culture"></param>
649+
/// <returns></returns>
650+
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
651+
public static EventCallback<ChangeEventArgs> CreateBinder(
652+
this EventCallbackFactory factory,
653+
object receiver,
654+
Action<TimeOnly?> setter,
655+
TimeOnly? existingValue,
656+
string format,
657+
CultureInfo? culture = null)
658+
{
659+
return CreateBinderCore<TimeOnly?>(factory, receiver, setter, culture, format, ConvertToNullableTimeOnlyWithFormat);
660+
}
661+
494662
/// <summary>
495663
/// For internal use only.
496664
/// </summary>

src/Components/Components/src/PublicAPI.Unshipped.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@ Microsoft.AspNetCore.Components.SupplyParameterFromQueryAttribute.Name.set -> vo
6464
Microsoft.AspNetCore.Components.SupplyParameterFromQueryAttribute.SupplyParameterFromQueryAttribute() -> void
6565
abstract Microsoft.AspNetCore.Components.ErrorBoundaryBase.OnErrorAsync(System.Exception! exception) -> System.Threading.Tasks.Task!
6666
override Microsoft.AspNetCore.Components.LayoutComponentBase.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) -> System.Threading.Tasks.Task!
67+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.DateOnly value, System.Globalization.CultureInfo? culture = null) -> string!
68+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.DateOnly value, string! format, System.Globalization.CultureInfo? culture = null) -> string!
69+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.DateOnly? value, System.Globalization.CultureInfo? culture = null) -> string?
70+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.DateOnly? value, string! format, System.Globalization.CultureInfo? culture = null) -> string?
71+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.TimeOnly value, System.Globalization.CultureInfo? culture = null) -> string!
72+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.TimeOnly value, string! format, System.Globalization.CultureInfo? culture = null) -> string!
73+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.TimeOnly? value, System.Globalization.CultureInfo? culture = null) -> string?
74+
static Microsoft.AspNetCore.Components.BindConverter.FormatValue(System.TimeOnly? value, string! format, System.Globalization.CultureInfo? culture = null) -> string?
75+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToDateOnly(object? obj, System.Globalization.CultureInfo? culture, out System.DateOnly value) -> bool
76+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToDateOnly(object? obj, System.Globalization.CultureInfo? culture, string! format, out System.DateOnly value) -> bool
77+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToNullableDateOnly(object? obj, System.Globalization.CultureInfo? culture, out System.DateOnly? value) -> bool
78+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToNullableDateOnly(object? obj, System.Globalization.CultureInfo? culture, string! format, out System.DateOnly? value) -> bool
79+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToNullableTimeOnly(object? obj, System.Globalization.CultureInfo? culture, out System.TimeOnly? value) -> bool
80+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToNullableTimeOnly(object? obj, System.Globalization.CultureInfo? culture, string! format, out System.TimeOnly? value) -> bool
81+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToTimeOnly(object? obj, System.Globalization.CultureInfo? culture, out System.TimeOnly value) -> bool
82+
static Microsoft.AspNetCore.Components.BindConverter.TryConvertToTimeOnly(object? obj, System.Globalization.CultureInfo? culture, string! format, out System.TimeOnly value) -> bool
83+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.DateOnly>! setter, System.DateOnly existingValue, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
84+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.DateOnly>! setter, System.DateOnly existingValue, string! format, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
85+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.DateOnly?>! setter, System.DateOnly? existingValue, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
86+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.DateOnly?>! setter, System.DateOnly? existingValue, string! format, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
87+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.TimeOnly>! setter, System.TimeOnly existingValue, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
88+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.TimeOnly>! setter, System.TimeOnly existingValue, string! format, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
89+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.TimeOnly?>! setter, System.TimeOnly? existingValue, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
90+
static Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action<System.TimeOnly?>! setter, System.TimeOnly? existingValue, string! format, System.Globalization.CultureInfo? culture = null) -> Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs!>
6791
static Microsoft.AspNetCore.Components.ParameterView.FromDictionary(System.Collections.Generic.IDictionary<string!, object?>! parameters) -> Microsoft.AspNetCore.Components.ParameterView
6892
virtual Microsoft.AspNetCore.Components.NavigationManager.NavigateToCore(string! uri, Microsoft.AspNetCore.Components.NavigationOptions options) -> void
6993
virtual Microsoft.AspNetCore.Components.NavigationManager.NavigateToCore(string! uri, bool forceLoad) -> void

src/Components/Components/test/BindConverterTest.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,62 @@ public void FormatValue_DateTime_Format()
185185
Assert.Equal(expected, actual);
186186
}
187187

188+
[Fact]
189+
public void FormatValue_DateOnly()
190+
{
191+
// Arrange
192+
var value = DateOnly.FromDateTime(DateTime.Now);
193+
var expected = value.ToString(CultureInfo.CurrentCulture);
194+
195+
// Act
196+
var actual = BindConverter.FormatValue(value);
197+
198+
// Assert
199+
Assert.Equal(expected, actual);
200+
}
201+
202+
[Fact]
203+
public void FormatValue_DateOnly_Format()
204+
{
205+
// Arrange
206+
var value = DateOnly.FromDateTime(DateTime.Now);
207+
var expected = value.ToString("MM-yyyy", CultureInfo.InvariantCulture);
208+
209+
// Act
210+
var actual = BindConverter.FormatValue(value, "MM-yyyy", CultureInfo.InvariantCulture);
211+
212+
// Assert
213+
Assert.Equal(expected, actual);
214+
}
215+
216+
[Fact]
217+
public void FormatValue_TimeOnly()
218+
{
219+
// Arrange
220+
var value = TimeOnly.FromDateTime(DateTime.Now);
221+
var expected = value.ToString(CultureInfo.CurrentCulture);
222+
223+
// Act
224+
var actual = BindConverter.FormatValue(value);
225+
226+
// Assert
227+
Assert.Equal(expected, actual);
228+
}
229+
230+
[Fact]
231+
public void FormatValue_TimeOnly_Format()
232+
{
233+
// Arrange
234+
var value = TimeOnly.FromDateTime(DateTime.Now);
235+
var expected = value.ToString("HH:mm", CultureInfo.InvariantCulture);
236+
237+
// Act
238+
var actual = BindConverter.FormatValue(value, "HH:mm", CultureInfo.InvariantCulture);
239+
240+
// Assert
241+
Assert.Equal(expected, actual);
242+
}
243+
188244
[Fact]
189245
public void FormatValue_Enum()
190246
{

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/src/Rendering/Events/EventTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,10 @@ function normalizeTimeBasedValue(element: HTMLInputElement): string {
260260
const type = element.type;
261261
switch (type) {
262262
case 'date':
263-
case 'datetime-local':
264263
case 'month':
265264
return value;
265+
case 'datetime-local':
266+
return value.length === 16 ? value + ':00' : value; // Convert yyyy-MM-ddTHH:mm to yyyy-MM-ddTHH:mm:00
266267
case 'time':
267268
return value.length === 5 ? value + ':00' : value; // Convert hh:mm to hh:mm:00
268269
case 'week':

0 commit comments

Comments
 (0)