Merge branch 'release/3.0'

This commit is contained in:
John Luo 2019-07-31 16:57:21 -07:00
commit e2fbe452d6
281 changed files with 2323 additions and 604 deletions

View File

@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Blazor.Rendering
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<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 HandleException(System.Exception exception) { }
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 />
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
// 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 EventFieldInfo EventFieldInfo;
public readonly UIEventArgs EventArgs;
public readonly EventArgs EventArgs;
public readonly TaskCompletionSource<object> TaskCompletionSource;
public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs eventArgs)
public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs)
{
EventHandlerId = eventHandlerId;
EventFieldInfo = eventFieldInfo;

View File

@ -46,12 +46,11 @@
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<UndefineProperties>TargetFramework</UndefineProperties>
</ProjectReference>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\..\DevServer\src\Microsoft.AspNetCore.Blazor.DevServer.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<!-- Optimization. Do not require framework compatibility between these projects. -->
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<UndefineProperties>TargetFramework</UndefineProperties>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<!-- When referencing from source, we need to disable VS's fast up-to-date check,
because otherwise changing the underlying Blazor library code isn't enough
to make it rebuild the affected library apps. -->
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
</Project>

View File

@ -253,7 +253,7 @@ namespace Test
public class MyComponent : ComponentBase
{
[Parameter]
public Action<UIEventArgs> OnClick { get; set; }
public Action<EventArgs> OnClick { get; set; }
}
}
"));
@ -263,7 +263,7 @@ namespace Test
@code {
private int counter;
private void Increment(UIEventArgs e) {
private void Increment(EventArgs e) {
counter++;
}
}");
@ -280,7 +280,7 @@ namespace Test
AssertFrame.Attribute(frame, "OnClick", 1);
// 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("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
//
// 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);
await task;
@ -367,7 +367,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property
//
// 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);
await task;
@ -404,7 +404,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
//
// This should always complete synchronously.
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);
await task;
@ -440,7 +440,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property
//
// 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);
await task;
@ -559,7 +559,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property
//
// 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);
await task;
@ -595,7 +595,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
// Trigger the change event to show it updates the property
//
// 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);
await task;

View File

@ -1,5 +1,4 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NuspecFile>Microsoft.AspNetCore.Blazor.Templates.nuspec</NuspecFile>
@ -16,18 +15,31 @@
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
</PropertyGroup>
<Target Name="TransformTemplateConfigs" BeforeTargets="CoreBuild" DependsOnTargets="SetTemplateJsonSymbolReplacements">
<!--
For each template, copy its '.template.config.src' directory to '.template.config',
removing any earlier output at that location
-->
<ItemGroup>
<UpToDateCheckInput Include="content\**\.template.config.src\**\*.*" />
</ItemGroup>
<Target Name="PrepareFileLists" AfterTargets="PrepareForBuild">
<ItemGroup>
<_TemplateConfigMainFile Include="content\**\.template.config.src\template.json" />
<_TemplateConfigDir Include="@(_TemplateConfigMainFile-&gt;'$([System.IO.Path]::GetDirectoryName('%(_TemplateConfigMainFile.FullPath)'))')" />
<_TemplateConfigDir Include="@(_TemplateConfigMainFile->'$([System.IO.Path]::GetDirectoryName('%(_TemplateConfigMainFile.FullPath)'))')" />
<_TemplateConfigFileToCopy Include="%(_TemplateConfigDir.Identity)\**\*.*">
<DestDir>$([System.IO.Path]::GetDirectoryName('%(_TemplateConfigDir.Identity)'))\.template.config\</DestDir>
</_TemplateConfigFileToCopy>
</ItemGroup>
</Target>
<Target
Name="TransformTemplateConfigs"
BeforeTargets="CoreBuild"
DependsOnTargets="SetTemplateJsonSymbolReplacements"
Inputs="@(_TemplateConfigFileToCopy)"
Outputs="@(_TemplateConfigFileToCopy->'%(DestDir)%(FileName)%(Extension)')">
<!--
For each template, copy its '.template.config.src' directory to '.template.config',
removing any earlier output at that location
-->
<RemoveDir Directories="%(_TemplateConfigFileToCopy.DestDir)" />
<Copy SourceFiles="%(_TemplateConfigFileToCopy.Identity)" DestinationFolder="%(_TemplateConfigFileToCopy.DestDir)" />
@ -49,8 +61,4 @@
<Output TaskParameter="OutputPath" ItemName="Content" />
</GenerateFileFromTemplate>
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<!-- Override SDK targets. This project does not produce a .dll. -->
<Target Name="CoreCompile" />
<Target Name="GetTargetPath" />
</Project>

View File

@ -1,5 +1,5 @@
<Router AppAssembly="typeof(Program).Assembly">
<NotFoundContent>
<NotFound>
<p>Sorry, there's nothing at this address.</p>
</NotFoundContent>
</NotFound>
</Router>

View File

