@univerjs/sheets-formula 0.13.0-insiders.20251220-0a5ea4d → 0.13.0-insiders.20251223-857805c
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +7 -7
- package/lib/es/index.js +1664 -1505
- package/lib/facade.js +7 -7
- package/lib/index.js +1664 -1505
- package/lib/types/commands/mutations/formula.mutation.d.ts +9 -0
- package/lib/types/controllers/trigger-calculation.controller.d.ts +6 -1
- package/lib/types/index.d.ts +3 -0
- package/lib/types/services/formula-common.d.ts +18 -0
- package/lib/types/services/register-other-formula.service.d.ts +32 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const d=require("@univerjs/core"),x=require("@univerjs/core/facade"),F=require("@univerjs/engine-formula"),i=require("@univerjs/sheets-formula"),y=require("@univerjs/engine-formula/facade"),C=require("@univerjs/sheets/facade");class R extends x.FUniver{_initialize(){this._debouncedFormulaCalculation=d.debounce(()=>{this._commandService.executeCommand(F.
|
|
1
|
+
"use strict";const d=require("@univerjs/core"),x=require("@univerjs/core/facade"),F=require("@univerjs/engine-formula"),i=require("@univerjs/sheets-formula"),y=require("@univerjs/engine-formula/facade"),C=require("@univerjs/sheets/facade");class R extends x.FUniver{_initialize(){this._debouncedFormulaCalculation=d.debounce(()=>{this._commandService.executeCommand(F.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(t){let n=this._injector.get(i.IRegisterFunctionService);n||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),n=this._injector.get(i.IRegisterFunctionService));const e=n.registerFunctions(t);return this._debouncedFormulaCalculation(),e}}x.FUniver.extend(R);class j extends y.FFormula{_initialize(){this._debouncedFormulaCalculation=d.debounce(()=>{this._commandService.executeCommand(F.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){const e=this._injector.get(d.LifecycleService).stage,o=this._injector.get(d.ILogService),c=this._injector.get(d.IConfigService);e>d.LifecycleStages.Starting&&o.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=c.getConfig(i.PLUGIN_CONFIG_KEY_BASE);if(!r){c.setConfig(i.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}r.initialFormulaComputing=t}registerFunction(t,n,e){var s;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const c={name:t,func:n,description:typeof e=="string"?e:(s=e==null?void 0:e.description)!=null?s:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerFunction(c);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(t,n,e){var s;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const c={name:t,func:n,description:typeof e=="string"?e:(s=e==null?void 0:e.description)!=null?s:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerAsyncFunction(c);return this._debouncedFormulaCalculation(),r}}y.FFormula.extend(j);class M{get CalculationMode(){return i.CalculationMode}}x.FEnum.extend(M);class E extends C.FWorkbook{getAllFormulaError(){const t=[],n=this._workbook,e=n.getUnitId(),o=n.getSheets(),c=this._injector.get(F.FormulaDataModel).getArrayFormulaCellData();return o.forEach(r=>{var S;const s=r.getName(),v=r.getSheetId(),I=r.getCellMatrix(),m=((S=c==null?void 0:c[e])==null?void 0:S[v])||{};I.forValue((_,h,u)=>{var g;if(!u)return;const l=(g=m==null?void 0:m[_])==null?void 0:g[h],a=F.extractFormulaError(u,!!l);a&&t.push({sheetName:s,row:_,column:h,formula:u.f||"",errorType:a})})}),t}}C.FWorkbook.extend(E);class w extends C.FRange{getFormulaError(){var h,u;const t=[],n=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),o=this._worksheet.getName(),c=this._workbook.getSheetBySheetId(e);if(!c)return t;const r=this._injector.get(F.FormulaDataModel).getArrayFormulaCellData(),s=((h=r==null?void 0:r[n])==null?void 0:h[e])||{},v=c.getCellMatrix(),{startRow:I,endRow:m,startColumn:S,endColumn:_}=this._range;for(let l=I;l<=m;l++)for(let a=S;a<=_;a++){const g=v.getValue(l,a);if(!g)continue;const k=(u=s==null?void 0:s[l])==null?void 0:u[a],b=F.extractFormulaError(g,!!k);b&&t.push({sheetName:o,row:l,column:a,formula:g.f||"",errorType:b})}return t}}C.FRange.extend(w);
|