Use flags to dictate which features a file manager has
parent
c12b834571
commit
acddc47a89
|
@ -5,26 +5,44 @@
|
|||
<div class="file-manager">
|
||||
<GridRow Class="file-manager-nav">
|
||||
<Space>
|
||||
@if (Features.HasFlag(FileManagerFeatures.NavigationBack))
|
||||
{
|
||||
<SpaceItem>
|
||||
<Tooltip Title="Back" MouseEnterDelay="2">
|
||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowLeft" OnClick="NavigateBack" Disabled="@(Past.Count == 0)" />
|
||||
</Tooltip>
|
||||
</SpaceItem>
|
||||
}
|
||||
|
||||
@if (Features.HasFlag(FileManagerFeatures.NavigationForward))
|
||||
{
|
||||
<SpaceItem>
|
||||
<Tooltip Title="Forward" MouseEnterDelay="2">
|
||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowRight" OnClick="NavigateForward" Disabled="@(Future.Count == 0)" />
|
||||
</Tooltip>
|
||||
</SpaceItem>
|
||||
}
|
||||
|
||||
@if (Features.HasFlag(FileManagerFeatures.UpALevel))
|
||||
{
|
||||
<SpaceItem>
|
||||
<Tooltip Title="Up a Level" MouseEnterDelay="2">
|
||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.ArrowUp" OnClick="NavigateUp" Disabled="@(Path.Parent == null)" />
|
||||
</Tooltip>
|
||||
</SpaceItem>
|
||||
}
|
||||
|
||||
@if (Features.HasFlag(FileManagerFeatures.Refresh))
|
||||
{
|
||||
<SpaceItem>
|
||||
<Tooltip Title="Refresh" MouseEnterDelay="2">
|
||||
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Reload" OnClick="Refresh" />
|
||||
</Tooltip>
|
||||
</SpaceItem>
|
||||
}
|
||||
|
||||
@if (Features.HasFlag(FileManagerFeatures.Breadcrumbs))
|
||||
{
|
||||
<SpaceItem Class="file-manager-nav-breadcrumbs">
|
||||
<Breadcrumb>
|
||||
@foreach (var breadcrumb in Breadcrumbs)
|
||||
|
@ -33,16 +51,28 @@
|
|||
}
|
||||
</Breadcrumb>
|
||||
</SpaceItem>
|
||||
}
|
||||
|
||||
@if (Features.HasFlag(FileManagerFeatures.NewFolder))
|
||||
{
|
||||
<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">
|
||||
|
@ -55,6 +85,7 @@
|
|||
</Popconfirm>
|
||||
</Tooltip>
|
||||
</SpaceItem>
|
||||
}
|
||||
</Space>
|
||||
</GridRow>
|
||||
|
||||
|
@ -124,6 +155,7 @@
|
|||
[Parameter] public Guid ArchiveId { get; set; }
|
||||
[Parameter] public string WorkingDirectory { get; set; }
|
||||
[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 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