diff --git a/src/controllers/locationCell.js b/src/controllers/locationCell.js index 6bbb91f..9a5c8d3 100644 --- a/src/controllers/locationCell.js +++ b/src/controllers/locationCell.js @@ -7,6 +7,7 @@ import { modelHTML } from './constant'; import { selectHightlightShow } from './select'; import conditionformat from './conditionformat'; import Store from '../store'; +import locale from '../locale/locale'; //定位 const luckysheetLocationCell = { @@ -14,83 +15,87 @@ const luckysheetLocationCell = { $("#luckysheet-modal-dialog-mask").show(); $("#luckysheet-locationCell-dialog").remove(); + const _locale = locale(); + const locale_location = _locale.findAndReplace; + const locale_button = _locale.button; + let content = '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'+ ''+ - ''+ + ''+ '
'+ '
'; $("body").append(replaceHtml(modelHTML, { "id": "luckysheet-locationCell-dialog", "addclass": "luckysheet-locationCell-dialog", - "title": "定位条件", + "title": locale_location.location, "content": content, - "botton": '', + "botton": '', "style": "z-index:100003" })); let $t = $("#luckysheet-locationCell-dialog").find(".luckysheet-modal-dialog-content").css("min-width", 400).end(), @@ -166,10 +171,10 @@ const luckysheetLocationCell = { else if(id == "locationStepRow"){ if(Store.luckysheet_select_save.length == 0 || (Store.luckysheet_select_save.length == 1 && Store.luckysheet_select_save[0].row[0] == Store.luckysheet_select_save[0].row[1])){ if(isEditMode()){ - alert("请选择最少两行"); + alert(locale_location.locationTiplessTwoRow); } else{ - tooltip.info("提示", "请选择最少两行"); + tooltip.info("", locale_location.locationTiplessTwoRow); } return; } @@ -181,10 +186,10 @@ const luckysheetLocationCell = { else if(id == "locationStepColumn"){ if(Store.luckysheet_select_save.length == 0 || (Store.luckysheet_select_save.length == 1 && Store.luckysheet_select_save[0].column[0] == Store.luckysheet_select_save[0].column[1])){ if(isEditMode()){ - alert("请选择最少两列"); + alert(locale_location.locationTiplessTwoColumn); } else{ - tooltip.info("提示", "请选择最少两列"); + tooltip.info("", locale_location.locationTiplessTwoColumn); } return; } @@ -262,10 +267,10 @@ const luckysheetLocationCell = { if(ruleArr == null || ruleArr.length == 0){ if(isEditMode()){ - alert("未找到单元格"); + alert(locale_location.locationTipNotFindCell); } else{ - tooltip.info("提示", "未找到单元格"); + tooltip.info("", locale_location.locationTipNotFindCell); } return; @@ -275,10 +280,10 @@ const luckysheetLocationCell = { if(Object.keys(computeMap).length == 0){ if(isEditMode()){ - alert("未找到单元格"); + alert(locale_location.locationTipNotFindCell); } else{ - tooltip.info("提示", "未找到单元格"); + tooltip.info("", locale_location.locationTipNotFindCell); } return; @@ -351,10 +356,10 @@ const luckysheetLocationCell = { if(rangeArr.length == 0){ if(isEditMode()){ - alert("未找到单元格"); + alert(locale_location.locationTipNotFindCell); } else{ - tooltip.info("提示", "未找到单元格"); + tooltip.info("", locale_location.locationTipNotFindCell); } } else{ diff --git a/src/controllers/menuButton.js b/src/controllers/menuButton.js index 1b69e86..f688cd9 100644 --- a/src/controllers/menuButton.js +++ b/src/controllers/menuButton.js @@ -101,26 +101,30 @@ const menuButton = { //格式刷 $("#luckysheet-icon-paintformat").click(function(){ + + let _locale = locale(); + let locale_paint = _locale.paint; + if(Store.luckysheet_select_save == null || Store.luckysheet_select_save.length == 0){ if(isEditMode()){ - alert("请选择需要复制格式的区域"); + alert(locale_paint.tipSelectRange); } else{ - tooltip.info("提示","请选择需要复制格式的区域"); + tooltip.info("",locale_paint.tipSelectRange); } return; } else if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ - alert("无法对多重选择区域执行此操作"); + alert(locale_paint.tipNotMulti); } else{ - tooltip.info("提示","无法对多重选择区域执行此操作"); + tooltip.info("",locale_paint.tipNotMulti); } return; } - tooltip.popover(" 格式刷开启", "topCenter", true, null, "ESC键退出",function(){ + tooltip.popover(" "+locale_paint.start+"", "topCenter", true, null, locale_paint.end,function(){ _this.cancelPaintModel(); }); $("#luckysheet-sheettable_0").addClass("luckysheetPaintCursor"); @@ -152,26 +156,28 @@ const menuButton = { _this.luckysheetPaintSingle = true; }); $("#luckysheet-icon-paintformat").dblclick(function(){ + let _locale = locale(); + let locale_paint = _locale.paint; if(Store.luckysheet_select_save == null || Store.luckysheet_select_save.length == 0){ if(isEditMode()){ - alert("请选择需要复制格式的区域"); + alert(locale_paint.tipSelectRange); } else{ - tooltip.info("提示","请选择需要复制格式的区域"); + tooltip.info("",locale_paint.tipSelectRange); } return; } else if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ - alert("无法对多重选择区域执行此操作"); + alert(locale_paint.tipNotMulti); } else{ - tooltip.info("提示","无法对多重选择区域执行此操作"); + tooltip.info("",locale_paint.tipNotMulti); } return; } - tooltip.popover(" 格式刷开启", "topCenter", true, null, "ESC键退出",function(){ + tooltip.popover(" "+locale_paint.start, "topCenter", true, null, locale_paint.end,function(){ _this.cancelPaintModel(); }); $("#luckysheet-sheettable_0").addClass("luckysheetPaintCursor"); @@ -1434,7 +1440,7 @@ const menuButton = { let menu = replaceHtml(_this.menu, { "id": "rotation-menu", "item": itemset, "subclass": "", "sub": "" }); $("body").append(menu); - $menuButton = $("#" + menuButtonId).width(120); + $menuButton = $("#" + menuButtonId).width(150); _this.focus($menuButton); $menuButton.find(".luckysheet-cols-menuitem").click(function(){ diff --git a/src/controllers/sheetmanage.js b/src/controllers/sheetmanage.js index f928cc3..5e4cc60 100644 --- a/src/controllers/sheetmanage.js +++ b/src/controllers/sheetmanage.js @@ -228,7 +228,7 @@ const sheetmanage = { indicator = indicator.eq(0).data("index"); } else { - indicator = luckysheetcurrentSheetitem.preval(":visible").eq(0).data("index"); + indicator = luckysheetcurrentSheetitem.prevAll(":visible").eq(0).data("index"); } $("#luckysheet-sheets-item" + indicator).addClass("luckysheet-sheets-item-active"); @@ -754,6 +754,9 @@ const sheetmanage = { Store.flowdata = file["data"]; editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据 + formula.execFunctionGroupData = null; + window.luckysheet_getcelldata_cache = null; + luckysheetPostil.buildAllPs(Store.flowdata); Store.config = file["config"]; diff --git a/src/global/formula.js b/src/global/formula.js index 9515f77..3d7a371 100644 --- a/src/global/formula.js +++ b/src/global/formula.js @@ -4370,25 +4370,33 @@ const luckysheetformula = { try { let str = eval(tempFunc); + if(str instanceof Object && str.data!=null){ + str = str.data.v; + } if (this.iscelldata($.trim(str))) { this.isFunctionRangeSaveChange(str, r, c, dynamicArray_compute); - console.log(function_str, str, this.isFunctionRangeSave,r,c); + //console.log(function_str, str, this.isFunctionRangeSave,r,c); } } catch{ } + + } else if (funcName == "OFFSET") { let tempFunc = "luckysheet_offset_check" + function_str.substr(28, function_str.length); - let str = eval(tempFunc); - if (this.iscelldata($.trim(str))) { - this.isFunctionRangeSaveChange(str, r, c, dynamicArray_compute); - - //console.log(function_str, str, this.isFunctionRangeSave,r,c); + try { + let str = eval(tempFunc); + if (this.iscelldata($.trim(str))) { + this.isFunctionRangeSaveChange(str, r, c, dynamicArray_compute); + //console.log(function_str, str, this.isFunctionRangeSave,r,c); + } } + catch{ + } //let result = eval(function_str); //console.log(function_str, result); diff --git a/src/global/tooltip.js b/src/global/tooltip.js index ded7bd1..14dd31b 100644 --- a/src/global/tooltip.js +++ b/src/global/tooltip.js @@ -7,12 +7,16 @@ const tooltip = { info: function (title, content) { $("#luckysheet-modal-dialog-mask").show(); $("#luckysheet-info").remove(); + + let _locale = locale(); + let locale_button = _locale.button; + $("body").append(replaceHtml(modelHTML, { "id": "luckysheet-info", "addclass": "", "title": title, "content": content, - "botton": '', + "botton": '', "style": "z-index:100003" })); let $t = $("#luckysheet-info").find(".luckysheet-modal-dialog-content").css("min-width", 300).end(), @@ -213,11 +217,15 @@ const tooltip = { }); }, popover: function(content, position, close, style, btntxt, exitsFuc){ + let _locale = locale(); + let locale_button = _locale.button; + let locale_paint = _locale.paint; + if(btntxt == null){ - btntxt = "关闭"; + btntxt = locale_button.close; } - let htmldiv = '
格式刷开启
'+ btntxt +'
'; + let htmldiv = '
'+locale_paint.start+'
'+ btntxt +'
'; $("#luckysheetpopover").remove(); $("body").append(htmldiv); $("#luckysheetpopover .luckysheetpopover-content").html(content); diff --git a/src/locale/en.js b/src/locale/en.js index c4bbecb..7d2951d 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -5,8 +5,8 @@ export default { paintFormat: 'Paint format', currencyFormat: 'Format as currency', percentageFormat: 'Format as percent', - decreaseDecimal: 'Decrease decimal places', - increaseDecimal: 'Increase decimal places', + numberDecrease: 'Decrease decimal places', + numberIncrease: 'Increase decimal places', moreFormats:'More formats', font: 'Font', fontSize: 'Font size', @@ -71,10 +71,14 @@ export default { button: { confirm: 'OK', cancel: 'Cancel', + colse:"close" }, - tooltip:{ - paintFormatStart: 'Paint format start', - paintFormatEnd: 'ESC key to exit', + paint:{ + start: 'Paint format start', + end: 'ESC key to exit', + + tipSelectRange:"Please select the range to be copied", + tipNotMulti:"Cannot perform this operation on multiple selection range", }, format:{ moreCurrency: 'More currency formats', @@ -465,10 +469,10 @@ export default { orderAZ: 'A-Z order', orderZA: 'Z-A order', clearContent: 'Clear content', - matrix: 'Matrix operation selection', - sortSelection: 'Sort selection', - filterSelection: 'Filter selection', - chartGeneration: 'Chart generation', + matrix: 'Matrix operation', + sortSelection: 'Sort', + filterSelection: 'Filter', + chartGeneration: 'Create chart', firstLineTitle: 'First line title', untitled: 'Untitled', array1: 'One-dimensional array', @@ -579,6 +583,22 @@ export default { noMatchTip:"No match found", successTip:"${xlength} items found", + + locationConstant:"Constant", + locationFormula:"Formula", + locationDate:"Date", + locationDigital:"number", + locationString:"String", + locationBool:"Logical", + locationError:"Error", + locationNull:"Null", + locationCondition:"Conditional format", + locationRowSpan:"Row span", + locationColumnSpan:"Column span", + + locationTiplessTwoRow:"Please select at least two Row", + locationTiplessTwoColumn:"Please select at least two columns", + locationTipNotFindCell:"Cell not found" }, sheetconfig: { diff --git a/src/locale/zh.js b/src/locale/zh.js index da7ea44..f880de2 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -71,10 +71,14 @@ export default { button: { confirm: '确定', cancel: '取消', + colse:"关闭" }, - tooltip: { - paintFormatStart: '格式刷开启', - paintFormatEnd: 'ESC键退出', + paint: { + start: '格式刷开启', + end: 'ESC键退出', + + tipSelectRange:"请选择需要复制格式的区域", + tipNotMulti:"无法对多重选择区域执行此操作", }, format: { moreCurrency: '更多货币格式', @@ -588,6 +592,23 @@ export default { noMatchTip:"找不到匹配项", successTip:"已经帮您搜索并进行了${xlength}处替换", + + locationConstant:"常量", + locationFormula:"公式", + locationDate:"日期", + locationDigital:"数字", + locationString:"字符", + locationBool:"逻辑值", + locationError:"错误", + locationNull:"空值", + locationCondition:"条件格式", + locationRowSpan:"间隔行", + locationColumnSpan:"间隔列", + + locationTiplessTwoRow:"请选择最少两行", + locationTiplessTwoColumn:"请选择最少两列", + locationTipNotFindCell:"未找到单元格" + }, sheetconfig: { delete: '删除',