@leankylin-sheet/core 3.1.12 → 3.1.14

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/index.esm.js CHANGED
@@ -58839,7 +58839,6 @@ function removeEditingComment(ctx, globalCache) {
58839
58839
  }
58840
58840
  var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
58841
58841
  if (!(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
58842
- var oldValue = cell.ps.value;
58843
58842
  cell.ps.value = value;
58844
58843
  if (!cell.ps.isShow) {
58845
58844
  ctx.commentBoxes = _.filter(ctx.commentBoxes, function (v) {
@@ -58847,16 +58846,12 @@ function removeEditingComment(ctx, globalCache) {
58847
58846
  });
58848
58847
  }
58849
58848
  if (ctx.hooks.afterUpdateComment) {
58850
- setTimeout(function () {
58851
- var _ctx$hooks$afterUpdat, _ctx$hooks2;
58852
- (_ctx$hooks$afterUpdat = (_ctx$hooks2 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat === void 0 ? void 0 : _ctx$hooks$afterUpdat.call(_ctx$hooks2, r, c, oldValue, value);
58853
- });
58849
+ var _ctx$hooks$afterUpdat, _ctx$hooks2;
58850
+ (_ctx$hooks$afterUpdat = (_ctx$hooks2 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat === void 0 ? void 0 : _ctx$hooks$afterUpdat.call(_ctx$hooks2, r, c, _objectSpread2({}, cell.ps));
58854
58851
  }
58855
58852
  }
58856
58853
  function newComment(ctx, globalCache, r, c) {
58857
58854
  var _ctx$hooks$beforeInse, _ctx$hooks3;
58858
- var allowEdit = isAllowEdit(ctx);
58859
- if (!allowEdit) return;
58860
58855
  if (((_ctx$hooks$beforeInse = (_ctx$hooks3 = ctx.hooks).beforeInsertComment) === null || _ctx$hooks$beforeInse === void 0 ? void 0 : _ctx$hooks$beforeInse.call(_ctx$hooks3, r, c)) === false) {
58861
58856
  return;
58862
58857
  }
@@ -58924,6 +58919,10 @@ function deleteComment(ctx, globalCache, r, c) {
58924
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);
58925
58920
  });
58926
58921
  }
58922
+ 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);
58925
+ }
58927
58926
  }
58928
58927
  function showComments(ctx, commentShowCells) {
58929
58928
  var flowdata = getFlowdata(ctx);
@@ -58951,6 +58950,10 @@ function showHideComment(ctx, globalCache, r, c) {
58951
58950
  } else {
58952
58951
  comment.isShow = true;
58953
58952
  }
58953
+ 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));
58956
+ }
58954
58957
  }
58955
58958
  function showHideAllComments(ctx) {
58956
58959
  var flowdata = getFlowdata(ctx);
@@ -59172,6 +59175,10 @@ function onCommentBoxResizeEnd(ctx, globalCache) {
59172
59175
  cell.ps.width = width / ctx.zoomRatio;
59173
59176
  cell.ps.height = height / ctx.zoomRatio;
59174
59177
  setEditingComment(ctx, flowdata, r, c);
59178
+ 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));
59181
+ }
59175
59182
  }
59176
59183
  }
59177
59184
  }
@@ -59202,8 +59209,6 @@ function onCommentBoxMoveStart(ctx, globalCache, e, _ref4, movingId) {
59202
59209
  }
59203
59210
  }
59204
59211
  function onCommentBoxMove(ctx, globalCache, e) {
59205
- var allowEdit = isAllowEdit(ctx);
59206
- if (!allowEdit) return false;
59207
59212
  var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
59208
59213
  if (commentBox === null || commentBox === void 0 ? void 0 : commentBox.movingId) {
59209
59214
  var box = document.getElementById(commentBox.movingId);
@@ -59241,6 +59246,10 @@ function onCommentBoxMoveEnd(ctx, globalCache) {
59241
59246
  cell.ps.left = left / ctx.zoomRatio;
59242
59247
  cell.ps.top = top / ctx.zoomRatio;
59243
59248
  setEditingComment(ctx, flowdata, r, c);
59249
+ 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));
59252
+ }
59244
59253
  }
59245
59254
  }
59246
59255
  }
package/dist/index.js CHANGED
@@ -58849,7 +58849,6 @@ function removeEditingComment(ctx, globalCache) {
58849
58849
  }
58850
58850
  var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
