@univerjs/sheets-formula 0.17.0 → 0.18.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.
Files changed (118) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -170
  16. package/lib/es/index.js +1 -16600
  17. package/lib/es/locale/ca-ES.js +1 -14
  18. package/lib/es/locale/en-US.js +1 -14
  19. package/lib/es/locale/es-ES.js +1 -14
  20. package/lib/es/locale/fa-IR.js +1 -14
  21. package/lib/es/locale/fr-FR.js +1 -14
  22. package/lib/es/locale/ja-JP.js +1 -14
  23. package/lib/es/locale/ko-KR.js +1 -14
  24. package/lib/es/locale/ru-RU.js +1 -14
  25. package/lib/es/locale/sk-SK.js +1 -14
  26. package/lib/es/locale/vi-VN.js +1 -14
  27. package/lib/es/locale/zh-CN.js +1 -14
  28. package/lib/es/locale/zh-TW.js +1 -14
  29. package/lib/facade.js +1 -170
  30. package/lib/index.js +1 -16600
  31. package/lib/locale/ca-ES.js +1 -14
  32. package/lib/locale/en-US.js +1 -14
  33. package/lib/locale/es-ES.js +1 -14
  34. package/lib/locale/fa-IR.js +1 -14
  35. package/lib/locale/fr-FR.js +1 -14
  36. package/lib/locale/ja-JP.js +1 -14
  37. package/lib/locale/ko-KR.js +1 -14
  38. package/lib/locale/ru-RU.js +1 -14
  39. package/lib/locale/sk-SK.js +1 -14
  40. package/lib/locale/vi-VN.js +1 -14
  41. package/lib/locale/zh-CN.js +1 -14
  42. package/lib/locale/zh-TW.js +1 -14
  43. package/lib/types/commands/commands/insert-function.command.d.ts +16 -1
  44. package/lib/types/commands/commands/quick-sum.command.d.ts +16 -1
  45. package/lib/types/config/config.d.ts +17 -2
  46. package/lib/types/controllers/active-dirty.controller.d.ts +15 -0
  47. package/lib/types/controllers/array-formula-cell-interceptor.controller.d.ts +15 -0
  48. package/lib/types/controllers/defined-name.controller.d.ts +15 -0
  49. package/lib/types/controllers/formula-auto-fill.controller.d.ts +16 -1
  50. package/lib/types/controllers/formula.controller.d.ts +15 -0
  51. package/lib/types/controllers/image-formula-cell-interceptor.controller.d.ts +15 -0
  52. package/lib/types/controllers/super-table.controller.d.ts +15 -0
  53. package/lib/types/controllers/trigger-calculation.controller.d.ts +16 -1
  54. package/lib/types/controllers/update-defined-name.controller.d.ts +15 -0
  55. package/lib/types/controllers/update-formula.controller.d.ts +15 -0
  56. package/lib/types/controllers/utils/offset-formula-data.d.ts +17 -2
  57. package/lib/types/controllers/utils/ref-range-formula.d.ts +17 -2
  58. package/lib/types/controllers/utils/ref-range-move.d.ts +17 -2
  59. package/lib/types/controllers/utils/ref-range-param.d.ts +17 -2
  60. package/lib/types/facade/f-enum.d.ts +15 -0
  61. package/lib/types/facade/f-formula.d.ts +18 -3
  62. package/lib/types/facade/f-range.d.ts +16 -1
  63. package/lib/types/facade/f-univer.d.ts +17 -2
  64. package/lib/types/facade/f-workbook.d.ts +16 -1
  65. package/lib/types/locale/ca-ES.d.ts +16 -1
  66. package/lib/types/locale/es-ES.d.ts +16 -1
  67. package/lib/types/locale/fa-IR.d.ts +16 -1
  68. package/lib/types/locale/fr-FR.d.ts +16 -1
  69. package/lib/types/locale/ja-JP.d.ts +16 -1
  70. package/lib/types/locale/ko-KR.d.ts +16 -1
  71. package/lib/types/locale/ru-RU.d.ts +16 -1
  72. package/lib/types/locale/sk-SK.d.ts +16 -1
  73. package/lib/types/locale/vi-VN.d.ts +16 -1
  74. package/lib/types/locale/zh-CN.d.ts +16 -1
  75. package/lib/types/locale/zh-TW.d.ts +16 -1
  76. package/lib/types/plugin.d.ts +16 -1
  77. package/lib/types/services/description.service.d.ts +20 -3
  78. package/lib/types/services/formula-ref-range.service.d.ts +19 -2
  79. package/lib/types/services/function-list/array.d.ts +16 -1
  80. package/lib/types/services/function-list/compatibility.d.ts +16 -1
  81. package/lib/types/services/function-list/cube.d.ts +16 -1
  82. package/lib/types/services/function-list/database.d.ts +16 -1
  83. package/lib/types/services/function-list/date.d.ts +16 -1
  84. package/lib/types/services/function-list/engineering.d.ts +16 -1
  85. package/lib/types/services/function-list/financial.d.ts +16 -1
  86. package/lib/types/services/function-list/function-list.d.ts +16 -1
  87. package/lib/types/services/function-list/information.d.ts +16 -1
  88. package/lib/types/services/function-list/logical.d.ts +16 -1
  89. package/lib/types/services/function-list/lookup.d.ts +16 -1
  90. package/lib/types/services/function-list/math.d.ts +16 -1
  91. package/lib/types/services/function-list/statistical.d.ts +16 -1
  92. package/lib/types/services/function-list/text.d.ts +16 -1
  93. package/lib/types/services/function-list/univer.d.ts +16 -1
  94. package/lib/types/services/function-list/web.d.ts +16 -1
  95. package/lib/types/services/register-function.service.d.ts +20 -3
  96. package/lib/types/services/remote/remote-register-function.service.d.ts +16 -1
  97. package/lib/types/services/utils.d.ts +17 -2
  98. package/lib/types/util/calculate.d.ts +17 -2
  99. package/lib/umd/facade.js +1 -1
  100. package/lib/umd/index.js +1 -1
  101. package/lib/umd/locale/ca-ES.js +1 -1
  102. package/lib/umd/locale/en-US.js +1 -1
  103. package/lib/umd/locale/es-ES.js +1 -1
  104. package/lib/umd/locale/fa-IR.js +1 -1
  105. package/lib/umd/locale/fr-FR.js +1 -1
  106. package/lib/umd/locale/ja-JP.js +1 -1
  107. package/lib/umd/locale/ko-KR.js +1 -1
  108. package/lib/umd/locale/ru-RU.js +1 -1
  109. package/lib/umd/locale/sk-SK.js +1 -1
  110. package/lib/umd/locale/vi-VN.js +1 -1
  111. package/lib/umd/locale/zh-CN.js +1 -1
  112. package/lib/umd/locale/zh-TW.js +1 -1
  113. package/package.json +12 -11
  114. package/lib/types/services/__test__/description.service.spec.d.ts +0 -16
  115. package/lib/types/services/__test__/formula-ref.spec.d.ts +0 -16
  116. package/lib/types/services/__test__/register-function.service.spec.d.ts +0 -16
  117. package/lib/types/services/__test__/util.d.ts +0 -7
  118. package/lib/types/services/__test__/utils.spec.d.ts +0 -16
