@univerjs/engine-formula 0.1.5 → 0.1.6
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/index.js +1 -1
- package/lib/es/index.js +3335 -3143
- package/lib/types/basics/common.d.ts +6 -0
- package/lib/types/basics/function.d.ts +5 -1
- package/lib/types/commands/mutations/set-defined-name.mutation.d.ts +13 -3
- package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +2 -1
- package/lib/types/engine/analysis/lexer-node.d.ts +4 -0
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +5 -2
- package/lib/types/engine/analysis/lexer.d.ts +7 -4
- package/lib/types/engine/ast-node/base-ast-node.d.ts +3 -0
- package/lib/types/engine/ast-node/reference-node.d.ts +1 -3
- package/lib/types/engine/dependency/formula-dependency.d.ts +1 -0
- package/lib/types/engine/utils/relative-formula.d.ts +4 -0
- package/lib/types/index.d.ts +4 -3
- package/lib/types/services/active-dirty-manager.service.d.ts +2 -1
- package/lib/types/services/current-data.service.d.ts +15 -2
- package/lib/types/services/defined-names.service.d.ts +50 -8
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
|
@@ -61,6 +61,11 @@ export interface IDirtyUnitSheetNameMap {
|
|
|
61
61
|
[sheetId: string]: string;
|
|
62
62
|
}>;
|
|
63
63
|
}
|
|
64
|
+
export interface IDirtyUnitSheetDefinedNameMap {
|
|
65
|
+
[unitId: string]: Nullable<{
|
|
66
|
+
[name: string]: string;
|
|
67
|
+
}>;
|
|
68
|
+
}
|
|
64
69
|
export interface IDirtyUnitFeatureMap {
|
|
65
70
|
[unitId: string]: Nullable<{
|
|
66
71
|
[sheetId: string]: {
|
|
@@ -137,6 +142,7 @@ export interface IFormulaDatasetConfig {
|
|
|
137
142
|
forceCalculate: boolean;
|
|
138
143
|
dirtyRanges: IUnitRange[];
|
|
139
144
|
dirtyNameMap: IDirtyUnitSheetNameMap;
|
|
145
|
+
dirtyDefinedNameMap: IDirtyUnitSheetNameMap;
|
|
140
146
|
dirtyUnitFeatureMap: IDirtyUnitFeatureMap;
|
|
141
147
|
dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap;
|
|
142
148
|
numfmtItemMap: INumfmtItemMap;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { IMutation } from '@univerjs/core';
|
|
1
|
+
import { IMutation, IRange } from '@univerjs/core';
|
|
2
2
|
|
|
3
3
|
export interface ISetDefinedNameMutationSearchParam {
|
|
4
4
|
unitId: string;
|
|
5
|
-
|
|
5
|
+
id: string;
|
|
6
6
|
}
|
|
7
7
|
export interface ISetDefinedNameMutationParam extends ISetDefinedNameMutationSearchParam {
|
|
8
|
+
name: string;
|
|
8
9
|
formulaOrRefString: string;
|
|
10
|
+
comment?: string;
|
|
11
|
+
localSheetId?: string;
|
|
12
|
+
hidden?: boolean;
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* In the formula engine, the mutation is solely responsible for communication between the worker and the main thread.
|
|
12
16
|
* It requires setting local to true during execution.
|
|
13
17
|
*/
|
|
14
18
|
export declare const SetDefinedNameMutation: IMutation<ISetDefinedNameMutationParam>;
|
|
15
|
-
export declare const RemoveDefinedNameMutation: IMutation<
|
|
19
|
+
export declare const RemoveDefinedNameMutation: IMutation<ISetDefinedNameMutationParam>;
|
|
20
|
+
export interface ISetDefinedNameCurrentMutationParam {
|
|
21
|
+
unitId: string;
|
|
22
|
+
sheetId: string;
|
|
23
|
+
range: IRange;
|
|
24
|
+
}
|
|
25
|
+
export declare const SetDefinedNameCurrentMutation: IMutation<ISetDefinedNameCurrentMutationParam>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
|
|
2
|
-
import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, INumfmtItemMap, IRuntimeOtherUnitDataType, IRuntimeUnitDataPrimitiveType } from '../../basics/common';
|
|
2
|
+
import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, INumfmtItemMap, IRuntimeOtherUnitDataType, IRuntimeUnitDataPrimitiveType } from '../../basics/common';
|
|
3
3
|
import { IExecutionOptions, IMutation, IUnitRange, Nullable } from '@univerjs/core';
|
|
4
4
|
|
|
5
5
|
export interface ISetFormulaCalculationStartMutation {
|
|
6
6
|
dirtyRanges: IUnitRange[];
|
|
7
7
|
dirtyNameMap: IDirtyUnitSheetNameMap;
|
|
8
|
+
dirtyDefinedNameMap: IDirtyUnitSheetDefinedNameMap;
|
|
8
9
|
dirtyUnitFeatureMap: IDirtyUnitFeatureMap;
|
|
9
10
|
dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap;
|
|
10
11
|
options: Nullable<IExecutionOptions>;
|
|
@@ -18,7 +18,9 @@ export declare class LexerNode {
|
|
|
18
18
|
private _lambdaParameter;
|
|
19
19
|
private _startIndex;
|
|
20
20
|
private _endIndex;
|
|
21
|
+
private _definedNames;
|
|
21
22
|
dispose(): void;
|
|
23
|
+
getDefinedNames(): string[];
|
|
22
24
|
getStartIndex(): number;
|
|
23
25
|
getLambdaId(): Nullable<string>;
|
|
24
26
|
setLambdaId(lambdaId: string): void;
|
|
@@ -35,6 +37,8 @@ export declare class LexerNode {
|
|
|
35
37
|
getToken(): string;
|
|
36
38
|
setToken(token: string): void;
|
|
37
39
|
setIndex(st: number, ed: number): void;
|
|
40
|
+
setDefinedNames(definedNames: Array<string>): void;
|
|
41
|
+
hasDefinedNames(): boolean;
|
|
38
42
|
replaceChild(lexerNode: LexerNode, newLexerNode: LexerNode): void;
|
|
39
43
|
changeToParent(newParentLexerNode: LexerNode): void;
|
|
40
44
|
removeChild(lexerNode: LexerNode): void;
|
|
@@ -2,7 +2,7 @@ import { LexerNode } from './lexer-node';
|
|
|
2
2
|
import { ISequenceArray, ISequenceNode } from '../utils/sequence';
|
|
3
3
|
import { ErrorType } from '../../basics/error-type';
|
|
4
4
|
import { FormulaAstLRU } from '../../basics/cache-lru';
|
|
5
|
-
import { Disposable } from '@univerjs/core';
|
|
5
|
+
import { AbsoluteRefType, Disposable } from '@univerjs/core';
|
|
6
6
|
|
|
7
7
|
export declare const FormulaLexerNodeCache: FormulaAstLRU<LexerNode>;
|
|
8
8
|
export declare const FormulaSequenceNodeCache: FormulaAstLRU<(string | ISequenceNode)[]>;
|
|
@@ -40,6 +40,7 @@ export declare class LexerTreeBuilder extends Disposable {
|
|
|
40
40
|
* @param formulaString
|
|
41
41
|
*/
|
|
42
42
|
checkIfAddBracket(formulaString: string): number;
|
|
43
|
+
convertRefersToAbsolute(formulaString: string, startAbsoluteRefType: AbsoluteRefType, endAbsoluteRefType: AbsoluteRefType): string;
|
|
43
44
|
sequenceNodesBuilder(formulaString: string): (string | ISequenceNode)[] | undefined;
|
|
44
45
|
getSequenceNode(sequenceArray: ISequenceArray[]): (string | ISequenceNode)[];
|
|
45
46
|
private _getCurrentParamIndex;
|
|
@@ -55,7 +56,8 @@ export declare class LexerTreeBuilder extends Disposable {
|
|
|
55
56
|
treeBuilder(formulaString: string, transformSuffix?: boolean, injectDefinedName?: (sequenceArray: ISequenceArray[]) => {
|
|
56
57
|
sequenceString: string;
|
|
57
58
|
hasDefinedName: boolean;
|
|
58
|
-
|
|
59
|
+
definedNames: string[];
|
|
60
|
+
}, simpleCheckDefinedName?: (formulaString: string) => boolean): ErrorType.VALUE | LexerNode | (string | LexerNode)[] | undefined;
|
|
59
61
|
private _suffixExpressionHandler;
|
|
60
62
|
private _checkCloseBracket;
|
|
61
63
|
private _checkOpenBracket;
|
|
@@ -99,4 +101,5 @@ export declare class LexerTreeBuilder extends Disposable {
|
|
|
99
101
|
private _resetTemp;
|
|
100
102
|
private _checkSimilarErrorToken;
|
|
101
103
|
private _nodeMaker;
|
|
104
|
+
private _addSequenceArray;
|
|
102
105
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { LexerTreeBuilder } from './lexer-tree-builder';
|
|
2
|
-
import {
|
|
2
|
+
import { ErrorType } from '../../basics/error-type';
|
|
3
|
+
import { IFormulaCurrentConfigService } from '../../services/current-data.service';
|
|
3
4
|
import { IDefinedNamesService } from '../../services/defined-names.service';
|
|
4
5
|
import { Disposable } from '@univerjs/core';
|
|
5
6
|
|
|
6
7
|
export declare class Lexer extends Disposable {
|
|
7
8
|
private readonly _definedNamesService;
|
|
8
|
-
private readonly _runtimeService;
|
|
9
9
|
private readonly _lexerTreeBuilder;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
private readonly _formulaCurrentConfigService;
|
|
11
|
+
constructor(_definedNamesService: IDefinedNamesService, _lexerTreeBuilder: LexerTreeBuilder, _formulaCurrentConfigService: IFormulaCurrentConfigService);
|
|
12
|
+
treeBuilder(formulaString: string, transformSuffix?: boolean): ErrorType.VALUE | import('./lexer-node').LexerNode | (string | import('./lexer-node').LexerNode)[] | undefined;
|
|
13
|
+
private _simpleCheckDefinedName;
|
|
14
|
+
private _checkDefinedNameDirty;
|
|
12
15
|
private _injectDefinedName;
|
|
13
16
|
}
|
|
@@ -14,6 +14,7 @@ export type LambdaPrivacyVarType = Map<string, Nullable<BaseAstNode>>;
|
|
|
14
14
|
export declare class BaseAstNode extends Disposable {
|
|
15
15
|
private _token;
|
|
16
16
|
private _children;
|
|
17
|
+
private _definedNames;
|
|
17
18
|
private _parent;
|
|
18
19
|
private _valueObject;
|
|
19
20
|
private _calculateState;
|
|
@@ -46,6 +47,8 @@ export declare class BaseAstNode extends Disposable {
|
|
|
46
47
|
};
|
|
47
48
|
executeAsync(): Promise<AstNodePromiseType>;
|
|
48
49
|
serialize(): IAstNodeNodeJson;
|
|
50
|
+
hasDefinedName(definedName: string): boolean;
|
|
51
|
+
setDefinedNames(definedNames: Array<string>): void;
|
|
49
52
|
}
|
|
50
53
|
export declare class ErrorNode extends BaseAstNode {
|
|
51
54
|
private _errorValueObject;
|
|
@@ -6,7 +6,6 @@ import { BaseReferenceObject } from '../reference-object/base-reference-object';
|
|
|
6
6
|
import { LexerNode } from '../analysis/lexer-node';
|
|
7
7
|
import { ISuperTableService } from '../../services/super-table.service';
|
|
8
8
|
import { IFormulaRuntimeService } from '../../services/runtime.service';
|
|
9
|
-
import { IDefinedNamesService } from '../../services/defined-names.service';
|
|
10
9
|
import { IAccessor, Injector } from '@wendellhu/redi';
|
|
11
10
|
|
|
12
11
|
export declare class ReferenceNode extends BaseAstNode {
|
|
@@ -19,12 +18,11 @@ export declare class ReferenceNode extends BaseAstNode {
|
|
|
19
18
|
execute(): void;
|
|
20
19
|
}
|
|
21
20
|
export declare class ReferenceNodeFactory extends BaseAstNodeFactory {
|
|
22
|
-
private readonly _definedNamesService;
|
|
23
21
|
private readonly _superTableService;
|
|
24
22
|
private readonly _formulaRuntimeService;
|
|
25
23
|
private readonly _functionService;
|
|
26
24
|
private readonly _injector;
|
|
27
|
-
constructor(
|
|
25
|
+
constructor(_superTableService: ISuperTableService, _formulaRuntimeService: IFormulaRuntimeService, _functionService: IFunctionService, _injector: Injector);
|
|
28
26
|
get zIndex(): number;
|
|
29
27
|
checkAndCreateNodeType(param: LexerNode | string): ReferenceNode | undefined;
|
|
30
28
|
}
|
|
@@ -47,6 +47,7 @@ export declare class FormulaDependencyGenerator extends Disposable {
|
|
|
47
47
|
* @param node
|
|
48
48
|
*/
|
|
49
49
|
private _getRangeListByNode;
|
|
50
|
+
private _isDirtyDefinedForNode;
|
|
50
51
|
/**
|
|
51
52
|
* Build a formula dependency tree based on the dependency relationships.
|
|
52
53
|
* @param treeList
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LexerTreeBuilder } from '../analysis/lexer-tree-builder';
|
|
2
|
+
|
|
3
|
+
export declare function isFormulaTransformable(lexerTreeBuilder: LexerTreeBuilder, formula: string): boolean;
|
|
4
|
+
export declare function transformFormula(lexerTreeBuilder: LexerTreeBuilder, formula: string, originRow: number, originCol: number, targetRow: number, targetCol: number): string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitSheetNameMap, INumfmtItemMap, IDirtyUnitOtherFormulaMap, } from './basics/common';
|
|
16
|
+
export type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitSheetNameMap, INumfmtItemMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, } from './basics/common';
|
|
17
17
|
export { isInDirtyRange } from './basics/dirty';
|
|
18
18
|
export { ErrorType } from './basics/error-type';
|
|
19
19
|
export { FunctionType, type IFunctionInfo, type IFunctionParam } from './basics/function';
|
|
@@ -23,7 +23,7 @@ export { convertUnitDataToRuntime } from './basics/runtime';
|
|
|
23
23
|
export { matchToken, compareToken, operatorToken } from './basics/token';
|
|
24
24
|
export { RegisterFunctionMutation } from './commands/mutations/register-function.mutation';
|
|
25
25
|
export { type ISetArrayFormulaDataMutationParams, SetArrayFormulaDataMutation, SetArrayFormulaDataUndoMutationFactory, } from './commands/mutations/set-array-formula-data.mutation';
|
|
26
|
-
export { RemoveDefinedNameMutation, SetDefinedNameMutation } from './commands/mutations/set-defined-name.mutation';
|
|
26
|
+
export { RemoveDefinedNameMutation, SetDefinedNameMutation, SetDefinedNameCurrentMutation, type ISetDefinedNameMutationSearchParam, type ISetDefinedNameMutationParam } from './commands/mutations/set-defined-name.mutation';
|
|
27
27
|
export { RemoveFeatureCalculationMutation, SetFeatureCalculationMutation, } from './commands/mutations/set-feature-calculation.mutation';
|
|
28
28
|
export { type ISetFormulaCalculationNotificationMutation, type ISetFormulaCalculationResultMutation, type ISetFormulaCalculationStartMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, } from './commands/mutations/set-formula-calculation.mutation';
|
|
29
29
|
export { type ISetFormulaDataMutationParams, SetFormulaDataMutation, } from './commands/mutations/set-formula-data.mutation';
|
|
@@ -90,7 +90,8 @@ export { SetNumfmtFormulaDataMutation } from './commands/mutations/set-numfmt-fo
|
|
|
90
90
|
export type { ISetNumfmtFormulaDataMutationParams } from './commands/mutations/set-numfmt-formula-data.mutation';
|
|
91
91
|
export { isReferenceString } from './basics/regex';
|
|
92
92
|
export { matchRefDrawToken } from './basics/match-token';
|
|
93
|
-
export { IDefinedNamesService, DefinedNamesService } from './services/defined-names.service';
|
|
93
|
+
export { IDefinedNamesService, DefinedNamesService, type IDefinedNamesServiceParam, type IDefinedNameMapItem } from './services/defined-names.service';
|
|
94
|
+
export { isFormulaTransformable, transformFormula } from './engine/utils/relative-formula';
|
|
94
95
|
export { IFormulaRuntimeService, FormulaRuntimeService } from './services/runtime.service';
|
|
95
96
|
export { IFormulaCurrentConfigService, FormulaCurrentConfigService } from './services/current-data.service';
|
|
96
97
|
export { IActiveDirtyManagerService } from './services/active-dirty-manager.service';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap } from '
|
|
1
|
+
import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap } from '../basics/common';
|
|
2
2
|
import { ICommandInfo, IUnitRange, Nullable, Disposable } from '@univerjs/core';
|
|
3
3
|
|
|
4
4
|
export interface IDirtyConversionManagerParams {
|
|
@@ -6,6 +6,7 @@ export interface IDirtyConversionManagerParams {
|
|
|
6
6
|
getDirtyData: (command: ICommandInfo) => {
|
|
7
7
|
dirtyRanges?: IUnitRange[];
|
|
8
8
|
dirtyNameMap?: IDirtyUnitSheetNameMap;
|
|
9
|
+
dirtyDefinedNameMap?: IDirtyUnitSheetDefinedNameMap;
|
|
9
10
|
dirtyUnitFeatureMap?: IDirtyUnitFeatureMap;
|
|
10
11
|
dirtyUnitOtherFormulaMap?: IDirtyUnitOtherFormulaMap;
|
|
11
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, INumfmtItemMap, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitSheetNameMap } from '../basics/common';
|
|
1
|
+
import { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, INumfmtItemMap, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitSheetNameMap } from '../basics/common';
|
|
2
2
|
import { IUnitRange, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
3
3
|
|
|
4
4
|
export declare const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = "__default_document_sub_component_id20231101__";
|
|
@@ -10,6 +10,7 @@ export interface IFormulaCurrentConfigService {
|
|
|
10
10
|
isForceCalculate(): boolean;
|
|
11
11
|
getDirtyRanges(): IUnitRange[];
|
|
12
12
|
getDirtyNameMap(): IDirtyUnitSheetNameMap;
|
|
13
|
+
getDirtyDefinedNameMap(): IDirtyUnitSheetDefinedNameMap;
|
|
13
14
|
getDirtyUnitFeatureMap(): IDirtyUnitFeatureMap;
|
|
14
15
|
registerUnitData(unitData: IUnitData): void;
|
|
15
16
|
registerFormulaData(formulaData: IFormulaData): void;
|
|
@@ -19,6 +20,10 @@ export interface IFormulaCurrentConfigService {
|
|
|
19
20
|
getArrayFormulaCellData(): IRuntimeUnitDataType;
|
|
20
21
|
getSheetName(unitId: string, sheetId: string): string;
|
|
21
22
|
getDirtyUnitOtherFormulaMap(): IDirtyUnitOtherFormulaMap;
|
|
23
|
+
getExecuteUnitId(): Nullable<string>;
|
|
24
|
+
getExecuteSubUnitId(): Nullable<string>;
|
|
25
|
+
setExecuteUnitId(unitId: string): void;
|
|
26
|
+
setExecuteSubUnitId(subUnitId: string): void;
|
|
22
27
|
}
|
|
23
28
|
export declare class FormulaCurrentConfigService extends Disposable implements IFormulaCurrentConfigService {
|
|
24
29
|
private readonly _currentUniverService;
|
|
@@ -29,13 +34,20 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
29
34
|
private _forceCalculate;
|
|
30
35
|
private _dirtyRanges;
|
|
31
36
|
private _dirtyNameMap;
|
|
37
|
+
private _dirtyDefinedNameMap;
|
|
32
38
|
private _numfmtItemMap;
|
|
33
39
|
private _dirtyUnitFeatureMap;
|
|
34
40
|
private _dirtyUnitOtherFormulaMap;
|
|
35
41
|
private _excludedCell;
|
|
36
42
|
private _sheetIdToNameMap;
|
|
43
|
+
private _executeUnitId;
|
|
44
|
+
private _executeSubUnitId;
|
|
37
45
|
constructor(_currentUniverService: IUniverInstanceService);
|
|
38
46
|
dispose(): void;
|
|
47
|
+
getExecuteUnitId(): Nullable<string>;
|
|
48
|
+
getExecuteSubUnitId(): Nullable<string>;
|
|
49
|
+
setExecuteUnitId(unitId: string): void;
|
|
50
|
+
setExecuteSubUnitId(subUnitId: string): void;
|
|
39
51
|
getExcludedRange(): Nullable<IUnitExcludedCell>;
|
|
40
52
|
getUnitData(): IUnitData;
|
|
41
53
|
getFormulaData(): IFormulaData;
|
|
@@ -44,10 +56,11 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
44
56
|
isForceCalculate(): boolean;
|
|
45
57
|
getDirtyRanges(): IUnitRange[];
|
|
46
58
|
getDirtyNameMap(): IDirtyUnitSheetNameMap;
|
|
59
|
+
getDirtyDefinedNameMap(): IDirtyUnitSheetDefinedNameMap;
|
|
47
60
|
getNumfmtItemMap(): INumfmtItemMap;
|
|
48
61
|
getDirtyUnitFeatureMap(): IDirtyUnitFeatureMap;
|
|
49
|
-
getSheetName(unitId: string, sheetId: string): string;
|
|
50
62
|
getDirtyUnitOtherFormulaMap(): IDirtyUnitOtherFormulaMap;
|
|
63
|
+
getSheetName(unitId: string, sheetId: string): string;
|
|
51
64
|
load(config: IFormulaDatasetConfig): void;
|
|
52
65
|
loadDirtyRangesAndExcludedCell(dirtyRanges: IUnitRange[], excludedCell?: IUnitExcludedCell): void;
|
|
53
66
|
registerUnitData(unitData: IUnitData): void;
|
|
@@ -1,19 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { IUnitRange, Nullable, Disposable } from '@univerjs/core';
|
|
2
3
|
|
|
4
|
+
export interface IDefinedNamesServiceParam {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
formulaOrRefString: string;
|
|
8
|
+
comment?: string;
|
|
9
|
+
localSheetId?: string;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface IDefinedNamesServiceFocusParam extends IDefinedNamesServiceParam {
|
|
13
|
+
unitId: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IDefinedNameMap {
|
|
16
|
+
[unitId: string]: IDefinedNameMapItem;
|
|
17
|
+
}
|
|
18
|
+
export interface IDefinedNameMapItem {
|
|
19
|
+
[id: string]: IDefinedNamesServiceParam;
|
|
20
|
+
}
|
|
3
21
|
export interface IDefinedNamesService {
|
|
4
|
-
registerDefinedName(unitId: string,
|
|
5
|
-
|
|
6
|
-
|
|
22
|
+
registerDefinedName(unitId: string, param: IDefinedNamesServiceParam): void;
|
|
23
|
+
registerDefinedNames(unitId: string, params: IDefinedNameMapItem): void;
|
|
24
|
+
getDefinedNameMap(unitId: string): Nullable<IDefinedNameMapItem>;
|
|
25
|
+
getValueByName(unitId: string, name: string): Nullable<IDefinedNamesServiceParam>;
|
|
26
|
+
getValueById(unitId: string, id: string): Nullable<IDefinedNamesServiceParam>;
|
|
7
27
|
removeDefinedName(unitId: string, name: string): void;
|
|
8
28
|
hasDefinedName(unitId: string): boolean;
|
|
29
|
+
setCurrentRange(range: IUnitRange): void;
|
|
30
|
+
getCurrentRange(): IUnitRange;
|
|
31
|
+
getCurrentRangeForString(): string;
|
|
32
|
+
currentRange$: Observable<IUnitRange>;
|
|
33
|
+
update$: Observable<unknown>;
|
|
34
|
+
focusRange$: Observable<IDefinedNamesServiceFocusParam>;
|
|
35
|
+
focusRange(unitId: string, id: string): void;
|
|
9
36
|
}
|
|
10
37
|
export declare class DefinedNamesService extends Disposable implements IDefinedNamesService {
|
|
11
38
|
private _definedNameMap;
|
|
39
|
+
private readonly _update$;
|
|
40
|
+
readonly update$: Observable<unknown>;
|
|
41
|
+
private _currentRange;
|
|
42
|
+
private readonly _currentRange$;
|
|
43
|
+
readonly currentRange$: Observable<IUnitRange>;
|
|
44
|
+
private readonly _focusRange$;
|
|
45
|
+
readonly focusRange$: Observable<IDefinedNamesServiceFocusParam>;
|
|
46
|
+
constructor();
|
|
12
47
|
dispose(): void;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
48
|
+
focusRange(unitId: string, id: string): void;
|
|
49
|
+
setCurrentRange(range: IUnitRange): void;
|
|
50
|
+
getCurrentRange(): IUnitRange;
|
|
51
|
+
getCurrentRangeForString(): string;
|
|
52
|
+
registerDefinedNames(unitId: string, params: IDefinedNameMapItem): void;
|
|
53
|
+
registerDefinedName(unitId: string, param: IDefinedNamesServiceParam): void;
|
|
54
|
+
removeDefinedName(unitId: string, id: string): void;
|
|
55
|
+
getDefinedNameMap(unitId: string): IDefinedNameMapItem;
|
|
56
|
+
getValueByName(unitId: string, name: string): IDefinedNamesServiceParam | null;
|
|
57
|
+
getValueById(unitId: string, id: string): IDefinedNamesServiceParam;
|
|
17
58
|
hasDefinedName(unitId: string): boolean;
|
|
59
|
+
private _update;
|
|
18
60
|
}
|
|
19
61
|
export declare const IDefinedNamesService: import('@wendellhu/redi').IdentifierDecorator<DefinedNamesService>;
|