Blazor API Review: UIEventArgs types

Fixes: #12550

Removes UIEventArgs in favor of EventArgs as the base class.

Moving Type into all of our event args types - this is important because
many of the events types are used for multiple events.

The only think about this that isn't perfect is that we have keep
special casing change because of how binding works. I renamed the type
to drop the `UI` prefix. It's not possible to define a subclass in the
Web project because of the way covariance works (or doesn't work) in
.NET.
This commit is contained in:
Ryan Nowak 2019-07-27 18:09:16 -07:00 committed by Ryan Nowak
parent 3919dd55c6
commit bef01f3e9a
33 changed files with 373 additions and 338 deletions

View File

@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Blazor.Rendering
public override Microsoft.AspNetCore.Components.Dispatcher Dispatcher { get { throw null; } } public override Microsoft.AspNetCore.Components.Dispatcher Dispatcher { get { throw null; } }
public System.Threading.Tasks.Task AddComponentAsync(System.Type componentType, string domElementSelector) { throw null; } public System.Threading.Tasks.Task AddComponentAsync(System.Type componentType, string domElementSelector) { throw null; }
public System.Threading.Tasks.Task AddComponentAsync<TComponent>(string domElementSelector) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; } public System.Threading.Tasks.Task AddComponentAsync<TComponent>(string domElementSelector) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; }
public override System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo eventFieldInfo, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) { throw null; } public override System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo eventFieldInfo, System.EventArgs eventArgs) { throw null; }
protected override void Dispose(bool disposing) { } protected override void Dispose(bool disposing) { }
protected override void HandleException(System.Exception exception) { } protected override void HandleException(System.Exception exception) { }
protected override System.Threading.Tasks.Task UpdateDisplayAsync(in Microsoft.AspNetCore.Components.Rendering.RenderBatch batch) { throw null; } protected override System.Threading.Tasks.Task UpdateDisplayAsync(in Microsoft.AspNetCore.Components.Rendering.RenderBatch batch) { throw null; }

View File

@ -120,7 +120,7 @@ namespace Microsoft.AspNetCore.Blazor.Rendering
} }
/// <inheritdoc /> /// <inheritdoc />
public override Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs eventArgs) public override Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs)
{ {
// Be sure we only run one event handler at once. Although they couldn't run // Be sure we only run one event handler at once. Although they couldn't run
// simultaneously anyway (there's only one thread), they could run nested on // simultaneously anyway (there's only one thread), they could run nested on
@ -185,10 +185,10 @@ namespace Microsoft.AspNetCore.Blazor.Rendering
{ {
public readonly ulong EventHandlerId; public readonly ulong EventHandlerId;
public readonly EventFieldInfo EventFieldInfo; public readonly EventFieldInfo EventFieldInfo;
public readonly UIEventArgs EventArgs; public readonly EventArgs EventArgs;
public readonly TaskCompletionSource<object> TaskCompletionSource; public readonly TaskCompletionSource<object> TaskCompletionSource;
public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs eventArgs) public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs)
{ {
EventHandlerId = eventHandlerId; EventHandlerId = eventHandlerId;
EventFieldInfo = eventFieldInfo; EventFieldInfo = eventFieldInfo;

View File

@ -253,7 +253,7 @@ namespace Test
public class MyComponent : ComponentBase public class MyComponent : ComponentBase
{ {
[Parameter] [Parameter]
public Action<UIEventArgs> OnClick { get; set; } public Action<EventArgs> OnClick { get; set; }
} }
} }
")); "));
@ -263,7 +263,7 @@ namespace Test
@code { @code {
private int counter; private int counter;
private void Increment(UIEventArgs e) { private void Increment(EventArgs e) {
counter++; counter++;
} }
}"); }");
@ -280,7 +280,7 @@ namespace Test
AssertFrame.Attribute(frame, "OnClick", 1); AssertFrame.Attribute(frame, "OnClick", 1);
// The handler will have been assigned to a lambda // The handler will have been assigned to a lambda
var handler = Assert.IsType<Action<UIEventArgs>>(frame.AttributeValue); var handler = Assert.IsType<Action<EventArgs>>(frame.AttributeValue);
Assert.Equal("Test.TestComponent", handler.Target.GetType().FullName); Assert.Equal("Test.TestComponent", handler.Target.GetType().FullName);
Assert.Equal("Increment", handler.Method.Name); Assert.Equal("Increment", handler.Method.Name);
}); });

View File

@ -332,7 +332,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property // Trigger the change event to show it updates the property
// //
// This should always complete synchronously. // This should always complete synchronously.
var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = "Modified value", })); var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = "Modified value", }));
Assert.Equal(TaskStatus.RanToCompletion, task.Status); Assert.Equal(TaskStatus.RanToCompletion, task.Status);
await task; await task;
@ -367,7 +367,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property // Trigger the change event to show it updates the property
// //
// This should always complete synchronously. // This should always complete synchronously.
var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = "Modified value", })); var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = "Modified value", }));
Assert.Equal(TaskStatus.RanToCompletion, task.Status); Assert.Equal(TaskStatus.RanToCompletion, task.Status);
await task; await task;
@ -404,7 +404,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// //
// This should always complete synchronously. // This should always complete synchronously.
var newDateValue = new DateTime(2018, 3, 5, 4, 5, 6); var newDateValue = new DateTime(2018, 3, 5, 4, 5, 6);
var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = newDateValue.ToString(), })); var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = newDateValue.ToString(), }));
Assert.Equal(TaskStatus.RanToCompletion, task.Status); Assert.Equal(TaskStatus.RanToCompletion, task.Status);
await task; await task;
@ -440,7 +440,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property // Trigger the change event to show it updates the property
// //
// This should always complete synchronously. // This should always complete synchronously.
var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = new DateTime(2018, 3, 5).ToString(testDateFormat), })); var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = new DateTime(2018, 3, 5).ToString(testDateFormat), }));
Assert.Equal(TaskStatus.RanToCompletion, task.Status); Assert.Equal(TaskStatus.RanToCompletion, task.Status);
await task; await task;
@ -559,7 +559,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property // Trigger the change event to show it updates the property
// //
// This should always complete synchronously. // This should always complete synchronously.
var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs() { Value = false, })); var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs() { Value = false, }));
Assert.Equal(TaskStatus.RanToCompletion, task.Status); Assert.Equal(TaskStatus.RanToCompletion, task.Status);
await task; await task;
@ -595,7 +595,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property // Trigger the change event to show it updates the property
// //
// This should always complete synchronously. // This should always complete synchronously.
var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = MyEnum.SecondValue.ToString(), })); var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = MyEnum.SecondValue.ToString(), }));
Assert.Equal(TaskStatus.RanToCompletion, task.Status); Assert.Equal(TaskStatus.RanToCompletion, task.Status);
await task; await task;

View File

@ -119,6 +119,11 @@ namespace Microsoft.AspNetCore.Components
public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) { throw null; } public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) { throw null; }
} }
public partial class ChangeEventArgs : System.EventArgs
{
public ChangeEventArgs() { }
public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
}
public abstract partial class ComponentBase : Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleAfterRender, Microsoft.AspNetCore.Components.IHandleEvent public abstract partial class ComponentBase : Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleAfterRender, Microsoft.AspNetCore.Components.IHandleEvent
{ {
public ComponentBase() { } public ComponentBase() { }
@ -188,35 +193,35 @@ namespace Microsoft.AspNetCore.Components
} }
public static partial class EventCallbackFactoryBinderExtensions public static partial class EventCallbackFactoryBinderExtensions
{ {
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool> setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool> setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal> setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal> setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double> setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double> setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int> setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int> setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long> setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long> setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool?> setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool?> setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal?> setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal?> setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double?> setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double?> setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int?> setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int?> setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long?> setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long?> setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float?> setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float?> setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float> setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float> setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<string> setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<string> setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> CreateBinder<T>(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<T> setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder<T>(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<T> setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
} }
public static partial class EventCallbackFactoryUIEventArgsExtensions public static partial class EventCallbackFactoryEventArgsExtensions
{ {
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<Microsoft.AspNetCore.Components.UIChangeEventArgs> callback) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<Microsoft.AspNetCore.Components.ChangeEventArgs> callback) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIEventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<Microsoft.AspNetCore.Components.UIEventArgs> callback) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<System.EventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.EventArgs> callback) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIChangeEventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func<Microsoft.AspNetCore.Components.UIChangeEventArgs, System.Threading.Tasks.Task> callback) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func<Microsoft.AspNetCore.Components.ChangeEventArgs, System.Threading.Tasks.Task> callback) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.UIEventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func<Microsoft.AspNetCore.Components.UIEventArgs, System.Threading.Tasks.Task> callback) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback<System.EventArgs> Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func<System.EventArgs, System.Threading.Tasks.Task> callback) { throw null; }
} }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct EventCallbackWorkItem public readonly partial struct EventCallbackWorkItem
@ -365,16 +370,6 @@ namespace Microsoft.AspNetCore.Components
public RouteAttribute(string template) { } public RouteAttribute(string template) { }
public string Template { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public string Template { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
} }
public partial class UIChangeEventArgs : Microsoft.AspNetCore.Components.UIEventArgs
{
public UIChangeEventArgs() { }
public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
}
public partial class UIEventArgs
{
public UIEventArgs() { }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
}
public abstract partial class UriHelperBase : Microsoft.AspNetCore.Components.IUriHelper public abstract partial class UriHelperBase : Microsoft.AspNetCore.Components.IUriHelper
{ {
protected UriHelperBase() { } protected UriHelperBase() { }
@ -516,7 +511,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
public event System.UnhandledExceptionEventHandler UnhandledSynchronizationException { add { } remove { } } public event System.UnhandledExceptionEventHandler UnhandledSynchronizationException { add { } remove { } }
protected internal virtual void AddToRenderQueue(int componentId, Microsoft.AspNetCore.Components.RenderFragment renderFragment) { } protected internal virtual void AddToRenderQueue(int componentId, Microsoft.AspNetCore.Components.RenderFragment renderFragment) { }
protected internal int AssignRootComponentId(Microsoft.AspNetCore.Components.IComponent component) { throw null; } protected internal int AssignRootComponentId(Microsoft.AspNetCore.Components.IComponent component) { throw null; }
public virtual System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo fieldInfo, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) { throw null; } public virtual System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo fieldInfo, System.EventArgs eventArgs) { throw null; }
public void Dispose() { } public void Dispose() { }
protected virtual void Dispose(bool disposing) { } protected virtual void Dispose(bool disposing) { }
protected abstract void HandleException(System.Exception exception); protected abstract void HandleException(System.Exception exception);

