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

Commit

Permalink
feat(delete cell): delete cell
Browse files Browse the repository at this point in the history
delete cell
  • Loading branch information
wpxp123456 committed Aug 25, 2020
1 parent ae78a07 commit d7de718
Show file tree
Hide file tree
Showing 8 changed files with 732 additions and 23 deletions.
53 changes: 32 additions & 21 deletions src/controllers/constant.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/controllers/controlHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
jfrefreshrange,
jfrefreshgrid_rhcw,
jfrefreshgrid_adRC,
jfrefreshgrid_deleteCell,
jfrefreshgrid_pastcut,
luckysheetrefreshgrid
} from '../global/refresh';
Expand Down Expand Up @@ -139,6 +140,9 @@ const controlHistory = {

jfrefreshgrid_adRC(ctr.data, ctr.config, "addRC", ctrlValue, ctr.calc, ctr.filterObj, ctr.cf, ctr.af, ctr.freezen);
}
else if (ctr.type == "deleteCell") { //删除单元格撤销操作
jfrefreshgrid_deleteCell(ctr.data, ctr.config, ctr.ctrl, ctr.calc, ctr.filterObj, ctr.cf);
}
else if (ctr.type == "showHidRows") { // 隐藏、显示行 撤销操作
//config
Store.config = ctr.config;
Expand Down Expand Up @@ -381,6 +385,9 @@ const controlHistory = {
else if (ctr.type == "delRC") { //删除行列重做操作
jfrefreshgrid_adRC(ctr.curData, ctr.curConfig, "delRC", ctr.ctrlValue, ctr.curCalc, ctr.curFilterObj, ctr.curCf, ctr.curAf, ctr.curFreezen);
}
else if (ctr.type == "deleteCell") { //删除单元格重做操作
jfrefreshgrid_deleteCell(ctr.curData, ctr.curConfig, ctr.ctrl, ctr.curCalc, ctr.curFilterObj, ctr.curCf);
}
else if (ctr.type == "showHidRows") { // 隐藏、显示行 重做操作
//config
Store.config = ctr.curconfig;
Expand Down
4 changes: 4 additions & 0 deletions src/controllers/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@ function initialFilterHandler(){

//单元格颜色
let bg = menuButton.checkstatus(Store.flowdata, r, cindex , "bg");

if(bg == null){
bg = "#ffffff";
}

let checksAF = alternateformat.checksAF(r, cindex, af_compute);
if(checksAF != null){//若单元格有交替颜色
Expand Down
50 changes: 49 additions & 1 deletion src/controllers/rowColumnOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import { isRealNull, isRealNum, hasPartMC, isEditMode } from '../global/validate';
import { countfunc } from '../global/count';
import formula from '../global/formula';
import { luckysheetextendtable, luckysheetdeletetable } from '../global/extend';
import { luckysheetextendtable, luckysheetdeletetable, luckysheetDeleteCell } from '../global/extend';
import {
jfrefreshgrid,
jfrefreshgridall,
Expand Down Expand Up @@ -1367,6 +1367,54 @@ export function rowColumnOperationInitial(){
jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length);
})

//删除单元格(左移、上移)
$("#luckysheet-delCellsMoveLeft").click(function (event) {
$("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus();

const locale_drag = locale().drag;

if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){
alert(locale_drag.noMulti);
}
else{
tooltip.info(locale_drag.noMulti, "");
}
return;
}

let str = Store.luckysheet_select_save[0].row[0],
edr = Store.luckysheet_select_save[0].row[1],
stc = Store.luckysheet_select_save[0].column[0],
edc = Store.luckysheet_select_save[0].column[1];

luckysheetDeleteCell('moveLeft', str, edr, stc, edc);
});
$("#luckysheet-delCellsMoveUp").click(function (event) {
$("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus();

const locale_drag = locale().drag;

if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){
alert(locale_drag.noMulti);
}
else{
tooltip.info(locale_drag.noMulti, "");
}
return;
}

let str = Store.luckysheet_select_save[0].row[0],
edr = Store.luckysheet_select_save[0].row[1],
stc = Store.luckysheet_select_save[0].column[0],
edc = Store.luckysheet_select_save[0].column[1];

luckysheetDeleteCell('moveUp', str, edr, stc, edc);
});

//清除单元格内容
$("#luckysheet-delete-text").click(function(){
$("#luckysheet-rightclick-menu").hide();
Expand Down
Loading

0 comments on commit d7de718

Please sign in to comment.