@univerjs/engine-formula 0.1.8 → 0.1.10
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.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1019 -966
- package/lib/types/engine/value-object/primitive-object.d.ts +1 -1
- package/lib/types/functions/base-function.d.ts +8 -0
- package/lib/types/functions/math/sumif/index.d.ts +2 -0
- package/lib/types/models/formula-data.model.d.ts +5 -0
- package/lib/types/services/function.service.d.ts +3 -2
- package/lib/umd/index.js +1 -1
- package/package.json +4 -4
|
@@ -90,7 +90,7 @@ export declare class BooleanValueObject extends BaseValueObject {
|
|
|
90
90
|
export declare const NumberValueObjectCache: FormulaAstLRU<NumberValueObject>;
|
|
91
91
|
export declare class NumberValueObject extends BaseValueObject {
|
|
92
92
|
private _value;
|
|
93
|
-
static create(value: number
|
|
93
|
+
static create(value: number): NumberValueObject;
|
|
94
94
|
constructor(rawValue: number);
|
|
95
95
|
getValue(): number;
|
|
96
96
|
setValue(value: number): void;
|
|
@@ -22,6 +22,14 @@ export declare class BaseFunction extends Disposable {
|
|
|
22
22
|
* Whether the function needs to pass in reference object
|
|
23
23
|
*/
|
|
24
24
|
needsReferenceObject: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Minimum number of parameters
|
|
27
|
+
*/
|
|
28
|
+
minParams: number;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum number of parameters
|
|
31
|
+
*/
|
|
32
|
+
maxParams: number;
|
|
25
33
|
constructor(_name: IFunctionNames);
|
|
26
34
|
get name(): IFunctionNames;
|
|
27
35
|
get unitId(): Nullable<string>;
|
|
@@ -2,6 +2,8 @@ import { BaseFunction } from '../../base-function';
|
|
|
2
2
|
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
3
3
|
|
|
4
4
|
export declare class Sumif extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
5
7
|
calculate(range: BaseValueObject, criteria: BaseValueObject, sumRange?: BaseValueObject): BaseValueObject;
|
|
6
8
|
private _handleSingleObject;
|
|
7
9
|
}
|
|
@@ -25,6 +25,10 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
25
25
|
mergeArrayFormulaRange(formulaData: IArrayFormulaRangeType): void;
|
|
26
26
|
mergeFormulaData(formulaData: IFormulaData): void;
|
|
27
27
|
deleteArrayFormulaRange(unitId: string, sheetId: string, row: number, column: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Cache all formulas on the snapshot to the formula model
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
28
32
|
initFormulaData(): void;
|
|
29
33
|
getCalculateData(): {
|
|
30
34
|
allUnitData: IUnitData;
|
|
@@ -36,6 +40,7 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
36
40
|
getFormulaItemBySId(sId: string, sheetId: string, unitId: string): Nullable<IFormulaDataItem>;
|
|
37
41
|
getFormulaDataItem(row: number, column: number, sheetId: string, unitId: string): Nullable<IFormulaDataItem>;
|
|
38
42
|
getFormulaIdMap(unitId: string, sheetId: string): Map<string, IFormulaIdMap>;
|
|
43
|
+
getFormulaStringByCell(row: number, column: number, sheetId: string, unitId: string): string | null;
|
|
39
44
|
}
|
|
40
45
|
export declare function initSheetFormulaData(formulaData: IFormulaData, unitId: string, sheetId: string, cellMatrix: ObjectMatrix<Nullable<ICellData>>): {
|
|
41
46
|
[x: string]: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseFunction } from '../functions/base-function';
|
|
2
2
|
import { IFunctionInfo, IFunctionNames } from '../basics/function';
|
|
3
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
4
|
import { Nullable, Disposable } from '@univerjs/core';
|
|
4
5
|
|
|
5
6
|
export interface IFunctionService {
|
|
@@ -21,7 +22,7 @@ export interface IFunctionService {
|
|
|
21
22
|
getExecutor(functionToken: IFunctionNames): Nullable<BaseFunction>;
|
|
22
23
|
hasExecutor(functionToken: IFunctionNames): boolean;
|
|
23
24
|
unregisterExecutors(...functionTokens: IFunctionNames[]): void;
|
|
24
|
-
registerDescriptions(...functions: IFunctionInfo[]):
|
|
25
|
+
registerDescriptions(...functions: IFunctionInfo[]): IDisposable;
|
|
25
26
|
getDescriptions(): Map<IFunctionNames, IFunctionInfo>;
|
|
26
27
|
getDescription(functionToken: IFunctionNames): Nullable<IFunctionInfo>;
|
|
27
28
|
hasDescription(functionToken: IFunctionNames): boolean;
|
|
@@ -36,7 +37,7 @@ export declare class FunctionService extends Disposable implements IFunctionServ
|
|
|
36
37
|
getExecutor(functionToken: IFunctionNames): BaseFunction | undefined;
|
|
37
38
|
hasExecutor(functionToken: IFunctionNames): boolean;
|
|
38
39
|
unregisterExecutors(...functionTokens: IFunctionNames[]): void;
|
|
39
|
-
registerDescriptions(...descriptions: IFunctionInfo[]):
|
|
40
|
+
registerDescriptions(...descriptions: IFunctionInfo[]): IDisposable;
|
|
40
41
|
getDescriptions(): Map<IFunctionNames, IFunctionInfo>;
|
|
41
42
|
getDescription(functionToken: IFunctionNames): IFunctionInfo | undefined;
|
|
42
43
|
hasDescription(functionToken: IFunctionNames): boolean;
|