28 changed files with 45639 additions and 43451 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,33 @@ |
|||
const luckysheetConfigsetting = { |
|||
autoFormatw: false, |
|||
accuracy: undefined, |
|||
total: 0, |
|||
|
|||
allowCopy: true, |
|||
showtoolbar: true, |
|||
showinfobar: true, |
|||
showsheetbar: true, |
|||
showstatisticBar: true, |
|||
pointEdit: false, |
|||
pointEditUpdate: null, |
|||
pointEditZoom: 1, |
|||
|
|||
userInfo: null, |
|||
userMenuItem: [], |
|||
myFolderUrl: null, |
|||
functionButton: null, |
|||
|
|||
showConfigWindowResize: true, |
|||
enableAddRow: true, |
|||
enableAddCol: true, |
|||
enablePage: true, |
|||
pageInfo: null, |
|||
|
|||
|
|||
editMode: false, |
|||
chartConfigChange: null, |
|||
beforeCreateDom: null, |
|||
fireMousedown: null, |
|||
} |
|||
|
|||
export default luckysheetConfigsetting; |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,177 @@ |
|||
import luckysheetConfigsetting from './luckysheetConfigsetting'; |
|||
import luckysheetFreezen from './freezen'; |
|||
import { luckysheetrefreshgrid } from '../global/refresh'; |
|||
import Store from '../store'; |
|||
|
|||
let container = Store.container; |
|||
let infobarHeight = Store.infobarHeight; |
|||
let toolbarHeight = Store.toolbarHeight; |
|||
let sheetBarHeight = Store.sheetBarHeight; |
|||
let statisticBarHeight = Store.statisticBarHeight; |
|||
let luckysheetTableContentHW = Store.luckysheetTableContentHW; |
|||
let devicePixelRatio = Store.devicePixelRatio; |
|||
|
|||
let gridW = 0, |
|||
gridH = 0, |
|||
cellmainHeight = 0, |
|||
cellmainWidth = 0; |
|||
|
|||
export default function luckysheetsizeauto() { |
|||
if (!luckysheetConfigsetting.showinfobar) { |
|||
infobarHeight = 0; |
|||
$("#luckysheet_info_detail").hide(); |
|||
} |
|||
else { |
|||
infobarHeight = 30; |
|||
$("#luckysheet_info_detail").show(); |
|||
} |
|||
|
|||
if (!luckysheetConfigsetting.showtoolbar) { |
|||
$("#" + container).find(".luckysheet-wa-editor, .luckysheet-share-logo").hide(); |
|||
toolbarHeight = 0; |
|||
} |
|||
else { |
|||
$("#" + container).find(".luckysheet-wa-editor, .luckysheet-share-logo").show(); |
|||
toolbarHeight = 35; |
|||
} |
|||
|
|||
if (!luckysheetConfigsetting.showsheetbar) { |
|||
$("#" + container).find("#luckysheet-sheet-area").hide(); |
|||
sheetBarHeight = 0; |
|||
} |
|||
else { |
|||
$("#" + container).find("#luckysheet-sheet-area").show(); |
|||
sheetBarHeight = 27; |
|||
} |
|||
|
|||
if (!luckysheetConfigsetting.showstatisticBar) { |
|||
$("#" + container).find(".luckysheet-stat-area").hide(); |
|||
statisticBarHeight = 0; |
|||
} |
|||
else { |
|||
$("#" + container).find(".luckysheet-stat-area").show(); |
|||
statisticBarHeight = 23; |
|||
} |
|||
|
|||
$("#" + container).find(".luckysheet-grid-container").css("top", toolbarHeight + infobarHeight + calculatebarHeight); |
|||
|
|||
gridW = $("#" + container).width(), gridH = $("#" + container).height(); |
|||
|
|||
if(luckysheetConfigsetting.showConfigWindowResize){//数据透视表 图表 交替颜色
|
|||
if($("#luckysheet-modal-dialog-slider-pivot").is(":visible")){ |
|||
gridW -= $("#luckysheet-modal-dialog-slider-pivot").outerWidth(); |
|||
} |
|||
else if($("#luckysheet-data-visualization").is(":visible")){ |
|||
gridW -= $("#luckysheet-data-visualization").outerWidth(); |
|||
} |
|||
else if($("#luckysheet-modal-dialog-slider-alternateformat").is(":visible")){ |
|||
gridW -= $("#luckysheet-modal-dialog-slider-alternateformat").outerWidth(); |
|||
} |
|||
} |
|||
|
|||
$("#" + container).find(".luckysheet").height(gridH - 2).width(gridW - 2); |
|||
|
|||
cellmainHeight = gridH - (infobarHeight + toolbarHeight + calculatebarHeight + columeHeaderHeight + sheetBarHeight + statisticBarHeight); |
|||
cellmainWidth = gridW - rowHeaderWidth; |
|||
|
|||
$("#luckysheet-cols-h-c, #luckysheet-cell-main, #luckysheet-scrollbar-x").width(cellmainWidth); |
|||
$("#luckysheet-cell-main").height(cellmainHeight); |
|||
$("#luckysheet-rows-h").height(cellmainHeight - cellMainSrollBarSize); |
|||
|
|||
$("#luckysheet-scrollbar-y").height(cellmainHeight + 6); |
|||
$("#luckysheet-scrollbar-x").height(cellMainSrollBarSize); |
|||
$("#luckysheet-scrollbar-y").width(cellMainSrollBarSize); |
|||
|
|||
luckysheetTableContentHW = [ |
|||
cellmainWidth + rowHeaderWidth - cellMainSrollBarSize, |
|||
cellmainHeight + columeHeaderHeight - cellMainSrollBarSize |
|||
]; |
|||
|
|||
$("#luckysheetTableContent, #luckysheetTableContentF").attr({ |
|||
width: Math.ceil(luckysheetTableContentHW[0] * devicePixelRatio), |
|||
height: Math.ceil(luckysheetTableContentHW[1] * devicePixelRatio) |
|||
}) |
|||
.css({ width: luckysheetTableContentHW[0], height: luckysheetTableContentHW[1] }); |
|||
|
|||
$("#" + container).find("#luckysheet-grid-window-1").css("bottom", sheetBarHeight); |
|||
$("#" + container).find(".luckysheet-grid-window").css("bottom", statisticBarHeight); |
|||
|
|||
let gridwidth = $("#luckysheet-grid-window-1").width(); |
|||
$("#luckysheet-freezebar-horizontal").find(".luckysheet-freezebar-horizontal-handle") |
|||
.css({ "width": gridwidth - 10 }) |
|||
.end() |
|||
.find(".luckysheet-freezebar-horizontal-drop") |
|||
.css({ "width": gridwidth - 10 }); |
|||
|
|||
let gridheight = $("#luckysheet-grid-window-1").height(); |
|||
$("#luckysheet-freezebar-vertical") |
|||
.find(".luckysheet-freezebar-vertical-handle") |
|||
.css({ "height": gridheight - 10 }) |
|||
.end() |
|||
.find(".luckysheet-freezebar-vertical-drop") |
|||
.css({ "height": gridheight - 10 }); |
|||
|
|||
luckysheetFreezen.createAssistCanvas(); |
|||
luckysheetrefreshgrid($("#luckysheet-cell-main").scrollLeft(), $("#luckysheet-cell-main").scrollTop()); |
|||
|
|||
let ismore = false, |
|||
toolbarW = 0, |
|||
morebtn = '<div class="luckysheet-toolbar-separator luckysheet-inline-block" style="user-select: none;"> </div><div class="luckysheet-toolbar-button luckysheet-inline-block" data-tips="更多按钮" id="luckysheet-icon-morebtn" role="button" style="user-select: none;"> <div class="luckysheet-toolbar-button-outer-box luckysheet-inline-block" style="user-select: none;"> <div class="luckysheet-toolbar-button-inner-box luckysheet-inline-block" style="user-select: none;"> <div class="luckysheet-toolbar-menu-button-caption luckysheet-inline-block" style="user-select: none;color:#0188fb;"><i class="fa fa-list-ul"></i> 更多... </div> </div> </div> </div>', |
|||
morediv = '<div id="luckysheet-icon-morebtn-div" class="luckysheet-wa-editor" style="position:absolute;top:'+ (infobarHeight + toolbarHeight+2 + $("#" + container).offset().top + $("body").scrollTop() ) +'px; right:0px;z-index:1003;padding-left:0px;display:none;height:auto;white-space:initial;"></div>'; |
|||
|
|||
if($("#luckysheet-icon-morebtn-div").length == 0){ |
|||
$("body").append(morediv); |
|||
} |
|||
|
|||
$("#luckysheet-icon-morebtn-div").hide(); |
|||
$("#luckysheet-icon-morebtn-div > div").appendTo($("#luckysheet-wa-editor")); |
|||
// $("#luckysheet-wa-editor > div").trigger("create");
|
|||
// $("#luckysheet-icon-morebtn-div > div").trigger("create");
|
|||
$("#luckysheet-icon-morebtn").prev().remove().end().remove(); |
|||
|
|||
$("#luckysheet-wa-editor > div").each(function(){ |
|||
let $t = $(this); |
|||
toolbarW += $t.outerWidth(); |
|||
|
|||
if(!ismore && toolbarW > gridW - 120){ |
|||
ismore = true; |
|||
} |
|||
|
|||
if(ismore){ |
|||
$("#luckysheet-icon-morebtn-div").append($(this)); |
|||
} |
|||
}); |
|||
|
|||
if(ismore){ |
|||
$("#luckysheet-wa-editor").append(morebtn); |
|||
$("#luckysheet-icon-morebtn").click(function(){ |
|||
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); |
|||
|
|||
let $txt = $(this).find(".luckysheet-toolbar-menu-button-caption"); |
|||
if($txt.text().indexOf("更多") > -1){ |
|||
$(this).find(".luckysheet-toolbar-menu-button-caption").html('<i class="fa fa-list-ul"></i> 收起... '); |
|||
} |
|||
else{ |
|||
$(this).find(".luckysheet-toolbar-menu-button-caption").html('<i class="fa fa-list-ul"></i> 更多... '); |
|||
} |
|||
|
|||
}); |
|||
//$("#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); |
|||
} |
|||
|
|||
$("#"+ 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(){ |
|||
$(this).next(".luckysheet-toolbar-button-split-right").removeClass("luckysheet-toolbar-button-split-right-hover"); |
|||
}); |
|||
|
|||
$("#"+ container + " .luckysheet-wa-editor .luckysheet-toolbar-button-split-right").off("hover").hover(function(){ |
|||
$(this).prev(".luckysheet-toolbar-button-split-left").addClass("luckysheet-toolbar-button-hover"); |
|||
}, function(){ |
|||
$(this).prev(".luckysheet-toolbar-button-split-left").removeClass("luckysheet-toolbar-button-hover"); |
|||
}); |
|||
} |
|||
@ -0,0 +1,366 @@ |
|||
import Store from '../store'; |
|||
import menuButton from './menuButton'; |
|||
import formula from '../global/formula'; |
|||
import sheetmanage from './sheetmanage'; |
|||
|
|||
let luckysheetfile = Store.luckysheetfile; |
|||
let currentSheetIndex = Store.currentSheetIndex; |
|||
let luckysheet_select_save = Store.luckysheet_select_save; |
|||
|
|||
//公式函数 选区实体框
|
|||
luckysheet.seletedHighlistByindex = function (id, r1, r2, c1, c2) { |
|||
var row = visibledatarow[r2], row_pre = r1 - 1 == -1 ? 0 : visibledatarow[r1 - 1]; |
|||
var col = visibledatacolumn[c2], col_pre = c1 - 1 == -1 ? 0 : visibledatacolumn[c1 - 1]; |
|||
|
|||
$('#' + id).css({ "left": col_pre, "width": col - col_pre - 1, "top": row_pre, "height": row - row_pre - 1 }); |
|||
} |
|||
|
|||
//选区
|
|||
function selectHightlightShow() { |
|||
$("#luckysheet-cell-selected-boxs").show(); |
|||
$("#luckysheet-cell-selected-boxs #luckysheet-cell-selected").siblings(".luckysheet-cell-selected").remove(); |
|||
|
|||
if(luckysheet_select_save.length > 0){ |
|||
for(var i = 0; i < luckysheet_select_save.length; i++){ |
|||
var r1 = luckysheet_select_save[i].row[0], r2 = luckysheet_select_save[i].row[1]; |
|||
var c1 = luckysheet_select_save[i].column[0], c2 = luckysheet_select_save[i].column[1]; |
|||
|
|||
if(luckysheet_select_save[i].row_focus == null){ |
|||
var rf = r1; |
|||
} |
|||
else{ |
|||
var rf = luckysheet_select_save[i].row_focus; |
|||
} |
|||
|
|||
if(luckysheet_select_save[i].column_focus == null){ |
|||
var cf = c1; |
|||
} |
|||
else{ |
|||
var cf = luckysheet_select_save[i].column_focus; |
|||
} |
|||
|
|||
var row = visibledatarow[r2], row_pre = r1 - 1 == -1 ? 0 : visibledatarow[r1 - 1]; |
|||
var col = visibledatacolumn[c2], col_pre = c1 - 1 == -1 ? 0 : visibledatacolumn[c1 - 1]; |
|||
|
|||
var row_f = visibledatarow[rf], row_pre_f = rf - 1 == -1 ? 0 : visibledatarow[rf - 1]; |
|||
var col_f = visibledatacolumn[cf], col_pre_f = cf - 1 == -1 ? 0 : visibledatacolumn[cf - 1]; |
|||
|
|||
var margeset = menuButton.mergeborer(luckysheet.flowdata, rf, cf); |
|||
if(!!margeset){ |
|||
row_f = margeset.row[1]; |
|||
row_pre_f = margeset.row[0]; |
|||
|
|||
col_f = margeset.column[1]; |
|||
col_pre_f = margeset.column[0]; |
|||
} |
|||
|
|||
luckysheet_select_save[i]["row"] = [r1, r2]; |
|||
luckysheet_select_save[i]["column"] = [c1, c2]; |
|||
|
|||
luckysheet_select_save[i]["row_focus"] = rf; |
|||
luckysheet_select_save[i]["column_focus"] = cf; |
|||
|
|||
luckysheet_select_save[i]["left"] = col_pre_f; |
|||
luckysheet_select_save[i]["width"] = col_f - col_pre_f - 1; |
|||
luckysheet_select_save[i]["top"] = row_pre_f; |
|||
luckysheet_select_save[i]["height"] = row_f - row_pre_f - 1; |
|||
|
|||
luckysheet_select_save[i]["left_move"] = col_pre; |
|||
luckysheet_select_save[i]["width_move"] = col - col_pre - 1; |
|||
luckysheet_select_save[i]["top_move"] = row_pre; |
|||
luckysheet_select_save[i]["height_move"] = row - row_pre - 1; |
|||
|
|||
if(i == 0){ |
|||
if(luckysheet_select_save.length == 1){ |
|||
if(mobilecheck){//移动端
|
|||
$("#luckysheet-cell-selected-boxs #luckysheet-cell-selected").css({ |
|||
"left": luckysheet_select_save[i]["left_move"], |
|||
"width": luckysheet_select_save[i]["width_move"], |
|||
"top": luckysheet_select_save[i]["top_move"], |
|||
"height": luckysheet_select_save[i]["height_move"], |
|||
"display": "block", |
|||
"border": "1px solid #0188fb" |
|||
}) |
|||
.find(".luckysheet-cs-draghandle") |
|||
.css("display", "block") |
|||
.end() |
|||
.find(".luckysheet-cs-fillhandle") |
|||
.css("display", "none") |
|||
.end() |
|||
.find(".luckysheet-cs-touchhandle") |
|||
.css("display", "block"); |
|||
} |
|||
else{ |
|||
$("#luckysheet-cell-selected-boxs #luckysheet-cell-selected").css({ |
|||
"left": luckysheet_select_save[i]["left_move"], |
|||
"width": luckysheet_select_save[i]["width_move"], |
|||
"top": luckysheet_select_save[i]["top_move"], |
|||
"height": luckysheet_select_save[i]["height_move"], |
|||
"display": "block", |
|||
"border": "1px solid #0188fb" |
|||
}) |
|||
.find(".luckysheet-cs-draghandle") |
|||
.css("display", "block") |
|||
.end() |
|||
.find(".luckysheet-cs-fillhandle") |
|||
.css("display", "block") |
|||
.end() |
|||
.find(".luckysheet-cs-touchhandle") |
|||
.css("display", "none"); |
|||
} |
|||
} |
|||
else{ |
|||
$("#luckysheet-cell-selected-boxs #luckysheet-cell-selected").css({ |
|||
"left": luckysheet_select_save[i]["left_move"], |
|||
"width": luckysheet_select_save[i]["width_move"], |
|||
"top": luckysheet_select_save[i]["top_move"], |
|||
"height": luckysheet_select_save[i]["height_move"], |
|||
"display": "block", |
|||
"border": "1px solid rgba(1, 136, 251, 0.15)" |
|||
}) |
|||
.find(".luckysheet-cs-draghandle") |
|||
.css("display", "none") |
|||
.end() |
|||
.find(".luckysheet-cs-fillhandle") |
|||
.css("display", "none"); |
|||
} |
|||
} |
|||
else{ |
|||
$("#luckysheet-cell-selected-boxs").append('<div class="luckysheet-cell-selected" style="left: '+ luckysheet_select_save[i]["left_move"] +'px; width: '+ luckysheet_select_save[i]["width_move"] +'px; top: '+ luckysheet_select_save[i]["top_move"] +'px; height: '+ luckysheet_select_save[i]["height_move"] +'px; border: 1px solid rgba(1, 136, 251, 0.15); display: block;"></div>'); |
|||
} |
|||
|
|||
if(i == luckysheet_select_save.length - 1){ |
|||
//focus 取选区数组最后一个
|
|||
$("#luckysheet-cell-selected-focus").css({ |
|||
"left": luckysheet_select_save[i]["left"], |
|||
"width": luckysheet_select_save[i]["width"], |
|||
"top": luckysheet_select_save[i]["top"], |
|||
"height": luckysheet_select_save[i]["height"], |
|||
"display": "block" |
|||
}); |
|||
//行列数
|
|||
luckysheet_count_show( |
|||
luckysheet_select_save[i]["left_move"], |
|||
luckysheet_select_save[i]["top_move"], |
|||
luckysheet_select_save[i]["width_move"], |
|||
luckysheet_select_save[i]["height_move"], |
|||
[r1, r2], |
|||
[c1, c2] |
|||
); |
|||
//左上角选择区域框
|
|||
formula.fucntionboxshow(rf, cf); |
|||
} |
|||
} |
|||
|
|||
//行列标题栏
|
|||
selectTitlesShow(luckysheet_select_save); |
|||
|
|||
//左上角范围显示
|
|||
$("#luckysheet-helpbox-cell").text(luckysheet.sheetmanage.getRangetxt(luckysheet.currentSheetIndex, luckysheet_select_save[luckysheet_select_save.length - 1])); |
|||
|
|||
//动态数组显示
|
|||
if(luckysheet_select_save.length == 1 && luckysheet_select_save[0].row[0] == luckysheet_select_save[0].row[1] && luckysheet_select_save[0].column[0] == luckysheet_select_save[0].column[1]){ |
|||
luckysheet.dynamicArray_hightShow(luckysheet_select_save[0].row[0], luckysheet_select_save[0].column[0]); |
|||
} |
|||
} |
|||
|
|||
luckysheetfile[sheetmanage.getSheetIndex(currentSheetIndex)].luckysheet_select_save = luckysheet_select_save; |
|||
} |
|||
|
|||
//选区标题栏
|
|||
function selectTitlesShow = function(rangeArr){ |
|||
var s = $.extend(true, [], rangeArr); |
|||
|
|||
var rowTitleMap = {}, columnTitleMap = {}; |
|||
for(var i = 0; i < s.length; i++){ |
|||
var r1 = s[i]["row"][0], r2 = s[i]["row"][1], c1 = s[i]["column"][0], c2 = s[i]["column"][1]; |
|||
//行、列标题栏
|
|||
rowTitleMap = luckysheet.selectTitlesMap(rowTitleMap, r1, r2); |
|||
columnTitleMap = luckysheet.selectTitlesMap(columnTitleMap, c1, c2); |
|||
} |
|||
|
|||
//行标题
|
|||
$("#luckysheet-rows-h-selected").empty(); |
|||
|
|||
var rowTitleRange = luckysheet.selectTitlesRange(rowTitleMap); |
|||
for(var i = 0; i < rowTitleRange.length; i++){ |
|||
var r1 = rowTitleRange[i][0], r2 = rowTitleRange[i][rowTitleRange[i].length - 1]; |
|||
var row = luckysheet.rowLocationByIndex(r2)[1], row_pre = luckysheet.rowLocationByIndex(r1)[0]; |
|||
|
|||
$("#luckysheet-rows-h-selected").append('<div class="luckysheet-rows-h-selected" style="top: '+ row_pre +'px; height: '+ (row - row_pre - 1) +'px; display: block; background-color: rgba(76, 76, 76, 0.1);"></div>'); |
|||
} |
|||
|
|||
//列标题
|
|||
$("#luckysheet-cols-h-selected").empty(); |
|||
|
|||
var columnTitleRange = luckysheet.selectTitlesRange(columnTitleMap); |
|||
for(var j = 0; j < columnTitleRange.length; j++){ |
|||
var c1 = columnTitleRange[j][0], c2 = columnTitleRange[j][columnTitleRange[j].length - 1]; |
|||
var col = luckysheet.colLocationByIndex(c2)[1], col_pre = luckysheet.colLocationByIndex(c1)[0]; |
|||
|
|||
$("#luckysheet-cols-h-selected").append('<div class="luckysheet-cols-h-selected" style="left: '+ col_pre +'px; width: '+ (col - col_pre - 1) +'px; display: block; background-color: rgba(76, 76, 76, 0.1);"></div>'); |
|||
} |
|||
} |
|||
function selectTitlesMap = function(rangeMap, range1, range2){ |
|||
var map = $.extend(true, {}, rangeMap); |
|||
for(var i = range1; i <= range2; i++){ |
|||
if(i in map){ |
|||
continue; |
|||
} |
|||
map[i] = 0; |
|||
} |
|||
return map; |
|||
} |
|||
function selectTitlesRange = function(map){ |
|||
var mapArr = []; |
|||
for(var i in map){ |
|||
mapArr.push(i); |
|||
} |
|||
mapArr.sort(function(a, b){ return a - b; }); |
|||
|
|||
var rangeArr = []; |
|||
var item = []; |
|||
if(mapArr.length > 1){ |
|||
for(var j = 1; j < mapArr.length; j++){ |
|||
if(mapArr[j] - mapArr[j - 1] == 1){ |
|||
item.push(mapArr[j - 1]); |
|||
if(j == mapArr.length - 1){ |
|||
item.push(mapArr[j]); |
|||
rangeArr.push(item); |
|||
} |
|||
} |
|||
else{ |
|||
if(j == 1){ |
|||
if(j == mapArr.length - 1){ |
|||
item.push(mapArr[j - 1]); |
|||
rangeArr.push(item); |
|||
rangeArr.push([mapArr[j]]); |
|||
} |
|||
else{ |
|||
rangeArr.push(mapArr[0]); |
|||
} |
|||
} |
|||
else if(j == mapArr.length - 1){ |
|||
item.push(mapArr[j - 1]); |
|||
rangeArr.push(item); |
|||
rangeArr.push([mapArr[j]]); |
|||
} |
|||
else{ |
|||
item.push(mapArr[j - 1]); |
|||
rangeArr.push(item); |
|||
item = []; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
else{ |
|||
rangeArr.push([mapArr[0]]); |
|||
} |
|||
|
|||
return rangeArr; |
|||
} |
|||
|
|||
//选区是否重叠
|
|||
function selectIsOverlap = function(){ |
|||
var overlap = false; |
|||
var map = {}; |
|||
|
|||
for(var s = 0; s < luckysheet_select_save.length; s++){ |
|||
var str_r = luckysheet_select_save[s].row[0], end_r = luckysheet_select_save[s].row[1]; |
|||
var str_c = luckysheet_select_save[s].column[0], end_c = luckysheet_select_save[s].column[1]; |
|||
|
|||
for(var r = str_r; r <= end_r; r++){ |
|||
for(var c = str_c; c <= end_c; c++){ |
|||
if((r + "_" + c) in map){ |
|||
overlap = true; |
|||
break; |
|||
} |
|||
else{ |
|||
map[r + "_" + c] = 0; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
return overlap; |
|||
} |
|||
|
|||
//复制选区虚线框
|
|||
function selectionCopyShow = function(range){ |
|||
$("#luckysheet-selection-copy").empty(); |
|||
|
|||
if(range == null){ |
|||
range = luckysheet_selection_range; |
|||
} |
|||
|
|||
if(range.length > 0){ |
|||
for(var s = 0; s < range.length; s++){ |
|||
var r1 = range[s].row[0], r2 = range[s].row[1]; |
|||
var c1 = range[s].column[0], c2 = range[s].column[1]; |
|||
|
|||
var row = visibledatarow[r2], row_pre = r1 - 1 == -1 ? 0 : visibledatarow[r1 - 1]; |
|||
var col = visibledatacolumn[c2], col_pre = c1 - 1 == -1 ? 0 : visibledatacolumn[c1 - 1]; |
|||
|
|||
var copyDomHtml = '<div class="luckysheet-selection-copy" style="display: block; left: '+ col_pre +'px; width: '+ (col - col_pre - 1) +'px; top: '+ row_pre +'px; height: '+ (row - row_pre - 1) +'px;">'+ |
|||
'<div class="luckysheet-selection-copy-top luckysheet-copy"></div>'+ |
|||
'<div class="luckysheet-selection-copy-right luckysheet-copy"></div>'+ |
|||
'<div class="luckysheet-selection-copy-bottom luckysheet-copy"></div>'+ |
|||
'<div class="luckysheet-selection-copy-left luckysheet-copy"></div>'+ |
|||
'<div class="luckysheet-selection-copy-hc"></div>'+ |
|||
'</div>'; |
|||
$("#luckysheet-selection-copy").append(copyDomHtml); |
|||
} |
|||
} |
|||
} |
|||
|
|||
function luckysheet_count_show(left, top, width, height, rowseleted, columnseleted) { |
|||
var rowl = rowseleted[1] - rowseleted[0] + 1, coll = columnseleted[1] - columnseleted[0] + 1; |
|||
var drawWidth = luckysheetTableContentHW[0], drawHeight = luckysheetTableContentHW[1]; |
|||
var scrollWidth = $("#luckysheet-cell-main").scrollLeft(), scrollHeight = $("#luckysheet-cell-main").scrollTop(); |
|||
|
|||
if (rowl >= 4) { |
|||
var leftv = left - 25; |
|||
if (leftv < 0) { |
|||
leftv = left + 5; |
|||
} |
|||
|
|||
if (leftv < scrollWidth) { |
|||
leftv = scrollWidth + 10; |
|||
} |
|||
|
|||
var topv = top + height / 2; |
|||
if (height > drawHeight) { |
|||
topv = scrollHeight + drawHeight / 2; |
|||
} |
|||
|
|||
$("#luckysheet-row-count-show").css({ "left": leftv, "top": topv, "display": "block" }).html("<div>" + rowl.toString().split("").join("</div><div>") + "</div><div>行</div>"); |
|||
} |
|||
else { |
|||
$("#luckysheet-row-count-show").hide(); |
|||
} |
|||
|
|||
if (coll >= 4) { |
|||
var topv = top - 25; |
|||
if (topv < 0) { |
|||
topv = top + 5; |
|||
} |
|||
|
|||
if (topv < scrollHeight) { |
|||
topv = scrollHeight + 10; |
|||
} |
|||
|
|||
var leftv = left + width / 2; |
|||
if (width > drawWidth) { |
|||
leftv = scrollWidth + drawWidth / 2; |
|||
} |
|||
|
|||
$("#luckysheet-column-count-show").css({ "left": leftv, "top": topv, "display": "block" }).text(coll + "列"); |
|||
} |
|||
else { |
|||
$("#luckysheet-column-count-show").hide(); |
|||
} |
|||
} |
|||
|
|||
export { |
|||
selectHightlightShow, |
|||
} |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,80 @@ |
|||
function luckysheetbinary_search(arr, key) { |
|||
let low = 0, high = arr.length - 1; |
|||
|
|||
while (low <= high) { |
|||
let mid = parseInt((high + low) / 2); |
|||
|
|||
if (key < arr[mid] && (mid == 0 || key >= arr[mid - 1])) { |
|||
return mid; |
|||
} |
|||
else if (key >= arr[mid]) { |
|||
low = mid + 1; |
|||
} |
|||
else if (key < arr[mid]) { |
|||
high = mid - 1; |
|||
} |
|||
else { |
|||
return -1; |
|||
} |
|||
} |
|||
} |
|||
|
|||
function luckysheetorder_search(arr, y) { |
|||
let i = 0, |
|||
row = 0, |
|||
row_pre = 0, |
|||
row_index = -1, |
|||
i_ed = arr.length - 1; |
|||
|
|||
while (i < arr.length && i_ed >= 0 && i_ed >= i) { |
|||
row = arr[i_ed]; |
|||
|
|||
if (i_ed == 0) { |
|||
row_pre = 0; |
|||
} |
|||
else { |
|||
row_pre = arr[i_ed - 1]; |
|||
} |
|||
|
|||
if (y >= row_pre && y < row) { |
|||
row_index = i_ed; |
|||
break; |
|||
} |
|||
|
|||
row = arr[i]; |
|||
|
|||
if (i == 0) { |
|||
row_pre = 0; |
|||
} |
|||
else { |
|||
row_pre = arr[i - 1]; |
|||
} |
|||
|
|||
if (y >= row_pre && y < row) { |
|||
row_index = i; |
|||
break; |
|||
} |
|||
|
|||
i++; |
|||
i_ed--; |
|||
} |
|||
|
|||
return row_index; |
|||
} |
|||
|
|||
function luckysheet_searcharray(arr, y) { |
|||
let index = arr.length - 1; |
|||
|
|||
if (arr.length < 40 || y <= arr[20] || y >= arr[index - 20]) { |
|||
index = luckysheetorder_search(arr, y); |
|||
} |
|||
else { |
|||
index = luckysheetbinary_search(arr, y); |
|||
} |
|||
|
|||
return index; |
|||
} |
|||
|
|||
export { |
|||
luckysheet_searcharray, |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,89 @@ |
|||
import luckysheetFreezen from '../controllers/freezen'; |
|||
import { luckysheet_searcharray } from '../controllers/sheetSearch'; |
|||
import { luckysheetrefreshgrid } from '../global/refresh'; |
|||
import Store from '../store'; |
|||
|
|||
let visibledatarow = Store.visibledatarow; |
|||
let visibledatacolumn = Store.visibledatacolumn; |
|||
|
|||
//全局滚动事件
|
|||
export default function luckysheetscrollevent(isadjust) { |
|||
let $t = $("#luckysheet-cell-main"); |
|||
let scrollLeft = $("#luckysheet-scrollbar-x").scrollLeft(), |
|||
scrollTop = $("#luckysheet-scrollbar-y").scrollTop(); |
|||
|
|||
if (!!isadjust) { |
|||
let scrollHeight = $t.get(0).scrollHeight; |
|||
let windowHeight = $t.height(); |
|||
let scrollWidth = $t.get(0).scrollWidth; |
|||
let windowWidth = $t.width(); |
|||
|
|||
let maxScrollLeft = scrollWidth - windowWidth; |
|||
let maxScrollTop = scrollHeight - windowHeight; |
|||
|
|||
let visibledatacolumn_c = visibledatacolumn, visibledatarow_c = visibledatarow; |
|||
|
|||
if (luckysheetFreezen.freezenhorizontaldata != null) { |
|||
visibledatarow_c = luckysheetFreezen.freezenhorizontaldata[3]; |
|||
} |
|||
|
|||
if (luckysheetFreezen.freezenverticaldata != null) { |
|||
visibledatacolumn_c = luckysheetFreezen.freezenverticaldata[3]; |
|||
} |
|||
|
|||
let col_ed = luckysheet_searcharray(visibledatacolumn_c, scrollLeft); |
|||
let row_ed = luckysheet_searcharray(visibledatarow_c, scrollTop); |
|||
|
|||
let refreshLeft = scrollLeft , refreshTop = scrollTop; |
|||
|
|||
if (col_ed <= 0) { |
|||
scrollLeft = 0; |
|||
} |
|||
else { |
|||
scrollLeft = visibledatacolumn_c[col_ed - 1]; |
|||
} |
|||
|
|||
if (row_ed <= 0) { |
|||
scrollTop = 0; |
|||
} |
|||
else { |
|||
scrollTop = visibledatarow_c[row_ed - 1]; |
|||
} |
|||
} |
|||
|
|||
if (luckysheetFreezen.freezenhorizontaldata != null) { |
|||
if (scrollTop < luckysheetFreezen.freezenhorizontaldata[2]) { |
|||
scrollTop = luckysheetFreezen.freezenhorizontaldata[2]; |
|||
$("#luckysheet-scrollbar-y").scrollTop(scrollTop); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
if (luckysheetFreezen.freezenverticaldata != null) { |
|||
if (scrollLeft < luckysheetFreezen.freezenverticaldata[2]) { |
|||
scrollLeft = luckysheetFreezen.freezenverticaldata[2]; |
|||
$("#luckysheet-scrollbar-x").scrollLeft(scrollLeft); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
$("#luckysheet-cols-h-c").scrollLeft(scrollLeft);//列标题
|
|||
$("#luckysheet-rows-h").scrollTop(scrollTop);//行标题
|
|||
|
|||
$t.scrollLeft(scrollLeft).scrollTop(scrollTop); |
|||
|
|||
$("#luckysheet-input-box-index").css({ |
|||
"left": $("#luckysheet-input-box").css("left"), |
|||
"top": (parseInt($("#luckysheet-input-box").css("top")) - 20) + "px", |
|||
"z-index": $("#luckysheet-input-box").css("z-index") |
|||
}).show(); |
|||
|
|||
luckysheetrefreshgrid(scrollLeft, scrollTop); |
|||
|
|||
$("#luckysheet-bottom-controll-row").css("left", scrollLeft + 10); |
|||
|
|||
//有选区且有冻结时,滚动适应
|
|||
if(luckysheetFreezen.freezenhorizontaldata != null || luckysheetFreezen.freezenverticaldata != null){ |
|||
luckysheetFreezen.scrollAdapt(); |
|||
} |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
export function isdatetime(s) { |
|||
if (s == null || s.toString().length < 5) { |
|||
return false; |
|||
} |
|||
else if(checkDateTime(s)){ |
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
function checkDateTime(str){ |
|||
var reg1 = /^(\d{4})-(\d{1,2})-(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/; |
|||
var reg2 = /^(\d{4})\/(\d{1,2})\/(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/; |
|||
|
|||
if(!reg1.test(str) && !reg2.test(str)){ |
|||
return false; |
|||
} |
|||
|
|||
var year = RegExp.$1, |
|||
month = RegExp.$2, |
|||
day = RegExp.$3; |
|||
|
|||
if(year < 1900){ |
|||
return false; |
|||
} |
|||
|
|||
if(month > 12){ |
|||
return false; |
|||
} |
|||
|
|||
if(day > 31){ |
|||
return false; |
|||
} |
|||
|
|||
if(month == 2){ |
|||
if(new Date(year, 1, 29).getDate() == 29 && day > 29){ |
|||
return false; |
|||
} |
|||
else if(new Date(year, 1, 29).getDate() != 29 && day > 28){ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
|
|||
export function diff(now, then) { |
|||
return moment(now).diff(moment(then)); |
|||
} |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,7 @@ |
|||
export function showloading(txt) { |
|||
$("#luckysheet-cell-loading").find("span").text(txt).end().show(); |
|||
}; |
|||
|
|||
export function hideloading() { |
|||
$("#luckysheet-cell-loading").hide(); |
|||
}; |
|||
@ -0,0 +1,82 @@ |
|||
import { luckysheet_searcharray } from '../controllers/sheetSearch'; |
|||
import Store from '../store'; |
|||
|
|||
let visibledatarow = Store.visibledatarow; |
|||
let visibledatacolumn = Store.visibledatacolumn; |
|||
let container = Store.container; |
|||
let rowHeaderWidth = Store.rowHeaderWidth; |
|||
let infobarHeight = Store.infobarHeight; |
|||
let toolbarHeight = Store.toolbarHeight; |
|||
let calculatebarHeight = Store.calculatebarHeight; |
|||
let columeHeaderHeight = Store.columeHeaderHeight; |
|||
|
|||
function rowLocationByIndex(row_index) { |
|||
let row = 0, row_pre = 0; |
|||
row = visibledatarow[row_index]; |
|||
|
|||
if (row_index == 0) { |
|||
row_pre = 0; |
|||
} |
|||
else { |
|||
row_pre = visibledatarow[row_index - 1]; |
|||
} |
|||
|
|||
return [row_pre, row, row_index]; |
|||
} |
|||
|
|||
function rowLocation(y) { |
|||
let row_index = luckysheet_searcharray(visibledatarow, y); |
|||
|
|||
if (row_index == -1 && y > 0) { |
|||
row_index = visibledatarow.length - 1; |
|||
} |
|||
else if (row_index == -1 && y <= 0) { |
|||
row_index = 0; |
|||
} |
|||
|
|||
return rowLocationByIndex(row_index); |
|||
} |
|||
|
|||
function colLocationByIndex(col_index){ |
|||
let col = 0, col_pre = 0; |
|||
col = visibledatacolumn[col_index]; |
|||
|
|||
if (col_index == 0) { |
|||
col_pre = 0; |
|||
} |
|||
else { |
|||
col_pre = visibledatacolumn[col_index - 1]; |
|||
} |
|||
|
|||
return [col_pre, col, col_index]; |
|||
} |
|||
|
|||
function colLocation(x) { |
|||
let col_index = luckysheet_searcharray(visibledatacolumn, x); |
|||
|
|||
if (col_index == -1 && x > 0) { |
|||
col_index = visibledatacolumn.length - 1; |
|||
} |
|||
else if (col_index == -1 && x <= 0) { |
|||
col_index = 0; |
|||
} |
|||
|
|||
return colLocationByIndex(col_index); |
|||
} |
|||
|
|||
function mouseposition(x, y) { |
|||
let container_offset = $("#" + container).offset(); |
|||
|
|||
let newX = x - container_offset.left - rowHeaderWidth, |
|||
newY = y - container_offset.top - infobarHeight - toolbarHeight - calculatebarHeight - columeHeaderHeight; |
|||
|
|||
return [newX, newY]; |
|||
} |
|||
|
|||
export { |
|||
rowLocationByIndex, |
|||
rowLocation, |
|||
colLocationByIndex, |
|||
colLocation, |
|||
mouseposition, |
|||
} |
|||
@ -0,0 +1,745 @@ |
|||
//批注
|
|||
luckysheet.postil = { |
|||
defaultWidth: 144, |
|||
defaultHeight: 84, |
|||
currentObj: null, |
|||
currentWinW: null, |
|||
currentWinH: null, |
|||
resize: null, |
|||
resizeXY: null, |
|||
move: false, |
|||
moveXY: null, |
|||
init: function(){ |
|||
//点击批注框 聚焦
|
|||
$("#luckysheet-postil-showBoxs").off("mousedown.showPs").on("mousedown.showPs", ".luckysheet-postil-show", function(event){ |
|||
luckysheet.postil.currentObj = $(this).find(".luckysheet-postil-show-main"); |
|||
|
|||
if($(this).hasClass("luckysheet-postil-show-active")){ |
|||
event.stopPropagation(); |
|||
return; |
|||
} |
|||
|
|||
luckysheet.postil.removeActivePs(); |
|||
|
|||
$(this).addClass("luckysheet-postil-show-active"); |
|||
$(this).find(".luckysheet-postil-dialog-resize").show(); |
|||
$(this).find(".arrowCanvas").css("z-index", 200); |
|||
$(this).find(".luckysheet-postil-show-main").css("z-index", 200); |
|||
|
|||
event.stopPropagation(); |
|||
}); |
|||
$("#luckysheet-postil-showBoxs").off("mouseup.showPs").on("mouseup.showPs", ".luckysheet-postil-show", function(event){ |
|||
if(event.which == "3"){ |
|||
event.stopPropagation(); |
|||
} |
|||
}); |
|||
|
|||
//批注框 改变大小
|
|||
$("#luckysheet-postil-showBoxs").off("mousedown.resize").on("mousedown.resize", ".luckysheet-postil-show .luckysheet-postil-dialog-resize .luckysheet-postil-dialog-resize-item", function(event){ |
|||
luckysheet.postil.currentObj = $(this).closest(".luckysheet-postil-show-main"); |
|||
luckysheet.postil.currentWinW = $("#luckysheet-cell-main")[0].scrollWidth; |
|||
luckysheet.postil.currentWinH = $("#luckysheet-cell-main")[0].scrollHeight; |
|||
|
|||
luckysheet.postil.resize = $(this).data("type"); |
|||
|
|||
var scrollTop = $("#luckysheet-cell-main").scrollTop(), scrollLeft = $("#luckysheet-cell-main").scrollLeft(); |
|||
var mouse = luckysheet.mouseposition(event.pageX, event.pageY); |
|||
var x = mouse[0] + scrollLeft; |
|||
var y = mouse[1] + scrollTop; |
|||
|
|||
var position = luckysheet.postil.currentObj.position(); |
|||
var width = luckysheet.postil.currentObj.width(); |
|||
var height = luckysheet.postil.currentObj.height(); |
|||
|
|||
luckysheet.postil.resizeXY = [x, y, width, height, position.left + scrollLeft, position.top + scrollTop, scrollLeft, scrollTop]; |
|||
|
|||
luckysheet.setluckysheet_scroll_status(true); |
|||
|
|||
if($(this).closest(".luckysheet-postil-show").hasClass("luckysheet-postil-show-active")){ |
|||
event.stopPropagation(); |
|||
return; |
|||
} |
|||
|
|||
luckysheet.postil.removeActivePs(); |
|||
|
|||
$(this).closest(".luckysheet-postil-show").addClass("luckysheet-postil-show-active"); |
|||
$(this).closest(".luckysheet-postil-show").find(".luckysheet-postil-dialog-resize").show(); |
|||
$(this).closest(".luckysheet-postil-show").find(".arrowCanvas").css("z-index", 200); |
|||
$(this).closest(".luckysheet-postil-show").find(".luckysheet-postil-show-main").css("z-index", 200); |
|||
|
|||
event.stopPropagation(); |
|||
}); |
|||
|
|||
//批注框 移动
|
|||
$("#luckysheet-postil-showBoxs").off("mousedown.move").on("mousedown.move", ".luckysheet-postil-show .luckysheet-postil-dialog-move .luckysheet-postil-dialog-move-item", function(event){ |
|||
luckysheet.postil.currentObj = $(this).closest(".luckysheet-postil-show-main"); |
|||
luckysheet.postil.currentWinW = $("#luckysheet-cell-main")[0].scrollWidth; |
|||
luckysheet.postil.currentWinH = $("#luckysheet-cell-main")[0].scrollHeight; |
|||
|
|||
luckysheet.postil.move = true; |
|||
|
|||
var scrollTop = $("#luckysheet-cell-main").scrollTop(), scrollLeft = $("#luckysheet-cell-main").scrollLeft(); |
|||
|
|||
var offset = luckysheet.postil.currentObj.offset(); |
|||
var position = luckysheet.postil.currentObj.position(); |
|||
|
|||
luckysheet.postil.moveXY = [event.pageX - offset.left, event.pageY - offset.top, position.left, position.top, scrollLeft, scrollTop]; |
|||
|
|||
luckysheet.setluckysheet_scroll_status(true); |
|||
|
|||
if($(this).closest(".luckysheet-postil-show").hasClass("luckysheet-postil-show-active")){ |
|||
event.stopPropagation(); |
|||
return; |
|||
} |
|||
|
|||
luckysheet.postil.removeActivePs(); |
|||
|
|||
$(this).closest(".luckysheet-postil-show").addClass("luckysheet-postil-show-active"); |
|||
$(this).closest(".luckysheet-postil-show").find(".luckysheet-postil-dialog-resize").show(); |
|||
$(this).closest(".luckysheet-postil-show").find(".arrowCanvas").css("z-index", 200); |
|||
$(this).closest(".luckysheet-postil-show").find(".luckysheet-postil-show-main").css("z-index", 200); |
|||
|
|||
event.stopPropagation(); |
|||
}); |
|||
}, |
|||
overshow: function(event){ |
|||
$("#luckysheet-postil-overshow").remove(); |
|||
|
|||
if($(event.target).closest("#luckysheet-cell-main").length == 0){ |
|||
return; |
|||
} |
|||
|
|||
var mouse = luckysheet.mouseposition(event.pageX, event.pageY); |
|||
var scrollLeft = $("#luckysheet-cell-main").scrollLeft(); |
|||
var scrollTop = $("#luckysheet-cell-main").scrollTop(); |
|||
var x = mouse[0] + scrollLeft; |
|||
var y = mouse[1] + scrollTop; |
|||
|
|||
if(luckysheetFreezen.freezenverticaldata != null && mouse[0] < (luckysheetFreezen.freezenverticaldata[0] - luckysheetFreezen.freezenverticaldata[2])){ |
|||
return; |
|||
} |
|||
|
|||
if(luckysheetFreezen.freezenhorizontaldata != null && mouse[1] < (luckysheetFreezen.freezenhorizontaldata[0] - luckysheetFreezen.freezenhorizontaldata[2])){ |
|||
return; |
|||
} |
|||
|
|||
var rowLocation = luckysheet.rowLocation(y), row_index = rowLocation[2]; |
|||
var colLocation = luckysheet.colLocation(x), col_index = colLocation[2]; |
|||
|
|||
if(luckysheet.flowdata[row_index] == null || luckysheet.flowdata[row_index][col_index] == null || luckysheet.flowdata[row_index][col_index].ps == null){ |
|||
return; |
|||
} |
|||
|
|||
var postil = luckysheet.flowdata[row_index][col_index].ps; |
|||
|
|||
if(postil["isshow"] || $("#luckysheet-postil-show_"+ row_index +"_"+ col_index).length > 0){ |
|||
return; |
|||
} |
|||
|
|||
var value = postil["value"] == null ? "" : postil["value"]; |
|||
|
|||
var toX = visibledatacolumn[col_index]; |
|||
var toY = row_index == 0 ? 0 : visibledatarow[row_index - 1]; |
|||
|
|||
var fromX = toX + 18; |
|||
var fromY = toY - 18; |
|||
|
|||
if(fromY < 0){ |
|||
fromY = 2; |
|||
} |
|||
|
|||
var size = luckysheet.postil.getArrowCanvasSize(fromX, fromY, toX, toY); |
|||
|
|||
var html = '<div id="luckysheet-postil-overshow">' + |
|||
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;"></canvas>' + |
|||
'<div style="width:132px;min-height:72px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ fromX +'px;top:'+ fromY +'px;z-index:100;">'+ value +'</div>' + |
|||
'</div>'; |
|||
|
|||
$(html).appendTo($("#luckysheet-cell-main")); |
|||
|
|||
var ctx = $("#luckysheet-postil-overshow .arrowCanvas").get(0).getContext("2d"); |
|||
|
|||
luckysheet.postil.drawArrow(ctx, size[4], size[5], size[6], size[7]); |
|||
}, |
|||
getArrowCanvasSize: function(fromX, fromY, toX, toY){ |
|||
var left = toX - 5; |
|||
|
|||
if(fromX < toX){ |
|||
left = fromX - 5; |
|||
} |
|||
|
|||
var top = toY - 5; |
|||
|
|||
if(fromY < toY){ |
|||
top = fromY - 5; |
|||
} |
|||
|
|||
var width = Math.abs(fromX - toX) + 10; |
|||
var height = Math.abs(fromY - toY) + 10; |
|||
|
|||
var x1 = width - 5; |
|||
var x2 = 5; |
|||
|
|||
if(fromX < toX){ |
|||
x1 = 5; |
|||
x2 = width - 5; |
|||
} |
|||
|
|||
var y1 = height - 5; |
|||
var y2 = 5; |
|||
|
|||
if(fromY < toY){ |
|||
y1 = 5; |
|||
y2 = height - 5; |
|||
} |
|||
|
|||
return [left, top, width, height, x1, y1, x2, y2]; |
|||
}, |
|||
drawArrow: function(ctx, fromX, fromY, toX, toY, theta, headlen, width, color){ |
|||
theta = luckysheet.getObjType(theta) == "undefined" ? 30 : theta; |
|||
headlen = luckysheet.getObjType(headlen) == "undefined" ? 6 : headlen; |
|||
width = luckysheet.getObjType(width) == "undefined" ? 1 : width; |
|||
color = luckysheet.getObjType(color) == "undefined" ? "#000" : color; |
|||
|
|||
// 计算各角度和对应的P2,P3坐标
|
|||
var angle = Math.atan2(fromY - toY, fromX - toX) * 180 / Math.PI, |
|||
angle1 = (angle + theta) * Math.PI / 180, |
|||
angle2 = (angle - theta) * Math.PI / 180, |
|||
topX = headlen * Math.cos(angle1), |
|||
topY = headlen * Math.sin(angle1), |
|||
botX = headlen * Math.cos(angle2), |
|||
botY = headlen * Math.sin(angle2); |
|||
|
|||
ctx.save(); |
|||
ctx.beginPath(); |
|||
|
|||
var arrowX = fromX - topX, |
|||
arrowY = fromY - topY; |
|||
|
|||
ctx.moveTo(arrowX, arrowY); |
|||
ctx.moveTo(fromX, fromY); |
|||
ctx.lineTo(toX, toY); |
|||
|
|||
ctx.lineWidth = width; |
|||
ctx.strokeStyle = color; |
|||
ctx.stroke(); |
|||
|
|||
arrowX = toX + topX; |
|||
arrowY = toY + topY; |
|||
ctx.moveTo(arrowX, arrowY); |
|||
ctx.lineTo(toX, toY); |
|||
arrowX = toX + botX; |
|||
arrowY = toY + botY; |
|||
ctx.lineTo(arrowX, arrowY); |
|||
|
|||
ctx.fillStyle = color; |
|||
ctx.fill(); |
|||
ctx.restore(); |
|||
}, |
|||
buildAllPs: function(data){ |
|||
$("#luckysheet-cell-main #luckysheet-postil-showBoxs").empty(); |
|||
|
|||
for(var r = 0; r < data.length; r++){ |
|||
for(var c = 0; c < data[0].length; c++){ |
|||
if(data[r][c] != null && data[r][c].ps != null){ |
|||
var postil = data[r][c].ps; |
|||
|
|||
luckysheet.postil.buildPs(r, c, postil); |
|||
} |
|||
} |
|||
} |
|||
|
|||
luckysheet.postil.init(); |
|||
}, |
|||
buildPs: function(r, c, postil){ |
|||
if($("#luckysheet-postil-show_"+ r +"_"+ c).length > 0){ |
|||
$("#luckysheet-postil-show_"+ r +"_"+ c).remove(); |
|||
} |
|||
|
|||
if(postil == null){ |
|||
return; |
|||
} |
|||
|
|||
var isshow = postil["isshow"] == null ? false : postil["isshow"]; |
|||
|
|||
if(isshow){ |
|||
var row = visibledatarow[r], row_pre = r - 1 == -1 ? 0 : visibledatarow[r - 1]; |
|||
var col = visibledatacolumn[c], col_pre = c - 1 == -1 ? 0 : visibledatacolumn[c - 1]; |
|||
|
|||
var margeset = luckysheet.menuButton.mergeborer(luckysheet.flowdata, r, c); |
|||
if(!!margeset){ |
|||
row = margeset.row[1]; |
|||
row_pre = margeset.row[0]; |
|||
|
|||
col = margeset.column[1]; |
|||
col_pre = margeset.column[0]; |
|||
} |
|||
|
|||
var toX = col; |
|||
var toY = row_pre; |
|||
|
|||
var left = postil["left"] == null ? toX + 18 : postil["left"]; |
|||
var top = postil["top"] == null ? toY - 18 : postil["top"]; |
|||
var width = postil["width"] == null ? luckysheet.postil.defaultWidth : postil["width"]; |
|||
var height = postil["height"] == null ? luckysheet.postil.defaultHeight : postil["height"]; |
|||
var value = postil["value"] == null ? "" : postil["value"]; |
|||
|
|||
if(top < 0){ |
|||
top = 2; |
|||
} |
|||
|
|||
var size = luckysheet.postil.getArrowCanvasSize(left, top, toX, toY); |
|||
|
|||
var html = '<div id="luckysheet-postil-show_'+ r +'_'+ c +'" class="luckysheet-postil-show">' + |
|||
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;"></canvas>' + |
|||
'<div class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' + |
|||
'<div class="luckysheet-postil-dialog-move">' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-t" data-type="t"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-r" data-type="r"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-b" data-type="b"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-l" data-type="l"></div>' + |
|||
'</div>' + |
|||
'<div class="luckysheet-postil-dialog-resize" style="display:none;">' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lt" data-type="lt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mt" data-type="mt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lm" data-type="lm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rm" data-type="rm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rt" data-type="rt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lb" data-type="lb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mb" data-type="mb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' + |
|||
'</div>' + |
|||
'<div style="width:100%;height:100%;overflow:hidden;">' + |
|||
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:18px;word-break:break-all;" spellcheck="false" contenteditable="true">' + |
|||
value + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>'; |
|||
|
|||
$(html).appendTo($("#luckysheet-cell-main #luckysheet-postil-showBoxs")); |
|||
|
|||
var ctx = $("#luckysheet-postil-show_"+ r +"_"+ c +" .arrowCanvas").get(0).getContext("2d"); |
|||
|
|||
luckysheet.postil.drawArrow(ctx, size[4], size[5], size[6], size[7]); |
|||
} |
|||
}, |
|||
newPs: function(r, c){ |
|||
var toX = visibledatacolumn[c]; |
|||
var toY = r == 0 ? 0 : visibledatarow[r - 1]; |
|||
|
|||
var fromX = toX + 18; |
|||
var fromY = toY - 18; |
|||
|
|||
if(fromY < 0){ |
|||
fromY = 2; |
|||
} |
|||
|
|||
var size = luckysheet.postil.getArrowCanvasSize(fromX, fromY, toX, toY); |
|||
|
|||
var html = '<div id="luckysheet-postil-show_'+ r +'_'+ c +'" class="luckysheet-postil-show luckysheet-postil-show-active">' + |
|||
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;"></canvas>' + |
|||
'<div class="luckysheet-postil-show-main" style="width:144px;height:84px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ fromX +'px;top:'+ fromY +'px;box-sizing:border-box;z-index:100;">' + |
|||
'<div class="luckysheet-postil-dialog-move">' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-t" data-type="t"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-r" data-type="r"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-b" data-type="b"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-l" data-type="l"></div>' + |
|||
'</div>' + |
|||
'<div class="luckysheet-postil-dialog-resize">' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lt" data-type="lt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mt" data-type="mt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lm" data-type="lm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rm" data-type="rm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rt" data-type="rt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lb" data-type="lb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mb" data-type="mb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' + |
|||
'</div>' + |
|||
'<div style="width:100%;height:100%;overflow:hidden;">' + |
|||
'<div class="formulaInputFocus" style="width:132px;height:72px;line-height:18px;word-break:break-all;" spellcheck="false" contenteditable="true">' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>'; |
|||
|
|||
$(html).appendTo($("#luckysheet-cell-main #luckysheet-postil-showBoxs")); |
|||
|
|||
var ctx = $("#luckysheet-postil-show_"+ r +"_"+ c +" .arrowCanvas").get(0).getContext("2d"); |
|||
|
|||
luckysheet.postil.drawArrow(ctx, size[4], size[5], size[6], size[7]); |
|||
|
|||
$("#luckysheet-postil-show_"+ r +"_"+ c +" .formulaInputFocus").focus(); |
|||
|
|||
luckysheet.postil.init(); |
|||
|
|||
var d = luckysheet.editor.deepCopyFlowData(luckysheet.flowdata); |
|||
var rc = []; |
|||
|
|||
if(d[r][c] == null){ |
|||
d[r][c] = {}; |
|||
} |
|||
|
|||
d[r][c].ps = { "left": null, "top": null, "width": null, "height": null, "value": "", "isshow": false }; |
|||
rc.push(r + "_" + c); |
|||
|
|||
luckysheet.postil.ref(d, rc); |
|||
}, |
|||
editPs: function(r, c){ |
|||
if($("#luckysheet-postil-show_"+ r +"_"+ c).length > 0){ |
|||
$("#luckysheet-postil-show_"+ r +"_"+ c).show(); |
|||
$("#luckysheet-postil-show_"+ r +"_"+ c).addClass("luckysheet-postil-show-active"); |
|||
$("#luckysheet-postil-show_"+ r +"_"+ c).find(".luckysheet-postil-dialog-resize").show(); |
|||
} |
|||
else{ |
|||
var postil = luckysheet.flowdata[r][c].ps; |
|||
|
|||
var row = visibledatarow[r], row_pre = r - 1 == -1 ? 0 : visibledatarow[r - 1]; |
|||
var col = visibledatacolumn[c], col_pre = c - 1 == -1 ? 0 : visibledatacolumn[c - 1]; |
|||
|
|||
var margeset = luckysheet.menuButton.mergeborer(luckysheet.flowdata, r, c); |
|||
if(!!margeset){ |
|||
row = margeset.row[1]; |
|||
row_pre = margeset.row[0]; |
|||
|
|||
col = margeset.column[1]; |
|||
col_pre = margeset.column[0]; |
|||
} |
|||
|
|||
var toX = col; |
|||
var toY = row_pre; |
|||
|
|||
var left = postil["left"] == null ? toX + 18 : postil["left"]; |
|||
var top = postil["top"] == null ? toY - 18 : postil["top"]; |
|||
var width = postil["width"] == null ? luckysheet.postil.defaultWidth : postil["width"]; |
|||
var height = postil["height"] == null ? luckysheet.postil.defaultHeight : postil["height"]; |
|||
var value = postil["value"] == null ? "" : postil["value"]; |
|||
|
|||
if(top < 0){ |
|||
top = 2; |
|||
} |
|||
|
|||
var size = luckysheet.postil.getArrowCanvasSize(left, top, toX, toY); |
|||
|
|||
var html = '<div id="luckysheet-postil-show_'+ r +'_'+ c +'" class="luckysheet-postil-show luckysheet-postil-show-active">' + |
|||
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;"></canvas>' + |
|||
'<div class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' + |
|||
'<div class="luckysheet-postil-dialog-move">' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-t" data-type="t"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-r" data-type="r"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-b" data-type="b"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-l" data-type="l"></div>' + |
|||
'</div>' + |
|||
'<div class="luckysheet-postil-dialog-resize">' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lt" data-type="lt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mt" data-type="mt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lm" data-type="lm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rm" data-type="rm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rt" data-type="rt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lb" data-type="lb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mb" data-type="mb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' + |
|||
'</div>' + |
|||
'<div style="width:100%;height:100%;overflow:hidden;">' + |
|||
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:18px;word-break:break-all;" spellcheck="false" contenteditable="true">' + |
|||
value + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>'; |
|||
|
|||
$(html).appendTo($("#luckysheet-cell-main #luckysheet-postil-showBoxs")); |
|||
|
|||
var ctx = $("#luckysheet-postil-show_"+ r +"_"+ c +" .arrowCanvas").get(0).getContext("2d"); |
|||
|
|||
luckysheet.postil.drawArrow(ctx, size[4], size[5], size[6], size[7]); |
|||
} |
|||
|
|||
$("#luckysheet-postil-show_"+ r +"_"+ c +" .formulaInputFocus").focus(); |
|||
luckysheet.luckysheetRangeLast($("#luckysheet-postil-show_"+ r +"_"+ c +" .formulaInputFocus").get(0)); |
|||
|
|||
luckysheet.postil.init(); |
|||
}, |
|||
delPs: function(r, c){ |
|||
if($("#luckysheet-postil-show_"+ r +"_"+ c).length > 0){ |
|||
$("#luckysheet-postil-show_"+ r +"_"+ c).remove(); |
|||
} |
|||
|
|||
var d = luckysheet.editor.deepCopyFlowData(luckysheet.flowdata); |
|||
var rc = []; |
|||
|
|||
delete d[r][c].ps; |
|||
rc.push(r + "_" + c); |
|||
|
|||
luckysheet.postil.ref(d, rc); |
|||
}, |
|||
showHidePs: function(r, c){ |
|||
var postil = luckysheet.flowdata[r][c].ps; |
|||
var isshow = postil["isshow"]; |
|||
|
|||
var d = luckysheet.editor.deepCopyFlowData(luckysheet.flowdata); |
|||
var rc = []; |
|||
|
|||
if(isshow){ |
|||
d[r][c].ps.isshow = false; |
|||
|
|||
$("#luckysheet-postil-show_"+ r +"_"+ c).remove(); |
|||
} |
|||
else{ |
|||
d[r][c].ps.isshow = true; |
|||
|
|||
var row = visibledatarow[r], row_pre = r - 1 == -1 ? 0 : visibledatarow[r - 1]; |
|||
var col = visibledatacolumn[c], col_pre = c - 1 == -1 ? 0 : visibledatacolumn[c - 1]; |
|||
|
|||
var margeset = luckysheet.menuButton.mergeborer(luckysheet.flowdata, r, c); |
|||
if(!!margeset){ |
|||
row = margeset.row[1]; |
|||
row_pre = margeset.row[0]; |
|||
|
|||
col = margeset.column[1]; |
|||
col_pre = margeset.column[0]; |
|||
} |
|||
|
|||
var toX = col; |
|||
var toY = row_pre; |
|||
|
|||
var left = postil["left"] == null ? toX + 18 : postil["left"]; |
|||
var top = postil["top"] == null ? toY - 18 : postil["top"]; |
|||
var width = postil["width"] == null ? luckysheet.postil.defaultWidth : postil["width"]; |
|||
var height = postil["height"] == null ? luckysheet.postil.defaultHeight : postil["height"]; |
|||
var value = postil["value"] == null ? "" : postil["value"]; |
|||
|
|||
if(top < 0){ |
|||
top = 2; |
|||
} |
|||
|
|||
var size = luckysheet.postil.getArrowCanvasSize(left, top, toX, toY); |
|||
|
|||
var html = '<div id="luckysheet-postil-show_'+ r +'_'+ c +'" class="luckysheet-postil-show">' + |
|||
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;"></canvas>' + |
|||
'<div class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' + |
|||
'<div class="luckysheet-postil-dialog-move">' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-t" data-type="t"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-r" data-type="r"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-b" data-type="b"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-l" data-type="l"></div>' + |
|||
'</div>' + |
|||
'<div class="luckysheet-postil-dialog-resize" style="display:none;">' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lt" data-type="lt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mt" data-type="mt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lm" data-type="lm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rm" data-type="rm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rt" data-type="rt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lb" data-type="lb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mb" data-type="mb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' + |
|||
'</div>' + |
|||
'<div style="width:100%;height:100%;overflow:hidden;">' + |
|||
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:18px;word-break:break-all;" spellcheck="false" contenteditable="true">' + |
|||
value + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>'; |
|||
|
|||
$(html).appendTo($("#luckysheet-cell-main #luckysheet-postil-showBoxs")); |
|||
|
|||
var ctx = $("#luckysheet-postil-show_"+ r +"_"+ c +" .arrowCanvas").get(0).getContext("2d"); |
|||
|
|||
luckysheet.postil.drawArrow(ctx, size[4], size[5], size[6], size[7]); |
|||
|
|||
luckysheet.postil.init(); |
|||
} |
|||
|
|||
rc.push(r + "_" + c); |
|||
|
|||
luckysheet.postil.ref(d, rc); |
|||
}, |
|||
showHideAllPs: function(){ |
|||
var d = luckysheet.editor.deepCopyFlowData(luckysheet.flowdata); |
|||
|
|||
var isAllShow = true; |
|||
var allPs = []; |
|||
|
|||
for(var r = 0; r < d.length; r++){ |
|||
for(var c = 0; c < d[0].length; c++){ |
|||
if(d[r] != null && d[r][c] != null && d[r][c].ps != null){ |
|||
allPs.push(r + "_" + c); |
|||
|
|||
if(!d[r][c].ps.isshow){ |
|||
isAllShow = false; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
if(allPs.length > 0){ |
|||
var rc = []; |
|||
|
|||
if(isAllShow){ //全部显示,操作为隐藏所有批注
|
|||
$("#luckysheet-cell-main #luckysheet-postil-showBoxs").empty(); |
|||
|
|||
for(var i = 0; i < allPs.length; i++){ |
|||
var rowIndex = allPs[i].split("_")[0]; |
|||
var colIndex = allPs[i].split("_")[1]; |
|||
|
|||
var postil = d[rowIndex][colIndex].ps; |
|||
|
|||
if(postil["isshow"]){ |
|||
d[rowIndex][colIndex].ps.isshow = false; |
|||
rc.push(allPs[i]); |
|||
} |
|||
} |
|||
} |
|||
else{ //部分显示或全部隐藏,操作位显示所有批注
|
|||
for(var i = 0; i < allPs.length; i++){ |
|||
var rowIndex = allPs[i].split("_")[0]; |
|||
var colIndex = allPs[i].split("_")[1]; |
|||
|
|||
var postil = d[rowIndex][colIndex].ps; |
|||
|
|||
if(!postil["isshow"]){ |
|||
var row = visibledatarow[rowIndex], row_pre = rowIndex - 1 == -1 ? 0 : visibledatarow[rowIndex - 1]; |
|||
var col = visibledatacolumn[colIndex], col_pre = colIndex - 1 == -1 ? 0 : visibledatacolumn[colIndex - 1]; |
|||
|
|||
var margeset = luckysheet.menuButton.mergeborer(luckysheet.flowdata, rowIndex, colIndex); |
|||
if(!!margeset){ |
|||
row = margeset.row[1]; |
|||
row_pre = margeset.row[0]; |
|||
|
|||
col = margeset.column[1]; |
|||
col_pre = margeset.column[0]; |
|||
} |
|||
|
|||
var toX = col; |
|||
var toY = row_pre; |
|||
|
|||
var left = postil["left"] == null ? toX + 18 : postil["left"]; |
|||
var top = postil["top"] == null ? toY - 18 : postil["top"]; |
|||
var width = postil["width"] == null ? luckysheet.postil.defaultWidth : postil["width"]; |
|||
var height = postil["height"] == null ? luckysheet.postil.defaultHeight : postil["height"]; |
|||
var value = postil["value"] == null ? "" : postil["value"]; |
|||
|
|||
if(top < 0){ |
|||
top = 2; |
|||
} |
|||
|
|||
var size = luckysheet.postil.getArrowCanvasSize(left, top, toX, toY); |
|||
|
|||
var html = '<div id="luckysheet-postil-show_'+ rowIndex +'_'+ colIndex +'" class="luckysheet-postil-show">' + |
|||
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;"></canvas>' + |
|||
'<div class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' + |
|||
'<div class="luckysheet-postil-dialog-move">' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-t" data-type="t"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-r" data-type="r"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-b" data-type="b"></div>' + |
|||
'<div class="luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-l" data-type="l"></div>' + |
|||
'</div>' + |
|||
'<div class="luckysheet-postil-dialog-resize" style="display:none;">' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lt" data-type="lt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mt" data-type="mt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lm" data-type="lm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rm" data-type="rm"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rt" data-type="rt"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-lb" data-type="lb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-mb" data-type="mb"></div>' + |
|||
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' + |
|||
'</div>' + |
|||
'<div style="width:100%;height:100%;overflow:hidden;">' + |
|||
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:18px;word-break:break-all;" spellcheck="false" contenteditable="true">' + |
|||
value + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>'; |
|||
|
|||
$(html).appendTo($("#luckysheet-cell-main #luckysheet-postil-showBoxs")); |
|||
|
|||
var ctx = $("#luckysheet-postil-show_"+ rowIndex +"_"+ colIndex +" .arrowCanvas").get(0).getContext("2d"); |
|||
|
|||
luckysheet.postil.drawArrow(ctx, size[4], size[5], size[6], size[7]); |
|||
|
|||
d[rowIndex][colIndex].ps.isshow = true; |
|||
rc.push(allPs[i]); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
luckysheet.postil.ref(d, rc); |
|||
|
|||
luckysheet.postil.init(); |
|||
}, |
|||
removeActivePs: function(){ |
|||
if($("#luckysheet-postil-showBoxs .luckysheet-postil-show-active").length > 0){ |
|||
var id = $("#luckysheet-postil-showBoxs .luckysheet-postil-show-active").attr("id"); |
|||
|
|||
$("#" + id).removeClass("luckysheet-postil-show-active"); |
|||
$("#" + id).find(".luckysheet-postil-dialog-resize").hide(); |
|||
$("#" + id).find(".arrowCanvas").css("z-index", 100); |
|||
$("#" + id).find(".luckysheet-postil-show-main").css("z-index", 100); |
|||
|
|||
var r = id.split("luckysheet-postil-show_")[1].split("_")[0]; |
|||
var c = id.split("luckysheet-postil-show_")[1].split("_")[1]; |
|||
|
|||
var value = $("#" + id).find(".formulaInputFocus").text(); |
|||
|
|||
var d = luckysheet.editor.deepCopyFlowData(luckysheet.flowdata); |
|||
var rc = []; |
|||
|
|||
d[r][c].ps.value = value; |
|||
rc.push(r + "_" + c); |
|||
|
|||
luckysheet.postil.ref(d, rc); |
|||
|
|||
if(!d[r][c].ps.isshow){ |
|||
$("#" + id).remove(); |
|||
} |
|||
} |
|||
}, |
|||
ref: function(data, rc){ |
|||
if (clearjfundo) { |
|||
luckysheet.jfundo = []; |
|||
|
|||
luckysheet.jfredo.push({ |
|||
"type": "postil", |
|||
"data": luckysheet.flowdata, |
|||
"curdata": data, |
|||
"sheetIndex": luckysheet.currentSheetIndex, |
|||
"rc": rc |
|||
}); |
|||
} |
|||
|
|||
//luckysheet.flowdata
|
|||
luckysheet.flowdata = data; |
|||
luckysheet.editor.webWorkerFlowDataCache(luckysheet.flowdata);//worker存数据
|
|||
|
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].data = luckysheet.flowdata; |
|||
luckysheet.formula.execFunctionGroupData = luckysheet.flowdata; |
|||
|
|||
//共享编辑模式
|
|||
if(luckysheet.server.allowUpdate){ |
|||
for(var i = 0; i < rc.length; i++){ |
|||
var r = rc[i].split("_")[0]; |
|||
var c = rc[i].split("_")[1]; |
|||
|
|||
luckysheet.server.saveParam("v", luckysheet.currentSheetIndex, luckysheet.flowdata[r][c], { "r": r, "c": c }); |
|||
} |
|||
} |
|||
|
|||
//刷新表格
|
|||
setTimeout(function () { |
|||
luckysheet.luckysheetrefreshgrid(); |
|||
}, 1); |
|||
}, |
|||
positionSync: function(){ |
|||
$("#luckysheet-postil-showBoxs .luckysheet-postil-show").each(function(i, e){ |
|||
var id = $(e).attr("id"); |
|||
|
|||
var r = id.split("luckysheet-postil-show_")[1].split("_")[0]; |
|||
var c = id.split("luckysheet-postil-show_")[1].split("_")[1]; |
|||
|
|||
luckysheet.postil.buildPs(r, c, luckysheet.flowdata[r][c].ps); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,953 @@ |
|||
function jfrefreshgrid(data, range, cfg, cdformat, RowlChange) { |
|||
//单元格数据更新联动
|
|||
luckysheet.formula.execFunctionExist = []; |
|||
for(var s = 0; s < range.length; s++){ |
|||
for(var r = range[s].row[0]; r <= range[s].row[1]; r++){ |
|||
for(var c = range[s].column[0]; c <= range[s].column[1]; c++){ |
|||
luckysheet.formula.execFunctionExist.push({ "r": r, "c": c, "i": luckysheet.currentSheetIndex }); |
|||
} |
|||
} |
|||
} |
|||
luckysheet.formula.execFunctionExist.reverse(); |
|||
luckysheet.formula.execFunctionGroup(null, null, null, null, data); |
|||
luckysheet.formula.execFunctionGroupData = null; |
|||
|
|||
if (clearjfundo) { |
|||
luckysheet.jfundo = []; |
|||
|
|||
if(cfg == null){ |
|||
var curConfig = $.extend(true, {}, config); |
|||
} |
|||
else{ |
|||
var curConfig = $.extend(true, {}, cfg); |
|||
} |
|||
|
|||
if(cdformat == null){ |
|||
var curCdformat = $.extend(true, [], luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)]["luckysheet_conditionformat_save"]); |
|||
} |
|||
else{ |
|||
var curCdformat = cdformat; |
|||
} |
|||
|
|||
luckysheet.jfredo.push({ |
|||
"type": "datachange", |
|||
"data": luckysheet.flowdata, |
|||
"curdata": data, |
|||
"sheetIndex": luckysheet.currentSheetIndex, |
|||
"range": range, |
|||
"config": $.extend(true, {}, config), |
|||
"curConfig": curConfig, |
|||
"cdformat": $.extend(true, [], luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)]["luckysheet_conditionformat_save"]), |
|||
"curCdformat": curCdformat, |
|||
"RowlChange": RowlChange |
|||
}); |
|||
} |
|||
|
|||
//luckysheet.flowdata
|
|||
luckysheet.flowdata = data; |
|||
luckysheet.editor.webWorkerFlowDataCache(luckysheet.flowdata);//worker存数据
|
|||
|
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].data = luckysheet.flowdata; |
|||
|
|||
//config
|
|||
if(cfg != null){ |
|||
config = cfg; |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].config = config; |
|||
|
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, cfg, { "k": "config" }); |
|||
|
|||
if(RowlChange != null){ |
|||
luckysheet.jfrefreshgrid_rhcw(luckysheet.flowdata.length, luckysheet.flowdata[0].length); |
|||
} |
|||
} |
|||
|
|||
//条件格式
|
|||
if(cdformat != null){ |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)]["luckysheet_conditionformat_save"] = cdformat; |
|||
|
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, cdformat, { "k": "luckysheet_conditionformat_save" }); |
|||
} |
|||
|
|||
//更新数据的范围
|
|||
for(var s = 0; s < range.length; s++){ |
|||
var r1 = range[s].row[0]; |
|||
var c1 = range[s].column[0]; |
|||
|
|||
if(luckysheet.flowdata[r1][c1] != null && luckysheet.flowdata[r1][c1].spl != null){ |
|||
window.luckysheetCurrentRow = r1; |
|||
window.luckysheetCurrentColumn = c1; |
|||
window.luckysheetCurrentFunction = luckysheet.flowdata[r1][c1].f; |
|||
|
|||
var fp = $.trim(luckysheet.formula.functionParser(luckysheet.flowdata[r1][c1].f)); |
|||
var sparklines = eval(fp); |
|||
luckysheet.flowdata[r1][c1].spl = sparklines; |
|||
} |
|||
|
|||
if(luckysheet.server.allowUpdate){ //共享编辑模式
|
|||
luckysheet.server.historyParam(luckysheet.flowdata, luckysheet.currentSheetIndex, range[s]); |
|||
} |
|||
|
|||
luckysheet.jfrefreshchartall(luckysheet.flowdata, range[s].row[0], range[s].row[1], range[s].column[0], range[s].column[1]); |
|||
} |
|||
|
|||
//刷新表格
|
|||
setTimeout(function () { |
|||
luckysheet.luckysheetrefreshgrid(); |
|||
}, 1); |
|||
|
|||
window.luckysheet_getcelldata_cache = null; |
|||
|
|||
//编辑器qksheet表格编辑时
|
|||
if(luckysheetConfigsetting.pointEdit){ |
|||
luckysheet.pointEdit_updateData(); |
|||
} |
|||
} |
|||
|
|||
function jfrefreshgridall(colwidth, rowheight, data, cfg, range, ctrlType, ctrlValue, cdformat, changeSize) { |
|||
var redo = {}; |
|||
|
|||
if (ctrlType == "cellRowChange") { |
|||
redo["type"] = "cellRowChange"; |
|||
redo["config"] = $.extend(true, {}, config); |
|||
redo["curconfig"] = $.extend(true, {}, cfg); |
|||
|
|||
redo["range"] = $.extend(true, [], luckysheet_select_save); |
|||
redo["currange"] = range; |
|||
|
|||
redo["ctrlType"] = ctrlType; |
|||
redo["ctrlValue"] = ctrlValue; |
|||
|
|||
var setfield = cfg["rowlen"]; |
|||
|
|||
if(setfield == null){ |
|||
setfield = {}; |
|||
} |
|||
|
|||
luckysheet.server.saveParam("cg", luckysheet.currentSheetIndex, setfield, { "k": "rowlen" }); |
|||
} |
|||
else if (ctrlType.indexOf("extend")>-1) { |
|||
redo["type"] = "extend"; |
|||
redo["config"] = $.extend(true, {}, config); |
|||
redo["curconfig"] = $.extend(true, {}, cfg); |
|||
|
|||
redo["range"] = $.extend(true, [], luckysheet_select_save); |
|||
redo["currange"] = range; |
|||
|
|||
redo["ctrlType"] = ctrlType; |
|||
redo["ctrlValue"] = ctrlValue; |
|||
|
|||
luckysheet.server.saveParam("arc", luckysheet.currentSheetIndex, {"index": ctrlValue.index, "len": ctrlValue.len, "direction": ctrlValue.direction, "mc": cfg.merge }, { "rc": ctrlValue.type }); |
|||
} |
|||
else if (ctrlType.indexOf("dele")>-1) { |
|||
redo["type"] = "dele"; |
|||
redo["config"] = $.extend(true, {}, config); |
|||
redo["curconfig"] = $.extend(true, {}, cfg); |
|||
|
|||
redo["range"] = $.extend(true, [], luckysheet_select_save); |
|||
redo["currange"] = range; |
|||
|
|||
redo["ctrlType"] = ctrlType; |
|||
redo["ctrlValue"] = ctrlValue; |
|||
|
|||
luckysheet.server.saveParam("drc", luckysheet.currentSheetIndex, {"index": ctrlValue.index, "len":ctrlValue.len, "mc": cfg.merge, "borderInfo": cfg.borderInfo }, { "rc": ctrlValue.type}); |
|||
} |
|||
else { |
|||
//单元格数据更新联动
|
|||
luckysheet.formula.execFunctionExist = []; |
|||
for(var s = 0; s < range.length; s++){ |
|||
for(var r = range[s].row[0]; r <= range[s].row[1]; r++){ |
|||
for(var c = range[s].column[0]; c <= range[s].column[1]; c++){ |
|||
luckysheet.formula.execFunctionExist.push({ "r": r, "c": c, "i": luckysheet.currentSheetIndex }); |
|||
} |
|||
} |
|||
} |
|||
luckysheet.formula.execFunctionExist.reverse(); |
|||
luckysheet.formula.execFunctionGroup(null, null, null, null, data); |
|||
luckysheet.formula.execFunctionGroupData = null; |
|||
|
|||
redo["type"] = "datachangeAll"; |
|||
|
|||
redo["range"] = $.extend(true, [], luckysheet_select_save); |
|||
redo["currange"] = range; |
|||
|
|||
redo["ctrlType"] = ctrlType; |
|||
redo["ctrlValue"] = ctrlValue; |
|||
|
|||
for(var s = 0; s < range.length; s++){ |
|||
luckysheet.server.historyParam(data, luckysheet.currentSheetIndex, range[s]); |
|||
} |
|||
} |
|||
|
|||
if (clearjfundo) { |
|||
luckysheet.jfundo = []; |
|||
|
|||
redo["data"] = luckysheet.flowdata; |
|||
redo["curdata"] = data; |
|||
redo["sheetIndex"] = luckysheet.currentSheetIndex; |
|||
|
|||
redo["cdformat"] = $.extend(true, [], luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)]["luckysheet_conditionformat_save"]); |
|||
redo["curCdformat"] = cdformat; |
|||
|
|||
luckysheet.jfredo.push(redo); |
|||
} |
|||
|
|||
//luckysheet.flowdata
|
|||
luckysheet.flowdata = data; |
|||
luckysheet.editor.webWorkerFlowDataCache(data);//worker存数据
|
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].data = luckysheet.flowdata; |
|||
|
|||
//config
|
|||
if (cfg != null) { |
|||
config = cfg; |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].config = config; |
|||
|
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, cfg, { "k": "config" }); |
|||
} |
|||
|
|||
//条件格式
|
|||
if(cdformat != null){ |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)]["luckysheet_conditionformat_save"] = cdformat; |
|||
|
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, cdformat, { "k": "luckysheet_conditionformat_save" }); |
|||
} |
|||
|
|||
//选区
|
|||
luckysheet_select_save = $.extend(true, [], range); |
|||
if(luckysheet_select_save.length > 0){ |
|||
//有选区时,刷新一下选区
|
|||
luckysheet.selectHightlightShow(); |
|||
} |
|||
|
|||
//行高、列宽 刷新
|
|||
luckysheet.jfrefreshgrid_rhcw(rowheight, colwidth); |
|||
|
|||
setTimeout(function () { |
|||
luckysheet.luckysheetrefreshgrid(); |
|||
}, 1); |
|||
|
|||
luckysheet.sheetmanage.storeSheetParamALL(); |
|||
|
|||
if (cfg == null) { |
|||
for(var s = 0; s < range.length; s++){ |
|||
luckysheet.jfrefreshchartall(luckysheet.flowdata, range[s].row[0], range[s].row[1], range[s].column[0], range[s].column[1]); |
|||
} |
|||
} |
|||
|
|||
window.luckysheet_getcelldata_cache = null; |
|||
|
|||
//编辑器qksheet表格编辑时
|
|||
if(luckysheetConfigsetting.pointEdit){ |
|||
luckysheet.pointEdit_updateData(); |
|||
} |
|||
} |
|||
|
|||
//删除、增加行列 刷新表格
|
|||
function jfrefreshgrid_adRC(data, cfg, ctrlType, ctrlValue, calc, filterObj, cf, af, freezen){ |
|||
var file = luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)]; |
|||
|
|||
//merge改变对应的单元格值改变
|
|||
var mcData = []; |
|||
for(var m in cfg["merge"]){ |
|||
var mc = cfg["merge"][m]; |
|||
|
|||
for(var r = mc.r; r <= mc.r + mc.rs - 1; r++){ |
|||
for(var c = mc.c; c <= mc.c + mc.cs - 1; c++){ |
|||
if(data[r][c] == null){ |
|||
data[r][c] = {}; |
|||
} |
|||
|
|||
if(r == mc.r && c == mc.c){ |
|||
data[r][c].mc = mc; |
|||
} |
|||
else{ |
|||
data[r][c].mc = { "r": mc.r, "c": mc.c }; |
|||
} |
|||
|
|||
mcData.push({ "r": r, "c": c }); |
|||
} |
|||
} |
|||
} |
|||
|
|||
//公式链中公式范围改变对应单元格值的改变
|
|||
var funcData = []; |
|||
if(calc.length > 0){ |
|||
luckysheet.formula.execFunctionGroupData = data; |
|||
|
|||
for(var i = 0; i < calc.length; i++){ |
|||
var clc = calc[i]; |
|||
var clc_r = clc.r, clc_c = clc.c, clc_i = clc.index, clc_funcStr = clc.func[2]; |
|||
var clc_result = luckysheet.formula.execfunction(clc_funcStr, clc_r, clc_c, null, true); |
|||
clc.func = clc_result; |
|||
|
|||
if(data[clc_r][clc_c].f == clc_funcStr){ |
|||
luckysheet.setcellvalue(clc_r, clc_c, data, clc_result[1]); |
|||
funcData.push({ "r": clc_r, "c": clc_c }); |
|||
} |
|||
} |
|||
} |
|||
|
|||
if(clearjfundo){ |
|||
luckysheet.jfundo = []; |
|||
|
|||
luckysheet.jfredo.push({ |
|||
"type": ctrlType, |
|||
"sheetIndex": luckysheet.currentSheetIndex, |
|||
"data": luckysheet.flowdata, |
|||
"curData": data, |
|||
"config": $.extend(true, {}, config), |
|||
"curConfig": cfg, |
|||
"ctrlValue": ctrlValue, |
|||
"mcData": mcData, |
|||
"calc": $.extend(true, [], file.calcChain), |
|||
"curCalc": calc, |
|||
"funcData": funcData, |
|||
"filterObj": { "filter_select": $.extend(true, {}, file.filter_select), "filter": $.extend(true, {}, file.filter) }, |
|||
"curFilterObj": filterObj, |
|||
"cf": $.extend(true, [], file.luckysheet_conditionformat_save), |
|||
"curCf": cf, |
|||
"af": $.extend(true, [], file.luckysheet_alternateformat_save), |
|||
"curAf": af, |
|||
"freezen": { "freezenhorizontaldata": luckysheetFreezen.freezenhorizontaldata, "freezenverticaldata": luckysheetFreezen.freezenverticaldata }, |
|||
"curFreezen": freezen |
|||
}); |
|||
} |
|||
|
|||
var index = ctrlValue.index, |
|||
len = ctrlValue.len, |
|||
rc = ctrlValue.rc; |
|||
|
|||
if(ctrlType == "addRC"){ |
|||
var direction = ctrlValue.direction, |
|||
restore = ctrlValue.restore; |
|||
|
|||
var addData = []; |
|||
if(restore){ |
|||
if(rc == "r"){ |
|||
if(direction == "lefttop"){ |
|||
var st_r = index; |
|||
} |
|||
else if(direction == "rightbottom"){ |
|||
var st_r = index + 1; |
|||
} |
|||
var ed_r = st_r + len - 1; |
|||
|
|||
for(var r = st_r; r <= ed_r; r++){ |
|||
var row = []; |
|||
for(var c = 0; c < data[0].length; c++){ |
|||
var cell = data[r][c]; |
|||
row.push(cell); |
|||
} |
|||
addData.push(row); |
|||
} |
|||
} |
|||
else if(rc == "c"){ |
|||
if(direction == "lefttop"){ |
|||
var st_c = index; |
|||
} |
|||
else if(direction == "rightbottom"){ |
|||
var st_c = index + 1; |
|||
} |
|||
var ed_c = st_c + len - 1; |
|||
|
|||
for(var r = 0; r < data.length; r++){ |
|||
var row = []; |
|||
for(var c = st_c; c <= ed_c; c++){ |
|||
var cell = data[r][c]; |
|||
row.push(cell); |
|||
} |
|||
addData.push(row); |
|||
} |
|||
} |
|||
} |
|||
|
|||
luckysheet.server.saveParam("arc", luckysheet.currentSheetIndex, {"index": index, "len": len, "direction": direction, "data": addData }, { "rc": rc }); |
|||
} |
|||
else if(ctrlType == "delRC"){ |
|||
luckysheet.server.saveParam("drc", luckysheet.currentSheetIndex, {"index": index, "len": len }, { "rc": rc }); |
|||
} |
|||
|
|||
//luckysheet.flowdata
|
|||
luckysheet.flowdata = data; |
|||
luckysheet.editor.webWorkerFlowDataCache(luckysheet.flowdata);//worker存数据
|
|||
file.data = data; |
|||
|
|||
//config
|
|||
config = cfg; |
|||
file.config = config; |
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, cfg, { "k": "config" }); |
|||
|
|||
//mcData
|
|||
for(var i = 0; i < mcData.length; i++){ |
|||
var mcData_r = mcData[i].r, |
|||
mcData_c = mcData[i].c; |
|||
|
|||
luckysheet.server.saveParam("v", luckysheet.currentSheetIndex, luckysheet.flowdata[mcData_r][mcData_c], { "r": mcData_r, "c": mcData_c }); |
|||
} |
|||
|
|||
//calc函数链
|
|||
file.calcChain = calc; |
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, calc, { "k": "calcChain" }); |
|||
for(var i = 0; i < funcData.length; i++){ |
|||
var funcData_r = funcData[i].r, |
|||
funcData_c = funcData[i].c; |
|||
|
|||
luckysheet.server.saveParam("v", luckysheet.currentSheetIndex, luckysheet.flowdata[funcData_r][funcData_c], { "r": funcData_r, "c": funcData_c }); |
|||
} |
|||
|
|||
//筛选配置
|
|||
if(filterObj != null){ |
|||
file.filter_select = filterObj.filter_select; |
|||
file.filter = filterObj.filter; |
|||
} |
|||
else{ |
|||
file.filter_select = null; |
|||
file.filter = null; |
|||
} |
|||
luckysheet.createFilterOptions(file.filter_select, file.filter); |
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, file.filter_select, { "k": "filter_select" }); |
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, file.filter, { "k": "filter" }); |
|||
|
|||
//条件格式配置
|
|||
file.luckysheet_conditionformat_save = cf; |
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, file.luckysheet_conditionformat_save, { "k": "luckysheet_conditionformat_save" }); |
|||
|
|||
//交替颜色配置
|
|||
file.luckysheet_alternateformat_save = af; |
|||
luckysheet.server.saveParam("all", luckysheet.currentSheetIndex, file.luckysheet_alternateformat_save, { "k": "luckysheet_alternateformat_save" }); |
|||
|
|||
//冻结配置
|
|||
if(freezen != null){ |
|||
luckysheetFreezen.freezenhorizontaldata = freezen.freezenhorizontaldata; |
|||
luckysheetFreezen.freezenverticaldata = freezen.freezenverticaldata; |
|||
} |
|||
else{ |
|||
luckysheetFreezen.freezenhorizontaldata = null; |
|||
luckysheetFreezen.freezenverticaldata = null; |
|||
} |
|||
|
|||
//行高、列宽刷新
|
|||
luckysheet.jfrefreshgrid_rhcw(luckysheet.flowdata.length, luckysheet.flowdata[0].length); |
|||
} |
|||
|
|||
//复制剪切 刷新表格
|
|||
function jfrefreshgrid_pastcut(source, target, RowlChange){ |
|||
//单元格数据更新联动
|
|||
var execF_rc = {}; |
|||
luckysheet.formula.execFunctionExist = []; |
|||
|
|||
for(var r = source["range"].row[0]; r <= source["range"].row[1]; r++){ |
|||
for(var c = source["range"].column[0]; c <= source["range"].column[1]; c++){ |
|||
if((r + "_" + c + "_" + source["sheetIndex"]) in execF_rc){ |
|||
continue; |
|||
} |
|||
|
|||
execF_rc[r + "_" + c + "_" + source["sheetIndex"]] = 0; |
|||
luckysheet.formula.execFunctionExist.push({ "r": r, "c": c, "i": source["sheetIndex"] }); |
|||
} |
|||
} |
|||
|
|||
for(var r = target["range"].row[0]; r <= target["range"].row[1]; r++){ |
|||
for(var c = target["range"].column[0]; c <= target["range"].column[1]; c++){ |
|||
if((r + "_" + c + "_" + target["sheetIndex"]) in execF_rc){ |
|||
continue; |
|||
} |
|||
|
|||
execF_rc[r + "_" + c + "_" + target["sheetIndex"]] = 0; |
|||
luckysheet.formula.execFunctionExist.push({ "r": r, "c": c, "i": target["sheetIndex"] }); |
|||
} |
|||
} |
|||
|
|||
luckysheet.formula.execFunctionExist.reverse(); |
|||
luckysheet.formula.execFunctionGroup(null, null, null, null, target["curData"]); |
|||
luckysheet.formula.execFunctionGroupData = null; |
|||
|
|||
if(clearjfundo){ |
|||
luckysheet.jfundo = []; |
|||
|
|||
luckysheet.jfredo.push({ |
|||
"type": "pasteCut", |
|||
"source": source, |
|||
"target": target, |
|||
"RowlChange": RowlChange |
|||
}) |
|||
} |
|||
|
|||
//config
|
|||
if(luckysheet.currentSheetIndex == source["sheetIndex"]){ |
|||
config = source["curConfig"]; |
|||
var rowHeight = source["curData"].length; |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(target["sheetIndex"])]["config"] = target["curConfig"]; |
|||
} |
|||
else if(luckysheet.currentSheetIndex == target["sheetIndex"]){ |
|||
config = target["curConfig"]; |
|||
var rowHeight = target["curData"].length; |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(source["sheetIndex"])]["config"] = source["curConfig"]; |
|||
} |
|||
|
|||
if(RowlChange){ |
|||
visibledatarow = []; |
|||
rh_height = 0; |
|||
for (var i = 0; i < rowHeight; i++) { |
|||
var rowlen = defaultrowlen; |
|||
if (config["rowlen"] != null && config["rowlen"][i] != null) { |
|||
rowlen = config["rowlen"][i]; |
|||
} |
|||
if (config["rowhidden"] != null && config["rowhidden"][i] != null) { |
|||
rowlen = config["rowhidden"][i]; |
|||
visibledatarow.push(rh_height); |
|||
continue; |
|||
} |
|||
else { |
|||
rh_height += rowlen + 1; |
|||
} |
|||
visibledatarow.push(rh_height);//行的临时长度分布
|
|||
} |
|||
rh_height += 110; |
|||
luckysheet.sheetmanage.showSheet(); |
|||
|
|||
if(luckysheet.currentSheetIndex == source["sheetIndex"]){ |
|||
var rowlenArr = luckysheet.computeRowlenArr(target["curData"].length, target["curConfig"]); |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(target["sheetIndex"])]["visibledatarow"] = rowlenArr; |
|||
} |
|||
else if(luckysheet.currentSheetIndex == target["sheetIndex"]){ |
|||
var rowlenArr = luckysheet.computeRowlenArr(source["curData"].length, source["curConfig"]); |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(source["sheetIndex"])]["visibledatarow"] = rowlenArr; |
|||
} |
|||
} |
|||
|
|||
//luckysheet.flowdata
|
|||
if(luckysheet.currentSheetIndex == source["sheetIndex"]){ |
|||
luckysheet.flowdata = source["curData"]; |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(target["sheetIndex"])]["data"] = target["curData"]; |
|||
} |
|||
else if(luckysheet.currentSheetIndex == target["sheetIndex"]){ |
|||
luckysheet.flowdata = target["curData"]; |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(source["sheetIndex"])]["data"] = source["curData"]; |
|||
} |
|||
luckysheet.editor.webWorkerFlowDataCache(luckysheet.flowdata);//worker存数据
|
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].data = luckysheet.flowdata; |
|||
|
|||
//luckysheet_select_save
|
|||
if(luckysheet.currentSheetIndex == target["sheetIndex"]){ |
|||
luckysheet_select_save = [{"row": target["range"].row, "column": target["range"].column}]; |
|||
} |
|||
else{ |
|||
luckysheet_select_save = [{"row": source["range"].row, "column": source["range"].column}]; |
|||
} |
|||
if(luckysheet_select_save.length > 0){ |
|||
//有选区时,刷新一下选区
|
|||
luckysheet.selectHightlightShow(); |
|||
} |
|||
|
|||
//条件格式
|
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(source["sheetIndex"])].luckysheet_conditionformat_save = source["curCdformat"]; |
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(target["sheetIndex"])].luckysheet_conditionformat_save = target["curCdformat"]; |
|||
|
|||
setTimeout(function () { |
|||
luckysheet.luckysheetrefreshgrid(); |
|||
}, 1); |
|||
|
|||
luckysheet.sheetmanage.storeSheetParamALL(); |
|||
|
|||
luckysheet.jfrefreshchartall(luckysheet.flowdata, 0, luckysheet.flowdata.length - 1, 0, luckysheet.flowdata[0].length - 1); |
|||
|
|||
//saveparam
|
|||
//来源表
|
|||
luckysheet.server.saveParam("all", source["sheetIndex"], source["curConfig"], { "k": "config" }); |
|||
//目的表
|
|||
luckysheet.server.saveParam("all", target["sheetIndex"], target["curConfig"], { "k": "config" }); |
|||
|
|||
//来源表
|
|||
luckysheet.server.historyParam(source["curData"], source["sheetIndex"], {"row": source["range"]["row"], "column": source["range"]["column"]}); |
|||
//目的表
|
|||
luckysheet.server.historyParam(target["curData"], target["sheetIndex"], {"row": target["range"]["row"], "column": target["range"]["column"]}); |
|||
|
|||
//编辑器qksheet表格编辑时
|
|||
if(luckysheetConfigsetting.pointEdit){ |
|||
luckysheet.pointEdit_updateData(); |
|||
} |
|||
} |
|||
|
|||
//行高、列宽改变 刷新表格
|
|||
function jfrefreshgrid_rhcw = function(rowheight, colwidth){ |
|||
//行高
|
|||
if(rowheight != null){ |
|||
visibledatarow = []; |
|||
rh_height = 0; |
|||
|
|||
for (var i = 0; i < rowheight; i++) { |
|||
var rowlen = defaultrowlen; |
|||
|
|||
if (config["rowlen"] != null && config["rowlen"][i] != null) { |
|||
rowlen = config["rowlen"][i]; |
|||
} |
|||
|
|||
if (config["rowhidden"] != null && config["rowhidden"][i] != null) { |
|||
rowlen = config["rowhidden"][i]; |
|||
visibledatarow.push(rh_height); |
|||
continue; |
|||
} |
|||
else { |
|||
rh_height += rowlen + 1; |
|||
} |
|||
|
|||
visibledatarow.push(rh_height); //行的临时长度分布
|
|||
} |
|||
|
|||
if(!luckysheetConfigsetting.pointEdit){ |
|||
//非编辑器qksheet表格编辑状态
|
|||
rh_height += 110; |
|||
} |
|||
} |
|||
|
|||
//列宽
|
|||
if(colwidth != null){ |
|||
visibledatacolumn = []; |
|||
ch_width = 0; |
|||
|
|||
var maxColumlen = 120; |
|||
|
|||
for (var i = 0; i < colwidth; i++) { |
|||
var firstcolumlen = defaultcollen; |
|||
|
|||
if (config["columlen"] != null && config["columlen"][i] != null) { |
|||
firstcolumlen = config["columlen"][i]; |
|||
} |
|||
else { |
|||
if (luckysheet.flowdata[0] != null && luckysheet.flowdata[0][i] != null) { |
|||
if (firstcolumlen > 300) { |
|||
firstcolumlen = 300; |
|||
} |
|||
else if (firstcolumlen < defaultcollen) { |
|||
firstcolumlen = defaultcollen; |
|||
} |
|||
|
|||
if (firstcolumlen != defaultcollen) { |
|||
if (config["columlen"] == null) { |
|||
config["columlen"] = {}; |
|||
} |
|||
|
|||
config["columlen"][i] = firstcolumlen; |
|||
} |
|||
} |
|||
} |
|||
|
|||
ch_width += firstcolumlen + 1; |
|||
|
|||
visibledatacolumn.push(ch_width);//列的临时长度分布
|
|||
|
|||
if(maxColumlen < firstcolumlen + 1){ |
|||
maxColumlen = firstcolumlen + 1; |
|||
} |
|||
} |
|||
|
|||
if(!luckysheetConfigsetting.pointEdit){ |
|||
//非编辑器qksheet表格编辑状态
|
|||
// ch_width += 120;
|
|||
ch_width += maxColumlen; |
|||
} |
|||
} |
|||
|
|||
luckysheet.sheetmanage.storeSheetParam(); |
|||
|
|||
//行高列宽改变时 重新计算sparklines
|
|||
var calcChain = luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].calcChain; |
|||
|
|||
if(calcChain != null && calcChain.length > 0){ |
|||
if(config["rowlen"] == null){ |
|||
config["rowlen"] = {}; |
|||
} |
|||
|
|||
if(config["columlen"] == null){ |
|||
config["columlen"] = {}; |
|||
} |
|||
|
|||
for(var i = 0; i < calcChain.length; i++){ |
|||
var r = calcChain[i].r, c = calcChain[i].c, index = calcChain[i].index; |
|||
|
|||
if(index == luckysheet.currentSheetIndex && luckysheet.flowdata[r][c] != null && luckysheet.flowdata[r][c].spl != null && ((r in config["rowlen"]) || (c in config["columlen"]))){ |
|||
window.luckysheetCurrentRow = r; |
|||
window.luckysheetCurrentColumn = c; |
|||
window.luckysheetCurrentFunction = luckysheet.flowdata[r][c].f; |
|||
|
|||
var fp = $.trim(luckysheet.formula.functionParser(luckysheet.flowdata[r][c].f)); |
|||
var sparklines = eval(fp); |
|||
luckysheet.flowdata[r][c].spl = sparklines; |
|||
|
|||
luckysheet.server.saveParam("v", luckysheet.currentSheetIndex, luckysheet.flowdata[r][c], { "r": r, "c": c }); |
|||
} |
|||
} |
|||
|
|||
luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].data = luckysheet.flowdata; |
|||
} |
|||
|
|||
//批注框同步
|
|||
luckysheet.postil.positionSync(); |
|||
|
|||
//选区同步
|
|||
luckysheet.selectHightlightShow(); |
|||
|
|||
//改变单元格行高,复制虚线框同步
|
|||
if($(".luckysheet-selection-copy").is(":visible")){ |
|||
luckysheet.selectionCopyShow(); |
|||
} |
|||
|
|||
//改变单元格行高,选区下拉icon隐藏
|
|||
if($("#luckysheet-dropCell-icon").is(":visible")){ |
|||
$("#luckysheet-dropCell-icon").remove(); |
|||
} |
|||
|
|||
//有冻结状态时,同步行高、列宽
|
|||
if(luckysheetFreezen.freezenhorizontaldata != null && luckysheetFreezen.freezenverticaldata != null){ |
|||
var row_st = luckysheetFreezen.freezenhorizontaldata[1] - 1; |
|||
var col_st = luckysheetFreezen.freezenverticaldata[1] - 1; |
|||
|
|||
var scrollTop = luckysheetFreezen.freezenhorizontaldata[2]; |
|||
var scrollLeft = luckysheetFreezen.freezenverticaldata[2]; |
|||
|
|||
var top = visibledatarow[row_st] - 2 - scrollTop + columeHeaderHeight; |
|||
var freezenhorizontaldata = [visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(visibledatarow, row_st + 1), top]; |
|||
var left = visibledatacolumn[col_st] - 2 - scrollLeft + rowHeaderWidth; |
|||
var freezenverticaldata = [visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(visibledatacolumn, col_st + 1), left]; |
|||
|
|||
luckysheetFreezen.saveFreezen(freezenhorizontaldata, top, freezenverticaldata, left); |
|||
luckysheetFreezen.createFreezenHorizontal(freezenhorizontaldata, top); |
|||
luckysheetFreezen.createFreezenVertical(freezenverticaldata, left); |
|||
luckysheetFreezen.createAssistCanvas(); |
|||
} |
|||
else if(luckysheetFreezen.freezenhorizontaldata != null){ |
|||
var row_st = luckysheetFreezen.freezenhorizontaldata[1] - 1; |
|||
var scrollTop = luckysheetFreezen.freezenhorizontaldata[2]; |
|||
|
|||
var top = visibledatarow[row_st] - 2 - scrollTop + columeHeaderHeight; |
|||
var freezenhorizontaldata = [visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(visibledatarow, row_st + 1), top]; |
|||
|
|||
luckysheetFreezen.saveFreezen(freezenhorizontaldata, top, null, null); |
|||
luckysheetFreezen.createFreezenHorizontal(freezenhorizontaldata, top); |
|||
luckysheetFreezen.createAssistCanvas(); |
|||
} |
|||
else if(luckysheetFreezen.freezenverticaldata != null){ |
|||
var col_st = luckysheetFreezen.freezenverticaldata[1] - 1; |
|||
var scrollLeft = luckysheetFreezen.freezenverticaldata[2]; |
|||
|
|||
var left = visibledatacolumn[col_st] - 2 - scrollLeft + rowHeaderWidth; |
|||
var freezenverticaldata = [visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(visibledatacolumn, col_st + 1), left]; |
|||
|
|||
luckysheetFreezen.saveFreezen(null, null, freezenverticaldata, left); |
|||
luckysheetFreezen.createFreezenVertical(freezenverticaldata, left); |
|||
luckysheetFreezen.createAssistCanvas(); |
|||
} |
|||
else{ |
|||
//有筛选标志时,同步筛选按钮和筛选范围位置
|
|||
if($("#luckysheet-filter-options-sheet" + luckysheet.currentSheetIndex + " .luckysheet-filter-options").length > 0){ |
|||
$("#luckysheet-filter-options-sheet" + luckysheet.currentSheetIndex + " .luckysheet-filter-options").each(function(i, e){ |
|||
var str = $(e).data("str"), cindex = $(e).data("cindex"); |
|||
|
|||
var left = visibledatacolumn[cindex] - 20; |
|||
var top = str - 1 == -1 ? 0 : visibledatarow[str - 1]; |
|||
|
|||
$(e).css({ "left": left, "top": top }); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
if($("#luckysheet-filter-selected-sheet" + luckysheet.currentSheetIndex).length > 0){ |
|||
var luckysheet_filter_save = luckysheetfile[luckysheet.sheetmanage.getSheetIndex(luckysheet.currentSheetIndex)].filter_select; |
|||
|
|||
var r1 = luckysheet_filter_save.row[0], r2 = luckysheet_filter_save.row[1]; |
|||
var c1 = luckysheet_filter_save.column[0], c2 = luckysheet_filter_save.column[1]; |
|||
|
|||
var row = visibledatarow[r2], row_pre = r1 - 1 == -1 ? 0 : visibledatarow[r1 - 1]; |
|||
var col = visibledatacolumn[c2], col_pre = c1 - 1 == -1 ? 0 : visibledatacolumn[c1 - 1]; |
|||
|
|||
$("#luckysheet-filter-selected-sheet" + luckysheet.currentSheetIndex).css({ |
|||
"left": col_pre, |
|||
"width": col - col_pre - 1, |
|||
"top": row_pre, |
|||
"height": row - row_pre - 1 |
|||
}); |
|||
} |
|||
|
|||
luckysheet.sheetmanage.showSheet(); |
|||
|
|||
setTimeout(function () { |
|||
luckysheet.luckysheetrefreshgrid(); |
|||
}, 1); |
|||
|
|||
//编辑器qksheet表格编辑时
|
|||
if(luckysheetConfigsetting.pointEdit){ |
|||
luckysheet.pointEdit_updateData(); |
|||
} |
|||
} |
|||
|
|||
//按照scrollHeight, scrollWidth刷新canvas展示数据
|
|||
function luckysheetrefreshgrid = function (scrollWidth, scrollHeight) { |
|||
luckysheet.formula.groupValuesRefresh(); |
|||
|
|||
if (scrollWidth == null) { |
|||
scrollWidth = $("#luckysheet-cell-main").scrollLeft(); |
|||
} |
|||
if (scrollHeight == null) { |
|||
scrollHeight = $("#luckysheet-cell-main").scrollTop(); |
|||
} |
|||
|
|||
if (luckysheetFreezen.freezenverticaldata != null || luckysheetFreezen.freezenhorizontaldata != null) { |
|||
var freezen_horizon_px, freezen_horizon_ed, freezen_horizon_scrollTop; |
|||
var freezen_vertical_px, freezen_vertical_ed, freezen_vertical_scrollTop; |
|||
var drawWidth = luckysheetTableContentHW[0], drawHeight = luckysheetTableContentHW[1]; |
|||
|
|||
if (luckysheetFreezen.freezenverticaldata != null && luckysheetFreezen.freezenhorizontaldata != null) { |
|||
freezen_horizon_px = luckysheetFreezen.freezenhorizontaldata[0]; |
|||
freezen_horizon_ed = luckysheetFreezen.freezenhorizontaldata[1]; |
|||
freezen_horizon_scrollTop = luckysheetFreezen.freezenhorizontaldata[2]; |
|||
|
|||
freezen_vertical_px = luckysheetFreezen.freezenverticaldata[0]; |
|||
freezen_vertical_ed = luckysheetFreezen.freezenverticaldata[1]; |
|||
freezen_vertical_scrollTop = luckysheetFreezen.freezenverticaldata[2]; |
|||
|
|||
//左上canvas freezen_3
|
|||
luckysheetDrawMain( |
|||
freezen_vertical_scrollTop, |
|||
freezen_horizon_scrollTop, |
|||
freezen_vertical_px, |
|||
freezen_horizon_px, |
|||
1, |
|||
1, |
|||
null, |
|||
null, |
|||
"freezen_3" |
|||
); |
|||
|
|||
//上右canvas freezen_4
|
|||
luckysheetDrawMain( |
|||
scrollWidth + freezen_vertical_px - freezen_vertical_scrollTop, |
|||
freezen_horizon_scrollTop, |
|||
drawWidth - freezen_vertical_px + freezen_vertical_scrollTop, |
|||
freezen_horizon_px, |
|||
1, |
|||
1, |
|||
null, |
|||
null, |
|||
"freezen_4" |
|||
); |
|||
|
|||
//左下canvas freezen_7
|
|||
luckysheetDrawMain( |
|||
freezen_vertical_scrollTop, |
|||
scrollHeight + freezen_horizon_px - freezen_horizon_scrollTop, |
|||
freezen_vertical_px, |
|||
drawHeight - freezen_horizon_px + freezen_horizon_scrollTop, |
|||
1, |
|||
1, |
|||
null, |
|||
null, |
|||
"freezen_7" |
|||
); |
|||
|
|||
//右下canvas luckysheetTableContent
|
|||
luckysheetDrawMain( |
|||
scrollWidth + freezen_vertical_px - freezen_vertical_scrollTop, |
|||
scrollHeight + freezen_horizon_px - freezen_horizon_scrollTop, |
|||
drawWidth - freezen_vertical_px + freezen_vertical_scrollTop, |
|||
drawHeight - freezen_horizon_px + freezen_horizon_scrollTop, |
|||
freezen_vertical_px - freezen_vertical_scrollTop + rowHeaderWidth, |
|||
freezen_horizon_px - freezen_horizon_scrollTop + columeHeaderHeight |
|||
); |
|||
|
|||
//标题
|
|||
luckysheetDrawgridColumnTitle( |
|||
scrollWidth + freezen_vertical_px - freezen_vertical_scrollTop, |
|||
drawWidth - freezen_vertical_px + freezen_vertical_scrollTop, |
|||
freezen_vertical_px - freezen_vertical_scrollTop + rowHeaderWidth |
|||
); |
|||
luckysheetDrawgridColumnTitle(freezen_vertical_scrollTop, freezen_vertical_px, rowHeaderWidth); |
|||
|
|||
luckysheetDrawgridRowTitle( |
|||
scrollHeight + freezen_horizon_px - freezen_horizon_scrollTop, |
|||
drawHeight - freezen_horizon_px + freezen_horizon_scrollTop, |
|||
freezen_horizon_px - freezen_horizon_scrollTop + columeHeaderHeight |
|||
); |
|||
luckysheetDrawgridRowTitle(freezen_horizon_scrollTop, freezen_horizon_px, columeHeaderHeight); |
|||
} |
|||
else if (luckysheetFreezen.freezenhorizontaldata != null) { |
|||
freezen_horizon_px = luckysheetFreezen.freezenhorizontaldata[0]; |
|||
freezen_horizon_ed = luckysheetFreezen.freezenhorizontaldata[1]; |
|||
freezen_horizon_scrollTop = luckysheetFreezen.freezenhorizontaldata[2]; |
|||
|
|||
luckysheetDrawMain( |
|||
scrollWidth, |
|||
freezen_horizon_scrollTop, |
|||
drawWidth, |
|||
freezen_horizon_px, |
|||
1, |
|||
1, |
|||
null, |
|||
null, |
|||
"freezen_h" |
|||
); |
|||
luckysheetDrawMain( |
|||
scrollWidth, |
|||
scrollHeight + freezen_horizon_px - freezen_horizon_scrollTop, |
|||
drawWidth, |
|||
drawHeight - freezen_horizon_px + freezen_horizon_scrollTop, |
|||
null, |
|||
freezen_horizon_px - freezen_horizon_scrollTop + columeHeaderHeight |
|||
); |
|||
|
|||
luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, null); |
|||
|
|||
luckysheetDrawgridRowTitle( |
|||
scrollHeight + freezen_horizon_px - freezen_horizon_scrollTop, |
|||
drawHeight - freezen_horizon_px + freezen_horizon_scrollTop, |
|||
freezen_horizon_px - freezen_horizon_scrollTop + columeHeaderHeight |
|||
); |
|||
luckysheetDrawgridRowTitle(freezen_horizon_scrollTop, freezen_horizon_px, columeHeaderHeight); |
|||
} |
|||
else if (luckysheetFreezen.freezenverticaldata != null) { |
|||
freezen_vertical_px = luckysheetFreezen.freezenverticaldata[0]; |
|||
freezen_vertical_ed = luckysheetFreezen.freezenverticaldata[1]; |
|||
freezen_vertical_scrollTop = luckysheetFreezen.freezenverticaldata[2]; |
|||
|
|||
luckysheetDrawMain( |
|||
freezen_vertical_scrollTop, |
|||
scrollHeight, |
|||
freezen_vertical_px, |
|||
drawHeight, |
|||
1, |
|||
1, |
|||
null, |
|||
null, |
|||
"freezen_v" |
|||
); |
|||
luckysheetDrawMain( |
|||
scrollWidth + freezen_vertical_px - freezen_vertical_scrollTop, |
|||
scrollHeight, |
|||
drawWidth - freezen_vertical_px + freezen_vertical_scrollTop, |
|||
drawHeight, |
|||
freezen_vertical_px - freezen_vertical_scrollTop + rowHeaderWidth, |
|||
null |
|||
); |
|||
|
|||
luckysheetDrawgridRowTitle(scrollHeight, drawHeight, null); |
|||
|
|||
luckysheetDrawgridColumnTitle( |
|||
scrollWidth + freezen_vertical_px - freezen_vertical_scrollTop, |
|||
drawWidth - freezen_vertical_px + freezen_vertical_scrollTop, |
|||
freezen_vertical_px - freezen_vertical_scrollTop + rowHeaderWidth |
|||
); |
|||
luckysheetDrawgridColumnTitle(freezen_vertical_scrollTop, freezen_vertical_px, rowHeaderWidth); |
|||
} |
|||
} |
|||
else { |
|||
luckysheetDrawgrid(scrollWidth, scrollHeight); |
|||
} |
|||
} |
|||
|
|||
export { |
|||
jfrefreshgrid, |
|||
jfrefreshgridall, |
|||
jfrefreshgrid_adRC, |
|||
jfrefreshgrid_pastcut, |
|||
jfrefreshgrid_rhcw, |
|||
luckysheetrefreshgrid, |
|||
} |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Loading…
Reference in new issue