feat(ITableExport): add links parameter support dynamic load style sheet (#3390)

* feat: 增加新方法

* chore: bump version 8.5.1-beta04

* test: 更新单元测试
This commit is contained in:
Argo Zhang
2024-05-01 21:47:54 +08:00
committed by GitHub
parent 26b962c9a8
commit 588916b992
3 changed files with 18 additions and 1 deletions

View File

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

View File

@@ -76,4 +76,14 @@ public interface ITableExport
/// <param name="options">导出配置实例</param>
/// <param name="fileName">文件名 默认 null ExportData_{DateTime.Now:yyyyMMddHHmmss}.xlsx</param>
Task<bool> ExportPdfAsync<TModel>(IEnumerable<TModel> items, IEnumerable<ITableColumn>? cols, TableExportOptions options, string? fileName = null) => ExportPdfAsync(items, cols, fileName);
/// <summary>
/// 导出 Pdf 方法
/// </summary>
/// <param name="items">导出数据集合</param>
/// <param name="cols">当前可见列数据集合 默认 null 导出全部列</param>
/// <param name="options">导出配置实例</param>
/// <param name="fileName">文件名 默认 null ExportData_{DateTime.Now:yyyyMMddHHmmss}.xlsx</param>
/// <param name="links">样式表集合</param>
Task<bool> ExportPdfAsync<TModel>(IEnumerable<TModel> items, IEnumerable<ITableColumn>? cols, TableExportOptions options, string? fileName = null, IEnumerable<string>? links = null) => ExportPdfAsync(items, cols, fileName);
}

View File

@@ -3,6 +3,7 @@
// Website: https://www.blazor.zone or https://argozhang.github.io/
namespace UnitTest.Components;
public class TableExportTest
{
[Fact]
@@ -23,8 +24,14 @@ public class TableExportTest
actual = await exporter.ExportCsvAsync(items, cols, new TableExportOptions(), null);
Assert.True(actual);
actual = await exporter.ExportPdfAsync(items, cols, null);
Assert.True(actual);
actual = await exporter.ExportPdfAsync(items, cols, new TableExportOptions(), null);
Assert.True(actual);
actual = await exporter.ExportPdfAsync(items, cols, new TableExportOptions(), null, null);
Assert.True(actual);
}
class MockTableExport : ITableExport