diff --git a/src/Connected.Components.Showcase.Runner/Pages/Index.razor b/src/Connected.Components.Showcase.Runner/Pages/Index.razor index 748b937..6f94a83 100644 --- a/src/Connected.Components.Showcase.Runner/Pages/Index.razor +++ b/src/Connected.Components.Showcase.Runner/Pages/Index.razor @@ -3,112 +3,39 @@

Component Sandbox

-

ValueDouble: @inputValueDouble.ToString()

-

ValueInt: @inputValueInt.ToString()

-

ValueText: @inputValueText

-

SimpleSelectValue: @SelectedItemValue

- - - - - - - - - - - +

SelectedValue: @SelectedValue.ToString()

- + Items="@items" + Label="Simple select" + @bind-Value=@SelectedValue +/> @code { + int SelectedValue; - List> SelectFieldItems = new(); - string SelectedItemValue = ""; - - int counter { get; set; } = 0; + List items; - private string _inputText = string.Empty; - string inputValueText + private void FillItemsList() { - get - { - return _inputText; - } - set - { - if (value.Length > 0) errorText = "Error!!!"; - else errorText = ""; - _inputText = value; - StateHasChanged(); - } - } - double inputValueDouble = 12.756; - int inputValueInt = 12; + if (items is null) items = new(); - DateTime inputValueDate = DateTime.Now.AddDays(-10); + Random random = new Random(DateTime.Now.Millisecond); - public void CounterIncrement() - { - counter++; + for (int i = 0; i < 10; i++) + { + int item = random.Next(); + items.Add(item); + } StateHasChanged(); } - string errorText = "Error!!"; - protected override async Task OnInitializedAsync() { - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 1", Value = "select item value 1", Enabled = true }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 2", Value = "select item value 2", Enabled = true }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 3", Value = "select item value 3", Enabled = true }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 4", Value = "select item value 4", Enabled = true }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 5", Value = "select item value 5", Enabled = false }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 6", Value = "select item value 6", Enabled = true }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 7", Value = "select item value 7", Enabled = true }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 8", Value = "select item value 8", Enabled = false }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 9", Value = "select item value 9", Enabled = true }); - SelectFieldItems.Add(new SelectItem() { DisplayedText = "Item 10", Value = "select item value 10", Enabled = true }); - SelectedItemValue = SelectFieldItems[0].Value; + FillItemsList(); } } \ No newline at end of file diff --git a/src/Connected.Components/Components/TextInput.razor.cs b/src/Connected.Components/Components/TextInput.razor.cs index 7dd294f..e7e5354 100644 --- a/src/Connected.Components/Components/TextInput.razor.cs +++ b/src/Connected.Components/Components/TextInput.razor.cs @@ -48,13 +48,11 @@ public partial class TextInput: InputBase private async Task ChangeValueAsync(ChangeEventArgs args) { await ValueChanged.InvokeAsync(args.Value.ToString()); - StateHasChanged(); } private async Task Clear() { await ValueChanged.InvokeAsync(string.Empty); - StateHasChanged(); } diff --git a/src/Connected.Components/Models/SelectItem.cs b/src/Connected.Components/Models/SelectItem.cs deleted file mode 100644 index bf47c79..0000000 --- a/src/Connected.Components/Models/SelectItem.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Connected.Models -{ - public class SelectItem - { - public string DisplayedText { get; set; } - public ValueType Value { get; set; } - public bool Enabled { get; set; } - } -} \ No newline at end of file