-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.d.ts
47 lines (39 loc) · 1.12 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Canvas } from 'canvas';
export interface TableRendererOptions {
cellWidth ?: number;
cellHeight ?: number;
offsetLeft ?: number;
offsetTop ?: number;
spacing ?: number;
titleSpacing ?: number;
fontFamily ?: string;
paddingVertical ?: number;
paddingHorizontal?: number;
backgroundColor ?: string | CanvasGradient | CanvasPattern;
}
export type Column = '|' | {
width ?: number,
title : string,
dataIndex: string,
align ?: CanvasTextAlign,
};
export type Row = '-' | {
[key: string]: string,
};
export interface TitleStyle {
font ?: string;
fillStyle?: string | CanvasGradient | CanvasPattern;
textAlign?: CanvasTextAlign;
offsetTop?: number;
}
export interface Table {
title ?: string;
titleStyle?: TitleStyle;
columns : Column[];
dataSource : Row[];
}
export type RenderFunction = (tables: Table | Table[]) => Canvas;
declare function TableRenderer (options?: TableRendererOptions): { render: RenderFunction };
declare function saveImage (canvas: Canvas, filepath: string): Promise<void>;
export default TableRenderer;
export { saveImage };