jspreadsheet 11.11.0 → 11.11.1

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