sheetnext 0.2.0 → 0.2.2
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/README.md +18 -15
- package/README_CN.md +17 -15
- package/dist/sheetnext.css +1 -1
- package/dist/sheetnext.es.js +3 -3
- package/dist/sheetnext.locale.zh-CN.es.js +3 -3
- package/dist/sheetnext.locale.zh-CN.umd.js +3 -3
- package/dist/sheetnext.umd.js +3 -3
- package/docs/ai-relay.md +284 -0
- package/docs/core-api.md +2980 -0
- package/docs/enums.md +171 -0
- package/docs/events.md +331 -0
- package/docs/json-format.md +426 -0
- package/package.json +2 -2
- package/docs/docs-detail.md +0 -2998
package/docs/core-api.md
ADDED
|
@@ -0,0 +1,2980 @@
|
|
|
1
|
+
# Core API
|
|
2
|
+
|
|
3
|
+
> Generated: 2026-03-17
|
|
4
|
+
|
|
5
|
+
Public callable classes detected for the generated API surface.
|
|
6
|
+
|
|
7
|
+
## SheetNext
|
|
8
|
+
|
|
9
|
+
### Constructor
|
|
10
|
+
- Create workbook instance.
|
|
11
|
+
|
|
12
|
+
**Parameters**
|
|
13
|
+
| Name | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| dom | HTMLElement | Yes | - | Editor container element. |
|
|
16
|
+
| options | SheetNextInitOptions | No | {} | Initialization options. |
|
|
17
|
+
| options.licenseKey | string | No | - | License key. |
|
|
18
|
+
| options.locale | string | No | 'en-US' | Initial locale (e.g. 'en-US', 'zh-CN'). |
|
|
19
|
+
| options.locales | Object<string, Object> | No | - | Extra locale packs keyed by locale code. |
|
|
20
|
+
| options.menuRight | function | No | - | Callback `(defaultHTML: string) => string`. Receives the default right-menu HTML, return modified HTML. |
|
|
21
|
+
| options.menuList | function | No | - | Callback `(config: Array<{key: string, labelKey: string, groups: Array, contextual?: boolean}>) => Array`. Receives the default toolbar panel config array, return modified array. |
|
|
22
|
+
| options.AI_URL | string | No | - | AI relay endpoint URL. |
|
|
23
|
+
| options.AI_TOKEN | string | No | - | Optional bearer token for AI relay endpoint. |
|
|
24
|
+
|
|
25
|
+
**Examples**
|
|
26
|
+
```js
|
|
27
|
+
import SheetNext from 'sheetnext';
|
|
28
|
+
import 'sheetnext.css';
|
|
29
|
+
|
|
30
|
+
const container = document.querySelector('#SNContainer');
|
|
31
|
+
const SN = new SheetNext(container);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Props
|
|
35
|
+
| Name | Type | Static | Default | Description |
|
|
36
|
+
| --- | --- | --- | --- | --- |
|
|
37
|
+
| containerDom | HTMLElement | No | dom | - |
|
|
38
|
+
| namespace | string | No | this._setupGlobalNamespace() | - |
|
|
39
|
+
| calcMode | 'auto' \| 'manual' | No | 'auto' | - |
|
|
40
|
+
| sheets | Sheet[] | No | [] | - |
|
|
41
|
+
| properties | Object | No | {} | - |
|
|
42
|
+
| Event | EventEmitter | No | new EventEmitter() | - |
|
|
43
|
+
| Utils | Utils | No | new Utils(this) | - |
|
|
44
|
+
| I18n | I18n | No | this._createI18n(options) | - |
|
|
45
|
+
| Print | Print | No | new Print(this) | - |
|
|
46
|
+
| Layout | Layout | No | new Layout(this, options) | - |
|
|
47
|
+
| AI | AI | No | new AI(this, options, this.#license) | - |
|
|
48
|
+
| IO | IO | No | new IO(this, this.#license) | - |
|
|
49
|
+
| Formula | Formula | No | new Formula(this) | - |
|
|
50
|
+
| UndoRedo | UndoRedo | No | new UndoRedo(this) | - |
|
|
51
|
+
| Canvas | Canvas | No | new Canvas(this, this.#license) | - |
|
|
52
|
+
|
|
53
|
+
### Get/Set
|
|
54
|
+
| Name | Type | Mode | Static | Description |
|
|
55
|
+
| --- | --- | --- | --- | --- |
|
|
56
|
+
| activeSheet | Sheet | get/set | No | - |
|
|
57
|
+
| workbookName | string | get/set | No | - |
|
|
58
|
+
| readOnly | boolean | get/set | No | - |
|
|
59
|
+
|
|
60
|
+
### Get
|
|
61
|
+
| Name | Type | Static | Description |
|
|
62
|
+
| --- | --- | --- | --- |
|
|
63
|
+
| locale | string | No | - |
|
|
64
|
+
|
|
65
|
+
### Methods
|
|
66
|
+
#### `static registerLocale(locale, messages): typeof SheetNext`
|
|
67
|
+
|
|
68
|
+
**Parameters**
|
|
69
|
+
| Name | Type | Required | Default | Description |
|
|
70
|
+
| --- | --- | --- | --- | --- |
|
|
71
|
+
| locale | string | Yes | - | - |
|
|
72
|
+
| messages | Object | Yes | - | - |
|
|
73
|
+
|
|
74
|
+
**Returns**
|
|
75
|
+
- Type: `typeof SheetNext`
|
|
76
|
+
|
|
77
|
+
**Examples**
|
|
78
|
+
```js
|
|
79
|
+
import SheetNext from 'sheetnext';
|
|
80
|
+
import zhCN from 'sheetnext/locales/zh-CN.js';
|
|
81
|
+
|
|
82
|
+
SheetNext.registerLocale('zh-CN', zhCN);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### `static getLocale(locale): Object | undefined`
|
|
86
|
+
|
|
87
|
+
**Parameters**
|
|
88
|
+
| Name | Type | Required | Default | Description |
|
|
89
|
+
| --- | --- | --- | --- | --- |
|
|
90
|
+
| locale | string | Yes | - | - |
|
|
91
|
+
|
|
92
|
+
**Returns**
|
|
93
|
+
- Type: `Object | undefined`
|
|
94
|
+
|
|
95
|
+
#### `addSheet(sheetName?): Sheet | null`
|
|
96
|
+
|
|
97
|
+
**Parameters**
|
|
98
|
+
| Name | Type | Required | Default | Description |
|
|
99
|
+
| --- | --- | --- | --- | --- |
|
|
100
|
+
| sheetName | string | No | - | - |
|
|
101
|
+
|
|
102
|
+
**Returns**
|
|
103
|
+
- Type: `Sheet | null`
|
|
104
|
+
|
|
105
|
+
**Examples**
|
|
106
|
+
```js
|
|
107
|
+
const budgetSheet = SN.addSheet('Budget 2026');
|
|
108
|
+
|
|
109
|
+
budgetSheet.getCell('A1').value = 'Month';
|
|
110
|
+
budgetSheet.getCell('B1').value = 'Amount';
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### `delSheet(name)`
|
|
114
|
+
|
|
115
|
+
**Parameters**
|
|
116
|
+
| Name | Type | Required | Default | Description |
|
|
117
|
+
| --- | --- | --- | --- | --- |
|
|
118
|
+
| name | string | Yes | - | - |
|
|
119
|
+
|
|
120
|
+
#### `getSheet(sheetName): Sheet | null`
|
|
121
|
+
|
|
122
|
+
**Parameters**
|
|
123
|
+
| Name | Type | Required | Default | Description |
|
|
124
|
+
| --- | --- | --- | --- | --- |
|
|
125
|
+
| sheetName | string | Yes | - | - |
|
|
126
|
+
|
|
127
|
+
**Returns**
|
|
128
|
+
- Type: `Sheet | null`
|
|
129
|
+
|
|
130
|
+
**Examples**
|
|
131
|
+
```js
|
|
132
|
+
const sheet = SN.getSheet('Budget 2026');
|
|
133
|
+
if (sheet) {
|
|
134
|
+
sheet.getCell('B2').value = 128000;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### `recalculate(currentSheetOnly = false)`
|
|
139
|
+
|
|
140
|
+
**Parameters**
|
|
141
|
+
| Name | Type | Required | Default | Description |
|
|
142
|
+
| --- | --- | --- | --- | --- |
|
|
143
|
+
| currentSheetOnly | boolean | No | false | - |
|
|
144
|
+
|
|
145
|
+
**Examples**
|
|
146
|
+
```js
|
|
147
|
+
SN.recalculate();
|
|
148
|
+
SN.recalculate(true);
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### `setLocale(locale)`
|
|
152
|
+
|
|
153
|
+
**Parameters**
|
|
154
|
+
| Name | Type | Required | Default | Description |
|
|
155
|
+
| --- | --- | --- | --- | --- |
|
|
156
|
+
| locale | string | Yes | - | - |
|
|
157
|
+
|
|
158
|
+
**Examples**
|
|
159
|
+
```js
|
|
160
|
+
SN.setLocale('zh-CN');
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### `t(key, params = {}): string`
|
|
164
|
+
|
|
165
|
+
**Parameters**
|
|
166
|
+
| Name | Type | Required | Default | Description |
|
|
167
|
+
| --- | --- | --- | --- | --- |
|
|
168
|
+
| key | string | Yes | - | - |
|
|
169
|
+
| params | Record<string, any> | No | {} | - |
|
|
170
|
+
|
|
171
|
+
**Returns**
|
|
172
|
+
- Type: `string`
|
|
173
|
+
|
|
174
|
+
## Sheet
|
|
175
|
+
|
|
176
|
+
### Props
|
|
177
|
+
| Name | Type | Static | Default | Description |
|
|
178
|
+
| --- | --- | --- | --- | --- |
|
|
179
|
+
| SN | Workbook | No | SN | - |
|
|
180
|
+
| rId | string | No | meta['_$r:id'] | - |
|
|
181
|
+
| Utils | Utils | No | SN.Utils | - |
|
|
182
|
+
| Canvas | Canvas | No | SN.Canvas | - |
|
|
183
|
+
| merges | RangeNum[] | No | [] | - |
|
|
184
|
+
| vi | Object | No | null | - |
|
|
185
|
+
| views | Object[] | No | [{ pane: {} }] | - |
|
|
186
|
+
| rows | Row[] | No | [] | - |
|
|
187
|
+
| cols | Col[] | No | [] | - |
|
|
188
|
+
| initialized | boolean | No | false | - |
|
|
189
|
+
| showGridLines | boolean | No | true | - |
|
|
190
|
+
| showRowColHeaders | boolean | No | true | - |
|
|
191
|
+
| showPageBreaks | boolean | No | false | - |
|
|
192
|
+
| outlinePr | Object | No | { | - |
|
|
193
|
+
| printSettings | Object | No | null | - |
|
|
194
|
+
| protection | Object | No | new SheetProtection(this) | - |
|
|
195
|
+
| Comment | Comment | No | new Comment(this) | - |
|
|
196
|
+
| AutoFilter | AutoFilter | No | new AutoFilter(this) | - |
|
|
197
|
+
| Table | Table | No | new Table(this) | - |
|
|
198
|
+
| Drawing | null | No | null | - |
|
|
199
|
+
| Sparkline | null | No | null | - |
|
|
200
|
+
| CF | null | No | null | - |
|
|
201
|
+
| Slicer | null | No | null | - |
|
|
202
|
+
| PivotTable | null | No | null | - |
|
|
203
|
+
|
|
204
|
+
### Get/Set
|
|
205
|
+
| Name | Type | Mode | Static | Description |
|
|
206
|
+
| --- | --- | --- | --- | --- |
|
|
207
|
+
| activeCell | CellNum | get/set | No | - |
|
|
208
|
+
| activeAreas | RangeNum[] | get/set | No | - |
|
|
209
|
+
| zoom | number | get/set | No | - |
|
|
210
|
+
| viewStart | CellNum | get/set | No | - |
|
|
211
|
+
| defaultColWidth | number | get/set | No | - |
|
|
212
|
+
| defaultRowHeight | number | get/set | No | - |
|
|
213
|
+
| indexWidth | number | get/set | No | - |
|
|
214
|
+
| headHeight | number | get/set | No | - |
|
|
215
|
+
| frozenCols | number | get/set | No | - |
|
|
216
|
+
| frozenRows | number | get/set | No | - |
|
|
217
|
+
| hidden | boolean | get/set | No | - |
|
|
218
|
+
| name | string | get/set | No | - |
|
|
219
|
+
|
|
220
|
+
### Get
|
|
221
|
+
| Name | Type | Static | Description |
|
|
222
|
+
| --- | --- | --- | --- |
|
|
223
|
+
| rowCount | number | No | - |
|
|
224
|
+
| colCount | number | No | - |
|
|
225
|
+
|
|
226
|
+
### Methods
|
|
227
|
+
#### `zoomIn(step = 0.1): number`
|
|
228
|
+
|
|
229
|
+
**Parameters**
|
|
230
|
+
| Name | Type | Required | Default | Description |
|
|
231
|
+
| --- | --- | --- | --- | --- |
|
|
232
|
+
| step | number | No | 0.1 | - |
|
|
233
|
+
|
|
234
|
+
**Returns**
|
|
235
|
+
- Type: `number`
|
|
236
|
+
|
|
237
|
+
#### `zoomOut(step = 0.1): number`
|
|
238
|
+
|
|
239
|
+
**Parameters**
|
|
240
|
+
| Name | Type | Required | Default | Description |
|
|
241
|
+
| --- | --- | --- | --- | --- |
|
|
242
|
+
| step | number | No | 0.1 | - |
|
|
243
|
+
|
|
244
|
+
**Returns**
|
|
245
|
+
- Type: `number`
|
|
246
|
+
|
|
247
|
+
#### `zoomToSelection(): number`
|
|
248
|
+
|
|
249
|
+
**Returns**
|
|
250
|
+
- Type: `number`
|
|
251
|
+
- Zoom to fit the selected area.
|
|
252
|
+
|
|
253
|
+
#### `rangeStrToNum(range): RangeNum`
|
|
254
|
+
|
|
255
|
+
**Parameters**
|
|
256
|
+
| Name | Type | Required | Default | Description |
|
|
257
|
+
| --- | --- | --- | --- | --- |
|
|
258
|
+
| range | RangeStr | Yes | - | - |
|
|
259
|
+
|
|
260
|
+
**Returns**
|
|
261
|
+
- Type: `RangeNum`
|
|
262
|
+
|
|
263
|
+
**Examples**
|
|
264
|
+
```js
|
|
265
|
+
const sheet = SN.activeSheet;
|
|
266
|
+
const range = sheet.rangeStrToNum('A1:C3');
|
|
267
|
+
|
|
268
|
+
console.log(range.s, range.e);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### `getRow(r): Row`
|
|
272
|
+
|
|
273
|
+
**Parameters**
|
|
274
|
+
| Name | Type | Required | Default | Description |
|
|
275
|
+
| --- | --- | --- | --- | --- |
|
|
276
|
+
| r | number | Yes | - | - |
|
|
277
|
+
|
|
278
|
+
**Returns**
|
|
279
|
+
- Type: `Row`
|
|
280
|
+
|
|
281
|
+
**Examples**
|
|
282
|
+
```js
|
|
283
|
+
const row = SN.activeSheet.getRow(0);
|
|
284
|
+
row.height = 32;
|
|
285
|
+
row.hidden = false;
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
#### `getCol(c): Col`
|
|
289
|
+
|
|
290
|
+
**Parameters**
|
|
291
|
+
| Name | Type | Required | Default | Description |
|
|
292
|
+
| --- | --- | --- | --- | --- |
|
|
293
|
+
| c | number | Yes | - | - |
|
|
294
|
+
|
|
295
|
+
**Returns**
|
|
296
|
+
- Type: `Col`
|
|
297
|
+
|
|
298
|
+
**Examples**
|
|
299
|
+
```js
|
|
300
|
+
const col = SN.activeSheet.getCol(1);
|
|
301
|
+
col.width = 120;
|
|
302
|
+
col.hidden = false;
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### `getCell(r, c?): Cell`
|
|
306
|
+
|
|
307
|
+
**Parameters**
|
|
308
|
+
| Name | Type | Required | Default | Description |
|
|
309
|
+
| --- | --- | --- | --- | --- |
|
|
310
|
+
| r | number \| string | Yes | - | - |
|
|
311
|
+
| c | number | No | - | - |
|
|
312
|
+
|
|
313
|
+
**Returns**
|
|
314
|
+
- Type: `Cell`
|
|
315
|
+
|
|
316
|
+
**Examples**
|
|
317
|
+
```js
|
|
318
|
+
const totalCell = SN.activeSheet.getCell('B2');
|
|
319
|
+
|
|
320
|
+
totalCell.value = 2560;
|
|
321
|
+
totalCell.numFmt = '#,##0.00';
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
#### `eachCells(ranges, callback, options = {})`
|
|
325
|
+
|
|
326
|
+
**Parameters**
|
|
327
|
+
| Name | Type | Required | Default | Description |
|
|
328
|
+
| --- | --- | --- | --- | --- |
|
|
329
|
+
| ranges | RangeRef \| RangeRef[] | Yes | - | - |
|
|
330
|
+
| callback | (r:number,c:number,area:RangeNum)=>void | Yes | - | - |
|
|
331
|
+
| options | {reverse?:boolean,sparse?:boolean} | No | {} | - |
|
|
332
|
+
|
|
333
|
+
**Examples**
|
|
334
|
+
```js
|
|
335
|
+
SN.activeSheet.eachCells('A1:C3', (r, c) => {
|
|
336
|
+
const cell = SN.activeSheet.getCell(r, c);
|
|
337
|
+
cell.fill = { fgColor: { rgb: 'FFF4CC' } };
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
#### `setBrush(keep = false)`
|
|
342
|
+
|
|
343
|
+
**Parameters**
|
|
344
|
+
| Name | Type | Required | Default | Description |
|
|
345
|
+
| --- | --- | --- | --- | --- |
|
|
346
|
+
| keep | boolean | No | false | - |
|
|
347
|
+
|
|
348
|
+
#### `cancelBrush(): boolean`
|
|
349
|
+
|
|
350
|
+
**Returns**
|
|
351
|
+
- Type: `boolean`
|
|
352
|
+
|
|
353
|
+
#### `applyBrush(targetArea): boolean`
|
|
354
|
+
|
|
355
|
+
**Parameters**
|
|
356
|
+
| Name | Type | Required | Default | Description |
|
|
357
|
+
| --- | --- | --- | --- | --- |
|
|
358
|
+
| targetArea | RangeNum | Yes | - | - |
|
|
359
|
+
|
|
360
|
+
**Returns**
|
|
361
|
+
- Type: `boolean`
|
|
362
|
+
|
|
363
|
+
#### `moveArea(moveArea, targetArea): boolean`
|
|
364
|
+
|
|
365
|
+
**Parameters**
|
|
366
|
+
| Name | Type | Required | Default | Description |
|
|
367
|
+
| --- | --- | --- | --- | --- |
|
|
368
|
+
| moveArea | Object \| string | Yes | - | - |
|
|
369
|
+
| targetArea | Object \| string | Yes | - | - |
|
|
370
|
+
|
|
371
|
+
**Returns**
|
|
372
|
+
- Type: `boolean`
|
|
373
|
+
|
|
374
|
+
#### `paddingArea(oArea = this.Canvas.lastPadding.oArea, targetArea = this.Canvas.lastPadding.targetArea, type = 'order')`
|
|
375
|
+
|
|
376
|
+
**Parameters**
|
|
377
|
+
| Name | Type | Required | Default | Description |
|
|
378
|
+
| --- | --- | --- | --- | --- |
|
|
379
|
+
| oArea | Object \| string | No | this.Canvas.lastPadding.oArea | - |
|
|
380
|
+
| targetArea | Object \| string | No | this.Canvas.lastPadding.targetArea | - |
|
|
381
|
+
| type | string | No | 'order' | Fill area with series/copy/format. |
|
|
382
|
+
|
|
383
|
+
#### `showAllHidRows()`
|
|
384
|
+
|
|
385
|
+
#### `showAllHidCols()`
|
|
386
|
+
|
|
387
|
+
#### `areasBorder(position, options, area = this.activeAreas)`
|
|
388
|
+
|
|
389
|
+
**Parameters**
|
|
390
|
+
| Name | Type | Required | Default | Description |
|
|
391
|
+
| --- | --- | --- | --- | --- |
|
|
392
|
+
| position | string | Yes | - | - |
|
|
393
|
+
| options | Object \| null | Yes | - | - |
|
|
394
|
+
| area | Array | No | this.activeAreas | - |
|
|
395
|
+
|
|
396
|
+
#### `hyperlinkJump()`
|
|
397
|
+
- Jump to hyperlink target of active cell.
|
|
398
|
+
|
|
399
|
+
#### `rangeSort(sortKeys, range?)`
|
|
400
|
+
- Category: `Sort`
|
|
401
|
+
|
|
402
|
+
**Parameters**
|
|
403
|
+
| Name | Type | Required | Default | Description |
|
|
404
|
+
| --- | --- | --- | --- | --- |
|
|
405
|
+
| sortKeys | Array<{col:string \| number, order?:string, customOrder?:Array}> | Yes | - | - |
|
|
406
|
+
| range | RangeRef | No | - | - |
|
|
407
|
+
|
|
408
|
+
**Examples**
|
|
409
|
+
```js
|
|
410
|
+
const sheet = SN.activeSheet;
|
|
411
|
+
|
|
412
|
+
sheet.rangeSort([
|
|
413
|
+
{ col: 'A', order: 'asc' }
|
|
414
|
+
], `A2:D${sheet.rowCount}`);
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### `flashFill(range, options = {})`
|
|
418
|
+
- Category: `FlashFill`
|
|
419
|
+
|
|
420
|
+
**Parameters**
|
|
421
|
+
| Name | Type | Required | Default | Description |
|
|
422
|
+
| --- | --- | --- | --- | --- |
|
|
423
|
+
| range | string \| Object | Yes | - | - |
|
|
424
|
+
| options | Object | No | {} | - |
|
|
425
|
+
|
|
426
|
+
#### `textToColumns(range, options = {})`
|
|
427
|
+
- Category: `TextToColumns`
|
|
428
|
+
|
|
429
|
+
**Parameters**
|
|
430
|
+
| Name | Type | Required | Default | Description |
|
|
431
|
+
| --- | --- | --- | --- | --- |
|
|
432
|
+
| range | string \| Object | Yes | - | - |
|
|
433
|
+
| options | Object | No | {} | - |
|
|
434
|
+
|
|
435
|
+
#### `groupRows(range, options = {})`
|
|
436
|
+
- Category: `Outline`
|
|
437
|
+
|
|
438
|
+
**Parameters**
|
|
439
|
+
| Name | Type | Required | Default | Description |
|
|
440
|
+
| --- | --- | --- | --- | --- |
|
|
441
|
+
| range | string \| Object | Yes | - | - |
|
|
442
|
+
| options | Object | No | {} | - |
|
|
443
|
+
|
|
444
|
+
#### `ungroupRows(range, options = {})`
|
|
445
|
+
- Category: `Outline`
|
|
446
|
+
|
|
447
|
+
**Parameters**
|
|
448
|
+
| Name | Type | Required | Default | Description |
|
|
449
|
+
| --- | --- | --- | --- | --- |
|
|
450
|
+
| range | string \| Object | Yes | - | - |
|
|
451
|
+
| options | Object | No | {} | - |
|
|
452
|
+
|
|
453
|
+
#### `groupCols(range, options = {})`
|
|
454
|
+
- Category: `Outline`
|
|
455
|
+
|
|
456
|
+
**Parameters**
|
|
457
|
+
| Name | Type | Required | Default | Description |
|
|
458
|
+
| --- | --- | --- | --- | --- |
|
|
459
|
+
| range | string \| Object | Yes | - | - |
|
|
460
|
+
| options | Object | No | {} | - |
|
|
461
|
+
|
|
462
|
+
#### `ungroupCols(range, options = {})`
|
|
463
|
+
- Category: `Outline`
|
|
464
|
+
|
|
465
|
+
**Parameters**
|
|
466
|
+
| Name | Type | Required | Default | Description |
|
|
467
|
+
| --- | --- | --- | --- | --- |
|
|
468
|
+
| range | string \| Object | Yes | - | - |
|
|
469
|
+
| options | Object | No | {} | - |
|
|
470
|
+
|
|
471
|
+
#### `subtotal(range, options = {})`
|
|
472
|
+
- Category: `Subtotal`
|
|
473
|
+
|
|
474
|
+
**Parameters**
|
|
475
|
+
| Name | Type | Required | Default | Description |
|
|
476
|
+
| --- | --- | --- | --- | --- |
|
|
477
|
+
| range | string \| Object | Yes | - | - |
|
|
478
|
+
| options | Object | No | {} | - |
|
|
479
|
+
|
|
480
|
+
#### `consolidate(ranges, options = {})`
|
|
481
|
+
- Category: `Consolidate`
|
|
482
|
+
|
|
483
|
+
**Parameters**
|
|
484
|
+
| Name | Type | Required | Default | Description |
|
|
485
|
+
| --- | --- | --- | --- | --- |
|
|
486
|
+
| ranges | Array<string \| Object> \| Object | Yes | - | - |
|
|
487
|
+
| options | Object | No | {} | - |
|
|
488
|
+
|
|
489
|
+
#### `setDataValidation(range, rule)`
|
|
490
|
+
- Category: `DataValidation`
|
|
491
|
+
|
|
492
|
+
**Parameters**
|
|
493
|
+
| Name | Type | Required | Default | Description |
|
|
494
|
+
| --- | --- | --- | --- | --- |
|
|
495
|
+
| range | string \| Object \| Array<string \| Object> | Yes | - | - |
|
|
496
|
+
| rule | Object | Yes | - | - |
|
|
497
|
+
|
|
498
|
+
#### `clearDataValidation(range)`
|
|
499
|
+
- Category: `DataValidation`
|
|
500
|
+
|
|
501
|
+
**Parameters**
|
|
502
|
+
| Name | Type | Required | Default | Description |
|
|
503
|
+
| --- | --- | --- | --- | --- |
|
|
504
|
+
| range | string \| Object \| Array<string \| Object> | Yes | - | - |
|
|
505
|
+
|
|
506
|
+
#### `insertTable(arr, pos, options = {}, ops?): RangeNum`
|
|
507
|
+
- Insert a table from the given position
|
|
508
|
+
- Category: `InsertTable`
|
|
509
|
+
|
|
510
|
+
**Parameters**
|
|
511
|
+
| Name | Type | Required | Default | Description |
|
|
512
|
+
| --- | --- | --- | --- | --- |
|
|
513
|
+
| arr | (ICellConfig \| string \| number)[][] | Yes | - | Table data array |
|
|
514
|
+
| pos | CellRef | Yes | - | Insert Location |
|
|
515
|
+
| options | Object | No | {} | Configure Options |
|
|
516
|
+
| ops | {align?:string,border?:boolean,width?:number,height?:number} | No | - | - |
|
|
517
|
+
|
|
518
|
+
**Returns**
|
|
519
|
+
- Type: `RangeNum`
|
|
520
|
+
|
|
521
|
+
**Examples**
|
|
522
|
+
```js
|
|
523
|
+
const sheet = SN.activeSheet;
|
|
524
|
+
|
|
525
|
+
/*
|
|
526
|
+
ICellConfig summary:
|
|
527
|
+
- v: cell value
|
|
528
|
+
- w: column width in px, usually set on the first row
|
|
529
|
+
- h: row height in px, usually set on the first column
|
|
530
|
+
- b: bold
|
|
531
|
+
- s: font size
|
|
532
|
+
- fg: background color
|
|
533
|
+
- a: text align, one of 'left' | 'right' | 'center'
|
|
534
|
+
- c: text color
|
|
535
|
+
- mr: merge cells to the right
|
|
536
|
+
- mb: merge cells downward
|
|
537
|
+
|
|
538
|
+
For mr or mb merges, keep the 2D array rectangular with "" placeholders.
|
|
539
|
+
Example: { mr: 2 }, "", ""
|
|
540
|
+
*/
|
|
541
|
+
const meetingTemplate = [
|
|
542
|
+
[{ v: 'Meeting Minutes', s: 16, mr: 3, fg: '#eee', h: 45, b: true }, { w: 160 }, '', { w: 160 }],
|
|
543
|
+
['Time', '', 'Location', ''],
|
|
544
|
+
['Host', '', 'Recorder', ''],
|
|
545
|
+
['Expected', '', 'Present', ''],
|
|
546
|
+
['Absent Members', { mr: 2 }, '', ''],
|
|
547
|
+
['Topic', { mr: 2 }, '', ''],
|
|
548
|
+
[{ v: 'Content', h: 280 }, { mr: 2 }, '', ''],
|
|
549
|
+
[{ v: 'Remarks', h: 80 }, { mr: 2 }, '', '']
|
|
550
|
+
];
|
|
551
|
+
|
|
552
|
+
sheet.insertTable(meetingTemplate, 'A1', {
|
|
553
|
+
border: true,
|
|
554
|
+
align: 'center',
|
|
555
|
+
height: 30,
|
|
556
|
+
width: 100
|
|
557
|
+
});
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
#### `areaHaveMerge(area): boolean`
|
|
561
|
+
- Tests whether merged cells exist in the range
|
|
562
|
+
- Category: `Merge`
|
|
563
|
+
|
|
564
|
+
**Parameters**
|
|
565
|
+
| Name | Type | Required | Default | Description |
|
|
566
|
+
| --- | --- | --- | --- | --- |
|
|
567
|
+
| area | Object | Yes | - | Area Object |
|
|
568
|
+
|
|
569
|
+
**Returns**
|
|
570
|
+
- Type: `boolean`
|
|
571
|
+
- Whether merged cells exist
|
|
572
|
+
|
|
573
|
+
#### `unMergeCells(cellAd = null, cell)`
|
|
574
|
+
- Unmerger, transfer to cell address or area, default take active Areas
|
|
575
|
+
- Category: `Merge`
|
|
576
|
+
|
|
577
|
+
**Parameters**
|
|
578
|
+
| Name | Type | Required | Default | Description |
|
|
579
|
+
| --- | --- | --- | --- | --- |
|
|
580
|
+
| cellAd | Object \| String \| null | No | null | Cell address or area |
|
|
581
|
+
| cell | CellRef | Yes | - | - |
|
|
582
|
+
|
|
583
|
+
#### `mergeCells(areas = null, mode = 'default', range)`
|
|
584
|
+
- Merge Cells to Support Multiple Modes
|
|
585
|
+
- Category: `Merge`
|
|
586
|
+
|
|
587
|
+
**Parameters**
|
|
588
|
+
| Name | Type | Required | Default | Description |
|
|
589
|
+
| --- | --- | --- | --- | --- |
|
|
590
|
+
| areas | Array \| Object \| String \| null | No | null | Section, default action Areas |
|
|
591
|
+
| mode | String | No | 'default' | Mode: 'default' \|center' \|content'same' |
|
|
592
|
+
| range | RangeRef | Yes | - | - |
|
|
593
|
+
|
|
594
|
+
#### `addRows(r, number = 1, index, count)`
|
|
595
|
+
- Insert Row
|
|
596
|
+
- Category: `RowColHandler`
|
|
597
|
+
|
|
598
|
+
**Parameters**
|
|
599
|
+
| Name | Type | Required | Default | Description |
|
|
600
|
+
| --- | --- | --- | --- | --- |
|
|
601
|
+
| r | Number | Yes | - | Row Index to Insert Location |
|
|
602
|
+
| number | Number | No | 1 | Number of rows inserted |
|
|
603
|
+
| index | number | Yes | - | - |
|
|
604
|
+
| count | number | Yes | - | - |
|
|
605
|
+
|
|
606
|
+
#### `addCols(c, number = 1, index, count)`
|
|
607
|
+
- Insert Columns
|
|
608
|
+
- Category: `RowColHandler`
|
|
609
|
+
|
|
610
|
+
**Parameters**
|
|
611
|
+
| Name | Type | Required | Default | Description |
|
|
612
|
+
| --- | --- | --- | --- | --- |
|
|
613
|
+
| c | Number | Yes | - | Index of columns for inserting positions |
|
|
614
|
+
| number | Number | No | 1 | Number of columns inserted |
|
|
615
|
+
| index | number | Yes | - | - |
|
|
616
|
+
| count | number | Yes | - | - |
|
|
617
|
+
|
|
618
|
+
#### `delRows(r, number = 1, start, count)`
|
|
619
|
+
- Delete Row
|
|
620
|
+
- Category: `RowColHandler`
|
|
621
|
+
|
|
622
|
+
**Parameters**
|
|
623
|
+
| Name | Type | Required | Default | Description |
|
|
624
|
+
| --- | --- | --- | --- | --- |
|
|
625
|
+
| r | Number | Yes | - | Remove Row Index at Start Location |
|
|
626
|
+
| number | Number | No | 1 | Number of rows deleted |
|
|
627
|
+
| start | number | Yes | - | - |
|
|
628
|
+
| count | number | Yes | - | - |
|
|
629
|
+
|
|
630
|
+
#### `delCols(c, number = 1, start, count)`
|
|
631
|
+
- Delete Column
|
|
632
|
+
- Category: `RowColHandler`
|
|
633
|
+
|
|
634
|
+
**Parameters**
|
|
635
|
+
| Name | Type | Required | Default | Description |
|
|
636
|
+
| --- | --- | --- | --- | --- |
|
|
637
|
+
| c | Number | Yes | - | Delete column index for starting position |
|
|
638
|
+
| number | Number | No | 1 | NUMBER OF ROWS REMOVED |
|
|
639
|
+
| start | number | Yes | - | - |
|
|
640
|
+
| count | number | Yes | - | - |
|
|
641
|
+
|
|
642
|
+
#### `getCellInViewInfo(rowIndex, colIndex, posMerge = true, r, c): Object`
|
|
643
|
+
- Fetch cell information in visible view
|
|
644
|
+
- Category: `ViewCalculator`
|
|
645
|
+
|
|
646
|
+
**Parameters**
|
|
647
|
+
| Name | Type | Required | Default | Description |
|
|
648
|
+
| --- | --- | --- | --- | --- |
|
|
649
|
+
| rowIndex | Number | Yes | - | Row index |
|
|
650
|
+
| colIndex | Number | Yes | - | Column Index |
|
|
651
|
+
| posMerge | Boolean | No | true | Whether to process merging cells |
|
|
652
|
+
| r | number | Yes | - | - |
|
|
653
|
+
| c | number | Yes | - | - |
|
|
654
|
+
|
|
655
|
+
**Returns**
|
|
656
|
+
- Type: `Object`
|
|
657
|
+
- Objects with location and size information
|
|
658
|
+
|
|
659
|
+
#### `getAreaInviewInfo(area): Object`
|
|
660
|
+
- Fetch area information in visible view
|
|
661
|
+
- Category: `ViewCalculator`
|
|
662
|
+
|
|
663
|
+
**Parameters**
|
|
664
|
+
| Name | Type | Required | Default | Description |
|
|
665
|
+
| --- | --- | --- | --- | --- |
|
|
666
|
+
| area | Object | Yes | - | Area Object |
|
|
667
|
+
|
|
668
|
+
**Returns**
|
|
669
|
+
- Type: `Object`
|
|
670
|
+
- Objects with location and size information
|
|
671
|
+
|
|
672
|
+
#### `getTotalHeight(): number`
|
|
673
|
+
- Retrieving the total height of all rows (cache optimization)
|
|
674
|
+
- Category: `ViewCalculator`
|
|
675
|
+
|
|
676
|
+
**Returns**
|
|
677
|
+
- Type: `number`
|
|
678
|
+
- Total Height
|
|
679
|
+
|
|
680
|
+
#### `getTotalWidth(): number`
|
|
681
|
+
- Get the total width of all columns (cache optimization)
|
|
682
|
+
- Category: `ViewCalculator`
|
|
683
|
+
|
|
684
|
+
**Returns**
|
|
685
|
+
- Type: `number`
|
|
686
|
+
- Total width
|
|
687
|
+
|
|
688
|
+
#### `getScrollTop(rowIndex): number`
|
|
689
|
+
- Get the sum of heights for all lines before the specified line
|
|
690
|
+
- Category: `ViewCalculator`
|
|
691
|
+
|
|
692
|
+
**Parameters**
|
|
693
|
+
| Name | Type | Required | Default | Description |
|
|
694
|
+
| --- | --- | --- | --- | --- |
|
|
695
|
+
| rowIndex | number | Yes | - | Row index |
|
|
696
|
+
|
|
697
|
+
**Returns**
|
|
698
|
+
- Type: `number`
|
|
699
|
+
- High Sum
|
|
700
|
+
|
|
701
|
+
#### `getScrollLeft(colIndex): number`
|
|
702
|
+
- Sum of widths of all columns before the specified column
|
|
703
|
+
- Category: `ViewCalculator`
|
|
704
|
+
|
|
705
|
+
**Parameters**
|
|
706
|
+
| Name | Type | Required | Default | Description |
|
|
707
|
+
| --- | --- | --- | --- | --- |
|
|
708
|
+
| colIndex | number | Yes | - | Column Index |
|
|
709
|
+
|
|
710
|
+
**Returns**
|
|
711
|
+
- Type: `number`
|
|
712
|
+
- Sum of width
|
|
713
|
+
|
|
714
|
+
#### `getRowIndexByScrollTop(scrollTop): number`
|
|
715
|
+
- Find line index from vertical scroll pixel position
|
|
716
|
+
- Category: `ViewCalculator`
|
|
717
|
+
|
|
718
|
+
**Parameters**
|
|
719
|
+
| Name | Type | Required | Default | Description |
|
|
720
|
+
| --- | --- | --- | --- | --- |
|
|
721
|
+
| scrollTop | number | Yes | - | Scroll Pixels Position |
|
|
722
|
+
|
|
723
|
+
**Returns**
|
|
724
|
+
- Type: `number`
|
|
725
|
+
- Line Index
|
|
726
|
+
|
|
727
|
+
#### `getColIndexByScrollLeft(scrollLeft): number`
|
|
728
|
+
- Find the corresponding column index from the horizontal scroll pixel position
|
|
729
|
+
- Category: `ViewCalculator`
|
|
730
|
+
|
|
731
|
+
**Parameters**
|
|
732
|
+
| Name | Type | Required | Default | Description |
|
|
733
|
+
| --- | --- | --- | --- | --- |
|
|
734
|
+
| scrollLeft | number | Yes | - | Scroll Pixels Position |
|
|
735
|
+
|
|
736
|
+
**Returns**
|
|
737
|
+
- Type: `number`
|
|
738
|
+
- Column Index
|
|
739
|
+
|
|
740
|
+
#### `copy(area = null, isCut = false, areas?)`
|
|
741
|
+
- Copy Regional Data
|
|
742
|
+
- Category: `Clipboard`
|
|
743
|
+
|
|
744
|
+
**Parameters**
|
|
745
|
+
| Name | Type | Required | Default | Description |
|
|
746
|
+
| --- | --- | --- | --- | --- |
|
|
747
|
+
| area | Object | No | null | Copy area {s: {r, c}, e: {r, c} |
|
|
748
|
+
| isCut | boolean | No | false | Whether to cut |
|
|
749
|
+
| areas | Array | No | - | - |
|
|
750
|
+
|
|
751
|
+
#### `cut(area = null, areas?)`
|
|
752
|
+
- Cut Area Data
|
|
753
|
+
- Category: `Clipboard`
|
|
754
|
+
|
|
755
|
+
**Parameters**
|
|
756
|
+
| Name | Type | Required | Default | Description |
|
|
757
|
+
| --- | --- | --- | --- | --- |
|
|
758
|
+
| area | Object | No | null | Cut Area |
|
|
759
|
+
| areas | Array | No | - | - |
|
|
760
|
+
|
|
761
|
+
#### `paste(targetArea = null, options = {})`
|
|
762
|
+
- Paste Data to Target Area
|
|
763
|
+
- Category: `Clipboard`
|
|
764
|
+
|
|
765
|
+
**Parameters**
|
|
766
|
+
| Name | Type | Required | Default | Description |
|
|
767
|
+
| --- | --- | --- | --- | --- |
|
|
768
|
+
| targetArea | Object | No | null | Target area start location {r, c} or full area |
|
|
769
|
+
| options | Object | No | {} | Paste Options |
|
|
770
|
+
| options.mode | string | Yes | - | PasteMode |
|
|
771
|
+
| options.operation | string | Yes | - | Operation |
|
|
772
|
+
| options.skipBlanks | boolean | Yes | - | Skip empty cells |
|
|
773
|
+
| options.transpose | boolean | Yes | - | Convert |
|
|
774
|
+
| options.externalData | Object | Yes | - | External Clipboard Data (from System Clipboard) |
|
|
775
|
+
|
|
776
|
+
#### `clearClipboard()`
|
|
777
|
+
- Clear Clipboard
|
|
778
|
+
- Category: `Clipboard`
|
|
779
|
+
|
|
780
|
+
#### `getClipboardData(): Object`
|
|
781
|
+
- Fetch the current clipboard data
|
|
782
|
+
- Category: `Clipboard`
|
|
783
|
+
|
|
784
|
+
**Returns**
|
|
785
|
+
- Type: `Object`
|
|
786
|
+
|
|
787
|
+
#### `hasClipboardData(): boolean`
|
|
788
|
+
- Check for clipboard data
|
|
789
|
+
- Category: `Clipboard`
|
|
790
|
+
|
|
791
|
+
**Returns**
|
|
792
|
+
- Type: `boolean`
|
|
793
|
+
|
|
794
|
+
## Row
|
|
795
|
+
- Row Objects
|
|
796
|
+
|
|
797
|
+
### Props
|
|
798
|
+
| Name | Type | Static | Default | Description |
|
|
799
|
+
| --- | --- | --- | --- | --- |
|
|
800
|
+
| sheet | Sheet | No | sheet | Sheet it belongs to |
|
|
801
|
+
| rIndex | number | No | rIndex | Row index |
|
|
802
|
+
| cells | Array<Cell> | No | [] | Line cell arrays |
|
|
803
|
+
|
|
804
|
+
### Get/Set
|
|
805
|
+
| Name | Type | Mode | Static | Description |
|
|
806
|
+
| --- | --- | --- | --- | --- |
|
|
807
|
+
| height | number | get/set | No | Row height (pixels) |
|
|
808
|
+
| hidden | boolean | get/set | No | Whether to hide |
|
|
809
|
+
| outlineLevel | number | get/set | No | Outline Level (0-7) |
|
|
810
|
+
| collapsed | boolean | get/set | No | Outline Collapse Marker |
|
|
811
|
+
| style | Object | get/set | No | Row Styles |
|
|
812
|
+
| font | Object | get/set | No | Font style |
|
|
813
|
+
| fill | Object | get/set | No | Fill Style |
|
|
814
|
+
| alignment | Object | get/set | No | Alignment Style |
|
|
815
|
+
| border | Object | get/set | No | Border Style |
|
|
816
|
+
| numFmt | string \| undefined | get/set | No | Number Format |
|
|
817
|
+
|
|
818
|
+
### Methods
|
|
819
|
+
#### `init(): void`
|
|
820
|
+
- Initialise cell in line
|
|
821
|
+
|
|
822
|
+
## Col
|
|
823
|
+
- Column object
|
|
824
|
+
|
|
825
|
+
### Props
|
|
826
|
+
| Name | Type | Static | Default | Description |
|
|
827
|
+
| --- | --- | --- | --- | --- |
|
|
828
|
+
| sheet | Sheet | No | sheet | Sheet it belongs to |
|
|
829
|
+
| cIndex | number | No | cIndex | Column Index |
|
|
830
|
+
|
|
831
|
+
### Get/Set
|
|
832
|
+
| Name | Type | Mode | Static | Description |
|
|
833
|
+
| --- | --- | --- | --- | --- |
|
|
834
|
+
| width | number | get/set | No | Column Width (px) |
|
|
835
|
+
| hidden | boolean | get/set | No | Whether to hide |
|
|
836
|
+
| outlineLevel | number | get/set | No | Outline Level (0-7) |
|
|
837
|
+
| collapsed | boolean | get/set | No | Outline Collapse Marker |
|
|
838
|
+
| style | Object | get/set | No | Column Styles |
|
|
839
|
+
| font | Object | get/set | No | Font style |
|
|
840
|
+
| fill | Object | get/set | No | Fill Style |
|
|
841
|
+
| alignment | Object | get/set | No | Alignment Style |
|
|
842
|
+
| border | Object | get/set | No | Border Style |
|
|
843
|
+
| numFmt | string \| undefined | get/set | No | Number Format |
|
|
844
|
+
|
|
845
|
+
### Get
|
|
846
|
+
| Name | Type | Static | Description |
|
|
847
|
+
| --- | --- | --- | --- |
|
|
848
|
+
| cells | Array<Cell> | No | Get all cells in a column |
|
|
849
|
+
|
|
850
|
+
## Cell
|
|
851
|
+
- Cell classes
|
|
852
|
+
|
|
853
|
+
### Props
|
|
854
|
+
| Name | Type | Static | Default | Description |
|
|
855
|
+
| --- | --- | --- | --- | --- |
|
|
856
|
+
| cIndex | number | No | cIndex | Column Index |
|
|
857
|
+
| row | Row | No | row | Rows belonging to |
|
|
858
|
+
| isMerged | boolean | No | false | Whether or not to merge cells |
|
|
859
|
+
| master | {r:number, c:number} \| null | No | null | Merge Cell Main Cell References |
|
|
860
|
+
|
|
861
|
+
### Get/Set
|
|
862
|
+
| Name | Type | Mode | Static | Description |
|
|
863
|
+
| --- | --- | --- | --- | --- |
|
|
864
|
+
| editVal | string | get/set | No | Edit value or formula |
|
|
865
|
+
| richText | Array \| null | get/set | No | Rich text runs array |
|
|
866
|
+
| hyperlink | Object \| null | get/set | No | Hyperlink Configuration |
|
|
867
|
+
| dataValidation | Object \| null | get/set | No | Data Validation Configuration |
|
|
868
|
+
| protection | {locked: boolean, hidden: boolean} | get/set | No | Cell Protection Configuration |
|
|
869
|
+
| type | string | get/set | No | Cell Type |
|
|
870
|
+
| style | Object | get/set | No | Cell Styles |
|
|
871
|
+
| border | Object | get/set | No | Border Style |
|
|
872
|
+
| fill | Object | get/set | No | Fill Style |
|
|
873
|
+
| font | Object | get/set | No | Font style |
|
|
874
|
+
| alignment | Object | get/set | No | Alignment |
|
|
875
|
+
| numFmt | string \| undefined | get/set | No | Number Format |
|
|
876
|
+
|
|
877
|
+
### Get
|
|
878
|
+
| Name | Type | Static | Description |
|
|
879
|
+
| --- | --- | --- | --- |
|
|
880
|
+
| showVal | string | No | Show values |
|
|
881
|
+
| accountingData | Object \| undefined | No | Get Accounting Format Structured Data (for Rendering) |
|
|
882
|
+
| calcVal | any | No | Calculated value |
|
|
883
|
+
| spillArray | Array[] \| null | No | Get full spill array results |
|
|
884
|
+
| isSpillSource | boolean | No | Whether it is a spill source cell |
|
|
885
|
+
| isSpillRef | boolean | No | Whether it is a spill reference cell |
|
|
886
|
+
| horizontalAlign | string | No | Calculated Horizontal Alignment |
|
|
887
|
+
| verticalAlign | string | No | Calculated Vertical Alignment |
|
|
888
|
+
| isLocked | boolean | No | Is it locked |
|
|
889
|
+
| validData | boolean | No | Data validation results |
|
|
890
|
+
| isFormula | boolean | No | Is it a formula |
|
|
891
|
+
| buildXml | Object | No | Build Cell XML |
|
|
892
|
+
|
|
893
|
+
## Canvas
|
|
894
|
+
- Canvas Rendering and Interaction Management
|
|
895
|
+
|
|
896
|
+
### Props
|
|
897
|
+
| Name | Type | Static | Default | Description |
|
|
898
|
+
| --- | --- | --- | --- | --- |
|
|
899
|
+
| dpr | number | No | - | - |
|
|
900
|
+
| ctx | CanvasRenderingContext2D \| null | No | - | - |
|
|
901
|
+
| ctxKZ | CanvasRenderingContext2D \| null | No | - | - |
|
|
902
|
+
| HDctx | CanvasRenderingContext2D \| null | No | - | - |
|
|
903
|
+
| SN | Object | No | SN | SheetNext Main Instance |
|
|
904
|
+
| Utils | Utils | No | SN.Utils | Tool Method Collection |
|
|
905
|
+
| dom | HTMLElement | No | SN.containerDom.querySelector('.sn-canvas') | Canvas Container |
|
|
906
|
+
| showLayer | HTMLCanvasElement | No | SN.containerDom.querySelector(".sn-show-layer") | Show Layer Canvas |
|
|
907
|
+
| handleLayer | HTMLCanvasElement | No | SN.containerDom.querySelector(".sn-handle-layer") | Operating Layer Canvas |
|
|
908
|
+
| buffer | HTMLCanvasElement | No | document.createElement('canvas') | Buffer Canvas |
|
|
909
|
+
| showLayerKZ | HTMLCanvasElement | No | document.createElement('canvas') | Snapshot Canvas |
|
|
910
|
+
| pCanvas | HTMLCanvasElement | No | document.createElement('canvas') | Brush preview canvas |
|
|
911
|
+
| pCtx | CanvasRenderingContext2D | No | this.pCanvas.getContext('2d') | Brush Preview Context |
|
|
912
|
+
| activeBorderInfo | Object \| null | No | null | Current Active Border Information |
|
|
913
|
+
| mpBorder | Object | No | {} | Multi-select border information |
|
|
914
|
+
| lastPadding | Object \| null | No | null | Last padding information |
|
|
915
|
+
| moveAreaName | string \| null | No | null | Mouse pointer is currently pointing to an area |
|
|
916
|
+
| disableMoveCheck | boolean | No | false | Whether to disable mobile detection |
|
|
917
|
+
| disableScroll | boolean | No | false | Whether to disable scrolling |
|
|
918
|
+
| input | HTMLElement | No | SN.containerDom.querySelector('.sn-input-editor') | Input Editor |
|
|
919
|
+
| formulaBar | HTMLElement | No | SN.containerDom.querySelector('.sn-formula-bar') | Formula Bar Input Box |
|
|
920
|
+
| inputEditing | boolean | No | false | - |
|
|
921
|
+
| areaInput | HTMLInputElement | No | SN.containerDom.querySelector('.sn-area-input') | Area input box |
|
|
922
|
+
| areaBox | HTMLElement | No | SN.containerDom.querySelector('.sn-area-box') | Area Selection Container |
|
|
923
|
+
| areaDropdown | HTMLElement | No | SN.containerDom.querySelector('.sn-area-dropdown') | Area Dropdown Container |
|
|
924
|
+
| rollX | HTMLElement | No | SN.containerDom.querySelector('.sn-roll-x') | Landscape scrollbar |
|
|
925
|
+
| rollXS | HTMLElement | No | SN.containerDom.querySelector('.sn-roll-x>div') | Landscape Scrollbar Slider |
|
|
926
|
+
| rollY | HTMLElement | No | SN.containerDom.querySelector('.sn-roll-y') | Portrait scrollbar |
|
|
927
|
+
| rollYS | HTMLElement | No | SN.containerDom.querySelector('.sn-roll-y>div') | Portrait Scrollbar Slider |
|
|
928
|
+
| drawingsCon | HTMLElement | No | SN.containerDom.querySelector('.sn-drawings-con') | Graphics Container |
|
|
929
|
+
| slicersCon | HTMLElement | No | SN.containerDom.querySelector('.sn-slicers-con') | Slicer Container |
|
|
930
|
+
| maxTop | number | No | 0 | Maximum longitudinal scrolling distance |
|
|
931
|
+
| maxLeft | number | No | 0 | Maximum lateral scrolling distance |
|
|
932
|
+
| rCount | number | No | 0 | Render Count |
|
|
933
|
+
| hoveredComment | Object \| null | No | null | Current hover comment |
|
|
934
|
+
| statSum | HTMLElement \| null | No | SN.containerDom.querySelector('[data-stat="sum"]') | Statistical Sum: Dom |
|
|
935
|
+
| statCount | HTMLElement \| null | No | SN.containerDom.querySelector('[data-stat="count"]') | Statistics Count: Dom |
|
|
936
|
+
| statAvg | HTMLElement \| null | No | SN.containerDom.querySelector('[data-stat="avg"]') | Statistical average: Dom |
|
|
937
|
+
| highlightColor | string \| null | No | null | Highlight color, null means closed |
|
|
938
|
+
| eyeProtectionMode | boolean | No | false | Whether to turn on eye protection mode |
|
|
939
|
+
| eyeProtectionColor | string | No | 'rgb(204,232,207)' | Eye protection color |
|
|
940
|
+
|
|
941
|
+
### Get/Set
|
|
942
|
+
| Name | Type | Mode | Static | Description |
|
|
943
|
+
| --- | --- | --- | --- | --- |
|
|
944
|
+
| inputEditing | boolean | get/set | No | Whether or not in input edit state |
|
|
945
|
+
|
|
946
|
+
### Get
|
|
947
|
+
| Name | Type | Static | Description |
|
|
948
|
+
| --- | --- | --- | --- |
|
|
949
|
+
| paddingType | string | No | Padding Type |
|
|
950
|
+
| hyperlinkJumpBtn | HTMLElement \| null | No | Hyperlink Jump Button |
|
|
951
|
+
| hyperlinkTip | HTMLElement \| null | No | Hyperlink Tips |
|
|
952
|
+
| validSelect | HTMLElement \| null | No | Data Validation Selector |
|
|
953
|
+
| validTip | HTMLElement \| null | No | Tips for data validation |
|
|
954
|
+
| scrollTip | HTMLElement \| null | No | Scroll Tips |
|
|
955
|
+
| width | number | No | Visible Width |
|
|
956
|
+
| height | number | No | Visible Height |
|
|
957
|
+
| viewWidth | number | No | Logical View Width |
|
|
958
|
+
| viewHeight | number | No | Logical View Height |
|
|
959
|
+
| pixelRatio | number | No | Pixel Ratio |
|
|
960
|
+
| halfPixel | number | No | Half Pixel Offset |
|
|
961
|
+
| activeSheet | Sheet | No | Current Active Sheet |
|
|
962
|
+
|
|
963
|
+
### Methods
|
|
964
|
+
#### `viewResize(): boolean`
|
|
965
|
+
- Re-fetch dom length after updating canvas zoom/length-width
|
|
966
|
+
|
|
967
|
+
**Returns**
|
|
968
|
+
- Type: `boolean`
|
|
969
|
+
|
|
970
|
+
#### `toLogical(value): number`
|
|
971
|
+
- Physical pixel to logical coordinates
|
|
972
|
+
|
|
973
|
+
**Parameters**
|
|
974
|
+
| Name | Type | Required | Default | Description |
|
|
975
|
+
| --- | --- | --- | --- | --- |
|
|
976
|
+
| value | number | Yes | - | Physical pixels |
|
|
977
|
+
|
|
978
|
+
**Returns**
|
|
979
|
+
- Type: `number`
|
|
980
|
+
|
|
981
|
+
#### `toPhysical(value): number`
|
|
982
|
+
- Logical Coordinates to Physical Pixels
|
|
983
|
+
|
|
984
|
+
**Parameters**
|
|
985
|
+
| Name | Type | Required | Default | Description |
|
|
986
|
+
| --- | --- | --- | --- | --- |
|
|
987
|
+
| value | number | Yes | - | Logical coordinates |
|
|
988
|
+
|
|
989
|
+
**Returns**
|
|
990
|
+
- Type: `number`
|
|
991
|
+
|
|
992
|
+
#### `px(value): number`
|
|
993
|
+
- Convert to value in pixel ratio
|
|
994
|
+
|
|
995
|
+
**Parameters**
|
|
996
|
+
| Name | Type | Required | Default | Description |
|
|
997
|
+
| --- | --- | --- | --- | --- |
|
|
998
|
+
| value | number | Yes | - | Raw Value |
|
|
999
|
+
|
|
1000
|
+
**Returns**
|
|
1001
|
+
- Type: `number`
|
|
1002
|
+
|
|
1003
|
+
#### `snap(value): number`
|
|
1004
|
+
- Alignment Pixel Ratio
|
|
1005
|
+
|
|
1006
|
+
**Parameters**
|
|
1007
|
+
| Name | Type | Required | Default | Description |
|
|
1008
|
+
| --- | --- | --- | --- | --- |
|
|
1009
|
+
| value | number | Yes | - | Raw Value |
|
|
1010
|
+
|
|
1011
|
+
**Returns**
|
|
1012
|
+
- Type: `number`
|
|
1013
|
+
|
|
1014
|
+
#### `snapRect(x, y, w, h): {x: number, y: number, w: number, h: number}`
|
|
1015
|
+
- Align Rectangle to Pixel Ratio
|
|
1016
|
+
|
|
1017
|
+
**Parameters**
|
|
1018
|
+
| Name | Type | Required | Default | Description |
|
|
1019
|
+
| --- | --- | --- | --- | --- |
|
|
1020
|
+
| x | number | Yes | - | X |
|
|
1021
|
+
| y | number | Yes | - | Y |
|
|
1022
|
+
| w | number | Yes | - | Wide |
|
|
1023
|
+
| h | number | Yes | - | High |
|
|
1024
|
+
|
|
1025
|
+
**Returns**
|
|
1026
|
+
- Type: `{x: number, y: number, w: number, h: number}`
|
|
1027
|
+
|
|
1028
|
+
#### `getEventPosition(event): {x: number, y: number}`
|
|
1029
|
+
- Gets the position of the event in the canvas (logical coordinates)<br>@ param {MouseEvent \| {clientX: number, clientY: number}} event - Mouse event or object with coordinates
|
|
1030
|
+
|
|
1031
|
+
**Parameters**
|
|
1032
|
+
| Name | Type | Required | Default | Description |
|
|
1033
|
+
| --- | --- | --- | --- | --- |
|
|
1034
|
+
| event | - | Yes | - | - |
|
|
1035
|
+
|
|
1036
|
+
**Returns**
|
|
1037
|
+
- Type: `{x: number, y: number}`
|
|
1038
|
+
|
|
1039
|
+
#### `getCellIndexByPosition(x, y): {c: number, r: number}`
|
|
1040
|
+
- Get cell index by location
|
|
1041
|
+
|
|
1042
|
+
**Parameters**
|
|
1043
|
+
| Name | Type | Required | Default | Description |
|
|
1044
|
+
| --- | --- | --- | --- | --- |
|
|
1045
|
+
| x | number | Yes | - | Logical coordinates X |
|
|
1046
|
+
| y | number | Yes | - | Logical coordinates Y |
|
|
1047
|
+
|
|
1048
|
+
**Returns**
|
|
1049
|
+
- Type: `{c: number, r: number}`
|
|
1050
|
+
|
|
1051
|
+
#### `applyZoom(): void`
|
|
1052
|
+
- Apply zoom and synchronize scrollbar and input box positions
|
|
1053
|
+
|
|
1054
|
+
#### `clearBuffer(width = this.buffer.width, height = this.buffer.height): void`
|
|
1055
|
+
- Clear Buffered Canvas (Physical Pixels)
|
|
1056
|
+
|
|
1057
|
+
**Parameters**
|
|
1058
|
+
| Name | Type | Required | Default | Description |
|
|
1059
|
+
| --- | --- | --- | --- | --- |
|
|
1060
|
+
| width | number | No | this.buffer.width | Width |
|
|
1061
|
+
| height | number | No | this.buffer.height | Height |
|
|
1062
|
+
|
|
1063
|
+
#### `updateScrollBarSize(): void`
|
|
1064
|
+
- Update scrollbar dimensions
|
|
1065
|
+
|
|
1066
|
+
#### `updateOverlayContainers(): void`
|
|
1067
|
+
- Update Overlay Container Dimensions
|
|
1068
|
+
|
|
1069
|
+
#### `updateScrollBar(): void`
|
|
1070
|
+
- Update scrollbar position
|
|
1071
|
+
|
|
1072
|
+
#### `getCellIndex(event): {r:number, c:number}`
|
|
1073
|
+
- Get the cell index corresponding to the event<br>@ param {MouseEvent \| {clientX: number, clientY: number}} event - Mouse event or object with coordinates
|
|
1074
|
+
|
|
1075
|
+
**Parameters**
|
|
1076
|
+
| Name | Type | Required | Default | Description |
|
|
1077
|
+
| --- | --- | --- | --- | --- |
|
|
1078
|
+
| event | - | Yes | - | - |
|
|
1079
|
+
|
|
1080
|
+
**Returns**
|
|
1081
|
+
- Type: `{r:number, c:number}`
|
|
1082
|
+
|
|
1083
|
+
#### `setHighlight(event): void`
|
|
1084
|
+
- Set highlight color and sync toolbar status
|
|
1085
|
+
|
|
1086
|
+
**Parameters**
|
|
1087
|
+
| Name | Type | Required | Default | Description |
|
|
1088
|
+
| --- | --- | --- | --- | --- |
|
|
1089
|
+
| event | MouseEvent | Yes | - | Trigger event |
|
|
1090
|
+
|
|
1091
|
+
#### `toggleEyeProtection(): void`
|
|
1092
|
+
- Toggle eye protection mode
|
|
1093
|
+
|
|
1094
|
+
#### `async r(type?, options = {}): Promise<void>`
|
|
1095
|
+
- Render Canvas (Snapshot mode supported)
|
|
1096
|
+
|
|
1097
|
+
**Parameters**
|
|
1098
|
+
| Name | Type | Required | Default | Description |
|
|
1099
|
+
| --- | --- | --- | --- | --- |
|
|
1100
|
+
| type | string | No | - | Rendering type, 's' for snapshot rendering |
|
|
1101
|
+
| options | Object | No | {} | Rendering Options |
|
|
1102
|
+
| options.targetCanvas | HTMLCanvasElement | No | - | Target Canvas (Screenshot Mode) |
|
|
1103
|
+
| options.width | number | No | - | Screenshot Width |
|
|
1104
|
+
| options.height | number | No | - | Screenshot height |
|
|
1105
|
+
| options.dpr | number | No | - | Specify dpr |
|
|
1106
|
+
| options.sheet | Sheet | No | - | Assign Sheets |
|
|
1107
|
+
|
|
1108
|
+
**Returns**
|
|
1109
|
+
- Type: `Promise<void>`
|
|
1110
|
+
|
|
1111
|
+
#### `rCell(x, y, w, h, cell)`
|
|
1112
|
+
- Category: `CellRenderer`
|
|
1113
|
+
|
|
1114
|
+
**Parameters**
|
|
1115
|
+
| Name | Type | Required | Default | Description |
|
|
1116
|
+
| --- | --- | --- | --- | --- |
|
|
1117
|
+
| x | number | Yes | - | - |
|
|
1118
|
+
| y | number | Yes | - | - |
|
|
1119
|
+
| w | number | Yes | - | - |
|
|
1120
|
+
| h | number | Yes | - | - |
|
|
1121
|
+
| cell | Object | Yes | - | - |
|
|
1122
|
+
|
|
1123
|
+
#### `rCellBackground(x, y, w, h, cell, skipGridLine = false, cfFormat = null, tableStyle = null)`
|
|
1124
|
+
- Category: `CellRenderer`
|
|
1125
|
+
|
|
1126
|
+
**Parameters**
|
|
1127
|
+
| Name | Type | Required | Default | Description |
|
|
1128
|
+
| --- | --- | --- | --- | --- |
|
|
1129
|
+
| x | number | Yes | - | - |
|
|
1130
|
+
| y | number | Yes | - | - |
|
|
1131
|
+
| w | number | Yes | - | - |
|
|
1132
|
+
| h | number | Yes | - | - |
|
|
1133
|
+
| cell | Object | Yes | - | - |
|
|
1134
|
+
| skipGridLine | boolean | No | false | - |
|
|
1135
|
+
| cfFormat | Object \| null | No | null | - |
|
|
1136
|
+
| tableStyle | Object \| null | No | null | - |
|
|
1137
|
+
|
|
1138
|
+
#### `rCellText(x, y, w, h, cell, layoutRect = null)`
|
|
1139
|
+
- Category: `CellRenderer`
|
|
1140
|
+
|
|
1141
|
+
**Parameters**
|
|
1142
|
+
| Name | Type | Required | Default | Description |
|
|
1143
|
+
| --- | --- | --- | --- | --- |
|
|
1144
|
+
| x | number | Yes | - | - |
|
|
1145
|
+
| y | number | Yes | - | - |
|
|
1146
|
+
| w | number | Yes | - | - |
|
|
1147
|
+
| h | number | Yes | - | - |
|
|
1148
|
+
| cell | Object | Yes | - | - |
|
|
1149
|
+
| layoutRect | {x:number,y:number,w:number,h:number} \| null | No | null | - |
|
|
1150
|
+
|
|
1151
|
+
#### `rCellTextWithOverflow(r, c, x, y, w, h, cell, sheet, nonEmptyCells, cfFormat = null, tableStyle = null)`
|
|
1152
|
+
- Category: `CellRenderer`
|
|
1153
|
+
|
|
1154
|
+
**Parameters**
|
|
1155
|
+
| Name | Type | Required | Default | Description |
|
|
1156
|
+
| --- | --- | --- | --- | --- |
|
|
1157
|
+
| r | number | Yes | - | - |
|
|
1158
|
+
| c | number | Yes | - | - |
|
|
1159
|
+
| x | number | Yes | - | - |
|
|
1160
|
+
| y | number | Yes | - | - |
|
|
1161
|
+
| w | number | Yes | - | - |
|
|
1162
|
+
| h | number | Yes | - | - |
|
|
1163
|
+
| cell | Object | Yes | - | - |
|
|
1164
|
+
| sheet | Object | Yes | - | - |
|
|
1165
|
+
| nonEmptyCells | Array<Object> | Yes | - | - |
|
|
1166
|
+
| cfFormat | Object \| null | No | null | - |
|
|
1167
|
+
| tableStyle | Object \| null | No | null | - |
|
|
1168
|
+
|
|
1169
|
+
#### `rMerged(sheet)`
|
|
1170
|
+
- Category: `CellRenderer`
|
|
1171
|
+
|
|
1172
|
+
**Parameters**
|
|
1173
|
+
| Name | Type | Required | Default | Description |
|
|
1174
|
+
| --- | --- | --- | --- | --- |
|
|
1175
|
+
| sheet | Object | Yes | - | - |
|
|
1176
|
+
|
|
1177
|
+
#### `rBorder(ciArr)`
|
|
1178
|
+
- Category: `CellRenderer`
|
|
1179
|
+
|
|
1180
|
+
**Parameters**
|
|
1181
|
+
| Name | Type | Required | Default | Description |
|
|
1182
|
+
| --- | --- | --- | --- | --- |
|
|
1183
|
+
| ciArr | Array<Object> | Yes | - | - |
|
|
1184
|
+
|
|
1185
|
+
#### `rBaseData(sheet)`
|
|
1186
|
+
- Category: `CellRenderer`
|
|
1187
|
+
|
|
1188
|
+
**Parameters**
|
|
1189
|
+
| Name | Type | Required | Default | Description |
|
|
1190
|
+
| --- | --- | --- | --- | --- |
|
|
1191
|
+
| sheet | Object | Yes | - | - |
|
|
1192
|
+
|
|
1193
|
+
#### `getOffset(x, y, w, h): Object`
|
|
1194
|
+
- Category: `SheetRenderer`
|
|
1195
|
+
|
|
1196
|
+
**Parameters**
|
|
1197
|
+
| Name | Type | Required | Default | Description |
|
|
1198
|
+
| --- | --- | --- | --- | --- |
|
|
1199
|
+
| x | number | Yes | - | - |
|
|
1200
|
+
| y | number | Yes | - | - |
|
|
1201
|
+
| w | number | Yes | - | - |
|
|
1202
|
+
| h | number | Yes | - | - |
|
|
1203
|
+
|
|
1204
|
+
**Returns**
|
|
1205
|
+
- Type: `Object`
|
|
1206
|
+
|
|
1207
|
+
#### `async rDrawing(nowRCount, options = {}): Promise<void>`
|
|
1208
|
+
- Category: `SheetRenderer`
|
|
1209
|
+
|
|
1210
|
+
**Parameters**
|
|
1211
|
+
| Name | Type | Required | Default | Description |
|
|
1212
|
+
| --- | --- | --- | --- | --- |
|
|
1213
|
+
| nowRCount | number | Yes | - | - |
|
|
1214
|
+
| options | Object | No | {} | - |
|
|
1215
|
+
|
|
1216
|
+
**Returns**
|
|
1217
|
+
- Type: `Promise<void>`
|
|
1218
|
+
|
|
1219
|
+
#### `async captureScreenshot(cellAddress, csType = 'topleft', option = {}): Promise<void>`
|
|
1220
|
+
- Category: `ScreenshotRenderer`
|
|
1221
|
+
|
|
1222
|
+
**Parameters**
|
|
1223
|
+
| Name | Type | Required | Default | Description |
|
|
1224
|
+
| --- | --- | --- | --- | --- |
|
|
1225
|
+
| cellAddress | string | Yes | - | - |
|
|
1226
|
+
| csType | string | No | 'topleft' | - |
|
|
1227
|
+
| option | Object | No | {} | - |
|
|
1228
|
+
|
|
1229
|
+
**Returns**
|
|
1230
|
+
- Type: `Promise<void>`
|
|
1231
|
+
|
|
1232
|
+
#### `getLight()`
|
|
1233
|
+
- Category: `IndexRenderer`
|
|
1234
|
+
|
|
1235
|
+
#### `rAllBtn()`
|
|
1236
|
+
- Category: `IndexRenderer`
|
|
1237
|
+
|
|
1238
|
+
#### `rRowColHeaders(sheet, lightInfo)`
|
|
1239
|
+
- Category: `IndexRenderer`
|
|
1240
|
+
|
|
1241
|
+
**Parameters**
|
|
1242
|
+
| Name | Type | Required | Default | Description |
|
|
1243
|
+
| --- | --- | --- | --- | --- |
|
|
1244
|
+
| sheet | Object | Yes | - | - |
|
|
1245
|
+
| lightInfo | Object | Yes | - | - |
|
|
1246
|
+
|
|
1247
|
+
#### `rHighlightBars(sheet, lightInfo)`
|
|
1248
|
+
- Category: `IndexRenderer`
|
|
1249
|
+
|
|
1250
|
+
**Parameters**
|
|
1251
|
+
| Name | Type | Required | Default | Description |
|
|
1252
|
+
| --- | --- | --- | --- | --- |
|
|
1253
|
+
| sheet | Object | Yes | - | - |
|
|
1254
|
+
| lightInfo | Object | Yes | - | - |
|
|
1255
|
+
|
|
1256
|
+
#### `rPageBreaks(sheet)`
|
|
1257
|
+
- Category: `IndexRenderer`
|
|
1258
|
+
|
|
1259
|
+
**Parameters**
|
|
1260
|
+
| Name | Type | Required | Default | Description |
|
|
1261
|
+
| --- | --- | --- | --- | --- |
|
|
1262
|
+
| sheet | Object | Yes | - | - |
|
|
1263
|
+
|
|
1264
|
+
#### `rIndex(sheet, isScreenshot = false, renderOptions = {})`
|
|
1265
|
+
- Category: `IndexRenderer`
|
|
1266
|
+
|
|
1267
|
+
**Parameters**
|
|
1268
|
+
| Name | Type | Required | Default | Description |
|
|
1269
|
+
| --- | --- | --- | --- | --- |
|
|
1270
|
+
| sheet | Object | Yes | - | - |
|
|
1271
|
+
| isScreenshot | boolean | No | false | - |
|
|
1272
|
+
| renderOptions | Object | No | {} | - |
|
|
1273
|
+
|
|
1274
|
+
#### `rDom()`
|
|
1275
|
+
- Category: `IndexRenderer`
|
|
1276
|
+
|
|
1277
|
+
#### `showCellInput(clearValue = false, focusEditor = false)`
|
|
1278
|
+
- Category: `InputManager`
|
|
1279
|
+
|
|
1280
|
+
**Parameters**
|
|
1281
|
+
| Name | Type | Required | Default | Description |
|
|
1282
|
+
| --- | --- | --- | --- | --- |
|
|
1283
|
+
| clearValue | boolean | No | false | - |
|
|
1284
|
+
| focusEditor | boolean | No | false | - |
|
|
1285
|
+
|
|
1286
|
+
#### `updateInputPosition()`
|
|
1287
|
+
- Category: `InputManager`
|
|
1288
|
+
|
|
1289
|
+
#### `updInputValue()`
|
|
1290
|
+
- Category: `InputManager`
|
|
1291
|
+
|
|
1292
|
+
#### `addEventListeners()`
|
|
1293
|
+
- Category: `EventManager`
|
|
1294
|
+
|
|
1295
|
+
#### `rSparklines(sheet)`
|
|
1296
|
+
- Render sparklines within all views
|
|
1297
|
+
- Category: `SparklineRenderer`
|
|
1298
|
+
|
|
1299
|
+
**Parameters**
|
|
1300
|
+
| Name | Type | Required | Default | Description |
|
|
1301
|
+
| --- | --- | --- | --- | --- |
|
|
1302
|
+
| sheet | Object | Yes | - | Sheet Objects |
|
|
1303
|
+
|
|
1304
|
+
#### `rCommentIndicators(sheet)`
|
|
1305
|
+
- Render comment Indicator
|
|
1306
|
+
- Category: `CommentRenderer`
|
|
1307
|
+
|
|
1308
|
+
**Parameters**
|
|
1309
|
+
| Name | Type | Required | Default | Description |
|
|
1310
|
+
| --- | --- | --- | --- | --- |
|
|
1311
|
+
| sheet | Sheet | Yes | - | Sheet Instance |
|
|
1312
|
+
|
|
1313
|
+
#### `rCommentBoxes(sheet)`
|
|
1314
|
+
- Render comment Floating Box
|
|
1315
|
+
- Category: `CommentRenderer`
|
|
1316
|
+
|
|
1317
|
+
**Parameters**
|
|
1318
|
+
| Name | Type | Required | Default | Description |
|
|
1319
|
+
| --- | --- | --- | --- | --- |
|
|
1320
|
+
| sheet | Sheet | Yes | - | Sheet Instance |
|
|
1321
|
+
|
|
1322
|
+
#### `rConditionalFormats(sheet)`
|
|
1323
|
+
- Render Conditional Formatting (Icons Only)<br>The data bar has been rendered in rBaseData to avoid overwriting the text
|
|
1324
|
+
- Category: `CFRenderer`
|
|
1325
|
+
|
|
1326
|
+
**Parameters**
|
|
1327
|
+
| Name | Type | Required | Default | Description |
|
|
1328
|
+
| --- | --- | --- | --- | --- |
|
|
1329
|
+
| sheet | - | Yes | - | - |
|
|
1330
|
+
|
|
1331
|
+
#### `rDataBar(x, y, w, h, dataBar)`
|
|
1332
|
+
- Render Data Bar (Export for CellRenderer)
|
|
1333
|
+
- Category: `CFRenderer`
|
|
1334
|
+
|
|
1335
|
+
**Parameters**
|
|
1336
|
+
| Name | Type | Required | Default | Description |
|
|
1337
|
+
| --- | --- | --- | --- | --- |
|
|
1338
|
+
| x | - | Yes | - | - |
|
|
1339
|
+
| y | - | Yes | - | - |
|
|
1340
|
+
| w | - | Yes | - | - |
|
|
1341
|
+
| h | - | Yes | - | - |
|
|
1342
|
+
| dataBar | - | Yes | - | - |
|
|
1343
|
+
|
|
1344
|
+
#### `rFilterIcons(sheet)`
|
|
1345
|
+
- Render Filter Icon
|
|
1346
|
+
- Category: `FilterRenderer`
|
|
1347
|
+
|
|
1348
|
+
**Parameters**
|
|
1349
|
+
| Name | Type | Required | Default | Description |
|
|
1350
|
+
| --- | --- | --- | --- | --- |
|
|
1351
|
+
| sheet | Sheet | Yes | - | Sheet Objects |
|
|
1352
|
+
|
|
1353
|
+
#### `clearFilterIconPositions()`
|
|
1354
|
+
- Clear filter icon position information
|
|
1355
|
+
- Category: `FilterRenderer`
|
|
1356
|
+
|
|
1357
|
+
#### `getFilterIconAtPosition(x, y): {colIndex:number, scopeId:string} | null`
|
|
1358
|
+
- Detect if the click location is on the filter icon
|
|
1359
|
+
- Category: `FilterRenderer`
|
|
1360
|
+
|
|
1361
|
+
**Parameters**
|
|
1362
|
+
| Name | Type | Required | Default | Description |
|
|
1363
|
+
| --- | --- | --- | --- | --- |
|
|
1364
|
+
| x | number | Yes | - | Click on the X coordinates |
|
|
1365
|
+
| y | number | Yes | - | Click on the Y position |
|
|
1366
|
+
|
|
1367
|
+
**Returns**
|
|
1368
|
+
- Type: `{colIndex:number, scopeId:string} | null`
|
|
1369
|
+
|
|
1370
|
+
#### `drawFilterIcon(ctx, iconX, iconY, iconSize, hasFilter, sortOrder)`
|
|
1371
|
+
- Draw a single filter icon (Excel style drop-down button)
|
|
1372
|
+
- Category: `FilterRenderer`
|
|
1373
|
+
|
|
1374
|
+
**Parameters**
|
|
1375
|
+
| Name | Type | Required | Default | Description |
|
|
1376
|
+
| --- | --- | --- | --- | --- |
|
|
1377
|
+
| ctx | - | Yes | - | - |
|
|
1378
|
+
| iconX | - | Yes | - | - |
|
|
1379
|
+
| iconY | - | Yes | - | - |
|
|
1380
|
+
| iconSize | - | Yes | - | - |
|
|
1381
|
+
| hasFilter | - | Yes | - | - |
|
|
1382
|
+
| sortOrder | - | Yes | - | - |
|
|
1383
|
+
|
|
1384
|
+
#### `rPivotTablePlaceholders(sheet)`
|
|
1385
|
+
- Render PivotTable Placeholder
|
|
1386
|
+
- Category: `PivotTableRenderer`
|
|
1387
|
+
|
|
1388
|
+
**Parameters**
|
|
1389
|
+
| Name | Type | Required | Default | Description |
|
|
1390
|
+
| --- | --- | --- | --- | --- |
|
|
1391
|
+
| sheet | Sheet | Yes | - | Sheet Instance |
|
|
1392
|
+
|
|
1393
|
+
#### `getPivotTableAtPosition(sheet, x, y)`
|
|
1394
|
+
- Detect if the mouse is in the pivot table placeholder area
|
|
1395
|
+
- Category: `PivotTableRenderer`
|
|
1396
|
+
|
|
1397
|
+
**Parameters**
|
|
1398
|
+
| Name | Type | Required | Default | Description |
|
|
1399
|
+
| --- | --- | --- | --- | --- |
|
|
1400
|
+
| sheet | Sheet | Yes | - | Sheet Instance |
|
|
1401
|
+
| x | number | Yes | - | Mouse X coordinates |
|
|
1402
|
+
| y | number | Yes | - | Mouse Y coordinates<br>@ returns {PivotTable \| null} Returns null if a PivotTable instance is returned within an area |
|
|
1403
|
+
|
|
1404
|
+
## Layout
|
|
1405
|
+
- Layout & Toolbar Management
|
|
1406
|
+
|
|
1407
|
+
### Props
|
|
1408
|
+
| Name | Type | Static | Default | Description |
|
|
1409
|
+
| --- | --- | --- | --- | --- |
|
|
1410
|
+
| SN | Object | No | SN | SheetNext Main Instance |
|
|
1411
|
+
| myModal | Object \| null | No | null | Generic Popup Instance |
|
|
1412
|
+
| toast | Object \| null | No | null | Toast Instance |
|
|
1413
|
+
| chatWindowOffsetX | number | No | 0 | Chat Window Drag Offset X |
|
|
1414
|
+
| chatWindowOffsetY | number | No | 0 | Chat Window Drag Offset Y |
|
|
1415
|
+
| menuConfig | Object | No | MenuConfig.initDefaultMenuConfig(SN, options) | Menu Configuration |
|
|
1416
|
+
|
|
1417
|
+
### Get/Set
|
|
1418
|
+
| Name | Type | Mode | Static | Description |
|
|
1419
|
+
| --- | --- | --- | --- | --- |
|
|
1420
|
+
| showMenuBar | boolean | get/set | No | Whether to show the menu bar |
|
|
1421
|
+
| showToolbar | boolean | get/set | No | Whether to show the toolbar |
|
|
1422
|
+
| showAIChat | boolean | get/set | No | Whether to show the AI chat portal |
|
|
1423
|
+
| showFormulaBar | boolean | get/set | No | Whether to show the formula bar |
|
|
1424
|
+
| showSheetTabBar | boolean | get/set | No | Whether to show the sheet tab bar |
|
|
1425
|
+
| showStats | boolean | get/set | No | Whether to show the statistics bar |
|
|
1426
|
+
| showAIChatWindow | boolean | get/set | No | Whether to show the AI chat window |
|
|
1427
|
+
| showPivotPanel | boolean | get/set | No | Whether to show the PivotTable field panel |
|
|
1428
|
+
|
|
1429
|
+
### Get
|
|
1430
|
+
| Name | Type | Static | Description |
|
|
1431
|
+
| --- | --- | --- | --- |
|
|
1432
|
+
| isSmallWindow | boolean | No | Whether it is a small window |
|
|
1433
|
+
| toolbarMode | 'full' \| 'minimal' | No | - |
|
|
1434
|
+
| isToolbarModeLocked | boolean | No | - |
|
|
1435
|
+
| minimalToolbarTextEnabled | boolean | No | - |
|
|
1436
|
+
|
|
1437
|
+
### Methods
|
|
1438
|
+
#### `openPivotPanel(pt): void`
|
|
1439
|
+
- Opens the PivotTable Fields panel (manually invoked by the user, such as a toolbar button)
|
|
1440
|
+
|
|
1441
|
+
**Parameters**
|
|
1442
|
+
| Name | Type | Required | Default | Description |
|
|
1443
|
+
| --- | --- | --- | --- | --- |
|
|
1444
|
+
| pt | PivotTable | Yes | - | PivotTable Instance |
|
|
1445
|
+
|
|
1446
|
+
#### `togglePivotPanel(pt)`
|
|
1447
|
+
- Toggle PivotTable field panel display
|
|
1448
|
+
|
|
1449
|
+
**Parameters**
|
|
1450
|
+
| Name | Type | Required | Default | Description |
|
|
1451
|
+
| --- | --- | --- | --- | --- |
|
|
1452
|
+
| pt | PivotTable | Yes | - | PivotTable Instance<br>@ returns {boolean} shown or not |
|
|
1453
|
+
|
|
1454
|
+
#### `autoOpenPivotPanel(pt): void`
|
|
1455
|
+
- Automatically opens the PivotTable Fields panel (called when the PivotTable area is clicked)<br>Do not open automatically if the user manually closed it
|
|
1456
|
+
|
|
1457
|
+
**Parameters**
|
|
1458
|
+
| Name | Type | Required | Default | Description |
|
|
1459
|
+
| --- | --- | --- | --- | --- |
|
|
1460
|
+
| pt | PivotTable | Yes | - | PivotTable Instance |
|
|
1461
|
+
|
|
1462
|
+
#### `closePivotPanel(): void`
|
|
1463
|
+
- Close the PivotTable field panel (called when you click outside the PivotTable area)<br>The manual close flag will not be set
|
|
1464
|
+
|
|
1465
|
+
#### `refreshActiveButtons(): void`
|
|
1466
|
+
- Refresh button state with active getter in toolbar<br>Bidirectional binding for toggle buttons such as format brush
|
|
1467
|
+
|
|
1468
|
+
#### `refreshToolbar(): void`
|
|
1469
|
+
- Unified refresh toolbar status (panel toggle, invoked after API modification)<br>Integration: Style status + checkbox + active button
|
|
1470
|
+
|
|
1471
|
+
#### `toggleMinimalToolbar(enabled)`
|
|
1472
|
+
|
|
1473
|
+
**Parameters**
|
|
1474
|
+
| Name | Type | Required | Default | Description |
|
|
1475
|
+
| --- | --- | --- | --- | --- |
|
|
1476
|
+
| enabled | boolean | Yes | - | - |
|
|
1477
|
+
|
|
1478
|
+
#### `toggleMinimalToolbarText(enabled)`
|
|
1479
|
+
|
|
1480
|
+
**Parameters**
|
|
1481
|
+
| Name | Type | Required | Default | Description |
|
|
1482
|
+
| --- | --- | --- | --- | --- |
|
|
1483
|
+
| enabled | boolean | Yes | - | - |
|
|
1484
|
+
|
|
1485
|
+
#### `scrollSheetTabs(dir): void`
|
|
1486
|
+
- Scroll Sheet Tab
|
|
1487
|
+
|
|
1488
|
+
**Parameters**
|
|
1489
|
+
| Name | Type | Required | Default | Description |
|
|
1490
|
+
| --- | --- | --- | --- | --- |
|
|
1491
|
+
| dir | number | Yes | - | Scroll Direction (1 or -1) |
|
|
1492
|
+
|
|
1493
|
+
#### `updateContextualToolbar(context): void`
|
|
1494
|
+
- Update Context Toolbar (Show/Hide Context Tab Based on Selection)
|
|
1495
|
+
|
|
1496
|
+
**Parameters**
|
|
1497
|
+
| Name | Type | Required | Default | Description |
|
|
1498
|
+
| --- | --- | --- | --- | --- |
|
|
1499
|
+
| context | Object | Yes | - | Context Information {type: 'table' \| 'pivotTable' \| 'chart' \| null, data: any, autoSwitch: boolean}<br>- autoSwitch: Whether to automatically switch to the context tab (default false, only show no switch) |
|
|
1500
|
+
|
|
1501
|
+
#### `initResizeObserver()`
|
|
1502
|
+
- Initialize ResizeObserver
|
|
1503
|
+
- Category: `ResizeHandler`
|
|
1504
|
+
|
|
1505
|
+
#### `throttleResize()`
|
|
1506
|
+
- Throttling resize event
|
|
1507
|
+
- Category: `ResizeHandler`
|
|
1508
|
+
|
|
1509
|
+
#### `handleAllResize()`
|
|
1510
|
+
- Handle all resize related logic
|
|
1511
|
+
- Category: `ResizeHandler`
|
|
1512
|
+
|
|
1513
|
+
#### `updateCanvasSize()`
|
|
1514
|
+
- Update Canvas Dimensions
|
|
1515
|
+
- Category: `ResizeHandler`
|
|
1516
|
+
|
|
1517
|
+
#### `initDragEvents()`
|
|
1518
|
+
- Initialize Drag Event
|
|
1519
|
+
- Category: `DragHandler`
|
|
1520
|
+
|
|
1521
|
+
#### `initEventListeners()`
|
|
1522
|
+
- Initialize all event listeners.
|
|
1523
|
+
- Category: `EventManager`
|
|
1524
|
+
|
|
1525
|
+
#### `initColorComponents(scope?)`
|
|
1526
|
+
- Initialize color components.
|
|
1527
|
+
- Category: `EventManager`
|
|
1528
|
+
|
|
1529
|
+
**Parameters**
|
|
1530
|
+
| Name | Type | Required | Default | Description |
|
|
1531
|
+
| --- | --- | --- | --- | --- |
|
|
1532
|
+
| scope | Element | No | - | Optional scope. |
|
|
1533
|
+
|
|
1534
|
+
#### `removeLoading()`
|
|
1535
|
+
- Remove loading animation.
|
|
1536
|
+
- Category: `EventManager`
|
|
1537
|
+
|
|
1538
|
+
## Formula
|
|
1539
|
+
- Formula Calculator
|
|
1540
|
+
|
|
1541
|
+
## AutoFilter
|
|
1542
|
+
|
|
1543
|
+
### Props
|
|
1544
|
+
| Name | Type | Static | Default | Description |
|
|
1545
|
+
| --- | --- | --- | --- | --- |
|
|
1546
|
+
| sheet | Sheet | No | sheet | Sheet it belongs to |
|
|
1547
|
+
|
|
1548
|
+
### Get/Set
|
|
1549
|
+
| Name | Type | Mode | Static | Description |
|
|
1550
|
+
| --- | --- | --- | --- | --- |
|
|
1551
|
+
| ref | string \| null | get/set | No | Gets/sets the default (sheet) filter range |
|
|
1552
|
+
| sortState | {colIndex: number, order: 'asc' \| 'desc'} \| null | get/set | No | Default (sheet) scope sort state |
|
|
1553
|
+
|
|
1554
|
+
### Get
|
|
1555
|
+
| Name | Type | Static | Description |
|
|
1556
|
+
| --- | --- | --- | --- |
|
|
1557
|
+
| range | {s: {r: number, c: number}, e: {r: number, c: number}} \| null | No | Default (sheet) scope |
|
|
1558
|
+
| columns | Map<number, Object> | No | Default (sheet) scope filter |
|
|
1559
|
+
| enabled | boolean | No | Whether the default (sheet) scope is enabled |
|
|
1560
|
+
| headerRow | number | No | Default (sheet) scope table header row |
|
|
1561
|
+
| hasActiveFilters | boolean | No | Whether the default (sheet) scope has a valid filter |
|
|
1562
|
+
| activeScopeId | string | No | Current Active Scope ID |
|
|
1563
|
+
|
|
1564
|
+
### Methods
|
|
1565
|
+
#### `setActiveScope(scopeId): string`
|
|
1566
|
+
|
|
1567
|
+
**Parameters**
|
|
1568
|
+
| Name | Type | Required | Default | Description |
|
|
1569
|
+
| --- | --- | --- | --- | --- |
|
|
1570
|
+
| scopeId | string \| null | Yes | - | - |
|
|
1571
|
+
|
|
1572
|
+
**Returns**
|
|
1573
|
+
- Type: `string`
|
|
1574
|
+
- Set active scope id when scope exists.
|
|
1575
|
+
|
|
1576
|
+
#### `getTableScopeId(tableId): string`
|
|
1577
|
+
|
|
1578
|
+
**Parameters**
|
|
1579
|
+
| Name | Type | Required | Default | Description |
|
|
1580
|
+
| --- | --- | --- | --- | --- |
|
|
1581
|
+
| tableId | string | Yes | - | - |
|
|
1582
|
+
|
|
1583
|
+
**Returns**
|
|
1584
|
+
- Type: `string`
|
|
1585
|
+
- Build table scope id from table id.
|
|
1586
|
+
|
|
1587
|
+
#### `isScopeEnabled(scopeId = null): boolean`
|
|
1588
|
+
|
|
1589
|
+
**Parameters**
|
|
1590
|
+
| Name | Type | Required | Default | Description |
|
|
1591
|
+
| --- | --- | --- | --- | --- |
|
|
1592
|
+
| scopeId | string \| null | No | null | - |
|
|
1593
|
+
|
|
1594
|
+
**Returns**
|
|
1595
|
+
- Type: `boolean`
|
|
1596
|
+
- Check whether scope range is enabled.
|
|
1597
|
+
|
|
1598
|
+
#### `hasActiveFiltersInScope(scopeId = null): boolean`
|
|
1599
|
+
|
|
1600
|
+
**Parameters**
|
|
1601
|
+
| Name | Type | Required | Default | Description |
|
|
1602
|
+
| --- | --- | --- | --- | --- |
|
|
1603
|
+
| scopeId | string \| null | No | null | - |
|
|
1604
|
+
|
|
1605
|
+
**Returns**
|
|
1606
|
+
- Type: `boolean`
|
|
1607
|
+
- Check whether scope has active column filters.
|
|
1608
|
+
|
|
1609
|
+
#### `hasAnyActiveFilters(): boolean`
|
|
1610
|
+
|
|
1611
|
+
**Returns**
|
|
1612
|
+
- Type: `boolean`
|
|
1613
|
+
- Check whether any scope has active filters.
|
|
1614
|
+
|
|
1615
|
+
#### `getScopeRange(scopeId = null): {s:{r:number,c:number},e:{r:number,c:number}} | null`
|
|
1616
|
+
|
|
1617
|
+
**Parameters**
|
|
1618
|
+
| Name | Type | Required | Default | Description |
|
|
1619
|
+
| --- | --- | --- | --- | --- |
|
|
1620
|
+
| scopeId | string \| null | No | null | - |
|
|
1621
|
+
|
|
1622
|
+
**Returns**
|
|
1623
|
+
- Type: `{s:{r:number,c:number},e:{r:number,c:number}} | null`
|
|
1624
|
+
- Get range of scope.
|
|
1625
|
+
|
|
1626
|
+
#### `getScopeHeaderRow(scopeId = null): number`
|
|
1627
|
+
|
|
1628
|
+
**Parameters**
|
|
1629
|
+
| Name | Type | Required | Default | Description |
|
|
1630
|
+
| --- | --- | --- | --- | --- |
|
|
1631
|
+
| scopeId | string \| null | No | null | - |
|
|
1632
|
+
|
|
1633
|
+
**Returns**
|
|
1634
|
+
- Type: `number`
|
|
1635
|
+
- Get header row index of scope.
|
|
1636
|
+
|
|
1637
|
+
#### `getColumnFilter(colIndex, scopeId = null): Object | null`
|
|
1638
|
+
|
|
1639
|
+
**Parameters**
|
|
1640
|
+
| Name | Type | Required | Default | Description |
|
|
1641
|
+
| --- | --- | --- | --- | --- |
|
|
1642
|
+
| colIndex | number | Yes | - | - |
|
|
1643
|
+
| scopeId | string \| null | No | null | - |
|
|
1644
|
+
|
|
1645
|
+
**Returns**
|
|
1646
|
+
- Type: `Object | null`
|
|
1647
|
+
- Get filter config for column in scope.
|
|
1648
|
+
|
|
1649
|
+
#### `getEnabledScopes(): Array<{scopeId:string,ownerType:string,ownerId:string | null,range:{s:{r:number,c:number},e:{r:number,c:number}},headerRow:number}>`
|
|
1650
|
+
|
|
1651
|
+
**Returns**
|
|
1652
|
+
- Type: `Array<{scopeId:string,ownerType:string,ownerId:string | null,range:{s:{r:number,c:number},e:{r:number,c:number}},headerRow:number}>`
|
|
1653
|
+
- List enabled scopes sorted by range.
|
|
1654
|
+
|
|
1655
|
+
#### `registerTableScope(table, options = {}): string | null`
|
|
1656
|
+
|
|
1657
|
+
**Parameters**
|
|
1658
|
+
| Name | Type | Required | Default | Description |
|
|
1659
|
+
| --- | --- | --- | --- | --- |
|
|
1660
|
+
| table | Object | Yes | - | - |
|
|
1661
|
+
| options | Object | No | {} | - |
|
|
1662
|
+
|
|
1663
|
+
**Returns**
|
|
1664
|
+
- Type: `string | null`
|
|
1665
|
+
- Register or update filter scope for table.
|
|
1666
|
+
|
|
1667
|
+
#### `unregisterTableScope(tableId, options = {}): void`
|
|
1668
|
+
|
|
1669
|
+
**Parameters**
|
|
1670
|
+
| Name | Type | Required | Default | Description |
|
|
1671
|
+
| --- | --- | --- | --- | --- |
|
|
1672
|
+
| tableId | string | Yes | - | - |
|
|
1673
|
+
| options | {silent?:boolean} | No | {} | - |
|
|
1674
|
+
|
|
1675
|
+
**Returns**
|
|
1676
|
+
- Unregister table scope and refresh view state.
|
|
1677
|
+
|
|
1678
|
+
#### `setRange(range, scopeId = this._defaultScopeId)`
|
|
1679
|
+
- Set filter scope (default sheet scope; scopeId can be specified)
|
|
1680
|
+
|
|
1681
|
+
**Parameters**
|
|
1682
|
+
| Name | Type | Required | Default | Description |
|
|
1683
|
+
| --- | --- | --- | --- | --- |
|
|
1684
|
+
| range | {s: {r: number, c: number}, e: {r: number, c: number}} | Yes | - | - |
|
|
1685
|
+
| scopeId | string | No | this._defaultScopeId | - |
|
|
1686
|
+
|
|
1687
|
+
#### `isColumnInRange(colIndex, scopeId = null)`
|
|
1688
|
+
- Determine if a column is within the filter range
|
|
1689
|
+
|
|
1690
|
+
**Parameters**
|
|
1691
|
+
| Name | Type | Required | Default | Description |
|
|
1692
|
+
| --- | --- | --- | --- | --- |
|
|
1693
|
+
| colIndex | number | Yes | - | - |
|
|
1694
|
+
| scopeId | string | No | null | - |
|
|
1695
|
+
|
|
1696
|
+
#### `isHeaderRow(rowIndex, scopeId = null)`
|
|
1697
|
+
- Determine if a row is a table header row
|
|
1698
|
+
|
|
1699
|
+
**Parameters**
|
|
1700
|
+
| Name | Type | Required | Default | Description |
|
|
1701
|
+
| --- | --- | --- | --- | --- |
|
|
1702
|
+
| rowIndex | number | Yes | - | - |
|
|
1703
|
+
| scopeId | string | No | null | - |
|
|
1704
|
+
|
|
1705
|
+
#### `getColumnValues(colIndex, scopeId = null): Array<{value: any, text: string, count: number, isEmpty: boolean}>`
|
|
1706
|
+
- Get all unique values for a column (for filter panel)
|
|
1707
|
+
|
|
1708
|
+
**Parameters**
|
|
1709
|
+
| Name | Type | Required | Default | Description |
|
|
1710
|
+
| --- | --- | --- | --- | --- |
|
|
1711
|
+
| colIndex | number | Yes | - | - |
|
|
1712
|
+
| scopeId | string | No | null | - |
|
|
1713
|
+
|
|
1714
|
+
**Returns**
|
|
1715
|
+
- Type: `Array<{value: any, text: string, count: number, isEmpty: boolean}>`
|
|
1716
|
+
|
|
1717
|
+
#### `setColumnFilter(colIndex, filter, scopeId = null)`
|
|
1718
|
+
- Set column filters
|
|
1719
|
+
|
|
1720
|
+
**Parameters**
|
|
1721
|
+
| Name | Type | Required | Default | Description |
|
|
1722
|
+
| --- | --- | --- | --- | --- |
|
|
1723
|
+
| colIndex | number | Yes | - | - |
|
|
1724
|
+
| filter | Object | Yes | - | - |
|
|
1725
|
+
| scopeId | string | No | null | - |
|
|
1726
|
+
|
|
1727
|
+
#### `clearColumnFilter(colIndex, scopeId = null)`
|
|
1728
|
+
- Clear a column filter
|
|
1729
|
+
|
|
1730
|
+
**Parameters**
|
|
1731
|
+
| Name | Type | Required | Default | Description |
|
|
1732
|
+
| --- | --- | --- | --- | --- |
|
|
1733
|
+
| colIndex | number | Yes | - | - |
|
|
1734
|
+
| scopeId | string | No | null | - |
|
|
1735
|
+
|
|
1736
|
+
#### `clearAllFilters(scopeId = null)`
|
|
1737
|
+
- Clear filters (reserved range)
|
|
1738
|
+
|
|
1739
|
+
**Parameters**
|
|
1740
|
+
| Name | Type | Required | Default | Description |
|
|
1741
|
+
| --- | --- | --- | --- | --- |
|
|
1742
|
+
| scopeId | string | No | null | - |
|
|
1743
|
+
|
|
1744
|
+
#### `clear(scopeId = this._defaultScopeId)`
|
|
1745
|
+
- Clear filters completely (inclusive)
|
|
1746
|
+
|
|
1747
|
+
**Parameters**
|
|
1748
|
+
| Name | Type | Required | Default | Description |
|
|
1749
|
+
| --- | --- | --- | --- | --- |
|
|
1750
|
+
| scopeId | string | No | this._defaultScopeId | - |
|
|
1751
|
+
|
|
1752
|
+
#### `hasFilter(colIndex, scopeId = null)`
|
|
1753
|
+
- Determine if columns are filtered
|
|
1754
|
+
|
|
1755
|
+
**Parameters**
|
|
1756
|
+
| Name | Type | Required | Default | Description |
|
|
1757
|
+
| --- | --- | --- | --- | --- |
|
|
1758
|
+
| colIndex | number | Yes | - | - |
|
|
1759
|
+
| scopeId | string | No | null | - |
|
|
1760
|
+
|
|
1761
|
+
#### `setSortState(colIndex, order, scopeId = null)`
|
|
1762
|
+
- Set sorting status
|
|
1763
|
+
|
|
1764
|
+
**Parameters**
|
|
1765
|
+
| Name | Type | Required | Default | Description |
|
|
1766
|
+
| --- | --- | --- | --- | --- |
|
|
1767
|
+
| colIndex | number | Yes | - | - |
|
|
1768
|
+
| order | 'asc' \| 'desc' | Yes | - | - |
|
|
1769
|
+
| scopeId | string | No | null | - |
|
|
1770
|
+
|
|
1771
|
+
#### `getSortOrder(colIndex, scopeId = null)`
|
|
1772
|
+
- Get sorting status
|
|
1773
|
+
|
|
1774
|
+
**Parameters**
|
|
1775
|
+
| Name | Type | Required | Default | Description |
|
|
1776
|
+
| --- | --- | --- | --- | --- |
|
|
1777
|
+
| colIndex | number | Yes | - | - |
|
|
1778
|
+
| scopeId | string | No | null | - |
|
|
1779
|
+
|
|
1780
|
+
#### `isRowFilteredHidden(rowIndex): boolean`
|
|
1781
|
+
- Whether the row is hidden due to filtering
|
|
1782
|
+
|
|
1783
|
+
**Parameters**
|
|
1784
|
+
| Name | Type | Required | Default | Description |
|
|
1785
|
+
| --- | --- | --- | --- | --- |
|
|
1786
|
+
| rowIndex | number | Yes | - | - |
|
|
1787
|
+
|
|
1788
|
+
**Returns**
|
|
1789
|
+
- Type: `boolean`
|
|
1790
|
+
|
|
1791
|
+
#### `parse(xmlObj)`
|
|
1792
|
+
- Resolve default scopes from sheet AutoFilter
|
|
1793
|
+
|
|
1794
|
+
**Parameters**
|
|
1795
|
+
| Name | Type | Required | Default | Description |
|
|
1796
|
+
| --- | --- | --- | --- | --- |
|
|
1797
|
+
| xmlObj | Object | Yes | - | - |
|
|
1798
|
+
|
|
1799
|
+
#### `parseScope(scopeId, autoFilterXml, options = {})`
|
|
1800
|
+
- Resolves the filter state of the specified scope to memory (mainly for table import)
|
|
1801
|
+
|
|
1802
|
+
**Parameters**
|
|
1803
|
+
| Name | Type | Required | Default | Description |
|
|
1804
|
+
| --- | --- | --- | --- | --- |
|
|
1805
|
+
| scopeId | string | Yes | - | - |
|
|
1806
|
+
| autoFilterXml | Object | Yes | - | - |
|
|
1807
|
+
| options | {range?: Object, restoreHiddenRowsFromSheet?: boolean, ownerType?: string, ownerId?: string} | No | {} | - |
|
|
1808
|
+
|
|
1809
|
+
#### `buildXml(scopeId = this._defaultScopeId): Object | null`
|
|
1810
|
+
- Build the XML for the specified scope; export the sheet scope by default
|
|
1811
|
+
|
|
1812
|
+
**Parameters**
|
|
1813
|
+
| Name | Type | Required | Default | Description |
|
|
1814
|
+
| --- | --- | --- | --- | --- |
|
|
1815
|
+
| scopeId | string | No | this._defaultScopeId | - |
|
|
1816
|
+
|
|
1817
|
+
**Returns**
|
|
1818
|
+
- Type: `Object | null`
|
|
1819
|
+
|
|
1820
|
+
## Table
|
|
1821
|
+
|
|
1822
|
+
### Props
|
|
1823
|
+
| Name | Type | Static | Default | Description |
|
|
1824
|
+
| --- | --- | --- | --- | --- |
|
|
1825
|
+
| sheet | Sheet | No | sheet | - |
|
|
1826
|
+
|
|
1827
|
+
### Get
|
|
1828
|
+
| Name | Type | Static | Description |
|
|
1829
|
+
| --- | --- | --- | --- |
|
|
1830
|
+
| size | number | No | - |
|
|
1831
|
+
|
|
1832
|
+
### Methods
|
|
1833
|
+
#### `getAll(): TableItem[]`
|
|
1834
|
+
|
|
1835
|
+
**Returns**
|
|
1836
|
+
- Type: `TableItem[]`
|
|
1837
|
+
|
|
1838
|
+
#### `get(id): TableItem | null`
|
|
1839
|
+
- Get table from ID
|
|
1840
|
+
|
|
1841
|
+
**Parameters**
|
|
1842
|
+
| Name | Type | Required | Default | Description |
|
|
1843
|
+
| --- | --- | --- | --- | --- |
|
|
1844
|
+
| id | string | Yes | - | - |
|
|
1845
|
+
|
|
1846
|
+
**Returns**
|
|
1847
|
+
- Type: `TableItem | null`
|
|
1848
|
+
|
|
1849
|
+
#### `getByName(name): TableItem | null`
|
|
1850
|
+
- Get table by name
|
|
1851
|
+
|
|
1852
|
+
**Parameters**
|
|
1853
|
+
| Name | Type | Required | Default | Description |
|
|
1854
|
+
| --- | --- | --- | --- | --- |
|
|
1855
|
+
| name | string | Yes | - | - |
|
|
1856
|
+
|
|
1857
|
+
**Returns**
|
|
1858
|
+
- Type: `TableItem | null`
|
|
1859
|
+
|
|
1860
|
+
#### `getTableAt(row, col): TableItem | null`
|
|
1861
|
+
- Get tables containing specified cells
|
|
1862
|
+
|
|
1863
|
+
**Parameters**
|
|
1864
|
+
| Name | Type | Required | Default | Description |
|
|
1865
|
+
| --- | --- | --- | --- | --- |
|
|
1866
|
+
| row | number | Yes | - | - |
|
|
1867
|
+
| col | number | Yes | - | - |
|
|
1868
|
+
|
|
1869
|
+
**Returns**
|
|
1870
|
+
- Type: `TableItem | null`
|
|
1871
|
+
|
|
1872
|
+
#### `add(options = {}): TableItem`
|
|
1873
|
+
- Add/create new table
|
|
1874
|
+
|
|
1875
|
+
**Parameters**
|
|
1876
|
+
| Name | Type | Required | Default | Description |
|
|
1877
|
+
| --- | --- | --- | --- | --- |
|
|
1878
|
+
| options | Object | No | {} | - |
|
|
1879
|
+
|
|
1880
|
+
**Returns**
|
|
1881
|
+
- Type: `TableItem`
|
|
1882
|
+
|
|
1883
|
+
**Examples**
|
|
1884
|
+
```js
|
|
1885
|
+
const table = SN.activeSheet.Table;
|
|
1886
|
+
|
|
1887
|
+
table.add({
|
|
1888
|
+
rangeRef: 'A1:D10',
|
|
1889
|
+
name: 'Sales',
|
|
1890
|
+
showHeaderRow: true,
|
|
1891
|
+
showRowStripes: true
|
|
1892
|
+
});
|
|
1893
|
+
```
|
|
1894
|
+
|
|
1895
|
+
#### `createFromSelection(area, options = {}): TableItem`
|
|
1896
|
+
- Create Table from Selection
|
|
1897
|
+
|
|
1898
|
+
**Parameters**
|
|
1899
|
+
| Name | Type | Required | Default | Description |
|
|
1900
|
+
| --- | --- | --- | --- | --- |
|
|
1901
|
+
| area | Object | Yes | - | { s: {r, c}, e: {r, c} } |
|
|
1902
|
+
| options | Object | No | {} | - |
|
|
1903
|
+
|
|
1904
|
+
**Returns**
|
|
1905
|
+
- Type: `TableItem`
|
|
1906
|
+
|
|
1907
|
+
#### `remove(id): boolean`
|
|
1908
|
+
- Remove Table
|
|
1909
|
+
|
|
1910
|
+
**Parameters**
|
|
1911
|
+
| Name | Type | Required | Default | Description |
|
|
1912
|
+
| --- | --- | --- | --- | --- |
|
|
1913
|
+
| id | string | Yes | - | Form ID |
|
|
1914
|
+
|
|
1915
|
+
**Returns**
|
|
1916
|
+
- Type: `boolean`
|
|
1917
|
+
|
|
1918
|
+
#### `removeByName(name): boolean`
|
|
1919
|
+
- Remove table by name
|
|
1920
|
+
|
|
1921
|
+
**Parameters**
|
|
1922
|
+
| Name | Type | Required | Default | Description |
|
|
1923
|
+
| --- | --- | --- | --- | --- |
|
|
1924
|
+
| name | string | Yes | - | - |
|
|
1925
|
+
|
|
1926
|
+
**Returns**
|
|
1927
|
+
- Type: `boolean`
|
|
1928
|
+
|
|
1929
|
+
#### `forEach(callback)`
|
|
1930
|
+
- Walk through all tables
|
|
1931
|
+
|
|
1932
|
+
**Parameters**
|
|
1933
|
+
| Name | Type | Required | Default | Description |
|
|
1934
|
+
| --- | --- | --- | --- | --- |
|
|
1935
|
+
| callback | Function | Yes | - | - |
|
|
1936
|
+
|
|
1937
|
+
#### `toJSON()`
|
|
1938
|
+
- Convert to JSON array
|
|
1939
|
+
|
|
1940
|
+
#### `fromJSON(jsonArray)`
|
|
1941
|
+
- Restore from JSON
|
|
1942
|
+
|
|
1943
|
+
**Parameters**
|
|
1944
|
+
| Name | Type | Required | Default | Description |
|
|
1945
|
+
| --- | --- | --- | --- | --- |
|
|
1946
|
+
| jsonArray | Array | Yes | - | - |
|
|
1947
|
+
|
|
1948
|
+
## Drawing
|
|
1949
|
+
- Drawing manager - CRUD, XML parse & export
|
|
1950
|
+
|
|
1951
|
+
### Props
|
|
1952
|
+
| Name | Type | Static | Default | Description |
|
|
1953
|
+
| --- | --- | --- | --- | --- |
|
|
1954
|
+
| sheet | Sheet | No | sheet | - |
|
|
1955
|
+
| map | Map<string, DrawingItem> | No | new Map() | - |
|
|
1956
|
+
|
|
1957
|
+
### Methods
|
|
1958
|
+
#### `addChart(chartOption, options?): DrawingItem`
|
|
1959
|
+
|
|
1960
|
+
**Parameters**
|
|
1961
|
+
| Name | Type | Required | Default | Description |
|
|
1962
|
+
| --- | --- | --- | --- | --- |
|
|
1963
|
+
| chartOption | Object | Yes | - | - |
|
|
1964
|
+
| options | DrawingOptions | No | - | - |
|
|
1965
|
+
|
|
1966
|
+
**Returns**
|
|
1967
|
+
- Type: `DrawingItem`
|
|
1968
|
+
|
|
1969
|
+
**Examples**
|
|
1970
|
+
```js
|
|
1971
|
+
const sheet = SN.activeSheet;
|
|
1972
|
+
|
|
1973
|
+
sheet.Drawing.addChart({
|
|
1974
|
+
title: { text: 'Sales trend chart' },
|
|
1975
|
+
legend: {
|
|
1976
|
+
data: `${sheet.name}!B3`
|
|
1977
|
+
},
|
|
1978
|
+
xAxis: {
|
|
1979
|
+
type: 'category',
|
|
1980
|
+
data: `${sheet.name}!C2:E2`
|
|
1981
|
+
},
|
|
1982
|
+
yAxis: { type: 'value' },
|
|
1983
|
+
series: [{
|
|
1984
|
+
name: 'Sales volume',
|
|
1985
|
+
type: 'line',
|
|
1986
|
+
data: `${sheet.name}!C3:E3`
|
|
1987
|
+
}]
|
|
1988
|
+
}, {
|
|
1989
|
+
startCell: 'B2'
|
|
1990
|
+
});
|
|
1991
|
+
```
|
|
1992
|
+
|
|
1993
|
+
#### `addImage(imageBase64, options?): DrawingItem`
|
|
1994
|
+
|
|
1995
|
+
**Parameters**
|
|
1996
|
+
| Name | Type | Required | Default | Description |
|
|
1997
|
+
| --- | --- | --- | --- | --- |
|
|
1998
|
+
| imageBase64 | string | Yes | - | - |
|
|
1999
|
+
| options | DrawingOptions | No | - | - |
|
|
2000
|
+
|
|
2001
|
+
**Returns**
|
|
2002
|
+
- Type: `DrawingItem`
|
|
2003
|
+
|
|
2004
|
+
#### `addShape(shapeType, options?): DrawingItem`
|
|
2005
|
+
|
|
2006
|
+
**Parameters**
|
|
2007
|
+
| Name | Type | Required | Default | Description |
|
|
2008
|
+
| --- | --- | --- | --- | --- |
|
|
2009
|
+
| shapeType | string | Yes | - | - |
|
|
2010
|
+
| options | DrawingOptions | No | - | - |
|
|
2011
|
+
|
|
2012
|
+
**Returns**
|
|
2013
|
+
- Type: `DrawingItem`
|
|
2014
|
+
|
|
2015
|
+
#### `remove(id)`
|
|
2016
|
+
|
|
2017
|
+
**Parameters**
|
|
2018
|
+
| Name | Type | Required | Default | Description |
|
|
2019
|
+
| --- | --- | --- | --- | --- |
|
|
2020
|
+
| id | string | Yes | - | - |
|
|
2021
|
+
|
|
2022
|
+
#### `get(id): DrawingItem | null`
|
|
2023
|
+
|
|
2024
|
+
**Parameters**
|
|
2025
|
+
| Name | Type | Required | Default | Description |
|
|
2026
|
+
| --- | --- | --- | --- | --- |
|
|
2027
|
+
| id | string | Yes | - | - |
|
|
2028
|
+
|
|
2029
|
+
**Returns**
|
|
2030
|
+
- Type: `DrawingItem | null`
|
|
2031
|
+
|
|
2032
|
+
#### `getByCell(cellRef): DrawingItem[]`
|
|
2033
|
+
|
|
2034
|
+
**Parameters**
|
|
2035
|
+
| Name | Type | Required | Default | Description |
|
|
2036
|
+
| --- | --- | --- | --- | --- |
|
|
2037
|
+
| cellRef | Object \| string | Yes | - | - |
|
|
2038
|
+
|
|
2039
|
+
**Returns**
|
|
2040
|
+
- Type: `DrawingItem[]`
|
|
2041
|
+
|
|
2042
|
+
#### `getAll(): DrawingItem[]`
|
|
2043
|
+
|
|
2044
|
+
**Returns**
|
|
2045
|
+
- Type: `DrawingItem[]`
|
|
2046
|
+
|
|
2047
|
+
## Comment
|
|
2048
|
+
- Comment Manager<br>High-performance design: Map index (cellRef - > CommentItem) + O (1) lookup<br>Architectural Reference: Fully Replicated Drawing Design Patterns
|
|
2049
|
+
|
|
2050
|
+
### Props
|
|
2051
|
+
| Name | Type | Static | Default | Description |
|
|
2052
|
+
| --- | --- | --- | --- | --- |
|
|
2053
|
+
| sheet | Sheet | No | sheet | - |
|
|
2054
|
+
| map | Map<string, CommentItem> | No | new Map() | - |
|
|
2055
|
+
|
|
2056
|
+
### Methods
|
|
2057
|
+
#### `parse(xmlObj)`
|
|
2058
|
+
- Parsing comment data from xmlObj (imported from an Excel file)
|
|
2059
|
+
|
|
2060
|
+
**Parameters**
|
|
2061
|
+
| Name | Type | Required | Default | Description |
|
|
2062
|
+
| --- | --- | --- | --- | --- |
|
|
2063
|
+
| xmlObj | Object | Yes | - | XML Object for Sheet |
|
|
2064
|
+
|
|
2065
|
+
#### `add(config = {}): CommentItem`
|
|
2066
|
+
- Add Comment
|
|
2067
|
+
|
|
2068
|
+
**Parameters**
|
|
2069
|
+
| Name | Type | Required | Default | Description |
|
|
2070
|
+
| --- | --- | --- | --- | --- |
|
|
2071
|
+
| config | Object | No | {} | {cellRef, author, text, visible, ...} |
|
|
2072
|
+
|
|
2073
|
+
**Returns**
|
|
2074
|
+
- Type: `CommentItem`
|
|
2075
|
+
|
|
2076
|
+
#### `get(cellRef): CommentItem | null`
|
|
2077
|
+
- Get comments
|
|
2078
|
+
|
|
2079
|
+
**Parameters**
|
|
2080
|
+
| Name | Type | Required | Default | Description |
|
|
2081
|
+
| --- | --- | --- | --- | --- |
|
|
2082
|
+
| cellRef | string | Yes | - | Cell reference "A1" |
|
|
2083
|
+
|
|
2084
|
+
**Returns**
|
|
2085
|
+
- Type: `CommentItem | null`
|
|
2086
|
+
|
|
2087
|
+
#### `remove(cellRef): boolean`
|
|
2088
|
+
- Delete Comment
|
|
2089
|
+
|
|
2090
|
+
**Parameters**
|
|
2091
|
+
| Name | Type | Required | Default | Description |
|
|
2092
|
+
| --- | --- | --- | --- | --- |
|
|
2093
|
+
| cellRef | string | Yes | - | Cell reference "A1" |
|
|
2094
|
+
|
|
2095
|
+
**Returns**
|
|
2096
|
+
- Type: `boolean`
|
|
2097
|
+
|
|
2098
|
+
#### `getAll(): CommentItem[]`
|
|
2099
|
+
- Get a list of all comments
|
|
2100
|
+
|
|
2101
|
+
**Returns**
|
|
2102
|
+
- Type: `CommentItem[]`
|
|
2103
|
+
|
|
2104
|
+
#### `clearCache()`
|
|
2105
|
+
- Clear the location cache for all comment (called when the view changes)
|
|
2106
|
+
|
|
2107
|
+
#### `toXmlObject(): Object | null`
|
|
2108
|
+
- Export as XML object (for Excel export)<br>Convert thread comment to normal comment format
|
|
2109
|
+
|
|
2110
|
+
**Returns**
|
|
2111
|
+
- Type: `Object | null`
|
|
2112
|
+
|
|
2113
|
+
## PivotTable
|
|
2114
|
+
- Perspective Table Manager<br>I'm in charge of the retrospect.
|
|
2115
|
+
|
|
2116
|
+
### Props
|
|
2117
|
+
| Name | Type | Static | Default | Description |
|
|
2118
|
+
| --- | --- | --- | --- | --- |
|
|
2119
|
+
| sheet | Sheet | No | sheet | - |
|
|
2120
|
+
| map | Map<string, PivotTableItem> | No | new Map() | - |
|
|
2121
|
+
|
|
2122
|
+
### Get
|
|
2123
|
+
| Name | Type | Static | Description |
|
|
2124
|
+
| --- | --- | --- | --- |
|
|
2125
|
+
| size | number | No | - |
|
|
2126
|
+
|
|
2127
|
+
### Methods
|
|
2128
|
+
#### `add(config): PivotTable`
|
|
2129
|
+
- Add Perceive Table
|
|
2130
|
+
|
|
2131
|
+
**Parameters**
|
|
2132
|
+
| Name | Type | Required | Default | Description |
|
|
2133
|
+
| --- | --- | --- | --- | --- |
|
|
2134
|
+
| config | Object | Yes | - | Configure Object |
|
|
2135
|
+
| config.sourceSheet | Sheet | Yes | - | Source Sheet |
|
|
2136
|
+
| config.sourceRangeRef | string | Yes | - | Source range |
|
|
2137
|
+
| config.cellRef | string \| Object | Yes | - | target cell<br>Is there a cycle for |
|
|
2138
|
+
|
|
2139
|
+
**Returns**
|
|
2140
|
+
- Type: `PivotTable`
|
|
2141
|
+
|
|
2142
|
+
**Examples**
|
|
2143
|
+
```js
|
|
2144
|
+
const sheet = SN.activeSheet;
|
|
2145
|
+
const pt = sheet.PivotTable.add({
|
|
2146
|
+
sourceSheet: sheet,
|
|
2147
|
+
sourceRangeRef: 'A1:D100',
|
|
2148
|
+
cellRef: 'F1',
|
|
2149
|
+
name: 'SalesPivot'
|
|
2150
|
+
});
|
|
2151
|
+
|
|
2152
|
+
// fieldIndex is the 0-based source column index.
|
|
2153
|
+
pt.addRowField(0);
|
|
2154
|
+
pt.addColField(1);
|
|
2155
|
+
pt.addDataField(3, 'sum');
|
|
2156
|
+
pt.setFieldSort(0, 'asc');
|
|
2157
|
+
pt.refresh();
|
|
2158
|
+
```
|
|
2159
|
+
|
|
2160
|
+
#### `remove(name)`
|
|
2161
|
+
- Remove Perceive Table
|
|
2162
|
+
|
|
2163
|
+
**Parameters**
|
|
2164
|
+
| Name | Type | Required | Default | Description |
|
|
2165
|
+
| --- | --- | --- | --- | --- |
|
|
2166
|
+
| name | string | Yes | - | Vision Table Name |
|
|
2167
|
+
|
|
2168
|
+
#### `get(name): PivotTable | null`
|
|
2169
|
+
- Get a visual watch
|
|
2170
|
+
|
|
2171
|
+
**Parameters**
|
|
2172
|
+
| Name | Type | Required | Default | Description |
|
|
2173
|
+
| --- | --- | --- | --- | --- |
|
|
2174
|
+
| name | string | Yes | - | - |
|
|
2175
|
+
|
|
2176
|
+
**Returns**
|
|
2177
|
+
- Type: `PivotTable | null`
|
|
2178
|
+
|
|
2179
|
+
#### `getAll(): Array<PivotTable>`
|
|
2180
|
+
- Get all view tables
|
|
2181
|
+
|
|
2182
|
+
**Returns**
|
|
2183
|
+
- Type: `Array<PivotTable>`
|
|
2184
|
+
|
|
2185
|
+
#### `forEach(callback)`
|
|
2186
|
+
- I've been through all of them.
|
|
2187
|
+
|
|
2188
|
+
**Parameters**
|
|
2189
|
+
| Name | Type | Required | Default | Description |
|
|
2190
|
+
| --- | --- | --- | --- | --- |
|
|
2191
|
+
| callback | Function | Yes | - | - |
|
|
2192
|
+
|
|
2193
|
+
#### `refreshAll()`
|
|
2194
|
+
- Refresh all view tables
|
|
2195
|
+
|
|
2196
|
+
## Slicer
|
|
2197
|
+
- Slicer Manager<br>We'll be in charge of the cutter.
|
|
2198
|
+
|
|
2199
|
+
### Props
|
|
2200
|
+
| Name | Type | Static | Default | Description |
|
|
2201
|
+
| --- | --- | --- | --- | --- |
|
|
2202
|
+
| sheet | Sheet | No | sheet | - |
|
|
2203
|
+
| map | Map<string, SlicerItem> | No | new Map() | - |
|
|
2204
|
+
|
|
2205
|
+
### Get
|
|
2206
|
+
| Name | Type | Static | Description |
|
|
2207
|
+
| --- | --- | --- | --- |
|
|
2208
|
+
| size | number | No | - |
|
|
2209
|
+
|
|
2210
|
+
### Methods
|
|
2211
|
+
#### `add(config): Slicer`
|
|
2212
|
+
- Add Slicer
|
|
2213
|
+
|
|
2214
|
+
**Parameters**
|
|
2215
|
+
| Name | Type | Required | Default | Description |
|
|
2216
|
+
| --- | --- | --- | --- | --- |
|
|
2217
|
+
| config | Object | Yes | - | Configure Object |
|
|
2218
|
+
|
|
2219
|
+
**Returns**
|
|
2220
|
+
- Type: `Slicer`
|
|
2221
|
+
|
|
2222
|
+
#### `remove(id)`
|
|
2223
|
+
- Remove Slicer
|
|
2224
|
+
|
|
2225
|
+
**Parameters**
|
|
2226
|
+
| Name | Type | Required | Default | Description |
|
|
2227
|
+
| --- | --- | --- | --- | --- |
|
|
2228
|
+
| id | string | Yes | - | - |
|
|
2229
|
+
|
|
2230
|
+
#### `get(id): Slicer | null`
|
|
2231
|
+
- Get Slice
|
|
2232
|
+
|
|
2233
|
+
**Parameters**
|
|
2234
|
+
| Name | Type | Required | Default | Description |
|
|
2235
|
+
| --- | --- | --- | --- | --- |
|
|
2236
|
+
| id | string | Yes | - | - |
|
|
2237
|
+
|
|
2238
|
+
**Returns**
|
|
2239
|
+
- Type: `Slicer | null`
|
|
2240
|
+
|
|
2241
|
+
#### `getAll(): Array<Slicer>`
|
|
2242
|
+
- Get all the slicers.
|
|
2243
|
+
|
|
2244
|
+
**Returns**
|
|
2245
|
+
- Type: `Array<Slicer>`
|
|
2246
|
+
|
|
2247
|
+
#### `forEach(callback)`
|
|
2248
|
+
- All the slicers.
|
|
2249
|
+
|
|
2250
|
+
**Parameters**
|
|
2251
|
+
| Name | Type | Required | Default | Description |
|
|
2252
|
+
| --- | --- | --- | --- | --- |
|
|
2253
|
+
| callback | Function | Yes | - | - |
|
|
2254
|
+
|
|
2255
|
+
## Sparkline
|
|
2256
|
+
- Mini Chart Manager
|
|
2257
|
+
|
|
2258
|
+
### Props
|
|
2259
|
+
| Name | Type | Static | Default | Description |
|
|
2260
|
+
| --- | --- | --- | --- | --- |
|
|
2261
|
+
| sheet | Sheet | No | sheet | Sheet it belongs to |
|
|
2262
|
+
| map | Map<string, SparklineItem> | No | new Map() | Minimap indexed by location Map: "R:C" - > SparklineItem |
|
|
2263
|
+
| groups | Array<Object> | No | [] | Minimap List |
|
|
2264
|
+
|
|
2265
|
+
### Methods
|
|
2266
|
+
#### `add(config): SparklineItem | null`
|
|
2267
|
+
- Add Minimap
|
|
2268
|
+
|
|
2269
|
+
**Parameters**
|
|
2270
|
+
| Name | Type | Required | Default | Description |
|
|
2271
|
+
| --- | --- | --- | --- | --- |
|
|
2272
|
+
| config | Object | Yes | - | Configure Object |
|
|
2273
|
+
| config.cellRef | string \| Object | Yes | - | Cell references "A1" or {r, c} |
|
|
2274
|
+
| config.formula | string | Yes | - | Data Range Formula |
|
|
2275
|
+
| config.type | string | No | 'line' | Miniature Type |
|
|
2276
|
+
| config.colors | Object | No | {} | Colour Configuration |
|
|
2277
|
+
|
|
2278
|
+
**Returns**
|
|
2279
|
+
- Type: `SparklineItem | null`
|
|
2280
|
+
|
|
2281
|
+
**Examples**
|
|
2282
|
+
```js
|
|
2283
|
+
const sparkline = SN.activeSheet.Sparkline;
|
|
2284
|
+
|
|
2285
|
+
sparkline.add({
|
|
2286
|
+
cellRef: 'D1',
|
|
2287
|
+
formula: 'A1:C1',
|
|
2288
|
+
type: 'column',
|
|
2289
|
+
colors: {
|
|
2290
|
+
series: '#376092',
|
|
2291
|
+
negative: '#D00000',
|
|
2292
|
+
high: '#00B050',
|
|
2293
|
+
low: '#FF6600'
|
|
2294
|
+
}
|
|
2295
|
+
});
|
|
2296
|
+
```
|
|
2297
|
+
|
|
2298
|
+
#### `remove(cellRef): boolean`
|
|
2299
|
+
- Delete Minimap
|
|
2300
|
+
|
|
2301
|
+
**Parameters**
|
|
2302
|
+
| Name | Type | Required | Default | Description |
|
|
2303
|
+
| --- | --- | --- | --- | --- |
|
|
2304
|
+
| cellRef | string \| Object | Yes | - | Cell references "A1" or {r, c} |
|
|
2305
|
+
|
|
2306
|
+
**Returns**
|
|
2307
|
+
- Type: `boolean`
|
|
2308
|
+
|
|
2309
|
+
#### `get(cellRef): SparklineItem | null`
|
|
2310
|
+
- Fetch Minimap Based on Cell Location
|
|
2311
|
+
|
|
2312
|
+
**Parameters**
|
|
2313
|
+
| Name | Type | Required | Default | Description |
|
|
2314
|
+
| --- | --- | --- | --- | --- |
|
|
2315
|
+
| cellRef | string \| Object | Yes | - | Cell references "A1" or {r, c} |
|
|
2316
|
+
|
|
2317
|
+
**Returns**
|
|
2318
|
+
- Type: `SparklineItem | null`
|
|
2319
|
+
|
|
2320
|
+
#### `getAll(): Array<SparklineItem>`
|
|
2321
|
+
- Fetch All Miniature Examples
|
|
2322
|
+
|
|
2323
|
+
**Returns**
|
|
2324
|
+
- Type: `Array<SparklineItem>`
|
|
2325
|
+
|
|
2326
|
+
#### `clearCache(cellRefOrRow, c?)`
|
|
2327
|
+
- Clear the cache of specified minimaps
|
|
2328
|
+
|
|
2329
|
+
**Parameters**
|
|
2330
|
+
| Name | Type | Required | Default | Description |
|
|
2331
|
+
| --- | --- | --- | --- | --- |
|
|
2332
|
+
| cellRefOrRow | string \| Object \| number | Yes | - | Cell references "A1"/{r, c} or line index |
|
|
2333
|
+
| c | number | No | - | Column Index (only when the first parameter is a line index) |
|
|
2334
|
+
|
|
2335
|
+
#### `clearAllCache()`
|
|
2336
|
+
- Clear all caches
|
|
2337
|
+
|
|
2338
|
+
#### `parse(xmlObj)`
|
|
2339
|
+
- Parsing MinimlObj Data
|
|
2340
|
+
|
|
2341
|
+
**Parameters**
|
|
2342
|
+
| Name | Type | Required | Default | Description |
|
|
2343
|
+
| --- | --- | --- | --- | --- |
|
|
2344
|
+
| xmlObj | Object | Yes | - | XML Object for Sheet |
|
|
2345
|
+
|
|
2346
|
+
#### `toXmlObj(): Object | null`
|
|
2347
|
+
- Export to XML Object Structure
|
|
2348
|
+
|
|
2349
|
+
**Returns**
|
|
2350
|
+
- Type: `Object | null`
|
|
2351
|
+
|
|
2352
|
+
## AI
|
|
2353
|
+
- AI assistant module (tool-calling workflow)
|
|
2354
|
+
|
|
2355
|
+
### Methods
|
|
2356
|
+
#### `chatInput(con)`
|
|
2357
|
+
|
|
2358
|
+
**Parameters**
|
|
2359
|
+
| Name | Type | Required | Default | Description |
|
|
2360
|
+
| --- | --- | --- | --- | --- |
|
|
2361
|
+
| con | string | Yes | - | - |
|
|
2362
|
+
|
|
2363
|
+
#### `async conversation(p, joinChat = true): Promise<void>`
|
|
2364
|
+
|
|
2365
|
+
**Parameters**
|
|
2366
|
+
| Name | Type | Required | Default | Description |
|
|
2367
|
+
| --- | --- | --- | --- | --- |
|
|
2368
|
+
| p | string | Yes | - | - |
|
|
2369
|
+
| joinChat | boolean | No | true | - |
|
|
2370
|
+
|
|
2371
|
+
**Returns**
|
|
2372
|
+
- Type: `Promise<void>`
|
|
2373
|
+
|
|
2374
|
+
#### `clearChat()`
|
|
2375
|
+
|
|
2376
|
+
#### `handleFileChange(event)`
|
|
2377
|
+
|
|
2378
|
+
**Parameters**
|
|
2379
|
+
| Name | Type | Required | Default | Description |
|
|
2380
|
+
| --- | --- | --- | --- | --- |
|
|
2381
|
+
| event | Event | Yes | - | - |
|
|
2382
|
+
|
|
2383
|
+
#### `async screenshot(addresses = [])`
|
|
2384
|
+
|
|
2385
|
+
**Parameters**
|
|
2386
|
+
| Name | Type | Required | Default | Description |
|
|
2387
|
+
| --- | --- | --- | --- | --- |
|
|
2388
|
+
| addresses | Array | No | [] | - |
|
|
2389
|
+
|
|
2390
|
+
## SheetProtection
|
|
2391
|
+
|
|
2392
|
+
### Get/Set
|
|
2393
|
+
| Name | Type | Mode | Static | Description |
|
|
2394
|
+
| --- | --- | --- | --- | --- |
|
|
2395
|
+
| selectLockedCells | boolean | get/set | No | - |
|
|
2396
|
+
| selectUnlockedCells | boolean | get/set | No | - |
|
|
2397
|
+
| formatCells | boolean | get/set | No | - |
|
|
2398
|
+
| formatColumns | boolean | get/set | No | - |
|
|
2399
|
+
| formatRows | boolean | get/set | No | - |
|
|
2400
|
+
| insertColumns | boolean | get/set | No | - |
|
|
2401
|
+
| insertRows | boolean | get/set | No | - |
|
|
2402
|
+
| insertHyperlinks | boolean | get/set | No | - |
|
|
2403
|
+
| deleteColumns | boolean | get/set | No | - |
|
|
2404
|
+
| deleteRows | boolean | get/set | No | - |
|
|
2405
|
+
| sort | boolean | get/set | No | - |
|
|
2406
|
+
| autoFilter | boolean | get/set | No | - |
|
|
2407
|
+
| pivotTables | boolean | get/set | No | - |
|
|
2408
|
+
| objects | boolean | get/set | No | - |
|
|
2409
|
+
|
|
2410
|
+
### Get
|
|
2411
|
+
| Name | Type | Static | Description |
|
|
2412
|
+
| --- | --- | --- | --- |
|
|
2413
|
+
| SN | Workbook | No | - |
|
|
2414
|
+
| enabled | boolean | No | - |
|
|
2415
|
+
|
|
2416
|
+
### Methods
|
|
2417
|
+
#### `enable(options = {})`
|
|
2418
|
+
- ENABLE SHEET PROTECTION
|
|
2419
|
+
|
|
2420
|
+
**Parameters**
|
|
2421
|
+
| Name | Type | Required | Default | Description |
|
|
2422
|
+
| --- | --- | --- | --- | --- |
|
|
2423
|
+
| options | Object | No | {} | SAVE OPTIONS |
|
|
2424
|
+
| options.password | string | No | - | EXPRESS PASSWORD (AUTO-HASHI) |
|
|
2425
|
+
| options.passwordHash | string | No | - | HASH'S PASSWORD |
|
|
2426
|
+
| options.selectLockedCells | boolean | No | - | ALLOWS THE SELECTION OF LOCKED CELLS |
|
|
2427
|
+
| options.selectUnlockedCells | boolean | No | - | ALLOW SELECTION OF UNLOCKED CELLS |
|
|
2428
|
+
| options.formatCells | boolean | No | - | ALLOW SETTING CELL FORMATS |
|
|
2429
|
+
| options.formatColumns | boolean | No | - | ALLOW SETTING BAR FORMATS |
|
|
2430
|
+
| options.formatRows | boolean | No | - | ALLOW SETTING LINE FORMATS |
|
|
2431
|
+
| options.insertColumns | boolean | No | - | ALLOW INSERT COLUMNS |
|
|
2432
|
+
| options.insertRows | boolean | No | - | ALLOW INSERT ROWS |
|
|
2433
|
+
| options.insertHyperlinks | boolean | No | - | ALLOW THE INSERTION OF HYPERLINKS |
|
|
2434
|
+
| options.deleteColumns | boolean | No | - | ALLOWS THE DELETION OF COLUMNS |
|
|
2435
|
+
| options.deleteRows | boolean | No | - | ALLOW DELETE ROWS |
|
|
2436
|
+
| options.sort | boolean | No | - | ALLOW SORTING |
|
|
2437
|
+
| options.autoFilter | boolean | No | - | ALLOW AUTOFILTER |
|
|
2438
|
+
| options.pivotTables | boolean | No | - | ALLOW DATA PERCEIVE TABLES |
|
|
2439
|
+
| options.objects | boolean | No | - | ALLOW EDITING OF OBJECTS |
|
|
2440
|
+
|
|
2441
|
+
#### `disable(password?): { ok: boolean, message?: string }`
|
|
2442
|
+
- DISABLE SHEET PROTECTION
|
|
2443
|
+
|
|
2444
|
+
**Parameters**
|
|
2445
|
+
| Name | Type | Required | Default | Description |
|
|
2446
|
+
| --- | --- | --- | --- | --- |
|
|
2447
|
+
| password | string | No | - | Password (if password protected) |
|
|
2448
|
+
|
|
2449
|
+
**Returns**
|
|
2450
|
+
- Type: `{ ok: boolean, message?: string }`
|
|
2451
|
+
|
|
2452
|
+
#### `verifyPassword(input): { ok: boolean, message?: string }`
|
|
2453
|
+
- Authentication password
|
|
2454
|
+
|
|
2455
|
+
**Parameters**
|
|
2456
|
+
| Name | Type | Required | Default | Description |
|
|
2457
|
+
| --- | --- | --- | --- | --- |
|
|
2458
|
+
| input | string | Yes | - | Password entered |
|
|
2459
|
+
|
|
2460
|
+
**Returns**
|
|
2461
|
+
- Type: `{ ok: boolean, message?: string }`
|
|
2462
|
+
|
|
2463
|
+
#### `getOptions(): Object | null`
|
|
2464
|
+
- Get all protection options (for UI display or export)
|
|
2465
|
+
|
|
2466
|
+
**Returns**
|
|
2467
|
+
- Type: `Object | null`
|
|
2468
|
+
|
|
2469
|
+
#### `isCellLocked(cell): boolean`
|
|
2470
|
+
- Check if cells are locked
|
|
2471
|
+
|
|
2472
|
+
**Parameters**
|
|
2473
|
+
| Name | Type | Required | Default | Description |
|
|
2474
|
+
| --- | --- | --- | --- | --- |
|
|
2475
|
+
| cell | Object | Yes | - | Cell Object |
|
|
2476
|
+
|
|
2477
|
+
**Returns**
|
|
2478
|
+
- Type: `boolean`
|
|
2479
|
+
|
|
2480
|
+
#### `isCellSelectable(cell): boolean`
|
|
2481
|
+
- Check if cells are optional
|
|
2482
|
+
|
|
2483
|
+
**Parameters**
|
|
2484
|
+
| Name | Type | Required | Default | Description |
|
|
2485
|
+
| --- | --- | --- | --- | --- |
|
|
2486
|
+
| cell | Object | Yes | - | Cell Object |
|
|
2487
|
+
|
|
2488
|
+
**Returns**
|
|
2489
|
+
- Type: `boolean`
|
|
2490
|
+
|
|
2491
|
+
#### `isAreaSelectable(area): boolean`
|
|
2492
|
+
- Check if the area is optional
|
|
2493
|
+
|
|
2494
|
+
**Parameters**
|
|
2495
|
+
| Name | Type | Required | Default | Description |
|
|
2496
|
+
| --- | --- | --- | --- | --- |
|
|
2497
|
+
| area | Object \| string | Yes | - | Area Object or String |
|
|
2498
|
+
|
|
2499
|
+
**Returns**
|
|
2500
|
+
- Type: `boolean`
|
|
2501
|
+
|
|
2502
|
+
#### `areAreasSelectable(areas): boolean`
|
|
2503
|
+
- Check if multiple areas are optional
|
|
2504
|
+
|
|
2505
|
+
**Parameters**
|
|
2506
|
+
| Name | Type | Required | Default | Description |
|
|
2507
|
+
| --- | --- | --- | --- | --- |
|
|
2508
|
+
| areas | Array | Yes | - | Regional arrays |
|
|
2509
|
+
|
|
2510
|
+
**Returns**
|
|
2511
|
+
- Type: `boolean`
|
|
2512
|
+
|
|
2513
|
+
#### `isSelectionVisible(): boolean`
|
|
2514
|
+
- Whether to allow the selection
|
|
2515
|
+
|
|
2516
|
+
**Returns**
|
|
2517
|
+
- Type: `boolean`
|
|
2518
|
+
|
|
2519
|
+
#### `setCellProtection(area, options = {})`
|
|
2520
|
+
- Set cell protection properties
|
|
2521
|
+
|
|
2522
|
+
**Parameters**
|
|
2523
|
+
| Name | Type | Required | Default | Description |
|
|
2524
|
+
| --- | --- | --- | --- | --- |
|
|
2525
|
+
| area | Object \| string \| Array | Yes | - | Regional |
|
|
2526
|
+
| options | Object | No | {} | { locked?: boolean, hidden?: boolean } |
|
|
2527
|
+
|
|
2528
|
+
#### `buildXmlNode(): Object | null`
|
|
2529
|
+
- SetProtec node for building xlsx export
|
|
2530
|
+
|
|
2531
|
+
**Returns**
|
|
2532
|
+
- Type: `Object | null`
|
|
2533
|
+
|
|
2534
|
+
## CF
|
|
2535
|
+
- CF conditional formatting Manager<br>Responsible for parsing, storing and managing Excel conditional formatting rules
|
|
2536
|
+
|
|
2537
|
+
### Props
|
|
2538
|
+
| Name | Type | Static | Default | Description |
|
|
2539
|
+
| --- | --- | --- | --- | --- |
|
|
2540
|
+
| sheet | Sheet | No | sheet | - |
|
|
2541
|
+
| rules | Array<CFrule | No | [] | - |
|
|
2542
|
+
|
|
2543
|
+
### Methods
|
|
2544
|
+
#### `add(config = {})`
|
|
2545
|
+
- Add conditional formatting rule
|
|
2546
|
+
|
|
2547
|
+
**Parameters**
|
|
2548
|
+
| Name | Type | Required | Default | Description |
|
|
2549
|
+
| --- | --- | --- | --- | --- |
|
|
2550
|
+
| config | Object | No | {} | Rule Configuration |
|
|
2551
|
+
| config.rangeRef | string | Yes | - | Scope of application "A1: D10" |
|
|
2552
|
+
| config.type | string | Yes | - | Rule type (colorScale/dataBar/iconSet/cellIs/expression/top10/aboveAverage/duplicateValues/containsText/timePeriod/containsBlanks/containsErrors)<br>@ returns {CFRule} created rule |
|
|
2553
|
+
|
|
2554
|
+
**Examples**
|
|
2555
|
+
```js
|
|
2556
|
+
const cf = SN.activeSheet.CF;
|
|
2557
|
+
|
|
2558
|
+
cf.add({
|
|
2559
|
+
rangeRef: 'A1:A20',
|
|
2560
|
+
type: 'cellIs',
|
|
2561
|
+
operator: 'greaterThan',
|
|
2562
|
+
formula1: 90,
|
|
2563
|
+
dxf: {
|
|
2564
|
+
font: { color: '#FF0000' },
|
|
2565
|
+
fill: { fgColor: '#FFCCCC' }
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
|
|
2569
|
+
cf.add({
|
|
2570
|
+
rangeRef: 'B1:B20',
|
|
2571
|
+
type: 'colorScale',
|
|
2572
|
+
cfvos: [{ type: 'min' }, { type: 'max' }],
|
|
2573
|
+
colors: ['#FFFFFF', '#FF0000']
|
|
2574
|
+
});
|
|
2575
|
+
```
|
|
2576
|
+
|
|
2577
|
+
#### `remove(index): boolean`
|
|
2578
|
+
- Delete conditional formatting rule
|
|
2579
|
+
|
|
2580
|
+
**Parameters**
|
|
2581
|
+
| Name | Type | Required | Default | Description |
|
|
2582
|
+
| --- | --- | --- | --- | --- |
|
|
2583
|
+
| index | number | Yes | - | Rule index |
|
|
2584
|
+
|
|
2585
|
+
**Returns**
|
|
2586
|
+
- Type: `boolean`
|
|
2587
|
+
|
|
2588
|
+
#### `get(index): CFRule | null`
|
|
2589
|
+
- Fetch the rule
|
|
2590
|
+
|
|
2591
|
+
**Parameters**
|
|
2592
|
+
| Name | Type | Required | Default | Description |
|
|
2593
|
+
| --- | --- | --- | --- | --- |
|
|
2594
|
+
| index | number | Yes | - | Rule index |
|
|
2595
|
+
|
|
2596
|
+
**Returns**
|
|
2597
|
+
- Type: `CFRule | null`
|
|
2598
|
+
|
|
2599
|
+
#### `getAll(): Array<CFRule>`
|
|
2600
|
+
- Get all rules
|
|
2601
|
+
|
|
2602
|
+
**Returns**
|
|
2603
|
+
- Type: `Array<CFRule>`
|
|
2604
|
+
|
|
2605
|
+
#### `parse(xmlObj): void`
|
|
2606
|
+
- Parsing conditional formatting data from xmlObj
|
|
2607
|
+
|
|
2608
|
+
**Parameters**
|
|
2609
|
+
| Name | Type | Required | Default | Description |
|
|
2610
|
+
| --- | --- | --- | --- | --- |
|
|
2611
|
+
| xmlObj | Object | Yes | - | XML Object for Sheet |
|
|
2612
|
+
|
|
2613
|
+
#### `getFormat(r, c)`
|
|
2614
|
+
- Get a cell's conditional formatting
|
|
2615
|
+
|
|
2616
|
+
**Parameters**
|
|
2617
|
+
| Name | Type | Required | Default | Description |
|
|
2618
|
+
| --- | --- | --- | --- | --- |
|
|
2619
|
+
| r | number | Yes | - | Row index |
|
|
2620
|
+
| c | number | Yes | - | Column Index<br>@ returns {Object \| null} formatted object |
|
|
2621
|
+
|
|
2622
|
+
#### `clearAllCache(): void`
|
|
2623
|
+
- Clear all caches
|
|
2624
|
+
|
|
2625
|
+
#### `clearRangeCache(sqref): void`
|
|
2626
|
+
- Clears the cache for the specified range
|
|
2627
|
+
|
|
2628
|
+
**Parameters**
|
|
2629
|
+
| Name | Type | Required | Default | Description |
|
|
2630
|
+
| --- | --- | --- | --- | --- |
|
|
2631
|
+
| sqref | string | Yes | - | Scope |
|
|
2632
|
+
|
|
2633
|
+
#### `toXmlObject(): Array`
|
|
2634
|
+
- Export as an array of sheet XML nodes
|
|
2635
|
+
|
|
2636
|
+
**Returns**
|
|
2637
|
+
- Type: `Array`
|
|
2638
|
+
|
|
2639
|
+
#### `getDxfId(dxf): number`
|
|
2640
|
+
- Get dxf style index (for export)
|
|
2641
|
+
|
|
2642
|
+
**Parameters**
|
|
2643
|
+
| Name | Type | Required | Default | Description |
|
|
2644
|
+
| --- | --- | --- | --- | --- |
|
|
2645
|
+
| dxf | Object | Yes | - | Differentiated Style Objects |
|
|
2646
|
+
|
|
2647
|
+
**Returns**
|
|
2648
|
+
- Type: `number`
|
|
2649
|
+
- dxfId
|
|
2650
|
+
|
|
2651
|
+
#### `getDxfList(): Array`
|
|
2652
|
+
- Get dxf style list (for exporting styles.xml)
|
|
2653
|
+
|
|
2654
|
+
**Returns**
|
|
2655
|
+
- Type: `Array`
|
|
2656
|
+
|
|
2657
|
+
## I18n
|
|
2658
|
+
- Lightweight i18n service with flat key lookup.
|
|
2659
|
+
|
|
2660
|
+
### Props
|
|
2661
|
+
| Name | Type | Static | Default | Description |
|
|
2662
|
+
| --- | --- | --- | --- | --- |
|
|
2663
|
+
| locale | string | No | locale \|\| 'en-US' | - |
|
|
2664
|
+
| fallbackLocale | string | No | fallbackLocale \|\| 'en-US' | - |
|
|
2665
|
+
|
|
2666
|
+
### Methods
|
|
2667
|
+
#### `register(locale, pack)`
|
|
2668
|
+
|
|
2669
|
+
**Parameters**
|
|
2670
|
+
| Name | Type | Required | Default | Description |
|
|
2671
|
+
| --- | --- | --- | --- | --- |
|
|
2672
|
+
| locale | string | Yes | - | - |
|
|
2673
|
+
| pack | LocalePack | Yes | - | - |
|
|
2674
|
+
|
|
2675
|
+
#### `setLocale(locale)`
|
|
2676
|
+
|
|
2677
|
+
**Parameters**
|
|
2678
|
+
| Name | Type | Required | Default | Description |
|
|
2679
|
+
| --- | --- | --- | --- | --- |
|
|
2680
|
+
| locale | string | Yes | - | - |
|
|
2681
|
+
|
|
2682
|
+
#### `t(key, params = {}): string`
|
|
2683
|
+
|
|
2684
|
+
**Parameters**
|
|
2685
|
+
| Name | Type | Required | Default | Description |
|
|
2686
|
+
| --- | --- | --- | --- | --- |
|
|
2687
|
+
| key | string | Yes | - | - |
|
|
2688
|
+
| params | Record<string, any> | No | {} | - |
|
|
2689
|
+
|
|
2690
|
+
**Returns**
|
|
2691
|
+
- Type: `string`
|
|
2692
|
+
|
|
2693
|
+
## IO
|
|
2694
|
+
|
|
2695
|
+
### Methods
|
|
2696
|
+
#### `async import(file): Promise<void>`
|
|
2697
|
+
|
|
2698
|
+
**Parameters**
|
|
2699
|
+
| Name | Type | Required | Default | Description |
|
|
2700
|
+
| --- | --- | --- | --- | --- |
|
|
2701
|
+
| file | File | Yes | - | - |
|
|
2702
|
+
|
|
2703
|
+
**Returns**
|
|
2704
|
+
- Type: `Promise<void>`
|
|
2705
|
+
- Import from xlsx/csv/json file.
|
|
2706
|
+
|
|
2707
|
+
#### `async importFromUrl(fileUrl): Promise<void>`
|
|
2708
|
+
|
|
2709
|
+
**Parameters**
|
|
2710
|
+
| Name | Type | Required | Default | Description |
|
|
2711
|
+
| --- | --- | --- | --- | --- |
|
|
2712
|
+
| fileUrl | string | Yes | - | - |
|
|
2713
|
+
|
|
2714
|
+
**Returns**
|
|
2715
|
+
- Type: `Promise<void>`
|
|
2716
|
+
|
|
2717
|
+
#### `async export(type)`
|
|
2718
|
+
|
|
2719
|
+
**Parameters**
|
|
2720
|
+
| Name | Type | Required | Default | Description |
|
|
2721
|
+
| --- | --- | --- | --- | --- |
|
|
2722
|
+
| type | 'XLSX' \| 'CSV' \| 'JSON' \| 'HTML' | Yes | - | - |
|
|
2723
|
+
|
|
2724
|
+
#### `async exportAllImage(): Promise<void>`
|
|
2725
|
+
|
|
2726
|
+
**Returns**
|
|
2727
|
+
- Type: `Promise<void>`
|
|
2728
|
+
|
|
2729
|
+
#### `async getData(): Promise<Object>`
|
|
2730
|
+
- Category: `JsonIO`
|
|
2731
|
+
|
|
2732
|
+
**Returns**
|
|
2733
|
+
- Type: `Promise<Object>`
|
|
2734
|
+
|
|
2735
|
+
#### `setData(data): boolean`
|
|
2736
|
+
- Category: `JsonIO`
|
|
2737
|
+
|
|
2738
|
+
**Parameters**
|
|
2739
|
+
| Name | Type | Required | Default | Description |
|
|
2740
|
+
| --- | --- | --- | --- | --- |
|
|
2741
|
+
| data | Object | Yes | - | - |
|
|
2742
|
+
|
|
2743
|
+
**Returns**
|
|
2744
|
+
- Type: `boolean`
|
|
2745
|
+
|
|
2746
|
+
## Print
|
|
2747
|
+
- Print Settings and Rendering
|
|
2748
|
+
|
|
2749
|
+
## UndoRedo
|
|
2750
|
+
|
|
2751
|
+
### Props
|
|
2752
|
+
| Name | Type | Static | Default | Description |
|
|
2753
|
+
| --- | --- | --- | --- | --- |
|
|
2754
|
+
| maxStack | number | No | 50 | - |
|
|
2755
|
+
|
|
2756
|
+
### Get
|
|
2757
|
+
| Name | Type | Static | Description |
|
|
2758
|
+
| --- | --- | --- | --- |
|
|
2759
|
+
| canUndo | boolean | No | - |
|
|
2760
|
+
| canRedo | boolean | No | - |
|
|
2761
|
+
|
|
2762
|
+
### Methods
|
|
2763
|
+
#### `add(action): void`
|
|
2764
|
+
|
|
2765
|
+
**Parameters**
|
|
2766
|
+
| Name | Type | Required | Default | Description |
|
|
2767
|
+
| --- | --- | --- | --- | --- |
|
|
2768
|
+
| action | {undo: Function, redo: Function, activeCell?: {r:number,c:number}} | Yes | - | - |
|
|
2769
|
+
|
|
2770
|
+
**Returns**
|
|
2771
|
+
- Add undo action into current transaction.
|
|
2772
|
+
|
|
2773
|
+
#### `begin(name = ''): void`
|
|
2774
|
+
|
|
2775
|
+
**Parameters**
|
|
2776
|
+
| Name | Type | Required | Default | Description |
|
|
2777
|
+
| --- | --- | --- | --- | --- |
|
|
2778
|
+
| name | string | No | '' | - |
|
|
2779
|
+
|
|
2780
|
+
**Returns**
|
|
2781
|
+
- Begin a manual undo transaction.
|
|
2782
|
+
|
|
2783
|
+
#### `commit(): void`
|
|
2784
|
+
|
|
2785
|
+
**Returns**
|
|
2786
|
+
- Commit current manual transaction.
|
|
2787
|
+
|
|
2788
|
+
#### `undo(): boolean`
|
|
2789
|
+
|
|
2790
|
+
**Returns**
|
|
2791
|
+
- Type: `boolean`
|
|
2792
|
+
|
|
2793
|
+
#### `redo(): boolean`
|
|
2794
|
+
|
|
2795
|
+
**Returns**
|
|
2796
|
+
- Type: `boolean`
|
|
2797
|
+
|
|
2798
|
+
#### `clear(): void`
|
|
2799
|
+
|
|
2800
|
+
**Returns**
|
|
2801
|
+
- Clear undo/redo stacks and pending transaction.
|
|
2802
|
+
|
|
2803
|
+
## Utils
|
|
2804
|
+
|
|
2805
|
+
### Methods
|
|
2806
|
+
#### `objToArr(obj): Array<any>`
|
|
2807
|
+
|
|
2808
|
+
**Parameters**
|
|
2809
|
+
| Name | Type | Required | Default | Description |
|
|
2810
|
+
| --- | --- | --- | --- | --- |
|
|
2811
|
+
| obj | any | Yes | - | - |
|
|
2812
|
+
|
|
2813
|
+
**Returns**
|
|
2814
|
+
- Type: `Array<any>`
|
|
2815
|
+
- Normalize any value to array.
|
|
2816
|
+
|
|
2817
|
+
#### `rgbToHex(rgb): string`
|
|
2818
|
+
|
|
2819
|
+
**Parameters**
|
|
2820
|
+
| Name | Type | Required | Default | Description |
|
|
2821
|
+
| --- | --- | --- | --- | --- |
|
|
2822
|
+
| rgb | string | Yes | - | - |
|
|
2823
|
+
|
|
2824
|
+
**Returns**
|
|
2825
|
+
- Type: `string`
|
|
2826
|
+
- Convert rgb() string to hex color.
|
|
2827
|
+
|
|
2828
|
+
#### `emuToPx(emu): number`
|
|
2829
|
+
|
|
2830
|
+
**Parameters**
|
|
2831
|
+
| Name | Type | Required | Default | Description |
|
|
2832
|
+
| --- | --- | --- | --- | --- |
|
|
2833
|
+
| emu | number | Yes | - | - |
|
|
2834
|
+
|
|
2835
|
+
**Returns**
|
|
2836
|
+
- Type: `number`
|
|
2837
|
+
- Convert EMU to pixels.
|
|
2838
|
+
|
|
2839
|
+
#### `pxToEmu(px): number`
|
|
2840
|
+
|
|
2841
|
+
**Parameters**
|
|
2842
|
+
| Name | Type | Required | Default | Description |
|
|
2843
|
+
| --- | --- | --- | --- | --- |
|
|
2844
|
+
| px | number | Yes | - | - |
|
|
2845
|
+
|
|
2846
|
+
**Returns**
|
|
2847
|
+
- Type: `number`
|
|
2848
|
+
- Convert pixels to EMU.
|
|
2849
|
+
|
|
2850
|
+
#### `decodeEntities(encodedString): string`
|
|
2851
|
+
|
|
2852
|
+
**Parameters**
|
|
2853
|
+
| Name | Type | Required | Default | Description |
|
|
2854
|
+
| --- | --- | --- | --- | --- |
|
|
2855
|
+
| encodedString | string | Yes | - | - |
|
|
2856
|
+
|
|
2857
|
+
**Returns**
|
|
2858
|
+
- Type: `string`
|
|
2859
|
+
- Decode HTML entities to plain text.
|
|
2860
|
+
|
|
2861
|
+
#### `sortObjectInPlace(obj, keyOrder): void`
|
|
2862
|
+
|
|
2863
|
+
**Parameters**
|
|
2864
|
+
| Name | Type | Required | Default | Description |
|
|
2865
|
+
| --- | --- | --- | --- | --- |
|
|
2866
|
+
| obj | Object | Yes | - | - |
|
|
2867
|
+
| keyOrder | Array<string> | Yes | - | - |
|
|
2868
|
+
|
|
2869
|
+
**Returns**
|
|
2870
|
+
- Reorder object keys in-place.
|
|
2871
|
+
|
|
2872
|
+
#### `debounce(func, wait): Function`
|
|
2873
|
+
|
|
2874
|
+
**Parameters**
|
|
2875
|
+
| Name | Type | Required | Default | Description |
|
|
2876
|
+
| --- | --- | --- | --- | --- |
|
|
2877
|
+
| func | Function | Yes | - | - |
|
|
2878
|
+
| wait | number | Yes | - | - |
|
|
2879
|
+
|
|
2880
|
+
**Returns**
|
|
2881
|
+
- Type: `Function`
|
|
2882
|
+
- Create a debounced function.
|
|
2883
|
+
|
|
2884
|
+
#### `numToChar(num): string`
|
|
2885
|
+
|
|
2886
|
+
**Parameters**
|
|
2887
|
+
| Name | Type | Required | Default | Description |
|
|
2888
|
+
| --- | --- | --- | --- | --- |
|
|
2889
|
+
| num | number | Yes | - | - |
|
|
2890
|
+
|
|
2891
|
+
**Returns**
|
|
2892
|
+
- Type: `string`
|
|
2893
|
+
|
|
2894
|
+
#### `charToNum(name): number`
|
|
2895
|
+
|
|
2896
|
+
**Parameters**
|
|
2897
|
+
| Name | Type | Required | Default | Description |
|
|
2898
|
+
| --- | --- | --- | --- | --- |
|
|
2899
|
+
| name | string | Yes | - | - |
|
|
2900
|
+
|
|
2901
|
+
**Returns**
|
|
2902
|
+
- Type: `number`
|
|
2903
|
+
|
|
2904
|
+
#### `rangeNumToStr(obj, absolute = false): string`
|
|
2905
|
+
|
|
2906
|
+
**Parameters**
|
|
2907
|
+
| Name | Type | Required | Default | Description |
|
|
2908
|
+
| --- | --- | --- | --- | --- |
|
|
2909
|
+
| obj | {s:{r:number,c:number},e:{r:number,c:number}} | Yes | - | - |
|
|
2910
|
+
| absolute | boolean | No | false | - |
|
|
2911
|
+
|
|
2912
|
+
**Returns**
|
|
2913
|
+
- Type: `string`
|
|
2914
|
+
|
|
2915
|
+
#### `cellStrToNum(cellStr): {c:number,r:number} | undefined`
|
|
2916
|
+
|
|
2917
|
+
**Parameters**
|
|
2918
|
+
| Name | Type | Required | Default | Description |
|
|
2919
|
+
| --- | --- | --- | --- | --- |
|
|
2920
|
+
| cellStr | string | Yes | - | - |
|
|
2921
|
+
|
|
2922
|
+
**Returns**
|
|
2923
|
+
- Type: `{c:number,r:number} | undefined`
|
|
2924
|
+
|
|
2925
|
+
#### `cellNumToStr(cellNum): string`
|
|
2926
|
+
|
|
2927
|
+
**Parameters**
|
|
2928
|
+
| Name | Type | Required | Default | Description |
|
|
2929
|
+
| --- | --- | --- | --- | --- |
|
|
2930
|
+
| cellNum | {c:number,r:number} | Yes | - | - |
|
|
2931
|
+
|
|
2932
|
+
**Returns**
|
|
2933
|
+
- Type: `string`
|
|
2934
|
+
|
|
2935
|
+
#### `getFillFormula(formula, originalRow, originalCol, targetRow, targetCol): string`
|
|
2936
|
+
|
|
2937
|
+
**Parameters**
|
|
2938
|
+
| Name | Type | Required | Default | Description |
|
|
2939
|
+
| --- | --- | --- | --- | --- |
|
|
2940
|
+
| formula | string | Yes | - | - |
|
|
2941
|
+
| originalRow | number | Yes | - | - |
|
|
2942
|
+
| originalCol | number | Yes | - | - |
|
|
2943
|
+
| targetRow | number | Yes | - | - |
|
|
2944
|
+
| targetCol | number | Yes | - | - |
|
|
2945
|
+
|
|
2946
|
+
**Returns**
|
|
2947
|
+
- Type: `string`
|
|
2948
|
+
- Build fill formula by shifting relative refs only.
|
|
2949
|
+
|
|
2950
|
+
#### `toast(message): void`
|
|
2951
|
+
|
|
2952
|
+
**Parameters**
|
|
2953
|
+
| Name | Type | Required | Default | Description |
|
|
2954
|
+
| --- | --- | --- | --- | --- |
|
|
2955
|
+
| message | any | Yes | - | - |
|
|
2956
|
+
|
|
2957
|
+
**Returns**
|
|
2958
|
+
- Show toast message.
|
|
2959
|
+
|
|
2960
|
+
#### `async downloadImageToBase64(imageUrl): Promise<string | undefined>`
|
|
2961
|
+
|
|
2962
|
+
**Parameters**
|
|
2963
|
+
| Name | Type | Required | Default | Description |
|
|
2964
|
+
| --- | --- | --- | --- | --- |
|
|
2965
|
+
| imageUrl | string | Yes | - | - |
|
|
2966
|
+
|
|
2967
|
+
**Returns**
|
|
2968
|
+
- Type: `Promise<string | undefined>`
|
|
2969
|
+
- Fetch image URL and return base64 data URL.
|
|
2970
|
+
|
|
2971
|
+
#### `modal(options = {}): Promise<{bodyEl: HTMLElement} | null>`
|
|
2972
|
+
|
|
2973
|
+
**Parameters**
|
|
2974
|
+
| Name | Type | Required | Default | Description |
|
|
2975
|
+
| --- | --- | --- | --- | --- |
|
|
2976
|
+
| options | Object | No | {} | - |
|
|
2977
|
+
|
|
2978
|
+
**Returns**
|
|
2979
|
+
- Type: `Promise<{bodyEl: HTMLElement} | null>`
|
|
2980
|
+
- Open common modal panel.
|