@univerjs/engine-formula 0.4.1 → 0.4.2

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 (116) hide show
  1. package/lib/cjs/index.js +2 -2
  2. package/lib/es/index.js +2865 -784
  3. package/lib/types/basics/database.d.ts +31 -0
  4. package/lib/types/basics/inverted-index-cache.d.ts +7 -18
  5. package/lib/types/basics/math.d.ts +12 -0
  6. package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +0 -1
  7. package/lib/types/controller/calculate.controller.d.ts +0 -1
  8. package/lib/types/controller/config.schema.d.ts +5 -1
  9. package/lib/types/engine/analysis/__tests__/dependency.spec.d.ts +16 -0
  10. package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -1
  11. package/lib/types/engine/ast-node/function-node.d.ts +2 -0
  12. package/lib/types/engine/ast-node/node-type.d.ts +13 -13
  13. package/lib/types/engine/dependency/dependency-tree.d.ts +14 -6
  14. package/lib/types/engine/reference-object/base-reference-object.d.ts +10 -0
  15. package/lib/types/engine/utils/char-kit.d.ts +5 -7
  16. package/lib/types/engine/utils/numfmt-kit.d.ts +13 -1
  17. package/lib/types/engine/utils/reference-cache.d.ts +3 -0
  18. package/lib/types/engine/utils/reference.d.ts +0 -2
  19. package/lib/types/engine/value-object/array-value-object.d.ts +1 -0
  20. package/lib/types/functions/base-function.d.ts +26 -1
  21. package/lib/types/functions/database/daverage/__tests__/index.spec.d.ts +16 -0
  22. package/lib/types/functions/database/daverage/index.d.ts +8 -0
  23. package/lib/types/functions/database/dcount/__tests__/index.spec.d.ts +16 -0
  24. package/lib/types/functions/database/dcount/index.d.ts +8 -0
  25. package/lib/types/functions/database/dcounta/__tests__/index.spec.d.ts +16 -0
  26. package/lib/types/functions/database/dcounta/index.d.ts +8 -0
  27. package/lib/types/functions/database/dget/__tests__/index.spec.d.ts +16 -0
  28. package/lib/types/functions/database/dget/index.d.ts +7 -0
  29. package/lib/types/functions/database/dmax/__tests__/index.spec.d.ts +16 -0
  30. package/lib/types/functions/database/dmax/index.d.ts +8 -0
  31. package/lib/types/functions/database/dmin/__tests__/index.spec.d.ts +16 -0
  32. package/lib/types/functions/database/dmin/index.d.ts +8 -0
  33. package/lib/types/functions/database/dproduct/__tests__/index.spec.d.ts +16 -0
  34. package/lib/types/functions/database/dproduct/index.d.ts +8 -0
  35. package/lib/types/functions/database/dstdev/__tests__/index.spec.d.ts +16 -0
  36. package/lib/types/functions/database/dstdev/index.d.ts +8 -0
  37. package/lib/types/functions/database/dstdevp/__tests__/index.spec.d.ts +16 -0
  38. package/lib/types/functions/database/dstdevp/index.d.ts +8 -0
  39. package/lib/types/functions/database/dsum/__tests__/index.spec.d.ts +16 -0
  40. package/lib/types/functions/database/dsum/index.d.ts +8 -0
  41. package/lib/types/functions/database/dvar/__tests__/index.spec.d.ts +16 -0
  42. package/lib/types/functions/database/dvar/index.d.ts +8 -0
  43. package/lib/types/functions/database/dvarp/__tests__/index.spec.d.ts +16 -0
  44. package/lib/types/functions/database/dvarp/index.d.ts +8 -0
  45. package/lib/types/functions/database/function-map.d.ts +3 -16
  46. package/lib/types/functions/financial/db/index.d.ts +1 -0
  47. package/lib/types/functions/financial/ddb/index.d.ts +1 -0
  48. package/lib/types/functions/financial/fv/index.d.ts +2 -1
  49. package/lib/types/functions/financial/ipmt/index.d.ts +2 -1
  50. package/lib/types/functions/financial/npv/index.d.ts +1 -0
  51. package/lib/types/functions/financial/pmt/index.d.ts +2 -1
  52. package/lib/types/functions/financial/ppmt/index.d.ts +2 -1
  53. package/lib/types/functions/financial/pv/index.d.ts +2 -1
  54. package/lib/types/functions/financial/sln/index.d.ts +1 -0
  55. package/lib/types/functions/financial/syd/index.d.ts +1 -0
  56. package/lib/types/functions/financial/tbillprice/index.d.ts +1 -0
  57. package/lib/types/functions/financial/vdb/index.d.ts +1 -0
  58. package/lib/types/functions/information/function-map.d.ts +1 -1
  59. package/lib/types/functions/information/sheet/__tests__/index.spec.d.ts +16 -0
  60. package/lib/types/functions/information/sheet/index.d.ts +10 -0
  61. package/lib/types/functions/information/sheets/__tests__/index.spec.d.ts +16 -0
  62. package/lib/types/functions/information/sheets/index.d.ts +8 -0
  63. package/lib/types/functions/lookup/xlookup/index.d.ts +1 -1
  64. package/lib/types/functions/math/arabic/__tests__/index.spec.d.ts +16 -0
  65. package/lib/types/functions/math/arabic/index.d.ts +8 -0
  66. package/lib/types/functions/math/roman/__tests__/index.spec.d.ts +16 -0
  67. package/lib/types/functions/math/roman/index.d.ts +9 -0
  68. package/lib/types/functions/math/sumif/index.d.ts +3 -1
  69. package/lib/types/functions/text/arraytotext/__test__/index.spec.d.ts +16 -0
  70. package/lib/types/functions/text/arraytotext/index.d.ts +9 -0
  71. package/lib/types/functions/text/asc/__test__/index.spec.d.ts +16 -0
  72. package/lib/types/functions/text/asc/index.d.ts +8 -0
  73. package/lib/types/functions/text/bahttext/__test__/index.spec.d.ts +16 -0
  74. package/lib/types/functions/text/bahttext/index.d.ts +9 -0
  75. package/lib/types/functions/text/char/__test__/index.spec.d.ts +16 -0
  76. package/lib/types/functions/text/char/index.d.ts +8 -0
  77. package/lib/types/functions/text/clean/__test__/index.spec.d.ts +16 -0
  78. package/lib/types/functions/text/clean/index.d.ts +8 -0
  79. package/lib/types/functions/text/code/__test__/index.spec.d.ts +16 -0
  80. package/lib/types/functions/text/code/index.d.ts +8 -0
  81. package/lib/types/functions/text/dbcs/__test__/index.spec.d.ts +16 -0
  82. package/lib/types/functions/text/dbcs/index.d.ts +8 -0
  83. package/lib/types/functions/text/dollar/__test__/index.spec.d.ts +16 -0
  84. package/lib/types/functions/text/dollar/index.d.ts +9 -0
  85. package/lib/types/functions/text/exact/__test__/index.spec.d.ts +16 -0
  86. package/lib/types/functions/text/exact/index.d.ts +8 -0
  87. package/lib/types/functions/text/fixed/__test__/index.spec.d.ts +16 -0
  88. package/lib/types/functions/text/fixed/index.d.ts +8 -0
  89. package/lib/types/functions/text/leftb/index.d.ts +1 -2
  90. package/lib/types/functions/text/numbervalue/__test__/index.spec.d.ts +16 -0
  91. package/lib/types/functions/text/numbervalue/index.d.ts +8 -0
  92. package/lib/types/functions/text/proper/__test__/index.spec.d.ts +16 -0
  93. package/lib/types/functions/text/proper/index.d.ts +8 -0
  94. package/lib/types/functions/text/right/__test__/index.spec.d.ts +16 -0
  95. package/lib/types/functions/text/right/index.d.ts +8 -0
  96. package/lib/types/functions/text/rightb/__test__/index.spec.d.ts +16 -0
  97. package/lib/types/functions/text/rightb/index.d.ts +8 -0
  98. package/lib/types/functions/text/substitute/__test__/index.spec.d.ts +16 -0
  99. package/lib/types/functions/text/substitute/index.d.ts +9 -0
  100. package/lib/types/functions/text/t/__test__/index.spec.d.ts +16 -0
  101. package/lib/types/functions/text/t/index.d.ts +7 -0
  102. package/lib/types/functions/text/unichar/__test__/index.spec.d.ts +16 -0
  103. package/lib/types/functions/text/unichar/index.d.ts +8 -0
  104. package/lib/types/functions/text/unicode/__test__/index.spec.d.ts +16 -0
  105. package/lib/types/functions/text/unicode/index.d.ts +8 -0
  106. package/lib/types/functions/text/value/__test__/index.spec.d.ts +16 -0
  107. package/lib/types/functions/text/value/index.d.ts +8 -0
  108. package/lib/types/functions/text/valuetotext/__test__/index.spec.d.ts +16 -0
  109. package/lib/types/functions/text/valuetotext/index.d.ts +8 -0
  110. package/lib/types/index.d.ts +2 -3
  111. package/lib/types/services/calculate-formula.service.d.ts +3 -4
  112. package/lib/types/services/current-data.service.d.ts +17 -2
  113. package/lib/types/services/dependency-manager.service.d.ts +17 -9
  114. package/lib/types/services/runtime.service.d.ts +10 -9
  115. package/lib/umd/index.js +2 -2
  116. package/package.json +5 -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,8 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Numbervalue extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject, decimalSeparator?: BaseValueObject, groupSeparator?: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
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 { BaseFunction } from '../../base-function';
2
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
3
+ export declare class Proper extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
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
+ export declare class Right extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject, numChars?: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
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
+ export declare class Rightb extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject, numBytes?: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
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
+ export declare class Substitute extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject, oldText: BaseValueObject, newText: BaseValueObject, instanceNum?: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
8
+ private _getObjectString;
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,7 @@
1
+ import { BaseFunction } from '../../base-function';
2
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
3
+ export declare class T extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(value: BaseValueObject): BaseValueObject;
7
+ }
@@ -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
+ export declare class Unichar extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(number: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
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
+ export declare class Unicode extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
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
+ export declare class Value extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
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
+ export declare class Valuetotext extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(value: BaseValueObject, format?: BaseValueObject): BaseValueObject;
7
+ private _handleSingleObject;
8
+ }
@@ -112,8 +112,7 @@ export { FeatureCalculationManagerService, IFeatureCalculationManagerService } f
112
112
  export { FunctionService } from './services/function.service';