View File

@ -1,16 +1,19 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about an event that is being raised. /// Supplies information about an change event that is being raised.
/// </summary> /// </summary>
public class UIEventArgs public class ChangeEventArgs : EventArgs
{ {
/// <summary> /// <summary>
/// Gets or sets the type of the event. /// Gets or sets the new value.
/// </summary> /// </summary>
public string Type { get; set; } public object Value { get; set; }
} }
} }

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<string> setter, Action<string> setter,
@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<bool> setter, Action<bool> setter,
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<bool?> setter, Action<bool?> setter,
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<int> setter, Action<int> setter,
@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<int?> setter, Action<int?> setter,
@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<long> setter, Action<long> setter,
@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<long?> setter, Action<long?> setter,
@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<float> setter, Action<float> setter,
@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<float?> setter, Action<float?> setter,
@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<double> setter, Action<double> setter,
@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<double?> setter, Action<double?> setter,
@ -240,7 +240,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<decimal> setter, Action<decimal> setter,
@ -259,7 +259,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<decimal?> setter, Action<decimal?> setter,
@ -278,7 +278,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTime> setter, Action<DateTime> setter,
@ -298,7 +298,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param> /// <param name="format"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTime> setter, Action<DateTime> setter,
@ -318,7 +318,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTime?> setter, Action<DateTime?> setter,
@ -338,7 +338,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param> /// <param name="format"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTime?> setter, Action<DateTime?> setter,
@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTimeOffset> setter, Action<DateTimeOffset> setter,
@ -378,7 +378,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param> /// <param name="format"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTimeOffset> setter, Action<DateTimeOffset> setter,
@ -398,7 +398,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTimeOffset?> setter, Action<DateTimeOffset?> setter,
@ -418,7 +418,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param> /// <param name="format"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder( public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<DateTimeOffset?> setter, Action<DateTimeOffset?> setter,
@ -439,7 +439,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param> /// <param name="existingValue"></param>
/// <param name="culture"></param> /// <param name="culture"></param>
/// <returns></returns> /// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder<T>( public static EventCallback<ChangeEventArgs> CreateBinder<T>(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<T> setter, Action<T> setter,
@ -449,14 +449,14 @@ namespace Microsoft.AspNetCore.Components
return CreateBinderCore<T>(factory, receiver, setter, culture, ParserDelegateCache.Get<T>()); return CreateBinderCore<T>(factory, receiver, setter, culture, ParserDelegateCache.Get<T>());
} }
private static EventCallback<UIChangeEventArgs> CreateBinderCore<T>( private static EventCallback<ChangeEventArgs> CreateBinderCore<T>(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<T> setter, Action<T> setter,
CultureInfo culture, CultureInfo culture,
BindConverter.BindParser<T> converter) BindConverter.BindParser<T> converter)
{ {
Action<UIChangeEventArgs> callback = e => Action<ChangeEventArgs> callback = e =>
{ {
T value = default; T value = default;
var converted = false; var converted = false;
@ -489,10 +489,10 @@ namespace Microsoft.AspNetCore.Components
setter(default); setter(default);
} }
}; };
return factory.Create<UIChangeEventArgs>(receiver, callback); return factory.Create<ChangeEventArgs>(receiver, callback);
} }
private static EventCallback<UIChangeEventArgs> CreateBinderCore<T>( private static EventCallback<ChangeEventArgs> CreateBinderCore<T>(
this EventCallbackFactory factory, this EventCallbackFactory factory,
object receiver, object receiver,
Action<T> setter, Action<T> setter,
@ -500,7 +500,7 @@ namespace Microsoft.AspNetCore.Components
string format, string format,
BindConverter.BindParserWithFormat<T> converter) BindConverter.BindParserWithFormat<T> converter)
{ {
Action<UIChangeEventArgs> callback = e => Action<ChangeEventArgs> callback = e =>
{ {
T value = default; T value = default;
var converted = false; var converted = false;
@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components
setter(default); setter(default);
} }
}; };
return factory.Create<UIChangeEventArgs>(receiver, callback); return factory.Create<ChangeEventArgs>(receiver, callback);
} }
} }
} }

View File

@ -7,9 +7,9 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Provides extension methods for <see cref="EventCallbackFactory"/> and <see cref="UIEventArgs"/> types. /// Provides extension methods for <see cref="EventCallbackFactory"/> and <see cref="EventArgs"/> types.
/// </summary> /// </summary>
public static class EventCallbackFactoryUIEventArgsExtensions public static class EventCallbackFactoryEventArgsExtensions
{ {
/// <summary> /// <summary>
/// Creates an <see cref="EventCallback"/> for the provided <paramref name="receiver"/> and /// Creates an <see cref="EventCallback"/> for the provided <paramref name="receiver"/> and
@ -19,14 +19,14 @@ namespace Microsoft.AspNetCore.Components
/// <param name="receiver">The event receiver.</param> /// <param name="receiver">The event receiver.</param>
/// <param name="callback">The event callback.</param> /// <param name="callback">The event callback.</param>
/// <returns>The <see cref="EventCallback"/>.</returns> /// <returns>The <see cref="EventCallback"/>.</returns>
public static EventCallback<UIEventArgs> Create(this EventCallbackFactory factory, object receiver, Action<UIEventArgs> callback) public static EventCallback<EventArgs> Create(this EventCallbackFactory factory, object receiver, Action<EventArgs> callback)
{ {
if (factory == null) if (factory == null)
{ {
throw new ArgumentNullException(nameof(factory)); throw new ArgumentNullException(nameof(factory));
} }
return factory.Create<UIEventArgs>(receiver, callback); return factory.Create<EventArgs>(receiver, callback);
} }
/// <summary> /// <summary>
@ -37,14 +37,14 @@ namespace Microsoft.AspNetCore.Components
/// <param name="receiver">The event receiver.</param> /// <param name="receiver">The event receiver.</param>
/// <param name="callback">The event callback.</param> /// <param name="callback">The event callback.</param>
/// <returns>The <see cref="EventCallback"/>.</returns> /// <returns>The <see cref="EventCallback"/>.</returns>
public static EventCallback<UIEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<UIEventArgs, Task> callback) public static EventCallback<EventArgs> Create(this EventCallbackFactory factory, object receiver, Func<EventArgs, Task> callback)
{ {
if (factory == null) if (factory == null)
{ {
throw new ArgumentNullException(nameof(factory)); throw new ArgumentNullException(nameof(factory));
} }
return factory.Create<UIEventArgs>(receiver, callback); return factory.Create<EventArgs>(receiver, callback);
} }
/// <summary> /// <summary>
@ -55,14 +55,14 @@ namespace Microsoft.AspNetCore.Components
/// <param name="receiver">The event receiver.</param> /// <param name="receiver">The event receiver.</param>
/// <param name="callback">The event callback.</param> /// <param name="callback">The event callback.</param>
/// <returns>The <see cref="EventCallback"/>.</returns> /// <returns>The <see cref="EventCallback"/>.</returns>
public static EventCallback<UIChangeEventArgs> Create(this EventCallbackFactory factory, object receiver, Action<UIChangeEventArgs> callback) public static EventCallback<ChangeEventArgs> Create(this EventCallbackFactory factory, object receiver, Action<ChangeEventArgs> callback)
{ {
if (factory == null) if (factory == null)
{ {
throw new ArgumentNullException(nameof(factory)); throw new ArgumentNullException(nameof(factory));
} }
return factory.Create<UIChangeEventArgs>(receiver, callback); return factory.Create<ChangeEventArgs>(receiver, callback);
} }
/// <summary> /// <summary>
@ -73,14 +73,14 @@ namespace Microsoft.AspNetCore.Components
/// <param name="receiver">The event receiver.</param> /// <param name="receiver">The event receiver.</param>
/// <param name="callback">The event callback.</param> /// <param name="callback">The event callback.</param>
/// <returns>The <see cref="EventCallback"/>.</returns> /// <returns>The <see cref="EventCallback"/>.</returns>
public static EventCallback<UIChangeEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<UIChangeEventArgs, Task> callback) public static EventCallback<ChangeEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<ChangeEventArgs, Task> callback)
{ {
if (factory == null) if (factory == null)
{ {
throw new ArgumentNullException(nameof(factory)); throw new ArgumentNullException(nameof(factory));
} }
return factory.Create<UIChangeEventArgs>(receiver, callback); return factory.Create<ChangeEventArgs>(receiver, callback);
} }
} }
} }

