diff --git a/dist/grid.js b/dist/grid.js index 8fde121..13548cd 100644 --- a/dist/grid.js +++ b/dist/grid.js @@ -1,11 +1,11 @@ 'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + var _react = require('react'); var _react2 = _interopRequireDefault(_react); @@ -24,7 +24,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } -var InfiniteGrid = (function (_React$Component) { +var InfiniteGrid = function (_React$Component) { _inherits(InfiniteGrid, _React$Component); _createClass(InfiniteGrid, [{ @@ -63,15 +63,15 @@ var InfiniteGrid = (function (_React$Component) { function InfiniteGrid(props) { _classCallCheck(this, InfiniteGrid); - var _this2 = _possibleConstructorReturn(this, Object.getPrototypeOf(InfiniteGrid).call(this, props)); + var _this = _possibleConstructorReturn(this, (InfiniteGrid.__proto__ || Object.getPrototypeOf(InfiniteGrid)).call(this, props)); - _this2.state = _this2.initialState(); + _this.state = _this.initialState(); // bind the functions - _this2._scrollListener = _this2._scrollListener.bind(_this2); - _this2._updateItemDimensions = _this2._updateItemDimensions.bind(_this2); - _this2._resizeListener = _this2._resizeListener.bind(_this2); - _this2._visibleIndexes = _this2._visibleIndexes.bind(_this2); - return _this2; + _this._scrollListener = _this._scrollListener.bind(_this); + _this._updateItemDimensions = _this._updateItemDimensions.bind(_this); + _this._resizeListener = _this._resizeListener.bind(_this); + _this._visibleIndexes = _this._visibleIndexes.bind(_this); + return _this; } // METHODS @@ -105,7 +105,7 @@ var InfiniteGrid = (function (_React$Component) { }, { key: '_getGridHeight', value: function _getGridHeight() { - return Math.floor(this.props.entries.length / this.state.itemDimensions.itemsPerRow) * this.state.itemDimensions.height; + return this.props.entries.length < this.state.itemDimensions.itemsPerRow ? this.state.itemDimensions.height : Math.ceil(this.props.entries.length / this.state.itemDimensions.itemsPerRow) * this.state.itemDimensions.height; } }, { key: '_getWrapperRect', @@ -243,11 +243,11 @@ var InfiniteGrid = (function (_React$Component) { }, { key: '_scrollListener', value: function _scrollListener(event) { - var _this = this; + var _this2 = this; clearTimeout(this.scrollOffset); this.scrollOffset = setTimeout(function () { - _this._visibleIndexes(); + _this2._visibleIndexes(); }, 10); } }, { @@ -301,7 +301,7 @@ var InfiniteGrid = (function (_React$Component) { }]); return InfiniteGrid; -})(_react2.default.Component); +}(_react2.default.Component); exports.default = InfiniteGrid; ; diff --git a/dist/item.js b/dist/item.js index 794a998..3c65089 100644 --- a/dist/item.js +++ b/dist/item.js @@ -1,11 +1,11 @@ 'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + var _react = require('react'); var _react2 = _interopRequireDefault(_react); @@ -20,13 +20,13 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } -var Item = (function (_React$Component) { +var Item = function (_React$Component) { _inherits(Item, _React$Component); function Item(props) { _classCallCheck(this, Item); - return _possibleConstructorReturn(this, Object.getPrototypeOf(Item).call(this, props)); + return _possibleConstructorReturn(this, (Item.__proto__ || Object.getPrototypeOf(Item)).call(this, props)); } _createClass(Item, [{ @@ -85,6 +85,6 @@ var Item = (function (_React$Component) { }]); return Item; -})(_react2.default.Component); +}(_react2.default.Component); exports.default = Item; \ No newline at end of file diff --git a/package.json b/package.json index 161496c..e0ecb22 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "license": "MIT", "dependencies": { "lodash": "^3.10.1", - "react": "^0.14.2", - "react-dom": "^0.14.2" + "react": "^15.3.0", + "react-dom": "^15.3.0" }, "devDependencies": { "babel": "^6.1.18", diff --git a/src/grid.js b/src/grid.js index d66fc66..ebc5ac9 100644 --- a/src/grid.js +++ b/src/grid.js @@ -71,7 +71,7 @@ export default class InfiniteGrid extends React.Component { _getGridHeight() { return (this.props.entries.length < this.state.itemDimensions.itemsPerRow) ? this.state.itemDimensions.height : - Math.floor(this.props.entries.length / this.state.itemDimensions.itemsPerRow) * this.state.itemDimensions.height; + Math.ceil(this.props.entries.length / this.state.itemDimensions.itemsPerRow) * this.state.itemDimensions.height; } _getWrapperRect() {