@leankylin-sheet/core 3.1.15 → 3.1.17

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 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
@@ -58863,14 +58863,20 @@ function newComment(ctx, globalCache, r, c) {
58863
58863
  cell = {};
58864
58864
  flowdata[r][c] = cell;
58865
58865
  }
58866
- cell.ps = {
58867
- left: null,
58868
- top: null,
58869
- width: null,
58870
- height: null,
58871
- value: "",
58872
- isShow: false
58873
- };
58866
+ if (cell.ps) {
58867
+ cell.ps = _objectSpread2(_objectSpread2({}, cell.ps), {}, {
58868
+ value: ""
58869
+ });
58870
+ } else {
58871
+ cell.ps = {
58872
+ left: null,
58873
+ top: null,
58874
+ width: null,
58875
+ height: null,
58876
+ isShow: false,
58877
+ value: ""
58878
+ };
58879
+ }
58874
58880
  ctx.editingCommentBox = _objectSpread2(_objectSpread2({}, getCommentBoxByRC(ctx, flowdata, r, c)), {}, {
58875
58881
  autoFocus: true
58876
58882
  });
@@ -58880,11 +58886,13 @@ function newComment(ctx, globalCache, r, c) {
58880
58886
  (_ctx$hooks$afterInser = (_ctx$hooks4 = ctx.hooks).afterInsertComment) === null || _ctx$hooks$afterInser === void 0 ? void 0 : _ctx$hooks$afterInser.call(_ctx$hooks4, r, c);
58881
58887
  });
58882
58888
  }
58889
+ if (ctx.hooks.afterUpdateComment) {
58890
+ var _ctx$hooks$afterUpdat2, _ctx$hooks5;
58891
+ (_ctx$hooks$afterUpdat2 = (_ctx$hooks5 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat2 === void 0 ? void 0 : _ctx$hooks$afterUpdat2.call(_ctx$hooks5, r, c, _objectSpread2({}, cell.ps));
58892
+ }
58883
58893
  }
58884
58894
  function editComment(ctx, globalCache, r, c) {
58885
58895
  var _flowdata$r$c2;
58886
- var allowEdit = isAllowEdit(ctx);
58887
- if (!allowEdit) return;
58888
58896
  var flowdata = getFlowdata(ctx);
58889
58897
  removeEditingComment(ctx, globalCache);
58890
58898
  var comment = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r$c2 = flowdata[r][c]) === null || _flowdata$r$c2 === void 0 ? void 0 : _flowdata$r$c2.ps;
@@ -58902,10 +58910,8 @@ function editComment(ctx, globalCache, r, c) {
58902
58910
  }
58903
58911
  }
