@nocobase/plugin-action-import 2.1.0-beta.44 → 2.1.0-beta.45

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.
@@ -14,9 +14,9 @@ export const SSF: any;
14
14
  // export { CFB };
15
15
  export const CFB: any;
16
16
 
17
- /** ESM ONLY! Set internal `fs` instance */
17
+ /** Set internal `fs` instance */
18
18
  export function set_fs(fs: any): void;
19
- /** ESM ONLY! Set internal codepage tables */
19
+ /** Set internal codepage tables */
20
20
  export function set_cptable(cptable: any): void;
21
21
 
22
22
  /** NODE ONLY! Attempts to read filename and parse */
@@ -24,12 +24,12 @@ export function readFile(filename: string, opts?: ParsingOptions): WorkBook;
24
24
  /** Attempts to parse data */
25
25
  export function read(data: any, opts?: ParsingOptions): WorkBook;
26
26
  /** Attempts to write or download workbook data to file */
27
- export function writeFile(data: WorkBook, filename: string, opts?: WritingOptions): any;
27
+ export function writeFile(data: WorkBook, filename: string, opts?: WritingOptions): void;
28
28
  /** Attempts to write or download workbook data to XLSX file */
29
- export function writeFileXLSX(data: WorkBook, filename: string, opts?: WritingOptions): any;
29
+ export function writeFileXLSX(data: WorkBook, filename: string, opts?: WritingOptions): void;
30
30
  /** Attempts to write or download workbook data to file asynchronously */
31
31
  type CBFunc = () => void;
32
- export function writeFileAsync(filename: string, data: WorkBook, opts: WritingOptions | CBFunc, cb?: CBFunc): any;
32
+ export function writeFileAsync(filename: string, data: WorkBook, opts: WritingOptions | CBFunc, cb?: CBFunc): void;
33
33
  /** Attempts to write the workbook data */
34
34
  export function write(data: WorkBook, opts: WritingOptions): any;
35
35
  /** Attempts to write the workbook data as XLSX */
@@ -139,12 +139,37 @@ export interface DateNFOption {
139
139
  dateNF?: NumberFormat;
140
140
  }
141
141
 
142
+ export interface UTCOption {
143
+ /**
144
+ * For plaintext formats, interpret ambiguous datetimes in UTC
145
+ * If explicitly set to `false`, dates will be parsed in local time.
146
+ *
147
+ * The `true` option is consistent with spreadsheet application export.
148
+ *
149
+ * @default true
150
+ */
151
+ UTC?: boolean;
152
+ }
153
+
154
+ export interface DenseOption {
155
+ /** If true, generate dense-mode worksheets */
156
+ dense?: boolean;
157
+ }
158
+
142
159
  /** Options for read and readFile */
