@univerjs/engine-formula 0.1.16 → 0.2.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 (78) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +4972 -4258
  3. package/lib/types/basics/date.d.ts +12 -0
  4. package/lib/types/basics/regex.d.ts +5 -5
  5. package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +3 -1
  6. package/lib/types/engine/analysis/__tests__/create-command-test-bed.d.ts +6 -6
  7. package/lib/types/engine/analysis/lexer-node.d.ts +1 -5
  8. package/lib/types/engine/ast-node/function-node.d.ts +1 -0
  9. package/lib/types/engine/dependency/dependency-tree.d.ts +1 -0
  10. package/lib/types/engine/reference-object/base-reference-object.d.ts +6 -6
  11. package/lib/types/engine/utils/math-kit.d.ts +6 -0
  12. package/lib/types/engine/utils/value-object.d.ts +27 -0
  13. package/lib/types/engine/value-object/primitive-object.d.ts +4 -2
  14. package/lib/types/functions/__tests__/create-function-test-bed.d.ts +6 -6
  15. package/lib/types/functions/date/datevalue/__tests__/index.spec.d.ts +16 -0
  16. package/lib/types/functions/date/datevalue/index.d.ts +9 -0
  17. package/lib/types/functions/date/now/__tests__/index.spec.d.ts +16 -0
  18. package/lib/types/functions/date/now/index.d.ts +8 -0
  19. package/lib/types/functions/date/time/__tests__/index.spec.d.ts +16 -0
  20. package/lib/types/functions/date/time/index.d.ts +9 -0
  21. package/lib/types/functions/date/timevalue/__tests__/index.spec.d.ts +16 -0
  22. package/lib/types/functions/date/timevalue/index.d.ts +9 -0
  23. package/lib/types/functions/date/today/index.d.ts +1 -2
  24. package/lib/types/functions/information/isref/index.d.ts +2 -2
  25. package/lib/types/functions/lookup/address/index.d.ts +2 -2
  26. package/lib/types/functions/lookup/choose/__tests__/index.spec.d.ts +16 -0
  27. package/lib/types/functions/lookup/choose/index.d.ts +10 -0
  28. package/lib/types/functions/lookup/function-map.d.ts +3 -3
  29. package/lib/types/functions/lookup/offset/index.d.ts +1 -0
  30. package/lib/types/functions/math/asin/__tests__/index.spec.d.ts +16 -0
  31. package/lib/types/functions/math/asin/index.d.ts +8 -0
  32. package/lib/types/functions/math/asinh/__tests__/index.spec.d.ts +16 -0
  33. package/lib/types/functions/math/asinh/index.d.ts +8 -0
  34. package/lib/types/functions/math/atan/__tests__/index.spec.d.ts +16 -0
  35. package/lib/types/functions/math/atan/index.d.ts +8 -0
  36. package/lib/types/functions/math/atan2/__tests__/index.spec.d.ts +16 -0
  37. package/lib/types/functions/math/atan2/index.d.ts +8 -0
  38. package/lib/types/functions/math/atanh/__tests__/index.spec.d.ts +16 -0
  39. package/lib/types/functions/math/atanh/index.d.ts +8 -0
  40. package/lib/types/functions/math/cos/__tests__/index.spec.d.ts +16 -0
  41. package/lib/types/functions/math/cos/index.d.ts +8 -0
  42. package/lib/types/functions/math/sumifs/index.d.ts +3 -2
  43. package/lib/types/functions/math/tan/__tests__/index.spec.d.ts +16 -0
  44. package/lib/types/functions/math/tan/index.d.ts +8 -0
  45. package/lib/types/functions/math/tanh/__tests__/index.spec.d.ts +16 -0
  46. package/lib/types/functions/math/tanh/index.d.ts +8 -0
  47. package/lib/types/functions/meta/compare/__tests__/index.spec.d.ts +16 -0
  48. package/lib/types/functions/statistical/avedev/__tests__/index.spec.d.ts +16 -0
  49. package/lib/types/functions/statistical/avedev/index.d.ts +8 -0
  50. package/lib/types/functions/statistical/averagea/__tests__/index.spec.d.ts +16 -0
  51. package/lib/types/functions/statistical/averagea/index.d.ts +8 -0
  52. package/lib/types/functions/statistical/averageif/__tests__/index.spec.d.ts +16 -0
  53. package/lib/types/functions/statistical/averageif/index.d.ts +18 -0
  54. package/lib/types/functions/statistical/averageifs/__tests__/index.spec.d.ts +16 -0
  55. package/lib/types/functions/statistical/averageifs/index.d.ts +10 -0
  56. package/lib/types/functions/statistical/countblank/__tests__/index.spec.d.ts +16 -0
  57. package/lib/types/functions/statistical/countblank/index.d.ts +8 -0
  58. package/lib/types/functions/statistical/countif/__tests__/index.spec.d.ts +16 -0
  59. package/lib/types/functions/statistical/countif/index.d.ts +10 -0
  60. package/lib/types/functions/statistical/countifs/__tests__/index.spec.d.ts +16 -0
  61. package/lib/types/functions/statistical/countifs/index.d.ts +12 -0
  62. package/lib/types/functions/statistical/function-map.d.ts +2 -1
  63. package/lib/types/functions/statistical/maxa/__tests__/index.spec.d.ts +16 -0
  64. package/lib/types/functions/statistical/maxa/index.d.ts +9 -0
  65. package/lib/types/functions/statistical/maxifs/index.d.ts +1 -0
  66. package/lib/types/functions/statistical/mina/__tests__/index.spec.d.ts +16 -0
  67. package/lib/types/functions/statistical/mina/index.d.ts +9 -0
  68. package/lib/types/functions/statistical/minifs/__tests__/index.spec.d.ts +16 -0
  69. package/lib/types/functions/statistical/minifs/index.d.ts +10 -0
  70. package/lib/types/functions/text/concat/__tests__/index.spec.d.ts +16 -0
  71. package/lib/types/functions/text/concat/index.d.ts +9 -0
  72. package/lib/types/functions/text/function-map.d.ts +2 -1
  73. package/lib/types/index.d.ts +9 -9
  74. package/lib/types/models/__tests__/create-command-test-bed.d.ts +6 -6
  75. package/lib/types/services/dependency-manager.service.d.ts +2 -2
  76. package/lib/types/services/runtime.service.d.ts +5 -0
  77. package/lib/umd/index.js +1 -1
  78. package/package.json +10 -10
