@fileverse-dev/fortune-core 1.2.50 → 1.2.51-patch-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.
@@ -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";
@@ -156,7 +156,6 @@ export function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, containe
156
156
  return;
157
157
  }
158
158
  cellFocus(ctx, row_index, col_index, true);
159
- editComment(ctx, globalCache, row_index, col_index);
160
159
  if (!inHorizontalFreeze && !inVerticalFreeze) {
161
160
  if (col_pre < ctx.scrollLeft) {
162
161
  ctx.scrollLeft = col_pre;
@@ -900,12 +899,35 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
900
899
  }
901
900
  }
902
901
  export function handleOverlayMouseMove(ctx, globalCache, e, cellInput, scrollX, scrollY, container, fxInput) {
902
+ var _a;
903
903
  if (onCommentBoxResize(ctx, globalCache, e)) return;
904
904
  if (onCommentBoxMove(ctx, globalCache, e)) return;
905
905
  if (onImageMove(ctx, globalCache, e)) return;
906
906
  if (onImageResize(ctx, globalCache, e)) return;
907
907
  onCellsMove(ctx, globalCache, e, scrollX, scrollY, container);
908
- overShowComment(ctx, e, scrollX, scrollY, container);
908
+ var containerMain = document.getElementsByClassName('fortune-cell-area')[0];
909
+ var rect = containerMain === null || containerMain === void 0 ? void 0 : containerMain.getBoundingClientRect();
910
+ if (!rect) {
911
+ rect = container.getBoundingClientRect();
912
+ }
913
+ var mouseX = e.pageX - rect.left - window.scrollX;
914
+ var mouseY = e.pageY - rect.top - window.scrollY;
915
+ var _x = mouseX + ctx.scrollLeft;
916
+ var _y = mouseY + ctx.scrollTop;
917
+ if (_x >= rect.width + ctx.scrollLeft || _y >= rect.height + ctx.scrollTop) {
918
+ return;
919
+ }
920
+ var freeze = (_a = globalCache.freezen) === null || _a === void 0 ? void 0 : _a[ctx.currentSheetId];
921
+ var _b = fixPositionOnFrozenCells(freeze, _x, _y, mouseX, mouseY),
922
+ x = _b.x,
923
+ y = _b.y,
924
+ inHorizontalFreeze = _b.inHorizontalFreeze,
925
+ inVerticalFreeze = _b.inVerticalFreeze;
926
+ var row_location = rowLocation(y, ctx.visibledatarow);
927
+ var row_index = row_location[2];
928
+ var col_location = colLocation(x, ctx.visibledatacolumn);
929
+ var col_index = col_location[2];
930
+ editComment(ctx, globalCache, row_index, col_index);
909
931
  overShowError(ctx, e, scrollX, scrollY, container);
910
932
  onSearchDialogMove(globalCache, e);
911
933
  onRangeSelectionModalMove(globalCache, e);
@@ -104,6 +104,7 @@ export function getCellValue(r, c, data, attr) {
104
104
  }
105
105
  export function setCellValue(ctx, r, c, d, v) {
106
106
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
107
+ console.log("setCellValue", r, c, __assign({}, v), __assign({}, v.ct));
107
108
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
108
109
  if (_.isNil(d)) {
109
110
  d = getFlowdata(ctx);
@@ -230,12 +230,12 @@ export function newComment(ctx, globalCache, r, c) {
230
230
  }
231
231
  }
232
232
  export function editComment(ctx, globalCache, r, c) {
233
- var _a;
233
+ var _a, _b;
234
234
  var allowEdit = isAllowEdit(ctx);
235
235
  if (!allowEdit) return;
236
236
  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;
237
+ 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;
238
+ if (!comment) return;
239
239
  var commentBoxes = _.concat(ctx.commentBoxes, ctx.editingCommentBox);
240
240
  if (_.findIndex(commentBoxes, function (v) {
241
241
  return (v === null || v === void 0 ? void 0 : v.rc) === "".concat(r, "_").concat(c);
@@ -175,7 +175,6 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
175
175
  return;
176
176
  }
177
177
  (0, _modules.cellFocus)(ctx, row_index, col_index, true);
178
- (0, _modules.editComment)(ctx, globalCache, row_index, col_index);
179
178
  if (!inHorizontalFreeze && !inVerticalFreeze) {
180
179
  if (col_pre < ctx.scrollLeft) {
181
180
  ctx.scrollLeft = col_pre;
@@ -919,12 +918,35 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
919
918
  }
920
919
  }
921
920
  function handleOverlayMouseMove(ctx, globalCache, e, cellInput, scrollX, scrollY, container, fxInput) {
921
+ var _a;
922
922
  if ((0, _modules.onCommentBoxResize)(ctx, globalCache, e)) return;
923
923
  if ((0, _modules.onCommentBoxMove)(ctx, globalCache, e)) return;
924
924
  if ((0, _modules.onImageMove)(ctx, globalCache, e)) return;
925
925
  if ((0, _modules.onImageResize)(ctx, globalCache, e)) return;
926
926
  (0, _modules.onCellsMove)(ctx, globalCache, e, scrollX, scrollY, container);
927
- (0, _modules.overShowComment)(ctx, e, scrollX, scrollY, container);
927
+ var containerMain = document.getElementsByClassName('fortune-cell-area')[0];
928
+ var rect = containerMain === null || containerMain === void 0 ? void 0 : containerMain.getBoundingClientRect();
929
+ if (!rect) {
930
+ rect = container.getBoundingClientRect();
931
+ }
932
+ var mouseX = e.pageX - rect.left - window.scrollX;
933
+ var mouseY = e.pageY - rect.top - window.scrollY;
934
+ var _x = mouseX + ctx.scrollLeft;
935
+ var _y = mouseY + ctx.scrollTop;
936
+ if (_x >= rect.width + ctx.scrollLeft || _y >= rect.height + ctx.scrollTop) {
937
+ return;
938
+ }
939
+ var freeze = (_a = globalCache.freezen) === null || _a === void 0 ? void 0 : _a[ctx.currentSheetId];
940
+ var _b = fixPositionOnFrozenCells(freeze, _x, _y, mouseX, mouseY),
941
+ x = _b.x,
942
+ y = _b.y,
943
+ inHorizontalFreeze = _b.inHorizontalFreeze,
944
+ inVerticalFreeze = _b.inVerticalFreeze;
945
+ var row_location = (0, _location.rowLocation)(y, ctx.visibledatarow);
946
+ var row_index = row_location[2];
947
+ var col_location = (0, _location.colLocation)(x, ctx.visibledatacolumn);
948
+ var col_index = col_location[2];
949
+ (0, _modules.editComment)(ctx, globalCache, row_index, col_index);
928
950
  (0, _modules.overShowError)(ctx, e, scrollX, scrollY, container);
929
951
  (0, _searchReplace.onSearchDialogMove)(globalCache, e);
930
952
  (0, _hyperlink.onRangeSelectionModalMove)(globalCache, e);
@@ -137,6 +137,7 @@ function getCellValue(r, c, data, attr) {
137
137
  }
138
138
  function setCellValue(ctx, r, c, d, v) {
139
139
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
140
+ console.log("setCellValue", r, c, __assign({}, v), __assign({}, v.ct));
140
141
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
141
142
  if (_lodash.default.isNil(d)) {
142
143
  d = (0, _context.getFlowdata)(ctx);
@@ -258,12 +258,12 @@ function newComment(ctx, globalCache, r, c) {
258
258
  }
259
259
  }
260
260
  function editComment(ctx, globalCache, r, c) {
261
- var _a;
261
+ var _a, _b;
262
262
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
263
263
  if (!allowEdit) return;
264
264
  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;
265
+ 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;
266
+ if (!comment) return;
267
267
  var commentBoxes = _lodash.default.concat(ctx.commentBoxes, ctx.editingCommentBox);
268
268
  if (_lodash.default.findIndex(commentBoxes, function (v) {
269
269
  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.50",
3
+ "version": "1.2.51-patch-2",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",