(Items);
+
+ if (_searchText.Length > 0)
+ FilterItems();
+
await base.OnParametersSetAsync();
}
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
- if (Required)
- {
- if (InputAttributes.ContainsKey("required")) InputAttributes.Add("required", true);
- }
+
+ if (Required && InputAttributes.ContainsKey("required"))
+ InputAttributes.Add("required", true);
}
}
\ No newline at end of file
diff --git a/src/Connected.Components/Components/TextInput.razor b/src/Connected.Components/Components/TextInput.razor
index cf84831..1750968 100644
--- a/src/Connected.Components/Components/TextInput.razor
+++ b/src/Connected.Components/Components/TextInput.razor
@@ -5,7 +5,7 @@
@if (NumOfRows==1)
{
- IsPassword ? "password" : "text";
- [Parameter]
- public EventCallback ValueChanged { get; set; }
+ [Parameter]
+ public EventCallback ValueChanged { get; set; }
- private async Task ChangeValueAsync(ChangeEventArgs args)
- {
- await ValueChanged.InvokeAsync(args.Value.ToString());
- }
+ private async Task ChangeValueAsync(ChangeEventArgs args)
+ {
+ await ValueChanged.InvokeAsync(args?.Value?.ToString());
+ }
private async Task Clear()
{
await ValueChanged.InvokeAsync(string.Empty);
-
}
protected override async Task OnInitializedAsync()
- {
+ {
await base.OnInitializedAsync();
- if (Required)
- {
- if (!InputAttributes.ContainsKey("required")) InputAttributes.Add("required", true);
- }
- }
+ if (Required && !InputAttributes.ContainsKey("required"))
+ InputAttributes.Add("required", true);
+ }
}
\ No newline at end of file
diff --git a/src/Connected.Components/Models/InputBase.cs b/src/Connected.Components/Models/InputBase.cs
index f6bda7a..abfd7b7 100644
--- a/src/Connected.Components/Models/InputBase.cs
+++ b/src/Connected.Components/Models/InputBase.cs
@@ -30,7 +30,7 @@ public class InputBase : ComponentBase
[Parameter]
public bool Required { get; set; } = false;
- public Dictionary InputAttributes { get; set; }
+ public Dictionary InputAttributes { get; set; } = new();
///
/// Show clear button.
@@ -50,18 +50,11 @@ public class InputBase : ComponentBase
[Parameter]
public bool ShowCharacterCounter { get; set; }
- private string _errorText = string.Empty;
+ ///
+ ///
+ ///
[Parameter]
- public string ErrorText {
- get
- {
- return _errorText;
- }
- set
- {
- _errorText = value;
- }
- }
+ public string ErrorText { get; set; } = string.Empty;
public bool IsError
{
@@ -79,15 +72,16 @@ public class InputBase : ComponentBase
protected virtual async Task SetTextAsync(string text)
{
- if (Text != text)
- {
- Text = text;
- await TextChanged.InvokeAsync(text);
- }
+ if (Text == text)
+ return;
+
+ Text = text;
+ await TextChanged.InvokeAsync(text);
}
private string _helperText = string.Empty;
+
[Parameter]
public string HelperText
{