jspreadsheet 9.1.28 → 9.2.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +349 -120
  2. package/dist/index.js +491 -484
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -7,6 +7,39 @@ declare function jspreadsheet(element: HTMLElement, options: jspreadsheet.Spread
7
7
 
8
8
  declare namespace jspreadsheet {
9
9
 
10
+ /** License string. Use setLicense to define the license */
11
+ let license: string;
12
+
13
+ /** Default row height for a table */
14
+ let defaultRowHeight: number;
15
+
16
+ /** The container that holds all spreadsheet instances in the screen */
17
+ let spreadsheet: Spreadsheet[];
18
+
19
+ /** The container that holds all extensions loaded */
20
+ let extensions: object;
21
+
22
+ /** Advance excel like helpers */
23
+ let helpers: Helpers;
24
+
25
+ /** Native editors. You can have extra entries not defined here when working with custom editors */
26
+ let editors: Editors;
27
+
28
+ /** Internal method */
29
+ let picker: Function;
30
+
31
+ /** Define the translations from english to any other language. Ex.{ 'hello': 'Ola', 'Successfully Saved': 'Salvo com sucesso' } */
32
+ function setDictionary(dictionary: object) : void;
33
+
34
+ /** Set the license */
35
+ function setLicense(license: string) : void;
36
+
37
+ /** Set extensions to the JSS spreadsheet. Example { formula, parser, render } */
38
+ function setExtensions(extensions: object) : void;
39
+
40
+ /** Destroy the spreadsheet. Full destroy will clear all JSS controllers and it is not possible to re-create a new spreadsheet if true is used, until refresh the page. */
41
+ function destroy(element: HTMLElement, fullDestroy?: boolean) : void;
42
+
10
43
  /** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */
11
44
  function parser(options: any) : void;
12
45
 
@@ -19,17 +52,61 @@ declare namespace jspreadsheet {
19
52
  /** Jspreadsheet forms extension. More info at: https://jspreadsheet.com/products */
20
53
  function forms(options: any) : void;
21
54
 
22
- /** Set extensions to the JSS spreadsheet. Example { formula, parser, render } */
23
- function setExtensions(extensions: object) : void;
24
-
25
- /** Destroy the spreadsheet. Full destroy will clear all JSS controllers and it is not possible to re-create a new spreadsheet if true is used, until refresh the page. */
26
- function destroy(element: HTMLElement, fullDestroy?: boolean) : void;
55
+ /** Get the current version */
56
+ function version(): object;
27
57
 
28
- /** License string */
29
- let license: string;
58
+ /** Native editors */
59
+ interface Editors {
60
+ // Create a DOM element for a cell edition
61
+ createEditor: (type: 'input'|'div', cellReference: HTMLElement, value: any, instance: worksheetInstance) => HTMLElement;
62
+ // Create a DOM for a floating editor container
63
+ createDialog: (cell: HTMLElement, value: any, x: number, y: number, instance: worksheetInstance) => HTMLElement;
64
+ // Default editor for text and numbers
65
+ general: Editor;
66
+ text: Editor;
67
+ number: Editor;
68
+ numeric: Editor;
69
+ percent: Editor;
70
+ notes: Editor;
71
+ dropdown: Editor;
72
+ autocomplete: Editor;
73
+ calendar: Editor;
74
+ color: Editor;
75
+ checkbox: Editor;
76
+ radio: Editor;
77
+ autonumber: Editor;
78
+ progressbar: Editor;
79
+ rating: Editor;
80
+ email: Editor;
81
+ url: Editor;
82
+ image: Editor;
83
+ html: Editor;
84
+ hidden: Editor;
85
+ tags: Editor;
86
+ record: Editor;
87
+ }
30
88
 
31
- /** Set the license */
32
- function setLicense(license: string) : void
89
+ /** Helpers */
90
+ interface Helpers {
91
+ // Get caret position for editable dom element
92
+ getCaretIndex: (element: HTMLElement) => number;
93
+ // Invert the key and values in an object
94
+ invert: (obj: object) => object;
95
+ // Get the excel-like letter based on the index number
96
+ getColumnName: (index: number) => string;
97
+ // Get the cell name from its coordinates
98
+ getColumnNameFromCoords: (x: number, y: number) => string;
99
+ // Get the coordinates from a cell name
100
+ getCoordsFromColumnName: (name: string) => [number, number];
101
+ // Shift the formula by x and y positions in the matrix
102
+ shiftFormula: (formula: string, x: number, y: number) => string;
103
+ // Get all the token names from a excel-like range
104
+ getTokensFromRange: (range: string) => string[];
105
+ // Get the range from an array of tokens
106
+ getRangeFromTokens: (tokens: string[]) => string;
107
+ // Extract the tokens from a formula
108
+ getTokens: (formula: string, worksheetName?: string) => string[];
109
+ }
33
110
 
34
111
  interface Tabs {
35
112
  /** Allow to create new tabs */
@@ -147,6 +224,31 @@ declare namespace jspreadsheet {
147
224
  placeholder?: string;
148
225
  }
149
226
 
227
+ interface DefinedNames {
228
+ index: string;
229
+ value: string;
230
+ }
231
+
232
+ /**
233
+ * Cell object
234
+ */
235
+ interface Records {
236
+ // CELL td element
237
+ element: HTMLTableCellElement;
238
+ // Cached value of the cell
239
+ v: string|number;
240
+ // Readonly
241
+ readonly: boolean;
242
+ // Coordinate X
243
+ x: number;
244
+ // Coordiname Y
245
+ y: number;
246
+ // Associate to an array of values
247
+ a?: any[][];
248
+ // Part of a merged cells
249
+ merged?: number[];
250
+ }
251
+
150
252
  interface Column {
151
253
  /** Define the column type. Can be a string to define a native editor, or a method to define the custom editor plugin. */
152
254
  type?: Editor | 'autocomplete' | 'calendar' | 'checkbox' | 'color' | 'dropdown' | 'hidden' | 'html' | 'image' | 'numeric' | 'radio' | 'text' | 'notes';
@@ -206,6 +308,39 @@ declare namespace jspreadsheet {
206
308
  zebra?: boolean;
207
309
  }
208
310
 
311
+ interface Border {
312
+ /** HTML Element for the border */
313
+ element: HTMLElement;
314
+ /** Border color */
315
+ color: string;
316
+ /** Used on the marching ants border */
317
+ moveLeft?: HTMLElement;
318
+ /** Used on the marching ants border */
319
+ moveTop?: HTMLElement;
320
+ /** Used on the marching ants border */
321
+ moveRight?: HTMLElement;
322
+ /** Used on the marching ants border */
323
+ moveDown?: HTMLElement;
324
+ /** Current x1 coordinates for the border */
325
+ x1: number;
326
+ /** Current y1 coordinates for the border */
327
+ y1: number;
328
+ /** Current x2 coordinates for the border */
329
+ x2: number;
330
+ /** Current y2 coordinates for the border */
331
+ y2: number;
332
+ /** Border is active in the viewport */
333
+ active: boolean;
334
+ /** Position top of the border */
335
+ t: number;
336
+ /** Position left of the border */
337
+ l: number;
338
+ /** Current border width */
339
+ w: number;
340
+ /** Current border height */
341
+ h: number;
342
+ }
343
+
209
344
  interface Row {
210
345
  /** Row height in pixels. */
211
346
  height?: number;
@@ -213,6 +348,29 @@ declare namespace jspreadsheet {
213
348
  title?: string;
214
349
  /** Row identification. */
215
350
  visible?: boolean;
351
+ /** Style for the tr */
352
+ style?: string;
353
+ /** RecordID for the row */
354
+ id?: number;
355
+ /** Group row elements */
356
+ group?: number[];
357
+ /** Group row state */
358
+ state?: boolean;
359
+ }
360
+
361
+ interface RowInstance {
362
+ /** Element */
363
+ element?: HTMLElement;
364
+ /** Row height in pixels. */
365
+ height?: number;
366
+ /** Row identification. */
367
+ visible?: boolean;
368
+ /** RecordID for the row */
369
+ id?: number;
370
+ /** Group row elements */
371
+ group?: number[];
372
+ /** Group row state */
373
+ state?: boolean;
216
374
  }
217
375
 
218
376
  interface Editor {
@@ -398,7 +556,7 @@ declare namespace jspreadsheet {
398
556
  /** When pagination is enabled and the user changes the page. */
399
557
  onchangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPageNumber: number, quantityPerPage: number) => void;
400
558
  /** Add or change the options of a new worksheet. */
401
- onbeforecreateworksheet?: (worksheetOptions: Worksheet, position: number) => Object;
559
+ onbeforecreateworksheet?: (worksheetOptions: Worksheet, options: object, position: number) => Object;
402
560
  /** When the user creates a new worksheet. */
403
561
  oncreateworksheet?: (worksheet: worksheetInstance, worksheetOptions: Worksheet, position: number) => void;
404
562
  /** When the user renames a worksheet. */
@@ -414,7 +572,7 @@ declare namespace jspreadsheet {
414
572
  /** Before the search method starts */
415
573
  onsearchstart?: (worksheet: worksheetInstance, query: string) => void;
416
574
  /** Before the search method starts */
417
- onsearchsrow?: (worksheet: worksheetInstance, row: number, query: string) => boolean;
575
+ onsearchrow?: (worksheet: worksheetInstance, row: number, query: string) => boolean;
418
576
  /** Action to be executed before searching. The accepted method return would be: null to continue with the default behavior, false to cancel the user action or an array with the row numbers to overwrite the default result. */
419
577
  onbeforesearch?: (worksheet: worksheetInstance, query: string, results: []) => [] | boolean | void;
420
578
  /** After the search is applied to the rows. */
@@ -429,13 +587,7 @@ declare namespace jspreadsheet {
429
587
  oncreaterow?: (worksheet: worksheetInstance, rowNumber: number, tr: HTMLElement) => void;
430
588
  /** When a new column is created */
431
589
  oncreatecolumn?: (worksheet: worksheetInstance, columnNumber: number, td: HTMLElement, options: Object) => void;
432
- /**
433
- * Before execute a formula.
434
- * @param {string} expression - formula to be executed.
435
- * @param {number} coordinate x - cell coordinates
436
- * @param {number} coordinate y
437
- * @return {any} Return false to cancel parsing. Return new parsed formula. Return void to continue with original formula
438
- */
590
+ /** A way to change the formula in real-time before execution */
439
591
  onbeforeformula?: (worksheet: worksheetInstance, expression: string, x: number, y: number) => string | false | void;
440
592
  /** Get the information about the expressions executed from the formula chain */
441
593
  onformulachain?: (worksheet: worksheetInstance, expressions: Array<object>) => void;
@@ -457,6 +609,16 @@ declare namespace jspreadsheet {
457
609
  onchangerowvisibility?: (worksheet: object, state: boolean, rows: []) => void
458
610
  /** When change the column visibility */
459
611
  onchangecolumnvisibility?: (worksheet: object, state: boolean, columns: []) => void
612
+ /** When a new row group is created */
613
+ oncreaterowgroup?: (worksheet: object, row: number, elements: number|number[]) => void
614
+ /** When a row group is destroyed */
615
+ ondestroyrowgroup?: (worksheet: object, row: number) => void
616
+ /** When open a row group */
617
+ onopenrowgroup?: (worksheet: object, row: number) => void
618
+ /** When close a row group */
619
+ oncloserowgroup?: (worksheet: object, row: number) => void
620
+ /** General event handler */
621
+ onevent?: (worksheet: Object, method: Object, a?: any, b?: any, c?: any, d?: any, e?: any, f?: any) => any
460
622
  /** Run every single table update action. Can bring performance issues if perform too much changes. */
461
623
  updateTable?: (worksheet: worksheetInstance, cell: Object, x: number, y: number, value: String) => void;
462
624
  /** Return false to cancel the contextMenu event, or return custom elements for the contextmenu. */
@@ -470,11 +632,13 @@ declare namespace jspreadsheet {
470
632
  /** About information */
471
633
  about?: string | Function,
472
634
  /** License string */
473
- license?: string,
635
+ license?: string;
474
636
  /** Worksheets */
475
637
  worksheets?: Array<Worksheet>;
476
638
  /** Validations */
477
639
  validations?: any;
640
+ /** Plugins */
641
+ plugins?: Record<string, Function>
478
642
  }
479
643
 
480
644
  interface Worksheet {
@@ -491,7 +655,7 @@ declare namespace jspreadsheet {
491
655
  /** Deprecated. Please use the data property. */
492
656
  json?: Array<Record<string, any>>;
493
657
  /** Array with the rows properties definitions such as title, height. */
494
- rows?: Row[];
658
+ rows?: Row[] | Record<number, Row>;
495
659
  /** The column properties define the behavior of a column and the associated editor */
496
660
  columns?: Array<Column>;
497
661
  /** Define the properties of a cell. This property overwrite the column definitions */
@@ -559,7 +723,7 @@ declare namespace jspreadsheet {
559
723
  /** Allow search on the spreadsheet */
560
724
  search?: boolean;
561
725
  /** Activate pagination and defines the number of records per page. Default: false */
562
- pagination?: number;
726
+ pagination?: number | boolean;
563
727
  /** Dropdown for the user to change the number of records per page. Example: [10,25,50,100]. Default: false */
564
728
  paginationOptions?: boolean | Array<number>;
565
729
  /** Text Overflow. Default: false */
@@ -573,7 +737,7 @@ declare namespace jspreadsheet {
573
737
  /** Virtualization for columns. Works only when tableOverflow: true. Default: true */
574
738
  virtualizationX?: boolean;
575
739
  /** Virtualization for rows. Works only when tableOverflow: true. Default: true */
576
- virtualizationY: boolean;
740
+ virtualizationY?: boolean;
577
741
  /** Initial comments. Default: null */
578
742
  comments?: Record<string, string>;
579
743
  /** Initial meta information. Default: null */
@@ -632,51 +796,51 @@ declare namespace jspreadsheet {
632
796
  /** DOM Element. Alias for el */
633
797
  element: HTMLElement;
634
798
  /** DOM Element container for the filters */
635
- filters: HTMLElement;
799
+ filter: HTMLElement;
636
800
  /** Toggle the full screen mode */
637
801
  fullscreen: (state: Boolean) => void;
638
802
  /** Get the toolbar object definitions */
639
- getToolbar: Toolbar,
803
+ getToolbar: (toolbar: Toolbar) => object,
640
804
  /** Set the toolbar */
641
805
  setToolbar: (toolbar: Toolbar) => void;
642
- /** Show the toolbar for the worksheet */
806
+ /** Show the toolbar */
643
807
  showToolbar: () => void;
644
- /** Hide the toolbar for the worksheet */
808
+ /** Hide the toolbar */
645
809
  hideToolbar: () => void;
646
810
  /** Get the worksheet by its id */
647
- getWorksheet: (id: String) => Number;
811
+ getWorksheet: (id: String) => number;
648
812
  /** Get the active worksheet when applicable */
649
813
  getWorksheetActive: () => number;
650
814
  /** Get the worksheet instance by its position */
651
- getWorksheetInstance: (position: Number) => worksheetInstance;
815
+ getWorksheetInstance: (position: number) => worksheetInstance;
652
816
  /** HTMLElement Helper */
653
817
  helper: HTMLElement,
654
818
  /** Array with the history information */
655
819
  history: [];
656
820
  /** Internal history index position */
657
- historyIndex: Boolean;
821
+ historyIndex: number;
658
822
  /** Ignore events */
659
- ignoreEvents: Boolean;
823
+ ignoreEvents: boolean;
660
824
  /** Ignore history events */
661
- ignoreHistory: Boolean;
825
+ ignoreHistory: boolean;
662
826
  /** Ignore persistence events */
663
- ignorePersistence: Boolean;
827
+ ignorePersistence: boolean;
664
828
  /** HTMLElement editor container */
665
829
  input: HTMLElement;
666
830
  /** HTMLElement loading element */
667
831
  loading: HTMLElement;
668
832
  /** Rename an existing worksheet by its position */
669
- renameWorksheet: (position: Number, title: String) => void;
670
- /** Move the position of a worksheet tab */
671
- moveWorksheet: (from: Number, to: Number, updateDom: Boolean) => void;
833
+ renameWorksheet: (position: number, title: String) => void;
834
+ /** Move the position of a worksheet */
835
+ updateWorksheet: (from: number, to: number) => void;
836
+ /** Move the position of a worksheet. DOM Only (Internal method) - Please use updateWorksheet */
837
+ moveWorksheet: (from: number, to: number) => void;
672
838
  /** Open a worksheet */
673
- openWorksheet: (position: Number) => void;
674
- /** Get the worksheet name */
675
- getWorksheetName: () => String;
839
+ openWorksheet: (position: number) => void;
676
840
  /** Spreadsheet unique name */
677
841
  name: string;
678
842
  /** List of plugins loaded to the spreadsheet */
679
- plugins: Record<number, Plugin>;
843
+ plugins: Record<string, Plugin>;
680
844
  /** Processing flag. It would be true when the spreadsheet is loading. */
681
845
  processing: boolean;
682
846
  /** Show progressbar */
@@ -695,24 +859,34 @@ declare namespace jspreadsheet {
695
859
  tools: HTMLElement;
696
860
  /** Worksheets container */
697
861
  worksheets: Array<Worksheet>;
862
+ /** Load plugins into the spreadsheet */
863
+ setPlugins: (plugins: Record<string, Function>) => void;
864
+ /** Internal history handlers */
865
+ setHistory: (history: object) => void;
866
+ /** Internal history handlers */
867
+ resetHistory: () => void;
868
+ /** Internal method: event dispatch controllers. */
869
+ dispatch: (...args: string[]) => void;
870
+ /** Get the spreadsheet configuration */
871
+ getConfig: () => Spreadsheet;
698
872
  }
699
873
 
700
874
  interface worksheetInstance {
701
875
  /** Array with the borders information */
702
- borders: Array<any>;
876
+ borders: Border[];
703
877
  /** Close the editon for one cell */
704
878
  closeEditor: (cell: HTMLElement, save: boolean) => void;
705
879
  /** Close the filters */
706
880
  closeFilters: (update: boolean) => void;
707
- /** Array with the column width controllers */
708
- colgroup: [];
881
+ /** Array with the HTML element references that define the columns */
882
+ colgroup: HTMLElement[];
709
883
  /** Hold the colgroup container */
710
884
  colgroupContainer: HTMLElement;
711
885
  /** DOM Worksheet container */
712
886
  content: HTMLElement;
713
887
  /** Copy */
714
888
  copy: (cut?: boolean) => void;
715
- /** DOM Corner square */
889
+ /** HTML Element for the handler fill */
716
890
  corner: HTMLElement;
717
891
  /** Create a new worksheet */
718
892
  createWorksheet: (worksheetOptions: Worksheet) => worksheetInstance;
@@ -729,16 +903,18 @@ declare namespace jspreadsheet {
729
903
  * @return {array} array of data
730
904
  */
731
905
  data: (highlighted?: boolean, processedData?: boolean, delimiter?: string) => Array<Array<any>> | string
732
- /** Internal use control type to defined JSON or ARRAY. */
733
- dataType: boolean,
906
+ /** Internal use control type to defined JSON (1) or ARRAY (0). */
907
+ dataType: number,
734
908
  /** Delete an existing column */
735
909
  deleteColumn: (columnnumber: number, numOfColumns?: number) => void;
736
910
  /** Delete an existing row */
737
911
  deleteRow: (rownumber: number, numOfRows?: number) => void;
738
912
  /** Destroy all merged cells */
739
913
  destroyMerged: () => void;
740
- /** Internal method: event dispatch controllers */
741
- dispatch: (event?: string) => void;
914
+ /** Legacy alias destroyMerged */
915
+ destroyMerge: () => void;
916
+ /** Internal method: event dispatch controllers. */
917
+ dispatch: (...args: string[]) => void;
742
918
  /** Navigation down */
743
919
  down: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
744
920
  /** If extension render exists, execute render extension else download CSV */
@@ -746,23 +922,23 @@ declare namespace jspreadsheet {
746
922
  /** Download CSV */
747
923
  downloadCSV: (includeHeaders?: boolean, processed?: boolean) => void;
748
924
  /** Edition controllers */
749
- edition: [];
925
+ edition?: [];
750
926
  /** DOM Worksheet. Alias for worksheet */
751
927
  element: HTMLElement;
752
928
  /** Internal method: Execute a formula. */
753
929
  executeFormula: (expression: string, x?: number, y?: number, caching?: boolean, basic?: boolean) => void;
754
930
  /** Navigation first */
755
931
  first: (shiftKey?: boolean, ctrlKey?: boolean) => void;
756
- /** Footers */
932
+ /** Internal footer controllers */
757
933
  footers: Record<string, string>;
758
- /** Formula chain. Internal use. */
934
+ /** Internal formula chain controllers */
759
935
  formula: [];
760
936
  /** Toggle the fullscreen mode */
761
937
  fullscreen: (state: boolean) => void;
762
938
  /** Get the border */
763
939
  getBorder: (alias: string) => object;
764
- /** Get the cell element from the cellname */
765
- getCell: (cellName: string) => HTMLElement | null;
940
+ /** Get the cell element from the cellName or via its coordinates x,y */
941
+ getCell: (cellNameOrColumnNumber: string|number, y?: number) => HTMLElement | null;
766
942
  /** Get the cell element from its coordinates */
767
943
  getCellFromCoords: (x: number, y: number) => Array<any>;
768
944
  /** Get attributes from one cell when applicable */
@@ -773,7 +949,7 @@ declare namespace jspreadsheet {
773
949
  getColumnData: (col: number, processed?: boolean) => Array<any>;
774
950
  /** Get the column position by its name */
775
951
  getColumnIdByName: (name: string) => number;
776
- /** Alias for getProperty */
952
+ /** Alias for getProperties */
777
953
  getColumnOptions: (x: number, y?: number) => Column;
778
954
  /** Get the comments from one cell. Example: getComments('A1') */
779
955
  getComments: (cellName?: string) => string;
@@ -786,10 +962,10 @@ declare namespace jspreadsheet {
786
962
  * @param {boolean} get the raw or processed data
787
963
  * @param {string} delimiter to get the data as a string with columns separate by the char delimiter.
788
964
  * @param {boolean} get the data as a JSON object.
789
- * @return {array|object} array or object with the data
965
+ * @return {array|string|null} array or string
790
966
  */
791
- getData: (highlighted?: boolean, processed?: boolean, delimiter?: string, asJson?: boolean) => Array<any> | String;
792
- /** Get the defined name or defined names when key is null */
967
+ getData: (highlighted?: boolean, processed?: boolean, delimiter?: string, asJson?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string | null;
968
+ /** Get the defined name or all defined names when key is null */
793
969
  getDefinedNames: (key?: string) => object;
794
970
  /** Internal method: Get the editor for one cell */
795
971
  getEditor: (x: number, y: number) => Object;
@@ -807,20 +983,18 @@ declare namespace jspreadsheet {
807
983
  getHeight: (row?: number) => Array<number> | number;
808
984
  /** Get the highlighted coordinates */
809
985
  getHighlighted: () => Array<any>;
810
- /** Get json */
811
- getJson: (h?: boolean, processed?: boolean) => any;
812
- /** Get the processed data cell shown to the user by the cell name */
813
- getLabel: (cellName: string) => Object;
814
- /** Get the processed data cell shown to the user by its coordinates */
815
- getLabelFromCoords: (x: number, y: number) => string[];
986
+ /** Get the data as JSON. */
987
+ getJson: (h?: boolean, processed?: boolean, delimiter?: boolean, asJson?: boolean) => any;
988
+ /** Get the processed data cell shown to the user by the cell name or coordinates. */
989
+ getLabel: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => string;
990
+ /** Aliases for getLabel */
991
+ getLabelFromCoords: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => string;
816
992
  /** Get the merged cells. Cell name: A1, A2, etc or null for all cells */
817
993
  getMerge: (cellName?: string) => Object | Array<number>;
818
994
  /** Get one or all meta information for one cell. */
819
995
  getMeta: (cellName: string, property: string) => Object;
820
996
  /** Get the nested cells */
821
997
  getNestedCell: (x: number, y: number, properties?: any) => Object;
822
- /** Get the nested header columns */
823
- getNestedColumns: (x: number, y: number) => any[];
824
998
  /** Get the nested headers */
825
999
  getNestedHeaders: () => [];
826
1000
  /** Get the next available number in the sequence */
@@ -833,6 +1007,8 @@ declare namespace jspreadsheet {
833
1007
  getProcessed: (x: number, y: number, extended?: boolean) => any;
834
1008
  /** Get the properties for one column when only x is present or the cell when x and y is defined. */
835
1009
  getProperties: (x: number, y?: number) => Column;
1010
+ /** Deprecated. Legacy alias to getProperties */
1011
+ getProperty: (x: number, y?: number) => Column;
836
1012
  /** Get the selection in a range format */
837
1013
  getRange: () => string;
838
1014
  /** Get a row data or meta information by Id. */
@@ -841,12 +1017,16 @@ declare namespace jspreadsheet {
841
1017
  getRowData: (row: number, processed: boolean) => any[];
842
1018
  /** Get the row id from its position */
843
1019
  getRowId: (row: number) => number;
844
- /** Get all selected cells */
845
- getSelected: (columnNameOnly: boolean) => any[];
846
- /** Get the selected columns. DOMElements or Indexes */
847
- getSelectedColumns: (indexes?: Boolean) => Array<HTMLElement> | Array<number>;
1020
+ /**
1021
+ * Get the selected cells
1022
+ * @param {boolean} columnNameOnly - Return an array of cell names or cell DOM elements
1023
+ * @param {boolean} ignoreHidden - Ignore hidden cells
1024
+ */
1025
+ getSelected: (columnNameOnly: boolean, ignoreHidden?: boolean) => any[];
1026
+ /** Get the selected columns indexes */
1027
+ getSelectedColumns: () => number[];
848
1028
  /** Get the selected rows. DOMElements or Indexes */
849
- getSelectedRows: (indexes?: Boolean) => Array<HTMLElement> | Array<number>;
1029
+ getSelectedRows: (indexes?: boolean) => HTMLElement[] | number[];
850
1030
  /** Get the style from one cell. Ex. getStyle('A1') */
851
1031
  getStyle: (cell: string) => Object;
852
1032
  /** Get value by the cell name or object. The value can be the raw or processed value. */
@@ -863,8 +1043,8 @@ declare namespace jspreadsheet {
863
1043
  headers: Array<HTMLElement>;
864
1044
  /** Hide column */
865
1045
  hideColumn: (column: number|number[]) => void;
866
- /** Hide the filters */
867
- hideFilter: () => void;
1046
+ /** Hide the filters from one or all columns. */
1047
+ hideFilter: (colNumber?: number) => void;
868
1048
  /** Hide index column */
869
1049
  hideIndex: () => void;
870
1050
  /** Hide row */
@@ -872,21 +1052,21 @@ declare namespace jspreadsheet {
872
1052
  /** Hide the search container */
873
1053
  hideSearch: () => void;
874
1054
  /** Add a new column */
875
- insertColumn: (numOfColumns: number, columnnumber: number, insertBefore: boolean, properties: Column, data: []) => void;
1055
+ insertColumn: (numOfColumnsOrData?: number|any[], columnNumber?: number, insertBefore?: boolean, properties?: Column, data?: any[], extraInformationFromEvents?: object, event?: object) => void;
876
1056
  /** Add a new row */
877
- insertRow: (numOfRows: number, rownumber: number, insertBefore: boolean, data: any[]) => void;
1057
+ insertRow: (numOfRows: number, rowNumber: number, insertBefore: boolean, data: any[]) => void;
878
1058
  /** Check if cell is attached to the DOM */
879
1059
  isAttached: (x: number, y: number) => boolean;
880
1060
  /** The worksheet is editable */
881
1061
  isEditable: () => boolean;
882
- /** Check if cell is readonly or not */
883
- isReadOnly: (cell: Object) => boolean;
884
- /** Cell is selected */
885
- isSelected: (x: number, y: number) => boolean;
1062
+ /** Check if cell is readonly or not. State used to set the state */
1063
+ isReadOnly: (cell: Object, state?: boolean) => boolean;
1064
+ /** Verify if this coordinates is within a selection or blank for the current selection */
1065
+ isSelected: (x: number, y: number, selection?: number[]) => boolean;
886
1066
  /** Navigation last */
887
- last: () => void;
1067
+ last: (shiftKey?: boolean, ctrlKey?: boolean) => void;
888
1068
  /** Navigation left */
889
- left: () => void;
1069
+ left: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
890
1070
  /** Dynamic load data to the spreadsheet. This method does not trigger events or persistence and reset the spreadsheet. To persist use setData. */
891
1071
  loadData: (data: any[]) => void;
892
1072
  /** Change a column position */
@@ -902,11 +1082,11 @@ declare namespace jspreadsheet {
902
1082
  /** Worksheet configuration */
903
1083
  options: Worksheet;
904
1084
  /** Sort one column by its position. ASC (0) or DESC (1) */
905
- orderBy: (column: number, direction: boolean) => void;
1085
+ orderBy: (column: number, direction: boolean, internalValueController?: any[], internalPreviousStateController?: boolean) => void;
906
1086
  /** Change page when using pagination */
907
- page: (pagenumber: number) => void;
1087
+ page: (pageNumber: number, callBack?: Function) => void;
908
1088
  /** Current page number */
909
- pagenumber: number;
1089
+ pageNumber: number;
910
1090
  /** Pagination DOM container */
911
1091
  pagination: Object;
912
1092
  /** Spreadsheet object */
@@ -915,8 +1095,8 @@ declare namespace jspreadsheet {
915
1095
  paste: (x: number, y: number, data: string | any[]) => void;
916
1096
  /** Get the quantity of pages when pagination is active */
917
1097
  quantityOfPages?: () => number;
918
- /** Array with the cell DOM elements */
919
- records: Array<HTMLElement>;
1098
+ /** Array container for all cell DOM elements */
1099
+ records: Records[][];
920
1100
  /** Refresh the whole data or from a single row */
921
1101
  refresh: (y: number | undefined) => void;
922
1102
  /** Refresh the borders by the border name */
@@ -927,14 +1107,14 @@ declare namespace jspreadsheet {
927
1107
  removeMerge: (cellName: String | Object) => void;
928
1108
  /** Reset the borders by name border name */
929
1109
  resetBorders: (border: String, resetPosition: boolean) => void;
930
- /** Close the filters */
931
- resetFilters: () => void;
1110
+ /** Reset the filter of one or all columns */
1111
+ resetFilters: (colNumber?: number) => void;
932
1112
  /** Destroy the footers */
933
1113
  resetFooter: () => void;
934
1114
  /** Destroy freeze columns */
935
1115
  resetFreezeColumns: () => void;
936
- /** Reset meta data */
937
- resetMeta: () => void;
1116
+ /** Reset meta data of one or multiple cells. Null for all cells */
1117
+ resetMeta: (cellName?: string[]|string) => void;
938
1118
  /** Reset nested headers */
939
1119
  resetNestedHeaders: () => void;
940
1120
  /** Reset the search */
@@ -944,13 +1124,13 @@ declare namespace jspreadsheet {
944
1124
  /** Get the style from one cell. Ex. resetStyle('A1') */
945
1125
  resetStyle: (cell?: String) => void;
946
1126
  /** DOM array of results */
947
- results: Array<number>;
1127
+ results: Array<number> | null;
948
1128
  /** Navigation right */
949
- right: () => void;
1129
+ right: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
950
1130
  /** Rotate the spreadsheet cell text. cell = A1, B1... etc */
951
1131
  rotate: (cell: string|string[], value:number) => void;
952
- /** DOM array of rows */
953
- rows: Array<HTMLElement>;
1132
+ /** Array of row objects */
1133
+ rows: RowInstance[];
954
1134
  /** Persistence helper method. The callback is executed with a JSON from the server */
955
1135
  save: (url: String, data: Object, token?: String, callback?: (result: Object) => void) => void;
956
1136
  /** ScrollX DOM Element */
@@ -982,9 +1162,9 @@ declare namespace jspreadsheet {
982
1162
  /** Set the worksheet data */
983
1163
  setData: (data: any[]) => void;
984
1164
  /** Set the defined name */
985
- setDefinedNames: (key: string, value: string) => void;
1165
+ setDefinedNames: (names: DefinedNames[]) => void;
986
1166
  /** Set filter */
987
- setFilter: (colnumber: number, keywords: any[]) => void;
1167
+ setFilter: (colNumber: number, keywords: any[]) => void;
988
1168
  /** Set the footers */
989
1169
  setFooter: (data: []) => void;
990
1170
  /** Set the footer value */
@@ -993,18 +1173,18 @@ declare namespace jspreadsheet {
993
1173
  setFreezeColumns: (num: number) => void;
994
1174
  /** Set the header title. Empty or null to reset to the default header value. */
995
1175
  setHeader: (x: number, title?: String) => void;
996
- /** Set the height of one row by its position */
997
- setHeight: (row: number, width: number) => void;
998
- /** Get the merged cells. Cellname: A1, A2, etc */
999
- setMerge: (cellName: String | Object, colspan?: number, rowspan?: number, forceOverwrite?: boolean) => void;
1176
+ /** Set the height of one row by its position. currentHeight is for internal use only */
1177
+ setHeight: (row: number|number[], height: number|number[], currentHeight?: number|number[]) => void;
1178
+ /** Get the merged cells. Cell name: A1, A2, etc */
1179
+ setMerge: (cellName: String | Object, colspan?: number, rowspan?: number) => void;
1000
1180
  /** Get one or various meta information for one cell. */
1001
1181
  setMeta: (cell: string | object, property?: string, value?: string) => void;
1002
1182
  /** Set the nested headers */
1003
1183
  setNestedHeaders: (config: any[]) => void;
1004
- /** Set plugins for the spreadsheet */
1005
- setPlugins: (plugins: any[]) => void;
1006
- /** Set the properties for one column */
1007
- setProperties: (column: number, settings: Object) => void;
1184
+ /** Deprecated. Alias for parent.setPlugins */
1185
+ setPlugins: (plugins: Record<string, Function>) => void;
1186
+ /** Set the properties for a column or cell */
1187
+ setProperties: (columnNumber: number, rowNumberOrColumnSettings: number|Column, settings?: Column) => void;
1008
1188
  /** Set or reset the cell as readonly */
1009
1189
  setReadOnly: (cell: Object, state: boolean) => void;
1010
1190
  /** Set the data from one row */
@@ -1017,29 +1197,29 @@ declare namespace jspreadsheet {
1017
1197
  * Set a cell value
1018
1198
  *
1019
1199
  * @param {mixed} cell destination cell
1020
- * @param {string} value value
1021
- * @param {string} force value over readonly cells
1200
+ * @param {string|number} value
1201
+ * @param {boolean} force value over readonly cells
1022
1202
  * @return void
1023
1203
  */
1024
- setValue: (cell: string, value?: String, forceOverwrite?: boolean) => void;
1204
+ setValue: (cell: string|string[]|object, value?: string|number, forceOverwrite?: boolean) => void;
1025
1205
  /**
1026
1206
  * Set a cell value
1027
1207
  *
1028
1208
  * @param {number} x
1029
1209
  * @param {number} y
1030
- * @param {string} value value
1031
- * @param {string} force value over readonly cells
1210
+ * @param {string|number} value value
1211
+ * @param {boolean} force value over readonly cells
1032
1212
  * @return void
1033
1213
  */
1034
- setValueFromCoords: (x: number, y: number, value: string, force?: boolean) => void;
1214
+ setValueFromCoords: (x: number, y: number, value: string|number, force?: boolean) => void;
1035
1215
  /** Set viewport width and height */
1036
1216
  setViewport: (width: number, height: number) => void;
1037
1217
  /** Set the width of one column by its position */
1038
- setWidth: (col: number, width: number) => void;
1218
+ setWidth: (col: number|number[], width: number|number[]) => void;
1039
1219
  /** Show column */
1040
1220
  showColumn: (column: number|number[]) => void;
1041
- /** Show filter controls */
1042
- showFilter: () => void;
1221
+ /** Show filter controls for one column or all columns */
1222
+ showFilter: (column?: number) => void;
1043
1223
  /** Show index column */
1044
1224
  showIndex: () => void;
1045
1225
  /** Show row */
@@ -1054,14 +1234,8 @@ declare namespace jspreadsheet {
1054
1234
  tbody: HTMLElement;
1055
1235
  /** DOM Worksheet table tfoot */
1056
1236
  tfoot: HTMLElement;
1057
- /** Verify if one col + row is merged and return or not the merge cell */
1058
- isMerged: (x: number, y: number, getParent: boolean) => boolean | any[];
1059
- /** Verify if the col has any merged cells */
1060
- isColMerged: (x: number) => boolean;
1061
- /** Verify if the col has any merged cells */
1062
- isRowMerged: (y: number) => boolean;
1063
1237
  /** Navigation up */
1064
- up: () => void;
1238
+ up: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
1065
1239
  /**
1066
1240
  * Internal method: Internal method: Set a cell value
1067
1241
  *
@@ -1077,13 +1251,68 @@ declare namespace jspreadsheet {
1077
1251
  /** Update the selection based on two DOM cell selements */
1078
1252
  updateSelection: (el1: number, el2: number, origin: boolean) => void;
1079
1253
  /** Update the selection based on coordinates */
1080
- updateSelectionFromCoords: (x1: number, y1: number, x2: number, y2: number, origin: boolean) => void;
1254
+ updateSelectionFromCoords: (x1: number, y1: number, x2: number, y2: number, origin: boolean, type?: string, color?: string) => void;
1081
1255
  /** Getter/setter the value by coordinates */
1082
1256
  value?: (x: number, y: number, value?: any) => void;
1083
1257
  /** Which page the row number is */
1084
1258
  whichPage?: (row: number) => number;
1259
+ /** Create a new group of rows */
1260
+ setRowGroup: (row: number, elements: number|number[]) => void;
1261
+ /** Open a new group of rows */
1262
+ openRowGroup: (row: number) => void;
1263
+ /** Close a new group of rows */
1264
+ closeRowGroup: (row: number) => void;
1265
+ /** Destroy a new group of rows */
1266
+ destroyRowGroup: (row: number) => void;
1267
+ /** Resize the given column numbers based on their content. */
1268
+ autoResize: (column: number[]) => void;
1269
+ /** Aliases for jspreadsheet.helpers. Tools to handle spreadsheet data */
1270
+ helpers: Helpers;
1271
+ /** Deprecated. Alias for the parent.showToolbar() */
1272
+ showToolbar: () => void;
1273
+ /** Deprecated. Alias for the parent.hideToolbar() */
1274
+ hideToolbar: () => void;
1275
+ /** Refresh the toolbar based on the current worksheet */
1276
+ refreshToolbar: () => void;
1277
+ /** Internal persistence handler */
1278
+ persistence: Function;
1279
+ /** Deprecated. Alias for parent.undo */
1280
+ undo: () => void;
1281
+ /** Deprecated. Alias for parent.redo */
1282
+ redo: () => void;
1283
+ /** Internal formula tracking */
1284
+ tracking?: number[];
1285
+ /** Visible columns on the viewport */
1286
+ visibleRows?: number[];
1287
+ /** Visible columns on the viewport */
1288
+ visibleCols?: number[];
1289
+ /** Viewport current width */
1290
+ width?: number;
1291
+ /** Viewport current width */
1292
+ height?: number;
1293
+ /** Get the row object */
1294
+ getRow: (row: number) => RowInstance;
1295
+ /** Internal worksheet onload method */
1296
+ onload?: () => void;
1297
+ /** Internal nested headers DOM container */
1298
+ nested?: object;
1299
+ /** Internal formula array values */
1300
+ resetArray?: (x: number, y: number) => void;
1301
+ /** Freeze a number of rows */
1302
+ setFreezeRows: (numberOfRows: number) => void;
1303
+ /** Reset the freeze rows */
1304
+ resetFreezeRows: () => void;
1305
+ /** Reset the properties of a cell */
1306
+ resetProperty: (x: number, y: number) => void;
1307
+ /** Internal method */
1308
+ setFormula: () => void;
1309
+ /** Update nested cell properties */
1310
+ setNestedCell: (x: number, y: number, properties: Nested) => void;
1311
+ /** Internal method: Update the merge cell dimensions */
1312
+ updateMerge: (cellName: string, colspan: number, rowspan: number) => void;
1313
+ /** Get the worksheet name */
1314
+ getWorksheetName: () => string;
1085
1315
  }
1086
1316
  }
1087
1317
 
1088
1318
  export = jspreadsheet;
1089
-