New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-virtuallist

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-virtuallist - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

js/.module-cache/01466834d75a3e58900417c130e08f0d3426e340.js

45

js/virtuallist.js
/** @jsx React.DOM */
module.exports = function(React) {
module.exports = function(React, addons) {
var List = React.createClass({displayName: 'List',

@@ -43,3 +43,13 @@ setDimensions: function(props) {

scrolled: 0,
viewLength: isNumber ? this.props.horizontal ? this.props.width : this.props.height : 1000
viewLength: isNumber ? this.props.horizontal ? this.props.width : this.props.height : 1000 ,
defaultProps: {
itemContainer: true,
items: true,
itemLength: true,
width: true,
height: true,
marginFactor: true,
onEvent: true,
horizontal: true
}
}

@@ -49,2 +59,4 @@ },

var currentScroll = this.refs.list.getDOMNode()[this.props.horizontal ? 'scrollLeft' : 'scrollTop'];
/*if (this.props.onScroll)
this.props.onScroll(currentScroll);*/
if (Math.abs(currentScroll - this.state.scrolled) >= this.state.viewLength * this.props.marginFactor)

@@ -54,2 +66,4 @@ this.setState({scrolled: currentScroll});

render: function() {
console.log('render the list');
var self = this;
var first = Math.max(Math.floor((this.state.scrolled - this.state.viewLength * this.props.marginFactor) / this.props.itemLength), 0)

@@ -59,11 +73,20 @@ var last = Math.min(Math.ceil((this.state.scrolled + this.state.viewLength * (this.props.marginFactor + 1)) / this.props.itemLength), this.props.items.length);

for (var i = first, l = last; i < l; i++) {
items.push(this.props.itemContainer({
data: this.props.items[i],
key: i,
style: {
position: 'absolute',
top: this.props.horizontal ? 0 : i * this.props.itemLength,
left: this.props.horizontal ? i * this.props.itemLength : 0
}
}));
var props = {};
Object.keys(this.props).forEach(function(prop) {
if (!(prop in self.state.defaultProps))
props[prop] = self.props[prop];
});
if (this.props.items[i] instanceof Object && !(this.props.items[i] instanceof Array))
for (var prop in this.props.items[i])
props[prop] = this.props.items[i][prop];
else
props.data = this.props.items[i];
props.key = i;
props.style = {
position: 'absolute',
top: this.props.horizontal ? 0 : i * this.props.itemLength,
left: this.props.horizontal ? i * this.props.itemLength : 0
};
props.onEvent = this.props.onEvent;
items.push(this.props.itemContainer(props));
}

@@ -70,0 +93,0 @@ return (

/** @jsx React.DOM */
module.exports = function(React) {
module.exports = function(React, addons) {
var List = React.createClass({

@@ -43,3 +43,13 @@ setDimensions: function(props) {

scrolled: 0,
viewLength: isNumber ? this.props.horizontal ? this.props.width : this.props.height : 1000
viewLength: isNumber ? this.props.horizontal ? this.props.width : this.props.height : 1000 ,
defaultProps: {
itemContainer: true,
items: true,
itemLength: true,
width: true,
height: true,
marginFactor: true,
onEvent: true,
horizontal: true
}
}

@@ -49,2 +59,4 @@ },

var currentScroll = this.refs.list.getDOMNode()[this.props.horizontal ? 'scrollLeft' : 'scrollTop'];
/*if (this.props.onScroll)
this.props.onScroll(currentScroll);*/
if (Math.abs(currentScroll - this.state.scrolled) >= this.state.viewLength * this.props.marginFactor)

@@ -54,2 +66,4 @@ this.setState({scrolled: currentScroll});

render: function() {
console.log('render the list');
var self = this;
var first = Math.max(Math.floor((this.state.scrolled - this.state.viewLength * this.props.marginFactor) / this.props.itemLength), 0)

@@ -59,11 +73,20 @@ var last = Math.min(Math.ceil((this.state.scrolled + this.state.viewLength * (this.props.marginFactor + 1)) / this.props.itemLength), this.props.items.length);

for (var i = first, l = last; i < l; i++) {
items.push(this.props.itemContainer({
data: this.props.items[i],
key: i,
style: {
position: 'absolute',
top: this.props.horizontal ? 0 : i * this.props.itemLength,
left: this.props.horizontal ? i * this.props.itemLength : 0
}
}));
var props = {};
Object.keys(this.props).forEach(function(prop) {
if (!(prop in self.state.defaultProps))
props[prop] = self.props[prop];
});
if (this.props.items[i] instanceof Object && !(this.props.items[i] instanceof Array))
for (var prop in this.props.items[i])
props[prop] = this.props.items[i][prop];
else
props.data = this.props.items[i];
props.key = i;
props.style = {
position: 'absolute',
top: this.props.horizontal ? 0 : i * this.props.itemLength,
left: this.props.horizontal ? i * this.props.itemLength : 0
};
props.onEvent = this.props.onEvent;
items.push(this.props.itemContainer(props));
}

@@ -70,0 +93,0 @@ return (

{
"name": "react-virtuallist",
"version": "0.0.3",
"version": "0.0.4",
"description": "React component for rendering virtual lists",

@@ -5,0 +5,0 @@ "main": "js/virtuallist.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