@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.
Files changed (183) hide show
  1. package/lib/cjs/facade.js +1 -0
  2. package/lib/cjs/index.js +2 -2
  3. package/lib/es/facade.js +79 -0
  4. package/lib/es/index.js +23862 -21567
  5. package/lib/types/basics/common.d.ts +6 -2
  6. package/lib/types/basics/format.d.ts +2 -15
  7. package/lib/types/basics/math.d.ts +3 -0
  8. package/lib/types/basics/statistical.d.ts +19 -3
  9. package/lib/types/commands/mutations/set-other-formula.mutation.d.ts +2 -2
  10. package/lib/types/controller/calculate.controller.d.ts +2 -2
  11. package/lib/types/engine/analysis/parser.d.ts +0 -2
  12. package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -0
  13. package/lib/types/engine/ast-node/function-node.d.ts +5 -2
  14. package/lib/types/engine/ast-node/operator-node.d.ts +1 -2
  15. package/lib/types/engine/ast-node/prefix-node.d.ts +6 -5
  16. package/lib/types/engine/ast-node/reference-node.d.ts +8 -10
  17. package/lib/types/engine/ast-node/suffix-node.d.ts +8 -5
  18. package/lib/types/engine/ast-node/union-node.d.ts +1 -2
  19. package/lib/types/engine/ast-node/value-node.d.ts +1 -2
  20. package/lib/types/engine/dependency/dependency-tree.d.ts +85 -38
  21. package/lib/types/engine/dependency/formula-dependency.d.ts +45 -36
  22. package/lib/types/engine/interpreter/interpreter.d.ts +3 -3
  23. package/lib/types/engine/utils/array-object.d.ts +1 -1
  24. package/lib/types/engine/utils/ast-node-tool.d.ts +1 -1
  25. package/lib/types/engine/utils/generate-ast-node.d.ts +8 -0
  26. package/lib/types/engine/utils/prefixHandler.d.ts +3 -2
  27. package/lib/types/engine/utils/value-object.d.ts +9 -1
  28. package/lib/types/engine/value-object/__tests__/array-inverted-index-cache.spec.d.ts +16 -0
  29. package/lib/types/engine/value-object/__tests__/array-inverted-index-cache2.spec.d.ts +16 -0
  30. package/lib/types/engine/value-object/cube-value-object.d.ts +1 -0
  31. package/lib/types/engine/value-object/lambda-value-object.d.ts +3 -1
  32. package/lib/types/engine/value-object/primitive-object.d.ts +0 -1
  33. package/lib/types/facade/f-formula.d.ts +31 -0
  34. package/lib/types/facade/f-univer.d.ts +9 -0
  35. package/lib/types/facade/index.d.ts +17 -0
  36. package/lib/types/functions/base-function.d.ts +7 -0
  37. package/lib/types/functions/compatibility/hypgeomdist/__tests__/index.spec.d.ts +16 -0
  38. package/lib/types/functions/compatibility/hypgeomdist/index.d.ts +8 -0
  39. package/lib/types/functions/compatibility/lognormdist/__tests__/index.spec.d.ts +16 -0
  40. package/lib/types/functions/compatibility/lognormdist/index.d.ts +8 -0
  41. package/lib/types/functions/compatibility/negbinomdist/__tests__/index.spec.d.ts +16 -0
  42. package/lib/types/functions/compatibility/negbinomdist/index.d.ts +8 -0
  43. package/lib/types/functions/compatibility/tdist/__tests__/index.spec.d.ts +16 -0
  44. package/lib/types/functions/compatibility/tdist/index.d.ts +8 -0
  45. package/lib/types/functions/financial/fv/index.d.ts +1 -1
  46. package/lib/types/functions/financial/ipmt/index.d.ts +1 -1
  47. package/lib/types/functions/financial/pmt/index.d.ts +1 -1
  48. package/lib/types/functions/financial/ppmt/index.d.ts +1 -1
  49. package/lib/types/functions/financial/pv/index.d.ts +1 -1
  50. package/lib/types/functions/lookup/formulatext/__tests__/index.spec.d.ts +16 -0
  51. package/lib/types/functions/lookup/formulatext/index.d.ts +10 -0
  52. package/lib/types/functions/lookup/lookup/index.d.ts +1 -1
  53. package/lib/types/functions/math/mmult/index.d.ts +0 -1
  54. package/lib/types/functions/statistical/frequency/__tests__/index.spec.d.ts +16 -0
  55. package/lib/types/functions/statistical/frequency/index.d.ts +9 -0
  56. package/lib/types/functions/statistical/gamma/__tests__/index.spec.d.ts +16 -0
  57. package/lib/types/functions/statistical/gamma/index.d.ts +8 -0
  58. package/lib/types/functions/statistical/gamma-dist/__tests__/index.spec.d.ts +16 -0
  59. package/lib/types/functions/statistical/gamma-dist/index.d.ts +8 -0
  60. package/lib/types/functions/statistical/gamma-inv/__tests__/index.spec.d.ts +16 -0
  61. package/lib/types/functions/statistical/gamma-inv/index.d.ts +8 -0
  62. package/lib/types/functions/statistical/gammaln/__tests__/index.spec.d.ts +16 -0
  63. package/lib/types/functions/statistical/gammaln/index.d.ts +8 -0
  64. package/lib/types/functions/statistical/gauss/__tests__/index.spec.d.ts +16 -0
  65. package/lib/types/functions/statistical/gauss/index.d.ts +8 -0
  66. package/lib/types/functions/statistical/geomean/__tests__/index.spec.d.ts +16 -0
  67. package/lib/types/functions/statistical/geomean/index.d.ts +7 -0
  68. package/lib/types/functions/statistical/growth/__tests__/index.spec.d.ts +16 -0
  69. package/lib/types/functions/statistical/growth/index.d.ts +16 -0
  70. package/lib/types/functions/statistical/harmean/__tests__/index.spec.d.ts +16 -0
  71. package/lib/types/functions/statistical/harmean/index.d.ts +7 -0
  72. package/lib/types/functions/statistical/hypgeom-dist/__tests__/index.spec.d.ts +16 -0
  73. package/lib/types/functions/statistical/hypgeom-dist/index.d.ts +8 -0
  74. package/lib/types/functions/statistical/kurt/__tests__/index.spec.d.ts +16 -0
  75. package/lib/types/functions/statistical/kurt/index.d.ts +8 -0
  76. package/lib/types/functions/statistical/large/__tests__/index.spec.d.ts +16 -0
  77. package/lib/types/functions/statistical/large/index.d.ts +9 -0
  78. package/lib/types/functions/statistical/lognorm-dist/__tests__/index.spec.d.ts +16 -0
  79. package/lib/types/functions/statistical/lognorm-dist/index.d.ts +8 -0
  80. package/lib/types/functions/statistical/lognorm-inv/__tests__/index.spec.d.ts +16 -0
  81. package/lib/types/functions/statistical/lognorm-inv/index.d.ts +8 -0
  82. package/lib/types/functions/statistical/median/__tests__/index.spec.d.ts +16 -0
  83. package/lib/types/functions/statistical/median/index.d.ts +8 -0
  84. package/lib/types/functions/statistical/mode-mult/__tests__/index.spec.d.ts +16 -0
  85. package/lib/types/functions/statistical/mode-mult/index.d.ts +8 -0
  86. package/lib/types/functions/statistical/mode-sngl/__tests__/index.spec.d.ts +16 -0
  87. package/lib/types/functions/statistical/mode-sngl/index.d.ts +8 -0
  88. package/lib/types/functions/statistical/negbinom-dist/__tests__/index.spec.d.ts +16 -0
  89. package/lib/types/functions/statistical/negbinom-dist/index.d.ts +8 -0
  90. package/lib/types/functions/statistical/pearson/__tests__/index.spec.d.ts +16 -0
  91. package/lib/types/functions/statistical/pearson/index.d.ts +8 -0
  92. package/lib/types/functions/statistical/percentile-exc/__tests__/index.spec.d.ts +16 -0
  93. package/lib/types/functions/statistical/percentile-exc/index.d.ts +9 -0
  94. package/lib/types/functions/statistical/percentile-inc/__tests__/index.spec.d.ts +16 -0
  95. package/lib/types/functions/statistical/percentile-inc/index.d.ts +9 -0
  96. package/lib/types/functions/statistical/percentrank-exc/__tests__/index.spec.d.ts +16 -0
  97. package/lib/types/functions/statistical/percentrank-exc/index.d.ts +9 -0
  98. package/lib/types/functions/statistical/percentrank-inc/__tests__/index.spec.d.ts +16 -0
  99. package/lib/types/functions/statistical/percentrank-inc/index.d.ts +9 -0
  100. package/lib/types/functions/statistical/permut/__tests__/index.spec.d.ts +16 -0
  101. package/lib/types/functions/statistical/permut/index.d.ts +7 -0
  102. package/lib/types/functions/statistical/permutationa/__tests__/index.spec.d.ts +16 -0
  103. package/lib/types/functions/statistical/permutationa/index.d.ts +7 -0
  104. package/lib/types/functions/statistical/phi/__tests__/index.spec.d.ts +16 -0
  105. package/lib/types/functions/statistical/phi/index.d.ts +8 -0
  106. package/lib/types/functions/statistical/poisson-dist/__tests__/index.spec.d.ts +16 -0
  107. package/lib/types/functions/statistical/poisson-dist/index.d.ts +8 -0
  108. package/lib/types/functions/statistical/prob/__tests__/index.spec.d.ts +16 -0
  109. package/lib/types/functions/statistical/prob/index.d.ts +9 -0
  110. package/lib/types/functions/statistical/quartile-exc/__tests__/index.spec.d.ts +16 -0
  111. package/lib/types/functions/statistical/quartile-exc/index.d.ts +9 -0
  112. package/lib/types/functions/statistical/quartile-inc/__tests__/index.spec.d.ts +16 -0
  113. package/lib/types/functions/statistical/quartile-inc/index.d.ts +9 -0
  114. package/lib/types/functions/statistical/rsq/__tests__/index.spec.d.ts +16 -0
  115. package/lib/types/functions/statistical/rsq/index.d.ts +8 -0
  116. package/lib/types/functions/statistical/skew/__tests__/index.spec.d.ts +16 -0
  117. package/lib/types/functions/statistical/skew/index.d.ts +8 -0
  118. package/lib/types/functions/statistical/skew-p/__tests__/index.spec.d.ts +16 -0
  119. package/lib/types/functions/statistical/skew-p/index.d.ts +8 -0
  120. package/lib/types/functions/statistical/slope/__tests__/index.spec.d.ts +16 -0
  121. package/lib/types/functions/statistical/slope/index.d.ts +8 -0
  122. package/lib/types/functions/statistical/small/__tests__/index.spec.d.ts +16 -0
  123. package/lib/types/functions/statistical/small/index.d.ts +9 -0
  124. package/lib/types/functions/statistical/standardize/__tests__/index.spec.d.ts +16 -0
  125. package/lib/types/functions/statistical/standardize/index.d.ts +8 -0
  126. package/lib/types/functions/statistical/steyx/__tests__/index.spec.d.ts +16 -0
  127. package/lib/types/functions/statistical/steyx/index.d.ts +8 -0
  128. package/lib/types/functions/statistical/t-dist/__tests__/index.spec.d.ts +16 -0
  129. package/lib/types/functions/statistical/t-dist/index.d.ts +8 -0
  130. package/lib/types/functions/statistical/t-dist-2t/__tests__/index.spec.d.ts +16 -0
  131. package/lib/types/functions/statistical/t-dist-2t/index.d.ts +8 -0
  132. package/lib/types/functions/statistical/t-dist-rt/__tests__/index.spec.d.ts +16 -0
  133. package/lib/types/functions/statistical/t-dist-rt/index.d.ts +8 -0
  134. package/lib/types/functions/statistical/t-inv/__tests__/index.spec.d.ts +16 -0
  135. package/lib/types/functions/statistical/t-inv/index.d.ts +8 -0
  136. package/lib/types/functions/statistical/t-inv-2t/__tests__/index.spec.d.ts +16 -0
  137. package/lib/types/functions/statistical/t-inv-2t/index.d.ts +8 -0
  138. package/lib/types/functions/statistical/t-test/__tests__/index.spec.d.ts +16 -0
  139. package/lib/types/functions/statistical/t-test/index.d.ts +14 -0
  140. package/lib/types/functions/statistical/trimmean/__tests__/index.spec.d.ts +16 -0
  141. package/lib/types/functions/statistical/trimmean/index.d.ts +9 -0
  142. package/lib/types/functions/statistical/weibull-dist/__tests__/index.spec.d.ts +16 -0
  143. package/lib/types/functions/statistical/weibull-dist/index.d.ts +8 -0
  144. package/lib/types/functions/statistical/z-test/__tests__/index.spec.d.ts +16 -0
  145. package/lib/types/functions/statistical/z-test/index.d.ts +9 -0
  146. package/lib/types/functions/text/exact/index.d.ts +1 -1
  147. package/lib/types/functions/text/find/__test__/index.spec.d.ts +16 -0
  148. package/lib/types/functions/text/find/index.d.ts +8 -0
  149. package/lib/types/functions/text/findb/__test__/index.spec.d.ts +16 -0
  150. package/lib/types/functions/text/findb/index.d.ts +8 -0
  151. package/lib/types/functions/text/function-map.d.ts +1 -2
  152. package/lib/types/functions/text/left/__test__/index.spec.d.ts +16 -0
  153. package/lib/types/functions/text/left/index.d.ts +8 -0
  154. package/lib/types/functions/text/lower/index.d.ts +2 -3
  155. package/lib/types/functions/text/mid/index.d.ts +2 -2
  156. package/lib/types/functions/text/midb/__test__/index.spec.d.ts +16 -0
  157. package/lib/types/functions/text/midb/index.d.ts +8 -0
  158. package/lib/types/functions/text/proper/index.d.ts +1 -1
  159. package/lib/types/functions/text/replace/__test__/index.spec.d.ts +16 -0
  160. package/lib/types/functions/text/replace/index.d.ts +8 -0
  161. package/lib/types/functions/text/replaceb/__test__/index.spec.d.ts +16 -0
  162. package/lib/types/functions/text/replaceb/index.d.ts +8 -0
  163. package/lib/types/functions/text/search/__test__/index.spec.d.ts +16 -0
  164. package/lib/types/functions/text/search/index.d.ts +8 -0
  165. package/lib/types/functions/text/searchb/__test__/index.spec.d.ts +16 -0
  166. package/lib/types/functions/text/searchb/index.d.ts +8 -0
  167. package/lib/types/functions/text/t/index.d.ts +1 -1
  168. package/lib/types/functions/text/textjoin/__test__/index.spec.d.ts +16 -0
  169. package/lib/types/functions/text/textjoin/index.d.ts +10 -0
  170. package/lib/types/functions/text/trim/__test__/index.spec.d.ts +16 -0
  171. package/lib/types/functions/text/trim/index.d.ts +8 -0
  172. package/lib/types/functions/text/upper/__test__/index.spec.d.ts +16 -0
  173. package/lib/types/functions/text/upper/index.d.ts +8 -0
  174. package/lib/types/index.d.ts +13 -2
  175. package/lib/types/models/formula-data.model.d.ts +6 -1
  176. package/lib/types/plugin.d.ts +3 -2
  177. package/lib/types/services/calculate-formula.service.d.ts +25 -14
  178. package/lib/types/services/dependency-manager.service.d.ts +70 -69
  179. package/lib/types/services/other-formula-manager.service.d.ts +4 -4
  180. package/lib/types/services/runtime.service.d.ts +2 -2
  181. package/lib/umd/facade.js +1 -0
  182. package/lib/umd/index.js +2 -2
  183. package/package.json +21 -11
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,8 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Search extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(findText: BaseValueObject, withinText: BaseValueObject, startNum?: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
8
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,8 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Searchb extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(findText: BaseValueObject, withinText: BaseValueObject, startNum?: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
8
+ }
@@ -1,5 +1,5 @@
1
- import { BaseFunction } from '../../base-function';
2
1
  import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
3
  export declare class T extends BaseFunction {
4
4
  minParams: number;
5
5
  maxParams: number;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,10 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Textjoin extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(delimiter: BaseValueObject, ignoreEmpty: BaseValueObject, ...variants: BaseValueObject[]): BaseValueObject;
7
+ private _handleSingleObject;
8
+ private _getDelimiterValues;
9
+ private _getTextValues;
10
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,8 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Trim extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
8
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,8 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Upper extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
8
+ }
@@ -49,7 +49,7 @@ export { ReferenceNodeFactory } from './engine/ast-node/reference-node';
49
49
  export { SuffixNodeFactory } from './engine/ast-node/suffix-node';
50
50
  export { UnionNodeFactory } from './engine/ast-node/union-node';
51
51
  export { ValueNodeFactory } from './engine/ast-node/value-node';
52
- export { FormulaDependencyGenerator } from './engine/dependency/formula-dependency';
52
+ export { FormulaDependencyGenerator, IFormulaDependencyGenerator } from './engine/dependency/formula-dependency';
53
53
  export { Interpreter } from './engine/interpreter/interpreter';
54
54
  export { BaseReferenceObject, type FunctionVariantType } from './engine/reference-object/base-reference-object';
55
55
  export { AsyncArrayObject, AsyncObject } from './engine/reference-object/base-reference-object';
@@ -103,7 +103,7 @@ export type { IRangeChange } from './models/formula-data.model';
103
103
  export { UniverFormulaEnginePlugin } from './plugin';
104
104
  export { IActiveDirtyManagerService } from './services/active-dirty-manager.service';
105
105
  export { ActiveDirtyManagerService } from './services/active-dirty-manager.service';
106
- export { CalculateFormulaService } from './services/calculate-formula.service';
106
+ export { CalculateFormulaService, ICalculateFormulaService } from './services/calculate-formula.service';
107
107
  export { FormulaCurrentConfigService, IFormulaCurrentConfigService, type IFormulaDirtyData } from './services/current-data.service';
108
108
  export { DefinedNamesService, type IDefinedNameMapItem, IDefinedNamesService, type IDefinedNamesServiceParam } from './services/defined-names.service';
109
109
  export { IDependencyManagerService } from './services/dependency-manager.service';
@@ -116,3 +116,14 @@ export { FormulaExecutedStateType, FormulaExecuteStageType, FormulaRuntimeServic
116
116
  export { ISuperTableService } from './services/super-table.service';
117
117
  export { SuperTableService } from './services/super-table.service';
118
118
  export { deserializeRangeWithSheetWithCache } from './engine/utils/reference-cache';
119
+ export { FFormula } from './facade/f-formula';
120
+ export { FormulaDependencyTree, type IFormulaDependencyTree } from './engine/dependency/dependency-tree';
121
+ export { type IOtherFormulaData } from './basics/common';
122
+ export { FormulaDependencyTreeType } from './engine/dependency/dependency-tree';
123
+ export { FormulaDependencyTreeVirtual } from './engine/dependency/dependency-tree';
124
+ export { generateAstNode } from './engine/utils/generate-ast-node';
125
+ export { type IFeatureCalculationManagerParam } from './services/feature-calculation-manager.service';
126
+ export { DEFAULT_INTERVAL_COUNT } from './services/calculate-formula.service';
127
+ export { type IUniverEngineFormulaConfig, PLUGIN_CONFIG_KEY } from './controller/config.schema';
128
+ export { generateRandomDependencyTreeId } from './engine/dependency/formula-dependency';
129
+ export { DependencyManagerBaseService } from './services/dependency-manager.service';
@@ -1,4 +1,4 @@
1
- import { ICellData, IObjectMatrixPrimitiveType, IRange, Nullable, Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
1
+ import { ICellData, IObjectMatrixPrimitiveType, IRange, IUnitRange, Nullable, Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
2
2
  import { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap } from '../basics/common';
3
3
  import { IFormulaIdMap } from './utils/formula-data-util';
4
4
  import { LexerTreeBuilder } from '../engine/analysis/lexer-tree-builder';
@@ -41,5 +41,10 @@ export declare class FormulaDataModel extends Disposable {
41
41
  getFormulaDataItem(row: number, column: number, sheetId: string, unitId: string): Nullable<IFormulaDataItem>;
42
42
  getFormulaIdMap(unitId: string, sheetId: string): Map<string, IFormulaIdMap>;
43
43
  getFormulaStringByCell(row: number, column: number, sheetId: string, unitId: string): string | null;
44
+ /**
45
+ * Function to get all formula ranges
46
+ * @returns
47
+ */
48
+ getFormulaDirtyRanges(): IUnitRange[];
44
49
  }
45
50
  export declare function initSheetFormulaData(formulaData: IFormulaData, unitId: string, sheetId: string, cellMatrix: ObjectMatrix<Nullable<ICellData>>): IFormulaData;
@@ -1,13 +1,14 @@
1
1
  import { IUniverEngineFormulaConfig } from './controller/config.schema';
2
2
  import { IConfigService, Injector, Plugin } from '@univerjs/core';
3
3
  export declare class UniverFormulaEnginePlugin extends Plugin {
4
- private readonly _config;
4
+ protected readonly _config: Partial<IUniverEngineFormulaConfig>;
5
5
  protected _injector: Injector;
6
- private readonly _configService;
6
+ protected readonly _configService: IConfigService;
7
7
  static pluginName: string;
8
8
  constructor(_config: Partial<IUniverEngineFormulaConfig> | undefined, _injector: Injector, _configService: IConfigService);
9
9
  onStarting(): void;
10
10
  onReady(): void;
11
11
  onRendered(): void;
12
12
  private _initialize;
13
+ protected _initializeWithOverride(): void;
13
14
  }
@@ -1,29 +1,40 @@
1
+ import { Observable, Subject } from 'rxjs';
1
2
  import { IFeatureDirtyRangeType, IFormulaDatasetConfig, IRuntimeUnitDataType } from '../basics/common';
2
3
  import { IAllRuntimeData, IExecutionInProgressParams, IFormulaRuntimeService } from './runtime.service';
3
4
  import { Disposable, IConfigService } from '@univerjs/core';
4
5
  import { Lexer } from '../engine/analysis/lexer';
5
6
  import { AstTreeBuilder } from '../engine/analysis/parser';
6
7
  import { ErrorNode } from '../engine/ast-node/base-ast-node';
7
- import { FormulaDependencyGenerator } from '../engine/dependency/formula-dependency';
8
+ import { IFormulaDependencyGenerator } from '../engine/dependency/formula-dependency';
8
9
  import { Interpreter } from '../engine/interpreter/interpreter';
9
10
  import { IFormulaCurrentConfigService } from './current-data.service';
10
11
  export declare const DEFAULT_CYCLE_REFERENCE_COUNT = 1;
11
12
  export declare const DEFAULT_INTERVAL_COUNT = 500;
12
13
  export declare const CYCLE_REFERENCE_COUNT = "cycleReferenceCount";
13
14
  export declare const EVERY_N_FUNCTION_EXECUTION_PAUSE = 100;
15
+ export interface ICalculateFormulaService {
16
+ executionInProgressListener$: Observable<IExecutionInProgressParams>;
17
+ executionCompleteListener$: Observable<IAllRuntimeData>;
18
+ setRuntimeFeatureCellData(featureId: string, featureData: IRuntimeUnitDataType): void;
19
+ setRuntimeFeatureRange(featureId: string, featureRange: IFeatureDirtyRangeType): void;
20
+ execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
21
+ stopFormulaExecution(): void;
22
+ calculate(formulaString: string, transformSuffix?: boolean): void;
23
+ }
24
+ export declare const ICalculateFormulaService: import('@wendellhu/redi').IdentifierDecorator<ICalculateFormulaService>;
14
25
  export declare class CalculateFormulaService extends Disposable {
15
- private readonly _configService;
16
- private readonly _lexer;
17
- private readonly _currentConfigService;
18
- private readonly _runtimeService;
19
- private readonly _formulaDependencyGenerator;
20
- private readonly _interpreter;
21
- private readonly _astTreeBuilder;
22
- private readonly _executionInProgressListener$;
23
- readonly executionInProgressListener$: import('rxjs').Observable<IExecutionInProgressParams>;
24
- private readonly _executionCompleteListener$;
25
- readonly executionCompleteListener$: import('rxjs').Observable<IAllRuntimeData>;
26
- constructor(_configService: IConfigService, _lexer: Lexer, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _formulaDependencyGenerator: FormulaDependencyGenerator, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder);
26
+ protected readonly _configService: IConfigService;
27
+ protected readonly _lexer: Lexer;
28
+ protected readonly _currentConfigService: IFormulaCurrentConfigService;
29
+ protected readonly _runtimeService: IFormulaRuntimeService;
30
+ protected readonly _formulaDependencyGenerator: IFormulaDependencyGenerator;
31
+ protected readonly _interpreter: Interpreter;
32
+ protected readonly _astTreeBuilder: AstTreeBuilder;
33
+ protected readonly _executionInProgressListener$: Subject<IExecutionInProgressParams>;
34
+ readonly executionInProgressListener$: Observable<IExecutionInProgressParams>;
35
+ protected readonly _executionCompleteListener$: Subject<IAllRuntimeData>;
36
+ readonly executionCompleteListener$: Observable<IAllRuntimeData>;
37
+ constructor(_configService: IConfigService, _lexer: Lexer, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _formulaDependencyGenerator: IFormulaDependencyGenerator, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder);
27
38
  /**
28
39
  * Stop the execution of the formula.
29
40
  */
@@ -40,6 +51,6 @@ export declare class CalculateFormulaService extends Disposable {
40
51
  execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
41
52
  private _execute;
42
53
  private _getArrayFormulaDirtyRangeAndExcludedRange;
43
- private _apply;
54
+ protected _apply(isArrayFormulaState?: boolean): Promise<IAllRuntimeData | undefined>;
44
55
  calculate(formulaString: string, transformSuffix?: boolean): ErrorNode | undefined;
45
56
  }
@@ -1,50 +1,67 @@
1
- import { IUnitRange, Nullable, Disposable, ObjectMatrix } from '@univerjs/core';
2
- import { FormulaDependencyTree } from '../engine/dependency/dependency-tree';
3
- export interface IOtherFormulaDependencyParam {
4
- [unitId: string]: Nullable<{
5
- [sheetId: string]: {
6
- [formulaId: string]: Nullable<number>;
7
- };
8
- }>;
9
- }
10
- export interface IFeatureFormulaDependencyParam {
11
- [unitId: string]: Nullable<{
12
- [sheetId: string]: {
13
- [featureId: string]: Nullable<number>;
14
- };
15
- }>;
16
- }
17
- export interface IFormulaDependencyParam {
18
- [unitId: string]: Nullable<{
19
- [sheetId: string]: ObjectMatrix<number>;
20
- }>;
21
- }
1
+ import { IUnitRange, Nullable, Disposable, ObjectMatrix, RTree } from '@univerjs/core';
2
+ import { AstRootNode } from '../engine/ast-node';
3
+ import { FormulaDependencyTree, IFormulaDependencyTree } from '../engine/dependency/dependency-tree';
22
4
  export interface IDependencyManagerService {
23
5
  dispose(): void;
24
- getAllTree(): FormulaDependencyTree[];
25
- buildDependencyTree(shouldBeBuildTrees: FormulaDependencyTree[], dependencyTrees?: FormulaDependencyTree[]): FormulaDependencyTree[];
26
- clearDependencyForTree(shouldBeClearTree: Nullable<FormulaDependencyTree>): void;
27
6
  reset(): void;
28
- addOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string, dependencyTree: FormulaDependencyTree): void;
7
+ addOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string, dependencyTree: IFormulaDependencyTree): void;
8
+ addOtherFormulaDependencyMainData(formulaId: string): void;
29
9
  removeOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string[]): void;
30
- getOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): Nullable<FormulaDependencyTree>;
10
+ hasOtherFormulaDataMainData(formulaId: string): boolean;
11
+ clearOtherFormulaDependency(unitId: string, sheetId?: string): void;
12
+ getOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): Nullable<ObjectMatrix<number>>;
31
13
  addFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string, dependencyTree: FormulaDependencyTree): void;