@@ -1,2 +1,17 @@
1
- import { IFunctionInfo } from '@univerjs/engine-formula';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IFunctionInfo } from '@univerjs/engine-formula';
2
17
  export declare const FUNCTION_LIST_UNIVER: IFunctionInfo[];
@@ -1,2 +1,17 @@
1
- import { IFunctionInfo } from '@univerjs/engine-formula';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IFunctionInfo } from '@univerjs/engine-formula';
2
17
  export declare const FUNCTION_LIST_WEB: IFunctionInfo[];
@@ -1,5 +1,22 @@
1
- import { IDisposable, ILocales, Disposable, LocaleService } from '@univerjs/core';
2
- import { FormulaFunctionResultValueType, FormulaFunctionValueType, IFunctionInfo, IFunctionService } from '@univerjs/engine-formula';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IDisposable, ILocales } from '@univerjs/core';
17
+ import type { FormulaFunctionResultValueType, FormulaFunctionValueType, IFunctionInfo } from '@univerjs/engine-formula';
18
+ import { Disposable, LocaleService } from '@univerjs/core';
19
+ import { IFunctionService } from '@univerjs/engine-formula';
3
20
  import { IDescriptionService } from './description.service';
4
21
  import { IRemoteRegisterFunctionService } from './remote/remote-register-function.service';
