@univerjs/engine-formula 0.4.2 → 0.5.0-alpha.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 +1 -0
- package/lib/cjs/index.js +2 -2
- package/lib/es/facade.js +79 -0
- package/lib/es/index.js +23862 -21567
- package/lib/types/basics/common.d.ts +6 -2
- package/lib/types/basics/format.d.ts +2 -15
- package/lib/types/basics/math.d.ts +3 -0
- package/lib/types/basics/statistical.d.ts +19 -3
- package/lib/types/commands/mutations/set-other-formula.mutation.d.ts +2 -2
- package/lib/types/controller/calculate.controller.d.ts +2 -2
- package/lib/types/engine/analysis/parser.d.ts +0 -2
- package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -0
- package/lib/types/engine/ast-node/function-node.d.ts +5 -2
- package/lib/types/engine/ast-node/operator-node.d.ts +1 -2
- package/lib/types/engine/ast-node/prefix-node.d.ts +6 -5
- package/lib/types/engine/ast-node/reference-node.d.ts +8 -10
- package/lib/types/engine/ast-node/suffix-node.d.ts +8 -5
- package/lib/types/engine/ast-node/union-node.d.ts +1 -2
- package/lib/types/engine/ast-node/value-node.d.ts +1 -2
- package/lib/types/engine/dependency/dependency-tree.d.ts +85 -38
- package/lib/types/engine/dependency/formula-dependency.d.ts +45 -36
- package/lib/types/engine/interpreter/interpreter.d.ts +3 -3
- package/lib/types/engine/utils/array-object.d.ts +1 -1
- package/lib/types/engine/utils/ast-node-tool.d.ts +1 -1
- package/lib/types/engine/utils/generate-ast-node.d.ts +8 -0
- package/lib/types/engine/utils/prefixHandler.d.ts +3 -2
- package/lib/types/engine/utils/value-object.d.ts +9 -1
- package/lib/types/engine/value-object/__tests__/array-inverted-index-cache.spec.d.ts +16 -0
- package/lib/types/engine/value-object/__tests__/array-inverted-index-cache2.spec.d.ts +16 -0
- package/lib/types/engine/value-object/cube-value-object.d.ts +1 -0
- package/lib/types/engine/value-object/lambda-value-object.d.ts +3 -1
- package/lib/types/engine/value-object/primitive-object.d.ts +0 -1
- package/lib/types/facade/f-formula.d.ts +31 -0
- package/lib/types/facade/f-univer.d.ts +9 -0
- package/lib/types/facade/index.d.ts +17 -0
- package/lib/types/functions/base-function.d.ts +7 -0
- package/lib/types/functions/compatibility/hypgeomdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/hypgeomdist/index.d.ts +8 -0
- package/lib/types/functions/compatibility/lognormdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/lognormdist/index.d.ts +8 -0
- package/lib/types/functions/compatibility/negbinomdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/negbinomdist/index.d.ts +8 -0
- package/lib/types/functions/compatibility/tdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/tdist/index.d.ts +8 -0
- package/lib/types/functions/financial/fv/index.d.ts +1 -1
- package/lib/types/functions/financial/ipmt/index.d.ts +1 -1
- package/lib/types/functions/financial/pmt/index.d.ts +1 -1
- package/lib/types/functions/financial/ppmt/index.d.ts +1 -1
- package/lib/types/functions/financial/pv/index.d.ts +1 -1
- package/lib/types/functions/lookup/formulatext/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/formulatext/index.d.ts +10 -0
- package/lib/types/functions/lookup/lookup/index.d.ts +1 -1
- package/lib/types/functions/math/mmult/index.d.ts +0 -1
- package/lib/types/functions/statistical/frequency/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/frequency/index.d.ts +9 -0
- package/lib/types/functions/statistical/gamma/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gamma/index.d.ts +8 -0
- package/lib/types/functions/statistical/gamma-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gamma-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/gamma-inv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gamma-inv/index.d.ts +8 -0
- package/lib/types/functions/statistical/gammaln/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gammaln/index.d.ts +8 -0
- package/lib/types/functions/statistical/gauss/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gauss/index.d.ts +8 -0
- package/lib/types/functions/statistical/geomean/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/geomean/index.d.ts +7 -0
- package/lib/types/functions/statistical/growth/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/growth/index.d.ts +16 -0
- package/lib/types/functions/statistical/harmean/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/harmean/index.d.ts +7 -0
- package/lib/types/functions/statistical/hypgeom-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/hypgeom-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/kurt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/kurt/index.d.ts +8 -0
- package/lib/types/functions/statistical/large/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/large/index.d.ts +9 -0
- package/lib/types/functions/statistical/lognorm-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/lognorm-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/lognorm-inv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/lognorm-inv/index.d.ts +8 -0
- package/lib/types/functions/statistical/median/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/median/index.d.ts +8 -0
- package/lib/types/functions/statistical/mode-mult/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/mode-mult/index.d.ts +8 -0
- package/lib/types/functions/statistical/mode-sngl/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/mode-sngl/index.d.ts +8 -0
- package/lib/types/functions/statistical/negbinom-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/negbinom-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/pearson/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/pearson/index.d.ts +8 -0
- package/lib/types/functions/statistical/percentile-exc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentile-exc/index.d.ts +9 -0
- package/lib/types/functions/statistical/percentile-inc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentile-inc/index.d.ts +9 -0
- package/lib/types/functions/statistical/percentrank-exc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentrank-exc/index.d.ts +9 -0
- package/lib/types/functions/statistical/percentrank-inc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentrank-inc/index.d.ts +9 -0
- package/lib/types/functions/statistical/permut/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/permut/index.d.ts +7 -0
- package/lib/types/functions/statistical/permutationa/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/permutationa/index.d.ts +7 -0
- package/lib/types/functions/statistical/phi/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/phi/index.d.ts +8 -0
- package/lib/types/functions/statistical/poisson-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/poisson-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/prob/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/prob/index.d.ts +9 -0
- package/lib/types/functions/statistical/quartile-exc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/quartile-exc/index.d.ts +9 -0
- package/lib/types/functions/statistical/quartile-inc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/quartile-inc/index.d.ts +9 -0
- package/lib/types/functions/statistical/rsq/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/rsq/index.d.ts +8 -0
- package/lib/types/functions/statistical/skew/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/skew/index.d.ts +8 -0
- package/lib/types/functions/statistical/skew-p/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/skew-p/index.d.ts +8 -0
- package/lib/types/functions/statistical/slope/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/slope/index.d.ts +8 -0
- package/lib/types/functions/statistical/small/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/small/index.d.ts +9 -0
- package/lib/types/functions/statistical/standardize/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/standardize/index.d.ts +8 -0
- package/lib/types/functions/statistical/steyx/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/steyx/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-dist-2t/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-dist-2t/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-dist-rt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-dist-rt/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-inv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-inv/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-inv-2t/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-inv-2t/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-test/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-test/index.d.ts +14 -0
- package/lib/types/functions/statistical/trimmean/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/trimmean/index.d.ts +9 -0
- package/lib/types/functions/statistical/weibull-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/weibull-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/z-test/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/z-test/index.d.ts +9 -0
- package/lib/types/functions/text/exact/index.d.ts +1 -1
- package/lib/types/functions/text/find/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/find/index.d.ts +8 -0
- package/lib/types/functions/text/findb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/findb/index.d.ts +8 -0
- package/lib/types/functions/text/function-map.d.ts +1 -2
- package/lib/types/functions/text/left/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/left/index.d.ts +8 -0
- package/lib/types/functions/text/lower/index.d.ts +2 -3
- package/lib/types/functions/text/mid/index.d.ts +2 -2
- package/lib/types/functions/text/midb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/midb/index.d.ts +8 -0
- package/lib/types/functions/text/proper/index.d.ts +1 -1
- package/lib/types/functions/text/replace/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/replace/index.d.ts +8 -0
- package/lib/types/functions/text/replaceb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/replaceb/index.d.ts +8 -0
- package/lib/types/functions/text/search/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/search/index.d.ts +8 -0
- package/lib/types/functions/text/searchb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/searchb/index.d.ts +8 -0
- package/lib/types/functions/text/t/index.d.ts +1 -1
- package/lib/types/functions/text/textjoin/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/textjoin/index.d.ts +10 -0
- package/lib/types/functions/text/trim/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/trim/index.d.ts +8 -0
- package/lib/types/functions/text/upper/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/upper/index.d.ts +8 -0
- package/lib/types/index.d.ts +13 -2
- package/lib/types/models/formula-data.model.d.ts +6 -1
- package/lib/types/plugin.d.ts +3 -2
- package/lib/types/services/calculate-formula.service.d.ts +25 -14
- package/lib/types/services/dependency-manager.service.d.ts +70 -69
- package/lib/types/services/other-formula-manager.service.d.ts +4 -4
- package/lib/types/services/runtime.service.d.ts +2 -2
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +2 -2
- package/package.json +21 -11
package/lib/es/facade.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Inject as s, ICommandService as f, Injector as p, FBase as v, FUniver as d } from "@univerjs/core";
|
|
2
|
+
import { SetFormulaCalculationStartMutation as u, SetFormulaCalculationStopMutation as C, SetFormulaCalculationNotificationMutation as l } from "@univerjs/engine-formula";
|
|
3
|
+
var _ = Object.defineProperty, S = Object.getOwnPropertyDescriptor, x = (t, e, a, o) => {
|
|
4
|
+
for (var n = o > 1 ? void 0 : o ? S(e, a) : e, r = t.length - 1, i; r >= 0; r--)
|
|
5
|
+
(i = t[r]) && (n = (o ? i(e, a, n) : i(n)) || n);
|
|
6
|
+
return o && n && _(e, a, n), n;
|
|
7
|
+
}, m = (t, e) => (a, o) => e(a, o, t);
|
|
8
|
+
let c = class extends v {
|
|
9
|
+
constructor(t, e) {
|
|
10
|
+
super(), this._commandService = t, this._injector = e;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Start the calculation of the formula.
|
|
14
|
+
*/
|
|
15
|
+
executeCalculation() {
|
|
16
|
+
this._commandService.executeCommand(u.id, { commands: [], forceCalculation: !0 }, { onlyLocal: !0 });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Stop the calculation of the formula.
|
|
20
|
+
*/
|
|
21
|
+
stopCalculation() {
|
|
22
|
+
this._commandService.executeCommand(C.id, {});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Listening calculation starts.
|
|
26
|
+
*/
|
|
27
|
+
calculationStart(t) {
|
|
28
|
+
return this._commandService.onCommandExecuted((e) => {
|
|
29
|
+
if (e.id === u.id) {
|
|
30
|
+
const a = e.params;
|
|
31
|
+
t(a.forceCalculation);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Listening calculation ends.
|
|
37
|
+
*/
|
|
38
|
+
calculationEnd(t) {
|
|
39
|
+
return this._commandService.onCommandExecuted((e) => {
|
|
40
|
+
if (e.id !== l.id)
|
|
41
|
+
return;
|
|
42
|
+
const a = e.params;
|
|
43
|
+
a.functionsExecutedState !== void 0 && t(a.functionsExecutedState);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
onCalculationEnd() {
|
|
47
|
+
return new Promise((t, e) => {
|
|
48
|
+
const a = setTimeout(() => {
|
|
49
|
+
e(new Error("Calculation end timeout"));
|
|
50
|
+
}, 3e4), o = this.calculationEnd(() => {
|
|
51
|
+
clearTimeout(a), o.dispose(), t();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Listening calculation processing.
|
|
57
|
+
*/
|
|
58
|
+
calculationProcessing(t) {
|
|
59
|
+
return this._commandService.onCommandExecuted((e) => {
|
|
60
|
+
if (e.id !== l.id)
|
|
61
|
+
return;
|
|
62
|
+
const a = e.params;
|
|
63
|
+
a.stageInfo !== void 0 && t(a.stageInfo);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
c = x([
|
|
68
|
+
m(0, s(f)),
|
|
69
|
+
m(1, s(p))
|
|
70
|
+
], c);
|
|
71
|
+
class h extends d {
|
|
72
|
+
getFormula() {
|
|
73
|
+
return this._injector.createInstance(c);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
d.extend(h);
|
|
77
|
+
export {
|
|
78
|
+
c as FFormula
|
|
79
|
+
};
|