jspreadsheet 8.0.41 → 8.0.42

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
@@ -3,909 +3,961 @@
3
3
  * https://jspreadsheet.com
4
4
  * Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
5
  */
6
+ interface jspreadsheet {
7
+ (element?: HTMLElement, options?: Spreadsheet): Array<worksheetInstance>
6
8
 
7
- declare function jspreadsheet(element?: HTMLElement, options?: jspreadsheet.Spreadsheet): Array<jspreadsheet.worksheetInstance>;
9
+ /** Set extensions to the JSS spreadsheet. Example { formula, parser, render } */
10
+ setExtensions(extensions: object) : void
8
11
 
9
- declare namespace jspreadsheet {
12
+ [key: string]: any
13
+ }
10
14
 
11
- /** License string */
12
- let license: string | null;
15
+ interface Tabs {
16
+ /** Allow to create new tabs */
17
+ allowCreate?: boolean;
18
+ /** Hide headers */
19
+ hideHeaders?: boolean;
20
+ /** Allow drag and drop to change tabs position */
21
+ allowChangePosition?: boolean;
22
+ }
13
23
 
14
- /** Set the license globaly to all spreadsheets and extensions */
15
- function setLicense(license: string) : void;
24
+ interface Toolbar {
25
+ /** Array of items for the toolbar */
26
+ items: Array<ToolbarItem>;
27
+ /** Responsive toolbar. Default: true. */
28
+ responsive?: boolean;
29
+ }
16
30
 
17
- /** Set extensions to the JSS spreadsheet. Example { formula, parser, render } */
18
- function setExtensions(extensions: object) : void;
31
+ interface ToolbarItem {
32
+ /** Toolbar item type */
33
+ type?: 'icon' | 'divisor' | 'label' | 'select';
34
+ /** Content of the toolbar element */
35
+ content?: string;
36
+ /** Tooltip for the toolbar element */
37
+ tooltip?: string;
38
+ /** Toolbar element width */
39
+ width?: number;
40
+ /** The initial selected option for the type: select */
41
+ value?: string;
42
+ /** Render method parser for the elements in the dropdown when type: select */
43
+ render?: Function;
44
+ /** When a item is clicked */
45
+ onclick?: Function;
46
+ /** For the type select when a new item is selected */
47
+ onchange?: Function;
48
+ /** To update the state of this item **/
49
+ updateState?: Function;
50
+ }
19
51
 
20
- interface Toolbar {
21
- /** Array of items for the toolbar */
22
- items: Array<ToolbarItem>;
23
- }
52
+ interface Dropdown {
53
+ /** Render type: default | picker | searchbar */
54
+ type?: 'default' | 'picker' | 'searchbar';
55
+ /** Dropdown input placeholder */
56
+ placeholder?: string;
57
+ /** The user can add new options to the dropdown. */
58
+ newOptions?: boolean;
59
+ /** Enabled the remote search features. */
60
+ remoteSearch?: boolean;
61
+ /** Remote backend to respond to the search. */
62
+ url?: string;
63
+ /** When the user add a new item to the dropdown. */
64
+ oninsert?: Function;
65
+ }
24
66
 
25
- interface ToolbarItem {
26
- /** Toolbar item type */
27
- type?: 'icon' | 'divisor' | 'label' | 'select';
28
- /** Content of the toolbar element */
29
- content?: string;
30
- /** Tooltip for the toolbar element */
31
- tooltip?: string;
32
- /** Toolbar element width */
33
- width?: number;
34
- /** The initial selected option for the type: select */
35
- value?: string;
36
- /** Render method parser for the elements in the dropdown when type: select */
37
- render?: Function;
38
- /** When a item is clicked */
39
- onclick?: Function;
40
- /** For the type select when a new item is selected */
41
- onchange?: Function;
42
- /** To update the state of this item **/
43
- updateState?: Function;
44
- }
67
+ interface DropdownItem {
68
+ /** Value of the selected item. */
69
+ id?: string | number;
70
+ /** Label for the selected item. */
71
+ name?: string;
72
+ /** Description of the item */
73
+ title?: string;
74
+ /** Icon of the item */
75
+ image?: string;
76
+ /** Name of the group where the item belongs to */
77
+ group?: string;
78
+ /** Keywords to help finding one item */
79
+ synonym?: Array<string>;
80
+ /** Item is disabled */
81
+ disabled?: boolean;
82
+ /** Color for the item */
83
+ color?: string;
84
+ }
45
85
 
46
- interface Dropdown {
47
- /** Render type: default | picker | searchbar */
48
- type?: 'default' | 'picker' | 'searchbar';
49
- /** Dropdown input placeholder */
50
- placeholder?: string;
51
- /** The user can add new options to the dropdown. */
52
- newOptions?: boolean;
53
- /** Enabled the remote search features. */
54
- remoteSearch?: boolean;
55
- /** Remote backend to respond to the search. */
56
- url?: string;
57
- /** When the user add a new item to the dropdown. */
58
- oninsert?: Function;
59
- }
86
+ interface Calendar {
87
+ /** Render type. Default: 'default' */
88
+ type?: 'default' | 'year-month-picker';
89
+ /** Disable the dates out of the defined range. */
90
+ validRange?: Array<number>;
91
+ /** The calendar starts in a day of week (0 for Sunday - 6 for Saturday). Default: 0 (Sunday) */
92
+ format?: string;
93
+ /** Calendar input is readonly */
94
+ readonly?: boolean;
95
+ /** Select today automatically when no date value is defined. */
96
+ today?: boolean;
97
+ /** Show hour and minute dropdown. */
98
+ time?: boolean;
99
+ /** Show reset button. Default: true */
100
+ resetButton?: boolean;
101
+ /** Calendar input placeholder. */
102
+ placeholder?: string;
103
+ }
60
104
 
61
- interface DropdownItem {
62
- /** Value of the selected item. */
63
- id?: string | number;
64
- /** Label for the selected item. */
65
- name?: string;
66
- /** Description of the item */
67
- title?: string;
68
- /** Icon of the item */
69
- image?: string;
70
- /** Name of the group where the item belongs to */
71
- group?: string;
72
- /** Keywords to help finding one item */
73
- synonym?: Array<string>;
74
- /** Item is disabled */
75
- disabled?: boolean;
76
- /** Color for the item */
77
- color?: string;
78
- }
105
+ interface Column {
106
+ /** Define the column type. Can be a string to define a native editor, or a method to define the custom editor plugin. */
107
+ type?: Editor | 'autocomplete' | 'calendar' | 'checkbox' | 'color' | 'dropdown' | 'hidden' | 'html' | 'image' | 'numeric' | 'radio' | 'text';
108
+ /** Column title */
109
+ title?: string;
110
+ /** Name or a path of a property when the data is a JSON object. */
111
+ name?: string;
112
+ /** Define the onmouseover tooltip for the column header. */
113
+ tooltip?: string;
114
+ /** Width of the column */
115
+ width?: number;
116
+ /** Visibility of a column */
117
+ visible?: boolean,
118
+ /** Column alignment. Default: center */
119
+ align?: 'center' | 'left' | 'right' | 'justify';
120
+ /** It is a method to overwrite the column definitions in real-time just before the column edition. */
121
+ filterOptions?: Function;
122
+ /** Load the items from the dropdown from a remote URL. */
123
+ url?: string;
124
+ /** Define the items in the dropdown and autocomplete column type. */
125
+ source?: Array<DropdownItem>;
126
+ /** Define the dropdown or autocomplete to accept multiple options. */
127
+ multiple?: boolean;
128
+ /** Define the input mask for the data cell. @see https://jsuites.net/v4/javascript-mask */
129
+ mask?: string;
130
+ /** Decimal representation character. */
131
+ decimal?: '.' | ',';
132
+ /** Truncate the string in the cell by any number of characters. */
133
+ truncate?: number,
134
+ /** Disable the mask when editing. */
135
+ disabledMaskOnEdition?: boolean;
136
+ /** It defines a renderer method or rule for the cell content. */
137
+ render?: string | Function;
138
+ /** Define the format of the date or numbers in the cell. Default for the calendar: DD/MM/YYYY */
139
+ format?: string;
140
+ /** Define the column as primaryKey. */
141
+ primaryKey?: boolean;
142
+ /** Extended configuration for one column. */
143
+ options?: Calendar | Dropdown;
144
+ /** The column is read-only */
145
+ readOnly?: boolean;
146
+ /** Wrap the text in the column */
147
+ wordWrap?: boolean;
148
+ /** Process the raw data when copy or download. Default: true */
149
+ process?: boolean;
150
+ }
79
151
 
80
- interface Calendar {
81
- /** Render type. Default: 'default' */
82
- type?: 'default' | 'year-month-picker';
83
- /** Disable the dates out of the defined range. */
84
- validRange?: Array<number>;
85
- /** The calendar starts in a day of week (0 for Sunday - 6 for Saturday). Default: 0 (Sunday) */
86
- format?: string;
87
- /** Calendar input is readonly */
88
- readonly?: boolean;
89
- /** Select today automatically when no date value is defined. */
90
- today?: boolean;
91
- /** Show hour and minute dropdown. */
92
- time?: boolean;
93
- /** Show reset button. Default: true */
94
- resetButton?: boolean;
95
- /** Calendar input placeholder. */
96
- placeholder?: string;
97
- }
152
+ interface Row {
153
+ /** Row height in pixels. */
154
+ height?: number;
155
+ /** Row identification. */
156
+ title?: string;
157
+ }
98
158
 
99
- interface Column {
100
- /** Define the column type. Can be a string to define a native editor, or a method to define the custom editor plugin. */
101
- type?: Editor | 'autocomplete' | 'calendar' | 'checkbox' | 'color' | 'dropdown' | 'hidden' | 'html' | 'image' | 'numeric' | 'radio' | 'text';
102
- /** Column title */
103
- title?: string;
104
- /** Name or a path of a property when the data is a JSON object. */
105
- name?: string;
106
- /** Define the onmouseover tooltip for the column header. */
107
- tooltip?: string;
108
- /** Width of the column */
109
- width?: number;
110
- /** Visibility of a column */
111
- visible?: boolean,
112
- /** Column alignment. Default: center */
113
- align?: 'center' | 'left' | 'right' | 'justify';
114
- /** It is a method to overwrite the column definitions in real-time just before the column edition. */
115
- filterOptions?: Function;
116
- /** Load the items from the dropdown from a remote URL. */
117
- url?: string;
118
- /** Define the items in the dropdown and autocomplete column type. */
119
- source?: Array<DropdownItem>;
120
- /** Define the dropdown or autocomplete to accept multiple options. */
121
- multiple?: boolean;
122
- /** Define the input mask for the data cell. @see https://jsuites.net/v4/javascript-mask */
123
- mask?: string;
124
- /** Decimal representation character. */
125
- decimal?: '.' | ',';
126
- /** Truncate the string in the cell by any number of characters. */
127
- truncate?: number,
128
- /** Disable the mask when editing. */
129
- disabledMaskOnEdition?: boolean;
130
- /** It defines a renderer method or rule for the cell content. */
131
- render?: string | Function;
132
- /** Define the format of the date or numbers in the cell. Default for the calendar: DD/MM/YYYY */
133
- format?: string;
134
- /** Define the column as primaryKey. */
135
- primaryKey?: boolean;
136
- /** Extended configuration for one column. */
137
- options?: Calendar | Dropdown;
138
- /** The column is read-only */
139
- readOnly?: boolean;
140
- /** Wrap the text in the column */
141
- wordWrap?: boolean;
142
- /** Process the raw data when copy or download. Default: true */
143
- process?: boolean;
144
- }
159
+ interface Editor {
160
+ /** createCell When a new cell is created. */
161
+ createCell: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any;
162
+ /** updateCell When the cell value changes. */
163
+ updateCell: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any;
164
+ /** openEditor When the user starts the edition of a cell. */
165
+ openEditor: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any;
166
+ /** closeEditor When the user finalizes the edition of a cell. */
167
+ closeEditor: (cell: HTMLElement, confirmChanges: boolean, x: number, y: number, instance: object, options: object) => any;
168
+ /** get Transform the raw data into processed data. It will shown a text instead of an id in the type dropdown for example. */
169
+ get: (options: object, value: any) => String
170
+ }
145
171
 
146
- interface Row {
147
- /** Row height in pixels. */
148
- height?: number;
149
- /** Row identification. */
150
- title?: string;
151
- }
172
+ interface Plugin {
173
+ /** When a new worksheet is added. */
174
+ init?: (worksheet: Object) => void;
175
+ /** It would receive a call for every spreadsheet event. */
176
+ onevent?: (event: String, a?: any, b?: any, c?: any, d?: any) => void;
177
+ /** When the spreadsheet needs to save something in the server. */
178
+ persistence?: (method: String, args: Object) => void;
179
+ /** When the user opens the context menu. */
180
+ contextMenu?: (instance: Object, x: Number, y: Number, e: MouseEvent, items: [], section: String, a: any, b?: any) => void;
181
+ /** When the toolbar is create and clicked. */
182
+ toolbar?: (instance: Object, items: []) => void;
183
+ }
184
+
185
+ interface Nested {
186
+ /** Nested header title */
187
+ title?: string;
188
+ /** Nested header tooltip */
189
+ tooltip?: string;
190
+ /** Nested header colspan */
191
+ colspan?: number;
192
+ }
193
+
194
+ interface Spreadsheet {
195
+ /** Your application name */
196
+ application? : string;
197
+ /** Render a remote spreadsheet from Jspreadsheet Cloud, which is a serveless hosting service. That can be generate at https://jspreadsheet.com/cloud */
198
+ cloud? : string;
199
+ /** DOM element for binding the javascript events. This property is normally used when JSS is running as a web component. */
200
+ root? : HTMLElement;
201
+ /** Global defined names. It defines global range variables. **/
202
+ definedNames?: Record<string, string>,
203
+ /** Global sorting handler. **/
204
+ sorting?: (direction: boolean, column: number) => number;
205
+ /** Remote URL for the persistence server **/
206
+ server?: string;
207
+
208
+ /** Toolbar */
209
+ toolbar?: boolean | Toolbar;
210
+
211
+ /** Allow table edition */
212
+ editable?: boolean;
213
+ /** Allow data export */
214
+ allowExport?: boolean;
215
+ /** Include the table headers in the first row of the data */
216
+ includeHeadersOnDownload?: boolean;
217
+ /** Force update on paste for read-only cells */
218
+ forceUpdateOnPaste?: boolean;
219
+ /** Enable loading spin when loading data. Default: false. */
220
+ loadingSpin?: boolean;
221
+ /** Render jspreadsheet spreadsheet on full screen mode. Default: false */
222
+ fullscreen?: boolean;
223
+ /** Make sure the formulas are capital letter. Default: true */
224
+ secureFormulas?: boolean;
225
+ /** Enable formula debug. Default: false **/
226
+ debugFormulas?: boolean,
227
+ /** Execute formulas. Default: true */
228
+ parseFormulas?: boolean;
229
+ /** Disable the formula editor. Default: true **/
230
+ editorFormulas?: boolean;
231
+ /** Auto increment cell data when using the corner copy, including formulas, numbers and dates. Default: true */
232
+ autoIncrement?: boolean;
233
+ /** Try to cast numbers from cell values when executing formulas. Default: true */
234
+ autoCasting?: boolean;
235
+ /** Remove any HTML from the data and headers. Default: true */
236
+ stripHTML?: boolean;
237
+ /** Allow tabs. Default: false */
238
+ tabs?: boolean | Tabs;
239
+ /** Allow the user to delete worksheets. Default: true **/
240
+ allowDeleteWorksheet?: boolean;
241
+ /** Allow the user to rename worksheets. Default: true **/
242
+ allowRenameWorksheet?: boolean;
243
+ /** Allow the user to drag and drop the worksheets. Default: true **/
244
+ allowMoveWorksheet?: boolean;
245
+ /** This method is called when the data in the spreadsheet is ready. */
246
+ onload?: (spreadsheet: spreadsheetInstance) => void;
247
+ /** Spreadsheet is clicked **/
248
+ onclick?: (worksheet: worksheetInstance, section: string, x: number, y: number) => void;
249
+ /** When undo is applied */
250
+ onundo?: (worksheet: worksheetInstance, historyRecord: object) => void;
251
+ /** When redo is applied */
252
+ onredo?: (worksheet: worksheetInstance, historyRecord: object) => void;
253
+ /** Before any data is sent to the backend. Can be used to overwrite the data or to cancel the action when return false. */
254
+ onbeforesave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: object) => boolean | object;
255
+ /** After something is saved */
256
+ onsave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: []) => void;
257
+ /** Before a column value is changed. NOTE: It is possible to overwrite the original value, by return a new value on this method. */
258
+ onbeforechange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => boolean | any;
259
+ /** After a column value is changed. */
260
+ onchange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, oldValue: any) => void;
261
+ /** Event: onafterchanges(jspreadsheetHTMLElement, jspreadsheetInstance) */
262
+ onafterchanges?: (worksheet: worksheetInstance, records: Array<any>) => void;
263
+ /** 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. */
264
+ oncopy?: (worksheet: worksheetInstance, selectedCells: [], data: string) => boolean | string;
265
+ /** Before the paste action is performed. Can return parsed or filtered data. It is possible to cancel the action when the return is false. */
266
+ onbeforepaste?: (worksheet: worksheetInstance, data: [], x: number, y: number, style: [], processedData: string) => boolean | [];
267
+ /** After a paste action is performed in the spreadsheet. */
268
+ onpaste?: (worksheet: worksheetInstance, records: Array<any>) => void;
269
+ /** Before a new row is inserted. You can cancel the insert event by returning false. */
270
+ onbeforeinsertrow?: (worksheet: worksheetInstance, rowNumber: number, numOfRows: number, insertBefore: boolean) => boolean | void;
271
+ /** After a new row is inserted. */
272
+ oninsertrow?: (worksheet: worksheetInstance, rowNumber: number, numOfRows: number, rowData: [], insertBefore: boolean) => void;
273
+ /** Before a row is deleted. You can cancel the delete event by returning false. */
274
+ onbeforedeleterow?: (worksheet: worksheetInstance, rowNumber: number, numOfRows: number) => boolean | void;
275
+ /** After a row is excluded. */
276
+ ondeleterow?: (worksheet: worksheetInstance, rowNumber: number, numOfRows: number, rowHTMLElements: [], rowData: [], cellAttributes: []) => void;
277
+ /** Before a new column is inserted. You can cancel the insert event by returning false. */
278
+ onbeforeinsertcolumn?: (worksheet: worksheetInstance, columnNumber: number, numOfColumns: number, insertBefore: boolean) => boolean | void;
279
+ /** After a new column is inserted. */
280
+ oninsertcolumn?: (worksheet: worksheetInstance, columnNumber: number, numOfColumns: number, historyRecords: [], insertBefore: boolean) => void;
281
+ /** Before a column is excluded. You can cancel the insert event by returning false. */
282
+ onbeforedeletecolumn?: (worksheet: worksheetInstance, columnNumber: number, numOfColumns: number) => boolean | void;
283
+ /** After a column is excluded. */
284
+ ondeletecolumn?: (worksheet: worksheetInstance, columnNumber: number, numOfColumns: number, affectedHTMLElements: [], historyProperties: [], cellAttributes: []) => void;
285
+ /** After a row is moved to a new position. */
286
+ onmoverow?: (worksheet: worksheetInstance, origin: number, destination: number) => void;
287
+ /** After a column is moved to a new position. */
288
+ onmovecolumn?: (worksheet: worksheetInstance, origin: number, destination: number) => void;
289
+ /** After a height change for one or more rows. */
290
+ onresizerow?: (worksheet: worksheetInstance, row: number | Array<number>, height: number | Array<number>, oldHeight: number | Array<number>) => void;
291
+ /** After a column width change for one or more columns. */
292
+ onresizecolumn?: (worksheet: worksheetInstance, column: number | Array<number>, width: number | Array<number>, oldWidth: number | Array<number>) => void;
293
+ /** When the selection is changed. */
294
+ onselection?: (worksheet: worksheetInstance, px: number, py: number, ux: number, uy: number, origin?: object) => void;
295
+ /** Before a new comment is added or updated. Return false to cancel the event. */
296
+ onbeforecomments?: (worksheet: worksheetInstance, cells: object) => boolean | void;
297
+ /** After a new comment is added or updated. */
298
+ oncomments?: (worksheet: worksheetInstance, newValues: object, previousValues: object) => void;
299
+ /** It runs before sorting a column. It should return an array with a custom sorting or false to cancel the user action. */
300
+ onbeforesort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: []) => boolean | [] | void;
301
+ /** When a column is sorted. */
302
+ onsort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: []) => void;
303
+ /** When the spreadsheed gets the focus. */
304
+ onfocus?: (worksheet: worksheetInstance) => void;
305
+ /** When the spreadsheet loses the focus. */
306
+ onblur?: (worksheet: worksheetInstance) => void;
307
+ /** When merge cells is executed. */
308
+ onmerge?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void;
309
+ /** When the header title is changed. */
310
+ onchangeheader?: (worksheet: worksheetInstance, column: number, newValue: string, oldValue: string) => void;
311
+ /** When the footers are created or updated. */
312
+ onchangefooter?: (worksheet: worksheetInstance, newValue: string, oldValue: string) => void;
313
+ /** When the value in a cell footer is changed. */
314
+ onchangefootervalue?: (worksheet: worksheetInstance, x: number, y: number, value: String) => void;
152
315
 
