@univerjs/engine-formula 1.0.4 → 1.2.0
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/{en-US-DrAfIiBE.js → en-US-BYMYuEpp.js} +15 -15
- package/lib/cjs/facade.js +3 -18
- package/lib/cjs/index.js +500 -166
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/cjs/{zh-TW-CvMudVQy.js → zh-TW-B5pYt-NJ.js} +15 -15
- package/lib/es/facade.js +3 -18
- package/lib/es/index.js +474 -140
- package/lib/facade.js +3 -18
- package/lib/index.js +474 -140
- package/lib/types/basics/common.d.ts +8 -2
- package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +2 -1
- package/lib/types/config/config.d.ts +0 -2
- package/lib/types/engine/dependency/dependency-groups.d.ts +21 -0
- package/lib/types/engine/dependency/dependency-tree.d.ts +1 -0
- package/lib/types/engine/dependency/formula-dependency.d.ts +1 -1
- package/lib/types/engine/reference-object/base-reference-object.d.ts +2 -1
- package/lib/types/engine/value-object/array-value-object.d.ts +10 -1
- package/lib/types/facade/f-formula.d.ts +0 -13
- package/lib/types/functions/lookup/xlookup/index.d.ts +2 -4
- package/lib/types/index.d.ts +4 -2
- package/lib/types/models/formula-data.model.d.ts +5 -0
- package/lib/types/services/active-dirty-manager.service.d.ts +1 -0
- package/lib/types/services/calculate-formula.service.d.ts +34 -2
- package/lib/types/services/current-data.service.d.ts +4 -2
- package/lib/types/services/formula-calculation-trigger.service.d.ts +5 -0
- package/lib/types/services/formula-changeset-calculation.service.d.ts +34 -0
- package/lib/types/services/runtime.service.d.ts +36 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +4 -4
- package/package.json +6 -6
package/lib/cjs/index.js
CHANGED
|
@@ -358,7 +358,7 @@ function getSearchModeValue(searchModeValue) {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
//#endregion
|
|
361
|
-
//#region \0@oxc-project+runtime@0.
|
|
361
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
362
362
|
function _typeof(o) {
|
|
363
363
|
"@babel/helpers - typeof";
|
|
364
364
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -369,7 +369,7 @@ function _typeof(o) {
|
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
//#endregion
|
|
372
|
-
//#region \0@oxc-project+runtime@0.
|
|
372
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
373
373
|
function toPrimitive(t, r) {
|
|
374
374
|
if ("object" != _typeof(t) || !t) return t;
|
|
375
375
|
var e = t[Symbol.toPrimitive];
|
|
@@ -382,14 +382,14 @@ function toPrimitive(t, r) {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
//#endregion
|
|
385
|
-
//#region \0@oxc-project+runtime@0.
|
|
385
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
386
386
|
function toPropertyKey(t) {
|
|
387
387
|
var i = toPrimitive(t, "string");
|
|
388
388
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
//#endregion
|
|
392
|
-
//#region \0@oxc-project+runtime@0.
|
|
392
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
393
393
|
function _defineProperty(e, r, t) {
|
|
394
394
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
395
395
|
value: t,
|
|
@@ -1216,7 +1216,7 @@ function splitTableStructuredRef(ref) {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
|
|
1218
1218
|
//#endregion
|
|
1219
|
-
//#region \0@oxc-project+runtime@0.
|
|
1219
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
1220
1220
|
function __decorateParam(paramIndex, decorator) {
|
|
1221
1221
|
return function(target, key) {
|
|
1222
1222
|
decorator(target, key, paramIndex);
|
|
@@ -1224,7 +1224,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
1226
|
//#endregion
|
|
1227
|
-
//#region \0@oxc-project+runtime@0.
|
|
1227
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
1228
1228
|
function __decorate(decorators, target, key, desc) {
|
|
1229
1229
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1230
1230
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1702,8 +1702,6 @@ const SetSuperTableOptionMutation = {
|
|
|
1702
1702
|
//#endregion
|
|
1703
1703
|
//#region src/config/config.ts
|
|
1704
1704
|
const ENGINE_FORMULA_PLUGIN_CONFIG_KEY = "engine-formula.config";
|
|
1705
|
-
const DEFAULT_CYCLE_REFERENCE_COUNT = 1;
|
|
1706
|
-
const ENGINE_FORMULA_CYCLE_REFERENCE_COUNT = "CYCLE_REFERENCE_COUNT";
|
|
1707
1705
|
const ENGINE_FORMULA_RETURN_DEPENDENCY_TREE = "RETURN_DEPENDENCY_TREE";
|
|
1708
1706
|
const configSymbol = Symbol(ENGINE_FORMULA_PLUGIN_CONFIG_KEY);
|
|
1709
1707
|
const defaultPluginConfig = {};
|
|
@@ -3124,9 +3122,8 @@ var LexerTreeBuilder = class extends _univerjs_core.Disposable {
|
|
|
3124
3122
|
const isCacheable = !/\b(?:LET|LAMBDA)\s*\(/iu.test(formulaString);
|
|
3125
3123
|
const cacheKey = injectDefinedNameParam == null ? formulaString : `${injectDefinedNameParam.unitId ?? ""}\0${injectDefinedNameParam.sheetId ?? ""}\0${injectDefinedNameParam.refOffsetX}\0${injectDefinedNameParam.refOffsetY}\0${formulaString}`;
|
|
3126
3124
|
if (transformSuffix === true && isCacheable) {
|
|
3127
|
-
var _this$_simpleCheckDef;
|
|
3128
3125
|
const lexerNode = FormulaLexerNodeCache.get(cacheKey);
|
|
3129
|
-
const simpleCheckDefinedNameResult = injectDefinedNameParam &&
|
|
3126
|
+
const simpleCheckDefinedNameResult = injectDefinedNameParam && this._simpleCheckDefinedName(formulaString, injectDefinedNameParam, lexerNode);
|
|
3130
3127
|
if (lexerNode && !simpleCheckDefinedNameResult) return lexerNode;
|
|
3131
3128
|
}
|
|
3132
3129
|
this._resetCurrentLexerNode();
|
|
@@ -3193,13 +3190,13 @@ var LexerTreeBuilder = class extends _univerjs_core.Disposable {
|
|
|
3193
3190
|
const definedNameToken = token.trim();
|
|
3194
3191
|
const definedContent = getValueByName(unitId, definedNameToken, sheetId);
|
|
3195
3192
|
if (definedContent) {
|
|
3193
|
+
definedNames.push(definedContent.name);
|
|
3196
3194
|
const refOffsetX = definedContent.localSheetId === "AllDefaultWorkbook" ? param.refOffsetX - 1 : param.refOffsetX;
|
|
3197
3195
|
const refString = definedContent.formulaOrRefString.startsWith("=") ? definedContent.formulaOrRefString : this._moveDefinedNameRefOffset(definedContent.formulaOrRefString, refOffsetX, param.refOffsetY);
|
|
3198
3196
|
const nestedDefinedNameParam = this._handleNestedDefinedName(refString, param);
|
|
3199
3197
|
if (nestedDefinedNameParam == null || typeof nestedDefinedNameParam !== "object") {
|
|
3200
3198
|
sequenceString += nestedDefinedNameParam || "#NAME?";
|
|
3201
3199
|
hasDefinedName = true;
|
|
3202
|
-
definedNames.push(definedNameToken);
|
|
3203
3200
|
} else if (typeof nestedDefinedNameParam === "object") {
|
|
3204
3201
|
const { sequenceString: nestedSequenceString, definedNames: nestedDefinedNames } = nestedDefinedNameParam;
|
|
3205
3202
|
sequenceString += nestedSequenceString;
|
|
@@ -3264,7 +3261,7 @@ var LexerTreeBuilder = class extends _univerjs_core.Disposable {
|
|
|
3264
3261
|
if (state === "#VALUE!" || sequenceArray.length === 0) return state;
|
|
3265
3262
|
return this._handleDefinedName(sequenceArray, param);
|
|
3266
3263
|
}
|
|
3267
|
-
_simpleCheckDefinedName(formulaString, injectDefinedNameParam) {
|
|
3264
|
+
_simpleCheckDefinedName(formulaString, injectDefinedNameParam, lexerNode) {
|
|
3268
3265
|
const { getDirtyDefinedNameMap, unitId } = injectDefinedNameParam;
|
|
3269
3266
|
const definedNameMap = getDirtyDefinedNameMap();
|
|
3270
3267
|
const executeUnitId = unitId;
|
|
@@ -3272,7 +3269,7 @@ var LexerTreeBuilder = class extends _univerjs_core.Disposable {
|
|
|
3272
3269
|
const names = Object.keys(definedNameMap[executeUnitId]);
|
|
3273
3270
|
for (let i = 0, len = names.length; i < len; i++) {
|
|
3274
3271
|
const name = names[i];
|
|
3275
|
-
if (formulaString.indexOf(name) > -1) return true;
|
|
3272
|
+
if (formulaString.indexOf(name) > -1 || (lexerNode === null || lexerNode === void 0 ? void 0 : lexerNode.getDefinedNames().includes(name))) return true;
|
|
3276
3273
|
}
|
|
3277
3274
|
}
|
|
3278
3275
|
return false;
|
|
@@ -4331,18 +4328,43 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
|
|
|
4331
4328
|
super();
|
|
4332
4329
|
this._univerInstanceService = _univerInstanceService;
|
|
4333
4330
|
this._lexerTreeBuilder = _lexerTreeBuilder;
|
|
4331
|
+
_defineProperty(this, "_circularReferences", /* @__PURE__ */ new Map());
|
|
4334
4332
|
_defineProperty(this, "_formulaIdMapData", Object.create(null));
|
|
4335
4333
|
_defineProperty(this, "_arrayFormulaRange", Object.create(null));
|
|
4336
4334
|
_defineProperty(this, "_arrayFormulaCellData", Object.create(null));
|
|
4337
4335
|
_defineProperty(this, "_unitImageFormulaData", Object.create(null));
|
|
4336
|
+
this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
|
|
4337
|
+
for (const [key, cell] of this._circularReferences) if (cell.unitId === workbook.getUnitId()) this._circularReferences.delete(key);
|
|
4338
|
+
}));
|
|
4338
4339
|
}
|
|
4339
4340
|
dispose() {
|
|
4340
4341
|
super.dispose();
|
|
4342
|
+
this._circularReferences.clear();
|
|
4341
4343
|
this._formulaIdMapData = Object.create(null);
|
|
4342
4344
|
this._arrayFormulaRange = Object.create(null);
|
|
4343
4345
|
this._arrayFormulaCellData = Object.create(null);
|
|
4344
4346
|
this._unitImageFormulaData = Object.create(null);
|
|
4345
4347
|
}
|
|
4348
|
+
setCircularReferences(cells) {
|
|
4349
|
+
this._circularReferences.clear();
|
|
4350
|
+
for (const cell of cells) this._circularReferences.set(JSON.stringify([
|
|
4351
|
+
cell.unitId,
|
|
4352
|
+
cell.sheetId,
|
|
4353
|
+
cell.row,
|
|
4354
|
+
cell.column
|
|
4355
|
+
]), { ...cell });
|
|
4356
|
+
}
|
|
4357
|
+
getCircularReferences(unitId) {
|
|
4358
|
+
return Array.from(this._circularReferences.values()).filter((cell) => cell.unitId === unitId).map((cell) => ({ ...cell }));
|
|
4359
|
+
}
|
|
4360
|
+
isCircularReference(unitId, sheetId, row, column) {
|
|
4361
|
+
return this._circularReferences.has(JSON.stringify([
|
|
4362
|
+
unitId,
|
|
4363
|
+
sheetId,
|
|
4364
|
+
row,
|
|
4365
|
+
column
|
|
4366
|
+
]));
|
|
4367
|
+
}
|
|
4346
4368
|
clearPreviousArrayFormulaCellData(clearArrayFormulaCellData) {
|
|
4347
4369
|
Object.keys(clearArrayFormulaCellData).forEach((unitId) => {
|
|
4348
4370
|
const clearSheetData = clearArrayFormulaCellData[unitId];
|
|
@@ -5181,6 +5203,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
|
|
|
5181
5203
|
this._localeService = _localeService;
|
|
5182
5204
|
this._formulaDataModel = _formulaDataModel;
|
|
5183
5205
|
this._sheetRowFilteredService = _sheetRowFilteredService;
|
|
5206
|
+
_defineProperty(this, "_dirtyIterationUnits", []);
|
|
5184
5207
|
_defineProperty(this, "_unitData", Object.create(null));
|
|
5185
5208
|
_defineProperty(this, "_unitStylesData", Object.create(null));
|
|
5186
5209
|
_defineProperty(this, "_arrayFormulaCellData", Object.create(null));
|
|
@@ -5361,6 +5384,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
|
|
|
5361
5384
|
}
|
|
5362
5385
|
if (config.rowData) this._applyUnitRowData(config.rowData);
|
|
5363
5386
|
this._formulaData = config.formulaData;
|
|
5387
|
+
this._dirtyIterationUnits = config.dirtyIterationUnits ?? [];
|
|
5364
5388
|
this._arrayFormulaCellData = convertUnitDataToRuntime(config.arrayFormulaCellData);
|
|
5365
5389
|
this._arrayFormulaRange = config.arrayFormulaRange;
|
|
5366
5390
|
this._forceCalculate = config.forceCalculate;
|
|
@@ -5388,6 +5412,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
|
|
|
5388
5412
|
}
|
|
5389
5413
|
getDirtyData() {
|
|
5390
5414
|
return {
|
|
5415
|
+
dirtyIterationUnits: this._dirtyIterationUnits,
|
|
5391
5416
|
forceCalculation: this._forceCalculate,
|
|
5392
5417
|
dirtyRanges: this._dirtyRanges,
|
|
5393
5418
|
dirtyNameMap: this._dirtyNameMap,
|
|
@@ -5400,6 +5425,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
|
|
|
5400
5425
|
};
|
|
5401
5426
|
}
|
|
5402
5427
|
loadDirtyRangesAndExcludedCell(dirtyRanges, excludedCell) {
|
|
5428
|
+
this._dirtyIterationUnits = [];
|
|
5403
5429
|
this._dirtyRanges = dirtyRanges;
|
|
5404
5430
|
this._excludedCell = excludedCell;
|
|
5405
5431
|
/**
|
|
@@ -8727,7 +8753,7 @@ var ArrayValueObject = class ArrayValueObject extends BaseValueObject {
|
|
|
8727
8753
|
const row = [];
|
|
8728
8754
|
for (let c = 0; c < columnArrayCount; c++) {
|
|
8729
8755
|
const cellRaw = columnArray[c].trim();
|
|
8730
|
-
row.push(ValueObjectFactory.create(cellRaw, false, dateSystem));
|
|
8756
|
+
row.push(ValueObjectFactory.createNumberLiteral(cellRaw, dateSystem) ?? ValueObjectFactory.create(cellRaw, false, dateSystem));
|
|
8731
8757
|
}
|
|
8732
8758
|
result.push(row);
|
|
8733
8759
|
}
|
|
@@ -8752,6 +8778,7 @@ var ArrayValueObject = class ArrayValueObject extends BaseValueObject {
|
|
|
8752
8778
|
return ArrayValueObject.create(arrayValueObjectData, this.getDateSystem());
|
|
8753
8779
|
}
|
|
8754
8780
|
};
|
|
8781
|
+
const NUMBER_LITERAL_REGEX = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
8755
8782
|
var ValueObjectFactory = class {
|
|
8756
8783
|
static create(rawValue, isIgnoreNumberPattern = false, dateSystem = _univerjs_core.DateSystem.Date1900) {
|
|
8757
8784
|
if (rawValue == null) return NullValueObject.create();
|
|
@@ -8773,6 +8800,19 @@ var ValueObjectFactory = class {
|
|
|
8773
8800
|
if (typeof rawValue === "number") return createNumberValueObjectByRawValue(rawValue).withDateSystem(dateSystem);
|
|
8774
8801
|
return ErrorValueObject.create("#VALUE!");
|
|
8775
8802
|
}
|
|
8803
|
+
/**
|
|
8804
|
+
* Create a number from a number literal written in formula source, such as `12.50`, `.5`, `007` or `1E3`.
|
|
8805
|
+
* Unlike cell text, where "000123456" must stay a string, a number literal in a formula is always a number.
|
|
8806
|
+
*
|
|
8807
|
+
* @param token The unquoted token from the formula source.
|
|
8808
|
+
* @param dateSystem The workbook date system.
|
|
8809
|
+
* @returns The number value object, a NUM error on overflow, or null when the token is not a number literal.
|
|
8810
|
+
*/
|
|
8811
|
+
static createNumberLiteral(token, dateSystem = _univerjs_core.DateSystem.Date1900) {
|
|
8812
|
+
const tokenTrim = token.trim();
|
|
8813
|
+
if (!NUMBER_LITERAL_REGEX.test(tokenTrim)) return null;
|
|
8814
|
+
return createNumberValueObjectByRawValue(Number(tokenTrim)).withDateSystem(dateSystem);
|
|
8815
|
+
}
|
|
8776
8816
|
};
|
|
8777
8817
|
function isStringWrappedByDoubleQuotes(input) {
|
|
8778
8818
|
const trimmedInput = input.trim();
|
|
@@ -9148,6 +9188,16 @@ var BaseReferenceObject = class extends ObjectClassType {
|
|
|
9148
9188
|
getRuntimeFeatureCellValue(row, column) {
|
|
9149
9189
|
return getRuntimeFeatureCell(row, column, this.getSheetId(), this.getUnitId(), this._runtimeFeatureCellData);
|
|
9150
9190
|
}
|
|
9191
|
+
isCellBlank(row, column) {
|
|
9192
|
+
var _this$getCurrentActiv5, _this$getCurrentRunti, _this$getCurrentActiv6, _this$getCurrentRunti2;
|
|
9193
|
+
const cell = this.getCellData(row, column);
|
|
9194
|
+
if (!(0, _univerjs_core.isNullCell)(cell)) return false;
|
|
9195
|
+
const originalCell = (_this$getCurrentActiv5 = this.getCurrentActiveSheetData()) === null || _this$getCurrentActiv5 === void 0 ? void 0 : _this$getCurrentActiv5.cellData.getValue(row, column);
|
|
9196
|
+
if ((0, _univerjs_core.isFormulaString)(originalCell === null || originalCell === void 0 ? void 0 : originalCell.f) || (0, _univerjs_core.isFormulaId)(originalCell === null || originalCell === void 0 ? void 0 : originalCell.si)) return false;
|
|
9197
|
+
if (!cell) return true;
|
|
9198
|
+
if (cell === ((_this$getCurrentRunti = this.getCurrentRuntimeActiveArrayFormulaCellData()) === null || _this$getCurrentRunti === void 0 ? void 0 : _this$getCurrentRunti.getValue(row, column)) || cell === ((_this$getCurrentActiv6 = this.getCurrentActiveArrayFormulaCellData()) === null || _this$getCurrentActiv6 === void 0 ? void 0 : _this$getCurrentActiv6.getValue(row, column)) || cell === this.getRuntimeFeatureCellValue(row, column)) return false;
|
|
9199
|
+
return originalCell != null || cell !== ((_this$getCurrentRunti2 = this.getCurrentRuntimeSheetData()) === null || _this$getCurrentRunti2 === void 0 ? void 0 : _this$getCurrentRunti2.getValue(row, column));
|
|
9200
|
+
}
|
|
9151
9201
|
getCellByPosition(rowRaw, columnRaw) {
|
|
9152
9202
|
const range = this.getRangePosition();
|
|
9153
9203
|
const row = rowRaw ?? range.startRow;
|
|
@@ -10059,11 +10109,14 @@ let FormulaExecutedStateType = /* @__PURE__ */ function(FormulaExecutedStateType
|
|
|
10059
10109
|
return FormulaExecutedStateType;
|
|
10060
10110
|
}({});
|
|
10061
10111
|
let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.Disposable {
|
|
10062
|
-
constructor(_currentConfigService, _hyperlinkEngineFormulaService) {
|
|
10112
|
+
constructor(_currentConfigService, _hyperlinkEngineFormulaService, _univerInstanceService) {
|
|
10063
10113
|
super();
|
|
10064
10114
|
this._currentConfigService = _currentConfigService;
|
|
10065
10115
|
this._hyperlinkEngineFormulaService = _hyperlinkEngineFormulaService;
|
|
10116
|
+
this._univerInstanceService = _univerInstanceService;
|
|
10066
10117
|
_defineProperty(this, "_formulaExecuteStage", 0);
|
|
10118
|
+
_defineProperty(this, "_circularReferences", /* @__PURE__ */ new Map());
|
|
10119
|
+
_defineProperty(this, "_pendingCircularReferences", /* @__PURE__ */ new Map());
|
|
10067
10120
|
_defineProperty(this, "_stopState", false);
|
|
10068
10121
|
_defineProperty(this, "_externalReferenceUnavailable", false);
|
|
10069
10122
|
_defineProperty(this, "_currentRow", -1);
|
|
@@ -10093,6 +10146,9 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10093
10146
|
_defineProperty(this, "_formulaCycleIndex", 0);
|
|
10094
10147
|
_defineProperty(this, "_isCycleDependency", false);
|
|
10095
10148
|
_defineProperty(this, "_dependencyTreeModelData", []);
|
|
10149
|
+
this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
|
|
10150
|
+
for (const references of [this._circularReferences, this._pendingCircularReferences]) for (const [key, cell] of references) if (cell.unitId === workbook.getUnitId()) references.delete(key);
|
|
10151
|
+
}));
|
|
10096
10152
|
}
|
|
10097
10153
|
get currentRow() {
|
|
10098
10154
|
return this._currentRow;
|
|
@@ -10117,6 +10173,8 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10117
10173
|
dispose() {
|
|
10118
10174
|
super.dispose();
|
|
10119
10175
|
this.reset();
|
|
10176
|
+
this._circularReferences.clear();
|
|
10177
|
+
this._pendingCircularReferences.clear();
|
|
10120
10178
|
this._runtimeFeatureCellData = Object.create(null);
|
|
10121
10179
|
this._runtimeFeatureRange = Object.create(null);
|
|
10122
10180
|
this.clearReferenceAndNumberformatCache();
|
|
@@ -10210,8 +10268,60 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10210
10268
|
clearStringToNumberPatternCache();
|
|
10211
10269
|
clearReferenceToRangeCache();
|
|
10212
10270
|
}
|
|
10271
|
+
beginCircularReferences() {
|
|
10272
|
+
this._pendingCircularReferences = new Map(this._circularReferences);
|
|
10273
|
+
const formulaData = this._currentConfigService.getFormulaData();
|
|
10274
|
+
for (const [key, cell] of this._pendingCircularReferences) {
|
|
10275
|
+
var _formulaData$cell$uni;
|
|
10276
|
+
if (!((_formulaData$cell$uni = formulaData[cell.unitId]) === null || _formulaData$cell$uni === void 0 || (_formulaData$cell$uni = _formulaData$cell$uni[cell.sheetId]) === null || _formulaData$cell$uni === void 0 || (_formulaData$cell$uni = _formulaData$cell$uni[cell.row]) === null || _formulaData$cell$uni === void 0 ? void 0 : _formulaData$cell$uni[cell.column])) this._pendingCircularReferences.delete(key);
|
|
10277
|
+
}
|
|
10278
|
+
}
|
|
10279
|
+
clearCircularReferenceCells(cells) {
|
|
10280
|
+
if (this._pendingCircularReferences.size === 0) return;
|
|
10281
|
+
for (const cell of cells) {
|
|
10282
|
+
this._pendingCircularReferences.delete(JSON.stringify([
|
|
10283
|
+
cell.unitId,
|
|
10284
|
+
cell.subUnitId,
|
|
10285
|
+
cell.row,
|
|
10286
|
+
cell.column
|
|
10287
|
+
]));
|
|
10288
|
+
if (this._pendingCircularReferences.size === 0) return;
|
|
10289
|
+
}
|
|
10290
|
+
}
|
|
10291
|
+
recordCircularReferences(cells) {
|
|
10292
|
+
for (const cell of cells) {
|
|
10293
|
+
if (cell.row < 0 || cell.column < 0) continue;
|
|
10294
|
+
this._pendingCircularReferences.set(JSON.stringify([
|
|
10295
|
+
cell.unitId,
|
|
10296
|
+
cell.sheetId,
|
|
10297
|
+
cell.row,
|
|
10298
|
+
cell.column
|
|
10299
|
+
]), { ...cell });
|
|
10300
|
+
}
|
|
10301
|
+
}
|
|
10302
|
+
completeCircularReferences() {
|
|
10303
|
+
if (!this.isStopExecution()) this._circularReferences = new Map(this._pendingCircularReferences);
|
|
10304
|
+
}
|
|
10305
|
+
preserveCurrentCellData() {
|
|
10306
|
+
var _this$_currentConfigS;
|
|
10307
|
+
const unitId = this.currentUnitId;
|
|
10308
|
+
const sheetId = this.currentSubUnitId;
|
|
10309
|
+
const cell = (_this$_currentConfigS = this._currentConfigService.getUnitData()[unitId]) === null || _this$_currentConfigS === void 0 || (_this$_currentConfigS = _this$_currentConfigS[sheetId]) === null || _this$_currentConfigS === void 0 ? void 0 : _this$_currentConfigS.cellData.getValue(this.currentRow, this.currentColumn);
|
|
10310
|
+
if ((cell === null || cell === void 0 ? void 0 : cell.v) != null) return;
|
|
10311
|
+
const sheets = this._runtimeData[unitId] ??= {};
|
|
10312
|
+
(sheets[sheetId] ??= new _univerjs_core.ObjectMatrix()).setValue(this.currentRow, this.currentColumn, {
|
|
10313
|
+
v: (cell === null || cell === void 0 ? void 0 : cell.v) ?? 0,
|
|
10314
|
+
t: (cell === null || cell === void 0 ? void 0 : cell.v) == null ? _univerjs_core.CellValueType.NUMBER : cell.t
|
|
10315
|
+
});
|
|
10316
|
+
if (this._currentSourceFormula) {
|
|
10317
|
+
const formulas = this._sourceFormulaData[unitId] ??= {};
|
|
10318
|
+
const sheet = formulas[sheetId] ??= {};
|
|
10319
|
+
const row = sheet[this.currentRow] ??= {};
|
|
10320
|
+
row[this.currentColumn] = { ...this._currentSourceFormula };
|
|
10321
|
+
}
|
|
10322
|
+
}
|
|
10213
10323
|
setCurrent(row, column, rowCount, columnCount, sheetId, unitId) {
|
|
10214
|
-
var _this$
|
|
10324
|
+
var _this$_currentConfigS2, _this$_currentConfigS3;
|
|
10215
10325
|
this._externalReferenceUnavailable = false;
|
|
10216
10326
|
this._currentRow = row;
|
|
10217
10327
|
this._currentColumn = column;
|
|
@@ -10219,8 +10329,8 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10219
10329
|
this._currentColumnCount = columnCount;
|
|
10220
10330
|
this._currentSubUnitId = sheetId;
|
|
10221
10331
|
this._currentUnitId = unitId;
|
|
10222
|
-
const cell = (_this$
|
|
10223
|
-
const formula = (_this$
|
|
10332
|
+
const cell = (_this$_currentConfigS2 = this._currentConfigService.getUnitData()[unitId]) === null || _this$_currentConfigS2 === void 0 || (_this$_currentConfigS2 = _this$_currentConfigS2[sheetId]) === null || _this$_currentConfigS2 === void 0 ? void 0 : _this$_currentConfigS2.cellData.getValue(row, column);
|
|
10333
|
+
const formula = (_this$_currentConfigS3 = this._currentConfigService.getFormulaData()[unitId]) === null || _this$_currentConfigS3 === void 0 || (_this$_currentConfigS3 = _this$_currentConfigS3[sheetId]) === null || _this$_currentConfigS3 === void 0 || (_this$_currentConfigS3 = _this$_currentConfigS3[row]) === null || _this$_currentConfigS3 === void 0 ? void 0 : _this$_currentConfigS3[column];
|
|
10224
10334
|
if (formula) {
|
|
10225
10335
|
const isSharedFollower = (formula.x ?? 0) !== 0 || (formula.y ?? 0) !== 0;
|
|
10226
10336
|
this._currentSourceFormula = {
|
|
@@ -10281,9 +10391,9 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10281
10391
|
}
|
|
10282
10392
|
setRuntimeData(functionVariant) {
|
|
10283
10393
|
if (this._externalReferenceUnavailable) {
|
|
10284
|
-
var _this$
|
|
10285
|
-
const cell = (_this$
|
|
10286
|
-
const formula = (_this$
|
|
10394
|
+
var _this$_currentConfigS4, _this$_currentConfigS5;
|
|
10395
|
+
const cell = (_this$_currentConfigS4 = this._currentConfigService.getUnitData()[this._currentUnitId]) === null || _this$_currentConfigS4 === void 0 || (_this$_currentConfigS4 = _this$_currentConfigS4[this._currentSubUnitId]) === null || _this$_currentConfigS4 === void 0 ? void 0 : _this$_currentConfigS4.cellData.getValue(this._currentRow, this._currentColumn);
|
|
10396
|
+
const formula = (_this$_currentConfigS5 = this._currentConfigService.getFormulaData()[this._currentUnitId]) === null || _this$_currentConfigS5 === void 0 || (_this$_currentConfigS5 = _this$_currentConfigS5[this._currentSubUnitId]) === null || _this$_currentConfigS5 === void 0 || (_this$_currentConfigS5 = _this$_currentConfigS5[this._currentRow]) === null || _this$_currentConfigS5 === void 0 || (_this$_currentConfigS5 = _this$_currentConfigS5[this._currentColumn]) === null || _this$_currentConfigS5 === void 0 ? void 0 : _this$_currentConfigS5.f;
|
|
10287
10397
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) && cell.v != null && (formula == null || formula === cell.f)) return;
|
|
10288
10398
|
}
|
|
10289
10399
|
const row = this._currentRow;
|
|
@@ -10342,7 +10452,7 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10342
10452
|
const hasDataInArrayFormulaRange = this._checkIfArrayFormulaRangeHasData(unitId, sheetId, row, column, arrayRange);
|
|
10343
10453
|
const isArrayFormulaExceeded = this._checkIfArrayFormulaExceeded(rowCount, columnCount, arrayRange);
|
|
10344
10454
|
if (hasDataInArrayFormulaRange || isArrayFormulaExceeded) {
|
|
10345
|
-
var _this$
|
|
10455
|
+
var _this$_currentConfigS6;
|
|
10346
10456
|
const errorObject = this._getValueObjectOfRuntimeData(ErrorValueObject.create("#SPILL!"));
|
|
10347
10457
|
sheetData.setValue(row, column, errorObject);
|
|
10348
10458
|
clearArrayUnitData.setValue(row, column, errorObject);
|
|
@@ -10353,7 +10463,7 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10353
10463
|
*/
|
|
10354
10464
|
const unitData = this._currentConfigService.getUnitData();
|
|
10355
10465
|
const arrayData = this._currentConfigService.getArrayFormulaCellData();
|
|
10356
|
-
const previousArrayFormulaRange = (_this$
|
|
10466
|
+
const previousArrayFormulaRange = (_this$_currentConfigS6 = this._currentConfigService.getArrayFormulaRange()[unitId]) === null || _this$_currentConfigS6 === void 0 || (_this$_currentConfigS6 = _this$_currentConfigS6[sheetId]) === null || _this$_currentConfigS6 === void 0 || (_this$_currentConfigS6 = _this$_currentConfigS6[row]) === null || _this$_currentConfigS6 === void 0 ? void 0 : _this$_currentConfigS6[column];
|
|
10357
10467
|
objectValueRefOrArray.iterator((_, rowIndex, columnIndex) => {
|
|
10358
10468
|
var _unitData$unitId, _arrayData$unitId;
|
|
10359
10469
|
const currentRow = rowIndex - startRow + row;
|
|
@@ -10470,6 +10580,7 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10470
10580
|
getAllRuntimeData() {
|
|
10471
10581
|
return {
|
|
10472
10582
|
unitData: this.getUnitData(),
|
|
10583
|
+
circularReferences: Array.from(this._circularReferences.values(), (cell) => ({ ...cell })),
|
|
10473
10584
|
sourceFormulaData: this._sourceFormulaData,
|
|
10474
10585
|
arrayFormulaRange: this.getUnitArrayFormula(),
|
|
10475
10586
|
arrayFormulaEmbedded: this.getUnitArrayFormulaEmbeddedMap(),
|
|
@@ -10490,6 +10601,7 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10490
10601
|
totalArrayFormulasToCalculate: this.getTotalArrayFormulasToCalculate(),
|
|
10491
10602
|
completedArrayFormulasCount: this.getCompletedArrayFormulasCount(),
|
|
10492
10603
|
stage: this.getFormulaExecuteStage(),
|
|
10604
|
+
circularReferences: Array.from(this._circularReferences.values(), (cell) => ({ ...cell })),
|
|
10493
10605
|
formulaCycleIndex: this.getFormulaCycleIndex()
|
|
10494
10606
|
};
|
|
10495
10607
|
}
|
|
@@ -10497,11 +10609,11 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10497
10609
|
FORMULA_REF_TO_ARRAY_CACHE.clear();
|
|
10498
10610
|
}
|
|
10499
10611
|
_checkIfArrayFormulaRangeHasData(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, arrayRange) {
|
|
10500
|
-
var _this$
|
|
10612
|
+
var _this$_currentConfigS7;
|
|
10501
10613
|
const { startRow, startColumn, endRow, endColumn } = arrayRange;
|
|
10502
10614
|
const unitData = this._currentConfigService.getUnitData();
|
|
10503
10615
|
const arrayData = this._currentConfigService.getArrayFormulaCellData();
|
|
10504
|
-
const previousArrayFormulaRange = (_this$
|
|
10616
|
+
const previousArrayFormulaRange = (_this$_currentConfigS7 = this._currentConfigService.getArrayFormulaRange()[formulaUnitId]) === null || _this$_currentConfigS7 === void 0 || (_this$_currentConfigS7 = _this$_currentConfigS7[formulaSheetId]) === null || _this$_currentConfigS7 === void 0 || (_this$_currentConfigS7 = _this$_currentConfigS7[formulaRow]) === null || _this$_currentConfigS7 === void 0 ? void 0 : _this$_currentConfigS7[formulaColumn];
|
|
10505
10617
|
for (let r = startRow; r <= endRow; r++) for (let c = startColumn; c <= endColumn; c++) {
|
|
10506
10618
|
var _this$_runtimeData, _arrayData$formulaUni, _unitData$formulaUnit;
|
|
10507
10619
|
if (r === formulaRow && formulaColumn === c) continue;
|
|
@@ -10537,8 +10649,8 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10537
10649
|
* @returns
|
|
10538
10650
|
*/
|
|
10539
10651
|
_isInOtherArrayFormulaRange(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, r, c) {
|
|
10540
|
-
var _this$
|
|
10541
|
-
const arrayFormulaRange = (_this$
|
|
10652
|
+
var _this$_currentConfigS8;
|
|
10653
|
+
const arrayFormulaRange = (_this$_currentConfigS8 = this._currentConfigService.getArrayFormulaRange()[formulaUnitId]) === null || _this$_currentConfigS8 === void 0 ? void 0 : _this$_currentConfigS8[formulaSheetId];
|
|
10542
10654
|
if (arrayFormulaRange == null) return false;
|
|
10543
10655
|
let isCellOverlapping = false;
|
|
10544
10656
|
new _univerjs_core.ObjectMatrix(arrayFormulaRange).forValue((rangeRow, rangeCol, range) => {
|
|
@@ -10551,8 +10663,8 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10551
10663
|
return isCellOverlapping;
|
|
10552
10664
|
}
|
|
10553
10665
|
_isCurrentSingleCellArrayFormulaRange(unitId, sheetId, row, column) {
|
|
10554
|
-
var _this$
|
|
10555
|
-
const range = (_this$
|
|
10666
|
+
var _this$_currentConfigS9;
|
|
10667
|
+
const range = (_this$_currentConfigS9 = this._currentConfigService.getArrayFormulaRange()[unitId]) === null || _this$_currentConfigS9 === void 0 || (_this$_currentConfigS9 = _this$_currentConfigS9[sheetId]) === null || _this$_currentConfigS9 === void 0 || (_this$_currentConfigS9 = _this$_currentConfigS9[row]) === null || _this$_currentConfigS9 === void 0 ? void 0 : _this$_currentConfigS9[column];
|
|
10556
10668
|
return range != null && range.startRow === range.endRow && range.startColumn === range.endColumn;
|
|
10557
10669
|
}
|
|
10558
10670
|
_isInArrayFormulaRange(range, r, c) {
|
|
@@ -10576,7 +10688,11 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
10576
10688
|
return isInDirtyRange(dirtyRanges, unitId, sheetId, row, column);
|
|
10577
10689
|
}
|
|
10578
10690
|
};
|
|
10579
|
-
FormulaRuntimeService = __decorate([
|
|
10691
|
+
FormulaRuntimeService = __decorate([
|
|
10692
|
+
__decorateParam(0, IFormulaCurrentConfigService),
|
|
10693
|
+
__decorateParam(1, IHyperlinkEngineFormulaService),
|
|
10694
|
+
__decorateParam(2, _univerjs_core.IUniverInstanceService)
|
|
10695
|
+
], FormulaRuntimeService);
|
|
10580
10696
|
const IFormulaRuntimeService = (0, _univerjs_core.createIdentifier)("univer.formula.runtime.service");
|
|
10581
10697
|
|
|
10582
10698
|
//#endregion
|
|
@@ -12762,6 +12878,21 @@ UnionNodeFactory = __decorate([__decorateParam(0, IFunctionService), __decorateP
|
|
|
12762
12878
|
|
|
12763
12879
|
//#endregion
|
|
12764
12880
|
//#region src/engine/ast-node/value-node.ts
|
|
12881
|
+
/**
|
|
12882
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
12883
|
+
*
|
|
12884
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12885
|
+
* you may not use this file except in compliance with the License.
|
|
12886
|
+
* You may obtain a copy of the License at
|
|
12887
|
+
*
|
|
12888
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12889
|
+
*
|
|
12890
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12891
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12892
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12893
|
+
* See the License for the specific language governing permissions and
|
|
12894
|
+
* limitations under the License.
|
|
12895
|
+
*/
|
|
12765
12896
|
var ValueNode = class extends BaseAstNode {
|
|
12766
12897
|
constructor(operatorString) {
|
|
12767
12898
|
super(operatorString);
|
|
@@ -12776,6 +12907,11 @@ var ValueNode = class extends BaseAstNode {
|
|
|
12776
12907
|
this.setValue(StringValueObject.create(tokenTrim.slice(1, -1).replace(/""/g, "\"")).withDateSystem(dateSystem));
|
|
12777
12908
|
return;
|
|
12778
12909
|
}
|
|
12910
|
+
const numberLiteral = ValueObjectFactory.createNumberLiteral(tokenTrim, dateSystem);
|
|
12911
|
+
if (numberLiteral) {
|
|
12912
|
+
this.setValue(numberLiteral);
|
|
12913
|
+
return;
|
|
12914
|
+
}
|
|
12779
12915
|
const parent = this.getParent();
|
|
12780
12916
|
let isIgnoreNumberPattern = true;
|
|
12781
12917
|
if ((parent === null || parent === void 0 ? void 0 : parent.nodeType) === 4) {
|
|
@@ -13580,6 +13716,90 @@ var OtherFormulaManagerService = class extends _univerjs_core.Disposable {
|
|
|
13580
13716
|
};
|
|
13581
13717
|
const IOtherFormulaManagerService = (0, _univerjs_core.createIdentifier)("univer.formula.other-formula-manager.service");
|
|
13582
13718
|
|
|
13719
|
+
//#endregion
|
|
13720
|
+
//#region src/engine/dependency/dependency-groups.ts
|
|
13721
|
+
/**
|
|
13722
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
13723
|
+
*
|
|
13724
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13725
|
+
* you may not use this file except in compliance with the License.
|
|
13726
|
+
* You may obtain a copy of the License at
|
|
13727
|
+
*
|
|
13728
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13729
|
+
*
|
|
13730
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13731
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13732
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13733
|
+
* See the License for the specific language governing permissions and
|
|
13734
|
+
* limitations under the License.
|
|
13735
|
+
*/
|
|
13736
|
+
/**
|
|
13737
|
+
* Returns strongly connected components in dependency order: precedents before their dependents.
|
|
13738
|
+
* Mutually dependent nodes stay together so only their group needs iterative calculation.
|
|
13739
|
+
* Uses iterative Kosaraju traversal to avoid overflowing the call stack on large dependency graphs.
|
|
13740
|
+
*/
|
|
13741
|
+
function getDependencyGroups(nodes, getId, getDependents) {
|
|
13742
|
+
const byId = new Map(nodes.map((node) => [getId(node), node]));
|
|
13743
|
+
const edges = /* @__PURE__ */ new Map();
|
|
13744
|
+
const reverse = /* @__PURE__ */ new Map();
|
|
13745
|
+
for (const node of nodes) {
|
|
13746
|
+
const id = getId(node);
|
|
13747
|
+
const dependents = Array.from(getDependents(node)).filter((dependent) => byId.has(dependent));
|
|
13748
|
+
edges.set(id, dependents);
|
|
13749
|
+
for (const dependent of dependents) {
|
|
13750
|
+
const incoming = reverse.get(dependent) ?? [];
|
|
13751
|
+
incoming.push(id);
|
|
13752
|
+
reverse.set(dependent, incoming);
|
|
13753
|
+
}
|
|
13754
|
+
}
|
|
13755
|
+
const visited = /* @__PURE__ */ new Set();
|
|
13756
|
+
const order = [];
|
|
13757
|
+
for (const id of byId.keys()) {
|
|
13758
|
+
if (visited.has(id)) continue;
|
|
13759
|
+
visited.add(id);
|
|
13760
|
+
const stack = [{
|
|
13761
|
+
id,
|
|
13762
|
+
next: 0
|
|
13763
|
+
}];
|
|
13764
|
+
while (stack.length) {
|
|
13765
|
+
const frame = stack[stack.length - 1];
|
|
13766
|
+
const children = edges.get(frame.id);
|
|
13767
|
+
if (frame.next === children.length) {
|
|
13768
|
+
order.push(frame.id);
|
|
13769
|
+
stack.pop();
|
|
13770
|
+
continue;
|
|
13771
|
+
}
|
|
13772
|
+
const child = children[frame.next++];
|
|
13773
|
+
if (!visited.has(child)) {
|
|
13774
|
+
visited.add(child);
|
|
13775
|
+
stack.push({
|
|
13776
|
+
id: child,
|
|
13777
|
+
next: 0
|
|
13778
|
+
});
|
|
13779
|
+
}
|
|
13780
|
+
}
|
|
13781
|
+
}
|
|
13782
|
+
visited.clear();
|
|
13783
|
+
const groups = [];
|
|
13784
|
+
for (let i = order.length - 1; i >= 0; i--) {
|
|
13785
|
+
const id = order[i];
|
|
13786
|
+
if (visited.has(id)) continue;
|
|
13787
|
+
const group = [];
|
|
13788
|
+
const stack = [id];
|
|
13789
|
+
visited.add(id);
|
|
13790
|
+
while (stack.length) {
|
|
13791
|
+
const current = stack.pop();
|
|
13792
|
+
group.push(byId.get(current));
|
|
13793
|
+
for (const parent of reverse.get(current) ?? []) if (!visited.has(parent)) {
|
|
13794
|
+
visited.add(parent);
|
|
13795
|
+
stack.push(parent);
|
|
13796
|
+
}
|
|
13797
|
+
}
|
|
13798
|
+
groups.push(group);
|
|
13799
|
+
}
|
|
13800
|
+
return groups;
|
|
13801
|
+
}
|
|
13802
|
+
|
|
13583
13803
|
//#endregion
|
|
13584
13804
|
//#region src/engine/dependency/dependency-tree.ts
|
|
13585
13805
|
let FormulaDependencyTreeType = /* @__PURE__ */ function(FormulaDependencyTreeType) {
|
|
@@ -13592,6 +13812,7 @@ var FormulaDependencyTreeCalculator = class {
|
|
|
13592
13812
|
constructor() {
|
|
13593
13813
|
_defineProperty(this, "_state", 0);
|
|
13594
13814
|
_defineProperty(this, "type", 0);
|
|
13815
|
+
_defineProperty(this, "cycleGroup", void 0);
|
|
13595
13816
|
_defineProperty(this, "treeId", void 0);
|
|
13596
13817
|
_defineProperty(this, "children", /* @__PURE__ */ new Set());
|
|
13597
13818
|
_defineProperty(this, "parents", /* @__PURE__ */ new Set());
|
|
@@ -14013,7 +14234,28 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
14013
14234
|
await this._generateTreeList(formulaData, otherFormulaData, unitData);
|
|
14014
14235
|
this._dependencyManagerService.openKdTree();
|
|
14015
14236
|
const updateTreeList = this._getUpdateTreeListAndMakeDependency();
|
|
14016
|
-
const
|
|
14237
|
+
const runList = this._calculateRunList(updateTreeList);
|
|
14238
|
+
const selfReferences = /* @__PURE__ */ new Set();
|
|
14239
|
+
const groups = getDependencyGroups(runList, (tree) => tree.treeId, (tree) => {
|
|
14240
|
+
const dependents = this._dependencyManagerService.searchDependency(tree.toRTreeItem());
|
|
14241
|
+
const addressDependents = this._dependencyRTreeCacheForAddressFunction.bulkSearch(tree.toRTreeItem());
|
|
14242
|
+
for (const dependent of addressDependents) dependents.add(dependent);
|
|
14243
|
+
if (dependents.has(tree.treeId)) selfReferences.add(tree.treeId);
|
|
14244
|
+
return dependents;
|
|
14245
|
+
});
|
|
14246
|
+
this._runtimeService.clearCircularReferenceCells(runList);
|
|
14247
|
+
for (const group of groups) {
|
|
14248
|
+
const cyclic = group.length > 1 || selfReferences.has(group[0].treeId);
|
|
14249
|
+
const groupId = cyclic ? group.map((tree) => tree.treeId).sort((a, b) => a - b).join(",") : void 0;
|
|
14250
|
+
for (const tree of group) {
|
|
14251
|
+
tree.cycleGroup = groupId;
|
|
14252
|
+
if (cyclic) {
|
|
14253
|
+
var _this$_runtimeService;
|
|
14254
|
+
(_this$_runtimeService = this._runtimeService.getUnitData()[tree.unitId]) === null || _this$_runtimeService === void 0 || (_this$_runtimeService = _this$_runtimeService[tree.subUnitId]) === null || _this$_runtimeService === void 0 || _this$_runtimeService.realDeleteValue(tree.row, tree.column);
|
|
14255
|
+
}
|
|
14256
|
+
}
|
|
14257
|
+
}
|
|
14258
|
+
const finalTreeList = groups.flat().reverse();
|
|
14017
14259
|
if (this._checkIsCycleDependency(finalTreeList)) this._runtimeService.enableCycleDependency();
|
|
14018
14260
|
if (isCalculateTreeModel) this._runtimeService.setDependencyTreeModelData(this._getAllDependencyJson(Array.from(this._dependencyTreeCache.values())));
|
|
14019
14261
|
this._dependencyTreeCache.clear();
|
|
@@ -14022,41 +14264,8 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
14022
14264
|
this._runtimeService.clearArrayObjectCache();
|
|
14023
14265
|
return Promise.resolve(finalTreeList);
|
|
14024
14266
|
}
|
|
14025
|
-
_isCyclicUtilMap(treeId, colorMap) {
|
|
14026
|
-
const WHITE = 0;
|
|
14027
|
-
const GRAY = 1;
|
|
14028
|
-
const BLACK = 2;
|
|
14029
|
-
const stack = [treeId];
|
|
14030
|
-
while (stack.length > 0) {
|
|
14031
|
-
const currentTreeId = stack[stack.length - 1];
|
|
14032
|
-
if ((colorMap.get(currentTreeId) || WHITE) === WHITE) {
|
|
14033
|
-
colorMap.set(currentTreeId, GRAY);
|
|
14034
|
-
const node = this._dependencyTreeCache.get(currentTreeId);
|
|
14035
|
-
if (node == null) {
|
|
14036
|
-
colorMap.set(currentTreeId, BLACK);
|
|
14037
|
-
stack.pop();
|
|
14038
|
-
continue;
|
|
14039
|
-
}
|
|
14040
|
-
const parents = this._dependencyManagerService.searchDependency(node.toRTreeItem());
|
|
14041
|
-
for (const parentTreeId of parents) {
|
|
14042
|
-
const parentColor = colorMap.get(parentTreeId) || WHITE;
|
|
14043
|
-
if (parentColor === GRAY) return true;
|
|
14044
|
-
else if (parentColor === WHITE) stack.push(parentTreeId);
|
|
14045
|
-
}
|
|
14046
|
-
} else {
|
|
14047
|
-
colorMap.set(currentTreeId, BLACK);
|
|
14048
|
-
stack.pop();
|
|
14049
|
-
}
|
|
14050
|
-
}
|
|
14051
|
-
return false;
|
|
14052
|
-
}
|
|
14053
14267
|
_checkIsCycleDependency(treeList) {
|
|
14054
|
-
|
|
14055
|
-
for (const tree of treeList) if (!colorMap.has(tree.treeId)) {
|
|
14056
|
-
if (this._isCyclicUtilMap(tree.treeId, colorMap)) return true;
|
|
14057
|
-
}
|
|
14058
|
-
colorMap.clear();
|
|
14059
|
-
return false;
|
|
14268
|
+
return treeList.some((tree) => tree.cycleGroup != null);
|
|
14060
14269
|
}
|
|
14061
14270
|
_getFeatureFormulaTree(featureId, treeId, params) {
|
|
14062
14271
|
const { unitId, subUnitId, dependencyRanges, getDirtyData } = params;
|
|
@@ -14440,11 +14649,17 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
14440
14649
|
if (node.nodeType === 12 && node.getToken() === "#") return true;
|
|
14441
14650
|
return false;
|
|
14442
14651
|
}
|
|
14652
|
+
_isStaticReference(node) {
|
|
14653
|
+
return node.nodeType === 1 || node.nodeType === 10 && node.getChildren().every((child) => this._isStaticReference(child));
|
|
14654
|
+
}
|
|
14443
14655
|
_nodeTraversalRef(node, result) {
|
|
14444
14656
|
const children = node.getChildren();
|
|
14445
14657
|
const childrenCount = children.length;
|
|
14658
|
+
const token = node.getToken();
|
|
14659
|
+
const readsReferenceMetadata = node.nodeType === 4 && (token === "ROW" || token === "ROWS" || token === "COLUMN" || token === "COLUMNS");
|
|
14446
14660
|
for (let i = 0; i < childrenCount; i++) {
|
|
14447
14661
|
const item = children[i];
|
|
14662
|
+
if (readsReferenceMetadata && this._isStaticReference(item)) continue;
|
|
14448
14663
|
if (this._isPreCalculateNode(item)) {
|
|
14449
14664
|
result.push(item);
|
|
14450
14665
|
if (item.nodeType === 10) {
|
|
@@ -14688,9 +14903,10 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
14688
14903
|
* @param tree
|
|
14689
14904
|
*/
|
|
14690
14905
|
_includeTree(tree, node) {
|
|
14691
|
-
var _this$_currentConfigS, _this$_currentConfigS2;
|
|
14906
|
+
var _this$_currentConfigS, _this$_currentConfigS2, _this$_currentConfigS3;
|
|
14692
14907
|
const unitId = tree.unitId;
|
|
14693
14908
|
const subUnitId = tree.subUnitId;
|
|
14909
|
+
if ((_this$_currentConfigS = this._currentConfigService.getDirtyData().dirtyIterationUnits) === null || _this$_currentConfigS === void 0 ? void 0 : _this$_currentConfigS.includes(unitId)) return true;
|
|
14694
14910
|
/**
|
|
14695
14911
|
* RAND, RANDBETWEEN, NOW, TODAY are volatile functions that are marked dirty and recalculated every time a calculation occurs.
|
|
14696
14912
|
*/
|
|
@@ -14698,13 +14914,13 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
14698
14914
|
if (this._includeTreeFeature(tree) === true) return true;
|
|
14699
14915
|
if (this._includeOtherFormula(tree) === true) return true;
|
|
14700
14916
|
if (includeDefinedName(tree, node, this._currentConfigService) === true) return true;
|
|
14701
|
-
const excludedCell = (_this$
|
|
14917
|
+
const excludedCell = (_this$_currentConfigS2 = this._currentConfigService.getExcludedRange()) === null || _this$_currentConfigS2 === void 0 || (_this$_currentConfigS2 = _this$_currentConfigS2[unitId]) === null || _this$_currentConfigS2 === void 0 ? void 0 : _this$_currentConfigS2[subUnitId];
|
|
14702
14918
|
if ((excludedCell === null || excludedCell === void 0 ? void 0 : excludedCell.getValue(tree.row, tree.column)) != null) return false;
|
|
14703
14919
|
/**
|
|
14704
14920
|
* When a worksheet is inserted or deleted,
|
|
14705
14921
|
* the formulas within it need to be calculated.
|
|
14706
14922
|
*/
|
|
14707
|
-
if (((_this$
|
|
14923
|
+
if (((_this$_currentConfigS3 = this._currentConfigService.getDirtyNameMap()[unitId]) === null || _this$_currentConfigS3 === void 0 ? void 0 : _this$_currentConfigS3[subUnitId]) != null) return true;
|
|
14708
14924
|
if (!this._updateRangeFlattenCache.has(unitId)) return false;
|
|
14709
14925
|
const sheetRangeMap = this._updateRangeFlattenCache.get(unitId);
|
|
14710
14926
|
if (!sheetRangeMap.has(subUnitId)) return false;
|
|
@@ -14867,6 +15083,105 @@ FormulaDependencyGenerator = __decorate([
|
|
|
14867
15083
|
const DEFAULT_INTERVAL_COUNT = 500;
|
|
14868
15084
|
const ICalculateFormulaService = (0, _univerjs_core.createIdentifier)("engine-formula.calculate-formula.service");
|
|
14869
15085
|
let CalculateFormulaService = class CalculateFormulaService extends _univerjs_core.Disposable {
|
|
15086
|
+
_loadCalculationSettings(settings) {
|
|
15087
|
+
this._workbookCalculationSettings = settings ?? {};
|
|
15088
|
+
this._normalizedCalculationSettings.clear();
|
|
15089
|
+
}
|
|
15090
|
+
_getCalculationSettings(unitId) {
|
|
15091
|
+
let settings = this._normalizedCalculationSettings.get(unitId);
|
|
15092
|
+
if (settings == null) {
|
|
15093
|
+
settings = (0, _univerjs_core.normalizeWorkbookCalculationSettings)(this._workbookCalculationSettings[unitId]);
|
|
15094
|
+
this._normalizedCalculationSettings.set(unitId, settings);
|
|
15095
|
+
}
|
|
15096
|
+
return settings;
|
|
15097
|
+
}
|
|
15098
|
+
_getIterationCell(tree) {
|
|
15099
|
+
var _this$_runtimeService, _this$_currentConfigS;
|
|
15100
|
+
const cell = ((_this$_runtimeService = this._runtimeService.getUnitData()[tree.unitId]) === null || _this$_runtimeService === void 0 || (_this$_runtimeService = _this$_runtimeService[tree.subUnitId]) === null || _this$_runtimeService === void 0 ? void 0 : _this$_runtimeService.getValue(tree.row, tree.column)) ?? ((_this$_currentConfigS = this._currentConfigService.getUnitData()[tree.unitId]) === null || _this$_currentConfigS === void 0 || (_this$_currentConfigS = _this$_currentConfigS[tree.subUnitId]) === null || _this$_currentConfigS === void 0 ? void 0 : _this$_currentConfigS.cellData.getValue(tree.row, tree.column)) ?? { v: 0 };
|
|
15101
|
+
return cell.v == null ? {
|
|
15102
|
+
v: 0,
|
|
15103
|
+
t: _univerjs_core.CellValueType.NUMBER
|
|
15104
|
+
} : cell;
|
|
15105
|
+
}
|
|
15106
|
+
async *_iterateCalculationGroup(group, groupId) {
|
|
15107
|
+
const settings = group.map((item) => this._getCalculationSettings(item.unitId));
|
|
15108
|
+
if (group.every((item, i) => {
|
|
15109
|
+
var _this$_currentConfigS2;
|
|
15110
|
+
const cell = (_this$_currentConfigS2 = this._currentConfigService.getUnitData()[item.unitId]) === null || _this$_currentConfigS2 === void 0 || (_this$_currentConfigS2 = _this$_currentConfigS2[item.subUnitId]) === null || _this$_currentConfigS2 === void 0 ? void 0 : _this$_currentConfigS2.cellData.getValue(item.row, item.column);
|
|
15111
|
+
const formula = (item.formula ?? (cell === null || cell === void 0 ? void 0 : cell.f) ?? "").toUpperCase();
|
|
15112
|
+
const requiresRecalculation = formula.includes(`${"INDEX"}(`) && !(formula.includes(`${"LOOKUP"}(`) && !formula.includes(`${"XLOOKUP"}(`));
|
|
15113
|
+
return settings[i].iterativeCalculation && this._preserveCircularUnits.has(item.unitId) && (cell === null || cell === void 0 ? void 0 : cell.v) != null && !requiresRecalculation;
|
|
15114
|
+
})) {
|
|
15115
|
+
for (const tree of group) yield {
|
|
15116
|
+
tree,
|
|
15117
|
+
preserve: true,
|
|
15118
|
+
iteration: 0
|
|
15119
|
+
};
|
|
15120
|
+
this._runtimeService.recordCircularReferences(group.map((item) => ({
|
|
15121
|
+
unitId: item.unitId,
|
|
15122
|
+
sheetId: item.subUnitId,
|
|
15123
|
+
row: item.row,
|
|
15124
|
+
column: item.column,
|
|
15125
|
+
groupId,
|
|
15126
|
+
iterations: 0
|
|
15127
|
+
})));
|
|
15128
|
+
return;
|
|
15129
|
+
}
|
|
15130
|
+
const limit = settings.reduce((limit, setting) => Math.max(limit, setting.iterativeCalculation ? setting.maxIterations : 0), 1);
|
|
15131
|
+
let converged = false;
|
|
15132
|
+
let iterations = 0;
|
|
15133
|
+
const beforeValues = [];
|
|
15134
|
+
const beforeTypes = [];
|
|
15135
|
+
for (let iteration = 0; iteration < limit; iteration++) {
|
|
15136
|
+
for (let i = 0; i < group.length; i++) if (settings[i].iterativeCalculation) {
|
|
15137
|
+
const before = this._getIterationCell(group[i]);
|
|
15138
|
+
beforeValues[i] = before.v;
|
|
15139
|
+
beforeTypes[i] = before.t;
|
|
15140
|
+
}
|
|
15141
|
+
for (let i = 0; i < group.length; i++) if (iteration < (settings[i].iterativeCalculation ? settings[i].maxIterations : 1)) {
|
|
15142
|
+
FORMULA_REF_TO_ARRAY_CACHE.clear();
|
|
15143
|
+
yield {
|
|
15144
|
+
tree: group[i],
|
|
15145
|
+
preserve: !settings[i].iterativeCalculation,
|
|
15146
|
+
iteration
|
|
15147
|
+
};
|
|
15148
|
+
}
|
|
15149
|
+
iterations = iteration + 1;
|
|
15150
|
+
converged = group.every((item, i) => {
|
|
15151
|
+
if (!settings[i].iterativeCalculation) return true;
|
|
15152
|
+
const after = this._getIterationCell(item);
|
|
15153
|
+
const previousValue = beforeValues[i];
|
|
15154
|
+
return typeof after.v === "number" && typeof previousValue === "number" && (after.t == null || after.t === _univerjs_core.CellValueType.NUMBER) && (beforeTypes[i] == null || beforeTypes[i] === _univerjs_core.CellValueType.NUMBER) ? Number.isFinite(after.v) && Math.abs(after.v - previousValue) <= settings[i].maxChange : after.t === beforeTypes[i] && after.v === previousValue;
|
|
15155
|
+
});
|
|
15156
|
+
if (converged) break;
|
|
15157
|
+
}
|
|
15158
|
+
FORMULA_REF_TO_ARRAY_CACHE.clear();
|
|
15159
|
+
this._runtimeService.recordCircularReferences(group.map((item, i) => ({
|
|
15160
|
+
unitId: item.unitId,
|
|
15161
|
+
sheetId: item.subUnitId,
|
|
15162
|
+
row: item.row,
|
|
15163
|
+
column: item.column,
|
|
15164
|
+
groupId,
|
|
15165
|
+
iterations: settings[i].iterativeCalculation ? Math.min(iterations, settings[i].maxIterations) : 0,
|
|
15166
|
+
converged: settings[i].iterativeCalculation ? converged : void 0
|
|
15167
|
+
})));
|
|
15168
|
+
}
|
|
15169
|
+
async *_getCalculationSteps(trees) {
|
|
15170
|
+
while (trees.length) {
|
|
15171
|
+
const tree = trees.pop();
|
|
15172
|
+
if (tree.cycleGroup == null) {
|
|
15173
|
+
yield {
|
|
15174
|
+
tree,
|
|
15175
|
+
preserve: false,
|
|
15176
|
+
iteration: 0
|
|
15177
|
+
};
|
|
15178
|
+
continue;
|
|
15179
|
+
}
|
|
15180
|
+
const group = [tree];
|
|
15181
|
+
while (trees.length && trees[trees.length - 1].cycleGroup === tree.cycleGroup) group.push(trees.pop());
|
|
15182
|
+
yield* this._iterateCalculationGroup(group, tree.cycleGroup);
|
|
15183
|
+
}
|
|
15184
|
+
}
|
|
14870
15185
|
constructor(_configService, _lexer, _currentConfigService, _runtimeService, _formulaDependencyGenerator, _interpreter, _astTreeBuilder) {
|
|
14871
15186
|
super();
|
|
14872
15187
|
this._configService = _configService;
|
|
@@ -14882,6 +15197,9 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
|
|
|
14882
15197
|
_defineProperty(this, "executionCompleteListener$", this._executionCompleteListener$.asObservable());
|
|
14883
15198
|
_defineProperty(this, "_executeLock", new _univerjs_core.AsyncLock());
|
|
14884
15199
|
_defineProperty(this, "_isCalculateTreeModel", false);
|
|
15200
|
+
_defineProperty(this, "_workbookCalculationSettings", {});
|
|
15201
|
+
_defineProperty(this, "_preserveCircularUnits", /* @__PURE__ */ new Set());
|
|
15202
|
+
_defineProperty(this, "_normalizedCalculationSettings", /* @__PURE__ */ new Map());
|
|
14885
15203
|
}
|
|
14886
15204
|
dispose() {
|
|
14887
15205
|
super.dispose();
|
|
@@ -14917,15 +15235,12 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
|
|
|
14917
15235
|
this._executionInProgressListener$.next(this._runtimeService.getRuntimeState());
|
|
14918
15236
|
this._currentConfigService.load(formulaDatasetConfig);
|
|
14919
15237
|
this._runtimeService.reset();
|
|
14920
|
-
|
|
15238
|
+
this._loadCalculationSettings(formulaDatasetConfig.calculationSettings);
|
|
15239
|
+
this._preserveCircularUnits = new Set(formulaDatasetConfig.preserveCircularUnits);
|
|
15240
|
+
this._runtimeService.beginCircularReferences();
|
|
14921
15241
|
this._isCalculateTreeModel = formulaDatasetConfig.isCalculateTreeModel || false;
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
const executed = await this._executeStep();
|
|
14925
|
-
FORMULA_REF_TO_ARRAY_CACHE.clear();
|
|
14926
|
-
const isCycleDependency = this._runtimeService.isCycleDependency();
|
|
14927
|
-
if (!executed || !isCycleDependency) break;
|
|
14928
|
-
}
|
|
15242
|
+
await this._executeStep();
|
|
15243
|
+
this._runtimeService.completeCircularReferences();
|
|
14929
15244
|
this._runtimeService.setFormulaExecuteStage(8);
|
|
14930
15245
|
this._executionInProgressListener$.next(this._runtimeService.getRuntimeState());
|
|
14931
15246
|
this._executionCompleteListener$.next(this._runtimeService.getAllRuntimeData());
|
|
@@ -15006,15 +15321,9 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
|
|
|
15006
15321
|
const intervalCount = (config === null || config === void 0 ? void 0 : config.intervalCount) || 500;
|
|
15007
15322
|
let i = 0;
|
|
15008
15323
|
const treeCount = treeList.length;
|
|
15009
|
-
|
|
15010
|
-
|
|
15324
|
+
for await (const { tree, preserve, iteration } of this._getCalculationSteps(treeList)) {
|
|
15325
|
+
this._runtimeService.setFormulaCycleIndex(iteration);
|
|
15011
15326
|
this._runtimeService.setCurrent(tree.row, tree.column, tree.rowCount, tree.columnCount, tree.subUnitId, tree.unitId);
|
|
15012
|
-
const node = generateAstNode(tree.unitId, tree.formula, this._lexer, this._astTreeBuilder, this._currentConfigService, tree.subUnitId, tree.column, tree.row);
|
|
15013
|
-
const nodeData = {
|
|
15014
|
-
node,
|
|
15015
|
-
refOffsetX: tree.refOffsetX,
|
|
15016
|
-
refOffsetY: tree.refOffsetY
|
|
15017
|
-
};
|
|
15018
15327
|
const getDirtyData = tree.getDirtyData;
|
|
15019
15328
|
if (i % intervalCount === 0) {
|
|
15020
15329
|
/**
|
|
@@ -15032,12 +15341,23 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
|
|
|
15032
15341
|
this._runtimeService.setCompletedFormulasCount(i + 1);
|
|
15033
15342
|
}
|
|
15034
15343
|
this._executionInProgressListener$.next(this._runtimeService.getRuntimeState());
|
|
15035
|
-
if (this._runtimeService.isStopExecution()
|
|
15344
|
+
if (this._runtimeService.isStopExecution()) {
|
|
15036
15345
|
this._runtimeService.setFormulaExecuteStage(0);
|
|
15037
15346
|
this._runtimeService.markedAsStopFunctionsExecuted();
|
|
15038
15347
|
return;
|
|
15039
15348
|
}
|
|
15040
15349
|
}
|
|
15350
|
+
if (preserve) {
|
|
15351
|
+
this._runtimeService.preserveCurrentCellData();
|
|
15352
|
+
i++;
|
|
15353
|
+
continue;
|
|
15354
|
+
}
|
|
15355
|
+
const node = generateAstNode(tree.unitId, tree.formula, this._lexer, this._astTreeBuilder, this._currentConfigService, tree.subUnitId, tree.column, tree.row);
|
|
15356
|
+
const nodeData = {
|
|
15357
|
+
node,
|
|
15358
|
+
refOffsetX: tree.refOffsetX,
|
|
15359
|
+
refOffsetY: tree.refOffsetY
|
|
15360
|
+
};
|
|
15041
15361
|
let value;
|
|
15042
15362
|
if (getDirtyData != null && tree.featureId != null) {
|
|
15043
15363
|
/**
|
|
@@ -15213,11 +15533,12 @@ let CalculateController = class CalculateController extends _univerjs_core.Dispo
|
|
|
15213
15533
|
}));
|
|
15214
15534
|
}
|
|
15215
15535
|
async _calculate(formulaDirtyData) {
|
|
15216
|
-
const { forceCalculation: forceCalculate = false, dirtyRanges = [], dirtyNameMap = {}, dirtyDefinedNameMap = {}, dirtySuperTableMap = {}, dirtyUnitFeatureMap = {}, dirtyUnitOtherFormulaMap = {}, clearDependencyTreeCache = {},
|
|
15536
|
+
const { dirtyIterationUnits, forceCalculation: forceCalculate = false, dirtyRanges = [], dirtyNameMap = {}, dirtyDefinedNameMap = {}, dirtySuperTableMap = {}, dirtyUnitFeatureMap = {}, dirtyUnitOtherFormulaMap = {}, clearDependencyTreeCache = {}, calculationSettings, rowData, externalReferences, isCalculateTreeModel = false } = formulaDirtyData;
|
|
15217
15537
|
const formulaData = this._formulaDataModel.getFormulaData();
|
|
15218
15538
|
const arrayFormulaCellData = this._formulaDataModel.getArrayFormulaCellData();
|
|
15219
15539
|
const arrayFormulaRange = this._formulaDataModel.getArrayFormulaRange();
|
|
15220
15540
|
this._calculateFormulaService.execute({
|
|
15541
|
+
dirtyIterationUnits,
|
|
15221
15542
|
formulaData,
|
|
15222
15543
|
arrayFormulaCellData,
|
|
15223
15544
|
arrayFormulaRange,
|
|
@@ -15229,7 +15550,7 @@ let CalculateController = class CalculateController extends _univerjs_core.Dispo
|
|
|
15229
15550
|
dirtyUnitFeatureMap,
|
|
15230
15551
|
dirtyUnitOtherFormulaMap,
|
|
15231
15552
|
clearDependencyTreeCache,
|
|
15232
|
-
|
|
15553
|
+
calculationSettings,
|
|
15233
15554
|
isCalculateTreeModel,
|
|
15234
15555
|
rowData,
|
|
15235
15556
|
externalReferences
|
|
@@ -15277,7 +15598,10 @@ let CalculateController = class CalculateController extends _univerjs_core.Dispo
|
|
|
15277
15598
|
break;
|
|
15278
15599
|
case 0:
|
|
15279
15600
|
}
|
|
15280
|
-
this._commandService.executeCommand(SetFormulaCalculationNotificationMutation.id, {
|
|
15601
|
+
this._commandService.executeCommand(SetFormulaCalculationNotificationMutation.id, {
|
|
15602
|
+
functionsExecutedState,
|
|
15603
|
+
circularReferences: data.circularReferences
|
|
15604
|
+
}, { onlyLocal: true });
|
|
15281
15605
|
});
|
|
15282
15606
|
/**
|
|
15283
15607
|
* Assignment operation after formula calculation.
|
|
@@ -21355,13 +21679,13 @@ const weekendNumberMap = {
|
|
|
21355
21679
|
17: [6]
|
|
21356
21680
|
};
|
|
21357
21681
|
function isValidWeekend(weekend) {
|
|
21358
|
-
if (typeof weekend === "string" && /^[
|
|
21682
|
+
if (typeof weekend === "string") return weekend.length === 7 && /^[01]{7}$/.test(weekend);
|
|
21359
21683
|
if (weekendNumberMap[Number(weekend)]) return true;
|
|
21360
21684
|
return false;
|
|
21361
21685
|
}
|
|
21362
21686
|
function getWeekendArray(weekend) {
|
|
21363
21687
|
if (!isValidWeekend(weekend)) return [];
|
|
21364
|
-
if (typeof weekend === "string"
|
|
21688
|
+
if (typeof weekend === "string") {
|
|
21365
21689
|
const result = [];
|
|
21366
21690
|
for (let i = 1; i <= weekend.length; i++) if (`${weekend[i - 1]}` === "1") {
|
|
21367
21691
|
if (i === weekend.length) result.push(0);
|
|
@@ -29797,7 +30121,8 @@ var Isblank = class extends BaseFunction {
|
|
|
29797
30121
|
}
|
|
29798
30122
|
calculate(value) {
|
|
29799
30123
|
if (value instanceof BaseReferenceObject) {
|
|
29800
|
-
const
|
|
30124
|
+
const { startRow, startColumn } = value.getRangePosition();
|
|
30125
|
+
const array = value.toArrayValueObject(false).mapValue((valueObject, row, column) => BooleanValueObject.create(!valueObject.isError() && value.isCellBlank(startRow + row, startColumn + column)));
|
|
29801
30126
|
return array.getRowCount() === 1 && array.getColumnCount() === 1 ? array.getFirstCell() : array;
|
|
29802
30127
|
}
|
|
29803
30128
|
if (value.isNull()) return BooleanValueObject.create(true);
|
|
@@ -32736,7 +33061,7 @@ var Sort = class extends BaseFunction {
|
|
|
32736
33061
|
_getResult(array, sortIndexValue, sortOrderValue, byColValue, arrayRowCount, arrayColumnCount) {
|
|
32737
33062
|
if (!byColValue) {
|
|
32738
33063
|
if (sortIndexValue > arrayColumnCount) return ErrorValueObject.create("#VALUE!");
|
|
32739
|
-
const arrayValue = array.getArrayValue();
|
|
33064
|
+
const arrayValue = array.getArrayValue().slice();
|
|
32740
33065
|
arrayValue.sort(this._sort(sortIndexValue - 1, sortOrderValue));
|
|
32741
33066
|
return ArrayValueObject.create({
|
|
32742
33067
|
calculateValueList: arrayValue,
|
|
@@ -33364,7 +33689,7 @@ var Unique = class extends BaseFunction {
|
|
|
33364
33689
|
const valueObject = item.valueObject;
|
|
33365
33690
|
let value = valueObject.getValue();
|
|
33366
33691
|
if (valueObject.isNull()) value = null;
|
|
33367
|
-
else if (valueObject.isString()
|
|
33692
|
+
else if (valueObject.isString()) value = (0, _univerjs_core.isRealNum)(value) ? +value : normalizeTextForComparison(value);
|
|
33368
33693
|
if (!valueMap.has(value)) valueMap.set(value, [r]);
|
|
33369
33694
|
else {
|
|
33370
33695
|
const valueMapItem = valueMap.get(value);
|
|
@@ -33668,30 +33993,18 @@ var Xlookup = class extends BaseFunction {
|
|
|
33668
33993
|
else resultArray = returnArray.slice(void 0, [0, 1]);
|
|
33669
33994
|
if (resultArray == null) return ErrorValueObject.create("#N/A");
|
|
33670
33995
|
return lookupValue.map((value) => {
|
|
33671
|
-
|
|
33672
|
-
if (checkErrorCombination) return checkErrorCombination;
|
|
33673
|
-
const result = this._handleSingleObject(value, lookupArray, resultArray, matchModeValue, searchModeValue);
|
|
33674
|
-
if (result.isError()) return ifNotFound;
|
|
33675
|
-
return this._blankResultAsZero(result);
|
|
33996
|
+
return this._getLookupResult(value, lookupArray, resultArray, ifNotFound, matchModeValue, searchModeValue);
|
|
33676
33997
|
});
|
|
33677
33998
|
}
|
|
33678
33999
|
const _lookupValue = lookupValue.isArray() ? lookupValue.get(0, 0) : lookupValue;
|
|
33679
|
-
if (columnCountLookup === columnCountReturn && rowCountLookup === rowCountReturn)
|
|
33680
|
-
const checkErrorCombination = this._checkErrorCombination(matchModeValue, searchModeValue);
|
|
33681
|
-
if (checkErrorCombination) return checkErrorCombination;
|
|
33682
|
-
const result = this._handleSingleObject(_lookupValue, lookupArray, returnArray, matchModeValue, searchModeValue);
|
|
33683
|
-
if (result.isError()) return ifNotFound;
|
|
33684
|
-
return this._blankResultAsZero(result);
|
|
33685
|
-
}
|
|
34000
|
+
if (columnCountLookup === columnCountReturn && rowCountLookup === rowCountReturn) return this._getLookupResult(_lookupValue, lookupArray, returnArray, ifNotFound, matchModeValue, searchModeValue);
|
|
33686
34001
|
let axis = 0;
|
|
33687
34002
|
/**
|
|
33688
34003
|
* 0 for rows
|
|
33689
34004
|
* 1 for columns
|
|
33690
34005
|
*/
|
|
33691
34006
|
if (columnCountLookup === columnCountReturn) axis = 1;
|
|
33692
|
-
|
|
33693
|
-
if (resultArray == null) return ErrorValueObject.create("#N/A");
|
|
33694
|
-
return resultArray;
|
|
34007
|
+
return this._getLookupResult(_lookupValue, lookupArray, returnArray, ifNotFound, matchModeValue, searchModeValue, axis);
|
|
33695
34008
|
}
|
|
33696
34009
|
_legacyImplicitLookupValue(lookupValue) {
|
|
33697
34010
|
if (!lookupValue.isArray()) return lookupValue;
|
|
@@ -33719,35 +34032,37 @@ var Xlookup = class extends BaseFunction {
|
|
|
33719
34032
|
if (rowIndex < 0 || rowIndex >= rowCount || columnIndex < 0 || columnIndex >= columnCount) return ErrorValueObject.create("#VALUE!");
|
|
33720
34033
|
return array.get(rowIndex, columnIndex) || ErrorValueObject.create("#VALUE!");
|
|
33721
34034
|
}
|
|
33722
|
-
|
|
34035
|
+
_getLookupResult(value, searchArray, resultArray, ifNotFound, matchModeValue, searchModeValue, axis) {
|
|
34036
|
+
if (value.isError()) return value;
|
|
34037
|
+
const checkErrorCombination = this._checkErrorCombination(matchModeValue, searchModeValue);
|
|
34038
|
+
if (checkErrorCombination) return checkErrorCombination;
|
|
34039
|
+
const position = this._findPosition(value, searchArray, matchModeValue, searchModeValue);
|
|
34040
|
+
if (position == null) return ifNotFound;
|
|
34041
|
+
if (axis === 0) return resultArray.slice([position.row, position.row + 1]) ?? ErrorValueObject.create("#N/A");
|
|
34042
|
+
if (axis === 1) return resultArray.slice(void 0, [position.column, position.column + 1]) ?? ErrorValueObject.create("#N/A");
|
|
34043
|
+
const result = resultArray.get(position.row, position.column) ?? NullValueObject.create();
|
|
34044
|
+
return this._blankResultAsZero(result);
|
|
34045
|
+
}
|
|
34046
|
+
_findPosition(value, searchArray, matchModeValue, searchModeValue) {
|
|
33723
34047
|
if ((searchModeValue === 2 || searchModeValue === -2) && matchModeValue !== 2) {
|
|
33724
34048
|
const searchType = getSearchModeValue(searchModeValue);
|
|
33725
34049
|
const matchType = getMatchModeValue(matchModeValue);
|
|
33726
|
-
|
|
34050
|
+
const rowOrColumn = searchArray.binarySearch(value, searchType, matchType);
|
|
34051
|
+
if (rowOrColumn == null) return null;
|
|
34052
|
+
return searchArray.getRowCount() === 1 ? {
|
|
34053
|
+
row: 0,
|
|
34054
|
+
column: rowOrColumn
|
|
34055
|
+
} : {
|
|
34056
|
+
row: rowOrColumn,
|
|
34057
|
+
column: 0
|
|
34058
|
+
};
|
|
33727
34059
|
}
|
|
33728
|
-
if (matchModeValue === 2)
|
|
33729
|
-
|
|
33730
|
-
|
|
33731
|
-
}
|
|
33732
|
-
_handleSingleObject(value, searchArray, resultArray, matchModeValue, searchModeValue) {
|
|
33733
|
-
if ((searchModeValue === 2 || searchModeValue === -2) && matchModeValue !== 2) {
|
|
33734
|
-
const searchType = getSearchModeValue(searchModeValue);
|
|
33735
|
-
const matchType = getMatchModeValue(matchModeValue);
|
|
33736
|
-
return this.binarySearch(value, searchArray, resultArray, searchType, matchType);
|
|
34060
|
+
if (matchModeValue === 2) {
|
|
34061
|
+
const matches = searchArray.compare(value, "=");
|
|
34062
|
+
return searchModeValue === -1 ? matches.getLastTruePosition() : matches.getFirstTruePosition();
|
|
33737
34063
|
}
|
|
33738
|
-
if (matchModeValue ===
|
|
33739
|
-
|
|
33740
|
-
return this._exactSearch(value, searchArray, resultArray, searchModeValue !== -1);
|
|
33741
|
-
}
|
|
33742
|
-
_exactSearch(value, searchArray, resultArray, isFirst) {
|
|
33743
|
-
const position = this._findExactPosition(value, searchArray, isFirst);
|
|
33744
|
-
if (position == null) return ErrorValueObject.create("#N/A");
|
|
33745
|
-
return resultArray.get(position.row, position.column) ?? ErrorValueObject.create("#N/A");
|
|
33746
|
-
}
|
|
33747
|
-
_exactSearchExpand(value, searchArray, resultArray, isFirst, axis) {
|
|
33748
|
-
const position = this._findExactPosition(value, searchArray, isFirst);
|
|
33749
|
-
if (position == null) return ErrorValueObject.create("#N/A");
|
|
33750
|
-
return axis === 0 ? resultArray.slice([position.row, position.row + 1]) ?? ErrorValueObject.create("#N/A") : resultArray.slice(void 0, [position.column, position.column + 1]) ?? ErrorValueObject.create("#N/A");
|
|
34064
|
+
if (matchModeValue === -1 || matchModeValue === 1) return searchArray.orderSearch(value, matchModeValue === 1 ? 2 : 1, searchModeValue === -1, false, true);
|
|
34065
|
+
return this._findExactPosition(value, searchArray, searchModeValue !== -1);
|
|
33751
34066
|
}
|
|
33752
34067
|
_findExactPosition(value, searchArray, isFirst) {
|
|
33753
34068
|
let position;
|
|
@@ -37206,7 +37521,7 @@ var Average = class extends BaseFunction {
|
|
|
37206
37521
|
_legacyImplicitDerivedArray(variant) {
|
|
37207
37522
|
if (!variant.isArray()) return variant;
|
|
37208
37523
|
const array = variant;
|
|
37209
|
-
if (array.usesInvertedIndexCache()) return variant;
|
|
37524
|
+
if (array.usesInvertedIndexCache() || !array.usesLegacyImplicitForAggregate()) return variant;
|
|
37210
37525
|
const startRow = array.getCurrentRow();
|
|
37211
37526
|
const startColumn = array.getCurrentColumn();
|
|
37212
37527
|
if (startRow < 0 || startColumn < 0) return variant;
|
|
@@ -41825,7 +42140,7 @@ var Proper = class extends BaseFunction {
|
|
|
41825
42140
|
}
|
|
41826
42141
|
_handleSingleObject(text) {
|
|
41827
42142
|
if (text.isError() || text.isNull() || text.isBoolean() || text.isNumber()) return text;
|
|
41828
|
-
const result = text.getValue().toLocaleString().toLocaleLowerCase().replace(/(
|
|
42143
|
+
const result = text.getValue().toLocaleString().toLocaleLowerCase().replace(/(^|[^\p{L}])(\p{L})/gu, (_, before, letter) => before + letter.toLocaleUpperCase());
|
|
41829
42144
|
return StringValueObject.create(result);
|
|
41830
42145
|
}
|
|
41831
42146
|
};
|
|
@@ -43774,7 +44089,7 @@ function getObjectValue(result, isUseStrip = false) {
|
|
|
43774
44089
|
//#endregion
|
|
43775
44090
|
//#region package.json
|
|
43776
44091
|
var name = "@univerjs/engine-formula";
|
|
43777
|
-
var version = "1.0
|
|
44092
|
+
var version = "1.2.0";
|
|
43778
44093
|
|
|
43779
44094
|
//#endregion
|
|
43780
44095
|
//#region src/services/global-computing-status.service.ts
|
|
@@ -43860,6 +44175,7 @@ let FormulaCalculationTriggerService = class FormulaCalculationTriggerService ex
|
|
|
43860
44175
|
_defineProperty(this, "_executionInProgress", false);
|
|
43861
44176
|
_defineProperty(this, "_hasPendingCalculation", false);
|
|
43862
44177
|
_defineProperty(this, "_stopRequested", false);
|
|
44178
|
+
_defineProperty(this, "_suppressed", false);
|
|
43863
44179
|
this._registerGenericDirtyConversions();
|
|
43864
44180
|
this._initialize();
|
|
43865
44181
|
}
|
|
@@ -43868,6 +44184,16 @@ let FormulaCalculationTriggerService = class FormulaCalculationTriggerService ex
|
|
|
43868
44184
|
this._started = true;
|
|
43869
44185
|
this._scheduleFlush();
|
|
43870
44186
|
}
|
|
44187
|
+
/** Snapshot reconstruction calculates these synchronous mutations in its isolated runtime. */
|
|
44188
|
+
runWithoutTriggering(operation) {
|
|
44189
|
+
const previous = this._suppressed;
|
|
44190
|
+
this._suppressed = true;
|
|
44191
|
+
try {
|
|
44192
|
+
return operation();
|
|
44193
|
+
} finally {
|
|
44194
|
+
this._suppressed = previous;
|
|
44195
|
+
}
|
|
44196
|
+
}
|
|
43871
44197
|
dispose() {
|
|
43872
44198
|
clearTimeout(this._timer);
|
|
43873
44199
|
this._waitingCommandQueue = [];
|
|
@@ -43887,7 +44213,7 @@ let FormulaCalculationTriggerService = class FormulaCalculationTriggerService ex
|
|
|
43887
44213
|
return;
|
|
43888
44214
|
}
|
|
43889
44215
|
const conversion = this._activeDirtyManagerService.get(command.id);
|
|
43890
|
-
if (!conversion) return;
|
|
44216
|
+
if (!conversion || this._suppressed) return;
|
|
43891
44217
|
if (((_conversion$shouldTri = conversion.shouldTrigger) === null || _conversion$shouldTri === void 0 ? void 0 : _conversion$shouldTri.call(conversion, command, options)) === false) return;
|
|
43892
44218
|
this._waitingCommandQueue.push(command);
|
|
43893
44219
|
this._scheduleFlush();
|
|
@@ -43976,6 +44302,8 @@ function mergeDirtyData(left, right) {
|
|
|
43976
44302
|
return result;
|
|
43977
44303
|
}
|
|
43978
44304
|
function appendDirtyData(target, source, rangeKeys) {
|
|
44305
|
+
var _source$dirtyIteratio;
|
|
44306
|
+
if ((_source$dirtyIteratio = source.dirtyIterationUnits) === null || _source$dirtyIteratio === void 0 ? void 0 : _source$dirtyIteratio.length) target.dirtyIterationUnits = Array.from(/* @__PURE__ */ new Set([...target.dirtyIterationUnits ?? [], ...source.dirtyIterationUnits]));
|
|
43979
44307
|
mergeDirtyRanges(target.dirtyRanges, source.dirtyRanges ?? [], rangeKeys);
|
|
43980
44308
|
mergeDirtyUnitStringMap(target.dirtyNameMap, source.dirtyNameMap);
|
|
43981
44309
|
mergeDirtyUnitStringMap(target.dirtyDefinedNameMap, source.dirtyDefinedNameMap);
|
|
@@ -44019,7 +44347,8 @@ function mergeDirtyUnitNestedMap(target, right) {
|
|
|
44019
44347
|
});
|
|
44020
44348
|
}
|
|
44021
44349
|
function hasDirtyData(dirtyData) {
|
|
44022
|
-
|
|
44350
|
+
var _dirtyData$dirtyItera;
|
|
44351
|
+
return dirtyData.forceCalculation || Boolean((_dirtyData$dirtyItera = dirtyData.dirtyIterationUnits) === null || _dirtyData$dirtyItera === void 0 ? void 0 : _dirtyData$dirtyItera.length) || dirtyData.dirtyRanges.length > 0 || hasNestedValue(dirtyData.dirtyNameMap) || hasNestedValue(dirtyData.dirtyDefinedNameMap) || hasNestedValue(dirtyData.dirtySuperTableMap) || hasNestedValue(dirtyData.dirtyUnitFeatureMap) || hasNestedValue(dirtyData.dirtyUnitOtherFormulaMap) || hasNestedValue(dirtyData.clearDependencyTreeCache);
|
|
44023
44352
|
}
|
|
44024
44353
|
function hasNestedValue(value) {
|
|
44025
44354
|
if (value == null) return false;
|
|
@@ -44027,7 +44356,8 @@ function hasNestedValue(value) {
|
|
|
44027
44356
|
return Object.values(value).some(hasNestedValue);
|
|
44028
44357
|
}
|
|
44029
44358
|
function dirtyDataIntersects(left, right) {
|
|
44030
|
-
|
|
44359
|
+
var _left$dirtyIterationU, _right$dirtyIteration;
|
|
44360
|
+
if (left.forceCalculation || right.forceCalculation || ((_left$dirtyIterationU = left.dirtyIterationUnits) === null || _left$dirtyIterationU === void 0 ? void 0 : _left$dirtyIterationU.length) || ((_right$dirtyIteration = right.dirtyIterationUnits) === null || _right$dirtyIteration === void 0 ? void 0 : _right$dirtyIteration.length)) return true;
|
|
44031
44361
|
if (left.dirtyRanges.some((leftRange) => right.dirtyRanges.some((rightRange) => leftRange.unitId === rightRange.unitId && leftRange.sheetId === rightRange.sheetId && _univerjs_core.Rectangle.intersects(leftRange.range, rightRange.range))) || clearedSheetIntersects(left, right) || clearedSheetIntersects(right, left)) return true;
|
|
44032
44362
|
return [
|
|
44033
44363
|
[left.dirtyNameMap, right.dirtyNameMap],
|
|
@@ -57475,13 +57805,17 @@ _defineProperty(UniverFormulaEnginePlugin, "packageName", name);
|
|
|
57475
57805
|
_defineProperty(UniverFormulaEnginePlugin, "version", version);
|
|
57476
57806
|
UniverFormulaEnginePlugin = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(2, _univerjs_core.IConfigService)], UniverFormulaEnginePlugin);
|
|
57477
57807
|
|
|
57808
|
+
//#endregion
|
|
57809
|
+
//#region src/services/formula-changeset-calculation.service.ts
|
|
57810
|
+
const IFormulaChangesetCalculationService = (0, _univerjs_core.createIdentifier)("engine-formula.changeset-calculation.service");
|
|
57811
|
+
|
|
57478
57812
|
//#endregion
|
|
57479
57813
|
exports.ALL_IMPLEMENTED_FUNCTIONS = ALL_IMPLEMENTED_FUNCTIONS;
|
|
57480
57814
|
exports.ALL_IMPLEMENTED_FUNCTIONS_SET = ALL_IMPLEMENTED_FUNCTIONS_SET;
|
|
57481
57815
|
exports.ActiveDirtyManagerService = ActiveDirtyManagerService;
|
|
57482
57816
|
exports.ArrayValueObject = ArrayValueObject;
|
|
57483
57817
|
exports.AstRootNodeFactory = AstRootNodeFactory;
|
|
57484
|
-
Object.defineProperty(exports,
|
|
57818
|
+
Object.defineProperty(exports, "AstTreeBuilder", {
|
|
57485
57819
|
enumerable: true,
|
|
57486
57820
|
get: function () {
|
|
57487
57821
|
return AstTreeBuilder;
|
|
@@ -57496,27 +57830,26 @@ exports.BaseValueObject = BaseValueObject;
|
|
|
57496
57830
|
exports.BooleanValue = BooleanValue;
|
|
57497
57831
|
exports.BooleanValueObject = BooleanValueObject;
|
|
57498
57832
|
exports.CELL_INVERTED_INDEX_CACHE = CELL_INVERTED_INDEX_CACHE;
|
|
57499
|
-
Object.defineProperty(exports,
|
|
57833
|
+
Object.defineProperty(exports, "CalculateController", {
|
|
57500
57834
|
enumerable: true,
|
|
57501
57835
|
get: function () {
|
|
57502
57836
|
return CalculateController;
|
|
57503
57837
|
}
|
|
57504
57838
|
});
|
|
57505
|
-
Object.defineProperty(exports,
|
|
57839
|
+
Object.defineProperty(exports, "CalculateFormulaService", {
|
|
57506
57840
|
enumerable: true,
|
|
57507
57841
|
get: function () {
|
|
57508
57842
|
return CalculateFormulaService;
|
|
57509
57843
|
}
|
|
57510
57844
|
});
|
|
57511
57845
|
exports.CustomFunction = CustomFunction;
|
|
57512
|
-
exports.DEFAULT_CYCLE_REFERENCE_COUNT = DEFAULT_CYCLE_REFERENCE_COUNT;
|
|
57513
57846
|
exports.DEFAULT_INTERVAL_COUNT = DEFAULT_INTERVAL_COUNT;
|
|
57514
57847
|
exports.DEFAULT_TOKEN_LAMBDA_FUNCTION_NAME = DEFAULT_TOKEN_LAMBDA_FUNCTION_NAME;
|
|
57515
57848
|
exports.DEFAULT_TOKEN_LET_FUNCTION_NAME = DEFAULT_TOKEN_LET_FUNCTION_NAME;
|
|
57516
57849
|
exports.DEFAULT_TOKEN_TYPE_LAMBDA_PARAMETER = DEFAULT_TOKEN_TYPE_LAMBDA_PARAMETER;
|
|
57517
57850
|
exports.DEFAULT_TOKEN_TYPE_PARAMETER = DEFAULT_TOKEN_TYPE_PARAMETER;
|
|
57518
57851
|
exports.DEFAULT_TOKEN_TYPE_ROOT = DEFAULT_TOKEN_TYPE_ROOT;
|
|
57519
|
-
Object.defineProperty(exports,
|
|
57852
|
+
Object.defineProperty(exports, "DefinedNamesService", {
|
|
57520
57853
|
enumerable: true,
|
|
57521
57854
|
get: function () {
|
|
57522
57855
|
return DefinedNamesService;
|
|
@@ -57524,13 +57857,12 @@ Object.defineProperty(exports, 'DefinedNamesService', {
|
|
|
57524
57857
|
});
|
|
57525
57858
|
exports.DependencyManagerBaseService = DependencyManagerBaseService;
|
|
57526
57859
|
exports.DependencyManagerService = DependencyManagerService;
|
|
57527
|
-
Object.defineProperty(exports,
|
|
57860
|
+
Object.defineProperty(exports, "DescriptionService", {
|
|
57528
57861
|
enumerable: true,
|
|
57529
57862
|
get: function () {
|
|
57530
57863
|
return DescriptionService;
|
|
57531
57864
|
}
|
|
57532
57865
|
});
|
|
57533
|
-
exports.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT = ENGINE_FORMULA_CYCLE_REFERENCE_COUNT;
|
|
57534
57866
|
exports.ENGINE_FORMULA_PLUGIN_CONFIG_KEY = ENGINE_FORMULA_PLUGIN_CONFIG_KEY;
|
|
57535
57867
|
exports.ENGINE_FORMULA_RETURN_DEPENDENCY_TREE = ENGINE_FORMULA_RETURN_DEPENDENCY_TREE;
|
|
57536
57868
|
exports.ERROR_TYPE_SET = ERROR_TYPE_SET;
|
|
@@ -57569,32 +57901,32 @@ exports.FUNCTION_NAMES_TEXT = FUNCTION_NAMES_TEXT;
|
|
|
57569
57901
|
exports.FUNCTION_NAMES_UNIVER = FUNCTION_NAMES_UNIVER;
|
|
57570
57902
|
exports.FUNCTION_NAMES_WEB = FUNCTION_NAMES_WEB;
|
|
57571
57903
|
exports.FeatureCalculationManagerService = FeatureCalculationManagerService;
|
|
57572
|
-
Object.defineProperty(exports,
|
|
57904
|
+
Object.defineProperty(exports, "FormulaCalculationSessionController", {
|
|
57573
57905
|
enumerable: true,
|
|
57574
57906
|
get: function () {
|
|
57575
57907
|
return FormulaCalculationSessionController;
|
|
57576
57908
|
}
|
|
57577
57909
|
});
|
|
57578
57910
|
exports.FormulaCalculationSessionService = FormulaCalculationSessionService;
|
|
57579
|
-
Object.defineProperty(exports,
|
|
57911
|
+
Object.defineProperty(exports, "FormulaCalculationTriggerService", {
|
|
57580
57912
|
enumerable: true,
|
|
57581
57913
|
get: function () {
|
|
57582
57914
|
return FormulaCalculationTriggerService;
|
|
57583
57915
|
}
|
|
57584
57916
|
});
|
|
57585
|
-
Object.defineProperty(exports,
|
|
57917
|
+
Object.defineProperty(exports, "FormulaCurrentConfigService", {
|
|
57586
57918
|
enumerable: true,
|
|
57587
57919
|
get: function () {
|
|
57588
57920
|
return FormulaCurrentConfigService;
|
|
57589
57921
|
}
|
|
57590
57922
|
});
|
|
57591
|
-
Object.defineProperty(exports,
|
|
57923
|
+
Object.defineProperty(exports, "FormulaDataModel", {
|
|
57592
57924
|
enumerable: true,
|
|
57593
57925
|
get: function () {
|
|
57594
57926
|
return FormulaDataModel;
|
|
57595
57927
|
}
|
|
57596
57928
|
});
|
|
57597
|
-
Object.defineProperty(exports,
|
|
57929
|
+
Object.defineProperty(exports, "FormulaDependencyGenerator", {
|
|
57598
57930
|
enumerable: true,
|
|
57599
57931
|
get: function () {
|
|
57600
57932
|
return FormulaDependencyGenerator;
|
|
@@ -57608,19 +57940,19 @@ exports.FormulaExecuteStageType = FormulaExecuteStageType;
|
|
|
57608
57940
|
exports.FormulaExecutedStateType = FormulaExecutedStateType;
|
|
57609
57941
|
exports.FormulaResultApplicationType = FormulaResultApplicationType;
|
|
57610
57942
|
exports.FormulaResultStatus = FormulaResultStatus;
|
|
57611
|
-
Object.defineProperty(exports,
|
|
57943
|
+
Object.defineProperty(exports, "FormulaRuntimeService", {
|
|
57612
57944
|
enumerable: true,
|
|
57613
57945
|
get: function () {
|
|
57614
57946
|
return FormulaRuntimeService;
|
|
57615
57947
|
}
|
|
57616
57948
|
});
|
|
57617
|
-
Object.defineProperty(exports,
|
|
57949
|
+
Object.defineProperty(exports, "FormulaUnitReferenceResolver", {
|
|
57618
57950
|
enumerable: true,
|
|
57619
57951
|
get: function () {
|
|
57620
57952
|
return FormulaUnitReferenceResolver;
|
|
57621
57953
|
}
|
|
57622
57954
|
});
|
|
57623
|
-
Object.defineProperty(exports,
|
|
57955
|
+
Object.defineProperty(exports, "FunctionNodeFactory", {
|
|
57624
57956
|
enumerable: true,
|
|
57625
57957
|
get: function () {
|
|
57626
57958
|
return FunctionNodeFactory;
|
|
@@ -57629,7 +57961,7 @@ Object.defineProperty(exports, 'FunctionNodeFactory', {
|
|
|
57629
57961
|
exports.FunctionService = FunctionService;
|
|
57630
57962
|
exports.FunctionType = FunctionType;
|
|
57631
57963
|
exports.GlobalComputingStatusService = GlobalComputingStatusService;
|
|
57632
|
-
Object.defineProperty(exports,
|
|
57964
|
+
Object.defineProperty(exports, "HyperlinkEngineFormulaService", {
|
|
57633
57965
|
enumerable: true,
|
|
57634
57966
|
get: function () {
|
|
57635
57967
|
return HyperlinkEngineFormulaService;
|
|
@@ -57641,6 +57973,7 @@ exports.IDefinedNamesService = IDefinedNamesService;
|
|
|
57641
57973
|
exports.IDependencyManagerService = IDependencyManagerService;
|
|
57642
57974
|
exports.IDescriptionService = IDescriptionService;
|
|
57643
57975
|
exports.IFeatureCalculationManagerService = IFeatureCalculationManagerService;
|
|
57976
|
+
exports.IFormulaChangesetCalculationService = IFormulaChangesetCalculationService;
|
|
57644
57977
|
exports.IFormulaCurrentConfigService = IFormulaCurrentConfigService;
|
|
57645
57978
|
exports.IFormulaDependencyGenerator = IFormulaDependencyGenerator;
|
|
57646
57979
|
exports.IFormulaExternalReferenceDataLoader = IFormulaExternalReferenceDataLoader;
|
|
@@ -57652,13 +57985,13 @@ exports.IOtherFormulaManagerService = IOtherFormulaManagerService;
|
|
|
57652
57985
|
exports.IRegisterFunctionService = IRegisterFunctionService;
|
|
57653
57986
|
exports.ISheetRowFilteredService = ISheetRowFilteredService;
|
|
57654
57987
|
exports.ISuperTableService = ISuperTableService;
|
|
57655
|
-
Object.defineProperty(exports,
|
|
57988
|
+
Object.defineProperty(exports, "Interpreter", {
|
|
57656
57989
|
enumerable: true,
|
|
57657
57990
|
get: function () {
|
|
57658
57991
|
return Interpreter;
|
|
57659
57992
|
}
|
|
57660
57993
|
});
|
|
57661
|
-
Object.defineProperty(exports,
|
|
57994
|
+
Object.defineProperty(exports, "LambdaNodeFactory", {
|
|
57662
57995
|
enumerable: true,
|
|
57663
57996
|
get: function () {
|
|
57664
57997
|
return LambdaNodeFactory;
|
|
@@ -57666,7 +57999,7 @@ Object.defineProperty(exports, 'LambdaNodeFactory', {
|
|
|
57666
57999
|
});
|
|
57667
58000
|
exports.LambdaParameterNodeFactory = LambdaParameterNodeFactory;
|
|
57668
58001
|
exports.LambdaValueObjectObject = LambdaValueObjectObject;
|
|
57669
|
-
Object.defineProperty(exports,
|
|
58002
|
+
Object.defineProperty(exports, "Lexer", {
|
|
57670
58003
|
enumerable: true,
|
|
57671
58004
|
get: function () {
|
|
57672
58005
|
return Lexer;
|
|
@@ -57679,7 +58012,7 @@ exports.NoopFormulaExternalReferenceDataLoader = NoopFormulaExternalReferenceDat
|
|
|
57679
58012
|
exports.NullValueObject = NullValueObject;
|
|
57680
58013
|
exports.NumberValueObject = NumberValueObject;
|
|
57681
58014
|
exports.OPERATOR_TOKEN_SET = OPERATOR_TOKEN_SET;
|
|
57682
|
-
Object.defineProperty(exports,
|
|
58015
|
+
Object.defineProperty(exports, "OperatorNodeFactory", {
|
|
57683
58016
|
enumerable: true,
|
|
57684
58017
|
get: function () {
|
|
57685
58018
|
return OperatorNodeFactory;
|
|
@@ -57688,27 +58021,27 @@ Object.defineProperty(exports, 'OperatorNodeFactory', {
|
|
|
57688
58021
|
exports.OtherFormulaBizType = OtherFormulaBizType;
|
|
57689
58022
|
exports.OtherFormulaManagerService = OtherFormulaManagerService;
|
|
57690
58023
|
exports.OtherFormulaMarkDirty = OtherFormulaMarkDirty;
|
|
57691
|
-
Object.defineProperty(exports,
|
|
58024
|
+
Object.defineProperty(exports, "PrefixNodeFactory", {
|
|
57692
58025
|
enumerable: true,
|
|
57693
58026
|
get: function () {
|
|
57694
58027
|
return PrefixNodeFactory;
|
|
57695
58028
|
}
|
|
57696
58029
|
});
|
|
57697
58030
|
exports.RangeReferenceObject = RangeReferenceObject;
|
|
57698
|
-
Object.defineProperty(exports,
|
|
58031
|
+
Object.defineProperty(exports, "ReferenceNodeFactory", {
|
|
57699
58032
|
enumerable: true,
|
|
57700
58033
|
get: function () {
|
|
57701
58034
|
return ReferenceNodeFactory;
|
|
57702
58035
|
}
|
|
57703
58036
|
});
|
|
57704
58037
|
exports.RegisterFunctionMutation = RegisterFunctionMutation;
|
|
57705
|
-
Object.defineProperty(exports,
|
|
58038
|
+
Object.defineProperty(exports, "RegisterFunctionService", {
|
|
57706
58039
|
enumerable: true,
|
|
57707
58040
|
get: function () {
|
|
57708
58041
|
return RegisterFunctionService;
|
|
57709
58042
|
}
|
|
57710
58043
|
});
|
|
57711
|
-
Object.defineProperty(exports,
|
|
58044
|
+
Object.defineProperty(exports, "RegisterOtherFormulaService", {
|
|
57712
58045
|
enumerable: true,
|
|
57713
58046
|
get: function () {
|
|
57714
58047
|
return RegisterOtherFormulaService;
|
|
@@ -57745,26 +58078,26 @@ exports.SetSuperTableOptionMutation = SetSuperTableOptionMutation;
|
|
|
57745
58078
|
exports.SetTriggerFormulaCalculationStartMutation = SetTriggerFormulaCalculationStartMutation;
|
|
57746
58079
|
exports.SheetRowFilteredService = SheetRowFilteredService;
|
|
57747
58080
|
exports.StringValueObject = StringValueObject;
|
|
57748
|
-
Object.defineProperty(exports,
|
|
58081
|
+
Object.defineProperty(exports, "SuffixNodeFactory", {
|
|
57749
58082
|
enumerable: true,
|
|
57750
58083
|
get: function () {
|
|
57751
58084
|
return SuffixNodeFactory;
|
|
57752
58085
|
}
|
|
57753
58086
|
});
|
|
57754
|
-
Object.defineProperty(exports,
|
|
58087
|
+
Object.defineProperty(exports, "SuperTableActiveDirtyController", {
|
|
57755
58088
|
enumerable: true,
|
|
57756
58089
|
get: function () {
|
|
57757
58090
|
return SuperTableActiveDirtyController;
|
|
57758
58091
|
}
|
|
57759
58092
|
});
|
|
57760
58093
|
exports.SuperTableService = SuperTableService;
|
|
57761
|
-
Object.defineProperty(exports,
|
|
58094
|
+
Object.defineProperty(exports, "UnionNodeFactory", {
|
|
57762
58095
|
enumerable: true,
|
|
57763
58096
|
get: function () {
|
|
57764
58097
|
return UnionNodeFactory;
|
|
57765
58098
|
}
|
|
57766
58099
|
});
|
|
57767
|
-
Object.defineProperty(exports,
|
|
58100
|
+
Object.defineProperty(exports, "UniverFormulaEnginePlugin", {
|
|
57768
58101
|
enumerable: true,
|
|
57769
58102
|
get: function () {
|
|
57770
58103
|
return UniverFormulaEnginePlugin;
|
|
@@ -57823,6 +58156,7 @@ exports.isReferenceStringWithEffectiveColumn = isReferenceStringWithEffectiveCol
|
|
|
57823
58156
|
exports.isReferenceStrings = isReferenceStrings;
|
|
57824
58157
|
exports.matchRefDrawToken = matchRefDrawToken;
|
|
57825
58158
|
exports.matchToken = matchToken;
|
|
58159
|
+
exports.mergeDirtyData = mergeDirtyData;
|
|
57826
58160
|
exports.needsQuoting = needsQuoting;
|
|
57827
58161
|
exports.normalizeFormulaUnitName = normalizeFormulaUnitName;
|
|
57828
58162
|
exports.normalizeSheetName = normalizeSheetName;
|