@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
@@ -22,5 +22,4 @@ export declare class FormulaAstLRU<T> {
22
22
  clear(): void;
23
23
  delete(formulaString: string): void;
24
24
  forEach(callbackfn: (value: T, key: string, map: LRUMap<string, T>) => void, thisArg?: any): void;
25
- private _hash;
26
25
  }
@@ -90,7 +90,6 @@ export interface IFormulaExternalReferenceBinding {
90
90
  sourceUnitType: FormulaUnitType;
91
91
  }
92
92
  export interface IFormulaExternalReferenceResource {
93
- schemaVersion: number;
94
93
  references: Record<string, IFormulaExternalReferenceBinding>;
95
94
  }
96
95
  /** Host-scoped External Reference resources keyed by the Host unitId. */
@@ -223,6 +222,9 @@ export interface ISuperTable {
223
222
  /** Whether the projected range contains a physical totals row. */
224
223
  showFooter?: boolean;
225
224
  }
225
+ export interface ISuperTableData extends Omit<ISuperTable, 'titleMap'> {
226
+ titleMap: Record<string, number>;
227
+ }
226
228
  export declare enum TableOptionType {
227
229
  ALL = "#All",
228
230
  DATA = "#Data",
@@ -243,6 +245,8 @@ export interface IUnitRowData {
243
245
  }>;
244
246
  }
