feat(xlsx): add optional auto filter to xlsx export

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-08-27 12:18:42 +08:00
1 parent 185db5e8c6
commit d70a1231b0
29 files changed
+285 -119

No files matched your search

@@ -17,19 +17,19 @@ function functionBody(name: string): string {
}
describe("ObjectBrowser XLSX export", () => {
it("asks for a header mode before opening the save dialog when comments exist", () => {
it("asks for export options before opening the save dialog", () => {
const dialog = functionBody("showObjectBrowserXlsxHeaderDialog");
const exportDataXlsx = functionBody("exportDataXlsx");
expect(dialog).toContain('if (!hasComments) return Promise.resolve("name")');
expect(exportDataXlsx).toContain("hasXlsxHeaderComments(columnInfos.map((column) => column.comment))");
expect(exportDataXlsx.indexOf("await showObjectBrowserXlsxHeaderDialog(")).toBeLessThan(exportDataXlsx.indexOf('await exportTableData(row, "xlsx", columnInfos, headerMode)'));
expect(dialog).toContain("showHeaderOptions: hasComments");
expect(exportDataXlsx).toContain("hasXlsxHeaderComments(columnInfos?.map((column) => column.comment))");
expect(exportDataXlsx.indexOf("await showObjectBrowserXlsxHeaderDialog(")).toBeLessThan(exportDataXlsx.indexOf('await exportTableData(row, "xlsx", columnInfos, exportOptions.headerMode, exportOptions.autoFilter)'));
});
it("falls back to field-name headers when column metadata is unavailable", () => {
const exportDataXlsx = functionBody("exportDataXlsx");
expect(exportDataXlsx).toContain("catch {\n // Export still works with field-name headers when column metadata is unavailable.\n }");
expect(exportDataXlsx).toContain('await exportTableData(row, "xlsx", columnInfos, headerMode)');
expect(exportDataXlsx).toContain('await exportTableData(row, "xlsx", columnInfos, exportOptions.headerMode, exportOptions.autoFilter)');
});
});