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

Commit

Permalink
fix(locale finished and bug fix): locale finished, condition bug fix …
Browse files Browse the repository at this point in the history
…, multi range bug fix
  • Loading branch information
tubiaoge committed Jul 29, 2020
1 parent f23ba5d commit 0aa9b3b
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 49 deletions.
54 changes: 33 additions & 21 deletions src/controllers/alternateformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import luckysheetsizeauto from './resize';
import server from './server';
import { selectHightlightShow } from './select';
import Store from '../store';
import locale from '../locale/locale';

//交替颜色
const alternateformat = {
Expand Down Expand Up @@ -411,18 +412,19 @@ const alternateformat = {
//选择颜色 确定 添加自定义模板
$(document).off("click.AFselectColorConfirm").on("click.AFselectColorConfirm", "#luckysheet-alternateformat-colorSelect-dialog-confirm", function(){
let $parent = $(this).parents("#luckysheet-alternateformat-colorSelect-dialog");

const _locale = locale()
const alternatingColors =_locale.alternatingColors;
$("#luckysheet-modal-dialog-mask").hide();
$parent.hide();

//获取currenColor colorType source
let currenColor = $parent.find(".currenColor span").attr("title");

let colorType;
if($parent.find(".luckysheet-modal-dialog-title-text").text() == "选择文本颜色"){
if($parent.find(".luckysheet-modal-dialog-title-text").text() == alternatingColors.selectionTextColor){
colorType = "fc";
}
else if($parent.find(".luckysheet-modal-dialog-title-text").text() == "选择单元格颜色"){
else if($parent.find(".luckysheet-modal-dialog-title-text").text() == alternatingColors.selectionCellColor){
colorType = "bc";
}

Expand Down Expand Up @@ -712,20 +714,25 @@ const alternateformat = {
$("#luckysheet-modal-dialog-mask").show();
$("#luckysheet-alternateformat-colorSelect-dialog").remove();

const _locale = locale()
const alternatingColors =_locale.alternatingColors;
const locale_button = _locale.button;
const locale_toolbar = _locale.toolbar;

let title;
if(colorType == "fc"){
title = "选择文本颜色";
title = alternatingColors.selectionTextColor;
}
else if(colorType == "bc"){
title = "选择单元格颜色";
title = alternatingColors.selectionCellColor;
}

$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-alternateformat-colorSelect-dialog",
"addclass": "luckysheet-alternateformat-colorSelect-dialog",
"title": title,
"content": "<div class='currenColor' data-source='"+ source +"'>当前颜色:<span title='"+ currenColor +"' style='background-color:"+ currenColor +"'></span></div><div class='colorshowbox'></div>",
"botton": '<button id="luckysheet-alternateformat-colorSelect-dialog-confirm" class="btn btn-primary">确定</button><button class="btn btn-default luckysheet-model-close-btn">取消</button>',
"content": "<div class='currenColor' data-source='"+ source +"'>"+ alternatingColors.currentColor +":<span title='"+ currenColor +"' style='background-color:"+ currenColor +"'></span></div><div class='colorshowbox'></div>",
"botton": '<button id="luckysheet-alternateformat-colorSelect-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-alternateformat-colorSelect-dialog")
Expand Down Expand Up @@ -756,13 +763,13 @@ const alternateformat = {
maxPaletteSize: 8,
maxSelectionSize: 8,
color: currenColor,
cancelText: "取消",
chooseText: "确定颜色",
togglePaletteMoreText: "自定义",
togglePaletteLessText: "收起",
cancelText: locale_button.cancel,
chooseText: locale_toolbar.confirmColor,
togglePaletteMoreText: locale_toolbar.customColor,
togglePaletteLessText: locale_toolbar.collapse,
togglePaletteOnly: true,
clearText: "清除颜色选择",
noColorSelectedText: "没有颜色被选择",
clearText: locale_toolbar.clearText,
noColorSelectedText: locale_toolbar.noColorSelectedText,
localStorageKey: "spectrum.textcolor" + server.gridKey,
palette: [
["#000", "#444", "#666", "#999", "#ccc", "#eee", "#f3f3f3", "#fff"],
Expand Down Expand Up @@ -790,12 +797,16 @@ const alternateformat = {
$("#luckysheet-modal-dialog-mask").hide();
$("#luckysheet-alternateformat-rangeDialog").remove();

const _locale = locale()
const alternatingColors =_locale.alternatingColors;
const locale_button = _locale.button;

$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-alternateformat-rangeDialog",
"addclass": "luckysheet-alternateformat-rangeDialog",
"title": "选择应用范围",
"content": '<input readonly="readonly" placeholder="请选择交替颜色应用范围" value="'+value+'"/>',
"botton": '<button id="luckysheet-alternateformat-rangeDialog-confirm" class="btn btn-primary">确定</button><button id="luckysheet-alternateformat-rangeDialog-close" class="btn btn-default">取消</button>',
"title": alternatingColors.selectRange,
"content": '<input readonly="readonly" placeholder="'+alternatingColors.tipSelectRange+'" value="'+value+'"/>',
"botton": '<button id="luckysheet-alternateformat-rangeDialog-confirm" class="btn btn-primary">'+locale_button.confirm+'</button><button id="luckysheet-alternateformat-rangeDialog-close" class="btn btn-default">'+locale_button.cancel+'</button>',
"style": "z-index:100003"
}));
let $t = $("#luckysheet-alternateformat-rangeDialog")
Expand Down Expand Up @@ -971,7 +982,8 @@ const alternateformat = {
},
update: function(){
let _this = this;

const _locale = locale()
const alternatingColors =_locale.alternatingColors;
//获取标识
let dataIndex = $("#luckysheet-alternateformat-remove").data("index");

Expand All @@ -980,10 +992,10 @@ const alternateformat = {

if(!formula.iscelldata(rangeValue)){
if(isEditMode()){
alert("您选择的应用范围不是选区!");
alert(alternatingColors.errorNoRange);
}
else{
tooltip.info("您选择的应用范围不是选区!", "");
tooltip.info(alternatingColors.errorNoRange, "");
}

return;
Expand All @@ -994,10 +1006,10 @@ const alternateformat = {

if(isExists){
if(isEditMode()){
alert("您选择的应用范围已存在交替颜色且不属于你要编辑的应用范围!");
alert(alternatingColors.errorExistColors);
}
else{
tooltip.info("您选择的应用范围已存在交替颜色且不属于你要编辑的应用范围!", "");
tooltip.info(alternatingColors.errorExistColors, "");
}

return;
Expand Down
5 changes: 4 additions & 1 deletion src/controllers/freezen.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ const luckysheetFreezen = {
cancelFreezenVertical: function (sheetIndex) {
let _this = this;

$("#luckysheet-freezen-btn-vertical").html('<i class="fa fa-indent"></i> 冻结首列');
const _locale = locale();
const locale_freezen = _locale.freezen;

$("#luckysheet-freezen-btn-vertical").html('<i class="fa fa-indent"></i> '+locale_freezen.freezenColumn);
_this.freezenverticaldata = null;
let isvertical = $("#luckysheet-freezebar-vertical").is(":visible");
$("#luckysheet-freezebar-vertical").hide();
Expand Down
14 changes: 7 additions & 7 deletions src/controllers/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,17 @@ export function keyboardInitial(){
//多重选区 行不一样且列不一样时 提示
if(Store.luckysheet_select_save.length > 1){
let isSameRow = true,
str_r = luckysheet_select_save[0].row[0],
end_r = luckysheet_select_save[0].row[1];
str_r = Store.luckysheet_select_save[0].row[0],
end_r = Store.luckysheet_select_save[0].row[1];
let isSameCol = true,
str_c = luckysheet_select_save[0].column[0],
end_c = luckysheet_select_save[0].column[1];
str_c = Store.luckysheet_select_save[0].column[0],
end_c = Store.luckysheet_select_save[0].column[1];

for(let s = 1; s < luckysheet_select_save.length; s++){
if(luckysheet_select_save[s].row[0] != str_r || luckysheet_select_save[s].row[1] != end_r){
for(let s = 1; s < Store.luckysheet_select_save.length; s++){
if(Store.luckysheet_select_save[s].row[0] != str_r || Store.luckysheet_select_save[s].row[1] != end_r){
isSameRow = false;
}
if(luckysheet_select_save[s].column[0] != str_c || luckysheet_select_save[s].column[1] != end_c){
if(Store.luckysheet_select_save[s].column[0] != str_c || Store.luckysheet_select_save[s].column[1] != end_c){
isSameCol = false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2145,8 +2145,8 @@ const menuButton = {
{ "text": conditionformat_text.top10_percent, "value": "top10%", "example": conditionformat_text.top10_percent },
{ "text": conditionformat_text.last10, "value": "last10", "example": conditionformat_text.last10 },
{ "text": conditionformat_text.last10_percent, "value": "last10%", "example": conditionformat_text.last10_percent },
{ "text": conditionformat_text.aboveAverage, "value": "AboveAverage", "example": conditionformat_text.aboveAverage },
{ "text": conditionformat_text.belowAverage, "value": "SubAverage", "example": conditionformat_text.belowAverage }
{ "text": conditionformat_text.aboveAverage, "value": "AboveAverage", "example": conditionformat_text.above },
{ "text": conditionformat_text.belowAverage, "value": "SubAverage", "example": conditionformat_text.below }
];
let subitemset2 = _this.createButtonMenu(subitemdata2);
let submenu2 = replaceHtml(_this.menu, {"id": "projectSelectRule", "item": subitemset2, "subclass": "luckysheet-menuButton-sub"});
Expand Down Expand Up @@ -2240,8 +2240,8 @@ const menuButton = {

$("body").append(menu + submenu + submenu2 + submenu3 + submenu4 + submenu6);
$menuButton = $("#" + menuButtonId).width(190);
$("#luckysheet-icon-highlightCellRule-menuButton").width(130);
$("#luckysheet-icon-projectSelectRule-menuButton").width(170);
$("#luckysheet-icon-highlightCellRule-menuButton").width(160);
$("#luckysheet-icon-projectSelectRule-menuButton").width(180);

$menuButton.find(".luckysheet-cols-menuitem").click(function(){
$menuButton.hide();
Expand Down
10 changes: 5 additions & 5 deletions src/css/luckysheet-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ body:not(.ewa-ipad) .luckysheet-cols-h-cell-nosel:hover, body:not(.ewa-ipad) .lu
/* background: #000; */
bottom: 68px;
left: 10px;
z-index: 100;
z-index: 1000;
}

#luckysheet-bottom-add-row{
Expand Down Expand Up @@ -4467,7 +4467,7 @@ fieldset[disabled] a.btn {

.luckysheet-freezebar-vertical-drop-bar {
width: 4px;
background-color: #ababab;
background-color: #f3f3f2;
border-width: 2px 1px 2px 2px;
margin-top: 19px;
top: 0px;
Expand All @@ -4476,7 +4476,7 @@ fieldset[disabled] a.btn {

.luckysheet-freezebar-vertical-drop-title {
width: 4px;
background: #616161;
background: #bcbdbc;
/* opacity: 0.80;
filter: alpha(opacity=80);*/
height: 19px;
Expand Down Expand Up @@ -4534,7 +4534,7 @@ fieldset[disabled] a.btn {
.luckysheet-freezebar-horizontal-drop-bar {
height: 4px;
overflow: hidden;
background-color: #ababab;
background-color: #f3f3f2;
border-width: 2px 2px 1px 2px;
margin-left: 45px;
left: 0px;
Expand All @@ -4544,7 +4544,7 @@ fieldset[disabled] a.btn {

.luckysheet-freezebar-horizontal-drop-title {
height: 4px;
background: #616161;
background: #bcbdbc;
/* opacity: 0.80;
filter: alpha(opacity=80);*/
width: 45px;
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

luckysheet.create({
container: 'luckysheet',
lang: 'zh',
lang: 'en',
plugins: ['chart'],
data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetSparkline,sheetComment,sheetPivotTableData,sheetPivotTable]
})
Expand Down
19 changes: 15 additions & 4 deletions src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export default {
selectionCellColor:"Click to select cell color",
removeColor:"Remove alternating colors",
colorShow:"color",
currentColor:"Current",

tipSelectRange:"Please select the range of alternating colors",
errorNoRange:"No range is selected",
errorExistColors:"Alternating colors already exist and cannot be edited",
},
button: {
confirm: 'OK',
Expand Down Expand Up @@ -285,7 +290,11 @@ export default {
{ "text": 'Scientific', "value": "0.00E+00", "example": "1.01E+5" },
{ "text": "", "value": "split", "example": "" },
{ "text": 'Accounting', "value": "¥(0.00)", "example": "¥(1200.09)" },


{ "text": 'Currency', "value": "¥0.00", "example": "¥1200.09" },


{ "text": "", "value": "split", "example": "" },
{ "text": 'Date', "value": "yyyy-MM-dd", "example": "2017-11-29" },
{ "text": 'Time', "value": "hh:mm AM/PM", "example": "3:00 PM" },
Expand Down Expand Up @@ -412,6 +421,8 @@ export default {
"columnOperation":"Column",
"secondaryTitle":"then by",

"sortTitle":"Sort range",

"sortRangeTitle":"Sort range from",
"sortRangeTitleTo":"to",

Expand Down Expand Up @@ -755,7 +766,7 @@ export default {
pleaseSelectIcon: 'Please click to select a group of icons:',
cellValue: 'Cell value',
specificText: 'Specific text',
occurrence: 'Date of occurrence',
occurrence: 'Date',
greaterThan: 'Greater than',
lessThan: 'Less than',
between: 'Between',
Expand All @@ -778,7 +789,7 @@ export default {
below: 'Below',
belowAverage: 'Below average',
all: 'All',
yesterday: 'Yesterday',
yesterday: 'YTD',
today: 'Today',
tomorrow: 'Tomorrow',
lastWeek: 'Last week',
Expand All @@ -796,8 +807,8 @@ export default {
editRuleDescription: 'Edit rule description',
newFormatRule: 'New format rule',
editFormatRule: 'Edit format rule',
formatStyle: 'Format style',
fillType: 'Fill type',
formatStyle: 'Style',
fillType: 'Fill',
color: 'Color',
twocolor: 'Two-color',
tricolor: 'Tricolor',
Expand Down
15 changes: 9 additions & 6 deletions src/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
customColor: '自定义',
alternatingColors: '交替颜色',
confirmColor: '确定颜色',
cancelColor: '取消',
collapse: '收起',
fillColor: '单元格颜色',
border: '边框',
Expand Down Expand Up @@ -52,7 +53,6 @@ export default {
toolLess:"少于",
toolClose:"收起",
toolMoreTip:"更多功能",

},
alternatingColors:{
applyRange: '应用范围',
Expand All @@ -64,10 +64,15 @@ export default {
textTitle:"格式样式",
custom:"自定义",
close:"关闭",
selectionTextColor:"点击选择文本颜色",
selectionCellColor:"点击选择单元格颜色",
selectionTextColor:"选择文本颜色",
selectionCellColor:"选择单元格颜色",
removeColor:"移除交替颜色",
colorShow:"颜色",
currentColor:"当前颜色",

tipSelectRange:"请选择交替颜色应用范围",
errorNoRange:"您选择的应用范围不是选区!",
errorExistColors:"您选择的应用范围已存在交替颜色且不属于你要编辑的应用范围!",
},
button: {
confirm: '确定',
Expand Down Expand Up @@ -96,8 +101,8 @@ export default {
detailSave: '已恢复本地缓存',
row: '行',
column: '列',

loading:"渲染中",

copy:"副本",
return:"返回",
rename:"重命名",
Expand Down Expand Up @@ -467,8 +472,6 @@ export default {
filterCancel:"取 消",
clearFilter:"清除筛选",



conditionNone:"无",
conditionCellIsNull:"单元格为空",
conditionCellNotNull:"单元格有数据",
Expand Down

0 comments on commit 0aa9b3b

Please sign in to comment.