From a357bec1831611758a19bf23ff0fa5a5fe99ca52 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Sun, 28 May 2023 11:30:53 +0200 Subject: Add changes --- .../Shared/SimpleComponents/DictionaryEditor.razor | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor (limited to 'MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor') diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor new file mode 100644 index 0000000..4d90c57 --- /dev/null +++ b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor @@ -0,0 +1,41 @@ +@using MatrixRoomUtils.Core.Extensions + + @foreach(var i in Items.Keys) + { + var key = i; + + +
+ } +
+ + +@code { + + [Parameter] + public Dictionary Items { get; set; } = new(); + + [Parameter, EditorRequired] + public EventCallback ItemsChanged { get; set; } + + [Parameter] + public Func? KeyFormatter { get; set; } + + [Parameter] + public Action? OnFocusLost { get; set; } + + + protected override Task OnInitializedAsync() + { + Console.WriteLine($"DictionaryEditor initialized with {Items.Count} items: {Items.ToJson()}"); + return base.OnInitializedAsync(); + } + + private void inputChanged(ChangeEventArgs obj, string key) + { + Console.WriteLine($"StringListEditor inputChanged {key} {obj.Value}"); + Items[key] = obj.Value.ToString(); + ItemsChanged.InvokeAsync(); + } + +} \ No newline at end of file -- cgit 1.5.1