32
14
  removeFeatureFormulaDependency(unitId: string, sheetId: string, featureIds: string[]): void;
33
- getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): Nullable<FormulaDependencyTree>;
34
- addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: FormulaDependencyTree): void;
15
+ getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): Nullable<number>;
16
+ clearFeatureFormulaDependency(unitId: string, sheetId?: string): void;
17
+ addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: IFormulaDependencyTree): void;
35
18
  removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void;
36
- getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): Nullable<FormulaDependencyTree>;
37
- removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
19
+ getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): Nullable<number>;
38
20
  clearFormulaDependency(unitId: string, sheetId?: string): void;
39
- addDependencyRTreeCache(tree: FormulaDependencyTree): void;
40
- searchDependency(search: IUnitRange[]): Set<number>;
21
+ removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
22
+ addFormulaDependencyByDefinedName(tree: IFormulaDependencyTree, node: Nullable<AstRootNode>): void;
23
+ addDependencyRTreeCache(tree: IFormulaDependencyTree): void;
24
+ searchDependency(search: IUnitRange[], exceptTreeIds?: Set<number>): Set<number>;
41
25
  getLastTreeId(): number;
42
- clearDependencyAll(): void;
26
+ getTreeById(treeId: number): Nullable<IFormulaDependencyTree>;
27
+ getAllTree(): IFormulaDependencyTree[];
28
+ buildDependencyTree(shouldBeBuildTrees: IFormulaDependencyTree[], dependencyTrees?: IFormulaDependencyTree[]): IFormulaDependencyTree[];
29
+ }
30
+ export declare class DependencyManagerBaseService extends Disposable implements IDependencyManagerService {
31
+ buildDependencyTree(shouldBeBuildTrees: IFormulaDependencyTree[], dependencyTrees?: IFormulaDependencyTree[]): IFormulaDependencyTree[];
32
+ getTreeById(treeId: number): Nullable<IFormulaDependencyTree>;
33
+ getAllTree(): IFormulaDependencyTree[];
34
+ protected _otherFormulaData: Map<string, Map<string, Map<string, ObjectMatrix<number>>>>;
35
+ protected _featureFormulaData: Map<string, Map<string, Map<string, Nullable<number>>>>;
36
+ protected _formulaData: Map<string, Map<string, ObjectMatrix<number>>>;
37
+ protected _definedNameMap: Map<string, Map<string, Set<number>>>;
38
+ protected _otherFormulaDataMainData: Set<string>;
39
+ protected _dependencyRTreeCache: RTree;
40
+ private _dependencyTreeIdLast;
41
+ reset(): void;
42
+ addOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string, dependencyTree: IFormulaDependencyTree): void;
43
+ removeOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string[]): void;
43
44
  clearOtherFormulaDependency(unitId: string, sheetId?: string): void;
