Skip to content

Commit

Permalink
Merge pull request #1460 from VisActor/1420-bug-pivotchart-markline-a…
Browse files Browse the repository at this point in the history
…utorange

fix: ts error in table-export
  • Loading branch information
fangsmile committed Apr 8, 2024
2 parents f3b84e2 + 968233f commit e4f49d5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/vtable-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
},
"scripts": {
"compile": "tsc --noEmit",
"start": "vite ./demo",
"build": "bundle --clean"
},
Expand Down Expand Up @@ -86,4 +87,4 @@
"@types/react-is": "^17.0.3",
"rollup-plugin-node-resolve": "5.2.0"
}
}
}
14 changes: 8 additions & 6 deletions packages/vtable-export/src/excel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { CellType, IVTable } from '../util/type';
import { getCellAlignment, getCellBorder, getCellFill, getCellFont } from './style';
import { updateCell, renderChart, graphicUtil } from '@visactor/vtable';
import { isArray } from '@visactor/vutils';
import type { IRowSeriesNumber } from '@visactor/vtable/src/ts-types';
import type { ColumnDefine, IRowSeriesNumber } from '@visactor/vtable/src/ts-types';

export async function exportVTableToExcel(tableInstance: IVTable) {
const workbook = new ExcelJS.Workbook();
Expand Down Expand Up @@ -96,19 +96,21 @@ function addCell(
const define =
cellLocation !== 'body' ? tableInstance.getHeaderDefine(col, row) : tableInstance.getBodyColumnDefine(col, row);
const mayHaveIcon =
cellLocation !== 'body' ? true : (define as IRowSeriesNumber)?.dragOrder || !!define?.icon || !!define?.tree;
cellLocation !== 'body'
? true
: (define as IRowSeriesNumber)?.dragOrder || !!define?.icon || !!(define as ColumnDefine)?.tree;
let icons;
if (mayHaveIcon) {
icons = tableInstance.getCellIcons(col, row);
}
let customRender;
let customLayout;
if (cellLocation !== 'body') {
customRender = define?.headerCustomRender;
customLayout = define?.headerCustomLayout;
customRender = (define as ColumnDefine)?.headerCustomRender;
customLayout = (define as ColumnDefine)?.headerCustomLayout;
} else {
customRender = define?.customRender || tableInstance.customRender;
customLayout = define?.customLayout;
customRender = (define as ColumnDefine)?.customRender || tableInstance.customRender;
customLayout = (define as ColumnDefine)?.customLayout;
}

if (
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/src/core/tableHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function _setRecords(table: ListTableAPI, records: any[] = []): void {
});
}

export function _setDataSource(table: ListTableAPI, dataSource: DataSource): void {
export function _setDataSource(table: BaseTableAPI, dataSource: DataSource): void {
_dealWithUpdateDataSource(table, () => {
if (dataSource) {
if (dataSource instanceof DataSource) {
Expand Down

0 comments on commit e4f49d5

Please sign in to comment.