diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-13 20:25:05 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-13 20:25:05 +0200 |
commit | 712ad189c99570f686ab779782b2a873e172428e (patch) | |
tree | 6102e4719416e71522e9143fa4e06951258bd77c /MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor | |
parent | Fix passwords being visible during editing (diff) | |
download | MatrixUtils-712ad189c99570f686ab779782b2a873e172428e.tar.xz |
Change syntax style
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor')
-rw-r--r-- | MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor index 4d90c57..42a5f64 100644 --- a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor +++ b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor @@ -1,9 +1,8 @@ @using MatrixRoomUtils.Core.Extensions <table> - @foreach(var i in Items.Keys) - { + @foreach (var i in Items.Keys) { var key = i; - <input value="@Items[key]" @oninput="(obj) => inputChanged(obj, key)"> + <input value="@Items[key]" @oninput="obj => inputChanged(obj, key)"> <button @onclick="() => { Items.Remove(key); ItemsChanged.InvokeAsync(); }">Remove</button> <br/> } @@ -11,28 +10,26 @@ <button @onclick="() => { Items.Add(string.Empty, default); ItemsChanged.InvokeAsync(); }">Add</button> @code { - + [Parameter] public Dictionary<string, object> Items { get; set; } = new(); - [Parameter, EditorRequired] + [Parameter] + [EditorRequired] public EventCallback ItemsChanged { get; set; } [Parameter] - public Func<string,string>? KeyFormatter { get; set; } - + public Func<string, string>? KeyFormatter { get; set; } + [Parameter] public Action? OnFocusLost { get; set; } - - protected override Task OnInitializedAsync() - { + protected override Task OnInitializedAsync() { Console.WriteLine($"DictionaryEditor initialized with {Items.Count} items: {Items.ToJson()}"); return base.OnInitializedAsync(); } - private void inputChanged(ChangeEventArgs obj, string key) - { + private void inputChanged(ChangeEventArgs obj, string key) { Console.WriteLine($"StringListEditor inputChanged {key} {obj.Value}"); Items[key] = obj.Value.ToString(); ItemsChanged.InvokeAsync(); |