@univerjs/engine-formula 0.4.1 → 0.4.2-nightly.202410301606
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/es/facade.js +82 -0
- package/lib/es/index.js +2859 -793
- package/lib/set-formula-calculation.mutation-DKlyJoJ-.mjs +26 -0
- package/lib/types/basics/database.d.ts +31 -0
- package/lib/types/basics/inverted-index-cache.d.ts +7 -18
- package/lib/types/basics/math.d.ts +12 -0
- package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +0 -1
- package/lib/types/controller/calculate.controller.d.ts +0 -1
- package/lib/types/controller/config.schema.d.ts +5 -1
- package/lib/types/engine/analysis/__tests__/dependency.spec.d.ts +16 -0
- package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -1
- package/lib/types/engine/ast-node/function-node.d.ts +2 -0
- package/lib/types/engine/ast-node/node-type.d.ts +13 -13
- package/lib/types/engine/dependency/dependency-tree.d.ts +14 -6
- package/lib/types/engine/reference-object/base-reference-object.d.ts +10 -0
- package/lib/types/engine/utils/char-kit.d.ts +5 -7
- package/lib/types/engine/utils/numfmt-kit.d.ts +13 -1
- package/lib/types/engine/utils/reference-cache.d.ts +3 -0
- package/lib/types/engine/utils/reference.d.ts +0 -2
- package/lib/types/engine/value-object/array-value-object.d.ts +1 -0
- package/lib/types/facade/f-formula.d.ts +30 -0
- package/lib/types/facade/f-univer.d.ts +9 -0
- package/lib/types/facade/index.d.ts +1 -0
- package/lib/types/functions/base-function.d.ts +26 -1
- package/lib/types/functions/database/daverage/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/daverage/index.d.ts +8 -0
- package/lib/types/functions/database/dcount/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dcount/index.d.ts +8 -0
- package/lib/types/functions/database/dcounta/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dcounta/index.d.ts +8 -0
- package/lib/types/functions/database/dget/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dget/index.d.ts +7 -0
- package/lib/types/functions/database/dmax/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dmax/index.d.ts +8 -0
- package/lib/types/functions/database/dmin/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dmin/index.d.ts +8 -0
- package/lib/types/functions/database/dproduct/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dproduct/index.d.ts +8 -0
- package/lib/types/functions/database/dstdev/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dstdev/index.d.ts +8 -0
- package/lib/types/functions/database/dstdevp/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dstdevp/index.d.ts +8 -0
- package/lib/types/functions/database/dsum/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dsum/index.d.ts +8 -0
- package/lib/types/functions/database/dvar/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dvar/index.d.ts +8 -0
- package/lib/types/functions/database/dvarp/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/database/dvarp/index.d.ts +8 -0
- package/lib/types/functions/database/function-map.d.ts +3 -16
- package/lib/types/functions/financial/db/index.d.ts +1 -0
- package/lib/types/functions/financial/ddb/index.d.ts +1 -0
- package/lib/types/functions/financial/fv/index.d.ts +1 -0
- package/lib/types/functions/financial/ipmt/index.d.ts +1 -0
- package/lib/types/functions/financial/npv/index.d.ts +1 -0
- package/lib/types/functions/financial/pmt/index.d.ts +1 -0
- package/lib/types/functions/financial/ppmt/index.d.ts +1 -0
- package/lib/types/functions/financial/pv/index.d.ts +1 -0
- package/lib/types/functions/financial/sln/index.d.ts +1 -0
- package/lib/types/functions/financial/syd/index.d.ts +1 -0
- package/lib/types/functions/financial/tbillprice/index.d.ts +1 -0
- package/lib/types/functions/financial/vdb/index.d.ts +1 -0
- package/lib/types/functions/information/function-map.d.ts +1 -1
- package/lib/types/functions/information/sheet/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/information/sheet/index.d.ts +10 -0
- package/lib/types/functions/information/sheets/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/information/sheets/index.d.ts +8 -0
- package/lib/types/functions/lookup/xlookup/index.d.ts +1 -1
- package/lib/types/functions/math/arabic/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/arabic/index.d.ts +8 -0
- package/lib/types/functions/math/roman/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/roman/index.d.ts +9 -0
- package/lib/types/functions/math/sumif/index.d.ts +3 -1
- package/lib/types/functions/text/arraytotext/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/arraytotext/index.d.ts +9 -0
- package/lib/types/functions/text/asc/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/asc/index.d.ts +8 -0
- package/lib/types/functions/text/bahttext/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/bahttext/index.d.ts +9 -0
- package/lib/types/functions/text/char/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/char/index.d.ts +8 -0
- package/lib/types/functions/text/clean/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/clean/index.d.ts +8 -0
- package/lib/types/functions/text/code/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/code/index.d.ts +8 -0
- package/lib/types/functions/text/dbcs/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/dbcs/index.d.ts +8 -0
- package/lib/types/functions/text/dollar/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/dollar/index.d.ts +9 -0
- package/lib/types/functions/text/exact/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/exact/index.d.ts +8 -0
- package/lib/types/functions/text/fixed/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/fixed/index.d.ts +8 -0
- package/lib/types/functions/text/leftb/index.d.ts +1 -2
- package/lib/types/functions/text/numbervalue/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/numbervalue/index.d.ts +8 -0
- package/lib/types/functions/text/proper/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/proper/index.d.ts +8 -0
- package/lib/types/functions/text/right/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/right/index.d.ts +8 -0
- package/lib/types/functions/text/rightb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/rightb/index.d.ts +8 -0
- package/lib/types/functions/text/substitute/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/substitute/index.d.ts +9 -0
- package/lib/types/functions/text/t/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/t/index.d.ts +7 -0
- package/lib/types/functions/text/unichar/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/unichar/index.d.ts +8 -0
- package/lib/types/functions/text/unicode/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/unicode/index.d.ts +8 -0
- package/lib/types/functions/text/value/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/value/index.d.ts +8 -0
- package/lib/types/functions/text/valuetotext/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/valuetotext/index.d.ts +8 -0
- package/lib/types/index.d.ts +2 -3
- package/lib/types/services/calculate-formula.service.d.ts +3 -4
- package/lib/types/services/current-data.service.d.ts +17 -2
- package/lib/types/services/dependency-manager.service.d.ts +17 -9
- package/lib/types/services/runtime.service.d.ts +10 -9
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +2 -2
- package/package.json +10 -13
- package/LICENSE +0 -176
- package/lib/cjs/index.js +0 -7
package/lib/es/facade.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
3
|
+
import { ICommandService, FUniver } from "@univerjs/core";
|
|
4
|
+
import { a as SetFormulaCalculationStartMutation, S as SetFormulaCalculationStopMutation, b as SetFormulaCalculationNotificationMutation } from "../set-formula-calculation.mutation-DKlyJoJ-.mjs";
|
|
5
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
6
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
8
|
+
return kind && result && __defProp2(target, key, result), result;
|
|
9
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), _a;
|
|
10
|
+
let FFormula = (_a = class {
|
|
11
|
+
constructor(_commandService) {
|
|
12
|
+
this._commandService = _commandService;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Start the calculation of the formula.
|
|
16
|
+
*/
|
|
17
|
+
executeCalculation() {
|
|
18
|
+
this._commandService.executeCommand(SetFormulaCalculationStartMutation.id, { commands: [], forceCalculation: !0 }, { onlyLocal: !0 });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Stop the calculation of the formula.
|
|
22
|
+
*/
|
|
23
|
+
stopCalculation() {
|
|
24
|
+
this._commandService.executeCommand(SetFormulaCalculationStopMutation.id, {});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Listening calculation starts.
|
|
28
|
+
*/
|
|
29
|
+
calculationStart(callback) {
|
|
30
|
+
return this._commandService.onCommandExecuted((command) => {
|
|
31
|
+
if (command.id === SetFormulaCalculationStartMutation.id) {
|
|
32
|
+
const params = command.params;
|
|
33
|
+
callback(params.forceCalculation);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Listening calculation ends.
|
|
39
|
+
*/
|
|
40
|
+
calculationEnd(callback) {
|
|
41
|
+
return this._commandService.onCommandExecuted((command) => {
|
|
42
|
+
if (command.id !== SetFormulaCalculationNotificationMutation.id)
|
|
43
|
+
return;
|
|
44
|
+
const params = command.params;
|
|
45
|
+
params.functionsExecutedState !== void 0 && callback(params.functionsExecutedState);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
onCalculationEnd() {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const timer = setTimeout(() => {
|
|
51
|
+
reject(new Error("Calculation end timeout"));
|
|
52
|
+
}, 3e4), disposable = this.calculationEnd(() => {
|
|
53
|
+
clearTimeout(timer), disposable.dispose(), resolve();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Listening calculation processing.
|
|
59
|
+
*/
|
|
60
|
+
calculationProcessing(callback) {
|
|
61
|
+
return this._commandService.onCommandExecuted((command) => {
|
|
62
|
+
if (command.id !== SetFormulaCalculationNotificationMutation.id)
|
|
63
|
+
return;
|
|
64
|
+
const params = command.params;
|
|
65
|
+
params.stageInfo !== void 0 && callback(params.stageInfo);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, __name(_a, "FFormula"), _a);
|
|
69
|
+
FFormula = __decorateClass([
|
|
70
|
+
__decorateParam(0, ICommandService)
|
|
71
|
+
], FFormula);
|
|
72
|
+
const _FUniverEngineFormulaMixin = class _FUniverEngineFormulaMixin extends FUniver {
|
|
73
|
+
getFormula() {
|
|
74
|
+
return this._injector.createInstance(FFormula);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
__name(_FUniverEngineFormulaMixin, "FUniverEngineFormulaMixin");
|
|
78
|
+
let FUniverEngineFormulaMixin = _FUniverEngineFormulaMixin;
|
|
79
|
+
FUniver.extend(FUniverEngineFormulaMixin);
|
|
80
|
+
export {
|
|
81
|
+
FFormula
|
|
82
|
+
};
|