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

react-sortablejs

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-sortablejs - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

docs/bundle.js.map

182

dist/react-sortable.js

@@ -1,2 +0,2 @@

/*! react-sortablejs v1.3.3 | (c) 2017 Cheton Wu <cheton@gmail.com> | MIT | https://github.com/cheton/react-sortable */
/*! react-sortablejs v1.3.4 | (c) 2017 Cheton Wu <cheton@gmail.com> | MIT | https://github.com/cheton/react-sortable */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -11,3 +11,3 @@ if(typeof exports === 'object' && typeof module === 'object')

root["ReactSortable"] = factory(root["React"], root["ReactDOM"], root["Sortable"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_7__, __WEBPACK_EXTERNAL_MODULE_8__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_12__, __WEBPACK_EXTERNAL_MODULE_13__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -78,3 +78,3 @@ /******/ // The module cache

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 9);
/******/ return __webpack_require__(__webpack_require__.s = 6);
/******/ })

@@ -472,60 +472,9 @@ /************************************************************************/

/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
"use strict";
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
Object.defineProperty(exports, "__esModule", {
value: true
});
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(12)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(11)();
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }),
/* 6 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
/***/ }),
/* 7 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_7__;
/***/ }),
/* 8 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_8__;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -537,17 +486,18 @@

var _class, _temp2;
var _class, _temp2; /* eslint consistent-return: 0 */
var _propTypes = __webpack_require__(5);
var _propTypes = __webpack_require__(10);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = __webpack_require__(6);
var _react = __webpack_require__(11);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(7);
var _reactDom = __webpack_require__(12);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _sortablejs = __webpack_require__(8);
var _sortablejs = __webpack_require__(13);

@@ -558,2 +508,4 @@ var _sortablejs2 = _interopRequireDefault(_sortablejs);

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -570,6 +522,6 @@

module.exports = (_temp2 = _class = function (_Component) {
_inherits(_class, _Component);
var Sortable = (_temp2 = _class = function (_Component) {
_inherits(Sortable, _Component);
function _class() {
function Sortable() {
var _ref;

@@ -579,3 +531,3 @@

_classCallCheck(this, _class);
_classCallCheck(this, Sortable);

@@ -586,6 +538,6 @@ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {

return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = _class.__proto__ || Object.getPrototypeOf(_class)).call.apply(_ref, [this].concat(args))), _this), _this.sortable = null, _temp), _possibleConstructorReturn(_this, _ret);
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Sortable.__proto__ || Object.getPrototypeOf(Sortable)).call.apply(_ref, [this].concat(args))), _this), _this.sortable = null, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(_class, [{
_createClass(Sortable, [{
key: 'componentDidMount',

@@ -660,12 +612,13 @@ value: function componentDidMount() {

var _props = this.props,
children = _props.children,
className = _props.className,
tag = _props.tag,
style = _props.style;
Component = _props.tag,
props = _objectWithoutProperties(_props, ['tag']);
return _react2.default.DOM[tag]({ className: className, style: style }, children);
delete props.options;
delete props.onChange;
return _react2.default.createElement(Component, props);
}
}]);
return _class;
return Sortable;
}(_react.Component), _class.propTypes = {

@@ -681,8 +634,24 @@ options: _propTypes2.default.object,

}, _temp2);
exports.default = Sortable;
/***/ }),
/* 10 */
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _Sortable = __webpack_require__(5);
var _Sortable2 = _interopRequireDefault(_Sortable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = _Sortable2.default;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/**

@@ -753,3 +722,3 @@ * Copyright 2013-present, Facebook, Inc.

/***/ }),
/* 11 */
/* 8 */
/***/ (function(module, exports, __webpack_require__) {

@@ -815,3 +784,3 @@

/***/ }),
/* 12 */
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

@@ -836,3 +805,3 @@

var ReactPropTypesSecret = __webpack_require__(4);
var checkPropTypes = __webpack_require__(10);
var checkPropTypes = __webpack_require__(7);