View File

@ -56,9 +56,9 @@ namespace Microsoft.AspNetCore.Components.Rendering
} }
} }
internal static void HandlingEvent(ILogger<Renderer> logger, ulong eventHandlerId, UIEventArgs eventArgs) internal static void HandlingEvent(ILogger<Renderer> logger, ulong eventHandlerId, EventArgs eventArgs)
{ {
_handlingEvent(logger, eventHandlerId, eventArgs?.Type ?? "null", null); _handlingEvent(logger, eventHandlerId, eventArgs?.GetType().Name ?? "null", null);
} }
} }
} }

View File

@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
/// A <see cref="Task"/> which will complete once all asynchronous processing related to the event /// A <see cref="Task"/> which will complete once all asynchronous processing related to the event
/// has completed. /// has completed.
/// </returns> /// </returns>
public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, UIEventArgs eventArgs) public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
{ {
EnsureSynchronizationContext(); EnsureSynchronizationContext();

View File

@ -1,17 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about an input change event that is being raised.
/// </summary>
public class UIChangeEventArgs : UIEventArgs
{
/// <summary>
/// Gets or sets the new value of the input. This may be a <see cref="string"/>
/// or a <see cref="bool"/>.
/// </summary>
public object Value { get; set; }
}
}

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value); var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "not-an-integer!", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "not-an-integer!", });
Assert.Equal(17, value); // Setter not called Assert.Equal(17, value); // Setter not called
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value); var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = string.Empty, }); await binder.InvokeAsync(new ChangeEventArgs() { Value = string.Empty, });
Assert.Equal(0, value); // Calls setter to apply default value for this type Assert.Equal(0, value); // Calls setter to apply default value for this type
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Components
// Act // Act
await Assert.ThrowsAsync<InvalidTimeZoneException>(() => await Assert.ThrowsAsync<InvalidTimeZoneException>(() =>
{ {
return binder.InvokeAsync(new UIChangeEventArgs() { Value = "18", }); return binder.InvokeAsync(new ChangeEventArgs() { Value = "18", });
}); });
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value); var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "not-an-integer!", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "not-an-integer!", });
Assert.Equal(17, value); // Setter not called Assert.Equal(17, value); // Setter not called
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value); var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "", });
Assert.Null(value); // Setter called Assert.Null(value); // Setter called
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = "bye"; var expectedValue = "bye";
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue, }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue, });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = true; var expectedValue = true;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, }); await binder.InvokeAsync(new ChangeEventArgs() { Value = true, });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -149,7 +149,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (bool?)true; var expectedValue = (bool?)true;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, }); await binder.InvokeAsync(new ChangeEventArgs() { Value = true, });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = 42; var expectedValue = 42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (int?)42; var expectedValue = (int?)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (long)42; var expectedValue = (long)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -225,7 +225,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (long?)42; var expectedValue = (long?)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -244,7 +244,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (float)42; var expectedValue = (float)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -263,7 +263,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (float?)42; var expectedValue = (float?)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -282,7 +282,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (double)42; var expectedValue = (double)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -301,7 +301,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (double?)42; var expectedValue = (double?)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -320,7 +320,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (decimal)42; var expectedValue = (decimal)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -339,7 +339,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (decimal?)42; var expectedValue = (decimal?)42;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = AttributeTargets.Class; var expectedValue = AttributeTargets.Class;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -377,7 +377,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = AttributeTargets.Class; var expectedValue = AttributeTargets.Class;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -396,7 +396,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -415,7 +415,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -435,7 +435,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4); var expectedValue = new DateTime(2018, 3, 4);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -455,7 +455,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4); var expectedValue = new DateTime(2018, 3, 4);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -474,7 +474,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -493,7 +493,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -513,7 +513,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4); var expectedValue = new DateTime(2018, 3, 4);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4); var expectedValue = new DateTime(2018, 3, 4);
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -553,7 +553,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = Guid.NewGuid(); var expectedValue = Guid.NewGuid();
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -573,7 +573,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = Guid.NewGuid(); var expectedValue = Guid.NewGuid();
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -592,7 +592,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new SecretMessage() { Message = "TypeConverter may be old, but it still works!", }; var expectedValue = new SecretMessage() { Message = "TypeConverter may be old, but it still works!", };
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue.Message, value.Message); Assert.Equal(expectedValue.Message, value.Message);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -627,7 +627,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = 42_000; var expectedValue = 42_000;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42 000,00", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42 000,00", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);
@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = 42_000; var expectedValue = 42_000;
// Act // Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42,000.00", }); await binder.InvokeAsync(new ChangeEventArgs() { Value = "42,000.00", });
Assert.Equal(expectedValue, value); Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count); Assert.Equal(1, component.Count);

View File

