Skip to content

Commit e18ebf4

Browse files
committed
refactor: 重构 NotSupportFilter 组件
1 parent 7044c95 commit e18ebf4

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@namespace BootstrapBlazor.Components
22
@inherits FilterBase
33

4-
<div></div>
4+
<div>@NotSupportedMessage</div>

src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,34 @@
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
55

6+
using Microsoft.Extensions.Localization;
7+
68
namespace BootstrapBlazor.Components;
79

810
/// <summary>
911
/// NotSupportFilter component
1012
/// </summary>
1113
public partial class NotSupportFilter
1214
{
13-
private string? FilterRowClassString => CssBuilder.Default("filter-row")
14-
.AddClass("active", TableColumnFilter.HasFilter())
15-
.Build();
15+
[Inject]
16+
[NotNull]
17+
private IStringLocalizer<TableColumnFilter>? Localizer { get; set; }
18+
19+
/// <summary>
20+
/// 获得/设置 不支持过滤类型提示信息 默认 null 读取资源文件内容
21+
/// </summary>
22+
[Parameter]
23+
public string? NotSupportedMessage { get; set; }
24+
25+
/// <summary>
26+
/// <inheritdoc/>
27+
/// </summary>
28+
protected override void OnParametersSet()
29+
{
30+
base.OnParametersSet();
31+
32+
NotSupportedMessage ??= Localizer[nameof(NotSupportedMessage)];
33+
}
1634

1735
/// <summary>
1836
/// <inheritdoc/>
@@ -26,8 +44,8 @@ public override FilterKeyValueAction GetFilterConditions()
2644
/// <summary>
2745
/// <inheritdoc/>
2846
/// </summary>
29-
public override async Task SetFilterConditionsAsync(FilterKeyValueAction filter)
47+
public override void Reset()
3048
{
31-
await base.SetFilterConditionsAsync(filter);
49+
3250
}
3351
}

0 commit comments

Comments
 (0)