@univerjs/sheets-formula 0.10.5 → 0.10.6-experimental.20250904-44da50e
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 +93 -47
- package/lib/es/index.js +1254 -1246
- package/lib/facade.js +93 -47
- package/lib/index.js +1254 -1246
- package/lib/types/facade/f-range.d.ts +30 -0
- package/lib/types/facade/f-workbook.d.ts +25 -0
- package/lib/types/facade/index.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -7
- package/LICENSE +0 -176
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ISheetFormulaError } from '@univerjs/engine-formula';
|
|
2
|
+
import { FRange } from '@univerjs/sheets/facade';
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export interface IFRangeEngineFormulaMixin {
|
|
7
|
+
/**
|
|
8
|
+
* Get formula errors in the current range
|
|
9
|
+
* @returns {ISheetFormulaError[]} Array of formula errors in the range
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const range = univerAPI.getActiveWorkbook()
|
|
13
|
+
* .getActiveSheet()
|
|
14
|
+
* .getRange('A1:B10');
|
|
15
|
+
* const errors = range.getFormulaError();
|
|
16
|
+
* console.log('Formula errors in range:', errors);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
getFormulaError(): ISheetFormulaError[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @ignore
|
|
23
|
+
*/
|
|
24
|
+
export declare class FRangeEngineFormulaMixin extends FRange implements IFRangeEngineFormulaMixin {
|
|
25
|
+
getFormulaError(): ISheetFormulaError[];
|
|
26
|
+
}
|
|
27
|
+
declare module '@univerjs/sheets/facade' {
|
|
28
|
+
interface FRange extends IFRangeEngineFormulaMixin {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ISheetFormulaError } from '@univerjs/engine-formula';
|
|
2
|
+
import { FWorkbook } from '@univerjs/sheets/facade';
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export interface IFWorkbookEngineFormulaMixin {
|
|
7
|
+
/**
|
|
8
|
+
* Get all formula errors in the workbook
|
|
9
|
+
* @returns {ISheetFormulaError[]} Array of formula errors
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
13
|
+
* const errors = fWorkbook.getAllFormulaError();
|
|
14
|
+
* console.log('Formula errors:', errors);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
getAllFormulaError(): ISheetFormulaError[];
|
|
18
|
+
}
|
|
19
|
+
export declare class FWorkbookEngineFormulaMixin extends FWorkbook implements IFWorkbookEngineFormulaMixin {
|
|
20
|
+
getAllFormulaError(): ISheetFormulaError[];
|
|
21
|
+
}
|
|
22
|
+
declare module '@univerjs/sheets/facade' {
|
|
23
|
+
interface FWorkbook extends IFWorkbookEngineFormulaMixin {
|
|
24
|
+
}
|
|
25
|
+
}
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,
|
|
1
|
+
(function(t,l){typeof exports=="object"&&typeof module<"u"?l(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula"),require("@univerjs/engine-formula/facade"),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/facade"],l):(t=typeof globalThis<"u"?globalThis:t||self,l(t.UniverCore,t.UniverCoreFacade,t.UniverEngineFormula,t.UniverSheetsFormula,t.UniverEngineFormulaFacade,t.UniverSheetsFacade))})(this,(function(t,l,g,i,x,m){"use strict";class k extends l.FUniver{_initialize(){this._debouncedFormulaCalculation=t.debounce(()=>{this._commandService.executeCommand(g.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(n){let c=this._injector.get(i.IRegisterFunctionService);c||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),c=this._injector.get(i.IRegisterFunctionService));const e=c.registerFunctions(n);return this._debouncedFormulaCalculation(),e}}l.FUniver.extend(k);class R extends x.FFormula{_initialize(){this._debouncedFormulaCalculation=t.debounce(()=>{this._commandService.executeCommand(g.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(n){const e=this._injector.get(t.LifecycleService).stage,o=this._injector.get(t.ILogService),s=this._injector.get(t.IConfigService);e>t.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=s.getConfig(i.PLUGIN_CONFIG_KEY_BASE);if(!r){s.setConfig(i.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:n});return}r.initialFormulaComputing=n}registerFunction(n,c,e){var a;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const s={name:n,func:c,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerFunction(s);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(n,c,e){var a;let o=this._injector.get(i.IRegisterFunctionService);o||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),o=this._injector.get(i.IRegisterFunctionService));const s={name:n,func:c,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=o.registerAsyncFunction(s);return this._debouncedFormulaCalculation(),r}}x.FFormula.extend(R);class b{get CalculationMode(){return i.CalculationMode}}l.FEnum.extend(b);class E extends m.FWorkbook{getAllFormulaError(){const n=[],c=this._workbook,e=c.getUnitId(),o=c.getSheets(),s=this._injector.get(g.FormulaDataModel).getArrayFormulaCellData();return o.forEach(r=>{var C;const a=r.getName(),j=r.getSheetId(),I=r.getCellMatrix(),F=((C=s==null?void 0:s[e])==null?void 0:C[j])||{};I.forValue((_,h,f)=>{var v;if(!f)return;const d=(v=F==null?void 0:F[_])==null?void 0:v[h],u=g.extractFormulaError(f,!!d);u&&n.push({sheetName:a,row:_,column:h,formula:f.f||"",errorType:u})})}),n}}m.FWorkbook.extend(E);class U extends m.FRange{getFormulaError(){var h,f;const n=[],c=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),o=this._worksheet.getName(),s=this._workbook.getSheetBySheetId(e);if(!s)return n;const r=this._injector.get(g.FormulaDataModel).getArrayFormulaCellData(),a=((h=r==null?void 0:r[c])==null?void 0:h[e])||{},j=s.getCellMatrix(),{startRow:I,endRow:F,startColumn:C,endColumn:_}=this._range;for(let d=I;d<=F;d++)for(let u=C;u<=_;u++){const v=j.getValue(d,u);if(!v)continue;const M=(f=a==null?void 0:a[d])==null?void 0:f[u],y=g.extractFormulaError(v,!!M);y&&n.push({sheetName:o,row:d,column:u,formula:v.f||"",errorType:y})}return n}}m.FRange.extend(U)}));
|