@univerjs/engine-formula 0.2.6 → 0.2.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.
Files changed (26) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +697 -436
  3. package/lib/types/engine/dependency/dependency-tree.d.ts +1 -1
  4. package/lib/types/engine/dependency/formula-dependency.d.ts +6 -1
  5. package/lib/types/functions/information/iseven/iseven.d.ts +2 -3
  6. package/lib/types/functions/information/isodd/isodd.d.ts +2 -3
  7. package/lib/types/functions/logical/false/__tests__/index.spec.d.ts +16 -0
  8. package/lib/types/functions/logical/false/index.d.ts +8 -0
  9. package/lib/types/functions/logical/function-map.d.ts +2 -2
  10. package/lib/types/functions/logical/ifna/__tests__/index.spec.d.ts +16 -0
  11. package/lib/types/functions/logical/ifna/index.d.ts +9 -0
  12. package/lib/types/functions/logical/ifs/__tests__/index.spec.d.ts +16 -0
  13. package/lib/types/functions/logical/ifs/index.d.ts +8 -0
  14. package/lib/types/functions/logical/not/__tests__/index.spec.d.ts +16 -0
  15. package/lib/types/functions/logical/not/index.d.ts +8 -0
  16. package/lib/types/functions/logical/switch/__tests__/index.spec.d.ts +16 -0
  17. package/lib/types/functions/logical/switch/index.d.ts +9 -0
  18. package/lib/types/functions/logical/true/__tests__/index.spec.d.ts +16 -0
  19. package/lib/types/functions/logical/true/index.d.ts +8 -0
  20. package/lib/types/functions/logical/xor/__tests__/index.spec.d.ts +16 -0
  21. package/lib/types/functions/logical/xor/index.d.ts +8 -0
  22. package/lib/types/functions/lookup/indirect/index.d.ts +1 -0
  23. package/lib/types/functions/statistical/function-map.d.ts +1 -1
  24. package/lib/types/services/feature-calculation-manager.service.d.ts +1 -2
  25. package/lib/umd/index.js +1 -1
  26. package/package.json +7 -7
