2020-04-20 10:03:32 +08:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using OneOf;
|
|
|
|
|
|
2020-05-29 00:33:49 +08:00
|
|
|
|
namespace AntDesign
|
2020-04-20 10:03:32 +08:00
|
|
|
|
{
|
2020-05-18 14:46:42 +08:00
|
|
|
|
public partial class Empty : AntDomComponentBase
|
2020-04-20 10:03:32 +08:00
|
|
|
|
{
|
2020-05-26 15:21:47 +08:00
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public string PrefixCls { get; set; } = "ant-empty";
|
|
|
|
|
|
2020-04-20 10:03:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// "ltr"|"rtl"
|
|
|
|
|
/// </summary>
|
2020-05-26 15:21:47 +08:00
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public string Direction { get; set; } = "ltr";
|
|
|
|
|
|
2020-05-26 15:21:47 +08:00
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public string ImageStyle { get; set; }
|
|
|
|
|
|
2020-05-26 15:21:47 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public bool Small { get; set; }
|
|
|
|
|
|
2020-06-02 19:15:15 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public bool Simple { get; set; }
|
|
|
|
|
|
2020-05-26 15:21:47 +08:00
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public RenderFragment ChildContent { get; set; }
|
2020-04-20 10:03:32 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public OneOf<string, bool, RenderFragment> Description { get; set; } = "暂无数据";
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-05-18 14:46:42 +08:00
|
|
|
|
public OneOf<string, RenderFragment> Image { get; set; } = Empty.PRESENTED_IMAGE_DEFAULT;
|
2020-04-20 10:03:32 +08:00
|
|
|
|
|
|
|
|
|
protected void SetClass()
|
|
|
|
|
{
|
|
|
|
|
this.ClassMapper.Clear()
|
|
|
|
|
.Add(PrefixCls)
|
2020-05-18 14:46:42 +08:00
|
|
|
|
.If($"{PrefixCls}-normal", () => Image.IsT1 && Image.AsT1 == Empty.PRESENTED_IMAGE_SIMPLE)
|
2020-04-20 10:03:32 +08:00
|
|
|
|
.If($"{PrefixCls}-{Direction}", () => Direction.IsIn("ltr", "rlt"))
|
2020-05-26 15:21:47 +08:00
|
|
|
|
.If($"{PrefixCls}-small", () => Small)
|
|
|
|
|
;
|
2020-04-20 10:03:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
this.SetClass();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnParametersSet()
|
|
|
|
|
{
|
|
|
|
|
this.SetClass();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|