@leankylin-sheet/react 4.0.15 → 4.0.17
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 +12 -5
- package/dist/index.js +11 -4
- package/dist/index.umd.js +1184 -4
- package/dist/index.umd.min.js +2 -2
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fix
|
|
|
2
2
|
import React, { useContext, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
3
3
|
import produce, { applyPatches, enablePatches, produceWithPatches } from 'immer';
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
-
import { useMemoizedFn, useThrottleFn } from 'ahooks';
|
|
5
|
+
import { useInViewport, useMemoizedFn, useThrottleFn } from 'ahooks';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
|
|
8
8
|
function _iterableToArrayLimit(r, l) {
|
|
@@ -1336,13 +1336,17 @@ var ScrollBar = function ScrollBar(_ref) {
|
|
|
1336
1336
|
context = _useContext.context,
|
|
1337
1337
|
refs = _useContext.refs,
|
|
1338
1338
|
setContext = _useContext.setContext;
|
|
1339
|
+
var ref = axis === "x" ? refs.scrollbarX : refs.scrollbarY;
|
|
1340
|
+
var _useInViewport = useInViewport(ref),
|
|
1341
|
+
_useInViewport2 = _slicedToArray(_useInViewport, 1),
|
|
1342
|
+
inViewport = _useInViewport2[0];
|
|
1339
1343
|
useEffect(function () {
|
|
1340
1344
|
if (axis === "x") {
|
|
1341
1345
|
refs.scrollbarX.current.scrollLeft = context.scrollLeft;
|
|
1342
1346
|
} else {
|
|
1343
1347
|
refs.scrollbarY.current.scrollTop = context.scrollTop;
|
|
1344
1348
|
}
|
|
1345
|
-
}, [axis === "x" ? context.scrollLeft : context.scrollTop]);
|
|
1349
|
+
}, [axis === "x" ? context.scrollLeft : context.scrollTop, inViewport]);
|
|
1346
1350
|
var getHidden = function getHidden() {
|
|
1347
1351
|
var _refs$scrollbarY$curr;
|
|
1348
1352
|
if (axis === "x") {
|
|
@@ -1352,7 +1356,7 @@ var ScrollBar = function ScrollBar(_ref) {
|
|
|
1352
1356
|
};
|
|
1353
1357
|
var hidden = getHidden();
|
|
1354
1358
|
return /*#__PURE__*/React.createElement("div", {
|
|
1355
|
-
ref:
|
|
1359
|
+
ref: ref,
|
|
1356
1360
|
style: axis === "x" ? {
|
|
1357
1361
|
left: context.rowHeaderWidth,
|
|
1358
1362
|
width: "calc(100% - ".concat(context.rowHeaderWidth, "px)"),
|
|
@@ -2467,11 +2471,14 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2467
2471
|
style: {
|
|
2468
2472
|
width: "100%",
|
|
2469
2473
|
height: "100%",
|
|
2470
|
-
overflow: "
|
|
2474
|
+
overflow: "auto",
|
|
2471
2475
|
display: "flex",
|
|
2472
2476
|
flexDirection: "column"
|
|
2473
2477
|
},
|
|
2474
|
-
|
|
2478
|
+
onContextMenu: function onContextMenu(e) {
|
|
2479
|
+
return e.stopPropagation();
|
|
2480
|
+
},
|
|
2481
|
+
onWheelCapture: function onWheelCapture(e) {
|
|
2475
2482
|
return e.stopPropagation();
|
|
2476
2483
|
},
|
|
2477
2484
|
id: "".concat(commentId, "-editor"),
|
package/dist/index.js
CHANGED
|
@@ -1346,13 +1346,17 @@ var ScrollBar = function ScrollBar(_ref) {
|
|
|
1346
1346
|
context = _useContext.context,
|
|
1347
1347
|
refs = _useContext.refs,
|
|
1348
1348
|
setContext = _useContext.setContext;
|
|
1349
|
+
var ref = axis === "x" ? refs.scrollbarX : refs.scrollbarY;
|
|
1350
|
+
var _useInViewport = ahooks.useInViewport(ref),
|
|
1351
|
+
_useInViewport2 = _slicedToArray(_useInViewport, 1),
|
|
1352
|
+
inViewport = _useInViewport2[0];
|
|
1349
1353
|
React.useEffect(function () {
|
|
1350
1354
|
if (axis === "x") {
|
|
1351
1355
|
refs.scrollbarX.current.scrollLeft = context.scrollLeft;
|
|
1352
1356
|
} else {
|
|
1353
1357
|
refs.scrollbarY.current.scrollTop = context.scrollTop;
|
|
1354
1358
|
}
|
|
1355
|
-
}, [axis === "x" ? context.scrollLeft : context.scrollTop]);
|
|
1359
|
+
}, [axis === "x" ? context.scrollLeft : context.scrollTop, inViewport]);
|
|
1356
1360
|
var getHidden = function getHidden() {
|
|
1357
1361
|
var _refs$scrollbarY$curr;
|
|
1358
1362
|
if (axis === "x") {
|
|
@@ -1362,7 +1366,7 @@ var ScrollBar = function ScrollBar(_ref) {
|
|
|
1362
1366
|
};
|
|
1363
1367
|
var hidden = getHidden();
|
|
1364
1368
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1365
|
-
ref:
|
|
1369
|
+
ref: ref,
|
|
1366
1370
|
style: axis === "x" ? {
|
|
1367
1371
|
left: context.rowHeaderWidth,
|
|
1368
1372
|
width: "calc(100% - ".concat(context.rowHeaderWidth, "px)"),
|
|
@@ -2477,11 +2481,14 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2477
2481
|
style: {
|
|
2478
2482
|
width: "100%",
|
|
2479
2483
|
height: "100%",
|
|
2480
|
-
overflow: "
|
|
2484
|
+
overflow: "auto",
|
|
2481
2485
|
display: "flex",
|
|
2482
2486
|
flexDirection: "column"
|
|
2483
2487
|
},
|
|
2484
|
-
|
|
2488
|
+
onContextMenu: function onContextMenu(e) {
|
|
2489
|
+
return e.stopPropagation();
|
|
2490
|
+
},
|
|
2491
|
+
onWheelCapture: function onWheelCapture(e) {
|
|
2485
2492
|
return e.stopPropagation();
|
|
2486
2493
|
},
|
|
2487
2494
|
id: "".concat(commentId, "-editor"),
|