diff --git a/src/controllers/resize.js b/src/controllers/resize.js index 4673d5c..f3d89db 100644 --- a/src/controllers/resize.js +++ b/src/controllers/resize.js @@ -8,7 +8,7 @@ import tooltip from '../global/tooltip' import { $$, getObjType, camel2split } from "../utils/util"; import { defaultToolbar, toolbarIdMap } from './toolbar'; -let gridW = 0, +let gridW = 0, gridH = 0; export default function luckysheetsizeauto(isRefreshCanvas=true) { @@ -41,7 +41,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { // Store.sheetBarHeight = 31; // } - + customSheetbarConfig(); // if (!luckysheetConfigsetting.showstatisticBar) { @@ -73,7 +73,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { if(luckysheetConfigsetting.showConfigWindowResize){//数据透视表 图表 交替颜色 Protection if($("#luckysheet-modal-dialog-slider-pivot").is(":visible")){ gridW -= $("#luckysheet-modal-dialog-slider-pivot").outerWidth(); - } + } else if($(".chartSetting").is(":visible")){ gridW -= $(".chartSetting").outerWidth(); } @@ -82,12 +82,12 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { } if($("#luckysheet-modal-dialog-slider-protection").is(":visible")){ gridW -= $("#luckysheet-modal-dialog-slider-protection").outerWidth(); - } + } } const _locale = locale(); const locale_toolbar = _locale.toolbar; - let ismore = false, + let ismore = false, toolbarW = 0, morebtn = `
@@ -104,7 +104,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
`, // Add style left:$$('.luckysheet') left, when the worksheet does not fill the full screen morediv = '
'; - + if($("#luckysheet-icon-morebtn-div").length == 0){ $("body").append(morediv); } @@ -116,7 +116,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { $("#luckysheet-icon-morebtn-div > div").each(function(){ const $t = $(this)[0]; const $container = $("#luckysheet-wa-editor")[0]; - + $container.appendChild(document.createTextNode(" ")); $container.appendChild($t); }); @@ -155,11 +155,11 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { }else{ $("#luckysheet-icon-morebtn-div").append($(`${element}`)); } - + } if(ismore){ - + $("#luckysheet-wa-editor").append(morebtn); $("#luckysheet-icon-morebtn").click(function(){ @@ -174,10 +174,10 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { } let right = $(window).width() - $("#luckysheet-icon-morebtn").offset().left - $("#luckysheet-icon-morebtn").width()+ $("body").scrollLeft(); - - + + // $("#luckysheet-icon-morebtn-div").toggle().css("right", right < 0 ? 0 : right); - + // use native js operation $$('#luckysheet-icon-morebtn-div').style.right = right < 0 ? 0 : right + 'px'; @@ -212,10 +212,10 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { $(this).find(".luckysheet-toolbar-button-inner-box").html(toolMoreHTML); } - + }); //$("#luckysheet-wa-editor div").trigger("create"); - + // $("#luckysheet-icon-morebtn-div .luckysheet-toolbar-menu-button").css("margin-right", -1); // $("#luckysheet-icon-morebtn-div .luckysheet-toolbar-button-split-left").css("margin-right", -3); @@ -235,7 +235,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { // tooltip tooltip.createHoverTip("#luckysheet-icon-morebtn-div" ,".luckysheet-toolbar-menu-button, .luckysheet-toolbar-button, .luckysheet-toolbar-combo-button"); } - + $("#"+ Store.container + " .luckysheet-wa-editor .luckysheet-toolbar-button-split-left").off("hover").hover(function(){ $(this).next(".luckysheet-toolbar-button-split-right").addClass("luckysheet-toolbar-button-split-right-hover"); }, function(){ @@ -254,7 +254,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) { $("#" + Store.container).find(".luckysheet").height(gridH - 2).width(gridW - 2); changeSheetContainerSize(gridW, gridH) - + if(isRefreshCanvas){ luckysheetrefreshgrid($("#luckysheet-cell-main").scrollLeft(), $("#luckysheet-cell-main").scrollTop()); } @@ -274,7 +274,7 @@ export function changeSheetContainerSize(gridW, gridH){ } Store.cellmainHeight = gridH - (Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columnHeaderHeight + Store.sheetBarHeight + Store.statisticBarHeight); Store.cellmainWidth = gridW - Store.rowHeaderWidth; - + $("#luckysheet-cols-h-c, #luckysheet-cell-main").width(Store.cellmainWidth); $("#luckysheet-cell-main").height(Store.cellmainHeight); $("#luckysheet-rows-h").height(Store.cellmainHeight - Store.cellMainSrollBarSize); @@ -286,13 +286,13 @@ export function changeSheetContainerSize(gridW, gridH){ $("#luckysheet-scrollbar-x").width(Store.cellmainWidth).css("left", Store.rowHeaderWidth - 2); Store.luckysheetTableContentHW = [ - Store.cellmainWidth + Store.rowHeaderWidth - Store.cellMainSrollBarSize, + Store.cellmainWidth + Store.rowHeaderWidth - Store.cellMainSrollBarSize, Store.cellmainHeight + Store.columnHeaderHeight - Store.cellMainSrollBarSize ]; - $("#luckysheetTableContent, #luckysheetTableContentF").attr({ - width: Math.ceil(Store.luckysheetTableContentHW[0] * Store.devicePixelRatio), - height: Math.ceil(Store.luckysheetTableContentHW[1] * Store.devicePixelRatio) + $("#luckysheetTableContent, #luckysheetTableContentF").attr({ + width: Math.ceil(Store.luckysheetTableContentHW[0] * Store.devicePixelRatio), + height: Math.ceil(Store.luckysheetTableContentHW[1] * Store.devicePixelRatio) }) .css({ width: Store.luckysheetTableContentHW[0], height: Store.luckysheetTableContentHW[1] }); @@ -313,15 +313,15 @@ export function changeSheetContainerSize(gridW, gridH){ .end() .find(".luckysheet-freezebar-vertical-drop") .css({ "height": gridheight - 10 }); - + luckysheetFreezen.createAssistCanvas(); } /** - * - * + * + * * Toolbar judgment rules: First set the display and hide of all tool buttons according to showtoolbar, and then override the judgment of showtoolbar according to showtoolbarConfig rules - * + * * The width value of each button in the statistics toolbar is used to calculate which needs to be placed in more buttons */ export function menuToolBarWidth() { @@ -331,10 +331,10 @@ export function menuToolBarWidth() { const toobarWidths = Store.toobarObject.toobarWidths = []; const toobarElements = Store.toobarObject.toobarElements = []; const toolbarConfig = Store.toobarObject.toolbarConfig = buildBoolBarConfig(); - + /** * 基于 showtoolbarConfig 配置 动态生成 toolbarConfig - * @returns {object} + * @returns {object} * @input showtoolbarConfig = ['undo', 'redo', '|' , 'font' , 'moreFormats', '|'] * { * undo: {ele: '#luckysheet-icon-undo', index: 0}, @@ -388,20 +388,19 @@ export function menuToolBarWidth() { config[s] = false; } } - + if (JSON.stringify(showtoolbarConfig) !== '{}') { if(showtoolbarConfig.hasOwnProperty('undoRedo')){ config.undo = config.redo = showtoolbarConfig.undoRedo; - delete showtoolbarConfig.undoRedo; } Object.assign(config, showtoolbarConfig); - + let current,next; let index = 0; for (let i = 0; i{ toobarWidths[i] -= containerLeft; }) - + } /** @@ -481,18 +480,18 @@ function customSheetbarConfig() { menu: true, //Worksheet management menu sheet: true //Worksheet display } - + if(!luckysheetConfigsetting.showsheetbar){ for(let s in config){ config[s] = false; } } - + // showsheetbarConfig determines the final result if(JSON.stringify(luckysheetConfigsetting.showsheetbarConfig) !== '{}'){ Object.assign(config,luckysheetConfigsetting.showsheetbarConfig); } - + luckysheetConfigsetting.showsheetbarConfig = config; } @@ -508,19 +507,19 @@ function customSheetbarConfig() { $('#luckysheet-sheets-add').hide(); isHide++; break; - + case 'menu': $('#luckysheet-sheets-m').hide(); isHide++; break; - + case 'sheet': $('#luckysheet-sheet-container').hide(); $('#luckysheet-sheets-leftscroll').hide(); $('#luckysheet-sheets-rightscroll').hide(); isHide++; break; - + default: break; } @@ -551,18 +550,18 @@ function customStatisticBarConfig() { view: true, // print view zoom: true // Zoom } - + if(!luckysheetConfigsetting.showstatisticBar){ for(let s in config){ config[s] = false; } } - + // showstatisticBarConfig determines the final result if(JSON.stringify(luckysheetConfigsetting.showstatisticBarConfig) !== '{}'){ Object.assign(config,luckysheetConfigsetting.showstatisticBarConfig); } - + luckysheetConfigsetting.showstatisticBarConfig = config; } @@ -578,7 +577,7 @@ function customStatisticBarConfig() { $('#luckysheet-sta-content').hide(); isHide++; break; - + case 'view': $('.luckysheet-print-viewList').hide(); isHide++; @@ -588,7 +587,7 @@ function customStatisticBarConfig() { $('#luckysheet-zoom-content').hide(); isHide++; break; - + default: break; } @@ -603,4 +602,4 @@ function customStatisticBarConfig() { $("#" + Store.container).find(".luckysheet-stat-area").show(); Store.statisticBarHeight = 23; } -} \ No newline at end of file +} diff --git a/src/controllers/toolbar.js b/src/controllers/toolbar.js index 6156110..f5faa5f 100644 --- a/src/controllers/toolbar.js +++ b/src/controllers/toolbar.js @@ -873,7 +873,6 @@ export function createToolbarHtml() { if (JSON.stringify(showtoolbarConfig) !== '{}') { if(showtoolbarConfig.hasOwnProperty('undoRedo')){ config.undo = config.redo = showtoolbarConfig.undoRedo; - delete showtoolbarConfig.undoRedo; } Object.assign(config, showtoolbarConfig); }