@ -119,6 +119,11 @@ namespace Microsoft.AspNetCore.Components
public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
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 ComponentBase() { }
@ -188,35 +193,35 @@ namespace Microsoft.AspNetCore.Components
}
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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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(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<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, 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, 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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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<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.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<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<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.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<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)]
public readonly partial struct EventCallbackWorkItem
@ -301,9 +306,9 @@ namespace Microsoft.AspNetCore.Components
{
public PageDisplay() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public Microsoft.AspNetCore.Components.RenderFragment<Microsoft.AspNetCore.Components.AuthenticationState> NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Components.RenderFragment<Microsoft.AspNetCore.Components.AuthenticationState> NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public System.Type Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
@ -365,16 +370,6 @@ namespace Microsoft.AspNetCore.Components
public RouteAttribute(string template) { }
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
{
protected UriHelperBase() { }
@ -419,8 +414,10 @@ namespace Microsoft.AspNetCore.Components.Forms
public Microsoft.AspNetCore.Components.Forms.FieldIdentifier Field(string fieldName) { throw null; }
public System.Collections.Generic.IEnumerable<string> GetValidationMessages() { throw null; }
public System.Collections.Generic.IEnumerable<string> GetValidationMessages(Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; }
public System.Collections.Generic.IEnumerable<string> GetValidationMessages(System.Linq.Expressions.Expression<System.Func<object>> accessor) { throw null; }
public bool IsModified() { throw null; }
public bool IsModified(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; }
public bool IsModified(System.Linq.Expressions.Expression<System.Func<object>> accessor) { throw null; }
public void MarkAsUnmodified() { }
public void MarkAsUnmodified(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { }
public void NotifyFieldChanged(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { }
@ -431,24 +428,20 @@ namespace Microsoft.AspNetCore.Components.Forms
{
public static Microsoft.AspNetCore.Components.Forms.EditContext AddDataAnnotationsValidation(this Microsoft.AspNetCore.Components.Forms.EditContext editContext) { throw null; }
}
public static partial class EditContextExpressionExtensions
public sealed partial class FieldChangedEventArgs : System.EventArgs
{
public static System.Collections.Generic.IEnumerable<string> GetValidationMessages(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression<System.Func<object>> accessor) { throw null; }
public static bool IsModified(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression<System.Func<object>> accessor) { throw null; }
}
public sealed partial class FieldChangedEventArgs
{
internal FieldChangedEventArgs() { }
public FieldChangedEventArgs(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { }
public Microsoft.AspNetCore.Components.Forms.FieldIdentifier FieldIdentifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct FieldIdentifier
public readonly partial struct FieldIdentifier : System.IEquatable<Microsoft.AspNetCore.Components.Forms.FieldIdentifier>
{
private readonly object _dummy;
public FieldIdentifier(object model, string fieldName) { throw null; }
public string FieldName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public static Microsoft.AspNetCore.Components.Forms.FieldIdentifier Create<T>(System.Linq.Expressions.Expression<System.Func<T>> accessor) { throw null; }
public bool Equals(Microsoft.AspNetCore.Components.Forms.FieldIdentifier otherIdentifier) { throw null; }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
}
@ -457,24 +450,23 @@ namespace Microsoft.AspNetCore.Components.Forms
public ValidationMessageStore(Microsoft.AspNetCore.Components.Forms.EditContext editContext) { }
public System.Collections.Generic.IEnumerable<string> this[Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier] { get { throw null; } }
public System.Collections.Generic.IEnumerable<string> this[System.Linq.Expressions.Expression<System.Func<object>> accessor] { get { throw null; } }
public void Add(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier, System.Collections.Generic.IEnumerable<string> messages) { }
public void Add(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier, string message) { }
public void AddRange(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier, System.Collections.Generic.IEnumerable<string> messages) { }
public void Add(System.Linq.Expressions.Expression<System.Func<object>> accessor, System.Collections.Generic.IEnumerable<string> messages) { }
public void Add(System.Linq.Expressions.Expression<System.Func<object>> accessor, string message) { }
public void Clear() { }
public void Clear(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { }
public void Clear(System.Linq.Expressions.Expression<System.Func<object>> accessor) { }
}
public static partial class ValidationMessageStoreExpressionExtensions
public sealed partial class ValidationRequestedEventArgs : System.EventArgs
{
public static void Add(this Microsoft.AspNetCore.Components.Forms.ValidationMessageStore store, System.Linq.Expressions.Expression<System.Func<object>> accessor, string message) { }
public static void AddRange(this Microsoft.AspNetCore.Components.Forms.ValidationMessageStore store, System.Linq.Expressions.Expression<System.Func<object>> accessor, System.Collections.Generic.IEnumerable<string> messages) { }
public static void Clear(this Microsoft.AspNetCore.Components.Forms.ValidationMessageStore store, System.Linq.Expressions.Expression<System.Func<object>> accessor) { }
public static readonly new Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs Empty;
public ValidationRequestedEventArgs() { }
}
public sealed partial class ValidationRequestedEventArgs
public sealed partial class ValidationStateChangedEventArgs : System.EventArgs
{
internal ValidationRequestedEventArgs() { }
}
public sealed partial class ValidationStateChangedEventArgs
{
internal ValidationStateChangedEventArgs() { }
public static readonly new Microsoft.AspNetCore.Components.Forms.ValidationStateChangedEventArgs Empty;
public ValidationStateChangedEventArgs() { }
}
}
namespace Microsoft.AspNetCore.Components.Rendering
@ -519,7 +511,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
public event System.UnhandledExceptionEventHandler UnhandledSynchronizationException { add { } remove { } }
protected internal virtual void AddToRenderQueue(int componentId, Microsoft.AspNetCore.Components.RenderFragment renderFragment) { }
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() { }
protected virtual void Dispose(bool disposing) { }
protected abstract void HandleException(System.Exception exception);
@ -651,11 +643,11 @@ namespace Microsoft.AspNetCore.Components.Routing
[Microsoft.AspNetCore.Components.ParameterAttribute]
public System.Reflection.Assembly AppAssembly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public Microsoft.AspNetCore.Components.RenderFragment<Microsoft.AspNetCore.Components.AuthenticationState> NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Components.RenderFragment<Microsoft.AspNetCore.Components.AuthenticationState> NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public Microsoft.AspNetCore.Components.RenderFragment NotFoundContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Components.RenderFragment NotFound { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
public void Dispose() { }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync() { throw null; }

View File

@ -58,8 +58,8 @@ namespace Microsoft.AspNetCore.Components
}
else if (isAuthorized)
{
var authorizedContent = Authorized ?? ChildContent;
builder.AddContent(1, authorizedContent?.Invoke(currentAuthenticationState));
var authorized = Authorized ?? ChildContent;
builder.AddContent(1, authorized?.Invoke(currentAuthenticationState));
}
else
{

View File

@ -1,16 +1,19 @@
// 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.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about an event that is being raised.
/// Supplies information about an change event that is being raised.
/// </summary>
public class UIEventArgs
public class ChangeEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the type of the event.
/// Gets or sets the new value.
/// </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="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<string> setter,
@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<bool> setter,
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<bool?> setter,
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<int> setter,
@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<int?> setter,
@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<long> setter,
@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<long?> setter,
@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<float> setter,
@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<float?> setter,
@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<double> setter,
@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<double?> setter,
@ -240,7 +240,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<decimal> setter,
@ -259,7 +259,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<decimal?> setter,
@ -278,7 +278,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTime> setter,
@ -298,7 +298,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTime> setter,
@ -318,7 +318,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTime?> setter,
@ -338,7 +338,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTime?> setter,
@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTimeOffset> setter,
@ -378,7 +378,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTimeOffset> setter,
@ -398,7 +398,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTimeOffset?> setter,
@ -418,7 +418,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder(
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<DateTimeOffset?> setter,
@ -439,7 +439,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="existingValue"></param>
/// <param name="culture"></param>
/// <returns></returns>
public static EventCallback<UIChangeEventArgs> CreateBinder<T>(
public static EventCallback<ChangeEventArgs> CreateBinder<T>(
this EventCallbackFactory factory,
object receiver,
Action<T> setter,
@ -449,14 +449,14 @@ namespace Microsoft.AspNetCore.Components
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,
object receiver,
Action<T> setter,
CultureInfo culture,
BindConverter.BindParser<T> converter)
{
Action<UIChangeEventArgs> callback = e =>
Action<ChangeEventArgs> callback = e =>
{
T value = default;
var converted = false;
@ -489,10 +489,10 @@ namespace Microsoft.AspNetCore.Components
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,
object receiver,
Action<T> setter,
@ -500,7 +500,7 @@ namespace Microsoft.AspNetCore.Components
string format,
BindConverter.BindParserWithFormat<T> converter)
{
Action<UIChangeEventArgs> callback = e =>
Action<ChangeEventArgs> callback = e =>
{
T value = default;
var converted = false;
@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components
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
{
/// <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>
public static class EventCallbackFactoryUIEventArgsExtensions
public static class EventCallbackFactoryEventArgsExtensions
{
/// <summary>
/// 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="callback">The event callback.</param>
/// <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)
{
throw new ArgumentNullException(nameof(factory));
}
return factory.Create<UIEventArgs>(receiver, callback);
return factory.Create<EventArgs>(receiver, callback);
}
/// <summary>
@ -37,14 +37,14 @@ namespace Microsoft.AspNetCore.Components
/// <param name="receiver">The event receiver.</param>
/// <param name="callback">The event callback.</param>
/// <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)
{
throw new ArgumentNullException(nameof(factory));
}
return factory.Create<UIEventArgs>(receiver, callback);
return factory.Create<EventArgs>(receiver, callback);
}
/// <summary>
@ -55,14 +55,14 @@ namespace Microsoft.AspNetCore.Components
/// <param name="receiver">The event receiver.</param>
/// <param name="callback">The event callback.</param>
/// <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)
{
throw new ArgumentNullException(nameof(factory));
}
return factory.Create<UIChangeEventArgs>(receiver, callback);
return factory.Create<ChangeEventArgs>(receiver, callback);
}
/// <summary>
@ -73,14 +73,14 @@ namespace Microsoft.AspNetCore.Components
/// <param name="receiver">The event receiver.</param>
/// <param name="callback">The event callback.</param>
/// <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)
{
throw new ArgumentNullException(nameof(factory));
}
return factory.Create<UIChangeEventArgs>(receiver, callback);
return factory.Create<ChangeEventArgs>(receiver, callback);
}
}
}

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace Microsoft.AspNetCore.Components.Forms
{
@ -158,6 +159,16 @@ namespace Microsoft.AspNetCore.Components.Forms
}
}
/// <summary>
/// Gets the current validation messages for the specified field.
///
/// This method does not perform validation itself. It only returns messages determined by previous validation actions.
/// </summary>
/// <param name="accessor">Identifies the field whose current validation messages should be returned.</param>
/// <returns>The current validation messages for the specified field.</returns>
public IEnumerable<string> GetValidationMessages(Expression<Func<object>> accessor)
=> GetValidationMessages(FieldIdentifier.Create(accessor));
/// <summary>
/// Determines whether the specified fields in this <see cref="EditContext"/> has been modified.
/// </summary>
@ -167,6 +178,14 @@ namespace Microsoft.AspNetCore.Components.Forms
? state.IsModified
: false;
/// <summary>
/// Determines whether the specified fields in this <see cref="EditContext"/> has been modified.
/// </summary>
/// <param name="accessor">Identifies the field whose current validation messages should be returned.</param>
/// <returns>True if the field has been modified; otherwise false.</returns>
public bool IsModified(Expression<Func<object>> accessor)
=> IsModified(FieldIdentifier.Create(accessor));
/// <summary>
/// Validates this <see cref="EditContext"/>.
/// </summary>

View File

@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Components.Forms
Validator.TryValidateProperty(propertyValue, validationContext, results);
messages.Clear(fieldIdentifier);
messages.AddRange(fieldIdentifier, results.Select(result => result.ErrorMessage));
messages.Add(fieldIdentifier, results.Select(result => result.ErrorMessage));
// We have to notify even if there were no messages before and are still no messages now,
// because the "state" that changed might be the completion of some async validation task

View File

@ -1,35 +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.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Microsoft.AspNetCore.Components.Forms
{
/// <summary>
/// Provides extension methods to simplify using <see cref="EditContext"/> with expressions.
/// </summary>
public static class EditContextExpressionExtensions
{
/// <summary>
/// Gets the current validation messages for the specified field.
///
/// This method does not perform validation itself. It only returns messages determined by previous validation actions.
/// </summary>
/// <param name="editContext">The <see cref="EditContext"/>.</param>
/// <param name="accessor">Identifies the field whose current validation messages should be returned.</param>
/// <returns>The current validation messages for the specified field.</returns>
public static IEnumerable<string> GetValidationMessages(this EditContext editContext, Expression<Func<object>> accessor)
=> editContext.GetValidationMessages(FieldIdentifier.Create(accessor));
/// <summary>
/// Determines whether the specified fields in this <see cref="EditContext"/> has been modified.
/// </summary>
/// <param name="editContext">The <see cref="EditContext"/>.</param>
/// <param name="accessor">Identifies the field whose current validation messages should be returned.</param>
/// <returns>True if the field has been modified; otherwise false.</returns>
public static bool IsModified(this EditContext editContext, Expression<Func<object>> accessor)
=> editContext.IsModified(FieldIdentifier.Create(accessor));
}
}

View File

@ -1,21 +1,27 @@
// 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.
using System;
namespace Microsoft.AspNetCore.Components.Forms
{
/// <summary>
/// Provides information about the <see cref="EditContext.OnFieldChanged"/> event.
/// </summary>
public sealed class FieldChangedEventArgs
public sealed class FieldChangedEventArgs : EventArgs
{
/// <summary>
/// Creates a new instance of <see cref="FieldChangedEventArgs"/>.
/// </summary>
/// <param name="fieldIdentifier">The <see cref="Forms.FieldIdentifier"/></param>
public FieldChangedEventArgs(in FieldIdentifier fieldIdentifier)
{
FieldIdentifier = fieldIdentifier;
}
/// <summary>
/// Identifies the field whose value has changed.
/// </summary>
public FieldIdentifier FieldIdentifier { get; }
internal FieldChangedEventArgs(in FieldIdentifier fieldIdentifier)
{
FieldIdentifier = fieldIdentifier;
}
}
}

View File

@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Components.Forms
/// Uniquely identifies a single field that can be edited. This may correspond to a property on a
/// model object, or can be any other named value.
/// </summary>
public readonly struct FieldIdentifier
public readonly struct FieldIdentifier : IEquatable<FieldIdentifier>
{
/// <summary>
/// Initializes a new instance of the <see cref="FieldIdentifier"/> structure.
@ -68,8 +68,15 @@ namespace Microsoft.AspNetCore.Components.Forms
/// <inheritdoc />
public override bool Equals(object obj)
=> obj is FieldIdentifier otherIdentifier
&& otherIdentifier.Model == Model
&& string.Equals(otherIdentifier.FieldName, FieldName, StringComparison.Ordinal);
&& Equals(otherIdentifier);
/// <inheritdoc />
public bool Equals(FieldIdentifier otherIdentifier)
{
return
otherIdentifier.Model == Model &&
string.Equals(otherIdentifier.FieldName, FieldName, StringComparison.Ordinal);
}
private static void ParseAccessor<T>(Expression<Func<T>> accessor, out object model, out string fieldName)
{

View File

@ -33,14 +33,30 @@ namespace Microsoft.AspNetCore.Components.Forms
public void Add(in FieldIdentifier fieldIdentifier, string message)
=> GetOrCreateMessagesListForField(fieldIdentifier).Add(message);
/// <summary>
/// Adds a validation message for the specified field.
/// </summary>
/// <param name="accessor">Identifies the field for which to add the message.</param>
/// <param name="message">The validation message.</param>
public void Add(Expression<Func<object>> accessor, string message)
=> Add(FieldIdentifier.Create(accessor), message);
/// <summary>
/// Adds the messages from the specified collection for the specified field.
/// </summary>
/// <param name="fieldIdentifier">The identifier for the field.</param>
/// <param name="messages">The validation messages to be added.</param>
public void AddRange(in FieldIdentifier fieldIdentifier, IEnumerable<string> messages)
public void Add(in FieldIdentifier fieldIdentifier, IEnumerable<string> messages)
=> GetOrCreateMessagesListForField(fieldIdentifier).AddRange(messages);
/// <summary>
/// Adds the messages from the specified collection for the specified field.
/// </summary>
/// <param name="accessor">Identifies the field for which to add the messages.</param>
/// <param name="messages">The validation messages to be added.</param>
public void Add(Expression<Func<object>> accessor, IEnumerable<string> messages)
=> Add(FieldIdentifier.Create(accessor), messages);
/// <summary>
/// Gets the validation messages within this <see cref="ValidationMessageStore"/> for the specified field.
///
@ -74,6 +90,13 @@ namespace Microsoft.AspNetCore.Components.Forms
_messages.Clear();
}
/// <summary>
/// Removes all messages within this <see cref="ValidationMessageStore"/> for the specified field.
/// </summary>
/// <param name="accessor">Identifies the field for which to remove the messages.</param>
public void Clear(Expression<Func<object>> accessor)
=> Clear(FieldIdentifier.Create(accessor));
/// <summary>
/// Removes all messages within this <see cref="ValidationMessageStore"/> for the specified field.
/// </summary>

View File

@ -1,41 +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.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Microsoft.AspNetCore.Components.Forms
{
/// <summary>
/// Provides extension methods to simplify using <see cref="ValidationMessageStore"/> with expressions.
/// </summary>
public static class ValidationMessageStoreExpressionExtensions
{
/// <summary>
/// Adds a validation message for the specified field.
/// </summary>
/// <param name="store">The <see cref="ValidationMessageStore"/>.</param>
/// <param name="accessor">Identifies the field for which to add the message.</param>
/// <param name="message">The validation message.</param>
public static void Add(this ValidationMessageStore store, Expression<Func<object>> accessor, string message)
=> store.Add(FieldIdentifier.Create(accessor), message);
/// <summary>
/// Adds the messages from the specified collection for the specified field.
/// </summary>
/// <param name="store">The <see cref="ValidationMessageStore"/>.</param>
/// <param name="accessor">Identifies the field for which to add the messages.</param>
/// <param name="messages">The validation messages to be added.</param>
public static void AddRange(this ValidationMessageStore store, Expression<Func<object>> accessor, IEnumerable<string> messages)
=> store.AddRange(FieldIdentifier.Create(accessor), messages);
/// <summary>
/// Removes all messages within this <see cref="ValidationMessageStore"/> for the specified field.
/// </summary>
/// <param name="store">The <see cref="ValidationMessageStore"/>.</param>
/// <param name="accessor">Identifies the field for which to remove the messages.</param>
public static void Clear(this ValidationMessageStore store, Expression<Func<object>> accessor)
=> store.Clear(FieldIdentifier.Create(accessor));
}
}

View File

@ -1,16 +1,24 @@
// 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.
using System;
namespace Microsoft.AspNetCore.Components.Forms
{
/// <summary>
/// Provides information about the <see cref="EditContext.OnValidationRequested"/> event.
/// </summary>
public sealed class ValidationRequestedEventArgs
public sealed class ValidationRequestedEventArgs : EventArgs
{
internal static readonly ValidationRequestedEventArgs Empty = new ValidationRequestedEventArgs();
/// <summary>
/// Gets a shared empty instance of <see cref="ValidationRequestedEventArgs"/>.
/// </summary>
public static new readonly ValidationRequestedEventArgs Empty = new ValidationRequestedEventArgs();
internal ValidationRequestedEventArgs()
/// <summary>
/// Creates a new instance of <see cref="ValidationRequestedEventArgs"/>.
/// </summary>
public ValidationRequestedEventArgs()
{
}
}

View File

@ -1,16 +1,24 @@
// 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.
using System;
namespace Microsoft.AspNetCore.Components.Forms
{
/// <summary>
/// Provides information about the <see cref="EditContext.OnValidationStateChanged"/> event.
/// </summary>
public sealed class ValidationStateChangedEventArgs
public sealed class ValidationStateChangedEventArgs : EventArgs
{
internal static readonly ValidationStateChangedEventArgs Empty = new ValidationStateChangedEventArgs();
/// <summary>
/// Gets a shared empty instance of <see cref="ValidationStateChangedEventArgs"/>.
/// </summary>
public new static readonly ValidationStateChangedEventArgs Empty = new ValidationStateChangedEventArgs();
internal ValidationStateChangedEventArgs()
/// <summary>
/// Creates a new instance of <see cref="ValidationStateChangedEventArgs" />
/// </summary>
public ValidationStateChangedEventArgs()
{
}
}

View File

@ -36,13 +36,13 @@ namespace Microsoft.AspNetCore.Components
/// The content that will be displayed if the user is not authorized.
/// </summary>
[Parameter]
public RenderFragment<AuthenticationState> NotAuthorizedContent { get; set; }
public RenderFragment<AuthenticationState> NotAuthorized { get; set; }
/// <summary>
/// The content that will be displayed while asynchronous authorization is in progress.
/// </summary>
[Parameter]
public RenderFragment AuthorizingContent { get; set; }
public RenderFragment Authorizing { get; set; }
/// <inheritdoc />
public void Attach(RenderHandle renderHandle)
@ -109,14 +109,14 @@ namespace Microsoft.AspNetCore.Components
}
// Some authorization data exists, so we do need to wrap the fragment
RenderFragment<AuthenticationState> authorizedContent = context => pageFragment;
RenderFragment<AuthenticationState> authorized = context => pageFragment;
return builder =>
{
builder.OpenComponent<AuthorizeViewWithSuppliedData>(0);
builder.AddAttribute(1, nameof(AuthorizeViewWithSuppliedData.AuthorizeDataParam), authorizeData);
builder.AddAttribute(2, nameof(AuthorizeViewWithSuppliedData.Authorized), authorizedContent);
builder.AddAttribute(3, nameof(AuthorizeViewWithSuppliedData.NotAuthorized), NotAuthorizedContent ?? DefaultNotAuthorizedContent);
builder.AddAttribute(4, nameof(AuthorizeViewWithSuppliedData.Authorizing), AuthorizingContent);
builder.AddAttribute(2, nameof(AuthorizeViewWithSuppliedData.Authorized), authorized);
builder.AddAttribute(3, nameof(AuthorizeViewWithSuppliedData.NotAuthorized), NotAuthorized ?? DefaultNotAuthorized);
builder.AddAttribute(4, nameof(AuthorizeViewWithSuppliedData.Authorizing), Authorizing);
builder.CloseComponent();
};
}
@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Components
// There has to be some default content. If we render blank by default, developers
// will find it hard to guess why their UI isn't appearing.
private static RenderFragment DefaultNotAuthorizedContent(AuthenticationState authenticationState)
private static RenderFragment DefaultNotAuthorized(AuthenticationState authenticationState)
=> builder => builder.AddContent(0, "Not authorized");
}
}

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
/// has completed.
/// </returns>
public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, UIEventArgs eventArgs)
public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
{
EnsureSynchronizationContext();

View File

@ -41,17 +41,17 @@ namespace Microsoft.AspNetCore.Components.Routing
/// <summary>
/// Gets or sets the type of the component that should be used as a fallback when no match is found for the requested route.
/// </summary>
[Parameter] public RenderFragment NotFoundContent { get; set; }
[Parameter] public RenderFragment NotFound { get; set; }
/// <summary>
/// The content that will be displayed if the user is not authorized.
/// </summary>
[Parameter] public RenderFragment<AuthenticationState> NotAuthorizedContent { get; set; }
[Parameter] public RenderFragment<AuthenticationState> NotAuthorized { get; set; }
/// <summary>
/// The content that will be displayed while asynchronous authorization is in progress.
/// </summary>
[Parameter] public RenderFragment AuthorizingContent { get; set; }
[Parameter] public RenderFragment Authorizing { get; set; }
private RouteTable Routes { get; set; }
@ -94,8 +94,8 @@ namespace Microsoft.AspNetCore.Components.Routing
builder.OpenComponent(0, typeof(PageDisplay));
builder.AddAttribute(1, nameof(PageDisplay.Page), handler);
builder.AddAttribute(2, nameof(PageDisplay.PageParameters), parameters);
builder.AddAttribute(3, nameof(PageDisplay.NotAuthorizedContent), NotAuthorizedContent);
builder.AddAttribute(4, nameof(PageDisplay.AuthorizingContent), AuthorizingContent);
builder.AddAttribute(3, nameof(PageDisplay.NotAuthorized), NotAuthorized);
builder.AddAttribute(4, nameof(PageDisplay.Authorizing), Authorizing);
builder.CloseComponent();
}
@ -120,14 +120,14 @@ namespace Microsoft.AspNetCore.Components.Routing
}
else
{
if (!isNavigationIntercepted && NotFoundContent != null)
if (!isNavigationIntercepted && NotFound != null)
{
Log.DisplayingNotFoundContent(_logger, locationPath, _baseUri);
Log.DisplayingNotFound(_logger, locationPath, _baseUri);
// We did not find a Component that matches the route.
// Only show the NotFoundContent if the application developer programatically got us here i.e we did not
// Only show the NotFound if the application developer programatically got us here i.e we did not
// intercept the navigation. In all other cases, force a browser navigation since this could be non-Blazor content.
_renderHandle.Render(NotFoundContent);
_renderHandle.Render(NotFound);
}
else
{
@ -159,8 +159,8 @@ namespace Microsoft.AspNetCore.Components.Routing
private static class Log
{
private static readonly Action<ILogger, string, string, Exception> _displayingNotFoundContent =
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(1, "DisplayingNotFoundContent"), $"Displaying {nameof(NotFoundContent)} because path '{{Path}}' with base URI '{{BaseUri}}' does not match any component route");
private static readonly Action<ILogger, string, string, Exception> _displayingNotFound =
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(1, "DisplayingNotFound"), $"Displaying {nameof(NotFound)} because path '{{Path}}' with base URI '{{BaseUri}}' does not match any component route");
private static readonly Action<ILogger, Type, string, string, Exception> _navigatingToComponent =
LoggerMessage.Define<Type, string, string>(LogLevel.Debug, new EventId(2, "NavigatingToComponent"), "Navigating to component {ComponentType} in response to path '{Path}' with base URI '{BaseUri}'");
@ -168,9 +168,9 @@ namespace Microsoft.AspNetCore.Components.Routing
private static readonly Action<ILogger, string, string, string, Exception> _navigatingToExternalUri =
LoggerMessage.Define<string, string, string>(LogLevel.Debug, new EventId(3, "NavigatingToExternalUri"), "Navigating to non-component URI '{ExternalUri}' in response to path '{Path}' with base URI '{BaseUri}'");
internal static void DisplayingNotFoundContent(ILogger logger, string path, string baseUri)
internal static void DisplayingNotFound(ILogger logger, string path, string baseUri)
{
_displayingNotFoundContent(logger, path, baseUri, null);
_displayingNotFound(logger, path, baseUri, null);
}
internal static void NavigatingToComponent(ILogger logger, Type componentType, string path, string baseUri)

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

@ -53,13 +53,13 @@ namespace Microsoft.AspNetCore.Components
}
[Fact]
public void RendersNotAuthorizedContentIfNotAuthorized()
public void RendersNotAuthorizedIfNotAuthorized()
{
// Arrange
var authorizationService = new TestAuthorizationService();
var renderer = CreateTestRenderer(authorizationService);
var rootComponent = WrapInAuthorizeView(
notAuthorizedContent:
notAuthorized:
context => builder => builder.AddContent(0, $"You are not authorized, even though we know you are {context.User.Identity.Name}"));
rootComponent.AuthenticationState = CreateAuthenticationState("Nellie");
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components
}
[Fact]
public void RendersNothingIfAuthorizedButNoChildContentOrAuthorizedContentProvided()
public void RendersNothingIfAuthorizedButNoChildContentOrAuthorizedProvided()
{
// Arrange
var authorizationService = new TestAuthorizationService();
@ -152,14 +152,14 @@ namespace Microsoft.AspNetCore.Components
}
[Fact]
public void RendersAuthorizedContentIfAuthorized()
public void RendersAuthorizedIfAuthorized()
{
// Arrange
var authorizationService = new TestAuthorizationService();
authorizationService.NextResult = AuthorizationResult.Success();
var renderer = CreateTestRenderer(authorizationService);
var rootComponent = WrapInAuthorizeView(
authorizedContent: context => builder =>
authorized: context => builder =>
builder.AddContent(0, $"You are authenticated as {context.User.Identity.Name}"));
rootComponent.AuthenticationState = CreateAuthenticationState("Nellie");
@ -235,13 +235,13 @@ namespace Microsoft.AspNetCore.Components
}
[Fact]
public void ThrowsIfBothChildContentAndAuthorizedContentProvided()
public void ThrowsIfBothChildContentAndAuthorizedProvided()
{
// Arrange
var authorizationService = new TestAuthorizationService();
var renderer = CreateTestRenderer(authorizationService);
var rootComponent = WrapInAuthorizeView(
authorizedContent: context => builder => { },
authorized: context => builder => { },
childContent: context => builder => { });
// Act/Assert
@ -260,7 +260,7 @@ namespace Microsoft.AspNetCore.Components
var renderer = CreateTestRenderer(authorizationService);
renderer.OnUpdateDisplayComplete = () => { @event.Set(); };
var rootComponent = WrapInAuthorizeView(
notAuthorizedContent:
notAuthorized:
context => builder => builder.AddContent(0, "You are not authorized"));
var authTcs = new TaskCompletionSource<AuthenticationState>();
rootComponent.AuthenticationState = authTcs.Task;
@ -293,7 +293,7 @@ namespace Microsoft.AspNetCore.Components
}
[Fact]
public void RendersAuthorizingContentUntilAuthorizationCompleted()
public void RendersAuthorizingUntilAuthorizationCompleted()
{
// Arrange
var @event = new ManualResetEventSlim();
@ -302,8 +302,8 @@ namespace Microsoft.AspNetCore.Components
var renderer = CreateTestRenderer(authorizationService);
renderer.OnUpdateDisplayComplete = () => { @event.Set(); };
var rootComponent = WrapInAuthorizeView(
authorizingContent: builder => builder.AddContent(0, "Auth pending..."),
authorizedContent: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!"));
authorizing: builder => builder.AddContent(0, "Auth pending..."),
authorized: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!"));
var authTcs = new TaskCompletionSource<AuthenticationState>();
rootComponent.AuthenticationState = authTcs.Task;
@ -447,9 +447,9 @@ namespace Microsoft.AspNetCore.Components
private static TestAuthStateProviderComponent WrapInAuthorizeView(
RenderFragment<AuthenticationState> childContent = null,
RenderFragment<AuthenticationState> authorizedContent = null,
RenderFragment<AuthenticationState> notAuthorizedContent = null,
RenderFragment authorizingContent = null,
RenderFragment<AuthenticationState> authorized = null,
RenderFragment<AuthenticationState> notAuthorized = null,
RenderFragment authorizing = null,
string policy = null,
string roles = null,
object resource = null)
@ -458,9 +458,9 @@ namespace Microsoft.AspNetCore.Components
{
builder.OpenComponent<AuthorizeView>(0);
builder.AddAttribute(1, nameof(AuthorizeView.ChildContent), childContent);
builder.AddAttribute(2, nameof(AuthorizeView.Authorized), authorizedContent);
builder.AddAttribute(3, nameof(AuthorizeView.NotAuthorized), notAuthorizedContent);
builder.AddAttribute(4, nameof(AuthorizeView.Authorizing), authorizingContent);
builder.AddAttribute(2, nameof(AuthorizeView.Authorized), authorized);
builder.AddAttribute(3, nameof(AuthorizeView.NotAuthorized), notAuthorized);
builder.AddAttribute(4, nameof(AuthorizeView.Authorizing), authorizing);
builder.AddAttribute(5, nameof(AuthorizeView.Policy), policy);
builder.AddAttribute(6, nameof(AuthorizeView.Roles), roles);
builder.AddAttribute(7, nameof(AuthorizeView.Resource), resource);

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// 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(1, component.Count);
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// 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(1, component.Count);
@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Components
// Act
await Assert.ThrowsAsync<InvalidTimeZoneException>(() =>
{
return binder.InvokeAsync(new UIChangeEventArgs() { Value = "18", });
return binder.InvokeAsync(new ChangeEventArgs() { Value = "18", });
});
Assert.Equal(1, component.Count);
@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// 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(1, component.Count);
@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Components
var binder = EventCallback.Factory.CreateBinder(component, setter, value);
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "", });
Assert.Null(value); // Setter called
Assert.Equal(1, component.Count);
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = "bye";
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue, });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue, });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = true;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, });
await binder.InvokeAsync(new ChangeEventArgs() { Value = true, });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -149,7 +149,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (bool?)true;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, });
await binder.InvokeAsync(new ChangeEventArgs() { Value = true, });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = 42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (int?)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (long)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -225,7 +225,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (long?)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -244,7 +244,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (float)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -263,7 +263,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (float?)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -282,7 +282,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (double)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -301,7 +301,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (double?)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -320,7 +320,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (decimal)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -339,7 +339,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = (decimal?)42;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", });
await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = AttributeTargets.Class;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -377,7 +377,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = AttributeTargets.Class;
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -396,7 +396,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -415,7 +415,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -435,7 +435,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4);
// 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(1, component.Count);
@ -455,7 +455,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4);
// 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(1, component.Count);
@ -474,7 +474,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -493,7 +493,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -513,7 +513,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4);
// 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(1, component.Count);
@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = new DateTime(2018, 3, 4);
// 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(1, component.Count);
@ -553,7 +553,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = Guid.NewGuid();
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
Assert.Equal(1, component.Count);
@ -573,7 +573,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = Guid.NewGuid();
// Act
await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), });
await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), });
Assert.Equal(expectedValue, value);
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!", };
// 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(1, component.Count);
@ -627,7 +627,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = 42_000;
// 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(1, component.Count);
@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components
var expectedValue = 42_000;
// 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(1, component.Count);

