@univerjs/engine-formula 1.3.1 → 1.5.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 (189) hide show
  1. package/README.md +23 -5
  2. package/lib/cjs/{en-US-BYMYuEpp.js → en-US-9VDUEyCa.js} +15 -30
  3. package/lib/cjs/facade.js +4 -8
  4. package/lib/cjs/index.js +435 -57921
  5. package/lib/cjs/locale/ar-SA.js +16 -32
  6. package/lib/cjs/locale/ca-ES.js +16 -32
  7. package/lib/cjs/locale/de-DE.js +16 -32
  8. package/lib/cjs/locale/en-US.js +2 -3
  9. package/lib/cjs/locale/es-ES.js +16 -32
  10. package/lib/cjs/locale/fa-IR.js +2 -3
  11. package/lib/cjs/locale/fr-FR.js +16 -32
  12. package/lib/cjs/locale/id-ID.js +16 -32
  13. package/lib/cjs/locale/it-IT.js +16 -32
  14. package/lib/cjs/locale/ja-JP.js +16 -32
  15. package/lib/cjs/locale/ko-KR.js +16 -32
  16. package/lib/cjs/locale/pl-PL.js +16 -32
  17. package/lib/cjs/locale/pt-BR.js +16 -32
  18. package/lib/cjs/locale/ru-RU.js +16 -32
  19. package/lib/cjs/locale/sk-SK.js +16 -32
  20. package/lib/cjs/locale/vi-VN.js +16 -32
  21. package/lib/cjs/locale/zh-CN.js +16 -32
  22. package/lib/cjs/locale/zh-HK.js +2 -3
  23. package/lib/cjs/locale/zh-TW.js +2 -3
  24. package/lib/cjs/plugin-BLJLwyCu.js +59607 -0
  25. package/lib/cjs/worker.js +9 -0
  26. package/lib/cjs/{zh-TW-B5pYt-NJ.js → zh-TW-DGiZe-tu.js} +15 -30
  27. package/lib/{en-US-l1Vb3W1H.js → en-US-CgN_37u8.js} +15 -30
  28. package/lib/es/{en-US-l1Vb3W1H.js → en-US-CgN_37u8.js} +15 -30
  29. package/lib/es/facade.js +4 -8
  30. package/lib/es/index.js +205 -57671
  31. package/lib/es/locale/ar-SA.js +16 -32
  32. package/lib/es/locale/ca-ES.js +16 -32
  33. package/lib/es/locale/de-DE.js +16 -32
  34. package/lib/es/locale/en-US.js +2 -3
  35. package/lib/es/locale/es-ES.js +16 -32
  36. package/lib/es/locale/fa-IR.js +2 -3
  37. package/lib/es/locale/fr-FR.js +16 -32
  38. package/lib/es/locale/id-ID.js +16 -32
  39. package/lib/es/locale/it-IT.js +16 -32
  40. package/lib/es/locale/ja-JP.js +16 -32
  41. package/lib/es/locale/ko-KR.js +16 -32
  42. package/lib/es/locale/pl-PL.js +16 -32
  43. package/lib/es/locale/pt-BR.js +16 -32
  44. package/lib/es/locale/ru-RU.js +16 -32
  45. package/lib/es/locale/sk-SK.js +16 -32
  46. package/lib/es/locale/vi-VN.js +16 -32
  47. package/lib/es/locale/zh-CN.js +16 -32
  48. package/lib/es/locale/zh-HK.js +2 -3
  49. package/lib/es/locale/zh-TW.js +2 -3
  50. package/lib/es/plugin-USnMdaGa.js +58260 -0
  51. package/lib/es/worker.js +3 -0
  52. package/lib/es/{zh-TW-BA0p9R2Z.js → zh-TW-CsrIhkUN.js} +15 -30
  53. package/lib/facade.js +4 -8
  54. package/lib/index.js +205 -57671
  55. package/lib/locale/ar-SA.js +16 -32
  56. package/lib/locale/ca-ES.js +16 -32
  57. package/lib/locale/de-DE.js +16 -32
  58. package/lib/locale/en-US.js +2 -3
  59. package/lib/locale/es-ES.js +16 -32
  60. package/lib/locale/fa-IR.js +2 -3
  61. package/lib/locale/fr-FR.js +16 -32
  62. package/lib/locale/id-ID.js +16 -32
  63. package/lib/locale/it-IT.js +16 -32
  64. package/lib/locale/ja-JP.js +16 -32
  65. package/lib/locale/ko-KR.js +16 -32
  66. package/lib/locale/pl-PL.js +16 -32
  67. package/lib/locale/pt-BR.js +16 -32
  68. package/lib/locale/ru-RU.js +16 -32
  69. package/lib/locale/sk-SK.js +16 -32
  70. package/lib/locale/vi-VN.js +16 -32
  71. package/lib/locale/zh-CN.js +16 -32
  72. package/lib/locale/zh-HK.js +2 -3
  73. package/lib/locale/zh-TW.js +2 -3
  74. package/lib/plugin-USnMdaGa.js +58260 -0
  75. package/lib/types/basics/cache-lru.d.ts +0 -1
  76. package/lib/types/basics/common.d.ts +5 -1
  77. package/lib/types/basics/complex.d.ts +10 -4
  78. package/lib/types/basics/date.d.ts +6 -1
  79. package/lib/types/basics/function.d.ts +2 -1
  80. package/lib/types/basics/inverted-index-cache.d.ts +2 -1
  81. package/lib/types/basics/match-token.d.ts +1 -1
  82. package/lib/types/commands/mutations/set-super-table.mutation.d.ts +3 -2
  83. package/lib/types/controllers/calculate.controller.d.ts +0 -2
  84. package/lib/types/engine/analysis/lexer-tree-builder.d.ts +2 -4
  85. package/lib/types/engine/analysis/lexer.d.ts +6 -2
  86. package/lib/types/engine/analysis/parser.d.ts +3 -1
  87. package/lib/types/engine/ast-node/function-node.d.ts +2 -1
  88. package/lib/types/engine/ast-node/reference-node.d.ts +1 -4
  89. package/lib/types/engine/ast-node/union-node.d.ts +1 -3
  90. package/lib/types/engine/dependency/formula-dependency.d.ts +24 -3
  91. package/lib/types/engine/dependency/reference-context.d.ts +33 -0
  92. package/lib/types/engine/reference-object/base-reference-object.d.ts +5 -3
  93. package/lib/types/engine/reference-object/column-reference-object.d.ts +1 -1
  94. package/lib/types/engine/reference-object/row-reference-object.d.ts +1 -1
  95. package/lib/types/engine/utils/check-variant-error.d.ts +4 -4
  96. package/lib/types/engine/utils/generate-ast-node.d.ts +0 -2
  97. package/lib/types/engine/utils/numfmt-kit.d.ts +1 -1
  98. package/lib/types/engine/utils/three-dimensional-reference.d.ts +21 -0
  99. package/lib/types/engine/value-object/array-value-object.d.ts +4 -0
  100. package/lib/types/engine/value-object/cube-value-object.d.ts +5 -2
  101. package/lib/types/engine/value-object/lambda-value-object.d.ts +2 -2
  102. package/lib/types/functions/array/function-map.d.ts +1 -1
  103. package/lib/types/functions/base-function.d.ts +5 -5
  104. package/lib/types/functions/compatibility/function-map.d.ts +2 -2
  105. package/lib/types/functions/database/function-map.d.ts +1 -1
  106. package/lib/types/functions/date/function-map.d.ts +1 -1
  107. package/lib/types/functions/engineering/function-map.d.ts +1 -1
  108. package/lib/types/functions/financial/function-map.d.ts +1 -1
  109. package/lib/types/functions/information/function-map.d.ts +1 -1
  110. package/lib/types/functions/information/isblank/index.d.ts +1 -1
  111. package/lib/types/functions/information/iserr/index.d.ts +1 -1
  112. package/lib/types/functions/information/iserror/index.d.ts +1 -1
  113. package/lib/types/functions/information/islogical/index.d.ts +1 -1
  114. package/lib/types/functions/information/isna/index.d.ts +1 -1
  115. package/lib/types/functions/information/isnontext/index.d.ts +1 -1
  116. package/lib/types/functions/information/isnumber/index.d.ts +1 -1
  117. package/lib/types/functions/information/istext/index.d.ts +1 -1
  118. package/lib/types/functions/logical/function-map.d.ts +1 -1
  119. package/lib/types/functions/logical/groupby/index.d.ts +1 -1
  120. package/lib/types/functions/logical/if/index.d.ts +1 -1
  121. package/lib/types/functions/logical/iferror/index.d.ts +1 -1
  122. package/lib/types/functions/logical/ifna/index.d.ts +1 -1
  123. package/lib/types/functions/logical/makearray/index.d.ts +1 -1
  124. package/lib/types/functions/lookup/choosecols/index.d.ts +1 -1
  125. package/lib/types/functions/lookup/chooserows/index.d.ts +1 -1
  126. package/lib/types/functions/lookup/column/index.d.ts +1 -1
  127. package/lib/types/functions/lookup/formulatext/index.d.ts +1 -1
  128. package/lib/types/functions/lookup/function-map.d.ts +1 -1
  129. package/lib/types/functions/lookup/getpivotdata/index.d.ts +7 -2
  130. package/lib/types/functions/lookup/hstack/index.d.ts +1 -1
  131. package/lib/types/functions/lookup/index/index.d.ts +1 -0
  132. package/lib/types/functions/lookup/indirect/index.d.ts +1 -1
  133. package/lib/types/functions/lookup/row/index.d.ts +1 -1
  134. package/lib/types/functions/lookup/sortby/index.d.ts +1 -1
  135. package/lib/types/functions/lookup/transpose/index.d.ts +1 -1
  136. package/lib/types/functions/lookup/vlookup/index.d.ts +1 -1
  137. package/lib/types/functions/lookup/vstack/index.d.ts +1 -1
  138. package/lib/types/functions/math/aggregate/index.d.ts +1 -1
  139. package/lib/types/functions/math/function-map.d.ts +1 -1
  140. package/lib/types/functions/math/randarray/index.d.ts +1 -1
  141. package/lib/types/functions/math/subtotal/index.d.ts +1 -1
  142. package/lib/types/functions/math/sumifs/index.d.ts +1 -1
  143. package/lib/types/functions/meta/cube/index.d.ts +4 -1
  144. package/lib/types/functions/meta/function-map.d.ts +1 -1
  145. package/lib/types/functions/statistical/function-map.d.ts +1 -1
  146. package/lib/types/functions/statistical/stdev-p/index.d.ts +1 -1
  147. package/lib/types/functions/statistical/stdev-s/index.d.ts +1 -1
  148. package/lib/types/functions/statistical/stdeva/index.d.ts +1 -1
  149. package/lib/types/functions/statistical/stdevpa/index.d.ts +1 -1
  150. package/lib/types/functions/statistical/var-p/index.d.ts +1 -1
  151. package/lib/types/functions/statistical/var-s/index.d.ts +1 -1
  152. package/lib/types/functions/statistical/vara/index.d.ts +1 -1
  153. package/lib/types/functions/statistical/varpa/index.d.ts +1 -1
  154. package/lib/types/functions/text/function-map.d.ts +1 -1
  155. package/lib/types/functions/text/textafter/index.d.ts +1 -1
  156. package/lib/types/functions/text/textbefore/index.d.ts +1 -1
  157. package/lib/types/functions/text/textsplit/index.d.ts +1 -1
  158. package/lib/types/functions/web/function-map.d.ts +1 -1
  159. package/lib/types/index.d.ts +4 -3
  160. package/lib/types/locale/en-US.d.ts +3005 -3005
  161. package/lib/types/models/formula-data-snapshot.d.ts +24 -0
  162. package/lib/types/models/formula-data.model.d.ts +9 -1
  163. package/lib/types/plugin.d.ts +1 -1
  164. package/lib/types/services/active-dirty-manager.service.d.ts +3 -2
  165. package/lib/types/services/calculate-formula.service.d.ts +14 -4
  166. package/lib/types/services/current-data.service.d.ts +20 -6
  167. package/lib/types/services/defined-names.service.d.ts +1 -1
  168. package/lib/types/services/dependency-manager.service.d.ts +12 -2
  169. package/lib/types/services/external-reference-data-loader.service.d.ts +1 -1
  170. package/lib/types/services/feature-calculation-manager.service.d.ts +1 -1
  171. package/lib/types/services/formula/description.service.d.ts +1 -1
  172. package/lib/types/services/formula/formula-calculation-session.service.d.ts +2 -1
  173. package/lib/types/services/formula/register-function.service.d.ts +1 -1
  174. package/lib/types/services/formula-cache.service.d.ts +47 -0
  175. package/lib/types/services/formula-calculation-trigger.service.d.ts +1 -1
  176. package/lib/types/services/formula-changeset-calculation.service.d.ts +1 -1
  177. package/lib/types/services/formula-result.service.d.ts +29 -0
  178. package/lib/types/services/function.service.d.ts +4 -1
  179. package/lib/types/services/hyperlink-engine-formula.service.d.ts +1 -1
  180. package/lib/types/services/other-formula-manager.service.d.ts +1 -1
  181. package/lib/types/services/runtime.service.d.ts +16 -4
  182. package/lib/types/services/sheet-row-filtered.service.d.ts +1 -1
  183. package/lib/types/services/super-table.service.d.ts +4 -4
  184. package/lib/types/services/unit-reference-resolver.service.d.ts +1 -1
  185. package/lib/types/worker.d.ts +16 -0
  186. package/lib/umd/index.js +4 -4
  187. package/lib/worker.js +3 -0
  188. package/lib/{zh-TW-BA0p9R2Z.js → zh-TW-CsrIhkUN.js} +15 -30
  189. package/package.json +13 -8
