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 { |
|
|
|
var cell_r = window.luckysheetCurrentRow; |
|
|
|
var cell_c = window.luckysheetCurrentColumn; |
|
|
|
var sheetindex_now = window.luckysheetCurrentIndex; |
|
|
|
//公式文本
|
|
|
|
var strtext = func_methods.getFirstValue(arguments[0]).toString(); |
|
|
|
if(valueIsError(strtext)){ |
|
|
|
return strtext; |
|
|
|
} |
|
|
|
|
|
|
|
//if (!window.luckysheet_function.ISIDCARD.f(UUserCard)) {
|
|
|
|
// return formula.error.v;
|
|
|
|
//}
|
|
|
|
//匹配简单公式,只能包含 空格 数字-+*/.()
|
|
|
|
var formulastr = /[ \d\+\*\-\/\(\)\.]+/; |
|
|
|
var strtext2=strtext.match(formulastr)[0]; |
|
|
|
return eval(strtext2); |
|
|
|
//在文本公式前面添加=
|
|
|
|
if(strtext.trim().indexOf('=')!=0) |
|
|
|
{ |
|
|
|
strtext ='='+strtext; |
|
|
|
} |
|
|
|
//console.log(strtext);
|
|
|
|
var result_this = formula.execstringformula(strtext,cell_r,cell_c,sheetindex_now); |
|
|
|
return result_this[1]; |
|
|
|
} |
|
|
|
catch (e) { |
|
|
|
var err = e; |
|
|
|
|
|
|
|
@ -5758,6 +5758,11 @@ const luckysheetformula = { |
|
|
|
return false; |
|
|
|
} |
|
|
|
}, |
|
|
|
//供function/functionImplementation.js的EVALUATE函数调用。
|
|
|
|
execstringformula: function (txt, r, c, index) { |
|
|
|
let _this = this; |
|
|
|
return this.execfunction(txt, r, c, index); |
|
|
|
}, |
|
|
|
functionResizeData: {}, |
|
|
|
functionResizeStatus: false, |
|
|
|
functionResizeTimeout: null, |
|
|
|
|
|
|
|
@ -8820,8 +8820,8 @@ export default { |
|
|
|
"m": [1, 1], |
|
|
|
"p": [{ |
|
|
|
"name": "expression", |
|
|
|
"example": '"5*6"', |
|
|
|
"detail": "Formula or expression only supports numbers+-/*.()", |
|
|
|
"example": '"A1+5*2^2"', |
|
|
|
"detail": "Formula or expression", |
|
|
|
"require": "m", |
|
|
|
"repeat": "n", |
|
|
|
"type": "rangeall" |
|
|
|
|
|
|
|
@ -8820,8 +8820,8 @@ export default { |
|
|
|
"m": [1, 1], |
|
|
|
"p": [{ |
|
|
|
"name": "expression", |
|
|
|
"example": '"5*6"', |
|
|
|
"detail": "Formula or expression only supports numbers+-/*.()", |
|
|
|
"example": '"A1+5*2^2"', |
|
|
|
"detail": "Formula or expression", |
|
|
|
"require": "m", |
|
|
|
"repeat": "n", |
|
|
|
"type": "rangeall" |
|
|
|
|
|
|
|
@ -9040,13 +9040,13 @@ export default { |
|
|
|
{ |
|
|
|
"n": "EVALUATE", |
|
|
|
"t": "3", |
|
|
|
"d": "对以文字表示的一个公式或者表达式求值,并返回结果", |
|
|
|
"d": "对以文字表示的公式或者表达式求值,并返回结果。", |
|
|
|
"a": "根据文字公式或者表达式求值。", |
|
|
|
"m": [1, 1], |
|
|
|
"p": [{ |
|
|
|
"name": "公式", |
|
|
|
"example": '"5*6"', |
|
|
|
"detail": "公式或表达式仅支持数字+-/*.()", |
|
|
|
"example": '"A1+5*2^2"', |
|
|
|
"detail": "公式或表达式", |
|
|
|
"require": "m", |
|
|
|
"repeat": "n", |
|
|
|
"type": "rangeall" |
|
|
|
|
|
|
|
@ -9038,6 +9038,20 @@ export default { |
|
|
|
'repeat' : 'n', |
|
|
|
'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: { |
|
|
|
|