@univerjs/engine-formula 0.1.6 → 0.1.7
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 +2611 -2541
- package/lib/types/commands/mutations/set-array-formula-data.mutation.d.ts +3 -2
- package/lib/types/commands/mutations/set-defined-name.mutation.d.ts +1 -7
- package/lib/types/commands/mutations/set-formula-data.mutation.d.ts +3 -0
- package/lib/types/engine/value-object/array-value-object.d.ts +5 -0
- package/lib/types/functions/information/isref/index.d.ts +1 -1
- package/lib/types/functions/math/subtotal/index.d.ts +1 -1
- package/lib/types/functions/statistical/maxifs/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/maxifs/index.d.ts +7 -0
- package/lib/types/index.d.ts +4 -3
- package/lib/types/models/formula-data.model.d.ts +12 -7
- package/lib/types/models/utils/formula-data-util.d.ts +10 -0
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IArrayFormulaRangeType, IArrayFormulaUnitCellType } from '../../basics/common';
|
|
2
|
-
import { IAccessor } from '@wendellhu/redi';
|
|
3
2
|
import { IMutation } from '@univerjs/core';
|
|
4
3
|
|
|
5
4
|
export interface ISetArrayFormulaDataMutationParams {
|
|
6
5
|
arrayFormulaRange: IArrayFormulaRangeType;
|
|
7
6
|
arrayFormulaCellData: IArrayFormulaUnitCellType;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* There is no need to process data here, it is used as the main thread to send data to the worker. The main thread has already updated the data in advance, and there is no need to update it again here.
|
|
10
|
+
*/
|
|
10
11
|
export declare const SetArrayFormulaDataMutation: IMutation<ISetArrayFormulaDataMutationParams>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMutation
|
|
1
|
+
import { IMutation } from '@univerjs/core';
|
|
2
2
|
|
|
3
3
|
export interface ISetDefinedNameMutationSearchParam {
|
|
4
4
|
unitId: string;
|
|
@@ -17,9 +17,3 @@ export interface ISetDefinedNameMutationParam extends ISetDefinedNameMutationSea
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const SetDefinedNameMutation: IMutation<ISetDefinedNameMutationParam>;
|
|
19
19
|
export declare const RemoveDefinedNameMutation: IMutation<ISetDefinedNameMutationParam>;
|
|
20
|
-
export interface ISetDefinedNameCurrentMutationParam {
|
|
21
|
-
unitId: string;
|
|
22
|
-
sheetId: string;
|
|
23
|
-
range: IRange;
|
|
24
|
-
}
|
|
25
|
-
export declare const SetDefinedNameCurrentMutation: IMutation<ISetDefinedNameCurrentMutationParam>;
|
|
@@ -4,4 +4,7 @@ import { IMutation } from '@univerjs/core';
|
|
|
4
4
|
export interface ISetFormulaDataMutationParams {
|
|
5
5
|
formulaData: IFormulaData;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* There is no need to process data here, it is used as the main thread to send data to the worker. The main thread has already updated the data in advance, and there is no need to update it again here.
|
|
9
|
+
*/
|
|
7
10
|
export declare const SetFormulaDataMutation: IMutation<ISetFormulaDataMutationParams>;
|
|
@@ -18,6 +18,10 @@ export declare class ArrayValueObject extends BaseValueObject {
|
|
|
18
18
|
private _currentColumn;
|
|
19
19
|
private _sliceCache;
|
|
20
20
|
private _flattenCache;
|
|
21
|
+
/**
|
|
22
|
+
* The default value of the array, null values in comparison results support setting to false
|
|
23
|
+
*/
|
|
24
|
+
private _defaultValue;
|
|
21
25
|
private _flattenPosition;
|
|
22
26
|
constructor(rawValue: string | IArrayValueObject);
|
|
23
27
|
dispose(): void;
|
|
@@ -36,6 +40,7 @@ export declare class ArrayValueObject extends BaseValueObject {
|
|
|
36
40
|
getArrayValue(): Nullable<BaseValueObject>[][];
|
|
37
41
|
setArrayValue(value: BaseValueObject[][]): void;
|
|
38
42
|
isArray(): boolean;
|
|
43
|
+
setDefaultValue(value: Nullable<BaseValueObject>): void;
|
|
39
44
|
get(row: number, column: number): BaseValueObject | null;
|
|
40
45
|
getRealValue(row: number, column: number): BaseValueObject | null;
|
|
41
46
|
set(row: number, column: number, value: Nullable<BaseValueObject>): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseFunction } from '../../base-function';
|
|
2
|
+
import { BooleanValueObject } from '../../../engine/value-object/primitive-object';
|
|
2
3
|
import { BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
|
|
3
|
-
import { BooleanValueObject } from '../../..';
|
|
4
4
|
|
|
5
5
|
export declare class Isref extends BaseFunction {
|
|
6
6
|
needsReferenceObject: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayValueObject } from '
|
|
1
|
+
import { ArrayValueObject } from '../../../engine/value-object/array-value-object';
|
|
2
2
|
import { BaseFunction } from '../../base-function';
|
|
3
3
|
import { FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
|
|
4
4
|
|
|
@@ -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 { BaseFunction } from '../../base-function';
|
|
2
|
+
import { BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
|
|
3
|
+
import { ArrayValueObject } from '../../../engine/value-object/array-value-object';
|
|
4
|
+
|
|
5
|
+
export declare class Maxifs extends BaseFunction {
|
|
6
|
+
calculate(maxRange: BaseValueObject, ...variants: BaseValueObject[]): ErrorValueObject | ArrayValueObject;
|
|
7
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitSheetNameMap, INumfmtItemMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, } from './basics/common';
|
|
17
17
|
export { isInDirtyRange } from './basics/dirty';
|
|
18
|
-
export { ErrorType } from './basics/error-type';
|
|
18
|
+
export { ErrorType, ERROR_TYPE_SET } from './basics/error-type';
|
|
19
19
|
export { FunctionType, type IFunctionInfo, type IFunctionParam } from './basics/function';
|
|
20
20
|
export { type IFunctionNames } from './basics/function';
|
|
21
21
|
export { includeFormulaLexerToken, isFormulaLexerToken, normalizeSheetName } from './basics/match-token';
|
|
22
22
|
export { convertUnitDataToRuntime } from './basics/runtime';
|
|
23
23
|
export { matchToken, compareToken, operatorToken } from './basics/token';
|
|
24
24
|
export { RegisterFunctionMutation } from './commands/mutations/register-function.mutation';
|
|
25
|
-
export { type ISetArrayFormulaDataMutationParams, SetArrayFormulaDataMutation,
|
|
26
|
-
export { RemoveDefinedNameMutation, SetDefinedNameMutation,
|
|
25
|
+
export { type ISetArrayFormulaDataMutationParams, SetArrayFormulaDataMutation, } from './commands/mutations/set-array-formula-data.mutation';
|
|
26
|
+
export { RemoveDefinedNameMutation, SetDefinedNameMutation, type ISetDefinedNameMutationSearchParam, type ISetDefinedNameMutationParam } from './commands/mutations/set-defined-name.mutation';
|
|
27
27
|
export { RemoveFeatureCalculationMutation, SetFeatureCalculationMutation, } from './commands/mutations/set-feature-calculation.mutation';
|
|
28
28
|
export { type ISetFormulaCalculationNotificationMutation, type ISetFormulaCalculationResultMutation, type ISetFormulaCalculationStartMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, } from './commands/mutations/set-formula-calculation.mutation';
|
|
29
29
|
export { type ISetFormulaDataMutationParams, SetFormulaDataMutation, } from './commands/mutations/set-formula-data.mutation';
|
|
@@ -95,3 +95,4 @@ export { isFormulaTransformable, transformFormula } from './engine/utils/relativ
|
|
|
95
95
|
export { IFormulaRuntimeService, FormulaRuntimeService } from './services/runtime.service';
|
|
96
96
|
export { IFormulaCurrentConfigService, FormulaCurrentConfigService } from './services/current-data.service';
|
|
97
97
|
export { IActiveDirtyManagerService } from './services/active-dirty-manager.service';
|
|
98
|
+
export type { IRangeChange } from './models/formula-data.model';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { IFormulaIdMap } from './utils/formula-data-util';
|
|
1
2
|
import { LexerTreeBuilder } from '../engine/analysis/lexer-tree-builder';
|
|
2
3
|
import { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, INumfmtItemMap, IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap } from '../basics/common';
|
|
3
|
-
import { ICellData, IObjectMatrixPrimitiveType, Nullable, Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
|
|
4
|
+
import { ICellData, IObjectMatrixPrimitiveType, IRange, Nullable, Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
|
|
4
5
|
|
|
5
|
-
export interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
c: number;
|
|
6
|
+
export interface IRangeChange {
|
|
7
|
+
oldCell: IRange;
|
|
8
|
+
newCell: IRange;
|
|
9
9
|
}
|
|
10
10
|
export declare class FormulaDataModel extends Disposable {
|
|
11
11
|
private readonly _currentUniverService;
|
|
@@ -28,13 +28,14 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
28
28
|
setNumfmtItemMap(value: INumfmtItemMap): void;
|
|
29
29
|
updateNumfmtItemMap(value: INumfmtItemMap): void;
|
|
30
30
|
mergeArrayFormulaRange(formulaData: IArrayFormulaRangeType): void;
|
|
31
|
+
mergeFormulaData(formulaData: IFormulaData): void;
|
|
31
32
|
deleteArrayFormulaRange(unitId: string, sheetId: string, row: number, column: number): void;
|
|
32
33
|
initFormulaData(): void;
|
|
33
34
|
getCalculateData(): {
|
|
34
35
|
allUnitData: IUnitData;
|
|
35
36
|
unitSheetNameMap: IUnitSheetNameMap;
|
|
36
37
|
};
|
|
37
|
-
updateFormulaData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>):
|
|
38
|
+
updateFormulaData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): IObjectMatrixPrimitiveType<IFormulaDataItem | null>;
|
|
38
39
|
updateArrayFormulaRange(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): void;
|
|
39
40
|
updateArrayFormulaCellData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): void;
|
|
40
41
|
updateNumfmtData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): void;
|
|
@@ -42,4 +43,8 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
42
43
|
getFormulaDataItem(row: number, column: number, sheetId: string, unitId: string): IFormulaDataItem | undefined;
|
|
43
44
|
getFormulaIdMap(unitId: string, sheetId: string): Map<string, IFormulaIdMap>;
|
|
44
45
|
}
|
|
45
|
-
export declare function initSheetFormulaData(formulaData: IFormulaData, unitId: string, sheetId: string, cellMatrix: ObjectMatrix<Nullable<ICellData>>):
|
|
46
|
+
export declare function initSheetFormulaData(formulaData: IFormulaData, unitId: string, sheetId: string, cellMatrix: ObjectMatrix<Nullable<ICellData>>): {
|
|
47
|
+
[x: string]: {
|
|
48
|
+
[x: string]: IObjectMatrixPrimitiveType<IFormulaDataItem>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IFormulaDataItem } from '../../basics/common';
|
|
2
|
+
import { ICellData, IRange, Nullable, ObjectMatrix } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export interface IFormulaIdMap {
|
|
5
|
+
f: string;
|
|
6
|
+
r: number;
|
|
7
|
+
c: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function updateFormulaDataByCellValue(sheetFormulaDataMatrix: ObjectMatrix<IFormulaDataItem>, newSheetFormulaDataMatrix: ObjectMatrix<IFormulaDataItem | null>, formulaIdMap: Map<string, IFormulaIdMap>, deleteFormulaIdMap: Map<string, string | IFormulaIdMap>, r: number, c: number, cell: Nullable<ICellData>): void;
|
|
10
|
+
export declare function clearArrayFormulaCellDataByCell(arrayFormulaRangeMatrix: ObjectMatrix<IRange>, arrayFormulaCellDataMatrix: ObjectMatrix<Nullable<ICellData>>, r: number, c: number): true | undefined;
|