|
@ -2,9 +2,9 @@ |
|
|
import sheetmanage from './sheetmanage'; |
|
|
import sheetmanage from './sheetmanage'; |
|
|
import server from './server'; |
|
|
import server from './server'; |
|
|
import { sheetselectlistitemHTML, sheetselectlistHTML, keycode } from './constant'; |
|
|
import { sheetselectlistitemHTML, sheetselectlistHTML, keycode } from './constant'; |
|
|
import { |
|
|
import { |
|
|
replaceHtml, |
|
|
replaceHtml, |
|
|
mouseclickposition, |
|
|
mouseclickposition, |
|
|
} from '../utils/util'; |
|
|
} from '../utils/util'; |
|
|
import { getSheetIndex } from '../methods/get'; |
|
|
import { getSheetIndex } from '../methods/get'; |
|
|
import { isEditMode } from '../global/validate'; |
|
|
import { isEditMode } from '../global/validate'; |
|
@ -67,10 +67,10 @@ function showsheetconfigmenu() { |
|
|
let redo = {}; |
|
|
let redo = {}; |
|
|
redo["type"] = "sheetColor"; |
|
|
redo["type"] = "sheetColor"; |
|
|
redo["sheetIndex"] = Store.currentSheetIndex; |
|
|
redo["sheetIndex"] = Store.currentSheetIndex; |
|
|
|
|
|
|
|
|
redo["oldcolor"] = oldcolor; |
|
|
redo["oldcolor"] = oldcolor; |
|
|
redo["color"] = color; |
|
|
redo["color"] = color; |
|
|
|
|
|
|
|
|
Store.jfundo.length = 0; |
|
|
Store.jfundo.length = 0; |
|
|
Store.jfredo.push(redo); |
|
|
Store.jfredo.push(redo); |
|
|
} |
|
|
} |
|
@ -92,7 +92,7 @@ function showsheetconfigmenu() { |
|
|
let redo = {}; |
|
|
let redo = {}; |
|
|
redo["type"] = "sheetColor"; |
|
|
redo["type"] = "sheetColor"; |
|
|
redo["sheetIndex"] = Store.currentSheetIndex; |
|
|
redo["sheetIndex"] = Store.currentSheetIndex; |
|
|
|
|
|
|
|
|
redo["oldcolor"] = oldcolor; |
|
|
redo["oldcolor"] = oldcolor; |
|
|
redo["color"] = null; |
|
|
redo["color"] = null; |
|
|
|
|
|
|
|
@ -162,6 +162,7 @@ let luckysheetsheetrightclick = function ($t, $cur, e) { |
|
|
export function initialSheetBar(){ |
|
|
export function initialSheetBar(){ |
|
|
const _locale = locale(); |
|
|
const _locale = locale(); |
|
|
const locale_sheetconfig = _locale.sheetconfig; |
|
|
const locale_sheetconfig = _locale.sheetconfig; |
|
|
|
|
|
isInitialSheetConfig = false |
|
|
|
|
|
|
|
|
$("#luckysheet-sheet-area").on("mousedown", "div.luckysheet-sheets-item", function (e) { |
|
|
$("#luckysheet-sheet-area").on("mousedown", "div.luckysheet-sheets-item", function (e) { |
|
|
if(isEditMode()){ |
|
|
if(isEditMode()){ |
|
@ -183,7 +184,7 @@ export function initialSheetBar(){ |
|
|
Store.luckysheet_sheet_move_status = true; |
|
|
Store.luckysheet_sheet_move_status = true; |
|
|
Store.luckysheet_sheet_move_data = {}; |
|
|
Store.luckysheet_sheet_move_data = {}; |
|
|
Store.luckysheet_sheet_move_data.widthlist = []; |
|
|
Store.luckysheet_sheet_move_data.widthlist = []; |
|
|
|
|
|
|
|
|
$("#luckysheet-sheet-area div.luckysheet-sheets-item:visible").each(function (i) { |
|
|
$("#luckysheet-sheet-area div.luckysheet-sheets-item:visible").each(function (i) { |
|
|
if (i == 0) { |
|
|
if (i == 0) { |
|
|
Store.luckysheet_sheet_move_data.widthlist.push(parseInt($(this).outerWidth())); |
|
|
Store.luckysheet_sheet_move_data.widthlist.push(parseInt($(this).outerWidth())); |
|
@ -205,12 +206,12 @@ export function initialSheetBar(){ |
|
|
}, 200); |
|
|
}, 200); |
|
|
} |
|
|
} |
|
|
}).on("click", "div.luckysheet-sheets-item", function (e) { |
|
|
}).on("click", "div.luckysheet-sheets-item", function (e) { |
|
|
|
|
|
|
|
|
if(isEditMode()){ |
|
|
if(isEditMode()){ |
|
|
// alert("非编辑模式下不允许该操作!");
|
|
|
// alert("非编辑模式下不允许该操作!");
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let $t = $(this), $cur = $(e.target); |
|
|
let $t = $(this), $cur = $(e.target); |
|
|
luckysheetsheetrightclick($t, $cur, e); |
|
|
luckysheetsheetrightclick($t, $cur, e); |
|
|
server.keepHighLightBox() |
|
|
server.keepHighLightBox() |
|
@ -242,7 +243,7 @@ export function initialSheetBar(){ |
|
|
if(Store.limitSheetNameLength === false){ |
|
|
if(Store.limitSheetNameLength === false){ |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let maxLength = Store.defaultSheetNameMaxLength; |
|
|
let maxLength = Store.defaultSheetNameMaxLength; |
|
|
if(maxLength === 0){ |
|
|
if(maxLength === 0){ |
|
|
return |
|
|
return |
|
@ -250,29 +251,29 @@ export function initialSheetBar(){ |
|
|
|
|
|
|
|
|
setTimeout( ()=> { |
|
|
setTimeout( ()=> { |
|
|
if (compositionFlag) { |
|
|
if (compositionFlag) { |
|
|
|
|
|
|
|
|
if ($(this).text().length >= maxLength) { /* 检查:值是否越界 */ |
|
|
if ($(this).text().length >= maxLength) { /* 检查:值是否越界 */ |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
$(this).text($(this).text().substring(0, maxLength)); |
|
|
$(this).text($(this).text().substring(0, maxLength)); |
|
|
|
|
|
|
|
|
let range = window.getSelection(); |
|
|
let range = window.getSelection(); |
|
|
range.selectAllChildren(this); |
|
|
range.selectAllChildren(this); |
|
|
range.collapseToEnd(); |
|
|
range.collapseToEnd(); |
|
|
}, 0); |
|
|
}, 0); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, 0); |
|
|
}, 0); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$("#luckysheet-sheet-area").on("blur", "span.luckysheet-sheets-item-name", function (e) { |
|
|
$("#luckysheet-sheet-area").on("blur", "span.luckysheet-sheets-item-name", function (e) { |
|
|
if(Store.allowEdit===false){ |
|
|
if(Store.allowEdit===false){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(0 === $(this).text().length){ |
|
|
if(0 === $(this).text().length){ |
|
|
|
|
|
|
|
|
tooltip.info("", locale_sheetconfig.sheetNamecannotIsEmptyError); |
|
|
tooltip.info("", locale_sheetconfig.sheetNamecannotIsEmptyError); |
|
|
|
|
|
|
|
|
setTimeout(()=>{ |
|
|
setTimeout(()=>{ |
|
|
$(this).text(oldSheetFileName); |
|
|
$(this).text(oldSheetFileName); |
|
|
luckysheetsheetnameeditor($(this)); |
|
|
luckysheetsheetnameeditor($(this)); |
|
@ -317,7 +318,7 @@ export function initialSheetBar(){ |
|
|
let redo = {}; |
|
|
let redo = {}; |
|
|
redo["type"] = "sheetName"; |
|
|
redo["type"] = "sheetName"; |
|
|
redo["sheetIndex"] = Store.currentSheetIndex; |
|
|
redo["sheetIndex"] = Store.currentSheetIndex; |
|
|
|
|
|
|
|
|
redo["oldtxt"] = oldtxt; |
|
|
redo["oldtxt"] = oldtxt; |
|
|
redo["txt"] = txt; |
|
|
redo["txt"] = txt; |
|
|
|
|
|
|
|
@ -334,7 +335,7 @@ export function initialSheetBar(){ |
|
|
let $t = $(this); |
|
|
let $t = $(this); |
|
|
if (kcode == keycode.ENTER) { |
|
|
if (kcode == keycode.ENTER) { |
|
|
let index = getSheetIndex(Store.currentSheetIndex); |
|
|
let index = getSheetIndex(Store.currentSheetIndex); |
|
|
oldSheetFileName = Store.luckysheetfile[index].name || oldSheetFileName; |
|
|
oldSheetFileName = Store.luckysheetfile[index].name || oldSheetFileName; |
|
|
Store.luckysheetfile[index].name = $t.text(); |
|
|
Store.luckysheetfile[index].name = $t.text(); |
|
|
$t.attr("contenteditable", "false"); |
|
|
$t.attr("contenteditable", "false"); |
|
|
} |
|
|
} |
|
@ -389,7 +390,7 @@ export function initialSheetBar(){ |
|
|
tooltip.confirm(locale_sheetconfig.confirmDelete+"【" + Store.luckysheetfile[index].name + "】?", "<span style='color:#9e9e9e;font-size:12px;'>"+locale_sheetconfig.redoDelete+"</span>", function () { |
|
|
tooltip.confirm(locale_sheetconfig.confirmDelete+"【" + Store.luckysheetfile[index].name + "】?", "<span style='color:#9e9e9e;font-size:12px;'>"+locale_sheetconfig.redoDelete+"</span>", function () { |
|
|
sheetmanage.deleteSheet(luckysheetcurrentSheetitem.data("index")); |
|
|
sheetmanage.deleteSheet(luckysheetcurrentSheetitem.data("index")); |
|
|
}, null); |
|
|
}, null); |
|
|
|
|
|
|
|
|
$("#luckysheet-input-box").removeAttr("style"); |
|
|
$("#luckysheet-input-box").removeAttr("style"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -430,7 +431,7 @@ export function initialSheetBar(){ |
|
|
let $c = $("#luckysheet-sheet-container-c"); |
|
|
let $c = $("#luckysheet-sheet-container-c"); |
|
|
sheetscrollstart = $c.scrollLeft(); |
|
|
sheetscrollstart = $c.scrollLeft(); |
|
|
sheetscrollend = $c.scrollLeft() - sheetscrollstep; |
|
|
sheetscrollend = $c.scrollLeft() - sheetscrollstep; |
|
|
|
|
|
|
|
|
if (sheetscrollend <= 0) { |
|
|
if (sheetscrollend <= 0) { |
|
|
$("#luckysheet-sheet-container .docs-sheet-fade-left").hide(); |
|
|
$("#luckysheet-sheet-container .docs-sheet-fade-left").hide(); |
|
|
} |
|
|
} |
|
@ -455,7 +456,7 @@ export function initialSheetBar(){ |
|
|
$("#luckysheet-sheet-container .docs-sheet-fade-right").hide(); |
|
|
$("#luckysheet-sheet-container .docs-sheet-fade-right").hide(); |
|
|
} |
|
|
} |
|
|
$("#luckysheet-sheet-container .docs-sheet-fade-left").show(); |
|
|
$("#luckysheet-sheet-container .docs-sheet-fade-left").show(); |
|
|
|
|
|
|
|
|
clearInterval(sheetscrollani); |
|
|
clearInterval(sheetscrollani); |
|
|
sheetscrollani = setInterval(function () { |
|
|
sheetscrollani = setInterval(function () { |
|
|
sheetscrollstart += 4; |
|
|
sheetscrollstart += 4; |
|
|