Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-virtualized

Package Overview
Dependencies
Maintainers
1
Versions
296
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-virtualized - npm Package Compare versions

Comparing version 9.6.1 to 9.7.0

7

CHANGELOG.md
Changelog
------------
##### 9.6.0
* 🐛 Fixed an invalid import in a vendored file.
##### 9.7.0
* Added public animation-friendly API methods to `Grid`/`List`/`Table` for an alternative to props-based animating. ([@imadha](https://github.com/imadha) - [#641](https://github.com/bvaughn/react-virtualized/pull/641))
##### 9.6.1
* 🐛 Fixed module syntax error in vendered file.
##### 9.6.0

@@ -8,0 +11,0 @@ * 🎉 `WindowScroller` and `Grid` now support horizontal window-scrolling via new `autoWidth` property. ([@maxnowack](https://github.com/maxnowack) - [#644](https://github.com/bvaughn/react-virtualized/pull/644))

@@ -101,4 +101,2 @@ 'use strict';

_this._setScrollingContainerRef = _this._setScrollingContainerRef.bind(_this);
_this._updateScrollLeftForScrollToColumn = _this._updateScrollLeftForScrollToColumn.bind(_this);
_this._updateScrollTopForScrollToRow = _this._updateScrollTopForScrollToRow.bind(_this);

@@ -140,15 +138,42 @@ _this._columnWidthGetter = _this._wrapSizeGetter(props.columnWidth);

/**
* Invalidate Grid size and recompute visible cells.
* This is a deferred wrapper for recomputeGridSize().
* It sets a flag to be evaluated on cDM/cDU to avoid unnecessary renders.
* This method is intended for advanced use-cases like CellMeasurer.
* Gets offsets for a given cell and alignment.
*/
// @TODO (bvaughn) Add automated test coverage for this.
_createClass(Grid, [{
key: 'getOffsetForCell',
value: function getOffsetForCell() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$alignment = _ref.alignment,
alignment = _ref$alignment === undefined ? this.props.scrollToAlignment : _ref$alignment,
_ref$columnIndex = _ref.columnIndex,
columnIndex = _ref$columnIndex === undefined ? this.props.scrollToColumn : _ref$columnIndex,
_ref$rowIndex = _ref.rowIndex,
rowIndex = _ref$rowIndex === undefined ? this.props.scrollToRow : _ref$rowIndex;
var offsetProps = _extends({}, this.props, {
scrollToAlignment: alignment,
scrollToColumn: columnIndex,
scrollToRow: rowIndex
});
return {
scrollLeft: this._getCalculatedScrollLeft(offsetProps),
scrollTop: this._getCalculatedScrollTop(offsetProps)
};
}
/**
* Invalidate Grid size and recompute visible cells.
* This is a deferred wrapper for recomputeGridSize().
* It sets a flag to be evaluated on cDM/cDU to avoid unnecessary renders.
* This method is intended for advanced use-cases like CellMeasurer.
*/
// @TODO (bvaughn) Add automated test coverage for this.
}, {
key: 'invalidateCellSizeAfterRender',
value: function invalidateCellSizeAfterRender(_ref) {
var columnIndex = _ref.columnIndex,
rowIndex = _ref.rowIndex;
value: function invalidateCellSizeAfterRender(_ref2) {
var columnIndex = _ref2.columnIndex,
rowIndex = _ref2.rowIndex;

@@ -186,7 +211,7 @@ this._deferredInvalidateColumnIndex = typeof this._deferredInvalidateColumnIndex === 'number' ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex;

value: function recomputeGridSize() {
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref2$columnIndex = _ref2.columnIndex,
columnIndex = _ref2$columnIndex === undefined ? 0 : _ref2$columnIndex,
_ref2$rowIndex = _ref2.rowIndex,
rowIndex = _ref2$rowIndex === undefined ? 0 : _ref2$rowIndex;
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref3$columnIndex = _ref3.columnIndex,
columnIndex = _ref3$columnIndex === undefined ? 0 : _ref3$columnIndex,
_ref3$rowIndex = _ref3.rowIndex,
rowIndex = _ref3$rowIndex === undefined ? 0 : _ref3$rowIndex;

@@ -221,5 +246,5 @@ var _props2 = this.props,

key: 'scrollToCell',
value: function scrollToCell(_ref3) {
var columnIndex = _ref3.columnIndex,
rowIndex = _ref3.rowIndex;
value: function scrollToCell(_ref4) {
var columnIndex = _ref4.columnIndex,
rowIndex = _ref4.rowIndex;
var columnCount = this.props.columnCount;

@@ -242,3 +267,18 @@

}
/**
* Scroll to the specified offset(s).
* Useful for animating position changes.
*/
}, {
key: 'scrollToPosition',
value: function scrollToPosition() {
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
scrollLeft = _ref5.scrollLeft,
scrollTop = _ref5.scrollTop;
this._setScrollPosition({ scrollLeft: scrollLeft, scrollTop: scrollTop });
}
}, {
key: 'componentDidMount',

@@ -800,14 +840,14 @@ value: function componentDidMount() {

key: '_invokeOnScrollMemoizer',
value: function _invokeOnScrollMemoizer(_ref4) {
value: function _invokeOnScrollMemoizer(_ref6) {
var _this4 = this;
var scrollLeft = _ref4.scrollLeft,
scrollTop = _ref4.scrollTop,
totalColumnsWidth = _ref4.totalColumnsWidth,
totalRowsHeight = _ref4.totalRowsHeight;
var scrollLeft = _ref6.scrollLeft,
scrollTop = _ref6.scrollTop,
totalColumnsWidth = _ref6.totalColumnsWidth,
totalRowsHeight = _ref6.totalRowsHeight;
this._onScrollMemoizer({
callback: function callback(_ref5) {
var scrollLeft = _ref5.scrollLeft,
scrollTop = _ref5.scrollTop;
callback: function callback(_ref7) {
var scrollLeft = _ref7.scrollLeft,
scrollTop = _ref7.scrollTop;
var _props7 = _this4.props,

@@ -851,5 +891,5 @@ height = _props7.height,

key: '_setScrollPosition',
value: function _setScrollPosition(_ref6) {
var scrollLeft = _ref6.scrollLeft,
scrollTop = _ref6.scrollTop;
value: function _setScrollPosition(_ref8) {
var scrollLeft = _ref8.scrollLeft,
scrollTop = _ref8.scrollTop;

@@ -887,4 +927,4 @@ var newState = {

}, {
key: '_updateScrollLeftForScrollToColumn',
value: function _updateScrollLeftForScrollToColumn() {
key: '_getCalculatedScrollLeft',
value: function _getCalculatedScrollLeft() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;

@@ -905,3 +945,3 @@ var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;

var calculatedScrollLeft = this._columnSizeAndPositionManager.getUpdatedOffsetForIndex({
return this._columnSizeAndPositionManager.getUpdatedOffsetForIndex({
align: scrollToAlignment,

@@ -912,13 +952,22 @@ containerSize: width - scrollBarSize,

});
}
}
}, {
key: '_updateScrollLeftForScrollToColumn',
value: function _updateScrollLeftForScrollToColumn() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;
var scrollLeft = state.scrollLeft;
if (scrollLeft !== calculatedScrollLeft) {
this._setScrollPosition({
scrollLeft: calculatedScrollLeft
});
}
var calculatedScrollLeft = this._getCalculatedScrollLeft(props, state);
if (calculatedScrollLeft >= 0 && scrollLeft !== calculatedScrollLeft) {
this._setScrollPosition({
scrollLeft: calculatedScrollLeft
});
}
}
}, {
key: '_updateScrollTopForScrollToRow',
value: function _updateScrollTopForScrollToRow() {
key: '_getCalculatedScrollTop',
value: function _getCalculatedScrollTop() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;

@@ -939,3 +988,3 @@ var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;

var calculatedScrollTop = this._rowSizeAndPositionManager.getUpdatedOffsetForIndex({
return this._rowSizeAndPositionManager.getUpdatedOffsetForIndex({
align: scrollToAlignment,

@@ -946,8 +995,17 @@ containerSize: height - scrollBarSize,

});
}
}
}, {
key: '_updateScrollTopForScrollToRow',
value: function _updateScrollTopForScrollToRow() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;
var scrollTop = state.scrollTop;
if (scrollTop !== calculatedScrollTop) {
this._setScrollPosition({
scrollTop: calculatedScrollTop
});
}
var calculatedScrollTop = this._getCalculatedScrollTop(props, state);
if (calculatedScrollTop >= 0 && scrollTop !== calculatedScrollTop) {
this._setScrollPosition({
scrollTop: calculatedScrollTop
});
}

@@ -954,0 +1012,0 @@ }

@@ -92,2 +92,14 @@ 'use strict';

describe('scrollToPosition', function () {
it('should scroll to the top', function () {
var instance = (0, _TestUtils.render)(getMarkup({
rowHeight: 10
}));
instance.scrollToPosition(100);
var rendered = (0, _reactDom.findDOMNode)(instance);
expect(rendered.textContent).toContain('Name 10');
expect(rendered.textContent).toContain('Name 19');
});
});
/** Tests scrolling via initial props */

@@ -94,0 +106,0 @@ describe('scrollToIndex', function () {

@@ -82,2 +82,29 @@ 'use strict';

/** See Grid#getOffsetForCell */
}, {
key: 'getOffsetForRow',
value: function getOffsetForRow(_ref) {
var alignment = _ref.alignment,
index = _ref.index;
var _Grid$getOffsetForCel = this.Grid.getOffsetForCell({
alignment: alignment,
rowIndex: index
}),
scrollTop = _Grid$getOffsetForCel.scrollTop;
return scrollTop;
}
/** See Grid#scrollToPosition */
}, {
key: 'scrollToPosition',
value: function scrollToPosition() {
var scrollTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
this.Grid.scrollToPosition({ scrollTop: scrollTop });
}
/** See Grid#scrollToCell */

@@ -122,6 +149,6 @@

key: '_cellRenderer',
value: function _cellRenderer(_ref) {
var rowIndex = _ref.rowIndex,
style = _ref.style,
rest = _objectWithoutProperties(_ref, ['rowIndex', 'style']);
value: function _cellRenderer(_ref2) {
var rowIndex = _ref2.rowIndex,
style = _ref2.style,
rest = _objectWithoutProperties(_ref2, ['rowIndex', 'style']);

@@ -157,6 +184,6 @@ var rowRenderer = this.props.rowRenderer;

key: '_onScroll',
value: function _onScroll(_ref2) {
var clientHeight = _ref2.clientHeight,
scrollHeight = _ref2.scrollHeight,
scrollTop = _ref2.scrollTop;
value: function _onScroll(_ref3) {
var clientHeight = _ref3.clientHeight,
scrollHeight = _ref3.scrollHeight,
scrollTop = _ref3.scrollTop;
var onScroll = this.props.onScroll;

@@ -169,7 +196,7 @@

key: '_onSectionRendered',
value: function _onSectionRendered(_ref3) {
var rowOverscanStartIndex = _ref3.rowOverscanStartIndex,
rowOverscanStopIndex = _ref3.rowOverscanStopIndex,
rowStartIndex = _ref3.rowStartIndex,
rowStopIndex = _ref3.rowStopIndex;
value: function _onSectionRendered(_ref4) {
var rowOverscanStartIndex = _ref4.rowOverscanStartIndex,
rowOverscanStopIndex = _ref4.rowOverscanStopIndex,
rowStartIndex = _ref4.rowStartIndex,
rowStopIndex = _ref4.rowStopIndex;
var onRowsRendered = this.props.onRowsRendered;

@@ -176,0 +203,0 @@

@@ -79,2 +79,19 @@ 'use strict';

/** See Grid#getOffsetForCell */
}, {
key: 'getOffsetForRow',
value: function getOffsetForRow(_ref) {
var alignment = _ref.alignment,
index = _ref.index;
var _Grid$getOffsetForCel = this.Grid.getOffsetForCell({
alignment: alignment,
rowIndex: index
}),
scrollTop = _Grid$getOffsetForCel.scrollTop;
return scrollTop;
}
/** See Grid#measureAllCells */

@@ -100,2 +117,12 @@

/** See Grid#scrollToPosition */
}, {
key: 'scrollToPosition',
value: function scrollToPosition() {
var scrollTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
this.Grid.scrollToPosition({ scrollTop: scrollTop });
}
/** See Grid#scrollToCell */

@@ -206,9 +233,9 @@

key: '_createColumn',
value: function _createColumn(_ref) {
var column = _ref.column,
columnIndex = _ref.columnIndex,
isScrolling = _ref.isScrolling,
parent = _ref.parent,
rowData = _ref.rowData,
rowIndex = _ref.rowIndex;
value: function _createColumn(_ref2) {
var column = _ref2.column,
columnIndex = _ref2.columnIndex,
isScrolling = _ref2.isScrolling,
parent = _ref2.parent,
rowData = _ref2.rowData,
rowIndex = _ref2.rowIndex;
var _column$props = column.props,

@@ -242,5 +269,5 @@ cellDataGetter = _column$props.cellDataGetter,

key: '_createHeader',
value: function _createHeader(_ref2) {
var column = _ref2.column,
index = _ref2.index;
value: function _createHeader(_ref3) {
var column = _ref3.column,
index = _ref3.index;
var _props2 = this.props,

@@ -317,10 +344,10 @@ headerClassName = _props2.headerClassName,

key: '_createRow',
value: function _createRow(_ref3) {
value: function _createRow(_ref4) {
var _this3 = this;
var index = _ref3.rowIndex,
isScrolling = _ref3.isScrolling,
key = _ref3.key,
parent = _ref3.parent,
style = _ref3.style;
var index = _ref4.rowIndex,
isScrolling = _ref4.isScrolling,
key = _ref4.key,
parent = _ref4.parent,
style = _ref4.style;
var _props3 = this.props,

@@ -429,6 +456,6 @@ children = _props3.children,

key: '_onScroll',
value: function _onScroll(_ref4) {
var clientHeight = _ref4.clientHeight,
scrollHeight = _ref4.scrollHeight,
scrollTop = _ref4.scrollTop;
value: function _onScroll(_ref5) {
var clientHeight = _ref5.clientHeight,
scrollHeight = _ref5.scrollHeight,
scrollTop = _ref5.scrollTop;
var onScroll = this.props.onScroll;

@@ -441,7 +468,7 @@

key: '_onSectionRendered',
value: function _onSectionRendered(_ref5) {
var rowOverscanStartIndex = _ref5.rowOverscanStartIndex,
rowOverscanStopIndex = _ref5.rowOverscanStopIndex,
rowStartIndex = _ref5.rowStartIndex,
rowStopIndex = _ref5.rowStopIndex;
value: function _onSectionRendered(_ref6) {
var rowOverscanStartIndex = _ref6.rowOverscanStartIndex,
rowOverscanStopIndex = _ref6.rowOverscanStopIndex,
rowStartIndex = _ref6.rowStartIndex,
rowStopIndex = _ref6.rowStopIndex;
var onRowsRendered = this.props.onRowsRendered;

@@ -448,0 +475,0 @@

@@ -62,4 +62,2 @@ import _extends from 'babel-runtime/helpers/extends';

_this._setScrollingContainerRef = _this._setScrollingContainerRef.bind(_this);
_this._updateScrollLeftForScrollToColumn = _this._updateScrollLeftForScrollToColumn.bind(_this);
_this._updateScrollTopForScrollToRow = _this._updateScrollTopForScrollToRow.bind(_this);

@@ -101,15 +99,42 @@ _this._columnWidthGetter = _this._wrapSizeGetter(props.columnWidth);

/**
* Invalidate Grid size and recompute visible cells.
* This is a deferred wrapper for recomputeGridSize().
* It sets a flag to be evaluated on cDM/cDU to avoid unnecessary renders.
* This method is intended for advanced use-cases like CellMeasurer.
* Gets offsets for a given cell and alignment.
*/
// @TODO (bvaughn) Add automated test coverage for this.
_createClass(Grid, [{
key: 'getOffsetForCell',
value: function getOffsetForCell() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$alignment = _ref.alignment,
alignment = _ref$alignment === undefined ? this.props.scrollToAlignment : _ref$alignment,
_ref$columnIndex = _ref.columnIndex,
columnIndex = _ref$columnIndex === undefined ? this.props.scrollToColumn : _ref$columnIndex,
_ref$rowIndex = _ref.rowIndex,
rowIndex = _ref$rowIndex === undefined ? this.props.scrollToRow : _ref$rowIndex;
var offsetProps = _extends({}, this.props, {
scrollToAlignment: alignment,
scrollToColumn: columnIndex,
scrollToRow: rowIndex
});
return {
scrollLeft: this._getCalculatedScrollLeft(offsetProps),
scrollTop: this._getCalculatedScrollTop(offsetProps)
};
}
/**
* Invalidate Grid size and recompute visible cells.
* This is a deferred wrapper for recomputeGridSize().
* It sets a flag to be evaluated on cDM/cDU to avoid unnecessary renders.
* This method is intended for advanced use-cases like CellMeasurer.
*/
// @TODO (bvaughn) Add automated test coverage for this.
}, {
key: 'invalidateCellSizeAfterRender',
value: function invalidateCellSizeAfterRender(_ref) {
var columnIndex = _ref.columnIndex,
rowIndex = _ref.rowIndex;
value: function invalidateCellSizeAfterRender(_ref2) {
var columnIndex = _ref2.columnIndex,
rowIndex = _ref2.rowIndex;

@@ -147,7 +172,7 @@ this._deferredInvalidateColumnIndex = typeof this._deferredInvalidateColumnIndex === 'number' ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex;

value: function recomputeGridSize() {
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref2$columnIndex = _ref2.columnIndex,
columnIndex = _ref2$columnIndex === undefined ? 0 : _ref2$columnIndex,
_ref2$rowIndex = _ref2.rowIndex,
rowIndex = _ref2$rowIndex === undefined ? 0 : _ref2$rowIndex;
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref3$columnIndex = _ref3.columnIndex,
columnIndex = _ref3$columnIndex === undefined ? 0 : _ref3$columnIndex,
_ref3$rowIndex = _ref3.rowIndex,
rowIndex = _ref3$rowIndex === undefined ? 0 : _ref3$rowIndex;

@@ -182,5 +207,5 @@ var _props2 = this.props,

key: 'scrollToCell',
value: function scrollToCell(_ref3) {
var columnIndex = _ref3.columnIndex,
rowIndex = _ref3.rowIndex;
value: function scrollToCell(_ref4) {
var columnIndex = _ref4.columnIndex,
rowIndex = _ref4.rowIndex;
var columnCount = this.props.columnCount;

@@ -203,3 +228,18 @@

}
/**
* Scroll to the specified offset(s).
* Useful for animating position changes.
*/
}, {
key: 'scrollToPosition',
value: function scrollToPosition() {
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
scrollLeft = _ref5.scrollLeft,
scrollTop = _ref5.scrollTop;
this._setScrollPosition({ scrollLeft: scrollLeft, scrollTop: scrollTop });
}
}, {
key: 'componentDidMount',

@@ -761,14 +801,14 @@ value: function componentDidMount() {

key: '_invokeOnScrollMemoizer',
value: function _invokeOnScrollMemoizer(_ref4) {
value: function _invokeOnScrollMemoizer(_ref6) {
var _this4 = this;
var scrollLeft = _ref4.scrollLeft,
scrollTop = _ref4.scrollTop,
totalColumnsWidth = _ref4.totalColumnsWidth,
totalRowsHeight = _ref4.totalRowsHeight;
var scrollLeft = _ref6.scrollLeft,
scrollTop = _ref6.scrollTop,
totalColumnsWidth = _ref6.totalColumnsWidth,
totalRowsHeight = _ref6.totalRowsHeight;
this._onScrollMemoizer({
callback: function callback(_ref5) {
var scrollLeft = _ref5.scrollLeft,
scrollTop = _ref5.scrollTop;
callback: function callback(_ref7) {
var scrollLeft = _ref7.scrollLeft,
scrollTop = _ref7.scrollTop;
var _props7 = _this4.props,

@@ -812,5 +852,5 @@ height = _props7.height,

key: '_setScrollPosition',
value: function _setScrollPosition(_ref6) {
var scrollLeft = _ref6.scrollLeft,
scrollTop = _ref6.scrollTop;
value: function _setScrollPosition(_ref8) {
var scrollLeft = _ref8.scrollLeft,
scrollTop = _ref8.scrollTop;

@@ -848,4 +888,4 @@ var newState = {

}, {
key: '_updateScrollLeftForScrollToColumn',
value: function _updateScrollLeftForScrollToColumn() {
key: '_getCalculatedScrollLeft',
value: function _getCalculatedScrollLeft() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;

@@ -866,3 +906,3 @@ var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;

var calculatedScrollLeft = this._columnSizeAndPositionManager.getUpdatedOffsetForIndex({
return this._columnSizeAndPositionManager.getUpdatedOffsetForIndex({
align: scrollToAlignment,

@@ -873,13 +913,22 @@ containerSize: width - scrollBarSize,

});
}
}
}, {
key: '_updateScrollLeftForScrollToColumn',
value: function _updateScrollLeftForScrollToColumn() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;
var scrollLeft = state.scrollLeft;
if (scrollLeft !== calculatedScrollLeft) {
this._setScrollPosition({
scrollLeft: calculatedScrollLeft
});
}
var calculatedScrollLeft = this._getCalculatedScrollLeft(props, state);
if (calculatedScrollLeft >= 0 && scrollLeft !== calculatedScrollLeft) {
this._setScrollPosition({
scrollLeft: calculatedScrollLeft
});
}
}
}, {
key: '_updateScrollTopForScrollToRow',
value: function _updateScrollTopForScrollToRow() {
key: '_getCalculatedScrollTop',
value: function _getCalculatedScrollTop() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;

@@ -900,3 +949,3 @@ var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;

var calculatedScrollTop = this._rowSizeAndPositionManager.getUpdatedOffsetForIndex({
return this._rowSizeAndPositionManager.getUpdatedOffsetForIndex({
align: scrollToAlignment,

@@ -907,8 +956,17 @@ containerSize: height - scrollBarSize,

});
}
}
}, {
key: '_updateScrollTopForScrollToRow',
value: function _updateScrollTopForScrollToRow() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;
var scrollTop = state.scrollTop;
if (scrollTop !== calculatedScrollTop) {
this._setScrollPosition({
scrollTop: calculatedScrollTop
});
}
var calculatedScrollTop = this._getCalculatedScrollTop(props, state);
if (calculatedScrollTop >= 0 && scrollTop !== calculatedScrollTop) {
this._setScrollPosition({
scrollTop: calculatedScrollTop
});
}

@@ -915,0 +973,0 @@ }

@@ -75,2 +75,14 @@ import _extends from 'babel-runtime/helpers/extends';

describe('scrollToPosition', function () {
it('should scroll to the top', function () {
var instance = render(getMarkup({
rowHeight: 10
}));
instance.scrollToPosition(100);
var rendered = findDOMNode(instance);
expect(rendered.textContent).toContain('Name 10');
expect(rendered.textContent).toContain('Name 19');
});
});
/** Tests scrolling via initial props */

@@ -77,0 +89,0 @@ describe('scrollToIndex', function () {

@@ -63,2 +63,29 @@ import _Object$getOwnPropertyDescriptor from 'babel-runtime/core-js/object/get-own-property-descriptor';

/** See Grid#getOffsetForCell */
}, {
key: 'getOffsetForRow',
value: function getOffsetForRow(_ref) {
var alignment = _ref.alignment,
index = _ref.index;
var _Grid$getOffsetForCel = this.Grid.getOffsetForCell({
alignment: alignment,
rowIndex: index
}),
scrollTop = _Grid$getOffsetForCel.scrollTop;
return scrollTop;
}
/** See Grid#scrollToPosition */
}, {
key: 'scrollToPosition',
value: function scrollToPosition() {
var scrollTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
this.Grid.scrollToPosition({ scrollTop: scrollTop });
}
/** See Grid#scrollToCell */

@@ -103,6 +130,6 @@

key: '_cellRenderer',
value: function _cellRenderer(_ref) {
var rowIndex = _ref.rowIndex,
style = _ref.style,
rest = _objectWithoutProperties(_ref, ['rowIndex', 'style']);
value: function _cellRenderer(_ref2) {
var rowIndex = _ref2.rowIndex,
style = _ref2.style,
rest = _objectWithoutProperties(_ref2, ['rowIndex', 'style']);

@@ -138,6 +165,6 @@ var rowRenderer = this.props.rowRenderer;

key: '_onScroll',
value: function _onScroll(_ref2) {
var clientHeight = _ref2.clientHeight,
scrollHeight = _ref2.scrollHeight,
scrollTop = _ref2.scrollTop;
value: function _onScroll(_ref3) {
var clientHeight = _ref3.clientHeight,
scrollHeight = _ref3.scrollHeight,
scrollTop = _ref3.scrollTop;
var onScroll = this.props.onScroll;

@@ -150,7 +177,7 @@

key: '_onSectionRendered',
value: function _onSectionRendered(_ref3) {
var rowOverscanStartIndex = _ref3.rowOverscanStartIndex,
rowOverscanStopIndex = _ref3.rowOverscanStopIndex,
rowStartIndex = _ref3.rowStartIndex,
rowStopIndex = _ref3.rowStopIndex;
value: function _onSectionRendered(_ref4) {
var rowOverscanStartIndex = _ref4.rowOverscanStartIndex,
rowOverscanStopIndex = _ref4.rowOverscanStopIndex,
rowStartIndex = _ref4.rowStartIndex,
rowStopIndex = _ref4.rowStopIndex;
var onRowsRendered = this.props.onRowsRendered;

@@ -157,0 +184,0 @@

@@ -47,2 +47,19 @@ import _extends from 'babel-runtime/helpers/extends';

/** See Grid#getOffsetForCell */
}, {
key: 'getOffsetForRow',
value: function getOffsetForRow(_ref) {
var alignment = _ref.alignment,
index = _ref.index;
var _Grid$getOffsetForCel = this.Grid.getOffsetForCell({
alignment: alignment,
rowIndex: index
}),
scrollTop = _Grid$getOffsetForCel.scrollTop;
return scrollTop;
}
/** See Grid#measureAllCells */

@@ -68,2 +85,12 @@

/** See Grid#scrollToPosition */
}, {
key: 'scrollToPosition',
value: function scrollToPosition() {
var scrollTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
this.Grid.scrollToPosition({ scrollTop: scrollTop });
}
/** See Grid#scrollToCell */

@@ -174,9 +201,9 @@

key: '_createColumn',
value: function _createColumn(_ref) {
var column = _ref.column,
columnIndex = _ref.columnIndex,
isScrolling = _ref.isScrolling,
parent = _ref.parent,
rowData = _ref.rowData,
rowIndex = _ref.rowIndex;
value: function _createColumn(_ref2) {
var column = _ref2.column,
columnIndex = _ref2.columnIndex,
isScrolling = _ref2.isScrolling,
parent = _ref2.parent,
rowData = _ref2.rowData,
rowIndex = _ref2.rowIndex;
var _column$props = column.props,

@@ -210,5 +237,5 @@ cellDataGetter = _column$props.cellDataGetter,

key: '_createHeader',
value: function _createHeader(_ref2) {
var column = _ref2.column,
index = _ref2.index;
value: function _createHeader(_ref3) {
var column = _ref3.column,
index = _ref3.index;
var _props2 = this.props,

@@ -285,10 +312,10 @@ headerClassName = _props2.headerClassName,

key: '_createRow',
value: function _createRow(_ref3) {
value: function _createRow(_ref4) {
var _this3 = this;
var index = _ref3.rowIndex,
isScrolling = _ref3.isScrolling,
key = _ref3.key,
parent = _ref3.parent,
style = _ref3.style;
var index = _ref4.rowIndex,
isScrolling = _ref4.isScrolling,
key = _ref4.key,
parent = _ref4.parent,
style = _ref4.style;
var _props3 = this.props,

@@ -397,6 +424,6 @@ children = _props3.children,

key: '_onScroll',
value: function _onScroll(_ref4) {
var clientHeight = _ref4.clientHeight,
scrollHeight = _ref4.scrollHeight,
scrollTop = _ref4.scrollTop;
value: function _onScroll(_ref5) {
var clientHeight = _ref5.clientHeight,
scrollHeight = _ref5.scrollHeight,
scrollTop = _ref5.scrollTop;
var onScroll = this.props.onScroll;

@@ -409,7 +436,7 @@

key: '_onSectionRendered',
value: function _onSectionRendered(_ref5) {
var rowOverscanStartIndex = _ref5.rowOverscanStartIndex,
rowOverscanStopIndex = _ref5.rowOverscanStopIndex,
rowStartIndex = _ref5.rowStartIndex,
rowStopIndex = _ref5.rowStopIndex;
value: function _onSectionRendered(_ref6) {
var rowOverscanStartIndex = _ref6.rowOverscanStartIndex,
rowOverscanStopIndex = _ref6.rowOverscanStopIndex,
rowStartIndex = _ref6.rowStartIndex,
rowStopIndex = _ref6.rowStopIndex;
var onRowsRendered = this.props.onRowsRendered;

@@ -416,0 +443,0 @@

@@ -6,3 +6,3 @@ {

"user": "bvaughn",
"version": "9.6.1",
"version": "9.7.0",
"homepage": "https://github.com/bvaughn/react-virtualized",

@@ -9,0 +9,0 @@ "main": "dist/commonjs/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc