Skip to content

Commit c52eb14

Browse files
authored
Merge pull request #111 from ChiaraBm/main
Improved DataGrid and FileManager. Added ItemSource. Minor fixes. Added showcase pages for flyonui package
2 parents 95b8c68 + 9838f1f commit c52eb14

File tree

95 files changed

+3738
-1263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3738
-1263
lines changed

MoonCore/MoonCore.Blazor.FlyonUi.Test.Backend/Http/Controllers/QueryController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.AspNetCore.Mvc;
33
using Microsoft.EntityFrameworkCore;
44
using MoonCore.Blazor.FlyonUi.Test.Shared.Http.Responses;
5+
using MoonCore.Common;
56
using MoonCore.Models;
67

78
namespace MoonCore.Blazor.FlyonUi.Test.Backend.Http.Controllers;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace MoonCore.Blazor.FlyonUi.Test.Backend.Http.Controllers;
4+
5+
[ApiController]
6+
[Route("api/showcase")]
7+
public class ShowcaseController : Controller
8+
{
9+
private readonly string RootDirectory = Path.Combine(
10+
"..",
11+
"MoonCore.Blazor.FlyonUi.Test.Frontend",
12+
"UI",
13+
"Showcases"
14+
);
15+
16+
[HttpGet("{name}")]
17+
public async Task<ActionResult> GetAsync([FromRoute] string name)
18+
{
19+
var fullPath = Path.Combine(RootDirectory, $"{name}.razor");
20+
21+
if (!System.IO.File.Exists(fullPath))
22+
return Problem("No showcase with that name found", statusCode: 404);
23+
24+
var contentStream = System.IO.File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
25+
return File(contentStream, "text/plain");
26+
}
27+
}

