Browse Source

fix(setcellvalue delete function fix): fix it

master
liuyang 5 years ago
parent
commit
00b351fa0d
  1. 18
      src/controllers/cellFormat.js
  2. 4
      src/global/formula.js
  3. 6
      src/global/setdata.js
  4. 4
      src/index.html

18
src/controllers/cellFormat.js

@ -6,6 +6,7 @@ import menuButton from './menuButton';
import {checkProtectionNotEnable} from './protection'; import {checkProtectionNotEnable} from './protection';
import { jfrefreshgrid } from '../global/refresh'; import { jfrefreshgrid } from '../global/refresh';
import locale from '../locale/locale'; import locale from '../locale/locale';
import { setcellvalue } from '../global/setdata';
let isInitialCellFormatModel = false; let isInitialCellFormatModel = false;
@ -22,9 +23,17 @@ function initialCellFormatModelEvent(){
hidden = hidden==true?1:0; hidden = hidden==true?1:0;
let d = recycleSeletion( let d = recycleSeletion(
function(cell){ function(cell, r, c, data){
if(cell==null){
setcellvalue(r, c, data, {
lo:locked,
hi:hidden
});
}
else{
cell.lo = locked; cell.lo = locked;
cell.hi = hidden; cell.hi = hidden;
}
}, },
function(){ function(){
alert(local_cellFormat.sheetDataIsNullAlert); alert(local_cellFormat.sheetDataIsNullAlert);
@ -79,7 +88,8 @@ function recycleSeletion(cycleFunction, dataIsNullFunction){
// } // }
// count++; // count++;
cycleFunction(cell);
cycleFunction(cell, r, c, data);
} }
} }
} }
@ -152,12 +162,12 @@ export function openCellFormatModel(){
recycleSeletion( recycleSeletion(
function(cell){ function(cell){
// let cell = data[r][c]; // let cell = data[r][c];
if(cell.lo==null || cell.lo==1){ if(cell==null || cell.lo==null || cell.lo==1){
locked = true; locked = true;
lockedCount++; lockedCount++;
} }
if(cell.hi==1){ if(cell!=null && cell.hi==1){
hidden = true; hidden = true;
hiddenCount++; hiddenCount++;
} }

4
src/global/formula.js

@ -1238,7 +1238,7 @@ const luckysheetformula = {
} }
if(!checkProtectionLocked(r, c, Store.currentSheetIndex)){ if(!checkProtectionLocked(r, c, Store.currentSheetIndex)){
return return;
} }
//数据验证 输入数据无效时禁止输入 //数据验证 输入数据无效时禁止输入
@ -5188,6 +5188,7 @@ const luckysheetformula = {
"r": u.r, "r": u.r,
"c": u.c, "c": u.c,
"v": v[1], "v": v[1],
"f": v[2],
"spe":v[3], "spe":v[3],
"index": u.index "index": u.index
}); });
@ -5226,6 +5227,7 @@ const luckysheetformula = {
} }
} }
updateValue.v = item.v; updateValue.v = item.v;
updateValue.f = item.f;
setcellvalue(item.r, item.c, data, updateValue); setcellvalue(item.r, item.c, data, updateValue);
server.saveParam("v", item.index, item.v, { server.saveParam("v", item.index, item.v, {
"r": item.r, "r": item.r,

6
src/global/setdata.js

@ -22,9 +22,9 @@ function setcellvalue(r, c, d, v) {
if(v.f != null){ if(v.f != null){
cell.f = v.f; cell.f = v.f;
} }
else{ // else{
delete cell.f; // delete cell.f;
} // }
if(v.spl != null){ if(v.spl != null){
cell.spl = v.spl; cell.spl = v.spl;

4
src/index.html

@ -53,8 +53,8 @@
"url":"./assets/iconfont/Pacifico-Regular.ttf" "url":"./assets/iconfont/Pacifico-Regular.ttf"
} }
], ],
data: // data:
[sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification] // [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification]
/*[{"name":"Sheet1","config":{"columnlen":{"0":241},"rowlen":{"0":81,"17":100}},"index":"1","status":"1","order":"0","luckysheet_select_save":[{"row":[0,0],"column":[4,4],"sheetIndex":1}],"zoomRatio":1,"showGridLines":"1","defaultColWidth":72,"defaultRowHeight":18,"celldata":[ /*[{"name":"Sheet1","config":{"columnlen":{"0":241},"rowlen":{"0":81,"17":100}},"index":"1","status":"1","order":"0","luckysheet_select_save":[{"row":[0,0],"column":[4,4],"sheetIndex":1}],"zoomRatio":1,"showGridLines":"1","defaultColWidth":72,"defaultRowHeight":18,"celldata":[
{"r":0,"c":0, {"r":0,"c":0,
"v":{ "v":{

Loading…
Cancel
Save