-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(Table): multiple select column adapts to compact mode #7068
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
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
43aaa91
refactor: 更新代码减少提示信息
ArgoZhang 28cb8d0
doc: 更新示例
ArgoZhang 541b0cc
feat: 多选列增加默认居中逻辑
ArgoZhang 85a0c7c
test: 更新单元测试
ArgoZhang 8c6395d
chore: bump version 9.12.2-beta02
ArgoZhang 5ddf8c8
revert: 撤销更改
ArgoZhang f622c70
refactor: 调整紧凑模式下左右间距
ArgoZhang bdfbceb
refactor: 调整紧凑模式下复选框宽度
ArgoZhang cda0ca5
refactor: 精简代码
ArgoZhang 3028387
feat: 增加 CheckboxColumnCompactWidth 参数
ArgoZhang 77c83dd
feat: 使用 CheckboxColumnCompactWidth 值渲染选择列宽度
ArgoZhang f6e86d1
test: 增加单元测试
ArgoZhang 8478f2d
refactor: 增加 CheckboxColumnCompactWidth 参数
ArgoZhang e6e935f
test: 增加单元测试
ArgoZhang af170c9
test: 增加单元测试
ArgoZhang 668a115
test: 更新单元测试
ArgoZhang 08fea11
doc: 代码格式化
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
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // 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 | ||
|
|
@@ -21,6 +21,8 @@ public partial class Tables | |
| [NotNull] | ||
| private string? RefreshText { get; set; } | ||
|
|
||
| private bool _isCompact = true; | ||
ArgoZhang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// OnInitialized | ||
| /// </summary> | ||
|
|
||
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // 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 | ||
|
|
@@ -175,7 +175,10 @@ private int MultipleSelectColumnLeft() | |
|
|
||
| private string? MultiColumnStyleString => GetFixedMultipleSelectColumn ? $"left: {MultipleSelectColumnLeft()}px;" : null; | ||
|
|
||
| private int MultiColumnWidth => ShowCheckboxText ? ShowCheckboxTextColumnWidth : CheckboxColumnWidth; | ||
| private int MultiColumnWidth => ShowCheckboxText ? ShowCheckboxTextColumnWidth : | ||
| TableSize == TableSize.Normal | ||
| ? CheckboxColumnWidth | ||
| : CheckboxColumnCompactWidth; | ||
|
|
||
| /// <summary> | ||
| /// 获得指定列头固定列样式 | ||
|
|
@@ -290,7 +293,10 @@ private int CalcMargin() | |
| } | ||
| if (IsMultipleSelect) | ||
| { | ||
| margin += ShowCheckboxText ? ShowCheckboxTextColumnWidth : CheckboxColumnWidth; | ||
| margin += ShowCheckboxText ? ShowCheckboxTextColumnWidth : | ||
| TableSize == TableSize.Normal | ||
| ? CheckboxColumnWidth | ||
| : CheckboxColumnCompactWidth; | ||
| } | ||
| if (ShowLineNo) | ||
| { | ||
|
|
||
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // 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 | ||
|
|
@@ -339,6 +339,12 @@ private string GetSortTooltip(ITableColumn col) => SortName != col.GetFieldName( | |
| [Parameter] | ||
| public int CheckboxColumnWidth { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 获得/设置 紧凑模式下复选框宽度 默认 28 | ||
| /// </summary> | ||
| [Parameter] | ||
| public int CheckboxColumnCompactWidth { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 获得/设置 行号列宽度 默认 60 | ||
| /// </summary> | ||
|
|
@@ -880,6 +886,11 @@ private void OnInitParameters() | |
| CheckboxColumnWidth = op.TableSettings.CheckboxColumnWidth; | ||
| } | ||
|
|
||
| if (CheckboxColumnCompactWidth == 0) | ||
| { | ||
| CheckboxColumnCompactWidth = op.TableSettings.CheckboxColumnCompactWidth; | ||
| } | ||
|
|
||
| if (op.TableSettings.TableRenderMode != null && RenderMode == TableRenderMode.Auto) | ||
| { | ||
| RenderMode = op.TableSettings.TableRenderMode.Value; | ||
|
|
||
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // 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 | ||
|
|
@@ -15,6 +15,11 @@ public class TableSettings | |
| /// </summary> | ||
| public int CheckboxColumnWidth { get; set; } = 36; | ||
|
|
||
| /// <summary> | ||
| /// 获得/设置 复选框宽度 默认 28 | ||
ArgoZhang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public int CheckboxColumnCompactWidth { get; set; } = 28; | ||
|
|
||
| /// <summary> | ||
| /// 获得/设置 明细行 Row Header 宽度 默认 24 | ||
| /// </summary> | ||
|
|
||
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // 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 | ||
|
|
@@ -1731,7 +1731,7 @@ public void FixedColumn_Ok() | |
| builder.OpenComponent<TableColumn<Foo, string>>(0); | ||
| builder.AddAttribute(1, "Field", foo.Name); | ||
| builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string))); | ||
| builder.AddAttribute(3, nameof(TableColumn<Foo, string>.Fixed), true); | ||
| builder.AddAttribute(3, nameof(TableColumn<,>.Fixed), true); | ||
| builder.CloseComponent(); | ||
| }); | ||
| pb.Add(a => a.DetailRowTemplate, foo => builder => | ||
|
|
@@ -1972,6 +1972,13 @@ public void FixedMultipleColumn_Ok() | |
| }); | ||
| }); | ||
| Assert.Contains("left: 36px;", cut.Markup); | ||
|
|
||
| var table = cut.FindComponent<Table<Foo>>(); | ||
| table.SetParametersAndRender(pb => | ||
| { | ||
| pb.Add(a => a.TableSize, TableSize.Compact); | ||
| }); | ||
| Assert.Contains("left: 28px;", cut.Markup); | ||
| } | ||
|
|
||
| [Theory] | ||
|
|
@@ -2650,7 +2657,7 @@ public void ToolbarButton_Ok() | |
| pb.Add(a => a.TableToolbarTemplate, builder => | ||
| { | ||
| builder.OpenComponent<TableToolbarButton<Foo>>(0); | ||
| builder.AddAttribute(1, nameof(TableToolbarButton<Foo>.Text), "test-after"); | ||
| builder.AddAttribute(1, nameof(TableToolbarButton<>.Text), "test-after"); | ||
| builder.CloseComponent(); | ||
| }); | ||
| pb.Add(a => a.TableToolbarBeforeTemplate, builder => | ||
|
|
@@ -7390,6 +7397,7 @@ public void TableSize_Ok() | |
| { | ||
| pb.Add(a => a.RenderMode, TableRenderMode.Table); | ||
| pb.Add(a => a.TableSize, TableSize.Normal); | ||
| pb.Add(a => a.IsMultipleSelect, true); | ||
| pb.Add(a => a.OnQueryAsync, OnQueryAsync(localizer)); | ||
| pb.Add(a => a.TableColumns, foo => builder => | ||
| { | ||
|
|
||
Oops, something went wrong.
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.