@univerjs/engine-formula 0.6.3 → 0.6.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.
@@ -1,23 +1,11 @@
1
- /**
2
- * Copyright 2023-present DreamNum Co., Ltd.
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
- */
1
+ import { LRUMap } from '@univerjs/core';
16
2
  export declare class FormulaAstLRU<T> {
17
3
  private _cache;
18
4
  constructor(cacheCount: number);
19
5
  set(formulaString: string, node: T): void;
20
6
  get(formulaString: string): T | undefined;
21
7
  clear(): void;
8
+ delete(formulaString: string): void;
9
+ forEach(callbackfn: (value: T, key: string, map: LRUMap<string, T>) => void, thisArg?: any): void;
22
10
  private _hash;
23
11
  }
@@ -154,6 +154,11 @@ export interface IUnitExcludedCell {
154
154
  [sheetId: string]: ObjectMatrix<boolean>;
155
155
  }>;
156
156
  }
157
+ export interface IUnitRowData {
158
+ [unitId: string]: Nullable<{
159
+ [sheetId: string]: IObjectArrayPrimitiveType<Partial<IRowData>>;
160
+ }>;
161
+ }
157
162
  export interface IFormulaDatasetConfig {
158
163
  formulaData: IFormulaData;
159
164
  arrayFormulaCellData: IArrayFormulaUnitCellType;
@@ -170,6 +175,7 @@ export interface IFormulaDatasetConfig {
170
175
  unitStylesData?: IUnitStylesData;
171
176
  unitSheetNameMap?: IUnitSheetNameMap;
172
177
  maxIteration?: number;
178
+ rowData?: IUnitRowData;
173
179
  }
174
180
  export declare enum ConcatenateType {
175
181
  FRONT = 0,
@@ -130,3 +130,4 @@ export { ENGINE_FORMULA_CYCLE_REFERENCE_COUNT, ENGINE_FORMULA_PLUGIN_CONFIG_KEY,
130
130
  export { generateRandomDependencyTreeId } from './engine/dependency/formula-dependency';
131
131
  export { DependencyManagerBaseService } from './services/dependency-manager.service';
132
132
  export { LambdaValueObjectObject } from './engine/value-object/lambda-value-object';
133
+ export { type IUnitRowData } from './basics/common';
@@ -1,5 +1,5 @@
1
1
  import { ICellData, IObjectMatrixPrimitiveType, IRange, IUnitRange, Nullable, Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
2
- import { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap } from '../basics/common';
2
+ import { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, IRuntimeUnitDataType, IUnitData, IUnitRowData, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
3
3
  import { LexerTreeBuilder } from '../engine/analysis/lexer-tree-builder';
4
4
  export interface IRangeChange {
5
5
  oldCell: IRange;
@@ -24,8 +24,15 @@ export declare class FormulaDataModel extends Disposable {
24
24
  deleteArrayFormulaRange(unitId: string, sheetId: string, row: number, column: number): void;
25
25
  getCalculateData(): {
26
26
  allUnitData: IUnitData;
27
+ unitStylesData: IUnitStylesData;
27
28
  unitSheetNameMap: IUnitSheetNameMap;
28
29
  };
30
+ /**
31
+ * Get the hidden rows that are filtered or manually hidden.
32
+ *
33
+ * For formulas that are sensitive to hidden rows.
34
+ */
35
+ getHiddenRowsFiltered(): IUnitRowData;
29
36
  updateFormulaData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): IObjectMatrixPrimitiveType<IFormulaDataItem | null>;
30
37
  updateArrayFormulaRange(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): void;
31
38
  updateArrayFormulaCellData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): void;
@@ -1,5 +1,6 @@
1
1
  import { IUnitRange, LocaleType, Nullable, Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
- import { IArrayFormulaRangeType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
2
+ import { IArrayFormulaRangeType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitRowData, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
3
+ import { FormulaDataModel } from '../models/formula-data.model';
3
4
  export interface IFormulaDirtyData {
4
5
  forceCalculation: boolean;
5
6
  dirtyRanges: IUnitRange[];
@@ -9,6 +10,7 @@ export interface IFormulaDirtyData {
9
10
  dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap;
10
11
  clearDependencyTreeCache: IDirtyUnitSheetNameMap;
11
12
  maxIteration?: number;
13
+ rowData?: IUnitRowData;
12
14
  }
13
15
  export interface IFormulaCurrentConfigService {
14
16
  load(config: IFormulaDatasetConfig): void;
@@ -54,6 +56,7 @@ export interface IFormulaCurrentConfigService {
54
56
  export declare class FormulaCurrentConfigService extends Disposable implements IFormulaCurrentConfigService {
55
57
  private readonly _univerInstanceService;
56
58
  private readonly _localeService;
59
+ private readonly _formulaDataModel;
57
60
  private _unitData;
58
61
  private _unitStylesData;
59
62
  private _arrayFormulaCellData;
@@ -71,7 +74,7 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
71
74
  private _sheetIdToNameMap;
72
75
  private _executeUnitId;
73
76
  private _executeSubUnitId;
74
- constructor(_univerInstanceService: IUniverInstanceService, _localeService: LocaleService);
77
+ constructor(_univerInstanceService: IUniverInstanceService, _localeService: LocaleService, _formulaDataModel: FormulaDataModel);
75
78
  dispose(): void;
76
79
  getExecuteUnitId(): Nullable<string>;
77
80
  getExecuteSubUnitId(): Nullable<string>;
@@ -111,5 +114,10 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
111
114
  registerSheetNameMap(sheetNameMap: IUnitSheetNameMap): void;
112
115
  private _mergeNameMap;
113
116
  private _loadSheetData;
117
+ /**
118
+ * There is no filter information in the worker, it must be passed in from the main thread after it is ready
119
+ * @param rowData
120
+ */
121
+ private _applyUnitRowData;
114
122
  }
115
123
  export declare const IFormulaCurrentConfigService: import('@wendellhu/redi').IdentifierDecorator<FormulaCurrentConfigService>;
@@ -25,6 +25,7 @@ export interface IFunctionService {
25
25
  getDescription(functionToken: IFunctionNames): Nullable<IFunctionInfo>;
26
26
  hasDescription(functionToken: IFunctionNames): boolean;
27
27
  unregisterDescriptions(...functionTokens: IFunctionNames[]): void;
28
+ deleteFormulaAstCacheKey(...functionToken: IFunctionNames[]): void;
28
29
  }
29
30
  export declare const IFunctionService: import('@wendellhu/redi').IdentifierDecorator<FunctionService>;
30
31
  export declare class FunctionService extends Disposable implements IFunctionService {
@@ -41,4 +42,5 @@ export declare class FunctionService extends Disposable implements IFunctionServ
41
42
  getDescription(functionToken: IFunctionNames): IFunctionInfo | undefined;
42
43
  hasDescription(functionToken: IFunctionNames): boolean;
43
44
  unregisterDescriptions(...functionTokens: IFunctionNames[]): void;
45
+ deleteFormulaAstCacheKey(...functionToken: IFunctionNames[]): void;
44
46
  }