2019-12-17 14:39:23 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
2020-05-16 23:27:40 +08:00
|
|
|
|
using OneOf;
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
namespace AntBlazor
|
|
|
|
|
{
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public partial class AntCard : AntDomComponentBase
|
2019-12-17 14:39:23 +08:00
|
|
|
|
{
|
2019-12-17 17:53:25 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
|
|
2019-12-17 14:39:23 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment Body { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public bool Bordered { get; set; } = false;
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public bool Hoverable { get; set; } = false;
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public bool Loading { get; set; } = false;
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public string BodyStyle { get; set; }
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment Cover { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public IList<RenderFragment> Actions { get; set; } = new List<RenderFragment>();
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public string Type { get; set; }
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-04-23 17:13:56 +08:00
|
|
|
|
public string Size { get; set; }
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-05-16 23:27:40 +08:00
|
|
|
|
public OneOf<string, RenderFragment> Title { get; set; }
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment Extra { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment AntCardTab { get; set; }
|
|
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
|
internal IList<AntCardGrid> Grids { get; set; } = new List<AntCardGrid>();
|
2019-12-17 14:39:23 +08:00
|
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
|
protected void SetClassMap()
|
2019-12-17 14:39:23 +08:00
|
|
|
|
{
|
|
|
|
|
this.ClassMapper.Clear()
|
|
|
|
|
.Add("ant-card")
|
2020-04-23 17:13:56 +08:00
|
|
|
|
.If("ant-card-loading", () => Loading)
|
|
|
|
|
.If("ant-card-bordered", () => Bordered)
|
|
|
|
|
.If("ant-card-hoverable", () => Hoverable)
|
|
|
|
|
.If("ant-card-small", () => Size == "small")
|
|
|
|
|
.If("ant-card-contain-grid", () => Grids.Count > 0)
|
|
|
|
|
.If("ant-card-type-inner", () => Type == "inner")
|
2019-12-17 14:39:23 +08:00
|
|
|
|
.If("ant-card-contain-tabs", () => AntCardTab != null)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
2020-04-23 17:13:56 +08:00
|
|
|
|
SetClassMap();
|
2019-12-17 14:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-23 17:13:56 +08:00
|
|
|
|
}
|