@univerjs/engine-formula 0.12.3 → 0.12.4-experimental.20251210-8d33c6e
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 +344 -43
- package/lib/es/index.js +6652 -6254
- package/lib/facade.js +344 -43
- package/lib/index.js +6652 -6254
- package/lib/types/basics/common.d.ts +14 -0
- package/lib/types/basics/date.d.ts +0 -1
- package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +39 -2
- package/lib/types/controller/calculate.controller.d.ts +4 -0
- package/lib/types/engine/dependency/dependency-tree.d.ts +39 -0
- package/lib/types/engine/dependency/formula-dependency.d.ts +21 -2
- package/lib/types/facade/f-formula.d.ts +243 -2
- package/lib/types/index.d.ts +3 -3
- package/lib/types/services/calculate-formula.service.d.ts +15 -4
- package/lib/types/services/current-data.service.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
- package/LICENSE +0 -176
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("@univerjs/core/facade"),u=require("@univerjs/core"),r=require("@univerjs/engine-formula"),l=require("rxjs");var S=Object.getOwnPropertyDescriptor,f=(o,e,i,t)=>{for(var n=t>1?void 0:t?S(e,i):e,a=o.length-1,s;a>=0;a--)(s=o[a])&&(n=s(n)||n);return n},c=(o,e)=>(i,t)=>e(i,t,o);exports.FFormula=class extends m.FBase{constructor(e,i,t,n){super(),this._commandService=e,this._injector=i,this._lexerTreeBuilder=t,this._configService=n,this._initialize()}_initialize(){}get lexerTreeBuilder(){return this._lexerTreeBuilder}moveFormulaRefOffset(e,i,t,n){return this._lexerTreeBuilder.moveFormulaRefOffset(e,i,t,n)}sequenceNodesBuilder(e){return this._lexerTreeBuilder.sequenceNodesBuilder(e)||[]}executeCalculation(){this._commandService.executeCommand(r.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})}stopCalculation(){this._commandService.executeCommand(r.SetFormulaCalculationStopMutation.id,{})}calculationStart(e){return this._commandService.onCommandExecuted(i=>{if(i.id===r.SetFormulaCalculationStartMutation.id){const t=i.params;e(t.forceCalculation)}})}calculationEnd(e){return this._commandService.onCommandExecuted(i=>{if(i.id!==r.SetFormulaCalculationNotificationMutation.id)return;const t=i.params;t.functionsExecutedState!==void 0&&e(t.functionsExecutedState)})}whenComputingCompleteAsync(e){const i=this._injector.get(r.GlobalComputingStatusService);return i.computingStatus?Promise.resolve(!0):l.firstValueFrom(l.race(i.computingStatus$.pipe(l.filter(t=>t)),l.timer(e!=null?e:3e4).pipe(l.map(()=>!1))))}onCalculationEnd(){return new Promise((e,i)=>{const t=setTimeout(()=>{i(new Error("Calculation end timeout"))},3e4),n=this.calculationEnd(()=>{clearTimeout(t),n.dispose(),e()})})}calculationProcessing(e){return this._commandService.onCommandExecuted(i=>{if(i.id!==r.SetFormulaCalculationNotificationMutation.id)return;const t=i.params;t.stageInfo!==void 0&&e(t.stageInfo)})}setMaxIteration(e){this._configService.setConfig(r.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT,e)}calculationResultApplied(e){return this._commandService.onCommandExecuted(i=>{if(i.id!==r.SetFormulaCalculationResultMutation.id)return;const t=i.params;t!==void 0&&requestIdleCallback(()=>{e(t)})})}onCalculationResultApplied(){return new Promise((e,i)=>{let t=!1,n=!1;const a=setTimeout(()=>{d(),i(new Error("Calculation end timeout"))},3e4),s=setTimeout(()=>{t||(d(),e())},500),p=this.calculationProcessing(()=>{t||(t=!0,clearTimeout(s))}),C=this.calculationResultApplied(()=>{n||(n=!0,d(),e())});function d(){clearTimeout(a),clearTimeout(s),p.dispose(),C.dispose()}})}executeFormulas(e,i){this._commandService.executeCommand(r.SetFormulaStringBatchCalculationMutation.id,{formulas:e},{onlyLocal:!0});const t=this._commandService.onCommandExecuted(n=>{if(n.id!==r.SetFormulaStringBatchCalculationResultMutation.id)return;const a=n.params;a.result!=null&&i(a.result),t.dispose()})}getAllDependencyTrees(e){this._commandService.executeCommand(r.SetFormulaDependencyCalculationMutation.id,void 0,{onlyLocal:!0});const i=this._commandService.onCommandExecuted(t=>{if(t.id!==r.SetFormulaDependencyCalculationResultMutation.id)return;const n=t.params;n.result!=null&&e(n.result),i.dispose()})}getCellDependencyTree(e,i){this._commandService.executeCommand(r.SetCellFormulaDependencyCalculationMutation.id,e,{onlyLocal:!0});const t=this._commandService.onCommandExecuted(n=>{if(n.id!==r.SetCellFormulaDependencyCalculationResultMutation.id)return;const a=n.params;a.result!==void 0&&i(a.result),t.dispose()})}getRangeDependents(e,i){this._commandService.executeCommand(r.SetQueryFormulaDependencyMutation.id,{unitRanges:e},{onlyLocal:!0});const t=this._commandService.onCommandExecuted(n=>{if(n.id!==r.SetQueryFormulaDependencyResultMutation.id)return;const a=n.params;a.result!=null&&i(a.result),t.dispose()})}getInRangeFormulas(e,i){this._commandService.executeCommand(r.SetQueryFormulaDependencyMutation.id,{unitRanges:e,isInRange:!0},{onlyLocal:!0});const t=this._commandService.onCommandExecuted(n=>{if(n.id!==r.SetQueryFormulaDependencyResultMutation.id)return;const a=n.params;a.result!=null&&i(a.result),t.dispose()})}};exports.FFormula=f([c(0,u.Inject(u.ICommandService)),c(1,u.Inject(u.Injector)),c(2,u.Inject(r.LexerTreeBuilder)),c(3,u.IConfigService)],exports.FFormula);class F extends m.FUniver{getFormula(){return this._injector.createInstance(exports.FFormula)}}m.FUniver.extend(F);
|