!1694 fix(#I44GIG): table filter support double and decimal data type

* chore: bump version to 5.5.2
* fix: NumberFilter 更改为泛型支持多种数据类型
This commit is contained in:
Argo 2021-08-09 04:53:45 +00:00
parent ac91d53091
commit 12066f50fe
4 changed files with 12 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup> <PropertyGroup>
<Version>5.5.2-beta01</Version> <Version>5.5.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'"> <ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

View File

@ -1,4 +1,5 @@
@namespace BootstrapBlazor.Components @namespace BootstrapBlazor.Components
@typeparam TValue
@inherits FilterBase @inherits FilterBase
@if (IsHeaderRow) @if (IsHeaderRow)

View File

@ -12,13 +12,13 @@ namespace BootstrapBlazor.Components
/// <summary> /// <summary>
/// 数字类型过滤条件 /// 数字类型过滤条件
/// </summary> /// </summary>
public partial class NumberFilter public partial class NumberFilter<TValue>
{ {
private int? Value1 { get; set; } private TValue? Value1 { get; set; }
private FilterAction Action1 { get; set; } = FilterAction.GreaterThanOrEqual; private FilterAction Action1 { get; set; } = FilterAction.GreaterThanOrEqual;
private int? Value2 { get; set; } private TValue? Value2 { get; set; }
private FilterAction Action2 { get; set; } = FilterAction.LessThanOrEqual; private FilterAction Action2 { get; set; } = FilterAction.LessThanOrEqual;
@ -52,8 +52,8 @@ namespace BootstrapBlazor.Components
/// </summary> /// </summary>
public override void Reset() public override void Reset()
{ {
Value1 = null; Value1 = default;
Value2 = null; Value2 = default;
Action1 = FilterAction.GreaterThanOrEqual; Action1 = FilterAction.GreaterThanOrEqual;
Action2 = FilterAction.LessThanOrEqual; Action2 = FilterAction.LessThanOrEqual;
Count = 0; Count = 0;

View File

@ -56,9 +56,13 @@ else
<DateTimeFilter Count="Count" /> <DateTimeFilter Count="Count" />
break; break;
case nameof(Int32): case nameof(Int32):
<NumberFilter TValue="int" Count="Count" />
break;
case nameof(Double): case nameof(Double):
<NumberFilter TValue="double" Count="Count" />
break;
case nameof(Decimal): case nameof(Decimal):
<NumberFilter Count="Count" /> <NumberFilter TValue="Decimal" Count="Count" />
break; break;
case nameof(String): case nameof(String):
<StringFilter Count="Count" /> <StringFilter Count="Count" />