-
-
Notifications
You must be signed in to change notification settings - Fork 363
bug(Table): unsupported filter data type cause filter icon misalignment #6298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7044c95
wip: 临时提交
ArgoZhang afad690
chore: bump version 9.8.0-beta03
ArgoZhang e18ebf4
refactor: 重构 NotSupportFilter 组件
ArgoZhang 1b446f6
refactor: 重构 TableColumnFilter 组件
ArgoZhang 9352db0
Merge remote-tracking branch 'gitee.com/feat-table-filter' into fix-t…
ArgoZhang 2818a4c
refactor: 增加搜索重置按钮样式
ArgoZhang f0baef3
test: 更新单元测试
ArgoZhang 8a3e12a
Merge branch 'main' into fix-table-filter
ArgoZhang 7a707a7
test: 更新单元测试
ArgoZhang b086afd
refactor: 使用基类本地化服务
ArgoZhang 2cb6b62
test: 补充单元测试
ArgoZhang fccf630
test: 更新单元测试
ArgoZhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| @namespace BootstrapBlazor.Components | ||
| @inherits FilterBase | ||
|
|
||
| <div>@NotSupportedMessage</div> |
45 changes: 45 additions & 0 deletions
45
src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
| // See the LICENSE file in the project root for more information. | ||
| // Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone | ||
|
|
||
| namespace BootstrapBlazor.Components; | ||
|
|
||
| /// <summary> | ||
| /// NotSupportFilter component | ||
| /// </summary> | ||
| public partial class NotSupportFilter | ||
| { | ||
| /// <summary> | ||
| /// 获得/设置 不支持过滤类型提示信息 默认 null 读取资源文件内容 | ||
| /// </summary> | ||
| [Parameter] | ||
| public string? NotSupportedMessage { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// <inheritdoc/> | ||
| /// </summary> | ||
| protected override void OnParametersSet() | ||
| { | ||
| base.OnParametersSet(); | ||
|
|
||
| NotSupportedMessage ??= Localizer[nameof(NotSupportedMessage)]; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// <inheritdoc/> | ||
| /// </summary> | ||
| /// <returns></returns> | ||
| public override FilterKeyValueAction GetFilterConditions() | ||
| { | ||
| return new(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// <inheritdoc/> | ||
| /// </summary> | ||
| public override void Reset() | ||
| { | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
| // See the LICENSE file in the project root for more information. | ||
| // Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone | ||
|
|
||
| namespace UnitTest.Components; | ||
|
|
||
| public class TableNotSupportFilterTest : BootstrapBlazorTestBase | ||
| { | ||
| [Fact] | ||
| public void OnFilterAsync_Ok() | ||
| { | ||
| var cut = Context.RenderComponent<TableColumnFilter>(pb => | ||
| { | ||
| pb.Add(a => a.Table, new MockTable()); | ||
| pb.Add(a => a.Column, new MockColumn()); | ||
| }); | ||
|
|
||
| cut.Contains("不支持的类型,请使用 FilterTemplate 自定义过滤组件"); | ||
|
|
||
| var filter = cut.FindComponent<NotSupportFilter>(); | ||
| var conditions = filter.Instance.GetFilterConditions(); | ||
| Assert.Empty(conditions.Filters); | ||
|
|
||
| filter.Instance.Reset(); | ||
| } | ||
|
|
||
| class MockTable : ITable | ||
| { | ||
| public Dictionary<string, IFilterAction> Filters { get; set; } = []; | ||
|
|
||
| public Func<Task>? OnFilterAsync { get; set; } | ||
|
|
||
| public List<ITableColumn> Columns => []; | ||
|
|
||
| public IEnumerable<ITableColumn> GetVisibleColumns() => Columns; | ||
| } | ||
|
|
||
| class MockColumn : TableColumn<Foo, List<string>> | ||
| { | ||
| public MockColumn() | ||
| { | ||
| PropertyType = typeof(List<string>); | ||
| FieldName = "Double"; | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.