Browse Source

Merge pull request #543 from flowerField/master

合并单元格后内部的边框处理
master
文顶顶 5 years ago
committed by GitHub
parent
commit
7c834a4a61
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      src/global/border.js
  2. 25
      src/global/refresh.js

31
src/global/border.js

@ -77,6 +77,14 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r + "_" + bd_c_left].r = { "color": borderColor, "style": borderStyle }; borderInfoCompute[bd_r + "_" + bd_c_left].r = { "color": borderColor, "style": borderStyle };
} }
} }
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_c1 <= c + cs - 1 && bd_c1 > c && bd_r >= r && bd_r <= r + rs -1){
borderInfoCompute[bd_r + "_" + bd_c1].l = null;
}
}
} }
} }
else if(borderType == "border-right"){ else if(borderType == "border-right"){
@ -107,6 +115,13 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r + "_" + bd_c_right].l = { "color": borderColor, "style": borderStyle }; borderInfoCompute[bd_r + "_" + bd_c_right].l = { "color": borderColor, "style": borderStyle };
} }
} }
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_c2 < c + cs - 1 && bd_c2 >= c && bd_r >= r && bd_r <= r + rs -1){
borderInfoCompute[bd_r + "_" + bd_c2].r = null;
}
}
} }
} }
else if(borderType == "border-top"){ else if(borderType == "border-top"){
@ -137,6 +152,14 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r_top + "_" + bd_c].b = { "color": borderColor, "style": borderStyle }; borderInfoCompute[bd_r_top + "_" + bd_c].b = { "color": borderColor, "style": borderStyle };
} }
} }
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_r1 <= r + rs - 1 && bd_r1 > r && bd_c >= c && bd_c <= c + cs -1){
borderInfoCompute[bd_r1 + "_" + bd_c].t = null;
}
}
} }
} }
else if(borderType == "border-bottom"){ else if(borderType == "border-bottom"){
@ -167,6 +190,14 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r_bottom + "_" + bd_c].t = { "color": borderColor, "style": borderStyle }; borderInfoCompute[bd_r_bottom + "_" + bd_c].t = { "color": borderColor, "style": borderStyle };
} }
} }
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_r2 < r + rs - 1 && bd_r2 >= r && bd_c >= c && bd_c <= c + cs -1){
borderInfoCompute[bd_r2 + "_" + bd_c].b = null;
}
}
} }
} }
else if(borderType == "border-all"){ else if(borderType == "border-all"){

25
src/global/refresh.js

@ -635,14 +635,29 @@ function jfrefreshgrid_deleteCell(data, cfg, ctrl, calc, filterObj, cf, dataVeri
data[r][c] = {}; data[r][c] = {};
} }
// if(r == mc.r && c == mc.c){
// data[r][c].mc = mc;
// }
// else{
// data[r][c].mc = { "r": mc.r, "c": mc.c };
// }
// mcData.push({ "r": r, "c": c });
if(r == mc.r && c == mc.c){ if(r == mc.r && c == mc.c){
data[r][c].mc = mc; if(JSON.stringify(data[r][c].mc) !=JSON.stringify(mc)){
data[r][c].mc = mc;
mcData.push({ "r": r, "c": c });
}
} }
else{ else{
data[r][c].mc = { "r": mc.r, "c": mc.c }; let tempMc = { "r": mc.r, "c": mc.c };
} if(JSON.stringify(data[r][c].mc) != JSON.stringify(tempMc)){
data[r][c].mc = tempMc;
mcData.push({ "r": r, "c": c }); mcData.push({ "r": r, "c": c });
}
}
} }
} }
} }

Loading…
Cancel
Save