View File

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

View File

@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Components.Forms
}
[Fact]
public void CanAddMessagesByRange()
public void CanAddMessagesMultiple()
{
// Arrange
var messages = new ValidationMessageStore(new EditContext(new object()));
@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Components.Forms
var entries = new[] { "A", "B", "C" };
// Act
messages.AddRange(field1, entries);
messages.Add(field1, entries);
// Assert
Assert.Equal(entries, messages[field1]);

View File

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

View File

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

View File

@ -430,7 +430,7 @@ namespace Microsoft.AspNetCore.Components.Test
{
// Arrange: Render a component with an event handler
var renderer = new TestRenderer();
UIEventArgs receivedArgs = null;
EventArgs receivedArgs = null;
var component = new EventComponent
{
@ -448,7 +448,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs);
// Act/Assert: Event can be fired
var eventArgs = new UIEventArgs();
var eventArgs = new EventArgs();
var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
// This should always be run synchronously
@ -460,7 +460,7 @@ namespace Microsoft.AspNetCore.Components.Test
{
// Arrange: Render a component with an event handler
var renderer = new TestRenderer();
UIEventArgs receivedArgs = null;
EventArgs receivedArgs = null;
var component = new EventComponent
{
@ -478,7 +478,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs);
// Act/Assert: Event can be fired
var eventArgs = new UIEventArgs();
var eventArgs = new EventArgs();
var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully);
Assert.Same(eventArgs, receivedArgs);
@ -508,7 +508,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Empty(renderer.HandledExceptions);
// Act/Assert: Event can be fired
var eventArgs = new UIEventArgs();
var eventArgs = new EventArgs();
var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully);
@ -577,7 +577,7 @@ namespace Microsoft.AspNetCore.Components.Test
[Fact]
public void CanDispatchEventsToNestedComponents()
{
UIEventArgs receivedArgs = null;
EventArgs receivedArgs = null;
// Arrange: Render parent component
var renderer = new TestRenderer();
@ -608,7 +608,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs);
// Act/Assert: Event can be fired
var eventArgs = new UIEventArgs();
var eventArgs = new EventArgs();
var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully);
Assert.Same(eventArgs, receivedArgs);
@ -619,7 +619,7 @@ namespace Microsoft.AspNetCore.Components.Test
{
// Arrange: Render a component with an event handler
var renderer = new TestRenderer();
UIEventArgs receivedArgs = null;
EventArgs receivedArgs = null;
var state = 0;
var tcs = new TaskCompletionSource<object>();
@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs);
// Act/Assert: Event can be fired
var eventArgs = new UIEventArgs();
var eventArgs = new EventArgs();
var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.Equal(1, state);
Assert.Same(eventArgs, receivedArgs);
@ -746,7 +746,7 @@ namespace Microsoft.AspNetCore.Components.Test
[Fact]
public async Task CanAsyncDispatchEventsToNestedComponents()
{
UIEventArgs receivedArgs = null;
EventArgs receivedArgs = null;
var state = 0;
var tcs = new TaskCompletionSource<object>();
@ -786,7 +786,7 @@ namespace Microsoft.AspNetCore.Components.Test
Assert.Null(receivedArgs);
// Act/Assert: Event can be fired
var eventArgs = new UIEventArgs();
var eventArgs = new EventArgs();
var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
Assert.Equal(1, state);
Assert.Same(eventArgs, receivedArgs);
@ -1774,7 +1774,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Act/Assert
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
var renderer = new TestRenderer();
var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; };
Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new EventComponent { OnTest = origEventHandler };
var componentId = renderer.AssignRootComponentId(component);
component.TriggerRender();
@ -2094,7 +2094,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange
var renderer = new TestRenderer();
var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; };
Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new EventComponent { OnTest = origEventHandler };
var componentId = renderer.AssignRootComponentId(component);
component.TriggerRender();
@ -2129,7 +2129,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange
var renderer = new TestRenderer();
var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; };
Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new ConditionalParentComponent<EventComponent>
{
IncludeChild = true,
@ -2180,7 +2180,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Arrange
var renderer = new TestRenderer();
var eventCount = 0;
Action<UIEventArgs> origEventHandler = args => { eventCount++; };
Action<EventArgs> origEventHandler = args => { eventCount++; };
var component = new EventComponent { OnTest = origEventHandler };
var componentId = renderer.AssignRootComponentId(component);
component.TriggerRender();
@ -2222,7 +2222,7 @@ namespace Microsoft.AspNetCore.Components.Test
{
builder.AddContent(0, "Child event count: " + eventCount);
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++;
rootComponent.TriggerRender();
@ -2468,7 +2468,7 @@ namespace Microsoft.AspNetCore.Components.Test
.AttributeEventHandlerId;
// Act: Toggle the checkbox
var eventArgs = new UIChangeEventArgs { Value = true };
var eventArgs = new ChangeEventArgs { Value = true };
var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs);
Assert.True(renderTask.IsCompletedSuccessfully);
@ -2713,7 +2713,7 @@ namespace Microsoft.AspNetCore.Components.Test
};
var numEventsFired = 0;
EventComponent component = null;
Action<UIEventArgs> eventHandler = null;
Action<EventArgs> eventHandler = null;
eventHandler = _ =>
{
@ -2737,14 +2737,14 @@ namespace Microsoft.AspNetCore.Components.Test
// Act/Assert 1: Event can be fired for the first time
var render1TCS = new TaskCompletionSource<object>();
renderer.NextUpdateDisplayReturnTask = render1TCS.Task;
await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs());
await renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
Assert.Equal(1, numEventsFired);
// Act/Assert 2: *Same* event handler ID can be reused prior to completion of
// preceding UI update
var render2TCS = new TaskCompletionSource<object>();
renderer.NextUpdateDisplayReturnTask = render2TCS.Task;
await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs());
await renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
Assert.Equal(2, numEventsFired);
// 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;
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(2, numEventsFired);
@ -3318,7 +3318,7 @@ namespace Microsoft.AspNetCore.Components.Test
FieldValue = "new property value",
ComponentId = componentId
};
var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new UIChangeEventArgs
var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new ChangeEventArgs
{
Value = "new property value"
});
@ -3336,7 +3336,7 @@ namespace Microsoft.AspNetCore.Components.Test
// show that the diff does *not* update the BoundString value attribute.
Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
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(eventHandlerId, attributeFrame.AttributeEventHandlerId);
});
@ -3370,7 +3370,7 @@ namespace Microsoft.AspNetCore.Components.Test
ComponentId = componentId,
FieldValue = newPropertyValue,
};
var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new UIChangeEventArgs
var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new ChangeEventArgs
{
Value = newPropertyValue
});
@ -3388,7 +3388,7 @@ namespace Microsoft.AspNetCore.Components.Test
// show that the diff does *not* update the BoundString value attribute.
Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
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(eventHandlerId, attributeFrame.AttributeEventHandlerId);
});
@ -3507,10 +3507,10 @@ namespace Microsoft.AspNetCore.Components.Test
private class EventComponent : AutoRenderComponent, IComponent, IHandleEvent
{
[Parameter]
public Action<UIEventArgs> OnTest { get; set; }
public Action<EventArgs> OnTest { get; set; }
[Parameter]
public Func<UIEventArgs, Task> OnTestAsync { get; set; }
public Func<EventArgs, Task> OnTestAsync { get; set; }
[Parameter]
public Action<DerivedEventArgs> OnClick { get; set; }
@ -3664,7 +3664,7 @@ namespace Microsoft.AspNetCore.Components.Test
=> _renderHandle.Render(builder =>
{
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();
});
}
@ -4095,7 +4095,7 @@ namespace Microsoft.AspNetCore.Components.Test
builder.OpenElement(0, "element with event");
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;
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(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.CloseElement();
rtb.CloseElement();
@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
.BuildServiceProvider();
var htmlRenderer = GetHtmlRenderer(serviceProvider);
Action<UIChangeEventArgs> change = (UIChangeEventArgs changeArgs) => throw new InvalidOperationException();
Action<ChangeEventArgs> change = (ChangeEventArgs changeArgs) => throw new InvalidOperationException();
// Act
var result = GetResult(htmlRenderer.Dispatcher.InvokeAsync(() => htmlRenderer.RenderComponentAsync<ComponentWithParameters>(

View File

@ -7,11 +7,11 @@
<Compile Include="Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs" />
<Reference Include="Microsoft.AspNetCore.Components.Web" />
<Reference Include="Microsoft.AspNetCore.DataProtection" />
<Reference Include="Microsoft.Extensions.Logging" />
<Reference Include="Microsoft.AspNetCore.SignalR" />
<Reference Include="Microsoft.AspNetCore.StaticFiles" />
<Reference Include="Microsoft.Extensions.Caching.Memory" />
<Reference Include="Microsoft.Extensions.FileProviders.Composite" />
<Reference Include="Microsoft.Extensions.FileProviders.Embedded" />
<Reference Include="Microsoft.Extensions.Logging" />
</ItemGroup>
</Project>

View File

@ -81,6 +81,15 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
}
}
public void PermanentDisconnect(CircuitHost circuitHost)
{
if (ConnectedCircuits.TryRemove(circuitHost.CircuitId, out _))
{
Log.CircuitDisconnectedPermanently(_logger, circuitHost.CircuitId);
circuitHost.Client.SetDisconnected();
}
}
public virtual Task DisconnectAsync(CircuitHost circuitHost, string connectionId)
{
Log.CircuitDisconnectStarted(_logger, circuitHost.CircuitId, connectionId);
@ -314,6 +323,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
private static readonly Action<ILogger, string, Exception> _circuitNotActive;
private static readonly Action<ILogger, string, string, Exception> _circuitConnectedToDifferentConnection;
private static readonly Action<ILogger, string, Exception> _circuitMarkedDisconnected;
private static readonly Action<ILogger, string, Exception> _circuitDisconnectedPermanently;
private static readonly Action<ILogger, string, EvictionReason, Exception> _circuitEvicted;
private static class EventIds
@ -330,6 +340,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
public static readonly EventId CircuitConnectedToDifferentConnection = new EventId(109, "CircuitConnectedToDifferentConnection");
public static readonly EventId CircuitMarkedDisconnected = new EventId(110, "CircuitMarkedDisconnected");
public static readonly EventId CircuitEvicted = new EventId(111, "CircuitEvicted");
public static readonly EventId CircuitDisconnectedPermanently = new EventId(112, "CircuitDisconnectedPermanently");
}
static Log()
@ -394,6 +405,11 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
EventIds.CircuitMarkedDisconnected,
"Circuit with id {CircuitId} is disconnected.");
_circuitDisconnectedPermanently = LoggerMessage.Define<string>(
LogLevel.Debug,
EventIds.CircuitDisconnectedPermanently,
"Circuit with id {CircuitId} has been removed from the registry for permanent disconnection.");
_circuitEvicted = LoggerMessage.Define<string, EvictionReason>(
LogLevel.Debug,
EventIds.CircuitEvicted,
@ -436,6 +452,9 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
public static void CircuitMarkedDisconnected(ILogger logger, string circuitId) =>
_circuitMarkedDisconnected(logger, circuitId, null);
public static void CircuitDisconnectedPermanently(ILogger logger, string circuitId) =>
_circuitDisconnectedPermanently(logger, circuitId, null);
public static void CircuitEvicted(ILogger logger, string circuitId, EvictionReason evictionReason) =>
_circuitEvicted(logger, circuitId, evictionReason, null);
}

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Linq;
using System.Text.Encodings.Web;
using System.Threading;
@ -10,6 +11,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.Server.Circuits;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.JSInterop;
@ -138,7 +140,8 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
pendingRender = new UnacknowledgedRenderBatch(
renderId,
arrayBuilder,
new TaskCompletionSource<object>());
new TaskCompletionSource<object>(),
ValueStopwatch.StartNew());
// Buffer the rendered batches no matter what. We'll send it down immediately when the client
// is connected or right after the client reconnects.
@ -256,13 +259,14 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
private void ProcessPendingBatch(string errorMessageOrNull, UnacknowledgedRenderBatch entry)
{
var elapsedTime = entry.ValueStopwatch.GetElapsedTime();
if (errorMessageOrNull == null)
{
Log.CompletingBatchWithoutError(_logger, entry.BatchId);
Log.CompletingBatchWithoutError(_logger, entry.BatchId, elapsedTime);
}
else
{
Log.CompletingBatchWithError(_logger, entry.BatchId, errorMessageOrNull);
Log.CompletingBatchWithError(_logger, entry.BatchId, errorMessageOrNull, elapsedTime);
}
entry.Data.Dispose();
@ -283,16 +287,18 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
internal readonly struct UnacknowledgedRenderBatch
{
public UnacknowledgedRenderBatch(long batchId, ArrayBuilder<byte> data, TaskCompletionSource<object> completionSource)
public UnacknowledgedRenderBatch(long batchId, ArrayBuilder<byte> data, TaskCompletionSource<object> completionSource, ValueStopwatch valueStopwatch)
{
BatchId = batchId;
Data = data;
CompletionSource = completionSource;
ValueStopwatch = valueStopwatch;
}
public long BatchId { get; }
public ArrayBuilder<byte> Data { get; }
public TaskCompletionSource<object> CompletionSource { get; }
public ValueStopwatch ValueStopwatch { get; }
}
private void CaptureAsyncExceptions(Task task)
@ -312,8 +318,8 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
private static readonly Action<ILogger, long, int, string, Exception> _beginUpdateDisplayAsync;
private static readonly Action<ILogger, string, Exception> _bufferingRenderDisconnectedClient;
private static readonly Action<ILogger, string, Exception> _sendBatchDataFailed;
private static readonly Action<ILogger, long, string, Exception> _completingBatchWithError;
private static readonly Action<ILogger, long, Exception> _completingBatchWithoutError;
private static readonly Action<ILogger, long, string, double, Exception> _completingBatchWithError;
private static readonly Action<ILogger, long, double, Exception> _completingBatchWithoutError;
private static readonly Action<ILogger, long, Exception> _receivedDuplicateBatchAcknowledgement;
private static class EventIds
@ -349,15 +355,15 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
EventIds.SendBatchDataFailed,
"Sending data for batch failed: {Message}");
_completingBatchWithError = LoggerMessage.Define<long, string>(
_completingBatchWithError = LoggerMessage.Define<long, string, double>(
LogLevel.Debug,
EventIds.CompletingBatchWithError,
"Completing batch {BatchId} with error: {ErrorMessage}");
"Completing batch {BatchId} with error: {ErrorMessage} in {ElapsedMilliseconds}ms.");
_completingBatchWithoutError = LoggerMessage.Define<long>(
_completingBatchWithoutError = LoggerMessage.Define<long, double>(
LogLevel.Debug,
EventIds.CompletingBatchWithoutError,
"Completing batch {BatchId} without error");
"Completing batch {BatchId} without error in {ElapsedMilliseconds}ms.");
_receivedDuplicateBatchAcknowledgement = LoggerMessage.Define<long>(
LogLevel.Debug,
@ -396,20 +402,22 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
null);
}
public static void CompletingBatchWithError(ILogger logger, long batchId, string errorMessage)
public static void CompletingBatchWithError(ILogger logger, long batchId, string errorMessage, TimeSpan elapsedTime)
{
_completingBatchWithError(
logger,
batchId,
errorMessage,
elapsedTime.TotalMilliseconds,
null);
}
public static void CompletingBatchWithoutError(ILogger logger, long batchId)
public static void CompletingBatchWithoutError(ILogger logger, long batchId, TimeSpan elapsedTime)
{
_completingBatchWithoutError(
logger,
batchId,
elapsedTime.TotalMilliseconds,
null);
}

