Skip to content

Commit 40340b0

Browse files
committed
Built 5.5.6 release
1 parent 81f4951 commit 40340b0

6 files changed

Lines changed: 96 additions & 44 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
------------
33

4+
##### 5.5.6
5+
Max scroll position logic in `Grid` now takes scrollbar size into consideration.
6+
Also includes a small `render` optimization for null cells.
7+
This release made possible by @jquense!
8+
49
##### 5.5.5
510
Updated `package.json` to support React `^0.14.0` as well as `^15.0.0-rc.1`.
611
Thanks to @opichals for the PR.

dist/commonjs/Grid/Grid.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ var _raf = require('raf');
1616

1717
var _raf2 = _interopRequireDefault(_raf);
1818

19+
var _scrollbarSize = require('dom-helpers/util/scrollbarSize');
20+
21+
var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
22+
1923
var _react = require('react');
2024

2125
var _react2 = _interopRequireDefault(_react);
@@ -154,6 +158,8 @@ var Grid = function (_Component) {
154158
var scrollToRow = _props.scrollToRow;
155159

156160

161+
this._scrollbarSize = (0, _scrollbarSize2.default)();
162+
157163
if (scrollLeft >= 0 || scrollTop >= 0) {
158164
this.setScrollPosition({ scrollLeft: scrollLeft, scrollTop: scrollTop });
159165
}
@@ -374,6 +380,13 @@ var Grid = function (_Component) {
374380
var columnDatum = this._columnMetadata[columnIndex];
375381
var renderedCell = renderCell({ columnIndex: columnIndex, rowIndex: rowIndex });
376382
var key = rowIndex + '-' + columnIndex;
383+
384+
// any other falsey value will be rendered
385+
// as a text node by React
386+
if (renderedCell == null || renderedCell === false) {
387+
continue;
388+
}
389+
377390
var child = _react2.default.createElement(
378391
'div',
379392
{
@@ -718,10 +731,11 @@ var Grid = function (_Component) {
718731
var height = _props6.height;
719732
var width = _props6.width;
720733

734+
var scrollbarSize = this._scrollbarSize;
721735
var totalRowsHeight = this._getTotalRowsHeight();
722736
var totalColumnsWidth = this._getTotalColumnsWidth();
723-
var scrollLeft = Math.min(totalColumnsWidth - width, event.target.scrollLeft);
724-
var scrollTop = Math.min(totalRowsHeight - height, event.target.scrollTop);
737+
var scrollLeft = Math.min(totalColumnsWidth - width + scrollbarSize, event.target.scrollLeft);
738+
var scrollTop = Math.min(totalRowsHeight - height + scrollbarSize, event.target.scrollTop);
725739

726740
// Certain devices (like Apple touchpad) rapid-fire duplicate events.
727741
// Don't force a re-render if this is the case.

dist/es/Grid/Grid.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { computeCellMetadataAndUpdateScrollOffsetHelper, createCallbackMemoizer, getOverscanIndices, getUpdatedOffsetForIndex, getVisibleCellIndices, initCellMetadata, updateScrollIndexHelper } from '../utils';
33
import cn from 'classnames';
44
import raf from 'raf';
5+
import getScrollbarSize from 'dom-helpers/util/scrollbarSize';
56
import React, { Component, PropTypes } from 'react';
67
import shouldPureComponentUpdate from 'react-pure-render/function';
78

@@ -127,6 +128,8 @@ var Grid = function (_Component) {
127128
var scrollToRow = _props.scrollToRow;
128129

129130

131+
this._scrollbarSize = getScrollbarSize();
132+
130133
if (scrollLeft >= 0 || scrollTop >= 0) {
131134
this.setScrollPosition({ scrollLeft: scrollLeft, scrollTop: scrollTop });
132135
}
@@ -347,6 +350,13 @@ var Grid = function (_Component) {
347350
var columnDatum = this._columnMetadata[columnIndex];
348351
var renderedCell = renderCell({ columnIndex: columnIndex, rowIndex: rowIndex });
349352
var key = rowIndex + '-' + columnIndex;
353+
354+
// any other falsey value will be rendered
355+
// as a text node by React
356+
if (renderedCell == null || renderedCell === false) {
357+
continue;
358+
}
359+
350360
var child = React.createElement(
351361
'div',
352362
{
@@ -691,10 +701,11 @@ var Grid = function (_Component) {
691701
var height = _props6.height;
692702
var width = _props6.width;
693703

704+
var scrollbarSize = this._scrollbarSize;
694705
var totalRowsHeight = this._getTotalRowsHeight();
695706
var totalColumnsWidth = this._getTotalColumnsWidth();
696-
var scrollLeft = Math.min(totalColumnsWidth - width, event.target.scrollLeft);
697-
var scrollTop = Math.min(totalRowsHeight - height, event.target.scrollTop);
707+
var scrollLeft = Math.min(totalColumnsWidth - width + scrollbarSize, event.target.scrollLeft);
708+
var scrollTop = Math.min(totalRowsHeight - height + scrollbarSize, event.target.scrollTop);
698709

699710
// Certain devices (like Apple touchpad) rapid-fire duplicate events.
700711
// Don't force a re-render if this is the case.

0 commit comments

Comments
 (0)