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

Commit

Permalink
fix(bug): dataVerification and sheet move and delete cell bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wpxp123456 committed Oct 27, 2020
1 parent f7c609e commit 4815d86
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 19 deletions.
29 changes: 22 additions & 7 deletions src/controllers/dataVerificationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,28 @@ const dataVerificationCtrl = {
return;
}

let str = range[range.length - 1].row[0],
edr = range[range.length - 1].row[1],
stc = range[range.length - 1].column[0],
edc = range[range.length - 1].column[1];
let d = editor.deepCopyFlowData(Store.flowdata);

if(str < 0){
str = 0;
}

if(edr > d.length - 1){
edr = d.length - 1;
}

if(stc < 0){
stc = 0;
}

if(edc > d[0].length - 1){
edc = d[0].length - 1;
}

let type = $("#luckysheet-dataVerification-dialog #data-verification-type-select").val();
let type2 = null, value1 = "", value2 = "";

Expand Down Expand Up @@ -699,13 +721,6 @@ const dataVerificationCtrl = {
let historyDataVerification = $.extend(true, {}, _this.dataVerification);
let currentDataVerification = $.extend(true, {}, _this.dataVerification);

let str = range[range.length - 1].row[0],
edr = range[range.length - 1].row[1],
stc = range[range.length - 1].column[0],
edc = range[range.length - 1].column[1];

let d = editor.deepCopyFlowData(Store.flowdata);

for(let r = str; r <= edr; r++){
for(let c = stc; c <= edc; c++){
currentDataVerification[r + '_' + c] = item;
Expand Down
18 changes: 18 additions & 0 deletions src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,24 @@ const sheetmanage = {
});

server.saveParam("shr", null, orders);

Store.luckysheetfile.sort((x, y) => {
let order_x = x.order;
let order_y = y.order;

if(order_x != null && order_y != null){
return order_x - order_y;
}
else if(order_x != null){
return -1;
}
else if(order_y != null){
return 1;
}
else{
return 1;
}
})
},
createSheet: function() { //修复拖动sheet更新后台后,重新打开显示错误
let _this = this;
Expand Down
3 changes: 3 additions & 0 deletions src/global/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4709,6 +4709,9 @@ export function setSheetActive(order, options = {}) {
success
} = {...options}

$("#luckysheet-sheet-area div.luckysheet-sheets-item").removeClass("luckysheet-sheets-item-active");
$("#luckysheet-sheets-item" + file.index).addClass("luckysheet-sheets-item-active");

sheetmanage.changeSheet(file.index);

setTimeout(() => {
Expand Down
40 changes: 28 additions & 12 deletions src/global/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,17 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) {
else if(index == r){
if(direction == "lefttop"){
newDataVerification[(r + value) + "_" + c] = item;

for(let i = 0; i < value; i++){
newDataVerification[(r + i) + "_" + c] = item;
}
}
else{
newDataVerification[r + "_" + c] = item;

for(let i = 0; i < value; i++){
newDataVerification[(r + i + 1) + "_" + c] = item;
}
}
}
else{
Expand All @@ -498,9 +506,17 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) {
else if(index == c){
if(direction == "lefttop"){
newDataVerification[r + "_" + (c + value)] = item;

for(let i = 0; i < value; i++){
newDataVerification[r + "_" + (c + i)] = item;
}
}
else{
newDataVerification[r + "_" + c] = item;

for(let i = 0; i < value; i++){
newDataVerification[r + "_" + (c + i + 1)] = item;
}
}
}
else{
Expand Down Expand Up @@ -2112,20 +2128,20 @@ function luckysheetDeleteCell(type, str, edr, stc, edc, sheetIndex) {
let row_index = cfg["borderInfo"][i].value.row_index;
let col_index = cfg["borderInfo"][i].value.col_index;

if(row_index < str || col_index < stc){
borderInfo.push(cfg["borderInfo"][i]);
}
else if(row_index > edr || col_index > edc){
if(row_index > edr){
row_index -= rlen;
cfg["borderInfo"][i].value.row_index = row_index;
if(row_index < str || row_index > edr || col_index < stc || col_index > edc){
if(type == 'moveLeft'){
if(col_index > edc && row_index >= str && row_index <= edr){
col_index -= clen;
cfg["borderInfo"][i].value.col_index = col_index;
}
}

if(col_index > edc){
col_index -= clen;
cfg["borderInfo"][i].value.col_index = col_index;
else if(type == 'moveUp'){
if(row_index > edr && col_index >= stc && col_index <= edc){
row_index -= rlen;
cfg["borderInfo"][i].value.row_index = row_index;
}
}

borderInfo.push(cfg["borderInfo"][i]);
}
}
Expand Down

0 comments on commit 4815d86

Please sign in to comment.