153
- interface Editor {
154
- /** createCell When a new cell is created. */
155
- createCell: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any;
156
- /** updateCell When the cell value changes. */
157
- updateCell: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any;
158
- /** openEditor When the user starts the edition of a cell. */
159
- openEditor: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any;
160
- /** closeEditor When the user finalizes the edition of a cell. */
161
- closeEditor: (cell: HTMLElement, confirmChanges: boolean, x: number, y: number, instance: object, options: object) => any;
162
- /** get Transform the raw data into processed data. It will shown a text instead of an id in the type dropdown for example. */
163
- get: (options: object, value: any) => String
164
- }
316
+ /** On change nested headers */
317
+ onchangenested?: (worksheet: worksheetInstance, options: object) => void;
165
318
 
166
- interface Plugin {
167
- /** When a new worksheet is added. */
168
- init?: (worksheet: Object) => void;
169
- /** It would receive a call for every spreadsheet event. */
170
- onevent?: (event: String, a?: any, b?: any, c?: any, d?: any) => void;
171
- /** When the spreadsheet needs to save something in the server. */
172
- persistence?: (method: String, args: Object) => void;
173
- /** When the user opens the context menu. */
174
- contextMenu?: (instance: Object, x: Number, y: Number, e: MouseEvent, items: [], section: String, a: any, b?: any) => void;
175
- /** When the toolbar is create and clicked. */
176
- toolbar?: (instance: Object, items: []) => void;
177
- }
319
+ /** On change nested cell properties */
320
+ onchangenestedcell?: (worksheet: worksheetInstance, x: number, y: number, properties: object) => void;
178
321
 