113
113
  export { IFunctionService } from './services/function.service';
114
114
  export { IOtherFormulaManagerService, OtherFormulaManagerService } from './services/other-formula-manager.service';
115
- export { FormulaExecuteStageType, type IExecutionInProgressParams } from './services/runtime.service';
116
- export { FormulaExecutedStateType, type IAllRuntimeData } from './services/runtime.service';
117
- export { FormulaRuntimeService, IFormulaRuntimeService } from './services/runtime.service';
115
+ export { FormulaExecutedStateType, FormulaExecuteStageType, FormulaRuntimeService, type IAllRuntimeData, type IExecutionInProgressParams, IFormulaRuntimeService } from './services/runtime.service';
118
116
  export { ISuperTableService } from './services/super-table.service';
119
117
  export { SuperTableService } from './services/super-table.service';
118
+ export { deserializeRangeWithSheetWithCache } from './engine/utils/reference-cache';
@@ -8,6 +8,7 @@ import { FormulaDependencyGenerator } from '../engine/dependency/formula-depende
8
8
  import { Interpreter } from '../engine/interpreter/interpreter';
9
9
  import { IFormulaCurrentConfigService } from './current-data.service';
10
10
  export declare const DEFAULT_CYCLE_REFERENCE_COUNT = 1;
11
+ export declare const DEFAULT_INTERVAL_COUNT = 500;
11
12
  export declare const CYCLE_REFERENCE_COUNT = "cycleReferenceCount";