MoonCore/MoonCore.Blazor.FlyonUi.Test.Frontend/MoonCore.Blazor.FlyonUi.Test.Frontend.csproj

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,21 @@
1717
<ProjectReference Include="..\MoonCore.Blazor.FlyonUi.Test.Shared\MoonCore.Blazor.FlyonUi.Test.Shared.csproj" />
1818
<ProjectReference Include="..\MoonCore.Blazor.FlyonUi\MoonCore.Blazor.FlyonUi.csproj" />
1919
</ItemGroup>
20-
21-
<ItemGroup>
22-
<_ContentIncludedByDefault Remove="wwwroot\css\app.css" />
23-
<_ContentIncludedByDefault Remove="UI\Components\Dg\Columns\PropertyColumn.razor" />
24-
<_ContentIncludedByDefault Remove="UI\Components\Dg\DataGrid.razor" />
25-
<_ContentIncludedByDefault Remove="UI\Components\ImprovedDg\Columns\ColumnBase.razor" />
26-
<_ContentIncludedByDefault Remove="UI\Components\ImprovedDg\Columns\PropertyColumn.razor" />
27-
<_ContentIncludedByDefault Remove="UI\Components\ImprovedDg\Columns\SelectColumn.razor" />
28-
<_ContentIncludedByDefault Remove="UI\Components\ImprovedDg\Columns\TemplateColumn.razor" />
29-
<_ContentIncludedByDefault Remove="UI\Components\ImprovedDg\DataGrid.razor" />
30-
<_ContentIncludedByDefault Remove="Layout\MainLayout.razor" />
31-
</ItemGroup>
32-
20+
3321
<ItemGroup>
3422
<AdditionalFiles Include="UI\Components\CustomModal.razor" />
3523
<AdditionalFiles Include="UI\Components\MultiLayerModal.razor" />
36-
<AdditionalFiles Include="UI\Pages\Auth\Testy.razor" />
3724
<AdditionalFiles Include="UI\Pages\Components\ContextMenuPage.razor" />
3825
<AdditionalFiles Include="UI\Pages\Components\Dropdowns.razor" />
3926
<AdditionalFiles Include="UI\Pages\Components\Index.razor" />
4027
<AdditionalFiles Include="UI\Pages\Components\LazyLoaders.razor" />
4128
<AdditionalFiles Include="UI\Pages\Components\TabsPage.razor" />
42-
<AdditionalFiles Include="UI\Pages\DataTables\Index.razor" />
43-
<AdditionalFiles Include="UI\Pages\DataTables\Loading.razor" />
44-
<AdditionalFiles Include="UI\Pages\DataTables\PaginationPage.razor" />
45-
<AdditionalFiles Include="UI\Pages\DataTables\SelectionPage.razor" />
4629
<AdditionalFiles Include="UI\Pages\Feedback\Index.razor" />
4730
<AdditionalFiles Include="UI\Pages\Feedback\Modals.razor" />
4831
<AdditionalFiles Include="UI\Pages\Feedback\Toasts.razor" />
4932
<AdditionalFiles Include="UI\Pages\Files\Editor.razor" />
5033
<AdditionalFiles Include="UI\Pages\Files\Index.razor" />
5134
<AdditionalFiles Include="UI\Pages\Files\ManagerPage.razor" />
52-
<AdditionalFiles Include="UI\Pages\Files\Transfer.razor" />
5335
<AdditionalFiles Include="UI\Pages\Forms\FormComponents.razor" />
5436
<AdditionalFiles Include="UI\Pages\Forms\Index.razor" />
5537
<AdditionalFiles Include="UI\Pages\Forms\SelectionPage.razor" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@inject IJSRuntime JsRuntime
2+
3+
<pre>
4+
<code class="language-razor rounded-lg">
5+
@Content
6+
</code>
7+
</pre>
8+
9+
@code
10+
{
11+
[Parameter] public string Content { get; set; }
12+
13+
protected override async Task OnAfterRenderAsync(bool firstRender)
14+
{
15+
if (!firstRender)
16+
return;
17+
18+
await JsRuntime.InvokeVoidAsync("hljs.highlightAll");
19+
}
20+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@using MoonCore.Blazor.FlyonUi.Components
2+
@using MoonCore.Helpers
3+
4+
@inject HttpApiClient ApiClient
5+
6+
<div class="flex justify-between gap-4">
7+
<div>
8+
<div class="text-lg font-semibold">@Title</div>
9+
<div class="text-base-content/80">@Description</div>
10+
</div>
11+
12+
<div>
13+
<div class="bg-base-200 rounded-field flex relative p-0.5">
14+
<div class="rounded-field bg-base-100 shadow-base-300/20 absolute h-8 w-20 shadow-sm transition-transform duration-300 ease-in-out @(ShowCode ? "translate-x-full" : "translate-x-0")"></div>
15+
<button @onclick="() => SetShowCodeAsync(false)" class="rounded-field text-base-content z-1 h-8 w-20">Preview</button>
16+
<button @onclick="() => SetShowCodeAsync(true)" class="rounded-field text-base-content z-1 h-8 w-20">Code</button>
17+
</div>
18+
</div>
19+
</div>
20+
21+
<div class="mt-5">
22+
@if (ShowCode)
23+
{
24+
<LazyLoader Load="LoadAsync">
25+
<Highlight Content="@Code" />
26+
</LazyLoader>
27+
}
28+
else
29+
{
30+
@ChildContent
31+
}
32+
</div>
33+
34+
@code
35+
{
36+
[Parameter] public RenderFragment ChildContent { get; set; }
37+
[Parameter] public string Source { get; set; }
38+
[Parameter] public string Title { get; set; }
39+
[Parameter] public string Description { get; set; }
40+
41+
private bool ShowCode = false;
42+
private string Code;
43+
44+
private async Task LoadAsync(LazyLoader _)
45+
{
46+
Code = await ApiClient.GetString($"api/showcase/{Source}");
47+
Code = Code.Replace("\n\r", "");
48+
}
49+
50+
private async Task SetShowCodeAsync(bool toggle)
51+
{
52+
ShowCode = toggle;
53+
await InvokeAsync(StateHasChanged);
54+
}
55+
}

MoonCore/MoonCore.Blazor.FlyonUi.Test.Frontend/UI/Layout/Layout2/AppSidebar.razor

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,38 +109,24 @@
109109
RequiresExactMatch = false
110110
},
111111
new()
112-
{
113-
Name = "Data Tables",
114-
Path = "/datatables",
115-
Icon = "icon-table-2",
116-
RequiresExactMatch = false
117-
},
118-
new()
119112
{
120113
Name = "Forms",
121114
Path = "/forms",
122-
Icon = "icon-letter-text",
123-
RequiresExactMatch = false
124-
},
125-
new()
126-
{
127-
Name = "Colors",
128-
Path = "/colors",
129-
Icon = "icon-palette",
115+
Icon = "icon-text-initial",
130116
RequiresExactMatch = false
131117
},
132118
new()
133119
{
134-
Name = "Auth",
135-
Path = "/auth",
136-
Icon = "icon-fingerprint",
120+
Name = "Files",
121+
Path = "/files",
122+
Icon = "icon-file-text",
137123
RequiresExactMatch = false
138124
},
139125
new()
140126
{
141-
Name = "Files",
142-
Path = "/files",
143-
Icon = "icon-file-text",
127+
Name = "DataGrids",
128+
Path = "/datagrids",
129+
Icon = "icon-table-2",
144130
RequiresExactMatch = false
145131
}
146132
};