45
+ addFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string, dependencyTree: FormulaDependencyTree): void;
46
+ removeFeatureFormulaDependency(unitId: string, sheetId: string, featureIds: string[]): void;
44
47
  clearFeatureFormulaDependency(unitId: string, sheetId?: string): void;
45
- openKdTree(): void;
46
- closeKdTree(): void;
47
- getTreeById(treeId: number): Nullable<FormulaDependencyTree>;
48
+ addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: IFormulaDependencyTree): void;
49
+ removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void;
50
+ clearFormulaDependency(unitId: string, sheetId?: string): void;
51
+ removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
52
+ searchDependency(search: IUnitRange[], exceptTreeIds?: Set<number>): Set<number>;
53
+ protected _restDependencyTreeId(): void;
54
+ getOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): ObjectMatrix<number> | undefined;
55
+ addOtherFormulaDependencyMainData(formulaId: string): void;
56
+ hasOtherFormulaDataMainData(formulaId: string): boolean;
57
+ protected _removeDependencyRTreeCacheById(unitId: string, sheetId: string): void;
58
+ getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): Nullable<number>;
59
+ getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): Nullable<number>;
60
+ addDependencyRTreeCache(tree: IFormulaDependencyTree): void;
61
+ getLastTreeId(): number;
62
+ protected _addAllTreeMap(tree: IFormulaDependencyTree): void;
63
+ protected _addDefinedName(unitId: string, definedName: string, treeId: number): void;
64
+ addFormulaDependencyByDefinedName(tree: IFormulaDependencyTree, node: Nullable<AstRootNode>): void;
48
65
  }
