jspreadsheet 11.11.0 → 11.11.2

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 +523 -476
  2. package/dist/index.js +566 -565
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -6,19 +6,19 @@
6
6
  declare function jspreadsheet(element: HTMLElement|HTMLDivElement|null, options: jspreadsheet.Spreadsheet) : Array<jspreadsheet.worksheetInstance>;
7
7
 
8
8
  declare namespace jspreadsheet {
9
-
9
+ let current: worksheetInstance | null;
10
10
  /** ClientID */
11
- let clientId: string;
11
+ let clientId: string | null;
12
12
  /** License string. Use setLicense to define the license */
13
- let license: string;
13
+ let license: string | null;
14
14
  /** Default row height for a table */
15
15
  let defaultRowHeight: number | string;
16
+ /** Default column width for a table */
17
+ let defaultColWidth: number;
16
18
  /** Column index default width. Default: 50 */
17
19
  let indexColumnWidth: number;
18
20
  /** The container that holds all spreadsheet instances in the screen */
19
- let spreadsheet: Spreadsheet[];
20
- /** The container that holds all extensions loaded */
21
- let extensions: object;
21
+ let spreadsheet: spreadsheetInstance[];
22
22
  /** Advance excel like helpers */
23
23
  let helpers: Helpers;
24
24
  /** Native editors. You can have extra entries not defined here when working with custom editors */
@@ -26,20 +26,20 @@ declare namespace jspreadsheet {
26
26
  /** History tracker controllers */
27
27
  let history: History;
28
28
  /** Clipboard controller */
29
- let clipboard: ClipBoard;
29
+ let clipboard: ClipBoardMethods;
30
30
  /** Shortcuts */
31
31
  let shortcuts: Shortcuts;
32
32
  /** Get the worksheet instance by its name */
33
- function getWorksheetInstanceByName(worksheetName: string, namespace?: string) : worksheetInstance;
33
+ let getWorksheetInstanceByName: GetWorksheetInstanceByNameFunction;
34
34
 
35
35
  /** Picker */
36
- function picker(el: HTMLElement, options: PickerOptions) : void;
36
+ let picker: Picker;
37
37
 
38
38
  /** Pause calculations */
39
39
  function calculations(state: boolean) : void;
40
40
 
41
41
  /** Define the translations from english to any other language. Ex.{ 'hello': 'Ola', 'Successfully Saved': 'Salvo com sucesso' } */
42
- function setDictionary(dictionary: object) : void;
42
+ let setDictionary: SetDictionary;
43
43
 
44
44
  /** Set the license */
45
45
  function setLicense(license: string|object) : void;
@@ -54,37 +54,69 @@ declare namespace jspreadsheet {
54
54
  function destroyAll() : void;
55
55
 
56
56
  /** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */
57
- function parser(options: any) : void;
57
+ let parser: ((options: any) => void) | undefined;
58
58
 
59
59
  /** Jspreadsheet formula extension. More info at: https://jspreadsheet.com/products */
60
- function formula(expression: string, variables: object, x: number, y: number, instance: worksheetInstance) : void;
60
+ let formula: ((expression: string, variables: object, x: number, y: number, instance: worksheetInstance) => void) | undefined;
61
61
 
62
62
  /** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */
63
- function render(element: HTMLElement, options: any) : void;
63
+ let render: ((element: HTMLElement, options: any) => void) | undefined;
64
64
 
65
65
  /** Jspreadsheet forms extension. More info at: https://jspreadsheet.com/products */
66
- function forms(options: any) : void;
66
+ let forms: ((options: any) => void) | undefined;
67
67
 
68
68
  /** Jspreadsheet search extension. More info at: https://jspreadsheet.com/products */
69
- function search() : void;
69
+ let search: (() => void) | undefined;
70
70
 
71
71
  /** Jspreadsheet importer extension. More info at: https://jspreadsheet.com/products */
72
- function importer() : void;
72
+ let importer: (() => void) | undefined;
73
73
 
74
74
  /** Jspreadsheet validations extension. More info at: https://jspreadsheet.com/products */
75
- function validations() : void;
75
+ let validations: (() => void) | undefined;
76
76
 
77
77
  /** Jspreadsheet bar extension. More info at: https://jspreadsheet.com/products */
78
- function bar(options?: { suggestions?: boolean }) : void;
78
+ let bar: ((options?: { suggestions?: boolean }) => void) | undefined;
79
79
 
80
80
  /** Jspreadsheet charts extension. More info at: https://jspreadsheet.com/products */
81
- function charts() : void;
81
+ let charts: (() => void) | undefined;
82
82
 
83
83
  /** Jspreadsheet shapes extension. More info at: https://jspreadsheet.com/products */
84
- function shapes() : void;
84
+ let shapes: (() => void) | undefined;
85
85
 
86
86
  /** Get the current version */
87
- function version(): object;
87
+ function version(): {
88
+ version: string,
89
+ edition: string,
90
+ host: string,
91
+ license: string,
92
+ print: () => [string],
93
+ };
94
+
95
+ type GetWorksheetInstanceByNameFunction = (worksheetName?: string | null | undefined, namespace?: string) => worksheetInstance | Record<string, worksheetInstance>;
96
+
97
+ interface Picker {
98
+ (el: HTMLElement, options: PickerOptions) : void;
99
+
100
+ cancel: () => void;
101
+ click: () => void;
102
+ e: Record<string, any> | null | undefined;
103
+ end: () => void;
104
+ getRangeFromNode: () => RangeCoords | null | undefined;
105
+ hasEvent: (focus?: boolean) => Record<string, any> | null | undefined;
106
+ input: (element: HTMLElement) => void;
107
+ keydown: (event: KeyboardEvent) => void;
108
+ palette: (colors: string[]) => void;
109
+ selection: (x1: number, y1: number, x2: number, y2: number, event: Event) => boolean | undefined;
110
+ start: (element: HTMLElement) => void;
111
+ update: (element: HTMLElement) => void;
112
+ validSelection: (acceptNewNodeOnly?: boolean) => boolean;
113
+ }
114
+
115
+ interface SetDictionary {
116
+ (dictionary: object) : void;
117
+
118
+ translate: (text: string, substitutions: string[]) => string;
119
+ }
88
120
 
89
121
  interface Shortcuts {
90
122
  get: (event: object) => Function | null;
@@ -92,25 +124,35 @@ declare namespace jspreadsheet {
92
124
  }
93
125
 
94
126
  interface PickerOptions {
95
- // picker creates a range selection component. formula expect to be a formula starting with '='
127
+ /** picker creates a range selection component. formula expect to be a formula starting with '=' */
96
128
  type?: 'formula' | 'picker';
97
- // When the value is changed
129
+ /** When the value is changed */
98
130
  onchange?: (element: HTMLElement, mouseEvent: object) => void;
99
- // Each time the selection is updated
131
+ /** Each time the selection is updated */
100
132
  onupdate?: (element: HTMLElement, mouseEvent: object) => void;
101
133
  }
102
134
 
135
+ type RangeCoords = [number, number, number, number];
136
+
103
137
  interface ClipBoard {
104
138
  worksheet: worksheetInstance,
105
139
  value: string,
106
- selection: number[],
140
+ selection: RangeCoords,
141
+ highlighted: RangeCoords | RangeCoords[],
107
142
  cut: boolean,
108
- hash: string,
143
+ hash: string | null,
144
+ }
145
+
146
+ interface ClipBoardMethods {
147
+ set(text: string, isCut?: boolean | undefined, coords?: RangeCoords, reset?: boolean): void,
148
+ get(): ClipBoard,
149
+ reset(resetClipboard?: boolean): void,
109
150
  }
110
151
 
111
152
  /** Images */
112
153
  interface Media {
113
- type: 'image' | 'chart' | 'shape',
154
+ id: string,
155
+ type?: 'image' | 'chart' | 'shape',
114
156
  src?: string,
115
157
  top?: number,
116
158
  left?: number,
@@ -118,7 +160,7 @@ declare namespace jspreadsheet {
118
160
  height?: number,
119
161
  zIndex?: number,
120
162
  options?: object,
121
- // This media is anchor to a cell, so position will be relative to the cell otherwise absolute
163
+ /** This media is anchor to a cell, so position will be relative to the cell otherwise absolute */
122
164
  cellAnchor?: string,
123
165
  }
124
166
 
@@ -134,26 +176,29 @@ declare namespace jspreadsheet {
134
176
  row?: number,
135
177
  data?: any[],
136
178
  options: Row,
179
+ [key: string]: any,
137
180
  }
138
181
 
139
182
  /** Advance comments */
140
183
  interface Comment {
141
- // User unique identification
184
+ /** User unique identification */
142
185
  user_id?: number,
143
- // User name
186
+ /** User name */
144
187
  name?: string,
145
- // Comment content
188
+ /** Comment content */
146
189
  comments?: string,
147
- // Date of the comments
190
+ /** Date of the comments */
148
191
  date?: string,
149
192
  }
150
193
 
151
194
  /** Global History */
152
195
  interface History {
196
+ (changes: Record<string, any>): void;
197
+
153
198
  /** History index cursor */
154
199
  index: number;
155
200
  /** History items */
156
- actions: [];
201
+ actions: Record<string, any>[];
157
202
  /** When true the next item is cascaded in the same existing history element */
158
203
  cascade: boolean;
159
204
  /** When true no history will be added to the tracker */
@@ -212,20 +257,18 @@ declare namespace jspreadsheet {
212
257
 
213
258
  /** Only available with the Validations extension */
214
259
  interface Validations {
215
- // Index position in the array of validations
260
+ /** Index position in the array of validations */
216
261
  index?: number | null;
217
- // The validation definition object
262
+ /** The validation definition object */
218
263
  value: Validation;
219
264
  }
220
265
 
221
266
  /** Native editors */
222
267
  interface Editors {
223
- // Create a DOM element for a cell edition
268
+ /** Create a DOM element for a cell edition */
224
269
  createEditor: (type: 'input'|'div', cellReference: HTMLElement, value: any, instance: worksheetInstance) => HTMLElement;
225
- // Create a DOM for a floating editor container
270
+ /** Create a DOM for a floating editor container */
226
271
  createDialog: (cell: HTMLElement, value: any, x: number, y: number, instance: worksheetInstance) => HTMLElement;
227
- // Default editor for text and numbers
228
- general: Editor;
229
272
  text: Editor;
230
273
  number: Editor;
231
274
  numeric: Editor;
@@ -252,42 +295,84 @@ declare namespace jspreadsheet {
252
295
  /** Helpers */
253
296
  interface Helpers {
254
297
  /**
255
- * Compare two arrays to see if contains exact the same elements
256
- * @param {number[]} a1
257
- * @param {number[]} a2
258
- * @return {boolean}
298
+ * Compare two arrays to see if contains exact the same elements.
299
+ * @param a1 - Array 1.
300
+ * @param a2 - Array 2.
259
301
  */
260
302
  compareArray: (a1: number[], a2: number[]) => boolean;
261
- // Get caret position for editable dom element
303
+ /**
304
+ * Get caret position for editable dom element.
305
+ */
262
306
  getCaretIndex: (element: HTMLElement) => number;
263
- // Invert the key and values in an object
307
+ /**
308
+ * Invert the key and values in an object.
309
+ */
264
310
  invert: (obj: object) => object;
265
- // Get the excel-like letter based on the index number
311
+ /**
312
+ * Get the excel-like letter based on the index number.
313
+ */
266
314
  getColumnName: (index: number) => string;
267
- // Get the cell name from its coordinates
315
+ /**
316
+ * Get the cell name from its coordinates.
317
+ */
268
318
  getCellNameFromCoords: (x: number, y: number) => string;
269
- // Aliases or getCellNameFromCoords
319
+ /**
320
+ * Aliases or getCellNameFromCoords.
321
+ */
270
322
  getColumnNameFromCoords: (x: number, y: number) => string;
271
- // Get the coordinates from a cell name
272
- getCoordsFromCellName: (name: string) => [number, number];
273
- // Alias for getCoordsFromCellName
274
- getCoordsFromColumnName: (name: string) => [number, number];
275
- // Shift the formula by x and y positions in the matrix
323
+ /**
324
+ * Get the coordinates from a cell name.
325
+ */
326
+ getCoordsFromCellName: (name: string) => [number | null, number | null] | [];
327
+ /**
328
+ * Alias for getCoordsFromCellName.
329
+ */
330
+ getCoordsFromColumnName: (name: string) => [number | null, number | null] | [];
331
+ /**
332
+ * Shift the formula by x and y positions in the matrix.
333
+ */
276
334
  shiftFormula: (formula: string, x: number, y: number) => string;
277
- // Get all the token names from a excel-like range
278
- getTokensFromRange: (range: string) => string[];
279
- // Get the range from an array of tokens
280
- getRangeFromTokens: (tokens: string[]) => string;
281
- // Get the coordinates as a number from a range string. Adjust helps to define the height dynamically when you have A:A ranges for example. Works in the same way for 1:1 ranges. Default: true
282
- getCoordsFromRange: (range: string, adjust?: boolean) => [number,number,number,number];
283
- // Get range string from [x1,y1,x2,y2]
284
- getRangeFromCoords: (coords: [number,number,number,number]) => string;
285
- // Extract the configuration from JSS from a static HTML table
335
+ /**
336
+ * Get all the token names from a excel-like range.
337
+ */
338
+ getTokensFromRange: (range: string, force?: boolean, worksheetName?: string, removeDuplicates?: boolean) => string[];
339
+ /**
340
+ * Get the range from an array of tokens.
341
+ */
342
+ getRangeFromTokens: (tokens: string[], fixCurrencySymbol?: string) => string;
343
+ /**
344
+ * Get the coordinates as a number from a range string. Adjust helps to define the height dynamically when you have A:A ranges for example. Works in the same way for 1:1 ranges. Default: true.
345
+ */
346
+ getCoordsFromRange: (range: string, adjust?: boolean) => RangeCoords;
347
+ /**
348
+ * Get range string from [x1,y1,x2,y2].
349
+ */
350
+ getRangeFromCoords(coords: RangeCoords): string;
351
+ getRangeFromCoords(x1: number, y1: number, x2: number, y2: number): string;
352
+ /**
353
+ * Extract the configuration from JSS from a static HTML table.
354
+ */
286
355
  createFromTable: (element: HTMLElement, options?: Worksheet) => Worksheet;
287
- // CSV string to JS array. delimiter default ','
288
- parseCSV: (str: string, delimiter?: string) => string[];
289
- // Get all token names inside an range
290
- getTokensFromCoords: (x1: number, y1: number, x2: number, y2: number, worksheetName?: string) => []
356
+ /**
357
+ * CSV string to JS array.
358
+ * @param str - CSV string.
359
+ * @param delimiter - Default: ','.
360
+ */
361
+ parseCSV: (str: string, delimiter?: string) => string[][];
362
+ /**
363
+ * Get all token names inside an range.
364
+ */
365
+ getTokensFromCoords: (x1: number, y1: number, x2: number, y2: number, worksheetName?: string) => string[];
366
+
367
+ focus: (element: HTMLElement) => void;
368
+
369
+ setCaretIndex: (element: any, index: number) => void;
370
+
371
+ getCaretNode: (target: HTMLElement) => HTMLElement | null;
372
+
373
+ secureFormula: (oldValue: string, runtime?: boolean) => string;
374
+
375
+ insertLineBreak: () => void;
291
376
  }
292
377
 
293
378
  interface Tabs {
@@ -379,9 +464,9 @@ declare namespace jspreadsheet {
379
464
  /** Event handler for when a new option is added to the dropdown */
380
465
  oninsert?: (obj: object, item: DropdownItem, newItem: DropdownItem) => void;
381
466
  /** Event handler for just before a new option is added to the dropdown */
382
- onbeforeinsert?: (obj: object, item: DropdownItem) => void;
467
+ onbeforeinsert?: (obj: object, item: DropdownItem) => DropdownItem | false | undefined;
383
468
  /** Event handler for before a search on autocomplete is performed */
384
- onbeforesearch?: (obj: object, ajaxRequest: object) => boolean | null;
469
+ onbeforesearch?: (obj: object, ajaxRequest: object) => object | false | undefined;
385
470
  /** Event handler for processing search results */
386
471
  onsearch?: (obj: object, result: object) => void;
387
472
  /** Toggles the sorting of dropdown elements */
@@ -439,12 +524,14 @@ declare namespace jspreadsheet {
439
524
  /** Specifies the type of calendar to render. Default is 'default'. Possible values are 'default' and 'year-month-picker'. */
440
525
  type?: 'default' | 'year-month-picker';
441
526
  /** An array of numbers specifying a range of valid dates. Dates outside this range will be disabled. */
442
- validRange?: number[];
527
+ validRange?: [number, number];
528
+ /** The day of the week the calendar starts on (0 for Sunday - 6 for Saturday). Default: 0. */
529
+ startingDay?: number;
443
530
  /** Specifies the day of the week the calendar starts on, where 0 is Sunday and 6 is Saturday. Default is 0 (Sunday). */
444
531
  format?: string;
445
532
  /** Specifies whether the calendar input is readonly or not. Default is false. */
446
533
  readonly?: boolean;
447
- /** Specifies whether today's date is automatically selected when no date is defined. Default is false. */
534
+ /** Specifies whether today's date is automatically selected when no date is defined. */
448
535
  today?: boolean;
449
536
  /** Specifies whether to display a dropdown for selecting hour and minute values. Default is false. */
450
537
  time?: boolean;
@@ -454,6 +541,8 @@ declare namespace jspreadsheet {
454
541
  placeholder?: string;
455
542
  /** Auto select confirms the current date as the new value onblur. Default: true */
456
543
  autoSelect?: boolean;
544
+ /** Open in fullscreen mode. */
545
+ fullscreen?: boolean;
457
546
  }
458
547
 
459
548
  interface DefinedNames {
@@ -465,47 +554,39 @@ declare namespace jspreadsheet {
465
554
  * Cell object
466
555
  */
467
556
  interface Records {
468
- // CELL td element
557
+ /** CELL td element */
469
558
  element: HTMLTableCellElement;
470
- // Cached value of the cell
471
- v: string|number;
472
- // Readonly
473
- readonly: boolean;
474
- // Coordinate X
559
+ /** Cached value of the cell */
560
+ v: string | number | boolean | undefined;
561
+ /** Coordinate X */
475
562
  x: number;
476
- // Coordinate Y
563
+ /** Coordinate Y */
477
564
  y: number;
478
- // Associate to an array of values
479
- a?: any[][];
480
- // Part of a merged cells
565
+ /** Associate to an array of values */
566
+ a?: Map<Records, any>;
567
+ /** Part of a merged cells */
481
568
  merged?: any[];
482
- // Style
569
+ /** Merged cells */
570
+ mergeCells?: [number, number];
571
+ /** Style */
483
572
  s?: number;
484
- // Comments
485
- c?: string|object;
486
- // Meta
573
+ /** Comments */
574
+ c?: string | Record<string, any>[];
575
+ /** Meta */
487
576
  meta?: object;
488
- // Chain
489
- chain?: Map<object, object>;
577
+ /** Chain */
578
+ chain?: Map<Records, true>;
579
+ // Worksheet Instance
580
+ w: worksheetInstance;
490
581
  }
491
582
 
492
- interface Column {
583
+ type ColumnType = Editor | 'text' | 'number' | 'numeric' | 'percent' | 'notes' | 'dropdown' | 'autocomplete' | 'calendar' | 'color' | 'checkbox' | 'radio' | 'autonumber' | 'progressbar' | 'rating' | 'email' | 'url' | 'image' | 'html' | 'hidden' | 'tags' | 'record';
584
+
585
+ interface ColumnPrimitiveProperties {
493
586
  /** Define the type of editor to use for the column. Can be a string to define a native editor, or a method to define a custom editor plugin. */
494
- type?: Editor | 'text' | 'number' | 'numeric' | 'percent' | 'notes' | 'dropdown' | 'autocomplete' | 'calendar' | 'color' | 'checkbox' | 'radio' | 'autonumber' | 'progressbar' | 'rating' | 'email' | 'url' | 'image' | 'html' | 'hidden' | 'tags' | 'record';
495
- /** The title of the column. */
496
- title?: string;
497
- /** The name or path of a property when the data is a JSON object. */
498
- name?: string;
499
- /** Define the tooltip text to display on mouseover for the column header. */
500
- tooltip?: string;
501
- /** The width of the column. Default: 100px */
502
- width?: number;
503
- /** Whether the column is visible. */
504
- visible?: boolean,
587
+ type?: ColumnType;
505
588
  /** The alignment of the column content. Default: center. */
506
589
  align?: 'center' | 'left' | 'right' | 'justify';
507
- /** A method to overwrite the column definitions in real-time just before the column is edited. */
508
- filterOptions?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: number|string, options: Column) => Column;
509
590
  /** The URL to load items from for the dropdown in this column, or when used in a text cell it will be a create a link */
510
591
  url?: string;
511
592
  /** The items to show in the dropdown or autocomplete. */
@@ -532,8 +613,6 @@ declare namespace jspreadsheet {
532
613
  format?: string;
533
614
  /** Locale for Intl.NumberFormat */
534
615
  locale?: string,
535
- /** Whether the column is a primary key. */
536
- primaryKey?: boolean;
537
616
  /** Extended configuration for the column. */
538
617
  options?: Calendar | Dropdown | object;
539
618
  /** Whether the column is read-only. */
@@ -542,18 +621,10 @@ declare namespace jspreadsheet {
542
621
  process?: boolean;
543
622
  /** Whether to try to cast numbers from a cell text. Default: true. */
544
623
  autoCasting?: boolean;
545
- /** Whether to shift the formula when copying and pasting. This option is only valid for custom column types. Default: false. */
546
- shiftFormula?: boolean;
547
624
  /** Whether to wrap the text in the column. */
548
625
  wrap?: boolean;
549
626
  /** The rotation angle for the text value, between -90 and 90. Default: null. */
550
627
  rotate?: number;
551
- /** Whether to apply CSS odd-even background color to the column. Default: false. */
552
- zebra?: boolean;
553
- /** The number of columns to group together. */
554
- group?: number;
555
- /** State of the column group. */
556
- state?: boolean;
557
628
  /** Record editor */
558
629
  worksheetId?: string;
559
630
  worksheetColumn?: number;
@@ -561,52 +632,33 @@ declare namespace jspreadsheet {
561
632
  locked?: boolean;
562
633
  }
563
634
 
564
- interface Cell {
565
- /** Define the type of editor to use for the column. Can be a string to define a native editor, or a method to define a custom editor plugin. */
566
- type?: Editor | 'text' | 'number' | 'numeric' | 'percent' | 'notes' | 'dropdown' | 'autocomplete' | 'calendar' | 'color' | 'checkbox' | 'radio' | 'autonumber' | 'progressbar' | 'rating' | 'email' | 'url' | 'image' | 'html' | 'hidden' | 'tags' | 'record';
635
+ interface Column extends ColumnPrimitiveProperties {
567
636
  /** The title of the column. */
568
637
  title?: string;
638
+ /** The name or path of a property when the data is a JSON object. */
639
+ name?: string;
569
640
  /** Define the tooltip text to display on mouseover for the column header. */
570
641
  tooltip?: string;
571
- /** The alignment of the column content. Default: center. */
572
- align?: 'center' | 'left' | 'right' | 'justify';
573
- /** The items to show in the dropdown or autocomplete. */
574
- source?: Array<DropdownItem> | Array<string> | Array<number>;
575
- /** Whether the column is an autocomplete field. */
576
- autocomplete?: boolean;
577
- /** Whether the dropdown or autocomplete can accept multiple options. */
578
- multiple?: boolean;
579
- /** The delimiter to use for separating multiple dropdown options. Default: ";". */
580
- delimiter?: string;
581
- /** The input mask to apply to the data cell. @see https://jsuites.net/v4/javascript-mask */
582
- mask?: string;
583
- /** The character to use as the decimal separator. */
584
- decimal?: '.' | ',';
585
- /** The maximum number of characters to display in the cell before truncating. */
586
- truncate?: number,
587
- /** Whether to disable the mask when editing. */
588
- disabledMaskOnEdition?: boolean;
589
- /** A renderer method or rule for the cell content. */
590
- render?: string | ((td: HTMLElement, value: number|string, x: number, y: number, worksheet: worksheetInstance, options: Column) => void);
591
- /** The format of the date or numbers in the cell. Default for the calendar: "DD/MM/YYYY". */
592
- format?: string;
593
- /** Locale for Intl.NumberFormat */
594
- locale?: string,
595
- /** Extended configuration for the column. */
596
- options?: Calendar | Dropdown | object;
597
- /** Whether the column is read-only. */
598
- readOnly?: boolean;
599
- /** The rotation angle for the text value, between -90 and 90. Default: null. */
600
- rotate?: number;
601
- /** URL */
602
- url?: string;
603
- /** Record editor */
604
- worksheetId?: string;
605
- worksheetColumn?: number;
606
- worksheetImage?: boolean;
607
- locked?: boolean;
642
+ /** The width of the column. Default: 100px */
643
+ width?: number;
644
+ /** Whether the column is visible. */
645
+ visible?: boolean,
646
+ /** A method to overwrite the column definitions in real-time just before the column is edited. */
647
+ filterOptions?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: number|string, options: Column) => Column;
648
+ /** Whether the column is a primary key. */
649
+ primaryKey?: boolean;
650
+ /** Whether to shift the formula when copying and pasting. This option is only valid for custom column types. Default: false. */
651
+ shiftFormula?: boolean;
652
+ /** Whether to apply CSS odd-even background color to the column. Default: false. */
653
+ zebra?: boolean;
654
+ /** The number of columns to group together. */
655
+ group?: number;
656
+ /** State of the column group. */
657
+ state?: boolean;
608
658
  }
609
659
 
660
+ interface Cell extends ColumnPrimitiveProperties { }
661
+
610
662
  interface Border {
611
663
  /** HTML Element for the border */
612
664
  element: HTMLElement;
@@ -657,19 +709,11 @@ declare namespace jspreadsheet {
657
709
  readOnly?: boolean;
658
710
  }
659
711
 
660
- interface RowInstance {
661
- /** Element */
662
- element?: HTMLElement;
663
- /** Row height in pixels. */
664
- height?: number;
665
- /** Row identification. */
666
- visible?: boolean;
667
- /** RecordID for the row */
668
- id?: number;
669
- /** Group row elements */
670
- group?: number;
671
- /** Group row state */
672
- state?: boolean;
712
+ interface RowInstance extends Row {
713
+ /** Element. */
714
+ element: HTMLTableRowElement;
715
+ /** Row index. */
716
+ y: number;
673
717
  }
674
718
 
675
719
  interface Editor {
@@ -683,8 +727,6 @@ declare namespace jspreadsheet {
683
727
  closeEditor?: (cell: HTMLTableCellElement, confirmChanges: boolean, x: number, y: number, instance: worksheetInstance, options: Column | Cell) => any;
684
728
  /** When a cell is destroyed. */
685
729
  destroyCell?: (cell: HTMLTableCellElement, x: number, y: number, instance: worksheetInstance) => void;
686
- /** Apply updates when the properties of a cell or column is changed. */
687
- updateProperty?: (x: number, y: number, instance: worksheetInstance, options: Column | Cell) => void;
688
730
  /** Transform the raw data into processed data. It will show a text instead of an id in the type dropdown for example. */
689
731
  get?: (options: object, value: any, extended: boolean, instance: worksheetInstance) => string
690
732
  }
@@ -695,13 +737,13 @@ declare namespace jspreadsheet {
695
737
  /** When a new worksheet is added. */
696
738
  init?: (worksheet: worksheetInstance) => void;
697
739
  /** It would receive a call for every spreadsheet event. */
698
- onevent?: (event: string, a?: any, b?: any, c?: any, d?: any) => void;
740
+ onevent?: (event: string, ...args: any[]) => any;
699
741
  /** When the spreadsheet needs to save something in the server. */
700
742
  persistence?: (method: string, args: object) => void;
701
743
  /** When the user opens the context menu. */
702
- contextMenu?: (instance: worksheetInstance, x: number, y: number, e: MouseEvent, items:Array<ContextmenuItem> , section: string, a: any, b?: any) => void;
703
- /** When the toolbar is create and clicked. */
704
- toolbar?: (instance: worksheetInstance, toolbar: Toolbar) => void;
744
+ contextMenu?: (instance: worksheetInstance, x: number, y: number, e: MouseEvent, items:Array<ContextmenuItem> , section: string, a: any, b?: any) => Array<ContextmenuItem>;
745
+ /** When the toolbar is created and clicked. */
746
+ toolbar?: (instance: worksheetInstance, toolbar: Toolbar) => Toolbar;
705
747
  }
706
748
 
707
749
  interface Nested {
@@ -720,8 +762,6 @@ declare namespace jspreadsheet {
720
762
  interface Spreadsheet {
721
763
  /** Your application name */
722
764
  application?: string;
723
- /** Deprecated */
724
- cloud?: string;
725
765
  /** Remote configuration with Jspreadsheet Server */
726
766
  guid?: string;
727
767
  /** DOM element for binding the javascript events. This property is normally used when JSS is running as a web component. */
@@ -733,7 +773,7 @@ declare namespace jspreadsheet {
733
773
  /** Remote URL for the persistence server */
734
774
  server?: string;
735
775
  /** Enable the toolbars */
736
- toolbar?: boolean | 'extended' | Toolbar | Function;
776
+ toolbar?: boolean | Toolbar | ToolbarItem[] | Function;
737
777
  /** Allow table edition */
738
778
  editable?: boolean;
739
779
  /** Allow data export */
@@ -742,12 +782,8 @@ declare namespace jspreadsheet {
742
782
  includeHeadersOnDownload?: boolean;
743
783
  /** Force update on paste for read-only cells */
744
784
  forceUpdateOnPaste?: boolean;
745
- /** Enable loading spin when loading data. Default: false. */
746
- loadingSpin?: boolean;
747
785
  /** Render jspreadsheet spreadsheet on full screen mode. Default: false */
748
786
  fullscreen?: boolean;
749
- /** Make sure the formulas are capital letter. Default: true */
750
- secureFormulas?: boolean;
751
787
  /** Enable formula debug. Default: false */
752
788
  debugFormulas?: boolean,
753
789
  /** Execute formulas. Default: true */
@@ -758,8 +794,6 @@ declare namespace jspreadsheet {
758
794
  autoIncrement?: boolean;
759
795
  /** Try to cast numbers from cell values when executing formulas. Default: true */
760
796
  autoCasting?: boolean;
761
- /** Deprecated */
762
- stripHTML?: boolean;
763
797
  /** Parse HTML. Default: false (Use this with caution) */
764
798
  parseHTML?: boolean;
765
799
  /** Allow bar when extension bar is enabled. Default: true */
@@ -783,37 +817,44 @@ declare namespace jspreadsheet {
783
817
  /** When redo is applied */
784
818
  onredo?: (worksheet: worksheetInstance, historyRecord: object) => void;
785
819
  /** Before any data is sent to the backend. Can be used to overwrite the data or to cancel the action when return false. */
786
- onbeforesave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: object) => boolean | object;
820
+ onbeforesave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: object) => boolean | object | undefined;
787
821
  /** After something is saved */
788
- onsave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: Array<any>, result: object) => void;
822
+ onsave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: object, result: object) => void;
789
823
  /** When something goes wrong during a persistence operation */
790
824
  onerror?: (spreadsheet: spreadsheetInstance, result: object) => void;
791
825
  /** Before a column value is changed. NOTE: It is possible to overwrite the original value, by return a new value on this method. */
792
- onbeforechange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => boolean | any;
826
+ onbeforechange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number | string, y: number | string, value: any) => false | any | undefined;
793
827
  /** After a column value is changed. */
794
- onchange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, oldValue: any) => void;
828
+ onchange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number | string, y: number | string, newValue: any, oldValue: any) => void;
795
829
  /** When all data have been updated. Origin: 'paste', 'handle-fill' or undefined */
796
- onafterchanges?: (worksheet: worksheetInstance, records: Array<any>, origin: string) => void;
830
+ onafterchanges?: (worksheet: worksheetInstance, records: Record<string, any>[], origin: string | undefined) => void;
797
831
  /** When a copy is performed in the spreadsheet. Any string returned will overwrite the user data or return null to progress with the default behavior. */
798
- oncopy?: (worksheet: worksheetInstance, selectedCells: Array<number>, data: string, cut: boolean) => boolean | string;
832
+ oncopy?: (worksheet: worksheetInstance, selectedCells: RangeCoords, data: string, cut: boolean | undefined) => false | string | undefined;
799
833
  /** Before the paste action is performed. Can return parsed or filtered data. It is possible to cancel the action when the return is false. */
800
- onbeforepaste?: (worksheet: worksheetInstance, data: Array<any>, x: number, y: number, properties: []) => boolean | [];
834
+ onbeforepaste?: (worksheet: worksheetInstance, data: Record<string, any>[][], x: number, y: number) => false | Record<string, any>[][] | undefined;
801
835
  /** After a paste action is performed in the spreadsheet. */
802
- onpaste?: (worksheet: worksheetInstance, records: Array<any>) => void;
836
+ onpaste?: (
837
+ worksheet: worksheetInstance,
838
+ records: {
839
+ x: number,
840
+ y: number,
841
+ [key: string]: any,
842
+ }
843
+ ) => void;
803
844
  /** Before a new row is inserted. You can cancel the insert event by returning false. */
804
- onbeforeinsertrow?: (worksheet: worksheetInstance, newRow: []) => boolean | newRow[] | void;
845
+ onbeforeinsertrow?: (worksheet: worksheetInstance, newRow: Record<string, any>[]) => false | newRow[] | undefined;
805
846
  /** After a new row is inserted. */
806
- oninsertrow?: (worksheet: worksheetInstance, newRow: []) => void;
847
+ oninsertrow?: (worksheet: worksheetInstance, newRow: Record<string, any>[]) => void;
807
848
  /** Before a row is deleted. You can cancel the delete event by returning false. */
808
- onbeforedeleterow?: (worksheet: worksheetInstance, rows: number[]) => number[] | boolean | void;
849
+ onbeforedeleterow?: (worksheet: worksheetInstance, rows: number[]) => number[] | false | undefined;
809
850
  /** After a row is excluded. */
810
851
  ondeleterow?: (worksheet: worksheetInstance, rows: number[]) => void;
811
852
  /** Before a new column is inserted. You can cancel the insert event by returning false. */
812
- onbeforeinsertcolumn?: (worksheet: worksheetInstance, newColumn: []) => boolean | newColumn[] | void;
853
+ onbeforeinsertcolumn?: (worksheet: worksheetInstance, newColumn: Record<string, any>[]) => false | newColumn[] | undefined;
813
854
  /** After a new column is inserted. */
814
- oninsertcolumn?: (worksheet: worksheetInstance, affected: []) => void;
855
+ oninsertcolumn?: (worksheet: worksheetInstance, affected: Record<string, any>[]) => void;
815
856
  /** Before a column is excluded. You can cancel the insert event by returning false. */
816
- onbeforedeletecolumn?: (worksheet: worksheetInstance, cols: number[]) => number[] | boolean | void;
857
+ onbeforedeletecolumn?: (worksheet: worksheetInstance, cols: number[]) => false | number[] | undefined;
817
858
  /** After a column is excluded. */
818
859
  ondeletecolumn?: (worksheet: worksheetInstance, cols: number[]) => void;
819
860
  /** After a row is moved to a new position. */
@@ -825,17 +866,17 @@ declare namespace jspreadsheet {
825
866
  /** After a column width change for one or more columns. */
826
867
  onresizecolumn?: (worksheet: worksheetInstance, column: number | Array<number>, width: number | Array<number>, oldWidth: number | Array<number>) => void;
827
868
  /** Before the selection happens */
828
- onbeforeselection?: (worksheet: worksheetInstance, px: number, py: number, ux: number, uy: number, origin?: object) => void | boolean;
869
+ onbeforeselection?: (worksheet: worksheetInstance, px: number, py: number, ux: number, uy: number, origin?: object) => boolean | undefined;
829
870
  /** When the selection is changed. */
830
871
  onselection?: (worksheet: worksheetInstance, px: number, py: number, ux: number, uy: number, origin?: object) => void;
831
872
  /** Before the comments is added or updated. Return false to cancel the event, void to accept the action or a object. */
832
- onbeforecomments?: (worksheet: worksheetInstance, cells: object) => boolean | object | void;
873
+ onbeforecomments?: (worksheet: worksheetInstance, cells: Record<string, string>) => false | Record<string, string> | undefined;
833
874
  /** After a new comment is added or updated. */
834
- oncomments?: (worksheet: worksheetInstance, newValues: object, previousValues: object) => void;
875
+ oncomments?: (worksheet: worksheetInstance, newValues: Record<string, string>, previousValues: Record<string, string>) => void;
835
876
  /** It runs before sorting a column. It should return an array with a custom sorting or false to cancel the user action. */
836
- onbeforesort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: []) => boolean | [] | void;
877
+ onbeforesort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: number[]) => false | number[] | undefined;
837
878
  /** When a column is sorted. */
838
- onsort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: []) => void;
879
+ onsort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: number[]) => void;
839
880
  /** When the spreadsheet gets the focus. */
840
881
  onfocus?: (worksheet: worksheetInstance) => void;
841
882
  /** When the spreadsheet loses the focus. */
@@ -843,9 +884,9 @@ declare namespace jspreadsheet {
843
884
  /** When merge cells is executed. */
844
885
  onmerge?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void;
845
886
  /** When the header title is changed. */
846
- onchangeheader?: (worksheet: worksheetInstance, column: number, newValue: string, oldValue: string) => void;
887
+ onchangeheader?: (worksheet: worksheetInstance, column: number, newValue: string, oldValue: string | undefined) => void;
847
888
  /** When the footers are created or updated. */
848
- onchangefooter?: (worksheet: worksheetInstance, newValue: string, oldValue: string) => void;
889
+ onchangefooter?: (worksheet: worksheetInstance, newValue: string[][], oldValue: string[][] | undefined) => void;
849
890
  /** When the value in a cell footer is changed. */
850
891
  onchangefootervalue?: (worksheet: worksheetInstance, x: number, y: number, value: string) => void;
851
892
  /** When the footer cell is rendered */
@@ -857,19 +898,19 @@ declare namespace jspreadsheet {
857
898
  /** When an editor is created. */
858
899
  oncreateeditor?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, element: HTMLElement, options: object) => void;
859
900
  /** When the editor is opened. */
860
- oneditionstart?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number) => boolean | void;
901
+ oneditionstart?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number) => boolean | undefined;
861
902
  /** When the editor is closed. */
862
903
  oneditionend?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, save: boolean) => void;
863
904
  /** When the style of a cell is changed. */
864
- onchangestyle?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void;
905
+ onchangestyle?: (worksheet: worksheetInstance, newValue: Record<string, string>, oldValue: Record<string, string | null>) => void;
865
906
  /** When a cell meta information is added or updated. */
866
- onchangemeta?: (worksheet: worksheetInstance, newValue: object) => void;
907
+ onchangemeta?: (worksheet: worksheetInstance, newValue: Record<string, any>) => void;
867
908
  /** Before the page is changed. Can cancel the action when return is false. */
868
- onbeforechangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPage: number, quantityPerPage: number) => boolean | void;
909
+ onbeforechangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPage: number, quantityPerPage: number) => boolean | undefined;
869
910
  /** When pagination is enabled and the user changes the page. */
870
911
  onchangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPageNumber: number, quantityPerPage: number) => void;
871
912
  /** Add or change the options of a new worksheet. */
872
- onbeforecreateworksheet?: (worksheetOptions: Worksheet, options: object, position: number) => object;
913
+ onbeforecreateworksheet?: (worksheetOptions: Worksheet, position: number) => Worksheet | false | undefined;
873
914
  /** When the user creates a new worksheet. */
874
915
  oncreateworksheet?: (worksheet: worksheetInstance, worksheetOptions: Worksheet, position: number) => void;
875
916
  /** When the user renames a worksheet. */
@@ -881,81 +922,81 @@ declare namespace jspreadsheet {
881
922
  /** When the user opens a worksheet. */
882
923
  onopenworksheet?: (worksheet: worksheetInstance, index: number) => void;
883
924
  /** When there is a row id update */
884
- onchangerowid?: (worksheet: worksheetInstance, rows: []) => void;
925
+ onchangerowid?: (worksheet: worksheetInstance, rows: any[] | Record<string, any>) => void;
885
926
  /** Before the search method starts */
886
927
  onsearchstart?: (worksheet: worksheetInstance, query: string) => void;
887
928
  /** Before the search method starts */
888
- onsearchrow?: (worksheet: worksheetInstance, row: number, query: string) => boolean;
929
+ onsearchrow?: (worksheet: worksheetInstance, row: number, query: string, terms: RegExp) => boolean;
889
930
  /** 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. */
890
- onbeforesearch?: (worksheet: worksheetInstance, query: string, results: []) => [] | boolean | void;
931
+ onbeforesearch?: (worksheet: worksheetInstance, query: string, results: number[]) => number[] | false | undefined;
891
932
  /** After the search is applied to the rows. */
892
- onsearch?: (worksheet: worksheetInstance, query: string, results: []) => void;
933
+ onsearch?: (worksheet: worksheetInstance, query: string, results: number[]) => void;
893
934
  /** Action to be executed before filtering rows. It can cancel the action by returning false. */
894
- onbeforefilter?: (worksheet: worksheetInstance, filters: [], data: []) => void;
935
+ onbeforefilter?: (worksheet: worksheetInstance, filters: string[][], data: number[]) => false | number[] | undefined;
895
936
  /** After the filter has been applied to the rows. */
896
- onfilter?: (worksheet: worksheetInstance, filters: [], data: []) => void;
937
+ onfilter?: (worksheet: worksheetInstance, filters: string[][], data: number[]) => void;
897
938
  /** When a new cell is created */
898
939
  oncreatecell?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => void;
899
940
  /** When a new row is created */
900
- oncreaterow?: (worksheet: worksheetInstance, rowNumber: number, tr: HTMLElement) => void;
941
+ oncreaterow?: (worksheet: worksheetInstance, rowNumber: number, tr: HTMLTableRowElement) => void;
901
942
  /** When a new column is created */
902
943
  oncreatecolumn?: (worksheet: worksheetInstance, columnNumber: number, td: HTMLElement, options: Column) => void;
903
944
  /** A way to change the formula in real-time before execution */
904
- onbeforeformula?: (worksheet: worksheetInstance, expression: string, x: number, y: number) => string | false | void;
945
+ onbeforeformula?: (worksheet: worksheetInstance, expression: string, x: number, y: number) => string | false | undefined;
905
946
  /** Get the information about the expressions executed from the formula chain */
906
947
  onformulachain?: (worksheet: worksheetInstance, expressions: Array<object>) => void;
907
948
  /** Customize the items available when filter editor is open. */
908
- onopenfilter?: (worksheet: worksheetInstance, column: number, options: Array<object>) => void | Array<object>;
949
+ onopenfilter?: (worksheet: worksheetInstance, column: number, options: Record<string, any>[]) => Record<string, any>[] | Promise<Record<string, any>[]> | undefined;
909
950
  /** When the viewport dimension is updated. */
910
- onresize?: (worksheet: worksheetInstance, w: number, h: number) => void
951
+ onresize?: (w: number, h: number) => void
911
952
  /** Intercept the ajax call before save. XHR ajax object */
912
953
  onbeforesend?: (worksheet: worksheetInstance, xhr: object) => void
913
954
  /** When defined names is affected */
914
- onchangedefinednames?: (worksheet: object, data: []) => void
955
+ onchangedefinednames?: (worksheet: worksheetInstance, data: Record<string, any>[]) => void
915
956
  /** New char is entered on editor. */
916
- oninput?: (worksheet: object, event: object) => void
957
+ oninput?: (worksheet: object, event: object, text: string) => void
917
958
  /** When change the row visibility */
918
- onchangerowvisibility?: (worksheet: object, state: boolean, rows: []) => void
959
+ onchangerowvisibility?: (worksheet: worksheetInstance, state: boolean, rows: number[]) => void
919
960
  /** When change the column visibility */
920
- onchangecolumnvisibility?: (worksheet: object, state: boolean, columns: []) => void
961
+ onchangecolumnvisibility?: (worksheet: worksheetInstance, state: boolean, columns: number[]) => void
921
962
  /** When a new row group is created */
922
- ongrouprow?: (worksheet: object, row: number, numOfItems: number) => void
963
+ ongrouprow?: (worksheet: worksheetInstance, row: number, numOfItems: number) => void
923
964
  /** When open a row group */
924
- onopenrowgroup?: (worksheet: object, row: number) => void
965
+ onopenrowgroup?: (worksheet: worksheetInstance, row: number) => void
925
966
  /** When close a row group */
926
- oncloserowgroup?: (worksheet: object, row: number) => void
967
+ oncloserowgroup?: (worksheet: worksheetInstance, row: number) => void
927
968
  /** When a new column group is created */
928
- ongroupcolumn?: (worksheet: object, column: number, numOfItems: number) => void
969
+ ongroupcolumn?: (worksheet: worksheetInstance, column: number, numOfItems: number) => void
929
970
  /** When open a column group */
930
- onopencolumngroup?: (worksheet: object, column: number) => void
971
+ onopencolumngroup?: (worksheet: worksheetInstance, column: number) => void
931
972
  /** When close a column group */
932
- onclosecolumngroup?: (worksheet: object, column: number) => void
973
+ onclosecolumngroup?: (worksheet: worksheetInstance, column: number) => void
933
974
  /** When a media object is added, removed or updated. */
934
- onchangemedia?: (worksheet: object, newValue: object[], oldValue: object, affectedRecords: object[]) => void
975
+ onchangemedia?: (worksheet: worksheetInstance, newValue: object[], oldValue: object[], affectedRecords: object[]) => void;
935
976
  /** Before loading an image */
936
- onbeforeloadimage?: (worksheet: object, img: HTMLElement, options: object) => undefined | string | boolean;
977
+ onbeforeloadimage?: (worksheet: worksheetInstance, img: HTMLImageElement, options: object) => undefined | string | false;
937
978
  /** Update references. When a table structure changes */
938
- onchangereferences?: (worksheet: object, affected: object, deletedTokens: string[], deletedColumns: string[], deletedRows: string[]) => void;
979
+ onchangereferences?: (worksheet: object, affected: Record<string, any>, deletedTokens: string[], deletedColumns: number[], deletedRows: number[]) => void;
939
980
  /** When the cell is changed */
940
- onchangeproperty?: (worksheet: object, records: object[]) => void;
981
+ onchangeproperty?: (worksheet: worksheetInstance, records: Record<string, any>[]) => void;
941
982
  /** Fire when there is a change in the config */
942
- onchangeconfig?: (worksheet: object, config: string|object, spreadsheetLevel?: boolean) => void;
983
+ onchangeconfig?: (config: string, spreadsheetLevel?: boolean) => void;
984
+ /** Fire when a worksheet's visibility is changed. */
985
+ onchangeworksheetstate?: (spreadsheet: spreadsheetInstance, worksheetIndex: number, state: boolean) => void;
943
986
  /** General event handler */
944
- onevent?: (worksheet: worksheetInstance, method: string, a?: any, b?: any, c?: any, d?: any, e?: any, f?: any) => any
987
+ onevent?: (worksheet: worksheetInstance, method: string, ...args: any[]) => any
988
+ /** Fire when a cell's metadata is reset. */
989
+ onresetmeta?: (worksheet: worksheetInstance, cellNames: string[] | undefined) => void;
990
+ /** Fire when a cell's style is reset. */
991
+ onresetstyle?: (worksheet: worksheetInstance, cellNames: string[]) => void;
992
+ /** Fire when a validation is created, changed or removed. */
993
+ onvalidation?: (worksheet: worksheetInstance, records: { index: number, value: Validation | null, oldValue: Validation | null }[]) => void;
945
994
  /** Return false to cancel the contextMenu event, or return custom elements for the contextmenu. */
946
995
  contextMenu?: Contextmenu | null;
947
- /** The first row is the header titles when parsing a HTML table */
948
- parseTableFirstRowAsHeader?: boolean;
949
- /** Try to identify a column type when parsing a HTML table */
950
- parseTableAutoCellType?: boolean;
951
- /** Global cell wrapping. Default: false */
952
- wordWrap?: boolean;
953
996
  /** About information */
954
- about?: string | Function,
955
- /** License string */
956
- license?: string | null;
997
+ about?: string,
957
998
  /** Worksheets */
958
- worksheets?: Array<Worksheet>;
999
+ worksheets?: Worksheet[];
959
1000
  /** Validations */
960
1001
  validations?: Validation[];
961
1002
  /** Plugins */
@@ -975,14 +1016,10 @@ declare namespace jspreadsheet {
975
1016
  /** International configuration */
976
1017
  international?: International;
977
1018
  /** Persistence handler */
978
- persistence?: (method: string, args: object) => void;
979
- /** Spreadsheet name */
980
- name?: string;
1019
+ persistence?: (worksheet: worksheetInstance, method: string, args: object) => void;
981
1020
  }
982
1021
 
983
1022
  interface Worksheet {
984
- /** Logo URL */
985
- logo?: string
986
1023
  /** Load the data from an external server URL */
987
1024
  url?: string;
988
1025
  /** Persistence URL or true when the URL is the same of the URL of the data source */
@@ -997,10 +1034,8 @@ declare namespace jspreadsheet {
997
1034
  columns?: Array<Column>;
998
1035
  /** Define the properties of a cell. This property overwrite the column definitions */
999
1036
  cells?: Record<string, Cell>;
1000
- /** Role of this worksheet */
1001
- role?: string,
1002
1037
  /** Nested headers definition */
1003
- nestedHeaders?: Array<Array<Nested>> | Array<Nested>;
1038
+ nestedHeaders?: Array<Array<Nested>>;
1004
1039
  /** Default column width. Default: 50px */
1005
1040
  defaultColWidth?: number | string;
1006
1041
  /** Default row height. Default: null */
@@ -1015,9 +1050,9 @@ declare namespace jspreadsheet {
1015
1050
  minDimensions?: [number, number];
1016
1051
  /** CSV data source URL */
1017
1052
  csv?: string;
1018
- /** CSV default filename for the jspreadsheet exports. Default: 'jspreadsheet' */
1053
+ /** CSV default filename for the jspreadsheet exports. Default: worksheetName */
1019
1054
  csvFileName?: string;
1020
- /** Consider first line as header. Default: true */
1055
+ /** Consider first line as header. Default: false */
1021
1056
  csvHeaders?: boolean;
1022
1057
  /** Delimiter to consider when dealing with the CSV data. Default: ',' */
1023
1058
  csvDelimiter?: string;
@@ -1045,24 +1080,22 @@ declare namespace jspreadsheet {
1045
1080
  allowManualInsertColumn?: boolean;
1046
1081
  /** Allow rows to be deleted. Default: true */
1047
1082
  allowDeleteRow?: boolean;
1048
- /** Allow all rows to be deleted. Warning: no rows left can lead to undesirabled behavior. Default: false */
1049
- allowDeletingAllRows?: boolean;
1050
1083
  /** Allow columns to be deleted. Default: true */
1051
1084
  allowDeleteColumn?: boolean;
1052
1085
  /** Allow rename column. Default: true */
1053
1086
  allowRenameColumn?: boolean;
1054
- /** Allow users to add comments to the cells. Default: false */
1087
+ /** Allow users to add comments to the cells. Default: true */
1055
1088
  allowComments?: boolean;
1056
1089
  /** Corner selection and corner data cloning. Default: true */
1057
1090
  fillHandle?: boolean;
1058
1091
  /** Merged cells. Default: null */
1059
- mergeCells?: Record<string, any[]>;
1092
+ mergeCells?: Record<string, [number, number]>;
1060
1093
  /** Allow search on the spreadsheet */
1061
1094
  search?: boolean;
1062
1095
  /** Activate pagination and defines the number of records per page. Default: false */
1063
- pagination?: number | boolean;
1096
+ pagination?: number;
1064
1097
  /** Dropdown for the user to change the number of records per page. Example: [10,25,50,100]. Default: false */
1065
- paginationOptions?: boolean | Array<number>;
1098
+ paginationOptions?: Array<number>;
1066
1099
  /** Text Overflow. Default: false */
1067
1100
  textOverflow?: boolean;
1068
1101
  /** Table overflow. Default: false */
@@ -1089,8 +1122,6 @@ declare namespace jspreadsheet {
1089
1122
  freezeColumnControl?: boolean,
1090
1123
  /** Enable freeze row manual control. Default: false */
1091
1124
  freezeRowControl?: boolean,
1092
- /** Deprecated. Call orderBy inside onload. */
1093
- orderBy?: [number, boolean];
1094
1125
  /** Worksheet Unique Id. */
1095
1126
  worksheetId?: string;
1096
1127
  /** Worksheet Name. */
@@ -1100,11 +1131,9 @@ declare namespace jspreadsheet {
1100
1131
  /** Enable the column filters */
1101
1132
  filters?: boolean | string;
1102
1133
  /** Footers */
1103
- footers?: Array<any>;
1134
+ footers?: any[][];
1104
1135
  /** Apply mask on footers. Default: true */
1105
1136
  applyMaskOnFooters?: boolean;
1106
- /** Define options for the plugins. Each key should be the pluginName. */
1107
- pluginOptions?: Record<string, any>;
1108
1137
  /** This is a internal controller for the spreadsheet locked properties. Please use editable to make it readonly. */
1109
1138
  locked?: boolean;
1110
1139
  /** Allow the selection of unlocked cells. Default: true. */
@@ -1113,8 +1142,6 @@ declare namespace jspreadsheet {
1113
1142
  selectLockedCells?: boolean;
1114
1143
  /** Enable resizable worksheet in on or both direction (horizontal | vertical | both). Default: none */
1115
1144
  resize?: 'horizontal' | 'vertical' | 'both' | 'none' | undefined;
1116
- /** Wrap. Default: false */
1117
- wrap?: boolean;
1118
1145
  /** Show the worksheet gridlines. Default: true */
1119
1146
  gridline?: boolean;
1120
1147
  /** Floating images or charts. */
@@ -1127,15 +1154,19 @@ declare namespace jspreadsheet {
1127
1154
  autoNames?: boolean;
1128
1155
  }
1129
1156
 
1157
+ interface SpreadsheetHTMLElement extends HTMLDivElement {
1158
+ spreadsheet: spreadsheetInstance;
1159
+ }
1160
+
1130
1161
  interface spreadsheetInstance {
1131
1162
  /** Spreadsheet configuration */
1132
1163
  config: Spreadsheet;
1133
1164
  /** Contextmenu HTMLElement */
1134
1165
  contextmenu: HTMLElement;
1135
1166
  /** DOM Element */
1136
- el: HTMLElement;
1167
+ el: SpreadsheetHTMLElement;
1137
1168
  /** DOM Element. Alias for el */
1138
- element: HTMLElement;
1169
+ element: SpreadsheetHTMLElement;
1139
1170
  /** DOM Element container for the filters */
1140
1171
  filter: HTMLElement;
1141
1172
  /** Toggle the full screen mode */
@@ -1154,16 +1185,8 @@ declare namespace jspreadsheet {
1154
1185
  name: string;
1155
1186
  /** List of plugins loaded to the spreadsheet */
1156
1187
  plugins: Record<string, Plugin>;
1157
- /** Processing flag. It would be true when the spreadsheet is loading. */
1158
- processing: boolean;
1159
1188
  /** Show progressbar */
1160
1189
  progress: (state: boolean) => void;
1161
- /** Queue of formulas used during the loading */
1162
- queue: Map<object, object>;
1163
- /** Undo */
1164
- undo: () => void;
1165
- /** Redo */
1166
- redo: () => void;
1167
1190
  /** DOM Textarea helper */
1168
1191
  textarea: HTMLElement;
1169
1192
  /** DOM toolbar */
@@ -1171,58 +1194,73 @@ declare namespace jspreadsheet {
1171
1194
  /** Tools HTMLElement container */
1172
1195
  tools: HTMLElement;
1173
1196
  /** Worksheets container */
1174
- worksheets: Array<Worksheet>;
1197
+ worksheets: Array<worksheetInstance>;
1175
1198
  /** Load plugins into the spreadsheet */
1176
1199
  setPlugins: (plugins: Record<string, Function>) => void;
1177
1200
  /** Internal method: event dispatch controllers. */
1178
- dispatch: (...args: string[]) => void;
1201
+ dispatch: (event: string, ...args: any[]) => any;
1179
1202
  /** Get the spreadsheet configuration */
1180
1203
  getConfig: () => Spreadsheet;
1181
1204
  /** Get the worksheet index by instance or worksheetId */
1182
- getWorksheet: (worksheetIdent: worksheetInstance|string, instance?: boolean) => number;
1205
+ getWorksheet(worksheetIdent: worksheetInstance): number | false;
1206
+ getWorksheet(worksheetIdent: string, instance?: boolean): worksheetInstance | number | false;
1183
1207
  /** Get the worksheet name */
1184
- getWorksheetName: (position: number) => string;
1208
+ getWorksheetName: (position: number) => string | undefined;
1185
1209
  /** Get the worksheet instance by its name */
1186
- getWorksheetInstanceByName: (worksheetName: string, namespace?: string) => worksheetInstance;
1210
+ getWorksheetInstanceByName: GetWorksheetInstanceByNameFunction;
1187
1211
  /** Open a worksheet */
1188
- openWorksheet: (position: number) => void;
1212
+ openWorksheet: (position: number, force?: boolean) => void;
1189
1213
  /** Create a new worksheet */
1190
- createWorksheet: (worksheetOptions: Worksheet, position?: Number) => worksheetInstance;
1214
+ createWorksheet: (worksheetOptions: Worksheet, position?: number) => worksheetInstance | false;
1191
1215
  /** Delete an existing worksheet by its position */
1192
- deleteWorksheet: (position: number) => void;
1216
+ deleteWorksheet: (position: number) => false | undefined;
1193
1217
  /** Rename an existing worksheet by its position */
1194
- renameWorksheet: (position: number, title: string) => void;
1218
+ renameWorksheet: (position: number, title: string) => false | undefined;
1195
1219
  /** Move the position of a worksheet. ignoreDomUpdates: true will block updates to the DOM */
1196
- moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => void;
1220
+ moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => false | undefined;
1197
1221
  /** Get the active worksheet when applicable */
1198
1222
  getWorksheetActive: () => number;
1199
- /** Get the worksheet instance by its position */
1200
- getWorksheetInstance: (position: number) => worksheetInstance;
1201
1223
  /** Parse the toolbar definitions with defaults */
1202
- getToolbar: (toolbar: Toolbar) => object,
1224
+ getToolbar: (toolbar?: Toolbar | ToolbarItem[] | Function) => object,
1203
1225
  /** Set the toolbar */
1204
- setToolbar: (toolbar: Toolbar) => void;
1226
+ setToolbar: (toolbar: Toolbar | ToolbarItem[] | Function) => void;
1205
1227
  /** Show the toolbar */
1206
1228
  showToolbar: () => void;
1207
1229
  /** Hide the toolbar */
1208
1230
  hideToolbar: () => void;
1209
1231
  /** Refresh the toolbar based on the current worksheet */
1210
- refreshToolbar: () => void;
1211
- /** Internal validations cache */
1212
- validations: () => void;
1232
+ refreshToolbar: (worksheet?: worksheetInstance) => void;
1233
+ /** Set a worksheet state visibility */
1234
+ setWorksheetState: (worksheetIndex: number, state: boolean) => void;
1235
+ /** Change the spreadsheet settings */
1236
+ setConfig: (config: Spreadsheet) => void;
1213
1237
  /** Destroy the spreadsheet */
1214
- destroy: () => void;
1238
+ destroy: (spreadsheet?: spreadsheetInstance | SpreadsheetHTMLElement, destroyEventHandlers?: boolean) => void;
1239
+ }
1240
+
1241
+ interface CustomArray<T> extends Array<T> {
1242
+ [key: string]: any;
1215
1243
  }
1216
1244
 
1245
+ interface ColumnInstance extends Column {
1246
+ x: number;
1247
+ colElement: HTMLTableColElement;
1248
+ element: HTMLTableCellElement
1249
+ }
1250
+
1251
+ type DeleteMediaItem = string | { id: string, [key: string]: any };
1252
+
1253
+ type SetValueFirstArgument = string | { x: number, y: number, value: any, force?: boolean }[];
1254
+
1217
1255
  interface worksheetInstance {
1218
1256
  /** Array with the borders information */
1219
- borders: Border[] | Border;
1257
+ borders: CustomArray<Border>;
1220
1258
  /** Close the edition for one cell */
1221
1259
  closeEditor: (cell: HTMLElement|null, save: boolean) => void;
1222
1260
  /** Close the filters */
1223
- closeFilters: (update: boolean) => void;
1224
- /** Array with the HTML element references that define the columns */
1225
- colgroup: HTMLElement[];
1261
+ closeFilter: (update: boolean) => void;
1262
+ /** Column settings */
1263
+ cols: ColumnInstance;
1226
1264
  /** Hold the colgroup container */
1227
1265
  colgroupContainer: HTMLElement;
1228
1266
  /** DOM Worksheet container */
@@ -1236,157 +1274,147 @@ declare namespace jspreadsheet {
1236
1274
  /** Cut */
1237
1275
  cut: () => void;
1238
1276
  /** Alias to getData */
1239
- data: (highlighted?: boolean, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string | null;
1277
+ data: (highlighted?: boolean | RangeCoords, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string;
1240
1278
  /** Internal use control type to defined JSON (1) or ARRAY (0). */
1241
1279
  dataType: number,
1242
1280
  /** Delete one more columns */
1243
- deleteColumn: (columnNumber: number|number[], numOfColumns?: number) => void;
1281
+ deleteColumn(columnNumber: number[]): false | undefined;
1282
+ deleteColumn(columnNumber: number, numOfColumns?: number): false | undefined;
1244
1283
  /** Delete an existing row or rows */
1245
- deleteRow: (rowNumber: number|number[], numOfRows?: number) => void;
1284
+ deleteRow(rowNumber: number[]): false | undefined;
1285
+ deleteRow(rowNumber: number, numOfRows?: number): false | undefined;
1246
1286
  /** Destroy all merged cells */
1247
- destroyMerged: () => void;
1248
- /** Legacy alias destroyMerged */
1249
1287
  destroyMerge: () => void;
1250
1288
  /** Internal method: event dispatch controllers. */
1251
- dispatch: (...args: string[]) => void;
1289
+ dispatch: (event: string, ...args: any[]) => any;
1252
1290
  /** Navigation down */
1253
1291
  down: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
1254
1292
  /** If extension render exists, execute render extension else download CSV */
1255
- download: (includeHeaders?: boolean, processed?: boolean, csv?: boolean) => void;
1293
+ download: (includeHeaders?: boolean, processed?: boolean, csv?: boolean) => false | string | undefined;
1256
1294
  /** Download CSV */
1257
- downloadCSV: (includeHeaders?: boolean, processed?: boolean) => void;
1258
- /** Edition controllers */
1259
- edition?: [];
1260
- /** DOM Worksheet. Alias for worksheet */
1295
+ downloadCSV: (includeHeaders?: boolean, processed?: boolean) => false | string | undefined;
1296
+ /** DOM Worksheet. */
1261
1297
  element: HTMLElement;
1262
1298
  /** Internal method: Execute a formula. */
1263
- executeFormula: (expression: string, x?: number, y?: number, caching?: boolean, basic?: boolean) => void;
1299
+ executeFormula: (expression: string, x?: number, y?: number, caching?: boolean, basic?: boolean) => any;
1264
1300
  /** Navigation first */
1265
1301
  first: (shiftKey?: boolean, ctrlKey?: boolean) => void;
1266
1302
  /** Internal footer controllers */
1267
- footers: Record<string, string>;
1268
- /** Toggle the fullscreen mode */
1269
- fullscreen: (state: boolean) => void;
1303
+ footers: Record<string, any>;
1270
1304
  /** Get the border */
1271
1305
  getBorder: (alias: string) => object;
1272
1306
  /** Get the cell element from the cellName or via its coordinates x,y */
1273
- getCell: (cellNameOrColumnNumber: string|number, y?: number) => HTMLElement | null;
1307
+ getCell(cellName: string): HTMLElement;
1308
+ getCell(columnNumber: number, y: number): HTMLElement;
1274
1309
  /** Alias to getCell */
1275
- getCellFromCoords: (x: number, y: number) => HTMLElement | null;
1310
+ getCellFromCoords(cellName: string): HTMLElement;
1311
+ getCellFromCoords(columnNumber: number, y: number): HTMLElement;
1276
1312
  /** Get attributes from one cell when applicable */
1277
- getCells: (cellName: string) => Column;
1313
+ getCells: (cellName?: string) => Cell | Record<string, Cell> | undefined;
1278
1314
  /** Get the column object by its position */
1279
- getColumn: (position: number) => Column;
1315
+ getColumn(): Column[];
1316
+ getColumn(position: number): ColumnInstance | undefined;
1280
1317
  /** Get the column data from its number */
1281
- getColumnData: (col: number, processed?: boolean) => Array<any>;
1318
+ getColumnData: (col: number, processed?: boolean) => false | Array<any>;
1282
1319
  /** Get the column position by its name */
1283
- getColumnIdByName: (name: string) => number;
1320
+ getColumnIdByName: (name: string) => number | false;
1284
1321
  /** Alias for getProperties */
1285
- getColumnOptions: (x: number, y?: number) => Column;
1322
+ getColumnOptions: (x: number, y?: number) => Cell | ColumnInstance | undefined;
1286
1323
  /** Get the comments from one cell or multiple cells. Example: getComments('A1') */
1287
- getComments: (cellName?: string) => string | object;
1324
+ getComments: (cellName?: string) => string | Comment[] | Record<string, string | Comment[]> | undefined;
1288
1325
  /** Get the cached values from one cell or multiple cells. Example: getCache('A1') */
1289
- getCache: (cellName?: string) => string | object;
1326
+ getCache: (cellName?: string) => false | string | object;
1290
1327
  /** Get the worksheet settings */
1291
1328
  getConfig: () => Worksheet;
1292
- /**
1293
- * Get the worksheet data
1294
- *
1295
- * @param {boolean} only the selected cells
1296
- * @param {boolean} get the raw or processed data
1297
- * @param {string} delimiter to get the data as a string with columns separate by the char delimiter.
1298
- * @param {boolean} get the data as a JSON object.
1299
- * @return {array|string|null} array or string
1300
- */
1301
- getData: (highlighted?: boolean, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string | null;
1329
+ /** Get the worksheet data */
1330
+ getData: (highlighted?: boolean | RangeCoords, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string;
1302
1331
  /** Get the worksheet data from a range */
1303
1332
  getDataFromRange: (range: string, processed?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string | null;
1304
1333
  /** Get the defined name or all defined names when key is null */
1305
- getDefinedNames: (key?: string) => object;
1334
+ getDefinedNames: (key?: string) => any;
1306
1335
  /** Internal method: Get the editor for one cell */
1307
- getEditor: (x: number, y: number) => Column;
1336
+ getEditor: (x: number, y: number) => [Editor, Cell | Column];
1308
1337
  /** Internal method: Get the filter */
1309
- getFilter: (column: number, getAsSets?: boolean) => Array<any>;
1338
+ getFilter: (column: number, getAsSets?: boolean) => string[] | string[][] | Set<string> | Set<string>[] | undefined;
1310
1339
  /** Get the footers configuration */
1311
- getFooter: () => Array<any>;
1340
+ getFooter: () => Array<any> | undefined;
1312
1341
  /** Get the footer value */
1313
1342
  getFooterValue: (x: number, y: number) => any;
1314
1343
  /** Get the header title */
1315
1344
  getHeader: (columnNumber: number) => string;
1316
1345
  /** Get all header elements */
1317
- getHeaders: (asArray: boolean) => Array<any>;
1346
+ getHeaders: (asArray: boolean) => string | string[];
1318
1347
  /** Get the height of one row by its position when height is defined. */
1319
1348
  getHeight: (row?: number) => Array<number> | number;
1320
1349
  /** Bring an array of selection coordinates [x1,y1,x2,y2][]. */
1321
- getHighlighted: () => null | number[][];
1350
+ getHighlighted: () => RangeCoords[];
1322
1351
  /** Get the data as JSON. */
1323
- getJson: (h?: boolean, processed?: boolean, delimiter?: boolean, asJson?: boolean) => any;
1352
+ getJson: (highlighted?: boolean | RangeCoords, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string;
1324
1353
  /** Get the processed data cell shown to the user by the cell name or coordinates. */
1325
- getLabel: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => string;
1354
+ getLabel: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => any;
1326
1355
  /** Aliases for getLabel */
1327
- getLabelFromCoords: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => string;
1356
+ getLabelFromCoords: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => any;
1328
1357
  /** Get the merged cells. Cell name: A1, A2, etc or null for all cells */
1329
- getMerge: (cellName?: string) => object | Array<number>;
1358
+ getMerge: (cellName?: string) => [number, number] | Record<string, [number, number]> | undefined;
1330
1359
  /** Get one or all meta information for one cell. */
1331
- getMeta: (cellName: string, property: string) => object;
1360
+ getMeta: (cellName: string, property: string) => object | undefined;
1332
1361
  /** Get the nested cells */
1333
- getNestedCell: (x: number, y: number, properties?: any) => object;
1362
+ getNestedCell: (x: number, y: number) => HTMLTableCellElement;
1334
1363
  /** Get the nested headers */
1335
- getNestedHeaders: () => [];
1364
+ getNestedHeaders: () => Nested[][] | undefined;
1336
1365
  /** Get the next available number in the sequence */
1337
- getNextSequence: () => number;
1366
+ getNextSequence: () => number | null;
1338
1367
  /** Alias to getProperty */
1339
- getOptions: (x: number, y?: number) => Column;
1368
+ getOptions: (x: number, y?: number) => Cell | ColumnInstance | undefined;
1340
1369
  /** Get the primaryKey column when applicable. */
1341
- getPrimaryKey: () => number;
1370
+ getPrimaryKey: () => number | false;
1342
1371
  /** Get processed data by the coordinates of the cell. Extended process a color, progressbar and rating as raw. */
1343
1372
  getProcessed: (x: number, y: number, extended?: boolean) => any;
1344
1373
  /** Get the properties for one column when only x is present or the cell when x and y is defined. */
1345
- getProperties: (x: number, y?: number) => Column;
1374
+ getProperties: (x: number, y?: number) => Cell | ColumnInstance | undefined;
1346
1375
  /** Deprecated. Legacy alias to getProperties */
1347
- getProperty: (x: number, y?: number) => Column;
1376
+ getProperty: (x: number, y?: number) => Cell | ColumnInstance | undefined;
1348
1377
  /** Get the selection in a range format */
1349
- getRange: () => string;
1378
+ getRange: (coords?: RangeCoords, includeName?: boolean) => string;
1350
1379
  /** Get a row data or meta information by Id. */
1351
- getRowById: (row: number, element: boolean) => Row;
1380
+ getRowById: (row: number, element?: boolean) => RowInstance | false | any[][] | Record<string, any>[];
1352
1381
  /** Get the data from one row */
1353
- getRowData: (row: number, processed: boolean) => any[];
1382
+ getRowData: (row: number, processed?: boolean) => any[] | Record<string, any> | undefined;
1354
1383
  /** Get the row id from its position */
1355
- getRowId: (row: number) => number;
1384
+ getRowId: (row: number, primaryKey?: boolean) => any;
1356
1385
  /**
1357
1386
  * Get the selected cells
1358
1387
  * @param {boolean?} columnNameOnly - Return an array of cell names or cell DOM elements
1359
1388
  */
1360
- getSelected: (columnNameOnly?: boolean) => any[];
1389
+ getSelected: (columnNameOnly?: boolean) => string[] | { x: number, y: number }[];
1361
1390
  /** Get the coordinates of the main selection */
1362
- getSelection: (preserveOrder?: boolean) => null | Array<number>;
1391
+ getSelection: (preserveOrder?: boolean) => RangeCoords | undefined;
1363
1392
  /** Get the selected columns indexes */
1364
1393
  getSelectedColumns: (visibleOnly?: boolean) => number[];
1365
1394
  /** Get the selected rows indexes. */
1366
1395
  getSelectedRows: (visibleOnly?: boolean) => number[];
1367
1396
 
1368
1397
  /** Get the style from a cell or all cells. getStyle() or getStyle('A1') */
1369
- getStyle: (cellName?: string|null, onlyIndexes?: boolean) => string|object;
1398
+ getStyle: (cellName?: string | null, onlyIndexes?: boolean) => string | number | Record<string, string> | Record<string, number> | undefined;
1370
1399
  /** Get the style index from a cell or all cells */
1371
- getStyleIndexes: (cellName?: string|null) => number|object;
1400
+ getStyleIndexes: (cellName?: string | null) => number | Record<string, number> | undefined;
1372
1401
  /** Find a style ID from a style string. Null when no styleId is found */
1373
- getStyleId: (styleString?: string) => number|null;
1402
+ getStyleId: (styleString?: string) => number | null;
1374
1403
  /** Get value by the cell name or object. The value can be the raw or processed value. */
1375
- getValue: (cell: string, processed: boolean) => string;
1404
+ getValue(cell: string, processed?: boolean): Array<Array<any>> | Array<Record<string, any>> | string;
1405
+ getValue(cell: { x: number, y: number }, processed?: boolean): any;
1376
1406
  /** Get value by the coordinates. The value can be the source or processed value, including not formatted proceed data. */
1377
1407
  getValueFromCoords: (x: number, y: number, processed?: boolean, raw?: boolean) => any;
1378
1408
  /** Get the width of one column by index or all column width as an array when index is null. */
1379
1409
  getWidth: (x?: number) => Array<number> | number;
1380
1410
  /** Go to the row number, [col number] */
1381
- goto: (y: number, x?: number) => void;
1411
+ goto: (y?: number | null, x?: number | null) => void;
1382
1412
  /** Hold the header container */
1383
1413
  headerContainer: HTMLElement;
1384
- /** Array with the header DOM elements */
1385
- headers: Array<HTMLElement>;
1386
1414
  /** Hide column */
1387
1415
  hideColumn: (column: number|number[]) => void;
1388
1416
  /** Hide the filters for column, columns or cell range. */
1389
- hideFilter: (colNumber?: number) => void;
1417
+ hideFilter: (colNumber?: number | string) => void;
1390
1418
  /** Hide index column */
1391
1419
  hideIndex: () => void;
1392
1420
  /** Hide row */
@@ -1395,63 +1423,76 @@ declare namespace jspreadsheet {
1395
1423
  hideSearch: () => void;
1396
1424
  /**
1397
1425
  * Add new column(s)
1398
- * @param {number|object[]} column - number of columns or array with column information
1399
- * @param {number?} columnNumber - reference when the first argument is a number
1400
- * @param {boolean?} insertBefore - insertBefore when the first argument is a number
1401
- * @param {object?} properties - column properties
1402
- * @param {any?} data
1403
- * @param {boolean?} createSelection
1426
+ * @param column - number of columns or array with column information
1427
+ * @param columnNumber - reference when the first argument is a number
1428
+ * @param insertBefore - insertBefore when the first argument is a number
1429
+ * @param properties - column properties
1430
+ * @param data
1431
+ * @param createSelection
1404
1432
  */
1405
- insertColumn: (column?: number | newColumn[], columnNumber?: number, insertBefore?: boolean, properties?: Column[], data?: any, createSelection?: boolean) => void;
1433
+ insertColumn: (column?: number | newColumn[], columnNumber?: number, insertBefore?: boolean, properties?: Column[], data?: any, createSelection?: boolean) => false | undefined;
1406
1434
  /**
1407
1435
  * Add new row(s)
1408
- * @param {number|object[]} row - number of rows or array with row information
1409
- * @param {number?} rowNumber - reference when the first argument is a number
1410
- * @param {boolean?} insertBefore - insertBefore when the first argument is a number
1411
- * @param {any?} data
1412
- * @param {boolean?} createSelection
1436
+ * @param row - number of rows or array with row information
1437
+ * @param rowNumber - reference when the first argument is a number
1438
+ * @param insertBefore - insertBefore when the first argument is a number
1439
+ * @param data
1440
+ * @param createSelection
1413
1441
  */
1414
- insertRow: (row?: number | newRow[], rowNumber?: number, insertBefore?: boolean, data?: any, createSelection?: boolean) => void;
1442
+ insertRow: (row?: number | newRow[], rowNumber?: number, insertBefore?: boolean, data?: any, createSelection?: boolean) => false | undefined;
1415
1443
  /** Check if cell is attached to the DOM */
1416
1444
  isAttached: (x: number, y: number) => boolean;
1417
1445
  /** The worksheet is editable */
1418
1446
  isEditable: () => boolean;
1447
+ /** Check if the cell is merged */
1448
+ isMerged: (x: number, y: number) => Records | false;
1419
1449
  /** Check if cell is readonly or not by cellName or Coordinates. isReadonly('A1') or isReadonly(x, y) */
1420
- isReadOnly: (cellNameOrX: string|number, y?: number) => boolean;
1450
+ isReadOnly(cellNameOrX: string, y?: undefined, ignoreLocked?: boolean): boolean | null;
1451
+ isReadOnly(cellNameOrX: number, y: number, ignoreLocked?: boolean): boolean | null;
1452
+ /** Check if the row is merged */
1453
+ isRowMerged: (row: number) => Records | undefined;
1421
1454
  /** Verify if this coordinates is within a selection or blank for the current selection */
1422
- isSelected: (x: number, y: number, selection?: number[]) => boolean;
1455
+ isSelected: (x: number, y: number, selection?: RangeCoords) => boolean;
1423
1456
  /** Navigation last */
1424
1457
  last: (shiftKey?: boolean, ctrlKey?: boolean) => void;
1425
1458
  /** Navigation left */
1426
1459
  left: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
1427
1460
  /** Change the data without events */
1428
1461
  loadData: (data: any[], adjustDimension?: boolean) => void;
1462
+ /** HTML element that contains the floating media */
1463
+ media: HTMLDivElement;
1429
1464
  /** Move one or more columns to another position */
1430
- moveColumn: (col: number, to: number, quantityOfColumns?: number) => void;
1465
+ moveColumn: (col: number, to: number, quantityOfColumns?: number) => false | undefined;
1431
1466
  /** Move one or more rows to another position */
1432
- moveRow: (row: number, to: number, quantityOfRows?: number) => void;
1467
+ moveRow: (row: number, to: number, quantityOfRows?: number) => false | undefined;
1433
1468
  /** Get the column name */
1434
- name: (col: number) => string;
1469
+ name: (col: number) => string | number;
1435
1470
  /** Start the edition for one cell */
1436
- openEditor: (cell: HTMLElement, empty?: boolean, mouseEvent?: object) => void;
1471
+ openEditor: (cell: HTMLElement, empty?: boolean, mouseEvent?: object) => false | undefined;
1437
1472
  /** Open the filters */
1438
1473
  openFilter: (column: number) => void;
1439
1474
  /** Worksheet configuration */
1440
1475
  options: Worksheet;
1441
1476
  /** Sort one column by its position. ASC (0) or DESC (1) */
1442
- orderBy: (column: number, direction: boolean, internalValueController?: any[], internalPreviousStateController?: boolean) => void;
1477
+ orderBy: (column: number, direction?: boolean, internalValueController?: number[], internalPreviousStateController?: any) => void;
1443
1478
  /** Change page when using pagination */
1444
- page: (pageNumber: number, callBack?: Function) => void;
1479
+ page: (pageNumber: number | null, callBack?: Function) => false | undefined;
1480
+
1481
+ pageDown: () => void;
1445
1482
  /** Current page number */
1446
1483
  pageNumber: number;
1484
+
1485
+ pageUp: () => void;
1447
1486
  /** Pagination DOM container */
1448
1487
  pagination: HTMLElement;
1449
1488
  /** Spreadsheet object */
1450
1489
  parent: spreadsheetInstance;
1451
1490
  /** Paste */
1452
- paste: (x: number, y: number, data: string | any[]) => void;
1491
+ paste: (x: number, y: number, data: string | any[], selections?: boolean) => false | undefined;
1492
+
1493
+ print: () => void;
1453
1494
  /** Get the quantity of pages when pagination is active */
1454
- quantityOfPages?: () => number;
1495
+ quantityOfPages?: () => number | false;
1455
1496
  /** Array container for all cell DOM elements */
1456
1497
  records: Records[][];
1457
1498
  /** Refresh the borders by the border name */
@@ -1459,9 +1500,9 @@ declare namespace jspreadsheet {
1459
1500
  /** Refresh footers */
1460
1501
  refreshFooter: () => void;
1461
1502
  /** Remove the merged cells by the cell name or a object with all cells to be removed. */
1462
- removeMerge: (cellName: string | object) => void;
1503
+ removeMerge: (cellName: string | Record<string, any>) => false | undefined;
1463
1504
  /** Reset the borders by name border name */
1464
- resetBorders: (border: string, resetPosition: boolean) => void;
1505
+ resetBorders: (border?: string, resetPosition?: boolean) => void;
1465
1506
  /** Reset the filter of one or all columns */
1466
1507
  resetFilters: (colNumber?: number, destroy?: boolean) => void;
1467
1508
  /** Destroy the footers */
@@ -1469,15 +1510,15 @@ declare namespace jspreadsheet {
1469
1510
  /** Destroy freeze columns */
1470
1511
  resetFreezeColumns: () => void;
1471
1512
  /** Reset meta data of one or multiple cells. Null for all cells */
1472
- resetMeta: (cellName?: string[]|string) => void;
1513
+ resetMeta: (cellName?: string[]|string) => false | undefined;
1473
1514
  /** Reset nested headers */
1474
1515
  resetNestedHeaders: () => void;
1475
1516
  /** Reset the search */
1476
1517
  resetSearch: () => void;
1477
1518
  /** Reset the main selection */
1478
- resetSelection: () => void;
1519
+ resetSelection: () => boolean;
1479
1520
  /** Get the style from one cell. Ex. resetStyle('A1') or resetStyle(['A1']) */
1480
- resetStyle: (cell?: string|string[]) => void;
1521
+ resetStyle: (cell?: string|string[]) => false | undefined;
1481
1522
  /** DOM array of results */
1482
1523
  results: Array<number> | null;
1483
1524
  /** Navigation right */
@@ -1488,12 +1529,8 @@ declare namespace jspreadsheet {
1488
1529
  rows: RowInstance[] | Record<number, RowInstance>;
1489
1530
  /** Persistence helper method. The callback is executed with a JSON from the server */
1490
1531
  save: (url: string, data: object, token?: string, callback?: (result: object) => void) => void;
1491
- /** ScrollX DOM Element */
1492
- scrollX: HTMLElement;
1493
- /** ScrollY DOM Element */
1494
- scrollY: HTMLElement;
1495
1532
  /** Search for something */
1496
- search: (str: string) => void;
1533
+ search: (str: string) => false | undefined;
1497
1534
  /** Search HTML container */
1498
1535
  searchContainer: HTMLElement;
1499
1536
  /** Search HTML input */
@@ -1501,88 +1538,99 @@ declare namespace jspreadsheet {
1501
1538
  /** Select All */
1502
1539
  selectAll: () => void;
1503
1540
  /** Selected cells */
1504
- selectedCell: any[];
1541
+ selectedCell: RangeCoords | null;
1505
1542
  /** Internal record id sequence */
1506
1543
  sequence: number;
1507
1544
  /** Set borders with a border name and color. */
1508
1545
  setBorder: (x1: number, y1: number, x2: number, y2: number, border?: string, color?: string) => void;
1509
1546
  /** Set attributes for one cell */
1510
- setCells: (cellName: string, settings: Column) => void;
1547
+ setCells(cellName: Record<string, Cell>): false | undefined;
1548
+ setCells(cellName: string, settings: Cell): false | undefined;
1511
1549
  /** Set the column data from its number */
1512
1550
  setColumnData: (col: number, data: any[], force?: boolean) => void;
1513
1551
  /** Set the comments for one or multiple cells */
1514
- setComments: (cellName: string | Record<string, string>, comments?: string) => void;
1552
+ setComments(cellName: Record<string, string>): false | undefined;
1553
+ setComments(cellName: string, comments: string): false | undefined;
1515
1554
  /** Set the cache for one or multiple cells */
1516
- setCache: (cellName: string | Record<string, string>, values?: string) => void;
1555
+ setCache(cellName: Record<string, any>): false | undefined;
1556
+ setCache(cellName: string, values?: any): false | undefined;
1517
1557
  /** Change the worksheet settings */
1518
- setConfig: (config: Worksheet) => void;
1558
+ setConfig: (config: Worksheet | Spreadsheet, spreadsheetLevel?: boolean) => void;
1519
1559
  /** Set the worksheet data */
1520
1560
  setData: (data: any[]) => void;
1521
1561
  /** Create or update names */
1522
- setDefinedNames: (names: DefinedNames[]) => void;
1562
+ setDefinedNames: (names: DefinedNames | DefinedNames[]) => void;
1523
1563
  /** Reset names by indexes */
1524
1564
  resetDefinedNames: (names: DefinedNames[]) => void;
1525
1565
  /** Set filter */
1526
- setFilter: (colNumber: number, keywords: any[]) => void;
1566
+ setFilter: (colNumber: number, keywords?: string[]) => void;
1527
1567
  /** Set the footers */
1528
- setFooter: (data: []) => void;
1568
+ setFooter: (data: any[][]) => void;
1529
1569
  /** Set the footer value */
1530
1570
  setFooterValue: (col: number, row: number, value: any) => void;
1531
1571
  /** List of columns to freeze. Should be a number or an array of consecutive numbers. Example: [4,5,6] */
1532
- setFreezeColumns: (num: number|number[]) => void;
1572
+ setFreezeColumns: (num?: number | number[] | null) => void;
1533
1573
  /** Set the header title. Empty or null to reset to the default header value. */
1534
- setHeader: (x: number, title?: string) => void;
1574
+ setHeader: (x: number, title?: string) => false | undefined;
1535
1575
  /** Set the height of one row by its position. currentHeight is for internal use only */
1536
1576
  setHeight: (row: number|number[], height: number|number[], currentHeight?: number|number[]) => void;
1537
1577
  /** Get the merged cells. Cell name: A1, A2, etc */
1538
- setMerge: (cellName: string | object, colspan?: number, rowspan?: number) => void;
1578
+ setMerge(cellName: Record<string, [number, number]>): false | undefined;
1579
+ setMerge(cellName: string, colspan: number, rowspan: number): false | undefined;
1539
1580
  /** Get one or various meta information for one cell. */
1540
- setMeta: (cell: string | object, property?: string, value?: string) => void;
1581
+ setMeta: (cell: string | Record<string, any>, property?: string, value?: string) => false | undefined;
1541
1582
  /** Set the nested headers */
1542
- setNestedHeaders: (config: any[]) => void;
1583
+ setNestedHeaders: (config: Nested[][]) => void;
1543
1584
  /** Deprecated. Alias for parent.setPlugins */
1544
1585
  setPlugins: (plugins: Record<string, Function>) => void;
1545
1586
  /** Alias for setProperty */
1546
- setProperties: (columnNumber: number, rowNumberOrColumnSettings: number|Column, cellSettings?: Cell) => void;
1587
+ setProperties(columnNumber: number, rowNumber: number, cellSettings?: Cell): boolean;
1588
+ setProperties(columnNumber: number, columnSettings: Column): boolean;
1589
+ setProperties(changes: ({ x: number, value: Column } | { x: number, y: number, value: Cell })[]): boolean;
1590
+ setProperties(changes: Record<string, Cell>): boolean;
1547
1591
  /** Add a new configuration settings for a column or cell */
1548
- setProperty: (columnNumber: number, rowNumberOrColumnSettings: number|Column, cellSettings?: Cell) => void;
1592
+ setProperty(columnNumber: number, rowNumber: number, cellSettings?: Cell): boolean;
1593
+ setProperty(columnNumber: number, columnSettings: Column): boolean;
1594
+ setProperty(changes: ({ x: number, value: Column } | { x: number, y: number, value: Cell })[]): boolean;
1595
+ setProperty(changes: Record<string, Cell>): boolean;
1549
1596
  /** Add new properties to the existing column or cell settings */
1550
- updateProperty: (columnNumber: number, rowNumberOrColumnSettings: number|Column, cellSettings?: Cell) => void;
1597
+ updateProperty(columnNumber: number, rowNumber: number, cellSettings?: Cell, ignoreDOM?: boolean): void;
1598
+ updateProperty(columnNumber: ({ x: number, value: Column } | { x: number, y: number, value: Cell })[], rowNumber?: undefined, cellSettings?: undefined, ignoreDOM?: boolean): void;
1551
1599
  /** Set or reset the cell as readonly */
1552
1600
  setReadOnly: (cellName: string|HTMLElement, state: boolean) => void;
1553
1601
  /** Set the data from one row */
1554
- setRowData: (row: number, data: any[], force: boolean) => void;
1602
+ setRowData: (row: number, data: any[], force?: boolean) => void;
1555
1603
  /** Set the row id from its position */
1556
- setRowId: (row: number, newId: number) => void;
1604
+ setRowId(row: Record<number, number>): void;
1605
+ setRowId(row: number, newId: number): void;
1557
1606
  /** Set the style for one cell. Ex. setStyle('A1', 'background-color', 'red') */
1558
- setStyle: (cell: string | object, property?: string, value?: string, forceOverwrite?: boolean) => void;
1607
+ setStyle(cell: string | string[] | { x: number, y: number }[], property: string, value?: string, forceOverwrite?: boolean): false | undefined;
1608
+ setStyle(cell: Record<string, string>, property?: undefined, value?: undefined, forceOverwrite?: boolean): false | undefined;
1559
1609
  /**
1560
1610
  * Set a cell value
1561
1611
  *
1562
- * @param {string|string[]|object} cell destination cell
1563
- * @param {string|number} value
1564
- * @param {boolean} force value over readonly cells
1565
- * @return void
1612
+ * @param cell destination cell
1613
+ * @param value
1614
+ * @param force value over readonly cells
1566
1615
  */
1567
- setValue: (cell: string|string[]|object, value?: string|number, forceOverwrite?: boolean) => void;
1616
+ setValue: (cell: SetValueFirstArgument, value?: any, forceOverwrite?: boolean, origin?: string) => false | undefined;
1568
1617
  /**
1569
1618
  * Set a cell value
1570
1619
  *
1571
- * @param {number} x
1572
- * @param {number} y
1573
- * @param {string|number} value value
1574
- * @param {boolean} force value over readonly cells
1575
- * @return void
1620
+ * @param x
1621
+ * @param y
1622
+ * @param value value
1623
+ * @param force value over readonly cells
1576
1624
  */
1577
- setValueFromCoords: (x: number, y: number, value: string|number, force?: boolean) => void;
1625
+ setValueFromCoords: (x: number, y: number, value: any, force?: boolean) => void;
1578
1626
  /** Set viewport width and height */
1579
1627
  setViewport: (width: number, height: number) => void;
1580
1628
  /** Set the width of one column by its position */
1581
- setWidth: (col: number|number[], width: number|number[]) => void;
1629
+ setWidth: (col: number | number[], width: number | number[], oldWidth?: number | number[]) => void;
1582
1630
  /** Show column */
1583
1631
  showColumn: (column: number|number[]) => void;
1584
1632
  /** Show filter controls for one column, all columns or a cell range */
1585
- showFilter: (columnOrCellRange?: number|string) => void;
1633
+ showFilter: (columnOrCellRange?: number | string | null) => void;
1586
1634
  /** Show index column */
1587
1635
  showIndex: () => void;
1588
1636
  /** Show row */
@@ -1602,25 +1650,24 @@ declare namespace jspreadsheet {
1602
1650
  /**
1603
1651
  * Internal method: Internal method: Set a cell value
1604
1652
  *
1605
- * @param {number} x
1606
- * @param {number} y
1607
- * @param {string} value value
1608
- * @param {string} force value over readonly cells
1609
- * @return void
1653
+ * @param x
1654
+ * @param y
1655
+ * @param value value
1656
+ * @param force value over readonly cells
1610
1657
  */
1611
- updateCell: (x: number, y: number, value: string, force?: boolean) => void;
1658
+ updateCell: (x: number, y: number, value: any, force?: boolean) => void;
1612
1659
  /** Internal method: update cells in a batch */
1613
- updateCells: (o: Array<Record<string, object>>) => void;
1660
+ updateCells: (o: Record<string, any>[]) => void;
1614
1661
  /** Update the selection based on coordinates */
1615
- updateSelectionFromCoords: (x1: number, y1: number, x2?: number, y2?: number, origin?: boolean, type?: string, color?: string) => void;
1662
+ updateSelectionFromCoords: (x1: number | number, y1: number | number, x2?: number | number, y2?: number | number, origin?: boolean, type?: string, color?: string) => void;
1616
1663
  /** Getter/setter the value by coordinates */
1617
- value?: (x: number, y: number, value?: any) => void;
1664
+ value?: (x: number | string, y: number, value?: any, removeProperty?: boolean) => any;
1618
1665
  /** Current page or which page the row number is */
1619
- whichPage?: (row?: number) => number;
1666
+ whichPage?: (row?: number) => number | false | null;
1620
1667
  /** Get all group of rows */
1621
- getRowGroup: () => object;
1668
+ getRowGroup: () => Record<number, { group: number, state: boolean }>;
1622
1669
  /** Create a new group of rows */
1623
- setRowGroup: (row: number, numOfItems?: number) => void;
1670
+ setRowGroup: (row: number, numOfItems?: number, state?: boolean, ignoreHistory?: boolean) => void;
1624
1671
  /** Open a new group of rows */
1625
1672
  openRowGroup: (row: number) => void;
1626
1673
  /** Close a new group of rows */
@@ -1628,17 +1675,15 @@ declare namespace jspreadsheet {
1628
1675
  /** Reset a group of rows */
1629
1676
  resetRowGroup: (row: number) => void;
1630
1677
  /** Get all group of columns */
1631
- getColumnGroup: () => object;
1678
+ getColumnGroup: () => Record<number, { group: number, state: boolean }>;
1632
1679
  /** Create a new group of columns */
1633
- setColumnGroup: (column: number, numOfItems?: number) => void;
1680
+ setColumnGroup: (column: number, numOfItems?: number, state?: boolean, ignoreHistory?: boolean) => void;
1634
1681
  /** Open a new group of columns */
1635
1682
  openColumnGroup: (column: number) => void;
1636
1683
  /** Close a new group of columns */
1637
1684
  closeColumnGroup: (column: number) => void;
1638
1685
  /** Reset a group of columns */
1639
1686
  resetColumnGroup: (column: number) => void;
1640
- /** Resize the given column numbers based on their content. */
1641
- autoResize: (column: number[]) => void;
1642
1687
  /** Aliases for jspreadsheet.helpers. Tools to handle spreadsheet data */
1643
1688
  helpers: Helpers;
1644
1689
  /** Internal persistence handler */
@@ -1647,8 +1692,6 @@ declare namespace jspreadsheet {
1647
1692
  undo: () => void;
1648
1693
  /** Deprecated. Alias for parent.redo */
1649
1694
  redo: () => void;
1650
- /** Internal formula tracking */
1651
- tracking?: number[];
1652
1695
  /** Visible columns on the viewport */
1653
1696
  visibleRows?: number[];
1654
1697
  /** Visible columns on the viewport */
@@ -1658,31 +1701,38 @@ declare namespace jspreadsheet {
1658
1701
  /** Viewport current width */
1659
1702
  height?: number;
1660
1703
  /** Get the row object or get the rows configuration when pass null. */
1661
- getRow: (row?: number) => RowInstance;
1662
- /** Internal worksheet onload method */
1663
- onload?: () => void;
1704
+ getRow: (row?: number) => Row[] | RowInstance;
1664
1705
  /** Internal nested headers DOM container */
1665
1706
  nested?: object;
1666
1707
  /** List of rows to freeze. Should be a number or an array of consecutive numbers. Example: [4,5,6] */
1667
- setFreezeRows: (numberOfRows: number|number[]) => void;
1708
+ setFreezeRows: (numberOfRows?: number | number[] | null) => void;
1668
1709
  /** Reset the freeze rows */
1669
1710
  resetFreezeRows: () => void;
1670
1711
  /** Reset the properties of a cell */
1671
- resetProperty: (x: number, y: number) => void;
1712
+ resetProperty: (x: number, y: number) => boolean;
1672
1713
  /** Internal method */
1673
1714
  setFormula: () => void;
1674
1715
  /** Update nested cell properties */
1675
- setNestedCell: (x: number, y: number, properties: Nested) => void;
1716
+ setNestedCell(x: number, y: number, properties: Nested): false | undefined;
1717
+ setNestedCell(
1718
+ changes: {
1719
+ x: number,
1720
+ y: number,
1721
+ properties: Nested
1722
+ }[]
1723
+ ): false | undefined;
1676
1724
  /** Get a validation object. Require the extension Validations. */
1677
- getValidations: (validationIndex: number | null) => Validation | Validation[];
1725
+ getValidations: (validationIndex?: number) => Validation | Validation[] | undefined;
1678
1726
  /** Insert or update existing validations by index. Require the extension Validations. */
1679
- setValidations: (validations: Validations[]) => void;
1727
+ setValidations: (validations: Validations | Validations[]) => false | undefined;
1680
1728
  /** Reset validations by validation indexes. Require the extension Validations. Undefined will remove all validations */
1681
- resetValidations: (validationIndex?: number | number[]) => void;
1729
+ resetValidations: (validationIndex?: number | number[]) => false | undefined;
1682
1730
  /** Load all validations rules from a cell based on its coordinates. */
1683
- loadValidations: (xOrCell: number|object, y?: number, includeIndexes?: boolean) => object[];
1731
+ loadValidations(xOrCell: Records, y?: undefined, includeIndexes?: boolean): Validation[] | { index: number, rules: Validation }[] | undefined;
1732
+ loadValidations(xOrCell: number, y: number, includeIndexes?: boolean): Validation[] | { index: number, rules: Validation }[] | undefined;
1684
1733
  /** This method returns true if a cell fails to meet all the defined validation criteria. If invoked without arguments, this method will scan the entire worksheet and return true if it detects validation errors. */
1685
- hasErrors: (col?: number|object, row?: number) => boolean;
1734
+ hasErrors(col: string): boolean;
1735
+ hasErrors(col?: number, row?: number): boolean;
1686
1736
  /** Resize columns to match the visible content */
1687
1737
  autoWidth: (columns: number[]) => void;
1688
1738
  /** Show the column headers */
@@ -1692,51 +1742,50 @@ declare namespace jspreadsheet {
1692
1742
  /** Refresh the search on the viewport */
1693
1743
  updateSearch: () => void;
1694
1744
  /** Get the worksheet index by instance or worksheetId */
1695
- getWorksheet: (worksheetIdent: worksheetInstance|string, instance?: boolean) => number;
1745
+ getWorksheet(worksheetIdent: worksheetInstance): number | false;
1746
+ getWorksheet(worksheetIdent: string, instance?: boolean): worksheetInstance | number | false;
1696
1747
  /** Open a worksheet */
1697
- openWorksheet: (position?: number) => void;
1748
+ openWorksheet: (position?: number, force?: boolean) => void;
1698
1749
  /** Create a new worksheet */
1699
- createWorksheet: (worksheetOptions: Worksheet, position?: Number) => worksheetInstance;
1750
+ createWorksheet: (worksheetOptions: Worksheet, position?: number) => false | worksheetInstance;
1700
1751
  /** Delete an existing worksheet by its position */
1701
- deleteWorksheet: (position?: number) => void;
1752
+ deleteWorksheet: (position?: number) => false | undefined;
1702
1753
  /** Rename an existing worksheet by its position */
1703
- renameWorksheet: (position: number, title: string) => void;
1754
+ renameWorksheet: (position: number | undefined, title: string) => false | undefined;
1704
1755
  /** Move the position of a worksheet. ignoreDomUpdates: true will block updates to the DOM */
1705
- moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => void;
1756
+ moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => false | undefined;
1706
1757
  /** Get the active worksheet when applicable */
1707
1758
  getWorksheetActive: () => number;
1708
1759
  /** Get the worksheet name */
1709
- getWorksheetName: (position?: number) => string;
1760
+ getWorksheetName: (position?: number) => string | undefined;
1710
1761
  /** Get the worksheet instance by its name */
1711
- getWorksheetInstanceByName: (worksheetName: string, namespace?: string) => worksheetInstance;
1762
+ getWorksheetInstanceByName: GetWorksheetInstanceByNameFunction;
1712
1763
  /** Set a worksheet state visibility */
1713
1764
  setWorksheetState: (worksheetIndex: number, state: boolean) => void;
1714
1765
  /** Parse the toolbar definitions with defaults */
1715
- getToolbar: (toolbar: Toolbar) => object;
1766
+ getToolbar: (toolbar?: Toolbar | ToolbarItem[] | Function) => object;
1716
1767
  /** Set the toolbar */
1717
- setToolbar: (toolbar: Toolbar) => void;
1768
+ setToolbar: (toolbar: Toolbar | ToolbarItem[] | Function) => void;
1718
1769
  /** Show the toolbar */
1719
1770
  showToolbar: () => void;
1720
1771
  /** Hide the toolbar */
1721
1772
  hideToolbar: () => void;
1722
1773
  /** Refresh the toolbar based on the current worksheet */
1723
- refreshToolbar: () => void;
1724
- /** Add, update or delete a new worksheet floating image */
1725
- setMedia: (items: Media[]) => void;
1774
+ refreshToolbar: (worksheet?: worksheetInstance) => void;
1775
+ /** Add, update or delete a worksheet media */
1776
+ setMedia: (items: Partial<Media> | Partial<Media[]>) => void;
1726
1777
  /** Get a media element position or object by guid. */
1727
- getMedia: (guid: string, position?: boolean) => void;
1778
+ getMedia: (guid: string, position?: boolean) => number | Media | null;
1728
1779
  /** List of all guids to delete. Can be charts and images */
1729
- deleteMedia: (items: object[]|string[]) => void;
1780
+ deleteMedia: (items: DeleteMediaItem | DeleteMediaItem[]) => false | undefined;
1730
1781
  /** Add a global formula to the tracking system. Use from formula pro. Only use if necessary. */
1731
1782
  setTracking: () => void;
1732
- /** Internal column names */
1733
- names: object;
1734
1783
  /** Set a worksheet zoom value > 0 and <= 1. */
1735
1784
  setZoom: (value: number) => void;
1736
1785
  /** Get the current zoom value. Default 1 */
1737
1786
  getZoom: () => number;
1738
- // Get the coordinates as a number from a range string. Adjust helps to define the height dynamically when you have A:A ranges for example. Works in the same way for 1:1 ranges. Default: true
1739
- getCoordsFromRange: (range: string, adjust?: boolean) => [number,number,number,number];
1787
+ /** Get the coordinates as a number from a range string. Adjust helps to define the height dynamically when you have A:A ranges for example. Works in the same way for 1:1 ranges. Default: true */
1788
+ getCoordsFromRange: (range: string, adjust?: boolean) => [number | null, number | null, number | null, number | null];
1740
1789
  }
1741
1790
 
1742
1791
  interface International {
@@ -1744,8 +1793,6 @@ declare namespace jspreadsheet {
1744
1793
  locale: string;
1745
1794
  /** General number format */
1746
1795
  NumberFormat?: Intl.NumberFormat;
1747
- /** Not yet implemented */
1748
- DateTimeFormat?: Intl.DateTimeFormat;
1749
1796
  }
1750
1797
  }
1751
1798