58904
58912
  function deleteComment(ctx, globalCache, r, c) {
58905
- var _ctx$hooks$beforeDele, _ctx$hooks5;
58906
- var allowEdit = isAllowEdit(ctx);
58907
- if (!allowEdit) return;
58908
- if (((_ctx$hooks$beforeDele = (_ctx$hooks5 = ctx.hooks).beforeDeleteComment) === null || _ctx$hooks$beforeDele === void 0 ? void 0 : _ctx$hooks$beforeDele.call(_ctx$hooks5, r, c)) === false) {
58913
+ var _ctx$hooks$beforeDele, _ctx$hooks6;
58914
+ if (((_ctx$hooks$beforeDele = (_ctx$hooks6 = ctx.hooks).beforeDeleteComment) === null || _ctx$hooks$beforeDele === void 0 ? void 0 : _ctx$hooks$beforeDele.call(_ctx$hooks6, r, c)) === false) {
58909
58915
  return;
58910
58916
  }
58911
58917
  var flowdata = getFlowdata(ctx);
@@ -58915,13 +58921,13 @@ function deleteComment(ctx, globalCache, r, c) {
58915
58921
  cell.ps = undefined;
58916
58922
  if (ctx.hooks.afterDeleteComment) {
58917
58923
  setTimeout(function () {
58918
- var _ctx$hooks$afterDelet, _ctx$hooks6;
58919
- (_ctx$hooks$afterDelet = (_ctx$hooks6 = ctx.hooks).afterDeleteComment) === null || _ctx$hooks$afterDelet === void 0 ? void 0 : _ctx$hooks$afterDelet.call(_ctx$hooks6, r, c);
58924
+ var _ctx$hooks$afterDelet, _ctx$hooks7;
58925
+ (_ctx$hooks$afterDelet = (_ctx$hooks7 = ctx.hooks).afterDeleteComment) === null || _ctx$hooks$afterDelet === void 0 ? void 0 : _ctx$hooks$afterDelet.call(_ctx$hooks7, r, c);
58920
58926
  });
58921
58927
  }
58922
58928
  if (ctx.hooks.afterUpdateComment) {
58923
- var _ctx$hooks$afterUpdat2, _ctx$hooks7;
58924
- (_ctx$hooks$afterUpdat2 = (_ctx$hooks7 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat2 === void 0 ? void 0 : _ctx$hooks$afterUpdat2.call(_ctx$hooks7, r, c, null);
58929
+ var _ctx$hooks$afterUpdat3, _ctx$hooks8;
58930
+ (_ctx$hooks$afterUpdat3 = (_ctx$hooks8 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat3 === void 0 ? void 0 : _ctx$hooks$afterUpdat3.call(_ctx$hooks8, r, c, null);
58925
58931
  }
58926
58932
  }
58927
58933
  function showComments(ctx, commentShowCells) {
@@ -58951,8 +58957,8 @@ function showHideComment(ctx, globalCache, r, c) {
58951
58957
  comment.isShow = true;
58952
58958
  }
58953
58959
  if (ctx.hooks.afterUpdateComment) {
58954
- var _ctx$hooks$afterUpdat3, _ctx$hooks8;
58955
- (_ctx$hooks$afterUpdat3 = (_ctx$hooks8 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat3 === void 0 ? void 0 : _ctx$hooks$afterUpdat3.call(_ctx$hooks8, r, c, _objectSpread2({}, comment));
58960
+ var _ctx$hooks$afterUpdat4, _ctx$hooks9;
58961
+ (_ctx$hooks$afterUpdat4 = (_ctx$hooks9 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat4 === void 0 ? void 0 : _ctx$hooks$afterUpdat4.call(_ctx$hooks9, r, c, _objectSpread2({}, comment));
58956
58962
  }
58957
58963
  }
58958
58964
  function showHideAllComments(ctx) {
@@ -59176,8 +59182,8 @@ function onCommentBoxResizeEnd(ctx, globalCache) {
59176
59182
  cell.ps.height = height / ctx.zoomRatio;
59177
59183
  setEditingComment(ctx, flowdata, r, c);
59178
59184
  if (ctx.hooks.afterUpdateComment) {
59179
- var _ctx$hooks$afterUpdat4, _ctx$hooks9;
59180
- (_ctx$hooks$afterUpdat4 = (_ctx$hooks9 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat4 === void 0 ? void 0 : _ctx$hooks$afterUpdat4.call(_ctx$hooks9, r, c, _objectSpread2({}, cell.ps));
59185
+ var _ctx$hooks$afterUpdat5, _ctx$hooks10;
59186
+ (_ctx$hooks$afterUpdat5 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks10, r, c, _objectSpread2({}, cell.ps));
59181
59187
  }
59182
59188
  }
59183
59189
  }
@@ -59247,8 +59253,8 @@ function onCommentBoxMoveEnd(ctx, globalCache) {
59247
59253
  cell.ps.top = top / ctx.zoomRatio;
59248
59254
  setEditingComment(ctx, flowdata, r, c);
59249
59255
  if (ctx.hooks.afterUpdateComment) {
59250
- var _ctx$hooks$afterUpdat5, _ctx$hooks10;
59251
- (_ctx$hooks$afterUpdat5 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks10, r, c, _objectSpread2({}, cell.ps));
59256
+ var _ctx$hooks$afterUpdat6, _ctx$hooks11;
59257
+ (_ctx$hooks$afterUpdat6 = (_ctx$hooks11 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat6 === void 0 ? void 0 : _ctx$hooks$afterUpdat6.call(_ctx$hooks11, r, c, _objectSpread2({}, cell.ps));
59252
59258
  }
59253
59259
  }
59254
59260
  }
@@ -62594,10 +62600,31 @@ var Canvas = /*#__PURE__*/function () {
62594
62600
  }
62595
62601
  return map;
62596
62602
  }
62603
+ }, {
62604
+ key: "cellPsRender",
62605
+ value: function cellPsRender(_ref2) {
62606
+ var renderCtx = _ref2.renderCtx,
62607
+ cell = _ref2.cell,
62608
+ endX = _ref2.endX,
62609
+ startY = _ref2.startY,
62610
+ offsetLeft = _ref2.offsetLeft,
62611
+ offsetTop = _ref2.offsetTop;
62612
+ if (cell === null || cell === void 0 ? void 0 : cell.ps) {
62613
+ var ps_w = 8 * this.sheetCtx.zoomRatio;
62614
+ var ps_h = 8 * this.sheetCtx.zoomRatio;
62615
+ renderCtx.beginPath();
62616
+ renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
62617
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
62618
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
62619
+ renderCtx.fillStyle = "#FC6666";
62620
+ renderCtx.fill();
62621
+ renderCtx.closePath();
62622
+ }
62623
+ }
62597
62624
  }, {
62598
62625
  key: "nullCellRender",
62599
62626
  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, _flowdata$r4$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62627
+ var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62601
62628
  var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
62602
62629
  var checksCF = checkCF(r, c, cfCompute);
62603
62630
  var flowdata = getFlowdata(this.sheetCtx);
@@ -62636,17 +62663,14 @@ var Canvas = /*#__PURE__*/function () {
62636
62663
  }
62637
62664
  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
62665
  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
- 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) {
62640
- var ps_w = 8 * this.sheetCtx.zoomRatio;
62641
- var ps_h = 8 * this.sheetCtx.zoomRatio;
62642
- renderCtx.beginPath();
62643
- renderCtx.moveTo(endX + offsetLeft - 1 - ps_w, startY + offsetTop);
62644
- renderCtx.lineTo(endX + offsetLeft - 1, startY + offsetTop);
62645
- renderCtx.lineTo(endX + offsetLeft - 1, startY + offsetTop + ps_h);
62646
- renderCtx.fillStyle = "#FC6666";
62647
- renderCtx.fill();
62648
- renderCtx.closePath();
62649
- }
62666
+ this.cellPsRender({
62667
+ renderCtx: renderCtx,
62668
+ cell: flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c],
62669
+ endX: endX,
62670
+ startY: startY,
62671
+ offsetLeft: offsetLeft,
62672
+ offsetTop: offsetTop
62673
+ });
62650
62674
  var cellOverflow_colInObj = this.cellOverflow_colIn(cellOverflowMap, r, c, colStart, colEnd);
62651
62675
  if (cellOverflow_colInObj.colLast && !_.isNil(cellOverflow_colInObj.rowIndex) && !_.isNil(cellOverflow_colInObj.colIndex) && !_.isNil(cellOverflow_colInObj.stc) && !_.isNil(cellOverflow_colInObj.edc)) {
62652
62676
  this.cellOverflowRender(cellOverflow_colInObj.rowIndex, cellOverflow_colInObj.colIndex, cellOverflow_colInObj.stc, cellOverflow_colInObj.edc, renderCtx, scrollHeight, scrollWidth, offsetLeft, offsetTop, afCompute, cfCompute);
@@ -62696,10 +62720,10 @@ var Canvas = /*#__PURE__*/function () {
62696
62720
  renderCtx.lineWidth = 1;
62697
62721
  var rectWidth = endX - startX;
62698
62722
  var rectHeight = endY - startY;
62699
- var tsPosition = function tsPosition(_ref2) {
62700
- var _ref3 = _slicedToArray(_ref2, 2),
62701
- x = _ref3[0],
62702
- y = _ref3[1];
62723
+ var tsPosition = function tsPosition(_ref3) {
62724
+ var _ref4 = _slicedToArray(_ref3, 2),
62725
+ x = _ref4[0],
62726
+ y = _ref4[1];
62703
62727
  if (y > startY + rectHeight) {
62704
62728
  var dis = y - (startY + rectHeight);
62705
62729
  y = startY + rectHeight;
@@ -62793,24 +62817,21 @@ var Canvas = /*#__PURE__*/function () {
62793
62817
  }
62794
62818
  this.renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop);
62795
62819
  this.renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop);
62796
- if (cell === null || cell === void 0 ? void 0 : cell.ps) {
62797
- var ps_w = 8 * this.sheetCtx.zoomRatio;
62798
- var ps_h = 8 * this.sheetCtx.zoomRatio;
62799
- renderCtx.beginPath();
62800
- renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
62801
- renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
62802
- renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
62803
- renderCtx.fillStyle = "#FC6666";
62804
- renderCtx.fill();
62805
- renderCtx.closePath();
62806
- }
62820
+ this.cellPsRender({
62821
+ renderCtx: renderCtx,
62822
+ cell: cell,
62823
+ endX: endX,
62824
+ startY: startY,
62825
+ offsetLeft: offsetLeft,
62826
+ offsetTop: offsetTop
62827
+ });
62807
62828
  if ((cell === null || cell === void 0 ? void 0 : cell.qp) === 1 && isRealNum$1(cell === null || cell === void 0 ? void 0 : cell.v)) {
62808
- var _ps_w = 6 * this.sheetCtx.zoomRatio;
62809
- var _ps_h = 6 * this.sheetCtx.zoomRatio;
62829
+ var ps_w = 6 * this.sheetCtx.zoomRatio;
62830
+ var ps_h = 6 * this.sheetCtx.zoomRatio;
62810
62831
  renderCtx.beginPath();
62811
- renderCtx.moveTo(startX + offsetLeft + _ps_w - 1, startY + offsetTop);
62832
+ renderCtx.moveTo(startX + offsetLeft + ps_w - 1, startY + offsetTop);
62812
62833
  renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop);
62813
- renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop + _ps_h);
62834
+ renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop + ps_h);
62814
62835
  renderCtx.fillStyle = "#487f1e";
62815
62836
  renderCtx.fill();
62816
62837
  renderCtx.closePath();
@@ -63211,9 +63232,9 @@ var Canvas = /*#__PURE__*/function () {
63211
63232
  }
63212
63233
  }, {
63213
63234
  key: "drawFreezeLine",
63214
- value: function drawFreezeLine(_ref4) {
63215
- var horizontalTop = _ref4.horizontalTop,
63216
- verticalLeft = _ref4.verticalLeft;
63235
+ value: function drawFreezeLine(_ref5) {
63236
+ var horizontalTop = _ref5.horizontalTop,
63237
+ verticalLeft = _ref5.verticalLeft;
63217
63238
  }
63218
63239
  }]);
63219
63240
  }();
package/dist/index.js CHANGED
@@ -58873,14 +58873,20 @@ function newComment(ctx, globalCache, r, c) {
58873
58873
  cell = {};
58874
58874
  flowdata[r][c] = cell;
58875
58875
  }
58876
- cell.ps = {
58877
- left: null,
58878
- top: null,
58879
- width: null,
58880
- height: null,
58881
- value: "",
58882
- isShow: false
58883
- };
58876
+ if (cell.ps) {
58877
+ cell.ps = _objectSpread2(_objectSpread2({}, cell.ps), {}, {
58878
+ value: ""
58879
+ });
58880
+ } else {
58881
+ cell.ps = {
58882
+ left: null,
58883
+ top: null,
58884
+ width: null,
58885
+ height: null,
58886
+ isShow: false,
58887
+ value: ""
58888
+ };
58889
+ }
58884
58890
  ctx.editingCommentBox = _objectSpread2(_objectSpread2({}, getCommentBoxByRC(ctx, flowdata, r, c)), {}, {
58885
58891
  autoFocus: true
58886
58892
  });
@@ -58890,11 +58896,13 @@ function newComment(ctx, globalCache, r, c) {
58890
58896
  (_ctx$hooks$afterInser = (_ctx$hooks4 = ctx.hooks).afterInsertComment) === null || _ctx$hooks$afterInser === void 0 ? void 0 : _ctx$hooks$afterInser.call(_ctx$hooks4, r, c);
58891
58897
  });
58892
58898
  }
58899
+ if (ctx.hooks.afterUpdateComment) {
58900
+ var _ctx$hooks$afterUpdat2, _ctx$hooks5;
58901
+ (_ctx$hooks$afterUpdat2 = (_ctx$hooks5 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat2 === void 0 ? void 0 : _ctx$hooks$afterUpdat2.call(_ctx$hooks5, r, c, _objectSpread2({}, cell.ps));
58902
+ }
58893
58903
  }
58894
58904
  function editComment(ctx, globalCache, r, c) {
58895
58905
  var _flowdata$r$c2;
58896
- var allowEdit = isAllowEdit(ctx);
58897
- if (!allowEdit) return;
58898
58906
  var flowdata = getFlowdata(ctx);
58899
58907
  removeEditingComment(ctx, globalCache);
58900
58908
  var comment = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r$c2 = flowdata[r][c]) === null || _flowdata$r$c2 === void 0 ? void 0 : _flowdata$r$c2.ps;
@@ -58912,10 +58920,8 @@ function editComment(ctx, globalCache, r, c) {
58912
58920
  }
58913
58921
  }
58914
58922
  function deleteComment(ctx, globalCache, r, c) {
58915
- var _ctx$hooks$beforeDele, _ctx$hooks5;
58916
- var allowEdit = isAllowEdit(ctx);
58917
- if (!allowEdit) return;
58918
- if (((_ctx$hooks$beforeDele = (_ctx$hooks5 = ctx.hooks).beforeDeleteComment) === null || _ctx$hooks$beforeDele === void 0 ? void 0 : _ctx$hooks$beforeDele.call(_ctx$hooks5, r, c)) === false) {
58923
+ var _ctx$hooks$beforeDele, _ctx$hooks6;
58924
+ if (((_ctx$hooks$beforeDele = (_ctx$hooks6 = ctx.hooks).beforeDeleteComment) === null || _ctx$hooks$beforeDele === void 0 ? void 0 : _ctx$hooks$beforeDele.call(_ctx$hooks6, r, c)) === false) {
58919
58925
  return;
58920
58926
  }
58921
58927
  var flowdata = getFlowdata(ctx);
@@ -58925,13 +58931,13 @@ function deleteComment(ctx, globalCache, r, c) {
58925
58931
  cell.ps = undefined;
58926
58932
  if (ctx.hooks.afterDeleteComment) {
58927
58933
  setTimeout(function () {
58928
- var _ctx$hooks$afterDelet, _ctx$hooks6;
58929
- (_ctx$hooks$afterDelet = (_ctx$hooks6 = ctx.hooks).afterDeleteComment) === null || _ctx$hooks$afterDelet === void 0 ? void 0 : _ctx$hooks$afterDelet.call(_ctx$hooks6, r, c);
58934
+ var _ctx$hooks$afterDelet, _ctx$hooks7;
58935
+ (_ctx$hooks$afterDelet = (_ctx$hooks7 = ctx.hooks).afterDeleteComment) === null || _ctx$hooks$afterDelet === void 0 ? void 0 : _ctx$hooks$afterDelet.call(_ctx$hooks7, r, c);
58930
58936
  });
58931
58937
  }
58932
58938
  if (ctx.hooks.afterUpdateComment) {
58933
- var _ctx$hooks$afterUpdat2, _ctx$hooks7;
58934
- (_ctx$hooks$afterUpdat2 = (_ctx$hooks7 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat2 === void 0 ? void 0 : _ctx$hooks$afterUpdat2.call(_ctx$hooks7, r, c, null);
58939
+ var _ctx$hooks$afterUpdat3, _ctx$hooks8;
58940
+ (_ctx$hooks$afterUpdat3 = (_ctx$hooks8 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat3 === void 0 ? void 0 : _ctx$hooks$afterUpdat3.call(_ctx$hooks8, r, c, null);
58935
58941
  }
58936
58942
  }
58937
58943
  function showComments(ctx, commentShowCells) {
@@ -58961,8 +58967,8 @@ function showHideComment(ctx, globalCache, r, c) {
58961
58967
  comment.isShow = true;
58962
58968
  }
58963
58969
  if (ctx.hooks.afterUpdateComment) {
58964
- var _ctx$hooks$afterUpdat3, _ctx$hooks8;
58965
- (_ctx$hooks$afterUpdat3 = (_ctx$hooks8 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat3 === void 0 ? void 0 : _ctx$hooks$afterUpdat3.call(_ctx$hooks8, r, c, _objectSpread2({}, comment));
58970
+ var _ctx$hooks$afterUpdat4, _ctx$hooks9;
58971
+ (_ctx$hooks$afterUpdat4 = (_ctx$hooks9 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat4 === void 0 ? void 0 : _ctx$hooks$afterUpdat4.call(_ctx$hooks9, r, c, _objectSpread2({}, comment));
58966
58972
  }
58967
58973
  }
58968
58974
  function showHideAllComments(ctx) {
@@ -59186,8 +59192,8 @@ function onCommentBoxResizeEnd(ctx, globalCache) {
59186
59192
  cell.ps.height = height / ctx.zoomRatio;
59187
59193
  setEditingComment(ctx, flowdata, r, c);
59188
59194
  if (ctx.hooks.afterUpdateComment) {
59189
- var _ctx$hooks$afterUpdat4, _ctx$hooks9;
59190
- (_ctx$hooks$afterUpdat4 = (_ctx$hooks9 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat4 === void 0 ? void 0 : _ctx$hooks$afterUpdat4.call(_ctx$hooks9, r, c, _objectSpread2({}, cell.ps));
59195
+ var _ctx$hooks$afterUpdat5, _ctx$hooks10;
59196
+ (_ctx$hooks$afterUpdat5 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks10, r, c, _objectSpread2({}, cell.ps));
59191
59197
  }
59192
59198
  }
59193
59199
  }
@@ -59257,8 +59263,8 @@ function onCommentBoxMoveEnd(ctx, globalCache) {
59257
59263
  cell.ps.top = top / ctx.zoomRatio;
59258
59264
  setEditingComment(ctx, flowdata, r, c);
59259
59265
  if (ctx.hooks.afterUpdateComment) {
59260
- var _ctx$hooks$afterUpdat5, _ctx$hooks10;
59261
- (_ctx$hooks$afterUpdat5 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks10, r, c, _objectSpread2({}, cell.ps));
59266
+ var _ctx$hooks$afterUpdat6, _ctx$hooks11;
59267
+ (_ctx$hooks$afterUpdat6 = (_ctx$hooks11 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat6 === void 0 ? void 0 : _ctx$hooks$afterUpdat6.call(_ctx$hooks11, r, c, _objectSpread2({}, cell.ps));
59262
59268
  }
59263
59269
  }
59264
59270
  }
@@ -62604,10 +62610,31 @@ var Canvas = /*#__PURE__*/function () {
62604
62610
  }
62605
62611
  return map;
62606
62612
  }
62613
+ }, {
62614
+ key: "cellPsRender",
62615
+ value: function cellPsRender(_ref2) {
62616
+ var renderCtx = _ref2.renderCtx,
62617
+ cell = _ref2.cell,
62618
+ endX = _ref2.endX,
62619
+ startY = _ref2.startY,
62620
+ offsetLeft = _ref2.offsetLeft,
62621
+ offsetTop = _ref2.offsetTop;
62622
+ if (cell === null || cell === void 0 ? void 0 : cell.ps) {
62623
+ var ps_w = 8 * this.sheetCtx.zoomRatio;
62624
+ var ps_h = 8 * this.sheetCtx.zoomRatio;
62625
+ renderCtx.beginPath();
62626
+ renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
62627
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
62628
+ renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
62629
+ renderCtx.fillStyle = "#FC6666";
62630
+ renderCtx.fill();
62631
+ renderCtx.closePath();
62632
+ }
62633
+ }
62607
62634
  }, {
62608
62635
  key: "nullCellRender",
62609
62636
  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, _flowdata$r4$c, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62637
+ var _this$sheetCtx$hooks$6, _this$sheetCtx$hooks6, _flowdata$r2, _flowdata$r3, _flowdata$r4, _this$sheetCtx$hooks$7, _this$sheetCtx$hooks7;
62611
62638
  var isMerge = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : false;
62612
62639
  var checksCF = checkCF(r, c, cfCompute);
62613
62640
  var flowdata = getFlowdata(this.sheetCtx);
@@ -62646,17 +62673,14 @@ var Canvas = /*#__PURE__*/function () {
62646
62673
  }
62647
62674
  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
62675
  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
- 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) {
62650
- var ps_w = 8 * this.sheetCtx.zoomRatio;
62651
- var ps_h = 8 * this.sheetCtx.zoomRatio;
62652
- renderCtx.beginPath();
62653
- renderCtx.moveTo(endX + offsetLeft - 1 - ps_w, startY + offsetTop);
62654
- renderCtx.lineTo(endX + offsetLeft - 1, startY + offsetTop);
62655
- renderCtx.lineTo(endX + offsetLeft - 1, startY + offsetTop + ps_h);
62656
- renderCtx.fillStyle = "#FC6666";
62657
- renderCtx.fill();
62658
- renderCtx.closePath();
62659
- }
62676
+ this.cellPsRender({
62677
+ renderCtx: renderCtx,
62678
+ cell: flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r4 = flowdata[r]) === null || _flowdata$r4 === void 0 ? void 0 : _flowdata$r4[c],
62679
+ endX: endX,
62680
+ startY: startY,
62681
+ offsetLeft: offsetLeft,
62682
+ offsetTop: offsetTop
62683
+ });
62660
62684
  var cellOverflow_colInObj = this.cellOverflow_colIn(cellOverflowMap, r, c, colStart, colEnd);
62661
62685
  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
62686
  this.cellOverflowRender(cellOverflow_colInObj.rowIndex, cellOverflow_colInObj.colIndex, cellOverflow_colInObj.stc, cellOverflow_colInObj.edc, renderCtx, scrollHeight, scrollWidth, offsetLeft, offsetTop, afCompute, cfCompute);
@@ -62706,10 +62730,10 @@ var Canvas = /*#__PURE__*/function () {
62706
62730
  renderCtx.lineWidth = 1;
62707
62731
  var rectWidth = endX - startX;
62708
62732
  var rectHeight = endY - startY;
62709
- var tsPosition = function tsPosition(_ref2) {
62710
- var _ref3 = _slicedToArray(_ref2, 2),
62711
- x = _ref3[0],
62712
- y = _ref3[1];
62733
+ var tsPosition = function tsPosition(_ref3) {
62734
+ var _ref4 = _slicedToArray(_ref3, 2),
62735
+ x = _ref4[0],
62736
+ y = _ref4[1];
62713
62737
  if (y > startY + rectHeight) {
62714
62738
  var dis = y - (startY + rectHeight);
62715
62739
  y = startY + rectHeight;
@@ -62803,24 +62827,21 @@ var Canvas = /*#__PURE__*/function () {
62803
62827
  }
62804
62828
  this.renderDelLine(renderCtx, cell, startX, startY, endX, endY, offsetLeft, offsetTop);
62805
62829
  this.renderLyFlag(renderCtx, cell, startX, startY, offsetLeft, offsetTop);
62806
- if (cell === null || cell === void 0 ? void 0 : cell.ps) {
62807
- var ps_w = 8 * this.sheetCtx.zoomRatio;
62808
- var ps_h = 8 * this.sheetCtx.zoomRatio;
62809
- renderCtx.beginPath();
62810
- renderCtx.moveTo(endX + offsetLeft - ps_w, startY + offsetTop);
62811
- renderCtx.lineTo(endX + offsetLeft, startY + offsetTop);
62812
- renderCtx.lineTo(endX + offsetLeft, startY + offsetTop + ps_h);
62813
- renderCtx.fillStyle = "#FC6666";
62814
- renderCtx.fill();
62815
- renderCtx.closePath();
62816
- }
62830
+ this.cellPsRender({
62831
+ renderCtx: renderCtx,
62832
+ cell: cell,
62833
+ endX: endX,
62834
+ startY: startY,
62835
+ offsetLeft: offsetLeft,
62836
+ offsetTop: offsetTop
62837
+ });
62817
62838
  if ((cell === null || cell === void 0 ? void 0 : cell.qp) === 1 && isRealNum$1(cell === null || cell === void 0 ? void 0 : cell.v)) {
62818
- var _ps_w = 6 * this.sheetCtx.zoomRatio;
62819
- var _ps_h = 6 * this.sheetCtx.zoomRatio;
62839
+ var ps_w = 6 * this.sheetCtx.zoomRatio;
62840
+ var ps_h = 6 * this.sheetCtx.zoomRatio;
62820
62841
  renderCtx.beginPath();
62821
- renderCtx.moveTo(startX + offsetLeft + _ps_w - 1, startY + offsetTop);
62842
+ renderCtx.moveTo(startX + offsetLeft + ps_w - 1, startY + offsetTop);
62822
62843
  renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop);
62823
- renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop + _ps_h);
62844
+ renderCtx.lineTo(startX + offsetLeft - 1, startY + offsetTop + ps_h);
62824
62845
  renderCtx.fillStyle = "#487f1e";
62825
62846
  renderCtx.fill();
62826
62847
  renderCtx.closePath();
@@ -63221,9 +63242,9 @@ var Canvas = /*#__PURE__*/function () {
63221
63242
  }
63222
63243
  }, {
63223
63244
  key: "drawFreezeLine",
63224
- value: function drawFreezeLine(_ref4) {
63225
- var horizontalTop = _ref4.horizontalTop,
63226
- verticalLeft = _ref4.verticalLeft;
63245
+ value: function drawFreezeLine(_ref5) {
63246
+ var horizontalTop = _ref5.horizontalTop,
63247
+ verticalLeft = _ref5.verticalLeft;
63227
63248
  }
63228
63249
  }]);
63229
63250
  }();
@@ -1,6 +1,12 @@
1
1
  import React from "react";
2
2
  import { Sheet, Selection, CellMatrix, Cell } from "./types";
3
3
  export type Hooks = {
4
+ commentsPreRender?: (r: number, c: number) => any;
5
+ showCommentsMenu?: (item: {
6
+ text: string;
7
+ show: boolean;
8
+ onClick: any;
9
+ }) => boolean;
4
10
  showMenuBefore?: (ctx: any, selection: any) => boolean;
5
11
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
6
12
  afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "3.1.15",
3
+ "version": "3.1.17",
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.15",
16
+ "@leankylin-sheet/formula-parser": "^3.1.17",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",