@nocobase/plugin-action-import 1.0.0-alpha.1

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.
Files changed (76) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +222 -0
  3. package/README.zh-CN.md +222 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/ImportActionInitializer.d.ts +9 -0
  7. package/dist/client/ImportDesigner.d.ts +2 -0
  8. package/dist/client/ImportModal.d.ts +6 -0
  9. package/dist/client/ImportPluginProvider.d.ts +3 -0
  10. package/dist/client/constants.d.ts +1 -0
  11. package/dist/client/context.d.ts +29 -0
  12. package/dist/client/index.d.ts +9 -0
  13. package/dist/client/index.js +24 -0
  14. package/dist/client/locale/index.d.ts +2 -0
  15. package/dist/client/schemaSettings.d.ts +2 -0
  16. package/dist/client/useFields.d.ts +1 -0
  17. package/dist/client/useImportAction.d.ts +6 -0
  18. package/dist/client/useShared.d.ts +76 -0
  19. package/dist/externalVersion.js +18 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.js +43 -0
  22. package/dist/locale/en-US.json +28 -0
  23. package/dist/locale/es-ES.json +27 -0
  24. package/dist/locale/ko_KR.json +28 -0
  25. package/dist/locale/pt-BR.json +27 -0
  26. package/dist/locale/zh-CN.json +29 -0
  27. package/dist/node_modules/node-xlsx/lib/helpers.js +142 -0
  28. package/dist/node_modules/node-xlsx/lib/index.js +6 -0
  29. package/dist/node_modules/node-xlsx/lib/workbook.js +16 -0
  30. package/dist/node_modules/node-xlsx/package.json +1 -0
  31. package/dist/node_modules/xlsx/LICENSE +201 -0
  32. package/dist/node_modules/xlsx/bin/xlsx.njs +302 -0
  33. package/dist/node_modules/xlsx/bower.json +22 -0
  34. package/dist/node_modules/xlsx/dist/cpexcel.js +1506 -0
  35. package/dist/node_modules/xlsx/dist/jszip.js +9000 -0
  36. package/dist/node_modules/xlsx/dist/shim.min.js +2 -0
  37. package/dist/node_modules/xlsx/dist/xlsx.core.min.js +18 -0
  38. package/dist/node_modules/xlsx/dist/xlsx.extendscript.js +31850 -0
  39. package/dist/node_modules/xlsx/dist/xlsx.full.min.js +24 -0
  40. package/dist/node_modules/xlsx/dist/xlsx.js +22693 -0
  41. package/dist/node_modules/xlsx/dist/xlsx.min.js +15 -0
  42. package/dist/node_modules/xlsx/dist/xlsx.mini.min.js +9 -0
  43. package/dist/node_modules/xlsx/jszip.js +9000 -0
  44. package/dist/node_modules/xlsx/package.json +1 -0
  45. package/dist/node_modules/xlsx/types/index.d.ts +853 -0
  46. package/dist/node_modules/xlsx/xlsx.js +6 -0
  47. package/dist/node_modules/xlsx/xlsx.mini.js +10709 -0
  48. package/dist/node_modules/xlsx/xlsxworker.js +15 -0
  49. package/dist/server/actions/downloadXlsxTemplate.d.ts +2 -0
  50. package/dist/server/actions/downloadXlsxTemplate.js +62 -0
  51. package/dist/server/actions/importXlsx.d.ts +2 -0
  52. package/dist/server/actions/importXlsx.js +185 -0
  53. package/dist/server/actions/index.d.ts +2 -0
  54. package/dist/server/actions/index.js +23 -0
  55. package/dist/server/index.d.ts +7 -0
  56. package/dist/server/index.js +59 -0
  57. package/dist/server/locale/en-US.d.ts +11 -0
  58. package/dist/server/locale/en-US.js +32 -0
  59. package/dist/server/locale/fr-FR.d.ts +11 -0
  60. package/dist/server/locale/fr-FR.js +32 -0
  61. package/dist/server/locale/index.d.ts +2 -0
  62. package/dist/server/locale/index.js +40 -0
  63. package/dist/server/locale/zh-CN.d.ts +12 -0
  64. package/dist/server/locale/zh-CN.js +33 -0
  65. package/dist/server/middleware/index.d.ts +2 -0
  66. package/dist/server/middleware/index.js +34 -0
  67. package/dist/server/migrations/20240425223956-change-locale-module.d.ts +6 -0
  68. package/dist/server/migrations/20240425223956-change-locale-module.js +42 -0
  69. package/dist/server/utils/index.d.ts +6 -0
  70. package/dist/server/utils/index.js +54 -0
  71. package/dist/server/utils/transform.d.ts +84 -0
  72. package/dist/server/utils/transform.js +226 -0
  73. package/dist/swagger/index.json +33 -0
  74. package/package.json +41 -0
  75. package/server.d.ts +2 -0
  76. package/server.js +1 -0
