@univerjs/engine-formula 0.2.12 → 0.2.13
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 +2 -2
- package/lib/es/index.js +1943 -487
- package/lib/types/basics/__tests__/math.spec.d.ts +16 -0
- package/lib/types/basics/math.d.ts +21 -0
- package/lib/types/controller/set-dependency.controller.d.ts +1 -1
- package/lib/types/engine/analysis/__tests__/create-command-test-bed.d.ts +6 -6
- package/lib/types/engine/dependency/dependency-tree.d.ts +2 -2
- package/lib/types/engine/reference-object/base-reference-object.d.ts +6 -6
- package/lib/types/engine/value-object/array-value-object.d.ts +1 -1
- package/lib/types/engine/value-object/lambda-value-object.d.ts +3 -2
- package/lib/types/functions/__tests__/create-function-test-bed.d.ts +6 -6
- package/lib/types/functions/base-function.d.ts +1 -1
- package/lib/types/functions/logical/bycol/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/logical/bycol/index.d.ts +7 -0
- package/lib/types/functions/logical/byrow/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/logical/byrow/index.d.ts +7 -0
- package/lib/types/functions/logical/function-map.d.ts +1 -1
- package/lib/types/functions/logical/map/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/logical/map/index.d.ts +8 -0
- package/lib/types/functions/logical/reduce/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/logical/reduce/index.d.ts +8 -0
- package/lib/types/functions/logical/scan/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/logical/scan/index.d.ts +8 -0
- package/lib/types/functions/lookup/drop/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/drop/index.d.ts +9 -0
- package/lib/types/functions/lookup/expand/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/expand/index.d.ts +9 -0
- package/lib/types/functions/lookup/function-map.d.ts +1 -1
- package/lib/types/functions/lookup/take/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/take/index.d.ts +9 -0
- package/lib/types/functions/lookup/tocol/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/tocol/index.d.ts +10 -0
- package/lib/types/functions/lookup/torow/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/torow/index.d.ts +10 -0
- package/lib/types/functions/lookup/wrapcols/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/wrapcols/index.d.ts +8 -0
- package/lib/types/functions/lookup/wraprows/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/wraprows/index.d.ts +8 -0
- package/lib/types/functions/math/combin/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/combin/index.d.ts +7 -0
- package/lib/types/functions/math/combina/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/combina/index.d.ts +7 -0
- package/lib/types/functions/math/fact/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/fact/index.d.ts +8 -0
- package/lib/types/functions/math/factdouble/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/factdouble/index.d.ts +8 -0
- package/lib/types/functions/math/gcd/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/gcd/index.d.ts +8 -0
- package/lib/types/functions/math/int/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/int/index.d.ts +8 -0
- package/lib/types/functions/math/lcm/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/lcm/index.d.ts +8 -0
- package/lib/types/functions/math/mdeterm/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/mdeterm/index.d.ts +7 -0
- package/lib/types/functions/math/minverse/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/minverse/index.d.ts +7 -0
- package/lib/types/functions/math/mmult/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/mmult/index.d.ts +9 -0
- package/lib/types/functions/math/mod/index.d.ts +1 -1
- package/lib/types/functions/math/multinomial/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/multinomial/index.d.ts +8 -0
- package/lib/types/functions/math/munit/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/munit/index.d.ts +8 -0
- package/lib/types/functions/math/quotient/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/quotient/index.d.ts +7 -0
- package/lib/types/functions/math/sequence/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/sequence/index.d.ts +8 -0
- package/lib/types/functions/math/seriessum/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/seriessum/index.d.ts +8 -0
- package/lib/types/functions/math/sign/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/sign/index.d.ts +8 -0
- package/lib/types/models/__tests__/create-command-test-bed.d.ts +6 -6
- package/lib/types/models/formula-data.model.d.ts +3 -2
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/services/active-dirty-manager.service.d.ts +1 -1
- package/lib/types/services/current-data.service.d.ts +1 -1
- package/lib/types/services/defined-names.service.d.ts +1 -1
- package/lib/types/services/dependency-manager.service.d.ts +4 -4
- package/lib/types/services/feature-calculation-manager.service.d.ts +1 -1
- package/lib/types/services/function.service.d.ts +1 -1
- package/lib/types/services/other-formula-manager.service.d.ts +1 -1
- package/lib/types/services/runtime.service.d.ts +1 -1
- package/lib/types/services/super-table.service.d.ts +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +9 -9
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { ObjectMatrix, LRUMap, hashAlgorithm, Tools, AbsoluteRefType, RANGE_TYPE, Disposable, moveRangeByOffset, isValidRange, numfmt, isRealNum,
|
|
5
|
+
import { ObjectMatrix, LRUMap, hashAlgorithm, Tools, AbsoluteRefType, RANGE_TYPE, Disposable, moveRangeByOffset, isValidRange, DEFAULT_EMPTY_DOCUMENT_VALUE, DataStreamTreeTokenType, numfmt, isRealNum, isNullCell, CellValueType, BooleanNumber, isFormulaString, isFormulaId, Inject, UniverInstanceType, IUniverInstanceService, CommandType, createIdentifier, toDisposable, Injector, sortRules, OnLifecycle, LifecycleStages, requestImmediateMacroTask, IConfigService, ICommandService, Optional, Plugin } from "@univerjs/core";
|
|
6
6
|
import { Subject } from "rxjs";
|
|
7
7
|
import { DataSyncPrimaryController } from "@univerjs/rpc";
|
|
8
8
|
function isInDirtyRange(dirtyRanges, unitId, sheetId, row, column) {
|
|
@@ -114,10 +114,10 @@ const DEFAULT_TOKEN_TYPE_PARAMETER = "P_1", DEFAULT_TOKEN_TYPE_ROOT = "R_1", DEF
|
|
|
114
114
|
__publicField(this, "_definedNames", []);
|
|
115
115
|
}
|
|
116
116
|
dispose() {
|
|
117
|
-
var
|
|
117
|
+
var _a26;
|
|
118
118
|
this._children.forEach((node) => {
|
|
119
119
|
typeof node != "string" && node.dispose();
|
|
120
|
-
}), (
|
|
120
|
+
}), (_a26 = this._functionDefinitionPrivacyVar) == null || _a26.clear(), this._parent = null;
|
|
121
121
|
}
|
|
122
122
|
getDefinedNames() {
|
|
123
123
|
return this._definedNames;
|
|
@@ -708,7 +708,7 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
708
708
|
}
|
|
709
709
|
// eslint-disable-next-line complexity
|
|
710
710
|
_suffixExpressionHandler(lexerNode) {
|
|
711
|
-
var
|
|
711
|
+
var _a26;
|
|
712
712
|
const children = lexerNode.getChildren();
|
|
713
713
|
if (!children)
|
|
714
714
|
return !1;
|
|
@@ -728,7 +728,7 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
728
728
|
if (char !== operatorToken.PLUS && char !== operatorToken.MINUS && this._deletePlusForPreNode(children[i - 1]))
|
|
729
729
|
return !1;
|
|
730
730
|
for (; symbolStack.length > 0; ) {
|
|
731
|
-
const lastSymbol = (
|
|
731
|
+
const lastSymbol = (_a26 = symbolStack[symbolStack.length - 1]) == null ? void 0 : _a26.trim();
|
|
732
732
|
if (!lastSymbol || lastSymbol === matchToken.OPEN_BRACKET)
|
|
733
733
|
break;
|
|
734
734
|
const lastSymbolPriority = OPERATOR_TOKEN_PRIORITY.get(lastSymbol), charPriority = OPERATOR_TOKEN_PRIORITY.get(char);
|
|
@@ -764,11 +764,11 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
764
764
|
return lexerNode.setChildren(baseStack), !0;
|
|
765
765
|
}
|
|
766
766
|
_processSuffixExpressionCloseBracket(baseStack, symbolStack, children, i) {
|
|
767
|
-
var
|
|
767
|
+
var _a26;
|
|
768
768
|
if (this._checkOpenBracket(children[i - 1]) || this._checkOperator(children[i - 1]))
|
|
769
769
|
return !1;
|
|
770
770
|
for (; symbolStack.length > 0; ) {
|
|
771
|
-
const lastSymbol = (
|
|
771
|
+
const lastSymbol = (_a26 = symbolStack[symbolStack.length - 1]) == null ? void 0 : _a26.trim();
|
|
772
772
|
if (!lastSymbol)
|
|
773
773
|
break;
|
|
774
774
|
if (lastSymbol === matchToken.OPEN_BRACKET) {
|
|
@@ -880,8 +880,8 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
880
880
|
return parent ? (this._currentLexerNode = parent, !0) : !1;
|
|
881
881
|
}
|
|
882
882
|
_setAncestorCurrentLexerNode() {
|
|
883
|
-
var
|
|
884
|
-
const parent = (
|
|
883
|
+
var _a26, _b, _c, _d, _e, _f;
|
|
884
|
+
const parent = (_a26 = this._currentLexerNode) == null ? void 0 : _a26.getParent();
|
|
885
885
|
let state = !1;
|
|
886
886
|
if (parent && parent.getToken() === DEFAULT_TOKEN_TYPE_LAMBDA_PARAMETER) {
|
|
887
887
|
if ((_b = parent == null ? void 0 : parent.getParent()) != null && _b.getParent()) {
|
|
@@ -1199,6 +1199,32 @@ const _ObjectClassType = class _ObjectClassType extends Disposable {
|
|
|
1199
1199
|
};
|
|
1200
1200
|
__name(_ObjectClassType, "ObjectClassType");
|
|
1201
1201
|
let ObjectClassType = _ObjectClassType;
|
|
1202
|
+
function getCellValue(cell) {
|
|
1203
|
+
if (cell === null)
|
|
1204
|
+
return 0;
|
|
1205
|
+
if (cell != null && cell.p) {
|
|
1206
|
+
const body = cell == null ? void 0 : cell.p.body;
|
|
1207
|
+
if (body == null)
|
|
1208
|
+
return 0;
|
|
1209
|
+
const data = body.dataStream;
|
|
1210
|
+
return data.substring(data.length - 2, data.length) === DEFAULT_EMPTY_DOCUMENT_VALUE ? data.substring(0, data.length - 2).replaceAll(DataStreamTreeTokenType.CUSTOM_RANGE_START, "").replaceAll(DataStreamTreeTokenType.CUSTOM_RANGE_END, "") : data;
|
|
1211
|
+
}
|
|
1212
|
+
return (cell == null ? void 0 : cell.v) || 0;
|
|
1213
|
+
}
|
|
1214
|
+
__name(getCellValue, "getCellValue");
|
|
1215
|
+
function getRuntimeFeatureCell(row, column, sheetId, unitId, runtimeFeatureCellData) {
|
|
1216
|
+
var _a26;
|
|
1217
|
+
const featureKeys = Object.keys(runtimeFeatureCellData);
|
|
1218
|
+
for (const featureId of featureKeys) {
|
|
1219
|
+
const data = runtimeFeatureCellData[featureId], CellData = (_a26 = data == null ? void 0 : data[unitId]) == null ? void 0 : _a26[sheetId];
|
|
1220
|
+
if (CellData == null)
|
|
1221
|
+
continue;
|
|
1222
|
+
const value = CellData.getValue(row, column);
|
|
1223
|
+
if (value != null)
|
|
1224
|
+
return value;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
__name(getRuntimeFeatureCell, "getRuntimeFeatureCell");
|
|
1202
1228
|
var BooleanValue = /* @__PURE__ */ ((BooleanValue2) => (BooleanValue2.FALSE = "FALSE", BooleanValue2.TRUE = "TRUE", BooleanValue2))(BooleanValue || {}), AstNodePromiseType = /* @__PURE__ */ ((AstNodePromiseType2) => (AstNodePromiseType2[AstNodePromiseType2.SUCCESS = 0] = "SUCCESS", AstNodePromiseType2[AstNodePromiseType2.ERROR = 1] = "ERROR", AstNodePromiseType2))(AstNodePromiseType || {}), TableOptionType = /* @__PURE__ */ ((TableOptionType2) => (TableOptionType2.ALL = "#All", TableOptionType2.DATA = "#Data", TableOptionType2.HEADERS = "#Headers", TableOptionType2.TOTALS = "#Totals", TableOptionType2))(TableOptionType || {}), ConcatenateType = /* @__PURE__ */ ((ConcatenateType2) => (ConcatenateType2[ConcatenateType2.FRONT = 0] = "FRONT", ConcatenateType2[ConcatenateType2.BACK = 1] = "BACK", ConcatenateType2))(ConcatenateType || {});
|
|
1203
1229
|
const _InvertedIndexCache = class _InvertedIndexCache {
|
|
1204
1230
|
constructor() {
|
|
@@ -1230,12 +1256,12 @@ const _InvertedIndexCache = class _InvertedIndexCache {
|
|
|
1230
1256
|
cellList == null && (cellList = /* @__PURE__ */ new Set(), columnMap.set(value, cellList)), cellList.add(row);
|
|
1231
1257
|
}
|
|
1232
1258
|
getCellValuePositions(unitId, sheetId, column) {
|
|
1233
|
-
var
|
|
1234
|
-
return (_b = (
|
|
1259
|
+
var _a26, _b;
|
|
1260
|
+
return (_b = (_a26 = this._cache.get(unitId)) == null ? void 0 : _a26.get(sheetId)) == null ? void 0 : _b.get(column);
|
|
1235
1261
|
}
|
|
1236
1262
|
getCellPositions(unitId, sheetId, column, value) {
|
|
1237
|
-
var
|
|
1238
|
-
return (_c = (_b = (
|
|
1263
|
+
var _a26, _b, _c;
|
|
1264
|
+
return (_c = (_b = (_a26 = this._cache.get(unitId)) == null ? void 0 : _a26.get(sheetId)) == null ? void 0 : _b.get(column)) == null ? void 0 : _c.get(value);
|
|
1239
1265
|
}
|
|
1240
1266
|
getCellPosition(unitId, sheetId, column, value, startRow, endRow) {
|
|
1241
1267
|
const rows = this.getCellPositions(unitId, sheetId, column, value);
|
|
@@ -1258,18 +1284,18 @@ const _InvertedIndexCache = class _InvertedIndexCache {
|
|
|
1258
1284
|
columnMap.startRow = Math.min(columnMap.startRow, startRow), columnMap.endRow = Math.max(columnMap.endRow, endRow);
|
|
1259
1285
|
}
|
|
1260
1286
|
shouldContinueBuildingCache(unitId, sheetId, column, row) {
|
|
1261
|
-
var
|
|
1262
|
-
const rowRange = (_b = (
|
|
1287
|
+
var _a26, _b;
|
|
1288
|
+
const rowRange = (_b = (_a26 = this._continueBuildingCache.get(unitId)) == null ? void 0 : _a26.get(sheetId)) == null ? void 0 : _b.get(column);
|
|
1263
1289
|
if (rowRange == null)
|
|
1264
1290
|
return !0;
|
|
1265
1291
|
const { startRow, endRow } = rowRange;
|
|
1266
1292
|
return !(row >= startRow && row <= endRow);
|
|
1267
1293
|
}
|
|
1268
1294
|
canUseCache(unitId, sheetId, column, rangeStartRow, rangeEndRow) {
|
|
1269
|
-
var
|
|
1295
|
+
var _a26, _b;
|
|
1270
1296
|
if (column === -1 || rangeStartRow === -1 || rangeEndRow === -1)
|
|
1271
1297
|
return !1;
|
|
1272
|
-
const rowRange = (_b = (
|
|
1298
|
+
const rowRange = (_b = (_a26 = this._continueBuildingCache.get(unitId)) == null ? void 0 : _a26.get(sheetId)) == null ? void 0 : _b.get(column);
|
|
1273
1299
|
if (rowRange == null)
|
|
1274
1300
|
return !1;
|
|
1275
1301
|
const { startRow, endRow } = rowRange;
|
|
@@ -2882,13 +2908,13 @@ const currencySymbols = [
|
|
|
2882
2908
|
/* Custom */
|
|
2883
2909
|
};
|
|
2884
2910
|
function handleNumfmtInCell(oldCell, cell, styles) {
|
|
2885
|
-
var
|
|
2911
|
+
var _a26, _b;
|
|
2886
2912
|
if (oldCell == null || cell == null)
|
|
2887
2913
|
return cell;
|
|
2888
2914
|
const oldCellStyle = (styles == null ? void 0 : styles.getStyleByCell(oldCell)) || oldCell.s, cellStyle = (styles == null ? void 0 : styles.getStyleByCell(cell)) || cell.s;
|
|
2889
2915
|
if (oldCellStyle == null || cellStyle == null || typeof oldCellStyle != "object" || typeof cellStyle != "object")
|
|
2890
2916
|
return cell;
|
|
2891
|
-
const oldPattern = (
|
|
2917
|
+
const oldPattern = (_a26 = oldCellStyle == null ? void 0 : oldCellStyle.n) == null ? void 0 : _a26.pattern, pattern = (_b = cellStyle == null ? void 0 : cellStyle.n) == null ? void 0 : _b.pattern;
|
|
2892
2918
|
if (oldPattern == null || pattern == null)
|
|
2893
2919
|
return cell;
|
|
2894
2920
|
const newPattern = oldPattern || pattern;
|
|
@@ -3873,8 +3899,8 @@ const _ArrayValueObject = class _ArrayValueObject extends BaseValueObject {
|
|
|
3873
3899
|
this._defaultValue = value;
|
|
3874
3900
|
}
|
|
3875
3901
|
get(row, column) {
|
|
3876
|
-
var
|
|
3877
|
-
return (
|
|
3902
|
+
var _a26;
|
|
3903
|
+
return ((_a26 = this._values[row]) == null ? void 0 : _a26[column]) || this._defaultValue;
|
|
3878
3904
|
}
|
|
3879
3905
|
getRealValue(row, column) {
|
|
3880
3906
|
const rowValues = this._values[row];
|
|
@@ -3901,19 +3927,19 @@ const _ArrayValueObject = class _ArrayValueObject extends BaseValueObject {
|
|
|
3901
3927
|
};
|
|
3902
3928
|
}
|
|
3903
3929
|
iterator(callback) {
|
|
3904
|
-
var
|
|
3930
|
+
var _a26;
|
|
3905
3931
|
const { startRow, endRow, startColumn, endColumn } = this.getRangePosition(), valueList = this.getArrayValue();
|
|
3906
3932
|
for (let r = startRow; r <= endRow; r++)
|
|
3907
3933
|
for (let c = startColumn; c <= endColumn; c++)
|
|
3908
|
-
if (callback(((
|
|
3934
|
+
if (callback(((_a26 = valueList[r]) == null ? void 0 : _a26[c]) || this._defaultValue, r, c) === !1)
|
|
3909
3935
|
return;
|
|
3910
3936
|
}
|
|
3911
3937
|
iteratorReverse(callback) {
|
|
3912
|
-
var
|
|
3938
|
+
var _a26;
|
|
3913
3939
|
const { startRow, endRow, startColumn, endColumn } = this.getRangePosition(), valueList = this.getArrayValue();
|
|
3914
3940
|
for (let r = endRow; r >= startRow; r--)
|
|
3915
3941
|
for (let c = endColumn; c >= startColumn; c--)
|
|
3916
|
-
if (callback(((
|
|
3942
|
+
if (callback(((_a26 = valueList[r]) == null ? void 0 : _a26[c]) || this._defaultValue, r, c) === !1)
|
|
3917
3943
|
return;
|
|
3918
3944
|
}
|
|
3919
3945
|
getLastTruePosition() {
|
|
@@ -4239,12 +4265,12 @@ const _ArrayValueObject = class _ArrayValueObject extends BaseValueObject {
|
|
|
4239
4265
|
return this.mapValue(wrappedCallbackFn);
|
|
4240
4266
|
}
|
|
4241
4267
|
mapValue(callbackFn) {
|
|
4242
|
-
var
|
|
4268
|
+
var _a26;
|
|
4243
4269
|
const rowCount = this._rowCount, columnCount = this._columnCount, result = [];
|
|
4244
4270
|
for (let r = 0; r < rowCount; r++) {
|
|
4245
4271
|
const rowList = [];
|
|
4246
4272
|
for (let c = 0; c < columnCount; c++) {
|
|
4247
|
-
const row = (
|
|
4273
|
+
const row = (_a26 = this._values) == null ? void 0 : _a26[r];
|
|
4248
4274
|
if (row == null)
|
|
4249
4275
|
rowList[c] = ErrorValueObject.create(ErrorType$1.VALUE);
|
|
4250
4276
|
else {
|
|
@@ -4708,32 +4734,6 @@ const _ValueObjectFactory = class _ValueObjectFactory {
|
|
|
4708
4734
|
};
|
|
4709
4735
|
__name(_ValueObjectFactory, "ValueObjectFactory");
|
|
4710
4736
|
let ValueObjectFactory = _ValueObjectFactory;
|
|
4711
|
-
function getCellValue(cell) {
|
|
4712
|
-
if (cell === null)
|
|
4713
|
-
return 0;
|
|
4714
|
-
if (cell != null && cell.p) {
|
|
4715
|
-
const body = cell == null ? void 0 : cell.p.body;
|
|
4716
|
-
if (body == null)
|
|
4717
|
-
return 0;
|
|
4718
|
-
const data = body.dataStream;
|
|
4719
|
-
return data.substring(data.length - 2, data.length) === DEFAULT_EMPTY_DOCUMENT_VALUE ? data.substring(0, data.length - 2) : data;
|
|
4720
|
-
}
|
|
4721
|
-
return (cell == null ? void 0 : cell.v) || 0;
|
|
4722
|
-
}
|
|
4723
|
-
__name(getCellValue, "getCellValue");
|
|
4724
|
-
function getRuntimeFeatureCell(row, column, sheetId, unitId, runtimeFeatureCellData) {
|
|
4725
|
-
var _a25;
|
|
4726
|
-
const featureKeys = Object.keys(runtimeFeatureCellData);
|
|
4727
|
-
for (const featureId of featureKeys) {
|
|
4728
|
-
const data = runtimeFeatureCellData[featureId], CellData = (_a25 = data == null ? void 0 : data[unitId]) == null ? void 0 : _a25[sheetId];
|
|
4729
|
-
if (CellData == null)
|
|
4730
|
-
continue;
|
|
4731
|
-
const value = CellData.getValue(row, column);
|
|
4732
|
-
if (value != null)
|
|
4733
|
-
return value;
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
|
-
__name(getRuntimeFeatureCell, "getRuntimeFeatureCell");
|
|
4737
4737
|
const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaAstLRU(FORMULA_CACHE_LRU_COUNT$1), _BaseReferenceObject = class _BaseReferenceObject extends ObjectClassType {
|
|
4738
4738
|
constructor(_token) {
|
|
4739
4739
|
super();
|
|
@@ -4850,8 +4850,8 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
4850
4850
|
return this._forcedUnitId;
|
|
4851
4851
|
}
|
|
4852
4852
|
setForcedSheetId(sheetNameMap) {
|
|
4853
|
-
var
|
|
4854
|
-
this._forcedSheetId = (
|
|
4853
|
+
var _a26;
|
|
4854
|
+
this._forcedSheetId = (_a26 = sheetNameMap[this.getUnitId()]) == null ? void 0 : _a26[this._forcedSheetName];
|
|
4855
4855
|
}
|
|
4856
4856
|
setForcedSheetIdDirect(sheetId) {
|
|
4857
4857
|
this._forcedSheetId = sheetId;
|
|
@@ -4914,12 +4914,12 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
4914
4914
|
this._runtimeFeatureCellData = unitData;
|
|
4915
4915
|
}
|
|
4916
4916
|
getActiveSheetRowCount() {
|
|
4917
|
-
var
|
|
4918
|
-
return ((
|
|
4917
|
+
var _a26;
|
|
4918
|
+
return ((_a26 = this.getCurrentActiveSheetData()) == null ? void 0 : _a26.rowCount) || 0;
|
|
4919
4919
|
}
|
|
4920
4920
|
getActiveSheetColumnCount() {
|
|
4921
|
-
var
|
|
4922
|
-
return ((
|
|
4921
|
+
var _a26;
|
|
4922
|
+
return ((_a26 = this.getCurrentActiveSheetData()) == null ? void 0 : _a26.columnCount) || 0;
|
|
4923
4923
|
}
|
|
4924
4924
|
getRowCount() {
|
|
4925
4925
|
return this._rangeData.endRow - this._rangeData.startRow + 1;
|
|
@@ -4928,12 +4928,12 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
4928
4928
|
return this._rangeData.endColumn - this._rangeData.startColumn + 1;
|
|
4929
4929
|
}
|
|
4930
4930
|
getRowData() {
|
|
4931
|
-
var
|
|
4932
|
-
return ((
|
|
4931
|
+
var _a26;
|
|
4932
|
+
return ((_a26 = this.getCurrentActiveSheetData()) == null ? void 0 : _a26.rowData) || {};
|
|
4933
4933
|
}
|
|
4934
4934
|
getColumnData() {
|
|
4935
|
-
var
|
|
4936
|
-
return ((
|
|
4935
|
+
var _a26;
|
|
4936
|
+
return ((_a26 = this.getCurrentActiveSheetData()) == null ? void 0 : _a26.columnData) || {};
|
|
4937
4937
|
}
|
|
4938
4938
|
isCell() {
|
|
4939
4939
|
return !1;
|
|
@@ -4972,11 +4972,11 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
4972
4972
|
return cell.t === CellValueType.STRING || cell.t === CellValueType.FORCE_STRING ? StringValueObject.create(value.toString()) : cell.t === CellValueType.BOOLEAN ? createBooleanValueObjectByRawValue(value) : ValueObjectFactory.create(value);
|
|
4973
4973
|
}
|
|
4974
4974
|
_getPatternByCell(cell) {
|
|
4975
|
-
var
|
|
4975
|
+
var _a26;
|
|
4976
4976
|
const styles = this._unitStylesData[this.getUnitId()];
|
|
4977
4977
|
if (!styles) return "";
|
|
4978
4978
|
const style = styles.getStyleByCell(cell);
|
|
4979
|
-
return ((
|
|
4979
|
+
return ((_a26 = style == null ? void 0 : style.n) == null ? void 0 : _a26.pattern) || "";
|
|
4980
4980
|
}
|
|
4981
4981
|
getCellByRow(row) {
|
|
4982
4982
|
return this.getCellByPosition(row);
|
|
@@ -4985,23 +4985,23 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
4985
4985
|
return this.getCellByPosition(void 0, column);
|
|
4986
4986
|
}
|
|
4987
4987
|
getCurrentActiveSheetData() {
|
|
4988
|
-
var
|
|
4989
|
-
return (
|
|
4988
|
+
var _a26;
|
|
4989
|
+
return (_a26 = this._unitData[this.getUnitId()]) == null ? void 0 : _a26[this.getSheetId()];
|
|
4990
4990
|
}
|
|
4991
4991
|
getCurrentStylesData() {
|
|
4992
4992
|
return this._unitStylesData[this.getUnitId()];
|
|
4993
4993
|
}
|
|
4994
4994
|
getCurrentRuntimeSheetData() {
|
|
4995
|
-
var
|
|
4996
|
-
return (_b = (
|
|
4995
|
+
var _a26, _b;
|
|
4996
|
+
return (_b = (_a26 = this._runtimeData) == null ? void 0 : _a26[this.getUnitId()]) == null ? void 0 : _b[this.getSheetId()];
|
|
4997
4997
|
}
|
|
4998
4998
|
getCurrentActiveArrayFormulaCellData() {
|
|
4999
|
-
var
|
|
5000
|
-
return (_b = (
|
|
4999
|
+
var _a26, _b;
|
|
5000
|
+
return (_b = (_a26 = this._arrayFormulaCellData) == null ? void 0 : _a26[this.getUnitId()]) == null ? void 0 : _b[this.getSheetId()];
|
|
5001
5001
|
}
|
|
5002
5002
|
getCurrentRuntimeActiveArrayFormulaCellData() {
|
|
5003
|
-
var
|
|
5004
|
-
return (_b = (
|
|
5003
|
+
var _a26, _b;
|
|
5004
|
+
return (_b = (_a26 = this._runtimeArrayFormulaCellData) == null ? void 0 : _a26[this.getUnitId()]) == null ? void 0 : _b[this.getSheetId()];
|
|
5005
5005
|
}
|
|
5006
5006
|
getCellData(row, column) {
|
|
5007
5007
|
const activeSheetData = this.getCurrentActiveSheetData(), activeRuntimeData = this.getCurrentRuntimeSheetData(), activeArrayFormulaCellData = this.getCurrentActiveArrayFormulaCellData(), activeRuntimeArrayFormulaCellData = this.getCurrentRuntimeActiveArrayFormulaCellData();
|
|
@@ -5024,18 +5024,18 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
5024
5024
|
* @returns
|
|
5025
5025
|
*/
|
|
5026
5026
|
getCellPattern(unitId, sheetId, row, column) {
|
|
5027
|
-
var
|
|
5027
|
+
var _a26, _b, _c, _d;
|
|
5028
5028
|
const currentStyles = this._unitStylesData[unitId];
|
|
5029
5029
|
if (!currentStyles)
|
|
5030
5030
|
return "";
|
|
5031
|
-
const currentCell = (_c = (_b = (
|
|
5031
|
+
const currentCell = (_c = (_b = (_a26 = this._unitData[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b.cellData) == null ? void 0 : _c.getValue(row, column);
|
|
5032
5032
|
if (!currentCell)
|
|
5033
5033
|
return "";
|
|
5034
5034
|
const style = currentStyles.getStyleByCell(currentCell);
|
|
5035
5035
|
return ((_d = style == null ? void 0 : style.n) == null ? void 0 : _d.pattern) || "";
|
|
5036
5036
|
}
|
|
5037
5037
|
toArrayValueObject(useCache = !0) {
|
|
5038
|
-
var
|
|
5038
|
+
var _a26;
|
|
5039
5039
|
const { startRow, endRow, startColumn, endColumn } = this.getRangePosition(), key = `${this.getUnitId()}_${this.getSheetId()}_${startRow}_${endRow}_${startColumn}_${endColumn}`, array = FORMULA_REF_TO_ARRAY_CACHE.get(key);
|
|
5040
5040
|
if (array && useCache)
|
|
5041
5041
|
return array;
|
|
@@ -5050,7 +5050,7 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
5050
5050
|
const arrayValueObjectData = {
|
|
5051
5051
|
calculateValueList: arrayValueList,
|
|
5052
5052
|
rowCount: arrayValueList.length,
|
|
5053
|
-
columnCount: ((
|
|
5053
|
+
columnCount: ((_a26 = arrayValueList[0]) == null ? void 0 : _a26.length) || 0,
|
|
5054
5054
|
unitId: this.getUnitId(),
|
|
5055
5055
|
sheetId: this.getSheetId(),
|
|
5056
5056
|
row: startRow,
|
|
@@ -5104,7 +5104,7 @@ const _AsyncArrayObject = class _AsyncArrayObject extends ObjectClassType {
|
|
|
5104
5104
|
return !0;
|
|
5105
5105
|
}
|
|
5106
5106
|
async getValue() {
|
|
5107
|
-
var
|
|
5107
|
+
var _a26;
|
|
5108
5108
|
const variants = [];
|
|
5109
5109
|
for (let r = 0; r < this._promiseList.length; r++) {
|
|
5110
5110
|
const promiseCells = this._promiseList[r];
|
|
@@ -5117,7 +5117,7 @@ const _AsyncArrayObject = class _AsyncArrayObject extends ObjectClassType {
|
|
|
5117
5117
|
const arrayValueObjectData = {
|
|
5118
5118
|
calculateValueList: variants,
|
|
5119
5119
|
rowCount: variants.length,
|
|
5120
|
-
columnCount: ((
|
|
5120
|
+
columnCount: ((_a26 = variants[0]) == null ? void 0 : _a26.length) || 0,
|
|
5121
5121
|
unitId: "",
|
|
5122
5122
|
sheetId: "",
|
|
5123
5123
|
row: 0,
|
|
@@ -5563,9 +5563,9 @@ const _BaseFunction = class _BaseFunction extends Disposable {
|
|
|
5563
5563
|
* =INDIRECT("DefinedName1")
|
|
5564
5564
|
*/
|
|
5565
5565
|
getDefinedName(name) {
|
|
5566
|
-
var
|
|
5566
|
+
var _a26;
|
|
5567
5567
|
const nameMap = this._definedNames;
|
|
5568
|
-
return nameMap == null ? null : (
|
|
5568
|
+
return nameMap == null ? null : (_a26 = Array.from(Object.values(nameMap)).filter((value) => value.name === name)) == null ? void 0 : _a26[0];
|
|
5569
5569
|
}
|
|
5570
5570
|
setDefinedNames(definedNames) {
|
|
5571
5571
|
this._definedNames = definedNames;
|
|
@@ -12071,8 +12071,8 @@ const _Cell = class _Cell extends BaseFunction {
|
|
|
12071
12071
|
}
|
|
12072
12072
|
}
|
|
12073
12073
|
_getWidthResult(columnData, defaultColumnWidth, _currentColumn, infoTypeIsArray) {
|
|
12074
|
-
var
|
|
12075
|
-
let result = (
|
|
12074
|
+
var _a26;
|
|
12075
|
+
let result = (_a26 = columnData[_currentColumn]) == null ? void 0 : _a26.w;
|
|
12076
12076
|
if (!result && result !== 0 && (result = defaultColumnWidth), infoTypeIsArray)
|
|
12077
12077
|
return NumberValueObject.create(result);
|
|
12078
12078
|
const resultArray = [[result, result === defaultColumnWidth]];
|
|
@@ -12179,14 +12179,14 @@ const _Isformula = class _Isformula extends BaseFunction {
|
|
|
12179
12179
|
__publicField(this, "needsReferenceObject", !0);
|
|
12180
12180
|
}
|
|
12181
12181
|
calculate(reference) {
|
|
12182
|
-
var
|
|
12182
|
+
var _a26;
|
|
12183
12183
|
if (reference.isError())
|
|
12184
12184
|
return reference;
|
|
12185
12185
|
if (!reference.isReferenceObject())
|
|
12186
12186
|
return ErrorValueObject.create(ErrorType$1.NA);
|
|
12187
|
-
const cellDataMatrix = (
|
|
12188
|
-
var
|
|
12189
|
-
const cellData = (
|
|
12187
|
+
const cellDataMatrix = (_a26 = reference.getCurrentActiveSheetData()) == null ? void 0 : _a26.cellData.getMatrix(), { startRow, startColumn } = reference.getRangePosition(), _reference = reference.toArrayValueObject(), resultArray = _reference.mapValue((valueObject, rowIndex, columnIndex) => {
|
|
12188
|
+
var _a27;
|
|
12189
|
+
const cellData = (_a27 = cellDataMatrix == null ? void 0 : cellDataMatrix[startRow + rowIndex]) == null ? void 0 : _a27[startColumn + columnIndex];
|
|
12190
12190
|
return cellData != null && cellData.f || cellData != null && cellData.si ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1);
|
|
12191
12191
|
});
|
|
12192
12192
|
return _reference.getRowCount() === 1 && _reference.getColumnCount() === 1 ? resultArray.get(0, 0) : resultArray;
|
|
@@ -12381,9 +12381,7 @@ const functionInformation = [
|
|
|
12381
12381
|
[N, FUNCTION_NAMES_INFORMATION.N],
|
|
12382
12382
|
[Na, FUNCTION_NAMES_INFORMATION.NA],
|
|
12383
12383
|
[Type, FUNCTION_NAMES_INFORMATION.TYPE]
|
|
12384
|
-
]
|
|
12385
|
-
var FUNCTION_NAMES_LOGICAL = /* @__PURE__ */ ((FUNCTION_NAMES_LOGICAL2) => (FUNCTION_NAMES_LOGICAL2.AND = "AND", FUNCTION_NAMES_LOGICAL2.BYCOL = "BYCOL", FUNCTION_NAMES_LOGICAL2.BYROW = "BYROW", FUNCTION_NAMES_LOGICAL2.FALSE = "FALSE", FUNCTION_NAMES_LOGICAL2.IF = "IF", FUNCTION_NAMES_LOGICAL2.IFERROR = "IFERROR", FUNCTION_NAMES_LOGICAL2.IFNA = "IFNA", FUNCTION_NAMES_LOGICAL2.IFS = "IFS", FUNCTION_NAMES_LOGICAL2.LAMBDA = "LAMBDA", FUNCTION_NAMES_LOGICAL2.LET = "LET", FUNCTION_NAMES_LOGICAL2.MAKEARRAY = "MAKEARRAY", FUNCTION_NAMES_LOGICAL2.MAP = "MAP", FUNCTION_NAMES_LOGICAL2.NOT = "NOT", FUNCTION_NAMES_LOGICAL2.OR = "OR", FUNCTION_NAMES_LOGICAL2.REDUCE = "REDUCE", FUNCTION_NAMES_LOGICAL2.SCAN = "SCAN", FUNCTION_NAMES_LOGICAL2.SWITCH = "SWITCH", FUNCTION_NAMES_LOGICAL2.TRUE = "TRUE", FUNCTION_NAMES_LOGICAL2.XOR = "XOR", FUNCTION_NAMES_LOGICAL2))(FUNCTION_NAMES_LOGICAL || {});
|
|
12386
|
-
const _And = class _And extends BaseFunction {
|
|
12384
|
+
], _And = class _And extends BaseFunction {
|
|
12387
12385
|
constructor() {
|
|
12388
12386
|
super(...arguments);
|
|
12389
12387
|
__publicField(this, "minParams", 1);
|
|
@@ -12408,6 +12406,108 @@ const _And = class _And extends BaseFunction {
|
|
|
12408
12406
|
};
|
|
12409
12407
|
__name(_And, "And");
|
|
12410
12408
|
let And = _And;
|
|
12409
|
+
const _Bycol = class _Bycol extends BaseFunction {
|
|
12410
|
+
constructor() {
|
|
12411
|
+
super(...arguments);
|
|
12412
|
+
__publicField(this, "minParams", 2);
|
|
12413
|
+
__publicField(this, "maxParams", 2);
|
|
12414
|
+
}
|
|
12415
|
+
calculate(array, lambda) {
|
|
12416
|
+
if (array.isError())
|
|
12417
|
+
return array;
|
|
12418
|
+
if (lambda.isError())
|
|
12419
|
+
return lambda;
|
|
12420
|
+
if (!(lambda.isValueObject() && lambda.isLambda() && lambda.getLambdaPrivacyVarKeys().length === 1))
|
|
12421
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
12422
|
+
const _lambda = lambda, rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1, _array = expandArrayValueObject(rowCount, columnCount, array), result = [[]];
|
|
12423
|
+
for (let c = 0; c < columnCount; c++) {
|
|
12424
|
+
const rows = [];
|
|
12425
|
+
for (let r = 0; r < rowCount; r++) {
|
|
12426
|
+
const col = _array.get(r, c);
|
|
12427
|
+
rows.push([col]);
|
|
12428
|
+
}
|
|
12429
|
+
const lambdaVariant = ArrayValueObject.create({
|
|
12430
|
+
calculateValueList: rows,
|
|
12431
|
+
rowCount,
|
|
12432
|
+
columnCount: 1,
|
|
12433
|
+
unitId: "",
|
|
12434
|
+
sheetId: "",
|
|
12435
|
+
row: 0,
|
|
12436
|
+
column: 0
|
|
12437
|
+
});
|
|
12438
|
+
let value = _lambda.execute(lambdaVariant);
|
|
12439
|
+
if (value.isArray()) {
|
|
12440
|
+
const valueRowCount = value.getRowCount(), valueColumnCount = value.getColumnCount();
|
|
12441
|
+
if (valueRowCount > 1 || valueColumnCount > 1)
|
|
12442
|
+
return ErrorValueObject.create(ErrorType$1.CALC);
|
|
12443
|
+
value = value.get(0, 0);
|
|
12444
|
+
}
|
|
12445
|
+
value.isNull() && (value = NumberValueObject.create(0)), result[0].push(value);
|
|
12446
|
+
}
|
|
12447
|
+
return columnCount === 1 ? result[0][0] : ArrayValueObject.create({
|
|
12448
|
+
calculateValueList: result,
|
|
12449
|
+
rowCount: 1,
|
|
12450
|
+
columnCount,
|
|
12451
|
+
unitId: this.unitId,
|
|
12452
|
+
sheetId: this.subUnitId,
|
|
12453
|
+
row: this.row,
|
|
12454
|
+
column: this.column
|
|
12455
|
+
});
|
|
12456
|
+
}
|
|
12457
|
+
};
|
|
12458
|
+
__name(_Bycol, "Bycol");
|
|
12459
|
+
let Bycol = _Bycol;
|
|
12460
|
+
const _Byrow = class _Byrow extends BaseFunction {
|
|
12461
|
+
constructor() {
|
|
12462
|
+
super(...arguments);
|
|
12463
|
+
__publicField(this, "minParams", 2);
|
|
12464
|
+
__publicField(this, "maxParams", 2);
|
|
12465
|
+
}
|
|
12466
|
+
calculate(array, lambda) {
|
|
12467
|
+
if (array.isError())
|
|
12468
|
+
return array;
|
|
12469
|
+
if (lambda.isError())
|
|
12470
|
+
return lambda;
|
|
12471
|
+
if (!(lambda.isValueObject() && lambda.isLambda() && lambda.getLambdaPrivacyVarKeys().length === 1))
|
|
12472
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
12473
|
+
const _lambda = lambda, rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1, _array = expandArrayValueObject(rowCount, columnCount, array), result = [];
|
|
12474
|
+
for (let r = 0; r < rowCount; r++) {
|
|
12475
|
+
const rows = [[]];
|
|
12476
|
+
for (let c = 0; c < columnCount; c++) {
|
|
12477
|
+
const col = _array.get(r, c);
|
|
12478
|
+
rows[0].push(col);
|
|
12479
|
+
}
|
|
12480
|
+
const lambdaVariant = ArrayValueObject.create({
|
|
12481
|
+
calculateValueList: rows,
|
|
12482
|
+
rowCount: 1,
|
|
12483
|
+
columnCount,
|
|
12484
|
+
unitId: "",
|
|
12485
|
+
sheetId: "",
|
|
12486
|
+
row: 0,
|
|
12487
|
+
column: 0
|
|
12488
|
+
});
|
|
12489
|
+
let value = _lambda.execute(lambdaVariant);
|
|
12490
|
+
if (value.isArray()) {
|
|
12491
|
+
const valueRowCount = value.getRowCount(), valueColumnCount = value.getColumnCount();
|
|
12492
|
+
if (valueRowCount > 1 || valueColumnCount > 1)
|
|
12493
|
+
return ErrorValueObject.create(ErrorType$1.CALC);
|
|
12494
|
+
value = value.get(0, 0);
|
|
12495
|
+
}
|
|
12496
|
+
value.isNull() && (value = NumberValueObject.create(0)), result.push([value]);
|
|
12497
|
+
}
|
|
12498
|
+
return rowCount === 1 ? result[0][0] : ArrayValueObject.create({
|
|
12499
|
+
calculateValueList: result,
|
|
12500
|
+
rowCount,
|
|
12501
|
+
columnCount: 1,
|
|
12502
|
+
unitId: this.unitId,
|
|
12503
|
+
sheetId: this.subUnitId,
|
|
12504
|
+
row: this.row,
|
|
12505
|
+
column: this.column
|
|
12506
|
+
});
|
|
12507
|
+
}
|
|
12508
|
+
};
|
|
12509
|
+
__name(_Byrow, "Byrow");
|
|
12510
|
+
let Byrow = _Byrow;
|
|
12411
12511
|
const _False = class _False extends BaseFunction {
|
|
12412
12512
|
constructor() {
|
|
12413
12513
|
super(...arguments);
|
|
@@ -12420,6 +12520,7 @@ const _False = class _False extends BaseFunction {
|
|
|
12420
12520
|
};
|
|
12421
12521
|
__name(_False, "False");
|
|
12422
12522
|
let False = _False;
|
|
12523
|
+
var FUNCTION_NAMES_LOGICAL = /* @__PURE__ */ ((FUNCTION_NAMES_LOGICAL2) => (FUNCTION_NAMES_LOGICAL2.AND = "AND", FUNCTION_NAMES_LOGICAL2.BYCOL = "BYCOL", FUNCTION_NAMES_LOGICAL2.BYROW = "BYROW", FUNCTION_NAMES_LOGICAL2.FALSE = "FALSE", FUNCTION_NAMES_LOGICAL2.IF = "IF", FUNCTION_NAMES_LOGICAL2.IFERROR = "IFERROR", FUNCTION_NAMES_LOGICAL2.IFNA = "IFNA", FUNCTION_NAMES_LOGICAL2.IFS = "IFS", FUNCTION_NAMES_LOGICAL2.LAMBDA = "LAMBDA", FUNCTION_NAMES_LOGICAL2.LET = "LET", FUNCTION_NAMES_LOGICAL2.MAKEARRAY = "MAKEARRAY", FUNCTION_NAMES_LOGICAL2.MAP = "MAP", FUNCTION_NAMES_LOGICAL2.NOT = "NOT", FUNCTION_NAMES_LOGICAL2.OR = "OR", FUNCTION_NAMES_LOGICAL2.REDUCE = "REDUCE", FUNCTION_NAMES_LOGICAL2.SCAN = "SCAN", FUNCTION_NAMES_LOGICAL2.SWITCH = "SWITCH", FUNCTION_NAMES_LOGICAL2.TRUE = "TRUE", FUNCTION_NAMES_LOGICAL2.XOR = "XOR", FUNCTION_NAMES_LOGICAL2))(FUNCTION_NAMES_LOGICAL || {});
|
|
12423
12524
|
const _If = class _If extends BaseFunction {
|
|
12424
12525
|
constructor() {
|
|
12425
12526
|
super(...arguments);
|
|
@@ -12613,6 +12714,72 @@ const _Makearray = class _Makearray extends BaseFunction {
|
|
|
12613
12714
|
};
|
|
12614
12715
|
__name(_Makearray, "Makearray");
|
|
12615
12716
|
let Makearray = _Makearray;
|
|
12717
|
+
var _a2;
|
|
12718
|
+
let Map$1 = (_a2 = class extends BaseFunction {
|
|
12719
|
+
constructor() {
|
|
12720
|
+
super(...arguments);
|
|
12721
|
+
__publicField(this, "minParams", 2);
|
|
12722
|
+
__publicField(this, "maxParams", 255);
|
|
12723
|
+
}
|
|
12724
|
+
calculate(...variants) {
|
|
12725
|
+
const _variants = [];
|
|
12726
|
+
let lambda = null, maxRowLength = 0, maxColumnLength = 0;
|
|
12727
|
+
for (let i = 0; i < variants.length; i++) {
|
|
12728
|
+
const variant = variants[i];
|
|
12729
|
+
if (variant.isError())
|
|
12730
|
+
return variant;
|
|
12731
|
+
if (i === variants.length - 1) {
|
|
12732
|
+
if (!(variant.isValueObject() && variant.isLambda()))
|
|
12733
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
12734
|
+
lambda = variant;
|
|
12735
|
+
} else
|
|
12736
|
+
_variants.push(variant), maxRowLength = Math.max(maxRowLength, variant.isArray() ? variant.getRowCount() : 1), maxColumnLength = Math.max(maxColumnLength, variant.isArray() ? variant.getColumnCount() : 1);
|
|
12737
|
+
}
|
|
12738
|
+
const resultArray = this._getResultArray(_variants, lambda, maxRowLength, maxColumnLength);
|
|
12739
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray[0][0] : ArrayValueObject.create({
|
|
12740
|
+
calculateValueList: resultArray,
|
|
12741
|
+
rowCount: maxRowLength,
|
|
12742
|
+
columnCount: maxColumnLength,
|
|
12743
|
+
unitId: this.unitId,
|
|
12744
|
+
sheetId: this.subUnitId,
|
|
12745
|
+
row: this.row,
|
|
12746
|
+
column: this.column
|
|
12747
|
+
});
|
|
12748
|
+
}
|
|
12749
|
+
_getResultArray(variants, lambda, maxRowLength, maxColumnLength) {
|
|
12750
|
+
const resultArray = [];
|
|
12751
|
+
for (let r = 0; r < maxRowLength; r++) {
|
|
12752
|
+
const row = [];
|
|
12753
|
+
for (let c = 0; c < maxColumnLength; c++) {
|
|
12754
|
+
const lambdaVariant = [];
|
|
12755
|
+
let isRowPushed = !1;
|
|
12756
|
+
for (let i = 0; i < variants.length; i++) {
|
|
12757
|
+
const variant = variants[i];
|
|
12758
|
+
if (!variant.isArray())
|
|
12759
|
+
if (r === 0 && c === 0) {
|
|
12760
|
+
lambdaVariant.push(variant);
|
|
12761
|
+
continue;
|
|
12762
|
+
} else {
|
|
12763
|
+
row.push(ErrorValueObject.create(ErrorType$1.NA)), isRowPushed = !0;
|
|
12764
|
+
break;
|
|
12765
|
+
}
|
|
12766
|
+
const valueObject = variant.get(r, c);
|
|
12767
|
+
if (!valueObject) {
|
|
12768
|
+
row.push(ErrorValueObject.create(ErrorType$1.NA)), isRowPushed = !0;
|
|
12769
|
+
break;
|
|
12770
|
+
}
|
|
12771
|
+
lambdaVariant.push(valueObject);
|
|
12772
|
+
}
|
|
12773
|
+
if (isRowPushed || lambdaVariant.length === 0)
|
|
12774
|
+
continue;
|
|
12775
|
+
let value = lambda.execute(...lambdaVariant);
|
|
12776
|
+
value.isArray() && (value = value.get(0, 0)), value.isNull() && (value = NumberValueObject.create(0)), row.push(value);
|
|
12777
|
+
}
|
|
12778
|
+
resultArray.push(row);
|
|
12779
|
+
}
|
|
12780
|
+
return resultArray;
|
|
12781
|
+
}
|
|
12782
|
+
}, __name(_a2, "Map"), _a2);
|
|
12616
12783
|
const _Not = class _Not extends BaseFunction {
|
|
12617
12784
|
constructor() {
|
|
12618
12785
|
super(...arguments);
|
|
@@ -12656,6 +12823,100 @@ const _Or = class _Or extends BaseFunction {
|
|
|
12656
12823
|
};
|
|
12657
12824
|
__name(_Or, "Or");
|
|
12658
12825
|
let Or = _Or;
|
|
12826
|
+
const _Reduce = class _Reduce extends BaseFunction {
|
|
12827
|
+
constructor() {
|
|
12828
|
+
super(...arguments);
|
|
12829
|
+
__publicField(this, "minParams", 3);
|
|
12830
|
+
__publicField(this, "maxParams", 3);
|
|
12831
|
+
}
|
|
12832
|
+
calculate(initialValue, array, lambda) {
|
|
12833
|
+
return initialValue.isArray() ? initialValue.mapValue((initialValueObject) => this._handleSingleValueObject(initialValueObject, array, lambda)) : this._handleSingleValueObject(initialValue, array, lambda);
|
|
12834
|
+
}
|
|
12835
|
+
_handleSingleValueObject(initialValue, array, lambda) {
|
|
12836
|
+
if (initialValue.isError())
|
|
12837
|
+
return initialValue;
|
|
12838
|
+
if (array.isError())
|
|
12839
|
+
return array;
|
|
12840
|
+
if (lambda.isError())
|
|
12841
|
+
return lambda;
|
|
12842
|
+
if (!(lambda.isValueObject() && lambda.isLambda() && lambda.getLambdaPrivacyVarKeys().length === 2))
|
|
12843
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
12844
|
+
const _lambda = lambda, rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1;
|
|
12845
|
+
let accumulator = initialValue;
|
|
12846
|
+
for (let r = 0; r < rowCount; r++)
|
|
12847
|
+
for (let c = 0; c < columnCount; c++) {
|
|
12848
|
+
const valueObject = array.isArray() ? array.get(r, c) : array;
|
|
12849
|
+
if (valueObject.isError())
|
|
12850
|
+
return valueObject;
|
|
12851
|
+
let value = _lambda.execute(accumulator, valueObject);
|
|
12852
|
+
if (value.isArray() && (value = value.get(0, 0)), value.isError())
|
|
12853
|
+
return value;
|
|
12854
|
+
value.isNull() && (value = NumberValueObject.create(0)), accumulator = value;
|
|
12855
|
+
}
|
|
12856
|
+
const result = +accumulator.getValue();
|
|
12857
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.VALUE) : NumberValueObject.create(result);
|
|
12858
|
+
}
|
|
12859
|
+
};
|
|
12860
|
+
__name(_Reduce, "Reduce");
|
|
12861
|
+
let Reduce = _Reduce;
|
|
12862
|
+
const _Scan = class _Scan extends BaseFunction {
|
|
12863
|
+
constructor() {
|
|
12864
|
+
super(...arguments);
|
|
12865
|
+
__publicField(this, "minParams", 3);
|
|
12866
|
+
__publicField(this, "maxParams", 3);
|
|
12867
|
+
}
|
|
12868
|
+
calculate(initialValue, array, lambda) {
|
|
12869
|
+
if (initialValue.isError())
|
|
12870
|
+
return initialValue;
|
|
12871
|
+
if (array.isError())
|
|
12872
|
+
return array;
|
|
12873
|
+
if (lambda.isError())
|
|
12874
|
+
return lambda;
|
|
12875
|
+
if (!(lambda.isValueObject() && lambda.isLambda() && lambda.getLambdaPrivacyVarKeys().length === 2))
|
|
12876
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
12877
|
+
let _initialValue = initialValue;
|
|
12878
|
+
if (initialValue.isArray()) {
|
|
12879
|
+
const rowCount = initialValue.getRowCount(), columnCount = initialValue.getColumnCount();
|
|
12880
|
+
if (rowCount > 1 || columnCount > 1)
|
|
12881
|
+
return ErrorValueObject.create(ErrorType$1.CALC);
|
|
12882
|
+
_initialValue = initialValue.get(0, 0);
|
|
12883
|
+
}
|
|
12884
|
+
return this._getResult(_initialValue, array, lambda);
|
|
12885
|
+
}
|
|
12886
|
+
_getResult(initialValue, array, lambda) {
|
|
12887
|
+
const rowCount = array.isArray() ? array.getRowCount() : 1, columnCount = array.isArray() ? array.getColumnCount() : 1;
|
|
12888
|
+
let accumulator = initialValue;
|
|
12889
|
+
const resultArray = [];
|
|
12890
|
+
for (let r = 0; r < rowCount; r++) {
|
|
12891
|
+
const row = [];
|
|
12892
|
+
for (let c = 0; c < columnCount; c++) {
|
|
12893
|
+
if (accumulator.isError()) {
|
|
12894
|
+
row.push(accumulator);
|
|
12895
|
+
continue;
|
|
12896
|
+
}
|
|
12897
|
+
const valueObject = array.isArray() ? array.get(r, c) : array;
|
|
12898
|
+
if (valueObject.isError()) {
|
|
12899
|
+
accumulator = valueObject, row.push(valueObject);
|
|
12900
|
+
continue;
|
|
12901
|
+
}
|
|
12902
|
+
let value = lambda.execute(accumulator, valueObject);
|
|
12903
|
+
value.isArray() && (value = value.get(0, 0)), value.isNull() && (value = NumberValueObject.create(0)), accumulator = value, row.push(value);
|
|
12904
|
+
}
|
|
12905
|
+
resultArray.push(row);
|
|
12906
|
+
}
|
|
12907
|
+
return rowCount === 1 && columnCount === 1 ? resultArray[0][0] : ArrayValueObject.create({
|
|
12908
|
+
calculateValueList: resultArray,
|
|
12909
|
+
rowCount,
|
|
12910
|
+
columnCount,
|
|
12911
|
+
unitId: this.unitId,
|
|
12912
|
+
sheetId: this.subUnitId,
|
|
12913
|
+
row: this.row,
|
|
12914
|
+
column: this.column
|
|
12915
|
+
});
|
|
12916
|
+
}
|
|
12917
|
+
};
|
|
12918
|
+
__name(_Scan, "Scan");
|
|
12919
|
+
let Scan = _Scan;
|
|
12659
12920
|
const _Switch = class _Switch extends BaseFunction {
|
|
12660
12921
|
constructor() {
|
|
12661
12922
|
super(...arguments);
|
|
@@ -12747,6 +13008,8 @@ __name(_Xor, "Xor");
|
|
|
12747
13008
|
let Xor = _Xor;
|
|
12748
13009
|
const functionLogical = [
|
|
12749
13010
|
[And, FUNCTION_NAMES_LOGICAL.AND],
|
|
13011
|
+
[Bycol, FUNCTION_NAMES_LOGICAL.BYCOL],
|
|
13012
|
+
[Byrow, FUNCTION_NAMES_LOGICAL.BYROW],
|
|
12750
13013
|
[False, FUNCTION_NAMES_LOGICAL.FALSE],
|
|
12751
13014
|
[If, FUNCTION_NAMES_LOGICAL.IF],
|
|
12752
13015
|
[Iferror, FUNCTION_NAMES_LOGICAL.IFERROR],
|
|
@@ -12755,14 +13018,15 @@ const functionLogical = [
|
|
|
12755
13018
|
[Lambda, FUNCTION_NAMES_LOGICAL.LAMBDA],
|
|
12756
13019
|
[Let, FUNCTION_NAMES_LOGICAL.LET],
|
|
12757
13020
|
[Makearray, FUNCTION_NAMES_LOGICAL.MAKEARRAY],
|
|
13021
|
+
[Map$1, FUNCTION_NAMES_LOGICAL.MAP],
|
|
12758
13022
|
[Not, FUNCTION_NAMES_LOGICAL.NOT],
|
|
12759
13023
|
[Or, FUNCTION_NAMES_LOGICAL.OR],
|
|
13024
|
+
[Reduce, FUNCTION_NAMES_LOGICAL.REDUCE],
|
|
13025
|
+
[Scan, FUNCTION_NAMES_LOGICAL.SCAN],
|
|
12760
13026
|
[Switch, FUNCTION_NAMES_LOGICAL.SWITCH],
|
|
12761
13027
|
[True, FUNCTION_NAMES_LOGICAL.TRUE],
|
|
12762
13028
|
[Xor, FUNCTION_NAMES_LOGICAL.XOR]
|
|
12763
|
-
]
|
|
12764
|
-
var FUNCTION_NAMES_LOOKUP = /* @__PURE__ */ ((FUNCTION_NAMES_LOOKUP2) => (FUNCTION_NAMES_LOOKUP2.ADDRESS = "ADDRESS", FUNCTION_NAMES_LOOKUP2.AREAS = "AREAS", FUNCTION_NAMES_LOOKUP2.CHOOSE = "CHOOSE", FUNCTION_NAMES_LOOKUP2.CHOOSECOLS = "CHOOSECOLS", FUNCTION_NAMES_LOOKUP2.CHOOSEROWS = "CHOOSEROWS", FUNCTION_NAMES_LOOKUP2.COLUMN = "COLUMN", FUNCTION_NAMES_LOOKUP2.COLUMNS = "COLUMNS", FUNCTION_NAMES_LOOKUP2.DROP = "DROP", FUNCTION_NAMES_LOOKUP2.EXPAND = "EXPAND", FUNCTION_NAMES_LOOKUP2.FILTER = "FILTER", FUNCTION_NAMES_LOOKUP2.FORMULATEXT = "FORMULATEXT", FUNCTION_NAMES_LOOKUP2.GETPIVOTDATA = "GETPIVOTDATA", FUNCTION_NAMES_LOOKUP2.HLOOKUP = "HLOOKUP", FUNCTION_NAMES_LOOKUP2.HSTACK = "HSTACK", FUNCTION_NAMES_LOOKUP2.HYPERLINK = "HYPERLINK", FUNCTION_NAMES_LOOKUP2.IMAGE = "IMAGE", FUNCTION_NAMES_LOOKUP2.INDEX = "INDEX", FUNCTION_NAMES_LOOKUP2.INDIRECT = "INDIRECT", FUNCTION_NAMES_LOOKUP2.LOOKUP = "LOOKUP", FUNCTION_NAMES_LOOKUP2.MATCH = "MATCH", FUNCTION_NAMES_LOOKUP2.OFFSET = "OFFSET", FUNCTION_NAMES_LOOKUP2.ROW = "ROW", FUNCTION_NAMES_LOOKUP2.ROWS = "ROWS", FUNCTION_NAMES_LOOKUP2.RTD = "RTD", FUNCTION_NAMES_LOOKUP2.SORT = "SORT", FUNCTION_NAMES_LOOKUP2.SORTBY = "SORTBY", FUNCTION_NAMES_LOOKUP2.TAKE = "TAKE", FUNCTION_NAMES_LOOKUP2.TOCOL = "TOCOL", FUNCTION_NAMES_LOOKUP2.TOROW = "TOROW", FUNCTION_NAMES_LOOKUP2.TRANSPOSE = "TRANSPOSE", FUNCTION_NAMES_LOOKUP2.UNIQUE = "UNIQUE", FUNCTION_NAMES_LOOKUP2.VLOOKUP = "VLOOKUP", FUNCTION_NAMES_LOOKUP2.VSTACK = "VSTACK", FUNCTION_NAMES_LOOKUP2.WRAPCOLS = "WRAPCOLS", FUNCTION_NAMES_LOOKUP2.WRAPROWS = "WRAPROWS", FUNCTION_NAMES_LOOKUP2.XLOOKUP = "XLOOKUP", FUNCTION_NAMES_LOOKUP2.XMATCH = "XMATCH", FUNCTION_NAMES_LOOKUP2))(FUNCTION_NAMES_LOOKUP || {});
|
|
12765
|
-
const _Address = class _Address extends BaseFunction {
|
|
13029
|
+
], _Address = class _Address extends BaseFunction {
|
|
12766
13030
|
constructor() {
|
|
12767
13031
|
super(...arguments);
|
|
12768
13032
|
__publicField(this, "minParams", 2);
|
|
@@ -13016,76 +13280,237 @@ const _Columns = class _Columns extends BaseFunction {
|
|
|
13016
13280
|
};
|
|
13017
13281
|
__name(_Columns, "Columns");
|
|
13018
13282
|
let Columns = _Columns;
|
|
13019
|
-
const
|
|
13283
|
+
const _Drop = class _Drop extends BaseFunction {
|
|
13020
13284
|
constructor() {
|
|
13021
13285
|
super(...arguments);
|
|
13022
13286
|
__publicField(this, "minParams", 2);
|
|
13023
13287
|
__publicField(this, "maxParams", 3);
|
|
13024
13288
|
}
|
|
13025
|
-
calculate(array,
|
|
13026
|
-
const
|
|
13289
|
+
calculate(array, rows, columns) {
|
|
13290
|
+
const _columns = columns != null ? columns : NumberValueObject.create(0), arrayRowCount = array.isArray() ? array.getRowCount() : 1, arrayColumnCount = array.isArray() ? array.getColumnCount() : 1, maxRowLength = Math.max(
|
|
13291
|
+
rows.isArray() ? rows.getRowCount() : 1,
|
|
13292
|
+
_columns.isArray() ? _columns.getRowCount() : 1
|
|
13293
|
+
), maxColumnLength = Math.max(
|
|
13294
|
+
rows.isArray() ? rows.getColumnCount() : 1,
|
|
13295
|
+
_columns.isArray() ? _columns.getColumnCount() : 1
|
|
13296
|
+
), rowsArray = expandArrayValueObject(maxRowLength, maxColumnLength, rows, ErrorValueObject.create(ErrorType$1.NA)), columnsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _columns, ErrorValueObject.create(ErrorType$1.NA));
|
|
13297
|
+
if (maxRowLength > 1 || maxColumnLength > 1)
|
|
13298
|
+
return rowsArray.mapValue((rowsObject2, rowIndex, columnIndex) => {
|
|
13299
|
+
const columnsObject2 = columnsArray.get(rowIndex, columnIndex);
|
|
13300
|
+
if (array.isError())
|
|
13301
|
+
return array;
|
|
13302
|
+
if (array.isNull())
|
|
13303
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13304
|
+
const { isError: isError2, errorObject: errorObject2 } = this._checkRowsColumns(rowsObject2, columnsObject2, arrayRowCount, arrayColumnCount);
|
|
13305
|
+
return isError2 ? errorObject2 : array.isArray() ? ErrorValueObject.create(ErrorType$1.VALUE) : array;
|
|
13306
|
+
});
|
|
13027
13307
|
if (array.isError())
|
|
13028
13308
|
return array;
|
|
13029
|
-
if (
|
|
13030
|
-
return
|
|
13031
|
-
const
|
|
13032
|
-
return
|
|
13033
|
-
}
|
|
13034
|
-
_getResultArrayByR1C1(array, include, ifEmpty) {
|
|
13035
|
-
let _array = array, _include = include;
|
|
13036
|
-
return _array.isArray() && (_array = _array.get(0, 0)), _include.isArray() && (_include = _include.get(0, 0)), _include.isString() && (_include = _include.convertToNumberObjectValue()), _include.isError() ? _include : +_include.getValue() ? _array : ifEmpty;
|
|
13309
|
+
if (array.isNull())
|
|
13310
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13311
|
+
const rowsObject = rows.isArray() ? rows.get(0, 0) : rows, columnsObject = _columns.isArray() ? _columns.get(0, 0) : _columns, { isError, errorObject, rowsValue, columnsValue } = this._checkRowsColumns(rowsObject, columnsObject, arrayRowCount, arrayColumnCount);
|
|
13312
|
+
return isError ? errorObject : this._getResultArray(array, rowsValue, columnsValue, arrayRowCount, arrayColumnCount);
|
|
13037
13313
|
}
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13050
|
-
|
|
13051
|
-
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
|
|
13314
|
+
_checkRowsColumns(rowsObject, columnsObject, arrayRowCount, arrayColumnCount) {
|
|
13315
|
+
if (rowsObject.isError())
|
|
13316
|
+
return {
|
|
13317
|
+
isError: !0,
|
|
13318
|
+
errorObject: rowsObject
|
|
13319
|
+
};
|
|
13320
|
+
if (columnsObject.isError())
|
|
13321
|
+
return {
|
|
13322
|
+
isError: !0,
|
|
13323
|
+
errorObject: columnsObject
|
|
13324
|
+
};
|
|
13325
|
+
const rowsValue = Math.trunc(+rowsObject.getValue()), columnsValue = Math.trunc(+columnsObject.getValue());
|
|
13326
|
+
return Number.isNaN(rowsValue) || Number.isNaN(columnsValue) ? {
|
|
13327
|
+
isError: !0,
|
|
13328
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
|
|
13329
|
+
} : Math.abs(rowsValue) >= arrayRowCount || Math.abs(columnsValue) >= arrayColumnCount ? {
|
|
13330
|
+
isError: !0,
|
|
13331
|
+
errorObject: ErrorValueObject.create(ErrorType$1.CALC)
|
|
13332
|
+
} : {
|
|
13333
|
+
isError: !1,
|
|
13334
|
+
rowsValue,
|
|
13335
|
+
columnsValue
|
|
13336
|
+
};
|
|
13060
13337
|
}
|
|
13061
|
-
|
|
13062
|
-
const
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13338
|
+
_getResultArray(array, rows, columns, arrayRowCount, arrayColumnCount) {
|
|
13339
|
+
const rowParam = rows >= 0 ? [rows, arrayRowCount] : [0, arrayRowCount + rows], columnParam = columns >= 0 ? [columns, arrayColumnCount] : [0, arrayColumnCount + columns];
|
|
13340
|
+
let resultArray;
|
|
13341
|
+
return rows === 0 && columns === 0 ? resultArray = array : rows === 0 ? resultArray = array.slice(void 0, columnParam) : columns === 0 ? resultArray = array.slice(rowParam, void 0) : resultArray = array.slice(rowParam, columnParam), resultArray = resultArray.map((valueObject) => valueObject.isNull() ? NumberValueObject.create(0) : valueObject), arrayRowCount - rows === 1 && arrayColumnCount - columns === 1 ? resultArray.get(0, 0) : resultArray;
|
|
13342
|
+
}
|
|
13343
|
+
};
|
|
13344
|
+
__name(_Drop, "Drop");
|
|
13345
|
+
let Drop = _Drop;
|
|
13346
|
+
const _Expand = class _Expand extends BaseFunction {
|
|
13347
|
+
constructor() {
|
|
13348
|
+
super(...arguments);
|
|
13349
|
+
__publicField(this, "minParams", 2);
|
|
13350
|
+
__publicField(this, "maxParams", 4);
|
|
13351
|
+
}
|
|
13352
|
+
calculate(array, rows, columns, padWith) {
|
|
13353
|
+
const arrayRowCount = array.isArray() ? array.getRowCount() : 1, arrayColumnCount = array.isArray() ? array.getColumnCount() : 1;
|
|
13354
|
+
let _rows = rows, _columns = columns != null ? columns : NumberValueObject.create(arrayColumnCount);
|
|
13355
|
+
const _padWith = padWith != null ? padWith : ErrorValueObject.create(ErrorType$1.NA);
|
|
13356
|
+
rows.isNull() && (_rows = NumberValueObject.create(arrayRowCount)), _columns.isNull() && (_columns = NumberValueObject.create(arrayColumnCount));
|
|
13357
|
+
const maxRowLength = Math.max(
|
|
13358
|
+
_rows.isArray() ? _rows.getRowCount() : 1,
|
|
13359
|
+
_columns.isArray() ? _columns.getRowCount() : 1
|
|
13360
|
+
), maxColumnLength = Math.max(
|
|
13361
|
+
_rows.isArray() ? _rows.getColumnCount() : 1,
|
|
13362
|
+
_columns.isArray() ? _columns.getColumnCount() : 1
|
|
13363
|
+
), rowsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _rows, ErrorValueObject.create(ErrorType$1.NA)), columnsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _columns, ErrorValueObject.create(ErrorType$1.NA));
|
|
13364
|
+
if (maxRowLength > 1 || maxColumnLength > 1)
|
|
13365
|
+
return rowsArray.mapValue((rowsObject2, rowIndex, columnIndex) => {
|
|
13366
|
+
const columnsObject2 = columnsArray.get(rowIndex, columnIndex);
|
|
13367
|
+
if (array.isError())
|
|
13368
|
+
return array;
|
|
13369
|
+
if (array.isNull())
|
|
13370
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13371
|
+
const { isError: isError2, errorObject: errorObject2 } = this._checkRowsColumnsPadWith(rowsObject2, columnsObject2, _padWith, arrayRowCount, arrayColumnCount);
|
|
13372
|
+
return isError2 ? errorObject2 : array.isArray() ? array.get(0, 0) : array;
|
|
13373
|
+
});
|
|
13374
|
+
if (array.isError())
|
|
13375
|
+
return array;
|
|
13376
|
+
if (array.isNull())
|
|
13377
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13378
|
+
const rowsObject = _rows.isArray() ? _rows.get(0, 0) : _rows, columnsObject = _columns.isArray() ? _columns.get(0, 0) : _columns, { isError, errorObject, rowsValue, columnsValue, padWithObject } = this._checkRowsColumnsPadWith(rowsObject, columnsObject, _padWith, arrayRowCount, arrayColumnCount);
|
|
13379
|
+
return isError ? errorObject : this._getResultArray(array, rowsValue, columnsValue, padWithObject, arrayRowCount, arrayColumnCount);
|
|
13380
|
+
}
|
|
13381
|
+
_checkRowsColumnsPadWith(rowsObject, columnsObject, padWith, arrayRowCount, arrayColumnCount) {
|
|
13382
|
+
if (rowsObject.isError())
|
|
13383
|
+
return {
|
|
13384
|
+
isError: !0,
|
|
13385
|
+
errorObject: rowsObject
|
|
13386
|
+
};
|
|
13387
|
+
if (columnsObject.isError())
|
|
13388
|
+
return {
|
|
13389
|
+
isError: !0,
|
|
13390
|
+
errorObject: columnsObject
|
|
13391
|
+
};
|
|
13392
|
+
const rowsValue = Math.trunc(+rowsObject.getValue()), columnsValue = Math.trunc(+columnsObject.getValue());
|
|
13393
|
+
if (Number.isNaN(rowsValue) || Number.isNaN(columnsValue))
|
|
13394
|
+
return {
|
|
13395
|
+
isError: !0,
|
|
13396
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
|
|
13397
|
+
};
|
|
13398
|
+
if (Math.abs(rowsValue) < arrayRowCount || Math.abs(columnsValue) < arrayColumnCount)
|
|
13399
|
+
return {
|
|
13400
|
+
isError: !0,
|
|
13401
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
|
|
13402
|
+
};
|
|
13403
|
+
let _padWith = padWith;
|
|
13404
|
+
if (padWith.isArray()) {
|
|
13405
|
+
const rowCount = padWith.getRowCount(), columnCount = padWith.getColumnCount();
|
|
13406
|
+
if (rowCount > 1 || columnCount > 1)
|
|
13407
|
+
return {
|
|
13408
|
+
isError: !0,
|
|
13409
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
|
|
13410
|
+
};
|
|
13411
|
+
_padWith = padWith.get(0, 0);
|
|
13412
|
+
}
|
|
13413
|
+
return {
|
|
13414
|
+
isError: !1,
|
|
13415
|
+
rowsValue,
|
|
13416
|
+
columnsValue,
|
|
13417
|
+
padWithObject: _padWith
|
|
13418
|
+
};
|
|
13419
|
+
}
|
|
13420
|
+
_getResultArray(array, rows, columns, padWith, arrayRowCount, arrayColumnCount) {
|
|
13421
|
+
let resultArray = [];
|
|
13422
|
+
array.isArray() ? resultArray = array.map((valueObject) => valueObject.isNull() ? NumberValueObject.create(0) : valueObject).getArrayValue() : resultArray = [[array]];
|
|
13423
|
+
const addRows = Math.max(0, rows - arrayRowCount), addColumns = Math.max(0, columns - arrayColumnCount);
|
|
13424
|
+
for (let r = 0; r < addRows; r++)
|
|
13425
|
+
resultArray.push(new Array(arrayColumnCount).fill(padWith));
|
|
13426
|
+
for (let c = 0; c < addColumns; c++)
|
|
13427
|
+
resultArray.forEach((row) => {
|
|
13428
|
+
row.push(padWith);
|
|
13429
|
+
});
|
|
13430
|
+
return rows === 1 && columns === 1 ? resultArray[0][0] : ArrayValueObject.create({
|
|
13431
|
+
calculateValueList: resultArray,
|
|
13432
|
+
rowCount: resultArray.length,
|
|
13433
|
+
columnCount: resultArray[0].length,
|
|
13434
|
+
unitId: this.unitId,
|
|
13435
|
+
sheetId: this.subUnitId,
|
|
13436
|
+
row: this.row,
|
|
13437
|
+
column: this.column
|
|
13438
|
+
});
|
|
13439
|
+
}
|
|
13440
|
+
};
|
|
13441
|
+
__name(_Expand, "Expand");
|
|
13442
|
+
let Expand = _Expand;
|
|
13443
|
+
const _Filter = class _Filter extends BaseFunction {
|
|
13444
|
+
constructor() {
|
|
13445
|
+
super(...arguments);
|
|
13446
|
+
__publicField(this, "minParams", 2);
|
|
13447
|
+
__publicField(this, "maxParams", 3);
|
|
13448
|
+
}
|
|
13449
|
+
calculate(array, include, ifEmpty) {
|
|
13450
|
+
const _ifEmpty = ifEmpty != null ? ifEmpty : ErrorValueObject.create(ErrorType$1.CALC);
|
|
13451
|
+
if (array.isError())
|
|
13452
|
+
return array;
|
|
13453
|
+
if (include.isError())
|
|
13454
|
+
return include;
|
|
13455
|
+
const arrayRowCount = array.isArray() ? array.getRowCount() : 1, arrayColumnCount = array.isArray() ? array.getColumnCount() : 1, includeRowCount = include.isArray() ? include.getRowCount() : 1, includeColumnCount = include.isArray() ? include.getColumnCount() : 1;
|
|
13456
|
+
return includeRowCount > 1 && includeColumnCount > 1 || includeRowCount === 1 && includeColumnCount !== arrayColumnCount || includeColumnCount === 1 && includeRowCount !== arrayRowCount ? ErrorValueObject.create(ErrorType$1.VALUE) : arrayRowCount === 1 && arrayColumnCount === 1 ? this._getResultArrayByR1C1(array, include, _ifEmpty) : includeRowCount === 1 ? includeColumnCount !== arrayColumnCount ? ErrorValueObject.create(ErrorType$1.VALUE) : this._getResultArrayByR1(arrayRowCount, arrayColumnCount, array, include, _ifEmpty) : includeColumnCount === 1 ? includeRowCount !== arrayRowCount ? ErrorValueObject.create(ErrorType$1.VALUE) : this._getResultArrayByC1(arrayRowCount, arrayColumnCount, array, include, _ifEmpty) : _ifEmpty;
|
|
13457
|
+
}
|
|
13458
|
+
_getResultArrayByR1C1(array, include, ifEmpty) {
|
|
13459
|
+
let _array = array, _include = include;
|
|
13460
|
+
return _array.isArray() && (_array = _array.get(0, 0)), _include.isArray() && (_include = _include.get(0, 0)), _include.isString() && (_include = _include.convertToNumberObjectValue()), _include.isError() ? _include : +_include.getValue() ? _array : ifEmpty;
|
|
13461
|
+
}
|
|
13462
|
+
_getResultArrayByR1(arrayRowCount, arrayColumnCount, array, include, ifEmpty) {
|
|
13463
|
+
const resultArray = [];
|
|
13464
|
+
for (let c = 0; c < arrayColumnCount; c++) {
|
|
13465
|
+
let includeObject = include.get(0, c);
|
|
13466
|
+
if (includeObject.isString() && (includeObject = includeObject.convertToNumberObjectValue()), includeObject.isError())
|
|
13467
|
+
return includeObject;
|
|
13468
|
+
if (+includeObject.getValue())
|
|
13469
|
+
for (let r = 0; r < arrayRowCount; r++) {
|
|
13470
|
+
resultArray[r] || (resultArray[r] = []);
|
|
13471
|
+
const arrayObject = array.get(r, c);
|
|
13472
|
+
resultArray[r].push(arrayObject);
|
|
13473
|
+
}
|
|
13474
|
+
}
|
|
13475
|
+
return resultArray.length === 0 ? ifEmpty : ArrayValueObject.create({
|
|
13476
|
+
calculateValueList: resultArray,
|
|
13477
|
+
rowCount: resultArray.length,
|
|
13478
|
+
columnCount: resultArray[0].length || 0,
|
|
13479
|
+
unitId: this.unitId,
|
|
13480
|
+
sheetId: this.subUnitId,
|
|
13481
|
+
row: this.row,
|
|
13482
|
+
column: this.column
|
|
13483
|
+
});
|
|
13484
|
+
}
|
|
13485
|
+
_getResultArrayByC1(arrayRowCount, arrayColumnCount, array, include, ifEmpty) {
|
|
13486
|
+
const resultArray = [];
|
|
13487
|
+
for (let r = 0; r < arrayRowCount; r++) {
|
|
13488
|
+
let includeObject = include.get(r, 0);
|
|
13489
|
+
if (includeObject.isString() && (includeObject = includeObject.convertToNumberObjectValue()), includeObject.isError())
|
|
13490
|
+
return includeObject;
|
|
13491
|
+
if (!+includeObject.getValue())
|
|
13492
|
+
continue;
|
|
13493
|
+
const row = [];
|
|
13494
|
+
for (let c = 0; c < arrayColumnCount; c++) {
|
|
13495
|
+
const arrayObject = array.get(r, c);
|
|
13496
|
+
row.push(arrayObject);
|
|
13497
|
+
}
|
|
13498
|
+
resultArray.push(row);
|
|
13499
|
+
}
|
|
13500
|
+
return resultArray.length === 0 ? ifEmpty : ArrayValueObject.create({
|
|
13501
|
+
calculateValueList: resultArray,
|
|
13502
|
+
rowCount: resultArray.length,
|
|
13503
|
+
columnCount: resultArray[0].length || 0,
|
|
13504
|
+
unitId: this.unitId,
|
|
13505
|
+
sheetId: this.subUnitId,
|
|
13506
|
+
row: this.row,
|
|
13507
|
+
column: this.column
|
|
13508
|
+
});
|
|
13085
13509
|
}
|
|
13086
13510
|
};
|
|
13087
13511
|
__name(_Filter, "Filter");
|
|
13088
13512
|
let Filter = _Filter;
|
|
13513
|
+
var FUNCTION_NAMES_LOOKUP = /* @__PURE__ */ ((FUNCTION_NAMES_LOOKUP2) => (FUNCTION_NAMES_LOOKUP2.ADDRESS = "ADDRESS", FUNCTION_NAMES_LOOKUP2.AREAS = "AREAS", FUNCTION_NAMES_LOOKUP2.CHOOSE = "CHOOSE", FUNCTION_NAMES_LOOKUP2.CHOOSECOLS = "CHOOSECOLS", FUNCTION_NAMES_LOOKUP2.CHOOSEROWS = "CHOOSEROWS", FUNCTION_NAMES_LOOKUP2.COLUMN = "COLUMN", FUNCTION_NAMES_LOOKUP2.COLUMNS = "COLUMNS", FUNCTION_NAMES_LOOKUP2.DROP = "DROP", FUNCTION_NAMES_LOOKUP2.EXPAND = "EXPAND", FUNCTION_NAMES_LOOKUP2.FILTER = "FILTER", FUNCTION_NAMES_LOOKUP2.FORMULATEXT = "FORMULATEXT", FUNCTION_NAMES_LOOKUP2.GETPIVOTDATA = "GETPIVOTDATA", FUNCTION_NAMES_LOOKUP2.HLOOKUP = "HLOOKUP", FUNCTION_NAMES_LOOKUP2.HSTACK = "HSTACK", FUNCTION_NAMES_LOOKUP2.HYPERLINK = "HYPERLINK", FUNCTION_NAMES_LOOKUP2.IMAGE = "IMAGE", FUNCTION_NAMES_LOOKUP2.INDEX = "INDEX", FUNCTION_NAMES_LOOKUP2.INDIRECT = "INDIRECT", FUNCTION_NAMES_LOOKUP2.LOOKUP = "LOOKUP", FUNCTION_NAMES_LOOKUP2.MATCH = "MATCH", FUNCTION_NAMES_LOOKUP2.OFFSET = "OFFSET", FUNCTION_NAMES_LOOKUP2.ROW = "ROW", FUNCTION_NAMES_LOOKUP2.ROWS = "ROWS", FUNCTION_NAMES_LOOKUP2.RTD = "RTD", FUNCTION_NAMES_LOOKUP2.SORT = "SORT", FUNCTION_NAMES_LOOKUP2.SORTBY = "SORTBY", FUNCTION_NAMES_LOOKUP2.TAKE = "TAKE", FUNCTION_NAMES_LOOKUP2.TOCOL = "TOCOL", FUNCTION_NAMES_LOOKUP2.TOROW = "TOROW", FUNCTION_NAMES_LOOKUP2.TRANSPOSE = "TRANSPOSE", FUNCTION_NAMES_LOOKUP2.UNIQUE = "UNIQUE", FUNCTION_NAMES_LOOKUP2.VLOOKUP = "VLOOKUP", FUNCTION_NAMES_LOOKUP2.VSTACK = "VSTACK", FUNCTION_NAMES_LOOKUP2.WRAPCOLS = "WRAPCOLS", FUNCTION_NAMES_LOOKUP2.WRAPROWS = "WRAPROWS", FUNCTION_NAMES_LOOKUP2.XLOOKUP = "XLOOKUP", FUNCTION_NAMES_LOOKUP2.XMATCH = "XMATCH", FUNCTION_NAMES_LOOKUP2))(FUNCTION_NAMES_LOOKUP || {});
|
|
13089
13514
|
const _Hlookup = class _Hlookup extends BaseFunction {
|
|
13090
13515
|
constructor() {
|
|
13091
13516
|
super(...arguments);
|
|
@@ -13150,6 +13575,112 @@ const _Hstack = class _Hstack extends BaseFunction {
|
|
|
13150
13575
|
};
|
|
13151
13576
|
__name(_Hstack, "Hstack");
|
|
13152
13577
|
let Hstack = _Hstack;
|
|
13578
|
+
const _Index = class _Index extends BaseFunction {
|
|
13579
|
+
constructor() {
|
|
13580
|
+
super(...arguments);
|
|
13581
|
+
__publicField(this, "minParams", 1);
|
|
13582
|
+
__publicField(this, "maxParams", 4);
|
|
13583
|
+
__publicField(this, "needsReferenceObject", !0);
|
|
13584
|
+
}
|
|
13585
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
|
13586
|
+
calculate(reference, rowNum, columnNum, areaNum) {
|
|
13587
|
+
if (reference.isError())
|
|
13588
|
+
return reference;
|
|
13589
|
+
if (rowNum != null && rowNum.isError())
|
|
13590
|
+
return rowNum;
|
|
13591
|
+
if (columnNum != null && columnNum.isError())
|
|
13592
|
+
return columnNum;
|
|
13593
|
+
if (areaNum != null && areaNum.isError())
|
|
13594
|
+
return areaNum;
|
|
13595
|
+
let referenceRowCount = 0, referenceColumnCount = 0;
|
|
13596
|
+
if (reference.isValueObject())
|
|
13597
|
+
referenceRowCount = 1, referenceColumnCount = 1;
|
|
13598
|
+
else if (reference.isReferenceObject()) {
|
|
13599
|
+
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
13600
|
+
referenceRowCount = endRow - startRow + 1, referenceColumnCount = endColumn - startColumn + 1;
|
|
13601
|
+
} else
|
|
13602
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13603
|
+
let _rowNum, _columnNum;
|
|
13604
|
+
referenceRowCount === 1 && referenceColumnCount > 1 && columnNum == null ? (_columnNum = rowNum != null ? rowNum : NumberValueObject.create(0), _rowNum = NumberValueObject.create(0)) : (_rowNum = rowNum != null ? rowNum : NumberValueObject.create(0), _columnNum = columnNum != null ? columnNum : NumberValueObject.create(0));
|
|
13605
|
+
let _areaNum = areaNum != null ? areaNum : NumberValueObject.create(1);
|
|
13606
|
+
_rowNum.isReferenceObject() && (_rowNum = _rowNum.toArrayValueObject()), _columnNum.isReferenceObject() && (_columnNum = _columnNum.toArrayValueObject()), _areaNum.isReferenceObject() && (_areaNum = _areaNum.toArrayValueObject());
|
|
13607
|
+
const maxRowLength = Math.max(
|
|
13608
|
+
_rowNum.isArray() ? _rowNum.getRowCount() : 1,
|
|
13609
|
+
_columnNum.isArray() ? _columnNum.getRowCount() : 1,
|
|
13610
|
+
_areaNum.isArray() ? _areaNum.getRowCount() : 1
|
|
13611
|
+
), maxColumnLength = Math.max(
|
|
13612
|
+
_rowNum.isArray() ? _rowNum.getColumnCount() : 1,
|
|
13613
|
+
_columnNum.isArray() ? _columnNum.getColumnCount() : 1,
|
|
13614
|
+
_areaNum.isArray() ? _areaNum.getColumnCount() : 1
|
|
13615
|
+
);
|
|
13616
|
+
if (_rowNum = _rowNum, _columnNum = _columnNum, _areaNum = _areaNum, maxRowLength === 1 && maxColumnLength === 1)
|
|
13617
|
+
return this._calculateSingleCell(reference, _rowNum, _columnNum, _areaNum);
|
|
13618
|
+
{
|
|
13619
|
+
const rowNumArray = expandArrayValueObject(maxRowLength, maxColumnLength, _rowNum, ErrorValueObject.create(ErrorType$1.NA)), columnNumArray = expandArrayValueObject(maxRowLength, maxColumnLength, _columnNum, ErrorValueObject.create(ErrorType$1.NA)), areaNumArray = expandArrayValueObject(maxRowLength, maxColumnLength, _areaNum, ErrorValueObject.create(ErrorType$1.NA));
|
|
13620
|
+
return rowNumArray.map((rowNumValue, rowIndex, columnIndex) => {
|
|
13621
|
+
const columnNumValue = columnNumArray.get(rowIndex, columnIndex) || NullValueObject.create(), areaNumValue = areaNumArray.get(rowIndex, columnIndex) || NullValueObject.create(), result = this._calculateSingleCell(reference, rowNumValue, columnNumValue, areaNumValue);
|
|
13622
|
+
return result.isReferenceObject() ? result.toArrayValueObject().getFirstCell() : result;
|
|
13623
|
+
});
|
|
13624
|
+
}
|
|
13625
|
+
}
|
|
13626
|
+
_calculateSingleCell(reference, rowNum, columnNum, areaNum) {
|
|
13627
|
+
if (rowNum.isError())
|
|
13628
|
+
return rowNum;
|
|
13629
|
+
const rowNumberValue = this._getNumberValue(rowNum);
|
|
13630
|
+
if (rowNumberValue === void 0 || rowNumberValue < 0)
|
|
13631
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13632
|
+
if (columnNum.isError())
|
|
13633
|
+
return columnNum;
|
|
13634
|
+
const columnNumberValue = this._getNumberValue(columnNum);
|
|
13635
|
+
if (columnNumberValue === void 0 || columnNumberValue < 0)
|
|
13636
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13637
|
+
if (areaNum.isError())
|
|
13638
|
+
return areaNum;
|
|
13639
|
+
const areaNumberValue = this._getAreaNumberValue(areaNum);
|
|
13640
|
+
return areaNumberValue === void 0 || areaNumberValue < 1 ? ErrorValueObject.create(ErrorType$1.VALUE) : reference.isReferenceObject() ? this._getReferenceObject(reference, rowNumberValue, columnNumberValue, areaNumberValue) : reference.isValueObject() && rowNumberValue === 1 && columnNumberValue === 1 ? reference : ErrorValueObject.create(ErrorType$1.REF);
|
|
13641
|
+
}
|
|
13642
|
+
_getNumberValue(numberValueObject) {
|
|
13643
|
+
if (numberValueObject == null)
|
|
13644
|
+
return 0;
|
|
13645
|
+
let logicValue = 0;
|
|
13646
|
+
if (numberValueObject.isBoolean())
|
|
13647
|
+
numberValueObject.getValue() === !0 && (logicValue = 1);
|
|
13648
|
+
else {
|
|
13649
|
+
if (numberValueObject.isString())
|
|
13650
|
+
return;
|
|
13651
|
+
numberValueObject.isNumber() ? logicValue = Math.floor(numberValueObject.getValue()) : numberValueObject.isNull() && (logicValue = 0);
|
|
13652
|
+
}
|
|
13653
|
+
return logicValue;
|
|
13654
|
+
}
|
|
13655
|
+
_getAreaNumberValue(numberValueObject) {
|
|
13656
|
+
if (numberValueObject == null)
|
|
13657
|
+
return 1;
|
|
13658
|
+
let logicValue = 0;
|
|
13659
|
+
if (numberValueObject.isBoolean())
|
|
13660
|
+
numberValueObject.getValue() === !0 && (logicValue = 1);
|
|
13661
|
+
else {
|
|
13662
|
+
if (numberValueObject.isString())
|
|
13663
|
+
return;
|
|
13664
|
+
numberValueObject.isNumber() ? logicValue = Math.floor(numberValueObject.getValue()) : numberValueObject.isNull() && (logicValue = 0);
|
|
13665
|
+
}
|
|
13666
|
+
return logicValue;
|
|
13667
|
+
}
|
|
13668
|
+
_getReferenceObject(reference, rowNumberValue, columnNumberValue, areaNumberValue) {
|
|
13669
|
+
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
13670
|
+
let referenceStartRow = 0, referenceEndRow = 0, referenceStartColumn = 0, referenceEndColumn = 0;
|
|
13671
|
+
if (rowNumberValue === 0 ? (referenceStartRow = startRow, referenceEndRow = endRow) : referenceStartRow = referenceEndRow = startRow + rowNumberValue - 1, columnNumberValue === 0 ? (referenceStartColumn = startColumn, referenceEndColumn = endColumn) : referenceStartColumn = referenceEndColumn = startColumn + columnNumberValue - 1, referenceStartRow > endRow || referenceStartColumn > endColumn)
|
|
13672
|
+
return ErrorValueObject.create(ErrorType$1.REF);
|
|
13673
|
+
const range = {
|
|
13674
|
+
startRow: referenceStartRow,
|
|
13675
|
+
startColumn: referenceStartColumn,
|
|
13676
|
+
endRow: referenceEndRow,
|
|
13677
|
+
endColumn: referenceEndColumn
|
|
13678
|
+
};
|
|
13679
|
+
return this.createReferenceObject(reference, range);
|
|
13680
|
+
}
|
|
13681
|
+
};
|
|
13682
|
+
__name(_Index, "Index");
|
|
13683
|
+
let Index = _Index;
|
|
13153
13684
|
const _Indirect = class _Indirect extends BaseFunction {
|
|
13154
13685
|
constructor() {
|
|
13155
13686
|
super(...arguments);
|
|
@@ -13721,6 +14252,224 @@ const _Sortby = class _Sortby extends BaseFunction {
|
|
|
13721
14252
|
};
|
|
13722
14253
|
__name(_Sortby, "Sortby");
|
|
13723
14254
|
let Sortby = _Sortby;
|
|
14255
|
+
const _Take = class _Take extends BaseFunction {
|
|
14256
|
+
constructor() {
|
|
14257
|
+
super(...arguments);
|
|
14258
|
+
__publicField(this, "minParams", 2);
|
|
14259
|
+
__publicField(this, "maxParams", 3);
|
|
14260
|
+
}
|
|
14261
|
+
calculate(array, rows, columns) {
|
|
14262
|
+
const arrayRowCount = array.isArray() ? array.getRowCount() : 1, arrayColumnCount = array.isArray() ? array.getColumnCount() : 1;
|
|
14263
|
+
let _rows = rows, _columns = columns != null ? columns : NumberValueObject.create(arrayColumnCount);
|
|
14264
|
+
rows.isNull() && (_rows = NumberValueObject.create(arrayRowCount)), _columns.isNull() && (_columns = NumberValueObject.create(arrayColumnCount));
|
|
14265
|
+
const maxRowLength = Math.max(
|
|
14266
|
+
_rows.isArray() ? _rows.getRowCount() : 1,
|
|
14267
|
+
_columns.isArray() ? _columns.getRowCount() : 1
|
|
14268
|
+
), maxColumnLength = Math.max(
|
|
14269
|
+
_rows.isArray() ? _rows.getColumnCount() : 1,
|
|
14270
|
+
_columns.isArray() ? _columns.getColumnCount() : 1
|
|
14271
|
+
), rowsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _rows, ErrorValueObject.create(ErrorType$1.NA)), columnsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _columns, ErrorValueObject.create(ErrorType$1.NA));
|
|
14272
|
+
if (maxRowLength > 1 || maxColumnLength > 1)
|
|
14273
|
+
return rowsArray.mapValue((rowsObject2, rowIndex, columnIndex) => {
|
|
14274
|
+
const columnsObject2 = columnsArray.get(rowIndex, columnIndex);
|
|
14275
|
+
if (array.isError())
|
|
14276
|
+
return array;
|
|
14277
|
+
if (array.isNull())
|
|
14278
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14279
|
+
const { isError: isError2, errorObject: errorObject2 } = this._checkRowsColumns(rowsObject2, columnsObject2, arrayRowCount, arrayColumnCount);
|
|
14280
|
+
return isError2 ? errorObject2 : array.isArray() ? ErrorValueObject.create(ErrorType$1.VALUE) : array;
|
|
14281
|
+
});
|
|
14282
|
+
if (array.isError())
|
|
14283
|
+
return array;
|
|
14284
|
+
if (array.isNull())
|
|
14285
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14286
|
+
const rowsObject = _rows.isArray() ? _rows.get(0, 0) : _rows, columnsObject = _columns.isArray() ? _columns.get(0, 0) : _columns, { isError, errorObject, rowsValue, columnsValue } = this._checkRowsColumns(rowsObject, columnsObject, arrayRowCount, arrayColumnCount);
|
|
14287
|
+
return isError ? errorObject : this._getResultArray(array, rowsValue, columnsValue, arrayRowCount, arrayColumnCount);
|
|
14288
|
+
}
|
|
14289
|
+
_checkRowsColumns(rowsObject, columnsObject, arrayRowCount, arrayColumnCount) {
|
|
14290
|
+
if (rowsObject.isError())
|
|
14291
|
+
return {
|
|
14292
|
+
isError: !0,
|
|
14293
|
+
errorObject: rowsObject
|
|
14294
|
+
};
|
|
14295
|
+
if (columnsObject.isError())
|
|
14296
|
+
return {
|
|
14297
|
+
isError: !0,
|
|
14298
|
+
errorObject: columnsObject
|
|
14299
|
+
};
|
|
14300
|
+
let rowsValue = Math.trunc(+rowsObject.getValue()), columnsValue = Math.trunc(+columnsObject.getValue());
|
|
14301
|
+
return Number.isNaN(rowsValue) || Number.isNaN(columnsValue) ? {
|
|
14302
|
+
isError: !0,
|
|
14303
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
|
|
14304
|
+
} : Math.abs(rowsValue) === 0 || Math.abs(columnsValue) === 0 ? {
|
|
14305
|
+
isError: !0,
|
|
14306
|
+
errorObject: ErrorValueObject.create(ErrorType$1.CALC)
|
|
14307
|
+
} : (rowsValue > arrayRowCount && (rowsValue = arrayRowCount), columnsValue > arrayColumnCount && (columnsValue = arrayColumnCount), {
|
|
14308
|
+
isError: !1,
|
|
14309
|
+
rowsValue,
|
|
14310
|
+
columnsValue
|
|
14311
|
+
});
|
|
14312
|
+
}
|
|
14313
|
+
_getResultArray(array, rows, columns, arrayRowCount, arrayColumnCount) {
|
|
14314
|
+
if (!array.isArray())
|
|
14315
|
+
return array;
|
|
14316
|
+
const rowParam = rows >= 0 ? [0, rows] : [arrayRowCount + rows, arrayRowCount], columnParam = columns >= 0 ? [0, columns] : [arrayColumnCount + columns, arrayColumnCount];
|
|
14317
|
+
let resultArray;
|
|
14318
|
+
return rows === arrayRowCount && columns === arrayColumnCount ? resultArray = array : rows === arrayRowCount ? resultArray = array.slice(void 0, columnParam) : columns === arrayColumnCount ? resultArray = array.slice(rowParam, void 0) : resultArray = array.slice(rowParam, columnParam), resultArray = resultArray.map((valueObject) => valueObject.isNull() ? NumberValueObject.create(0) : valueObject), rows === 1 && columns === 1 ? resultArray.get(0, 0) : resultArray;
|
|
14319
|
+
}
|
|
14320
|
+
};
|
|
14321
|
+
__name(_Take, "Take");
|
|
14322
|
+
let Take = _Take;
|
|
14323
|
+
const _Tocol = class _Tocol extends BaseFunction {
|
|
14324
|
+
constructor() {
|
|
14325
|
+
super(...arguments);
|
|
14326
|
+
__publicField(this, "minParams", 1);
|
|
14327
|
+
__publicField(this, "maxParams", 3);
|
|
14328
|
+
}
|
|
14329
|
+
calculate(array, ignore, scanByColumn) {
|
|
14330
|
+
const _ignore = ignore != null ? ignore : NumberValueObject.create(0), _scanByColumn = scanByColumn != null ? scanByColumn : BooleanValueObject.create(!1), maxRowLength = Math.max(
|
|
14331
|
+
_ignore.isArray() ? _ignore.getRowCount() : 1,
|
|
14332
|
+
_scanByColumn.isArray() ? _scanByColumn.getRowCount() : 1
|
|
14333
|
+
), maxColumnLength = Math.max(
|
|
14334
|
+
_ignore.isArray() ? _ignore.getColumnCount() : 1,
|
|
14335
|
+
_scanByColumn.isArray() ? _scanByColumn.getColumnCount() : 1
|
|
14336
|
+
), ignoreArray = expandArrayValueObject(maxRowLength, maxColumnLength, _ignore, ErrorValueObject.create(ErrorType$1.NA)), scanByColumnArray = expandArrayValueObject(maxRowLength, maxColumnLength, _scanByColumn, ErrorValueObject.create(ErrorType$1.NA)), resultArray = ignoreArray.mapValue((ignoreObject, rowIndex, columnIndex) => {
|
|
14337
|
+
const scanByColumnObject = scanByColumnArray.get(rowIndex, columnIndex);
|
|
14338
|
+
if (array.isError())
|
|
14339
|
+
return array;
|
|
14340
|
+
if (array.isNull())
|
|
14341
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14342
|
+
if (ignoreObject.isError())
|
|
14343
|
+
return ignoreObject;
|
|
14344
|
+
if (scanByColumnObject.isError())
|
|
14345
|
+
return scanByColumnObject;
|
|
14346
|
+
const ignoreValue = Math.trunc(+ignoreObject.getValue()), scanByColumnValue = +scanByColumnObject.getValue();
|
|
14347
|
+
if (Number.isNaN(ignoreValue) || ignoreValue < 0 || ignoreValue > 3 || Number.isNaN(scanByColumnValue))
|
|
14348
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14349
|
+
if (!array.isArray())
|
|
14350
|
+
return array;
|
|
14351
|
+
let result = [];
|
|
14352
|
+
return scanByColumnValue ? result = this._getArrayValueByColumn(array, ignoreValue) : result = this._getArrayValueByRow(array, ignoreValue), result.length === 0 ? ErrorValueObject.create(ErrorType$1.CALC) : maxRowLength > 1 || maxColumnLength > 1 || result.length === 1 ? result[0] : ArrayValueObject.create({
|
|
14353
|
+
calculateValueList: result.map((valueObject) => [valueObject]),
|
|
14354
|
+
rowCount: result.length,
|
|
14355
|
+
columnCount: 1,
|
|
14356
|
+
unitId: this.unitId,
|
|
14357
|
+
sheetId: this.subUnitId,
|
|
14358
|
+
row: this.row,
|
|
14359
|
+
column: this.column
|
|
14360
|
+
});
|
|
14361
|
+
});
|
|
14362
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
14363
|
+
}
|
|
14364
|
+
_getArrayValueByColumn(array, ignore) {
|
|
14365
|
+
const _array = array, arrayRowCount = _array.getRowCount(), arrayColumnCount = _array.getColumnCount(), result = [];
|
|
14366
|
+
for (let c = 0; c < arrayColumnCount; c++)
|
|
14367
|
+
for (let r = 0; r < arrayRowCount; r++) {
|
|
14368
|
+
const valueObject = _array.get(r, c);
|
|
14369
|
+
this._isIgnore(valueObject, ignore) || result.push(valueObject.isNull() ? NumberValueObject.create(0) : valueObject);
|
|
14370
|
+
}
|
|
14371
|
+
return result;
|
|
14372
|
+
}
|
|
14373
|
+
_getArrayValueByRow(array, ignore) {
|
|
14374
|
+
const _array = array, arrayRowCount = _array.getRowCount(), arrayColumnCount = _array.getColumnCount(), result = [];
|
|
14375
|
+
for (let r = 0; r < arrayRowCount; r++)
|
|
14376
|
+
for (let c = 0; c < arrayColumnCount; c++) {
|
|
14377
|
+
const valueObject = _array.get(r, c);
|
|
14378
|
+
this._isIgnore(valueObject, ignore) || result.push(valueObject.isNull() ? NumberValueObject.create(0) : valueObject);
|
|
14379
|
+
}
|
|
14380
|
+
return result;
|
|
14381
|
+
}
|
|
14382
|
+
_isIgnore(valueObject, ignore) {
|
|
14383
|
+
switch (ignore) {
|
|
14384
|
+
case 0:
|
|
14385
|
+
return !1;
|
|
14386
|
+
case 1:
|
|
14387
|
+
return valueObject.isNull();
|
|
14388
|
+
case 2:
|
|
14389
|
+
return valueObject.isError();
|
|
14390
|
+
case 3:
|
|
14391
|
+
return valueObject.isNull() || valueObject.isError();
|
|
14392
|
+
default:
|
|
14393
|
+
return !1;
|
|
14394
|
+
}
|
|
14395
|
+
}
|
|
14396
|
+
};
|
|
14397
|
+
__name(_Tocol, "Tocol");
|
|
14398
|
+
let Tocol = _Tocol;
|
|
14399
|
+
const _Torow = class _Torow extends BaseFunction {
|
|
14400
|
+
constructor() {
|
|
14401
|
+
super(...arguments);
|
|
14402
|
+
__publicField(this, "minParams", 1);
|
|
14403
|
+
__publicField(this, "maxParams", 3);
|
|
14404
|
+
}
|
|
14405
|
+
calculate(array, ignore, scanByColumn) {
|
|
14406
|
+
const _ignore = ignore != null ? ignore : NumberValueObject.create(0), _scanByColumn = scanByColumn != null ? scanByColumn : BooleanValueObject.create(!1), maxRowLength = Math.max(
|
|
14407
|
+
_ignore.isArray() ? _ignore.getRowCount() : 1,
|
|
14408
|
+
_scanByColumn.isArray() ? _scanByColumn.getRowCount() : 1
|
|
14409
|
+
), maxColumnLength = Math.max(
|
|
14410
|
+
_ignore.isArray() ? _ignore.getColumnCount() : 1,
|
|
14411
|
+
_scanByColumn.isArray() ? _scanByColumn.getColumnCount() : 1
|
|
14412
|
+
), ignoreArray = expandArrayValueObject(maxRowLength, maxColumnLength, _ignore, ErrorValueObject.create(ErrorType$1.NA)), scanByColumnArray = expandArrayValueObject(maxRowLength, maxColumnLength, _scanByColumn, ErrorValueObject.create(ErrorType$1.NA)), resultArray = ignoreArray.mapValue((ignoreObject, rowIndex, columnIndex) => {
|
|
14413
|
+
const scanByColumnObject = scanByColumnArray.get(rowIndex, columnIndex);
|
|
14414
|
+
if (array.isError())
|
|
14415
|
+
return array;
|
|
14416
|
+
if (ignoreObject.isError())
|
|
14417
|
+
return ignoreObject;
|
|
14418
|
+
if (scanByColumnObject.isError())
|
|
14419
|
+
return scanByColumnObject;
|
|
14420
|
+
const ignoreValue = Math.trunc(+ignoreObject.getValue()), scanByColumnValue = +scanByColumnObject.getValue();
|
|
14421
|
+
if (Number.isNaN(ignoreValue) || ignoreValue < 0 || ignoreValue > 3 || Number.isNaN(scanByColumnValue) || array.isNull())
|
|
14422
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14423
|
+
if (!array.isArray())
|
|
14424
|
+
return array;
|
|
14425
|
+
let result = [];
|
|
14426
|
+
return scanByColumnValue ? result = this._getArrayValueByColumn(array, ignoreValue) : result = this._getArrayValueByRow(array, ignoreValue), result.length === 0 ? ErrorValueObject.create(ErrorType$1.CALC) : maxRowLength > 1 || maxColumnLength > 1 || result.length === 1 ? result[0] : ArrayValueObject.create({
|
|
14427
|
+
calculateValueList: [result],
|
|
14428
|
+
rowCount: 1,
|
|
14429
|
+
columnCount: result.length,
|
|
14430
|
+
unitId: this.unitId,
|
|
14431
|
+
sheetId: this.subUnitId,
|
|
14432
|
+
row: this.row,
|
|
14433
|
+
column: this.column
|
|
14434
|
+
});
|
|
14435
|
+
});
|
|
14436
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
14437
|
+
}
|
|
14438
|
+
_getArrayValueByColumn(array, ignore) {
|
|
14439
|
+
const _array = array, arrayRowCount = _array.getRowCount(), arrayColumnCount = _array.getColumnCount(), result = [];
|
|
14440
|
+
for (let c = 0; c < arrayColumnCount; c++)
|
|
14441
|
+
for (let r = 0; r < arrayRowCount; r++) {
|
|
14442
|
+
const valueObject = _array.get(r, c);
|
|
14443
|
+
this._isIgnore(valueObject, ignore) || result.push(valueObject.isNull() ? NumberValueObject.create(0) : valueObject);
|
|
14444
|
+
}
|
|
14445
|
+
return result;
|
|
14446
|
+
}
|
|
14447
|
+
_getArrayValueByRow(array, ignore) {
|
|
14448
|
+
const _array = array, arrayRowCount = _array.getRowCount(), arrayColumnCount = _array.getColumnCount(), result = [];
|
|
14449
|
+
for (let r = 0; r < arrayRowCount; r++)
|
|
14450
|
+
for (let c = 0; c < arrayColumnCount; c++) {
|
|
14451
|
+
const valueObject = _array.get(r, c);
|
|
14452
|
+
this._isIgnore(valueObject, ignore) || result.push(valueObject.isNull() ? NumberValueObject.create(0) : valueObject);
|
|
14453
|
+
}
|
|
14454
|
+
return result;
|
|
14455
|
+
}
|
|
14456
|
+
_isIgnore(valueObject, ignore) {
|
|
14457
|
+
switch (ignore) {
|
|
14458
|
+
case 0:
|
|
14459
|
+
return !1;
|
|
14460
|
+
case 1:
|
|
14461
|
+
return valueObject.isNull();
|
|
14462
|
+
case 2:
|
|
14463
|
+
return valueObject.isError();
|
|
14464
|
+
case 3:
|
|
14465
|
+
return valueObject.isNull() || valueObject.isError();
|
|
14466
|
+
default:
|
|
14467
|
+
return !1;
|
|
14468
|
+
}
|
|
14469
|
+
}
|
|
14470
|
+
};
|
|
14471
|
+
__name(_Torow, "Torow");
|
|
14472
|
+
let Torow = _Torow;
|
|
13724
14473
|
const _Transpose = class _Transpose extends BaseFunction {
|
|
13725
14474
|
constructor() {
|
|
13726
14475
|
super(...arguments);
|
|
@@ -13943,8 +14692,118 @@ const _Vstack = class _Vstack extends BaseFunction {
|
|
|
13943
14692
|
});
|
|
13944
14693
|
}
|
|
13945
14694
|
};
|
|
13946
|
-
__name(_Vstack, "Vstack");
|
|
13947
|
-
let Vstack = _Vstack;
|
|
14695
|
+
__name(_Vstack, "Vstack");
|
|
14696
|
+
let Vstack = _Vstack;
|
|
14697
|
+
const _Wrapcols = class _Wrapcols extends BaseFunction {
|
|
14698
|
+
constructor() {
|
|
14699
|
+
super(...arguments);
|
|
14700
|
+
__publicField(this, "minParams", 2);
|
|
14701
|
+
__publicField(this, "maxParams", 3);
|
|
14702
|
+
}
|
|
14703
|
+
calculate(vector, wrapCount, padWith) {
|
|
14704
|
+
let _padWith = padWith != null ? padWith : ErrorValueObject.create(ErrorType$1.NA);
|
|
14705
|
+
_padWith.isNull() && (_padWith = ErrorValueObject.create(ErrorType$1.NA));
|
|
14706
|
+
const vectorRowCount = vector.isArray() ? vector.getRowCount() : 1, vectorColumnCount = vector.isArray() ? vector.getColumnCount() : 1, maxRowLength = Math.max(
|
|
14707
|
+
wrapCount.isArray() ? wrapCount.getRowCount() : 1,
|
|
14708
|
+
_padWith.isArray() ? _padWith.getRowCount() : 1
|
|
14709
|
+
), maxColumnLength = Math.max(
|
|
14710
|
+
wrapCount.isArray() ? wrapCount.getColumnCount() : 1,
|
|
14711
|
+
_padWith.isArray() ? _padWith.getColumnCount() : 1
|
|
14712
|
+
), wrapCountArray = expandArrayValueObject(maxRowLength, maxColumnLength, wrapCount, ErrorValueObject.create(ErrorType$1.NA)), padWithArray = expandArrayValueObject(maxRowLength, maxColumnLength, _padWith, ErrorValueObject.create(ErrorType$1.NA)), resultArray = wrapCountArray.mapValue((wrapCountObject, rowIndex, columnIndex) => {
|
|
14713
|
+
const padWithObject = padWithArray.get(rowIndex, columnIndex);
|
|
14714
|
+
if (vector.isError())
|
|
14715
|
+
return vector;
|
|
14716
|
+
if (vector.isNull())
|
|
14717
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14718
|
+
if (wrapCountObject.isError())
|
|
14719
|
+
return wrapCountObject;
|
|
14720
|
+
const wrapCountValue = Math.trunc(+wrapCountObject.getValue());
|
|
14721
|
+
if (vectorRowCount > 1 && vectorColumnCount > 1 || Number.isNaN(wrapCountValue))
|
|
14722
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14723
|
+
if (wrapCountValue < 1)
|
|
14724
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
14725
|
+
const vectorArray = vector.isArray() ? vector.getArrayValue().flat() : [vector], result = this._getWrapArray(vectorArray, wrapCountValue, padWithObject);
|
|
14726
|
+
return maxRowLength > 1 || maxColumnLength > 1 || result.length === 1 && result[0].length === 1 ? result[0][0] : ArrayValueObject.create({
|
|
14727
|
+
calculateValueList: result,
|
|
14728
|
+
rowCount: result.length,
|
|
14729
|
+
columnCount: result[0].length,
|
|
14730
|
+
unitId: this.unitId,
|
|
14731
|
+
sheetId: this.subUnitId,
|
|
14732
|
+
row: this.row,
|
|
14733
|
+
column: this.column
|
|
14734
|
+
});
|
|
14735
|
+
});
|
|
14736
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
14737
|
+
}
|
|
14738
|
+
_getWrapArray(vectorArray, wrapCount, padWith) {
|
|
14739
|
+
const columns = Math.ceil(vectorArray.length / wrapCount), _wrapCount = columns > 1 ? wrapCount : vectorArray.length, result = [];
|
|
14740
|
+
for (let c = 0; c < columns; c++)
|
|
14741
|
+
for (let r = 0; r < _wrapCount; r++) {
|
|
14742
|
+
result[r] || (result[r] = []);
|
|
14743
|
+
const index = c * _wrapCount + r;
|
|
14744
|
+
index < vectorArray.length ? result[r].push(vectorArray[index].isNull() ? NumberValueObject.create(0) : vectorArray[index]) : result[r].push(padWith);
|
|
14745
|
+
}
|
|
14746
|
+
return result;
|
|
14747
|
+
}
|
|
14748
|
+
};
|
|
14749
|
+
__name(_Wrapcols, "Wrapcols");
|
|
14750
|
+
let Wrapcols = _Wrapcols;
|
|
14751
|
+
const _Wraprows = class _Wraprows extends BaseFunction {
|
|
14752
|
+
constructor() {
|
|
14753
|
+
super(...arguments);
|
|
14754
|
+
__publicField(this, "minParams", 2);
|
|
14755
|
+
__publicField(this, "maxParams", 3);
|
|
14756
|
+
}
|
|
14757
|
+
calculate(vector, wrapCount, padWith) {
|
|
14758
|
+
let _padWith = padWith != null ? padWith : ErrorValueObject.create(ErrorType$1.NA);
|
|
14759
|
+
_padWith.isNull() && (_padWith = ErrorValueObject.create(ErrorType$1.NA));
|
|
14760
|
+
const vectorRowCount = vector.isArray() ? vector.getRowCount() : 1, vectorColumnCount = vector.isArray() ? vector.getColumnCount() : 1, maxRowLength = Math.max(
|
|
14761
|
+
wrapCount.isArray() ? wrapCount.getRowCount() : 1,
|
|
14762
|
+
_padWith.isArray() ? _padWith.getRowCount() : 1
|
|
14763
|
+
), maxColumnLength = Math.max(
|
|
14764
|
+
wrapCount.isArray() ? wrapCount.getColumnCount() : 1,
|
|
14765
|
+
_padWith.isArray() ? _padWith.getColumnCount() : 1
|
|
14766
|
+
), wrapCountArray = expandArrayValueObject(maxRowLength, maxColumnLength, wrapCount, ErrorValueObject.create(ErrorType$1.NA)), padWithArray = expandArrayValueObject(maxRowLength, maxColumnLength, _padWith, ErrorValueObject.create(ErrorType$1.NA)), resultArray = wrapCountArray.mapValue((wrapCountObject, rowIndex, columnIndex) => {
|
|
14767
|
+
const padWithObject = padWithArray.get(rowIndex, columnIndex);
|
|
14768
|
+
if (vector.isError())
|
|
14769
|
+
return vector;
|
|
14770
|
+
if (vector.isNull())
|
|
14771
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14772
|
+
if (wrapCountObject.isError())
|
|
14773
|
+
return wrapCountObject;
|
|
14774
|
+
const wrapCountValue = Math.trunc(+wrapCountObject.getValue());
|
|
14775
|
+
if (vectorRowCount > 1 && vectorColumnCount > 1 || Number.isNaN(wrapCountValue))
|
|
14776
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14777
|
+
if (wrapCountValue < 1)
|
|
14778
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
14779
|
+
const vectorArray = vector.isArray() ? vector.getArrayValue().flat() : [vector], result = this._getWrapArray(vectorArray, wrapCountValue, padWithObject);
|
|
14780
|
+
return maxRowLength > 1 || maxColumnLength > 1 || result.length === 1 && result[0].length === 1 ? result[0][0] : ArrayValueObject.create({
|
|
14781
|
+
calculateValueList: result,
|
|
14782
|
+
rowCount: result.length,
|
|
14783
|
+
columnCount: result[0].length,
|
|
14784
|
+
unitId: this.unitId,
|
|
14785
|
+
sheetId: this.subUnitId,
|
|
14786
|
+
row: this.row,
|
|
14787
|
+
column: this.column
|
|
14788
|
+
});
|
|
14789
|
+
});
|
|
14790
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
14791
|
+
}
|
|
14792
|
+
_getWrapArray(vectorArray, wrapCount, padWith) {
|
|
14793
|
+
const rows = Math.ceil(vectorArray.length / wrapCount), _wrapCount = rows > 1 ? wrapCount : vectorArray.length, result = [];
|
|
14794
|
+
for (let r = 0; r < rows; r++) {
|
|
14795
|
+
const row = [];
|
|
14796
|
+
for (let c = 0; c < _wrapCount; c++) {
|
|
14797
|
+
const index = r * _wrapCount + c;
|
|
14798
|
+
index < vectorArray.length ? row.push(vectorArray[index].isNull() ? NumberValueObject.create(0) : vectorArray[index]) : row.push(padWith);
|
|
14799
|
+
}
|
|
14800
|
+
result.push(row);
|
|
14801
|
+
}
|
|
14802
|
+
return result;
|
|
14803
|
+
}
|
|
14804
|
+
};
|
|
14805
|
+
__name(_Wraprows, "Wraprows");
|
|
14806
|
+
let Wraprows = _Wraprows;
|
|
13948
14807
|
const _Xlookup = class _Xlookup extends BaseFunction {
|
|
13949
14808
|
constructor() {
|
|
13950
14809
|
super(...arguments);
|
|
@@ -14095,112 +14954,6 @@ const _Xmatch = class _Xmatch extends BaseFunction {
|
|
|
14095
14954
|
};
|
|
14096
14955
|
__name(_Xmatch, "Xmatch");
|
|
14097
14956
|
let Xmatch = _Xmatch;
|
|
14098
|
-
const _Index = class _Index extends BaseFunction {
|
|
14099
|
-
constructor() {
|
|
14100
|
-
super(...arguments);
|
|
14101
|
-
__publicField(this, "minParams", 1);
|
|
14102
|
-
__publicField(this, "maxParams", 4);
|
|
14103
|
-
__publicField(this, "needsReferenceObject", !0);
|
|
14104
|
-
}
|
|
14105
|
-
// eslint-disable-next-line max-lines-per-function, complexity
|
|
14106
|
-
calculate(reference, rowNum, columnNum, areaNum) {
|
|
14107
|
-
if (reference.isError())
|
|
14108
|
-
return reference;
|
|
14109
|
-
if (rowNum != null && rowNum.isError())
|
|
14110
|
-
return rowNum;
|
|
14111
|
-
if (columnNum != null && columnNum.isError())
|
|
14112
|
-
return columnNum;
|
|
14113
|
-
if (areaNum != null && areaNum.isError())
|
|
14114
|
-
return areaNum;
|
|
14115
|
-
let referenceRowCount = 0, referenceColumnCount = 0;
|
|
14116
|
-
if (reference.isValueObject())
|
|
14117
|
-
referenceRowCount = 1, referenceColumnCount = 1;
|
|
14118
|
-
else if (reference.isReferenceObject()) {
|
|
14119
|
-
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
14120
|
-
referenceRowCount = endRow - startRow + 1, referenceColumnCount = endColumn - startColumn + 1;
|
|
14121
|
-
} else
|
|
14122
|
-
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14123
|
-
let _rowNum, _columnNum;
|
|
14124
|
-
referenceRowCount === 1 && referenceColumnCount > 1 && columnNum == null ? (_columnNum = rowNum != null ? rowNum : NumberValueObject.create(0), _rowNum = NumberValueObject.create(0)) : (_rowNum = rowNum != null ? rowNum : NumberValueObject.create(0), _columnNum = columnNum != null ? columnNum : NumberValueObject.create(0));
|
|
14125
|
-
let _areaNum = areaNum != null ? areaNum : NumberValueObject.create(1);
|
|
14126
|
-
_rowNum.isReferenceObject() && (_rowNum = _rowNum.toArrayValueObject()), _columnNum.isReferenceObject() && (_columnNum = _columnNum.toArrayValueObject()), _areaNum.isReferenceObject() && (_areaNum = _areaNum.toArrayValueObject());
|
|
14127
|
-
const maxRowLength = Math.max(
|
|
14128
|
-
_rowNum.isArray() ? _rowNum.getRowCount() : 1,
|
|
14129
|
-
_columnNum.isArray() ? _columnNum.getRowCount() : 1,
|
|
14130
|
-
_areaNum.isArray() ? _areaNum.getRowCount() : 1
|
|
14131
|
-
), maxColumnLength = Math.max(
|
|
14132
|
-
_rowNum.isArray() ? _rowNum.getColumnCount() : 1,
|
|
14133
|
-
_columnNum.isArray() ? _columnNum.getColumnCount() : 1,
|
|
14134
|
-
_areaNum.isArray() ? _areaNum.getColumnCount() : 1
|
|
14135
|
-
);
|
|
14136
|
-
if (_rowNum = _rowNum, _columnNum = _columnNum, _areaNum = _areaNum, maxRowLength === 1 && maxColumnLength === 1)
|
|
14137
|
-
return this._calculateSingleCell(reference, _rowNum, _columnNum, _areaNum);
|
|
14138
|
-
{
|
|
14139
|
-
const rowNumArray = expandArrayValueObject(maxRowLength, maxColumnLength, _rowNum, ErrorValueObject.create(ErrorType$1.NA)), columnNumArray = expandArrayValueObject(maxRowLength, maxColumnLength, _columnNum, ErrorValueObject.create(ErrorType$1.NA)), areaNumArray = expandArrayValueObject(maxRowLength, maxColumnLength, _areaNum, ErrorValueObject.create(ErrorType$1.NA));
|
|
14140
|
-
return rowNumArray.map((rowNumValue, rowIndex, columnIndex) => {
|
|
14141
|
-
const columnNumValue = columnNumArray.get(rowIndex, columnIndex) || NullValueObject.create(), areaNumValue = areaNumArray.get(rowIndex, columnIndex) || NullValueObject.create(), result = this._calculateSingleCell(reference, rowNumValue, columnNumValue, areaNumValue);
|
|
14142
|
-
return result.isReferenceObject() ? result.toArrayValueObject().getFirstCell() : result;
|
|
14143
|
-
});
|
|
14144
|
-
}
|
|
14145
|
-
}
|
|
14146
|
-
_calculateSingleCell(reference, rowNum, columnNum, areaNum) {
|
|
14147
|
-
if (rowNum.isError())
|
|
14148
|
-
return rowNum;
|
|
14149
|
-
const rowNumberValue = this._getNumberValue(rowNum);
|
|
14150
|
-
if (rowNumberValue === void 0 || rowNumberValue < 0)
|
|
14151
|
-
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14152
|
-
if (columnNum.isError())
|
|
14153
|
-
return columnNum;
|
|
14154
|
-
const columnNumberValue = this._getNumberValue(columnNum);
|
|
14155
|
-
if (columnNumberValue === void 0 || columnNumberValue < 0)
|
|
14156
|
-
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
14157
|
-
if (areaNum.isError())
|
|
14158
|
-
return areaNum;
|
|
14159
|
-
const areaNumberValue = this._getAreaNumberValue(areaNum);
|
|
14160
|
-
return areaNumberValue === void 0 || areaNumberValue < 1 ? ErrorValueObject.create(ErrorType$1.VALUE) : reference.isReferenceObject() ? this._getReferenceObject(reference, rowNumberValue, columnNumberValue, areaNumberValue) : reference.isValueObject() && rowNumberValue === 1 && columnNumberValue === 1 ? reference : ErrorValueObject.create(ErrorType$1.REF);
|
|
14161
|
-
}
|
|
14162
|
-
_getNumberValue(numberValueObject) {
|
|
14163
|
-
if (numberValueObject == null)
|
|
14164
|
-
return 0;
|
|
14165
|
-
let logicValue = 0;
|
|
14166
|
-
if (numberValueObject.isBoolean())
|
|
14167
|
-
numberValueObject.getValue() === !0 && (logicValue = 1);
|
|
14168
|
-
else {
|
|
14169
|
-
if (numberValueObject.isString())
|
|
14170
|
-
return;
|
|
14171
|
-
numberValueObject.isNumber() ? logicValue = Math.floor(numberValueObject.getValue()) : numberValueObject.isNull() && (logicValue = 0);
|
|
14172
|
-
}
|
|
14173
|
-
return logicValue;
|
|
14174
|
-
}
|
|
14175
|
-
_getAreaNumberValue(numberValueObject) {
|
|
14176
|
-
if (numberValueObject == null)
|
|
14177
|
-
return 1;
|
|
14178
|
-
let logicValue = 0;
|
|
14179
|
-
if (numberValueObject.isBoolean())
|
|
14180
|
-
numberValueObject.getValue() === !0 && (logicValue = 1);
|
|
14181
|
-
else {
|
|
14182
|
-
if (numberValueObject.isString())
|
|
14183
|
-
return;
|
|
14184
|
-
numberValueObject.isNumber() ? logicValue = Math.floor(numberValueObject.getValue()) : numberValueObject.isNull() && (logicValue = 0);
|
|
14185
|
-
}
|
|
14186
|
-
return logicValue;
|
|
14187
|
-
}
|
|
14188
|
-
_getReferenceObject(reference, rowNumberValue, columnNumberValue, areaNumberValue) {
|
|
14189
|
-
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
14190
|
-
let referenceStartRow = 0, referenceEndRow = 0, referenceStartColumn = 0, referenceEndColumn = 0;
|
|
14191
|
-
if (rowNumberValue === 0 ? (referenceStartRow = startRow, referenceEndRow = endRow) : referenceStartRow = referenceEndRow = startRow + rowNumberValue - 1, columnNumberValue === 0 ? (referenceStartColumn = startColumn, referenceEndColumn = endColumn) : referenceStartColumn = referenceEndColumn = startColumn + columnNumberValue - 1, referenceStartRow > endRow || referenceStartColumn > endColumn)
|
|
14192
|
-
return ErrorValueObject.create(ErrorType$1.REF);
|
|
14193
|
-
const range = {
|
|
14194
|
-
startRow: referenceStartRow,
|
|
14195
|
-
startColumn: referenceStartColumn,
|
|
14196
|
-
endRow: referenceEndRow,
|
|
14197
|
-
endColumn: referenceEndColumn
|
|
14198
|
-
};
|
|
14199
|
-
return this.createReferenceObject(reference, range);
|
|
14200
|
-
}
|
|
14201
|
-
};
|
|
14202
|
-
__name(_Index, "Index");
|
|
14203
|
-
let Index = _Index;
|
|
14204
14957
|
const functionLookup = [
|
|
14205
14958
|
[Address, FUNCTION_NAMES_LOOKUP.ADDRESS],
|
|
14206
14959
|
[Areas, FUNCTION_NAMES_LOOKUP.AREAS],
|
|
@@ -14209,6 +14962,8 @@ const functionLookup = [
|
|
|
14209
14962
|
[Chooserows, FUNCTION_NAMES_LOOKUP.CHOOSEROWS],
|
|
14210
14963
|
[Column, FUNCTION_NAMES_LOOKUP.COLUMN],
|
|
14211
14964
|
[Columns, FUNCTION_NAMES_LOOKUP.COLUMNS],
|
|
14965
|
+
[Drop, FUNCTION_NAMES_LOOKUP.DROP],
|
|
14966
|
+
[Expand, FUNCTION_NAMES_LOOKUP.EXPAND],
|
|
14212
14967
|
[Filter, FUNCTION_NAMES_LOOKUP.FILTER],
|
|
14213
14968
|
[Hlookup, FUNCTION_NAMES_LOOKUP.HLOOKUP],
|
|
14214
14969
|
[Hstack, FUNCTION_NAMES_LOOKUP.HSTACK],
|
|
@@ -14221,10 +14976,15 @@ const functionLookup = [
|
|
|
14221
14976
|
[Rows, FUNCTION_NAMES_LOOKUP.ROWS],
|
|
14222
14977
|
[Sort, FUNCTION_NAMES_LOOKUP.SORT],
|
|
14223
14978
|
[Sortby, FUNCTION_NAMES_LOOKUP.SORTBY],
|
|
14979
|
+
[Take, FUNCTION_NAMES_LOOKUP.TAKE],
|
|
14980
|
+
[Tocol, FUNCTION_NAMES_LOOKUP.TOCOL],
|
|
14981
|
+
[Torow, FUNCTION_NAMES_LOOKUP.TOROW],
|
|
14224
14982
|
[Transpose, FUNCTION_NAMES_LOOKUP.TRANSPOSE],
|
|
14225
14983
|
[Unique, FUNCTION_NAMES_LOOKUP.UNIQUE],
|
|
14226
14984
|
[Vlookup, FUNCTION_NAMES_LOOKUP.VLOOKUP],
|
|
14227
14985
|
[Vstack, FUNCTION_NAMES_LOOKUP.VSTACK],
|
|
14986
|
+
[Wrapcols, FUNCTION_NAMES_LOOKUP.WRAPCOLS],
|
|
14987
|
+
[Wraprows, FUNCTION_NAMES_LOOKUP.WRAPROWS],
|
|
14228
14988
|
[Xlookup, FUNCTION_NAMES_LOOKUP.XLOOKUP],
|
|
14229
14989
|
[Xmatch, FUNCTION_NAMES_LOOKUP.XMATCH]
|
|
14230
14990
|
];
|
|
@@ -14538,6 +15298,129 @@ const _CeilingPrecise = class _CeilingPrecise extends BaseFunction {
|
|
|
14538
15298
|
};
|
|
14539
15299
|
__name(_CeilingPrecise, "CeilingPrecise");
|
|
14540
15300
|
let CeilingPrecise = _CeilingPrecise;
|
|
15301
|
+
function calculateFactorial(n, step = 1) {
|
|
15302
|
+
let _n = Math.floor(n);
|
|
15303
|
+
if (n < 0)
|
|
15304
|
+
return Number.NaN;
|
|
15305
|
+
let result = 1;
|
|
15306
|
+
for (; _n > 1 && Number.isFinite(result); )
|
|
15307
|
+
result *= _n, _n -= step;
|
|
15308
|
+
return result;
|
|
15309
|
+
}
|
|
15310
|
+
__name(calculateFactorial, "calculateFactorial");
|
|
15311
|
+
function calculateCombin(n, k) {
|
|
15312
|
+
const t = Math.min(n - k, k);
|
|
15313
|
+
let result = 1;
|
|
15314
|
+
for (let i = 1; i <= t && Number.isFinite(result); i++)
|
|
15315
|
+
result *= n - i + 1, result /= i;
|
|
15316
|
+
return result;
|
|
15317
|
+
}
|
|
15318
|
+
__name(calculateCombin, "calculateCombin");
|
|
15319
|
+
function calculateGcd(a, b) {
|
|
15320
|
+
let _a26 = Math.floor(a), _b = Math.floor(b);
|
|
15321
|
+
for (; _b !== 0; ) {
|
|
15322
|
+
const t = _b;
|
|
15323
|
+
_b = _a26 % _b, _a26 = t;
|
|
15324
|
+
}
|
|
15325
|
+
return _a26;
|
|
15326
|
+
}
|
|
15327
|
+
__name(calculateGcd, "calculateGcd");
|
|
15328
|
+
function calculateLcm(a, b) {
|
|
15329
|
+
const den = calculateGcd(a, b);
|
|
15330
|
+
return den === 0 ? 0 : Math.abs(a * b) / den;
|
|
15331
|
+
}
|
|
15332
|
+
__name(calculateLcm, "calculateLcm");
|
|
15333
|
+
function calculateMdeterm(matrix) {
|
|
15334
|
+
const n = matrix.length;
|
|
15335
|
+
if (n === 1)
|
|
15336
|
+
return matrix[0][0];
|
|
15337
|
+
if (n === 2)
|
|
15338
|
+
return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0];
|
|
15339
|
+
let det = 0;
|
|
15340
|
+
for (let col = 0; col < n; col++)
|
|
15341
|
+
det += (col % 2 === 0 ? 1 : -1) * matrix[0][col] * calculateMdeterm(minor(matrix, 0, col));
|
|
15342
|
+
return det;
|
|
15343
|
+
}
|
|
15344
|
+
__name(calculateMdeterm, "calculateMdeterm");
|
|
15345
|
+
function calculateMinverse(matrix) {
|
|
15346
|
+
const det = calculateMdeterm(matrix);
|
|
15347
|
+
return det === 0 ? null : matrix.length === 1 ? [[1 / det]] : adjoint(matrix).map((row) => row.map((value) => value / det));
|
|
15348
|
+
}
|
|
15349
|
+
__name(calculateMinverse, "calculateMinverse");
|
|
15350
|
+
function minor(matrix, row, col) {
|
|
15351
|
+
return matrix.filter((_, r) => r !== row).map((row2) => row2.filter((_, c) => c !== col));
|
|
15352
|
+
}
|
|
15353
|
+
__name(minor, "minor");
|
|
15354
|
+
function adjoint(matrix) {
|
|
15355
|
+
const n = matrix.length, adj = Array.from({ length: n }, () => new Array(n).fill(0));
|
|
15356
|
+
for (let i = 0; i < n; i++)
|
|
15357
|
+
for (let j = 0; j < n; j++) {
|
|
15358
|
+
const sign2 = (i + j) % 2 === 0 ? 1 : -1;
|
|
15359
|
+
adj[j][i] = sign2 * calculateMdeterm(minor(matrix, i, j));
|
|
15360
|
+
}
|
|
15361
|
+
return adj;
|
|
15362
|
+
}
|
|
15363
|
+
__name(adjoint, "adjoint");
|
|
15364
|
+
const _Combin = class _Combin extends BaseFunction {
|
|
15365
|
+
constructor() {
|
|
15366
|
+
super(...arguments);
|
|
15367
|
+
__publicField(this, "minParams", 2);
|
|
15368
|
+
__publicField(this, "maxParams", 2);
|
|
15369
|
+
}
|
|
15370
|
+
calculate(number, numberChosen) {
|
|
15371
|
+
const maxRowLength = Math.max(
|
|
15372
|
+
number.isArray() ? number.getRowCount() : 1,
|
|
15373
|
+
numberChosen.isArray() ? numberChosen.getRowCount() : 1
|
|
15374
|
+
), maxColumnLength = Math.max(
|
|
15375
|
+
number.isArray() ? number.getColumnCount() : 1,
|
|
15376
|
+
numberChosen.isArray() ? numberChosen.getColumnCount() : 1
|
|
15377
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, number, ErrorValueObject.create(ErrorType$1.NA)), numberChosenArray = expandArrayValueObject(maxRowLength, maxColumnLength, numberChosen, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.mapValue((numberObject, rowIndex, columnIndex) => {
|
|
15378
|
+
let _numberObject = numberObject, numberChosenObject = numberChosenArray.get(rowIndex, columnIndex);
|
|
15379
|
+
if (_numberObject.isString() && (_numberObject = _numberObject.convertToNumberObjectValue()), numberChosenObject.isString() && (numberChosenObject = numberChosenObject.convertToNumberObjectValue()), _numberObject.isError())
|
|
15380
|
+
return _numberObject;
|
|
15381
|
+
if (numberChosenObject.isError())
|
|
15382
|
+
return numberChosenObject;
|
|
15383
|
+
const numberValue = Math.floor(+_numberObject.getValue()), numberChosenValue = Math.floor(+numberChosenObject.getValue());
|
|
15384
|
+
if (numberValue < 0 || numberChosenValue < 0 || numberValue < numberChosenValue)
|
|
15385
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
15386
|
+
const result = calculateCombin(numberValue, numberChosenValue);
|
|
15387
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
15388
|
+
});
|
|
15389
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
15390
|
+
}
|
|
15391
|
+
};
|
|
15392
|
+
__name(_Combin, "Combin");
|
|
15393
|
+
let Combin = _Combin;
|
|
15394
|
+
const _Combina = class _Combina extends BaseFunction {
|
|
15395
|
+
constructor() {
|
|
15396
|
+
super(...arguments);
|
|
15397
|
+
__publicField(this, "minParams", 2);
|
|
15398
|
+
__publicField(this, "maxParams", 2);
|
|
15399
|
+
}
|
|
15400
|
+
calculate(number, numberChosen) {
|
|
15401
|
+
const maxRowLength = Math.max(
|
|
15402
|
+
number.isArray() ? number.getRowCount() : 1,
|
|
15403
|
+
numberChosen.isArray() ? numberChosen.getRowCount() : 1
|
|
15404
|
+
), maxColumnLength = Math.max(
|
|
15405
|
+
number.isArray() ? number.getColumnCount() : 1,
|
|
15406
|
+
numberChosen.isArray() ? numberChosen.getColumnCount() : 1
|
|
15407
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, number, ErrorValueObject.create(ErrorType$1.NA)), numberChosenArray = expandArrayValueObject(maxRowLength, maxColumnLength, numberChosen, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.mapValue((numberObject, rowIndex, columnIndex) => {
|
|
15408
|
+
let _numberObject = numberObject, numberChosenObject = numberChosenArray.get(rowIndex, columnIndex);
|
|
15409
|
+
if (_numberObject.isString() && (_numberObject = _numberObject.convertToNumberObjectValue()), numberChosenObject.isString() && (numberChosenObject = numberChosenObject.convertToNumberObjectValue()), _numberObject.isError())
|
|
15410
|
+
return _numberObject;
|
|
15411
|
+
if (numberChosenObject.isError())
|
|
15412
|
+
return numberChosenObject;
|
|
15413
|
+
const numberValue = Math.floor(+_numberObject.getValue()), numberChosenValue = Math.floor(+numberChosenObject.getValue());
|
|
15414
|
+
if (numberValue < 0 || numberChosenValue < 0 || numberValue === 0 && numberValue < numberChosenValue)
|
|
15415
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
15416
|
+
const result = calculateCombin(numberValue + numberChosenValue - 1, numberValue - 1);
|
|
15417
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
15418
|
+
});
|
|
15419
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
15420
|
+
}
|
|
15421
|
+
};
|
|
15422
|
+
__name(_Combina, "Combina");
|
|
15423
|
+
let Combina = _Combina;
|
|
14541
15424
|
const _Cos = class _Cos extends BaseFunction {
|
|
14542
15425
|
constructor() {
|
|
14543
15426
|
super(...arguments);
|
|
@@ -14740,6 +15623,51 @@ const _Exp = class _Exp extends BaseFunction {
|
|
|
14740
15623
|
};
|
|
14741
15624
|
__name(_Exp, "Exp");
|
|
14742
15625
|
let Exp = _Exp;
|
|
15626
|
+
const _Fact = class _Fact extends BaseFunction {
|
|
15627
|
+
constructor() {
|
|
15628
|
+
super(...arguments);
|
|
15629
|
+
__publicField(this, "minParams", 1);
|
|
15630
|
+
__publicField(this, "maxParams", 1);
|
|
15631
|
+
}
|
|
15632
|
+
calculate(number) {
|
|
15633
|
+
return number.isArray() ? number.mapValue((numberObject) => this._handleSingleObject(numberObject)) : this._handleSingleObject(number);
|
|
15634
|
+
}
|
|
15635
|
+
_handleSingleObject(number) {
|
|
15636
|
+
let _number = number;
|
|
15637
|
+
if (_number.isString() && (_number = _number.convertToNumberObjectValue()), _number.isError())
|
|
15638
|
+
return _number;
|
|
15639
|
+
const numberValue = Math.floor(+_number.getValue()), result = calculateFactorial(numberValue);
|
|
15640
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
15641
|
+
}
|
|
15642
|
+
};
|
|
15643
|
+
__name(_Fact, "Fact");
|
|
15644
|
+
let Fact = _Fact;
|
|
15645
|
+
const _Factdouble = class _Factdouble extends BaseFunction {
|
|
15646
|
+
constructor() {
|
|
15647
|
+
super(...arguments);
|
|
15648
|
+
__publicField(this, "minParams", 1);
|
|
15649
|
+
__publicField(this, "maxParams", 1);
|
|
15650
|
+
}
|
|
15651
|
+
calculate(number) {
|
|
15652
|
+
let _number = number;
|
|
15653
|
+
if (number.isArray()) {
|
|
15654
|
+
const rowCount = number.getRowCount(), columnCount = number.getColumnCount();
|
|
15655
|
+
if (rowCount > 1 || columnCount > 1)
|
|
15656
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
15657
|
+
_number = number.get(0, 0);
|
|
15658
|
+
}
|
|
15659
|
+
return this._handleSingleObject(_number);
|
|
15660
|
+
}
|
|
15661
|
+
_handleSingleObject(number) {
|
|
15662
|
+
let _number = number;
|
|
15663
|
+
if (_number.isString() && (_number = _number.convertToNumberObjectValue()), _number.isError())
|
|
15664
|
+
return _number;
|
|
15665
|
+
const numberValue = Math.floor(+_number.getValue()), result = calculateFactorial(numberValue, 2);
|
|
15666
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
15667
|
+
}
|
|
15668
|
+
};
|
|
15669
|
+
__name(_Factdouble, "Factdouble");
|
|
15670
|
+
let Factdouble = _Factdouble;
|
|
14743
15671
|
const _Floor = class _Floor extends BaseFunction {
|
|
14744
15672
|
constructor() {
|
|
14745
15673
|
super(...arguments);
|
|
@@ -14810,43 +15738,180 @@ const _FloorMath = class _FloorMath extends BaseFunction {
|
|
|
14810
15738
|
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
14811
15739
|
}
|
|
14812
15740
|
};
|
|
14813
|
-
__name(_FloorMath, "FloorMath");
|
|
14814
|
-
let FloorMath = _FloorMath;
|
|
14815
|
-
const _FloorPrecise = class _FloorPrecise extends BaseFunction {
|
|
15741
|
+
__name(_FloorMath, "FloorMath");
|
|
15742
|
+
let FloorMath = _FloorMath;
|
|
15743
|
+
const _FloorPrecise = class _FloorPrecise extends BaseFunction {
|
|
15744
|
+
constructor() {
|
|
15745
|
+
super(...arguments);
|
|
15746
|
+
__publicField(this, "minParams", 1);
|
|
15747
|
+
__publicField(this, "maxParams", 2);
|
|
15748
|
+
}
|
|
15749
|
+
calculate(number, significance) {
|
|
15750
|
+
const _significance = significance != null ? significance : NumberValueObject.create(1);
|
|
15751
|
+
if (number.isError())
|
|
15752
|
+
return number;
|
|
15753
|
+
if (_significance.isError())
|
|
15754
|
+
return _significance;
|
|
15755
|
+
const maxRowLength = Math.max(
|
|
15756
|
+
number.isArray() ? number.getRowCount() : 1,
|
|
15757
|
+
_significance.isArray() ? _significance.getRowCount() : 1
|
|
15758
|
+
), maxColumnLength = Math.max(
|
|
15759
|
+
number.isArray() ? number.getColumnCount() : 1,
|
|
15760
|
+
_significance.isArray() ? _significance.getColumnCount() : 1
|
|
15761
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, number, ErrorValueObject.create(ErrorType$1.NA)), significanceArray = expandArrayValueObject(maxRowLength, maxColumnLength, _significance, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((numberObject, rowIndex, columnIndex) => {
|
|
15762
|
+
let significanceObject = significanceArray.get(rowIndex, columnIndex), _numberObject = numberObject;
|
|
15763
|
+
if (_numberObject.isString() && (_numberObject = _numberObject.convertToNumberObjectValue()), _numberObject.isError())
|
|
15764
|
+
return _numberObject;
|
|
15765
|
+
if (significanceObject.isString() && (significanceObject = significanceObject.convertToNumberObjectValue()), significanceObject.isError())
|
|
15766
|
+
return significanceObject;
|
|
15767
|
+
const numberValue = +_numberObject.getValue(), significanceValue = +significanceObject.getValue();
|
|
15768
|
+
if (numberValue === 0 || significanceValue === 0)
|
|
15769
|
+
return NumberValueObject.create(0);
|
|
15770
|
+
const result = (significanceValue < 0 ? -floor(numberValue / Math.abs(significanceValue), 0) : floor(numberValue / significanceValue, 0)) * significanceValue;
|
|
15771
|
+
return NumberValueObject.create(result);
|
|
15772
|
+
});
|
|
15773
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
15774
|
+
}
|
|
15775
|
+
};
|
|
15776
|
+
__name(_FloorPrecise, "FloorPrecise");
|
|
15777
|
+
let FloorPrecise = _FloorPrecise;
|
|
15778
|
+
const _Gcd = class _Gcd extends BaseFunction {
|
|
15779
|
+
constructor() {
|
|
15780
|
+
super(...arguments);
|
|
15781
|
+
__publicField(this, "minParams", 1);
|
|
15782
|
+
__publicField(this, "maxParams", 255);
|
|
15783
|
+
}
|
|
15784
|
+
calculate(...variants) {
|
|
15785
|
+
let result = 0;
|
|
15786
|
+
for (let i = 0; i < variants.length; i++) {
|
|
15787
|
+
const variant = variants[i];
|
|
15788
|
+
if (!variant.isNull())
|
|
15789
|
+
if (variant.isArray()) {
|
|
15790
|
+
let isError = !1, errorObject = ErrorValueObject.create(ErrorType$1.VALUE);
|
|
15791
|
+
if (variant.iterator((valueObject) => {
|
|
15792
|
+
if (valueObject != null && valueObject.isNull())
|
|
15793
|
+
return !0;
|
|
15794
|
+
const { isError: _isError, errorObject: _errorObject, number } = this._handleSingleObject(valueObject);
|
|
15795
|
+
if (_isError)
|
|
15796
|
+
return isError = !0, errorObject = _errorObject, !1;
|
|
15797
|
+
result = calculateGcd(result, number);
|
|
15798
|
+
}), isError)
|
|
15799
|
+
return errorObject;
|
|
15800
|
+
} else {
|
|
15801
|
+
const { isError, errorObject, number } = this._handleSingleObject(variant);
|
|
15802
|
+
if (isError)
|
|
15803
|
+
return errorObject;
|
|
15804
|
+
result = calculateGcd(result, number);
|
|
15805
|
+
}
|
|
15806
|
+
}
|
|
15807
|
+
return NumberValueObject.create(result);
|
|
15808
|
+
}
|
|
15809
|
+
_handleSingleObject(number) {
|
|
15810
|
+
if (number.isBoolean())
|
|
15811
|
+
return {
|
|
15812
|
+
isError: !0,
|
|
15813
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE),
|
|
15814
|
+
number: null
|
|
15815
|
+
};
|
|
15816
|
+
let _number = number;
|
|
15817
|
+
if (number.isString() && (_number = _number.convertToNumberObjectValue()), _number.isError())
|
|
15818
|
+
return {
|
|
15819
|
+
isError: !0,
|
|
15820
|
+
errorObject: _number,
|
|
15821
|
+
number: null
|
|
15822
|
+
};
|
|
15823
|
+
const numberValue = Math.floor(+_number.getValue());
|
|
15824
|
+
return numberValue < 0 || numberValue >= 2 ** 53 ? {
|
|
15825
|
+
isError: !0,
|
|
15826
|
+
errorObject: ErrorValueObject.create(ErrorType$1.NUM),
|
|
15827
|
+
number: null
|
|
15828
|
+
} : {
|
|
15829
|
+
isError: !1,
|
|
15830
|
+
errorObject: null,
|
|
15831
|
+
number: numberValue
|
|
15832
|
+
};
|
|
15833
|
+
}
|
|
15834
|
+
};
|
|
15835
|
+
__name(_Gcd, "Gcd");
|
|
15836
|
+
let Gcd = _Gcd;
|
|
15837
|
+
const _Int = class _Int extends BaseFunction {
|
|
15838
|
+
constructor() {
|
|
15839
|
+
super(...arguments);
|
|
15840
|
+
__publicField(this, "minParams", 1);
|
|
15841
|
+
__publicField(this, "maxParams", 1);
|
|
15842
|
+
}
|
|
15843
|
+
calculate(number) {
|
|
15844
|
+
return number.isArray() ? number.mapValue((numberObject) => this._handleSingleObject(numberObject)) : this._handleSingleObject(number);
|
|
15845
|
+
}
|
|
15846
|
+
_handleSingleObject(number) {
|
|
15847
|
+
let _number = number;
|
|
15848
|
+
if (_number.isString() && (_number = _number.convertToNumberObjectValue()), _number.isError())
|
|
15849
|
+
return _number;
|
|
15850
|
+
const numberValue = Math.floor(+_number.getValue());
|
|
15851
|
+
return NumberValueObject.create(numberValue);
|
|
15852
|
+
}
|
|
15853
|
+
};
|
|
15854
|
+
__name(_Int, "Int");
|
|
15855
|
+
let Int = _Int;
|
|
15856
|
+
const _Lcm = class _Lcm extends BaseFunction {
|
|
14816
15857
|
constructor() {
|
|
14817
15858
|
super(...arguments);
|
|
14818
15859
|
__publicField(this, "minParams", 1);
|
|
14819
|
-
__publicField(this, "maxParams",
|
|
15860
|
+
__publicField(this, "maxParams", 255);
|
|
14820
15861
|
}
|
|
14821
|
-
calculate(
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
15862
|
+
calculate(...variants) {
|
|
15863
|
+
let result = 1, noCalculate = !0;
|
|
15864
|
+
for (let i = 0; i < variants.length; i++) {
|
|
15865
|
+
const variant = variants[i];
|
|
15866
|
+
if (!variant.isNull())
|
|
15867
|
+
if (variant.isArray()) {
|
|
15868
|
+
let isError = !1, errorObject = ErrorValueObject.create(ErrorType$1.VALUE);
|
|
15869
|
+
if (variant.iterator((valueObject) => {
|
|
15870
|
+
if (valueObject != null && valueObject.isNull())
|
|
15871
|
+
return !0;
|
|
15872
|
+
const { isError: _isError, errorObject: _errorObject, number } = this._handleSingleObject(valueObject);
|
|
15873
|
+
if (_isError)
|
|
15874
|
+
return isError = !0, errorObject = _errorObject, !1;
|
|
15875
|
+
result = calculateLcm(result, number), noCalculate = !1;
|
|
15876
|
+
}), isError)
|
|
15877
|
+
return errorObject;
|
|
15878
|
+
} else {
|
|
15879
|
+
const { isError, errorObject, number } = this._handleSingleObject(variant);
|
|
15880
|
+
if (isError)
|
|
15881
|
+
return errorObject;
|
|
15882
|
+
result = calculateLcm(result, number), noCalculate = !1;
|
|
15883
|
+
}
|
|
15884
|
+
}
|
|
15885
|
+
return noCalculate ? NumberValueObject.create(0) : Number.isNaN(result) || !Number.isFinite(result) || result >= 2 ** 53 ? ErrorValueObject.create(ErrorType$1.VALUE) : NumberValueObject.create(result);
|
|
15886
|
+
}
|
|
15887
|
+
_handleSingleObject(number) {
|
|
15888
|
+
if (number.isBoolean())
|
|
15889
|
+
return {
|
|
15890
|
+
isError: !0,
|
|
15891
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE),
|
|
15892
|
+
number: null
|
|
15893
|
+
};
|
|
15894
|
+
let _number = number;
|
|
15895
|
+
if (number.isString() && (_number = _number.convertToNumberObjectValue()), _number.isError())
|
|
15896
|
+
return {
|
|
15897
|
+
isError: !0,
|
|
15898
|
+
errorObject: _number,
|
|
15899
|
+
number: null
|
|
15900
|
+
};
|
|
15901
|
+
const numberValue = Math.floor(+_number.getValue());
|
|
15902
|
+
return numberValue < 0 ? {
|
|
15903
|
+
isError: !0,
|
|
15904
|
+
errorObject: ErrorValueObject.create(ErrorType$1.NUM),
|
|
15905
|
+
number: null
|
|
15906
|
+
} : {
|
|
15907
|
+
isError: !1,
|
|
15908
|
+
errorObject: null,
|
|
15909
|
+
number: numberValue
|
|
15910
|
+
};
|
|
14846
15911
|
}
|
|
14847
15912
|
};
|
|
14848
|
-
__name(
|
|
14849
|
-
let
|
|
15913
|
+
__name(_Lcm, "Lcm");
|
|
15914
|
+
let Lcm = _Lcm;
|
|
14850
15915
|
const _Ln = class _Ln extends BaseFunction {
|
|
14851
15916
|
constructor() {
|
|
14852
15917
|
super(...arguments);
|
|
@@ -14911,6 +15976,119 @@ const _Log10 = class _Log10 extends BaseFunction {
|
|
|
14911
15976
|
};
|
|
14912
15977
|
__name(_Log10, "Log10");
|
|
14913
15978
|
let Log10 = _Log10;
|
|
15979
|
+
const _Mdeterm = class _Mdeterm extends BaseFunction {
|
|
15980
|
+
constructor() {
|
|
15981
|
+
super(...arguments);
|
|
15982
|
+
__publicField(this, "minParams", 1);
|
|
15983
|
+
__publicField(this, "maxParams", 1);
|
|
15984
|
+
}
|
|
15985
|
+
calculate(array) {
|
|
15986
|
+
const arrayRowCount = array.isArray() ? array.getRowCount() : 1, arrayColumnCount = array.isArray() ? array.getColumnCount() : 1, matrix = [];
|
|
15987
|
+
for (let r = 0; r < arrayRowCount; r++) {
|
|
15988
|
+
const row = [];
|
|
15989
|
+
for (let c = 0; c < arrayColumnCount; c++) {
|
|
15990
|
+
let valueObject = array.isArray() ? array.get(r, c) : array;
|
|
15991
|
+
if (valueObject.isError())
|
|
15992
|
+
return valueObject;
|
|
15993
|
+
if (valueObject.isNull() || valueObject.isBoolean())
|
|
15994
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
15995
|
+
if (valueObject.isString() && (valueObject = valueObject.convertToNumberObjectValue()), valueObject.isError())
|
|
15996
|
+
return valueObject;
|
|
15997
|
+
const value = +valueObject.getValue();
|
|
15998
|
+
row.push(value);
|
|
15999
|
+
}
|
|
16000
|
+
matrix.push(row);
|
|
16001
|
+
}
|
|
16002
|
+
if (arrayRowCount !== arrayColumnCount)
|
|
16003
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16004
|
+
const result = calculateMdeterm(matrix);
|
|
16005
|
+
return NumberValueObject.create(result);
|
|
16006
|
+
}
|
|
16007
|
+
};
|
|
16008
|
+
__name(_Mdeterm, "Mdeterm");
|
|
16009
|
+
let Mdeterm = _Mdeterm;
|
|
16010
|
+
const _Minverse = class _Minverse extends BaseFunction {
|
|
16011
|
+
constructor() {
|
|
16012
|
+
super(...arguments);
|
|
16013
|
+
__publicField(this, "minParams", 1);
|
|
16014
|
+
__publicField(this, "maxParams", 1);
|
|
16015
|
+
}
|
|
16016
|
+
calculate(array) {
|
|
16017
|
+
const arrayRowCount = array.isArray() ? array.getRowCount() : 1, arrayColumnCount = array.isArray() ? array.getColumnCount() : 1, matrix = [];
|
|
16018
|
+
for (let r = 0; r < arrayRowCount; r++) {
|
|
16019
|
+
const row = [];
|
|
16020
|
+
for (let c = 0; c < arrayColumnCount; c++) {
|
|
16021
|
+
let valueObject = array.isArray() ? array.get(r, c) : array;
|
|
16022
|
+
if (valueObject.isError())
|
|
16023
|
+
return valueObject;
|
|
16024
|
+
if (valueObject.isNull() || valueObject.isBoolean())
|
|
16025
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16026
|
+
if (valueObject.isString() && (valueObject = valueObject.convertToNumberObjectValue()), valueObject.isError())
|
|
16027
|
+
return valueObject;
|
|
16028
|
+
const value = +valueObject.getValue();
|
|
16029
|
+
row.push(value);
|
|
16030
|
+
}
|
|
16031
|
+
matrix.push(row);
|
|
16032
|
+
}
|
|
16033
|
+
if (arrayRowCount !== arrayColumnCount)
|
|
16034
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16035
|
+
const result = calculateMinverse(matrix);
|
|
16036
|
+
return result === null ? ErrorValueObject.create(ErrorType$1.NUM) : ArrayValueObject.createByArray(result);
|
|
16037
|
+
}
|
|
16038
|
+
};
|
|
16039
|
+
__name(_Minverse, "Minverse");
|
|
16040
|
+
let Minverse = _Minverse;
|
|
16041
|
+
const _Mmult = class _Mmult extends BaseFunction {
|
|
16042
|
+
constructor() {
|
|
16043
|
+
super(...arguments);
|
|
16044
|
+
__publicField(this, "minParams", 2);
|
|
16045
|
+
__publicField(this, "maxParams", 2);
|
|
16046
|
+
}
|
|
16047
|
+
calculate(array1, array2) {
|
|
16048
|
+
const array1RowCount = array1.isArray() ? array1.getRowCount() : 1, array1ColumnCount = array1.isArray() ? array1.getColumnCount() : 1, array2RowCount = array2.isArray() ? array2.getRowCount() : 1, array2ColumnCount = array2.isArray() ? array2.getColumnCount() : 1;
|
|
16049
|
+
if (array1ColumnCount !== array2RowCount)
|
|
16050
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16051
|
+
const matrix1 = this._getMatrix(array1, array1RowCount, array1ColumnCount), matrix2 = this._getMatrix(array2, array2RowCount, array2ColumnCount);
|
|
16052
|
+
if (matrix1 instanceof ErrorValueObject)
|
|
16053
|
+
return matrix1;
|
|
16054
|
+
if (matrix2 instanceof ErrorValueObject)
|
|
16055
|
+
return matrix2;
|
|
16056
|
+
const result = this._getResult(matrix1, matrix2, array1RowCount, array1ColumnCount, array2ColumnCount);
|
|
16057
|
+
return ArrayValueObject.createByArray(result);
|
|
16058
|
+
}
|
|
16059
|
+
_getMatrix(array, rowCount, columnCount) {
|
|
16060
|
+
const matrix = [];
|
|
16061
|
+
for (let r = 0; r < rowCount; r++) {
|
|
16062
|
+
const row = [];
|
|
16063
|
+
for (let c = 0; c < columnCount; c++) {
|
|
16064
|
+
let valueObject = array.isArray() ? array.get(r, c) : array;
|
|
16065
|
+
if (valueObject.isError())
|
|
16066
|
+
return valueObject;
|
|
16067
|
+
if (valueObject.isNull() || valueObject.isBoolean())
|
|
16068
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16069
|
+
if (valueObject.isString() && (valueObject = valueObject.convertToNumberObjectValue()), valueObject.isError())
|
|
16070
|
+
return valueObject;
|
|
16071
|
+
const value = +valueObject.getValue();
|
|
16072
|
+
row.push(value);
|
|
16073
|
+
}
|
|
16074
|
+
matrix.push(row);
|
|
16075
|
+
}
|
|
16076
|
+
return matrix;
|
|
16077
|
+
}
|
|
16078
|
+
_getResult(matrix1, matrix2, array1RowCount, array1ColumnCount, array2ColumnCount) {
|
|
16079
|
+
const result = Array.from({ length: array1RowCount }, () => new Array(array2ColumnCount).fill(0));
|
|
16080
|
+
for (let r = 0; r < array1RowCount; r++)
|
|
16081
|
+
for (let c = 0; c < array2ColumnCount; c++) {
|
|
16082
|
+
let value = 0;
|
|
16083
|
+
for (let k = 0; k < array1ColumnCount; k++)
|
|
16084
|
+
value += matrix1[r][k] * matrix2[k][c];
|
|
16085
|
+
result[r][c] = value;
|
|
16086
|
+
}
|
|
16087
|
+
return result;
|
|
16088
|
+
}
|
|
16089
|
+
};
|
|
16090
|
+
__name(_Mmult, "Mmult");
|
|
16091
|
+
let Mmult = _Mmult;
|
|
14914
16092
|
const _Mod = class _Mod extends BaseFunction {
|
|
14915
16093
|
constructor() {
|
|
14916
16094
|
super(...arguments);
|
|
@@ -14967,6 +16145,104 @@ const _Mround = class _Mround extends BaseFunction {
|
|
|
14967
16145
|
};
|
|
14968
16146
|
__name(_Mround, "Mround");
|
|
14969
16147
|
let Mround = _Mround;
|
|
16148
|
+
const _Multinomial = class _Multinomial extends BaseFunction {
|
|
16149
|
+
constructor() {
|
|
16150
|
+
super(...arguments);
|
|
16151
|
+
__publicField(this, "minParams", 1);
|
|
16152
|
+
__publicField(this, "maxParams", 255);
|
|
16153
|
+
}
|
|
16154
|
+
calculate(...variants) {
|
|
16155
|
+
let sum2 = 0, den = 1;
|
|
16156
|
+
for (let i = 0; i < variants.length; i++) {
|
|
16157
|
+
const variant = variants[i];
|
|
16158
|
+
if (!variant.isNull())
|
|
16159
|
+
if (variant.isArray()) {
|
|
16160
|
+
let isError = !1, errorObject = ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16161
|
+
if (variant.iterator((valueObject) => {
|
|
16162
|
+
if (valueObject != null && valueObject.isNull())
|
|
16163
|
+
return !0;
|
|
16164
|
+
const { isError: _isError, errorObject: _errorObject, number } = this._handleSingleObject(valueObject);
|
|
16165
|
+
if (_isError)
|
|
16166
|
+
return isError = !0, errorObject = _errorObject, !1;
|
|
16167
|
+
if (sum2 += number, sum2 > 170)
|
|
16168
|
+
return isError = !0, errorObject = ErrorValueObject.create(ErrorType$1.NUM), !1;
|
|
16169
|
+
den *= calculateFactorial(number);
|
|
16170
|
+
}), isError)
|
|
16171
|
+
return errorObject;
|
|
16172
|
+
} else {
|
|
16173
|
+
const { isError, errorObject, number } = this._handleSingleObject(variant);
|
|
16174
|
+
if (isError)
|
|
16175
|
+
return errorObject;
|
|
16176
|
+
if (sum2 += number, sum2 > 170)
|
|
16177
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
16178
|
+
den *= calculateFactorial(number);
|
|
16179
|
+
}
|
|
16180
|
+
}
|
|
16181
|
+
const result = calculateFactorial(sum2) / den;
|
|
16182
|
+
return NumberValueObject.create(result);
|
|
16183
|
+
}
|
|
16184
|
+
_handleSingleObject(number) {
|
|
16185
|
+
if (number.isBoolean())
|
|
16186
|
+
return {
|
|
16187
|
+
isError: !0,
|
|
16188
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE),
|
|
16189
|
+
number: null
|
|
16190
|
+
};
|
|
16191
|
+
let _number = number;
|
|
16192
|
+
if (number.isString() && (_number = _number.convertToNumberObjectValue()), _number.isError())
|
|
16193
|
+
return {
|
|
16194
|
+
isError: !0,
|
|
16195
|
+
errorObject: _number,
|
|
16196
|
+
number: null
|
|
16197
|
+
};
|
|
16198
|
+
const numberValue = Math.floor(+_number.getValue());
|
|
16199
|
+
return numberValue < 0 ? {
|
|
16200
|
+
isError: !0,
|
|
16201
|
+
errorObject: ErrorValueObject.create(ErrorType$1.NUM),
|
|
16202
|
+
number: null
|
|
16203
|
+
} : {
|
|
16204
|
+
isError: !1,
|
|
16205
|
+
errorObject: null,
|
|
16206
|
+
number: numberValue
|
|
16207
|
+
};
|
|
16208
|
+
}
|
|
16209
|
+
};
|
|
16210
|
+
__name(_Multinomial, "Multinomial");
|
|
16211
|
+
let Multinomial = _Multinomial;
|
|
16212
|
+
const _Munit = class _Munit extends BaseFunction {
|
|
16213
|
+
constructor() {
|
|
16214
|
+
super(...arguments);
|
|
16215
|
+
__publicField(this, "minParams", 1);
|
|
16216
|
+
__publicField(this, "maxParams", 1);
|
|
16217
|
+
}
|
|
16218
|
+
calculate(dimension) {
|
|
16219
|
+
if (dimension.isArray()) {
|
|
16220
|
+
const rowCount = dimension.getRowCount(), columnCount = dimension.getColumnCount(), resultArray = dimension.mapValue((dimensionObject) => {
|
|
16221
|
+
const result = this._handleSingleObject(dimensionObject);
|
|
16222
|
+
return result.isError() ? result : rowCount > 1 || columnCount > 1 ? result.get(0, 0) : result;
|
|
16223
|
+
});
|
|
16224
|
+
return rowCount === 1 && columnCount === 1 ? resultArray.get(0, 0) : resultArray;
|
|
16225
|
+
}
|
|
16226
|
+
return this._handleSingleObject(dimension);
|
|
16227
|
+
}
|
|
16228
|
+
_handleSingleObject(dimension) {
|
|
16229
|
+
let _dimension = dimension;
|
|
16230
|
+
if (_dimension.isString() && (_dimension = _dimension.convertToNumberObjectValue()), _dimension.isError())
|
|
16231
|
+
return _dimension;
|
|
16232
|
+
const dimensionValue = Math.floor(+_dimension.getValue());
|
|
16233
|
+
if (dimensionValue <= 0)
|
|
16234
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16235
|
+
const result = [];
|
|
16236
|
+
for (let r = 0; r < dimensionValue; r++) {
|
|
16237
|
+
result[r] = [];
|
|
16238
|
+
for (let c = 0; c < dimensionValue; c++)
|
|
16239
|
+
result[r][c] = r === c ? 1 : 0;
|
|
16240
|
+
}
|
|
16241
|
+
return ArrayValueObject.createByArray(result);
|
|
16242
|
+
}
|
|
16243
|
+
};
|
|
16244
|
+
__name(_Munit, "Munit");
|
|
16245
|
+
let Munit = _Munit;
|
|
14970
16246
|
const _Odd = class _Odd extends BaseFunction {
|
|
14971
16247
|
constructor() {
|
|
14972
16248
|
super(...arguments);
|
|
@@ -15051,6 +16327,27 @@ const _Product = class _Product extends BaseFunction {
|
|
|
15051
16327
|
};
|
|
15052
16328
|
__name(_Product, "Product");
|
|
15053
16329
|
let Product = _Product;
|
|
16330
|
+
const _Quotient = class _Quotient extends BaseFunction {
|
|
16331
|
+
constructor() {
|
|
16332
|
+
super(...arguments);
|
|
16333
|
+
__publicField(this, "minParams", 2);
|
|
16334
|
+
__publicField(this, "maxParams", 2);
|
|
16335
|
+
}
|
|
16336
|
+
calculate(numerator, denominator) {
|
|
16337
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(numerator, denominator);
|
|
16338
|
+
if (isError)
|
|
16339
|
+
return errorObject;
|
|
16340
|
+
const [numeratorObject, denominatorObject] = variants, numeratorValue = +numeratorObject.getValue(), denominatorValue = +denominatorObject.getValue();
|
|
16341
|
+
if (Number.isNaN(numeratorValue) || Number.isNaN(denominatorValue))
|
|
16342
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16343
|
+
if (denominatorValue === 0)
|
|
16344
|
+
return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
|
|
16345
|
+
const result = Math.trunc(numeratorValue / denominatorValue);
|
|
16346
|
+
return NumberValueObject.create(result);
|
|
16347
|
+
}
|
|
16348
|
+
};
|
|
16349
|
+
__name(_Quotient, "Quotient");
|
|
16350
|
+
let Quotient = _Quotient;
|
|
15054
16351
|
const _Radians = class _Radians extends BaseFunction {
|
|
15055
16352
|
constructor() {
|
|
15056
16353
|
super(...arguments);
|
|
@@ -15333,6 +16630,141 @@ const _Sech = class _Sech extends BaseFunction {
|
|
|
15333
16630
|
};
|
|
15334
16631
|
__name(_Sech, "Sech");
|
|
15335
16632
|
let Sech = _Sech;
|
|
16633
|
+
const _Seriessum = class _Seriessum extends BaseFunction {
|
|
16634
|
+
constructor() {
|
|
16635
|
+
super(...arguments);
|
|
16636
|
+
__publicField(this, "minParams", 4);
|
|
16637
|
+
__publicField(this, "maxParams", 4);
|
|
16638
|
+
}
|
|
16639
|
+
calculate(x, n, m, coefficients) {
|
|
16640
|
+
if (x.isNull() || n.isNull() || m.isNull() || coefficients.isNull())
|
|
16641
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
16642
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n, m);
|
|
16643
|
+
if (isError)
|
|
16644
|
+
return errorObject;
|
|
16645
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsStringToNumber(...variants);
|
|
16646
|
+
if (isError2)
|
|
16647
|
+
return errorObject2;
|
|
16648
|
+
const [xObject, nObject, mObject] = variants2, xValue = +xObject.getValue(), nValue = +nObject.getValue(), mValue = +mObject.getValue(), coefficientsArray = [];
|
|
16649
|
+
if (coefficients.isArray()) {
|
|
16650
|
+
let isError_coefficients = !1, errorObject_coefficients = ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16651
|
+
if (coefficients.iterator((coefficientsObject) => {
|
|
16652
|
+
const { isError: _isError, errorObject: _errorObject, coefficientsObject: _coefficientsObject } = this._handleSingleObject(coefficientsObject);
|
|
16653
|
+
if (_isError)
|
|
16654
|
+
return isError_coefficients = !0, errorObject_coefficients = _errorObject, !1;
|
|
16655
|
+
const coefficientsValue = +_coefficientsObject.getValue();
|
|
16656
|
+
coefficientsArray.push(coefficientsValue);
|
|
16657
|
+
}), isError_coefficients)
|
|
16658
|
+
return errorObject_coefficients;
|
|
16659
|
+
} else {
|
|
16660
|
+
const { isError: _isError, errorObject: _errorObject, coefficientsObject: _coefficientsObject } = this._handleSingleObject(coefficients);
|
|
16661
|
+
if (_isError)
|
|
16662
|
+
return _errorObject;
|
|
16663
|
+
const coefficientsValue = +_coefficientsObject.getValue();
|
|
16664
|
+
coefficientsArray.push(coefficientsValue);
|
|
16665
|
+
}
|
|
16666
|
+
let result = 0;
|
|
16667
|
+
for (let i = 0; i < coefficientsArray.length; i++)
|
|
16668
|
+
result += coefficientsArray[i] * xValue ** (nValue + i * mValue);
|
|
16669
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
16670
|
+
}
|
|
16671
|
+
_handleSingleObject(coefficientsObject) {
|
|
16672
|
+
if (coefficientsObject.isError())
|
|
16673
|
+
return {
|
|
16674
|
+
isError: !0,
|
|
16675
|
+
errorObject: coefficientsObject,
|
|
16676
|
+
coefficientsObject: null
|
|
16677
|
+
};
|
|
16678
|
+
if (coefficientsObject != null && coefficientsObject.isBoolean())
|
|
16679
|
+
return {
|
|
16680
|
+
isError: !0,
|
|
16681
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE),
|
|
16682
|
+
coefficientsObject: null
|
|
16683
|
+
};
|
|
16684
|
+
let _coefficientsObject = coefficientsObject;
|
|
16685
|
+
return _coefficientsObject.isString() && (_coefficientsObject = _coefficientsObject.convertToNumberObjectValue()), _coefficientsObject.isError() ? {
|
|
16686
|
+
isError: !0,
|
|
16687
|
+
errorObject: _coefficientsObject,
|
|
16688
|
+
coefficientsObject: null
|
|
16689
|
+
} : {
|
|
16690
|
+
isError: !1,
|
|
16691
|
+
errorObject: null,
|
|
16692
|
+
coefficientsObject: _coefficientsObject
|
|
16693
|
+
};
|
|
16694
|
+
}
|
|
16695
|
+
};
|
|
16696
|
+
__name(_Seriessum, "Seriessum");
|
|
16697
|
+
let Seriessum = _Seriessum;
|
|
16698
|
+
const _Sequence = class _Sequence extends BaseFunction {
|
|
16699
|
+
constructor() {
|
|
16700
|
+
super(...arguments);
|
|
16701
|
+
__publicField(this, "minParams", 1);
|
|
16702
|
+
__publicField(this, "maxParams", 4);
|
|
16703
|
+
}
|
|
16704
|
+
calculate(rows, columns, start, step) {
|
|
16705
|
+
let _rows = rows, _columns = columns != null ? columns : NumberValueObject.create(1), _start = start != null ? start : NumberValueObject.create(1), _step = step != null ? step : NumberValueObject.create(1);
|
|
16706
|
+
_rows.isNull() && (_rows = NumberValueObject.create(1)), _columns.isNull() && (_columns = NumberValueObject.create(1)), _start.isNull() && (_start = NumberValueObject.create(1)), _step.isNull() && (_step = NumberValueObject.create(1));
|
|
16707
|
+
const maxRowLength = Math.max(
|
|
16708
|
+
_rows.isArray() ? _rows.getRowCount() : 1,
|
|
16709
|
+
_columns.isArray() ? _columns.getRowCount() : 1,
|
|
16710
|
+
_start.isArray() ? _start.getRowCount() : 1,
|
|
16711
|
+
_step.isArray() ? _step.getRowCount() : 1
|
|
16712
|
+
), maxColumnLength = Math.max(
|
|
16713
|
+
_rows.isArray() ? _rows.getColumnCount() : 1,
|
|
16714
|
+
_columns.isArray() ? _columns.getColumnCount() : 1,
|
|
16715
|
+
_start.isArray() ? _start.getColumnCount() : 1,
|
|
16716
|
+
_step.isArray() ? _step.getColumnCount() : 1
|
|
16717
|
+
), rowsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _rows, ErrorValueObject.create(ErrorType$1.NA)), columnsArray = expandArrayValueObject(maxRowLength, maxColumnLength, _columns, ErrorValueObject.create(ErrorType$1.NA)), startArray = expandArrayValueObject(maxRowLength, maxColumnLength, _start, ErrorValueObject.create(ErrorType$1.NA)), stepArray = expandArrayValueObject(maxRowLength, maxColumnLength, _step, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rowsArray.mapValue((rowsObject, rowIndex, columnIndex) => {
|
|
16718
|
+
const columnsObject = columnsArray.get(rowIndex, columnIndex), startObject = startArray.get(rowIndex, columnIndex), stepObject = stepArray.get(rowIndex, columnIndex);
|
|
16719
|
+
return rowsObject.isError() ? rowsObject : columnsObject.isError() ? columnsObject : startObject.isError() ? startObject : stepObject.isError() ? stepObject : this._getResult(rowsObject, columnsObject, startObject, stepObject, maxRowLength, maxColumnLength);
|
|
16720
|
+
});
|
|
16721
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
16722
|
+
}
|
|
16723
|
+
_getResult(rowsObject, columnsObject, startObject, stepObject, maxRowLength, maxColumnLength) {
|
|
16724
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rowsObject, columnsObject, startObject, stepObject);
|
|
16725
|
+
if (isError)
|
|
16726
|
+
return errorObject;
|
|
16727
|
+
const [_rowsObject, _columnsObject, _startObject, _stepObject] = variants, rowsValue = Math.floor(+_rowsObject.getValue()), columnsValue = Math.floor(+_columnsObject.getValue()), startValue = +_startObject.getValue(), stepValue = +_stepObject.getValue();
|
|
16728
|
+
if (rowsValue < 0 || columnsValue < 0)
|
|
16729
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
16730
|
+
if (rowsValue === 0 || columnsValue === 0)
|
|
16731
|
+
return ErrorValueObject.create(ErrorType$1.CALC);
|
|
16732
|
+
const result = [];
|
|
16733
|
+
for (let r = 0; r < rowsValue; r++) {
|
|
16734
|
+
result[r] = [];
|
|
16735
|
+
for (let c = 0; c < columnsValue; c++)
|
|
16736
|
+
result[r][c] = startValue + (r * columnsValue + c) * stepValue;
|
|
16737
|
+
}
|
|
16738
|
+
return maxRowLength > 1 || maxColumnLength > 1 ? NumberValueObject.create(result[0][0]) : ArrayValueObject.createByArray(result);
|
|
16739
|
+
}
|
|
16740
|
+
};
|
|
16741
|
+
__name(_Sequence, "Sequence");
|
|
16742
|
+
let Sequence = _Sequence;
|
|
16743
|
+
const _Sign = class _Sign extends BaseFunction {
|
|
16744
|
+
constructor() {
|
|
16745
|
+
super(...arguments);
|
|
16746
|
+
__publicField(this, "minParams", 1);
|
|
16747
|
+
__publicField(this, "maxParams", 1);
|
|
16748
|
+
}
|
|
16749
|
+
calculate(number) {
|
|
16750
|
+
if (number.isArray()) {
|
|
16751
|
+
const resultArray = number.mapValue((numberObject) => this._handleSingleObject(numberObject));
|
|
16752
|
+
return resultArray.getRowCount() === 1 && resultArray.getColumnCount() === 1 ? resultArray.get(0, 0) : resultArray;
|
|
16753
|
+
}
|
|
16754
|
+
return this._handleSingleObject(number);
|
|
16755
|
+
}
|
|
16756
|
+
_handleSingleObject(number) {
|
|
16757
|
+
if (number.isError())
|
|
16758
|
+
return number;
|
|
16759
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(number);
|
|
16760
|
+
if (isError)
|
|
16761
|
+
return errorObject;
|
|
16762
|
+
const [numberObject] = variants, numberValue = +numberObject.getValue();
|
|
16763
|
+
return numberValue > 0 ? NumberValueObject.create(1) : numberValue < 0 ? NumberValueObject.create(-1) : NumberValueObject.create(0);
|
|
16764
|
+
}
|
|
16765
|
+
};
|
|
16766
|
+
__name(_Sign, "Sign");
|
|
16767
|
+
let Sign = _Sign;
|
|
15336
16768
|
const _Sin = class _Sin extends BaseFunction {
|
|
15337
16769
|
constructor() {
|
|
15338
16770
|
super(...arguments);
|
|
@@ -16012,6 +17444,8 @@ const functionMath = [
|
|
|
16012
17444
|
[Ceiling, FUNCTION_NAMES_MATH.CEILING],
|
|
16013
17445
|
[CeilingMath, FUNCTION_NAMES_MATH.CEILING_MATH],
|
|
16014
17446
|
[CeilingPrecise, FUNCTION_NAMES_MATH.CEILING_PRECISE],
|
|
17447
|
+
[Combin, FUNCTION_NAMES_MATH.COMBIN],
|
|
17448
|
+
[Combina, FUNCTION_NAMES_MATH.COMBINA],
|
|
16015
17449
|
[Cos, FUNCTION_NAMES_MATH.COS],
|
|
16016
17450
|
[Cosh, FUNCTION_NAMES_MATH.COSH],
|
|
16017
17451
|
[Cot, FUNCTION_NAMES_MATH.COT],
|
|
@@ -16022,18 +17456,29 @@ const functionMath = [
|
|
|
16022
17456
|
[Degrees, FUNCTION_NAMES_MATH.DEGREES],
|
|
16023
17457
|
[Even, FUNCTION_NAMES_MATH.EVEN],
|
|
16024
17458
|
[Exp, FUNCTION_NAMES_MATH.EXP],
|
|
17459
|
+
[Fact, FUNCTION_NAMES_MATH.FACT],
|
|
17460
|
+
[Factdouble, FUNCTION_NAMES_MATH.FACTDOUBLE],
|
|
16025
17461
|
[Floor, FUNCTION_NAMES_MATH.FLOOR],
|
|
16026
17462
|
[FloorMath, FUNCTION_NAMES_MATH.FLOOR_MATH],
|
|
16027
17463
|
[FloorPrecise, FUNCTION_NAMES_MATH.FLOOR_PRECISE],
|
|
17464
|
+
[Gcd, FUNCTION_NAMES_MATH.GCD],
|
|
17465
|
+
[Int, FUNCTION_NAMES_MATH.INT],
|
|
17466
|
+
[Lcm, FUNCTION_NAMES_MATH.LCM],
|
|
16028
17467
|
[Ln, FUNCTION_NAMES_MATH.LN],
|
|
16029
17468
|
[Log, FUNCTION_NAMES_MATH.LOG],
|
|
16030
17469
|
[Log10, FUNCTION_NAMES_MATH.LOG10],
|
|
17470
|
+
[Mdeterm, FUNCTION_NAMES_MATH.MDETERM],
|
|
17471
|
+
[Minverse, FUNCTION_NAMES_MATH.MINVERSE],
|
|
17472
|
+
[Mmult, FUNCTION_NAMES_MATH.MMULT],
|
|
16031
17473
|
[Mod, FUNCTION_NAMES_MATH.MOD],
|
|
16032
17474
|
[Mround, FUNCTION_NAMES_MATH.MROUND],
|
|
17475
|
+
[Multinomial, FUNCTION_NAMES_MATH.MULTINOMIAL],
|
|
17476
|
+
[Munit, FUNCTION_NAMES_MATH.MUNIT],
|
|
16033
17477
|
[Odd, FUNCTION_NAMES_MATH.ODD],
|
|
16034
17478
|
[Pi, FUNCTION_NAMES_MATH.PI],
|
|
16035
17479
|
[Power, FUNCTION_NAMES_MATH.POWER],
|
|
16036
17480
|
[Product, FUNCTION_NAMES_MATH.PRODUCT],
|
|
17481
|
+
[Quotient, FUNCTION_NAMES_MATH.QUOTIENT],
|
|
16037
17482
|
[Radians, FUNCTION_NAMES_MATH.RADIANS],
|
|
16038
17483
|
[Rand, FUNCTION_NAMES_MATH.RAND],
|
|
16039
17484
|
[Randarray, FUNCTION_NAMES_MATH.RANDARRAY],
|
|
@@ -16043,6 +17488,9 @@ const functionMath = [
|
|
|
16043
17488
|
[Roundup, FUNCTION_NAMES_MATH.ROUNDUP],
|
|
16044
17489
|
[Sec, FUNCTION_NAMES_MATH.SEC],
|
|
16045
17490
|
[Sech, FUNCTION_NAMES_MATH.SECH],
|
|
17491
|
+
[Seriessum, FUNCTION_NAMES_MATH.SERIESSUM],
|
|
17492
|
+
[Sequence, FUNCTION_NAMES_MATH.SEQUENCE],
|
|
17493
|
+
[Sign, FUNCTION_NAMES_MATH.SIGN],
|
|
16046
17494
|
[Sin, FUNCTION_NAMES_MATH.SIN],
|
|
16047
17495
|
[Sinh, FUNCTION_NAMES_MATH.SINH],
|
|
16048
17496
|
[Sqrt, FUNCTION_NAMES_MATH.SQRT],
|
|
@@ -17421,35 +18869,28 @@ var FUNCTION_NAMES_UNIVER = /* @__PURE__ */ ((FUNCTION_NAMES_UNIVER2) => FUNCTIO
|
|
|
17421
18869
|
const functionWeb = [];
|
|
17422
18870
|
var FUNCTION_NAMES_WEB = /* @__PURE__ */ ((FUNCTION_NAMES_WEB2) => (FUNCTION_NAMES_WEB2.ENCODEURL = "ENCODEURL", FUNCTION_NAMES_WEB2.FILTERXML = "FILTERXML", FUNCTION_NAMES_WEB2.WEBSERVICE = "WEBSERVICE", FUNCTION_NAMES_WEB2))(FUNCTION_NAMES_WEB || {});
|
|
17423
18871
|
function updateFormulaDataByCellValue(sheetFormulaDataMatrix, newSheetFormulaDataMatrix, formulaIdMap, deleteFormulaIdMap, r, c, cell) {
|
|
17424
|
-
|
|
17425
|
-
|
|
17426
|
-
|
|
17427
|
-
sheetFormulaDataMatrix.setValue(r, c, {
|
|
17428
|
-
f: formulaString,
|
|
17429
|
-
si: formulaId
|
|
17430
|
-
}), formulaIdMap.set(formulaId, { f: formulaString, r, c }), newSheetFormulaDataMatrix.setValue(r, c, {
|
|
17431
|
-
f: formulaString,
|
|
17432
|
-
si: formulaId
|
|
17433
|
-
});
|
|
17434
|
-
else if (checkFormulaString && !checkFormulaId)
|
|
17435
|
-
sheetFormulaDataMatrix.setValue(r, c, {
|
|
17436
|
-
f: formulaString
|
|
17437
|
-
}), newSheetFormulaDataMatrix.setValue(r, c, {
|
|
17438
|
-
f: formulaString
|
|
17439
|
-
});
|
|
17440
|
-
else if (!checkFormulaString && checkFormulaId)
|
|
17441
|
-
sheetFormulaDataMatrix.setValue(r, c, {
|
|
17442
|
-
f: "",
|
|
17443
|
-
si: formulaId
|
|
17444
|
-
});
|
|
17445
|
-
else if (!checkFormulaString && !checkFormulaId && sheetFormulaDataMatrix.getValue(r, c)) {
|
|
17446
|
-
const currentFormulaInfo = sheetFormulaDataMatrix.getValue(r, c), f = (currentFormulaInfo == null ? void 0 : currentFormulaInfo.f) || "", si = (currentFormulaInfo == null ? void 0 : currentFormulaInfo.si) || "";
|
|
18872
|
+
const formulaString = (cell == null ? void 0 : cell.f) || "", formulaId = (cell == null ? void 0 : cell.si) || "", checkFormulaString = isFormulaString(formulaString), checkFormulaId = isFormulaId(formulaId), currentFormulaInfo = sheetFormulaDataMatrix.getValue(r, c), f = (currentFormulaInfo == null ? void 0 : currentFormulaInfo.f) || "", si = (currentFormulaInfo == null ? void 0 : currentFormulaInfo.si) || "";
|
|
18873
|
+
function clearFormulaData() {
|
|
18874
|
+
var _a26;
|
|
17447
18875
|
if (isFormulaString(f) && isFormulaId(si)) {
|
|
17448
|
-
const updatedFormula = (
|
|
18876
|
+
const updatedFormula = (_a26 = formulaIdMap.get(si)) == null ? void 0 : _a26.f;
|
|
17449
18877
|
updatedFormula ? deleteFormulaIdMap.set(si, updatedFormula) : deleteFormulaIdMap.set(si, f);
|
|
17450
18878
|
}
|
|
17451
|
-
sheetFormulaDataMatrix.realDeleteValue(r, c), newSheetFormulaDataMatrix.setValue(r, c, null);
|
|
17452
18879
|
}
|
|
18880
|
+
__name(clearFormulaData, "clearFormulaData"), checkFormulaString && checkFormulaId ? (si !== formulaId && clearFormulaData(), sheetFormulaDataMatrix.setValue(r, c, {
|
|
18881
|
+
f: formulaString,
|
|
18882
|
+
si: formulaId
|
|
18883
|
+
}), formulaIdMap.set(formulaId, { f: formulaString, r, c }), newSheetFormulaDataMatrix.setValue(r, c, {
|
|
18884
|
+
f: formulaString,
|
|
18885
|
+
si: formulaId
|
|
18886
|
+
})) : checkFormulaString && !checkFormulaId ? (f !== formulaString && clearFormulaData(), sheetFormulaDataMatrix.setValue(r, c, {
|
|
18887
|
+
f: formulaString
|
|
18888
|
+
}), newSheetFormulaDataMatrix.setValue(r, c, {
|
|
18889
|
+
f: formulaString
|
|
18890
|
+
})) : !checkFormulaString && checkFormulaId ? (si !== formulaId && clearFormulaData(), sheetFormulaDataMatrix.setValue(r, c, {
|
|
18891
|
+
f: "",
|
|
18892
|
+
si: formulaId
|
|
18893
|
+
})) : !checkFormulaString && !checkFormulaId && sheetFormulaDataMatrix.getValue(r, c) && (clearFormulaData(), sheetFormulaDataMatrix.realDeleteValue(r, c), newSheetFormulaDataMatrix.setValue(r, c, null));
|
|
17453
18894
|
}
|
|
17454
18895
|
__name(updateFormulaDataByCellValue, "updateFormulaDataByCellValue");
|
|
17455
18896
|
function clearArrayFormulaCellDataByCell(arrayFormulaRangeMatrix, arrayFormulaCellDataMatrix, r, c) {
|
|
@@ -17466,8 +18907,8 @@ var __defProp$m = Object.defineProperty, __getOwnPropDesc$m = Object.getOwnPrope
|
|
|
17466
18907
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17467
18908
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
17468
18909
|
return kind && result && __defProp$m(target, key, result), result;
|
|
17469
|
-
}, "__decorateClass$m"), __decorateParam$m = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$m"),
|
|
17470
|
-
let FormulaDataModel = (
|
|
18910
|
+
}, "__decorateClass$m"), __decorateParam$m = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$m"), _a3;
|
|
18911
|
+
let FormulaDataModel = (_a3 = class extends Disposable {
|
|
17471
18912
|
constructor(_univerInstanceService, _lexerTreeBuilder) {
|
|
17472
18913
|
super();
|
|
17473
18914
|
__publicField(this, "_formulaData", {});
|
|
@@ -17475,22 +18916,25 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17475
18916
|
__publicField(this, "_arrayFormulaCellData", {});
|
|
17476
18917
|
this._univerInstanceService = _univerInstanceService, this._lexerTreeBuilder = _lexerTreeBuilder, this.initFormulaData();
|
|
17477
18918
|
}
|
|
18919
|
+
dispose() {
|
|
18920
|
+
super.dispose(), this._formulaData = {}, this._arrayFormulaRange = {}, this._arrayFormulaCellData = {};
|
|
18921
|
+
}
|
|
17478
18922
|
clearPreviousArrayFormulaCellData(clearArrayFormulaCellData) {
|
|
17479
18923
|
Object.keys(clearArrayFormulaCellData).forEach((unitId) => {
|
|
17480
18924
|
const clearSheetData = clearArrayFormulaCellData[unitId];
|
|
17481
18925
|
if (clearSheetData == null)
|
|
17482
18926
|
return !0;
|
|
17483
18927
|
Object.keys(clearSheetData).forEach((sheetId) => {
|
|
17484
|
-
var
|
|
17485
|
-
const clearCellMatrixData = clearSheetData[sheetId], rangeMatrix = (_b = (
|
|
18928
|
+
var _a26, _b, _c, _d;
|
|
18929
|
+
const clearCellMatrixData = clearSheetData[sheetId], rangeMatrix = (_b = (_a26 = this._arrayFormulaRange) == null ? void 0 : _a26[unitId]) == null ? void 0 : _b[sheetId];
|
|
17486
18930
|
if (rangeMatrix == null)
|
|
17487
18931
|
return !0;
|
|
17488
18932
|
let arrayFormulaCellMatrixData = new ObjectMatrix();
|
|
17489
18933
|
((_c = this._arrayFormulaCellData[unitId]) == null ? void 0 : _c[sheetId]) != null && (arrayFormulaCellMatrixData = new ObjectMatrix(
|
|
17490
18934
|
(_d = this._arrayFormulaCellData[unitId]) == null ? void 0 : _d[sheetId]
|
|
17491
18935
|
)), clearCellMatrixData.forValue((row, column) => {
|
|
17492
|
-
var
|
|
17493
|
-
const range = (
|
|
18936
|
+
var _a27;
|
|
18937
|
+
const range = (_a27 = rangeMatrix == null ? void 0 : rangeMatrix[row]) == null ? void 0 : _a27[column];
|
|
17494
18938
|
if (range == null)
|
|
17495
18939
|
return !0;
|
|
17496
18940
|
const { startRow, startColumn, endRow, endColumn } = range;
|
|
@@ -17507,8 +18951,8 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17507
18951
|
if (sheetData == null)
|
|
17508
18952
|
return !0;
|
|
17509
18953
|
this._arrayFormulaRange[unitId] == null && (this._arrayFormulaRange[unitId] = {}), this._arrayFormulaCellData[unitId] == null && (this._arrayFormulaCellData[unitId] = {}), Object.keys(sheetData).forEach((sheetId) => {
|
|
17510
|
-
var
|
|
17511
|
-
const cellMatrixData = sheetData[sheetId], arrayFormulaRangeMatrix = new ObjectMatrix((
|
|
18954
|
+
var _a26, _b;
|
|
18955
|
+
const cellMatrixData = sheetData[sheetId], arrayFormulaRangeMatrix = new ObjectMatrix((_a26 = this._arrayFormulaRange[unitId]) == null ? void 0 : _a26[sheetId]), arrayFormulaCellMatrixData = new ObjectMatrix((_b = this._arrayFormulaCellData[unitId]) == null ? void 0 : _b[sheetId]);
|
|
17512
18956
|
cellMatrixData.forValue((row, column) => {
|
|
17513
18957
|
const arrayFormulaRange = arrayFormulaRangeMatrix == null ? void 0 : arrayFormulaRangeMatrix.getValue(row, column);
|
|
17514
18958
|
if (arrayFormulaRange == null)
|
|
@@ -17547,8 +18991,8 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17547
18991
|
if (sheetData == null)
|
|
17548
18992
|
return !0;
|
|
17549
18993
|
this._arrayFormulaRange[unitId] || (this._arrayFormulaRange[unitId] = {}), Object.keys(sheetData).forEach((sheetId) => {
|
|
17550
|
-
var
|
|
17551
|
-
const arrayFormula = new ObjectMatrix(sheetData[sheetId]), rangeMatrix = new ObjectMatrix((
|
|
18994
|
+
var _a26;
|
|
18995
|
+
const arrayFormula = new ObjectMatrix(sheetData[sheetId]), rangeMatrix = new ObjectMatrix((_a26 = this._arrayFormulaRange[unitId]) == null ? void 0 : _a26[sheetId]);
|
|
17552
18996
|
arrayFormula.forValue((r, c, v) => {
|
|
17553
18997
|
rangeMatrix.setValue(r, c, v);
|
|
17554
18998
|
}), this._arrayFormulaRange[unitId] && (this._arrayFormulaRange[unitId][sheetId] = rangeMatrix.getData());
|
|
@@ -17564,12 +19008,12 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17564
19008
|
return;
|
|
17565
19009
|
}
|
|
17566
19010
|
this._formulaData[unitId] || (this._formulaData[unitId] = {}), Object.keys(sheetData).forEach((sheetId) => {
|
|
17567
|
-
var
|
|
19011
|
+
var _a26, _b;
|
|
17568
19012
|
const currentSheetData = sheetData[sheetId];
|
|
17569
19013
|
if (currentSheetData === void 0)
|
|
17570
19014
|
return;
|
|
17571
19015
|
if (currentSheetData === null) {
|
|
17572
|
-
(
|
|
19016
|
+
(_a26 = this._formulaData[unitId]) == null || delete _a26[sheetId];
|
|
17573
19017
|
return;
|
|
17574
19018
|
}
|
|
17575
19019
|
const sheetFormula = new ObjectMatrix(currentSheetData), formulaMatrix = new ObjectMatrix(((_b = this._formulaData[unitId]) == null ? void 0 : _b[sheetId]) || {});
|
|
@@ -17581,8 +19025,8 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17581
19025
|
});
|
|
17582
19026
|
}
|
|
17583
19027
|
deleteArrayFormulaRange(unitId, sheetId, row, column) {
|
|
17584
|
-
var
|
|
17585
|
-
const cellMatrixData = (
|
|
19028
|
+
var _a26;
|
|
19029
|
+
const cellMatrixData = (_a26 = this._arrayFormulaRange[unitId]) == null ? void 0 : _a26[sheetId];
|
|
17586
19030
|
if (cellMatrixData == null)
|
|
17587
19031
|
return;
|
|
17588
19032
|
const rangeMatrixData = new ObjectMatrix(cellMatrixData);
|
|
@@ -17664,8 +19108,8 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17664
19108
|
}), newSheetFormulaDataMatrix.clone();
|
|
17665
19109
|
}
|
|
17666
19110
|
updateArrayFormulaRange(unitId, sheetId, cellValue) {
|
|
17667
|
-
var
|
|
17668
|
-
const arrayFormulaRange = (
|
|
19111
|
+
var _a26;
|
|
19112
|
+
const arrayFormulaRange = (_a26 = this._arrayFormulaRange[unitId]) == null ? void 0 : _a26[sheetId];
|
|
17669
19113
|
if (!arrayFormulaRange) return;
|
|
17670
19114
|
const arrayFormulaRangeMatrix = new ObjectMatrix(arrayFormulaRange);
|
|
17671
19115
|
new ObjectMatrix(cellValue).forValue((r, c, cell) => {
|
|
@@ -17673,8 +19117,8 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17673
19117
|
});
|
|
17674
19118
|
}
|
|
17675
19119
|
updateArrayFormulaCellData(unitId, sheetId, cellValue) {
|
|
17676
|
-
var
|
|
17677
|
-
const arrayFormulaRange = (
|
|
19120
|
+
var _a26, _b;
|
|
19121
|
+
const arrayFormulaRange = (_a26 = this._arrayFormulaRange[unitId]) == null ? void 0 : _a26[sheetId];
|
|
17678
19122
|
if (!arrayFormulaRange) return;
|
|
17679
19123
|
const arrayFormulaRangeMatrix = new ObjectMatrix(arrayFormulaRange), arrayFormulaCellData = (_b = this._arrayFormulaCellData[unitId]) == null ? void 0 : _b[sheetId];
|
|
17680
19124
|
if (!arrayFormulaCellData) return;
|
|
@@ -17701,8 +19145,8 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17701
19145
|
}), formulaDataItem;
|
|
17702
19146
|
}
|
|
17703
19147
|
getFormulaDataItem(row, column, sheetId, unitId) {
|
|
17704
|
-
var
|
|
17705
|
-
return (_d = (_c = (_b = (
|
|
19148
|
+
var _a26, _b, _c, _d;
|
|
19149
|
+
return (_d = (_c = (_b = (_a26 = this._formulaData) == null ? void 0 : _a26[unitId]) == null ? void 0 : _b[sheetId]) == null ? void 0 : _c[row]) == null ? void 0 : _d[column];
|
|
17706
19150
|
}
|
|
17707
19151
|
getFormulaIdMap(unitId, sheetId) {
|
|
17708
19152
|
const formulaIdMap = /* @__PURE__ */ new Map(), formulaData = this._formulaData;
|
|
@@ -17741,7 +19185,7 @@ let FormulaDataModel = (_a2 = class extends Disposable {
|
|
|
17741
19185
|
}
|
|
17742
19186
|
return isFormulaString(f) ? f : null;
|
|
17743
19187
|
}
|
|
17744
|
-
}, __name(
|
|
19188
|
+
}, __name(_a3, "FormulaDataModel"), _a3);
|
|
17745
19189
|
FormulaDataModel = __decorateClass$m([
|
|
17746
19190
|
__decorateParam$m(0, IUniverInstanceService),
|
|
17747
19191
|
__decorateParam$m(1, Inject(LexerTreeBuilder))
|
|
@@ -17847,8 +19291,8 @@ const SetArrayFormulaDataMutation = {
|
|
|
17847
19291
|
this._definedNameMap[unitId] == null && (this._definedNameMap[unitId] = {}), this._definedNameMap[unitId][param.id] = param, this._update();
|
|
17848
19292
|
}
|
|
17849
19293
|
removeDefinedName(unitId, id) {
|
|
17850
|
-
var
|
|
17851
|
-
(
|
|
19294
|
+
var _a26;
|
|
19295
|
+
(_a26 = this._definedNameMap[unitId]) == null || delete _a26[id], this._update();
|
|
17852
19296
|
}
|
|
17853
19297
|
removeUnitDefinedName(unitId) {
|
|
17854
19298
|
delete this._definedNameMap[unitId], this._update();
|
|
@@ -17857,13 +19301,13 @@ const SetArrayFormulaDataMutation = {
|
|
|
17857
19301
|
return this._definedNameMap[unitId];
|
|
17858
19302
|
}
|
|
17859
19303
|
getValueByName(unitId, name) {
|
|
17860
|
-
var
|
|
19304
|
+
var _a26;
|
|
17861
19305
|
const nameMap = this._definedNameMap[unitId];
|
|
17862
|
-
return nameMap == null ? null : (
|
|
19306
|
+
return nameMap == null ? null : (_a26 = Array.from(Object.values(nameMap)).filter((value) => value.name === name)) == null ? void 0 : _a26[0];
|
|
17863
19307
|
}
|
|
17864
19308
|
getValueById(unitId, id) {
|
|
17865
|
-
var
|
|
17866
|
-
return (
|
|
19309
|
+
var _a26;
|
|
19310
|
+
return (_a26 = this._definedNameMap[unitId]) == null ? void 0 : _a26[id];
|
|
17867
19311
|
}
|
|
17868
19312
|
hasDefinedName(unitId) {
|
|
17869
19313
|
return this._definedNameMap[unitId] == null ? !1 : (Array.from(Object.values(this._definedNameMap[unitId])).length || 0) !== 0;
|
|
@@ -17879,8 +19323,8 @@ var __defProp$l = Object.defineProperty, __getOwnPropDesc$l = Object.getOwnPrope
|
|
|
17879
19323
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17880
19324
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
17881
19325
|
return kind && result && __defProp$l(target, key, result), result;
|
|
17882
|
-
}, "__decorateClass$l"), __decorateParam$l = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$l"),
|
|
17883
|
-
let FormulaCurrentConfigService = (
|
|
19326
|
+
}, "__decorateClass$l"), __decorateParam$l = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$l"), _a4;
|
|
19327
|
+
let FormulaCurrentConfigService = (_a4 = class extends Disposable {
|
|
17884
19328
|
constructor(_univerInstanceService) {
|
|
17885
19329
|
super();
|
|
17886
19330
|
__publicField(this, "_unitData", {});
|
|
@@ -18076,7 +19520,7 @@ let FormulaCurrentConfigService = (_a3 = class extends Disposable {
|
|
|
18076
19520
|
unitSheetNameMap
|
|
18077
19521
|
};
|
|
18078
19522
|
}
|
|
18079
|
-
}, __name(
|
|
19523
|
+
}, __name(_a4, "FormulaCurrentConfigService"), _a4);
|
|
18080
19524
|
FormulaCurrentConfigService = __decorateClass$l([
|
|
18081
19525
|
__decorateParam$l(0, IUniverInstanceService)
|
|
18082
19526
|
], FormulaCurrentConfigService);
|
|
@@ -18087,8 +19531,8 @@ var __defProp$k = Object.defineProperty, __getOwnPropDesc$k = Object.getOwnPrope
|
|
|
18087
19531
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
18088
19532
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
18089
19533
|
return kind && result && __defProp$k(target, key, result), result;
|
|
18090
|
-
}, "__decorateClass$k"), __decorateParam$k = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$k"),
|
|
18091
|
-
let Lexer = (
|
|
19534
|
+
}, "__decorateClass$k"), __decorateParam$k = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$k"), _a5;
|
|
19535
|
+
let Lexer = (_a5 = class extends Disposable {
|
|
18092
19536
|
constructor(_definedNamesService, _lexerTreeBuilder, _formulaCurrentConfigService) {
|
|
18093
19537
|
super(), this._definedNamesService = _definedNamesService, this._lexerTreeBuilder = _lexerTreeBuilder, this._formulaCurrentConfigService = _formulaCurrentConfigService;
|
|
18094
19538
|
}
|
|
@@ -18150,7 +19594,7 @@ let Lexer = (_a4 = class extends Disposable {
|
|
|
18150
19594
|
definedNames
|
|
18151
19595
|
};
|
|
18152
19596
|
}
|
|
18153
|
-
}, __name(
|
|
19597
|
+
}, __name(_a5, "Lexer"), _a5);
|
|
18154
19598
|
Lexer = __decorateClass$k([
|
|
18155
19599
|
__decorateParam$k(0, IDefinedNamesService),
|
|
18156
19600
|
__decorateParam$k(1, Inject(LexerTreeBuilder)),
|
|
@@ -18160,8 +19604,8 @@ var __defProp$j = Object.defineProperty, __getOwnPropDesc$j = Object.getOwnPrope
|
|
|
18160
19604
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
18161
19605
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
18162
19606
|
return kind && result && __defProp$j(target, key, result), result;
|
|
18163
|
-
}, "__decorateClass$j"), __decorateParam$j = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$j"), FormulaExecuteStageType = /* @__PURE__ */ ((FormulaExecuteStageType2) => (FormulaExecuteStageType2[FormulaExecuteStageType2.IDLE = 0] = "IDLE", FormulaExecuteStageType2[FormulaExecuteStageType2.START_DEPENDENCY = 1] = "START_DEPENDENCY", FormulaExecuteStageType2[FormulaExecuteStageType2.START_CALCULATION = 2] = "START_CALCULATION", FormulaExecuteStageType2[FormulaExecuteStageType2.CURRENTLY_CALCULATING = 3] = "CURRENTLY_CALCULATING", FormulaExecuteStageType2[FormulaExecuteStageType2.START_DEPENDENCY_ARRAY_FORMULA = 4] = "START_DEPENDENCY_ARRAY_FORMULA", FormulaExecuteStageType2[FormulaExecuteStageType2.START_CALCULATION_ARRAY_FORMULA = 5] = "START_CALCULATION_ARRAY_FORMULA", FormulaExecuteStageType2[FormulaExecuteStageType2.CURRENTLY_CALCULATING_ARRAY_FORMULA = 6] = "CURRENTLY_CALCULATING_ARRAY_FORMULA", FormulaExecuteStageType2[FormulaExecuteStageType2.CALCULATION_COMPLETED = 7] = "CALCULATION_COMPLETED", FormulaExecuteStageType2))(FormulaExecuteStageType || {}), FormulaExecutedStateType = /* @__PURE__ */ ((FormulaExecutedStateType2) => (FormulaExecutedStateType2[FormulaExecutedStateType2.INITIAL = 0] = "INITIAL", FormulaExecutedStateType2[FormulaExecutedStateType2.STOP_EXECUTION = 1] = "STOP_EXECUTION", FormulaExecutedStateType2[FormulaExecutedStateType2.NOT_EXECUTED = 2] = "NOT_EXECUTED", FormulaExecutedStateType2[FormulaExecutedStateType2.SUCCESS = 3] = "SUCCESS", FormulaExecutedStateType2))(FormulaExecutedStateType || {}),
|
|
18164
|
-
let FormulaRuntimeService = (
|
|
19607
|
+
}, "__decorateClass$j"), __decorateParam$j = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$j"), FormulaExecuteStageType = /* @__PURE__ */ ((FormulaExecuteStageType2) => (FormulaExecuteStageType2[FormulaExecuteStageType2.IDLE = 0] = "IDLE", FormulaExecuteStageType2[FormulaExecuteStageType2.START_DEPENDENCY = 1] = "START_DEPENDENCY", FormulaExecuteStageType2[FormulaExecuteStageType2.START_CALCULATION = 2] = "START_CALCULATION", FormulaExecuteStageType2[FormulaExecuteStageType2.CURRENTLY_CALCULATING = 3] = "CURRENTLY_CALCULATING", FormulaExecuteStageType2[FormulaExecuteStageType2.START_DEPENDENCY_ARRAY_FORMULA = 4] = "START_DEPENDENCY_ARRAY_FORMULA", FormulaExecuteStageType2[FormulaExecuteStageType2.START_CALCULATION_ARRAY_FORMULA = 5] = "START_CALCULATION_ARRAY_FORMULA", FormulaExecuteStageType2[FormulaExecuteStageType2.CURRENTLY_CALCULATING_ARRAY_FORMULA = 6] = "CURRENTLY_CALCULATING_ARRAY_FORMULA", FormulaExecuteStageType2[FormulaExecuteStageType2.CALCULATION_COMPLETED = 7] = "CALCULATION_COMPLETED", FormulaExecuteStageType2))(FormulaExecuteStageType || {}), FormulaExecutedStateType = /* @__PURE__ */ ((FormulaExecutedStateType2) => (FormulaExecutedStateType2[FormulaExecutedStateType2.INITIAL = 0] = "INITIAL", FormulaExecutedStateType2[FormulaExecutedStateType2.STOP_EXECUTION = 1] = "STOP_EXECUTION", FormulaExecutedStateType2[FormulaExecutedStateType2.NOT_EXECUTED = 2] = "NOT_EXECUTED", FormulaExecutedStateType2[FormulaExecutedStateType2.SUCCESS = 3] = "SUCCESS", FormulaExecutedStateType2))(FormulaExecutedStateType || {}), _a6;
|
|
19608
|
+
let FormulaRuntimeService = (_a6 = class extends Disposable {
|
|
18165
19609
|
constructor(_currentConfigService) {
|
|
18166
19610
|
super();
|
|
18167
19611
|
__publicField(this, "_formulaExecuteStage", 0);
|
|
@@ -18342,8 +19786,8 @@ let FormulaRuntimeService = (_a5 = class extends Disposable {
|
|
|
18342
19786
|
sheetData.setValue(row, column, errorObject), clearArrayUnitData.setValue(row, column, errorObject);
|
|
18343
19787
|
const unitData2 = this._currentConfigService.getUnitData();
|
|
18344
19788
|
objectValueRefOrArray.iterator((_, rowIndex, columnIndex) => {
|
|
18345
|
-
var
|
|
18346
|
-
const currentRow = rowIndex - startRow + row, currentColumn = columnIndex - startColumn + column, cell = (_b = (
|
|
19789
|
+
var _a26, _b;
|
|
19790
|
+
const currentRow = rowIndex - startRow + row, currentColumn = columnIndex - startColumn + column, cell = (_b = (_a26 = unitData2[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b.cellData.getValue(currentRow, currentColumn);
|
|
18347
19791
|
rowIndex === startRow && columnIndex === startColumn ? runtimeArrayUnitData.setValue(row, column, errorObject) : cell != null ? (cell.v == null && (cell.v = ""), runtimeArrayUnitData.setValue(currentRow, currentColumn, cell)) : runtimeArrayUnitData.setValue(currentRow, currentColumn, { v: "" });
|
|
18348
19792
|
});
|
|
18349
19793
|
} else {
|
|
@@ -18414,8 +19858,8 @@ let FormulaRuntimeService = (_a5 = class extends Disposable {
|
|
|
18414
19858
|
};
|
|
18415
19859
|
}
|
|
18416
19860
|
_checkIfArrayFormulaRangeHasData(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, arrayRange) {
|
|
18417
|
-
var
|
|
18418
|
-
const { startRow, startColumn, endRow, endColumn } = arrayRange, unitData = this._currentConfigService.getUnitData(), unitArrayFormulaRange = (_c = (_b = (
|
|
19861
|
+
var _a26, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
19862
|
+
const { startRow, startColumn, endRow, endColumn } = arrayRange, unitData = this._currentConfigService.getUnitData(), unitArrayFormulaRange = (_c = (_b = (_a26 = this._unitArrayFormulaRange[formulaUnitId]) == null ? void 0 : _a26[formulaSheetId]) == null ? void 0 : _b[formulaRow]) == null ? void 0 : _c[formulaColumn];
|
|
18419
19863
|
for (let r = startRow; r <= endRow; r++)
|
|
18420
19864
|
for (let c = startColumn; c <= endColumn; c++) {
|
|
18421
19865
|
if (r === formulaRow && formulaColumn === c)
|
|
@@ -18445,7 +19889,7 @@ let FormulaRuntimeService = (_a5 = class extends Disposable {
|
|
|
18445
19889
|
const dirtyRanges = this._currentConfigService.getDirtyRanges();
|
|
18446
19890
|
return dirtyRanges.length === 0 ? !0 : isInDirtyRange(dirtyRanges, unitId, sheetId, row, column);
|
|
18447
19891
|
}
|
|
18448
|
-
}, __name(
|
|
19892
|
+
}, __name(_a6, "FormulaRuntimeService"), _a6);
|
|
18449
19893
|
FormulaRuntimeService = __decorateClass$j([
|
|
18450
19894
|
__decorateParam$j(0, IFormulaCurrentConfigService)
|
|
18451
19895
|
], FormulaRuntimeService);
|
|
@@ -18477,10 +19921,10 @@ const NODE_ORDER_MAP = /* @__PURE__ */ new Map([
|
|
|
18477
19921
|
this._token = _token;
|
|
18478
19922
|
}
|
|
18479
19923
|
dispose() {
|
|
18480
|
-
var
|
|
19924
|
+
var _a26;
|
|
18481
19925
|
this._children.forEach((node) => {
|
|
18482
19926
|
node.dispose();
|
|
18483
|
-
}), (
|
|
19927
|
+
}), (_a26 = this._valueObject) == null || _a26.dispose(), this._parent = null;
|
|
18484
19928
|
}
|
|
18485
19929
|
get nodeType() {
|
|
18486
19930
|
return NodeType.BASE;
|
|
@@ -18712,8 +20156,8 @@ const _PrefixNode = class _PrefixNode extends BaseAstNode {
|
|
|
18712
20156
|
};
|
|
18713
20157
|
__name(_PrefixNode, "PrefixNode");
|
|
18714
20158
|
let PrefixNode = _PrefixNode;
|
|
18715
|
-
var
|
|
18716
|
-
let PrefixNodeFactory = (
|
|
20159
|
+
var _a7;
|
|
20160
|
+
let PrefixNodeFactory = (_a7 = class extends BaseAstNodeFactory {
|
|
18717
20161
|
constructor(_functionService, _injector) {
|
|
18718
20162
|
super(), this._functionService = _functionService, this._injector = _injector;
|
|
18719
20163
|
}
|
|
@@ -18733,7 +20177,7 @@ let PrefixNodeFactory = (_a6 = class extends BaseAstNodeFactory {
|
|
|
18733
20177
|
const functionExecutor = this._functionService.getExecutor(functionName);
|
|
18734
20178
|
return functionExecutor ? new PrefixNode(this._injector, tokenTrim, functionExecutor) : (console.error(`No function ${token}`), ErrorNode.create(ErrorType$1.NAME));
|
|
18735
20179
|
}
|
|
18736
|
-
}, __name(
|
|
20180
|
+
}, __name(_a7, "PrefixNodeFactory"), _a7);
|
|
18737
20181
|
PrefixNodeFactory = __decorateClass$i([
|
|
18738
20182
|
__decorateParam$i(0, IFunctionService),
|
|
18739
20183
|
__decorateParam$i(1, Inject(Injector))
|
|
@@ -18806,7 +20250,7 @@ const _FunctionNode = class _FunctionNode extends BaseAstNode {
|
|
|
18806
20250
|
lookupCountRow !== resultCountRow && (resultVectorRange.endRow += lookupCountRow - resultCountRow), lookupCountColumn !== resultCountColumn && (resultVectorRange.endColumn += lookupCountColumn - resultCountColumn);
|
|
18807
20251
|
}
|
|
18808
20252
|
_calculate(variants) {
|
|
18809
|
-
var
|
|
20253
|
+
var _a26;
|
|
18810
20254
|
const { minParams, maxParams } = this._functionExecutor;
|
|
18811
20255
|
if (minParams !== -1 && maxParams !== -1 && (variants.length < minParams || variants.length > maxParams))
|
|
18812
20256
|
return ErrorValueObject.create(ErrorType$1.NA);
|
|
@@ -18822,7 +20266,7 @@ const _FunctionNode = class _FunctionNode extends BaseAstNode {
|
|
|
18822
20266
|
resultVariant = ArrayValueObject.create({
|
|
18823
20267
|
calculateValueList: arrayValues,
|
|
18824
20268
|
rowCount: arrayValues.length,
|
|
18825
|
-
columnCount: ((
|
|
20269
|
+
columnCount: ((_a26 = arrayValues[0]) == null ? void 0 : _a26.length) || 0,
|
|
18826
20270
|
unitId: "",
|
|
18827
20271
|
sheetId: "",
|
|
18828
20272
|
row: -1,
|
|
@@ -18853,8 +20297,8 @@ const _FunctionNode = class _FunctionNode extends BaseAstNode {
|
|
|
18853
20297
|
};
|
|
18854
20298
|
__name(_FunctionNode, "FunctionNode");
|
|
18855
20299
|
let FunctionNode = _FunctionNode;
|
|
18856
|
-
var
|
|
18857
|
-
let FunctionNodeFactory = (
|
|
20300
|
+
var _a8;
|
|
20301
|
+
let FunctionNodeFactory = (_a8 = class extends BaseAstNodeFactory {
|
|
18858
20302
|
constructor(_functionService, _currentConfigService, _runtimeService, _definedNamesService, _injector) {
|
|
18859
20303
|
super(), this._functionService = _functionService, this._currentConfigService = _currentConfigService, this._runtimeService = _runtimeService, this._definedNamesService = _definedNamesService, this._injector = _injector;
|
|
18860
20304
|
}
|
|
@@ -18878,10 +20322,10 @@ let FunctionNodeFactory = (_a7 = class extends BaseAstNodeFactory {
|
|
|
18878
20322
|
}
|
|
18879
20323
|
}
|
|
18880
20324
|
_isParentUnionNode(param) {
|
|
18881
|
-
var
|
|
18882
|
-
return ((_b = (
|
|
20325
|
+
var _a26, _b;
|
|
20326
|
+
return ((_b = (_a26 = param.getParent()) == null ? void 0 : _a26.getParent()) == null ? void 0 : _b.getToken()) === matchToken.COLON;
|
|
18883
20327
|
}
|
|
18884
|
-
}, __name(
|
|
20328
|
+
}, __name(_a8, "FunctionNodeFactory"), _a8);
|
|
18885
20329
|
FunctionNodeFactory = __decorateClass$h([
|
|
18886
20330
|
__decorateParam$h(0, IFunctionService),
|
|
18887
20331
|
__decorateParam$h(1, IFormulaCurrentConfigService),
|
|
@@ -18893,8 +20337,8 @@ var __defProp$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPrope
|
|
|
18893
20337
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
18894
20338
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
18895
20339
|
return kind && result && __defProp$g(target, key, result), result;
|
|
18896
|
-
}, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g"),
|
|
18897
|
-
let Interpreter = (
|
|
20340
|
+
}, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g"), _a9;
|
|
20341
|
+
let Interpreter = (_a9 = class extends Disposable {
|
|
18898
20342
|
constructor(_runtimeService) {
|
|
18899
20343
|
super(), this._runtimeService = _runtimeService;
|
|
18900
20344
|
}
|
|
@@ -18962,7 +20406,7 @@ let Interpreter = (_a8 = class extends Disposable {
|
|
|
18962
20406
|
}
|
|
18963
20407
|
return node.execute(), AstNodePromiseType.SUCCESS;
|
|
18964
20408
|
}
|
|
18965
|
-
}, __name(
|
|
20409
|
+
}, __name(_a9, "Interpreter"), _a9);
|
|
18966
20410
|
Interpreter = __decorateClass$g([
|
|
18967
20411
|
__decorateParam$g(0, IFormulaRuntimeService)
|
|
18968
20412
|
], Interpreter);
|
|
@@ -19035,6 +20479,9 @@ const _LambdaValueObjectObject = class _LambdaValueObjectObject extends BaseValu
|
|
|
19035
20479
|
this._lambdaPrivacyValueMap.set(key, variant);
|
|
19036
20480
|
}
|
|
19037
20481
|
}
|
|
20482
|
+
getLambdaPrivacyVarKeys() {
|
|
20483
|
+
return this._lambdaPrivacyVarKeys;
|
|
20484
|
+
}
|
|
19038
20485
|
};
|
|
19039
20486
|
__name(_LambdaValueObjectObject, "LambdaValueObjectObject");
|
|
19040
20487
|
let LambdaValueObjectObject = _LambdaValueObjectObject;
|
|
@@ -19085,8 +20532,8 @@ const _LambdaNode = class _LambdaNode extends BaseAstNode {
|
|
|
19085
20532
|
};
|
|
19086
20533
|
__name(_LambdaNode, "LambdaNode");
|
|
19087
20534
|
let LambdaNode = _LambdaNode;
|
|
19088
|
-
var
|
|
19089
|
-
let LambdaNodeFactory = (
|
|
20535
|
+
var _a10;
|
|
20536
|
+
let LambdaNodeFactory = (_a10 = class extends BaseAstNodeFactory {
|
|
19090
20537
|
constructor(_runtimeService, _interpreter) {
|
|
19091
20538
|
super(), this._runtimeService = _runtimeService, this._interpreter = _interpreter;
|
|
19092
20539
|
}
|
|
@@ -19139,7 +20586,7 @@ let LambdaNodeFactory = (_a9 = class extends BaseAstNodeFactory {
|
|
|
19139
20586
|
}
|
|
19140
20587
|
}
|
|
19141
20588
|
}
|
|
19142
|
-
}, __name(
|
|
20589
|
+
}, __name(_a10, "LambdaNodeFactory"), _a10);
|
|
19143
20590
|
LambdaNodeFactory = __decorateClass$f([
|
|
19144
20591
|
__decorateParam$f(0, IFormulaRuntimeService),
|
|
19145
20592
|
__decorateParam$f(1, Inject(Interpreter))
|
|
@@ -19220,10 +20667,10 @@ const _OperatorNode = class _OperatorNode extends BaseAstNode {
|
|
|
19220
20667
|
return NodeType.OPERATOR;
|
|
19221
20668
|
}
|
|
19222
20669
|
execute() {
|
|
19223
|
-
var
|
|
20670
|
+
var _a26, _b;
|
|
19224
20671
|
const children = this.getChildren();
|
|
19225
20672
|
this._functionExecutor.name === FUNCTION_NAMES_META.COMPARE && this._functionExecutor.setCompareType(this.getToken());
|
|
19226
|
-
let object1 = (
|
|
20673
|
+
let object1 = (_a26 = children[0]) == null ? void 0 : _a26.getValue(), object2 = (_b = children[1]) == null ? void 0 : _b.getValue();
|
|
19227
20674
|
const token = this.getToken();
|
|
19228
20675
|
if ((object1 == null || object2 == null) && token !== operatorToken.MINUS && token !== operatorToken.PLUS) {
|
|
19229
20676
|
this.setValue(ErrorValueObject.create(ErrorType$1.VALUE));
|
|
@@ -19239,8 +20686,8 @@ const _OperatorNode = class _OperatorNode extends BaseAstNode {
|
|
|
19239
20686
|
};
|
|
19240
20687
|
__name(_OperatorNode, "OperatorNode");
|
|
19241
20688
|
let OperatorNode = _OperatorNode;
|
|
19242
|
-
var
|
|
19243
|
-
let OperatorNodeFactory = (
|
|
20689
|
+
var _a11;
|
|
20690
|
+
let OperatorNodeFactory = (_a11 = class extends BaseAstNodeFactory {
|
|
19244
20691
|
constructor(_functionService) {
|
|
19245
20692
|
super(), this._functionService = _functionService;
|
|
19246
20693
|
}
|
|
@@ -19261,7 +20708,7 @@ let OperatorNodeFactory = (_a10 = class extends BaseAstNodeFactory {
|
|
|
19261
20708
|
if (!(tokenTrim.charAt(0) === '"' && tokenTrim.charAt(tokenTrim.length - 1) === '"') && OPERATOR_TOKEN_SET.has(tokenTrim))
|
|
19262
20709
|
return this.create(tokenTrim);
|
|
19263
20710
|
}
|
|
19264
|
-
}, __name(
|
|
20711
|
+
}, __name(_a11, "OperatorNodeFactory"), _a11);
|
|
19265
20712
|
OperatorNodeFactory = __decorateClass$e([
|
|
19266
20713
|
__decorateParam$e(0, IFunctionService)
|
|
19267
20714
|
], OperatorNodeFactory);
|
|
@@ -19277,8 +20724,8 @@ const _SuperTableService = class _SuperTableService extends Disposable {
|
|
|
19277
20724
|
this._tableMap.clear(), this._tableOptionMap.clear();
|
|
19278
20725
|
}
|
|
19279
20726
|
remove(unitId, tableName) {
|
|
19280
|
-
var
|
|
19281
|
-
(
|
|
20727
|
+
var _a26;
|
|
20728
|
+
(_a26 = this._tableMap.get(unitId)) == null || _a26.delete(tableName);
|
|
19282
20729
|
}
|
|
19283
20730
|
getTableMap(unitId) {
|
|
19284
20731
|
return this._tableMap.get(unitId);
|
|
@@ -19287,8 +20734,8 @@ const _SuperTableService = class _SuperTableService extends Disposable {
|
|
|
19287
20734
|
return this._tableOptionMap;
|
|
19288
20735
|
}
|
|
19289
20736
|
registerTable(unitId, tableName, reference) {
|
|
19290
|
-
var
|
|
19291
|
-
this._tableMap.get(unitId) == null && this._tableMap.set(unitId, /* @__PURE__ */ new Map()), (
|
|
20737
|
+
var _a26;
|
|
20738
|
+
this._tableMap.get(unitId) == null && this._tableMap.set(unitId, /* @__PURE__ */ new Map()), (_a26 = this._tableMap.get(unitId)) == null || _a26.set(tableName, reference);
|
|
19292
20739
|
}
|
|
19293
20740
|
registerTableOptionMap(tableOption, tableOptionType) {
|
|
19294
20741
|
this._tableOptionMap.set(tableOption, tableOptionType);
|
|
@@ -19332,12 +20779,12 @@ const ISuperTableService = createIdentifier("univer.formula.super-table.service"
|
|
|
19332
20779
|
};
|
|
19333
20780
|
}
|
|
19334
20781
|
_columnHandler(rightString, titleMap, isSingle = !1) {
|
|
19335
|
-
var
|
|
20782
|
+
var _a26, _b, _c;
|
|
19336
20783
|
let startColumn = -1, endColumn = -1;
|
|
19337
20784
|
const colonIndex = rightString.indexOf(matchToken.COLON);
|
|
19338
20785
|
if (new RegExp($SUPER_TABLE_COLUMN_REGEX, "g").test(rightString)) {
|
|
19339
20786
|
const startColumnString = rightString.substring(0, colonIndex).substring(1, -1), endColumnString = rightString.substring(colonIndex + 1).substring(1, -1);
|
|
19340
|
-
startColumn = (
|
|
20787
|
+
startColumn = (_a26 = titleMap.get(startColumnString)) != null ? _a26 : -1, endColumn = (_b = titleMap.get(endColumnString)) != null ? _b : -1;
|
|
19341
20788
|
} else
|
|
19342
20789
|
isSingle && (rightString = rightString.substring(1, -1)), startColumn = (_c = titleMap.get(rightString)) != null ? _c : -1, endColumn = startColumn;
|
|
19343
20790
|
return {
|
|
@@ -19369,8 +20816,8 @@ const _ReferenceNode = class _ReferenceNode extends BaseAstNode {
|
|
|
19369
20816
|
};
|
|
19370
20817
|
__name(_ReferenceNode, "ReferenceNode");
|
|
19371
20818
|
let ReferenceNode = _ReferenceNode;
|
|
19372
|
-
var
|
|
19373
|
-
let ReferenceNodeFactory = (
|
|
20819
|
+
var _a12;
|
|
20820
|
+
let ReferenceNodeFactory = (_a12 = class extends BaseAstNodeFactory {
|
|
19374
20821
|
constructor(_superTableService, _formulaRuntimeService, _functionService, _injector) {
|
|
19375
20822
|
super(), this._superTableService = _superTableService, this._formulaRuntimeService = _formulaRuntimeService, this._functionService = _functionService, this._injector = _injector;
|
|
19376
20823
|
}
|
|
@@ -19378,9 +20825,9 @@ let ReferenceNodeFactory = (_a11 = class extends BaseAstNodeFactory {
|
|
|
19378
20825
|
return NODE_ORDER_MAP.get(NodeType.REFERENCE) || DEFAULT_AST_NODE_FACTORY_Z_INDEX;
|
|
19379
20826
|
}
|
|
19380
20827
|
checkAndCreateNodeType(param) {
|
|
19381
|
-
var
|
|
20828
|
+
var _a26, _b;
|
|
19382
20829
|
let isLexerNode = !1, tokenTrimPre, isPrepareMerge = !1;
|
|
19383
|
-
param instanceof LexerNode ? (isLexerNode = !0, tokenTrimPre = param.getToken().trim(), ((_b = (
|
|
20830
|
+
param instanceof LexerNode ? (isLexerNode = !0, tokenTrimPre = param.getToken().trim(), ((_b = (_a26 = param.getParent()) == null ? void 0 : _a26.getParent()) == null ? void 0 : _b.getToken().trim()) === matchToken.COLON && (isPrepareMerge = !0)) : tokenTrimPre = param.trim();
|
|
19384
20831
|
const { tokenTrim, minusPrefixNode, atPrefixNode } = prefixHandler(tokenTrimPre, this._functionService, this._injector);
|
|
19385
20832
|
if (!isLexerNode && tokenTrim.charAt(0) === '"' && tokenTrim.charAt(tokenTrim.length - 1) === '"')
|
|
19386
20833
|
return;
|
|
@@ -19407,10 +20854,10 @@ let ReferenceNodeFactory = (_a11 = class extends BaseAstNodeFactory {
|
|
|
19407
20854
|
return atPrefixNode ? node.setParent(atPrefixNode) : minusPrefixNode && node.setParent(minusPrefixNode), node;
|
|
19408
20855
|
}
|
|
19409
20856
|
_checkParentIsUnionOperator(param) {
|
|
19410
|
-
var
|
|
19411
|
-
return ((_b = (
|
|
20857
|
+
var _a26, _b;
|
|
20858
|
+
return ((_b = (_a26 = param.getParent()) == null ? void 0 : _a26.getParent()) == null ? void 0 : _b.getToken().trim()) === matchToken.COLON;
|
|
19412
20859
|
}
|
|
19413
|
-
}, __name(
|
|
20860
|
+
}, __name(_a12, "ReferenceNodeFactory"), _a12);
|
|
19414
20861
|
ReferenceNodeFactory = __decorateClass$d([
|
|
19415
20862
|
__decorateParam$d(0, ISuperTableService),
|
|
19416
20863
|
__decorateParam$d(1, IFormulaRuntimeService),
|
|
@@ -19445,17 +20892,17 @@ const _SuffixNode = class _SuffixNode extends BaseAstNode {
|
|
|
19445
20892
|
this.setValue(result);
|
|
19446
20893
|
}
|
|
19447
20894
|
_handlerPound(value) {
|
|
19448
|
-
var
|
|
20895
|
+
var _a26, _b, _c, _d;
|
|
19449
20896
|
if (!value.isReferenceObject() || !value.isCell())
|
|
19450
20897
|
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
19451
|
-
const currentConfigService = this._accessor.get(IFormulaCurrentConfigService), lexer = this._accessor.get(Lexer), cellValue = value, range = cellValue.getRangePosition(), unitId = cellValue.getUnitId(), sheetId = cellValue.getSheetId(), formulaData = currentConfigService.getFormulaData(), formulaString = (_d = (_c = (_b = (
|
|
20898
|
+
const currentConfigService = this._accessor.get(IFormulaCurrentConfigService), lexer = this._accessor.get(Lexer), cellValue = value, range = cellValue.getRangePosition(), unitId = cellValue.getUnitId(), sheetId = cellValue.getSheetId(), formulaData = currentConfigService.getFormulaData(), formulaString = (_d = (_c = (_b = (_a26 = formulaData == null ? void 0 : formulaData[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b[range.startRow]) == null ? void 0 : _c[range.startColumn]) == null ? void 0 : _d.f;
|
|
19452
20899
|
return formulaString && lexer.treeBuilder(formulaString), ErrorValueObject.create(ErrorType$1.VALUE);
|
|
19453
20900
|
}
|
|
19454
20901
|
};
|
|
19455
20902
|
__name(_SuffixNode, "SuffixNode");
|
|
19456
20903
|
let SuffixNode = _SuffixNode;
|
|
19457
|
-
var
|
|
19458
|
-
let SuffixNodeFactory = (
|
|
20904
|
+
var _a13;
|
|
20905
|
+
let SuffixNodeFactory = (_a13 = class extends BaseAstNodeFactory {
|
|
19459
20906
|
constructor(_functionService, _injector) {
|
|
19460
20907
|
super(), this._functionService = _functionService, this._injector = _injector;
|
|
19461
20908
|
}
|
|
@@ -19475,7 +20922,7 @@ let SuffixNodeFactory = (_a12 = class extends BaseAstNodeFactory {
|
|
|
19475
20922
|
const functionExecutor = this._functionService.getExecutor(functionName);
|
|
19476
20923
|
return functionExecutor ? new SuffixNode(this._injector, tokenTrim, functionExecutor) : (console.error(`No function ${param}`), ErrorNode.create(ErrorType$1.NAME));
|
|
19477
20924
|
}
|
|
19478
|
-
}, __name(
|
|
20925
|
+
}, __name(_a13, "SuffixNodeFactory"), _a13);
|
|
19479
20926
|
SuffixNodeFactory = __decorateClass$c([
|
|
19480
20927
|
__decorateParam$c(0, IFunctionService),
|
|
19481
20928
|
__decorateParam$c(1, Inject(Injector))
|
|
@@ -19505,8 +20952,8 @@ const _UnionNode = class _UnionNode extends BaseAstNode {
|
|
|
19505
20952
|
};
|
|
19506
20953
|
__name(_UnionNode, "UnionNode");
|
|
19507
20954
|
let UnionNode = _UnionNode;
|
|
19508
|
-
var
|
|
19509
|
-
let UnionNodeFactory = (
|
|
20955
|
+
var _a14;
|
|
20956
|
+
let UnionNodeFactory = (_a14 = class extends BaseAstNodeFactory {
|
|
19510
20957
|
constructor(_functionService) {
|
|
19511
20958
|
super(), this._functionService = _functionService;
|
|
19512
20959
|
}
|
|
@@ -19523,7 +20970,7 @@ let UnionNodeFactory = (_a13 = class extends BaseAstNodeFactory {
|
|
|
19523
20970
|
if (!(tokenTrim.charAt(0) === '"' && tokenTrim.charAt(tokenTrim.length - 1) === '"') && tokenTrim === matchToken.COLON)
|
|
19524
20971
|
return this.create(tokenTrim);
|
|
19525
20972
|
}
|
|
19526
|
-
}, __name(
|
|
20973
|
+
}, __name(_a14, "UnionNodeFactory"), _a14);
|
|
19527
20974
|
UnionNodeFactory = __decorateClass$b([
|
|
19528
20975
|
__decorateParam$b(0, IFunctionService)
|
|
19529
20976
|
], UnionNodeFactory);
|
|
@@ -19580,8 +21027,8 @@ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPrope
|
|
|
19580
21027
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19581
21028
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
19582
21029
|
return kind && result && __defProp$a(target, key, result), result;
|
|
19583
|
-
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"),
|
|
19584
|
-
let AstTreeBuilder = (
|
|
21030
|
+
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"), _a15;
|
|
21031
|
+
let AstTreeBuilder = (_a15 = class extends Disposable {
|
|
19585
21032
|
constructor(_runtimeService, _astRootNodeFactory, _functionNodeFactory, _lambdaNodeFactory, _lambdaParameterNodeFactory, _operatorNodeFactory, _prefixNodeFactory, _referenceNodeFactory, _suffixNodeFactory, _unionNodeFactory, _valueNodeFactory) {
|
|
19586
21033
|
super();
|
|
19587
21034
|
__publicField(this, "_astNodeFactoryList", []);
|
|
@@ -19741,7 +21188,7 @@ let AstTreeBuilder = (_a14 = class extends Disposable {
|
|
|
19741
21188
|
this._valueNodeFactory
|
|
19742
21189
|
].sort(sortRules);
|
|
19743
21190
|
}
|
|
19744
|
-
}, __name(
|
|
21191
|
+
}, __name(_a15, "AstTreeBuilder"), _a15);
|
|
19745
21192
|
AstTreeBuilder = __decorateClass$a([
|
|
19746
21193
|
__decorateParam$a(0, IFormulaRuntimeService),
|
|
19747
21194
|
__decorateParam$a(1, Inject(AstRootNodeFactory)),
|
|
@@ -19768,8 +21215,8 @@ const _FeatureCalculationManagerService = class _FeatureCalculationManagerServic
|
|
|
19768
21215
|
}
|
|
19769
21216
|
remove(unitId, subUnitId, featureIds) {
|
|
19770
21217
|
featureIds.forEach((featureId) => {
|
|
19771
|
-
var
|
|
19772
|
-
(_b = (
|
|
21218
|
+
var _a26, _b;
|
|
21219
|
+
(_b = (_a26 = this._referenceExecutorMap.get(unitId)) == null ? void 0 : _a26.get(subUnitId)) == null || _b.delete(featureId);
|
|
19773
21220
|
}), this._onChanged$.next({
|
|
19774
21221
|
unitId,
|
|
19775
21222
|
subUnitId,
|
|
@@ -19777,12 +21224,12 @@ const _FeatureCalculationManagerService = class _FeatureCalculationManagerServic
|
|
|
19777
21224
|
});
|
|
19778
21225
|
}
|
|
19779
21226
|
get(unitId, subUnitId, featureId) {
|
|
19780
|
-
var
|
|
19781
|
-
return (_b = (
|
|
21227
|
+
var _a26, _b;
|
|
21228
|
+
return (_b = (_a26 = this._referenceExecutorMap.get(unitId)) == null ? void 0 : _a26.get(subUnitId)) == null ? void 0 : _b.get(featureId);
|
|
19782
21229
|
}
|
|
19783
21230
|
has(unitId, subUnitId, featureId) {
|
|
19784
|
-
var
|
|
19785
|
-
return !!((_b = (
|
|
21231
|
+
var _a26, _b;
|
|
21232
|
+
return !!((_b = (_a26 = this._referenceExecutorMap.get(unitId)) == null ? void 0 : _a26.get(subUnitId)) != null && _b.has(featureId));
|
|
19786
21233
|
}
|
|
19787
21234
|
register(unitId, subUnitId, featureId, referenceExecutor) {
|
|
19788
21235
|
let unitMap = this._referenceExecutorMap.get(unitId);
|
|
@@ -19811,19 +21258,19 @@ const IFeatureCalculationManagerService = createIdentifier(
|
|
|
19811
21258
|
this._otherFormulaData = {};
|
|
19812
21259
|
}
|
|
19813
21260
|
remove(searchParam) {
|
|
19814
|
-
var
|
|
21261
|
+
var _a26, _b, _c;
|
|
19815
21262
|
const { unitId, subUnitId, formulaId } = searchParam;
|
|
19816
|
-
(_c = (_b = (
|
|
21263
|
+
(_c = (_b = (_a26 = this._otherFormulaData) == null ? void 0 : _a26[unitId]) == null ? void 0 : _b[subUnitId]) == null || delete _c[formulaId];
|
|
19817
21264
|
}
|
|
19818
21265
|
get(searchParam) {
|
|
19819
|
-
var
|
|
21266
|
+
var _a26, _b;
|
|
19820
21267
|
const { unitId, subUnitId, formulaId } = searchParam;
|
|
19821
|
-
return (_b = (
|
|
21268
|
+
return (_b = (_a26 = this._otherFormulaData[unitId]) == null ? void 0 : _a26[subUnitId]) == null ? void 0 : _b[formulaId];
|
|
19822
21269
|
}
|
|
19823
21270
|
has(searchParam) {
|
|
19824
|
-
var
|
|
21271
|
+
var _a26, _b;
|
|
19825
21272
|
const { unitId, subUnitId, formulaId } = searchParam;
|
|
19826
|
-
return ((_b = (
|
|
21273
|
+
return ((_b = (_a26 = this._otherFormulaData[unitId]) == null ? void 0 : _a26[subUnitId]) == null ? void 0 : _b[formulaId]) != null;
|
|
19827
21274
|
}
|
|
19828
21275
|
register(insertParam) {
|
|
19829
21276
|
const { unitId, subUnitId, formulaId, item } = insertParam;
|
|
@@ -19908,8 +21355,8 @@ const IOtherFormulaManagerService = createIdentifier(
|
|
|
19908
21355
|
return this._id;
|
|
19909
21356
|
}
|
|
19910
21357
|
dispose() {
|
|
19911
|
-
var
|
|
19912
|
-
super.dispose(), this.children = [], this.rangeList = [], this.parents = [], (
|
|
21358
|
+
var _a26;
|
|
21359
|
+
super.dispose(), this.children = [], this.rangeList = [], this.parents = [], (_a26 = this.node) == null || _a26.dispose();
|
|
19913
21360
|
}
|
|
19914
21361
|
disposeWithChildren() {
|
|
19915
21362
|
this.children.forEach((tree) => {
|
|
@@ -19941,12 +21388,12 @@ const IOtherFormulaManagerService = createIdentifier(
|
|
|
19941
21388
|
* @param dependencyRangeList
|
|
19942
21389
|
*/
|
|
19943
21390
|
dependencyRange(dependencyRangeList, dirtyUnitSheetNameMap, unitExcludedCell) {
|
|
19944
|
-
var
|
|
21391
|
+
var _a26, _b;
|
|
19945
21392
|
if (this.rangeList.length === 0)
|
|
19946
21393
|
return !1;
|
|
19947
21394
|
for (let r = 0, len = this.rangeList.length; r < len; r++) {
|
|
19948
21395
|
const unitRange = this.rangeList[r], { unitId, sheetId, range } = unitRange.gridRange;
|
|
19949
|
-
if (((
|
|
21396
|
+
if (((_a26 = dirtyUnitSheetNameMap[unitId]) == null ? void 0 : _a26[sheetId]) != null)
|
|
19950
21397
|
return !0;
|
|
19951
21398
|
if (!dependencyRangeList.has(unitId))
|
|
19952
21399
|
continue;
|
|
@@ -20077,12 +21524,14 @@ const _FormulaDependencyTreeCache = class _FormulaDependencyTreeCache extends Di
|
|
|
20077
21524
|
}
|
|
20078
21525
|
getDependencyId(dependenceTree, ids) {
|
|
20079
21526
|
const parentIdList = this._parentIdMap.get(dependenceTree.id);
|
|
20080
|
-
if (parentIdList)
|
|
20081
|
-
|
|
21527
|
+
if (parentIdList) {
|
|
21528
|
+
const list = [...parentIdList];
|
|
21529
|
+
for (const parentId of list) {
|
|
20082
21530
|
ids.add(parentId);
|
|
20083
21531
|
const tree = this._dependencyMap.get(parentId);
|
|
20084
|
-
tree && this.getDependencyId(tree, ids);
|
|
21532
|
+
tree && parentId !== dependenceTree.id && this.getDependencyId(tree, ids);
|
|
20085
21533
|
}
|
|
21534
|
+
}
|
|
20086
21535
|
}
|
|
20087
21536
|
/**
|
|
20088
21537
|
* Determine whether range is dependent on other trees.
|
|
@@ -20222,12 +21671,12 @@ const _DependencyManagerService = class _DependencyManagerService extends Dispos
|
|
|
20222
21671
|
});
|
|
20223
21672
|
}
|
|
20224
21673
|
getOtherFormulaDependency(unitId, sheetId, formulaId) {
|
|
20225
|
-
var
|
|
20226
|
-
return (_b = (
|
|
21674
|
+
var _a26, _b;
|
|
21675
|
+
return (_b = (_a26 = this._otherFormulaData[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b[formulaId];
|
|
20227
21676
|
}
|
|
20228
21677
|
hasOtherFormulaDependency(unitId, sheetId, formulaId) {
|
|
20229
|
-
var
|
|
20230
|
-
return ((_b = (
|
|
21678
|
+
var _a26, _b;
|
|
21679
|
+
return ((_b = (_a26 = this._otherFormulaData[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b[formulaId]) != null;
|
|
20231
21680
|
}
|
|
20232
21681
|
addFeatureFormulaDependency(unitId, sheetId, featureId, dependencyTree) {
|
|
20233
21682
|
this._featureFormulaData[unitId] || (this._featureFormulaData[unitId] = {}), this._featureFormulaData[unitId][sheetId] || (this._featureFormulaData[unitId][sheetId] = {}), this._featureFormulaData[unitId][sheetId][featureId] = dependencyTree;
|
|
@@ -20239,12 +21688,12 @@ const _DependencyManagerService = class _DependencyManagerService extends Dispos
|
|
|
20239
21688
|
});
|
|
20240
21689
|
}
|
|
20241
21690
|
getFeatureFormulaDependency(unitId, sheetId, featureId) {
|
|
20242
|
-
var
|
|
20243
|
-
return (_b = (
|
|
21691
|
+
var _a26, _b;
|
|
21692
|
+
return (_b = (_a26 = this._featureFormulaData[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b[featureId];
|
|
20244
21693
|
}
|
|
20245
21694
|
hasFeatureFormulaDependency(unitId, sheetId, featureId) {
|
|
20246
|
-
var
|
|
20247
|
-
return ((_b = (
|
|
21695
|
+
var _a26, _b;
|
|
21696
|
+
return ((_b = (_a26 = this._featureFormulaData[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b[featureId]) != null;
|
|
20248
21697
|
}
|
|
20249
21698
|
addFormulaDependency(unitId, sheetId, row, column, dependencyTree) {
|
|
20250
21699
|
this._formulaData[unitId] || (this._formulaData[unitId] = {}), this._formulaData[unitId][sheetId] || (this._formulaData[unitId][sheetId] = new ObjectMatrix()), this._formulaData[unitId][sheetId].setValue(row, column, dependencyTree);
|
|
@@ -20256,11 +21705,11 @@ const _DependencyManagerService = class _DependencyManagerService extends Dispos
|
|
|
20256
21705
|
}
|
|
20257
21706
|
}
|
|
20258
21707
|
clearFormulaDependency(unitId, sheetId) {
|
|
20259
|
-
this._formulaData[unitId] && this._formulaData[unitId][sheetId]
|
|
21708
|
+
sheetId && this._formulaData[unitId] && this._formulaData[unitId][sheetId] ? this._formulaData[unitId][sheetId].reset() : this._formulaData[unitId] && (this._formulaData[unitId] = null);
|
|
20260
21709
|
}
|
|
20261
21710
|
hasFormulaDependency(unitId, sheetId, row, column) {
|
|
20262
|
-
var
|
|
20263
|
-
return ((_b = (
|
|
21711
|
+
var _a26, _b;
|
|
21712
|
+
return ((_b = (_a26 = this._formulaData[unitId]) == null ? void 0 : _a26[sheetId]) == null ? void 0 : _b.getValue(row, column)) != null;
|
|
20264
21713
|
}
|
|
20265
21714
|
};
|
|
20266
21715
|
__name(_DependencyManagerService, "DependencyManagerService");
|
|
@@ -20274,8 +21723,8 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
|
|
|
20274
21723
|
return kind && result && __defProp$9(target, key, result), result;
|
|
20275
21724
|
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9");
|
|
20276
21725
|
const FORMULA_CACHE_LRU_COUNT = 1e5;
|
|
20277
|
-
var
|
|
20278
|
-
let FormulaDependencyGenerator = (
|
|
21726
|
+
var _a16;
|
|
21727
|
+
let FormulaDependencyGenerator = (_a16 = class extends Disposable {
|
|
20279
21728
|
constructor(_currentConfigService, _runtimeService, _otherFormulaManagerService, _featureCalculationManagerService, _interpreter, _astTreeBuilder, _lexer, _dependencyManagerService) {
|
|
20280
21729
|
super();
|
|
20281
21730
|
__publicField(this, "_updateRangeFlattenCache", /* @__PURE__ */ new Map());
|
|
@@ -20534,11 +21983,11 @@ let FormulaDependencyGenerator = (_a15 = class extends Disposable {
|
|
|
20534
21983
|
const featureMap = this._featureCalculationManagerService.getReferenceExecutorMap();
|
|
20535
21984
|
newTreeList.forEach((tree) => {
|
|
20536
21985
|
tree.children = tree.children.filter((child) => {
|
|
20537
|
-
var
|
|
20538
|
-
return child.featureId ? !((_b = (
|
|
21986
|
+
var _a26, _b;
|
|
21987
|
+
return child.featureId ? !((_b = (_a26 = featureMap.get(tree.unitId)) == null ? void 0 : _a26.get(tree.subUnitId)) != null && _b.has(child.featureId)) : !0;
|
|
20539
21988
|
}), tree.parents = tree.parents.filter((parent) => {
|
|
20540
|
-
var
|
|
20541
|
-
return parent.featureId ? !((_b = (
|
|
21989
|
+
var _a26, _b;
|
|
21990
|
+
return parent.featureId ? !((_b = (_a26 = featureMap.get(tree.unitId)) == null ? void 0 : _a26.get(tree.subUnitId)) != null && _b.has(parent.featureId)) : !0;
|
|
20542
21991
|
});
|
|
20543
21992
|
});
|
|
20544
21993
|
}
|
|
@@ -20573,21 +22022,21 @@ let FormulaDependencyGenerator = (_a15 = class extends Disposable {
|
|
|
20573
22022
|
return dependencyTree;
|
|
20574
22023
|
}
|
|
20575
22024
|
_includeTreeFeature(tree) {
|
|
20576
|
-
var
|
|
22025
|
+
var _a26, _b;
|
|
20577
22026
|
const unitId = tree.unitId, subUnitId = tree.subUnitId, featureId = tree.featureId;
|
|
20578
22027
|
if (featureId != null) {
|
|
20579
22028
|
const featureMap = this._currentConfigService.getDirtyUnitFeatureMap();
|
|
20580
|
-
if (((_b = (
|
|
22029
|
+
if (((_b = (_a26 = featureMap == null ? void 0 : featureMap[unitId]) == null ? void 0 : _a26[subUnitId]) == null ? void 0 : _b[featureId]) != null)
|
|
20581
22030
|
return !0;
|
|
20582
22031
|
}
|
|
20583
22032
|
return !1;
|
|
20584
22033
|
}
|
|
20585
22034
|
_includeOtherFormula(tree) {
|
|
20586
|
-
var
|
|
22035
|
+
var _a26, _b;
|
|
20587
22036
|
const unitId = tree.unitId, subUnitId = tree.subUnitId, formulaId = tree.formulaId;
|
|
20588
22037
|
if (formulaId != null) {
|
|
20589
22038
|
const otherFormulaMap = this._currentConfigService.getDirtyUnitOtherFormulaMap();
|
|
20590
|
-
if (((_b = (
|
|
22039
|
+
if (((_b = (_a26 = otherFormulaMap == null ? void 0 : otherFormulaMap[unitId]) == null ? void 0 : _a26[subUnitId]) == null ? void 0 : _b[formulaId]) != null)
|
|
20591
22040
|
return !0;
|
|
20592
22041
|
}
|
|
20593
22042
|
return !1;
|
|
@@ -20602,11 +22051,11 @@ let FormulaDependencyGenerator = (_a15 = class extends Disposable {
|
|
|
20602
22051
|
* @param tree
|
|
20603
22052
|
*/
|
|
20604
22053
|
_includeTree(tree) {
|
|
20605
|
-
var
|
|
22054
|
+
var _a26, _b, _c;
|
|
20606
22055
|
const unitId = tree.unitId, subUnitId = tree.subUnitId;
|
|
20607
22056
|
if (this._includeTreeFeature(tree) === !0 || this._includeOtherFormula(tree) === !0 || this._includeDefinedName(tree) === !0)
|
|
20608
22057
|
return !0;
|
|
20609
|
-
const excludedCell = (_b = (
|
|
22058
|
+
const excludedCell = (_b = (_a26 = this._currentConfigService.getExcludedRange()) == null ? void 0 : _a26[unitId]) == null ? void 0 : _b[subUnitId];
|
|
20610
22059
|
let isExclude = !1;
|
|
20611
22060
|
if (excludedCell == null || excludedCell.forValue((row, column) => {
|
|
20612
22061
|
if (tree.row === row && tree.column === column)
|
|
@@ -20650,7 +22099,7 @@ let FormulaDependencyGenerator = (_a15 = class extends Disposable {
|
|
|
20650
22099
|
}
|
|
20651
22100
|
return formulaRunList.reverse();
|
|
20652
22101
|
}
|
|
20653
|
-
}, __name(
|
|
22102
|
+
}, __name(_a16, "FormulaDependencyGenerator"), _a16);
|
|
20654
22103
|
FormulaDependencyGenerator = __decorateClass$9([
|
|
20655
22104
|
OnLifecycle(LifecycleStages.Rendered, FormulaDependencyGenerator),
|
|
20656
22105
|
__decorateParam$9(0, IFormulaCurrentConfigService),
|
|
@@ -20668,8 +22117,8 @@ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPrope
|
|
|
20668
22117
|
return kind && result && __defProp$8(target, key, result), result;
|
|
20669
22118
|
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8");
|
|
20670
22119
|
const DEFAULT_CYCLE_REFERENCE_COUNT = 1;
|
|
20671
|
-
var
|
|
20672
|
-
let CalculateFormulaService = (
|
|
22120
|
+
var _a17;
|
|
22121
|
+
let CalculateFormulaService = (_a17 = class extends Disposable {
|
|
20673
22122
|
constructor(_configService, _lexer, _currentConfigService, _runtimeService, _formulaDependencyGenerator, _interpreter, _astTreeBuilder) {
|
|
20674
22123
|
super();
|
|
20675
22124
|
__publicField(this, "_executionStartListener$", new Subject());
|
|
@@ -20789,7 +22238,7 @@ let CalculateFormulaService = (_a16 = class extends Disposable {
|
|
|
20789
22238
|
const astNode = this._astTreeBuilder.parse(lexerNode);
|
|
20790
22239
|
astNode == null || astNode.serialize();
|
|
20791
22240
|
}
|
|
20792
|
-
}, __name(
|
|
22241
|
+
}, __name(_a17, "CalculateFormulaService"), _a17);
|
|
20793
22242
|
CalculateFormulaService = __decorateClass$8([
|
|
20794
22243
|
OnLifecycle(LifecycleStages.Rendered, CalculateFormulaService),
|
|
20795
22244
|
__decorateParam$8(0, IConfigService),
|
|
@@ -20804,8 +22253,8 @@ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPrope
|
|
|
20804
22253
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
20805
22254
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
20806
22255
|
return kind && result && __defProp$7(target, key, result), result;
|
|
20807
|
-
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"),
|
|
20808
|
-
let CalculateController = (
|
|
22256
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a18;
|
|
22257
|
+
let CalculateController = (_a18 = class extends Disposable {
|
|
20809
22258
|
constructor(_commandService, _calculateFormulaService, _univerInstanceService, _formulaDataModel) {
|
|
20810
22259
|
super(), this._commandService = _commandService, this._calculateFormulaService = _calculateFormulaService, this._univerInstanceService = _univerInstanceService, this._formulaDataModel = _formulaDataModel, this._initialize();
|
|
20811
22260
|
}
|
|
@@ -20918,7 +22367,7 @@ let CalculateController = (_a17 = class extends Disposable {
|
|
|
20918
22367
|
}
|
|
20919
22368
|
);
|
|
20920
22369
|
}
|
|
20921
|
-
}, __name(
|
|
22370
|
+
}, __name(_a18, "CalculateController"), _a18);
|
|
20922
22371
|
CalculateController = __decorateClass$7([
|
|
20923
22372
|
OnLifecycle(LifecycleStages.Ready, CalculateController),
|
|
20924
22373
|
__decorateParam$7(0, ICommandService),
|
|
@@ -20971,8 +22420,8 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
|
|
|
20971
22420
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
20972
22421
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
20973
22422
|
return kind && result && __defProp$6(target, key, result), result;
|
|
20974
|
-
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"),
|
|
20975
|
-
let FormulaController = (
|
|
22423
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a19;
|
|
22424
|
+
let FormulaController = (_a19 = class extends Disposable {
|
|
20976
22425
|
constructor(_commandService, _functionService, _configService, _dataSyncPrimaryController) {
|
|
20977
22426
|
super(), this._commandService = _commandService, this._functionService = _functionService, this._configService = _configService, this._dataSyncPrimaryController = _dataSyncPrimaryController, this._initialize();
|
|
20978
22427
|
}
|
|
@@ -20998,12 +22447,12 @@ let FormulaController = (_a18 = class extends Disposable {
|
|
|
20998
22447
|
SetSuperTableOptionMutation,
|
|
20999
22448
|
RegisterFunctionMutation
|
|
21000
22449
|
].forEach((mutation) => {
|
|
21001
|
-
var
|
|
21002
|
-
this._commandService.registerCommand(mutation), (
|
|
22450
|
+
var _a26;
|
|
22451
|
+
this._commandService.registerCommand(mutation), (_a26 = this._dataSyncPrimaryController) == null || _a26.registerSyncingMutations(mutation);
|
|
21003
22452
|
});
|
|
21004
22453
|
}
|
|
21005
22454
|
_registerFunctions() {
|
|
21006
|
-
var
|
|
22455
|
+
var _a26;
|
|
21007
22456
|
const config2 = this._configService.getConfig(PLUGIN_CONFIG_KEY), functions = [
|
|
21008
22457
|
...functionArray,
|
|
21009
22458
|
...functionCompatibility,
|
|
@@ -21021,13 +22470,13 @@ let FormulaController = (_a18 = class extends Disposable {
|
|
|
21021
22470
|
...functionText,
|
|
21022
22471
|
...functionUniver,
|
|
21023
22472
|
...functionWeb
|
|
21024
|
-
].concat((
|
|
22473
|
+
].concat((_a26 = config2 == null ? void 0 : config2.function) != null ? _a26 : []).map((registerObject) => {
|
|
21025
22474
|
const Func = registerObject[0], name = registerObject[1];
|
|
21026
22475
|
return new Func(name);
|
|
21027
22476
|
});
|
|
21028
22477
|
this._functionService.registerExecutors(...functions);
|
|
21029
22478
|
}
|
|
21030
|
-
}, __name(
|
|
22479
|
+
}, __name(_a19, "FormulaController"), _a19);
|
|
21031
22480
|
FormulaController = __decorateClass$6([
|
|
21032
22481
|
OnLifecycle(LifecycleStages.Ready, FormulaController),
|
|
21033
22482
|
__decorateParam$6(0, ICommandService),
|
|
@@ -21039,8 +22488,8 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
|
|
|
21039
22488
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21040
22489
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
21041
22490
|
return kind && result && __defProp$5(target, key, result), result;
|
|
21042
|
-
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"),
|
|
21043
|
-
let SetDefinedNameController = (
|
|
22491
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a20;
|
|
22492
|
+
let SetDefinedNameController = (_a20 = class extends Disposable {
|
|
21044
22493
|
constructor(_commandService, _definedNamesService) {
|
|
21045
22494
|
super(), this._commandService = _commandService, this._definedNamesService = _definedNamesService, this._initialize();
|
|
21046
22495
|
}
|
|
@@ -21073,7 +22522,7 @@ let SetDefinedNameController = (_a19 = class extends Disposable {
|
|
|
21073
22522
|
})
|
|
21074
22523
|
);
|
|
21075
22524
|
}
|
|
21076
|
-
}, __name(
|
|
22525
|
+
}, __name(_a20, "SetDefinedNameController"), _a20);
|
|
21077
22526
|
SetDefinedNameController = __decorateClass$5([
|
|
21078
22527
|
OnLifecycle(LifecycleStages.Ready, SetDefinedNameController),
|
|
21079
22528
|
__decorateParam$5(0, ICommandService),
|
|
@@ -21083,8 +22532,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
|
|
|
21083
22532
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21084
22533
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
21085
22534
|
return kind && result && __defProp$4(target, key, result), result;
|
|
21086
|
-
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"),
|
|
21087
|
-
let SetFeatureCalculationController = (
|
|
22535
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a21;
|
|
22536
|
+
let SetFeatureCalculationController = (_a21 = class extends Disposable {
|
|
21088
22537
|
constructor(_commandService, _featureCalculationManagerService) {
|
|
21089
22538
|
super(), this._commandService = _commandService, this._featureCalculationManagerService = _featureCalculationManagerService, this._initialize();
|
|
21090
22539
|
}
|
|
@@ -21110,7 +22559,7 @@ let SetFeatureCalculationController = (_a20 = class extends Disposable {
|
|
|
21110
22559
|
})
|
|
21111
22560
|
);
|
|
21112
22561
|
}
|
|
21113
|
-
}, __name(
|
|
22562
|
+
}, __name(_a21, "SetFeatureCalculationController"), _a21);
|
|
21114
22563
|
SetFeatureCalculationController = __decorateClass$4([
|
|
21115
22564
|
OnLifecycle(LifecycleStages.Ready, SetFeatureCalculationController),
|
|
21116
22565
|
__decorateParam$4(0, ICommandService),
|
|
@@ -21120,8 +22569,8 @@ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPrope
|
|
|
21120
22569
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21121
22570
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
21122
22571
|
return kind && result && __defProp$3(target, key, result), result;
|
|
21123
|
-
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"),
|
|
21124
|
-
let SetOtherFormulaController = (
|
|
22572
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a22;
|
|
22573
|
+
let SetOtherFormulaController = (_a22 = class extends Disposable {
|
|
21125
22574
|
constructor(_commandService, _otherFormulaManagerService, _dependencyManagerService) {
|
|
21126
22575
|
super(), this._commandService = _commandService, this._otherFormulaManagerService = _otherFormulaManagerService, this._dependencyManagerService = _dependencyManagerService, this._initialize();
|
|
21127
22576
|
}
|
|
@@ -21149,7 +22598,7 @@ let SetOtherFormulaController = (_a21 = class extends Disposable {
|
|
|
21149
22598
|
})
|
|
21150
22599
|
);
|
|
21151
22600
|
}
|
|
21152
|
-
}, __name(
|
|
22601
|
+
}, __name(_a22, "SetOtherFormulaController"), _a22);
|
|
21153
22602
|
SetOtherFormulaController = __decorateClass$3([
|
|
21154
22603
|
OnLifecycle(LifecycleStages.Ready, SetOtherFormulaController),
|
|
21155
22604
|
__decorateParam$3(0, ICommandService),
|
|
@@ -21160,8 +22609,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
|
|
|
21160
22609
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21161
22610
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
21162
22611
|
return kind && result && __defProp$2(target, key, result), result;
|
|
21163
|
-
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"),
|
|
21164
|
-
let SetSuperTableController = (
|
|
22612
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a23;
|
|
22613
|
+
let SetSuperTableController = (_a23 = class extends Disposable {
|
|
21165
22614
|
constructor(_commandService, _superTableService) {
|
|
21166
22615
|
super(), this._commandService = _commandService, this._superTableService = _superTableService, this._initialize();
|
|
21167
22616
|
}
|
|
@@ -21193,7 +22642,7 @@ let SetSuperTableController = (_a22 = class extends Disposable {
|
|
|
21193
22642
|
})
|
|
21194
22643
|
);
|
|
21195
22644
|
}
|
|
21196
|
-
}, __name(
|
|
22645
|
+
}, __name(_a23, "SetSuperTableController"), _a23);
|
|
21197
22646
|
SetSuperTableController = __decorateClass$2([
|
|
21198
22647
|
OnLifecycle(LifecycleStages.Ready, SetSuperTableController),
|
|
21199
22648
|
__decorateParam$2(0, ICommandService),
|
|
@@ -21232,8 +22681,8 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
21232
22681
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21233
22682
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
21234
22683
|
return kind && result && __defProp$1(target, key, result), result;
|
|
21235
|
-
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"),
|
|
21236
|
-
let SetDependencyController = (
|
|
22684
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a24;
|
|
22685
|
+
let SetDependencyController = (_a24 = class extends Disposable {
|
|
21237
22686
|
constructor(_commandService, _dependencyManagerService, _featureCalculationManagerService) {
|
|
21238
22687
|
super(), this._commandService = _commandService, this._dependencyManagerService = _dependencyManagerService, this._featureCalculationManagerService = _featureCalculationManagerService, this._initialize();
|
|
21239
22688
|
}
|
|
@@ -21279,22 +22728,29 @@ let SetDependencyController = (_a23 = class extends Disposable {
|
|
|
21279
22728
|
} else if (command.id === SetFormulaDataMutation.id) {
|
|
21280
22729
|
const formulaData = command.params.formulaData;
|
|
21281
22730
|
Object.keys(formulaData).forEach((unitId) => {
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
21285
|
-
|
|
21286
|
-
|
|
21287
|
-
|
|
21288
|
-
|
|
21289
|
-
|
|
22731
|
+
const unitFormulaData = formulaData[unitId];
|
|
22732
|
+
if (unitFormulaData !== void 0) {
|
|
22733
|
+
if (unitFormulaData === null) {
|
|
22734
|
+
this._dependencyManagerService.clearFormulaDependency(unitId);
|
|
22735
|
+
return;
|
|
22736
|
+
}
|
|
22737
|
+
Object.keys(unitFormulaData).forEach((subUnitId) => {
|
|
22738
|
+
const formulaDataItem = unitFormulaData[subUnitId];
|
|
22739
|
+
if (formulaDataItem !== void 0) {
|
|
22740
|
+
if (formulaDataItem === null)
|
|
22741
|
+
return this._dependencyManagerService.clearFormulaDependency(unitId, subUnitId), !0;
|
|
22742
|
+
new ObjectMatrix(formulaDataItem).forValue((row, column) => {
|
|
22743
|
+
this._dependencyManagerService.removeFormulaDependency(unitId, subUnitId, row, column);
|
|
22744
|
+
});
|
|
22745
|
+
}
|
|
21290
22746
|
});
|
|
21291
|
-
}
|
|
22747
|
+
}
|
|
21292
22748
|
});
|
|
21293
22749
|
}
|
|
21294
22750
|
})
|
|
21295
22751
|
);
|
|
21296
22752
|
}
|
|
21297
|
-
}, __name(
|
|
22753
|
+
}, __name(_a24, "SetDependencyController"), _a24);
|
|
21298
22754
|
SetDependencyController = __decorateClass$1([
|
|
21299
22755
|
OnLifecycle(LifecycleStages.Ready, SetDependencyController),
|
|
21300
22756
|
__decorateParam$1(0, ICommandService),
|
|
@@ -21307,9 +22763,9 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
|
21307
22763
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
21308
22764
|
return kind && result && __defProp2(target, key, result), result;
|
|
21309
22765
|
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
|
|
21310
|
-
const PLUGIN_NAME = "
|
|
21311
|
-
var
|
|
21312
|
-
let UniverFormulaEnginePlugin = (
|
|
22766
|
+
const PLUGIN_NAME = "UNIVER_ENGINE_FORMULA_PLUGIN";
|
|
22767
|
+
var _a25;
|
|
22768
|
+
let UniverFormulaEnginePlugin = (_a25 = class extends Plugin {
|
|
21313
22769
|
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
21314
22770
|
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
21315
22771
|
const { ...rest } = this._config;
|
|
@@ -21319,7 +22775,7 @@ let UniverFormulaEnginePlugin = (_a24 = class extends Plugin {
|
|
|
21319
22775
|
this._initialize();
|
|
21320
22776
|
}
|
|
21321
22777
|
_initialize() {
|
|
21322
|
-
var
|
|
22778
|
+
var _a26;
|
|
21323
22779
|
const dependencies = [
|
|
21324
22780
|
// Services
|
|
21325
22781
|
[IFunctionService, { useClass: FunctionService }],
|
|
@@ -21335,7 +22791,7 @@ let UniverFormulaEnginePlugin = (_a24 = class extends Plugin {
|
|
|
21335
22791
|
[SetDefinedNameController],
|
|
21336
22792
|
[SetSuperTableController]
|
|
21337
22793
|
];
|
|
21338
|
-
(
|
|
22794
|
+
(_a26 = this._config) != null && _a26.notExecuteFormula || dependencies.push(
|
|
21339
22795
|
// Services
|
|
21340
22796
|
[CalculateFormulaService],
|
|
21341
22797
|
[IOtherFormulaManagerService, { useClass: OtherFormulaManagerService }],
|
|
@@ -21366,7 +22822,7 @@ let UniverFormulaEnginePlugin = (_a24 = class extends Plugin {
|
|
|
21366
22822
|
[ValueNodeFactory]
|
|
21367
22823
|
), dependencies.forEach((dependency) => this._injector.add(dependency));
|
|
21368
22824
|
}
|
|
21369
|
-
}, __name(
|
|
22825
|
+
}, __name(_a25, "UniverFormulaEnginePlugin"), __publicField(_a25, "pluginName", PLUGIN_NAME), _a25);
|
|
21370
22826
|
UniverFormulaEnginePlugin = __decorateClass([
|
|
21371
22827
|
__decorateParam(1, Inject(Injector)),
|
|
21372
22828
|
__decorateParam(2, IConfigService)
|