From bba39922e01a0d01eea71a821082fc166b0266c0 Mon Sep 17 00:00:00 2001 From: wpxp123456 Date: Wed, 25 Sep 2024 11:23:16 +0800 Subject: [PATCH] fix(formula): fix bycol/byrow/map --- packages/engine-formula/src/functions/logical/bycol/index.ts | 4 ++-- packages/engine-formula/src/functions/logical/byrow/index.ts | 4 ++-- packages/engine-formula/src/functions/logical/map/index.ts | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/engine-formula/src/functions/logical/bycol/index.ts b/packages/engine-formula/src/functions/logical/bycol/index.ts index a684c680e79..1e8f4117d71 100644 --- a/packages/engine-formula/src/functions/logical/bycol/index.ts +++ b/packages/engine-formula/src/functions/logical/bycol/index.ts @@ -55,8 +55,8 @@ export class Bycol extends BaseFunction { const _lambda = lambda as LambdaValueObjectObject; - const rowCount = array.isArray() ? (array as ArrayValueObject).getRowCount() : 1; - const columnCount = array.isArray() ? (array as ArrayValueObject).getColumnCount() : 1; + const rowCount = _array.isArray() ? (_array as ArrayValueObject).getRowCount() : 1; + const columnCount = _array.isArray() ? (_array as ArrayValueObject).getColumnCount() : 1; _array = expandArrayValueObject(rowCount, columnCount, _array as BaseValueObject); const result: BaseValueObject[][] = [[]]; diff --git a/packages/engine-formula/src/functions/logical/byrow/index.ts b/packages/engine-formula/src/functions/logical/byrow/index.ts index 6d3190ae2b9..4c173ecfe8b 100644 --- a/packages/engine-formula/src/functions/logical/byrow/index.ts +++ b/packages/engine-formula/src/functions/logical/byrow/index.ts @@ -55,8 +55,8 @@ export class Byrow extends BaseFunction { const _lambda = lambda as LambdaValueObjectObject; - const rowCount = array.isArray() ? (array as ArrayValueObject).getRowCount() : 1; - const columnCount = array.isArray() ? (array as ArrayValueObject).getColumnCount() : 1; + const rowCount = _array.isArray() ? (_array as ArrayValueObject).getRowCount() : 1; + const columnCount = _array.isArray() ? (_array as ArrayValueObject).getColumnCount() : 1; _array = expandArrayValueObject(rowCount, columnCount, _array as BaseValueObject); const result: BaseValueObject[][] = []; diff --git a/packages/engine-formula/src/functions/logical/map/index.ts b/packages/engine-formula/src/functions/logical/map/index.ts index 2ca24da4b67..2f227e584b4 100644 --- a/packages/engine-formula/src/functions/logical/map/index.ts +++ b/packages/engine-formula/src/functions/logical/map/index.ts @@ -28,6 +28,8 @@ export class Map extends BaseFunction { override maxParams = 255; + override needsReferenceObject = true; + override calculate(...variants: FunctionVariantType[]): BaseValueObject { const _variants: FunctionVariantType[] = []; let lambda: Nullable = null;