@leankylin-sheet/react 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/index.esm.js CHANGED
@@ -2056,12 +2056,13 @@ var ImgBoxs = function ImgBoxs() {
2056
2056
  };
2057
2057
 
2058
2058
  var NotationBoxes = function NotationBoxes() {
2059
- var _context$commentBoxes;
2059
+ var _context$visibledatac, _context$commentBoxes;
2060
2060
  var _useContext = useContext(WorkbookContext),
2061
2061
  context = _useContext.context,
2062
2062
  setContext = _useContext.setContext,
2063
2063
  refs = _useContext.refs;
2064
2064
  var flowdata = getFlowdata(context);
2065
+ var length = (_context$visibledatac = context.visibledatacolumn) === null || _context$visibledatac === void 0 ? void 0 : _context$visibledatac.length;
2065
2066
  useEffect(function () {
2066
2067
  if (flowdata) {
2067
2068
  var psShownCells = [];
@@ -2082,7 +2083,7 @@ var NotationBoxes = function NotationBoxes() {
2082
2083
  return showComments(ctx, psShownCells);
2083
2084
  });
2084
2085
  }
2085
- }, [flowdata, setContext]);
2086
+ }, [flowdata, setContext, length]);
2086
2087
  return /*#__PURE__*/React.createElement("div", {
2087
2088
  id: "luckysheet-postil-showBoxs"
2088
2089
  }, _.concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
@@ -2100,7 +2101,8 @@ var NotationBoxes = function NotationBoxes() {
2100
2101
  height = commentBox.height,
2101
2102
  value = commentBox.value,
2102
2103
  autoFocus = commentBox.autoFocus,
2103
- size = commentBox.size;
2104
+ size = commentBox.size,
2105
+ preValue = commentBox.preValue;
2104
2106
  var isEditing = ((_context$editingComme2 = context.editingCommentBox) === null || _context$editingComme2 === void 0 ? void 0 : _context$editingComme2.rc) === rc;
2105
2107
  var commentId = "comment-box-".concat(rc);
2106
2108
  return /*#__PURE__*/React.createElement("div", {
@@ -2130,7 +2132,7 @@ var NotationBoxes = function NotationBoxes() {
2130
2132
  x1: size.fromX,
2131
2133
  y1: size.fromY,
2132
2134
  x2: size.toX,
2133
- y2: size.toY,
2135
+ y2: size.toY + 4,
2134
2136
  stroke: "#333",
2135
2137
  strokeWidth: "1",
2136
2138
  markerEnd: "url(#arrowhead)"
@@ -2195,15 +2197,17 @@ var NotationBoxes = function NotationBoxes() {
2195
2197
  height: "100%",
2196
2198
  overflow: "hidden"
2197
2199
  }
2198
- }, /*#__PURE__*/React.createElement(ContentEditable, {
2200
+ }, /*#__PURE__*/React.createElement("div", {
2201
+ dangerouslySetInnerHTML: {
2202
+ __html: preValue
2203
+ }
2204
+ }), /*#__PURE__*/React.createElement(ContentEditable, {
2199
2205
  id: "comment-editor-".concat(rc),
2200
2206
  autoFocus: autoFocus,
2201
2207
  style: {
2202
2208
  width: "100%",
2203
- height: "100%",
2204
2209
  lineHeight: "20px",
2205
2210
  boxSizing: "border-box",
2206
- textAlign: "center",
2207
2211
  wordBreak: "break-all",
2208
2212
  outline: "none"
2209
2213
  },
@@ -7405,24 +7409,35 @@ var ContextMenu = function ContextMenu() {
7405
7409
  });
7406
7410
  }
7407
7411
  if (name === "insert-comment") {
7408
- var _flowdata$row_index, _flowdata$row_index$c;
7412
+ var _flowdata$row_index, _flowdata$row_index$c, _flowdata$row_index$c2, _flowdata$row_index2, _flowdata$row_index2$, _flowdata$row_index2$2;
7409
7413
  var flowdata = getFlowdata(context);
7410
7414
  var row_index = selection === null || selection === void 0 ? void 0 : selection.row[0];
7411
7415
  var col_index = selection === null || selection === void 0 ? void 0 : selection.column[0];
7412
- var hasPs = (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : (_flowdata$row_index$c = _flowdata$row_index[col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : _flowdata$row_index$c.ps) != null;
7413
- var itemData = hasPs ? [{
7414
- text: "编辑批注",
7415
- onClick: editComment
7416
+ var hasPsValue = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : (_flowdata$row_index$c = _flowdata$row_index[col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : (_flowdata$row_index$c2 = _flowdata$row_index$c.ps) === null || _flowdata$row_index$c2 === void 0 ? void 0 : _flowdata$row_index$c2.value;
7417
+ var hasPsPreValue = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index2 = flowdata[row_index]) === null || _flowdata$row_index2 === void 0 ? void 0 : (_flowdata$row_index2$ = _flowdata$row_index2[col_index]) === null || _flowdata$row_index2$ === void 0 ? void 0 : (_flowdata$row_index2$2 = _flowdata$row_index2$.ps) === null || _flowdata$row_index2$2 === void 0 ? void 0 : _flowdata$row_index2$2.preValue;
7418
+ var canAddPs = !hasPsValue;
7419
+ var canEditPs = hasPsValue;
7420
+ var canDeletePs = hasPsValue;
7421
+ var canShowHidePs = hasPsValue || hasPsPreValue;
7422
+ var itemData = [{
7423
+ text: "新建说明",
7424
+ onClick: newComment,
7425
+ show: canAddPs
7416
7426
  }, {
7417
- text: "删除批注",
7418
- onClick: deleteComment
7427
+ text: "编辑说明",
7428
+ onClick: editComment,
7429
+ show: canEditPs
7419
7430
  }, {
7420
- text: "显示/隐藏批注",
7421
- onClick: showHideComment
7422
- }] : [{
7423
- text: "新建批注",
7424
- onClick: newComment
7425
- }];
7431
+ text: "删除说明",
7432
+ onClick: deleteComment,
7433
+ show: canDeletePs
7434
+ }, {
7435
+ text: "显示/隐藏说明",
7436
+ onClick: showHideComment,
7437
+ show: canShowHidePs
7438
+ }].filter(function (item) {
7439
+ return item.show;
7440
+ });
7426
7441
  return itemData.map(function (item) {
7427
7442
  return /*#__PURE__*/React.createElement(Menu, {
7428
7443
  key: item.text,
package/dist/index.js CHANGED
@@ -2066,12 +2066,13 @@ var ImgBoxs = function ImgBoxs() {
2066
2066
  };
2067
2067
 
2068
2068
  var NotationBoxes = function NotationBoxes() {
2069
- var _context$commentBoxes;
2069
+ var _context$visibledatac, _context$commentBoxes;
2070
2070
  var _useContext = React.useContext(WorkbookContext),
2071
2071
  context = _useContext.context,
2072
2072
  setContext = _useContext.setContext,
2073
2073
  refs = _useContext.refs;
2074
2074
  var flowdata = core.getFlowdata(context);
2075
+ var length = (_context$visibledatac = context.visibledatacolumn) === null || _context$visibledatac === void 0 ? void 0 : _context$visibledatac.length;
2075
2076
  React.useEffect(function () {
2076
2077
  if (flowdata) {
2077
2078
  var psShownCells = [];
@@ -2092,7 +2093,7 @@ var NotationBoxes = function NotationBoxes() {
2092
2093
  return core.showComments(ctx, psShownCells);
2093
2094
  });
2094
2095
  }
2095
- }, [flowdata, setContext]);
2096
+ }, [flowdata, setContext, length]);
2096
2097
  return /*#__PURE__*/React__default['default'].createElement("div", {
2097
2098
  id: "luckysheet-postil-showBoxs"
2098
2099
  }, ___default['default'].concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
@@ -2110,7 +2111,8 @@ var NotationBoxes = function NotationBoxes() {
2110
2111
  height = commentBox.height,
2111
2112
  value = commentBox.value,
2112
2113
  autoFocus = commentBox.autoFocus,
2113
- size = commentBox.size;
2114
+ size = commentBox.size,
2115
+ preValue = commentBox.preValue;
2114
2116
  var isEditing = ((_context$editingComme2 = context.editingCommentBox) === null || _context$editingComme2 === void 0 ? void 0 : _context$editingComme2.rc) === rc;
2115
2117
  var commentId = "comment-box-".concat(rc);
2116
2118
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -2140,7 +2142,7 @@ var NotationBoxes = function NotationBoxes() {
2140
2142
  x1: size.fromX,
2141
2143
  y1: size.fromY,
2142
2144
  x2: size.toX,
2143
- y2: size.toY,
2145
+ y2: size.toY + 4,
2144
2146
  stroke: "#333",
2145
2147
  strokeWidth: "1",
2146
2148
  markerEnd: "url(#arrowhead)"
@@ -2205,15 +2207,17 @@ var NotationBoxes = function NotationBoxes() {
2205
2207
  height: "100%",
2206
2208
  overflow: "hidden"
2207
2209
  }
2208
- }, /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
2210
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
2211
+ dangerouslySetInnerHTML: {
2212
+ __html: preValue
2213
+ }
2214
+ }), /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
2209
2215
  id: "comment-editor-".concat(rc),
2210
2216
  autoFocus: autoFocus,
2211
2217
  style: {
2212
2218
  width: "100%",
2213
- height: "100%",
2214
2219
  lineHeight: "20px",
2215
2220
  boxSizing: "border-box",
2216
- textAlign: "center",
2217
2221
  wordBreak: "break-all",
2218
2222
  outline: "none"
2219
2223
  },
@@ -7415,24 +7419,35 @@ var ContextMenu = function ContextMenu() {
7415
7419
  });
7416
7420
  }
7417
7421
  if (name === "insert-comment") {
7418
- var _flowdata$row_index, _flowdata$row_index$c;
7422
+ var _flowdata$row_index, _flowdata$row_index$c, _flowdata$row_index$c2, _flowdata$row_index2, _flowdata$row_index2$, _flowdata$row_index2$2;
7419
7423
  var flowdata = core.getFlowdata(context);
7420
7424
  var row_index = selection === null || selection === void 0 ? void 0 : selection.row[0];
7421
7425
  var col_index = selection === null || selection === void 0 ? void 0 : selection.column[0];
7422
- var hasPs = (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : (_flowdata$row_index$c = _flowdata$row_index[col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : _flowdata$row_index$c.ps) != null;
7423
- var itemData = hasPs ? [{
7424
- text: "编辑批注",
7425
- onClick: core.editComment
7426
+ var hasPsValue = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : (_flowdata$row_index$c = _flowdata$row_index[col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : (_flowdata$row_index$c2 = _flowdata$row_index$c.ps) === null || _flowdata$row_index$c2 === void 0 ? void 0 : _flowdata$row_index$c2.value;
7427
+ var hasPsPreValue = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index2 = flowdata[row_index]) === null || _flowdata$row_index2 === void 0 ? void 0 : (_flowdata$row_index2$ = _flowdata$row_index2[col_index]) === null || _flowdata$row_index2$ === void 0 ? void 0 : (_flowdata$row_index2$2 = _flowdata$row_index2$.ps) === null || _flowdata$row_index2$2 === void 0 ? void 0 : _flowdata$row_index2$2.preValue;
7428
+ var canAddPs = !hasPsValue;
7429
+ var canEditPs = hasPsValue;
7430
+ var canDeletePs = hasPsValue;
7431
+ var canShowHidePs = hasPsValue || hasPsPreValue;
7432
+ var itemData = [{
7433
+ text: "新建说明",
7434
+ onClick: core.newComment,
7435
+ show: canAddPs
7426
7436
  }, {
7427
- text: "删除批注",
7428
- onClick: core.deleteComment
7437
+ text: "编辑说明",
7438
+ onClick: core.editComment,
7439
+ show: canEditPs
7429
7440
  }, {
7430
- text: "显示/隐藏批注",
7431
- onClick: core.showHideComment
7432
- }] : [{
7433
- text: "新建批注",
7434
- onClick: core.newComment
7435
- }];
7441
+ text: "删除说明",
7442
+ onClick: core.deleteComment,
7443
+ show: canDeletePs
7444
+ }, {
7445
+ text: "显示/隐藏说明",
7446
+ onClick: core.showHideComment,
7447
+ show: canShowHidePs
7448
+ }].filter(function (item) {
7449
+ return item.show;
7450
+ });
7436
7451
  return itemData.map(function (item) {
7437
7452
  return /*#__PURE__*/React__default['default'].createElement(Menu, {
7438
7453
  key: item.text,
package/dist/index.umd.js CHANGED
@@ -105102,12 +105102,13 @@
105102
105102
  };
105103
105103
 
105104
105104
  var NotationBoxes = function NotationBoxes() {
105105
- var _context$commentBoxes;
105105
+ var _context$visibledatac, _context$commentBoxes;
105106
105106
  var _useContext = React.useContext(WorkbookContext),
105107
105107
  context = _useContext.context,
105108
105108
  setContext = _useContext.setContext,
105109
105109
  refs = _useContext.refs;
105110
105110
  var flowdata = getFlowdata(context);
105111
+ var length = (_context$visibledatac = context.visibledatacolumn) === null || _context$visibledatac === void 0 ? void 0 : _context$visibledatac.length;
105111
105112
  React.useEffect(function () {
105112
105113
  if (flowdata) {
105113
105114
  var psShownCells = [];
@@ -105128,7 +105129,7 @@
105128
105129
  return showComments(ctx, psShownCells);
105129
105130
  });
105130
105131
  }
105131
- }, [flowdata, setContext]);
105132
+ }, [flowdata, setContext, length]);
105132
105133
  return /*#__PURE__*/React__default['default'].createElement("div", {
105133
105134
  id: "luckysheet-postil-showBoxs"
105134
105135
  }, lodash.concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
@@ -105146,7 +105147,8 @@
105146
105147
  height = commentBox.height,
105147
105148
  value = commentBox.value,
105148
105149
  autoFocus = commentBox.autoFocus,
105149
- size = commentBox.size;
105150
+ size = commentBox.size,
105151
+ preValue = commentBox.preValue;
105150
105152
  var isEditing = ((_context$editingComme2 = context.editingCommentBox) === null || _context$editingComme2 === void 0 ? void 0 : _context$editingComme2.rc) === rc;
105151
105153
  var commentId = "comment-box-".concat(rc);
105152
105154
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -105176,7 +105178,7 @@
105176
105178
  x1: size.fromX,
105177
105179
  y1: size.fromY,
105178
105180
  x2: size.toX,
105179
- y2: size.toY,
105181
+ y2: size.toY + 4,
105180
105182
  stroke: "#333",
105181
105183
  strokeWidth: "1",
105182
105184
  markerEnd: "url(#arrowhead)"
@@ -105241,15 +105243,17 @@
105241
105243
  height: "100%",
105242
105244
  overflow: "hidden"
105243
105245
  }
105244
- }, /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
105246
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
105247
+ dangerouslySetInnerHTML: {
105248
+ __html: preValue
105249
+ }
105250
+ }), /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
105245
105251
  id: "comment-editor-".concat(rc),
105246
105252
  autoFocus: autoFocus,
105247
105253
  style: {
105248
105254
  width: "100%",
105249
- height: "100%",
105250
105255
  lineHeight: "20px",
105251
105256
  boxSizing: "border-box",
105252
- textAlign: "center",
105253
105257
  wordBreak: "break-all",
105254
105258
  outline: "none"
105255
105259
  },
@@ -110451,24 +110455,35 @@
110451
110455
  });
110452
110456
  }
110453
110457
  if (name === "insert-comment") {
110454
- var _flowdata$row_index, _flowdata$row_index$c;
110458
+ var _flowdata$row_index, _flowdata$row_index$c, _flowdata$row_index$c2, _flowdata$row_index2, _flowdata$row_index2$, _flowdata$row_index2$2;
110455
110459
  var flowdata = getFlowdata(context);
110456
110460
  var row_index = selection === null || selection === void 0 ? void 0 : selection.row[0];
110457
110461
  var col_index = selection === null || selection === void 0 ? void 0 : selection.column[0];
110458
- var hasPs = (flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : (_flowdata$row_index$c = _flowdata$row_index[col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : _flowdata$row_index$c.ps) != null;
110459
- var itemData = hasPs ? [{
110460
- text: "编辑批注",
110461
- onClick: editComment
110462
+ var hasPsValue = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : (_flowdata$row_index$c = _flowdata$row_index[col_index]) === null || _flowdata$row_index$c === void 0 ? void 0 : (_flowdata$row_index$c2 = _flowdata$row_index$c.ps) === null || _flowdata$row_index$c2 === void 0 ? void 0 : _flowdata$row_index$c2.value;
110463
+ var hasPsPreValue = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index2 = flowdata[row_index]) === null || _flowdata$row_index2 === void 0 ? void 0 : (_flowdata$row_index2$ = _flowdata$row_index2[col_index]) === null || _flowdata$row_index2$ === void 0 ? void 0 : (_flowdata$row_index2$2 = _flowdata$row_index2$.ps) === null || _flowdata$row_index2$2 === void 0 ? void 0 : _flowdata$row_index2$2.preValue;
110464
+ var canAddPs = !hasPsValue;
110465
+ var canEditPs = hasPsValue;
110466
+ var canDeletePs = hasPsValue;
110467
+ var canShowHidePs = hasPsValue || hasPsPreValue;
110468
+ var itemData = [{
110469
+ text: "新建说明",
110470
+ onClick: newComment,
110471
+ show: canAddPs
110462
110472
  }, {
110463
- text: "删除批注",
110464
- onClick: deleteComment
110473
+ text: "编辑说明",
110474
+ onClick: editComment,
110475
+ show: canEditPs
110465
110476
  }, {
110466
- text: "显示/隐藏批注",
110467
- onClick: showHideComment
110468
- }] : [{
110469
- text: "新建批注",
110470
- onClick: newComment
110471
- }];
110477
+ text: "删除说明",
110478
+ onClick: deleteComment,
110479
+ show: canDeletePs
110480
+ }, {
110481
+ text: "显示/隐藏说明",
110482
+ onClick: showHideComment,
110483
+ show: canShowHidePs
110484
+ }].filter(function (item) {
110485
+ return item.show;
110486
+ });
110472
110487
  return itemData.map(function (item) {
110473
110488
  return /*#__PURE__*/React__default['default'].createElement(Menu, {
110474
110489
  key: item.text,