react-window 1.8.7 → 1.8.8
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-dev.umd.js +1 -1
- package/dist/index-dev.umd.js.map +1 -1
- package/dist/index-prod.umd.js +1 -1
- package/dist/index-prod.umd.js.map +1 -1
- package/dist/index.cjs.js +52 -35
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +52 -35
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/FixedSizeList.js +9 -2
- package/src/VariableSizeList.js +3 -2
- package/src/createListComponent.js +23 -3
package/dist/index.esm.js
CHANGED
|
@@ -1245,17 +1245,34 @@ function createListComponent(_ref) {
|
|
|
1245
1245
|
align = 'auto';
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
|
-
var
|
|
1248
|
+
var _this$props2 = this.props,
|
|
1249
|
+
itemCount = _this$props2.itemCount,
|
|
1250
|
+
layout = _this$props2.layout;
|
|
1249
1251
|
var scrollOffset = this.state.scrollOffset;
|
|
1250
|
-
index = Math.max(0, Math.min(index, itemCount - 1));
|
|
1251
|
-
|
|
1252
|
+
index = Math.max(0, Math.min(index, itemCount - 1)); // The scrollbar size should be considered when scrolling an item into view, to ensure it's fully visible.
|
|
1253
|
+
// But we only need to account for its size when it's actually visible.
|
|
1254
|
+
// This is an edge case for lists; normally they only scroll in the dominant direction.
|
|
1255
|
+
|
|
1256
|
+
var scrollbarSize = 0;
|
|
1257
|
+
|
|
1258
|
+
if (this._outerRef) {
|
|
1259
|
+
var outerRef = this._outerRef;
|
|
1260
|
+
|
|
1261
|
+
if (layout === 'vertical') {
|
|
1262
|
+
scrollbarSize = outerRef.scrollWidth > outerRef.clientWidth ? getScrollbarSize() : 0;
|
|
1263
|
+
} else {
|
|
1264
|
+
scrollbarSize = outerRef.scrollHeight > outerRef.clientHeight ? getScrollbarSize() : 0;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
this.scrollTo(getOffsetForIndexAndAlignment(this.props, index, align, scrollOffset, this._instanceProps, scrollbarSize));
|
|
1252
1269
|
};
|
|
1253
1270
|
|
|
1254
1271
|
_proto.componentDidMount = function componentDidMount() {
|
|
1255
|
-
var _this$
|
|
1256
|
-
direction = _this$
|
|
1257
|
-
initialScrollOffset = _this$
|
|
1258
|
-
layout = _this$
|
|
1272
|
+
var _this$props3 = this.props,
|
|
1273
|
+
direction = _this$props3.direction,
|
|
1274
|
+
initialScrollOffset = _this$props3.initialScrollOffset,
|
|
1275
|
+
layout = _this$props3.layout;
|
|
1259
1276
|
|
|
1260
1277
|
if (typeof initialScrollOffset === 'number' && this._outerRef != null) {
|
|
1261
1278
|
var outerRef = this._outerRef; // TODO Deprecate direction "horizontal"
|
|
@@ -1271,9 +1288,9 @@ function createListComponent(_ref) {
|
|
|
1271
1288
|
};
|
|
1272
1289
|
|
|
1273
1290
|
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
1274
|
-
var _this$
|
|
1275
|
-
direction = _this$
|
|
1276
|
-
layout = _this$
|
|
1291
|
+
var _this$props4 = this.props,
|
|
1292
|
+
direction = _this$props4.direction,
|
|
1293
|
+
layout = _this$props4.layout;
|
|
1277
1294
|
var _this$state = this.state,
|
|
1278
1295
|
scrollOffset = _this$state.scrollOffset,
|
|
1279
1296
|
scrollUpdateWasRequested = _this$state.scrollUpdateWasRequested;
|
|
@@ -1319,24 +1336,24 @@ function createListComponent(_ref) {
|
|
|
1319
1336
|
};
|
|
1320
1337
|
|
|
1321
1338
|
_proto.render = function render() {
|
|
1322
|
-
var _this$
|
|
1323
|
-
children = _this$
|
|
1324
|
-
className = _this$
|
|
1325
|
-
direction = _this$
|
|
1326
|
-
height = _this$
|
|
1327
|
-
innerRef = _this$
|
|
1328
|
-
innerElementType = _this$
|
|
1329
|
-
innerTagName = _this$
|
|
1330
|
-
itemCount = _this$
|
|
1331
|
-
itemData = _this$
|
|
1332
|
-
_this$
|
|
1333
|
-
itemKey = _this$
|
|
1334
|
-
layout = _this$
|
|
1335
|
-
outerElementType = _this$
|
|
1336
|
-
outerTagName = _this$
|
|
1337
|
-
style = _this$
|
|
1338
|
-
useIsScrolling = _this$
|
|
1339
|
-
width = _this$
|
|
1339
|
+
var _this$props5 = this.props,
|
|
1340
|
+
children = _this$props5.children,
|
|
1341
|
+
className = _this$props5.className,
|
|
1342
|
+
direction = _this$props5.direction,
|
|
1343
|
+
height = _this$props5.height,
|
|
1344
|
+
innerRef = _this$props5.innerRef,
|
|
1345
|
+
innerElementType = _this$props5.innerElementType,
|
|
1346
|
+
innerTagName = _this$props5.innerTagName,
|
|
1347
|
+
itemCount = _this$props5.itemCount,
|
|
1348
|
+
itemData = _this$props5.itemData,
|
|
1349
|
+
_this$props5$itemKey = _this$props5.itemKey,
|
|
1350
|
+
itemKey = _this$props5$itemKey === void 0 ? defaultItemKey$1 : _this$props5$itemKey,
|
|
1351
|
+
layout = _this$props5.layout,
|
|
1352
|
+
outerElementType = _this$props5.outerElementType,
|
|
1353
|
+
outerTagName = _this$props5.outerTagName,
|
|
1354
|
+
style = _this$props5.style,
|
|
1355
|
+
useIsScrolling = _this$props5.useIsScrolling,
|
|
1356
|
+
width = _this$props5.width;
|
|
1340
1357
|
var isScrolling = this.state.isScrolling; // TODO Deprecate direction "horizontal"
|
|
1341
1358
|
|
|
1342
1359
|
var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
@@ -1417,9 +1434,9 @@ function createListComponent(_ref) {
|
|
|
1417
1434
|
;
|
|
1418
1435
|
|
|
1419
1436
|
_proto._getRangeToRender = function _getRangeToRender() {
|
|
1420
|
-
var _this$
|
|
1421
|
-
itemCount = _this$
|
|
1422
|
-
overscanCount = _this$
|
|
1437
|
+
var _this$props6 = this.props,
|
|
1438
|
+
itemCount = _this$props6.itemCount,
|
|
1439
|
+
overscanCount = _this$props6.overscanCount;
|
|
1423
1440
|
var _this$state3 = this.state,
|
|
1424
1441
|
isScrolling = _this$state3.isScrolling,
|
|
1425
1442
|
scrollDirection = _this$state3.scrollDirection,
|
|
@@ -1624,7 +1641,7 @@ var VariableSizeList = /*#__PURE__*/createListComponent({
|
|
|
1624
1641
|
return instanceProps.itemMetadataMap[index].size;
|
|
1625
1642
|
},
|
|
1626
1643
|
getEstimatedTotalSize: getEstimatedTotalSize,
|
|
1627
|
-
getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(props, index, align, scrollOffset, instanceProps) {
|
|
1644
|
+
getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(props, index, align, scrollOffset, instanceProps, scrollbarSize) {
|
|
1628
1645
|
var direction = props.direction,
|
|
1629
1646
|
height = props.height,
|
|
1630
1647
|
layout = props.layout,
|
|
@@ -1637,7 +1654,7 @@ var VariableSizeList = /*#__PURE__*/createListComponent({
|
|
|
1637
1654
|
|
|
1638
1655
|
var estimatedTotalSize = getEstimatedTotalSize(props, instanceProps);
|
|
1639
1656
|
var maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, itemMetadata.offset));
|
|
1640
|
-
var minOffset = Math.max(0, itemMetadata.offset - size + itemMetadata.size);
|
|
1657
|
+
var minOffset = Math.max(0, itemMetadata.offset - size + itemMetadata.size + scrollbarSize);
|
|
1641
1658
|
|
|
1642
1659
|
if (align === 'smart') {
|
|
1643
1660
|
if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
|
|
@@ -1925,7 +1942,7 @@ var FixedSizeList = /*#__PURE__*/createListComponent({
|
|
|
1925
1942
|
itemSize = _ref3.itemSize;
|
|
1926
1943
|
return itemSize * itemCount;
|
|
1927
1944
|
},
|
|
1928
|
-
getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(_ref4, index, align, scrollOffset) {
|
|
1945
|
+
getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(_ref4, index, align, scrollOffset, instanceProps, scrollbarSize) {
|
|
1929
1946
|
var direction = _ref4.direction,
|
|
1930
1947
|
height = _ref4.height,
|
|
1931
1948
|
itemCount = _ref4.itemCount,
|
|
@@ -1937,7 +1954,7 @@ var FixedSizeList = /*#__PURE__*/createListComponent({
|
|
|
1937
1954
|
var size = isHorizontal ? width : height;
|
|
1938
1955
|
var lastItemOffset = Math.max(0, itemCount * itemSize - size);
|
|
1939
1956
|
var maxOffset = Math.min(lastItemOffset, index * itemSize);
|
|
1940
|
-
var minOffset = Math.max(0, index * itemSize - size + itemSize);
|
|
1957
|
+
var minOffset = Math.max(0, index * itemSize - size + itemSize + scrollbarSize);
|
|
1941
1958
|
|
|
1942
1959
|
if (align === 'smart') {
|
|
1943
1960
|
if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
|