@univerjs/engine-formula 0.1.2 → 0.1.4
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 +5872 -4638
- package/lib/types/basics/common.d.ts +11 -4
- package/lib/types/basics/date.d.ts +1 -1
- package/lib/types/basics/format.d.ts +24 -0
- package/lib/types/basics/inverted-index-cache.d.ts +2 -2
- package/lib/types/basics/match-token.d.ts +5 -0
- package/lib/types/basics/object-class-type.d.ts +4 -0
- package/lib/types/basics/runtime.d.ts +2 -1
- package/lib/types/basics/token-type.d.ts +1 -0
- package/lib/types/basics/token.d.ts +1 -0
- package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +2 -2
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +5 -1
- package/lib/types/engine/analysis/parser.d.ts +0 -1
- package/lib/types/engine/ast-node/reference-node.d.ts +3 -3
- package/lib/types/engine/dependency/dependency-tree.d.ts +20 -4
- package/lib/types/engine/dependency/formula-dependency.d.ts +0 -6
- package/lib/types/engine/reference-object/base-reference-object.d.ts +8 -6
- package/lib/types/engine/utils/ast-node-tool.d.ts +18 -0
- package/lib/types/engine/utils/char-kit.d.ts +25 -0
- package/lib/types/engine/utils/compare.d.ts +1 -0
- package/lib/types/engine/utils/object-compare.d.ts +0 -1
- package/lib/types/engine/utils/prefixHandler.d.ts +24 -0
- package/lib/types/engine/utils/r1c1-reference.d.ts +2 -3
- package/lib/types/engine/utils/reference.d.ts +4 -9
- package/lib/types/engine/value-object/__tests__/array-value-divided.spec.d.ts +16 -0
- package/lib/types/engine/value-object/__tests__/array-value-minus.spec.d.ts +16 -0
- package/lib/types/engine/value-object/__tests__/array-value-multiply.spec.d.ts +16 -0
- package/lib/types/engine/value-object/__tests__/array-value-plus.spec.d.ts +16 -0
- package/lib/types/engine/value-object/array-value-object.d.ts +7 -7
- package/lib/types/engine/value-object/base-value-object.d.ts +9 -4
- package/lib/types/engine/value-object/cube-value-object.d.ts +30 -0
- package/lib/types/engine/value-object/lambda-value-object.d.ts +1 -0
- package/lib/types/engine/value-object/primitive-object.d.ts +25 -4
- package/lib/types/functions/base-function.d.ts +4 -9
- package/lib/types/functions/logical/or/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/logical/or/index.d.ts +20 -0
- package/lib/types/functions/lookup/function-map.d.ts +1 -4
- package/lib/types/functions/lookup/index/index.d.ts +11 -2
- package/lib/types/functions/lookup/offset/index.d.ts +2 -2
- package/lib/types/functions/meta/cube/index.d.ts +20 -0
- package/lib/types/functions/meta/function-map.d.ts +2 -2
- package/lib/types/functions/meta/function-names.d.ts +2 -1
- package/lib/types/functions/text/len/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/len/index.d.ts +21 -0
- package/lib/types/functions/text/lenb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/lenb/index.d.ts +21 -0
- package/lib/types/functions/text/text/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/text/index.d.ts +20 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/services/current-data.service.d.ts +3 -0
- package/lib/umd/index.js +1 -1
- package/package.json +13 -11
|
@@ -48,6 +48,11 @@ export interface IRuntimeUnitDataType {
|
|
|
48
48
|
[sheetId: string]: ObjectMatrix<Nullable<ICellData>>;
|
|
49
49
|
}>;
|
|
50
50
|
}
|
|
51
|
+
export interface IRuntimeUnitDataPrimitiveType {
|
|
52
|
+
[unitId: string]: Nullable<{
|
|
53
|
+
[sheetId: string]: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
51
56
|
export interface IRuntimeOtherUnitDataType {
|
|
52
57
|
[unitId: string]: Nullable<{
|
|
53
58
|
[sheetId: string]: Nullable<{
|
|
@@ -60,6 +65,11 @@ export interface IUnitSheetNameMap {
|
|
|
60
65
|
[sheetName: string]: string;
|
|
61
66
|
}>;
|
|
62
67
|
}
|
|
68
|
+
export interface IUnitSheetIdToNameMap {
|
|
69
|
+
[unitId: string]: Nullable<{
|
|
70
|
+
[sheetId: string]: string;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
63
73
|
export interface IDirtyUnitSheetNameMap {
|
|
64
74
|
[unitId: string]: Nullable<{
|
|
65
75
|
[sheetId: string]: string;
|
|
@@ -82,10 +92,7 @@ export interface IFeatureDirtyRangeType {
|
|
|
82
92
|
[sheetId: string]: IRange[];
|
|
83
93
|
}>;
|
|
84
94
|
}
|
|
85
|
-
export interface IArrayFormulaUnitCellType {
|
|
86
|
-
[unitId: string]: Nullable<{
|
|
87
|
-
[sheetId: string]: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
|
|
88
|
-
}>;
|
|
95
|
+
export interface IArrayFormulaUnitCellType extends IRuntimeUnitDataPrimitiveType {
|
|
89
96
|
}
|
|
90
97
|
export interface IFormulaData {
|
|
91
98
|
[unitId: string]: Nullable<{
|
|
@@ -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 declare const
|
|
16
|
+
export declare const DEFAULT_DATE_FORMAT = "yyyy/mm/dd;@";
|
|
17
17
|
/**
|
|
18
18
|
* Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.
|
|
19
19
|
*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* covert number to preview string by pattern
|
|
18
|
+
* @TODODushusir: Internationalization, reuse with numfmt
|
|
19
|
+
*
|
|
20
|
+
* @param pattern
|
|
21
|
+
* @param value
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export declare const getFormatPreview: (pattern: string, value: number) => any;
|
|
@@ -29,8 +29,8 @@ export declare class InvertedIndexCache {
|
|
|
29
29
|
private _cache;
|
|
30
30
|
private _continueBuildingCache;
|
|
31
31
|
set(unitId: string, sheetId: string, column: number, value: string | number | boolean | null, row: number): void;
|
|
32
|
-
getCellValuePositions(unitId: string, sheetId: string, column: number): Map<string | number | boolean | null, number
|
|
33
|
-
getCellPositions(unitId: string, sheetId: string, column: number, value: string | number | boolean): number
|
|
32
|
+
getCellValuePositions(unitId: string, sheetId: string, column: number): Map<string | number | boolean | null, Set<number>> | undefined;
|
|
33
|
+
getCellPositions(unitId: string, sheetId: string, column: number, value: string | number | boolean): Set<number> | undefined;
|
|
34
34
|
getCellPosition(unitId: string, sheetId: string, column: number, value: string | number | boolean, startRow: number, endRow: number): number | undefined;
|
|
35
35
|
setContinueBuildingCache(unitId: string, sheetId: string, column: number, startRow: number, endRow: number): void;
|
|
36
36
|
shouldContinueBuildingCache(unitId: string, sheetId: string, column: number, row: number): boolean;
|
|
@@ -18,3 +18,8 @@ export declare const FORMULA_LEXER_TOKENS: (operatorToken | suffixToken | compar
|
|
|
18
18
|
export declare function isFormulaLexerToken(str: string): boolean;
|
|
19
19
|
export declare function includeFormulaLexerToken(str: string): boolean;
|
|
20
20
|
export declare function normalizeSheetName(sheetName: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Determine whether the character is a token keyword for the formula engine.
|
|
23
|
+
* @param char
|
|
24
|
+
*/
|
|
25
|
+
export declare function matchRefDrawToken(char: string): boolean;
|
|
@@ -17,6 +17,10 @@ import { Disposable } from '@univerjs/core';
|
|
|
17
17
|
export declare class ObjectClassType extends Disposable {
|
|
18
18
|
pattern: string;
|
|
19
19
|
getPattern(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Only used in NumberValueObject
|
|
22
|
+
* @param pattern
|
|
23
|
+
*/
|
|
20
24
|
setPattern(pattern: string): void;
|
|
21
25
|
isError(): boolean;
|
|
22
26
|
isAsyncObject(): boolean;
|
|
@@ -13,5 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IArrayFormulaUnitCellType, IRuntimeUnitDataType } from './common';
|
|
16
|
+
import type { IArrayFormulaUnitCellType, IRuntimeUnitDataPrimitiveType, IRuntimeUnitDataType } from './common';
|
|
17
17
|
export declare function convertUnitDataToRuntime(unitData: IArrayFormulaUnitCellType): IRuntimeUnitDataType;
|
|
18
|
+
export declare function convertRuntimeToUnitData(unitData: IRuntimeUnitDataType): IRuntimeUnitDataPrimitiveType;
|
|
@@ -20,3 +20,4 @@ export declare const DEFAULT_TOKEN_TYPE_LAMBDA_RUNTIME_PARAMETER = "LR_1";
|
|
|
20
20
|
export declare const DEFAULT_TOKEN_TYPE_LAMBDA_OMIT_PARAMETER = "LO_1";
|
|
21
21
|
export declare const DEFAULT_TOKEN_LET_FUNCTION_NAME = "LET";
|
|
22
22
|
export declare const DEFAULT_TOKEN_LAMBDA_FUNCTION_NAME = "LAMBDA";
|
|
23
|
+
export declare const DEFAULT_TOKEN_CUBE_FUNCTION_NAME = "CUBE";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IExecutionOptions, IMutation, IUnitRange, Nullable } from '@univerjs/core';
|
|
17
|
-
import type { IDirtyUnitFeatureMap, IDirtyUnitSheetNameMap, INumfmtItemMap, IRuntimeOtherUnitDataType,
|
|
17
|
+
import type { IDirtyUnitFeatureMap, IDirtyUnitSheetNameMap, INumfmtItemMap, IRuntimeOtherUnitDataType, IRuntimeUnitDataPrimitiveType } from '../../basics/common';
|
|
18
18
|
import type { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
|
|
19
19
|
export interface ISetFormulaCalculationStartMutation {
|
|
20
20
|
dirtyRanges: IUnitRange[];
|
|
@@ -38,7 +38,7 @@ export interface ISetFormulaCalculationNotificationMutation {
|
|
|
38
38
|
}
|
|
39
39
|
export declare const SetFormulaCalculationNotificationMutation: IMutation<ISetFormulaCalculationNotificationMutation>;
|
|
40
40
|
export interface ISetFormulaCalculationResultMutation {
|
|
41
|
-
unitData:
|
|
41
|
+
unitData: IRuntimeUnitDataPrimitiveType;
|
|
42
42
|
unitOtherData: IRuntimeOtherUnitDataType;
|
|
43
43
|
}
|
|
44
44
|
export declare const SetFormulaCalculationResultMutation: IMutation<ISetFormulaCalculationResultMutation>;
|
|
@@ -52,7 +52,6 @@ export declare class LexerTreeBuilder extends Disposable {
|
|
|
52
52
|
/**
|
|
53
53
|
* Estimate the number of right brackets that need to be automatically added to the end of the formula.
|
|
54
54
|
* @param formulaString
|
|
55
|
-
* @returns
|
|
56
55
|
*/
|
|
57
56
|
checkIfAddBracket(formulaString: string): number;
|
|
58
57
|
sequenceNodesBuilder(formulaString: string): (string | ISequenceNode)[] | undefined;
|
|
@@ -72,6 +71,10 @@ export declare class LexerTreeBuilder extends Disposable {
|
|
|
72
71
|
hasDefinedName: boolean;
|
|
73
72
|
}): ErrorType.VALUE | LexerNode | (string | LexerNode)[] | undefined;
|
|
74
73
|
private _suffixExpressionHandler;
|
|
74
|
+
private _checkCloseBracket;
|
|
75
|
+
private _checkOpenBracket;
|
|
76
|
+
private _checkOperator;
|
|
77
|
+
private _deletePlusForPreNode;
|
|
75
78
|
private _resetCurrentLexerNode;
|
|
76
79
|
private _resetSegment;
|
|
77
80
|
private _openBracket;
|
|
@@ -79,6 +82,7 @@ export declare class LexerTreeBuilder extends Disposable {
|
|
|
79
82
|
private _openSquareBracket;
|
|
80
83
|
private _closeSquareBracket;
|
|
81
84
|
private _getCurrentBracket;
|
|
85
|
+
private _changeCurrentBracket;
|
|
82
86
|
private _openBraces;
|
|
83
87
|
private _closeBraces;
|
|
84
88
|
private _openSingleQuotation;
|
|
@@ -48,7 +48,6 @@ export declare class AstTreeBuilder extends Disposable {
|
|
|
48
48
|
parse(lexerNode: LexerNode, refOffsetX?: number, refOffsetY?: number): Nullable<BaseAstNode>;
|
|
49
49
|
private _lambdaParameterHandler;
|
|
50
50
|
private _changeLetToLambda;
|
|
51
|
-
private _getTopParent;
|
|
52
51
|
private _parse;
|
|
53
52
|
private _checkAstNode;
|
|
54
53
|
private _initializeAstNode;
|
|
@@ -18,9 +18,9 @@ import { Injector } from '@wendellhu/redi';
|
|
|
18
18
|
import { IDefinedNamesService } from '../../services/defined-names.service';
|
|
19
19
|
import { IFormulaRuntimeService } from '../../services/runtime.service';
|
|
20
20
|
import { ISuperTableService } from '../../services/super-table.service';
|
|
21
|
-
import { Lexer } from '../analysis/lexer';
|
|
22
21
|
import { LexerNode } from '../analysis/lexer-node';
|
|
23
22
|
import type { BaseReferenceObject } from '../reference-object/base-reference-object';
|
|
23
|
+
import { IFunctionService } from '../../services/function.service';
|
|
24
24
|
import { BaseAstNode } from './base-ast-node';
|
|
25
25
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
26
26
|
import { NodeType } from './node-type';
|
|
@@ -37,9 +37,9 @@ export declare class ReferenceNodeFactory extends BaseAstNodeFactory {
|
|
|
37
37
|
private readonly _definedNamesService;
|
|
38
38
|
private readonly _superTableService;
|
|
39
39
|
private readonly _formulaRuntimeService;
|
|
40
|
-
private readonly
|
|
40
|
+
private readonly _functionService;
|
|
41
41
|
private readonly _injector;
|
|
42
|
-
constructor(_definedNamesService: IDefinedNamesService, _superTableService: ISuperTableService, _formulaRuntimeService: IFormulaRuntimeService,
|
|
42
|
+
constructor(_definedNamesService: IDefinedNamesService, _superTableService: ISuperTableService, _formulaRuntimeService: IFormulaRuntimeService, _functionService: IFunctionService, _injector: Injector);
|
|
43
43
|
get zIndex(): number;
|
|
44
44
|
checkAndCreateNodeType(param: LexerNode | string): ReferenceNode | undefined;
|
|
45
45
|
}
|
|
@@ -22,6 +22,10 @@ export declare enum FDtreeStateType {
|
|
|
22
22
|
ADDED = 1,
|
|
23
23
|
SKIP = 2
|
|
24
24
|
}
|
|
25
|
+
export interface IUnitRangeWithToken {
|
|
26
|
+
gridRange: IUnitRange;
|
|
27
|
+
token: string;
|
|
28
|
+
}
|
|
25
29
|
/**
|
|
26
30
|
* A dependency tree, capable of calculating mutual dependencies,
|
|
27
31
|
* is used to determine the order of formula calculations.
|
|
@@ -37,7 +41,7 @@ export declare class FormulaDependencyTree extends Disposable {
|
|
|
37
41
|
columnCount: number;
|
|
38
42
|
subUnitId: string;
|
|
39
43
|
unitId: string;
|
|
40
|
-
rangeList:
|
|
44
|
+
rangeList: IUnitRangeWithToken[];
|
|
41
45
|
formulaId: Nullable<string>;
|
|
42
46
|
featureId: Nullable<string>;
|
|
43
47
|
getDirtyData: Nullable<(tree: FormulaDependencyTree) => {
|
|
@@ -55,7 +59,6 @@ export declare class FormulaDependencyTree extends Disposable {
|
|
|
55
59
|
* "Determine whether all ranges of the current node exist within the dirty area.
|
|
56
60
|
* If they are within the dirty area, return true, indicating that this node needs to be calculated.
|
|
57
61
|
* @param dependencyRangeList
|
|
58
|
-
* @returns
|
|
59
62
|
*/
|
|
60
63
|
dependencyRange(dependencyRangeList: Map<string, Map<string, IRange[]>>, dirtyUnitSheetNameMap: IDirtyUnitSheetNameMap, unitExcludedCell: Nullable<IUnitExcludedCell>): boolean;
|
|
61
64
|
pushChildren(tree: FormulaDependencyTree): void;
|
|
@@ -63,12 +66,25 @@ export declare class FormulaDependencyTree extends Disposable {
|
|
|
63
66
|
* Add the range corresponding to the current ast node.
|
|
64
67
|
* @param range
|
|
65
68
|
*/
|
|
66
|
-
pushRangeList(range:
|
|
69
|
+
pushRangeList(range: IUnitRangeWithToken): void;
|
|
67
70
|
/**
|
|
68
71
|
* Determine whether it is dependent on other trees.
|
|
69
72
|
* @param dependenceTree
|
|
70
|
-
* @returns
|
|
71
73
|
*/
|
|
72
74
|
dependency(dependenceTree: FormulaDependencyTree): boolean;
|
|
73
75
|
private _pushParent;
|
|
74
76
|
}
|
|
77
|
+
export declare class FormulaDependencyTreeCache extends Disposable {
|
|
78
|
+
private _cacheItems;
|
|
79
|
+
dispose(): void;
|
|
80
|
+
size(): number;
|
|
81
|
+
add(unitRangeWithToken: IUnitRangeWithToken, tree: FormulaDependencyTree): void;
|
|
82
|
+
clear(): void;
|
|
83
|
+
remove(token: string, tree: FormulaDependencyTree): void;
|
|
84
|
+
delete(token: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Determine whether range is dependent on other trees.
|
|
87
|
+
* @param dependenceTree
|
|
88
|
+
*/
|
|
89
|
+
dependency(dependenceTree: FormulaDependencyTree): void;
|
|
90
|
+
}
|
|
@@ -43,12 +43,10 @@ export declare class FormulaDependencyGenerator extends Disposable {
|
|
|
43
43
|
/**
|
|
44
44
|
* Generate nodes for the dependency tree, where each node contains all the reference data ranges included in each formula.
|
|
45
45
|
* @param formulaData
|
|
46
|
-
* @returns
|
|
47
46
|
*/
|
|
48
47
|
private _generateTreeList;
|
|
49
48
|
/**
|
|
50
49
|
* Break down the dirty areas into ranges for subsequent matching.
|
|
51
|
-
* @returns
|
|
52
50
|
*/
|
|
53
51
|
private _updateRangeFlatten;
|
|
54
52
|
private _generateAstNode;
|
|
@@ -61,26 +59,22 @@ export declare class FormulaDependencyGenerator extends Disposable {
|
|
|
61
59
|
* Calculate the range required for collection in advance,
|
|
62
60
|
* including references and location functions (such as OFFSET, INDIRECT, INDEX, etc.).
|
|
63
61
|
* @param node
|
|
64
|
-
* @returns
|
|
65
62
|
*/
|
|
66
63
|
private _getRangeListByNode;
|
|
67
64
|
/**
|
|
68
65
|
* Build a formula dependency tree based on the dependency relationships.
|
|
69
66
|
* @param treeList
|
|
70
|
-
* @returns
|
|
71
67
|
*/
|
|
72
68
|
private _getUpdateTreeListAndMakeDependency;
|
|
73
69
|
/**
|
|
74
70
|
* Determine whether all ranges of the current node exist within the dirty area.
|
|
75
71
|
* If they are within the dirty area, return true, indicating that this node needs to be calculated.
|
|
76
72
|
* @param tree
|
|
77
|
-
* @returns
|
|
78
73
|
*/
|
|
79
74
|
private _includeTree;
|
|
80
75
|
/**
|
|
81
76
|
* Generate the final formula calculation order array by traversing the dependency tree established via depth-first search.
|
|
82
77
|
* @param treeList
|
|
83
|
-
* @returns
|
|
84
78
|
*/
|
|
85
79
|
private _calculateRunList;
|
|
86
80
|
}
|
|
@@ -19,7 +19,7 @@ import type { INumfmtItemMap, IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap
|
|
|
19
19
|
import { ObjectClassType } from '../../basics/object-class-type';
|
|
20
20
|
import { ArrayValueObject } from '../value-object/array-value-object';
|
|
21
21
|
import { type BaseValueObject, ErrorValueObject } from '../value-object/base-value-object';
|
|
22
|
-
import {
|
|
22
|
+
import { NullValueObject, NumberValueObject } from '../value-object/primitive-object';
|
|
23
23
|
export type NodeValueType = BaseValueObject | BaseReferenceObject | AsyncObject | AsyncArrayObject;
|
|
24
24
|
export type FunctionVariantType = BaseValueObject | BaseReferenceObject;
|
|
25
25
|
export declare const FORMULA_REF_TO_ARRAY_CACHE: FormulaAstLRU<ArrayValueObject>;
|
|
@@ -41,6 +41,8 @@ export declare class BaseReferenceObject extends ObjectClassType {
|
|
|
41
41
|
private _refOffsetY;
|
|
42
42
|
constructor(_token: string);
|
|
43
43
|
dispose(): void;
|
|
44
|
+
getToken(): string;
|
|
45
|
+
setToken(token: string): void;
|
|
44
46
|
isExceedRange(): boolean;
|
|
45
47
|
setRefOffset(x?: number, y?: number): void;
|
|
46
48
|
getRefOffset(): {
|
|
@@ -55,7 +57,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
|
|
|
55
57
|
};
|
|
56
58
|
isReferenceObject(): boolean;
|
|
57
59
|
iterator(callback: (valueObject: Nullable<BaseValueObject>, rowIndex: number, columnIndex: number) => Nullable<boolean>): Nullable<boolean>;
|
|
58
|
-
getFirstCell(): ErrorValueObject | NullValueObject | NumberValueObject |
|
|
60
|
+
getFirstCell(): ErrorValueObject | NullValueObject | NumberValueObject | import("../value-object/primitive-object").BooleanValueObject | import("../value-object/primitive-object").StringValueObject | ArrayValueObject;
|
|
59
61
|
getRangeData(): IRange;
|
|
60
62
|
setRangeData(range: IRange): void;
|
|
61
63
|
getUnitId(): string;
|
|
@@ -98,16 +100,16 @@ export declare class BaseReferenceObject extends ObjectClassType {
|
|
|
98
100
|
isTable(): boolean;
|
|
99
101
|
unionBy(referenceObject: BaseReferenceObject): NodeValueType;
|
|
100
102
|
unionRange(rangeData1: IRange, rangeData2: IRange): IRange;
|
|
101
|
-
getCellValueObject(cell: ICellData): ErrorValueObject | NullValueObject | NumberValueObject |
|
|
102
|
-
getCellByRow(row: number): ErrorValueObject | NullValueObject | NumberValueObject |
|
|
103
|
-
getCellByColumn(column: number): ErrorValueObject | NullValueObject | NumberValueObject |
|
|
103
|
+
getCellValueObject(cell: ICellData): ErrorValueObject | NullValueObject | NumberValueObject | import("../value-object/primitive-object").BooleanValueObject | import("../value-object/primitive-object").StringValueObject | ArrayValueObject;
|
|
104
|
+
getCellByRow(row: number): ErrorValueObject | NullValueObject | NumberValueObject | import("../value-object/primitive-object").BooleanValueObject | import("../value-object/primitive-object").StringValueObject | ArrayValueObject;
|
|
105
|
+
getCellByColumn(column: number): ErrorValueObject | NullValueObject | NumberValueObject | import("../value-object/primitive-object").BooleanValueObject | import("../value-object/primitive-object").StringValueObject | ArrayValueObject;
|
|
104
106
|
getCurrentActiveSheetData(): import("../../basics/common").ISheetItem;
|
|
105
107
|
getCurrentRuntimeSheetData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>> | undefined;
|
|
106
108
|
getCurrentActiveArrayFormulaCellData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>> | undefined;
|
|
107
109
|
getCurrentRuntimeActiveArrayFormulaCellData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>> | undefined;
|
|
108
110
|
getCellData(row: number, column: number): ICellData;
|
|
109
111
|
getRuntimeFeatureCellValue(row: number, column: number): ICellData | undefined;
|
|
110
|
-
getCellByPosition(row?: number, column?: number): ErrorValueObject | NullValueObject | NumberValueObject |
|
|
112
|
+
getCellByPosition(row?: number, column?: number): ErrorValueObject | NullValueObject | NumberValueObject | import("../value-object/primitive-object").BooleanValueObject | import("../value-object/primitive-object").StringValueObject | ArrayValueObject;
|
|
111
113
|
toArrayValueObject(useCache?: boolean): ArrayValueObject;
|
|
112
114
|
toUnitRange(): {
|
|
113
115
|
range: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Nullable } from '@univerjs/core';
|
|
17
|
+
import type { BaseAstNode } from '../ast-node/base-ast-node';
|
|
18
|
+
export declare function getAstNodeTopParent(node: BaseAstNode): Nullable<BaseAstNode>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Korean in Excel does not count as two characters. Here we calculate all Chinese, Japanese and Korean characters as two characters.
|
|
18
|
+
*
|
|
19
|
+
* ā -> 1
|
|
20
|
+
* ー -> 2
|
|
21
|
+
*
|
|
22
|
+
* @param str
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare function charLenByte(str: string): number;
|
|
@@ -28,3 +28,4 @@ export declare function isWildcard(str: string): boolean;
|
|
|
28
28
|
export declare function isMatchWildcard(currentValue: string, value: string): boolean;
|
|
29
29
|
export declare function replaceWildcard(value: string): string;
|
|
30
30
|
export declare function compareWithWildcard(currentValue: string, value: string, operator: compareToken): boolean;
|
|
31
|
+
export declare function escapeRegExp(str: string): string;
|
|
@@ -27,6 +27,5 @@ export declare function valueObjectCompare(range: BaseValueObject, criteria: Bas
|
|
|
27
27
|
* Find the Boolean intersection of two ArrayValueObjects
|
|
28
28
|
* @param valueObject1
|
|
29
29
|
* @param valueObject2
|
|
30
|
-
* @returns
|
|
31
30
|
*/
|
|
32
31
|
export declare function booleanObjectIntersection(valueObject1: BaseValueObject, valueObject2: BaseValueObject): BaseValueObject;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Injector } from '@wendellhu/redi';
|
|
17
|
+
import type { Nullable } from '@univerjs/core';
|
|
18
|
+
import type { IFunctionService } from '../../services/function.service';
|
|
19
|
+
import { PrefixNode } from '../ast-node/prefix-node';
|
|
20
|
+
export declare function prefixHandler(tokenTrim: string, functionService: IFunctionService, injector: Injector): {
|
|
21
|
+
tokenTrim: string;
|
|
22
|
+
minusPrefixNode: Nullable<PrefixNode>;
|
|
23
|
+
atPrefixNode: Nullable<PrefixNode>;
|
|
24
|
+
};
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
export declare function deserializeRangeForR1C1(refString: string, currentRow?: number, currentColumn?: number): IGridRangeName;
|
|
16
|
+
import type { IRange, IUnitRangeName } from '@univerjs/core';
|
|
17
|
+
export declare function deserializeRangeForR1C1(refString: string, currentRow?: number, currentColumn?: number): IUnitRangeName;
|
|
19
18
|
export declare function serializeRangeToR1C1(range: IRange): string;
|
|
@@ -13,13 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IRange } from '@univerjs/core';
|
|
16
|
+
import type { IRange, IUnitRangeName } from '@univerjs/core';
|
|
17
17
|
import { AbsoluteRefType } from '@univerjs/core';
|
|
18
|
-
export interface IGridRangeName {
|
|
19
|
-
unitId: string;
|
|
20
|
-
sheetName: string;
|
|
21
|
-
range: IRange;
|
|
22
|
-
}
|
|
23
18
|
export interface IAbsoluteRefTypeForRange {
|
|
24
19
|
startAbsoluteRefType: AbsoluteRefType;
|
|
25
20
|
endAbsoluteRefType?: AbsoluteRefType;
|
|
@@ -52,18 +47,18 @@ export declare function serializeRangeWithSheet(sheetName: string, range: IRange
|
|
|
52
47
|
* @param range
|
|
53
48
|
*/
|
|
54
49
|
export declare function serializeRangeWithSpreadsheet(unit: string, sheetName: string, range: IRange): string;
|
|
55
|
-
export declare function serializeRangeToRefString(gridRangeName:
|
|
50
|
+
export declare function serializeRangeToRefString(gridRangeName: IUnitRangeName): string;
|
|
56
51
|
export declare function handleRefStringInfo(refString: string): {
|
|
57
52
|
refBody: string;
|
|
58
53
|
sheetName: string;
|
|
59
54
|
unitId: string;
|
|
60
55
|
};
|
|
61
|
-
export declare function deserializeRangeWithSheet(refString: string):
|
|
56
|
+
export declare function deserializeRangeWithSheet(refString: string): IUnitRangeName;
|
|
62
57
|
/**
|
|
63
58
|
* Determine whether the sheet name needs to be wrapped in quotes
|
|
64
59
|
* Excel will quote the worksheet name if any of the following is true:
|
|
65
60
|
* - It contains any space or punctuation characters, such as ()$,;-{}"'()【】“”‘’%… and many more
|
|
66
|
-
* - It is a valid cell reference in A1 notation, e.g. B1048576 is quoted
|
|
61
|
+
* - It is a valid cell reference in A1 notation, e.g. B1048576 is quoted
|
|
67
62
|
* - It is a valid cell reference in R1C1 notation, e.g. RC, RC2, R5C, R-4C, RC-8, R, C
|
|
68
63
|
* - It starts with a non-letter, e.g. 99, 1.5, 12a, 💩a
|
|
69
64
|
* - Excel will not quote worksheet names if they only contain non-punctuation, non-letter characters in non-initial positions. For example, a💩 remains unquoted.*
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
import type { Nullable } from '@univerjs/core';
|
|
17
17
|
import { compareToken } from '../../basics/token';
|
|
18
18
|
import { ArrayBinarySearchType, ArrayOrderSearchType } from '../utils/compare';
|
|
19
|
-
import type { callbackMapFnType,
|
|
19
|
+
import type { callbackMapFnType, IArrayValueObject } from './base-value-object';
|
|
20
20
|
import { BaseValueObject, ErrorValueObject } from './base-value-object';
|
|
21
21
|
import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from './primitive-object';
|
|
22
22
|
export declare function fromObjectToString(array: IArrayValueObject): string;
|
|
23
23
|
export declare function transformToValueObject(array?: Array<Array<number | string | boolean | null>>): BaseValueObject[][];
|
|
24
|
-
export declare function transformToValue(array?: BaseValueObject[][]): (string | number | boolean | null)[][];
|
|
24
|
+
export declare function transformToValue(array?: Nullable<BaseValueObject>[][]): (string | number | boolean | null)[][];
|
|
25
25
|
export declare class ArrayValueObject extends BaseValueObject {
|
|
26
|
+
static create(rawValue: string | IArrayValueObject): ArrayValueObject;
|
|
26
27
|
private _values;
|
|
27
28
|
private _rowCount;
|
|
28
29
|
private _columnCount;
|
|
@@ -47,12 +48,12 @@ export declare class ArrayValueObject extends BaseValueObject {
|
|
|
47
48
|
getSheetId(): string;
|
|
48
49
|
getCurrentRow(): number;
|
|
49
50
|
getCurrentColumn(): number;
|
|
50
|
-
getArrayValue(): BaseValueObject[][];
|
|
51
|
+
getArrayValue(): Nullable<BaseValueObject>[][];
|
|
51
52
|
setArrayValue(value: BaseValueObject[][]): void;
|
|
52
53
|
isArray(): boolean;
|
|
53
|
-
get(row: number, column: number): BaseValueObject;
|
|
54
|
+
get(row: number, column: number): BaseValueObject | null;
|
|
54
55
|
getRealValue(row: number, column: number): BaseValueObject | null;
|
|
55
|
-
set(row: number, column: number, value: BaseValueObject): void;
|
|
56
|
+
set(row: number, column: number, value: Nullable<BaseValueObject>): void;
|
|
56
57
|
getRangePosition(): {
|
|
57
58
|
startRow: number;
|
|
58
59
|
endRow: number;
|
|
@@ -133,7 +134,6 @@ export declare class ArrayValueObject extends BaseValueObject {
|
|
|
133
134
|
compare(valueObject: BaseValueObject, operator: compareToken): BaseValueObject;
|
|
134
135
|
concatenateFront(valueObject: BaseValueObject): BaseValueObject;
|
|
135
136
|
concatenateBack(valueObject: BaseValueObject): BaseValueObject;
|
|
136
|
-
product(valueObject: BaseValueObject, callbackFn: callbackProductFnType): BaseValueObject;
|
|
137
137
|
map(callbackFn: callbackMapFnType): BaseValueObject;
|
|
138
138
|
mapValue(callbackFn: callbackMapFnType): BaseValueObject;
|
|
139
139
|
pow(valueObject: BaseValueObject): BaseValueObject;
|
|
@@ -210,5 +210,5 @@ export declare class ArrayValueObject extends BaseValueObject {
|
|
|
210
210
|
private _createNewArray;
|
|
211
211
|
}
|
|
212
212
|
export declare class ValueObjectFactory {
|
|
213
|
-
static create(rawValue: string | number | boolean | null): ErrorValueObject | NullValueObject | NumberValueObject |
|
|
213
|
+
static create(rawValue: string | number | boolean | null): ErrorValueObject | NullValueObject | NumberValueObject | BooleanValueObject | StringValueObject | ArrayValueObject;
|
|
214
214
|
}
|