@univerjs/sheets-formula 0.15.3 → 0.15.4

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/lib/cjs/facade.js CHANGED
@@ -1 +1 @@
1
- "use strict";const d=require("@univerjs/core"),x=require("@univerjs/core/facade"),F=require("@univerjs/engine-formula"),i=require("@univerjs/sheets-formula"),y=require("@univerjs/engine-formula/facade"),C=require("@univerjs/sheets/facade");class R extends x.FUniver{_initialize(){this._debouncedFormulaCalculation=d.debounce(()=>{this._commandService.executeCommand(F.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(t){let n=this._injector.get(i.IRegisterFunctionService);n||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),n=this._injector.get(i.IRegisterFunctionService));const e=n.registerFunctions(t);return this._debouncedFormulaCalculation(),e}}x.FUniver.extend(R);class j extends y.FFormula{_initialize(){this._debouncedFormulaCalculation=d.debounce(()=>{this._commandService.executeCommand(F.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){const e=this._injector.get(d.LifecycleService).stage,o=this._injector.get(d.ILogService),c=this._injector.get(d.IConfigService);e>d.LifecycleStages.Starting&&o.warn("[FFormula]","CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");const r=c.getConfig(i.PLUGIN_CONFIG_KEY_BASE);if(!r){c.setConfig(i.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}r.initialFormulaComputing=t}registerFunction(t,n,e){var s;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const c={name:t,func:n,description:typeof e=="string"?e:(s=e==null?void 0:e.description)!=null?s:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerFunction(c);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(t,n,e){var s;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const c={name:t,func:n,description:typeof e=="string"?e:(s=e==null?void 0:e.description)!=null?s:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerAsyncFunction(c);return this._debouncedFormulaCalculation(),r}}y.FFormula.extend(j);class M{get CalculationMode(){return i.CalculationMode}}x.FEnum.extend(M);class E extends C.FWorkbook{getAllFormulaError(){const t=[],n=this._workbook,e=n.getUnitId(),o=n.getSheets(),c=this._injector.get(F.FormulaDataModel).getArrayFormulaCellData();return o.forEach(r=>{var S;const s=r.getName(),v=r.getSheetId(),I=r.getCellMatrix(),m=((S=c==null?void 0:c[e])==null?void 0:S[v])||{};I.forValue((_,h,u)=>{var g;if(!u)return;const l=(g=m==null?void 0:m[_])==null?void 0:g[h],a=F.extractFormulaError(u,!!l);a&&t.push({sheetName:s,row:_,column:h,formula:u.f||"",errorType:a})})}),t}}C.FWorkbook.extend(E);class w extends C.FRange{getFormulaError(){var h,u;const t=[],n=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),o=this._worksheet.getName(),c=this._workbook.getSheetBySheetId(e);if(!c)return t;const r=this._injector.get(F.FormulaDataModel).getArrayFormulaCellData(),s=((h=r==null?void 0:r[n])==null?void 0:h[e])||{},v=c.getCellMatrix(),{startRow:I,endRow:m,startColumn:S,endColumn:_}=this._range;for(let l=I;l<=m;l++)for(let a=S;a<=_;a++){const g=v.getValue(l,a);if(!g)continue;const k=(u=s==null?void 0:s[l])==null?void 0:u[a],b=F.extractFormulaError(g,!!k);b&&t.push({sheetName:o,row:l,column:a,formula:g.f||"",errorType:b})}return t}}C.FRange.extend(w);
1
+ "use strict";const C=require("@univerjs/core"),I=require("@univerjs/core/facade"),s=require("@univerjs/engine-formula"),c=require("@univerjs/sheets-formula"),b=require("@univerjs/engine-formula/facade"),y=require("@univerjs/sheets"),R=require("@univerjs/sheets/facade");class p extends I.FUniver{_initialize(){this._debouncedFormulaCalculation=C.debounce(()=>{this._commandService.executeCommand(s.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(t){let o=this._injector.get(c.IRegisterFunctionService);o||(this._injector.add([c.IRegisterFunctionService,{useClass:c.RegisterFunctionService}]),o=this._injector.get(c.IRegisterFunctionService));const e=o.registerFunctions(t);return this._debouncedFormulaCalculation(),e}}I.FUniver.extend(p);class M extends b.FFormula{_initialize(){this._debouncedFormulaCalculation=C.debounce(()=>{this._commandService.executeCommand(s.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){const e=this._injector.get(C.LifecycleService).stage,n=this._injector.get(C.ILogService),i=this._injector.get(C.IConfigService);e>C.LifecycleStages.Starting&&n.warn("[FFormula]","CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");const r=i.getConfig(c.PLUGIN_CONFIG_KEY_BASE);if(!r){i.setConfig(c.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}r.initialFormulaComputing=t}registerFunction(t,o,e){var a;let n=this._injector.get(c.IRegisterFunctionService);n||(this._injector.add([c.IRegisterFunctionService,{useClass:c.RegisterFunctionService}]),n=this._injector.get(c.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerFunction(i);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(t,o,e){var a;let n=this._injector.get(c.IRegisterFunctionService);n||(this._injector.add([c.IRegisterFunctionService,{useClass:c.RegisterFunctionService}]),n=this._injector.get(c.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerAsyncFunction(i);return this._debouncedFormulaCalculation(),r}calculationResultApplied(t){let o=!1,e=!1,n=null;return this._commandService.onCommandExecuted((i,r)=>{i.id!==s.SetFormulaCalculationResultMutation.id&&i.id!==y.SetRangeValuesMutation.id||(i.id===s.SetFormulaCalculationResultMutation.id&&(o=!0,n=i.params),i.id===y.SetRangeValuesMutation.id&&(r!=null&&r.applyFormulaCalculationResult)&&(e=!0),!(!o||!e)&&requestIdleCallback(()=>{t(n)}))})}onCalculationResultApplied(){return new Promise((t,o)=>{let e=!1,n=!1;const i=setTimeout(()=>{l(),o(new Error("Calculation end timeout"))},6e4),r=setTimeout(()=>{e||(l(),t())},500),a=this.calculationProcessing(g=>{const{stage:m,totalArrayFormulasToCalculate:f,totalFormulasToCalculate:d}=g;if(m===s.FormulaExecuteStageType.START_CALCULATION&&f+d===0){l(),t();return}e||(e=!0,clearTimeout(r))}),_=this.calculationResultApplied(()=>{n||(n=!0,l(),t())});function l(){clearTimeout(i),clearTimeout(r),a.dispose(),_.dispose()}})}}b.FFormula.extend(M);class j{get CalculationMode(){return c.CalculationMode}}I.FEnum.extend(j);class E extends R.FWorkbook{getAllFormulaError(){const t=[],o=this._workbook,e=o.getUnitId(),n=o.getSheets(),i=this._injector.get(s.FormulaDataModel).getArrayFormulaCellData();return n.forEach(r=>{var m;const a=r.getName(),_=r.getSheetId(),l=r.getCellMatrix(),g=((m=i==null?void 0:i[e])==null?void 0:m[_])||{};l.forValue((f,d,h)=>{var S;if(!h)return;const F=(S=g==null?void 0:g[f])==null?void 0:S[d],u=s.extractFormulaError(h,!!F);u&&t.push({sheetName:a,row:f,column:d,formula:h.f||"",errorType:u})})}),t}}R.FWorkbook.extend(E);class T extends R.FRange{getFormulaError(){var d,h;const t=[],o=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),n=this._worksheet.getName(),i=this._workbook.getSheetBySheetId(e);if(!i)return t;const r=this._injector.get(s.FormulaDataModel).getArrayFormulaCellData(),a=((d=r==null?void 0:r[o])==null?void 0:d[e])||{},_=i.getCellMatrix(),{startRow:l,endRow:g,startColumn:m,endColumn:f}=this._range;for(let F=l;F<=g;F++)for(let u=m;u<=f;u++){const S=_.getValue(F,u);if(!S)continue;const k=(h=a==null?void 0:a[F])==null?void 0:h[u],x=s.extractFormulaError(S,!!k);x&&t.push({sheetName:n,row:F,column:u,formula:S.f||"",errorType:x})}return t}}R.FRange.extend(T);
@@ -0,0 +1 @@
1
+ "use strict";const a={formula:{progress:{analyzing:"Analyzovanie",calculating:"Výpočet","array-analysis":"Analýza poľa","array-calculation":"Výpočet poľa",done:"Hotovo"}}};module.exports=a;
package/lib/es/facade.js CHANGED
@@ -1,18 +1,19 @@
1
- import { debounce as y, LifecycleService as D, ILogService as R, IConfigService as U, LifecycleStages as A } from "@univerjs/core";
2
- import { FUniver as b, FEnum as L } from "@univerjs/core/facade";
3
- import { SetTriggerFormulaCalculationStartMutation as j, FormulaDataModel as k, extractFormulaError as I } from "@univerjs/engine-formula";
4
- import { IRegisterFunctionService as s, RegisterFunctionService as S, PLUGIN_CONFIG_KEY_BASE as v, CalculationMode as N } from "@univerjs/sheets-formula";
5
- import { FFormula as w } from "@univerjs/engine-formula/facade";
6
- import { FWorkbook as M, FRange as p } from "@univerjs/sheets/facade";
7
- class z extends b {
1
+ import { debounce as v, LifecycleService as E, ILogService as D, IConfigService as L, LifecycleStages as U } from "@univerjs/core";
2
+ import { FUniver as I, FEnum as N } from "@univerjs/core/facade";
3
+ import { SetTriggerFormulaCalculationStartMutation as k, SetFormulaCalculationResultMutation as y, FormulaExecuteStageType as z, FormulaDataModel as j, extractFormulaError as R } from "@univerjs/engine-formula";
4
+ import { IRegisterFunctionService as a, RegisterFunctionService as _, PLUGIN_CONFIG_KEY_BASE as x, CalculationMode as P } from "@univerjs/sheets-formula";
5
+ import { FFormula as T } from "@univerjs/engine-formula/facade";
6
+ import { SetRangeValuesMutation as b } from "@univerjs/sheets";
7
+ import { FWorkbook as w, FRange as M } from "@univerjs/sheets/facade";
8
+ class V extends I {
8
9
  /**
9
10
  * Initialize the FUniver instance.
10
11
  * @ignore
11
12
  */
12
13
  _initialize() {
13
- this._debouncedFormulaCalculation = y(() => {
14
+ this._debouncedFormulaCalculation = v(() => {
14
15
  this._commandService.executeCommand(
15
- j.id,
16
+ k.id,
16
17
  {
17
18
  commands: [],
18
19
  forceCalculation: !0
@@ -24,22 +25,22 @@ class z extends b {
24
25
  }, 10);
25
26
  }
26
27
  registerFunction(t) {
27
- let r = this._injector.get(s);
28
- r || (this._injector.add([s, { useClass: S }]), r = this._injector.get(s));
29
- const e = r.registerFunctions(t);
28
+ let n = this._injector.get(a);
29
+ n || (this._injector.add([a, { useClass: _ }]), n = this._injector.get(a));
30
+ const e = n.registerFunctions(t);
30
31
  return this._debouncedFormulaCalculation(), e;
31
32
  }
32
33
  }
33
- b.extend(z);
34
- class T extends w {
34
+ I.extend(V);
35
+ class W extends T {
35
36
  /**
36
37
  * Initialize the FUniver instance.
37
38
  * @ignore
38
39
  */
39
40
  _initialize() {
40
- this._debouncedFormulaCalculation = y(() => {
41
+ this._debouncedFormulaCalculation = v(() => {
41
42
  this._commandService.executeCommand(
42
- j.id,
43
+ k.id,
43
44
  {
44
45
  commands: [],
45
46
  forceCalculation: !0
@@ -51,89 +52,119 @@ class T extends w {
51
52
  }, 10);
52
53
  }
53
54
  setInitialFormulaComputing(t) {
54
- const e = this._injector.get(D).stage, o = this._injector.get(R), n = this._injector.get(U);
55
- e > A.Starting && o.warn("[FFormula]", "CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");
56
- const i = n.getConfig(v);
57
- if (!i) {
58
- n.setConfig(v, { initialFormulaComputing: t });
55
+ const e = this._injector.get(E).stage, o = this._injector.get(D), i = this._injector.get(L);
56
+ e > U.Starting && o.warn("[FFormula]", "CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");
57
+ const r = i.getConfig(x);
58
+ if (!r) {
59
+ i.setConfig(x, { initialFormulaComputing: t });
59
60
  return;
60
61
  }
61
- i.initialFormulaComputing = t;
62
+ r.initialFormulaComputing = t;
62
63
  }
63
- registerFunction(t, r, e) {
64
- var c;
65
- let o = this._injector.get(s);
66
- o || (this._injector.add([s, { useClass: S }]), o = this._injector.get(s));
67
- const n = {
64
+ registerFunction(t, n, e) {
65
+ var l;
66
+ let o = this._injector.get(a);
67
+ o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
68
+ const i = {
68
69
  name: t,
69
- func: r,
70
- description: typeof e == "string" ? e : (c = e == null ? void 0 : e.description) != null ? c : "",
70
+ func: n,
71
+ description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
71
72
  locales: typeof e == "object" ? e.locales : void 0
72
- }, i = o.registerFunction(n);
73
- return this._debouncedFormulaCalculation(), i;
73
+ }, r = o.registerFunction(i);
74
+ return this._debouncedFormulaCalculation(), r;
74
75
  }
75
- registerAsyncFunction(t, r, e) {
76
- var c;
77
- let o = this._injector.get(s);
78
- o || (this._injector.add([s, { useClass: S }]), o = this._injector.get(s));
79
- const n = {
76
+ registerAsyncFunction(t, n, e) {
77
+ var l;
78
+ let o = this._injector.get(a);
79
+ o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
80
+ const i = {
80
81
  name: t,
81
- func: r,
82
- description: typeof e == "string" ? e : (c = e == null ? void 0 : e.description) != null ? c : "",
82
+ func: n,
83
+ description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
83
84
  locales: typeof e == "object" ? e.locales : void 0
84
- }, i = o.registerAsyncFunction(n);
85
- return this._debouncedFormulaCalculation(), i;
85
+ }, r = o.registerAsyncFunction(i);
86
+ return this._debouncedFormulaCalculation(), r;
87
+ }
88
+ calculationResultApplied(t) {
89
+ let n = !1, e = !1, o = null;
90
+ return this._commandService.onCommandExecuted((i, r) => {
91
+ i.id !== y.id && i.id !== b.id || (i.id === y.id && (n = !0, o = i.params), i.id === b.id && (r != null && r.applyFormulaCalculationResult) && (e = !0), !(!n || !e) && requestIdleCallback(() => {
92
+ t(o);
93
+ }));
94
+ });
95
+ }
96
+ onCalculationResultApplied() {
97
+ return new Promise((t, n) => {
98
+ let e = !1, o = !1;
99
+ const i = setTimeout(() => {
100
+ c(), n(new Error("Calculation end timeout"));
101
+ }, 6e4), r = setTimeout(() => {
102
+ e || (c(), t());
103
+ }, 500), l = this.calculationProcessing((u) => {
104
+ const { stage: g, totalArrayFormulasToCalculate: f, totalFormulasToCalculate: d } = u;
105
+ if (g === z.START_CALCULATION && f + d === 0) {
106
+ c(), t();
107
+ return;
108
+ }
109
+ e || (e = !0, clearTimeout(r));
110
+ }), C = this.calculationResultApplied(() => {
111
+ o || (o = !0, c(), t());
112
+ });
113
+ function c() {
114
+ clearTimeout(i), clearTimeout(r), l.dispose(), C.dispose();
115
+ }
116
+ });
86
117
  }
87
118
  }
88
- w.extend(T);
119
+ T.extend(W);
89
120
  class B {
90
121
  get CalculationMode() {
91
- return N;
122
+ return P;
92
123
  }
93
124
  }
94
- L.extend(B);
95
- class G extends M {
125
+ N.extend(B);
126
+ class G extends w {
96
127
  getAllFormulaError() {
97
- const t = [], r = this._workbook, e = r.getUnitId(), o = r.getSheets(), n = this._injector.get(k).getArrayFormulaCellData();
98
- return o.forEach((i) => {
99
- var h;
100
- const c = i.getName(), _ = i.getSheetId(), C = i.getCellMatrix(), m = ((h = n == null ? void 0 : n[e]) == null ? void 0 : h[_]) || {};
101
- C.forValue((F, d, u) => {
102
- var g;
103
- if (!u) return;
104
- const l = (g = m == null ? void 0 : m[F]) == null ? void 0 : g[d], a = I(u, !!l);
105
- a && t.push({
106
- sheetName: c,
107
- row: F,
128
+ const t = [], n = this._workbook, e = n.getUnitId(), o = n.getSheets(), i = this._injector.get(j).getArrayFormulaCellData();
129
+ return o.forEach((r) => {
130
+ var g;
131
+ const l = r.getName(), C = r.getSheetId(), c = r.getCellMatrix(), u = ((g = i == null ? void 0 : i[e]) == null ? void 0 : g[C]) || {};
132
+ c.forValue((f, d, h) => {
133
+ var F;
134
+ if (!h) return;
135
+ const m = (F = u == null ? void 0 : u[f]) == null ? void 0 : F[d], s = R(h, !!m);
136
+ s && t.push({
137
+ sheetName: l,
138
+ row: f,
108
139
  column: d,
109
- formula: u.f || "",
110
- errorType: a
140
+ formula: h.f || "",
141
+ errorType: s
111
142
  });
112
143
  });
113
144
  }), t;
114
145
  }
115
146
  }
116
- M.extend(G);
117
- class V extends p {
147
+ w.extend(G);
148
+ class O extends M {
118
149
  getFormulaError() {
119
- var d, u;
120
- const t = [], r = this._workbook.getUnitId(), e = this._worksheet.getSheetId(), o = this._worksheet.getName(), n = this._workbook.getSheetBySheetId(e);
121
- if (!n) return t;
122
- const i = this._injector.get(k).getArrayFormulaCellData(), c = ((d = i == null ? void 0 : i[r]) == null ? void 0 : d[e]) || {}, _ = n.getCellMatrix(), { startRow: C, endRow: m, startColumn: h, endColumn: F } = this._range;
123
- for (let l = C; l <= m; l++)
124
- for (let a = h; a <= F; a++) {
125
- const g = _.getValue(l, a);
126
- if (!g) continue;
127
- const E = (u = c == null ? void 0 : c[l]) == null ? void 0 : u[a], x = I(g, !!E);
128
- x && t.push({
150
+ var d, h;
151
+ const t = [], n = this._workbook.getUnitId(), e = this._worksheet.getSheetId(), o = this._worksheet.getName(), i = this._workbook.getSheetBySheetId(e);
152
+ if (!i) return t;
153
+ const r = this._injector.get(j).getArrayFormulaCellData(), l = ((d = r == null ? void 0 : r[n]) == null ? void 0 : d[e]) || {}, C = i.getCellMatrix(), { startRow: c, endRow: u, startColumn: g, endColumn: f } = this._range;
154
+ for (let m = c; m <= u; m++)
155
+ for (let s = g; s <= f; s++) {
156
+ const F = C.getValue(m, s);
157
+ if (!F) continue;
158
+ const A = (h = l == null ? void 0 : l[m]) == null ? void 0 : h[s], p = R(F, !!A);
159
+ p && t.push({
129
160
  sheetName: o,
130
- row: l,
131
- column: a,
132
- formula: g.f || "",
133
- errorType: x
161
+ row: m,
162
+ column: s,
163
+ formula: F.f || "",
164
+ errorType: p
134
165
  });
135
166
  }
136
167
  return t;
137
168
  }
138
169
  }
139
- p.extend(V);
170
+ M.extend(O);
@@ -0,0 +1,14 @@
1
+ const a = {
2
+ formula: {
3
+ progress: {
4
+ analyzing: "Analyzovanie",
5
+ calculating: "Výpočet",
6
+ "array-analysis": "Analýza poľa",
7
+ "array-calculation": "Výpočet poľa",
8
+ done: "Hotovo"
9
+ }
10
+ }
11
+ };
12
+ export {
13
+ a as default
14
+ };
package/lib/facade.js CHANGED
@@ -1,18 +1,19 @@
1
- import { debounce as y, LifecycleService as D, ILogService as R, IConfigService as U, LifecycleStages as A } from "@univerjs/core";
2
- import { FUniver as b, FEnum as L } from "@univerjs/core/facade";
3
- import { SetTriggerFormulaCalculationStartMutation as j, FormulaDataModel as k, extractFormulaError as I } from "@univerjs/engine-formula";
4
- import { IRegisterFunctionService as s, RegisterFunctionService as S, PLUGIN_CONFIG_KEY_BASE as v, CalculationMode as N } from "@univerjs/sheets-formula";
5
- import { FFormula as w } from "@univerjs/engine-formula/facade";
6
- import { FWorkbook as M, FRange as p } from "@univerjs/sheets/facade";
7
- class z extends b {
1
+ import { debounce as v, LifecycleService as E, ILogService as D, IConfigService as L, LifecycleStages as U } from "@univerjs/core";
2
+ import { FUniver as I, FEnum as N } from "@univerjs/core/facade";
3
+ import { SetTriggerFormulaCalculationStartMutation as k, SetFormulaCalculationResultMutation as y, FormulaExecuteStageType as z, FormulaDataModel as j, extractFormulaError as R } from "@univerjs/engine-formula";
4
+ import { IRegisterFunctionService as a, RegisterFunctionService as _, PLUGIN_CONFIG_KEY_BASE as x, CalculationMode as P } from "@univerjs/sheets-formula";
5
+ import { FFormula as T } from "@univerjs/engine-formula/facade";
6
+ import { SetRangeValuesMutation as b } from "@univerjs/sheets";
7
+ import { FWorkbook as w, FRange as M } from "@univerjs/sheets/facade";
8
+ class V extends I {
8
9
  /**
9
10
  * Initialize the FUniver instance.
10
11
  * @ignore
11
12
  */
12
13
  _initialize() {
13
- this._debouncedFormulaCalculation = y(() => {
14
+ this._debouncedFormulaCalculation = v(() => {
14
15
  this._commandService.executeCommand(
15
- j.id,
16
+ k.id,
16
17
  {
17
18
  commands: [],
18
19
  forceCalculation: !0
@@ -24,22 +25,22 @@ class z extends b {
24
25
  }, 10);
25
26
  }
26
27
  registerFunction(t) {
27
- let r = this._injector.get(s);
28
- r || (this._injector.add([s, { useClass: S }]), r = this._injector.get(s));
29
- const e = r.registerFunctions(t);
28
+ let n = this._injector.get(a);
29
+ n || (this._injector.add([a, { useClass: _ }]), n = this._injector.get(a));
30
+ const e = n.registerFunctions(t);
30
31
  return this._debouncedFormulaCalculation(), e;
31
32
  }
32
33
  }
33
- b.extend(z);
34
- class T extends w {
34
+ I.extend(V);
35
+ class W extends T {
35
36
  /**
36
37
  * Initialize the FUniver instance.
37
38
  * @ignore
38
39
  */
39
40
  _initialize() {
40
- this._debouncedFormulaCalculation = y(() => {
41
+ this._debouncedFormulaCalculation = v(() => {
41
42
  this._commandService.executeCommand(
42
- j.id,
43
+ k.id,
43
44
  {
44
45
  commands: [],
45
46
  forceCalculation: !0
@@ -51,89 +52,119 @@ class T extends w {
51
52
  }, 10);
52
53
  }
53
54
  setInitialFormulaComputing(t) {
54
- const e = this._injector.get(D).stage, o = this._injector.get(R), n = this._injector.get(U);
55
- e > A.Starting && o.warn("[FFormula]", "CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");
56
- const i = n.getConfig(v);
57
- if (!i) {
58
- n.setConfig(v, { initialFormulaComputing: t });
55
+ const e = this._injector.get(E).stage, o = this._injector.get(D), i = this._injector.get(L);
56
+ e > U.Starting && o.warn("[FFormula]", "CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");
57
+ const r = i.getConfig(x);
58
+ if (!r) {
59
+ i.setConfig(x, { initialFormulaComputing: t });
59
60
  return;
60
61
  }
61
- i.initialFormulaComputing = t;
62
+ r.initialFormulaComputing = t;
62
63
  }
63
- registerFunction(t, r, e) {
64
- var c;
65
- let o = this._injector.get(s);
66
- o || (this._injector.add([s, { useClass: S }]), o = this._injector.get(s));
67
- const n = {
64
+ registerFunction(t, n, e) {
65
+ var l;
66
+ let o = this._injector.get(a);
67
+ o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
68
+ const i = {
68
69
  name: t,
69
- func: r,
70
- description: typeof e == "string" ? e : (c = e == null ? void 0 : e.description) != null ? c : "",
70
+ func: n,
71
+ description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
71
72
  locales: typeof e == "object" ? e.locales : void 0
72
- }, i = o.registerFunction(n);
73
- return this._debouncedFormulaCalculation(), i;
73
+ }, r = o.registerFunction(i);
74
+ return this._debouncedFormulaCalculation(), r;
74
75
  }
75
- registerAsyncFunction(t, r, e) {
76
- var c;
77
- let o = this._injector.get(s);
78
- o || (this._injector.add([s, { useClass: S }]), o = this._injector.get(s));
79
- const n = {
76
+ registerAsyncFunction(t, n, e) {
77
+ var l;
78
+ let o = this._injector.get(a);
79
+ o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
80
+ const i = {
80
81
  name: t,
81
- func: r,
82
- description: typeof e == "string" ? e : (c = e == null ? void 0 : e.description) != null ? c : "",
82
+ func: n,
83
+ description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
83
84
  locales: typeof e == "object" ? e.locales : void 0
84
- }, i = o.registerAsyncFunction(n);
85
- return this._debouncedFormulaCalculation(), i;
85
+ }, r = o.registerAsyncFunction(i);
86
+ return this._debouncedFormulaCalculation(), r;
87
+ }
88
+ calculationResultApplied(t) {
89
+ let n = !1, e = !1, o = null;
90
+ return this._commandService.onCommandExecuted((i, r) => {
91
+ i.id !== y.id && i.id !== b.id || (i.id === y.id && (n = !0, o = i.params), i.id === b.id && (r != null && r.applyFormulaCalculationResult) && (e = !0), !(!n || !e) && requestIdleCallback(() => {
92
+ t(o);
93
+ }));
94
+ });
95
+ }
96
+ onCalculationResultApplied() {
97
+ return new Promise((t, n) => {
98
+ let e = !1, o = !1;
99
+ const i = setTimeout(() => {
100
+ c(), n(new Error("Calculation end timeout"));
101
+ }, 6e4), r = setTimeout(() => {
102
+ e || (c(), t());
103
+ }, 500), l = this.calculationProcessing((u) => {
104
+ const { stage: g, totalArrayFormulasToCalculate: f, totalFormulasToCalculate: d } = u;
105
+ if (g === z.START_CALCULATION && f + d === 0) {
106
+ c(), t();
107
+ return;
108
+ }
109
+ e || (e = !0, clearTimeout(r));
110
+ }), C = this.calculationResultApplied(() => {
111
+ o || (o = !0, c(), t());
112
+ });
113
+ function c() {
114
+ clearTimeout(i), clearTimeout(r), l.dispose(), C.dispose();
115
+ }
116
+ });
86
117
  }
87
118
  }
88
- w.extend(T);
119
+ T.extend(W);
89
120
  class B {
90
121
  get CalculationMode() {
91
- return N;
122
+ return P;
92
123
  }
93
124
  }
94
- L.extend(B);
95
- class G extends M {
125
+ N.extend(B);
126
+ class G extends w {
96
127
  getAllFormulaError() {
97
- const t = [], r = this._workbook, e = r.getUnitId(), o = r.getSheets(), n = this._injector.get(k).getArrayFormulaCellData();
98
- return o.forEach((i) => {
99
- var h;
100
- const c = i.getName(), _ = i.getSheetId(), C = i.getCellMatrix(), m = ((h = n == null ? void 0 : n[e]) == null ? void 0 : h[_]) || {};
101
- C.forValue((F, d, u) => {
102
- var g;
103
- if (!u) return;
104
- const l = (g = m == null ? void 0 : m[F]) == null ? void 0 : g[d], a = I(u, !!l);
105
- a && t.push({
106
- sheetName: c,
107
- row: F,
128
+ const t = [], n = this._workbook, e = n.getUnitId(), o = n.getSheets(), i = this._injector.get(j).getArrayFormulaCellData();
129
+ return o.forEach((r) => {
130
+ var g;
131
+ const l = r.getName(), C = r.getSheetId(), c = r.getCellMatrix(), u = ((g = i == null ? void 0 : i[e]) == null ? void 0 : g[C]) || {};
132
+ c.forValue((f, d, h) => {
133
+ var F;
134
+ if (!h) return;
135
+ const m = (F = u == null ? void 0 : u[f]) == null ? void 0 : F[d], s = R(h, !!m);
136
+ s && t.push({
137
+ sheetName: l,
138
+ row: f,
108
139
  column: d,
109
- formula: u.f || "",
110
- errorType: a
140
+ formula: h.f || "",
141
+ errorType: s
111
142
  });
112
143
  });
113
144
  }), t;
114
145
  }
115
146
  }
116
- M.extend(G);
117
- class V extends p {
147
+ w.extend(G);
148
+ class O extends M {
118
149
  getFormulaError() {
119
- var d, u;
120
- const t = [], r = this._workbook.getUnitId(), e = this._worksheet.getSheetId(), o = this._worksheet.getName(), n = this._workbook.getSheetBySheetId(e);
121
- if (!n) return t;
122
- const i = this._injector.get(k).getArrayFormulaCellData(), c = ((d = i == null ? void 0 : i[r]) == null ? void 0 : d[e]) || {}, _ = n.getCellMatrix(), { startRow: C, endRow: m, startColumn: h, endColumn: F } = this._range;
123
- for (let l = C; l <= m; l++)
124
- for (let a = h; a <= F; a++) {
125
- const g = _.getValue(l, a);
126
- if (!g) continue;
127
- const E = (u = c == null ? void 0 : c[l]) == null ? void 0 : u[a], x = I(g, !!E);
128
- x && t.push({
150
+ var d, h;
151
+ const t = [], n = this._workbook.getUnitId(), e = this._worksheet.getSheetId(), o = this._worksheet.getName(), i = this._workbook.getSheetBySheetId(e);
152
+ if (!i) return t;
153
+ const r = this._injector.get(j).getArrayFormulaCellData(), l = ((d = r == null ? void 0 : r[n]) == null ? void 0 : d[e]) || {}, C = i.getCellMatrix(), { startRow: c, endRow: u, startColumn: g, endColumn: f } = this._range;
154
+ for (let m = c; m <= u; m++)
155
+ for (let s = g; s <= f; s++) {
156
+ const F = C.getValue(m, s);
157
+ if (!F) continue;
158
+ const A = (h = l == null ? void 0 : l[m]) == null ? void 0 : h[s], p = R(F, !!A);
159
+ p && t.push({
129
160
  sheetName: o,
130
- row: l,
131
- column: a,
132
- formula: g.f || "",
133
- errorType: x
161
+ row: m,
162
+ column: s,
163
+ formula: F.f || "",
164
+ errorType: p
134
165
  });
135
166
  }
136
167
  return t;
137
168
  }
138
169
  }
139
- p.extend(V);
170
+ M.extend(O);
@@ -0,0 +1,14 @@
1
+ const a = {
2
+ formula: {
3
+ progress: {
4
+ analyzing: "Analyzovanie",
5
+ calculating: "Výpočet",
6
+ "array-analysis": "Analýza poľa",
7
+ "array-calculation": "Výpočet poľa",
8
+ done: "Hotovo"
9
+ }
10
+ }
11
+ };
12
+ export {
13
+ a as default
14
+ };
@@ -1,5 +1,5 @@
1
1
  import { IDisposable, ILocales } from '@univerjs/core';
2
- import { IFunctionInfo } from '@univerjs/engine-formula';
2
+ import { IFunctionInfo, ISetFormulaCalculationResultMutation } from '@univerjs/engine-formula';
3
3
  import { CalculationMode, IRegisterAsyncFunction, IRegisterFunction } from '@univerjs/sheets-formula';
4
4
  import { FFormula } from '@univerjs/engine-formula/facade';
5
5
  /**
@@ -254,6 +254,59 @@ export interface IFFormulaSheetsMixin {
254
254
  locales?: ILocales;
255
255
  description?: string | IFunctionInfo;
256
256
  }): IDisposable;
257
+ /**
258
+ * Listens for the moment when formula-calculation results are applied.
259
+ *
260
+ * This event fires after the engine completes a calculation cycle and
261
+ * dispatches a `SetFormulaCalculationResultMutation`.
262
+ * The callback is invoked during an idle frame to avoid blocking UI updates.
263
+ *
264
+ * @param {Function} callback - A function called with the calculation result payload
265
+ * once the result-application mutation is emitted.
266
+ * @returns {IDisposable} A disposable used to unsubscribe from the event.
267
+ *
268
+ * @example
269
+ * ```ts
270
+ * const formulaEngine = univerAPI.getFormula();
271
+ *
272
+ * const dispose = formulaEngine.calculationResultApplied((result) => {
273
+ * console.log('Calculation results applied:', result);
274
+ * });
275
+ *
276
+ * // Later…
277
+ * dispose.dispose();
278
+ * ```
279
+ */
280
+ calculationResultApplied(callback: (result: ISetFormulaCalculationResultMutation) => void): IDisposable;
281
+ /**
282
+ * Waits for formula-calculation results to be applied.
283
+ *
284
+ * This method resolves under three conditions:
285
+ * 1. A real calculation runs and the engine emits a "calculation started" signal,
286
+ * followed by a "calculation result applied" signal.
287
+ * 2. No calculation actually starts within 500 ms — the method assumes there is
288
+ * nothing to wait for and resolves automatically.
289
+ * 3. A global 30 s timeout triggers, in which case the promise rejects.
290
+ *
291
+ * The API internally listens to both “calculation in progress” events and
292
+ * “calculation result applied” events, ensuring it behaves correctly whether
293
+ * formulas are recalculated or skipped due to cache/state.
294
+ *
295
+ * @returns {Promise<void>} A promise that resolves when calculation results are applied
296
+ * or when no calculation occurs within the start-detection window.
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * const formulaEngine = univerAPI.getFormula();
301
+ *
302
+ * // Wait for formula updates to apply before reading values.
303
+ * await formulaEngine.onCalculationResultApplied();
304
+ *
305
+ * const value = sheet.getRange("C24").getValue();
306
+ * console.log("Updated value:", value);
307
+ * ```
308
+ */
309
+ onCalculationResultApplied(): Promise<void>;
257
310
  }
258
311
  export declare class FFormulaSheetsMixin extends FFormula implements IFFormulaSheetsMixin {
259
312
  /**
@@ -270,6 +323,8 @@ export declare class FFormulaSheetsMixin extends FFormula implements IFFormulaSh
270
323
  registerFunction(name: string, func: IRegisterFunction, description: string): IDisposable;
271
324
  registerAsyncFunction(name: string, func: IRegisterAsyncFunction): IDisposable;
272
325
  registerAsyncFunction(name: string, func: IRegisterAsyncFunction, description: string): IDisposable;
326
+ calculationResultApplied(callback: (result: ISetFormulaCalculationResultMutation) => void): IDisposable;
327
+ onCalculationResultApplied(): Promise<void>;
273
328
  }
274
329
  declare module '@univerjs/engine-formula/facade' {
275
330
  interface FFormula extends IFFormulaSheetsMixin {
@@ -0,0 +1,3 @@
1
+ import { default as enUS } from './en-US';
2
+ declare const locale: typeof enUS;
3
+ export default locale;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(t,l){typeof exports=="object"&&typeof module<"u"?l(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula"),require("@univerjs/engine-formula/facade"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/engine-formula","@univerjs/sheets-formula","@univerjs/engine-formula/facade","@univerjs/sheets/facade"],l):(t=typeof globalThis<"u"?globalThis:t||self,l(t.UniverCore,t.UniverCoreFacade,t.UniverEngineFormula,t.UniverSheetsFormula,t.UniverEngineFormulaFacade,t.UniverSheetsFacade))})(this,(function(t,l,d,i,x,m){"use strict";class k extends l.FUniver{_initialize(){this._debouncedFormulaCalculation=t.debounce(()=>{this._commandService.executeCommand(d.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(n){let c=this._injector.get(i.IRegisterFunctionService);c||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),c=this._injector.get(i.IRegisterFunctionService));const e=c.registerFunctions(n);return this._debouncedFormulaCalculation(),e}}l.FUniver.extend(k);class R extends x.FFormula{_initialize(){this._debouncedFormulaCalculation=t.debounce(()=>{this._commandService.executeCommand(d.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(n){const e=this._injector.get(t.LifecycleService).stage,o=this._injector.get(t.ILogService),s=this._injector.get(t.IConfigService);e>t.LifecycleStages.Starting&&o.warn("[FFormula]","CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");const r=s.getConfig(i.PLUGIN_CONFIG_KEY_BASE);if(!r){s.setConfig(i.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:n});return}r.initialFormulaComputing=n}registerFunction(n,c,e){var a;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const s={name:n,func:c,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerFunction(s);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(n,c,e){var a;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const s={name:n,func:c,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerAsyncFunction(s);return this._debouncedFormulaCalculation(),r}}x.FFormula.extend(R);class b{get CalculationMode(){return i.CalculationMode}}l.FEnum.extend(b);class E extends m.FWorkbook{getAllFormulaError(){const n=[],c=this._workbook,e=c.getUnitId(),o=c.getSheets(),s=this._injector.get(d.FormulaDataModel).getArrayFormulaCellData();return o.forEach(r=>{var C;const a=r.getName(),j=r.getSheetId(),I=r.getCellMatrix(),F=((C=s==null?void 0:s[e])==null?void 0:C[j])||{};I.forValue((_,h,f)=>{var v;if(!f)return;const g=(v=F==null?void 0:F[_])==null?void 0:v[h],u=d.extractFormulaError(f,!!g);u&&n.push({sheetName:a,row:_,column:h,formula:f.f||"",errorType:u})})}),n}}m.FWorkbook.extend(E);class U extends m.FRange{getFormulaError(){var h,f;const n=[],c=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),o=this._worksheet.getName(),s=this._workbook.getSheetBySheetId(e);if(!s)return n;const r=this._injector.get(d.FormulaDataModel).getArrayFormulaCellData(),a=((h=r==null?void 0:r[c])==null?void 0:h[e])||{},j=s.getCellMatrix(),{startRow:I,endRow:F,startColumn:C,endColumn:_}=this._range;for(let g=I;g<=F;g++)for(let u=C;u<=_;u++){const v=j.getValue(g,u);if(!v)continue;const M=(f=a==null?void 0:a[g])==null?void 0:f[u],y=d.extractFormulaError(v,!!M);y&&n.push({sheetName:o,row:g,column:u,formula:v.f||"",errorType:y})}return n}}m.FRange.extend(U)}));
1
+ (function(c,f){typeof exports=="object"&&typeof module<"u"?f(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula"),require("@univerjs/engine-formula/facade"),require("@univerjs/sheets"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/engine-formula","@univerjs/sheets-formula","@univerjs/engine-formula/facade","@univerjs/sheets","@univerjs/sheets/facade"],f):(c=typeof globalThis<"u"?globalThis:c||self,f(c.UniverCore,c.UniverCoreFacade,c.UniverEngineFormula,c.UniverSheetsFormula,c.UniverEngineFormulaFacade,c.UniverSheets,c.UniverSheetsFacade))})(this,(function(c,f,u,s,I,y,j){"use strict";class p extends f.FUniver{_initialize(){this._debouncedFormulaCalculation=c.debounce(()=>{this._commandService.executeCommand(u.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(t){let o=this._injector.get(s.IRegisterFunctionService);o||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),o=this._injector.get(s.IRegisterFunctionService));const e=o.registerFunctions(t);return this._debouncedFormulaCalculation(),e}}f.FUniver.extend(p);class k extends I.FFormula{_initialize(){this._debouncedFormulaCalculation=c.debounce(()=>{this._commandService.executeCommand(u.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){const e=this._injector.get(c.LifecycleService).stage,n=this._injector.get(c.ILogService),i=this._injector.get(c.IConfigService);e>c.LifecycleStages.Starting&&n.warn("[FFormula]","CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");const r=i.getConfig(s.PLUGIN_CONFIG_KEY_BASE);if(!r){i.setConfig(s.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}r.initialFormulaComputing=t}registerFunction(t,o,e){var a;let n=this._injector.get(s.IRegisterFunctionService);n||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),n=this._injector.get(s.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerFunction(i);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(t,o,e){var a;let n=this._injector.get(s.IRegisterFunctionService);n||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),n=this._injector.get(s.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerAsyncFunction(i);return this._debouncedFormulaCalculation(),r}calculationResultApplied(t){let o=!1,e=!1,n=null;return this._commandService.onCommandExecuted((i,r)=>{i.id!==u.SetFormulaCalculationResultMutation.id&&i.id!==y.SetRangeValuesMutation.id||(i.id===u.SetFormulaCalculationResultMutation.id&&(o=!0,n=i.params),i.id===y.SetRangeValuesMutation.id&&(r!=null&&r.applyFormulaCalculationResult)&&(e=!0),!(!o||!e)&&requestIdleCallback(()=>{t(n)}))})}onCalculationResultApplied(){return new Promise((t,o)=>{let e=!1,n=!1;const i=setTimeout(()=>{l(),o(new Error("Calculation end timeout"))},6e4),r=setTimeout(()=>{e||(l(),t())},500),a=this.calculationProcessing(g=>{const{stage:h,totalArrayFormulasToCalculate:S,totalFormulasToCalculate:m}=g;if(h===u.FormulaExecuteStageType.START_CALCULATION&&S+m===0){l(),t();return}e||(e=!0,clearTimeout(r))}),_=this.calculationResultApplied(()=>{n||(n=!0,l(),t())});function l(){clearTimeout(i),clearTimeout(r),a.dispose(),_.dispose()}})}}I.FFormula.extend(k);class b{get CalculationMode(){return s.CalculationMode}}f.FEnum.extend(b);class E extends j.FWorkbook{getAllFormulaError(){const t=[],o=this._workbook,e=o.getUnitId(),n=o.getSheets(),i=this._injector.get(u.FormulaDataModel).getArrayFormulaCellData();return n.forEach(r=>{var h;const a=r.getName(),_=r.getSheetId(),l=r.getCellMatrix(),g=((h=i==null?void 0:i[e])==null?void 0:h[_])||{};l.forValue((S,m,v)=>{var C;if(!v)return;const F=(C=g==null?void 0:g[S])==null?void 0:C[m],d=u.extractFormulaError(v,!!F);d&&t.push({sheetName:a,row:S,column:m,formula:v.f||"",errorType:d})})}),t}}j.FWorkbook.extend(E);class M extends j.FRange{getFormulaError(){var m,v;const t=[],o=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),n=this._worksheet.getName(),i=this._workbook.getSheetBySheetId(e);if(!i)return t;const r=this._injector.get(u.FormulaDataModel).getArrayFormulaCellData(),a=((m=r==null?void 0:r[o])==null?void 0:m[e])||{},_=i.getCellMatrix(),{startRow:l,endRow:g,startColumn:h,endColumn:S}=this._range;for(let F=l;F<=g;F++)for(let d=h;d<=S;d++){const C=_.getValue(F,d);if(!C)continue;const T=(v=a==null?void 0:a[F])==null?void 0:v[d],x=u.extractFormulaError(C,!!T);x&&t.push({sheetName:n,row:F,column:d,formula:C.f||"",errorType:x})}return t}}j.FRange.extend(M)}));
@@ -0,0 +1 @@
1
+ (function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFormulaSkSK=o())})(this,(function(){"use strict";return{formula:{progress:{analyzing:"Analyzovanie",calculating:"Výpočet","array-analysis":"Analýza poľa","array-calculation":"Výpočet poľa",done:"Hotovo"}}}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-formula",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "private": false,
5
5
  "author": "DreamNum <developer@univer.ai>",
6
6
  "license": "Apache-2.0",
@@ -62,19 +62,19 @@
62
62
  "rxjs": ">=7.0.0"
63
63
  },
64
64
  "dependencies": {
65
- "@univerjs/rpc": "0.15.3",
66
- "@univerjs/sheets": "0.15.3",
67
- "@univerjs/core": "0.15.3",
68
- "@univerjs/engine-formula": "0.15.3"
65
+ "@univerjs/engine-formula": "0.15.4",
66
+ "@univerjs/sheets": "0.15.4",
67
+ "@univerjs/core": "0.15.4",
68
+ "@univerjs/rpc": "0.15.4"
69
69
  },
70
70
  "devDependencies": {
71
71
  "rxjs": "^7.8.2",
72
72
  "typescript": "^5.9.3",
73
73
  "vite": "^7.3.1",
74
- "vitest": "^4.0.16",
75
- "@univerjs-infra/shared": "0.15.3",
76
- "@univerjs/engine-render": "0.15.3",
77
- "@univerjs/docs": "0.15.3"
74
+ "vitest": "^4.0.18",
75
+ "@univerjs-infra/shared": "0.15.4",
76
+ "@univerjs/docs": "0.15.4",
77
+ "@univerjs/engine-render": "0.15.4"
78
78
  },
79
79
  "scripts": {
80
80
  "test": "vitest run",