From 31e4b3d9e4cf16f005f8cede059b7cb1cab05031 Mon Sep 17 00:00:00 2001 From: wbfsa Date: Mon, 19 Oct 2020 12:08:12 +0800 Subject: [PATCH] fix(function array value error): fix it --- src/global/formula.js | 6 ++++-- src/global/func_methods.js | 20 ++++++++++++++++---- src/index.html | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/global/formula.js b/src/global/formula.js index 915f94d..771c49a 100644 --- a/src/global/formula.js +++ b/src/global/formula.js @@ -4067,7 +4067,7 @@ const luckysheetformula = { i++; } - // console.log(function_str); + console.log(function_str); return function_str; }, insertUpdateDynamicArray: function(dynamicArrayItem) { @@ -5081,7 +5081,7 @@ const luckysheetformula = { let ukey ="r" + u.r + "c" + u.c + "i" + u.index; - // if ((u.r == item.r && u.c == item.c && u.index == item.index) || name in _this.execvertex[ukey].chidren ) { + // if ((u.r == item.r && u.c == item.c && u.index == item.index) ) { // continue; // } @@ -5430,6 +5430,8 @@ const luckysheetformula = { return [true, result, txt, {type: "dynamicArrayItem", data: dynamicArrayItem}]; } + console.log(result, txt); + return [true, result, txt]; }, testFunction: function(txt, fp) { diff --git a/src/global/func_methods.js b/src/global/func_methods.js index d115000..6ea219a 100644 --- a/src/global/func_methods.js +++ b/src/global/func_methods.js @@ -33,8 +33,14 @@ const func_methods = { if(getObjType(rangeObj.data) == "array"){ for(let i = 0; i < rangeObj.data.length; i++){ for(let j = 0; j < rangeObj.data[i].length; j++){ - if(rangeObj.data[i][j] != null && !isRealNull(rangeObj.data[i][j].v)){ - dataArr.push(rangeObj.data[i][j].v); + if(rangeObj.data[i][j] != null){ + let datav = rangeObj.data[i][j]; + if(datav instanceof Object){ + dataArr.push(datav.v); + } + else{ + dataArr.push(datav); + } } else{ if(!isNeglectNullCell){ @@ -92,8 +98,14 @@ const func_methods = { for(let j = 0; j < rangeObj.data[i].length; j++){ let value; - if(rangeObj.data[i][j] != null && !isRealNull(rangeObj.data[i][j].v)){ - value = rangeObj.data[i][j].v; + if(rangeObj.data[i][j] != null){ + let datav = rangeObj.data[i][j]; + if(datav instanceof Object){ + value = datav.v; + } + else{ + value = datav; + } } else{ if(nullCellType == "number"){ diff --git a/src/index.html b/src/index.html index 6a2233b..fe8e862 100644 --- a/src/index.html +++ b/src/index.html @@ -54,7 +54,7 @@ } ], data: - [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification] + [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification] /*[{"name":"Sheet1","config":{"columnlen":{"0":241},"rowlen":{"0":81}},"index":"1","status":"1","order":"0","luckysheet_select_save":[{"row":[0,0],"column":[4,4],"sheetIndex":1}],"zoomRatio":1,"showGridLines":"1","defaultColWidth":72,"defaultRowHeight":18,"celldata":[ {"r":0,"c":0, "v":{