@@ -14,6 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare const DEFAULT_DATE_FORMAT = "yyyy/mm/dd;@";
17
+ export declare const DEFAULT_NOW_FORMAT = "yyyy/mm/dd hh:mm";
18
+ export declare const DEFAULT_TIME_FORMAT = "h:mm A/P";
17
19
  /**
18
20
  * Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.
19
21
  *
@@ -26,6 +28,12 @@ export declare const DEFAULT_DATE_FORMAT = "yyyy/mm/dd;@";
26
28
  * @returns
27
29
  */
28
30
  export declare function excelDateSerial(date: Date): number;
31
+ /**
32
+ * Time serial number with date
33
+ * @param date
34
+ * @returns
35
+ */
36
+ export declare function excelDateTimeSerial(date: Date): number;
29
37
  export declare function excelSerialToDate(serial: number): Date;
30
38
  export declare function formatDateDefault(date: Date): string;
31
39
  /**
@@ -36,3 +44,7 @@ export declare function formatDateDefault(date: Date): string;
36
44
  * @returns
37
45
  */
38
46
  export declare function isValidDateStr(dateStr: string): boolean;
47
+ export declare function parseFormattedDate(value: string): any;
48
+ export declare function parseFormattedValue(value: string): any;
49
+ export declare function parseFormattedTime(value: string): any;
50
+ export declare function isDate(format: string): any;
@@ -18,12 +18,12 @@ export declare const SHEET_NAME_REGEX = "((?![\\[\\]\\/?*\\\\]).)*!";
18
18
  export declare const ABSOLUTE_SYMBOL = "$";
