logisheets 1.11.0 → 1.12.1

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,20 +1,20 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function handle(msg: any, book_id?: number | null): any;
4
3
  /**
5
- * Render a number with an Excel number-format code, natively via `ssf-rs`
6
- * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
7
- * the `ssf` npm package. On an unsupported/invalid format it falls back to the
8
- * JavaScript `String(value)` representation, matching the previous behavior.
4
+ * Render a text value with an Excel number-format code (for the `@` text
5
+ * section). Falls back to the text itself on an unsupported format.
9
6
  */
10
- export function format_number(fmt: string, value: number): string;
7
+ export function format_text(fmt: string, text: string): string;
11
8
  /**
12
9
  * Input: AsyncFuncResult
13
10
  * Output: ActionAffect
14
11
  */
15
12
  export function input_async_result(id: number, result: any): any;
16
13
  /**
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.
14
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
15
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
16
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
17
+ * JavaScript `String(value)` representation, matching the previous behavior.
19
18
  */
20
- export function format_text(fmt: string, text: string): string;
19
+ export function format_number(fmt: string, value: number): string;
20
+ export function handle(msg: any, book_id?: number | null): any;
@@ -171,36 +171,26 @@ function debugString(val) {
171
171
  return className;
172
172
  }
173
173
  /**
174
- * @param {any} msg
175
- * @param {number | null} [book_id]
176
- * @returns {any}
177
- */
178
- module.exports.handle = function(msg, book_id) {
179
- const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
180
- return ret;
181
- };
182
-
183
- /**
184
- * Render a number with an Excel number-format code, natively via `ssf-rs`
185
- * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
186
- * the `ssf` npm package. On an unsupported/invalid format it falls back to the
187
- * JavaScript `String(value)` representation, matching the previous behavior.
174
+ * Render a text value with an Excel number-format code (for the `@` text
175
+ * section). Falls back to the text itself on an unsupported format.
188
176
  * @param {string} fmt
189
- * @param {number} value
177
+ * @param {string} text
190
178
  * @returns {string}
191
179
  */
