@truecalc/core 6.0.1 → 6.1.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@truecalc/core",
3
3
  "type": "module",
4
4
  "description": "Spreadsheet formula engine for the browser — Google Sheets–compatible formula evaluator compiled to WebAssembly",
5
- "version": "6.0.1",
5
+ "version": "6.1.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -34,6 +34,11 @@ export interface FunctionInfo {
34
34
  description: string;
35
35
  }
36
36
 
37
+ export interface RenameSheetRefsResult {
38
+ formula?: string;
39
+ error?: string;
40
+ }
41
+
37
42
  export interface TranslateResult {
38
43
  formula?: string;
39
44
  error?: string;
@@ -83,6 +88,16 @@ export function evaluate(formula: string, variables: any): EvalResult;
83
88
  */
84
89
  export function list_functions(): FunctionInfo[];
85
90
 
91
+ /**
92
+ * Rewrite the sheet qualifier of every cell/range reference in `formula`
93
+ * that points at `old` to point at `new` instead — the sheet-rename
94
+ * reference-rewrite transform. Sheet-name matching is case-insensitive.
95
+ * Requoting is handled automatically. Unqualified refs, refs to other
96
+ * sheets, string literals, function names, and defined names are left
97
+ * untouched; no-op if `formula` has no `old`-qualified refs.
98
+ */
99
+ export function rename_sheet_refs(formula: string, old: string, _new: string): RenameSheetRefsResult;
100
+
86
101
  /**
87
102
  * Shift every relative cell/range reference in `formula` by `(d_row, d_col)`
88
103
  * — the fill / copy-paste reference-adjustment transform. `$`-absolute axes
package/truecalc_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./truecalc_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- Engine, createEngine, evaluate, list_functions, translate_formula, validate
8
+ Engine, createEngine, evaluate, list_functions, rename_sheet_refs, translate_formula, validate
9
9
  } from "./truecalc_wasm_bg.js";
@@ -98,6 +98,29 @@ export function list_functions() {
98
98
  }
99
99
  }
100
100
 
101
+ /**
102
+ * Rewrite the sheet qualifier of every cell/range reference in `formula`
103
+ * that points at `old` to point at `new` instead — the sheet-rename
104
+ * reference-rewrite transform. Sheet-name matching is case-insensitive.
105
+ * Requoting is handled automatically. Unqualified refs, refs to other
106
+ * sheets, string literals, function names, and defined names are left
107
+ * untouched; no-op if `formula` has no `old`-qualified refs.
108
+ * @param {string} formula
109
+ * @param {string} old
110
+ * @param {string} _new
111
+ * @returns {RenameSheetRefsResult}
112
+ */
113
+ export function rename_sheet_refs(formula, old, _new) {
114
+ const ptr0 = passStringToWasm0(formula, wasm.__wbindgen_export, wasm.__wbindgen_export2);
115
+ const len0 = WASM_VECTOR_LEN;
116
+ const ptr1 = passStringToWasm0(old, wasm.__wbindgen_export, wasm.__wbindgen_export2);
117
+ const len1 = WASM_VECTOR_LEN;
118
+ const ptr2 = passStringToWasm0(_new, wasm.__wbindgen_export, wasm.__wbindgen_export2);
119
+ const len2 = WASM_VECTOR_LEN;
120
+ const ret = wasm.rename_sheet_refs(ptr0, len0, ptr1, len1, ptr2, len2);
121
+ return takeObject(ret);
122
+ }
123
+
101
124
  /**
102
125
  * Shift every relative cell/range reference in `formula` by `(d_row, d_col)`
103
126
  * — the fill / copy-paste reference-adjustment transform. `$`-absolute axes
Binary file