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

react-selectable-fast

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-selectable-fast - npm Package Compare versions

Comparing version 2.2.2 to 2.3.0

2

dist/react-selectable-fast.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["React-Selectable-Fast"]=t(require("react")):e["React-Selectable-Fast"]=t(e.React)}(window,function(e){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(t,o){t.exports=e},function(e,t,o){"use strict";o.r(t);var n=o(0),r=o.n(n);function i(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function l(){return{documentScrollTop:Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop),documentScrollLeft:Math.max(window.pageXOffset,document.documentElement.scrollLeft,document.body.scrollLeft)}}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{scrollTop:0,scrollLeft:0},o=t.scrollTop,n=t.scrollLeft,r=l(),i=r.documentScrollTop,c=r.documentScrollLeft,s=e.getBoundingClientRect();return{top:s.top+i+o,left:s.left+c+n,offsetWidth:e.offsetWidth,offsetHeight:e.offsetHeight,computedWidth:s.width,computedHeight:s.height}}var s=function(e,t,o,n,r,i,l,c,s){return void 0===s&&(s=0),!(e+i-s<o||e+s>o+c||t+r-s<n||t+s>n+l)},a=function(e,t,o,n){void 0===n&&(n=1);var r=e instanceof HTMLElement?c(e):e,i=t instanceof HTMLElement?c(t):t;return 1===n?s(r.top,r.left,i.top,i.left,r.offsetWidth,r.offsetHeight,i.offsetWidth,i.offsetHeight,o):s(r.top,r.left,i.top,i.left,r.computedWidth,r.computedHeight,i.computedWidth,i.computedHeight,o)};function u(e){return(u="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 f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var m=function(e){function t(){var e,o,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return n=this,r=(e=p(t)).call.apply(e,[this].concat(l)),o=!r||"object"!==u(r)&&"function"!=typeof r?h(n):r,y(h(h(o)),"state",{boxTop:0,boxLeft:0,boxWidth:0,boxHeight:0,isBoxSelecting:!1}),y(h(h(o)),"getRef",function(){return o.selectbox}),y(h(h(o)),"getSelectboxRef",function(e){return o.selectbox=e}),o}var o,i,l;return 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&&d(e,t)}(t,n["Component"]),o=t,(i=[{key:"render",value:function(){var e={left:this.state.boxLeft,top:this.state.boxTop,width:this.state.boxWidth,height:this.state.boxHeight,zIndex:9e3,position:this.props.fixedPosition?"fixed":"absolute",cursor:"default"};return r.a.createElement("div",null,this.state.isBoxSelecting&&r.a.createElement("div",{ref:this.getSelectboxRef,style:e,className:this.props.className}))}}])&&f(o.prototype,i),l&&f(o,l),t}();y(m,"defaultProps",{className:"selectable-selectbox"});var b=m,v=r.a.createContext({selectable:"omg"});function g(e){return(g="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 S(e){return function(e){if(Array.isArray(e)){for(var t=0,o=new Array(e.length);t<e.length;t++)o[t]=e[t];return o}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function w(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var E=function(){},L=function(e){function t(e){var o,n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,r=O(t).call(this,e),o=!r||"object"!==g(r)&&"function"!=typeof r?j(n):r,k(j(j(o)),"setScollTop",function(e){var t=o.scrollContainer.scrollTop;o.checkScrollTop(e,t),o.checkScrollBottom(e,t)}),k(j(j(o)),"checkScrollTop",function(e,t){var n=o.props,r=n.minimumSpeedFactor,i=n.scrollSpeed,l=o.scrollBounds.top-e.clientY;if(l>0||e.clientY<0){var c=t-Math.max(l,r)*i;o.scrollContainer.scrollTop=c}}),k(j(j(o)),"checkScrollBottom",function(e,t){var n=o.props,r=n.minimumSpeedFactor,i=n.scrollSpeed,l=e.clientY-o.scrollBounds.bottom;if(l>0||e.clientY>window.innerHeight){var c=t+Math.max(l,r)*i;o.scrollContainer.scrollTop=Math.min(c,o.maxScroll)}}),k(j(j(o)),"updateRegistry",function(){var e={scrollTop:o.scrollContainer.scrollTop,scrollLeft:o.scrollContainer.scrollLeft},t=!0,n=!1,r=void 0;try{for(var i,l=o.registry.values()[Symbol.iterator]();!(t=(i=l.next()).done);t=!0){i.value.registerSelectable(e)}}catch(e){n=!0,r=e}finally{try{t||null==l.return||l.return()}finally{if(n)throw r}}}),k(j(j(o)),"registerSelectable",function(e){o.registry.add(e),e.state.selected&&o.selectedItems.add(e)}),k(j(j(o)),"unregisterSelectable",function(e){o.registry.delete(e),o.selectedItems.delete(e),o.selectingItems.delete(e)}),k(j(j(o)),"applyContainerScroll",function(e,t){return e+t}),k(j(j(o)),"openSelectbox",function(e){var t=o.desktopEventCoords(e);if(o.setScollTop(t),!o.mouseMoveStarted){o.mouseMoveStarted=!0,o.mouseMoved=!0;var n=o.scrollContainer.scrollTop,r=t.pageY,i=t.pageX,c=l(),s=c.documentScrollTop,a=c.documentScrollLeft,u=o.applyContainerScroll(r-o.scrollBounds.top,n-s),f=o.applyContainerScroll(o.mouseDownData.boxTop-o.scrollBounds.top,o.mouseDownData.scrollTop-s),p=f-u;f=Math.min(f-p,f);var d=o.mouseDownData.boxLeft-i,h=o.mouseDownData.boxLeft-o.scrollBounds.left,y=o.applyContainerScroll(Math.min(h-d,h),-a);o.selectbox.setState({isBoxSelecting:!0,boxWidth:Math.abs(d),boxHeight:Math.abs(p),boxLeft:y,boxTop:f},function(){o.updateSelecting(),o.props.duringSelection(S(o.selectingItems)),o.mouseMoveStarted=!1})}}),k(j(j(o)),"updateSelecting",function(){var e=o.selectbox.getRef();if(e){var t=c(e);o.selectItems(function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){k(e,t,o[t])})}return e}({},t,{offsetWidth:t.offsetWidth||1,offsetHeight:t.offsetHeight||1}))}}),k(j(j(o)),"selectItems",function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).click,n=o.props,r=n.tolerance,i=n.enableDeselect,l=n.mixedDeselect;e.top+=o.scrollContainer.scrollTop,e.left+=o.scrollContainer.scrollLeft;var c=!0,s=!1,a=void 0;try{for(var u,f=o.registry.values()[Symbol.iterator]();!(c=(u=f.next()).done);c=!0){var p=u.value;o.processItem(p,r,e,t,i,l)}}catch(e){s=!0,a=e}finally{try{c||null==f.return||f.return()}finally{if(s)throw a}}}),k(j(j(o)),"clearSelection",function(){var e=!0,t=!1,n=void 0;try{for(var r,i=o.selectedItems.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var l=r.value;l.setState({selected:!1}),o.selectedItems.delete(l)}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}o.setState({selectionMode:!1}),o.props.onSelectionFinish(S(o.selectedItems)),o.props.onSelectionClear()}),k(j(j(o)),"selectAll",function(){o.updateWhiteListNodes();var e=!0,t=!1,n=void 0;try{for(var r,i=o.registry.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var l=r.value;o.inIgnoreList(l.node)||l.state.selected||(l.setState({selected:!0}),o.selectedItems.add(l))}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}o.setState({selectionMode:!0}),o.props.onSelectionFinish(S(o.selectedItems))}),k(j(j(o)),"mouseDown",function(e){if(!o.mouseDownStarted&&!o.props.disabled&&o.detectLeftButton(e))if(o.updateWhiteListNodes(),o.inIgnoreList(e.target))o.mouseDownStarted=!1;else{if(o.props.resetOnStart&&o.clearSelection(),o.mouseDownStarted=!0,o.mouseUpStarted=!1,e=o.desktopEventCoords(e),!o.props.globalMouse&&!i(e.target,o.selectableGroup)){var t=c(o.selectableGroup);if(!a({top:t.top,left:t.left,bottom:t.offsetHeight,right:t.offsetWidth},{top:e.pageY,left:e.pageX,offsetWidth:0,offsetHeight:0}))return}o.updateRootBounds(),o.updateRegistry(),o.mouseDownData={boxLeft:e.pageX,boxTop:e.pageY,scrollTop:o.scrollContainer.scrollTop,scrollLeft:o.scrollContainer.scrollLeft,target:e.target},e.preventDefault(),document.addEventListener("mousemove",o.openSelectbox),document.addEventListener("touchmove",o.openSelectbox),document.addEventListener("mouseup",o.mouseUp),document.addEventListener("touchend",o.mouseUp)}}),k(j(j(o)),"mouseUp",function(e){if(!o.mouseUpStarted&&(o.mouseUpStarted=!0,o.mouseDownStarted=!1,o.removeTempEventListeners(),o.mouseDownData)){var t=o.desktopEventCoords(e),n=t.pageY,r=t.pageX;if(!o.mouseMoved&&i(t.target,o.rootNode))o.handleClick(t,n,r);else{var l=!0,c=!1,s=void 0;try{for(var a,u=o.selectingItems.values()[Symbol.iterator]();!(l=(a=u.next()).done);l=!0){a.value.setState({selected:!0,selecting:!1})}}catch(e){c=!0,s=e}finally{try{l||null==u.return||u.return()}finally{if(c)throw s}}o.selectedItems=new Set(S(o.selectedItems).concat(S(o.selectingItems))),o.selectingItems.clear(),1===t.which&&o.mouseDownData.target===t.target&&o.preventEvent(t.target,"click"),o.selectbox.setState({isBoxSelecting:!1,boxWidth:0,boxHeight:0}),o.props.onSelectionFinish(S(o.selectedItems))}o.toggleSelectionMode(),o.cleanUp(),o.mouseMoved=!1}}),k(j(j(o)),"keyListener",function(e){e.ctrlKey||e.metaKey||27===e.keyCode&&o.clearSelection()}),k(j(j(o)),"getGroupRef",function(e){return o.selectableGroup=e}),k(j(j(o)),"getSelectboxRef",function(e){return o.selectbox=e}),k(j(j(o)),"defaultContainerStyle",{position:"relative"}),k(j(j(o)),"contextValue",{selectable:{register:o.registerSelectable,unregister:o.unregisterSelectable,selectAll:o.selectAll,clearSelection:o.clearSelection,getScrolledContainer:function(){return o.scrollContainer}}}),o.state={selectionMode:!1},o.mouseDownStarted=!1,o.mouseMoveStarted=!1,o.mouseUpStarted=!1,o.mouseDownData=null,o.registry=new Set,o.selectedItems=new Set,o.selectingItems=new Set,o.ignoreCheckCache=new Map,o.ignoreList=o.props.ignoreList.concat([".selectable-select-all",".selectable-deselect-all"]),o}var o,s,u;return 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&&x(e,t)}(t,n["Component"]),o=t,(s=[{key:"componentDidMount",value:function(){this.rootNode=this.selectableGroup,this.scrollContainer=document.querySelector(this.props.scrollContainer)||this.rootNode,this.rootNode.addEventListener("mousedown",this.mouseDown),this.rootNode.addEventListener("touchstart",this.mouseDown),this.props.deselectOnEsc&&(document.addEventListener("keydown",this.keyListener),document.addEventListener("keyup",this.keyListener))}},{key:"componentWillUnmount",value:function(){this.rootNode.removeEventListener("mousedown",this.mouseDown),this.rootNode.removeEventListener("touchstart",this.mouseDown),this.props.deselectOnEsc&&(document.removeEventListener("keydown",this.keyListener),document.removeEventListener("keyup",this.keyListener)),this.removeTempEventListeners()}},{key:"removeTempEventListeners",value:function(){document.removeEventListener("mousemove",this.openSelectbox),document.removeEventListener("touchmove",this.openSelectbox),document.removeEventListener("mouseup",this.mouseUp),document.removeEventListener("touchend",this.mouseUp)}},{key:"updateRootBounds",value:function(){this.scrollBounds=this.scrollContainer.getBoundingClientRect(),this.maxScroll=this.scrollContainer.scrollHeight-this.scrollContainer.clientHeight}},{key:"toggleSelectionMode",value:function(){var e=this.selectedItems,t=this.state.selectionMode;e.size&&!t&&this.setState({selectionMode:!0}),!e.size&&t&&this.setState({selectionMode:!1})}},{key:"processItem",value:function(e,t,o,n,r,i){if(this.inIgnoreList(e.node))return null;var l=a(o,e.bounds,t,this.props.delta),c=e.state,s=c.selecting,u=c.selected;if(n&&l)return u?this.selectedItems.delete(e):this.selectedItems.add(e),e.setState({selected:!u}),this.clickedItem=e;if(!n&&l){if(u&&r&&(!this.selectionStarted||i))return e.setState({selected:!1}),e.deselected=!0,this.deselectionStarted=!0,this.selectedItems.delete(e);var f=i?!e.deselected:!this.deselectionStarted;if(!s&&!u&&f)return e.setState({selecting:!0}),this.selectionStarted=!0,this.selectingItems.add(e),{updateSelecting:!0}}return!n&&!l&&s&&this.selectingItems.has(e)?(e.setState({selecting:!1}),this.selectingItems.delete(e),{updateSelecting:!0}):null}},{key:"inIgnoreList",value:function(e){if(void 0!==this.ignoreCheckCache.get(e))return this.ignoreCheckCache.get(e);var t=this.ignoreListNodes.some(function(t){return e===t||t.contains(e)});return this.ignoreCheckCache.set(e,t),t}},{key:"updateWhiteListNodes",value:function(){this.ignoreListNodes=S(document.querySelectorAll(this.ignoreList.join(", ")))}},{key:"detectLeftButton",value:function(e){return!(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)&&("buttons"in e?1===e.buttons:"which"in e?1===e.which:1===e.button)}},{key:"preventEvent",value:function(e,t){e.addEventListener(t,function o(n){e.removeEventListener(t,o,!0),n.preventDefault(),n.stopPropagation()},!0)}},{key:"handleClick",value:function(e,t,o){var n=S(e.target.classList||[]).indexOf(this.props.clickClassName)>-1;(this.props.allowClickWithoutSelected||this.selectedItems.size||n||this.ctrlPressed)&&(this.selectItems({top:t,left:o,offsetWidth:0,offsetHeight:0},{click:!0}),this.props.onSelectionFinish(S(this.selectedItems),this.clickedItem),1===e.which&&this.preventEvent(e.target,"click"),2!==e.which&&3!==e.which||this.preventEvent(e.target,"contextmenu"))}},{key:"cleanUp",value:function(){if(this.deselectionStarted=!1,this.selectionStarted=!1,this.props.mixedDeselect){var e=!0,t=!1,o=void 0;try{for(var n,r=this.registry.values()[Symbol.iterator]();!(e=(n=r.next()).done);e=!0){n.value.deselected=!1}}catch(e){t=!0,o=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw o}}}}},{key:"desktopEventCoords",value:function(e){return void 0!==e.pageX&&void 0!==e.pageY||(void 0!==e.targetTouches[0]&&void 0!==e.targetTouches[0].pageX?(e.pageX=e.targetTouches[0].pageX,e.pageY=e.targetTouches[0].pageY):void 0!==e.changedTouches[0]&&void 0!==e.changedTouches[0].pageX&&(e.pageX=e.changedTouches[0].pageX,e.pageY=e.changedTouches[0].pageY)),e}},{key:"render",value:function(){return r.a.createElement(v.Provider,{value:this.contextValue},r.a.createElement(this.props.component,{ref:this.getGroupRef,style:Object.assign({},this.defaultContainerStyle,this.props.style),className:"".concat(this.props.className," ").concat(this.state.selectionMode?this.props.selectionModeClass:"")},r.a.createElement(b,{ref:this.getSelectboxRef,fixedPosition:this.props.fixedPosition,className:this.props.selectboxClassName}),this.props.children))}}])&&w(o.prototype,s),u&&w(o,u),t}();k(L,"defaultProps",{component:"div",tolerance:0,globalMouse:!1,ignoreList:[],scrollSpeed:.25,minimumSpeedFactor:60,duringSelection:E,onSelectionFinish:E,onSelectionClear:E,allowClickWithoutSelected:!0,selectionModeClass:"in-selection-mode",resetOnStart:!1,disabled:!1,deselectOnEsc:!0,delta:1});var C=L;function P(e){return(P="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 T(){return(T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function _(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var N=function(e){var t,o;return o=t=function(t){function o(){var e,t,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o);for(var i=arguments.length,l=new Array(i),s=0;s<i;s++)l[s]=arguments[s];return n=this,r=(e=I(o)).call.apply(e,[this].concat(l)),t=!r||"object"!==P(r)&&"function"!=typeof r?D(n):r,R(D(D(t)),"state",{selected:t.props.selected,selecting:!1}),R(D(D(t)),"registerSelectable",function(e){t.bounds=c(t.node,e),t.context.selectable.register(D(D(t)))}),R(D(D(t)),"selectableRef",function(e){return t.node=e}),t}var i,l,s;return 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&&M(e,t)}(o,n.Component),i=o,(l=[{key:"componentDidMount",value:function(){this.registerSelectable()}},{key:"componentWillUnmount",value:function(){this.context.selectable.unregister(this)}},{key:"render",value:function(){return r.a.createElement(e,T({},this.props,{selected:this.state.selected,selecting:this.state.selecting,selectableRef:this.selectableRef}))}}])&&_(i.prototype,l),s&&_(i,s),o}(),R(t,"contextType",v),R(t,"defaultProps",{selected:!1}),o};function W(e){return(W="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 H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function B(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function A(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var G=function(e){function t(){var e,o,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return n=this,r=(e=Y(t)).call.apply(e,[this].concat(l)),o=!r||"object"!==W(r)&&"function"!=typeof r?X(n):r,F(X(X(o)),"getRootRef",function(e){return o.root=e}),o}var o,i,l;return 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&&U(e,t)}(t,n["Component"]),o=t,(i=[{key:"componentDidMount",value:function(){this.root.addEventListener("mousedown",function(e){return e.stopPropagation()})}},{key:"render",value:function(){var e=this.props,t=e.children,o=e.className,n=B(e,["children","className"]);return r.a.createElement(this.props.component,H({ref:this.getRootRef,className:"selectable-select-all ".concat(o),onClick:this.context.selectable.selectAll},n),t)}}])&&A(o.prototype,i),l&&A(o,l),t}();F(G,"contextType",v),F(G,"defaultProps",{component:"div"});var K=G;function q(e){return(q="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 z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function V(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function J(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ee(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var te=function(e){function t(){var e,o,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return n=this,r=(e=Q(t)).call.apply(e,[this].concat(l)),o=!r||"object"!==q(r)&&"function"!=typeof r?$(n):r,ee($($(o)),"getRootRef",function(e){return o.root=e}),o}var o,i,l;return 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&&Z(e,t)}(t,n["Component"]),o=t,(i=[{key:"componentDidMount",value:function(){this.root.addEventListener("mousedown",function(e){return e.stopPropagation()})}},{key:"render",value:function(){var e=this.props,t=e.children,o=e.className,n=V(e,["children","className"]);return r.a.createElement(this.props.component,z({ref:this.getRootRef,className:"selectable-deselect-all ".concat(o),onClick:this.context.selectable.clearSelection},n),t)}}])&&J(o.prototype,i),l&&J(o,l),t}();ee(te,"contextType",v),ee(te,"defaultProps",{component:"div"});var oe=te;o.d(t,"SelectableGroup",function(){return C}),o.d(t,"createSelectable",function(){return N}),o.d(t,"SelectAll",function(){return K}),o.d(t,"DeselectAll",function(){return oe})}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["React-Selectable-Fast"]=t(require("react")):e["React-Selectable-Fast"]=t(e.React)}(window,function(e){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(t,o){t.exports=e},function(e,t,o){"use strict";o.r(t);var n=o(0),r=o.n(n);function i(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function l(){return{documentScrollTop:Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop),documentScrollLeft:Math.max(window.pageXOffset,document.documentElement.scrollLeft,document.body.scrollLeft)}}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{scrollTop:0,scrollLeft:0},o=t.scrollTop,n=t.scrollLeft,r=l(),i=r.documentScrollTop,c=r.documentScrollLeft,s=e.getBoundingClientRect();return{top:s.top+i+o,left:s.left+c+n,offsetWidth:e.offsetWidth,offsetHeight:e.offsetHeight,computedWidth:s.width,computedHeight:s.height}}var s=function(e,t,o,n,r,i,l,c,s){return void 0===s&&(s=0),!(e+i-s<o||e+s>o+c||t+r-s<n||t+s>n+l)},a=function(e,t,o,n){void 0===n&&(n=1);var r=e instanceof HTMLElement?c(e):e,i=t instanceof HTMLElement?c(t):t;return 1===n?s(r.top,r.left,i.top,i.left,r.offsetWidth,r.offsetHeight,i.offsetWidth,i.offsetHeight,o):s(r.top,r.left,i.top,i.left,r.computedWidth,r.computedHeight,i.computedWidth,i.computedHeight,o)};function u(e){return(u="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 f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var m=function(e){function t(){var e,o,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return n=this,r=(e=p(t)).call.apply(e,[this].concat(l)),o=!r||"object"!==u(r)&&"function"!=typeof r?d(n):r,y(d(o),"state",{boxTop:0,boxLeft:0,boxWidth:0,boxHeight:0,isBoxSelecting:!1}),y(d(o),"getRef",function(){return o.selectbox}),y(d(o),"getSelectboxRef",function(e){return o.selectbox=e}),o}var o,i,l;return 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&&h(e,t)}(t,n["Component"]),o=t,(i=[{key:"render",value:function(){var e={left:this.state.boxLeft,top:this.state.boxTop,width:this.state.boxWidth,height:this.state.boxHeight,zIndex:9e3,position:this.props.fixedPosition?"fixed":"absolute",cursor:"default"};return r.a.createElement("div",null,this.state.isBoxSelecting&&r.a.createElement("div",{ref:this.getSelectboxRef,style:e,className:this.props.className}))}}])&&f(o.prototype,i),l&&f(o,l),t}();y(m,"defaultProps",{className:"selectable-selectbox"});var b=m,v=r.a.createContext({selectable:"omg"});function g(e){return(g="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 S(e){return function(e){if(Array.isArray(e)){for(var t=0,o=new Array(e.length);t<e.length;t++)o[t]=e[t];return o}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function w(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var E=function(){},L=function(e){function t(e){var o,n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,r=O(t).call(this,e),o=!r||"object"!==g(r)&&"function"!=typeof r?x(n):r,k(x(o),"setScollTop",function(e){var t=o.scrollContainer.scrollTop;o.checkScrollTop(e,t),o.checkScrollBottom(e,t)}),k(x(o),"checkScrollTop",function(e,t){var n=o.props,r=n.minimumSpeedFactor,i=n.scrollSpeed,l=o.scrollBounds.top-e.clientY;if(l>0||e.clientY<0){var c=t-Math.max(l,r)*i;o.scrollContainer.scrollTop=c}}),k(x(o),"checkScrollBottom",function(e,t){var n=o.props,r=n.minimumSpeedFactor,i=n.scrollSpeed,l=e.clientY-o.scrollBounds.bottom;if(l>0||e.clientY>window.innerHeight){var c=t+Math.max(l,r)*i;o.scrollContainer.scrollTop=Math.min(c,o.maxScroll)}}),k(x(o),"updateRegistry",function(){var e={scrollTop:o.scrollContainer.scrollTop,scrollLeft:o.scrollContainer.scrollLeft},t=!0,n=!1,r=void 0;try{for(var i,l=o.registry.values()[Symbol.iterator]();!(t=(i=l.next()).done);t=!0){i.value.registerSelectable(e)}}catch(e){n=!0,r=e}finally{try{t||null==l.return||l.return()}finally{if(n)throw r}}}),k(x(o),"registerSelectable",function(e){o.registry.add(e),e.state.selected&&o.selectedItems.add(e)}),k(x(o),"unregisterSelectable",function(e){o.registry.delete(e),o.selectedItems.delete(e),o.selectingItems.delete(e)}),k(x(o),"applyContainerScroll",function(e,t){return e+t}),k(x(o),"openSelectbox",function(e){var t=o.desktopEventCoords(e);if(o.setScollTop(t),!o.mouseMoveStarted){o.mouseMoveStarted=!0,o.mouseMoved=!0;var n=o.scrollContainer,r=n.scrollTop,i=n.scrollLeft,c=t.pageY,s=t.pageX,a=l(),u=a.documentScrollTop,f=a.documentScrollLeft,p=o.applyContainerScroll(c-o.scrollBounds.top,r-u),d=o.applyContainerScroll(o.mouseDownData.boxTop-o.scrollBounds.top,o.mouseDownData.scrollTop-u),h=d-p;d=Math.min(d-h,d);var y=o.applyContainerScroll(s-o.scrollBounds.left,i-f),m=o.applyContainerScroll(o.mouseDownData.boxLeft-o.scrollBounds.left,o.mouseDownData.scrollLeft-f),b=m-y;m=Math.min(m-b,m),o.selectbox.setState({isBoxSelecting:!0,boxWidth:Math.abs(b),boxHeight:Math.abs(h),boxLeft:m,boxTop:d},function(){o.updateSelecting(),o.props.duringSelection(S(o.selectingItems)),o.mouseMoveStarted=!1})}}),k(x(o),"updateSelecting",function(){var e=o.selectbox.getRef();if(e){var t=c(e);o.selectItems(function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){k(e,t,o[t])})}return e}({},t,{offsetWidth:t.offsetWidth||1,offsetHeight:t.offsetHeight||1}))}}),k(x(o),"selectItems",function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).click,n=o.props,r=n.tolerance,i=n.enableDeselect,l=n.mixedDeselect;e.top+=o.scrollContainer.scrollTop,e.left+=o.scrollContainer.scrollLeft;var c=!0,s=!1,a=void 0;try{for(var u,f=o.registry.values()[Symbol.iterator]();!(c=(u=f.next()).done);c=!0){var p=u.value;o.processItem(p,r,e,t,i,l)}}catch(e){s=!0,a=e}finally{try{c||null==f.return||f.return()}finally{if(s)throw a}}}),k(x(o),"clearSelection",function(){var e=!0,t=!1,n=void 0;try{for(var r,i=o.selectedItems.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var l=r.value;l.setState({selected:!1}),o.selectedItems.delete(l)}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}o.setState({selectionMode:!1}),o.props.onSelectionFinish(S(o.selectedItems)),o.props.onSelectionClear()}),k(x(o),"selectAll",function(){o.updateWhiteListNodes();var e=!0,t=!1,n=void 0;try{for(var r,i=o.registry.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var l=r.value;o.inIgnoreList(l.node)||l.state.selected||(l.setState({selected:!0}),o.selectedItems.add(l))}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}o.setState({selectionMode:!0}),o.props.onSelectionFinish(S(o.selectedItems))}),k(x(o),"mouseDown",function(e){if(!o.mouseDownStarted&&!o.props.disabled&&o.detectLeftButton(e))if(o.updateWhiteListNodes(),o.inIgnoreList(e.target))o.mouseDownStarted=!1;else{if(o.props.resetOnStart&&o.clearSelection(),o.mouseDownStarted=!0,o.mouseUpStarted=!1,e=o.desktopEventCoords(e),!o.props.globalMouse&&!i(e.target,o.selectableGroup)){var t=c(o.selectableGroup);if(!a({top:t.top,left:t.left,bottom:t.offsetHeight,right:t.offsetWidth},{top:e.pageY,left:e.pageX,offsetWidth:0,offsetHeight:0}))return}o.updateRootBounds(),o.updateRegistry(),o.mouseDownData={boxLeft:e.pageX,boxTop:e.pageY,scrollTop:o.scrollContainer.scrollTop,scrollLeft:o.scrollContainer.scrollLeft,target:e.target},e.preventDefault(),document.addEventListener("mousemove",o.openSelectbox),document.addEventListener("touchmove",o.openSelectbox),document.addEventListener("mouseup",o.mouseUp),document.addEventListener("touchend",o.mouseUp)}}),k(x(o),"mouseUp",function(e){if(!o.mouseUpStarted&&(o.mouseUpStarted=!0,o.mouseDownStarted=!1,o.removeTempEventListeners(),o.mouseDownData)){var t=o.desktopEventCoords(e),n=t.pageY,r=t.pageX;if(!o.mouseMoved&&i(t.target,o.rootNode))o.handleClick(t,n,r);else{var l=!0,c=!1,s=void 0;try{for(var a,u=o.selectingItems.values()[Symbol.iterator]();!(l=(a=u.next()).done);l=!0){a.value.setState({selected:!0,selecting:!1})}}catch(e){c=!0,s=e}finally{try{l||null==u.return||u.return()}finally{if(c)throw s}}o.selectedItems=new Set(S(o.selectedItems).concat(S(o.selectingItems))),o.selectingItems.clear(),1===t.which&&o.mouseDownData.target===t.target&&o.preventEvent(t.target,"click"),o.selectbox.setState({isBoxSelecting:!1,boxWidth:0,boxHeight:0}),o.props.onSelectionFinish(S(o.selectedItems))}o.toggleSelectionMode(),o.cleanUp(),o.mouseMoved=!1}}),k(x(o),"keyListener",function(e){e.ctrlKey||e.metaKey||27===e.keyCode&&o.clearSelection()}),k(x(o),"getGroupRef",function(e){return o.selectableGroup=e}),k(x(o),"getSelectboxRef",function(e){return o.selectbox=e}),k(x(o),"defaultContainerStyle",{position:"relative"}),k(x(o),"contextValue",{selectable:{register:o.registerSelectable,unregister:o.unregisterSelectable,selectAll:o.selectAll,clearSelection:o.clearSelection,getScrolledContainer:function(){return o.scrollContainer}}}),o.state={selectionMode:!1},o.mouseDownStarted=!1,o.mouseMoveStarted=!1,o.mouseUpStarted=!1,o.mouseDownData=null,o.registry=new Set,o.selectedItems=new Set,o.selectingItems=new Set,o.ignoreCheckCache=new Map,o.ignoreList=o.props.ignoreList.concat([".selectable-select-all",".selectable-deselect-all"]),o}var o,s,u;return 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&&j(e,t)}(t,n["Component"]),o=t,(s=[{key:"componentDidMount",value:function(){this.rootNode=this.selectableGroup,this.scrollContainer=document.querySelector(this.props.scrollContainer)||this.rootNode,this.rootNode.addEventListener("mousedown",this.mouseDown),this.rootNode.addEventListener("touchstart",this.mouseDown),this.props.deselectOnEsc&&(document.addEventListener("keydown",this.keyListener),document.addEventListener("keyup",this.keyListener))}},{key:"componentWillUnmount",value:function(){this.rootNode.removeEventListener("mousedown",this.mouseDown),this.rootNode.removeEventListener("touchstart",this.mouseDown),this.props.deselectOnEsc&&(document.removeEventListener("keydown",this.keyListener),document.removeEventListener("keyup",this.keyListener)),this.removeTempEventListeners()}},{key:"removeTempEventListeners",value:function(){document.removeEventListener("mousemove",this.openSelectbox),document.removeEventListener("touchmove",this.openSelectbox),document.removeEventListener("mouseup",this.mouseUp),document.removeEventListener("touchend",this.mouseUp)}},{key:"updateRootBounds",value:function(){this.scrollBounds=this.scrollContainer.getBoundingClientRect(),this.maxScroll=this.scrollContainer.scrollHeight-this.scrollContainer.clientHeight}},{key:"toggleSelectionMode",value:function(){var e=this.selectedItems,t=this.state.selectionMode;e.size&&!t&&this.setState({selectionMode:!0}),!e.size&&t&&this.setState({selectionMode:!1})}},{key:"processItem",value:function(e,t,o,n,r,i){if(this.inIgnoreList(e.node))return null;var l=a(o,e.bounds,t,this.props.delta),c=e.state,s=c.selecting,u=c.selected;if(n&&l)return u?this.selectedItems.delete(e):this.selectedItems.add(e),e.setState({selected:!u}),this.clickedItem=e;if(!n&&l){if(u&&r&&(!this.selectionStarted||i))return e.setState({selected:!1}),e.deselected=!0,this.deselectionStarted=!0,this.selectedItems.delete(e);var f=i?!e.deselected:!this.deselectionStarted;if(!s&&!u&&f)return e.setState({selecting:!0}),this.selectionStarted=!0,this.selectingItems.add(e),{updateSelecting:!0}}return!n&&!l&&s&&this.selectingItems.has(e)?(e.setState({selecting:!1}),this.selectingItems.delete(e),{updateSelecting:!0}):null}},{key:"inIgnoreList",value:function(e){if(void 0!==this.ignoreCheckCache.get(e))return this.ignoreCheckCache.get(e);var t=this.ignoreListNodes.some(function(t){return e===t||t.contains(e)});return this.ignoreCheckCache.set(e,t),t}},{key:"updateWhiteListNodes",value:function(){this.ignoreListNodes=S(document.querySelectorAll(this.ignoreList.join(", ")))}},{key:"detectLeftButton",value:function(e){return!(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)&&("buttons"in e?1===e.buttons:"which"in e?1===e.which:1===e.button)}},{key:"preventEvent",value:function(e,t){e.addEventListener(t,function o(n){e.removeEventListener(t,o,!0),n.preventDefault(),n.stopPropagation()},!0)}},{key:"handleClick",value:function(e,t,o){var n=S(e.target.classList||[]).indexOf(this.props.clickClassName)>-1;(this.props.allowClickWithoutSelected||this.selectedItems.size||n||this.ctrlPressed)&&(this.selectItems({top:t,left:o,offsetWidth:0,offsetHeight:0},{click:!0}),this.props.onSelectionFinish(S(this.selectedItems),this.clickedItem),1===e.which&&this.preventEvent(e.target,"click"),2!==e.which&&3!==e.which||this.preventEvent(e.target,"contextmenu"))}},{key:"cleanUp",value:function(){if(this.deselectionStarted=!1,this.selectionStarted=!1,this.props.mixedDeselect){var e=!0,t=!1,o=void 0;try{for(var n,r=this.registry.values()[Symbol.iterator]();!(e=(n=r.next()).done);e=!0){n.value.deselected=!1}}catch(e){t=!0,o=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw o}}}}},{key:"desktopEventCoords",value:function(e){return void 0!==e.pageX&&void 0!==e.pageY||(void 0!==e.targetTouches[0]&&void 0!==e.targetTouches[0].pageX?(e.pageX=e.targetTouches[0].pageX,e.pageY=e.targetTouches[0].pageY):void 0!==e.changedTouches[0]&&void 0!==e.changedTouches[0].pageX&&(e.pageX=e.changedTouches[0].pageX,e.pageY=e.changedTouches[0].pageY)),e}},{key:"render",value:function(){return r.a.createElement(v.Provider,{value:this.contextValue},r.a.createElement(this.props.component,{ref:this.getGroupRef,style:Object.assign({},this.defaultContainerStyle,this.props.style),className:"".concat(this.props.className," ").concat(this.state.selectionMode?this.props.selectionModeClass:"")},r.a.createElement(b,{ref:this.getSelectboxRef,fixedPosition:this.props.fixedPosition,className:this.props.selectboxClassName}),this.props.children))}}])&&w(o.prototype,s),u&&w(o,u),t}();k(L,"defaultProps",{component:"div",tolerance:0,globalMouse:!1,ignoreList:[],scrollSpeed:.25,minimumSpeedFactor:60,duringSelection:E,onSelectionFinish:E,onSelectionClear:E,allowClickWithoutSelected:!0,selectionModeClass:"in-selection-mode",resetOnStart:!1,disabled:!1,deselectOnEsc:!0,delta:1});var C=L;function P(e){return(P="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 T(){return(T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function _(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function R(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var N=function(e){var t,o;return o=t=function(t){function o(){var e,t,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o);for(var i=arguments.length,l=new Array(i),s=0;s<i;s++)l[s]=arguments[s];return n=this,r=(e=I(o)).call.apply(e,[this].concat(l)),t=!r||"object"!==P(r)&&"function"!=typeof r?M(n):r,R(M(t),"state",{selected:t.props.selected,selecting:!1}),R(M(t),"registerSelectable",function(e){t.bounds=c(t.node,e),t.context.selectable.register(M(t))}),R(M(t),"selectableRef",function(e){return t.node=e}),t}var i,l,s;return 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&&D(e,t)}(o,n.Component),i=o,(l=[{key:"componentDidMount",value:function(){this.registerSelectable()}},{key:"componentWillUnmount",value:function(){this.context.selectable.unregister(this)}},{key:"render",value:function(){return r.a.createElement(e,T({},this.props,{selected:this.state.selected,selecting:this.state.selecting,selectableRef:this.selectableRef}))}}])&&_(i.prototype,l),s&&_(i,s),o}(),R(t,"contextType",v),R(t,"defaultProps",{selected:!1}),o};function W(e){return(W="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 H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function B(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function A(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var G=function(e){function t(){var e,o,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return n=this,r=(e=Y(t)).call.apply(e,[this].concat(l)),o=!r||"object"!==W(r)&&"function"!=typeof r?U(n):r,F(U(o),"getRootRef",function(e){return o.root=e}),o}var o,i,l;return 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&&X(e,t)}(t,n["Component"]),o=t,(i=[{key:"componentDidMount",value:function(){this.root.addEventListener("mousedown",function(e){return e.stopPropagation()})}},{key:"render",value:function(){var e=this.props,t=e.children,o=e.className,n=B(e,["children","className"]);return r.a.createElement(this.props.component,H({ref:this.getRootRef,className:"selectable-select-all ".concat(o),onClick:this.context.selectable.selectAll},n),t)}}])&&A(o.prototype,i),l&&A(o,l),t}();F(G,"contextType",v),F(G,"defaultProps",{component:"div"});var K=G;function q(e){return(q="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 z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function V(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function J(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var te=function(e){function t(){var e,o,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return n=this,r=(e=Q(t)).call.apply(e,[this].concat(l)),o=!r||"object"!==q(r)&&"function"!=typeof r?Z(n):r,ee(Z(o),"getRootRef",function(e){return o.root=e}),o}var o,i,l;return 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&&$(e,t)}(t,n["Component"]),o=t,(i=[{key:"componentDidMount",value:function(){this.root.addEventListener("mousedown",function(e){return e.stopPropagation()})}},{key:"render",value:function(){var e=this.props,t=e.children,o=e.className,n=V(e,["children","className"]);return r.a.createElement(this.props.component,z({ref:this.getRootRef,className:"selectable-deselect-all ".concat(o),onClick:this.context.selectable.clearSelection},n),t)}}])&&J(o.prototype,i),l&&J(o,l),t}();ee(te,"contextType",v),ee(te,"defaultProps",{component:"div"});var oe=te;o.d(t,"SelectableGroup",function(){return C}),o.d(t,"createSelectable",function(){return N}),o.d(t,"SelectAll",function(){return K}),o.d(t,"DeselectAll",function(){return oe})}])});
//# sourceMappingURL=react-selectable-fast.js.map

@@ -6,9 +6,9 @@ "use strict";

});
exports.default = void 0;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var SelectableGroupContext = _react.default.createContext({
var SelectableGroupContext = _react["default"].createContext({
selectable: 'omg'

@@ -18,2 +18,2 @@ });

var _default = SelectableGroupContext;
exports.default = _default;
exports["default"] = _default;

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = void 0;
exports["default"] = void 0;

@@ -17,5 +17,5 @@ var _react = _interopRequireWildcard(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }

@@ -36,2 +36,4 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -41,4 +43,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -67,3 +67,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
_defineProperty(_assertThisInitialized(_this), "state", {
selected: _this.props.selected,

@@ -73,9 +73,9 @@ selecting: false

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "registerSelectable", function (containerScroll) {
_this.bounds = (0, _getBoundsForNode.default)(_this.node, containerScroll);
_defineProperty(_assertThisInitialized(_this), "registerSelectable", function (containerScroll) {
_this.bounds = (0, _getBoundsForNode["default"])(_this.node, containerScroll);
_this.context.selectable.register(_assertThisInitialized(_assertThisInitialized(_this)));
_this.context.selectable.register(_assertThisInitialized(_this));
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "selectableRef", function (ref) {
_defineProperty(_assertThisInitialized(_this), "selectableRef", function (ref) {
return _this.node = ref;

@@ -100,3 +100,3 @@ });

value: function render() {
return _react.default.createElement(WrappedComponent, _extends({}, this.props, {
return _react["default"].createElement(WrappedComponent, _extends({}, this.props, {
selected: this.state.selected,

@@ -110,3 +110,3 @@ selecting: this.state.selecting,

return SelectableItem;
}(_react.Component), _defineProperty(_class, "contextType", _Context.default), _defineProperty(_class, "propTypes", {
}(_react.Component), _defineProperty(_class, "contextType", _Context["default"]), _defineProperty(_class, "propTypes", {
selected: _propTypes.bool

@@ -119,2 +119,2 @@ }), _defineProperty(_class, "defaultProps", {

var _default = createSelectable;
exports.default = _default;
exports["default"] = _default;

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = void 0;
exports["default"] = void 0;

@@ -15,5 +15,5 @@ var _react = _interopRequireWildcard(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }

@@ -38,2 +38,4 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -43,4 +45,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -66,3 +66,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getRootRef", function (c) {
_defineProperty(_assertThisInitialized(_this), "getRootRef", function (c) {
return _this.root = c;

@@ -89,3 +89,3 @@ });

return _react.default.createElement(this.props.component, _extends({
return _react["default"].createElement(this.props.component, _extends({
ref: this.getRootRef,

@@ -101,3 +101,3 @@ className: "selectable-deselect-all ".concat(className),

_defineProperty(DeselectAllButton, "contextType", _Context.default);
_defineProperty(DeselectAllButton, "contextType", _Context["default"]);

@@ -114,2 +114,2 @@ _defineProperty(DeselectAllButton, "propTypes", {

var _default = DeselectAllButton;
exports.default = _default;
exports["default"] = _default;

@@ -6,7 +6,7 @@ "use strict";

});
exports.default = void 0;
exports["default"] = void 0;
var _getBoundsForNode = _interopRequireDefault(require("./getBoundsForNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -49,4 +49,4 @@ /**

var aObj = a instanceof HTMLElement ? (0, _getBoundsForNode.default)(a) : a;
var bObj = b instanceof HTMLElement ? (0, _getBoundsForNode.default)(b) : b;
var aObj = a instanceof HTMLElement ? (0, _getBoundsForNode["default"])(a) : a;
var bObj = b instanceof HTMLElement ? (0, _getBoundsForNode["default"])(b) : b;

@@ -61,2 +61,2 @@ if (delta === 1) {

exports.default = _default;
exports["default"] = _default;

@@ -7,3 +7,3 @@ "use strict";

exports.getDocumentScroll = getDocumentScroll;
exports.default = getBoundsForNode;
exports["default"] = getBoundsForNode;

@@ -10,0 +10,0 @@ function getDocumentScroll() {

@@ -9,3 +9,3 @@ "use strict";

get: function get() {
return _SelectableGroup.default;
return _SelectableGroup["default"];
}

@@ -16,3 +16,3 @@ });

get: function get() {
return _CreateSelectable.default;
return _CreateSelectable["default"];
}

@@ -23,3 +23,3 @@ });

get: function get() {
return _SelectAll.default;
return _SelectAll["default"];
}

@@ -30,3 +30,3 @@ });

get: function get() {
return _DeselectAll.default;
return _DeselectAll["default"];
}

@@ -43,3 +43,3 @@ });

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -46,0 +46,0 @@ // As early as possible, check for the existence of the JavaScript globals which

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = isNodeInRoot;
exports["default"] = isNodeInRoot;

@@ -9,0 +9,0 @@ function isNodeInRoot(node, root) {

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = void 0;
exports["default"] = void 0;

@@ -23,5 +23,5 @@ var _react = _interopRequireWildcard(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }

@@ -50,2 +50,4 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -55,4 +57,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -74,3 +74,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "setScollTop", function (e) {
_defineProperty(_assertThisInitialized(_this), "setScollTop", function (e) {
var scrollTop = _this.scrollContainer.scrollTop;

@@ -83,3 +83,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "checkScrollTop", function (e, currentTop) {
_defineProperty(_assertThisInitialized(_this), "checkScrollTop", function (e, currentTop) {
var _this$props = _this.props,

@@ -96,3 +96,3 @@ minimumSpeedFactor = _this$props.minimumSpeedFactor,

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "checkScrollBottom", function (e, currentTop) {
_defineProperty(_assertThisInitialized(_this), "checkScrollBottom", function (e, currentTop) {
var _this$props2 = _this.props,

@@ -109,3 +109,3 @@ minimumSpeedFactor = _this$props2.minimumSpeedFactor,

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateRegistry", function () {
_defineProperty(_assertThisInitialized(_this), "updateRegistry", function () {
var containerScroll = {

@@ -129,4 +129,4 @@ scrollTop: _this.scrollContainer.scrollTop,

try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}

@@ -141,3 +141,3 @@ } finally {

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "registerSelectable", function (selectableItem) {
_defineProperty(_assertThisInitialized(_this), "registerSelectable", function (selectableItem) {
_this.registry.add(selectableItem);

@@ -150,15 +150,15 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "unregisterSelectable", function (selectableItem) {
_this.registry.delete(selectableItem);
_defineProperty(_assertThisInitialized(_this), "unregisterSelectable", function (selectableItem) {
_this.registry["delete"](selectableItem);
_this.selectedItems.delete(selectableItem);
_this.selectedItems["delete"](selectableItem);
_this.selectingItems.delete(selectableItem);
_this.selectingItems["delete"](selectableItem);
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "applyContainerScroll", function (value, scroll) {
_defineProperty(_assertThisInitialized(_this), "applyContainerScroll", function (value, scroll) {
return value + scroll;
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "openSelectbox", function (event) {
_defineProperty(_assertThisInitialized(_this), "openSelectbox", function (event) {
var e = _this.desktopEventCoords(event);

@@ -171,3 +171,5 @@

_this.mouseMoved = true;
var scrollTop = _this.scrollContainer.scrollTop;
var _this$scrollContainer = _this.scrollContainer,
scrollTop = _this$scrollContainer.scrollTop,
scrollLeft = _this$scrollContainer.scrollLeft;
var eventTop = e.pageY;

@@ -186,10 +188,13 @@ var eventLeft = e.pageX;

boxTop = Math.min(boxTop - boxHeight, boxTop);
var bowWidth = _this.mouseDownData.boxLeft - eventLeft;
var leftContainerRelative = _this.mouseDownData.boxLeft - _this.scrollBounds.left;
var boxLeft = _this.applyContainerScroll(Math.min(leftContainerRelative - bowWidth, leftContainerRelative), -documentScrollLeft);
var left = _this.applyContainerScroll(eventLeft - _this.scrollBounds.left, scrollLeft - documentScrollLeft);
var boxLeft = _this.applyContainerScroll(_this.mouseDownData.boxLeft - _this.scrollBounds.left, _this.mouseDownData.scrollLeft - documentScrollLeft);
var boxWidth = boxLeft - left;
boxLeft = Math.min(boxLeft - boxWidth, boxLeft);
_this.selectbox.setState({
isBoxSelecting: true,
boxWidth: Math.abs(bowWidth),
boxWidth: Math.abs(boxWidth),
boxHeight: Math.abs(boxHeight),

@@ -207,7 +212,7 @@ boxLeft: boxLeft,

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateSelecting", function () {
_defineProperty(_assertThisInitialized(_this), "updateSelecting", function () {
var selectbox = _this.selectbox.getRef();
if (!selectbox) return;
var selectboxBounds = (0, _getBoundsForNode.default)(selectbox);
var selectboxBounds = (0, _getBoundsForNode["default"])(selectbox);

@@ -220,3 +225,3 @@ _this.selectItems(_objectSpread({}, selectboxBounds, {

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "selectItems", function (selectboxBounds) {
_defineProperty(_assertThisInitialized(_this), "selectItems", function (selectboxBounds) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},

@@ -246,4 +251,4 @@ click = _ref.click;

try {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}

@@ -258,3 +263,3 @@ } finally {

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "clearSelection", function () {
_defineProperty(_assertThisInitialized(_this), "clearSelection", function () {
var _iteratorNormalCompletion3 = true;

@@ -271,3 +276,3 @@ var _didIteratorError3 = false;

_this.selectedItems.delete(item);
_this.selectedItems["delete"](item);
}

@@ -279,4 +284,4 @@ } catch (err) {

try {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();
if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
_iterator3["return"]();
}

@@ -299,3 +304,3 @@ } finally {

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "selectAll", function () {
_defineProperty(_assertThisInitialized(_this), "selectAll", function () {
_this.updateWhiteListNodes();

@@ -324,4 +329,4 @@

try {
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
_iterator4.return();
if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
_iterator4["return"]();
}

@@ -342,3 +347,3 @@ } finally {

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "mouseDown", function (e) {
_defineProperty(_assertThisInitialized(_this), "mouseDown", function (e) {
if (_this.mouseDownStarted || _this.props.disabled || !_this.detectLeftButton(e)) return;

@@ -361,5 +366,5 @@

if (!_this.props.globalMouse && !(0, _nodeInRoot.default)(e.target, _this.selectableGroup)) {
var offsetData = (0, _getBoundsForNode.default)(_this.selectableGroup);
var collides = (0, _doObjectsCollide.default)({
if (!_this.props.globalMouse && !(0, _nodeInRoot["default"])(e.target, _this.selectableGroup)) {
var offsetData = (0, _getBoundsForNode["default"])(_this.selectableGroup);
var collides = (0, _doObjectsCollide["default"])({
top: offsetData.top,

@@ -396,3 +401,3 @@ left: offsetData.left,

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "mouseUp", function (event) {
_defineProperty(_assertThisInitialized(_this), "mouseUp", function (event) {
if (_this.mouseUpStarted) return;

@@ -411,3 +416,3 @@ _this.mouseUpStarted = true;

if (!_this.mouseMoved && (0, _nodeInRoot.default)(e.target, _this.rootNode)) {
if (!_this.mouseMoved && (0, _nodeInRoot["default"])(e.target, _this.rootNode)) {
_this.handleClick(e, eventTop, eventLeft);

@@ -432,4 +437,4 @@ } else {

try {
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
_iterator5.return();
if (!_iteratorNormalCompletion5 && _iterator5["return"] != null) {
_iterator5["return"]();
}

@@ -467,3 +472,3 @@ } finally {

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "keyListener", function (e) {
_defineProperty(_assertThisInitialized(_this), "keyListener", function (e) {
if (e.ctrlKey || e.metaKey) {

@@ -479,15 +484,15 @@ return;

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getGroupRef", function (c) {
_defineProperty(_assertThisInitialized(_this), "getGroupRef", function (c) {
return _this.selectableGroup = c;
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getSelectboxRef", function (c) {
_defineProperty(_assertThisInitialized(_this), "getSelectboxRef", function (c) {
return _this.selectbox = c;
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "defaultContainerStyle", {
_defineProperty(_assertThisInitialized(_this), "defaultContainerStyle", {
position: 'relative'
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "contextValue", {
_defineProperty(_assertThisInitialized(_this), "contextValue", {
selectable: {

@@ -584,3 +589,3 @@ register: _this.registerSelectable,

var isCollided = (0, _doObjectsCollide.default)(selectboxBounds, item.bounds, tolerance, this.props.delta);
var isCollided = (0, _doObjectsCollide["default"])(selectboxBounds, item.bounds, tolerance, this.props.delta);
var _item$state = item.state,

@@ -592,3 +597,3 @@ selecting = _item$state.selecting,

if (selected) {
this.selectedItems.delete(item);
this.selectedItems["delete"](item);
} else {

@@ -611,3 +616,3 @@ this.selectedItems.add(item);

this.deselectionStarted = true;
return this.selectedItems.delete(item);
return this.selectedItems["delete"](item);
}

@@ -634,3 +639,3 @@

});
this.selectingItems.delete(item);
this.selectingItems["delete"](item);
return {

@@ -737,4 +742,4 @@ updateSelecting: true

try {
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
_iterator6.return();
if (!_iteratorNormalCompletion6 && _iterator6["return"] != null) {
_iterator6["return"]();
}

@@ -775,9 +780,9 @@ } finally {

value: function render() {
return _react.default.createElement(_Context.default.Provider, {
return _react["default"].createElement(_Context["default"].Provider, {
value: this.contextValue
}, _react.default.createElement(this.props.component, {
}, _react["default"].createElement(this.props.component, {
ref: this.getGroupRef,
style: Object.assign({}, this.defaultContainerStyle, this.props.style),
className: "".concat(this.props.className, " ").concat(this.state.selectionMode ? this.props.selectionModeClass : '')
}, _react.default.createElement(_Selectbox.default, {
}, _react["default"].createElement(_Selectbox["default"], {
ref: this.getSelectboxRef,

@@ -866,2 +871,2 @@ fixedPosition: this.props.fixedPosition,

var _default = SelectableGroup;
exports.default = _default;
exports["default"] = _default;

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = void 0;
exports["default"] = void 0;

@@ -15,5 +15,5 @@ var _react = _interopRequireWildcard(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }

@@ -38,2 +38,4 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -43,4 +45,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -66,3 +66,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getRootRef", function (c) {
_defineProperty(_assertThisInitialized(_this), "getRootRef", function (c) {
return _this.root = c;

@@ -89,3 +89,3 @@ });

return _react.default.createElement(this.props.component, _extends({
return _react["default"].createElement(this.props.component, _extends({
ref: this.getRootRef,

@@ -101,3 +101,3 @@ className: "selectable-select-all ".concat(className),

_defineProperty(SelectAllButton, "contextType", _Context.default);
_defineProperty(SelectAllButton, "contextType", _Context["default"]);

@@ -114,2 +114,2 @@ _defineProperty(SelectAllButton, "propTypes", {

var _default = SelectAllButton;
exports.default = _default;
exports["default"] = _default;

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = void 0;
exports["default"] = void 0;

@@ -13,3 +13,3 @@ var _react = _interopRequireWildcard(require("react"));

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }

@@ -28,2 +28,4 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -33,4 +35,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -56,3 +56,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
_defineProperty(_assertThisInitialized(_this), "state", {
boxTop: 0,

@@ -65,7 +65,7 @@ boxLeft: 0,

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getRef", function () {
_defineProperty(_assertThisInitialized(_this), "getRef", function () {
return _this.selectbox;
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getSelectboxRef", function (c) {
_defineProperty(_assertThisInitialized(_this), "getSelectboxRef", function (c) {
return _this.selectbox = c;

@@ -89,3 +89,3 @@ });

};
return _react.default.createElement("div", null, this.state.isBoxSelecting && _react.default.createElement("div", {
return _react["default"].createElement("div", null, this.state.isBoxSelecting && _react["default"].createElement("div", {
ref: this.getSelectboxRef,

@@ -111,2 +111,2 @@ style: boxStyle,

var _default = Selectbox;
exports.default = _default;
exports["default"] = _default;
{
"name": "react-selectable-fast",
"version": "2.2.2",
"version": "2.3.0",
"description": "Enable other React components to be selectable by drawing a box with your mouse/touch",

@@ -17,3 +17,3 @@ "repository": {

"transpile": "babel ./src/ -d ./lib/",
"build:prod": "NODE_ENV=production webpack --config webpack.production.config.js",
"build:prod": "cross-env NODE_ENV=production webpack --config webpack.production.config.js",
"prepublish": "npm run lint && npm run clean && npm run build:prod && npm run transpile",

@@ -60,27 +60,28 @@ "prettier": "npx prettier --write src/**/*.js example/**/*.js *.js",

"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/preset-env": "^7.3.1",
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-transform-react-remove-prop-types": "^0.4.23",
"eslint": "^5.12.1",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"cross-env": "^5.2.0",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-import": "^2.15.0",
"eslint-plugin-jsx-a11y": "^6.2.0",
"eslint-plugin-react": "^7.12.4",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
"prettier": "^1.16.1",
"prop-types": "^15.6.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.13.0",
"husky": "^2.4.1",
"lint-staged": "^8.2.1",
"prettier": "^1.18.2",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"rimraf": "^2.6.3",
"webpack": "^4.29.0",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14"
"webpack": "^4.34.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.4",
"webpack-dev-server": "^3.7.2"
},

@@ -87,0 +88,0 @@ "husky": {

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