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

Commit

Permalink
fix(columlen): columlen
Browse files Browse the repository at this point in the history
columlen to columnlen
  • Loading branch information
Dushusir committed Aug 4, 2020
1 parent 817c194 commit b656c27
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 96 deletions.
4 changes: 2 additions & 2 deletions docs/guide/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@
}
```

### config.columlen
### config.columnlen
- Type:Object
- Default:{}
- Usage:The column width of each cell, example:
```js
"columlen": {
"columnlen": {
"0": 97,
"1": 115,
"2": 128
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/operate.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
- Update: `luckysheetfile[3].config.["rowlen"]["3"] = 10`

2. Examples of modifying column width:
- Enter: `{"t":"cg","i":1,"v":{"20":74, "15":170, "6":40},"k":" columlen"}`
- Update: `luckysheetfile[1].config.["columlen"]["20"] = 74`
- Enter: `{"t":"cg","i":1,"v":{"20":74, "15":170, "6":40},"k":" columnlen"}`
- Update: `luckysheetfile[1].config.["columnlen"]["20"] = 74`

3. Examples of merged cells:
- Enter: `{"t":"cg","i":1,"v":{"5_10":{row:[1,3], column:[3,5]},"k":" merge "}`
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@
}
```

### config.columlen
### config.columnlen
- 类型:Object
- 默认值:{}
- 作用:每个单元格的列宽,示例:
```js
"columlen": {
"columnlen": {
"0": 97,
"1": 115,
"2": 128
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/operate.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
- 更新:`luckysheetfile[3].config.["rowlen"]["3"] = 10`

2. 修改列宽度举例:
- 输入:`{"t":"cg","i":1,"v":{"20":74, "15":170, "6":40},"k":" columlen"}`
- 更新:`luckysheetfile[1].config.["columlen"]["20"] = 74`
- 输入:`{"t":"cg","i":1,"v":{"20":74, "15":170, "6":40},"k":" columnlen"}`
- 更新:`luckysheetfile[1].config.["columnlen"]["20"] = 74`

3. 合并单元格举例:
- 输入:`{"t":"cg","i":1,"v":{"5_10":{row:[1,3], column:[3,5]},"k":" merge "}`
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/controlHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const controlHistory = {
server.saveParam("cg", ctr.sheetIndex, ctr.config["rowlen"], { "k": "rowlen" });
}
else if(ctr.ctrlType == "resizeC"){
server.saveParam("cg", ctr.sheetIndex, ctr.config["columlen"], { "k": "columlen" });
server.saveParam("cg", ctr.sheetIndex, ctr.config["columnlen"], { "k": "columnlen" });
}

jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length);
Expand Down Expand Up @@ -359,7 +359,7 @@ const controlHistory = {
server.saveParam("cg", ctr.sheetIndex, ctr.curconfig["rowlen"], { "k": "rowlen" });
}
else if(ctr.ctrlType == "resizeC"){
server.saveParam("cg", ctr.sheetIndex, ctr.curconfig["columlen"], { "k": "columlen" });
server.saveParam("cg", ctr.sheetIndex, ctr.curconfig["columnlen"], { "k": "columnlen" });
}

jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length);
Expand Down
24 changes: 12 additions & 12 deletions src/controllers/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,19 +919,19 @@ export default function luckysheetHandler() {

//列宽默认值
let cfg = $.extend(true, {}, Store.config);
if (cfg["columlen"] == null) {
cfg["columlen"] = {};
if (cfg["columnlen"] == null) {
cfg["columnlen"] = {};
}

let first_collen = cfg["columlen"][Store.luckysheet_select_save[0].column[0]] == null ? Store.defaultcollen : cfg["columlen"][Store.luckysheet_select_save[0].column[0]];
let first_collen = cfg["columnlen"][Store.luckysheet_select_save[0].column[0]] == null ? Store.defaultcollen : cfg["columnlen"][Store.luckysheet_select_save[0].column[0]];
let isSame = true;

for (let i = 0; i < Store.luckysheet_select_save.length; i++) {
let s = Store.luckysheet_select_save[i];
let c1 = s.column[0], c2 = s.column[1];

for (let c = c1; c <= c2; c++) {
let collen = cfg["columlen"][c] == null ? Store.defaultcollen : cfg["columlen"][c];
let collen = cfg["columnlen"][c] == null ? Store.defaultcollen : cfg["columnlen"][c];

if (collen != first_collen) {
isSame = false;
Expand Down Expand Up @@ -2364,12 +2364,12 @@ export default function luckysheetHandler() {

let size = (x + 3) - Store.luckysheet_cols_change_size_start[0];

let firstcolumlen = Store.defaultcollen;
if (Store.config["columlen"] != null && Store.config["columlen"][Store.luckysheet_cols_change_size_start[1]] != null) {
firstcolumlen = Store.config["columlen"][Store.luckysheet_cols_change_size_start[1]];
let firstcolumnlen = Store.defaultcollen;
if (Store.config["columnlen"] != null && Store.config["columnlen"][Store.luckysheet_cols_change_size_start[1]] != null) {
firstcolumnlen = Store.config["columnlen"][Store.luckysheet_cols_change_size_start[1]];
}

if (Math.abs(size - firstcolumlen) < 3) {
if (Math.abs(size - firstcolumnlen) < 3) {
return;
}
if ((x + 3) - Store.luckysheet_cols_change_size_start[0] < 30) {
Expand All @@ -2381,11 +2381,11 @@ export default function luckysheetHandler() {
}

let cfg = $.extend(true, {}, Store.config);
if (cfg["columlen"] == null) {
cfg["columlen"] = {};
if (cfg["columnlen"] == null) {
cfg["columnlen"] = {};
}

cfg["columlen"][Store.luckysheet_cols_change_size_start[1]] = Math.ceil(size);
cfg["columnlen"][Store.luckysheet_cols_change_size_start[1]] = Math.ceil(size);

if (Store.clearjfundo) {
Store.jfundo = [];
Expand All @@ -2403,7 +2403,7 @@ export default function luckysheetHandler() {
Store.config = cfg;
Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].config = Store.config;

server.saveParam("cg", Store.currentSheetIndex, cfg["columlen"], { "k": "columlen" });
server.saveParam("cg", Store.currentSheetIndex, cfg["columnlen"], { "k": "columnlen" });

jfrefreshgrid_rhcw(null, Store.flowdata[0].length);

Expand Down
4 changes: 2 additions & 2 deletions src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -3816,8 +3816,8 @@ const menuButton = {
else{
let config = getluckysheetfile()[getSheetIndex(Store.currentSheetIndex)]["config"];

if (config["columlen"] != null && config["columlen"][cell_c] != null) {
width = config["columlen"][cell_c];
if (config["columnlen"] != null && config["columnlen"][cell_c] != null) {
width = config["columnlen"][cell_c];
}

if (config["rowlen"] != null && config["rowlen"][cell_r] != null) {
Expand Down
30 changes: 15 additions & 15 deletions src/controllers/rowColumnOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,19 +776,19 @@ export function rowColumnOperationInitial(){

//列宽默认值
let cfg = $.extend(true, {}, Store.config);
if(cfg["columlen"] == null){
cfg["columlen"] = {};
if(cfg["columnlen"] == null){
cfg["columnlen"] = {};
}

let first_collen = cfg["columlen"][Store.luckysheet_select_save[0].column[0]] == null ? Store.defaultcollen : cfg["columlen"][Store.luckysheet_select_save[0].column[0]];
let first_collen = cfg["columnlen"][Store.luckysheet_select_save[0].column[0]] == null ? Store.defaultcollen : cfg["columnlen"][Store.luckysheet_select_save[0].column[0]];
let isSame = true;

for(let i = 0; i < Store.luckysheet_select_save.length; i++){
let s = Store.luckysheet_select_save[i];
let c1 = s.column[0], c2 = s.column[1];

for(let c = c1; c <= c2; c++){
let collen = cfg["columlen"][c] == null ? Store.defaultcollen : cfg["columlen"][c];
let collen = cfg["columnlen"][c] == null ? Store.defaultcollen : cfg["columnlen"][c];

if(collen != first_collen){
isSame = false;
Expand Down Expand Up @@ -1443,16 +1443,16 @@ export function rowColumnOperationInitial(){
else if(Store.luckysheetRightHeadClickIs == "column"){
type = "resizeC";

if(cfg["columlen"] == null){
cfg["columlen"] = {};
if(cfg["columnlen"] == null){
cfg["columnlen"] = {};
}

for(let s = 0; s < Store.luckysheet_select_save.length; s++){
let c1 = Store.luckysheet_select_save[s].column[0];
let c2 = Store.luckysheet_select_save[s].column[1];

for(let c = c1; c <= c2; c++){
cfg["columlen"][c] = size;
cfg["columnlen"][c] = size;
}
}
}
Expand All @@ -1477,7 +1477,7 @@ export function rowColumnOperationInitial(){
jfrefreshgrid_rhcw(Store.flowdata.length, null);
}
else if(Store.luckysheetRightHeadClickIs == "column"){
server.saveParam("cg", Store.currentSheetIndex, cfg["columlen"], { "k": "columlen" });
server.saveParam("cg", Store.currentSheetIndex, cfg["columnlen"], { "k": "columnlen" });
jfrefreshgrid_rhcw(null, Store.flowdata[0].length);
}
});
Expand Down Expand Up @@ -1557,11 +1557,11 @@ function luckysheetcolsdbclick() {
size = winW - 100 + scrollLeft;
}

if (cfg["columlen"] == null) {
cfg["columlen"] = {};
if (cfg["columnlen"] == null) {
cfg["columnlen"] = {};
}

cfg["columlen"][Store.luckysheet_cols_change_size_start[1]] = Math.ceil(size);
cfg["columnlen"][Store.luckysheet_cols_change_size_start[1]] = Math.ceil(size);

matchColumn[col_index] = 1;
}
Expand Down Expand Up @@ -1607,17 +1607,17 @@ function luckysheetcolsdbclick() {
size = winW - 100 + scrollLeft;
}

if (cfg["columlen"] == null) {
cfg["columlen"] = {};
if (cfg["columnlen"] == null) {
cfg["columnlen"] = {};
}
cfg["columlen"][c] = Math.ceil(size);
cfg["columnlen"][c] = Math.ceil(size);

matchColumn[c] = 1;
}
}
}

jfrefreshgridall(Store.flowdata[0].length, Store.flowdata.length, Store.flowdata, cfg, Store.luckysheet_select_save, "resizeC", "columlen");
jfrefreshgridall(Store.flowdata[0].length, Store.flowdata.length, Store.flowdata, cfg, Store.luckysheet_select_save, "resizeC", "columnlen");
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ const selection = {
let style = "", span = "";

if(r == minR){
if(Store.config == null || Store.config["columlen"] == null || Store.config["columlen"][c.toString()] == null){
if(Store.config == null || Store.config["columnlen"] == null || Store.config["columnlen"][c.toString()] == null){
colgroup += '<colgroup width="72px"></colgroup>';
}
else {
colgroup += '<colgroup width="'+ Store.config["columlen"][c.toString()] +'px"></colgroup>';
colgroup += '<colgroup width="'+ Store.config["columnlen"][c.toString()] +'px"></colgroup>';
}
}

Expand Down Expand Up @@ -471,11 +471,11 @@ const selection = {
column += "";

if(r == minR){
if(Store.config == null || Store.config["columlen"] == null || Store.config["columlen"][c.toString()] == null){
if(Store.config == null || Store.config["columnlen"] == null || Store.config["columnlen"][c.toString()] == null){
colgroup += '<colgroup width="72px"></colgroup>';
}
else {
colgroup += '<colgroup width="'+ Store.config["columlen"][c.toString()] +'px"></colgroup>';
colgroup += '<colgroup width="'+ Store.config["columnlen"][c.toString()] +'px"></colgroup>';
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/controllers/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const server = {
}, 1);
}
}
else if(type == "cg"){ //config更新(rowhidden,rowlen,columlen,merge,borderInfo)
else if(type == "cg"){ //config更新(rowhidden,rowlen,columnlen,merge,borderInfo)
let k = item.k;

if(k == "borderInfo"){
Expand All @@ -299,7 +299,7 @@ const server = {
if(index == Store.currentSheetIndex){//更新数据为当前表格数据
Store.config = file["config"];

if(k == "rowlen" || k == "columlen" || k == "rowhidden"){
if(k == "rowlen" || k == "columnlen" || k == "rowhidden"){
jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length);
}

Expand Down
2 changes: 1 addition & 1 deletion src/demoData/sheetCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ const sheetCell = {
"27": 20,
"28": 80
},
"columlen": {
"columnlen": {
"0": 97,
"2": 115,
"3": 128,
Expand Down
2 changes: 1 addition & 1 deletion src/demoData/sheetComment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const sheetComment = {
"name": "Comment",
"color": "",
"config": {
"columlen": {
"columnlen": {
"2": 102
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/demoData/sheetConditionFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const sheetConditionFormat = {
"28": 20,
"29": 20
},
"columlen": {
"columnlen": {
"0": 30,
"1": 30,
"2": 86,
Expand Down
2 changes: 1 addition & 1 deletion src/demoData/sheetFormula.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const sheetFormula = {
}
},
"rowlen": {},
"columlen": {
"columnlen": {
"0": 111,
"2": 105,
"3": 82,
Expand Down
2 changes: 1 addition & 1 deletion src/demoData/sheetSparkline.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ const sheetSparkline = {
"56": 20,
"57": 20
},
"columlen": {
"columnlen": {
"0": 101,
"2": 131,
"3": 30,
Expand Down
8 changes: 4 additions & 4 deletions src/function/functionImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -23379,8 +23379,8 @@ const functionImplementation = {
case "width":
var cfg = file.config;

if(cfg["columlen"] != null && col_index in cfg["columlen"]){
return cfg["columlen"][col_index];
if(cfg["columnlen"] != null && col_index in cfg["columnlen"]){
return cfg["columnlen"][col_index];
}

return Store.defaultcollen;
Expand Down Expand Up @@ -25482,7 +25482,7 @@ const functionImplementation = {
return temp1;
// {
// height:rowlen,
// width:firstcolumlen,
// width:firstcolumnlen,
// normalRangeMin:6,
// normalRangeMax:6,
// normalRangeColor:"#000"
Expand Down Expand Up @@ -25627,7 +25627,7 @@ const functionImplementation = {
return temp1;
// {
// height:rowlen,
// width:firstcolumlen,
// width:firstcolumnlen,
// normalRangeMin:6,
// normalRangeMax:6,
// normalRangeColor:"#000"
Expand Down
Loading

0 comments on commit b656c27

Please sign in to comment.