49
66
  /**
50
67
  * Passively marked as dirty, register the reference and execution actions of the feature plugin.
@@ -52,22 +69,10 @@ export interface IDependencyManagerService {
52
69
  * causing the formula to be marked dirty again,
53
70
  * thereby completing the calculation of the entire dependency tree.
54
71
  */
55
- export declare class DependencyManagerService extends Disposable implements IDependencyManagerService {
56
- private _otherFormulaData;
57
- private _featureFormulaData;
58
- private _formulaData;
59
- private _allTreeMap;
60
- private _dependencyRTreeCache;
61
- private _dependencyTreeIdLast;
72
+ export declare class DependencyManagerService extends DependencyManagerBaseService implements IDependencyManagerService {
73
+ protected _allTreeMap: Map<number, IFormulaDependencyTree>;
62
74
  dispose(): void;
63
- /**
64
- * Get all FormulaDependencyTree from _otherFormulaData, _featureFormulaData, _formulaData
65
- * return FormulaDependencyTree[]
66
- */
67
- getAllTree(): FormulaDependencyTree[];
68
- getTreeById(treeId: number): FormulaDependencyTree | undefined;
69
- buildDependencyTree(shouldBeBuildTrees: FormulaDependencyTree[], dependencyTrees?: FormulaDependencyTree[]): FormulaDependencyTree[];
70
- searchDependency(search: IUnitRange[]): Set<number>;
75
+ buildDependencyTree(shouldBeBuildTrees: IFormulaDependencyTree[], dependencyTrees?: IFormulaDependencyTree[]): IFormulaDependencyTree[];
71
76
  /**
72
77
  * Build the dependency relationship between the trees.
73
78
  * @param allTrees all FormulaDependencyTree
@@ -81,34 +86,30 @@ export declare class DependencyManagerService extends Disposable implements IDep
81
86
  */
82
87
  private _buildReverseDependency;
83
88
  /**
84
- * Clear the dependency relationship of the tree.
85
- * establish the relationship between the parent and the child.
86
- * @param shouldBeClearTree
89
+ * Get all FormulaDependencyTree from _otherFormulaData, _featureFormulaData, _formulaData
90
+ * return FormulaDependencyTree[]
87
91
  */
88
- clearDependencyForTree(shouldBeClearTree: Nullable<FormulaDependencyTree>): void;
92
+ getAllTree(): IFormulaDependencyTree[];
93
+ getTreeById(treeId: number): IFormulaDependencyTree | undefined;
89
94
  reset(): void;
90
- addOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string, dependencyTree: FormulaDependencyTree): void;
95
+ addOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string, dependencyTree: IFormulaDependencyTree): void;
91
96
  removeOtherFormulaDependency(unitId: string, sheetId: string, formulaIds: string[]): void;
