|
|
@ -2871,6 +2871,142 @@ const menuButton = { |
|
|
|
|
|
|
|
return [style, color]; |
|
|
|
}, |
|
|
|
updateFormatCell:function(d, attr, foucsStatus,row_st, row_ed, col_st, col_ed){ |
|
|
|
if(d==null || attr==null){ |
|
|
|
return; |
|
|
|
} |
|
|
|
if(attr == "ct"){ |
|
|
|
for (let r = row_st; r <= row_ed; r++) { |
|
|
|
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
for (let c = col_st; c <= col_ed; c++) { |
|
|
|
let cell = d[r][c], value = null; |
|
|
|
|
|
|
|
if (getObjType(cell) == "object") { |
|
|
|
value = d[r][c]["v"]; |
|
|
|
} |
|
|
|
else{ |
|
|
|
value = d[r][c]; |
|
|
|
} |
|
|
|
|
|
|
|
if(foucsStatus != "@" && isRealNum(value)){ |
|
|
|
value = parseFloat(value); |
|
|
|
} |
|
|
|
|
|
|
|
let mask = update(foucsStatus, value); |
|
|
|
let type = "n"; |
|
|
|
|
|
|
|
if(is_date(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47){ |
|
|
|
type = "d"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "@" || foucsStatus === 49){ |
|
|
|
type = "s" |
|
|
|
} |
|
|
|
else if(foucsStatus == "General" || foucsStatus === 0){ |
|
|
|
type = "g"; |
|
|
|
} |
|
|
|
|
|
|
|
if (getObjType(cell) == "object") { |
|
|
|
d[r][c]["m"] = mask; |
|
|
|
if(d[r][c]["ct"] == null){ |
|
|
|
d[r][c]["ct"] = {}; |
|
|
|
} |
|
|
|
d[r][c]["ct"]["fa"] = foucsStatus; |
|
|
|
d[r][c]["ct"]["t"] = type; |
|
|
|
} |
|
|
|
else{ |
|
|
|
d[r][c] = { "ct":{"fa":foucsStatus, "t":type}, "v": value, "m": mask }; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
if(attr == "ht"){ |
|
|
|
if(foucsStatus == "left"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "center"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "right"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(attr == "vt"){ |
|
|
|
if(foucsStatus == "top"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "middle"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "bottom"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(attr == "tb"){ |
|
|
|
if(foucsStatus == "overflow"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "clip"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "wrap"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(attr == "tr"){ |
|
|
|
if(foucsStatus == "none"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "angleup"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "angledown"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "vertical"){ |
|
|
|
foucsStatus = "3"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "rotation-up"){ |
|
|
|
foucsStatus = "4"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "rotation-down"){ |
|
|
|
foucsStatus = "5"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (let r = row_st; r <= row_ed; r++) { |
|
|
|
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
for (let c = col_st; c <= col_ed; c++) { |
|
|
|
let value = d[r][c]; |
|
|
|
|
|
|
|
if (getObjType(value) == "object") { |
|
|
|
// if(attr in inlineStyleAffectAttribute && isInlineStringCell(value)){
|
|
|
|
updateInlineStringFormatOutside(value, attr, foucsStatus); |
|
|
|
// }
|
|
|
|
// else{
|
|
|
|
d[r][c][attr] = foucsStatus; |
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
d[r][c] = { v: value }; |
|
|
|
d[r][c][attr] = foucsStatus; |
|
|
|
} |
|
|
|
|
|
|
|
// if(attr == "tr" && d[r][c].tb != null){
|
|
|
|
// d[r][c].tb = "0";
|
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
updateFormat: function(d, attr, foucsStatus){ |
|
|
|
let _this = this; |
|
|
|
|
|
|
@ -2903,136 +3039,7 @@ const menuButton = { |
|
|
|
let col_st = Store.luckysheet_select_save[s]["column"][0], |
|
|
|
col_ed = Store.luckysheet_select_save[s]["column"][1]; |
|
|
|
|
|
|
|
if(attr == "ct"){ |
|
|
|
for (let r = row_st; r <= row_ed; r++) { |
|
|
|
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
for (let c = col_st; c <= col_ed; c++) { |
|
|
|
let cell = d[r][c], value = null; |
|
|
|
|
|
|
|
if (getObjType(cell) == "object") { |
|
|
|
value = d[r][c]["v"]; |
|
|
|
} |
|
|
|
else{ |
|
|
|
value = d[r][c]; |
|
|
|
} |
|
|
|
|
|
|
|
if(foucsStatus != "@" && isRealNum(value)){ |
|
|
|
value = parseFloat(value); |
|
|
|
} |
|
|
|
|
|
|
|
let mask = update(foucsStatus, value); |
|
|
|
let type = "n"; |
|
|
|
|
|
|
|
if(is_date(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47){ |
|
|
|
type = "d"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "@" || foucsStatus === 49){ |
|
|
|
type = "s" |
|
|
|
} |
|
|
|
else if(foucsStatus == "General" || foucsStatus === 0){ |
|
|
|
type = "g"; |
|
|
|
} |
|
|
|
|
|
|
|
if (getObjType(cell) == "object") { |
|
|
|
d[r][c]["m"] = mask; |
|
|
|
if(d[r][c]["ct"] == null){ |
|
|
|
d[r][c]["ct"] = {}; |
|
|
|
} |
|
|
|
d[r][c]["ct"]["fa"] = foucsStatus; |
|
|
|
d[r][c]["ct"]["t"] = type; |
|
|
|
} |
|
|
|
else{ |
|
|
|
d[r][c] = { "ct":{"fa":foucsStatus, "t":type}, "v": value, "m": mask }; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
if(attr == "ht"){ |
|
|
|
if(foucsStatus == "left"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "center"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "right"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(attr == "vt"){ |
|
|
|
if(foucsStatus == "top"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "middle"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "bottom"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(attr == "tb"){ |
|
|
|
if(foucsStatus == "overflow"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "clip"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "wrap"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(attr == "tr"){ |
|
|
|
if(foucsStatus == "none"){ |
|
|
|
foucsStatus = "0"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "angleup"){ |
|
|
|
foucsStatus = "1"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "angledown"){ |
|
|
|
foucsStatus = "2"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "vertical"){ |
|
|
|
foucsStatus = "3"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "rotation-up"){ |
|
|
|
foucsStatus = "4"; |
|
|
|
} |
|
|
|
else if(foucsStatus == "rotation-down"){ |
|
|
|
foucsStatus = "5"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (let r = row_st; r <= row_ed; r++) { |
|
|
|
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
for (let c = col_st; c <= col_ed; c++) { |
|
|
|
let value = d[r][c]; |
|
|
|
|
|
|
|
if (getObjType(value) == "object") { |
|
|
|
// if(attr in inlineStyleAffectAttribute && isInlineStringCell(value)){
|
|
|
|
updateInlineStringFormatOutside(value, attr, foucsStatus); |
|
|
|
// }
|
|
|
|
// else{
|
|
|
|
d[r][c][attr] = foucsStatus; |
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
d[r][c] = { v: value }; |
|
|
|
d[r][c][attr] = foucsStatus; |
|
|
|
} |
|
|
|
|
|
|
|
// if(attr == "tr" && d[r][c].tb != null){
|
|
|
|
// d[r][c].tb = "0";
|
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.updateFormatCell(d, attr, foucsStatus, row_st, row_ed, col_st, col_ed); |
|
|
|
|
|
|
|
if(attr == "tb" || attr == "tr" || attr == "fs"){ |
|
|
|
cfg = rowlenByRange(d, row_st, row_ed, cfg); |
|
|
|