192
- module.exports.format_number = function(fmt, value) {
193
- let deferred2_0;
194
- let deferred2_1;
180
+ module.exports.format_text = function(fmt, text) {
181
+ let deferred3_0;
182
+ let deferred3_1;
195
183
  try {
196
184
  const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
185
  const len0 = WASM_VECTOR_LEN;
198
- const ret = wasm.format_number(ptr0, len0, value);
199
- deferred2_0 = ret[0];
200
- deferred2_1 = ret[1];
186
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
187
+ const len1 = WASM_VECTOR_LEN;
188
+ const ret = wasm.format_text(ptr0, len0, ptr1, len1);
189
+ deferred3_0 = ret[0];
190
+ deferred3_1 = ret[1];
201
191
  return getStringFromWasm0(ret[0], ret[1]);
202
192
  } finally {
203
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
193
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
204
194
  }
205
195
  };
206
196
 
@@ -217,29 +207,39 @@ module.exports.input_async_result = function(id, result) {
217
207
  };
218
208
 
219
209
  /**
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.
210
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
211
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
212
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
213
+ * JavaScript `String(value)` representation, matching the previous behavior.
222
214
  * @param {string} fmt
223
- * @param {string} text
215
+ * @param {number} value
224
216
  * @returns {string}
225
217
  */
226
- module.exports.format_text = function(fmt, text) {
227
- let deferred3_0;
228
- let deferred3_1;
218
+ module.exports.format_number = function(fmt, value) {
219
+ let deferred2_0;
220
+ let deferred2_1;
229
221
  try {
230
222
  const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
223
  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];
224
+ const ret = wasm.format_number(ptr0, len0, value);
225
+ deferred2_0 = ret[0];
226
+ deferred2_1 = ret[1];
237
227
  return getStringFromWasm0(ret[0], ret[1]);
238
228
  } finally {
239
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
229
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
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.1",
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.1",
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,20 +1,20 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function handle(msg: any, book_id?: number | null): any;
4
3
  /**
5
- * Render a number with an Excel number-format code, natively via `ssf-rs`
6
- * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
7
- * the `ssf` npm package. On an unsupported/invalid format it falls back to the
8
- * JavaScript `String(value)` representation, matching the previous behavior.
4
+ * Render a text value with an Excel number-format code (for the `@` text
5
+ * section). Falls back to the text itself on an unsupported format.
9
6
  */
10
- export function format_number(fmt: string, value: number): string;
7
+ export function format_text(fmt: string, text: string): string;
11
8
  /**
12
9
  * Input: AsyncFuncResult
13
10
  * Output: ActionAffect
14
11
  */
15
12
  export function input_async_result(id: number, result: any): any;
16
13
  /**
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.
14
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
15
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
16
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
17
+ * JavaScript `String(value)` representation, matching the previous behavior.
19
18
  */
20
- export function format_text(fmt: string, text: string): string;
19
+ export function format_number(fmt: string, value: number): string;
20
+ export function handle(msg: any, book_id?: number | null): any;
@@ -171,36 +171,26 @@ function debugString(val) {
171
171
  return className;
172
172
  }
173
173
  /**
174
- * @param {any} msg
175
- * @param {number | null} [book_id]
176
- * @returns {any}
177
- */
178
- module.exports.handle = function(msg, book_id) {
179
- const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
180
- return ret;
181
- };
182
-
183
- /**
184
- * Render a number with an Excel number-format code, natively via `ssf-rs`
185
- * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
186
- * the `ssf` npm package. On an unsupported/invalid format it falls back to the
187
- * JavaScript `String(value)` representation, matching the previous behavior.
174
+ * Render a text value with an Excel number-format code (for the `@` text
175
+ * section). Falls back to the text itself on an unsupported format.
188
176
  * @param {string} fmt
189
- * @param {number} value
177
+ * @param {string} text
190
178
  * @returns {string}
191
179
  */
192
- module.exports.format_number = function(fmt, value) {
193
- let deferred2_0;
194
- let deferred2_1;
180
+ module.exports.format_text = function(fmt, text) {
181
+ let deferred3_0;
182
+ let deferred3_1;
195
183
  try {
196
184
  const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
185
  const len0 = WASM_VECTOR_LEN;
198
- const ret = wasm.format_number(ptr0, len0, value);
199
- deferred2_0 = ret[0];
200
- deferred2_1 = ret[1];
186
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
187
+ const len1 = WASM_VECTOR_LEN;
188
+ const ret = wasm.format_text(ptr0, len0, ptr1, len1);
189
+ deferred3_0 = ret[0];
190
+ deferred3_1 = ret[1];
201
191
  return getStringFromWasm0(ret[0], ret[1]);
202
192
  } finally {
203
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
193
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
204
194
  }
205
195
  };
206
196
 
@@ -217,29 +207,39 @@ module.exports.input_async_result = function(id, result) {
217
207
  };
218
208
 
219
209
  /**
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.
210
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
211
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
212
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
213
+ * JavaScript `String(value)` representation, matching the previous behavior.
222
214
  * @param {string} fmt
223
- * @param {string} text
215
+ * @param {number} value
224
216
  * @returns {string}
225
217
  */
226
- module.exports.format_text = function(fmt, text) {
227
- let deferred3_0;
228
- let deferred3_1;
218
+ module.exports.format_number = function(fmt, value) {
219
+ let deferred2_0;
220
+ let deferred2_1;
229
221
  try {
230
222
  const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
223
  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];
224
+ const ret = wasm.format_number(ptr0, len0, value);
225
+ deferred2_0 = ret[0];
226
+ deferred2_1 = ret[1];
237
227
  return getStringFromWasm0(ret[0], ret[1]);
238
228
  } finally {
239
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
229
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
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.1",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",