react-grid-layout
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -129,2 +129,3 @@ 'use strict'; | ||
var layout; | ||
// If no layout is supplied, look for `_grid` properties on children. | ||
@@ -143,3 +144,6 @@ if (!initialLayout) { | ||
.filter(function(val) { return val !== undefined; }); | ||
} else { | ||
} | ||
// Layout was supplied. Mark indices and trim off the end. | ||
else { | ||
// Clone initialLayout. | ||
layout = [].concat(initialLayout || []); | ||
@@ -150,10 +154,12 @@ layout = layout.map(function(l, i) { | ||
}); | ||
// Ensure the user hasn't passed more entries than we have children. | ||
layout = layout.slice(0, this.props.children.length); | ||
} | ||
// Fill in the blanks | ||
while (layout.length !== this.props.children.length) { | ||
// Fill in the blanks. | ||
while (layout.length < this.props.children.length) { | ||
layout.push({w: 1, h: 1, x: 0, y: 0, i: layout.length - 1}); | ||
} | ||
// Correct the layout | ||
// Correct the layout. | ||
layout = utils.correctBounds(layout, {cols: this.getColsFromBreakpoint(breakpoint)}); | ||
@@ -352,3 +358,3 @@ layout = utils.compact(layout); | ||
var $__0= this.props,className=$__0.className,initialLayout=$__0.initialLayout,props=(function(source, exclusion) {var rest = {};var hasOwn = Object.prototype.hasOwnProperty;if (source == null) {throw new TypeError();}for (var key in source) {if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {rest[key] = source[key];}}return rest;})($__0,{className:1,initialLayout:1}); | ||
className = 'react-grid-layout ' + (className || '') + ' ' + this.state.className; | ||
className = 'react-grid-layout ' + (className || ''); | ||
@@ -355,0 +361,0 @@ return ( |
@@ -35,11 +35,12 @@ 'use strict'; | ||
// Move the element up as far as it can go without colliding. | ||
do { | ||
while (l.y > 0 && !utils.layoutItemCollidesWith(compareWith, l).length) { | ||
l.y--; | ||
} | ||
while (l.y > -1 && !utils.layoutItemCollidesWith(compareWith, l).length); | ||
// Move it down, and keep moving it down if it's colliding. | ||
do { | ||
l.y++; | ||
} while(utils.layoutItemCollidesWith(compareWith, l).length); | ||
var collides = utils.layoutItemCollidesWith(compareWith, l); | ||
while(collides.length) { | ||
l.y = collides[0].y + collides[0].h; | ||
collides = utils.layoutItemCollidesWith(compareWith, l); | ||
} | ||
@@ -190,3 +191,3 @@ // Add to comparison array. We only collide with items before this one. | ||
if (typeof layout[i][subProps[j]] !== 'number') { | ||
throw new Error('ReactGridLayout: " + contextName + "[' + i + '].' + subProps[j] + ' must be a Number!'); | ||
throw new Error('ReactGridLayout: ' + contextName + '[' + i + '].' + subProps[j] + ' must be a Number!'); | ||
} | ||
@@ -193,0 +194,0 @@ } |
{ | ||
"name": "react-grid-layout", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A draggable and resizable grid layout with responsive breakpoints, for React.", | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "jsxhint .", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "webpack", | ||
"build": "make js", | ||
"build-example": "webpack", | ||
"check-build": "make check-build", | ||
"dev-server": "echo 'Open http://localhost:4002'; webpack-dev-server --config webpack-dev-server.config.js --hot --progress --colors --port 4002 --content-base ." | ||
@@ -39,3 +42,5 @@ }, | ||
"jsx-loader": "^0.12.2", | ||
"jsxhint": "^0.9.0", | ||
"lodash": "^2.4.1", | ||
"precommit-hook": "^1.0.7", | ||
"react": "^0.12.2", | ||
@@ -49,3 +54,7 @@ "react-hot-loader": "^1.0.4", | ||
"registry": "https://registry.npmjs.org" | ||
} | ||
}, | ||
"precommit": [ | ||
"check-build", | ||
"lint" | ||
] | ||
} |
@@ -149,1 +149,4 @@ ### React-Grid-Layout | ||
- [x] Define grid attributes on children themselves (`_grid` key) | ||
- [ ] Min/max w/h per item | ||
- [ ] Resizable handles on other corners | ||
- [ ] Configurable w/h per breakpoint |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36501
16
831
152
10