mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-02 03:57:38 +08:00
feat(module: statistic): add CultureInfo to support localization number format (#3299)
This commit is contained in:
parent
1f0cbe0985
commit
0a6d75a14b
@ -7,12 +7,22 @@ namespace AntDesign
|
||||
{
|
||||
public partial class Statistic<TValue> : StatisticComponentBase<TValue>
|
||||
{
|
||||
[Parameter] public string DecimalSeparator { get; set; } = ".";
|
||||
[Parameter] public string DecimalSeparator { get; set; }
|
||||
|
||||
[Parameter] public string GroupSeparator { get; set; } = ",";
|
||||
[Parameter] public string GroupSeparator { get; set; }
|
||||
|
||||
[Parameter] public int Precision { get; set; }
|
||||
|
||||
[Parameter] public CultureInfo CultureInfo { get; set; } = LocaleProvider.CurrentLocale.CurrentCulture;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
DecimalSeparator ??= CultureInfo.NumberFormat.NumberDecimalSeparator;
|
||||
GroupSeparator ??= CultureInfo.NumberFormat.NumberGroupSeparator;
|
||||
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
private (string integerPart, string fractionalPart) SeparateDecimal()
|
||||
{
|
||||
decimal decimalValue;
|
||||
|
@ -18,24 +18,25 @@ Display statistic number.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| ---------------- | ----------------------------- | -------------------- | ------- | ------- |
|
||||
| decimalSeparator | decimal separator | string | . | |
|
||||
| formatter | customize value display logic | (value) => ReactNode | - | |
|
||||
| groupSeparator | group separator | string | , | |
|
||||
| precision | precision of input value | number | - | |
|
||||
| prefix | prefix node of value | string \| ReactNode | - | |
|
||||
| suffix | suffix node of value | string \| ReactNode | - | |
|
||||
| title | Display title | string \| ReactNode | - | |
|
||||
| value | Display value | string \| number | - | |
|
||||
| valueStyle | Set value css style | CSSProperties | - | |
|
||||
| CultureInfo | culture info for the number format | CultureInfo | CurrentCultureInfo | |
|
||||
| DecimalSeparator | decimal separator | string | . | |
|
||||
| Formatter | customize value display logic | (value) => ReactNode | - | |
|
||||
| GroupSeparator | group separator | string | , | |
|
||||
| Precision | precision of input value | number | - | |
|
||||
| Prefix | prefix node of value | string \| ReactNode | - | |
|
||||
| Suffix | suffix node of value | string \| ReactNode | - | |
|
||||
| Title | Display title | string \| ReactNode | - | |
|
||||
| Value | Display value | string \| number | - | |
|
||||
| ValueStyle | Set value css style | CSSProperties | - | |
|
||||
|
||||
#### Statistic.Countdown
|
||||
#### Countdown
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| format | Format as [moment](http://momentjs.com/) | string | 'HH:mm:ss' | |
|
||||
| onFinish | Trigger when time's up | () => void | - | |
|
||||
| prefix | prefix node of value | string \| ReactNode | - | |
|
||||
| suffix | suffix node of value | string \| ReactNode | - | |
|
||||
| title | Display title | string \| ReactNode | - | |
|
||||
| value | Set target countdown time | number \| moment | - | |
|
||||
| valueStyle | Set value css style | CSSProperties | - | |
|
||||
| Format | Format as [TimeSpan](https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/custom-timespan-format-strings?WT.mc_id=DT-MVP-5003987) | string | @"hh\:mm\:ss" | |
|
||||
| OnFinish | Trigger when time's up | () => void | - | |
|
||||
| Prefix | prefix node of value | string \| ReactNode | - | |
|
||||
| Suffix | suffix node of value | string \| ReactNode | - | |
|
||||
| Title | Display title | string \| ReactNode | - | |
|
||||
| Value | Set target countdown time | number \| moment | - | |
|
||||
| ValueStyle | Set value css style | CSSProperties | - | |
|
||||
|
@ -19,23 +19,24 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/rcBNhLBrKbE/Statistic.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| ---------------- | ---------------- | ---------------------------- | ------ | ---- |
|
||||
| decimalSeparator | 设置小数点 | string | . | |
|
||||
| groupSeparator | 设置千分位标识符 | string | , | |
|
||||
| precision | 数值精度 | int | - | |
|
||||
| prefix | 设置数值的前缀 | string\|RenderFragment | - | |
|
||||
| suffix | 设置数值的后缀 | string\|RenderFragment | - | |
|
||||
| title | 数值的标题 | string\|RenderFragment | - | |
|
||||
| value | 数值内容 | decimal\|Datetime\|TimeSpan | - | |
|
||||
| valueStyle | 设置数值的样式 | string | - | |
|
||||
| CultureInfo | 用来获取数字格式的 CultureInfo 类 | CultureInfo | CurrentCultureInfo | |
|
||||
| DecimalSeparator | 设置小数点 | string | . | |
|
||||
| GroupSeparator | 设置千分位标识符 | string | , | |
|
||||
| Precision | 数值精度 | int | - | |
|
||||
| Prefix | 设置数值的前缀 | string\|RenderFragment | - | |
|
||||
| Suffix | 设置数值的后缀 | string\|RenderFragment | - | |
|
||||
| Title | 数值的标题 | string\|RenderFragment | - | |
|
||||
| Value | 数值内容 | decimal\|Datetime\|TimeSpan | - | |
|
||||
| ValueStyle | 设置数值的样式 | string | - | |
|
||||
|
||||
#### Statistic.Countdown
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| format | 格式化倒计时展示,参考 [TimeSpan](https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/custom-timespan-format-strings?WT.mc_id=DT-MVP-5003987) | string | @"hh\:mm\:ss" | |
|
||||
| onFinish | 倒计时完成时触发 | () => void | - | |
|
||||
| prefix | 设置数值的前缀 | string \| RenderFragment | - | |
|
||||
| suffix | 设置数值的后缀 | string \| RenderFragment | - | |
|
||||
| title | 数值的标题 | string \| RenderFragment | - | |
|
||||
| value | 数值内容 | Datetime \| TimeSpan | - | |
|
||||
| valueStyle | 设置数值的样式 | string | - | |
|
||||
| Format | 格式化倒计时展示,参考 [TimeSpan](https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/custom-timespan-format-strings?WT.mc_id=DT-MVP-5003987) | string | @"hh\:mm\:ss" | |
|
||||
| OnFinish | 倒计时完成时触发 | () => void | - | |
|
||||
| Prefix | 设置数值的前缀 | string \| RenderFragment | - | |
|
||||
| Suffix | 设置数值的后缀 | string \| RenderFragment | - | |
|
||||
| Title | 数值的标题 | string \| RenderFragment | - | |
|
||||
| Value | 数值内容 | Datetime \| TimeSpan | - | |
|
||||
| ValueStyle | 设置数值的样式 | string | - | |
|
||||
|
Loading…
Reference in New Issue
Block a user