245
247
  export interface IFormulaDatasetConfig {
248
+ /** Sheet metadata changed; rebind and calculate affected references without forcing all formulas. */
249
+ dirtyReferenceUnits?: string[];
246
250
  /** Recalculate iteration-sensitive groups and their dependents in these workbooks. */
247
251
  dirtyIterationUnits?: string[];
248
252
  /** Snapshot replay limits calculation to affected cycles and their required precedents. */
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { DateSystem } from '@univerjs/core';
16
17
  export declare class Complex {
17
18
  static getComplex(realNum: number, iNum: number, suffix: string): number | string;
18
19
  static createByComplexStr(realNum: number, iNum: number, suffix: string): Complex;
@@ -21,10 +22,15 @@ export declare class Complex {
21
22
  private _iNum;
22
23
  private _suffix;
23
24
  private _isError;
24
- constructor(inumber: number | string);
25
- private _getImReal;
26
- private _getImAginary;
27
- private _getImSuffix;
25
+ private _dateSystem;
26
+ constructor(inumber: number | string, dateSystem?: DateSystem);
27
+ /**
28
+ * Reads the text into its real and imaginary parts. Excel converts every
29
+ * part with the same text to number conversion it applies to cell values,
30
+ * so `1+2-3i` keeps `2-3` as its imaginary part, and any part that cannot
31
+ * be read makes the whole number invalid.
32
+ */
33
+ private _parseInumber;
28
34
  getRealNum(): number;
29
35
  getINum(): number;
30
36
  getSuffix(): string;
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { BaseValueObject } from '../engine/value-object/base-value-object';
17
16
  import { DateSystem, numfmt } from '@univerjs/core';
17
+ import type { BaseValueObject } from '../engine/value-object/base-value-object';
18
18
  import { ErrorValueObject } from '../engine/value-object/base-value-object';
19
19
  export declare const DEFAULT_DATE_FORMAT = "yyyy/mm/dd;@";
20
20
  export declare const DEFAULT_NOW_FORMAT = "yyyy/mm/dd hh:mm";
@@ -39,6 +39,11 @@ export declare function countWorkingDays(startDateSerialNumber: number, endDateS
39
39
  export declare function getDateSerialNumberByWorkingDays(startDateSerialNumber: number, workingDays: number, weekend?: number | string, holidays?: number[], dateSystem?: DateSystem): number | ErrorValueObject;
40
40
  export declare function getDateSerialNumberByObject(serialNumberObject: BaseValueObject, dateSystem?: DateSystem): ErrorValueObject | number;
41
41
  export declare function getWeekDayByDateSerialNumber(dateSerialNumber: number, dateSystem?: DateSystem): number;
42
+ /**
43
+ * Returns the ISO 8601 week number of a date serial, the value of `ISOWEEKNUM` and
44
+ * `WEEKNUM(date, 21)`. The time fraction is ignored so a date-time keeps the week of its day.
45
+ */
46
+ export declare function getIsoWeekNumber(dateSerialNumber: number, dateSystem?: DateSystem): number;
42
47
  interface ITwoDateDaysType {
43
48
  days: number;
44
49
  yearDays: number;
@@ -27,9 +27,9 @@ import type { FUNCTION_NAMES_LOOKUP } from '../functions/lookup/function-names';
27
27
  import type { FUNCTION_NAMES_MATH } from '../functions/math/function-names';
28
28
  import type { FUNCTION_NAMES_META } from '../functions/meta/function-names';
29
29
  import type { FUNCTION_NAMES_STATISTICAL } from '../functions/statistical/function-names';
30
- import type { FUNCTION_NAMES_TEXT } from '../functions/text/function-names';
31
30
  import type { FUNCTION_NAMES_UNIVER } from '../functions/univer/function-names';
32
31
  import type { FUNCTION_NAMES_WEB } from '../functions/web/function-names';
32
+ import { FUNCTION_NAMES_TEXT } from '../functions/text/function-names';
33
33
  /**
34
34
  * Function type, refer to https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb
35
35
  */
@@ -162,3 +162,4 @@ export interface IFunctionInfo {
162
162
  functionParameter: IFunctionParam[];
163
163
  }
164
164
  export type IFunctionNames = string | FUNCTION_NAMES_ARRAY | FUNCTION_NAMES_COMPATIBILITY | FUNCTION_NAMES_CUBE | FUNCTION_NAMES_DATABASE | FUNCTION_NAMES_DATE | FUNCTION_NAMES_ENGINEERING | FUNCTION_NAMES_FINANCIAL | FUNCTION_NAMES_INFORMATION | FUNCTION_NAMES_LOGICAL | FUNCTION_NAMES_LOOKUP | FUNCTION_NAMES_MATH | FUNCTION_NAMES_META | FUNCTION_NAMES_STATISTICAL | FUNCTION_NAMES_TEXT | FUNCTION_NAMES_UNIVER | FUNCTION_NAMES_WEB;
165
+ export declare function normalizeFunctionToken(token: string): string;
@@ -20,6 +20,7 @@ type ValueTypeWithNullUndefined = ValueType | null | undefined;
20
20
  type ValueTypeWithSymbol = ValueType | symbol;
21
21
  export declare const DEFAULT_EMPTY_CELL_KEY: unique symbol;
22
22
  export declare class InvertedIndexCache {
23
+ private readonly _normalizedValueMap;
23
24
  /**
24
25
  * {
25
26
  * unitId:{
@@ -47,8 +48,8 @@ export declare class InvertedIndexCache {
47
48
  rowsInCache: NumericTuple[];
48
49
  rowsNotInCache: NumericTuple[];
49
50
  };
51
+ deleteUnit(unitId: string): void;
50
52
  clear(): void;
51
53
  private _handleNewInterval;
52
54
  }
53
- export declare const CELL_INVERTED_INDEX_CACHE: InvertedIndexCache;
54
55
  export {};
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { compareToken, matchToken, operatorToken, prefixToken, suffixToken } from './token';
17
- export declare const FORMULA_LEXER_TOKENS: (operatorToken | suffixToken | compareToken | prefixToken | matchToken)[];
17
+ export declare const FORMULA_LEXER_TOKENS: (operatorToken | compareToken | matchToken | suffixToken | prefixToken)[];
18
18
  export declare function isFormulaLexerToken(str: string): boolean;
19
19
  export declare function includeFormulaLexerToken(str: string): boolean;
20
20
  export declare function normalizeSheetName(sheetName: string): string;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IMutation } from '@univerjs/core';
17
- import type { ISuperTable } from '../../basics/common';
17
+ import type { ISuperTable, ISuperTableData } from '../../basics/common';
18
18
  import type { ISuperTableOptionParam } from '../../services/super-table.service';
19
19
  export interface ISetSuperTableMutationSearchParam {
20
20
  unitId: string;
@@ -25,7 +25,8 @@ export interface IRemoveSuperTableMutationParam extends ISetSuperTableMutationSe
25
25
  }
26
26
  export interface ISetSuperTableMutationParam extends ISetSuperTableMutationSearchParam {
27
27
  oldTableName?: string;
28
- reference: ISuperTable;
28
+ /** Plain column data for RPC; Map remains accepted for existing local callers. */
29
+ reference: ISuperTableData | ISuperTable;
29
30
  }
30
31
  /**
31
32
  * In the formula engine, the mutation is solely responsible for communication between the worker and the main thread.
@@ -30,6 +30,4 @@ export declare class CalculateController extends Disposable {
30
30
  private _generateCellDependencyTreeJson;
31
31
  private _calculateFormulaString;
32
32
  private _initialExecuteFormulaListener;
33
- private _applyTreeResult;
34
- private _applyResult;
35
33
  }
@@ -14,15 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Nullable } from '@univerjs/core';
17
+ import { AbsoluteRefType, Disposable } from '@univerjs/core';
17
18
  import type { IDirtyUnitDefinedNameMap, IExprTreeNode, ISuperTable } from '../../basics/common';
18
19
  import type { IFunctionNames } from '../../basics/function';
19
20
  import type { IDefinedNamesServiceParam } from '../../services/defined-names.service';
20
21
  import type { ISequenceArray, ISequenceNode } from '../utils/sequence';
21
- import { AbsoluteRefType, Disposable } from '@univerjs/core';
22
22
  import { FormulaAstLRU } from '../../basics/cache-lru';
23
23
  import { ErrorType } from '../../basics/error-type';
24
24
  import { LexerNode } from './lexer-node';
25
- export declare const FormulaLexerNodeCache: FormulaAstLRU<LexerNode>;
26
25
  export declare const FormulaSequenceNodeCache: FormulaAstLRU<(string | ISequenceNode)[]>;
27
26
  interface IInjectDefinedNameParam {
28
27
  unitId: Nullable<string>;
@@ -102,12 +101,11 @@ export declare class LexerTreeBuilder extends Disposable {
102
101
  private _minusSplitSequenceNode;
103
102
  private _pushSequenceNode;
104
103
  nodeMakerTest(formulaString: string): ErrorType.VALUE | (string | LexerNode)[] | undefined;
105
- treeBuilder(formulaString: string, transformSuffix?: boolean, injectDefinedNameParam?: IInjectDefinedNameParam): ErrorType.VALUE | LexerNode | (string | LexerNode)[] | undefined;
104
+ treeBuilder(formulaString: string, transformSuffix?: boolean, injectDefinedNameParam?: IInjectDefinedNameParam): ErrorType.VALUE | (string | LexerNode)[] | LexerNode | undefined;
106
105
  private _handleDefinedName;
107
106
  private _moveDefinedNameRefOffset;
108
107
  private _getHasSheetNameDefinedName;
109
108
  private _handleNestedDefinedName;
110
- private _simpleCheckDefinedName;
111
109
  private _checkDefinedNameDirty;
112
110
  private _suffixExpressionHandler;
113
111
  private _processSuffixExpressionRemain;
@@ -17,13 +17,17 @@ import type { Nullable } from '@univerjs/core';
17
17
  import { Disposable } from '@univerjs/core';
18
18
  import { IFormulaCurrentConfigService } from '../../services/current-data.service';
19
19
  import { IDefinedNamesService } from '../../services/defined-names.service';
20
+ import { FormulaCacheService } from '../../services/formula-cache.service';
20
21
  import { IFunctionService } from '../../services/function.service';
22
+ import { LexerNode } from './lexer-node';
21
23
  import { LexerTreeBuilder } from './lexer-tree-builder';
22
24
  export declare class Lexer extends Disposable {
23
25
  private readonly _definedNamesService;
24
26
  private readonly _lexerTreeBuilder;
25
27
  private readonly _formulaCurrentConfigService;
26
28
  private readonly _functionService;
27
- constructor(_definedNamesService: IDefinedNamesService, _lexerTreeBuilder: LexerTreeBuilder, _formulaCurrentConfigService: IFormulaCurrentConfigService, _functionService: IFunctionService);
28
- treeBuilder(formulaString: string, transformSuffix?: boolean, unitId?: Nullable<string>, refOffsetX?: number, refOffsetY?: number): import("../..").ErrorType.VALUE | import("./lexer-node").LexerNode | (string | import("./lexer-node").LexerNode)[] | undefined;
29
+ private readonly _cacheService;
30
+ constructor(_definedNamesService: IDefinedNamesService, _lexerTreeBuilder: LexerTreeBuilder, _formulaCurrentConfigService: IFormulaCurrentConfigService, _functionService: IFunctionService, _cacheService: FormulaCacheService);
31
+ treeBuilder(formulaString: string, transformSuffix?: boolean, unitId?: Nullable<string>, refOffsetX?: number, refOffsetY?: number): import("../..").ErrorType.VALUE | (string | LexerNode)[] | LexerNode | undefined;
32
+ private _isDefinedNameDirty;
29
33
  }
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { Nullable } from '@univerjs/core';
17
17
  import { Disposable } from '@univerjs/core';
18
+ import { FormulaCacheService } from '../../services/formula-cache.service';
18
19
  import { IFormulaRuntimeService } from '../../services/runtime.service';
19
20
  import { AstRootNodeFactory } from '../ast-node/ast-root-node';
20
21
  import { BaseAstNode } from '../ast-node/base-ast-node';
@@ -29,6 +30,7 @@ import { UnionNodeFactory } from '../ast-node/union-node';
29
30
  import { ValueNodeFactory } from '../ast-node/value-node';
30
31
  import { LexerNode } from './lexer-node';
31
32
  export declare class AstTreeBuilder extends Disposable {
33
+ readonly cacheService: FormulaCacheService;
32
34
  private readonly _runtimeService;
33
35
  private readonly _astRootNodeFactory;
34
36
  private readonly _functionNodeFactory;
@@ -41,7 +43,7 @@ export declare class AstTreeBuilder extends Disposable {
41
43
  private readonly _unionNodeFactory;
42
44
  private readonly _valueNodeFactory;
43
45
  private _astNodeFactoryList;
44
- constructor(_runtimeService: IFormulaRuntimeService, _astRootNodeFactory: AstRootNodeFactory, _functionNodeFactory: FunctionNodeFactory, _lambdaNodeFactory: LambdaNodeFactory, _lambdaParameterNodeFactory: LambdaParameterNodeFactory, _operatorNodeFactory: OperatorNodeFactory, _prefixNodeFactory: PrefixNodeFactory, _referenceNodeFactory: ReferenceNodeFactory, _suffixNodeFactory: SuffixNodeFactory, _unionNodeFactory: UnionNodeFactory, _valueNodeFactory: ValueNodeFactory);
46
+ constructor(cacheService: FormulaCacheService, _runtimeService: IFormulaRuntimeService, _astRootNodeFactory: AstRootNodeFactory, _functionNodeFactory: FunctionNodeFactory, _lambdaNodeFactory: LambdaNodeFactory, _lambdaParameterNodeFactory: LambdaParameterNodeFactory, _operatorNodeFactory: OperatorNodeFactory, _prefixNodeFactory: PrefixNodeFactory, _referenceNodeFactory: ReferenceNodeFactory, _suffixNodeFactory: SuffixNodeFactory, _unionNodeFactory: UnionNodeFactory, _valueNodeFactory: ValueNodeFactory);
45
47
  dispose(): void;
46
48
  parse(lexerNode: LexerNode): Nullable<BaseAstNode>;
47
49
  private _lambdaParameterHandler;
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { DateSystem, Injector } from '@univerjs/core';
16
17
  import type { BaseFunction } from '../../functions/base-function';
17
18
  import type { LexerNode } from '../analysis/lexer-node';
18
- import { DateSystem, Injector } from '@univerjs/core';
19
19
  import { AstNodePromiseType } from '../../basics/common';
20
20
  import { FormulaDataModel } from '../../models/formula-data.model';
21
21
  import { IFormulaCurrentConfigService } from '../../services/current-data.service';
@@ -40,6 +40,7 @@ export declare class FunctionNode extends BaseAstNode {
40
40
  execute(dateSystem?: DateSystem): void;
41
41
  private _collectVariants;
42
42
  private _getChildVariant;
43
+ isAffectedBySheetMetadata(sheetOrderChanged: boolean, sheetSizeChanged: boolean): boolean;
43
44
  isFunctionExecutorArgumentsIgnoreNumberPattern(): boolean;
44
45
  /**
45
46
  * If it contains an array formula, set the current cell to the cache and send itself as a ref outward
@@ -30,9 +30,6 @@ interface ITableReferenceDescriptor {
30
30
  tableName: string;
31
31
  columnStruct: string | undefined;
32
32
  }
33
- type ReferenceNodeCurrentConfigService = Pick<IFormulaCurrentConfigService, 'getArrayFormulaCellData' | 'getArrayFormulaRange' | 'getSheetNameMap' | 'getUnitData' | 'getUnitStylesData'>;
34
- type ReferenceNodeRuntimeService = Pick<IFormulaRuntimeService, 'markExternalReferenceUnavailable' | 'currentColumn' | 'currentRow' | 'currentSubUnitId' | 'currentUnitId' | 'getRuntimeArrayFormulaCellData' | 'getRuntimeFeatureCellData' | 'getUnitArrayFormula' | 'getUnitData'>;
35
- type ReferenceNodeSuperTableService = Pick<ISuperTableService, 'getTableMap' | 'getTableOptionMap'>;
36
33
  export declare class ReferenceNode extends BaseAstNode {
37
34
  private _currentConfigService;
38
35
  private _runtimeService;
@@ -44,7 +41,7 @@ export declare class ReferenceNode extends BaseAstNode {
44
41
  private _tableReference?;
45
42
  private _refOffsetX;
46
43
  private _refOffsetY;
47
- constructor(_currentConfigService: ReferenceNodeCurrentConfigService, _runtimeService: ReferenceNodeRuntimeService, operatorString: string, _referenceObjectType: ReferenceObjectType, _unitReferenceResolver: IFormulaUnitReferenceResolver, _superTableService: ReferenceNodeSuperTableService, _externalReferenceDataLoader: IFormulaExternalReferenceDataLoader, _isPrepareMerge?: boolean, _tableReference?: ITableReferenceDescriptor | undefined);
44
+ constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, operatorString: string, _referenceObjectType: ReferenceObjectType, _unitReferenceResolver: IFormulaUnitReferenceResolver, _superTableService: ISuperTableService, _externalReferenceDataLoader: IFormulaExternalReferenceDataLoader, _isPrepareMerge?: boolean, _tableReference?: ITableReferenceDescriptor | undefined);
48
45
  get nodeType(): NodeType;
49
46
  execute(): void;
50
47
  executeAsync(): Promise<AstNodePromiseType>;
@@ -21,12 +21,10 @@ import { BaseAstNodeFactory } from './base-ast-node-factory';
21
21
  import { NodeType } from './node-type';
22
22
  export declare class UnionNode extends BaseAstNode {
23
23
  private readonly _currentConfigService;
24
- constructor(operatorString: string, _currentConfigService: Pick<IFormulaCurrentConfigService, 'getSheetsInfo'>);
24
+ constructor(operatorString: string, _currentConfigService: IFormulaCurrentConfigService);
25
25
  get nodeType(): NodeType;
26
26
  execute(): void;
27
27
  private _createThreeDimensionalReference;
28
- private _normalizeSheetName;
29
- private _copyReferenceContext;
30
28
  private _unionFunction;
31
29
  }
32
30
  export declare class UnionNodeFactory extends BaseAstNodeFactory {
@@ -14,13 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IRange, IUnitRange, Nullable } from '@univerjs/core';
17
+ import { Disposable, IUniverInstanceService, RTree } from '@univerjs/core';
17
18
  import type { IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IOtherFormulaData, IUnitData } from '../../basics/common';
18
19
  import type { IFeatureCalculationManagerParam } from '../../services/feature-calculation-manager.service';
19
20
  import type { BaseAstNode } from '../ast-node/base-ast-node';
20
21
  import type { FunctionNode } from '../ast-node/function-node';
21
22
  import type { IExecuteAstNodeData } from '../utils/ast-node-tool';
22
23
  import type { IFormulaDependencyTree, IFormulaDependencyTreeFullJson, IFormulaDependencyTreeJson, IFormulaDependentsAndInRangeResults } from './dependency-tree';
23
- import { Disposable, IUniverInstanceService, RTree } from '@univerjs/core';
24
24
  import { IFormulaCurrentConfigService } from '../../services/current-data.service';
25
25
  import { IDependencyManagerService } from '../../services/dependency-manager.service';
26
26
  import { IFeatureCalculationManagerService } from '../../services/feature-calculation-manager.service';
@@ -33,6 +33,8 @@ import { Interpreter } from '../interpreter/interpreter';
33
33
  import { FormulaDependencyTree, FormulaDependencyTreeModel, FormulaDependencyTreeVirtual } from './dependency-tree';
34
34
  export declare function generateRandomDependencyTreeId(dependencyManagerService: IDependencyManagerService): number;
35
35
  export interface IFormulaDependencyGenerator {
36
+ /** Keep structural dirty information available when a calculation is interrupted. */
37
+ finishReferenceContext?(completed: boolean): void;
36
38
  generate(isCalculateTreeModel?: boolean): Promise<IFormulaDependencyTree[]>;
37
39
  getAllDependencyJson(): Promise<IFormulaDependencyTreeJson[]>;
38
40
  getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number): Promise<IFormulaDependencyTreeFullJson | undefined>;
@@ -40,7 +42,7 @@ export interface IFormulaDependencyGenerator {
40
42
  getInRangeFormulas(unitRanges: IUnitRange[]): Promise<IFormulaDependencyTreeJson[]>;
41
43
  getRangeDependentsAndInRangeFormulas(unitRanges: IUnitRange[]): Promise<IFormulaDependentsAndInRangeResults>;
42
44
  }
43
- export declare const IFormulaDependencyGenerator: import("@wendellhu/redi").IdentifierDecorator<IFormulaDependencyGenerator>;
45
+ export declare const IFormulaDependencyGenerator: import("@univerjs/core").IdentifierDecorator<IFormulaDependencyGenerator>;
44
46
  export declare class FormulaDependencyGenerator extends Disposable implements IFormulaDependencyGenerator {
45
47
  protected readonly _currentConfigService: IFormulaCurrentConfigService;
46
48
  protected readonly _runtimeService: IFormulaRuntimeService;
@@ -55,6 +57,9 @@ export declare class FormulaDependencyGenerator extends Disposable implements IF
55
57
  private _updateRangeFlattenCache;
56
58
  protected _dependencyRTreeCacheForAddressFunction: RTree;
57
59
  protected _dependencyTreeCache: Map<number, IFormulaDependencyTree>;
60
+ private _reusableRanges;
61
+ private readonly _referenceContext;
62
+ private _reusableSheetSignature;
58
63
  constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _otherFormulaManagerService: IOtherFormulaManagerService, _featureCalculationManagerService: IFeatureCalculationManagerService, _univerInstanceService: IUniverInstanceService, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder, _lexer: Lexer, _dependencyManagerService: IDependencyManagerService, _lexerTreeBuilder: LexerTreeBuilder);
59
64
  dispose(): void;
60
65
  private _initUnitDispose;
@@ -71,7 +76,7 @@ export declare class FormulaDependencyGenerator extends Disposable implements IF
71
76
  */
72
77
  protected _getUpdateTreeListAndMakeDependency(): IFormulaDependencyTree[];
73
78
  protected _getTreeById(treeId: number): IFormulaDependencyTree | undefined;
74
- protected _getTreeNode(tree: IFormulaDependencyTree): import("../ast-node").AstRootNode;
79
+ protected _getTreeNode(tree: Pick<IFormulaDependencyTree, 'unitId' | 'subUnitId' | 'formula' | 'row' | 'column'>): import("../ast-node").AstRootNode;
75
80
  private _traverse;
76
81
  protected _calculateRunList(treeList: IFormulaDependencyTree[]): (FormulaDependencyTree | FormulaDependencyTreeVirtual)[];
77
82
  protected _getAllTreeList(): Promise<IFormulaDependencyTree[]>;
@@ -86,6 +91,22 @@ export declare class FormulaDependencyGenerator extends Disposable implements IF
86
91
  */
87
92
  protected _convertDirtyRangesToUnitRange(dirtyRanges: IFeatureDirtyRangeType): IUnitRange[];
88
93
  private _isCyclicUtil;
94
+ /**
95
+ * Whether the ranges resolved for this formula may be kept for a later calculation. This
96
+ * is independent of whether they may be reused right now: a forced calculation rebuilds
97
+ * the index but the ranges it resolves are still valid for the next one.
98
+ */
99
+ private _canShareRanges;
100
+ /**
101
+ * `A:A` and other open-ended references are clipped to the size of the sheet they point
102
+ * at, so any resize can change a resolved range list without touching the AST.
103
+ */
104
+ private _getSheetSignature;
105
+ private _takeReusableRanges;
106
+ private _storeReusableRanges;
107
+ finishReferenceContext(completed: boolean): void;
108
+ protected _updateReferenceContext(unitData: IUnitData): boolean;
109
+ protected _isReferenceContextAffected(tree: Pick<IFormulaDependencyTree, 'unitId' | 'subUnitId' | 'formula' | 'row' | 'column' | 'rowCount' | 'columnCount' | 'refOffsetX' | 'refOffsetY'>, node?: BaseAstNode): boolean;
89
110
  /**
90
111
  * Generate nodes for the dependency tree, where each node contains all the reference data ranges included in each formula.
91
112
  * @param formulaData
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IUnitData } from '../../basics/common';
17
+ import type { BaseAstNode } from '../ast-node/base-ast-node';
18
+ /** Retains sheet metadata only; formulas and dependency ranges stay in the existing caches. */
19
+ export declare class ReferenceContext {
20
+ private _stable;
21
+ private _previous;
22
+ private _current;
23
+ private _orderChanged;
24
+ private _changed;
25
+ update(unitData: IUnitData, getSheetsInfo: (unitId: string) => {
26
+ sheetOrder: string[];
27
+ sheetNameMap: Record<string, string>;
28
+ } | undefined): boolean;
29
+ finish(completed: boolean): void;
30
+ isSheetSizeChanged(unitId: string, sheetId: string): boolean;
31
+ isAffected(node: BaseAstNode, unitId: string, sheetId: string, offsetX?: number, offsetY?: number): boolean;
32
+ private _resolveStaticReference;
33
+ }
@@ -14,17 +14,19 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ICellData, IRange, IUnitRange, Nullable } from '@univerjs/core';
17
- import { DateSystem, ObjectMatrix } from '@univerjs/core';
18
17
  import type { IArrayFormulaRangeType, IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap, IUnitStylesData } from '../../basics/common';
18
+ import type { FormulaCalculationCache } from '../../services/formula-cache.service';
19
19
  import type { BaseValueObject } from '../value-object/base-value-object';
20
- import { FormulaAstLRU } from '../../basics/cache-lru';
20
+ import { DateSystem, ObjectMatrix } from '@univerjs/core';
21
21
  import { ObjectClassType } from '../../basics/object-class-type';
22
22
  import { ArrayValueObject } from '../value-object/array-value-object';
23
23
  export type NodeValueType = BaseValueObject | BaseReferenceObject | AsyncObject | AsyncArrayObject;
24
24
  export type FunctionVariantType = BaseValueObject | BaseReferenceObject;
25
- export declare const FORMULA_REF_TO_ARRAY_CACHE: FormulaAstLRU<ArrayValueObject>;
26
25
  export declare class BaseReferenceObject extends ObjectClassType {
27
26
  private _token;
27
+ private _calculationCache;
28
+ setCalculationCache(cache: FormulaCalculationCache | undefined): void;
29
+ getCalculationCache(): FormulaCalculationCache | undefined;
28
30
  private _dateSystem;
29
31
  private _forcedSheetId;
30
32
  private _forcedSheetName;
@@ -18,5 +18,5 @@ import { BaseReferenceObject } from './base-reference-object';
18
18
  export declare class ColumnReferenceObject extends BaseReferenceObject {
19
19
  constructor(token: string);
20
20
  isColumn(): boolean;
21
- unionBy(referenceObject: BaseReferenceObject): ErrorValueObject | this;
21
+ unionBy(referenceObject: BaseReferenceObject): this | ErrorValueObject;
22
22
  }
@@ -18,5 +18,5 @@ import { BaseReferenceObject } from './base-reference-object';
18
18
  export declare class RowReferenceObject extends BaseReferenceObject {
19
19
  constructor(token: string);
20
20
  isRow(): boolean;
21
- unionBy(referenceObject: BaseReferenceObject): ErrorValueObject | this;
21
+ unionBy(referenceObject: BaseReferenceObject): this | ErrorValueObject;
22
22
  }
@@ -20,34 +20,34 @@ export declare function checkVariantsErrorIsArray(...variants: BaseValueObject[]
20
20
  errorObject: BaseValueObject;
21
21
  variants?: undefined;
22
22
  } | {
23
+ errorObject?: undefined;
23
24
  isError: boolean;
24
25
  variants: BaseValueObject[];
25
- errorObject?: undefined;
26
26
  };
27
27
  export declare function checkVariantsErrorIsArrayOrBoolean(...variants: BaseValueObject[]): {
28
28
  isError: boolean;
29
29
  errorObject: BaseValueObject;
30
30
  variants?: undefined;
31
31
  } | {
32
+ errorObject?: undefined;
32
33
  isError: boolean;
33
34
  variants: BaseValueObject[];
34
- errorObject?: undefined;
35
35
  };
36
36
  export declare function checkVariantsErrorIsNullorArrayOrBoolean(...variants: BaseValueObject[]): {
37
37
  isError: boolean;
38
38
  errorObject: BaseValueObject;
39
39
  variants?: undefined;
40
40
  } | {
41
+ errorObject?: undefined;
41
42
  isError: boolean;
42
43
  variants: BaseValueObject[];
43
- errorObject?: undefined;
44
44
  };
45
45
  export declare function checkVariantsErrorIsStringToNumber(...variants: BaseValueObject[]): {
46
46
  isError: boolean;
47
47
  errorObject: BaseValueObject;
48
48
  variants?: undefined;
49
49
  } | {
50
+ errorObject?: undefined;
50
51
  isError: boolean;
51
52
  variants: BaseValueObject[];
52
- errorObject?: undefined;
53
53
  };
@@ -19,7 +19,5 @@ import type { Lexer } from '../analysis/lexer';
19
19
  import type { AstTreeBuilder } from '../analysis/parser';
20
20
  import type { AstRootNode } from '../ast-node/ast-root-node';
21
21
  import type { IFormulaDependencyTree } from '../dependency/dependency-tree';
22
- import { FormulaAstLRU } from '../../basics/cache-lru';
23
- export declare const FORMULA_AST_CACHE: FormulaAstLRU<AstRootNode>;
24
22
  export declare function generateAstNode(unitId: string, formulaString: string, lexer: Lexer, astTreeBuilder: AstTreeBuilder, currentConfigService: IFormulaCurrentConfigService, subUnitId?: string, definedNameRefOffsetX?: number, definedNameRefOffsetY?: number): AstRootNode;
25
23
  export declare function includeDefinedName(tree: IFormulaDependencyTree, node: Nullable<AstRootNode>, currentConfigService: IFormulaCurrentConfigService): boolean;
@@ -86,8 +86,8 @@ export declare function stringIsNumberPattern(input: string, options?: {
86
86
  value: number;
87
87
  pattern: string;
88
88
  } | {
89
- isNumberPattern: boolean;
90
89
  value?: undefined;
91
90
  pattern?: undefined;
91
+ isNumberPattern: boolean;
92
92
  };
93
93
  export declare function clearStringToNumberPatternCache(): void;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IFormulaCurrentConfigService } from '../../services/current-data.service';
17
+ import type { BaseReferenceObject } from '../reference-object/base-reference-object';
18
+ import { MultiAreaReferenceObject } from '../reference-object/multi-area-reference-object';
19
+ import { ErrorValueObject } from '../value-object/base-value-object';
20
+ export declare function expandSheetSpan(source: BaseReferenceObject, currentConfig: IFormulaCurrentConfigService): MultiAreaReferenceObject | ErrorValueObject | undefined;
21
+ export declare function createThreeDimensionalReference(firstSheetName: string, lastSheetName: string, source: BaseReferenceObject, sheetsInfo: ReturnType<IFormulaCurrentConfigService['getSheetsInfo']>): MultiAreaReferenceObject | undefined;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { Nullable } from '@univerjs/core';
17
17
  import { DateSystem } from '@univerjs/core';
18
+ import type { FormulaCalculationCache } from '../../services/formula-cache.service';
18
19
  import type { callbackMapFnType, IArrayValueObject } from './base-value-object';
19
20
  import { compareToken } from '../../basics/token';
20
21
  import { ArrayBinarySearchType, ArrayOrderSearchType } from '../utils/compare';
@@ -22,6 +23,9 @@ import { BaseValueObject } from './base-value-object';
22
23
  export declare function transformToValueObject(array?: Array<Array<number | string | boolean | null>>, isIgnoreNumberPattern?: boolean, dateSystem?: DateSystem): BaseValueObject[][];
23
24
  export declare function transformToValue(array?: Nullable<BaseValueObject>[][]): (string | number | boolean | null)[][];
24
25
  export declare class ArrayValueObject extends BaseValueObject {
26
+ private _calculationCache;
27
+ withCalculationCache(cache: FormulaCalculationCache | undefined): this;
28
+ getCalculationCache(): FormulaCalculationCache | undefined;
25
29
  /**
26
30
  * Create an array value object based on the string or IArrayValueObject data.
27
31
  * @param rawValue
@@ -13,16 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { BaseReferenceObject } from '../reference-object/base-reference-object';
16
17
  import type { ArrayValueObject } from './array-value-object';
17
18
  import { BaseValueObject } from './base-value-object';
18
19
  import { NumberValueObject } from './primitive-object';
19
20
  export declare class CubeValueObject extends BaseValueObject {
20
- static create(values: ArrayValueObject[]): CubeValueObject;
21
+ private _references?;
22
+ static create(values: ArrayValueObject[], references?: BaseReferenceObject[]): CubeValueObject;
21
23
  isCube(): boolean;
22
24
  private _values;
23
- constructor(values: ArrayValueObject[]);
25
+ constructor(values: ArrayValueObject[], _references?: BaseReferenceObject[] | undefined);
24
26
  dispose(): void;
25
27
  getCubeValues(): ArrayValueObject[];
28
+ getCubeReferences(): BaseReferenceObject[] | undefined;
26
29
  getCubeCount(): number;
27
30
  sum(): NumberValueObject;
28
31
  max(): NumberValueObject;
@@ -29,12 +29,12 @@ export declare class LambdaValueObjectObject extends BaseValueObject {
29
29
  constructor(_lambdaNode: Nullable<BaseAstNode>, _interpreter: Nullable<Interpreter>, _lambdaPrivacyVarKeys: string[]);
30
30
  dispose(): void;
31
31
  isLambda(): boolean;
32
- execute(...variants: FunctionVariantType[]): BaseValueObject | AsyncObject;
32
+ execute(...variants: FunctionVariantType[]): AsyncObject | BaseValueObject;
33
33
  /**
34
34
  * Execute custom lambda function, handle basic types
35
35
  * @param variants
36
36
  */
37
- executeCustom(...variants: PrimitiveValueType[]): BaseValueObject | AsyncObject;
37
+ executeCustom(...variants: PrimitiveValueType[]): AsyncObject | BaseValueObject;
38
38
  private _setLambdaNodeValue;
39
39
  private _setLambdaPrivacyValueMap;
40
40
  getLambdaPrivacyVarKeys(): string[];
@@ -15,4 +15,4 @@
15
15
  */
16
16
  import { Flatten } from './flatten';
17
17
  import { FUNCTION_NAMES_ARRAY } from './function-names';
18
- export declare const functionArray: (FUNCTION_NAMES_ARRAY | typeof Flatten)[][];
18
+ export declare const functionArray: (typeof Flatten | FUNCTION_NAMES_ARRAY)[][];
@@ -172,12 +172,12 @@ export declare class BaseFunction {
172
172
  equalSearch(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean): BaseValueObject;
173
173
  fuzzySearch(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean): BaseValueObject;
174
174
  orderSearch(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, keepFirstNearest?: boolean): BaseValueObject;
175
- binarySearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, axis?: number, searchType?: ArrayBinarySearchType, matchType?: ArrayOrderSearchType): ErrorValueObject | ArrayValueObject | undefined;
176
- equalSearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean, axis?: number): ErrorValueObject | ArrayValueObject | undefined;
177
- fuzzySearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean, axis?: number): ErrorValueObject | ArrayValueObject | undefined;
178
- orderSearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, axis?: number, keepFirstNearest?: boolean): ErrorValueObject | ArrayValueObject | undefined;
175
+ binarySearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, axis?: number, searchType?: ArrayBinarySearchType, matchType?: ArrayOrderSearchType): ArrayValueObject | ErrorValueObject | undefined;
176
+ equalSearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean, axis?: number): ArrayValueObject | ErrorValueObject | undefined;
177
+ fuzzySearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean, axis?: number): ArrayValueObject | ErrorValueObject | undefined;
178
+ orderSearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, axis?: number, keepFirstNearest?: boolean): ArrayValueObject | ErrorValueObject | undefined;
179
179
  flattenArray(variants: BaseValueObject[], ignoreLogicalValuesAndText?: boolean): ArrayValueObject | BaseValueObject;
180
180
  private _includingLogicalValuesAndText;
181
- createReferenceObject(reference: BaseReferenceObject, range: IRange): ErrorValueObject | BaseReferenceObject;
181
+ createReferenceObject(reference: BaseReferenceObject, range: IRange): BaseReferenceObject | ErrorValueObject;
182
182
  private _setReferenceDefault;
183
183
  }
@@ -13,6 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { StdevS } from '../statistical/stdev-s';
16
+ import { StdevP } from '../statistical/stdev-p';
17
17
  import { FUNCTION_NAMES_COMPATIBILITY } from './function-names';
18
- export declare const functionCompatibility: (FUNCTION_NAMES_COMPATIBILITY | typeof StdevS)[][];
18
+ export declare const functionCompatibility: (typeof StdevP | FUNCTION_NAMES_COMPATIBILITY)[][];