|
@ -15,8 +15,10 @@ import { getBorderInfoCompute } from './border'; |
|
|
import { getSheetIndex } from '../methods/get'; |
|
|
import { getSheetIndex } from '../methods/get'; |
|
|
import { getObjType, chatatABC, luckysheetfontformat } from '../utils/util'; |
|
|
import { getObjType, chatatABC, luckysheetfontformat } from '../utils/util'; |
|
|
import { isInlineStringCell } from '../controllers/inlineString'; |
|
|
import { isInlineStringCell } from '../controllers/inlineString'; |
|
|
|
|
|
import method from './method'; |
|
|
import Store from '../store'; |
|
|
import Store from '../store'; |
|
|
import locale from '../locale/locale'; |
|
|
import locale from '../locale/locale'; |
|
|
|
|
|
import sheetmanage from '../controllers/sheetmanage'; |
|
|
|
|
|
|
|
|
function luckysheetDrawgridRowTitle(scrollHeight, drawHeight, offsetTop) { |
|
|
function luckysheetDrawgridRowTitle(scrollHeight, drawHeight, offsetTop) { |
|
|
if (scrollHeight == null) { |
|
|
if (scrollHeight == null) { |
|
@ -79,14 +81,21 @@ function luckysheetDrawgridRowTitle(scrollHeight, drawHeight, offsetTop) { |
|
|
// if(end_r > scrollHeight + drawHeight){
|
|
|
// if(end_r > scrollHeight + drawHeight){
|
|
|
// break;
|
|
|
// break;
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
let firstOffset = (dataset_row_st==r)?-2:0; |
|
|
|
|
|
let lastOffset = (dataset_row_ed==r)?-2:0; |
|
|
|
|
|
//列标题单元格渲染前触发,return false 则不渲染该单元格
|
|
|
|
|
|
if(!method.createHookFunction("rowTitleCellRenderBefore", r+1, { |
|
|
|
|
|
r:r, |
|
|
|
|
|
top:(start_r + offsetTop + firstOffset), |
|
|
|
|
|
width:Store.rowHeaderWidth -1, |
|
|
|
|
|
height:(end_r - start_r + 1+lastOffset-firstOffset) |
|
|
|
|
|
}, luckysheetTableContent)){ continue; } |
|
|
|
|
|
|
|
|
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) { |
|
|
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
luckysheetTableContent.fillStyle = "#ffffff"; |
|
|
luckysheetTableContent.fillStyle = "#ffffff"; |
|
|
let firstOffset = (dataset_row_st==r)?-2:0; |
|
|
|
|
|
let lastOffset = (dataset_row_ed==r)?-2:0; |
|
|
|
|
|
luckysheetTableContent.fillRect( |
|
|
luckysheetTableContent.fillRect( |
|
|
0, |
|
|
0, |
|
|
(start_r + offsetTop + firstOffset) , |
|
|
(start_r + offsetTop + firstOffset) , |
|
@ -174,6 +183,14 @@ function luckysheetDrawgridRowTitle(scrollHeight, drawHeight, offsetTop) { |
|
|
|
|
|
|
|
|
preEndR = end_r; |
|
|
preEndR = end_r; |
|
|
|
|
|
|
|
|
|
|
|
//列标题单元格渲染前触发,return false 则不渲染该单元格
|
|
|
|
|
|
method.createHookFunction("rowTitleCellRenderAfter", r+1, { |
|
|
|
|
|
r:r, |
|
|
|
|
|
top:(start_r + offsetTop + firstOffset), |
|
|
|
|
|
width:Store.rowHeaderWidth -1, |
|
|
|
|
|
height:(end_r - start_r + 1+lastOffset-firstOffset) |
|
|
|
|
|
}, luckysheetTableContent) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//行标题栏竖线
|
|
|
//行标题栏竖线
|
|
@ -262,6 +279,14 @@ function luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, offsetLeft) { |
|
|
// if(end_c > scrollWidth + drawWidth+1){
|
|
|
// if(end_c > scrollWidth + drawWidth+1){
|
|
|
// break;
|
|
|
// break;
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
let abc = chatatABC(c); |
|
|
|
|
|
//列标题单元格渲染前触发,return false 则不渲染该单元格
|
|
|
|
|
|
if(!method.createHookFunction("columnTitleCellRenderBefore", abc, { |
|
|
|
|
|
c:c, |
|
|
|
|
|
left:(start_c + offsetLeft - 1), |
|
|
|
|
|
width:(end_c - start_c), |
|
|
|
|
|
height:Store.columeHeaderHeight -1 |
|
|
|
|
|
}, luckysheetTableContent)){ continue; } |
|
|
|
|
|
|
|
|
if (Store.config["colhidden"] != null && Store.config["colhidden"][c] != null) { |
|
|
if (Store.config["colhidden"] != null && Store.config["colhidden"][c] != null) { |
|
|
|
|
|
|
|
@ -279,7 +304,7 @@ function luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, offsetLeft) { |
|
|
//列标题栏序列号
|
|
|
//列标题栏序列号
|
|
|
luckysheetTableContent.save();//save scale before draw text
|
|
|
luckysheetTableContent.save();//save scale before draw text
|
|
|
luckysheetTableContent.scale(Store.zoomRatio,Store.zoomRatio); |
|
|
luckysheetTableContent.scale(Store.zoomRatio,Store.zoomRatio); |
|
|
let abc = chatatABC(c); |
|
|
|
|
|
let textMetrics = getMeasureText(abc, luckysheetTableContent); |
|
|
let textMetrics = getMeasureText(abc, luckysheetTableContent); |
|
|
//luckysheetTableContent.measureText(abc);
|
|
|
//luckysheetTableContent.measureText(abc);
|
|
|
|
|
|
|
|
@ -357,6 +382,13 @@ function luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, offsetLeft) { |
|
|
luckysheetTableContent.closePath(); |
|
|
luckysheetTableContent.closePath(); |
|
|
|
|
|
|
|
|
preEndC = end_c; |
|
|
preEndC = end_c; |
|
|
|
|
|
|
|
|
|
|
|
method.createHookFunction("columnTitleCellRenderAfter", abc, { |
|
|
|
|
|
c:c, |
|
|
|
|
|
left:(start_c + offsetLeft - 1), |
|
|
|
|
|
width:(end_c - start_c), |
|
|
|
|
|
height:Store.columeHeaderHeight -1 |
|
|
|
|
|
}, luckysheetTableContent) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//列标题栏横线
|
|
|
//列标题栏横线
|
|
@ -387,6 +419,7 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let sheetFile = sheetmanage.getSheetByIndex(); |
|
|
|
|
|
|
|
|
// console.trace();
|
|
|
// console.trace();
|
|
|
clearTimeout(Store.measureTextCacheTimeOut); |
|
|
clearTimeout(Store.measureTextCacheTimeOut); |
|
@ -571,6 +604,8 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of |
|
|
firstcolumnlen = Store.config["columnlen"][c]; |
|
|
firstcolumnlen = Store.config["columnlen"][c]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Store.flowdata[r] != null && Store.flowdata[r][c] != null) { |
|
|
if (Store.flowdata[r] != null && Store.flowdata[r][c] != null) { |
|
|
let value = Store.flowdata[r][c]; |
|
|
let value = Store.flowdata[r][c]; |
|
|
|
|
|
|
|
@ -617,6 +652,18 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
//空单元格渲染前
|
|
|
|
|
|
if(!method.createHookFunction("cellRenderBefore", Store.flowdata[r][c], { |
|
|
|
|
|
r:r, |
|
|
|
|
|
c:c, |
|
|
|
|
|
"start_r": start_r, |
|
|
|
|
|
"start_c": start_c, |
|
|
|
|
|
"end_r": end_r, |
|
|
|
|
|
"end_c": end_c |
|
|
|
|
|
}, sheetFile,luckysheetTableContent)){ continue; } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cellupdate.push({ |
|
|
cellupdate.push({ |
|
|
"r": r, |
|
|
"r": r, |
|
@ -664,6 +711,16 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//有值单元格渲染前
|
|
|
|
|
|
if(!method.createHookFunction("cellRenderBefore", Store.flowdata[r][c], { |
|
|
|
|
|
r:r, |
|
|
|
|
|
c:c, |
|
|
|
|
|
"start_r": start_r, |
|
|
|
|
|
"start_c": start_c, |
|
|
|
|
|
"end_r": end_r, |
|
|
|
|
|
"end_c": end_c |
|
|
|
|
|
}, sheetFile,luckysheetTableContent)){ continue; } |
|
|
|
|
|
|
|
|
if(Store.flowdata[r][c] == null){ //空单元格
|
|
|
if(Store.flowdata[r][c] == null){ //空单元格
|
|
|
nullCellRender(r, c, start_r, start_c, end_r, end_c,luckysheetTableContent,af_compute, cf_compute,offsetLeft,offsetTop,dynamicArray_compute,cellOverflowMap, dataset_col_st, dataset_col_ed,scrollHeight,scrollWidth,bodrder05); |
|
|
nullCellRender(r, c, start_r, start_c, end_r, end_c,luckysheetTableContent,af_compute, cf_compute,offsetLeft,offsetTop,dynamicArray_compute,cellOverflowMap, dataset_col_st, dataset_col_ed,scrollHeight,scrollWidth,bodrder05); |
|
|
} |
|
|
} |
|
@ -700,6 +757,15 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of |
|
|
cellRender(r, c, start_r, start_c, end_r, end_c, value,luckysheetTableContent,af_compute, cf_compute,offsetLeft,offsetTop,dynamicArray_compute,cellOverflowMap, dataset_col_st, dataset_col_ed,scrollHeight,scrollWidth,bodrder05); |
|
|
cellRender(r, c, start_r, start_c, end_r, end_c, value,luckysheetTableContent,af_compute, cf_compute,offsetLeft,offsetTop,dynamicArray_compute,cellOverflowMap, dataset_col_st, dataset_col_ed,scrollHeight,scrollWidth,bodrder05); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
method.createHookFunction("cellRenderAfter", Store.flowdata[r][c], { |
|
|
|
|
|
r:r, |
|
|
|
|
|
c:c, |
|
|
|
|
|
"start_r": start_r, |
|
|
|
|
|
"start_c": start_c, |
|
|
|
|
|
"end_r": end_r, |
|
|
|
|
|
"end_c": end_c |
|
|
|
|
|
}, sheetFile,luckysheetTableContent) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//合并单元格再处理
|
|
|
//合并单元格再处理
|
|
|