@univerjs/engine-formula 0.2.2 → 0.2.3

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 (32) hide show
  1. package/README.md +11 -2
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/es/index.js +4222 -4078
  4. package/lib/types/engine/value-object/array-value-object.d.ts +2 -0
  5. package/lib/types/engine/value-object/base-value-object.d.ts +1 -0
  6. package/lib/types/engine/value-object/primitive-object.d.ts +3 -0
  7. package/lib/types/functions/custom-function.d.ts +5 -0
  8. package/lib/types/functions/math/acoth/__tests__/index.spec.d.ts +16 -0
  9. package/lib/types/functions/math/acoth/index.d.ts +8 -0
  10. package/lib/types/functions/math/base/__tests__/index.spec.d.ts +16 -0
  11. package/lib/types/functions/math/base/index.d.ts +9 -0
  12. package/lib/types/functions/math/cosh/__tests__/index.spec.d.ts +16 -0
  13. package/lib/types/functions/math/cosh/index.d.ts +8 -0
  14. package/lib/types/functions/math/cot/__tests__/index.spec.d.ts +16 -0
  15. package/lib/types/functions/math/cot/index.d.ts +8 -0
  16. package/lib/types/functions/math/coth/__tests__/index.spec.d.ts +16 -0
  17. package/lib/types/functions/math/coth/index.d.ts +8 -0
  18. package/lib/types/functions/math/csc/__tests__/index.spec.d.ts +16 -0
  19. package/lib/types/functions/math/csc/index.d.ts +8 -0
  20. package/lib/types/functions/math/csch/__tests__/index.spec.d.ts +16 -0
  21. package/lib/types/functions/math/csch/index.d.ts +8 -0
  22. package/lib/types/functions/math/function-map.d.ts +2 -1
  23. package/lib/types/functions/math/sin/__tests__/index.spec.d.ts +16 -0
  24. package/lib/types/functions/math/sin/index.d.ts +8 -0
  25. package/lib/types/functions/math/sinh/__tests__/index.spec.d.ts +16 -0
  26. package/lib/types/functions/math/sinh/index.d.ts +8 -0
  27. package/lib/types/index.d.ts +1 -1
  28. package/lib/types/services/dependency-manager.service.d.ts +6 -0
  29. package/lib/umd/index.js +1 -1
  30. package/package.json +6 -6
  31. package/lib/types/commands/mutations/unregister-function.mutation.d.ts +0 -16
  32. package/lib/types/controller/register-function.controller.d.ts +0 -12
@@ -54,6 +54,7 @@ export declare class ArrayValueObject extends BaseValueObject {
54
54
  setDefaultValue(value: Nullable<BaseValueObject>): void;
55
55
  get(row: number, column: number): Nullable<BaseValueObject>;
56
56
  getRealValue(row: number, column: number): BaseValueObject | null;
57
+ getValueOrDefault(row: number, column: number): Nullable<BaseValueObject>;
57
58
  set(row: number, column: number, value: Nullable<BaseValueObject>): void;
58
59
  getRangePosition(): {
59
60
  startRow: number;
@@ -151,6 +152,7 @@ export declare class ArrayValueObject extends BaseValueObject {
151
152
  acos(): BaseValueObject;
152
153
  acosh(): BaseValueObject;
153
154
  sin(): BaseValueObject;
155
+ sinh(): BaseValueObject;
154
156
  asin(): BaseValueObject;
155
157
  asinh(): BaseValueObject;
156
158
  tan(): BaseValueObject;
@@ -89,6 +89,7 @@ export declare class BaseValueObject extends ObjectClassType {
89
89
  acos(): BaseValueObject;
90
90
  acosh(): BaseValueObject;
91
91
  sin(): BaseValueObject;
92
+ sinh(): BaseValueObject;
92
93
  asin(): BaseValueObject;
93
94
  asinh(): BaseValueObject;
94
95
  tan(): BaseValueObject;
@@ -27,6 +27,7 @@ export declare class NullValueObject extends BaseValueObject {
27
27
  acos(): BaseValueObject;
28
28
  acosh(): BaseValueObject;
29
29
  sin(): BaseValueObject;
30
+ sinh(): BaseValueObject;
30
31
  asin(): BaseValueObject;
31
32
  asinh(): BaseValueObject;
32
33
  tan(): BaseValueObject;
@@ -72,6 +73,7 @@ export declare class BooleanValueObject extends BaseValueObject {
72
73
  acos(): BaseValueObject;
73
74
  acosh(): BaseValueObject;
74
75
  sin(): BaseValueObject;
76
+ sinh(): BaseValueObject;
75
77
  asin(): BaseValueObject;
76
78
  asinh(): BaseValueObject;
77
79
  tan(): BaseValueObject;
@@ -124,6 +126,7 @@ export declare class NumberValueObject extends BaseValueObject {
124
126
  acos(): BaseValueObject;
125
127
  acosh(): BaseValueObject;
126
128
  sin(): BaseValueObject;
129
+ sinh(): BaseValueObject;
127
130
  asin(): BaseValueObject;
128
131
  asinh(): BaseValueObject;
129
132
  tan(): BaseValueObject;
@@ -0,0 +1,5 @@
1
+ import { BaseFunction } from './base-function';
2
+
3
+ export declare class CustomFunction extends BaseFunction {
4
+ isCustom(): boolean;
5
+ }
@@ -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 Acoth 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,9 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { StringValueObject } from '../../../engine/value-object/primitive-object';
3
+ import { BaseFunction } from '../../base-function';
4
+
5
+ export declare class Base extends BaseFunction {
6
+ minParams: number;
7
+ maxParams: number;
8
+ calculate(number: BaseValueObject, radix: BaseValueObject, minLength?: BaseValueObject): BaseValueObject | StringValueObject;
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 { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class Cosh 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 Cot 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 Coth 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 Csc 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 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
+ }
@@ -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';
@@ -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.