@leankylin-sheet/core 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas.d.ts +2 -1
- package/dist/index.esm.js +65 -69
- package/dist/index.js +65 -69
- package/package.json +2 -2
package/dist/canvas.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ export declare class Canvas {
|
|
|
27
27
|
}): void;
|
|
28
28
|
getCellOverflowMap(canvas: CanvasRenderingContext2D, colStart: number, colEnd: number, rowStart: number, rowEnd: number): any;
|
|
29
29
|
nullCellRender(r: number, c: number, startY: number, startX: number, endY: number, endX: number, renderCtx: CanvasRenderingContext2D, afCompute: any, cfCompute: any, offsetLeft: number, offsetTop: number, dynamicArrayCompute: any, cellOverflowMap: any, colStart: number, colEnd: number, scrollHeight: number, scrollWidth: number, bodrder05: any, isMerge?: boolean): void;
|
|
30
|
-
|
|
30
|
+
renderDelLine(renderCtx: CanvasRenderingContext2D, cell: any, startX: number, startY: number, endX: number, endY: number, offsetLeft: number, offsetTop: number): void;
|
|
31
|
+
renderLyFlag(renderCtx: CanvasRenderingContext2D, cell: any, startX: number, startY: number, offsetLeft: number, offsetTop: number): void;
|
|
31
32
|
cellRender(r: number, c: number, startY: number, startX: number, endY: number, endX: number, value: any, renderCtx: CanvasRenderingContext2D, afCompute: any, cfCompute: any, offsetLeft: number, offsetTop: number, dynamicArrayCompute: any, cellOverflowMap: any, colStart: number, colEnd: number, scrollHeight: number, scrollWidth: number, bodrder05: number, isMerge?: boolean): void;
|
|
32
33
|
cellOverflowRender(r: number, c: number, stc: number, edc: number, renderCtx: CanvasRenderingContext2D, scrollHeight: number, scrollWidth: number, offsetLeft: number, offsetTop: number, afCompute: any, cfCompute: any): void;
|
|
33
34
|
cellOverflow_trace(r: number, curC: number, traceC: number, traceDir: string, horizonAlign: string, textMetrics: number): any;
|
package/dist/index.esm.js
CHANGED
|
@@ -62576,7 +62576,7 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62576
62576
|
}, {
|
|
62577
62577
|
key: "nullCellRender",
|
|
62578
62578
|
value: function nullCellRender(r, c, startY, startX, endY, endX, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
|
|
62579
|
-
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$
|
|
62579
|
+
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4, _flowdata$r4$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
|
|
62580
62580
|
var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
|
|
62581
62581
|
var checksCF = checkCF(r, c, cfCompute);
|
|
62582
62582
|
var flowdata = getFlowdata(this.sheetCtx);
|
|
@@ -62613,8 +62613,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62613
62613
|
renderCtx.textBaseline = "bottom";
|
|
62614
62614
|
renderCtx.fillText(_.isNil(value) ? "" : value, horizonAlignPos, verticalAlignPos);
|
|
62615
62615
|
}
|
|
62616
|
-
this.
|
|
62617
|
-
|
|
62616
|
+
this.renderDelLine(renderCtx, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : _flowdata$r2[c], startX, startY, endX, endY, offsetLeft, offsetTop);
|
|
62617
|
+
this.renderLyFlag(renderCtx, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : _flowdata$r3[c], startX, startY, offsetLeft, offsetTop);
|
|
62618
|
+
if (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : (_flowdata$r4$c = _flowdata$r4[c]) === null || _flowdata$r4$c === void 0 ? void 0 : _flowdata$r4$c.ps) {
|
|
62618
62619
|
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62619
62620
|
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
62620
62621
|
renderCtx.beginPath();
|
|
@@ -62658,9 +62659,50 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62658
62659
|
endX: cellsize[2] + cellsize[0]
|
|
62659
62660
|
}, renderCtx);
|
|
62660
62661
|
}
|
|
62662
|
+
}, {
|
|
62663
|
+
key: "renderDelLine",
|
|
62664
|
+
value: function renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop) {
|
|
62665
|
+
var delLineColor = cell === null || cell === void 0 ? void 0 : cell.delLineColor;
|
|
62666
|
+
if (!delLineColor) {
|
|
62667
|
+
return;
|
|
62668
|
+
}
|
|
62669
|
+
var delLineSpace = (cell === null || cell === void 0 ? void 0 : cell.delLineSpace) || 8;
|
|
62670
|
+
startX += offsetLeft;
|
|
62671
|
+
startY += offsetTop + 1;
|
|
62672
|
+
endX += offsetLeft;
|
|
62673
|
+
endY += offsetTop - 2;
|
|
62674
|
+
renderCtx.strokeStyle = delLineColor;
|
|
62675
|
+
renderCtx.lineWidth = 1;
|
|
62676
|
+
var rectWidth = endX - startX;
|
|
62677
|
+
var rectHeight = endY - startY;
|
|
62678
|
+
var tsPosition = function tsPosition(_ref2) {
|
|
62679
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
62680
|
+
x = _ref3[0],
|
|
62681
|
+
y = _ref3[1];
|
|
62682
|
+
if (y > startY + rectHeight) {
|
|
62683
|
+
var dis = y - (startY + rectHeight);
|
|
62684
|
+
y = startY + rectHeight;
|
|
62685
|
+
x += dis;
|
|
62686
|
+
}
|
|
62687
|
+
if (x > startX + rectWidth) {
|
|
62688
|
+
var _dis = x - (startX + rectWidth);
|
|
62689
|
+
x = startX + rectWidth;
|
|
62690
|
+
y += _dis;
|
|
62691
|
+
}
|
|
62692
|
+
return [x, y];
|
|
62693
|
+
};
|
|
62694
|
+
renderCtx.beginPath();
|
|
62695
|
+
for (var space = 0; space < rectWidth + rectHeight; space += delLineSpace) {
|
|
62696
|
+
var startP = tsPosition([startX, startY + space]);
|
|
62697
|
+
var endP = tsPosition([startX + space, startY]);
|
|
62698
|
+
renderCtx.moveTo(startP[0], startP[1]);
|
|
62699
|
+
renderCtx.lineTo(endP[0], endP[1]);
|
|
62700
|
+
}
|
|
62701
|
+
renderCtx.stroke();
|
|
62702
|
+
}
|
|
62661
62703
|
}, {
|
|
62662
62704
|
key: "renderLyFlag",
|
|
62663
|
-
value: function renderLyFlag(renderCtx, cell,
|
|
62705
|
+
value: function renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop) {
|
|
62664
62706
|
var lyFlagColor = cell === null || cell === void 0 ? void 0 : cell.lyFlagColor;
|
|
62665
62707
|
if (!lyFlagColor) {
|
|
62666
62708
|
return;
|
|
@@ -62668,9 +62710,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62668
62710
|
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62669
62711
|
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
62670
62712
|
renderCtx.beginPath();
|
|
62671
|
-
renderCtx.moveTo(
|
|
62672
|
-
renderCtx.lineTo(
|
|
62673
|
-
renderCtx.lineTo(
|
|
62713
|
+
renderCtx.moveTo(startX + offsetLeft, startY + offsetTop);
|
|
62714
|
+
renderCtx.lineTo(startX + offsetLeft, startY + offsetTop + ps_h);
|
|
62715
|
+
renderCtx.lineTo(startX + offsetLeft + ps_w, startY + offsetTop);
|
|
62674
62716
|
renderCtx.fillStyle = lyFlagColor;
|
|
62675
62717
|
renderCtx.fill();
|
|
62676
62718
|
renderCtx.closePath();
|
|
@@ -62678,7 +62720,7 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62678
62720
|
}, {
|
|
62679
62721
|
key: "cellRender",
|
|
62680
62722
|
value: function cellRender(r, c, startY, startX, endY, endX, value, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
|
|
62681
|
-
var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8,
|
|
62723
|
+
var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8, _this$sheetCtx$hooks$9, _this$sheetCtx$hooks9, _flowdata$r5;
|
|
62682
62724
|
var isMerge = arguments.length > 19 && arguments[19] !== undefined ? arguments[19] : false;
|
|
62683
62725
|
var flowdata = getFlowdata(this.sheetCtx);
|
|
62684
62726
|
if (!flowdata) {
|
|
@@ -62728,7 +62770,8 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62728
62770
|
renderCtx.fill();
|
|
62729
62771
|
renderCtx.closePath();
|
|
62730
62772
|
}
|
|
62731
|
-
this.
|
|
62773
|
+
this.renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop);
|
|
62774
|
+
this.renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop);
|
|
62732
62775
|
if (cell === null || cell === void 0 ? void 0 : cell.ps) {
|
|
62733
62776
|
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62734
62777
|
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
@@ -62759,53 +62802,6 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62759
62802
|
} else {
|
|
62760
62803
|
cellOverflow_bd_r_render = false;
|
|
62761
62804
|
}
|
|
62762
|
-
} else if ((dataVerification === null || dataVerification === void 0 ? void 0 : (_dataVerification = dataVerification["".concat(r, "_").concat(c)]) === null || _dataVerification === void 0 ? void 0 : _dataVerification.type) === "checkbox") {
|
|
62763
|
-
var pos_x = startX + offsetLeft;
|
|
62764
|
-
var pos_y = startY + offsetTop + 1;
|
|
62765
|
-
renderCtx.save();
|
|
62766
|
-
renderCtx.beginPath();
|
|
62767
|
-
renderCtx.rect(pos_x, pos_y, cellWidth, cellHeight);
|
|
62768
|
-
renderCtx.clip();
|
|
62769
|
-
renderCtx.scale(this.sheetCtx.zoomRatio, this.sheetCtx.zoomRatio);
|
|
62770
|
-
var measureText = getMeasureText(value, renderCtx, this.sheetCtx);
|
|
62771
|
-
var textMetrics = measureText.width + 14;
|
|
62772
|
-
var oneLineTextHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
|
|
62773
|
-
var horizonAlignPos = pos_x + space_width;
|
|
62774
|
-
if (horizonAlign === 0) {
|
|
62775
|
-
horizonAlignPos = pos_x + cellWidth / 2 - textMetrics / 2;
|
|
62776
|
-
} else if (horizonAlign === 2) {
|
|
62777
|
-
horizonAlignPos = pos_x + cellWidth - space_width - textMetrics;
|
|
62778
|
-
}
|
|
62779
|
-
var verticalCellHeight = cellHeight > oneLineTextHeight ? cellHeight : oneLineTextHeight;
|
|
62780
|
-
var verticalAlignPos_text = pos_y + verticalCellHeight - space_height;
|
|
62781
|
-
renderCtx.textBaseline = "bottom";
|
|
62782
|
-
var verticalAlignPos_checkbox = verticalAlignPos_text - 13 * this.sheetCtx.zoomRatio;
|
|
62783
|
-
if (verticalAlign === 0) {
|
|
62784
|
-
verticalAlignPos_text = pos_y + verticalCellHeight / 2;
|
|
62785
|
-
renderCtx.textBaseline = "middle";
|
|
62786
|
-
verticalAlignPos_checkbox = verticalAlignPos_text - 6 * this.sheetCtx.zoomRatio;
|
|
62787
|
-
} else if (verticalAlign === 1) {
|
|
62788
|
-
verticalAlignPos_text = pos_y + space_height;
|
|
62789
|
-
renderCtx.textBaseline = "top";
|
|
62790
|
-
verticalAlignPos_checkbox = verticalAlignPos_text + 1 * this.sheetCtx.zoomRatio;
|
|
62791
|
-
}
|
|
62792
|
-
horizonAlignPos /= this.sheetCtx.zoomRatio;
|
|
62793
|
-
verticalAlignPos_text /= this.sheetCtx.zoomRatio;
|
|
62794
|
-
verticalAlignPos_checkbox /= this.sheetCtx.zoomRatio;
|
|
62795
|
-
renderCtx.lineWidth = 1;
|
|
62796
|
-
renderCtx.strokeStyle = "#000";
|
|
62797
|
-
renderCtx.strokeRect(horizonAlignPos, verticalAlignPos_checkbox, 10, 10);
|
|
62798
|
-
if (dataVerification["".concat(r, "_").concat(c)].checked) {
|
|
62799
|
-
renderCtx.beginPath();
|
|
62800
|
-
renderCtx.lineTo(horizonAlignPos + 1, verticalAlignPos_checkbox + 6);
|
|
62801
|
-
renderCtx.lineTo(horizonAlignPos + 4, verticalAlignPos_checkbox + 9);
|
|
62802
|
-
renderCtx.lineTo(horizonAlignPos + 9, verticalAlignPos_checkbox + 2);
|
|
62803
|
-
renderCtx.stroke();
|
|
62804
|
-
renderCtx.closePath();
|
|
62805
|
-
}
|
|
62806
|
-
renderCtx.fillStyle = normalizedAttr(flowdata, r, c, "fc");
|
|
62807
|
-
renderCtx.fillText(_.isNil(value) ? "" : value, horizonAlignPos + 14, verticalAlignPos_text);
|
|
62808
|
-
renderCtx.restore();
|
|
62809
62805
|
} else {
|
|
62810
62806
|
var _checksCF$dataBar, _checksCF$dataBar2, _checksCF$dataBar2$va, _cell$ct$fa$indexOf, _cell$ct, _cell$ct$fa, _cell$ct2;
|
|
62811
62807
|
if ((checksCF === null || checksCF === void 0 ? void 0 : (_checksCF$dataBar = checksCF.dataBar) === null || _checksCF$dataBar === void 0 ? void 0 : _checksCF$dataBar.valueLen) && (checksCF === null || checksCF === void 0 ? void 0 : (_checksCF$dataBar2 = checksCF.dataBar) === null || _checksCF$dataBar2 === void 0 ? void 0 : (_checksCF$dataBar2$va = _checksCF$dataBar2.valueLen) === null || _checksCF$dataBar2$va === void 0 ? void 0 : _checksCF$dataBar2$va.toString()) !== "NaN") {
|
|
@@ -62887,11 +62883,11 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62887
62883
|
}
|
|
62888
62884
|
}
|
|
62889
62885
|
}
|
|
62890
|
-
var
|
|
62891
|
-
var
|
|
62886
|
+
var pos_x = startX + offsetLeft;
|
|
62887
|
+
var pos_y = startY + offsetTop + 1;
|
|
62892
62888
|
renderCtx.save();
|
|
62893
62889
|
renderCtx.beginPath();
|
|
62894
|
-
renderCtx.rect(
|
|
62890
|
+
renderCtx.rect(pos_x, pos_y, cellWidth, cellHeight);
|
|
62895
62891
|
renderCtx.clip();
|
|
62896
62892
|
renderCtx.scale(this.sheetCtx.zoomRatio, this.sheetCtx.zoomRatio);
|
|
62897
62893
|
var textInfo = cell ? getCellTextInfo(cell, renderCtx, this.sheetCtx, {
|
|
@@ -62906,16 +62902,16 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62906
62902
|
var l = checksCF.icons.left;
|
|
62907
62903
|
var t = checksCF.icons.top;
|
|
62908
62904
|
var _value = textInfo.values[0];
|
|
62909
|
-
var verticalAlignPos =
|
|
62905
|
+
var verticalAlignPos = pos_y + _value.top - textInfo.textHeightAll;
|
|
62910
62906
|
if (verticalAlign === 0) {
|
|
62911
|
-
verticalAlignPos =
|
|
62907
|
+
verticalAlignPos = pos_y + cellHeight / 2 - textInfo.textHeightAll / 2;
|
|
62912
62908
|
} else if (verticalAlign === 1) {
|
|
62913
|
-
verticalAlignPos =
|
|
62909
|
+
verticalAlignPos = pos_y;
|
|
62914
62910
|
} else if (verticalAlign === 2) {
|
|
62915
62911
|
verticalAlignPos -= textInfo.desc;
|
|
62916
62912
|
}
|
|
62917
62913
|
verticalAlignPos /= this.sheetCtx.zoomRatio;
|
|
62918
|
-
renderCtx.drawImage(getCfIconsImg(), l * 42, t * 32, 32, 32,
|
|
62914
|
+
renderCtx.drawImage(getCfIconsImg(), l * 42, t * 32, 32, 32, pos_x / this.sheetCtx.zoomRatio, verticalAlignPos, textInfo.textHeightAll / this.sheetCtx.zoomRatio, textInfo.textHeightAll / this.sheetCtx.zoomRatio);
|
|
62919
62915
|
}
|
|
62920
62916
|
renderCtx.fillStyle = normalizedAttr(flowdata, r, c, "fc");
|
|
62921
62917
|
if (checksAF === null || checksAF === void 0 ? void 0 : checksAF[0]) {
|
|
@@ -62929,8 +62925,8 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62929
62925
|
renderCtx.fillStyle = "#ff0000";
|
|
62930
62926
|
}
|
|
62931
62927
|
this.cellTextRender(textInfo, renderCtx, {
|
|
62932
|
-
pos_x:
|
|
62933
|
-
pos_y:
|
|
62928
|
+
pos_x: pos_x,
|
|
62929
|
+
pos_y: pos_y
|
|
62934
62930
|
});
|
|
62935
62931
|
renderCtx.restore();
|
|
62936
62932
|
}
|
|
@@ -62954,7 +62950,7 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62954
62950
|
renderCtx.stroke();
|
|
62955
62951
|
renderCtx.closePath();
|
|
62956
62952
|
}
|
|
62957
|
-
(_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$
|
|
62953
|
+
(_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$r5 = flowdata[r]) === null || _flowdata$r5 === void 0 ? void 0 : _flowdata$r5[c], {
|
|
62958
62954
|
row: r,
|
|
62959
62955
|
column: c,
|
|
62960
62956
|
startX: cellsize[0],
|
|
@@ -63194,9 +63190,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
63194
63190
|
}
|
|
63195
63191
|
}, {
|
|
63196
63192
|
key: "drawFreezeLine",
|
|
63197
|
-
value: function drawFreezeLine(
|
|
63198
|
-
var horizontalTop =
|
|
63199
|
-
verticalLeft =
|
|
63193
|
+
value: function drawFreezeLine(_ref4) {
|
|
63194
|
+
var horizontalTop = _ref4.horizontalTop,
|
|
63195
|
+
verticalLeft = _ref4.verticalLeft;
|
|
63200
63196
|
}
|
|
63201
63197
|
}]);
|
|
63202
63198
|
}();
|
package/dist/index.js
CHANGED
|
@@ -62586,7 +62586,7 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62586
62586
|
}, {
|
|
62587
62587
|
key: "nullCellRender",
|
|
62588
62588
|
value: function nullCellRender(r, c, startY, startX, endY, endX, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
|
|
62589
|
-
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$
|
|
62589
|
+
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4, _flowdata$r4$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
|
|
62590
62590
|
var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
|
|
62591
62591
|
var checksCF = checkCF(r, c, cfCompute);
|
|
62592
62592
|
var flowdata = getFlowdata(this.sheetCtx);
|
|
@@ -62623,8 +62623,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62623
62623
|
renderCtx.textBaseline = "bottom";
|
|
62624
62624
|
renderCtx.fillText(___default['default'].isNil(value) ? "" : value, horizonAlignPos, verticalAlignPos);
|
|
62625
62625
|
}
|
|
62626
|
-
this.
|
|
62627
|
-
|
|
62626
|
+
this.renderDelLine(renderCtx, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : _flowdata$r2[c], startX, startY, endX, endY, offsetLeft, offsetTop);
|
|
62627
|
+
this.renderLyFlag(renderCtx, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r3 = flowdata[r]) === null || _flowdata$r3 === void 0 ? void 0 : _flowdata$r3[c], startX, startY, offsetLeft, offsetTop);
|
|
62628
|
+
if (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : (_flowdata$r4$c = _flowdata$r4[c]) === null || _flowdata$r4$c === void 0 ? void 0 : _flowdata$r4$c.ps) {
|
|
62628
62629
|
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62629
62630
|
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
62630
62631
|
renderCtx.beginPath();
|
|
@@ -62668,9 +62669,50 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62668
62669
|
endX: cellsize[2] + cellsize[0]
|
|
62669
62670
|
}, renderCtx);
|
|
62670
62671
|
}
|
|
62672
|
+
}, {
|
|
62673
|
+
key: "renderDelLine",
|
|
62674
|
+
value: function renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop) {
|
|
62675
|
+
var delLineColor = cell === null || cell === void 0 ? void 0 : cell.delLineColor;
|
|
62676
|
+
if (!delLineColor) {
|
|
62677
|
+
return;
|
|
62678
|
+
}
|
|
62679
|
+
var delLineSpace = (cell === null || cell === void 0 ? void 0 : cell.delLineSpace) || 8;
|
|
62680
|
+
startX += offsetLeft;
|
|
62681
|
+
startY += offsetTop + 1;
|
|
62682
|
+
endX += offsetLeft;
|
|
62683
|
+
endY += offsetTop - 2;
|
|
62684
|
+
renderCtx.strokeStyle = delLineColor;
|
|
62685
|
+
renderCtx.lineWidth = 1;
|
|
62686
|
+
var rectWidth = endX - startX;
|
|
62687
|
+
var rectHeight = endY - startY;
|
|
62688
|
+
var tsPosition = function tsPosition(_ref2) {
|
|
62689
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
62690
|
+
x = _ref3[0],
|
|
62691
|
+
y = _ref3[1];
|
|
62692
|
+
if (y > startY + rectHeight) {
|
|
62693
|
+
var dis = y - (startY + rectHeight);
|
|
62694
|
+
y = startY + rectHeight;
|
|
62695
|
+
x += dis;
|
|
62696
|
+
}
|
|
62697
|
+
if (x > startX + rectWidth) {
|
|
62698
|
+
var _dis = x - (startX + rectWidth);
|
|
62699
|
+
x = startX + rectWidth;
|
|
62700
|
+
y += _dis;
|
|
62701
|
+
}
|
|
62702
|
+
return [x, y];
|
|
62703
|
+
};
|
|
62704
|
+
renderCtx.beginPath();
|
|
62705
|
+
for (var space = 0; space < rectWidth + rectHeight; space += delLineSpace) {
|
|
62706
|
+
var startP = tsPosition([startX, startY + space]);
|
|
62707
|
+
var endP = tsPosition([startX + space, startY]);
|
|
62708
|
+
renderCtx.moveTo(startP[0], startP[1]);
|
|
62709
|
+
renderCtx.lineTo(endP[0], endP[1]);
|
|
62710
|
+
}
|
|
62711
|
+
renderCtx.stroke();
|
|
62712
|
+
}
|
|
62671
62713
|
}, {
|
|
62672
62714
|
key: "renderLyFlag",
|
|
62673
|
-
value: function renderLyFlag(renderCtx, cell,
|
|
62715
|
+
value: function renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop) {
|
|
62674
62716
|
var lyFlagColor = cell === null || cell === void 0 ? void 0 : cell.lyFlagColor;
|
|
62675
62717
|
if (!lyFlagColor) {
|
|
62676
62718
|
return;
|
|
@@ -62678,9 +62720,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62678
62720
|
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62679
62721
|
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
62680
62722
|
renderCtx.beginPath();
|
|
62681
|
-
renderCtx.moveTo(
|
|
62682
|
-
renderCtx.lineTo(
|
|
62683
|
-
renderCtx.lineTo(
|
|
62723
|
+
renderCtx.moveTo(startX + offsetLeft, startY + offsetTop);
|
|
62724
|
+
renderCtx.lineTo(startX + offsetLeft, startY + offsetTop + ps_h);
|
|
62725
|
+
renderCtx.lineTo(startX + offsetLeft + ps_w, startY + offsetTop);
|
|
62684
62726
|
renderCtx.fillStyle = lyFlagColor;
|
|
62685
62727
|
renderCtx.fill();
|
|
62686
62728
|
renderCtx.closePath();
|
|
@@ -62688,7 +62730,7 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62688
62730
|
}, {
|
|
62689
62731
|
key: "cellRender",
|
|
62690
62732
|
value: function cellRender(r, c, startY, startX, endY, endX, value, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
|
|
62691
|
-
var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8,
|
|
62733
|
+
var _this$sheetCtx$hooks$8, _this$sheetCtx$hooks8, _this$sheetCtx$hooks$9, _this$sheetCtx$hooks9, _flowdata$r5;
|
|
62692
62734
|
var isMerge = arguments.length > 19 && arguments[19] !== undefined ? arguments[19] : false;
|
|
62693
62735
|
var flowdata = getFlowdata(this.sheetCtx);
|
|
62694
62736
|
if (!flowdata) {
|
|
@@ -62738,7 +62780,8 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62738
62780
|
renderCtx.fill();
|
|
62739
62781
|
renderCtx.closePath();
|
|
62740
62782
|
}
|
|
62741
|
-
this.
|
|
62783
|
+
this.renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop);
|
|
62784
|
+
this.renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop);
|
|
62742
62785
|
if (cell === null || cell === void 0 ? void 0 : cell.ps) {
|
|
62743
62786
|
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62744
62787
|
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
@@ -62769,53 +62812,6 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62769
62812
|
} else {
|
|
62770
62813
|
cellOverflow_bd_r_render = false;
|
|
62771
62814
|
}
|
|
62772
|
-
} else if ((dataVerification === null || dataVerification === void 0 ? void 0 : (_dataVerification = dataVerification["".concat(r, "_").concat(c)]) === null || _dataVerification === void 0 ? void 0 : _dataVerification.type) === "checkbox") {
|
|
62773
|
-
var pos_x = startX + offsetLeft;
|
|
62774
|
-
var pos_y = startY + offsetTop + 1;
|
|
62775
|
-
renderCtx.save();
|
|
62776
|
-
renderCtx.beginPath();
|
|
62777
|
-
renderCtx.rect(pos_x, pos_y, cellWidth, cellHeight);
|
|
62778
|
-
renderCtx.clip();
|
|
62779
|
-
renderCtx.scale(this.sheetCtx.zoomRatio, this.sheetCtx.zoomRatio);
|
|
62780
|
-
var measureText = getMeasureText(value, renderCtx, this.sheetCtx);
|
|
62781
|
-
var textMetrics = measureText.width + 14;
|
|
62782
|
-
var oneLineTextHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
|
|
62783
|
-
var horizonAlignPos = pos_x + space_width;
|
|
62784
|
-
if (horizonAlign === 0) {
|
|
62785
|
-
horizonAlignPos = pos_x + cellWidth / 2 - textMetrics / 2;
|
|
62786
|
-
} else if (horizonAlign === 2) {
|
|
62787
|
-
horizonAlignPos = pos_x + cellWidth - space_width - textMetrics;
|
|
62788
|
-
}
|
|
62789
|
-
var verticalCellHeight = cellHeight > oneLineTextHeight ? cellHeight : oneLineTextHeight;
|
|
62790
|
-
var verticalAlignPos_text = pos_y + verticalCellHeight - space_height;
|
|
62791
|
-
renderCtx.textBaseline = "bottom";
|
|
62792
|
-
var verticalAlignPos_checkbox = verticalAlignPos_text - 13 * this.sheetCtx.zoomRatio;
|
|
62793
|
-
if (verticalAlign === 0) {
|
|
62794
|
-
verticalAlignPos_text = pos_y + verticalCellHeight / 2;
|
|
62795
|
-
renderCtx.textBaseline = "middle";
|
|
62796
|
-
verticalAlignPos_checkbox = verticalAlignPos_text - 6 * this.sheetCtx.zoomRatio;
|
|
62797
|
-
} else if (verticalAlign === 1) {
|
|
62798
|
-
verticalAlignPos_text = pos_y + space_height;
|
|
62799
|
-
renderCtx.textBaseline = "top";
|
|
62800
|
-
verticalAlignPos_checkbox = verticalAlignPos_text + 1 * this.sheetCtx.zoomRatio;
|
|
62801
|
-
}
|
|
62802
|
-
horizonAlignPos /= this.sheetCtx.zoomRatio;
|
|
62803
|
-
verticalAlignPos_text /= this.sheetCtx.zoomRatio;
|
|
62804
|
-
verticalAlignPos_checkbox /= this.sheetCtx.zoomRatio;
|
|
62805
|
-
renderCtx.lineWidth = 1;
|
|
62806
|
-
renderCtx.strokeStyle = "#000";
|
|
62807
|
-
renderCtx.strokeRect(horizonAlignPos, verticalAlignPos_checkbox, 10, 10);
|
|
62808
|
-
if (dataVerification["".concat(r, "_").concat(c)].checked) {
|
|
62809
|
-
renderCtx.beginPath();
|
|
62810
|
-
renderCtx.lineTo(horizonAlignPos + 1, verticalAlignPos_checkbox + 6);
|
|
62811
|
-
renderCtx.lineTo(horizonAlignPos + 4, verticalAlignPos_checkbox + 9);
|
|
62812
|
-
renderCtx.lineTo(horizonAlignPos + 9, verticalAlignPos_checkbox + 2);
|
|
62813
|
-
renderCtx.stroke();
|
|
62814
|
-
renderCtx.closePath();
|
|
62815
|
-
}
|
|
62816
|
-
renderCtx.fillStyle = normalizedAttr(flowdata, r, c, "fc");
|
|
62817
|
-
renderCtx.fillText(___default['default'].isNil(value) ? "" : value, horizonAlignPos + 14, verticalAlignPos_text);
|
|
62818
|
-
renderCtx.restore();
|
|
62819
62815
|
} else {
|
|
62820
62816
|
var _checksCF$dataBar, _checksCF$dataBar2, _checksCF$dataBar2$va, _cell$ct$fa$indexOf, _cell$ct, _cell$ct$fa, _cell$ct2;
|
|
62821
62817
|
if ((checksCF === null || checksCF === void 0 ? void 0 : (_checksCF$dataBar = checksCF.dataBar) === null || _checksCF$dataBar === void 0 ? void 0 : _checksCF$dataBar.valueLen) && (checksCF === null || checksCF === void 0 ? void 0 : (_checksCF$dataBar2 = checksCF.dataBar) === null || _checksCF$dataBar2 === void 0 ? void 0 : (_checksCF$dataBar2$va = _checksCF$dataBar2.valueLen) === null || _checksCF$dataBar2$va === void 0 ? void 0 : _checksCF$dataBar2$va.toString()) !== "NaN") {
|
|
@@ -62897,11 +62893,11 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62897
62893
|
}
|
|
62898
62894
|
}
|
|
62899
62895
|
}
|
|
62900
|
-
var
|
|
62901
|
-
var
|
|
62896
|
+
var pos_x = startX + offsetLeft;
|
|
62897
|
+
var pos_y = startY + offsetTop + 1;
|
|
62902
62898
|
renderCtx.save();
|
|
62903
62899
|
renderCtx.beginPath();
|
|
62904
|
-
renderCtx.rect(
|
|
62900
|
+
renderCtx.rect(pos_x, pos_y, cellWidth, cellHeight);
|
|
62905
62901
|
renderCtx.clip();
|
|
62906
62902
|
renderCtx.scale(this.sheetCtx.zoomRatio, this.sheetCtx.zoomRatio);
|
|
62907
62903
|
var textInfo = cell ? getCellTextInfo(cell, renderCtx, this.sheetCtx, {
|
|
@@ -62916,16 +62912,16 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62916
62912
|
var l = checksCF.icons.left;
|
|
62917
62913
|
var t = checksCF.icons.top;
|
|
62918
62914
|
var _value = textInfo.values[0];
|
|
62919
|
-
var verticalAlignPos =
|
|
62915
|
+
var verticalAlignPos = pos_y + _value.top - textInfo.textHeightAll;
|
|
62920
62916
|
if (verticalAlign === 0) {
|
|
62921
|
-
verticalAlignPos =
|
|
62917
|
+
verticalAlignPos = pos_y + cellHeight / 2 - textInfo.textHeightAll / 2;
|
|
62922
62918
|
} else if (verticalAlign === 1) {
|
|
62923
|
-
verticalAlignPos =
|
|
62919
|
+
verticalAlignPos = pos_y;
|
|
62924
62920
|
} else if (verticalAlign === 2) {
|
|
62925
62921
|
verticalAlignPos -= textInfo.desc;
|
|
62926
62922
|
}
|
|
62927
62923
|
verticalAlignPos /= this.sheetCtx.zoomRatio;
|
|
62928
|
-
renderCtx.drawImage(getCfIconsImg(), l * 42, t * 32, 32, 32,
|
|
62924
|
+
renderCtx.drawImage(getCfIconsImg(), l * 42, t * 32, 32, 32, pos_x / this.sheetCtx.zoomRatio, verticalAlignPos, textInfo.textHeightAll / this.sheetCtx.zoomRatio, textInfo.textHeightAll / this.sheetCtx.zoomRatio);
|
|
62929
62925
|
}
|
|
62930
62926
|
renderCtx.fillStyle = normalizedAttr(flowdata, r, c, "fc");
|
|
62931
62927
|
if (checksAF === null || checksAF === void 0 ? void 0 : checksAF[0]) {
|
|
@@ -62939,8 +62935,8 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62939
62935
|
renderCtx.fillStyle = "#ff0000";
|
|
62940
62936
|
}
|
|
62941
62937
|
this.cellTextRender(textInfo, renderCtx, {
|
|
62942
|
-
pos_x:
|
|
62943
|
-
pos_y:
|
|
62938
|
+
pos_x: pos_x,
|
|
62939
|
+
pos_y: pos_y
|
|
62944
62940
|
});
|
|
62945
62941
|
renderCtx.restore();
|
|
62946
62942
|
}
|
|
@@ -62964,7 +62960,7 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62964
62960
|
renderCtx.stroke();
|
|
62965
62961
|
renderCtx.closePath();
|
|
62966
62962
|
}
|
|
62967
|
-
(_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$
|
|
62963
|
+
(_this$sheetCtx$hooks$9 = (_this$sheetCtx$hooks9 = this.sheetCtx.hooks).afterRenderCell) === null || _this$sheetCtx$hooks$9 === void 0 ? void 0 : _this$sheetCtx$hooks$9.call(_this$sheetCtx$hooks9, (_flowdata$r5 = flowdata[r]) === null || _flowdata$r5 === void 0 ? void 0 : _flowdata$r5[c], {
|
|
62968
62964
|
row: r,
|
|
62969
62965
|
column: c,
|
|
62970
62966
|
startX: cellsize[0],
|
|
@@ -63204,9 +63200,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
63204
63200
|
}
|
|
63205
63201
|
}, {
|
|
63206
63202
|
key: "drawFreezeLine",
|
|
63207
|
-
value: function drawFreezeLine(
|
|
63208
|
-
var horizontalTop =
|
|
63209
|
-
verticalLeft =
|
|
63203
|
+
value: function drawFreezeLine(_ref4) {
|
|
63204
|
+
var horizontalTop = _ref4.horizontalTop,
|
|
63205
|
+
verticalLeft = _ref4.verticalLeft;
|
|
63210
63206
|
}
|
|
63211
63207
|
}]);
|
|
63212
63208
|
}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leankylin-sheet/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "father-build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@leankylin-sheet/formula-parser": "^3.0.
|
|
16
|
+
"@leankylin-sheet/formula-parser": "^3.0.2",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"immer": "^9.0.12",
|
|
19
19
|
"lodash": "^4.17.21",
|