jspreadsheet 11.4.2 → 11.4.3

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