@rosperitus/excelerate 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/excelerate.d.ts +86 -1
- package/excelerate.js +87 -0
- package/excelerate_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -174,6 +174,8 @@ class Book {
|
|
|
174
174
|
setCellStyle(sheet: number, address: string, patch: CellStylePatch): void;
|
|
175
175
|
setCellStyleAt(sheet: number, row: number, column: number, patch: CellStylePatch): void;
|
|
176
176
|
setRangeStyle(sheet: number, range: string, patch: CellStylePatch): void;
|
|
177
|
+
getRichText(sheet: number, address: string): TextRun[] | null; // [{ text, font }]
|
|
178
|
+
setRichText(sheet: number, address: string, runs: TextRun[]): void;
|
|
177
179
|
|
|
178
180
|
// Notes, links, tables
|
|
179
181
|
setComment(sheet: number, address: string, author: string, text: string): void;
|
package/excelerate.d.ts
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
* what is left out keeps the value the cell had, so `{ font: { bold: true } }`
|
|
7
7
|
* makes a cell bold without touching its number format.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* What `setDocumentProperties` takes: a named field is set, `null` clears it,
|
|
11
|
+
* a missing one stays. `custom` replaces the whole list; `type` is optional.
|
|
12
|
+
*/
|
|
13
|
+
export type DocumentPropertiesPatch = Partial<
|
|
14
|
+
Record<Exclude<keyof DocumentProperties, "custom">, string | null>
|
|
15
|
+
> & {
|
|
16
|
+
custom?: { name: string; value: string | number | boolean; type?: CustomProperty["type"] }[];
|
|
17
|
+
};
|
|
9
18
|
export interface CellStylePatch {
|
|
10
19
|
numberFormat?: string;
|
|
11
20
|
font?: Partial<{
|
|
@@ -88,6 +97,33 @@ export interface SheetViewInfo {
|
|
|
88
97
|
rightToLeft: boolean;
|
|
89
98
|
topLeftCell: string | null;
|
|
90
99
|
}
|
|
100
|
+
/** One of the user's own document properties. */
|
|
101
|
+
export interface CustomProperty {
|
|
102
|
+
name: string;
|
|
103
|
+
type: "text" | "integer" | "number" | "boolean" | "date";
|
|
104
|
+
value: string | number | boolean;
|
|
105
|
+
}
|
|
106
|
+
/** Title, author, dates and the user's fields, as `documentProperties` returns them. Dates are ISO 8601. */
|
|
107
|
+
export interface DocumentProperties {
|
|
108
|
+
title: string | null;
|
|
109
|
+
subject: string | null;
|
|
110
|
+
creator: string | null;
|
|
111
|
+
keywords: string | null;
|
|
112
|
+
description: string | null;
|
|
113
|
+
lastModifiedBy: string | null;
|
|
114
|
+
category: string | null;
|
|
115
|
+
contentStatus: string | null;
|
|
116
|
+
language: string | null;
|
|
117
|
+
identifier: string | null;
|
|
118
|
+
revision: string | null;
|
|
119
|
+
version: string | null;
|
|
120
|
+
created: string | null;
|
|
121
|
+
modified: string | null;
|
|
122
|
+
lastPrinted: string | null;
|
|
123
|
+
company: string | null;
|
|
124
|
+
manager: string | null;
|
|
125
|
+
custom: CustomProperty[];
|
|
126
|
+
}
|
|
91
127
|
/** A name that stands for a formula, as `definedNames` returns it. */
|
|
92
128
|
export interface WorkbookName {
|
|
93
129
|
name: string;
|
|
@@ -113,7 +149,7 @@ export interface SheetConditionalFormat {
|
|
|
113
149
|
/** The autofilter over a range, as `autoFilter` returns it. */
|
|
114
150
|
export interface SheetAutoFilter {
|
|
115
151
|
range: string;
|
|
116
|
-
columns: { colId: number; kind: "values" | "custom" | "dynamic" | "top10" | "none" }[];
|
|
152
|
+
columns: { colId: number; kind: "values" | "custom" | "dynamic" | "top10" | "color" | "icon" | "none" }[];
|
|
117
153
|
}
|
|
118
154
|
/** A pivot report on the sheet, as `pivotTables` returns it. */
|
|
119
155
|
export interface SheetPivotTable {
|
|
@@ -182,6 +218,22 @@ export interface SheetShape {
|
|
|
182
218
|
* a theme colour carries its tint as `theme:4@-0.25`.
|
|
183
219
|
*/
|
|
184
220
|
export type StyleColor = string | null;
|
|
221
|
+
/**
|
|
222
|
+
* What a run of formatted text changes about the cell's font; a field left
|
|
223
|
+
* out is the cell's own. `size` in points.
|
|
224
|
+
*/
|
|
225
|
+
export interface RunFont {
|
|
226
|
+
name?: string;
|
|
227
|
+
size?: number;
|
|
228
|
+
bold?: boolean;
|
|
229
|
+
italic?: boolean;
|
|
230
|
+
underline?: string;
|
|
231
|
+
strike?: boolean;
|
|
232
|
+
color?: StyleColor;
|
|
233
|
+
script?: "superscript" | "subscript" | "baseline";
|
|
234
|
+
}
|
|
235
|
+
/** One run of formatted text, as `getRichText` returns it. */
|
|
236
|
+
export interface TextRun { text: string; font?: RunFont | null }
|
|
185
237
|
/** One side of a cell's border. */
|
|
186
238
|
export interface BorderSide { style: string; color: StyleColor }
|
|
187
239
|
/** How a cell is painted, as `cellStyle` returns it. */
|
|
@@ -346,6 +398,12 @@ export class Book {
|
|
|
346
398
|
* for. `sheet` is set on a name local to one sheet.
|
|
347
399
|
*/
|
|
348
400
|
definedNames(): WorkbookName[];
|
|
401
|
+
/**
|
|
402
|
+
* What Excel shows under File > Info: every text field is a string or
|
|
403
|
+
* `null`, dates in ISO 8601. `custom` lists the user's own fields with
|
|
404
|
+
* their type: `text`, `integer`, `number`, `boolean` or `date`.
|
|
405
|
+
*/
|
|
406
|
+
documentProperties(): DocumentProperties;
|
|
349
407
|
/**
|
|
350
408
|
* Evaluates a formula (with or without the leading `=`) as if it sat in
|
|
351
409
|
* `address` of `sheet`, and returns its result.
|
|
@@ -427,6 +485,16 @@ export class Book {
|
|
|
427
485
|
* The same by numbers, as `getRangeAt` takes them.
|
|
428
486
|
*/
|
|
429
487
|
getRangeStylesAt(sheet: number, row: number, column: number, rows: number, columns: number): RangeStyles;
|
|
488
|
+
/**
|
|
489
|
+
* The runs of a cell's formatted text: `{ text, font }` each, `font`
|
|
490
|
+
* naming only what the run changes about the cell's font, or `null` for
|
|
491
|
+
* a run in the cell's own. `null` for a cell without formatted text.
|
|
492
|
+
*/
|
|
493
|
+
getRichText(sheet: number, address: string): TextRun[] | null;
|
|
494
|
+
/**
|
|
495
|
+
* The same by 1-based row and column.
|
|
496
|
+
*/
|
|
497
|
+
getRichTextAt(sheet: number, row: number, column: number): TextRun[] | null;
|
|
430
498
|
/**
|
|
431
499
|
* A whole row in one crossing of the boundary: values, displayed text,
|
|
432
500
|
* bold and indent, plus whether the row is hidden.
|
|
@@ -724,6 +792,13 @@ export class Book {
|
|
|
724
792
|
* name local to that sheet instead of the workbook.
|
|
725
793
|
*/
|
|
726
794
|
setDefinedName(name: string, formula: string, sheet?: number | null): void;
|
|
795
|
+
/**
|
|
796
|
+
* Changes the fields the patch names and leaves the rest: a string sets
|
|
797
|
+
* one, `null` clears it. `custom`, when given, replaces the list; a
|
|
798
|
+
* field's type is taken from `type` or else from the value (a whole
|
|
799
|
+
* number is an integer).
|
|
800
|
+
*/
|
|
801
|
+
setDocumentProperties(patch: DocumentPropertiesPatch): void;
|
|
727
802
|
/**
|
|
728
803
|
* Puts a link over a cell or a block of them.
|
|
729
804
|
*
|
|
@@ -758,6 +833,16 @@ export class Book {
|
|
|
758
833
|
* The same with the corner given as 1-based row and column.
|
|
759
834
|
*/
|
|
760
835
|
setRangeStylesAt(sheet: number, row: number, column: number, styles: RangeStylesPatch): void;
|
|
836
|
+
/**
|
|
837
|
+
* Writes formatted text: runs as `getRichText` returns them, each with
|
|
838
|
+
* its own text and the part of the font it changes (`font` may be left
|
|
839
|
+
* out or `null` for the cell's own).
|
|
840
|
+
*/
|
|
841
|
+
setRichText(sheet: number, address: string, runs: TextRun[]): void;
|
|
842
|
+
/**
|
|
843
|
+
* The same by 1-based row and column.
|
|
844
|
+
*/
|
|
845
|
+
setRichTextAt(sheet: number, row: number, column: number, runs: TextRun[]): void;
|
|
761
846
|
/**
|
|
762
847
|
* Sets the height of a row in points, or gives it back to the sheet
|
|
763
848
|
* default with `undefined`. `row` is the number a user sees.
|
package/excelerate.js
CHANGED
|
@@ -336,6 +336,16 @@ class Book {
|
|
|
336
336
|
const ret = wasm.book_definedNames(this.__wbg_ptr);
|
|
337
337
|
return ret;
|
|
338
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* What Excel shows under File > Info: every text field is a string or
|
|
341
|
+
* `null`, dates in ISO 8601. `custom` lists the user's own fields with
|
|
342
|
+
* their type: `text`, `integer`, `number`, `boolean` or `date`.
|
|
343
|
+
* @returns {DocumentProperties}
|
|
344
|
+
*/
|
|
345
|
+
documentProperties() {
|
|
346
|
+
const ret = wasm.book_documentProperties(this.__wbg_ptr);
|
|
347
|
+
return ret;
|
|
348
|
+
}
|
|
339
349
|
/**
|
|
340
350
|
* Evaluates a formula (with or without the leading `=`) as if it sat in
|
|
341
351
|
* `address` of `sheet`, and returns its result.
|
|
@@ -610,6 +620,37 @@ class Book {
|
|
|
610
620
|
}
|
|
611
621
|
return takeFromExternrefTable0(ret[0]);
|
|
612
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* The runs of a cell's formatted text: `{ text, font }` each, `font`
|
|
625
|
+
* naming only what the run changes about the cell's font, or `null` for
|
|
626
|
+
* a run in the cell's own. `null` for a cell without formatted text.
|
|
627
|
+
* @param {number} sheet
|
|
628
|
+
* @param {string} address
|
|
629
|
+
* @returns {TextRun[] | null}
|
|
630
|
+
*/
|
|
631
|
+
getRichText(sheet, address) {
|
|
632
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
633
|
+
const len0 = WASM_VECTOR_LEN;
|
|
634
|
+
const ret = wasm.book_getRichText(this.__wbg_ptr, sheet, ptr0, len0);
|
|
635
|
+
if (ret[2]) {
|
|
636
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
637
|
+
}
|
|
638
|
+
return takeFromExternrefTable0(ret[0]);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* The same by 1-based row and column.
|
|
642
|
+
* @param {number} sheet
|
|
643
|
+
* @param {number} row
|
|
644
|
+
* @param {number} column
|
|
645
|
+
* @returns {TextRun[] | null}
|
|
646
|
+
*/
|
|
647
|
+
getRichTextAt(sheet, row, column) {
|
|
648
|
+
const ret = wasm.book_getRichTextAt(this.__wbg_ptr, sheet, row, column);
|
|
649
|
+
if (ret[2]) {
|
|
650
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
651
|
+
}
|
|
652
|
+
return takeFromExternrefTable0(ret[0]);
|
|
653
|
+
}
|
|
613
654
|
/**
|
|
614
655
|
* A whole row in one crossing of the boundary: values, displayed text,
|
|
615
656
|
* bold and indent, plus whether the row is hidden.
|
|
@@ -1354,6 +1395,19 @@ class Book {
|
|
|
1354
1395
|
throw takeFromExternrefTable0(ret[0]);
|
|
1355
1396
|
}
|
|
1356
1397
|
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Changes the fields the patch names and leaves the rest: a string sets
|
|
1400
|
+
* one, `null` clears it. `custom`, when given, replaces the list; a
|
|
1401
|
+
* field's type is taken from `type` or else from the value (a whole
|
|
1402
|
+
* number is an integer).
|
|
1403
|
+
* @param {DocumentPropertiesPatch} patch
|
|
1404
|
+
*/
|
|
1405
|
+
setDocumentProperties(patch) {
|
|
1406
|
+
const ret = wasm.book_setDocumentProperties(this.__wbg_ptr, patch);
|
|
1407
|
+
if (ret[1]) {
|
|
1408
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1357
1411
|
/**
|
|
1358
1412
|
* Puts a link over a cell or a block of them.
|
|
1359
1413
|
*
|
|
@@ -1455,6 +1509,35 @@ class Book {
|
|
|
1455
1509
|
throw takeFromExternrefTable0(ret[0]);
|
|
1456
1510
|
}
|
|
1457
1511
|
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Writes formatted text: runs as `getRichText` returns them, each with
|
|
1514
|
+
* its own text and the part of the font it changes (`font` may be left
|
|
1515
|
+
* out or `null` for the cell's own).
|
|
1516
|
+
* @param {number} sheet
|
|
1517
|
+
* @param {string} address
|
|
1518
|
+
* @param {TextRun[]} runs
|
|
1519
|
+
*/
|
|
1520
|
+
setRichText(sheet, address, runs) {
|
|
1521
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1522
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1523
|
+
const ret = wasm.book_setRichText(this.__wbg_ptr, sheet, ptr0, len0, runs);
|
|
1524
|
+
if (ret[1]) {
|
|
1525
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* The same by 1-based row and column.
|
|
1530
|
+
* @param {number} sheet
|
|
1531
|
+
* @param {number} row
|
|
1532
|
+
* @param {number} column
|
|
1533
|
+
* @param {TextRun[]} runs
|
|
1534
|
+
*/
|
|
1535
|
+
setRichTextAt(sheet, row, column, runs) {
|
|
1536
|
+
const ret = wasm.book_setRichTextAt(this.__wbg_ptr, sheet, row, column, runs);
|
|
1537
|
+
if (ret[1]) {
|
|
1538
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1458
1541
|
/**
|
|
1459
1542
|
* Sets the height of a row in points, or gives it back to the sheet
|
|
1460
1543
|
* default with `undefined`. `row` is the number a user sees.
|
|
@@ -1914,6 +1997,10 @@ function __wbg_get_imports() {
|
|
|
1914
1997
|
const ret = arg0.call(arg1, arg2);
|
|
1915
1998
|
return ret;
|
|
1916
1999
|
}, arguments); },
|
|
2000
|
+
__wbg_from_74f3d90e0ff11240: function(arg0) {
|
|
2001
|
+
const ret = Array.from(arg0);
|
|
2002
|
+
return ret;
|
|
2003
|
+
},
|
|
1917
2004
|
__wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
|
|
1918
2005
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1919
2006
|
}, arguments); },
|
package/excelerate_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED