@univerjs/engine-formula 0.4.1 → 0.4.2

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 (116) hide show
  1. package/lib/cjs/index.js +2 -2
  2. package/lib/es/index.js +2865 -784
  3. package/lib/types/basics/database.d.ts +31 -0
  4. package/lib/types/basics/inverted-index-cache.d.ts +7 -18
  5. package/lib/types/basics/math.d.ts +12 -0
  6. package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +0 -1
  7. package/lib/types/controller/calculate.controller.d.ts +0 -1
  8. package/lib/types/controller/config.schema.d.ts +5 -1
  9. package/lib/types/engine/analysis/__tests__/dependency.spec.d.ts +16 -0
  10. package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -1
  11. package/lib/types/engine/ast-node/function-node.d.ts +2 -0
  12. package/lib/types/engine/ast-node/node-type.d.ts +13 -13
  13. package/lib/types/engine/dependency/dependency-tree.d.ts +14 -6
  14. package/lib/types/engine/reference-object/base-reference-object.d.ts +10 -0
  15. package/lib/types/engine/utils/char-kit.d.ts +5 -7
  16. package/lib/types/engine/utils/numfmt-kit.d.ts +13 -1
  17. package/lib/types/engine/utils/reference-cache.d.ts +3 -0
  18. package/lib/types/engine/utils/reference.d.ts +0 -2
  19. package/lib/types/engine/value-object/array-value-object.d.ts +1 -0
  20. package/lib/types/functions/base-function.d.ts +26 -1
  21. package/lib/types/functions/database/daverage/__tests__/index.spec.d.ts +16 -0
  22. package/lib/types/functions/database/daverage/index.d.ts +8 -0
  23. package/lib/types/functions/database/dcount/__tests__/index.spec.d.ts +16 -0
  24. package/lib/types/functions/database/dcount/index.d.ts +8 -0
  25. package/lib/types/functions/database/dcounta/__tests__/index.spec.d.ts +16 -0
  26. package/lib/types/functions/database/dcounta/index.d.ts +8 -0
  27. package/lib/types/functions/database/dget/__tests__/index.spec.d.ts +16 -0
  28. package/lib/types/functions/database/dget/index.d.ts +7 -0
  29. package/lib/types/functions/database/dmax/__tests__/index.spec.d.ts +16 -0
  30. package/lib/types/functions/database/dmax/index.d.ts +8 -0
  31. package/lib/types/functions/database/dmin/__tests__/index.spec.d.ts +16 -0
  32. package/lib/types/functions/database/dmin/index.d.ts +8 -0
  33. package/lib/types/functions/database/dproduct/__tests__/index.spec.d.ts +16 -0
  34. package/lib/types/functions/database/dproduct/index.d.ts +8 -0
  35. package/lib/types/functions/database/dstdev/__tests__/index.spec.d.ts +16 -0
  36. package/lib/types/functions/database/dstdev/index.d.ts +8 -0
  37. package/lib/types/functions/database/dstdevp/__tests__/index.spec.d.ts +16 -0
  38. package/lib/types/functions/database/dstdevp/index.d.ts +8 -0
  39. package/lib/types/functions/database/dsum/__tests__/index.spec.d.ts +16 -0
  40. package/lib/types/functions/database/dsum/index.d.ts +8 -0
  41. package/lib/types/functions/database/dvar/__tests__/index.spec.d.ts +16 -0
  42. package/lib/types/functions/database/dvar/index.d.ts +8 -0
  43. package/lib/types/functions/database/dvarp/__tests__/index.spec.d.ts +16 -0
  44. package/lib/types/functions/database/dvarp/index.d.ts +8 -0
  45. package/lib/types/functions/database/function-map.d.ts +3 -16
  46. package/lib/types/functions/financial/db/index.d.ts +1 -0
  47. package/lib/types/functions/financial/ddb/index.d.ts +1 -0
  48. package/lib/types/functions/financial/fv/index.d.ts +2 -1
  49. package/lib/types/functions/financial/ipmt/index.d.ts +2 -1
  50. package/lib/types/functions/financial/npv/index.d.ts +1 -0
  51. package/lib/types/functions/financial/pmt/index.d.ts +2 -1
  52. package/lib/types/functions/financial/ppmt/index.d.ts +2 -1
  53. package/lib/types/functions/financial/pv/index.d.ts +2 -1
  54. package/lib/types/functions/financial/sln/index.d.ts +1 -0
  55. package/lib/types/functions/financial/syd/index.d.ts +1 -0
  56. package/lib/types/functions/financial/tbillprice/index.d.ts +1 -0
  57. package/lib/types/functions/financial/vdb/index.d.ts +1 -0
  58. package/lib/types/functions/information/function-map.d.ts +1 -1
  59. package/lib/types/functions/information/sheet/__tests__/index.spec.d.ts +16 -0
  60. package/lib/types/functions/information/sheet/index.d.ts +10 -0
  61. package/lib/types/functions/information/sheets/__tests__/index.spec.d.ts +16 -0
  62. package/lib/types/functions/information/sheets/index.d.ts +8 -0
  63. package/lib/types/functions/lookup/xlookup/index.d.ts +1 -1
  64. package/lib/types/functions/math/arabic/__tests__/index.spec.d.ts +16 -0
  65. package/lib/types/functions/math/arabic/index.d.ts +8 -0
  66. package/lib/types/functions/math/roman/__tests__/index.spec.d.ts +16 -0
  67. package/lib/types/functions/math/roman/index.d.ts +9 -0
  68. package/lib/types/functions/math/sumif/index.d.ts +3 -1
  69. package/lib/types/functions/text/arraytotext/__test__/index.spec.d.ts +16 -0
  70. package/lib/types/functions/text/arraytotext/index.d.ts +9 -0
  71. package/lib/types/functions/text/asc/__test__/index.spec.d.ts +16 -0
  72. package/lib/types/functions/text/asc/index.d.ts +8 -0
  73. package/lib/types/functions/text/bahttext/__test__/index.spec.d.ts +16 -0
  74. package/lib/types/functions/text/bahttext/index.d.ts +9 -0
  75. package/lib/types/functions/text/char/__test__/index.spec.d.ts +16 -0
  76. package/lib/types/functions/text/char/index.d.ts +8 -0
  77. package/lib/types/functions/text/clean/__test__/index.spec.d.ts +16 -0
  78. package/lib/types/functions/text/clean/index.d.ts +8 -0
  79. package/lib/types/functions/text/code/__test__/index.spec.d.ts +16 -0
  80. package/lib/types/functions/text/code/index.d.ts +8 -0
  81. package/lib/types/functions/text/dbcs/__test__/index.spec.d.ts +16 -0
  82. package/lib/types/functions/text/dbcs/index.d.ts +8 -0
  83. package/lib/types/functions/text/dollar/__test__/index.spec.d.ts +16 -0
  84. package/lib/types/functions/text/dollar/index.d.ts +9 -0
  85. package/lib/types/functions/text/exact/__test__/index.spec.d.ts +16 -0
  86. package/lib/types/functions/text/exact/index.d.ts +8 -0
  87. package/lib/types/functions/text/fixed/__test__/index.spec.d.ts +16 -0
  88. package/lib/types/functions/text/fixed/index.d.ts +8 -0
  89. package/lib/types/functions/text/leftb/index.d.ts +1 -2
  90. package/lib/types/functions/text/numbervalue/__test__/index.spec.d.ts +16 -0
  91. package/lib/types/functions/text/numbervalue/index.d.ts +8 -0
  92. package/lib/types/functions/text/proper/__test__/index.spec.d.ts +16 -0
  93. package/lib/types/functions/text/proper/index.d.ts +8 -0
  94. package/lib/types/functions/text/right/__test__/index.spec.d.ts +16 -0
  95. package/lib/types/functions/text/right/index.d.ts +8 -0
  96. package/lib/types/functions/text/rightb/__test__/index.spec.d.ts +16 -0
  97. package/lib/types/functions/text/rightb/index.d.ts +8 -0
  98. package/lib/types/functions/text/substitute/__test__/index.spec.d.ts +16 -0
  99. package/lib/types/functions/text/substitute/index.d.ts +9 -0
  100. package/lib/types/functions/text/t/__test__/index.spec.d.ts +16 -0
  101. package/lib/types/functions/text/t/index.d.ts +7 -0
  102. package/lib/types/functions/text/unichar/__test__/index.spec.d.ts +16 -0
  103. package/lib/types/functions/text/unichar/index.d.ts +8 -0
  104. package/lib/types/functions/text/unicode/__test__/index.spec.d.ts +16 -0
  105. package/lib/types/functions/text/unicode/index.d.ts +8 -0
  106. package/lib/types/functions/text/value/__test__/index.spec.d.ts +16 -0
  107. package/lib/types/functions/text/value/index.d.ts +8 -0
  108. package/lib/types/functions/text/valuetotext/__test__/index.spec.d.ts +16 -0
  109. package/lib/types/functions/text/valuetotext/index.d.ts +8 -0
  110. package/lib/types/index.d.ts +2 -3
  111. package/lib/types/services/calculate-formula.service.d.ts +3 -4
  112. package/lib/types/services/current-data.service.d.ts +17 -2
  113. package/lib/types/services/dependency-manager.service.d.ts +17 -9
  114. package/lib/types/services/runtime.service.d.ts +10 -9
  115. package/lib/umd/index.js +2 -2
  116. package/package.json +5 -4
@@ -0,0 +1,31 @@
1
+ import { BaseValueObject, ErrorValueObject } from '../engine/value-object/base-value-object';
2
+ type DatabaseValueType = string | number | null;
3
+ export declare function checkDatabase(database: BaseValueObject): {
4
+ isError: boolean;
5
+ errorObject: ErrorValueObject;
6
+ databaseValues: DatabaseValueType[][];
7
+ } | {
8
+ isError: boolean;
9
+ errorObject: null;
10
+ databaseValues: DatabaseValueType[][];
11
+ };
12
+ export declare function checkField(field: BaseValueObject, database: DatabaseValueType[][]): {
13
+ isError: boolean;
14
+ errorObject: ErrorValueObject;
15
+ fieldIndex: number;
16
+ } | {
17
+ isError: boolean;
18
+ errorObject: null;
19
+ fieldIndex: number;
20
+ };
21
+ export declare function checkCriteria(criteria: BaseValueObject): {
22
+ isError: boolean;
23
+ errorObject: ErrorValueObject;
24
+ criteriaValues: DatabaseValueType[][];
25
+ } | {
26
+ isError: boolean;
27
+ errorObject: null;
28
+ criteriaValues: DatabaseValueType[][];
29
+ };
30
+ export declare function isCriteriaMatch(criteria: DatabaseValueType[][], database: DatabaseValueType[][], databaseRowIndex: number): boolean;
31
+ export {};
@@ -1,18 +1,4 @@
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
- */
1
+ import { NumericTuple } from '@flatten-js/interval-tree';
16
2
  export declare class InvertedIndexCache {
17
3
  /**
18
4
  * {
@@ -30,11 +16,14 @@ export declare class InvertedIndexCache {
30
16
  private _continueBuildingCache;
31
17
  set(unitId: string, sheetId: string, column: number, value: string | number | boolean | null, row: number): void;
32
18
  getCellValuePositions(unitId: string, sheetId: string, column: number): Map<string | number | boolean | null, Set<number>> | undefined;
33
- getCellPositions(unitId: string, sheetId: string, column: number, value: string | number | boolean): Set<number> | undefined;
34
- getCellPosition(unitId: string, sheetId: string, column: number, value: string | number | boolean, startRow: number, endRow: number): number | undefined;
19
+ getCellPositions(unitId: string, sheetId: string, column: number, value: string | number | boolean, rowsInCache: NumericTuple[]): number[] | undefined;
35
20
  setContinueBuildingCache(unitId: string, sheetId: string, column: number, startRow: number, endRow: number): void;
36
21
  shouldContinueBuildingCache(unitId: string, sheetId: string, column: number, row: number): boolean;
37
- canUseCache(unitId: string, sheetId: string, column: number, rangeStartRow: number, rangeEndRow: number): boolean;
22
+ canUseCache(unitId: string, sheetId: string, column: number, rangeStartRow: number, rangeEndRow: number): {
23
+ rowsInCache: NumericTuple[];
24
+ rowsNotInCache: NumericTuple[];
25
+ };
38
26
  clear(): void;
27
+ private _handleNewInterval;
39
28
  }
40
29
  export declare const CELL_INVERTED_INDEX_CACHE: InvertedIndexCache;
@@ -19,3 +19,15 @@ export declare function calculateGcd(a: number, b: number): number;
19
19
  export declare function calculateLcm(a: number, b: number): number;
20
20
  export declare function calculateMdeterm(matrix: number[][]): number;
21
21
  export declare function calculateMinverse(matrix: number[][]): number[][] | null;
22
+ export declare const romanToArabicMap: Map<string, number>;
23
+ export declare const arabicToRomanMap: Map<number, string>;
24
+ /**
25
+ * form: A number specifying the type of roman numeral you want.
26
+ * The roman numeral style ranges from Classic to Simplified, becoming more concise as the value of form increases
27
+ * 0 Classic
28
+ * 1 More concise
29
+ * 2 More concise
30
+ * 3 More concise
31
+ * 4 Simplified
32
+ */
33
+ export declare const romanFormArray: number[][];
@@ -4,7 +4,6 @@ import { IFormulaDirtyData } from '../../services/current-data.service';
4
4
  import { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
5
5
  export interface ISetFormulaCalculationStartMutation extends IFormulaDirtyData {
6
6
  options: Nullable<IExecutionOptions>;
7
- forceCalculation: boolean;
8
7
  }
9
8
  /**
10
9
  * TODO: @DR-Univer
@@ -10,6 +10,5 @@ export declare class CalculateController extends Disposable {
10
10
  private _commandExecutedListener;
11
11
  private _calculate;
12
12
  private _initialExecuteFormulaListener;
13
- private _initialExecuteFormulaProcessListener;
14
13
  private _applyResult;
15
14
  }
@@ -1,10 +1,14 @@
1
1
  import { Ctor } from '@univerjs/core';
2
- import { BaseFunction } from '../functions/base-function';
3
2
  import { IFunctionNames } from '../basics/function';
3
+ import { BaseFunction } from '../functions/base-function';
4
4
  export declare const PLUGIN_CONFIG_KEY = "engine-formula.config";
5
5
  export declare const configSymbol: unique symbol;
6
6
  export interface IUniverEngineFormulaConfig {
7
7
  notExecuteFormula?: boolean;
8
8
  function?: Array<[Ctor<BaseFunction>, IFunctionNames]>;
9
+ /**
10
+ * The formula calculation quantity interval for waiting for the main thread message in the worker. Each time the formula calculates the `intervalCount` quantity, it will receive a main thread message to support stopping the calculation. Default is 500
11
+ */
12
+ intervalCount?: number;
9
13
  }
10
14
  export declare const defaultPluginConfig: IUniverEngineFormulaConfig;
@@ -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 {};
@@ -7,7 +7,7 @@ import { NodeType } from './node-type';
7
7
  interface IAstNodeNodeJson {
8
8
  token: string;
9
9
  children?: IAstNodeNodeJson[];
10
- nodeType: string;
10
+ nodeType: number;
11
11
  }
12
12
  export type LambdaPrivacyVarType = Map<string, Nullable<BaseAstNode>>;
13
13
  export declare class BaseAstNode {
@@ -34,6 +34,8 @@ export declare class FunctionNode extends BaseAstNode {
34
34
  private _setDefinedNamesForFunction;
35
35
  private _setRefInfo;
36
36
  private _setRefData;
37
+ private _setLocale;
38
+ private _setSheetsInfo;
37
39
  }
38
40
  export declare class ErrorFunctionNode extends BaseAstNode {
39
41
  constructor(token?: string);
@@ -14,18 +14,18 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare enum NodeType {
17
- REFERENCE = "ReferenceNode",
18
- VALUE = "ValueNode",
19
- OPERATOR = "OperatorNode",
20
- FUNCTION = "FunctionNode",
21
- LAMBDA = "LambdaNode",
22
- LAMBDA_PARAMETER = "LambdaNodeParameter",
23
- ERROR = "ErrorNode",
24
- BASE = "Base",
25
- ROOT = "Root",
26
- UNION = "UnionNode",
27
- PREFIX = "PrefixNode",
28
- SUFFIX = "SuffixNode",
29
- NULL = "NullNode"
17
+ REFERENCE = 1,
18
+ VALUE = 2,
19
+ OPERATOR = 3,
20
+ FUNCTION = 4,
21
+ LAMBDA = 5,
22
+ LAMBDA_PARAMETER = 6,
23
+ ERROR = 7,
24
+ BASE = 8,
25
+ ROOT = 9,
26
+ UNION = 10,
27
+ PREFIX = 11,
28
+ SUFFIX = 12,
29
+ NULL = 13
30
30
  }
31
31
  export declare const NODE_ORDER_MAP: Map<NodeType, number>;
@@ -13,10 +13,10 @@ export declare enum FDtreeStateType {
13
13
  * is used to determine the order of formula calculations.
14
14
  */
15
15
  export declare class FormulaDependencyTree {
16
- treeId: string;
16
+ treeId: number;
17
17
  nodeData: Nullable<IExecuteAstNodeData>;
18
- children: Set<FormulaDependencyTree>;
19
- parents: Set<FormulaDependencyTree>;
18
+ children: Set<number>;
19
+ parents: Set<number>;
20
20
  formula: string;
21
21
  row: number;
22
22
  column: number;
@@ -28,14 +28,22 @@ export declare class FormulaDependencyTree {
28
28
  formulaId: Nullable<string>;
29
29
  featureId: Nullable<string>;
30
30
  isCache: boolean;
31
- constructor(treeId?: string);
31
+ constructor(treeId: number);
32
+ toJson(): {
33
+ formula: string;
34
+ row: number;
35
+ column: number;
36
+ subUnitId: string;
37
+ unitId: string;
38
+ formulaId: Nullable<string>;
39
+ featureId: Nullable<string>;
40
+ };
32
41
  getDirtyData: Nullable<(dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => {
33
42
  runtimeCellData: IRuntimeUnitDataType;
34
43
  dirtyRanges: IFeatureDirtyRangeType;
35
44
  }>;
36
45
  private _state;
37
46
  dispose(): void;
38
- disposeWithChildren(): void;
39
47
  resetState(): void;
40
48
  setAdded(): void;
41
49
  isAdded(): boolean;
@@ -50,7 +58,7 @@ export declare class FormulaDependencyTree {
50
58
  * @param range
51
59
  */
52
60
  pushRangeList(ranges: IUnitRange[]): void;
53
- hasChildren(tree: FormulaDependencyTree): boolean;
61
+ hasChildren(treeId: number): boolean;
54
62
  toRTreeItem(): IRTreeItem;
55
63
  /**
56
64
  * Determine whether it is dependent on other trees.
@@ -39,6 +39,11 @@ export declare class BaseReferenceObject extends ObjectClassType {
39
39
  endRow: number;
40
40
  startColumn: number;
41
41
  endColumn: number;
42
+ rangeType?: import('@univerjs/core').RANGE_TYPE;
43
+ startAbsoluteRefType?: import('@univerjs/core').AbsoluteRefType;
44
+ endAbsoluteRefType?: import('@univerjs/core').AbsoluteRefType;
45
+ unitId?: string;
46
+ sheetId?: string;
42
47
  };
43
48
  isReferenceObject(): boolean;
44
49
  iterator(callback: (valueObject: Nullable<BaseValueObject>, rowIndex: number, columnIndex: number) => Nullable<boolean>): Nullable<boolean>;
@@ -115,6 +120,11 @@ export declare class BaseReferenceObject extends ObjectClassType {
115
120
  endRow: number;
116
121
  startColumn: number;
117
122
  endColumn: number;
123
+ rangeType?: import('@univerjs/core').RANGE_TYPE;
124
+ startAbsoluteRefType?: import('@univerjs/core').AbsoluteRefType;
125
+ endAbsoluteRefType?: import('@univerjs/core').AbsoluteRefType;
126
+ unitId?: string;
127
+ sheetId?: string;
118
128
  };
119
129
  sheetId: string;
120
130
  unitId: string;
@@ -14,12 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /**
17
- * Korean in Excel does not count as two characters. Here we calculate all Chinese, Japanese and Korean characters as two characters.
17
+ * excel logic is cofusing, so we use google sheet logic
18
18
  *
19
- * ā -> 1
20
- * -> 2
21
- *
22
- * @param str
23
- * @returns
19
+ * @param text
20
+ * @returns number
24
21
  */
25
- export declare function charLenByte(str: string): number;
22
+ export declare function charLenByte(text: string): number;
23
+ export declare function getCharLenByteInText(text: string, charIndex: number, direction?: 'ltr' | 'rtl'): number;
@@ -1,4 +1,4 @@
1
- import { ICellData, Nullable, Styles } from '@univerjs/core';
1
+ import { ICellData, Nullable, Styles, LocaleType } from '@univerjs/core';
2
2
  import { operatorToken } from '../../basics/token';
3
3
  /**
4
4
  * Handling number formats in styles
@@ -61,3 +61,15 @@ export declare function clearNumberFormatTypeCache(): void;
61
61
  * @param nextPattern
62
62
  */
63
63
  export declare function comparePatternPriority(previousPattern: string, nextPattern: string, operator: operatorToken): string;
64
+ export declare function getCurrencyFormat(locale: LocaleType, numberDigits?: number): string;
65
+ export declare function applyCurrencyFormat(locale: LocaleType, number: number, numberDigits?: number): string;
66
+ export declare function stringIsNumberPattern(input: string): {
67
+ isNumberPattern: boolean;
68
+ value: number;
69
+ pattern: string;
70
+ } | {
71
+ isNumberPattern: boolean;
72
+ value?: undefined;
73
+ pattern?: undefined;
74
+ };
75
+ export declare function clearStringToNumberPatternCache(): void;
@@ -0,0 +1,3 @@
1
+ import { IUnitRangeName } from '@univerjs/core';
2
+ export declare function deserializeRangeWithSheetWithCache(refString: string): IUnitRangeName;
3
+ export declare function clearReferenceToRangeCache(): void;
@@ -43,8 +43,6 @@ export declare function handleRefStringInfo(refString: string): {
43
43
  unitId: string;
44
44
  };
45
45
  export declare function deserializeRangeWithSheet(refString: string): IUnitRangeName;
46
- export declare function deserializeRangeWithSheetWithCache(refString: string): IUnitRangeName;
47
- export declare function clearReferenceToRangeCache(): void;
48
46
  export declare function isReferenceStringWithEffectiveColumn(refString: string): boolean;
49
47
  export declare function replaceRefPrefixString(token: string): string;
50
48
  /**
@@ -219,6 +219,7 @@ export declare class ArrayValueObject extends BaseValueObject {
219
219
  private _transposeArray;
220
220
  private _batchOperator;
221
221
  private _batchOperatorValue;
222
+ private __batchOperatorRowValue;
222
223
  private _batchOperatorArray;
223
224
  private _checkArrayCalculateType;
224
225
  private _formatValue;
@@ -1,4 +1,4 @@
1
- import { IRange, Nullable } from '@univerjs/core';
1
+ import { IRange, LocaleType, Nullable } from '@univerjs/core';
2
2
  import { IFunctionNames } from '../basics/function';
3
3
  import { BaseReferenceObject, FunctionVariantType, NodeValueType } from '../engine/reference-object/base-reference-object';
4
4
  import { ArrayBinarySearchType, ArrayOrderSearchType } from '../engine/utils/compare';
@@ -13,6 +13,9 @@ export declare class BaseFunction {
13
13
  private _row;
14
14
  private _column;
15
15
  private _definedNames;
16
+ private _locale;
17
+ private _sheetOrder;
18
+ private _sheetNameMap;
16
19
  /**
17
20
  * Whether the function needs to expand the parameters
18
21
  */
@@ -21,6 +24,14 @@ export declare class BaseFunction {
21
24
  * Whether the function needs to pass in reference object
22
25
  */
23
26
  needsReferenceObject: boolean;
27
+ /**
28
+ * Whether the function needs handle locale
29
+ */
30
+ needsLocale: boolean;
31
+ /**
32
+ * Whether the function needs sheets info
33
+ */
34
+ needsSheetsInfo: boolean;
24
35
  /**
25
36
  * Minimum number of parameters
26
37
  */
@@ -44,6 +55,20 @@ export declare class BaseFunction {
44
55
  */
45
56
  getDefinedName(name: string): import('..').IDefinedNamesServiceParam | null;
46
57
  setDefinedNames(definedNames: IDefinedNameMapItem): void;
58
+ getLocale(): LocaleType;
59
+ setLocale(locale: LocaleType): void;
60
+ getSheetsInfo(): {
61
+ sheetOrder: string[];
62
+ sheetNameMap: {
63
+ [sheetId: string]: string;
64
+ };
65
+ };
66
+ setSheetsInfo({ sheetOrder, sheetNameMap, }: {
67
+ sheetOrder: string[];
68
+ sheetNameMap: {
69
+ [sheetId: string]: string;
70
+ };
71
+ }): void;
47
72
  isAsync(): boolean;
48
73
  isAddress(): boolean;
49
74
  isCustom(): boolean;
@@ -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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Daverage extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Dcount extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Dcounta extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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,7 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Dget extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): BaseValueObject;
7
+ }
@@ -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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Dmax extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Dmin extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Dproduct extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Dstdev extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+ export declare class Dstdevp extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(database: BaseValueObject, field: BaseValueObject, criteria: BaseValueObject): ErrorValueObject | NumberValueObject;
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 {};