From 64f7d0e6c44c24f21e6e7d8d16beac6f23a5d770 Mon Sep 17 00:00:00 2001 From: wbfsa Date: Mon, 3 Aug 2020 22:43:41 +0800 Subject: [PATCH 1/3] fix(no fullscreen bug): when no fullscreen , div go to top bug fix --- src/controllers/handler.js | 7 ++-- src/controllers/matrixOperation.js | 38 +++++++++--------- src/controllers/menuButton.js | 56 +++++++++++++-------------- src/controllers/rowColumnOperation.js | 29 +++++++------- src/utils/util.js | 10 ++++- 5 files changed, 75 insertions(+), 65 deletions(-) diff --git a/src/controllers/handler.js b/src/controllers/handler.js index ffe6e84..65347b2 100644 --- a/src/controllers/handler.js +++ b/src/controllers/handler.js @@ -28,6 +28,7 @@ import { ArrayUnique, showrightclickmenu, luckysheetactiveCell, + luckysheetContainerFocus, } from '../utils/util'; import { getSheetIndex, getRangetxt } from '../methods/get'; import { @@ -867,7 +868,7 @@ export default function luckysheetHandler() { //数据透视表 pivotTable.pivotclick(row_index, col_index, Store.currentSheetIndex); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); //$("#luckysheet-cols-h-c .luckysheet-cols-h-cells-c .luckysheet-cols-h-cells-clip .luckysheet-cols-h-cell-sel").removeClass("luckysheet-cols-h-cell-sel").addClass("luckysheet-cols-h-cell-nosel"); @@ -3074,7 +3075,7 @@ export default function luckysheetHandler() { //底部添加行按钮 $("#luckysheet-bottom-add-row").on("click", function (e) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), value = $("#luckysheet-bottom-add-row-input").val(); @@ -3549,7 +3550,7 @@ export default function luckysheetHandler() { luckysheetMoveHighlightCell("down", 0, "rangeOfSelect"); } - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); }); diff --git a/src/controllers/matrixOperation.js b/src/controllers/matrixOperation.js index 382e907..95692ce 100644 --- a/src/controllers/matrixOperation.js +++ b/src/controllers/matrixOperation.js @@ -1,6 +1,6 @@ import selection from './selection'; import { - numFormat, + numFormat,luckysheetContainerFocus, } from '../utils/util'; import { hasPartMC, isEditMode } from '../global/validate'; import { getdatabyselection, getcellvalue } from '../global/getdata'; @@ -13,7 +13,7 @@ export function initialMatrixOperation(){ //复制为json格式字符串,首行为标题 $("#luckysheet-copy-json-head").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -86,7 +86,7 @@ export function initialMatrixOperation(){ //复制为json格式字符串,无标题,采用ABCD作为标题 $("#luckysheet-copy-json-nohead").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -147,7 +147,7 @@ export function initialMatrixOperation(){ //复制为一维数组 $("#luckysheet-copy-array1").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -204,7 +204,7 @@ export function initialMatrixOperation(){ //复制为二维数组 $("#luckysheet-copy-array2").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -383,7 +383,7 @@ export function initialMatrixOperation(){ //复制为对角线 $("#luckysheet-copy-diagonal").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -443,7 +443,7 @@ export function initialMatrixOperation(){ //复制为反对角线 $("#luckysheet-copy-antidiagonal").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -504,7 +504,7 @@ export function initialMatrixOperation(){ //复制为对角偏移n列 $("#luckysheet-copy-diagonaloffset").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -590,7 +590,7 @@ export function initialMatrixOperation(){ //复制为布尔值 $("#luckysheet-copy-boolvalue").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -671,7 +671,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 上下 $("#luckysheet-matrix-turn-up").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -707,7 +707,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 左右 $("#luckysheet-matrix-turn-left").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -743,7 +743,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 顺时针 $("#luckysheet-matrix-turn-cw").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -779,7 +779,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 逆时针 $("#luckysheet-matrix-turn-anticw").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -815,7 +815,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 转置 $("#luckysheet-matrix-turn-trans").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -864,7 +864,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 矩阵计算 $("#luckysheet-matrix-cal-confirm").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -957,7 +957,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除两端0值 按行 $("#luckysheet-matrix-delezero-row").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1025,7 +1025,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除两端0值 按列 $("#luckysheet-matrix-delezero-column").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1106,7 +1106,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除重复值 按行 $("#luckysheet-matrix-delerpt-row").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1167,7 +1167,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除重复值 按列 $("#luckysheet-matrix-delerpt-column").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ diff --git a/src/controllers/menuButton.js b/src/controllers/menuButton.js index 8651b8a..84d37ec 100644 --- a/src/controllers/menuButton.js +++ b/src/controllers/menuButton.js @@ -29,7 +29,7 @@ import { setcellvalue } from '../global/setdata'; import { countfunc } from '../global/count'; import { getSheetIndex, getRangetxt, getluckysheetfile } from '../methods/get'; import { setluckysheetfile } from '../methods/set'; -import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontformat } from '../utils/util'; +import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontformat,luckysheetContainerFocus } from '../utils/util'; import Store from '../store'; import locale from '../locale/locale'; import { connect } from 'tls'; @@ -418,7 +418,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -436,7 +436,7 @@ const menuButton = { $("#luckysheet-icon-fmtOtherSelf-menuButton").find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); $("#luckysheet-icon-fmtOtherSelf-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let itemvalue = $(this).attr("itemvalue"); @@ -482,7 +482,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"), itemname = $t.attr("itemname"); _this.focus($menuButton, itemvalue); @@ -581,13 +581,13 @@ const menuButton = { _this.updateFormat(d, "fc", color); $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); }, }); $menuButton.find(".luckysheet-color-reset").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $input = $("#"+ menuButtonId).find(".luckysheet-color-selected"); $input.val("#000000"); @@ -602,7 +602,7 @@ const menuButton = { //交替颜色 $menuButton.find(".luckysheet-icon-alternateformat").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -719,13 +719,13 @@ const menuButton = { _this.updateFormat(d, "bg", color); $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); } }); $menuButton.find(".luckysheet-color-reset").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $input = $("#" + menuButtonId).find(".luckysheet-color-selected"); $input.val("#ffffff"); @@ -740,7 +740,7 @@ const menuButton = { //交替颜色 $menuButton.find(".luckysheet-icon-alternateformat").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -819,7 +819,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"), $input = $("#luckysheet-icon-font-size input"); $("#luckysheet-icon-font-size").attr("itemvalue", itemvalue); @@ -1020,7 +1020,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); if(itemvalue == "borderColor" || itemvalue == "borderSize"){ @@ -1220,7 +1220,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(selectIsOverlap()){ if(isEditMode()){ @@ -1311,7 +1311,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1367,7 +1367,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1414,7 +1414,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1464,7 +1464,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1516,7 +1516,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1780,7 +1780,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -1849,7 +1849,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -1977,7 +1977,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2264,7 +2264,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2343,7 +2343,7 @@ const menuButton = { $(document).off("click.CFhighlightCellRule").on("click.CFhighlightCellRule", "#luckysheet-icon-highlightCellRule-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-highlightCellRule-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2461,7 +2461,7 @@ const menuButton = { $(document).off("click.CFprojectSelectRule").on("click.CFprojectSelectRule", "#luckysheet-icon-projectSelectRule-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-projectSelectRule-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2565,7 +2565,7 @@ const menuButton = { $(document).off("click.CFdataBar").on("click.CFdataBar", "#luckysheet-icon-dataBar-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-dataBar-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2581,7 +2581,7 @@ const menuButton = { $(document).off("click.CFcolorGradation").on("click.CFcolorGradation", "#luckysheet-icon-colorGradation-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-colorGradation-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2597,7 +2597,7 @@ const menuButton = { $(document).off("click.CFdeleteRule").on("click.CFdeleteRule", "#luckysheet-icon-deleteRule-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-deleteRule-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2667,7 +2667,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); diff --git a/src/controllers/rowColumnOperation.js b/src/controllers/rowColumnOperation.js index 888ae4d..10756f4 100644 --- a/src/controllers/rowColumnOperation.js +++ b/src/controllers/rowColumnOperation.js @@ -6,7 +6,8 @@ import server from './server'; import { selectHightlightShow, luckysheet_count_show,selectHelpboxFill } from './select'; import { getObjType, - showrightclickmenu, + showrightclickmenu, + luckysheetContainerFocus, } from '../utils/util'; import { getSheetIndex, getRangetxt } from '../methods/get'; import { @@ -909,7 +910,7 @@ export function rowColumnOperationInitial(){ //向左增加列,向上增加行 $("#luckysheet-add-lefttop, #luckysheet-add-lefttop_t").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -951,7 +952,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-addTopRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -993,7 +994,7 @@ export function rowColumnOperationInitial(){ }) $("#luckysheet-addLeftCols").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1037,7 +1038,7 @@ export function rowColumnOperationInitial(){ //向右增加列,向下增加行 $("#luckysheet-add-rightbottom, #luckysheet-add-rightbottom_t").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1080,7 +1081,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-addBottomRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1123,7 +1124,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-addRightCols").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1168,7 +1169,7 @@ export function rowColumnOperationInitial(){ //删除选中行列 $("#luckysheet-del-selected, #luckysheet-del-selected_t").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheetRightHeadClickIs == "row"){ @@ -1196,7 +1197,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-delRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheetRightHeadClickIs == "row"){ @@ -1224,7 +1225,7 @@ export function rowColumnOperationInitial(){ }) $("#luckysheet-delCols").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheetRightHeadClickIs == "row"){ @@ -1254,7 +1255,7 @@ export function rowColumnOperationInitial(){ //隐藏、显示行 $("#luckysheet-hidRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let cfg = $.extend(true, {}, Store.config); if(cfg["rowhidden"] == null){ @@ -1295,7 +1296,7 @@ export function rowColumnOperationInitial(){ }) $("#luckysheet-showHidRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let cfg = $.extend(true, {}, Store.config); if(cfg["rowhidden"] == null){ @@ -1338,7 +1339,7 @@ export function rowColumnOperationInitial(){ //清除单元格内容 $("#luckysheet-delete-text").click(function(){ $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 0){ let d = editor.deepCopyFlowData(Store.flowdata); @@ -1405,7 +1406,7 @@ export function rowColumnOperationInitial(){ //行高列宽设置 $("#luckysheet-rows-cols-changesize").click(function(){ $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let size = parseInt($(this).siblings("input[type='number']").val().trim()); diff --git a/src/utils/util.js b/src/utils/util.js index 17eedc9..f09207c 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -383,6 +383,13 @@ function luckysheetactiveCell() { } } +//单元格编辑聚焦 +function luckysheetContainerFocus() { + $("#" + Store.container).attr("tabindex", 0).focus({ + preventScroll: true + }); +} + //数字格式 function numFormat(num, type) { if (num == null || isNaN(parseFloat(num)) || hasChinaword(num) || num == -Infinity || num == Infinity) { @@ -638,5 +645,6 @@ export { $$, seriesLoadScripts, parallelLoadScripts, - loadLinks + loadLinks, + luckysheetContainerFocus } \ No newline at end of file From 04e2b8e06965673f807a46fbcda2a403711ec7ea Mon Sep 17 00:00:00 2001 From: wbfsa Date: Tue, 4 Aug 2020 00:53:31 +0800 Subject: [PATCH 2/3] fix(mobile touch): moubile touch fix --- src/controllers/mobile.js | 2 +- src/global/scroll.js | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/controllers/mobile.js b/src/controllers/mobile.js index 1b88552..b83fbe0 100644 --- a/src/controllers/mobile.js +++ b/src/controllers/mobile.js @@ -227,7 +227,7 @@ export default function mobileinit(){ $(document).on("touchstart", ".luckysheet-cs-touchhandle", function(event){ luckysheet_touchhandle_status = true; luckysheet_touchmove_status = false; - console.log(1111111111); + // console.log(1111111111); event.stopPropagation(); }) diff --git a/src/global/scroll.js b/src/global/scroll.js index f53c904..ad8a24f 100644 --- a/src/global/scroll.js +++ b/src/global/scroll.js @@ -19,12 +19,12 @@ export default function luckysheetscrollevent(isadjust) { let scrollLeft = $("#luckysheet-scrollbar-x").scrollLeft(), scrollTop = $("#luckysheet-scrollbar-y").scrollTop(); - clearTimeout(scrollTimeOutCancel); + // clearTimeout(scrollTimeOutCancel); - scrollTimeOutCancel = setTimeout(() => { - scrollRequestAnimationFrameIni = true; - window.cancelAnimationFrame(scrollRequestAnimationFrame); - }, 500); + // scrollTimeOutCancel = setTimeout(() => { + // scrollRequestAnimationFrameIni = true; + // window.cancelAnimationFrame(scrollRequestAnimationFrame); + // }, 500); // if (!!isadjust) { // let scrollHeight = $t.get(0).scrollHeight; @@ -92,13 +92,12 @@ export default function luckysheetscrollevent(isadjust) { "z-index": $("#luckysheet-input-box").css("z-index") }).show(); - if(scrollRequestAnimationFrameIni && Store.scrollRefreshSwitch){ - execScroll(); - scrollRequestAnimationFrameIni = false; - } - // window.requestAnimationFrame(()=>{ - // luckysheetrefreshgrid(scrollLeft, scrollTop); - // }); + // if(scrollRequestAnimationFrameIni && Store.scrollRefreshSwitch){ + // execScroll(); + // scrollRequestAnimationFrameIni = false; + // } + + luckysheetrefreshgrid(scrollLeft, scrollTop); $("#luckysheet-bottom-controll-row").css("left", scrollLeft + 10); From fb3b5122a5f4e333cca581251ef6d672da767b37 Mon Sep 17 00:00:00 2001 From: wpxp123456 <2677556700@qq.com> Date: Tue, 4 Aug 2020 13:58:40 +0800 Subject: [PATCH 3/3] fix(bug): bug bug --- src/controllers/handler.js | 47 ++++++++++++++++++--------- src/controllers/ifFormulaGenerator.js | 2 ++ src/controllers/locationCell.js | 3 ++ src/controllers/menuButton.js | 7 ++-- src/controllers/selection.js | 5 +-- src/controllers/splitColumn.js | 8 +++++ src/index.html | 3 +- src/locale/zh.js | 2 +- 8 files changed, 56 insertions(+), 21 deletions(-) diff --git a/src/controllers/handler.js b/src/controllers/handler.js index 65347b2..fd21ea2 100644 --- a/src/controllers/handler.js +++ b/src/controllers/handler.js @@ -20,6 +20,7 @@ import { selectHightlightShow, selectIsOverlap, selectionCopyShow, luckysheet_co import selection from './selection'; import controlHistory from './controlHistory'; import splitColumn from './splitColumn'; +import { luckysheetdefaultstyle } from './constant'; import { replaceHtml, @@ -3260,7 +3261,7 @@ export default function luckysheetHandler() { return; } - //复制范围内包含部分合并单元格,提示 + //截图范围内包含部分合并单元格,提示 if (Store.config["merge"] != null) { let has_PartMC = false; @@ -3293,14 +3294,6 @@ export default function luckysheetHandler() { let st_c = Store.luckysheet_select_save[0].column[0], ed_c = Store.luckysheet_select_save[0].column[1]; - let shotData = datagridgrowth([], ed_r + 1, ed_c + 1); - - for (let r = st_r; r <= ed_r; r++) { - for (let c = st_c; c <= ed_c; c++) { - shotData[r][c] = Store.flowdata[r][c]; - } - } - let scrollHeight, rh_height; if (st_r - 1 < 0) { scrollHeight = 0; @@ -3326,13 +3319,37 @@ export default function luckysheetHandler() { height: Math.ceil(rh_height * devicePixelRatio) }).css({ width: ch_width, height: rh_height }); - let d = Store.flowdata; - Store.flowdata = shotData; - luckysheetDrawMain(scrollWidth, scrollHeight, ch_width, rh_height, 1, 1, null, null, newCanvas); - - Store.flowdata = d; - editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据 + let ctx_newCanvas = newCanvas.get(0).getContext("2d"); + + //补上 左边框和上边框 + ctx_newCanvas.beginPath(); + ctx_newCanvas.moveTo( + 0, + 0 + ); + ctx_newCanvas.lineTo( + 0, + Store.devicePixelRatio * rh_height + ); + ctx_newCanvas.lineWidth = Store.devicePixelRatio * 2; + ctx_newCanvas.strokeStyle = luckysheetdefaultstyle.strokeStyle; + ctx_newCanvas.stroke(); + ctx_newCanvas.closePath(); + + ctx_newCanvas.beginPath(); + ctx_newCanvas.moveTo( + 0, + 0 + ); + ctx_newCanvas.lineTo( + Store.devicePixelRatio * ch_width, + 0 + ); + ctx_newCanvas.lineWidth = Store.devicePixelRatio * 2; + ctx_newCanvas.strokeStyle = luckysheetdefaultstyle.strokeStyle; + ctx_newCanvas.stroke(); + ctx_newCanvas.closePath(); let image = new Image(); let url = newCanvas.get(0).toDataURL("image/png"); diff --git a/src/controllers/ifFormulaGenerator.js b/src/controllers/ifFormulaGenerator.js index 35a17a9..9340ff5 100644 --- a/src/controllers/ifFormulaGenerator.js +++ b/src/controllers/ifFormulaGenerator.js @@ -472,6 +472,8 @@ const ifFormulaGenerator = { $("#luckysheet-ifFormulaGenerator-multiRange-dialog").css({ "left": (winw + scrollLeft - myw) / 2, "top": (winh + scrollTop - myh) / 3 }).show(); }, getIfList: function(compareValue, smallRange, largeRange, method, methodVal){ + const locale_formula = locale().formula; + $("#luckysheet-ifFormulaGenerator-dialog .ifList").empty(); smallRange = parseInt(smallRange); diff --git a/src/controllers/locationCell.js b/src/controllers/locationCell.js index 9a5c8d3..8e64beb 100644 --- a/src/controllers/locationCell.js +++ b/src/controllers/locationCell.js @@ -108,6 +108,8 @@ const luckysheetLocationCell = { init: function(){ let _this = this; + const locale_location = locale().findAndReplace; + $(document).on("click", "#luckysheet-locationCell-dialog .listItem input:radio", function(e){ $("#luckysheet-locationCell-dialog .listItem input:checkbox").prop("disabled", true); $("#luckysheet-locationCell-dialog .listItem .subbox label").css("color", "#666"); @@ -213,6 +215,7 @@ const luckysheetLocationCell = { }); }, apply: function(range, type, value){ + const locale_location = locale().findAndReplace; let rangeArr = []; if(type == "locationFormula" || type == "locationConstant" || type == "locationNull"){ //公式 常量 空值 diff --git a/src/controllers/menuButton.js b/src/controllers/menuButton.js index 84d37ec..d70e57c 100644 --- a/src/controllers/menuButton.js +++ b/src/controllers/menuButton.js @@ -2736,8 +2736,10 @@ const menuButton = { }, getQKBorder: function(width, type, color){ let bordertype = ""; + if(width.indexOf("pt") > -1){ - let width = parseFloat(width); + width = parseFloat(width); + if(width < 1){ } @@ -2749,7 +2751,8 @@ const menuButton = { } } else{ - let width = parseFloat(width); + width = parseFloat(width); + if(width < 2){ } diff --git a/src/controllers/selection.js b/src/controllers/selection.js index d825d42..cd56e7d 100644 --- a/src/controllers/selection.js +++ b/src/controllers/selection.js @@ -429,7 +429,7 @@ const selection = { } if(c_value == null){ - c_value = ""; + c_value = " "; } column += c_value; @@ -488,7 +488,8 @@ const selection = { } } - column = replaceHtml(column, {"style":style, "span":""}); + column = replaceHtml(column, {"style": style, "span": ""}); + column += " "; } column += ''; diff --git a/src/controllers/splitColumn.js b/src/controllers/splitColumn.js index 7eb53b4..8675c97 100644 --- a/src/controllers/splitColumn.js +++ b/src/controllers/splitColumn.js @@ -249,6 +249,10 @@ const luckysheetSplitColumn = { value = getcellvalue(r, c, Store.flowdata); } + if(value == null){ + value = ""; + } + rowArr = value.toString().split(reg); dataArr.push(rowArr); @@ -287,6 +291,10 @@ const luckysheetSplitColumn = { value = getcellvalue(r, c, Store.flowdata); } + if(value == null){ + value = ""; + } + rowArr.push(value); arr.push(rowArr); diff --git a/src/index.html b/src/index.html index 4c467e0..ec8d314 100644 --- a/src/index.html +++ b/src/index.html @@ -33,7 +33,8 @@ luckysheet.create({ container: 'luckysheet', - lang: 'en', + // lang: 'en', + lang: 'zh', allowEdit:true, plugins: ['chart'], data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetSparkline,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart] diff --git a/src/locale/zh.js b/src/locale/zh.js index a8c7b2a..6cf101d 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -584,7 +584,7 @@ export default { successTip:"已成功复制(如果粘贴失败,请在图片上右键点击'复制图片')", }, splitText:{ - splitSymbol:"分割符号", + splitDelimiters:"分割符号", splitOther:"其它", splitContinueSymbol:"连续分隔符号视为单个处理", splitDataPreview:"数据预览",