@fileverse-dev/fortune-core 1.2.51 → 1.2.53

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.
@@ -1,6 +1,6 @@
1
1
  import _ from "lodash";
2
2
  import { getFlowdata } from "../context";
3
- import { cancelActiveImgItem, cancelPaintModel, functionHTMLGenerate, israngeseleciton, rangeHightlightselected, rangeSetValue, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxResize, onCommentBoxResizeEnd, onImageMove, onImageMoveEnd, onImageResize, onImageResizeEnd, removeEditingComment, overShowComment, removeOverShowComment, rangeDrag, onFormulaRangeDragEnd, createFormulaRangeSelect, createRangeHightlight, onCellsMoveEnd, onCellsMove, cellFocus, editComment, onIframeMoveEnd, onIframeResizeEnd, overShowError } from "../modules";
3
+ import { cancelActiveImgItem, cancelPaintModel, functionHTMLGenerate, israngeseleciton, rangeHightlightselected, rangeSetValue, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxResize, onCommentBoxResizeEnd, onImageMove, onImageMoveEnd, onImageResize, onImageResizeEnd, removeEditingComment, removeOverShowComment, rangeDrag, onFormulaRangeDragEnd, createFormulaRangeSelect, createRangeHightlight, onCellsMoveEnd, onCellsMove, cellFocus, editComment, onIframeMoveEnd, onIframeResizeEnd, overShowError } from "../modules";
4
4
  import { getFrozenHandleLeft, getFrozenHandleTop, scrollToFrozenRowCol } from "../modules/freeze";
5
5
  import { cancelFunctionrangeSelected, mergeBorder, mergeMoveMain, updateCell, luckysheetUpdateCell } from "../modules/cell";
6
6
  import { colLocation, colLocationByIndex, rowLocation, rowLocationByIndex } from "../modules/location";
@@ -900,12 +900,33 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
900
900
  }
901
901
  }
