diff --git a/Moonlight/Shared/Components/FileManagerPartials/FileView.razor b/Moonlight/Shared/Components/FileManagerPartials/FileView.razor index dcf0a34..0e889e8 100644 --- a/Moonlight/Shared/Components/FileManagerPartials/FileView.razor +++ b/Moonlight/Shared/Components/FileManagerPartials/FileView.razor @@ -35,88 +35,90 @@ - - - - - - - @foreach (var file in Data) - { + - + - } + @foreach (var file in Data) + { + + + + + + + } + @@ -138,12 +140,13 @@ @code { + [Parameter] public FileAccess Access { get; set; } [Parameter] public Func>? OnElementClicked { get; set; } - + [Parameter] public Func? OnSelectionChanged { get; set; } @@ -155,7 +158,7 @@ [Parameter] public bool DisableScrolling { get; set; } = false; - + [Parameter] public Func? Filter { get; set; } @@ -169,15 +172,19 @@ private Dictionary ToggleStatusCache = new(); private bool AllToggled = false; + private ContentBlock ContentBlock; + public async Task Refresh() { + ContentBlock?.SetBlocking(true); + var list = new List(); - + foreach (var fileData in await Access.Ls()) { if (Filter != null) { - if(Filter.Invoke(fileData)) + if (Filter.Invoke(fileData)) list.Add(fileData); } else @@ -185,7 +192,7 @@ } Data = list.ToArray(); - + ToggleStatusCache.Clear(); AllToggled = false; @@ -196,6 +203,8 @@ await InvokeAsync(StateHasChanged); OnSelectionChanged?.Invoke(); + + ContentBlock?.SetBlocking(false); } private async Task Load(LazyLoader arg) @@ -257,7 +266,7 @@ if (canceled) return; } - + await Access.Up(); await Refresh(); } @@ -273,4 +282,4 @@ return Task.CompletedTask; } -} \ No newline at end of file + } \ No newline at end of file diff --git a/Moonlight/Shared/Components/Partials/ContentBlock.razor b/Moonlight/Shared/Components/Partials/ContentBlock.razor new file mode 100644 index 0000000..c987da7 --- /dev/null +++ b/Moonlight/Shared/Components/Partials/ContentBlock.razor @@ -0,0 +1,52 @@ +@if (AllowContentOverride) +{ + if (IsBlocking) + { +
+
+ @(ChildContent) +
+
+
+
+
+
+ } + else + { + @ChildContent + } +} +else +{ +
+
+ @(ChildContent) +
+ @if (IsBlocking) + { +
+
+
+
+ } +
+} + +@code +{ + [Parameter] + public RenderFragment ChildContent { get; set; } + + [Parameter] + public bool AllowContentOverride { get; set; } = false; + + private bool IsBlocking = false; + + public async Task SetBlocking(bool b) + { + IsBlocking = b; + + await InvokeAsync(StateHasChanged); + } +} \ No newline at end of file