@@ -32,7 +32,7 @@ export declare class FormulaDependencyTree extends Disposable {
32
32
  formulaId: Nullable<string>;
33
33
  featureId: Nullable<string>;
34
34
  isPassive: boolean;
35
- getDirtyData: Nullable<(tree: FormulaDependencyTree, dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => {
35
+ getDirtyData: Nullable<(dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => {
36
36
  runtimeCellData: IRuntimeUnitDataType;
37
37
  dirtyRanges: IFeatureDirtyRangeType;
38
38
  }>;
@@ -32,7 +32,7 @@ export declare class FormulaDependencyGenerator extends Disposable {
32
32
  */
33
33
  private _generateTreeList;
34
34
  private _registerFeatureFormulas;
35
- private _makePassiveDirtyForFeatureFormulas;
35
+ private _getFeatureFormulaTree;
36
36
  private _registerOtherFormulas;
37
37
  private _registerFormulas;
38
38
  /**
@@ -57,6 +57,11 @@ export declare class FormulaDependencyGenerator extends Disposable {
57
57
  * @param treeList
58
58
  */
59
59
  private _getUpdateTreeListAndMakeDependency;
60
+ private _dependencyFeatureCalculation;
61
+ private _clearFeatureCalculationNode;
62
+ private _getExistTreeList;
63
+ private _convertDirtyRangesToMap;
64
+ private _intersectFeatureCalculation;
60
65
  private _includeTreeFeature;
61
66
  private _includeOtherFormula;
62
67
  private _includeDefinedName;
@@ -1,9 +1,8 @@
1
- import { BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
- import { BooleanValueObject } from '../../../engine/value-object/primitive-object';
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
3
2
  import { BaseFunction } from '../../base-function';
4
3
 
5
4
  export declare class Iseven extends BaseFunction {
6
5
  minParams: number;
7
6
  maxParams: number;
8
- calculate(value: BaseValueObject): ErrorValueObject | BooleanValueObject;
7
+ calculate(value: BaseValueObject): BaseValueObject;
9
8
  }
@@ -1,9 +1,8 @@
1
- import { BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
2
- import { BooleanValueObject } from '../../../engine/value-object/primitive-object';
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
3
2
  import { BaseFunction } from '../../base-function';
4
3
 
5
4
  export declare class Isodd extends BaseFunction {
6
5
  minParams: number;
7
6
  maxParams: number;
8
- calculate(value: BaseValueObject): ErrorValueObject | BooleanValueObject;
7
+ calculate(value: BaseValueObject): BaseValueObject;
9
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 { BooleanValueObject } from '../../../engine/value-object/primitive-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class False extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(): BooleanValueObject;
8
+ }
@@ -1,6 +1,6 @@
1
- import { And } from './and';
2
1
  import { FUNCTION_NAMES_LOGICAL } from './function-names';
2
+ import { And } from './and';
3
3
  import { Iferror } from './iferror';
4
4
  import { Makearray } from './makearray';
5
5
 
6
- export declare const functionLogical: ((FUNCTION_NAMES_LOGICAL | typeof And)[] | (FUNCTION_NAMES_LOGICAL | typeof Makearray)[] | (FUNCTION_NAMES_LOGICAL | typeof Iferror)[])[];
6
+ export declare const functionLogical: ((FUNCTION_NAMES_LOGICAL | typeof And)[] | (FUNCTION_NAMES_LOGICAL | typeof Iferror)[] | (FUNCTION_NAMES_LOGICAL | typeof Makearray)[])[];
@@ -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 { ArrayValueObject } from '../../../engine/value-object/array-value-object';
2
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
3
+ import { BaseFunction } from '../../base-function';
4
+
5
+ export declare class Ifna extends BaseFunction {
6
+ minParams: number;
7
+ maxParams: number;
8
+ calculate(value: BaseValueObject, valueIfNa: BaseValueObject): BaseValueObject | ArrayValueObject;
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 Ifs extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(...params: 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 Not extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(logicalValue: 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 { BaseFunction } from '../../base-function';
3
+
4
+ export declare class Switch extends BaseFunction {
5
+ minParams: number;
6
+ calculate(expression: BaseValueObject, ...args: BaseValueObject[]): BaseValueObject;
7
+ private _handleNonArrayInputs;
8
+ private _handleArrayInputs;
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 { BooleanValueObject } from '../../../engine/value-object/primitive-object';
2
+ import { BaseFunction } from '../../base-function';
3
+
4
+ export declare class True extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(): BooleanValueObject;
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 Xor extends BaseFunction {
5
+ minParams: number;
6
+ maxParams: number;
7
+ calculate(...logicalValues: BaseValueObject[]): BaseValueObject;
8
+ }
@@ -7,6 +7,7 @@ export declare class Indirect extends BaseFunction {
7
7
  maxParams: number;
8
8
  isAddress(): boolean;
9
9
  calculate(refText: BaseValueObject, a1?: BaseValueObject): BaseValueObject | BaseReferenceObject;
10
+ private _handleSingleObject;
10
11
  private _setDefault;
11
12
  /**
12
13
  * In Excel, to inject a defined name into a function that has positioning capabilities,
@@ -1,5 +1,5 @@
1
1
  import { FUNCTION_NAMES_STATISTICAL } from './function-names';
2
- import { StdevP } from './stdev-p';
3
2
  import { Averageif } from './averageif';
3
+ import { StdevP } from './stdev-p';
4
4
 
5
5
  export declare const functionStatistical: ((FUNCTION_NAMES_STATISTICAL | typeof Averageif)[] | (FUNCTION_NAMES_STATISTICAL | typeof StdevP)[])[];
@@ -2,7 +2,6 @@ import { IUnitRange, Nullable, Disposable } from '@univerjs/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { IFeatureDirtyRangeType, IRuntimeUnitDataType } from '../basics/common';
4
4
  import { IRemoveFeatureCalculationMutationParam } from '../commands/mutations/set-feature-calculation.mutation';
5
- import { FormulaDependencyTree } from '../engine/dependency/dependency-tree';
6
5
  import { IAllRuntimeData } from './runtime.service';
7
6
  import { IFormulaDirtyData } from './current-data.service';
8
7
 
@@ -10,7 +9,7 @@ export interface IFeatureCalculationManagerParam {
10
9
  unitId: string;
11
10
  subUnitId: string;
12
11
  dependencyRanges: IUnitRange[];
13
- getDirtyData: (tree: FormulaDependencyTree, dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => {
12
+ getDirtyData: (dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => {
14
13
  runtimeCellData: IRuntimeUnitDataType;
15
14
  dirtyRanges: IFeatureDirtyRangeType;
16
15
  };