143
- export interface ParsingOptions extends CommonOptions {
160
+ export interface ParsingOptions extends UTCOption, CommonOptions, DenseOption {
144
161
  /** Input data encoding */
145
162
  type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
146
163
 
147
- /** Default codepage */
164
+ /**
165
+ * Default codepage for legacy files
166
+ *
167
+ * This requires encoding support to be loaded. It is automatically loaded
168
+ * in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
169
+ * is required in React / Angular / Webpack ESM deployments.
170
+ *
171
+ * Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
172
+ */
148
173
  codepage?: number;
149
174
 
150
175
  /**
@@ -213,24 +238,24 @@ export interface ParsingOptions extends CommonOptions {
213
238
  /** If true, plaintext parsing will not parse values */
214
239
  raw?: boolean;
215
240
 
241
+ /** If true, ignore "dimensions" records and guess range using every cell */
242
+ nodim?: boolean;
243
+
216
244
  /** If true, preserve _xlfn. prefixes in formula function names */
217
245
  xlfn?: boolean;
218
246
 
219
- dense?: boolean;
247
+ /**
248
+ * For single-sheet formats (including CSV), override the worksheet name
249
+ * @default "Sheet1"
250
+ */
251
+ sheet?: string;
220
252
 
221
253
  PRN?: boolean;
222
254
  }
223
255
 
224
- export interface SheetOption {
225
- /**
226
- * Name of Worksheet (for single-sheet formats)
227
- * @default ''
228
- */
229
- sheet?: string;
230
- }
231
256
 
232
257
  /** Options for write and writeFile */
233
- export interface WritingOptions extends CommonOptions, SheetOption {
258
+ export interface WritingOptions extends CommonOptions {
234
259
  /** Output data encoding */
235
260
  type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
236
261
 
@@ -252,6 +277,9 @@ export interface WritingOptions extends CommonOptions, SheetOption {
252
277
  */
253
278
  compression?: boolean;
254
279
 
280
+ /** Override theme XML when exporting to XLSX/XLSM/XLSB */
281
+ themeXLSX?: string;
282
+
255
283
  /**
256
284
  * Suppress "number stored as text" errors in generated files
257
285
  * @default true
@@ -261,8 +289,34 @@ export interface WritingOptions extends CommonOptions, SheetOption {
261
289
  /** Override workbook properties on save */
262
290
  Props?: Properties;
263
291
 
292
+ /**
293
+ * Desired codepage for legacy file formats
294
+ *
295
+ * This requires encoding support to be loaded. It is automatically loaded
296
+ * in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
297
+ * is required in React / Angular / Webpack / ESM deployments.
298
+ *
299
+ * Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
300
+ */
301
+ codepage?: number;
302
+
264
303
  /** Base64 encoding of NUMBERS base for exports */
265
304
  numbers?: string;
305
+
306
+ /**
307
+ * For single-sheet formats, export the specified worksheet.
308
+ *
309
+ * The property must be a string (sheet name) or number (`SheetNames` index).
310
+ *
311
+ * If this option is omitted, the first worksheet will be exported.
312
+ */
313
+ sheet?: string | number;
314
+
315
+ /** Field Separator ("delimiter") for CSV / Text output */
316
+ FS?: string;
317
+
318
+ /** Record Separator ("row separator") for CSV / Text output */
319
+ RS?: string;
266
320
  }
267
321
 
268
322
  /** Workbook Object */
@@ -285,6 +339,9 @@ export interface WorkBook {
285
339
  Workbook?: WBProps;
286
340
 
287
341
  vbaraw?: any;
342
+
343
+ /** Original file type (when parsed with `read` or `readFile`) */
344
+ bookType?: BookType;
288
345
  }
289
346
 
290
347
  export interface SheetProps {
@@ -514,20 +571,52 @@ export type SheetKeys = string | MarginInfo | SheetType;
514
571
  /** General object representing a Sheet (worksheet or chartsheet) */
515
572
  export interface Sheet {
516
573
  /**
517
- * Indexing with a cell address string maps to a cell object
574
+ * Sparse-mode store cells with keys corresponding to A1-style address
575
+ * Dense-mode store cells in the '!data' key
518
576
  * Special keys start with '!'
519
577
  */
520
- [cell: string]: CellObject | SheetKeys | any;
578
+ [cell: string]: CellObject | CellObject[][] | SheetKeys | any;
579
+
580
+ /**
581
+ * Dense-mode worksheets store data in an array of arrays
582
+ *
583
+ * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
584
+ */
585
+ '!data'?: CellObject[][];
521
586
 
522
587
  /** Sheet type */
523
588
  '!type'?: SheetType;
524
589
 
525
- /** Sheet Range */
590
+ /** Sheet Range (A1-style) */
526
591
  '!ref'?: string;
527
592
 
528
593
  /** Page Margins */
529
594
  '!margins'?: MarginInfo;
530
595
  }
596
+ /** General object representing a dense Sheet (worksheet or chartsheet) */
597
+ export interface DenseSheet extends Sheet {
598
+ /**
599
+ * Special keys start with '!'
600
+ * Dense-mode worksheets store data in the '!data' key
601
+ */
602
+ [cell: string]: CellObject[][] | SheetKeys | any;
603
+
604
+ /**
605
+ * Dense-mode worksheets store data in an array of arrays
606
+ *
607
+ * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
608
+ */
609
+ '!data': CellObject[][];
610
+ }
611
+ /** General object representing a sparse Sheet (worksheet or chartsheet) */
612
+ export interface SparseSheet extends Sheet {
613
+ /**
614
+ * Sparse-mode store cells with keys corresponding to A1-style address
615
+ * Cells are accessed with sheet[addr]
616
+ */
617
+ '!data': never;
618
+ }
619
+
531
620
 
532
621
  /** AutoFilter properties */
533
622
  export interface AutoFilterInfo {
@@ -560,6 +649,15 @@ export interface WorkSheet extends Sheet {
560
649
  /** AutoFilter info */
561
650
  '!autofilter'?: AutoFilterInfo;
562
651
  }
652
+ /** Dense Worksheet Object */
653
+ export interface DenseWorkSheet extends DenseSheet {
654
+ /**
655
+ * Dense-mode worksheets store data in an array of arrays
656
+ *
657
+ * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
658
+ */
659
+ '!data': CellObject[][];
660
+ }
563
661
 
564
662
  /**
565
663
  * Worksheet Object with CellObject type
@@ -578,7 +676,7 @@ export type ExcelDataType = 'b' | 'n' | 'e' | 's' | 'd' | 'z';
578
676
  * Type of generated workbook
579
677
  * @default 'xlsx'
580
678
  */
581
- export type BookType = 'xlsx' | 'xlsm' | 'xlsb' | 'xls' | 'xla' | 'biff8' | 'biff5' | 'biff2' | 'xlml' | 'ods' | 'fods' | 'csv' | 'txt' | 'sylk' | 'slk' | 'html' | 'dif' | 'rtf' | 'prn' | 'eth' | 'dbf';
679
+ export type BookType = 'xlsx' | 'xlsm' | 'xlsb' | 'xls' | 'xla' | 'biff8' | 'biff5' | 'biff2' | 'xlml' | 'ods' | 'fods' | 'csv' | 'txt' | 'sylk' | 'slk' | 'html' | 'dif' | 'rtf' | 'prn' | 'eth' | 'dbf' | 'numbers';
582
680
 
583
681
  /** Comment element */
584
682
  export interface Comment {
@@ -627,6 +725,9 @@ export interface CellObject {
627
725
  /** Range of enclosing array if formula is array formula (if applicable) */
628
726
  F?: string;
629
727
 
728
+ /** If true, cell is a dynamic array formula (for supported file formats) */
729
+ D?: boolean;
730
+
630
731
  /** Rich text encoding (if applicable) */
631
732
  r?: any;
632
733
 
@@ -725,9 +826,35 @@ export interface Sheet2JSONOpts extends DateNFOption {
725
826
 
726
827
  /** if true, return raw numbers; if false, return formatted numbers */
727
828
  rawNumbers?: boolean;
829
+
830
+ /**
831
+ * If true, return dates whose UTC interpretation is correct
832
+ * By default, return dates whose local interpretation is correct
833
+ *
834
+ * @default false
835
+ */
836
+ UTC?: boolean;
728
837
  }
729
838
 
730
- export interface AOA2SheetOpts extends CommonOptions, DateNFOption {
839
+ export interface Sheet2FormulaOpts {
840
+ /**
841
+ * If false, only export cells with formulae.
842
+ * By default, synthetic formulae are generated for each cell.
843
+ */
844
+ values?: boolean;
845
+ }
846
+
847
+ export interface UTCDateOption {
848
+ /**
849
+ * If true, dates are interpreted using the UTC methods
850
+ * By default, dates are interpreted in the local timezone
851
+ *
852
+ * @default false
853
+ */
854
+ UTC?: boolean;
855
+ }
856
+
857
+ export interface AOA2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, DenseOption {
731
858
  /**
732
859
  * Create cell objects for stub cells
733
860
  * @default false
@@ -737,7 +864,7 @@ export interface AOA2SheetOpts extends CommonOptions, DateNFOption {
737
864
 
738
865
  export interface SheetAOAOpts extends AOA2SheetOpts, OriginOption {}
739
866
 
740
- export interface JSON2SheetOpts extends CommonOptions, DateNFOption {
867
+ export interface JSON2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, OriginOption, DenseOption {
741
868
  /** Use specified column order */
742
869
  header?: string[];
743
870
 
@@ -745,9 +872,7 @@ export interface JSON2SheetOpts extends CommonOptions, DateNFOption {
745
872
  skipHeader?: boolean;
746
873
  }
747
874
 
748
- export interface SheetJSONOpts extends JSON2SheetOpts, OriginOption {}
749
-
750
- export interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOption, SheetOption {
875
+ export interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOption {
751
876
  /** If true, plaintext parsing will not parse values */
752
877
  raw?: boolean;
753
878
 
@@ -759,6 +884,28 @@ export interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOpti
759
884
 
760
885
  /** If true, hidden rows and cells will not be parsed */
761
886
  display?: boolean;
887
+
888
+ /**
889
+ * Override the worksheet name
890
+ * @default "Sheet1"
891
+ */
892
+ sheet?: string;
893
+
894
+ /**
895
+ * If true, interpret date strings as if they are UTC.
896
+ * By default, date strings are interpreted in the local timezone.
897
+ *
898
+ * @default false
899
+ */
900
+ UTC?: boolean;
901
+ }
902
+
903
+ export interface Table2BookOpts extends Table2SheetOpts {
904
+ /**
905
+ * Override the worksheet name
906
+ * @default "Sheet1"
907
+ */
908
+ sheet?: string;
762
909
  }
763
910
 
764
911
  /** General utilities */
@@ -775,7 +922,7 @@ export interface XLSX$Utils {
775
922
 
776
923
  /** BROWSER ONLY! Converts a TABLE DOM element to a worksheet. */
777
924
  table_to_sheet(data: any, opts?: Table2SheetOpts): WorkSheet;
778
- table_to_book(data: any, opts?: Table2SheetOpts): WorkBook;
925
+ table_to_book(data: any, opts?: Table2BookOpts): WorkBook;
779
926
  sheet_add_dom(ws: WorkSheet, data: any, opts?: Table2SheetOpts): WorkSheet;
780
927
 
781
928
  /* --- Export Functions --- */
@@ -795,16 +942,7 @@ export interface XLSX$Utils {
795
942
  sheet_to_html(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
796
943
 
797
944
  /** Generates a list of the formulae (with value fallbacks) */
798
- sheet_to_formulae(worksheet: WorkSheet): string[];
799
-
800
- /** Generates DIF */
801
- sheet_to_dif(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
802
-
803
- /** Generates SYLK (Symbolic Link) */
804
- sheet_to_slk(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
805
-
806
- /** Generates ETH */
807
- sheet_to_eth(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
945
+ sheet_to_formulae(worksheet: WorkSheet, options?: Sheet2FormulaOpts): string[];
808
946
 
809
947
  /* --- Cell Address Utilities --- */
810
948
 
@@ -838,11 +976,14 @@ export interface XLSX$Utils {
838
976
 
839
977
  /* --- General Utilities --- */
840
978
 
841
- /** Creates a new workbook */
842
- book_new(): WorkBook;
979
+ /** Create a new workbook */
980
+ book_new(ws?: WorkSheet, wsname?: string): WorkBook;
981
+
982
+ /** Create a new worksheet */
983
+ sheet_new(opts?: DenseOption): WorkSheet;
843
984
 
844
- /** Append a worksheet to a workbook */
845
- book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string, roll?: boolean): void;
985
+ /** Append a worksheet to a workbook, returns new worksheet name */
986
+ book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string, roll?: boolean): string;
846
987
 
847
988
  /** Set sheet visibility (visible/hidden/very hidden) */
848
989
  book_set_sheet_visibility(workbook: WorkBook, sheet: number|string, visibility: number): void;
@@ -867,8 +1008,8 @@ export interface XLSX$Utils {
867
1008
  sheet_add_aoa(ws: WorkSheet, data: any[][], opts?: SheetAOAOpts): WorkSheet;
868
1009
 
869
1010
  /** Add an array of JS objects to a worksheet */
870
- sheet_add_json(ws: WorkSheet, data: any[], opts?: SheetJSONOpts): WorkSheet;
871
- sheet_add_json<T>(ws: WorkSheet, data: T[], opts?: SheetJSONOpts): WorkSheet;
1011
+ sheet_add_json(ws: WorkSheet, data: any[], opts?: JSON2SheetOpts): WorkSheet;
1012
+ sheet_add_json<T>(ws: WorkSheet, data: T[], opts?: JSON2SheetOpts): WorkSheet;
872
1013
 
873
1014
 
874
1015
  consts: XLSX$Consts;
@@ -887,14 +1028,38 @@ export interface XLSX$Consts {
887
1028
  SHEET_VERYHIDDEN: 2;
888
1029
  }
889
1030
 
890
- /** NODE ONLY! these return Readable Streams */
1031
+ export interface StrideOption {
1032
+ /** Number of rows to write per step */
1033
+ stride?: number;
1034
+ }
1035
+
1036
+ export interface XLMLStreamOpts extends WritingOptions, StrideOption {}
1037
+
1038
+ /**
1039
+ * Streaming write methods
1040
+ *
1041
+ * These methods are directly compatible with NodeJS `stream.Readable` API
1042
+ *
1043
+ * Web Streams (modern browsers) can play nice with NodeJS streams. See the Web
1044
+ * Demo at https://docs.sheetjs.com/docs/demos/bigdata/worker#streaming-write
1045
+ *
1046
+ * NOTE: These methods are not included in the `xlsx.mini.min.js` build!
1047
+ */
891
1048
  export interface StreamUtils {
1049
+ /** Set `Readable` (for environments that do not support NodeJS Streams) */
1050
+ set_readable(Readable: any): void;
1051
+
1052
+ /* --- Worksheet writers --- */
1053
+
892
1054
  /** CSV output stream, generate one line at a time */
893
1055
  to_csv(sheet: WorkSheet, opts?: Sheet2CSVOpts): any;
894
1056
  /** HTML output stream, generate one line at a time */
895
1057
  to_html(sheet: WorkSheet, opts?: Sheet2HTMLOpts): any;
896
1058
  /** JSON object stream, generate one row at a time */
897
1059
  to_json(sheet: WorkSheet, opts?: Sheet2JSONOpts): any;
898
- /** Set `Readable` (internal) */
899
- set_readable(Readable: any): void;
1060
+
1061
+ /* --- Workbook writers --- */
1062
+
1063
+ /** XLML output string stream (bookType `xlml`) */
1064
+ to_xlml(data: WorkBook, opts?: XLMLStreamOpts): any;
900
1065
  }