@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Components
public async Task EventCallbackOfT_Default() public async Task EventCallbackOfT_Default()
{ {
// Arrange // Arrange
var callback = default(EventCallback<UIEventArgs>); var callback = default(EventCallback<EventArgs>);
// Act & Assert (Does not throw) // Act & Assert (Does not throw)
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Components
{ {
// Arrange // Arrange
int runCount = 0; int runCount = 0;
var callback = new EventCallback<UIEventArgs>(null, (Action)(() => runCount++)); var callback = new EventCallback<EventArgs>(null, (Action)(() => runCount++));
// Act // Act
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Components
var callback = new EventCallback(component, (Action)(() => runCount++)); var callback = new EventCallback(component, (Action)(() => runCount++));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert
@ -104,8 +104,8 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback(component, (Action<UIEventArgs>)((e) => { arg = e; runCount++; })); var callback = new EventCallback(component, (Action<EventArgs>)((e) => { arg = e; runCount++; }));
// Act // Act
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -124,11 +124,11 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback(component, (Action<UIEventArgs>)((e) => { arg = e; runCount++; })); var callback = new EventCallback(component, (Action<EventArgs>)((e) => { arg = e; runCount++; }));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert
@ -164,8 +164,8 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback(component, (Action<UIEventArgs>)((e) => { arg = e; runCount++; })); var callback = new EventCallback(component, (Action<EventArgs>)((e) => { arg = e; runCount++; }));
// Act & Assert // Act & Assert
await Assert.ThrowsAsync<ArgumentException>(() => await Assert.ThrowsAsync<ArgumentException>(() =>
@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Components
var callback = new EventCallback(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; })); var callback = new EventCallback(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; }));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert
@ -217,8 +217,8 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback(component, (Func<UIEventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; })); var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
// Act // Act
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -237,11 +237,11 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback(component, (Func<UIEventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; })); var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert
@ -277,8 +277,8 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback(component, (Func<UIEventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; })); var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
// Act & Assert // Act & Assert
await Assert.ThrowsAsync<ArgumentException>(() => await Assert.ThrowsAsync<ArgumentException>(() =>
@ -294,7 +294,7 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
var callback = new EventCallback<UIEventArgs>(component, (Action)(() => runCount++)); var callback = new EventCallback<EventArgs>(component, (Action)(() => runCount++));
// Act // Act
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -312,10 +312,10 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
var callback = new EventCallback<UIEventArgs>(component, (Action)(() => runCount++)); var callback = new EventCallback<EventArgs>(component, (Action)(() => runCount++));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert
@ -330,8 +330,8 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback<UIEventArgs>(component, (Action<UIEventArgs>)((e) => { arg = e; runCount++; })); var callback = new EventCallback<EventArgs>(component, (Action<EventArgs>)((e) => { arg = e; runCount++; }));
// Act // Act
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -350,11 +350,11 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback<UIEventArgs>(component, (Action<UIEventArgs>)((e) => { arg = e; runCount++; })); var callback = new EventCallback<EventArgs>(component, (Action<EventArgs>)((e) => { arg = e; runCount++; }));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert
@ -370,7 +370,7 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
var callback = new EventCallback<UIEventArgs>(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; })); var callback = new EventCallback<EventArgs>(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; }));
// Act // Act
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -388,10 +388,10 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
var callback = new EventCallback<UIEventArgs>(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; })); var callback = new EventCallback<EventArgs>(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; }));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert
@ -406,8 +406,8 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback<UIEventArgs>(component, (Func<UIEventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; })); var callback = new EventCallback<EventArgs>(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
// Act // Act
await callback.InvokeAsync(null); await callback.InvokeAsync(null);
@ -426,11 +426,11 @@ namespace Microsoft.AspNetCore.Components
var component = new EventCountingComponent(); var component = new EventCountingComponent();
int runCount = 0; int runCount = 0;
UIEventArgs arg = null; EventArgs arg = null;
var callback = new EventCallback<UIEventArgs>(component, (Func<UIEventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; })); var callback = new EventCallback<EventArgs>(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
// Act // Act
await callback.InvokeAsync(new UIEventArgs()); await callback.InvokeAsync(new EventArgs());
// Assert // Assert

View File

@ -216,7 +216,7 @@ namespace Microsoft.AspNetCore.Components.Test
{ {
// Arrange // Arrange
var builder = new RenderTreeBuilder(); var builder = new RenderTreeBuilder();
Action<UIEventArgs> eventHandler = eventInfo => { }; Action<EventArgs> eventHandler = eventInfo => { };
// Act // Act
builder.OpenElement(0, "myelement"); // 0: <myelement builder.OpenElement(0, "myelement"); // 0: <myelement
@ -261,7 +261,7 @@ namespace Microsoft.AspNetCore.Components.Test
{ {
// Arrange // Arrange
var builder = new RenderTreeBuilder(); var builder = new RenderTreeBuilder();
Action<UIEventArgs> eventHandler = eventInfo => { }; Action<EventArgs> eventHandler = eventInfo => { };
// Act // Act
builder.OpenElement(0, "myelement"); builder.OpenElement(0, "myelement");
@ -428,7 +428,7 @@ namespace Microsoft.AspNetCore.Components.Test
{ {
builder.OpenElement(0, "some element"); builder.OpenElement(0, "some element");
builder.AddContent(1, "hello"); builder.AddContent(1, "hello");
builder.AddAttribute(2, "name", new Action<UIEventArgs>(eventInfo => { })); builder.AddAttribute(2, "name", new Action<EventArgs>(eventInfo => { }));
}); });
} }
@ -897,7 +897,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange // Arrange
var builder = new RenderTreeBuilder(); var builder = new RenderTreeBuilder();
var value = new Action<UIEventArgs>((e) => { }); var value = new Action<EventArgs>((e) => { });
// Act // Act
builder.OpenElement(0, "elem"); builder.OpenElement(0, "elem");
@ -919,7 +919,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Act // Act
builder.OpenElement(0, "elem"); builder.OpenElement(0, "elem");
builder.AddAttribute(1, "attr", (Action<UIEventArgs>)null); builder.AddAttribute(1, "attr", (Action<EventArgs>)null);
builder.CloseElement(); builder.CloseElement();
// Assert // Assert
@ -965,7 +965,7 @@ namespace Microsoft.AspNetCore.Components.Test
frame => AssertFrame.Element(frame, "elem", 1, 0)); frame => AssertFrame.Element(frame, "elem", 1, 0));
} }
public static TheoryData<Action<UIEventArgs>> EventHandlerValues => new TheoryData<Action<UIEventArgs>> public static TheoryData<Action<EventArgs>> EventHandlerValues => new TheoryData<Action<EventArgs>>
{ {
null, null,
(e) => { }, (e) => { },
@ -973,7 +973,7 @@ namespace Microsoft.AspNetCore.Components.Test
[Theory] [Theory]
[MemberData(nameof(EventHandlerValues))] [MemberData(nameof(EventHandlerValues))]
public void AddAttribute_Component_EventHandlerValue_SetsAttributeValue(Action<UIEventArgs> value) public void AddAttribute_Component_EventHandlerValue_SetsAttributeValue(Action<EventArgs> value)
{ {
// Arrange // Arrange
var builder = new RenderTreeBuilder(); var builder = new RenderTreeBuilder();
@ -1241,7 +1241,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange // Arrange
var builder = new RenderTreeBuilder(); var builder = new RenderTreeBuilder();
var value = new Action<UIEventArgs>((e) => { }); var value = new Action<EventArgs>((e) => { });
// Act // Act
builder.OpenElement(0, "elem"); builder.OpenElement(0, "elem");
@ -1261,7 +1261,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange // Arrange
var builder = new RenderTreeBuilder(); var builder = new RenderTreeBuilder();
var value = new Action<UIEventArgs>((e) => { }); var value = new Action<EventArgs>((e) => { });
// Act // Act
builder.OpenComponent<TestComponent>(0); builder.OpenComponent<TestComponent>(0);

View File

@ -835,9 +835,9 @@ namespace Microsoft.AspNetCore.Components.Test
public void RecognizesAttributeEventHandlerValuesChanged() public void RecognizesAttributeEventHandlerValuesChanged()
{ {
// Arrange // Arrange
Action<UIEventArgs> retainedHandler = _ => { }; Action<EventArgs> retainedHandler = _ => { };
Action<UIEventArgs> removedHandler = _ => { }; Action<EventArgs> removedHandler = _ => { };
Action<UIEventArgs> addedHandler = _ => { }; Action<EventArgs> addedHandler = _ => { };
oldTree.OpenElement(0, "My element"); oldTree.OpenElement(0, "My element");
oldTree.AddAttribute(1, "onfoo", retainedHandler); oldTree.AddAttribute(1, "onfoo", retainedHandler);
oldTree.AddAttribute(2, "onbar", removedHandler); oldTree.AddAttribute(2, "onbar", removedHandler);
@ -1575,7 +1575,7 @@ namespace Microsoft.AspNetCore.Components.Test
public void PreservesEventHandlerIdsForRetainedEventHandlers() public void PreservesEventHandlerIdsForRetainedEventHandlers()
{ {
// Arrange // Arrange
Action<UIEventArgs> retainedHandler = _ => { }; Action<EventArgs> retainedHandler = _ => { };
oldTree.OpenElement(0, "My element"); oldTree.OpenElement(0, "My element");
oldTree.AddAttribute(1, "ontest", retainedHandler); oldTree.AddAttribute(1, "ontest", retainedHandler);
oldTree.CloseElement(); oldTree.CloseElement();
@ -1601,7 +1601,7 @@ namespace Microsoft.AspNetCore.Components.Test
public void PreservesEventHandlerIdsForRetainedEventHandlers_SlowPath() public void PreservesEventHandlerIdsForRetainedEventHandlers_SlowPath()
{ {
// Arrange // Arrange
Action<UIEventArgs> retainedHandler = _ => { }; Action<EventArgs> retainedHandler = _ => { };
oldTree.OpenElement(0, "My element"); oldTree.OpenElement(0, "My element");
oldTree.AddAttribute(0, "ontest", retainedHandler); oldTree.AddAttribute(0, "ontest", retainedHandler);
oldTree.CloseElement(); oldTree.CloseElement();

View File

@ -430,7 +430,7 @@ namespace Microsoft.AspNetCore.Components.Test
{ {
// Arrange: Render a component with an event handler // Arrange: Render a component with an event handler
var renderer = new TestRenderer(); var renderer = new TestRenderer();
UIEventArgs receivedArgs = null; EventArgs receivedArgs = null;
var component = new EventComponent var component = new EventComponent
{ {
@ -448,7 +448,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs); Assert.Null(receivedArgs);
// Act/Assert: Event can be fired // Act/Assert: Event can be fired
var eventArgs = new UIEventArgs(); var eventArgs = new EventArgs();
var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
// This should always be run synchronously // This should always be run synchronously
@ -460,7 +460,7 @@ namespace Microsoft.AspNetCore.Components.Test
{ {
// Arrange: Render a component with an event handler // Arrange: Render a component with an event handler
var renderer = new TestRenderer(); var renderer = new TestRenderer();
UIEventArgs receivedArgs = null; EventArgs receivedArgs = null;
var component = new EventComponent var component = new EventComponent
{ {
@ -478,7 +478,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs); Assert.Null(receivedArgs);
// Act/Assert: Event can be fired // Act/Assert: Event can be fired
var eventArgs = new UIEventArgs(); var eventArgs = new EventArgs();
var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully); Assert.True(renderTask.IsCompletedSuccessfully);
Assert.Same(eventArgs, receivedArgs); Assert.Same(eventArgs, receivedArgs);
@ -508,7 +508,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Empty(renderer.HandledExceptions); Assert.Empty(renderer.HandledExceptions);
// Act/Assert: Event can be fired // Act/Assert: Event can be fired
var eventArgs = new UIEventArgs(); var eventArgs = new EventArgs();
var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully); Assert.True(renderTask.IsCompletedSuccessfully);
@ -577,7 +577,7 @@ namespace Microsoft.AspNetCore.Components.Test
[Fact] [Fact]
public void CanDispatchEventsToNestedComponents() public void CanDispatchEventsToNestedComponents()
{ {
UIEventArgs receivedArgs = null; EventArgs receivedArgs = null;
// Arrange: Render parent component // Arrange: Render parent component
var renderer = new TestRenderer(); var renderer = new TestRenderer();
@ -608,7 +608,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs); Assert.Null(receivedArgs);
// Act/Assert: Event can be fired // Act/Assert: Event can be fired
var eventArgs = new UIEventArgs(); var eventArgs = new EventArgs();
var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully); Assert.True(renderTask.IsCompletedSuccessfully);
Assert.Same(eventArgs, receivedArgs); Assert.Same(eventArgs, receivedArgs);
@ -619,7 +619,7 @@ namespace Microsoft.AspNetCore.Components.Test
{ {
// Arrange: Render a component with an event handler // Arrange: Render a component with an event handler
var renderer = new TestRenderer(); var renderer = new TestRenderer();
UIEventArgs receivedArgs = null; EventArgs receivedArgs = null;
var state = 0; var state = 0;
var tcs = new TaskCompletionSource<object>(); var tcs = new TaskCompletionSource<object>();
@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs); Assert.Null(receivedArgs);
// Act/Assert: Event can be fired // Act/Assert: Event can be fired
var eventArgs = new UIEventArgs(); var eventArgs = new EventArgs();
var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.Equal(1, state); Assert.Equal(1, state);
Assert.Same(eventArgs, receivedArgs); Assert.Same(eventArgs, receivedArgs);
@ -746,7 +746,7 @@ namespace Microsoft.AspNetCore.Components.Test
[Fact] [Fact]
public async Task CanAsyncDispatchEventsToNestedComponents() public async Task CanAsyncDispatchEventsToNestedComponents()
{ {
UIEventArgs receivedArgs = null; EventArgs receivedArgs = null;
var state = 0; var state = 0;
var tcs = new TaskCompletionSource<object>(); var tcs = new TaskCompletionSource<object>();
@ -786,7 +786,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs); Assert.Null(receivedArgs);
// Act/Assert: Event can be fired // Act/Assert: Event can be fired
var eventArgs = new UIEventArgs(); var eventArgs = new EventArgs();
var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.Equal(1, state); Assert.Equal(1, state);
Assert.Same(eventArgs, receivedArgs); Assert.Same(eventArgs, receivedArgs);
@ -1774,7 +1774,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Act/Assert // Act/Assert
await Assert.ThrowsAsync<ArgumentException>(() => await Assert.ThrowsAsync<ArgumentException>(() =>
{ {
return renderer.DispatchEventAsync(0, new UIEventArgs()); return renderer.DispatchEventAsync(0, new EventArgs());
}); });
} }
@ -2052,7 +2052,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange // Arrange
var renderer = new TestRenderer(); var renderer = new TestRenderer();
var eventCount = 0; var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; }; Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new EventComponent { OnTest = origEventHandler }; var component = new EventComponent { OnTest = origEventHandler };
var componentId = renderer.AssignRootComponentId(component); var componentId = renderer.AssignRootComponentId(component);
component.TriggerRender(); component.TriggerRender();
@ -2094,7 +2094,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange // Arrange
var renderer = new TestRenderer(); var renderer = new TestRenderer();
var eventCount = 0; var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; }; Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new EventComponent { OnTest = origEventHandler }; var component = new EventComponent { OnTest = origEventHandler };
var componentId = renderer.AssignRootComponentId(component); var componentId = renderer.AssignRootComponentId(component);
component.TriggerRender(); component.TriggerRender();
@ -2129,7 +2129,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange // Arrange
var renderer = new TestRenderer(); var renderer = new TestRenderer();
var eventCount = 0; var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; }; Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new ConditionalParentComponent<EventComponent> var component = new ConditionalParentComponent<EventComponent>
{ {
IncludeChild = true, IncludeChild = true,
@ -2180,7 +2180,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange // Arrange
var renderer = new TestRenderer(); var renderer = new TestRenderer();
var eventCount = 0; var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; }; Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new EventComponent { OnTest = origEventHandler }; var component = new EventComponent { OnTest = origEventHandler };
var componentId = renderer.AssignRootComponentId(component); var componentId = renderer.AssignRootComponentId(component);
component.TriggerRender(); component.TriggerRender();
@ -2222,7 +2222,7 @@ namespace Microsoft.AspNetCore.Components.Test
{ {
builder.AddContent(0, "Child event count: " + eventCount); builder.AddContent(0, "Child event count: " + eventCount);
builder.OpenComponent<EventComponent>(1); builder.OpenComponent<EventComponent>(1);
builder.AddAttribute(2, nameof(EventComponent.OnTest), new Action<UIEventArgs>(args => builder.AddAttribute(2, nameof(EventComponent.OnTest), new Action<EventArgs>(args =>
{ {
eventCount++; eventCount++;
rootComponent.TriggerRender(); rootComponent.TriggerRender();
@ -2468,7 +2468,7 @@ namespace Microsoft.AspNetCore.Components.Test
.AttributeEventHandlerId; .AttributeEventHandlerId;
// Act: Toggle the checkbox // Act: Toggle the checkbox
var eventArgs = new UIChangeEventArgs { Value = true }; var eventArgs = new ChangeEventArgs { Value = true };
var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs); var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully); Assert.True(renderTask.IsCompletedSuccessfully);
@ -2713,7 +2713,7 @@ namespace Microsoft.AspNetCore.Components.Test
}; };
var numEventsFired = 0; var numEventsFired = 0;
EventComponent component = null; EventComponent component = null;
Action<UIEventArgs> eventHandler = null; Action<EventArgs> eventHandler = null;
eventHandler = _ => eventHandler = _ =>
{ {
@ -2737,14 +2737,14 @@ namespace Microsoft.AspNetCore.Components.Test
// Act/Assert 1: Event can be fired for the first time // Act/Assert 1: Event can be fired for the first time
var render1TCS = new TaskCompletionSource<object>(); var render1TCS = new TaskCompletionSource<object>();
renderer.NextUpdateDisplayReturnTask = render1TCS.Task; renderer.NextUpdateDisplayReturnTask = render1TCS.Task;
await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); await renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
Assert.Equal(1, numEventsFired); Assert.Equal(1, numEventsFired);
// Act/Assert 2: *Same* event handler ID can be reused prior to completion of // Act/Assert 2: *Same* event handler ID can be reused prior to completion of
// preceding UI update // preceding UI update
var render2TCS = new TaskCompletionSource<object>(); var render2TCS = new TaskCompletionSource<object>();
renderer.NextUpdateDisplayReturnTask = render2TCS.Task; renderer.NextUpdateDisplayReturnTask = render2TCS.Task;
await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); await renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
Assert.Equal(2, numEventsFired); Assert.Equal(2, numEventsFired);
// Act/Assert 3: After we complete the first UI update in which a given // Act/Assert 3: After we complete the first UI update in which a given
@ -2760,7 +2760,7 @@ namespace Microsoft.AspNetCore.Components.Test
await awaitableTask; await awaitableTask;
var ex = await Assert.ThrowsAsync<ArgumentException>(() => var ex = await Assert.ThrowsAsync<ArgumentException>(() =>
{ {
return renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); return renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
}); });
Assert.Equal($"There is no event handler with ID {eventHandlerId}", ex.Message); Assert.Equal($"There is no event handler with ID {eventHandlerId}", ex.Message);
Assert.Equal(2, numEventsFired); Assert.Equal(2, numEventsFired);
@ -3318,7 +3318,7 @@ namespace Microsoft.AspNetCore.Components.Test
FieldValue = "new property value", FieldValue = "new property value",
ComponentId = componentId ComponentId = componentId
}; };
var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new UIChangeEventArgs var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new ChangeEventArgs
{ {
Value = "new property value" Value = "new property value"
}); });
@ -3336,7 +3336,7 @@ namespace Microsoft.AspNetCore.Components.Test
// show that the diff does *not* update the BoundString value attribute. // show that the diff does *not* update the BoundString value attribute.
Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type); Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
var attributeFrame = batch2.ReferenceFrames[edit.ReferenceFrameIndex]; var attributeFrame = batch2.ReferenceFrames[edit.ReferenceFrameIndex];
AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action<UIChangeEventArgs>)); AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action<ChangeEventArgs>));
Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId);
Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId);
}); });
@ -3370,7 +3370,7 @@ namespace Microsoft.AspNetCore.Components.Test
ComponentId = componentId, ComponentId = componentId,
FieldValue = newPropertyValue, FieldValue = newPropertyValue,
}; };
var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new UIChangeEventArgs var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new ChangeEventArgs
{ {
Value = newPropertyValue Value = newPropertyValue
}); });
@ -3388,7 +3388,7 @@ namespace Microsoft.AspNetCore.Components.Test
// show that the diff does *not* update the BoundString value attribute. // show that the diff does *not* update the BoundString value attribute.
Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type); Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
var attributeFrame = latestBatch.ReferenceFrames[edit.ReferenceFrameIndex]; var attributeFrame = latestBatch.ReferenceFrames[edit.ReferenceFrameIndex];
AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action<UIChangeEventArgs>)); AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action<ChangeEventArgs>));
Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId);
Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId);
}); });
@ -3507,10 +3507,10 @@ namespace Microsoft.AspNetCore.Components.Test
private class EventComponent : AutoRenderComponent, IComponent, IHandleEvent private class EventComponent : AutoRenderComponent, IComponent, IHandleEvent
{ {
[Parameter] [Parameter]
public Action<UIEventArgs> OnTest { get; set; } public Action<EventArgs> OnTest { get; set; }
[Parameter] [Parameter]
public Func<UIEventArgs, Task> OnTestAsync { get; set; } public Func<EventArgs, Task> OnTestAsync { get; set; }
[Parameter] [Parameter]
public Action<DerivedEventArgs> OnClick { get; set; } public Action<DerivedEventArgs> OnClick { get; set; }
@ -3664,7 +3664,7 @@ namespace Microsoft.AspNetCore.Components.Test
=> _renderHandle.Render(builder => => _renderHandle.Render(builder =>
{ {
builder.OpenElement(0, "my button"); builder.OpenElement(0, "my button");
builder.AddAttribute(1, "my click handler", new Action<UIEventArgs>(eventArgs => OnClick(eventArgs))); builder.AddAttribute(1, "my click handler", new Action<EventArgs>(eventArgs => OnClick(eventArgs)));
builder.CloseElement(); builder.CloseElement();
}); });
} }
@ -4095,7 +4095,7 @@ namespace Microsoft.AspNetCore.Components.Test
builder.OpenElement(0, "element with event"); builder.OpenElement(0, "element with event");
builder.AddAttribute(1, nameof(BoundString), BoundString); builder.AddAttribute(1, nameof(BoundString), BoundString);
builder.AddAttribute(2, "ontestevent", new Action<UIChangeEventArgs>((UIChangeEventArgs eventArgs) => builder.AddAttribute(2, "ontestevent", new Action<ChangeEventArgs>((ChangeEventArgs eventArgs) =>
{ {
BoundString = (string)eventArgs.Value; BoundString = (string)eventArgs.Value;
TriggerRender(); TriggerRender();
@ -4106,7 +4106,7 @@ namespace Microsoft.AspNetCore.Components.Test
} }
} }
private class DerivedEventArgs : UIEventArgs private class DerivedEventArgs : EventArgs
{ {
} }
} }

