diff --git a/src/controllers/constant.js b/src/controllers/constant.js index 34ce534b2..1cf06b5bf 100644 --- a/src/controllers/constant.js +++ b/src/controllers/constant.js @@ -167,276 +167,265 @@ const gridHTML = '
' + colsmenuHTML = ''; //右键菜单dom -const rightclickHTML = '
' - +'
' - +'
复制
' - +'
' - +'
' - +'
' - +'复制为' - +'
' - +'
' - +'
' - +'
粘贴
' - +'
' - +'
' - +'' - +'
' - +'
' - +'插入' - +'
' - +'
' - +'
' - +'
' - +'删除' - +'
' - +'
' - +'
' - +'
' - +'隐藏' - +'
' - +'
' - +'
' - +'
' - +'' - +'
' - +'
' - +'向' - +'' - +'增加' - +'' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'向' - +'' - +'增加' - +'' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'删除选中' - +'' - +'
' - +'
' - +'
' - +'
' - +'' - +'' - +'' - +'px' - +'' - +'
' - +'
' - +'
' - +'
' - +'' - +'
' - +'
A-Z顺序排列
' - +'
' - +'
' - +'
Z-A降序排列
' - +'
' - +'
' - +'
' - +'' - +'
' - +'
清除内容
' - +'
' - +'
' - +'
' - +'矩阵操作选区' - +'
' - +'
' - +'
' - +'
排序选区
' - +'
' - +'
' - +'
筛选选区
' - +'
' - +'
' - +'
图表生成
' - +'
' - +'
' - +'
' - //复制为 二级菜单 - +'
' - +'
' - +'
' - +'Json' - +'' - +'' - +'
' - +'
' - +'
' - +'
一维数组
' - +'
' - +'
' - +'
二维数组
' - +'
' - +'
' - +'
' - +'
多维数组
' - +'
' - +'' - +'×' - +'' - +'' - +'
' - +'
' - +'
' - +'' - +'
' - +'
对角线
' - +'
' - +'
' - +'
反对角线
' - +'
' - +'
' - +'
' - +'对角偏移' - +'' - +'列' - +'' - +'
' - +'
' - +'
' - +'
布尔值
' - +'
' - +'
' - //插入 二级菜单 - +'
' - +'
' - +'
' - +'向上增加' - +'' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'向下增加' - +'' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'向左增加' - +'' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'向右增加' - +'' - +'' - +'' - +'
' - +'
' - +'
' - //删除 二级菜单 - +'
' - +'
' - +'
' - +'删除选中行' - +'
' - +'
' - +'
' - +'
' - +'删除选中列' - +'
' - +'
' - +'
' - //隐藏 二级菜单 - +'
' - +'
' - +'
' - +'隐藏选中行' - +'
' - +'
' - +'
' - +'
' - +'显示隐藏行' - +'
' - +'
' - // +'
' - // +'
' - // +'隐藏选中列' - // +'
' - // +'
' - // +'
' - // +'
' - // +'显示隐藏列' - // +'
' - // +'
' - +'
' - //矩阵操作选区 二级菜单 - +'
' - +'
' - +'
' - +'翻转' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'翻转' - +'' - +'' - +'
' - +'
' - +'
' - +'
转置
' - +'
' - +'' - +'
' - +'
' - +'
矩阵计算
' - +'
' - +'' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'
' - +'删除两端0值' - +'' - +'' - +'
' - +'
' - +'
' - +'
' - +'删除重复值' - +'' - +'' - +'
' - +'
' - +'
' - +'
生成新矩阵
' - +'
' - +'
'; +function rightclickHTML(){ + const rightclick = locale().rightclick; + + return `
+
+
${rightclick.copy}
+
+
+
+ ${rightclick.copyAs} +
+
+
+
${rightclick.paste}
+
+
+ +
+
+ ${rightclick.insert} +
+
+
+
+ ${rightclick.delete} +
+
+
+
+ ${rightclick.hide} +
+
+
+
+ +
+
+ ${rightclick.to} + ${rightclick.left} + ${rightclick.add} + + ${rightclick.column} + +
+
+
+
+ ${rightclick.to} + ${rightclick.right} + ${rightclick.add} + + ${rightclick.column} + +
+
+
+
+ ${rightclick.deleteSelected} + ${rightclick.column} +
+
+
+
+ ${rightclick.column} + ${rightclick.width} + + px + +
+
+
+
+ +
+
${rightclick.orderAZ}
+
+
+
${rightclick.orderZA}
+
+
+
+ +
+
${rightclick.clearContent}
+
+
+
+ ${rightclick.matrix} +
+
+
+
${rightclick.sortSelection}
+
+
+
${rightclick.filterSelection}
+
+
+
${rightclick.chartGeneration}
+
+
+
+
+
+
+ Json + + +
+
+
+
${rightclick.array1}
+
+
+
${rightclick.array2}
+
+
+
+
${rightclick.array3}
+
+ + × + + +
+
+
+ +
+
${rightclick.diagonal}
+
+
+
${rightclick.antiDiagonal}
+
+
+
+ ${rightclick.diagonalOffset} + + ${rightclick.column} + +
+
+
+
${rightclick.boolean}
+
+
+
+
+
+ ${rightclick.to}${rightclick.top}${rightclick.add} + + ${rightclick.row} + +
+
+
+
+ ${rightclick.to}${rightclick.bottom}${rightclick.add} + + ${rightclick.row} + +
+
+
+
+ ${rightclick.to}${rightclick.left}${rightclick.add} + + ${rightclick.column} + +
+
+
+
+ ${rightclick.to}${rightclick.right}${rightclick.add} + + ${rightclick.column} + +
+
+
+
+
+
+ ${rightclick.deleteSelected}${rightclick.row} +
+
+
+
+ ${rightclick.deleteSelected}${rightclick.column} +
+
+
+
+
+
+ ${rightclick.hideSelected}${rightclick.row} +
+
+
+
+ ${rightclick.showHide}${rightclick.row} +
+
+
+
+
+
+ ${rightclick.flip} + + +
+
+
+
+ ${rightclick.flip} + + +
+
+
+
${rightclick.transpose}
+
+ +
+
+
${rightclick.matrixCalculation}
+
+ + + +
+
+
+
+
+ ${rightclick.delete0} + + +
+
+
+
+ ${rightclick.removeDuplicate} + + +
+
+
+
${rightclick.generateNewMatrix}
+
+
` +} const pivottableconfigHTML = '
排序
排序依据
显示总计
', pivottablesumHTML = '
求和
数值计数
计数
去重计数
平均值
最大值
最小值
中位数
乘积
标准差
整体标准差
方差
整体方差
', diff --git a/src/controllers/handler.js b/src/controllers/handler.js index 07a326c76..184e32356 100644 --- a/src/controllers/handler.js +++ b/src/controllers/handler.js @@ -71,6 +71,7 @@ import { update, genarate } from '../global/format'; import method from '../global/method'; import { getBorderInfoCompute } from '../global/border'; import { luckysheetDrawMain } from '../global/draw'; +import locale from '../locale/locale'; import Store from '../store'; //, columeflowset, rowflowset @@ -884,10 +885,10 @@ export default function luckysheetHandler() { if (obj_s["row"] != null && obj_s["row"][0] == 0 && obj_s["row"][1] == Store.flowdata.length - 1) { Store.luckysheetRightHeadClickIs = "column"; - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text("列"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text("宽"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text("左"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text("右"); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text(locale().rightclick.column); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text(locale().rightclick.width); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text(locale().rightclick.left); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text(locale().rightclick.right); $("#luckysheet-cols-rows-add").show(); $("#luckysheet-cols-rows-data").show(); @@ -929,10 +930,10 @@ export default function luckysheetHandler() { else if (obj_s["column"] != null && obj_s["column"][0] == 0 && obj_s["column"][1] == Store.flowdata[0].length - 1) { Store.luckysheetRightHeadClickIs = "row"; - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text("行"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text("高"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text("上"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text("下"); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text(locale().rightclick.row); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text(locale().rightclick.height); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text(locale().rightclick.top); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text(locale().rightclick.bottom); $("#luckysheet-cols-rows-add").show(); $("#luckysheet-cols-rows-data").show(); @@ -4536,10 +4537,10 @@ export default function luckysheetHandler() { $("#luckysheet-cols-rows-shift").hide(); Store.luckysheetRightHeadClickIs = "row"; - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text("行"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text("高"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text("上"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text("下"); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text(locale().rightclick.row); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text(locale().rightclick.height); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text(locale().rightclick.top); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text(locale().rightclick.bottom); $("#luckysheet-cols-rows-add").show(); $("#luckysheet-cols-rows-data").show(); @@ -4924,10 +4925,10 @@ export default function luckysheetHandler() { } Store.luckysheetRightHeadClickIs = "column"; - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text("列"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text("宽"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text("左"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text("右"); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text(locale().rightclick.column); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-size").text(locale().rightclick.width); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text(locale().rightclick.left); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text(locale().rightclick.right); $("#luckysheet-cols-rows-add").show(); $("#luckysheet-cols-rows-data").show(); @@ -5192,9 +5193,9 @@ export default function luckysheetHandler() { let offset = $(this).offset(); $("#luckysheet-cols-rows-shift").show(); Store.luckysheetRightHeadClickIs = "column"; - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text("列"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text("左"); - $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text("右"); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-word").text(locale().rightclick.column); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text(locale().rightclick.left); + $("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text(locale().rightclick.right); $("#luckysheet-cols-rows-add").show(); $("#luckysheet-cols-rows-data").hide(); diff --git a/src/function/func.js b/src/function/func.js index a97173607..c027dccba 100644 --- a/src/function/func.js +++ b/src/function/func.js @@ -184,11 +184,12 @@ function luckysheet_compareWith() { fp[m][n] = booleanToNum(fp[m][n]); tp[m][n] = booleanToNum(tp[m][n]); + let value; if(isRealNum(fp[m][n]) && isRealNum(tp[m][n])){ - let value = parseFloat(fp[m][n]) * parseFloat(tp[m][n]); + value = parseFloat(fp[m][n]) * parseFloat(tp[m][n]); } else{ - let value = error.v; + value = error.v; } rowArr.push(value); diff --git a/src/global/createdom.js b/src/global/createdom.js index 067148754..976c6a0c8 100644 --- a/src/global/createdom.js +++ b/src/global/createdom.js @@ -97,7 +97,7 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit //新建行菜单 $("body").append(maskHTML); $("body").append(colsmenuHTML); - $("body").append(rightclickHTML); + $("body").append(rightclickHTML()); $("body").append(inputHTML); $("body").append(replaceHtml(filtermenuHTML, { "menuid": "filter" })); $("body").append(replaceHtml(filtersubmenuHTML, { "menuid": "filter" })); diff --git a/src/global/draw.js b/src/global/draw.js index feb0bdcb2..3e003832e 100644 --- a/src/global/draw.js +++ b/src/global/draw.js @@ -776,7 +776,8 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of luckysheetTableContent.font = fontset; let textMetrics = luckysheetTableContent.measureText(value).width; - let oneLineTextHeight = menuButton.getTextSize("田", fontset)[1]; + // let oneLineTextHeight = menuButton.getTextSize("田", fontset)[1]; + let oneLineTextHeight = menuButton.getTextSize(value, fontset)[1]; let textW, textH; diff --git a/src/locale/en.js b/src/locale/en.js index 66ea980ee..8f097a9c4 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -312,6 +312,65 @@ export default { MicrosoftYaHei:"YaHei", }, fontarray: ["Times New Roman","Arial","Tahoma","Verdana"], - fontjson: {"arial":1,"times new roman":0,"tahoma":2,"verdana":3} + fontjson: {"arial":1,"times new roman":0,"tahoma":2,"verdana":3}, + rightclick: { + copy: 'Copy', + copyAs: 'Copy as', + paste: 'Paste', + insert: 'Insert', + delete: 'Delete', + deleteSelected: 'Delete selected ', + hide: 'Hide', + hideSelected: 'Hide selected ', + showHide: 'Show hide', + to: 'Towards', + left: 'Left', + right: 'Right', + top: 'Top', + bottom: 'Bottom', + add: 'Add', + row: 'Row', + column: 'Column', + width: 'Width', + height: 'Height', + number: 'Number', + confirm: 'Confirm', + orderAZ: 'A-Z order', + orderZA: 'Z-A order', + clearContent: 'Clear content', + matrix: 'Matrix operation selection', + sortSelection: 'Sort selection', + filterSelection: 'Filter selection', + chartGeneration: 'Chart generation', + firstLineTitle: 'First line title', + untitled: 'Untitled', + array1: 'One-dimensional array', + array2: 'Two-dimensional array', + array3: 'Multidimensional Arrays', + diagonal: 'Diagonal', + antiDiagonal: 'Anti-diagonal', + diagonalOffset: 'Diagonal offset', + offset: 'Offset', + Boolean: '布尔值', + flip: 'Flip', + upAndDown: 'Up and down', + leftAndRight: 'Left and right', + clockwise: 'Clockwise', + counterclockwise: 'Counterclockwise', + transpose: 'Transpose', + matrixCalculation: 'Matrix calculation', + plus: 'Plus', + minus: 'Minus', + multiply: 'Multiply', + divided: 'Divided', + power: 'Power', + root: 'Root', + log: 'Log', + delete0: 'Delete 0 values at both ends', + removeDuplicate: 'Remove duplicate values', + byRow: 'By row', + byCol: 'By column', + generateNewMatrix: 'Generate new matrix', + } }; \ No newline at end of file diff --git a/src/locale/zh.js b/src/locale/zh.js index da3e9aa77..e062e66eb 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -333,6 +333,64 @@ export default { MicrosoftYaHei:"Microsoft YaHei", }, fontarray: ["微软雅黑","宋体","黑体","楷体","仿宋","新宋体","华文新魏","华文行楷","华文隶书","Arial","Times New Roman","Tahoma","Verdana"], - fontjson: {"微软雅黑":0,"microsoft yahei":0,"宋体":1,"simsun":1,"黑体":2,"simhei":2,"楷体":3,"kaiti":3,"仿宋":4,"fangsong":4,"新宋体":5,"nsimsun":5,"华文新魏":6,"stxinwei":6,"华文行楷":7,"stxingkai":7,"华文隶书":8,"stliti":8,"arial":9,"times new roman":10,"tahoma":11,"verdana":12} - + fontjson: {"微软雅黑":0,"microsoft yahei":0,"宋体":1,"simsun":1,"黑体":2,"simhei":2,"楷体":3,"kaiti":3,"仿宋":4,"fangsong":4,"新宋体":5,"nsimsun":5,"华文新魏":6,"stxinwei":6,"华文行楷":7,"stxingkai":7,"华文隶书":8,"stliti":8,"arial":9,"times new roman":10,"tahoma":11,"verdana":12}, + rightclick: { + copy: '复制', + copyAs: '复制为', + paste: '粘贴', + insert: '插入', + delete: '删除', + deleteSelected: '删除选中', + hide: '隐藏', + hideSelected: '隐藏选中', + showHide: '显示隐藏', + to: '向', + left: '左', + right: '右', + top: '上', + bottom: '下', + add: '增加', + row: '行', + column: '列', + width: '宽', + height: '高', + number: '数字', + confirm: '确认', + orderAZ: 'A-Z顺序排列', + orderZA: 'Z-A降序排列', + clearContent: '清除内容', + matrix: '矩阵操作选区', + sortSelection: '排序选区', + filterSelection: '筛选选区', + chartGeneration: '图表生成', + firstLineTitle: '首行为标题', + untitled: '无标题', + array1: '一维数组', + array2: '二维数组', + array3: '多维数组', + diagonal: '对角线', + antiDiagonal: '反对角线', + diagonalOffset: '对角偏移', + offset: '偏移量', + boolean: '布尔值', + flip: '翻转', + upAndDown: '上下', + leftAndRight: '左右', + clockwise: '顺时针', + counterclockwise: '逆时针', + transpose: '转置', + matrixCalculation: '矩阵计算', + plus: '加', + minus: '减', + multiply: '乘', + divided: '除', + power: '次方', + root: '次方根', + log: 'log', + delete0: '删除两端0值', + removeDuplicate: '删除重复值', + byRow: '按行', + byCol: '按列', + generateNewMatrix: '生成新矩阵', + } };