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/dist/index.cjs.js CHANGED
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
7
  var _extends = _interopDefault(require('@babel/runtime/helpers/extends'));
8
- var _inheritsLoose = _interopDefault(require('@babel/runtime/helpers/inheritsLoose'));
9
8
  var _assertThisInitialized = _interopDefault(require('@babel/runtime/helpers/assertThisInitialized'));
9
+ var _inheritsLoose = _interopDefault(require('@babel/runtime/helpers/inheritsLoose'));
10
10
  var memoizeOne = _interopDefault(require('memoize-one'));
11
11
  var react = require('react');
12
12
  var _objectWithoutPropertiesLoose = _interopDefault(require('@babel/runtime/helpers/objectWithoutPropertiesLoose'));
@@ -121,20 +121,14 @@ var devWarningsTagName = null;
121
121
 
122
122
  if (process.env.NODE_ENV !== 'production') {
123
123
  if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
124
- devWarningsOverscanCount =
125
- /*#__PURE__*/
126
- new WeakSet();
127
- devWarningsOverscanRowsColumnsCount =
128
- /*#__PURE__*/
129
- new WeakSet();
130
- devWarningsTagName =
131
- /*#__PURE__*/
132
- new WeakSet();
124
+ devWarningsOverscanCount = /*#__PURE__*/new WeakSet();
125
+ devWarningsOverscanRowsColumnsCount = /*#__PURE__*/new WeakSet();
126
+ devWarningsTagName = /*#__PURE__*/new WeakSet();
133
127
  }
134
128
  }
135
129
 
