mirror of https://github.com/abpframework/abp.git
6 changed files with 188 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||
using Volo.Abp.AspNetCore.Components.Web.Theming; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.MudBlazorUI; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpAspNetCoreComponentsWebThemingModule), |
|||
typeof(AbpMudBlazorUIModule) |
|||
)] |
|||
public class AbpAspNetCoreComponentsWebThemingMudBlazorModule : AbpModule |
|||
{ |
|||
} |
|||
|
|||
@ -0,0 +1,82 @@ |
|||
@using Microsoft.AspNetCore.Components.Web |
|||
@using Microsoft.Extensions.Options |
|||
@using Volo.Abp.Ui.Branding |
|||
@inject IOptions<PageHeaderOptions> Options |
|||
@inject IBrandingProvider BrandingProvider |
|||
@inject PageLayout PageLayout |
|||
|
|||
<MudGrid Class="entry-row"> |
|||
@if (PageLayout.Title.IsNullOrEmpty()) |
|||
{ |
|||
<PageTitle>@BrandingProvider.AppName</PageTitle> |
|||
} |
|||
else |
|||
{ |
|||
<PageTitle>@PageLayout.Title | @BrandingProvider.AppName</PageTitle> |
|||
} |
|||
|
|||
@if (Options.Value.RenderPageTitle) |
|||
{ |
|||
<MudItem xs="12" sm="6"> |
|||
<MudText Typo="Typo.h4" Class="content-header-title"> |
|||
@PageLayout.Title |
|||
</MudText> |
|||
</MudItem> |
|||
} |
|||
|
|||
@if (Options.Value.RenderBreadcrumbs && PageLayout.BreadcrumbItems.Any()) |
|||
{ |
|||
<MudItem xs="12" sm="6"> |
|||
<MudBreadcrumbs MaxItems="4"> |
|||
@if (BreadcrumbShowHome) |
|||
{ |
|||
<MudBreadcrumbItem Href="/"> |
|||
<MudIcon Icon="@Icons.Material.Filled.Home" /> |
|||
</MudBreadcrumbItem> |
|||
} |
|||
@foreach (var item in PageLayout.BreadcrumbItems) |
|||
{ |
|||
<MudBreadcrumbItem Href="@item.Url"> |
|||
@item.Text |
|||
</MudBreadcrumbItem> |
|||
} |
|||
</MudBreadcrumbs> |
|||
</MudItem> |
|||
} |
|||
|
|||
@if (Options.Value.RenderToolbar) |
|||
{ |
|||
<MudItem xs="12"> |
|||
<MudStack Row="true" Justify="Justify.FlexEnd" Spacing="1"> |
|||
@if (Toolbar == null) |
|||
{ |
|||
@ChildContent |
|||
} |
|||
|
|||
@foreach (var toolbarItemRender in ToolbarItemRenders) |
|||
{ |
|||
<MudStackItem> |
|||
@toolbarItemRender |
|||
</MudStackItem> |
|||
} |
|||
</MudStack> |
|||
</MudItem> |
|||
} |
|||
</MudGrid> |
|||
|
|||
@code { |
|||
[Parameter] |
|||
public bool BreadcrumbShowHome { get; set; } = true; |
|||
|
|||
[Parameter] |
|||
public bool BreadcrumbShowCurrent { get; set; } = true; |
|||
|
|||
[Parameter] |
|||
public RenderFragment ChildContent { get; set; } = default!; |
|||
|
|||
[Parameter] |
|||
public PageToolbar? Toolbar { get; set; } |
|||
|
|||
protected List<RenderFragment> ToolbarItemRenders { get; } = new(); |
|||
} |
|||
|
|||
@ -0,0 +1,34 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.AspNetCore.Components.Web.Theming.PageToolbars; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.PageToolbars; |
|||
|
|||
public static class MudBlazorPageToolbarExtensions |
|||
{ |
|||
public static PageToolbar AddMudButton( |
|||
this PageToolbar toolbar, |
|||
string text, |
|||
Func<Task> clicked, |
|||
object? icon = null, |
|||
int order = 0, |
|||
string? requiredPolicyName = null) |
|||
{ |
|||
toolbar.AddComponent( |
|||
typeof(MudPageToolbarButton), |
|||
new Dictionary<string, object?> |
|||
{ |
|||
{ nameof(MudPageToolbarButton.Text), text }, |
|||
{ nameof(MudPageToolbarButton.Disabled), false }, |
|||
{ nameof(MudPageToolbarButton.Icon), icon }, |
|||
{ nameof(MudPageToolbarButton.Clicked), clicked } |
|||
}, |
|||
order, |
|||
requiredPolicyName |
|||
); |
|||
|
|||
return toolbar; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,35 @@ |
|||
@using MudBlazor |
|||
|
|||
<MudButton Variant="Variant.Filled" |
|||
Color="Color.Primary" |
|||
Disabled="Disabled" |
|||
OnClick="@OnClickAsync"> |
|||
@if (Icon is string iconString && !string.IsNullOrWhiteSpace(iconString)) |
|||
{ |
|||
<MudIcon Icon="@iconString" Class="me-1" /> |
|||
} |
|||
@Text |
|||
</MudButton> |
|||
|
|||
@code { |
|||
[Parameter] |
|||
public string Text { get; set; } = string.Empty; |
|||
|
|||
[Parameter] |
|||
public bool Disabled { get; set; } |
|||
|
|||
[Parameter] |
|||
public object? Icon { get; set; } |
|||
|
|||
[Parameter] |
|||
public Func<Task>? Clicked { get; set; } |
|||
|
|||
private async Task OnClickAsync() |
|||
{ |
|||
if (Clicked != null && !Disabled) |
|||
{ |
|||
await Clicked.Invoke(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Razor"> |
|||
|
|||
<Import Project="..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net10.0</TargetFramework> |
|||
<Nullable>enable</Nullable> |
|||
<WarningsAsErrors>Nullable</WarningsAsErrors> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" /> |
|||
<ProjectReference Include="..\Volo.Abp.MudBlazorUI\Volo.Abp.MudBlazorUI.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
|
|||
@ -0,0 +1,5 @@ |
|||
@using MudBlazor |
|||
@using Volo.Abp.AspNetCore.Components.Web.Theming |
|||
@using Volo.Abp.AspNetCore.Components.Web.Theming.Layout |
|||
@using Volo.Abp.AspNetCore.Components.Web.Theming.PageToolbars |
|||
|
|||
Loading…
Reference in new issue