179
- interface Nested {
180
- /** Nested header title */
181
- title?: string;
182
- /** Nested header tooltip */
183
- tooltip?: string;
184
- /** Nested header colspan */
185
- colspan?: number;
186
- }
322
+ /** When an editor is created. */
323
+ oncreateeditor?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, element: HTMLElement, options: object) => void;
324
+ /** When the editor is opened. **/
325
+ oneditionstart?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number) => void;
326
+ /** When the editor is closed. **/
327
+ oneditionend?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, save: boolean) => void;
328
+ /** When the style of a cell is changed. */
329
+ onchangestyle?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void;
330
+ /** When a cell meta information is added or updated. */
331
+ onchangemeta?: (worksheet: worksheetInstance, newValue: object) => void;
332
+ /** Before the page is changed. Can cancel the action when return is false. */
333
+ onbeforechangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPage: number, quantityPerPage: number) => boolean | void;
334
+ /** When pagination is enabled and the user changes the page. */
335
+ onchangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPageNumber: number, quantityPerPage: number) => void;
336
+ /** Add or change the options of a new worksheet. */
337
+ onbeforecreateworksheet?: (worksheetOptions: Worksheet, position: number) => Object;
338
+ /** When the user creates a new worksheet. */
339
+ oncreateworksheet?: (worksheet: worksheetInstance, worksheetOptions: Worksheet, position: number) => void;
340
+ /** When the user renames a worksheet. */
341
+ onrenameworksheet?: (worksheet: worksheetInstance, position: number, newValue: string, oldValue: string) => void;
342
+ /** When the user deletes a worksheet. */
343
+ ondeleteworksheet?: (worksheet: worksheetInstance, position: number) => void;
344
+ /** When the user updates the worksheet tab position. */
345
+ onmoveworksheet?: (worksheet: worksheetInstance, from: number, to: number) => void;
346
+ /** When the user opens a worksheet. */
347
+ onopenworksheet?: (worksheet: worksheetInstance, index: number) => void;
348
+ /** When there is a row id update */
349
+ onchangerowid?: (worksheet: worksheetInstance, rows: []) => void;
350
+ /** 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. */
351
+ onbeforesearch?: (worksheet: worksheetInstance, query: string, results: []) => [] | boolean | void;
352
+ /** After the search is applied to the rows. */
353
+ onsearch?: (worksheet: worksheetInstance, query: string, results: []) => void;
354
+ /** Action to be executed before filtering rows. It can cancel the action by returning false. */
355
+ onbeforefilter?: (worksheet: worksheetInstance, filters: [], data: []) => void;
356
+ /** After the filter has been applied to the rows. */
357
+ onfilter?: (worksheet: worksheetInstance, filters: [], data: []) => void;
358
+ /** When a new cell is created **/
359
+ oncreatecell?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => void;
360
+ /** Run every single table update action. Can bring performance issues if perform too much changes. */
361
+ updateTable?: (worksheet: worksheetInstance, cell: Object, x: number, y: number, value: String) => void;
362
+ /** Return false to cancel the contextMenu event, or return custom elements for the contextmenu. */
363
+ contextmenu?: (worksheet: worksheetInstance, x: number, y: number, e: Event, section: string, section_argument1?: any, section_argument2?: any) => [] | boolean;
364
+ /** The first row is the header titles when parsing a HTML table */
365
+ parseTableFirstRowAsHeader?: boolean,
366
+ /** Try to identify a column type when parsing a HTML table */
367
+ parseTableAutoCellType?: boolean,
368
+ /** Global cell wrapping. Default: false */
369
+ wordWrap?: boolean;
370
+ /** About information */
371
+ about?: string | Function,
372
+ /** License string */
373
+ license?: string,
374
+ /** Worksheets */
375
+ worksheets?: Array<Worksheet>;
376
+ }
187
377
 
