Skip to content

Commit 06214cf

Browse files
feat(DefaultTableExport): add EnableAutoFilter/EnableAutoWidth property (#5846)
* feat(DefaultTableExport): 添加是否启用 Excel 自动筛选,是否启用 Excel 自动宽度参数 #5845 * doc: 更新注释为英文 * chore: bump version 9.5.8 * refactor: 更改参数名称 * test: 更新单元测试 --------- Co-authored-by: Argo Zhang <[email protected]>
1 parent d1579e1 commit 06214cf

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.5.8-beta01</Version>
4+
<Version>9.5.8</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Options/TableExportOptions.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,45 @@
88
namespace BootstrapBlazor.Components;
99

1010
/// <summary>
11-
/// Table 导出 Excel 配置类
11+
/// Configuration class for exporting tables to Excel
1212
/// </summary>
1313
public class TableExportOptions
1414
{
1515
/// <summary>
16-
/// 获得/设置 是否使用格式化 默认 true 如果设置 <see cref="TableColumn{TItem, TType}.FormatString"/> 或者 <see cref="TableColumn{TItem, TType}.Formatter"/> 后使用格式化值
16+
/// Gets or sets whether to use formatting. Default is true.
17+
/// If <see cref="TableColumn{TItem, TType}.FormatString"/> or <see cref="TableColumn{TItem, TType}.Formatter"/> is set, the formatted value will be used.
1718
/// </summary>
18-
/// <remarks>注意格式化后返回值是 <code>string</code> 会导致原始值类型改变</remarks>
19+
/// <remarks>Note: After formatting, the returned value is a <code>string</code>, which may change the original value type.</remarks>
1920
public bool EnableFormat { get; set; } = true;
2021

2122
/// <summary>
22-
/// 获得/设置 是否使用 Lookup 默认 true
23+
/// Gets or sets whether to use Lookup. Default is true.
2324
/// </summary>
2425
public bool EnableLookup { get; set; } = true;
2526

2627
/// <summary>
27-
/// 获得/设置 是否将数组类型值进行合并操作 默认 true
28+
/// Gets or sets whether to merge array-type values. Default is true.
2829
/// </summary>
2930
public bool AutoMergeArray { get; set; } = true;
3031

3132
/// <summary>
32-
/// 获得/设置 是否使用枚举类型的 <see cref="DescriptionAttribute"/> 标签 默认 true
33+
/// Gets or sets whether to use the <see cref="DescriptionAttribute"/> tag for enum types. Default is true.
3334
/// </summary>
3435
public bool UseEnumDescription { get; set; } = true;
3536

3637
/// <summary>
37-
/// 获得/设置 数组类型合并操作时使用的分隔符 默认使用逗号
38+
/// Gets or sets the delimiter used when merging array-type values. Default is a comma.
3839
/// </summary>
39-
/// <remarks>注意格式化后返回值是 <code>string</code> 会导致原始值类型改变</remarks>
40+
/// <remarks>Note: After formatting, the returned value is a <code>string</code>, which may change the original value type.</remarks>
4041
public string ArrayDelimiter { get; set; } = ",";
42+
43+
/// <summary>
44+
/// Gets or sets whether to enable Excel auto-filtering. Default is true.
45+
/// </summary>
46+
public bool EnableAutoFilter { get; set; } = true;
47+
48+
/// <summary>
49+
/// Gets or sets whether to enable Excel auto-width. Default is false.
50+
/// </summary>
51+
public bool EnableAutoWidth { get; set; }
4152
}

test/UnitTest/Options/BootstrapBlazorOptionsTest.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,15 @@ public void Options_TableExportOptions()
9595
exportOptions.AutoMergeArray = false;
9696
exportOptions.ArrayDelimiter = ",";
9797
exportOptions.UseEnumDescription = false;
98+
exportOptions.EnableAutoFilter = false;
99+
exportOptions.EnableAutoWidth = false;
98100

99101
Assert.False(exportOptions.EnableLookup);
100102
Assert.False(exportOptions.EnableFormat);
101103
Assert.False(exportOptions.AutoMergeArray);
102104
Assert.False(exportOptions.UseEnumDescription);
105+
Assert.False(exportOptions.EnableAutoFilter);
106+
Assert.False(exportOptions.EnableAutoWidth);
103107

104108
Assert.Equal(",", exportOptions.ArrayDelimiter);
105109
}

0 commit comments

Comments
 (0)