@zhenliang/sheet 0.1.7-3.beta.10 → 0.1.7-3.beta.12

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.
@@ -8,9 +8,9 @@ export var Remark = /*#__PURE__*/forwardRef(function (props, ref) {
8
8
  var rightOverflow = document.body.clientWidth - position.left < 400;
9
9
  var bottomOverflow = document.body.clientHeight - position.top < 400;
10
10
  if (rightOverflow && bottomOverflow) {
11
- return "translate(-100%, -100%)";
11
+ return "translate(calc(-100% - 4px), calc(-100% - 4px))";
12
12
  } else if (rightOverflow && !bottomOverflow) {
13
- return "translate(-100%, 40px)";
13
+ return "translate(calc(-100% - 4px), 44px)";
14
14
  } else if (!rightOverflow && bottomOverflow) {
15
15
  return "translate(0, calc(40px - 100%))";
16
16
  }
@@ -386,9 +386,11 @@ span.harvest-sheet-container:focus {
386
386
  z-index: 10;
387
387
  margin-left: 5px;
388
388
  overflow: auto;
389
+ scroll-behavior: smooth;
389
390
  padding: 0;
390
391
  background: rgb(255,255,255);
391
392
  box-shadow: 0 4px 8px rgba(216,223,235,.5);
393
+ transition: top .1s linear,left .1s linear,transform .05s linear;
392
394
  }
393
395
  .harvest-remark-container::-webkit-scrollbar{
394
396
  display: none;
@@ -63,6 +63,17 @@ export var useRemarkContainer = function useRemarkContainer(elementRef, start, e
63
63
  useEffect(function () {
64
64
  var _elementRef$current, _elementRef$current2;
65
65
  var remarkScroll = throttle(function () {
66
+ var _ref = elementRef.current || {},
67
+ _ref$scrollTop = _ref.scrollTop,
68
+ scrollTop = _ref$scrollTop === void 0 ? 0 : _ref$scrollTop,
69
+ _ref$scrollHeight = _ref.scrollHeight,
70
+ scrollHeight = _ref$scrollHeight === void 0 ? 0 : _ref$scrollHeight,
71
+ _ref$clientHeight = _ref.clientHeight,
72
+ clientHeight = _ref$clientHeight === void 0 ? 0 : _ref$clientHeight;
73
+ // 滚动条抖动导致的
74
+ if (Math.abs(clientHeight + scrollTop - scrollHeight) <= 1) {
75
+ return;
76
+ }
66
77
  setRemarkInfo({
67
78
  show: false
68
79
  });
@@ -96,13 +107,13 @@ export var useRemarkContainer = function useRemarkContainer(elementRef, start, e
96
107
  }
97
108
  var io = new IntersectionObserver(function (entries) {
98
109
  var ratio = entries[0].intersectionRatio;
99
- if (ratio < 1) {
110
+ if (ratio < 0.5) {
100
111
  setRemarkInfo({
101
112
  show: false
102
113
  });
103
114
  }
104
115
  }, {
105
- threshold: 1
116
+ threshold: 0.5
106
117
  });
107
118
  io.observe(cell);
108
119
  return function () {
@@ -87,7 +87,6 @@ var Table = function Table(_ref) {
87
87
  var toRow = flatDataSource.findIndex(function (d) {
88
88
  return String(d === null || d === void 0 ? void 0 : d.id) === String(id);
89
89
  });
90
- console.log(sheetInstance.current, data, flatDataSource, toRow, toCol);
91
90
  (_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 || _sheetInstance$curren.goTo(toRow, toCol);
92
91
  (_sheetInstance$curren2 = sheetInstance.current) === null || _sheetInstance$curren2 === void 0 || _sheetInstance$curren2.select({
93
92
  start: {
@@ -104,7 +103,7 @@ var Table = function Table(_ref) {
104
103
  return (_sheetInstance$curren3 = sheetInstance.current) === null || _sheetInstance$curren3 === void 0 ? void 0 : _sheetInstance$curren3[property];
105
104
  }
106
105
  });
107
- }, [columns, dataSource]);
106
+ }, [columns, dataSource, offset]);
108
107
  var _useRowSelection = useRowSelection(dataSource, rowSelection, hasChildren),
109
108
  _useRowSelection2 = _slicedToArray(_useRowSelection, 2),
110
109
  checkedRow = _useRowSelection2[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.73.beta.10",
3
+ "version": "0.1.73.beta.12",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",