logisheets 1.11.0 → 1.12.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.
@@ -127,7 +127,17 @@ export declare class Workbook {
127
127
  batchGetCellCoordinateWithSheetById(ids: readonly SheetCellId[]): Result<readonly CellCoordinateWithSheet[]>;
128
128
  execTransaction(tx: Transaction): ActionEffect;
129
129
  load(buf: Uint8Array, bookName: string): ReturnCode;
130
- save(data: string): SaveFileResult;
130
+ /**
131
+ * Serialize to .xlsx bytes.
132
+ *
133
+ * `resolveBlockRefs` writes block formulas as ordinary A1 references
134
+ * instead of `BLOCKREF(...)`. Off by default: the named form is readable
135
+ * and reopens here intact, but no other spreadsheet knows those functions,
136
+ * so a file Excel must recalculate needs the coordinates. One-way — a
137
+ * resolved `BLOCKREFS` becomes a plain range, which LogiSheets does not
138
+ * parse back when it straddles a block.
139
+ */
140
+ save(data: string, resolveBlockRefs?: boolean): SaveFileResult;
131
141
  getAppData(): readonly AppData[];
132
142
  /** Monotonic counter bumped on every committed write — snapshot it to
133
143
  * detect concurrent modification (optimistic concurrency). */
@@ -302,7 +302,7 @@ class Workbook {
302
302
  rpc('commitTempStatus', undefined, this._id);
303
303
  }
304
304
  cleanupTempStatus() {
305
- rpc('cleanTempStatus', undefined, this._id);
305
+ rpc('cleanupTempStatus', undefined, this._id);
306
306
  }
307
307
  toggleStatus(useTemp) {
308
308
  rpc('toggleStatus', { useTemp }, this._id);
@@ -365,8 +365,18 @@ class Workbook {
365
365
  load(buf, bookName) {
366
366
  return rpc('loadWorkbook', { content: Array.from(buf), name: bookName }, this._id);
367
367
  }
368
- save(data) {
369
- return rpc('saveWorkbook', { appData: data }, this._id);
368
+ /**
369
+ * Serialize to .xlsx bytes.
370
+ *
371
+ * `resolveBlockRefs` writes block formulas as ordinary A1 references
372
+ * instead of `BLOCKREF(...)`. Off by default: the named form is readable
373
+ * and reopens here intact, but no other spreadsheet knows those functions,
374
+ * so a file Excel must recalculate needs the coordinates. One-way — a
375
+ * resolved `BLOCKREFS` becomes a plain range, which LogiSheets does not
376
+ * parse back when it straddles a block.
377
+ */
378
+ save(data, resolveBlockRefs = false) {
379
+ return rpc('saveWorkbook', { appData: data, resolveBlockRefs }, this._id);
370
380
  }
371
381
  getAppData() {
372
382
  return rpc('getAppData', undefined, this._id);
@@ -17,6 +17,7 @@ export interface ActionEffect {
17
17
  colRemoved: readonly SheetColId[];
18
18
  colUpdated: readonly SheetColId[];
19
19
  headerUpdated: readonly number[];
20
+ errorMessage?: string;
20
21
  }
21
22
  export declare class ActionEffectBuilder {
22
23
  private _version;
@@ -32,6 +33,7 @@ export declare class ActionEffectBuilder {
32
33
  private _colRemoved;
33
34
  private _colUpdated;
34
35
  private _headerUpdated;
36
+ private _errorMessage?;
35
37
  version(value: number): this;
36
38
  asyncTasks(value: readonly Task[]): this;
37
39
  status(value: StatusCode): this;
@@ -45,6 +47,7 @@ export declare class ActionEffectBuilder {
45
47
  colRemoved(value: readonly SheetColId[]): this;
46
48
  colUpdated(value: readonly SheetColId[]): this;
47
49
  headerUpdated(value: readonly number[]): this;
50
+ errorMessage(value: string): this;
48
51
  build(): {
49
52
  version: number;
50
53
  asyncTasks: readonly Task[];
@@ -59,5 +62,6 @@ export declare class ActionEffectBuilder {
59
62
  colRemoved: readonly SheetColId[];
60
63
  colUpdated: readonly SheetColId[];
61
64
  headerUpdated: readonly number[];
65
+ errorMessage: string | undefined;
62
66
  };
63
67
  }
@@ -15,6 +15,7 @@ class ActionEffectBuilder {
15
15
  _colRemoved;
16
16
  _colUpdated;
17
17
  _headerUpdated;
18
+ _errorMessage;
18
19
  version(value) {
19
20
  this._version = value;
20
21
  return this;
@@ -67,6 +68,10 @@ class ActionEffectBuilder {
67
68
  this._headerUpdated = value;
68
69
  return this;
69
70
  }
71
+ errorMessage(value) {
72
+ this._errorMessage = value;
73
+ return this;
74
+ }
70
75
  build() {
71
76
  if (this._version === undefined)
72
77
  throw new Error('missing version');
@@ -94,7 +99,7 @@ class ActionEffectBuilder {
94
99
  throw new Error('missing colUpdated');
95
100
  if (this._headerUpdated === undefined)
96
101
  throw new Error('missing headerUpdated');
97
- return { version: this._version, asyncTasks: this._asyncTasks, status: this._status, valueChanged: this._valueChanged, cellRemoved: this._cellRemoved, styleChanged: this._styleChanged, rowInserted: this._rowInserted, rowRemoved: this._rowRemoved, rowUpdated: this._rowUpdated, colInserted: this._colInserted, colRemoved: this._colRemoved, colUpdated: this._colUpdated, headerUpdated: this._headerUpdated };
102
+ return { version: this._version, asyncTasks: this._asyncTasks, status: this._status, valueChanged: this._valueChanged, cellRemoved: this._cellRemoved, styleChanged: this._styleChanged, rowInserted: this._rowInserted, rowRemoved: this._rowRemoved, rowUpdated: this._rowUpdated, colInserted: this._colInserted, colRemoved: this._colRemoved, colUpdated: this._colUpdated, headerUpdated: this._headerUpdated, errorMessage: this._errorMessage };
98
103
  }
99
104
  }
100
105
  exports.ActionEffectBuilder = ActionEffectBuilder;
@@ -1,3 +1,4 @@
1
1
  export interface SaveParams {
2
2
  appData: string;
3
+ resolveBlockRefs?: boolean;
3
4
  }
@@ -1,6 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function handle(msg: any, book_id?: number | null): any;
3
+ /**
4
+ * Input: AsyncFuncResult
5
+ * Output: ActionAffect
6
+ */
7
+ export function input_async_result(id: number, result: any): any;
4
8
  /**
5
9
  * Render a number with an Excel number-format code, natively via `ssf-rs`
6
10
  * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
@@ -8,13 +12,9 @@ export function handle(msg: any, book_id?: number | null): any;
8
12
  * JavaScript `String(value)` representation, matching the previous behavior.
9
13
  */
10
14
  export function format_number(fmt: string, value: number): string;
11
- /**
12
- * Input: AsyncFuncResult
13
- * Output: ActionAffect
14
- */
15
- export function input_async_result(id: number, result: any): any;
16
15
  /**
17
16
  * Render a text value with an Excel number-format code (for the `@` text
18
17
  * section). Falls back to the text itself on an unsupported format.
19
18
  */
20
19
  export function format_text(fmt: string, text: string): string;
20
+ export function handle(msg: any, book_id?: number | null): any;
@@ -171,12 +171,14 @@ function debugString(val) {
171
171
  return className;
172
172
  }
173
173
  /**
174
- * @param {any} msg
175
- * @param {number | null} [book_id]
174
+ * Input: AsyncFuncResult
175
+ * Output: ActionAffect
176
+ * @param {number} id
177
+ * @param {any} result
176
178
  * @returns {any}
177
179
  */
178
- module.exports.handle = function(msg, book_id) {
179
- const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
180
+ module.exports.input_async_result = function(id, result) {
181
+ const ret = wasm.input_async_result(id, result);
180
182
  return ret;
181
183
  };
182
184
 
@@ -204,18 +206,6 @@ module.exports.format_number = function(fmt, value) {
204
206
  }
205
207
  };
206
208
 
207
- /**
208
- * Input: AsyncFuncResult
209
- * Output: ActionAffect
210
- * @param {number} id
211
- * @param {any} result
212
- * @returns {any}
213
- */
214
- module.exports.input_async_result = function(id, result) {
215
- const ret = wasm.input_async_result(id, result);
216
- return ret;
217
- };
218
-
219
209
  /**
220
210
  * Render a text value with an Excel number-format code (for the `@` text
221
211
  * section). Falls back to the text itself on an unsupported format.
@@ -240,6 +230,16 @@ module.exports.format_text = function(fmt, text) {
240
230
  }
241
231
  };
242
232
 
233
+ /**
234
+ * @param {any} msg
235
+ * @param {number | null} [book_id]
236
+ * @returns {any}
237
+ */
238
+ module.exports.handle = function(msg, book_id) {
239
+ const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
240
+ return ret;
241
+ };
242
+
243
243
  module.exports.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
244
244
  const ret = String(arg1);
245
245
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const handle: (a: any, b: number) => any;
5
4
  export const format_number: (a: number, b: number, c: number) => [number, number];
6
5
  export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
7
6
  export const input_async_result: (a: number, b: any) => any;
7
+ export const handle: (a: any, b: number) => any;
8
8
  export const __wbindgen_malloc: (a: number, b: number) => number;
9
9
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10
10
  export const __wbindgen_exn_store: (a: number) => void;
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.11.0",
6
+ "version": "1.12.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.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Node.js bindings for LogiSheets — a Rust + WebAssembly spreadsheet engine that reads, edits, and writes real .xlsx (Excel) files (formulas, styles, and structure preserved) with no browser required.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,6 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function handle(msg: any, book_id?: number | null): any;
3
+ /**
4
+ * Input: AsyncFuncResult
5
+ * Output: ActionAffect
6
+ */
7
+ export function input_async_result(id: number, result: any): any;
4
8
  /**
5
9
  * Render a number with an Excel number-format code, natively via `ssf-rs`
6
10
  * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
@@ -8,13 +12,9 @@ export function handle(msg: any, book_id?: number | null): any;
8
12
  * JavaScript `String(value)` representation, matching the previous behavior.
9
13
  */
10
14
  export function format_number(fmt: string, value: number): string;
11
- /**
12
- * Input: AsyncFuncResult
13
- * Output: ActionAffect
14
- */
15
- export function input_async_result(id: number, result: any): any;
16
15
  /**
17
16
  * Render a text value with an Excel number-format code (for the `@` text
18
17
  * section). Falls back to the text itself on an unsupported format.
19
18
  */
20
19
  export function format_text(fmt: string, text: string): string;
20
+ export function handle(msg: any, book_id?: number | null): any;
@@ -171,12 +171,14 @@ function debugString(val) {
171
171
  return className;
172
172
  }
173
173
  /**
174
- * @param {any} msg
175
- * @param {number | null} [book_id]
174
+ * Input: AsyncFuncResult
175
+ * Output: ActionAffect
176
+ * @param {number} id
177
+ * @param {any} result
176
178
  * @returns {any}
177
179
  */
178
- module.exports.handle = function(msg, book_id) {
179
- const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
180
+ module.exports.input_async_result = function(id, result) {
181
+ const ret = wasm.input_async_result(id, result);
180
182
  return ret;
181
183
  };
182
184
 
@@ -204,18 +206,6 @@ module.exports.format_number = function(fmt, value) {
204
206
  }
205
207
  };
206
208
 
207
- /**
208
- * Input: AsyncFuncResult
209
- * Output: ActionAffect
210
- * @param {number} id
211
- * @param {any} result
212
- * @returns {any}
213
- */
214
- module.exports.input_async_result = function(id, result) {
215
- const ret = wasm.input_async_result(id, result);
216
- return ret;
217
- };
218
-
219
209
  /**
220
210
  * Render a text value with an Excel number-format code (for the `@` text
221
211
  * section). Falls back to the text itself on an unsupported format.
@@ -240,6 +230,16 @@ module.exports.format_text = function(fmt, text) {
240
230
  }
241
231
  };
242
232
 
233
+ /**
234
+ * @param {any} msg
235
+ * @param {number | null} [book_id]
236
+ * @returns {any}
237
+ */
238
+ module.exports.handle = function(msg, book_id) {
239
+ const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
240
+ return ret;
241
+ };
242
+
243
243
  module.exports.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
244
244
  const ret = String(arg1);
245
245
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
Binary file
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const handle: (a: any, b: number) => any;
5
4
  export const format_number: (a: number, b: number, c: number) => [number, number];
6
5
  export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
7
6
  export const input_async_result: (a: number, b: any) => any;
7
+ export const handle: (a: any, b: number) => any;
8
8
  export const __wbindgen_malloc: (a: number, b: number) => number;
9
9
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10
10
  export const __wbindgen_exn_store: (a: number) => 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.11.0",
6
+ "version": "1.12.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",