@univerjs/engine-formula 1.0.0-alpha.8 → 1.0.0-beta.1
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 +1175 -982
- package/lib/es/index.js +1177 -984
- package/lib/index.js +1177 -984
- package/lib/types/basics/common.d.ts +2 -0
- package/lib/types/basics/regex.d.ts +4 -4
- package/lib/types/controllers/formula-calculation-trigger.controller.d.ts +1 -2
- package/lib/types/controllers/formula.controller.d.ts +1 -1
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +4 -0
- package/lib/types/engine/analysis/lexer.d.ts +4 -2
- package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -0
- package/lib/types/engine/ast-node/function-node.d.ts +1 -0
- package/lib/types/engine/ast-node/union-node.d.ts +8 -2
- package/lib/types/engine/reference-object/base-reference-object.d.ts +2 -1
- package/lib/types/engine/reference-object/multi-area-reference-object.d.ts +11 -3
- package/lib/types/engine/reference-object/table-reference-object.d.ts +1 -1
- package/lib/types/engine/utils/generate-ast-node.d.ts +1 -1
- package/lib/types/engine/value-object/array-value-object.d.ts +1 -1
- package/lib/types/functions/base-function.d.ts +6 -2
- package/lib/types/functions/compatibility/rank/index.d.ts +1 -0
- package/lib/types/functions/information/isblank/index.d.ts +3 -3
- package/lib/types/functions/logical/percentof/index.d.ts +5 -6
- package/lib/types/functions/lookup/choose/index.d.ts +1 -0
- package/lib/types/functions/lookup/function-map.d.ts +4 -1
- package/lib/types/functions/lookup/match/index.d.ts +1 -0
- package/lib/types/functions/lookup/xlookup/index.d.ts +4 -0
- package/lib/types/functions/math/sumproduct/index.d.ts +1 -0
- package/lib/types/functions/statistical/median/index.d.ts +1 -0
- package/lib/types/functions/statistical/percentile-exc/index.d.ts +1 -0
- package/lib/types/functions/statistical/percentile-inc/index.d.ts +1 -0
- package/lib/types/functions/statistical/rank-avg/index.d.ts +1 -0
- package/lib/types/functions/statistical/rank-eq/index.d.ts +1 -0
- package/lib/types/functions/text/textjoin/index.d.ts +1 -0
- package/lib/types/services/register-other-formula.service.d.ts +3 -3
- package/lib/types/services/runtime.service.d.ts +2 -0
- package/lib/umd/index.js +4 -4
- package/package.json +4 -4
|
@@ -220,6 +220,8 @@ export interface ISuperTable {
|
|
|
220
220
|
* Sheet tables default to true; Base virtual tables store records from row 0.
|
|
221
221
|
*/
|
|
222
222
|
showHeader?: boolean;
|
|
223
|
+
/** Whether the projected range contains a physical totals row. */
|
|
224
|
+
showFooter?: boolean;
|
|
223
225
|
}
|
|
224
226
|
export declare enum TableOptionType {
|
|
225
227
|
ALL = "#All",
|
|
@@ -32,10 +32,10 @@ export declare const REFERENCE_REGEX_SINGLE_ROW = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\
|
|
|
32
32
|
export declare const REFERENCE_REGEX_SINGLE_ROW_PRECOMPILING: RegExp;
|
|
33
33
|
export declare const REFERENCE_REGEX_SINGLE_COLUMN = "^'?(\\[([^\\[\\]\\/?:\"<>|*\\\\]+)\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?'?\\s*?\\$?[A-Za-z]+$";
|
|
34
34
|
export declare const REFERENCE_REGEX_SINGLE_COLUMN_PRECOMPILING: RegExp;
|
|
35
|
-
export declare const REFERENCE_TABLE_ALL_COLUMN_REGEX = "^(?:(?:\\[([^\\
|
|
36
|
-
export declare const REFERENCE_TABLE_SINGLE_COLUMN_REGEX = "^(?:(?:\\[([^\\
|
|
37
|
-
export declare const REFERENCE_TABLE_MULTIPLE_COLUMN_REGEX = "^(?:(?:\\[([^\\
|
|
38
|
-
export declare const REFERENCE_TABLE_TITLE_ONLY_ANY_HASH_REGEX = "^(?:(?:\\[([^\\
|
|
35
|
+
export declare const REFERENCE_TABLE_ALL_COLUMN_REGEX = "^(?:(?:\\[(?:[^\\]]|\\]\\])+\\]|'(?:[^']|'')+'|[^\\s!\\[\\]]+)!)?(?:\\[(?:[^\\]]|\\]\\])+\\])?((?![~!@#$%^&*()+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+$";
|
|
36
|
+
export declare const REFERENCE_TABLE_SINGLE_COLUMN_REGEX = "^(?:(?:\\[(?:[^\\]]|\\]\\])+\\]|'(?:[^']|'')+'|[^\\s!\\[\\]]+)!)?(?:\\[(?:[^\\]]|\\]\\])+\\])?((?![~!@#$%^&*()+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[[^#]*#?\\]|\\[\\[#.+\\]\\s*?,\\s*?\\[[^#]*#?\\]\\])+$";
|
|
37
|
+
export declare const REFERENCE_TABLE_MULTIPLE_COLUMN_REGEX = "^(?:(?:\\[(?:[^\\]]|\\]\\])+\\]|'(?:[^']|'')+'|[^\\s!\\[\\]]+)!)?(?:\\[(?:[^\\]]|\\]\\])+\\])?((?![~!@#$%^&*()+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[\\[[^#]*#?\\]\\s*?:\\s*?\\[[^#]*#?\\]\\])?$|^(?:(?:\\[(?:[^\\]]|\\]\\])+\\]|'(?:[^']|'')+'|[^\\s!\\[\\]]+)!)?(?:\\[(?:[^\\]]|\\]\\])+\\])?((?![~!@#$%^&*()+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[\\[#.+\\]\\s*?,\\s*?\\[[^#]*#?\\]\\s*?:\\s*?\\[[^#]*#?\\]\\])?$";
|
|
38
|
+
export declare const REFERENCE_TABLE_TITLE_ONLY_ANY_HASH_REGEX = "^(?:(?:\\[(?:[^\\]]|\\]\\])+\\]|'(?:[^']|'')+'|[^\\s!\\[\\]]+)!)?(?:\\[(?:[^\\]]|\\]\\])+\\])?((?![~!@#$%^&*()+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+\\[\\s*#([^\\]]+)\\s*\\]$";
|
|
39
39
|
export declare const REFERENCE_TABLE_ALL_COLUMN_REGEX_PRECOMPILING: RegExp;
|
|
40
40
|
export declare const REFERENCE_TABLE_SINGLE_COLUMN_REGEX_PRECOMPILING: RegExp;
|
|
41
41
|
export declare const REFERENCE_TABLE_MULTIPLE_COLUMN_REGEX_PRECOMPILING: RegExp;
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Disposable, LifecycleService } from '@univerjs/core';
|
|
17
17
|
import { FormulaCalculationTriggerService } from '../services/formula-calculation-trigger.service';
|
|
18
|
-
import { RegisterOtherFormulaService } from '../services/register-other-formula.service';
|
|
19
18
|
export declare class FormulaCalculationTriggerController extends Disposable {
|
|
20
|
-
constructor(formulaCalculationTriggerService: FormulaCalculationTriggerService,
|
|
19
|
+
constructor(formulaCalculationTriggerService: FormulaCalculationTriggerService, lifecycleService: LifecycleService);
|
|
21
20
|
}
|
|
@@ -17,7 +17,7 @@ import { Disposable, ICommandService, IConfigService } from '@univerjs/core';
|
|
|
17
17
|
import { DataSyncPrimaryController } from '@univerjs/rpc';
|
|
18
18
|
import { IFunctionService } from '../services/function.service';
|
|
19
19
|
import { RegisterOtherFormulaService } from '../services/register-other-formula.service';
|
|
20
|
-
type FormulaDataSyncController = Pick<DataSyncPrimaryController, 'registerSyncingMutations' | 'syncUnitMutations'>;
|
|
20
|
+
type FormulaDataSyncController = Pick<DataSyncPrimaryController, 'registerSyncingMutations' | 'syncUnitMutations' | 'waitForPendingMutations'>;
|
|
21
21
|
export declare class FormulaController extends Disposable {
|
|
22
22
|
private readonly _commandService;
|
|
23
23
|
private readonly _functionService;
|
|
@@ -27,6 +27,9 @@ export declare const FormulaSequenceNodeCache: FormulaAstLRU<(string | ISequence
|
|
|
27
27
|
interface IInjectDefinedNameParam {
|
|
28
28
|
unitId: Nullable<string>;
|
|
29
29
|
sheetId?: Nullable<string>;
|
|
30
|
+
refOffsetX: number;
|
|
31
|
+
refOffsetY: number;
|
|
32
|
+
hasFunction(functionToken: IFunctionNames): boolean;
|
|
30
33
|
getValueByName(unitId: string, name: string, sheetId?: Nullable<string>): Nullable<IDefinedNamesServiceParam>;
|
|
31
34
|
getDirtyDefinedNameMap(): IDirtyUnitDefinedNameMap;
|
|
32
35
|
getSheetName: (unitId: string, sheetId: string) => string;
|
|
@@ -101,6 +104,7 @@ export declare class LexerTreeBuilder extends Disposable {
|
|
|
101
104
|
nodeMakerTest(formulaString: string): ErrorType.VALUE | (string | LexerNode)[] | undefined;
|
|
102
105
|
treeBuilder(formulaString: string, transformSuffix?: boolean, injectDefinedNameParam?: IInjectDefinedNameParam): ErrorType.VALUE | LexerNode | (string | LexerNode)[] | undefined;
|
|
103
106
|
private _handleDefinedName;
|
|
107
|
+
private _moveDefinedNameRefOffset;
|
|
104
108
|
private _getHasSheetNameDefinedName;
|
|
105
109
|
private _handleNestedDefinedName;
|
|
106
110
|
private _simpleCheckDefinedName;
|
|
@@ -17,11 +17,13 @@ import type { Nullable } from '@univerjs/core';
|
|
|
17
17
|
import { Disposable } from '@univerjs/core';
|
|
18
18
|
import { IFormulaCurrentConfigService } from '../../services/current-data.service';
|
|
19
19
|
import { IDefinedNamesService } from '../../services/defined-names.service';
|
|
20
|
+
import { IFunctionService } from '../../services/function.service';
|
|
20
21
|
import { LexerTreeBuilder } from './lexer-tree-builder';
|
|
21
22
|
export declare class Lexer extends Disposable {
|
|
22
23
|
private readonly _definedNamesService;
|
|
23
24
|
private readonly _lexerTreeBuilder;
|
|
24
25
|
private readonly _formulaCurrentConfigService;
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
private readonly _functionService;
|
|
27
|
+
constructor(_definedNamesService: IDefinedNamesService, _lexerTreeBuilder: LexerTreeBuilder, _formulaCurrentConfigService: IFormulaCurrentConfigService, _functionService: IFunctionService);
|
|
28
|
+
treeBuilder(formulaString: string, transformSuffix?: boolean, unitId?: Nullable<string>, refOffsetX?: number, refOffsetY?: number): import("../..").ErrorType.VALUE | import("./lexer-node").LexerNode | (string | import("./lexer-node").LexerNode)[] | undefined;
|
|
27
29
|
}
|
|
@@ -52,6 +52,7 @@ export declare class BaseAstNode {
|
|
|
52
52
|
getToken(): string;
|
|
53
53
|
setValue(value: Nullable<FunctionVariantType>): void;
|
|
54
54
|
getValue(): Nullable<FunctionVariantType>;
|
|
55
|
+
preservesLazyIfReferenceArray(_child: BaseAstNode): boolean;
|
|
55
56
|
isCalculated(): boolean;
|
|
56
57
|
setCalculated(): void;
|
|
57
58
|
execute(): void;
|
|
@@ -35,6 +35,7 @@ export declare class FunctionNode extends BaseAstNode {
|
|
|
35
35
|
private _unitReferenceResolver;
|
|
36
36
|
constructor(token: string, _functionExecutor: BaseFunction, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _definedNamesService: IDefinedNamesService, _formulaDataModel: FormulaDataModel, _unitReferenceResolver: IFormulaUnitReferenceResolver);
|
|
37
37
|
get nodeType(): NodeType;
|
|
38
|
+
preservesLazyIfReferenceArray(child: BaseAstNode): boolean;
|
|
38
39
|
executeAsync(): Promise<AstNodePromiseType>;
|
|
39
40
|
execute(): void;
|
|
40
41
|
private _collectVariants;
|
|
@@ -13,20 +13,26 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { IFormulaCurrentConfigService } from '../../services/current-data.service';
|
|
16
17
|
import { IFunctionService } from '../../services/function.service';
|
|
17
18
|
import { LexerNode } from '../analysis/lexer-node';
|
|
18
19
|
import { BaseAstNode } from './base-ast-node';
|
|
19
20
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
20
21
|
import { NodeType } from './node-type';
|
|
21
22
|
export declare class UnionNode extends BaseAstNode {
|
|
22
|
-
|
|
23
|
+
private readonly _currentConfigService;
|
|
24
|
+
constructor(operatorString: string, _currentConfigService: Pick<IFormulaCurrentConfigService, 'getSheetsInfo'>);
|
|
23
25
|
get nodeType(): NodeType;
|
|
24
26
|
execute(): void;
|
|
27
|
+
private _createThreeDimensionalReference;
|
|
28
|
+
private _normalizeSheetName;
|
|
29
|
+
private _copyReferenceContext;
|
|
25
30
|
private _unionFunction;
|
|
26
31
|
}
|
|
27
32
|
export declare class UnionNodeFactory extends BaseAstNodeFactory {
|
|
28
33
|
private readonly _functionService;
|
|
29
|
-
|
|
34
|
+
private readonly _currentConfigService;
|
|
35
|
+
constructor(_functionService: IFunctionService, _currentConfigService: IFormulaCurrentConfigService);
|
|
30
36
|
get zIndex(): number;
|
|
31
37
|
create(param: string): BaseAstNode;
|
|
32
38
|
checkAndCreateNodeType(param: LexerNode | string): BaseAstNode | undefined;
|
|
@@ -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
|
-
import type { ICellData, IRange, Nullable } from '@univerjs/core';
|
|
16
|
+
import type { ICellData, IRange, IUnitRange, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { IArrayFormulaRangeType, IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap, IUnitStylesData } from '../../basics/common';
|
|
18
18
|
import type { BaseValueObject } from '../value-object/base-value-object';
|
|
19
19
|
import { ObjectMatrix } from '@univerjs/core';
|
|
@@ -146,6 +146,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
|
|
|
146
146
|
sheetId: string;
|
|
147
147
|
unitId: string;
|
|
148
148
|
};
|
|
149
|
+
toUnitRanges(): IUnitRange[];
|
|
149
150
|
private _checkIfWorksheetMiss;
|
|
150
151
|
private _getBlankArrayValueObject;
|
|
151
152
|
}
|
|
@@ -13,19 +13,25 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { Nullable } from '@univerjs/core';
|
|
16
|
+
import type { IUnitRange, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { ArrayValueObject } from '../value-object/array-value-object';
|
|
18
|
-
import type { BaseValueObject
|
|
18
|
+
import type { BaseValueObject } from '../value-object/base-value-object';
|
|
19
|
+
import { ErrorValueObject } from '../value-object/base-value-object';
|
|
19
20
|
import { BaseReferenceObject } from './base-reference-object';
|
|
20
21
|
export type MultiAreaValue = BaseReferenceObject | ErrorValueObject;
|
|
22
|
+
export declare enum MultiAreaArrayMode {
|
|
23
|
+
FIRST_CELL_GRID = "first-cell-grid",
|
|
24
|
+
STACK_AREAS = "stack-areas"
|
|
25
|
+
}
|
|
21
26
|
export declare class MultiAreaReferenceObject extends BaseReferenceObject {
|
|
27
|
+
private readonly _arrayMode;
|
|
22
28
|
/**
|
|
23
29
|
* 2D structure:
|
|
24
30
|
* - First dimension: stored by rows
|
|
25
31
|
* - Second dimension: each AreaValue within that row
|
|
26
32
|
*/
|
|
27
33
|
private _areas;
|
|
28
|
-
constructor(token: string, areas?: MultiAreaValue[][]);
|
|
34
|
+
constructor(token: string, areas?: MultiAreaValue[][], _arrayMode?: MultiAreaArrayMode);
|
|
29
35
|
dispose(): void;
|
|
30
36
|
getAreas(): MultiAreaValue[][];
|
|
31
37
|
setAreas(areas: MultiAreaValue[][]): void;
|
|
@@ -77,11 +83,13 @@ export declare class MultiAreaReferenceObject extends BaseReferenceObject {
|
|
|
77
83
|
* - inner `_areas[row]` dimension => columns
|
|
78
84
|
*/
|
|
79
85
|
toArrayValueObject(): ArrayValueObject;
|
|
86
|
+
private _stackAreas;
|
|
80
87
|
getRangePosition(): import("@univerjs/core").IRange;
|
|
81
88
|
toUnitRange(): {
|
|
82
89
|
range: import("@univerjs/core").IRange;
|
|
83
90
|
sheetId: string;
|
|
84
91
|
unitId: string;
|
|
85
92
|
};
|
|
93
|
+
toUnitRanges(): IUnitRange[];
|
|
86
94
|
getRangeData(): import("@univerjs/core").IRange;
|
|
87
95
|
}
|
|
@@ -81,7 +81,7 @@ export declare class TableReferenceObject extends BaseReferenceObject {
|
|
|
81
81
|
private _findCommaAtTopLevel;
|
|
82
82
|
/**
|
|
83
83
|
* Parse Section, compatible with both "[#Data]" and "#Data" inputs
|
|
84
|
-
* Returns TableOptionType if matched; returns
|
|
84
|
+
* Returns TableOptionType if matched; returns undefined when the comma belongs to a column title.
|
|
85
85
|
*/
|
|
86
86
|
private _parseSectionMaybeBracketed;
|
|
87
87
|
/**
|
|
@@ -21,5 +21,5 @@ import type { AstRootNode } from '../ast-node/ast-root-node';
|
|
|
21
21
|
import type { IFormulaDependencyTree } from '../dependency/dependency-tree';
|
|
22
22
|
import { FormulaAstLRU } from '../../basics/cache-lru';
|
|
23
23
|
export declare const FORMULA_AST_CACHE: FormulaAstLRU<AstRootNode>;
|
|
24
|
-
export declare function generateAstNode(unitId: string, formulaString: string, lexer: Lexer, astTreeBuilder: AstTreeBuilder, currentConfigService: IFormulaCurrentConfigService, subUnitId?: string): AstRootNode;
|
|
24
|
+
export declare function generateAstNode(unitId: string, formulaString: string, lexer: Lexer, astTreeBuilder: AstTreeBuilder, currentConfigService: IFormulaCurrentConfigService, subUnitId?: string, definedNameRefOffsetX?: number, definedNameRefOffsetY?: number): AstRootNode;
|
|
25
25
|
export declare function includeDefinedName(tree: IFormulaDependencyTree, node: Nullable<AstRootNode>, currentConfigService: IFormulaCurrentConfigService): boolean;
|
|
@@ -132,7 +132,7 @@ export declare class ArrayValueObject extends BaseValueObject {
|
|
|
132
132
|
* the sequential matching approach is only used for special matches in XLOOKUP and XMATCH.
|
|
133
133
|
* For example, when match_mode is set to 1 and -1 for an exact match. If not found, it returns the next smaller item.
|
|
134
134
|
*/
|
|
135
|
-
orderSearch(valueObject: BaseValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, isFuzzyMatching?: boolean): void | {
|
|
135
|
+
orderSearch(valueObject: BaseValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, isFuzzyMatching?: boolean, keepFirstNearest?: boolean): void | {
|
|
136
136
|
row: number;
|
|
137
137
|
column: number;
|
|
138
138
|
} | null;
|
|
@@ -76,6 +76,10 @@ export declare class BaseFunction {
|
|
|
76
76
|
* Whether the function needs unevaluated AST children.
|
|
77
77
|
*/
|
|
78
78
|
needsAstChildren: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Arguments that preserve a selected lazy IF branch as a reference array.
|
|
81
|
+
*/
|
|
82
|
+
lazyIfReferenceArrayArgumentIndexes: readonly number[];
|
|
79
83
|
/**
|
|
80
84
|
* Legacy CSE-style array functions should write only the first result cell
|
|
81
85
|
* when they are used as a top-level normal formula.
|
|
@@ -163,11 +167,11 @@ export declare class BaseFunction {
|
|
|
163
167
|
private _getOneLastByRaw;
|
|
164
168
|
equalSearch(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean): BaseValueObject;
|
|
165
169
|
fuzzySearch(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean): BaseValueObject;
|
|
166
|
-
orderSearch(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean): BaseValueObject;
|
|
170
|
+
orderSearch(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, keepFirstNearest?: boolean): BaseValueObject;
|
|
167
171
|
binarySearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, axis?: number, searchType?: ArrayBinarySearchType, matchType?: ArrayOrderSearchType): ErrorValueObject | ArrayValueObject | undefined;
|
|
168
172
|
equalSearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean, axis?: number): ErrorValueObject | ArrayValueObject | undefined;
|
|
169
173
|
fuzzySearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, isFirst?: boolean, axis?: number): ErrorValueObject | ArrayValueObject | undefined;
|
|
170
|
-
orderSearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, axis?: number): ErrorValueObject | ArrayValueObject | undefined;
|
|
174
|
+
orderSearchExpand(value: BaseValueObject, searchArray: ArrayValueObject, resultArray: ArrayValueObject, searchType?: ArrayOrderSearchType, isDesc?: boolean, axis?: number, keepFirstNearest?: boolean): ErrorValueObject | ArrayValueObject | undefined;
|
|
171
175
|
flattenArray(variants: BaseValueObject[], ignoreLogicalValuesAndText?: boolean): ArrayValueObject | BaseValueObject;
|
|
172
176
|
private _includingLogicalValuesAndText;
|
|
173
177
|
createReferenceObject(reference: BaseReferenceObject, range: IRange): ErrorValueObject | BaseReferenceObject;
|
|
@@ -20,6 +20,7 @@ export declare class Rank extends BaseFunction {
|
|
|
20
20
|
minParams: number;
|
|
21
21
|
maxParams: number;
|
|
22
22
|
needsReferenceObject: boolean;
|
|
23
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
23
24
|
calculate(number: FunctionVariantType, ref: FunctionVariantType, order?: FunctionVariantType): BaseValueObject;
|
|
24
25
|
private _checkRefReferenceObject;
|
|
25
26
|
}
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import type { FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
|
|
16
17
|
import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
|
|
17
|
-
import type { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
18
|
-
import { BooleanValueObject } from '../../../engine/value-object/primitive-object';
|
|
19
18
|
import { BaseFunction } from '../../base-function';
|
|
20
19
|
export declare class Isblank extends BaseFunction {
|
|
21
20
|
minParams: number;
|
|
22
21
|
maxParams: number;
|
|
23
|
-
|
|
22
|
+
needsReferenceObject: boolean;
|
|
23
|
+
calculate(value: FunctionVariantType): import("../../..").BaseValueObject | ArrayValueObject;
|
|
24
24
|
}
|
|
@@ -14,14 +14,13 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
17
|
-
import {
|
|
18
|
-
import { BaseFunction } from '../../base-function';
|
|
17
|
+
import { Sum } from '../../math/sum';
|
|
19
18
|
/**
|
|
20
|
-
* PERCENTOF is
|
|
21
|
-
*
|
|
19
|
+
* PERCENTOF is logically equivalent to SUM(dataSubset) / SUM(dataAll).
|
|
20
|
+
* GROUPBY also consumes the function name as an aggregator token through its AST path.
|
|
22
21
|
*/
|
|
23
|
-
export declare class Percentof extends
|
|
22
|
+
export declare class Percentof extends Sum {
|
|
24
23
|
minParams: number;
|
|
25
24
|
maxParams: number;
|
|
26
|
-
calculate(
|
|
25
|
+
calculate(dataSubset: BaseValueObject, dataAll: BaseValueObject): BaseValueObject;
|
|
27
26
|
}
|
|
@@ -18,6 +18,7 @@ import { BaseFunction } from '../../base-function';
|
|
|
18
18
|
export declare class Choose extends BaseFunction {
|
|
19
19
|
minParams: number;
|
|
20
20
|
maxParams: number;
|
|
21
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
21
22
|
needsReferenceObject: boolean;
|
|
22
23
|
calculate(indexNum: FunctionVariantType, ...variants: FunctionVariantType[]): FunctionVariantType;
|
|
23
24
|
}
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Anchorarray } from './anchorarray';
|
|
16
17
|
import { Choose } from './choose';
|
|
17
18
|
import { FUNCTION_NAMES_LOOKUP } from './function-names';
|
|
18
19
|
import { Hstack } from './hstack';
|
|
20
|
+
import { Index } from './index/index';
|
|
19
21
|
import { Indirect } from './indirect';
|
|
20
22
|
import { Lookup } from './lookup';
|
|
21
23
|
import { Match } from './match';
|
|
22
|
-
|
|
24
|
+
import { Offset } from './offset';
|
|
25
|
+
export declare const functionLookup: ((FUNCTION_NAMES_LOOKUP | typeof Anchorarray)[] | (FUNCTION_NAMES_LOOKUP | typeof Choose)[] | (FUNCTION_NAMES_LOOKUP | typeof Hstack)[] | (FUNCTION_NAMES_LOOKUP | typeof Index)[] | (FUNCTION_NAMES_LOOKUP | typeof Indirect)[] | (FUNCTION_NAMES_LOOKUP | typeof Lookup)[] | (FUNCTION_NAMES_LOOKUP | typeof Match)[] | (FUNCTION_NAMES_LOOKUP | typeof Offset)[])[];
|
|
@@ -19,6 +19,7 @@ import { BaseFunction } from '../../base-function';
|
|
|
19
19
|
export declare class Match extends BaseFunction {
|
|
20
20
|
minParams: number;
|
|
21
21
|
maxParams: number;
|
|
22
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
22
23
|
calculate(lookupValue: BaseValueObject, lookupArray: ArrayValueObject, matchType?: BaseValueObject): BaseValueObject;
|
|
23
24
|
private _handleSingleObject;
|
|
24
25
|
private _getSearchModeValue;
|
|
@@ -23,6 +23,10 @@ export declare class Xlookup extends BaseFunction {
|
|
|
23
23
|
private _legacyImplicitLookupValue;
|
|
24
24
|
private _handleExpandObject;
|
|
25
25
|
private _handleSingleObject;
|
|
26
|
+
private _exactSearch;
|
|
27
|
+
private _exactSearchExpand;
|
|
28
|
+
private _findExactPosition;
|
|
29
|
+
private _isExactMatch;
|
|
26
30
|
private _blankResultAsZero;
|
|
27
31
|
/**
|
|
28
32
|
* Wildcard matching and binary search cannot appear at the same time
|
|
@@ -18,6 +18,7 @@ import { BaseFunction } from '../../base-function';
|
|
|
18
18
|
export declare class Sumproduct extends BaseFunction {
|
|
19
19
|
minParams: number;
|
|
20
20
|
maxParams: number;
|
|
21
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
21
22
|
calculate(array1: BaseValueObject, ...variants: BaseValueObject[]): BaseValueObject;
|
|
22
23
|
/**
|
|
23
24
|
* Validate all variants:
|
|
@@ -18,5 +18,6 @@ import { BaseFunction } from '../../base-function';
|
|
|
18
18
|
export declare class Median extends BaseFunction {
|
|
19
19
|
minParams: number;
|
|
20
20
|
maxParams: number;
|
|
21
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
21
22
|
calculate(...variants: BaseValueObject[]): BaseValueObject;
|
|
22
23
|
}
|
|
@@ -18,6 +18,7 @@ import { BaseFunction } from '../../base-function';
|
|
|
18
18
|
export declare class PercentileExc extends BaseFunction {
|
|
19
19
|
minParams: number;
|
|
20
20
|
maxParams: number;
|
|
21
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
21
22
|
calculate(array: BaseValueObject, k: BaseValueObject): BaseValueObject;
|
|
22
23
|
private _handleSingleObject;
|
|
23
24
|
}
|
|
@@ -18,6 +18,7 @@ import { BaseFunction } from '../../base-function';
|
|
|
18
18
|
export declare class PercentileInc extends BaseFunction {
|
|
19
19
|
minParams: number;
|
|
20
20
|
maxParams: number;
|
|
21
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
21
22
|
calculate(array: BaseValueObject, k: BaseValueObject): BaseValueObject;
|
|
22
23
|
private _handleSingleObject;
|
|
23
24
|
}
|
|
@@ -20,6 +20,7 @@ export declare class RankAvg extends BaseFunction {
|
|
|
20
20
|
minParams: number;
|
|
21
21
|
maxParams: number;
|
|
22
22
|
needsReferenceObject: boolean;
|
|
23
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
23
24
|
calculate(number: FunctionVariantType, ref: FunctionVariantType, order?: FunctionVariantType): BaseValueObject;
|
|
24
25
|
private _getResult;
|
|
25
26
|
private _checkRefReferenceObject;
|
|
@@ -20,6 +20,7 @@ export declare class RankEq extends BaseFunction {
|
|
|
20
20
|
minParams: number;
|
|
21
21
|
maxParams: number;
|
|
22
22
|
needsReferenceObject: boolean;
|
|
23
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
23
24
|
calculate(number: FunctionVariantType, ref: FunctionVariantType, order?: FunctionVariantType): BaseValueObject;
|
|
24
25
|
private _checkRefReferenceObject;
|
|
25
26
|
}
|
|
@@ -18,6 +18,7 @@ import { BaseFunction } from '../../base-function';
|
|
|
18
18
|
export declare class Textjoin extends BaseFunction {
|
|
19
19
|
minParams: number;
|
|
20
20
|
maxParams: number;
|
|
21
|
+
lazyIfReferenceArrayArgumentIndexes: number[];
|
|
21
22
|
calculate(delimiter: BaseValueObject, ignoreEmpty: BaseValueObject, ...variants: BaseValueObject[]): BaseValueObject;
|
|
22
23
|
private _handleSingleObject;
|
|
23
24
|
private _getDelimiterValues;
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IRange, Nullable } from '@univerjs/core';
|
|
16
|
+
import type { IDisposable, IRange, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { ISetFormulaCalculationResultMutation } from '../commands/mutations/set-formula-calculation.mutation';
|
|
18
18
|
import type { IOtherFormulaResult } from './formula-common';
|
|
19
19
|
import { Disposable, ICommandService, LifecycleService } from '@univerjs/core';
|
|
20
|
-
import { BehaviorSubject } from 'rxjs';
|
|
21
20
|
import { IActiveDirtyManagerService } from './active-dirty-manager.service';
|
|
22
21
|
export declare enum OtherFormulaBizType {
|
|
23
22
|
DEFAULT = "default",
|
|
@@ -33,6 +32,7 @@ export declare class RegisterOtherFormulaService extends Disposable {
|
|
|
33
32
|
private _activeDirtyManagerService;
|
|
34
33
|
private readonly _lifecycleService;
|
|
35
34
|
private _formulaCacheMap;
|
|
35
|
+
private _mutationSyncHandler?;
|
|
36
36
|
private _formulaChangeWithRange$;
|
|
37
37
|
formulaChangeWithRange$: import("rxjs").Observable<{
|
|
38
38
|
unitId: string;
|
|
@@ -45,12 +45,12 @@ export declare class RegisterOtherFormulaService extends Disposable {
|
|
|
45
45
|
formulaResult$: import("rxjs").Observable<Record<string, Record<string, IOtherFormulaResult[]>>>;
|
|
46
46
|
private _otherFormulaResultApplied$;
|
|
47
47
|
otherFormulaResultApplied$: import("rxjs").Observable<ISetFormulaCalculationResultMutation>;
|
|
48
|
-
calculateStarted$: BehaviorSubject<boolean>;
|
|
49
48
|
constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService, _lifecycleService: LifecycleService);
|
|
50
49
|
dispose(): void;
|
|
51
50
|
private _ensureCacheMap;
|
|
52
51
|
private _createFormulaId;
|
|
53
52
|
private _initFormulaRegister;
|
|
53
|
+
setMutationSyncHandler(handler: (unitId: string) => () => Promise<void>): IDisposable;
|
|
54
54
|
private _initFormulaCalculationResultChange;
|
|
55
55
|
registerFormulaWithRange(unitId: string, subUnitId: string, formulaText: string, ranges?: IRange[], extra?: Record<string, any>, bizType?: OtherFormulaBizType, bizId?: string): string;
|
|
56
56
|
getFormulaDirtyMap(unitId: string): Record<string, Record<string, boolean>>;
|
|
@@ -78,6 +78,7 @@ export interface IFormulaRuntimeService {
|
|
|
78
78
|
reset(): void;
|
|
79
79
|
setCurrent(row: number, column: number, rowCount: number, columnCount: number, sheetId: string, unitId: string): void;
|
|
80
80
|
setFunctionRefInfoOverride(rowCount: number, columnCount: number): () => void;
|
|
81
|
+
hasFunctionRefInfoOverride(): boolean;
|
|
81
82
|
registerFunctionDefinitionPrivacyVar(lambdaId: string, lambdaVar: Map<string, Nullable<BaseAstNode>>): void;
|
|
82
83
|
getFunctionDefinitionPrivacyVar(lambdaId: string): Nullable<Map<string, Nullable<BaseAstNode>>>;
|
|
83
84
|
setRuntimeData(functionVariant: FunctionVariantType): void;
|
|
@@ -187,6 +188,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
187
188
|
clearReferenceAndNumberformatCache(): void;
|
|
188
189
|
setCurrent(row: number, column: number, rowCount: number, columnCount: number, sheetId: string, unitId: string): void;
|
|
189
190
|
setFunctionRefInfoOverride(rowCount: number, columnCount: number): () => void;
|
|
191
|
+
hasFunctionRefInfoOverride(): boolean;
|
|
190
192
|
clearFunctionDefinitionPrivacyVar(): void;
|
|
191
193
|
registerFunctionDefinitionPrivacyVar(lambdaId: string, lambdaVar: Map<string, Nullable<BaseAstNode>>): void;
|
|
192
194
|
getFunctionDefinitionPrivacyVar(lambdaId: string): Nullable<Map<string, Nullable<BaseAstNode>>>;
|