react-window 1.8.6 → 1.8.7
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/README.md +69 -1
- 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 +30 -50
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +29 -49
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -11
- package/CHANGELOG.md +0 -121
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
|
|
3
2
|
import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
3
|
+
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
|
|
4
4
|
import memoizeOne from 'memoize-one';
|
|
5
5
|
import { createElement, PureComponent } from 'react';
|
|
6
6
|
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';
|
|
@@ -115,20 +115,14 @@ var devWarningsTagName = null;
|
|
|
115
115
|
|
|
116
116
|
if (process.env.NODE_ENV !== 'production') {
|
|
117
117
|
if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
|
|
118
|
-
devWarningsOverscanCount =
|
|
119
|
-
/*#__PURE__*/
|
|
120
|
-
new WeakSet();
|
|
121
|
-
devWarningsOverscanRowsColumnsCount =
|
|
122
|
-
/*#__PURE__*/
|
|
123
|
-
new WeakSet();
|
|
124
|
-
devWarningsTagName =
|
|
125
|
-
/*#__PURE__*/
|
|
126
|
-
new WeakSet();
|
|
118
|
+
devWarningsOverscanCount = /*#__PURE__*/new WeakSet();
|
|
119
|
+
devWarningsOverscanRowsColumnsCount = /*#__PURE__*/new WeakSet();
|
|
120
|
+
devWarningsTagName = /*#__PURE__*/new WeakSet();
|
|
127
121
|
}
|
|
128
122
|
}
|
|
129
123
|
|
|
130
124
|
function createGridComponent(_ref2) {
|
|
131
|
-
var _class
|
|
125
|
+
var _class;
|
|
132
126
|
|
|
133
127
|
var getColumnOffset = _ref2.getColumnOffset,
|
|
134
128
|
getColumnStartIndexForOffset = _ref2.getColumnStartIndexForOffset,
|
|
@@ -145,9 +139,7 @@ function createGridComponent(_ref2) {
|
|
|
145
139
|
initInstanceProps = _ref2.initInstanceProps,
|
|
146
140
|
shouldResetStyleCacheOnItemSizeChange = _ref2.shouldResetStyleCacheOnItemSizeChange,
|
|
147
141
|
validateProps = _ref2.validateProps;
|
|
148
|
-
return
|
|
149
|
-
/*#__PURE__*/
|
|
150
|
-
function (_PureComponent) {
|
|
142
|
+
return _class = /*#__PURE__*/function (_PureComponent) {
|
|
151
143
|
_inheritsLoose(Grid, _PureComponent);
|
|
152
144
|
|
|
153
145
|
// Always use explicit constructor for React components.
|
|
@@ -157,11 +149,11 @@ function createGridComponent(_ref2) {
|
|
|
157
149
|
var _this;
|
|
158
150
|
|
|
159
151
|
_this = _PureComponent.call(this, props) || this;
|
|
160
|
-
_this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(
|
|
152
|
+
_this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
|
|
161
153
|
_this._resetIsScrollingTimeoutId = null;
|
|
162
154
|
_this._outerRef = void 0;
|
|
163
155
|
_this.state = {
|
|
164
|
-
instance: _assertThisInitialized(
|
|
156
|
+
instance: _assertThisInitialized(_this),
|
|
165
157
|
isScrolling: false,
|
|
166
158
|
horizontalScrollDirection: 'forward',
|
|
167
159
|
scrollLeft: typeof _this.props.initialScrollLeft === 'number' ? _this.props.initialScrollLeft : 0,
|
|
@@ -570,11 +562,11 @@ function createGridComponent(_ref2) {
|
|
|
570
562
|
|
|
571
563
|
this._callOnScroll(_scrollLeft, _scrollTop, _horizontalScrollDirection, _verticalScrollDirection, _scrollUpdateWasRequested);
|
|
572
564
|
}
|
|
573
|
-
}
|
|
565
|
+
} // Lazily create and cache item styles while scrolling,
|
|
574
566
|
// So that pure component sCU will prevent re-renders.
|
|
575
567
|
// We maintain this cache, and pass a style prop rather than index,
|
|
576
568
|
// So that List can clear cached styles and force item re-render if necessary.
|
|
577
|
-
|
|
569
|
+
;
|
|
578
570
|
|
|
579
571
|
_proto._getHorizontalRangeToRender = function _getHorizontalRangeToRender() {
|
|
580
572
|
var _this$props6 = this.props,
|
|
@@ -633,7 +625,7 @@ function createGridComponent(_ref2) {
|
|
|
633
625
|
direction: 'ltr',
|
|
634
626
|
itemData: undefined,
|
|
635
627
|
useIsScrolling: false
|
|
636
|
-
},
|
|
628
|
+
}, _class;
|
|
637
629
|
}
|
|
638
630
|
|
|
639
631
|
var validateSharedProps = function validateSharedProps(_ref5, _ref6) {
|
|
@@ -881,9 +873,7 @@ var getOffsetForIndexAndAlignment = function getOffsetForIndexAndAlignment(itemT
|
|
|
881
873
|
}
|
|
882
874
|
};
|
|
883
875
|
|
|
884
|
-
var VariableSizeGrid =
|
|
885
|
-
/*#__PURE__*/
|
|
886
|
-
createGridComponent({
|
|
876
|
+
var VariableSizeGrid = /*#__PURE__*/createGridComponent({
|
|
887
877
|
getColumnOffset: function getColumnOffset(props, index, instanceProps) {
|
|
888
878
|
return getItemMetadata('column', props, index, instanceProps).offset;
|
|
889
879
|
},
|
|
@@ -1030,17 +1020,13 @@ var devWarningsTagName$1 = null;
|
|
|
1030
1020
|
|
|
1031
1021
|
if (process.env.NODE_ENV !== 'production') {
|
|
1032
1022
|
if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
|
|
1033
|
-
devWarningsDirection =
|
|
1034
|
-
/*#__PURE__*/
|
|
1035
|
-
new WeakSet();
|
|
1036
|
-
devWarningsTagName$1 =
|
|
1037
|
-
/*#__PURE__*/
|
|
1038
|
-
new WeakSet();
|
|
1023
|
+
devWarningsDirection = /*#__PURE__*/new WeakSet();
|
|
1024
|
+
devWarningsTagName$1 = /*#__PURE__*/new WeakSet();
|
|
1039
1025
|
}
|
|
1040
1026
|
}
|
|
1041
1027
|
|
|
1042
1028
|
function createListComponent(_ref) {
|
|
1043
|
-
var _class
|
|
1029
|
+
var _class;
|
|
1044
1030
|
|
|
1045
1031
|
var getItemOffset = _ref.getItemOffset,
|
|
1046
1032
|
getEstimatedTotalSize = _ref.getEstimatedTotalSize,
|
|
@@ -1051,9 +1037,7 @@ function createListComponent(_ref) {
|
|
|
1051
1037
|
initInstanceProps = _ref.initInstanceProps,
|
|
1052
1038
|
shouldResetStyleCacheOnItemSizeChange = _ref.shouldResetStyleCacheOnItemSizeChange,
|
|
1053
1039
|
validateProps = _ref.validateProps;
|
|
1054
|
-
return
|
|
1055
|
-
/*#__PURE__*/
|
|
1056
|
-
function (_PureComponent) {
|
|
1040
|
+
return _class = /*#__PURE__*/function (_PureComponent) {
|
|
1057
1041
|
_inheritsLoose(List, _PureComponent);
|
|
1058
1042
|
|
|
1059
1043
|
// Always use explicit constructor for React components.
|
|
@@ -1063,11 +1047,11 @@ function createListComponent(_ref) {
|
|
|
1063
1047
|
var _this;
|
|
1064
1048
|
|
|
1065
1049
|
_this = _PureComponent.call(this, props) || this;
|
|
1066
|
-
_this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(
|
|
1050
|
+
_this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
|
|
1067
1051
|
_this._outerRef = void 0;
|
|
1068
1052
|
_this._resetIsScrollingTimeoutId = null;
|
|
1069
1053
|
_this.state = {
|
|
1070
|
-
instance: _assertThisInitialized(
|
|
1054
|
+
instance: _assertThisInitialized(_this),
|
|
1071
1055
|
isScrolling: false,
|
|
1072
1056
|
scrollDirection: 'forward',
|
|
1073
1057
|
scrollOffset: typeof _this.props.initialScrollOffset === 'number' ? _this.props.initialScrollOffset : 0,
|
|
@@ -1426,11 +1410,11 @@ function createListComponent(_ref) {
|
|
|
1426
1410
|
|
|
1427
1411
|
this._callOnScroll(_scrollDirection, _scrollOffset, _scrollUpdateWasRequested);
|
|
1428
1412
|
}
|
|
1429
|
-
}
|
|
1413
|
+
} // Lazily create and cache item styles while scrolling,
|
|
1430
1414
|
// So that pure component sCU will prevent re-renders.
|
|
1431
1415
|
// We maintain this cache, and pass a style prop rather than index,
|
|
1432
1416
|
// So that List can clear cached styles and force item re-render if necessary.
|
|
1433
|
-
|
|
1417
|
+
;
|
|
1434
1418
|
|
|
1435
1419
|
_proto._getRangeToRender = function _getRangeToRender() {
|
|
1436
1420
|
var _this$props5 = this.props,
|
|
@@ -1461,7 +1445,7 @@ function createListComponent(_ref) {
|
|
|
1461
1445
|
layout: 'vertical',
|
|
1462
1446
|
overscanCount: 2,
|
|
1463
1447
|
useIsScrolling: false
|
|
1464
|
-
},
|
|
1448
|
+
}, _class;
|
|
1465
1449
|
} // NOTE: I considered further wrapping individual items with a pure ListItem component.
|
|
1466
1450
|
// This would avoid ever calling the render function for the same index more than once,
|
|
1467
1451
|
// But it would also add the overhead of a lot of components/fibers.
|
|
@@ -1632,9 +1616,7 @@ var getEstimatedTotalSize = function getEstimatedTotalSize(_ref2, _ref3) {
|
|
|
1632
1616
|
return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
|
|
1633
1617
|
};
|
|
1634
1618
|
|
|
1635
|
-
var VariableSizeList =
|
|
1636
|
-
/*#__PURE__*/
|
|
1637
|
-
createListComponent({
|
|
1619
|
+
var VariableSizeList = /*#__PURE__*/createListComponent({
|
|
1638
1620
|
getItemOffset: function getItemOffset(props, index, instanceProps) {
|
|
1639
1621
|
return getItemMetadata$1(props, index, instanceProps).offset;
|
|
1640
1622
|
},
|
|
@@ -1751,9 +1733,7 @@ createListComponent({
|
|
|
1751
1733
|
}
|
|
1752
1734
|
});
|
|
1753
1735
|
|
|
1754
|
-
var FixedSizeGrid =
|
|
1755
|
-
/*#__PURE__*/
|
|
1756
|
-
createGridComponent({
|
|
1736
|
+
var FixedSizeGrid = /*#__PURE__*/createGridComponent({
|
|
1757
1737
|
getColumnOffset: function getColumnOffset(_ref, index) {
|
|
1758
1738
|
var columnWidth = _ref.columnWidth;
|
|
1759
1739
|
return index * columnWidth;
|
|
@@ -1931,9 +1911,7 @@ createGridComponent({
|
|
|
1931
1911
|
}
|
|
1932
1912
|
});
|
|
1933
1913
|
|
|
1934
|
-
var FixedSizeList =
|
|
1935
|
-
/*#__PURE__*/
|
|
1936
|
-
createListComponent({
|
|
1914
|
+
var FixedSizeList = /*#__PURE__*/createListComponent({
|
|
1937
1915
|
getItemOffset: function getItemOffset(_ref, index) {
|
|
1938
1916
|
var itemSize = _ref.itemSize;
|
|
1939
1917
|
return index * itemSize;
|
|
@@ -2055,15 +2033,17 @@ function shallowDiffers(prev, next) {
|
|
|
2055
2033
|
return false;
|
|
2056
2034
|
}
|
|
2057
2035
|
|
|
2036
|
+
var _excluded = ["style"],
|
|
2037
|
+
_excluded2 = ["style"];
|
|
2058
2038
|
// It knows to compare individual style props and ignore the wrapper object.
|
|
2059
2039
|
// See https://reactjs.org/docs/react-api.html#reactmemo
|
|
2060
2040
|
|
|
2061
2041
|
function areEqual(prevProps, nextProps) {
|
|
2062
2042
|
var prevStyle = prevProps.style,
|
|
2063
|
-
prevRest = _objectWithoutPropertiesLoose(prevProps,
|
|
2043
|
+
prevRest = _objectWithoutPropertiesLoose(prevProps, _excluded);
|
|
2064
2044
|
|
|
2065
2045
|
var nextStyle = nextProps.style,
|
|
2066
|
-
nextRest = _objectWithoutPropertiesLoose(nextProps,
|
|
2046
|
+
nextRest = _objectWithoutPropertiesLoose(nextProps, _excluded2);
|
|
2067
2047
|
|
|
2068
2048
|
return !shallowDiffers(prevStyle, nextStyle) && !shallowDiffers(prevRest, nextRest);
|
|
2069
2049
|
}
|
|
@@ -2075,5 +2055,5 @@ function shouldComponentUpdate(nextProps, nextState) {
|
|
|
2075
2055
|
return !areEqual(this.props, nextProps) || shallowDiffers(this.state, nextState);
|
|
2076
2056
|
}
|
|
2077
2057
|
|
|
2078
|
-
export {
|
|
2058
|
+
export { FixedSizeGrid, FixedSizeList, VariableSizeGrid, VariableSizeList, areEqual, shouldComponentUpdate };
|
|
2079
2059
|
//# sourceMappingURL=index.esm.js.map
|