92
- getOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): FormulaDependencyTree | undefined;
93
- hasOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): boolean;
94
97
  clearOtherFormulaDependency(unitId: string, sheetId?: string): void;
95
98
  addFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string, dependencyTree: FormulaDependencyTree): void;
96
99
  removeFeatureFormulaDependency(unitId: string, sheetId: string, featureIds: string[]): void;
97
100
  clearFeatureFormulaDependency(unitId: string, sheetId?: string): void;
98
- getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): FormulaDependencyTree | null | undefined;
99
- addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: FormulaDependencyTree): void;
101
+ addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: IFormulaDependencyTree): void;
100
102
  removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void;
101
103
  clearFormulaDependency(unitId: string, sheetId?: string): void;
102
- clearDependencyAll(): void;
103
- getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): FormulaDependencyTree | null | undefined;
104
- addDependencyRTreeCache(tree: FormulaDependencyTree): void;
105
- private _restDependencyTreeId;
106
- getLastTreeId(): number;
107
- private _removeDependencyRTreeCacheById;
104
+ /**
105
+ * Clear the dependency relationship of the tree.
106
+ * establish the relationship between the parent and the child.
107
+ * @param shouldBeClearTree
108
+ */
109
+ clearDependencyForTree(shouldBeClearTree: Nullable<IFormulaDependencyTree>): void;
108
110
  private _removeDependencyRTreeCache;