902
902
  export function handleOverlayMouseMove(ctx, globalCache, e, cellInput, scrollX, scrollY, container, fxInput) {
903
+ var _a;
903
904
  if (onCommentBoxResize(ctx, globalCache, e)) return;
904
905
  if (onCommentBoxMove(ctx, globalCache, e)) return;
905
906
  if (onImageMove(ctx, globalCache, e)) return;
906
907
  if (onImageResize(ctx, globalCache, e)) return;
907
908
  onCellsMove(ctx, globalCache, e, scrollX, scrollY, container);
908
- overShowComment(ctx, e, scrollX, scrollY, container);
909
+ var containerMain = document.getElementsByClassName("fortune-cell-area")[0];
910
+ var rect = containerMain === null || containerMain === void 0 ? void 0 : containerMain.getBoundingClientRect();
911
+ if (!rect) {
912
+ rect = container.getBoundingClientRect();
913
+ }
914
+ var mouseX = e.pageX - rect.left - window.scrollX;
915
+ var mouseY = e.pageY - rect.top - window.scrollY;
916
+ var _x = mouseX + ctx.scrollLeft;
917
+ var _y = mouseY + ctx.scrollTop;
918
+ if (_x >= rect.width + ctx.scrollLeft || _y >= rect.height + ctx.scrollTop) {
919
+ return;
920
+ }
921
+ var freeze = (_a = globalCache.freezen) === null || _a === void 0 ? void 0 : _a[ctx.currentSheetId];
922
+ var _b = fixPositionOnFrozenCells(freeze, _x, _y, mouseX, mouseY),
923
+ x = _b.x,
924
+ y = _b.y;
925
+ var row_location = rowLocation(y, ctx.visibledatarow);
926
+ var row_index = row_location[2];
927
+ var col_location = colLocation(x, ctx.visibledatacolumn);
928
+ var col_index = col_location[2];
929
+ editComment(ctx, globalCache, row_index, col_index);
909
930
  overShowError(ctx, e, scrollX, scrollY, container);
910
931
  onSearchDialogMove(globalCache, e);
911
932
  onRangeSelectionModalMove(globalCache, e);
@@ -196,8 +196,6 @@ export function removeEditingComment(ctx, globalCache) {
196
196
  }
197
197
  export function newComment(ctx, globalCache, r, c) {
198
198
  var _a, _b;
199
- var allowEdit = isAllowEdit(ctx);
200
- if (!allowEdit) return;
201
199
  if (((_b = (_a = ctx.hooks).beforeInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
202
200
  return;
203
201
  }
@@ -230,12 +228,10 @@ export function newComment(ctx, globalCache, r, c) {
230
228
  }
231
229
  }
232
230
  export function editComment(ctx, globalCache, r, c) {
233
- var _a;
234
- var allowEdit = isAllowEdit(ctx);
235
- if (!allowEdit) return;
231
+ var _a, _b;
236
232
  var flowdata = getFlowdata(ctx);
237
- removeEditingComment(ctx, globalCache);
238
- var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
233
+ var comment = (_b = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r]) === null || _a === void 0 ? void 0 : _a[c]) === null || _b === void 0 ? void 0 : _b.ps;
234
+ if (!comment) return;
239
235
  var commentBoxes = _.concat(ctx.commentBoxes, ctx.editingCommentBox);
240
236
  if (_.findIndex(commentBoxes, function (v) {
241
237
  return (v === null || v === void 0 ? void 0 : v.rc) === "".concat(r, "_").concat(c);
@@ -919,12 +919,33 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
919
919
  }
920
920
  }
921
921
  function handleOverlayMouseMove(ctx, globalCache, e, cellInput, scrollX, scrollY, container, fxInput) {
922
+ var _a;
922
923
  if ((0, _modules.onCommentBoxResize)(ctx, globalCache, e)) return;
923
924
  if ((0, _modules.onCommentBoxMove)(ctx, globalCache, e)) return;
924
925
  if ((0, _modules.onImageMove)(ctx, globalCache, e)) return;
925
926
  if ((0, _modules.onImageResize)(ctx, globalCache, e)) return;
926
927
  (0, _modules.onCellsMove)(ctx, globalCache, e, scrollX, scrollY, container);
927
- (0, _modules.overShowComment)(ctx, e, scrollX, scrollY, container);
928
+ var containerMain = document.getElementsByClassName("fortune-cell-area")[0];
929
+ var rect = containerMain === null || containerMain === void 0 ? void 0 : containerMain.getBoundingClientRect();
930
+ if (!rect) {
931
+ rect = container.getBoundingClientRect();
932
+ }
933
+ var mouseX = e.pageX - rect.left - window.scrollX;
934
+ var mouseY = e.pageY - rect.top - window.scrollY;
935
+ var _x = mouseX + ctx.scrollLeft;
936
+ var _y = mouseY + ctx.scrollTop;
937
+ if (_x >= rect.width + ctx.scrollLeft || _y >= rect.height + ctx.scrollTop) {
938
+ return;
939
+ }
940
+ var freeze = (_a = globalCache.freezen) === null || _a === void 0 ? void 0 : _a[ctx.currentSheetId];
941
+ var _b = fixPositionOnFrozenCells(freeze, _x, _y, mouseX, mouseY),
942
+ x = _b.x,
943
+ y = _b.y;
944
+ var row_location = (0, _location.rowLocation)(y, ctx.visibledatarow);
945
+ var row_index = row_location[2];
946
+ var col_location = (0, _location.colLocation)(x, ctx.visibledatacolumn);
947
+ var col_index = col_location[2];
948
+ (0, _modules.editComment)(ctx, globalCache, row_index, col_index);
928
949
  (0, _modules.overShowError)(ctx, e, scrollX, scrollY, container);
929
950
  (0, _searchReplace.onSearchDialogMove)(globalCache, e);
930
951
  (0, _hyperlink.onRangeSelectionModalMove)(globalCache, e);
@@ -224,8 +224,6 @@ function removeEditingComment(ctx, globalCache) {
224
224
  }
225
225
  function newComment(ctx, globalCache, r, c) {
226
226
  var _a, _b;
227
- var allowEdit = (0, _utils.isAllowEdit)(ctx);
228
- if (!allowEdit) return;
229
227
  if (((_b = (_a = ctx.hooks).beforeInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
230
228
  return;
231
229
  }
@@ -258,12 +256,10 @@ function newComment(ctx, globalCache, r, c) {
258
256
  }
259
257
  }
260
258
  function editComment(ctx, globalCache, r, c) {
261
- var _a;
262
- var allowEdit = (0, _utils.isAllowEdit)(ctx);
263
- if (!allowEdit) return;
259
+ var _a, _b;
264
260
  var flowdata = (0, _context.getFlowdata)(ctx);
265
- removeEditingComment(ctx, globalCache);
266
- var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
261
+ var comment = (_b = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r]) === null || _a === void 0 ? void 0 : _a[c]) === null || _b === void 0 ? void 0 : _b.ps;
262
+ if (!comment) return;
267
263
  var commentBoxes = _lodash.default.concat(ctx.commentBoxes, ctx.editingCommentBox);
268
264
  if (_lodash.default.findIndex(commentBoxes, function (v) {
269
265
  return (v === null || v === void 0 ? void 0 : v.rc) === "".concat(r, "_").concat(c);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.51",
3
+ "version": "1.2.53",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",