MoonCore/MoonCore.Blazor.FlyonUi.Test.Frontend/UI/Layout/Layout2/MainLayout.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131
</div>
3232
</div>
3333
</nav>
34-
<div class="grow p-8">
34+
<div class="flex-1 min-h-0 p-8 overflow-y-auto">
3535
@Body
36+
37+
<ToastLauncher />
38+
<ModalLauncher />
39+
<DrawerLauncher />
40+
<DropHandler />
3641
</div>
3742
</div>
3843
</div>
3944

40-
<ToastLauncher />
41-
<ModalLauncher />
42-
<DrawerLauncher />
43-
<DropHandler />
44-
4545
@code
4646
{
4747
private async Task LaunchSidebarAsync()

MoonCore/MoonCore.Blazor.FlyonUi.Test.Frontend/UI/Pages/Auth/Testy.razor

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
11
@page "/components/contextmenu"
22

33
@using MoonCore.Blazor.FlyonUi.Components
4+
@using MoonCore.Blazor.FlyonUi.Test.Frontend.UI.Components
5+
@using MoonCore.Blazor.FlyonUi.Test.Frontend.UI.Showcases
46

57
<NavTabs Index="4" Names="UiConstants.ComponentNames" Links="UiConstants.ComponentLinks" Icons="UiConstants.ComponentIcons" />
68

7-
<ContextMenu @ref="Menu">
8-
<button type="button" class="dropdown-item">
9-
<i class="icon-cloud-download text-primary text-lg"></i>
10-
Download
11-
</button>
12-
<button type="button" class="dropdown-item">
13-
<i class="icon-folder-archive text-warning text-lg"></i>
14-
Archive
15-
</button>
16-
<button type="button" class="dropdown-item">
17-
<i class="icon-folder-pen text-accent text-lg"></i>
18-
Rename
19-
</button>
20-
<button type="button" class="dropdown-item">
21-
<i class="icon-trash-2 text-error text-lg"></i>
22-
Delete
23-
</button>
24-
</ContextMenu>
25-
26-
<div class="bg-base-200/50 h-64 w-64 flex justify-center items-center mt-5" @oncontextmenu="e => Menu.TriggerAsync(e)" @oncontextmenu:preventDefault>
27-
Right click me
9+
<div class="mt-8 mb-25">
10+
<div class="font-semibold text-2xl">Context Menu</div>
11+
<p class="mt-1 text-base-content/80 text-lg">
12+
Enhance interactivity and user experience on your site by implementing a context menu that offers users relevant actions and options through a right-click.
13+
</p>
2814
</div>
2915

30-
@code
31-
{
32-
private ContextMenu Menu;
33-
}
16+
<div class="my-20">
17+
<Showcase Source="@(nameof(ContextMenuSc))" Title="Context Menu" Description="Default context menu">
18+
<ContextMenuSc />
19+
</Showcase>
20+
</div>
Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
@page "/components/dropdowns"
2+
23
@using MoonCore.Blazor.FlyonUi.Components
4+
@using MoonCore.Blazor.FlyonUi.Test.Frontend.UI.Components
5+
@using MoonCore.Blazor.FlyonUi.Test.Frontend.UI.Showcases
36

47
<NavTabs Index="3" Names="UiConstants.ComponentNames" Links="UiConstants.ComponentLinks" Icons="UiConstants.ComponentIcons" />
58

6-
<div class="mt-5">
7-
<Dropdown>
8-
<Activator>
9-
<div class="dropdown-toggle btn btn-primary" aria-haspopup="menu" aria-expanded="false" aria-label="Dropdown">
10-
Dropdown
11-
<span class="icon-chevron-down dropdown-open:rotate-180 size-4"></span>
12-
</div>
13-
</Activator>
14-
<Content>
15-
<ul>
16-
<li><a class="dropdown-item" href="#">My Profile</a></li>
17-
<li><a class="dropdown-item" href="#">Settings</a></li>
18-
<li><a class="dropdown-item" href="#">Billing</a></li>
19-
<li><a class="dropdown-item" href="#">FAQs</a></li>
20-
</ul>
21-
</Content>
22-
</Dropdown>
9+
<div class="mt-8 mb-25">
10+
<div class="font-semibold text-2xl">Dropdowns</div>
11+
<p class="mt-1 text-base-content/80 text-lg">
12+
The Dropdown neatly displays Dropdown or content without using the FlyonUI JavaScript plugin, offering a compact interface for easy navigation and space-saving.
13+
</p>
2314
</div>
2415

25-
@code
26-
{
27-
28-
}
16+
<div class="my-20">
17+
<Showcase Source="@(nameof(DropdownSc))" Title="Dropdown" Description="Default dropdown">
18+
<DropdownSc />
19+
</Showcase>
20+
</div>

0 commit comments

Comments
 (0)