jspreadsheet 11.18.2 → 11.18.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 +287 -84
- package/dist/index.js +576 -576
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -96,7 +96,6 @@ declare namespace jspreadsheet {
|
|
|
96
96
|
|
|
97
97
|
interface Picker {
|
|
98
98
|
(el: HTMLElement, options: PickerOptions) : void;
|
|
99
|
-
|
|
100
99
|
cancel: () => void;
|
|
101
100
|
click: () => void;
|
|
102
101
|
e: Record<string, any> | null | undefined;
|
|
@@ -114,7 +113,6 @@ declare namespace jspreadsheet {
|
|
|
114
113
|
|
|
115
114
|
interface SetDictionary {
|
|
116
115
|
(dictionary: object) : void;
|
|
117
|
-
|
|
118
116
|
translate: (text: string, substitutions: string[]) => string;
|
|
119
117
|
}
|
|
120
118
|
|
|
@@ -149,21 +147,117 @@ declare namespace jspreadsheet {
|
|
|
149
147
|
reset(resetClipboard?: boolean): void,
|
|
150
148
|
}
|
|
151
149
|
|
|
152
|
-
/**
|
|
153
|
-
interface
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
top?: number
|
|
158
|
-
left?: number
|
|
159
|
-
width?: number
|
|
160
|
-
height?: number
|
|
161
|
-
zIndex?: number
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
/** Common properties for all media types */
|
|
151
|
+
interface MediaBase {
|
|
152
|
+
// GUID string
|
|
153
|
+
id: string;
|
|
154
|
+
type: 'image' | 'chart' | 'shape';
|
|
155
|
+
top?: number;
|
|
156
|
+
left?: number;
|
|
157
|
+
width?: number;
|
|
158
|
+
height?: number;
|
|
159
|
+
zIndex?: number;
|
|
160
|
+
// Cell anchor if applicable
|
|
161
|
+
cellAnchor?: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Options for image media */
|
|
165
|
+
interface MediaImageOptions {
|
|
166
|
+
src: string;
|
|
167
|
+
absolute?: boolean;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Options for chart media (unchanged) */
|
|
171
|
+
interface MediaChartOptions {
|
|
172
|
+
type: 'area' | 'bar' | 'column' | 'doughnut' | 'filledRadar' | 'histogram' | 'line' | 'pareto' |
|
|
173
|
+
'percentArea' | 'percentBar' | 'percentColumn' | 'pie' | 'radar' | 'scatter' |
|
|
174
|
+
'stackedArea' | 'stackedBar' | 'stackedColumn';
|
|
175
|
+
range: string; // e.g., "A1:B10"
|
|
176
|
+
headers?: boolean;
|
|
177
|
+
orientation?: 0 | 1;
|
|
178
|
+
labels?: number;
|
|
179
|
+
datasets?: number[];
|
|
180
|
+
title?: {
|
|
181
|
+
text: string;
|
|
182
|
+
align?: 'left' | 'center' | 'right';
|
|
183
|
+
font?: { size?: number; bold?: boolean };
|
|
184
|
+
};
|
|
185
|
+
subtitle?: {
|
|
186
|
+
text: string;
|
|
187
|
+
align?: 'left' | 'center' | 'right';
|
|
188
|
+
};
|
|
189
|
+
legend?: {
|
|
190
|
+
display?: boolean;
|
|
191
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
192
|
+
align?: 'left' | 'center' | 'right';
|
|
193
|
+
};
|
|
194
|
+
series?: Array<{
|
|
195
|
+
color?: string;
|
|
196
|
+
borderColor?: string;
|
|
197
|
+
yAxis?: 'left' | 'right';
|
|
198
|
+
}>;
|
|
199
|
+
axis?: {
|
|
200
|
+
base?: { title?: { text: string } };
|
|
201
|
+
side?: { title?: { text: string } };
|
|
202
|
+
};
|
|
203
|
+
cutout?: number;
|
|
204
|
+
separation?: {
|
|
205
|
+
type: 'piece-width';
|
|
206
|
+
value: number;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** Options for shape media (updated with your list) */
|
|
211
|
+
interface MediaShapeOptions {
|
|
212
|
+
type: 'simpleLine' | 'lineWithArrow' | 'doubleArrowLine' | 'elbowConnector' | 'elbowArrowConnector' |
|
|
213
|
+
'doubleArrowElbowConnector' | 'curvedElbowConnector' | 'curvedArrowConnector' | 'curvedDoubleArrowConnector' |
|
|
214
|
+
'rectangle' | 'rounded-rectangle' | 'singleCutCornerRectangle' | 'doubleCutCornerRectangle' |
|
|
215
|
+
'oppositeCutCornerRectangle' | 'roundedTopRightRectangle' | 'roundedTopLeftRectangle' |
|
|
216
|
+
'roundedTopRightBottomLeftRectangle' | 'ellipse' | 'triangle' | 'right-triangle' | 'parallelogram' |
|
|
217
|
+
'trapezium' | 'diamond' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'decagon' |
|
|
218
|
+
'ovalInterfaceIcon' | 'cutCircle' | 'circlewithtoprightoutsideangle' | 'doubleLineSquare' |
|
|
219
|
+
'doubledtoprighangle' | 'doubleLineShape' | 'mouldingCrown' | 'crossIcon' | 'plaqueShape' |
|
|
220
|
+
'cylinderShape' | 'cubeShape' | 'bevelShape' | 'donutShape' | 'blockShape' | 'blockArk' |
|
|
221
|
+
'smileyFace' | 'heart' | 'lightningBolt' | 'sun' | 'crescentMoon' | 'cloud' | 'arcCurve' |
|
|
222
|
+
'leftSquareBrackets' | 'rightSquareBrackets' | 'squareBracketsPair' | 'leftFlowerBracket' |
|
|
223
|
+
'rightFlowerBracket' | 'flowerBrackets' | 'rightBlockArrow' | 'leftBlockArrow' | 'upBlockArrow' |
|
|
224
|
+
'downBlockArrow' | 'upDownArrow' | 'leftRightArrow' | 'quadArrow' | 'leftRightUpArrow' |
|
|
225
|
+
'bentArrow' | 'uTurnArrow' | 'leftUpArrow' | 'bentUpArrow' | 'curvedRightArrow' | 'curvedLeftArrow' |
|
|
226
|
+
'curvedUpArrow' | 'curvedDownArrow' | 'stripedRightArrow' | 'notchedRightArrow' | 'pentagonArrow' |
|
|
227
|
+
'chevron' | 'rightArrowCallout' | 'downArrowCallout' | 'leftArrowCallout' | 'upArrowCallout' |
|
|
228
|
+
'leftRightArrowCallout' | 'quadArrowCallout' | 'circularArrow' | 'plus' | 'minus' | 'multiplication' |
|
|
229
|
+
'division' | 'equal' | 'notEqualTo' | 'predefinedTask' | 'internalStorage' | 'document' |
|
|
230
|
+
'multitaskingDocuments' | 'terminator' | 'preparation' | 'manualInput' | 'manualOperation' |
|
|
231
|
+
'offpageConnector' | 'card' | 'punchedTape' | 'swimmingJunction' | 'orShape' | 'collateShape' |
|
|
232
|
+
'sortShape' | 'extractShape' | 'mergeShape' | 'storedDataShape' | 'delayShape' |
|
|
233
|
+
'sequentialAccessStorageShape' | 'directAccessStorage' | 'displayShape';
|
|
234
|
+
backgroundColor?: string;
|
|
235
|
+
borderColor?: string;
|
|
236
|
+
fontColor?: string;
|
|
237
|
+
borderWidth?: number;
|
|
238
|
+
text?: string;
|
|
165
239
|
}
|
|
166
240
|
|
|
241
|
+
/** Discriminated union for Media based on type */
|
|
242
|
+
interface MediaImage extends MediaBase {
|
|
243
|
+
type: 'image';
|
|
244
|
+
src: string;
|
|
245
|
+
options?: MediaImageOptions;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
interface MediaChart extends MediaBase {
|
|
249
|
+
type: 'chart';
|
|
250
|
+
options?: MediaChartOptions;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
interface MediaShape extends MediaBase {
|
|
254
|
+
type: 'shape';
|
|
255
|
+
options?: MediaShapeOptions;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** Unified Media type */
|
|
259
|
+
type Media = MediaImage | MediaChart | MediaShape;
|
|
260
|
+
|
|
167
261
|
/** New column object */
|
|
168
262
|
interface newColumn {
|
|
169
263
|
column?: number,
|
|
@@ -194,7 +288,6 @@ declare namespace jspreadsheet {
|
|
|
194
288
|
/** Global History */
|
|
195
289
|
interface History {
|
|
196
290
|
(changes: Record<string, any>): void;
|
|
197
|
-
|
|
198
291
|
/** History index cursor */
|
|
199
292
|
index: number;
|
|
200
293
|
/** History items */
|
|
@@ -213,7 +306,7 @@ declare namespace jspreadsheet {
|
|
|
213
306
|
reset: () => void;
|
|
214
307
|
}
|
|
215
308
|
|
|
216
|
-
/**
|
|
309
|
+
/** Validation entry */
|
|
217
310
|
interface Validation {
|
|
218
311
|
/** Excel-like range format Sheet1!A1:A6 */
|
|
219
312
|
range: string;
|
|
@@ -252,7 +345,7 @@ declare namespace jspreadsheet {
|
|
|
252
345
|
dropdown: true,
|
|
253
346
|
}
|
|
254
347
|
|
|
255
|
-
/**
|
|
348
|
+
/** Validations update format */
|
|
256
349
|
interface Validations {
|
|
257
350
|
/** Index position in the array of validations */
|
|
258
351
|
index?: number | null;
|
|
@@ -392,6 +485,10 @@ declare namespace jspreadsheet {
|
|
|
392
485
|
items: Array<ToolbarItem>;
|
|
393
486
|
/** Responsive toolbar. Default: true. */
|
|
394
487
|
responsive?: boolean;
|
|
488
|
+
/** maxWidth */
|
|
489
|
+
maxWidth?: number;
|
|
490
|
+
/** Position of the extended hidden options when applicable */
|
|
491
|
+
bottom: boolean
|
|
395
492
|
}
|
|
396
493
|
|
|
397
494
|
interface ToolbarItem {
|
|
@@ -788,7 +885,7 @@ declare namespace jspreadsheet {
|
|
|
788
885
|
/** Remote URL for the persistence server */
|
|
789
886
|
server?: string;
|
|
790
887
|
/** Enable the toolbars */
|
|
791
|
-
toolbar?: boolean | Toolbar | ToolbarItem[] |
|
|
888
|
+
toolbar?: boolean | Toolbar | ToolbarItem[] | ((toolbarOptions: Toolbar) => Toolbar);
|
|
792
889
|
/** Allow table edition */
|
|
793
890
|
editable?: boolean;
|
|
794
891
|
/** Allow data export */
|
|
@@ -1021,7 +1118,7 @@ declare namespace jspreadsheet {
|
|
|
1021
1118
|
/** Validations */
|
|
1022
1119
|
validations?: Validation[];
|
|
1023
1120
|
/** Plugins */
|
|
1024
|
-
plugins?: Record<string,
|
|
1121
|
+
plugins?: Record<string, Plugin>;
|
|
1025
1122
|
/** Global style */
|
|
1026
1123
|
style?: string[];
|
|
1027
1124
|
/** Snap the cells to the grid when scrolling. Default: false */
|
|
@@ -1237,10 +1334,10 @@ declare namespace jspreadsheet {
|
|
|
1237
1334
|
openWorksheet: (position: number, force?: boolean) => void;
|
|
1238
1335
|
/** Create a new worksheet */
|
|
1239
1336
|
createWorksheet: (worksheetOptions: Worksheet, position?: number) => worksheetInstance | false;
|
|
1240
|
-
/** Delete an existing worksheet by its position */
|
|
1241
|
-
deleteWorksheet: (position
|
|
1242
|
-
/** Rename an existing worksheet by its position */
|
|
1243
|
-
renameWorksheet: (position: number, title: string) => false | undefined;
|
|
1337
|
+
/** Delete an existing worksheet by its position. When position is omitted delete based on the call context. */
|
|
1338
|
+
deleteWorksheet: (position?: number) => false | undefined;
|
|
1339
|
+
/** Rename an existing worksheet by its position. When position is omitted rename based on the call context. */
|
|
1340
|
+
renameWorksheet: (position: number | null, title: string) => false | undefined;
|
|
1244
1341
|
/** Move the position of a worksheet. ignoreDomUpdates: true will block updates to the DOM */
|
|
1245
1342
|
moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => false | undefined;
|
|
1246
1343
|
/** Get the active worksheet when applicable */
|
|
@@ -1273,10 +1370,13 @@ declare namespace jspreadsheet {
|
|
|
1273
1370
|
element: HTMLTableCellElement
|
|
1274
1371
|
}
|
|
1275
1372
|
|
|
1276
|
-
type DeleteMediaItem = string | { id: string
|
|
1373
|
+
type DeleteMediaItem = string | { id: string };
|
|
1277
1374
|
|
|
1278
1375
|
type SetValueFirstArgument = string | { x: number, y: number, value: any, force?: boolean }[];
|
|
1279
1376
|
|
|
1377
|
+
/** Maps cell names (e.g., "A1") to colspan and rowspan values (e.g., [3, 2]). */
|
|
1378
|
+
type MergeConfig = Record<string, [number, number]>;
|
|
1379
|
+
|
|
1280
1380
|
interface worksheetInstance {
|
|
1281
1381
|
/** Array with the borders information */
|
|
1282
1382
|
borders: CustomArray<Border>;
|
|
@@ -1327,7 +1427,7 @@ declare namespace jspreadsheet {
|
|
|
1327
1427
|
/** Internal footer controllers */
|
|
1328
1428
|
footers: Record<string, any>;
|
|
1329
1429
|
/** Get the border */
|
|
1330
|
-
getBorder: (alias: string) =>
|
|
1430
|
+
getBorder: (alias: string) => Border;
|
|
1331
1431
|
/** Get the cell element from the cellName or via its coordinates x,y */
|
|
1332
1432
|
getCell(cellName: string): HTMLElement;
|
|
1333
1433
|
getCell(columnNumber: number, y: number): HTMLElement;
|
|
@@ -1349,12 +1449,25 @@ declare namespace jspreadsheet {
|
|
|
1349
1449
|
getComments: (cellName?: string) => string | Comment[] | Record<string, string | Comment[]> | undefined;
|
|
1350
1450
|
/** Get the cached values from one cell or multiple cells. Example: getCache('A1') */
|
|
1351
1451
|
getCache: (cellName?: string) => false | string | object;
|
|
1352
|
-
/** Get the worksheet settings */
|
|
1353
|
-
getConfig: () => Worksheet;
|
|
1354
|
-
/**
|
|
1452
|
+
/** Get the worksheet settings. Default: false */
|
|
1453
|
+
getConfig: (spreadsheetLevel?: boolean) => Worksheet | Spreadsheet;
|
|
1454
|
+
/**
|
|
1455
|
+
* Fetches all or selected worksheet data in array or JSON format.
|
|
1456
|
+
* @intent get-sheet-data, export-data
|
|
1457
|
+
* @param highlighted - If true, returns only highlighted cells; if RangeCoords, specific range; defaults to all data.
|
|
1458
|
+
* @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.
|
|
1459
|
+
* @param delimiter - Delimiter for string output (e.g., "," for CSV-like). Normally used on download operations.
|
|
1460
|
+
* @param asJson - Recommended to be used on data operations, default will always respect the internal format. Defaults to false.
|
|
1461
|
+
* @param includeFilteredRows - If true, includes rows hidden by filters. Defaults to false.
|
|
1462
|
+
* @returns {Array<Array<any>> | Array<Record<string, any>> | string} - Worksheet data in specified format or respecting the internal values
|
|
1463
|
+
* @example
|
|
1464
|
+
* const allData = getData(); // [["1", "2"], ["3", "4"]]
|
|
1465
|
+
* const jsonData = getData(false, true, ",", true); // [{ "A": "1", "B": "2" }, ...]
|
|
1466
|
+
* const selectedData = getData([0, 0, 1, 1]); // [["1", "2"], ["3", "4"]]
|
|
1467
|
+
*/
|
|
1355
1468
|
getData: (highlighted?: boolean | RangeCoords, processed?: boolean, delimiter?: string, asJson?: boolean, includeFilteredRows?: boolean) => Array<Array<any>> | Array<Record<string, any>> | string;
|
|
1356
1469
|
/** Get the worksheet data from a range */
|
|
1357
|
-
getDataFromRange: (range: string, processed?: boolean) => Array<Array<any>> | Array<Record<string, any
|
|
1470
|
+
getDataFromRange: (range: string, processed?: boolean) => Array<Array<any>> | Array<Record<string, any>>;
|
|
1358
1471
|
/** Get the defined name or all defined names when key is null */
|
|
1359
1472
|
getDefinedNames: (key?: string) => any;
|
|
1360
1473
|
/** Internal method: Get the editor for one cell */
|
|
@@ -1382,7 +1495,7 @@ declare namespace jspreadsheet {
|
|
|
1382
1495
|
/** Get the merged cells. Cell name: A1, A2, etc or null for all cells */
|
|
1383
1496
|
getMerge: (cellName?: string) => [number, number] | Record<string, [number, number]> | undefined;
|
|
1384
1497
|
/** Get one or all meta information for one cell. */
|
|
1385
|
-
getMeta: (cellName: string
|
|
1498
|
+
getMeta: (cellName: string) => object | undefined;
|
|
1386
1499
|
/** Get the nested cells */
|
|
1387
1500
|
getNestedCell: (x: number, y: number) => HTMLTableCellElement;
|
|
1388
1501
|
/** Get the nested headers */
|
|
@@ -1419,7 +1532,16 @@ declare namespace jspreadsheet {
|
|
|
1419
1532
|
/** Get the selected rows indexes. */
|
|
1420
1533
|
getSelectedRows: (visibleOnly?: boolean) => number[];
|
|
1421
1534
|
|
|
1422
|
-
/**
|
|
1535
|
+
/**
|
|
1536
|
+
* Retrieves CSS styles for a cell or all cells.
|
|
1537
|
+
* @intent get-cell-style, read-formatting
|
|
1538
|
+
* @param cellName - Cell name (e.g., "A1"); if omitted, returns all styles.
|
|
1539
|
+
* @param onlyIndexes - If true, returns style indices instead of full styles.
|
|
1540
|
+
* @returns {string | number | Record<string, string> | Record<string, number> | undefined} - Style value, index, or object of styles.
|
|
1541
|
+
* @example
|
|
1542
|
+
* getStyle("A1"); // "background-color: red"
|
|
1543
|
+
* getStyle(); // { "A1": "background-color: red", "B2": "font-weight: bold" }
|
|
1544
|
+
*/
|
|
1423
1545
|
getStyle: (cellName?: string | null, onlyIndexes?: boolean) => string | number | Record<string, string> | Record<string, number> | undefined;
|
|
1424
1546
|
/** Get the style index from a cell or all cells */
|
|
1425
1547
|
getStyleIndexes: (cellName?: string | null) => number | Record<string, number> | undefined;
|
|
@@ -1431,9 +1553,9 @@ declare namespace jspreadsheet {
|
|
|
1431
1553
|
/** Get value by the coordinates. The value can be the source or processed value, including not formatted proceed data. */
|
|
1432
1554
|
getValueFromCoords: (x: number, y: number, processed?: boolean, raw?: boolean) => any;
|
|
1433
1555
|
/** Get the width of one column by index or all column width as an array when index is null. */
|
|
1434
|
-
getWidth: (
|
|
1556
|
+
getWidth: (column?: number) => Array<number> | number;
|
|
1435
1557
|
/** Go to the row number, [col number] */
|
|
1436
|
-
goto: (
|
|
1558
|
+
goto: (row?: number | null, column?: number | null) => void;
|
|
1437
1559
|
/** Hold the header container */
|
|
1438
1560
|
headerContainer: HTMLElement;
|
|
1439
1561
|
/** Hide column */
|
|
@@ -1451,20 +1573,23 @@ declare namespace jspreadsheet {
|
|
|
1451
1573
|
* @param column - number of columns or array with column information
|
|
1452
1574
|
* @param columnNumber - reference when the first argument is a number
|
|
1453
1575
|
* @param insertBefore - insertBefore when the first argument is a number
|
|
1454
|
-
* @param properties - column properties
|
|
1455
|
-
* @param data
|
|
1456
|
-
* @param createSelection
|
|
1457
1576
|
*/
|
|
1458
|
-
insertColumn
|
|
1577
|
+
insertColumn(column?: number, columnNumber?: number, insertBefore?: boolean) : false | undefined;
|
|
1578
|
+
/** Add new columns in a batch */
|
|
1579
|
+
insertColumn(columns: newColumn[]) : false | undefined;
|
|
1459
1580
|
/**
|
|
1460
|
-
*
|
|
1461
|
-
* @
|
|
1462
|
-
* @param
|
|
1463
|
-
* @param
|
|
1464
|
-
* @param
|
|
1465
|
-
* @
|
|
1581
|
+
* Inserts one or more rows at a specified position.
|
|
1582
|
+
* @intent add-rows, insert-row
|
|
1583
|
+
* @param row - Number of rows to add or array of row data/options.
|
|
1584
|
+
* @param rowNumber - Insert position (zero-based), optional if `row` is array.
|
|
1585
|
+
* @param insertBefore - If true, inserts before `rowNumber`; if false, after. Defaults to false.
|
|
1586
|
+
* @returns {false | undefined} - False if invalid, undefined on success.
|
|
1587
|
+
* @example
|
|
1588
|
+
* insertRow(1, 0, true); // Add 1 row before row 0
|
|
1589
|
+
* insertRow([{ row: 0, data: ["a", "b"] }]); // Insert row with data
|
|
1466
1590
|
*/
|
|
1467
|
-
insertRow
|
|
1591
|
+
insertRow(row?: number | newRow[], rowNumber?: number, insertBefore?: boolean) : false | undefined;
|
|
1592
|
+
insertRow(rows: newRow[]) : false | undefined;
|
|
1468
1593
|
/** Check if cell is attached to the DOM */
|
|
1469
1594
|
isAttached: (x: number, y: number) => boolean;
|
|
1470
1595
|
/** The worksheet is editable */
|
|
@@ -1502,11 +1627,11 @@ declare namespace jspreadsheet {
|
|
|
1502
1627
|
orderBy: (column: number, direction?: boolean, internalValueController?: number[], internalPreviousStateController?: any) => void;
|
|
1503
1628
|
/** Change page when using pagination */
|
|
1504
1629
|
page: (pageNumber: number | null, callBack?: Function) => false | undefined;
|
|
1505
|
-
|
|
1630
|
+
/** Move the scroll page down */
|
|
1506
1631
|
pageDown: () => void;
|
|
1507
1632
|
/** Current page number */
|
|
1508
1633
|
pageNumber: number;
|
|
1509
|
-
|
|
1634
|
+
/** Move the scroll page up */
|
|
1510
1635
|
pageUp: () => void;
|
|
1511
1636
|
/** Pagination DOM container */
|
|
1512
1637
|
pagination: HTMLElement;
|
|
@@ -1514,7 +1639,7 @@ declare namespace jspreadsheet {
|
|
|
1514
1639
|
parent: spreadsheetInstance;
|
|
1515
1640
|
/** Paste */
|
|
1516
1641
|
paste: (x: number, y: number, data: string | any[], selections?: boolean) => false | undefined;
|
|
1517
|
-
|
|
1642
|
+
/** Call the print extension when applicable */
|
|
1518
1643
|
print: () => void;
|
|
1519
1644
|
/** Get the quantity of pages when pagination is active */
|
|
1520
1645
|
quantityOfPages?: () => number | false;
|
|
@@ -1526,8 +1651,14 @@ declare namespace jspreadsheet {
|
|
|
1526
1651
|
refreshFooter: () => void;
|
|
1527
1652
|
/** Remove the merged cells by the cell name or a object with all cells to be removed. */
|
|
1528
1653
|
removeMerge: (cellName: string | Record<string, any>) => false | undefined;
|
|
1529
|
-
/**
|
|
1530
|
-
|
|
1654
|
+
/**
|
|
1655
|
+
* Removes borders by alias or all borders.
|
|
1656
|
+
* @intent remove-borders, clear-highlighting
|
|
1657
|
+
* @param border - Border identifier to remove (optional, null for all).
|
|
1658
|
+
* @param permanent - If true, removes permanently; if false, temporary.
|
|
1659
|
+
* @returns {boolean | undefined} - True if successful, false if no border found.
|
|
1660
|
+
*/
|
|
1661
|
+
resetBorders: (border?: string, permanent?: boolean) => void;
|
|
1531
1662
|
/** Reset the filter of one or all columns */
|
|
1532
1663
|
resetFilters: (colNumber?: number, destroy?: boolean) => void;
|
|
1533
1664
|
/** Destroy the footers */
|
|
@@ -1567,21 +1698,41 @@ declare namespace jspreadsheet {
|
|
|
1567
1698
|
currentSelection: RangeCoords | null;
|
|
1568
1699
|
/** Internal record id sequence */
|
|
1569
1700
|
sequence: number;
|
|
1570
|
-
/**
|
|
1571
|
-
|
|
1701
|
+
/**
|
|
1702
|
+
* Adds a colored border to a cell range with a unique identifier.
|
|
1703
|
+
* @intent highlight-cells, create-border
|
|
1704
|
+
* @param x1 - Starting column index (0 or positive).
|
|
1705
|
+
* @param y1 - Starting row index (0 or positive).
|
|
1706
|
+
* @param x2 - Ending column index (≥ x1).
|
|
1707
|
+
* @param y2 - Ending row index (≥ y1).
|
|
1708
|
+
* @param border - Unique border identifier.
|
|
1709
|
+
* @param color - Hex color code (e.g., "#FF0000"), defaults to random if omitted.
|
|
1710
|
+
* @example
|
|
1711
|
+
* setBorder(0, 1, 3, 5, "highlight1", "#FF0000"); // Red border A2:D6
|
|
1712
|
+
*/
|
|
1713
|
+
setBorder: (x1: number, y1: number, x2: number, y2: number, border: string, color?: string) => void;
|
|
1572
1714
|
/** Set attributes for one cell */
|
|
1573
1715
|
setCells(cellName: Record<string, Cell>): false | undefined;
|
|
1574
1716
|
setCells(cellName: string, settings: Cell): false | undefined;
|
|
1575
1717
|
/** Set the column data from its number */
|
|
1576
1718
|
setColumnData: (col: number, data: any[], force?: boolean) => void;
|
|
1577
|
-
/**
|
|
1578
|
-
|
|
1579
|
-
|
|
1719
|
+
/**
|
|
1720
|
+
* Adds or updates comments for one or more cells.
|
|
1721
|
+
* @intent add-comment, set-note
|
|
1722
|
+
* @param cells - Cell name (e.g., "A1") or object mapping cells to comments.
|
|
1723
|
+
* @param comments - Comment text or object (required if `cells` is string).
|
|
1724
|
+
* @returns {false | undefined} - False if read-only, undefined on success.
|
|
1725
|
+
* @example
|
|
1726
|
+
* setComments("A1", "Check this"); // Comment on A1
|
|
1727
|
+
* setComments({ "A1": "Note 1", "B2": { comments: "Note 2", user_id: 1 } }); // Batch comments
|
|
1728
|
+
*/
|
|
1729
|
+
setComments(cells: string, comments: string|Comment): false | undefined;
|
|
1730
|
+
setComments(cells: Record<string, string|Comment>): false | undefined;
|
|
1580
1731
|
/** Set the cache for one or multiple cells */
|
|
1581
1732
|
setCache(cellName: Record<string, any>): false | undefined;
|
|
1582
1733
|
setCache(cellName: string, values?: any): false | undefined;
|
|
1583
1734
|
/** Change the worksheet settings */
|
|
1584
|
-
setConfig
|
|
1735
|
+
setConfig(config: Worksheet | Spreadsheet, spreadsheetLevel?: boolean) : void;
|
|
1585
1736
|
/** Set the worksheet data */
|
|
1586
1737
|
setData: (data: any[]) => void;
|
|
1587
1738
|
/** Create or update names */
|
|
@@ -1596,25 +1747,38 @@ declare namespace jspreadsheet {
|
|
|
1596
1747
|
setFooterValue: (col: number, row: number, value: any) => void;
|
|
1597
1748
|
/** List of columns to freeze. Should be a number or an array of consecutive numbers. Example: [4,5,6] */
|
|
1598
1749
|
setFreezeColumns: (num?: number | number[] | null) => void;
|
|
1599
|
-
/**
|
|
1600
|
-
|
|
1750
|
+
/**
|
|
1751
|
+
* Sets or resets a column header title.
|
|
1752
|
+
* @intent set-column-title, rename-header
|
|
1753
|
+
* @param colNumber - Column index (zero-based).
|
|
1754
|
+
* @param title - New header title; if empty or null, resets to default (e.g., "A").
|
|
1755
|
+
* @returns {false | undefined} - False if read-only, undefined on success.
|
|
1756
|
+
* @example
|
|
1757
|
+
* setHeader(0, "Name"); // Set column A to "Name"
|
|
1758
|
+
* setHeader(1, ""); // Reset column B to "B"
|
|
1759
|
+
*/
|
|
1760
|
+
setHeader: (colNumber: number, title?: string) => false | undefined;
|
|
1601
1761
|
/** Set the height of one row by its position. currentHeight is for internal use only */
|
|
1602
1762
|
setHeight: (row: number|number[], height: number|number[], currentHeight?: number|number[]) => void;
|
|
1603
|
-
/**
|
|
1604
|
-
|
|
1763
|
+
/**
|
|
1764
|
+
* Merges cell ranges based on a configuration or single cell specification.
|
|
1765
|
+
* @intent merge-cells, combine-cells
|
|
1766
|
+
* @param cellName - Cell name (e.g., "A1") or merge config (e.g., { "A1": [3, 2] }).
|
|
1767
|
+
* @param colspan - Columns to span (required if `cellName` is string).
|
|
1768
|
+
* @param rowspan - Rows to span (required if `cellName` is string).
|
|
1769
|
+
* @returns {false | undefined} - False if invalid or overlapping, undefined on success.
|
|
1770
|
+
* @example
|
|
1771
|
+
* setMerge("A1", 3, 2); // Merge A1:C2
|
|
1772
|
+
* setMerge({ "A1": [3, 2], "D4": [2, 4] }); // Merge A1:C2 and D4:E7
|
|
1773
|
+
*/
|
|
1605
1774
|
setMerge(cellName: string, colspan: number, rowspan: number): false | undefined;
|
|
1606
|
-
setMerge(): false | undefined;
|
|
1775
|
+
setMerge(cells: MergeConfig): false | undefined;
|
|
1607
1776
|
/** Get one or various meta information for one cell. */
|
|
1608
1777
|
setMeta: (cell: string | Record<string, any>, property?: string, value?: string) => false | undefined;
|
|
1609
1778
|
/** Set the nested headers */
|
|
1610
1779
|
setNestedHeaders: (config: Nested[][]) => void;
|
|
1611
1780
|
/** Deprecated. Alias for parent.setPlugins */
|
|
1612
|
-
setPlugins: (plugins: Record<string,
|
|
1613
|
-
/** Alias for setProperty */
|
|
1614
|
-
setProperties(columnNumber: number, rowNumber: number, cellSettings?: Cell): boolean;
|
|
1615
|
-
setProperties(columnNumber: number, columnSettings: Column): boolean;
|
|
1616
|
-
setProperties(changes: ({ x: number, value: Column } | { x: number, y: number, value: Cell })[]): boolean;
|
|
1617
|
-
setProperties(changes: Record<string, Cell>): boolean;
|
|
1781
|
+
setPlugins: (plugins: Record<string, Plugin>) => void;
|
|
1618
1782
|
/** Add a new configuration settings for a column or cell */
|
|
1619
1783
|
setProperty(columnNumber: number, rowNumber: number, cellSettings?: Cell): boolean;
|
|
1620
1784
|
setProperty(columnNumber: number, columnSettings: Column): boolean;
|
|
@@ -1627,18 +1791,42 @@ declare namespace jspreadsheet {
|
|
|
1627
1791
|
setReadOnly: (cellName: string|HTMLElement, state: boolean) => void;
|
|
1628
1792
|
/** Set the data from one row */
|
|
1629
1793
|
setRowData: (row: number, data: any[], force?: boolean) => void;
|
|
1630
|
-
/**
|
|
1794
|
+
/**
|
|
1795
|
+
* Assigns custom IDs to one or more rows for tracking or syncing.
|
|
1796
|
+
* @intent update-row-ids, set-row-identifiers
|
|
1797
|
+
* @param row - Row index or object mapping indices to IDs (e.g., { 0: 1000 }).
|
|
1798
|
+
* @param newId - New ID for a single row (required if `row` is a number).
|
|
1799
|
+
* @example
|
|
1800
|
+
* setRowId(0, 1000); // Set row 0 to ID 1000
|
|
1801
|
+
* setRowId({ 0: 1000, 1: 1001 }); // Batch update
|
|
1802
|
+
*/
|
|
1631
1803
|
setRowId(row: Record<number, number>): void;
|
|
1632
1804
|
setRowId(row: number, newId: number): void;
|
|
1633
|
-
/**
|
|
1805
|
+
/**
|
|
1806
|
+
* Applies CSS styles to one or more cells.
|
|
1807
|
+
* @intent format-cells, set-style
|
|
1808
|
+
* @param cell - Cell name (e.g., "A1"), array of cells, or style object (e.g., { "A1": "color: red" }).
|
|
1809
|
+
* @param property - CSS property (e.g., "background-color"), required if `cell` is not an object.
|
|
1810
|
+
* @param value - CSS value (e.g., "red"), optional if `cell` is an object.
|
|
1811
|
+
* @param forceOverwrite - If true, applies even to locked cells. Defaults to false.
|
|
1812
|
+
* @returns {false | undefined} - False if invalid, undefined on success.
|
|
1813
|
+
* @example
|
|
1814
|
+
* setStyle("A1", "background-color", "red"); // Red background for A1
|
|
1815
|
+
* setStyle({ "A1": "color: blue", "B2": "font-weight: bold" }); // Batch styling
|
|
1816
|
+
*/
|
|
1634
1817
|
setStyle(cell: string | string[] | { x: number, y: number }[], property: string, value?: string, forceOverwrite?: boolean): false | undefined;
|
|
1635
1818
|
setStyle(cell: Record<string, string>, property?: undefined, value?: undefined, forceOverwrite?: boolean): false | undefined;
|
|
1636
1819
|
/**
|
|
1637
|
-
*
|
|
1638
|
-
*
|
|
1639
|
-
* @param cell
|
|
1640
|
-
* @param value
|
|
1641
|
-
* @param
|
|
1820
|
+
* Writes a value to a cell or range, optionally forcing over read-only cells.
|
|
1821
|
+
* @intent set-cell-value, write-data
|
|
1822
|
+
* @param cell - Cell identifier (e.g., "A1") or array of coordinate-value objects (e.g., [{ x: 0, y: 0, value: "test" }]).
|
|
1823
|
+
* @param value - Value to set (required if `cell` is a string).
|
|
1824
|
+
* @param forceOverwrite - If true, writes even to read-only cells. Defaults to false.
|
|
1825
|
+
* @param origin - Source of change (e.g., "user", "script"). Optional.
|
|
1826
|
+
* @returns {false | undefined} - False if operation fails (e.g., invalid cell), undefined on success.
|
|
1827
|
+
* @example
|
|
1828
|
+
* setValue("A1", "Hello"); // Set A1 to "Hello"
|
|
1829
|
+
* setValue([{ x: 0, y: 0, value: "Test" }, { x: 1, y: 1, value: 42 }]); // Batch update
|
|
1642
1830
|
*/
|
|
1643
1831
|
setValue: (cell: SetValueFirstArgument, value?: any, forceOverwrite?: boolean, origin?: string) => false | undefined;
|
|
1644
1832
|
/**
|
|
@@ -1651,7 +1839,7 @@ declare namespace jspreadsheet {
|
|
|
1651
1839
|
*/
|
|
1652
1840
|
setValueFromCoords: (x: number, y: number, value: any, force?: boolean) => void;
|
|
1653
1841
|
/** Set viewport width and height */
|
|
1654
|
-
setViewport: (width
|
|
1842
|
+
setViewport: (width?: number, height?: number) => void;
|
|
1655
1843
|
/** Set the width of one column by its position */
|
|
1656
1844
|
setWidth: (col: number | number[], width: number | number[], oldWidth?: number | number[]) => void;
|
|
1657
1845
|
/** Show column */
|
|
@@ -1686,7 +1874,7 @@ declare namespace jspreadsheet {
|
|
|
1686
1874
|
/** Internal method: update cells in a batch */
|
|
1687
1875
|
updateCells: (o: Record<string, any>[]) => void;
|
|
1688
1876
|
/** Update the selection based on coordinates */
|
|
1689
|
-
updateSelectionFromCoords: (x1: number
|
|
1877
|
+
updateSelectionFromCoords: (x1: number, y1: number, x2?: number, y2?: number, origin?: boolean, type?: string, color?: string) => void;
|
|
1690
1878
|
/** Getter/setter the value by coordinates */
|
|
1691
1879
|
value?: (x: number | string, y: number, value?: any, removeProperty?: boolean) => any;
|
|
1692
1880
|
/** Current page or which page the row number is */
|
|
@@ -1748,18 +1936,19 @@ declare namespace jspreadsheet {
|
|
|
1748
1936
|
properties: Nested
|
|
1749
1937
|
}[]
|
|
1750
1938
|
): false | undefined;
|
|
1751
|
-
/** Get a validation object.
|
|
1939
|
+
/** Get a validation object. */
|
|
1752
1940
|
getValidations: (validationIndex?: number) => Validation | Validation[] | undefined;
|
|
1753
|
-
/** Insert or update existing validations by index.
|
|
1941
|
+
/** Insert or update existing validations by index. */
|
|
1754
1942
|
setValidations: (validations: Validations | Validations[]) => false | undefined;
|
|
1755
|
-
/** Reset validations by validation indexes.
|
|
1943
|
+
/** Reset validations by validation indexes. Undefined will remove all validations */
|
|
1756
1944
|
resetValidations: (validationIndex?: number | number[]) => false | undefined;
|
|
1757
1945
|
/** Load all validations rules from a cell based on its coordinates. */
|
|
1758
1946
|
loadValidations(xOrCell: Records, y?: undefined, includeIndexes?: boolean): Validation[] | { index: number, rules: Validation }[] | undefined;
|
|
1759
1947
|
loadValidations(xOrCell: number, y: number, includeIndexes?: boolean): Validation[] | { index: number, rules: Validation }[] | undefined;
|
|
1760
1948
|
/** 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. */
|
|
1949
|
+
hasErrors(): boolean;
|
|
1761
1950
|
hasErrors(col: string): boolean;
|
|
1762
|
-
hasErrors(col
|
|
1951
|
+
hasErrors(col: number, row: number): boolean;
|
|
1763
1952
|
/** Resize columns to match the visible content */
|
|
1764
1953
|
autoWidth: (columns: number[]) => void;
|
|
1765
1954
|
/** Show the column headers */
|
|
@@ -1799,12 +1988,26 @@ declare namespace jspreadsheet {
|
|
|
1799
1988
|
hideToolbar: () => void;
|
|
1800
1989
|
/** Refresh the toolbar based on the current worksheet */
|
|
1801
1990
|
refreshToolbar: (worksheet?: worksheetInstance) => void;
|
|
1802
|
-
/**
|
|
1803
|
-
|
|
1991
|
+
/**
|
|
1992
|
+
* Adds or updates media elements (charts, images, shapes) in the worksheet.
|
|
1993
|
+
* @intent add-charts, insert-images, create-shapes
|
|
1994
|
+
* @param items - Array of media objects to add or update (e.g., charts, images).
|
|
1995
|
+
* @returns {false | undefined} - False if invalid, undefined on success.
|
|
1996
|
+
* @example
|
|
1997
|
+
* setMedia([{ id: "random-guid", type: "chart", top: 50, options: { type: "bar", range: "A1:B10" } }]);
|
|
1998
|
+
* setMedia([{ id: "random-guid", type: "image", src: "logo.png", top: 10, left: 10 }]);
|
|
1999
|
+
*/
|
|
2000
|
+
setMedia: (items: Media[]) => false | undefined;
|
|
1804
2001
|
/** Get a media element position or object by guid. */
|
|
1805
2002
|
getMedia: (guid: string, position?: boolean) => number | Media | null;
|
|
1806
|
-
/**
|
|
1807
|
-
|
|
2003
|
+
/**
|
|
2004
|
+
* Deletes media elements by their GUIDs.
|
|
2005
|
+
* @intent delete-media, remove-chart
|
|
2006
|
+
* @param items - Array of GUIDs or objects with id to delete.
|
|
2007
|
+
* @example
|
|
2008
|
+
* deleteMedia(["chart1", { id: "img1" }]);
|
|
2009
|
+
*/
|
|
2010
|
+
deleteMedia: (items: DeleteMediaItem[]) => false | undefined;
|
|
1808
2011
|
/** Add a global formula to the tracking system. Use from formula pro. Only use if necessary. */
|
|
1809
2012
|
setTracking: () => void;
|
|
1810
2013
|
/** Set a worksheet zoom value > 0 and <= 1. */
|