@univerjs/sheets-formula 0.20.1 → 0.21.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 (44) hide show
  1. package/lib/cjs/facade.js +252 -1
  2. package/lib/cjs/index.js +16436 -1
  3. package/lib/cjs/locale/ca-ES.js +12 -1
  4. package/lib/cjs/locale/en-US.js +27 -1
  5. package/lib/cjs/locale/es-ES.js +12 -1
  6. package/lib/cjs/locale/fa-IR.js +12 -1
  7. package/lib/cjs/locale/fr-FR.js +12 -1
  8. package/lib/cjs/locale/ja-JP.js +12 -1
  9. package/lib/cjs/locale/ko-KR.js +12 -1
  10. package/lib/cjs/locale/ru-RU.js +12 -1
  11. package/lib/cjs/locale/sk-SK.js +12 -1
  12. package/lib/cjs/locale/vi-VN.js +12 -1
  13. package/lib/cjs/locale/zh-CN.js +12 -1
  14. package/lib/cjs/locale/zh-TW.js +12 -1
  15. package/lib/es/facade.js +253 -1
  16. package/lib/es/index.js +16362 -1
  17. package/lib/es/locale/ca-ES.js +11 -1
  18. package/lib/es/locale/en-US.js +26 -1
  19. package/lib/es/locale/es-ES.js +11 -1
  20. package/lib/es/locale/fa-IR.js +11 -1
  21. package/lib/es/locale/fr-FR.js +11 -1
  22. package/lib/es/locale/ja-JP.js +11 -1
  23. package/lib/es/locale/ko-KR.js +11 -1
  24. package/lib/es/locale/ru-RU.js +11 -1
  25. package/lib/es/locale/sk-SK.js +11 -1
  26. package/lib/es/locale/vi-VN.js +11 -1
  27. package/lib/es/locale/zh-CN.js +11 -1
  28. package/lib/es/locale/zh-TW.js +11 -1
  29. package/lib/facade.js +253 -1
  30. package/lib/index.js +16362 -1
  31. package/lib/locale/ca-ES.js +11 -1
  32. package/lib/locale/en-US.js +26 -1
  33. package/lib/locale/es-ES.js +11 -1
  34. package/lib/locale/fa-IR.js +11 -1
  35. package/lib/locale/fr-FR.js +11 -1
  36. package/lib/locale/ja-JP.js +11 -1
  37. package/lib/locale/ko-KR.js +11 -1
  38. package/lib/locale/ru-RU.js +11 -1
  39. package/lib/locale/sk-SK.js +11 -1
  40. package/lib/locale/vi-VN.js +11 -1
  41. package/lib/locale/zh-CN.js +11 -1
  42. package/lib/locale/zh-TW.js +11 -1
  43. package/lib/umd/index.js +1 -1
  44. package/package.json +9 -9
