Browse Source

fix(bug): bug

bug
master
wpxp123456 5 years ago
parent
commit
726300811a
  1. 16
      src/controllers/filter.js
  2. 1
      src/controllers/handler.js
  3. 66
      src/controllers/rowColumnOperation.js
  4. 69
      src/controllers/sheetmanage.js
  5. 8
      src/global/draw.js
  6. 1
      src/locale/en.js
  7. 1
      src/locale/zh.js

16
src/controllers/filter.js

@ -100,11 +100,13 @@ function orderbydatafiler(str, stc, edr, edc, index, asc) {
} }
if(hasMc){ if(hasMc){
const locale_filter = locale().filter;
if(isEditMode()){ if(isEditMode()){
alert("筛选选区有合并单元格,无法执行此操作!"); alert(locale_filter.mergeError);
} }
else{ else{
tooltip.info("筛选选区有合并单元格,无法执行此操作!", ""); tooltip.info(locale_filter.mergeError, "");
} }
return; return;
@ -134,13 +136,15 @@ function createFilter() {
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
$("#luckysheet-filter-menu, #luckysheet-filter-submenu").hide(); $("#luckysheet-filter-menu, #luckysheet-filter-submenu").hide();
$("#" + container).attr("tabindex", 0).focus(); $("#" + Store.container).attr("tabindex", 0).focus();
const locale_splitText = locale().splitText;
if(isEditMode()){ if(isEditMode()){
alert("不能对多重选择区域执行此操作,请选择单个区域,然后再试"); alert(locale_splitText.tipNoMulti);
} }
else{ else{
tooltip.info("不能对多重选择区域执行此操作,请选择单个区域,然后再试", ""); tooltip.info(locale_splitText.tipNoMulti, "");
} }
return; return;
@ -277,8 +281,6 @@ function createFilterOptions(luckysheet_filter_save, filterObj) {
file.filter_select = luckysheet_filter_save; file.filter_select = luckysheet_filter_save;
} }
function initialFilterHandler(){ function initialFilterHandler(){
//filter event handler //filter event handler
let hidefilersubmenu = null; let hidefilersubmenu = null;

1
src/controllers/handler.js

@ -185,7 +185,6 @@ export default function luckysheetHandler() {
// setTimeout(function(){ // setTimeout(function(){
luckysheetscrollevent(); luckysheetscrollevent();
// },10); // },10);
}) })
.mousewheel(function (event, delta) { .mousewheel(function (event, delta) {
event.preventDefault(); event.preventDefault();

66
src/controllers/rowColumnOperation.js

@ -35,12 +35,9 @@ import {getMeasureText} from '../global/getRowlen';
import { luckysheet_searcharray } from '../controllers/sheetSearch'; import { luckysheet_searcharray } from '../controllers/sheetSearch';
import Store from '../store'; import Store from '../store';
export function rowColumnOperationInitial(){ export function rowColumnOperationInitial(){
//表格行标题 mouse事件
//表格行标题 mouse事件
$("#luckysheet-rows-h").mousedown(function (event) { $("#luckysheet-rows-h").mousedown(function (event) {
//有批注在编辑时 //有批注在编辑时
luckysheetPostil.removeActivePs(); luckysheetPostil.removeActivePs();
@ -809,7 +806,6 @@ export function rowColumnOperationInitial(){
} }
}); });
//表格行标题 改变行高按钮 //表格行标题 改变行高按钮
$("#luckysheet-rows-change-size").mousedown(function (event) { $("#luckysheet-rows-change-size").mousedown(function (event) {
//有批注在编辑时 //有批注在编辑时
@ -915,6 +911,10 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const _locale = locale();
const locale_drag = _locale.drag;
const locale_info = _locale.info;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){ if(isEditMode()){
alert(locale_drag.noMulti); alert(locale_drag.noMulti);
@ -926,6 +926,8 @@ export function rowColumnOperationInitial(){
return; return;
} }
let $t = $(this), value = $t.parent().find("input").val(); let $t = $(this), value = $t.parent().find("input").val();
if (!isRealNum(value)) { if (!isRealNum(value)) {
if(isEditMode()){ if(isEditMode()){
@ -957,6 +959,10 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const _locale = locale();
const locale_drag = _locale.drag;
const locale_info = _locale.info;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){ if(isEditMode()){
alert(locale_drag.noMulti); alert(locale_drag.noMulti);
@ -984,10 +990,10 @@ export function rowColumnOperationInitial(){
if (value < 1 || value > 100) { if (value < 1 || value > 100) {
if(isEditMode()){ if(isEditMode()){
alert(llocale_info.tipInputNumberLimit); alert(locale_info.tipInputNumberLimit);
} }
else{ else{
tooltip.info(llocale_info.tipInputNumberLimit, ""); tooltip.info(locale_info.tipInputNumberLimit, "");
} }
return; return;
} }
@ -999,6 +1005,10 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const _locale = locale();
const locale_drag = _locale.drag;
const locale_info = _locale.info;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){ if(isEditMode()){
alert(locale_drag.noMulti); alert(locale_drag.noMulti);
@ -1026,10 +1036,10 @@ export function rowColumnOperationInitial(){
if (value < 1 || value > 100) { if (value < 1 || value > 100) {
if(isEditMode()){ if(isEditMode()){
alert(llocale_info.tipInputNumberLimit); alert(locale_info.tipInputNumberLimit);
} }
else{ else{
tooltip.info(llocale_info.tipInputNumberLimit, ""); tooltip.info(locale_info.tipInputNumberLimit, "");
} }
return; return;
} }
@ -1043,6 +1053,10 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const _locale = locale();
const locale_drag = _locale.drag;
const locale_info = _locale.info;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){ if(isEditMode()){
alert(locale_drag.noMulti); alert(locale_drag.noMulti);
@ -1070,10 +1084,10 @@ export function rowColumnOperationInitial(){
if (value < 1 || value > 100) { if (value < 1 || value > 100) {
if(isEditMode()){ if(isEditMode()){
alert(llocale_info.tipInputNumberLimit); alert(locale_info.tipInputNumberLimit);
} }
else{ else{
tooltip.info(llocale_info.tipInputNumberLimit, ""); tooltip.info(locale_info.tipInputNumberLimit, "");
} }
return; return;
@ -1086,6 +1100,10 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const _locale = locale();
const locale_drag = _locale.drag;
const locale_info = _locale.info;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){ if(isEditMode()){
alert(locale_drag.noMulti); alert(locale_drag.noMulti);
@ -1113,10 +1131,10 @@ export function rowColumnOperationInitial(){
if (value < 1 || value > 100) { if (value < 1 || value > 100) {
if(isEditMode()){ if(isEditMode()){
alert(llocale_info.tipInputNumberLimit); alert(locale_info.tipInputNumberLimit);
} }
else{ else{
tooltip.info(llocale_info.tipInputNumberLimit, ""); tooltip.info(locale_info.tipInputNumberLimit, "");
} }
return; return;
@ -1129,6 +1147,10 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const _locale = locale();
const locale_drag = _locale.drag;
const locale_info = _locale.info;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){ if(isEditMode()){
alert(locale_drag.noMulti); alert(locale_drag.noMulti);
@ -1156,10 +1178,10 @@ export function rowColumnOperationInitial(){
if (value < 1 || value > 100) { if (value < 1 || value > 100) {
if(isEditMode()){ if(isEditMode()){
alert(llocale_info.tipInputNumberLimit); alert(locale_info.tipInputNumberLimit);
} }
else{ else{
tooltip.info(llocale_info.tipInputNumberLimit, ""); tooltip.info(locale_info.tipInputNumberLimit, "");
} }
return; return;
@ -1174,6 +1196,8 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const locale_drag = locale().drag;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(Store.luckysheetRightHeadClickIs == "row"){ if(Store.luckysheetRightHeadClickIs == "row"){
if(isEditMode()){ if(isEditMode()){
@ -1202,6 +1226,8 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const locale_drag = locale().drag;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(Store.luckysheetRightHeadClickIs == "row"){ if(Store.luckysheetRightHeadClickIs == "row"){
if(isEditMode()){ if(isEditMode()){
@ -1230,6 +1256,8 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rightclick-menu").hide(); $("#luckysheet-rightclick-menu").hide();
luckysheetContainerFocus(); luckysheetContainerFocus();
const locale_drag = locale().drag;
if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheet_select_save.length > 1){
if(Store.luckysheetRightHeadClickIs == "row"){ if(Store.luckysheetRightHeadClickIs == "row"){
if(isEditMode()){ if(isEditMode()){
@ -1366,6 +1394,8 @@ export function rowColumnOperationInitial(){
} }
if(has_PartMC){ if(has_PartMC){
const locale_drag = locale().drag;
if(isEditMode()){ if(isEditMode()){
alert(locale_drag.noPartMerge); alert(locale_drag.noPartMerge);
} }
@ -1418,11 +1448,13 @@ export function rowColumnOperationInitial(){
let size = parseInt($(this).siblings("input[type='number']").val().trim()); let size = parseInt($(this).siblings("input[type='number']").val().trim());
if(size < 0 || size > 255){ if(size < 0 || size > 255){
const locale_info = locale().info;
if(isEditMode()){ if(isEditMode()){
alert(llocale_info.tipRowHeightLimit); alert(locale_info.tipRowHeightLimit);
} }
else{ else{
tooltip.info(llocale_info.tipRowHeightLimit, ""); tooltip.info(locale_info.tipRowHeightLimit, "");
} }
return; return;

69
src/controllers/sheetmanage.js

@ -590,10 +590,16 @@ const sheetmanage = {
Store.luckysheet_select_save = file["luckysheet_select_save"]; Store.luckysheet_select_save = file["luckysheet_select_save"];
if(Store.luckysheet_select_save == null || Store.luckysheet_select_save.length == 0){ 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){ if(data[0] != null && data[0][0] != null && data[0][0].mc != null){
Store.luckysheet_select_save = [{ "row": [0, data[0][0].mc.rs - 1], "column": [0, data[0][0].mc.cs - 1] }]; Store.luckysheet_select_save = [{
"row": [0, data[0][0].mc.rs - 1],
"column": [0, data[0][0].mc.cs - 1]
}];
} }
else{ else{
Store.luckysheet_select_save = [{ "row": [0, 0], "column": [0, 0] }]; Store.luckysheet_select_save = [{
"row": [0, 0],
"column": [0, 0]
}];
} }
} }
@ -687,6 +693,21 @@ const sheetmanage = {
Store.luckysheetcurrentisPivotTable = false; Store.luckysheetcurrentisPivotTable = false;
$("#luckysheet-modal-dialog-slider-pivot").hide(); $("#luckysheet-modal-dialog-slider-pivot").hide();
luckysheetsizeauto(); luckysheetsizeauto();
//等待滚动条dom宽高加载完成后 初始化滚动位置
if(file["scrollLeft"] != null && file["scrollLeft"] > 0){
$("#luckysheet-scrollbar-x").scrollLeft(file["scrollLeft"] * Store.zoomRatio);
}
else{
$("#luckysheet-scrollbar-x").scrollLeft(0);
}
if(file["scrollTop"] != null && file["scrollTop"] > 0){
$("#luckysheet-scrollbar-y").scrollTop(file["scrollTop"] * Store.zoomRatio);
}
else{
$("#luckysheet-scrollbar-y").scrollTop(0);
}
} }
if(typeof luckysheetConfigsetting.beforeCreateDom == "function" ){ if(typeof luckysheetConfigsetting.beforeCreateDom == "function" ){
@ -758,8 +779,13 @@ const sheetmanage = {
file["luckysheet_select_save"] = $.extend(true, [], Store.luckysheet_select_save); file["luckysheet_select_save"] = $.extend(true, [], Store.luckysheet_select_save);
file["luckysheet_selection_range"] = $.extend(true, [], Store.luckysheet_selection_range); file["luckysheet_selection_range"] = $.extend(true, [], Store.luckysheet_selection_range);
file["scrollLeft"] = $("#luckysheet-scrollbar-x").scrollLeft();//列标题 if($("#luckysheet-scrollbar-x")[0].scrollWidth > $("#luckysheet-scrollbar-x")[0].offsetWidth){
file["scrollTop"] = $("#luckysheet-scrollbar-y").scrollTop();//行标题 file["scrollLeft"] = $("#luckysheet-scrollbar-x").scrollLeft(); //横向滚动条
}
if($("#luckysheet-scrollbar-y")[0].scrollHeight > $("#luckysheet-scrollbar-y")[0].offsetHeight){
file["scrollTop"] = $("#luckysheet-scrollbar-y").scrollTop(); //纵向滚动条
}
file["zoomRatio"] = Store.zoomRatio; file["zoomRatio"] = Store.zoomRatio;
}, },
@ -777,7 +803,22 @@ const sheetmanage = {
Store.config = file["config"]; Store.config = file["config"];
Store.luckysheet_select_save = file["luckysheet_select_save"] == null ? [] : file["luckysheet_select_save"]; 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"]; Store.luckysheet_selection_range = file["luckysheet_selection_range"] == null ? [] : file["luckysheet_selection_range"];
if(file["freezen"] == null){ if(file["freezen"] == null){
@ -789,7 +830,7 @@ const sheetmanage = {
luckysheetFreezen.freezenverticaldata = file["freezen"].vertical == null ? null : file["freezen"].vertical.freezenverticaldata; luckysheetFreezen.freezenverticaldata = file["freezen"].vertical == null ? null : file["freezen"].vertical.freezenverticaldata;
} }
if(file["zoomRatio"]!=null){ if(file["zoomRatio"] != null){
Store.zoomRatio = file["zoomRatio"]; Store.zoomRatio = file["zoomRatio"];
} }
else{ else{
@ -799,15 +840,15 @@ const sheetmanage = {
createFilterOptions(file["filter_select"], file["filter"]); createFilterOptions(file["filter_select"], file["filter"]);
Store.scrollRefreshSwitch = false; Store.scrollRefreshSwitch = false;
if(file["scrollLeft"]!=null && file["scrollLeft"]>0){ if(file["scrollLeft"] != null && file["scrollLeft"] > 0){
$("#luckysheet-scrollbar-x").scrollLeft(file["scrollLeft"]*Store.zoomRatio); $("#luckysheet-scrollbar-x").scrollLeft(file["scrollLeft"] * Store.zoomRatio);
} }
else{ else{
$("#luckysheet-scrollbar-x").scrollLeft(0); $("#luckysheet-scrollbar-x").scrollLeft(0);
} }
if(file["scrollTop"]!=null && file["scrollTop"]>0){ if(file["scrollTop"] != null && file["scrollTop"] > 0){
$("#luckysheet-scrollbar-y").scrollTop(file["scrollTop"]*Store.zoomRatio); $("#luckysheet-scrollbar-y").scrollTop(file["scrollTop"] * Store.zoomRatio);
} }
else{ else{
$("#luckysheet-scrollbar-y").scrollTop(0); $("#luckysheet-scrollbar-y").scrollTop(0);
@ -816,8 +857,7 @@ const sheetmanage = {
Store.scrollRefreshSwitch = true; Store.scrollRefreshSwitch = true;
}, 0); }, 0);
jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length, false);
jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length,false);
}, },
restoreselect: function() { restoreselect: function() {
let index = this.getSheetIndex(Store.currentSheetIndex); let index = this.getSheetIndex(Store.currentSheetIndex);
@ -879,14 +919,11 @@ const sheetmanage = {
pivotTable.changePivotTable(index); pivotTable.changePivotTable(index);
} }
} }
else if($("#luckysheet-modal-dialog-slider-pivot").is(":visible")) { else{
Store.luckysheetcurrentisPivotTable = false; Store.luckysheetcurrentisPivotTable = false;
$("#luckysheet-modal-dialog-slider-pivot").hide(); $("#luckysheet-modal-dialog-slider-pivot").hide();
luckysheetsizeauto(false); luckysheetsizeauto(false);
} }
else if(Store.luckysheetcurrentisPivotTable) {
Store.luckysheetcurrentisPivotTable = false;
}
let load = file["load"]; let load = file["load"];
if (load != null) { if (load != null) {

8
src/global/draw.js

@ -2068,6 +2068,14 @@ function getCellOverflowMap(canvas, col_st, col_ed, row_st, row_end){
let data = Store.flowdata; let data = Store.flowdata;
if(row_st < 0){
row_st = 0;
}
if(row_end > data.length - 1){
row_end = data.length - 1;
}
for(let r = row_st; r <= row_end; r++){ for(let r = row_st; r <= row_end; r++){
for(let c = 0; c < data[r].length; c++){ for(let c = 0; c < data[r].length; c++){
let cell = data[r][c]; let cell = data[r][c];

1
src/locale/en.js

@ -484,6 +484,7 @@ export default {
filterDateFormatTip:"Date format", filterDateFormatTip:"Date format",
valueBlank:"(Null)", valueBlank:"(Null)",
mergeError:"There are merged cells in the filter selection, this operation cannot be performed!",
}, },
rightclick: { rightclick: {
copy: 'Copy', copy: 'Copy',

1
src/locale/zh.js

@ -501,6 +501,7 @@ export default {
filterDateFormatTip:"日期格式", filterDateFormatTip:"日期格式",
valueBlank:"(空白)", valueBlank:"(空白)",
mergeError:"筛选选区有合并单元格,无法执行此操作!",
}, },
rightclick: { rightclick: {
copy: '复制', copy: '复制',

Loading…
Cancel
Save