From 4a7850b86ef1086fe18fa7961a62bbc622ed760d Mon Sep 17 00:00:00 2001 From: liuyang Date: Sat, 1 Aug 2020 01:46:37 +0800 Subject: [PATCH] fix(sheet change arrow): fix bug --- src/controllers/pivotTable.js | 2 +- src/controllers/resize.js | 4 ++++ src/controllers/sheetBar.js | 12 +----------- src/controllers/sheetmanage.js | 17 +++++++++++++++++ src/global/refresh.js | 4 +++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/controllers/pivotTable.js b/src/controllers/pivotTable.js index eed268c8b..0679c7026 100644 --- a/src/controllers/pivotTable.js +++ b/src/controllers/pivotTable.js @@ -2342,7 +2342,7 @@ const pivotTable = { $("#luckysheet-dialog-pivotTable-range").html(getRangetxt(_this.pivotDataSheetIndex, _this.pivot_select_save)); $("#luckysheet-modal-dialog-slider-pivot").show(); - sheetmanage.sheetBarShowAndHide(); + luckysheetsizeauto(); }, getComposeArray: function (data) { diff --git a/src/controllers/resize.js b/src/controllers/resize.js index b5fff7d89..456183c6e 100644 --- a/src/controllers/resize.js +++ b/src/controllers/resize.js @@ -3,6 +3,7 @@ import luckysheetFreezen from './freezen'; import { luckysheetrefreshgrid } from '../global/refresh'; import Store from '../store'; import locale from '../locale/locale'; +import sheetmanage from './sheetmanage'; let gridW = 0, gridH = 0; @@ -167,4 +168,7 @@ export default function luckysheetsizeauto() { }, function(){ $(this).prev(".luckysheet-toolbar-button-split-left").removeClass("luckysheet-toolbar-button-hover"); }); + + sheetmanage.sheetArrowShowAndHide(); + sheetmanage.sheetBarShowAndHide(); } \ No newline at end of file diff --git a/src/controllers/sheetBar.js b/src/controllers/sheetBar.js index 0d5e99b5a..c048ee6d9 100644 --- a/src/controllers/sheetBar.js +++ b/src/controllers/sheetBar.js @@ -244,17 +244,7 @@ export function initialSheetBar(){ } } - let winW = $(window).width(); - - let c_width = 0; - $("#luckysheet-sheet-container-c > div.luckysheet-sheets-item:visible").each(function(){ - c_width += $(this).outerWidth(); - }); - - if (c_width >= winW * 0.7) { - $("#luckysheet-sheet-area .luckysheet-sheets-scroll").css("display", "inline-block"); - $("#luckysheet-sheet-container .docs-sheet-fade-left").show(); - } + sheetmanage.sheetArrowShowAndHide(); Store.luckysheetfile[index].name = txt; server.saveParam("all", Store.currentSheetIndex, txt, { "k": "name" }); diff --git a/src/controllers/sheetmanage.js b/src/controllers/sheetmanage.js index e996a2ec3..44aa191aa 100644 --- a/src/controllers/sheetmanage.js +++ b/src/controllers/sheetmanage.js @@ -1041,6 +1041,23 @@ const sheetmanage = { this.sheetBarShowAndHide(index); }, + sheetArrowShowAndHide(){ + let containerW = $("#luckysheet-sheet-container").width(); + + let c_width = 0; + $("#luckysheet-sheet-container-c > div.luckysheet-sheets-item:visible").each(function(){ + c_width += $(this).outerWidth(); + }); + + if (c_width >= containerW) { + $("#luckysheet-sheet-area .luckysheet-sheets-scroll").css("display", "inline-block"); + $("#luckysheet-sheet-container .docs-sheet-fade-left").show(); + } + else{ + $("#luckysheet-sheet-area .luckysheet-sheets-scroll").css("display", "none"); + $("#luckysheet-sheet-container .docs-sheet-fade-left").hide(); + } + }, sheetBarShowAndHide(index){ let $c = $("#luckysheet-sheet-container-c"); diff --git a/src/global/refresh.js b/src/global/refresh.js index c275b0917..619d88f6f 100644 --- a/src/global/refresh.js +++ b/src/global/refresh.js @@ -116,7 +116,9 @@ function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction server.historyParam(Store.flowdata, Store.currentSheetIndex, range[s]); } // 刷新图表 - Store.chartparam.jfrefreshchartall(Store.flowdata,range[s].row[0],range[s].row[1],range[s].column[0],range[s].column[1]) + if(typeof(Store.chartparam.jfrefreshchartall)=="function"){ + Store.chartparam.jfrefreshchartall(Store.flowdata,range[s].row[0],range[s].row[1],range[s].column[0],range[s].column[1]); + } } //刷新表格