package/README.md CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  ## Package Overview
10
10
 
11
- | Package | UMD global | CSS | Locales | Facade entry |
12
- | --- | --- | :---: | :---: | :---: |
13
- | `@univerjs/engine-formula` | `UniverEngineFormula` | No | Yes | Yes |
11
+ | Package | UMD global | CSS | Locales | Facade entry | Worker entry |
12
+ | --- | --- | :---: | :---: | :---: | :---: |
13
+ | `@univerjs/engine-formula` | `UniverEngineFormula` | No | Yes | Yes | Yes |
14
14
 
15
15
  ## Installation
16
16
 
@@ -20,16 +20,34 @@ pnpm add @univerjs/engine-formula
20
20
  npm install @univerjs/engine-formula
21
21
  ```
22
22
 
23
- Keep all `@univerjs/*` packages on the same version.
24
-
25
23
  ## Usage
26
24
 
25
+ Start with the [integration setup](https://docs.univer.ai/) for your document type, including its required plugins, styles, and locale resources. The snippet below assumes that setup is complete.
26
+
27
27
  ```ts
28
28
  import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
29
29
 
30
30
  univer.registerPlugin(UniverFormulaEnginePlugin);
31
31
  ```
32
32
 
33
+ ### Worker usage
34
+
35
+ On the main thread, import `UniverFormulaEnginePlugin` from `@univerjs/engine-formula`. Set `notExecuteFormula: true` to delegate calculation to the worker.
36
+
37
+ In the worker entry, import `UniverFormulaEnginePlugin` from `@univerjs/engine-formula/worker`:
38
+
39
+ ```ts
40
+ import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula/worker';
41
+
42
+ univer.registerPlugin(UniverFormulaEnginePlugin, { notExecuteFormula: false });
43
+ ```
44
+
45
+ ## Integration Notes
46
+
47
+ - Load the locale resources from `@univerjs/engine-formula/locale/<language>` for each language enabled by your application.
48
+ - Import `@univerjs/engine-formula/facade` when using this package through Univer Facade APIs.
49
+ - Custom calculation engines must await `FormulaResultService` before emitting completion. Subclasses of `CalculateFormulaService` must pass this service to the base constructor.
50
+
33
51
  ## Resources
34
52
 
35
53
  - [Documentation](https://docs.univer.ai)
@@ -1,4 +1,4 @@
1
- //#region src/locale/function-list/array/en-US.ts
1
+ // src/locale/function-list/array/en-US.ts
2
2
  /**
3
3
  * Copyright 2023-present DreamNum Co., Ltd.
4
4
  *
@@ -57,8 +57,7 @@ const locale$14 = {
57
57
  }
58
58
  };
59
59
 
60
- //#endregion
61
- //#region src/locale/function-list/compatibility/en-US.ts
60
+ // src/locale/function-list/compatibility/en-US.ts
62
61
  /**
63
62
  * Copyright 2023-present DreamNum Co., Ltd.
64
63
  *
@@ -881,8 +880,7 @@ const locale$13 = {
881
880
  }
882
881
  };
883
882
 
884
- //#endregion
885
- //#region src/locale/function-list/cube/en-US.ts
883
+ // src/locale/function-list/cube/en-US.ts
886
884
  /**
887
885
  * Copyright 2023-present DreamNum Co., Ltd.
888
886
  *
@@ -1057,8 +1055,7 @@ const locale$12 = {
1057
1055
  }
1058
1056
  };
1059
1057
 
1060
- //#endregion
1061
- //#region src/locale/function-list/database/en-US.ts
1058
+ // src/locale/function-list/database/en-US.ts
1062
1059
  /**
1063
1060
  * Copyright 2023-present DreamNum Co., Ltd.
1064
1061
  *
@@ -1341,8 +1338,7 @@ const locale$11 = {
1341
1338
  }
1342
1339
  };
1343
1340
 
1344
- //#endregion
1345
- //#region src/locale/function-list/date/en-US.ts
1341
+ // src/locale/function-list/date/en-US.ts
1346
1342
  /**
1347
1343
  * Copyright 2023-present DreamNum Co., Ltd.
1348
1344
  *
@@ -1813,8 +1809,7 @@ const locale$10 = {
1813
1809
  }
1814
1810
  };
1815
1811
 
1816
- //#endregion
1817
- //#region src/locale/function-list/engineering/en-US.ts
1812
+ // src/locale/function-list/engineering/en-US.ts
1818
1813
  /**
1819
1814
  * Copyright 2023-present DreamNum Co., Ltd.
1820
1815
  *
@@ -2699,8 +2694,7 @@ const locale$9 = {
2699
2694
  }
2700
2695
  };
2701
2696
 
2702
- //#endregion
2703
- //#region src/locale/function-list/financial/en-US.ts
2697
+ // src/locale/function-list/financial/en-US.ts
2704
2698
  /**
2705
2699
  * Copyright 2023-present DreamNum Co., Ltd.
2706
2700
  *
@@ -4329,8 +4323,7 @@ const locale$8 = {
4329
4323
  }
4330
4324
  };
4331
4325
 
4332
- //#endregion
4333
- //#region src/locale/function-list/information/en-US.ts
4326
+ // src/locale/function-list/information/en-US.ts
4334
4327
  /**
4335
4328
  * Copyright 2023-present DreamNum Co., Ltd.
4336
4329
  *
@@ -4667,8 +4660,7 @@ const locale$7 = {
4667
4660
  }
4668
4661
  };
4669
4662
 
4670
- //#endregion
4671
- //#region src/locale/function-list/logical/en-US.ts
4663
+ // src/locale/function-list/logical/en-US.ts
4672
4664
  /**
4673
4665
  * Copyright 2023-present DreamNum Co., Ltd.
4674
4666
  *
@@ -5057,8 +5049,7 @@ const locale$6 = {
5057
5049
  }
5058
5050
  };
5059
5051
 
5060
- //#endregion
5061
- //#region src/locale/function-list/lookup/en-US.ts
5052
+ // src/locale/function-list/lookup/en-US.ts
5062
5053
  /**
5063
5054
  * Copyright 2023-present DreamNum Co., Ltd.
5064
5055
  *
@@ -5881,8 +5872,7 @@ const locale$5 = {
5881
5872
  }
5882
5873
  };
5883
5874
 
5884
- //#endregion
5885
- //#region src/locale/function-list/math/en-US.ts
5875
+ // src/locale/function-list/math/en-US.ts
5886
5876
  /**
5887
5877
  * Copyright 2023-present DreamNum Co., Ltd.
5888
5878
  *
@@ -7199,8 +7189,7 @@ const locale$4 = {
7199
7189
  }
7200
7190
  };
7201
7191
 
7202
- //#endregion
7203
- //#region src/locale/function-list/statistical/en-US.ts
7192
+ // src/locale/function-list/statistical/en-US.ts
7204
7193
  /**
7205
7194
  * Copyright 2023-present DreamNum Co., Ltd.
7206
7195
  *
@@ -9552,8 +9541,7 @@ const locale$3 = {
9552
9541
  }
9553
9542
  };
9554
9543
 
9555
- //#endregion
9556
- //#region src/locale/function-list/text/en-US.ts
9544
+ // src/locale/function-list/text/en-US.ts
9557
9545
  /**
9558
9546
  * Copyright 2023-present DreamNum Co., Ltd.
9559
9547
  *
@@ -10528,8 +10516,7 @@ const locale$2 = {
10528
10516
  }
10529
10517
  };
10530
10518
 
10531
- //#endregion
10532
- //#region src/locale/function-list/univer/en-US.ts
10519
+ // src/locale/function-list/univer/en-US.ts
10533
10520
  /**
10534
10521
  * Copyright 2023-present DreamNum Co., Ltd.
10535
10522
  *
@@ -10547,8 +10534,7 @@ const locale$2 = {
10547
10534
  */
