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

Commit

Permalink
fix(locale): locale bug
Browse files Browse the repository at this point in the history
locale bug
  • Loading branch information
Dushusir committed Jul 27, 2020
1 parent 2445ff5 commit 3bd0cae
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 61 deletions.
61 changes: 33 additions & 28 deletions src/controllers/locationCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,90 +7,95 @@ import { modelHTML } from './constant';
import { selectHightlightShow } from './select';
import conditionformat from './conditionformat';
import Store from '../store';
import locale from '../locale/locale';

//定位
const luckysheetLocationCell = {
createDialog: function(){
$("#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(),
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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{
Expand Down
28 changes: 17 additions & 11 deletions src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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(){
Expand Down
5 changes: 4 additions & 1 deletion src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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"];
Expand Down
20 changes: 14 additions & 6 deletions src/global/formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 11 additions & 3 deletions src/global/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 3bd0cae

Please sign in to comment.