Moving on
This commit is contained in:
@ -1,12 +0,0 @@
|
||||
@inherits FileItemBase
|
||||
|
||||
<a class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-item">
|
||||
<p class="is-size-7"><sub>@File.Folder</sub></p>
|
||||
<p class="@(File.CanBeDeleted ? "has-text-danger" : null)">
|
||||
@File.Name
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
@ -1,16 +0,0 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Seenginx.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Seenginx.Components
|
||||
{
|
||||
public class FileItemBase : ComponentBase
|
||||
{
|
||||
[Parameter]
|
||||
public ConfigFile File { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
@typeparam CFile
|
||||
|
||||
<div class="filesWithEditor">
|
||||
|
||||
<div class="tile is-parent is-4 is-vertical">
|
||||
<div class="tile is-child">
|
||||
<div class="buttons are-small">
|
||||
<button class="button is-static is-outlined"><span class="icon is-small"><i class="mdi mdi-filter-outline"></i></span></button>
|
||||
@foreach (var filter in Filters)
|
||||
{
|
||||
<button @onclick="e => OnFilterClick(e,filter)" class="button is-outlined">@filter</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile is-child">
|
||||
<div class="field">
|
||||
<p class="control has-icons-left">
|
||||
<input formnovalidate value="@SearchInput" @onchange="e => SearchInputChanged(e)" class="input is-small is-primary" type="text" placeholder="Search...">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="mdi mdi-search-web"></i>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile is-child is-vertical">
|
||||
<aside class="menu">
|
||||
<ul class="menu-list">
|
||||
@foreach (var file in Files)
|
||||
{
|
||||
<li @onclick="e => OnFileClick(e,file)" @key="file" class="@file.IsVisible">
|
||||
<FileItem File="file" @key="file"></FileItem>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
<div class="tile is-child">
|
||||
<div class="buttons are-small is-centered has-addons">
|
||||
<button class="button is-primary" @onclick="OnAddDialog">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-plus-box-outline"></i>
|
||||
</span>
|
||||
<span>Add</span>
|
||||
</button>
|
||||
<button class="button is-warning" @onclick="OnUpdateDialog">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-pencil-box-outline"></i>
|
||||
</span>
|
||||
<span>Update</span>
|
||||
</button>
|
||||
<button class="button is-danger" @onclick="OnDeleteDialog">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-minus-box-outline"></i>
|
||||
</span>
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tile is-parent is-vertical is-8">
|
||||
@Editor
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -1,101 +0,0 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Seenginx.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Seenginx.Components
|
||||
{
|
||||
public partial class FilesWithEditor<CFile> : ComponentBase
|
||||
where CFile : ConfigFile
|
||||
{
|
||||
[Parameter]
|
||||
public List<CFile> Files { get; set; } = new List<CFile>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> Filters { get; set; } = new List<string>();
|
||||
[Parameter]
|
||||
public List<int> FilteredOutFiles { get; set; } = new List<int>();
|
||||
[Parameter]
|
||||
public EventCallback<string> ApplyFilter { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback AddFile { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<CFile> UpdateFile { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<CFile> DeleteFile { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> Editor { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> CreateDialog { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> UpdateDialog { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> DeleteDialog { get; set; }
|
||||
|
||||
protected bool IsAnyFileSelected => SelectedFile != default;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<CFile> SelectedFileChanged { get; set; }
|
||||
[Parameter]
|
||||
public CFile SelectedFile { get; set; }
|
||||
|
||||
protected string SearchInput { get; set; } = string.Empty;
|
||||
|
||||
protected async Task OnDeselectClick()
|
||||
{
|
||||
SelectedFile = null;
|
||||
await SelectedFileChanged.InvokeAsync(SelectedFile);
|
||||
}
|
||||
|
||||
protected async Task OnFilterClick(MouseEventArgs e, string filter)
|
||||
{
|
||||
await ApplyFilter.InvokeAsync(filter);
|
||||
//for (int index = 0; index < Files.Count; index++)
|
||||
// if (FilteredOutFiles.Contains(index))
|
||||
// Files[index].Hide();
|
||||
// else
|
||||
// Files[index].Unhide();
|
||||
}
|
||||
|
||||
protected async Task SearchInputChanged(ChangeEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SearchInput))
|
||||
Files.ForEach(f => f.Unhide());
|
||||
else
|
||||
Files.ForEach(f =>
|
||||
{
|
||||
if (f.Name.ToLower().Contains(SearchInput.ToLower()))
|
||||
f.Unhide();
|
||||
else
|
||||
f.Hide();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task OnFileClick(MouseEventArgs e, CFile file)
|
||||
{
|
||||
await SelectedFileChanged.InvokeAsync(file);
|
||||
}
|
||||
|
||||
protected async Task OnAddDialog()
|
||||
{
|
||||
await AddFile.InvokeAsync(null);
|
||||
}
|
||||
protected async Task OnUpdateDialog()
|
||||
{
|
||||
await UpdateFile.InvokeAsync(SelectedFile);
|
||||
}
|
||||
protected async Task OnDeleteDialog()
|
||||
{
|
||||
await UpdateFile.InvokeAsync(SelectedFile);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user