12
13
  export declare const EVERY_N_FUNCTION_EXECUTION_PAUSE = 100;
13
14
  export declare class CalculateFormulaService extends Disposable {
@@ -18,12 +19,10 @@ export declare class CalculateFormulaService extends Disposable {
18
19
  private readonly _formulaDependencyGenerator;
19
20
  private readonly _interpreter;
20
21
  private readonly _astTreeBuilder;
21
- private readonly _executionStartListener$;
22
- readonly executionStartListener$: import('rxjs').Observable<boolean>;
23
- private readonly _executionCompleteListener$;
24
- readonly executionCompleteListener$: import('rxjs').Observable<IAllRuntimeData>;
25
22
  private readonly _executionInProgressListener$;
26
23
  readonly executionInProgressListener$: import('rxjs').Observable<IExecutionInProgressParams>;
24
+ private readonly _executionCompleteListener$;
25
+ readonly executionCompleteListener$: import('rxjs').Observable<IAllRuntimeData>;
27
26
  constructor(_configService: IConfigService, _lexer: Lexer, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _formulaDependencyGenerator: FormulaDependencyGenerator, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder);
28
27
  /**
29
28
  * Stop the execution of the formula.
@@ -1,4 +1,4 @@
1
- import { IUnitRange, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
1
+ import { IUnitRange, LocaleType, Nullable, Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
2
  import { IArrayFormulaRangeType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
3
3
  export interface IFormulaDirtyData {
4
4
  forceCalculation: boolean;
@@ -38,9 +38,17 @@ export interface IFormulaCurrentConfigService {
38
38
  setExecuteSubUnitId(subUnitId: string): void;
39
39
  getDirtyData(): IFormulaDirtyData;
40
40
  getClearDependencyTreeCache(): IDirtyUnitSheetNameMap;
41
+ getLocale(): LocaleType;
42
+ getSheetsInfo(): {
43
+ sheetOrder: string[];
44
+ sheetNameMap: {
45
+ [sheetId: string]: string;
46
+ };
47
+ };
41
48
  }
42
49
  export declare class FormulaCurrentConfigService extends Disposable implements IFormulaCurrentConfigService {
43
50
  private readonly _univerInstanceService;
51
+ private readonly _localeService;
44
52
  private _unitData;
45
53
  private _unitStylesData;
46
54
  private _arrayFormulaCellData;
@@ -58,7 +66,7 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
58
66
  private _sheetIdToNameMap;
59
67
  private _executeUnitId;
60
68
  private _executeSubUnitId;
61
- constructor(_univerInstanceService: IUniverInstanceService);
69
+ constructor(_univerInstanceService: IUniverInstanceService, _localeService: LocaleService);
62
70
  dispose(): void;
63
71
  getExecuteUnitId(): Nullable<string>;
64
72
  getExecuteSubUnitId(): Nullable<string>;
@@ -79,6 +87,13 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
79
87
  getDirtyUnitOtherFormulaMap(): IDirtyUnitOtherFormulaMap;
80
88
  getSheetName(unitId: string, sheetId: string): string;
81
89
  getClearDependencyTreeCache(): IDirtyUnitSheetNameMap;
90
+ getLocale(): LocaleType;
91
+ getSheetsInfo(): {
92
+ sheetOrder: string[];
93
+ sheetNameMap: {
94
+ [sheetId: string]: string;
95
+ };
96
+ };
82
97
  load(config: IFormulaDatasetConfig): void;
83
98
  getDirtyData(): IFormulaDirtyData;
84
99
  loadDirtyRangesAndExcludedCell(dirtyRanges: IUnitRange[], excludedCell?: IUnitExcludedCell): void;
@@ -1,22 +1,22 @@
1
- import { IRTreeItem, IUnitRange, Nullable, Disposable, ObjectMatrix } from '@univerjs/core';
1
+ import { IUnitRange, Nullable, Disposable, ObjectMatrix } from '@univerjs/core';
2
2
  import { FormulaDependencyTree } from '../engine/dependency/dependency-tree';
3
3
  export interface IOtherFormulaDependencyParam {
4
4
  [unitId: string]: Nullable<{
5
5
  [sheetId: string]: {
6
- [formulaId: string]: Nullable<FormulaDependencyTree>;
6
+ [formulaId: string]: Nullable<number>;
7
7
  };
8
8
  }>;
9
9
  }
10
10
  export interface IFeatureFormulaDependencyParam {
11
11
  [unitId: string]: Nullable<{
12
12
  [sheetId: string]: {
13
- [featureId: string]: Nullable<FormulaDependencyTree>;
13
+ [featureId: string]: Nullable<number>;
14
14
  };
15
15
  }>;
16
16
  }
17
17
  export interface IFormulaDependencyParam {
18
18
  [unitId: string]: Nullable<{
19
- [sheetId: string]: ObjectMatrix<Nullable<FormulaDependencyTree>>;
19
+ [sheetId: string]: ObjectMatrix<number>;
20
20
  }>;
21
21
  }
22
22
  export interface IDependencyManagerService {
@@ -37,11 +37,14 @@ export interface IDependencyManagerService {
37
37
  removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
38
38
  clearFormulaDependency(unitId: string, sheetId?: string): void;
39
39
  addDependencyRTreeCache(tree: FormulaDependencyTree): void;
40
- searchDependency(search: IUnitRange[]): Map<string, IRTreeItem>;
40
+ searchDependency(search: IUnitRange[]): Set<number>;
41
41
  getLastTreeId(): number;
42
42
  clearDependencyAll(): void;
43
43
  clearOtherFormulaDependency(unitId: string, sheetId?: string): void;
44
44
  clearFeatureFormulaDependency(unitId: string, sheetId?: string): void;
45
+ openKdTree(): void;
46
+ closeKdTree(): void;
47
+ getTreeById(treeId: number): Nullable<FormulaDependencyTree>;
45
48
  }
46
49
  /**
47
50
  * Passively marked as dirty, register the reference and execution actions of the feature plugin.
@@ -53,6 +56,7 @@ export declare class DependencyManagerService extends Disposable implements IDep
53
56
  private _otherFormulaData;
54
57
  private _featureFormulaData;
55
58
  private _formulaData;
59
+ private _allTreeMap;
56
60
  private _dependencyRTreeCache;
57
61
  private _dependencyTreeIdLast;
58
62
  dispose(): void;
@@ -61,8 +65,9 @@ export declare class DependencyManagerService extends Disposable implements IDep
61
65
  * return FormulaDependencyTree[]
62
66
  */
63
67
  getAllTree(): FormulaDependencyTree[];
68
+ getTreeById(treeId: number): FormulaDependencyTree | undefined;
64
69
  buildDependencyTree(shouldBeBuildTrees: FormulaDependencyTree[], dependencyTrees?: FormulaDependencyTree[]): FormulaDependencyTree[];
65
- searchDependency(search: IUnitRange[]): Map<string, IRTreeItem>;
70
+ searchDependency(search: IUnitRange[]): Set<number>;
66
71
  /**
67
72
  * Build the dependency relationship between the trees.
68
73
  * @param allTrees all FormulaDependencyTree
@@ -84,23 +89,26 @@ export declare class DependencyManagerService extends Disposable implements IDep
84
89
  reset(): void;
85
90
  addOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string, dependencyTree: FormulaDependencyTree): void;
86
91
  removeOtherFormulaDependency(unitId: string, sheetId: string, formulaIds: string[]): void;
87
- getOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): Nullable<FormulaDependencyTree>;
92
+ getOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): FormulaDependencyTree | undefined;
88
93
  hasOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): boolean;
89
94
  clearOtherFormulaDependency(unitId: string, sheetId?: string): void;
90
95
  addFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string, dependencyTree: FormulaDependencyTree): void;
91
96
  removeFeatureFormulaDependency(unitId: string, sheetId: string, featureIds: string[]): void;
92
97
  clearFeatureFormulaDependency(unitId: string, sheetId?: string): void;
93
- getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): Nullable<FormulaDependencyTree>;
98
+ getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): FormulaDependencyTree | null | undefined;
94
99
  addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: FormulaDependencyTree): void;
95
100
  removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void;
96
101
  clearFormulaDependency(unitId: string, sheetId?: string): void;
97
102
  clearDependencyAll(): void;
98
- getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): Nullable<Nullable<FormulaDependencyTree>>;
103
+ getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): FormulaDependencyTree | null | undefined;
99
104
  addDependencyRTreeCache(tree: FormulaDependencyTree): void;
100
105
  private _restDependencyTreeId;
101
106
  getLastTreeId(): number;
102
107
  private _removeDependencyRTreeCacheById;
103
108
  private _removeDependencyRTreeCache;
104
109
  removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
110
+ openKdTree(): void;
111
+ closeKdTree(): void;
112
+ private _removeAllTreeMap;
105
113
  }
106
114
  export declare const IDependencyManagerService: import('@wendellhu/redi').IdentifierDecorator<DependencyManagerService>;
@@ -14,13 +14,14 @@ import { IFormulaCurrentConfigService } from './current-data.service';
14
14
  */
15
15
  export declare enum FormulaExecuteStageType {
16
16
  IDLE = 0,
17
- START_DEPENDENCY = 1,
18
- START_CALCULATION = 2,
19
- CURRENTLY_CALCULATING = 3,
20
- START_DEPENDENCY_ARRAY_FORMULA = 4,
21
- START_CALCULATION_ARRAY_FORMULA = 5,
22
- CURRENTLY_CALCULATING_ARRAY_FORMULA = 6,
23
- CALCULATION_COMPLETED = 7
17
+ START = 1,
18
+ START_DEPENDENCY = 2,
19
+ START_CALCULATION = 3,
20
+ CURRENTLY_CALCULATING = 4,
21
+ START_DEPENDENCY_ARRAY_FORMULA = 5,
22
+ START_CALCULATION_ARRAY_FORMULA = 6,
23
+ CURRENTLY_CALCULATING_ARRAY_FORMULA = 7,
24
+ CALCULATION_COMPLETED = 8
24
25
  }
25
26
  export declare enum FormulaExecutedStateType {
26
27
  INITIAL = 0,
@@ -134,6 +135,8 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
134
135
  enableCycleDependency(): void;
135
136
  disableCycleDependency(): void;
136
137
  isCycleDependency(): boolean;
138
+ setFormulaCycleIndex(index: number): void;
139
+ getFormulaCycleIndex(): number;
137
140
  setTotalArrayFormulasToCalculate(value: number): void;
138
141
  getTotalArrayFormulasToCalculate(): number;
139
142
  setCompletedArrayFormulasCount(value: number): void;
@@ -142,8 +145,6 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
142
145
  getTotalFormulasToCalculate(): number;
143
146
  setCompletedFormulasCount(value: number): void;
144
147
  getCompletedFormulasCount(): number;
145
- setFormulaCycleIndex(index: number): void;
146
- getFormulaCycleIndex(): number;
147
148
  markedAsSuccessfullyExecuted(): void;
148
149
  markedAsNoFunctionsExecuted(): void;
149
150
  markedAsStopFunctionsExecuted(): void;