@univerjs/engine-formula 0.2.2 → 0.2.4-alpha.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.
- package/README.md +11 -2
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +4972 -4302
- package/lib/types/basics/date.d.ts +9 -15
- package/lib/types/controller/formula.controller.d.ts +1 -2
- package/lib/types/engine/analysis/__tests__/create-command-test-bed.d.ts +7 -8
- package/lib/types/engine/ast-node/function-node.d.ts +1 -1
- package/lib/types/engine/ast-node/prefix-node.d.ts +1 -2
- package/lib/types/engine/ast-node/reference-node.d.ts +1 -1
- package/lib/types/engine/ast-node/suffix-node.d.ts +1 -1
- package/lib/types/engine/reference-object/base-reference-object.d.ts +1 -0
- package/lib/types/engine/utils/prefixHandler.d.ts +1 -2
- package/lib/types/engine/value-object/array-value-object.d.ts +2 -0
- package/lib/types/engine/value-object/base-value-object.d.ts +1 -0
- package/lib/types/engine/value-object/primitive-object.d.ts +4 -1
- package/lib/types/functions/__tests__/create-function-test-bed.d.ts +7 -8
- package/lib/types/functions/custom-function.d.ts +5 -0
- package/lib/types/functions/date/function-map.d.ts +3 -1
- package/lib/types/functions/date/hour/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/hour/index.d.ts +9 -0
- package/lib/types/functions/date/minute/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/minute/index.d.ts +9 -0
- package/lib/types/functions/date/networkdays/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/networkdays/index.d.ts +8 -0
- package/lib/types/functions/date/networkdays-intl/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/networkdays-intl/index.d.ts +9 -0
- package/lib/types/functions/date/second/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/second/index.d.ts +9 -0
- package/lib/types/functions/date/weekday/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/weekday/index.d.ts +9 -0
- package/lib/types/functions/date/workday/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/workday/index.d.ts +8 -0
- package/lib/types/functions/date/workday-intl/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/workday-intl/index.d.ts +9 -0
- package/lib/types/functions/math/acoth/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/acoth/index.d.ts +8 -0
- package/lib/types/functions/math/base/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/base/index.d.ts +9 -0
- package/lib/types/functions/math/cosh/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/cosh/index.d.ts +8 -0
- package/lib/types/functions/math/cot/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/cot/index.d.ts +8 -0
- package/lib/types/functions/math/coth/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/coth/index.d.ts +8 -0
- package/lib/types/functions/math/csc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/csc/index.d.ts +8 -0
- package/lib/types/functions/math/csch/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/csch/index.d.ts +8 -0
- package/lib/types/functions/math/function-map.d.ts +2 -1
- package/lib/types/functions/math/sin/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/sin/index.d.ts +8 -0
- package/lib/types/functions/math/sinh/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/sinh/index.d.ts +8 -0
- package/lib/types/functions/math/sumproduct/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/sumproduct/index.d.ts +8 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/models/__tests__/create-command-test-bed.d.ts +7 -8
- package/lib/types/plugin.d.ts +1 -2
- package/lib/types/services/active-dirty-manager.service.d.ts +1 -1
- package/lib/types/services/current-data.service.d.ts +1 -1
- package/lib/types/services/defined-names.service.d.ts +1 -1
- package/lib/types/services/dependency-manager.service.d.ts +7 -1
- package/lib/types/services/feature-calculation-manager.service.d.ts +1 -1
- package/lib/types/services/function.service.d.ts +2 -3
- package/lib/types/services/other-formula-manager.service.d.ts +1 -1
- package/lib/types/services/runtime.service.d.ts +1 -1
- package/lib/types/services/super-table.service.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -10
- package/lib/types/commands/mutations/unregister-function.mutation.d.ts +0 -16
- package/lib/types/controller/register-function.controller.d.ts +0 -12
|
@@ -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 Csch extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(variant: BaseValueObject): BaseValueObject;
|
|
8
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Base } from './base';
|
|
1
2
|
import { FUNCTION_NAMES_MATH } from './function-names';
|
|
2
3
|
import { Subtotal } from './subtotal';
|
|
3
4
|
import { Sum } from './sum';
|
|
4
5
|
import { Sumifs } from './sumifs';
|
|
5
6
|
|
|
6
|
-
export declare const functionMath: ((FUNCTION_NAMES_MATH | typeof Subtotal)[] | (FUNCTION_NAMES_MATH | typeof Sum)[] | (FUNCTION_NAMES_MATH | typeof Sumifs)[])[];
|
|
7
|
+
export declare const functionMath: ((FUNCTION_NAMES_MATH | typeof Base)[] | (FUNCTION_NAMES_MATH | typeof Subtotal)[] | (FUNCTION_NAMES_MATH | typeof Sum)[] | (FUNCTION_NAMES_MATH | typeof Sumifs)[])[];
|
|
@@ -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 Sin 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 Sinh 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 Sumproduct extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(array1: BaseValueObject, ...variants: BaseValueObject[]): BaseValueObject;
|
|
8
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export { StringValueObject, NullValueObject } from './engine/value-object/primit
|
|
|
38
38
|
export { functionArray } from './functions/array/function-map';
|
|
39
39
|
export { FUNCTION_NAMES_ARRAY } from './functions/array/function-names';
|
|
40
40
|
export { BaseFunction } from './functions/base-function';
|
|
41
|
+
export { CustomFunction } from './functions/custom-function';
|
|
41
42
|
export { functionCompatibility } from './functions/compatibility/function-map';
|
|
42
43
|
export { FUNCTION_NAMES_COMPATIBILITY } from './functions/compatibility/function-names';
|
|
43
44
|
export { functionCube } from './functions/cube/function-map';
|
|
@@ -97,4 +98,3 @@ export { SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation,
|
|
|
97
98
|
export { SetFormulaDataMutation, type ISetFormulaDataMutationParams } from './commands/mutations/set-formula-data.mutation';
|
|
98
99
|
export { SetOtherFormulaMutation, RemoveOtherFormulaMutation, type ISetOtherFormulaMutationParams, type IRemoveOtherFormulaMutationParams } from './commands/mutations/set-other-formula.mutation';
|
|
99
100
|
export { SetSuperTableMutation, RemoveSuperTableMutation, SetSuperTableOptionMutation } from './commands/mutations/set-super-table.mutation';
|
|
100
|
-
export { UnregisterFunctionMutation } from './commands/mutations/unregister-function.mutation';
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { IWorkbookData, Univer } from '@univerjs/core';
|
|
2
|
-
import { Dependency } from '@wendellhu/redi';
|
|
1
|
+
import { Dependency, IWorkbookData, Univer } from '@univerjs/core';
|
|
3
2
|
|
|
4
3
|
export declare function createCommandTestBed(workbookData?: IWorkbookData, dependencies?: Dependency[]): {
|
|
5
4
|
univer: Univer;
|
|
6
5
|
get: {
|
|
7
|
-
<T>(id: import('@
|
|
8
|
-
<T>(id: import('@
|
|
9
|
-
<T>(id: import('@
|
|
10
|
-
<T>(id: import('@
|
|
11
|
-
<T>(id: import('@
|
|
12
|
-
<T>(id: import('@
|
|
6
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, lookUp?: import('@univerjs/core').LookUp): T;
|
|
7
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.MANY, lookUp?: import('@univerjs/core').LookUp): T[];
|
|
8
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.OPTIONAL, lookUp?: import('@univerjs/core').LookUp): T | null;
|
|
9
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.REQUIRED, lookUp?: import('@univerjs/core').LookUp): T;
|
|
10
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity?: import('@univerjs/core').Quantity, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
11
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantityOrLookup?: import('@univerjs/core').Quantity | import('@univerjs/core').LookUp, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
13
12
|
};
|
|
14
13
|
sheet: import('@univerjs/core').Workbook;
|
|
15
14
|
};
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -32,4 +32,4 @@ export declare class ActiveDirtyManagerService extends Disposable implements IAc
|
|
|
32
32
|
register(commandId: string, dirtyConversion: IDirtyConversionManagerParams): void;
|
|
33
33
|
getDirtyConversionMap(): Map<string, IDirtyConversionManagerParams>;
|
|
34
34
|
}
|
|
35
|
-
export declare const IActiveDirtyManagerService: import('@
|
|
35
|
+
export declare const IActiveDirtyManagerService: import('@univerjs/core').IdentifierDecorator<ActiveDirtyManagerService>;
|
|
@@ -72,4 +72,4 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
72
72
|
private _mergeNameMap;
|
|
73
73
|
private _loadSheetData;
|
|
74
74
|
}
|
|
75
|
-
export declare const IFormulaCurrentConfigService: import('@
|
|
75
|
+
export declare const IFormulaCurrentConfigService: import('@univerjs/core').IdentifierDecorator<FormulaCurrentConfigService>;
|
|
@@ -60,4 +60,4 @@ export declare class DefinedNamesService extends Disposable implements IDefinedN
|
|
|
60
60
|
hasDefinedName(unitId: string): boolean;
|
|
61
61
|
private _update;
|
|
62
62
|
}
|
|
63
|
-
export declare const IDefinedNamesService: import('@
|
|
63
|
+
export declare const IDefinedNamesService: import('@univerjs/core').IdentifierDecorator<DefinedNamesService>;
|
|
@@ -53,6 +53,12 @@ export declare class DependencyManagerService extends Disposable implements IDep
|
|
|
53
53
|
* @param shouldBeBuildTrees FormulaDependencyTree[] | FormulaDependencyTreeCache
|
|
54
54
|
*/
|
|
55
55
|
private _buildDependencyTree;
|
|
56
|
+
/**
|
|
57
|
+
* Build the reverse dependency relationship between the trees.
|
|
58
|
+
* @param allTrees
|
|
59
|
+
* @param dependencyTrees
|
|
60
|
+
*/
|
|
61
|
+
private _buildReverseDependency;
|
|
56
62
|
/**
|
|
57
63
|
* Clear the dependency relationship of the tree.
|
|
58
64
|
* establish the relationship between the parent and the child.
|
|
@@ -71,4 +77,4 @@ export declare class DependencyManagerService extends Disposable implements IDep
|
|
|
71
77
|
clearFormulaDependency(unitId: string, sheetId: string): void;
|
|
72
78
|
hasFormulaDependency(unitId: string, sheetId: string, row: number, column: number): boolean;
|
|
73
79
|
}
|
|
74
|
-
export declare const IDependencyManagerService: import('@
|
|
80
|
+
export declare const IDependencyManagerService: import('@univerjs/core').IdentifierDecorator<DependencyManagerService>;
|
|
@@ -34,4 +34,4 @@ export declare class FeatureCalculationManagerService extends Disposable impleme
|
|
|
34
34
|
register(featureId: string, referenceExecutor: IFeatureCalculationManagerParam): void;
|
|
35
35
|
getReferenceExecutorMap(): Map<string, IFeatureCalculationManagerParam>;
|
|
36
36
|
}
|
|
37
|
-
export declare const IFeatureCalculationManagerService: import('@
|
|
37
|
+
export declare const IFeatureCalculationManagerService: import('@univerjs/core').IdentifierDecorator<FeatureCalculationManagerService>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Nullable, Disposable } from '@univerjs/core';
|
|
2
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
1
|
+
import { IDisposable, Nullable, Disposable } from '@univerjs/core';
|
|
3
2
|
import { IFunctionInfo, IFunctionNames } from '../basics/function';
|
|
4
3
|
import { BaseFunction } from '../functions/base-function';
|
|
5
4
|
|
|
@@ -43,4 +42,4 @@ export declare class FunctionService extends Disposable implements IFunctionServ
|
|
|
43
42
|
hasDescription(functionToken: IFunctionNames): boolean;
|
|
44
43
|
unregisterDescriptions(...functionTokens: IFunctionNames[]): void;
|
|
45
44
|
}
|
|
46
|
-
export declare const IFunctionService: import('@
|
|
45
|
+
export declare const IFunctionService: import('@univerjs/core').IdentifierDecorator<FunctionService>;
|
|
@@ -36,4 +36,4 @@ export declare class OtherFormulaManagerService extends Disposable implements IO
|
|
|
36
36
|
batchRemove(formulaData: IDirtyUnitOtherFormulaMap): void;
|
|
37
37
|
getOtherFormulaData(): IOtherFormulaData;
|
|
38
38
|
}
|
|
39
|
-
export declare const IOtherFormulaManagerService: import('@
|
|
39
|
+
export declare const IOtherFormulaManagerService: import('@univerjs/core').IdentifierDecorator<OtherFormulaManagerService>;
|
|
@@ -179,4 +179,4 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
179
179
|
private _checkIfArrayFormulaExceeded;
|
|
180
180
|
private _isInDirtyRange;
|
|
181
181
|
}
|
|
182
|
-
export declare const IFormulaRuntimeService: import('@
|
|
182
|
+
export declare const IFormulaRuntimeService: import('@univerjs/core').IdentifierDecorator<FormulaRuntimeService>;
|
|
@@ -22,4 +22,4 @@ export declare class SuperTableService extends Disposable implements ISuperTable
|
|
|
22
22
|
registerTable(unitId: string, tableName: string, reference: ISuperTable): void;
|
|
23
23
|
registerTableOptionMap(tableOption: string, tableOptionType: TableOptionType): void;
|
|
24
24
|
}
|
|
25
|
-
export declare const ISuperTableService: import('@
|
|
25
|
+
export declare const ISuperTableService: import('@univerjs/core').IdentifierDecorator<ISuperTableService>;
|