From 7bb5fb7459a587ceed6b3b9229d9c74814f0757b Mon Sep 17 00:00:00 2001
From: Darick Carpenter
Date: Sun, 24 May 2020 12:05:23 -0600
Subject: [PATCH 1/2] Added BindEvent to MatInputText to allow
@bind:event="oninput".
---
.../Demo/DemoMatTextField.razor | 49 +++++++++++++++++++
.../MatTextField/BaseMatInputTextComponent.cs | 3 ++
.../MatTextField/MatInputTextComponent.razor | 4 +-
3 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/src/MatBlazor.Demo/Demo/DemoMatTextField.razor b/src/MatBlazor.Demo/Demo/DemoMatTextField.razor
index bdccb56a..66c7f626 100644
--- a/src/MatBlazor.Demo/Demo/DemoMatTextField.razor
+++ b/src/MatBlazor.Demo/Demo/DemoMatTextField.razor
@@ -1245,6 +1245,55 @@
bool? boolNullValue;
}
+ ")>
+
+
+
+
+Bind Event
+
+
+
+
+
+
+
+ Value: @MyString11
+
+
+
+
+ Value: @MyString12
+
+
+ @code
+ {
+ public string MyString11 { get; set; }
+ public string MyString12 {get;set;}
+ }
+
+
+
+
+
+ Value: @MyString11
+
+
+
+
+ Value: @MyString12
+
+
+ @code
+ {
+
+ public string MyString11 {get;set;}
+ public string MyString11 {get;set;}
+ }
+
")>
\ No newline at end of file
diff --git a/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs b/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs
index 1c3b936d..c1d9f892 100644
--- a/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs
+++ b/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs
@@ -94,6 +94,9 @@ protected virtual bool InputTextReadOnly()
[Parameter]
public string Type { get; set; } = "text";
+ [Parameter]
+ public string BindEvent { get; set; } = "onchange";
+
protected virtual EventCallback OnKeyDownEvent()
{
diff --git a/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor b/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor
index b33a3199..74711c2c 100644
--- a/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor
+++ b/src/MatBlazor/Components/MatTextField/MatInputTextComponent.razor
@@ -16,11 +16,11 @@
@if (TextArea)
{
-
+
}
else
{
-
+
}
From a466af92987f5f62c0e24e875339359ee1aefd52 Mon Sep 17 00:00:00 2001
From: Darick Carpenter
Date: Tue, 26 May 2020 10:09:48 -0600
Subject: [PATCH 2/2] Added UpdateOnInput to MatInputText to allow
@bind:event="oninput".
---
src/MatBlazor.Demo/Demo/DemoMatTextField.razor | 10 +++++-----
.../MatTextField/BaseMatInputTextComponent.cs | 6 ++++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/MatBlazor.Demo/Demo/DemoMatTextField.razor b/src/MatBlazor.Demo/Demo/DemoMatTextField.razor
index 66c7f626..ecd26ad2 100644
--- a/src/MatBlazor.Demo/Demo/DemoMatTextField.razor
+++ b/src/MatBlazor.Demo/Demo/DemoMatTextField.razor
@@ -1257,12 +1257,12 @@
-
+
Value: @MyString11
-
+
Value: @MyString12
@@ -1278,12 +1278,12 @@
-
+
Value: @MyString11
-
+
Value: @MyString12
@@ -1291,7 +1291,7 @@
{
public string MyString11 {get;set;}
- public string MyString11 {get;set;}
+ public string MyString12 {get;set;}
}
")>
diff --git a/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs b/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs
index c1d9f892..8b450bda 100644
--- a/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs
+++ b/src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs
@@ -94,8 +94,10 @@ protected virtual bool InputTextReadOnly()
[Parameter]
public string Type { get; set; } = "text";
- [Parameter]
- public string BindEvent { get; set; } = "onchange";
+ [Parameter]
+ public bool UpdateOnInput { get; set; }
+
+ protected string BindEvent => UpdateOnInput ? "oninput" : "onchange";
protected virtual EventCallback OnKeyDownEvent()