188
- interface Spreadsheet {
189
- /** Your application name */
190
- application? : string;
191
- /** Render a remote spreadsheet from Jspreadsheet Cloud, which is a serveless hosting service. That can be generate at https://jspreadsheet.com/cloud */
192
- cloud? : string;
193
- /** DOM element for binding the javascript events. This property is normally used when JSS is running as a web component. */
194
- root? : HTMLElement;
195
- /** Global defined names. It defines global range variables. **/
196
- definedNames?: Record<string, string>,
197
- /** Global sorting handler. **/
198
- sorting?: (direction: boolean, column: number) => number;
199
- /** Remote URL for the persistence server **/
200
- server?: string,
201
- /** Allow table edition */
202
- editable?: boolean;
203
- /** Allow data export */
204
- allowExport?: boolean;
205
- /** Include the table headers in the first row of the data */
206
- includeHeadersOnDownload?: boolean;
207
- /** Force update on paste for read-only cells */
208
- forceUpdateOnPaste?: boolean;
209
- /** Enable loading spin when loading data. Default: false. */
210
- loadingSpin?: boolean;
211
- /** Render jspreadsheet spreadsheet on full screen mode. Default: false */
212
- fullscreen?: boolean;
213
- /** Make sure the formulas are capital letter. Default: true */
214
- secureFormulas?: boolean;
215
- /** Enable formula debug. Default: false **/
216
- debugFormulas?: boolean,
217
- /** Execute formulas. Default: true */
218
- parseFormulas?: boolean;
219
- /** Disable the formula editor. Default: true **/
220
- editorFormulas?: boolean;
221
- /** Auto increment cell data when using the corner copy, including formulas, numbers and dates. Default: true */
222
- autoIncrement?: boolean;
223
- /** Try to cast numbers from cell values when executing formulas. Default: true */
224
- autoCasting?: boolean;
225
- /** Remove any HTML from the data and headers. Default: true */
226
- stripHTML?: boolean;
227
- /** Allow tabs. Default: false */
228
- tabs?: boolean;
229
- /** Allow the user to delete worksheets. Default: true **/
230
- allowDeleteWorksheet?: boolean;
231
- /** Allow the user to rename worksheets. Default: true **/
232
- allowRenameWorksheet?: boolean;
233
- /** Allow the user to drag and drop the worksheets. Default: true **/
234
- allowMoveWorksheet?: boolean;
235
- /** This method is called when the data in the spreadsheet is ready. */
236
- onload?: (spreadsheet: spreadsheetInstance) => void;
237
- /** Spreadsheet is clicked **/
238
- onclick?: (worksheet: worksheetInstance, section: String, x: Number, y: Number) => void;
239
- /** When undo is applied */
240
- onundo?: (worksheet: worksheetInstance, historyRecord: Object) => void;
241
- /** When redo is applied */
242
- onredo?: (worksheet: worksheetInstance, historyRecord: Object) => void;
243
- /** Before any data is sent to the backend. Can be used to overwrite the data or to cancel the action when return false. */
244
- onbeforesave?: (worksheet: worksheetInstance, instance: Object, data: []) => Boolean | [];
245
- /** After something is saved */
246
- onsave?: (worksheet: worksheetInstance, instance: Object, data: []) => void;
247
- /** Before a column value is changed. NOTE: It is possible to overwrite the original value, by return a new value on this method. */
248
- onbeforechange?: (worksheet: worksheetInstance, cell: Element, x: Number, y: Number, value: String) => String;
249
- /** After a column value is changed. */
250
- onchange?: (worksheet: worksheetInstance, cell: HTMLElement, x: Number, y: Number, newValue: String, oldValue: String) => void;
251
- /** Event: onafterchanges(jspreadsheetHTMLElement, jspreadsheetInstance) */
252
- onafterchanges?: (worksheet: worksheetInstance, records: Array<any>) => void;
253
- /** 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. */
254
- oncopy?: (worksheet: worksheetInstance, selectedCells: [], data: String) => String;
255
- /** Before the paste action is performed. Can return parsed or filtered data, can cancel the action when return false. */
256
- onbeforepaste?: (worksheet: worksheetInstance, data: String, x: Number, y: Number) => [];
257
- /** After a paste action is performed in the spreadsheet. */
258
- onpaste?: (worksheet: worksheetInstance, data: []) => void;
259
- /** Before a new row is inserted. You can cancel the insert event by returning false. */
260
- onbeforeinsertrow?: (worksheet: worksheetInstance, rowNumber: Number, numOfRows: Number, insertBefore: Boolean) => Boolean | undefined;
261
- /** After a new row is inserted. */
262
- oninsertrow?: (worksheet: worksheetInstance, rowNumber: Number, numOfRows: Number, insertBefore: Boolean) => void;
263
- /** Before a row is deleted. You can cancel the delete event by returning false. */
264
- onbeforedeleterow?: (worksheet: worksheetInstance, rowNumber: Number, numOfRows: Number) => Boolean | undefined;
265
- /** After a row is excluded. */
266
- ondeleterow?: (worksheet: worksheetInstance, rowNumber: Number, numOfRows: Number, rowHTMLElements: [], rowData: [], cellAttributes: []) => void;
267
- /** Before a new column is inserted. You can cancel the insert event by returning false. */
268
- onbeforeinsertcolumn?: (worksheet: worksheetInstance, columnNumber: Number, numOfColumns: Number, insertBefore: Boolean) => Boolean | undefined;
269
- /** After a new column is inserted. */
270
- oninsertcolumn?: (worksheet: worksheetInstance, columnNumber: Number, numOfColumns: Number, historyRecords: [], insertBefore: Boolean) => void;
271
- /** Before a column is excluded. You can cancel the insert event by returning false. */
272
- onbeforedeletecolumn?: (worksheet: worksheetInstance, columnNumber: Number, numOfColumns: Number) => Boolean | undefined;
273
- /** After a column is excluded. */
274
- ondeletecolumn?: (worksheet: worksheetInstance, columnNumber: Number, numOfColumns: Number, affectedHTMLElements: [], historyProperties: [], cellAttributes: []) => void;
275
- /** After a row is moved to a new position. */
276
- onmoverow?: (worksheet: worksheetInstance, origin: Number, destination: Number) => void;
277
- /** After a column is moved to a new position. */
278
- onmovecolumn?: (worksheet: worksheetInstance, origin: Number, destination: Number) => void;
279
- /** After a height change for one or more rows. */
280
- onresizerow?: (worksheet: worksheetInstance, row: Number | [], height: Number | [], oldHeight: Number | []) => void;
281
- /** After a column width change for one or more columns. */
282
- onresizecolumn?: (worksheet: worksheetInstance, column: Number | [], width: Number | [], oldWidth: Number | []) => void;
283
- /** When the selection is changed. */
284
- onselection?: (worksheet: worksheetInstance, px: Number, py: Number, ux: Number, uy: Number, origin: Number) => void;
285
- /** Before a new comment is added or updated. Return false to cancel the event. */
286
- onbeforecomments?: (worksheet: worksheetInstance, cells: Object) => Boolean | undefined;
287
- /** After a new comment is added or updated. */
288
- oncomments?: (worksheet: worksheetInstance, cells: Object) => void;
289
- /** It runs before sorting a column. It should return an array with a custom sorting or false to cancel the user action. */
290
- onbeforesort?: (worksheet: worksheetInstance, column: Number, direction: Number, newOrderValues: []) => Boolean | [] | undefined;
291
- /** When a column is sorted. */
292
- onsort?: (worksheet: worksheetInstance, column: Number, direction: Number, newOrderValues: []) => void;
293
- /** When the spreadsheed gets the focus. */
294
- onfocus?: (worksheet: worksheetInstance) => void;
295
- /** When the spreadsheet loses the focus. */
296
- onblur?: (worksheet: worksheetInstance) => void;
297
- /** When merge cells is executed. */
298
- onmerge?: (worksheet: worksheetInstance, cellName: String, colspan: Number, rowspan: Number) => void;
299
- /** When the header title is changed. */
300
- onchangeheader?: (worksheet: worksheetInstance, column: Number, newValue: String, oldValue: String) => void;
301
- /** When the footers are created or updated. */
302
- onchangefooter?: (worksheet: worksheetInstance, column: Number, newValue: String, oldValue: String) => void;
303
- /** When the value in a cell footer is changed. */
304
- onchangefootervalue?: (worksheet: worksheetInstance, x: Number, y: Number, value: String) => void;
305
- /** When an editor is created. */
306
- oncreateeditor?: (worksheet: worksheetInstance, cell: HTMLElement, x: Number, y: Number, element: HTMLElement, options: Object) => void;
307
- /** When the editor is opened. **/
308
- oneditionstart?: (worksheet: worksheetInstance, cell: HTMLElement, x: Number, y: Number) => void;
309
- /** When the editor is closed. **/
310
- oneditionend?: (worksheet: worksheetInstance, cell: HTMLElement, x: Number, y: Number, newValue: [], save: Boolean) => void;
311
- /** When the style of a cell is changed. */
312
- onchangestyle?: (worksheet: worksheetInstance, mixed: [], key: String, value: String) => void;
313
- /** When a cell meta information is added or updated. */
314
- onchangemeta?: (worksheet: worksheetInstance, mixed: [], key: String, value: String) => void;
315
- /** Before the page is changed. Can cancel the action when return is false. */
316
- onbeforechangepage?: (worksheet: worksheetInstance, pageNumber: Number, oldPage: Number, quantityPerPage: Number) => Boolean | undefined;
317
- /** When pagination is enabled and the user changes the page. */
318
- onchangepage?: (worksheet: worksheetInstance, pageNumber: Number, oldPageNumber: Number) => void;
319
- /** Add or change the options of a new worksheet. */
320
- onbeforecreateworksheet?: (worksheet: Worksheet, index: Number) => Object;
321
- /** When the user creates a new worksheet. */
322
- oncreateworksheet?: (worksheet: worksheetInstance, options: Worksheet, index: Number) => void;
323
- /** When the user renames a worksheet. */
324
- onrenameworksheet?: (worksheet: worksheetInstance, worksheetNumber: Number, newValue: String, oldValue: String) => void;
325
- /** >When the user deletes a worksheet. */
326
- ondeleteworksheet?: (worksheet: worksheetInstance, worksheetNumber: Number) => void;
327
- /** When the user updates the worksheet tab position. */
328
- onmoveworksheet?: (worksheet: worksheetInstance, from: Number, to: Number) => void;
329
- /** When the user opens a worksheet. */
330
- onopenworksheet?: (worksheet: worksheetInstance, index: Number) => void;
331
- /** When there is a row id update */
332
- onchangerowid?: (worksheet: worksheetInstance, rows: []) => void;
333
- /** 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. */
334
- onbeforesearch?: (worksheet: worksheetInstance, query: String, results: []) => [];
335
- /** After the search is applied to the rows. */
336
- onsearch?: (worksheet: worksheetInstance, query: String, results: []) => void;
337
- /** Action to be executed before filtering rows. It can cancel the action by returning false. */
338
- onbeforefilter?: (worksheet: worksheetInstance, filters: [], data: []) => void;
339
- /** After the filter has been applied to the rows. */
340
- onfilter?: (worksheet: worksheetInstance, filters: [], data: []) => void;
341
- /** When a new cell is created **/
342
- oncreatecell?: (worksheet: worksheetInstance, cell: HTMLElement, x: Number, y: Number, value: any) => void;
343
- /** Run every single table update action. Can bring performance issues if perform too much changes. */
344
- updateTable?: (worksheet: worksheetInstance, cell: Object, x: Number, y: Number, value: String) => void;
345
- /** Return false to cancel the contextMenu event, or return custom elements for the contextmenu. */
346
- contextmenu?: (worksheet: worksheetInstance, x: Number, y: Number, e: Event, section: String, section_argument1: String | Number, section_argument2: String | Number) => [];
347
- /** The first row is the header titles when parsing a HTML table */
348
- parseTableFirstRowAsHeader?: boolean,
349
- /** Try to identify a column type when parsing a HTML table */
350
- parseTableAutoCellType?: boolean,
351
- /** Global cell wrapping. Default: false */
352
- wordWrap?: boolean;
353
- /** About information */
354
- about?: string | Function,
355
- /** License string */
356
- license?: string,
357
- /** Worksheets */
358
- worksheets?: Array<Worksheet>;
359
- }
378
+ interface Worksheet {
379
+ /** Logo URL **/
380
+ logo?: string
381
+ /** Load the data from an external server URL */
382
+ url?: string;
383
+ /** Persitence URL or true when the URL is the same of the URL of the data source */
384
+ persistence? : string | boolean;
385
+ /** Allow internal sequence for new rows */
386
+ sequence? : boolean;
387
+ /** Load the data into a new spreadsheet from an array of rows or objects */
388
+ data? : Array<any> ;
389
+ /** Deprected. Please use the data property. */
390
+ json? : Array<Record<string, any>>;
391
+ /** Array with the rows properties definitions such as title, height. */
392
+ rows? : Row[];
393
+ /** The column properties define the behavior of a column and the associated editor */
394
+ columns? : Array<Column>;
395
+ /** Define the properties of a cell. This property overwrite the column definitions */
396
+ cells?: Record<string, Column>;
397
+ /** Role of this worksheet **/
398
+ role?: string,
399
+ /** Nested headers definition */
400
+ nestedHeaders?: Array<Nested>;
401
+ /** Default column width. Default: 50px */
402
+ defaultColWidth?: number | string;
403
+ /** Default row height. Default: null */
404
+ defaultRowHeight?: number | string;
405
+ /** Default alignment for a new column: [center, left, right] */
406
+ defaultColAlign?: 'center' | 'left' | 'right' | 'justify';
407
+ /** Minimum number of spare rows. Default: 0 */
408
+ minSpareRows?: number;
409
+ /** Minimum number of spare cols. Default: 0 */
410
+ minSpareCols?: number;
411
+ /** Minimum table dimensions: [numberOfColumns, numberOfRows] */
412
+ minDimensions?: [number, number];
413
+ /** CSV data source URL */
414
+ csv?: string;
415
+ /** CSV default filename for the jspreadsheet exports. Default: 'jspreadsheet' */
416
+ csvFileName?: string;
417
+ /** Consider first line as header. Default: true */
418
+ csvHeaders?: boolean;
419
+ /** Delimiter to consider when dealing with the CSV data. Default: ',' */
420
+ csvDelimiter?: boolean;
421
+ /** Allow column sorting */
422
+ columnSorting?: boolean;
423
+ /** Allow column dragging */
424
+ columnDrag?: boolean;
425
+ /** Allow column resizing */
426
+ columnResize?: boolean;
427
+ /** Allow row resizing */
428
+ rowResize?: boolean;
429
+ /** Allow row dragging */
430
+ rowDrag?: boolean;
431
+ /** Allow table edition */
432
+ editable?: boolean;
433
+ /** Allow new rows */
434
+ allowInsertRow?: boolean;
435
+ /** Allow new rows to be added using tab key. Default: true */
436
+ allowManualInsertRow?: boolean;
437
+ /** Allow new columns to be added using enter key. Default: true */
438
+ allowInsertColumn?: boolean;
439
+ /** Allow new rows to be added via script. Default: true */
440
+ allowManualInsertColumn?: boolean;
441
+ /** Allow rows to be deleted. Default: true */
442
+ allowDeleteRow?: boolean;
443
+ /** Allow all rows to be deleted. Warning: no rows left can lead to undesirabled behavior. Default: false */
444
+ allowDeletingAllRows?: boolean;
445
+ /** Allow columns to be deleted. Default: true */
446
+ allowDeleteColumn?: boolean;
447
+ /** Allow rename column. Default: true */
448
+ allowRenameColumn?: boolean;
449
+ /** Allow users to add comments to the cells. Default: false */
450
+ allowComments?: boolean;
451
+ /** Corner selection and corner data cloning. Default: true */
452
+ selectionCopy?: boolean;
453
+ /** Merged cells. Default: null */
454
+ mergeCells?: Record<string, []>;
455
+ /** Allow search on the spreadsheet */
456
+ search?: boolean;
457
+ /** Activate pagination and defines the number of records per page. Default: false */
458
+ pagination?: number;
459
+ /** Dropdown for the user to change the number of records per page. Example: [10,25,50,100]. Default: false */
460
+ paginationOptions?: boolean | Array<number>;
360
461
 
361
- interface Worksheet {
362
- /** Logo URL **/
363
- logo?: string
364
- /** Load the data from an external server URL */
365
- url?: string;
366
- /** Persitence URL or true when the URL is the same of the URL of the data source */
367
- persistence? : string | boolean;
368
- /** Allow internal sequence for new rows */
369
- sequence? : boolean;
370
- /** Load the data into a new spreadsheet from an array of rows or objects */
371
- data? : Array<any> ;
372
- /** Deprected. Please use the data property. */
373
- json? : Array<Record<string, any>>;
374
- /** Array with the rows properties definitions such as title, height. */
375
- rows? : Row[];
376
- /** The column properties define the behavior of a column and the associated editor */
377
- columns? : Array<Column>;
378
- /** Define the properties of a cell. This property overwrite the column definitions */
379
- cells?: Record<string, Column>;
380
- /** Role of this worksheet **/
381
- role?: string,
382
- /** Nested headers definition */
383
- nestedHeaders?: Array<Nested>;
384
- /** Default column width. Default: 50px */
385
- defaultColWidth?: number | string;
386
- /** Default row height. Default: null */
387
- defaultRowHeight?: number | string;
388
- /** Default alignment for a new column: [center, left, right] */
389
- defaultColAlign?: 'center' | 'left' | 'right' | 'justify';
390
- /** Minimum number of spare rows. Default: 0 */
391
- minSpareRows?: number;
392
- /** Minimum number of spare cols. Default: 0 */
393
- minSpareCols?: number;
394
- /** Minimum table dimensions: [numberOfColumns, numberOfRows] */
395
- minDimensions?: [number, number];
396
- /** CSV data source URL */
397
- csv?: string;
398
- /** CSV default filename for the jspreadsheet exports. Default: 'jspreadsheet' */
399
- csvFileName?: string;
400
- /** Consider first line as header. Default: true */
401
- csvHeaders?: boolean;
402
- /** Delimiter to consider when dealing with the CSV data. Default: ',' */
403
- csvDelimiter?: boolean;
404
- /** Allow column sorting */
405
- columnSorting?: boolean;
406
- /** Allow column dragging */
407
- columnDrag?: boolean;
408
- /** Allow column resizing */
409
- columnResize?: boolean;
410
- /** Allow row resizing */
411
- rowResize?: boolean;
412
- /** Allow row dragging */
413
- rowDrag?: boolean;
414
- /** Allow table edition */
415
- editable?: boolean;
416
- /** Allow new rows */
417
- allowInsertRow?: boolean;
418
- /** Allow new rows to be added using tab key. Default: true */
419
- allowManualInsertRow?: boolean;
420
- /** Allow new columns to be added using enter key. Default: true */
421
- allowInsertColumn?: boolean;
422
- /** Allow new rows to be added via script. Default: true */
423
- allowManualInsertColumn?: boolean;
424
- /** Allow rows to be deleted. Default: true */
425
- allowDeleteRow?: boolean;
426
- /** Allow all rows to be deleted. Warning: no rows left can lead to undesirabled behavior. Default: false */
427
- allowDeletingAllRows?: boolean;
428
- /** Allow columns to be deleted. Default: true */
429
- allowDeleteColumn?: boolean;
430
- /** Allow rename column. Default: true */
431
- allowRenameColumn?: boolean;
432
- /** Allow users to add comments to the cells. Default: false */
433
- allowComments?: boolean;
434
- /** Corner selection and corner data cloning. Default: true */
435
- selectionCopy?: boolean,
436
- /** Merged cells. Default: null */
437
- mergeCells?: Record<string, []>,
438
- /** Allow search on the spreadsheet */
439
- search?: boolean;
440
- /** Activate pagination and defines the number of records per page. Default: false */
441
- pagination?: number;
442
- /** Dropdown for the user to change the number of records per page. Example: [10,25,50,100]. Default: false */
443
- paginationOptions?: boolean | Array<number> ;
444
- /** Table overflow. Default: false */
445
- tableOverflow?: boolean;
446
- /** Allow the user to resize the table when tableOverflow is active. Default: false */
447
- tableOverflowResizable?: boolean;
448
- /** Define the table overflow height. Example: '300px' */
449
- tableHeight?: number | string;
450
- /** Define the table overflow width. Example: '800px' */
451
- tableWidth?: number | string;
452
- /** Initial comments. Default: null */
453
- comments?: Record<string, string>;
454
- /** Initial meta information. Default: null */
455
- meta?: Record<string, any>;
456
- /** Style */
457
- style?: Record<string, string>;
458
- /** Freeze columns. Default: 0 */
459
- freezeColumns?: number;
460
- /** Initial sorting [colNumber, direction]. Default: null */
461
- orderBy?: [number, boolean];
462
- /** Worksheet Unique Id. **/
463
- worksheetId?: string;
464
- /** Worksheet Name. **/
465
- worksheetName?: string;
466
- /** Worksheet state: hidden | null. Hide a worksheet **/
467
- worksheetState?: 'hidden' | undefined;
468
- /** Enable the column filters */
469
- filters?: boolean;
470
- /** Footers */
471
- footers?: Array<any>;
472
- /** Apply mask on footers */
473
- applyMaskOnFooters?: boolean;
474
- /** Define options for the plugins. Each key should be the pluginName. */
475
- pluginOptions?: Record<string, any>;
476
- /** This is a internal controller for the spreadsheet locked properties. Please use editable to make it readonly. */
477
- locked?: boolean;
478
- /** Allow the selection of unlocked cells. Default: true. */
479
- selectUnLockedCells?: boolean;
480
- /** Allow the selection of locked cells. Default: true. */
481
- selectLockedCells?: boolean;
482
- }
462
+ /** Text Overflow. Default: false */
463
+ textOverflow?: boolean;
464
+ /** Table overflow. Default: false */
465
+ tableOverflow?: boolean;
466
+ /** Define the table overflow height. Example: '300px' */
467
+ tableHeight?: number | string;
468
+ /** Define the table overflow width. Example: '800px' */
469
+ tableWidth?: number | string;
470
+ /** Initial comments. Default: null */
471
+ comments?: Record<string, string>;
472
+ /** Initial meta information. Default: null */
473
+ meta?: Record<string, any>;
474
+ /** Style */
475
+ style?: Record<string, string>;
476
+ /** Freeze columns. Default: 0 */
477
+ freezeColumns?: number;
478
+ /** Initial sorting [colNumber, direction]. Default: null */
479
+ orderBy?: [number, boolean];
480
+ /** Worksheet Unique Id. **/
481
+ worksheetId?: string;
482
+ /** Worksheet Name. **/
483
+ worksheetName?: string;
484
+ /** Worksheet state: hidden | null. Hide a worksheet **/
485
+ worksheetState?: 'hidden' | undefined;
486
+ /** Enable the column filters */
487
+ filters?: boolean;
488
+ /** Footers */
489
+ footers?: Array<any>;
490
+ /** Apply mask on footers */
491
+ applyMaskOnFooters?: boolean;
492
+ /** Define options for the plugins. Each key should be the pluginName. */
493
+ pluginOptions?: Record<string, any>;
494
+ /** This is a internal controller for the spreadsheet locked properties. Please use editable to make it readonly. */
495
+ locked?: boolean;
496
+ /** Allow the selection of unlocked cells. Default: true. */
497
+ selectUnLockedCells?: boolean;
498
+ /** Allow the selection of locked cells. Default: true. */
499
+ selectLockedCells?: boolean;
500
+ }
483
501
 
