Skip to content

Commit

Permalink
3.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbengtsson committed Apr 26, 2020
1 parent 4e81553 commit 5812a8b
Show file tree
Hide file tree
Showing 5 changed files with 1,067 additions and 960 deletions.
280 changes: 176 additions & 104 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,101 @@
// Generated by dts-bundle-generator v4.3.0

export declare type HookHandler = (data: HookData) => void | boolean;
export declare type CellHookHandler = (data: CellHookData) => void | boolean;
export declare type jsPDFConstructor = any;
export declare type jsPDFDocument = any;
export declare type Opts = {
[key: string]: string | number;
};
declare class DocHandler {
private readonly jsPDFDocument;
readonly userStyles: Partial<Styles>;
constructor(jsPDFDocument: jsPDFDocument);
static setDefaults(defaults: UserOptions, doc?: jsPDFDocument | null): void;
private static unifyColor;
applyStyles(styles: Partial<Styles>, fontOnly?: boolean): void;
splitTextToSize(text: string | string[], size: number, opts: Opts): string[];
rect(x: number, y: number, width: number, height: number, fillStyle: string): any;
getPreviousAutoTable(): Table;
getTextWidth(text: string | string[]): number;
getDocument(): any;
setPage(page: number): void;
addPage(): any;
getFontList(): {
[key: string]: string[];
};
getGlobalOptions(): UserOptions;
getDocumentOptions(): UserOptions;
pageSize(): {
width: number;
height: number;
};
scaleFactor(): number;
pageNumber(): number;
}
declare class HookData {
table: Table;
pageNumber: number;
pageCount: number;
settings: Settings;
doc: jsPDFDocument;
cursor: {
x: number;
y: number;
};
constructor(table: Table, doc: DocHandler);
}
declare class CellHookData extends HookData {
cell: Cell;
row: Row;
column: Column;
section: 'head' | 'body' | 'foot';
constructor(table: Table, doc: DocHandler, cell: Cell, row: Row, column: Column);
}
export declare type MarginPadding = {
top: number;
right: number;
bottom: number;
left: number;
};
export declare type PageHook = (data: HookData) => void | boolean;
export declare type CellHook = (data: CellHookData) => void | boolean;
export interface HookProps {
didParseCell: CellHook[];
willDrawCell: CellHook[];
didDrawCell: CellHook[];
didDrawPage: PageHook[];
}
export interface Settings {
includeHiddenHtml: boolean;
useCss: boolean;
theme: 'striped' | 'grid' | 'plain';
startY: number;
margin: MarginPadding;
pageBreak: 'auto' | 'avoid' | 'always';
rowPageBreak: 'auto' | 'avoid';
tableWidth: 'auto' | 'wrap' | number;
showHead: 'everyPage' | 'firstPage' | 'never';
showFoot: 'everyPage' | 'lastPage' | 'never';
tableLineWidth: number;
tableLineColor: Color;
}
export interface StylesProps {
styles: Partial<Styles>;
headStyles: Partial<Styles>;
bodyStyles: Partial<Styles>;
footStyles: Partial<Styles>;
alternateRowStyles: Partial<Styles>;
columnStyles: {
[key: string]: Partial<Styles>;
};
}
declare class Table {
id?: any;
id?: string | number;
cursor: {
x: number;
y: number;
};
doc: any;
userStyles: any;
settings: any;
settings: Settings;
styles: StylesProps;
columns: Column[];
head: Row[];
body: Row[];
Expand All @@ -27,15 +112,20 @@ declare class Table {
pageStartX: number;
pageStartY: number;
finalY: number;
styles: any;
cellHooks: any;
hooks: HookProps;
constructor(id: string | number | undefined, settings: Settings, styles: StylesProps, hooks: HookProps, content: {
body: Row[];
head: Row[];
foot: Row[];
columns: Column[];
});
allRows(): Row[];
callCellHooks(handlers: HookHandler[] | CellHookHandler[], cell: Cell, row: Row, column: Column): boolean;
callEndPageHooks(): void;
margin(side: string): any;
callCellHooks(doc: DocHandler, handlers: CellHook[], cell: Cell, row: Row, column: Column): boolean;
callEndPageHooks(doc: DocHandler): void;
}
declare class Row {
raw: HTMLTableRowElement | any;
raw: HTMLTableRowElement | RowInput;
element?: HTMLTableRowElement;
index: number;
cells: {
[key: string]: Cell;
Expand All @@ -46,16 +136,16 @@ declare class Row {
x: number;
y: number;
spansMultiplePages: boolean;
constructor(raw: any, index: number, section: Section);
hasRowSpan(): boolean;
constructor(raw: RowInput | HTMLTableRowElement, index: number, section: Section);
hasRowSpan(columns: Column[]): boolean;
canEntireRowFit(height: number): boolean;
getMinimumRowHeight(): any;
getMinimumRowHeight(columns: Column[], doc: DocHandler): number;
}
export declare type Section = 'head' | 'body' | 'foot';
declare class Cell {
raw: HTMLTableCellElement | any;
styles: any;
text: string | string[];
raw: HTMLTableCellElement | CellInput;
styles: Styles;
text: string[];
section: Section;
contentHeight: number;
contentWidth: number;
Expand All @@ -72,94 +162,56 @@ declare class Cell {
y: number;
colSpan: number;
rowSpan: number;
constructor(raw: any, themeStyles: any, section: Section);
getContentHeight(): any;
padding(name: 'vertical' | 'horizontal' | 'top' | 'bottom' | 'left' | 'right'): any;
constructor(raw: CellInput, styles: Styles, section: Section);
getContentHeight(doc: DocHandler): number;
padding(name: 'vertical' | 'horizontal' | 'top' | 'bottom' | 'left' | 'right'): number;
}
declare class Column {
raw: any;
raw: ColumnOption | null;
dataKey: string | number;
index: number;
wrappedWidth: number;
minReadableWidth: number;
minWidth: number;
width: number;
constructor(dataKey: string | number, raw: any, index: number);
getMaxCustomCellWidth(): number;
}
declare class HookData {
table: Table;
pageNumber: number;
pageCount: number;
settings: any;
doc: any;
cursor: {
x: number;
y: number;
};
constructor();
}
declare class CellHookData extends HookData {
cell: Cell;
row: Row;
column: Column;
section: 'head' | 'body' | 'foot';
constructor(cell: Cell, row: Row, column: Column);
}
export interface ColumnOption {
header?: string;
title?: string;
footer?: string;
dataKey?: string | number;
constructor(dataKey: string | number, raw: ColumnOption | null, index: number);
getMaxCustomCellWidth(table: Table): number;
}
export declare type UserOptions = HTMLConfig | ContentConfig | ColumnDataConfig;
export declare type Color = [number, number, number] | number | 'transparent' | false;
export declare type MarginPadding = number | {
top?: number;
right?: number;
bottom?: number;
left?: number;
};
export interface Styles {
font?: 'helvetica' | 'times' | 'courier' | string;
fontStyle?: 'normal' | 'bold' | 'italic' | 'bolditalic';
overflow?: 'linebreak' | 'ellipsize' | 'visible' | 'hidden';
fillColor?: Color;
textColor?: Color;
halign?: 'left' | 'center' | 'right' | 'justify';
valign?: 'top' | 'middle' | 'bottom';
fontSize?: number;
cellPadding?: number;
lineColor?: Color;
lineWidth?: number;
cellWidth?: 'auto' | 'wrap' | number;
minCellHeight?: number;
}
export interface CellDefinition {
rowSpan?: number;
colSpan?: number;
styles?: Styles;
content?: string | string[] | number;
font: 'helvetica' | 'times' | 'courier' | string;
fontStyle: 'normal' | 'bold' | 'italic' | 'bolditalic';
overflow: 'linebreak' | 'ellipsize' | 'visible' | 'hidden' | Function;
fillColor: Color;
textColor: Color;
halign: 'left' | 'center' | 'right' | 'justify';
valign: 'top' | 'middle' | 'bottom';
fontSize: number;
cellPadding: MarginPaddingInput;
lineColor: Color;
lineWidth: number;
cellWidth: 'auto' | 'wrap' | number;
minCellHeight: number;
minCellWidth: number;
}
export declare type CellType = null | string | number | boolean | CellDefinition;
export declare type MultipleRowType = CellType[][] | {
string: CellType;
}[];
export declare type SingleRowType = CellType[] | {
string: CellType;
};
export interface BaseConfig {
theme?: 'striped' | 'grid' | 'plain';
startY?: number;
margin?: MarginPadding;
export interface UserOptions {
includeHiddenHtml?: boolean;
useCss?: boolean;
theme?: 'striped' | 'grid' | 'plain' | null;
startY?: number | false;
margin?: MarginPaddingInput;
pageBreak?: 'auto' | 'avoid' | 'always';
rowPageBreak?: 'auto' | 'avoid';
tableWidth?: 'auto' | 'wrap' | number;
showHead?: 'everyPage' | 'firstPage' | 'never';
showFoot?: 'everyPage' | 'lastPage' | 'never';
showHead?: 'everyPage' | 'firstPage' | 'never' | boolean;
showFoot?: 'everyPage' | 'lastPage' | 'never' | boolean;
tableLineWidth?: number;
tableLineColor?: Color;
tableId?: any;
tableId?: string | number;
head?: RowInput[];
body?: RowInput[];
foot?: RowInput[];
html?: string | HTMLTableElement;
columns?: ColumnOption[];
styles?: Styles;
bodyStyles?: Styles;
headStyles?: Styles;
Expand All @@ -168,24 +220,44 @@ export interface BaseConfig {
columnStyles?: {
[key: string]: Styles;
};
didParseCell?: (data: CellHookData) => void;
willDrawCell?: (data: CellHookData) => void;
didDrawCell?: (data: CellHookData) => void;
didDrawPage?: (data: CellHookData) => void;
didParseCell?: CellHook;
willDrawCell?: CellHook;
didDrawCell?: CellHook;
didDrawPage?: PageHook;
}
export interface ContentConfig extends BaseConfig {
head?: SingleRowType | MultipleRowType;
foot?: SingleRowType | MultipleRowType;
body: MultipleRowType;
export interface ColumnOption {
header?: string;
title?: string;
footer?: string;
dataKey?: string | number;
key?: string | number;
}
export interface ColumnDataConfig extends BaseConfig {
columns?: ColumnOption[];
body: object[];
export declare type Color = [number, number, number] | number | string | false;
export declare type MarginPaddingInput = number | number[] | {
top?: number;
right?: number;
bottom?: number;
left?: number;
horizontal?: number;
vertical?: number;
};
export interface CellDef {
rowSpan?: number;
colSpan?: number;
styles?: Partial<Styles>;
content?: string | string[] | number;
title?: string;
_element?: HTMLTableCellElement;
}
export interface HTMLConfig extends BaseConfig {
html: string | HTMLElement;
declare class HtmlRowInput extends Array<CellInput> {
_element: HTMLTableRowElement;
constructor(element: HTMLTableRowElement);
}
export declare function applyPlugin(jsPDF: any): void;
export declare type CellInput = null | string | string[] | number | boolean | CellDef;
export declare type RowInput = {
[key: string]: CellInput;
} | HtmlRowInput | CellInput[];
export declare function applyPlugin(jsPDF: jsPDFConstructor): void;
export declare type autoTable = (options: UserOptions) => void;

export {};
Loading

0 comments on commit 5812a8b

Please sign in to comment.