Skip to content

Export

export type CSVFormatter = (options: Partial<CSVFormat>, data: DataInput) => string;

class ExportCsv {
doExport({ data, headers, props }: DataInput): string;;
}

export type ExportFormat = Partial<CSVFormat>;

class ExportFilePlugin {
/** Exports string */
exportString(options?: ExportFormat, t?: ExportTypes): Promise<string | null>;;
/** Exports Blob */
exportBlob(options?: ExportFormat, t?: ExportTypes): Promise<Blob | null>;;
/** Export file */
exportFile(options?: ExportFormat, t?: ExportTypes): Promise<void>;;
/** Blob object */
getBlob(formatter: Formatter): Promise<Blob | null>;;
}

export type ColSource = {
headers: string[][];
props: any[];
};

DataInput (Extended from export.plugin.d.ts)

Section titled “DataInput (Extended from export.plugin.d.ts)”
export type DataInput = {
data: DataType[];
} & ColSource;

interface FormatterOptions {
mime: string;
encoding: string
}

interface Formatter {
options: FormatterOptions;
doExport(data: DataInput): string
}

CSVFormat (Extended from export.plugin.d.ts)

Section titled “CSVFormat (Extended from export.plugin.d.ts)”
interface CSVFormat {
fileKind: 'csv';
bom: boolean;
columnDelimiter: string;
rowDelimiter: string;
filename?: string
}