@asasugar-use/custom-json2excel
Version:
✌传入json,可自定义表格标题名称和列数、头部名称、过滤列和绑定生成开始与成功的回调函数
29 lines (26 loc) • 629 B
text/typescript
export type AnyObject = Record<string, any>;
export type AnyObjectArray = AnyObject[];
export type VoidFunction = () => void;
export interface ElsExtend {
name: string;
colspan: number;
}
export interface Json2ExcelParams {
data: AnyObjectArray;
scope?: AnyObject;
orderedKey?: string[];
filters?: string[];
title?: ElsExtend[];
footer?: ElsExtend[];
keyMap?: AnyObject;
name?: string;
type?: 'xls' | 'csv';
onStart?: VoidFunction;
onSuccess?: VoidFunction;
onError?: (err?: any) => void;
}
export interface ExcelData<T = any> {
header: string[];
results: T[];
meta: { sheetName: string; };
}