forked from clarketm/TableExport
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtableexport.d.ts
More file actions
237 lines (207 loc) · 5.35 KB
/
Copy pathtableexport.d.ts
File metadata and controls
237 lines (207 loc) · 5.35 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/**
* TableExport main plugin constructor
*
* @class TableExport
*
* @param selectors {NodeList|JQuery} selector(s)
* @param options {Object} TableExport configuration options
* @param isUpdate {Boolean}
* @constructor
*/
export class TableExport {
constructor(selectors: NodeList|JQuery, options: Defaults, isUpdate: boolean);
/**
* Default plugin options.
* @memberof TableExport.prototype
*/
defaults: Defaults;
/**
* TableExport configuration options (user-defined w/ default fallback)
*/
settings: any;
/**
* selectors (e.g. tables) to apply the plugin to
*/
selectors: NodeList|JQuery;
/**
* Character set (character encoding) of the HTML.
* @memberof TableExport.prototype
*/
charset: string;
/**
* Filename fallback for exported files.
* @memberof TableExport.prototype
*/
defaultFileName: string;
/**
* Class applied to each export button element.
* @memberof TableExport.prototype
*/
defaultButton: string;
/**
* Bootstrap configuration classes ["base", "theme", "container"].
* @memberof TableExport.prototype
*/
bootstrap: string[];
/**
* Row delimeter
* @memberof TableExport.prototype
*/
rowDel: string;
/**
* HTML entity mapping for special characters.
* @memberof TableExport.prototype
*/
entityMap: Object;
/**
* XLSX (Open XML spreadsheet) file extension configuration
* @memberof TableExport.prototype
*/
xlsx: XLSX;
/**
* XLS (Binary spreadsheet) file extension configuration
* @memberof TableExport.prototype
*/
xls: XLS;
/**
* CSV (Comma Separated Values) file extension configuration
* @memberof TableExport.prototype
*/
csv: CSV;
/**
* TXT (Plain Text) file extension configuration
* @memberof TableExport.prototype
*/
txt: TXT;
/**
* Escapes special characters with HTML entities
* @memberof TableExport.prototype
* @param string {String}
* @returns {String} escaped string
*/
escapeHtml: (string: string) => string;
/**
* Formats datetimes for compatibility with Excel
* @memberof TableExport.prototype
* @param v {Number}
* @param date1904 {Date}
* @returns {Number} epoch time
*/
dateNum: (v: number, date1904: Date) => number;
/**
* Creates an Excel spreadsheet from a data string
* @memberof TableExport.prototype
* @param data {String}
* @returns {Number} epoch time
*/
createSheet: (data: string) => number;
/**
* Converts a string to an arraybuffer
* @memberof TableExport.prototype
* @returns {ArrayBuffer}
*/
string2ArrayBuffer: (s: string) => ArrayBuffer;
/**
* Exports and downloads the file
* @memberof TableExport.prototype
* @param data {String}
* @param mime {String} mime type
* @param name {String} filename
* @param extension {String} file extension
*/
export2file: (data: string, mime: string, name: string, extension: String) => void;
/**
* Updates the plugin instance with new/updated options
* @param options {Object} TableExport configuration options
* @returns {TableExport} updated TableExport instance
*/
update: (options: any) => TableExport;
/**
* Reset the plugin instance to its original state
* @returns {TableExport} original TableExport instance
*/
reset: () => TableExport;
/**
* Remove the instance (i.e. caption containing the export buttons)
*/
remove: () => void;
}
/**
* Excel Workbook constructor
* @memberof TableExport.prototype
* @constructor
*/
export interface Workbook {
SheetNames: any[];
Sheets: Object;
}
/**
* Default plugin options.
* @memberof TableExport.prototype
*/
export interface Defaults {
headings: boolean;
footers: boolean;
formats: string[];
fileName: string;
bootstrap: boolean;
position: string;
ignoreRows: number[];
ignoreCols: number[];
ignoreCSS: string;
emptyCSS: string;
trimWhitespace: boolean;
}
/**
* XLSX (Open XML spreadsheet) file extension configuration
* @memberof TableExport.prototype
*/
export interface XLSX {
defaultClass: string;
buttonContent: string;
mimeType: string;
separator: string;
fileExtension: string;
}
/**
* XLS (Binary spreadsheet) file extension configuration
* @memberof TableExport.prototype
*/
export interface XLS {
defaultClass: string;
buttonContent: string;
mimeType: string;
separator: string;
fileExtension: string;
}
/**
* CSV (Comma Separated Values) file extension configuration
* @memberof TableExport.prototype
*/
export interface CSV {
defaultClass: string;
buttonContent: string;
mimeType: string;
separator: string;
fileExtension: string;
}
/**
* TXT (Plain Text) file extension configuration
* @memberof TableExport.prototype
*/
export interface TXT {
defaultClass: string;
buttonContent: string;
mimeType: string;
separator: string;
fileExtension: string;
}
interface JQuery {
/**
* TableExport main plugin constructor
*
* @param options {Object} TableExport configuration options
* @param isUpdate {Boolean}
*/
tableexport(options: Defaults, isUpdate: boolean): TableExport;
}