@@ -1 +1,11 @@
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
+ //#region src/locale/ca-ES.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "Analitzant",
4
+ calculating: "Calculant",
5
+ "array-analysis": "Anàlisi de matriu",
6
+ "array-calculation": "Càlcul de matriu",
7
+ done: "Fet"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,26 @@
1
- const e={formula:{progress:{analyzing:`Analyzing`,calculating:`Calculating`,"array-analysis":`Array Analysis`,"array-calculation":`Array Calculation`,done:`Done`}}};export{e as default};
1
+ //#region src/locale/en-US.ts
2
+ /**
3
+ * Copyright 2023-present DreamNum Co., Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ const locale = { formula: { progress: {
18
+ analyzing: "Analyzing",
19
+ calculating: "Calculating",
20
+ "array-analysis": "Array Analysis",
21
+ "array-calculation": "Array Calculation",
22
+ done: "Done"
23
+ } } };
24
+
25
+ //#endregion
26
+ export { locale as default };
@@ -1 +1,11 @@
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
+ //#region src/locale/es-ES.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "Analizando",
4
+ calculating: "Calculando",
5
+ "array-analysis": "Análisis de matriz",
6
+ "array-calculation": "Cálculo de matriz",
7
+ done: "Hecho"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
1
- const e={formula:{progress:{analyzing:`در حال تحلیل`,calculating:`در حال محاسبه`,"array-analysis":`تحلیل آرایه`,"array-calculation":`محاسبه آرایه`,done:`تمام`}}};export{e as default};
1
+ //#region src/locale/fa-IR.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "در حال تحلیل",
4
+ calculating: "در حال محاسبه",
5
+ "array-analysis": "تحلیل آرایه",
6
+ "array-calculation": "محاسبه آرایه",
7
+ done: "تمام"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
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
+ //#region src/locale/fr-FR.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "Analyse en cours",
4
+ calculating: "Calcul en cours",
5
+ "array-analysis": "Analyse de tableau",
6
+ "array-calculation": "Calcul de tableau",
7
+ done: "Terminé"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
1
- const e={formula:{progress:{analyzing:`解析中`,calculating:`計算中`,"array-analysis":`配列の解析`,"array-calculation":`配列の計算`,done:`完了`}}};export{e as default};
1
+ //#region src/locale/ja-JP.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "解析中",
4
+ calculating: "計算中",
5
+ "array-analysis": "配列の解析",
6
+ "array-calculation": "配列の計算",
7
+ done: "完了"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
1
- const e={formula:{progress:{analyzing:`분석 중`,calculating:`계산 중`,"array-analysis":`배열 분석`,"array-calculation":`배열 계산`,done:`완료`}}};export{e as default};
1
+ //#region src/locale/ko-KR.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "분석 중",
4
+ calculating: "계산 중",
5
+ "array-analysis": "배열 분석",
6
+ "array-calculation": "배열 계산",
7
+ done: "완료"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
1
- const e={formula:{progress:{analyzing:`Анализ`,calculating:`Вычисление`,"array-analysis":`Анализ массива`,"array-calculation":`Вычисление массива`,done:`Готово`}}};export{e as default};
1
+ //#region src/locale/ru-RU.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "Анализ",
4
+ calculating: "Вычисление",
5
+ "array-analysis": "Анализ массива",
6
+ "array-calculation": "Вычисление массива",
7
+ done: "Готово"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
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
+ //#region src/locale/sk-SK.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "Analyzovanie",
4
+ calculating: "Výpočet",
5
+ "array-analysis": "Analýza poľa",
6
+ "array-calculation": "Výpočet poľa",
7
+ done: "Hotovo"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
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
+ //#region src/locale/vi-VN.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "Đang phân tích",
4
+ calculating: "Đang tính toán",
5
+ "array-analysis": "Phân tích mảng",
6
+ "array-calculation": "Tính toán mảng",
7
+ done: "Hoàn tất"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
1
- const e={formula:{progress:{analyzing:`分析中`,calculating:`计算中`,"array-analysis":`数组分析`,"array-calculation":`数组计算`,done:`完成`}}};export{e as default};
1
+ //#region src/locale/zh-CN.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "分析中",
4
+ calculating: "计算中",
5
+ "array-analysis": "数组分析",
6
+ "array-calculation": "数组计算",
7
+ done: "完成"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
@@ -1 +1,11 @@
1
- const e={formula:{progress:{analyzing:`分析中`,calculating:`計算中`,"array-analysis":`陣列分析`,"array-calculation":`陣列計算`,done:`完成`}}};export{e as default};
1
+ //#region src/locale/zh-TW.ts
2
+ const locale = { formula: { progress: {
3
+ analyzing: "分析中",
4
+ calculating: "計算中",
5
+ "array-analysis": "陣列分析",
6
+ "array-calculation": "陣列計算",
7
+ done: "完成"
8
+ } } };
9
+
10
+ //#endregion
11
+ export { locale as default };
package/lib/facade.js CHANGED
@@ -1 +1,253 @@
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 extends a{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{};
1
+ import { IConfigService, ILogService, LifecycleService, LifecycleStages, debounce } from "@univerjs/core";
2
+ import { FEnum, FUniver } from "@univerjs/core/facade";
3
+ import { FormulaDataModel, FormulaExecuteStageType, SetFormulaCalculationResultMutation, SetTriggerFormulaCalculationStartMutation, extractFormulaError } from "@univerjs/engine-formula";
4
+ import { CalculationMode, IRegisterFunctionService, PLUGIN_CONFIG_KEY_BASE, RegisterFunctionService } from "@univerjs/sheets-formula";
5
+ import { FFormula } from "@univerjs/engine-formula/facade";
6
+ import { SetRangeValuesMutation } from "@univerjs/sheets";
7
+ import { FRange, FWorkbook } from "@univerjs/sheets/facade";
8
+
9
+ //#region src/facade/f-univer.ts
10
+ /**
11
+ * @ignore
12
+ */
13
+ var FUniverSheetsFormulaMixin = class extends FUniver {
14
+ /**
15
+ * Initialize the FUniver instance.
16
+ * @ignore
17
+ */
18
+ _initialize() {
19
+ this._debouncedFormulaCalculation = debounce(() => {
20
+ this._commandService.executeCommand(SetTriggerFormulaCalculationStartMutation.id, {
21
+ commands: [],
22
+ forceCalculation: true
23
+ }, { onlyLocal: true });
24
+ }, 10);
25
+ }
26
+ registerFunction(config) {
27
+ let registerFunctionService = this._injector.get(IRegisterFunctionService);
28
+ if (!registerFunctionService) {
29
+ this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]);
30
+ registerFunctionService = this._injector.get(IRegisterFunctionService);
31
+ }
32
+ const functionsDisposable = registerFunctionService.registerFunctions(config);
33
+ this._debouncedFormulaCalculation();
34
+ return functionsDisposable;
35
+ }
36
+ };
37
+ FUniver.extend(FUniverSheetsFormulaMixin);
38
+
39
+ //#endregion
40
+ //#region src/facade/f-formula.ts
41
+ var FFormulaSheetsMixin = class extends FFormula {
42
+ /**
43
+ * Initialize the FUniver instance.
44
+ * @ignore
45
+ */
46
+ _initialize() {
47
+ this._debouncedFormulaCalculation = debounce(() => {
48
+ this._commandService.executeCommand(SetTriggerFormulaCalculationStartMutation.id, {
49
+ commands: [],
50
+ forceCalculation: true
51
+ }, { onlyLocal: true });
52
+ }, 10);
53
+ }
54
+ setInitialFormulaComputing(calculationMode) {
55
+ const lifecycleStage = this._injector.get(LifecycleService).stage;
56
+ const logService = this._injector.get(ILogService);
57
+ const configService = this._injector.get(IConfigService);
58
+ if (lifecycleStage > LifecycleStages.Starting) logService.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.");
59
+ const config = configService.getConfig(PLUGIN_CONFIG_KEY_BASE);
60
+ if (!config) {
61
+ configService.setConfig(PLUGIN_CONFIG_KEY_BASE, { initialFormulaComputing: calculationMode });
62
+ return;
63
+ }
64
+ config.initialFormulaComputing = calculationMode;
65
+ }
66
+ registerFunction(name, func, options) {
67
+ var _options$description;
68
+ let registerFunctionService = this._injector.get(IRegisterFunctionService);
69
+ if (!registerFunctionService) {
70
+ this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]);
71
+ registerFunctionService = this._injector.get(IRegisterFunctionService);
72
+ }
73
+ const params = {
74
+ name,
75
+ func,
76
+ description: typeof options === "string" ? options : (_options$description = options === null || options === void 0 ? void 0 : options.description) !== null && _options$description !== void 0 ? _options$description : "",
77
+ locales: typeof options === "object" ? options.locales : void 0
78
+ };
79
+ const functionsDisposable = registerFunctionService.registerFunction(params);
80
+ this._debouncedFormulaCalculation();
81
+ return functionsDisposable;
82
+ }
83
+ registerAsyncFunction(name, func, options) {
84
+ var _options$description2;
85
+ let registerFunctionService = this._injector.get(IRegisterFunctionService);
86
+ if (!registerFunctionService) {
87
+ this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]);
88
+ registerFunctionService = this._injector.get(IRegisterFunctionService);
89
+ }
90
+ const params = {
91
+ name,
92
+ func,
93
+ description: typeof options === "string" ? options : (_options$description2 = options === null || options === void 0 ? void 0 : options.description) !== null && _options$description2 !== void 0 ? _options$description2 : "",
94
+ locales: typeof options === "object" ? options.locales : void 0
95
+ };
96
+ const functionsDisposable = registerFunctionService.registerAsyncFunction(params);
97
+ this._debouncedFormulaCalculation();
98
+ return functionsDisposable;
99
+ }
100
+ calculationResultApplied(callback) {
101
+ let setFormulaCalculationResult = false;
102
+ let applyFormulaCalculationResult = false;
103
+ let result = null;
104
+ return this._commandService.onCommandExecuted((command, options) => {
105
+ if (command.id !== SetFormulaCalculationResultMutation.id && command.id !== SetRangeValuesMutation.id) return;
106
+ if (command.id === SetFormulaCalculationResultMutation.id) {
107
+ setFormulaCalculationResult = true;
108
+ result = command.params;
109
+ }
110
+ if (command.id === SetRangeValuesMutation.id && (options === null || options === void 0 ? void 0 : options.applyFormulaCalculationResult)) applyFormulaCalculationResult = true;
111
+ if (!setFormulaCalculationResult || !applyFormulaCalculationResult) return;
112
+ requestIdleCallback(() => {
113
+ callback(result);
114
+ });
115
+ });
116
+ }
117
+ onCalculationResultApplied() {
118
+ return new Promise((resolve, reject) => {
119
+ let started = false;
120
+ let finished = false;
121
+ const mainTimer = setTimeout(() => {
122
+ cleanup();
123
+ reject(/* @__PURE__ */ new Error("Calculation end timeout"));
124
+ }, 6e4);
125
+ const startWatchdog = setTimeout(() => {
126
+ if (!started) {
127
+ cleanup();
128
+ resolve();
129
+ }
130
+ }, 500);
131
+ const processingDisposable = this.calculationProcessing((stageInfo) => {
132
+ const { stage, totalArrayFormulasToCalculate, totalFormulasToCalculate } = stageInfo;
133
+ if (stage === FormulaExecuteStageType.START_CALCULATION && totalArrayFormulasToCalculate + totalFormulasToCalculate === 0) {
134
+ cleanup();
135
+ resolve();
136
+ return;
137
+ }
138
+ if (started) return;
139
+ started = true;
140
+ clearTimeout(startWatchdog);
141
+ });
142
+ const endDisposable = this.calculationResultApplied(() => {
143
+ if (finished) return;
144
+ finished = true;
145
+ cleanup();
146
+ resolve();
147
+ });
148
+ function cleanup() {
149
+ clearTimeout(mainTimer);
150
+ clearTimeout(startWatchdog);
151
+ processingDisposable.dispose();
152
+ endDisposable.dispose();
153
+ }
154
+ });
155
+ }
156
+ };
157
+ FFormula.extend(FFormulaSheetsMixin);
158
+
159
+ //#endregion
160
+ //#region src/facade/f-enum.ts
161
+ /**
162
+ * Copyright 2023-present DreamNum Co., Ltd.
163
+ *
164
+ * Licensed under the Apache License, Version 2.0 (the "License");
165
+ * you may not use this file except in compliance with the License.
166
+ * You may obtain a copy of the License at
167
+ *
168
+ * http://www.apache.org/licenses/LICENSE-2.0
169
+ *
170
+ * Unless required by applicable law or agreed to in writing, software
171
+ * distributed under the License is distributed on an "AS IS" BASIS,
172
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
173
+ * See the License for the specific language governing permissions and
174
+ * limitations under the License.
175
+ */
176
+ var FSheetsFormulaEnumMixin = class extends FEnum {
177
+ get CalculationMode() {
178
+ return CalculationMode;
179
+ }
180
+ };
181
+ FEnum.extend(FSheetsFormulaEnumMixin);
182
+
183
+ //#endregion
184
+ //#region src/facade/f-workbook.ts
185
+ var FWorkbookEngineFormulaMixin = class extends FWorkbook {
186
+ getAllFormulaError() {
187
+ const errors = [];
188
+ const workbook = this._workbook;
189
+ const unitId = workbook.getUnitId();
190
+ const worksheets = workbook.getSheets();
191
+ const arrayFormula = this._injector.get(FormulaDataModel).getArrayFormulaCellData();
192
+ worksheets.forEach((worksheet) => {
193
+ var _arrayFormula$unitId;
194
+ const sheetName = worksheet.getName();
195
+ const sheetId = worksheet.getSheetId();
196
+ const cellMatrix = worksheet.getCellMatrix();
197
+ const arrayFormulaSheet = (arrayFormula === null || arrayFormula === void 0 || (_arrayFormula$unitId = arrayFormula[unitId]) === null || _arrayFormula$unitId === void 0 ? void 0 : _arrayFormula$unitId[sheetId]) || {};
198
+ cellMatrix.forValue((row, column, cell) => {
199
+ var _arrayFormulaSheet$ro;
200
+ if (!cell) return;
201
+ const errorType = extractFormulaError(cell, !!(arrayFormulaSheet === null || arrayFormulaSheet === void 0 || (_arrayFormulaSheet$ro = arrayFormulaSheet[row]) === null || _arrayFormulaSheet$ro === void 0 ? void 0 : _arrayFormulaSheet$ro[column]));
202
+ if (errorType) errors.push({
203
+ sheetName,
204
+ row,
205
+ column,
206
+ formula: cell.f || "",
207
+ errorType
208
+ });
209
+ });
210
+ });
211
+ return errors;
212
+ }
213
+ };
214
+ FWorkbook.extend(FWorkbookEngineFormulaMixin);
215
+
216
+ //#endregion
217
+ //#region src/facade/f-range.ts
218
+ /**
219
+ * @ignore
220
+ */
221
+ var FRangeEngineFormulaMixin = class extends FRange {
222
+ getFormulaError() {
223
+ var _arrayFormula$unitId;
224
+ const errors = [];
225
+ const unitId = this._workbook.getUnitId();
226
+ const sheetId = this._worksheet.getSheetId();
227
+ const sheetName = this._worksheet.getName();
228
+ const worksheet = this._workbook.getSheetBySheetId(sheetId);
229
+ if (!worksheet) return errors;
230
+ const arrayFormula = this._injector.get(FormulaDataModel).getArrayFormulaCellData();
231
+ const arrayFormulaSheet = (arrayFormula === null || arrayFormula === void 0 || (_arrayFormula$unitId = arrayFormula[unitId]) === null || _arrayFormula$unitId === void 0 ? void 0 : _arrayFormula$unitId[sheetId]) || {};
232
+ const cellMatrix = worksheet.getCellMatrix();
233
+ const { startRow, endRow, startColumn, endColumn } = this._range;
234
+ for (let row = startRow; row <= endRow; row++) for (let column = startColumn; column <= endColumn; column++) {
235
+ var _arrayFormulaSheet$ro;
236
+ const cell = cellMatrix.getValue(row, column);
237
+ if (!cell) continue;
238
+ const errorType = extractFormulaError(cell, !!(arrayFormulaSheet === null || arrayFormulaSheet === void 0 || (_arrayFormulaSheet$ro = arrayFormulaSheet[row]) === null || _arrayFormulaSheet$ro === void 0 ? void 0 : _arrayFormulaSheet$ro[column]));
239
+ if (errorType) errors.push({
240
+ sheetName,
241
+ row,
242
+ column,
243
+ formula: cell.f || "",
244
+ errorType
245
+ });
246
+ }
247
+ return errors;
248
+ }
249
+ };
250
+ FRange.extend(FRangeEngineFormulaMixin);
251
+
252
+ //#endregion
253
+ export { };