Allow @bind:event override when used with @bind (dotnet/aspnetcore-tooling#687)
* Allow @bind:event override when used with @bind
* Added more tests to cover standalone @bind-value=... case
* fix
\n\nCommit migrated from a399bd072e
This commit is contained in:
parent
7a510b311d
commit
ab867ec5e2
|
|
@ -538,8 +538,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
|
|||
var node = bindEntry.BindNode;
|
||||
var attributeName = node.AttributeName;
|
||||
valueAttributeName = node.TagHelper.GetValueAttributeName() ?? valueAttributeName;
|
||||
changeAttributeName = node.TagHelper.GetChangeAttributeName() ?? changeAttributeName;
|
||||
expressionAttributeName = node.TagHelper.GetExpressionAttributeName() ?? expressionAttributeName;
|
||||
|
||||
// If there an attribute that specifies the event like @bind:event="oninput",
|
||||
// that should be preferred. Otherwise, use the one from the tag helper.
|
||||
changeAttributeName ??= node.TagHelper.GetChangeAttributeName();
|
||||
|
||||
expressionAttributeName = node.TagHelper.GetExpressionAttributeName();
|
||||
|
||||
// We expect 0-1 components per-node.
|
||||
var componentTagHelper = (parent as ComponentIntermediateNode)?.Component;
|
||||
|
|
|
|||
|
|
@ -958,6 +958,34 @@ namespace Test
|
|||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BindToElementWithSuffix_OverridesEvent()
|
||||
{
|
||||
// Arrange
|
||||
AdditionalSyntaxTrees.Add(Parse(@"
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
[BindElement(""div"", ""value"", ""myvalue"", ""myevent"")]
|
||||
public static class BindAttributes
|
||||
{
|
||||
}
|
||||
}"));
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<div @bind-value=""@ParentValue"" @bind-value:event=""anotherevent"" />
|
||||
@code {
|
||||
public string ParentValue { get; set; } = ""hi"";
|
||||
}");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuiltIn_BindToInputWithoutType_WritesAttributes()
|
||||
{
|
||||
|
|
@ -1086,6 +1114,60 @@ namespace Test
|
|||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuiltIn_BindToInputText_CanOverrideEvent()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<input @bind=""@CurrentDate"" @bind:event=""oninput"" @bind:format=""MM/dd"" />
|
||||
@code {
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
}");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuiltIn_BindToInputWithSuffix()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<input @bind-value=""@CurrentDate"" @bind-value:format=""MM/dd"" />
|
||||
@code {
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
}");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuiltIn_BindToInputWithSuffix_CanOverrideEvent()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<input @bind-value=""@CurrentDate"" @bind-value:event=""oninput"" @bind-value:format=""MM/dd"" />
|
||||
@code {
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
}");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Child Content
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 219
|
||||
private void __RazorDirectiveTokenHelpers__() {
|
||||
}
|
||||
#pragma warning restore 219
|
||||
#pragma warning disable 0414
|
||||
private static System.Object __o = null;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
ParentValue
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
);
|
||||
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue);
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public string ParentValue { get; set; } = "hi";
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [12] ) - System
|
||||
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [17] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
DesignTimeDirective -
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning disable 0414
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning restore 0414
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [67] x:\dir\subdir\Test\TestComponent.cshtml) - div
|
||||
HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
|
||||
HtmlContent - (67:0,67 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (67:0,67 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (76:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (76:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Source Location: (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|ParentValue|
|
||||
Generated Location: (935:25,19 [11] )
|
||||
|ParentValue|
|
||||
|
||||
Source Location: (76:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public string ParentValue { get; set; } = "hi";
|
||||
|
|
||||
Generated Location: (1280:36,7 [55] )
|
||||
|
|
||||
public string ParentValue { get; set; } = "hi";
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 219
|
||||
private void __RazorDirectiveTokenHelpers__() {
|
||||
}
|
||||
#pragma warning restore 219
|
||||
#pragma warning disable 0414
|
||||
private static System.Object __o = null;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
CurrentDate
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
, "MM/dd");
|
||||
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [12] ) - System
|
||||
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [17] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
DesignTimeDirective -
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning disable 0414
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning restore 0414
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (14:0,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (15:0,15 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate
|
||||
IntermediateToken - - CSharp - ,
|
||||
IntermediateToken - - CSharp - "MM/dd"
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (14:0,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")
|
||||
HtmlContent - (73:0,73 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (73:0,73 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (82:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (82:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Source Location: (15:0,15 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|CurrentDate|
|
||||
Generated Location: (931:25,15 [11] )
|
||||
|CurrentDate|
|
||||
|
||||
Source Location: (82:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
Generated Location: (1294:36,7 [77] )
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 219
|
||||
private void __RazorDirectiveTokenHelpers__() {
|
||||
}
|
||||
#pragma warning restore 219
|
||||
#pragma warning disable 0414
|
||||
private static System.Object __o = null;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
CurrentDate
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
, "MM/dd");
|
||||
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [12] ) - System
|
||||
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [17] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
DesignTimeDirective -
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning disable 0414
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning restore 0414
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [63] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate
|
||||
IntermediateToken - - CSharp - ,
|
||||
IntermediateToken - - CSharp - "MM/dd"
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")
|
||||
HtmlContent - (63:0,63 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (63:0,63 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (72:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (72:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|CurrentDate|
|
||||
Generated Location: (937:25,21 [11] )
|
||||
|CurrentDate|
|
||||
|
||||
Source Location: (72:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
Generated Location: (1300:36,7 [77] )
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 219
|
||||
private void __RazorDirectiveTokenHelpers__() {
|
||||
}
|
||||
#pragma warning restore 219
|
||||
#pragma warning disable 0414
|
||||
private static System.Object __o = null;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
CurrentDate
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
, "MM/dd");
|
||||
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [12] ) - System
|
||||
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [17] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
DesignTimeDirective -
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning disable 0414
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning restore 0414
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate
|
||||
IntermediateToken - - CSharp - ,
|
||||
IntermediateToken - - CSharp - "MM/dd"
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")
|
||||
HtmlContent - (91:0,91 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (91:0,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (100:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (100:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|CurrentDate|
|
||||
Generated Location: (937:25,21 [11] )
|
||||
|CurrentDate|
|
||||
|
||||
Source Location: (100:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
Generated Location: (1300:36,7 [77] )
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenElement(0, "div");
|
||||
builder.AddAttribute(1, "myvalue", Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
ParentValue
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
));
|
||||
builder.AddAttribute(2, "anotherevent", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue));
|
||||
builder.SetUpdatesAttributeName("myvalue");
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public string ParentValue { get; set; } = "hi";
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [14] ) - System
|
||||
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [19] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [67] x:\dir\subdir\Test\TestComponent.cshtml) - div
|
||||
HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
|
||||
CSharpCode - (76:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (76:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (76:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public string ParentValue { get; set; } = "hi";
|
||||
|
|
||||
Generated Location: (1215:32,7 [55] )
|
||||
|
|
||||
public string ParentValue { get; set; } = "hi";
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenElement(0, "input");
|
||||
builder.AddAttribute(1, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
CurrentDate
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
, "MM/dd"));
|
||||
builder.AddAttribute(2, "oninput", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd"));
|
||||
builder.SetUpdatesAttributeName("value");
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [14] ) - System
|
||||
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [19] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (14:0,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (15:0,15 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate
|
||||
IntermediateToken - - CSharp - ,
|
||||
IntermediateToken - - CSharp - "MM/dd"
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (14:0,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")
|
||||
CSharpCode - (82:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (82:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (82:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
Generated Location: (1222:32,7 [77] )
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenElement(0, "input");
|
||||
builder.AddAttribute(1, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
CurrentDate
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
, "MM/dd"));
|
||||
builder.AddAttribute(2, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd"));
|
||||
builder.SetUpdatesAttributeName("value");
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [14] ) - System
|
||||
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [19] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [63] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate
|
||||
IntermediateToken - - CSharp - ,
|
||||
IntermediateToken - - CSharp - "MM/dd"
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")
|
||||
CSharpCode - (72:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (72:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (72:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
Generated Location: (1229:32,7 [77] )
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenElement(0, "input");
|
||||
builder.AddAttribute(1, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
CurrentDate
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
, "MM/dd"));
|
||||
builder.AddAttribute(2, "oninput", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd"));
|
||||
builder.SetUpdatesAttributeName("value");
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [14] ) - System
|
||||
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [19] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
MarkupElement - (0:0,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate
|
||||
IntermediateToken - - CSharp - ,
|
||||
IntermediateToken - - CSharp - "MM/dd"
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")
|
||||
CSharpCode - (100:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (100:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (100:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
Generated Location: (1228:32,7 [77] )
|
||||
|
|
||||
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
|
||||
|
|
||||
|
||||
|
|
@ -15,6 +15,10 @@ namespace Microsoft.AspNetCore.Components
|
|||
// when a specific type attribute is applied.
|
||||
[BindInputElement(null, null, "value", "onchange")]
|
||||
|
||||
// Handles cases like <input @bind-value="..." /> - this is a fallback and will be ignored
|
||||
// when a specific type attribute is applied.
|
||||
[BindInputElement(null, "value", "value", "onchange")]
|
||||
|
||||
[BindInputElement("checkbox", null, "checked", "onchange")]
|
||||
[BindInputElement("text", null, "value", "onchange")]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue