logisheets 1.7.1 → 1.9.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.
Files changed (40) hide show
  1. package/README.md +59 -8
  2. package/dist/src/api/workbook.d.ts +14 -1
  3. package/dist/src/api/workbook.js +34 -0
  4. package/dist/src/api/worksheet.d.ts +8 -1
  5. package/dist/src/api/worksheet.js +9 -0
  6. package/dist/src/bindings/block_sort_order.d.ts +4 -0
  7. package/dist/src/bindings/block_sort_order.js +2 -0
  8. package/dist/src/bindings/chart_info.d.ts +20 -0
  9. package/dist/src/bindings/chart_info.js +2 -0
  10. package/dist/src/bindings/chart_series_info.d.ts +5 -0
  11. package/dist/src/bindings/chart_series_info.js +2 -0
  12. package/dist/src/bindings/create_chart.d.ts +63 -0
  13. package/dist/src/bindings/create_chart.js +103 -0
  14. package/dist/src/bindings/create_chart_series.d.ts +14 -0
  15. package/dist/src/bindings/create_chart_series.js +21 -0
  16. package/dist/src/bindings/delete_chart.d.ts +14 -0
  17. package/dist/src/bindings/delete_chart.js +23 -0
  18. package/dist/src/bindings/edit_payload.d.ts +16 -0
  19. package/dist/src/bindings/index.d.ts +10 -0
  20. package/dist/src/bindings/index.js +10 -0
  21. package/dist/src/bindings/move_chart.d.ts +46 -0
  22. package/dist/src/bindings/move_chart.js +79 -0
  23. package/dist/src/bindings/rpc_get_block_sort_order_params.d.ts +6 -0
  24. package/dist/src/bindings/rpc_get_block_sort_order_params.js +2 -0
  25. package/dist/src/bindings/rpc_get_charts_params.d.ts +3 -0
  26. package/dist/src/bindings/rpc_get_charts_params.js +2 -0
  27. package/dist/src/bindings/rpc_workbook_methods.d.ts +6 -0
  28. package/dist/src/bindings/update_chart.d.ts +22 -0
  29. package/dist/src/bindings/update_chart.js +33 -0
  30. package/dist/wasm/logisheets_wasm_server.d.ts +12 -0
  31. package/dist/wasm/logisheets_wasm_server.js +83 -27
  32. package/dist/wasm/logisheets_wasm_server_bg.wasm +0 -0
  33. package/dist/wasm/logisheets_wasm_server_bg.wasm.d.ts +5 -3
  34. package/dist/wasm/package.json +1 -1
  35. package/package.json +1 -1
  36. package/wasm/logisheets_wasm_server.d.ts +12 -0
  37. package/wasm/logisheets_wasm_server.js +83 -27
  38. package/wasm/logisheets_wasm_server_bg.wasm +0 -0
  39. package/wasm/logisheets_wasm_server_bg.wasm.d.ts +5 -3
  40. package/wasm/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ export interface MoveChart {
2
+ sheetIdx: number;
3
+ chartId: string;
4
+ fromRow: number;
5
+ fromCol: number;
6
+ fromColOff: number;
7
+ fromRowOff: number;
8
+ toRow: number;
9
+ toCol: number;
10
+ toColOff: number;
11
+ toRowOff: number;
12
+ }
13
+ export declare class MoveChartBuilder {
14
+ private _sheetIdx;
15
+ private _chartId;
16
+ private _fromRow;
17
+ private _fromCol;
18
+ private _fromColOff;
19
+ private _fromRowOff;
20
+ private _toRow;
21
+ private _toCol;
22
+ private _toColOff;
23
+ private _toRowOff;
24
+ sheetIdx(value: number): this;
25
+ chartId(value: string): this;
26
+ fromRow(value: number): this;
27
+ fromCol(value: number): this;
28
+ fromColOff(value: number): this;
29
+ fromRowOff(value: number): this;
30
+ toRow(value: number): this;
31
+ toCol(value: number): this;
32
+ toColOff(value: number): this;
33
+ toRowOff(value: number): this;
34
+ build(): {
35
+ sheetIdx: number;
36
+ chartId: string;
37
+ fromRow: number;
38
+ fromCol: number;
39
+ fromColOff: number;
40
+ fromRowOff: number;
41
+ toRow: number;
42
+ toCol: number;
43
+ toColOff: number;
44
+ toRowOff: number;
45
+ };
46
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MoveChartBuilder = void 0;
4
+ class MoveChartBuilder {
5
+ _sheetIdx;
6
+ _chartId;
7
+ _fromRow;
8
+ _fromCol;
9
+ _fromColOff;
10
+ _fromRowOff;
11
+ _toRow;
12
+ _toCol;
13
+ _toColOff;
14
+ _toRowOff;
15
+ sheetIdx(value) {
16
+ this._sheetIdx = value;
17
+ return this;
18
+ }
19
+ chartId(value) {
20
+ this._chartId = value;
21
+ return this;
22
+ }
23
+ fromRow(value) {
24
+ this._fromRow = value;
25
+ return this;
26
+ }
27
+ fromCol(value) {
28
+ this._fromCol = value;
29
+ return this;
30
+ }
31
+ fromColOff(value) {
32
+ this._fromColOff = value;
33
+ return this;
34
+ }
35
+ fromRowOff(value) {
36
+ this._fromRowOff = value;
37
+ return this;
38
+ }
39
+ toRow(value) {
40
+ this._toRow = value;
41
+ return this;
42
+ }
43
+ toCol(value) {
44
+ this._toCol = value;
45
+ return this;
46
+ }
47
+ toColOff(value) {
48
+ this._toColOff = value;
49
+ return this;
50
+ }
51
+ toRowOff(value) {
52
+ this._toRowOff = value;
53
+ return this;
54
+ }
55
+ build() {
56
+ if (this._sheetIdx === undefined)
57
+ throw new Error('missing sheetIdx');
58
+ if (this._chartId === undefined)
59
+ throw new Error('missing chartId');
60
+ if (this._fromRow === undefined)
61
+ throw new Error('missing fromRow');
62
+ if (this._fromCol === undefined)
63
+ throw new Error('missing fromCol');
64
+ if (this._fromColOff === undefined)
65
+ throw new Error('missing fromColOff');
66
+ if (this._fromRowOff === undefined)
67
+ throw new Error('missing fromRowOff');
68
+ if (this._toRow === undefined)
69
+ throw new Error('missing toRow');
70
+ if (this._toCol === undefined)
71
+ throw new Error('missing toCol');
72
+ if (this._toColOff === undefined)
73
+ throw new Error('missing toColOff');
74
+ if (this._toRowOff === undefined)
75
+ throw new Error('missing toRowOff');
76
+ return { sheetIdx: this._sheetIdx, chartId: this._chartId, fromRow: this._fromRow, fromCol: this._fromCol, fromColOff: this._fromColOff, fromRowOff: this._fromRowOff, toRow: this._toRow, toCol: this._toCol, toColOff: this._toColOff, toRowOff: this._toRowOff };
77
+ }
78
+ }
79
+ exports.MoveChartBuilder = MoveChartBuilder;
@@ -0,0 +1,6 @@
1
+ export interface GetBlockSortOrderParams {
2
+ sheetIdx: number;
3
+ blockId: number;
4
+ field: string;
5
+ asc: boolean;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface GetChartsParams {
2
+ sheetIdx: number;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,7 @@ import { BatchGetCellInfoByIdParams } from './rpc_batch_get_cell_info_by_id_para
6
6
  import { BlockDataRow } from './block_data_row';
7
7
  import { BlockField } from './block_field';
8
8
  import { BlockInfo } from './block_info';
9
+ import { BlockSortOrder } from './block_sort_order';
9
10
  import { CalcConditionParams } from './rpc_calc_condition_params';
10
11
  import { CellCoordinateWithSheet } from './cell_coordinate_with_sheet';
11
12
  import { CellImageInfo } from './cell_image_info';
@@ -13,6 +14,7 @@ import { CellInfo } from './cell_info';
13
14
  import { CellInput } from './cell_input';
14
15
  import { CellPosition } from './cell_position';
15
16
  import { CellRefRange } from './cell_ref_range';
17
+ import { ChartInfo } from './chart_info';
16
18
  import { CheckFormulaParams } from './rpc_check_formula_params';
17
19
  import { CheckpointMetaDto } from './checkpoint_meta';
18
20
  import { Comment } from './comment';
@@ -29,6 +31,7 @@ import { GetBlockColIdParams } from './rpc_get_block_col_id_params';
29
31
  import { GetBlockDisplayWindowParams } from './rpc_get_block_display_window_params';
30
32
  import { GetBlockInfoParams } from './rpc_get_block_info_params';
31
33
  import { GetBlockRowIdParams } from './rpc_get_block_row_id_params';
34
+ import { GetBlockSortOrderParams } from './rpc_get_block_sort_order_params';
32
35
  import { GetBlockValuesParams } from './rpc_get_block_values_params';
33
36
  import { GetCellIdByBlockRefParams } from './rpc_get_cell_id_by_block_ref_params';
34
37
  import { GetCellIdParams } from './rpc_get_cell_id_params';
@@ -38,6 +41,7 @@ import { GetCellParams } from './rpc_get_cell_params';
38
41
  import { GetCellPositionParams } from './rpc_get_cell_position_params';
39
42
  import { GetCellsExceptWindowParams } from './rpc_get_cells_except_window_params';
40
43
  import { GetCellsParams } from './rpc_get_cells_params';
44
+ import { GetChartsParams } from './rpc_get_charts_params';
41
45
  import { GetColWidthParams } from './rpc_get_col_width_params';
42
46
  import { GetCommentsParams } from './rpc_get_comments_params';
43
47
  import { GetDataBoundaryParams } from './rpc_get_data_boundary_params';
@@ -115,6 +119,7 @@ export interface WorkbookMethods {
115
119
  getBlockRowId(params: GetBlockRowIdParams, bookId?: number): Promise<number | ErrorMessage>;
116
120
  getBlockColId(params: GetBlockColIdParams, bookId?: number): Promise<number | ErrorMessage>;
117
121
  getBlockValues(params: GetBlockValuesParams, bookId?: number): Promise<readonly string[] | ErrorMessage>;
122
+ getBlockSortOrder(params: GetBlockSortOrderParams, bookId?: number): Promise<BlockSortOrder | ErrorMessage>;
118
123
  getAvailableBlockId(params: GetAvailableBlockIdParams, bookId?: number): Promise<number | ErrorMessage>;
119
124
  getAllBlockFields(bookId?: number): Promise<readonly BlockField[] | ErrorMessage>;
120
125
  getAllBlocks(params: GetAllBlocksParams, bookId?: number): Promise<readonly BlockInfo[] | ErrorMessage>;
@@ -128,6 +133,7 @@ export interface WorkbookMethods {
128
133
  getMergedCells(params: GetMergedCellsParams, bookId?: number): Promise<readonly MergeCell[] | ErrorMessage>;
129
134
  getComments(params: GetCommentsParams, bookId?: number): Promise<readonly Comment[] | ErrorMessage>;
130
135
  getCellImages(params: GetCellImagesParams, bookId?: number): Promise<readonly CellImageInfo[] | ErrorMessage>;
136
+ getCharts(params: GetChartsParams, bookId?: number): Promise<readonly ChartInfo[] | ErrorMessage>;
131
137
  getShadowCellId(params: GetShadowCellIdParams, bookId?: number): Promise<SheetCellId | ErrorMessage>;
132
138
  getShadowCellIds(params: GetShadowCellIdsParams, bookId?: number): Promise<readonly SheetCellId[] | ErrorMessage>;
133
139
  getShadowInfoById(params: GetShadowInfoByIdParams, bookId?: number): Promise<ShadowCellInfo | ErrorMessage>;
@@ -0,0 +1,22 @@
1
+ export interface UpdateChart {
2
+ sheetIdx: number;
3
+ chartId: string;
4
+ chartType?: string;
5
+ title?: string;
6
+ }
7
+ export declare class UpdateChartBuilder {
8
+ private _sheetIdx;
9
+ private _chartId;
10
+ private _chartType?;
11
+ private _title?;
12
+ sheetIdx(value: number): this;
13
+ chartId(value: string): this;
14
+ chartType(value: string): this;
15
+ title(value: string): this;
16
+ build(): {
17
+ sheetIdx: number;
18
+ chartId: string;
19
+ chartType: string | undefined;
20
+ title: string | undefined;
21
+ };
22
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateChartBuilder = void 0;
4
+ class UpdateChartBuilder {
5
+ _sheetIdx;
6
+ _chartId;
7
+ _chartType;
8
+ _title;
9
+ sheetIdx(value) {
10
+ this._sheetIdx = value;
11
+ return this;
12
+ }
13
+ chartId(value) {
14
+ this._chartId = value;
15
+ return this;
16
+ }
17
+ chartType(value) {
18
+ this._chartType = value;
19
+ return this;
20
+ }
21
+ title(value) {
22
+ this._title = value;
23
+ return this;
24
+ }
25
+ build() {
26
+ if (this._sheetIdx === undefined)
27
+ throw new Error('missing sheetIdx');
28
+ if (this._chartId === undefined)
29
+ throw new Error('missing chartId');
30
+ return { sheetIdx: this._sheetIdx, chartId: this._chartId, chartType: this._chartType, title: this._title };
31
+ }
32
+ }
33
+ exports.UpdateChartBuilder = UpdateChartBuilder;
@@ -6,3 +6,15 @@ export function handle(msg: any, book_id?: number | null): any;
6
6
  * Output: ActionAffect
7
7
  */
8
8
  export function input_async_result(id: number, result: any): any;
9
+ /**
10
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
11
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
12
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
13
+ * JavaScript `String(value)` representation, matching the previous behavior.
14
+ */
15
+ export function format_number(fmt: string, value: number): string;
16
+ /**
17
+ * Render a text value with an Excel number-format code (for the `@` text
18
+ * section). Falls back to the text itself on an unsupported format.
19
+ */
20
+ export function format_text(fmt: string, text: string): string;
@@ -2,26 +2,9 @@
2
2
  let imports = {};
3
3
  imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- function addToExternrefTable0(obj) {
8
- const idx = wasm.__externref_table_alloc();
9
- wasm.__wbindgen_export_2.set(idx, obj);
10
- return idx;
11
- }
12
-
13
- function handleError(f, args) {
14
- try {
15
- return f.apply(this, args);
16
- } catch (e) {
17
- const idx = addToExternrefTable0(e);
18
- wasm.__wbindgen_exn_store(idx);
19
- }
20
- }
21
-
22
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
23
-
24
- cachedTextDecoder.decode();
7
+ let WASM_VECTOR_LEN = 0;
25
8
 
26
9
  let cachedUint8ArrayMemory0 = null;
27
10
 
@@ -32,13 +15,6 @@ function getUint8ArrayMemory0() {
32
15
  return cachedUint8ArrayMemory0;
33
16
  }
34
17
 
35
- function getStringFromWasm0(ptr, len) {
36
- ptr = ptr >>> 0;
37
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
38
- }
39
-
40
- let WASM_VECTOR_LEN = 0;
41
-
42
18
  let cachedTextEncoder = new TextEncoder('utf-8');
43
19
 
44
20
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -102,6 +78,30 @@ function getDataViewMemory0() {
102
78
  return cachedDataViewMemory0;
103
79
  }
104
80
 
81
+ function addToExternrefTable0(obj) {
82
+ const idx = wasm.__externref_table_alloc();
83
+ wasm.__wbindgen_export_4.set(idx, obj);
84
+ return idx;
85
+ }
86
+
87
+ function handleError(f, args) {
88
+ try {
89
+ return f.apply(this, args);
90
+ } catch (e) {
91
+ const idx = addToExternrefTable0(e);
92
+ wasm.__wbindgen_exn_store(idx);
93
+ }
94
+ }
95
+
96
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
97
+
98
+ cachedTextDecoder.decode();
99
+
100
+ function getStringFromWasm0(ptr, len) {
101
+ ptr = ptr >>> 0;
102
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
103
+ }
104
+
105
105
  function isLikeNone(x) {
106
106
  return x === undefined || x === null;
107
107
  }
@@ -192,6 +192,62 @@ module.exports.input_async_result = function(id, result) {
192
192
  return ret;
193
193
  };
194
194
 
195
+ /**
196
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
197
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
198
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
199
+ * JavaScript `String(value)` representation, matching the previous behavior.
200
+ * @param {string} fmt
201
+ * @param {number} value
202
+ * @returns {string}
203
+ */
204
+ module.exports.format_number = function(fmt, value) {
205
+ let deferred2_0;
206
+ let deferred2_1;
207
+ try {
208
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const len0 = WASM_VECTOR_LEN;
210
+ const ret = wasm.format_number(ptr0, len0, value);
211
+ deferred2_0 = ret[0];
212
+ deferred2_1 = ret[1];
213
+ return getStringFromWasm0(ret[0], ret[1]);
214
+ } finally {
215
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
216
+ }
217
+ };
218
+
219
+ /**
220
+ * Render a text value with an Excel number-format code (for the `@` text
221
+ * section). Falls back to the text itself on an unsupported format.
222
+ * @param {string} fmt
223
+ * @param {string} text
224
+ * @returns {string}
225
+ */
226
+ module.exports.format_text = function(fmt, text) {
227
+ let deferred3_0;
228
+ let deferred3_1;
229
+ try {
230
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
233
+ const len1 = WASM_VECTOR_LEN;
234
+ const ret = wasm.format_text(ptr0, len0, ptr1, len1);
235
+ deferred3_0 = ret[0];
236
+ deferred3_1 = ret[1];
237
+ return getStringFromWasm0(ret[0], ret[1]);
238
+ } finally {
239
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
240
+ }
241
+ };
242
+
243
+ module.exports.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
244
+ const ret = String(arg1);
245
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
+ const len1 = WASM_VECTOR_LEN;
247
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
248
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
249
+ };
250
+
195
251
  module.exports.__wbg_buffer_71667b1101df19da = function(arg0) {
196
252
  const ret = arg0.buffer;
197
253
  return ret;
@@ -490,7 +546,7 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
490
546
  };
491
547
 
492
548
  module.exports.__wbindgen_init_externref_table = function() {
493
- const table = wasm.__wbindgen_export_2;
549
+ const table = wasm.__wbindgen_export_4;
494
550
  const offset = table.grow(4);
495
551
  table.set(0, undefined);
496
552
  table.set(offset + 0, undefined);
@@ -2,11 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const handle: (a: any, b: number) => any;
5
+ export const format_number: (a: number, b: number, c: number) => [number, number];
6
+ export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
5
7
  export const input_async_result: (a: number, b: any) => any;
8
+ export const __wbindgen_malloc: (a: number, b: number) => number;
9
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
6
10
  export const __wbindgen_exn_store: (a: number) => void;
7
11
  export const __externref_table_alloc: () => number;
8
- export const __wbindgen_export_2: WebAssembly.Table;
12
+ export const __wbindgen_export_4: WebAssembly.Table;
9
13
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
10
- export const __wbindgen_malloc: (a: number, b: number) => number;
11
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
12
14
  export const __wbindgen_start: () => void;
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.7.1",
6
+ "version": "1.9.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logisheets",
3
- "version": "1.7.1",
3
+ "version": "1.9.0",
4
4
  "description": "Read and write the xlsx files",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -6,3 +6,15 @@ export function handle(msg: any, book_id?: number | null): any;
6
6
  * Output: ActionAffect
7
7
  */
8
8
  export function input_async_result(id: number, result: any): any;
9
+ /**
10
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
11
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
12
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
13
+ * JavaScript `String(value)` representation, matching the previous behavior.
14
+ */
15
+ export function format_number(fmt: string, value: number): string;
16
+ /**
17
+ * Render a text value with an Excel number-format code (for the `@` text
18
+ * section). Falls back to the text itself on an unsupported format.
19
+ */
20
+ export function format_text(fmt: string, text: string): string;
@@ -2,26 +2,9 @@
2
2
  let imports = {};
3
3
  imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- function addToExternrefTable0(obj) {
8
- const idx = wasm.__externref_table_alloc();
9
- wasm.__wbindgen_export_2.set(idx, obj);
10
- return idx;
11
- }
12
-
13
- function handleError(f, args) {
14
- try {
15
- return f.apply(this, args);
16
- } catch (e) {
17
- const idx = addToExternrefTable0(e);
18
- wasm.__wbindgen_exn_store(idx);
19
- }
20
- }
21
-
22
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
23
-
24
- cachedTextDecoder.decode();
7
+ let WASM_VECTOR_LEN = 0;
25
8
 
26
9
  let cachedUint8ArrayMemory0 = null;
27
10
 
@@ -32,13 +15,6 @@ function getUint8ArrayMemory0() {
32
15
  return cachedUint8ArrayMemory0;
33
16
  }
34
17
 
35
- function getStringFromWasm0(ptr, len) {
36
- ptr = ptr >>> 0;
37
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
38
- }
39
-
40
- let WASM_VECTOR_LEN = 0;
41
-
42
18
  let cachedTextEncoder = new TextEncoder('utf-8');
43
19
 
44
20
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -102,6 +78,30 @@ function getDataViewMemory0() {
102
78
  return cachedDataViewMemory0;
103
79
  }
104
80
 
81
+ function addToExternrefTable0(obj) {
82
+ const idx = wasm.__externref_table_alloc();
83
+ wasm.__wbindgen_export_4.set(idx, obj);
84
+ return idx;
85
+ }
86
+
87
+ function handleError(f, args) {
88
+ try {
89
+ return f.apply(this, args);
90
+ } catch (e) {
91
+ const idx = addToExternrefTable0(e);
92
+ wasm.__wbindgen_exn_store(idx);
93
+ }
94
+ }
95
+
96
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
97
+
98
+ cachedTextDecoder.decode();
99
+
100
+ function getStringFromWasm0(ptr, len) {
101
+ ptr = ptr >>> 0;
102
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
103
+ }
104
+
105
105
  function isLikeNone(x) {
106
106
  return x === undefined || x === null;
107
107
  }
@@ -192,6 +192,62 @@ module.exports.input_async_result = function(id, result) {
192
192
  return ret;
193
193
  };
194
194
 
195
+ /**
196
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
197
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
198
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
199
+ * JavaScript `String(value)` representation, matching the previous behavior.
200
+ * @param {string} fmt
201
+ * @param {number} value
202
+ * @returns {string}
203
+ */
204
+ module.exports.format_number = function(fmt, value) {
205
+ let deferred2_0;
206
+ let deferred2_1;
207
+ try {
208
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const len0 = WASM_VECTOR_LEN;
210
+ const ret = wasm.format_number(ptr0, len0, value);
211
+ deferred2_0 = ret[0];
212
+ deferred2_1 = ret[1];
213
+ return getStringFromWasm0(ret[0], ret[1]);
214
+ } finally {
215
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
216
+ }
217
+ };
218
+
219
+ /**
220
+ * Render a text value with an Excel number-format code (for the `@` text
221
+ * section). Falls back to the text itself on an unsupported format.
222
+ * @param {string} fmt
223
+ * @param {string} text
224
+ * @returns {string}
225
+ */
226
+ module.exports.format_text = function(fmt, text) {
227
+ let deferred3_0;
228
+ let deferred3_1;
229
+ try {
230
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
233
+ const len1 = WASM_VECTOR_LEN;
234
+ const ret = wasm.format_text(ptr0, len0, ptr1, len1);
235
+ deferred3_0 = ret[0];
236
+ deferred3_1 = ret[1];
237
+ return getStringFromWasm0(ret[0], ret[1]);
238
+ } finally {
239
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
240
+ }
241
+ };
242
+
243
+ module.exports.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
244
+ const ret = String(arg1);
245
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
+ const len1 = WASM_VECTOR_LEN;
247
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
248
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
249
+ };
250
+
195
251
  module.exports.__wbg_buffer_71667b1101df19da = function(arg0) {
196
252
  const ret = arg0.buffer;
197
253
  return ret;
@@ -490,7 +546,7 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
490
546
  };
491
547
 
492
548
  module.exports.__wbindgen_init_externref_table = function() {
493
- const table = wasm.__wbindgen_export_2;
549
+ const table = wasm.__wbindgen_export_4;
494
550
  const offset = table.grow(4);
495
551
  table.set(0, undefined);
496
552
  table.set(offset + 0, undefined);
Binary file
@@ -2,11 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const handle: (a: any, b: number) => any;
5
+ export const format_number: (a: number, b: number, c: number) => [number, number];
6
+ export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
5
7
  export const input_async_result: (a: number, b: any) => any;
8
+ export const __wbindgen_malloc: (a: number, b: number) => number;
9
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
6
10
  export const __wbindgen_exn_store: (a: number) => void;
7
11
  export const __externref_table_alloc: () => number;
8
- export const __wbindgen_export_2: WebAssembly.Table;
12
+ export const __wbindgen_export_4: WebAssembly.Table;
9
13
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
10
- export const __wbindgen_malloc: (a: number, b: number) => number;
11
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
12
14
  export const __wbindgen_start: () => void;
package/wasm/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.7.1",
6
+ "version": "1.9.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",