react-reorder
Advanced tools
Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6
{ | ||
"name": "react-reorder", | ||
"version": "3.0.0-alpha.5", | ||
"version": "3.0.0-alpha.6", | ||
"description": "Drag & drop, touch enabled, reorderable / sortable list, React component", | ||
@@ -37,3 +37,3 @@ "author": "Jake 'Sid' Smith", | ||
"create-react-class": "*", | ||
"lodash.assign": "*" | ||
"prop-types": "*" | ||
}, | ||
@@ -48,3 +48,3 @@ "devDependencies": { | ||
"concurrently": "3.5.0", | ||
"eslintrc": "git+https://github.com/JakeSidSmith/eslintrc.git#v2.1.0", | ||
"eslint-config-jakesidsmith": "github:jakesidsmith/eslint-config-jakesidsmith#v2.1.0", | ||
"http-server": "0.8.5", | ||
@@ -54,8 +54,7 @@ "immutable": "3.8.1", | ||
"jsdom": "9.8.3", | ||
"lodash.assign": "4.2.0", | ||
"mocha": "3.2.0", | ||
"nyc": "10.0.0", | ||
"react": "15.4.1", | ||
"react-addons-test-utils": "15.4.1", | ||
"react-dom": "15.4.1", | ||
"prop-types": "15.6.0", | ||
"react": "16.2.0", | ||
"react-dom": "16.2.0", | ||
"react-style-sheets": "0.1.0", | ||
@@ -62,0 +61,0 @@ "sinon": "1.17.6", |
@@ -389,4 +389,28 @@ 'use strict'; | ||
function getReorderComponent (React, ReactDOM, createReactClass, assign) { | ||
function assign () { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (!args.length) { | ||
return undefined; | ||
} | ||
if (args.length === 1) { | ||
return args[0]; | ||
} | ||
var obj = args.shift(); | ||
while (args.length) { | ||
var arg = args.shift(); | ||
for (var key in arg) { | ||
obj[key] = arg[key]; | ||
} | ||
} | ||
return obj; | ||
} | ||
function getReorderComponent (React, ReactDOM, createReactClass, PropTypes) { | ||
var Reorder = createReactClass({ | ||
@@ -670,2 +694,7 @@ displayName: 'Reorder', | ||
// Store root node | ||
componentDidMount: function () { | ||
this.storeRootNode(); | ||
}, | ||
// Remove listeners | ||
@@ -683,4 +712,4 @@ componentWillUnmount: function () { | ||
storeRootNode: function (element) { | ||
element = element || ReactDOM.findDOMNode(this); | ||
storeRootNode: function () { | ||
var element = ReactDOM.findDOMNode(this); | ||
this.rootNode = element; | ||
@@ -737,4 +766,3 @@ | ||
style: this.props.style, | ||
onClick: this.props.onClick, | ||
ref: this.storeRootNode | ||
onClick: this.props.onClick | ||
}, | ||
@@ -747,4 +775,2 @@ children | ||
var PropTypes = React.PropTypes; | ||
Reorder.propTypes = { | ||
@@ -799,10 +825,14 @@ component: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), | ||
var createReactClass = require('create-react-class'); // eslint-disable-line no-undef | ||
var assign = require('lodash.assign'); // eslint-disable-line no-undef | ||
module.exports = withReorderMethods(getReorderComponent(React, ReactDOM, createReactClass, assign)); // eslint-disable-line no-undef | ||
var PropTypes = require('prop-types'); // eslint-disable-line no-undef | ||
module.exports = withReorderMethods( // eslint-disable-line no-undef | ||
getReorderComponent(React, ReactDOM, createReactClass, PropTypes) | ||
); | ||
// Export for amd / require | ||
} else if (typeof define === 'function' && define.amd) { // eslint-disable-line no-undef | ||
define( // eslint-disable-line no-undef | ||
['react', 'react-dom', 'create-react-class', 'lodash.assign'], | ||
function (ReactAMD, ReactDOMAMD, createReactClassAMD, assignAMD) { | ||
return withReorderMethods(getReorderComponent(ReactAMD, ReactDOMAMD, createReactClassAMD, assignAMD)); | ||
['react', 'react-dom', 'create-react-class', 'prop-types'], | ||
function (ReactAMD, ReactDOMAMD, createReactClassAMD, PropTypesAMD) { | ||
return withReorderMethods( | ||
getReorderComponent(ReactAMD, ReactDOMAMD, createReactClassAMD, PropTypesAMD) | ||
); | ||
} | ||
@@ -825,3 +855,3 @@ ); | ||
root.Reorder = withReorderMethods( | ||
getReorderComponent(root.React, root.ReactDOM, root.createReactClass, root.assign) | ||
getReorderComponent(root.React, root.ReactDOM, root.createReactClass, root.PropTypes) | ||
); | ||
@@ -828,0 +858,0 @@ } |
@@ -175,8 +175,5 @@ import { expect } from 'chai'; | ||
expect(addEventListenerSpy).to.have.been.called; | ||
expect(removeEventListenerSpy).not.to.have.been.called; | ||
expect(addEventListenerSpy.callCount).to.equal(events.length); | ||
events.forEach(function (event) { | ||
expect(addEventListenerSpy).to.have.been.calledWith(event); | ||
expect(removeEventListenerSpy).not.to.have.been.calledWith(event); | ||
}); | ||
@@ -189,7 +186,4 @@ | ||
expect(addEventListenerSpy).not.to.have.been.called; | ||
expect(removeEventListenerSpy).to.have.been.called; | ||
expect(removeEventListenerSpy.callCount).to.equal(events.length); | ||
events.forEach(function (event) { | ||
expect(addEventListenerSpy).not.to.have.been.calledWith(event); | ||
expect(removeEventListenerSpy).to.have.been.calledWith(event); | ||
@@ -196,0 +190,0 @@ }); |
import $ from 'jquery'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import TestUtils from 'react-addons-test-utils'; | ||
import TestUtils from 'react-dom/test-utils'; | ||
@@ -6,0 +6,0 @@ // Override trigger method with one from TestUtils |
import { expect } from 'chai'; | ||
import { spy } from 'sinon'; | ||
import createReactClass from 'create-react-class'; | ||
import mount from './helpers/mount'; | ||
@@ -46,3 +47,3 @@ import React, { Component } from 'react'; | ||
const AnotherComponent = React.createClass({ | ||
const AnotherComponent = createReactClass({ | ||
render: function () { | ||
@@ -49,0 +50,0 @@ return <div />; |
Floating dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Floating dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
88684
21
2224
+ Addedprop-types@*
+ Addedprop-types@15.8.1(transitive)
+ Addedreact-is@16.13.1(transitive)
- Removedlodash.assign@*
- Removedlodash.assign@4.2.0(transitive)