@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.
- package/lib/cjs/facade.js +252 -1
- package/lib/cjs/index.js +16436 -1
- package/lib/cjs/locale/ca-ES.js +12 -1
- package/lib/cjs/locale/en-US.js +27 -1
- package/lib/cjs/locale/es-ES.js +12 -1
- package/lib/cjs/locale/fa-IR.js +12 -1
- package/lib/cjs/locale/fr-FR.js +12 -1
- package/lib/cjs/locale/ja-JP.js +12 -1
- package/lib/cjs/locale/ko-KR.js +12 -1
- package/lib/cjs/locale/ru-RU.js +12 -1
- package/lib/cjs/locale/sk-SK.js +12 -1
- package/lib/cjs/locale/vi-VN.js +12 -1
- package/lib/cjs/locale/zh-CN.js +12 -1
- package/lib/cjs/locale/zh-TW.js +12 -1
- package/lib/es/facade.js +253 -1
- package/lib/es/index.js +16362 -1
- package/lib/es/locale/ca-ES.js +11 -1
- package/lib/es/locale/en-US.js +26 -1
- package/lib/es/locale/es-ES.js +11 -1
- package/lib/es/locale/fa-IR.js +11 -1
- package/lib/es/locale/fr-FR.js +11 -1
- package/lib/es/locale/ja-JP.js +11 -1
- package/lib/es/locale/ko-KR.js +11 -1
- package/lib/es/locale/ru-RU.js +11 -1
- package/lib/es/locale/sk-SK.js +11 -1
- package/lib/es/locale/vi-VN.js +11 -1
- package/lib/es/locale/zh-CN.js +11 -1
- package/lib/es/locale/zh-TW.js +11 -1
- package/lib/facade.js +253 -1
- package/lib/index.js +16362 -1
- package/lib/locale/ca-ES.js +11 -1
- package/lib/locale/en-US.js +26 -1
- package/lib/locale/es-ES.js +11 -1
- package/lib/locale/fa-IR.js +11 -1
- package/lib/locale/fr-FR.js +11 -1
- package/lib/locale/ja-JP.js +11 -1
- package/lib/locale/ko-KR.js +11 -1
- package/lib/locale/ru-RU.js +11 -1
- package/lib/locale/sk-SK.js +11 -1
- package/lib/locale/vi-VN.js +11 -1
- package/lib/locale/zh-CN.js +11 -1
- package/lib/locale/zh-TW.js +11 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
package/lib/cjs/locale/ca-ES.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ca-ES.ts
|
|
3
|
+
const locale = { formula: { 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
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/en-US.js
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/en-US.ts
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
const locale = { formula: { progress: {
|
|
19
|
+
analyzing: "Analyzing",
|
|
20
|
+
calculating: "Calculating",
|
|
21
|
+
"array-analysis": "Array Analysis",
|
|
22
|
+
"array-calculation": "Array Calculation",
|
|
23
|
+
done: "Done"
|
|
24
|
+
} } };
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
module.exports = locale;
|
package/lib/cjs/locale/es-ES.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/es-ES.ts
|
|
3
|
+
const locale = { formula: { 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
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/fa-IR.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/fa-IR.ts
|
|
3
|
+
const locale = { formula: { progress: {
|
|
4
|
+
analyzing: "در حال تحلیل",
|
|
5
|
+
calculating: "در حال محاسبه",
|
|
6
|
+
"array-analysis": "تحلیل آرایه",
|
|
7
|
+
"array-calculation": "محاسبه آرایه",
|
|
8
|
+
done: "تمام"
|
|
9
|
+
} } };
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/fr-FR.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/fr-FR.ts
|
|
3
|
+
const locale = { formula: { 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
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/ja-JP.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ja-JP.ts
|
|
3
|
+
const locale = { formula: { progress: {
|
|
4
|
+
analyzing: "解析中",
|
|
5
|
+
calculating: "計算中",
|
|
6
|
+
"array-analysis": "配列の解析",
|
|
7
|
+
"array-calculation": "配列の計算",
|
|
8
|
+
done: "完了"
|
|
9
|
+
} } };
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/ko-KR.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ko-KR.ts
|
|
3
|
+
const locale = { formula: { progress: {
|
|
4
|
+
analyzing: "분석 중",
|
|
5
|
+
calculating: "계산 중",
|
|
6
|
+
"array-analysis": "배열 분석",
|
|
7
|
+
"array-calculation": "배열 계산",
|
|
8
|
+
done: "완료"
|
|
9
|
+
} } };
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/ru-RU.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ru-RU.ts
|
|
3
|
+
const locale = { formula: { progress: {
|
|
4
|
+
analyzing: "Анализ",
|
|
5
|
+
calculating: "Вычисление",
|
|
6
|
+
"array-analysis": "Анализ массива",
|
|
7
|
+
"array-calculation": "Вычисление массива",
|
|
8
|
+
done: "Готово"
|
|
9
|
+
} } };
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/sk-SK.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/sk-SK.ts
|
|
3
|
+
const locale = { formula: { 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
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/vi-VN.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/vi-VN.ts
|
|
3
|
+
const locale = { formula: { 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
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/zh-CN.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/zh-CN.ts
|
|
3
|
+
const locale = { formula: { progress: {
|
|
4
|
+
analyzing: "分析中",
|
|
5
|
+
calculating: "计算中",
|
|
6
|
+
"array-analysis": "数组分析",
|
|
7
|
+
"array-calculation": "数组计算",
|
|
8
|
+
done: "完成"
|
|
9
|
+
} } };
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/cjs/locale/zh-TW.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/zh-TW.ts
|
|
3
|
+
const locale = { formula: { progress: {
|
|
4
|
+
analyzing: "分析中",
|
|
5
|
+
calculating: "計算中",
|
|
6
|
+
"array-analysis": "陣列分析",
|
|
7
|
+
"array-calculation": "陣列計算",
|
|
8
|
+
done: "完成"
|
|
9
|
+
} } };
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
module.exports = locale;
|
package/lib/es/facade.js
CHANGED
|
@@ -1 +1,253 @@
|
|
|
1
|
-
import
|
|
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 { };
|