jspreadsheet 9.0.3 → 9.1.0
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 +60 -31
- package/dist/index.js +473 -441
- package/dist/jspreadsheet.css +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -14,13 +14,16 @@ declare namespace jspreadsheet {
|
|
|
14
14
|
function formula(expression: string, variables: object, x: number, y: number, instance: jspreadsheet.worksheetInstance) : void;
|
|
15
15
|
|
|
16
16
|
/** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */
|
|
17
|
-
function render(options: any) : void;
|
|
17
|
+
function render(element: HTMLElement, options: any) : void;
|
|
18
18
|
|
|
19
19
|
/** Jspreadsheet forms extension. More info at: https://jspreadsheet.com/products */
|
|
20
20
|
function forms(options: any) : void;
|
|
21
21
|
|
|
22
22
|
/** Set extensions to the JSS spreadsheet. Example { formula, parser, render } */
|
|
23
|
-
function setExtensions(extensions: object) : void
|
|
23
|
+
function setExtensions(extensions: object) : void;
|
|
24
|
+
|
|
25
|
+
/** Destroy the spreadsheet. Full destroy will clear all JSS controllers and it is not possible to re-create a new spreadsheet if true is used, until refresh the page. */
|
|
26
|
+
function destroy(element: HTMLElement, fullDestroy?: boolean) : void;
|
|
24
27
|
|
|
25
28
|
/** License string */
|
|
26
29
|
let license: string;
|
|
@@ -61,7 +64,7 @@ declare namespace jspreadsheet {
|
|
|
61
64
|
onclick?: Function;
|
|
62
65
|
/** For the type select when a new item is selected */
|
|
63
66
|
onchange?: Function;
|
|
64
|
-
/** To update the state of this item
|
|
67
|
+
/** To update the state of this item */
|
|
65
68
|
updateState?: Function;
|
|
66
69
|
}
|
|
67
70
|
|
|
@@ -146,7 +149,7 @@ declare namespace jspreadsheet {
|
|
|
146
149
|
|
|
147
150
|
interface Column {
|
|
148
151
|
/** Define the column type. Can be a string to define a native editor, or a method to define the custom editor plugin. */
|
|
149
|
-
type?: Editor | 'autocomplete' | 'calendar' | 'checkbox' | 'color' | 'dropdown' | 'hidden' | 'html' | 'image' | 'numeric' | 'radio' | 'text';
|
|
152
|
+
type?: Editor | 'autocomplete' | 'calendar' | 'checkbox' | 'color' | 'dropdown' | 'hidden' | 'html' | 'image' | 'numeric' | 'radio' | 'text' | 'notes';
|
|
150
153
|
/** Column title */
|
|
151
154
|
title?: string;
|
|
152
155
|
/** Name or a path of a property when the data is a JSON object. */
|
|
@@ -197,6 +200,10 @@ declare namespace jspreadsheet {
|
|
|
197
200
|
shiftFormula?: boolean;
|
|
198
201
|
/** Wrap the text in the column */
|
|
199
202
|
wrap?: boolean;
|
|
203
|
+
/** Rotate text value between -90 and 90. Default: null */
|
|
204
|
+
rotate?: number;
|
|
205
|
+
/** CSS odd even background color. Default: false */
|
|
206
|
+
zebra?: boolean;
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
interface Row {
|
|
@@ -245,6 +252,8 @@ declare namespace jspreadsheet {
|
|
|
245
252
|
tooltip?: string;
|
|
246
253
|
/** Nested header colspan */
|
|
247
254
|
colspan?: number;
|
|
255
|
+
/** Alignment */
|
|
256
|
+
align?: 'left' | 'center' | 'right';
|
|
248
257
|
}
|
|
249
258
|
|
|
250
259
|
interface Spreadsheet {
|
|
@@ -254,14 +263,14 @@ declare namespace jspreadsheet {
|
|
|
254
263
|
cloud?: string;
|
|
255
264
|
/** DOM element for binding the javascript events. This property is normally used when JSS is running as a web component. */
|
|
256
265
|
root?: HTMLElement;
|
|
257
|
-
/** Global defined names. It defines global range variables.
|
|
266
|
+
/** Global defined names. It defines global range variables. */
|
|
258
267
|
definedNames?: Record<string, string>,
|
|
259
|
-
/** Global sorting handler.
|
|
268
|
+
/** Global sorting handler. */
|
|
260
269
|
sorting?: (direction: boolean, column: number) => number;
|
|
261
|
-
/** Remote URL for the persistence server
|
|
270
|
+
/** Remote URL for the persistence server */
|
|
262
271
|
server?: string;
|
|
263
|
-
/**
|
|
264
|
-
toolbar?: boolean | Toolbar | Function;
|
|
272
|
+
/** Enable the toolbars */
|
|
273
|
+
toolbar?: boolean | 'extended' | Toolbar | Function;
|
|
265
274
|
/** Allow table edition */
|
|
266
275
|
editable?: boolean;
|
|
267
276
|
/** Allow data export */
|
|
@@ -276,11 +285,11 @@ declare namespace jspreadsheet {
|
|
|
276
285
|
fullscreen?: boolean;
|
|
277
286
|
/** Make sure the formulas are capital letter. Default: true */
|
|
278
287
|
secureFormulas?: boolean;
|
|
279
|
-
/** Enable formula debug. Default: false
|
|
288
|
+
/** Enable formula debug. Default: false */
|
|
280
289
|
debugFormulas?: boolean,
|
|
281
290
|
/** Execute formulas. Default: true */
|
|
282
291
|
parseFormulas?: boolean;
|
|
283
|
-
/** Disable the formula editor. Default: true
|
|
292
|
+
/** Disable the formula editor. Default: true */
|
|
284
293
|
editorFormulas?: boolean;
|
|
285
294
|
/** Auto increment cell data when using the corner copy, including formulas, numbers and dates. Default: true */
|
|
286
295
|
autoIncrement?: boolean;
|
|
@@ -300,7 +309,7 @@ declare namespace jspreadsheet {
|
|
|
300
309
|
moveDownOnEnter?: boolean;
|
|
301
310
|
/** This method is called when the data in the spreadsheet is ready. */
|
|
302
311
|
onload?: (spreadsheet: spreadsheetInstance) => void;
|
|
303
|
-
/** Spreadsheet is clicked
|
|
312
|
+
/** Spreadsheet is clicked */
|
|
304
313
|
onclick?: (worksheet: worksheetInstance, section: string, x: number, y: number) => void;
|
|
305
314
|
/** When undo is applied */
|
|
306
315
|
onundo?: (worksheet: worksheetInstance, historyRecord: object) => void;
|
|
@@ -309,7 +318,7 @@ declare namespace jspreadsheet {
|
|
|
309
318
|
/** Before any data is sent to the backend. Can be used to overwrite the data or to cancel the action when return false. */
|
|
310
319
|
onbeforesave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: object) => boolean | object;
|
|
311
320
|
/** After something is saved */
|
|
312
|
-
onsave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: Array<any
|
|
321
|
+
onsave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: Array<any>, result: Object) => void;
|
|
313
322
|
/** Before a column value is changed. NOTE: It is possible to overwrite the original value, by return a new value on this method. */
|
|
314
323
|
onbeforechange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => boolean | any;
|
|
315
324
|
/** After a column value is changed. */
|
|
@@ -374,9 +383,9 @@ declare namespace jspreadsheet {
|
|
|
374
383
|
onchangenestedcell?: (worksheet: worksheetInstance, x: number, y: number, properties: object) => void;
|
|
375
384
|
/** When an editor is created. */
|
|
376
385
|
oncreateeditor?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, element: HTMLElement, options: object) => void;
|
|
377
|
-
/** When the editor is opened.
|
|
386
|
+
/** When the editor is opened. */
|
|
378
387
|
oneditionstart?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number) => void;
|
|
379
|
-
/** When the editor is closed.
|
|
388
|
+
/** When the editor is closed. */
|
|
380
389
|
oneditionend?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, save: boolean) => void;
|
|
381
390
|
/** When the style of a cell is changed. */
|
|
382
391
|
onchangestyle?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void;
|
|
@@ -428,8 +437,16 @@ declare namespace jspreadsheet {
|
|
|
428
437
|
onopenfilter?: (worksheet: worksheetInstance, column: number, options: Array<object>) => void | Array<object>;
|
|
429
438
|
/** When the viewport dimension is updated. */
|
|
430
439
|
onresize?: (worksheet: worksheetInstance, w: number, h: number) => void
|
|
440
|
+
/** Before the references are changed. */
|
|
441
|
+
onbeforechangereferences?: (worksheet: worksheetInstance, affectedTokens: [], deletedTokens: []) => void
|
|
431
442
|
/** When the references are changed. Sorting, Add/Delete/Move Rows and Columns. */
|
|
432
443
|
onchangereferences?: (worksheet: worksheetInstance, affectedTokens: [], deletedTokens: []) => void
|
|
444
|
+
/** Intercept the ajax call before save. XHR ajax object */
|
|
445
|
+
onbeforesend?: (worksheet: worksheetInstance, xhr: object) => void
|
|
446
|
+
/** When defined names is affected */
|
|
447
|
+
onchangedefinednames?: (worksheet: object, data: []) => void
|
|
448
|
+
/** New char is entered on editor. */
|
|
449
|
+
oninput?: (worksheet: object, event: object) => void
|
|
433
450
|
/** Run every single table update action. Can bring performance issues if perform too much changes. */
|
|
434
451
|
updateTable?: (worksheet: worksheetInstance, cell: Object, x: number, y: number, value: String) => void;
|
|
435
452
|
/** Return false to cancel the contextMenu event, or return custom elements for the contextmenu. */
|
|
@@ -451,17 +468,17 @@ declare namespace jspreadsheet {
|
|
|
451
468
|
}
|
|
452
469
|
|
|
453
470
|
interface Worksheet {
|
|
454
|
-
/** Logo URL
|
|
471
|
+
/** Logo URL */
|
|
455
472
|
logo?: string
|
|
456
473
|
/** Load the data from an external server URL */
|
|
457
474
|
url?: string;
|
|
458
|
-
/**
|
|
475
|
+
/** Persistence URL or true when the URL is the same of the URL of the data source */
|
|
459
476
|
persistence?: string | boolean;
|
|
460
477
|
/** Allow internal sequence for new rows */
|
|
461
478
|
sequence?: boolean;
|
|
462
479
|
/** Load the data into a new spreadsheet from an array of rows or objects */
|
|
463
480
|
data?: Array<Array<any>> | Array<Record<string, any>>;
|
|
464
|
-
/**
|
|
481
|
+
/** Deprecated. Please use the data property. */
|
|
465
482
|
json?: Array<Record<string, any>>;
|
|
466
483
|
/** Array with the rows properties definitions such as title, height. */
|
|
467
484
|
rows?: Row[];
|
|
@@ -469,7 +486,7 @@ declare namespace jspreadsheet {
|
|
|
469
486
|
columns?: Array<Column>;
|
|
470
487
|
/** Define the properties of a cell. This property overwrite the column definitions */
|
|
471
488
|
cells?: Record<string, Column>;
|
|
472
|
-
/** Role of this worksheet
|
|
489
|
+
/** Role of this worksheet */
|
|
473
490
|
role?: string,
|
|
474
491
|
/** Nested headers definition */
|
|
475
492
|
nestedHeaders?: Array<Array<Nested>> | Array<Nested>;
|
|
@@ -549,13 +566,19 @@ declare namespace jspreadsheet {
|
|
|
549
566
|
style?: Record<string, string>;
|
|
550
567
|
/** Freeze columns. Default: 0 */
|
|
551
568
|
freezeColumns?: number;
|
|
569
|
+
/** Freeze rows. Default: 0 */
|
|
570
|
+
freezeRows?: number;
|
|
571
|
+
/** Enable freeze column manual control. Default: false */
|
|
572
|
+
freezeColumnControl: boolean,
|
|
573
|
+
/** Enable freeze row manual control. Default: false */
|
|
574
|
+
freezeRowControl: boolean,
|
|
552
575
|
/** Initial sorting [colNumber, direction]. Default: null */
|
|
553
576
|
orderBy?: [number, boolean];
|
|
554
|
-
/** Worksheet Unique Id.
|
|
577
|
+
/** Worksheet Unique Id. */
|
|
555
578
|
worksheetId?: string;
|
|
556
|
-
/** Worksheet Name.
|
|
579
|
+
/** Worksheet Name. */
|
|
557
580
|
worksheetName?: string;
|
|
558
|
-
/** Worksheet state: hidden | null. Hide a worksheet
|
|
581
|
+
/** Worksheet state: hidden | null. Hide a worksheet */
|
|
559
582
|
worksheetState?: 'hidden' | undefined;
|
|
560
583
|
/** Enable the column filters */
|
|
561
584
|
filters?: boolean;
|
|
@@ -573,6 +596,10 @@ declare namespace jspreadsheet {
|
|
|
573
596
|
selectLockedCells?: boolean;
|
|
574
597
|
/** Enable resizable worksheet in on or both direction (horizontal | vertical | both). Default: none */
|
|
575
598
|
resize?: 'horizontal' | 'vertical' | 'both' | 'none' | undefined;
|
|
599
|
+
/** Wrap. Default: false */
|
|
600
|
+
wrap?: boolean,
|
|
601
|
+
/** Show the worksheet gridlines. Default: true */
|
|
602
|
+
gridline?: boolean,
|
|
576
603
|
}
|
|
577
604
|
|
|
578
605
|
interface spreadsheetInstance {
|
|
@@ -618,9 +645,9 @@ declare namespace jspreadsheet {
|
|
|
618
645
|
ignoreHistory: Boolean;
|
|
619
646
|
/** Ignore persistence events */
|
|
620
647
|
ignorePersistence: Boolean;
|
|
621
|
-
/** HTMLElement editor container
|
|
648
|
+
/** HTMLElement editor container */
|
|
622
649
|
input: HTMLElement;
|
|
623
|
-
/** HTMLElement loading element
|
|
650
|
+
/** HTMLElement loading element */
|
|
624
651
|
loading: HTMLElement;
|
|
625
652
|
/** Rename an existing worksheet by its position */
|
|
626
653
|
renameWorksheet: (position: Number, title: String) => void;
|
|
@@ -704,8 +731,8 @@ declare namespace jspreadsheet {
|
|
|
704
731
|
edition: [];
|
|
705
732
|
/** DOM Worksheet. Alias for worksheet */
|
|
706
733
|
element: HTMLElement;
|
|
707
|
-
/** Internal method: Execute a formula */
|
|
708
|
-
executeFormula: (expression: string, x?: number, y?: number, caching?: boolean) => void;
|
|
734
|
+
/** Internal method: Execute a formula. */
|
|
735
|
+
executeFormula: (expression: string, x?: number, y?: number, caching?: boolean, basic?: boolean) => void;
|
|
709
736
|
/** Navigation first */
|
|
710
737
|
first: (shiftKey?: boolean, ctrlKey?: boolean) => void;
|
|
711
738
|
/** Footers */
|
|
@@ -760,7 +787,7 @@ declare namespace jspreadsheet {
|
|
|
760
787
|
getHeaders: (asArray: boolean) => Array<any>;
|
|
761
788
|
/** Get the height of one row by its position when height is defined. */
|
|
762
789
|
getHeight: (row?: number) => Array<number> | number;
|
|
763
|
-
/** Get the highlighted coordinates
|
|
790
|
+
/** Get the highlighted coordinates */
|
|
764
791
|
getHighlighted: () => Array<any>;
|
|
765
792
|
/** Get json */
|
|
766
793
|
getJson: (h?: boolean, processed?: boolean) => any;
|
|
@@ -810,7 +837,7 @@ declare namespace jspreadsheet {
|
|
|
810
837
|
getValueFromCoords: (x: number, y: number, processed: boolean) => any;
|
|
811
838
|
/** Get the width of one column by index or all column width as an array when index is null. */
|
|
812
839
|
getWidth: (x?: number) => Array<number> | number;
|
|
813
|
-
/** Go to the row number, [col number]
|
|
840
|
+
/** Go to the row number, [col number] */
|
|
814
841
|
goto: (y: number, x?: number) => void;
|
|
815
842
|
/** Hold the header container */
|
|
816
843
|
headerContainer: HTMLElement;
|
|
@@ -867,7 +894,7 @@ declare namespace jspreadsheet {
|
|
|
867
894
|
/** Spreadsheet object */
|
|
868
895
|
parent: spreadsheetInstance;
|
|
869
896
|
/** Paste */
|
|
870
|
-
paste: (x: number, y: number, data: string) => void;
|
|
897
|
+
paste: (x: number, y: number, data: string | any[]) => void;
|
|
871
898
|
/** Get the quantity of pages when pagination is active */
|
|
872
899
|
quantityOfPages?: () => number;
|
|
873
900
|
/** Array with the cell DOM elements */
|
|
@@ -902,6 +929,8 @@ declare namespace jspreadsheet {
|
|
|
902
929
|
results: Array<number>;
|
|
903
930
|
/** Navigation right */
|
|
904
931
|
right: () => void;
|
|
932
|
+
/** Rotate the spreadsheet cell text. cell = A1, B1... etc */
|
|
933
|
+
rotate: (cell: string|string[], value:number) => void;
|
|
905
934
|
/** DOM array of rows */
|
|
906
935
|
rows: Array<HTMLElement>;
|
|
907
936
|
/** Persistence helper method. The callback is executed with a JSON from the server */
|
|
@@ -944,8 +973,8 @@ declare namespace jspreadsheet {
|
|
|
944
973
|
setFooterValue: (col: number, row: number, value: any) => void;
|
|
945
974
|
/** Freeze x number of columns */
|
|
946
975
|
setFreezeColumns: (num: number) => void;
|
|
947
|
-
/** Set the header title */
|
|
948
|
-
setHeader: (x: number, title
|
|
976
|
+
/** Set the header title. Empty or null to reset to the default header value. */
|
|
977
|
+
setHeader: (x: number, title?: String) => void;
|
|
949
978
|
/** Set the height of one row by its position */
|
|
950
979
|
setHeight: (row: number, width: number) => void;
|
|
951
980
|
/** Get the merged cells. Cellname: A1, A2, etc */
|