5
22
  export type IRegisterFunction = (...arg: Array<FormulaFunctionValueType>) => FormulaFunctionResultValueType;
@@ -62,7 +79,7 @@ export interface IRegisterFunctionService {
62
79
  */
63
80
  registerAsyncFunction(params: ISingleFunctionRegisterParams): IDisposable;
64
81
  }
65
- export declare const IRegisterFunctionService: import('@wendellhu/redi').IdentifierDecorator<IRegisterFunctionService>;
82
+ export declare const IRegisterFunctionService: import("@wendellhu/redi").IdentifierDecorator<IRegisterFunctionService>;
66
83
  export interface ISingleFunctionRegisterParams {
67
84
  /**
68
85
  * function name
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ */
1
16
  import { IFunctionService } from '@univerjs/engine-formula';
2
17
  export interface IRemoteRegisterFunctionService {
3
18
  registerFunctions(serializedFuncs: Array<[string, string]>): Promise<void>;
@@ -5,7 +20,7 @@ export interface IRemoteRegisterFunctionService {
5
20
  unregisterFunctions(names: string[]): Promise<void>;
6
21
  }
7
22
  export declare const RemoteRegisterFunctionServiceName = "sheets-formula.remote-register-function.service";
8
- export declare const IRemoteRegisterFunctionService: import('@wendellhu/redi').IdentifierDecorator<IRemoteRegisterFunctionService>;
23
+ export declare const IRemoteRegisterFunctionService: import("@wendellhu/redi").IdentifierDecorator<IRemoteRegisterFunctionService>;
9
24
  /**
10
25
  * This class should resident in the remote process.
11
26
  */
@@ -1,4 +1,19 @@
1
- import { LocaleService } from '@univerjs/core';
2
- import { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { LocaleService } from '@univerjs/core';
17
+ import type { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
3
18
  export declare function getFunctionName(item: IFunctionInfo, localeService: LocaleService): string;
4
19
  export declare function generateParam(param: IFunctionParam): string | undefined;
@@ -1,3 +1,18 @@
1
- import { Injector } from '@univerjs/core';
2
- import { ISheetData } from '@univerjs/engine-formula';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { Injector } from '@univerjs/core';
17
+ import type { ISheetData } from '@univerjs/engine-formula';
3
18
  export declare function calculateFormula(inject: Injector, formulaString: string, unitId: string, sheetData: ISheetData): string | number | boolean | (string | number | boolean | null)[][];
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(c,f){typeof exports=="object"&&typeof module<"u"?f(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula"),require("@univerjs/engine-formula/facade"),require("@univerjs/sheets"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/engine-formula","@univerjs/sheets-formula","@univerjs/engine-formula/facade","@univerjs/sheets","@univerjs/sheets/facade"],f):(c=typeof globalThis<"u"?globalThis:c||self,f(c.UniverCore,c.UniverCoreFacade,c.UniverEngineFormula,c.UniverSheetsFormula,c.UniverEngineFormulaFacade,c.UniverSheets,c.UniverSheetsFacade))})(this,(function(c,f,u,s,I,y,j){"use strict";class p extends f.FUniver{_initialize(){this._debouncedFormulaCalculation=c.debounce(()=>{this._commandService.executeCommand(u.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(t){let o=this._injector.get(s.IRegisterFunctionService);o||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),o=this._injector.get(s.IRegisterFunctionService));const e=o.registerFunctions(t);return this._debouncedFormulaCalculation(),e}}f.FUniver.extend(p);class k extends I.FFormula{_initialize(){this._debouncedFormulaCalculation=c.debounce(()=>{this._commandService.executeCommand(u.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){const e=this._injector.get(c.LifecycleService).stage,n=this._injector.get(c.ILogService),i=this._injector.get(c.IConfigService);e>c.LifecycleStages.Starting&&n.warn("[FFormula]","CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");const r=i.getConfig(s.PLUGIN_CONFIG_KEY_BASE);if(!r){i.setConfig(s.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}r.initialFormulaComputing=t}registerFunction(t,o,e){var a;let n=this._injector.get(s.IRegisterFunctionService);n||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),n=this._injector.get(s.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerFunction(i);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(t,o,e){var a;let n=this._injector.get(s.IRegisterFunctionService);n||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),n=this._injector.get(s.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerAsyncFunction(i);return this._debouncedFormulaCalculation(),r}calculationResultApplied(t){let o=!1,e=!1,n=null;return this._commandService.onCommandExecuted((i,r)=>{i.id!==u.SetFormulaCalculationResultMutation.id&&i.id!==y.SetRangeValuesMutation.id||(i.id===u.SetFormulaCalculationResultMutation.id&&(o=!0,n=i.params),i.id===y.SetRangeValuesMutation.id&&(r!=null&&r.applyFormulaCalculationResult)&&(e=!0),!(!o||!e)&&requestIdleCallback(()=>{t(n)}))})}onCalculationResultApplied(){return new Promise((t,o)=>{let e=!1,n=!1;const i=setTimeout(()=>{l(),o(new Error("Calculation end timeout"))},6e4),r=setTimeout(()=>{e||(l(),t())},500),a=this.calculationProcessing(g=>{const{stage:h,totalArrayFormulasToCalculate:S,totalFormulasToCalculate:m}=g;if(h===u.FormulaExecuteStageType.START_CALCULATION&&S+m===0){l(),t();return}e||(e=!0,clearTimeout(r))}),_=this.calculationResultApplied(()=>{n||(n=!0,l(),t())});function l(){clearTimeout(i),clearTimeout(r),a.dispose(),_.dispose()}})}}I.FFormula.extend(k);class b{get CalculationMode(){return s.CalculationMode}}f.FEnum.extend(b);class E extends j.FWorkbook{getAllFormulaError(){const t=[],o=this._workbook,e=o.getUnitId(),n=o.getSheets(),i=this._injector.get(u.FormulaDataModel).getArrayFormulaCellData();return n.forEach(r=>{var h;const a=r.getName(),_=r.getSheetId(),l=r.getCellMatrix(),g=((h=i==null?void 0:i[e])==null?void 0:h[_])||{};l.forValue((S,m,v)=>{var C;if(!v)return;const F=(C=g==null?void 0:g[S])==null?void 0:C[m],d=u.extractFormulaError(v,!!F);d&&t.push({sheetName:a,row:S,column:m,formula:v.f||"",errorType:d})})}),t}}j.FWorkbook.extend(E);class M extends j.FRange{getFormulaError(){var m,v;const t=[],o=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),n=this._worksheet.getName(),i=this._workbook.getSheetBySheetId(e);if(!i)return t;const r=this._injector.get(u.FormulaDataModel).getArrayFormulaCellData(),a=((m=r==null?void 0:r[o])==null?void 0:m[e])||{},_=i.getCellMatrix(),{startRow:l,endRow:g,startColumn:h,endColumn:S}=this._range;for(let F=l;F<=g;F++)for(let d=h;d<=S;d++){const C=_.getValue(F,d);if(!C)continue;const T=(v=a==null?void 0:a[F])==null?void 0:v[d],x=u.extractFormulaError(C,!!T);x&&t.push({sheetName:n,row:F,column:d,formula:C.f||"",errorType:x})}return t}}j.FRange.extend(M)}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(require(`@univerjs/core`),require(`@univerjs/core/facade`),require(`@univerjs/engine-formula`),require(`@univerjs/sheets-formula`),require(`@univerjs/engine-formula/facade`),require(`@univerjs/sheets`),require(`@univerjs/sheets/facade`)):typeof define==`function`&&define.amd?define([`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/engine-formula`,`@univerjs/sheets-formula`,`@univerjs/engine-formula/facade`,`@univerjs/sheets`,`@univerjs/sheets/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore,e.UniverCoreFacade,e.UniverEngineFormula,e.UniverSheetsFormula,e.UniverEngineFormulaFacade,e.UniverSheets,e.UniverSheetsFacade))})(this,function(e,t,n,r,i,a,o){var s=class extends t.FUniver{_initialize(){this._debouncedFormulaCalculation=(0,e.debounce)(()=>{this._commandService.executeCommand(n.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(e){let t=this._injector.get(r.IRegisterFunctionService);t||(this._injector.add([r.IRegisterFunctionService,{useClass:r.RegisterFunctionService}]),t=this._injector.get(r.IRegisterFunctionService));let n=t.registerFunctions(e);return this._debouncedFormulaCalculation(),n}};t.FUniver.extend(s);var c=class extends i.FFormula{_initialize(){this._debouncedFormulaCalculation=(0,e.debounce)(()=>{this._commandService.executeCommand(n.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){let n=this._injector.get(e.LifecycleService).stage,i=this._injector.get(e.ILogService),a=this._injector.get(e.IConfigService);n>e.LifecycleStages.Starting&&i.warn(`[FFormula]`,`CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.`);let o=a.getConfig(r.PLUGIN_CONFIG_KEY_BASE);if(!o){a.setConfig(r.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}o.initialFormulaComputing=t}registerFunction(e,t,n){var i;let a=this._injector.get(r.IRegisterFunctionService);a||(this._injector.add([r.IRegisterFunctionService,{useClass:r.RegisterFunctionService}]),a=this._injector.get(r.IRegisterFunctionService));let o={name:e,func:t,description:typeof n==`string`?n:(i=n==null?void 0:n.description)==null?``:i,locales:typeof n==`object`?n.locales:void 0},s=a.registerFunction(o);return this._debouncedFormulaCalculation(),s}registerAsyncFunction(e,t,n){var i;let a=this._injector.get(r.IRegisterFunctionService);a||(this._injector.add([r.IRegisterFunctionService,{useClass:r.RegisterFunctionService}]),a=this._injector.get(r.IRegisterFunctionService));let o={name:e,func:t,description:typeof n==`string`?n:(i=n==null?void 0:n.description)==null?``:i,locales:typeof n==`object`?n.locales:void 0},s=a.registerAsyncFunction(o);return this._debouncedFormulaCalculation(),s}calculationResultApplied(e){let t=!1,r=!1,i=null;return this._commandService.onCommandExecuted((o,s)=>{o.id!==n.SetFormulaCalculationResultMutation.id&&o.id!==a.SetRangeValuesMutation.id||(o.id===n.SetFormulaCalculationResultMutation.id&&(t=!0,i=o.params),o.id===a.SetRangeValuesMutation.id&&s!=null&&s.applyFormulaCalculationResult&&(r=!0),!(!t||!r)&&requestIdleCallback(()=>{e(i)}))})}onCalculationResultApplied(){return new Promise((e,t)=>{let r=!1,i=!1,a=setTimeout(()=>{l(),t(Error(`Calculation end timeout`))},6e4),o=setTimeout(()=>{r||(l(),e())},500),s=this.calculationProcessing(t=>{let{stage:i,totalArrayFormulasToCalculate:a,totalFormulasToCalculate:s}=t;if(i===n.FormulaExecuteStageType.START_CALCULATION&&a+s===0){l(),e();return}r||(r=!0,clearTimeout(o))}),c=this.calculationResultApplied(()=>{i||(i=!0,l(),e())});function l(){clearTimeout(a),clearTimeout(o),s.dispose(),c.dispose()}})}};i.FFormula.extend(c);var l=class{get CalculationMode(){return r.CalculationMode}};t.FEnum.extend(l);var u=class extends o.FWorkbook{getAllFormulaError(){let e=[],t=this._workbook,r=t.getUnitId(),i=t.getSheets(),a=this._injector.get(n.FormulaDataModel).getArrayFormulaCellData();return i.forEach(t=>{var i;let o=t.getName(),s=t.getSheetId(),c=t.getCellMatrix(),l=(a==null||(i=a[r])==null?void 0:i[s])||{};c.forValue((t,r,i)=>{var a;if(!i)return;let s=(0,n.extractFormulaError)(i,!!(!(l==null||(a=l[t])==null)&&a[r]));s&&e.push({sheetName:o,row:t,column:r,formula:i.f||``,errorType:s})})}),e}};o.FWorkbook.extend(u);var d=class extends o.FRange{getFormulaError(){var e;let t=[],r=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),a=this._worksheet.getName(),o=this._workbook.getSheetBySheetId(i);if(!o)return t;let s=this._injector.get(n.FormulaDataModel).getArrayFormulaCellData(),c=(s==null||(e=s[r])==null?void 0:e[i])||{},l=o.getCellMatrix(),{startRow:u,endRow:d,startColumn:f,endColumn:p}=this._range;for(let e=u;e<=d;e++)for(let r=f;r<=p;r++){var m;let i=l.getValue(e,r);if(!i)continue;let o=(0,n.extractFormulaError)(i,!!(!(c==null||(m=c[e])==null)&&m[r]));o&&t.push({sheetName:a,row:e,column:r,formula:i.f||``,errorType:o})}return t}};o.FRange.extend(d)});