@univerjs/engine-formula 0.22.0 → 0.22.1-insiders.20260515-225d350
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2149 -1889
- package/lib/es/index.js +2149 -1892
- package/lib/index.js +2149 -1892
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +18 -0
- package/lib/types/engine/dependency/formula-dependency.d.ts +22 -27
- package/lib/types/index.d.ts +3 -2
- package/lib/types/services/calculate-formula.service.d.ts +10 -5
- package/lib/types/services/dependency-manager.service.d.ts +23 -29
- package/lib/umd/index.js +2 -2
- package/package.json +4 -4
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
29
|
let _univerjs_core = require("@univerjs/core");
|
|
30
|
-
let rxjs = require("rxjs");
|
|
31
30
|
let _flatten_js_interval_tree = require("@flatten-js/interval-tree");
|
|
32
31
|
_flatten_js_interval_tree = __toESM(_flatten_js_interval_tree);
|
|
32
|
+
let rxjs = require("rxjs");
|
|
33
33
|
let decimal_js = require("decimal.js");
|
|
34
34
|
decimal_js = __toESM(decimal_js);
|
|
35
35
|
let _univerjs_rpc = require("@univerjs/rpc");
|
|
@@ -1132,6 +1132,181 @@ let FunctionType = /* @__PURE__ */ function(FunctionType) {
|
|
|
1132
1132
|
return FunctionType;
|
|
1133
1133
|
}({});
|
|
1134
1134
|
|
|
1135
|
+
//#endregion
|
|
1136
|
+
//#region src/basics/inverted-index-cache.ts
|
|
1137
|
+
const DEFAULT_EMPTY_CELL_KEY = Symbol("EMPTY_CELL");
|
|
1138
|
+
const normalizedValueMap = /* @__PURE__ */ new Map();
|
|
1139
|
+
function normalizeValue(value) {
|
|
1140
|
+
if (normalizedValueMap.has(value)) return normalizedValueMap.get(value);
|
|
1141
|
+
let _value;
|
|
1142
|
+
if (value === null || value === void 0 || value === "") _value = DEFAULT_EMPTY_CELL_KEY;
|
|
1143
|
+
else if ((0, _univerjs_core.isRealNum)(value) && Number(value).toString() === value.toString()) _value = Number(value) === 0 ? 0 : Number(value);
|
|
1144
|
+
else if (typeof value === "string") _value = value.toLowerCase();
|
|
1145
|
+
else _value = value;
|
|
1146
|
+
normalizedValueMap.set(value, _value);
|
|
1147
|
+
return _value;
|
|
1148
|
+
}
|
|
1149
|
+
var InvertedIndexCache = class {
|
|
1150
|
+
constructor() {
|
|
1151
|
+
_defineProperty(this, "_cache", /* @__PURE__ */ new Map());
|
|
1152
|
+
_defineProperty(this, "_continueBuildingCache", /* @__PURE__ */ new Map());
|
|
1153
|
+
}
|
|
1154
|
+
set(unitId, sheetId, column, value, row, isForceUpdate = false) {
|
|
1155
|
+
if (!this.shouldContinueBuildingCache(unitId, sheetId, column, row) && !isForceUpdate) return;
|
|
1156
|
+
let unitMap = this._cache.get(unitId);
|
|
1157
|
+
if (unitMap == null) {
|
|
1158
|
+
unitMap = /* @__PURE__ */ new Map();
|
|
1159
|
+
this._cache.set(unitId, unitMap);
|
|
1160
|
+
}
|
|
1161
|
+
let sheetMap = unitMap.get(sheetId);
|
|
1162
|
+
if (sheetMap == null) {
|
|
1163
|
+
sheetMap = /* @__PURE__ */ new Map();
|
|
1164
|
+
unitMap.set(sheetId, sheetMap);
|
|
1165
|
+
}
|
|
1166
|
+
let columnMap = sheetMap.get(column);
|
|
1167
|
+
if (columnMap == null) {
|
|
1168
|
+
columnMap = /* @__PURE__ */ new Map();
|
|
1169
|
+
sheetMap.set(column, columnMap);
|
|
1170
|
+
}
|
|
1171
|
+
if (isForceUpdate) {
|
|
1172
|
+
for (const [_, _cellList] of columnMap) if (_cellList.has(row)) {
|
|
1173
|
+
_cellList.delete(row);
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
const _value = normalizeValue(value);
|
|
1178
|
+
let cellList = columnMap.get(_value);
|
|
1179
|
+
if (cellList == null) {
|
|
1180
|
+
cellList = /* @__PURE__ */ new Set();
|
|
1181
|
+
columnMap.set(_value, cellList);
|
|
1182
|
+
}
|
|
1183
|
+
cellList.add(row);
|
|
1184
|
+
}
|
|
1185
|
+
getCellValuePositions(unitId, sheetId, column) {
|
|
1186
|
+
var _this$_cache$get;
|
|
1187
|
+
return (_this$_cache$get = this._cache.get(unitId)) === null || _this$_cache$get === void 0 || (_this$_cache$get = _this$_cache$get.get(sheetId)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get.get(column);
|
|
1188
|
+
}
|
|
1189
|
+
getCellPositions(unitId, sheetId, column, value, rowsInCache) {
|
|
1190
|
+
var _this$_cache$get2;
|
|
1191
|
+
const columnMap = (_this$_cache$get2 = this._cache.get(unitId)) === null || _this$_cache$get2 === void 0 || (_this$_cache$get2 = _this$_cache$get2.get(sheetId)) === null || _this$_cache$get2 === void 0 ? void 0 : _this$_cache$get2.get(column);
|
|
1192
|
+
if (!columnMap) return;
|
|
1193
|
+
const result = {
|
|
1194
|
+
errorType: null,
|
|
1195
|
+
matchingRows: []
|
|
1196
|
+
};
|
|
1197
|
+
const _value = normalizeValue(value);
|
|
1198
|
+
if (ERROR_TYPE_SET.has(_value)) result.errorType = _value;
|
|
1199
|
+
else if (_value === 0 || _value === DEFAULT_EMPTY_CELL_KEY) {
|
|
1200
|
+
const rows = [];
|
|
1201
|
+
const rowsForZero = columnMap.get(0);
|
|
1202
|
+
if (rowsForZero) rows.push(...rowsForZero);
|
|
1203
|
+
const rowsForEmpty = columnMap.get(DEFAULT_EMPTY_CELL_KEY);
|
|
1204
|
+
if (rowsForEmpty) rows.push(...rowsForEmpty);
|
|
1205
|
+
result.matchingRows = rows.filter((row) => rowsInCache.some(([start, end]) => row >= start && row <= end));
|
|
1206
|
+
} else {
|
|
1207
|
+
var _columnMap$get;
|
|
1208
|
+
result.matchingRows = Array.from((_columnMap$get = columnMap.get(_value)) !== null && _columnMap$get !== void 0 ? _columnMap$get : []).filter((row) => rowsInCache.some(([start, end]) => row >= start && row <= end));
|
|
1209
|
+
}
|
|
1210
|
+
return result;
|
|
1211
|
+
}
|
|
1212
|
+
setContinueBuildingCache(unitId, sheetId, column, startRow, endRow) {
|
|
1213
|
+
if (column === -1 || startRow === -1 || endRow === -1) return;
|
|
1214
|
+
let unitMap = this._continueBuildingCache.get(unitId);
|
|
1215
|
+
if (unitMap == null) {
|
|
1216
|
+
unitMap = /* @__PURE__ */ new Map();
|
|
1217
|
+
this._continueBuildingCache.set(unitId, unitMap);
|
|
1218
|
+
}
|
|
1219
|
+
let sheetMap = unitMap.get(sheetId);
|
|
1220
|
+
if (sheetMap == null) {
|
|
1221
|
+
sheetMap = /* @__PURE__ */ new Map();
|
|
1222
|
+
unitMap.set(sheetId, sheetMap);
|
|
1223
|
+
}
|
|
1224
|
+
let columnMap = sheetMap.get(column);
|
|
1225
|
+
if (columnMap == null) {
|
|
1226
|
+
columnMap = new _flatten_js_interval_tree.default();
|
|
1227
|
+
columnMap.insert([startRow, endRow]);
|
|
1228
|
+
sheetMap.set(column, columnMap);
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
this._handleNewInterval(columnMap, startRow, endRow);
|
|
1232
|
+
}
|
|
1233
|
+
shouldContinueBuildingCache(unitId, sheetId, column, row) {
|
|
1234
|
+
var _this$_continueBuildi;
|
|
1235
|
+
if (column === -1 || row === -1) return false;
|
|
1236
|
+
const columnMap = (_this$_continueBuildi = this._continueBuildingCache.get(unitId)) === null || _this$_continueBuildi === void 0 || (_this$_continueBuildi = _this$_continueBuildi.get(sheetId)) === null || _this$_continueBuildi === void 0 ? void 0 : _this$_continueBuildi.get(column);
|
|
1237
|
+
if (!columnMap) return true;
|
|
1238
|
+
return columnMap.search([row, row]).length === 0;
|
|
1239
|
+
}
|
|
1240
|
+
canUseCache(unitId, sheetId, column, rangeStartRow, rangeEndRow) {
|
|
1241
|
+
var _this$_continueBuildi2;
|
|
1242
|
+
const columnMap = (_this$_continueBuildi2 = this._continueBuildingCache.get(unitId)) === null || _this$_continueBuildi2 === void 0 || (_this$_continueBuildi2 = _this$_continueBuildi2.get(sheetId)) === null || _this$_continueBuildi2 === void 0 ? void 0 : _this$_continueBuildi2.get(column);
|
|
1243
|
+
if (column === -1 || rangeStartRow === -1 || rangeEndRow === -1 || !columnMap) return {
|
|
1244
|
+
rowsInCache: [],
|
|
1245
|
+
rowsNotInCache: []
|
|
1246
|
+
};
|
|
1247
|
+
const result = columnMap.search([rangeStartRow, rangeEndRow]);
|
|
1248
|
+
if (result.length === 0) return {
|
|
1249
|
+
rowsInCache: [],
|
|
1250
|
+
rowsNotInCache: []
|
|
1251
|
+
};
|
|
1252
|
+
result.sort((a, b) => a[0] - b[0]);
|
|
1253
|
+
const rowsInCache = [];
|
|
1254
|
+
const rowsNotInCache = [];
|
|
1255
|
+
let _rangeStartRow = rangeStartRow;
|
|
1256
|
+
for (let i = 0; i < result.length; i++) {
|
|
1257
|
+
const [start, end] = result[i];
|
|
1258
|
+
if (_rangeStartRow >= start) {
|
|
1259
|
+
if (rangeEndRow <= end) {
|
|
1260
|
+
rowsInCache.push([_rangeStartRow, rangeEndRow]);
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
rowsInCache.push([_rangeStartRow, end]);
|
|
1264
|
+
_rangeStartRow = end + 1;
|
|
1265
|
+
if (i === result.length - 1 && _rangeStartRow <= rangeEndRow) rowsNotInCache.push([_rangeStartRow, rangeEndRow]);
|
|
1266
|
+
} else {
|
|
1267
|
+
if (rangeEndRow > end) {
|
|
1268
|
+
rowsInCache.push([start, end]);
|
|
1269
|
+
rowsNotInCache.push([_rangeStartRow, start - 1]);
|
|
1270
|
+
_rangeStartRow = end + 1;
|
|
1271
|
+
if (i === result.length - 1 && _rangeStartRow <= rangeEndRow) rowsNotInCache.push([_rangeStartRow, rangeEndRow]);
|
|
1272
|
+
continue;
|
|
1273
|
+
}
|
|
1274
|
+
rowsInCache.push([start, rangeEndRow]);
|
|
1275
|
+
rowsNotInCache.push([_rangeStartRow, start - 1]);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
return {
|
|
1279
|
+
rowsInCache,
|
|
1280
|
+
rowsNotInCache
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
clear() {
|
|
1284
|
+
this._cache.clear();
|
|
1285
|
+
this._continueBuildingCache.clear();
|
|
1286
|
+
normalizedValueMap.clear();
|
|
1287
|
+
}
|
|
1288
|
+
_handleNewInterval(columnMap, startRow, endRow) {
|
|
1289
|
+
let result = columnMap.search([startRow, endRow]);
|
|
1290
|
+
if (result.length === 0) {
|
|
1291
|
+
const adjacentRange = [startRow - 1 < 0 ? 0 : startRow - 1, endRow + 1];
|
|
1292
|
+
result = columnMap.search(adjacentRange);
|
|
1293
|
+
if (result.length === 0) {
|
|
1294
|
+
columnMap.insert([startRow, endRow]);
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
let min = startRow;
|
|
1299
|
+
let max = endRow;
|
|
1300
|
+
for (const interval of result) {
|
|
1301
|
+
min = Math.min(min, interval[0]);
|
|
1302
|
+
max = Math.max(max, interval[1]);
|
|
1303
|
+
columnMap.remove(interval);
|
|
1304
|
+
}
|
|
1305
|
+
columnMap.insert([min, max]);
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
const CELL_INVERTED_INDEX_CACHE = new InvertedIndexCache();
|
|
1309
|
+
|
|
1135
1310
|
//#endregion
|
|
1136
1311
|
//#region src/basics/match-token.ts
|
|
1137
1312
|
/**
|
|
@@ -2166,159 +2341,986 @@ const SetSuperTableOptionMutation = {
|
|
|
2166
2341
|
//#endregion
|
|
2167
2342
|
//#region src/config/config.ts
|
|
2168
2343
|
const ENGINE_FORMULA_PLUGIN_CONFIG_KEY = "engine-formula.config";
|
|
2344
|
+
const DEFAULT_CYCLE_REFERENCE_COUNT = 1;
|
|
2169
2345
|
const ENGINE_FORMULA_CYCLE_REFERENCE_COUNT = "CYCLE_REFERENCE_COUNT";
|
|
2170
2346
|
const ENGINE_FORMULA_RETURN_DEPENDENCY_TREE = "RETURN_DEPENDENCY_TREE";
|
|
2171
2347
|
const configSymbol = Symbol(ENGINE_FORMULA_PLUGIN_CONFIG_KEY);
|
|
2172
2348
|
const defaultPluginConfig = {};
|
|
2173
2349
|
|
|
2174
2350
|
//#endregion
|
|
2175
|
-
//#region src/
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2351
|
+
//#region src/functions/date/function-names.ts
|
|
2352
|
+
/**
|
|
2353
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2354
|
+
*
|
|
2355
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2356
|
+
* you may not use this file except in compliance with the License.
|
|
2357
|
+
* You may obtain a copy of the License at
|
|
2358
|
+
*
|
|
2359
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2360
|
+
*
|
|
2361
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2362
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2363
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2364
|
+
* See the License for the specific language governing permissions and
|
|
2365
|
+
* limitations under the License.
|
|
2366
|
+
*/
|
|
2367
|
+
let FUNCTION_NAMES_DATE = /* @__PURE__ */ function(FUNCTION_NAMES_DATE) {
|
|
2368
|
+
FUNCTION_NAMES_DATE["DATE"] = "DATE";
|
|
2369
|
+
FUNCTION_NAMES_DATE["DATEDIF"] = "DATEDIF";
|
|
2370
|
+
FUNCTION_NAMES_DATE["DATEVALUE"] = "DATEVALUE";
|
|
2371
|
+
FUNCTION_NAMES_DATE["DAY"] = "DAY";
|
|
2372
|
+
FUNCTION_NAMES_DATE["DAYS"] = "DAYS";
|
|
2373
|
+
FUNCTION_NAMES_DATE["DAYS360"] = "DAYS360";
|
|
2374
|
+
FUNCTION_NAMES_DATE["EDATE"] = "EDATE";
|
|
2375
|
+
FUNCTION_NAMES_DATE["EOMONTH"] = "EOMONTH";
|
|
2376
|
+
FUNCTION_NAMES_DATE["EPOCHTODATE"] = "EPOCHTODATE";
|
|
2377
|
+
FUNCTION_NAMES_DATE["HOUR"] = "HOUR";
|
|
2378
|
+
FUNCTION_NAMES_DATE["ISOWEEKNUM"] = "ISOWEEKNUM";
|
|
2379
|
+
FUNCTION_NAMES_DATE["MINUTE"] = "MINUTE";
|
|
2380
|
+
FUNCTION_NAMES_DATE["MONTH"] = "MONTH";
|
|
2381
|
+
FUNCTION_NAMES_DATE["NETWORKDAYS"] = "NETWORKDAYS";
|
|
2382
|
+
FUNCTION_NAMES_DATE["NETWORKDAYS_INTL"] = "NETWORKDAYS.INTL";
|
|
2383
|
+
FUNCTION_NAMES_DATE["NOW"] = "NOW";
|
|
2384
|
+
FUNCTION_NAMES_DATE["SECOND"] = "SECOND";
|
|
2385
|
+
FUNCTION_NAMES_DATE["TIME"] = "TIME";
|
|
2386
|
+
FUNCTION_NAMES_DATE["TIMEVALUE"] = "TIMEVALUE";
|
|
2387
|
+
FUNCTION_NAMES_DATE["TO_DATE"] = "TO_DATE";
|
|
2388
|
+
FUNCTION_NAMES_DATE["TODAY"] = "TODAY";
|
|
2389
|
+
FUNCTION_NAMES_DATE["WEEKDAY"] = "WEEKDAY";
|
|
2390
|
+
FUNCTION_NAMES_DATE["WEEKNUM"] = "WEEKNUM";
|
|
2391
|
+
FUNCTION_NAMES_DATE["WORKDAY"] = "WORKDAY";
|
|
2392
|
+
FUNCTION_NAMES_DATE["WORKDAY_INTL"] = "WORKDAY.INTL";
|
|
2393
|
+
FUNCTION_NAMES_DATE["YEAR"] = "YEAR";
|
|
2394
|
+
FUNCTION_NAMES_DATE["YEARFRAC"] = "YEARFRAC";
|
|
2395
|
+
return FUNCTION_NAMES_DATE;
|
|
2396
|
+
}({});
|
|
2187
2397
|
|
|
2188
2398
|
//#endregion
|
|
2189
|
-
//#region src/
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2399
|
+
//#region src/functions/engineering/function-names.ts
|
|
2400
|
+
/**
|
|
2401
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2402
|
+
*
|
|
2403
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2404
|
+
* you may not use this file except in compliance with the License.
|
|
2405
|
+
* You may obtain a copy of the License at
|
|
2406
|
+
*
|
|
2407
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2408
|
+
*
|
|
2409
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2410
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2411
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2412
|
+
* See the License for the specific language governing permissions and
|
|
2413
|
+
* limitations under the License.
|
|
2414
|
+
*/
|
|
2415
|
+
let FUNCTION_NAMES_ENGINEERING = /* @__PURE__ */ function(FUNCTION_NAMES_ENGINEERING) {
|
|
2416
|
+
FUNCTION_NAMES_ENGINEERING["BESSELI"] = "BESSELI";
|
|
2417
|
+
FUNCTION_NAMES_ENGINEERING["BESSELJ"] = "BESSELJ";
|
|
2418
|
+
FUNCTION_NAMES_ENGINEERING["BESSELK"] = "BESSELK";
|
|
2419
|
+
FUNCTION_NAMES_ENGINEERING["BESSELY"] = "BESSELY";
|
|
2420
|
+
FUNCTION_NAMES_ENGINEERING["BIN2DEC"] = "BIN2DEC";
|
|
2421
|
+
FUNCTION_NAMES_ENGINEERING["BIN2HEX"] = "BIN2HEX";
|
|
2422
|
+
FUNCTION_NAMES_ENGINEERING["BIN2OCT"] = "BIN2OCT";
|
|
2423
|
+
FUNCTION_NAMES_ENGINEERING["BITAND"] = "BITAND";
|
|
2424
|
+
FUNCTION_NAMES_ENGINEERING["BITLSHIFT"] = "BITLSHIFT";
|
|
2425
|
+
FUNCTION_NAMES_ENGINEERING["BITOR"] = "BITOR";
|
|
2426
|
+
FUNCTION_NAMES_ENGINEERING["BITRSHIFT"] = "BITRSHIFT";
|
|
2427
|
+
FUNCTION_NAMES_ENGINEERING["BITXOR"] = "BITXOR";
|
|
2428
|
+
FUNCTION_NAMES_ENGINEERING["COMPLEX"] = "COMPLEX";
|
|
2429
|
+
FUNCTION_NAMES_ENGINEERING["CONVERT"] = "CONVERT";
|
|
2430
|
+
FUNCTION_NAMES_ENGINEERING["DEC2BIN"] = "DEC2BIN";
|
|
2431
|
+
FUNCTION_NAMES_ENGINEERING["DEC2HEX"] = "DEC2HEX";
|
|
2432
|
+
FUNCTION_NAMES_ENGINEERING["DEC2OCT"] = "DEC2OCT";
|
|
2433
|
+
FUNCTION_NAMES_ENGINEERING["DELTA"] = "DELTA";
|
|
2434
|
+
FUNCTION_NAMES_ENGINEERING["ERF"] = "ERF";
|
|
2435
|
+
FUNCTION_NAMES_ENGINEERING["ERF_PRECISE"] = "ERF.PRECISE";
|
|
2436
|
+
FUNCTION_NAMES_ENGINEERING["ERFC"] = "ERFC";
|
|
2437
|
+
FUNCTION_NAMES_ENGINEERING["ERFC_PRECISE"] = "ERFC.PRECISE";
|
|
2438
|
+
FUNCTION_NAMES_ENGINEERING["GESTEP"] = "GESTEP";
|
|
2439
|
+
FUNCTION_NAMES_ENGINEERING["HEX2BIN"] = "HEX2BIN";
|
|
2440
|
+
FUNCTION_NAMES_ENGINEERING["HEX2DEC"] = "HEX2DEC";
|
|
2441
|
+
FUNCTION_NAMES_ENGINEERING["HEX2OCT"] = "HEX2OCT";
|
|
2442
|
+
FUNCTION_NAMES_ENGINEERING["IMABS"] = "IMABS";
|
|
2443
|
+
FUNCTION_NAMES_ENGINEERING["IMAGINARY"] = "IMAGINARY";
|
|
2444
|
+
FUNCTION_NAMES_ENGINEERING["IMARGUMENT"] = "IMARGUMENT";
|
|
2445
|
+
FUNCTION_NAMES_ENGINEERING["IMCONJUGATE"] = "IMCONJUGATE";
|
|
2446
|
+
FUNCTION_NAMES_ENGINEERING["IMCOS"] = "IMCOS";
|
|
2447
|
+
FUNCTION_NAMES_ENGINEERING["IMCOSH"] = "IMCOSH";
|
|
2448
|
+
FUNCTION_NAMES_ENGINEERING["IMCOT"] = "IMCOT";
|
|
2449
|
+
FUNCTION_NAMES_ENGINEERING["IMCOTH"] = "IMCOTH";
|
|
2450
|
+
FUNCTION_NAMES_ENGINEERING["IMCSC"] = "IMCSC";
|
|
2451
|
+
FUNCTION_NAMES_ENGINEERING["IMCSCH"] = "IMCSCH";
|
|
2452
|
+
FUNCTION_NAMES_ENGINEERING["IMDIV"] = "IMDIV";
|
|
2453
|
+
FUNCTION_NAMES_ENGINEERING["IMEXP"] = "IMEXP";
|
|
2454
|
+
FUNCTION_NAMES_ENGINEERING["IMLN"] = "IMLN";
|
|
2455
|
+
FUNCTION_NAMES_ENGINEERING["IMLOG"] = "IMLOG";
|
|
2456
|
+
FUNCTION_NAMES_ENGINEERING["IMLOG10"] = "IMLOG10";
|
|
2457
|
+
FUNCTION_NAMES_ENGINEERING["IMLOG2"] = "IMLOG2";
|
|
2458
|
+
FUNCTION_NAMES_ENGINEERING["IMPOWER"] = "IMPOWER";
|
|
2459
|
+
FUNCTION_NAMES_ENGINEERING["IMPRODUCT"] = "IMPRODUCT";
|
|
2460
|
+
FUNCTION_NAMES_ENGINEERING["IMREAL"] = "IMREAL";
|
|
2461
|
+
FUNCTION_NAMES_ENGINEERING["IMSEC"] = "IMSEC";
|
|
2462
|
+
FUNCTION_NAMES_ENGINEERING["IMSECH"] = "IMSECH";
|
|
2463
|
+
FUNCTION_NAMES_ENGINEERING["IMSIN"] = "IMSIN";
|
|
2464
|
+
FUNCTION_NAMES_ENGINEERING["IMSINH"] = "IMSINH";
|
|
2465
|
+
FUNCTION_NAMES_ENGINEERING["IMSQRT"] = "IMSQRT";
|
|
2466
|
+
FUNCTION_NAMES_ENGINEERING["IMSUB"] = "IMSUB";
|
|
2467
|
+
FUNCTION_NAMES_ENGINEERING["IMSUM"] = "IMSUM";
|
|
2468
|
+
FUNCTION_NAMES_ENGINEERING["IMTAN"] = "IMTAN";
|
|
2469
|
+
FUNCTION_NAMES_ENGINEERING["IMTANH"] = "IMTANH";
|
|
2470
|
+
FUNCTION_NAMES_ENGINEERING["OCT2BIN"] = "OCT2BIN";
|
|
2471
|
+
FUNCTION_NAMES_ENGINEERING["OCT2DEC"] = "OCT2DEC";
|
|
2472
|
+
FUNCTION_NAMES_ENGINEERING["OCT2HEX"] = "OCT2HEX";
|
|
2473
|
+
return FUNCTION_NAMES_ENGINEERING;
|
|
2200
2474
|
}({});
|
|
2475
|
+
|
|
2476
|
+
//#endregion
|
|
2477
|
+
//#region src/functions/financial/function-names.ts
|
|
2201
2478
|
/**
|
|
2202
|
-
*
|
|
2203
|
-
*
|
|
2204
|
-
*
|
|
2479
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2480
|
+
*
|
|
2481
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2482
|
+
* you may not use this file except in compliance with the License.
|
|
2483
|
+
* You may obtain a copy of the License at
|
|
2484
|
+
*
|
|
2485
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2486
|
+
*
|
|
2487
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2488
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2489
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2490
|
+
* See the License for the specific language governing permissions and
|
|
2491
|
+
* limitations under the License.
|
|
2205
2492
|
*/
|
|
2206
|
-
function
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2493
|
+
let FUNCTION_NAMES_FINANCIAL = /* @__PURE__ */ function(FUNCTION_NAMES_FINANCIAL) {
|
|
2494
|
+
FUNCTION_NAMES_FINANCIAL["ACCRINT"] = "ACCRINT";
|
|
2495
|
+
FUNCTION_NAMES_FINANCIAL["ACCRINTM"] = "ACCRINTM";
|
|
2496
|
+
FUNCTION_NAMES_FINANCIAL["AMORDEGRC"] = "AMORDEGRC";
|
|
2497
|
+
FUNCTION_NAMES_FINANCIAL["AMORLINC"] = "AMORLINC";
|
|
2498
|
+
FUNCTION_NAMES_FINANCIAL["COUPDAYBS"] = "COUPDAYBS";
|
|
2499
|
+
FUNCTION_NAMES_FINANCIAL["COUPDAYS"] = "COUPDAYS";
|
|
2500
|
+
FUNCTION_NAMES_FINANCIAL["COUPDAYSNC"] = "COUPDAYSNC";
|
|
2501
|
+
FUNCTION_NAMES_FINANCIAL["COUPNCD"] = "COUPNCD";
|
|
2502
|
+
FUNCTION_NAMES_FINANCIAL["COUPNUM"] = "COUPNUM";
|
|
2503
|
+
FUNCTION_NAMES_FINANCIAL["COUPPCD"] = "COUPPCD";
|
|
2504
|
+
FUNCTION_NAMES_FINANCIAL["CUMIPMT"] = "CUMIPMT";
|
|
2505
|
+
FUNCTION_NAMES_FINANCIAL["CUMPRINC"] = "CUMPRINC";
|
|
2506
|
+
FUNCTION_NAMES_FINANCIAL["DB"] = "DB";
|
|
2507
|
+
FUNCTION_NAMES_FINANCIAL["DDB"] = "DDB";
|
|
2508
|
+
FUNCTION_NAMES_FINANCIAL["DISC"] = "DISC";
|
|
2509
|
+
FUNCTION_NAMES_FINANCIAL["DOLLARDE"] = "DOLLARDE";
|
|
2510
|
+
FUNCTION_NAMES_FINANCIAL["DOLLARFR"] = "DOLLARFR";
|
|
2511
|
+
FUNCTION_NAMES_FINANCIAL["DURATION"] = "DURATION";
|
|
2512
|
+
FUNCTION_NAMES_FINANCIAL["EFFECT"] = "EFFECT";
|
|
2513
|
+
FUNCTION_NAMES_FINANCIAL["FV"] = "FV";
|
|
2514
|
+
FUNCTION_NAMES_FINANCIAL["FVSCHEDULE"] = "FVSCHEDULE";
|
|
2515
|
+
FUNCTION_NAMES_FINANCIAL["INTRATE"] = "INTRATE";
|
|
2516
|
+
FUNCTION_NAMES_FINANCIAL["IPMT"] = "IPMT";
|
|
2517
|
+
FUNCTION_NAMES_FINANCIAL["IRR"] = "IRR";
|
|
2518
|
+
FUNCTION_NAMES_FINANCIAL["ISPMT"] = "ISPMT";
|
|
2519
|
+
FUNCTION_NAMES_FINANCIAL["MDURATION"] = "MDURATION";
|
|
2520
|
+
FUNCTION_NAMES_FINANCIAL["MIRR"] = "MIRR";
|
|
2521
|
+
FUNCTION_NAMES_FINANCIAL["NOMINAL"] = "NOMINAL";
|
|
2522
|
+
FUNCTION_NAMES_FINANCIAL["NPER"] = "NPER";
|
|
2523
|
+
FUNCTION_NAMES_FINANCIAL["NPV"] = "NPV";
|
|
2524
|
+
FUNCTION_NAMES_FINANCIAL["ODDFPRICE"] = "ODDFPRICE";
|
|
2525
|
+
FUNCTION_NAMES_FINANCIAL["ODDFYIELD"] = "ODDFYIELD";
|
|
2526
|
+
FUNCTION_NAMES_FINANCIAL["ODDLPRICE"] = "ODDLPRICE";
|
|
2527
|
+
FUNCTION_NAMES_FINANCIAL["ODDLYIELD"] = "ODDLYIELD";
|
|
2528
|
+
FUNCTION_NAMES_FINANCIAL["PDURATION"] = "PDURATION";
|
|
2529
|
+
FUNCTION_NAMES_FINANCIAL["PMT"] = "PMT";
|
|
2530
|
+
FUNCTION_NAMES_FINANCIAL["PPMT"] = "PPMT";
|
|
2531
|
+
FUNCTION_NAMES_FINANCIAL["PRICE"] = "PRICE";
|
|
2532
|
+
FUNCTION_NAMES_FINANCIAL["PRICEDISC"] = "PRICEDISC";
|
|
2533
|
+
FUNCTION_NAMES_FINANCIAL["PRICEMAT"] = "PRICEMAT";
|
|
2534
|
+
FUNCTION_NAMES_FINANCIAL["PV"] = "PV";
|
|
2535
|
+
FUNCTION_NAMES_FINANCIAL["RATE"] = "RATE";
|
|
2536
|
+
FUNCTION_NAMES_FINANCIAL["RECEIVED"] = "RECEIVED";
|
|
2537
|
+
FUNCTION_NAMES_FINANCIAL["RRI"] = "RRI";
|
|
2538
|
+
FUNCTION_NAMES_FINANCIAL["SLN"] = "SLN";
|
|
2539
|
+
FUNCTION_NAMES_FINANCIAL["SYD"] = "SYD";
|
|
2540
|
+
FUNCTION_NAMES_FINANCIAL["TBILLEQ"] = "TBILLEQ";
|
|
2541
|
+
FUNCTION_NAMES_FINANCIAL["TBILLPRICE"] = "TBILLPRICE";
|
|
2542
|
+
FUNCTION_NAMES_FINANCIAL["TBILLYIELD"] = "TBILLYIELD";
|
|
2543
|
+
FUNCTION_NAMES_FINANCIAL["VDB"] = "VDB";
|
|
2544
|
+
FUNCTION_NAMES_FINANCIAL["XIRR"] = "XIRR";
|
|
2545
|
+
FUNCTION_NAMES_FINANCIAL["XNPV"] = "XNPV";
|
|
2546
|
+
FUNCTION_NAMES_FINANCIAL["YIELD"] = "YIELD";
|
|
2547
|
+
FUNCTION_NAMES_FINANCIAL["YIELDDISC"] = "YIELDDISC";
|
|
2548
|
+
FUNCTION_NAMES_FINANCIAL["YIELDMAT"] = "YIELDMAT";
|
|
2549
|
+
return FUNCTION_NAMES_FINANCIAL;
|
|
2550
|
+
}({});
|
|
2212
2551
|
|
|
2213
2552
|
//#endregion
|
|
2214
|
-
//#region src/
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2553
|
+
//#region src/functions/information/function-names.ts
|
|
2554
|
+
/**
|
|
2555
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2556
|
+
*
|
|
2557
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2558
|
+
* you may not use this file except in compliance with the License.
|
|
2559
|
+
* You may obtain a copy of the License at
|
|
2560
|
+
*
|
|
2561
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2562
|
+
*
|
|
2563
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2564
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2565
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2566
|
+
* See the License for the specific language governing permissions and
|
|
2567
|
+
* limitations under the License.
|
|
2568
|
+
*/
|
|
2569
|
+
let FUNCTION_NAMES_INFORMATION = /* @__PURE__ */ function(FUNCTION_NAMES_INFORMATION) {
|
|
2570
|
+
FUNCTION_NAMES_INFORMATION["CELL"] = "CELL";
|
|
2571
|
+
FUNCTION_NAMES_INFORMATION["ERROR_TYPE"] = "ERROR.TYPE";
|
|
2572
|
+
FUNCTION_NAMES_INFORMATION["INFO"] = "INFO";
|
|
2573
|
+
FUNCTION_NAMES_INFORMATION["ISBETWEEN"] = "ISBETWEEN";
|
|
2574
|
+
FUNCTION_NAMES_INFORMATION["ISBLANK"] = "ISBLANK";
|
|
2575
|
+
FUNCTION_NAMES_INFORMATION["ISDATE"] = "ISDATE";
|
|
2576
|
+
FUNCTION_NAMES_INFORMATION["ISEMAIL"] = "ISEMAIL";
|
|
2577
|
+
FUNCTION_NAMES_INFORMATION["ISERR"] = "ISERR";
|
|
2578
|
+
FUNCTION_NAMES_INFORMATION["ISERROR"] = "ISERROR";
|
|
2579
|
+
FUNCTION_NAMES_INFORMATION["ISEVEN"] = "ISEVEN";
|
|
2580
|
+
FUNCTION_NAMES_INFORMATION["ISFORMULA"] = "ISFORMULA";
|
|
2581
|
+
FUNCTION_NAMES_INFORMATION["ISLOGICAL"] = "ISLOGICAL";
|
|
2582
|
+
FUNCTION_NAMES_INFORMATION["ISNA"] = "ISNA";
|
|
2583
|
+
FUNCTION_NAMES_INFORMATION["ISNONTEXT"] = "ISNONTEXT";
|
|
2584
|
+
FUNCTION_NAMES_INFORMATION["ISNUMBER"] = "ISNUMBER";
|
|
2585
|
+
FUNCTION_NAMES_INFORMATION["ISODD"] = "ISODD";
|
|
2586
|
+
FUNCTION_NAMES_INFORMATION["ISOMITTED"] = "ISOMITTED";
|
|
2587
|
+
FUNCTION_NAMES_INFORMATION["ISREF"] = "ISREF";
|
|
2588
|
+
FUNCTION_NAMES_INFORMATION["ISTEXT"] = "ISTEXT";
|
|
2589
|
+
FUNCTION_NAMES_INFORMATION["ISURL"] = "ISURL";
|
|
2590
|
+
FUNCTION_NAMES_INFORMATION["N"] = "N";
|
|
2591
|
+
FUNCTION_NAMES_INFORMATION["NA"] = "NA";
|
|
2592
|
+
FUNCTION_NAMES_INFORMATION["SHEET"] = "SHEET";
|
|
2593
|
+
FUNCTION_NAMES_INFORMATION["SHEETS"] = "SHEETS";
|
|
2594
|
+
FUNCTION_NAMES_INFORMATION["TYPE"] = "TYPE";
|
|
2595
|
+
return FUNCTION_NAMES_INFORMATION;
|
|
2596
|
+
}({});
|
|
2597
|
+
|
|
2598
|
+
//#endregion
|
|
2599
|
+
//#region src/functions/logical/function-names.ts
|
|
2600
|
+
/**
|
|
2601
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2602
|
+
*
|
|
2603
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2604
|
+
* you may not use this file except in compliance with the License.
|
|
2605
|
+
* You may obtain a copy of the License at
|
|
2606
|
+
*
|
|
2607
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2608
|
+
*
|
|
2609
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2610
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2611
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2612
|
+
* See the License for the specific language governing permissions and
|
|
2613
|
+
* limitations under the License.
|
|
2614
|
+
*/
|
|
2615
|
+
let FUNCTION_NAMES_LOGICAL = /* @__PURE__ */ function(FUNCTION_NAMES_LOGICAL) {
|
|
2616
|
+
FUNCTION_NAMES_LOGICAL["AND"] = "AND";
|
|
2617
|
+
FUNCTION_NAMES_LOGICAL["BYCOL"] = "BYCOL";
|
|
2618
|
+
FUNCTION_NAMES_LOGICAL["BYROW"] = "BYROW";
|
|
2619
|
+
FUNCTION_NAMES_LOGICAL["FALSE"] = "FALSE";
|
|
2620
|
+
FUNCTION_NAMES_LOGICAL["IF"] = "IF";
|
|
2621
|
+
FUNCTION_NAMES_LOGICAL["IFERROR"] = "IFERROR";
|
|
2622
|
+
FUNCTION_NAMES_LOGICAL["IFNA"] = "IFNA";
|
|
2623
|
+
FUNCTION_NAMES_LOGICAL["IFS"] = "IFS";
|
|
2624
|
+
FUNCTION_NAMES_LOGICAL["LAMBDA"] = "LAMBDA";
|
|
2625
|
+
FUNCTION_NAMES_LOGICAL["LET"] = "LET";
|
|
2626
|
+
FUNCTION_NAMES_LOGICAL["MAKEARRAY"] = "MAKEARRAY";
|
|
2627
|
+
FUNCTION_NAMES_LOGICAL["MAP"] = "MAP";
|
|
2628
|
+
FUNCTION_NAMES_LOGICAL["NOT"] = "NOT";
|
|
2629
|
+
FUNCTION_NAMES_LOGICAL["OR"] = "OR";
|
|
2630
|
+
FUNCTION_NAMES_LOGICAL["REDUCE"] = "REDUCE";
|
|
2631
|
+
FUNCTION_NAMES_LOGICAL["SCAN"] = "SCAN";
|
|
2632
|
+
FUNCTION_NAMES_LOGICAL["SWITCH"] = "SWITCH";
|
|
2633
|
+
FUNCTION_NAMES_LOGICAL["TRUE"] = "TRUE";
|
|
2634
|
+
FUNCTION_NAMES_LOGICAL["XOR"] = "XOR";
|
|
2635
|
+
return FUNCTION_NAMES_LOGICAL;
|
|
2636
|
+
}({});
|
|
2637
|
+
|
|
2638
|
+
//#endregion
|
|
2639
|
+
//#region src/functions/lookup/function-names.ts
|
|
2640
|
+
/**
|
|
2641
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2642
|
+
*
|
|
2643
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2644
|
+
* you may not use this file except in compliance with the License.
|
|
2645
|
+
* You may obtain a copy of the License at
|
|
2646
|
+
*
|
|
2647
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2648
|
+
*
|
|
2649
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2650
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2651
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2652
|
+
* See the License for the specific language governing permissions and
|
|
2653
|
+
* limitations under the License.
|
|
2654
|
+
*/
|
|
2655
|
+
let FUNCTION_NAMES_LOOKUP = /* @__PURE__ */ function(FUNCTION_NAMES_LOOKUP) {
|
|
2656
|
+
FUNCTION_NAMES_LOOKUP["ADDRESS"] = "ADDRESS";
|
|
2657
|
+
FUNCTION_NAMES_LOOKUP["AREAS"] = "AREAS";
|
|
2658
|
+
FUNCTION_NAMES_LOOKUP["CHOOSE"] = "CHOOSE";
|
|
2659
|
+
FUNCTION_NAMES_LOOKUP["CHOOSECOLS"] = "CHOOSECOLS";
|
|
2660
|
+
FUNCTION_NAMES_LOOKUP["CHOOSEROWS"] = "CHOOSEROWS";
|
|
2661
|
+
FUNCTION_NAMES_LOOKUP["COLUMN"] = "COLUMN";
|
|
2662
|
+
FUNCTION_NAMES_LOOKUP["COLUMNS"] = "COLUMNS";
|
|
2663
|
+
FUNCTION_NAMES_LOOKUP["DROP"] = "DROP";
|
|
2664
|
+
FUNCTION_NAMES_LOOKUP["EXPAND"] = "EXPAND";
|
|
2665
|
+
FUNCTION_NAMES_LOOKUP["FILTER"] = "FILTER";
|
|
2666
|
+
FUNCTION_NAMES_LOOKUP["FORMULATEXT"] = "FORMULATEXT";
|
|
2667
|
+
FUNCTION_NAMES_LOOKUP["GETPIVOTDATA"] = "GETPIVOTDATA";
|
|
2668
|
+
FUNCTION_NAMES_LOOKUP["HLOOKUP"] = "HLOOKUP";
|
|
2669
|
+
FUNCTION_NAMES_LOOKUP["HSTACK"] = "HSTACK";
|
|
2670
|
+
FUNCTION_NAMES_LOOKUP["HYPERLINK"] = "HYPERLINK";
|
|
2671
|
+
FUNCTION_NAMES_LOOKUP["IMAGE"] = "IMAGE";
|
|
2672
|
+
FUNCTION_NAMES_LOOKUP["INDEX"] = "INDEX";
|
|
2673
|
+
FUNCTION_NAMES_LOOKUP["INDIRECT"] = "INDIRECT";
|
|
2674
|
+
FUNCTION_NAMES_LOOKUP["LOOKUP"] = "LOOKUP";
|
|
2675
|
+
FUNCTION_NAMES_LOOKUP["MATCH"] = "MATCH";
|
|
2676
|
+
FUNCTION_NAMES_LOOKUP["OFFSET"] = "OFFSET";
|
|
2677
|
+
FUNCTION_NAMES_LOOKUP["ROW"] = "ROW";
|
|
2678
|
+
FUNCTION_NAMES_LOOKUP["ROWS"] = "ROWS";
|
|
2679
|
+
FUNCTION_NAMES_LOOKUP["RTD"] = "RTD";
|
|
2680
|
+
FUNCTION_NAMES_LOOKUP["SORT"] = "SORT";
|
|
2681
|
+
FUNCTION_NAMES_LOOKUP["SORTBY"] = "SORTBY";
|
|
2682
|
+
FUNCTION_NAMES_LOOKUP["TAKE"] = "TAKE";
|
|
2683
|
+
FUNCTION_NAMES_LOOKUP["TOCOL"] = "TOCOL";
|
|
2684
|
+
FUNCTION_NAMES_LOOKUP["TOROW"] = "TOROW";
|
|
2685
|
+
FUNCTION_NAMES_LOOKUP["TRANSPOSE"] = "TRANSPOSE";
|
|
2686
|
+
FUNCTION_NAMES_LOOKUP["UNIQUE"] = "UNIQUE";
|
|
2687
|
+
FUNCTION_NAMES_LOOKUP["VLOOKUP"] = "VLOOKUP";
|
|
2688
|
+
FUNCTION_NAMES_LOOKUP["VSTACK"] = "VSTACK";
|
|
2689
|
+
FUNCTION_NAMES_LOOKUP["WRAPCOLS"] = "WRAPCOLS";
|
|
2690
|
+
FUNCTION_NAMES_LOOKUP["WRAPROWS"] = "WRAPROWS";
|
|
2691
|
+
FUNCTION_NAMES_LOOKUP["XLOOKUP"] = "XLOOKUP";
|
|
2692
|
+
FUNCTION_NAMES_LOOKUP["XMATCH"] = "XMATCH";
|
|
2693
|
+
return FUNCTION_NAMES_LOOKUP;
|
|
2694
|
+
}({});
|
|
2695
|
+
|
|
2696
|
+
//#endregion
|
|
2697
|
+
//#region src/functions/math/function-names.ts
|
|
2698
|
+
/**
|
|
2699
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2700
|
+
*
|
|
2701
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2702
|
+
* you may not use this file except in compliance with the License.
|
|
2703
|
+
* You may obtain a copy of the License at
|
|
2704
|
+
*
|
|
2705
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2706
|
+
*
|
|
2707
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2708
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2709
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2710
|
+
* See the License for the specific language governing permissions and
|
|
2711
|
+
* limitations under the License.
|
|
2712
|
+
*/
|
|
2713
|
+
let FUNCTION_NAMES_MATH = /* @__PURE__ */ function(FUNCTION_NAMES_MATH) {
|
|
2714
|
+
FUNCTION_NAMES_MATH["ABS"] = "ABS";
|
|
2715
|
+
FUNCTION_NAMES_MATH["ACOS"] = "ACOS";
|
|
2716
|
+
FUNCTION_NAMES_MATH["ACOSH"] = "ACOSH";
|
|
2717
|
+
FUNCTION_NAMES_MATH["ACOT"] = "ACOT";
|
|
2718
|
+
FUNCTION_NAMES_MATH["ACOTH"] = "ACOTH";
|
|
2719
|
+
FUNCTION_NAMES_MATH["AGGREGATE"] = "AGGREGATE";
|
|
2720
|
+
FUNCTION_NAMES_MATH["ARABIC"] = "ARABIC";
|
|
2721
|
+
FUNCTION_NAMES_MATH["ASIN"] = "ASIN";
|
|
2722
|
+
FUNCTION_NAMES_MATH["ASINH"] = "ASINH";
|
|
2723
|
+
FUNCTION_NAMES_MATH["ATAN"] = "ATAN";
|
|
2724
|
+
FUNCTION_NAMES_MATH["ATAN2"] = "ATAN2";
|
|
2725
|
+
FUNCTION_NAMES_MATH["ATANH"] = "ATANH";
|
|
2726
|
+
FUNCTION_NAMES_MATH["BASE"] = "BASE";
|
|
2727
|
+
FUNCTION_NAMES_MATH["CEILING"] = "CEILING";
|
|
2728
|
+
FUNCTION_NAMES_MATH["CEILING_MATH"] = "CEILING.MATH";
|
|
2729
|
+
FUNCTION_NAMES_MATH["CEILING_PRECISE"] = "CEILING.PRECISE";
|
|
2730
|
+
FUNCTION_NAMES_MATH["COMBIN"] = "COMBIN";
|
|
2731
|
+
FUNCTION_NAMES_MATH["COMBINA"] = "COMBINA";
|
|
2732
|
+
FUNCTION_NAMES_MATH["COS"] = "COS";
|
|
2733
|
+
FUNCTION_NAMES_MATH["COSH"] = "COSH";
|
|
2734
|
+
FUNCTION_NAMES_MATH["COT"] = "COT";
|
|
2735
|
+
FUNCTION_NAMES_MATH["COTH"] = "COTH";
|
|
2736
|
+
FUNCTION_NAMES_MATH["CSC"] = "CSC";
|
|
2737
|
+
FUNCTION_NAMES_MATH["CSCH"] = "CSCH";
|
|
2738
|
+
FUNCTION_NAMES_MATH["DECIMAL"] = "DECIMAL";
|
|
2739
|
+
FUNCTION_NAMES_MATH["DEGREES"] = "DEGREES";
|
|
2740
|
+
FUNCTION_NAMES_MATH["EVEN"] = "EVEN";
|
|
2741
|
+
FUNCTION_NAMES_MATH["EXP"] = "EXP";
|
|
2742
|
+
FUNCTION_NAMES_MATH["FACT"] = "FACT";
|
|
2743
|
+
FUNCTION_NAMES_MATH["FACTDOUBLE"] = "FACTDOUBLE";
|
|
2744
|
+
FUNCTION_NAMES_MATH["FLOOR"] = "FLOOR";
|
|
2745
|
+
FUNCTION_NAMES_MATH["FLOOR_MATH"] = "FLOOR.MATH";
|
|
2746
|
+
FUNCTION_NAMES_MATH["FLOOR_PRECISE"] = "FLOOR.PRECISE";
|
|
2747
|
+
FUNCTION_NAMES_MATH["GCD"] = "GCD";
|
|
2748
|
+
FUNCTION_NAMES_MATH["INT"] = "INT";
|
|
2749
|
+
FUNCTION_NAMES_MATH["ISO_CEILING"] = "ISO.CEILING";
|
|
2750
|
+
FUNCTION_NAMES_MATH["LCM"] = "LCM";
|
|
2751
|
+
FUNCTION_NAMES_MATH["LET"] = "LET";
|
|
2752
|
+
FUNCTION_NAMES_MATH["LN"] = "LN";
|
|
2753
|
+
FUNCTION_NAMES_MATH["LOG"] = "LOG";
|
|
2754
|
+
FUNCTION_NAMES_MATH["LOG10"] = "LOG10";
|
|
2755
|
+
FUNCTION_NAMES_MATH["MDETERM"] = "MDETERM";
|
|
2756
|
+
FUNCTION_NAMES_MATH["MINVERSE"] = "MINVERSE";
|
|
2757
|
+
FUNCTION_NAMES_MATH["MMULT"] = "MMULT";
|
|
2758
|
+
FUNCTION_NAMES_MATH["MOD"] = "MOD";
|
|
2759
|
+
FUNCTION_NAMES_MATH["MROUND"] = "MROUND";
|
|
2760
|
+
FUNCTION_NAMES_MATH["MULTINOMIAL"] = "MULTINOMIAL";
|
|
2761
|
+
FUNCTION_NAMES_MATH["MUNIT"] = "MUNIT";
|
|
2762
|
+
FUNCTION_NAMES_MATH["ODD"] = "ODD";
|
|
2763
|
+
FUNCTION_NAMES_MATH["PI"] = "PI";
|
|
2764
|
+
FUNCTION_NAMES_MATH["POWER"] = "POWER";
|
|
2765
|
+
FUNCTION_NAMES_MATH["PRODUCT"] = "PRODUCT";
|
|
2766
|
+
FUNCTION_NAMES_MATH["QUOTIENT"] = "QUOTIENT";
|
|
2767
|
+
FUNCTION_NAMES_MATH["RADIANS"] = "RADIANS";
|
|
2768
|
+
FUNCTION_NAMES_MATH["RAND"] = "RAND";
|
|
2769
|
+
FUNCTION_NAMES_MATH["RANDARRAY"] = "RANDARRAY";
|
|
2770
|
+
FUNCTION_NAMES_MATH["RANDBETWEEN"] = "RANDBETWEEN";
|
|
2771
|
+
FUNCTION_NAMES_MATH["ROMAN"] = "ROMAN";
|
|
2772
|
+
FUNCTION_NAMES_MATH["ROUND"] = "ROUND";
|
|
2773
|
+
FUNCTION_NAMES_MATH["ROUNDBANK"] = "ROUNDBANK";
|
|
2774
|
+
FUNCTION_NAMES_MATH["ROUNDDOWN"] = "ROUNDDOWN";
|
|
2775
|
+
FUNCTION_NAMES_MATH["ROUNDUP"] = "ROUNDUP";
|
|
2776
|
+
FUNCTION_NAMES_MATH["SEC"] = "SEC";
|
|
2777
|
+
FUNCTION_NAMES_MATH["SECH"] = "SECH";
|
|
2778
|
+
FUNCTION_NAMES_MATH["SERIESSUM"] = "SERIESSUM";
|
|
2779
|
+
FUNCTION_NAMES_MATH["SEQUENCE"] = "SEQUENCE";
|
|
2780
|
+
FUNCTION_NAMES_MATH["SIGN"] = "SIGN";
|
|
2781
|
+
FUNCTION_NAMES_MATH["SIN"] = "SIN";
|
|
2782
|
+
FUNCTION_NAMES_MATH["SINH"] = "SINH";
|
|
2783
|
+
FUNCTION_NAMES_MATH["SQRT"] = "SQRT";
|
|
2784
|
+
FUNCTION_NAMES_MATH["SQRTPI"] = "SQRTPI";
|
|
2785
|
+
FUNCTION_NAMES_MATH["SUBTOTAL"] = "SUBTOTAL";
|
|
2786
|
+
FUNCTION_NAMES_MATH["SUM"] = "SUM";
|
|
2787
|
+
FUNCTION_NAMES_MATH["SUMIF"] = "SUMIF";
|
|
2788
|
+
FUNCTION_NAMES_MATH["SUMIFS"] = "SUMIFS";
|
|
2789
|
+
FUNCTION_NAMES_MATH["SUMPRODUCT"] = "SUMPRODUCT";
|
|
2790
|
+
FUNCTION_NAMES_MATH["SUMSQ"] = "SUMSQ";
|
|
2791
|
+
FUNCTION_NAMES_MATH["SUMX2MY2"] = "SUMX2MY2";
|
|
2792
|
+
FUNCTION_NAMES_MATH["SUMX2PY2"] = "SUMX2PY2";
|
|
2793
|
+
FUNCTION_NAMES_MATH["SUMXMY2"] = "SUMXMY2";
|
|
2794
|
+
FUNCTION_NAMES_MATH["TAN"] = "TAN";
|
|
2795
|
+
FUNCTION_NAMES_MATH["TANH"] = "TANH";
|
|
2796
|
+
FUNCTION_NAMES_MATH["TRUNC"] = "TRUNC";
|
|
2797
|
+
return FUNCTION_NAMES_MATH;
|
|
2798
|
+
}({});
|
|
2799
|
+
|
|
2800
|
+
//#endregion
|
|
2801
|
+
//#region src/functions/statistical/function-names.ts
|
|
2802
|
+
/**
|
|
2803
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2804
|
+
*
|
|
2805
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2806
|
+
* you may not use this file except in compliance with the License.
|
|
2807
|
+
* You may obtain a copy of the License at
|
|
2808
|
+
*
|
|
2809
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2810
|
+
*
|
|
2811
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2812
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2813
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2814
|
+
* See the License for the specific language governing permissions and
|
|
2815
|
+
* limitations under the License.
|
|
2816
|
+
*/
|
|
2817
|
+
let FUNCTION_NAMES_STATISTICAL = /* @__PURE__ */ function(FUNCTION_NAMES_STATISTICAL) {
|
|
2818
|
+
FUNCTION_NAMES_STATISTICAL["AVEDEV"] = "AVEDEV";
|
|
2819
|
+
FUNCTION_NAMES_STATISTICAL["AVERAGE"] = "AVERAGE";
|
|
2820
|
+
FUNCTION_NAMES_STATISTICAL["AVERAGE_WEIGHTED"] = "AVERAGE.WEIGHTED";
|
|
2821
|
+
FUNCTION_NAMES_STATISTICAL["AVERAGEA"] = "AVERAGEA";
|
|
2822
|
+
FUNCTION_NAMES_STATISTICAL["AVERAGEIF"] = "AVERAGEIF";
|
|
2823
|
+
FUNCTION_NAMES_STATISTICAL["AVERAGEIFS"] = "AVERAGEIFS";
|
|
2824
|
+
FUNCTION_NAMES_STATISTICAL["BETA_DIST"] = "BETA.DIST";
|
|
2825
|
+
FUNCTION_NAMES_STATISTICAL["BETA_INV"] = "BETA.INV";
|
|
2826
|
+
FUNCTION_NAMES_STATISTICAL["BINOM_DIST"] = "BINOM.DIST";
|
|
2827
|
+
FUNCTION_NAMES_STATISTICAL["BINOM_DIST_RANGE"] = "BINOM.DIST.RANGE";
|
|
2828
|
+
FUNCTION_NAMES_STATISTICAL["BINOM_INV"] = "BINOM.INV";
|
|
2829
|
+
FUNCTION_NAMES_STATISTICAL["CHISQ_DIST"] = "CHISQ.DIST";
|
|
2830
|
+
FUNCTION_NAMES_STATISTICAL["CHISQ_DIST_RT"] = "CHISQ.DIST.RT";
|
|
2831
|
+
FUNCTION_NAMES_STATISTICAL["CHISQ_INV"] = "CHISQ.INV";
|
|
2832
|
+
FUNCTION_NAMES_STATISTICAL["CHISQ_INV_RT"] = "CHISQ.INV.RT";
|
|
2833
|
+
FUNCTION_NAMES_STATISTICAL["CHISQ_TEST"] = "CHISQ.TEST";
|
|
2834
|
+
FUNCTION_NAMES_STATISTICAL["CONFIDENCE_NORM"] = "CONFIDENCE.NORM";
|
|
2835
|
+
FUNCTION_NAMES_STATISTICAL["CONFIDENCE_T"] = "CONFIDENCE.T";
|
|
2836
|
+
FUNCTION_NAMES_STATISTICAL["CORREL"] = "CORREL";
|
|
2837
|
+
FUNCTION_NAMES_STATISTICAL["COUNT"] = "COUNT";
|
|
2838
|
+
FUNCTION_NAMES_STATISTICAL["COUNTA"] = "COUNTA";
|
|
2839
|
+
FUNCTION_NAMES_STATISTICAL["COUNTBLANK"] = "COUNTBLANK";
|
|
2840
|
+
FUNCTION_NAMES_STATISTICAL["COUNTIF"] = "COUNTIF";
|
|
2841
|
+
FUNCTION_NAMES_STATISTICAL["COUNTIFS"] = "COUNTIFS";
|
|
2842
|
+
FUNCTION_NAMES_STATISTICAL["COVARIANCE_P"] = "COVARIANCE.P";
|
|
2843
|
+
FUNCTION_NAMES_STATISTICAL["COVARIANCE_S"] = "COVARIANCE.S";
|
|
2844
|
+
FUNCTION_NAMES_STATISTICAL["DEVSQ"] = "DEVSQ";
|
|
2845
|
+
FUNCTION_NAMES_STATISTICAL["EXPON_DIST"] = "EXPON.DIST";
|
|
2846
|
+
FUNCTION_NAMES_STATISTICAL["F_DIST"] = "F.DIST";
|
|
2847
|
+
FUNCTION_NAMES_STATISTICAL["F_DIST_RT"] = "F.DIST.RT";
|
|
2848
|
+
FUNCTION_NAMES_STATISTICAL["F_INV"] = "F.INV";
|
|
2849
|
+
FUNCTION_NAMES_STATISTICAL["F_INV_RT"] = "F.INV.RT";
|
|
2850
|
+
FUNCTION_NAMES_STATISTICAL["F_TEST"] = "F.TEST";
|
|
2851
|
+
FUNCTION_NAMES_STATISTICAL["FISHER"] = "FISHER";
|
|
2852
|
+
FUNCTION_NAMES_STATISTICAL["FISHERINV"] = "FISHERINV";
|
|
2853
|
+
FUNCTION_NAMES_STATISTICAL["FORECAST"] = "FORECAST";
|
|
2854
|
+
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS"] = "FORECAST.ETS";
|
|
2855
|
+
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS_CONFINT"] = "FORECAST.ETS.CONFINT";
|
|
2856
|
+
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS_SEASONALITY"] = "FORECAST.ETS.SEASONALITY";
|
|
2857
|
+
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS_STAT"] = "FORECAST.ETS.STAT";
|
|
2858
|
+
FUNCTION_NAMES_STATISTICAL["FORECAST_LINEAR"] = "FORECAST.LINEAR";
|
|
2859
|
+
FUNCTION_NAMES_STATISTICAL["FREQUENCY"] = "FREQUENCY";
|
|
2860
|
+
FUNCTION_NAMES_STATISTICAL["GAMMA"] = "GAMMA";
|
|
2861
|
+
FUNCTION_NAMES_STATISTICAL["GAMMA_DIST"] = "GAMMA.DIST";
|
|
2862
|
+
FUNCTION_NAMES_STATISTICAL["GAMMA_INV"] = "GAMMA.INV";
|
|
2863
|
+
FUNCTION_NAMES_STATISTICAL["GAMMALN"] = "GAMMALN";
|
|
2864
|
+
FUNCTION_NAMES_STATISTICAL["GAMMALN_PRECISE"] = "GAMMALN.PRECISE";
|
|
2865
|
+
FUNCTION_NAMES_STATISTICAL["GAUSS"] = "GAUSS";
|
|
2866
|
+
FUNCTION_NAMES_STATISTICAL["GEOMEAN"] = "GEOMEAN";
|
|
2867
|
+
FUNCTION_NAMES_STATISTICAL["GROWTH"] = "GROWTH";
|
|
2868
|
+
FUNCTION_NAMES_STATISTICAL["HARMEAN"] = "HARMEAN";
|
|
2869
|
+
FUNCTION_NAMES_STATISTICAL["HYPGEOM_DIST"] = "HYPGEOM.DIST";
|
|
2870
|
+
FUNCTION_NAMES_STATISTICAL["INTERCEPT"] = "INTERCEPT";
|
|
2871
|
+
FUNCTION_NAMES_STATISTICAL["KURT"] = "KURT";
|
|
2872
|
+
FUNCTION_NAMES_STATISTICAL["LARGE"] = "LARGE";
|
|
2873
|
+
FUNCTION_NAMES_STATISTICAL["LINEST"] = "LINEST";
|
|
2874
|
+
FUNCTION_NAMES_STATISTICAL["LOGEST"] = "LOGEST";
|
|
2875
|
+
FUNCTION_NAMES_STATISTICAL["LOGNORM_DIST"] = "LOGNORM.DIST";
|
|
2876
|
+
FUNCTION_NAMES_STATISTICAL["LOGNORM_INV"] = "LOGNORM.INV";
|
|
2877
|
+
FUNCTION_NAMES_STATISTICAL["MARGINOFERROR"] = "MARGINOFERROR";
|
|
2878
|
+
FUNCTION_NAMES_STATISTICAL["MAX"] = "MAX";
|
|
2879
|
+
FUNCTION_NAMES_STATISTICAL["MAXA"] = "MAXA";
|
|
2880
|
+
FUNCTION_NAMES_STATISTICAL["MAXIFS"] = "MAXIFS";
|
|
2881
|
+
FUNCTION_NAMES_STATISTICAL["MEDIAN"] = "MEDIAN";
|
|
2882
|
+
FUNCTION_NAMES_STATISTICAL["MIN"] = "MIN";
|
|
2883
|
+
FUNCTION_NAMES_STATISTICAL["MINA"] = "MINA";
|
|
2884
|
+
FUNCTION_NAMES_STATISTICAL["MINIFS"] = "MINIFS";
|
|
2885
|
+
FUNCTION_NAMES_STATISTICAL["MODE_MULT"] = "MODE.MULT";
|
|
2886
|
+
FUNCTION_NAMES_STATISTICAL["MODE_SNGL"] = "MODE.SNGL";
|
|
2887
|
+
FUNCTION_NAMES_STATISTICAL["NEGBINOM_DIST"] = "NEGBINOM.DIST";
|
|
2888
|
+
FUNCTION_NAMES_STATISTICAL["NORM_DIST"] = "NORM.DIST";
|
|
2889
|
+
FUNCTION_NAMES_STATISTICAL["NORM_INV"] = "NORM.INV";
|
|
2890
|
+
FUNCTION_NAMES_STATISTICAL["NORM_S_DIST"] = "NORM.S.DIST";
|
|
2891
|
+
FUNCTION_NAMES_STATISTICAL["NORM_S_INV"] = "NORM.S.INV";
|
|
2892
|
+
FUNCTION_NAMES_STATISTICAL["PEARSON"] = "PEARSON";
|
|
2893
|
+
FUNCTION_NAMES_STATISTICAL["PERCENTILE_EXC"] = "PERCENTILE.EXC";
|
|
2894
|
+
FUNCTION_NAMES_STATISTICAL["PERCENTILE_INC"] = "PERCENTILE.INC";
|
|
2895
|
+
FUNCTION_NAMES_STATISTICAL["PERCENTRANK_EXC"] = "PERCENTRANK.EXC";
|
|
2896
|
+
FUNCTION_NAMES_STATISTICAL["PERCENTRANK_INC"] = "PERCENTRANK.INC";
|
|
2897
|
+
FUNCTION_NAMES_STATISTICAL["PERMUT"] = "PERMUT";
|
|
2898
|
+
FUNCTION_NAMES_STATISTICAL["PERMUTATIONA"] = "PERMUTATIONA";
|
|
2899
|
+
FUNCTION_NAMES_STATISTICAL["PHI"] = "PHI";
|
|
2900
|
+
FUNCTION_NAMES_STATISTICAL["POISSON_DIST"] = "POISSON.DIST";
|
|
2901
|
+
FUNCTION_NAMES_STATISTICAL["PROB"] = "PROB";
|
|
2902
|
+
FUNCTION_NAMES_STATISTICAL["QUARTILE_EXC"] = "QUARTILE.EXC";
|
|
2903
|
+
FUNCTION_NAMES_STATISTICAL["QUARTILE_INC"] = "QUARTILE.INC";
|
|
2904
|
+
FUNCTION_NAMES_STATISTICAL["RANK_AVG"] = "RANK.AVG";
|
|
2905
|
+
FUNCTION_NAMES_STATISTICAL["RANK_EQ"] = "RANK.EQ";
|
|
2906
|
+
FUNCTION_NAMES_STATISTICAL["RSQ"] = "RSQ";
|
|
2907
|
+
FUNCTION_NAMES_STATISTICAL["SKEW"] = "SKEW";
|
|
2908
|
+
FUNCTION_NAMES_STATISTICAL["SKEW_P"] = "SKEW.P";
|
|
2909
|
+
FUNCTION_NAMES_STATISTICAL["SLOPE"] = "SLOPE";
|
|
2910
|
+
FUNCTION_NAMES_STATISTICAL["SMALL"] = "SMALL";
|
|
2911
|
+
FUNCTION_NAMES_STATISTICAL["STANDARDIZE"] = "STANDARDIZE";
|
|
2912
|
+
FUNCTION_NAMES_STATISTICAL["STDEV_P"] = "STDEV.P";
|
|
2913
|
+
FUNCTION_NAMES_STATISTICAL["STDEV_S"] = "STDEV.S";
|
|
2914
|
+
FUNCTION_NAMES_STATISTICAL["STDEVA"] = "STDEVA";
|
|
2915
|
+
FUNCTION_NAMES_STATISTICAL["STDEVPA"] = "STDEVPA";
|
|
2916
|
+
FUNCTION_NAMES_STATISTICAL["STEYX"] = "STEYX";
|
|
2917
|
+
FUNCTION_NAMES_STATISTICAL["T_DIST"] = "T.DIST";
|
|
2918
|
+
FUNCTION_NAMES_STATISTICAL["T_DIST_2T"] = "T.DIST.2T";
|
|
2919
|
+
FUNCTION_NAMES_STATISTICAL["T_DIST_RT"] = "T.DIST.RT";
|
|
2920
|
+
FUNCTION_NAMES_STATISTICAL["T_INV"] = "T.INV";
|
|
2921
|
+
FUNCTION_NAMES_STATISTICAL["T_INV_2T"] = "T.INV.2T";
|
|
2922
|
+
FUNCTION_NAMES_STATISTICAL["T_TEST"] = "T.TEST";
|
|
2923
|
+
FUNCTION_NAMES_STATISTICAL["TREND"] = "TREND";
|
|
2924
|
+
FUNCTION_NAMES_STATISTICAL["TRIMMEAN"] = "TRIMMEAN";
|
|
2925
|
+
FUNCTION_NAMES_STATISTICAL["VAR_P"] = "VAR.P";
|
|
2926
|
+
FUNCTION_NAMES_STATISTICAL["VAR_S"] = "VAR.S";
|
|
2927
|
+
FUNCTION_NAMES_STATISTICAL["VARA"] = "VARA";
|
|
2928
|
+
FUNCTION_NAMES_STATISTICAL["VARPA"] = "VARPA";
|
|
2929
|
+
FUNCTION_NAMES_STATISTICAL["WEIBULL_DIST"] = "WEIBULL.DIST";
|
|
2930
|
+
FUNCTION_NAMES_STATISTICAL["Z_TEST"] = "Z.TEST";
|
|
2931
|
+
return FUNCTION_NAMES_STATISTICAL;
|
|
2932
|
+
}({});
|
|
2933
|
+
|
|
2934
|
+
//#endregion
|
|
2935
|
+
//#region src/functions/text/function-names.ts
|
|
2936
|
+
/**
|
|
2937
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2938
|
+
*
|
|
2939
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2940
|
+
* you may not use this file except in compliance with the License.
|
|
2941
|
+
* You may obtain a copy of the License at
|
|
2942
|
+
*
|
|
2943
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2944
|
+
*
|
|
2945
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2946
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2947
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2948
|
+
* See the License for the specific language governing permissions and
|
|
2949
|
+
* limitations under the License.
|
|
2950
|
+
*/
|
|
2951
|
+
let FUNCTION_NAMES_TEXT = /* @__PURE__ */ function(FUNCTION_NAMES_TEXT) {
|
|
2952
|
+
FUNCTION_NAMES_TEXT["ASC"] = "ASC";
|
|
2953
|
+
FUNCTION_NAMES_TEXT["ARRAYTOTEXT"] = "ARRAYTOTEXT";
|
|
2954
|
+
FUNCTION_NAMES_TEXT["BAHTTEXT"] = "BAHTTEXT";
|
|
2955
|
+
FUNCTION_NAMES_TEXT["CHAR"] = "CHAR";
|
|
2956
|
+
FUNCTION_NAMES_TEXT["CLEAN"] = "CLEAN";
|
|
2957
|
+
FUNCTION_NAMES_TEXT["CODE"] = "CODE";
|
|
2958
|
+
FUNCTION_NAMES_TEXT["CONCAT"] = "CONCAT";
|
|
2959
|
+
FUNCTION_NAMES_TEXT["CONCATENATE"] = "CONCATENATE";
|
|
2960
|
+
FUNCTION_NAMES_TEXT["DBCS"] = "DBCS";
|
|
2961
|
+
FUNCTION_NAMES_TEXT["DOLLAR"] = "DOLLAR";
|
|
2962
|
+
FUNCTION_NAMES_TEXT["EXACT"] = "EXACT";
|
|
2963
|
+
FUNCTION_NAMES_TEXT["FIND"] = "FIND";
|
|
2964
|
+
FUNCTION_NAMES_TEXT["FINDB"] = "FINDB";
|
|
2965
|
+
FUNCTION_NAMES_TEXT["FIXED"] = "FIXED";
|
|
2966
|
+
FUNCTION_NAMES_TEXT["LEFT"] = "LEFT";
|
|
2967
|
+
FUNCTION_NAMES_TEXT["LEFTB"] = "LEFTB";
|
|
2968
|
+
FUNCTION_NAMES_TEXT["LEN"] = "LEN";
|
|
2969
|
+
FUNCTION_NAMES_TEXT["LENB"] = "LENB";
|
|
2970
|
+
FUNCTION_NAMES_TEXT["LOWER"] = "LOWER";
|
|
2971
|
+
FUNCTION_NAMES_TEXT["MID"] = "MID";
|
|
2972
|
+
FUNCTION_NAMES_TEXT["MIDB"] = "MIDB";
|
|
2973
|
+
FUNCTION_NAMES_TEXT["NUMBERSTRING"] = "NUMBERSTRING";
|
|
2974
|
+
FUNCTION_NAMES_TEXT["NUMBERVALUE"] = "NUMBERVALUE";
|
|
2975
|
+
FUNCTION_NAMES_TEXT["PHONETIC"] = "PHONETIC";
|
|
2976
|
+
FUNCTION_NAMES_TEXT["PROPER"] = "PROPER";
|
|
2977
|
+
FUNCTION_NAMES_TEXT["REGEXEXTRACT"] = "REGEXEXTRACT";
|
|
2978
|
+
FUNCTION_NAMES_TEXT["REGEXMATCH"] = "REGEXMATCH";
|
|
2979
|
+
FUNCTION_NAMES_TEXT["REGEXREPLACE"] = "REGEXREPLACE";
|
|
2980
|
+
FUNCTION_NAMES_TEXT["REPLACE"] = "REPLACE";
|
|
2981
|
+
FUNCTION_NAMES_TEXT["REPLACEB"] = "REPLACEB";
|
|
2982
|
+
FUNCTION_NAMES_TEXT["REPT"] = "REPT";
|
|
2983
|
+
FUNCTION_NAMES_TEXT["RIGHT"] = "RIGHT";
|
|
2984
|
+
FUNCTION_NAMES_TEXT["RIGHTB"] = "RIGHTB";
|
|
2985
|
+
FUNCTION_NAMES_TEXT["SEARCH"] = "SEARCH";
|
|
2986
|
+
FUNCTION_NAMES_TEXT["SEARCHB"] = "SEARCHB";
|
|
2987
|
+
FUNCTION_NAMES_TEXT["SUBSTITUTE"] = "SUBSTITUTE";
|
|
2988
|
+
FUNCTION_NAMES_TEXT["T"] = "T";
|
|
2989
|
+
FUNCTION_NAMES_TEXT["TEXT"] = "TEXT";
|
|
2990
|
+
FUNCTION_NAMES_TEXT["TEXTAFTER"] = "TEXTAFTER";
|
|
2991
|
+
FUNCTION_NAMES_TEXT["TEXTBEFORE"] = "TEXTBEFORE";
|
|
2992
|
+
FUNCTION_NAMES_TEXT["TEXTJOIN"] = "TEXTJOIN";
|
|
2993
|
+
FUNCTION_NAMES_TEXT["TEXTSPLIT"] = "TEXTSPLIT";
|
|
2994
|
+
FUNCTION_NAMES_TEXT["TRIM"] = "TRIM";
|
|
2995
|
+
FUNCTION_NAMES_TEXT["UNICHAR"] = "UNICHAR";
|
|
2996
|
+
FUNCTION_NAMES_TEXT["UNICODE"] = "UNICODE";
|
|
2997
|
+
FUNCTION_NAMES_TEXT["UPPER"] = "UPPER";
|
|
2998
|
+
FUNCTION_NAMES_TEXT["VALUE"] = "VALUE";
|
|
2999
|
+
FUNCTION_NAMES_TEXT["VALUETOTEXT"] = "VALUETOTEXT";
|
|
3000
|
+
FUNCTION_NAMES_TEXT["CALL"] = "CALL";
|
|
3001
|
+
FUNCTION_NAMES_TEXT["EUROCONVERT"] = "EUROCONVERT";
|
|
3002
|
+
FUNCTION_NAMES_TEXT["REGISTER_ID"] = "REGISTER.ID";
|
|
3003
|
+
return FUNCTION_NAMES_TEXT;
|
|
3004
|
+
}({});
|
|
3005
|
+
|
|
3006
|
+
//#endregion
|
|
3007
|
+
//#region src/functions/web/function-names.ts
|
|
3008
|
+
/**
|
|
3009
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3010
|
+
*
|
|
3011
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3012
|
+
* you may not use this file except in compliance with the License.
|
|
3013
|
+
* You may obtain a copy of the License at
|
|
3014
|
+
*
|
|
3015
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3016
|
+
*
|
|
3017
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3018
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3019
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3020
|
+
* See the License for the specific language governing permissions and
|
|
3021
|
+
* limitations under the License.
|
|
3022
|
+
*/
|
|
3023
|
+
let FUNCTION_NAMES_WEB = /* @__PURE__ */ function(FUNCTION_NAMES_WEB) {
|
|
3024
|
+
FUNCTION_NAMES_WEB["ENCODEURL"] = "ENCODEURL";
|
|
3025
|
+
FUNCTION_NAMES_WEB["FILTERXML"] = "FILTERXML";
|
|
3026
|
+
FUNCTION_NAMES_WEB["WEBSERVICE"] = "WEBSERVICE";
|
|
3027
|
+
return FUNCTION_NAMES_WEB;
|
|
3028
|
+
}({});
|
|
3029
|
+
|
|
3030
|
+
//#endregion
|
|
3031
|
+
//#region src/functions/new-excel-functions.ts
|
|
3032
|
+
const NEW_EXCEL_FUNCTIONS = new Set([
|
|
3033
|
+
"ACOT",
|
|
3034
|
+
"ACOTH",
|
|
3035
|
+
"ARABIC",
|
|
3036
|
+
"BASE",
|
|
3037
|
+
"CEILING.MATH",
|
|
3038
|
+
"CEILING.PRECISE",
|
|
3039
|
+
"COMBINA",
|
|
3040
|
+
"COT",
|
|
3041
|
+
"COTH",
|
|
3042
|
+
"CSC",
|
|
3043
|
+
"CSCH",
|
|
3044
|
+
"DECIMAL",
|
|
3045
|
+
"FLOOR.MATH",
|
|
3046
|
+
"FLOOR.PRECISE",
|
|
3047
|
+
"MUNIT",
|
|
3048
|
+
"RANDARRAY",
|
|
3049
|
+
"SEC",
|
|
3050
|
+
"SECH",
|
|
3051
|
+
"SEQUENCE",
|
|
3052
|
+
"CHOOSECOLS",
|
|
3053
|
+
"CHOOSEROWS",
|
|
3054
|
+
"DROP",
|
|
3055
|
+
"EXPAND",
|
|
3056
|
+
"FILTER",
|
|
3057
|
+
"FORMULATEXT",
|
|
3058
|
+
"HSTACK",
|
|
3059
|
+
"SORT",
|
|
3060
|
+
"SORTBY",
|
|
3061
|
+
"TAKE",
|
|
3062
|
+
"TOCOL",
|
|
3063
|
+
"TOROW",
|
|
3064
|
+
"UNIQUE",
|
|
3065
|
+
"VSTACK",
|
|
3066
|
+
"WRAPCOLS",
|
|
3067
|
+
"WRAPROWS",
|
|
3068
|
+
"XLOOKUP",
|
|
3069
|
+
"XMATCH",
|
|
3070
|
+
"BITAND",
|
|
3071
|
+
"BITLSHIFT",
|
|
3072
|
+
"BITOR",
|
|
3073
|
+
"BITRSHIFT",
|
|
3074
|
+
"BITXOR",
|
|
3075
|
+
"ERF.PRECISE",
|
|
3076
|
+
"ERFC.PRECISE",
|
|
3077
|
+
"IMCOSH",
|
|
3078
|
+
"IMCOT",
|
|
3079
|
+
"IMCSC",
|
|
3080
|
+
"IMCSCH",
|
|
3081
|
+
"IMSEC",
|
|
3082
|
+
"IMSECH",
|
|
3083
|
+
"IMSINH",
|
|
3084
|
+
"IMTAN",
|
|
3085
|
+
"ISFORMULA",
|
|
3086
|
+
"SHEET",
|
|
3087
|
+
"SHEETS",
|
|
3088
|
+
"IFNA",
|
|
3089
|
+
"IFS",
|
|
3090
|
+
"SWITCH",
|
|
3091
|
+
"XOR",
|
|
3092
|
+
"BETA.DIST",
|
|
3093
|
+
"BETA.INV",
|
|
3094
|
+
"BINOM.DIST",
|
|
3095
|
+
"BINOM.DIST.RANGE",
|
|
3096
|
+
"BINOM.INV",
|
|
3097
|
+
"CHISQ.DIST",
|
|
3098
|
+
"CHISQ.DIST.RT",
|
|
3099
|
+
"CHISQ.INV",
|
|
3100
|
+
"CHISQ.INV.RT",
|
|
3101
|
+
"CHISQ.TEST",
|
|
3102
|
+
"CONFIDENCE.NORM",
|
|
3103
|
+
"CONFIDENCE.T",
|
|
3104
|
+
"COVARIANCE.P",
|
|
3105
|
+
"COVARIANCE.S",
|
|
3106
|
+
"EXPON.DIST",
|
|
3107
|
+
"F.DIST",
|
|
3108
|
+
"F.DIST.RT",
|
|
3109
|
+
"F.INV",
|
|
3110
|
+
"F.INV.RT",
|
|
3111
|
+
"F.TEST",
|
|
3112
|
+
"FORECAST.LINEAR",
|
|
3113
|
+
"GAMMA",
|
|
3114
|
+
"GAMMA.DIST",
|
|
3115
|
+
"GAMMA.INV",
|
|
3116
|
+
"GAMMALN.PRECISE",
|
|
3117
|
+
"GAUSS",
|
|
3118
|
+
"HYPGEOM.DIST",
|
|
3119
|
+
"LOGNORM.DIST",
|
|
3120
|
+
"LOGNORM.INV",
|
|
3121
|
+
"MAXIFS",
|
|
3122
|
+
"MINIFS",
|
|
3123
|
+
"MODE.MULT",
|
|
3124
|
+
"MODE.SNGL",
|
|
3125
|
+
"NEGBINOM.DIST",
|
|
3126
|
+
"NORM.DIST",
|
|
3127
|
+
"NORM.INV",
|
|
3128
|
+
"NORM.S.DIST",
|
|
3129
|
+
"NORM.S.INV",
|
|
3130
|
+
"PERCENTILE.EXC",
|
|
3131
|
+
"PERCENTILE.INC",
|
|
3132
|
+
"PERCENTRANK.EXC",
|
|
3133
|
+
"PERCENTRANK.INC",
|
|
3134
|
+
"PERMUTATIONA",
|
|
3135
|
+
"PHI",
|
|
3136
|
+
"POISSON.DIST",
|
|
3137
|
+
"QUARTILE.EXC",
|
|
3138
|
+
"QUARTILE.INC",
|
|
3139
|
+
"RANK.AVG",
|
|
3140
|
+
"RANK.EQ",
|
|
3141
|
+
"SKEW.P",
|
|
3142
|
+
"STDEV.P",
|
|
3143
|
+
"STDEV.S",
|
|
3144
|
+
"T.DIST",
|
|
3145
|
+
"T.DIST.2T",
|
|
3146
|
+
"T.DIST.RT",
|
|
3147
|
+
"T.INV",
|
|
3148
|
+
"T.INV.2T",
|
|
3149
|
+
"T.TEST",
|
|
3150
|
+
"VAR.P",
|
|
3151
|
+
"VAR.S",
|
|
3152
|
+
"WEIBULL.DIST",
|
|
3153
|
+
"Z.TEST",
|
|
3154
|
+
"ARRAYTOTEXT",
|
|
3155
|
+
"ENCODEURL",
|
|
3156
|
+
"NUMBERVALUE",
|
|
3157
|
+
"TEXTAFTER",
|
|
3158
|
+
"TEXTBEFORE",
|
|
3159
|
+
"TEXTJOIN",
|
|
3160
|
+
"TEXTSPLIT",
|
|
3161
|
+
"UNICHAR",
|
|
3162
|
+
"UNICODE",
|
|
3163
|
+
"VALUETOTEXT",
|
|
3164
|
+
"DAYS",
|
|
3165
|
+
"ISOWEEKNUM",
|
|
3166
|
+
"PDURATION",
|
|
3167
|
+
"RRI",
|
|
3168
|
+
"BYCOL",
|
|
3169
|
+
"BYROW",
|
|
3170
|
+
"MAKEARRAY",
|
|
3171
|
+
"MAP",
|
|
3172
|
+
"REDUCE",
|
|
3173
|
+
"SCAN"
|
|
3174
|
+
]);
|
|
3175
|
+
|
|
3176
|
+
//#endregion
|
|
3177
|
+
//#region src/engine/utils/reference-cache.ts
|
|
3178
|
+
const referenceToRangeCache = new FormulaAstLRU(1e5);
|
|
3179
|
+
function deserializeRangeWithSheetWithCache(refString) {
|
|
3180
|
+
const refCache = referenceToRangeCache.get(refString);
|
|
3181
|
+
if (refCache) return refCache;
|
|
3182
|
+
const result = deserializeRangeWithSheet(refString);
|
|
3183
|
+
referenceToRangeCache.set(refString, result);
|
|
3184
|
+
return deserializeRangeWithSheet(refString);
|
|
3185
|
+
}
|
|
3186
|
+
function clearReferenceToRangeCache() {
|
|
3187
|
+
referenceToRangeCache.clear();
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
//#endregion
|
|
3191
|
+
//#region src/engine/utils/sequence.ts
|
|
3192
|
+
let sequenceNodeType = /* @__PURE__ */ function(sequenceNodeType) {
|
|
3193
|
+
sequenceNodeType[sequenceNodeType["NORMAL"] = 0] = "NORMAL";
|
|
3194
|
+
sequenceNodeType[sequenceNodeType["NUMBER"] = 1] = "NUMBER";
|
|
3195
|
+
sequenceNodeType[sequenceNodeType["STRING"] = 2] = "STRING";
|
|
3196
|
+
sequenceNodeType[sequenceNodeType["FUNCTION"] = 3] = "FUNCTION";
|
|
3197
|
+
sequenceNodeType[sequenceNodeType["REFERENCE"] = 4] = "REFERENCE";
|
|
3198
|
+
sequenceNodeType[sequenceNodeType["ARRAY"] = 5] = "ARRAY";
|
|
3199
|
+
sequenceNodeType[sequenceNodeType["DEFINED_NAME"] = 6] = "DEFINED_NAME";
|
|
3200
|
+
sequenceNodeType[sequenceNodeType["TABLE"] = 7] = "TABLE";
|
|
3201
|
+
return sequenceNodeType;
|
|
3202
|
+
}({});
|
|
3203
|
+
/**
|
|
3204
|
+
* Deserialize Sequence to text.
|
|
3205
|
+
* @param newSequenceNodes
|
|
3206
|
+
* @returns
|
|
3207
|
+
*/
|
|
3208
|
+
function generateStringWithSequence(newSequenceNodes) {
|
|
3209
|
+
let sequenceString = "";
|
|
3210
|
+
for (const node of newSequenceNodes) if (typeof node === "string") sequenceString += node;
|
|
3211
|
+
else sequenceString += node.token;
|
|
3212
|
+
return sequenceString;
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
//#endregion
|
|
3216
|
+
//#region src/engine/analysis/lexer-node.ts
|
|
3217
|
+
var LexerNode = class LexerNode {
|
|
3218
|
+
constructor() {
|
|
3219
|
+
_defineProperty(this, "_parent", void 0);
|
|
3220
|
+
_defineProperty(this, "_token", "R_1");
|
|
3221
|
+
_defineProperty(this, "_children", []);
|
|
3222
|
+
_defineProperty(this, "_lambdaId", void 0);
|
|
3223
|
+
_defineProperty(this, "_functionDefinitionPrivacyVar", void 0);
|
|
3224
|
+
_defineProperty(this, "_lambdaParameter", "");
|
|
3225
|
+
_defineProperty(this, "_startIndex", -1);
|
|
3226
|
+
_defineProperty(this, "_endIndex", -1);
|
|
3227
|
+
_defineProperty(this, "_definedNames", []);
|
|
3228
|
+
}
|
|
3229
|
+
dispose() {
|
|
3230
|
+
var _this$_functionDefini;
|
|
3231
|
+
this._children.forEach((node) => {
|
|
3232
|
+
if (!(typeof node === "string")) node.dispose();
|
|
3233
|
+
});
|
|
3234
|
+
(_this$_functionDefini = this._functionDefinitionPrivacyVar) === null || _this$_functionDefini === void 0 || _this$_functionDefini.clear();
|
|
3235
|
+
this._functionDefinitionPrivacyVar = null;
|
|
3236
|
+
this._children = [];
|
|
3237
|
+
this._parent = null;
|
|
3238
|
+
this._definedNames = [];
|
|
3239
|
+
}
|
|
3240
|
+
getDefinedNames() {
|
|
3241
|
+
return this._definedNames;
|
|
3242
|
+
}
|
|
3243
|
+
getStartIndex() {
|
|
3244
|
+
return this._startIndex;
|
|
3245
|
+
}
|
|
3246
|
+
getLambdaId() {
|
|
3247
|
+
return this._lambdaId;
|
|
3248
|
+
}
|
|
3249
|
+
setLambdaId(lambdaId) {
|
|
3250
|
+
this._lambdaId = lambdaId;
|
|
3251
|
+
}
|
|
3252
|
+
getFunctionDefinitionPrivacyVar() {
|
|
3253
|
+
return this._functionDefinitionPrivacyVar;
|
|
3254
|
+
}
|
|
3255
|
+
setLambdaPrivacyVar(lambdaPrivacyVar) {
|
|
3256
|
+
this._functionDefinitionPrivacyVar = lambdaPrivacyVar;
|
|
3257
|
+
}
|
|
3258
|
+
getLambdaParameter() {
|
|
3259
|
+
return this._lambdaParameter;
|
|
3260
|
+
}
|
|
3261
|
+
setLambdaParameter(lambdaParameter) {
|
|
3262
|
+
this._lambdaParameter = lambdaParameter;
|
|
3263
|
+
}
|
|
3264
|
+
getParent() {
|
|
3265
|
+
return this._parent;
|
|
3266
|
+
}
|
|
3267
|
+
setParent(lexerNode) {
|
|
3268
|
+
this._parent = lexerNode;
|
|
3269
|
+
}
|
|
3270
|
+
getChildren() {
|
|
3271
|
+
return this._children;
|
|
3272
|
+
}
|
|
3273
|
+
setChildren(children) {
|
|
3274
|
+
this._children = children;
|
|
3275
|
+
}
|
|
3276
|
+
addChildren(children) {
|
|
3277
|
+
this._children.push(children);
|
|
3278
|
+
}
|
|
3279
|
+
addChildrenFirst(children) {
|
|
3280
|
+
this._children.unshift(children);
|
|
3281
|
+
}
|
|
3282
|
+
getToken() {
|
|
3283
|
+
return this._token;
|
|
3284
|
+
}
|
|
3285
|
+
setToken(token) {
|
|
3286
|
+
this._token = token;
|
|
3287
|
+
}
|
|
3288
|
+
setIndex(st, ed) {
|
|
3289
|
+
this._startIndex = st;
|
|
3290
|
+
this._endIndex = ed;
|
|
3291
|
+
}
|
|
3292
|
+
setDefinedNames(definedNames) {
|
|
3293
|
+
this._definedNames = definedNames;
|
|
3294
|
+
}
|
|
3295
|
+
hasDefinedNames() {
|
|
3296
|
+
return this._definedNames.length > 0;
|
|
3297
|
+
}
|
|
3298
|
+
replaceChild(lexerNode, newLexerNode) {
|
|
3299
|
+
const i = this._getIndexInParent(lexerNode);
|
|
3300
|
+
if (i == null) return;
|
|
3301
|
+
this.getChildren().splice(i, 1, newLexerNode);
|
|
3302
|
+
newLexerNode.setParent(this);
|
|
3303
|
+
}
|
|
3304
|
+
changeToParent(newParentLexerNode) {
|
|
3305
|
+
const parentNode = this.getParent();
|
|
3306
|
+
if (parentNode) parentNode.removeChild(this);
|
|
3307
|
+
this.setParent(newParentLexerNode);
|
|
3308
|
+
newParentLexerNode.getChildren().push(this);
|
|
3309
|
+
}
|
|
3310
|
+
removeChild(lexerNode) {
|
|
3311
|
+
const i = this._getIndexInParent(lexerNode);
|
|
3312
|
+
if (i == null) return;
|
|
3313
|
+
this.getChildren().splice(i, 1);
|
|
3314
|
+
}
|
|
3315
|
+
serialize() {
|
|
3316
|
+
const token = this.getToken();
|
|
3317
|
+
const children = this.getChildren();
|
|
3318
|
+
const childrenSerialization = [];
|
|
3319
|
+
const childrenCount = children.length;
|
|
3320
|
+
for (let i = 0; i < childrenCount; i++) {
|
|
3321
|
+
const item = children[i];
|
|
3322
|
+
if (item instanceof LexerNode) childrenSerialization.push(item.serialize());
|
|
3323
|
+
else childrenSerialization.push(item);
|
|
2322
3324
|
}
|
|
2323
3325
|
return {
|
|
2324
3326
|
token,
|
|
@@ -2355,6 +3357,19 @@ var LexerTreeBuilder = class extends _univerjs_core.Disposable {
|
|
|
2355
3357
|
_defineProperty(this, "_colonState", false);
|
|
2356
3358
|
_defineProperty(this, "_formulaErrorCount", 0);
|
|
2357
3359
|
_defineProperty(this, "_tableBracketState", false);
|
|
3360
|
+
_defineProperty(this, "_hasNewExcelFunction", false);
|
|
3361
|
+
_defineProperty(this, "_lambdaFunctionParameterSet", /* @__PURE__ */ new Set());
|
|
3362
|
+
_defineProperty(this, "_xlpmPrefix", "_xlpm.");
|
|
3363
|
+
_defineProperty(this, "_xlfnPrefix", "_xlfn.");
|
|
3364
|
+
_defineProperty(this, "_currentUnitId", "");
|
|
3365
|
+
}
|
|
3366
|
+
_resetPrefix() {
|
|
3367
|
+
this._xlpmPrefix = "_xlpm.";
|
|
3368
|
+
this._xlfnPrefix = "_xlfn.";
|
|
3369
|
+
}
|
|
3370
|
+
_clearPrefix() {
|
|
3371
|
+
this._xlpmPrefix = "";
|
|
3372
|
+
this._xlfnPrefix = "";
|
|
2358
3373
|
}
|
|
2359
3374
|
dispose() {
|
|
2360
3375
|
this._resetTemp();
|
|
@@ -3479,11 +4494,289 @@ var LexerTreeBuilder = class extends _univerjs_core.Disposable {
|
|
|
3479
4494
|
});
|
|
3480
4495
|
}
|
|
3481
4496
|
getNewFormulaWithPrefix(formulaString, hasFunction) {
|
|
4497
|
+
const lexerNode = this.treeBuilder(formulaString, false);
|
|
4498
|
+
if (!lexerNode || lexerNode === "#VALUE!" || Array.isArray(lexerNode)) return null;
|
|
4499
|
+
const formulaStrings = [];
|
|
4500
|
+
this._hasNewExcelFunction = false;
|
|
4501
|
+
this._generateNewFunctionString(lexerNode, formulaStrings, hasFunction);
|
|
4502
|
+
if (this._hasNewExcelFunction) return `=${formulaStrings.join("")}`;
|
|
3482
4503
|
return null;
|
|
3483
4504
|
}
|
|
4505
|
+
_generateNewFunctionString(lexerNode, formulaStrings, hasFunction) {
|
|
4506
|
+
const token = lexerNode.getToken();
|
|
4507
|
+
const tokenTrim = token.trim();
|
|
4508
|
+
const tokenTrimUpper = tokenTrim.toUpperCase();
|
|
4509
|
+
const tokenForFunction = this._clearFunctionString(tokenTrimUpper);
|
|
4510
|
+
const isFunctionNode = hasFunction(tokenForFunction);
|
|
4511
|
+
let curNodeType = 0;
|
|
4512
|
+
if (token === "R_1") curNodeType = 3;
|
|
4513
|
+
else if (token === "P_1") curNodeType = 4;
|
|
4514
|
+
else if (token === "L_1") curNodeType = 5;
|
|
4515
|
+
else if (NEW_EXCEL_FUNCTIONS.has(tokenForFunction)) {
|
|
4516
|
+
formulaStrings.push(`${this._xlfnPrefix}${tokenTrim}`);
|
|
4517
|
+
this._hasNewExcelFunction = true;
|
|
4518
|
+
} else if (tokenTrimUpper === "LAMBDA") {
|
|
4519
|
+
formulaStrings.push(`${this._xlfnPrefix}${tokenTrim}`);
|
|
4520
|
+
this._hasNewExcelFunction = true;
|
|
4521
|
+
curNodeType = 2;
|
|
4522
|
+
} else if (tokenTrimUpper === "LET") {
|
|
4523
|
+
formulaStrings.push(`${this._xlfnPrefix}${tokenTrim}`);
|
|
4524
|
+
this._hasNewExcelFunction = true;
|
|
4525
|
+
curNodeType = 1;
|
|
4526
|
+
} else if (tokenTrimUpper === ":") curNodeType = 8;
|
|
4527
|
+
else if (SUFFIX_TOKEN_SET.has(tokenTrimUpper)) curNodeType = 7;
|
|
4528
|
+
else if (tokenTrimUpper === "-") {
|
|
4529
|
+
if (this._checkAddBracketForMinus(lexerNode)) curNodeType = 9;
|
|
4530
|
+
formulaStrings.push(token);
|
|
4531
|
+
} else {
|
|
4532
|
+
formulaStrings.push(token);
|
|
4533
|
+
curNodeType = 10;
|
|
4534
|
+
}
|
|
4535
|
+
if (isFunctionNode) {
|
|
4536
|
+
if (curNodeType !== 2 && curNodeType !== 1) curNodeType = 6;
|
|
4537
|
+
formulaStrings.push("(");
|
|
4538
|
+
} else if (curNodeType === 9) formulaStrings.push("(");
|
|
4539
|
+
const children = lexerNode.getChildren();
|
|
4540
|
+
const childrenCount = children.length;
|
|
4541
|
+
if (curNodeType === 2) {
|
|
4542
|
+
const firstChild = children[0];
|
|
4543
|
+
let firstIsInputIndex = 0;
|
|
4544
|
+
if (firstChild instanceof LexerNode) {
|
|
4545
|
+
if (firstChild.getToken() === "L_1") firstIsInputIndex = 1;
|
|
4546
|
+
}
|
|
4547
|
+
for (let i = firstIsInputIndex; i < childrenCount - 1; i++) {
|
|
4548
|
+
const item = children[i];
|
|
4549
|
+
if (item instanceof LexerNode) {
|
|
4550
|
+
const varName = item.getChildren()[0];
|
|
4551
|
+
if (typeof varName === "string") {
|
|
4552
|
+
if (this._lambdaFunctionParameterSet.has(varName)) console.error(`Lambda parameter name "${varName}" is duplicated.`);
|
|
4553
|
+
this._lambdaFunctionParameterSet.add(varName);
|
|
4554
|
+
formulaStrings.push(`${this._xlpmPrefix}${varName}`);
|
|
4555
|
+
this._hasNewExcelFunction = true;
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
formulaStrings.push(",");
|
|
4559
|
+
}
|
|
4560
|
+
this._handleNewFunctionChild(children[childrenCount - 1], formulaStrings, hasFunction);
|
|
4561
|
+
if (firstIsInputIndex === 1) {
|
|
4562
|
+
formulaStrings.push(")");
|
|
4563
|
+
formulaStrings.push("(");
|
|
4564
|
+
this._generateNewFunctionString(firstChild, formulaStrings, hasFunction);
|
|
4565
|
+
formulaStrings.push(")");
|
|
4566
|
+
} else formulaStrings.push(")");
|
|
4567
|
+
return;
|
|
4568
|
+
} else if (curNodeType === 1) {
|
|
4569
|
+
for (let i = 0; i < childrenCount - 1; i++) {
|
|
4570
|
+
const item = children[i];
|
|
4571
|
+
if (item instanceof LexerNode && i % 2 === 0) {
|
|
4572
|
+
const varName = item.getChildren()[0];
|
|
4573
|
+
if (typeof varName === "string") {
|
|
4574
|
+
if (this._lambdaFunctionParameterSet.has(varName)) console.error(`Let variable name "${varName}" is duplicated.`);
|
|
4575
|
+
this._lambdaFunctionParameterSet.add(varName);
|
|
4576
|
+
formulaStrings.push(`${this._xlpmPrefix}${varName}`);
|
|
4577
|
+
this._hasNewExcelFunction = true;
|
|
4578
|
+
formulaStrings.push(",");
|
|
4579
|
+
continue;
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
this._handleNewFunctionChild(item, formulaStrings, hasFunction);
|
|
4583
|
+
if (item instanceof LexerNode) {
|
|
4584
|
+
const nextItem = children[i + 1];
|
|
4585
|
+
if (nextItem && nextItem instanceof LexerNode) formulaStrings.push(",");
|
|
4586
|
+
}
|
|
4587
|
+
}
|
|
4588
|
+
this._handleNewFunctionChild(children[childrenCount - 1], formulaStrings, hasFunction);
|
|
4589
|
+
formulaStrings.push(")");
|
|
4590
|
+
return;
|
|
4591
|
+
} else if (curNodeType === 8) {
|
|
4592
|
+
const firstNode = children[0];
|
|
4593
|
+
const secondNode = children[1];
|
|
4594
|
+
this._handleNewFunctionChild(firstNode, formulaStrings, hasFunction);
|
|
4595
|
+
formulaStrings.push(token);
|
|
4596
|
+
this._handleNewFunctionChild(secondNode, formulaStrings, hasFunction);
|
|
4597
|
+
return;
|
|
4598
|
+
}
|
|
4599
|
+
for (let i = 0; i < childrenCount; i++) {
|
|
4600
|
+
const item = children[i];
|
|
4601
|
+
this._handleNewFunctionChild(item, formulaStrings, hasFunction);
|
|
4602
|
+
if (item instanceof LexerNode) {
|
|
4603
|
+
const nextItem = children[i + 1];
|
|
4604
|
+
if (nextItem && nextItem instanceof LexerNode) formulaStrings.push(",");
|
|
4605
|
+
}
|
|
4606
|
+
}
|
|
4607
|
+
if (curNodeType === 7) formulaStrings.push(token);
|
|
4608
|
+
if (isFunctionNode) formulaStrings.push(")");
|
|
4609
|
+
else if (curNodeType === 9) formulaStrings.push(")");
|
|
4610
|
+
}
|
|
4611
|
+
_handleNewFunctionChild(item, formulaStrings, hasFunction) {
|
|
4612
|
+
if (item instanceof LexerNode) this._generateNewFunctionString(item, formulaStrings, hasFunction);
|
|
4613
|
+
else if (this._lambdaFunctionParameterSet.has(item)) {
|
|
4614
|
+
formulaStrings.push(`${this._xlpmPrefix}${item}`);
|
|
4615
|
+
this._hasNewExcelFunction = true;
|
|
4616
|
+
} else formulaStrings.push(item);
|
|
4617
|
+
}
|
|
4618
|
+
_clearFunctionString(token) {
|
|
4619
|
+
let t = token.trim();
|
|
4620
|
+
if (!t) return t;
|
|
4621
|
+
const firstChar = t[0];
|
|
4622
|
+
if (firstChar === "@" || firstChar === "-" || firstChar === "+") t = t.slice(1);
|
|
4623
|
+
if (!t) return t;
|
|
4624
|
+
const lastChar = t[t.length - 1];
|
|
4625
|
+
if (SUFFIX_TOKEN_SET.has(lastChar)) t = t.slice(0, -1);
|
|
4626
|
+
return t;
|
|
4627
|
+
}
|
|
4628
|
+
_checkAddBracketForMinus(node) {
|
|
4629
|
+
const childrenFirst = node.getChildren()[0];
|
|
4630
|
+
if (!childrenFirst || !(childrenFirst instanceof LexerNode) || node.getChildren().length > 1) return false;
|
|
4631
|
+
const children = childrenFirst.getChildren();
|
|
4632
|
+
const childrenCount = children.length;
|
|
4633
|
+
if (childrenCount === 1) return false;
|
|
4634
|
+
for (let i = 0; i < childrenCount; i++) {
|
|
4635
|
+
const item = children[i];
|
|
4636
|
+
if (!(item instanceof LexerNode) && OPERATOR_TOKEN_SET.has(item)) return true;
|
|
4637
|
+
}
|
|
4638
|
+
return false;
|
|
4639
|
+
}
|
|
3484
4640
|
getFormulaExprTree(formulaString, unitId, hasFunction, getDefinedNameName, getTable) {
|
|
4641
|
+
const lexerNode = this.treeBuilder(formulaString, false);
|
|
4642
|
+
if (!lexerNode || lexerNode === "#VALUE!" || Array.isArray(lexerNode)) return null;
|
|
4643
|
+
this._clearPrefix();
|
|
4644
|
+
this._currentUnitId = unitId;
|
|
4645
|
+
const newNode = this._generateExprTree(lexerNode, hasFunction, getDefinedNameName, getTable);
|
|
4646
|
+
this._currentUnitId = "";
|
|
4647
|
+
this._resetPrefix();
|
|
4648
|
+
return newNode;
|
|
4649
|
+
}
|
|
4650
|
+
_generateExprTree(lexerNodeRoot, hasFunction, getDefinedNameName, getTable) {
|
|
4651
|
+
const newNode = {
|
|
4652
|
+
value: "",
|
|
4653
|
+
children: [],
|
|
4654
|
+
startIndex: 0
|
|
4655
|
+
};
|
|
4656
|
+
let lexerNode = lexerNodeRoot;
|
|
4657
|
+
if (lexerNode instanceof LexerNode && (lexerNode.getToken() === "R_1" || lexerNode.getToken() === "P_1") && lexerNode.getChildren().length === 1) lexerNode = lexerNode.getChildren()[0];
|
|
4658
|
+
if (!(lexerNode instanceof LexerNode)) return this._handleTextNodeForExprTree(lexerNode, getDefinedNameName, getTable);
|
|
4659
|
+
const children = lexerNode.getChildren();
|
|
4660
|
+
const childrenCount = children.length;
|
|
4661
|
+
const formulaStrings = [];
|
|
4662
|
+
this._generateNewFunctionString(lexerNode, formulaStrings, hasFunction);
|
|
4663
|
+
newNode.value = formulaStrings.join("");
|
|
4664
|
+
newNode.startIndex = lexerNode.getStartIndex();
|
|
4665
|
+
const curNodeType = this._getCurNodeTypeForExprTree(lexerNode);
|
|
4666
|
+
if (curNodeType === 2) {
|
|
4667
|
+
const firstChild = children[0];
|
|
4668
|
+
if (firstChild instanceof LexerNode) {
|
|
4669
|
+
if (firstChild.getToken().trim() !== "L_1") return newNode;
|
|
4670
|
+
this._handleLambdaForExprTree(firstChild, newNode, hasFunction, getDefinedNameName, getTable);
|
|
4671
|
+
}
|
|
4672
|
+
return newNode;
|
|
4673
|
+
} else if (curNodeType === 1) {
|
|
4674
|
+
for (let i = 0; i < childrenCount - 1; i++) {
|
|
4675
|
+
const item = children[i];
|
|
4676
|
+
if (item instanceof LexerNode && i % 2 === 1) {
|
|
4677
|
+
const itemChildren = item.getChildren();
|
|
4678
|
+
if (itemChildren.length === 1 && !(itemChildren[0] instanceof LexerNode)) continue;
|
|
4679
|
+
const childNode = this._generateExprTree(item, hasFunction, getDefinedNameName, getTable);
|
|
4680
|
+
childNode && newNode.children.push(childNode);
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
return newNode;
|
|
4684
|
+
} else if (curNodeType === 8) {
|
|
4685
|
+
const firstNode = children[0];
|
|
4686
|
+
if (firstNode instanceof LexerNode) {
|
|
4687
|
+
const firstChildNode = firstNode.getChildren()[0];
|
|
4688
|
+
if (firstChildNode instanceof LexerNode) newNode.startIndex = firstChildNode.getStartIndex();
|
|
4689
|
+
}
|
|
4690
|
+
if (this._checkColonNodeForExprTree(lexerNode)) return newNode;
|
|
4691
|
+
} else if (curNodeType === 7) {
|
|
4692
|
+
const firstNode = children[0];
|
|
4693
|
+
if (firstNode instanceof LexerNode) {
|
|
4694
|
+
const firstChildNode = firstNode.getChildren()[0];
|
|
4695
|
+
if (firstChildNode instanceof LexerNode) newNode.startIndex = firstChildNode.getStartIndex();
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
this._handleChildrenForExprTree(children, curNodeType, newNode, hasFunction, getDefinedNameName, getTable);
|
|
4699
|
+
return newNode;
|
|
4700
|
+
}
|
|
4701
|
+
_handleChildrenForExprTree(children, curNodeType, newNode, hasFunction, getDefinedNameName, getTable) {
|
|
4702
|
+
for (let i = 0; i < children.length; i++) {
|
|
4703
|
+
let item = children[i];
|
|
4704
|
+
if (!(item instanceof LexerNode)) {
|
|
4705
|
+
const childNode = this._handleTextNodeForExprTree(item, getDefinedNameName, getTable);
|
|
4706
|
+
childNode && newNode.children.push(childNode);
|
|
4707
|
+
continue;
|
|
4708
|
+
}
|
|
4709
|
+
const itemChildren = item.getChildren();
|
|
4710
|
+
if (itemChildren.length === 1 && !(itemChildren[0] instanceof LexerNode)) {
|
|
4711
|
+
const itemChild = itemChildren[0];
|
|
4712
|
+
if (!getDefinedNameName(this._currentUnitId, itemChild) && !this._getTableNameFromStructuredRef(itemChild, getTable) && !isReferenceString(itemChild)) continue;
|
|
4713
|
+
}
|
|
4714
|
+
if (curNodeType === 8) {
|
|
4715
|
+
const refNode = itemChildren[0];
|
|
4716
|
+
if (refNode instanceof LexerNode) {
|
|
4717
|
+
if (isReferenceString(refNode.getToken().trim())) continue;
|
|
4718
|
+
item = refNode;
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
const childNode = this._generateExprTree(item, hasFunction, getDefinedNameName, getTable);
|
|
4722
|
+
childNode && newNode.children.push(childNode);
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
_checkColonNodeForExprTree(item) {
|
|
4726
|
+
const itemChildren = item.getChildren();
|
|
4727
|
+
if (itemChildren.length < 2) return false;
|
|
4728
|
+
const firstChild = itemChildren[0];
|
|
4729
|
+
const secondChild = itemChildren[1];
|
|
4730
|
+
if (!(firstChild instanceof LexerNode) || !(secondChild instanceof LexerNode)) return false;
|
|
4731
|
+
const firstGrandChild = firstChild.getChildren()[0];
|
|
4732
|
+
const secondGrandChild = secondChild.getChildren()[0];
|
|
4733
|
+
if (!(firstGrandChild instanceof LexerNode) || !(secondGrandChild instanceof LexerNode)) return false;
|
|
4734
|
+
const firstChildToken = firstGrandChild.getToken().trim();
|
|
4735
|
+
const secondChildToken = secondGrandChild.getToken().trim();
|
|
4736
|
+
if (isReferenceString(`${firstChildToken}${":"}${secondChildToken}`)) return true;
|
|
4737
|
+
return false;
|
|
4738
|
+
}
|
|
4739
|
+
_handleTextNodeForExprTree(item, getDefinedNameName, getTable) {
|
|
4740
|
+
const itemTrim = item.trim();
|
|
4741
|
+
if (itemTrim.startsWith("{") && itemTrim.endsWith("}") || getDefinedNameName(this._currentUnitId, itemTrim) || this._getTableNameFromStructuredRef(itemTrim, getTable) || isReferenceString(itemTrim)) return {
|
|
4742
|
+
value: itemTrim,
|
|
4743
|
+
children: [],
|
|
4744
|
+
startIndex: -1
|
|
4745
|
+
};
|
|
4746
|
+
return null;
|
|
4747
|
+
}
|
|
4748
|
+
_getTableNameFromStructuredRef(token, getTable) {
|
|
4749
|
+
const { tableName } = splitTableStructuredRef(token);
|
|
4750
|
+
if (getTable(this._currentUnitId, tableName)) return tableName;
|
|
3485
4751
|
return null;
|
|
3486
4752
|
}
|
|
4753
|
+
_handleLambdaForExprTree(firstChild, newNode, hasFunction, getDefinedNameName, getTable) {
|
|
4754
|
+
const firstGrandchildren = firstChild.getChildren();
|
|
4755
|
+
for (let i = 0; i < firstGrandchildren.length; i++) {
|
|
4756
|
+
const item = firstGrandchildren[i];
|
|
4757
|
+
if (!(item instanceof LexerNode)) continue;
|
|
4758
|
+
const itemChildren = item.getChildren();
|
|
4759
|
+
if (itemChildren.length === 1 && !(itemChildren[0] instanceof LexerNode)) continue;
|
|
4760
|
+
const childNode = this._generateExprTree(item, hasFunction, getDefinedNameName, getTable);
|
|
4761
|
+
childNode && newNode.children.push(childNode);
|
|
4762
|
+
}
|
|
4763
|
+
}
|
|
4764
|
+
_getCurNodeTypeForExprTree(lexerNode) {
|
|
4765
|
+
const token = lexerNode.getToken();
|
|
4766
|
+
const tokenTrimUpper = token.trim().toUpperCase();
|
|
4767
|
+
let curNodeType = 0;
|
|
4768
|
+
if (token === "R_1") curNodeType = 3;
|
|
4769
|
+
else if (token === "P_1") curNodeType = 4;
|
|
4770
|
+
else if (token === "L_1") curNodeType = 5;
|
|
4771
|
+
else if (tokenTrimUpper === "LAMBDA") curNodeType = 2;
|
|
4772
|
+
else if (tokenTrimUpper === "LET") curNodeType = 1;
|
|
4773
|
+
else if (tokenTrimUpper === ":") curNodeType = 8;
|
|
4774
|
+
else if (SUFFIX_TOKEN_SET.has(tokenTrimUpper)) curNodeType = 7;
|
|
4775
|
+
else if (tokenTrimUpper === "-") {
|
|
4776
|
+
if (this._checkAddBracketForMinus(lexerNode)) curNodeType = 9;
|
|
4777
|
+
} else curNodeType = 10;
|
|
4778
|
+
return curNodeType;
|
|
4779
|
+
}
|
|
3487
4780
|
};
|
|
3488
4781
|
|
|
3489
4782
|
//#endregion
|
|
@@ -3924,7 +5217,7 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
|
|
|
3924
5217
|
const column = Number(columnStr);
|
|
3925
5218
|
const currentCell = sheetInstance.getCellRaw(row, column);
|
|
3926
5219
|
const isFormula = (0, _univerjs_core.isFormulaString)(currentCell === null || currentCell === void 0 ? void 0 : currentCell.f) || (0, _univerjs_core.isFormulaId)(currentCell === null || currentCell === void 0 ? void 0 : currentCell.si);
|
|
3927
|
-
const noValue = (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === void 0 || (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === null || (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === "";
|
|
5220
|
+
const noValue = (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === void 0 || (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === null || (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === "" || (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === 0 || (currentCell === null || currentCell === void 0 ? void 0 : currentCell.v) === "0";
|
|
3928
5221
|
if (!(isFormula && noValue)) continue;
|
|
3929
5222
|
if (!columnRanges[column]) columnRanges[column] = [];
|
|
3930
5223
|
const lastRange = columnRanges[column].slice(-1)[0];
|
|
@@ -4023,181 +5316,6 @@ function initSheetFormulaData(formulaData, unitId, sheetId, cellMatrix) {
|
|
|
4023
5316
|
return { [unitId]: { [sheetId]: newSheetFormulaData } };
|
|
4024
5317
|
}
|
|
4025
5318
|
|
|
4026
|
-
//#endregion
|
|
4027
|
-
//#region src/basics/inverted-index-cache.ts
|
|
4028
|
-
const DEFAULT_EMPTY_CELL_KEY = Symbol("EMPTY_CELL");
|
|
4029
|
-
const normalizedValueMap = /* @__PURE__ */ new Map();
|
|
4030
|
-
function normalizeValue(value) {
|
|
4031
|
-
if (normalizedValueMap.has(value)) return normalizedValueMap.get(value);
|
|
4032
|
-
let _value;
|
|
4033
|
-
if (value === null || value === void 0 || value === "") _value = DEFAULT_EMPTY_CELL_KEY;
|
|
4034
|
-
else if ((0, _univerjs_core.isRealNum)(value) && Number(value).toString() === value.toString()) _value = Number(value) === 0 ? 0 : Number(value);
|
|
4035
|
-
else if (typeof value === "string") _value = value.toLowerCase();
|
|
4036
|
-
else _value = value;
|
|
4037
|
-
normalizedValueMap.set(value, _value);
|
|
4038
|
-
return _value;
|
|
4039
|
-
}
|
|
4040
|
-
var InvertedIndexCache = class {
|
|
4041
|
-
constructor() {
|
|
4042
|
-
_defineProperty(this, "_cache", /* @__PURE__ */ new Map());
|
|
4043
|
-
_defineProperty(this, "_continueBuildingCache", /* @__PURE__ */ new Map());
|
|
4044
|
-
}
|
|
4045
|
-
set(unitId, sheetId, column, value, row, isForceUpdate = false) {
|
|
4046
|
-
if (!this.shouldContinueBuildingCache(unitId, sheetId, column, row) && !isForceUpdate) return;
|
|
4047
|
-
let unitMap = this._cache.get(unitId);
|
|
4048
|
-
if (unitMap == null) {
|
|
4049
|
-
unitMap = /* @__PURE__ */ new Map();
|
|
4050
|
-
this._cache.set(unitId, unitMap);
|
|
4051
|
-
}
|
|
4052
|
-
let sheetMap = unitMap.get(sheetId);
|
|
4053
|
-
if (sheetMap == null) {
|
|
4054
|
-
sheetMap = /* @__PURE__ */ new Map();
|
|
4055
|
-
unitMap.set(sheetId, sheetMap);
|
|
4056
|
-
}
|
|
4057
|
-
let columnMap = sheetMap.get(column);
|
|
4058
|
-
if (columnMap == null) {
|
|
4059
|
-
columnMap = /* @__PURE__ */ new Map();
|
|
4060
|
-
sheetMap.set(column, columnMap);
|
|
4061
|
-
}
|
|
4062
|
-
if (isForceUpdate) {
|
|
4063
|
-
for (const [_, _cellList] of columnMap) if (_cellList.has(row)) {
|
|
4064
|
-
_cellList.delete(row);
|
|
4065
|
-
break;
|
|
4066
|
-
}
|
|
4067
|
-
}
|
|
4068
|
-
const _value = normalizeValue(value);
|
|
4069
|
-
let cellList = columnMap.get(_value);
|
|
4070
|
-
if (cellList == null) {
|
|
4071
|
-
cellList = /* @__PURE__ */ new Set();
|
|
4072
|
-
columnMap.set(_value, cellList);
|
|
4073
|
-
}
|
|
4074
|
-
cellList.add(row);
|
|
4075
|
-
}
|
|
4076
|
-
getCellValuePositions(unitId, sheetId, column) {
|
|
4077
|
-
var _this$_cache$get;
|
|
4078
|
-
return (_this$_cache$get = this._cache.get(unitId)) === null || _this$_cache$get === void 0 || (_this$_cache$get = _this$_cache$get.get(sheetId)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get.get(column);
|
|
4079
|
-
}
|
|
4080
|
-
getCellPositions(unitId, sheetId, column, value, rowsInCache) {
|
|
4081
|
-
var _this$_cache$get2;
|
|
4082
|
-
const columnMap = (_this$_cache$get2 = this._cache.get(unitId)) === null || _this$_cache$get2 === void 0 || (_this$_cache$get2 = _this$_cache$get2.get(sheetId)) === null || _this$_cache$get2 === void 0 ? void 0 : _this$_cache$get2.get(column);
|
|
4083
|
-
if (!columnMap) return;
|
|
4084
|
-
const result = {
|
|
4085
|
-
errorType: null,
|
|
4086
|
-
matchingRows: []
|
|
4087
|
-
};
|
|
4088
|
-
const _value = normalizeValue(value);
|
|
4089
|
-
if (ERROR_TYPE_SET.has(_value)) result.errorType = _value;
|
|
4090
|
-
else if (_value === 0 || _value === DEFAULT_EMPTY_CELL_KEY) {
|
|
4091
|
-
const rows = [];
|
|
4092
|
-
const rowsForZero = columnMap.get(0);
|
|
4093
|
-
if (rowsForZero) rows.push(...rowsForZero);
|
|
4094
|
-
const rowsForEmpty = columnMap.get(DEFAULT_EMPTY_CELL_KEY);
|
|
4095
|
-
if (rowsForEmpty) rows.push(...rowsForEmpty);
|
|
4096
|
-
result.matchingRows = rows.filter((row) => rowsInCache.some(([start, end]) => row >= start && row <= end));
|
|
4097
|
-
} else {
|
|
4098
|
-
var _columnMap$get;
|
|
4099
|
-
result.matchingRows = Array.from((_columnMap$get = columnMap.get(_value)) !== null && _columnMap$get !== void 0 ? _columnMap$get : []).filter((row) => rowsInCache.some(([start, end]) => row >= start && row <= end));
|
|
4100
|
-
}
|
|
4101
|
-
return result;
|
|
4102
|
-
}
|
|
4103
|
-
setContinueBuildingCache(unitId, sheetId, column, startRow, endRow) {
|
|
4104
|
-
if (column === -1 || startRow === -1 || endRow === -1) return;
|
|
4105
|
-
let unitMap = this._continueBuildingCache.get(unitId);
|
|
4106
|
-
if (unitMap == null) {
|
|
4107
|
-
unitMap = /* @__PURE__ */ new Map();
|
|
4108
|
-
this._continueBuildingCache.set(unitId, unitMap);
|
|
4109
|
-
}
|
|
4110
|
-
let sheetMap = unitMap.get(sheetId);
|
|
4111
|
-
if (sheetMap == null) {
|
|
4112
|
-
sheetMap = /* @__PURE__ */ new Map();
|
|
4113
|
-
unitMap.set(sheetId, sheetMap);
|
|
4114
|
-
}
|
|
4115
|
-
let columnMap = sheetMap.get(column);
|
|
4116
|
-
if (columnMap == null) {
|
|
4117
|
-
columnMap = new _flatten_js_interval_tree.default();
|
|
4118
|
-
columnMap.insert([startRow, endRow]);
|
|
4119
|
-
sheetMap.set(column, columnMap);
|
|
4120
|
-
return;
|
|
4121
|
-
}
|
|
4122
|
-
this._handleNewInterval(columnMap, startRow, endRow);
|
|
4123
|
-
}
|
|
4124
|
-
shouldContinueBuildingCache(unitId, sheetId, column, row) {
|
|
4125
|
-
var _this$_continueBuildi;
|
|
4126
|
-
if (column === -1 || row === -1) return false;
|
|
4127
|
-
const columnMap = (_this$_continueBuildi = this._continueBuildingCache.get(unitId)) === null || _this$_continueBuildi === void 0 || (_this$_continueBuildi = _this$_continueBuildi.get(sheetId)) === null || _this$_continueBuildi === void 0 ? void 0 : _this$_continueBuildi.get(column);
|
|
4128
|
-
if (!columnMap) return true;
|
|
4129
|
-
return columnMap.search([row, row]).length === 0;
|
|
4130
|
-
}
|
|
4131
|
-
canUseCache(unitId, sheetId, column, rangeStartRow, rangeEndRow) {
|
|
4132
|
-
var _this$_continueBuildi2;
|
|
4133
|
-
const columnMap = (_this$_continueBuildi2 = this._continueBuildingCache.get(unitId)) === null || _this$_continueBuildi2 === void 0 || (_this$_continueBuildi2 = _this$_continueBuildi2.get(sheetId)) === null || _this$_continueBuildi2 === void 0 ? void 0 : _this$_continueBuildi2.get(column);
|
|
4134
|
-
if (column === -1 || rangeStartRow === -1 || rangeEndRow === -1 || !columnMap) return {
|
|
4135
|
-
rowsInCache: [],
|
|
4136
|
-
rowsNotInCache: []
|
|
4137
|
-
};
|
|
4138
|
-
const result = columnMap.search([rangeStartRow, rangeEndRow]);
|
|
4139
|
-
if (result.length === 0) return {
|
|
4140
|
-
rowsInCache: [],
|
|
4141
|
-
rowsNotInCache: []
|
|
4142
|
-
};
|
|
4143
|
-
result.sort((a, b) => a[0] - b[0]);
|
|
4144
|
-
const rowsInCache = [];
|
|
4145
|
-
const rowsNotInCache = [];
|
|
4146
|
-
let _rangeStartRow = rangeStartRow;
|
|
4147
|
-
for (let i = 0; i < result.length; i++) {
|
|
4148
|
-
const [start, end] = result[i];
|
|
4149
|
-
if (_rangeStartRow >= start) {
|
|
4150
|
-
if (rangeEndRow <= end) {
|
|
4151
|
-
rowsInCache.push([_rangeStartRow, rangeEndRow]);
|
|
4152
|
-
break;
|
|
4153
|
-
}
|
|
4154
|
-
rowsInCache.push([_rangeStartRow, end]);
|
|
4155
|
-
_rangeStartRow = end + 1;
|
|
4156
|
-
if (i === result.length - 1 && _rangeStartRow <= rangeEndRow) rowsNotInCache.push([_rangeStartRow, rangeEndRow]);
|
|
4157
|
-
} else {
|
|
4158
|
-
if (rangeEndRow > end) {
|
|
4159
|
-
rowsInCache.push([start, end]);
|
|
4160
|
-
rowsNotInCache.push([_rangeStartRow, start - 1]);
|
|
4161
|
-
_rangeStartRow = end + 1;
|
|
4162
|
-
if (i === result.length - 1 && _rangeStartRow <= rangeEndRow) rowsNotInCache.push([_rangeStartRow, rangeEndRow]);
|
|
4163
|
-
continue;
|
|
4164
|
-
}
|
|
4165
|
-
rowsInCache.push([start, rangeEndRow]);
|
|
4166
|
-
rowsNotInCache.push([_rangeStartRow, start - 1]);
|
|
4167
|
-
}
|
|
4168
|
-
}
|
|
4169
|
-
return {
|
|
4170
|
-
rowsInCache,
|
|
4171
|
-
rowsNotInCache
|
|
4172
|
-
};
|
|
4173
|
-
}
|
|
4174
|
-
clear() {
|
|
4175
|
-
this._cache.clear();
|
|
4176
|
-
this._continueBuildingCache.clear();
|
|
4177
|
-
normalizedValueMap.clear();
|
|
4178
|
-
}
|
|
4179
|
-
_handleNewInterval(columnMap, startRow, endRow) {
|
|
4180
|
-
let result = columnMap.search([startRow, endRow]);
|
|
4181
|
-
if (result.length === 0) {
|
|
4182
|
-
const adjacentRange = [startRow - 1 < 0 ? 0 : startRow - 1, endRow + 1];
|
|
4183
|
-
result = columnMap.search(adjacentRange);
|
|
4184
|
-
if (result.length === 0) {
|
|
4185
|
-
columnMap.insert([startRow, endRow]);
|
|
4186
|
-
return;
|
|
4187
|
-
}
|
|
4188
|
-
}
|
|
4189
|
-
let min = startRow;
|
|
4190
|
-
let max = endRow;
|
|
4191
|
-
for (const interval of result) {
|
|
4192
|
-
min = Math.min(min, interval[0]);
|
|
4193
|
-
max = Math.max(max, interval[1]);
|
|
4194
|
-
columnMap.remove(interval);
|
|
4195
|
-
}
|
|
4196
|
-
columnMap.insert([min, max]);
|
|
4197
|
-
}
|
|
4198
|
-
};
|
|
4199
|
-
const CELL_INVERTED_INDEX_CACHE = new InvertedIndexCache();
|
|
4200
|
-
|
|
4201
5319
|
//#endregion
|
|
4202
5320
|
//#region src/services/sheet-row-filtered.service.ts
|
|
4203
5321
|
/**
|
|
@@ -8524,949 +9642,269 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
|
|
|
8524
9642
|
completedArrayFormulasCount: this.getCompletedArrayFormulasCount(),
|
|
8525
9643
|
stage: this.getFormulaExecuteStage(),
|
|
8526
9644
|
formulaCycleIndex: this.getFormulaCycleIndex()
|
|
8527
|
-
};
|
|
8528
|
-
}
|
|
8529
|
-
clearArrayObjectCache() {
|
|
8530
|
-
FORMULA_REF_TO_ARRAY_CACHE.clear();
|
|
8531
|
-
}
|
|
8532
|
-
_checkIfArrayFormulaRangeHasData(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, arrayRange) {
|
|
8533
|
-
var _this$_unitArrayFormu;
|
|
8534
|
-
const { startRow, startColumn, endRow, endColumn } = arrayRange;
|
|
8535
|
-
const unitData = this._currentConfigService.getUnitData();
|
|
8536
|
-
const arrayData = this._currentConfigService.getArrayFormulaCellData();
|
|
8537
|
-
(_this$_unitArrayFormu = this._unitArrayFormulaRange[formulaUnitId]) === null || _this$_unitArrayFormu === void 0 || (_this$_unitArrayFormu = _this$_unitArrayFormu[formulaSheetId]) === null || _this$_unitArrayFormu === void 0 || (_this$_unitArrayFormu = _this$_unitArrayFormu[formulaRow]) === null || _this$_unitArrayFormu === void 0 || _this$_unitArrayFormu[formulaColumn];
|
|
8538
|
-
for (let r = startRow; r <= endRow; r++) for (let c = startColumn; c <= endColumn; c++) {
|
|
8539
|
-
var _this$_runtimeData, _arrayData$formulaUni, _unitData$formulaUnit;
|
|
8540
|
-
if (r === formulaRow && formulaColumn === c) continue;
|
|
8541
|
-
const cell = (_this$_runtimeData = this._runtimeData) === null || _this$_runtimeData === void 0 || (_this$_runtimeData = _this$_runtimeData[formulaUnitId]) === null || _this$_runtimeData === void 0 || (_this$_runtimeData = _this$_runtimeData[formulaSheetId]) === null || _this$_runtimeData === void 0 ? void 0 : _this$_runtimeData.getValue(r, c);
|
|
8542
|
-
arrayData === null || arrayData === void 0 || (_arrayData$formulaUni = arrayData[formulaUnitId]) === null || _arrayData$formulaUni === void 0 || (_arrayData$formulaUni = _arrayData$formulaUni[formulaSheetId]) === null || _arrayData$formulaUni === void 0 || _arrayData$formulaUni.getValue(r, c);
|
|
8543
|
-
const currentCell = unitData === null || unitData === void 0 || (_unitData$formulaUnit = unitData[formulaUnitId]) === null || _unitData$formulaUnit === void 0 || (_unitData$formulaUnit = _unitData$formulaUnit[formulaSheetId]) === null || _unitData$formulaUnit === void 0 || (_unitData$formulaUnit = _unitData$formulaUnit.cellData) === null || _unitData$formulaUnit === void 0 ? void 0 : _unitData$formulaUnit.getValue(r, c);
|
|
8544
|
-
const featureCell = this._getRuntimeFeatureCellValue(r, c, formulaSheetId, formulaUnitId);
|
|
8545
|
-
if (!isNullCellForFormula(cell) || this._isInOtherArrayFormulaRange(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, r, c) || !isNullCellForFormula(currentCell) || !isNullCellForFormula(featureCell)) return true;
|
|
8546
|
-
}
|
|
8547
|
-
return false;
|
|
8548
|
-
}
|
|
8549
|
-
_getRuntimeFeatureCellValue(row, column, sheetId, unitId) {
|
|
8550
|
-
return getRuntimeFeatureCell(row, column, sheetId, unitId, this._runtimeFeatureCellData);
|
|
8551
|
-
}
|
|
8552
|
-
_arrayCellHasData(cell) {
|
|
8553
|
-
if (cell === null || cell === void 0) return false;
|
|
8554
|
-
if (cell.v !== void 0) return true;
|
|
8555
|
-
return false;
|
|
8556
|
-
}
|
|
8557
|
-
/**
|
|
8558
|
-
* If the current array formula in the extended area intersects with the existing array formula, a #SPILL! error will be reported. Note that if other array formulas are already #SPILL!, they will not conflict with the current array formula
|
|
8559
|
-
* @param formulaUnitId
|
|
8560
|
-
* @param formulaSheetId
|
|
8561
|
-
* @param formulaRow
|
|
8562
|
-
* @param formulaColumn
|
|
8563
|
-
* @param r
|
|
8564
|
-
* @param c
|
|
8565
|
-
* @returns
|
|
8566
|
-
*/
|
|
8567
|
-
_isInOtherArrayFormulaRange(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, r, c) {
|
|
8568
|
-
var _this$_currentConfigS;
|
|
8569
|
-
const arrayFormulaRange = (_this$_currentConfigS = this._currentConfigService.getArrayFormulaRange()[formulaUnitId]) === null || _this$_currentConfigS === void 0 ? void 0 : _this$_currentConfigS[formulaSheetId];
|
|
8570
|
-
if (arrayFormulaRange == null) return false;
|
|
8571
|
-
let isCellOverlapping = false;
|
|
8572
|
-
new _univerjs_core.ObjectMatrix(arrayFormulaRange).forValue((rangeRow, rangeCol, range) => {
|
|
8573
|
-
var _this$_runtimeData$fo;
|
|
8574
|
-
if (rangeRow === formulaRow && rangeCol === formulaColumn) return;
|
|
8575
|
-
const isOverlapping = this._isInArrayFormulaRange(range, r, c);
|
|
8576
|
-
const cell = (_this$_runtimeData$fo = this._runtimeData[formulaUnitId]) === null || _this$_runtimeData$fo === void 0 || (_this$_runtimeData$fo = _this$_runtimeData$fo[formulaSheetId]) === null || _this$_runtimeData$fo === void 0 ? void 0 : _this$_runtimeData$fo.getValue(rangeRow, rangeCol);
|
|
8577
|
-
if (isOverlapping && (cell === null || cell === void 0 ? void 0 : cell.v) !== "#SPILL!") isCellOverlapping = true;
|
|
8578
|
-
});
|
|
8579
|
-
return isCellOverlapping;
|
|
8580
|
-
}
|
|
8581
|
-
_isInArrayFormulaRange(range, r, c) {
|
|
8582
|
-
if (range == null) return false;
|
|
8583
|
-
const { startRow, startColumn, endRow, endColumn } = range;
|
|
8584
|
-
if (r >= startRow && r <= endRow && c >= startColumn && c <= endColumn) return true;
|
|
8585
|
-
return false;
|
|
8586
|
-
}
|
|
8587
|
-
_checkIfArrayFormulaExceeded(rowCount, columnCount, arrayRange) {
|
|
8588
|
-
if (arrayRange.endRow >= rowCount || arrayRange.endColumn >= columnCount) return true;
|
|
8589
|
-
return false;
|
|
8590
|
-
}
|
|
8591
|
-
_isInDirtyRange(unitId, sheetId, row, column) {
|
|
8592
|
-
const dirtyRanges = this._currentConfigService.getDirtyRanges();
|
|
8593
|
-
if (dirtyRanges.length === 0) return true;
|
|
8594
|
-
return isInDirtyRange(dirtyRanges, unitId, sheetId, row, column);
|
|
8595
|
-
}
|
|
8596
|
-
};
|
|
8597
|
-
FormulaRuntimeService = __decorate([__decorateParam(0, IFormulaCurrentConfigService), __decorateParam(1, IHyperlinkEngineFormulaService)], FormulaRuntimeService);
|
|
8598
|
-
const IFormulaRuntimeService = (0, _univerjs_core.createIdentifier)("univer.formula.runtime.service");
|
|
8599
|
-
|
|
8600
|
-
//#endregion
|
|
8601
|
-
//#region src/engine/ast-node/node-type.ts
|
|
8602
|
-
const NODE_ORDER_MAP = new Map([
|
|
8603
|
-
[1, 7],
|
|
8604
|
-
[2, 9],
|
|
8605
|
-
[3, 8],
|
|
8606
|
-
[4, 6],
|
|
8607
|
-
[5, 1],
|
|
8608
|
-
[6, 2],
|
|
8609
|
-
[9, 10],
|
|
8610
|
-
[10, 3],
|
|
8611
|
-
[11, 4],
|
|
8612
|
-
[12, 5]
|
|
8613
|
-
]);
|
|
8614
|
-
|
|
8615
|
-
//#endregion
|
|
8616
|
-
//#region src/engine/ast-node/base-ast-node.ts
|
|
8617
|
-
var BaseAstNode = class {
|
|
8618
|
-
constructor(_token) {
|
|
8619
|
-
this._token = _token;
|
|
8620
|
-
_defineProperty(this, "_children", []);
|
|
8621
|
-
_defineProperty(this, "_definedNames", void 0);
|
|
8622
|
-
_defineProperty(this, "_parent", void 0);
|
|
8623
|
-
_defineProperty(this, "_valueObject", void 0);
|
|
8624
|
-
_defineProperty(this, "_calculateState", false);
|
|
8625
|
-
_defineProperty(this, "_async", false);
|
|
8626
|
-
_defineProperty(this, "_address", false);
|
|
8627
|
-
_defineProperty(this, "_isForcedCalculateFunction", false);
|
|
8628
|
-
}
|
|
8629
|
-
dispose() {
|
|
8630
|
-
var _this$_valueObject;
|
|
8631
|
-
this._children.forEach((node) => {
|
|
8632
|
-
node.dispose();
|
|
8633
|
-
});
|
|
8634
|
-
(_this$_valueObject = this._valueObject) === null || _this$_valueObject === void 0 || _this$_valueObject.dispose();
|
|
8635
|
-
this._valueObject = null;
|
|
8636
|
-
this._children = [];
|
|
8637
|
-
this._definedNames = null;
|
|
8638
|
-
this._parent = null;
|
|
8639
|
-
}
|
|
8640
|
-
get nodeType() {
|
|
8641
|
-
return 8;
|
|
8642
|
-
}
|
|
8643
|
-
resetCalculationState() {
|
|
8644
|
-
this._children.forEach((node) => {
|
|
8645
|
-
node.resetCalculationState();
|
|
8646
|
-
});
|
|
8647
|
-
this._valueObject = null;
|
|
8648
|
-
this._calculateState = false;
|
|
8649
|
-
}
|
|
8650
|
-
isAsync() {
|
|
8651
|
-
return this._async;
|
|
8652
|
-
}
|
|
8653
|
-
isAddress() {
|
|
8654
|
-
return this._address;
|
|
8655
|
-
}
|
|
8656
|
-
isForcedCalculateFunction() {
|
|
8657
|
-
return this._isForcedCalculateFunction;
|
|
8658
|
-
}
|
|
8659
|
-
setAsync() {
|
|
8660
|
-
this._async = true;
|
|
8661
|
-
}
|
|
8662
|
-
setAddress() {
|
|
8663
|
-
this._address = true;
|
|
8664
|
-
}
|
|
8665
|
-
getParent() {
|
|
8666
|
-
return this._parent;
|
|
8667
|
-
}
|
|
8668
|
-
setParent(node) {
|
|
8669
|
-
this._parent = node;
|
|
8670
|
-
node.addChildren(this);
|
|
8671
|
-
}
|
|
8672
|
-
setForcedCalculateFunction() {
|
|
8673
|
-
this._isForcedCalculateFunction = true;
|
|
8674
|
-
}
|
|
8675
|
-
getChildren() {
|
|
8676
|
-
return this._children;
|
|
8677
|
-
}
|
|
8678
|
-
addChildren(...astNode) {
|
|
8679
|
-
this._children.push(...astNode);
|
|
8680
|
-
}
|
|
8681
|
-
getToken() {
|
|
8682
|
-
return this._token;
|
|
8683
|
-
}
|
|
8684
|
-
setValue(value) {
|
|
8685
|
-
this._valueObject = value;
|
|
8686
|
-
}
|
|
8687
|
-
getValue() {
|
|
8688
|
-
return this._valueObject;
|
|
8689
|
-
}
|
|
8690
|
-
isCalculated() {
|
|
8691
|
-
return this._calculateState;
|
|
8692
|
-
}
|
|
8693
|
-
setCalculated() {
|
|
8694
|
-
this._calculateState = true;
|
|
8695
|
-
}
|
|
8696
|
-
execute() {}
|
|
8697
|
-
setNotEmpty(state = true) {}
|
|
8698
|
-
async executeAsync() {
|
|
8699
|
-
return Promise.resolve(0);
|
|
8700
|
-
}
|
|
8701
|
-
serialize() {
|
|
8702
|
-
const token = this.getToken();
|
|
8703
|
-
const children = this.getChildren();
|
|
8704
|
-
const childrenSerialization = [];
|
|
8705
|
-
const childrenCount = children.length;
|
|
8706
|
-
for (let i = 0; i < childrenCount; i++) {
|
|
8707
|
-
const item = children[i];
|
|
8708
|
-
childrenSerialization.push(item.serialize());
|
|
8709
|
-
}
|
|
8710
|
-
const result = {
|
|
8711
|
-
token,
|
|
8712
|
-
nodeType: this.nodeType
|
|
8713
|
-
};
|
|
8714
|
-
if (childrenCount > 0) result.children = childrenSerialization;
|
|
8715
|
-
return result;
|
|
8716
|
-
}
|
|
8717
|
-
hasDefinedName(definedName) {
|
|
8718
|
-
var _this$_definedNames;
|
|
8719
|
-
return ((_this$_definedNames = this._definedNames) === null || _this$_definedNames === void 0 ? void 0 : _this$_definedNames.includes(definedName)) || false;
|
|
8720
|
-
}
|
|
8721
|
-
setDefinedNames(definedNames) {
|
|
8722
|
-
this._definedNames = definedNames;
|
|
8723
|
-
}
|
|
8724
|
-
getDefinedNames() {
|
|
8725
|
-
return this._definedNames;
|
|
8726
|
-
}
|
|
8727
|
-
};
|
|
8728
|
-
var ErrorNode = class ErrorNode extends BaseAstNode {
|
|
8729
|
-
constructor(errorType) {
|
|
8730
|
-
super(errorType);
|
|
8731
|
-
_defineProperty(this, "_errorValueObject", void 0);
|
|
8732
|
-
this._errorValueObject = ErrorValueObject.create(errorType);
|
|
8733
|
-
}
|
|
8734
|
-
get nodeType() {
|
|
8735
|
-
return 7;
|
|
8736
|
-
}
|
|
8737
|
-
static create(errorType) {
|
|
8738
|
-
return new ErrorNode(errorType);
|
|
8739
|
-
}
|
|
8740
|
-
getValue() {
|
|
8741
|
-
return this._errorValueObject;
|
|
8742
|
-
}
|
|
8743
|
-
};
|
|
8744
|
-
|
|
8745
|
-
//#endregion
|
|
8746
|
-
//#region src/engine/ast-node/base-ast-node-factory.ts
|
|
8747
|
-
var BaseAstNodeFactory = class {
|
|
8748
|
-
get zIndex() {
|
|
8749
|
-
return 0;
|
|
8750
|
-
}
|
|
8751
|
-
dispose() {}
|
|
8752
|
-
create(param, currentRow, currentColumn) {
|
|
8753
|
-
let token;
|
|
8754
|
-
if (param instanceof LexerNode) token = param.getToken();
|
|
8755
|
-
else token = param;
|
|
8756
|
-
return new BaseAstNode(token);
|
|
9645
|
+
};
|
|
8757
9646
|
}
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
//#endregion
|
|
8761
|
-
//#region src/engine/ast-node/ast-root-node.ts
|
|
8762
|
-
var AstRootNode = class extends BaseAstNode {
|
|
8763
|
-
get nodeType() {
|
|
8764
|
-
return 9;
|
|
9647
|
+
clearArrayObjectCache() {
|
|
9648
|
+
FORMULA_REF_TO_ARRAY_CACHE.clear();
|
|
8765
9649
|
}
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
9650
|
+
_checkIfArrayFormulaRangeHasData(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, arrayRange) {
|
|
9651
|
+
var _this$_unitArrayFormu;
|
|
9652
|
+
const { startRow, startColumn, endRow, endColumn } = arrayRange;
|
|
9653
|
+
const unitData = this._currentConfigService.getUnitData();
|
|
9654
|
+
const arrayData = this._currentConfigService.getArrayFormulaCellData();
|
|
9655
|
+
(_this$_unitArrayFormu = this._unitArrayFormulaRange[formulaUnitId]) === null || _this$_unitArrayFormu === void 0 || (_this$_unitArrayFormu = _this$_unitArrayFormu[formulaSheetId]) === null || _this$_unitArrayFormu === void 0 || (_this$_unitArrayFormu = _this$_unitArrayFormu[formulaRow]) === null || _this$_unitArrayFormu === void 0 || _this$_unitArrayFormu[formulaColumn];
|
|
9656
|
+
for (let r = startRow; r <= endRow; r++) for (let c = startColumn; c <= endColumn; c++) {
|
|
9657
|
+
var _this$_runtimeData, _arrayData$formulaUni, _unitData$formulaUnit;
|
|
9658
|
+
if (r === formulaRow && formulaColumn === c) continue;
|
|
9659
|
+
const cell = (_this$_runtimeData = this._runtimeData) === null || _this$_runtimeData === void 0 || (_this$_runtimeData = _this$_runtimeData[formulaUnitId]) === null || _this$_runtimeData === void 0 || (_this$_runtimeData = _this$_runtimeData[formulaSheetId]) === null || _this$_runtimeData === void 0 ? void 0 : _this$_runtimeData.getValue(r, c);
|
|
9660
|
+
arrayData === null || arrayData === void 0 || (_arrayData$formulaUni = arrayData[formulaUnitId]) === null || _arrayData$formulaUni === void 0 || (_arrayData$formulaUni = _arrayData$formulaUni[formulaSheetId]) === null || _arrayData$formulaUni === void 0 || _arrayData$formulaUni.getValue(r, c);
|
|
9661
|
+
const currentCell = unitData === null || unitData === void 0 || (_unitData$formulaUnit = unitData[formulaUnitId]) === null || _unitData$formulaUnit === void 0 || (_unitData$formulaUnit = _unitData$formulaUnit[formulaSheetId]) === null || _unitData$formulaUnit === void 0 || (_unitData$formulaUnit = _unitData$formulaUnit.cellData) === null || _unitData$formulaUnit === void 0 ? void 0 : _unitData$formulaUnit.getValue(r, c);
|
|
9662
|
+
const featureCell = this._getRuntimeFeatureCellValue(r, c, formulaSheetId, formulaUnitId);
|
|
9663
|
+
if (!isNullCellForFormula(cell) || this._isInOtherArrayFormulaRange(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, r, c) || !isNullCellForFormula(currentCell) || !isNullCellForFormula(featureCell)) return true;
|
|
8771
9664
|
}
|
|
8772
|
-
|
|
8773
|
-
if (node == null)
|
|
8774
|
-
/**
|
|
8775
|
-
* fix: https://github.com/dream-num/univer/issues/1415
|
|
8776
|
-
*/
|
|
8777
|
-
this.setValue(ErrorValueObject.create("#VALUE!"));
|
|
8778
|
-
else this.setValue(node.getValue());
|
|
9665
|
+
return false;
|
|
8779
9666
|
}
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
get zIndex() {
|
|
8783
|
-
return NODE_ORDER_MAP.get(9) || 100;
|
|
9667
|
+
_getRuntimeFeatureCellValue(row, column, sheetId, unitId) {
|
|
9668
|
+
return getRuntimeFeatureCell(row, column, sheetId, unitId, this._runtimeFeatureCellData);
|
|
8784
9669
|
}
|
|
8785
|
-
|
|
8786
|
-
if (
|
|
8787
|
-
if (
|
|
9670
|
+
_arrayCellHasData(cell) {
|
|
9671
|
+
if (cell === null || cell === void 0) return false;
|
|
9672
|
+
if (cell.v !== void 0) return true;
|
|
9673
|
+
return false;
|
|
8788
9674
|
}
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
*
|
|
8795
|
-
*
|
|
8796
|
-
*
|
|
8797
|
-
*
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
FUNCTION_NAMES_DATE["WEEKNUM"] = "WEEKNUM";
|
|
8832
|
-
FUNCTION_NAMES_DATE["WORKDAY"] = "WORKDAY";
|
|
8833
|
-
FUNCTION_NAMES_DATE["WORKDAY_INTL"] = "WORKDAY.INTL";
|
|
8834
|
-
FUNCTION_NAMES_DATE["YEAR"] = "YEAR";
|
|
8835
|
-
FUNCTION_NAMES_DATE["YEARFRAC"] = "YEARFRAC";
|
|
8836
|
-
return FUNCTION_NAMES_DATE;
|
|
8837
|
-
}({});
|
|
8838
|
-
|
|
8839
|
-
//#endregion
|
|
8840
|
-
//#region src/functions/engineering/function-names.ts
|
|
8841
|
-
/**
|
|
8842
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
8843
|
-
*
|
|
8844
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8845
|
-
* you may not use this file except in compliance with the License.
|
|
8846
|
-
* You may obtain a copy of the License at
|
|
8847
|
-
*
|
|
8848
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8849
|
-
*
|
|
8850
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
8851
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8852
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8853
|
-
* See the License for the specific language governing permissions and
|
|
8854
|
-
* limitations under the License.
|
|
8855
|
-
*/
|
|
8856
|
-
let FUNCTION_NAMES_ENGINEERING = /* @__PURE__ */ function(FUNCTION_NAMES_ENGINEERING) {
|
|
8857
|
-
FUNCTION_NAMES_ENGINEERING["BESSELI"] = "BESSELI";
|
|
8858
|
-
FUNCTION_NAMES_ENGINEERING["BESSELJ"] = "BESSELJ";
|
|
8859
|
-
FUNCTION_NAMES_ENGINEERING["BESSELK"] = "BESSELK";
|
|
8860
|
-
FUNCTION_NAMES_ENGINEERING["BESSELY"] = "BESSELY";
|
|
8861
|
-
FUNCTION_NAMES_ENGINEERING["BIN2DEC"] = "BIN2DEC";
|
|
8862
|
-
FUNCTION_NAMES_ENGINEERING["BIN2HEX"] = "BIN2HEX";
|
|
8863
|
-
FUNCTION_NAMES_ENGINEERING["BIN2OCT"] = "BIN2OCT";
|
|
8864
|
-
FUNCTION_NAMES_ENGINEERING["BITAND"] = "BITAND";
|
|
8865
|
-
FUNCTION_NAMES_ENGINEERING["BITLSHIFT"] = "BITLSHIFT";
|
|
8866
|
-
FUNCTION_NAMES_ENGINEERING["BITOR"] = "BITOR";
|
|
8867
|
-
FUNCTION_NAMES_ENGINEERING["BITRSHIFT"] = "BITRSHIFT";
|
|
8868
|
-
FUNCTION_NAMES_ENGINEERING["BITXOR"] = "BITXOR";
|
|
8869
|
-
FUNCTION_NAMES_ENGINEERING["COMPLEX"] = "COMPLEX";
|
|
8870
|
-
FUNCTION_NAMES_ENGINEERING["CONVERT"] = "CONVERT";
|
|
8871
|
-
FUNCTION_NAMES_ENGINEERING["DEC2BIN"] = "DEC2BIN";
|
|
8872
|
-
FUNCTION_NAMES_ENGINEERING["DEC2HEX"] = "DEC2HEX";
|
|
8873
|
-
FUNCTION_NAMES_ENGINEERING["DEC2OCT"] = "DEC2OCT";
|
|
8874
|
-
FUNCTION_NAMES_ENGINEERING["DELTA"] = "DELTA";
|
|
8875
|
-
FUNCTION_NAMES_ENGINEERING["ERF"] = "ERF";
|
|
8876
|
-
FUNCTION_NAMES_ENGINEERING["ERF_PRECISE"] = "ERF.PRECISE";
|
|
8877
|
-
FUNCTION_NAMES_ENGINEERING["ERFC"] = "ERFC";
|
|
8878
|
-
FUNCTION_NAMES_ENGINEERING["ERFC_PRECISE"] = "ERFC.PRECISE";
|
|
8879
|
-
FUNCTION_NAMES_ENGINEERING["GESTEP"] = "GESTEP";
|
|
8880
|
-
FUNCTION_NAMES_ENGINEERING["HEX2BIN"] = "HEX2BIN";
|
|
8881
|
-
FUNCTION_NAMES_ENGINEERING["HEX2DEC"] = "HEX2DEC";
|
|
8882
|
-
FUNCTION_NAMES_ENGINEERING["HEX2OCT"] = "HEX2OCT";
|
|
8883
|
-
FUNCTION_NAMES_ENGINEERING["IMABS"] = "IMABS";
|
|
8884
|
-
FUNCTION_NAMES_ENGINEERING["IMAGINARY"] = "IMAGINARY";
|
|
8885
|
-
FUNCTION_NAMES_ENGINEERING["IMARGUMENT"] = "IMARGUMENT";
|
|
8886
|
-
FUNCTION_NAMES_ENGINEERING["IMCONJUGATE"] = "IMCONJUGATE";
|
|
8887
|
-
FUNCTION_NAMES_ENGINEERING["IMCOS"] = "IMCOS";
|
|
8888
|
-
FUNCTION_NAMES_ENGINEERING["IMCOSH"] = "IMCOSH";
|
|
8889
|
-
FUNCTION_NAMES_ENGINEERING["IMCOT"] = "IMCOT";
|
|
8890
|
-
FUNCTION_NAMES_ENGINEERING["IMCOTH"] = "IMCOTH";
|
|
8891
|
-
FUNCTION_NAMES_ENGINEERING["IMCSC"] = "IMCSC";
|
|
8892
|
-
FUNCTION_NAMES_ENGINEERING["IMCSCH"] = "IMCSCH";
|
|
8893
|
-
FUNCTION_NAMES_ENGINEERING["IMDIV"] = "IMDIV";
|
|
8894
|
-
FUNCTION_NAMES_ENGINEERING["IMEXP"] = "IMEXP";
|
|
8895
|
-
FUNCTION_NAMES_ENGINEERING["IMLN"] = "IMLN";
|
|
8896
|
-
FUNCTION_NAMES_ENGINEERING["IMLOG"] = "IMLOG";
|
|
8897
|
-
FUNCTION_NAMES_ENGINEERING["IMLOG10"] = "IMLOG10";
|
|
8898
|
-
FUNCTION_NAMES_ENGINEERING["IMLOG2"] = "IMLOG2";
|
|
8899
|
-
FUNCTION_NAMES_ENGINEERING["IMPOWER"] = "IMPOWER";
|
|
8900
|
-
FUNCTION_NAMES_ENGINEERING["IMPRODUCT"] = "IMPRODUCT";
|
|
8901
|
-
FUNCTION_NAMES_ENGINEERING["IMREAL"] = "IMREAL";
|
|
8902
|
-
FUNCTION_NAMES_ENGINEERING["IMSEC"] = "IMSEC";
|
|
8903
|
-
FUNCTION_NAMES_ENGINEERING["IMSECH"] = "IMSECH";
|
|
8904
|
-
FUNCTION_NAMES_ENGINEERING["IMSIN"] = "IMSIN";
|
|
8905
|
-
FUNCTION_NAMES_ENGINEERING["IMSINH"] = "IMSINH";
|
|
8906
|
-
FUNCTION_NAMES_ENGINEERING["IMSQRT"] = "IMSQRT";
|
|
8907
|
-
FUNCTION_NAMES_ENGINEERING["IMSUB"] = "IMSUB";
|
|
8908
|
-
FUNCTION_NAMES_ENGINEERING["IMSUM"] = "IMSUM";
|
|
8909
|
-
FUNCTION_NAMES_ENGINEERING["IMTAN"] = "IMTAN";
|
|
8910
|
-
FUNCTION_NAMES_ENGINEERING["IMTANH"] = "IMTANH";
|
|
8911
|
-
FUNCTION_NAMES_ENGINEERING["OCT2BIN"] = "OCT2BIN";
|
|
8912
|
-
FUNCTION_NAMES_ENGINEERING["OCT2DEC"] = "OCT2DEC";
|
|
8913
|
-
FUNCTION_NAMES_ENGINEERING["OCT2HEX"] = "OCT2HEX";
|
|
8914
|
-
return FUNCTION_NAMES_ENGINEERING;
|
|
8915
|
-
}({});
|
|
8916
|
-
|
|
8917
|
-
//#endregion
|
|
8918
|
-
//#region src/functions/financial/function-names.ts
|
|
8919
|
-
/**
|
|
8920
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
8921
|
-
*
|
|
8922
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8923
|
-
* you may not use this file except in compliance with the License.
|
|
8924
|
-
* You may obtain a copy of the License at
|
|
8925
|
-
*
|
|
8926
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8927
|
-
*
|
|
8928
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
8929
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8930
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8931
|
-
* See the License for the specific language governing permissions and
|
|
8932
|
-
* limitations under the License.
|
|
8933
|
-
*/
|
|
8934
|
-
let FUNCTION_NAMES_FINANCIAL = /* @__PURE__ */ function(FUNCTION_NAMES_FINANCIAL) {
|
|
8935
|
-
FUNCTION_NAMES_FINANCIAL["ACCRINT"] = "ACCRINT";
|
|
8936
|
-
FUNCTION_NAMES_FINANCIAL["ACCRINTM"] = "ACCRINTM";
|
|
8937
|
-
FUNCTION_NAMES_FINANCIAL["AMORDEGRC"] = "AMORDEGRC";
|
|
8938
|
-
FUNCTION_NAMES_FINANCIAL["AMORLINC"] = "AMORLINC";
|
|
8939
|
-
FUNCTION_NAMES_FINANCIAL["COUPDAYBS"] = "COUPDAYBS";
|
|
8940
|
-
FUNCTION_NAMES_FINANCIAL["COUPDAYS"] = "COUPDAYS";
|
|
8941
|
-
FUNCTION_NAMES_FINANCIAL["COUPDAYSNC"] = "COUPDAYSNC";
|
|
8942
|
-
FUNCTION_NAMES_FINANCIAL["COUPNCD"] = "COUPNCD";
|
|
8943
|
-
FUNCTION_NAMES_FINANCIAL["COUPNUM"] = "COUPNUM";
|
|
8944
|
-
FUNCTION_NAMES_FINANCIAL["COUPPCD"] = "COUPPCD";
|
|
8945
|
-
FUNCTION_NAMES_FINANCIAL["CUMIPMT"] = "CUMIPMT";
|
|
8946
|
-
FUNCTION_NAMES_FINANCIAL["CUMPRINC"] = "CUMPRINC";
|
|
8947
|
-
FUNCTION_NAMES_FINANCIAL["DB"] = "DB";
|
|
8948
|
-
FUNCTION_NAMES_FINANCIAL["DDB"] = "DDB";
|
|
8949
|
-
FUNCTION_NAMES_FINANCIAL["DISC"] = "DISC";
|
|
8950
|
-
FUNCTION_NAMES_FINANCIAL["DOLLARDE"] = "DOLLARDE";
|
|
8951
|
-
FUNCTION_NAMES_FINANCIAL["DOLLARFR"] = "DOLLARFR";
|
|
8952
|
-
FUNCTION_NAMES_FINANCIAL["DURATION"] = "DURATION";
|
|
8953
|
-
FUNCTION_NAMES_FINANCIAL["EFFECT"] = "EFFECT";
|
|
8954
|
-
FUNCTION_NAMES_FINANCIAL["FV"] = "FV";
|
|
8955
|
-
FUNCTION_NAMES_FINANCIAL["FVSCHEDULE"] = "FVSCHEDULE";
|
|
8956
|
-
FUNCTION_NAMES_FINANCIAL["INTRATE"] = "INTRATE";
|
|
8957
|
-
FUNCTION_NAMES_FINANCIAL["IPMT"] = "IPMT";
|
|
8958
|
-
FUNCTION_NAMES_FINANCIAL["IRR"] = "IRR";
|
|
8959
|
-
FUNCTION_NAMES_FINANCIAL["ISPMT"] = "ISPMT";
|
|
8960
|
-
FUNCTION_NAMES_FINANCIAL["MDURATION"] = "MDURATION";
|
|
8961
|
-
FUNCTION_NAMES_FINANCIAL["MIRR"] = "MIRR";
|
|
8962
|
-
FUNCTION_NAMES_FINANCIAL["NOMINAL"] = "NOMINAL";
|
|
8963
|
-
FUNCTION_NAMES_FINANCIAL["NPER"] = "NPER";
|
|
8964
|
-
FUNCTION_NAMES_FINANCIAL["NPV"] = "NPV";
|
|
8965
|
-
FUNCTION_NAMES_FINANCIAL["ODDFPRICE"] = "ODDFPRICE";
|
|
8966
|
-
FUNCTION_NAMES_FINANCIAL["ODDFYIELD"] = "ODDFYIELD";
|
|
8967
|
-
FUNCTION_NAMES_FINANCIAL["ODDLPRICE"] = "ODDLPRICE";
|
|
8968
|
-
FUNCTION_NAMES_FINANCIAL["ODDLYIELD"] = "ODDLYIELD";
|
|
8969
|
-
FUNCTION_NAMES_FINANCIAL["PDURATION"] = "PDURATION";
|
|
8970
|
-
FUNCTION_NAMES_FINANCIAL["PMT"] = "PMT";
|
|
8971
|
-
FUNCTION_NAMES_FINANCIAL["PPMT"] = "PPMT";
|
|
8972
|
-
FUNCTION_NAMES_FINANCIAL["PRICE"] = "PRICE";
|
|
8973
|
-
FUNCTION_NAMES_FINANCIAL["PRICEDISC"] = "PRICEDISC";
|
|
8974
|
-
FUNCTION_NAMES_FINANCIAL["PRICEMAT"] = "PRICEMAT";
|
|
8975
|
-
FUNCTION_NAMES_FINANCIAL["PV"] = "PV";
|
|
8976
|
-
FUNCTION_NAMES_FINANCIAL["RATE"] = "RATE";
|
|
8977
|
-
FUNCTION_NAMES_FINANCIAL["RECEIVED"] = "RECEIVED";
|
|
8978
|
-
FUNCTION_NAMES_FINANCIAL["RRI"] = "RRI";
|
|
8979
|
-
FUNCTION_NAMES_FINANCIAL["SLN"] = "SLN";
|
|
8980
|
-
FUNCTION_NAMES_FINANCIAL["SYD"] = "SYD";
|
|
8981
|
-
FUNCTION_NAMES_FINANCIAL["TBILLEQ"] = "TBILLEQ";
|
|
8982
|
-
FUNCTION_NAMES_FINANCIAL["TBILLPRICE"] = "TBILLPRICE";
|
|
8983
|
-
FUNCTION_NAMES_FINANCIAL["TBILLYIELD"] = "TBILLYIELD";
|
|
8984
|
-
FUNCTION_NAMES_FINANCIAL["VDB"] = "VDB";
|
|
8985
|
-
FUNCTION_NAMES_FINANCIAL["XIRR"] = "XIRR";
|
|
8986
|
-
FUNCTION_NAMES_FINANCIAL["XNPV"] = "XNPV";
|
|
8987
|
-
FUNCTION_NAMES_FINANCIAL["YIELD"] = "YIELD";
|
|
8988
|
-
FUNCTION_NAMES_FINANCIAL["YIELDDISC"] = "YIELDDISC";
|
|
8989
|
-
FUNCTION_NAMES_FINANCIAL["YIELDMAT"] = "YIELDMAT";
|
|
8990
|
-
return FUNCTION_NAMES_FINANCIAL;
|
|
8991
|
-
}({});
|
|
8992
|
-
|
|
8993
|
-
//#endregion
|
|
8994
|
-
//#region src/functions/information/function-names.ts
|
|
8995
|
-
/**
|
|
8996
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
8997
|
-
*
|
|
8998
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8999
|
-
* you may not use this file except in compliance with the License.
|
|
9000
|
-
* You may obtain a copy of the License at
|
|
9001
|
-
*
|
|
9002
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9003
|
-
*
|
|
9004
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9005
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9006
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9007
|
-
* See the License for the specific language governing permissions and
|
|
9008
|
-
* limitations under the License.
|
|
9009
|
-
*/
|
|
9010
|
-
let FUNCTION_NAMES_INFORMATION = /* @__PURE__ */ function(FUNCTION_NAMES_INFORMATION) {
|
|
9011
|
-
FUNCTION_NAMES_INFORMATION["CELL"] = "CELL";
|
|
9012
|
-
FUNCTION_NAMES_INFORMATION["ERROR_TYPE"] = "ERROR.TYPE";
|
|
9013
|
-
FUNCTION_NAMES_INFORMATION["INFO"] = "INFO";
|
|
9014
|
-
FUNCTION_NAMES_INFORMATION["ISBETWEEN"] = "ISBETWEEN";
|
|
9015
|
-
FUNCTION_NAMES_INFORMATION["ISBLANK"] = "ISBLANK";
|
|
9016
|
-
FUNCTION_NAMES_INFORMATION["ISDATE"] = "ISDATE";
|
|
9017
|
-
FUNCTION_NAMES_INFORMATION["ISEMAIL"] = "ISEMAIL";
|
|
9018
|
-
FUNCTION_NAMES_INFORMATION["ISERR"] = "ISERR";
|
|
9019
|
-
FUNCTION_NAMES_INFORMATION["ISERROR"] = "ISERROR";
|
|
9020
|
-
FUNCTION_NAMES_INFORMATION["ISEVEN"] = "ISEVEN";
|
|
9021
|
-
FUNCTION_NAMES_INFORMATION["ISFORMULA"] = "ISFORMULA";
|
|
9022
|
-
FUNCTION_NAMES_INFORMATION["ISLOGICAL"] = "ISLOGICAL";
|
|
9023
|
-
FUNCTION_NAMES_INFORMATION["ISNA"] = "ISNA";
|
|
9024
|
-
FUNCTION_NAMES_INFORMATION["ISNONTEXT"] = "ISNONTEXT";
|
|
9025
|
-
FUNCTION_NAMES_INFORMATION["ISNUMBER"] = "ISNUMBER";
|
|
9026
|
-
FUNCTION_NAMES_INFORMATION["ISODD"] = "ISODD";
|
|
9027
|
-
FUNCTION_NAMES_INFORMATION["ISOMITTED"] = "ISOMITTED";
|
|
9028
|
-
FUNCTION_NAMES_INFORMATION["ISREF"] = "ISREF";
|
|
9029
|
-
FUNCTION_NAMES_INFORMATION["ISTEXT"] = "ISTEXT";
|
|
9030
|
-
FUNCTION_NAMES_INFORMATION["ISURL"] = "ISURL";
|
|
9031
|
-
FUNCTION_NAMES_INFORMATION["N"] = "N";
|
|
9032
|
-
FUNCTION_NAMES_INFORMATION["NA"] = "NA";
|
|
9033
|
-
FUNCTION_NAMES_INFORMATION["SHEET"] = "SHEET";
|
|
9034
|
-
FUNCTION_NAMES_INFORMATION["SHEETS"] = "SHEETS";
|
|
9035
|
-
FUNCTION_NAMES_INFORMATION["TYPE"] = "TYPE";
|
|
9036
|
-
return FUNCTION_NAMES_INFORMATION;
|
|
9037
|
-
}({});
|
|
9038
|
-
|
|
9039
|
-
//#endregion
|
|
9040
|
-
//#region src/functions/logical/function-names.ts
|
|
9041
|
-
/**
|
|
9042
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
9043
|
-
*
|
|
9044
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9045
|
-
* you may not use this file except in compliance with the License.
|
|
9046
|
-
* You may obtain a copy of the License at
|
|
9047
|
-
*
|
|
9048
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9049
|
-
*
|
|
9050
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9051
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9052
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9053
|
-
* See the License for the specific language governing permissions and
|
|
9054
|
-
* limitations under the License.
|
|
9055
|
-
*/
|
|
9056
|
-
let FUNCTION_NAMES_LOGICAL = /* @__PURE__ */ function(FUNCTION_NAMES_LOGICAL) {
|
|
9057
|
-
FUNCTION_NAMES_LOGICAL["AND"] = "AND";
|
|
9058
|
-
FUNCTION_NAMES_LOGICAL["BYCOL"] = "BYCOL";
|
|
9059
|
-
FUNCTION_NAMES_LOGICAL["BYROW"] = "BYROW";
|
|
9060
|
-
FUNCTION_NAMES_LOGICAL["FALSE"] = "FALSE";
|
|
9061
|
-
FUNCTION_NAMES_LOGICAL["IF"] = "IF";
|
|
9062
|
-
FUNCTION_NAMES_LOGICAL["IFERROR"] = "IFERROR";
|
|
9063
|
-
FUNCTION_NAMES_LOGICAL["IFNA"] = "IFNA";
|
|
9064
|
-
FUNCTION_NAMES_LOGICAL["IFS"] = "IFS";
|
|
9065
|
-
FUNCTION_NAMES_LOGICAL["LAMBDA"] = "LAMBDA";
|
|
9066
|
-
FUNCTION_NAMES_LOGICAL["LET"] = "LET";
|
|
9067
|
-
FUNCTION_NAMES_LOGICAL["MAKEARRAY"] = "MAKEARRAY";
|
|
9068
|
-
FUNCTION_NAMES_LOGICAL["MAP"] = "MAP";
|
|
9069
|
-
FUNCTION_NAMES_LOGICAL["NOT"] = "NOT";
|
|
9070
|
-
FUNCTION_NAMES_LOGICAL["OR"] = "OR";
|
|
9071
|
-
FUNCTION_NAMES_LOGICAL["REDUCE"] = "REDUCE";
|
|
9072
|
-
FUNCTION_NAMES_LOGICAL["SCAN"] = "SCAN";
|
|
9073
|
-
FUNCTION_NAMES_LOGICAL["SWITCH"] = "SWITCH";
|
|
9074
|
-
FUNCTION_NAMES_LOGICAL["TRUE"] = "TRUE";
|
|
9075
|
-
FUNCTION_NAMES_LOGICAL["XOR"] = "XOR";
|
|
9076
|
-
return FUNCTION_NAMES_LOGICAL;
|
|
9077
|
-
}({});
|
|
9078
|
-
|
|
9079
|
-
//#endregion
|
|
9080
|
-
//#region src/functions/lookup/function-names.ts
|
|
9081
|
-
/**
|
|
9082
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
9083
|
-
*
|
|
9084
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9085
|
-
* you may not use this file except in compliance with the License.
|
|
9086
|
-
* You may obtain a copy of the License at
|
|
9087
|
-
*
|
|
9088
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9089
|
-
*
|
|
9090
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9091
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9092
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9093
|
-
* See the License for the specific language governing permissions and
|
|
9094
|
-
* limitations under the License.
|
|
9095
|
-
*/
|
|
9096
|
-
let FUNCTION_NAMES_LOOKUP = /* @__PURE__ */ function(FUNCTION_NAMES_LOOKUP) {
|
|
9097
|
-
FUNCTION_NAMES_LOOKUP["ADDRESS"] = "ADDRESS";
|
|
9098
|
-
FUNCTION_NAMES_LOOKUP["AREAS"] = "AREAS";
|
|
9099
|
-
FUNCTION_NAMES_LOOKUP["CHOOSE"] = "CHOOSE";
|
|
9100
|
-
FUNCTION_NAMES_LOOKUP["CHOOSECOLS"] = "CHOOSECOLS";
|
|
9101
|
-
FUNCTION_NAMES_LOOKUP["CHOOSEROWS"] = "CHOOSEROWS";
|
|
9102
|
-
FUNCTION_NAMES_LOOKUP["COLUMN"] = "COLUMN";
|
|
9103
|
-
FUNCTION_NAMES_LOOKUP["COLUMNS"] = "COLUMNS";
|
|
9104
|
-
FUNCTION_NAMES_LOOKUP["DROP"] = "DROP";
|
|
9105
|
-
FUNCTION_NAMES_LOOKUP["EXPAND"] = "EXPAND";
|
|
9106
|
-
FUNCTION_NAMES_LOOKUP["FILTER"] = "FILTER";
|
|
9107
|
-
FUNCTION_NAMES_LOOKUP["FORMULATEXT"] = "FORMULATEXT";
|
|
9108
|
-
FUNCTION_NAMES_LOOKUP["GETPIVOTDATA"] = "GETPIVOTDATA";
|
|
9109
|
-
FUNCTION_NAMES_LOOKUP["HLOOKUP"] = "HLOOKUP";
|
|
9110
|
-
FUNCTION_NAMES_LOOKUP["HSTACK"] = "HSTACK";
|
|
9111
|
-
FUNCTION_NAMES_LOOKUP["HYPERLINK"] = "HYPERLINK";
|
|
9112
|
-
FUNCTION_NAMES_LOOKUP["IMAGE"] = "IMAGE";
|
|
9113
|
-
FUNCTION_NAMES_LOOKUP["INDEX"] = "INDEX";
|
|
9114
|
-
FUNCTION_NAMES_LOOKUP["INDIRECT"] = "INDIRECT";
|
|
9115
|
-
FUNCTION_NAMES_LOOKUP["LOOKUP"] = "LOOKUP";
|
|
9116
|
-
FUNCTION_NAMES_LOOKUP["MATCH"] = "MATCH";
|
|
9117
|
-
FUNCTION_NAMES_LOOKUP["OFFSET"] = "OFFSET";
|
|
9118
|
-
FUNCTION_NAMES_LOOKUP["ROW"] = "ROW";
|
|
9119
|
-
FUNCTION_NAMES_LOOKUP["ROWS"] = "ROWS";
|
|
9120
|
-
FUNCTION_NAMES_LOOKUP["RTD"] = "RTD";
|
|
9121
|
-
FUNCTION_NAMES_LOOKUP["SORT"] = "SORT";
|
|
9122
|
-
FUNCTION_NAMES_LOOKUP["SORTBY"] = "SORTBY";
|
|
9123
|
-
FUNCTION_NAMES_LOOKUP["TAKE"] = "TAKE";
|
|
9124
|
-
FUNCTION_NAMES_LOOKUP["TOCOL"] = "TOCOL";
|
|
9125
|
-
FUNCTION_NAMES_LOOKUP["TOROW"] = "TOROW";
|
|
9126
|
-
FUNCTION_NAMES_LOOKUP["TRANSPOSE"] = "TRANSPOSE";
|
|
9127
|
-
FUNCTION_NAMES_LOOKUP["UNIQUE"] = "UNIQUE";
|
|
9128
|
-
FUNCTION_NAMES_LOOKUP["VLOOKUP"] = "VLOOKUP";
|
|
9129
|
-
FUNCTION_NAMES_LOOKUP["VSTACK"] = "VSTACK";
|
|
9130
|
-
FUNCTION_NAMES_LOOKUP["WRAPCOLS"] = "WRAPCOLS";
|
|
9131
|
-
FUNCTION_NAMES_LOOKUP["WRAPROWS"] = "WRAPROWS";
|
|
9132
|
-
FUNCTION_NAMES_LOOKUP["XLOOKUP"] = "XLOOKUP";
|
|
9133
|
-
FUNCTION_NAMES_LOOKUP["XMATCH"] = "XMATCH";
|
|
9134
|
-
return FUNCTION_NAMES_LOOKUP;
|
|
9135
|
-
}({});
|
|
9136
|
-
|
|
9137
|
-
//#endregion
|
|
9138
|
-
//#region src/functions/math/function-names.ts
|
|
9139
|
-
/**
|
|
9140
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
9141
|
-
*
|
|
9142
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9143
|
-
* you may not use this file except in compliance with the License.
|
|
9144
|
-
* You may obtain a copy of the License at
|
|
9145
|
-
*
|
|
9146
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9147
|
-
*
|
|
9148
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9149
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9150
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9151
|
-
* See the License for the specific language governing permissions and
|
|
9152
|
-
* limitations under the License.
|
|
9153
|
-
*/
|
|
9154
|
-
let FUNCTION_NAMES_MATH = /* @__PURE__ */ function(FUNCTION_NAMES_MATH) {
|
|
9155
|
-
FUNCTION_NAMES_MATH["ABS"] = "ABS";
|
|
9156
|
-
FUNCTION_NAMES_MATH["ACOS"] = "ACOS";
|
|
9157
|
-
FUNCTION_NAMES_MATH["ACOSH"] = "ACOSH";
|
|
9158
|
-
FUNCTION_NAMES_MATH["ACOT"] = "ACOT";
|
|
9159
|
-
FUNCTION_NAMES_MATH["ACOTH"] = "ACOTH";
|
|
9160
|
-
FUNCTION_NAMES_MATH["AGGREGATE"] = "AGGREGATE";
|
|
9161
|
-
FUNCTION_NAMES_MATH["ARABIC"] = "ARABIC";
|
|
9162
|
-
FUNCTION_NAMES_MATH["ASIN"] = "ASIN";
|
|
9163
|
-
FUNCTION_NAMES_MATH["ASINH"] = "ASINH";
|
|
9164
|
-
FUNCTION_NAMES_MATH["ATAN"] = "ATAN";
|
|
9165
|
-
FUNCTION_NAMES_MATH["ATAN2"] = "ATAN2";
|
|
9166
|
-
FUNCTION_NAMES_MATH["ATANH"] = "ATANH";
|
|
9167
|
-
FUNCTION_NAMES_MATH["BASE"] = "BASE";
|
|
9168
|
-
FUNCTION_NAMES_MATH["CEILING"] = "CEILING";
|
|
9169
|
-
FUNCTION_NAMES_MATH["CEILING_MATH"] = "CEILING.MATH";
|
|
9170
|
-
FUNCTION_NAMES_MATH["CEILING_PRECISE"] = "CEILING.PRECISE";
|
|
9171
|
-
FUNCTION_NAMES_MATH["COMBIN"] = "COMBIN";
|
|
9172
|
-
FUNCTION_NAMES_MATH["COMBINA"] = "COMBINA";
|
|
9173
|
-
FUNCTION_NAMES_MATH["COS"] = "COS";
|
|
9174
|
-
FUNCTION_NAMES_MATH["COSH"] = "COSH";
|
|
9175
|
-
FUNCTION_NAMES_MATH["COT"] = "COT";
|
|
9176
|
-
FUNCTION_NAMES_MATH["COTH"] = "COTH";
|
|
9177
|
-
FUNCTION_NAMES_MATH["CSC"] = "CSC";
|
|
9178
|
-
FUNCTION_NAMES_MATH["CSCH"] = "CSCH";
|
|
9179
|
-
FUNCTION_NAMES_MATH["DECIMAL"] = "DECIMAL";
|
|
9180
|
-
FUNCTION_NAMES_MATH["DEGREES"] = "DEGREES";
|
|
9181
|
-
FUNCTION_NAMES_MATH["EVEN"] = "EVEN";
|
|
9182
|
-
FUNCTION_NAMES_MATH["EXP"] = "EXP";
|
|
9183
|
-
FUNCTION_NAMES_MATH["FACT"] = "FACT";
|
|
9184
|
-
FUNCTION_NAMES_MATH["FACTDOUBLE"] = "FACTDOUBLE";
|
|
9185
|
-
FUNCTION_NAMES_MATH["FLOOR"] = "FLOOR";
|
|
9186
|
-
FUNCTION_NAMES_MATH["FLOOR_MATH"] = "FLOOR.MATH";
|
|
9187
|
-
FUNCTION_NAMES_MATH["FLOOR_PRECISE"] = "FLOOR.PRECISE";
|
|
9188
|
-
FUNCTION_NAMES_MATH["GCD"] = "GCD";
|
|
9189
|
-
FUNCTION_NAMES_MATH["INT"] = "INT";
|
|
9190
|
-
FUNCTION_NAMES_MATH["ISO_CEILING"] = "ISO.CEILING";
|
|
9191
|
-
FUNCTION_NAMES_MATH["LCM"] = "LCM";
|
|
9192
|
-
FUNCTION_NAMES_MATH["LET"] = "LET";
|
|
9193
|
-
FUNCTION_NAMES_MATH["LN"] = "LN";
|
|
9194
|
-
FUNCTION_NAMES_MATH["LOG"] = "LOG";
|
|
9195
|
-
FUNCTION_NAMES_MATH["LOG10"] = "LOG10";
|
|
9196
|
-
FUNCTION_NAMES_MATH["MDETERM"] = "MDETERM";
|
|
9197
|
-
FUNCTION_NAMES_MATH["MINVERSE"] = "MINVERSE";
|
|
9198
|
-
FUNCTION_NAMES_MATH["MMULT"] = "MMULT";
|
|
9199
|
-
FUNCTION_NAMES_MATH["MOD"] = "MOD";
|
|
9200
|
-
FUNCTION_NAMES_MATH["MROUND"] = "MROUND";
|
|
9201
|
-
FUNCTION_NAMES_MATH["MULTINOMIAL"] = "MULTINOMIAL";
|
|
9202
|
-
FUNCTION_NAMES_MATH["MUNIT"] = "MUNIT";
|
|
9203
|
-
FUNCTION_NAMES_MATH["ODD"] = "ODD";
|
|
9204
|
-
FUNCTION_NAMES_MATH["PI"] = "PI";
|
|
9205
|
-
FUNCTION_NAMES_MATH["POWER"] = "POWER";
|
|
9206
|
-
FUNCTION_NAMES_MATH["PRODUCT"] = "PRODUCT";
|
|
9207
|
-
FUNCTION_NAMES_MATH["QUOTIENT"] = "QUOTIENT";
|
|
9208
|
-
FUNCTION_NAMES_MATH["RADIANS"] = "RADIANS";
|
|
9209
|
-
FUNCTION_NAMES_MATH["RAND"] = "RAND";
|
|
9210
|
-
FUNCTION_NAMES_MATH["RANDARRAY"] = "RANDARRAY";
|
|
9211
|
-
FUNCTION_NAMES_MATH["RANDBETWEEN"] = "RANDBETWEEN";
|
|
9212
|
-
FUNCTION_NAMES_MATH["ROMAN"] = "ROMAN";
|
|
9213
|
-
FUNCTION_NAMES_MATH["ROUND"] = "ROUND";
|
|
9214
|
-
FUNCTION_NAMES_MATH["ROUNDBANK"] = "ROUNDBANK";
|
|
9215
|
-
FUNCTION_NAMES_MATH["ROUNDDOWN"] = "ROUNDDOWN";
|
|
9216
|
-
FUNCTION_NAMES_MATH["ROUNDUP"] = "ROUNDUP";
|
|
9217
|
-
FUNCTION_NAMES_MATH["SEC"] = "SEC";
|
|
9218
|
-
FUNCTION_NAMES_MATH["SECH"] = "SECH";
|
|
9219
|
-
FUNCTION_NAMES_MATH["SERIESSUM"] = "SERIESSUM";
|
|
9220
|
-
FUNCTION_NAMES_MATH["SEQUENCE"] = "SEQUENCE";
|
|
9221
|
-
FUNCTION_NAMES_MATH["SIGN"] = "SIGN";
|
|
9222
|
-
FUNCTION_NAMES_MATH["SIN"] = "SIN";
|
|
9223
|
-
FUNCTION_NAMES_MATH["SINH"] = "SINH";
|
|
9224
|
-
FUNCTION_NAMES_MATH["SQRT"] = "SQRT";
|
|
9225
|
-
FUNCTION_NAMES_MATH["SQRTPI"] = "SQRTPI";
|
|
9226
|
-
FUNCTION_NAMES_MATH["SUBTOTAL"] = "SUBTOTAL";
|
|
9227
|
-
FUNCTION_NAMES_MATH["SUM"] = "SUM";
|
|
9228
|
-
FUNCTION_NAMES_MATH["SUMIF"] = "SUMIF";
|
|
9229
|
-
FUNCTION_NAMES_MATH["SUMIFS"] = "SUMIFS";
|
|
9230
|
-
FUNCTION_NAMES_MATH["SUMPRODUCT"] = "SUMPRODUCT";
|
|
9231
|
-
FUNCTION_NAMES_MATH["SUMSQ"] = "SUMSQ";
|
|
9232
|
-
FUNCTION_NAMES_MATH["SUMX2MY2"] = "SUMX2MY2";
|
|
9233
|
-
FUNCTION_NAMES_MATH["SUMX2PY2"] = "SUMX2PY2";
|
|
9234
|
-
FUNCTION_NAMES_MATH["SUMXMY2"] = "SUMXMY2";
|
|
9235
|
-
FUNCTION_NAMES_MATH["TAN"] = "TAN";
|
|
9236
|
-
FUNCTION_NAMES_MATH["TANH"] = "TANH";
|
|
9237
|
-
FUNCTION_NAMES_MATH["TRUNC"] = "TRUNC";
|
|
9238
|
-
return FUNCTION_NAMES_MATH;
|
|
9239
|
-
}({});
|
|
9675
|
+
/**
|
|
9676
|
+
* If the current array formula in the extended area intersects with the existing array formula, a #SPILL! error will be reported. Note that if other array formulas are already #SPILL!, they will not conflict with the current array formula
|
|
9677
|
+
* @param formulaUnitId
|
|
9678
|
+
* @param formulaSheetId
|
|
9679
|
+
* @param formulaRow
|
|
9680
|
+
* @param formulaColumn
|
|
9681
|
+
* @param r
|
|
9682
|
+
* @param c
|
|
9683
|
+
* @returns
|
|
9684
|
+
*/
|
|
9685
|
+
_isInOtherArrayFormulaRange(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, r, c) {
|
|
9686
|
+
var _this$_currentConfigS;
|
|
9687
|
+
const arrayFormulaRange = (_this$_currentConfigS = this._currentConfigService.getArrayFormulaRange()[formulaUnitId]) === null || _this$_currentConfigS === void 0 ? void 0 : _this$_currentConfigS[formulaSheetId];
|
|
9688
|
+
if (arrayFormulaRange == null) return false;
|
|
9689
|
+
let isCellOverlapping = false;
|
|
9690
|
+
new _univerjs_core.ObjectMatrix(arrayFormulaRange).forValue((rangeRow, rangeCol, range) => {
|
|
9691
|
+
var _this$_runtimeData$fo;
|
|
9692
|
+
if (rangeRow === formulaRow && rangeCol === formulaColumn) return;
|
|
9693
|
+
const isOverlapping = this._isInArrayFormulaRange(range, r, c);
|
|
9694
|
+
const cell = (_this$_runtimeData$fo = this._runtimeData[formulaUnitId]) === null || _this$_runtimeData$fo === void 0 || (_this$_runtimeData$fo = _this$_runtimeData$fo[formulaSheetId]) === null || _this$_runtimeData$fo === void 0 ? void 0 : _this$_runtimeData$fo.getValue(rangeRow, rangeCol);
|
|
9695
|
+
if (isOverlapping && (cell === null || cell === void 0 ? void 0 : cell.v) !== "#SPILL!") isCellOverlapping = true;
|
|
9696
|
+
});
|
|
9697
|
+
return isCellOverlapping;
|
|
9698
|
+
}
|
|
9699
|
+
_isInArrayFormulaRange(range, r, c) {
|
|
9700
|
+
if (range == null) return false;
|
|
9701
|
+
const { startRow, startColumn, endRow, endColumn } = range;
|
|
9702
|
+
if (r >= startRow && r <= endRow && c >= startColumn && c <= endColumn) return true;
|
|
9703
|
+
return false;
|
|
9704
|
+
}
|
|
9705
|
+
_checkIfArrayFormulaExceeded(rowCount, columnCount, arrayRange) {
|
|
9706
|
+
if (arrayRange.endRow >= rowCount || arrayRange.endColumn >= columnCount) return true;
|
|
9707
|
+
return false;
|
|
9708
|
+
}
|
|
9709
|
+
_isInDirtyRange(unitId, sheetId, row, column) {
|
|
9710
|
+
const dirtyRanges = this._currentConfigService.getDirtyRanges();
|
|
9711
|
+
if (dirtyRanges.length === 0) return true;
|
|
9712
|
+
return isInDirtyRange(dirtyRanges, unitId, sheetId, row, column);
|
|
9713
|
+
}
|
|
9714
|
+
};
|
|
9715
|
+
FormulaRuntimeService = __decorate([__decorateParam(0, IFormulaCurrentConfigService), __decorateParam(1, IHyperlinkEngineFormulaService)], FormulaRuntimeService);
|
|
9716
|
+
const IFormulaRuntimeService = (0, _univerjs_core.createIdentifier)("univer.formula.runtime.service");
|
|
9240
9717
|
|
|
9241
9718
|
//#endregion
|
|
9242
|
-
//#region src/
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
* See the License for the specific language governing permissions and
|
|
9256
|
-
* limitations under the License.
|
|
9257
|
-
*/
|
|
9258
|
-
let FUNCTION_NAMES_STATISTICAL = /* @__PURE__ */ function(FUNCTION_NAMES_STATISTICAL) {
|
|
9259
|
-
FUNCTION_NAMES_STATISTICAL["AVEDEV"] = "AVEDEV";
|
|
9260
|
-
FUNCTION_NAMES_STATISTICAL["AVERAGE"] = "AVERAGE";
|
|
9261
|
-
FUNCTION_NAMES_STATISTICAL["AVERAGE_WEIGHTED"] = "AVERAGE.WEIGHTED";
|
|
9262
|
-
FUNCTION_NAMES_STATISTICAL["AVERAGEA"] = "AVERAGEA";
|
|
9263
|
-
FUNCTION_NAMES_STATISTICAL["AVERAGEIF"] = "AVERAGEIF";
|
|
9264
|
-
FUNCTION_NAMES_STATISTICAL["AVERAGEIFS"] = "AVERAGEIFS";
|
|
9265
|
-
FUNCTION_NAMES_STATISTICAL["BETA_DIST"] = "BETA.DIST";
|
|
9266
|
-
FUNCTION_NAMES_STATISTICAL["BETA_INV"] = "BETA.INV";
|
|
9267
|
-
FUNCTION_NAMES_STATISTICAL["BINOM_DIST"] = "BINOM.DIST";
|
|
9268
|
-
FUNCTION_NAMES_STATISTICAL["BINOM_DIST_RANGE"] = "BINOM.DIST.RANGE";
|
|
9269
|
-
FUNCTION_NAMES_STATISTICAL["BINOM_INV"] = "BINOM.INV";
|
|
9270
|
-
FUNCTION_NAMES_STATISTICAL["CHISQ_DIST"] = "CHISQ.DIST";
|
|
9271
|
-
FUNCTION_NAMES_STATISTICAL["CHISQ_DIST_RT"] = "CHISQ.DIST.RT";
|
|
9272
|
-
FUNCTION_NAMES_STATISTICAL["CHISQ_INV"] = "CHISQ.INV";
|
|
9273
|
-
FUNCTION_NAMES_STATISTICAL["CHISQ_INV_RT"] = "CHISQ.INV.RT";
|
|
9274
|
-
FUNCTION_NAMES_STATISTICAL["CHISQ_TEST"] = "CHISQ.TEST";
|
|
9275
|
-
FUNCTION_NAMES_STATISTICAL["CONFIDENCE_NORM"] = "CONFIDENCE.NORM";
|
|
9276
|
-
FUNCTION_NAMES_STATISTICAL["CONFIDENCE_T"] = "CONFIDENCE.T";
|
|
9277
|
-
FUNCTION_NAMES_STATISTICAL["CORREL"] = "CORREL";
|
|
9278
|
-
FUNCTION_NAMES_STATISTICAL["COUNT"] = "COUNT";
|
|
9279
|
-
FUNCTION_NAMES_STATISTICAL["COUNTA"] = "COUNTA";
|
|
9280
|
-
FUNCTION_NAMES_STATISTICAL["COUNTBLANK"] = "COUNTBLANK";
|
|
9281
|
-
FUNCTION_NAMES_STATISTICAL["COUNTIF"] = "COUNTIF";
|
|
9282
|
-
FUNCTION_NAMES_STATISTICAL["COUNTIFS"] = "COUNTIFS";
|
|
9283
|
-
FUNCTION_NAMES_STATISTICAL["COVARIANCE_P"] = "COVARIANCE.P";
|
|
9284
|
-
FUNCTION_NAMES_STATISTICAL["COVARIANCE_S"] = "COVARIANCE.S";
|
|
9285
|
-
FUNCTION_NAMES_STATISTICAL["DEVSQ"] = "DEVSQ";
|
|
9286
|
-
FUNCTION_NAMES_STATISTICAL["EXPON_DIST"] = "EXPON.DIST";
|
|
9287
|
-
FUNCTION_NAMES_STATISTICAL["F_DIST"] = "F.DIST";
|
|
9288
|
-
FUNCTION_NAMES_STATISTICAL["F_DIST_RT"] = "F.DIST.RT";
|
|
9289
|
-
FUNCTION_NAMES_STATISTICAL["F_INV"] = "F.INV";
|
|
9290
|
-
FUNCTION_NAMES_STATISTICAL["F_INV_RT"] = "F.INV.RT";
|
|
9291
|
-
FUNCTION_NAMES_STATISTICAL["F_TEST"] = "F.TEST";
|
|
9292
|
-
FUNCTION_NAMES_STATISTICAL["FISHER"] = "FISHER";
|
|
9293
|
-
FUNCTION_NAMES_STATISTICAL["FISHERINV"] = "FISHERINV";
|
|
9294
|
-
FUNCTION_NAMES_STATISTICAL["FORECAST"] = "FORECAST";
|
|
9295
|
-
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS"] = "FORECAST.ETS";
|
|
9296
|
-
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS_CONFINT"] = "FORECAST.ETS.CONFINT";
|
|
9297
|
-
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS_SEASONALITY"] = "FORECAST.ETS.SEASONALITY";
|
|
9298
|
-
FUNCTION_NAMES_STATISTICAL["FORECAST_ETS_STAT"] = "FORECAST.ETS.STAT";
|
|
9299
|
-
FUNCTION_NAMES_STATISTICAL["FORECAST_LINEAR"] = "FORECAST.LINEAR";
|
|
9300
|
-
FUNCTION_NAMES_STATISTICAL["FREQUENCY"] = "FREQUENCY";
|
|
9301
|
-
FUNCTION_NAMES_STATISTICAL["GAMMA"] = "GAMMA";
|
|
9302
|
-
FUNCTION_NAMES_STATISTICAL["GAMMA_DIST"] = "GAMMA.DIST";
|
|
9303
|
-
FUNCTION_NAMES_STATISTICAL["GAMMA_INV"] = "GAMMA.INV";
|
|
9304
|
-
FUNCTION_NAMES_STATISTICAL["GAMMALN"] = "GAMMALN";
|
|
9305
|
-
FUNCTION_NAMES_STATISTICAL["GAMMALN_PRECISE"] = "GAMMALN.PRECISE";
|
|
9306
|
-
FUNCTION_NAMES_STATISTICAL["GAUSS"] = "GAUSS";
|
|
9307
|
-
FUNCTION_NAMES_STATISTICAL["GEOMEAN"] = "GEOMEAN";
|
|
9308
|
-
FUNCTION_NAMES_STATISTICAL["GROWTH"] = "GROWTH";
|
|
9309
|
-
FUNCTION_NAMES_STATISTICAL["HARMEAN"] = "HARMEAN";
|
|
9310
|
-
FUNCTION_NAMES_STATISTICAL["HYPGEOM_DIST"] = "HYPGEOM.DIST";
|
|
9311
|
-
FUNCTION_NAMES_STATISTICAL["INTERCEPT"] = "INTERCEPT";
|
|
9312
|
-
FUNCTION_NAMES_STATISTICAL["KURT"] = "KURT";
|
|
9313
|
-
FUNCTION_NAMES_STATISTICAL["LARGE"] = "LARGE";
|
|
9314
|
-
FUNCTION_NAMES_STATISTICAL["LINEST"] = "LINEST";
|
|
9315
|
-
FUNCTION_NAMES_STATISTICAL["LOGEST"] = "LOGEST";
|
|
9316
|
-
FUNCTION_NAMES_STATISTICAL["LOGNORM_DIST"] = "LOGNORM.DIST";
|
|
9317
|
-
FUNCTION_NAMES_STATISTICAL["LOGNORM_INV"] = "LOGNORM.INV";
|
|
9318
|
-
FUNCTION_NAMES_STATISTICAL["MARGINOFERROR"] = "MARGINOFERROR";
|
|
9319
|
-
FUNCTION_NAMES_STATISTICAL["MAX"] = "MAX";
|
|
9320
|
-
FUNCTION_NAMES_STATISTICAL["MAXA"] = "MAXA";
|
|
9321
|
-
FUNCTION_NAMES_STATISTICAL["MAXIFS"] = "MAXIFS";
|
|
9322
|
-
FUNCTION_NAMES_STATISTICAL["MEDIAN"] = "MEDIAN";
|
|
9323
|
-
FUNCTION_NAMES_STATISTICAL["MIN"] = "MIN";
|
|
9324
|
-
FUNCTION_NAMES_STATISTICAL["MINA"] = "MINA";
|
|
9325
|
-
FUNCTION_NAMES_STATISTICAL["MINIFS"] = "MINIFS";
|
|
9326
|
-
FUNCTION_NAMES_STATISTICAL["MODE_MULT"] = "MODE.MULT";
|
|
9327
|
-
FUNCTION_NAMES_STATISTICAL["MODE_SNGL"] = "MODE.SNGL";
|
|
9328
|
-
FUNCTION_NAMES_STATISTICAL["NEGBINOM_DIST"] = "NEGBINOM.DIST";
|
|
9329
|
-
FUNCTION_NAMES_STATISTICAL["NORM_DIST"] = "NORM.DIST";
|
|
9330
|
-
FUNCTION_NAMES_STATISTICAL["NORM_INV"] = "NORM.INV";
|
|
9331
|
-
FUNCTION_NAMES_STATISTICAL["NORM_S_DIST"] = "NORM.S.DIST";
|
|
9332
|
-
FUNCTION_NAMES_STATISTICAL["NORM_S_INV"] = "NORM.S.INV";
|
|
9333
|
-
FUNCTION_NAMES_STATISTICAL["PEARSON"] = "PEARSON";
|
|
9334
|
-
FUNCTION_NAMES_STATISTICAL["PERCENTILE_EXC"] = "PERCENTILE.EXC";
|
|
9335
|
-
FUNCTION_NAMES_STATISTICAL["PERCENTILE_INC"] = "PERCENTILE.INC";
|
|
9336
|
-
FUNCTION_NAMES_STATISTICAL["PERCENTRANK_EXC"] = "PERCENTRANK.EXC";
|
|
9337
|
-
FUNCTION_NAMES_STATISTICAL["PERCENTRANK_INC"] = "PERCENTRANK.INC";
|
|
9338
|
-
FUNCTION_NAMES_STATISTICAL["PERMUT"] = "PERMUT";
|
|
9339
|
-
FUNCTION_NAMES_STATISTICAL["PERMUTATIONA"] = "PERMUTATIONA";
|
|
9340
|
-
FUNCTION_NAMES_STATISTICAL["PHI"] = "PHI";
|
|
9341
|
-
FUNCTION_NAMES_STATISTICAL["POISSON_DIST"] = "POISSON.DIST";
|
|
9342
|
-
FUNCTION_NAMES_STATISTICAL["PROB"] = "PROB";
|
|
9343
|
-
FUNCTION_NAMES_STATISTICAL["QUARTILE_EXC"] = "QUARTILE.EXC";
|
|
9344
|
-
FUNCTION_NAMES_STATISTICAL["QUARTILE_INC"] = "QUARTILE.INC";
|
|
9345
|
-
FUNCTION_NAMES_STATISTICAL["RANK_AVG"] = "RANK.AVG";
|
|
9346
|
-
FUNCTION_NAMES_STATISTICAL["RANK_EQ"] = "RANK.EQ";
|
|
9347
|
-
FUNCTION_NAMES_STATISTICAL["RSQ"] = "RSQ";
|
|
9348
|
-
FUNCTION_NAMES_STATISTICAL["SKEW"] = "SKEW";
|
|
9349
|
-
FUNCTION_NAMES_STATISTICAL["SKEW_P"] = "SKEW.P";
|
|
9350
|
-
FUNCTION_NAMES_STATISTICAL["SLOPE"] = "SLOPE";
|
|
9351
|
-
FUNCTION_NAMES_STATISTICAL["SMALL"] = "SMALL";
|
|
9352
|
-
FUNCTION_NAMES_STATISTICAL["STANDARDIZE"] = "STANDARDIZE";
|
|
9353
|
-
FUNCTION_NAMES_STATISTICAL["STDEV_P"] = "STDEV.P";
|
|
9354
|
-
FUNCTION_NAMES_STATISTICAL["STDEV_S"] = "STDEV.S";
|
|
9355
|
-
FUNCTION_NAMES_STATISTICAL["STDEVA"] = "STDEVA";
|
|
9356
|
-
FUNCTION_NAMES_STATISTICAL["STDEVPA"] = "STDEVPA";
|
|
9357
|
-
FUNCTION_NAMES_STATISTICAL["STEYX"] = "STEYX";
|
|
9358
|
-
FUNCTION_NAMES_STATISTICAL["T_DIST"] = "T.DIST";
|
|
9359
|
-
FUNCTION_NAMES_STATISTICAL["T_DIST_2T"] = "T.DIST.2T";
|
|
9360
|
-
FUNCTION_NAMES_STATISTICAL["T_DIST_RT"] = "T.DIST.RT";
|
|
9361
|
-
FUNCTION_NAMES_STATISTICAL["T_INV"] = "T.INV";
|
|
9362
|
-
FUNCTION_NAMES_STATISTICAL["T_INV_2T"] = "T.INV.2T";
|
|
9363
|
-
FUNCTION_NAMES_STATISTICAL["T_TEST"] = "T.TEST";
|
|
9364
|
-
FUNCTION_NAMES_STATISTICAL["TREND"] = "TREND";
|
|
9365
|
-
FUNCTION_NAMES_STATISTICAL["TRIMMEAN"] = "TRIMMEAN";
|
|
9366
|
-
FUNCTION_NAMES_STATISTICAL["VAR_P"] = "VAR.P";
|
|
9367
|
-
FUNCTION_NAMES_STATISTICAL["VAR_S"] = "VAR.S";
|
|
9368
|
-
FUNCTION_NAMES_STATISTICAL["VARA"] = "VARA";
|
|
9369
|
-
FUNCTION_NAMES_STATISTICAL["VARPA"] = "VARPA";
|
|
9370
|
-
FUNCTION_NAMES_STATISTICAL["WEIBULL_DIST"] = "WEIBULL.DIST";
|
|
9371
|
-
FUNCTION_NAMES_STATISTICAL["Z_TEST"] = "Z.TEST";
|
|
9372
|
-
return FUNCTION_NAMES_STATISTICAL;
|
|
9373
|
-
}({});
|
|
9719
|
+
//#region src/engine/ast-node/node-type.ts
|
|
9720
|
+
const NODE_ORDER_MAP = new Map([
|
|
9721
|
+
[1, 7],
|
|
9722
|
+
[2, 9],
|
|
9723
|
+
[3, 8],
|
|
9724
|
+
[4, 6],
|
|
9725
|
+
[5, 1],
|
|
9726
|
+
[6, 2],
|
|
9727
|
+
[9, 10],
|
|
9728
|
+
[10, 3],
|
|
9729
|
+
[11, 4],
|
|
9730
|
+
[12, 5]
|
|
9731
|
+
]);
|
|
9374
9732
|
|
|
9375
9733
|
//#endregion
|
|
9376
|
-
//#region src/
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9734
|
+
//#region src/engine/ast-node/base-ast-node.ts
|
|
9735
|
+
var BaseAstNode = class {
|
|
9736
|
+
constructor(_token) {
|
|
9737
|
+
this._token = _token;
|
|
9738
|
+
_defineProperty(this, "_children", []);
|
|
9739
|
+
_defineProperty(this, "_definedNames", void 0);
|
|
9740
|
+
_defineProperty(this, "_parent", void 0);
|
|
9741
|
+
_defineProperty(this, "_valueObject", void 0);
|
|
9742
|
+
_defineProperty(this, "_calculateState", false);
|
|
9743
|
+
_defineProperty(this, "_async", false);
|
|
9744
|
+
_defineProperty(this, "_address", false);
|
|
9745
|
+
_defineProperty(this, "_isForcedCalculateFunction", false);
|
|
9746
|
+
}
|
|
9747
|
+
dispose() {
|
|
9748
|
+
var _this$_valueObject;
|
|
9749
|
+
this._children.forEach((node) => {
|
|
9750
|
+
node.dispose();
|
|
9751
|
+
});
|
|
9752
|
+
(_this$_valueObject = this._valueObject) === null || _this$_valueObject === void 0 || _this$_valueObject.dispose();
|
|
9753
|
+
this._valueObject = null;
|
|
9754
|
+
this._children = [];
|
|
9755
|
+
this._definedNames = null;
|
|
9756
|
+
this._parent = null;
|
|
9757
|
+
}
|
|
9758
|
+
get nodeType() {
|
|
9759
|
+
return 8;
|
|
9760
|
+
}
|
|
9761
|
+
resetCalculationState() {
|
|
9762
|
+
this._children.forEach((node) => {
|
|
9763
|
+
node.resetCalculationState();
|
|
9764
|
+
});
|
|
9765
|
+
this._valueObject = null;
|
|
9766
|
+
this._calculateState = false;
|
|
9767
|
+
}
|
|
9768
|
+
isAsync() {
|
|
9769
|
+
return this._async;
|
|
9770
|
+
}
|
|
9771
|
+
isAddress() {
|
|
9772
|
+
return this._address;
|
|
9773
|
+
}
|
|
9774
|
+
isForcedCalculateFunction() {
|
|
9775
|
+
return this._isForcedCalculateFunction;
|
|
9776
|
+
}
|
|
9777
|
+
setAsync() {
|
|
9778
|
+
this._async = true;
|
|
9779
|
+
}
|
|
9780
|
+
setAddress() {
|
|
9781
|
+
this._address = true;
|
|
9782
|
+
}
|
|
9783
|
+
getParent() {
|
|
9784
|
+
return this._parent;
|
|
9785
|
+
}
|
|
9786
|
+
setParent(node) {
|
|
9787
|
+
this._parent = node;
|
|
9788
|
+
node.addChildren(this);
|
|
9789
|
+
}
|
|
9790
|
+
setForcedCalculateFunction() {
|
|
9791
|
+
this._isForcedCalculateFunction = true;
|
|
9792
|
+
}
|
|
9793
|
+
getChildren() {
|
|
9794
|
+
return this._children;
|
|
9795
|
+
}
|
|
9796
|
+
addChildren(...astNode) {
|
|
9797
|
+
this._children.push(...astNode);
|
|
9798
|
+
}
|
|
9799
|
+
getToken() {
|
|
9800
|
+
return this._token;
|
|
9801
|
+
}
|
|
9802
|
+
setValue(value) {
|
|
9803
|
+
this._valueObject = value;
|
|
9804
|
+
}
|
|
9805
|
+
getValue() {
|
|
9806
|
+
return this._valueObject;
|
|
9807
|
+
}
|
|
9808
|
+
isCalculated() {
|
|
9809
|
+
return this._calculateState;
|
|
9810
|
+
}
|
|
9811
|
+
setCalculated() {
|
|
9812
|
+
this._calculateState = true;
|
|
9813
|
+
}
|
|
9814
|
+
execute() {}
|
|
9815
|
+
setNotEmpty(state = true) {}
|
|
9816
|
+
async executeAsync() {
|
|
9817
|
+
return Promise.resolve(0);
|
|
9818
|
+
}
|
|
9819
|
+
serialize() {
|
|
9820
|
+
const token = this.getToken();
|
|
9821
|
+
const children = this.getChildren();
|
|
9822
|
+
const childrenSerialization = [];
|
|
9823
|
+
const childrenCount = children.length;
|
|
9824
|
+
for (let i = 0; i < childrenCount; i++) {
|
|
9825
|
+
const item = children[i];
|
|
9826
|
+
childrenSerialization.push(item.serialize());
|
|
9827
|
+
}
|
|
9828
|
+
const result = {
|
|
9829
|
+
token,
|
|
9830
|
+
nodeType: this.nodeType
|
|
9831
|
+
};
|
|
9832
|
+
if (childrenCount > 0) result.children = childrenSerialization;
|
|
9833
|
+
return result;
|
|
9834
|
+
}
|
|
9835
|
+
hasDefinedName(definedName) {
|
|
9836
|
+
var _this$_definedNames;
|
|
9837
|
+
return ((_this$_definedNames = this._definedNames) === null || _this$_definedNames === void 0 ? void 0 : _this$_definedNames.includes(definedName)) || false;
|
|
9838
|
+
}
|
|
9839
|
+
setDefinedNames(definedNames) {
|
|
9840
|
+
this._definedNames = definedNames;
|
|
9841
|
+
}
|
|
9842
|
+
getDefinedNames() {
|
|
9843
|
+
return this._definedNames;
|
|
9844
|
+
}
|
|
9845
|
+
};
|
|
9846
|
+
var ErrorNode = class ErrorNode extends BaseAstNode {
|
|
9847
|
+
constructor(errorType) {
|
|
9848
|
+
super(errorType);
|
|
9849
|
+
_defineProperty(this, "_errorValueObject", void 0);
|
|
9850
|
+
this._errorValueObject = ErrorValueObject.create(errorType);
|
|
9851
|
+
}
|
|
9852
|
+
get nodeType() {
|
|
9853
|
+
return 7;
|
|
9854
|
+
}
|
|
9855
|
+
static create(errorType) {
|
|
9856
|
+
return new ErrorNode(errorType);
|
|
9857
|
+
}
|
|
9858
|
+
getValue() {
|
|
9859
|
+
return this._errorValueObject;
|
|
9860
|
+
}
|
|
9861
|
+
};
|
|
9446
9862
|
|
|
9447
9863
|
//#endregion
|
|
9448
|
-
//#region src/
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9864
|
+
//#region src/engine/ast-node/base-ast-node-factory.ts
|
|
9865
|
+
var BaseAstNodeFactory = class {
|
|
9866
|
+
get zIndex() {
|
|
9867
|
+
return 0;
|
|
9868
|
+
}
|
|
9869
|
+
dispose() {}
|
|
9870
|
+
create(param, currentRow, currentColumn) {
|
|
9871
|
+
let token;
|
|
9872
|
+
if (param instanceof LexerNode) token = param.getToken();
|
|
9873
|
+
else token = param;
|
|
9874
|
+
return new BaseAstNode(token);
|
|
9875
|
+
}
|
|
9876
|
+
};
|
|
9877
|
+
|
|
9878
|
+
//#endregion
|
|
9879
|
+
//#region src/engine/ast-node/ast-root-node.ts
|
|
9880
|
+
var AstRootNode = class extends BaseAstNode {
|
|
9881
|
+
get nodeType() {
|
|
9882
|
+
return 9;
|
|
9883
|
+
}
|
|
9884
|
+
execute() {
|
|
9885
|
+
const children = this.getChildren();
|
|
9886
|
+
if (children.length > 1) {
|
|
9887
|
+
this.setValue(ErrorValueObject.create("#VALUE!"));
|
|
9888
|
+
return;
|
|
9889
|
+
}
|
|
9890
|
+
const node = children[0];
|
|
9891
|
+
if (node == null)
|
|
9892
|
+
/**
|
|
9893
|
+
* fix: https://github.com/dream-num/univer/issues/1415
|
|
9894
|
+
*/
|
|
9895
|
+
this.setValue(ErrorValueObject.create("#VALUE!"));
|
|
9896
|
+
else this.setValue(node.getValue());
|
|
9897
|
+
}
|
|
9898
|
+
};
|
|
9899
|
+
var AstRootNodeFactory = class extends BaseAstNodeFactory {
|
|
9900
|
+
get zIndex() {
|
|
9901
|
+
return NODE_ORDER_MAP.get(9) || 100;
|
|
9902
|
+
}
|
|
9903
|
+
checkAndCreateNodeType(param) {
|
|
9904
|
+
if (!(param instanceof LexerNode)) return;
|
|
9905
|
+
if (param.getToken() === "R_1") return new AstRootNode("R_1");
|
|
9906
|
+
}
|
|
9907
|
+
};
|
|
9470
9908
|
|
|
9471
9909
|
//#endregion
|
|
9472
9910
|
//#region src/functions/column-like-functions.ts
|
|
@@ -9493,7 +9931,8 @@ const FORMULA_CACHE_LRU_COUNT = 5e3;
|
|
|
9493
9931
|
const FORMULA_AST_CACHE = new FormulaAstLRU(FORMULA_CACHE_LRU_COUNT);
|
|
9494
9932
|
function generateAstNode(unitId, formulaString, lexer, astTreeBuilder, currentConfigService) {
|
|
9495
9933
|
let astNode = FORMULA_AST_CACHE.get(`${unitId}${formulaString}`);
|
|
9496
|
-
|
|
9934
|
+
const noCache = checkIsChangedByDefinedName(unitId, formulaString, currentConfigService);
|
|
9935
|
+
if (!noCache && astNode && !isDirtyDefinedForNode(astNode, currentConfigService)) return astNode;
|
|
9497
9936
|
const lexerNode = lexer.treeBuilder(formulaString);
|
|
9498
9937
|
if (ERROR_TYPE_SET.has(lexerNode)) return ErrorNode.create(lexerNode);
|
|
9499
9938
|
astNode = astTreeBuilder.parse(lexerNode);
|
|
@@ -9501,9 +9940,20 @@ function generateAstNode(unitId, formulaString, lexer, astTreeBuilder, currentCo
|
|
|
9501
9940
|
console.error("generateAstNode astNode is null");
|
|
9502
9941
|
return ErrorNode.create(lexerNode);
|
|
9503
9942
|
}
|
|
9504
|
-
FORMULA_AST_CACHE.set(`${unitId}${formulaString}`, astNode);
|
|
9943
|
+
if (!noCache) FORMULA_AST_CACHE.set(`${unitId}${formulaString}`, astNode);
|
|
9505
9944
|
return astNode;
|
|
9506
9945
|
}
|
|
9946
|
+
function checkIsChangedByDefinedName(unitId, formula, currentConfigService) {
|
|
9947
|
+
const unitDefinedNameMap = currentConfigService.getDirtyDefinedNameMap()[unitId];
|
|
9948
|
+
if (unitDefinedNameMap == null) return false;
|
|
9949
|
+
const formulaText = normalizeFormulaText(formula);
|
|
9950
|
+
const names = Object.keys(unitDefinedNameMap);
|
|
9951
|
+
for (let i = 0, len = names.length; i < len; i++) if (normalizeFormulaText(names[i]) === formulaText) return true;
|
|
9952
|
+
return false;
|
|
9953
|
+
}
|
|
9954
|
+
function normalizeFormulaText(formula) {
|
|
9955
|
+
return formula.startsWith("=") ? formula.slice(1) : formula;
|
|
9956
|
+
}
|
|
9507
9957
|
function isDirtyDefinedForNode(node, currentConfigService) {
|
|
9508
9958
|
const definedNameMap = currentConfigService.getDirtyDefinedNameMap();
|
|
9509
9959
|
const executeUnitId = currentConfigService.getExecuteUnitId();
|
|
@@ -11367,6 +11817,8 @@ var DependencyManagerBaseService = class extends _univerjs_core.Disposable {
|
|
|
11367
11817
|
updateDependencyTreeDirtyState(treeId, isDirty) {
|
|
11368
11818
|
throw new Error("Method not implemented.");
|
|
11369
11819
|
}
|
|
11820
|
+
openKdTree() {}
|
|
11821
|
+
closeKdTree() {}
|
|
11370
11822
|
};
|
|
11371
11823
|
/**
|
|
11372
11824
|
* Passively marked as dirty, register the reference and execution actions of the feature plugin.
|
|
@@ -11378,89 +11830,16 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11378
11830
|
constructor(..._args2) {
|
|
11379
11831
|
super(..._args2);
|
|
11380
11832
|
_defineProperty(this, "_allTreeMap", /* @__PURE__ */ new Map());
|
|
11381
|
-
|
|
11382
|
-
dispose() {
|
|
11383
|
-
super.dispose();
|
|
11384
|
-
this.reset();
|
|
11385
|
-
}
|
|
11386
|
-
buildDependencyTree(shouldBeBuildTrees, dependencyTrees = []) {
|
|
11387
|
-
const allTrees = this.getAllTree();
|
|
11388
|
-
if (shouldBeBuildTrees.length === 0) {
|
|
11389
|
-
this._buildReverseDependency(allTrees, dependencyTrees);
|
|
11390
|
-
return allTrees;
|
|
11391
|
-
}
|
|
11392
|
-
this._buildDependencyTree(allTrees, shouldBeBuildTrees);
|
|
11393
|
-
this._buildReverseDependency(allTrees, shouldBeBuildTrees);
|
|
11394
|
-
return allTrees;
|
|
11395
|
-
}
|
|
11396
|
-
/**
|
|
11397
|
-
* Build the dependency relationship between the trees.
|
|
11398
|
-
* @param allTrees all FormulaDependencyTree
|
|
11399
|
-
* @param shouldBeBuildTrees FormulaDependencyTree[] | FormulaDependencyTreeCache
|
|
11400
|
-
*/
|
|
11401
|
-
_buildDependencyTree(allTrees, shouldBeBuildTrees) {
|
|
11402
|
-
const shouldBeBuildTreeMap = /* @__PURE__ */ new Map();
|
|
11403
|
-
for (let i = 0; i < shouldBeBuildTrees.length; i++) {
|
|
11404
|
-
const tree = shouldBeBuildTrees[i];
|
|
11405
|
-
shouldBeBuildTreeMap.set(tree.treeId, tree);
|
|
11406
|
-
}
|
|
11407
|
-
for (let i = 0; i < allTrees.length; i++) {
|
|
11408
|
-
const tree = allTrees[i];
|
|
11409
|
-
const RTreeItem = tree.toRTreeItem();
|
|
11410
|
-
const searchResults = this._dependencyRTreeCache.bulkSearch(RTreeItem);
|
|
11411
|
-
for (const id of searchResults) {
|
|
11412
|
-
const shouldBeBuildTree = shouldBeBuildTreeMap.get(id);
|
|
11413
|
-
if (shouldBeBuildTree && tree !== shouldBeBuildTree && !shouldBeBuildTree.hasChildren(tree.treeId)) shouldBeBuildTree.pushChildren(tree);
|
|
11414
|
-
}
|
|
11415
|
-
}
|
|
11416
|
-
shouldBeBuildTreeMap.clear();
|
|
11417
|
-
}
|
|
11418
|
-
/**
|
|
11419
|
-
* Build the reverse dependency relationship between the trees.
|
|
11420
|
-
* @param allTrees
|
|
11421
|
-
* @param dependencyTrees
|
|
11422
|
-
*/
|
|
11423
|
-
_buildReverseDependency(allTrees, dependencyTrees) {
|
|
11424
|
-
const allTreeMap = /* @__PURE__ */ new Map();
|
|
11425
|
-
for (let i = 0; i < allTrees.length; i++) {
|
|
11426
|
-
const tree = allTrees[i];
|
|
11427
|
-
allTreeMap.set(tree.treeId, tree);
|
|
11428
|
-
}
|
|
11429
|
-
for (let i = 0; i < dependencyTrees.length; i++) {
|
|
11430
|
-
const tree = dependencyTrees[i];
|
|
11431
|
-
const RTreeItem = tree.toRTreeItem();
|
|
11432
|
-
const searchResults = this._dependencyRTreeCache.bulkSearch(RTreeItem);
|
|
11433
|
-
for (const id of searchResults) {
|
|
11434
|
-
const allTree = allTreeMap.get(id);
|
|
11435
|
-
if (allTree && tree !== allTree && !allTree.hasChildren(tree.treeId)) allTree.pushChildren(tree);
|
|
11436
|
-
}
|
|
11437
|
-
}
|
|
11438
|
-
allTreeMap.clear();
|
|
11439
|
-
}
|
|
11440
|
-
/**
|
|
11441
|
-
* Get all FormulaDependencyTree from _otherFormulaData, _featureFormulaData, _formulaData
|
|
11442
|
-
* return FormulaDependencyTree[]
|
|
11443
|
-
*/
|
|
11444
|
-
getAllTree() {
|
|
11445
|
-
const trees = [];
|
|
11446
|
-
this._allTreeMap.forEach((tree) => {
|
|
11447
|
-
tree.resetState();
|
|
11448
|
-
trees.push(tree);
|
|
11449
|
-
});
|
|
11450
|
-
return trees;
|
|
11451
|
-
}
|
|
11452
|
-
getTreeById(treeId) {
|
|
11453
|
-
return this._allTreeMap.get(treeId);
|
|
11833
|
+
_defineProperty(this, "_dependencyRTreeCache", new _univerjs_core.RTree(true));
|
|
11454
11834
|
}
|
|
11455
11835
|
reset() {
|
|
11456
11836
|
this._otherFormulaData.clear();
|
|
11457
11837
|
this._featureFormulaData.clear();
|
|
11458
11838
|
this._formulaData.clear();
|
|
11459
|
-
this._definedNameMap.clear();
|
|
11460
|
-
this._otherFormulaDataMainData.clear();
|
|
11461
11839
|
this._dependencyRTreeCache.clear();
|
|
11462
11840
|
this._allTreeMap.clear();
|
|
11463
11841
|
this._restDependencyTreeId();
|
|
11842
|
+
this._otherFormulaDataMainData.clear();
|
|
11464
11843
|
}
|
|
11465
11844
|
addOtherFormulaDependency(unitId, sheetId, formulaId, dependencyTree) {
|
|
11466
11845
|
if (!this._otherFormulaData.has(unitId)) this._otherFormulaData.set(unitId, /* @__PURE__ */ new Map());
|
|
@@ -11469,7 +11848,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11469
11848
|
const sheetMap = unitMap.get(sheetId);
|
|
11470
11849
|
if (!sheetMap.has(formulaId)) sheetMap.set(formulaId, new _univerjs_core.ObjectMatrix());
|
|
11471
11850
|
sheetMap.get(formulaId).setValue(dependencyTree.refOffsetX, dependencyTree.refOffsetY, dependencyTree.treeId);
|
|
11472
|
-
this._addAllTreeMap(dependencyTree);
|
|
11473
11851
|
}
|
|
11474
11852
|
removeOtherFormulaDependency(unitId, sheetId, formulaIds) {
|
|
11475
11853
|
const unitMap = this._otherFormulaData.get(unitId);
|
|
@@ -11480,7 +11858,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11480
11858
|
if (treeSet == null) return;
|
|
11481
11859
|
treeSet.forValue((row, column, treeId) => {
|
|
11482
11860
|
this._removeDependencyRTreeCache(treeId);
|
|
11483
|
-
this.clearDependencyForTree(this._allTreeMap.get(treeId));
|
|
11484
11861
|
this._removeAllTreeMap(treeId);
|
|
11485
11862
|
});
|
|
11486
11863
|
sheetMap.delete(formulaId);
|
|
@@ -11499,11 +11876,7 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11499
11876
|
const formulaTreeSet = sheetMap.get(formulaId);
|
|
11500
11877
|
if (formulaTreeSet == null) continue;
|
|
11501
11878
|
formulaTreeSet.forValue((row, column, treeId) => {
|
|
11502
|
-
|
|
11503
|
-
if (tree) {
|
|
11504
|
-
this.clearDependencyForTree(tree);
|
|
11505
|
-
this._removeAllTreeMap(treeId);
|
|
11506
|
-
}
|
|
11879
|
+
if (this._allTreeMap.get(treeId)) this._removeAllTreeMap(treeId);
|
|
11507
11880
|
});
|
|
11508
11881
|
this._otherFormulaDataMainData.delete(formulaId);
|
|
11509
11882
|
}
|
|
@@ -11516,11 +11889,7 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11516
11889
|
const formulaTreeSet = sheetMap.get(formulaId);
|
|
11517
11890
|
if (formulaTreeSet == null) continue;
|
|
11518
11891
|
formulaTreeSet.forValue((row, column, treeId) => {
|
|
11519
|
-
|
|
11520
|
-
if (tree) {
|
|
11521
|
-
this.clearDependencyForTree(tree);
|
|
11522
|
-
this._removeAllTreeMap(treeId);
|
|
11523
|
-
}
|
|
11892
|
+
if (this._allTreeMap.get(treeId)) this._removeAllTreeMap(treeId);
|
|
11524
11893
|
});
|
|
11525
11894
|
this._otherFormulaDataMainData.delete(formulaId);
|
|
11526
11895
|
}
|
|
@@ -11533,7 +11902,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11533
11902
|
const unitMap = this._featureFormulaData.get(unitId);
|
|
11534
11903
|
if (!unitMap.has(sheetId)) unitMap.set(sheetId, /* @__PURE__ */ new Map());
|
|
11535
11904
|
unitMap.get(sheetId).set(featureId, dependencyTree.treeId);
|
|
11536
|
-
this._addAllTreeMap(dependencyTree);
|
|
11537
11905
|
}
|
|
11538
11906
|
removeFeatureFormulaDependency(unitId, sheetId, featureIds) {
|
|
11539
11907
|
const unitMap = this._featureFormulaData.get(unitId);
|
|
@@ -11544,7 +11912,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11544
11912
|
if (deleteTreeId == null) return;
|
|
11545
11913
|
this._removeDependencyRTreeCache(deleteTreeId);
|
|
11546
11914
|
sheetMap.delete(featureId);
|
|
11547
|
-
this.clearDependencyForTree(this._allTreeMap.get(deleteTreeId));
|
|
11548
11915
|
this._removeAllTreeMap(deleteTreeId);
|
|
11549
11916
|
});
|
|
11550
11917
|
}
|
|
@@ -11556,7 +11923,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11556
11923
|
this._removeDependencyRTreeCacheById(unitId, sheetId);
|
|
11557
11924
|
sheetMap.forEach((featureTreeId) => {
|
|
11558
11925
|
if (featureTreeId == null) return;
|
|
11559
|
-
this.clearDependencyForTree(this._allTreeMap.get(featureTreeId));
|
|
11560
11926
|
this._removeAllTreeMap(featureTreeId);
|
|
11561
11927
|
});
|
|
11562
11928
|
sheetMap.clear();
|
|
@@ -11565,7 +11931,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11565
11931
|
this._removeDependencyRTreeCacheById(unitId, sheetId);
|
|
11566
11932
|
sheetMap.forEach((featureTreeId) => {
|
|
11567
11933
|
if (featureTreeId == null) return;
|
|
11568
|
-
this.clearDependencyForTree(this._allTreeMap.get(featureTreeId));
|
|
11569
11934
|
this._removeAllTreeMap(featureTreeId);
|
|
11570
11935
|
});
|
|
11571
11936
|
});
|
|
@@ -11577,7 +11942,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11577
11942
|
const unitMap = this._formulaData.get(unitId);
|
|
11578
11943
|
if (!unitMap.has(sheetId)) unitMap.set(sheetId, new _univerjs_core.ObjectMatrix());
|
|
11579
11944
|
unitMap.get(sheetId).setValue(row, column, dependencyTree.treeId);
|
|
11580
|
-
this._addAllTreeMap(dependencyTree);
|
|
11581
11945
|
}
|
|
11582
11946
|
removeFormulaDependency(unitId, sheetId, row, column) {
|
|
11583
11947
|
const unitMap = this._formulaData.get(unitId);
|
|
@@ -11587,7 +11951,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11587
11951
|
if (deleteTreeId == null) return;
|
|
11588
11952
|
this._removeDependencyRTreeCache(deleteTreeId);
|
|
11589
11953
|
sheetMatrix.realDeleteValue(row, column);
|
|
11590
|
-
this.clearDependencyForTree(this._allTreeMap.get(deleteTreeId));
|
|
11591
11954
|
this._removeAllTreeMap(deleteTreeId);
|
|
11592
11955
|
}
|
|
11593
11956
|
}
|
|
@@ -11598,7 +11961,6 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11598
11961
|
this._removeDependencyRTreeCacheById(unitId, sheetId);
|
|
11599
11962
|
sheetMatrix.forValue((row, column, treeId) => {
|
|
11600
11963
|
if (treeId == null) return true;
|
|
11601
|
-
this.clearDependencyForTree(this._allTreeMap.get(treeId));
|
|
11602
11964
|
this._removeAllTreeMap(treeId);
|
|
11603
11965
|
});
|
|
11604
11966
|
sheetMatrix.reset();
|
|
@@ -11607,47 +11969,23 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11607
11969
|
this._removeDependencyRTreeCacheById(unitId, sheetId);
|
|
11608
11970
|
sheetMatrix.forValue((row, column, treeId) => {
|
|
11609
11971
|
if (treeId == null) return true;
|
|
11610
|
-
this.clearDependencyForTree(this._allTreeMap.get(treeId));
|
|
11611
11972
|
this._removeAllTreeMap(treeId);
|
|
11612
11973
|
});
|
|
11613
11974
|
});
|
|
11614
11975
|
this._formulaData.delete(unitId);
|
|
11615
11976
|
}
|
|
11616
11977
|
}
|
|
11617
|
-
/**
|
|
11618
|
-
* Clear the dependency relationship of the tree.
|
|
11619
|
-
* establish the relationship between the parent and the child.
|
|
11620
|
-
* @param shouldBeClearTree
|
|
11621
|
-
*/
|
|
11622
|
-
clearDependencyForTree(shouldBeClearTree) {
|
|
11623
|
-
if (shouldBeClearTree == null) return;
|
|
11624
|
-
const parents = shouldBeClearTree.parents;
|
|
11625
|
-
const children = shouldBeClearTree.children;
|
|
11626
|
-
const allTreeMap = this._allTreeMap;
|
|
11627
|
-
for (const parentTreeId of parents) {
|
|
11628
|
-
const parent = allTreeMap.get(parentTreeId);
|
|
11629
|
-
parent === null || parent === void 0 || parent.children.delete(shouldBeClearTree.treeId);
|
|
11630
|
-
}
|
|
11631
|
-
for (const childTreeId of children) {
|
|
11632
|
-
const child = allTreeMap.get(childTreeId);
|
|
11633
|
-
child === null || child === void 0 || child.parents.delete(shouldBeClearTree.treeId);
|
|
11634
|
-
}
|
|
11635
|
-
shouldBeClearTree.dispose();
|
|
11636
|
-
}
|
|
11637
11978
|
_removeDependencyRTreeCache(treeId) {
|
|
11638
11979
|
if (treeId == null) return;
|
|
11639
11980
|
const treeRangeMap = this._allTreeMap.get(treeId);
|
|
11640
11981
|
if (treeRangeMap) {
|
|
11641
11982
|
const searchRanges = [];
|
|
11642
|
-
for (
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
id: treeId
|
|
11649
|
-
});
|
|
11650
|
-
}
|
|
11983
|
+
for (const [unitId, sheetMap] of treeRangeMap) for (const [sheetId, range] of sheetMap) searchRanges.push({
|
|
11984
|
+
unitId,
|
|
11985
|
+
sheetId,
|
|
11986
|
+
range,
|
|
11987
|
+
id: treeId
|
|
11988
|
+
});
|
|
11651
11989
|
this._dependencyRTreeCache.bulkRemove(searchRanges);
|
|
11652
11990
|
}
|
|
11653
11991
|
}
|
|
@@ -11658,23 +11996,100 @@ var DependencyManagerService = class extends DependencyManagerBaseService {
|
|
|
11658
11996
|
if (treeSet) {
|
|
11659
11997
|
for (const treeId of treeSet) {
|
|
11660
11998
|
this._removeDependencyRTreeCache(treeId);
|
|
11661
|
-
this.clearDependencyForTree(this._allTreeMap.get(treeId));
|
|
11662
11999
|
this._removeAllTreeMap(treeId);
|
|
11663
12000
|
}
|
|
11664
12001
|
treeSet.clear();
|
|
11665
12002
|
}
|
|
11666
12003
|
}
|
|
11667
12004
|
}
|
|
12005
|
+
openKdTree() {
|
|
12006
|
+
this._dependencyRTreeCache.openKdTree();
|
|
12007
|
+
}
|
|
12008
|
+
closeKdTree() {
|
|
12009
|
+
this._dependencyRTreeCache.closeKdTree();
|
|
12010
|
+
}
|
|
11668
12011
|
_removeAllTreeMap(treeId) {
|
|
11669
12012
|
if (treeId == null) return;
|
|
11670
12013
|
this._allTreeMap.delete(treeId);
|
|
11671
12014
|
}
|
|
11672
12015
|
_addAllTreeMap(tree) {
|
|
11673
|
-
|
|
12016
|
+
const rangeList = tree.rangeList;
|
|
12017
|
+
let oldTreeMap = this._allTreeMap.get(tree.treeId);
|
|
12018
|
+
for (let i = 0; i < rangeList.length; i++) {
|
|
12019
|
+
var _oldTreeMap$get, _oldTreeMap$get2;
|
|
12020
|
+
let { unitId, sheetId, range } = rangeList[i];
|
|
12021
|
+
if (!oldTreeMap) {
|
|
12022
|
+
oldTreeMap = /* @__PURE__ */ new Map();
|
|
12023
|
+
this._allTreeMap.set(tree.treeId, oldTreeMap);
|
|
12024
|
+
}
|
|
12025
|
+
if (!oldTreeMap.has(unitId)) oldTreeMap.set(unitId, /* @__PURE__ */ new Map());
|
|
12026
|
+
const oldRange = oldTreeMap === null || oldTreeMap === void 0 || (_oldTreeMap$get = oldTreeMap.get(unitId)) === null || _oldTreeMap$get === void 0 ? void 0 : _oldTreeMap$get.get(sheetId);
|
|
12027
|
+
if (oldRange) range = {
|
|
12028
|
+
startRow: Math.min(range.startRow, oldRange.startRow),
|
|
12029
|
+
startColumn: Math.min(range.startColumn, oldRange.startColumn),
|
|
12030
|
+
endRow: Math.max(range.endRow, oldRange.endRow),
|
|
12031
|
+
endColumn: Math.max(range.endColumn, oldRange.endColumn)
|
|
12032
|
+
};
|
|
12033
|
+
(_oldTreeMap$get2 = oldTreeMap.get(unitId)) === null || _oldTreeMap$get2 === void 0 || _oldTreeMap$get2.set(sheetId, range);
|
|
12034
|
+
}
|
|
11674
12035
|
}
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
12036
|
+
dispose() {
|
|
12037
|
+
super.dispose();
|
|
12038
|
+
this.reset();
|
|
12039
|
+
}
|
|
12040
|
+
buildDependencyTree(shouldBeBuildTrees, dependencyTrees = []) {
|
|
12041
|
+
const allTrees = this.getAllTree();
|
|
12042
|
+
if (shouldBeBuildTrees.length === 0) {
|
|
12043
|
+
this._buildReverseDependency(allTrees, dependencyTrees);
|
|
12044
|
+
return allTrees;
|
|
12045
|
+
}
|
|
12046
|
+
this._buildDependencyTree(allTrees, shouldBeBuildTrees);
|
|
12047
|
+
this._buildReverseDependency(allTrees, shouldBeBuildTrees);
|
|
12048
|
+
return allTrees;
|
|
12049
|
+
}
|
|
12050
|
+
/**
|
|
12051
|
+
* Build the dependency relationship between the trees.
|
|
12052
|
+
* @param allTrees all FormulaDependencyTree
|
|
12053
|
+
* @param shouldBeBuildTrees FormulaDependencyTree[] | FormulaDependencyTreeCache
|
|
12054
|
+
*/
|
|
12055
|
+
_buildDependencyTree(allTrees, shouldBeBuildTrees) {
|
|
12056
|
+
const shouldBeBuildTreeMap = /* @__PURE__ */ new Map();
|
|
12057
|
+
for (let i = 0; i < shouldBeBuildTrees.length; i++) {
|
|
12058
|
+
const tree = shouldBeBuildTrees[i];
|
|
12059
|
+
shouldBeBuildTreeMap.set(tree.treeId, tree);
|
|
12060
|
+
}
|
|
12061
|
+
for (let i = 0; i < allTrees.length; i++) {
|
|
12062
|
+
const tree = allTrees[i];
|
|
12063
|
+
const RTreeItem = tree.toRTreeItem();
|
|
12064
|
+
const searchResults = this._dependencyRTreeCache.bulkSearch(RTreeItem);
|
|
12065
|
+
for (const id of searchResults) {
|
|
12066
|
+
const shouldBeBuildTree = shouldBeBuildTreeMap.get(id);
|
|
12067
|
+
if (shouldBeBuildTree && tree !== shouldBeBuildTree && !shouldBeBuildTree.hasChildren(tree.treeId)) shouldBeBuildTree.pushChildren(tree);
|
|
12068
|
+
}
|
|
12069
|
+
}
|
|
12070
|
+
shouldBeBuildTreeMap.clear();
|
|
12071
|
+
}
|
|
12072
|
+
/**
|
|
12073
|
+
* Build the reverse dependency relationship between the trees.
|
|
12074
|
+
* @param allTrees
|
|
12075
|
+
* @param dependencyTrees
|
|
12076
|
+
*/
|
|
12077
|
+
_buildReverseDependency(allTrees, dependencyTrees) {
|
|
12078
|
+
const allTreeMap = /* @__PURE__ */ new Map();
|
|
12079
|
+
for (let i = 0; i < allTrees.length; i++) {
|
|
12080
|
+
const tree = allTrees[i];
|
|
12081
|
+
allTreeMap.set(tree.treeId, tree);
|
|
12082
|
+
}
|
|
12083
|
+
for (let i = 0; i < dependencyTrees.length; i++) {
|
|
12084
|
+
const tree = dependencyTrees[i];
|
|
12085
|
+
const RTreeItem = tree.toRTreeItem();
|
|
12086
|
+
const searchResults = this._dependencyRTreeCache.bulkSearch(RTreeItem);
|
|
12087
|
+
for (const id of searchResults) {
|
|
12088
|
+
const allTree = allTreeMap.get(id);
|
|
12089
|
+
if (allTree && tree !== allTree && !allTree.hasChildren(tree.treeId)) allTree.pushChildren(tree);
|
|
12090
|
+
}
|
|
12091
|
+
}
|
|
12092
|
+
allTreeMap.clear();
|
|
11678
12093
|
}
|
|
11679
12094
|
};
|
|
11680
12095
|
const IDependencyManagerService = (0, _univerjs_core.createIdentifier)("univer.formula.dependency-manager.service");
|
|
@@ -12217,12 +12632,14 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12217
12632
|
this._lexerTreeBuilder = _lexerTreeBuilder;
|
|
12218
12633
|
_defineProperty(this, "_updateRangeFlattenCache", /* @__PURE__ */ new Map());
|
|
12219
12634
|
_defineProperty(this, "_dependencyRTreeCacheForAddressFunction", new _univerjs_core.RTree());
|
|
12635
|
+
_defineProperty(this, "_dependencyTreeCache", /* @__PURE__ */ new Map());
|
|
12220
12636
|
_defineProperty(this, "_executedAddressFunctionNodeIds", /* @__PURE__ */ new Set());
|
|
12221
12637
|
_defineProperty(this, "_formulaDependencyTreeModel", /* @__PURE__ */ new Map());
|
|
12222
12638
|
this._initUnitDispose();
|
|
12223
12639
|
}
|
|
12224
12640
|
dispose() {
|
|
12225
12641
|
super.dispose();
|
|
12642
|
+
this._dependencyTreeCache.clear();
|
|
12226
12643
|
this._updateRangeFlattenCache.clear();
|
|
12227
12644
|
this._dependencyRTreeCacheForAddressFunction.clear();
|
|
12228
12645
|
FORMULA_AST_CACHE.clear();
|
|
@@ -12252,87 +12669,301 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12252
12669
|
});
|
|
12253
12670
|
});
|
|
12254
12671
|
const unitData = this._currentConfigService.getUnitData();
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
const updateTreeList = this._getUpdateTreeListAndMakeDependency(
|
|
12258
|
-
|
|
12259
|
-
if (this._dependencyFeatureCalculation(finalTreeList)) {
|
|
12260
|
-
finalTreeList.forEach((tree) => {
|
|
12261
|
-
tree.resetState();
|
|
12262
|
-
});
|
|
12263
|
-
finalTreeList = this._calculateRunList(finalTreeList);
|
|
12264
|
-
}
|
|
12672
|
+
await this._generateTreeList(formulaData, otherFormulaData, unitData);
|
|
12673
|
+
this._dependencyManagerService.openKdTree();
|
|
12674
|
+
const updateTreeList = this._getUpdateTreeListAndMakeDependency();
|
|
12675
|
+
const finalTreeList = this._calculateRunList(updateTreeList);
|
|
12265
12676
|
if (this._checkIsCycleDependency(finalTreeList)) this._runtimeService.enableCycleDependency();
|
|
12677
|
+
if (isCalculateTreeModel) this._runtimeService.setDependencyTreeModelData(this._getAllDependencyJson(Array.from(this._dependencyTreeCache.values())));
|
|
12678
|
+
this._dependencyTreeCache.clear();
|
|
12266
12679
|
this._dependencyRTreeCacheForAddressFunction.clear();
|
|
12680
|
+
this._dependencyManagerService.closeKdTree();
|
|
12267
12681
|
this._runtimeService.clearArrayObjectCache();
|
|
12268
12682
|
return Promise.resolve(finalTreeList);
|
|
12269
12683
|
}
|
|
12270
|
-
|
|
12271
|
-
const
|
|
12272
|
-
|
|
12684
|
+
_isCyclicUtilMap(treeId, colorMap) {
|
|
12685
|
+
const WHITE = 0;
|
|
12686
|
+
const GRAY = 1;
|
|
12687
|
+
const BLACK = 2;
|
|
12688
|
+
const stack = [treeId];
|
|
12689
|
+
while (stack.length > 0) {
|
|
12690
|
+
const currentTreeId = stack[stack.length - 1];
|
|
12691
|
+
if ((colorMap.get(currentTreeId) || WHITE) === WHITE) {
|
|
12692
|
+
colorMap.set(currentTreeId, GRAY);
|
|
12693
|
+
const node = this._dependencyTreeCache.get(currentTreeId);
|
|
12694
|
+
if (node == null) {
|
|
12695
|
+
colorMap.set(currentTreeId, BLACK);
|
|
12696
|
+
stack.pop();
|
|
12697
|
+
continue;
|
|
12698
|
+
}
|
|
12699
|
+
const parents = this._dependencyManagerService.searchDependency(node.toRTreeItem());
|
|
12700
|
+
for (const parentTreeId of parents) {
|
|
12701
|
+
const parentColor = colorMap.get(parentTreeId) || WHITE;
|
|
12702
|
+
if (parentColor === GRAY) return true;
|
|
12703
|
+
else if (parentColor === WHITE) stack.push(parentTreeId);
|
|
12704
|
+
}
|
|
12705
|
+
} else {
|
|
12706
|
+
colorMap.set(currentTreeId, BLACK);
|
|
12707
|
+
stack.pop();
|
|
12708
|
+
}
|
|
12709
|
+
}
|
|
12710
|
+
return false;
|
|
12711
|
+
}
|
|
12712
|
+
_checkIsCycleDependency(treeList) {
|
|
12713
|
+
const colorMap = /* @__PURE__ */ new Map();
|
|
12714
|
+
for (const tree of treeList) if (!colorMap.has(tree.treeId)) {
|
|
12715
|
+
if (this._isCyclicUtilMap(tree.treeId, colorMap)) return true;
|
|
12716
|
+
}
|
|
12717
|
+
colorMap.clear();
|
|
12718
|
+
return false;
|
|
12719
|
+
}
|
|
12720
|
+
_getFeatureFormulaTree(featureId, treeId, params) {
|
|
12721
|
+
const { unitId, subUnitId, dependencyRanges, getDirtyData } = params;
|
|
12722
|
+
const FDtree = new FormulaDependencyTree(treeId || generateRandomDependencyTreeId(this._dependencyManagerService));
|
|
12723
|
+
FDtree.unitId = unitId;
|
|
12724
|
+
FDtree.subUnitId = subUnitId;
|
|
12725
|
+
FDtree.rangeList = dependencyRanges;
|
|
12726
|
+
FDtree.getDirtyData = getDirtyData;
|
|
12727
|
+
const allDependency = getDirtyData(this._currentConfigService.getDirtyData(), this._runtimeService.getAllRuntimeData());
|
|
12728
|
+
FDtree.featureDirtyRanges = this._convertDirtyRangesToUnitRange(allDependency.dirtyRanges);
|
|
12729
|
+
FDtree.featureId = featureId;
|
|
12730
|
+
FDtree.type = 2;
|
|
12731
|
+
this._dependencyManagerService.addFeatureFormulaDependency(unitId, subUnitId, featureId, FDtree);
|
|
12732
|
+
this._dependencyTreeCache.set(FDtree.treeId, FDtree);
|
|
12733
|
+
if (this._dependencyManagerService.getFeatureFormulaDependency(params.unitId, params.subUnitId, featureId)) FDtree.isCache = true;
|
|
12734
|
+
return FDtree;
|
|
12735
|
+
}
|
|
12736
|
+
_registerOtherFormulas(otherFormulaData, otherFormulaDataKeys, treeList) {
|
|
12273
12737
|
/**
|
|
12274
|
-
*
|
|
12275
|
-
* Because each execution requires rebuilding the reverse dependencies,
|
|
12276
|
-
* the previous dependencies may become outdated due to data changes in applications such as pivot tables,
|
|
12277
|
-
* which can result in an outdated dirty mark range.
|
|
12738
|
+
* Register formulas in doc, slide, and other types of applications.
|
|
12278
12739
|
*/
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
}
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12740
|
+
for (const unitId of otherFormulaDataKeys) {
|
|
12741
|
+
const subComponentData = otherFormulaData[unitId];
|
|
12742
|
+
if (subComponentData == null) continue;
|
|
12743
|
+
const subComponentKeys = Object.keys(subComponentData);
|
|
12744
|
+
for (const subUnitId of subComponentKeys) {
|
|
12745
|
+
const subFormulaData = subComponentData[subUnitId];
|
|
12746
|
+
if (subFormulaData == null) continue;
|
|
12747
|
+
const { rowCount = Infinity, columnCount = Infinity } = this._currentConfigService.getSheetRowColumnCount(unitId, subUnitId) || {};
|
|
12748
|
+
const subFormulaDataKeys = Object.keys(subFormulaData);
|
|
12749
|
+
for (const subFormulaDataId of subFormulaDataKeys) {
|
|
12750
|
+
var _treeMatrix$getValue;
|
|
12751
|
+
const hasOtherFormula = this._dependencyManagerService.hasOtherFormulaDataMainData(subFormulaDataId);
|
|
12752
|
+
const { f: formulaString, ranges } = subFormulaData[subFormulaDataId];
|
|
12753
|
+
let isCache = false;
|
|
12754
|
+
if (hasOtherFormula) isCache = true;
|
|
12755
|
+
const { firstRow, firstColumn } = this._getFirstCellOfRange(ranges);
|
|
12756
|
+
const treeMatrix = this._dependencyManagerService.getOtherFormulaDependency(unitId, subUnitId, subFormulaDataId);
|
|
12757
|
+
const firstFDtree = new FormulaDependencyTree((_treeMatrix$getValue = treeMatrix === null || treeMatrix === void 0 ? void 0 : treeMatrix.getValue(0, 0)) !== null && _treeMatrix$getValue !== void 0 ? _treeMatrix$getValue : generateRandomDependencyTreeId(this._dependencyManagerService));
|
|
12758
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
12759
|
+
const range = ranges[i];
|
|
12760
|
+
const { startRow, startColumn } = range;
|
|
12761
|
+
let { endRow, endColumn } = range;
|
|
12762
|
+
endRow = Math.min(endRow, rowCount - 1);
|
|
12763
|
+
endColumn = Math.min(endColumn, columnCount - 1);
|
|
12764
|
+
for (let r = startRow; r <= endRow; r++) for (let c = startColumn; c <= endColumn; c++) {
|
|
12765
|
+
const x = c - firstColumn;
|
|
12766
|
+
const y = r - firstRow;
|
|
12767
|
+
if (x === 0 && y === 0) {
|
|
12768
|
+
firstFDtree.formula = formulaString;
|
|
12769
|
+
firstFDtree.unitId = unitId;
|
|
12770
|
+
firstFDtree.subUnitId = subUnitId;
|
|
12771
|
+
firstFDtree.formulaId = subFormulaDataId;
|
|
12772
|
+
firstFDtree.type = 1;
|
|
12773
|
+
firstFDtree.isCache = isCache;
|
|
12774
|
+
treeList.push(firstFDtree);
|
|
12775
|
+
this._dependencyTreeCache.set(firstFDtree.treeId, firstFDtree);
|
|
12776
|
+
this._dependencyManagerService.addOtherFormulaDependency(unitId, subUnitId, subFormulaDataId, firstFDtree);
|
|
12777
|
+
this._dependencyManagerService.addFormulaDependencyByDefinedName(firstFDtree);
|
|
12778
|
+
continue;
|
|
12779
|
+
}
|
|
12780
|
+
const virtual = new FormulaDependencyTreeVirtual();
|
|
12781
|
+
virtual.treeId = (treeMatrix === null || treeMatrix === void 0 ? void 0 : treeMatrix.getValue(x, y)) || generateRandomDependencyTreeId(this._dependencyManagerService);
|
|
12782
|
+
virtual.refTree = firstFDtree;
|
|
12783
|
+
virtual.refOffsetX = x;
|
|
12784
|
+
virtual.refOffsetY = y;
|
|
12785
|
+
virtual.isCache = isCache;
|
|
12786
|
+
virtual.type = 1;
|
|
12787
|
+
this._dependencyManagerService.addOtherFormulaDependency(unitId, subUnitId, subFormulaDataId, virtual);
|
|
12788
|
+
this._dependencyManagerService.addFormulaDependencyByDefinedName(virtual);
|
|
12789
|
+
treeList.push(virtual);
|
|
12790
|
+
this._dependencyTreeCache.set(virtual.treeId, virtual);
|
|
12301
12791
|
}
|
|
12302
|
-
featureTree.parents = /* @__PURE__ */ new Set();
|
|
12303
|
-
intersectTrees.forEach((tree) => {
|
|
12304
|
-
if (tree.hasChildren(featureTree.treeId)) return;
|
|
12305
|
-
tree.pushChildren(featureTree);
|
|
12306
|
-
});
|
|
12307
|
-
hasFeatureCalculation = true;
|
|
12308
12792
|
}
|
|
12793
|
+
this._dependencyManagerService.addOtherFormulaDependencyMainData(subFormulaDataId);
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12796
|
+
}
|
|
12797
|
+
}
|
|
12798
|
+
_registerFormulas(formulaDataKeys, formulaData, unitData, treeList) {
|
|
12799
|
+
/**
|
|
12800
|
+
* Register formulas in the sheet.
|
|
12801
|
+
*/
|
|
12802
|
+
for (const unitId of formulaDataKeys) {
|
|
12803
|
+
const sheetData = formulaData[unitId];
|
|
12804
|
+
if (sheetData == null) continue;
|
|
12805
|
+
const sheetDataKeys = Object.keys(sheetData);
|
|
12806
|
+
for (const sheetId of sheetDataKeys) {
|
|
12807
|
+
const matrixData = new _univerjs_core.ObjectMatrix(sheetData[sheetId] || {});
|
|
12808
|
+
const sIdCache = /* @__PURE__ */ new Map();
|
|
12809
|
+
matrixData.forValue((row, column, formulaDataItem) => {
|
|
12810
|
+
if (formulaDataItem == null) return true;
|
|
12811
|
+
const { x = 0, y = 0, si } = formulaDataItem;
|
|
12812
|
+
if (!(x === 0 && y === 0 && si != null)) return true;
|
|
12813
|
+
const FDtree = this._createFDtree(unitId, sheetId, row, column, unitData, formulaDataItem);
|
|
12814
|
+
const treeId = this._dependencyManagerService.getFormulaDependency(unitId, sheetId, row, column);
|
|
12815
|
+
if (treeId != null) FDtree.treeId = treeId;
|
|
12816
|
+
else {
|
|
12817
|
+
this._dependencyManagerService.addFormulaDependency(unitId, sheetId, row, column, FDtree);
|
|
12818
|
+
this._dependencyManagerService.addFormulaDependencyByDefinedName(FDtree);
|
|
12819
|
+
}
|
|
12820
|
+
sIdCache.set(si, FDtree);
|
|
12821
|
+
treeList.push(FDtree);
|
|
12822
|
+
this._dependencyTreeCache.set(FDtree.treeId, FDtree);
|
|
12309
12823
|
});
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12824
|
+
matrixData.forValue((row, column, formulaDataItem) => {
|
|
12825
|
+
if (formulaDataItem == null) return true;
|
|
12826
|
+
const { x = 0, y = 0, si } = formulaDataItem;
|
|
12827
|
+
if (x === 0 && y === 0 && si != null) return true;
|
|
12828
|
+
let FDtree;
|
|
12829
|
+
if (si && sIdCache.has(si)) {
|
|
12830
|
+
const cache = sIdCache.get(si);
|
|
12831
|
+
FDtree = this._createVirtualFDtree(cache, formulaDataItem);
|
|
12832
|
+
} else FDtree = this._createFDtree(unitId, sheetId, row, column, unitData, formulaDataItem);
|
|
12833
|
+
const treeId = this._dependencyManagerService.getFormulaDependency(unitId, sheetId, row, column);
|
|
12834
|
+
if (treeId != null) FDtree.treeId = treeId;
|
|
12835
|
+
else {
|
|
12836
|
+
this._dependencyManagerService.addFormulaDependency(unitId, sheetId, row, column, FDtree);
|
|
12837
|
+
this._dependencyManagerService.addFormulaDependencyByDefinedName(FDtree);
|
|
12838
|
+
}
|
|
12839
|
+
treeList.push(FDtree);
|
|
12840
|
+
this._dependencyTreeCache.set(FDtree.treeId, FDtree);
|
|
12841
|
+
});
|
|
12842
|
+
sIdCache.clear();
|
|
12843
|
+
}
|
|
12844
|
+
}
|
|
12845
|
+
}
|
|
12846
|
+
_createFDtree(unitId, sheetId, row, column, unitData, formulaDataItem) {
|
|
12847
|
+
const { f: formulaString, x = 0, y = 0 } = formulaDataItem;
|
|
12848
|
+
const FDtree = new FormulaDependencyTree(generateRandomDependencyTreeId(this._dependencyManagerService));
|
|
12849
|
+
const sheetItem = unitData[unitId][sheetId];
|
|
12850
|
+
FDtree.formula = formulaString;
|
|
12851
|
+
FDtree.unitId = unitId;
|
|
12852
|
+
FDtree.subUnitId = sheetId;
|
|
12853
|
+
FDtree.row = row;
|
|
12854
|
+
FDtree.column = column;
|
|
12855
|
+
FDtree.rowCount = sheetItem.rowCount;
|
|
12856
|
+
FDtree.columnCount = sheetItem.columnCount;
|
|
12857
|
+
return FDtree;
|
|
12313
12858
|
}
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12859
|
+
/**
|
|
12860
|
+
* Build a formula dependency tree based on the dependency relationships.
|
|
12861
|
+
* @param treeList
|
|
12862
|
+
*/
|
|
12863
|
+
_getUpdateTreeListAndMakeDependency() {
|
|
12864
|
+
const newTreeList = [];
|
|
12865
|
+
const existTree = /* @__PURE__ */ new Set();
|
|
12866
|
+
const forceCalculate = this._currentConfigService.isForceCalculate();
|
|
12867
|
+
const dirtyRanges = this._currentConfigService.getDirtyRanges();
|
|
12868
|
+
const treeIds = this._dependencyManagerService.searchDependency(dirtyRanges);
|
|
12869
|
+
const addressSearchResults = this._dependencyRTreeCacheForAddressFunction.bulkSearch(dirtyRanges);
|
|
12870
|
+
for (const addressSearchResult of addressSearchResults) treeIds.add(addressSearchResult);
|
|
12871
|
+
for (const [treeId, tree] of this._dependencyTreeCache)
|
|
12872
|
+
/**
|
|
12873
|
+
* forceCalculate: Mandatory calculation, adding all formulas to dependencies
|
|
12874
|
+
* tree.dependencyRange: Formula dependent modification range
|
|
12875
|
+
* includeTree: modification range contains formula
|
|
12876
|
+
*/
|
|
12877
|
+
if ((forceCalculate || tree.isDirty || tree.dependencySheetName(this._currentConfigService.getDirtyNameMap()) || treeIds.has(treeId) && !tree.isExcludeRange(this._currentConfigService.getExcludedRange())) && !existTree.has(treeId)) {
|
|
12878
|
+
newTreeList.push(tree);
|
|
12879
|
+
existTree.add(treeId);
|
|
12880
|
+
}
|
|
12881
|
+
for (const [treeId, tree] of this._dependencyTreeCache) {
|
|
12882
|
+
if (tree.isVirtual) continue;
|
|
12883
|
+
tree.rangeList.length = 0;
|
|
12884
|
+
}
|
|
12885
|
+
return newTreeList;
|
|
12886
|
+
}
|
|
12887
|
+
_getTreeById(treeId) {
|
|
12888
|
+
return this._dependencyTreeCache.get(treeId);
|
|
12889
|
+
}
|
|
12890
|
+
_getTreeNode(tree) {
|
|
12891
|
+
return generateAstNode(tree.unitId, tree.formula, this._lexer, this._astTreeBuilder, this._currentConfigService);
|
|
12892
|
+
}
|
|
12893
|
+
*_traverse(treeList, skippedTreeIds) {
|
|
12894
|
+
const stack = treeList;
|
|
12895
|
+
const cacheStack = /* @__PURE__ */ new Set();
|
|
12896
|
+
while (stack.length > 0) {
|
|
12897
|
+
const tree = stack.pop();
|
|
12898
|
+
cacheStack.clear();
|
|
12899
|
+
if (tree === void 0 || tree.isSkip()) continue;
|
|
12900
|
+
if (tree.isAdded()) {
|
|
12901
|
+
yield tree;
|
|
12902
|
+
tree.setSkip();
|
|
12903
|
+
skippedTreeIds.add(tree.treeId);
|
|
12904
|
+
continue;
|
|
12324
12905
|
}
|
|
12325
|
-
tree.
|
|
12326
|
-
const
|
|
12327
|
-
for (const
|
|
12328
|
-
|
|
12329
|
-
const
|
|
12330
|
-
if (!
|
|
12331
|
-
|
|
12332
|
-
|
|
12906
|
+
const searchResults = this._dependencyManagerService.searchDependency(tree.toRTreeItem(), skippedTreeIds);
|
|
12907
|
+
const addressSearchResults = this._dependencyRTreeCacheForAddressFunction.bulkSearch(tree.toRTreeItem(), skippedTreeIds);
|
|
12908
|
+
for (const addressSearchResult of addressSearchResults) searchResults.add(addressSearchResult);
|
|
12909
|
+
for (const parentTreeId of searchResults) {
|
|
12910
|
+
const parentTree = this._dependencyTreeCache.get(parentTreeId);
|
|
12911
|
+
if (!parentTree) {
|
|
12912
|
+
console.error("Dependency tree not found for treeId:", parentTreeId);
|
|
12913
|
+
continue;
|
|
12914
|
+
}
|
|
12915
|
+
if (parentTree.isAdded() || tree.isSkip()) continue;
|
|
12916
|
+
cacheStack.add(parentTree);
|
|
12333
12917
|
}
|
|
12334
|
-
|
|
12335
|
-
|
|
12918
|
+
searchResults.clear();
|
|
12919
|
+
if (cacheStack.size === 0) {
|
|
12920
|
+
yield tree;
|
|
12921
|
+
tree.setSkip();
|
|
12922
|
+
skippedTreeIds.add(tree.treeId);
|
|
12923
|
+
} else {
|
|
12924
|
+
tree.setAdded();
|
|
12925
|
+
stack.push(tree);
|
|
12926
|
+
for (const cacheTree of cacheStack) stack.push(cacheTree);
|
|
12927
|
+
}
|
|
12928
|
+
}
|
|
12929
|
+
stack.length = 0;
|
|
12930
|
+
cacheStack.clear();
|
|
12931
|
+
}
|
|
12932
|
+
_calculateRunList(treeList) {
|
|
12933
|
+
const formulaRunList = [];
|
|
12934
|
+
const skippedTreeIds = /* @__PURE__ */ new Set();
|
|
12935
|
+
for (const tree of this._traverse(treeList, skippedTreeIds)) formulaRunList.push(tree);
|
|
12936
|
+
return formulaRunList;
|
|
12937
|
+
}
|
|
12938
|
+
async _getAllTreeList() {
|
|
12939
|
+
await this._initializeGenerateTreeList();
|
|
12940
|
+
return Array.from(this._dependencyTreeCache.values());
|
|
12941
|
+
}
|
|
12942
|
+
_getDependencyTreeParenIds(tree) {
|
|
12943
|
+
return this._dependencyManagerService.searchDependency(tree.toRTreeItem());
|
|
12944
|
+
}
|
|
12945
|
+
_getDependencyTreeChildrenIds(tree) {
|
|
12946
|
+
const childrenIds = /* @__PURE__ */ new Set();
|
|
12947
|
+
const rangeList = tree.rangeList;
|
|
12948
|
+
for (const [treeId, dependencyTree] of this._dependencyTreeCache) for (const unitRange of rangeList) {
|
|
12949
|
+
const unitId = unitRange.unitId;
|
|
12950
|
+
const sheetId = unitRange.sheetId;
|
|
12951
|
+
if (dependencyTree.unitId !== unitId || dependencyTree.subUnitId !== sheetId) continue;
|
|
12952
|
+
const range = unitRange.range;
|
|
12953
|
+
if (dependencyTree.inRangeData(range)) {
|
|
12954
|
+
childrenIds.add(treeId);
|
|
12955
|
+
break;
|
|
12956
|
+
}
|
|
12957
|
+
}
|
|
12958
|
+
return childrenIds;
|
|
12959
|
+
}
|
|
12960
|
+
_startFormulaDependencyTreeModel() {
|
|
12961
|
+
this._dependencyManagerService.openKdTree();
|
|
12962
|
+
}
|
|
12963
|
+
_endFormulaDependencyTreeModel() {
|
|
12964
|
+
this._formulaDependencyTreeModel.clear();
|
|
12965
|
+
this._dependencyTreeCache.clear();
|
|
12966
|
+
this._dependencyManagerService.closeKdTree();
|
|
12336
12967
|
}
|
|
12337
12968
|
/**
|
|
12338
12969
|
* TODO @DR-Univer: The next step will be to try changing the incoming dirtyRanges to an array, thus avoiding conversion.
|
|
@@ -12354,23 +12985,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12354
12985
|
}
|
|
12355
12986
|
return unitRange;
|
|
12356
12987
|
}
|
|
12357
|
-
_intersectFeatureCalculation(dirtyRanges, newTreeList, param) {
|
|
12358
|
-
const dependencyTree = [];
|
|
12359
|
-
const treeIds = this._dependencyManagerService.searchDependency(dirtyRanges);
|
|
12360
|
-
for (let i = 0, len = newTreeList.length; i < len; i++) {
|
|
12361
|
-
const tree = newTreeList[i];
|
|
12362
|
-
if (tree.unitId === param.unitId && tree.subUnitId === param.subUnitId && tree.featureId === param.featureId) continue;
|
|
12363
|
-
if (treeIds.has(tree.treeId)) dependencyTree.push(tree);
|
|
12364
|
-
}
|
|
12365
|
-
return dependencyTree;
|
|
12366
|
-
}
|
|
12367
|
-
_getExistTreeList(param, treeList) {
|
|
12368
|
-
const { unitId, subUnitId, featureId } = param;
|
|
12369
|
-
for (let i = 0, len = treeList.length; i < len; i++) {
|
|
12370
|
-
const tree = treeList[i];
|
|
12371
|
-
if (tree.unitId === unitId && tree.subUnitId === subUnitId && tree.featureId === featureId) return tree;
|
|
12372
|
-
}
|
|
12373
|
-
}
|
|
12374
12988
|
_isCyclicUtil(treeId, visited, recursionStack) {
|
|
12375
12989
|
const node = this._dependencyManagerService.getTreeById(treeId);
|
|
12376
12990
|
if (node == null) return false;
|
|
@@ -12385,15 +12999,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12385
12999
|
recursionStack.delete(node.treeId);
|
|
12386
13000
|
return false;
|
|
12387
13001
|
}
|
|
12388
|
-
_checkIsCycleDependency(treeList) {
|
|
12389
|
-
const visited = /* @__PURE__ */ new Set();
|
|
12390
|
-
const recursionStack = /* @__PURE__ */ new Set();
|
|
12391
|
-
for (let i = 0, len = treeList.length; i < len; i++) {
|
|
12392
|
-
const tree = treeList[i];
|
|
12393
|
-
if (this._isCyclicUtil(tree.treeId, visited, recursionStack) === true) return true;
|
|
12394
|
-
}
|
|
12395
|
-
return false;
|
|
12396
|
-
}
|
|
12397
13002
|
/**
|
|
12398
13003
|
* Generate nodes for the dependency tree, where each node contains all the reference data ranges included in each formula.
|
|
12399
13004
|
* @param formulaData
|
|
@@ -12440,82 +13045,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12440
13045
|
});
|
|
12441
13046
|
});
|
|
12442
13047
|
}
|
|
12443
|
-
_getFeatureFormulaTree(featureId, treeId, params) {
|
|
12444
|
-
const { unitId, subUnitId, dependencyRanges, getDirtyData } = params;
|
|
12445
|
-
const FDtree = new FormulaDependencyTree(treeId || generateRandomDependencyTreeId(this._dependencyManagerService));
|
|
12446
|
-
FDtree.unitId = unitId;
|
|
12447
|
-
FDtree.subUnitId = subUnitId;
|
|
12448
|
-
FDtree.rangeList = dependencyRanges;
|
|
12449
|
-
FDtree.getDirtyData = getDirtyData;
|
|
12450
|
-
const allDependency = getDirtyData(this._currentConfigService.getDirtyData(), this._runtimeService.getAllRuntimeData());
|
|
12451
|
-
FDtree.featureDirtyRanges = this._convertDirtyRangesToUnitRange(allDependency.dirtyRanges);
|
|
12452
|
-
FDtree.featureId = featureId;
|
|
12453
|
-
FDtree.type = 2;
|
|
12454
|
-
this._dependencyManagerService.addFeatureFormulaDependency(unitId, subUnitId, featureId, FDtree);
|
|
12455
|
-
if (this._dependencyManagerService.getFeatureFormulaDependency(params.unitId, params.subUnitId, featureId)) FDtree.isCache = true;
|
|
12456
|
-
return FDtree;
|
|
12457
|
-
}
|
|
12458
|
-
_registerOtherFormulas(otherFormulaData, otherFormulaDataKeys, treeList) {
|
|
12459
|
-
/**
|
|
12460
|
-
* Register formulas in doc, slide, and other types of applications.
|
|
12461
|
-
*/
|
|
12462
|
-
for (const unitId of otherFormulaDataKeys) {
|
|
12463
|
-
const subComponentData = otherFormulaData[unitId];
|
|
12464
|
-
if (subComponentData == null) continue;
|
|
12465
|
-
const subComponentKeys = Object.keys(subComponentData);
|
|
12466
|
-
for (const subUnitId of subComponentKeys) {
|
|
12467
|
-
const subFormulaData = subComponentData[subUnitId];
|
|
12468
|
-
if (subFormulaData == null) continue;
|
|
12469
|
-
const { rowCount = Infinity, columnCount = Infinity } = this._currentConfigService.getSheetRowColumnCount(unitId, subUnitId) || {};
|
|
12470
|
-
const subFormulaDataKeys = Object.keys(subFormulaData);
|
|
12471
|
-
for (const subFormulaDataId of subFormulaDataKeys) {
|
|
12472
|
-
const hasOtherFormula = this._dependencyManagerService.hasOtherFormulaDataMainData(subFormulaDataId);
|
|
12473
|
-
const { f: formulaString, ranges } = subFormulaData[subFormulaDataId];
|
|
12474
|
-
let isCache = false;
|
|
12475
|
-
if (hasOtherFormula) isCache = true;
|
|
12476
|
-
const node = generateAstNode(unitId, formulaString, this._lexer, this._astTreeBuilder, this._currentConfigService);
|
|
12477
|
-
const { firstRow, firstColumn } = this._getFirstCellOfRange(ranges);
|
|
12478
|
-
const treeMatrix = this._dependencyManagerService.getOtherFormulaDependency(unitId, subUnitId, subFormulaDataId);
|
|
12479
|
-
const firstFDtree = new FormulaDependencyTree((treeMatrix === null || treeMatrix === void 0 ? void 0 : treeMatrix.getValue(0, 0)) || generateRandomDependencyTreeId(this._dependencyManagerService));
|
|
12480
|
-
for (let i = 0; i < ranges.length; i++) {
|
|
12481
|
-
const range = ranges[i];
|
|
12482
|
-
const { startRow, startColumn } = range;
|
|
12483
|
-
let { endRow, endColumn } = range;
|
|
12484
|
-
endRow = Math.min(endRow, rowCount - 1);
|
|
12485
|
-
endColumn = Math.min(endColumn, columnCount - 1);
|
|
12486
|
-
for (let r = startRow; r <= endRow; r++) for (let c = startColumn; c <= endColumn; c++) {
|
|
12487
|
-
const x = c - firstColumn;
|
|
12488
|
-
const y = r - firstRow;
|
|
12489
|
-
if (x === 0 && y === 0) {
|
|
12490
|
-
firstFDtree.node = node;
|
|
12491
|
-
firstFDtree.formula = formulaString;
|
|
12492
|
-
firstFDtree.unitId = unitId;
|
|
12493
|
-
firstFDtree.subUnitId = subUnitId;
|
|
12494
|
-
firstFDtree.formulaId = subFormulaDataId;
|
|
12495
|
-
firstFDtree.type = 1;
|
|
12496
|
-
firstFDtree.isCache = isCache;
|
|
12497
|
-
treeList.push(firstFDtree);
|
|
12498
|
-
this._dependencyManagerService.addOtherFormulaDependency(unitId, subUnitId, subFormulaDataId, firstFDtree);
|
|
12499
|
-
this._dependencyManagerService.addFormulaDependencyByDefinedName(firstFDtree);
|
|
12500
|
-
continue;
|
|
12501
|
-
}
|
|
12502
|
-
const virtual = new FormulaDependencyTreeVirtual();
|
|
12503
|
-
virtual.treeId = (treeMatrix === null || treeMatrix === void 0 ? void 0 : treeMatrix.getValue(x, y)) || generateRandomDependencyTreeId(this._dependencyManagerService);
|
|
12504
|
-
virtual.refTree = firstFDtree;
|
|
12505
|
-
virtual.refOffsetX = x;
|
|
12506
|
-
virtual.refOffsetY = y;
|
|
12507
|
-
virtual.isCache = isCache;
|
|
12508
|
-
virtual.type = 1;
|
|
12509
|
-
this._dependencyManagerService.addOtherFormulaDependency(unitId, subUnitId, subFormulaDataId, virtual);
|
|
12510
|
-
this._dependencyManagerService.addFormulaDependencyByDefinedName(virtual);
|
|
12511
|
-
treeList.push(virtual);
|
|
12512
|
-
}
|
|
12513
|
-
}
|
|
12514
|
-
this._dependencyManagerService.addOtherFormulaDependencyMainData(subFormulaDataId);
|
|
12515
|
-
}
|
|
12516
|
-
}
|
|
12517
|
-
}
|
|
12518
|
-
}
|
|
12519
13048
|
_getFirstCellOfRange(ranges) {
|
|
12520
13049
|
const range = ranges[0];
|
|
12521
13050
|
return {
|
|
@@ -12523,72 +13052,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12523
13052
|
firstColumn: range.startColumn
|
|
12524
13053
|
};
|
|
12525
13054
|
}
|
|
12526
|
-
_registerFormulas(formulaDataKeys, formulaData, unitData, treeList) {
|
|
12527
|
-
/**
|
|
12528
|
-
* Register formulas in the sheet.
|
|
12529
|
-
*/
|
|
12530
|
-
for (const unitId of formulaDataKeys) {
|
|
12531
|
-
const sheetData = formulaData[unitId];
|
|
12532
|
-
if (sheetData == null) continue;
|
|
12533
|
-
const sheetDataKeys = Object.keys(sheetData);
|
|
12534
|
-
for (const sheetId of sheetDataKeys) {
|
|
12535
|
-
const matrixData = new _univerjs_core.ObjectMatrix(sheetData[sheetId] || {});
|
|
12536
|
-
const sIdCache = /* @__PURE__ */ new Map();
|
|
12537
|
-
matrixData.forValue((row, column, formulaDataItem) => {
|
|
12538
|
-
if (formulaDataItem == null) return true;
|
|
12539
|
-
const { x = 0, y = 0, si } = formulaDataItem;
|
|
12540
|
-
if (!(x === 0 && y === 0 && si != null)) return true;
|
|
12541
|
-
const FDtree = this._createFDtree(unitId, sheetId, row, column, unitData, formulaDataItem);
|
|
12542
|
-
const treeId = this._dependencyManagerService.getFormulaDependency(unitId, sheetId, row, column);
|
|
12543
|
-
if (treeId != null) {
|
|
12544
|
-
FDtree.treeId = treeId;
|
|
12545
|
-
FDtree.isCache = true;
|
|
12546
|
-
this._dependencyManagerService.updateDependencyTreeDirtyState(treeId, false);
|
|
12547
|
-
} else {
|
|
12548
|
-
this._dependencyManagerService.addFormulaDependency(unitId, sheetId, row, column, FDtree);
|
|
12549
|
-
this._dependencyManagerService.addFormulaDependencyByDefinedName(FDtree);
|
|
12550
|
-
}
|
|
12551
|
-
sIdCache.set(si, FDtree);
|
|
12552
|
-
treeList.push(FDtree);
|
|
12553
|
-
});
|
|
12554
|
-
matrixData.forValue((row, column, formulaDataItem) => {
|
|
12555
|
-
if (formulaDataItem == null) return true;
|
|
12556
|
-
const { x = 0, y = 0, si } = formulaDataItem;
|
|
12557
|
-
if (x === 0 && y === 0 && si != null) return true;
|
|
12558
|
-
let FDtree;
|
|
12559
|
-
if (si && sIdCache.has(si)) {
|
|
12560
|
-
const cache = sIdCache.get(si);
|
|
12561
|
-
FDtree = this._createVirtualFDtree(cache, formulaDataItem);
|
|
12562
|
-
} else FDtree = this._createFDtree(unitId, sheetId, row, column, unitData, formulaDataItem);
|
|
12563
|
-
const treeId = this._dependencyManagerService.getFormulaDependency(unitId, sheetId, row, column);
|
|
12564
|
-
if (treeId != null) {
|
|
12565
|
-
FDtree.treeId = treeId;
|
|
12566
|
-
FDtree.isCache = true;
|
|
12567
|
-
this._dependencyManagerService.updateDependencyTreeDirtyState(treeId, false);
|
|
12568
|
-
} else {
|
|
12569
|
-
this._dependencyManagerService.addFormulaDependency(unitId, sheetId, row, column, FDtree);
|
|
12570
|
-
this._dependencyManagerService.addFormulaDependencyByDefinedName(FDtree);
|
|
12571
|
-
}
|
|
12572
|
-
treeList.push(FDtree);
|
|
12573
|
-
});
|
|
12574
|
-
sIdCache.clear();
|
|
12575
|
-
}
|
|
12576
|
-
}
|
|
12577
|
-
}
|
|
12578
|
-
_createFDtree(unitId, sheetId, row, column, unitData, formulaDataItem) {
|
|
12579
|
-
const { f: formulaString, x = 0, y = 0 } = formulaDataItem;
|
|
12580
|
-
const FDtree = new FormulaDependencyTree(generateRandomDependencyTreeId(this._dependencyManagerService));
|
|
12581
|
-
const sheetItem = unitData[unitId][sheetId];
|
|
12582
|
-
FDtree.node = generateAstNode(unitId, formulaString, this._lexer, this._astTreeBuilder, this._currentConfigService);
|
|
12583
|
-
FDtree.formula = formulaString;
|
|
12584
|
-
FDtree.unitId = unitId;
|
|
12585
|
-
FDtree.subUnitId = sheetId;
|
|
12586
|
-
FDtree.row = row;
|
|
12587
|
-
FDtree.column = column;
|
|
12588
|
-
FDtree.rowCount = sheetItem.rowCount;
|
|
12589
|
-
FDtree.columnCount = sheetItem.columnCount;
|
|
12590
|
-
return FDtree;
|
|
12591
|
-
}
|
|
12592
13055
|
_createVirtualFDtree(tree, formulaDataItem) {
|
|
12593
13056
|
const { x = 0, y = 0 } = formulaDataItem;
|
|
12594
13057
|
const virtual = new FormulaDependencyTreeVirtual();
|
|
@@ -12698,9 +13161,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12698
13161
|
this._nodeTraversalReferenceFunction(node, referenceFunctionList);
|
|
12699
13162
|
return referenceFunctionList;
|
|
12700
13163
|
}
|
|
12701
|
-
_getTreeNode(tree) {
|
|
12702
|
-
return tree.node;
|
|
12703
|
-
}
|
|
12704
13164
|
async _buildDirtyRangesByAddressFunction(treeDependencyCache, tree) {
|
|
12705
13165
|
const addressFunctionNodes = tree.addressFunctionNodes;
|
|
12706
13166
|
if (addressFunctionNodes.length === 0) return;
|
|
@@ -12803,9 +13263,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12803
13263
|
if (newDirtyRanges.length > 0) this._searchDependencyByAddressFunction(treeDependencyCache, newDirtyRanges, searchResults);
|
|
12804
13264
|
return searchResults;
|
|
12805
13265
|
}
|
|
12806
|
-
_getTreeById(treeId) {
|
|
12807
|
-
return this._dependencyManagerService.getTreeById(treeId);
|
|
12808
|
-
}
|
|
12809
13266
|
_addDependencyTreeByAddressFunction(tree, addressFunctionRangeList) {
|
|
12810
13267
|
const searchRanges = [];
|
|
12811
13268
|
for (let i = 0; i < addressFunctionRangeList.length; i++) {
|
|
@@ -12834,33 +13291,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12834
13291
|
}
|
|
12835
13292
|
return rangeList;
|
|
12836
13293
|
}
|
|
12837
|
-
/**
|
|
12838
|
-
* Build a formula dependency tree based on the dependency relationships.
|
|
12839
|
-
* @param treeList
|
|
12840
|
-
*/
|
|
12841
|
-
_getUpdateTreeListAndMakeDependency(treeList) {
|
|
12842
|
-
const newTreeList = [];
|
|
12843
|
-
const existTree = /* @__PURE__ */ new Set();
|
|
12844
|
-
const forceCalculate = this._currentConfigService.isForceCalculate();
|
|
12845
|
-
const dirtyRanges = this._currentConfigService.getDirtyRanges();
|
|
12846
|
-
const treeIds = this._dependencyManagerService.searchDependency(dirtyRanges);
|
|
12847
|
-
const addressSearchResults = this._dependencyRTreeCacheForAddressFunction.bulkSearch(dirtyRanges);
|
|
12848
|
-
for (const addressSearchResult of addressSearchResults) treeIds.add(addressSearchResult);
|
|
12849
|
-
const allTree = this._dependencyManagerService.buildDependencyTree(treeList);
|
|
12850
|
-
for (const tree of allTree) {
|
|
12851
|
-
const treeId = tree.treeId;
|
|
12852
|
-
/**
|
|
12853
|
-
* forceCalculate: Mandatory calculation, adding all formulas to dependencies
|
|
12854
|
-
* tree.dependencyRange: Formula dependent modification range
|
|
12855
|
-
* includeTree: modification range contains formula
|
|
12856
|
-
*/
|
|
12857
|
-
if ((forceCalculate || tree.isDirty || tree.dependencySheetName(this._currentConfigService.getDirtyNameMap()) || treeIds.has(treeId) && !tree.isExcludeRange(this._currentConfigService.getExcludedRange())) && !existTree.has(treeId)) {
|
|
12858
|
-
newTreeList.push(tree);
|
|
12859
|
-
existTree.add(treeId);
|
|
12860
|
-
}
|
|
12861
|
-
}
|
|
12862
|
-
return newTreeList;
|
|
12863
|
-
}
|
|
12864
13294
|
_includeTreeFeature(tree) {
|
|
12865
13295
|
const unitId = tree.unitId;
|
|
12866
13296
|
const subUnitId = tree.subUnitId;
|
|
@@ -12932,63 +13362,12 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
12932
13362
|
for (const range of ranges) if (tree.inRangeData(range)) return true;
|
|
12933
13363
|
return false;
|
|
12934
13364
|
}
|
|
12935
|
-
/**
|
|
12936
|
-
* Generate the final formula calculation order array by traversing the dependency tree established via depth-first search.
|
|
12937
|
-
* @param treeList
|
|
12938
|
-
*/
|
|
12939
|
-
_calculateRunList(treeList) {
|
|
12940
|
-
treeList.length;
|
|
12941
|
-
const stack = treeList;
|
|
12942
|
-
const formulaRunList = [];
|
|
12943
|
-
const cacheStack = [];
|
|
12944
|
-
while (stack.length > 0) {
|
|
12945
|
-
const tree = stack.pop();
|
|
12946
|
-
if (tree === void 0 || tree.isSkip()) continue;
|
|
12947
|
-
if (tree.isAdded()) {
|
|
12948
|
-
formulaRunList.push(tree);
|
|
12949
|
-
tree.setSkip();
|
|
12950
|
-
continue;
|
|
12951
|
-
}
|
|
12952
|
-
cacheStack.length = 0;
|
|
12953
|
-
for (const parentTreeId of tree.parents) {
|
|
12954
|
-
const parentTree = this._dependencyManagerService.getTreeById(parentTreeId);
|
|
12955
|
-
if (!parentTree) {
|
|
12956
|
-
console.error("Dependency tree not found for treeId:", parentTreeId);
|
|
12957
|
-
continue;
|
|
12958
|
-
}
|
|
12959
|
-
if (parentTree.isAdded() || tree.isSkip()) continue;
|
|
12960
|
-
cacheStack.push(parentTree);
|
|
12961
|
-
}
|
|
12962
|
-
const addressSearchResults = this._dependencyRTreeCacheForAddressFunction.bulkSearch(tree.toRTreeItem());
|
|
12963
|
-
for (const parentTreeId of addressSearchResults) {
|
|
12964
|
-
const parentTree = this._dependencyManagerService.getTreeById(parentTreeId);
|
|
12965
|
-
if (!parentTree) {
|
|
12966
|
-
console.error("Dependency tree not found for treeId:", parentTreeId);
|
|
12967
|
-
continue;
|
|
12968
|
-
}
|
|
12969
|
-
if (parentTree.isAdded() || tree.isSkip()) continue;
|
|
12970
|
-
cacheStack.push(parentTree);
|
|
12971
|
-
}
|
|
12972
|
-
if (cacheStack.length === 0) {
|
|
12973
|
-
formulaRunList.push(tree);
|
|
12974
|
-
tree.setSkip();
|
|
12975
|
-
} else {
|
|
12976
|
-
tree.setAdded();
|
|
12977
|
-
stack.push(tree, ...cacheStack);
|
|
12978
|
-
}
|
|
12979
|
-
}
|
|
12980
|
-
return formulaRunList;
|
|
12981
|
-
}
|
|
12982
13365
|
async _initializeGenerateTreeList() {
|
|
12983
13366
|
const formulaData = this._currentConfigService.getFormulaData();
|
|
12984
13367
|
const otherFormulaData = this._otherFormulaManagerService.getOtherFormulaData();
|
|
12985
13368
|
const unitData = this._currentConfigService.getUnitData();
|
|
12986
13369
|
return await this._generateTreeList(formulaData, otherFormulaData, unitData);
|
|
12987
13370
|
}
|
|
12988
|
-
async _getAllTreeList() {
|
|
12989
|
-
const treeList = await this._initializeGenerateTreeList();
|
|
12990
|
-
return this._dependencyManagerService.buildDependencyTree(treeList);
|
|
12991
|
-
}
|
|
12992
13371
|
_getTreeModel(treeId) {
|
|
12993
13372
|
let treeModel = this._formulaDependencyTreeModel.get(treeId);
|
|
12994
13373
|
if (!treeModel) {
|
|
@@ -13002,12 +13381,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
13002
13381
|
}
|
|
13003
13382
|
return treeModel;
|
|
13004
13383
|
}
|
|
13005
|
-
_getDependencyTreeParenIds(tree) {
|
|
13006
|
-
return tree.parents;
|
|
13007
|
-
}
|
|
13008
|
-
_getDependencyTreeChildrenIds(tree) {
|
|
13009
|
-
return tree.children;
|
|
13010
|
-
}
|
|
13011
13384
|
_getFormulaDependencyTreeModel(tree) {
|
|
13012
13385
|
const treeModel = this._getTreeModel(tree.treeId);
|
|
13013
13386
|
const parentIds = this._getDependencyTreeParenIds(tree);
|
|
@@ -13020,10 +13393,6 @@ let FormulaDependencyGenerator = class FormulaDependencyGenerator extends _unive
|
|
|
13020
13393
|
}
|
|
13021
13394
|
return treeModel;
|
|
13022
13395
|
}
|
|
13023
|
-
_endFormulaDependencyTreeModel() {
|
|
13024
|
-
this._formulaDependencyTreeModel.clear();
|
|
13025
|
-
}
|
|
13026
|
-
_startFormulaDependencyTreeModel() {}
|
|
13027
13396
|
_getAllDependencyJson(treeList) {
|
|
13028
13397
|
this._startFormulaDependencyTreeModel();
|
|
13029
13398
|
const results = [];
|
|
@@ -13271,7 +13640,7 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
|
|
|
13271
13640
|
if (isArrayFormulaState) this._runtimeService.setFormulaExecuteStage(5);
|
|
13272
13641
|
else this._runtimeService.setFormulaExecuteStage(2);
|
|
13273
13642
|
this._executionInProgressListener$.next(this._runtimeService.getRuntimeState());
|
|
13274
|
-
const treeList =
|
|
13643
|
+
const treeList = await this._formulaDependencyGenerator.generate(this._isCalculateTreeModel);
|
|
13275
13644
|
const interpreter = this._interpreter;
|
|
13276
13645
|
if (isArrayFormulaState) {
|
|
13277
13646
|
this._runtimeService.setFormulaExecuteStage(6);
|
|
@@ -13284,11 +13653,16 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
|
|
|
13284
13653
|
let pendingTasks = [];
|
|
13285
13654
|
const config = this._configService.getConfig(ENGINE_FORMULA_PLUGIN_CONFIG_KEY);
|
|
13286
13655
|
const intervalCount = (config === null || config === void 0 ? void 0 : config.intervalCount) || 500;
|
|
13656
|
+
let i = 0;
|
|
13287
13657
|
const treeCount = treeList.length;
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
const
|
|
13291
|
-
const nodeData =
|
|
13658
|
+
while (treeList.length > 0) {
|
|
13659
|
+
const tree = treeList.pop();
|
|
13660
|
+
const node = generateAstNode(tree.unitId, tree.formula, this._lexer, this._astTreeBuilder, this._currentConfigService);
|
|
13661
|
+
const nodeData = {
|
|
13662
|
+
node,
|
|
13663
|
+
refOffsetX: tree.refOffsetX,
|
|
13664
|
+
refOffsetY: tree.refOffsetY
|
|
13665
|
+
};
|
|
13292
13666
|
const getDirtyData = tree.getDirtyData;
|
|
13293
13667
|
if (i % intervalCount === 0) {
|
|
13294
13668
|
/**
|
|
@@ -13330,7 +13704,8 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
|
|
|
13330
13704
|
if (tree.formulaId != null) this._runtimeService.setRuntimeOtherData(tree.formulaId, tree.refOffsetX, tree.refOffsetY, value);
|
|
13331
13705
|
else this._runtimeService.setRuntimeData(value);
|
|
13332
13706
|
}
|
|
13333
|
-
|
|
13707
|
+
node.resetCalculationState();
|
|
13708
|
+
i++;
|
|
13334
13709
|
}
|
|
13335
13710
|
pendingTasks.forEach((cancel) => cancel());
|
|
13336
13711
|
pendingTasks = [];
|
|
@@ -15843,13 +16218,26 @@ function isRowHidden(rowData, rowIndex) {
|
|
|
15843
16218
|
if (!row) return false;
|
|
15844
16219
|
return row.hd === _univerjs_core.BooleanNumber.TRUE;
|
|
15845
16220
|
}
|
|
16221
|
+
const NESTED_AGGREGATE_FORMULA_CACHE = /* @__PURE__ */ new WeakMap();
|
|
15846
16222
|
function isNestedAggregateOrSubtotal(cellData, rowIndex, columnIndex, sheetId, unitId, formulaDataModel) {
|
|
15847
16223
|
const cellValue = cellData.getValue(rowIndex, columnIndex);
|
|
15848
|
-
if ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.f)
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
16224
|
+
if (!(cellValue === null || cellValue === void 0 ? void 0 : cellValue.f) && !(cellValue === null || cellValue === void 0 ? void 0 : cellValue.si)) return false;
|
|
16225
|
+
if (typeof cellValue.f === "string") return hasNestedAggregateFormula(cellValue.f);
|
|
16226
|
+
if (cellValue.si == null) return false;
|
|
16227
|
+
let cache = NESTED_AGGREGATE_FORMULA_CACHE.get(formulaDataModel);
|
|
16228
|
+
if (cache == null) {
|
|
16229
|
+
cache = /* @__PURE__ */ new Map();
|
|
16230
|
+
NESTED_AGGREGATE_FORMULA_CACHE.set(formulaDataModel, cache);
|
|
16231
|
+
}
|
|
16232
|
+
const cacheKey = `${unitId}\0${sheetId}\0${cellValue.si}`;
|
|
16233
|
+
const cached = cache.get(cacheKey);
|
|
16234
|
+
if (cached != null) return cached;
|
|
16235
|
+
const result = hasNestedAggregateFormula(formulaDataModel.getFormulaStringByCell(rowIndex, columnIndex, sheetId, unitId));
|
|
16236
|
+
cache.set(cacheKey, result);
|
|
16237
|
+
return result;
|
|
16238
|
+
}
|
|
16239
|
+
function hasNestedAggregateFormula(formulaString) {
|
|
16240
|
+
return !!formulaString && (formulaString.indexOf(`${"SUBTOTAL"}(`) > -1 || formulaString.indexOf(`${"AGGREGATE"}(`) > -1);
|
|
15853
16241
|
}
|
|
15854
16242
|
function getModeSnglResult(valueCountMap, valueMaxCount) {
|
|
15855
16243
|
const result = Object.entries(valueCountMap).filter(([_, { count }]) => count === valueMaxCount).sort((a, b) => a[1].order - b[1].order).map(([value]) => +value);
|
|
@@ -15924,40 +16312,54 @@ function getAggregateResult(options, refs) {
|
|
|
15924
16312
|
});
|
|
15925
16313
|
if (errorValueObject === null || errorValueObject === void 0 ? void 0 : errorValueObject.isError()) return errorValueObject;
|
|
15926
16314
|
}
|
|
16315
|
+
let result;
|
|
15927
16316
|
switch (type) {
|
|
15928
16317
|
case "AVERAGE":
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
case "COUNT":
|
|
15932
|
-
|
|
15933
|
-
|
|
15934
|
-
case "
|
|
15935
|
-
|
|
16318
|
+
result = n === 0 ? ErrorValueObject.create("#DIV/0!") : NumberValueObject.create(sum / n);
|
|
16319
|
+
break;
|
|
16320
|
+
case "COUNT":
|
|
16321
|
+
result = NumberValueObject.create(count);
|
|
16322
|
+
break;
|
|
16323
|
+
case "COUNTA":
|
|
16324
|
+
result = NumberValueObject.create(counta);
|
|
16325
|
+
break;
|
|
16326
|
+
case "MAX":
|
|
16327
|
+
result = NumberValueObject.create(max);
|
|
16328
|
+
break;
|
|
16329
|
+
case "MIN":
|
|
16330
|
+
result = NumberValueObject.create(min);
|
|
16331
|
+
break;
|
|
16332
|
+
case "PRODUCT":
|
|
16333
|
+
result = NumberValueObject.create(n === 0 ? 0 : product);
|
|
16334
|
+
break;
|
|
15936
16335
|
case "STDEV":
|
|
15937
16336
|
case "STDEV.S":
|
|
15938
|
-
|
|
15939
|
-
|
|
16337
|
+
result = n < 2 ? ErrorValueObject.create("#DIV/0!") : createNewArray([valueObjects], 1, n).std(1);
|
|
16338
|
+
break;
|
|
15940
16339
|
case "STDEVP":
|
|
15941
16340
|
case "STDEV.P":
|
|
15942
|
-
|
|
15943
|
-
|
|
15944
|
-
case "SUM":
|
|
16341
|
+
result = n === 0 ? ErrorValueObject.create("#DIV/0!") : createNewArray([valueObjects], 1, n).std();
|
|
16342
|
+
break;
|
|
16343
|
+
case "SUM":
|
|
16344
|
+
result = NumberValueObject.create(sum);
|
|
16345
|
+
break;
|
|
15945
16346
|
case "VAR":
|
|
15946
16347
|
case "VAR.S":
|
|
15947
|
-
|
|
15948
|
-
|
|
16348
|
+
result = n < 2 ? ErrorValueObject.create("#DIV/0!") : createNewArray([valueObjects], 1, n).var(1);
|
|
16349
|
+
break;
|
|
15949
16350
|
case "VARP":
|
|
15950
16351
|
case "VAR.P":
|
|
15951
|
-
|
|
15952
|
-
|
|
16352
|
+
result = n === 0 ? ErrorValueObject.create("#DIV/0!") : createNewArray([valueObjects], 1, n).var();
|
|
16353
|
+
break;
|
|
15953
16354
|
case "MEDIAN":
|
|
15954
|
-
|
|
15955
|
-
|
|
16355
|
+
result = n === 0 ? ErrorValueObject.create("#NUM!") : getMedianResult(valueObjects.map((vo) => +vo.getValue()));
|
|
16356
|
+
break;
|
|
15956
16357
|
case "MODE.SNGL":
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
default:
|
|
16358
|
+
result = valueCountOrder === 0 || valueMaxCount === 1 ? ErrorValueObject.create("#N/A") : getModeSnglResult(valueCountMap, valueMaxCount);
|
|
16359
|
+
break;
|
|
16360
|
+
default: result = ErrorValueObject.create("#VALUE!");
|
|
15960
16361
|
}
|
|
16362
|
+
return result;
|
|
15961
16363
|
}
|
|
15962
16364
|
function getArrayValuesByAggregateIgnoreOptions(array, options, formulaDataModel) {
|
|
15963
16365
|
const { ignoreRowHidden = false, ignoreErrorValues = false, ignoreNested = false } = options !== null && options !== void 0 ? options : {};
|
|
@@ -39960,152 +40362,6 @@ const ALL_IMPLEMENTED_FUNCTIONS = [
|
|
|
39960
40362
|
];
|
|
39961
40363
|
const ALL_IMPLEMENTED_FUNCTIONS_SET = new Set(ALL_IMPLEMENTED_FUNCTIONS.map(([_, name]) => name));
|
|
39962
40364
|
|
|
39963
|
-
//#endregion
|
|
39964
|
-
//#region src/functions/new-excel-functions.ts
|
|
39965
|
-
const NEW_EXCEL_FUNCTIONS = new Set([
|
|
39966
|
-
"ACOT",
|
|
39967
|
-
"ACOTH",
|
|
39968
|
-
"ARABIC",
|
|
39969
|
-
"BASE",
|
|
39970
|
-
"CEILING.MATH",
|
|
39971
|
-
"CEILING.PRECISE",
|
|
39972
|
-
"COMBINA",
|
|
39973
|
-
"COT",
|
|
39974
|
-
"COTH",
|
|
39975
|
-
"CSC",
|
|
39976
|
-
"CSCH",
|
|
39977
|
-
"DECIMAL",
|
|
39978
|
-
"FLOOR.MATH",
|
|
39979
|
-
"FLOOR.PRECISE",
|
|
39980
|
-
"MUNIT",
|
|
39981
|
-
"RANDARRAY",
|
|
39982
|
-
"SEC",
|
|
39983
|
-
"SECH",
|
|
39984
|
-
"SEQUENCE",
|
|
39985
|
-
"CHOOSECOLS",
|
|
39986
|
-
"CHOOSEROWS",
|
|
39987
|
-
"DROP",
|
|
39988
|
-
"EXPAND",
|
|
39989
|
-
"FILTER",
|
|
39990
|
-
"FORMULATEXT",
|
|
39991
|
-
"HSTACK",
|
|
39992
|
-
"SORT",
|
|
39993
|
-
"SORTBY",
|
|
39994
|
-
"TAKE",
|
|
39995
|
-
"TOCOL",
|
|
39996
|
-
"TOROW",
|
|
39997
|
-
"UNIQUE",
|
|
39998
|
-
"VSTACK",
|
|
39999
|
-
"WRAPCOLS",
|
|
40000
|
-
"WRAPROWS",
|
|
40001
|
-
"XLOOKUP",
|
|
40002
|
-
"XMATCH",
|
|
40003
|
-
"BITAND",
|
|
40004
|
-
"BITLSHIFT",
|
|
40005
|
-
"BITOR",
|
|
40006
|
-
"BITRSHIFT",
|
|
40007
|
-
"BITXOR",
|
|
40008
|
-
"ERF.PRECISE",
|
|
40009
|
-
"ERFC.PRECISE",
|
|
40010
|
-
"IMCOSH",
|
|
40011
|
-
"IMCOT",
|
|
40012
|
-
"IMCSC",
|
|
40013
|
-
"IMCSCH",
|
|
40014
|
-
"IMSEC",
|
|
40015
|
-
"IMSECH",
|
|
40016
|
-
"IMSINH",
|
|
40017
|
-
"IMTAN",
|
|
40018
|
-
"ISFORMULA",
|
|
40019
|
-
"SHEET",
|
|
40020
|
-
"SHEETS",
|
|
40021
|
-
"IFNA",
|
|
40022
|
-
"IFS",
|
|
40023
|
-
"SWITCH",
|
|
40024
|
-
"XOR",
|
|
40025
|
-
"BETA.DIST",
|
|
40026
|
-
"BETA.INV",
|
|
40027
|
-
"BINOM.DIST",
|
|
40028
|
-
"BINOM.DIST.RANGE",
|
|
40029
|
-
"BINOM.INV",
|
|
40030
|
-
"CHISQ.DIST",
|
|
40031
|
-
"CHISQ.DIST.RT",
|
|
40032
|
-
"CHISQ.INV",
|
|
40033
|
-
"CHISQ.INV.RT",
|
|
40034
|
-
"CHISQ.TEST",
|
|
40035
|
-
"CONFIDENCE.NORM",
|
|
40036
|
-
"CONFIDENCE.T",
|
|
40037
|
-
"COVARIANCE.P",
|
|
40038
|
-
"COVARIANCE.S",
|
|
40039
|
-
"EXPON.DIST",
|
|
40040
|
-
"F.DIST",
|
|
40041
|
-
"F.DIST.RT",
|
|
40042
|
-
"F.INV",
|
|
40043
|
-
"F.INV.RT",
|
|
40044
|
-
"F.TEST",
|
|
40045
|
-
"FORECAST.LINEAR",
|
|
40046
|
-
"GAMMA",
|
|
40047
|
-
"GAMMA.DIST",
|
|
40048
|
-
"GAMMA.INV",
|
|
40049
|
-
"GAMMALN.PRECISE",
|
|
40050
|
-
"GAUSS",
|
|
40051
|
-
"HYPGEOM.DIST",
|
|
40052
|
-
"LOGNORM.DIST",
|
|
40053
|
-
"LOGNORM.INV",
|
|
40054
|
-
"MAXIFS",
|
|
40055
|
-
"MINIFS",
|
|
40056
|
-
"MODE.MULT",
|
|
40057
|
-
"MODE.SNGL",
|
|
40058
|
-
"NEGBINOM.DIST",
|
|
40059
|
-
"NORM.DIST",
|
|
40060
|
-
"NORM.INV",
|
|
40061
|
-
"NORM.S.DIST",
|
|
40062
|
-
"NORM.S.INV",
|
|
40063
|
-
"PERCENTILE.EXC",
|
|
40064
|
-
"PERCENTILE.INC",
|
|
40065
|
-
"PERCENTRANK.EXC",
|
|
40066
|
-
"PERCENTRANK.INC",
|
|
40067
|
-
"PERMUTATIONA",
|
|
40068
|
-
"PHI",
|
|
40069
|
-
"POISSON.DIST",
|
|
40070
|
-
"QUARTILE.EXC",
|
|
40071
|
-
"QUARTILE.INC",
|
|
40072
|
-
"RANK.AVG",
|
|
40073
|
-
"RANK.EQ",
|
|
40074
|
-
"SKEW.P",
|
|
40075
|
-
"STDEV.P",
|
|
40076
|
-
"STDEV.S",
|
|
40077
|
-
"T.DIST",
|
|
40078
|
-
"T.DIST.2T",
|
|
40079
|
-
"T.DIST.RT",
|
|
40080
|
-
"T.INV",
|
|
40081
|
-
"T.INV.2T",
|
|
40082
|
-
"T.TEST",
|
|
40083
|
-
"VAR.P",
|
|
40084
|
-
"VAR.S",
|
|
40085
|
-
"WEIBULL.DIST",
|
|
40086
|
-
"Z.TEST",
|
|
40087
|
-
"ARRAYTOTEXT",
|
|
40088
|
-
"ENCODEURL",
|
|
40089
|
-
"NUMBERVALUE",
|
|
40090
|
-
"TEXTAFTER",
|
|
40091
|
-
"TEXTBEFORE",
|
|
40092
|
-
"TEXTJOIN",
|
|
40093
|
-
"TEXTSPLIT",
|
|
40094
|
-
"UNICHAR",
|
|
40095
|
-
"UNICODE",
|
|
40096
|
-
"VALUETOTEXT",
|
|
40097
|
-
"DAYS",
|
|
40098
|
-
"ISOWEEKNUM",
|
|
40099
|
-
"PDURATION",
|
|
40100
|
-
"RRI",
|
|
40101
|
-
"BYCOL",
|
|
40102
|
-
"BYROW",
|
|
40103
|
-
"MAKEARRAY",
|
|
40104
|
-
"MAP",
|
|
40105
|
-
"REDUCE",
|
|
40106
|
-
"SCAN"
|
|
40107
|
-
]);
|
|
40108
|
-
|
|
40109
40365
|
//#endregion
|
|
40110
40366
|
//#region src/functions/univer/function-names.ts
|
|
40111
40367
|
/**
|
|
@@ -40152,7 +40408,7 @@ function getObjectValue(result, isUseStrip = false) {
|
|
|
40152
40408
|
//#endregion
|
|
40153
40409
|
//#region package.json
|
|
40154
40410
|
var name = "@univerjs/engine-formula";
|
|
40155
|
-
var version = "0.22.
|
|
40411
|
+
var version = "0.22.1-insiders.20260515-225d350";
|
|
40156
40412
|
|
|
40157
40413
|
//#endregion
|
|
40158
40414
|
//#region src/services/global-computing-status.service.ts
|
|
@@ -40551,10 +40807,11 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends _uni
|
|
|
40551
40807
|
} }
|
|
40552
40808
|
};
|
|
40553
40809
|
this._commandService.executeCommand(SetOtherFormulaMutation.id, params, { onlyLocal: true }).then(() => {
|
|
40810
|
+
if (this._disposed) return;
|
|
40554
40811
|
this._commandService.executeCommand(OtherFormulaMarkDirty.id, { [unitId]: { [subUnitId]: { [formulaId]: true } } }, { onlyLocal: true });
|
|
40555
40812
|
});
|
|
40556
40813
|
};
|
|
40557
|
-
this.disposeWithMe(this._formulaChangeWithRange$.pipe((0, rxjs.bufferWhen)(() => this.calculateStarted$.pipe((0, rxjs.filter)((calculateStarted) => calculateStarted)))).subscribe((options) => options.forEach(handleRegister)));
|
|
40814
|
+
this.disposeWithMe(this._formulaChangeWithRange$.pipe((0, rxjs.bufferWhen)(() => this.calculateStarted$.pipe((0, rxjs.skip)(1), (0, rxjs.filter)((calculateStarted) => calculateStarted)))).subscribe((options) => options.forEach(handleRegister)));
|
|
40558
40815
|
this.disposeWithMe(this._formulaChangeWithRange$.pipe((0, rxjs.filter)(() => this.calculateStarted$.getValue())).subscribe(handleRegister));
|
|
40559
40816
|
}
|
|
40560
40817
|
_initFormulaCalculationResultChange() {
|
|
@@ -40738,6 +40995,7 @@ exports.BaseReferenceObject = BaseReferenceObject;
|
|
|
40738
40995
|
exports.BaseValueObject = BaseValueObject;
|
|
40739
40996
|
exports.BooleanValue = BooleanValue;
|
|
40740
40997
|
exports.BooleanValueObject = BooleanValueObject;
|
|
40998
|
+
exports.CELL_INVERTED_INDEX_CACHE = CELL_INVERTED_INDEX_CACHE;
|
|
40741
40999
|
Object.defineProperty(exports, 'CalculateController', {
|
|
40742
41000
|
enumerable: true,
|
|
40743
41001
|
get: function () {
|
|
@@ -40751,6 +41009,7 @@ Object.defineProperty(exports, 'CalculateFormulaService', {
|
|
|
40751
41009
|
}
|
|
40752
41010
|
});
|
|
40753
41011
|
exports.CustomFunction = CustomFunction;
|
|
41012
|
+
exports.DEFAULT_CYCLE_REFERENCE_COUNT = DEFAULT_CYCLE_REFERENCE_COUNT;
|
|
40754
41013
|
exports.DEFAULT_INTERVAL_COUNT = DEFAULT_INTERVAL_COUNT;
|
|
40755
41014
|
exports.DEFAULT_TOKEN_LAMBDA_FUNCTION_NAME = DEFAULT_TOKEN_LAMBDA_FUNCTION_NAME;
|
|
40756
41015
|
exports.DEFAULT_TOKEN_LET_FUNCTION_NAME = DEFAULT_TOKEN_LET_FUNCTION_NAME;
|
|
@@ -40771,6 +41030,7 @@ exports.ENGINE_FORMULA_RETURN_DEPENDENCY_TREE = ENGINE_FORMULA_RETURN_DEPENDENCY
|
|
|
40771
41030
|
exports.ERROR_TYPE_SET = ERROR_TYPE_SET;
|
|
40772
41031
|
exports.ErrorType = ErrorType;
|
|
40773
41032
|
exports.ErrorValueObject = ErrorValueObject;
|
|
41033
|
+
exports.FORMULA_REF_TO_ARRAY_CACHE = FORMULA_REF_TO_ARRAY_CACHE;
|
|
40774
41034
|
exports.FUNCTION_NAMES_ARRAY = FUNCTION_NAMES_ARRAY;
|
|
40775
41035
|
exports.FUNCTION_NAMES_COMPATIBILITY = FUNCTION_NAMES_COMPATIBILITY;
|
|
40776
41036
|
exports.FUNCTION_NAMES_CUBE = FUNCTION_NAMES_CUBE;
|