-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.mts
91 lines (89 loc) · 2.78 KB
/
index.d.mts
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
type FormatType = "RP" | "GR" | "DATETIME" | "NUMBER" | "";
type HalignType = "center" | "right" | "left" | "";
interface ColumnGenarator<T> {
key: keyof T;
label?: string;
options?: {
format?: FormatType;
halign?: HalignType;
disabledColumn?: boolean;
disabledFooter?: boolean;
};
}
interface DataItemGenerator {
[key: string]: any;
}
interface GenaratorExport<T> {
columns: ColumnGenarator<T>[];
data: DataItemGenerator[];
type: ("EXCEL" | "PDF" | "TXT" | "ALL")[];
title?: string;
pdfSetting?: {
orientation?: "p" | "portrait" | "l" | "landscape";
unit?: "pt" | "px" | "in" | "mm" | "cm" | "ex" | "em" | "pc";
width?: number;
height?: number;
fontSIze?: number;
bgColor?: string;
titlePdf?: string;
txtColor?: string;
textHeaderRight?: string;
textHeaderLeft?: string;
theme?: "grid" | "striped" | "plain";
grandTotalSetting?: {
disableGrandTotal?: boolean;
colSpan?: number;
};
openNewTab?: boolean;
};
date?: {
start_date?: string;
end_date?: string;
caption?: string;
};
txtSetting?: {
dataTxt?: DataItemGenerator[] | DataItemGenerator;
titleTxt: string;
templateTxt?: string;
copy?: boolean;
};
excelSetting?: {
titleExcel?: string;
bgColor?: string;
txtColor?: string;
additionalTextHeader?: string;
grandTotalSetting?: {
disableGrandTotal?: boolean;
colSpan?: number;
};
};
grouping: string[];
footerSetting?: {
subTotal?: {
caption?: string;
enableCount?: boolean;
captionItem?: string;
};
grandTotal?: {
caption?: string;
captionItem?: string;
enableCount?: boolean;
};
};
}
/**
* Ekspor ke PDF atau Excel berdasarkan konfigurasi yang diberikan.
*
* @param title - Judul laporan.
* @param columns - Konfigurasi kolom untuk laporan.
* @param data - Data yang akan disertakan dalam laporan.
* @param grouping - Gruping yang akan diterapkan dalam laporan ada head dan detail Example: ["no_faktur_hutang"].
* @param pdfSetting - Opsi untuk config PDF.
* @param excelSetting - Opsi untuk config Excel.
* @param txtSetting - Opsi untuk config Txt file.
* @param date - Rentang tanggal untuk laporan.
* @param type - Jenis laporan yang akan diekspor ("PDF" "TXT" atau "EXCEL").
* @param footerSetting - Setting Footer Subtotal atau GranTotal
*/
declare const ExportData: <T>({ columns, data, grouping, date, type, txtSetting, pdfSetting, excelSetting, title, footerSetting }: GenaratorExport<T>) => void;
export { ExportData, type GenaratorExport };