Skip to content

Commit fc61213

Browse files
authored
Merge pull request dream-num#515 from flowerField/master
resolve bug
2 parents 15b810f + b4789e5 commit fc61213

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

src/controllers/controlHistory.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ const controlHistory = {
8585
"dataVerification": ctr.dataVerification,
8686
"dynamicArray": ctr.dynamicArray
8787
}
88-
jfrefreshgrid(ctr.data, ctr.range, allParam);
88+
// jfrefreshgrid(ctr.data, ctr.range, allParam);
89+
90+
/* ⚠️ 这个🌶️ dataRange表示的才是数据更新的位置 */
91+
jfrefreshgrid(ctr.data, ctr.dataRange, allParam);
92+
8993
// formula.execFunctionGroup(null, null, null, null, ctr.data);//取之前的数据
9094
}
9195
else if (ctr.type == "pasteCut") {

src/controllers/server.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,21 @@ const server = {
427427
file["config"][k] = {};
428428
}
429429

430-
for(let key in value){
431-
file["config"][k][key] = value[key];
432-
}
430+
// for(let key in value){
431+
// file["config"][k][key] = value[key];
432+
// }
433+
434+
// ⚠️ 上面的处理方式会导致部分配置项被遗漏,以致协同编辑的时候多视图出现不一致的情况,调整处理的策略为直接替换配置项:
435+
// 可能的配置项为:
436+
// columnlen: {0: 65, 1: 186, 2: 52}
437+
// customHeight: {0: 1, 5: 1, 6: 1}
438+
// customWidth: {0: 1, 1: 1, 2: 1}
439+
// merge: {2_1: {…}, 4_2: {…}, 6_2: {…}}
440+
// rowlen: {0: 19, 5: 93, 6: 117}
441+
if(value && (typeof value == "object")){
442+
file["config"][k] = value;
443+
}
444+
433445
}
434446

435447
if(index == Store.currentSheetIndex){//更新数据为当前表格数据
@@ -694,7 +706,14 @@ const server = {
694706
file["column"] += len;
695707

696708
for(let i = 0; i < data.length; i++){
697-
data[i].splice(st_i, 0, addData[i]);
709+
// data[i].splice(st_i, 0, addData[i]);
710+
711+
// 备注:区分插入的位置(可能是左侧插入或者右侧插入)
712+
if(direction == "lefttop"){
713+
data[i].splice(st_i, 0, addData[i]);
714+
}else{
715+
data[i].splice(st_i + 1, 0, addData[i]);
716+
}
698717
}
699718
}
700719

src/global/format.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,8 +1353,16 @@ var make_ssf = function make_ssf(SSF) {
13531353
}
13541354
// var retval = "";
13551355
var retval = tempV === 0 ? "0" : "";
1356-
for (i = 0; i !== out.length; ++i)
1357-
if (out[i] != null) retval += out[i].v;
1356+
// for (i = 0; i !== out.length; ++i)
1357+
// if (out[i] != null) retval += out[i].v;
1358+
for (i = 0; i !== out.length; ++i){
1359+
if (out[i] != null && out[i].v.startsWith(".")){
1360+
retval += out[i].v;
1361+
}else{
1362+
retval = out[i].v || retval;
1363+
}
1364+
}
1365+
13581366
return retval;
13591367
}
13601368
SSF._eval = eval_fmt;

0 commit comments

Comments
 (0)