10548
10535
  const locale$1 = {};
10549
10536
 
10550
- //#endregion
10551
- //#region src/locale/function-list/web/en-US.ts
10537
+ // src/locale/function-list/web/en-US.ts
10552
10538
  /**
10553
10539
  * Copyright 2023-present DreamNum Co., Ltd.
10554
10540
  *
@@ -10609,7 +10595,6 @@ const locale = {
10609
10595
  }
10610
10596
  };
10611
10597
 
10612
- //#endregion
10613
10598
  Object.defineProperty(exports, "locale", {
10614
10599
  enumerable: true,
10615
10600
  get: function () {
package/lib/cjs/facade.js CHANGED
@@ -3,15 +3,14 @@ let _univerjs_core_facade = require("@univerjs/core/facade");
3
3
  let _univerjs_core = require("@univerjs/core");
4
4
  let _univerjs_engine_formula = require("@univerjs/engine-formula");
5
5
 
6
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
6
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
7
7
  function __decorateParam(paramIndex, decorator) {
8
8
  return function(target, key) {
9
9
  decorator(target, key, paramIndex);
10
10
  };
11
11
  }
12
12
 
13
- //#endregion
14
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
13
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
15
14
  function __decorate(decorators, target, key, desc) {
16
15
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17
16
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -19,8 +18,7 @@ function __decorate(decorators, target, key, desc) {
19
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
20
19
  }
21
20
 
22
- //#endregion
23
- //#region src/facade/f-formula.ts
21
+ // src/facade/f-formula.ts
24
22
  let FFormula = class FFormula extends _univerjs_core_facade.FBase {
25
23
  constructor(_commandService, _injector, _lexerTreeBuilder, _configService, _functionService, _definedNamesService, _superTableService) {
26
24
  super();
@@ -664,8 +662,7 @@ FFormula = __decorate([
664
662
  __decorateParam(6, _univerjs_engine_formula.ISuperTableService)
665
663
  ], FFormula);
666
664
 
667
- //#endregion
668
- //#region src/facade/f-univer.ts
665
+ // src/facade/f-univer.ts
669
666
  /**
670
667
  * Copyright 2023-present DreamNum Co., Ltd.
671
668
  *
@@ -688,7 +685,6 @@ var FUniverEngineFormulaMixin = class extends _univerjs_core_facade.FUniver {
688
685
  };
689
686
  _univerjs_core_facade.FUniver.extend(FUniverEngineFormulaMixin);
690
687
 
691
- //#endregion
692
688
  Object.defineProperty(exports, "FFormula", {
693
689
  enumerable: true,
694
690
  get: function () {