Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(sheets): register other formula (#2045)

zhangw4a8ffd944cc1
diff --git a/packages/data-validation/src/index.ts b/packages/data-validation/src/index.ts
index eed40351c5..b9753b37fc 100644
--- a/packages/data-validation/src/index.ts
+++ b/packages/data-validation/src/index.ts
@@ -67,5 +67,4 @@ export { removeDataValidationUndoFactory } from './commands/commands/data-valida
export { TWO_FORMULA_OPERATOR_COUNT } from './types/const/two-formula-operators';
export { DataValidationResourceController } from './controllers/dv-resource.controller';
export { DataValidationSheetController } from './controllers/dv-sheet.controller';
-export { DataValidationFormulaMarkDirty, type IDataValidationFormulaMarkDirtyParams } from './commands/mutations/formula.mutation';
export { TextLengthErrorTitleMap } from './types/const/operator-text-map';
diff --git a/packages/data-validation/src/plugin.ts b/packages/data-validation/src/plugin.ts
index 5578b6be53..ff105c6a74 100644
--- a/packages/data-validation/src/plugin.ts
+++ b/packages/data-validation/src/plugin.ts
@@ -23,7 +23,6 @@ import { AddDataValidationCommand, RemoveAllDataValidationCommand, RemoveDataVal
import { AddDataValidationMutation, RemoveDataValidationMutation, UpdateDataValidationMutation } from './commands/mutations/data-validation.mutation';
import { DataValidationResourceController } from './controllers/dv-resource.controller';
import { DataValidationSheetController } from './controllers/dv-sheet.controller';
-import { DataValidationFormulaMarkDirty } from './commands/mutations/formula.mutation';
const PLUGIN_NAME = 'data-validation';
@@ -63,7 +62,6 @@ export class UniverDataValidationPlugin extends Plugin {
RemoveDataValidationCommand,
// mutation
- DataValidationFormulaMarkDirty,
AddDataValidationMutation,
UpdateDataValidationMutation,
RemoveDataValidationMutation,
diff --git a/packages/sheets-data-validation/src/index.ts b/packages/sheets-data-validation/src/index.ts
index 033708efd4..6cd0a2c6dc 100644
--- a/packages/sheets-data-validation/src/index.ts
+++ b/packages/sheets-data-validation/src/index.ts
@@ -25,7 +25,6 @@ export { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, Up
export { DataValidationCacheService } from './services/dv-cache.service';
export { DataValidationFormulaService } from './services/dv-formula.service';
export { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
-export { RegisterOtherFormulaService } from './services/register-formula.service';
export { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
export { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
export { DataValidationAutoFillController } from './controllers/dv-auto-fill.controller';
diff --git a/packages/sheets-data-validation/src/plugin.ts b/packages/sheets-data-validation/src/plugin.ts
index ad5ffc4d3a..a162a4d0e6 100644
--- a/packages/sheets-data-validation/src/plugin.ts
+++ b/packages/sheets-data-validation/src/plugin.ts
@@ -24,7 +24,6 @@ import { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, Up
import { DataValidationCacheService } from './services/dv-cache.service';
import { DataValidationFormulaService } from './services/dv-formula.service';
import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
-import { RegisterOtherFormulaService } from './services/register-formula.service';
import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
import { enUS, zhCN } from './locale';
import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
@@ -56,7 +55,6 @@ export class UniverSheetsDataValidationPlugin extends Plugin {
[DataValidationCacheService],
[DataValidationFormulaService],
[DataValidationCustomFormulaService],
- [RegisterOtherFormulaService],
[DataValidationDropdownManagerService],
// controller
diff --git a/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts b/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts
index 2d9f7bc39d..ab39e8a7bc 100644
--- a/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts
+++ b/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts
@@ -15,11 +15,11 @@
*/
import type { IRange, ISheetDataValidationRule } from '@univerjs/core';
-import { DataValidationType, Disposable, isFormulaString, IUniverInstanceService, ObjectMatrix, Range } from '@univerjs/core';
+import { DataValidationType, Disposable, isFormulaString, ObjectMatrix, Range } from '@univerjs/core';
import { isFormulaTransformable, LexerTreeBuilder, transformFormula } from '@univerjs/engine-formula';
import { Inject } from '@wendellhu/redi';
import { DataValidationModel } from '@univerjs/data-validation';
-import { RegisterOtherFormulaService } from './register-formula.service';
+import { RegisterOtherFormulaService } from '@univerjs/sheets-formula';
import { DataValidationCacheService } from './dv-cache.service';
interface IDataValidationFormula {
@@ -63,7 +63,6 @@ export class DataValidationCustomFormulaService extends Disposable {
constructor(
@Inject(RegisterOtherFormulaService) private _registerOtherFormulaService: RegisterOtherFormulaService,
@Inject(LexerTreeBuilder) private _lexerTreeBuilder: LexerTreeBuilder,
- @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
@Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
@Inject(DataValidationCacheService) private readonly _dataValidationCacheService: DataValidationCacheService
) {
@@ -81,9 +80,9 @@ export class DataValidationCustomFormulaService extends Disposable {
const { formulaCellMap, ruleFormulaMap } = this._ensureMaps(unitId, subUnitId);
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
results.forEach((result) => {
- const ruleInfo = ruleFormulaMap.get(result.ruleId);
+ const ruleInfo = ruleFormulaMap.get(result.extra?.ruleId);
const cellInfo = formulaCellMap.get(result.formulaId);
- const rule = manager.getRuleById(result.ruleId);
+ const rule = manager.getRuleById(result.extra?.ruleId);
if (rule && ruleInfo && !ruleInfo.isTransformable) {
this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
@@ -125,14 +124,6 @@ export class DataValidationCustomFormulaService extends Disposable {
formulaCellMap = new Map();
formulaCellUnitMap.set(subUnitId, formulaCellMap);
-
- // if (rules) {
- // rules.forEach((rule) => {
- // if (rule.type === DataValidationType.CUSTOM) {
- // this.addRule(unitId, subUnitId, rule);
- // }
- // });
- // }
}
return {
formulaMap,
@@ -142,7 +133,7 @@ export class DataValidationCustomFormulaService extends Disposable {
};
private _registerFormula(unitId: string, subUnitId: string, ruleId: string, formulaString: string) {
- return this._registerOtherFormulaService.registerFormula(unitId, subUnitId, ruleId, formulaString);
+ return this._registerOtherFormulaService.registerFormula(unitId, subUnitId, formulaString, { ruleId });
};
deleteByRuleId(unitId: string, subUnitId: string, ruleId: string) {
diff --git a/packages/sheets-data-validation/src/services/dv-formula.service.ts b/packages/sheets-data-validation/src/services/dv-formula.service.ts
index 4596c155eb..b90c3b42e0 100644
--- a/packages/sheets-data-validation/src/services/dv-formula.service.ts
+++ b/packages/sheets-data-validation/src/services/dv-formula.service.ts
@@ -18,8 +18,8 @@ import type { Nullable } from '@univerjs/core';
import { Disposable, isFormulaString } from '@univerjs/core';
import { Inject } from '@wendellhu/redi';
import { DataValidationModel } from '@univerjs/data-validation';
-import type { IDataValidationFormulaResult, IFormulaInfo } from './formula-common';
-import { RegisterOtherFormulaService } from './register-formula.service';
+import type { IFormulaInfo, IOtherFormulaResult } from '@univerjs/sheets-formula';
+import { RegisterOtherFormulaService } from '@univerjs/sheets-formula';
import { DataValidationCacheService } from './dv-cache.service';
type RuleId = string;
@@ -31,7 +31,6 @@ export class DataValidationFormulaService extends Disposable {
constructor(
@Inject(RegisterOtherFormulaService) private _registerOtherFormulaService: RegisterOtherFormulaService,
- // @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
@Inject(DataValidationCacheService) private readonly _dataValidationCacheService: DataValidationCacheService,
@Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel
) {
@@ -48,8 +47,8 @@ export class DataValidationFormulaService extends Disposable {
const formulaMap = this._ensureRuleFormulaMap(unitId, subUnitId);
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
results.forEach((result) => {
- if (formulaMap.get(result.ruleId)) {
- const rule = manager.getRuleById(result.ruleId);
+ if (formulaMap.get(result.extra?.ruleId)) {
+ const rule = manager.getRuleById(result.extra?.ruleId);
if (rule) {
this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
}
@@ -73,15 +72,6 @@ export class DataValidationFormulaService extends Disposable {
if (!subUnitMap) {
subUnitMap = new Map();
unitMap.set(subUnitId, subUnitMap);
- // const worksheet = this._univerInstanceService.getUniverSheetInstance(unitId)?.getSheetBySheetId(subUnitId);
- // const rules = worksheet?.getSnapshot().dataValidation;
- // if (rules) {
- // rules.forEach((rule) => {
- // if (rule.type !== DataValidationType.CUSTOM) {
- // this.addRule(unitId, subUnitId, rule.uid, rule.formula1, rule.formula2);
- // }
- // });
- // }
}
return subUnitMap;
@@ -96,12 +86,12 @@ export class DataValidationFormulaService extends Disposable {
const formulaRuleMap = this._ensureRuleFormulaMap(unitId, subUnitId);
const item: [IFormulaInfo | undefined, IFormulaInfo | undefined] = [undefined, undefined];
if (isFormula1Legal) {
- const id = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, ruleId, formula1!);
+ const id = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, formula1!, { ruleId });
item[0] = { id, text: formula1! };
}
if (isFormula2Legal) {
- const id = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, ruleId, formula2!);
+ const id = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, formula2!, { ruleId });
item[1] = { id, text: formula2! };
}
formulaRuleMap.set(ruleId, item);
@@ -130,7 +120,7 @@ export class DataValidationFormulaService extends Disposable {
if (oldFormula1?.text !== formula1) {
oldFormula1 && this._registerOtherFormulaService.deleteFormula(unitId, subUnitId, [oldFormula1.id]);
if (isFormulaString(formula1)) {
- const formulaId = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, ruleId, formula1!);
+ const formulaId = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, formula1!, { ruleId });
item[0] = {
text: formula1!,
id: formulaId,
@@ -143,7 +133,7 @@ export class DataValidationFormulaService extends Disposable {
if (oldFormula2?.text !== formula2) {
oldFormula2 && this._registerOtherFormulaService.deleteFormula(unitId, subUnitId, [oldFormula2.id]);
if (isFormulaString(formula2)) {
- const formulaId = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, ruleId, formula2!);
+ const formulaId = this._registerOtherFormulaService.registerFormula(unitId, subUnitId, formula2!, { ruleId });
item[1] = {
text: formula2!,
id: formulaId,
@@ -154,7 +144,7 @@ export class DataValidationFormulaService extends Disposable {
}
}
- getRuleFormulaResult(unitId: string, subUnitId: string, ruleId: string): Promise<Nullable<[Nullable<IDataValidationFormulaResult>, Nullable<IDataValidationFormulaResult>]>> {
+ getRuleFormulaResult(unitId: string, subUnitId: string, ruleId: string): Promise<Nullable<[Nullable<IOtherFormulaResult>, Nullable<IOtherFormulaResult>]>> {
const ruleFormulaMap = this._ensureRuleFormulaMap(unitId, subUnitId);
const formulaInfo = ruleFormulaMap.get(ruleId);
diff --git a/packages/sheets-data-validation/src/views/detail/index.tsx b/packages/sheets-data-validation/src/views/detail/index.tsx
index 12cbd837da..b1fc96c6bc 100644
--- a/packages/sheets-data-validation/src/views/detail/index.tsx
+++ b/packages/sheets-data-validation/src/views/detail/index.tsx
@@ -41,7 +41,7 @@ const debounceExecuteFactory = (commandService: ICommandService) => debounce(
275
);
-// eslint-disable-next-line max-lines-per-function
+
export function DataValidationDetail() {
const [key, setKey] = useState(0);
const dataValidationPanelService = useDependency(DataValidationPanelService);
diff --git a/packages/data-validation/src/commands/mutations/formula.mutation.ts b/packages/sheets-formula/src/commands/mutations/formula.mutation.ts
similarity index 78%
rename from packages/data-validation/src/commands/mutations/formula.mutation.ts
rename to packages/sheets-formula/src/commands/mutations/formula.mutation.ts
index 88426fce7b..fb1892ec79 100644
--- a/packages/data-validation/src/commands/mutations/formula.mutation.ts
+++ b/packages/sheets-formula/src/commands/mutations/formula.mutation.ts
@@ -17,9 +17,9 @@
import type { IMutation } from '@univerjs/core';
import { CommandType } from '@univerjs/core';
-export interface IDataValidationFormulaMarkDirtyParams { [unitId: string]: { [sunUnitId: string]: { [formulaId: string]: boolean } } }
+export interface IOtherFormulaMarkDirtyParams { [unitId: string]: { [sunUnitId: string]: { [formulaId: string]: boolean } } }
-export const DataValidationFormulaMarkDirty: IMutation<IDataValidationFormulaMarkDirtyParams> = {
+export const OtherFormulaMarkDirty: IMutation<IOtherFormulaMarkDirtyParams> = {
type: CommandType.MUTATION,
id: 'sheet.mutation.data-validation-formula-mark-dirty',
handler() {
diff --git a/packages/sheets-formula/src/controllers/formula-ui.controller.ts b/packages/sheets-formula/src/controllers/formula-ui.controller.ts
index f4a3a05467..1b61d35ce4 100644
--- a/packages/sheets-formula/src/controllers/formula-ui.controller.ts
+++ b/packages/sheets-formula/src/controllers/formula-ui.controller.ts
@@ -31,6 +31,7 @@ import { SearchFunctionOperation } from '../commands/operations/search-function.
import { RenderFormulaPromptContent } from '../views/FormulaPromptContainer';
import { MORE_FUNCTIONS_COMPONENT } from '../views/more-functions/interface';
import { MoreFunctions } from '../views/more-functions/MoreFunctions';
+import { OtherFormulaMarkDirty } from '../commands/mutations/formula.mutation';
import { InsertFunctionMenuItemFactory, MoreFunctionsMenuItemFactory, PasteFormulaMenuItemFactory } from './menu';
import {
ChangeRefToAbsoluteShortcut,
@@ -81,6 +82,7 @@ export class FormulaUIController extends Disposable {
HelpFunctionOperation,
SelectEditorFormulaOperation,
ReferenceAbsoluteOperation,
+ OtherFormulaMarkDirty,
].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
}
diff --git a/packages/sheets-formula/src/formula-ui-plugin.ts b/packages/sheets-formula/src/formula-ui-plugin.ts
index 1d75f7de1a..843823fc98 100644
--- a/packages/sheets-formula/src/formula-ui-plugin.ts
+++ b/packages/sheets-formula/src/formula-ui-plugin.ts
@@ -41,6 +41,7 @@ import { IRegisterFunctionService, RegisterFunctionService } from './services/re
import { NumfmtFormulaDisplayController } from './controllers/numfmt-formula-display.controller';
import { DefinedNameController } from './controllers/defined-name.controller';
import { FormulaRefRangeService } from './services/formula-ref-range.service';
+import { RegisterOtherFormulaService } from './services/register-other-formula.service';
/**
* The configuration of the formula UI plugin.
@@ -79,6 +80,7 @@ export class UniverSheetsFormulaPlugin extends Plugin {
[IRegisterFunctionService, { useClass: RegisterFunctionService }],
[FormulaRefRangeService],
+ [RegisterOtherFormulaService],
// controllers
[FormulaUIController],
diff --git a/packages/sheets-formula/src/index.ts b/packages/sheets-formula/src/index.ts
index c1c7dd6015..d3cfffbb31 100644
--- a/packages/sheets-formula/src/index.ts
+++ b/packages/sheets-formula/src/index.ts
@@ -27,3 +27,5 @@ export { RegisterFunctionService } from './services/register-function.service';
export { IRegisterFunctionService } from './services/register-function.service';
export { FormulaRefRangeService } from './services/formula-ref-range.service';
export { SPECIAL_PASTE_FORMULA } from './commands/commands/formula-clipboard.command';
+export { RegisterOtherFormulaService } from './services/register-other-formula.service';
+export type { IFormulaInfo, IOtherFormulaResult } from './services/formula-common';
diff --git a/packages/sheets-data-validation/src/services/formula-common.ts b/packages/sheets-formula/src/services/formula-common.ts
similarity index 93%
rename from packages/sheets-data-validation/src/services/formula-common.ts
rename to packages/sheets-formula/src/services/formula-common.ts
index c5729c0c38..61dcbb006f 100644
--- a/packages/sheets-data-validation/src/services/formula-common.ts
+++ b/packages/sheets-formula/src/services/formula-common.ts
@@ -23,12 +23,12 @@ export enum FormulaResultStatus {
ERROR,
}
-export interface IDataValidationFormulaResult {
+export interface IOtherFormulaResult {
result?: Nullable<ICellData>[][];
status: FormulaResultStatus;
- ruleId: string;
formulaId: string;
callbacks: Set<(value: Nullable<ICellData>[][]) => void>;
+ extra?: Record<string, any>;
}
export interface IFormulaInfo {
diff --git a/packages/sheets-data-validation/src/services/register-formula.service.ts b/packages/sheets-formula/src/services/register-other-formula.service.ts
similarity index 81%
rename from packages/sheets-data-validation/src/services/register-formula.service.ts
rename to packages/sheets-formula/src/services/register-other-formula.service.ts
index 149099ae0b..259d4b3a93 100644
--- a/packages/sheets-data-validation/src/services/register-formula.service.ts
+++ b/packages/sheets-formula/src/services/register-other-formula.service.ts
@@ -19,17 +19,17 @@ import { Disposable, ICommandService, Tools } from '@univerjs/core';
import type { IRemoveOtherFormulaMutationParams, ISetFormulaCalculationResultMutation, ISetOtherFormulaMutationParams } from '@univerjs/engine-formula';
import { IActiveDirtyManagerService, RemoveOtherFormulaMutation, SetFormulaCalculationResultMutation, SetOtherFormulaMutation } from '@univerjs/engine-formula';
import { bufferTime, filter, map, Subject } from 'rxjs';
-import type { IDataValidationFormulaMarkDirtyParams } from '@univerjs/data-validation';
-import { DataValidationFormulaMarkDirty } from '@univerjs/data-validation';
-import { FormulaResultStatus, type IDataValidationFormulaResult } from './formula-common';
+import type { IOtherFormulaMarkDirtyParams } from '../commands/mutations/formula.mutation';
+import { OtherFormulaMarkDirty } from '../commands/mutations/formula.mutation';
+import { FormulaResultStatus, type IOtherFormulaResult } from './formula-common';
export class RegisterOtherFormulaService extends Disposable {
- private _formulaCacheMap: Map<string, Map<string, Map<string, IDataValidationFormulaResult>>> = new Map();
+ private _formulaCacheMap: Map<string, Map<string, Map<string, IOtherFormulaResult>>> = new Map();
private _formulaChange$ = new Subject<{ unitId: string; subUnitId: string; formulaText: string; formulaId: string }>();
public formulaChange$ = this._formulaChange$.asObservable();
- private _formulaResult$ = new Subject<Record<string, Record<string, IDataValidationFormulaResult[]>>>();
+ private _formulaResult$ = new Subject<Record<string, Record<string, IOtherFormulaResult[]>>>();
public formulaResult$ = this._formulaResult$.asObservable();
constructor(
@@ -64,10 +64,10 @@ export class RegisterOtherFormulaService extends Disposable {
}
private _initFormulaRegister() {
- this._activeDirtyManagerService.register(DataValidationFormulaMarkDirty.id,
- { commandId: DataValidationFormulaMarkDirty.id,
+ this._activeDirtyManagerService.register(OtherFormulaMarkDirty.id,
+ { commandId: OtherFormulaMarkDirty.id,
getDirtyData(commandInfo) {
- const params = commandInfo.params as IDataValidationFormulaMarkDirtyParams;
+ const params = commandInfo.params as IOtherFormulaMarkDirtyParams;
return {
dirtyUnitOtherFormulaMap: params,
};
@@ -91,8 +91,8 @@ export class RegisterOtherFormulaService extends Disposable {
const value = result[unitId][subUnitId];
const config: ISetOtherFormulaMutationParams = { unitId, subUnitId, formulaMap: value };
this._commandService.executeCommand(SetOtherFormulaMutation.id, config).then(() => {
- this._commandService.executeCommand(DataValidationFormulaMarkDirty.id,
- { [unitId]: { [subUnitId]: value } } as unknown as IDataValidationFormulaMarkDirtyParams);
+ this._commandService.executeCommand(OtherFormulaMarkDirty.id,
+ { [unitId]: { [subUnitId]: value } } as unknown as IOtherFormulaMarkDirtyParams);
});
}
}
@@ -106,15 +106,15 @@ export class RegisterOtherFormulaService extends Disposable {
const params = commandInfo.params as ISetFormulaCalculationResultMutation;
const { unitOtherData } = params;
- const results: Record<string, Record<string, IDataValidationFormulaResult[]>> = {};
+ const results: Record<string, Record<string, IOtherFormulaResult[]>> = {};
for (const unitId in unitOtherData) {
const unitData = unitOtherData[unitId];
- const unitResults: Record<string, IDataValidationFormulaResult[]> = {};
+ const unitResults: Record<string, IOtherFormulaResult[]> = {};
results[unitId] = unitResults;
for (const subUnitId in unitData) {
const cacheMap = this._ensureCacheMap(unitId, subUnitId);
const subUnitData = unitData[subUnitId];
- const subUnitResults: IDataValidationFormulaResult[] = [];
+ const subUnitResults: IOtherFormulaResult[] = [];
unitResults[subUnitId] = subUnitResults;
for (const formulaId in subUnitData) {
const current = subUnitData[formulaId];
@@ -136,16 +136,16 @@ export class RegisterOtherFormulaService extends Disposable {
}));
}
- registerFormula(unitId: string, subUnitId: string, ruleId: string, formulaText: string) {
+ registerFormula(unitId: string, subUnitId: string, formulaText: string, extra?: Record<string, any>) {
const formulaId = this._createFormulaId(unitId, subUnitId);
const cacheMap = this._ensureCacheMap(unitId, subUnitId);
cacheMap.set(formulaId, {
result: undefined,
status: FormulaResultStatus.WAIT,
- ruleId,
formulaId,
callbacks: new Set(),
+ extra,
});
this._formulaChange$.next({
unitId,
@@ -167,7 +167,7 @@ export class RegisterOtherFormulaService extends Disposable {
formulaIdList.forEach((id) => cacheMap.delete(id));
}
- getFormulaValue(unitId: string, subUnitId: string, formulaId: string): Promise<Nullable<IDataValidationFormulaResult>> {
+ getFormulaValue(unitId: string, subUnitId: string, formulaId: string): Promise<Nullable<IOtherFormulaResult>> {
const cacheMap = this._ensureCacheMap(unitId, subUnitId);
const item = cacheMap.get(formulaId);
if (!item) {
@@ -185,14 +185,7 @@ export class RegisterOtherFormulaService extends Disposable {
});
}
- async getTempFormulaResult(unitId: string, subUnitId: string, formulaString: string) {
- const formulaId = this.registerFormula(unitId, subUnitId, 'temp', formulaString);
- const formulaValue = await this.getFormulaValue(unitId, subUnitId, formulaId);
- this.deleteFormula(unitId, subUnitId, [formulaId]);
- return formulaValue;
- }
-
- getFormulaValueSync(unitId: string, subUnitId: string, formulaId: string): Nullable<IDataValidationFormulaResult> {
+ getFormulaValueSync(unitId: string, subUnitId: string, formulaId: string): Nullable<IOtherFormulaResult> {
const cacheMap = this._ensureCacheMap(unitId, subUnitId);
return cacheMap.get(formulaId);
}