diff --git a/src/controllers/selection.js b/src/controllers/selection.js
index 8400866..c01dca3 100644
--- a/src/controllers/selection.js
+++ b/src/controllers/selection.js
@@ -29,7 +29,7 @@ const selection = {
Store.luckysheet_selection_range = [];
selectionCopyShow();
// Store.luckysheet_copy_save = {};
-
+
if (!clipboardData) {
let textarea = $("#luckysheet-copy-content").css("visibility", "hidden");
textarea.val(cpdata);
@@ -46,19 +46,19 @@ const selection = {
getHtmlBorderStyle: function(type, color){
let style = "";
let borderType = {
- "0": "none",
- "1": "Thin",
- "2": "Hair",
- "3": "Dotted",
- "4": "Dashed",
- "5": "DashDot",
- "6": "DashDotDot",
- "7": "Double",
- "8": "Medium",
- "9": "MediumDashed",
- "10": "MediumDashDot",
- "11": "MediumDashDotDot",
- "12": "SlantedDashDot",
+ "0": "none",
+ "1": "Thin",
+ "2": "Hair",
+ "3": "Dotted",
+ "4": "Dashed",
+ "5": "DashDot",
+ "6": "DashDotDot",
+ "7": "Double",
+ "8": "Medium",
+ "9": "MediumDashed",
+ "10": "MediumDashDot",
+ "11": "MediumDashDotDot",
+ "12": "SlantedDashDot",
"13": "Thick"
};
type = borderType[type.toString()];
@@ -70,7 +70,7 @@ const selection = {
style += "1.5pt ";
}
else {
- style += "0.5pt ";
+ style += "0.5pt ";
}
if(type == "Hair"){
@@ -83,7 +83,7 @@ const selection = {
style += "dashed ";
}
else if(type.indexOf("Dotted") > -1){
- style += "dotted ";
+ style += "dotted ";
}
else if(type.indexOf("Dashed") > -1){
style += "dashed ";
@@ -150,26 +150,26 @@ const selection = {
selectionCopyShow();
//luckysheet内copy保存
- Store.luckysheet_copy_save = {
- "dataSheetIndex": Store.currentSheetIndex,
- "copyRange": copyRange,
- "RowlChange": RowlChange,
- "HasMC": HasMC
+ Store.luckysheet_copy_save = {
+ "dataSheetIndex": Store.currentSheetIndex,
+ "copyRange": copyRange,
+ "RowlChange": RowlChange,
+ "HasMC": HasMC
};
//copy范围数据拼接成table 赋给剪贴板
let _this = this;
-
+
let borderInfoCompute;
if(Store.config["borderInfo"] && Store.config["borderInfo"].length > 0){ //边框
borderInfoCompute = getBorderInfoCompute();
}
- let cpdata = "",
+ let cpdata = "",
d = editor.deepCopyFlowData(Store.flowdata);
let colgroup = "";
- // rowIndexArr = rowIndexArr.sort();
+ // rowIndexArr = rowIndexArr.sort();
// colIndexArr = colIndexArr.sort();
for (let i = 0; i < rowIndexArr.length; i++) {
@@ -228,9 +228,9 @@ const selection = {
//边框
if(borderInfoCompute && borderInfoCompute[r + "_" + c]){
- let bl_obj = { "color": {}, "style": {} },
- br_obj = { "color": {}, "style": {} },
- bt_obj = { "color": {}, "style": {} },
+ let bl_obj = { "color": {}, "style": {} },
+ br_obj = { "color": {}, "style": {} },
+ bt_obj = { "color": {}, "style": {} },
bb_obj = { "color": {}, "style": {} };
for(let bd_r = r; bd_r < (r + d[r][c]["mc"].rs); bd_r++){
@@ -276,7 +276,7 @@ const selection = {
if(bd_c == c && borderInfoCompute[bd_r + "_" + bd_c] && borderInfoCompute[bd_r + "_" + bd_c].l){
let linetype = borderInfoCompute[r + "_" + c].l.style;
let bcolor = borderInfoCompute[bd_r + "_" + bd_c].l.color;
-
+
if(bl_obj["style"][linetype] == null){
bl_obj["style"][linetype] = 1;
}
@@ -440,14 +440,14 @@ const selection = {
}
if(c_value == null){
- c_value = " ";
+ c_value = "";
}
column += c_value;
}
else {
let style = "";
-
+
//边框
if(borderInfoCompute && borderInfoCompute[r + "_" + c]){
//左边框
@@ -500,7 +500,7 @@ const selection = {
}
column = replaceHtml(column, {"style": style, "span": ""});
- column += " ";
+ column += "";
}
column += '';
@@ -510,7 +510,7 @@ const selection = {
cpdata += "";
}
cpdata = '
' + colgroup + cpdata + '
';
-
+
Store.iscopyself = true;
if (!clipboardData) {
@@ -522,14 +522,15 @@ const selection = {
// document.execCommand("Copy");
// 等50毫秒,keyPress事件发生了再去处理数据
- // setTimeout(function () {
- // $("#luckysheet-copy-content").blur();
+ // setTimeout(function () {
+ // $("#luckysheet-copy-content").blur();
// }, 10);
var oInput = document.createElement('input');
+ oInput.setAttribute('readonly', 'readonly');
oInput.value = cpdata;
document.body.appendChild(oInput);
- oInput.select(); // 选择对象
+ oInput.setSelectionRange(0, cpdata.length);
document.execCommand("Copy");
oInput.style.display='none';
document.body.removeChild(oInput);
@@ -566,7 +567,7 @@ const selection = {
return false;//否则设不生效
}
},
- isPasteAction: false,
+ isPasteAction: false,
paste: function (e, triggerType) {//paste事件
let _this = this;
@@ -622,7 +623,7 @@ const selection = {
alert("不能对多重选择区域执行此操作,请选择单个区域,然后再试");
}
else{
- tooltip.info('提示', "不能对多重选择区域执行此操作,请选择单个区域,然后再试");
+ tooltip.info('提示', "不能对多重选择区域执行此操作,请选择单个区域,然后再试");
}
}
@@ -641,27 +642,27 @@ const selection = {
let copyh = data.length, copyc = data[0].length;
let minh = Store.luckysheet_select_save[0].row[0], //应用范围首尾行
- maxh = minh + copyh - 1;
+ maxh = minh + copyh - 1;
let minc = Store.luckysheet_select_save[0].column[0], //应用范围首尾列
- maxc = minc + copyc - 1;
+ maxc = minc + copyc - 1;
//应用范围包含部分合并单元格,则return提示
let has_PartMC = false;
if(cfg["merge"] != null){
has_PartMC = hasPartMC(cfg, minh, maxh, minc, maxc);
}
-
+
if(has_PartMC){
if(isEditMode()){
alert("不能对合并单元格做部分更改");
}
else{
- tooltip.info('提示', "不能对合并单元格做部分更改");
+ tooltip.info('提示', "不能对合并单元格做部分更改");
}
return;
}
-
+
let d = editor.deepCopyFlowData(Store.flowdata);//取数据
let rowMaxLength = d.length;
let cellMaxLength = d[0].length;
@@ -675,12 +676,12 @@ const selection = {
if(cfg["rowlen"] == null){
cfg["rowlen"] = {};
}
-
+
let RowlChange = false;
let offsetMC = {};
for (let h = minh; h <= maxh; h++) {
let x = [].concat(d[h]);
-
+
let currentRowLen = Store.defaultrowlen;
if(cfg["rowlen"][h] != null){
currentRowLen = cfg["rowlen"][h];
@@ -709,29 +710,29 @@ const selection = {
cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c] = x[c]["mc"];
- offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
+ offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
}
else{
- x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
+ x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
}
}
if(borderInfo[(h - minh) + "_" + (c - minc)]){
let bd_obj = {
"rangeType": "cell",
- "value": {
- "row_index": h,
- "col_index": c,
- "l": borderInfo[(h - minh) + "_" + (c - minc)].l,
+ "value": {
+ "row_index": h,
+ "col_index": c,
+ "l": borderInfo[(h - minh) + "_" + (c - minc)].l,
"r": borderInfo[(h - minh) + "_" + (c - minc)].r,
"t": borderInfo[(h - minh) + "_" + (c - minc)].t,
- "b": borderInfo[(h - minh) + "_" + (c - minc)].b
+ "b": borderInfo[(h - minh) + "_" + (c - minc)].b
}
}
cfg["borderInfo"].push(bd_obj);
}
-
+
let fontset = luckysheetfontformat(x[c]);
let oneLineTextHeight = menuButton.getTextSize("田", fontset)[1];
//比较计算高度和当前高度取最大高度
@@ -748,8 +749,8 @@ const selection = {
}
Store.luckysheet_select_save = [{ "row": [minh, maxh], "column": [minc, maxc] }];
-
-
+
+
if(addr > 0 || addc > 0 || RowlChange){
let allParam = {
"cfg": cfg,
@@ -768,9 +769,9 @@ const selection = {
else {
data = data.replace(/\r/g, "");
let dataChe = [];
- let che = data.split("\n"),
+ let che = data.split("\n"),
colchelen = che[0].split("\t").length;
-
+
for (let i = 0; i < che.length; i++) {
if (che[i].split("\t").length < colchelen) {
continue;
@@ -778,7 +779,7 @@ const selection = {
dataChe.push(che[i].split("\t"));
}
-
+
let d = editor.deepCopyFlowData(Store.flowdata);//取数据
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
@@ -791,13 +792,13 @@ const selection = {
if(Store.config["merge"] != null){
has_PartMC = hasPartMC(Store.config, curR, curR + rlen - 1, curC, curC + clen - 1);
}
-
+
if(has_PartMC){
if(isEditMode()){
alert("不能对合并单元格做部分更改");
}
else{
- tooltip.info('提示',"不能对合并单元格做部分更改");
+ tooltip.info('提示',"不能对合并单元格做部分更改");
}
return;
}
@@ -810,7 +811,7 @@ const selection = {
for (let r = 0; r < rlen; r++) {
let x = [].concat(d[r + curR]);
for (let c = 0; c < clen; c++) {
-
+
let value = dataChe[r][c];
if(isRealNum(value)){
value = parseFloat(value);
@@ -824,7 +825,7 @@ const selection = {
else{
originCell.m = value;
}
-
+
if(originCell.f!=null && originCell.f.length>0){
originCell.f = "";
formula.delFunctionGroup(r + curR,c + curC,Store.currentSheetIndex);
@@ -839,7 +840,7 @@ const selection = {
x[c + curC] = cell;
}
-
+
}
d[r + curR] = x;
}
@@ -896,13 +897,13 @@ const selection = {
if(cfg["merge"] != null){
has_PartMC = hasPartMC(cfg, minh, maxh, minc, maxc);
}
-
+
if(has_PartMC){
if(isEditMode()){
alert("不能对合并单元格做部分更改");
}
else{
- tooltip.info('提示',"不能对合并单元格做部分更改");
+ tooltip.info('提示',"不能对合并单元格做部分更改");
}
return;
}
@@ -919,7 +920,7 @@ const selection = {
let borderInfoCompute = getBorderInfoCompute(copySheetIndex);
let c_dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(copySheetIndex)]["dataVerification"]);
let dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"]);
-
+
//剪切粘贴在当前表操作,删除剪切范围内数据、合并单元格和数据验证
if(Store.currentSheetIndex == copySheetIndex){
for(let i = c_r1; i <= c_r2; i++){
@@ -952,9 +953,9 @@ const selection = {
for(let j = 0; j < bd_range.length; j++){
bd_emptyRange = bd_emptyRange.concat(conditionformat.CFSplitRange(
- bd_range[j],
- {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
- {"row": [minh, maxh], "column": [minc, maxc]},
+ bd_range[j],
+ {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
+ {"row": [minh, maxh], "column": [minc, maxc]},
"restPart"
));
}
@@ -1047,10 +1048,10 @@ const selection = {
cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c] = x[c]["mc"];
- offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
+ offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
}
else{
- x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
+ x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
}
}
}
@@ -1060,7 +1061,7 @@ const selection = {
last["row"] = [minh, maxh];
last["column"] = [minc, maxc];
-
+
//若有行高改变,重新计算行高改变
if(copyRowlChange){
if(Store.currentSheetIndex != copySheetIndex){
@@ -1115,9 +1116,9 @@ const selection = {
for(let j = 0; j < bd_range.length; j++){
bd_emptyRange = bd_emptyRange.concat(conditionformat.CFSplitRange(
- bd_range[j],
- {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
- {"row": [minh, maxh], "column": [minc, maxc]},
+ bd_range[j],
+ {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
+ {"row": [minh, maxh], "column": [minc, maxc]},
"restPart"
));
}
@@ -1151,18 +1152,18 @@ const selection = {
for(let j = 0; j < source_curCdformat_cellrange.length; j++){
let range = conditionformat.CFSplitRange(
- source_curCdformat_cellrange[j],
- {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
- {"row": [minh, maxh], "column": [minc, maxc]},
+ source_curCdformat_cellrange[j],
+ {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
+ {"row": [minh, maxh], "column": [minc, maxc]},
"restPart"
);
emptyRange = emptyRange.concat(range);
let range2 = conditionformat.CFSplitRange(
- source_curCdformat_cellrange[j],
- {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
- {"row": [minh, maxh], "column": [minc, maxc]},
+ source_curCdformat_cellrange[j],
+ {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
+ {"row": [minh, maxh], "column": [minc, maxc]},
"operatePart"
);
@@ -1187,7 +1188,7 @@ const selection = {
target_curCdformat = target_curCdformat.concat(ruleArr);
}
- //数据验证
+ //数据验证
for(let i = c_r1; i <= c_r2; i++){
for(let j = c_c1; j <= c_c2; j++){
delete c_dataVerification[i + "_" + j];
@@ -1236,9 +1237,9 @@ const selection = {
for(let j = 0; j < cellrange.length; j++){
let range = conditionformat.CFSplitRange(
- cellrange[j],
- {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
- {"row": [minh, maxh], "column": [minc, maxc]},
+ cellrange[j],
+ {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
+ {"row": [minh, maxh], "column": [minc, maxc]},
"allPart"
);
@@ -1374,13 +1375,13 @@ const selection = {
if(cfg["merge"] != null){
has_PartMC = hasPartMC(cfg, minh, maxh, minc, maxc);
}
-
+
if(has_PartMC){
if(isEditMode()){
alert("不能对合并单元格做部分更改");
}
else{
- tooltip.info('提示',"不能对合并单元格做部分更改");
+ tooltip.info('提示',"不能对合并单元格做部分更改");
}
return;
}
@@ -1524,10 +1525,10 @@ const selection = {
cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c] = x[c]["mc"];
- offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
+ offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
}
else{
- x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
+ x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
}
}
}
@@ -1542,7 +1543,7 @@ const selection = {
if(copyRange["copyRange"].length == 1){
let c_file = Store.luckysheetfile[getSheetIndex(copySheetIndex)];
let a_file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
-
+
let ruleArr_cf = $.extend(true, [], c_file["luckysheet_conditionformat_save"]);
if(ruleArr_cf != null && ruleArr_cf.length > 0){
@@ -1562,9 +1563,9 @@ const selection = {
for(let j = 0; j < cf_range.length; j++){
let range = conditionformat.CFSplitRange(
- cf_range[j],
- {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
- {"row": [mth, maxrowCache - 1], "column": [mtc, maxcellCahe - 1]},
+ cf_range[j],
+ {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
+ {"row": [mth, maxrowCache - 1], "column": [mtc, maxcellCahe - 1]},
"operatePart"
);
@@ -1604,7 +1605,7 @@ const selection = {
"dataVerification": dataVerification
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
-
+
selectHightlightShow();
}
},
@@ -1626,7 +1627,7 @@ const selection = {
c_r2 = copyRange["copyRange"][0].row[1],
c_c1 = copyRange["copyRange"][0].column[0],
c_c2 = copyRange["copyRange"][0].column[1];
-
+
let copyData = $.extend(true, [], getdatabyselection({"row": [c_r1, c_r2], "column": [c_c1, c_c2]}, copySheetIndex));
//应用范围
@@ -1642,18 +1643,18 @@ const selection = {
if(cfg["merge"] != null){
has_PartMC = hasPartMC(cfg, minh, minh + copyh - 1, minc, minc + copyc - 1);
}
-
+
if(has_PartMC){
if(isEditMode()){
alert("不能对合并单元格做部分更改");
}
else{
- tooltip.info('提示',"不能对合并单元格做部分更改");
+ tooltip.info('提示',"不能对合并单元格做部分更改");
}
return;
}
- maxh = minh + copyh - 1;
+ maxh = minh + copyh - 1;
maxc = minc + copyc - 1;
}
@@ -1782,10 +1783,10 @@ const selection = {
cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c] = x[c]["mc"];
- offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
+ offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
}
else{
- x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
+ x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
}
}
@@ -1816,9 +1817,9 @@ const selection = {
for(let j = 0; j < cdformat_cellrange.length; j++){
let range = conditionformat.CFSplitRange(
- cdformat_cellrange[j],
- {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
- {"row": [minh, maxh], "column": [minc, maxc]},
+ cdformat_cellrange[j],
+ {"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
+ {"row": [minh, maxh], "column": [minc, maxc]},
"operatePart"
);
@@ -1855,7 +1856,7 @@ const selection = {
"dataVerification": dataVerification
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
-
+
selectHightlightShow();
}
},
@@ -1906,7 +1907,7 @@ const selection = {
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) {
continue;
}
-
+
for (let c = 0; c < data1cache[0].length; c++) {
if (getcellvalue(r, c, data1cache) != getcellvalue(r, c, data2cache)) {
return false;