58851
58851
  if (!(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
58852
- var oldValue = cell.ps.value;
58853
58852
  cell.ps.value = value;
58854
58853
  if (!cell.ps.isShow) {
58855
58854
  ctx.commentBoxes = ___default['default'].filter(ctx.commentBoxes, function (v) {
@@ -58857,16 +58856,12 @@ function removeEditingComment(ctx, globalCache) {
58857
58856
  });
58858
58857
  }
58859
58858
  if (ctx.hooks.afterUpdateComment) {
58860
- setTimeout(function () {
58861
- var _ctx$hooks$afterUpdat, _ctx$hooks2;
58862
- (_ctx$hooks$afterUpdat = (_ctx$hooks2 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat === void 0 ? void 0 : _ctx$hooks$afterUpdat.call(_ctx$hooks2, r, c, oldValue, value);
58863
- });
58859
+ var _ctx$hooks$afterUpdat, _ctx$hooks2;
58860
+ (_ctx$hooks$afterUpdat = (_ctx$hooks2 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat === void 0 ? void 0 : _ctx$hooks$afterUpdat.call(_ctx$hooks2, r, c, _objectSpread2({}, cell.ps));
58864
58861
  }
58865
58862
  }
58866
58863
  function newComment(ctx, globalCache, r, c) {
58867
58864
  var _ctx$hooks$beforeInse, _ctx$hooks3;
58868
- var allowEdit = isAllowEdit(ctx);
58869
- if (!allowEdit) return;
58870
58865
  if (((_ctx$hooks$beforeInse = (_ctx$hooks3 = ctx.hooks).beforeInsertComment) === null || _ctx$hooks$beforeInse === void 0 ? void 0 : _ctx$hooks$beforeInse.call(_ctx$hooks3, r, c)) === false) {
58871
58866
  return;
58872
58867
  }
@@ -58934,6 +58929,10 @@ function deleteComment(ctx, globalCache, r, c) {
58934
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);
58935
58930
  });
58936
58931
  }
58932
+ 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);
58935
+ }
58937
58936
  }
58938
58937
  function showComments(ctx, commentShowCells) {
58939
58938
  var flowdata = getFlowdata(ctx);
@@ -58961,6 +58960,10 @@ function showHideComment(ctx, globalCache, r, c) {
58961
58960
  } else {
58962
58961
  comment.isShow = true;
58963
58962
  }
58963
+ 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));
58966
+ }
58964
58967
  }
58965
58968
  function showHideAllComments(ctx) {
58966
58969
  var flowdata = getFlowdata(ctx);
@@ -59182,6 +59185,10 @@ function onCommentBoxResizeEnd(ctx, globalCache) {
59182
59185
  cell.ps.width = width / ctx.zoomRatio;
59183
59186
  cell.ps.height = height / ctx.zoomRatio;
59184
59187
  setEditingComment(ctx, flowdata, r, c);
59188
+ 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));
59191
+ }
59185
59192
  }
59186
59193
  }
59187
59194
  }
@@ -59212,8 +59219,6 @@ function onCommentBoxMoveStart(ctx, globalCache, e, _ref4, movingId) {
59212
59219
  }
59213
59220
  }
59214
59221
  function onCommentBoxMove(ctx, globalCache, e) {
59215
- var allowEdit = isAllowEdit(ctx);
59216
- if (!allowEdit) return false;
59217
59222
  var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
59218
59223
  if (commentBox === null || commentBox === void 0 ? void 0 : commentBox.movingId) {
59219
59224
  var box = document.getElementById(commentBox.movingId);
@@ -59251,6 +59256,10 @@ function onCommentBoxMoveEnd(ctx, globalCache) {
59251
59256
  cell.ps.left = left / ctx.zoomRatio;
59252
59257
  cell.ps.top = top / ctx.zoomRatio;
59253
59258
  setEditingComment(ctx, flowdata, r, c);
59259
+ 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));
59262
+ }
59254
59263
  }
59255
59264
  }
59256
59265
  }
@@ -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
+ showMenuBefore?: (ctx: any, selection: any) => boolean;
4
5
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
5
6
  afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
6
7
  afterSelectionChange?: (sheetId: string, selection: Selection) => void;
@@ -56,7 +57,7 @@ export type Hooks = {
56
57
  }) => void;
57
58
  beforePaste?: (selection: Selection[] | undefined, content: string) => boolean;
58
59
  beforeUpdateComment?: (row: number, column: number, value: any) => boolean;
59
- afterUpdateComment?: (row: number, column: number, oldValue: any, value: any) => void;
60
+ afterUpdateComment?: (row: number, column: number, value: any) => void;
60
61
  beforeInsertComment?: (row: number, column: number) => boolean;
61
62
  afterInsertComment?: (row: number, column: number) => void;
62
63
  beforeDeleteComment?: (row: number, column: number) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "3.1.12",
3
+ "version": "3.1.14",
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.12",
16
+ "@leankylin-sheet/formula-parser": "^3.1.14",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",