@@ -0,0 +1,853 @@
1
+ /* index.d.ts (C) 2015-present SheetJS and contributors */
2
+ // TypeScript Version: 2.2
3
+ import * as CFB from "cfb";
4
+ import * as SSF from "ssf";
5
+
6
+ /** Version string */
7
+ export const version: string;
8
+
9
+ /** SSF Formatter Library */
10
+ export { SSF };
11
+
12
+ /** CFB Library */
13
+ export { CFB };
14
+
15
+ /** NODE ONLY! Attempts to read filename and parse */
16
+ export function readFile(filename: string, opts?: ParsingOptions): WorkBook;
17
+ /** Attempts to parse data */
18
+ export function read(data: any, opts?: ParsingOptions): WorkBook;
19
+ /** Attempts to write or download workbook data to file */
20
+ export function writeFile(data: WorkBook, filename: string, opts?: WritingOptions): any;
21
+ /** Attempts to write or download workbook data to file asynchronously */
22
+ type CBFunc = () => void;
23
+ export function writeFileAsync(filename: string, data: WorkBook, opts: WritingOptions | CBFunc, cb?: CBFunc): any;
24
+ /** Attempts to write the workbook data */
25
+ export function write(data: WorkBook, opts?: WritingOptions): any;
26
+
27
+ /** Utility Functions */
28
+ export const utils: XLSX$Utils;
29
+ /** Stream Utility Functions */
30
+ export const stream: StreamUtils;
31
+
32
+ /** Number Format (either a string or an index to the format table) */
33
+ export type NumberFormat = string | number;
34
+
35
+ /** Worksheet specifier (string, number, worksheet) */
36
+ export type WSSpec = string | number | WorkSheet;
37
+
38
+ /** Range specifier (string or range or cell), single-cell lifted to range */
39
+ export type RangeSpec = string | Range | CellAddress;
40
+
41
+ /** Basic File Properties */
42
+ export interface Properties {
43
+ /** Summary tab "Title" */
44
+ Title?: string;
45
+ /** Summary tab "Subject" */
46
+ Subject?: string;
47
+ /** Summary tab "Author" */
48
+ Author?: string;
49
+ /** Summary tab "Manager" */
50
+ Manager?: string;
51
+ /** Summary tab "Company" */
52
+ Company?: string;
53
+ /** Summary tab "Category" */
54
+ Category?: string;
55
+ /** Summary tab "Keywords" */
56
+ Keywords?: string;
57
+ /** Summary tab "Comments" */
58
+ Comments?: string;
59
+ /** Statistics tab "Last saved by" */
60
+ LastAuthor?: string;
61
+ /** Statistics tab "Created" */
62
+ CreatedDate?: Date;
63
+ }
64
+
65
+ /** Other supported properties */
66
+ export interface FullProperties extends Properties {
67
+ ModifiedDate?: Date;
68
+ Application?: string;
69
+ AppVersion?: string;
70
+ DocSecurity?: string;
71
+ HyperlinksChanged?: boolean;
72
+ SharedDoc?: boolean;
73
+ LinksUpToDate?: boolean;
74
+ ScaleCrop?: boolean;
75
+ Worksheets?: number;
76
+ SheetNames?: string[];
77
+ ContentStatus?: string;
78
+ LastPrinted?: string;
79
+ Revision?: string | number;
80
+ Version?: string;
81
+ Identifier?: string;
82
+ Language?: string;
83
+ }
84
+
85
+ export interface CommonOptions {
86
+ /**
87
+ * If true, throw errors when features are not understood
88
+ * @default false
89
+ */
90
+ WTF?: boolean;
91
+
92
+ /**
93
+ * When reading a file with VBA macros, expose CFB blob to `vbaraw` field
94
+ * When writing BIFF8/XLSB/XLSM, reseat `vbaraw` and export to file
95
+ * @default false
96
+ */
97
+ bookVBA?: boolean;
98
+
99
+ /**
100
+ * When reading a file, store dates as type d (default is n)
101
+ * When writing XLSX/XLSM file, use native date (default uses date codes)
102
+ * @default false
103
+ */
104
+ cellDates?: boolean;
105
+
106
+ /**
107
+ * Create cell objects for stub cells
108
+ * @default false
109
+ */
110
+ sheetStubs?: boolean;
111
+
112
+ /**
113
+ * When reading a file, save style/theme info to the .s field
114
+ * When writing a file, export style/theme info
115
+ * @default false
116
+ */
117
+ cellStyles?: boolean;
118
+
119
+ /**
120
+ * If defined and file is encrypted, use password
121
+ * @default ''
122
+ */
123
+ password?: string;
124
+ }
125
+
126
+ export interface DateNFOption {
127
+ /** Use specified date format */
128
+ dateNF?: NumberFormat;
129
+ }
130
+
131
+ /** Options for read and readFile */
132
+ export interface ParsingOptions extends CommonOptions {
133
+ /** Input data encoding */
134
+ type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
135
+
136
+ /** Default codepage */
137
+ codepage?: number;
138
+
139
+ /**
140
+ * Save formulae to the .f field
141
+ * @default true
142
+ */
143
+ cellFormula?: boolean;
144
+
145
+ /**
146
+ * Parse rich text and save HTML to the .h field
147
+ * @default true
148
+ */
149
+ cellHTML?: boolean;
150
+
151
+ /**
152
+ * Save number format string to the .z field
153
+ * @default false
154
+ */
155
+ cellNF?: boolean;
156
+
157
+ /**
158
+ * Generate formatted text to the .w field
159
+ * @default true
160
+ */
161
+ cellText?: boolean;
162
+
163
+ /** Override default date format (code 14) */
164
+ dateNF?: string;
165
+
166
+ /** Field Separator ("Delimiter" override) */
167
+ FS?: string;
168
+
169
+ /**
170
+ * If >0, read the first sheetRows rows
171
+ * @default 0
172
+ */
173
+ sheetRows?: number;
174
+
175
+ /**
176
+ * If true, parse calculation chains
177
+ * @default false
178
+ */
179
+ bookDeps?: boolean;
180
+
181
+ /**
182
+ * If true, add raw files to book object
183
+ * @default false
184
+ */
185
+ bookFiles?: boolean;
186
+
187
+ /**
188
+ * If true, only parse enough to get book metadata
189
+ * @default false
190
+ */
191
+ bookProps?: boolean;
192
+
193
+ /**
194
+ * If true, only parse enough to get the sheet names
195
+ * @default false
196
+ */
197
+ bookSheets?: boolean;
198
+
199
+ /** If specified, only parse the specified sheets or sheet names */
200
+ sheets?: number | string | Array<number | string>;
201
+
202
+ /** If true, plaintext parsing will not parse values */
203
+ raw?: boolean;
204
+
205
+ dense?: boolean;
206
+ }
207
+
208
+ /** Options for write and writeFile */
209
+ export interface WritingOptions extends CommonOptions {
210
+ /** Output data encoding */
211
+ type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
212
+
213
+ /**
214
+ * Generate Shared String Table
215
+ * @default false
216
+ */
217
+ bookSST?: boolean;
218
+
219
+ /**
220
+ * File format of generated workbook
221
+ * @default 'xlsx'
222
+ */
223
+ bookType?: BookType;
224
+
225
+ /**
226
+ * Name of Worksheet (for single-sheet formats)
227
+ * @default ''
228
+ */
229
+ sheet?: string;
230
+
231
+ /**
232
+ * Use ZIP compression for ZIP-based formats
233
+ * @default false
234
+ */
235
+ compression?: boolean;
236
+
237
+ /**
238
+ * Suppress "number stored as text" errors in generated files
239
+ * @default true
240
+ */
241
+ ignoreEC?: boolean;
242
+
243
+ /** Override workbook properties on save */
244
+ Props?: Properties;
245
+ }
246
+
247
+ /** Workbook Object */
248
+ export interface WorkBook {
249
+ /**
250
+ * A dictionary of the worksheets in the workbook.
251
+ * Use SheetNames to reference these.
252
+ */
253
+ Sheets: { [sheet: string]: WorkSheet };
254
+
255
+ /** Ordered list of the sheet names in the workbook */
256
+ SheetNames: string[];
257
+
258
+ /** Standard workbook Properties */
259
+ Props?: FullProperties;
260
+
261
+ /** Custom workbook Properties */
262
+ Custprops?: any;
263
+
264
+ Workbook?: WBProps;
265
+
266
+ vbaraw?: any;
267
+ }
268
+
269
+ export interface SheetProps {
270
+ /** Name of Sheet */
271
+ name?: string;
272
+
273
+ /** Sheet Visibility (0=Visible 1=Hidden 2=VeryHidden) */
274
+ Hidden?: 0 | 1 | 2;
275
+
276
+ /** Name of Document Module in associated VBA Project */
277
+ CodeName?: string;
278
+ }
279
+
280
+ /** Defined Name Object */
281
+ export interface DefinedName {
282
+ /** Name */
283
+ Name: string;
284
+
285
+ /** Reference */
286
+ Ref: string;
287
+
288
+ /** Scope (undefined for workbook scope) */
289
+ Sheet?: number;
290
+
291
+ /** Name comment */
292
+ Comment?: string;
293
+ }
294
+
295
+ /** Workbook-Level Attributes */
296
+ export interface WBProps {
297
+ /** Sheet Properties */
298
+ Sheets?: SheetProps[];
299
+
300
+ /** Defined Names */
301
+ Names?: DefinedName[];
302
+
303
+ /** Workbook Views */
304
+ Views?: WBView[];
305
+
306
+ /** Other Workbook Properties */
307
+ WBProps?: WorkbookProperties;
308
+ }
309
+
310
+ /** Workbook View */
311
+ export interface WBView {
312
+ /** Right-to-left mode */
313
+ RTL?: boolean;
314
+ }
315
+
316
+ /** Other Workbook Properties */
317
+ export interface WorkbookProperties {
318
+ /** Worksheet Epoch (1904 if true, 1900 if false) */
319
+ date1904?: boolean;
320
+
321
+ /** Warn or strip personally identifying info on save */
322
+ filterPrivacy?: boolean;
323
+
324
+ /** Name of Document Module in associated VBA Project */
325
+ CodeName?: string;
326
+ }
327
+
328
+ /** Column Properties Object */
329
+ export interface ColInfo {
330
+ /* --- visibility --- */
331
+
332
+ /** if true, the column is hidden */
333
+ hidden?: boolean;
334
+
335
+ /* --- column width --- */
336
+
337
+ /** width in Excel's "Max Digit Width", width*256 is integral */
338
+ width?: number;
339
+
340
+ /** width in screen pixels */
341
+ wpx?: number;
342
+
343
+ /** width in "characters" */
344
+ wch?: number;
345
+
346
+ /** outline / group level */
347
+ level?: number;
348
+
349
+ /** Excel's "Max Digit Width" unit, always integral */
350
+ MDW?: number;
351
+ }
352
+
353
+ /** Row Properties Object */
354
+ export interface RowInfo {
355
+ /* --- visibility --- */
356
+
357
+ /** if true, the column is hidden */
358
+ hidden?: boolean;
359
+
360
+ /* --- row height --- */
361
+
362
+ /** height in screen pixels */
363
+ hpx?: number;
364
+
365
+ /** height in points */
366
+ hpt?: number;
367
+
368
+ /** outline / group level */
369
+ level?: number;
370
+ }
371
+
372
+ /**
373
+ * Write sheet protection properties.
374
+ */
375
+ export interface ProtectInfo {
376
+ /**
377
+ * The password for formats that support password-protected sheets
378
+ * (XLSX/XLSB/XLS). The writer uses the XOR obfuscation method.
379
+ */
380
+ password?: string;
381
+ /**
382
+ * Select locked cells
383
+ * @default: true
384
+ */
385
+ selectLockedCells?: boolean;
386
+ /**
387
+ * Select unlocked cells
388
+ * @default: true
389
+ */
390
+ selectUnlockedCells?: boolean;
391
+ /**
392
+ * Format cells
393
+ * @default: false
394
+ */
395
+ formatCells?: boolean;
396
+ /**
397
+ * Format columns
398
+ * @default: false
399
+ */
400
+ formatColumns?: boolean;
401
+ /**
402
+ * Format rows
403
+ * @default: false
404
+ */
405
+ formatRows?: boolean;
406
+ /**
407
+ * Insert columns
408
+ * @default: false
409
+ */
410
+ insertColumns?: boolean;
411
+ /**
412
+ * Insert rows
413
+ * @default: false
414
+ */
415
+ insertRows?: boolean;
416
+ /**
417
+ * Insert hyperlinks
418
+ * @default: false
419
+ */
420
+ insertHyperlinks?: boolean;
421
+ /**
422
+ * Delete columns
423
+ * @default: false
424
+ */
425
+ deleteColumns?: boolean;
426
+ /**
427
+ * Delete rows
428
+ * @default: false
429
+ */
430
+ deleteRows?: boolean;
431
+ /**
432
+ * Sort
433
+ * @default: false
434
+ */
435
+ sort?: boolean;
436
+ /**
437
+ * Filter
438
+ * @default: false
439
+ */
440
+ autoFilter?: boolean;
441
+ /**
442
+ * Use PivotTable reports
443
+ * @default: false
444
+ */
445
+ pivotTables?: boolean;
446
+ /**
447
+ * Edit objects
448
+ * @default: true
449
+ */
450
+ objects?: boolean;
451
+ /**
452
+ * Edit scenarios
453
+ * @default: true
454
+ */
455
+ scenarios?: boolean;
456
+ }
457
+
458
+ /** Page Margins -- see Excel Page Setup .. Margins diagram for explanation */
459
+ export interface MarginInfo {
460
+ /** Left side margin (inches) */
461
+ left?: number;
462
+ /** Right side margin (inches) */
463
+ right?: number;
464
+ /** Top side margin (inches) */
465
+ top?: number;
466
+ /** Bottom side margin (inches) */
467
+ bottom?: number;
468
+ /** Header top margin (inches) */
469
+ header?: number;
470
+ /** Footer bottom height (inches) */
471
+ footer?: number;
472
+ }
473
+ export type SheetType = 'sheet' | 'chart';
474
+ export type SheetKeys = string | MarginInfo | SheetType;
475
+ /** General object representing a Sheet (worksheet or chartsheet) */
476
+ export interface Sheet {
477
+ /**
478
+ * Indexing with a cell address string maps to a cell object
479
+ * Special keys start with '!'
480
+ */
481
+ [cell: string]: CellObject | SheetKeys | any;
482
+
483
+ /** Sheet type */
484
+ '!type'?: SheetType;
485
+
486
+ /** Sheet Range */
487
+ '!ref'?: string;
488
+
489
+ /** Page Margins */
490
+ '!margins'?: MarginInfo;
491
+ }
492
+
493
+ /** AutoFilter properties */
494
+ export interface AutoFilterInfo {
495
+ /** Range of the AutoFilter table */
496
+ ref: string;
497
+ }
498
+
499
+ export type WSKeys = SheetKeys | ColInfo[] | RowInfo[] | Range[] | ProtectInfo | AutoFilterInfo;
500
+
501
+ /** Worksheet Object */
502
+ export interface WorkSheet extends Sheet {
503
+ /**
504
+ * Indexing with a cell address string maps to a cell object
505
+ * Special keys start with '!'
506
+ */
507
+ [cell: string]: CellObject | WSKeys | any;
508
+
509
+ /** Column Info */
510
+ '!cols'?: ColInfo[];
511
+
512
+ /** Row Info */
513
+ '!rows'?: RowInfo[];
514
+
515
+ /** Merge Ranges */
516
+ '!merges'?: Range[];
517
+
518
+ /** Worksheet Protection info */
519
+ '!protect'?: ProtectInfo;
520
+
521
+ /** AutoFilter info */
522
+ '!autofilter'?: AutoFilterInfo;
523
+ }
524
+
525
+ /**
526
+ * Worksheet Object with CellObject type
527
+ *
528
+ * The normal Worksheet type uses indexer of type `any` -- this enforces CellObject
529
+ */
530
+ export interface StrictWS { [addr: string]: CellObject; }
531
+
532
+ /**
533
+ * The Excel data type for a cell.
534
+ * b Boolean, n Number, e error, s String, d Date, z Stub
535
+ */
536
+ export type ExcelDataType = 'b' | 'n' | 'e' | 's' | 'd' | 'z';
537
+
538
+ /**
539
+ * Type of generated workbook
540
+ * @default 'xlsx'
541
+ */
542
+ export type BookType = 'xlsx' | 'xlsm' | 'xlsb' | 'xls' | 'xla' | 'biff8' | 'biff5' | 'biff2' | 'xlml' | 'ods' | 'fods' | 'csv' | 'txt' | 'sylk' | 'html' | 'dif' | 'rtf' | 'prn' | 'eth';
543
+
544
+ /** Comment element */
545
+ export interface Comment {
546
+ /** Author of the comment block */
547
+ a?: string;
548
+
549
+ /** Plaintext of the comment */
550
+ t: string;
551
+ }
552
+
553
+ /** Cell comments */
554
+ export interface Comments extends Array<Comment> {
555
+ /** Hide comment by default */
556
+ hidden?: boolean;
557
+ }
558
+
559
+ /** Link object */
560
+ export interface Hyperlink {
561
+ /** Target of the link (HREF) */
562
+ Target: string;
563
+
564
+ /** Plaintext tooltip to display when mouse is over cell */
565
+ Tooltip?: string;
566
+ }
567
+
568
+ /** Worksheet Cell Object */
569
+ export interface CellObject {
570
+ /** The raw value of the cell. Can be omitted if a formula is specified */
571
+ v?: string | number | boolean | Date;
572
+
573
+ /** Formatted text (if applicable) */
574
+ w?: string;
575
+
576
+ /**
577
+ * The Excel Data Type of the cell.
578
+ * b Boolean, n Number, e Error, s String, d Date, z Empty
579
+ */
580
+ t: ExcelDataType;
581
+
582
+ /** Cell formula (if applicable) */
583
+ f?: string;
584
+
585
+ /** Range of enclosing array if formula is array formula (if applicable) */
586
+ F?: string;
587
+
588
+ /** Rich text encoding (if applicable) */
589
+ r?: any;
590
+
591
+ /** HTML rendering of the rich text (if applicable) */
592
+ h?: string;
593
+
594
+ /** Comments associated with the cell */
595
+ c?: Comments;
596
+
597
+ /** Number format string associated with the cell (if requested) */
598
+ z?: NumberFormat;
599
+
600
+ /** Cell hyperlink object (.Target holds link, .tooltip is tooltip) */
601
+ l?: Hyperlink;
602
+
603
+ /** The style/theme of the cell (if applicable) */
604
+ s?: any;
605
+ }
606
+
607
+ /** Simple Cell Address */
608
+ export interface CellAddress {
609
+ /** Column number */
610
+ c: number;
611
+ /** Row number */
612
+ r: number;
613
+ }
614
+
615
+ /** Range object (representing ranges like "A1:B2") */
616
+ export interface Range {
617
+ /** Starting cell */
618
+ s: CellAddress;
619
+ /** Ending cell */
620
+ e: CellAddress;
621
+ }
622
+
623
+ export interface Sheet2CSVOpts extends DateNFOption {
624
+ /** Field Separator ("delimiter") */
625
+ FS?: string;
626
+
627
+ /** Record Separator ("row separator") */
628
+ RS?: string;
629
+
630
+ /** Remove trailing field separators in each record */
631
+ strip?: boolean;
632
+
633
+ /** Include blank lines in the CSV output */
634
+ blankrows?: boolean;
635
+
636
+ /** Skip hidden rows and columns in the CSV output */
637
+ skipHidden?: boolean;
638
+
639
+ /** Force quotes around fields */
640
+ forceQuotes?: boolean;
641
+
642
+ /** if true, return raw numbers; if false, return formatted numbers */
643
+ rawNumbers?: boolean;
644
+ }
645
+
646
+ export interface OriginOption {
647
+ /** Top-Left cell for operation (CellAddress or A1 string or row) */
648
+ origin?: number | string | CellAddress;
649
+ }
650
+
651
+ export interface Sheet2HTMLOpts {
652
+ /** TABLE element id attribute */
653
+ id?: string;
654
+
655
+ /** Add contenteditable to every cell */
656
+ editable?: boolean;
657
+
658
+ /** Header HTML */
659
+ header?: string;
660
+
661
+ /** Footer HTML */
662
+ footer?: string;
663
+ }
664
+
665
+ export interface Sheet2JSONOpts extends DateNFOption {
666
+ /** Output format */
667
+ header?: "A"|number|string[];
668
+
669
+ /** Override worksheet range */
670
+ range?: any;
671
+
672
+ /** Include or omit blank lines in the output */
673
+ blankrows?: boolean;
674
+
675
+ /** Default value for null/undefined values */
676
+ defval?: any;
677
+
678
+ /** if true, return raw data; if false, return formatted text */
679
+ raw?: boolean;
680
+
681
+ /** if true, return raw numbers; if false, return formatted numbers */
682
+ rawNumbers?: boolean;
683
+ }
684
+
685
+ export interface AOA2SheetOpts extends CommonOptions, DateNFOption {
686
+ /**
687
+ * Create cell objects for stub cells
688
+ * @default false
689
+ */
690
+ sheetStubs?: boolean;
691
+ }
692
+
693
+ export interface SheetAOAOpts extends AOA2SheetOpts, OriginOption {}
694
+
695
+ export interface JSON2SheetOpts extends CommonOptions, DateNFOption {
696
+ /** Use specified column order */
697
+ header?: string[];
698
+
699
+ /** Skip header row in generated sheet */
700
+ skipHeader?: boolean;
701
+ }
702
+
703
+ export interface SheetJSONOpts extends JSON2SheetOpts, OriginOption {}
704
+
705
+ export interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOption {
706
+ /** If true, plaintext parsing will not parse values */
707
+ raw?: boolean;
708
+
709
+ /**
710
+ * If >0, read the first sheetRows rows
711
+ * @default 0
712
+ */
713
+ sheetRows?: number;
714
+
715
+ /** If true, hidden rows and cells will not be parsed */
716
+ display?: boolean;
717
+ }
718
+
719
+ /** General utilities */
720
+ export interface XLSX$Utils {
721
+ /* --- Import Functions --- */
722
+
723
+ /** Converts an array of arrays of JS data to a worksheet. */
724
+ aoa_to_sheet<T>(data: T[][], opts?: AOA2SheetOpts): WorkSheet;
725
+ aoa_to_sheet(data: any[][], opts?: AOA2SheetOpts): WorkSheet;
726
+
727
+ /** Converts an array of JS objects to a worksheet. */
728
+ json_to_sheet<T>(data: T[], opts?: JSON2SheetOpts): WorkSheet;
729
+ json_to_sheet(data: any[], opts?: JSON2SheetOpts): WorkSheet;
730
+
731
+ /** BROWSER ONLY! Converts a TABLE DOM element to a worksheet. */
732
+ table_to_sheet(data: any, opts?: Table2SheetOpts): WorkSheet;
733
+ table_to_book(data: any, opts?: Table2SheetOpts): WorkBook;
734
+ sheet_add_dom(ws: WorkSheet, data: any, opts?: Table2SheetOpts): WorkSheet;
735
+
736
+ /* --- Export Functions --- */
737
+
738
+ /** Converts a worksheet object to an array of JSON objects */
739
+ sheet_to_json<T>(worksheet: WorkSheet, opts?: Sheet2JSONOpts): T[];
740
+ sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[][];
741
+ sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[];
742
+
743
+ /** Generates delimiter-separated-values output */
744
+ sheet_to_csv(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
745
+
746
+ /** Generates UTF16 Formatted Text */
747
+ sheet_to_txt(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
748
+
749
+ /** Generates HTML */
750
+ sheet_to_html(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
751
+
752
+ /** Generates a list of the formulae (with value fallbacks) */
753
+ sheet_to_formulae(worksheet: WorkSheet): string[];
754
+
755
+ /** Generates DIF */
756
+ sheet_to_dif(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
757
+
758
+ /** Generates SYLK (Symbolic Link) */
759
+ sheet_to_slk(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
760
+
761
+ /** Generates ETH */
762
+ sheet_to_eth(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
763
+
764
+ /* --- Cell Address Utilities --- */
765
+
766
+ /** Converts 0-indexed cell address to A1 form */
767
+ encode_cell(cell: CellAddress): string;
768
+
769
+ /** Converts 0-indexed row to A1 form */
770
+ encode_row(row: number): string;
771
+
772
+ /** Converts 0-indexed column to A1 form */
773
+ encode_col(col: number): string;
774
+
775
+ /** Converts 0-indexed range to A1 form */
776
+ encode_range(s: CellAddress, e: CellAddress): string;
777
+ encode_range(r: Range): string;
778
+
779
+ /** Converts A1 cell address to 0-indexed form */
780
+ decode_cell(address: string): CellAddress;
781
+
782
+ /** Converts A1 row to 0-indexed form */
783
+ decode_row(row: string): number;
784
+
785
+ /** Converts A1 column to 0-indexed form */
786
+ decode_col(col: string): number;
787
+
788
+ /** Converts A1 range to 0-indexed form */
789
+ decode_range(range: string): Range;
790
+
791
+ /** Format cell */
792
+ format_cell(cell: CellObject, v?: any, opts?: any): string;
793
+
794
+ /* --- General Utilities --- */
795
+
796
+ /** Creates a new workbook */
797
+ book_new(): WorkBook;
798
+
799
+ /** Append a worksheet to a workbook */
800
+ book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string): void;
801
+
802
+ /** Set sheet visibility (visible/hidden/very hidden) */
803
+ book_set_sheet_visibility(workbook: WorkBook, sheet: number|string, visibility: number): void;
804
+
805
+ /** Set number format for a cell */
806
+ cell_set_number_format(cell: CellObject, fmt: string|number): CellObject;
807
+
808
+ /** Set hyperlink for a cell */
809
+ cell_set_hyperlink(cell: CellObject, target: string, tooltip?: string): CellObject;
810
+
811
+ /** Set internal link for a cell */
812
+ cell_set_internal_link(cell: CellObject, target: string, tooltip?: string): CellObject;
813
+
814
+ /** Add comment to a cell */
815
+ cell_add_comment(cell: CellObject, text: string, author?: string): void;
816
+
817
+ /** Assign an Array Formula to a range */
818
+ sheet_set_array_formula(ws: WorkSheet, range: Range|string, formula: string): WorkSheet;
819
+
820
+ /** Add an array of arrays of JS data to a worksheet */
821
+ sheet_add_aoa<T>(ws: WorkSheet, data: T[][], opts?: SheetAOAOpts): WorkSheet;
822
+ sheet_add_aoa(ws: WorkSheet, data: any[][], opts?: SheetAOAOpts): WorkSheet;
823
+
824
+ /** Add an array of JS objects to a worksheet */
825
+ sheet_add_json(ws: WorkSheet, data: any[], opts?: SheetJSONOpts): WorkSheet;
826
+ sheet_add_json<T>(ws: WorkSheet, data: T[], opts?: SheetJSONOpts): WorkSheet;
827
+
828
+
829
+ consts: XLSX$Consts;
830
+ }
831
+
832
+ export interface XLSX$Consts {
833
+ /* --- Sheet Visibility --- */
834
+
835
+ /** Visibility: Visible */
836
+ SHEET_VISIBLE: 0;
837
+
838
+ /** Visibility: Hidden */
839
+ SHEET_HIDDEN: 1;
840
+
841
+ /** Visibility: Very Hidden */
842
+ SHEET_VERYHIDDEN: 2;
843
+ }
844
+
845
+ /** NODE ONLY! these return Readable Streams */
846
+ export interface StreamUtils {
847
+ /** CSV output stream, generate one line at a time */
848
+ to_csv(sheet: WorkSheet, opts?: Sheet2CSVOpts): any;
849
+ /** HTML output stream, generate one line at a time */
850
+ to_html(sheet: WorkSheet, opts?: Sheet2HTMLOpts): any;
851
+ /** JSON object stream, generate one row at a time */
852
+ to_json(sheet: WorkSheet, opts?: Sheet2JSONOpts): any;
853
+ }