19
19
  export declare const RANGE_SYMBOL = "\\s*?:\\s*?";
20
20
  export declare const UNIT_NAME_SHEET_NAME_REGEX = "'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?";
21
- export declare const SIMPLE_SINGLE_RANGE_REGEX = "\\$?[A-Za-z]+\\$?[0-9]+";
22
- export declare const REFERENCE_MULTIPLE_RANGE_REGEX = "^(@)?'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\$?[A-Za-z]+\\$?[0-9]+\\s*?:\\s*?\\$?[A-Za-z]+\\$?[0-9]+$";
23
- export declare const REFERENCE_SINGLE_RANGE_REGEX = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\s*?\\$?[A-Za-z]+\\$?[0-9]+(#)?$";
24
- export declare const REFERENCE_REGEX_ROW = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\$?[0-9]+\\s*?:\\s*?\\$?[0-9]+$";
21
+ export declare const SIMPLE_SINGLE_RANGE_REGEX = "\\$?[A-Za-z]+\\$?[1-9][0-9]*";
22
+ export declare const REFERENCE_MULTIPLE_RANGE_REGEX = "^(@)?'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\$?[A-Za-z]+\\$?[1-9][0-9]*\\s*?:\\s*?\\$?[A-Za-z]+\\$?[1-9][0-9]*$";
23
+ export declare const REFERENCE_SINGLE_RANGE_REGEX = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\s*?\\$?[A-Za-z]+\\$?[1-9][0-9]*(#)?$";
24
+ export declare const REFERENCE_REGEX_ROW = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\$?[1-9][0-9]*\\s*?:\\s*?\\$?[1-9][0-9]*$";
25
25
  export declare const REFERENCE_REGEX_COLUMN = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\$?[A-Za-z]+\\s*?:\\s*?\\$?[A-Za-z]+$";
26
- export declare const REFERENCE_REGEX_SINGLE_ROW = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\s*?\\$?[0-9]+$";
26
+ export declare const REFERENCE_REGEX_SINGLE_ROW = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\s*?\\$?[1-9][0-9]*$";
27
27
  export declare const REFERENCE_REGEX_SINGLE_COLUMN = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\s*?\\$?[A-Za-z]+$";
28
28
  export declare const REFERENCE_TABLE_ALL_COLUMN_REGEX = "^(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+$";
29
29
  export declare const REFERENCE_TABLE_SINGLE_COLUMN_REGEX = "^(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[((?<!#).)*\\]|\\[\\[#.+\\]\\s*?,\\s*?\\[((?<!#).)*\\]\\])+$";
@@ -2,12 +2,14 @@ import { IExecutionOptions, IMutation, IUnitRange, Nullable } from '@univerjs/co
2
2
  import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IRuntimeOtherUnitDataType, IRuntimeUnitDataPrimitiveType } from '../../basics/common';
3
3
  import { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
4
4
 
5
- export interface ISetFormulaCalculationStartMutation {
5
+ export interface IFormulaDirtyData {
6
6
  dirtyRanges: IUnitRange[];
7
7
  dirtyNameMap: IDirtyUnitSheetNameMap;
8
8
  dirtyDefinedNameMap: IDirtyUnitSheetDefinedNameMap;
9
9
  dirtyUnitFeatureMap: IDirtyUnitFeatureMap;
10
10
  dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap;
11
+ }
12
+ export interface ISetFormulaCalculationStartMutation extends IFormulaDirtyData {
11
13
  options: Nullable<IExecutionOptions>;
12
14
  forceCalculation?: boolean;
13
15
  }
@@ -5,12 +5,12 @@ import { ISheetData } from '../../../basics/common';
5
5
  export declare function createCommandTestBed(workbookData?: IWorkbookData, dependencies?: Dependency[]): {
6
6
  univer: Univer;
7
7
  get: {
8
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp | undefined): T;
9
- <T_1>(id: import('@wendellhu/redi').DependencyIdentifier<T_1>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_1[];
10
- <T_2>(id: import('@wendellhu/redi').DependencyIdentifier<T_2>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_2 | null;
11
- <T_3>(id: import('@wendellhu/redi').DependencyIdentifier<T_3>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_3;
12
- <T_4>(id: import('@wendellhu/redi').DependencyIdentifier<T_4>, quantity?: import('@wendellhu/redi').Quantity | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_4 | T_4[] | null;
13
- <T_5>(id: import('@wendellhu/redi').DependencyIdentifier<T_5>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_5 | T_5[] | null;
8
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
9
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
10
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
11
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
12
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
13
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
14
14
  };
15
15
  sheet: Workbook;
16
16
  unitId: string;
@@ -1,14 +1,10 @@
1
- import { Nullable, Observable } from '@univerjs/core';
1
+ import { Nullable } from '@univerjs/core';
2
2
  import { LambdaPrivacyVarType } from '../ast-node/base-ast-node';
3
3
 
4
4
  interface LexerNodeJson {
5
5
  token: string;
6
6
  children: Array<LexerNodeJson | string>;
7
7
  }
8
- export interface UniverFormulaEngineObserver {
9
- onBeforeFormulaCalculateObservable: Observable<string>;
10
- onAfterFormulaLexerObservable: Observable<LexerNode>;
11
- }
12
8
  export declare class LexerNode {
13
9
  private _parent;
14
10
  private _token;
@@ -46,4 +46,5 @@ export declare class FunctionNodeFactory extends BaseAstNodeFactory {
46
46
  get zIndex(): number;
47
47
  create(token: string): BaseAstNode;
48
48
  checkAndCreateNodeType(param: LexerNode | string): BaseAstNode | undefined;
49
+ private _isParentUnionNode;
49
50
  }
@@ -35,6 +35,7 @@ export declare class FormulaDependencyTree extends Disposable {
35
35
  }>;
36
36
  private _state;
37
37
  dispose(): void;
38
+ disposeWithChildren(): void;
38
39
  resetState(): void;
39
40
  setAdded(): void;
40
41
  isAdded(): boolean;
@@ -4,7 +4,7 @@ import { IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap, IUnitStylesData } f
4
4
  import { ObjectClassType } from '../../basics/object-class-type';
5
5
  import { ArrayValueObject } from '../value-object/array-value-object';
6
6
  import { BaseValueObject, ErrorValueObject } from '../value-object/base-value-object';
7
- import { NullValueObject, NumberValueObject } from '../value-object/primitive-object';
7
+ import { NullValueObject, NumberValueObject, StringValueObject } from '../value-object/primitive-object';
8
8
 
9
9
  export type NodeValueType = BaseValueObject | BaseReferenceObject | AsyncObject | AsyncArrayObject;
10
10
  export type FunctionVariantType = BaseValueObject | BaseReferenceObject;
@@ -43,7 +43,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
43
43
  };
44
44
  isReferenceObject(): boolean;
45
45
  iterator(callback: (valueObject: Nullable<BaseValueObject>, rowIndex: number, columnIndex: number) => Nullable<boolean>): Nullable<boolean>;
46
- getFirstCell(): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | import('../value-object/primitive-object').StringValueObject | ArrayValueObject;
46
+ getFirstCell(): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
47
47
  getRangeData(): IRange;
48
48
  setRangeData(range: IRange): void;
49
49
  getUnitId(): string;
@@ -88,9 +88,9 @@ export declare class BaseReferenceObject extends ObjectClassType {
88
88
  isTable(): boolean;
89
89
  unionBy(referenceObject: BaseReferenceObject): NodeValueType;
90
90
  unionRange(rangeData1: IRange, rangeData2: IRange): IRange;
91
- getCellValueObject(cell: ICellData): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | import('../value-object/primitive-object').StringValueObject | ArrayValueObject;
92
- getCellByRow(row: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | import('../value-object/primitive-object').StringValueObject | ArrayValueObject;
93
- getCellByColumn(column: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | import('../value-object/primitive-object').StringValueObject | ArrayValueObject;
91
+ getCellValueObject(cell: ICellData): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
92
+ getCellByRow(row: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
93
+ getCellByColumn(column: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
94
94
  getCurrentActiveSheetData(): import('../../basics/common').ISheetItem;
95
95
  getCurrentStylesData(): import('@univerjs/core').Styles;
96
96
  getCurrentRuntimeSheetData(): import('@univerjs/core').ObjectMatrix<Nullable<ICellData>> | undefined;
@@ -98,7 +98,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
98
98
  getCurrentRuntimeActiveArrayFormulaCellData(): import('@univerjs/core').ObjectMatrix<Nullable<ICellData>> | undefined;
99
99
  getCellData(row: number, column: number): ICellData;
100
100
  getRuntimeFeatureCellValue(row: number, column: number): ICellData | undefined;
101
- getCellByPosition(row?: number, column?: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | import('../value-object/primitive-object').StringValueObject | ArrayValueObject;
101
+ getCellByPosition(row?: number, column?: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
102
102
  /**
103
103
  * Get the pattern of the cell
104
104
  * @param unitId
@@ -131,3 +131,9 @@ export declare function withinErrorMargin(left: number, right: number): boolean;
131
131
  * @returns
132
132
  */
133
133
  export declare function stripErrorMargin(num: number, precision?: number): number;
134
+ /**
135
+ * Get the fractional part of the number
136
+ * @param num
137
+ * @returns
138
+ */
139
+ export declare function getFractionalPart(num: number): number;
@@ -1,5 +1,6 @@
1
1
  import { ICellData, Nullable } from '@univerjs/core';
2
2
  import { FunctionVariantType } from '../reference-object/base-reference-object';
3
+ import { ArrayValueObject } from '../value-object/array-value-object';
3
4
  import { BaseValueObject } from '../value-object/base-value-object';
4
5
  import { NumberValueObject } from '../value-object/primitive-object';
5
6
 
@@ -11,3 +12,29 @@ export declare function isSingleValueObject(valueObject: FunctionVariantType): b
11
12
  * @returns
12
13
  */
13
14
  export declare function objectValueToCellValue(objectValue: Nullable<BaseValueObject>): ICellData | undefined;
15
+ /**
16
+ * The size of the extended range is determined by the maximum width and height of the criteria range.
17
+ * @param variants
18
+ * @returns
19
+ */
20
+ export declare function calculateMaxDimensions(variants: BaseValueObject[]): {
21
+ maxRowLength: number;
22
+ maxColumnLength: number;
23
+ };
24
+ export declare function getErrorArray(variants: BaseValueObject[], sumRange: BaseValueObject, maxRowLength: number, maxColumnLength: number): ArrayValueObject | null;
25
+ export declare function getBooleanResults(variants: BaseValueObject[], maxRowLength: number, maxColumnLength: number, isNumberSensitive?: boolean): BaseValueObject[][];
26
+ /**
27
+ * Two valueObjects of the same type can be compared
28
+ * @param array
29
+ * @param range
30
+ * @param criteria
31
+ * @returns
32
+ */
33
+ export declare function filterSameValueObjectResult(array: ArrayValueObject, range: ArrayValueObject, criteria: BaseValueObject): BaseValueObject;
34
+ /**
35
+ * Check if the two valueObjects are of the same type
36
+ * @param left
37
+ * @param right
38
+ * @returns
39
+ */
40
+ export declare function isSameValueObjectType(left: BaseValueObject, right: BaseValueObject): boolean;
@@ -60,9 +60,11 @@ export declare class BooleanValueObject extends BaseValueObject {
60
60
  divided(valueObject: BaseValueObject): BaseValueObject;
61
61
  mod(valueObject: BaseValueObject): BaseValueObject;
62
62
  compare(valueObject: BaseValueObject, operator: compareToken): BaseValueObject;
63
+ compareBy(value: string | number | boolean, operator: compareToken): BaseValueObject;
64
+ private _compareString;
63
65
  concatenateFront(valueObject: BaseValueObject): BaseValueObject;
64
66
  concatenateBack(valueObject: BaseValueObject): BaseValueObject;
65
- private _convertTonNumber;
67
+ private _convertToNumber;
66
68
  pow(valueObject: BaseValueObject): BaseValueObject;
67
69
  sqrt(): BaseValueObject;
68
70
  cbrt(): BaseValueObject;
@@ -90,7 +92,7 @@ export declare class BooleanValueObject extends BaseValueObject {
90
92
  export declare const NumberValueObjectCache: FormulaAstLRU<NumberValueObject>;
91
93
  export declare class NumberValueObject extends BaseValueObject {
92
94
  private _value;
93
- static create(value: number): NumberValueObject;
95
+ static create(value: number, pattern?: string): NumberValueObject;
94
96
  constructor(rawValue: number);
95
97
  getValue(): number;
96
98
  setValue(value: number): void;
@@ -6,12 +6,12 @@ import { FunctionVariantType } from '../../engine/reference-object/base-referenc
6
6
  export declare function createFunctionTestBed(workbookData?: IWorkbookData, dependencies?: Dependency[]): {
7
7
  univer: Univer;
8
8
  get: {
9
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp | undefined): T;
10
- <T_1>(id: import('@wendellhu/redi').DependencyIdentifier<T_1>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_1[];
11
- <T_2>(id: import('@wendellhu/redi').DependencyIdentifier<T_2>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_2 | null;
12
- <T_3>(id: import('@wendellhu/redi').DependencyIdentifier<T_3>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_3;
13
- <T_4>(id: import('@wendellhu/redi').DependencyIdentifier<T_4>, quantity?: import('@wendellhu/redi').Quantity | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_4 | T_4[] | null;
14
- <T_5>(id: import('@wendellhu/redi').DependencyIdentifier<T_5>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_5 | T_5[] | null;
9
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
10
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
11
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
12
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
13
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
14
+ <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
15
15
  };
16
16
  sheet: Workbook;
17
17
  unitId: string;
@@ -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,9 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class Datevalue extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(dateText: BaseValueObject): BaseValueObject;
8
+ private _handleSingleObject;
9
+ }
@@ -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 { NumberValueObject } from '../../../engine/value-object/primitive-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class Now extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(): 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,9 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class Time extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(hour: BaseValueObject, minute: BaseValueObject, second: BaseValueObject): BaseValueObject;
8
+ private _calculateTime;
9
+ }
@@ -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,9 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class Timevalue extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(timeText: BaseValueObject): BaseValueObject;
8
+ private _handleSingleObject;
9
+ }
@@ -1,9 +1,8 @@
1
- import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
1
  import { NumberValueObject } from '../../../engine/value-object/primitive-object';
3
2
  import { BaseFunction } from '../../base-function';
4
3
 
5
4
  export declare class Today extends BaseFunction {
6
5
  minParams: number;
7
6
  maxParams: number;
8
- calculate(value?: BaseValueObject): NumberValueObject;
7
+ calculate(): NumberValueObject;
9
8
  }
@@ -1,4 +1,4 @@
1
- import { BaseValueObject } from '../../../engine/value-object/base-value-object';
1
+ import { FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
2
2
  import { BooleanValueObject } from '../../../engine/value-object/primitive-object';
3
3
  import { BaseFunction } from '../../base-function';
4
4
 
@@ -6,5 +6,5 @@ export declare class Isref extends BaseFunction {
6
6
  minParams: number;
7
7
  maxParams: number;
8
8
  needsReferenceObject: boolean;
9
- calculate(value: BaseValueObject): BooleanValueObject;
9
+ calculate(value: FunctionVariantType): BooleanValueObject;
10
10
  }
@@ -1,9 +1,9 @@
1
1
  import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
- import { StringValueObject } from '../../../engine/value-object/primitive-object';
3
2
  import { BaseFunction } from '../../base-function';
4
3
 
5
4
  export declare class Address extends BaseFunction {
6
5
  minParams: number;
7
6
  maxParams: number;
8
- calculate(rowNumber: BaseValueObject, columnNumber: BaseValueObject, absNumber?: BaseValueObject, a1?: BaseValueObject, sheetText?: BaseValueObject): BaseValueObject | StringValueObject;
7
+ calculate(rowNumber: BaseValueObject, columnNumber: BaseValueObject, absNumber?: BaseValueObject, a1?: BaseValueObject, sheetText?: BaseValueObject): BaseValueObject;
8
+ private _calculateSingleCell;
9
9
  }
@@ -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 { FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class Choose extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ needsReferenceObject: boolean;
8
+ isAddress(): boolean;
9
+ calculate(indexNum: FunctionVariantType, ...variants: FunctionVariantType[]): FunctionVariantType;
10
+ }
@@ -1,13 +1,13 @@
1
1
  import { Address } from './address';
2
2
  import { Column } from './column';
3
3
  import { FUNCTION_NAMES_LOOKUP } from './function-names';
4
+ import { Hlookup } from './hlookup';
4
5
  import { Indirect } from './indirect';
5
6
  import { Lookup } from './lookup';
6
7
  import { Match } from './match';
7
- import { Offset } from './offset';
8
8
  import { Vlookup } from './vlookup';
9
9
  import { Xlookup } from './xlookup';
10
10
  import { Xmatch } from './xmatch';
11
- import { Index } from './index';
11
+ import { Choose } from './choose';
12
12
 
13
- export declare const functionLookup: ((FUNCTION_NAMES_LOOKUP | typeof Address)[] | (FUNCTION_NAMES_LOOKUP | typeof Column)[] | (FUNCTION_NAMES_LOOKUP | typeof Index)[] | (FUNCTION_NAMES_LOOKUP | typeof Indirect)[] | (FUNCTION_NAMES_LOOKUP | typeof Offset)[] | (FUNCTION_NAMES_LOOKUP | typeof Vlookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Lookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Match)[] | (FUNCTION_NAMES_LOOKUP | typeof Xlookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Xmatch)[])[];
13
+ export declare const functionLookup: ((FUNCTION_NAMES_LOOKUP | typeof Address)[] | (FUNCTION_NAMES_LOOKUP | typeof Choose)[] | (FUNCTION_NAMES_LOOKUP | typeof Column)[] | (FUNCTION_NAMES_LOOKUP | typeof Indirect)[] | (FUNCTION_NAMES_LOOKUP | typeof Vlookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Lookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Match)[] | (FUNCTION_NAMES_LOOKUP | typeof Hlookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Xlookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Xmatch)[])[];
@@ -5,6 +5,7 @@ export declare class Offset extends BaseFunction {
5
5
  minParams: number;
6
6
  maxParams: number;
7
7
  needsReferenceObject: boolean;
8
+ isAddress(): boolean;
8
9
  calculate(reference: FunctionVariantType, rows: FunctionVariantType, columns: FunctionVariantType, height?: FunctionVariantType, width?: FunctionVariantType): FunctionVariantType;
9
10
  private _handleSingleObject;
10
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
+
4
+ export declare class Asin extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(variant: BaseValueObject): BaseValueObject;
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
+
4
+ export declare class Asinh extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(variant: BaseValueObject): BaseValueObject;
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
+
4
+ export declare class Atan extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(variant: BaseValueObject): BaseValueObject;
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
+
4
+ export declare class Atan2 extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(xNum: BaseValueObject, yNum: BaseValueObject): BaseValueObject;
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
+
4
+ export declare class Atanh extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(variant: BaseValueObject): BaseValueObject;
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 {};