Dushusir
					
					5 years ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 6 changed files with 
37 additions and 
15 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/function/functionImplementation.js
				
 
			
				- 
					
					
					 
					src/global/formula.js
				
 
			
				- 
					
					
					 
					src/locale/en.js
				
 
			
				- 
					
					
					 
					src/locale/es.js
				
 
			
				- 
					
					
					 
					src/locale/zh.js
				
 
			
				- 
					
					
					 
					src/locale/zh_tw.js
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -27562,19 +27562,22 @@ const functionImplementation = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        try { | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            var cell_r = window.luckysheetCurrentRow; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            var cell_c = window.luckysheetCurrentColumn; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            var sheetindex_now = window.luckysheetCurrentIndex; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //公式文本
 | 
					 | 
					 | 
					            //公式文本
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            var strtext = func_methods.getFirstValue(arguments[0]).toString(); | 
					 | 
					 | 
					            var strtext = func_methods.getFirstValue(arguments[0]).toString(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if(valueIsError(strtext)){ | 
					 | 
					 | 
					            if(valueIsError(strtext)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                return strtext; | 
					 | 
					 | 
					                return strtext; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					            //在文本公式前面添加=
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //if (!window.luckysheet_function.ISIDCARD.f(UUserCard)) {
 | 
					 | 
					 | 
					            if(strtext.trim().indexOf('=')!=0) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //    return formula.error.v;
 | 
					 | 
					 | 
					            { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //}
 | 
					 | 
					 | 
					                strtext ='='+strtext; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //匹配简单公式,只能包含  空格 数字-+*/.()
 | 
					 | 
					 | 
					            } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            var formulastr = /[ \d\+\*\-\/\(\)\.]+/; | 
					 | 
					 | 
					            //console.log(strtext);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            var strtext2=strtext.match(formulastr)[0]; | 
					 | 
					 | 
					            var result_this = formula.execstringformula(strtext,cell_r,cell_c,sheetindex_now); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            return eval(strtext2); | 
					 | 
					 | 
					            return result_this[1]; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        catch (e) { | 
					 | 
					 | 
					        catch (e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            var err = e; | 
					 | 
					 | 
					            var err = e; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -5758,6 +5758,11 @@ const luckysheetformula = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return false; | 
					 | 
					 | 
					            return false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }, | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    //供function/functionImplementation.js的EVALUATE函数调用。
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    execstringformula: function (txt, r, c, index) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        let _this = this; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return this.execfunction(txt, r, c, index); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    functionResizeData: {}, | 
					 | 
					 | 
					    functionResizeData: {}, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    functionResizeStatus: false, | 
					 | 
					 | 
					    functionResizeStatus: false, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    functionResizeTimeout: null, | 
					 | 
					 | 
					    functionResizeTimeout: null, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -8820,8 +8820,8 @@ export default { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "m": [1, 1], | 
					 | 
					 | 
					        "m": [1, 1], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "p": [{ | 
					 | 
					 | 
					        "p": [{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "name": "expression", | 
					 | 
					 | 
					            "name": "expression", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            "example": '"5*6"', | 
					 | 
					 | 
					            "example": '"A1+5*2^2"', | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            "detail": "Formula or expression only supports numbers+-/*.()", | 
					 | 
					 | 
					            "detail": "Formula or expression", | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            "require": "m", | 
					 | 
					 | 
					            "require": "m", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "repeat": "n", | 
					 | 
					 | 
					            "repeat": "n", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "type": "rangeall" | 
					 | 
					 | 
					            "type": "rangeall" | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -8820,8 +8820,8 @@ export default { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "m": [1, 1], | 
					 | 
					 | 
					        "m": [1, 1], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "p": [{ | 
					 | 
					 | 
					        "p": [{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "name": "expression", | 
					 | 
					 | 
					            "name": "expression", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            "example": '"5*6"', | 
					 | 
					 | 
					            "example": '"A1+5*2^2"', | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            "detail": "Formula or expression only supports numbers+-/*.()", | 
					 | 
					 | 
					            "detail": "Formula or expression", | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            "require": "m", | 
					 | 
					 | 
					            "require": "m", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "repeat": "n", | 
					 | 
					 | 
					            "repeat": "n", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "type": "rangeall" | 
					 | 
					 | 
					            "type": "rangeall" | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -9040,13 +9040,13 @@ export default { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    { | 
					 | 
					 | 
					    { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "n": "EVALUATE", | 
					 | 
					 | 
					        "n": "EVALUATE", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "t": "3", | 
					 | 
					 | 
					        "t": "3", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        "d": "对以文字表示的一个公式或者表达式求值,并返回结果", | 
					 | 
					 | 
					        "d": "对以文字表示的公式或者表达式求值,并返回结果。", | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        "a": "根据文字公式或者表达式求值。", | 
					 | 
					 | 
					        "a": "根据文字公式或者表达式求值。", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "m": [1, 1], | 
					 | 
					 | 
					        "m": [1, 1], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "p": [{ | 
					 | 
					 | 
					        "p": [{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "name": "公式", | 
					 | 
					 | 
					            "name": "公式", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            "example": '"5*6"', | 
					 | 
					 | 
					            "example": '"A1+5*2^2"', | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            "detail": "公式或表达式仅支持数字+-/*.()", | 
					 | 
					 | 
					            "detail": "公式或表达式", | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            "require": "m", | 
					 | 
					 | 
					            "require": "m", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "repeat": "n", | 
					 | 
					 | 
					            "repeat": "n", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            "type": "rangeall" | 
					 | 
					 | 
					            "type": "rangeall" | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -9038,6 +9038,20 @@ export default { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            'repeat' : 'n', | 
					 | 
					 | 
					            'repeat' : 'n', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            'type'   : 'rangenumber' | 
					 | 
					 | 
					            'type'   : 'rangenumber' | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }] | 
					 | 
					 | 
					        }] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    },{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        'n': 'EVALUATE', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        't': '3', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        'd': '對以文字表示的公式或者表達式求值,並返回結果。', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        'a': '根據文字公式或者表達式求值。', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        'm': [1, 1], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        "p": [{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            "name": "公式", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            "example": '"A1+5*2^2"', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            "detail": "公式或表達式", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            "require": "m", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            "repeat": "n", | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            "type": "rangeall" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }, | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    ], | 
					 | 
					 | 
					    ], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    toolbar: { | 
					 | 
					 | 
					    toolbar: { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |