Use flags to dictate which features a file manager has
parent
c12b834571
commit
acddc47a89
|
@ -5,56 +5,87 @@
|
||||||
<div class="file-manager">
|
<div class="file-manager">
|
||||||
<GridRow Class="file-manager-nav">
|
<GridRow Class="file-manager-nav">
|
||||||
<Space>
|
<Space>
|
||||||
<SpaceItem>
|
@if (Features.HasFlag(FileManagerFeatures.NavigationBack))
|
||||||
<Tooltip Title="Back" MouseEnterDelay="2">
|
{
|
||||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowLeft" OnClick="NavigateBack" Disabled="@(Past.Count == 0)" />
|
<SpaceItem>
|
||||||
</Tooltip>
|
<Tooltip Title="Back" MouseEnterDelay="2">
|
||||||
</SpaceItem>
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowLeft" OnClick="NavigateBack" Disabled="@(Past.Count == 0)" />
|
||||||
<SpaceItem>
|
</Tooltip>
|
||||||
<Tooltip Title="Forward" MouseEnterDelay="2">
|
</SpaceItem>
|
||||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowRight" OnClick="NavigateForward" Disabled="@(Future.Count == 0)" />
|
}
|
||||||
</Tooltip>
|
|
||||||
</SpaceItem>
|
@if (Features.HasFlag(FileManagerFeatures.NavigationForward))
|
||||||
<SpaceItem>
|
{
|
||||||
<Tooltip Title="Up a Level" MouseEnterDelay="2">
|
<SpaceItem>
|
||||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowUp" OnClick="NavigateUp" Disabled="@(Path.Parent == null)" />
|
<Tooltip Title="Forward" MouseEnterDelay="2">
|
||||||
</Tooltip>
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowRight" OnClick="NavigateForward" Disabled="@(Future.Count == 0)" />
|
||||||
</SpaceItem>
|
</Tooltip>
|
||||||
<SpaceItem>
|
</SpaceItem>
|
||||||
<Tooltip Title="Refresh" MouseEnterDelay="2">
|
}
|
||||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Reload" OnClick="Refresh" />
|
|
||||||
</Tooltip>
|
@if (Features.HasFlag(FileManagerFeatures.UpALevel))
|
||||||
</SpaceItem>
|
{
|
||||||
<SpaceItem Class="file-manager-nav-breadcrumbs">
|
<SpaceItem>
|
||||||
<Breadcrumb>
|
<Tooltip Title="Up a Level" MouseEnterDelay="2">
|
||||||
@foreach (var breadcrumb in Breadcrumbs)
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowUp" OnClick="NavigateUp" Disabled="@(Path.Parent == null)" />
|
||||||
{
|
</Tooltip>
|
||||||
<BreadcrumbItem OnClick="() => ChangeDirectory(breadcrumb, false)">@breadcrumb.Name</BreadcrumbItem>
|
</SpaceItem>
|
||||||
}
|
}
|
||||||
</Breadcrumb>
|
|
||||||
</SpaceItem>
|
@if (Features.HasFlag(FileManagerFeatures.Refresh))
|
||||||
<SpaceItem>
|
{
|
||||||
<Tooltip Title="New Folder" MouseEnterDelay="2">
|
<SpaceItem>
|
||||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.FolderAdd" OnClick="() => NewFolderModal.Open()" />
|
<Tooltip Title="Refresh" MouseEnterDelay="2">
|
||||||
</Tooltip>
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Reload" OnClick="Refresh" />
|
||||||
</SpaceItem>
|
</Tooltip>
|
||||||
<SpaceItem>
|
</SpaceItem>
|
||||||
<Tooltip Title="Upload File" MouseEnterDelay="2">
|
}
|
||||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Upload" OnClick="() => UploadModal.Open()" />
|
|
||||||
</Tooltip>
|
@if (Features.HasFlag(FileManagerFeatures.Breadcrumbs))
|
||||||
</SpaceItem>
|
{
|
||||||
<SpaceItem>
|
<SpaceItem Class="file-manager-nav-breadcrumbs">
|
||||||
<Tooltip Title="Delete" MouseEnterDelay="2">
|
<Breadcrumb>
|
||||||
<Popconfirm OnConfirm="Delete">
|
@foreach (var breadcrumb in Breadcrumbs)
|
||||||
<TitleTemplate>
|
{
|
||||||
Are you sure you want to delete the selected file@(Selected.Count() == 1 ? "" : "s")?
|
<BreadcrumbItem OnClick="() => ChangeDirectory(breadcrumb, false)">@breadcrumb.Name</BreadcrumbItem>
|
||||||
</TitleTemplate>
|
}
|
||||||
<ChildContent>
|
</Breadcrumb>
|
||||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Delete" Disabled="@(Selected.Count() == 0)" />
|
</SpaceItem>
|
||||||
</ChildContent>
|
}
|
||||||
</Popconfirm>
|
|
||||||
</Tooltip>
|
@if (Features.HasFlag(FileManagerFeatures.NewFolder))
|
||||||
</SpaceItem>
|
{
|
||||||
|
<SpaceItem>
|
||||||
|
<Tooltip Title="New Folder" MouseEnterDelay="2">
|
||||||
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.FolderAdd" OnClick="() => NewFolderModal.Open()" />
|
||||||
|
</Tooltip>
|
||||||
|
</SpaceItem>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (Features.HasFlag(FileManagerFeatures.UploadFile))
|
||||||
|
{
|
||||||
|
<SpaceItem>
|
||||||
|
<Tooltip Title="Upload File" MouseEnterDelay="2">
|
||||||
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Upload" OnClick="() => UploadModal.Open()" />
|
||||||
|
</Tooltip>
|
||||||
|
</SpaceItem>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (Features.HasFlag(FileManagerFeatures.Delete))
|
||||||
|
{
|
||||||
|
<SpaceItem>
|
||||||
|
<Tooltip Title="Delete" MouseEnterDelay="2">
|
||||||
|
<Popconfirm OnConfirm="Delete">
|
||||||
|
<TitleTemplate>
|
||||||
|
Are you sure you want to delete the selected file@(Selected.Count() == 1 ? "" : "s")?
|
||||||
|
</TitleTemplate>
|
||||||
|
<ChildContent>
|
||||||
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Delete" Disabled="@(Selected.Count() == 0)" />
|
||||||
|
</ChildContent>
|
||||||
|
</Popconfirm>
|
||||||
|
</Tooltip>
|
||||||
|
</SpaceItem>
|
||||||
|
}
|
||||||
</Space>
|
</Space>
|
||||||
</GridRow>
|
</GridRow>
|
||||||
|
|
||||||
|
@ -124,6 +155,7 @@
|
||||||
[Parameter] public Guid ArchiveId { get; set; }
|
[Parameter] public Guid ArchiveId { get; set; }
|
||||||
[Parameter] public string WorkingDirectory { get; set; }
|
[Parameter] public string WorkingDirectory { get; set; }
|
||||||
[Parameter] public bool SelectMultiple { get; set; } = true;
|
[Parameter] public bool SelectMultiple { get; set; } = true;
|
||||||
|
[Parameter] public FileManagerFeatures Features { get; set; } = FileManagerFeatures.NavigationBack | FileManagerFeatures.NavigationForward | FileManagerFeatures.UpALevel | FileManagerFeatures.Refresh | FileManagerFeatures.Breadcrumbs | FileManagerFeatures.NewFolder | FileManagerFeatures.UploadFile | FileManagerFeatures.Delete;
|
||||||
[Parameter] public IEnumerable<IFileManagerEntry> Selected { get; set; } = new List<IFileManagerEntry>();
|
[Parameter] public IEnumerable<IFileManagerEntry> Selected { get; set; } = new List<IFileManagerEntry>();
|
||||||
[Parameter] public EventCallback<IEnumerable<IFileManagerEntry>> SelectedChanged { get; set; }
|
[Parameter] public EventCallback<IEnumerable<IFileManagerEntry>> SelectedChanged { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace LANCommander.Components.FileManagerComponents
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
public enum FileManagerFeatures
|
||||||
|
{
|
||||||
|
NavigationBack = 0,
|
||||||
|
NavigationForward = 1,
|
||||||
|
UpALevel = 2,
|
||||||
|
Refresh = 4,
|
||||||
|
Breadcrumbs = 8,
|
||||||
|
NewFolder = 16,
|
||||||
|
UploadFile = 32,
|
||||||
|
Delete = 64,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue