@leankylin-sheet/core 3.1.14 → 3.1.16
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 +8 -0
- package/dist/index.esm.js +91 -58
- package/dist/index.js +91 -58
- package/dist/modules/comment.d.ts +1 -0
- package/dist/settings.d.ts +1 -0
- package/dist/types.d.ts +2 -0
- package/package.json +2 -2
package/dist/canvas.d.ts
CHANGED
|
@@ -26,6 +26,14 @@ export declare class Canvas {
|
|
|
26
26
|
clear?: boolean;
|
|
27
27
|
}): void;
|
|
28
28
|
getCellOverflowMap(canvas: CanvasRenderingContext2D, colStart: number, colEnd: number, rowStart: number, rowEnd: number): any;
|
|
29
|
+
cellPsRender({ renderCtx, cell, endX, startY, offsetLeft, offsetTop, }: {
|
|
30
|
+
renderCtx: any;
|
|
31
|
+
cell: any;
|
|
32
|
+
endX: any;
|
|
33
|
+
startY: any;
|
|
34
|
+
offsetLeft: any;
|
|
35
|
+
offsetTop: any;
|
|
36
|
+
}): void;
|
|
29
37
|
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
38
|
renderDelLine(renderCtx: CanvasRenderingContext2D, cell: any, startX: number, startY: number, endX: number, endY: number, offsetLeft: number, offsetTop: number): void;
|
|
31
39
|
renderLyFlag(renderCtx: CanvasRenderingContext2D, cell: any, startX: number, startY: number, offsetLeft: number, offsetTop: number): void;
|
package/dist/index.esm.js
CHANGED
|
@@ -58800,6 +58800,7 @@ function getCommentBoxByRC(ctx, flowdata, r, c) {
|
|
|
58800
58800
|
var width = (comment === null || comment === void 0 ? void 0 : comment.width) == null ? commentBoxProps.defaultWidth * ctx.zoomRatio : comment.width * ctx.zoomRatio;
|
|
58801
58801
|
var height = (comment === null || comment === void 0 ? void 0 : comment.height) == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
|
|
58802
58802
|
var value = (comment === null || comment === void 0 ? void 0 : comment.value) == null ? "" : comment.value;
|
|
58803
|
+
var preValue = (comment === null || comment === void 0 ? void 0 : comment.preValue) == null ? "" : comment.preValue;
|
|
58803
58804
|
if (top < 0) {
|
|
58804
58805
|
top = 2;
|
|
58805
58806
|
}
|
|
@@ -58815,7 +58816,8 @@ function getCommentBoxByRC(ctx, flowdata, r, c) {
|
|
|
58815
58816
|
height: height,
|
|
58816
58817
|
value: value,
|
|
58817
58818
|
size: size,
|
|
58818
|
-
autoFocus: false
|
|
58819
|
+
autoFocus: false,
|
|
58820
|
+
preValue: preValue
|
|
58819
58821
|
};
|
|
58820
58822
|
}
|
|
58821
58823
|
function setEditingComment(ctx, flowdata, r, c) {
|
|
@@ -58863,23 +58865,37 @@ function newComment(ctx, globalCache, r, c) {
|
|
|
58863
58865
|
cell = {};
|
|
58864
58866
|
flowdata[r][c] = cell;
|
|
58865
58867
|
}
|
|
58866
|
-
cell.ps
|
|
58867
|
-
|
|
58868
|
-
|
|
58869
|
-
|
|
58870
|
-
|
|
58871
|
-
|
|
58872
|
-
|
|
58873
|
-
|
|
58868
|
+
if (cell.ps) {
|
|
58869
|
+
var _ctx$hooks$getPsPreVa, _ctx$hooks4, _ctx$hooks4$getPsPreV;
|
|
58870
|
+
cell.ps = _objectSpread2(_objectSpread2({}, cell.ps), {}, {
|
|
58871
|
+
value: "",
|
|
58872
|
+
preValue: "".concat(cell.ps.preValue).concat((_ctx$hooks$getPsPreVa = (_ctx$hooks4 = ctx.hooks) === null || _ctx$hooks4 === void 0 ? void 0 : (_ctx$hooks4$getPsPreV = _ctx$hooks4.getPsPreValue) === null || _ctx$hooks4$getPsPreV === void 0 ? void 0 : _ctx$hooks4$getPsPreV.call(_ctx$hooks4)) !== null && _ctx$hooks$getPsPreVa !== void 0 ? _ctx$hooks$getPsPreVa : "")
|
|
58873
|
+
});
|
|
58874
|
+
} else {
|
|
58875
|
+
var _ctx$hooks$getPsPreVa2, _ctx$hooks5, _ctx$hooks5$getPsPreV;
|
|
58876
|
+
cell.ps = {
|
|
58877
|
+
left: null,
|
|
58878
|
+
top: null,
|
|
58879
|
+
width: null,
|
|
58880
|
+
height: null,
|
|
58881
|
+
preValue: (_ctx$hooks$getPsPreVa2 = (_ctx$hooks5 = ctx.hooks) === null || _ctx$hooks5 === void 0 ? void 0 : (_ctx$hooks5$getPsPreV = _ctx$hooks5.getPsPreValue) === null || _ctx$hooks5$getPsPreV === void 0 ? void 0 : _ctx$hooks5$getPsPreV.call(_ctx$hooks5)) !== null && _ctx$hooks$getPsPreVa2 !== void 0 ? _ctx$hooks$getPsPreVa2 : "",
|
|
58882
|
+
isShow: false,
|
|
58883
|
+
value: ""
|
|
58884
|
+
};
|
|
58885
|
+
}
|
|
58874
58886
|
ctx.editingCommentBox = _objectSpread2(_objectSpread2({}, getCommentBoxByRC(ctx, flowdata, r, c)), {}, {
|
|
58875
58887
|
autoFocus: true
|
|
58876
58888
|
});
|
|
58877
58889
|
if (ctx.hooks.afterInsertComment) {
|
|
58878
58890
|
setTimeout(function () {
|
|
58879
|
-
var _ctx$hooks$afterInser, _ctx$
|
|
58880
|
-
(_ctx$hooks$afterInser = (_ctx$
|
|
58891
|
+
var _ctx$hooks$afterInser, _ctx$hooks6;
|
|
58892
|
+
(_ctx$hooks$afterInser = (_ctx$hooks6 = ctx.hooks).afterInsertComment) === null || _ctx$hooks$afterInser === void 0 ? void 0 : _ctx$hooks$afterInser.call(_ctx$hooks6, r, c);
|
|
58881
58893
|
});
|
|
58882
58894
|
}
|
|
58895
|
+
if (ctx.hooks.afterUpdateComment) {
|
|
58896
|
+
var _ctx$hooks$afterUpdat2, _ctx$hooks7;
|
|
58897
|
+
(_ctx$hooks$afterUpdat2 = (_ctx$hooks7 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat2 === void 0 ? void 0 : _ctx$hooks$afterUpdat2.call(_ctx$hooks7, r, c, _objectSpread2({}, cell.ps));
|
|
58898
|
+
}
|
|
58883
58899
|
}
|
|
58884
58900
|
function editComment(ctx, globalCache, r, c) {
|
|
58885
58901
|
var _flowdata$r$c2;
|
|
@@ -58902,10 +58918,10 @@ function editComment(ctx, globalCache, r, c) {
|
|
|
58902
58918
|
}
|
|
58903
58919
|
}
|
|
58904
58920
|
function deleteComment(ctx, globalCache, r, c) {
|
|
58905
|
-
var _ctx$hooks$beforeDele, _ctx$
|
|
58921
|
+
var _ctx$hooks$beforeDele, _ctx$hooks8;
|
|
58906
58922
|
var allowEdit = isAllowEdit(ctx);
|
|
58907
58923
|
if (!allowEdit) return;
|
|
58908
|
-
if (((_ctx$hooks$beforeDele = (_ctx$
|
|
58924
|
+
if (((_ctx$hooks$beforeDele = (_ctx$hooks8 = ctx.hooks).beforeDeleteComment) === null || _ctx$hooks$beforeDele === void 0 ? void 0 : _ctx$hooks$beforeDele.call(_ctx$hooks8, r, c)) === false) {
|
|
58909
58925
|
return;
|
|
58910
58926
|
}
|
|
58911
58927
|
var flowdata = getFlowdata(ctx);
|
|
@@ -58915,13 +58931,13 @@ function deleteComment(ctx, globalCache, r, c) {
|
|
|
58915
58931
|
cell.ps = undefined;
|
|
58916
58932
|
if (ctx.hooks.afterDeleteComment) {
|
|
58917
58933
|
setTimeout(function () {
|
|
58918
|
-
var _ctx$hooks$afterDelet, _ctx$
|
|
58919
|
-
(_ctx$hooks$afterDelet = (_ctx$
|
|
58934
|
+
var _ctx$hooks$afterDelet, _ctx$hooks9;
|
|
58935
|
+
(_ctx$hooks$afterDelet = (_ctx$hooks9 = ctx.hooks).afterDeleteComment) === null || _ctx$hooks$afterDelet === void 0 ? void 0 : _ctx$hooks$afterDelet.call(_ctx$hooks9, r, c);
|
|
58920
58936
|
});
|
|
58921
58937
|
}
|
|
58922
58938
|
if (ctx.hooks.afterUpdateComment) {
|
|
58923
|
-
var _ctx$hooks$
|
|
58924
|
-
(_ctx$hooks$
|
|
58939
|
+
var _ctx$hooks$afterUpdat3, _ctx$hooks10;
|
|
58940
|
+
(_ctx$hooks$afterUpdat3 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat3 === void 0 ? void 0 : _ctx$hooks$afterUpdat3.call(_ctx$hooks10, r, c, null);
|
|
58925
58941
|
}
|
|
58926
58942
|
}
|
|
58927
58943
|
function showComments(ctx, commentShowCells) {
|
|
@@ -58951,8 +58967,8 @@ function showHideComment(ctx, globalCache, r, c) {
|
|
|
58951
58967
|
comment.isShow = true;
|
|
58952
58968
|
}
|
|
58953
58969
|
if (ctx.hooks.afterUpdateComment) {
|
|
58954
|
-
var _ctx$hooks$
|
|
58955
|
-
(_ctx$hooks$
|
|
58970
|
+
var _ctx$hooks$afterUpdat4, _ctx$hooks11;
|
|
58971
|
+
(_ctx$hooks$afterUpdat4 = (_ctx$hooks11 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat4 === void 0 ? void 0 : _ctx$hooks$afterUpdat4.call(_ctx$hooks11, r, c, _objectSpread2({}, comment));
|
|
58956
58972
|
}
|
|
58957
58973
|
}
|
|
58958
58974
|
function showHideAllComments(ctx) {
|
|
@@ -59051,6 +59067,7 @@ function overShowComment(ctx, e, scrollX, scrollY, container) {
|
|
|
59051
59067
|
var height = comment.height == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
|
|
59052
59068
|
var size = getArrowCanvasSize(left, top, toX, toY);
|
|
59053
59069
|
var value = comment.value == null ? "" : comment.value;
|
|
59070
|
+
var preValue = comment.preValue == null ? "" : comment.preValue;
|
|
59054
59071
|
ctx.hoveredCommentBox = {
|
|
59055
59072
|
r: r,
|
|
59056
59073
|
c: c,
|
|
@@ -59061,7 +59078,8 @@ function overShowComment(ctx, e, scrollX, scrollY, container) {
|
|
|
59061
59078
|
height: height,
|
|
59062
59079
|
size: size,
|
|
59063
59080
|
value: value,
|
|
59064
|
-
autoFocus: false
|
|
59081
|
+
autoFocus: false,
|
|
59082
|
+
preValue: preValue
|
|
59065
59083
|
};
|
|
59066
59084
|
}
|
|
59067
59085
|
function getCommentBoxPosition(commentId) {
|
|
@@ -59176,8 +59194,8 @@ function onCommentBoxResizeEnd(ctx, globalCache) {
|
|
|
59176
59194
|
cell.ps.height = height / ctx.zoomRatio;
|
|
59177
59195
|
setEditingComment(ctx, flowdata, r, c);
|
|
59178
59196
|
if (ctx.hooks.afterUpdateComment) {
|
|
59179
|
-
var _ctx$hooks$
|
|
59180
|
-
(_ctx$hooks$
|
|
59197
|
+
var _ctx$hooks$afterUpdat5, _ctx$hooks12;
|
|
59198
|
+
(_ctx$hooks$afterUpdat5 = (_ctx$hooks12 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks12, r, c, _objectSpread2({}, cell.ps));
|
|
59181
59199
|
}
|
|
59182
59200
|
}
|
|
59183
59201
|
}
|
|
@@ -59247,8 +59265,8 @@ function onCommentBoxMoveEnd(ctx, globalCache) {
|
|
|
59247
59265
|
cell.ps.top = top / ctx.zoomRatio;
|
|
59248
59266
|
setEditingComment(ctx, flowdata, r, c);
|
|
59249
59267
|
if (ctx.hooks.afterUpdateComment) {
|
|
59250
|
-
var _ctx$hooks$
|
|
59251
|
-
(_ctx$hooks$
|
|
59268
|
+
var _ctx$hooks$afterUpdat6, _ctx$hooks13;
|
|
59269
|
+
(_ctx$hooks$afterUpdat6 = (_ctx$hooks13 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat6 === void 0 ? void 0 : _ctx$hooks$afterUpdat6.call(_ctx$hooks13, r, c, _objectSpread2({}, cell.ps));
|
|
59252
59270
|
}
|
|
59253
59271
|
}
|
|
59254
59272
|
}
|
|
@@ -62594,10 +62612,31 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62594
62612
|
}
|
|
62595
62613
|
return map;
|
|
62596
62614
|
}
|
|
62615
|
+
}, {
|
|
62616
|
+
key: "cellPsRender",
|
|
62617
|
+
value: function cellPsRender(_ref2) {
|
|
62618
|
+
var renderCtx = _ref2.renderCtx,
|
|
62619
|
+
cell = _ref2.cell,
|
|
62620
|
+
endX = _ref2.endX,
|
|
62621
|
+
startY = _ref2.startY,
|
|
62622
|
+
offsetLeft = _ref2.offsetLeft,
|
|
62623
|
+
offsetTop = _ref2.offsetTop;
|
|
62624
|
+
if (cell === null || cell === void 0 ? void 0 : cell.ps) {
|
|
62625
|
+
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62626
|
+
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
62627
|
+
renderCtx.beginPath();
|
|
62628
|
+
renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
|
|
62629
|
+
renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
|
|
62630
|
+
renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
|
|
62631
|
+
renderCtx.fillStyle = "#FC6666";
|
|
62632
|
+
renderCtx.fill();
|
|
62633
|
+
renderCtx.closePath();
|
|
62634
|
+
}
|
|
62635
|
+
}
|
|
62597
62636
|
}, {
|
|
62598
62637
|
key: "nullCellRender",
|
|
62599
62638
|
value: function nullCellRender(r, c, startY, startX, endY, endX, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
|
|
62600
|
-
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4,
|
|
62639
|
+
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
|
|
62601
62640
|
var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
|
|
62602
62641
|
var checksCF = checkCF(r, c, cfCompute);
|
|
62603
62642
|
var flowdata = getFlowdata(this.sheetCtx);
|
|
@@ -62636,17 +62675,14 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62636
62675
|
}
|
|
62637
62676
|
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);
|
|
62638
62677
|
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);
|
|
62639
|
-
|
|
62640
|
-
|
|
62641
|
-
|
|
62642
|
-
|
|
62643
|
-
|
|
62644
|
-
|
|
62645
|
-
|
|
62646
|
-
|
|
62647
|
-
renderCtx.fill();
|
|
62648
|
-
renderCtx.closePath();
|
|
62649
|
-
}
|
|
62678
|
+
this.cellPsRender({
|
|
62679
|
+
renderCtx: renderCtx,
|
|
62680
|
+
cell: flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c],
|
|
62681
|
+
endX: endX,
|
|
62682
|
+
startY: startY,
|
|
62683
|
+
offsetLeft: offsetLeft,
|
|
62684
|
+
offsetTop: offsetTop
|
|
62685
|
+
});
|
|
62650
62686
|
var cellOverflow_colInObj = this.cellOverflow_colIn(cellOverflowMap, r, c, colStart, colEnd);
|
|
62651
62687
|
if (cellOverflow_colInObj.colLast && !_.isNil(cellOverflow_colInObj.rowIndex) && !_.isNil(cellOverflow_colInObj.colIndex) && !_.isNil(cellOverflow_colInObj.stc) && !_.isNil(cellOverflow_colInObj.edc)) {
|
|
62652
62688
|
this.cellOverflowRender(cellOverflow_colInObj.rowIndex, cellOverflow_colInObj.colIndex, cellOverflow_colInObj.stc, cellOverflow_colInObj.edc, renderCtx, scrollHeight, scrollWidth, offsetLeft, offsetTop, afCompute, cfCompute);
|
|
@@ -62696,10 +62732,10 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62696
62732
|
renderCtx.lineWidth = 1;
|
|
62697
62733
|
var rectWidth = endX - startX;
|
|
62698
62734
|
var rectHeight = endY - startY;
|
|
62699
|
-
var tsPosition = function tsPosition(
|
|
62700
|
-
var
|
|
62701
|
-
x =
|
|
62702
|
-
y =
|
|
62735
|
+
var tsPosition = function tsPosition(_ref3) {
|
|
62736
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
62737
|
+
x = _ref4[0],
|
|
62738
|
+
y = _ref4[1];
|
|
62703
62739
|
if (y > startY + rectHeight) {
|
|
62704
62740
|
var dis = y - (startY + rectHeight);
|
|
62705
62741
|
y = startY + rectHeight;
|
|
@@ -62793,24 +62829,21 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62793
62829
|
}
|
|
62794
62830
|
this.renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop);
|
|
62795
62831
|
this.renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop);
|
|
62796
|
-
|
|
62797
|
-
|
|
62798
|
-
|
|
62799
|
-
|
|
62800
|
-
|
|
62801
|
-
|
|
62802
|
-
|
|
62803
|
-
|
|
62804
|
-
renderCtx.fill();
|
|
62805
|
-
renderCtx.closePath();
|
|
62806
|
-
}
|
|
62832
|
+
this.cellPsRender({
|
|
62833
|
+
renderCtx: renderCtx,
|
|
62834
|
+
cell: cell,
|
|
62835
|
+
endX: endX,
|
|
62836
|
+
startY: startY,
|
|
62837
|
+
offsetLeft: offsetLeft,
|
|
62838
|
+
offsetTop: offsetTop
|
|
62839
|
+
});
|
|
62807
62840
|
if ((cell === null || cell === void 0 ? void 0 : cell.qp) === 1 && isRealNum$1(cell === null || cell === void 0 ? void 0 : cell.v)) {
|
|
62808
|
-
var
|
|
62809
|
-
var
|
|
62841
|
+
var ps_w = 6 * this.sheetCtx.zoomRatio;
|
|
62842
|
+
var ps_h = 6 * this.sheetCtx.zoomRatio;
|
|
62810
62843
|
renderCtx.beginPath();
|
|
62811
|
-
renderCtx.moveTo(startX + offsetLeft +
|
|
62844
|
+
renderCtx.moveTo(startX + offsetLeft + ps_w - 1, startY + offsetTop);
|
|
62812
62845
|
renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop);
|
|
62813
|
-
renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop +
|
|
62846
|
+
renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop + ps_h);
|
|
62814
62847
|
renderCtx.fillStyle = "#487f1e";
|
|
62815
62848
|
renderCtx.fill();
|
|
62816
62849
|
renderCtx.closePath();
|
|
@@ -63211,9 +63244,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
63211
63244
|
}
|
|
63212
63245
|
}, {
|
|
63213
63246
|
key: "drawFreezeLine",
|
|
63214
|
-
value: function drawFreezeLine(
|
|
63215
|
-
var horizontalTop =
|
|
63216
|
-
verticalLeft =
|
|
63247
|
+
value: function drawFreezeLine(_ref5) {
|
|
63248
|
+
var horizontalTop = _ref5.horizontalTop,
|
|
63249
|
+
verticalLeft = _ref5.verticalLeft;
|
|
63217
63250
|
}
|
|
63218
63251
|
}]);
|
|
63219
63252
|
}();
|
package/dist/index.js
CHANGED
|
@@ -58810,6 +58810,7 @@ function getCommentBoxByRC(ctx, flowdata, r, c) {
|
|
|
58810
58810
|
var width = (comment === null || comment === void 0 ? void 0 : comment.width) == null ? commentBoxProps.defaultWidth * ctx.zoomRatio : comment.width * ctx.zoomRatio;
|
|
58811
58811
|
var height = (comment === null || comment === void 0 ? void 0 : comment.height) == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
|
|
58812
58812
|
var value = (comment === null || comment === void 0 ? void 0 : comment.value) == null ? "" : comment.value;
|
|
58813
|
+
var preValue = (comment === null || comment === void 0 ? void 0 : comment.preValue) == null ? "" : comment.preValue;
|
|
58813
58814
|
if (top < 0) {
|
|
58814
58815
|
top = 2;
|
|
58815
58816
|
}
|
|
@@ -58825,7 +58826,8 @@ function getCommentBoxByRC(ctx, flowdata, r, c) {
|
|
|
58825
58826
|
height: height,
|
|
58826
58827
|
value: value,
|
|
58827
58828
|
size: size,
|
|
58828
|
-
autoFocus: false
|
|
58829
|
+
autoFocus: false,
|
|
58830
|
+
preValue: preValue
|
|
58829
58831
|
};
|
|
58830
58832
|
}
|
|
58831
58833
|
function setEditingComment(ctx, flowdata, r, c) {
|
|
@@ -58873,23 +58875,37 @@ function newComment(ctx, globalCache, r, c) {
|
|
|
58873
58875
|
cell = {};
|
|
58874
58876
|
flowdata[r][c] = cell;
|
|
58875
58877
|
}
|
|
58876
|
-
cell.ps
|
|
58877
|
-
|
|
58878
|
-
|
|
58879
|
-
|
|
58880
|
-
|
|
58881
|
-
|
|
58882
|
-
|
|
58883
|
-
|
|
58878
|
+
if (cell.ps) {
|
|
58879
|
+
var _ctx$hooks$getPsPreVa, _ctx$hooks4, _ctx$hooks4$getPsPreV;
|
|
58880
|
+
cell.ps = _objectSpread2(_objectSpread2({}, cell.ps), {}, {
|
|
58881
|
+
value: "",
|
|
58882
|
+
preValue: "".concat(cell.ps.preValue).concat((_ctx$hooks$getPsPreVa = (_ctx$hooks4 = ctx.hooks) === null || _ctx$hooks4 === void 0 ? void 0 : (_ctx$hooks4$getPsPreV = _ctx$hooks4.getPsPreValue) === null || _ctx$hooks4$getPsPreV === void 0 ? void 0 : _ctx$hooks4$getPsPreV.call(_ctx$hooks4)) !== null && _ctx$hooks$getPsPreVa !== void 0 ? _ctx$hooks$getPsPreVa : "")
|
|
58883
|
+
});
|
|
58884
|
+
} else {
|
|
58885
|
+
var _ctx$hooks$getPsPreVa2, _ctx$hooks5, _ctx$hooks5$getPsPreV;
|
|
58886
|
+
cell.ps = {
|
|
58887
|
+
left: null,
|
|
58888
|
+
top: null,
|
|
58889
|
+
width: null,
|
|
58890
|
+
height: null,
|
|
58891
|
+
preValue: (_ctx$hooks$getPsPreVa2 = (_ctx$hooks5 = ctx.hooks) === null || _ctx$hooks5 === void 0 ? void 0 : (_ctx$hooks5$getPsPreV = _ctx$hooks5.getPsPreValue) === null || _ctx$hooks5$getPsPreV === void 0 ? void 0 : _ctx$hooks5$getPsPreV.call(_ctx$hooks5)) !== null && _ctx$hooks$getPsPreVa2 !== void 0 ? _ctx$hooks$getPsPreVa2 : "",
|
|
58892
|
+
isShow: false,
|
|
58893
|
+
value: ""
|
|
58894
|
+
};
|
|
58895
|
+
}
|
|
58884
58896
|
ctx.editingCommentBox = _objectSpread2(_objectSpread2({}, getCommentBoxByRC(ctx, flowdata, r, c)), {}, {
|
|
58885
58897
|
autoFocus: true
|
|
58886
58898
|
});
|
|
58887
58899
|
if (ctx.hooks.afterInsertComment) {
|
|
58888
58900
|
setTimeout(function () {
|
|
58889
|
-
var _ctx$hooks$afterInser, _ctx$
|
|
58890
|
-
(_ctx$hooks$afterInser = (_ctx$
|
|
58901
|
+
var _ctx$hooks$afterInser, _ctx$hooks6;
|
|
58902
|
+
(_ctx$hooks$afterInser = (_ctx$hooks6 = ctx.hooks).afterInsertComment) === null || _ctx$hooks$afterInser === void 0 ? void 0 : _ctx$hooks$afterInser.call(_ctx$hooks6, r, c);
|
|
58891
58903
|
});
|
|
58892
58904
|
}
|
|
58905
|
+
if (ctx.hooks.afterUpdateComment) {
|
|
58906
|
+
var _ctx$hooks$afterUpdat2, _ctx$hooks7;
|
|
58907
|
+
(_ctx$hooks$afterUpdat2 = (_ctx$hooks7 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat2 === void 0 ? void 0 : _ctx$hooks$afterUpdat2.call(_ctx$hooks7, r, c, _objectSpread2({}, cell.ps));
|
|
58908
|
+
}
|
|
58893
58909
|
}
|
|
58894
58910
|
function editComment(ctx, globalCache, r, c) {
|
|
58895
58911
|
var _flowdata$r$c2;
|
|
@@ -58912,10 +58928,10 @@ function editComment(ctx, globalCache, r, c) {
|
|
|
58912
58928
|
}
|
|
58913
58929
|
}
|
|
58914
58930
|
function deleteComment(ctx, globalCache, r, c) {
|
|
58915
|
-
var _ctx$hooks$beforeDele, _ctx$
|
|
58931
|
+
var _ctx$hooks$beforeDele, _ctx$hooks8;
|
|
58916
58932
|
var allowEdit = isAllowEdit(ctx);
|
|
58917
58933
|
if (!allowEdit) return;
|
|
58918
|
-
if (((_ctx$hooks$beforeDele = (_ctx$
|
|
58934
|
+
if (((_ctx$hooks$beforeDele = (_ctx$hooks8 = ctx.hooks).beforeDeleteComment) === null || _ctx$hooks$beforeDele === void 0 ? void 0 : _ctx$hooks$beforeDele.call(_ctx$hooks8, r, c)) === false) {
|
|
58919
58935
|
return;
|
|
58920
58936
|
}
|
|
58921
58937
|
var flowdata = getFlowdata(ctx);
|
|
@@ -58925,13 +58941,13 @@ function deleteComment(ctx, globalCache, r, c) {
|
|
|
58925
58941
|
cell.ps = undefined;
|
|
58926
58942
|
if (ctx.hooks.afterDeleteComment) {
|
|
58927
58943
|
setTimeout(function () {
|
|
58928
|
-
var _ctx$hooks$afterDelet, _ctx$
|
|
58929
|
-
(_ctx$hooks$afterDelet = (_ctx$
|
|
58944
|
+
var _ctx$hooks$afterDelet, _ctx$hooks9;
|
|
58945
|
+
(_ctx$hooks$afterDelet = (_ctx$hooks9 = ctx.hooks).afterDeleteComment) === null || _ctx$hooks$afterDelet === void 0 ? void 0 : _ctx$hooks$afterDelet.call(_ctx$hooks9, r, c);
|
|
58930
58946
|
});
|
|
58931
58947
|
}
|
|
58932
58948
|
if (ctx.hooks.afterUpdateComment) {
|
|
58933
|
-
var _ctx$hooks$
|
|
58934
|
-
(_ctx$hooks$
|
|
58949
|
+
var _ctx$hooks$afterUpdat3, _ctx$hooks10;
|
|
58950
|
+
(_ctx$hooks$afterUpdat3 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat3 === void 0 ? void 0 : _ctx$hooks$afterUpdat3.call(_ctx$hooks10, r, c, null);
|
|
58935
58951
|
}
|
|
58936
58952
|
}
|
|
58937
58953
|
function showComments(ctx, commentShowCells) {
|
|
@@ -58961,8 +58977,8 @@ function showHideComment(ctx, globalCache, r, c) {
|
|
|
58961
58977
|
comment.isShow = true;
|
|
58962
58978
|
}
|
|
58963
58979
|
if (ctx.hooks.afterUpdateComment) {
|
|
58964
|
-
var _ctx$hooks$
|
|
58965
|
-
(_ctx$hooks$
|
|
58980
|
+
var _ctx$hooks$afterUpdat4, _ctx$hooks11;
|
|
58981
|
+
(_ctx$hooks$afterUpdat4 = (_ctx$hooks11 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat4 === void 0 ? void 0 : _ctx$hooks$afterUpdat4.call(_ctx$hooks11, r, c, _objectSpread2({}, comment));
|
|
58966
58982
|
}
|
|
58967
58983
|
}
|
|
58968
58984
|
function showHideAllComments(ctx) {
|
|
@@ -59061,6 +59077,7 @@ function overShowComment(ctx, e, scrollX, scrollY, container) {
|
|
|
59061
59077
|
var height = comment.height == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
|
|
59062
59078
|
var size = getArrowCanvasSize(left, top, toX, toY);
|
|
59063
59079
|
var value = comment.value == null ? "" : comment.value;
|
|
59080
|
+
var preValue = comment.preValue == null ? "" : comment.preValue;
|
|
59064
59081
|
ctx.hoveredCommentBox = {
|
|
59065
59082
|
r: r,
|
|
59066
59083
|
c: c,
|
|
@@ -59071,7 +59088,8 @@ function overShowComment(ctx, e, scrollX, scrollY, container) {
|
|
|
59071
59088
|
height: height,
|
|
59072
59089
|
size: size,
|
|
59073
59090
|
value: value,
|
|
59074
|
-
autoFocus: false
|
|
59091
|
+
autoFocus: false,
|
|
59092
|
+
preValue: preValue
|
|
59075
59093
|
};
|
|
59076
59094
|
}
|
|
59077
59095
|
function getCommentBoxPosition(commentId) {
|
|
@@ -59186,8 +59204,8 @@ function onCommentBoxResizeEnd(ctx, globalCache) {
|
|
|
59186
59204
|
cell.ps.height = height / ctx.zoomRatio;
|
|
59187
59205
|
setEditingComment(ctx, flowdata, r, c);
|
|
59188
59206
|
if (ctx.hooks.afterUpdateComment) {
|
|
59189
|
-
var _ctx$hooks$
|
|
59190
|
-
(_ctx$hooks$
|
|
59207
|
+
var _ctx$hooks$afterUpdat5, _ctx$hooks12;
|
|
59208
|
+
(_ctx$hooks$afterUpdat5 = (_ctx$hooks12 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks12, r, c, _objectSpread2({}, cell.ps));
|
|
59191
59209
|
}
|
|
59192
59210
|
}
|
|
59193
59211
|
}
|
|
@@ -59257,8 +59275,8 @@ function onCommentBoxMoveEnd(ctx, globalCache) {
|
|
|
59257
59275
|
cell.ps.top = top / ctx.zoomRatio;
|
|
59258
59276
|
setEditingComment(ctx, flowdata, r, c);
|
|
59259
59277
|
if (ctx.hooks.afterUpdateComment) {
|
|
59260
|
-
var _ctx$hooks$
|
|
59261
|
-
(_ctx$hooks$
|
|
59278
|
+
var _ctx$hooks$afterUpdat6, _ctx$hooks13;
|
|
59279
|
+
(_ctx$hooks$afterUpdat6 = (_ctx$hooks13 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat6 === void 0 ? void 0 : _ctx$hooks$afterUpdat6.call(_ctx$hooks13, r, c, _objectSpread2({}, cell.ps));
|
|
59262
59280
|
}
|
|
59263
59281
|
}
|
|
59264
59282
|
}
|
|
@@ -62604,10 +62622,31 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62604
62622
|
}
|
|
62605
62623
|
return map;
|
|
62606
62624
|
}
|
|
62625
|
+
}, {
|
|
62626
|
+
key: "cellPsRender",
|
|
62627
|
+
value: function cellPsRender(_ref2) {
|
|
62628
|
+
var renderCtx = _ref2.renderCtx,
|
|
62629
|
+
cell = _ref2.cell,
|
|
62630
|
+
endX = _ref2.endX,
|
|
62631
|
+
startY = _ref2.startY,
|
|
62632
|
+
offsetLeft = _ref2.offsetLeft,
|
|
62633
|
+
offsetTop = _ref2.offsetTop;
|
|
62634
|
+
if (cell === null || cell === void 0 ? void 0 : cell.ps) {
|
|
62635
|
+
var ps_w = 8 * this.sheetCtx.zoomRatio;
|
|
62636
|
+
var ps_h = 8 * this.sheetCtx.zoomRatio;
|
|
62637
|
+
renderCtx.beginPath();
|
|
62638
|
+
renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
|
|
62639
|
+
renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
|
|
62640
|
+
renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
|
|
62641
|
+
renderCtx.fillStyle = "#FC6666";
|
|
62642
|
+
renderCtx.fill();
|
|
62643
|
+
renderCtx.closePath();
|
|
62644
|
+
}
|
|
62645
|
+
}
|
|
62607
62646
|
}, {
|
|
62608
62647
|
key: "nullCellRender",
|
|
62609
62648
|
value: function nullCellRender(r, c, startY, startX, endY, endX, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05) {
|
|
62610
|
-
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4,
|
|
62649
|
+
var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
|
|
62611
62650
|
var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
|
|
62612
62651
|
var checksCF = checkCF(r, c, cfCompute);
|
|
62613
62652
|
var flowdata = getFlowdata(this.sheetCtx);
|
|
@@ -62646,17 +62685,14 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62646
62685
|
}
|
|
62647
62686
|
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);
|
|
62648
62687
|
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);
|
|
62649
|
-
|
|
62650
|
-
|
|
62651
|
-
|
|
62652
|
-
|
|
62653
|
-
|
|
62654
|
-
|
|
62655
|
-
|
|
62656
|
-
|
|
62657
|
-
renderCtx.fill();
|
|
62658
|
-
renderCtx.closePath();
|
|
62659
|
-
}
|
|
62688
|
+
this.cellPsRender({
|
|
62689
|
+
renderCtx: renderCtx,
|
|
62690
|
+
cell: flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c],
|
|
62691
|
+
endX: endX,
|
|
62692
|
+
startY: startY,
|
|
62693
|
+
offsetLeft: offsetLeft,
|
|
62694
|
+
offsetTop: offsetTop
|
|
62695
|
+
});
|
|
62660
62696
|
var cellOverflow_colInObj = this.cellOverflow_colIn(cellOverflowMap, r, c, colStart, colEnd);
|
|
62661
62697
|
if (cellOverflow_colInObj.colLast && !___default['default'].isNil(cellOverflow_colInObj.rowIndex) && !___default['default'].isNil(cellOverflow_colInObj.colIndex) && !___default['default'].isNil(cellOverflow_colInObj.stc) && !___default['default'].isNil(cellOverflow_colInObj.edc)) {
|
|
62662
62698
|
this.cellOverflowRender(cellOverflow_colInObj.rowIndex, cellOverflow_colInObj.colIndex, cellOverflow_colInObj.stc, cellOverflow_colInObj.edc, renderCtx, scrollHeight, scrollWidth, offsetLeft, offsetTop, afCompute, cfCompute);
|
|
@@ -62706,10 +62742,10 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62706
62742
|
renderCtx.lineWidth = 1;
|
|
62707
62743
|
var rectWidth = endX - startX;
|
|
62708
62744
|
var rectHeight = endY - startY;
|
|
62709
|
-
var tsPosition = function tsPosition(
|
|
62710
|
-
var
|
|
62711
|
-
x =
|
|
62712
|
-
y =
|
|
62745
|
+
var tsPosition = function tsPosition(_ref3) {
|
|
62746
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
62747
|
+
x = _ref4[0],
|
|
62748
|
+
y = _ref4[1];
|
|
62713
62749
|
if (y > startY + rectHeight) {
|
|
62714
62750
|
var dis = y - (startY + rectHeight);
|
|
62715
62751
|
y = startY + rectHeight;
|
|
@@ -62803,24 +62839,21 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
62803
62839
|
}
|
|
62804
62840
|
this.renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop);
|
|
62805
62841
|
this.renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop);
|
|
62806
|
-
|
|
62807
|
-
|
|
62808
|
-
|
|
62809
|
-
|
|
62810
|
-
|
|
62811
|
-
|
|
62812
|
-
|
|
62813
|
-
|
|
62814
|
-
renderCtx.fill();
|
|
62815
|
-
renderCtx.closePath();
|
|
62816
|
-
}
|
|
62842
|
+
this.cellPsRender({
|
|
62843
|
+
renderCtx: renderCtx,
|
|
62844
|
+
cell: cell,
|
|
62845
|
+
endX: endX,
|
|
62846
|
+
startY: startY,
|
|
62847
|
+
offsetLeft: offsetLeft,
|
|
62848
|
+
offsetTop: offsetTop
|
|
62849
|
+
});
|
|
62817
62850
|
if ((cell === null || cell === void 0 ? void 0 : cell.qp) === 1 && isRealNum$1(cell === null || cell === void 0 ? void 0 : cell.v)) {
|
|
62818
|
-
var
|
|
62819
|
-
var
|
|
62851
|
+
var ps_w = 6 * this.sheetCtx.zoomRatio;
|
|
62852
|
+
var ps_h = 6 * this.sheetCtx.zoomRatio;
|
|
62820
62853
|
renderCtx.beginPath();
|
|
62821
|
-
renderCtx.moveTo(startX + offsetLeft +
|
|
62854
|
+
renderCtx.moveTo(startX + offsetLeft + ps_w - 1, startY + offsetTop);
|
|
62822
62855
|
renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop);
|
|
62823
|
-
renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop +
|
|
62856
|
+
renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop + ps_h);
|
|
62824
62857
|
renderCtx.fillStyle = "#487f1e";
|
|
62825
62858
|
renderCtx.fill();
|
|
62826
62859
|
renderCtx.closePath();
|
|
@@ -63221,9 +63254,9 @@ var Canvas = /*#__PURE__*/function () {
|
|
|
63221
63254
|
}
|
|
63222
63255
|
}, {
|
|
63223
63256
|
key: "drawFreezeLine",
|
|
63224
|
-
value: function drawFreezeLine(
|
|
63225
|
-
var horizontalTop =
|
|
63226
|
-
verticalLeft =
|
|
63257
|
+
value: function drawFreezeLine(_ref5) {
|
|
63258
|
+
var horizontalTop = _ref5.horizontalTop,
|
|
63259
|
+
verticalLeft = _ref5.verticalLeft;
|
|
63227
63260
|
}
|
|
63228
63261
|
}]);
|
|
63229
63262
|
}();
|
|
@@ -60,6 +60,7 @@ export declare function getCommentBoxByRC(ctx: Context, flowdata: CellMatrix, r:
|
|
|
60
60
|
toY: number;
|
|
61
61
|
};
|
|
62
62
|
autoFocus: boolean;
|
|
63
|
+
preValue: string;
|
|
63
64
|
};
|
|
64
65
|
export declare function setEditingComment(ctx: Context, flowdata: CellMatrix, r: number, c: number): void;
|
|
65
66
|
export declare function removeEditingComment(ctx: Context, globalCache: GlobalCache): void;
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Sheet, Selection, CellMatrix, Cell } from "./types";
|
|
3
3
|
export type Hooks = {
|
|
4
|
+
getPsPreValue?: () => string;
|
|
4
5
|
showMenuBefore?: (ctx: any, selection: any) => boolean;
|
|
5
6
|
beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
|
|
6
7
|
afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
|
package/dist/types.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export type Cell = {
|
|
|
52
52
|
height: number | null;
|
|
53
53
|
value: string;
|
|
54
54
|
isShow: boolean;
|
|
55
|
+
preValue?: string;
|
|
55
56
|
};
|
|
56
57
|
hl?: {
|
|
57
58
|
r: number;
|
|
@@ -175,6 +176,7 @@ export type CommentBox = {
|
|
|
175
176
|
rc: string;
|
|
176
177
|
autoFocus: boolean;
|
|
177
178
|
value: string;
|
|
179
|
+
preValue: string;
|
|
178
180
|
size: {
|
|
179
181
|
fromX: number;
|
|
180
182
|
fromY: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leankylin-sheet/core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.16",
|
|
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.1.
|
|
16
|
+
"@leankylin-sheet/formula-parser": "^3.1.16",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"immer": "^9.0.12",
|
|
19
19
|
"lodash": "^4.17.21",
|