sheetra 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +32 -0
- package/dist/index.esm.js +2392 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2419 -0
- package/dist/index.js.map +1 -0
- package/dist/types/builders/export-builder.d.ts +20 -0
- package/dist/types/builders/section-builder.d.ts +142 -0
- package/dist/types/builders/sheet-builder.d.ts +297 -0
- package/dist/types/core/cell.d.ts +16 -0
- package/dist/types/core/column.d.ts +13 -0
- package/dist/types/core/row.d.ts +20 -0
- package/dist/types/core/styles.d.ts +23 -0
- package/dist/types/core/workbook.d.ts +19 -0
- package/dist/types/core/worksheet.d.ts +32 -0
- package/dist/types/formatters/date-formatter.d.ts +7 -0
- package/dist/types/formatters/index.d.ts +3 -0
- package/dist/types/formatters/number-formatter.d.ts +6 -0
- package/dist/types/formatters/string-formatter.d.ts +310 -0
- package/dist/types/index.d.ts +1730 -0
- package/dist/types/types/cell.types.d.ts +288 -0
- package/dist/types/types/export.types.d.ts +303 -0
- package/dist/types/types/index.d.ts +13 -0
- package/dist/types/types/workbook.types.d.ts +500 -0
- package/dist/types/utils/constants.d.ts +10 -0
- package/dist/types/utils/helpers.d.ts +36 -0
- package/dist/types/utils/validators.d.ts +3 -0
- package/dist/types/writers/csv-writer.d.ts +6 -0
- package/dist/types/writers/excel-writer.d.ts +16 -0
- package/dist/types/writers/index.d.ts +4 -0
- package/dist/types/writers/json-writer.d.ts +6 -0
- package/package.json +88 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { CellData, CellStyle, DataValidation, ConditionalFormatRule } from './cell.types';
|
|
2
|
+
/**
|
|
3
|
+
* Row properties
|
|
4
|
+
*/
|
|
5
|
+
export interface RowProperties {
|
|
6
|
+
/** Row height in points */
|
|
7
|
+
height?: number;
|
|
8
|
+
/** Hidden row */
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
/** Outline level (for grouping) */
|
|
11
|
+
outlineLevel?: number;
|
|
12
|
+
/** Collapsed state */
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
/** Custom row style */
|
|
15
|
+
style?: CellStyle;
|
|
16
|
+
/** Row page break */
|
|
17
|
+
pageBreak?: boolean;
|
|
18
|
+
/** Phonetic (for Asian languages) */
|
|
19
|
+
phonetic?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Row data structure
|
|
23
|
+
*/
|
|
24
|
+
export interface RowData extends RowProperties {
|
|
25
|
+
/** Cells in the row */
|
|
26
|
+
cells: CellData[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Column properties
|
|
30
|
+
*/
|
|
31
|
+
export interface ColumnProperties {
|
|
32
|
+
/** Column width in characters */
|
|
33
|
+
width?: number;
|
|
34
|
+
/** Hidden column */
|
|
35
|
+
hidden?: boolean;
|
|
36
|
+
/** Outline level (for grouping) */
|
|
37
|
+
outlineLevel?: number;
|
|
38
|
+
/** Collapsed state */
|
|
39
|
+
collapsed?: boolean;
|
|
40
|
+
/** Custom column style */
|
|
41
|
+
style?: CellStyle;
|
|
42
|
+
/** Column page break */
|
|
43
|
+
pageBreak?: boolean;
|
|
44
|
+
/** Best fit width */
|
|
45
|
+
bestFit?: boolean;
|
|
46
|
+
/** Phonetic (for Asian languages) */
|
|
47
|
+
phonetic?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Column data structure
|
|
51
|
+
*/
|
|
52
|
+
export interface ColumnData extends ColumnProperties {
|
|
53
|
+
/** Column index */
|
|
54
|
+
index?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Merged cell range
|
|
58
|
+
*/
|
|
59
|
+
export interface MergeCell {
|
|
60
|
+
/** Start row index (0-based) */
|
|
61
|
+
startRow: number;
|
|
62
|
+
/** Start column index (0-based) */
|
|
63
|
+
startCol: number;
|
|
64
|
+
/** End row index (0-based) */
|
|
65
|
+
endRow: number;
|
|
66
|
+
/** End column index (0-based) */
|
|
67
|
+
endCol: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Frozen pane configuration
|
|
71
|
+
*/
|
|
72
|
+
export interface FreezePane {
|
|
73
|
+
/** Number of frozen rows */
|
|
74
|
+
rows?: number;
|
|
75
|
+
/** Number of frozen columns */
|
|
76
|
+
columns?: number;
|
|
77
|
+
/** Active cell in the unfrozen area */
|
|
78
|
+
activeCell?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Sheet view settings
|
|
82
|
+
*/
|
|
83
|
+
export interface SheetView {
|
|
84
|
+
/** Right-to-left mode */
|
|
85
|
+
rightToLeft?: boolean;
|
|
86
|
+
/** Show grid lines */
|
|
87
|
+
showGridLines?: boolean;
|
|
88
|
+
/** Show row and column headers */
|
|
89
|
+
showRowColHeaders?: boolean;
|
|
90
|
+
/** Show zero values */
|
|
91
|
+
showZeros?: boolean;
|
|
92
|
+
/** Zoom scale percentage */
|
|
93
|
+
zoomScale?: number;
|
|
94
|
+
/** Zoom scale for page layout view */
|
|
95
|
+
zoomScaleNormal?: number;
|
|
96
|
+
/** Zoom scale for page break preview */
|
|
97
|
+
zoomScalePageBreakPreview?: number;
|
|
98
|
+
/** Zoom scale for page layout view */
|
|
99
|
+
zoomScaleSheetLayoutView?: number;
|
|
100
|
+
/** View type */
|
|
101
|
+
view?: 'normal' | 'pageBreakPreview' | 'pageLayout';
|
|
102
|
+
/** Top-left visible cell */
|
|
103
|
+
topLeftCell?: string;
|
|
104
|
+
/** Split state */
|
|
105
|
+
split?: {
|
|
106
|
+
xSplit?: number;
|
|
107
|
+
ySplit?: number;
|
|
108
|
+
activePane?: 'bottomRight' | 'topRight' | 'bottomLeft' | 'topLeft';
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Print options for worksheet
|
|
113
|
+
*/
|
|
114
|
+
export interface PrintOptions {
|
|
115
|
+
/** Orientation */
|
|
116
|
+
orientation?: 'portrait' | 'landscape';
|
|
117
|
+
/** Fit to page */
|
|
118
|
+
fitToPage?: boolean;
|
|
119
|
+
/** Fit to width (in pages) */
|
|
120
|
+
fitToWidth?: number;
|
|
121
|
+
/** Fit to height (in pages) */
|
|
122
|
+
fitToHeight?: number;
|
|
123
|
+
/** Paper size */
|
|
124
|
+
paperSize?: string | number;
|
|
125
|
+
/** Scale percentage */
|
|
126
|
+
scale?: number;
|
|
127
|
+
/** Print area range */
|
|
128
|
+
printArea?: string;
|
|
129
|
+
/** Print titles (rows to repeat) */
|
|
130
|
+
printTitles?: {
|
|
131
|
+
rows?: string;
|
|
132
|
+
columns?: string;
|
|
133
|
+
};
|
|
134
|
+
/** Center on page */
|
|
135
|
+
center?: {
|
|
136
|
+
horizontal?: boolean;
|
|
137
|
+
vertical?: boolean;
|
|
138
|
+
};
|
|
139
|
+
/** Print grid lines */
|
|
140
|
+
printGridLines?: boolean;
|
|
141
|
+
/** Print row and column headers */
|
|
142
|
+
printHeadings?: boolean;
|
|
143
|
+
/** Black and white */
|
|
144
|
+
blackAndWhite?: boolean;
|
|
145
|
+
/** Draft quality */
|
|
146
|
+
draft?: boolean;
|
|
147
|
+
/** Page order */
|
|
148
|
+
pageOrder?: 'downThenOver' | 'overThenDown';
|
|
149
|
+
/** Comments display */
|
|
150
|
+
comments?: 'none' | 'asDisplayed' | 'atEnd';
|
|
151
|
+
/** Errors display */
|
|
152
|
+
errors?: 'displayed' | 'blank' | 'dash' | 'NA';
|
|
153
|
+
/** First page number */
|
|
154
|
+
firstPageNumber?: number;
|
|
155
|
+
/** Horizontal DPI */
|
|
156
|
+
horizontalDpi?: number;
|
|
157
|
+
/** Vertical DPI */
|
|
158
|
+
verticalDpi?: number;
|
|
159
|
+
/** Header margin */
|
|
160
|
+
headerMargin?: number;
|
|
161
|
+
/** Footer margin */
|
|
162
|
+
footerMargin?: number;
|
|
163
|
+
/** Top margin */
|
|
164
|
+
topMargin?: number;
|
|
165
|
+
/** Bottom margin */
|
|
166
|
+
bottomMargin?: number;
|
|
167
|
+
/** Left margin */
|
|
168
|
+
leftMargin?: number;
|
|
169
|
+
/** Right margin */
|
|
170
|
+
rightMargin?: number;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Header/Footer configuration
|
|
174
|
+
*/
|
|
175
|
+
export interface HeaderFooter {
|
|
176
|
+
/** Different first page */
|
|
177
|
+
differentFirst?: boolean;
|
|
178
|
+
/** Different odd and even pages */
|
|
179
|
+
differentOddEven?: boolean;
|
|
180
|
+
/** Scale with document */
|
|
181
|
+
scaleWithDoc?: boolean;
|
|
182
|
+
/** Align with margins */
|
|
183
|
+
alignWithMargins?: boolean;
|
|
184
|
+
/** Odd page header */
|
|
185
|
+
oddHeader?: string;
|
|
186
|
+
/** Odd page footer */
|
|
187
|
+
oddFooter?: string;
|
|
188
|
+
/** Even page header */
|
|
189
|
+
evenHeader?: string;
|
|
190
|
+
/** Even page footer */
|
|
191
|
+
evenFooter?: string;
|
|
192
|
+
/** First page header */
|
|
193
|
+
firstHeader?: string;
|
|
194
|
+
/** First page footer */
|
|
195
|
+
firstFooter?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Auto-filter configuration
|
|
199
|
+
*/
|
|
200
|
+
export interface AutoFilter {
|
|
201
|
+
/** Filter range */
|
|
202
|
+
range: string;
|
|
203
|
+
/** Filter columns */
|
|
204
|
+
columns?: Record<number, {
|
|
205
|
+
/** Filter criteria */
|
|
206
|
+
criteria?: any;
|
|
207
|
+
/** Custom filters */
|
|
208
|
+
customFilters?: any[];
|
|
209
|
+
/** Dynamic filter */
|
|
210
|
+
dynamicFilter?: string;
|
|
211
|
+
/** Top 10 filter */
|
|
212
|
+
top10?: {
|
|
213
|
+
top?: boolean;
|
|
214
|
+
percent?: boolean;
|
|
215
|
+
val?: number;
|
|
216
|
+
};
|
|
217
|
+
/** Color filter */
|
|
218
|
+
colorFilter?: string;
|
|
219
|
+
/** Icon filter */
|
|
220
|
+
iconFilter?: string;
|
|
221
|
+
}>;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Table configuration
|
|
225
|
+
*/
|
|
226
|
+
export interface TableConfig {
|
|
227
|
+
/** Table name */
|
|
228
|
+
name: string;
|
|
229
|
+
/** Table range */
|
|
230
|
+
range: string;
|
|
231
|
+
/** Table style */
|
|
232
|
+
style?: string;
|
|
233
|
+
/** Header row */
|
|
234
|
+
headerRow?: boolean;
|
|
235
|
+
/** Total row */
|
|
236
|
+
totalRow?: boolean;
|
|
237
|
+
/** Banded rows */
|
|
238
|
+
bandedRows?: boolean;
|
|
239
|
+
/** Banded columns */
|
|
240
|
+
bandedColumns?: boolean;
|
|
241
|
+
/** First column */
|
|
242
|
+
firstColumn?: boolean;
|
|
243
|
+
/** Last column */
|
|
244
|
+
lastColumn?: boolean;
|
|
245
|
+
/** Show auto-filter */
|
|
246
|
+
showFilter?: boolean;
|
|
247
|
+
/** Table columns */
|
|
248
|
+
columns?: Array<{
|
|
249
|
+
name: string;
|
|
250
|
+
totalsRowFunction?: 'none' | 'sum' | 'min' | 'max' | 'average' | 'count' | 'countNums' | 'stdDev' | 'var' | 'custom';
|
|
251
|
+
totalsRowLabel?: string;
|
|
252
|
+
totalsRowFormula?: string;
|
|
253
|
+
}>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Pivot table configuration
|
|
257
|
+
*/
|
|
258
|
+
export interface PivotTableConfig {
|
|
259
|
+
/** Pivot table name */
|
|
260
|
+
name: string;
|
|
261
|
+
/** Source data range */
|
|
262
|
+
source: string;
|
|
263
|
+
/** Destination cell */
|
|
264
|
+
destination: string;
|
|
265
|
+
/** Row fields */
|
|
266
|
+
rows?: Array<{
|
|
267
|
+
name: string;
|
|
268
|
+
axis?: 'row' | 'column' | 'page' | 'data';
|
|
269
|
+
sort?: 'ascending' | 'descending' | 'manual';
|
|
270
|
+
position?: number;
|
|
271
|
+
}>;
|
|
272
|
+
/** Column fields */
|
|
273
|
+
columns?: Array<{
|
|
274
|
+
name: string;
|
|
275
|
+
axis?: 'row' | 'column' | 'page' | 'data';
|
|
276
|
+
sort?: 'ascending' | 'descending' | 'manual';
|
|
277
|
+
position?: number;
|
|
278
|
+
}>;
|
|
279
|
+
/** Data fields */
|
|
280
|
+
data?: Array<{
|
|
281
|
+
name: string;
|
|
282
|
+
summarize?: 'sum' | 'count' | 'average' | 'max' | 'min' | 'product' | 'countNums' | 'stdDev' | 'stdDevp' | 'var' | 'varp';
|
|
283
|
+
numberFormat?: string;
|
|
284
|
+
}>;
|
|
285
|
+
/** Page fields */
|
|
286
|
+
pages?: Array<{
|
|
287
|
+
name: string;
|
|
288
|
+
axis?: 'row' | 'column' | 'page' | 'data';
|
|
289
|
+
sort?: 'ascending' | 'descending' | 'manual';
|
|
290
|
+
position?: number;
|
|
291
|
+
}>;
|
|
292
|
+
/** Filter fields */
|
|
293
|
+
filters?: Array<{
|
|
294
|
+
name: string;
|
|
295
|
+
axis?: 'row' | 'column' | 'page' | 'data';
|
|
296
|
+
sort?: 'ascending' | 'descending' | 'manual';
|
|
297
|
+
position?: number;
|
|
298
|
+
}>;
|
|
299
|
+
/** Style */
|
|
300
|
+
style?: string;
|
|
301
|
+
/** Grand total columns */
|
|
302
|
+
grandTotalColumns?: boolean;
|
|
303
|
+
/** Grand total rows */
|
|
304
|
+
grandTotalRows?: boolean;
|
|
305
|
+
/** Show row headers */
|
|
306
|
+
showRowHeaders?: boolean;
|
|
307
|
+
/** Show column headers */
|
|
308
|
+
showColumnHeaders?: boolean;
|
|
309
|
+
/** Compact form */
|
|
310
|
+
compact?: boolean;
|
|
311
|
+
/** Outline form */
|
|
312
|
+
outline?: boolean;
|
|
313
|
+
/** Tabular form */
|
|
314
|
+
tabular?: boolean;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Chart configuration
|
|
318
|
+
*/
|
|
319
|
+
export interface ChartConfig {
|
|
320
|
+
/** Chart title */
|
|
321
|
+
title?: string;
|
|
322
|
+
/** Chart type */
|
|
323
|
+
type: 'area' | 'bar' | 'column' | 'line' | 'pie' | 'doughnut' | 'radar' | 'scatter' | 'stock' | 'surface' | 'bubble';
|
|
324
|
+
/** Data range */
|
|
325
|
+
dataRange: string;
|
|
326
|
+
/** X-axis range (for scatter) */
|
|
327
|
+
xAxisRange?: string;
|
|
328
|
+
/** Legend position */
|
|
329
|
+
legend?: 'top' | 'bottom' | 'left' | 'right' | 'corner' | 'none';
|
|
330
|
+
/** Chart size */
|
|
331
|
+
size?: {
|
|
332
|
+
width: number;
|
|
333
|
+
height: number;
|
|
334
|
+
};
|
|
335
|
+
/** Chart position */
|
|
336
|
+
position?: {
|
|
337
|
+
x: number;
|
|
338
|
+
y: number;
|
|
339
|
+
};
|
|
340
|
+
/** Chart style */
|
|
341
|
+
style?: number;
|
|
342
|
+
/** Show data labels */
|
|
343
|
+
showDataLabels?: boolean;
|
|
344
|
+
/** Show gridlines */
|
|
345
|
+
showGridlines?: boolean;
|
|
346
|
+
/** 3D */
|
|
347
|
+
threeD?: boolean;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Complete worksheet data structure
|
|
351
|
+
*/
|
|
352
|
+
export interface WorksheetData {
|
|
353
|
+
/** Sheet name */
|
|
354
|
+
name: string;
|
|
355
|
+
/** Rows in the sheet */
|
|
356
|
+
rows: RowData[];
|
|
357
|
+
/** Column definitions */
|
|
358
|
+
columns?: ColumnData[];
|
|
359
|
+
/** Merged cells */
|
|
360
|
+
mergeCells?: MergeCell[];
|
|
361
|
+
/** Frozen panes */
|
|
362
|
+
freezePane?: FreezePane;
|
|
363
|
+
/** Print options */
|
|
364
|
+
printOptions?: PrintOptions;
|
|
365
|
+
/** Sheet view settings */
|
|
366
|
+
sheetView?: SheetView;
|
|
367
|
+
/** Header/Footer */
|
|
368
|
+
headerFooter?: HeaderFooter;
|
|
369
|
+
/** Auto-filter */
|
|
370
|
+
autoFilter?: AutoFilter;
|
|
371
|
+
/** Tables */
|
|
372
|
+
tables?: TableConfig[];
|
|
373
|
+
/** Pivot tables */
|
|
374
|
+
pivotTables?: PivotTableConfig[];
|
|
375
|
+
/** Charts */
|
|
376
|
+
charts?: ChartConfig[];
|
|
377
|
+
/** Data validations */
|
|
378
|
+
dataValidations?: Record<string, DataValidation>;
|
|
379
|
+
/** Conditional formatting */
|
|
380
|
+
conditionalFormats?: Record<string, ConditionalFormatRule[]>;
|
|
381
|
+
/** Sheet protection password */
|
|
382
|
+
protection?: {
|
|
383
|
+
password?: string;
|
|
384
|
+
sheet?: boolean;
|
|
385
|
+
objects?: boolean;
|
|
386
|
+
scenarios?: boolean;
|
|
387
|
+
formatCells?: boolean;
|
|
388
|
+
formatColumns?: boolean;
|
|
389
|
+
formatRows?: boolean;
|
|
390
|
+
insertColumns?: boolean;
|
|
391
|
+
insertRows?: boolean;
|
|
392
|
+
insertHyperlinks?: boolean;
|
|
393
|
+
deleteColumns?: boolean;
|
|
394
|
+
deleteRows?: boolean;
|
|
395
|
+
sort?: boolean;
|
|
396
|
+
autoFilter?: boolean;
|
|
397
|
+
pivotTables?: boolean;
|
|
398
|
+
};
|
|
399
|
+
/** Sheet tab color */
|
|
400
|
+
tabColor?: string;
|
|
401
|
+
/** Sheet state (visible, hidden, veryHidden) */
|
|
402
|
+
state?: 'visible' | 'hidden' | 'veryHidden';
|
|
403
|
+
/** Background image */
|
|
404
|
+
background?: string;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Workbook properties
|
|
408
|
+
*/
|
|
409
|
+
export interface WorkbookProperties {
|
|
410
|
+
/** Creator name */
|
|
411
|
+
creator?: string;
|
|
412
|
+
/** Last modified by */
|
|
413
|
+
lastModifiedBy?: string;
|
|
414
|
+
/** Creation date */
|
|
415
|
+
created?: Date;
|
|
416
|
+
/** Last modified date */
|
|
417
|
+
modified?: Date;
|
|
418
|
+
/** Company name */
|
|
419
|
+
company?: string;
|
|
420
|
+
/** Manager name */
|
|
421
|
+
manager?: string;
|
|
422
|
+
/** Title */
|
|
423
|
+
title?: string;
|
|
424
|
+
/** Subject */
|
|
425
|
+
subject?: string;
|
|
426
|
+
/** Keywords */
|
|
427
|
+
keywords?: string;
|
|
428
|
+
/** Category */
|
|
429
|
+
category?: string;
|
|
430
|
+
/** Description */
|
|
431
|
+
description?: string;
|
|
432
|
+
/** Status */
|
|
433
|
+
status?: string;
|
|
434
|
+
/** Custom properties */
|
|
435
|
+
custom?: Record<string, string | number | boolean | Date>;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Workbook calculation properties
|
|
439
|
+
*/
|
|
440
|
+
export interface CalculationProperties {
|
|
441
|
+
/** Calculation mode */
|
|
442
|
+
calcMode?: 'auto' | 'autoNoTable' | 'manual';
|
|
443
|
+
/** Full calculation on load */
|
|
444
|
+
fullCalcOnLoad?: boolean;
|
|
445
|
+
/** Force full calculation */
|
|
446
|
+
forceFullCalc?: boolean;
|
|
447
|
+
/** Iteration */
|
|
448
|
+
iteration?: boolean;
|
|
449
|
+
/** Max iterations */
|
|
450
|
+
maxIterations?: number;
|
|
451
|
+
/** Max change */
|
|
452
|
+
maxChange?: number;
|
|
453
|
+
/** Reference style (A1 or R1C1) */
|
|
454
|
+
refMode?: 'A1' | 'R1C1';
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Complete workbook data structure
|
|
458
|
+
*/
|
|
459
|
+
export interface WorkbookData {
|
|
460
|
+
/** Worksheets in the workbook */
|
|
461
|
+
sheets: WorksheetData[];
|
|
462
|
+
/** Workbook properties */
|
|
463
|
+
properties?: WorkbookProperties;
|
|
464
|
+
/** Calculation properties */
|
|
465
|
+
calculation?: CalculationProperties;
|
|
466
|
+
/** Named ranges */
|
|
467
|
+
namedRanges?: Record<string, {
|
|
468
|
+
range: string;
|
|
469
|
+
localSheet?: number;
|
|
470
|
+
comment?: string;
|
|
471
|
+
hidden?: boolean;
|
|
472
|
+
}>;
|
|
473
|
+
/** External references */
|
|
474
|
+
externalReferences?: Array<{
|
|
475
|
+
name: string;
|
|
476
|
+
path: string;
|
|
477
|
+
type: 'dde' | 'ole' | 'external';
|
|
478
|
+
}>;
|
|
479
|
+
/** Active sheet index */
|
|
480
|
+
activeSheet?: number;
|
|
481
|
+
/** Selected tabs */
|
|
482
|
+
selectedTabs?: number[];
|
|
483
|
+
/** Tab ratio */
|
|
484
|
+
tabRatio?: number;
|
|
485
|
+
/** First visible tab */
|
|
486
|
+
firstVisibleTab?: number;
|
|
487
|
+
/** Workbook views */
|
|
488
|
+
views?: Array<{
|
|
489
|
+
activeTab?: number;
|
|
490
|
+
firstSheet?: number;
|
|
491
|
+
showHorizontalScroll?: boolean;
|
|
492
|
+
showVerticalScroll?: boolean;
|
|
493
|
+
showSheetTabs?: boolean;
|
|
494
|
+
xWindow?: number;
|
|
495
|
+
yWindow?: number;
|
|
496
|
+
windowWidth?: number;
|
|
497
|
+
windowHeight?: number;
|
|
498
|
+
tabRatio?: number;
|
|
499
|
+
}>;
|
|
500
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format currency values
|
|
3
|
+
*/
|
|
4
|
+
export declare const formatCurrency: (value: number) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Format date values
|
|
7
|
+
*/
|
|
8
|
+
export declare const formatDate: (date: string | Date) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Format number with commas
|
|
11
|
+
*/
|
|
12
|
+
export declare const formatNumber: (num: number) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Truncate text with ellipsis
|
|
15
|
+
*/
|
|
16
|
+
export declare const truncateText: (text: string, maxLength: number) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Generate random ID
|
|
19
|
+
*/
|
|
20
|
+
export declare const generateId: () => string;
|
|
21
|
+
/**
|
|
22
|
+
* Debounce function
|
|
23
|
+
*/
|
|
24
|
+
export declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => ((...args: Parameters<T>) => void);
|
|
25
|
+
/**
|
|
26
|
+
* Group array by key
|
|
27
|
+
*/
|
|
28
|
+
export declare const groupBy: <T>(array: T[], key: keyof T) => Record<string, T[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate percentage
|
|
31
|
+
*/
|
|
32
|
+
export declare const calculatePercentage: (value: number, total: number) => number;
|
|
33
|
+
/**
|
|
34
|
+
* Download file
|
|
35
|
+
*/
|
|
36
|
+
export declare const downloadFile: (content: string, filename: string, type: string) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Workbook } from '../core/workbook';
|
|
2
|
+
import { ExportOptions } from '../types';
|
|
3
|
+
export declare class ExcelWriter {
|
|
4
|
+
static write(workbook: Workbook, _options: ExportOptions): Promise<Blob>;
|
|
5
|
+
private static generateExcelData;
|
|
6
|
+
private static generateSheetData;
|
|
7
|
+
private static getSheetRange;
|
|
8
|
+
private static columnToLetter;
|
|
9
|
+
private static createExcelFile;
|
|
10
|
+
private static generateWorkbookXML;
|
|
11
|
+
}
|
|
12
|
+
export declare class ExportBuilder {
|
|
13
|
+
private workbook;
|
|
14
|
+
constructor(workbook: Workbook);
|
|
15
|
+
download(options?: ExportOptions): void;
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sheetra",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Powerful Excel/CSV/JSON export library with zero dependencies",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"excel",
|
|
15
|
+
"csv",
|
|
16
|
+
"json",
|
|
17
|
+
"export",
|
|
18
|
+
"spreadsheet",
|
|
19
|
+
"xlsx",
|
|
20
|
+
"data-export",
|
|
21
|
+
"zero-dependencies"
|
|
22
|
+
],
|
|
23
|
+
"author": "Your Name",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": ""
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": ""
|
|
31
|
+
},
|
|
32
|
+
"homepage": "",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=12.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@jest/types": "^30.2.0",
|
|
38
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
39
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
40
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
41
|
+
"@types/jest": "^29.0.0",
|
|
42
|
+
"@types/node": "^18.0.0",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
44
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
45
|
+
"eslint": "^8.0.0",
|
|
46
|
+
"eslint-config-prettier": "^8.0.0",
|
|
47
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
48
|
+
"jest": "^29.0.0",
|
|
49
|
+
"prettier": "^2.0.0",
|
|
50
|
+
"rollup": "^3.0.0",
|
|
51
|
+
"rollup-plugin-dts": "^5.0.0",
|
|
52
|
+
"rollup-plugin-terser": "^7.0.0",
|
|
53
|
+
"ts-jest": "^29.0.0",
|
|
54
|
+
"ts-node": "^10.9.2",
|
|
55
|
+
"tslib": "^2.0.0",
|
|
56
|
+
"typescript": "^5.0.0"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rollup -c",
|
|
60
|
+
"dev": "rollup -c -w",
|
|
61
|
+
"test": "jest",
|
|
62
|
+
"test:watch": "jest --watch",
|
|
63
|
+
"test:coverage": "jest --coverage",
|
|
64
|
+
"test:ci": "jest --ci --coverage --maxWorkers=2",
|
|
65
|
+
"test:unit": "jest test/unit",
|
|
66
|
+
"test:integration": "jest test/integration",
|
|
67
|
+
"test:performance": "jest test/performance --runInBand",
|
|
68
|
+
"test:core": "jest test/unit/core",
|
|
69
|
+
"test:builders": "jest test/unit/builders",
|
|
70
|
+
"test:writers": "jest test/unit/writers",
|
|
71
|
+
"test:formatters": "jest test/unit/formatters",
|
|
72
|
+
"test:utils": "jest test/unit/utils",
|
|
73
|
+
"test:changed": "jest --onlyChanged",
|
|
74
|
+
"test:related": "jest --findRelatedTests",
|
|
75
|
+
"test:verbose": "jest --verbose",
|
|
76
|
+
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
77
|
+
"test:clear": "jest --clearCache",
|
|
78
|
+
"test:updateSnapshot": "jest --updateSnapshot",
|
|
79
|
+
"test:coverage:html": "jest --coverage && open coverage/index.html",
|
|
80
|
+
"test:ci:coverage": "jest --ci --coverage --coverageReporters=text-lcov | coveralls",
|
|
81
|
+
"test:badges": "jest --coverage && jest-coverage-badges output ./coverage",
|
|
82
|
+
"lint": "eslint src/**/*.ts",
|
|
83
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
84
|
+
"preversion": "npm run lint",
|
|
85
|
+
"version": "npm run format && git add -A src",
|
|
86
|
+
"postversion": "git push && git push --tags"
|
|
87
|
+
}
|
|
88
|
+
}
|