diff --git a/LANCommander/Components/FilePicker.razor b/LANCommander/Components/FilePicker.razor index 413d5e2..5a20957 100644 --- a/LANCommander/Components/FilePicker.razor +++ b/LANCommander/Components/FilePicker.razor @@ -29,6 +29,8 @@ [Parameter] public bool AllowDirectories { get; set; } = false; [Parameter] public string Prefix { get; set; } [Parameter] public string Root { get; set; } + [Parameter] public Func EntrySelectable { get; set; } = _ => true; + [Parameter] public Func EntryVisible { get; set; } = _ => true; bool ArchiveExists { get; set; } = false; @@ -56,7 +58,8 @@ Root = Root, Select = true, Multiple = false, - AllowDirectories = AllowDirectories + EntrySelectable = EntrySelectable, + EntryVisible = EntryVisible }; var modalRef = await ModalService.CreateModalAsync>(modalOptions, browserOptions); diff --git a/LANCommander/Components/FilePickerDialog.razor b/LANCommander/Components/FilePickerDialog.razor index 2e1eb77..010ba86 100644 --- a/LANCommander/Components/FilePickerDialog.razor +++ b/LANCommander/Components/FilePickerDialog.razor @@ -3,21 +3,14 @@ @using LANCommander.Components.FileManagerComponents; @using LANCommander.Models; - + @code { + private IEnumerable SelectedFiles { get; set; } public override async Task OnFeedbackOkAsync(ModalClosingEventArgs args) { await base.OkCancelRefWithResult!.OnOk(SelectedFiles); } - - bool IsEntrySelectable(IFileManagerEntry entry) - { - if (!Options.AllowDirectories && entry is FileManagerDirectory) - return false; - else - return true; - } } diff --git a/LANCommander/Models/FilePickerOptions.cs b/LANCommander/Models/FilePickerOptions.cs index 19b50c4..c0ba985 100644 --- a/LANCommander/Models/FilePickerOptions.cs +++ b/LANCommander/Models/FilePickerOptions.cs @@ -1,4 +1,6 @@ -namespace LANCommander.Models +using LANCommander.Components.FileManagerComponents; + +namespace LANCommander.Models { public class FilePickerOptions { @@ -6,6 +8,7 @@ public string Root { get; set; } public bool Select { get; set; } public bool Multiple { get; set; } = false; - public bool AllowDirectories { get; set; } = false; + public Func EntryVisible { get; set; } = _ => true; + public Func EntrySelectable { get; set; } = _ => true; } }