484
- interface spreadsheetInstance {
485
- /** Spreadsheet configuration */
486
- config?: Spreadsheet;
487
- /** Contextmenu HTMLElement */
488
- contextmenu?: HTMLElement;
489
- /** Create a new worksheet from the given settings */
490
- createWorksheet?: (options: Worksheet) => void;
491
- /** Delete an existing worksheet by its position */
492
- deleteWorksheet?: (position: Number) => void;
493
- /** DOM Element */
494
- el?: HTMLElement;
495
- /** DOM Element. Alias for el */
496
- element?: HTMLElement;
497
- /** DOM Element container for the filters */
498
- filters?: HTMLElement;
499
- /** Toggle the fullscreen mode */
500
- fullscreen?: (state: Boolean) => void;
501
- /** Get the toolbar object definitions */
502
- getToolbar?: Toolbar,
503
- /** Set the toolbar */
504
- setToolbar?: (toolbar: Toolbar) => void;
505
- /** Show the toolbar for the worksheet */
506
- showToolbar?: () => void;
507
- /** Hide the toolbar for the worksheet */
508
- hideToolbar?: () => void;
509
- /** Get the worksheet by its id */
510
- getWorksheet?: (id: String) => Number;
511
- /** Get the active worksheet when applicable */
512
- getWorksheetActive?: () => worksheetInstance;
513
- /** Get the worksheet instance by its position */
514
- getWorksheetInstance?: (position: Number) => worksheetInstance;
515
- /** HTMLElement Helper */
516
- helper?: HTMLElement,
517
- /** Array with the history information */
518
- history?: [];
519
- /** Internal history index position */
520
- historyIndex?: Boolean;
521
- /** Ignore events */
522
- ignoreEvents?: Boolean;
523
- /** Ignore history events */
524
- ignoreHistory?: Boolean;
525
- /** Ignore persistence events */
526
- ignorePersistence?: Boolean;
527
- /** HTMLElement editor container **/
528
- input?: HTMLElement;
529
- /** HTMLElement loading element **/
530
- loading?: HTMLElement;
531
- /** Rename an existing worksheet by its position */
532
- renameWorksheet?: (position: Number, title: String) => void;
533
- /** Move the position of a worksheet tab */
534
- moveWorksheet?: (from: Number, to: Number, updateDom: Boolean) => void;
535
- /** Open a worksheet */
536
- openWorksheet?: (position: Number) => void;
537
- /** Get the worksheet name */
538
- getWorksheetName?: () => String;
539
- /** Spreadsheet unique name */
540
- name?: string;
541
- /** List of plugins loaded to the spreadsheet */
542
- plugins?: Record<number, Plugin>;
543
- /** Processing flag. It would be true when the spreadsheet is loading. */
544
- processing?: boolean;
545
- /** Show progressbar */
546
- progress?: (state: boolean) => void;
547
- /** Queue of formulas used during the loading */
548
- queue?: Array<string>;
549
- /** Undo */
550
- undo?: () => void;
551
- /** Redo */
552
- redo?: () => void;
553
- /** DOM Textarea helper */
554
- textarea?: HTMLElement;
555
- /** DOM toolbar */
556
- toolbar?: HTMLElement;
557
- /** Tools HTMLElement container */
558
- tools?: HTMLElement;
559
- /** Worksheets container */
560
- worksheets?: Array<Worksheet>;
561
- }
502
+ interface spreadsheetInstance {
503
+ /** Spreadsheet configuration */
504
+ config: Spreadsheet;
505
+ /** Contextmenu HTMLElement */
506
+ contextmenu: HTMLElement;
507
+ /** Create a new worksheet from the given settings */
508
+ createWorksheet: (options: Worksheet) => void;
509
+ /** Delete an existing worksheet by its position */
510
+ deleteWorksheet: (position: Number) => void;
511
+ /** DOM Element */
512
+ el: HTMLElement;
513
+ /** DOM Element. Alias for el */
514
+ element: HTMLElement;
515
+ /** DOM Element container for the filters */
516
+ filters: HTMLElement;
517
+ /** Toggle the fullscreen mode */
518
+ fullscreen: (state: Boolean) => void;
519
+ /** Get the toolbar object definitions */
520
+ getToolbar: Toolbar,
521
+ /** Set the toolbar */
522
+ setToolbar: (toolbar: Toolbar) => void;
523
+ /** Show the toolbar for the worksheet */
524
+ showToolbar: () => void;
525
+ /** Hide the toolbar for the worksheet */
526
+ hideToolbar: () => void;
527
+ /** Get the worksheet by its id */
528
+ getWorksheet: (id: String) => Number;
529
+ /** Get the active worksheet when applicable */
530
+ getWorksheetActive: () => worksheetInstance;
531
+ /** Get the worksheet instance by its position */
532
+ getWorksheetInstance: (position: Number) => worksheetInstance;
533
+ /** HTMLElement Helper */
534
+ helper: HTMLElement,
535
+ /** Array with the history information */
536
+ history: [];
537
+ /** Internal history index position */
538
+ historyIndex: Boolean;
539
+ /** Ignore events */
540
+ ignoreEvents: Boolean;
541
+ /** Ignore history events */
542
+ ignoreHistory: Boolean;
543
+ /** Ignore persistence events */
544
+ ignorePersistence: Boolean;
545
+ /** HTMLElement editor container **/
546
+ input: HTMLElement;
547
+ /** HTMLElement loading element **/
548
+ loading: HTMLElement;
549
+ /** Rename an existing worksheet by its position */
550
+ renameWorksheet: (position: Number, title: String) => void;
551
+ /** Move the position of a worksheet tab */
552
+ moveWorksheet: (from: Number, to: Number, updateDom: Boolean) => void;
553
+ /** Open a worksheet */
554
+ openWorksheet: (position: Number) => void;
555
+ /** Get the worksheet name */
556
+ getWorksheetName: () => String;
557
+ /** Spreadsheet unique name */
558
+ name: string;
559
+ /** List of plugins loaded to the spreadsheet */
560
+ plugins: Record<number, Plugin>;
561
+ /** Processing flag. It would be true when the spreadsheet is loading. */
562
+ processing: boolean;
563
+ /** Show progressbar */
564
+ progress: (state: boolean) => void;
565
+ /** Queue of formulas used during the loading */
566
+ queue: Array<string>;
567
+ /** Undo */
568
+ undo: () => void;
569
+ /** Redo */
570
+ redo: () => void;
571
+ /** DOM Textarea helper */
572
+ textarea: HTMLElement;
573
+ /** DOM toolbar */
574
+ toolbar: HTMLElement;
575
+ /** Tools HTMLElement container */
576
+ tools: HTMLElement;
577
+ /** Worksheets container */
578
+ worksheets: Array<Worksheet>;
579
+ }
562
580
 