View File

@ -66,7 +66,32 @@ namespace Microsoft.AspNetCore.Components.Server
}
CircuitHost = null;
return _circuitRegistry.DisconnectAsync(circuitHost, Context.ConnectionId);
if (exception != null)
{
return _circuitRegistry.DisconnectAsync(circuitHost, Context.ConnectionId);
}
else
{
// The client will gracefully disconnect when using websockets by correctly closing the TCP connection.
// This happens when the user closes a tab, navigates away from the page or reloads the page.
// In these situations we know the user is done with the circuit, so we can get rid of it at that point.
// This is important to be able to more efficiently manage resources, specially memory.
return TerminateCircuitGracefully(circuitHost);
}
}
private async Task TerminateCircuitGracefully(CircuitHost circuitHost)
{
try
{
Log.CircuitTerminatedGracefully(_logger, circuitHost.CircuitId);
_circuitRegistry.PermanentDisconnect(circuitHost);
await circuitHost.DisposeAsync();
}
catch (Exception e)
{
Log.UnhandledExceptionInCircuit(_logger, circuitHost.CircuitId, e);
}
}
/// <summary>
@ -248,6 +273,8 @@ namespace Microsoft.AspNetCore.Components.Server
private static readonly Action<ILogger, string, Exception> _circuitHostNotInitialized =
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(6, "CircuitHostNotInitialized"), "Call to '{CallSite}' received before the circuit host initialization.");
private static readonly Action<ILogger, string, Exception> _circuitTerminatedGracefully =
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(7, "CircuitTerminatedGracefully"), "Circuit '{CircuitId}' terminated gracefully.");
public static void NoComponentsRegisteredInEndpoint(ILogger logger, string endpointDisplayName)
{
@ -272,6 +299,8 @@ namespace Microsoft.AspNetCore.Components.Server
public static void CircuitAlreadyInitialized(ILogger logger, string circuitId) => _circuitAlreadyInitialized(logger, circuitId, null);
public static void CircuitHostNotInitialized(ILogger logger, [CallerMemberName] string callSite = "") => _circuitHostNotInitialized(logger, callSite, null);
public static void CircuitTerminatedGracefully(ILogger logger, string circuitId) => _circuitTerminatedGracefully(logger, circuitId, null);
}
}
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
@ -14,12 +14,13 @@
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Components.Web" />
<Reference Include="Microsoft.AspNetCore.DataProtection" />
<Reference Include="Microsoft.Extensions.Logging" />
<Reference Include="Microsoft.AspNetCore.SignalR" />
<Reference Include="Microsoft.AspNetCore.StaticFiles" />
<Reference Include="Microsoft.Extensions.Caching.Memory" />
<Reference Include="Microsoft.Extensions.FileProviders.Composite" />
<Reference Include="Microsoft.Extensions.FileProviders.Embedded" />
<Reference Include="Microsoft.Extensions.Logging" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup>

