datainout
Version:
Import and reports data
55 lines (53 loc) • 1.55 kB
text/typescript
type TableData = {
header?: any;
footer?: any;
table?: any[];
};
type PageData = Record<string, any>;
type DataInoutInput = TableData | PageData;
type AttributeType = "number" | "string" | "boolean" | "object" | "date" | "virtual";
type BaseAttribute = {
keyName: string;
index?: number;
section: SheetSection;
};
type SheetSection = "header" | "table" | "footer";
type SheetExcelOption<T extends BaseAttribute> = {
cells: T[];
sheetIndex: number;
sheetName: string;
beginTableAt: number;
endTableAt?: number;
keyTableAt: number;
};
type EventType = {
onFile: () => void;
start: () => void;
finish: () => void;
begin: (sheetName?: string) => void;
data: () => void;
enddata: () => void;
end: (sheetName?: string) => void;
header: (sheetName?: string) => void;
footer: (sheetName?: string) => void;
/** Handle error. Return false to cancel import, otherhands return true */
error: (error: Error) => boolean;
};
type TableExcelOptions<T> = {
sheets: T[];
name: string;
};
type Task<T> = (args: T) => Promise<void>;
type SheetExcelOptionV2<T extends BaseAttribute> = {
cells: {
header?: T[];
footer?: T[];
table: T[];
};
sheetIndex: number;
sheetName: string;
beginTableAt: number;
endTableAt?: number;
keyTableAt: number;
};
export type { AttributeType, BaseAttribute, DataInoutInput, EventType, PageData, SheetExcelOption, SheetExcelOptionV2, SheetSection, TableData, TableExcelOptions, Task };