@jspreadsheet/bundle 12.2.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 +2355 -0
- package/dist/index.js +223 -0
- package/dist/style.css +6992 -0
- package/package.json +35 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for @jspreadsheet/extensions
|
|
3
|
+
* Combined type definitions for all jspreadsheet extensions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// jspreadsheet
|
|
7
|
+
/**
|
|
8
|
+
* Official Type definitions for Jspreadsheet Pro v11
|
|
9
|
+
* https://jspreadsheet.com/docs
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare function jspreadsheet(element: HTMLElement|HTMLDivElement|null, options: jspreadsheet.Spreadsheet) : Array<jspreadsheet.worksheetInstance>;
|
|
13
|
+
|
|
14
|
+
declare namespace jspreadsheet {
|
|
15
|
+
let current: worksheetInstance | null;
|
|
16
|
+
/** ClientID */
|
|
17
|
+
let clientId: string | null;
|
|
18
|
+
/** License string. Use setLicense to define the license */
|
|
19
|
+
let license: string | null;
|
|
20
|
+
/** Default row height for a table */
|
|
21
|
+
let defaultRowHeight: number | string;
|
|
22
|
+
/** Default column width for a table */
|
|
23
|
+
let defaultColWidth: number;
|
|
24
|
+
/** Column index default width. Default: 50 */
|
|
25
|
+
let indexColumnWidth: number;
|
|
26
|
+
/** The container that holds all spreadsheet instances in the screen */
|
|
27
|
+
let spreadsheet: spreadsheetInstance[];
|
|
28
|
+
/** Advance excel like helpers */
|
|
29
|
+
let helpers: Helpers;
|
|
30
|
+
/** Native editors. You can have extra entries not defined here when working with custom editors */
|
|
31
|
+
let editors: Editors;
|
|
32
|
+
/** History tracker controllers */
|
|
33
|
+
let history: History;
|
|
34
|
+
/** Clipboard controller */
|
|
35
|
+
let clipboard: ClipBoardMethods;
|
|
36
|
+
/** Shortcuts */
|
|
37
|
+
let shortcuts: Shortcuts;
|
|
38
|
+
|
|
39
|
+
// Register a validation
|
|
40
|
+
let setValidationHandler: (name: string, handler: (value: any, options: object) => boolean) => void;
|
|
41
|
+
/** Get the worksheet instance by its name */
|
|
42
|
+
let getWorksheetInstanceByName: GetWorksheetInstanceByNameFunction;
|
|
43
|
+
|
|
44
|
+
/** Picker */
|
|
45
|
+
let picker: Picker;
|
|
46
|
+
|
|
47
|
+
/** Pause calculations */
|
|
48
|
+
function calculations(state: boolean) : void;
|
|
49
|
+
|
|
50
|
+
/** Define the translations from english to any other language. Ex.{ 'hello': 'Ola', 'Successfully Saved': 'Salvo com sucesso' } */
|
|
51
|
+
let setDictionary: SetDictionary;
|
|
52
|
+
|
|
53
|
+
/** Set the license */
|
|
54
|
+
function setLicense(license: string|object) : void;
|
|
55
|
+
|
|
56
|
+
/** Set extensions to the JSS spreadsheet or null to disable all extensions. Example { formula, parser, render } */
|
|
57
|
+
function setExtensions(extensions: object | null, options?: object) : void;
|
|
58
|
+
|
|
59
|
+
/** 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. */
|
|
60
|
+
function destroy(element: HTMLElement | spreadsheetInstance, fullDestroy?: boolean) : void;
|
|
61
|
+
|
|
62
|
+
/** Destroy all the spreadsheets in all namespaces **/
|
|
63
|
+
function destroyAll() : void;
|
|
64
|
+
|
|
65
|
+
/** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */
|
|
66
|
+
let parser: ((options?: parseOptions) => void) | undefined;
|
|
67
|
+
|
|
68
|
+
/** Jspreadsheet formula extension. More info at: https://jspreadsheet.com/products */
|
|
69
|
+
let formula: ((expression: string, variables: object, x: number, y: number, instance: worksheetInstance) => void) | undefined;
|
|
70
|
+
|
|
71
|
+
/** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */
|
|
72
|
+
let render: ((element: HTMLElement, options: any) => void) | undefined;
|
|
73
|
+
|
|
74
|
+
/** Jspreadsheet forms extension. More info at: https://jspreadsheet.com/products */
|
|
75
|
+
let forms: ((options: any) => void) | undefined;
|
|
76
|
+
|
|
77
|
+
/** Jspreadsheet search extension. More info at: https://jspreadsheet.com/products */
|
|
78
|
+
let search: (() => void) | undefined;
|
|
79
|
+
|
|
80
|
+
/** Jspreadsheet importer extension. More info at: https://jspreadsheet.com/products */
|
|
81
|
+
let importer: (() => void) | undefined;
|
|
82
|
+
|
|
83
|
+
/** Jspreadsheet validations extension. More info at: https://jspreadsheet.com/products */
|
|
84
|
+
let validations: (() => void) | undefined;
|
|
85
|
+
|
|
86
|
+
/** Jspreadsheet bar extension. More info at: https://jspreadsheet.com/products */
|
|
87
|
+
let bar: ((options?: { suggestions?: boolean }) => void) | undefined;
|
|
88
|
+
|
|
89
|
+
/** Jspreadsheet charts extension. More info at: https://jspreadsheet.com/products */
|
|
90
|
+
let charts: (() => void) | undefined;
|
|
91
|
+
|
|
92
|
+
/** Jspreadsheet shapes extension. More info at: https://jspreadsheet.com/products */
|
|
93
|
+
let shapes: (() => void) | undefined;
|
|
94
|
+
|
|
95
|
+
/** Get the current version */
|
|
96
|
+
function version(): {
|
|
97
|
+
version: string,
|
|
98
|
+
edition: string,
|
|
99
|
+
host: string,
|
|
100
|
+
license: string,
|
|
101
|
+
print: () => [string],
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type GetWorksheetInstanceByNameFunction = (worksheetName?: string | null | undefined, namespace?: string) => worksheetInstance | Record<string, worksheetInstance>;
|
|
105
|
+
|
|
106
|
+
interface Table {
|
|
107
|
+
// Type
|
|
108
|
+
type?: 'table',
|
|
109
|
+
// Table name
|
|
110
|
+
name?: string,
|
|
111
|
+
// Range
|
|
112
|
+
range?: string,
|
|
113
|
+
// Table style
|
|
114
|
+
theme?: string,
|
|
115
|
+
// The first line is a header
|
|
116
|
+
headerRow?: boolean,
|
|
117
|
+
// Column names
|
|
118
|
+
headers?: string[],
|
|
119
|
+
// Total row
|
|
120
|
+
totalRow?: string,
|
|
121
|
+
// Alternate row colors
|
|
122
|
+
bandedRows?: true,
|
|
123
|
+
// Alternate row colors
|
|
124
|
+
bandedColumns?: true,
|
|
125
|
+
// First column as bold
|
|
126
|
+
firstColumn?: boolean
|
|
127
|
+
// First row as bold
|
|
128
|
+
lastColumn?: boolean
|
|
129
|
+
// Filters
|
|
130
|
+
filters?: boolean
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface Picker {
|
|
134
|
+
(el: HTMLElement, options: PickerOptions) : void;
|
|
135
|
+
cancel: () => void;
|
|
136
|
+
click: () => void;
|
|
137
|
+
e: Record<string, any> | null | undefined;
|
|
138
|
+
end: () => void;
|
|
139
|
+
getRangeFromNode: () => RangeCoords | null | undefined;
|
|
140
|
+
hasEvent: (focus?: boolean) => Record<string, any> | null | undefined;
|
|
141
|
+
input: (element: HTMLElement) => void;
|
|
142
|
+
keydown: (event: KeyboardEvent) => void;
|
|
143
|
+
palette: (colors: string[]) => void;
|
|
144
|
+
selection: (x1: number, y1: number, x2: number, y2: number, event: Event) => boolean | undefined;
|
|
145
|
+
start: (element: HTMLElement) => void;
|
|
146
|
+
update: (element: HTMLElement) => void;
|
|
147
|
+
validSelection: (acceptNewNodeOnly?: boolean) => boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface SetDictionary {
|
|
151
|
+
(dictionary: object) : void;
|
|
152
|
+
translate: (text: string, substitutions: string[]) => string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
interface Shortcut {
|
|
156
|
+
key?: string,
|
|
157
|
+
code?: string,
|
|
158
|
+
handler?: (event: KeyboardEvent, internalEvent: object) => void,
|
|
159
|
+
ctrlKey?: boolean,
|
|
160
|
+
altKey?: boolean,
|
|
161
|
+
shiftKey?: boolean,
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface Shortcuts {
|
|
165
|
+
// Get the first shortcut based on the event properties
|
|
166
|
+
get: (event: Shortcut | KeyboardEvent) => Function | null;
|
|
167
|
+
// Create a new shortcut with the defined properties
|
|
168
|
+
set: (shortcut: Shortcut) => void;
|
|
169
|
+
// Remove the shortcut that matches the defined properties
|
|
170
|
+
reset: (shortcut: Shortcut) => void;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface PickerOptions {
|
|
174
|
+
/** picker creates a range selection component. formula expect to be a formula starting with '=' */
|
|
175
|
+
type?: 'formula' | 'picker';
|
|
176
|
+
/** When the value is changed */
|
|
177
|
+
onchange?: (element: HTMLElement, mouseEvent: object) => void;
|
|
178
|
+
/** Each time the selection is updated */
|
|
179
|
+
onupdate?: (element: HTMLElement, mouseEvent: object) => void;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
type RangeCoords = [number, number, number, number];
|
|
183
|
+
|
|
184
|
+
interface ClipBoard {
|
|
185
|
+
worksheet: worksheetInstance,
|
|
186
|
+
value: string,
|
|
187
|
+
selection: RangeCoords,
|
|
188
|
+
highlighted: RangeCoords | RangeCoords[],
|
|
189
|
+
cut: boolean,
|
|
190
|
+
hash: string | null,
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface ClipBoardMethods {
|
|
194
|
+
set(text: string, isCut?: boolean | undefined, coords?: RangeCoords, reset?: boolean): void,
|
|
195
|
+
get(): ClipBoard,
|
|
196
|
+
reset(resetClipboard?: boolean): void,
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Common properties for all media types */
|
|
200
|
+
interface MediaBase {
|
|
201
|
+
// GUID string
|
|
202
|
+
id?: string;
|
|
203
|
+
type: 'image' | 'chart' | 'shape';
|
|
204
|
+
top?: number;
|
|
205
|
+
left?: number;
|
|
206
|
+
width?: number;
|
|
207
|
+
height?: number;
|
|
208
|
+
zIndex?: number;
|
|
209
|
+
// Cell anchor if applicable
|
|
210
|
+
cellAnchor?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Options for image media */
|
|
214
|
+
interface MediaImageOptions {
|
|
215
|
+
src: string;
|
|
216
|
+
absolute?: boolean;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Options for chart media (unchanged) */
|
|
220
|
+
interface MediaChartOptions {
|
|
221
|
+
type: 'area' | 'bar' | 'column' | 'doughnut' | 'filledRadar' | 'histogram' | 'line' | 'pareto' |
|
|
222
|
+
'percentArea' | 'percentBar' | 'percentColumn' | 'pie' | 'radar' | 'scatter' |
|
|
223
|
+
'stackedArea' | 'stackedBar' | 'stackedColumn';
|
|
224
|
+
range: string; // e.g., "A1:B10"
|
|
225
|
+
headers?: boolean;
|
|
226
|
+
orientation?: 0 | 1;
|
|
227
|
+
labels?: number;
|
|
228
|
+
datasets?: number[];
|
|
229
|
+
title?: {
|
|
230
|
+
text: string;
|
|
231
|
+
align?: 'left' | 'center' | 'right';
|
|
232
|
+
font?: { size?: number; bold?: boolean };
|
|
233
|
+
};
|
|
234
|
+
subtitle?: {
|
|
235
|
+
text: string;
|
|
236
|
+
align?: 'left' | 'center' | 'right';
|
|
237
|
+
};
|
|
238
|
+
legend?: {
|
|
239
|
+
display?: boolean;
|
|
240
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
241
|
+
align?: 'left' | 'center' | 'right';
|
|
242
|
+
};
|
|
243
|
+
series?: Array<{
|
|
244
|
+
color?: string;
|
|
245
|
+
borderColor?: string;
|
|
246
|
+
yAxis?: 'left' | 'right';
|
|
247
|
+
}>;
|
|
248
|
+
axis?: {
|
|
249
|
+
base?: { title?: { text: string } };
|
|
250
|
+
side?: { title?: { text: string } };
|
|
251
|
+
};
|
|
252
|
+
cutout?: number;
|
|
253
|
+
separation?: {
|
|
254
|
+
type: 'piece-width';
|
|
255
|
+
value: number;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** Options for shape media (updated with your list) */
|
|
260
|
+
interface MediaShapeOptions {
|
|
261
|
+
type: 'simpleLine' | 'lineWithArrow' | 'doubleArrowLine' | 'elbowConnector' | 'elbowArrowConnector' |
|
|
262
|
+
'doubleArrowElbowConnector' | 'curvedElbowConnector' | 'curvedArrowConnector' | 'curvedDoubleArrowConnector' |
|
|
263
|
+
'rectangle' | 'rounded-rectangle' | 'singleCutCornerRectangle' | 'doubleCutCornerRectangle' |
|
|
264
|
+
'oppositeCutCornerRectangle' | 'roundedTopRightRectangle' | 'roundedTopLeftRectangle' |
|
|
265
|
+
'roundedTopRightBottomLeftRectangle' | 'ellipse' | 'triangle' | 'right-triangle' | 'parallelogram' |
|
|
266
|
+
'trapezium' | 'diamond' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'decagon' |
|
|
267
|
+
'ovalInterfaceIcon' | 'cutCircle' | 'circlewithtoprightoutsideangle' | 'doubleLineSquare' |
|
|
268
|
+
'doubledtoprighangle' | 'doubleLineShape' | 'mouldingCrown' | 'crossIcon' | 'plaqueShape' |
|
|
269
|
+
'cylinderShape' | 'cubeShape' | 'bevelShape' | 'donutShape' | 'blockShape' | 'blockArk' |
|
|
270
|
+
'smileyFace' | 'heart' | 'lightningBolt' | 'sun' | 'crescentMoon' | 'cloud' | 'arcCurve' |
|
|
271
|
+
'leftSquareBrackets' | 'rightSquareBrackets' | 'squareBracketsPair' | 'leftFlowerBracket' |
|
|
272
|
+
'rightFlowerBracket' | 'flowerBrackets' | 'rightBlockArrow' | 'leftBlockArrow' | 'upBlockArrow' |
|
|
273
|
+
'downBlockArrow' | 'upDownArrow' | 'leftRightArrow' | 'quadArrow' | 'leftRightUpArrow' |
|
|
274
|
+
'bentArrow' | 'uTurnArrow' | 'leftUpArrow' | 'bentUpArrow' | 'curvedRightArrow' | 'curvedLeftArrow' |
|
|
275
|
+
'curvedUpArrow' | 'curvedDownArrow' | 'stripedRightArrow' | 'notchedRightArrow' | 'pentagonArrow' |
|
|
276
|
+
'chevron' | 'rightArrowCallout' | 'downArrowCallout' | 'leftArrowCallout' | 'upArrowCallout' |
|
|
277
|
+
'leftRightArrowCallout' | 'quadArrowCallout' | 'circularArrow' | 'plus' | 'minus' | 'multiplication' |
|
|
278
|
+
'division' | 'equal' | 'notEqualTo' | 'predefinedTask' | 'internalStorage' | 'document' |
|
|
279
|
+
'multitaskingDocuments' | 'terminator' | 'preparation' | 'manualInput' | 'manualOperation' |
|
|
280
|
+
'offpageConnector' | 'card' | 'punchedTape' | 'swimmingJunction' | 'orShape' | 'collateShape' |
|
|
281
|
+
'sortShape' | 'extractShape' | 'mergeShape' | 'storedDataShape' | 'delayShape' |
|
|
282
|
+
'sequentialAccessStorageShape' | 'directAccessStorage' | 'displayShape';
|
|
283
|
+
backgroundColor?: string;
|
|
284
|
+
borderColor?: string;
|
|
285
|
+
fontColor?: string;
|
|
286
|
+
borderWidth?: number;
|
|
287
|
+
text?: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Discriminated union for Media based on type */
|
|
291
|
+
interface MediaImage extends MediaBase {
|
|
292
|
+
type: 'image';
|
|
293
|
+
src: string;
|
|
294
|
+
options?: MediaImageOptions;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
interface MediaChart extends MediaBase {
|
|
298
|
+
type: 'chart';
|
|
299
|
+
options?: MediaChartOptions;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
interface MediaShape extends MediaBase {
|
|
303
|
+
type: 'shape';
|
|
304
|
+
options?: MediaShapeOptions;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Unified Media type */
|
|
308
|
+
type Media = MediaImage | MediaChart | MediaShape;
|
|
309
|
+
|
|
310
|
+
/** New column object */
|
|
311
|
+
interface newColumn {
|
|
312
|
+
column?: number,
|
|
313
|
+
data?: any[],
|
|
314
|
+
options: Column,
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* New row object */
|
|
318
|
+
interface newRow {
|
|
319
|
+
row?: number,
|
|
320
|
+
data?: any[],
|
|
321
|
+
options: Row,
|
|
322
|
+
[key: string]: any,
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** Advance comments */
|
|
326
|
+
interface Comment {
|
|
327
|
+
/** User unique identification */
|
|
328
|
+
user_id?: number,
|
|
329
|
+
/** User name */
|
|
330
|
+
name?: string,
|
|
331
|
+
/** Comment content */
|
|
332
|
+
comments?: string,
|
|
333
|
+
/** Date of the comments */
|
|
334
|
+
date?: string,
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** Global History */
|
|
338
|
+
interface History {
|
|
339
|
+
(changes: Record<string, any>): void;
|
|
340
|
+
/** History index cursor */
|
|
341
|
+
index: number;
|
|
342
|
+
/** History items */
|
|
343
|
+
actions: Record<string, any>[];
|
|
344
|
+
/** When true the next item is cascaded in the same existing history element */
|
|
345
|
+
cascade: boolean;
|
|
346
|
+
/** When true no history will be added to the tracker */
|
|
347
|
+
ignore: boolean;
|
|
348
|
+
/** A history redo or undo is in progress */
|
|
349
|
+
progress: 'undo' | 'redo' | null;
|
|
350
|
+
/** Undo last action */
|
|
351
|
+
undo: () => void;
|
|
352
|
+
/** Redo most recent action */
|
|
353
|
+
redo: () => void;
|
|
354
|
+
/** Reset history tracker */
|
|
355
|
+
reset: () => void;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/** Validation entry */
|
|
359
|
+
interface Validation {
|
|
360
|
+
/** Excel-like range format Sheet1!A1:A6 */
|
|
361
|
+
range: string;
|
|
362
|
+
/** Validation type */
|
|
363
|
+
type: 'number' | 'text' | 'date' | 'list' | 'textLength' | 'empty' | 'notEmpty' | Function;
|
|
364
|
+
/** Validation action can be a warning or reject when the condition are not match or a format when the condition matches */
|
|
365
|
+
action: 'warning' | 'reject' | 'format';
|
|
366
|
+
/** Criteria to be match */
|
|
367
|
+
criteria?:
|
|
368
|
+
| '='
|
|
369
|
+
| '!='
|
|
370
|
+
| '>='
|
|
371
|
+
| '>'
|
|
372
|
+
| '<='
|
|
373
|
+
| '<'
|
|
374
|
+
| 'between'
|
|
375
|
+
| 'not between'
|
|
376
|
+
| 'valid date'
|
|
377
|
+
| 'valid email'
|
|
378
|
+
| 'valid url'
|
|
379
|
+
| 'contains'
|
|
380
|
+
| 'not contains'
|
|
381
|
+
| 'begins with'
|
|
382
|
+
| 'ends with'
|
|
383
|
+
/** Custom message to the user */
|
|
384
|
+
text?: string;
|
|
385
|
+
/** Ignore blank cells */
|
|
386
|
+
allowBlank?: boolean;
|
|
387
|
+
/** For type: format you can apply some CSS when condition is matched */
|
|
388
|
+
format?: Record<string, string>;
|
|
389
|
+
/** For type: format you can add a class when condition is matched */
|
|
390
|
+
className?: string;
|
|
391
|
+
/** Array with two positions, the second position used when criteria is between or not between. */
|
|
392
|
+
value?: number[] | string[],
|
|
393
|
+
/** Make sure run that as a dropdown */
|
|
394
|
+
dropdown?: true,
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** Validations update format */
|
|
398
|
+
interface Validations {
|
|
399
|
+
/** Index position in the array of validations */
|
|
400
|
+
index?: number | null;
|
|
401
|
+
/** The validation definition object */
|
|
402
|
+
value: Validation;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** Native editors */
|
|
406
|
+
interface Editors {
|
|
407
|
+
/** Create a DOM element for a cell edition */
|
|
408
|
+
createEditor: (type: 'input'|'div', cellReference: HTMLElement, value: any, instance: worksheetInstance) => HTMLElement;
|
|
409
|
+
/** Create a DOM for a floating editor container */
|
|
410
|
+
createDialog: (cell: HTMLElement, value: any, x: number, y: number, instance: worksheetInstance) => HTMLElement;
|
|
411
|
+
text: Editor;
|
|
412
|
+
number: Editor;
|
|
413
|
+
numeric: Editor;
|
|
414
|
+
percent: Editor;
|
|
415
|
+
notes: Editor;
|
|
416
|
+
dropdown: Editor;
|
|
417
|
+
autocomplete: Editor;
|
|
418
|
+
calendar: Editor;
|
|
419
|
+
color: Editor;
|
|
420
|
+
checkbox: Editor;
|
|
421
|
+
radio: Editor;
|
|
422
|
+
autonumber: Editor;
|
|
423
|
+
progressbar: Editor;
|
|
424
|
+
rating: Editor;
|
|
425
|
+
email: Editor;
|
|
426
|
+
url: Editor;
|
|
427
|
+
image: Editor;
|
|
428
|
+
html: Editor;
|
|
429
|
+
hidden: Editor;
|
|
430
|
+
tags: Editor;
|
|
431
|
+
record: Editor;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Helpers */
|
|
435
|
+
interface Helpers {
|
|
436
|
+
/**
|
|
437
|
+
* Compare two arrays to see if contains exact the same elements.
|
|
438
|
+
* @param a1 - Array 1.
|
|
439
|
+
* @param a2 - Array 2.
|
|
440
|
+
*/
|
|
441
|
+
compareArray: (a1: number[], a2: number[]) => boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Get caret position for editable dom element.
|
|
444
|
+
*/
|
|
445
|
+
getCaretIndex: (element: HTMLElement) => number;
|
|
446
|
+
/**
|
|
447
|
+
* Invert the key and values in an object.
|
|
448
|
+
*/
|
|
449
|
+
invert: (obj: object) => object;
|
|
450
|
+
/**
|
|
451
|
+
* Get the excel-like letter based on the index number.
|
|
452
|
+
*/
|
|
453
|
+
getColumnName: (index: number) => string;
|
|
454
|
+
/**
|
|
455
|
+
* Get the cell name from its coordinates.
|
|
456
|
+
*/
|
|
457
|
+
getCellNameFromCoords: (x: number, y: number) => string;
|
|
458
|
+
/**
|
|
459
|
+
* Aliases or getCellNameFromCoords.
|
|
460
|
+
*/
|
|
461
|
+
getColumnNameFromCoords: (x: number, y: number) => string;
|
|
462
|
+
/**
|
|
463
|
+
* Get the coordinates from a cell name.
|
|
464
|
+
*/
|
|
465
|
+
getCoordsFromCellName: (name: string) => [number | null, number | null] | [];
|
|
466
|
+
/**
|
|
467
|
+
* Alias for getCoordsFromCellName.
|
|
468
|
+
*/
|
|
469
|
+
getCoordsFromColumnName: (name: string) => [number | null, number | null] | [];
|
|
470
|
+
/**
|
|
471
|
+
* Shift the formula by x and y positions in the matrix.
|
|
472
|
+
*/
|
|
473
|
+
shiftFormula: (formula: string, x: number, y: number) => string;
|
|
474
|
+
/**
|
|
475
|
+
* Get all the token names from a excel-like range.
|
|
476
|
+
*/
|
|
477
|
+
getTokensFromRange: (range: string, force?: boolean, worksheetName?: string, removeDuplicates?: boolean) => string[];
|
|
478
|
+
/**
|
|
479
|
+
* Get the range from an array of tokens.
|
|
480
|
+
*/
|
|
481
|
+
getRangeFromTokens: (tokens: string[], fixCurrencySymbol?: string) => string;
|
|
482
|
+
/**
|
|
483
|
+
* 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.
|
|
484
|
+
*/
|
|
485
|
+
getCoordsFromRange: (range: string, adjust?: boolean) => RangeCoords;
|
|
486
|
+
/**
|
|
487
|
+
* Get range string from [x1,y1,x2,y2].
|
|
488
|
+
*/
|
|
489
|
+
getRangeFromCoords(coords: RangeCoords): string;
|
|
490
|
+
getRangeFromCoords(x1: number, y1: number, x2: number, y2: number): string;
|
|
491
|
+
/**
|
|
492
|
+
* Extract the configuration from JSS from a static HTML table.
|
|
493
|
+
*/
|
|
494
|
+
createFromTable: (element: HTMLElement, options?: Worksheet) => Worksheet;
|
|
495
|
+
/**
|
|
496
|
+
* CSV string to JS array.
|
|
497
|
+
* @param str - CSV string.
|
|
498
|
+
* @param delimiter - Default: ','.
|
|
499
|
+
*/
|
|
500
|
+
parseCSV: (str: string, delimiter?: string) => string[][];
|
|
501
|
+
/**
|
|
502
|
+
* Get all token names inside an range.
|
|
503
|
+
*/
|
|
504
|
+
getTokensFromCoords: (x1: number, y1: number, x2: number, y2: number, worksheetName?: string) => string[];
|
|
505
|
+
|
|
506
|
+
focus: (element: HTMLElement) => void;
|
|
507
|
+
|
|
508
|
+
setCaretIndex: (element: any, index: number) => void;
|
|
509
|
+
|
|
510
|
+
getCaretNode: (target: HTMLElement) => HTMLElement | null;
|
|
511
|
+
|
|
512
|
+
secureFormula: (oldValue: string, runtime?: boolean) => string;
|
|
513
|
+
|
|
514
|
+
insertLineBreak: () => void;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
interface Tabs {
|
|
518
|
+
/** Show the create new tab button */
|
|
519
|
+
allowCreate?: boolean;
|
|
520
|
+
/** Allow drag and drop of the headers to change the tab position */
|
|
521
|
+
allowChangePosition?: boolean;
|
|
522
|
+
/** Allow the header border bottom animation. */
|
|
523
|
+
animation?: boolean;
|
|
524
|
+
/** Hide the tab headers if only one tab is present. */
|
|
525
|
+
hideHeaders?: boolean;
|
|
526
|
+
/** Default padding content */
|
|
527
|
+
padding?: number;
|
|
528
|
+
/** Position of the headers: top | bottom. Default: top */
|
|
529
|
+
position?: 'top' | 'bottom';
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
interface Toolbar {
|
|
533
|
+
/** Array of items for the toolbar */
|
|
534
|
+
items: Array<ToolbarItem>;
|
|
535
|
+
/** Responsive toolbar. Default: true. */
|
|
536
|
+
responsive?: boolean;
|
|
537
|
+
/** maxWidth */
|
|
538
|
+
maxWidth?: number;
|
|
539
|
+
/** Position of the extended hidden options when applicable */
|
|
540
|
+
bottom: boolean
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
interface ToolbarItem {
|
|
544
|
+
/** Toolbar item type */
|
|
545
|
+
type?: 'icon' | 'divisor' | 'label' | 'select';
|
|
546
|
+
/** Content of the toolbar element */
|
|
547
|
+
content?: string;
|
|
548
|
+
/** Tooltip for the toolbar element */
|
|
549
|
+
tooltip?: string;
|
|
550
|
+
/** Toolbar element width */
|
|
551
|
+
width?: number;
|
|
552
|
+
/** The initial selected option for the type: select */
|
|
553
|
+
value?: string;
|
|
554
|
+
/** Render method parser for the elements in the dropdown when type: select */
|
|
555
|
+
render?: Function;
|
|
556
|
+
/** When a item is clicked */
|
|
557
|
+
onclick?: (el: HTMLElement, iconObject: object, toolbarItem: HTMLElement) => void;
|
|
558
|
+
/** For the type select when a new item is selected */
|
|
559
|
+
onchange?: (el: HTMLElement, pickerObject: object, reservedValue: any, itemValue: string, itemKey: string, mouseEvent: object) => void;
|
|
560
|
+
/** To update the state of the toolbar */
|
|
561
|
+
updateState?: (toolbarObject: object, toolbarItem: HTMLElement, option: any, extendOption: any) => void;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
interface Dropdown {
|
|
565
|
+
/** Endpoint to fetch data from a remote server */
|
|
566
|
+
url?: string;
|
|
567
|
+
/** Preloaded data items for the dropdown */
|
|
568
|
+
data?: DropdownItem[];
|
|
569
|
+
/** Format type of the data, typically { id: name } or { value: text } */
|
|
570
|
+
format?: number;
|
|
571
|
+
/** Indicates if multiple item selection is allowed */
|
|
572
|
+
multiple?: boolean;
|
|
573
|
+
/** Enables the autocomplete feature for user input */
|
|
574
|
+
autocomplete?: boolean;
|
|
575
|
+
/** Allows remote search for options */
|
|
576
|
+
remoteSearch?: boolean;
|
|
577
|
+
/** Enables the lazy loading feature for handling a large number of options */
|
|
578
|
+
lazyLoading?: boolean;
|
|
579
|
+
/** Rendering style of the dropdown: 'default', 'picker', or 'searchbar' */
|
|
580
|
+
type?: 'default' | 'picker' | 'searchbar',
|
|
581
|
+
/** Defines the dropdown's width */
|
|
582
|
+
width?: number;
|
|
583
|
+
/** Sets the maximum width of the dropdown */
|
|
584
|
+
maxWidth?: number;
|
|
585
|
+
/** Determines if the dropdown is opened when initialized */
|
|
586
|
+
opened?: boolean;
|
|
587
|
+
/** The initial value of the dropdown */
|
|
588
|
+
value?: string;
|
|
589
|
+
/** Placeholder text for the dropdown */
|
|
590
|
+
placeholder?: string;
|
|
591
|
+
/** Allows the user to add new options */
|
|
592
|
+
newOptions?: boolean;
|
|
593
|
+
/** Internal controller for the dropdown's position */
|
|
594
|
+
position?: boolean;
|
|
595
|
+
/** Event handler for value changes */
|
|
596
|
+
onchange?: (el: HTMLElement, obj: object, oldValue: string, newValue: string) => void;
|
|
597
|
+
/** Event handler for when the dropdown is ready */
|
|
598
|
+
onload?: (el: HTMLElement, obj: object, data: any, val: any) => void;
|
|
599
|
+
/** Event handler for when the dropdown opens */
|
|
600
|
+
onopen?: (el: HTMLElement) => void;
|
|
601
|
+
/** Event handler for when the dropdown closes */
|
|
602
|
+
onclose?: (el: HTMLElement) => void;
|
|
603
|
+
/** Event handler for when the dropdown receives focus */
|
|
604
|
+
onfocus?: (el: HTMLElement) => void;
|
|
605
|
+
/** Event handler for when the dropdown loses focus */
|
|
606
|
+
onblur?: (el: HTMLElement) => void;
|
|
607
|
+
/** Event handler for when a new option is added to the dropdown */
|
|
608
|
+
oninsert?: (obj: object, item: DropdownItem, newItem: DropdownItem) => void;
|
|
609
|
+
/** Event handler for just before a new option is added to the dropdown */
|
|
610
|
+
onbeforeinsert?: (obj: object, item: DropdownItem) => DropdownItem | false | undefined;
|
|
611
|
+
/** Event handler for before a search on autocomplete is performed */
|
|
612
|
+
onbeforesearch?: (obj: object, ajaxRequest: object) => object | false | undefined;
|
|
613
|
+
/** Event handler for processing search results */
|
|
614
|
+
onsearch?: (obj: object, result: object) => void;
|
|
615
|
+
/** Toggles the sorting of dropdown elements */
|
|
616
|
+
sortResults?: boolean;
|
|
617
|
+
/** Indicates if the dropdown should automatically receive focus upon creation */
|
|
618
|
+
autofocus?: boolean;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
interface DropdownItem {
|
|
622
|
+
/** Value of the selected item. */
|
|
623
|
+
value?: string | number;
|
|
624
|
+
/** Label for the selected item. */
|
|
625
|
+
text?: string;
|
|
626
|
+
/** Description of the item */
|
|
627
|
+
title?: string;
|
|
628
|
+
/** Icon of the item */
|
|
629
|
+
image?: string;
|
|
630
|
+
/** Name of the group where the item belongs to */
|
|
631
|
+
group?: string;
|
|
632
|
+
/** Keywords to help finding one item */
|
|
633
|
+
synonym?: string[];
|
|
634
|
+
/** Item is disabled */
|
|
635
|
+
disabled?: boolean;
|
|
636
|
+
/** Color for the item */
|
|
637
|
+
color?: string;
|
|
638
|
+
/** Deprecated */
|
|
639
|
+
id?: string | number;
|
|
640
|
+
/** Deprecated */
|
|
641
|
+
name?: string;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
interface ContextmenuItem {
|
|
645
|
+
/** Context menu item type: line | default */
|
|
646
|
+
type?: 'line' | 'default';
|
|
647
|
+
/** Context menu item title */
|
|
648
|
+
title: string;
|
|
649
|
+
/** Context menu icon key. (Material icon key icon identification) */
|
|
650
|
+
icon?: string;
|
|
651
|
+
/** Item is disabled */
|
|
652
|
+
disabled?: boolean;
|
|
653
|
+
/** A short description or instruction for the item. Normally a shortcut. Ex. CTRL + C */
|
|
654
|
+
shortcut?: string;
|
|
655
|
+
/** Show this text when the user mouse over the element */
|
|
656
|
+
tooltip?: string;
|
|
657
|
+
/** Submenu */
|
|
658
|
+
submenu?: Array<ContextmenuItem>;
|
|
659
|
+
/** Onclick event for the contextmenu item */
|
|
660
|
+
onclick?: (e: MouseEvent, element: HTMLElement) => void;
|
|
661
|
+
/** onopen event */
|
|
662
|
+
onopen?: (self: object) => void;
|
|
663
|
+
/** onclose event */
|
|
664
|
+
onclose?: (self: object) => void;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
interface Contextmenu {
|
|
668
|
+
/** The contextmenu menu */
|
|
669
|
+
(worksheet: worksheetInstance, x: number, y: number, e: MouseEvent, items: Array<ContextmenuItem>, section: string, section_argument1?: any, section_argument2?: any) : Array<ContextmenuItem> | boolean;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
interface Calendar {
|
|
673
|
+
/** Specifies the type of calendar to render. Default is 'default'. Possible values are 'default' and 'year-month-picker'. */
|
|
674
|
+
type?: 'default' | 'year-month-picker';
|
|
675
|
+
/** An array of numbers specifying a range of valid dates. Dates outside this range will be disabled. */
|
|
676
|
+
validRange?: [number, number];
|
|
677
|
+
/** The day of the week the calendar starts on (0 for Sunday - 6 for Saturday). Default: 0. */
|
|
678
|
+
startingDay?: number;
|
|
679
|
+
/** Specifies the day of the week the calendar starts on, where 0 is Sunday and 6 is Saturday. Default is 0 (Sunday). */
|
|
680
|
+
format?: string;
|
|
681
|
+
/** Specifies whether the calendar input is readonly or not. Default is false. */
|
|
682
|
+
readonly?: boolean;
|
|
683
|
+
/** Specifies whether today's date is automatically selected when no date is defined. */
|
|
684
|
+
today?: boolean;
|
|
685
|
+
/** Specifies whether to display a dropdown for selecting hour and minute values. Default is false. */
|
|
686
|
+
time?: boolean;
|
|
687
|
+
/** Specifies whether to display a reset button. Default is true. */
|
|
688
|
+
resetButton?: boolean;
|
|
689
|
+
/** Specifies a placeholder text to display in the calendar input when no date is selected. */
|
|
690
|
+
placeholder?: string;
|
|
691
|
+
/** Auto select confirms the current date as the new value onblur. Default: true */
|
|
692
|
+
autoSelect?: boolean;
|
|
693
|
+
/** Open in fullscreen mode. */
|
|
694
|
+
fullscreen?: boolean;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
interface DefinedNames {
|
|
698
|
+
index: string;
|
|
699
|
+
value?: string;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Cell value
|
|
704
|
+
*/
|
|
705
|
+
interface CellRecord {
|
|
706
|
+
/** Cached value of the cell */
|
|
707
|
+
value: string | number | boolean | undefined;
|
|
708
|
+
/** Coordinate X */
|
|
709
|
+
x: number;
|
|
710
|
+
/** Coordinate Y */
|
|
711
|
+
y: number;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Cell object
|
|
716
|
+
*/
|
|
717
|
+
interface Records {
|
|
718
|
+
/** CELL td element */
|
|
719
|
+
element: HTMLTableCellElement;
|
|
720
|
+
/** Cached value of the cell */
|
|
721
|
+
v: string | number | boolean | undefined;
|
|
722
|
+
/** Coordinate X */
|
|
723
|
+
x: number;
|
|
724
|
+
/** Coordinate Y */
|
|
725
|
+
y: number;
|
|
726
|
+
/** Associate to an array of values */
|
|
727
|
+
a?: Map<Records, any>;
|
|
728
|
+
/** Part of a merged cells */
|
|
729
|
+
merged?: any[];
|
|
730
|
+
/** Merged cells */
|
|
731
|
+
mergeCells?: [number, number];
|
|
732
|
+
/** Style */
|
|
733
|
+
s?: number;
|
|
734
|
+
/** Comments */
|
|
735
|
+
c?: string | Record<string, any>[];
|
|
736
|
+
/** Meta */
|
|
737
|
+
meta?: object;
|
|
738
|
+
/** Chain */
|
|
739
|
+
chain?: Map<Records, true>;
|
|
740
|
+
// Worksheet Instance
|
|
741
|
+
w: worksheetInstance;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
type ColumnType = Editor | 'text' | 'number' | 'numeric' | 'percent' | 'notes' | 'dropdown' | 'autocomplete' | 'calendar' | 'color' | 'checkbox' | 'radio' | 'autonumber' | 'progressbar' | 'rating' | 'email' | 'url' | 'image' | 'html' | 'hidden' | 'tags' | 'record';
|
|
745
|
+
|
|
746
|
+
interface ColumnPrimitiveProperties {
|
|
747
|
+
/** 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. */
|
|
748
|
+
type?: ColumnType;
|
|
749
|
+
/** The alignment of the column content. Default: center. */
|
|
750
|
+
align?: 'center' | 'left' | 'right' | 'justify';
|
|
751
|
+
/** 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 */
|
|
752
|
+
url?: string;
|
|
753
|
+
/** The items to show in the dropdown or autocomplete. */
|
|
754
|
+
source?: Array<DropdownItem> | Array<string> | Array<number>;
|
|
755
|
+
/** It defines the options of a dropdown from a cell range. Example: Sheet1!A1:A4 */
|
|
756
|
+
dynamicSource?: string;
|
|
757
|
+
/** Whether the column is an autocomplete field. */
|
|
758
|
+
autocomplete?: boolean;
|
|
759
|
+
/** Whether the dropdown or autocomplete can accept multiple options. */
|
|
760
|
+
multiple?: boolean;
|
|
761
|
+
/** The delimiter to use for separating multiple dropdown options. Default: ";". */
|
|
762
|
+
delimiter?: string;
|
|
763
|
+
/** The input mask to apply to the data cell. @see https://jsuites.net/v4/javascript-mask */
|
|
764
|
+
mask?: string;
|
|
765
|
+
/** The character to use as the decimal separator. */
|
|
766
|
+
decimal?: '.' | ',';
|
|
767
|
+
/** The maximum number of characters to display in the cell before truncating. */
|
|
768
|
+
truncate?: number,
|
|
769
|
+
/** Whether to disable the mask when editing. */
|
|
770
|
+
disabledMaskOnEdition?: boolean;
|
|
771
|
+
/** A renderer method or rule for the cell content. */
|
|
772
|
+
render?: string | ((td: HTMLElement, value: number|string, x: number | string, y: number | string, worksheet: worksheetInstance, options: Column) => void);
|
|
773
|
+
/** The format of the date or numbers in the cell. Default for the calendar: "DD/MM/YYYY". */
|
|
774
|
+
format?: string;
|
|
775
|
+
/** Locale for Intl.NumberFormat */
|
|
776
|
+
locale?: string,
|
|
777
|
+
/** Extended configuration for the column. */
|
|
778
|
+
options?: Calendar | Dropdown | object;
|
|
779
|
+
/** Whether the column is read-only. */
|
|
780
|
+
readOnly?: boolean;
|
|
781
|
+
/** Whether to process the raw data when copying or downloading. Default: true. */
|
|
782
|
+
process?: boolean;
|
|
783
|
+
/** Whether to try to cast numbers from a cell text. Default: true. */
|
|
784
|
+
autoCasting?: boolean;
|
|
785
|
+
/** Whether to wrap the text in the column. */
|
|
786
|
+
wrap?: boolean;
|
|
787
|
+
/** The rotation angle for the text value, between -90 and 90. Default: null. */
|
|
788
|
+
rotate?: number;
|
|
789
|
+
/** Can be used to map JSON properties or help to group type radio cells */
|
|
790
|
+
name?: string;
|
|
791
|
+
/** Record editor */
|
|
792
|
+
worksheetId?: string;
|
|
793
|
+
worksheetColumn?: number;
|
|
794
|
+
worksheetImage?: boolean;
|
|
795
|
+
locked?: boolean;
|
|
796
|
+
// Accept value on cells when those are not listed as a valid option on the dropdown. Default: true
|
|
797
|
+
strictMode?: boolean;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
interface Column extends ColumnPrimitiveProperties {
|
|
801
|
+
/** The title of the column. */
|
|
802
|
+
title?: string;
|
|
803
|
+
/** The name or path of a property when the data is a JSON object. */
|
|
804
|
+
name?: string;
|
|
805
|
+
/** Define the tooltip text to display on mouseover for the column header. */
|
|
806
|
+
tooltip?: string;
|
|
807
|
+
/** The width of the column. Default: 100px */
|
|
808
|
+
width?: number;
|
|
809
|
+
/** Whether the column is visible. */
|
|
810
|
+
visible?: boolean,
|
|
811
|
+
/** A method to overwrite the column definitions in real-time just before the column is edited. */
|
|
812
|
+
filterOptions?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: number|string, options: Column) => Column;
|
|
813
|
+
/** Whether to shift the formula when copying and pasting. This option is only valid for custom column types. Default: false. */
|
|
814
|
+
shiftFormula?: boolean;
|
|
815
|
+
/** Whether to apply CSS odd-even background color to the column. Default: false. */
|
|
816
|
+
zebra?: boolean;
|
|
817
|
+
/** The number of columns to group together. */
|
|
818
|
+
group?: number;
|
|
819
|
+
/** State of the column group. */
|
|
820
|
+
state?: boolean;
|
|
821
|
+
/** Style index */
|
|
822
|
+
s?: number;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
interface Cell extends ColumnPrimitiveProperties { }
|
|
826
|
+
|
|
827
|
+
interface Border {
|
|
828
|
+
/** HTML Element for the border */
|
|
829
|
+
element: HTMLElement;
|
|
830
|
+
/** Border color */
|
|
831
|
+
color: string;
|
|
832
|
+
/** Used on the marching ants border */
|
|
833
|
+
moveLeft?: HTMLElement;
|
|
834
|
+
/** Used on the marching ants border */
|
|
835
|
+
moveTop?: HTMLElement;
|
|
836
|
+
/** Used on the marching ants border */
|
|
837
|
+
moveRight?: HTMLElement;
|
|
838
|
+
/** Used on the marching ants border */
|
|
839
|
+
moveDown?: HTMLElement;
|
|
840
|
+
/** Current x1 coordinates for the border */
|
|
841
|
+
x1: number;
|
|
842
|
+
/** Current y1 coordinates for the border */
|
|
843
|
+
y1: number;
|
|
844
|
+
/** Current x2 coordinates for the border */
|
|
845
|
+
x2: number;
|
|
846
|
+
/** Current y2 coordinates for the border */
|
|
847
|
+
y2: number;
|
|
848
|
+
/** Border is active in the viewport */
|
|
849
|
+
active: boolean;
|
|
850
|
+
/** Position top of the border */
|
|
851
|
+
t: number;
|
|
852
|
+
/** Position left of the border */
|
|
853
|
+
l: number;
|
|
854
|
+
/** Current border width */
|
|
855
|
+
w: number;
|
|
856
|
+
/** Current border height */
|
|
857
|
+
h: number;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
interface Row {
|
|
861
|
+
/** Height of the row in pixels. */
|
|
862
|
+
height?: number;
|
|
863
|
+
/** Title or name of the row. */
|
|
864
|
+
title?: string;
|
|
865
|
+
/** Determines whether the row is visible or not. */
|
|
866
|
+
visible?: boolean;
|
|
867
|
+
/** ID number that identifies the row. */
|
|
868
|
+
id?: number;
|
|
869
|
+
/** Number of rows that this row is grouped with. */
|
|
870
|
+
group?: number;
|
|
871
|
+
/** State of the row group (collapsed or expanded). */
|
|
872
|
+
state?: boolean;
|
|
873
|
+
/** Determines whether the row is read-only or not. */
|
|
874
|
+
readOnly?: boolean;
|
|
875
|
+
/** Style index */
|
|
876
|
+
s?: number;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
interface RowInstance extends Row {
|
|
880
|
+
/** Element. */
|
|
881
|
+
element: HTMLTableRowElement;
|
|
882
|
+
/** Row index. */
|
|
883
|
+
y: number;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
interface Editor {
|
|
887
|
+
/** createCell When a new cell is created. */
|
|
888
|
+
createCell?: (cell: HTMLTableCellElement, value: any, x: number, y: number, instance: worksheetInstance, options: Column | Cell) => any;
|
|
889
|
+
/** updateCell When the cell value changes. */
|
|
890
|
+
updateCell?: (cell: HTMLTableCellElement, value: any, x: number, y: number, instance: worksheetInstance, options: Column | Cell) => any;
|
|
891
|
+
/** openEditor When the user starts the edition of a cell. */
|
|
892
|
+
openEditor?: (cell: HTMLTableCellElement, value: any, x: number, y: number, instance: worksheetInstance, options: Column | Cell) => any;
|
|
893
|
+
/** closeEditor When the user finalizes the edition of a cell. */
|
|
894
|
+
closeEditor?: (cell: HTMLTableCellElement, confirmChanges: boolean, x: number, y: number, instance: worksheetInstance, options: Column | Cell) => any;
|
|
895
|
+
/** When a cell is destroyed. */
|
|
896
|
+
destroyCell?: (cell: HTMLTableCellElement, x: number, y: number, instance: worksheetInstance) => void;
|
|
897
|
+
/** Transform the raw data into processed data. It will show a text instead of an id in the type dropdown for example. */
|
|
898
|
+
get?: (options: object, value: any, extended: boolean, instance: worksheetInstance) => string
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
interface Plugin {
|
|
902
|
+
/** When a new worksheet is added. */
|
|
903
|
+
beforeinit?: (worksheet: worksheetInstance) => void;
|
|
904
|
+
/** When a new worksheet is added. */
|
|
905
|
+
init?: (worksheet: worksheetInstance) => void;
|
|
906
|
+
/** It would receive a call for every spreadsheet event. */
|
|
907
|
+
onevent?: (event: string, ...args: any[]) => any;
|
|
908
|
+
/** When the spreadsheet needs to save something in the server. */
|
|
909
|
+
persistence?: (method: string, args: object) => void;
|
|
910
|
+
/** When the user opens the context menu. */
|
|
911
|
+
contextMenu?: (instance: worksheetInstance, x: number, y: number, e: MouseEvent, items:Array<ContextmenuItem> , section: string, a: any, b?: any) => Array<ContextmenuItem>;
|
|
912
|
+
/** When the toolbar is created and clicked. */
|
|
913
|
+
toolbar?: (instance: worksheetInstance, toolbar: Toolbar) => Toolbar;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
interface Nested {
|
|
917
|
+
/** Nested header title */
|
|
918
|
+
title?: string;
|
|
919
|
+
/** Nested header tooltip */
|
|
920
|
+
tooltip?: string;
|
|
921
|
+
/** Nested header colspan */
|
|
922
|
+
colspan?: number;
|
|
923
|
+
/** Alignment */
|
|
924
|
+
align?: 'left' | 'center' | 'right';
|
|
925
|
+
/** Frozen */
|
|
926
|
+
frozen?: boolean;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
interface Spreadsheet {
|
|
930
|
+
/** Your application name */
|
|
931
|
+
application?: string;
|
|
932
|
+
/** Remote configuration with Jspreadsheet Server */
|
|
933
|
+
guid?: string;
|
|
934
|
+
/** DOM element for binding the javascript events. This property is normally used when JSS is running as a web component. */
|
|
935
|
+
root?: HTMLElement;
|
|
936
|
+
/** Global defined names. It defines global range variables. */
|
|
937
|
+
definedNames?: Record<string, string>,
|
|
938
|
+
/** Global sorting handler. */
|
|
939
|
+
sorting?: (direction: boolean, column: number) => (a: any, b: any) => number;
|
|
940
|
+
/** Enable the toolbars */
|
|
941
|
+
toolbar?: boolean | Toolbar | ToolbarItem[] | ((toolbarOptions: Toolbar) => Toolbar);
|
|
942
|
+
/** Allow table edition */
|
|
943
|
+
editable?: boolean;
|
|
944
|
+
/** Allow data export */
|
|
945
|
+
allowExport?: boolean;
|
|
946
|
+
/** Include the table headers in the first row of the data */
|
|
947
|
+
includeHeadersOnDownload?: boolean;
|
|
948
|
+
/** Force update on paste for read-only cells */
|
|
949
|
+
forceUpdateOnPaste?: boolean;
|
|
950
|
+
/** Render jspreadsheet spreadsheet on full screen mode. Default: false */
|
|
951
|
+
fullscreen?: boolean;
|
|
952
|
+
/** Make sure the formulas are capital letter. Default: true */
|
|
953
|
+
secureFormulas?: boolean;
|
|
954
|
+
/** Enable formula debug. Default: false */
|
|
955
|
+
debugFormulas?: boolean,
|
|
956
|
+
/** Execute formulas. Default: true */
|
|
957
|
+
parseFormulas?: boolean;
|
|
958
|
+
/** Disable the formula editor. Default: true */
|
|
959
|
+
editorFormulas?: boolean;
|
|
960
|
+
/** Enable or disable formula picker with keyboard. Default: true */
|
|
961
|
+
keyboardFormulas?: boolean;
|
|
962
|
+
/** Auto increment cell data when using the corner copy, including formulas, numbers and dates. Default: true */
|
|
963
|
+
autoIncrement?: boolean;
|
|
964
|
+
/** Try to cast numbers from cell values when executing formulas. Default: true */
|
|
965
|
+
autoCasting?: boolean;
|
|
966
|
+
/** Try to find a format when the input is a string. Default: true */
|
|
967
|
+
autoFormat?: boolean;
|
|
968
|
+
/** Parse HTML. Default: false (Use this with caution) */
|
|
969
|
+
parseHTML?: boolean;
|
|
970
|
+
/** Allow bar when extension bar is enabled. Default: true */
|
|
971
|
+
bar?: boolean;
|
|
972
|
+
/** Allow tabs. Default: false */
|
|
973
|
+
tabs?: boolean | Tabs;
|
|
974
|
+
/** Allow the user to delete worksheets. Default: true */
|
|
975
|
+
allowDeleteWorksheet?: boolean;
|
|
976
|
+
/** Allow the user to rename worksheets. Default: true */
|
|
977
|
+
allowRenameWorksheet?: boolean;
|
|
978
|
+
/** Allow the user to drag and drop the worksheets. Default: true */
|
|
979
|
+
allowMoveWorksheet?: boolean;
|
|
980
|
+
/** Move the cursor down when pressing enter during edition. Default: true */
|
|
981
|
+
moveDownOnEnter?: boolean;
|
|
982
|
+
/** This method is called when the data in the spreadsheet is ready. */
|
|
983
|
+
onload?: (spreadsheet: spreadsheetInstance) => void;
|
|
984
|
+
/** Spreadsheet is clicked */
|
|
985
|
+
onclick?: (worksheet: worksheetInstance, section: string, x: number, y: number, event: object) => void;
|
|
986
|
+
/** When undo is applied */
|
|
987
|
+
onundo?: (worksheet: worksheetInstance, historyRecord: object) => void;
|
|
988
|
+
/** When redo is applied */
|
|
989
|
+
onredo?: (worksheet: worksheetInstance, historyRecord: object) => void;
|
|
990
|
+
/** When something goes wrong during a persistence operation */
|
|
991
|
+
onerror?: (spreadsheet: spreadsheetInstance, result: object) => void;
|
|
992
|
+
/** Before a column value is changed. NOTE: It is possible to overwrite the original value, by return a new value on this method. */
|
|
993
|
+
onbeforechange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number | string, y: number | string, value: any) => false | any | undefined;
|
|
994
|
+
/** After a cell value is changed. */
|
|
995
|
+
onchange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number | string, y: number | string, newValue: any, oldValue: any) => void;
|
|
996
|
+
/** After a cell value is rendered */
|
|
997
|
+
onrender?: (worksheet: worksheetInstance, cell: HTMLElement, x: number | string, y: number | string, newValue: any, options: Column) => void;
|
|
998
|
+
/** Before all data have been updated. Origin: 'paste', 'handle-fill' or undefined */
|
|
999
|
+
onbeforechanges?: (worksheet: worksheetInstance, records: Record<string, any>[], origin: string | undefined) => void | boolean | Record<string, any>[];
|
|
1000
|
+
/** When all data have been updated. Origin: 'paste', 'handle-fill' or undefined */
|
|
1001
|
+
onafterchanges?: (worksheet: worksheetInstance, records: Record<string, any>[], origin: string | undefined) => void;
|
|
1002
|
+
/** 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. */
|
|
1003
|
+
oncopy?: (worksheet: worksheetInstance, selectedCells: RangeCoords, data: string, cut: boolean | undefined) => false | string | undefined;
|
|
1004
|
+
/** Before the paste action is performed. Can return parsed or filtered data. It is possible to cancel the action when the return is false. */
|
|
1005
|
+
onbeforepaste?: (worksheet: worksheetInstance, data: Record<string, any>[][], x: number, y: number) => false | Record<string, any>[][] | undefined;
|
|
1006
|
+
/** After a paste action is performed in the spreadsheet. */
|
|
1007
|
+
onpaste?: (
|
|
1008
|
+
worksheet: worksheetInstance,
|
|
1009
|
+
records: {
|
|
1010
|
+
x: number,
|
|
1011
|
+
y: number,
|
|
1012
|
+
[key: string]: any,
|
|
1013
|
+
}[]
|
|
1014
|
+
) => void;
|
|
1015
|
+
/** Before a new row is inserted. You can cancel the insert event by returning false. */
|
|
1016
|
+
onbeforeinsertrow?: (worksheet: worksheetInstance, newRow: Record<string, any>[]) => false | newRow[] | undefined;
|
|
1017
|
+
/** After a new row is inserted. */
|
|
1018
|
+
oninsertrow?: (worksheet: worksheetInstance, newRow: Record<string, any>[]) => void;
|
|
1019
|
+
/** Before a row is deleted. You can cancel the delete event by returning false. */
|
|
1020
|
+
onbeforedeleterow?: (worksheet: worksheetInstance, rows: number[]) => number[] | false | undefined;
|
|
1021
|
+
/** After a row is excluded. */
|
|
1022
|
+
ondeleterow?: (worksheet: worksheetInstance, rows: number[]) => void;
|
|
1023
|
+
/** Before a new column is inserted. You can cancel the insert event by returning false. */
|
|
1024
|
+
onbeforeinsertcolumn?: (worksheet: worksheetInstance, newColumn: Record<string, any>[]) => false | newColumn[] | undefined;
|
|
1025
|
+
/** After a new column is inserted. */
|
|
1026
|
+
oninsertcolumn?: (worksheet: worksheetInstance, affected: Record<string, any>[]) => void;
|
|
1027
|
+
/** Before a column is excluded. You can cancel the insert event by returning false. */
|
|
1028
|
+
onbeforedeletecolumn?: (worksheet: worksheetInstance, cols: number[]) => false | number[] | undefined;
|
|
1029
|
+
/** After a column is excluded. */
|
|
1030
|
+
ondeletecolumn?: (worksheet: worksheetInstance, cols: number[]) => void;
|
|
1031
|
+
/** Before a row is moved to a new position. */
|
|
1032
|
+
onbeforemoverow?: (worksheet: worksheetInstance, origin: number, destination: number, quantityOfRows: number) => void;
|
|
1033
|
+
/** After a row is moved to a new position. */
|
|
1034
|
+
onmoverow?: (worksheet: worksheetInstance, origin: number, destination: number, quantityOfRows: number) => void;
|
|
1035
|
+
/** Before a column is moved to a new position. */
|
|
1036
|
+
onbeforemovecolumn?: (worksheet: worksheetInstance, origin: number, destination: number, quantityOfColumns: number) => void;
|
|
1037
|
+
/** After a column is moved to a new position. */
|
|
1038
|
+
onmovecolumn?: (worksheet: worksheetInstance, origin: number, destination: number, quantityOfColumns: number) => void;
|
|
1039
|
+
/** After a height change for one or more rows. */
|
|
1040
|
+
onresizerow?: (worksheet: worksheetInstance, row: number | Array<number>, height: number | Array<number>, oldHeight: number | Array<number>) => void;
|
|
1041
|
+
/** After a column width change for one or more columns. */
|
|
1042
|
+
onresizecolumn?: (worksheet: worksheetInstance, column: number | Array<number>, width: number | Array<number>, oldWidth: number | Array<number>) => void;
|
|
1043
|
+
/** Before the selection happens */
|
|
1044
|
+
onbeforeselection?: (worksheet: worksheetInstance, px: number, py: number, ux: number, uy: number, origin?: object) => boolean | undefined;
|
|
1045
|
+
/** When the selection is changed. */
|
|
1046
|
+
onselection?: (worksheet: worksheetInstance, px: number, py: number, ux: number, uy: number, origin?: object) => void;
|
|
1047
|
+
/** Before the comments is added or updated. Return false to cancel the event, void to accept the action or a object. */
|
|
1048
|
+
onbeforecomments?: (worksheet: worksheetInstance, cells: Record<string, string>) => false | Record<string, string> | undefined;
|
|
1049
|
+
/** After a new comment is added or updated. */
|
|
1050
|
+
oncomments?: (worksheet: worksheetInstance, newValues: Record<string, string>, previousValues: Record<string, string>) => void;
|
|
1051
|
+
/** It runs before sorting a column. It should return an array with a custom sorting or false to cancel the user action. */
|
|
1052
|
+
onbeforesort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: number[]) => false | number[] | undefined;
|
|
1053
|
+
/** When a column is sorted. */
|
|
1054
|
+
onsort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: number[]) => void;
|
|
1055
|
+
/** When the spreadsheet gets the focus. */
|
|
1056
|
+
onfocus?: (worksheet: worksheetInstance) => void;
|
|
1057
|
+
/** When the spreadsheet loses the focus. */
|
|
1058
|
+
onblur?: (worksheet: worksheetInstance) => void;
|
|
1059
|
+
/** When merge cells is executed. */
|
|
1060
|
+
onmerge?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void;
|
|
1061
|
+
/** When the header title is changed. */
|
|
1062
|
+
onchangeheader?: (worksheet: worksheetInstance, column: number, newValue: string, oldValue: string | undefined) => void;
|
|
1063
|
+
/** When the footers are created or updated. */
|
|
1064
|
+
onchangefooter?: (worksheet: worksheetInstance, newValue: string[][], oldValue: string[][] | undefined) => void;
|
|
1065
|
+
/** When the value in a cell footer is changed. */
|
|
1066
|
+
onchangefootervalue?: (worksheet: worksheetInstance, records: CellRecord[]) => void;
|
|
1067
|
+
/** When the footer cell is rendered */
|
|
1068
|
+
onrenderfootercell?: (worksheet: worksheetInstance, record: object) => void;
|
|
1069
|
+
/** On change nested headers */
|
|
1070
|
+
onchangenested?: (worksheet: worksheetInstance, options: object) => void;
|
|
1071
|
+
/** On change nested cell properties */
|
|
1072
|
+
onchangenestedcell?: (worksheet: worksheetInstance, x: number, y: number, properties: object) => void;
|
|
1073
|
+
/** When an editor is created. */
|
|
1074
|
+
oncreateeditor?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, element: HTMLElement, options: object) => void;
|
|
1075
|
+
/** When the editor is opened. */
|
|
1076
|
+
oneditionstart?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number) => boolean | undefined;
|
|
1077
|
+
/** When the editor is closed. */
|
|
1078
|
+
oneditionend?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, save: boolean) => void;
|
|
1079
|
+
/** When the style of a cell is changed. */
|
|
1080
|
+
onchangestyle?: (worksheet: worksheetInstance, newValue: Record<string, string>, oldValue: Record<string, string | null>) => void;
|
|
1081
|
+
/** When a cell meta information is added or updated. */
|
|
1082
|
+
onchangemeta?: (worksheet: worksheetInstance, newValue: Record<string, any>) => void;
|
|
1083
|
+
/** Before the page is changed. Can cancel the action when return is false. */
|
|
1084
|
+
onbeforechangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPage: number, quantityPerPage: number) => boolean | undefined;
|
|
1085
|
+
/** When pagination is enabled and the user changes the page. */
|
|
1086
|
+
onchangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPageNumber: number, quantityPerPage: number) => void;
|
|
1087
|
+
/** Add or change the options of a new worksheet. */
|
|
1088
|
+
onbeforecreateworksheet?: (worksheetOptions: Worksheet, position: number) => Worksheet | false | undefined;
|
|
1089
|
+
/** When the user creates a new worksheet. */
|
|
1090
|
+
oncreateworksheet?: (worksheet: worksheetInstance, worksheetOptions: Worksheet, position: number) => void;
|
|
1091
|
+
/** When the user renames a worksheet. */
|
|
1092
|
+
onrenameworksheet?: (worksheet: worksheetInstance, position: number, newValue: string, oldValue: string) => void;
|
|
1093
|
+
/** Before delete worksheet */
|
|
1094
|
+
onbeforedeleteworksheet?: (worksheet: worksheetInstance, position: number) => void | false;
|
|
1095
|
+
/** When the user deletes a worksheet. */
|
|
1096
|
+
ondeleteworksheet?: (worksheet: worksheetInstance, position: number) => void;
|
|
1097
|
+
/** When the user updates the worksheet tab position. */
|
|
1098
|
+
onmoveworksheet?: (worksheet: worksheetInstance, from: number, to: number) => void;
|
|
1099
|
+
/** Before open the worksheet. Return false to cancel opening the worksheet */
|
|
1100
|
+
onbeforeopenworksheet?: (worksheet: worksheetInstance, index: number) => void | boolean;
|
|
1101
|
+
/** When the user opens a worksheet. */
|
|
1102
|
+
onopenworksheet?: (worksheet: worksheetInstance, index: number) => void;
|
|
1103
|
+
/** When there is a row id update */
|
|
1104
|
+
onchangerowid?: (worksheet: worksheetInstance, rows: any[] | Record<string, any>) => void;
|
|
1105
|
+
/** Before the search method starts */
|
|
1106
|
+
onsearchstart?: (worksheet: worksheetInstance, query: string) => void;
|
|
1107
|
+
/** Before the search method starts */
|
|
1108
|
+
onsearchrow?: (worksheet: worksheetInstance, row: number, query: string, terms: RegExp) => boolean;
|
|
1109
|
+
/** 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. */
|
|
1110
|
+
onbeforesearch?: (worksheet: worksheetInstance, query: string, results: number[]) => number[] | false | undefined;
|
|
1111
|
+
/** After the search is applied to the rows. */
|
|
1112
|
+
onsearch?: (worksheet: worksheetInstance, query: string, results: number[]) => void;
|
|
1113
|
+
/** Action to be executed before filtering rows. It can cancel the action by returning false. */
|
|
1114
|
+
onbeforefilter?: (worksheet: worksheetInstance, filters: string[][], data: number[]) => false | number[] | undefined;
|
|
1115
|
+
/** After the filter has been applied to the rows. */
|
|
1116
|
+
onfilter?: (worksheet: worksheetInstance, filters: string[][], data: number[]) => void;
|
|
1117
|
+
/** When a new cell is created */
|
|
1118
|
+
oncreatecell?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => void;
|
|
1119
|
+
/** When a new row is created */
|
|
1120
|
+
oncreaterow?: (worksheet: worksheetInstance, rowNumber: number, tr: HTMLTableRowElement) => void;
|
|
1121
|
+
/** When a new column is created */
|
|
1122
|
+
oncreatecolumn?: (worksheet: worksheetInstance, columnNumber: number, td: HTMLElement, options: Column) => void;
|
|
1123
|
+
/** A way to change the formula in real-time before execution */
|
|
1124
|
+
onbeforeformula?: (worksheet: worksheetInstance, expression: string, x: number, y: number) => string | false | undefined;
|
|
1125
|
+
/** Get the information about the expressions executed from the formula chain */
|
|
1126
|
+
onformulachain?: (worksheet: worksheetInstance, expressions: Array<object>) => void;
|
|
1127
|
+
/** Customize the items available when filter editor is open. */
|
|
1128
|
+
onopenfilter?: (worksheet: worksheetInstance, column: number, options: Record<string, any>[]) => Record<string, any>[] | Promise<Record<string, any>[]> | undefined;
|
|
1129
|
+
/** When the viewport dimension is updated. */
|
|
1130
|
+
onresize?: (w: number, h: number) => void
|
|
1131
|
+
/** When defined names is affected */
|
|
1132
|
+
onchangedefinednames?: (worksheet: worksheetInstance, data: Record<string, any>[]) => void
|
|
1133
|
+
/** Keyboard event */
|
|
1134
|
+
onkeydown?: (worksheet: object, event: object) => void
|
|
1135
|
+
/** New char is entered on editor. */
|
|
1136
|
+
oninput?: (worksheet: object, event: object, text: string) => void
|
|
1137
|
+
/** When change the row visibility */
|
|
1138
|
+
onchangerowvisibility?: (worksheet: worksheetInstance, state: boolean, rows: number[]) => void
|
|
1139
|
+
/** When change the column visibility */
|
|
1140
|
+
onchangecolumnvisibility?: (worksheet: worksheetInstance, state: boolean, columns: number[]) => void
|
|
1141
|
+
/** When a new row group is created */
|
|
1142
|
+
ongrouprow?: (worksheet: worksheetInstance, row: number, numOfItems: number) => void
|
|
1143
|
+
/** When open a row group */
|
|
1144
|
+
onopenrowgroup?: (worksheet: worksheetInstance, row: number) => void
|
|
1145
|
+
/** When close a row group */
|
|
1146
|
+
oncloserowgroup?: (worksheet: worksheetInstance, row: number) => void
|
|
1147
|
+
/** When a new column group is created */
|
|
1148
|
+
ongroupcolumn?: (worksheet: worksheetInstance, column: number, numOfItems: number) => void
|
|
1149
|
+
/** When open a column group */
|
|
1150
|
+
onopencolumngroup?: (worksheet: worksheetInstance, column: number) => void
|
|
1151
|
+
/** When close a column group */
|
|
1152
|
+
onclosecolumngroup?: (worksheet: worksheetInstance, column: number) => void
|
|
1153
|
+
/** When a media object is added, removed or updated. */
|
|
1154
|
+
onchangemedia?: (worksheet: worksheetInstance, newValue: object[], oldValue: object[], affectedRecords: object[]) => void;
|
|
1155
|
+
/** Before loading an image */
|
|
1156
|
+
onbeforeloadimage?: (worksheet: worksheetInstance, img: HTMLImageElement, options: object) => undefined | string | false;
|
|
1157
|
+
/** Update references. When a table structure changes */
|
|
1158
|
+
onchangereferences?: (worksheet: object, affected: Record<string, any>, deletedTokens: string[], deletedColumns: number[], deletedRows: number[]) => void;
|
|
1159
|
+
/** When the cell is changed */
|
|
1160
|
+
onchangeproperty?: (worksheet: worksheetInstance, records: Record<string, any>[]) => void;
|
|
1161
|
+
/** Fire when there is a change in the config */
|
|
1162
|
+
onchangeconfig?: (config: string, spreadsheetLevel?: boolean) => void;
|
|
1163
|
+
/** Fire when a worksheet's visibility is changed. */
|
|
1164
|
+
onchangeworksheetstate?: (spreadsheet: spreadsheetInstance, worksheetIndex: number, state: boolean) => void;
|
|
1165
|
+
/** General event handler */
|
|
1166
|
+
onevent?: (worksheet: worksheetInstance, method: string, ...args: any[]) => any
|
|
1167
|
+
/** Fire when a cell's metadata is reset. */
|
|
1168
|
+
onresetmeta?: (worksheet: worksheetInstance, cellNames: string[] | undefined) => void;
|
|
1169
|
+
/** Fire when a cell's style is reset. */
|
|
1170
|
+
onresetstyle?: (worksheet: worksheetInstance, cellNames: string[]) => void;
|
|
1171
|
+
/** Fire when a validation is created, changed or removed. */
|
|
1172
|
+
onvalidation?: (worksheet: worksheetInstance, records: { index: number, value: Validation | null, oldValue: Validation | null }[]) => void;
|
|
1173
|
+
/** Freeze columns */
|
|
1174
|
+
onfreezecolumns?: (worksheet: worksheetInstance, columns: number[]) => void;
|
|
1175
|
+
/** Freeze columns */
|
|
1176
|
+
onfreezerows?: (worksheet: worksheetInstance, rows: number[]) => void;
|
|
1177
|
+
/** Return false to cancel the contextMenu event, or return custom elements for the contextmenu. */
|
|
1178
|
+
contextMenu?: Contextmenu | null;
|
|
1179
|
+
/** About information */
|
|
1180
|
+
about?: string,
|
|
1181
|
+
/** Worksheets */
|
|
1182
|
+
worksheets?: Worksheet[];
|
|
1183
|
+
/** Validations */
|
|
1184
|
+
validations?: Validation[];
|
|
1185
|
+
/** Plugins */
|
|
1186
|
+
plugins?: Record<string, Plugin | (() => Plugin) | any>
|
|
1187
|
+
/** Global style */
|
|
1188
|
+
style?: string[];
|
|
1189
|
+
/** Snap the cells to the grid when scrolling. Default: false */
|
|
1190
|
+
snapToGrid?: boolean;
|
|
1191
|
+
/** Space between the table and the end of the container. Default: 100 */
|
|
1192
|
+
spacing?: number;
|
|
1193
|
+
/** Namespace help with cross-calculations conflict names */
|
|
1194
|
+
namespace?: string;
|
|
1195
|
+
/** International configuration */
|
|
1196
|
+
international?: International;
|
|
1197
|
+
/** Persistence handler */
|
|
1198
|
+
persistence?: (worksheet: worksheetInstance, method: string, args: object) => void;
|
|
1199
|
+
/** Create a selection during the openWorksheet. Default: true */
|
|
1200
|
+
autoSelect?: boolean;
|
|
1201
|
+
/** Assign a guid to the row Id when that is not provided. Default: false */
|
|
1202
|
+
autoId?: boolean;
|
|
1203
|
+
/** Send data and style to the clipboard. Default: false */
|
|
1204
|
+
fullCopy?: boolean;
|
|
1205
|
+
/** Bring data and style from the clipboard. Default: false */
|
|
1206
|
+
fullPaste?: boolean;
|
|
1207
|
+
/** Table overflow. Default: false */
|
|
1208
|
+
tableOverflow?: boolean;
|
|
1209
|
+
/** Define the table overflow height. Example: '300px' */
|
|
1210
|
+
tableHeight?: number | string;
|
|
1211
|
+
/** Define the table overflow width. Example: '800px' */
|
|
1212
|
+
tableWidth?: number | string;
|
|
1213
|
+
/** Resizable */
|
|
1214
|
+
resizable?: boolean;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
interface Worksheet {
|
|
1218
|
+
/** Load the data from an external server URL */
|
|
1219
|
+
url?: string;
|
|
1220
|
+
/** Load the data into a new spreadsheet from an array of rows or objects */
|
|
1221
|
+
data?: Array<Array<any>> | Array<Record<string, any>>;
|
|
1222
|
+
/** Array with the rows properties definitions such as title, height. */
|
|
1223
|
+
rows?: Row[] | Record<number, Row>;
|
|
1224
|
+
/** The column properties define the behavior of a column and the associated editor */
|
|
1225
|
+
columns?: Array<Column>;
|
|
1226
|
+
/** Define the properties of a cell. This property overwrite the column definitions */
|
|
1227
|
+
cells?: Record<string, Cell>;
|
|
1228
|
+
/** Nested headers definition */
|
|
1229
|
+
nestedHeaders?: Array<Array<Nested>>;
|
|
1230
|
+
/** Default column width. Default: 50px */
|
|
1231
|
+
defaultColWidth?: number | string;
|
|
1232
|
+
/** Default row height. Default: null */
|
|
1233
|
+
defaultRowHeight?: number | string;
|
|
1234
|
+
/** Deprecated. The default alignment of a cell is defined by a CSS class from 8.2.0+ */
|
|
1235
|
+
defaultColAlign?: 'center' | 'left' | 'right' | 'justify';
|
|
1236
|
+
/** Minimum number of spare rows. Default: 0 */
|
|
1237
|
+
minSpareRows?: number;
|
|
1238
|
+
/** Minimum number of spare cols. Default: 0 */
|
|
1239
|
+
minSpareCols?: number;
|
|
1240
|
+
/** Minimum table dimensions: [numberOfColumns, numberOfRows] */
|
|
1241
|
+
minDimensions?: [number, number];
|
|
1242
|
+
/** CSV data source URL */
|
|
1243
|
+
csv?: string;
|
|
1244
|
+
/** CSV default filename for the jspreadsheet exports. Default: worksheetName */
|
|
1245
|
+
csvFileName?: string;
|
|
1246
|
+
/** Consider first line as header. Default: false */
|
|
1247
|
+
csvHeaders?: boolean;
|
|
1248
|
+
/** Delimiter to consider when dealing with the CSV data. Default: ',' */
|
|
1249
|
+
csvDelimiter?: string;
|
|
1250
|
+
/** Allow column sorting */
|
|
1251
|
+
columnSorting?: boolean;
|
|
1252
|
+
/** Sorting the column on dblclick in the header. Default: true */
|
|
1253
|
+
columnSortingOnDblClick?: boolean;
|
|
1254
|
+
/** Allow column dragging */
|
|
1255
|
+
columnDrag?: boolean;
|
|
1256
|
+
/** Allow column resizing */
|
|
1257
|
+
columnResize?: boolean;
|
|
1258
|
+
/** Allow row resizing */
|
|
1259
|
+
rowResize?: boolean;
|
|
1260
|
+
/** Allow row dragging */
|
|
1261
|
+
rowDrag?: boolean;
|
|
1262
|
+
/** Allow table edition */
|
|
1263
|
+
editable?: boolean;
|
|
1264
|
+
/** Allow new rows */
|
|
1265
|
+
allowInsertRow?: boolean;
|
|
1266
|
+
/** Allow new rows to be added using tab key. Default: true */
|
|
1267
|
+
allowManualInsertRow?: boolean;
|
|
1268
|
+
/** Allow new columns to be added using enter key. Default: true */
|
|
1269
|
+
allowInsertColumn?: boolean;
|
|
1270
|
+
/** Allow new rows to be added via script. Default: true */
|
|
1271
|
+
allowManualInsertColumn?: boolean;
|
|
1272
|
+
/** Allow rows to be deleted. Default: true */
|
|
1273
|
+
allowDeleteRow?: boolean;
|
|
1274
|
+
/** Allow columns to be deleted. Default: true */
|
|
1275
|
+
allowDeleteColumn?: boolean;
|
|
1276
|
+
/** Allow rename column. Default: true */
|
|
1277
|
+
allowRenameColumn?: boolean;
|
|
1278
|
+
/** Allow users to add comments to the cells. Default: true */
|
|
1279
|
+
allowComments?: boolean;
|
|
1280
|
+
/** Corner selection and corner data cloning. Default: true */
|
|
1281
|
+
fillHandle?: boolean;
|
|
1282
|
+
/** Merged cells. Default: null */
|
|
1283
|
+
mergeCells?: Record<string, [number, number]>;
|
|
1284
|
+
/** Allow search on the spreadsheet */
|
|
1285
|
+
search?: boolean;
|
|
1286
|
+
/** Activate pagination and defines the number of records per page. Default: false */
|
|
1287
|
+
pagination?: number;
|
|
1288
|
+
/** Dropdown for the user to change the number of records per page. Example: [10,25,50,100]. Default: false */
|
|
1289
|
+
paginationOptions?: Array<number>;
|
|
1290
|
+
/** Text Overflow. Default: false */
|
|
1291
|
+
textOverflow?: boolean;
|
|
1292
|
+
/** Virtualization for columns. Works only when tableOverflow: true. Default: true */
|
|
1293
|
+
virtualizationX?: boolean;
|
|
1294
|
+
/** Virtualization for rows. Works only when tableOverflow: true. Default: true */
|
|
1295
|
+
virtualizationY?: boolean;
|
|
1296
|
+
/** Initial comments. Default: null */
|
|
1297
|
+
comments?: Record<string, string|Comment[]>;
|
|
1298
|
+
/** Initial meta information. Default: null */
|
|
1299
|
+
meta?: Record<string, any>;
|
|
1300
|
+
/** Style */
|
|
1301
|
+
style?: Record<string, string|number>;
|
|
1302
|
+
/** List of frozen column numbers. Should be a number or an array of consecutive numbers. Example: [4,5,6] */
|
|
1303
|
+
freezeColumns?: number|number[];
|
|
1304
|
+
/** List of frozen row numbers. Should be a number or an array of consecutive numbers. Example: [4,5,6] */
|
|
1305
|
+
freezeRows?: number|number[];
|
|
1306
|
+
/** Enable freeze column manual control. Default: true */
|
|
1307
|
+
freezeColumnControl?: boolean,
|
|
1308
|
+
/** Enable freeze row manual control. Default: true */
|
|
1309
|
+
freezeRowControl?: boolean,
|
|
1310
|
+
/** Worksheet Unique Id. */
|
|
1311
|
+
worksheetId?: string;
|
|
1312
|
+
/** Worksheet Name. */
|
|
1313
|
+
worksheetName?: string;
|
|
1314
|
+
/** Worksheet state: hidden | null. Hide a worksheet */
|
|
1315
|
+
worksheetState?: 'hidden' | undefined;
|
|
1316
|
+
/** Enable the column filters */
|
|
1317
|
+
filters?: boolean | string;
|
|
1318
|
+
/** Footers */
|
|
1319
|
+
footers?: any[][];
|
|
1320
|
+
/** This is a internal controller for the spreadsheet locked properties. Please use editable to make it readonly. */
|
|
1321
|
+
locked?: boolean;
|
|
1322
|
+
/** Allow the selection of unlocked cells. Default: true. */
|
|
1323
|
+
selectUnLockedCells?: boolean;
|
|
1324
|
+
/** Allow the selection of locked cells. Default: true. */
|
|
1325
|
+
selectLockedCells?: boolean;
|
|
1326
|
+
/** Show the worksheet gridlines. Default: true */
|
|
1327
|
+
gridline?: boolean;
|
|
1328
|
+
/** Floating images or charts. */
|
|
1329
|
+
media?: Media[];
|
|
1330
|
+
/** Cached values. This can be used to skip calculations during onload */
|
|
1331
|
+
cache?: Record<string, string|number>;
|
|
1332
|
+
/** Zoom value. Default 1 */
|
|
1333
|
+
zoom?: number;
|
|
1334
|
+
/** Detect column names from the data object given when the column names are not declared. Default: true */
|
|
1335
|
+
autoNames?: boolean;
|
|
1336
|
+
/** Tables */
|
|
1337
|
+
tables?: Table[]
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
interface SpreadsheetHTMLElement extends HTMLDivElement {
|
|
1341
|
+
spreadsheet: spreadsheetInstance;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
interface spreadsheetInstance {
|
|
1345
|
+
/** Spreadsheet configuration */
|
|
1346
|
+
config: Spreadsheet;
|
|
1347
|
+
/** Contextmenu HTMLElement */
|
|
1348
|
+
contextmenu: HTMLElement;
|
|
1349
|
+
/** DOM Element */
|
|
1350
|
+
el: SpreadsheetHTMLElement;
|
|
1351
|
+
/** DOM Element. Alias for el */
|
|
1352
|
+
element: SpreadsheetHTMLElement;
|
|
1353
|
+
/** DOM Element container for the filters */
|
|
1354
|
+
filter: HTMLElement;
|
|
1355
|
+
/** Toggle the full screen mode */
|
|
1356
|
+
fullscreen: (state: Boolean) => void;
|
|
1357
|
+
/** HTMLElement Helper */
|
|
1358
|
+
helper: HTMLElement,
|
|
1359
|
+
/** Ignore events */
|
|
1360
|
+
ignoreEvents: boolean;
|
|
1361
|
+
/** HTMLElement editor container */
|
|
1362
|
+
input: HTMLElement;
|
|
1363
|
+
/** HTMLElement loading element */
|
|
1364
|
+
loading: HTMLElement;
|
|
1365
|
+
/** Spreadsheet unique name */
|
|
1366
|
+
name: string;
|
|
1367
|
+
/** List of plugins loaded to the spreadsheet */
|
|
1368
|
+
plugins: Record<string, Plugin>;
|
|
1369
|
+
/** Show progressbar */
|
|
1370
|
+
progress: (state: boolean) => void;
|
|
1371
|
+
/** DOM Textarea helper */
|
|
1372
|
+
textarea: HTMLElement;
|
|
1373
|
+
/** DOM toolbar */
|
|
1374
|
+
toolbar: HTMLElement;
|
|
1375
|
+
/** Tools HTMLElement container */
|
|
1376
|
+
tools: HTMLElement;
|
|
1377
|
+
/** Worksheets container */
|
|
1378
|
+
worksheets: Array<worksheetInstance>;
|
|
1379
|
+
/** Load plugins into the spreadsheet */
|
|
1380
|
+
setPlugins: (plugins: Record<string, Function>) => void;
|
|
1381
|
+
/** Internal method: event dispatch controllers. */
|
|
1382
|
+
dispatch: (event: string, ...args: any[]) => any;
|
|
1383
|
+
/** Get the spreadsheet configuration */
|
|
1384
|
+
getConfig: () => Spreadsheet;
|
|
1385
|
+
/** Get the worksheet index by instance or worksheetId */
|
|
1386
|
+
getWorksheet(worksheetIdent: worksheetInstance): number | false;
|
|
1387
|
+
getWorksheet(worksheetIdent: string, instance?: boolean): worksheetInstance | number | false;
|
|
1388
|
+
/** Get the worksheet name */
|
|
1389
|
+
getWorksheetName: (position: number) => string | undefined;
|
|
1390
|
+
/** Get the worksheet instance by its name */
|
|
1391
|
+
getWorksheetInstanceByName: GetWorksheetInstanceByNameFunction;
|
|
1392
|
+
/** Open a worksheet */
|
|
1393
|
+
openWorksheet: (position: number, force?: boolean) => void;
|
|
1394
|
+
/** Create a new worksheet */
|
|
1395
|
+
createWorksheet: (worksheetOptions: Worksheet, position?: number) => worksheetInstance | false;
|
|
1396
|
+
/** Delete an existing worksheet by its position. When position is omitted delete based on the call context. */
|
|
1397
|
+
deleteWorksheet: (position?: number) => false | undefined;
|
|
1398
|
+
/** Rename an existing worksheet by its position. When position is omitted rename based on the call context. */
|
|
1399
|
+
renameWorksheet: (position: number | null, title: string) => false | undefined;
|
|
1400
|
+
/** Move the position of a worksheet. ignoreDomUpdates: true will block updates to the DOM */
|
|
1401
|
+
moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => false | undefined;
|
|
1402
|
+
/** Get the active worksheet when applicable */
|
|
1403
|
+
getWorksheetActive: () => number;
|
|
1404
|
+
/** Parse the toolbar definitions with defaults */
|
|
1405
|
+
getToolbar: (toolbar?: Toolbar | ToolbarItem[] | Function) => object,
|
|
1406
|
+
/** Set the toolbar */
|
|
1407
|
+
setToolbar: (toolbar: Toolbar | ToolbarItem[] | Function) => void;
|
|
1408
|
+
/** Show the toolbar */
|
|
1409
|
+
showToolbar: () => void;
|
|
1410
|
+
/** Hide the toolbar */
|
|
1411
|
+
hideToolbar: () => void;
|
|
1412
|
+
/** Refresh the toolbar based on the current worksheet */
|
|
1413
|
+
refreshToolbar: (worksheet?: worksheetInstance) => void;
|
|
1414
|
+
/** Set a worksheet state visibility */
|
|
1415
|
+
setWorksheetState: (worksheetIndex: number, state: boolean) => void;
|
|
1416
|
+
/** Change the spreadsheet settings */
|
|
1417
|
+
setConfig: (config: Spreadsheet) => void;
|
|
1418
|
+
/** Destroy the spreadsheet */
|
|
1419
|
+
destroy: (spreadsheet?: spreadsheetInstance | SpreadsheetHTMLElement, destroyEventHandlers?: boolean) => void;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
interface CustomArray<T> extends Array<T> {
|
|
1423
|
+
[key: string]: any;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
interface ColumnInstance extends Column {
|
|
1427
|
+
x: number;
|
|
1428
|
+
colElement: HTMLTableColElement;
|
|
1429
|
+
element: HTMLTableCellElement
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
type DeleteMediaItem = string | { id: string };
|
|
1433
|
+
|
|
1434
|
+
type SetValueFirstArgument = string | { x: number, y: number, value: any, force?: boolean }[];
|
|
1435
|
+
|
|
1436
|
+
/** Maps cell names (e.g., "A1") to colspan and rowspan values (e.g., [3, 2]). */
|
|
1437
|
+
type MergeConfig = Record<string, [number, number]>;
|
|
1438
|
+
|
|
1439
|
+
interface worksheetInstance {
|
|
1440
|
+
/** Array with the borders information */
|
|
1441
|
+
borders: CustomArray<Border>;
|
|
1442
|
+
/** Close the edition for one cell */
|
|
1443
|
+
closeEditor: (cell: HTMLElement|null, save: boolean) => void;
|
|
1444
|
+
/** Close the filters */
|
|
1445
|
+
closeFilter: (update: boolean) => void;
|
|
1446
|
+
/** Column settings */
|
|
1447
|
+
cols: ColumnInstance;
|
|
1448
|
+
/** Hold the colgroup container */
|
|
1449
|
+
colgroupContainer: HTMLElement;
|
|
1450
|
+
/** DOM Worksheet container */
|
|
1451
|
+
content: HTMLElement;
|
|
1452
|
+
/** Copy */
|
|
1453
|
+
copy: (cut?: boolean) => void;
|
|
1454
|
+
/** HTML Element for the handler fill */
|
|
1455
|
+
corner: HTMLElement;
|
|
1456
|
+
/** Internal selected cell */
|
|
1457
|
+
cursor: object;
|
|
1458
|
+
/** Cut */
|
|
1459
|
+
cut: () => void;
|
|
1460
|
+
/** Alias to getData */
|
|
1461
|
+
data: (highlighted?: boolean | RangeCoords, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string;
|
|
1462
|
+
/** Internal use control type to defined JSON (1) or ARRAY (0). */
|
|
1463
|
+
dataType: number,
|
|
1464
|
+
/** Delete one more columns */
|
|
1465
|
+
deleteColumn(columnNumber: number[]): false | undefined;
|
|
1466
|
+
deleteColumn(columnNumber: number, numOfColumns?: number): false | undefined;
|
|
1467
|
+
/** Delete an existing row or rows */
|
|
1468
|
+
deleteRow(rowNumber: number[]): false | undefined;
|
|
1469
|
+
deleteRow(rowNumber: number, numOfRows?: number): false | undefined;
|
|
1470
|
+
/** Destroy all merged cells */
|
|
1471
|
+
destroyMerge: () => void;
|
|
1472
|
+
/** Internal method: event dispatch controllers. */
|
|
1473
|
+
dispatch: (event: string, ...args: any[]) => any;
|
|
1474
|
+
/** Navigation down */
|
|
1475
|
+
down: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
|
|
1476
|
+
/** If extension render exists, execute render extension else download CSV */
|
|
1477
|
+
download: (includeHeaders?: boolean, processed?: boolean, csv?: boolean) => false | string | undefined;
|
|
1478
|
+
/** Download CSV */
|
|
1479
|
+
downloadCSV: (includeHeaders?: boolean, processed?: boolean) => false | string | undefined;
|
|
1480
|
+
/** DOM Worksheet. */
|
|
1481
|
+
element: HTMLElement;
|
|
1482
|
+
/** Internal method: Execute a formula. */
|
|
1483
|
+
executeFormula: (expression: string, x?: number, y?: number, caching?: boolean, basic?: boolean) => any;
|
|
1484
|
+
/** Navigation first */
|
|
1485
|
+
first: (shiftKey?: boolean, ctrlKey?: boolean) => void;
|
|
1486
|
+
/** Internal footer controllers */
|
|
1487
|
+
footers: Record<string, any>;
|
|
1488
|
+
/** Get the border */
|
|
1489
|
+
getBorder: (alias: string) => Border;
|
|
1490
|
+
/** Get the cell element from the cellName or via its coordinates x,y */
|
|
1491
|
+
getCell(cellName: string): HTMLElement;
|
|
1492
|
+
getCell(columnNumber: number, y: number): HTMLElement;
|
|
1493
|
+
/** Alias to getCell */
|
|
1494
|
+
getCellFromCoords(cellName: string): HTMLElement;
|
|
1495
|
+
getCellFromCoords(columnNumber: number, y: number): HTMLElement;
|
|
1496
|
+
/** Get attributes from one cell when applicable */
|
|
1497
|
+
getCells: (cellName?: string) => Cell | Record<string, Cell> | undefined;
|
|
1498
|
+
/** Get the column object by its position */
|
|
1499
|
+
getColumn(): Column[];
|
|
1500
|
+
getColumn(position: number): ColumnInstance | undefined;
|
|
1501
|
+
/** Get the column data from its number */
|
|
1502
|
+
getColumnData: (col: number, processed?: boolean) => false | Array<any>;
|
|
1503
|
+
/** Get the column position by its name */
|
|
1504
|
+
getColumnIdByName: (name: string) => number | false;
|
|
1505
|
+
/** Alias for getProperties */
|
|
1506
|
+
getColumnOptions: (x: number, y?: number) => Cell | ColumnInstance | undefined;
|
|
1507
|
+
/** Get the comments from one cell or multiple cells. Example: getComments('A1') */
|
|
1508
|
+
getComments: (cellName?: string) => string | Comment[] | Record<string, string | Comment[]> | undefined;
|
|
1509
|
+
/** Get the cached values from one cell or multiple cells. Example: getCache('A1') */
|
|
1510
|
+
getCache: (cellName?: string) => false | string | object;
|
|
1511
|
+
/** Get the worksheet settings. Default: false */
|
|
1512
|
+
getConfig: (spreadsheetLevel?: boolean) => Worksheet | Spreadsheet;
|
|
1513
|
+
/**
|
|
1514
|
+
* Fetches all or selected worksheet data in array or JSON format.
|
|
1515
|
+
* @intent get-sheet-data, export-data
|
|
1516
|
+
* @param highlighted - If true, returns only highlighted cells; if RangeCoords, specific range; defaults to all data.
|
|
1517
|
+
* @param processed - If true, returns formatted values; if false, raw values for example formulas or keys. Where processed result for formulas or labels Defaults to false.
|
|
1518
|
+
* @param delimiter - Delimiter for string output (e.g., "," for CSV-like). Normally used on download operations.
|
|
1519
|
+
* @param asJson - Recommended to be used on data operations, default will always respect the internal format. Defaults to false.
|
|
1520
|
+
* @param includeFilteredRows - If true, includes rows hidden by filters. Defaults to false.
|
|
1521
|
+
* @returns {Array<Array<any>> | Array<Record<string, any>> | string} - Worksheet data in specified format or respecting the internal values
|
|
1522
|
+
* @example
|
|
1523
|
+
* const allData = getData(); // [["1", "2"], ["3", "4"]]
|
|
1524
|
+
* const jsonData = getData(false, true, ",", true); // [{ "A": "1", "B": "2" }, ...]
|
|
1525
|
+
* const selectedData = getData([0, 0, 1, 1]); // [["1", "2"], ["3", "4"]]
|
|
1526
|
+
*/
|
|
1527
|
+
getData: (highlighted?: boolean | RangeCoords, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string;
|
|
1528
|
+
/** Get the worksheet data from a range */
|
|
1529
|
+
getDataFromRange: (range: string, processed?: boolean) => Array<Array<any>> | Array<Record<string, any>>;
|
|
1530
|
+
/** Get the defined name or all defined names when key is null */
|
|
1531
|
+
getDefinedNames: (key?: string) => any;
|
|
1532
|
+
/** Internal method: Get the editor for one cell */
|
|
1533
|
+
getEditor: (x: number, y: number) => [Editor, Cell | Column];
|
|
1534
|
+
/** Internal method: Get the filter */
|
|
1535
|
+
getFilter: (col: number, row: number, getAsSets?: boolean) => string[] | string[][] | Set<string> | Set<string>[] | undefined;
|
|
1536
|
+
/** Get the footer configuration */
|
|
1537
|
+
getFooter: () => Array<any> | undefined;
|
|
1538
|
+
/** Get the footer value */
|
|
1539
|
+
getFooterValue: (x: number, y: number) => any;
|
|
1540
|
+
/** Get the header title */
|
|
1541
|
+
getHeader: (columnNumber: number) => string;
|
|
1542
|
+
/** Get all header elements */
|
|
1543
|
+
getHeaders: (asArray: boolean) => string | string[];
|
|
1544
|
+
/** Get the height of one row by its position when height is defined. */
|
|
1545
|
+
getHeight: (row?: number) => Array<number> | number;
|
|
1546
|
+
/** Bring an array of selection coordinates [x1,y1,x2,y2][]. */
|
|
1547
|
+
getHighlighted: () => RangeCoords[];
|
|
1548
|
+
/** Get the data as JSON. */
|
|
1549
|
+
getJson: (highlighted?: boolean | RangeCoords, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string;
|
|
1550
|
+
/** Get the processed data cell shown to the user by the cell name or coordinates. */
|
|
1551
|
+
getLabel: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => any;
|
|
1552
|
+
/** Aliases for getLabel */
|
|
1553
|
+
getLabelFromCoords: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => any;
|
|
1554
|
+
/** Get the merged cells. Cell name: A1, A2, etc or null for all cells */
|
|
1555
|
+
getMerge: (cellName?: string) => [number, number] | Record<string, [number, number]> | undefined;
|
|
1556
|
+
/** Get one or all meta information for one cell. */
|
|
1557
|
+
getMeta: (cellName: string) => object | undefined;
|
|
1558
|
+
/** Get the nested cells */
|
|
1559
|
+
getNestedCell: (x: number, y: number) => HTMLTableCellElement;
|
|
1560
|
+
/** Get the nested headers */
|
|
1561
|
+
getNestedHeaders: () => Nested[][] | undefined;
|
|
1562
|
+
/** Alias to getProperty */
|
|
1563
|
+
getOptions: (x: number, y?: number) => Cell | ColumnInstance | undefined;
|
|
1564
|
+
/** Get processed data by the coordinates of the cell. Extended process a color, progressbar and rating as raw. */
|
|
1565
|
+
getProcessed: (x: number, y: number, extended?: boolean) => any;
|
|
1566
|
+
/** Deprecated. Legacy alias to getProperties */
|
|
1567
|
+
getProperty: (x: number, y?: number) => Cell | ColumnInstance | undefined;
|
|
1568
|
+
/** Get the selection in a range format */
|
|
1569
|
+
getRange: (coords?: RangeCoords, includeName?: boolean) => string;
|
|
1570
|
+
/** Get a row data or meta information by Id. */
|
|
1571
|
+
getRowById: (row: number, element?: boolean) => RowInstance | false | any[][] | Record<string, any>[];
|
|
1572
|
+
/** Get the data from one row */
|
|
1573
|
+
getRowData: (row: number, processed?: boolean) => any[] | Record<string, any> | undefined;
|
|
1574
|
+
/** Get the row id from its position */
|
|
1575
|
+
getRowId: (row: number) => any;
|
|
1576
|
+
/**
|
|
1577
|
+
* Get the selected cells
|
|
1578
|
+
* @param {boolean?} columnNameOnly - Return an array of cell names or cell DOM elements
|
|
1579
|
+
*/
|
|
1580
|
+
getSelected: (columnNameOnly?: boolean) => string[] | { x: number, y: number }[];
|
|
1581
|
+
/** Get the coordinates of the main selection */
|
|
1582
|
+
getSelection: (preserveOrder?: boolean) => RangeCoords | undefined;
|
|
1583
|
+
/** Get the selected columns indexes */
|
|
1584
|
+
getSelectedColumns: (visibleOnly?: boolean) => number[];
|
|
1585
|
+
/** Get the selected rows indexes. */
|
|
1586
|
+
getSelectedRows: (visibleOnly?: boolean) => number[];
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* Retrieves CSS styles for a cell or all cells.
|
|
1590
|
+
* @intent get-cell-style, read-formatting
|
|
1591
|
+
* @param cellName - Cell name (e.g., "A1"); if omitted, returns all styles.
|
|
1592
|
+
* @param onlyIndexes - If true, returns style indices instead of full styles.
|
|
1593
|
+
* @returns {string | number | Record<string, string> | Record<string, number> | undefined} - Style value, index, or object of styles.
|
|
1594
|
+
* @example
|
|
1595
|
+
* getStyle("A1"); // "background-color: red"
|
|
1596
|
+
* getStyle(); // { "A1": "background-color: red", "B2": "font-weight: bold" }
|
|
1597
|
+
*/
|
|
1598
|
+
getStyle: (cellName?: string | null, onlyIndexes?: boolean) => string | number | Record<string, string> | Record<string, number> | undefined;
|
|
1599
|
+
/** Get the style index from a cell or all cells */
|
|
1600
|
+
getStyleIndexes: (cellName?: string | null) => number | Record<string, number> | undefined;
|
|
1601
|
+
/** Find a style ID from a style string. Null when no styleId is found */
|
|
1602
|
+
getStyleId: (styleString?: string) => number | null;
|
|
1603
|
+
/** Get value by the cell name or object. The value can be the raw or processed value. */
|
|
1604
|
+
getValue(cell: string, processed?: boolean, raw?: boolean): Array<Array<any>> | Array<Record<string, any>> | string;
|
|
1605
|
+
getValue(cell: { x: number, y: number }, processed?: boolean, raw?: boolean): any;
|
|
1606
|
+
/** Get value by the coordinates. The value can be the source or processed value, including not formatted proceed data. */
|
|
1607
|
+
getValueFromCoords: (x: number, y: number, processed?: boolean, raw?: boolean) => any;
|
|
1608
|
+
/** Get the width of one column by index or all column width as an array when index is null. */
|
|
1609
|
+
getWidth: (column?: number) => Array<number> | number;
|
|
1610
|
+
/** Go to the row number, [col number] */
|
|
1611
|
+
goto: (row?: number | null, column?: number | null) => void;
|
|
1612
|
+
/** Hold the header container */
|
|
1613
|
+
headerContainer: HTMLElement;
|
|
1614
|
+
/** Hide column */
|
|
1615
|
+
hideColumn: (column: number|number[]) => void;
|
|
1616
|
+
/** Hide the filters for the column or a cell range. */
|
|
1617
|
+
hideFilter: (colNumber?: number | string) => void;
|
|
1618
|
+
/** Hide index column */
|
|
1619
|
+
hideIndex: () => void;
|
|
1620
|
+
/** Hide row */
|
|
1621
|
+
hideRow: (row: number|number[]) => void;
|
|
1622
|
+
/** Hide the search container */
|
|
1623
|
+
hideSearch: () => void;
|
|
1624
|
+
/**
|
|
1625
|
+
* Add new column(s)
|
|
1626
|
+
* @param column - number of columns or array with column information
|
|
1627
|
+
* @param columnNumber - reference when the first argument is a number
|
|
1628
|
+
* @param insertBefore - insertBefore when the first argument is a number
|
|
1629
|
+
*/
|
|
1630
|
+
insertColumn(column?: number, columnNumber?: number, insertBefore?: boolean) : false | undefined;
|
|
1631
|
+
/** Add new columns in a batch */
|
|
1632
|
+
insertColumn(columns: newColumn[]) : false | undefined;
|
|
1633
|
+
/**
|
|
1634
|
+
* Inserts one or more rows at a specified position.
|
|
1635
|
+
* @intent add-rows, insert-row
|
|
1636
|
+
* @param row - Number of rows to add or array of row data/options.
|
|
1637
|
+
* @param rowNumber - Insert position (zero-based), optional if `row` is array.
|
|
1638
|
+
* @param insertBefore - If true, inserts before `rowNumber`; if false, after. Defaults to false.
|
|
1639
|
+
* @returns {false | undefined} - False if invalid, undefined on success.
|
|
1640
|
+
* @example
|
|
1641
|
+
* insertRow(1, 0, true); // Add 1 row before row 0
|
|
1642
|
+
* insertRow([{ row: 0, data: ["a", "b"] }]); // Insert row with data
|
|
1643
|
+
*/
|
|
1644
|
+
insertRow(row?: number | newRow[], rowNumber?: number, insertBefore?: boolean) : false | undefined;
|
|
1645
|
+
insertRow(rows: newRow[]) : false | undefined;
|
|
1646
|
+
/** Check if cell is attached to the DOM */
|
|
1647
|
+
isAttached: (x: number, y: number) => boolean;
|
|
1648
|
+
/** The worksheet is editable */
|
|
1649
|
+
isEditable: () => boolean;
|
|
1650
|
+
/** Check if the cell is merged */
|
|
1651
|
+
isMerged: (x: number, y: number) => Records | false;
|
|
1652
|
+
/** Check if cell is readonly or not by cellName or Coordinates. isReadonly('A1') or isReadonly(x, y) */
|
|
1653
|
+
isReadOnly(cellNameOrX: string, y?: undefined, ignoreLocked?: boolean): boolean | null;
|
|
1654
|
+
isReadOnly(cellNameOrX: number, y: number, ignoreLocked?: boolean): boolean | null;
|
|
1655
|
+
/** Check if the row is merged */
|
|
1656
|
+
isRowMerged: (row: number) => Records | undefined;
|
|
1657
|
+
/** Verify if this coordinates is within a selection or blank for the current selection */
|
|
1658
|
+
isSelected: (x: number, y: number, selection?: RangeCoords) => boolean;
|
|
1659
|
+
/** Navigation last */
|
|
1660
|
+
last: (shiftKey?: boolean, ctrlKey?: boolean) => void;
|
|
1661
|
+
/** Navigation left */
|
|
1662
|
+
left: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
|
|
1663
|
+
/** Change the data without events */
|
|
1664
|
+
loadData: (data: any[], adjustDimension?: boolean) => void;
|
|
1665
|
+
/** HTML element that contains the floating media */
|
|
1666
|
+
media: HTMLDivElement;
|
|
1667
|
+
/** Move one or more columns to another position */
|
|
1668
|
+
moveColumn: (col: number, to: number, quantityOfColumns?: number) => false | undefined;
|
|
1669
|
+
/** Move one or more rows to another position */
|
|
1670
|
+
moveRow: (row: number, to: number, quantityOfRows?: number) => false | undefined;
|
|
1671
|
+
/** Get the column name */
|
|
1672
|
+
name: (col: number) => string | number;
|
|
1673
|
+
/** Start the edition for one cell */
|
|
1674
|
+
openEditor: (cell: HTMLElement, empty?: boolean, mouseEvent?: object) => false | undefined;
|
|
1675
|
+
/** Open the filters */
|
|
1676
|
+
openFilter: (column: number, row?: number) => void;
|
|
1677
|
+
/** Worksheet configuration */
|
|
1678
|
+
options: Worksheet;
|
|
1679
|
+
/** Sort one column by its position. ASC (0) or DESC (1) */
|
|
1680
|
+
orderBy: (column: number, direction?: boolean, internalValueController?: number[], internalPreviousStateController?: any) => void;
|
|
1681
|
+
/** Change page when using pagination */
|
|
1682
|
+
page: (pageNumber: number | null, callBack?: Function) => false | undefined;
|
|
1683
|
+
/** Move the scroll page down */
|
|
1684
|
+
pageDown: () => void;
|
|
1685
|
+
/** Current page number */
|
|
1686
|
+
pageNumber: number;
|
|
1687
|
+
/** Move the scroll page up */
|
|
1688
|
+
pageUp: () => void;
|
|
1689
|
+
/** Pagination DOM container */
|
|
1690
|
+
pagination: HTMLElement;
|
|
1691
|
+
/** Spreadsheet object */
|
|
1692
|
+
parent: spreadsheetInstance;
|
|
1693
|
+
/** Paste */
|
|
1694
|
+
paste: (x: number, y: number, data: string | any[], selections?: boolean) => false | undefined;
|
|
1695
|
+
/** Call the print extension when applicable */
|
|
1696
|
+
print: () => void;
|
|
1697
|
+
/** Get the quantity of pages when pagination is active */
|
|
1698
|
+
quantityOfPages?: () => number | false;
|
|
1699
|
+
/** Array container for all cell DOM elements */
|
|
1700
|
+
records: Records[][];
|
|
1701
|
+
/** Refresh the borders by the border name */
|
|
1702
|
+
refreshBorders: (border?: string) => void;
|
|
1703
|
+
/** Remove the merged cells by the cell name or a object with all cells to be removed. */
|
|
1704
|
+
removeMerge: (cellName: string | Record<string, any>) => false | undefined;
|
|
1705
|
+
/**
|
|
1706
|
+
* Removes borders by alias or all borders.
|
|
1707
|
+
* @intent remove-borders, clear-highlighting
|
|
1708
|
+
* @param border - Border identifier to remove (optional, null for all).
|
|
1709
|
+
* @param permanent - If true, removes permanently; if false, temporary.
|
|
1710
|
+
* @returns {boolean | undefined} - True if successful, false if no border found.
|
|
1711
|
+
*/
|
|
1712
|
+
resetBorders: (border?: string, permanent?: boolean) => void;
|
|
1713
|
+
/** Reset the filter */
|
|
1714
|
+
resetFilters: (column?: number, row?: number) => void;
|
|
1715
|
+
/** Destroy the footers */
|
|
1716
|
+
resetFooter: () => void;
|
|
1717
|
+
/** Destroy freeze columns */
|
|
1718
|
+
resetFreezeColumns: () => void;
|
|
1719
|
+
/** Reset meta data of one or multiple cells. Null for all cells */
|
|
1720
|
+
resetMeta: (cellName?: string[]|string) => false | undefined;
|
|
1721
|
+
/** Reset nested headers */
|
|
1722
|
+
resetNestedHeaders: () => void;
|
|
1723
|
+
/** Reset the search */
|
|
1724
|
+
resetSearch: () => void;
|
|
1725
|
+
/** Reset the main selection */
|
|
1726
|
+
resetSelection: () => boolean;
|
|
1727
|
+
/** Get the style from one cell. Ex. resetStyle('A1') or resetStyle(['A1']) */
|
|
1728
|
+
resetStyle: (cell?: string|string[]) => false | undefined;
|
|
1729
|
+
/** DOM array of results */
|
|
1730
|
+
results: Array<number> | null;
|
|
1731
|
+
/** Navigation right */
|
|
1732
|
+
right: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
|
|
1733
|
+
/** Rotate the spreadsheet cell text. cell = A1, B1... etc */
|
|
1734
|
+
rotate: (cell: string|string[], value:number) => void;
|
|
1735
|
+
/** Array of row objects */
|
|
1736
|
+
rows: RowInstance[] | Record<number, RowInstance>;
|
|
1737
|
+
/** Search for something */
|
|
1738
|
+
search: (str: string) => false | undefined;
|
|
1739
|
+
/** Search HTML container */
|
|
1740
|
+
searchContainer: HTMLElement;
|
|
1741
|
+
/** Search HTML input */
|
|
1742
|
+
searchInput: HTMLElement;
|
|
1743
|
+
/** Select All */
|
|
1744
|
+
selectAll: () => void;
|
|
1745
|
+
/** Selected cells */
|
|
1746
|
+
selectedCell: RangeCoords | null;
|
|
1747
|
+
currentSelection: RangeCoords | null;
|
|
1748
|
+
/**
|
|
1749
|
+
* Adds a colored border to a cell range with a unique identifier.
|
|
1750
|
+
* @intent highlight-cells, create-border
|
|
1751
|
+
* @param x1 - Starting column index (0 or positive).
|
|
1752
|
+
* @param y1 - Starting row index (0 or positive).
|
|
1753
|
+
* @param x2 - Ending column index (≥ x1).
|
|
1754
|
+
* @param y2 - Ending row index (≥ y1).
|
|
1755
|
+
* @param border - Unique border identifier.
|
|
1756
|
+
* @param color - Hex color code (e.g., "#FF0000"), defaults to random if omitted.
|
|
1757
|
+
* @example
|
|
1758
|
+
* setBorder(0, 1, 3, 5, "highlight1", "#FF0000"); // Red border A2:D6
|
|
1759
|
+
*/
|
|
1760
|
+
setBorder: (x1: number, y1: number, x2: number, y2: number, border: string, color?: string) => void;
|
|
1761
|
+
/** Set attributes for one cell */
|
|
1762
|
+
setCells(cellName: Record<string, Cell>): false | undefined;
|
|
1763
|
+
setCells(cellName: string, settings: Cell): false | undefined;
|
|
1764
|
+
/** Set the column data from its number */
|
|
1765
|
+
setColumnData: (col: number, data: any[], force?: boolean) => void;
|
|
1766
|
+
/**
|
|
1767
|
+
* Adds or updates comments for one or more cells.
|
|
1768
|
+
* @intent add-comment, set-note
|
|
1769
|
+
* @param cells - Cell name (e.g., "A1") or object mapping cells to comments.
|
|
1770
|
+
* @param comments - Comment text or object (required if `cells` is string).
|
|
1771
|
+
* @returns {false | undefined} - False if read-only, undefined on success.
|
|
1772
|
+
* @example
|
|
1773
|
+
* setComments("A1", "Check this"); // Comment on A1
|
|
1774
|
+
* setComments({ "A1": "Note 1", "B2": { comments: "Note 2", user_id: 1 } }); // Batch comments
|
|
1775
|
+
*/
|
|
1776
|
+
setComments(cells: string, comments: string|Comment): false | undefined;
|
|
1777
|
+
setComments(cells: Record<string, string|Comment>): false | undefined;
|
|
1778
|
+
/** Set the cache for one or multiple cells */
|
|
1779
|
+
setCache(cellName: Record<string, any>): false | undefined;
|
|
1780
|
+
setCache(cellName: string, values?: any): false | undefined;
|
|
1781
|
+
/** Change the worksheet settings */
|
|
1782
|
+
setConfig(config: Worksheet | Spreadsheet, spreadsheetLevel?: boolean) : void;
|
|
1783
|
+
/** Set the worksheet data */
|
|
1784
|
+
setData: (data: any[]) => void;
|
|
1785
|
+
/** Create or update names */
|
|
1786
|
+
setDefinedNames: (names: DefinedNames | DefinedNames[]) => void;
|
|
1787
|
+
/** Reset names by indexes */
|
|
1788
|
+
resetDefinedNames: (names: DefinedNames[]) => void;
|
|
1789
|
+
/** Set filter */
|
|
1790
|
+
setFilter: (colNumber: number, rowNumber: number | null, keywords?: string[]) => void;
|
|
1791
|
+
/** Set the footers */
|
|
1792
|
+
setFooter: (data: any[][]) => void;
|
|
1793
|
+
/** Set the footer value */
|
|
1794
|
+
setFooterValue: (values: CellRecord[]) => void;
|
|
1795
|
+
/** List of columns to freeze. Should be a number or an array of consecutive numbers. Example: [4,5,6] */
|
|
1796
|
+
setFreezeColumns: (num?: number | number[] | null) => void;
|
|
1797
|
+
/**
|
|
1798
|
+
* Sets or resets a column header title.
|
|
1799
|
+
* @intent set-column-title, rename-header
|
|
1800
|
+
* @param colNumber - Column index (zero-based).
|
|
1801
|
+
* @param title - New header title; if empty or null, resets to default (e.g., "A").
|
|
1802
|
+
* @returns {false | undefined} - False if read-only, undefined on success.
|
|
1803
|
+
* @example
|
|
1804
|
+
* setHeader(0, "Name"); // Set column A to "Name"
|
|
1805
|
+
* setHeader(1, ""); // Reset column B to "B"
|
|
1806
|
+
*/
|
|
1807
|
+
setHeader: (colNumber: number, title?: string) => false | undefined;
|
|
1808
|
+
/** Set the height of one row by its position. currentHeight is for internal use only */
|
|
1809
|
+
setHeight: (row: number|number[], height: number|number[], currentHeight?: number|number[]) => void;
|
|
1810
|
+
/**
|
|
1811
|
+
* Merges cell ranges based on a configuration or single cell specification.
|
|
1812
|
+
* @intent merge-cells, combine-cells
|
|
1813
|
+
* @param cellName - Cell name (e.g., "A1") or merge config (e.g., { "A1": [3, 2] }).
|
|
1814
|
+
* @param colspan - Columns to span (required if `cellName` is string).
|
|
1815
|
+
* @param rowspan - Rows to span (required if `cellName` is string).
|
|
1816
|
+
* @returns {false | undefined} - False if invalid or overlapping, undefined on success.
|
|
1817
|
+
* @example
|
|
1818
|
+
* setMerge("A1", 3, 2); // Merge A1:C2
|
|
1819
|
+
* setMerge({ "A1": [3, 2], "D4": [2, 4] }); // Merge A1:C2 and D4:E7
|
|
1820
|
+
*/
|
|
1821
|
+
setMerge(cellName: string, colspan: number, rowspan: number): false | undefined;
|
|
1822
|
+
setMerge(cells: MergeConfig): false | undefined;
|
|
1823
|
+
/** Get one or various meta-information for one cell. */
|
|
1824
|
+
setMeta: (cell: string | Record<string, any>, property?: string, value?: string) => false | undefined;
|
|
1825
|
+
/** Set the nested headers */
|
|
1826
|
+
setNestedHeaders: (config: Nested[][]) => void;
|
|
1827
|
+
/** Deprecated. Alias for parent.setPlugins */
|
|
1828
|
+
setPlugins: (plugins: Record<string, Plugin>) => void;
|
|
1829
|
+
/** Add a new configuration setting for a column or cell */
|
|
1830
|
+
setProperty(columnNumber: number, rowNumber: number, cellSettings?: Cell): boolean;
|
|
1831
|
+
setProperty(columnNumber: number, columnSettings: Column): boolean;
|
|
1832
|
+
setProperty(changes: ({ x: number, value: Column } | { x: number, y: number, value: Cell, update?: boolean })[]): boolean;
|
|
1833
|
+
setProperty(changes: Record<string, Cell>): boolean;
|
|
1834
|
+
/** Set or reset the cell as readonly */
|
|
1835
|
+
setReadOnly: (cellName: string|HTMLElement, state: boolean) => void;
|
|
1836
|
+
/** Set the data from one row */
|
|
1837
|
+
setRowData: (row: number, data: any[], force?: boolean) => void;
|
|
1838
|
+
/**
|
|
1839
|
+
* Assigns custom IDs to one or more rows for tracking or syncing.
|
|
1840
|
+
* @intent update-row-ids, set-row-identifiers
|
|
1841
|
+
* @param row - Row index or object mapping indices to IDs (e.g., { 0: 1000 }).
|
|
1842
|
+
* @param newId - New ID for a single row (required if `row` is a number).
|
|
1843
|
+
* @example
|
|
1844
|
+
* setRowId(0, 1000); // Set row 0 to ID 1000
|
|
1845
|
+
* setRowId({ 0: 1000, 1: 1001 }); // Batch update
|
|
1846
|
+
*/
|
|
1847
|
+
setRowId(row: Record<number, number>): void;
|
|
1848
|
+
setRowId(row: number, newId: number): void;
|
|
1849
|
+
/**
|
|
1850
|
+
* Applies CSS styles to one or more cells.
|
|
1851
|
+
* @intent format-cells, set-style
|
|
1852
|
+
* @param cell - Cell name (e.g., "A1"), array of cells, or style object (e.g., { "A1": "color: red" }).
|
|
1853
|
+
* @param property - CSS property (e.g., "background-color"), required if `cell` is not an object.
|
|
1854
|
+
* @param value - CSS value (e.g., "red"), optional if `cell` is an object.
|
|
1855
|
+
* @param forceOverwrite - If true, applies even to locked cells. Defaults to false.
|
|
1856
|
+
* @returns {false | undefined} - False if invalid, undefined on success.
|
|
1857
|
+
* @example
|
|
1858
|
+
* setStyle("A1", "background-color", "red"); // Red background for A1
|
|
1859
|
+
* setStyle({ "A1": "color: blue", "B2": "font-weight: bold" }); // Batch styling
|
|
1860
|
+
*/
|
|
1861
|
+
setStyle(cell: string | string[] | { x: number, y: number }[], property: string, value?: string, forceOverwrite?: boolean): false | undefined;
|
|
1862
|
+
setStyle(cell: Record<string, string>, property?: undefined, value?: undefined, forceOverwrite?: boolean): false | undefined;
|
|
1863
|
+
/**
|
|
1864
|
+
* Writes a value to a cell or range, optionally forcing over read-only cells.
|
|
1865
|
+
* @intent set-cell-value, write-data
|
|
1866
|
+
* @param cell - Cell identifier (e.g., "A1") or array of coordinate-value objects (e.g., [{ x: 0, y: 0, value: "test" }]).
|
|
1867
|
+
* @param value - Value to set (required if `cell` is a string).
|
|
1868
|
+
* @param forceOverwrite - If true, writes even to read-only cells. Defaults to false.
|
|
1869
|
+
* @param origin - Source of change (e.g., "user", "script"). Optional.
|
|
1870
|
+
* @returns {false | undefined} - False if operation fails (e.g., invalid cell), undefined on success.
|
|
1871
|
+
* @example
|
|
1872
|
+
* setValue("A1", "Hello"); // Set A1 to "Hello"
|
|
1873
|
+
* setValue([{ x: 0, y: 0, value: "Test" }, { x: 1, y: 1, value: 42 }]); // Batch update
|
|
1874
|
+
*/
|
|
1875
|
+
setValue: (cell: SetValueFirstArgument, value?: any, forceOverwrite?: boolean, origin?: string) => false | undefined;
|
|
1876
|
+
/**
|
|
1877
|
+
* Set a cell value
|
|
1878
|
+
*
|
|
1879
|
+
* @param x
|
|
1880
|
+
* @param y
|
|
1881
|
+
* @param value value
|
|
1882
|
+
* @param force value over readonly cells
|
|
1883
|
+
*/
|
|
1884
|
+
setValueFromCoords: (x: number, y: number, value: any, force?: boolean) => void;
|
|
1885
|
+
/** Set viewport width and height */
|
|
1886
|
+
setViewport: (width?: number, height?: number) => void;
|
|
1887
|
+
/** Set the width of one column by its position */
|
|
1888
|
+
setWidth: (col: number | number[], width: number | number[], oldWidth?: number | number[]) => void;
|
|
1889
|
+
/** Show column */
|
|
1890
|
+
showColumn: (column: number|number[]) => void;
|
|
1891
|
+
/** Show filter controls for one column, all columns or a cell range */
|
|
1892
|
+
showFilter: (columnOrCellRange?: number | string | null) => void;
|
|
1893
|
+
/** Show index column */
|
|
1894
|
+
showIndex: () => void;
|
|
1895
|
+
/** Show row */
|
|
1896
|
+
showRow: (row: number|number[]) => void;
|
|
1897
|
+
/** Hide the search container */
|
|
1898
|
+
showSearch: () => void;
|
|
1899
|
+
/** DOM Worksheet table */
|
|
1900
|
+
table: HTMLElement;
|
|
1901
|
+
/** DOM Worksheet table thead */
|
|
1902
|
+
thead: HTMLElement;
|
|
1903
|
+
/** DOM Worksheet table tbody */
|
|
1904
|
+
tbody: HTMLElement;
|
|
1905
|
+
/** DOM Worksheet table tfoot */
|
|
1906
|
+
tfoot: HTMLElement;
|
|
1907
|
+
/** Navigation up */
|
|
1908
|
+
up: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void;
|
|
1909
|
+
/**
|
|
1910
|
+
* Internal method: Internal method: Set a cell value
|
|
1911
|
+
*
|
|
1912
|
+
* @param x
|
|
1913
|
+
* @param y
|
|
1914
|
+
* @param value value
|
|
1915
|
+
* @param force value over readonly cells
|
|
1916
|
+
*/
|
|
1917
|
+
updateCell: (x: number, y: number, value: any, force?: boolean) => void;
|
|
1918
|
+
/** Internal method: update cells in a batch */
|
|
1919
|
+
updateCells: (o: Record<string, any>[]) => void;
|
|
1920
|
+
/** Update the selection based on coordinates */
|
|
1921
|
+
updateSelectionFromCoords: (x1: number, y1: number, x2?: number, y2?: number, origin?: boolean, type?: string, color?: string) => void;
|
|
1922
|
+
/** Getter/setter the value by coordinates */
|
|
1923
|
+
value?: (x: number | string, y: number, value?: any, removeProperty?: boolean) => any;
|
|
1924
|
+
/** Current page or which page the row number is */
|
|
1925
|
+
whichPage?: (row?: number) => number | false | null;
|
|
1926
|
+
/** Get all group of rows */
|
|
1927
|
+
getRowGroup: () => Record<number, { group: number, state: boolean }>;
|
|
1928
|
+
/** Create a new group of rows */
|
|
1929
|
+
setRowGroup: (row: number, numOfItems?: number, state?: boolean, ignoreHistory?: boolean) => void;
|
|
1930
|
+
/** Open a new group of rows or all rows */
|
|
1931
|
+
openRowGroup: (row?: number|number[]) => void;
|
|
1932
|
+
/** Close a new group of rows or all rows */
|
|
1933
|
+
closeRowGroup: (row?: number|number[]) => void;
|
|
1934
|
+
/** Reset a group of rows */
|
|
1935
|
+
resetRowGroup: (row: number) => void;
|
|
1936
|
+
/** Get all group of columns */
|
|
1937
|
+
getColumnGroup: () => Record<number, { group: number, state: boolean }>;
|
|
1938
|
+
/** Create a new group of columns */
|
|
1939
|
+
setColumnGroup: (column: number, numOfItems?: number, state?: boolean, ignoreHistory?: boolean) => void;
|
|
1940
|
+
/** Open a new group of columns or all groups */
|
|
1941
|
+
openColumnGroup: (column?: number|number[]) => void;
|
|
1942
|
+
/** Close a new group of columns or all groups */
|
|
1943
|
+
closeColumnGroup: (column?: number|number[]) => void;
|
|
1944
|
+
/** Reset a group of columns */
|
|
1945
|
+
resetColumnGroup: (column: number) => void;
|
|
1946
|
+
/** Aliases for jspreadsheet.helpers. Tools to handle spreadsheet data */
|
|
1947
|
+
helpers: Helpers;
|
|
1948
|
+
/** Deprecated. Alias for parent.undo */
|
|
1949
|
+
undo: () => void;
|
|
1950
|
+
/** Deprecated. Alias for parent.redo */
|
|
1951
|
+
redo: () => void;
|
|
1952
|
+
/** Visible columns on the viewport */
|
|
1953
|
+
visibleRows?: number[];
|
|
1954
|
+
/** Visible columns on the viewport */
|
|
1955
|
+
visibleCols?: number[];
|
|
1956
|
+
/** Viewport current width */
|
|
1957
|
+
width?: number;
|
|
1958
|
+
/** Viewport current width */
|
|
1959
|
+
height?: number;
|
|
1960
|
+
/** Get the row object or get the rows configuration when pass null. */
|
|
1961
|
+
getRow: (row?: number) => Row[] | RowInstance;
|
|
1962
|
+
/** Internal nested headers DOM container */
|
|
1963
|
+
nested?: object;
|
|
1964
|
+
/** List of rows to freeze. Should be a number or an array of consecutive numbers. Example: [4,5,6] */
|
|
1965
|
+
setFreezeRows: (numberOfRows?: number | number[] | null) => void;
|
|
1966
|
+
/** Reset the freeze rows */
|
|
1967
|
+
resetFreezeRows: () => void;
|
|
1968
|
+
/** Reset the properties of a cell */
|
|
1969
|
+
resetProperty: (x: number, y: number) => boolean;
|
|
1970
|
+
/** Internal method */
|
|
1971
|
+
setFormula: () => void;
|
|
1972
|
+
/** Update nested cell properties */
|
|
1973
|
+
setNestedCell(x: number, y: number, properties: Nested): false | undefined;
|
|
1974
|
+
setNestedCell(
|
|
1975
|
+
changes: {
|
|
1976
|
+
x: number,
|
|
1977
|
+
y: number,
|
|
1978
|
+
properties: Nested
|
|
1979
|
+
}[]
|
|
1980
|
+
): false | undefined;
|
|
1981
|
+
/** Get a validation object. */
|
|
1982
|
+
getValidations: (validationIndex?: number) => Validation | Validation[] | undefined;
|
|
1983
|
+
/** Insert or update existing validations by index. */
|
|
1984
|
+
setValidations: (validations: Validations | Validations[]) => false | undefined;
|
|
1985
|
+
/** Reset validations by validation indexes. Undefined will remove all validations */
|
|
1986
|
+
resetValidations: (validationIndex?: number | number[]) => false | undefined;
|
|
1987
|
+
/** Load all validation rules from a cell based on its coordinates. */
|
|
1988
|
+
loadValidations(x: number, y: number): Validation[] | undefined;
|
|
1989
|
+
/** 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. */
|
|
1990
|
+
hasErrors(): boolean | number[];
|
|
1991
|
+
/** Check for errors from a cell by its name hasError('A1') */
|
|
1992
|
+
hasErrors(col: string): boolean;
|
|
1993
|
+
/** Check the errors from a cell by its coordinates */
|
|
1994
|
+
hasErrors(col: number, row: number): boolean;
|
|
1995
|
+
/** Resize columns to match the visible content */
|
|
1996
|
+
autoWidth: (columns?: number[]) => void;
|
|
1997
|
+
/** Show the column headers */
|
|
1998
|
+
showHeaders: () => void;
|
|
1999
|
+
/** Hide the column headers */
|
|
2000
|
+
hideHeaders: () => void;
|
|
2001
|
+
/** Get the worksheet index by instance or worksheetId */
|
|
2002
|
+
getWorksheet(worksheetIdent: worksheetInstance): number | false;
|
|
2003
|
+
getWorksheet(worksheetIdent: string, instance?: boolean): worksheetInstance | number | false;
|
|
2004
|
+
/** Open a worksheet */
|
|
2005
|
+
openWorksheet: (position?: number, force?: boolean) => void;
|
|
2006
|
+
/** Create a new worksheet */
|
|
2007
|
+
createWorksheet: (worksheetOptions: Worksheet, position?: number) => false | worksheetInstance;
|
|
2008
|
+
/** Delete an existing worksheet by its position */
|
|
2009
|
+
deleteWorksheet: (position?: number) => false | undefined;
|
|
2010
|
+
/** Rename an existing worksheet by its position */
|
|
2011
|
+
renameWorksheet: (position: number | undefined, title: string) => false | undefined;
|
|
2012
|
+
/** Move the position of a worksheet. ignoreDomUpdates: true will block updates to the DOM */
|
|
2013
|
+
moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => false | undefined;
|
|
2014
|
+
/** Get the active worksheet when applicable */
|
|
2015
|
+
getWorksheetActive: () => number;
|
|
2016
|
+
/** Get the worksheet name */
|
|
2017
|
+
getWorksheetName: (position?: number) => string | undefined;
|
|
2018
|
+
/** Get the worksheet instance by its name */
|
|
2019
|
+
getWorksheetInstanceByName: GetWorksheetInstanceByNameFunction;
|
|
2020
|
+
/** Set a worksheet state visibility */
|
|
2021
|
+
setWorksheetState: (worksheetIndex: number, state: boolean) => void;
|
|
2022
|
+
/** Parse the toolbar definitions with defaults */
|
|
2023
|
+
getToolbar: (toolbar?: Toolbar | ToolbarItem[] | Function) => object;
|
|
2024
|
+
/** Set the toolbar */
|
|
2025
|
+
setToolbar: (toolbar: Toolbar | ToolbarItem[] | Function) => void;
|
|
2026
|
+
/** Show the toolbar */
|
|
2027
|
+
showToolbar: () => void;
|
|
2028
|
+
/** Hide the toolbar */
|
|
2029
|
+
hideToolbar: () => void;
|
|
2030
|
+
/** Refresh the toolbar based on the current worksheet */
|
|
2031
|
+
refreshToolbar: (worksheet?: worksheetInstance) => void;
|
|
2032
|
+
/**
|
|
2033
|
+
* Adds or updates media elements (charts, images, shapes) in the worksheet.
|
|
2034
|
+
* @intent add-charts, insert-images, create-shapes
|
|
2035
|
+
* @param items - Array of media objects to add or update (e.g., charts, images).
|
|
2036
|
+
* @returns {false | undefined} - False if invalid, undefined on success.
|
|
2037
|
+
* @example
|
|
2038
|
+
* setMedia([{ id: "random-guid", type: "chart", top: 50, options: { type: "bar", range: "A1:B10" } }]);
|
|
2039
|
+
* setMedia([{ id: "random-guid", type: "image", src: "logo.png", top: 10, left: 10 }]);
|
|
2040
|
+
*/
|
|
2041
|
+
setMedia: (items: Media[]) => false | undefined;
|
|
2042
|
+
/** Get a media element position or object by guid. */
|
|
2043
|
+
getMedia: (guid: string, position?: boolean) => number | Media | null;
|
|
2044
|
+
/**
|
|
2045
|
+
* Deletes media elements by their GUIDs.
|
|
2046
|
+
* @intent delete-media, remove-chart
|
|
2047
|
+
* @param items - Array of GUIDs or objects with id to delete.
|
|
2048
|
+
* @example
|
|
2049
|
+
* deleteMedia(["chart1", { id: "img1" }]);
|
|
2050
|
+
*/
|
|
2051
|
+
deleteMedia: (items: DeleteMediaItem[]) => false | undefined;
|
|
2052
|
+
/** Add a global formula to the tracking system. Use from formula pro. Only use if necessary. */
|
|
2053
|
+
setTracking: () => void;
|
|
2054
|
+
/** Set a worksheet zoom value > 0 and <= 1. */
|
|
2055
|
+
setZoom: (value: number) => void;
|
|
2056
|
+
/** Get the current zoom value. Default 1 */
|
|
2057
|
+
getZoom: () => number;
|
|
2058
|
+
/** 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 */
|
|
2059
|
+
getCoordsFromRange: (range: string, adjust?: boolean) => [number | null, number | null, number | null, number | null];
|
|
2060
|
+
/** Edition handler */
|
|
2061
|
+
edition: HTMLElement;
|
|
2062
|
+
/** Get the cell object by its coords */
|
|
2063
|
+
getCellObject: (x: number, y: number) => Records;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
interface International {
|
|
2067
|
+
/** User locale **/
|
|
2068
|
+
locale: string;
|
|
2069
|
+
/** General number format */
|
|
2070
|
+
NumberFormat?: Intl.NumberFormat;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
interface parseOptions {
|
|
2074
|
+
/** Load the XLSX from a remote URL. Bear in mind any potential CORS restrictions using this property. */
|
|
2075
|
+
url?: string;
|
|
2076
|
+
/** Define the decimal and a thousand separator based on a locale. */
|
|
2077
|
+
locale?: string;
|
|
2078
|
+
/** Try to import embed cell style as HTML */
|
|
2079
|
+
parseHTML?: boolean;
|
|
2080
|
+
/** Enable or disable the loading spin. Default: true */
|
|
2081
|
+
loadingSpin?: boolean;
|
|
2082
|
+
/** load from a local file. This property is used along input type='file' */
|
|
2083
|
+
file?: object;
|
|
2084
|
+
/** When the file is loaded. */
|
|
2085
|
+
onload?: (config: jspreadsheet.Spreadsheet) => void;
|
|
2086
|
+
/** Method to be called when something is wrong. */
|
|
2087
|
+
onerror?: (error: object) => void;
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
// bar
|
|
2094
|
+
/**
|
|
2095
|
+
* Official Type definitions for JSS Formula Premium
|
|
2096
|
+
* https://jspreadsheet.com/products/bar
|
|
2097
|
+
*/
|
|
2098
|
+
|
|
2099
|
+
declare function bar(options: bar.Options) : void;
|
|
2100
|
+
|
|
2101
|
+
declare namespace bar {
|
|
2102
|
+
|
|
2103
|
+
interface Options {
|
|
2104
|
+
suggestions?: boolean;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
// comments
|
|
2110
|
+
/**
|
|
2111
|
+
* Official Type definitions for JSS comments
|
|
2112
|
+
* https://jspreadsheet.com/products/comments
|
|
2113
|
+
* Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
2114
|
+
*/
|
|
2115
|
+
|
|
2116
|
+
declare function comments(user: comments.options): void;
|
|
2117
|
+
|
|
2118
|
+
declare namespace comments {
|
|
2119
|
+
interface options {
|
|
2120
|
+
user_id?: number;
|
|
2121
|
+
name?: string;
|
|
2122
|
+
image?: string;
|
|
2123
|
+
/**
|
|
2124
|
+
* Permission Level
|
|
2125
|
+
* reader: 0,
|
|
2126
|
+
* editor: 1,
|
|
2127
|
+
* owner: 2,
|
|
2128
|
+
*/
|
|
2129
|
+
permission?: 0 | 1 | 2;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
// format
|
|
2136
|
+
/**
|
|
2137
|
+
* Official Type definitions for JSS Format
|
|
2138
|
+
* https://jspreadsheet.com/products/format
|
|
2139
|
+
*/
|
|
2140
|
+
|
|
2141
|
+
declare function format(options?: format.options): void;
|
|
2142
|
+
|
|
2143
|
+
declare namespace format {
|
|
2144
|
+
|
|
2145
|
+
interface options {
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
// charts
|
|
2152
|
+
/**
|
|
2153
|
+
* Official Type definitions for JSS search
|
|
2154
|
+
* https://jspreadsheet.com/products/charts
|
|
2155
|
+
* Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
2156
|
+
*/
|
|
2157
|
+
|
|
2158
|
+
declare function charts(options?: charts.options): void;
|
|
2159
|
+
|
|
2160
|
+
declare namespace charts {
|
|
2161
|
+
|
|
2162
|
+
interface options {
|
|
2163
|
+
animations?: object;
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
// formula
|
|
2170
|
+
/**
|
|
2171
|
+
* Official Type definitions for JSS Formula Premium
|
|
2172
|
+
* https://jspreadsheet.com/products/formula
|
|
2173
|
+
*/
|
|
2174
|
+
|
|
2175
|
+
declare function formula(expression: string, variables?: object, x?: number, y?: number, instance?: Function): any
|
|
2176
|
+
|
|
2177
|
+
declare namespace formula {
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* Define custom formulas
|
|
2181
|
+
*/
|
|
2182
|
+
function setFormula(formulas: object) : void;
|
|
2183
|
+
function license(value: string) : void;
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* Define external variables
|
|
2187
|
+
*/
|
|
2188
|
+
function setConst(variables: object) : void;
|
|
2189
|
+
function resetConst() : void;
|
|
2190
|
+
|
|
2191
|
+
/**
|
|
2192
|
+
* This property is depreacted. Use Jspreadsheet defined names.
|
|
2193
|
+
* @param variables
|
|
2194
|
+
*/
|
|
2195
|
+
function define(variables: object) : void;
|
|
2196
|
+
function reset() : void;
|
|
2197
|
+
|
|
2198
|
+
let adjustPrecision: boolean;
|
|
2199
|
+
let caching: boolean;
|
|
2200
|
+
let divisor: string;
|
|
2201
|
+
let debug: boolean;
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* Transform a formula before executed.
|
|
2206
|
+
* @param {string} expression
|
|
2207
|
+
* Example:
|
|
2208
|
+
* formula.onbeforeformula = (expression) => expression.replace(/\./g, '').replace(/\,/g, '.')
|
|
2209
|
+
*/
|
|
2210
|
+
function onbeforeformula(expression: string) : string
|
|
2211
|
+
|
|
2212
|
+
/**
|
|
2213
|
+
* Transform a formula before executed.
|
|
2214
|
+
* @param {object} error
|
|
2215
|
+
* @param {string} expression - SUM(A1,B2)
|
|
2216
|
+
* @param {object} variables - { A1: 1000, A2: 2000 }
|
|
2217
|
+
* @param {number} x (cell coordinate)
|
|
2218
|
+
* @param {number} y (cell coordinate)
|
|
2219
|
+
* @param {object} worksheet (worksheet instance)
|
|
2220
|
+
*/
|
|
2221
|
+
function onerror(error: Error, expression: string, variables: object, x: number, y: number, worksheet: object) : void
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
// parser
|
|
2227
|
+
/**
|
|
2228
|
+
* Official Type definitions for JSS Parser
|
|
2229
|
+
* https://jspreadsheet.com/products/parser
|
|
2230
|
+
* Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
2231
|
+
*/
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
declare function parser(options?: parser.options): void;
|
|
2236
|
+
|
|
2237
|
+
declare namespace parser {
|
|
2238
|
+
|
|
2239
|
+
interface options {
|
|
2240
|
+
/** Load the XLSX from a remote URL. Bear in mind any potential CORS restrictions using this property. */
|
|
2241
|
+
url?: string;
|
|
2242
|
+
/** Define the decimal and a thousand separator based on a locale. */
|
|
2243
|
+
locale?: string;
|
|
2244
|
+
/** Try to import embed cell style as HTML */
|
|
2245
|
+
parseHTML?: boolean;
|
|
2246
|
+
/** Enable or disable the loading spin. Default: true */
|
|
2247
|
+
loadingSpin?: boolean;
|
|
2248
|
+
/** load from a local file. This property is used along input type='file' */
|
|
2249
|
+
file?: object;
|
|
2250
|
+
/** When the file is loaded. */
|
|
2251
|
+
onload?: (config: jspreadsheet.Spreadsheet) => void;
|
|
2252
|
+
/** Method to be called when something is wrong. */
|
|
2253
|
+
onerror?: (error: object) => void;
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
// render
|
|
2260
|
+
/**
|
|
2261
|
+
* Official Type definitions for JSS Render
|
|
2262
|
+
* https://jspreadsheet.com/products/render
|
|
2263
|
+
* Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
2264
|
+
*/
|
|
2265
|
+
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
declare function render(element: HTMLElement | jspreadsheet.spreadsheetInstance, options?: render.options): void;
|
|
2269
|
+
|
|
2270
|
+
declare namespace render {
|
|
2271
|
+
|
|
2272
|
+
interface options {
|
|
2273
|
+
/** Final filename */
|
|
2274
|
+
filename?: string;
|
|
2275
|
+
/** Receive the spreadsheet object and return a new spreadsheet object */
|
|
2276
|
+
onbeforerender?: (configSpreadsheet: object) => object;
|
|
2277
|
+
/** Receive the blob. Return false to cancel the default behavior. */
|
|
2278
|
+
onbeforesave?: (blob: object) => void | boolean;
|
|
2279
|
+
/** When finish */
|
|
2280
|
+
onsuccess?: (blog: object) => void;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/** Set the license */
|
|
2284
|
+
function license(license: string|object) : void;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
|
|
2289
|
+
// search
|
|
2290
|
+
/**
|
|
2291
|
+
* Official Type definitions for JSS search
|
|
2292
|
+
* https://jspreadsheet.com/products/search
|
|
2293
|
+
* Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
2294
|
+
*/
|
|
2295
|
+
|
|
2296
|
+
declare function search(worksheet: object): void;
|
|
2297
|
+
|
|
2298
|
+
declare namespace search {
|
|
2299
|
+
interface Options {
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
// shapes
|
|
2306
|
+
/**
|
|
2307
|
+
* Jspreadsheet Shapes Extension
|
|
2308
|
+
* https//jspreadsheet.com/
|
|
2309
|
+
*/
|
|
2310
|
+
|
|
2311
|
+
declare function shapes(options?: shapes.options): void;
|
|
2312
|
+
|
|
2313
|
+
declare namespace shapes {
|
|
2314
|
+
|
|
2315
|
+
interface options {
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
|
|
2321
|
+
// validations
|
|
2322
|
+
/**
|
|
2323
|
+
* Official Type definitions for JSS Validations
|
|
2324
|
+
* https://jspreadsheet.com/products/validations
|
|
2325
|
+
* Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
2326
|
+
*/
|
|
2327
|
+
|
|
2328
|
+
declare function validations(options?: validations.options): void;
|
|
2329
|
+
|
|
2330
|
+
declare namespace validations {
|
|
2331
|
+
|
|
2332
|
+
interface options {
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
declare interface Packages {
|
|
2340
|
+
jspreadsheet: typeof jspreadsheet;
|
|
2341
|
+
bar: typeof bar;
|
|
2342
|
+
comments: typeof comments;
|
|
2343
|
+
format: typeof format;
|
|
2344
|
+
charts: typeof charts;
|
|
2345
|
+
formula: typeof formula;
|
|
2346
|
+
parser: typeof parser;
|
|
2347
|
+
render: typeof render;
|
|
2348
|
+
search: typeof search;
|
|
2349
|
+
shapes: typeof shapes;
|
|
2350
|
+
validations: typeof validations;
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
declare const packages: Packages;
|
|
2354
|
+
export default packages;
|
|
2355
|
+
export { jspreadsheet, bar, comments, format, charts, formula, parser, render, search, shapes, validations };
|