@devmm/puredocs-excel-formula 1.1.1 → 1.1.2
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/dist/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2817,6 +2817,8 @@ function registerLookup(r) {
|
|
|
2817
2817
|
r.register("COLUMNS", columns, 1, 1);
|
|
2818
2818
|
r.register("OFFSET", offset, 3, 5, true);
|
|
2819
2819
|
r.register("INDIRECT", indirect, 1, 2, true);
|
|
2820
|
+
r.register("ANCHORARRAY", anchorArray, 1, 1);
|
|
2821
|
+
r.register("SINGLE", single, 1, 1);
|
|
2820
2822
|
}
|
|
2821
2823
|
function num2(a, c, i) {
|
|
2822
2824
|
const r = exports.FormulaHelper.evalDouble(a[i], c);
|
|
@@ -3264,6 +3266,15 @@ function offset(a, c) {
|
|
|
3264
3266
|
puredocsExcel.cellRefFromRowCol(newRow + height - 1, newCol + width - 1)
|
|
3265
3267
|
);
|
|
3266
3268
|
}
|
|
3269
|
+
function anchorArray(a, c) {
|
|
3270
|
+
const arg2 = a[0];
|
|
3271
|
+
if (arg2 instanceof CellReferenceNode) return c.resolveSpillRange(arg2.reference);
|
|
3272
|
+
if (arg2 instanceof SheetCellReferenceNode) return c.resolveSheetSpillRange(arg2.sheetName, arg2.cellReference);
|
|
3273
|
+
return FormulaValue.errorRef;
|
|
3274
|
+
}
|
|
3275
|
+
function single(a, c) {
|
|
3276
|
+
return new ImplicitIntersectionNode(a[0]).evaluate(c);
|
|
3277
|
+
}
|
|
3267
3278
|
|
|
3268
3279
|
// src/functions/statistical-functions.ts
|
|
3269
3280
|
function registerStatistical(r) {
|
|
@@ -4930,6 +4941,15 @@ var _FormulaContext = class _FormulaContext {
|
|
|
4930
4941
|
if (colon < 0) return this.getCellValue(spillRef);
|
|
4931
4942
|
return this.getRangeValues(spillRef.slice(0, colon), spillRef.slice(colon + 1));
|
|
4932
4943
|
}
|
|
4944
|
+
/** {@link resolveSpillRange} for an anchor on another sheet ('S'!A1#). */
|
|
4945
|
+
resolveSheetSpillRange(sheetName, anchorRef) {
|
|
4946
|
+
if (!this.workbook) return FormulaValue.errorRef;
|
|
4947
|
+
try {
|
|
4948
|
+
return __privateMethod(this, _FormulaContext_instances, forSheet_fn).call(this, sheetName).resolveSpillRange(anchorRef);
|
|
4949
|
+
} catch {
|
|
4950
|
+
return FormulaValue.errorRef;
|
|
4951
|
+
}
|
|
4952
|
+
}
|
|
4933
4953
|
getRangeBounds(startRef, endRef) {
|
|
4934
4954
|
const s = puredocsExcel.parseCellRef(startRef);
|
|
4935
4955
|
const e = puredocsExcel.parseCellRef(endRef);
|
|
@@ -5548,6 +5568,7 @@ function createWorkbookRecalcModel(workbook) {
|
|
|
5548
5568
|
};
|
|
5549
5569
|
}
|
|
5550
5570
|
var MAX_ADOPTED_SPILL_CELLS = 262144;
|
|
5571
|
+
var resultOf = (fv2) => fv2.isBlank ? 0 : fv2.toObject();
|
|
5551
5572
|
var normSheet = (s) => s.toUpperCase();
|
|
5552
5573
|
var normRef = (r) => r.replace(/\$/g, "").toUpperCase();
|
|
5553
5574
|
var keyOf = (sheet, ref) => `${normSheet(sheet)}!${normRef(ref)}`;
|
|
@@ -6208,7 +6229,7 @@ writeResult_fn = function(e) {
|
|
|
6208
6229
|
if (!fv2.isArray) {
|
|
6209
6230
|
__privateMethod(this, _RecalcEngine_instances, clearSpill_fn).call(this, anchorKey, changed);
|
|
6210
6231
|
__privateGet(this, _model).setCellArrayRef?.(e.sheetName, e.ref, null);
|
|
6211
|
-
const value2 = fv2
|
|
6232
|
+
const value2 = resultOf(fv2);
|
|
6212
6233
|
__privateMethod(this, _RecalcEngine_instances, writeCell_fn).call(this, e.sheetName, e.ref, value2, e.row, e.col);
|
|
6213
6234
|
changed.push({ sheet: e.sheet, row: e.row, col: e.col });
|
|
6214
6235
|
return { result: { sheet: e.sheetName, ref: e.ref, value: value2 }, changed };
|
|
@@ -6239,7 +6260,7 @@ writeResult_fn = function(e) {
|
|
|
6239
6260
|
for (let dc = 0; dc < cols; dc++) {
|
|
6240
6261
|
const r = e.row + dr, c = e.col + dc;
|
|
6241
6262
|
const ref = puredocsExcel.cellRefFromRowCol(r, c);
|
|
6242
|
-
__privateMethod(this, _RecalcEngine_instances, writeCell_fn).call(this, e.sheetName, ref, arr.get(dr, dc)
|
|
6263
|
+
__privateMethod(this, _RecalcEngine_instances, writeCell_fn).call(this, e.sheetName, ref, resultOf(arr.get(dr, dc)), r, c);
|
|
6243
6264
|
changed.push({ sheet: e.sheet, row: r, col: c });
|
|
6244
6265
|
if (dr !== 0 || dc !== 0) {
|
|
6245
6266
|
const cellKey2 = keyOf(e.sheet, ref);
|
|
@@ -6259,7 +6280,7 @@ writeResult_fn = function(e) {
|
|
|
6259
6280
|
const spillRef = `${e.ref}:${puredocsExcel.cellRefFromRowCol(e.row + rows2 - 1, e.col + cols - 1)}`;
|
|
6260
6281
|
__privateGet(this, _model).setCellArrayRef?.(e.sheetName, e.ref, spillRef);
|
|
6261
6282
|
return {
|
|
6262
|
-
result: { sheet: e.sheetName, ref: e.ref, value: arr.get(0, 0)
|
|
6283
|
+
result: { sheet: e.sheetName, ref: e.ref, value: resultOf(arr.get(0, 0)), spill: { rows: rows2, cols } },
|
|
6263
6284
|
changed
|
|
6264
6285
|
};
|
|
6265
6286
|
};
|