@@ -1302,4 +1271,59 @@ module.exports = function(isValidElement, throwOnDirectAccess) {

/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(9)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(8)();
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }),
/* 11 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_11__;
/***/ }),
/* 12 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_12__;
/***/ }),
/* 13 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_13__;
/***/ })
/******/ ]);
});

@@ -1,2 +0,2 @@

/*! react-sortablejs v1.3.3 | (c) 2017 Cheton Wu <cheton@gmail.com> | MIT | https://github.com/cheton/react-sortable */
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react"),require("react-dom"),require("sortablejs")):"function"==typeof define&&define.amd?define(["react","react-dom","sortablejs"],n):"object"==typeof exports?exports.ReactSortable=n(require("react"),require("react-dom"),require("sortablejs")):e.ReactSortable=n(e.React,e.ReactDOM,e.Sortable)}(this,function(e,n,t){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var t={};return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=9)}([function(e,n){function t(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===t||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(n){try{return f.call(null,e,0)}catch(n){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(n){try{return l.call(null,e)}catch(n){return l.call(this,e)}}}function u(){v&&y&&(v=!1,y.length?d=y.concat(d):h=-1,d.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var n=d.length;n;){for(y=d,d=[];++h<n;)y&&y[h].run();h=-1,n=d.length}y=null,v=!1,i(e)}}function c(e,n){this.fun=e,this.array=n}function s(){}var f,l,p=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:t}catch(e){f=t}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var y,d=[],v=!1,h=-1;p.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];d.push(new c(e,n)),1!==d.length||v||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=s,p.addListener=s,p.once=s,p.off=s,p.removeListener=s,p.removeAllListeners=s,p.emit=s,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,n,t){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,n,t){"use strict";(function(n){function t(e,n,t,o,i,u,a,c){if(r(n),!e){var s;if(void 0===n)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[t,o,i,u,a,c],l=0;s=new Error(n.replace(/%s/g,function(){return f[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var r=function(e){};"production"!==n.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=t}).call(n,t(0))},function(e,n,t){"use strict";(function(n){var r=t(1),o=r;"production"!==n.env.NODE_ENV&&function(){var e=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return t[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(n,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!n){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];e.apply(void 0,[t].concat(o))}}}(),e.exports=o}).call(n,t(0))},function(e,n,t){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,n,t){(function(n){if("production"!==n.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=t(12)(o,!0)}else e.exports=t(11)()}).call(n,t(0))},function(n,t){n.exports=e},function(e,t){e.exports=n},function(e,n){e.exports=t},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}function u(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}var a,c,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},l=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),p=t(5),y=r(p),d=t(6),v=r(d),h=t(7),m=r(h),b=t(8),g=r(b),w={nextSibling:null,activeComponent:null};e.exports=(c=a=function(e){function n(){var e,t,r,u;o(this,n);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return t=r=i(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(c))),r.sortable=null,u=t,i(r,u)}return u(n,e),l(n,[{key:"componentDidMount",value:function(){var e=this,n=f({},this.props.options);["onChoose","onStart","onEnd","onAdd","onUpdate","onSort","onRemove","onFilter","onMove","onClone"].forEach(function(t){var r=n[t];n[t]=function(){for(var n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];var u=o[0];if("onChoose"===t)w.nextSibling=u.item.nextElementSibling,w.activeComponent=e;else if(("onAdd"===t||"onUpdate"===t)&&e.props.onChange){var a=e.sortable.toArray(),c=w.activeComponent,f=c.sortable.toArray(),l=w.nextSibling&&null!==w.nextSibling.parentNode?w.nextSibling:null;if(u.from.insertBefore(u.item,l),c!==e){var p=c.props.options||{};"object"===s(p.group)&&"clone"===p.group.pull&&u.item.parentNode.removeChild(u.item),c.props.onChange&&c.props.onChange(f,c.sortable,u)}e.props.onChange&&e.props.onChange(a,e.sortable,u)}if("move"===u.type){var y=o[0],d=o[1];return!r||r(y,d)}setTimeout(function(){r&&r(u)},0)}}),this.sortable=g.default.create(m.default.findDOMNode(this),n)}},{key:"componentWillUnmount",value:function(){this.sortable&&(this.sortable.destroy(),this.sortable=null)}},{key:"render",value:function(){var e=this.props,n=e.children,t=e.className,r=e.tag,o=e.style;return v.default.DOM[r]({className:t,style:o},n)}}]),n}(d.Component),a.propTypes={options:y.default.object,onChange:y.default.func,tag:y.default.string,style:y.default.object},a.defaultProps={options:{},tag:"div",style:{}},c)},function(e,n,t){"use strict";(function(n){function r(e,t,r,c,s){if("production"!==n.env.NODE_ENV)for(var f in e)if(e.hasOwnProperty(f)){var l;try{o("function"==typeof e[f],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",c||"React class",r,f),l=e[f](t,f,c,r,null,u)}catch(e){l=e}if(i(!l||l instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",r,f,typeof l),l instanceof Error&&!(l.message in a)){a[l.message]=!0;var p=s?s():"";i(!1,"Failed %s type: %s%s",r,l.message,null!=p?p:"")}}}if("production"!==n.env.NODE_ENV)var o=t(2),i=t(3),u=t(4),a={};e.exports=r}).call(n,t(0))},function(e,n,t){"use strict";var r=t(1),o=t(2);e.exports=function(){function e(){o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function n(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n};return t.checkPropTypes=r,t.PropTypes=t,t}},function(e,n,t){"use strict";(function(n){var r=t(1),o=t(2),i=t(3),u=t(4),a=t(10);e.exports=function(e,t){function c(e){var n=e&&(E&&e[E]||e[j]);if("function"==typeof n)return n}function s(e,n){return e===n?0!==e||1/e==1/n:e!==e&&n!==n}function f(e){this.message=e,this.stack=""}function l(e){function r(r,s,l,p,y,d,v){if(p=p||S,d=d||l,v!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==n.env.NODE_ENV&&"undefined"!=typeof console){var h=p+":"+l;!a[h]&&c<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,p),a[h]=!0,c++)}return null==s[l]?r?new f(null===s[l]?"The "+y+" `"+d+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+y+" `"+d+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(s,l,p,y,d)}if("production"!==n.env.NODE_ENV)var a={},c=0;var s=r.bind(null,!1);return s.isRequired=r.bind(null,!0),s}function p(e){function n(n,t,r,o,i,u){var a=n[t];if(O(a)!==e)return new f("Invalid "+o+" `"+i+"` of type `"+T(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return l(n)}function y(e){function n(n,t,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=n[t];if(!Array.isArray(a)){return new f("Invalid "+o+" `"+i+"` of type `"+O(a)+"` supplied to `"+r+"`, expected an array.")}for(var c=0;c<a.length;c++){var s=e(a,c,r,o,i+"["+c+"]",u);if(s instanceof Error)return s}return null}return l(n)}function d(e){function n(n,t,r,o,i){if(!(n[t]instanceof e)){var u=e.name||S;return new f("Invalid "+o+" `"+i+"` of type `"+x(n[t])+"` supplied to `"+r+"`, expected instance of `"+u+"`.")}return null}return l(n)}function v(e){function t(n,t,r,o,i){for(var u=n[t],a=0;a<e.length;a++)if(s(u,e[a]))return null;return new f("Invalid "+o+" `"+i+"` of value `"+u+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?l(t):("production"!==n.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)}function h(e){function n(n,t,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=n[t],c=O(a);if("object"!==c)return new f("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected an object.");for(var s in a)if(a.hasOwnProperty(s)){var l=e(a,s,r,o,i+"."+s,u);if(l instanceof Error)return l}return null}return l(n)}function m(e){function t(n,t,r,o,i){for(var a=0;a<e.length;a++){if(null==(0,e[a])(n,t,r,o,i,u))return null}return new f("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}return Array.isArray(e)?l(t):("production"!==n.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull)}function b(e){function n(n,t,r,o,i){var a=n[t],c=O(a);if("object"!==c)return new f("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected `object`.");for(var s in e){var l=e[s];if(l){var p=l(a,s,r,o,i+"."+s,u);if(p)return p}}return null}return l(n)}function g(n){switch(typeof n){case"number":case"string":case"undefined":return!0;case"boolean":return!n;case"object":if(Array.isArray(n))return n.every(g);if(null===n||e(n))return!0;var t=c(n);if(!t)return!1;var r,o=t.call(n);if(t!==n.entries){for(;!(r=o.next()).done;)if(!g(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!g(i[1]))return!1}return!0;default:return!1}}function w(e,n){return"symbol"===e||("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}function O(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":w(n,e)?"symbol":n}function T(e){var n=O(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function x(e){return e.constructor&&e.constructor.name?e.constructor.name:S}var E="function"==typeof Symbol&&Symbol.iterator,j="@@iterator",S="<<anonymous>>",N={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:function(){return l(r.thatReturnsNull)}(),arrayOf:y,element:function(){function n(n,t,r,o,i){var u=n[t];if(!e(u)){return new f("Invalid "+o+" `"+i+"` of type `"+O(u)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return l(n)}(),instanceOf:d,node:function(){function e(e,n,t,r,o){return g(e[n])?null:new f("Invalid "+r+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}return l(e)}(),objectOf:h,oneOf:v,oneOfType:m,shape:b};return f.prototype=Error.prototype,N.checkPropTypes=a,N.PropTypes=N,N}}).call(n,t(0))}])});
/*! react-sortablejs v1.3.4 | (c) 2017 Cheton Wu <cheton@gmail.com> | MIT | https://github.com/cheton/react-sortable */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom"),require("sortablejs")):"function"==typeof define&&define.amd?define(["react","react-dom","sortablejs"],t):"object"==typeof exports?exports.ReactSortable=t(require("react"),require("react-dom"),require("sortablejs")):e.ReactSortable=t(e.React,e.ReactDOM,e.Sortable)}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(s===setTimeout)return setTimeout(e,0);if((s===n||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function u(){v&&y&&(v=!1,y.length?d=y.concat(d):h=-1,d.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var t=d.length;t;){for(y=d,d=[];++h<t;)y&&y[h].run();h=-1,t=d.length}y=null,v=!1,i(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var s,l,p=e.exports={};!function(){try{s="function"==typeof setTimeout?setTimeout:n}catch(e){s=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var y,d=[],v=!1,h=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new c(e,t)),1!==d.length||v||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=f,p.addListener=f,p.once=f,p.off=f,p.removeListener=f,p.removeAllListeners=f,p.emit=f,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";(function(t){function n(e,t,n,o,i,u,a,c){if(r(t),!e){var f;if(void 0===t)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,o,i,u,a,c],l=0;f=new Error(t.replace(/%s/g,function(){return s[l++]})),f.name="Invariant Violation"}throw f.framesToPop=1,f}}var r=function(e){};"production"!==t.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n}).call(t,n(0))},function(e,t,n){"use strict";(function(t){var r=n(1),o=r;"production"!==t.env.NODE_ENV&&function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];e.apply(void 0,[n].concat(o))}}}(),e.exports=o}).call(t,n(0))},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c,f,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),y=n(10),d=r(y),v=n(11),h=r(v),m=n(12),b=r(m),g=n(13),O=r(g),w={nextSibling:null,activeComponent:null},T=(f=c=function(e){function t(){var e,n,r,o;i(this,t);for(var a=arguments.length,c=Array(a),f=0;f<a;f++)c[f]=arguments[f];return n=r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),r.sortable=null,o=n,u(r,o)}return a(t,e),p(t,[{key:"componentDidMount",value:function(){var e=this,t=l({},this.props.options);["onChoose","onStart","onEnd","onAdd","onUpdate","onSort","onRemove","onFilter","onMove","onClone"].forEach(function(n){var r=t[n];t[n]=function(){for(var t=arguments.length,o=Array(t),i=0;i<t;i++)o[i]=arguments[i];var u=o[0];if("onChoose"===n)w.nextSibling=u.item.nextElementSibling,w.activeComponent=e;else if(("onAdd"===n||"onUpdate"===n)&&e.props.onChange){var a=e.sortable.toArray(),c=w.activeComponent,f=c.sortable.toArray(),l=w.nextSibling&&null!==w.nextSibling.parentNode?w.nextSibling:null;if(u.from.insertBefore(u.item,l),c!==e){var p=c.props.options||{};"object"===s(p.group)&&"clone"===p.group.pull&&u.item.parentNode.removeChild(u.item),c.props.onChange&&c.props.onChange(f,c.sortable,u)}e.props.onChange&&e.props.onChange(a,e.sortable,u)}if("move"===u.type){var y=o[0],d=o[1];return!r||r(y,d)}setTimeout(function(){r&&r(u)},0)}}),this.sortable=O.default.create(b.default.findDOMNode(this),t)}},{key:"componentWillUnmount",value:function(){this.sortable&&(this.sortable.destroy(),this.sortable=null)}},{key:"render",value:function(){var e=this.props,t=e.tag,n=o(e,["tag"]);return delete n.options,delete n.onChange,h.default.createElement(t,n)}}]),t}(v.Component),c.propTypes={options:d.default.object,onChange:d.default.func,tag:d.default.string,style:d.default.object},c.defaultProps={options:{},tag:"div",style:{}},f);t.default=T},function(e,t,n){"use strict";var r=n(5),o=function(e){return e&&e.__esModule?e:{default:e}}(r);e.exports=o.default},function(e,t,n){"use strict";(function(t){function r(e,n,r,c,f){if("production"!==t.env.NODE_ENV)for(var s in e)if(e.hasOwnProperty(s)){var l;try{o("function"==typeof e[s],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",c||"React class",r,s),l=e[s](n,s,c,r,null,u)}catch(e){l=e}if(i(!l||l instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",r,s,typeof l),l instanceof Error&&!(l.message in a)){a[l.message]=!0;var p=f?f():"";i(!1,"Failed %s type: %s%s",r,l.message,null!=p?p:"")}}}if("production"!==t.env.NODE_ENV)var o=n(2),i=n(3),u=n(4),a={};e.exports=r}).call(t,n(0))},function(e,t,n){"use strict";var r=n(1),o=n(2);e.exports=function(){function e(){o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";(function(t){var r=n(1),o=n(2),i=n(3),u=n(4),a=n(7);e.exports=function(e,n){function c(e){var t=e&&(E&&e[E]||e[j]);if("function"==typeof t)return t}function f(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function s(e){this.message=e,this.stack=""}function l(e){function r(r,f,l,p,y,d,v){if(p=p||_,d=d||l,v!==u)if(n)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var h=p+":"+l;!a[h]&&c<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,p),a[h]=!0,c++)}return null==f[l]?r?new s(null===f[l]?"The "+y+" `"+d+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+y+" `"+d+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(f,l,p,y,d)}if("production"!==t.env.NODE_ENV)var a={},c=0;var f=r.bind(null,!1);return f.isRequired=r.bind(null,!0),f}function p(e){function t(t,n,r,o,i,u){var a=t[n];if(w(a)!==e)return new s("Invalid "+o+" `"+i+"` of type `"+T(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return l(t)}function y(e){function t(t,n,r,o,i){if("function"!=typeof e)return new s("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){return new s("Invalid "+o+" `"+i+"` of type `"+w(a)+"` supplied to `"+r+"`, expected an array.")}for(var c=0;c<a.length;c++){var f=e(a,c,r,o,i+"["+c+"]",u);if(f instanceof Error)return f}return null}return l(t)}function d(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var u=e.name||_;return new s("Invalid "+o+" `"+i+"` of type `"+x(t[n])+"` supplied to `"+r+"`, expected instance of `"+u+"`.")}return null}return l(t)}function v(e){function n(t,n,r,o,i){for(var u=t[n],a=0;a<e.length;a++)if(f(u,e[a]))return null;return new s("Invalid "+o+" `"+i+"` of value `"+u+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?l(n):("production"!==t.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)}function h(e){function t(t,n,r,o,i){if("function"!=typeof e)return new s("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],c=w(a);if("object"!==c)return new s("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected an object.");for(var f in a)if(a.hasOwnProperty(f)){var l=e(a,f,r,o,i+"."+f,u);if(l instanceof Error)return l}return null}return l(t)}function m(e){function n(t,n,r,o,i){for(var a=0;a<e.length;a++){if(null==(0,e[a])(t,n,r,o,i,u))return null}return new s("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}return Array.isArray(e)?l(n):("production"!==t.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull)}function b(e){function t(t,n,r,o,i){var a=t[n],c=w(a);if("object"!==c)return new s("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected `object`.");for(var f in e){var l=e[f];if(l){var p=l(a,f,r,o,i+"."+f,u);if(p)return p}}return null}return l(t)}function g(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(g);if(null===t||e(t))return!0;var n=c(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!g(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!g(i[1]))return!1}return!0;default:return!1}}function O(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function w(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":O(t,e)?"symbol":t}function T(e){var t=w(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function x(e){return e.constructor&&e.constructor.name?e.constructor.name:_}var E="function"==typeof Symbol&&Symbol.iterator,j="@@iterator",_="<<anonymous>>",S={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:function(){return l(r.thatReturnsNull)}(),arrayOf:y,element:function(){function t(t,n,r,o,i){var u=t[n];if(!e(u)){return new s("Invalid "+o+" `"+i+"` of type `"+w(u)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return l(t)}(),instanceOf:d,node:function(){function e(e,t,n,r,o){return g(e[t])?null:new s("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return l(e)}(),objectOf:h,oneOf:v,oneOfType:m,shape:b};return s.prototype=Error.prototype,S.checkPropTypes=a,S.PropTypes=S,S}}).call(t,n(0))},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=n(9)(o,!0)}else e.exports=n(8)()}).call(t,n(0))},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n}])});

@@ -1,3 +0,3 @@

import extend from 'lodash/extend';
import random from 'lodash/random';
import uniqueId from 'lodash/uniqueId';
import uniq from 'lodash/uniq';

@@ -40,18 +40,18 @@ import React from 'react';

const simpleList = this.state.simpleList.map((val, key) => (
<li key={key} data-id={val}>List Item {val}</li>
<li key={uniqueId()} data-id={val}>List Item {val}</li>
));
const groupLeft = this.state.groupLeft.map((val, key) => (
<div key={key} data-id={val}>{val}</div>
<div key={uniqueId()} data-id={val}>{val}</div>
));
const groupRight = this.state.groupRight.map((val, key) => (
<div key={key} data-id={val}>{val}</div>
<div key={uniqueId()} data-id={val}>{val}</div>
));
const cloneUncontrolled = this.state.cloneUncontrolled.map((val, key) => (
<li key={key} data-id={val}>{val}</li>
<li key={uniqueId()} data-id={val}>{val}</li>
));
const cloneControlledSource = this.state.cloneControlledSource.map((val, key) => (
<li key={key} data-id={val}>{val}</li>
<li key={uniqueId()} data-id={val}>{val}</li>
));
const cloneControlledTarget = this.state.cloneControlledTarget.map((val, key) => (
<li key={key} data-id={val}>{val}</li>
<li key={uniqueId()} data-id={val}>{val}</li>
));

@@ -61,3 +61,3 @@

<div>
<div style={{marginTop: 50}}>
<div style={{ marginTop: 50 }}>
<div className="title">Simple List</div>

@@ -96,3 +96,3 @@ <div className="form-group">

<div>
<div className="title" style={{marginTop: 50}}>Shared Group</div>
<div className="title" style={{ marginTop: 50 }}>Shared Group</div>
<div className="form-group">

@@ -149,3 +149,3 @@ <button

<div>
<div className="title" style={{marginTop: 50}}>Uncontrolled Component</div>
<div className="title" style={{ marginTop: 50 }}>Uncontrolled Component</div>
<h4>Clone items from left to right. DOM elements are duplicated.</h4>

@@ -182,4 +182,3 @@ <div className="row">

tag="ul"
>
</Sortable>
/>
</div>

@@ -189,3 +188,3 @@ </div>

<div>
<div className="title" style={{marginTop: 50}}>Controlled Component</div>
<div className="title" style={{ marginTop: 50 }}>Controlled Component</div>
<h4>Clone items from left to right without duplication.</h4>

@@ -192,0 +191,0 @@ <div className="row">

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

/* eslint no-var: 0 */
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var stylusLoader = require('stylus-loader');
var nib = require('nib');
var stylusLoader = require('stylus-loader');

@@ -12,18 +12,30 @@ module.exports = {

path: path.join(__dirname, '../docs'),
filename: 'bundle.js'
filename: 'bundle.js?[hash]'
},
module: {
rules: [
// http://survivejs.com/webpack_react/linting_in_webpack/
{
test: /\.json$/,
loader: 'json-loader'
test: /\.jsx?$/,
loader: 'eslint-loader',
enforce: 'pre',
exclude: /node_modules/
},
{
test: /\.styl$/,
loader: 'stylint-loader',
enforce: 'pre'
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
exclude: /(node_modules|bower_components)/
},
{
test: /\.styl$/,
loader: 'style-loader!css-loader!stylus-loader'
use: [
'style-loader',
'css-loader?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]',
'stylus-loader'
]
},

@@ -37,3 +49,3 @@ {

loader: 'url-loader',
query: {
options: {
limit: 8192

@@ -45,3 +57,3 @@ }

loader: 'url-loader',
query: {
options: {
limit: 10000,

@@ -59,4 +71,6 @@ mimetype: 'application/font-woff'

new webpack.LoaderOptionsPlugin({
debug: true
debug: true,
}),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new stylusLoader.OptionsPlugin({

@@ -70,7 +84,5 @@ default: {

}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
mangle: false
new HtmlWebpackPlugin({
filename: '../docs/index.html',
template: 'index.html'
})

@@ -87,5 +99,6 @@ ],

watchOptions: {
poll: true // use polling instead of native watchers
poll: true, // use polling instead of native watchers
ignored: /node_modules/
}
}
};
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _Sortable = require('./Sortable');
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Sortable2 = _interopRequireDefault(_Sortable);
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 _class, _temp2;
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _sortablejs = require('sortablejs');
var _sortablejs2 = _interopRequireDefault(_sortablejs);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
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 store = {
nextSibling: null,
activeComponent: null
};
module.exports = (_temp2 = _class = function (_Component) {
_inherits(_class, _Component);
function _class() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, _class);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = _class.__proto__ || Object.getPrototypeOf(_class)).call.apply(_ref, [this].concat(args))), _this), _this.sortable = null, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(_class, [{
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
var options = _extends({}, this.props.options);
['onChoose', 'onStart', 'onEnd', 'onAdd', 'onUpdate', 'onSort', 'onRemove', 'onFilter', 'onMove', 'onClone'].forEach(function (name) {
var eventHandler = options[name];
options[name] = function () {
for (var _len2 = arguments.length, params = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
params[_key2] = arguments[_key2];
}
var evt = params[0];
if (name === 'onChoose') {
store.nextSibling = evt.item.nextElementSibling;
store.activeComponent = _this2;
} else if ((name === 'onAdd' || name === 'onUpdate') && _this2.props.onChange) {
var items = _this2.sortable.toArray();
var remote = store.activeComponent;
var remoteItems = remote.sortable.toArray();
var referenceNode = store.nextSibling && store.nextSibling.parentNode !== null ? store.nextSibling : null;
evt.from.insertBefore(evt.item, referenceNode);
if (remote !== _this2) {
var remoteOptions = remote.props.options || {};
if (_typeof(remoteOptions.group) === 'object' && remoteOptions.group.pull === 'clone') {
// Remove the node with the same data-reactid
evt.item.parentNode.removeChild(evt.item);
}
remote.props.onChange && remote.props.onChange(remoteItems, remote.sortable, evt);
}
_this2.props.onChange && _this2.props.onChange(items, _this2.sortable, evt);
}
if (evt.type === 'move') {
var _evt = params[0],
originalEvent = params[1];
var canMove = eventHandler ? eventHandler(_evt, originalEvent) : true;
return canMove;
}
setTimeout(function () {
eventHandler && eventHandler(evt);
}, 0);
};
});
this.sortable = _sortablejs2.default.create(_reactDom2.default.findDOMNode(this), options);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
if (this.sortable) {
this.sortable.destroy();
this.sortable = null;
}
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
children = _props.children,
className = _props.className,
tag = _props.tag,
style = _props.style;
return _react2.default.DOM[tag]({ className: className, style: style }, children);
}
}]);
return _class;
}(_react.Component), _class.propTypes = {
options: _propTypes2.default.object,
onChange: _propTypes2.default.func,
tag: _propTypes2.default.string,
style: _propTypes2.default.object
}, _class.defaultProps = {
options: {},
tag: 'div',
style: {}
}, _temp2);
module.exports = _Sortable2.default;
{
"name": "react-sortablejs",
"version": "1.3.3",
"version": "1.3.4",
"description": "A React component built on top of Sortable (https://github.com/RubaXa/Sortable).",

@@ -64,2 +64,3 @@ "main": "lib/index.js",

"eslint-plugin-react": "~6.10.3",
"html-webpack-plugin": "^2.28.0",
"lodash": "^4.17.4",

@@ -66,0 +67,0 @@ "nib": "^1.1.2",

@@ -60,2 +60,3 @@ # react-sortable [![build status](https://travis-ci.org/cheton/react-sortable.svg?branch=master)](https://travis-ci.org/cheton/react-sortable) [![Coverage Status](https://coveralls.io/repos/github/cheton/react-sortable/badge.svg?branch=master)](https://coveralls.io/github/cheton/react-sortable?branch=master)

```js
import uniqueId from 'lodash/uniqueId';
import React from 'react';

@@ -71,3 +72,3 @@ import Sortable from 'react-sortablejs';

};
const listItems = items.map((val, key) => (<li key={key} data-id={val}>List Item: {val}</li>));
const listItems = items.map(val => (<li key={uniqueId()} data-id={val}>List Item: {val}</li>));

@@ -152,2 +153,3 @@ return (

```js
import uniqueId from 'lodash/uniqueId';
import React from 'react';

@@ -163,3 +165,3 @@ import ReactDOM from 'react-dom';

render() {
const items = this.state.items.map((val, key) => (<li key={key} data-id={val}>{val}</li>));
const items = this.state.items.map(val => (<li key={uniqueId()} data-id={val}>{val}</li>));

@@ -188,2 +190,3 @@ return (

```js
import uniqueId from 'lodash/uniqueId';
import React from 'react';

@@ -199,3 +202,3 @@ import ReactDOM from 'react-dom';

render() {
const items = this.state.items.map((val, key) => (<li key={key} data-id={val}>{val}</li>));
const items = this.state.items.map(val => (<li key={uniqueId()} data-id={val}>{val}</li>));

@@ -228,2 +231,3 @@ return (

```js
import uniqueId from 'lodash/uniqueId';
import React from 'react';

@@ -234,3 +238,3 @@ import Sortable from '../src';

const SharedGroup = ({ items }) => {
items = items.map((val, key) => (<li key={key} data-id={val}>{val}</li>));
items = items.map(val => (<li key={uniqueId()} data-id={val}>{val}</li>));

@@ -237,0 +241,0 @@ return (

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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