Socket
Socket
Sign inDemoInstall

react-sortable-hoc

Package Overview
Dependencies
11
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.9.0 to 1.9.1

11

CHANGELOG.md

@@ -5,5 +5,14 @@ # Change Log

<a name="1.9.1"></a>
## [1.9.1](https://github.com/clauderic/react-sortable-hoc/compare/v1.9.0...v1.9.1) (2019-04-24)
### Bug Fixes
- do not copy canvas context if it has neither width nor height ([#530](https://github.com/clauderic/react-sortable-hoc/issues/530)) ([3808437](https://github.com/clauderic/react-sortable-hoc/commit/3808437))
- pass isKeySorting to onSortOver and updateBeforeSortStart handler props ([#531](https://github.com/clauderic/react-sortable-hoc/issues/531)) ([763fd33](https://github.com/clauderic/react-sortable-hoc/commit/763fd33)
<a name="1.9.0"></a>
# [1.9.0](https://github.com/clauderic/react-sortable-hoc/compare/v1.1.0...v1.9.0) (2019-04-23)
# [1.9.0](https://github.com/clauderic/react-sortable-hoc/compare/v1.8.3...v1.9.0) (2019-04-23)

@@ -10,0 +19,0 @@ ### Bug Fixes

12

dist/react-sortable-hoc.esm.js

@@ -331,3 +331,3 @@ import _extends from '@babel/runtime/helpers/esm/extends';

if (field.tagName === NodeType.Canvas) {
if (field.tagName === NodeType.Canvas && fields[i].width > 0 && fields[i].height > 0) {
var destCtx = field.getContext('2d');

@@ -843,3 +843,4 @@ destCtx.drawImage(fields[i], 0, 0);

index: index,
node: _node
node: _node,
isKeySorting: _isKeySorting
}, event)).then(function () {});

@@ -1373,3 +1374,5 @@ }, function (_wasThrown, _result) {

if (onSortOver && this.newIndex !== prevIndex) {
var oldIndex = isKeySorting ? this.prevIndex : prevIndex;
if (onSortOver && this.newIndex !== oldIndex) {
onSortOver({

@@ -1379,3 +1382,4 @@ collection: this.manager.active.collection,

newIndex: this.newIndex,
oldIndex: prevIndex
oldIndex: oldIndex,
isKeySorting: isKeySorting
});

@@ -1382,0 +1386,0 @@ }

@@ -337,3 +337,3 @@ 'use strict';

if (field.tagName === NodeType.Canvas) {
if (field.tagName === NodeType.Canvas && fields[i].width > 0 && fields[i].height > 0) {
var destCtx = field.getContext('2d');

@@ -849,3 +849,4 @@ destCtx.drawImage(fields[i], 0, 0);

index: index,
node: _node
node: _node,
isKeySorting: _isKeySorting
}, event)).then(function () {});

@@ -1379,3 +1380,5 @@ }, function (_wasThrown, _result) {

if (onSortOver && this.newIndex !== prevIndex) {
var oldIndex = isKeySorting ? this.prevIndex : prevIndex;
if (onSortOver && this.newIndex !== oldIndex) {
onSortOver({

@@ -1385,3 +1388,4 @@ collection: this.manager.active.collection,

newIndex: this.newIndex,
oldIndex: prevIndex
oldIndex: oldIndex,
isKeySorting: isKeySorting
});

@@ -1388,0 +1392,0 @@ }

@@ -607,3 +607,3 @@ (function (global, factory) {

if (field.tagName === NodeType.Canvas) {
if (field.tagName === NodeType.Canvas && fields[i].width > 0 && fields[i].height > 0) {
var destCtx = field.getContext('2d');

@@ -1119,3 +1119,4 @@ destCtx.drawImage(fields[i], 0, 0);

index: index,
node: _node
node: _node,
isKeySorting: _isKeySorting
}, event)).then(function () {});

@@ -1649,3 +1650,5 @@ }, function (_wasThrown, _result) {

if (onSortOver && this.newIndex !== prevIndex) {
var oldIndex = isKeySorting ? this.prevIndex : prevIndex;
if (onSortOver && this.newIndex !== oldIndex) {
onSortOver({

@@ -1655,3 +1658,4 @@ collection: this.manager.active.collection,

newIndex: this.newIndex,
oldIndex: prevIndex
oldIndex: oldIndex,
isKeySorting: isKeySorting
});

@@ -1658,0 +1662,0 @@ }

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","react-dom"],t):t((e=e||self).SortableHOC={},e.React,e.PropTypes,e.ReactDOM)}(this,function(e,r,i,a){"use strict";function t(e,t){return e(t={exports:{}},t.exports),t.exports}i=i&&i.hasOwnProperty("default")?i.default:i;var s=t(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},t.apply(this,arguments)}e.exports=t});var n=function(e){if(Array.isArray(e))return e};var o=function(e,t){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(r)throw i}}return n};var l=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var b=function(e,t){return n(e)||o(e,t)||l()};var c=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};var I=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(e){c(t,e,n[e])})}return t};var u=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function f(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var d=function(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e},h=t(function(t){function n(e){return(n="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})(e)}function o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(e){return n(e)}:t.exports=o=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},o(e)}t.exports=o});var p=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var y=function(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?p(e):t},g=t(function(t){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}t.exports=n}),v=t(function(n){function o(e,t){return n.exports=o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}n.exports=o});var m=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)},w=function(e,t,n,o,r,i,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,r,i,a,s],u=0;(l=new Error(t.replace(/%s/g,function(){return c[u++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}},x=function(){function e(){u(this,e),c(this,"refs",{})}return d(e,[{key:"add",value:function(e,t){this.refs[e]||(this.refs[e]=[]),this.refs[e].push(t)}},{key:"remove",value:function(e,t){var n=this.getIndex(e,t);-1!==n&&this.refs[e].splice(n,1)}},{key:"isActive",value:function(){return this.active}},{key:"getActive",value:function(){var t=this;return this.refs[this.active.collection].find(function(e){return e.node.sortableInfo.index==t.active.index})}},{key:"getIndex",value:function(e,t){return this.refs[e].indexOf(t)}},{key:"getOrderedRefs",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.active.collection;return this.refs[e].sort(S)}}]),e}();function S(e,t){return e.node.sortableInfo.index-t.node.sortableInfo.index}var O=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}};var T=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)};var C=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var E=function(e){return O(e)||T(e)||C()};function k(n){for(var e=arguments.length,o=new Array(1<e?e-1:0),t=1;t<e;t++)o[t-1]=arguments[t];return Object.keys(n).reduce(function(e,t){return-1===o.indexOf(t)&&(e[t]=n[t]),e},{})}var R={end:["touchend","touchcancel","mouseup"],move:["touchmove","mousemove"],start:["touchstart","mousedown"]},D=function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var e=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1];switch(t){case"ms":return"ms";default:return t&&t.length?t[0].toUpperCase()+t.substr(1):""}}();function N(t,n){Object.keys(n).forEach(function(e){t.style[e]=n[e]})}function A(e,t){e.style["".concat(D,"Transform")]=null==t?"":"translate3d(".concat(t.x,"px,").concat(t.y,"px,0)")}function M(e,t){e.style["".concat(D,"TransitionDuration")]=null==t?"":"".concat(t,"ms")}function W(e,t){for(;e;){if(t(e))return e;e=e.parentNode}return null}function L(e,t,n){return Math.max(e,Math.min(n,t))}function P(e){return"px"===e.substr(-2)?parseFloat(e):0}function j(e,t){var n=t.displayName||t.name;return n?"".concat(e,"(").concat(n,")"):e}function H(e,t){var n=e.getBoundingClientRect();return{top:n.top+t.top,left:n.left+t.left}}function K(e){return e.touches&&e.touches.length?{x:e.touches[0].pageX,y:e.touches[0].pageY}:e.changedTouches&&e.changedTouches.length?{x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY}:{x:e.pageX,y:e.pageY}}function _(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){var o={left:n.left+e.offsetLeft,top:n.top+e.offsetTop};return e.parentNode===t?o:_(e.parentNode,t,o)}}function B(e){var t=e.lockOffset,n=e.width,o=e.height,r=t,i=t,a="px";if("string"==typeof t){var s=/^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(t);w(null!==s,'lockOffset value should be a number or a string of a number followed by "px" or "%". Given %s',t),r=parseFloat(t),i=parseFloat(t),a=s[1]}return w(isFinite(r)&&isFinite(i),"lockOffset value should be a finite. Given %s",t),"%"===a&&(r=r*n/100,i=i*o/100),{x:r,y:i}}function G(e){return e instanceof HTMLElement?(t=e,n=window.getComputedStyle(t),o=/(auto|scroll)/,["overflow","overflowX","overflowY"].find(function(e){return o.test(n[e])})?e:G(e.parentNode)):null;var t,n,o}var X=27,U=32,Y=37,q=38,F=39,V=40,z={Anchor:"A",Button:"BUTTON",Canvas:"CANVAS",Input:"INPUT",Option:"OPTION",Textarea:"TEXTAREA",Select:"SELECT"};function $(n){var e,t,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return t=e=function(e){function t(){return u(this,t),y(this,g(t).apply(this,arguments))}return m(t,e),d(t,[{key:"componentDidMount",value:function(){a.findDOMNode(this).sortableHandle=!0}},{key:"getWrappedInstance",value:function(){return w(o.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableHandle() call"),this.refs.wrappedInstance}},{key:"render",value:function(){var e=o.withRef?"wrappedInstance":null;return r.createElement(n,s({ref:e},this.props))}}]),t}(r.Component),c(e,"displayName",j("sortableHandle",n)),t}function J(e){return null!=e.sortableHandle}var Q=function(){function n(e,t){u(this,n),this.container=e,this.onScrollCallback=t}return d(n,[{key:"clear",value:function(){clearInterval(this.interval),this.interval=null}},{key:"update",value:function(e){var t=this,n=e.translate,o=e.minTranslate,r=e.maxTranslate,i=e.width,a=e.height,s={x:0,y:0},l={x:1,y:1},c=10,u=10,f=this.container,d=f.scrollTop,h=f.scrollLeft,p=f.scrollHeight,y=f.scrollWidth,g=0===d,v=p-d-f.clientHeight==0,m=0===h,x=y-h-f.clientWidth==0;n.y>=r.y-a/2&&!v?(s.y=1,l.y=u*Math.abs((r.y-a/2-n.y)/a)):n.x>=r.x-i/2&&!x?(s.x=1,l.x=c*Math.abs((r.x-i/2-n.x)/i)):n.y<=o.y+a/2&&!g?(s.y=-1,l.y=u*Math.abs((n.y-a/2-o.y)/a)):n.x<=o.x+i/2&&!m&&(s.x=-1,l.x=c*Math.abs((n.x-i/2-o.x)/i)),this.interval&&(this.clear(),this.isAutoScrolling=!1),0===s.x&&0===s.y||(this.interval=setInterval(function(){t.isAutoScrolling=!0;var e={left:l.x*s.x,top:l.y*s.y};t.container.scrollTop+=e.top,t.container.scrollLeft+=e.left,t.onScrollCallback(e)},5))}}]),n}();var Z={axis:i.oneOf(["x","y","xy"]),contentWindow:i.any,disableAutoscroll:i.bool,distance:i.number,getContainer:i.func,getHelperDimensions:i.func,helperClass:i.string,helperContainer:i.oneOfType([i.func,"undefined"==typeof HTMLElement?i.any:i.instanceOf(HTMLElement)]),hideSortableGhost:i.bool,keyboardSortingTransitionDuration:i.number,lockAxis:i.string,lockOffset:i.oneOfType([i.number,i.string,i.arrayOf(i.oneOfType([i.number,i.string]))]),lockToContainerEdges:i.bool,onSortEnd:i.func,onSortMove:i.func,onSortOver:i.func,onSortStart:i.func,pressDelay:i.number,pressThreshold:i.number,shouldCancelStart:i.func,transitionDuration:i.number,updateBeforeSortStart:i.func,useDragHandle:i.bool,useWindowAsScrollContainer:i.bool},ee={axis:"y",disableAutoscroll:!1,distance:0,getHelperDimensions:function(e){var t=e.node;return{height:t.offsetHeight,width:t.offsetWidth}},hideSortableGhost:!0,lockOffset:"50%",lockToContainerEdges:!1,pressDelay:0,pressThreshold:5,shouldCancelStart:function(e){return-1!==[z.Input,z.Textarea,z.Select,z.Option,z.Button].indexOf(e.target.tagName)||!!W(e.target,function(e){return"true"===e.contentEditable})},transitionDuration:300,useWindowAsScrollContainer:!1},te=Object.keys(Z);function ne(t){var e,n,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return n=e=function(e){function n(e){var k,t;return u(this,n),k=y(this,g(n).call(this,e)),c(p(p(k)),"handleStart",function(e){var t=k.props,n=t.distance,o=t.shouldCancelStart;if(2!==e.button&&!o(e)){k.touched=!0,k.position=K(e);var r,i=W(e.target,function(e){return null!=e.sortableInfo});if(i&&i.sortableInfo&&k.nodeIsChild(i)&&!k.state.sorting){var a=k.props.useDragHandle,s=i.sortableInfo,l=s.index,c=s.collection;if(s.disabled)return;if(a&&!W(e.target,J))return;k.manager.active={collection:c,index:l},(r=e).touches&&r.touches.length||r.changedTouches&&r.changedTouches.length||e.target.tagName!==z.Anchor||e.preventDefault(),n||(0===k.props.pressDelay?k.handlePress(e):k.pressTimer=setTimeout(function(){return k.handlePress(e)},k.props.pressDelay))}}}),c(p(p(k)),"nodeIsChild",function(e){return e.sortableInfo.manager===k.manager}),c(p(p(k)),"handleMove",function(e){var t=k.props,n=t.distance,o=t.pressThreshold;if(!k.state.sorting&&k.touched&&!k._awaitingUpdateBeforeSortStart){var r=K(e),i={x:k.position.x-r.x,y:k.position.y-r.y},a=Math.abs(i.x)+Math.abs(i.y);k.delta=i,n||o&&!(o<=a)?n&&n<=a&&k.manager.isActive()&&k.handlePress(e):(clearTimeout(k.cancelTimer),k.cancelTimer=setTimeout(k.cancel,0))}}),c(p(p(k)),"handleEnd",function(){k.touched=!1,k.cancel()}),c(p(p(k)),"cancel",function(){var e=k.props.distance;k.state.sorting||(e||clearTimeout(k.pressTimer),k.manager.active=null)}),c(p(p(k)),"handlePress",function(C){try{var r=k.manager.getActive(),e=function(){if(r){var e=function(){var e,t,n,o,r,i,a=S.sortableInfo.index,s=(e=S,{bottom:P((t=window.getComputedStyle(e)).marginBottom),left:P(t.marginLeft),right:P(t.marginRight),top:P(t.marginTop)}),l=k.scrollContainer.getBoundingClientRect(),c=v({collection:O,index:a,node:S});if(k.node=S,k.margin=s,k.width=c.width,k.height=c.height,k.marginOffset={x:k.margin.left+k.margin.right,y:Math.max(k.margin.top,k.margin.bottom)},k.boundingClientRect=S.getBoundingClientRect(),k.containerBoundingRect=l,k.index=a,k.newIndex=a,k.axis={x:0<=g.indexOf("x"),y:0<=g.indexOf("y")},k.offsetEdge=_(S,k.container),k.initialOffset=K(T?I({},C,{pageX:k.boundingClientRect.left,pageY:k.boundingClientRect.top}):C),k.initialScroll={left:k.scrollContainer.scrollLeft,top:k.scrollContainer.scrollTop},k.initialWindowScroll={left:window.pageXOffset,top:window.pageYOffset},k.helper=k.helperContainer.appendChild((o="input, textarea, select, canvas, [contenteditable]",r=(n=S).querySelectorAll(o),i=n.cloneNode(!0),E(i.querySelectorAll(o)).forEach(function(e,t){"file"!==e.type&&(e.value=r[t].value),"radio"===e.type&&e.name&&(e.name="__sortableClone__".concat(e.name)),e.tagName===z.Canvas&&e.getContext("2d").drawImage(r[t],0,0)}),i)),N(k.helper,{boxSizing:"border-box",height:"".concat(k.height,"px"),left:"".concat(k.boundingClientRect.left-s.left,"px"),pointerEvents:"none",position:"fixed",top:"".concat(k.boundingClientRect.top-s.top,"px"),width:"".concat(k.width,"px")}),T&&k.helper.focus(),x&&N(k.sortableGhost=S,{opacity:0,visibility:"hidden"}),k.minTranslate={},k.maxTranslate={},T){var u=w?{top:0,left:0,width:k.contentWindow.innerWidth,height:k.contentWindow.innerHeight}:k.containerBoundingRect,f=u.top,d=u.left,h=u.width,p=f+u.height,y=d+h;k.axis.x&&(k.minTranslate.x=d-k.boundingClientRect.left,k.maxTranslate.x=y-(k.boundingClientRect.left+k.width)),k.axis.y&&(k.minTranslate.y=f-k.boundingClientRect.top,k.maxTranslate.y=p-(k.boundingClientRect.top+k.height))}else k.axis.x&&(k.minTranslate.x=(w?0:l.left)-k.boundingClientRect.left-k.width/2,k.maxTranslate.x=(w?k.contentWindow.innerWidth:l.left+l.width)-k.boundingClientRect.left-k.width/2),k.axis.y&&(k.minTranslate.y=(w?0:l.top)-k.boundingClientRect.top-k.height/2,k.maxTranslate.y=(w?k.contentWindow.innerHeight:l.top+l.height)-k.boundingClientRect.top-k.height/2);m&&m.split(" ").forEach(function(e){return k.helper.classList.add(e)}),k.listenerNode=C.touches?S:k.contentWindow,T?(k.listenerNode.addEventListener("wheel",k.handleKeyEnd,!0),k.listenerNode.addEventListener("mousedown",k.handleKeyEnd,!0),k.listenerNode.addEventListener("keydown",k.handleKeyDown)):(R.move.forEach(function(e){return k.listenerNode.addEventListener(e,k.handleSortMove,!1)}),R.end.forEach(function(e){return k.listenerNode.addEventListener(e,k.handleSortEnd,!1)})),k.setState({sorting:!0,sortingIndex:a}),b&&b({node:S,index:a,collection:O,isKeySorting:T},C),T&&k.keyMove(0)},t=k.props,g=t.axis,v=t.getHelperDimensions,m=t.helperClass,x=t.hideSortableGhost,n=t.updateBeforeSortStart,b=t.onSortStart,w=t.useWindowAsScrollContainer,S=r.node,O=r.collection,T=k.manager.isKeySorting,o=function(){if("function"==typeof n){k._awaitingUpdateBeforeSortStart=!0;var e=function(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,value)}(function(){var e=S.sortableInfo.index;return Promise.resolve(n({collection:O,index:e,node:S},C)).then(function(){})},function(e,t){if(k._awaitingUpdateBeforeSortStart=!1,e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();return o&&o.then?o.then(e):e()}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}),c(p(p(k)),"handleSortMove",function(e){var t=k.props.onSortMove;"function"==typeof e.preventDefault&&e.preventDefault(),k.updateHelperPosition(e),k.animateNodes(),k.autoscroll(),t&&t(e)}),c(p(p(k)),"handleSortEnd",function(e){var t=k.props,n=t.hideSortableGhost,o=t.onSortEnd,r=k.manager,i=r.active.collection,a=r.isKeySorting,s=k.manager.refs[i];k.listenerNode&&(a?(k.listenerNode.removeEventListener("wheel",k.handleKeyEnd,!0),k.listenerNode.removeEventListener("mousedown",k.handleKeyEnd,!0),k.listenerNode.removeEventListener("keydown",k.handleKeyDown)):(R.move.forEach(function(e){return k.listenerNode.removeEventListener(e,k.handleSortMove)}),R.end.forEach(function(e){return k.listenerNode.removeEventListener(e,k.handleSortEnd)}))),k.helper.parentNode.removeChild(k.helper),n&&k.sortableGhost&&N(k.sortableGhost,{opacity:"",visibility:""});for(var l=0,c=s.length;l<c;l++){var u=s[l],f=u.node;u.edgeOffset=null,A(f,u.boundingClientRect=null),M(f,null),u.translate=null}k.autoScroller.clear(),k.manager.active=null,k.manager.isKeySorting=!1,k.setState({sorting:!1,sortingIndex:null}),"function"==typeof o&&o({collection:i,newIndex:k.newIndex,oldIndex:k.index,isKeySorting:a},e),k.touched=!1}),c(p(p(k)),"autoscroll",function(){var e=k.props.disableAutoscroll,t=k.manager.isKeySorting;if(!e){if(t){var n=I({},k.translate),o=0,r=0;return k.axis.x&&(n.x=Math.min(k.maxTranslate.x,Math.max(k.minTranslate.x,k.translate.x)),o=k.translate.x-n.x),k.axis.y&&(n.y=Math.min(k.maxTranslate.y,Math.max(k.minTranslate.y,k.translate.y)),r=k.translate.y-n.y),k.translate=n,A(k.helper,k.translate),k.scrollContainer.scrollLeft+=o,void(k.scrollContainer.scrollTop+=r)}k.autoScroller.update({height:k.height,maxTranslate:k.maxTranslate,minTranslate:k.minTranslate,translate:k.translate,width:k.width})}}),c(p(p(k)),"onAutoScroll",function(e){k.translate.x+=e.left,k.translate.y+=e.top,k.animateNodes()}),c(p(p(k)),"handleKeyDown",function(e){var t=e.keyCode,n=k.props.shouldCancelStart;if((!k.manager.active||k.manager.isKeySorting)&&(k.manager.active||t===U&&!n(e)&&k.isValidSortingTarget(e)))switch(e.stopPropagation(),e.preventDefault(),t){case U:k.manager.active?k.keyDrop(e):k.keyLift(e);break;case V:case F:k.keyMove(1);break;case q:case Y:k.keyMove(-1);break;case X:k.newIndex=k.manager.active.index,k.keyDrop(e)}}),c(p(p(k)),"keyLift",function(e){var t=e.target,n=W(t,function(e){return null!=e.sortableInfo}).sortableInfo,o=n.index,r=n.collection;k.initialFocusedNode=t,k.manager.isKeySorting=!0,k.manager.active={index:o,collection:r},k.handlePress(e)}),c(p(p(k)),"keyMove",function(e){var t=k.manager.getOrderedRefs(),n=t[t.length-1].node.sortableInfo.index,o=k.newIndex+e,r=k.newIndex;if(!(o<0||n<o)){k.prevIndex=r,k.newIndex=o;var i,a,s,l=(i=k.newIndex,a=k.prevIndex,s=k.index,i<s&&a<i?i-1:s<i&&i<a?i+1:i),c=t.find(function(e){return e.node.sortableInfo.index===l}),u=c.node,f=k.containerScrollDelta,d=c.boundingClientRect||H(u,f),h=c.translate||{x:0,y:0},p=d.top+h.y-f.top,y=d.left+h.x-f.left,g=r<o,v=g&&k.axis.x?u.offsetWidth-k.width:0,m=g&&k.axis.y?u.offsetHeight-k.height:0;k.handleSortMove({pageX:y+v,pageY:p+m,ignoreTransition:0===e})}}),c(p(p(k)),"keyDrop",function(e){k.handleSortEnd(e),k.initialFocusedNode&&k.initialFocusedNode.focus()}),c(p(p(k)),"handleKeyEnd",function(e){k.manager.active&&k.keyDrop(e)}),c(p(p(k)),"isValidSortingTarget",function(e){var t=k.props.useDragHandle,n=e.target,o=W(n,function(e){return null!=e.sortableInfo});return o&&o.sortableInfo&&!o.sortableInfo.disabled&&(t?J(n):n.sortableInfo)}),w(!((t=e).distance&&t.pressDelay),"Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time."),k.state={},k.manager=new x,k.events={end:k.handleEnd,move:k.handleMove,start:k.handleStart},k}return m(n,e),d(n,[{key:"getChildContext",value:function(){return{manager:this.manager}}},{key:"componentDidMount",value:function(){var n=this,o=this.props.useWindowAsScrollContainer,e=this.getContainer();Promise.resolve(e).then(function(e){n.container=e,n.document=n.container.ownerDocument||document;var t=n.props.contentWindow||n.document.defaultView||window;n.contentWindow="function"==typeof t?t():t,n.scrollContainer=o?n.document.scrollingElement||n.document.documentElement:G(n.container)||n.container,n.autoScroller=new Q(n.scrollContainer,n.onAutoScroll),Object.keys(n.events).forEach(function(t){return R[t].forEach(function(e){return n.container.addEventListener(e,n.events[t],!1)})}),n.container.addEventListener("keydown",n.handleKeyDown)})}},{key:"componentWillUnmount",value:function(){var n=this;this.helper&&this.helper.parentNode&&this.helper.parentNode.removeChild(this.helper),this.container&&(Object.keys(this.events).forEach(function(t){return R[t].forEach(function(e){return n.container.removeEventListener(e,n.events[t])})}),this.container.removeEventListener("keydown",this.handleKeyDown))}},{key:"updateHelperPosition",value:function(e){var t=this.props,n=t.lockAxis,o=t.lockOffset,r=t.lockToContainerEdges,i=t.transitionDuration,a=t.keyboardSortingTransitionDuration,s=void 0===a?i:a,l=this.manager.isKeySorting,c=e.ignoreTransition,u=K(e),f={x:u.x-this.initialOffset.x,y:u.y-this.initialOffset.y};if(f.y-=window.pageYOffset-this.initialWindowScroll.top,f.x-=window.pageXOffset-this.initialWindowScroll.left,this.translate=f,r){var d=function(e){var t=e.height,n=e.width,o=e.lockOffset,r=Array.isArray(o)?o:[o,o];w(2===r.length,"lockOffset prop of SortableContainer should be a single value or an array of exactly two values. Given %s",o);var i=b(r,2),a=i[0],s=i[1];return[B({height:t,lockOffset:a,width:n}),B({height:t,lockOffset:s,width:n})]}({height:this.height,lockOffset:o,width:this.width}),h=b(d,2),p=h[0],y=h[1],g=this.width/2-p.x,v=this.height/2-p.y,m=this.width/2-y.x,x=this.height/2-y.y;f.x=L(this.minTranslate.x+g,this.maxTranslate.x-m,f.x),f.y=L(this.minTranslate.y+v,this.maxTranslate.y-x,f.y)}"x"===n?f.y=0:"y"===n&&(f.x=0),l&&s&&!c&&M(this.helper,s),A(this.helper,f)}},{key:"animateNodes",value:function(){var e=this.props,t=e.transitionDuration,n=e.hideSortableGhost,o=e.onSortOver,r=this.containerScrollDelta,i=this.windowScrollDelta,a=this.manager.getOrderedRefs(),s=this.offsetEdge.left+this.translate.x+r.left,l=this.offsetEdge.top+this.translate.y+r.top,c=this.manager.isKeySorting,u=this.newIndex;this.newIndex=null;for(var f=0,d=a.length;f<d;f++){var h=a[f].node,p=h.sortableInfo.index,y=h.offsetWidth,g=h.offsetHeight,v=this.height>g?g/2:this.height/2,m=this.width>y?y/2:this.width/2,x=c&&p>this.index&&p<=u,b=c&&p<this.index&&u<=p,w={x:0,y:0},S=a[f].edgeOffset;S||(S=_(h,this.container),a[f].edgeOffset=S,c&&(a[f].boundingClientRect=H(h,r)));var O=f<a.length-1&&a[f+1],T=0<f&&a[f-1];O&&!O.edgeOffset&&(O.edgeOffset=_(O.node,this.container),c&&(O.boundingClientRect=H(O.node,r))),p!==this.index?(t&&M(h,t),this.axis.x?this.axis.y?b||p<this.index&&(s+i.left-m<=S.left&&l+i.top<=S.top+v||l+i.top+v<=S.top)?(w.x=this.width+this.marginOffset.x,S.left+w.x>this.containerBoundingRect.width-m&&O&&(w.x=O.edgeOffset.left-S.left,w.y=O.edgeOffset.top-S.top),null===this.newIndex&&(this.newIndex=p)):(x||p>this.index&&(s+i.left+m>=S.left&&l+i.top+v>=S.top||l+i.top+v>=S.top+g))&&(w.x=-(this.width+this.marginOffset.x),S.left+w.x<this.containerBoundingRect.left+m&&T&&(w.x=T.edgeOffset.left-S.left,w.y=T.edgeOffset.top-S.top),this.newIndex=p):x||p>this.index&&s+i.left+m>=S.left?(w.x=-(this.width+this.marginOffset.x),this.newIndex=p):(b||p<this.index&&s+i.left<=S.left+m)&&(w.x=this.width+this.marginOffset.x,null==this.newIndex&&(this.newIndex=p)):this.axis.y&&(x||p>this.index&&l+i.top+v>=S.top?(w.y=-(this.height+this.marginOffset.y),this.newIndex=p):(b||p<this.index&&l+i.top<=S.top+v)&&(w.y=this.height+this.marginOffset.y,null==this.newIndex&&(this.newIndex=p))),A(h,w),a[f].translate=w):n&&N(this.sortableGhost=h,{opacity:0,visibility:"hidden"})}null==this.newIndex&&(this.newIndex=this.index),c&&(this.newIndex=u),o&&this.newIndex!==u&&o({collection:this.manager.active.collection,index:this.index,newIndex:this.newIndex,oldIndex:u})}},{key:"getWrappedInstance",value:function(){return w(o.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call"),this.refs.wrappedInstance}},{key:"getContainer",value:function(){var e=this.props.getContainer;return"function"!=typeof e?a.findDOMNode(this):e(o.withRef?this.getWrappedInstance():void 0)}},{key:"render",value:function(){var e=o.withRef?"wrappedInstance":null;return r.createElement(t,s({ref:e},k(this.props,te)))}},{key:"helperContainer",get:function(){var e=this.props.helperContainer;return"function"==typeof e?e():this.props.helperContainer||this.document.body}},{key:"containerScrollDelta",get:function(){return this.props.useWindowAsScrollContainer?{left:0,top:0}:{left:this.scrollContainer.scrollLeft-this.initialScroll.left,top:this.scrollContainer.scrollTop-this.initialScroll.top}}},{key:"windowScrollDelta",get:function(){return{left:this.contentWindow.pageXOffset-this.initialWindowScroll.left,top:this.contentWindow.pageYOffset-this.initialWindowScroll.top}}}]),n}(r.Component),c(e,"displayName",j("sortableList",t)),c(e,"defaultProps",ee),c(e,"propTypes",Z),c(e,"childContextTypes",{manager:i.object.isRequired}),n}var oe={index:i.number.isRequired,collection:i.oneOfType([i.number,i.string]),disabled:i.bool},re=Object.keys(oe);function ie(n){var e,t,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return t=e=function(e){function t(){return u(this,t),y(this,g(t).apply(this,arguments))}return m(t,e),d(t,[{key:"componentDidMount",value:function(){this.register()}},{key:"componentDidUpdate",value:function(e){this.node&&(e.index!==this.props.index&&(this.node.sortableInfo.index=this.props.index),e.disabled!==this.props.disabled&&(this.node.sortableInfo.disabled=this.props.disabled)),e.collection!==this.props.collection&&(this.unregister(e.collection),this.register())}},{key:"componentWillUnmount",value:function(){this.unregister()}},{key:"register",value:function(){var e=this.props,t=e.collection,n=e.disabled,o=e.index,r=a.findDOMNode(this);r.sortableInfo={collection:t,disabled:n,index:o,manager:this.context.manager},this.node=r,this.ref={node:r},this.context.manager.add(t,this.ref)}},{key:"unregister",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.props.collection;this.context.manager.remove(e,this.ref)}},{key:"getWrappedInstance",value:function(){return w(o.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call"),this.refs.wrappedInstance}},{key:"render",value:function(){var e=o.withRef?"wrappedInstance":null;return r.createElement(n,s({ref:e},k(this.props,re)))}}]),t}(r.Component),c(e,"displayName",j("sortableElement",n)),c(e,"contextTypes",{manager:i.object.isRequired}),c(e,"propTypes",oe),c(e,"defaultProps",{collection:0}),t}e.SortableContainer=ne,e.sortableContainer=ne,e.SortableElement=ie,e.sortableElement=ie,e.SortableHandle=$,e.sortableHandle=$,e.arrayMove=function(e,t,n){return(e=e.slice()).splice(n<0?e.length+n:n,0,e.splice(t,1)[0]),e},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","react-dom"],t):t((e=e||self).SortableHOC={},e.React,e.PropTypes,e.ReactDOM)}(this,function(e,r,i,a){"use strict";function t(e,t){return e(t={exports:{}},t.exports),t.exports}i=i&&i.hasOwnProperty("default")?i.default:i;var s=t(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},t.apply(this,arguments)}e.exports=t});var n=function(e){if(Array.isArray(e))return e};var o=function(e,t){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(r)throw i}}return n};var l=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var b=function(e,t){return n(e)||o(e,t)||l()};var c=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};var I=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(e){c(t,e,n[e])})}return t};var u=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function d(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var f=function(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),e},h=t(function(t){function n(e){return(n="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})(e)}function o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(e){return n(e)}:t.exports=o=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},o(e)}t.exports=o});var p=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var g=function(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?p(e):t},y=t(function(t){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}t.exports=n}),v=t(function(n){function o(e,t){return n.exports=o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}n.exports=o});var m=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)},w=function(e,t,n,o,r,i,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,r,i,a,s],u=0;(l=new Error(t.replace(/%s/g,function(){return c[u++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}},x=function(){function e(){u(this,e),c(this,"refs",{})}return f(e,[{key:"add",value:function(e,t){this.refs[e]||(this.refs[e]=[]),this.refs[e].push(t)}},{key:"remove",value:function(e,t){var n=this.getIndex(e,t);-1!==n&&this.refs[e].splice(n,1)}},{key:"isActive",value:function(){return this.active}},{key:"getActive",value:function(){var t=this;return this.refs[this.active.collection].find(function(e){return e.node.sortableInfo.index==t.active.index})}},{key:"getIndex",value:function(e,t){return this.refs[e].indexOf(t)}},{key:"getOrderedRefs",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.active.collection;return this.refs[e].sort(S)}}]),e}();function S(e,t){return e.node.sortableInfo.index-t.node.sortableInfo.index}var O=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}};var T=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)};var C=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var E=function(e){return O(e)||T(e)||C()};function k(n){for(var e=arguments.length,o=new Array(1<e?e-1:0),t=1;t<e;t++)o[t-1]=arguments[t];return Object.keys(n).reduce(function(e,t){return-1===o.indexOf(t)&&(e[t]=n[t]),e},{})}var R={end:["touchend","touchcancel","mouseup"],move:["touchmove","mousemove"],start:["touchstart","mousedown"]},D=function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var e=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1];switch(t){case"ms":return"ms";default:return t&&t.length?t[0].toUpperCase()+t.substr(1):""}}();function N(t,n){Object.keys(n).forEach(function(e){t.style[e]=n[e]})}function A(e,t){e.style["".concat(D,"Transform")]=null==t?"":"translate3d(".concat(t.x,"px,").concat(t.y,"px,0)")}function M(e,t){e.style["".concat(D,"TransitionDuration")]=null==t?"":"".concat(t,"ms")}function W(e,t){for(;e;){if(t(e))return e;e=e.parentNode}return null}function L(e,t,n){return Math.max(e,Math.min(n,t))}function P(e){return"px"===e.substr(-2)?parseFloat(e):0}function j(e,t){var n=t.displayName||t.name;return n?"".concat(e,"(").concat(n,")"):e}function H(e,t){var n=e.getBoundingClientRect();return{top:n.top+t.top,left:n.left+t.left}}function K(e){return e.touches&&e.touches.length?{x:e.touches[0].pageX,y:e.touches[0].pageY}:e.changedTouches&&e.changedTouches.length?{x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY}:{x:e.pageX,y:e.pageY}}function _(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){var o={left:n.left+e.offsetLeft,top:n.top+e.offsetTop};return e.parentNode===t?o:_(e.parentNode,t,o)}}function B(e){var t=e.lockOffset,n=e.width,o=e.height,r=t,i=t,a="px";if("string"==typeof t){var s=/^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(t);w(null!==s,'lockOffset value should be a number or a string of a number followed by "px" or "%". Given %s',t),r=parseFloat(t),i=parseFloat(t),a=s[1]}return w(isFinite(r)&&isFinite(i),"lockOffset value should be a finite. Given %s",t),"%"===a&&(r=r*n/100,i=i*o/100),{x:r,y:i}}function G(e){return e instanceof HTMLElement?(t=e,n=window.getComputedStyle(t),o=/(auto|scroll)/,["overflow","overflowX","overflowY"].find(function(e){return o.test(n[e])})?e:G(e.parentNode)):null;var t,n,o}var X=27,U=32,Y=37,q=38,F=39,V=40,z={Anchor:"A",Button:"BUTTON",Canvas:"CANVAS",Input:"INPUT",Option:"OPTION",Textarea:"TEXTAREA",Select:"SELECT"};function $(n){var e,t,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return t=e=function(e){function t(){return u(this,t),g(this,y(t).apply(this,arguments))}return m(t,e),f(t,[{key:"componentDidMount",value:function(){a.findDOMNode(this).sortableHandle=!0}},{key:"getWrappedInstance",value:function(){return w(o.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableHandle() call"),this.refs.wrappedInstance}},{key:"render",value:function(){var e=o.withRef?"wrappedInstance":null;return r.createElement(n,s({ref:e},this.props))}}]),t}(r.Component),c(e,"displayName",j("sortableHandle",n)),t}function J(e){return null!=e.sortableHandle}var Q=function(){function n(e,t){u(this,n),this.container=e,this.onScrollCallback=t}return f(n,[{key:"clear",value:function(){clearInterval(this.interval),this.interval=null}},{key:"update",value:function(e){var t=this,n=e.translate,o=e.minTranslate,r=e.maxTranslate,i=e.width,a=e.height,s={x:0,y:0},l={x:1,y:1},c=10,u=10,d=this.container,f=d.scrollTop,h=d.scrollLeft,p=d.scrollHeight,g=d.scrollWidth,y=0===f,v=p-f-d.clientHeight==0,m=0===h,x=g-h-d.clientWidth==0;n.y>=r.y-a/2&&!v?(s.y=1,l.y=u*Math.abs((r.y-a/2-n.y)/a)):n.x>=r.x-i/2&&!x?(s.x=1,l.x=c*Math.abs((r.x-i/2-n.x)/i)):n.y<=o.y+a/2&&!y?(s.y=-1,l.y=u*Math.abs((n.y-a/2-o.y)/a)):n.x<=o.x+i/2&&!m&&(s.x=-1,l.x=c*Math.abs((n.x-i/2-o.x)/i)),this.interval&&(this.clear(),this.isAutoScrolling=!1),0===s.x&&0===s.y||(this.interval=setInterval(function(){t.isAutoScrolling=!0;var e={left:l.x*s.x,top:l.y*s.y};t.container.scrollTop+=e.top,t.container.scrollLeft+=e.left,t.onScrollCallback(e)},5))}}]),n}();var Z={axis:i.oneOf(["x","y","xy"]),contentWindow:i.any,disableAutoscroll:i.bool,distance:i.number,getContainer:i.func,getHelperDimensions:i.func,helperClass:i.string,helperContainer:i.oneOfType([i.func,"undefined"==typeof HTMLElement?i.any:i.instanceOf(HTMLElement)]),hideSortableGhost:i.bool,keyboardSortingTransitionDuration:i.number,lockAxis:i.string,lockOffset:i.oneOfType([i.number,i.string,i.arrayOf(i.oneOfType([i.number,i.string]))]),lockToContainerEdges:i.bool,onSortEnd:i.func,onSortMove:i.func,onSortOver:i.func,onSortStart:i.func,pressDelay:i.number,pressThreshold:i.number,shouldCancelStart:i.func,transitionDuration:i.number,updateBeforeSortStart:i.func,useDragHandle:i.bool,useWindowAsScrollContainer:i.bool},ee={axis:"y",disableAutoscroll:!1,distance:0,getHelperDimensions:function(e){var t=e.node;return{height:t.offsetHeight,width:t.offsetWidth}},hideSortableGhost:!0,lockOffset:"50%",lockToContainerEdges:!1,pressDelay:0,pressThreshold:5,shouldCancelStart:function(e){return-1!==[z.Input,z.Textarea,z.Select,z.Option,z.Button].indexOf(e.target.tagName)||!!W(e.target,function(e){return"true"===e.contentEditable})},transitionDuration:300,useWindowAsScrollContainer:!1},te=Object.keys(Z);function ne(t){var e,n,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return n=e=function(e){function n(e){var k,t;return u(this,n),k=g(this,y(n).call(this,e)),c(p(p(k)),"handleStart",function(e){var t=k.props,n=t.distance,o=t.shouldCancelStart;if(2!==e.button&&!o(e)){k.touched=!0,k.position=K(e);var r,i=W(e.target,function(e){return null!=e.sortableInfo});if(i&&i.sortableInfo&&k.nodeIsChild(i)&&!k.state.sorting){var a=k.props.useDragHandle,s=i.sortableInfo,l=s.index,c=s.collection;if(s.disabled)return;if(a&&!W(e.target,J))return;k.manager.active={collection:c,index:l},(r=e).touches&&r.touches.length||r.changedTouches&&r.changedTouches.length||e.target.tagName!==z.Anchor||e.preventDefault(),n||(0===k.props.pressDelay?k.handlePress(e):k.pressTimer=setTimeout(function(){return k.handlePress(e)},k.props.pressDelay))}}}),c(p(p(k)),"nodeIsChild",function(e){return e.sortableInfo.manager===k.manager}),c(p(p(k)),"handleMove",function(e){var t=k.props,n=t.distance,o=t.pressThreshold;if(!k.state.sorting&&k.touched&&!k._awaitingUpdateBeforeSortStart){var r=K(e),i={x:k.position.x-r.x,y:k.position.y-r.y},a=Math.abs(i.x)+Math.abs(i.y);k.delta=i,n||o&&!(o<=a)?n&&n<=a&&k.manager.isActive()&&k.handlePress(e):(clearTimeout(k.cancelTimer),k.cancelTimer=setTimeout(k.cancel,0))}}),c(p(p(k)),"handleEnd",function(){k.touched=!1,k.cancel()}),c(p(p(k)),"cancel",function(){var e=k.props.distance;k.state.sorting||(e||clearTimeout(k.pressTimer),k.manager.active=null)}),c(p(p(k)),"handlePress",function(C){try{var r=k.manager.getActive(),e=function(){if(r){var e=function(){var e,t,n,o,r,i,a=S.sortableInfo.index,s=(e=S,{bottom:P((t=window.getComputedStyle(e)).marginBottom),left:P(t.marginLeft),right:P(t.marginRight),top:P(t.marginTop)}),l=k.scrollContainer.getBoundingClientRect(),c=v({collection:O,index:a,node:S});if(k.node=S,k.margin=s,k.width=c.width,k.height=c.height,k.marginOffset={x:k.margin.left+k.margin.right,y:Math.max(k.margin.top,k.margin.bottom)},k.boundingClientRect=S.getBoundingClientRect(),k.containerBoundingRect=l,k.index=a,k.newIndex=a,k.axis={x:0<=y.indexOf("x"),y:0<=y.indexOf("y")},k.offsetEdge=_(S,k.container),k.initialOffset=K(T?I({},C,{pageX:k.boundingClientRect.left,pageY:k.boundingClientRect.top}):C),k.initialScroll={left:k.scrollContainer.scrollLeft,top:k.scrollContainer.scrollTop},k.initialWindowScroll={left:window.pageXOffset,top:window.pageYOffset},k.helper=k.helperContainer.appendChild((o="input, textarea, select, canvas, [contenteditable]",r=(n=S).querySelectorAll(o),i=n.cloneNode(!0),E(i.querySelectorAll(o)).forEach(function(e,t){"file"!==e.type&&(e.value=r[t].value),"radio"===e.type&&e.name&&(e.name="__sortableClone__".concat(e.name)),e.tagName===z.Canvas&&0<r[t].width&&0<r[t].height&&e.getContext("2d").drawImage(r[t],0,0)}),i)),N(k.helper,{boxSizing:"border-box",height:"".concat(k.height,"px"),left:"".concat(k.boundingClientRect.left-s.left,"px"),pointerEvents:"none",position:"fixed",top:"".concat(k.boundingClientRect.top-s.top,"px"),width:"".concat(k.width,"px")}),T&&k.helper.focus(),x&&N(k.sortableGhost=S,{opacity:0,visibility:"hidden"}),k.minTranslate={},k.maxTranslate={},T){var u=w?{top:0,left:0,width:k.contentWindow.innerWidth,height:k.contentWindow.innerHeight}:k.containerBoundingRect,d=u.top,f=u.left,h=u.width,p=d+u.height,g=f+h;k.axis.x&&(k.minTranslate.x=f-k.boundingClientRect.left,k.maxTranslate.x=g-(k.boundingClientRect.left+k.width)),k.axis.y&&(k.minTranslate.y=d-k.boundingClientRect.top,k.maxTranslate.y=p-(k.boundingClientRect.top+k.height))}else k.axis.x&&(k.minTranslate.x=(w?0:l.left)-k.boundingClientRect.left-k.width/2,k.maxTranslate.x=(w?k.contentWindow.innerWidth:l.left+l.width)-k.boundingClientRect.left-k.width/2),k.axis.y&&(k.minTranslate.y=(w?0:l.top)-k.boundingClientRect.top-k.height/2,k.maxTranslate.y=(w?k.contentWindow.innerHeight:l.top+l.height)-k.boundingClientRect.top-k.height/2);m&&m.split(" ").forEach(function(e){return k.helper.classList.add(e)}),k.listenerNode=C.touches?S:k.contentWindow,T?(k.listenerNode.addEventListener("wheel",k.handleKeyEnd,!0),k.listenerNode.addEventListener("mousedown",k.handleKeyEnd,!0),k.listenerNode.addEventListener("keydown",k.handleKeyDown)):(R.move.forEach(function(e){return k.listenerNode.addEventListener(e,k.handleSortMove,!1)}),R.end.forEach(function(e){return k.listenerNode.addEventListener(e,k.handleSortEnd,!1)})),k.setState({sorting:!0,sortingIndex:a}),b&&b({node:S,index:a,collection:O,isKeySorting:T},C),T&&k.keyMove(0)},t=k.props,y=t.axis,v=t.getHelperDimensions,m=t.helperClass,x=t.hideSortableGhost,n=t.updateBeforeSortStart,b=t.onSortStart,w=t.useWindowAsScrollContainer,S=r.node,O=r.collection,T=k.manager.isKeySorting,o=function(){if("function"==typeof n){k._awaitingUpdateBeforeSortStart=!0;var e=function(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,value)}(function(){var e=S.sortableInfo.index;return Promise.resolve(n({collection:O,index:e,node:S,isKeySorting:T},C)).then(function(){})},function(e,t){if(k._awaitingUpdateBeforeSortStart=!1,e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();return o&&o.then?o.then(e):e()}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}),c(p(p(k)),"handleSortMove",function(e){var t=k.props.onSortMove;"function"==typeof e.preventDefault&&e.preventDefault(),k.updateHelperPosition(e),k.animateNodes(),k.autoscroll(),t&&t(e)}),c(p(p(k)),"handleSortEnd",function(e){var t=k.props,n=t.hideSortableGhost,o=t.onSortEnd,r=k.manager,i=r.active.collection,a=r.isKeySorting,s=k.manager.refs[i];k.listenerNode&&(a?(k.listenerNode.removeEventListener("wheel",k.handleKeyEnd,!0),k.listenerNode.removeEventListener("mousedown",k.handleKeyEnd,!0),k.listenerNode.removeEventListener("keydown",k.handleKeyDown)):(R.move.forEach(function(e){return k.listenerNode.removeEventListener(e,k.handleSortMove)}),R.end.forEach(function(e){return k.listenerNode.removeEventListener(e,k.handleSortEnd)}))),k.helper.parentNode.removeChild(k.helper),n&&k.sortableGhost&&N(k.sortableGhost,{opacity:"",visibility:""});for(var l=0,c=s.length;l<c;l++){var u=s[l],d=u.node;u.edgeOffset=null,A(d,u.boundingClientRect=null),M(d,null),u.translate=null}k.autoScroller.clear(),k.manager.active=null,k.manager.isKeySorting=!1,k.setState({sorting:!1,sortingIndex:null}),"function"==typeof o&&o({collection:i,newIndex:k.newIndex,oldIndex:k.index,isKeySorting:a},e),k.touched=!1}),c(p(p(k)),"autoscroll",function(){var e=k.props.disableAutoscroll,t=k.manager.isKeySorting;if(!e){if(t){var n=I({},k.translate),o=0,r=0;return k.axis.x&&(n.x=Math.min(k.maxTranslate.x,Math.max(k.minTranslate.x,k.translate.x)),o=k.translate.x-n.x),k.axis.y&&(n.y=Math.min(k.maxTranslate.y,Math.max(k.minTranslate.y,k.translate.y)),r=k.translate.y-n.y),k.translate=n,A(k.helper,k.translate),k.scrollContainer.scrollLeft+=o,void(k.scrollContainer.scrollTop+=r)}k.autoScroller.update({height:k.height,maxTranslate:k.maxTranslate,minTranslate:k.minTranslate,translate:k.translate,width:k.width})}}),c(p(p(k)),"onAutoScroll",function(e){k.translate.x+=e.left,k.translate.y+=e.top,k.animateNodes()}),c(p(p(k)),"handleKeyDown",function(e){var t=e.keyCode,n=k.props.shouldCancelStart;if((!k.manager.active||k.manager.isKeySorting)&&(k.manager.active||t===U&&!n(e)&&k.isValidSortingTarget(e)))switch(e.stopPropagation(),e.preventDefault(),t){case U:k.manager.active?k.keyDrop(e):k.keyLift(e);break;case V:case F:k.keyMove(1);break;case q:case Y:k.keyMove(-1);break;case X:k.newIndex=k.manager.active.index,k.keyDrop(e)}}),c(p(p(k)),"keyLift",function(e){var t=e.target,n=W(t,function(e){return null!=e.sortableInfo}).sortableInfo,o=n.index,r=n.collection;k.initialFocusedNode=t,k.manager.isKeySorting=!0,k.manager.active={index:o,collection:r},k.handlePress(e)}),c(p(p(k)),"keyMove",function(e){var t=k.manager.getOrderedRefs(),n=t[t.length-1].node.sortableInfo.index,o=k.newIndex+e,r=k.newIndex;if(!(o<0||n<o)){k.prevIndex=r,k.newIndex=o;var i,a,s,l=(i=k.newIndex,a=k.prevIndex,s=k.index,i<s&&a<i?i-1:s<i&&i<a?i+1:i),c=t.find(function(e){return e.node.sortableInfo.index===l}),u=c.node,d=k.containerScrollDelta,f=c.boundingClientRect||H(u,d),h=c.translate||{x:0,y:0},p=f.top+h.y-d.top,g=f.left+h.x-d.left,y=r<o,v=y&&k.axis.x?u.offsetWidth-k.width:0,m=y&&k.axis.y?u.offsetHeight-k.height:0;k.handleSortMove({pageX:g+v,pageY:p+m,ignoreTransition:0===e})}}),c(p(p(k)),"keyDrop",function(e){k.handleSortEnd(e),k.initialFocusedNode&&k.initialFocusedNode.focus()}),c(p(p(k)),"handleKeyEnd",function(e){k.manager.active&&k.keyDrop(e)}),c(p(p(k)),"isValidSortingTarget",function(e){var t=k.props.useDragHandle,n=e.target,o=W(n,function(e){return null!=e.sortableInfo});return o&&o.sortableInfo&&!o.sortableInfo.disabled&&(t?J(n):n.sortableInfo)}),w(!((t=e).distance&&t.pressDelay),"Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time."),k.state={},k.manager=new x,k.events={end:k.handleEnd,move:k.handleMove,start:k.handleStart},k}return m(n,e),f(n,[{key:"getChildContext",value:function(){return{manager:this.manager}}},{key:"componentDidMount",value:function(){var n=this,o=this.props.useWindowAsScrollContainer,e=this.getContainer();Promise.resolve(e).then(function(e){n.container=e,n.document=n.container.ownerDocument||document;var t=n.props.contentWindow||n.document.defaultView||window;n.contentWindow="function"==typeof t?t():t,n.scrollContainer=o?n.document.scrollingElement||n.document.documentElement:G(n.container)||n.container,n.autoScroller=new Q(n.scrollContainer,n.onAutoScroll),Object.keys(n.events).forEach(function(t){return R[t].forEach(function(e){return n.container.addEventListener(e,n.events[t],!1)})}),n.container.addEventListener("keydown",n.handleKeyDown)})}},{key:"componentWillUnmount",value:function(){var n=this;this.helper&&this.helper.parentNode&&this.helper.parentNode.removeChild(this.helper),this.container&&(Object.keys(this.events).forEach(function(t){return R[t].forEach(function(e){return n.container.removeEventListener(e,n.events[t])})}),this.container.removeEventListener("keydown",this.handleKeyDown))}},{key:"updateHelperPosition",value:function(e){var t=this.props,n=t.lockAxis,o=t.lockOffset,r=t.lockToContainerEdges,i=t.transitionDuration,a=t.keyboardSortingTransitionDuration,s=void 0===a?i:a,l=this.manager.isKeySorting,c=e.ignoreTransition,u=K(e),d={x:u.x-this.initialOffset.x,y:u.y-this.initialOffset.y};if(d.y-=window.pageYOffset-this.initialWindowScroll.top,d.x-=window.pageXOffset-this.initialWindowScroll.left,this.translate=d,r){var f=function(e){var t=e.height,n=e.width,o=e.lockOffset,r=Array.isArray(o)?o:[o,o];w(2===r.length,"lockOffset prop of SortableContainer should be a single value or an array of exactly two values. Given %s",o);var i=b(r,2),a=i[0],s=i[1];return[B({height:t,lockOffset:a,width:n}),B({height:t,lockOffset:s,width:n})]}({height:this.height,lockOffset:o,width:this.width}),h=b(f,2),p=h[0],g=h[1],y=this.width/2-p.x,v=this.height/2-p.y,m=this.width/2-g.x,x=this.height/2-g.y;d.x=L(this.minTranslate.x+y,this.maxTranslate.x-m,d.x),d.y=L(this.minTranslate.y+v,this.maxTranslate.y-x,d.y)}"x"===n?d.y=0:"y"===n&&(d.x=0),l&&s&&!c&&M(this.helper,s),A(this.helper,d)}},{key:"animateNodes",value:function(){var e=this.props,t=e.transitionDuration,n=e.hideSortableGhost,o=e.onSortOver,r=this.containerScrollDelta,i=this.windowScrollDelta,a=this.manager.getOrderedRefs(),s=this.offsetEdge.left+this.translate.x+r.left,l=this.offsetEdge.top+this.translate.y+r.top,c=this.manager.isKeySorting,u=this.newIndex;this.newIndex=null;for(var d=0,f=a.length;d<f;d++){var h=a[d].node,p=h.sortableInfo.index,g=h.offsetWidth,y=h.offsetHeight,v=this.height>y?y/2:this.height/2,m=this.width>g?g/2:this.width/2,x=c&&p>this.index&&p<=u,b=c&&p<this.index&&u<=p,w={x:0,y:0},S=a[d].edgeOffset;S||(S=_(h,this.container),a[d].edgeOffset=S,c&&(a[d].boundingClientRect=H(h,r)));var O=d<a.length-1&&a[d+1],T=0<d&&a[d-1];O&&!O.edgeOffset&&(O.edgeOffset=_(O.node,this.container),c&&(O.boundingClientRect=H(O.node,r))),p!==this.index?(t&&M(h,t),this.axis.x?this.axis.y?b||p<this.index&&(s+i.left-m<=S.left&&l+i.top<=S.top+v||l+i.top+v<=S.top)?(w.x=this.width+this.marginOffset.x,S.left+w.x>this.containerBoundingRect.width-m&&O&&(w.x=O.edgeOffset.left-S.left,w.y=O.edgeOffset.top-S.top),null===this.newIndex&&(this.newIndex=p)):(x||p>this.index&&(s+i.left+m>=S.left&&l+i.top+v>=S.top||l+i.top+v>=S.top+y))&&(w.x=-(this.width+this.marginOffset.x),S.left+w.x<this.containerBoundingRect.left+m&&T&&(w.x=T.edgeOffset.left-S.left,w.y=T.edgeOffset.top-S.top),this.newIndex=p):x||p>this.index&&s+i.left+m>=S.left?(w.x=-(this.width+this.marginOffset.x),this.newIndex=p):(b||p<this.index&&s+i.left<=S.left+m)&&(w.x=this.width+this.marginOffset.x,null==this.newIndex&&(this.newIndex=p)):this.axis.y&&(x||p>this.index&&l+i.top+v>=S.top?(w.y=-(this.height+this.marginOffset.y),this.newIndex=p):(b||p<this.index&&l+i.top<=S.top+v)&&(w.y=this.height+this.marginOffset.y,null==this.newIndex&&(this.newIndex=p))),A(h,w),a[d].translate=w):n&&N(this.sortableGhost=h,{opacity:0,visibility:"hidden"})}null==this.newIndex&&(this.newIndex=this.index),c&&(this.newIndex=u);var C=c?this.prevIndex:u;o&&this.newIndex!==C&&o({collection:this.manager.active.collection,index:this.index,newIndex:this.newIndex,oldIndex:C,isKeySorting:c})}},{key:"getWrappedInstance",value:function(){return w(o.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call"),this.refs.wrappedInstance}},{key:"getContainer",value:function(){var e=this.props.getContainer;return"function"!=typeof e?a.findDOMNode(this):e(o.withRef?this.getWrappedInstance():void 0)}},{key:"render",value:function(){var e=o.withRef?"wrappedInstance":null;return r.createElement(t,s({ref:e},k(this.props,te)))}},{key:"helperContainer",get:function(){var e=this.props.helperContainer;return"function"==typeof e?e():this.props.helperContainer||this.document.body}},{key:"containerScrollDelta",get:function(){return this.props.useWindowAsScrollContainer?{left:0,top:0}:{left:this.scrollContainer.scrollLeft-this.initialScroll.left,top:this.scrollContainer.scrollTop-this.initialScroll.top}}},{key:"windowScrollDelta",get:function(){return{left:this.contentWindow.pageXOffset-this.initialWindowScroll.left,top:this.contentWindow.pageYOffset-this.initialWindowScroll.top}}}]),n}(r.Component),c(e,"displayName",j("sortableList",t)),c(e,"defaultProps",ee),c(e,"propTypes",Z),c(e,"childContextTypes",{manager:i.object.isRequired}),n}var oe={index:i.number.isRequired,collection:i.oneOfType([i.number,i.string]),disabled:i.bool},re=Object.keys(oe);function ie(n){var e,t,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return t=e=function(e){function t(){return u(this,t),g(this,y(t).apply(this,arguments))}return m(t,e),f(t,[{key:"componentDidMount",value:function(){this.register()}},{key:"componentDidUpdate",value:function(e){this.node&&(e.index!==this.props.index&&(this.node.sortableInfo.index=this.props.index),e.disabled!==this.props.disabled&&(this.node.sortableInfo.disabled=this.props.disabled)),e.collection!==this.props.collection&&(this.unregister(e.collection),this.register())}},{key:"componentWillUnmount",value:function(){this.unregister()}},{key:"register",value:function(){var e=this.props,t=e.collection,n=e.disabled,o=e.index,r=a.findDOMNode(this);r.sortableInfo={collection:t,disabled:n,index:o,manager:this.context.manager},this.node=r,this.ref={node:r},this.context.manager.add(t,this.ref)}},{key:"unregister",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.props.collection;this.context.manager.remove(e,this.ref)}},{key:"getWrappedInstance",value:function(){return w(o.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call"),this.refs.wrappedInstance}},{key:"render",value:function(){var e=o.withRef?"wrappedInstance":null;return r.createElement(n,s({ref:e},k(this.props,re)))}}]),t}(r.Component),c(e,"displayName",j("sortableElement",n)),c(e,"contextTypes",{manager:i.object.isRequired}),c(e,"propTypes",oe),c(e,"defaultProps",{collection:0}),t}e.SortableContainer=ne,e.sortableContainer=ne,e.SortableElement=ie,e.sortableElement=ie,e.SortableHandle=$,e.sortableHandle=$,e.arrayMove=function(e,t,n){return(e=e.slice()).splice(n<0?e.length+n:n,0,e.splice(t,1)[0]),e},Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "react-sortable-hoc",
"version": "1.9.0",
"version": "1.9.1",
"description": "Set of higher-order components to turn any list into a sortable, touch-friendly, animated list",

@@ -5,0 +5,0 @@ "author": {

@@ -98,27 +98,27 @@ # <img src="https://user-images.githubusercontent.com/1416436/54170652-dfd59d80-444d-11e9-9c51-658638c0454b.png" width="400" alt="React Sortable HOC" />

| Property | Type | Default | Description |
| :-------------------------------- | :-------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| axis | String | `y` | Items can be sorted horizontally, vertically or in a grid. Possible values: `x`, `y` or `xy` |
| lockAxis | String | | If you'd like, you can lock movement to an axis while sorting. This is not something that is possible with HTML5 Drag & Drop. Possible values: `x` or `y`. |
| helperClass | String | | You can provide a class you'd like to add to the sortable helper to add some styles to it |
| transitionDuration | Number | `300` | The duration of the transition when elements shift positions. Set this to `0` if you'd like to disable transitions |
| keyboardSortingTransitionDuration | Number | `transitionDuration` | The duration of the transition when the helper is shifted during keyboard sorting. Set this to `0` if you'd like to disable transitions for the keyboard sorting helper. Defaults to the value set for `transitionDuration` if undefined |
| pressDelay | Number | `0` | If you'd like elements to only become sortable after being pressed for a certain time, change this property. A good sensible default value for mobile is `200`. Cannot be used in conjunction with the `distance` prop. |
| pressThreshold | Number | `5` | Number of pixels of movement to tolerate before ignoring a press event. |
| distance | Number | `0` | If you'd like elements to only become sortable after being dragged a certain number of pixels. Cannot be used in conjunction with the `pressDelay` prop. |
| shouldCancelStart | Function | [Function](https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L48) | This function is invoked before sorting begins, and can be used to programatically cancel sorting before it begins. By default, it will cancel sorting if the event target is either an `input`, `textarea`, `select` or `option`. |
| updateBeforeSortStart | Function | | This function is invoked before sorting begins. It can return a promise, allowing you to run asynchronous updates (such as `setState`) before sorting begins. `function({node, index, collection}, event)` |
| onSortStart | Function | | Callback that is invoked when sorting begins. `function({node, index, collection, isKeySorting}, event)` |
| onSortMove | Function | | Callback that is invoked during sorting as the cursor moves. `function(event)` |
| onSortOver | Function | | Callback that is invoked when moving over an item. `function({index, oldIndex, newIndex, collection}, e)` |
| onSortEnd | Function | | Callback that is invoked when sorting ends. `function({oldIndex, newIndex, collection, isKeySorting}, e)` |
| useDragHandle | Boolean | `false` | If you're using the `SortableHandle` HOC, set this to `true` |
| useWindowAsScrollContainer | Boolean | `false` | If you want, you can set the `window` as the scrolling container |
| hideSortableGhost | Boolean | `true` | Whether to auto-hide the ghost element. By default, as a convenience, React Sortable List will automatically hide the element that is currently being sorted. Set this to false if you would like to apply your own styling. |
| lockToContainerEdges | Boolean | `false` | You can lock movement of the sortable element to it's parent `SortableContainer` |
| lockOffset | `OffsetValue`\* &#124; [`OffsetValue`\*, `OffsetValue`\*] | "50%"`| When`lockToContainerEdges`is set to`true`, this controls the offset distance between the sortable helper and the top/bottom edges of it's parent`SortableContainer`. Percentage values are relative to the height of the item currently being sorted. If you wish to specify different behaviours for locking to the _top_ of the container vs the _bottom_, you may also pass in an`array`(For example:`["0%", "100%"]`). |
| getContainer | Function | | Optional function to return the scrollable container element. This property defaults to the `SortableContainer` element itself or (if `useWindowAsScrollContainer` is true) the window. Use this function to specify a custom container object (eg this is useful for integrating with certain 3rd party components such as `FlexTable`). This function is passed a single parameter (the `wrappedInstance` React element) and it is expected to return a DOM element. |
| getHelperDimensions | Function | [Function](https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L74-L77) | Optional `function({node, index, collection})` that should return the computed dimensions of the SortableHelper. See [default implementation](https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L74-L77) for more details |
| helperContainer | HTMLElement &#124; Function | `document.body` | By default, the cloned sortable helper is appended to the document body. Use this prop to specify a different container for the sortable clone to be appended to. Accepts an `HTMLElement` or a function returning an `HTMLElement` that will be invoked before right before sorting begins |
| disableAutoscroll | Boolean | `false` | Disables autoscrolling while dragging |
| Property | Type | Default | Description |
| :-------------------------------- | :-------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| axis | String | `y` | Items can be sorted horizontally, vertically or in a grid. Possible values: `x`, `y` or `xy` |
| lockAxis | String | | If you'd like, you can lock movement to an axis while sorting. This is not something that is possible with HTML5 Drag & Drop. Possible values: `x` or `y`. |
| helperClass | String | | You can provide a class you'd like to add to the sortable helper to add some styles to it |
| transitionDuration | Number | `300` | The duration of the transition when elements shift positions. Set this to `0` if you'd like to disable transitions |
| keyboardSortingTransitionDuration | Number | `transitionDuration` | The duration of the transition when the helper is shifted during keyboard sorting. Set this to `0` if you'd like to disable transitions for the keyboard sorting helper. Defaults to the value set for `transitionDuration` if undefined |
| pressDelay | Number | `0` | If you'd like elements to only become sortable after being pressed for a certain time, change this property. A good sensible default value for mobile is `200`. Cannot be used in conjunction with the `distance` prop. |
| pressThreshold | Number | `5` | Number of pixels of movement to tolerate before ignoring a press event. |
| distance | Number | `0` | If you'd like elements to only become sortable after being dragged a certain number of pixels. Cannot be used in conjunction with the `pressDelay` prop. |
| shouldCancelStart | Function | [Function](https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L48) | This function is invoked before sorting begins, and can be used to programatically cancel sorting before it begins. By default, it will cancel sorting if the event target is either an `input`, `textarea`, `select` or `option`. |
| updateBeforeSortStart | Function | | This function is invoked before sorting begins. It can return a promise, allowing you to run asynchronous updates (such as `setState`) before sorting begins. `function({node, index, collection, isKeySorting}, event)` |
| onSortStart | Function | | Callback that is invoked when sorting begins. `function({node, index, collection, isKeySorting}, event)` |
| onSortMove | Function | | Callback that is invoked during sorting as the cursor moves. `function(event)` |
| onSortOver | Function | | Callback that is invoked when moving over an item. `function({index, oldIndex, newIndex, collection, isKeySorting}, e)` |
| onSortEnd | Function | | Callback that is invoked when sorting ends. `function({oldIndex, newIndex, collection, isKeySorting}, e)` |
| useDragHandle | Boolean | `false` | If you're using the `SortableHandle` HOC, set this to `true` |
| useWindowAsScrollContainer | Boolean | `false` | If you want, you can set the `window` as the scrolling container |
| hideSortableGhost | Boolean | `true` | Whether to auto-hide the ghost element. By default, as a convenience, React Sortable List will automatically hide the element that is currently being sorted. Set this to false if you would like to apply your own styling. |
| lockToContainerEdges | Boolean | `false` | You can lock movement of the sortable element to it's parent `SortableContainer` |
| lockOffset | `OffsetValue`\* &#124; [`OffsetValue`\*, `OffsetValue`\*] | `"50%"` | When`lockToContainerEdges`is set to`true`, this controls the offset distance between the sortable helper and the top/bottom edges of it's parent`SortableContainer`. Percentage values are relative to the height of the item currently being sorted. If you wish to specify different behaviours for locking to the _top_ of the container vs the _bottom_, you may also pass in an`array`(For example:`["0%", "100%"]`). |
| getContainer | Function | | Optional function to return the scrollable container element. This property defaults to the `SortableContainer` element itself or (if `useWindowAsScrollContainer` is true) the window. Use this function to specify a custom container object (eg this is useful for integrating with certain 3rd party components such as `FlexTable`). This function is passed a single parameter (the `wrappedInstance` React element) and it is expected to return a DOM element. |
| getHelperDimensions | Function | [Function](https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L74-L77) | Optional `function({node, index, collection})` that should return the computed dimensions of the SortableHelper. See [default implementation](https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L74-L77) for more details |
| helperContainer | HTMLElement &#124; Function | `document.body` | By default, the cloned sortable helper is appended to the document body. Use this prop to specify a different container for the sortable clone to be appended to. Accepts an `HTMLElement` or a function returning an `HTMLElement` that will be invoked before right before sorting begins |
| disableAutoscroll | Boolean | `false` | Disables autoscrolling while dragging |

@@ -125,0 +125,0 @@ \* `OffsetValue` can either be a finite `Number` or a `String` made up of a number and a unit (`px` or `%`).

@@ -19,2 +19,3 @@ import * as React from 'react';

collection: Offset;
isKeySorting: boolean;
}

@@ -21,0 +22,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc