2020-06-09 23:47:50 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using OneOf;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign
|
|
|
|
|
{
|
2020-09-16 13:58:16 +08:00
|
|
|
|
public abstract class StatisticComponentBase<T> : AntDomComponentBase
|
2020-06-09 23:47:50 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置数值的前缀
|
|
|
|
|
/// </summary>
|
2020-09-16 13:58:16 +08:00
|
|
|
|
[Parameter] public string Prefix { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter] public RenderFragment PrefixTemplate { get; set; }
|
2020-06-09 23:47:50 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置数值的后缀
|
|
|
|
|
/// </summary>
|
2020-09-16 13:58:16 +08:00
|
|
|
|
[Parameter] public string Suffix { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter] public RenderFragment SuffixTemplate { get; set; }
|
2020-06-09 23:47:50 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 数值的标题
|
|
|
|
|
/// </summary>
|
2020-09-16 13:58:16 +08:00
|
|
|
|
[Parameter] public string Title { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter] public RenderFragment TitleTemplate { get; set; }
|
2020-06-09 23:47:50 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 数值内容
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Parameter] public T Value { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置数值的样式
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Parameter] public string ValueStyle { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter] public RenderFragment ChildContent { get; set; }
|
2020-09-20 11:45:58 +08:00
|
|
|
|
|
|
|
|
|
private void SetClassMap()
|
|
|
|
|
{
|
|
|
|
|
string prefixName = "ant-statistic";
|
2021-03-12 17:02:11 +08:00
|
|
|
|
ClassMapper
|
|
|
|
|
.Add(prefixName)
|
|
|
|
|
.If($"{prefixName}-rtl", () => RTL);
|
2020-09-20 11:45:58 +08:00
|
|
|
|
}
|
2021-03-12 17:02:11 +08:00
|
|
|
|
|
2020-09-20 11:45:58 +08:00
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
|
|
|
|
|
SetClassMap();
|
|
|
|
|
}
|
2020-06-09 23:47:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|