2020-06-13 00:47:00 +08:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
|
using OneOf;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign
|
|
|
|
|
{
|
|
|
|
|
public partial class PageHeader
|
|
|
|
|
{
|
|
|
|
|
#region Parameters
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool Ghost { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-09-16 13:58:16 +08:00
|
|
|
|
public OneOf<bool?, string> BackIcon { get; set; }
|
2020-06-13 00:47:00 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-09-16 13:58:16 +08:00
|
|
|
|
public RenderFragment BackIconTemplate { get; set; }
|
2020-06-13 00:47:00 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-09-16 13:58:16 +08:00
|
|
|
|
public string Title { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment TitleTemplate { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string Subtitle { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment SubtitleTemplate { get; set; }
|
2020-06-13 00:47:00 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback OnBack { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderContent { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderFooter { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderBreadcrumb { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderAvatar { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderTitle { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderSubtitle { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderTags { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment PageHeaderExtra { get; set; }
|
|
|
|
|
|
|
|
|
|
#endregion Parameters
|
|
|
|
|
|
|
|
|
|
private void SetClassMap()
|
|
|
|
|
{
|
2021-03-12 17:02:11 +08:00
|
|
|
|
ClassMapper
|
|
|
|
|
.Add("ant-page-header")
|
2020-06-13 00:47:00 +08:00
|
|
|
|
.If("has-footer", () => PageHeaderFooter != null)
|
|
|
|
|
.If("ant-page-header-ghost", () => this.Ghost)
|
2021-03-12 17:02:11 +08:00
|
|
|
|
.If("has-breadcrumb", () => PageHeaderBreadcrumb != null)
|
|
|
|
|
.If("ant-page-header-rtl", () => RTL);
|
2020-06-13 00:47:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
SetClassMap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void OnBackClick(MouseEventArgs eventArgs)
|
|
|
|
|
{
|
|
|
|
|
if (OnBack.HasDelegate)
|
|
|
|
|
{
|
|
|
|
|
await OnBack.InvokeAsync(eventArgs);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await JsInvokeAsync("history.back");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|