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

react-infinite-list

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-infinite-list - npm Package Compare versions

Comparing version 0.2.3 to 0.2.5

9

CHANGELOG.md

@@ -0,1 +1,10 @@

## v0.2.5 (2015-07-9)
Fixed library build. Removed item from module to main file, due to the babel transpile issues.
## v0.2.4 (2015-07-9)
Fixed maximum padding problem.
Thanks voy!
This release is broken due to changes in v0.2.3. Please discard
## v0.2.3 (2015-06-30)

@@ -2,0 +11,0 @@

124

dist/react-infinite-list.js

@@ -57,10 +57,10 @@ (function webpackUniversalModuleDefinition(root, factory) {

/* WEBPACK VAR INJECTION */(function(React) {"use strict";
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _inherits = function (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) subClass.__proto__ = superClass; };

@@ -72,12 +72,6 @@

var _react = __webpack_require__(1);
var React = _interopRequire(__webpack_require__(1));
var findDOMNode = _react.findDOMNode;
var PropTypes = _react.PropTypes;
var Component = _react.Component;
var classnames = _interopRequire(__webpack_require__(2));
var classnames = _interopRequire(__webpack_require__(3));
var InfiniteListItem = _interopRequire(__webpack_require__(2));
var isWebkit = /WebKit/.test(navigator && navigator.userAgent || "");

@@ -89,3 +83,34 @@

var InfiniteList = (function (_Component) {
var InfiniteListItem = (function (_React$Component) {
function InfiniteListItem() {
_classCallCheck(this, InfiniteListItem);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(InfiniteListItem, _React$Component);
_createClass(InfiniteListItem, {
render: {
value: function render() {
return React.createElement(
"div",
{ key: this.props.id, className: "infinite-list-item" },
this.props.title
);
}
}
});
return InfiniteListItem;
})(React.Component);
InfiniteListItem.propTypes = {
title: React.PropTypes.string.isRequired,
id: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]).isRequired
};
var InfiniteList = (function (_React$Component2) {
function InfiniteList(props) {

@@ -100,3 +125,3 @@ _classCallCheck(this, InfiniteList);

_inherits(InfiniteList, _Component);
_inherits(InfiniteList, _React$Component2);

@@ -132,3 +157,3 @@ _createClass(InfiniteList, {

value: function _calculateVisibleItems() {
var scrolledPx = findDOMNode(this).scrollTop;
var scrolledPx = React.findDOMNode(this).scrollTop;

@@ -149,3 +174,3 @@ var visibleStart = Math.floor(scrolledPx / this.props.itemHeight);

if (itemsChanged) {
findDOMNode(this).scrollTop = 0;
React.findDOMNode(this).scrollTop = 0;
}

@@ -184,3 +209,4 @@

var padding = this.state.renderedStart * itemHeight;
var maxPadding = totalHeight - numOfVisibleItems * itemHeight + itemHeight;
// if maximum number of items on page is larger than actual number of items, maxPadding can be < 0
var maxPadding = Math.max(0, totalHeight - numOfVisibleItems * itemHeight + itemHeight);
var paddingTop = Math.min(maxPadding, padding);

@@ -205,3 +231,3 @@

return InfiniteList;
})(Component);
})(React.Component);

@@ -211,7 +237,6 @@ module.exports = InfiniteList;

InfiniteList.propTypes = {
items: PropTypes.array.isRequired,
height: PropTypes.number.isRequired,
itemHeight: PropTypes.number.isRequired
items: React.PropTypes.array.isRequired,
height: React.PropTypes.number.isRequired,
itemHeight: React.PropTypes.number.isRequired
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))

@@ -228,53 +253,2 @@ /***/ },

/* WEBPACK VAR INJECTION */(function(React) {"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var _react = __webpack_require__(1);
var PropTypes = _react.PropTypes;
var Component = _react.Component;
var InfiniteListItem = (function (_Component) {
function InfiniteListItem() {
_classCallCheck(this, InfiniteListItem);
if (_Component != null) {
_Component.apply(this, arguments);
}
}
_inherits(InfiniteListItem, _Component);
_createClass(InfiniteListItem, {
render: {
value: function render() {
return React.createElement(
"div",
{ key: this.props.id, className: "infinite-list-item" },
this.props.title
);
}
}
});
return InfiniteListItem;
})(Component);
module.exports = InfiniteListItem;
InfiniteListItem.propTypes = {
title: PropTypes.string.isRequired,
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*!

@@ -317,3 +291,5 @@ Copyright (c) 2015 Jed Watson.

if (true) {
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true){
// AMD. Register as an anonymous module.

@@ -323,4 +299,2 @@ !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {

}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else {

@@ -327,0 +301,0 @@ window.classNames = classNames;

@@ -1,1 +0,6 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-infinite-list"]=t(require("react")):e["react-infinite-list"]=t(e.React)}(this,function(e){return function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){"use strict";function n(){return window.matchMedia&&(window.matchMedia("only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)").matches||window.matchMedia("only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)").matches)||window.devicePixelRatio&&window.devicePixelRatio>1.3}var r=function(e){return e&&e.__esModule?e["default"]:e},o=function f(e,t,i){var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var r=Object.getPrototypeOf(e);return null===r?void 0:f(r,t,i)}if("value"in n&&n.writable)return n.value;var o=n.get;return void 0===o?void 0:o.call(i)},s=function(){function e(e,t){for(var i in t){var n=t[i];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),l=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},u=r(i(1)),p=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return l(t,e),s(t,{render:{value:function(){return u.createElement("div",{className:"infinite-list-item"},this.props.title)}}}),t}(u.Component);p.propTypes={height:u.PropTypes.number.isRequired,title:u.PropTypes.string.isRequired};var h=/WebKit/.test(navigator&&navigator.userAgent||""),d=function(e){function t(e){a(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this._scrollTimer=null,this.state={renderedStart:0}}return l(t,e),s(t,{onWheel:{value:function(){this._scrolledByWheel=!0}},onScroll:{value:function(e){return e.stopPropagation(),h&&this._scrolledByWheel&&!n()?(this._scrolledByWheel=!1,void(this._scrollTimer||(this._scrollTimer=setTimeout(function(){this._scrollTimer=null,this._calculateVisibleItems()}.bind(this),150)))):void this._calculateVisibleItems()}},_calculateVisibleItems:{value:function(){var e=u.findDOMNode(this).scrollTop,t=Math.floor(e/this.props.itemHeight);t!==this.state.renderedStart&&this.setState({renderedStart:t})}},componentWillReceiveProps:{value:function(e){var t=this.props.items.length!==e.items.length,i=this.props.height!==e.height;t&&(u.findDOMNode(this).scrollTop=0),(t||i)&&this._calculateVisibleItems()}},_getItemComponent:{value:function(e){var t=this.props.listItemClass||p;return u.createElement(t,c({key:e.id},e))}},render:{value:function(){var e=this.state.renderedStart,t=this.props,i=t.items,n=t.height,r=t.itemHeight,o=Math.ceil(n/r)+1,s=i.length*r,l=i.slice(e,e+o),a=l.map(this._getItemComponent,this),c=this.state.renderedStart*r,p=s-o*r+r,h=Math.min(p,c);return u.createElement("div",{className:"infinite-list",onWheel:this.onWheel.bind(this),onScroll:this.onScroll.bind(this),style:{height:this.props.height}},u.createElement("div",{className:"infinite-list-content",style:{height:s-h,paddingTop:h}},a))}}}),t}(u.Component);e.exports=d,d.propTypes={items:u.PropTypes.array.isRequired,height:u.PropTypes.number.isRequired,itemHeight:u.PropTypes.number.isRequired}},function(t,i,n){t.exports=e}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-infinite-list"]=t(require("react")):e["react-infinite-list"]=t(e.React)}(this,function(e){return function(e){function t(r){if(i[r])return i[r].exports;var n=i[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){"use strict";function r(){return window.matchMedia&&(window.matchMedia("only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)").matches||window.matchMedia("only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)").matches)||window.devicePixelRatio&&window.devicePixelRatio>1.3}var n=function(e){return e&&e.__esModule?e["default"]:e},o=function m(e,t,i){var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var n=Object.getPrototypeOf(e);return null===n?void 0:m(n,t,i)}if("value"in r&&r.writable)return r.value;var o=r.get;return void 0===o?void 0:o.call(i)},s=function(){function e(e,t){for(var i in t){var r=t[i];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(e,t)}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},u=n(i(1)),p=n(i(2)),d=/WebKit/.test(navigator&&navigator.userAgent||""),h=function(e){function t(){l(this,t),null!=e&&e.apply(this,arguments)}return a(t,e),s(t,{render:{value:function(){return u.createElement("div",{key:this.props.id,className:"infinite-list-item"},this.props.title)}}}),t}(u.Component);h.propTypes={title:u.PropTypes.string.isRequired,id:u.PropTypes.oneOfType([u.PropTypes.number,u.PropTypes.string]).isRequired};var f=function(e){function t(e){l(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this._scrollTimer=null,this.state={renderedStart:0}}return a(t,e),s(t,{onWheel:{value:function(){this._scrolledByWheel=!0}},onScroll:{value:function(e){return e.stopPropagation(),d&&this._scrolledByWheel&&!r()?(this._scrolledByWheel=!1,void(this._scrollTimer||(this._scrollTimer=setTimeout(function(){this._scrollTimer=null,this._calculateVisibleItems()}.bind(this),150)))):void this._calculateVisibleItems()}},_calculateVisibleItems:{value:function(){var e=u.findDOMNode(this).scrollTop,t=Math.floor(e/this.props.itemHeight);t!==this.state.renderedStart&&this.setState({renderedStart:t})}},componentWillReceiveProps:{value:function(e){var t=this.props.items.length!==e.items.length,i=this.props.height!==e.height;t&&(u.findDOMNode(this).scrollTop=0),(t||i)&&this._calculateVisibleItems()}},_getItemComponent:{value:function(e){var t=this.props.listItemClass||h;return u.createElement(t,c({key:e.id},e))}},_getClassNames:{value:function(){return p("infinite-list",this.props.className)}},render:{value:function(){var e=this.state.renderedStart,t=this.props,i=t.items,r=t.height,n=t.itemHeight,o=Math.ceil(r/n)+1,s=i.length*n,a=i.slice(e,e+o),l=a.map(this._getItemComponent,this),c=this.state.renderedStart*n,p=Math.max(0,s-o*n+n),d=Math.min(p,c);return u.createElement("div",{className:this._getClassNames(),onWheel:this.onWheel.bind(this),onScroll:this.onScroll.bind(this),style:{height:this.props.height}},u.createElement("div",{className:"infinite-list-content",style:{height:s-d,paddingTop:d}},l))}}}),t}(u.Component);e.exports=f,f.propTypes={items:u.PropTypes.array.isRequired,height:u.PropTypes.number.isRequired,itemHeight:u.PropTypes.number.isRequired}},function(t,i,r){t.exports=e},function(e,t,i){var r;/*!
Copyright (c) 2015 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var e="",t=0;t<arguments.length;t++){var i=arguments[t];if(i){var r=typeof i;if("string"===r||"number"===r)e+=" "+i;else if(Array.isArray(i))e+=" "+n.apply(null,i);else if("object"===r)for(var o in i)i.hasOwnProperty(o)&&i[o]&&(e+=" "+o)}}return e.substr(1)}"undefined"!=typeof e&&e.exports?e.exports=n:(r=function(){return n}.call(t,i,t,e),!(void 0!==r&&(e.exports=r)))}()}])});

@@ -9,6 +9,6 @@ 'use strict';

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -22,2 +22,4 @@

var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');

@@ -27,6 +29,2 @@

var _InfiniteListItem = require('./InfiniteListItem');
var _InfiniteListItem2 = _interopRequireDefault(_InfiniteListItem);
var isWebkit = /WebKit/.test(navigator && navigator.userAgent || '');

@@ -38,3 +36,33 @@

var InfiniteList = (function (_Component) {
var InfiniteListItem = (function (_React$Component) {
function InfiniteListItem() {
_classCallCheck(this, InfiniteListItem);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(InfiniteListItem, _React$Component);
_createClass(InfiniteListItem, [{
key: 'render',
value: function render() {
return _react2['default'].createElement(
'div',
{ key: this.props.id, className: 'infinite-list-item' },
this.props.title
);
}
}]);
return InfiniteListItem;
})(_react2['default'].Component);
InfiniteListItem.propTypes = {
title: _react2['default'].PropTypes.string.isRequired,
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.string]).isRequired
};
var InfiniteList = (function (_React$Component2) {
function InfiniteList(props) {

@@ -49,3 +77,3 @@ _classCallCheck(this, InfiniteList);

_inherits(InfiniteList, _Component);
_inherits(InfiniteList, _React$Component2);

@@ -81,3 +109,3 @@ _createClass(InfiniteList, [{

value: function _calculateVisibleItems() {
var scrolledPx = (0, _react.findDOMNode)(this).scrollTop;
var scrolledPx = _react2['default'].findDOMNode(this).scrollTop;

@@ -98,3 +126,3 @@ var visibleStart = Math.floor(scrolledPx / this.props.itemHeight);

if (itemsChanged) {
(0, _react.findDOMNode)(this).scrollTop = 0;
_react2['default'].findDOMNode(this).scrollTop = 0;
}

@@ -109,4 +137,4 @@

value: function _getItemComponent(item) {
var ListItemComponent = this.props.listItemClass || _InfiniteListItem2['default'];
return React.createElement(ListItemComponent, _extends({ key: item.id }, item));
var ListItemComponent = this.props.listItemClass || InfiniteListItem;
return _react2['default'].createElement(ListItemComponent, _extends({ key: item.id }, item));
}

@@ -134,6 +162,7 @@ }, {

var padding = this.state.renderedStart * itemHeight;
var maxPadding = totalHeight - numOfVisibleItems * itemHeight + itemHeight;
// if maximum number of items on page is larger than actual number of items, maxPadding can be < 0
var maxPadding = Math.max(0, totalHeight - numOfVisibleItems * itemHeight + itemHeight);
var paddingTop = Math.min(maxPadding, padding);
return React.createElement(
return _react2['default'].createElement(
'div',

@@ -144,3 +173,3 @@ { className: this._getClassNames(),

style: { height: this.props.height } },
React.createElement(
_react2['default'].createElement(
'div',

@@ -155,3 +184,3 @@ { className: 'infinite-list-content', style: { height: totalHeight - paddingTop, paddingTop: paddingTop } },

return InfiniteList;
})(_react.Component);
})(_react2['default'].Component);

@@ -161,6 +190,6 @@ exports['default'] = InfiniteList;

InfiniteList.propTypes = {
items: _react.PropTypes.array.isRequired,
height: _react.PropTypes.number.isRequired,
itemHeight: _react.PropTypes.number.isRequired
items: _react2['default'].PropTypes.array.isRequired,
height: _react2['default'].PropTypes.number.isRequired,
itemHeight: _react2['default'].PropTypes.number.isRequired
};
module.exports = exports['default'];
{
"name": "react-infinite-list",
"version": "0.2.3",
"version": "0.2.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/react-infinite-list.js",

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