Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(formula contain text bug): add iscell method
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Nov 30, 2020
1 parent 4b13413 commit 89358d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
22 changes: 3 additions & 19 deletions src/global/formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -5018,7 +5018,6 @@ const luckysheetformula = {
}
}


let arrayMatchCache = {};
let arrayMatch = function(formulaArray, formulaObjects, func){
for(let a=0;a<formulaArray.length;a++){
Expand Down Expand Up @@ -5057,21 +5056,6 @@ const luckysheetformula = {
}

let existsChildFormulaMatch = {}, ii=0;
let childFormulaMatch = function(formulaArray, formulaObjects){
arrayMatch(formulaArray, formulaObjects,function(childKey){
ii++;
if(childKey in formulaObjects){
let childFormulaCell = formulaObjects[childKey];
if(childFormulaCell.level==Math.max){
childFormulaCell.level = 0;
}
childFormulaCell.level += 1;
existsChildFormulaMatch[childKey] = 1;

childFormulaMatch(childFormulaCell.formulaArray, formulaObjects);
}
});
}

//创建公式缓存及其范围的缓存
// console.time("1");
Expand All @@ -5094,16 +5078,16 @@ const luckysheetformula = {
}
});
}
else{
else if(!(calc_funcStr.substr(0,2)=='="' && calc_funcStr.substr(calc_funcStr.length-1,1)=='"')){
let formulaTextArray = calc_funcStr.split(/==|!=|<>|<=|>=|[,()=+-\/*%&^><]/g);

for(let i=0;i<formulaTextArray.length;i++){
let t = formulaTextArray[i];
if(t.length<=1){
continue;
}

if(t.substr(0,1)=='"' && t.substr(t.length-1,1)=='"'){
if(t.substr(0,1)=='"' && t.substr(t.length-1,1)=='"' && !_this.iscelldata(t)){
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions src/index.html

Large diffs are not rendered by default.

0 comments on commit 89358d3

Please sign in to comment.