View File

@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers
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);
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)
=> 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));
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));
private static Task UnwrapTask(Task task)

View File

@ -6,7 +6,9 @@ namespace Microsoft.AspNetCore.Components
[Microsoft.AspNetCore.Components.BindElementAttribute("select", null, "value", "onchange")]
[Microsoft.AspNetCore.Components.BindElementAttribute("textarea", null, "value", "onchange")]
[Microsoft.AspNetCore.Components.BindInputElementAttribute("checkbox", null, "checked", "onchange", false, null)]
[Microsoft.AspNetCore.Components.BindInputElementAttribute("date", "value", "value", "onchange", true, "yyyy-MM-dd")]
[Microsoft.AspNetCore.Components.BindInputElementAttribute("date", null, "value", "onchange", true, "yyyy-MM-dd")]
[Microsoft.AspNetCore.Components.BindInputElementAttribute("number", "value", "value", "onchange", true, null)]
[Microsoft.AspNetCore.Components.BindInputElementAttribute("number", null, "value", "onchange", true, null)]
[Microsoft.AspNetCore.Components.BindInputElementAttribute("text", null, "value", "onchange", false, null)]
[Microsoft.AspNetCore.Components.BindInputElementAttribute(null, "value", "value", "onchange", false, null)]
@ -51,23 +53,23 @@ namespace Microsoft.AspNetCore.Components
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("onactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onactivate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onblur", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onclick", 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("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("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("ondragend", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragenter", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))]
@ -75,24 +77,24 @@ namespace Microsoft.AspNetCore.Components
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragover", 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("ondurationchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ondurationchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onerror", typeof(Microsoft.AspNetCore.Components.UIErrorEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocus", 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("onfullscreenchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("ongotpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeydown", 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("onload", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadend", 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))]
@ -103,50 +105,51 @@ namespace Microsoft.AspNetCore.Components
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onmouseup", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onmousewheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpaste", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointercancel", 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("onpointerleave", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointermove", 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("onpointerup", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onprogress", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(System.EventArgs))]
[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("ontouchend", 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("ontouchmove", 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("onwaiting", typeof(Microsoft.AspNetCore.Components.UIEventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onvolumechange", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onwaiting", typeof(System.EventArgs))]
[Microsoft.AspNetCore.Components.EventHandlerAttribute("onwheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))]
public static partial class EventHandlers
{
}
public partial class UIClipboardEventArgs : Microsoft.AspNetCore.Components.UIEventArgs
public partial class UIClipboardEventArgs : System.EventArgs
{
public UIClipboardEventArgs() { }
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
}
public partial class UIDataTransferItem
{
@ -159,19 +162,21 @@ namespace Microsoft.AspNetCore.Components
public UIDragEventArgs() { }
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 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 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 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 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 bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
@ -182,8 +187,9 @@ namespace Microsoft.AspNetCore.Components
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 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 bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
@ -197,6 +203,7 @@ namespace Microsoft.AspNetCore.Components
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 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
{
@ -210,14 +217,15 @@ namespace Microsoft.AspNetCore.Components
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 partial class UIProgressEventArgs : Microsoft.AspNetCore.Components.UIEventArgs
public partial class UIProgressEventArgs : System.EventArgs
{
public UIProgressEventArgs() { }
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 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 bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
@ -228,6 +236,7 @@ namespace Microsoft.AspNetCore.Components
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[] 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
{
@ -276,8 +285,8 @@ namespace Microsoft.AspNetCore.Components.Forms
{
public static partial class EditContextFieldClassExtensions
{
public static string FieldClass(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; }
public static string FieldClass<TField>(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression<System.Func<TField>> accessor) { throw null; }
public static string FieldCssClass(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) { throw null; }
public static string FieldCssClass<TField>(this Microsoft.AspNetCore.Components.Forms.EditContext editContext, System.Linq.Expressions.Expression<System.Func<TField>> accessor) { throw null; }
}
public partial class EditForm : Microsoft.AspNetCore.Components.ComponentBase
{
@ -308,7 +317,6 @@ namespace Microsoft.AspNetCore.Components.Forms
protected T CurrentValue { get { throw null; } set { } }
protected string CurrentValueAsString { get { throw null; } set { } }
protected Microsoft.AspNetCore.Components.Forms.EditContext EditContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
protected string FieldClass { get { throw null; } }
protected Microsoft.AspNetCore.Components.Forms.FieldIdentifier FieldIdentifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
@ -372,6 +380,7 @@ namespace Microsoft.AspNetCore.Components.Forms
[Microsoft.AspNetCore.Components.ParameterAttribute]
public System.Linq.Expressions.Expression<System.Func<T>> For { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { }
protected virtual void Dispose(bool disposing) { }
protected override void OnParametersSet() { }
void System.IDisposable.Dispose() { }
}
@ -381,6 +390,7 @@ namespace Microsoft.AspNetCore.Components.Forms
[Microsoft.AspNetCore.Components.ParameterAttribute(CaptureUnmatchedValues=true)]
public System.Collections.Generic.IReadOnlyDictionary<string, object> AdditionalAttributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { }
protected virtual void Dispose(bool disposing) { }
protected override void OnParametersSet() { }
void System.IDisposable.Dispose() { }
}

View File

@ -24,9 +24,11 @@ namespace Microsoft.AspNetCore.Components
// type="number" is invariant culture
[BindInputElement("number", null, "value", "onchange", isInvariantCulture: true, format: null)]
[BindInputElement("number", "value", "value", "onchange", isInvariantCulture: true, format: null)]
// type="date" is invariant culture with a specific format
[BindInputElement("date", null, "value", "onchange", isInvariantCulture: true, format: "yyyy-MM-dd")]
[BindInputElement("date", "value", "value", "onchange", isInvariantCulture: true, format: "yyyy-MM-dd")]
[BindElement("select", null, "value", "onchange")]
[BindElement("textarea", null, "value", "onchange")]

View File

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

View File

@ -14,23 +14,23 @@ namespace Microsoft.AspNetCore.Components.Forms
public static class EditContextFieldClassExtensions
{
/// <summary>
/// Gets a string that indicates the status of the specified field. This will include
/// Gets a string that indicates the status of the specified field as a CSS class. This will include
/// some combination of "modified", "valid", or "invalid", depending on the status of the field.
/// </summary>
/// <param name="editContext">The <see cref="EditContext"/>.</param>
/// <param name="accessor">An identifier for the field.</param>
/// <returns>A string that indicates the status of the field.</returns>
public static string FieldClass<TField>(this EditContext editContext, Expression<Func<TField>> accessor)
=> FieldClass(editContext, FieldIdentifier.Create(accessor));
public static string FieldCssClass<TField>(this EditContext editContext, Expression<Func<TField>> accessor)
=> FieldCssClass(editContext, FieldIdentifier.Create(accessor));
/// <summary>
/// Gets a string that indicates the status of the specified field. This will include
/// Gets a string that indicates the status of the specified field as a CSS class. This will include
/// some combination of "modified", "valid", or "invalid", depending on the status of the field.
/// </summary>
/// <param name="editContext">The <see cref="EditContext"/>.</param>
/// <param name="fieldIdentifier">An identifier for the field.</param>
/// <returns>A string that indicates the status of the field.</returns>
public static string FieldClass(this EditContext editContext, in FieldIdentifier fieldIdentifier)
public static string FieldCssClass(this EditContext editContext, in FieldIdentifier fieldIdentifier)
{
var isValid = !editContext.GetValidationMessages(fieldIdentifier).Any();
if (editContext.IsModified(fieldIdentifier))

View File

@ -143,8 +143,8 @@ namespace Microsoft.AspNetCore.Components.Forms
/// Gets a string that indicates the status of the field being edited. This will include
/// some combination of "modified", "valid", or "invalid", depending on the status of the field.
/// </summary>
protected string FieldClass
=> EditContext.FieldClass(FieldIdentifier);
private string FieldClass
=> EditContext.FieldCssClass(FieldIdentifier);
/// <summary>
/// Gets a CSS class string that combines the <c>class</c> attribute and <see cref="FieldClass"/>

View File

@ -85,9 +85,14 @@ namespace Microsoft.AspNetCore.Components.Forms
StateHasChanged();
}
protected virtual void Dispose(bool disposing)
{
}
void IDisposable.Dispose()
{
DetachValidationStateChangedListener();
Dispose(disposing: true);
}
private void DetachValidationStateChangedListener()

View File

@ -82,9 +82,14 @@ namespace Microsoft.AspNetCore.Components.Forms
StateHasChanged();
}
protected virtual void Dispose(bool disposing)
{
}
void IDisposable.Dispose()
{
DetachValidationStateChangedListener();
Dispose(disposing: true);
}
private void DetachValidationStateChangedListener()

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)
{
case "change":
return DeserializeUIEventChangeArgs(eventArgsJson);
return DeserializeChangeEventArgs(eventArgsJson);
case "clipboard":
return Deserialize<UIClipboardEventArgs>(eventArgsJson);
case "drag":
@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Components.Web
case "touch":
return Deserialize<UITouchEventArgs>(eventArgsJson);
case "unknown":
return Deserialize<UIEventArgs>(eventArgsJson);
return EventArgs.Empty;
case "wheel":
return Deserialize<UIWheelEventArgs>(eventArgsJson);
default:
@ -92,9 +92,9 @@ namespace Microsoft.AspNetCore.Components.Web
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;
switch (jsonElement.ValueKind)
{
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Components.Web
changeArgs.Value = jsonElement.GetBoolean();
break;
default:
throw new ArgumentException($"Unsupported {nameof(UIChangeEventArgs)} value {jsonElement}.");
throw new ArgumentException($"Unsupported {nameof(ChangeEventArgs)} value {jsonElement}.");
}
return changeArgs;
}

View File

@ -1,12 +1,18 @@
// 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.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about an clipboard event that is being raised.
/// </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.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about an error event that is being raised.
/// </summary>
public class UIErrorEventArgs : UIEventArgs
public class UIErrorEventArgs : EventArgs
{
/// <summary>
/// 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.
/// </summary>
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.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about a focus event that is being raised.
/// </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.
// 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.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about a keyboard event that is being raised.
/// </summary>
public class UIKeyboardEventArgs : UIEventArgs
public class UIKeyboardEventArgs : EventArgs
{
/// <summary>
/// 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.
/// </summary>
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.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about a mouse event that is being raised.
/// </summary>
public class UIMouseEventArgs : UIEventArgs
public class UIMouseEventArgs : EventArgs
{
/// <summary>
/// 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.
/// </summary>
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.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about a progress event that is being raised.
/// </summary>
public class UIProgressEventArgs : UIEventArgs
public class UIProgressEventArgs : EventArgs
{
/// <summary>
/// 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.
/// </summary>
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.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Supplies information about a touch event that is being raised.
/// </summary>
public class UITouchEventArgs : UIEventArgs
public class UITouchEventArgs : EventArgs
{
/// <summary>
/// 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.
/// </summary>
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
{
/// <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>
public static class WebEventCallbackFactoryUIEventArgsExtensions
{

View File

@ -213,28 +213,23 @@ namespace Microsoft.AspNetCore.Components.Forms
// Act/Assert: Initally, it's valid and unmodified
var inputComponent = await RenderAndGetTestInputComponentAsync(rootComponent);
Assert.Equal("valid", inputComponent.FieldClass);
Assert.Equal("valid", inputComponent.CssClass); // Same because no Class was specified
Assert.Equal("valid", inputComponent.CssClass); // no Class was specified
// Act/Assert: Modify the field
rootComponent.EditContext.NotifyFieldChanged(fieldIdentifier);
Assert.Equal("modified valid", inputComponent.FieldClass);
Assert.Equal("modified valid", inputComponent.CssClass);
// Act/Assert: Make it invalid
var messages = new ValidationMessageStore(rootComponent.EditContext);
messages.Add(fieldIdentifier, "I do not like this value");
Assert.Equal("modified invalid", inputComponent.FieldClass);
Assert.Equal("modified invalid", inputComponent.CssClass);
// Act/Assert: Clear the modification flag
rootComponent.EditContext.MarkAsUnmodified(fieldIdentifier);
Assert.Equal("invalid", inputComponent.FieldClass);
Assert.Equal("invalid", inputComponent.CssClass);
// Act/Assert: Make it valid
messages.Clear();
Assert.Equal("valid", inputComponent.FieldClass);
Assert.Equal("valid", inputComponent.CssClass);
}
@ -256,12 +251,10 @@ namespace Microsoft.AspNetCore.Components.Forms
// Act/Assert
var inputComponent = await RenderAndGetTestInputComponentAsync(rootComponent);
Assert.Equal("valid", inputComponent.FieldClass);
Assert.Equal("my-class other-class valid", inputComponent.CssClass);
// Act/Assert: Retains custom class when changing field class
rootComponent.EditContext.NotifyFieldChanged(fieldIdentifier);
Assert.Equal("modified valid", inputComponent.FieldClass);
Assert.Equal("my-class other-class modified valid", inputComponent.CssClass);
}
@ -393,8 +386,6 @@ namespace Microsoft.AspNetCore.Components.Forms
public new FieldIdentifier FieldIdentifier => base.FieldIdentifier;
public new string FieldClass => base.FieldClass;
protected override bool TryParseValueFromString(string value, out T result, out string validationErrorMessage)
{
throw new NotImplementedException();

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Hosting;
namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures
{
@ -11,6 +12,8 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures
{
public string PathBase { get; set; }
public IWebHost Host { get; set; }
public ExecutionMode ExecutionMode { get; set; } = ExecutionMode.Client;
private AspNetSiteServerFixture.BuildWebHost _buildWebHostMethod;
@ -32,7 +35,11 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures
var underlying = new DevHostServerFixture<TClientProgram>();
underlying.PathBase = PathBase;
_serverToDispose = underlying;
return underlying.RootUri.AbsoluteUri;
var uri = underlying.RootUri.AbsoluteUri; // As a side-effect, this starts the server
Host = underlying.Host;
return uri;
}
else
{
@ -41,7 +48,11 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures
underlying.AdditionalArguments.AddRange(AspNetFixtureAdditionalArguments);
underlying.BuildWebHostMethod = _buildWebHostMethod;
_serverToDispose = underlying;
return underlying.RootUri.AbsoluteUri;
var uri = underlying.RootUri.AbsoluteUri; // As a side-effect, this starts the server
Host = underlying.Host;
return uri;
}
}

View File

@ -0,0 +1,113 @@
// 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.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BasicTestApp;
using Castle.DynamicProxy.Contributors;
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
using Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests;
using Microsoft.AspNetCore.E2ETesting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Testing;
using OpenQA.Selenium;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.AspNetCore.Components.E2ETests.ServerExecutionTests
{
public class CircuitGracefulTerminationTests : BasicTestAppTestBase, IDisposable
{
public CircuitGracefulTerminationTests(
BrowserFixture browserFixture,
ToggleExecutionModeServerFixture<Program> serverFixture,
ITestOutputHelper output)
: base(browserFixture, serverFixture.WithServerExecution(), output)
{
}
public TaskCompletionSource<object> GracefulDisconnectCompletionSource { get; private set; }
public TestSink Sink { get; private set; }
public List<(Extensions.Logging.LogLevel level, string eventIdName)> Messages { get; private set; }
public override async Task InitializeAsync()
{
// These tests manipulate the browser in ways that make it impossible to use the same browser
// instance across tests (One of the tests closes the browser). For that reason we simply create
// a new browser instance for every test in this class sos that there are no issues when running
// them together.
await base.InitializeAsync(Guid.NewGuid().ToString());
}
protected override void InitializeAsyncCore()
{
Navigate(ServerPathBase, noReload: false);
MountTestComponent<CounterComponent>();
Browser.Equal("Current count: 0", () => Browser.FindElement(By.TagName("p")).Text);
GracefulDisconnectCompletionSource = new TaskCompletionSource<object>(TaskContinuationOptions.RunContinuationsAsynchronously);
Sink = _serverFixture.Host.Services.GetRequiredService<TestSink>();
Messages = new List<(Extensions.Logging.LogLevel level, string eventIdName)>();
Sink.MessageLogged += Log;
}
[Fact]
public async Task ReloadingThePage_GracefullyDisconnects_TheCurrentCircuit()
{
// Arrange & Act
_ = ((IJavaScriptExecutor)Browser).ExecuteScript("location.reload()");
await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task);
// Assert
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages);
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages);
}
[Fact]
public async Task ClosingTheBrowserWindow_GracefullyDisconnects_TheCurrentCircuit()
{
// Arrange & Act
Browser.Close();
// Set to null so that other tests in this class can create a new browser if necessary so
// that tests don't fail when running together.
Browser = null;
await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task);
// Assert
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages);
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages);
}
[Fact]
public async Task ClosingTheBrowserWindow_GracefullyDisconnects_WhenNavigatingAwayFromThePage()
{
// Arrange & Act
Browser.Navigate().GoToUrl("about:blank");
await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task);
// Assert
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages);
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages);
}
private void Log(WriteContext wc)
{
if ((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully") == (wc.LogLevel, wc.EventId.Name))
{
GracefulDisconnectCompletionSource.TrySetResult(null);
}
Messages.Add((wc.LogLevel, wc.EventId.Name));
}
public void Dispose()
{
if (Sink != null)
{
Sink.MessageLogged -= Log;
}
}
}
}

View File

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

View File

@ -10,12 +10,12 @@
<CascadingAuthenticationState>
<Router AppAssembly=typeof(BasicTestApp.Program).Assembly>
<AuthorizingContent>Authorizing...</AuthorizingContent>
<NotAuthorizedContent>
<Authorizing>Authorizing...</Authorizing>
<NotAuthorized>
<div id="auth-failure">
Sorry, @(context.User.Identity.Name ?? "anonymous"), you're not authorized.
</div>
</NotAuthorizedContent>
</NotAuthorized>
</Router>
</CascadingAuthenticationState>

View File

@ -1,5 +1,7 @@
<h3 id="bind-cases">Bind cases</h3>
@* There are a mix of cases here using bind and bind-value for coverage *@
<h2>Textbox</h2>
<p>
Initially blank:
@ -32,7 +34,7 @@
</p>
<p>
Nullable int:
<input id="textbox-nullable-int" @bind="textboxNullableIntValue" type="number" />
<input id="textbox-nullable-int" @bind-value="textboxNullableIntValue" type="number" />
<span id="textbox-nullable-int-value">@textboxNullableIntValue</span>
<input id="textbox-nullable-int-mirror" @bind="textboxNullableIntValue" readonly />
</p>
@ -50,7 +52,7 @@
</p>
<p>
float:
<input id="textbox-float" @bind="textboxFloatValue" type="number" />
<input id="textbox-float" @bind-value="textboxFloatValue" type="number" />
<span id="textbox-float-value">@textboxFloatValue</span>
<input id="textbox-float-mirror" @bind="textboxFloatValue" readonly />
</p>
@ -74,7 +76,7 @@
</p>
<p>
decimal:
<input id="textbox-decimal" @bind="textboxDecimalValue" type="number" />
<input id="textbox-decimal" @bind-value="textboxDecimalValue" type="number" />
<span id="textbox-decimal-value">@textboxDecimalValue</span>
<input id="textbox-decimal-mirror" @bind="textboxDecimalValue" readonly />
</p>
@ -119,7 +121,7 @@
</p>
<p>
Nullable DateTime:
<input id="textbox-nullable-datetime" @bind="textboxNullableDateTimeValue" type="text" />
<input id="textbox-nullable-datetime" @bind-value="textboxNullableDateTimeValue" type="text" />
<span id="textbox-nullable-datetime-value">@textboxNullableDateTimeValue</span>
<input id="textbox-nullable-datetime-mirror" @bind="textboxNullableDateTimeValue" readonly />
</p>
@ -149,7 +151,7 @@
</p>
<p>
DateTime (format):
<input id="textbox-datetime-format" @bind="textboxDateTimeFormatValue" type="text" @bind:format="MM-dd" />
<input id="textbox-datetime-format" @bind-value="textboxDateTimeFormatValue" type="text" @bind-value:format="MM-dd" />
<span id="textbox-datetime-format-value">@textboxDateTimeFormatValue</span>
<input id="textbox-datetime-format-mirror" @bind="textboxDateTimeFormatValue" readonly />
</p>
@ -161,7 +163,7 @@
</p>
<p>
DateTime (format / invalid value):
<input id="textbox-datetime-format-invalid" @bind="textboxDateTimeFormatInvalidValue" type="text" @bind:format="MM-dd" />
<input id="textbox-datetime-format-invalid" @bind-value="textboxDateTimeFormatInvalidValue" type="text" @bind-value:format="MM-dd" />
<span id="textbox-datetime-format-invalid-value">@textboxDateTimeFormatInvalidValue</span>
<input id="textbox-datetime-format-invalid-mirror" @bind="textboxDateTimeFormatInvalidValue" readonly />
</p>

View File

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

View File

@ -18,11 +18,11 @@
<form @onsubmit="HandleSubmit">
<p class="user-name">
User name:
<input @bind="person.UserName" class="@editContext.FieldClass(() => person.UserName)" />
<input @bind="person.UserName" class="@editContext.FieldCssClass(() => person.UserName)" />
</p>
<p class="accepts-terms">
Accept terms:
<input type="checkbox" @bind="person.AcceptsTerms" class="@editContext.FieldClass(() => person.AcceptsTerms)" />
<input type="checkbox" @bind="person.AcceptsTerms" class="@editContext.FieldCssClass(() => person.AcceptsTerms)" />
</p>
<button type="submit">Submit</button>

View File

@ -5,10 +5,10 @@
<DataAnnotationsValidator />
<p class="user-name">
User name: <input @bind="UserName" class="@context.FieldClass(() => UserName)" />
User name: <input @bind="UserName" class="@context.FieldCssClass(() => UserName)" />
</p>
<p class="accepts-terms">
Accept terms: <input type="checkbox" @bind="AcceptsTerms" class="@context.FieldClass(() => AcceptsTerms)" />
Accept terms: <input type="checkbox" @bind="AcceptsTerms" class="@context.FieldCssClass(() => AcceptsTerms)" />
</p>
<button type="submit">Submit</button>

View File

@ -3,6 +3,8 @@
<h3 id="globalization-cases">Globalization Bind Cases</h3>
<h3 id="culture-name-display">Culture is: @System.Globalization.CultureInfo.CurrentCulture.Name</h3>
@* There are a mix of cases here using bind and bind-value for coverage *@
<div>
<p>Numbers using bind in text fields</p>
<div>
@ -10,7 +12,7 @@
<span id="input_type_text_int_value">@inputTypeTextInt</span>
</div>
<div>
decimal: <input type="text" id="input_type_text_decimal" @bind="inputTypeTextDecimal" />
decimal: <input type="text" id="input_type_text_decimal" @bind-value="inputTypeTextDecimal" />
<span id="input_type_text_decimal_value">@inputTypeTextDecimal</span>
</div>
</div>
@ -22,7 +24,7 @@
<span id="input_type_text_datetime_value">@inputTypeTextDateTime</span>
</div>
<div>
DateTimeOffset: <input type="text" id="input_type_text_datetimeoffset" @bind="inputTypeTextDateTimeOffset" />
DateTimeOffset: <input type="text" id="input_type_text_datetimeoffset" @bind-value="inputTypeTextDateTimeOffset" />
<span id="input_type_text_datetimeoffset_value">@inputTypeTextDateTimeOffset</span>
</div>
</div>
@ -34,7 +36,7 @@
<span id="input_type_number_int_value">@inputTypeNumberInt</span>
</div>
<div>
decimal: <input type="number" id="input_type_number_decimal" @bind="inputTypeNumberDecimal" />
decimal: <input type="number" id="input_type_number_decimal" @bind-value="inputTypeNumberDecimal" />
<span id="input_type_number_decimal_value">@inputTypeNumberDecimal</span>
</div>
</div>
@ -47,7 +49,7 @@
<span id="input_type_date_datetime_value">@inputTypeDateDateTime</span>
</div>
<div>
DateTimeOffset: <input type="text" id="input_type_date_datetimeoffset_extrainput" @bind="inputTypeDateDateTimeOffset" />
DateTimeOffset: <input type="text" id="input_type_date_datetimeoffset_extrainput" @bind-value="inputTypeDateDateTimeOffset" />
<input type="date" id="input_type_date_datetimeoffset" @bind="inputTypeDateDateTimeOffset" />
<span id="input_type_date_datetimeoffset_value">@inputTypeDateDateTimeOffset</span>
</div>

View File

@ -58,7 +58,6 @@
<option value="BasicTestApp.RenderFragmentToggler">Render fragment renderer</option>
<option value="BasicTestApp.ReorderingFocusComponent">Reordering focus retention</option>
<option value="BasicTestApp.RouterTest.TestRouter">Router</option>
<option value="BasicTestApp.RouterTest.TestRouterWithoutNotFoundContent">Router without NotFoundContent</option>
<option value="BasicTestApp.RouterTest.UriHelperComponent">UriHelper Test</option>
<option value="BasicTestApp.SvgComponent">SVG</option>
<option value="BasicTestApp.SvgWithChildComponent">SVG with child component</option>

View File

@ -1,6 +1,6 @@
@using Microsoft.AspNetCore.Components.Routing
<Router AppAssembly=typeof(BasicTestApp.Program).Assembly>
<NotFoundContent>
<NotFound>
<div id="test-info">Oops, that component wasn't found!</div>
</NotFoundContent>
</NotFound>
</Router>

View File

@ -70,9 +70,8 @@ namespace Ignitor
throw new InvalidOperationException("Element does not have a change event.");
}
var sleectEventArgs = new UIChangeEventArgs()
var args = new ChangeEventArgs()
{
Type = changeEventDescriptor.EventName,
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)

View File

@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests.Bootstrap3Tests
var hasV3Part = false;
var hasV4Part = false;
var factory = Factory.WithWebHostBuilder(
whb => whb.UseStartup<Startup>().ConfigureServices(
whb => whb.ConfigureServices(
services => services.AddMvc().ConfigureApplicationPartManager(
apm => (hasV3Part, hasV4Part) = (HasPart(apm, "V3"), HasPart(apm, "V4")))));

View File

@ -37,13 +37,10 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests
}
public string BootstrapFrameworkVersion { get; set; } = "V4";
private bool IsHelixCI => typeof(ServerFactory<,>).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Any(a => a.Key == "Microsoft.AspNetCore.Testing.IsHelixCI");
protected override IHostBuilder CreateHostBuilder()
{
Program.UseStartup = false;
return base.CreateHostBuilder();
return Program.CreateHostBuilder(new[] { "--use-startup=false" });
}
protected override void ConfigureWebHost(IWebHostBuilder builder)

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
@ -17,13 +18,11 @@ namespace Identity.DefaultUI.WebSite
CreateHostBuilder(args).Build().Run();
}
public static bool UseStartup { get; set; } = true;
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
if (UseStartup)
if (!args.Contains("--use-startup=false"))
{
webBuilder.UseStartup<Startup>();
}

View File

@ -1,7 +1,7 @@
@using Microsoft.AspNetCore.Components.Routing
Router component
<Router AppAssembly="System.Reflection.Assembly.GetAssembly(typeof(RouterContainer))">
<NotFoundContent>
<NotFound>
<p>Route not found</p>
</NotFoundContent>
</NotFound>
</Router>

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Serverová aplikace Blazor",
"description": "Šablona projektu pro vytvoření serverové aplikace Blazor, která běží na straně serveru uvnitř aplikace ASP.NET Core a zpracovává interakce uživatele přes připojení SignalR. Tato šablona se dá využít pro webové aplikace s propracovanými dynamickými uživatelskými rozhraními (UI)."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Blazor-Server-App",
"description": "Eine Projektvorlage für das Erstellen einer Blazor-Server-App, die serverseitig innerhalb einer ASP.NET Core-App ausgeführt wird und die Benutzerinteraktionen über eine SignalR-Verbindung verarbeitet. Diese Vorlage kann für Web-Apps mit umfangreichen dynamischen Benutzeroberflächen verwendet werden."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Blazor Server App",
"description": "A project template for creating a Blazor server app that runs server-side inside an ASP.NET Core app and handles user interactions over a SignalR connection. This template can be used for web apps with rich dynamic user interfaces (UIs)."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Aplicación de servidor Blazor",
"description": "Plantilla de proyecto para crear una aplicación de servidor de Blazor que se ejecuta del lado servidor dentro de una aplicación de ASP.NET Core y controla las interacciones de los usuarios a través de una conexión de SignalR. Esta plantilla se puede usar para las aplicaciones web con interfaces de usuario dinámicas enriquecidas."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Application serveur Blazor",
"description": "Modèle de projet permettant de créer une application serveur Blazor qui s'exécute côté serveur dans une application ASP.NET Core, et qui gère les interactions utilisateur via une connexion SignalR. Vous pouvez utiliser ce modèle pour les applications web ayant des IU (interfaces utilisateur) dynamiques riches."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "App server Blazor",
"description": "Modello di progetto per la creazione di un'app server Blazor che viene eseguita lato server all'interno di un'app ASP.NET Core e gestisce le interazioni utente in una connessione SignalR. Questo modello può essere usato per app Web con interfacce utente dinamiche."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Blazor サーバー アプリ",
"description": "ASP.NET Core アプリ内のサーバー側で実行され、SignalR 接続を介してユーザー操作を処理する Blazor サーバー アプリを作成するためのプロジェクト テンプレート。このテンプレートは、高度でダイナミックなユーザー インターフェイス (UI) を備えた Web アプリに使用できます。"
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Blazor 서버 앱",
"description": "ASP.NET Core 앱 내에서 서버 쪽을 실행하고 SignalR 연결을 통해 사용자 상호 작용을 처리하는 Blazor 서버 앱을 만드는 데 사용되는 프로젝트 템플릿입니다. 이 템플릿을 사용하여 다양한 동적 UI(사용자 인터페이스)가 포함된 웹앱을 만들 수 있습니다."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Aplikacja serwera Blazor",
"description": "Szablon projektu służący do tworzenia aplikacji serwera Blazor działającej po stronie serwera wewnątrz aplikacji platformy ASP.NET Core i obsługującej interakcje z użytkownikami za pośrednictwem połączenia SignalR. Ten szablon może być używany dla aplikacji internetowych z rozbudowanymi, dynamicznymi interfejsami użytkowników."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Aplicativo de Servidor Blazor",
"description": "Um modelo de projeto para criar um aplicativo para servidores Blazor que é executado do lado do servidor em um aplicativo ASP.NET Core e manipula as interações com o usuário em uma conexão SignalR. Esse modelo pode ser usado para aplicativos Web com UIs (interfaces do usuário) completas e dinâmicas."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Серверное приложение Blazor",
"description": "Шаблон проекта для создания серверного приложения Blazor, которое запускается на стороне сервера в приложении ASP.NET Core и обрабатывает взаимодействие с пользователем через подключение SignalR. Этот шаблон можно использовать для веб-приложений с полнофункциональными динамическими пользовательскими интерфейсами."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Blazor Sunucu Uygulaması",
"description": "Bir ASP.NET Core uygulaması içinde sunucu tarafında çalışan ve bir SignalR bağlantısı üzerinden kullanıcı etkileşimlerini işleyen bir Blazor sunucu uygulaması oluşturmaya yönelik proje şablonu. Bu şablon, zengin dinamik kullanıcı arabirimlerine (UI) sahip web uygulamaları için kullanılabilir."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Blazor Server 应用",
"description": "用于创建 Blazor 服务器应用的项目模板,该应用会在 ASP.NET Core 应用内运行服务器端并对通过 SignalR 连接进行用户交互进行处理。此模板可用于具有丰富动态用户界面(UI)的 Web 应用。"
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Blazor 伺服器應用程式",
"description": "用來建立 Blazor 伺服器應用程式的專案範本,該應用程式會在 ASP.NET Core 應用程式內執行伺服器端,並透過 SignalR 連線處理使用者互動。此範本可用於具有豐富動態使用者介面 (UI) 的 Web 應用程式。"
}
}

View File

@ -1,7 +1,7 @@
<CascadingAuthenticationState>
<Router AppAssembly="typeof(Startup).Assembly">
<NotFoundContent>
<NotFound>
<p>Sorry, there's nothing at this address.</p>
</NotFoundContent>
</NotFound>
</Router>
</CascadingAuthenticationState>

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Prázdné",
"description": "Prázdná šablona projektu pro vytvoření aplikace ASP.NET Core. V této šabloně není žádný obsah."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Leer",
"description": "Eine leere Projektvorlage zum Erstellen einer ASP.NET Core-Anwendung. Diese Vorlage umfasst keine Inhalte."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Empty",
"description": "An empty project template for creating an ASP.NET Core application. This template does not have any content in it."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Vacío",
"description": "Una plantilla de proyecto vacía para crear una aplicación ASP.NET Core. Esta plantilla no incluye ningún contenido."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Vide",
"description": "Modèle de projet vide pour la création d'une application ASP.NET Core. Ce modèle n'a aucun contenu."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Vuoto",
"description": "Modello di progetto vuoto per la creazione di un'applicazione ASP.NET Core. Questo modello non include alcun contenuto."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "空",
"description": "ASP.NET Core アプリケーションを作成するための空のプロジェクト テンプレートです。このテンプレートにはコンテンツが一切含まれていません。"
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "비어 있음",
"description": "ASP.NET Core 응용 프로그램을 만들기 위한 빈 프로젝트 템플릿입니다. 이 템플릿에는 내용이 없습니다."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Pusty",
"description": "Pusty szablon projektu służący do tworzenia aplikacji platformy ASP.NET Core. Ten szablon nie ma żadnej zawartości."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Vazio",
"description": "Um modelo de projeto vazio para a criação de um aplicativo ASP.NET Core. Esse modelo não tem nenhum conteúdo."
}
}

View File

@ -0,0 +1,7 @@
{
"version": "1.0.0.0",
"strings": {
"name": "Пустой",
"description": "Пустой шаблон проекта для создания приложения ASP.NET Core. Этот шаблон не имеет содержимого."
}
}

Some files were not shown because too many files have changed in this diff Show More