From 7dedec0f9b1095a73248e8a1e36862694de07f06 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Sun, 22 Sep 2024 16:20:27 +0300 Subject: [PATCH] Implements directory browser dialog, part 5: file system items selection --- .../Components/EnlightenmentCombobox.razor | 8 +- .../Components/EnlightenmentInput.razor | 2 +- .../Components/FileSystemBrowser.razor | 171 ++++-- .../Components/FileSystemBrowser.razor.css | 60 +- .../Components/FileSystemNavigator.razor | 56 -- .../Components/FileSystemNavigator.razor.css | 154 ----- .../Components/FileSystemTreeViewNode.razor | 3 +- .../Core/Services/UI/ComboboxService.cs | 3 +- src/Lumina.Presentation.Web/Pages/Home.razor | 2 +- .../wwwroot/js/site.js | 530 +++++++++++++++--- 10 files changed, 640 insertions(+), 349 deletions(-) delete mode 100644 src/Lumina.Presentation.Web/Components/FileSystemNavigator.razor delete mode 100644 src/Lumina.Presentation.Web/Components/FileSystemNavigator.razor.css diff --git a/src/Lumina.Presentation.Web/Components/EnlightenmentCombobox.razor b/src/Lumina.Presentation.Web/Components/EnlightenmentCombobox.razor index 4db138d5..1192729b 100644 --- a/src/Lumina.Presentation.Web/Components/EnlightenmentCombobox.razor +++ b/src/Lumina.Presentation.Web/Components/EnlightenmentCombobox.razor @@ -41,7 +41,7 @@ /// protected override void OnInitialized() { - _comboboxService.ComboboxOpened += CloseIfNotThis; + _comboboxService.ComboboxOpened += CloseIfNotThisAsync; } /// @@ -61,12 +61,12 @@ /// Closes the dropdown if the provided is not the current , or if it's . /// /// The optional id of the combobox that initiated the dropdown state change. - private void CloseIfNotThis(string? openedId) + private async Task CloseIfNotThisAsync(string? openedId) { if (openedId != "combobox_checkbox_" + Id && IsOpen) { IsOpen = false; - StateHasChanged(); + await InvokeAsync(StateHasChanged); } } @@ -86,6 +86,6 @@ /// public void Dispose() { - _comboboxService.ComboboxOpened -= CloseIfNotThis; + _comboboxService.ComboboxOpened -= CloseIfNotThisAsync; } } \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Components/EnlightenmentInput.razor b/src/Lumina.Presentation.Web/Components/EnlightenmentInput.razor index d7e95aad..96979481 100644 --- a/src/Lumina.Presentation.Web/Components/EnlightenmentInput.razor +++ b/src/Lumina.Presentation.Web/Components/EnlightenmentInput.razor @@ -43,7 +43,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) - await JSRuntime.InvokeVoidAsync("windowKeyDownHandler", inputElement, DotNetObjectReference.Create(this)); + await JSRuntime.InvokeVoidAsync("windowKeyDownHandler", inputElement, DotNetObjectReference.Create(this)).ConfigureAwait(false); } /// diff --git a/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor b/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor index 80aadc98..0b3c702b 100644 --- a/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor +++ b/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor @@ -1,8 +1,8 @@ -@using Lumina.Presentation.Web.Common.Api +@using Lumina.Presentation.Web.Common.Models.Common +@using Lumina.Presentation.Web.Common.Api @using Lumina.Presentation.Web.Common.Enums.FileSystem @using Lumina.Presentation.Web.Common.Enums.Notifications @using Lumina.Presentation.Web.Common.Exceptions -@using Lumina.Presentation.Web.Common.Models.Common @using Lumina.Presentation.Web.Common.Models.FileManagement @using Lumina.Presentation.Web.Common.Models.UI @using Lumina.Presentation.Web.Common.Services @@ -21,15 +21,15 @@
-
+