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

Commit

Permalink
fix(fix bugs): fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Aug 30, 2020
1 parent 254081f commit bbaafe0
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 133 deletions.
2 changes: 2 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ export default {
forceCalculation:false,//强制刷新公式,公式较多会有性能问题,慎用
rowHeaderWidth: 46,
columeHeaderHeight: 20,
defaultColWidth:73,
defaultRowHeight:19,
}
3 changes: 3 additions & 0 deletions src/controllers/luckysheetConfigsetting.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const luckysheetConfigsetting = {
fireMousedown: null,
plugins:[],
forceCalculation:false,//强制刷新公式,公式较多会有性能问题,慎用

defaultColWidth:73,
defaultRowHeight:19,
}

export default luckysheetConfigsetting;
15 changes: 7 additions & 8 deletions src/controllers/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ const server = {
}

let r = value.r, c = value.c;
let func = value.func;

let calcChain = file["calcChain"] == null ? [] : file["calcChain"];

Expand All @@ -418,13 +417,13 @@ const server = {
}
}
}
else if(op == "update"){
for(let a = 0; a < calcChain.length; a++){
if(r == calcChain[a].r && c == calcChain[a].c && index == calcChain[a].index){
calcChain[a].func = func;
}
}
}
// else if(op == "update"){
// for(let a = 0; a < calcChain.length; a++){
// if(r == calcChain[a].r && c == calcChain[a].c && index == calcChain[a].index){
// calcChain[a].func = func;
// }
// }
// }

