@univerjs/engine-formula
Advanced tools
Comparing version 0.3.0-nightly.202410101606 to 0.3.0-nightly.202410111606
@@ -144,2 +144,3 @@ import { BooleanNumber, ICellData, IColumnData, IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType, IRange, IRowData, IUnitRange, Nullable, ObjectMatrix, Styles } from '@univerjs/core'; | ||
arrayFormulaCellData: IArrayFormulaUnitCellType; | ||
arrayFormulaRange: IArrayFormulaRangeType; | ||
forceCalculate: boolean; | ||
@@ -151,2 +152,3 @@ dirtyRanges: IUnitRange[]; | ||
dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap; | ||
clearDependencyTreeCache?: IUnitSheetIdToNameMap; | ||
excludedCell?: IUnitExcludedCell; | ||
@@ -153,0 +155,0 @@ allUnitData?: IUnitData; |
@@ -11,1 +11,5 @@ import { compareToken, matchToken, operatorToken, prefixToken, suffixToken } from './token'; | ||
export declare function matchRefDrawToken(char: string): boolean; | ||
export declare const TOKEN_CANNOT_BE_AT_END_SET: Set<string>; | ||
export declare function isTokenCannotBeAtEnd(token: string): boolean; | ||
export declare const TOKEN_CANNOT_PRECEDE_SUFFIX_TOKEN_SET: Set<string>; | ||
export declare function isTokenCannotPrecedeSuffixToken(token: string): boolean; |
@@ -24,1 +24,2 @@ /** | ||
export declare const DEFAULT_TOKEN_CUBE_FUNCTION_NAME = "CUBE"; | ||
export declare const FORCED_RECALCULATION_FUNCTION_NAME: Set<string>; |
@@ -60,4 +60,5 @@ /** | ||
AT = "@", | ||
MINUS = "-" | ||
MINUS = "-", | ||
PLUS = "+" | ||
} | ||
export declare const SPACE_TOKEN = " "; |
@@ -1,2 +0,2 @@ | ||
import { IMutation } from '@univerjs/core'; | ||
import { IAccessor, IMutation } from '@univerjs/core'; | ||
export interface ISetDefinedNameMutationSearchParam { | ||
@@ -14,2 +14,9 @@ unitId: string; | ||
/** | ||
* Generate undo mutation of a `SetDefinedNameMutation` | ||
* @param accessor | ||
* @param params | ||
* @returns | ||
*/ | ||
export declare const SetDefinedNameMutationFactory: (accessor: IAccessor, params: ISetDefinedNameMutationParam) => ISetDefinedNameMutationParam; | ||
/** | ||
* In the formula engine, the mutation is solely responsible for communication between the worker and the main thread. | ||
@@ -16,0 +23,0 @@ * It requires setting local to true during execution. |
@@ -12,2 +12,3 @@ import { Disposable, ICommandService } from '@univerjs/core'; | ||
private _commandExecutedListener; | ||
private _handleSetDefinedName; | ||
} |
@@ -0,5 +1,5 @@ | ||
import { ISequenceArray, ISequenceNode } from '../utils/sequence'; | ||
import { AbsoluteRefType, Disposable } from '@univerjs/core'; | ||
import { FormulaAstLRU } from '../../basics/cache-lru'; | ||
import { ErrorType } from '../../basics/error-type'; | ||
import { ISequenceArray, ISequenceNode } from '../utils/sequence'; | ||
import { LexerNode } from './lexer-node'; | ||
@@ -19,2 +19,3 @@ export declare const FormulaLexerNodeCache: FormulaAstLRU<LexerNode>; | ||
private _colonState; | ||
private _formulaErrorCount; | ||
private _tableBracketState; | ||
@@ -59,4 +60,7 @@ dispose(): void; | ||
private _mergeSequenceNodeReference; | ||
/** | ||
* =-A1 Separate the negative sign from the ref string. | ||
*/ | ||
private _minusSplitSequenceNode; | ||
private _pushSequenceNode; | ||
private _replacePrefixString; | ||
nodeMakerTest(formulaString: string): ErrorType.VALUE | (string | LexerNode)[] | undefined; | ||
@@ -96,2 +100,4 @@ treeBuilder(formulaString: string, transformSuffix?: boolean, injectDefinedName?: (sequenceArray: ISequenceArray[]) => { | ||
private _closeTableBracket; | ||
private _formalErrorOccurred; | ||
private _hasFormalError; | ||
private _getLastChildCurrentLexerNode; | ||
@@ -108,4 +114,15 @@ private _getLastChildCurrent; | ||
private _removeLastChild; | ||
/** | ||
* fix univer-pro/issues/2447 | ||
* =1/3+ | ||
* =+ | ||
* =sum(A1+) | ||
*/ | ||
private _formulaErrorLastTokenCheck; | ||
private _findPreviousToken; | ||
private _negativeCondition; | ||
private _findSecondLastNonSpaceToken; | ||
private _findNextToken; | ||
private _unexpectedEndingTokenExcludeOperator; | ||
private _unexpectedEndingToken; | ||
private _isOperatorToken; | ||
private _getSequenceArray; | ||
@@ -112,0 +129,0 @@ private _resetTemp; |
import { Nullable, Disposable } from '@univerjs/core'; | ||
import { BaseAstNode } from '../ast-node/base-ast-node'; | ||
import { IFormulaRuntimeService } from '../../services/runtime.service'; | ||
import { AstRootNodeFactory } from '../ast-node/ast-root-node'; | ||
import { BaseAstNode } from '../ast-node/base-ast-node'; | ||
import { FunctionNodeFactory } from '../ast-node/function-node'; | ||
@@ -36,4 +36,5 @@ import { LambdaNodeFactory } from '../ast-node/lambda-node'; | ||
private _parse; | ||
private _setPrefixRefOffset; | ||
private _checkAstNode; | ||
private _initializeAstNode; | ||
} |
import { Nullable, Disposable } from '@univerjs/core'; | ||
import { AstNodePromiseType } from '../../basics/common'; | ||
import { ErrorType } from '../../basics/error-type'; | ||
import { FunctionVariantType } from '../reference-object/base-reference-object'; | ||
import { AstNodePromiseType } from '../../basics/common'; | ||
import { ErrorValueObject } from '../value-object/base-value-object'; | ||
@@ -24,2 +24,3 @@ import { NodeType } from './node-type'; | ||
private _refOffsetY; | ||
private _isForcedCalculateFunction; | ||
constructor(_token: string); | ||
@@ -30,2 +31,3 @@ dispose(): void; | ||
isAddress(): boolean; | ||
isForcedCalculateFunction(): boolean; | ||
setAsync(): void; | ||
@@ -35,2 +37,3 @@ setAddress(): void; | ||
setParent(node: BaseAstNode): void; | ||
setForcedCalculateFunction(): void; | ||
getChildren(): BaseAstNode[]; | ||
@@ -37,0 +40,0 @@ addChildren(...astNode: BaseAstNode[]): void; |
@@ -0,9 +1,9 @@ | ||
import { BaseFunction } from '../../functions/base-function'; | ||
import { LexerNode } from '../analysis/lexer-node'; | ||
import { Injector } from '@univerjs/core'; | ||
import { AstNodePromiseType } from '../../basics/common'; | ||
import { BaseFunction } from '../../functions/base-function'; | ||
import { IFormulaCurrentConfigService } from '../../services/current-data.service'; | ||
import { IDefinedNamesService } from '../../services/defined-names.service'; | ||
import { IFunctionService } from '../../services/function.service'; | ||
import { IFormulaRuntimeService } from '../../services/runtime.service'; | ||
import { LexerNode } from '../analysis/lexer-node'; | ||
import { IDefinedNamesService } from '../../services/defined-names.service'; | ||
import { BaseAstNode } from './base-ast-node'; | ||
@@ -38,2 +38,8 @@ import { BaseAstNodeFactory } from './base-ast-node-factory'; | ||
} | ||
export declare class ErrorFunctionNode extends BaseAstNode { | ||
constructor(token?: string); | ||
get nodeType(): NodeType; | ||
executeAsync(): Promise<AstNodePromiseType>; | ||
execute(): void; | ||
} | ||
export declare class FunctionNodeFactory extends BaseAstNodeFactory { | ||
@@ -40,0 +46,0 @@ private readonly _functionService; |
@@ -28,3 +28,2 @@ import { IFormulaRuntimeService } from '../../services/runtime.service'; | ||
private _updateLambdaStatement; | ||
private _updateTree; | ||
} |
@@ -0,3 +1,3 @@ | ||
import { LambdaPrivacyVarType, BaseAstNode } from './base-ast-node'; | ||
import { LexerNode } from '../analysis/lexer-node'; | ||
import { LambdaPrivacyVarType, BaseAstNode } from './base-ast-node'; | ||
import { BaseAstNodeFactory } from './base-ast-node-factory'; | ||
@@ -4,0 +4,0 @@ import { NodeType } from './node-type'; |
@@ -1,2 +0,2 @@ | ||
import { Disposable, IRange, IUnitRange, Nullable } from '@univerjs/core'; | ||
import { IRange, IRTreeItem, IUnitRange, Nullable, Disposable } from '@univerjs/core'; | ||
import { IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IRuntimeUnitDataType, IUnitExcludedCell } from '../../basics/common'; | ||
@@ -11,6 +11,2 @@ import { IFormulaDirtyData } from '../../services/current-data.service'; | ||
} | ||
export interface IUnitRangeWithToken { | ||
gridRange: IUnitRange; | ||
token: string; | ||
} | ||
/** | ||
@@ -21,5 +17,6 @@ * A dependency tree, capable of calculating mutual dependencies, | ||
export declare class FormulaDependencyTree extends Disposable { | ||
treeId: string; | ||
node: Nullable<BaseAstNode>; | ||
children: FormulaDependencyTree[]; | ||
parents: FormulaDependencyTree[]; | ||
children: Set<FormulaDependencyTree>; | ||
parents: Set<FormulaDependencyTree>; | ||
formula: string; | ||
@@ -32,8 +29,7 @@ row: number; | ||
unitId: string; | ||
rangeList: IUnitRangeWithToken[]; | ||
rangeList: IUnitRange[]; | ||
formulaId: Nullable<string>; | ||
featureId: Nullable<string>; | ||
isPassive: boolean; | ||
_childIds: Set<string>; | ||
anchorToken: string; | ||
isCache: boolean; | ||
constructor(treeId?: string); | ||
getDirtyData: Nullable<(dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => { | ||
@@ -44,5 +40,2 @@ runtimeCellData: IRuntimeUnitDataType; | ||
private _state; | ||
private _id; | ||
constructor(); | ||
get id(): string; | ||
dispose(): void; | ||
@@ -56,10 +49,5 @@ disposeWithChildren(): void; | ||
inRangeData(range: IRange): boolean; | ||
/** | ||
* "Determine whether all ranges of the current node exist within the dirty area. | ||
* If they are within the dirty area, return true, indicating that this node needs to be calculated. | ||
* @param dependencyRangeList | ||
*/ | ||
dependencyRange(dependencyRangeList: Map<string, Map<string, IRange[]>>, dirtyUnitSheetNameMap: IDirtyUnitSheetNameMap, unitExcludedCell: Nullable<IUnitExcludedCell>): boolean; | ||
dependencySheetName(dirtyUnitSheetNameMap?: IDirtyUnitSheetNameMap): boolean; | ||
isExcludeRange(unitExcludedCell: Nullable<IUnitExcludedCell>): boolean; | ||
pushChildren(tree: FormulaDependencyTree): void; | ||
hasChild(tree: FormulaDependencyTree): boolean; | ||
/** | ||
@@ -69,3 +57,5 @@ * Add the range corresponding to the current ast node. | ||
*/ | ||
pushRangeList(range: IUnitRangeWithToken): void; | ||
pushRangeList(ranges: IUnitRange[]): void; | ||
hasChildren(tree: FormulaDependencyTree): boolean; | ||
toRTreeItem(): IRTreeItem; | ||
/** | ||
@@ -78,30 +68,1 @@ * Determine whether it is dependent on other trees. | ||
} | ||
export declare class FormulaDependencyTreeCache extends Disposable { | ||
private _cacheItems; | ||
private _map; | ||
private _dependencyMap; | ||
private _parentIdMap; | ||
private _rangeTokens; | ||
dispose(): void; | ||
size(): number; | ||
getDependencyMap(): Map<string, FormulaDependencyTree>; | ||
getDependencyTree(id: string): FormulaDependencyTree | undefined; | ||
get length(): number; | ||
add(unitRangeWithToken: IUnitRangeWithToken, tree: FormulaDependencyTree): void; | ||
addDependencyMap(tree: FormulaDependencyTree): void; | ||
updateParent(tree: FormulaDependencyTree): void; | ||
clear(): void; | ||
remove(token: string, tree: FormulaDependencyTree): void; | ||
delete(token: string): void; | ||
getDependencyId(dependenceTree: FormulaDependencyTree, ids: Set<string>): void; | ||
/** | ||
* Determine whether range is dependent on other trees. | ||
* @param dependenceTree | ||
*/ | ||
dependencyUseParentId(dependenceTree: FormulaDependencyTree): void; | ||
/** | ||
* Determine whether range is dependent on other trees. | ||
* @param dependenceTree | ||
*/ | ||
dependency(dependenceTree: FormulaDependencyTree): void; | ||
} |
@@ -20,5 +20,4 @@ import { Disposable } from '@univerjs/core'; | ||
private readonly _dependencyManagerService; | ||
private _formulaASTCache; | ||
private _updateRangeFlattenCache; | ||
private _dirtyUnitSheetNameMap; | ||
private _formulaASTCache; | ||
constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _otherFormulaManagerService: IOtherFormulaManagerService, _featureCalculationManagerService: IFeatureCalculationManagerService, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder, _lexer: Lexer, _dependencyManagerService: IDependencyManagerService); | ||
@@ -63,3 +62,8 @@ dispose(): void; | ||
private _getExistTreeList; | ||
private _convertDirtyRangesToMap; | ||
/** | ||
* TODO @DR-Univer: The next step will be to try changing the incoming dirtyRanges to an array, thus avoiding conversion. | ||
* @param dirtyRanges | ||
* @returns | ||
*/ | ||
private _convertDirtyRangesToUnitRange; | ||
private _intersectFeatureCalculation; | ||
@@ -69,2 +73,4 @@ private _includeTreeFeature; | ||
private _includeDefinedName; | ||
private _detectForcedRecalculationNode; | ||
private _detectForcedRecalculationNodeRecursion; | ||
/** | ||
@@ -71,0 +77,0 @@ * Determine whether all ranges of the current node exist within the dirty area. |
@@ -1,6 +0,6 @@ | ||
import { Disposable } from '@univerjs/core'; | ||
import { IFormulaRuntimeService } from '../../services/runtime.service'; | ||
import { BaseAstNode } from '../ast-node/base-ast-node'; | ||
import { FunctionVariantType } from '../reference-object/base-reference-object'; | ||
import { PreCalculateNodeType } from '../utils/node-type'; | ||
import { Disposable } from '@univerjs/core'; | ||
import { IFormulaRuntimeService } from '../../services/runtime.service'; | ||
export declare class Interpreter extends Disposable { | ||
@@ -7,0 +7,0 @@ private readonly _runtimeService; |
import { ICellData, IRange, Nullable } from '@univerjs/core'; | ||
import { IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap, IUnitStylesData } from '../../basics/common'; | ||
import { FormulaAstLRU } from '../../basics/cache-lru'; | ||
@@ -7,3 +8,2 @@ import { ObjectClassType } from '../../basics/object-class-type'; | ||
import { NullValueObject, NumberValueObject, StringValueObject } from '../value-object/primitive-object'; | ||
import { IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap, IUnitStylesData } from '../../basics/common'; | ||
export type NodeValueType = BaseValueObject | BaseReferenceObject | AsyncObject | AsyncArrayObject; | ||
@@ -102,3 +102,3 @@ export type FunctionVariantType = BaseValueObject | BaseReferenceObject; | ||
getRuntimeFeatureCellValue(row: number, column: number): ICellData | undefined; | ||
getCellByPosition(row?: number, column?: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../..').BooleanValueObject | StringValueObject | ArrayValueObject; | ||
getCellByPosition(rowRaw?: number, columnRaw?: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../..').BooleanValueObject | StringValueObject | ArrayValueObject; | ||
/** | ||
@@ -105,0 +105,0 @@ * Get the pattern of the cell |
import { BaseValueObject } from '../value-object/base-value-object'; | ||
export declare function checkVariantErrorIsArray(variant: BaseValueObject): BaseValueObject; | ||
export declare function checkVariantsErrorIsArray(...variants: BaseValueObject[]): { | ||
isError: boolean; | ||
errorObject: BaseValueObject; | ||
variants?: undefined; | ||
} | { | ||
isError: boolean; | ||
variants: BaseValueObject[]; | ||
errorObject?: undefined; | ||
}; | ||
export declare function checkVariantsErrorIsArrayOrBoolean(...variants: BaseValueObject[]): { | ||
@@ -4,0 +13,0 @@ isError: boolean; |
import { Injector, Nullable } from '@univerjs/core'; | ||
import { IFunctionService } from '../../services/function.service'; | ||
import { PrefixNode } from '../ast-node/prefix-node'; | ||
export declare function prefixHandler(tokenTrim: string, functionService: IFunctionService, injector: Injector): { | ||
export declare function prefixHandler(tokenTrimParam: string, functionService: IFunctionService, injector: Injector): { | ||
tokenTrim: string; | ||
@@ -6,0 +6,0 @@ minusPrefixNode: Nullable<PrefixNode>; |
@@ -47,2 +47,3 @@ import { IRange, IUnitRangeName, IUnitRangeWithName, AbsoluteRefType } from '@univerjs/core'; | ||
export declare function isReferenceStringWithEffectiveColumn(refString: string): boolean; | ||
export declare function replaceRefPrefixString(token: string): string; | ||
/** | ||
@@ -49,0 +50,0 @@ * implement getSheetIdByName |
import { Nullable } from '@univerjs/core'; | ||
import { callbackMapFnType, IArrayValueObject, BaseValueObject, ErrorValueObject } from './base-value-object'; | ||
import { compareToken } from '../../basics/token'; | ||
import { ArrayBinarySearchType, ArrayOrderSearchType } from '../utils/compare'; | ||
import { BaseValueObject, ErrorValueObject, callbackMapFnType, IArrayValueObject } from './base-value-object'; | ||
import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from './primitive-object'; | ||
@@ -6,0 +6,0 @@ export declare function fromObjectToString(array: IArrayValueObject): string; |
@@ -41,2 +41,5 @@ /** | ||
PROPER = "PROPER", | ||
REGEXEXTRACT = "REGEXEXTRACT", | ||
REGEXMATCH = "REGEXMATCH", | ||
REGEXREPLACE = "REGEXREPLACE", | ||
REPLACE = "REPLACE", | ||
@@ -43,0 +46,0 @@ REPLACEB = "REPLACEB", |
@@ -17,2 +17,3 @@ /** | ||
export type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitSheetNameMap, } from './basics/common'; | ||
export { BooleanValue } from './basics/common'; | ||
export { isInDirtyRange } from './basics/dirty'; | ||
@@ -25,20 +26,47 @@ export { ERROR_TYPE_SET, ErrorType } from './basics/error-type'; | ||
export { compareToken, matchToken, operatorToken } from './basics/token'; | ||
export { matchRefDrawToken } from './basics/match-token'; | ||
export { isReferenceString } from './basics/regex'; | ||
export { RegisterFunctionMutation } from './commands/mutations/register-function.mutation'; | ||
export { type ISetArrayFormulaDataMutationParams, SetArrayFormulaDataMutation } from './commands/mutations/set-array-formula-data.mutation'; | ||
export { type ISetDefinedNameMutationParam, type ISetDefinedNameMutationSearchParam, RemoveDefinedNameMutation, SetDefinedNameMutation } from './commands/mutations/set-defined-name.mutation'; | ||
export { SetDefinedNameMutationFactory } from './commands/mutations/set-defined-name.mutation'; | ||
export { RemoveFeatureCalculationMutation, SetFeatureCalculationMutation } from './commands/mutations/set-feature-calculation.mutation'; | ||
export { type ISetFormulaCalculationNotificationMutation, type ISetFormulaCalculationResultMutation, type ISetFormulaCalculationStartMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, } from './commands/mutations/set-formula-calculation.mutation'; | ||
export { type ISetFormulaDataMutationParams, SetFormulaDataMutation } from './commands/mutations/set-formula-data.mutation'; | ||
export { type IRemoveOtherFormulaMutationParams, type ISetOtherFormulaMutationParams, RemoveOtherFormulaMutation, SetOtherFormulaMutation } from './commands/mutations/set-other-formula.mutation'; | ||
export { RemoveSuperTableMutation, SetSuperTableMutation, SetSuperTableOptionMutation } from './commands/mutations/set-super-table.mutation'; | ||
export { CalculateController } from './controller/calculate.controller'; | ||
export { SetDefinedNameController } from './controller/set-defined-name.controller'; | ||
export { Lexer } from './engine/analysis/lexer'; | ||
export { LexerNode } from './engine/analysis/lexer-node'; | ||
export { LexerTreeBuilder } from './engine/analysis/lexer-tree-builder'; | ||
export { AstTreeBuilder } from './engine/analysis/parser'; | ||
export { AstRootNodeFactory } from './engine/ast-node/ast-root-node'; | ||
export { FunctionNodeFactory } from './engine/ast-node/function-node'; | ||
export { LambdaNodeFactory } from './engine/ast-node/lambda-node'; | ||
export { LambdaParameterNodeFactory } from './engine/ast-node/lambda-parameter-node'; | ||
export { OperatorNodeFactory } from './engine/ast-node/operator-node'; | ||
export { PrefixNodeFactory } from './engine/ast-node/prefix-node'; | ||
export { ReferenceNodeFactory } from './engine/ast-node/reference-node'; | ||
export { SuffixNodeFactory } from './engine/ast-node/suffix-node'; | ||
export { UnionNodeFactory } from './engine/ast-node/union-node'; | ||
export { ValueNodeFactory } from './engine/ast-node/value-node'; | ||
export { FormulaDependencyGenerator } from './engine/dependency/formula-dependency'; | ||
export { Interpreter } from './engine/interpreter/interpreter'; | ||
export { BaseReferenceObject, type FunctionVariantType } from './engine/reference-object/base-reference-object'; | ||
export { AsyncArrayObject, AsyncObject } from './engine/reference-object/base-reference-object'; | ||
export { RangeReferenceObject } from './engine/reference-object/range-reference-object'; | ||
export { strip, stripErrorMargin } from './engine/utils/math-kit'; | ||
export { handleNumfmtInCell } from './engine/utils/numfmt-kit'; | ||
export { deserializeRangeForR1C1 } from './engine/utils/r1c1-reference'; | ||
export { deserializeRangeWithSheet, getAbsoluteRefTypeWithSingleString, getAbsoluteRefTypeWitString, getRangeWithRefsString, type IAbsoluteRefTypeForRange, isReferenceStrings, isReferenceStringWithEffectiveColumn, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet, singleReferenceToGrid, } from './engine/utils/reference'; | ||
export { handleRefStringInfo } from './engine/utils/reference'; | ||
export { generateStringWithSequence, type ISequenceNode, sequenceNodeType } from './engine/utils/sequence'; | ||
export { ArrayValueObject, ValueObjectFactory } from './engine/value-object/array-value-object'; | ||
export { BaseValueObject, ErrorValueObject } from './engine/value-object/base-value-object'; | ||
export { BooleanValue } from './basics/common'; | ||
export type { PrimitiveValueType } from './engine/value-object/primitive-object'; | ||
export { NumberValueObject } from './engine/value-object/primitive-object'; | ||
export { BooleanValueObject } from './engine/value-object/primitive-object'; | ||
export { NullValueObject, StringValueObject } from './engine/value-object/primitive-object'; | ||
export { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from './engine/value-object/primitive-object'; | ||
export { functionArray } from './functions/array/function-map'; | ||
export { FUNCTION_NAMES_ARRAY } from './functions/array/function-names'; | ||
export { BaseFunction } from './functions/base-function'; | ||
export { CustomFunction } from './functions/custom-function'; | ||
export { functionCompatibility } from './functions/compatibility/function-map'; | ||
@@ -48,2 +76,3 @@ export { FUNCTION_NAMES_COMPATIBILITY } from './functions/compatibility/function-names'; | ||
export { FUNCTION_NAMES_CUBE } from './functions/cube/function-names'; | ||
export { CustomFunction } from './functions/custom-function'; | ||
export { functionDatabase } from './functions/database/function-map'; | ||
@@ -76,5 +105,12 @@ export { FUNCTION_NAMES_DATABASE } from './functions/database/function-names'; | ||
export { initSheetFormulaData } from './models/formula-data.model'; | ||
export type { IRangeChange } from './models/formula-data.model'; | ||
export { UniverFormulaEnginePlugin } from './plugin'; | ||
export { IActiveDirtyManagerService } from './services/active-dirty-manager.service'; | ||
export { ActiveDirtyManagerService } from './services/active-dirty-manager.service'; | ||
export { CalculateFormulaService } from './services/calculate-formula.service'; | ||
export { FeatureCalculationManagerService, IFeatureCalculationManagerService, } from './services/feature-calculation-manager.service'; | ||
export { FormulaCurrentConfigService, IFormulaCurrentConfigService, type IFormulaDirtyData } from './services/current-data.service'; | ||
export { DefinedNamesService, type IDefinedNameMapItem, IDefinedNamesService, type IDefinedNamesServiceParam } from './services/defined-names.service'; | ||
export { IDependencyManagerService } from './services/dependency-manager.service'; | ||
export { DependencyManagerService } from './services/dependency-manager.service'; | ||
export { FeatureCalculationManagerService, IFeatureCalculationManagerService } from './services/feature-calculation-manager.service'; | ||
export { FunctionService } from './services/function.service'; | ||
@@ -85,40 +121,4 @@ export { IFunctionService } from './services/function.service'; | ||
export { FormulaExecutedStateType, type IAllRuntimeData } from './services/runtime.service'; | ||
export { isReferenceString } from './basics/regex'; | ||
export { matchRefDrawToken } from './basics/match-token'; | ||
export { DefinedNamesService, type IDefinedNameMapItem, IDefinedNamesService, type IDefinedNamesServiceParam } from './services/defined-names.service'; | ||
export { FormulaRuntimeService, IFormulaRuntimeService } from './services/runtime.service'; | ||
export { FormulaCurrentConfigService, IFormulaCurrentConfigService, type IFormulaDirtyData } from './services/current-data.service'; | ||
export { IActiveDirtyManagerService } from './services/active-dirty-manager.service'; | ||
export { ActiveDirtyManagerService } from './services/active-dirty-manager.service'; | ||
export type { IRangeChange } from './models/formula-data.model'; | ||
export { handleNumfmtInCell } from './engine/utils/numfmt-kit'; | ||
export { AsyncArrayObject } from './engine/reference-object/base-reference-object'; | ||
export { strip, stripErrorMargin } from './engine/utils/math-kit'; | ||
export { AsyncObject } from './engine/reference-object/base-reference-object'; | ||
export { Lexer } from './engine/analysis/lexer'; | ||
export { FormulaDependencyGenerator } from './engine/dependency/formula-dependency'; | ||
export { ISuperTableService } from './services/super-table.service'; | ||
export { SuperTableService } from './services/super-table.service'; | ||
export { Interpreter } from './engine/interpreter/interpreter'; | ||
export { AstTreeBuilder } from './engine/analysis/parser'; | ||
export { AstRootNodeFactory } from './engine/ast-node/ast-root-node'; | ||
export { FunctionNodeFactory } from './engine/ast-node/function-node'; | ||
export { LambdaNodeFactory } from './engine/ast-node/lambda-node'; | ||
export { LambdaParameterNodeFactory } from './engine/ast-node/lambda-parameter-node'; | ||
export { OperatorNodeFactory } from './engine/ast-node/operator-node'; | ||
export { PrefixNodeFactory } from './engine/ast-node/prefix-node'; | ||
export { ReferenceNodeFactory } from './engine/ast-node/reference-node'; | ||
export { SuffixNodeFactory } from './engine/ast-node/suffix-node'; | ||
export { UnionNodeFactory } from './engine/ast-node/union-node'; | ||
export { ValueNodeFactory } from './engine/ast-node/value-node'; | ||
export { IDependencyManagerService } from './services/dependency-manager.service'; | ||
export { DependencyManagerService } from './services/dependency-manager.service'; | ||
export { CalculateController } from './controller/calculate.controller'; | ||
export { RegisterFunctionMutation } from './commands/mutations/register-function.mutation'; | ||
export { type ISetArrayFormulaDataMutationParams, SetArrayFormulaDataMutation } from './commands/mutations/set-array-formula-data.mutation'; | ||
export { type ISetDefinedNameMutationParam, type ISetDefinedNameMutationSearchParam, RemoveDefinedNameMutation, SetDefinedNameMutation, } from './commands/mutations/set-defined-name.mutation'; | ||
export { RemoveFeatureCalculationMutation, SetFeatureCalculationMutation } from './commands/mutations/set-feature-calculation.mutation'; | ||
export { type ISetFormulaCalculationNotificationMutation, type ISetFormulaCalculationResultMutation, type ISetFormulaCalculationStartMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, } from './commands/mutations/set-formula-calculation.mutation'; | ||
export { type ISetFormulaDataMutationParams, SetFormulaDataMutation } from './commands/mutations/set-formula-data.mutation'; | ||
export { type IRemoveOtherFormulaMutationParams, type ISetOtherFormulaMutationParams, RemoveOtherFormulaMutation, SetOtherFormulaMutation, } from './commands/mutations/set-other-formula.mutation'; | ||
export { RemoveSuperTableMutation, SetSuperTableMutation, SetSuperTableOptionMutation, } from './commands/mutations/set-super-table.mutation'; |
@@ -1,5 +0,5 @@ | ||
import { Disposable, IUniverInstanceService, ObjectMatrix, ICellData, IObjectMatrixPrimitiveType, IRange, Nullable } from '@univerjs/core'; | ||
import { LexerTreeBuilder } from '../engine/analysis/lexer-tree-builder'; | ||
import { ICellData, IObjectMatrixPrimitiveType, IRange, Nullable, Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core'; | ||
import { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap } from '../basics/common'; | ||
import { IFormulaIdMap } from './utils/formula-data-util'; | ||
import { LexerTreeBuilder } from '../engine/analysis/lexer-tree-builder'; | ||
export interface IRangeChange { | ||
@@ -6,0 +6,0 @@ oldCell: IRange; |
@@ -11,2 +11,3 @@ import { ICommandInfo, IUnitRange, Nullable, Disposable } from '@univerjs/core'; | ||
dirtyUnitOtherFormulaMap?: IDirtyUnitOtherFormulaMap; | ||
clearDependencyTreeCache?: IDirtyUnitSheetNameMap; | ||
}; | ||
@@ -13,0 +14,0 @@ } |
import { IUnitRange, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core'; | ||
import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitSheetNameMap, IUnitStylesData } from '../basics/common'; | ||
import { IArrayFormulaRangeType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitSheetNameMap, IUnitStylesData } from '../basics/common'; | ||
export interface IFormulaDirtyData { | ||
@@ -10,2 +10,3 @@ forceCalculation: boolean; | ||
dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap; | ||
clearDependencyTreeCache: IDirtyUnitSheetNameMap; | ||
} | ||
@@ -32,2 +33,3 @@ export interface IFormulaCurrentConfigService { | ||
getArrayFormulaCellData(): IRuntimeUnitDataType; | ||
getArrayFormulaRange(): IArrayFormulaRangeType; | ||
getSheetName(unitId: string, sheetId: string): string; | ||
@@ -40,2 +42,3 @@ getDirtyUnitOtherFormulaMap(): IDirtyUnitOtherFormulaMap; | ||
getDirtyData(): IFormulaDirtyData; | ||
getClearDependencyTreeCache(): IDirtyUnitSheetNameMap; | ||
} | ||
@@ -47,5 +50,7 @@ export declare class FormulaCurrentConfigService extends Disposable implements IFormulaCurrentConfigService { | ||
private _arrayFormulaCellData; | ||
private _arrayFormulaRange; | ||
private _formulaData; | ||
private _sheetNameMap; | ||
private _forceCalculate; | ||
private _clearDependencyTreeCache; | ||
private _dirtyRanges; | ||
@@ -71,2 +76,3 @@ private _dirtyNameMap; | ||
getArrayFormulaCellData(): IRuntimeUnitDataType; | ||
getArrayFormulaRange(): IArrayFormulaRangeType; | ||
getSheetNameMap(): IUnitSheetNameMap; | ||
@@ -80,2 +86,3 @@ isForceCalculate(): boolean; | ||
getSheetName(unitId: string, sheetId: string): string; | ||
getClearDependencyTreeCache(): IDirtyUnitSheetNameMap; | ||
load(config: IFormulaDatasetConfig): void; | ||
@@ -82,0 +89,0 @@ getDirtyData(): IFormulaDirtyData; |
@@ -1,2 +0,2 @@ | ||
import { IUnitRange, Nullable, Disposable } from '@univerjs/core'; | ||
import { Disposable, IUniverInstanceService, IUnitRange, Nullable, Worksheet } from '@univerjs/core'; | ||
import { Observable } from 'rxjs'; | ||
@@ -36,4 +36,6 @@ export interface IDefinedNamesServiceParam { | ||
focusRange(unitId: string, id: string): void; | ||
getWorksheetByRef(unitId: string, ref: string): Nullable<Worksheet>; | ||
} | ||
export declare class DefinedNamesService extends Disposable implements IDefinedNamesService { | ||
private readonly _univerInstanceService; | ||
private _definedNameMap; | ||
@@ -47,4 +49,5 @@ private readonly _update$; | ||
readonly focusRange$: Observable<IDefinedNamesServiceFocusParam>; | ||
constructor(); | ||
constructor(_univerInstanceService: IUniverInstanceService); | ||
dispose(): void; | ||
getWorksheetByRef(unitId: string, ref: string): Nullable<Worksheet>; | ||
focusRange(unitId: string, id: string): void; | ||
@@ -51,0 +54,0 @@ setCurrentRange(range: IUnitRange): void; |
@@ -1,3 +0,3 @@ | ||
import { Disposable, ObjectMatrix, Nullable } from '@univerjs/core'; | ||
import { FormulaDependencyTreeCache, FormulaDependencyTree } from '../engine/dependency/dependency-tree'; | ||
import { IRTreeItem, IUnitRange, Nullable, Disposable, ObjectMatrix } from '@univerjs/core'; | ||
import { FormulaDependencyTree } from '../engine/dependency/dependency-tree'; | ||
export interface IOtherFormulaDependencyParam { | ||
@@ -25,3 +25,3 @@ [unitId: string]: Nullable<{ | ||
getAllTree(): FormulaDependencyTree[]; | ||
buildDependencyTree(shouldBeBuildTrees: FormulaDependencyTree[] | FormulaDependencyTreeCache, dependencyTrees?: FormulaDependencyTree[]): FormulaDependencyTree[]; | ||
buildDependencyTree(shouldBeBuildTrees: FormulaDependencyTree[], dependencyTrees?: FormulaDependencyTree[]): FormulaDependencyTree[]; | ||
clearDependencyForTree(shouldBeClearTree: Nullable<FormulaDependencyTree>): void; | ||
@@ -31,11 +31,17 @@ reset(): void; | ||
removeOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string[]): void; | ||
hasOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): boolean; | ||
getOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): Nullable<FormulaDependencyTree>; | ||
addFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string, dependencyTree: FormulaDependencyTree): void; | ||
removeFeatureFormulaDependency(unitId: string, sheetId: string, featureIds: string[]): void; | ||
getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): Nullable<FormulaDependencyTree>; | ||
hasFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): boolean; | ||
addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: FormulaDependencyTree): void; | ||
removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void; | ||
hasFormulaDependency(unitId: string, sheetId: string, row: number, column: number): boolean; | ||
getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): Nullable<FormulaDependencyTree>; | ||
removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void; | ||
clearFormulaDependency(unitId: string, sheetId?: string): void; | ||
addDependencyRTreeCache(tree: FormulaDependencyTree): void; | ||
searchDependency(search: IUnitRange[]): Map<string, IRTreeItem>; | ||
hasTreeIdInCache(treeId: string): boolean; | ||
clearDependencyAll(): void; | ||
clearOtherFormulaDependency(unitId: string, sheetId?: string): void; | ||
clearFeatureFormulaDependency(unitId: string, sheetId?: string): void; | ||
} | ||
@@ -52,2 +58,4 @@ /** | ||
private _formulaData; | ||
private _dependencyRTreeCache; | ||
private _dependencyTreeIdsCache; | ||
dispose(): void; | ||
@@ -59,4 +67,4 @@ /** | ||
getAllTree(): FormulaDependencyTree[]; | ||
buildDependencyTree(shouldBeBuildTrees: FormulaDependencyTree[] | FormulaDependencyTreeCache, dependencyTrees?: FormulaDependencyTree[]): FormulaDependencyTree[]; | ||
private _buildDependencyTreeWithCache; | ||
buildDependencyTree(shouldBeBuildTrees: FormulaDependencyTree[], dependencyTrees?: FormulaDependencyTree[]): FormulaDependencyTree[]; | ||
searchDependency(search: IUnitRange[]): Map<string, IRTreeItem>; | ||
/** | ||
@@ -69,2 +77,8 @@ * Build the dependency relationship between the trees. | ||
/** | ||
* Build the reverse dependency relationship between the trees. | ||
* @param allTrees | ||
* @param dependencyTrees | ||
*/ | ||
private _buildReverseDependency; | ||
/** | ||
* Clear the dependency relationship of the tree. | ||
@@ -80,11 +94,21 @@ * establish the relationship between the parent and the child. | ||
hasOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string): boolean; | ||
clearOtherFormulaDependency(unitId: string, sheetId?: string): void; | ||
addFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string, dependencyTree: FormulaDependencyTree): void; | ||
removeFeatureFormulaDependency(unitId: string, sheetId: string, featureIds: string[]): void; | ||
clearFeatureFormulaDependency(unitId: string, sheetId?: string): void; | ||
getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): Nullable<FormulaDependencyTree>; | ||
hasFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): boolean; | ||
addFormulaDependency(unitId: string, sheetId: string, row: number, column: number, dependencyTree: FormulaDependencyTree): void; | ||
removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void; | ||
clearFormulaDependency(unitId: string, sheetId?: string): void; | ||
hasFormulaDependency(unitId: string, sheetId: string, row: number, column: number): boolean; | ||
clearDependencyAll(): void; | ||
getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): Nullable<Nullable<FormulaDependencyTree>>; | ||
addDependencyRTreeCache(tree: FormulaDependencyTree): void; | ||
private _addTreeIdToCache; | ||
private _removeTreeIdFromCache; | ||
private _clearTreeIdCache; | ||
hasTreeIdInCache(treeId: string): boolean; | ||
private _removeDependencyRTreeCacheById; | ||
private _removeDependencyRTreeCache; | ||
removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void; | ||
} | ||
export declare const IDependencyManagerService: import('@wendellhu/redi').IdentifierDecorator<DependencyManagerService>; |
@@ -178,2 +178,14 @@ import { Nullable, Disposable } from '@univerjs/core'; | ||
private _getRuntimeFeatureCellValue; | ||
private _arrayCellHasData; | ||
/** | ||
* If the current array formula in the extended area intersects with the existing array formula, a #SPILL! error will be reported. Note that if other array formulas are already #SPILL!, they will not conflict with the current array formula | ||
* @param formulaUnitId | ||
* @param formulaSheetId | ||
* @param formulaRow | ||
* @param formulaColumn | ||
* @param r | ||
* @param c | ||
* @returns | ||
*/ | ||
private _isInOtherArrayFormulaRange; | ||
private _isInArrayFormulaRange; | ||
@@ -180,0 +192,0 @@ private _checkIfArrayFormulaExceeded; |
{ | ||
"name": "@univerjs/engine-formula", | ||
"version": "0.3.0-nightly.202410101606", | ||
"version": "0.3.0-nightly.202410111606", | ||
"private": false, | ||
@@ -50,4 +50,4 @@ "description": "UniverSheet normal base-formula-engine", | ||
"rxjs": ">=7.0.0", | ||
"@univerjs/core": "0.3.0-nightly.202410101606", | ||
"@univerjs/rpc": "0.3.0-nightly.202410101606" | ||
"@univerjs/core": "0.3.0-nightly.202410111606", | ||
"@univerjs/rpc": "0.3.0-nightly.202410111606" | ||
}, | ||
@@ -57,10 +57,10 @@ "dependencies": { | ||
"numfmt": "^2.5.2", | ||
"@univerjs/core": "0.3.0-nightly.202410101606", | ||
"@univerjs/rpc": "0.3.0-nightly.202410101606" | ||
"@univerjs/rpc": "0.3.0-nightly.202410111606", | ||
"@univerjs/core": "0.3.0-nightly.202410111606" | ||
}, | ||
"devDependencies": { | ||
"rxjs": "^7.8.1", | ||
"typescript": "^5.6.2", | ||
"typescript": "^5.6.3", | ||
"vite": "^5.4.8", | ||
"vitest": "^2.1.1", | ||
"vitest": "^2.1.2", | ||
"@univerjs-infra/shared": "0.3.0" | ||
@@ -67,0 +67,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
897
48298
3939793
3
4
+ Added@univerjs/core@0.3.0-nightly.202410111606(transitive)
+ Added@univerjs/rpc@0.3.0-nightly.202410111606(transitive)
+ Addedquickselect@3.0.0(transitive)
+ Addedrbush@4.0.1(transitive)
- Removed@univerjs/core@0.3.0-nightly.202410101606(transitive)
- Removed@univerjs/rpc@0.3.0-nightly.202410101606(transitive)