109
111
  removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
110
- openKdTree(): void;
111
- closeKdTree(): void;
112
- private _removeAllTreeMap;
112
+ protected _removeAllTreeMap(treeId: Nullable<number>): void;
113
+ protected _addAllTreeMap(tree: IFormulaDependencyTree): void;
113
114
  }
114
115
  export declare const IDependencyManagerService: import('@wendellhu/redi').IdentifierDecorator<DependencyManagerService>;
@@ -1,17 +1,17 @@
1
1
  import { Nullable, Disposable } from '@univerjs/core';
2
- import { IDirtyUnitOtherFormulaMap, IFormulaDataItem, IOtherFormulaData } from '../basics/common';
2
+ import { IDirtyUnitOtherFormulaMap, IOtherFormulaData, IOtherFormulaDataItem } from '../basics/common';
3
3
  export interface IOtherFormulaManagerSearchParam {
4
4
  unitId: string;
5
5
  subUnitId: string;
6
6
  formulaId: string;
7
7
  }
8
8
  export interface IOtherFormulaManagerInsertParam extends IOtherFormulaManagerSearchParam {
9
- item: IFormulaDataItem;
9
+ item: IOtherFormulaDataItem;
10
10
  }
11
11
  export interface IOtherFormulaManagerService {
12
12
  dispose(): void;
13
13
  remove(searchParam: IOtherFormulaManagerSearchParam): void;
14
- get(searchParam: IOtherFormulaManagerSearchParam): Nullable<IFormulaDataItem>;
14
+ get(searchParam: IOtherFormulaManagerSearchParam): Nullable<IOtherFormulaDataItem>;
15
15
  has(searchParam: IOtherFormulaManagerSearchParam): boolean;
16
16
  register(insertParam: IOtherFormulaManagerInsertParam): void;
17
17
  getOtherFormulaData(): IOtherFormulaData;
@@ -28,7 +28,7 @@ export declare class OtherFormulaManagerService extends Disposable implements IO
28
28
  private _otherFormulaData;
29
29
  dispose(): void;
30
30
  remove(searchParam: IOtherFormulaManagerSearchParam): void;
31
- get(searchParam: IOtherFormulaManagerSearchParam): IFormulaDataItem | undefined;
31
+ get(searchParam: IOtherFormulaManagerSearchParam): IOtherFormulaDataItem | undefined;
32
32
  has(searchParam: IOtherFormulaManagerSearchParam): boolean;
33
33
  register(insertParam: IOtherFormulaManagerInsertParam): void;
34
34
  batchRegister(formulaData: IOtherFormulaData): void;
@@ -69,7 +69,7 @@ export interface IFormulaRuntimeService {
69
69
  setFormulaCycleIndex(index: number): void;
70
70
  isStopExecution(): boolean;
71
71
  getFormulaExecuteStage(): FormulaExecuteStageType;
72
- setRuntimeOtherData(formulaId: string, functionVariant: FunctionVariantType): void;
72
+ setRuntimeOtherData(formulaId: string, x: number, y: number, functionVariant: FunctionVariantType): void;
73
73
  getRuntimeOtherData(): IRuntimeOtherUnitDataType;
74
74
  getAllRuntimeData(): IAllRuntimeData;
75
75
  markedAsSuccessfullyExecuted(): void;
@@ -159,7 +159,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
159
159
  clearFunctionDefinitionPrivacyVar(): void;
160
160
  registerFunctionDefinitionPrivacyVar(lambdaId: string, lambdaVar: Map<string, Nullable<BaseAstNode>>): void;
161
161
  getFunctionDefinitionPrivacyVar(lambdaId: string): Nullable<Map<string, Nullable<BaseAstNode>>>;
162
- setRuntimeOtherData(formulaId: string, functionVariant: FunctionVariantType): void;
162
+ setRuntimeOtherData(formulaId: string, x: number, y: number, functionVariant: FunctionVariantType): void;
163
163
  setRuntimeData(functionVariant: FunctionVariantType): void;
164
164
  getUnitData(): IRuntimeUnitDataType;
165
165
  getUnitArrayFormula(): IArrayFormulaRangeType;
@@ -0,0 +1 @@
1
+ (function(i,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula"],a):(i=typeof globalThis<"u"?globalThis:i||self,a(i.UniverEngineFormulaFacade={},i.UniverCore,i.UniverEngineFormula))})(this,function(i,a,u){"use strict";var m=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=(r,t,e,n)=>{for(var o=n>1?void 0:n?d(t,e):t,c=r.length-1,s;c>=0;c--)(s=r[c])&&(o=(n?s(t,e,o):s(o))||o);return n&&o&&m(t,e,o),o},l=(r,t)=>(e,n)=>t(e,n,r);i.FFormula=class extends a.FBase{constructor(t,e){super(),this._commandService=t,this._injector=e}executeCalculation(){this._commandService.executeCommand(u.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})}stopCalculation(){this._commandService.executeCommand(u.SetFormulaCalculationStopMutation.id,{})}calculationStart(t){return this._commandService.onCommandExecuted(e=>{if(e.id===u.SetFormulaCalculationStartMutation.id){const n=e.params;t(n.forceCalculation)}})}calculationEnd(t){return this._commandService.onCommandExecuted(e=>{if(e.id!==u.SetFormulaCalculationNotificationMutation.id)return;const n=e.params;n.functionsExecutedState!==void 0&&t(n.functionsExecutedState)})}onCalculationEnd(){return new Promise((t,e)=>{const n=setTimeout(()=>{e(new Error("Calculation end timeout"))},3e4),o=this.calculationEnd(()=>{clearTimeout(n),o.dispose(),t()})})}calculationProcessing(t){return this._commandService.onCommandExecuted(e=>{if(e.id!==u.SetFormulaCalculationNotificationMutation.id)return;const n=e.params;n.stageInfo!==void 0&&t(n.stageInfo)})}},i.FFormula=f([l(0,a.Inject(a.ICommandService)),l(1,a.Inject(a.Injector))],i.FFormula);class v extends a.FUniver{getFormula(){return this._injector.createInstance(i.FFormula)}}a.FUniver.extend(v),Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});