Browse Source

fix(locale): locale bug

locale bug
master
liurunze 5 years ago
parent
commit
3bd0cae050
  1. 61
      src/controllers/locationCell.js
  2. 28
      src/controllers/menuButton.js
  3. 5
      src/controllers/sheetmanage.js
  4. 20
      src/global/formula.js
  5. 14
      src/global/tooltip.js
  6. 38
      src/locale/en.js
  7. 27
      src/locale/zh.js

61
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 = '<div class="listbox">'+
'<div class="listItem">'+
'<input type="radio" name="locationType" checked="checked" id="locationConstant">'+
'<label for="locationConstant">常量</label>'+
'<label for="locationConstant">'+locale_location.locationConstant+'</label>'+
'<div class="subbox">'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="date" id="locationConstantDate">'+
'<label for="locationConstantDate">日期</label>'+
'<label for="locationConstantDate">'+locale_location.locationDate+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="number" id="locationConstantNumber">'+
'<label for="locationConstantNumber">数字</label>'+
'<label for="locationConstantNumber">'+locale_location.locationDigital+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="string" id="locationConstantString">'+
'<label for="locationConstantString">字符</label>'+
'<label for="locationConstantString">'+locale_location.locationString+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="boolean" id="locationConstantBoolean">'+
'<label for="locationConstantBoolean">逻辑值</label>'+
'<label for="locationConstantBoolean">'+locale_location.locationBool+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="error" id="locationConstantError">'+
'<label for="locationConstantError">错误</label>'+
'<label for="locationConstantError">'+locale_location.locationBool+'</label>'+
'</div>'+
'</div>'+
'</div>'+
'<div class="listItem">'+
'<input type="radio" name="locationType" id="locationFormula">'+
'<label for="locationFormula">公式</label>'+
'<label for="locationFormula">'+locale_location.locationFormula+'</label>'+
'<div class="subbox">'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="date" id="locationFormulaDate" disabled="true">'+
'<label for="locationFormulaDate" style="color: #666">日期</label>'+
'<label for="locationFormulaDate" style="color: #666">'+locale_location.locationDate+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="number" id="locationFormulaNumber" disabled="true">'+
'<label for="locationFormulaNumber" style="color: #666">数字</label>'+
'<label for="locationFormulaNumber" style="color: #666">'+locale_location.locationDigital+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="string" id="locationFormulaString" disabled="true">'+
'<label for="locationFormulaString" style="color: #666">字符</label>'+
'<label for="locationFormulaString" style="color: #666">'+locale_location.locationString+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="boolean" id="locationFormulaBoolean" disabled="true">'+
'<label for="locationFormulaBoolean" style="color: #666">逻辑值</label>'+
'<label for="locationFormulaBoolean" style="color: #666">'+locale_location.locationBool+'</label>'+
'</div>'+
'<div class="subItem">'+
'<input type="checkbox" checked="checked" class="error" id="locationFormulaError" disabled="true">'+
'<label for="locationFormulaError" style="color: #666">错误</label>'+
'<label for="locationFormulaError" style="color: #666">'+locale_location.locationError+'</label>'+
'</div>'+
'</div>'+
'</div>'+
'<div class="listItem">'+
'<input type="radio" name="locationType" id="locationNull">'+
'<label for="locationNull">空值</label>'+
'<label for="locationNull">'+locale_location.locationNull+'</label>'+
'</div>'+
'<div class="listItem">'+
'<input type="radio" name="locationType" id="locationCF">'+
'<label for="locationCF">条件格式</label>'+
'<label for="locationCF">'+locale_location.locationCondition+'</label>'+
'</div>'+
'<div class="listItem">'+
'<input type="radio" name="locationType" id="locationStepRow">'+
'<label for="locationStepRow">间隔行</label>'+
'<label for="locationStepRow">'+locale_location.locationRowSpan+'</label>'+
'</div>'+
'<div class="listItem">'+
'<input type="radio" name="locationType" id="locationStepColumn">'+
'<label for="locationStepColumn">间隔列</label>'+
'<label for="locationStepColumn">'+locale_location.locationColumnSpan+'</label>'+
'</div>'+
'</div>';
$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-locationCell-dialog",
"addclass": "luckysheet-locationCell-dialog",
"title": "定位条件",
"title": locale_location.location,
"content": content,
"botton": '<button id="luckysheet-locationCell-dialog-confirm" class="btn btn-primary">确定</button><button class="btn btn-default luckysheet-model-close-btn">取消</button>',
"botton": '<button id="luckysheet-locationCell-dialog-confirm" class="btn btn-primary">'+locale_button.confirm+'</button><button class="btn btn-default luckysheet-model-close-btn">'+locale_button.cancel+'</button>',
"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{

28
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("<i class='fa fa-paint-brush'></i> 格式刷开启", "topCenter", true, null, "ESC键退出",function(){
tooltip.popover("<i class='fa fa-paint-brush'></i> "+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("<i class='fa fa-paint-brush'></i> 格式刷开启", "topCenter", true, null, "ESC键退出",function(){
tooltip.popover("<i class='fa fa-paint-brush'></i> "+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(){

5
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"];

20
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);

14
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": '<button class="btn btn-default luckysheet-model-close-btn">&nbsp;&nbsp;关闭&nbsp;&nbsp;</button>',
"botton": '<button class="btn btn-default luckysheet-model-close-btn">&nbsp;&nbsp;'+locale_button.colse+'&nbsp;&nbsp;</button>',
"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 = '<div id="luckysheetpopover" class="luckysheetpopover"><div class="luckysheetpopover-content">格式刷开启</div><div class="luckysheetpopover-btn">'+ btntxt +'</div></div>';
let htmldiv = '<div id="luckysheetpopover" class="luckysheetpopover"><div class="luckysheetpopover-content">'+locale_paint.start+'</div><div class="luckysheetpopover-btn">'+ btntxt +'</div></div>';
$("#luckysheetpopover").remove();
$("body").append(htmldiv);
$("#luckysheetpopover .luckysheetpopover-content").html(content);

38
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: {

27
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: '删除',

Loading…
Cancel
Save