View File

@ -343,7 +343,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
{ {
rtb.OpenElement(0, "p"); rtb.OpenElement(0, "p");
rtb.OpenElement(1, "input"); rtb.OpenElement(1, "input");
rtb.AddAttribute(2, "change", pc.GetValueOrDefault<Action<UIChangeEventArgs>>("update")); rtb.AddAttribute(2, "change", pc.GetValueOrDefault<Action<ChangeEventArgs>>("update"));
rtb.AddAttribute(3, "value", pc.GetValueOrDefault<int>("value")); rtb.AddAttribute(3, "value", pc.GetValueOrDefault<int>("value"));
rtb.CloseElement(); rtb.CloseElement();
rtb.CloseElement(); rtb.CloseElement();
@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
.BuildServiceProvider(); .BuildServiceProvider();
var htmlRenderer = GetHtmlRenderer(serviceProvider); var htmlRenderer = GetHtmlRenderer(serviceProvider);
Action<UIChangeEventArgs> change = (UIChangeEventArgs changeArgs) => throw new InvalidOperationException(); Action<ChangeEventArgs> change = (ChangeEventArgs changeArgs) => throw new InvalidOperationException();
// Act // Act
var result = GetResult(htmlRenderer.Dispatcher.InvokeAsync(() => htmlRenderer.RenderComponentAsync<ComponentWithParameters>( var result = GetResult(htmlRenderer.Dispatcher.InvokeAsync(() => htmlRenderer.RenderComponentAsync<ComponentWithParameters>(

View File

@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers
Assert.Equal(attributeValue, frame.AttributeValue); Assert.Equal(attributeValue, frame.AttributeValue);
} }
public static void Attribute(RenderTreeFrame frame, string attributeName, Action<UIEventArgs> attributeEventHandlerValue, int? sequence = null) public static void Attribute(RenderTreeFrame frame, string attributeName, Action<EventArgs> attributeEventHandlerValue, int? sequence = null)
{ {
AssertFrame.Attribute(frame, attributeName, sequence); AssertFrame.Attribute(frame, attributeName, sequence);
Assert.Equal(attributeEventHandlerValue, frame.AttributeValue); Assert.Equal(attributeEventHandlerValue, frame.AttributeValue);

View File

@ -60,10 +60,10 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers
public new Task RenderRootComponentAsync(int componentId, ParameterView parameters) public new Task RenderRootComponentAsync(int componentId, ParameterView parameters)
=> Dispatcher.InvokeAsync(() => base.RenderRootComponentAsync(componentId, parameters)); => Dispatcher.InvokeAsync(() => base.RenderRootComponentAsync(componentId, parameters));
public Task DispatchEventAsync(ulong eventHandlerId, UIEventArgs args) public Task DispatchEventAsync(ulong eventHandlerId, EventArgs args)
=> Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, null, args)); => Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, null, args));
public new Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs args) public new Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs args)
=> Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, eventFieldInfo, args)); => Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, eventFieldInfo, args));
private static Task UnwrapTask(Task task) private static Task UnwrapTask(Task task)

