react-tree-dropdown-
Advanced tools
Comparing version 2.1.4-beta.0 to 2.1.4-beta.1
@@ -26,3 +26,3 @@ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("ReactDropdownTreeSelect",["react"],t):"object"==typeof exports?exports.ReactDropdownTreeSelect=t(require("react")):e.ReactDropdownTreeSelect=t(e.React)}(this,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){e.exports=n(14)()},function(t,n){t.exports=e},function(e,t,n){var r; | ||
and limitations under the License. | ||
***************************************************************************** */var E=function(){return(E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var x={Pixel:"Pixel",Percent:"Percent"},j={unit:x.Percent,value:.8};function N(e){return"number"==typeof e?{unit:x.Percent,value:100*e}:"string"==typeof e?e.match(/^(\d*(\.\d+)?)px$/)?{unit:x.Pixel,value:parseFloat(e)}:e.match(/^(\d*(\.\d+)?)%$/)?{unit:x.Percent,value:parseFloat(e)}:(console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'),j):(console.warn("scrollThreshold should be string or number"),j)}var R=function(e){function t(t){var n=e.call(this,t)||this;return n.lastScrollTop=0,n.actionTriggered=!1,n.startY=0,n.currentY=0,n.dragging=!1,n.maxPullDownDistance=0,n.getScrollableTarget=function(){return n.props.scrollableTarget instanceof HTMLElement?n.props.scrollableTarget:"string"==typeof n.props.scrollableTarget?document.getElementById(n.props.scrollableTarget):(null===n.props.scrollableTarget&&console.warn("You are trying to pass scrollableTarget but it is null. This might\n happen because the element may not have been added to DOM yet.\n See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.\n "),null)},n.onStart=function(e){n.lastScrollTop||(n.dragging=!0,e instanceof MouseEvent?n.startY=e.pageY:e instanceof TouchEvent&&(n.startY=e.touches[0].pageY),n.currentY=n.startY,n._infScroll&&(n._infScroll.style.willChange="transform",n._infScroll.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},n.onMove=function(e){n.dragging&&(e instanceof MouseEvent?n.currentY=e.pageY:e instanceof TouchEvent&&(n.currentY=e.touches[0].pageY),n.currentY<n.startY||(n.currentY-n.startY>=Number(n.props.pullDownToRefreshThreshold)&&n.setState({pullToRefreshThresholdBreached:!0}),n.currentY-n.startY>1.5*n.maxPullDownDistance||n._infScroll&&(n._infScroll.style.overflow="visible",n._infScroll.style.transform="translate3d(0px, "+(n.currentY-n.startY)+"px, 0px)")))},n.onEnd=function(){n.startY=0,n.currentY=0,n.dragging=!1,n.state.pullToRefreshThresholdBreached&&(n.props.refreshFunction&&n.props.refreshFunction(),n.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){n._infScroll&&(n._infScroll.style.overflow="auto",n._infScroll.style.transform="none",n._infScroll.style.willChange="unset")})},n.onScrollListener=function(e){"function"==typeof n.props.onScroll&&setTimeout(function(){return n.props.onScroll&&n.props.onScroll(e)},0);var t=n.props.height||n._scrollableNode?e.target:document.documentElement.scrollTop?document.documentElement:document.body;n.actionTriggered||((n.props.inverse?n.isElementAtTop(t,n.props.scrollThreshold):n.isElementAtBottom(t,n.props.scrollThreshold))&&n.props.hasMore&&(n.actionTriggered=!0,n.setState({showLoader:!0}),n.props.next&&n.props.next()),n.lastScrollTop=t.scrollTop)},n.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:t.dataLength},n.throttledOnScrollListener=function(e,t,n,r){var o,a=!1,i=0;function l(){o&&clearTimeout(o)}function s(){var s=this,c=Date.now()-i,u=arguments;function p(){i=Date.now(),n.apply(s,u)}a||(r&&!o&&p(),l(),void 0===r&&c>e?p():!0!==t&&(o=setTimeout(r?function(){o=void 0}:p,void 0===r?e-c:e)))}return"boolean"!=typeof t&&(r=n,n=t,t=void 0),s.cancel=function(){l(),a=!0},s}(150,n.onScrollListener).bind(n),n.onStart=n.onStart.bind(n),n.onMove=n.onMove.bind(n),n.onEnd=n.onEnd.bind(n),n}return function(e,t){function n(){this.constructor=e}P(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){if(void 0===this.props.dataLength)throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener("scroll",this.throttledOnScrollListener),"number"==typeof this.props.initialScrollY&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener("touchstart",this.onStart),this.el.addEventListener("touchmove",this.onMove),this.el.addEventListener("touchend",this.onEnd),this.el.addEventListener("mousedown",this.onStart),this.el.addEventListener("mousemove",this.onMove),this.el.addEventListener("mouseup",this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),"function"!=typeof this.props.refreshFunction))throw new Error('Mandatory prop "refreshFunction" missing.\n Pull Down To Refresh functionality will not work\n as expected. Check README.md for usage\'')},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener("scroll",this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener("touchstart",this.onStart),this.el.removeEventListener("touchmove",this.onMove),this.el.removeEventListener("touchend",this.onEnd),this.el.removeEventListener("mousedown",this.onStart),this.el.removeEventListener("mousemove",this.onMove),this.el.removeEventListener("mouseup",this.onEnd)))},t.prototype.componentDidUpdate=function(e){this.props.dataLength!==e.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(e,t){return e.dataLength!==t.prevDataLength?E(E({},t),{prevDataLength:e.dataLength}):null},t.prototype.isElementAtTop=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=N(t);return r.unit===x.Pixel?e.scrollTop<=r.value+n-e.scrollHeight+1:e.scrollTop<=r.value/100+n-e.scrollHeight+1},t.prototype.isElementAtBottom=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=N(t);return r.unit===x.Pixel?e.scrollTop+n>=e.scrollHeight-r.value:e.scrollTop+n>=r.value/100*e.scrollHeight},t.prototype.render=function(){var e=this,t=E({height:this.props.height||"auto",overflow:"auto",WebkitOverflowScrolling:"touch"},this.props.style),n=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),r=this.props.pullDownToRefresh&&this.props.height?{overflow:"auto"}:{};return s.a.createElement("div",{style:r,className:"infinite-scroll-component__outerdiv"},s.a.createElement("div",{className:"infinite-scroll-component "+(this.props.className||""),ref:function(t){return e._infScroll=t},style:t},this.props.pullDownToRefresh&&s.a.createElement("div",{style:{position:"relative"},ref:function(t){return e._pullDown=t}},s.a.createElement("div",{style:{position:"absolute",left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!n&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(l.Component),M=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function D(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var L=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=D(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.handleClick=function(){r.props.onAction(r.props.actionData)},D(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),M(t,[{key:"render",value:function(){var e=this.props,t=e.title,n=e.className,r=e.text,o=e.readOnly;return s.a.createElement("i",{title:t,className:n,onClick:!o&&this.handleClick},r)}}]),t}();L.propTypes={title:i.a.string,text:i.a.string,className:i.a.string,actionData:i.a.object,onAction:i.a.func,readOnly:i.a.bool},L.defaultProps={onAction:function(){}};var I=L,A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Y=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),B(t,[{key:"render",value:function(){var e=this.props,t=e.actions,n=e.id,r=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["actions","id"]);return u(t)?null:t.map(function(e,t){var o=e.id||"action-"+t;return s.a.createElement(I,A({key:o},r,e,{actionData:{action:o,id:n}}))})}}]),t}();Y.propTypes={id:i.a.string.isRequired,actions:i.a.array};var V=Y,F=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},H=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function q(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var z=function(e){var t=e.checked,n=e.indeterminate;return function(e){e&&(e.checked=t,e.indeterminate=n)}},W=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=q(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.handleChange=function(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),r.props.onChange(e)},q(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),H(t,[{key:"render",value:function(){var e=this.props,t=e.checked,n=e.indeterminate,r=void 0!==n&&n,o=(e.onChange,e.disabled),a=e.readOnly,i=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["checked","indeterminate","onChange","disabled","readOnly"]),l=o||a;return s.a.createElement("input",F({type:"checkbox",ref:z({checked:t,indeterminate:r}),onChange:this.handleChange,disabled:l},i))}}]),t}();W.propTypes={checked:i.a.bool,indeterminate:i.a.bool,onChange:i.a.func,disabled:i.a.bool,readOnly:i.a.bool};var U=W,$=n(3),J=n.n($),Z=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function G(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var K=o.a.bind(J.a),Q=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=G(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.handleCheckboxChange=function(e){var t=r.props,n=t.simpleSelect,o=t.id,a=t.onCheckboxChange;n?a(o,!0):a(o,e.target.checked)},G(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),Z(t,[{key:"render",value:function(){var e=this.props,t=e.simpleSelect,n=e.title,r=e.label,o=e.id,a=e.partial,i=e.path,l=e.checked,c=e.value,u=e.disabled,p=e.showPartiallySelected,h=e.readOnly,d=e.approved,f=e.nodeRenderer,g={className:"node-label"};return t&&!h&&(g.onClick=this.handleCheckboxChange),f?f({id:o,value:c,disabled:u,checked:l,path:i,refUpdater:z,approved:d,title:n||r,onChange:this.handleCheckboxChange,indeterminate:p&&a}):s.a.createElement("label",{title:n||r,htmlFor:o},s.a.createElement(U,{name:o,id:o,indeterminate:p&&a,className:K("checkbox-item",{"simple-select":t}),checked:l,onChange:this.handleCheckboxChange,value:c,disabled:u,readOnly:h}),s.a.createElement("span",g,r))}}]),t}();Q.propTypes={id:i.a.string.isRequired,actions:i.a.array,title:i.a.string,label:i.a.string.isRequired,value:i.a.string.isRequired,checked:i.a.bool,path:i.a.array,partial:i.a.bool,expanded:i.a.bool,disabled:i.a.bool,dataset:i.a.object,simpleSelect:i.a.bool,showPartiallySelected:i.a.bool,onCheckboxChange:i.a.func,nodeRenderer:i.a.func,readOnly:i.a.bool,approved:i.a.bool};var X=Q,ee=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function te(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var ne=o.a.bind(J.a),re=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=te(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.onToggle=function(){r.props.onNodeToggle(r.props.id)},te(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),ee(t,[{key:"render",value:function(){var e=this.props,t=e.expanded,n=e.isLeaf,r=e.iconRenderer,o=ne("toggle",{expanded:!n&&t,collapsed:!n&&!t});return r?r(o,this.onToggle):s.a.createElement("i",{className:o,onClick:this.onToggle})}}]),t}();re.propTypes={expanded:i.a.bool,isLeaf:i.a.bool,onNodeToggle:i.a.func,id:i.a.string,iconRenderer:i.a.func};var oe=re,ae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ie=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var le=o.a.bind(J.a),se=function(e){return u(e)},ce=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),ie(t,[{key:"render",value:function(){var e=this.props,t=e.simpleSelect,n=e.keepTreeOnSearch,r=e._id,o=e._children,a=e.dataset,i=e._depth,l=e.expanded,u=e.title,p=e.label,h=e.partial,d=e.checked,f=e.value,g=e.path,y=e.disabled,b=e.actions,v=e.onAction,m=e.searchModeOn,w=e.onNodeToggle,O=e.onCheckboxChange,T=e.showPartiallySelected,_=e.nodeRenderer,S=e.iconRenderer,k=e.readOnly,C=e.approved,P=function(e){var t=e.keepTreeOnSearch,n=e.keepChildrenOnSearch,r=e._children,o=e.matchInChildren,a=e.matchInParent,i=e.disabled,l=e.partial,s=e.hide,c=e.className,u=e.showPartiallySelected,p=e.readOnly;return le("node",{leaf:se(r),tree:!se(r),disabled:i,hide:s,"match-in-children":t&&o,"match-in-parent":t&&n&&a,partial:u&&l,readOnly:p},c)}(this.props),E=n||!m?{paddingLeft:20*(i||0)+"px"}:{};return s.a.createElement("li",ae({className:P,style:E},c(a)),s.a.createElement(oe,{isLeaf:se(o),expanded:l,id:r,onNodeToggle:w,iconRenderer:S}),s.a.createElement(X,{title:u,label:p,id:r,path:g,partial:h,checked:d,value:f,disabled:y,simpleSelect:t,onCheckboxChange:O,showPartiallySelected:T,nodeRenderer:_,readOnly:k,approved:C}),s.a.createElement(V,{actions:b,onAction:v,id:r,readOnly:k}))}}]),t}();ce.propTypes={_id:i.a.string.isRequired,_depth:i.a.number,_children:i.a.array,actions:i.a.array,className:i.a.string,title:i.a.string,label:i.a.string.isRequired,value:i.a.string.isRequired,path:i.a.array,checked:i.a.bool,expanded:i.a.bool,disabled:i.a.bool,partial:i.a.bool,dataset:i.a.object,keepTreeOnSearch:i.a.bool,keepChildrenOnSearch:i.a.bool,searchModeOn:i.a.bool,onNodeToggle:i.a.func,onAction:i.a.func,onCheckboxChange:i.a.func,simpleSelect:i.a.bool,showPartiallySelected:i.a.bool,nodeRenderer:i.a.func,iconRenderer:i.a.func,readOnly:i.a.bool,approved:i.a.bool};var ue=ce,pe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var de=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return fe.call(n),n.computeInstanceProps(e),n.state={items:n.allVisibleNodes.slice(0,n.props.pageSize)},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["Component"]),he(t,[{key:"render",value:function(){var e=this.props,t=e.searchModeOn,n=e.noItemsPlaceholder;return this.state.items.length>0?s.a.createElement("ul",{className:"root "+(t?"searchModeOn":""),ref:this.setNodeRef},this.state.scrollableTarget&&s.a.createElement(R,{dataLength:this.state.items.length,next:this.loadMore,hasMore:this.hasMore(),loader:null,scrollableTarget:this.state.scrollableTarget},this.state.items)):n}}]),t}();de.propTypes={data:i.a.object,keepTreeOnSearch:i.a.bool,keepChildrenOnSearch:i.a.bool,searchModeOn:i.a.bool,onChange:i.a.func,onNodeToggle:i.a.func,onAction:i.a.func,onCheckboxChange:i.a.func,simpleSelect:i.a.bool,showPartiallySelected:i.a.bool,pageSize:i.a.number,nodeRenderer:i.a.func,iconRenderer:i.a.func,readOnly:i.a.bool,noItemsPlaceholder:i.a.any},de.defaultProps={pageSize:100,noItemsPlaceholder:s.a.createElement("p",null,"The data contains no valid elements for display")};var fe=function(){var e=this;this.componentWillReceiveProps=function(t){e.computeInstanceProps(t),e.setState({items:e.allVisibleNodes.slice(0,e.props.pageSize)})},this.componentDidMount=function(){e.setState({scrollableTarget:e.node&&e.node.parentNode?e.node.parentNode:null})},this.computeInstanceProps=function(t){e.allVisibleNodes=e.getNodes(t),e.totalPages=Math.ceil(e.allVisibleNodes.length/e.props.pageSize),e.currentPage=1},this.hasValidData=function(e){return!(!e||e.constructor!==Map)&&e.size>0},this.getNodes=function(t){var n=t.data,r=t.keepTreeOnSearch,o=t.searchModeOn,a=t.simpleSelect,i=t.showPartiallySelected,l=t.readOnly,c=t.nodeRenderer,u=t.iconRenderer,p=t.onAction,h=t.onChange,d=t.onCheckboxChange,f=t.onNodeToggle,g=t.keepChildrenOnSearch,y=[];return e.hasValidData(n)&&n.forEach(function(e){(function(e,t,n){if(t||e.expanded)return!0;var r=e._parent&&n.get(e._parent);return!r||r.expanded})(e,o,n)&&y.push(s.a.createElement(ue,pe({keepTreeOnSearch:r,keepChildrenOnSearch:g,key:e._id},e,{searchModeOn:o,onChange:h,onCheckboxChange:d,onNodeToggle:f,onAction:p,simpleSelect:a,showPartiallySelected:i,nodeRenderer:c,iconRenderer:u,readOnly:l})))}),y},this.hasMore=function(){return e.currentPage<=e.totalPages},this.loadMore=function(){e.currentPage=e.currentPage+1;var t=e.allVisibleNodes.slice(0,e.currentPage*e.props.pageSize);e.setState({items:t})},this.setNodeRef=function(t){e.node=t}},ge=de,ye=n(5),be=n.n(ye),ve=function(e){return e},me=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"children",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ve;return be()(e[t],function(e){return n(e).checked})||e[t].some(function(e){return n(e).partial})};var we=function(e,t,n,r){var o=function e(t){var n=t.nodes,r=t.list,o=void 0===r?new Map:r,a=t.parent,i=t.depth,l=void 0===i?0:i,s=t.simple,c=t.showPartialState,p=t.defaultValues,h=void 0===p?[]:p,d=t.hierarchical;return n.forEach(function(t,n){t._depth=l,a?(t._id=t.id||a._id+"-"+n,t._parent=a._id,a._children.push(t._id)):t._id=t.id||""+n,t.isDefaultValue&&(h.push(t._id),t.checked=!0),d||function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=["checked","disabled"],r=0;r<n.length;r++){var o=n[r];void 0===e[o]&&void 0!==t[o]&&(e[o]=t[o])}}(t,a),o.set(t._id,t),!s&&t.children&&(t._children=[],e({nodes:t.children,list:o,parent:t,depth:l+1,showPartialState:c,defaultValues:h,hierarchical:d}),c&&!t.checked&&(t.partial=me(t),!u(t.children)&&t.children.every(function(e){return e.checked})&&(t.checked=!0)),t.children=void 0)}),{list:o,defaultValues:h}}({nodes:Array.isArray(e)?e:[e],simple:t,showPartialState:n,hierarchical:r});return{list:o.list,defaultValues:o.defaultValues}},Oe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Te=function(){function e(t){var n=t.data,r=t.simpleSelect,o=t.showPartiallySelected,a=t.hierarchical;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._src=n;var i=we(JSON.parse(JSON.stringify(n)),r,o,a),l=i.list,s=i.defaultValues;this.tree=l,this.defaultValues=s,this.simpleSelect=r,this.showPartialState=!a&&o,this.searchMaps=new Map,this.hierarchical=a}return Oe(e,[{key:"getNodeById",value:function(e){return this.tree.get(e)}},{key:"getMatches",value:function(e){var t=this;if(this.searchMaps.has(e))return this.searchMaps.get(e);var n=-1,r=e;this.searchMaps.forEach(function(t,o){e.startsWith(o)&&o.length>n&&(n=o.length,r=o)});var o=[];r!==e?this.searchMaps.get(r).forEach(function(n){var r=t.getNodeById(n);r.label.toLowerCase().indexOf(e)>=0&&o.push(r._id)}):this.tree.forEach(function(t){t.label.toLowerCase().indexOf(e)>=0&&o.push(t._id)});return this.searchMaps.set(e,o),o}},{key:"addParentsToTree",value:function(e,t){if(void 0!==e){var n=this.getNodeById(e);this.addParentsToTree(n._parent,t),n.hide=!0,n.matchInChildren=!0,t.set(e,n)}}},{key:"addChildrenToTree",value:function(e,t,n){var r=this;void 0!==e&&e.forEach(function(e){if(!n||!n.includes(e)){var o=r.getNodeById(e);o.matchInParent=!0,t.set(e,o),r.addChildrenToTree(o._children,t)}})}},{key:"filterTree",value:function(e,t,n){var r=this,o=this.getMatches(e.toLowerCase()),a=new Map;this.tree.forEach(function(e){e.hide=!0,e.matchInChildren=!1}),o.forEach(function(e){var i=r.getNodeById(e);i.hide=!1,t&&r.addParentsToTree(i._parent,a),a.set(e,i),t&&n&&r.addChildrenToTree(i._children,a,o)});var i=0===o.length;return this.matchTree=a,{allNodesHidden:i,tree:a}}},{key:"restoreNodes",value:function(){return this.tree.forEach(function(e){e.hide=!1}),this.tree}},{key:"restoreDefaultValues",value:function(){var e=this;return this.defaultValues.forEach(function(t){e.setNodeCheckedState(t,!0)}),this.tree}},{key:"togglePreviousChecked",value:function(e){var t=this.currentChecked;t&&t!==e&&(this.getNodeById(t).checked=!1),this.currentChecked=e}},{key:"setNodeCheckedState",value:function(e,t){var n=this.getNodeById(e);n.checked=t,this.showPartialState&&(n.partial=!1),this.simpleSelect?this.togglePreviousChecked(e):(this.hierarchical||this.toggleChildren(e,t),this.showPartialState&&this.partialCheckParents(n),this.hierarchical||t||this.unCheckParents(n))}},{key:"unCheckParents",value:function(e){for(var t=e._parent;t;){var n=this.getNodeById(t);n.checked=!1,n.partial=me(n,"_children",this.getNodeById.bind(this)),t=n._parent}}},{key:"partialCheckParents",value:function(e){for(var t=this,n=e._parent;n;){var r=this.getNodeById(n);r.checked=r._children.every(function(e){return t.getNodeById(e).checked}),r.partial=me(r,"_children",this.getNodeById.bind(this)),n=r._parent}}},{key:"toggleChildren",value:function(e,t){var n=this,r=this.getNodeById(e);r.checked=t,this.showPartialState&&(r.partial=!1),u(r._children)||r._children.forEach(function(e){return n.toggleChildren(e,t)})}},{key:"toggleNodeExpandState",value:function(e){var t=this.getNodeById(e);return t.expanded=!t.expanded,t.expanded||this.collapseChildren(t),this.tree}},{key:"collapseChildren",value:function(e){var t=this;e.expanded=!1,u(e._children)||e._children.forEach(function(e){return t.collapseChildren(t.getNodeById(e))})}},{key:"getTags",value:function(){var e=this,t=[],n={};return this.tree.forEach(function(r,o){n[o]||(r.checked?(t.push(r),e.hierarchical||function t(r){n[r._id]=!0,u(r._children)||r._children.forEach(function(n){return t(e.getNodeById(n))})}(r)):n[o]=!0)}),t}}]),e}(),_e=n(4),Se=n.n(_e),ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ce=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(); | ||
***************************************************************************** */var E=function(){return(E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var x={Pixel:"Pixel",Percent:"Percent"},j={unit:x.Percent,value:.8};function N(e){return"number"==typeof e?{unit:x.Percent,value:100*e}:"string"==typeof e?e.match(/^(\d*(\.\d+)?)px$/)?{unit:x.Pixel,value:parseFloat(e)}:e.match(/^(\d*(\.\d+)?)%$/)?{unit:x.Percent,value:parseFloat(e)}:(console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'),j):(console.warn("scrollThreshold should be string or number"),j)}var R=function(e){function t(t){var n=e.call(this,t)||this;return n.lastScrollTop=0,n.actionTriggered=!1,n.startY=0,n.currentY=0,n.dragging=!1,n.maxPullDownDistance=0,n.getScrollableTarget=function(){return n.props.scrollableTarget instanceof HTMLElement?n.props.scrollableTarget:"string"==typeof n.props.scrollableTarget?document.getElementById(n.props.scrollableTarget):(null===n.props.scrollableTarget&&console.warn("You are trying to pass scrollableTarget but it is null. This might\n happen because the element may not have been added to DOM yet.\n See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.\n "),null)},n.onStart=function(e){n.lastScrollTop||(n.dragging=!0,e instanceof MouseEvent?n.startY=e.pageY:e instanceof TouchEvent&&(n.startY=e.touches[0].pageY),n.currentY=n.startY,n._infScroll&&(n._infScroll.style.willChange="transform",n._infScroll.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},n.onMove=function(e){n.dragging&&(e instanceof MouseEvent?n.currentY=e.pageY:e instanceof TouchEvent&&(n.currentY=e.touches[0].pageY),n.currentY<n.startY||(n.currentY-n.startY>=Number(n.props.pullDownToRefreshThreshold)&&n.setState({pullToRefreshThresholdBreached:!0}),n.currentY-n.startY>1.5*n.maxPullDownDistance||n._infScroll&&(n._infScroll.style.overflow="visible",n._infScroll.style.transform="translate3d(0px, "+(n.currentY-n.startY)+"px, 0px)")))},n.onEnd=function(){n.startY=0,n.currentY=0,n.dragging=!1,n.state.pullToRefreshThresholdBreached&&(n.props.refreshFunction&&n.props.refreshFunction(),n.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){n._infScroll&&(n._infScroll.style.overflow="auto",n._infScroll.style.transform="none",n._infScroll.style.willChange="unset")})},n.onScrollListener=function(e){"function"==typeof n.props.onScroll&&setTimeout(function(){return n.props.onScroll&&n.props.onScroll(e)},0);var t=n.props.height||n._scrollableNode?e.target:document.documentElement.scrollTop?document.documentElement:document.body;n.actionTriggered||((n.props.inverse?n.isElementAtTop(t,n.props.scrollThreshold):n.isElementAtBottom(t,n.props.scrollThreshold))&&n.props.hasMore&&(n.actionTriggered=!0,n.setState({showLoader:!0}),n.props.next&&n.props.next()),n.lastScrollTop=t.scrollTop)},n.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:t.dataLength},n.throttledOnScrollListener=function(e,t,n,r){var o,a=!1,i=0;function l(){o&&clearTimeout(o)}function s(){var s=this,c=Date.now()-i,u=arguments;function p(){i=Date.now(),n.apply(s,u)}a||(r&&!o&&p(),l(),void 0===r&&c>e?p():!0!==t&&(o=setTimeout(r?function(){o=void 0}:p,void 0===r?e-c:e)))}return"boolean"!=typeof t&&(r=n,n=t,t=void 0),s.cancel=function(){l(),a=!0},s}(150,n.onScrollListener).bind(n),n.onStart=n.onStart.bind(n),n.onMove=n.onMove.bind(n),n.onEnd=n.onEnd.bind(n),n}return function(e,t){function n(){this.constructor=e}P(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){if(void 0===this.props.dataLength)throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener("scroll",this.throttledOnScrollListener),"number"==typeof this.props.initialScrollY&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener("touchstart",this.onStart),this.el.addEventListener("touchmove",this.onMove),this.el.addEventListener("touchend",this.onEnd),this.el.addEventListener("mousedown",this.onStart),this.el.addEventListener("mousemove",this.onMove),this.el.addEventListener("mouseup",this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),"function"!=typeof this.props.refreshFunction))throw new Error('Mandatory prop "refreshFunction" missing.\n Pull Down To Refresh functionality will not work\n as expected. Check README.md for usage\'')},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener("scroll",this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener("touchstart",this.onStart),this.el.removeEventListener("touchmove",this.onMove),this.el.removeEventListener("touchend",this.onEnd),this.el.removeEventListener("mousedown",this.onStart),this.el.removeEventListener("mousemove",this.onMove),this.el.removeEventListener("mouseup",this.onEnd)))},t.prototype.componentDidUpdate=function(e){this.props.dataLength!==e.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(e,t){return e.dataLength!==t.prevDataLength?E(E({},t),{prevDataLength:e.dataLength}):null},t.prototype.isElementAtTop=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=N(t);return r.unit===x.Pixel?e.scrollTop<=r.value+n-e.scrollHeight+1:e.scrollTop<=r.value/100+n-e.scrollHeight+1},t.prototype.isElementAtBottom=function(e,t){void 0===t&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=N(t);return r.unit===x.Pixel?e.scrollTop+n>=e.scrollHeight-r.value:e.scrollTop+n>=r.value/100*e.scrollHeight},t.prototype.render=function(){var e=this,t=E({height:this.props.height||"auto",overflow:"auto",WebkitOverflowScrolling:"touch"},this.props.style),n=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),r=this.props.pullDownToRefresh&&this.props.height?{overflow:"auto"}:{};return s.a.createElement("div",{style:r,className:"infinite-scroll-component__outerdiv"},s.a.createElement("div",{className:"infinite-scroll-component "+(this.props.className||""),ref:function(t){return e._infScroll=t},style:t},this.props.pullDownToRefresh&&s.a.createElement("div",{style:{position:"relative"},ref:function(t){return e._pullDown=t}},s.a.createElement("div",{style:{position:"absolute",left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!n&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(l.Component),M=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function D(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var L=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=D(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.handleClick=function(){r.props.onAction(r.props.actionData)},D(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),M(t,[{key:"render",value:function(){var e=this.props,t=e.title,n=e.className,r=e.text,o=e.readOnly;return s.a.createElement("i",{title:t,className:n,onClick:!o&&this.handleClick},r)}}]),t}();L.propTypes={title:i.a.string,text:i.a.string,className:i.a.string,actionData:i.a.object,onAction:i.a.func,readOnly:i.a.bool},L.defaultProps={onAction:function(){}};var I=L,A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Y=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),B(t,[{key:"render",value:function(){var e=this.props,t=e.actions,n=e.id,r=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["actions","id"]);return u(t)?null:t.map(function(e,t){var o=e.id||"action-"+t;return s.a.createElement(I,A({key:o},r,e,{actionData:{action:o,id:n}}))})}}]),t}();Y.propTypes={id:i.a.string.isRequired,actions:i.a.array};var V=Y,F=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},H=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function q(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var z=function(e){var t=e.checked,n=e.indeterminate;return function(e){e&&(e.checked=t,e.indeterminate=n)}},W=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=q(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.handleChange=function(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),r.props.onChange(e)},q(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),H(t,[{key:"render",value:function(){var e=this.props,t=e.checked,n=e.indeterminate,r=void 0!==n&&n,o=(e.onChange,e.disabled),a=e.readOnly,i=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["checked","indeterminate","onChange","disabled","readOnly"]),l=o||a;return s.a.createElement("input",F({type:"checkbox",ref:z({checked:t,indeterminate:r}),onChange:this.handleChange,disabled:l},i))}}]),t}();W.propTypes={checked:i.a.bool,indeterminate:i.a.bool,onChange:i.a.func,disabled:i.a.bool,readOnly:i.a.bool};var U=W,$=n(3),J=n.n($),Z=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function G(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var K=o.a.bind(J.a),Q=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=G(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.handleCheckboxChange=function(e){var t=r.props,n=t.simpleSelect,o=t.id,a=t.onCheckboxChange;n?a(o,!0):a(o,e.target.checked)},G(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),Z(t,[{key:"render",value:function(){var e=this.props,t=e.simpleSelect,n=e.title,r=e.label,o=e.id,a=e.partial,i=e.path,l=e.checked,c=e.value,u=e.disabled,p=e.showPartiallySelected,h=e.readOnly,d=e.approved,f=e.nodeRenderer,g={className:"node-label"};return t&&!h&&(g.onClick=this.handleCheckboxChange),f?f({id:o,value:c,disabled:u,checked:l,path:i,refUpdater:z,approved:d,title:n||r,onChange:this.handleCheckboxChange,indeterminate:p&&a}):s.a.createElement("label",{title:n||r,htmlFor:o},s.a.createElement(U,{name:o,id:o,indeterminate:p&&a,className:K("checkbox-item",{"simple-select":t}),checked:l,onChange:this.handleCheckboxChange,value:c,disabled:u,readOnly:h}),s.a.createElement("span",g,r))}}]),t}();Q.propTypes={id:i.a.string.isRequired,actions:i.a.array,title:i.a.string,label:i.a.string.isRequired,value:i.a.string.isRequired,checked:i.a.bool,path:i.a.array,partial:i.a.bool,expanded:i.a.bool,disabled:i.a.bool,dataset:i.a.object,simpleSelect:i.a.bool,showPartiallySelected:i.a.bool,onCheckboxChange:i.a.func,nodeRenderer:i.a.func,readOnly:i.a.bool,approved:i.a.bool};var X=Q,ee=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function te(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var ne=o.a.bind(J.a),re=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=te(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.onToggle=function(){r.props.onNodeToggle(r.props.id)},te(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),ee(t,[{key:"render",value:function(){var e=this.props,t=e.expanded,n=e.isLeaf,r=e.iconRenderer,o=ne("toggle",{expanded:!n&&t,collapsed:!n&&!t});return r?r(o,this.onToggle):s.a.createElement("i",{className:o,onClick:this.onToggle})}}]),t}();re.propTypes={expanded:i.a.bool,isLeaf:i.a.bool,onNodeToggle:i.a.func,id:i.a.string,iconRenderer:i.a.func};var oe=re,ae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ie=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var le=o.a.bind(J.a),se=function(e){return u(e)},ce=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["PureComponent"]),ie(t,[{key:"render",value:function(){var e=this.props,t=e.simpleSelect,n=e.keepTreeOnSearch,r=e._id,o=e._children,a=e.dataset,i=e._depth,l=e.expanded,u=e.title,p=e.label,h=e.partial,d=e.checked,f=e.value,g=e.path,y=e.disabled,b=e.actions,v=e.onAction,m=e.searchModeOn,w=e.onNodeToggle,O=e.onCheckboxChange,T=e.showPartiallySelected,_=e.nodeRenderer,S=e.iconRenderer,k=e.readOnly,C=e.approved,P=function(e){var t=e.keepTreeOnSearch,n=e.keepChildrenOnSearch,r=e._children,o=e.matchInChildren,a=e.matchInParent,i=e.disabled,l=e.partial,s=e.hide,c=e.className,u=e.showPartiallySelected,p=e.readOnly;return le("node",{leaf:se(r),tree:!se(r),disabled:i,hide:s,"match-in-children":t&&o,"match-in-parent":t&&n&&a,partial:u&&l,readOnly:p},c)}(this.props),E=n||!m?{paddingLeft:20*(i||0)+"px"}:{};return s.a.createElement("li",ae({className:P,style:E},c(a)),s.a.createElement(oe,{isLeaf:se(o),expanded:l,id:r,onNodeToggle:w,iconRenderer:S}),s.a.createElement(X,{title:u,label:p,id:r,path:g,partial:h,checked:d,value:f,disabled:y,simpleSelect:t,onCheckboxChange:O,showPartiallySelected:T,nodeRenderer:_,readOnly:k,approved:C}),s.a.createElement(V,{actions:b,onAction:v,id:r,readOnly:k}))}}]),t}();ce.propTypes={_id:i.a.string.isRequired,_depth:i.a.number,_children:i.a.array,actions:i.a.array,className:i.a.string,title:i.a.string,label:i.a.string.isRequired,value:i.a.string.isRequired,path:i.a.array,checked:i.a.bool,expanded:i.a.bool,disabled:i.a.bool,partial:i.a.bool,dataset:i.a.object,keepTreeOnSearch:i.a.bool,keepChildrenOnSearch:i.a.bool,searchModeOn:i.a.bool,onNodeToggle:i.a.func,onAction:i.a.func,onCheckboxChange:i.a.func,simpleSelect:i.a.bool,showPartiallySelected:i.a.bool,nodeRenderer:i.a.func,iconRenderer:i.a.func,readOnly:i.a.bool,approved:i.a.bool};var ue=ce,pe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var de=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return fe.call(n),n.computeInstanceProps(e),n.state={items:n.allVisibleNodes.slice(0,n.props.pageSize)},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l["Component"]),he(t,[{key:"render",value:function(){var e=this.props,t=e.searchModeOn,n=e.noItemsPlaceholder;return this.state.items.length>0?s.a.createElement("ul",{className:"root "+(t?"searchModeOn":""),ref:this.setNodeRef},this.state.scrollableTarget&&s.a.createElement(R,{dataLength:this.state.items.length,next:this.loadMore,hasMore:this.hasMore(),loader:s.a.createElement("span",{className:"searchLoader"},"Loading..."),scrollableTarget:this.state.scrollableTarget},this.state.items)):n}}]),t}();de.propTypes={data:i.a.object,keepTreeOnSearch:i.a.bool,keepChildrenOnSearch:i.a.bool,searchModeOn:i.a.bool,onChange:i.a.func,onNodeToggle:i.a.func,onAction:i.a.func,onCheckboxChange:i.a.func,simpleSelect:i.a.bool,showPartiallySelected:i.a.bool,pageSize:i.a.number,nodeRenderer:i.a.func,iconRenderer:i.a.func,readOnly:i.a.bool,noItemsPlaceholder:i.a.any},de.defaultProps={pageSize:100,noItemsPlaceholder:s.a.createElement("p",null,"The data contains no valid elements for display")};var fe=function(){var e=this;this.componentWillReceiveProps=function(t){e.computeInstanceProps(t),e.setState({items:e.allVisibleNodes.slice(0,e.props.pageSize)})},this.componentDidMount=function(){e.setState({scrollableTarget:e.node&&e.node.parentNode?e.node.parentNode:null})},this.computeInstanceProps=function(t){e.allVisibleNodes=e.getNodes(t),e.totalPages=Math.ceil(e.allVisibleNodes.length/e.props.pageSize),e.currentPage=1},this.hasValidData=function(e){return!(!e||e.constructor!==Map)&&e.size>0},this.getNodes=function(t){var n=t.data,r=t.keepTreeOnSearch,o=t.searchModeOn,a=t.simpleSelect,i=t.showPartiallySelected,l=t.readOnly,c=t.nodeRenderer,u=t.iconRenderer,p=t.onAction,h=t.onChange,d=t.onCheckboxChange,f=t.onNodeToggle,g=t.keepChildrenOnSearch,y=[];return e.hasValidData(n)&&n.forEach(function(e){(function(e,t,n){if(t||e.expanded)return!0;var r=e._parent&&n.get(e._parent);return!r||r.expanded})(e,o,n)&&y.push(s.a.createElement(ue,pe({keepTreeOnSearch:r,keepChildrenOnSearch:g,key:e._id},e,{searchModeOn:o,onChange:h,onCheckboxChange:d,onNodeToggle:f,onAction:p,simpleSelect:a,showPartiallySelected:i,nodeRenderer:c,iconRenderer:u,readOnly:l})))}),y},this.hasMore=function(){return e.currentPage<=e.totalPages},this.loadMore=function(){e.currentPage=e.currentPage+1;var t=e.allVisibleNodes.slice(0,e.currentPage*e.props.pageSize);e.setState({items:t})},this.setNodeRef=function(t){e.node=t}},ge=de,ye=n(5),be=n.n(ye),ve=function(e){return e},me=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"children",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ve;return be()(e[t],function(e){return n(e).checked})||e[t].some(function(e){return n(e).partial})};var we=function(e,t,n,r){var o=function e(t){var n=t.nodes,r=t.list,o=void 0===r?new Map:r,a=t.parent,i=t.depth,l=void 0===i?0:i,s=t.simple,c=t.showPartialState,p=t.defaultValues,h=void 0===p?[]:p,d=t.hierarchical;return n.forEach(function(t,n){t._depth=l,a?(t._id=t.id||a._id+"-"+n,t._parent=a._id,a._children.push(t._id)):t._id=t.id||""+n,t.isDefaultValue&&(h.push(t._id),t.checked=!0),d||function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=["checked","disabled"],r=0;r<n.length;r++){var o=n[r];void 0===e[o]&&void 0!==t[o]&&(e[o]=t[o])}}(t,a),o.set(t._id,t),!s&&t.children&&(t._children=[],e({nodes:t.children,list:o,parent:t,depth:l+1,showPartialState:c,defaultValues:h,hierarchical:d}),c&&!t.checked&&(t.partial=me(t),!u(t.children)&&t.children.every(function(e){return e.checked})&&(t.checked=!0)),t.children=void 0)}),{list:o,defaultValues:h}}({nodes:Array.isArray(e)?e:[e],simple:t,showPartialState:n,hierarchical:r});return{list:o.list,defaultValues:o.defaultValues}},Oe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Te=function(){function e(t){var n=t.data,r=t.simpleSelect,o=t.showPartiallySelected,a=t.hierarchical;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._src=n;var i=we(JSON.parse(JSON.stringify(n)),r,o,a),l=i.list,s=i.defaultValues;this.tree=l,this.defaultValues=s,this.simpleSelect=r,this.showPartialState=!a&&o,this.searchMaps=new Map,this.hierarchical=a}return Oe(e,[{key:"getNodeById",value:function(e){return this.tree.get(e)}},{key:"getMatches",value:function(e){var t=this;if(this.searchMaps.has(e))return this.searchMaps.get(e);var n=-1,r=e;this.searchMaps.forEach(function(t,o){e.startsWith(o)&&o.length>n&&(n=o.length,r=o)});var o=[];r!==e?this.searchMaps.get(r).forEach(function(n){var r=t.getNodeById(n);r.label.toLowerCase().indexOf(e)>=0&&o.push(r._id)}):this.tree.forEach(function(t){t.label.toLowerCase().indexOf(e)>=0&&o.push(t._id)});return this.searchMaps.set(e,o),o}},{key:"addParentsToTree",value:function(e,t){if(void 0!==e){var n=this.getNodeById(e);this.addParentsToTree(n._parent,t),n.hide=!0,n.matchInChildren=!0,t.set(e,n)}}},{key:"addChildrenToTree",value:function(e,t,n){var r=this;void 0!==e&&e.forEach(function(e){if(!n||!n.includes(e)){var o=r.getNodeById(e);o.matchInParent=!0,t.set(e,o),r.addChildrenToTree(o._children,t)}})}},{key:"filterTree",value:function(e,t,n){var r=this,o=this.getMatches(e.toLowerCase()),a=new Map;this.tree.forEach(function(e){e.hide=!0,e.matchInChildren=!1}),o.forEach(function(e){var i=r.getNodeById(e);i.hide=!1,t&&r.addParentsToTree(i._parent,a),a.set(e,i),t&&n&&r.addChildrenToTree(i._children,a,o)});var i=0===o.length;return this.matchTree=a,{allNodesHidden:i,tree:a}}},{key:"restoreNodes",value:function(){return this.tree.forEach(function(e){e.hide=!1}),this.tree}},{key:"restoreDefaultValues",value:function(){var e=this;return this.defaultValues.forEach(function(t){e.setNodeCheckedState(t,!0)}),this.tree}},{key:"togglePreviousChecked",value:function(e){var t=this.currentChecked;t&&t!==e&&(this.getNodeById(t).checked=!1),this.currentChecked=e}},{key:"setNodeCheckedState",value:function(e,t){var n=this.getNodeById(e);n.checked=t,this.showPartialState&&(n.partial=!1),this.simpleSelect?this.togglePreviousChecked(e):(this.hierarchical||this.toggleChildren(e,t),this.showPartialState&&this.partialCheckParents(n),this.hierarchical||t||this.unCheckParents(n))}},{key:"unCheckParents",value:function(e){for(var t=e._parent;t;){var n=this.getNodeById(t);n.checked=!1,n.partial=me(n,"_children",this.getNodeById.bind(this)),t=n._parent}}},{key:"partialCheckParents",value:function(e){for(var t=this,n=e._parent;n;){var r=this.getNodeById(n);r.checked=r._children.every(function(e){return t.getNodeById(e).checked}),r.partial=me(r,"_children",this.getNodeById.bind(this)),n=r._parent}}},{key:"toggleChildren",value:function(e,t){var n=this,r=this.getNodeById(e);r.checked=t,this.showPartialState&&(r.partial=!1),u(r._children)||r._children.forEach(function(e){return n.toggleChildren(e,t)})}},{key:"toggleNodeExpandState",value:function(e){var t=this.getNodeById(e);return t.expanded=!t.expanded,t.expanded||this.collapseChildren(t),this.tree}},{key:"collapseChildren",value:function(e){var t=this;e.expanded=!1,u(e._children)||e._children.forEach(function(e){return t.collapseChildren(t.getNodeById(e))})}},{key:"getTags",value:function(){var e=this,t=[],n={};return this.tree.forEach(function(r,o){n[o]||(r.checked?(t.push(r),e.hierarchical||function t(r){n[r._id]=!0,u(r._children)||r._children.forEach(function(n){return t(e.getNodeById(n))})}(r)):n[o]=!0)}),t}}]),e}(),_e=n(4),Se=n.n(_e),ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ce=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(); | ||
/*! | ||
@@ -29,0 +29,0 @@ * React Dropdown Tree Select |
{ | ||
"name": "react-tree-dropdown-", | ||
"version": "2.1.4-beta.0", | ||
"version": "2.1.4-beta.1", | ||
"description": "Lightweight, customizable and fast Dropdown Tree Select component for React", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1090576
10327