136
130
  function createGridComponent(_ref2) {
137
- var _class, _temp;
131
+ var _class;
138
132
 
139
133
  var getColumnOffset = _ref2.getColumnOffset,
140
134
  getColumnStartIndexForOffset = _ref2.getColumnStartIndexForOffset,
@@ -151,9 +145,7 @@ function createGridComponent(_ref2) {
151
145
  initInstanceProps = _ref2.initInstanceProps,
152
146
  shouldResetStyleCacheOnItemSizeChange = _ref2.shouldResetStyleCacheOnItemSizeChange,
153
147
  validateProps = _ref2.validateProps;
154
- return _temp = _class =
155
- /*#__PURE__*/
156
- function (_PureComponent) {
148
+ return _class = /*#__PURE__*/function (_PureComponent) {
157
149
  _inheritsLoose(Grid, _PureComponent);
158
150
 
159
151
  // Always use explicit constructor for React components.
@@ -163,11 +155,11 @@ function createGridComponent(_ref2) {
163
155
  var _this;
164
156
 
165
157
  _this = _PureComponent.call(this, props) || this;
166
- _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_assertThisInitialized(_this)));
158
+ _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
167
159
  _this._resetIsScrollingTimeoutId = null;
168
160
  _this._outerRef = void 0;
169
161
  _this.state = {
170
- instance: _assertThisInitialized(_assertThisInitialized(_this)),
162
+ instance: _assertThisInitialized(_this),
171
163
  isScrolling: false,
172
164
  horizontalScrollDirection: 'forward',
173
165
  scrollLeft: typeof _this.props.initialScrollLeft === 'number' ? _this.props.initialScrollLeft : 0,
@@ -576,11 +568,11 @@ function createGridComponent(_ref2) {
576
568
 
577
569
  this._callOnScroll(_scrollLeft, _scrollTop, _horizontalScrollDirection, _verticalScrollDirection, _scrollUpdateWasRequested);
578
570
  }
579
- }; // Lazily create and cache item styles while scrolling,
571
+ } // Lazily create and cache item styles while scrolling,
580
572
  // So that pure component sCU will prevent re-renders.
581
573
  // We maintain this cache, and pass a style prop rather than index,
582
574
  // So that List can clear cached styles and force item re-render if necessary.
583
-
575
+ ;
584
576
 
585
577
  _proto._getHorizontalRangeToRender = function _getHorizontalRangeToRender() {
586
578
  var _this$props6 = this.props,
@@ -639,7 +631,7 @@ function createGridComponent(_ref2) {
639
631
  direction: 'ltr',
640
632
  itemData: undefined,
641
633
  useIsScrolling: false
642
- }, _temp;
634
+ }, _class;
643
635
  }
644
636
 
645
637
  var validateSharedProps = function validateSharedProps(_ref5, _ref6) {
@@ -887,9 +879,7 @@ var getOffsetForIndexAndAlignment = function getOffsetForIndexAndAlignment(itemT
887
879
  }
888
880
  };
889
881
 
890
- var VariableSizeGrid =
891
- /*#__PURE__*/
892
- createGridComponent({
882
+ var VariableSizeGrid = /*#__PURE__*/createGridComponent({
893
883
  getColumnOffset: function getColumnOffset(props, index, instanceProps) {
894
884
  return getItemMetadata('column', props, index, instanceProps).offset;
895
885
  },
@@ -1036,17 +1026,13 @@ var devWarningsTagName$1 = null;
1036
1026
 
1037
1027
  if (process.env.NODE_ENV !== 'production') {
1038
1028
  if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
1039
- devWarningsDirection =
1040
- /*#__PURE__*/
1041
- new WeakSet();
1042
- devWarningsTagName$1 =
1043
- /*#__PURE__*/
1044
- new WeakSet();
1029
+ devWarningsDirection = /*#__PURE__*/new WeakSet();
1030
+ devWarningsTagName$1 = /*#__PURE__*/new WeakSet();
1045
1031
  }
1046
1032
  }
1047
1033
 
1048
1034
  function createListComponent(_ref) {
1049
- var _class, _temp;
1035
+ var _class;
1050
1036
 
1051
1037
  var getItemOffset = _ref.getItemOffset,
1052
1038
  getEstimatedTotalSize = _ref.getEstimatedTotalSize,
@@ -1057,9 +1043,7 @@ function createListComponent(_ref) {
1057
1043
  initInstanceProps = _ref.initInstanceProps,
1058
1044
  shouldResetStyleCacheOnItemSizeChange = _ref.shouldResetStyleCacheOnItemSizeChange,
1059
1045
  validateProps = _ref.validateProps;
1060
- return _temp = _class =
1061
- /*#__PURE__*/
1062
- function (_PureComponent) {
1046
+ return _class = /*#__PURE__*/function (_PureComponent) {
1063
1047
  _inheritsLoose(List, _PureComponent);
1064
1048
 
1065
1049
  // Always use explicit constructor for React components.
@@ -1069,11 +1053,11 @@ function createListComponent(_ref) {
1069
1053
  var _this;
1070
1054
 
1071
1055
  _this = _PureComponent.call(this, props) || this;
1072
- _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_assertThisInitialized(_this)));
1056
+ _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
1073
1057
  _this._outerRef = void 0;
1074
1058
  _this._resetIsScrollingTimeoutId = null;
1075
1059
  _this.state = {
1076
- instance: _assertThisInitialized(_assertThisInitialized(_this)),
1060
+ instance: _assertThisInitialized(_this),
1077
1061
  isScrolling: false,
1078
1062
  scrollDirection: 'forward',
1079
1063
  scrollOffset: typeof _this.props.initialScrollOffset === 'number' ? _this.props.initialScrollOffset : 0,
@@ -1432,11 +1416,11 @@ function createListComponent(_ref) {
1432
1416
 
1433
1417
  this._callOnScroll(_scrollDirection, _scrollOffset, _scrollUpdateWasRequested);
1434
1418
  }
1435
- }; // Lazily create and cache item styles while scrolling,
1419
+ } // Lazily create and cache item styles while scrolling,
1436
1420
  // So that pure component sCU will prevent re-renders.
1437
1421
  // We maintain this cache, and pass a style prop rather than index,
1438
1422
  // So that List can clear cached styles and force item re-render if necessary.
1439
-
1423
+ ;
1440
1424
 
1441
1425
  _proto._getRangeToRender = function _getRangeToRender() {
1442
1426
  var _this$props5 = this.props,
@@ -1467,7 +1451,7 @@ function createListComponent(_ref) {
1467
1451
  layout: 'vertical',
1468
1452
  overscanCount: 2,
1469
1453
  useIsScrolling: false
1470
- }, _temp;
1454
+ }, _class;
1471
1455
  } // NOTE: I considered further wrapping individual items with a pure ListItem component.
1472
1456
  // This would avoid ever calling the render function for the same index more than once,
1473
1457
  // But it would also add the overhead of a lot of components/fibers.
@@ -1638,9 +1622,7 @@ var getEstimatedTotalSize = function getEstimatedTotalSize(_ref2, _ref3) {
1638
1622
  return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
1639
1623
  };
1640
1624
 
1641
- var VariableSizeList =
1642
- /*#__PURE__*/
1643
- createListComponent({
1625
+ var VariableSizeList = /*#__PURE__*/createListComponent({
1644
1626
  getItemOffset: function getItemOffset(props, index, instanceProps) {
1645
1627
  return getItemMetadata$1(props, index, instanceProps).offset;
1646
1628
  },
@@ -1757,9 +1739,7 @@ createListComponent({
1757
1739
  }
1758
1740
  });
1759
1741
 
1760
- var FixedSizeGrid =
1761
- /*#__PURE__*/
1762
- createGridComponent({
1742
+ var FixedSizeGrid = /*#__PURE__*/createGridComponent({
1763
1743
  getColumnOffset: function getColumnOffset(_ref, index) {
1764
1744
  var columnWidth = _ref.columnWidth;
1765
1745
  return index * columnWidth;
@@ -1937,9 +1917,7 @@ createGridComponent({
1937
1917
  }
1938
1918
  });
1939
1919
 
1940
- var FixedSizeList =
1941
- /*#__PURE__*/
1942
- createListComponent({
1920
+ var FixedSizeList = /*#__PURE__*/createListComponent({
1943
1921
  getItemOffset: function getItemOffset(_ref, index) {
1944
1922
  var itemSize = _ref.itemSize;
1945
1923
  return index * itemSize;
@@ -2061,15 +2039,17 @@ function shallowDiffers(prev, next) {
2061
2039
  return false;
2062
2040
  }
2063
2041
 
2042
+ var _excluded = ["style"],
2043
+ _excluded2 = ["style"];
2064
2044
  // It knows to compare individual style props and ignore the wrapper object.
2065
2045
  // See https://reactjs.org/docs/react-api.html#reactmemo
2066
2046
 
2067
2047
  function areEqual(prevProps, nextProps) {
2068
2048
  var prevStyle = prevProps.style,
2069
- prevRest = _objectWithoutPropertiesLoose(prevProps, ["style"]);
2049
+ prevRest = _objectWithoutPropertiesLoose(prevProps, _excluded);
2070
2050
 
2071
2051
  var nextStyle = nextProps.style,
2072
- nextRest = _objectWithoutPropertiesLoose(nextProps, ["style"]);
2052
+ nextRest = _objectWithoutPropertiesLoose(nextProps, _excluded2);
2073
2053
 
2074
2054
  return !shallowDiffers(prevStyle, nextStyle) && !shallowDiffers(prevRest, nextRest);
2075
2055
  }
@@ -2081,10 +2061,10 @@ function shouldComponentUpdate(nextProps, nextState) {
2081
2061
  return !areEqual(this.props, nextProps) || shallowDiffers(this.state, nextState);
2082
2062
  }
2083
2063
 
2084
- exports.VariableSizeGrid = VariableSizeGrid;
2085
- exports.VariableSizeList = VariableSizeList;
2086
2064
  exports.FixedSizeGrid = FixedSizeGrid;
2087
2065
  exports.FixedSizeList = FixedSizeList;
2066
+ exports.VariableSizeGrid = VariableSizeGrid;
2067
+ exports.VariableSizeList = VariableSizeList;
2088
2068
  exports.areEqual = areEqual;
2089
2069
  exports.shouldComponentUpdate = shouldComponentUpdate;
2090
2070
  //# sourceMappingURL=index.cjs.js.map