View File

@ -53,23 +53,23 @@ namespace Microsoft.AspNetCore.Components
public System.Type EventArgsType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Type EventArgsType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
} }
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onabort", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onabort", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onactivate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onblur", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onblur", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncontextmenu", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncontextmenu", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncopy", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncopy", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncuechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncuechange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncut", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncut", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondblclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondblclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondeactivate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrag", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrag", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragend", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragend", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragenter", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragenter", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
@ -77,24 +77,24 @@ namespace Microsoft.AspNetCore.Components
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragover", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragover", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragstart", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragstart", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrop", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrop", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondurationchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondurationchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onerror", typeof(Microsoft.AspNetCore.Components.UIErrorEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onerror", typeof(Microsoft.AspNetCore.Components.UIErrorEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocus", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocus", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusin", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusin", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusout", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusout", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ongotpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ongotpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeydown", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeydown", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeypress", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeypress", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeyup", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeyup", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onload", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onload", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadend", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadend", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadstart", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadstart", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onlostpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onlostpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
@ -105,50 +105,51 @@ namespace Microsoft.AspNetCore.Components
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onmouseup", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onmouseup", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onmousewheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onmousewheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpaste", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpaste", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointercancel", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointercancel", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerdown", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerdown", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerenter", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerenter", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerleave", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerleave", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointermove", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointermove", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerout", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerout", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerover", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerover", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerup", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerup", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onprogress", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onprogress", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeout", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeout", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeupdate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeupdate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchcancel", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchcancel", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchend", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchend", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchenter", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchenter", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchleave", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchleave", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchmove", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchmove", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchstart", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchstart", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onvolumechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onvolumechange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onwaiting", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwaiting", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onwheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))]
public static partial class EventHandlers public static partial class EventHandlers
{ {
} }
public partial class UIClipboardEventArgs : Microsoft.AspNetCore.Components.UIEventArgs public partial class UIClipboardEventArgs : System.EventArgs
{ {
public UIClipboardEventArgs() { } public UIClipboardEventArgs() { }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UIDataTransferItem public partial class UIDataTransferItem
{ {
@ -161,19 +162,21 @@ namespace Microsoft.AspNetCore.Components
public UIDragEventArgs() { } public UIDragEventArgs() { }
public Microsoft.AspNetCore.Components.DataTransfer DataTransfer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Components.DataTransfer DataTransfer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UIErrorEventArgs : Microsoft.AspNetCore.Components.UIEventArgs public partial class UIErrorEventArgs : System.EventArgs
{ {
public UIErrorEventArgs() { } public UIErrorEventArgs() { }
public int Colno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int Colno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string Filename { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string Filename { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public int Lineno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int Lineno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string Message { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string Message { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UIFocusEventArgs : Microsoft.AspNetCore.Components.UIEventArgs public partial class UIFocusEventArgs : System.EventArgs
{ {
public UIFocusEventArgs() { } public UIFocusEventArgs() { }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UIKeyboardEventArgs : Microsoft.AspNetCore.Components.UIEventArgs public partial class UIKeyboardEventArgs : System.EventArgs
{ {
public UIKeyboardEventArgs() { } public UIKeyboardEventArgs() { }
public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
@ -184,8 +187,9 @@ namespace Microsoft.AspNetCore.Components
public bool MetaKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool MetaKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public bool Repeat { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool Repeat { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UIMouseEventArgs : Microsoft.AspNetCore.Components.UIEventArgs public partial class UIMouseEventArgs : System.EventArgs
{ {
public UIMouseEventArgs() { } public UIMouseEventArgs() { }
public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
@ -199,6 +203,7 @@ namespace Microsoft.AspNetCore.Components
public double ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public double ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public double ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public double ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UIPointerEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs public partial class UIPointerEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs
{ {
@ -212,14 +217,15 @@ namespace Microsoft.AspNetCore.Components
public float TiltY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public float TiltY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public float Width { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public float Width { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UIProgressEventArgs : Microsoft.AspNetCore.Components.UIEventArgs public partial class UIProgressEventArgs : System.EventArgs
{ {
public UIProgressEventArgs() { } public UIProgressEventArgs() { }
public bool LengthComputable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool LengthComputable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public long Loaded { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long Loaded { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public long Total { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long Total { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UITouchEventArgs : Microsoft.AspNetCore.Components.UIEventArgs public partial class UITouchEventArgs : System.EventArgs
{ {
public UITouchEventArgs() { } public UITouchEventArgs() { }
public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
@ -230,6 +236,7 @@ namespace Microsoft.AspNetCore.Components
public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Components.UITouchPoint[] TargetTouches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Components.UITouchPoint[] TargetTouches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Components.UITouchPoint[] Touches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Components.UITouchPoint[] Touches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
public partial class UITouchPoint public partial class UITouchPoint
{ {

View File

@ -43,19 +43,19 @@ namespace Microsoft.AspNetCore.Components
[EventHandler("onkeypress", typeof(UIKeyboardEventArgs))] [EventHandler("onkeypress", typeof(UIKeyboardEventArgs))]
// Input events // Input events
[EventHandler("onchange", typeof(UIChangeEventArgs))] [EventHandler("onchange", typeof(ChangeEventArgs))]
[EventHandler("oninput", typeof(UIChangeEventArgs))] [EventHandler("oninput", typeof(ChangeEventArgs))]
[EventHandler("oninvalid", typeof(UIEventArgs))] [EventHandler("oninvalid", typeof(EventArgs))]
[EventHandler("onreset", typeof(UIEventArgs))] [EventHandler("onreset", typeof(EventArgs))]
[EventHandler("onselect", typeof(UIEventArgs))] [EventHandler("onselect", typeof(EventArgs))]
[EventHandler("onselectstart", typeof(UIEventArgs))] [EventHandler("onselectstart", typeof(EventArgs))]
[EventHandler("onselectionchange", typeof(UIEventArgs))] [EventHandler("onselectionchange", typeof(EventArgs))]
[EventHandler("onsubmit", typeof(UIEventArgs))] [EventHandler("onsubmit", typeof(EventArgs))]
// Clipboard events // Clipboard events
[EventHandler("onbeforecopy", typeof(UIEventArgs))] [EventHandler("onbeforecopy", typeof(EventArgs))]
[EventHandler("onbeforecut", typeof(UIEventArgs))] [EventHandler("onbeforecut", typeof(EventArgs))]
[EventHandler("onbeforepaste", typeof(UIEventArgs))] [EventHandler("onbeforepaste", typeof(EventArgs))]
[EventHandler("oncopy", typeof(UIClipboardEventArgs))] [EventHandler("oncopy", typeof(UIClipboardEventArgs))]
[EventHandler("oncut", typeof(UIClipboardEventArgs))] [EventHandler("oncut", typeof(UIClipboardEventArgs))]
[EventHandler("onpaste", typeof(UIClipboardEventArgs))] [EventHandler("onpaste", typeof(UIClipboardEventArgs))]
@ -81,23 +81,23 @@ namespace Microsoft.AspNetCore.Components
[EventHandler("onpointerup", typeof(UIPointerEventArgs))] [EventHandler("onpointerup", typeof(UIPointerEventArgs))]
// Media events // Media events
[EventHandler("oncanplay", typeof(UIEventArgs))] [EventHandler("oncanplay", typeof(EventArgs))]
[EventHandler("oncanplaythrough", typeof(UIEventArgs))] [EventHandler("oncanplaythrough", typeof(EventArgs))]
[EventHandler("oncuechange", typeof(UIEventArgs))] [EventHandler("oncuechange", typeof(EventArgs))]
[EventHandler("ondurationchange", typeof(UIEventArgs))] [EventHandler("ondurationchange", typeof(EventArgs))]
[EventHandler("onemptied", typeof(UIEventArgs))] [EventHandler("onemptied", typeof(EventArgs))]
[EventHandler("onpause", typeof(UIEventArgs))] [EventHandler("onpause", typeof(EventArgs))]
[EventHandler("onplay", typeof(UIEventArgs))] [EventHandler("onplay", typeof(EventArgs))]
[EventHandler("onplaying", typeof(UIEventArgs))] [EventHandler("onplaying", typeof(EventArgs))]
[EventHandler("onratechange", typeof(UIEventArgs))] [EventHandler("onratechange", typeof(EventArgs))]
[EventHandler("onseeked", typeof(UIEventArgs))] [EventHandler("onseeked", typeof(EventArgs))]
[EventHandler("onseeking", typeof(UIEventArgs))] [EventHandler("onseeking", typeof(EventArgs))]
[EventHandler("onstalled", typeof(UIEventArgs))] [EventHandler("onstalled", typeof(EventArgs))]
[EventHandler("onstop", typeof(UIEventArgs))] [EventHandler("onstop", typeof(EventArgs))]
[EventHandler("onsuspend", typeof(UIEventArgs))] [EventHandler("onsuspend", typeof(EventArgs))]
[EventHandler("ontimeupdate", typeof(UIEventArgs))] [EventHandler("ontimeupdate", typeof(EventArgs))]
[EventHandler("onvolumechange", typeof(UIEventArgs))] [EventHandler("onvolumechange", typeof(EventArgs))]
[EventHandler("onwaiting", typeof(UIEventArgs))] [EventHandler("onwaiting", typeof(EventArgs))]
// Progress events // Progress events
[EventHandler("onloadstart", typeof(UIProgressEventArgs))] [EventHandler("onloadstart", typeof(UIProgressEventArgs))]
@ -109,19 +109,19 @@ namespace Microsoft.AspNetCore.Components
[EventHandler("onerror", typeof(UIErrorEventArgs))] [EventHandler("onerror", typeof(UIErrorEventArgs))]
// General events // General events
[EventHandler("onactivate", typeof(UIEventArgs))] [EventHandler("onactivate", typeof(EventArgs))]
[EventHandler("onbeforeactivate", typeof(UIEventArgs))] [EventHandler("onbeforeactivate", typeof(EventArgs))]
[EventHandler("onbeforedeactivate", typeof(UIEventArgs))] [EventHandler("onbeforedeactivate", typeof(EventArgs))]
[EventHandler("ondeactivate", typeof(UIEventArgs))] [EventHandler("ondeactivate", typeof(EventArgs))]
[EventHandler("onended", typeof(UIEventArgs))] [EventHandler("onended", typeof(EventArgs))]
[EventHandler("onfullscreenchange", typeof(UIEventArgs))] [EventHandler("onfullscreenchange", typeof(EventArgs))]
[EventHandler("onfullscreenerror", typeof(UIEventArgs))] [EventHandler("onfullscreenerror", typeof(EventArgs))]
[EventHandler("onloadeddata", typeof(UIEventArgs))] [EventHandler("onloadeddata", typeof(EventArgs))]
[EventHandler("onloadedmetadata", typeof(UIEventArgs))] [EventHandler("onloadedmetadata", typeof(EventArgs))]
[EventHandler("onpointerlockchange", typeof(UIEventArgs))] [EventHandler("onpointerlockchange", typeof(EventArgs))]
[EventHandler("onpointerlockerror", typeof(UIEventArgs))] [EventHandler("onpointerlockerror", typeof(EventArgs))]
[EventHandler("onreadystatechange", typeof(UIEventArgs))] [EventHandler("onreadystatechange", typeof(EventArgs))]
[EventHandler("onscroll", typeof(UIEventArgs))] [EventHandler("onscroll", typeof(EventArgs))]
public static class EventHandlers public static class EventHandlers
{ {
} }

View File

@ -54,12 +54,12 @@ namespace Microsoft.AspNetCore.Components.Web
} }
} }
private static UIEventArgs ParseEventArgsJson(string eventArgsType, string eventArgsJson) private static EventArgs ParseEventArgsJson(string eventArgsType, string eventArgsJson)
{ {
switch (eventArgsType) switch (eventArgsType)
{ {
case "change": case "change":
return DeserializeUIEventChangeArgs(eventArgsJson); return DeserializeChangeEventArgs(eventArgsJson);
case "clipboard": case "clipboard":
return Deserialize<UIClipboardEventArgs>(eventArgsJson); return Deserialize<UIClipboardEventArgs>(eventArgsJson);
case "drag": case "drag":
@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Components.Web
case "touch": case "touch":
return Deserialize<UITouchEventArgs>(eventArgsJson); return Deserialize<UITouchEventArgs>(eventArgsJson);
case "unknown": case "unknown":
return Deserialize<UIEventArgs>(eventArgsJson); return EventArgs.Empty;
case "wheel": case "wheel":
return Deserialize<UIWheelEventArgs>(eventArgsJson); return Deserialize<UIWheelEventArgs>(eventArgsJson);
default: default:
@ -92,9 +92,9 @@ namespace Microsoft.AspNetCore.Components.Web
return JsonSerializer.Deserialize<T>(eventArgsJson, JsonSerializerOptionsProvider.Options); return JsonSerializer.Deserialize<T>(eventArgsJson, JsonSerializerOptionsProvider.Options);
} }
private static UIChangeEventArgs DeserializeUIEventChangeArgs(string eventArgsJson) private static ChangeEventArgs DeserializeChangeEventArgs(string eventArgsJson)
{ {
var changeArgs = Deserialize<UIChangeEventArgs>(eventArgsJson); var changeArgs = Deserialize<ChangeEventArgs>(eventArgsJson);
var jsonElement = (JsonElement)changeArgs.Value; var jsonElement = (JsonElement)changeArgs.Value;
switch (jsonElement.ValueKind) switch (jsonElement.ValueKind)
{ {
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Components.Web
changeArgs.Value = jsonElement.GetBoolean(); changeArgs.Value = jsonElement.GetBoolean();
break; break;
default: default:
throw new ArgumentException($"Unsupported {nameof(UIChangeEventArgs)} value {jsonElement}."); throw new ArgumentException($"Unsupported {nameof(ChangeEventArgs)} value {jsonElement}.");
} }
return changeArgs; return changeArgs;
} }

View File

@ -1,12 +1,18 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about an clipboard event that is being raised. /// Supplies information about an clipboard event that is being raised.
/// </summary> /// </summary>
public class UIClipboardEventArgs : UIEventArgs public class UIClipboardEventArgs : EventArgs
{ {
/// <summary>
/// Gets or sets the type of the event.
/// </summary>
public string Type { get; set; }
} }
} }

View File

@ -1,12 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about an error event that is being raised. /// Supplies information about an error event that is being raised.
/// </summary> /// </summary>
public class UIErrorEventArgs : UIEventArgs public class UIErrorEventArgs : EventArgs
{ {
/// <summary> /// <summary>
/// Gets a a human-readable error message describing the problem. /// Gets a a human-readable error message describing the problem.
@ -27,5 +29,10 @@ namespace Microsoft.AspNetCore.Components
/// Gets the column number of the script file on which the error occurred. /// Gets the column number of the script file on which the error occurred.
/// </summary> /// </summary>
public int Colno { get; set; } public int Colno { get; set; }
/// <summary>
/// Gets or sets the type of the event.
/// </summary>
public string Type { get; set; }
} }
} }

View File

@ -1,14 +1,21 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about a focus event that is being raised. /// Supplies information about a focus event that is being raised.
/// </summary> /// </summary>
public class UIFocusEventArgs : UIEventArgs public class UIFocusEventArgs : EventArgs
{ {
// Not including support for 'relatedTarget' since we don't have a good way to represent it. // Not including support for 'relatedTarget' since we don't have a good way to represent it.
// see: https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent // see: https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent
/// <summary>
/// Gets or sets the type of the event.
/// </summary>
public string Type { get; set; }
} }
} }

View File

@ -1,12 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about a keyboard event that is being raised. /// Supplies information about a keyboard event that is being raised.
/// </summary> /// </summary>
public class UIKeyboardEventArgs : UIEventArgs public class UIKeyboardEventArgs : EventArgs
{ {
/// <summary> /// <summary>
/// The key value of the key represented by the event. /// The key value of the key represented by the event.
@ -51,5 +53,10 @@ namespace Microsoft.AspNetCore.Components
/// true if the meta key was down when the event was fired. false otherwise. /// true if the meta key was down when the event was fired. false otherwise.
/// </summary> /// </summary>
public bool MetaKey { get; set; } public bool MetaKey { get; set; }
/// <summary>
/// Gets or sets the type of the event.
/// </summary>
public string Type { get; set; }
} }
} }

View File

@ -1,12 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about a mouse event that is being raised. /// Supplies information about a mouse event that is being raised.
/// </summary> /// </summary>
public class UIMouseEventArgs : UIEventArgs public class UIMouseEventArgs : EventArgs
{ {
/// <summary> /// <summary>
/// A count of consecutive clicks that happened in a short amount of time, incremented by one. /// A count of consecutive clicks that happened in a short amount of time, incremented by one.
@ -73,5 +75,10 @@ namespace Microsoft.AspNetCore.Components
/// <c>true</c> if the meta key was down when the event was fired. <c>false</c> otherwise. /// <c>true</c> if the meta key was down when the event was fired. <c>false</c> otherwise.
/// </summary> /// </summary>
public bool MetaKey { get; set; } public bool MetaKey { get; set; }
/// <summary>
/// Gets or sets the type of the event.
/// </summary>
public string Type { get; set; }
} }
} }

View File

@ -1,12 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about a progress event that is being raised. /// Supplies information about a progress event that is being raised.
/// </summary> /// </summary>
public class UIProgressEventArgs : UIEventArgs public class UIProgressEventArgs : EventArgs
{ {
/// <summary> /// <summary>
/// Whether or not the total size of the transfer is known. /// Whether or not the total size of the transfer is known.
@ -24,5 +26,10 @@ namespace Microsoft.AspNetCore.Components
/// If the total size is unknown, this value is zero. /// If the total size is unknown, this value is zero.
/// </summary> /// </summary>
public long Total { get; set; } public long Total { get; set; }
/// <summary>
/// Gets or sets the type of the event.
/// </summary>
public string Type { get; set; }
} }
} }

View File

@ -1,12 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Supplies information about a touch event that is being raised. /// Supplies information about a touch event that is being raised.
/// </summary> /// </summary>
public class UITouchEventArgs : UIEventArgs public class UITouchEventArgs : EventArgs
{ {
/// <summary> /// <summary>
/// A count of consecutive clicks that happened in a short amount of time, incremented by one. /// A count of consecutive clicks that happened in a short amount of time, incremented by one.
@ -50,5 +52,10 @@ namespace Microsoft.AspNetCore.Components
/// true if the meta key was down when the event was fired. false otherwise. /// true if the meta key was down when the event was fired. false otherwise.
/// </summary> /// </summary>
public bool MetaKey { get; set; } public bool MetaKey { get; set; }
/// <summary>
/// Gets or sets the type of the event.
/// </summary>
public string Type { get; set; }
} }
} }

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary> /// <summary>
/// Provides extension methods for <see cref="EventCallbackFactory"/> and <see cref="UIEventArgs"/> types. /// Provides extension methods for <see cref="EventCallbackFactory"/> and <see cref="EventArgs"/> types.
/// </summary> /// </summary>
public static class WebEventCallbackFactoryUIEventArgsExtensions public static class WebEventCallbackFactoryUIEventArgsExtensions
{ {

View File

@ -385,7 +385,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests
} }
[Fact] [Fact]
public async Task DispatchingEventsWithInvalidUIEventArgs() public async Task DispatchingEventsWithInvalidEventArgs()
{ {
// Arrange // Arrange
var (interopCalls, dotNetCompletions, batches) = ConfigureClient(); var (interopCalls, dotNetCompletions, batches) = ConfigureClient();

View File

@ -8,7 +8,7 @@
</select> </select>
@code { @code {
void OnSelected(UIChangeEventArgs e) void OnSelected(ChangeEventArgs e)
{ {
// Included fragment to preserve choice of Blazor client or server. // Included fragment to preserve choice of Blazor client or server.
var redirect = new Uri(UriHelper.GetAbsoluteUri()).GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, UriFormat.UriEscaped); var redirect = new Uri(UriHelper.GetAbsoluteUri()).GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, UriFormat.UriEscaped);

View File

@ -70,9 +70,8 @@ namespace Ignitor
throw new InvalidOperationException("Element does not have a change event."); throw new InvalidOperationException("Element does not have a change event.");
} }
var sleectEventArgs = new UIChangeEventArgs() var args = new ChangeEventArgs()
{ {
Type = changeEventDescriptor.EventName,
Value = value Value = value
}; };
@ -88,7 +87,7 @@ namespace Ignitor
} }
}; };
return DispatchEventCore(connection, Serialize(browserDescriptor), Serialize(sleectEventArgs)); return DispatchEventCore(connection, Serialize(browserDescriptor), Serialize(args));
} }
public Task ClickAsync(HubConnection connection) public Task ClickAsync(HubConnection connection)