setTimeout(function () {
luckysheetrefreshgrid();
Expand Down
91 changes: 50 additions & 41 deletions src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isEditMode } from '../global/validate';
import cleargridelement from '../global/cleargridelement';
import { getcellvalue, datagridgrowth } from '../global/getdata';
import { getcellvalue, datagridgrowth,getcellFormula } from '../global/getdata';
import { setcellvalue } from '../global/setdata';
import luckysheetcreatedom from '../global/createdom';
import tooltip from '../global/tooltip';
Expand Down Expand Up @@ -598,14 +598,7 @@ const sheetmanage = {

return data;
},
initialjfFile: function(menu, title) {
let _this = this;

_this.getCurSheet();
let file = Store.luckysheetfile[_this.getSheetIndex(Store.currentSheetIndex)];
_this.nulldata = datagridgrowth([], Store.defaultrowNum, Store.defaultcolumnNum);
let data = _this.buildGridData(file);

sheetParamRestore: function(file, data) {
Store.luckysheet_select_save = file["luckysheet_select_save"];
if(Store.luckysheet_select_save == null || Store.luckysheet_select_save.length == 0){
if(data[0] != null && data[0][0] != null && data[0][0].mc != null){
Expand All @@ -627,6 +620,43 @@ const sheetmanage = {

Store.zoomRatio = file["zoomRatio"] == null ? 1 : file["zoomRatio"];

if(file["defaultRowHeight"]!=null){
Store.defaultrowlen = parseFloat(file["defaultRowHeight"]);
}
else{
Store.defaultrowlen = luckysheetConfigsetting["defaultRowHeight"];
}

if(file["defaultColWidth"]!=null){
Store.defaultcollen = parseFloat(file["defaultColWidth"]);
}
else{
Store.defaultcollen = luckysheetConfigsetting["defaultColWidth"];
}

if(file["showGridLines"]!=null){
let showGridLines = file["showGridLines"];
if(showGridLines==0 || showGridLines==false){
Store.showGridLines = false;
}
else{
Store.showGridLines = true;
}
}
else{
Store.showGridLines = true;
}
},
initialjfFile: function(menu, title) {
let _this = this;

_this.getCurSheet();
let file = Store.luckysheetfile[_this.getSheetIndex(Store.currentSheetIndex)];
_this.nulldata = datagridgrowth([], Store.defaultrowNum, Store.defaultcolumnNum);
let data = _this.buildGridData(file);

this.sheetParamRestore(file, data);

let r2 = Store.luckysheet_select_save[0].row[1],
c2 = Store.luckysheet_select_save[0].column[1];

Expand Down Expand Up @@ -833,25 +863,7 @@ const sheetmanage = {

luckysheetPostil.buildAllPs(Store.flowdata);

Store.config = file["config"];

Store.luckysheet_select_save = file["luckysheet_select_save"];
if(Store.luckysheet_select_save == null || Store.luckysheet_select_save.length == 0){
if(Store.flowdata[0] != null && Store.flowdata[0][0] != null && Store.flowdata[0][0].mc != null){
Store.luckysheet_select_save = [{
"row": [0, Store.flowdata[0][0].mc.rs - 1],
"column": [0, Store.flowdata[0][0].mc.cs - 1]
}];
}
else{
Store.luckysheet_select_save = [{
"row": [0, 0],
"column": [0, 0]
}];
}
}

Store.luckysheet_selection_range = file["luckysheet_selection_range"] == null ? [] : file["luckysheet_selection_range"];
this.sheetParamRestore(file, Store.flowdata);

if(file["freezen"] == null){
luckysheetFreezen.freezenhorizontaldata = null;
Expand All @@ -862,13 +874,6 @@ const sheetmanage = {
luckysheetFreezen.freezenverticaldata = file["freezen"].vertical == null ? null : file["freezen"].vertical.freezenverticaldata;
}

if(file["zoomRatio"] != null){
Store.zoomRatio = file["zoomRatio"];
}
else{
Store.zoomRatio = 1;
}

createFilterOptions(file["filter_select"], file["filter"]);

rhchInit(Store.flowdata.length, Store.flowdata[0].length);
Expand Down Expand Up @@ -908,7 +913,11 @@ const sheetmanage = {
mergeCalculationSheet:{},
mergeCalculation:function(index){
let file = Store.luckysheetfile[this.getSheetIndex(index)];
let config = file.config, data = file.data, mergeConfig = config.merge;
let config = file.config, data = file.data;
if(config==null){
return;
}
let mergeConfig = config.merge;
if(mergeConfig==null || index in this.mergeCalculationSheet || file["autoCalculationMerge"]===false){
return;
}
Expand Down Expand Up @@ -1080,9 +1089,10 @@ const sheetmanage = {
let dataNameList = {};
for(let i = 0; i < calchain.length; i++){
let f = calchain[i];
let dataindex = f.index, func = f.func;
let dataindex = f.index;
let formulaTxt = getcellFormula(f.r, f.c, dataindex);

formula.functionParser(func[2], (str)=>{
formula.functionParser(formulaTxt, (str)=>{
if(str.indexOf("!")>-1){
let name = str.substr(0, str.indexOf('!'));
dataNameList[name] = true;
Expand Down Expand Up @@ -1142,7 +1152,7 @@ const sheetmanage = {
return ret;
},
showSheet: function() {
changeSheetContainerSize();
// changeSheetContainerSize();
$("#luckysheet-cell-flow_0").css({ "width": Store.ch_width, "top": "-1px" }); //width更新
$("#luckysheet-sheettable_0").css({ "width": Store.ch_width - 1, "height": Store.rh_height });
$("#luckysheetrowHeader_0").css("height", Store.rh_height);
Expand Down Expand Up @@ -1523,13 +1533,12 @@ const sheetmanage = {
}

let r = value.r, c = value.c;
let func = value.func;

if(op == "del" ){
formula.delFunctionGroup(r, c, index);
}
else {
formula.insertUpdateFunctionGroup(r, c, func, index);
formula.insertUpdateFunctionGroup(r, c, index);
}
}
else if(type == "cg"){
Expand Down
3 changes: 3 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.rowHeaderWidth = extendsetting.rowHeaderWidth;
luckysheetConfigsetting.columeHeaderHeight = extendsetting.columeHeaderHeight;

luckysheetConfigsetting.defaultColWidth = extendsetting.defaultColWidth;
luckysheetConfigsetting.defaultRowHeight = extendsetting.defaultRowHeight;

// Register plugins
initPlugins(extendsetting.plugins , extendsetting.data);

Expand Down
2 changes: 2 additions & 0 deletions src/demoData/sheetCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,8 @@ const sheetCell = {
},
"index": "0",
"zoomRatio":1,
// "defaultColWidth":20,
// "showGridLines":0,
"chart": [],
"status": "1",
"order": "0",
Expand Down
Loading

0 comments on commit bbaafe0

Please sign in to comment.