@univerjs/sheets-formula 0.17.0 → 0.18.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 (118) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -170
  16. package/lib/es/index.js +1 -16600
  17. package/lib/es/locale/ca-ES.js +1 -14
  18. package/lib/es/locale/en-US.js +1 -14
  19. package/lib/es/locale/es-ES.js +1 -14
  20. package/lib/es/locale/fa-IR.js +1 -14
  21. package/lib/es/locale/fr-FR.js +1 -14
  22. package/lib/es/locale/ja-JP.js +1 -14
  23. package/lib/es/locale/ko-KR.js +1 -14
  24. package/lib/es/locale/ru-RU.js +1 -14
  25. package/lib/es/locale/sk-SK.js +1 -14
  26. package/lib/es/locale/vi-VN.js +1 -14
  27. package/lib/es/locale/zh-CN.js +1 -14
  28. package/lib/es/locale/zh-TW.js +1 -14
  29. package/lib/facade.js +1 -170
  30. package/lib/index.js +1 -16600
  31. package/lib/locale/ca-ES.js +1 -14
  32. package/lib/locale/en-US.js +1 -14
  33. package/lib/locale/es-ES.js +1 -14
  34. package/lib/locale/fa-IR.js +1 -14
  35. package/lib/locale/fr-FR.js +1 -14
  36. package/lib/locale/ja-JP.js +1 -14
  37. package/lib/locale/ko-KR.js +1 -14
  38. package/lib/locale/ru-RU.js +1 -14
  39. package/lib/locale/sk-SK.js +1 -14
  40. package/lib/locale/vi-VN.js +1 -14
  41. package/lib/locale/zh-CN.js +1 -14
  42. package/lib/locale/zh-TW.js +1 -14
  43. package/lib/types/commands/commands/insert-function.command.d.ts +16 -1
  44. package/lib/types/commands/commands/quick-sum.command.d.ts +16 -1
  45. package/lib/types/config/config.d.ts +17 -2
  46. package/lib/types/controllers/active-dirty.controller.d.ts +15 -0
  47. package/lib/types/controllers/array-formula-cell-interceptor.controller.d.ts +15 -0
  48. package/lib/types/controllers/defined-name.controller.d.ts +15 -0
  49. package/lib/types/controllers/formula-auto-fill.controller.d.ts +16 -1
  50. package/lib/types/controllers/formula.controller.d.ts +15 -0
  51. package/lib/types/controllers/image-formula-cell-interceptor.controller.d.ts +15 -0
  52. package/lib/types/controllers/super-table.controller.d.ts +15 -0
  53. package/lib/types/controllers/trigger-calculation.controller.d.ts +16 -1
  54. package/lib/types/controllers/update-defined-name.controller.d.ts +15 -0
  55. package/lib/types/controllers/update-formula.controller.d.ts +15 -0
  56. package/lib/types/controllers/utils/offset-formula-data.d.ts +17 -2
  57. package/lib/types/controllers/utils/ref-range-formula.d.ts +17 -2
  58. package/lib/types/controllers/utils/ref-range-move.d.ts +17 -2
  59. package/lib/types/controllers/utils/ref-range-param.d.ts +17 -2
  60. package/lib/types/facade/f-enum.d.ts +15 -0
  61. package/lib/types/facade/f-formula.d.ts +18 -3
  62. package/lib/types/facade/f-range.d.ts +16 -1
  63. package/lib/types/facade/f-univer.d.ts +17 -2
  64. package/lib/types/facade/f-workbook.d.ts +16 -1
  65. package/lib/types/locale/ca-ES.d.ts +16 -1
  66. package/lib/types/locale/es-ES.d.ts +16 -1
  67. package/lib/types/locale/fa-IR.d.ts +16 -1
  68. package/lib/types/locale/fr-FR.d.ts +16 -1
  69. package/lib/types/locale/ja-JP.d.ts +16 -1
  70. package/lib/types/locale/ko-KR.d.ts +16 -1
  71. package/lib/types/locale/ru-RU.d.ts +16 -1
  72. package/lib/types/locale/sk-SK.d.ts +16 -1
  73. package/lib/types/locale/vi-VN.d.ts +16 -1
  74. package/lib/types/locale/zh-CN.d.ts +16 -1
  75. package/lib/types/locale/zh-TW.d.ts +16 -1
  76. package/lib/types/plugin.d.ts +16 -1
  77. package/lib/types/services/description.service.d.ts +20 -3
  78. package/lib/types/services/formula-ref-range.service.d.ts +19 -2
  79. package/lib/types/services/function-list/array.d.ts +16 -1
  80. package/lib/types/services/function-list/compatibility.d.ts +16 -1
  81. package/lib/types/services/function-list/cube.d.ts +16 -1
  82. package/lib/types/services/function-list/database.d.ts +16 -1
  83. package/lib/types/services/function-list/date.d.ts +16 -1
  84. package/lib/types/services/function-list/engineering.d.ts +16 -1
  85. package/lib/types/services/function-list/financial.d.ts +16 -1
  86. package/lib/types/services/function-list/function-list.d.ts +16 -1
  87. package/lib/types/services/function-list/information.d.ts +16 -1
  88. package/lib/types/services/function-list/logical.d.ts +16 -1
  89. package/lib/types/services/function-list/lookup.d.ts +16 -1
  90. package/lib/types/services/function-list/math.d.ts +16 -1
  91. package/lib/types/services/function-list/statistical.d.ts +16 -1
  92. package/lib/types/services/function-list/text.d.ts +16 -1
  93. package/lib/types/services/function-list/univer.d.ts +16 -1
  94. package/lib/types/services/function-list/web.d.ts +16 -1
  95. package/lib/types/services/register-function.service.d.ts +20 -3
  96. package/lib/types/services/remote/remote-register-function.service.d.ts +16 -1
  97. package/lib/types/services/utils.d.ts +17 -2
  98. package/lib/types/util/calculate.d.ts +17 -2
  99. package/lib/umd/facade.js +1 -1
  100. package/lib/umd/index.js +1 -1
  101. package/lib/umd/locale/ca-ES.js +1 -1
  102. package/lib/umd/locale/en-US.js +1 -1
  103. package/lib/umd/locale/es-ES.js +1 -1
  104. package/lib/umd/locale/fa-IR.js +1 -1
  105. package/lib/umd/locale/fr-FR.js +1 -1
  106. package/lib/umd/locale/ja-JP.js +1 -1
  107. package/lib/umd/locale/ko-KR.js +1 -1
  108. package/lib/umd/locale/ru-RU.js +1 -1
  109. package/lib/umd/locale/sk-SK.js +1 -1
  110. package/lib/umd/locale/vi-VN.js +1 -1
  111. package/lib/umd/locale/zh-CN.js +1 -1
  112. package/lib/umd/locale/zh-TW.js +1 -1
  113. package/package.json +12 -11
  114. package/lib/types/services/__test__/description.service.spec.d.ts +0 -16
  115. package/lib/types/services/__test__/formula-ref.spec.d.ts +0 -16
  116. package/lib/types/services/__test__/register-function.service.spec.d.ts +0 -16
  117. package/lib/types/services/__test__/util.d.ts +0 -7
  118. package/lib/types/services/__test__/utils.spec.d.ts +0 -16
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "Analitzant",
5
- calculating: "Calculant",
6
- "array-analysis": "Anàlisi de matriu",
7
- "array-calculation": "Càlcul de matriu",
8
- done: "Fet"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`Analitzant`,calculating:`Calculant`,"array-analysis":`Anàlisi de matriu`,"array-calculation":`Càlcul de matriu`,done:`Fet`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "Analyzing",
5
- calculating: "Calculating",
6
- "array-analysis": "Array Analysis",
7
- "array-calculation": "Array Calculation",
8
- done: "Done"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`Analyzing`,calculating:`Calculating`,"array-analysis":`Array Analysis`,"array-calculation":`Array Calculation`,done:`Done`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "Analizando",
5
- calculating: "Calculando",
6
- "array-analysis": "Análisis de matriz",
7
- "array-calculation": "Cálculo de matriz",
8
- done: "Hecho"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`Analizando`,calculating:`Calculando`,"array-analysis":`Análisis de matriz`,"array-calculation":`Cálculo de matriz`,done:`Hecho`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "در حال تحلیل",
5
- calculating: "در حال محاسبه",
6
- "array-analysis": "تحلیل آرایه",
7
- "array-calculation": "محاسبه آرایه",
8
- done: "تمام"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`در حال تحلیل`,calculating:`در حال محاسبه`,"array-analysis":`تحلیل آرایه`,"array-calculation":`محاسبه آرایه`,done:`تمام`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "Analyse en cours",
5
- calculating: "Calcul en cours",
6
- "array-analysis": "Analyse de tableau",
7
- "array-calculation": "Calcul de tableau",
8
- done: "Terminé"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`Analyse en cours`,calculating:`Calcul en cours`,"array-analysis":`Analyse de tableau`,"array-calculation":`Calcul de tableau`,done:`Terminé`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "解析中",
5
- calculating: "計算中",
6
- "array-analysis": "配列の解析",
7
- "array-calculation": "配列の計算",
8
- done: "完了"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`解析中`,calculating:`計算中`,"array-analysis":`配列の解析`,"array-calculation":`配列の計算`,done:`完了`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "분석 중",
5
- calculating: "계산 중",
6
- "array-analysis": "배열 분석",
7
- "array-calculation": "배열 계산",
8
- done: "완료"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`분석 중`,calculating:`계산 중`,"array-analysis":`배열 분석`,"array-calculation":`배열 계산`,done:`완료`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "Анализ",
5
- calculating: "Вычисление",
6
- "array-analysis": "Анализ массива",
7
- "array-calculation": "Вычисление массива",
8
- done: "Готово"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`Анализ`,calculating:`Вычисление`,"array-analysis":`Анализ массива`,"array-calculation":`Вычисление массива`,done:`Готово`}}};export{e as default};
@@ -1,14 +1 @@
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
+ const e={formula:{progress:{analyzing:`Analyzovanie`,calculating:`Výpočet`,"array-analysis":`Analýza poľa`,"array-calculation":`Výpočet poľa`,done:`Hotovo`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "Đang phân tích",
5
- calculating: "Đang tính toán",
6
- "array-analysis": "Phân tích mảng",
7
- "array-calculation": "Tính toán mảng",
8
- done: "Hoàn tất"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`Đang phân tích`,calculating:`Đang tính toán`,"array-analysis":`Phân tích mảng`,"array-calculation":`Tính toán mảng`,done:`Hoàn tất`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "分析中",
5
- calculating: "计算中",
6
- "array-analysis": "数组分析",
7
- "array-calculation": "数组计算",
8
- done: "完成"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`分析中`,calculating:`计算中`,"array-analysis":`数组分析`,"array-calculation":`数组计算`,done:`完成`}}};export{e as default};
@@ -1,14 +1 @@
1
- const a = {
2
- formula: {
3
- progress: {
4
- analyzing: "分析中",
5
- calculating: "計算中",
6
- "array-analysis": "陣列分析",
7
- "array-calculation": "陣列計算",
8
- done: "完成"
9
- }
10
- }
11
- };
12
- export {
13
- a as default
14
- };
1
+ const e={formula:{progress:{analyzing:`分析中`,calculating:`計算中`,"array-analysis":`陣列分析`,"array-calculation":`陣列計算`,done:`完成`}}};export{e as default};
package/lib/facade.js CHANGED
@@ -1,170 +1 @@
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 {
9
- /**
10
- * Initialize the FUniver instance.
11
- * @ignore
12
- */
13
- _initialize() {
14
- this._debouncedFormulaCalculation = v(() => {
15
- this._commandService.executeCommand(
16
- k.id,
17
- {
18
- commands: [],
19
- forceCalculation: !0
20
- },
21
- {
22
- onlyLocal: !0
23
- }
24
- );
25
- }, 10);
26
- }
27
- registerFunction(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);
31
- return this._debouncedFormulaCalculation(), e;
32
- }
33
- }
34
- I.extend(V);
35
- class W extends T {
36
- /**
37
- * Initialize the FUniver instance.
38
- * @ignore
39
- */
40
- _initialize() {
41
- this._debouncedFormulaCalculation = v(() => {
42
- this._commandService.executeCommand(
43
- k.id,
44
- {
45
- commands: [],
46
- forceCalculation: !0
47
- },
48
- {
49
- onlyLocal: !0
50
- }
51
- );
52
- }, 10);
53
- }
54
- setInitialFormulaComputing(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 });
60
- return;
61
- }
62
- r.initialFormulaComputing = t;
63
- }
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 = {
69
- name: t,
70
- func: n,
71
- description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
72
- locales: typeof e == "object" ? e.locales : void 0
73
- }, r = o.registerFunction(i);
74
- return this._debouncedFormulaCalculation(), r;
75
- }
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 = {
81
- name: t,
82
- func: n,
83
- description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
84
- locales: typeof e == "object" ? e.locales : void 0
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
- });
117
- }
118
- }
119
- T.extend(W);
120
- class B {
121
- get CalculationMode() {
122
- return P;
123
- }
124
- }
125
- N.extend(B);
126
- class G extends w {
127
- getAllFormulaError() {
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,
139
- column: d,
140
- formula: h.f || "",
141
- errorType: s
142
- });
143
- });
144
- }), t;
145
- }
146
- }
147
- w.extend(G);
148
- class O extends M {
149
- getFormulaError() {
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({
160
- sheetName: o,
161
- row: m,
162
- column: s,
163
- formula: F.f || "",
164
- errorType: p
165
- });
166
- }
167
- return t;
168
- }
169
- }
170
- M.extend(O);
1
+ import{IConfigService as e,ILogService as t,LifecycleService as n,LifecycleStages as r,debounce as i}from"@univerjs/core";import{FEnum as a,FUniver as o}from"@univerjs/core/facade";import{FormulaDataModel as s,FormulaExecuteStageType as c,SetFormulaCalculationResultMutation as l,SetTriggerFormulaCalculationStartMutation as u,extractFormulaError as d}from"@univerjs/engine-formula";import{CalculationMode as f,IRegisterFunctionService as p,PLUGIN_CONFIG_KEY_BASE as m,RegisterFunctionService as h}from"@univerjs/sheets-formula";import{FFormula as g}from"@univerjs/engine-formula/facade";import{SetRangeValuesMutation as _}from"@univerjs/sheets";import{FRange as v,FWorkbook as y}from"@univerjs/sheets/facade";var b=class extends o{_initialize(){this._debouncedFormulaCalculation=i(()=>{this._commandService.executeCommand(u.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(e){let t=this._injector.get(p);t||(this._injector.add([p,{useClass:h}]),t=this._injector.get(p));let n=t.registerFunctions(e);return this._debouncedFormulaCalculation(),n}};o.extend(b);var x=class extends g{_initialize(){this._debouncedFormulaCalculation=i(()=>{this._commandService.executeCommand(u.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(i){let a=this._injector.get(n).stage,o=this._injector.get(t),s=this._injector.get(e);a>r.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.`);let c=s.getConfig(m);if(!c){s.setConfig(m,{initialFormulaComputing:i});return}c.initialFormulaComputing=i}registerFunction(e,t,n){var r;let i=this._injector.get(p);i||(this._injector.add([p,{useClass:h}]),i=this._injector.get(p));let a={name:e,func:t,description:typeof n==`string`?n:(r=n==null?void 0:n.description)==null?``:r,locales:typeof n==`object`?n.locales:void 0},o=i.registerFunction(a);return this._debouncedFormulaCalculation(),o}registerAsyncFunction(e,t,n){var r;let i=this._injector.get(p);i||(this._injector.add([p,{useClass:h}]),i=this._injector.get(p));let a={name:e,func:t,description:typeof n==`string`?n:(r=n==null?void 0:n.description)==null?``:r,locales:typeof n==`object`?n.locales:void 0},o=i.registerAsyncFunction(a);return this._debouncedFormulaCalculation(),o}calculationResultApplied(e){let t=!1,n=!1,r=null;return this._commandService.onCommandExecuted((i,a)=>{i.id!==l.id&&i.id!==_.id||(i.id===l.id&&(t=!0,r=i.params),i.id===_.id&&a!=null&&a.applyFormulaCalculationResult&&(n=!0),!(!t||!n)&&requestIdleCallback(()=>{e(r)}))})}onCalculationResultApplied(){return new Promise((e,t)=>{let n=!1,r=!1,i=setTimeout(()=>{l(),t(Error(`Calculation end timeout`))},6e4),a=setTimeout(()=>{n||(l(),e())},500),o=this.calculationProcessing(t=>{let{stage:r,totalArrayFormulasToCalculate:i,totalFormulasToCalculate:o}=t;if(r===c.START_CALCULATION&&i+o===0){l(),e();return}n||(n=!0,clearTimeout(a))}),s=this.calculationResultApplied(()=>{r||(r=!0,l(),e())});function l(){clearTimeout(i),clearTimeout(a),o.dispose(),s.dispose()}})}};g.extend(x);var S=class{get CalculationMode(){return f}};a.extend(S);var C=class extends y{getAllFormulaError(){let e=[],t=this._workbook,n=t.getUnitId(),r=t.getSheets(),i=this._injector.get(s).getArrayFormulaCellData();return r.forEach(t=>{var r;let a=t.getName(),o=t.getSheetId(),s=t.getCellMatrix(),c=(i==null||(r=i[n])==null?void 0:r[o])||{};s.forValue((t,n,r)=>{var i;if(!r)return;let o=d(r,!!(!(c==null||(i=c[t])==null)&&i[n]));o&&e.push({sheetName:a,row:t,column:n,formula:r.f||``,errorType:o})})}),e}};y.extend(C);var w=class extends v{getFormulaError(){var e;let t=[],n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=this._worksheet.getName(),a=this._workbook.getSheetBySheetId(r);if(!a)return t;let o=this._injector.get(s).getArrayFormulaCellData(),c=(o==null||(e=o[n])==null?void 0:e[r])||{},l=a.getCellMatrix(),{startRow:u,endRow:f,startColumn:p,endColumn:m}=this._range;for(let e=u;e<=f;e++)for(let n=p;n<=m;n++){var h;let r=l.getValue(e,n);if(!r)continue;let a=d(r,!!(!(c==null||(h=c[e])==null)&&h[n]));a&&t.push({sheetName:i,row:e,column:n,formula:r.f||``,errorType:a})}return t}};v.extend(w);export{};