563
- interface worksheetInstance {
564
- /** Spreadsheet object */
565
- parent?: spreadsheetInstance;
566
- /** Array with the borders information */
567
- borders?: [];
568
- /** Start the edition for one cell */
569
- openEditor?: (cell: HTMLElement, empty: Boolean, mouseEvent: Object) => void;
570
- /** Close the editon for one cell */
571
- closeEditor?: (cell: HTMLElement, save: Boolean) => void;
572
- /** Array with the column width controllers */
573
- colgroup?: [];
574
- /** Hold the colgroup container */
575
- colgroupContainer?: HTMLElement;
576
- /** Cut */
577
- cut?: () => void;
578
- /** Copy */
579
- copy?: () => void;
580
- /** Paste */
581
- paste?: (x: Number, y: Number, data: String) => void;
582
- /** DOM Corner square */
583
- corner?: HTMLElement;
584
- /**
585
- * Get the worksheet data
586
- *
587
- * @param {boolean} only the selected cells
588
- * @param {boolean} get the raw or processed data
589
- * @param {string} Null the return will be an array. With this argument, the return will be a string separated by the character defined.
590
- * @return {array} array of data
591
- */
592
- data?: (highlighted: boolean, processedData: boolean, delimiter: string) => Array<Array<any>> | string
593
- /** Internal type to defined JSON or ARRAY */
594
- dataType?: number,
595
- /** Change a row position */
596
- moveRow?: (from: Number, to: Number) => void;
597
- /** Add a new row */
598
- insertRow?: (numOfRows: Number, rowNumber: Number, insertBefore: Boolean, data: []) => void;
599
- /** Delete an existing row */
600
- deleteRow?: (rowNumber: Number, numOfRows: Number) => void;
601
- /** Change a column position */
602
- moveColumn?: (from: Number, to: Number) => void;
603
- /** Add a new column */
604
- insertColumn?: (numOfColumns: Number, columnNumber: Number, insertBefore: Boolean, properties: Column, data: []) => void;
605
- /** Delete an existing column */
606
- deleteColumn?: (columnNumber: Number, numOfColumns: Number) => void;
607
- /** Get the merged cells. Cellname: A1, A2, etc */
608
- getMerge?: (cellName: String) => void;
609
- /** Get the merged cells. Cellname: A1, A2, etc */
610
- setMerge?: (cellName: String, colspan: Number, rowspan: Number, forceOverwrite: Boolean) => void;
611
- /** Remove the merged cells by the cellname */
612
- removeMerge?: (cellName: String) => void;
613
- /** Destroy all merged cells */
614
- destroyMerged?: () => void;
615
- /** Verify if one col + row is merged and return or not the merge cell */
616
- isMerged?: (x: Number, y: Number, getParent: Boolean) => Boolean | [];
617
- /** Verify if the col has any merged cells */
618
- isColMerged?: (x: Number) => Boolean;
619
- /** Verify if the col has any merged cells */
620
- isRowMerged?: (y: Number) => Boolean;
621
- /** Internal method: event dispatch controllers */
622
- dispatch?: (event: String) => void;
623
- /** Navigation up */
624
- up?: () => void;
625
- /** Navigation down */
626
- down?: () => void;
627
- /** Navigation left */
628
- left?: () => void;
629
- /** Navigation right */
630
- right?: () => void;
631
- /** Navigation last */
632
- last?: () => void;
633
- /** Navigation first */
634
- first?: () => void;
635
- /** Download CSV */
636
- download?: (includeHeaders: Boolean, processed: Boolean) => void;
637
- /** DOM Worksheet */
638
- worksheet?: HTMLElement;
639
- /** DOM Worksheet. Alias for worksheet */
640
- element?: HTMLElement;
641
- /** Internal method: Execute a formula */
642
- executeFormula?: (expression: String, x: Number, y: Number, caching: Boolean) => void;
643
- /** Footers */
644
- footers?: Record<string, string>;
645
- /** Formula chain */
646
- formula?: [];
647
- /** Toggle the fullscreen mode */
648
- fullscreen?: (state: Boolean) => void;
649
- /** Get the border */
650
- getBorder?: (alias: string) => object;
651
- /** Set borders with a border name and color. */
652
- setBorder?: (x1: Number, y1: Number, x2: Number, y2: Number, border: String, color: String) => void;
653
- /** Reset the borders by name border name */
654
- resetBorders?: (border: String, resetPosition: Boolean) => void;
655
- /** Refresh the borders by the border name */
656
- refreshBorders?: (border: String) => void;
657
- /** Reset the main selection */
658
- resetSelection?: () => void;
659
- /** Get the cell element from the cellname */
660
- getCell?: (cellName: String) => Object;
661
- /** Get the cell element from its coordinates */
662
- getCellFromCoords?: (x: Number, y: Number) => [];
663
- /** Get attributes from one cell when applicable */
664
- getCells?: (cellName: String) => Column;
665
- /** Set attributes for one cell */
666
- setCells?: (cellName: String, settings: Column) => void;
667
- /**
668
- * Get the worksheet data
669
- *
670
- * @param {boolean} only the selected cells
671
- * @param {boolean} get the raw or processed data
672
- * @return {array} array of data
673
- */
674
- getData?: (highlighted: Boolean, processed: Boolean) => [];
675
- /** Reset the table data */
676
- setData?: (data: []) => void;
677
- /** Get the column position by its name */
678
- getColumnIdByName?: (name: String) => Number;
679
- /** Get the settings for one column. Row its optional when need to get the information from one specific cell. */
680
- getColumnOptions?: (x: Number, y: Number) => void;
681
- /** Get the column object by its position */
682
- getColumn?: (position: Number) => Object;
683
- /** Set the column properties by its position */
684
- setColumn?: (position: Number, settings: Object) => void;
685
- /** Get the column data from its number */
686
- getColumnData?: (col: Number, processed: Boolean) => [];
687
- /** Set the column data from its number */
688
- setColumnData?: (col: Number, data: [], force: boolean) => void;
689
- /** Get the data from one row */
690
- getRowData?: (row: Number) => [];
691
- /** Set the data from one row */
692
- setRowData?: (row: Number, data: [], force: boolean) => void;
693
- /** Get the row id from its position */
694
- getRowId?: (row: Number) => Number;
695
- /** Set the row id from its position */
696
- setRowId?: (row: Number, newId: Number) => void;
697
- /** Get the primaryKey column when applicable. */
698
- getPrimaryKey?: () => Number;
699
- /** Get the next available number in the sequence */
700
- getNextSequence?: () => Number;
701
- /** Get a row data or meta information by Id. */
702
- getRowById?: (row: Number, element: boolean) => Object;
703
- /** Get the defined name or defined names when key is null */
704
- getDefinedNames?: (key?: string) => object;
705
- /** Set the defined name */
706
- setDefinedNames?: (key: string, value: string) => void;
707
- /** Internal method: Get the editor for one cell */
708
- getEditor?: (x: Number, y: Number) => Object;
709
- /** Internal method: Get the filter */
710
- getFilter?: (column: number) => Array<any>;
711
- /** Get the footers configuration */
712
- getFooter?: () => Array<any>;
713
- /** Get the footer value */
714
- getFooterValue?: (col: number, row: number) => any;
715
- /** Set the footer value */
716
- setFooterValue?: (col: number, row: number, value: any) => void;
717
- /** Get processed data by the coordinates of the cell */
718
- getProcessed?: (col: number, row: number, extended: boolean) => void;
719
- /** Hide the search container */
720
- showSearch?: () => void;
721
- /** Hide the search container */
722
- hideSearch?: () => void;
723
- /** DOM Contextmenu */
724
- contextMenu?: HTMLElement;
725
- /** DOM Worksheet container */
726
- content?: HTMLElement;
727
- /** DOM Worksheet table */
728
- table?: HTMLElement;
729
- /** DOM Worksheet table thead */
730
- thead?: HTMLElement;
731
- /** DOM Worksheet table body */
732
- tbody?: HTMLElement;
733
- /** DOM array of rows */
734
- rows?: Array<HTMLElement>;
735
- /** DOM array of results */
736
- results?: Array<Number>;
737
- /** Pagination DOM containr */
738
- pagination?: Object;
739
- /** Current page number */
740
- pageNumber?: Number;
741
- /** Hold the header container */
742
- headerContainer?: HTMLElement;
743
- /** Array with the header DOM elements */
744
- headers?: Array<HTMLElement>;
745
- /** Array with the cell DOM elements */
746
- records?: Array<HTMLElement>;
747
- /** Selected cells */
748
- selectedCell?: [];
749
- /** Internal selected cell */
750
- cursor?: Object;
751
- /** Edition controllers */
752
- edition?: [];
753
- /** Internal record id sequence */
754
- sequence?: Number;
755
- /** Get the worksheet settings */
756
- getConfig?: () => Boolean;
757
- /** Change the worksheet settings */
758
- setConfig?: (config: Worksheet) => void;
759
- /** Load the initial worksheet settings */
760
- loadConfig?: (config: Worksheet) => void;
761
- /** Persistence helper method. The callback is executed with a JSON from the server */
762
- save?: (url: String, data: Object, token: String, callback: (result: Object) => void) => void;
763
- /** Refresh the whole data or from a single row */
764
- refresh?: (y: Number | undefined) => void;
765
- /** Get the editor type for one column or cell */
766
- getType?: (x: Number, y: Number) => void;
767
- /** Set the editor type for one column or cell */
768
- setType?: (x: Number, y: Number) => void;
769
- /** Get the properties for one column or cell */
770
- getProperties?: (x: Number, y: Number) => void;
771
- /** Set the properties for one column */
772
- setProperties?: (column: Number, settings: Object) => void;
773
- /** Update nested header */
774
- updateNestedHeader?: (x: Number, y: Number, settings: Object) => void;
775
- /** Get the nested header columns */
776
- getNestedColumns?: (x: Number, y: Number) => [];
777
- /** Set plugins for the spreadsheet */
778
- setPlugins?: (plugins: []) => void;
779
- /** Get the processed data cell shown to the user by the cell name */
780
- getLabel?: (cellName: String) => Object;
781
- /** Get the processed data cell shown to the user by its coordinates */
782
- getLabelFromCoords?: (x: Number, y: Number) => [];
783
- /** Get value by the cellname or object. The value can be the raw or processed value. */
784
- getValue?: (cell: String, processed: Boolean) => String;
785
- /** Get value by the coordinates. The value can be the raw or processed value. */
786
- getValueFromCoords?: (x: Number, y: Number, processed: Boolean) => void;
787
- /**
788
- * Set a cell value
789
- *
790
- * @param {mixed} cell destination cell
791
- * @param {string} value value
792
- * @param {string} force value over readonly cells
793
- * @return void
794
- */
795
- setValue?: (cell: String, value: String, forceOverwrite: Boolean) => void;
796
- /**
797
- * Set a cell value
798
- *
799
- * @param {number} x
800
- * @param {number} y
801
- * @param {string} value value
802
- * @param {string} force value over readonly cells
803
- * @return void
804
- */
805
- setValueFromCoords?: (x: Number, y: Number, value: String, force: Boolean) => void;
806
- /** Get the width of one column by its position */
807
- getWidth?: (col: Number) => void;
808
- /** Set the width of one column by its position */
809
- setWidth?: (col: Number, width: Number) => void;
810
- /** Get the height of one row by its position */
811
- getHeight?: (row: Number) => void;
812
- /** Set the height of one row by its position */
813
- setHeight?: (row: Number, width: Number) => void;
814
- /** Set the footers */
815
- setFooter?: (data: []) => void;
816
- /** Destroy the footers */
817
- resetFooter?: () => void;
818
- /** Get the header title */
819
- getHeader?: (columnNumber: Number) => String;
820
- /** Set the header title */
821
- setHeader?: (columnNumber: Number, title: String) => void;
822
- /** Get all header elements */
823
- getHeaders?: () => [];
824
- /** Get one or all meta information for one cell. */
825
- getMeta?: (cellName: String, property: String) => Object;
826
- /** Get one or various meta information for one cell. */
827
- setMeta?: (cellName: String, property: String, value: String) => void;
828
- /** Get the style from one cell. Ex. getStyle('A1') */
829
- getStyle?: (cell: String) => Object;
830
- /** Get the style from one cell. Ex. resetStyle('A1') */
831
- resetStyle?: (cell: String) => void;
832
- /** Set the style for one cell. Ex. setStyle('A1', 'background-color', 'red') */
833
- setStyle?: (cellName: String, property: String, value: String, forceOverwrite: Boolean) => void;
834
- /** Get the comments from one cell */
835
- getComments?: (cellName: String) => String;
836
- /** Set the comments for one cell */
837
- setComments?: (cellName: String, comments: String) => void;
838
- /** Sort one column by its position. ASC (0) or DESC (1) */
839
- orderBy?: (column: Number, direction: Boolean) => void;
840
- /** Update the selection based on two DOM cell selements */
841
- updateSelection?: (el1: Number, el2: Number, origin: Boolean) => void;
842
- /** Update the selection based on coordinates */
843
- updateSelectionFromCoords?: (x1: Number, y1: Number, x2: Number, y2: Number, origin: Boolean) => void;
844
- /** Get all selected cells */
845
- getSelected?: (columnNameOnly: Boolean) => [];
846
- /** Get the selected rows */
847
- getSelectedRows?: () => [];
848
- /** Get the selected columns */
849
- getSelectedColumns?: () => [];
850
- /** Get the highlighted coordinates **/
851
- getHighlighted?: () => [];
852
- /** The worksheet is editable */
853
- isEditable?: () => Boolean;
854
- /** Check if cell is attached to the DOM */
855
- isAttached?: (x: number, y: number) => Boolean;
856
- /** Check if cell is readonly or not */
857
- isReadOnly?: (cell: Object) => Boolean;
858
- /** Cell is selected */
859
- isSelected?: (x: Number, y: Number) => Boolean;
860
- /** Set or reset the cell as readonly */
861
- setReadOnly?: (cell: Object, state: Boolean) => void;
862
- /** Show row */
863
- showRow?: (row: Number) => void;
864
- /** Hide row */
865
- hideRow?: (row: Number) => void;
866
- /** Show column */
867
- showColumn?: (column: Number) => void;
868
- /** Hide column */
869
- hideColumn?: (column: Number) => void;
870
- /** Show index column */
871
- showIndex?: () => void;
872
- /** Hide index column */
873
- hideIndex?: () => void;
874
- /** Change page when using pagination */
875
- page?: (pageNumber: Number) => void;
876
- /** Go to the row number **/
877
- goto?: (rowNumber: Number) => void;
878
- /** Search for something */
879
- search?: (str: String) => void;
880
- /** Search HTML input */
881
- searchInput?: HTMLElement;
882
- /** Search HTML container */
883
- searchContainer?: HTMLElement;
884
- /** Reset the search */
885
- resetSearch?: () => void;
886
- /** Open the filters */
887
- openFilter?: (column: Number) => void;
888
- /** Close the filters */
889
- resetFilters?: () => void;
890
- /** Close the filters */
891
- closeFilters?: () => void;
892
- /** Worksheet configuration */
893
- options?: Worksheet;
894
- /** Internal method: update cells in a batch */
895
- updateCells?: (o: Object) => void;
896
- /**
897
- * Internal method: Internal method: Set a cell value
898
- *
899
- * @param {number} x
900
- * @param {number} y
901
- * @param {string} value value
902
- * @param {string} force value over readonly cells
903
- * @return void
904
- */
905
- updateCell?: (x: Number, y: Number, value: String, force: Boolean) => void;
906
- /** Set viewport width and height */
907
- setViewport?: (width: Number, height: Number) => void;
908
- }
581
+ interface worksheetInstance {
582
+ /** Array with the borders information */
583
+ borders: [];
584
+ /** Close the editon for one cell */
585
+ closeEditor: (cell: HTMLElement, save: boolean) => void;
586
+ /** Close the filters */
587
+ closeFilters: (update: boolean) => void;
588
+ /** Array with the column width controllers */
589
+ colgroup: [];
590
+ /** Hold the colgroup container */
591
+ colgroupContainer: HTMLElement;
592
+ /** DOM Worksheet container */
593
+ content: HTMLElement;
594
+ /** Copy */
595
+ copy: (cut?: boolean) => void;
596
+ /** DOM Corner square */
597
+ corner: HTMLElement;
598
+ /** Create a new worksheet */
599
+ createWorksheet: (worksheetOptions: Worksheet) => void;
600
+ /** Internal selected cell */
601
+ cursor: object;
602
+ /** Cut */
603
+ cut: () => void;
604
+ /**
605
+ * Get the worksheet data
606
+ *
607
+ * @param {boolean} only the selected cells
608
+ * @param {boolean} get the raw or processed data
609
+ * @param {string} Null the return will be an array. With this argument, the return will be a string separated by the character defined.
610
+ * @return {array} array of data
611
+ */
612
+ data: (highlighted?: boolean, processedData?: boolean, delimiter?: string) => Array<Array<any>> | string
613
+ /** Internal use control type to defined JSON or ARRAY. */
614
+ dataType: boolean,
615
+ /** Delete an existing column */
616
+ deleteColumn: (columnnumber: number, numOfColumns?: number) => void;
617
+ /** Delete an existing row */
618
+ deleteRow: (rownumber: number, numOfRows?: number) => void;
619
+ /** Destroy all merged cells */
620
+ destroyMerged: () => void;
621
+ /** Internal method: event dispatch controllers */
622
+ dispatch: (event?: string) => void;
623
+ /** Navigation down */
624
+ down: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
625
+ /** Download CSV */
626
+ download: (includeHeaders?: boolean, processed?: boolean) => void;
627
+ /** Edition controllers */
628
+ edition: [];
629
+ /** DOM Worksheet. Alias for worksheet */
630
+ element: HTMLElement;
631
+ /** Internal method: Execute a formula */
632
+ executeFormula: (expression: string, x?: number, y?: number, caching?: boolean) => void;
633
+ /** Navigation first */
634
+ first: (shiftKey?: boolean, ctrlKey?: boolean) => void;
635
+ /** Footers */
636
+ footers: Record<string, string>;
637
+ /** Formula chain. Internal use. */
638
+ formula: [];
639
+ /** Toggle the fullscreen mode */
640
+ fullscreen: (state: boolean) => void;
641
+ /** Get the border */
642
+ getBorder: (alias: string) => object;
643
+ /** Get the cell element from the cellname */
644
+ getCell: (cellName: string) => Object;
645
+ /** Get the cell element from its coordinates */
646
+ getCellFromCoords: (x: number, y: number) => [];
647
+ /** Get attributes from one cell when applicable */
648
+ getCells: (cellName: string) => Column;
649
+ /** Get the column object by its position */
650
+ getColumn: (position: number) => Object;
651
+ /** Get the column data from its number */
652
+ getColumnData: (col: number, processed?: boolean) => [];
653
+ /** Get the column position by its name */
654
+ getColumnIdByName: (name: string) => number;
655
+ /** Get the settings for one column. Row its optional when need to get the information from one specific cell. */
656
+ getColumnOptions: (x: number, y: number) => void;
657
+ /** Get the comments from one cell. Example: getComments('A1') */
658
+ getComments: (cellName?: string) => string;
659
+ /** Get the worksheet settings */
660
+ getConfig: () => boolean;
661
+ /**
662
+ * Get the worksheet data
663
+ *
664
+ * @param {boolean} only the selected cells
665
+ * @param {boolean} get the raw or processed data
666
+ * @return {array} array of data
667
+ */
668
+ getData: (highlighted?: boolean, processed?: boolean, delimiter?: string) => [];
669
+ /** Get the defined name or defined names when key is null */
670
+ getDefinedNames: (key?: string) => object;
671
+ /** Internal method: Get the editor for one cell */
672
+ getEditor: (x: number, y: number) => Object;
673
+ /** Internal method: Get the filter */
674
+ getFilter: (column: number) => Array<any>;
675
+ /** Get the footers configuration */
676
+ getFooter: () => Array<any>;
677
+ /** Get the footer value */
678
+ getFooterValue: (x: number, y: number) => any;
679
+ /** Get the header title */
680
+ getHeader: (columnnumber: number) => string;
681
+ /** Get all header elements */
682
+ getHeaders: (asArray: boolean) => [];
683
+ /** Get the height of one row by its position */
684
+ getHeight: (row: number) => void;
685
+ /** Get the highlighted coordinates **/
686
+ getHighlighted: () => [];
687
+ /** Get json */
688
+ getJson: (h?: boolean, processed?: boolean) => [];
689
+ /** Get the processed data cell shown to the user by the cell name */
690
+ getLabel: (cellName: string) => Object;
691
+ /** Get the processed data cell shown to the user by its coordinates */
692
+ getLabelFromCoords: (x: number, y: number) => [];
693
+ /** Get the merged cells. Cellname: A1, A2, etc */
694
+ getMerge: (cellName: string) => void;
695
+ /** Get one or all meta information for one cell. */
696
+ getMeta: (cellName: string, property: string) => Object;
697
+ /** Get the nested cells */
698
+ getNestedCell: (x: number, y: number, properties?: any) => Object;
699
+ /** Get the nested header columns */
700
+ getNestedColumns: (x: number, y: number) => [];
701
+ /** Get the nested headers */
702
+ getNestedHeaders: () => [];
703
+ /** Get the next available number in the sequence */
704
+ getNextSequence: () => number;
705
+ /** Get the column or cell options by coordinates */
706
+ getOptions: (x: number, y: number) => object;
707
+ /** Get the primaryKey column when applicable. */
708
+ getPrimaryKey: () => number;
709
+ /** Get processed data by the coordinates of the cell */
710
+ getProcessed: (x: number, y: number, extended: boolean) => void;
711
+ /** Get the properties for one column or cell */
712
+ getProperties: (x: number, y: number) => void;
713
+ /** Get a row data or meta information by Id. */
714
+ getRowById: (row: number, element: boolean) => Object;
715
+ /** Get the data from one row */
716
+ getRowData: (row: number, processed: boolean) => [];
717
+ /** Get the row id from its position */
718
+ getRowId: (row: number) => number;
719
+ /** Get all selected cells */
720
+ getSelected: (columnNameOnly: boolean) => [];
721
+ /** Get the selected columns */
722
+ getSelectedColumns: () => [];
723
+ /** Get the selected rows */
724
+ getSelectedRows: () => [];
725
+ /** Get the style from one cell. Ex. getStyle('A1') */
726
+ getStyle: (cell: string) => Object;
727
+ /** Get value by the cellname or object. The value can be the raw or processed value. */
728
+ getValue: (cell: string, processed: boolean) => String;
729
+ /** Get value by the coordinates. The value can be the raw or processed value. */
730
+ getValueFromCoords: (x: number, y: number, processed: boolean) => void;
731
+ /** Get the width of one column by its position */
732
+ getWidth: (x: number) => void;
733
+ /** Get the editor type for one column or cell */
734
+ getType: (x: number, y: number) => void;
735
+ /** Go to the row number, [col number] **/
736
+ goto: (y: number, x?: number) => void;
737
+ /** Hold the header container */
738
+ headerContainer: HTMLElement;
739
+ /** Array with the header DOM elements */
740
+ headers: Array<HTMLElement>;
741
+ /** Hide column */
742
+ hideColumn: (column: number) => void;
743
+ /** Hide the filters */
744
+ hideFilter: () => void;
745
+ /** Hide index column */
746
+ hideIndex: () => void;
747
+ /** Hide row */
748
+ hideRow: (row: number) => void;
749
+ /** Hide the search container */
750
+ hideSearch: () => void;
751
+ /** Add a new column */
752
+ insertColumn: (numOfColumns: number, columnnumber: number, insertBefore: boolean, properties: Column, data: []) => void;
753
+ /** Add a new row */
754
+ insertRow: (numOfRows: number, rownumber: number, insertBefore: boolean, data: []) => void;
755
+ /** Check if cell is attached to the DOM */
756
+ isAttached: (x: number, y: number) => boolean;
757
+ /** The worksheet is editable */
758
+ isEditable: () => boolean;
759
+ /** Check if cell is readonly or not */
760
+ isReadOnly: (cell: Object) => boolean;
761
+ /** Cell is selected */
762
+ isSelected: (x: number, y: number) => boolean;
763
+ /** Navigation last */
764
+ last: () => void;
765
+ /** Navigation left */
766
+ left: () => void;
767
+ /** Change a column position */
768
+ moveColumn: (from: number, to: number) => void;
769
+ /** Change a row position */
770
+ moveRow: (from: number, to: number) => void;
771
+ /** Get the column name */
772
+ name: (col: number) => string;
773
+ /** Start the edition for one cell */
774
+ openEditor: (cell: HTMLElement, empty?: boolean, mouseEvent?: Object) => void;
775
+ /** Open the filters */
776
+ openFilter: (column: number) => void;
777
+ /** Worksheet configuration */
778
+ options: Worksheet;
779
+ /** Sort one column by its position. ASC (0) or DESC (1) */
780
+ orderBy: (column: number, direction: boolean) => void;
781
+ /** Change page when using pagination */
782
+ page: (pagenumber: number) => void;
783
+ /** Current page number */
784
+ pagenumber: number;
785
+ /** Pagination DOM containr */
786
+ pagination: Object;
787
+ /** Spreadsheet object */
788
+ parent: spreadsheetInstance;
789
+ /** Paste */
790
+ paste: (x: number, y: number, data: string) => void;
791
+ /** Get the quantity of pages when pagination is active */
792
+ quantityOfPages?: () => number;
793
+ /** Array with the cell DOM elements */
794
+ records: Array<HTMLElement>;
795
+ /** Refresh the whole data or from a single row */
796
+ refresh: (y: number | undefined) => void;
797
+ /** Refresh the borders by the border name */
798
+ refreshBorders: (border?: string) => void;
799
+ /** Refresh footers */
800
+ refreshFooter: () => void;
801
+ /** Remove the merged cells by the cellname */
802
+ removeMerge: (cellName: String) => void;
803
+ /** Reset the borders by name border name */
804
+ resetBorders: (border: String, resetPosition: boolean) => void;
805
+ /** Close the filters */
806
+ resetFilters: () => void;
807
+ /** Destroy the footers */
808
+ resetFooter: () => void;
809
+ /** Destroy freeze columns */
810
+ resetFreezeColumns: () => void;
811
+ /** Reset meta data */
812
+ resetMeta: () => void;
813
+ /** Reset nested headers */
814
+ resetNestedHeaders: () => void;
815
+ /** Reset the search */
816
+ resetSearch: () => void;
817
+ /** Reset the main selection */
818
+ resetSelection: () => void;
819
+ /** Get the style from one cell. Ex. resetStyle('A1') */
820
+ resetStyle: (cell?: String) => void;
821
+ /** DOM array of results */
822
+ results: Array<number>;
823
+ /** Navigation right */
824
+ right: () => void;
825
+ /** DOM array of rows */
826
+ rows: Array<HTMLElement>;
827
+ /** Persistence helper method. The callback is executed with a JSON from the server */
828
+ save: (url: String, data: Object, token?: String, callback?: (result: Object) => void) => void;
829
+ /** ScrollX DOM Element */
830
+ scrollX: HTMLElement;
831
+ /** ScrollY DOM Element */
832
+ scrollY: HTMLElement;
833
+ /** Search for something */
834
+ search: (str: String) => void;
835
+ /** Search HTML container */
836
+ searchContainer: HTMLElement;
837
+ /** Search HTML input */
838
+ searchInput: HTMLElement;
839
+ /** Select All */
840
+ selectAll: () => void;
841
+ /** Selected cells */
842
+ selectedCell: [];
843
+ /** Internal record id sequence */
844
+ sequence: number;
845
+ /** Set borders with a border name and color. */
846
+ setBorder: (x1: number, y1: number, x2: number, y2: number, border?: string, color?: string) => void;
847
+ /** Set attributes for one cell */
848
+ setCells: (cellName: string, settings: Column) => void;
849
+ /** Set the column data from its number */
850
+ setColumnData: (col: number, data: [], force?: boolean) => void;
851
+ /** Set the comments for one cell */
852
+ setComments: (cellName: String, comments: String) => void;
853
+ /** Change the worksheet settings */
854
+ setConfig: (config: Worksheet) => void;
855
+ /** Reset the table data */
856
+ setData: (data: []) => void;
857
+ /** Set the defined name */
858
+ setDefinedNames: (key: string, value: string) => void;
859
+ /** Set filter */
860
+ setFilter: (colnumber: number, keywords: []) => void;
861
+ /** Set the footers */
862
+ setFooter: (data: []) => void;
863
+ /** Set the footer value */
864
+ setFooterValue: (col: number, row: number, value: any) => void;
865
+ /** Freeze x number of columns */
866
+ setFreezeColumns: (num: number) => void;
867
+ /** Set the header title */
868
+ setHeader: (x: number, title: String) => void;
869
+ /** Set the height of one row by its position */
870
+ setHeight: (row: number, width: number) => void;
871
+ /** Get the merged cells. Cellname: A1, A2, etc */
872
+ setMerge: (cellName: String, colspan: number, rowspan: number, forceOverwrite?: boolean) => void;
873
+ /** Get one or various meta information for one cell. */
874
+ setMeta: (cell: string | object, property?: string, value?: string) => void;
875
+ /** Set the nested headers */
876
+ setNestedHeaders: (config: []) => void;
877
+ /** Set plugins for the spreadsheet */
878
+ setPlugins: (plugins: []) => void;
879
+ /** Set the properties for one column */
880
+ setProperties: (column: number, settings: Object) => void;
881
+ /** Set or reset the cell as readonly */
882
+ setReadOnly: (cell: Object, state: boolean) => void;
883
+ /** Set the data from one row */
884
+ setRowData: (row: number, data: [], force: boolean) => void;
885
+ /** Set the row id from its position */
886
+ setRowId: (row: number, newId: number) => void;
887
+ /** Set the style for one cell. Ex. setStyle('A1', 'background-color', 'red') */
888
+ setStyle: (cell: string | object, property?: string, value?: string, forceOverwrite?: boolean) => void;
889
+ /**
890
+ * Set a cell value
891
+ *
892
+ * @param {mixed} cell destination cell
893
+ * @param {string} value value
894
+ * @param {string} force value over readonly cells
895
+ * @return void
896
+ */
897
+ setValue: (cell: string, value?: String, forceOverwrite?: boolean) => void;
898
+ /**
899
+ * Set a cell value
900
+ *
901
+ * @param {number} x
902
+ * @param {number} y
903
+ * @param {string} value value
904
+ * @param {string} force value over readonly cells
905
+ * @return void
906
+ */
907
+ setValueFromCoords: (x: number, y: number, value: string, force?: boolean) => void;
908
+ /** Set viewport width and height */
909
+ setViewport: (width: number, height: number) => void;
910
+ /** Set the width of one column by its position */
911
+ setWidth: (col: number, width: number) => void;
912
+ /** Show column */
913
+ showColumn: (column: number) => void;
914
+ /** Show filter controls */
915
+ showFilter: () => void;
916
+ /** Show index column */
917
+ showIndex: () => void;
918
+ /** Show row */
919
+ showRow: (row: number) => void;
920
+ /** Hide the search container */
921
+ showSearch: () => void;
922
+ /** DOM Worksheet table */
923
+ table: HTMLElement;
924
+ /** DOM Worksheet table thead */
925
+ thead: HTMLElement;
926
+ /** DOM Worksheet table tbody */
927
+ tbody: HTMLElement;
928
+ /** DOM Worksheet table tfoot */
929
+ tfoot: HTMLElement;
930
+ /** Verify if one col + row is merged and return or not the merge cell */
931
+ isMerged: (x: number, y: number, getParent: boolean) => boolean | [];
932
+ /** Verify if the col has any merged cells */
933
+ isColMerged: (x: number) => boolean;
934
+ /** Verify if the col has any merged cells */
935
+ isRowMerged: (y: number) => boolean;
936
+ /** Navigation up */
937
+ up: () => void;
938
+ /**
939
+ * Internal method: Internal method: Set a cell value
940
+ *
941
+ * @param {number} x
942
+ * @param {number} y
943
+ * @param {string} value value
944
+ * @param {string} force value over readonly cells
945
+ * @return void
946
+ */
947
+ updateCell: (x: number, y: number, value: string, force?: boolean) => void;
948
+ /** Internal method: update cells in a batch */
949
+ updateCells: (o: Object) => void;
950
+ /** Update the selection based on two DOM cell selements */
951
+ updateSelection: (el1: number, el2: number, origin: boolean) => void;
952
+ /** Update the selection based on coordinates */
953
+ updateSelectionFromCoords: (x1: number, y1: number, x2: number, y2: number, origin: boolean) => void;
954
+ /** Getter/setter the value by coordinates */
955
+ value?: (x: number, y: number, value?: any) => void;
956
+ /** Which page the row number is */
957
+ whichPage?: (row: number) => number;
909
958
  }
910
959
 
960
+ declare let jspreadsheet: jspreadsheet
961
+
911
962
  export = jspreadsheet;
963
+