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

rb-table

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rb-table - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

2

dist/rb-table.bundle.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.RBTable=t(e.React)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;10>r;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var o={};"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}();var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function i(){}var l,a,s,c,d,h,u,f,p,b,m,y,v,w,_,g,x=(function(e){e.exports=function(){function e(e,t,r,o,i,l){if(l!==n){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=i,r.PropTypes=r,r}()}(l={exports:{}},l.exports),l.exports),E=!1;function S(){if(!E){E=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),r=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(v=/\b(iPhone|iP[ao]d)/.exec(e),w=/\b(iP[ao]d)/.exec(e),m=/Android/i.exec(e),_=/FBAN\/\w+;/i.exec(e),g=/Mobile/i.exec(e),y=!!/Win64/.exec(e),t){(a=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(a=document.documentMode);var o=/(?:Trident\/(\d+.\d+))/.exec(e);u=o?parseFloat(o[1])+4:a,s=t[2]?parseFloat(t[2]):NaN,c=t[3]?parseFloat(t[3]):NaN,(d=t[4]?parseFloat(t[4]):NaN)?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),h=t&&t[1]?parseFloat(t[1]):NaN):h=NaN}else a=s=c=h=d=NaN;if(r){if(r[1]){var n=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);f=!n||parseFloat(n[1].replace("_","."))}else f=!1;p=!!r[2],b=!!r[3]}else f=p=b=!1}}var M,O={ie:function(){return S()||a},ieCompatibilityMode:function(){return S()||u>a},ie64:function(){return O.ie()&&y},firefox:function(){return S()||s},opera:function(){return S()||c},webkit:function(){return S()||d},safari:function(){return O.webkit()},chrome:function(){return S()||h},windows:function(){return S()||p},osx:function(){return S()||f},linux:function(){return S()||b},iphone:function(){return S()||v},mobile:function(){return S()||v||w||m||g},nativeApp:function(){return S()||_},android:function(){return S()||m},ipad:function(){return S()||w}},T=O,C=!("undefined"==typeof window||!window.document||!window.document.createElement),N={canUseDOM:C,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:C&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:C&&!!window.screen,isInWorker:!C};N.canUseDOM&&(M=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var k=function(e,t){if(!N.canUseDOM||t&&!("addEventListener"in document))return!1;var r="on"+e,o=r in document;if(!o){var n=document.createElement("div");n.setAttribute(r,"return;"),o="function"==typeof n[r]}return!o&&M&&"wheel"===e&&(o=document.implementation.hasFeature("Events.wheel","3.0")),o},R=10,z=40,D=800;function L(e){var t=0,r=0,o=0,n=0;return"detail"in e&&(r=e.detail),"wheelDelta"in e&&(r=-e.wheelDelta/120),"wheelDeltaY"in e&&(r=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=r,r=0),o=t*R,n=r*R,"deltaY"in e&&(n=e.deltaY),"deltaX"in e&&(o=e.deltaX),(o||n)&&e.deltaMode&&(1==e.deltaMode?(o*=z,n*=z):(o*=D,n*=D)),o&&!t&&(t=1>o?-1:1),n&&!r&&(r=1>n?-1:1),{spinX:t,spinY:r,pixelX:o,pixelY:n}}L.getEventType=function(){return T.firefox()?"DOMMouseScroll":k("wheel")?"wheel":"mousewheel"};var P,W,X=L,B=navigator.userAgent.match(/Trident/),j=(P=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return P(e)}),A=(W=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return W(e)});function F(e){var t=e.target||e.srcElement;t.__resizeRAF__&&A(t.__resizeRAF__),t.__resizeRAF__=j(function(){var r=t.__resizeTrigger__;r.__resizeListeners__.forEach(function(t){t.call(r,e)})})}function q(){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",F)}function I(e,t){if(!e.__resizeListeners__){e.__resizeListeners__=[];var r=e.__resizeTrigger__=document.createElement("object");r.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),r.__resizeElement__=e,r.onload=q,r.type="text/html",B&&e.appendChild(r),r.data="about:blank",B||e.appendChild(r)}e.__resizeListeners__.push(t)}function Y(e,t){var r={};for(var o in e)0>t.indexOf(o)&&Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function H(t){for(var r=arguments.length,o=Array(r>1?r-1:0),n=1;r>n;n++)o[n-1]=arguments[n];if(t)return"string"==typeof t||"number"==typeof t?t:"function"==typeof t?t.apply(void 0,o):e.isValidElement(t)?e.cloneElement(t,{tablecontext:o}):void 0}function U(e){return e.width?{width:e.width}:null}function V(e){return e?e+"px":e}function G(e,t){e.style.height=t}function K(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.touches,r=e.clientX,o=e.clientY;if(t&&t.length>0){var n=t[0];r=n.clientX,o=n.clientY}return{clientX:r,clientY:o}}function Z(e,t,r){return e.width&&e[t]?Error(r+".column."+t+" will not take effect when column.width is set."):"maxWidth"===t&&e.minWidth>e.maxWidth?Error(r+".column.maxWidth is smaller then column.minWidth"):void 0}var J=function(t){function r(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var o=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.call(this,e));return o.setTableRef=o.setTableRef.bind(o),o.handleResize=o.handleResize.bind(o),o.handleScroll=o.handleScroll.bind(o),o.handleClickRow=o.handleClickRow.bind(o),o.handleMoveEnd=o.handleMoveEnd.bind(o),o.handleMove=o.handleMove.bind(o),o.hScrollPanelMouseDown=o.hScrollPanelMouseDown.bind(o),o.vScrollPanelMouseDown=o.vScrollPanelMouseDown.bind(o),o.horizontalMoveStart=o.horizontalMoveStart.bind(o),o.verticalMoveStart=o.verticalMoveStart.bind(o),o.touchStart=o.touchStart.bind(o),o.touchEnd=o.touchEnd.bind(o),o}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)}(r,t),r.prototype.componentWillUnmount=function(){I(this.table,this.handleResize),window.removeEventListener("mousemove",this.handleMove),window.removeEventListener("mouseup",this.handleMoveEnd)},r.prototype.componentDidMount=function(){var e=this;window.addEventListener("mousemove",this.handleMove),window.addEventListener("mouseup",this.handleMoveEnd),setTimeout(function(){e.reflow()})},r.prototype.setTableRef=function(e){var t,r;e&&(this.table&&(r=this.handleResize,(t=this.table).__resizeListeners__&&(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(r),1),t.__resizeListeners__.length||(t.__resizeTrigger__.contentDocument.defaultView.removeEventListener("resize",F),t.__resizeTrigger__=!t.removeChild(t.__resizeTrigger__)))),this.table=e,I(e,this.handleResize))},r.prototype.componentDidUpdate=function(){this.reflow()},r.prototype.handleResize=function(){this.reflow()},r.prototype.reflow=function(){this.refs.virtualTable&&this.refs.body&&(this.alignTable(),this.scrollByOffset(0,0),this.table.style.visibility="visible")},r.prototype.handleScroll=function(e){var t=X(e),r=t.pixelY,o=t.pixelX;r=Math.round(.5*r),this.scrollByOffset(o=Math.round(.5*o),r).hasOffset&&(this.autoSize||e.preventDefault(),e.stopPropagation())},r.prototype.handleClickRow=function(e,t){this.props.onRowClick&&this.props.onRowClick(e,t)},r.prototype.setLocation=function(e){var t=e.clientY;this.x=e.clientX,this.y=t},r.prototype.handleMoveEnd=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1,this.touchIsStarted=!1},r.prototype.handleMove=function(e){var t=K(e),r=t.clientX,o=t.clientY;this.mouseIsDownBottom?this.move({clientX:r,clientY:this.y}):this.mouseIsDownRight?this.move({clientX:this.x,clientY:o}):this.touchIsStarted&&(e.preventDefault(),this.move({clientX:r,clientY:o},-1))},r.prototype.move=function(e){var t=e.clientX,r=e.clientY,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=t-this.x,i=r-this.y;this.setLocation({clientX:t,clientY:r}),this.scrollByOffset(o*n,o*i)},r.prototype.touchStart=function(e){this.touchIsStarted=!0,this.setLocation(K(e))},r.prototype.touchEnd=function(e){this.touchIsStarted=!1},r.prototype.hScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.hScrollBar.getBoundingClientRect(),r=t.left,o=t.right,n=K(e).clientX-.5*(r+o);this.scrollByOffset(n,0)}},r.prototype.vScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.vScrollBar.getBoundingClientRect(),r=t.top,o=t.bottom,n=K(e).clientY-.5*(r+o);this.scrollByOffset(0,n)}},r.prototype.horizontalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(K(e)))},r.prototype.verticalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(K(e)))},r.prototype.getHoverClass=function(){var e=this.props.prefixCls,t=" "+e+"-row--hover";return this.props.onRowClick&&(t+=e+"-row--clickable"),t},r.prototype.bodies=function(){var e=this.refs;return[e.bodyMiddleContent,e.bodyLeftContent,e.bodyRightContent].filter(function(e){return!!e})},r.prototype.handleRowEnter=function(e){var t=this;this.bodies().forEach(function(r){return r.children[e].className+=t.getHoverClass()})},r.prototype.handleRowLeave=function(e){var t=this;this.bodies().forEach(function(r){return r.children[e].className=r.children[e].className.replace(t.getHoverClass(),"")})},r.prototype.getTableWidthHeight=function(){var e=this.refs,t=e.virtualTable,r=e.scrollX,o=[],n=[];t.style.width="",r.clientWidth-this.props.columns.length>t.offsetWidth&&(t.style.width=V(r.clientWidth-this.props.columns.length));var i=t.querySelector("thead > tr"),l=t.querySelector("colgroup");function a(){for(var e=0;i.children.length>e;e++)o[e]=i.children[e].offsetWidth+1}return this.props.columns.forEach(function(e,t){l.children[t].style.width=V(e.width||"")}),a(),this.props.columns.forEach(function(e,t){var r=e.width,n=e.minWidth,i=e.maxWidth;(i||n)&&(r=o[t],r=Math.min(i||r,r),l.children[t].style.width=V(r=Math.max(n||r,r)))}),a(),t.querySelectorAll("tbody > tr").forEach(function(e,t){n[t]=e.offsetHeight}),{columnWs:o,rowHs:n}},r.prototype.alignTable=function(){var e=this,t=this.refs,r=t.headerLeft,o=t.headerRight,n=t.body,i=this.props.columns,l=[r,o].filter(function(e){return!!e});l.forEach(function(e){G(e.querySelector("tr"),"")});var a=this.getTableWidthHeight(),s=a.columnWs,c=a.rowHs,d=this.refs.virtualTable.querySelector("thead > tr").clientHeight,h=this.table.clientHeight,u=this.refs.hScrollPanel.offsetHeight,f=this.refs.bodyMiddle.querySelector("colgroup"),p=this.refs.headerMiddle.querySelector("colgroup"),b=0,m=0;s.forEach(function(t,n){var l=V(t);b+=t,f.children[n].style.width=l,p.children[n].style.width=l,i[n].width||("left"===i[n].fixed?(r.querySelector("colgroup").children[n].style.width=l,e.refs.bodyLeft.querySelector("colgroup").children[n].style.width=l):"right"===i[n].fixed&&(o.querySelector("colgroup").children[m].style.width=l,e.refs.bodyRight.querySelector("colgroup").children[m].style.width=l,m++))});var y,v,w=this.refs.scrollX.clientWidth;this.refs.scrollX.style.overflowX=b>w?"scroll":"hidden",y=this.refs.header,v=V(b=Math.max(b,w)),y.style.width=v,n.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:300+n.offsetWidth-n.clientWidth));var _=this.refs.header.offsetHeight;(this.refs.header.style.height=V(_),l.forEach(function(e){G(e.querySelector("tr"),V(d)),G(e.parentElement,V(_))}),this.bodies().forEach(function(e){!function(e,t){for(var r=0;e.children.length>r;r++)t(e.children[r],r)}(e,function(e,t){return G(e,V(c[t]))})}),h>99999||this.autoSize)?(this.autoSize=!0,n.style.width=V(this.refs.header.clientWidth),this.refs.scrollX.style.paddingBottom=0,this.refs.scrollX.style.overflowX="auto",this.refs.body.style.paddingRight=0,this.refs.body.style.overflowY="hidden"):this.refs.body.style.height=V(h-_-u)},r.prototype.scrollByOffset=function(e,t){var r=this.refs,o=r.bodyMiddle,n=r.hScrollBar,i=r.hScrollPanel,l=r.vScrollBar,a=r.vScrollPanel;if(o){var s=this.refs.scrollX.offsetWidth,c=this.refs.body.clientHeight,d=o.offsetWidth,h=o.offsetHeight,u=1,f=1;if(!this.autoSize&&h>c||(a.style.visibility="hidden",l=null,a=null),!this.autoSize&&d>s||(i.style.visibility="hidden",n=null,i=null),n){var p=i.offsetWidth,b=Math.max(p*s/d,20);u=(d-s)/(p-b)}if(l){var m=a.offsetHeight,y=Math.max(m*c/h,20);f=(h-c)/(m-y)}var v=this.refs.scrollX.scrollLeft+(e*=u),w=this.refs.body.scrollTop+(t*=f),_=!0;if(v>d-s&&(v=d-s,_=!1),0>v&&(v=0,_=!1),w>h-c&&(w=h-c,_=!1),0>w&&(w=0,_=!1),this.refs.body.scrollTop=w,this.refs.scrollX.scrollLeft=v,n)i.style.visibility="visible",n.style.width=Math.round(b)+"px",n.style.transform="translateX("+Math.round(v/u)+"px)";if(x(this.refs.bodyLeft,v),x(this.refs.bodyRight,v-d+s),l){var g=Math.round(w/f);a.style.visibility="visible",l.style.height=Math.round(y)+"px",l.style.transform="translateY("+g+"px)"}return{hasOffset:_}}function x(e,t){e&&(0===t&&e?e.parentElement.parentElement.style.display="none":(e.parentElement.parentElement.style.display="block",e.style.transform="translateY("+-w+"px)"))}},r.prototype.renderHeaderSideOf=function(t){var r=t.side,o=Y(t,["side"]),n=r.toLowerCase(),i=o[n+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"header"+r},e.createElement("colgroup",null,i.map(function(t,r){return e.createElement("col",{key:r,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:l+"-row "+l+"-row--header"},i.map(function(t,r){return e.createElement("td",{key:t.dataIndex||r,className:l+"-cell "+l+"-cell--header "+(t.headerClassName||""),style:t.headerStyle},H(t.header,o.data,t))}))))},r.prototype.renderBodySideOf=function(t){var r=this,o=t.side,n=t.data,i=Y(t,["side","data"])[o.toLowerCase()+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"body"+o},e.createElement("colgroup",null,i.map(function(t,r){return e.createElement("col",{key:r,style:U(t)})})),e.createElement("tbody",{ref:"body"+o+"Content"},n.map(function(t,o){return e.createElement("tr",{key:o,className:l+"-row "+l+"-row--body",onMouseEnter:function(){return r.handleRowEnter(o)},onMouseLeave:function(){return r.handleRowLeave(o)},onClick:function(){return r.handleClickRow(t,o)}},i.map(function(r,o){return e.createElement("td",{key:o,style:r.cellStyle,className:l+"-cell "+l+"-cell--body "+(r.cellClassName||"")},H(r.cell,t,n,r))}))})))},r.prototype.renderVirtualTable=function(t){var r=t.data,o=t.columns,n=this.props.prefixCls;return e.createElement("table",{className:n+"-hidden-layout",ref:"virtualTable"},e.createElement("colgroup",null,o.map(function(t,r){return e.createElement("col",{key:r,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:n+"-row "+n+"-row--header"},o.map(function(r,o){return e.createElement("td",{key:r.dataIndex||o,className:n+"-cell "+n+"-cell--header",style:r.headerStyle},H(r.header,t.data,r))}))),e.createElement("tbody",{ref:"virtualTableBody"},r.map(function(t,i){return e.createElement("tr",{key:i,className:n+"-row "+n+"-row--body"},o.map(function(o,i){return e.createElement("td",{key:i,style:o.cellStyle,className:n+"-cell "+n+"-cell--body "+(o.cellClassName||"")},H(o.cell,t,r,o))}))})))},r.prototype.render=function(){var t=this,r=this.props,o=r.data,n=r.columns,i=r.prefixCls,l=r.style,a=r.className,s=n.slice(),c=n.filter(function(e){return"left"===e.fixed}),d=n.filter(function(e){return"right"===e.fixed}),h=function(e){return{side:e,columns:n,leftColumns:c,rightColumns:d,middleColumns:s,data:o}};return e.createElement("div",{className:i+" "+(a||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,onTouchStart:this.touchStart,onTouchMove:this.handleMove,onTouchEnd:this.touchEnd,style:Object.assign({visibility:"hidden"},l)},e.createElement("div",{ref:"scrollX",className:i+"-scrollx",onScroll:function(){return t.scrollByOffset(0,0)}},e.createElement("div",{className:i+"__header",ref:"header"},this.renderHeaderSideOf(h("Middle"))),e.createElement("div",{className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},this.renderBodySideOf(h("Middle")),this.renderVirtualTable(h("virtual")))),!!c.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--left"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Left"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Left")))),!!d.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--right"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Right"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Right")))),e.createElement("div",{className:i+"__vscroll",ref:"vScrollPanel",onMouseDown:this.vScrollPanelMouseDown,onTouchStart:this.vScrollPanelMouseDown},e.createElement("div",{ref:"vScrollBar",className:i+"__vscroll__bar",onMouseDown:this.verticalMoveStart,onTouchStart:this.verticalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown,onTouchStart:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",className:i+"__hscroll__bar",onMouseDown:this.horizontalMoveStart,onTouchStart:this.horizontalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),this.props.children)},r}(e.Component);J.propTypes={columns:x.arrayOf(x.shape({header:x.oneOfType([x.string,x.number,x.func,x.element]).isRequired,cell:x.oneOfType([x.string,x.number,x.func,x.element]).isRequired,width:x.number,minWidth:Z,maxWidth:Z,fixed:x.oneOf(["left","right"]),headerClassName:x.string,cellClassName:x.string,headerStyle:x.obj,cellStyle:x.obj})),data:x.array.isRequired,prefixCls:x.string.isRequired,onRowClick:x.func},J.defaultProps={prefixCls:"rb-table",data:[]};return function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}('.rb-table{overflow:hidden;position:relative;background:#fff;color:#333;box-sizing:border-box;border:1px solid #e8e8e8;touch-action:none!important}.rb-table table{width:100%;border-spacing:0;font-size:12px;table-layout:fixed;border:none;word-break:break-all}.rb-table-scrollx{position:relative;overflow-x:scroll;overflow-y:hidden;padding-bottom:99999px;touch-action:none!important}.rb-table__body{overflow-y:scroll;overflow-x:hidden;touch-action:none!important;box-sizing:border-box;padding-right:300px}.rb-table__body .rb-table-hidden-layout{position:fixed;visibility:hidden;top:1000000px;width:-webkit-max-content;width:-moz-max-content;width:max-content;table-layout:auto}.rb-table-fixed{overflow:hidden;position:absolute;top:0;background:#fff}.rb-table-fixed table{width:auto}.rb-table-fixed__body{overflow:hidden}.rb-table-fixed--left{left:0;border-right:1px solid #e8e8e8}.rb-table-fixed--right{right:0;border:1px solid #e8e8e8;border-width:0 1px}.rb-table-row--hover{background-color:#fafafa}.rb-table-row--clickable{cursor:pointer}.rb-table-cell{padding:14px 10px;border-bottom:1px solid #e8e8e8;font-size:12px}.rb-table__hscroll{visibility:hidden;position:absolute;box-sizing:border-box;left:0;bottom:0;right:14px;background:#f9f9f9;height:14px;z-index:1}.rb-table__hscroll__bar{padding:3px 0;height:100%;box-sizing:border-box;touch-action:none!important}.rb-table__hscroll__bar:before{content:"";display:block;background:#bfbfbf;border-radius:14px;height:100%;width:100%}.rb-table__hscroll__bar:hover:before{background:#7f7f7f}.rb-table__vscroll{visibility:hidden;position:absolute;box-sizing:border-box;background:#f9f9f9;top:0;bottom:3px;right:0;width:14px;z-index:1}.rb-table__vscroll__bar{padding:0 3px;touch-action:none!important}.rb-table__vscroll__bar:before{content:"";display:block;background:#bfbfbf;border-radius:14px;height:100%;width:100%}.rb-table__vscroll__bar:hover:before{background:#7f7f7f}.rb-table-fixed--left .rb-table-cell:first-child,.rb-table-scrollx .rb-table-cell:first-child{padding-left:30px}.rb-table-fixed--right .rb-table-cell:last-child,.rb-table-scrollx .rb-table-cell:last-child{padding-right:30px}'),J});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.RBTable=t(e.React)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;10>r;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var o={};"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}();var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function i(){}var l,a,s,c,d,h,u,f,p,b,m,y,v,w,_,g,x=(function(e){e.exports=function(){function e(e,t,r,o,i,l){if(l!==n){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=i,r.PropTypes=r,r}()}(l={exports:{}},l.exports),l.exports),E=!1;function S(){if(!E){E=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),r=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(v=/\b(iPhone|iP[ao]d)/.exec(e),w=/\b(iP[ao]d)/.exec(e),m=/Android/i.exec(e),_=/FBAN\/\w+;/i.exec(e),g=/Mobile/i.exec(e),y=!!/Win64/.exec(e),t){(a=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(a=document.documentMode);var o=/(?:Trident\/(\d+.\d+))/.exec(e);u=o?parseFloat(o[1])+4:a,s=t[2]?parseFloat(t[2]):NaN,c=t[3]?parseFloat(t[3]):NaN,(d=t[4]?parseFloat(t[4]):NaN)?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),h=t&&t[1]?parseFloat(t[1]):NaN):h=NaN}else a=s=c=h=d=NaN;if(r){if(r[1]){var n=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);f=!n||parseFloat(n[1].replace("_","."))}else f=!1;p=!!r[2],b=!!r[3]}else f=p=b=!1}}var M,O={ie:function(){return S()||a},ieCompatibilityMode:function(){return S()||u>a},ie64:function(){return O.ie()&&y},firefox:function(){return S()||s},opera:function(){return S()||c},webkit:function(){return S()||d},safari:function(){return O.webkit()},chrome:function(){return S()||h},windows:function(){return S()||p},osx:function(){return S()||f},linux:function(){return S()||b},iphone:function(){return S()||v},mobile:function(){return S()||v||w||m||g},nativeApp:function(){return S()||_},android:function(){return S()||m},ipad:function(){return S()||w}},T=O,C=!("undefined"==typeof window||!window.document||!window.document.createElement),N={canUseDOM:C,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:C&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:C&&!!window.screen,isInWorker:!C};N.canUseDOM&&(M=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var k=function(e,t){if(!N.canUseDOM||t&&!("addEventListener"in document))return!1;var r="on"+e,o=r in document;if(!o){var n=document.createElement("div");n.setAttribute(r,"return;"),o="function"==typeof n[r]}return!o&&M&&"wheel"===e&&(o=document.implementation.hasFeature("Events.wheel","3.0")),o},R=10,z=40,D=800;function L(e){var t=0,r=0,o=0,n=0;return"detail"in e&&(r=e.detail),"wheelDelta"in e&&(r=-e.wheelDelta/120),"wheelDeltaY"in e&&(r=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=r,r=0),o=t*R,n=r*R,"deltaY"in e&&(n=e.deltaY),"deltaX"in e&&(o=e.deltaX),(o||n)&&e.deltaMode&&(1==e.deltaMode?(o*=z,n*=z):(o*=D,n*=D)),o&&!t&&(t=1>o?-1:1),n&&!r&&(r=1>n?-1:1),{spinX:t,spinY:r,pixelX:o,pixelY:n}}L.getEventType=function(){return T.firefox()?"DOMMouseScroll":k("wheel")?"wheel":"mousewheel"};var P,W,X=L,B=navigator.userAgent.match(/Trident/),j=(P=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return P(e)}),A=(W=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return W(e)});function F(e){var t=e.target||e.srcElement;t.__resizeRAF__&&A(t.__resizeRAF__),t.__resizeRAF__=j(function(){var r=t.__resizeTrigger__;r.__resizeListeners__.forEach(function(t){t.call(r,e)})})}function q(){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",F)}function I(e,t){if(!e.__resizeListeners__){e.__resizeListeners__=[];var r=e.__resizeTrigger__=document.createElement("object");r.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),r.__resizeElement__=e,r.onload=q,r.type="text/html",B&&e.appendChild(r),r.data="about:blank",B||e.appendChild(r)}e.__resizeListeners__.push(t)}function Y(e,t){var r={};for(var o in e)0>t.indexOf(o)&&Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function H(t){for(var r=arguments.length,o=Array(r>1?r-1:0),n=1;r>n;n++)o[n-1]=arguments[n];if(t)return"string"==typeof t||"number"==typeof t?t:"function"==typeof t?t.apply(void 0,o):e.isValidElement(t)?e.cloneElement(t,{tablecontext:o}):void 0}function U(e){return e.width?{width:e.width}:null}function V(e){return e?e+"px":e}function G(e,t){e.style.height=t}function K(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.touches,r=e.clientX,o=e.clientY;if(t&&t.length>0){var n=t[0];r=n.clientX,o=n.clientY}return{clientX:r,clientY:o}}function Z(e,t,r){return e.width&&e[t]?Error(r+".column."+t+" will not take effect when column.width is set."):"maxWidth"===t&&e.minWidth>e.maxWidth?Error(r+".column.maxWidth is smaller then column.minWidth"):void 0}var J=function(t){function r(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var o=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.call(this,e));return o.setTableRef=o.setTableRef.bind(o),o.handleResize=o.handleResize.bind(o),o.handleScroll=o.handleScroll.bind(o),o.handleClickRow=o.handleClickRow.bind(o),o.handleMoveEnd=o.handleMoveEnd.bind(o),o.handleMove=o.handleMove.bind(o),o.hScrollPanelMouseDown=o.hScrollPanelMouseDown.bind(o),o.vScrollPanelMouseDown=o.vScrollPanelMouseDown.bind(o),o.horizontalMoveStart=o.horizontalMoveStart.bind(o),o.verticalMoveStart=o.verticalMoveStart.bind(o),o.touchStart=o.touchStart.bind(o),o.touchEnd=o.touchEnd.bind(o),o}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)}(r,t),r.prototype.componentWillUnmount=function(){I(this.table,this.handleResize),window.removeEventListener("mousemove",this.handleMove),window.removeEventListener("mouseup",this.handleMoveEnd)},r.prototype.componentDidMount=function(){var e=this;window.addEventListener("mousemove",this.handleMove),window.addEventListener("mouseup",this.handleMoveEnd),setTimeout(function(){e.reflow()})},r.prototype.setTableRef=function(e){var t,r;e&&(this.table&&(r=this.handleResize,(t=this.table).__resizeListeners__&&(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(r),1),t.__resizeListeners__.length||(t.__resizeTrigger__.contentDocument.defaultView.removeEventListener("resize",F),t.__resizeTrigger__=!t.removeChild(t.__resizeTrigger__)))),this.table=e,I(e,this.handleResize))},r.prototype.componentDidUpdate=function(){this.reflow()},r.prototype.handleResize=function(){this.reflow()},r.prototype.reflow=function(){this.refs.virtualTable&&this.refs.body&&(this.alignTable(),this.scrollByOffset(0,0),this.table.style.visibility="visible")},r.prototype.handleScroll=function(e){var t=X(e),r=t.pixelY,o=t.pixelX;r=Math.round(.5*r),this.scrollByOffset(o=Math.round(.5*o),r).hasOffset&&(this.autoSize||e.preventDefault(),e.stopPropagation())},r.prototype.handleClickRow=function(e,t){this.props.onRowClick&&this.props.onRowClick(e,t)},r.prototype.setLocation=function(e){var t=e.clientY;this.x=e.clientX,this.y=t},r.prototype.handleMoveEnd=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1,this.touchIsStarted=!1},r.prototype.handleMove=function(e){var t=K(e),r=t.clientX,o=t.clientY;this.mouseIsDownBottom?this.move({clientX:r,clientY:this.y}):this.mouseIsDownRight?this.move({clientX:this.x,clientY:o}):this.touchIsStarted&&(e.preventDefault(),this.move({clientX:r,clientY:o},-1))},r.prototype.move=function(e){var t=e.clientX,r=e.clientY,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=t-this.x,i=r-this.y;this.setLocation({clientX:t,clientY:r}),this.scrollByOffset(o*n,o*i)},r.prototype.touchStart=function(e){this.touchIsStarted=!0,this.setLocation(K(e))},r.prototype.touchEnd=function(e){this.touchIsStarted=!1},r.prototype.hScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.hScrollBar.getBoundingClientRect(),r=t.left,o=t.right,n=K(e).clientX-.5*(r+o);this.scrollByOffset(n,0)}},r.prototype.vScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.vScrollBar.getBoundingClientRect(),r=t.top,o=t.bottom,n=K(e).clientY-.5*(r+o);this.scrollByOffset(0,n)}},r.prototype.horizontalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(K(e)))},r.prototype.verticalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(K(e)))},r.prototype.getHoverClass=function(){var e=this.props.prefixCls,t=" "+e+"-row--hover";return this.props.onRowClick&&(t+=e+"-row--clickable"),t},r.prototype.bodies=function(){var e=this.refs;return[e.bodyMiddleContent,e.bodyLeftContent,e.bodyRightContent].filter(function(e){return!!e})},r.prototype.handleRowEnter=function(e){var t=this;this.bodies().forEach(function(r){return r.children[e].className+=t.getHoverClass()})},r.prototype.handleRowLeave=function(e){var t=this;this.bodies().forEach(function(r){return r.children[e].className=r.children[e].className.replace(t.getHoverClass(),"")})},r.prototype.getTableWidthHeight=function(){var e=this.refs,t=e.virtualTable,r=e.scrollX,o=[],n=[];t.style.width="",r.clientWidth-this.props.columns.length>t.offsetWidth&&(t.style.width=V(r.clientWidth-this.props.columns.length));var i=t.querySelector("thead > tr"),l=t.querySelector("colgroup");this.props.columns.forEach(function(e,t){l.children[t].style.width=V(e.width||"")});var a=this;function s(){for(var e=0;i.children.length>e;e++){var t=a.props.columns[e],r=t.width||Math.ceil(i.children[e].offsetWidth),n=t.maxWidth,l=t.minWidth;(n||l)&&(r=Math.min(n||r,r),r=Math.max(l||r,r)),o[e]=r}}return s(),this.props.columns.forEach(function(e,t){var r=e.width,n=e.minWidth,i=e.maxWidth;(i||n)&&(r=o[t],r=Math.min(i||r,r),l.children[t].style.width=V(r=Math.max(n||r,r)))}),s(),t.querySelectorAll("tbody > tr").forEach(function(e,t){n[t]=e.offsetHeight}),{columnWs:o,rowHs:n}},r.prototype.alignTable=function(){var e=this,t=this.refs,r=t.headerLeft,o=t.headerRight,n=t.body,i=this.props.columns,l=[r,o].filter(function(e){return!!e});l.forEach(function(e){G(e.querySelector("tr"),"")});var a=this.getTableWidthHeight(),s=a.columnWs,c=a.rowHs,d=this.refs.virtualTable.querySelector("thead > tr").clientHeight,h=this.table.clientHeight,u=this.refs.hScrollPanel.offsetHeight,f=this.refs.bodyMiddle.querySelector("colgroup"),p=this.refs.headerMiddle.querySelector("colgroup"),b=0,m=0;s.forEach(function(t,n){var l=V(t);b+=t,f.children[n].style.width=l,p.children[n].style.width=l,i[n].width||("left"===i[n].fixed?(r.querySelector("colgroup").children[n].style.width=l,e.refs.bodyLeft.querySelector("colgroup").children[n].style.width=l):"right"===i[n].fixed&&(o.querySelector("colgroup").children[m].style.width=l,e.refs.bodyRight.querySelector("colgroup").children[m].style.width=l,m++))});var y,v,w=this.refs.scrollX.clientWidth;this.refs.scrollX.style.overflowX=b>w?"scroll":"hidden",y=this.refs.header,v=V(b=Math.max(b,w)),y.style.width=v,n.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:n.offsetWidth-n.clientWidth));var _=this.refs.header.offsetHeight;(this.refs.header.style.height=V(_),l.forEach(function(e){G(e.querySelector("tr"),V(d)),G(e.parentElement,V(_))}),this.bodies().forEach(function(e){!function(e,t){for(var r=0;e.children.length>r;r++)t(e.children[r],r)}(e,function(e,t){return G(e,V(c[t]))})}),h>99999||this.autoSize)?(this.autoSize=!0,n.style.width=V(this.refs.header.clientWidth),this.refs.scrollX.style.paddingBottom=0,this.refs.scrollX.style.overflowX="auto",this.refs.body.style.paddingRight=0,this.refs.body.style.overflowY="hidden"):this.refs.body.style.height=V(h-_-u)},r.prototype.scrollByOffset=function(e,t){var r=this.refs,o=r.bodyMiddle,n=r.hScrollBar,i=r.hScrollPanel,l=r.vScrollBar,a=r.vScrollPanel;if(o){var s=this.refs.scrollX.offsetWidth,c=this.refs.body.clientHeight,d=o.offsetWidth,h=o.offsetHeight,u=1,f=1;if(!this.autoSize&&h>c||(a.style.visibility="hidden",l=null,a=null),!this.autoSize&&d>s||(i.style.visibility="hidden",n=null,i=null),n){var p=i.offsetWidth,b=Math.max(p*s/d,20);u=(d-s)/(p-b)}if(l){var m=a.offsetHeight,y=Math.max(m*c/h,20);f=(h-c)/(m-y)}var v=this.refs.scrollX.scrollLeft+(e*=u),w=this.refs.body.scrollTop+(t*=f),_=!0;if(v>d-s&&(v=d-s,_=!1),0>v&&(v=0,_=!1),w>h-c&&(w=h-c,_=!1),0>w&&(w=0,_=!1),this.refs.body.scrollTop=w,this.refs.scrollX.scrollLeft=v,n)i.style.visibility="visible",n.style.width=Math.round(b)+"px",n.style.transform="translateX("+Math.round(v/u)+"px)";if(x(this.refs.bodyLeft,v),x(this.refs.bodyRight,v-d+s),l){var g=Math.round(w/f);a.style.visibility="visible",l.style.height=Math.round(y)+"px",l.style.transform="translateY("+g+"px)"}return{hasOffset:_}}function x(e,t){e&&(0===t&&e?e.parentElement.parentElement.style.display="none":(e.parentElement.parentElement.style.display="block",e.style.transform="translateY("+-w+"px)"))}},r.prototype.renderHeaderSideOf=function(t){var r=t.side,o=Y(t,["side"]),n=r.toLowerCase(),i=o[n+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"header"+r},e.createElement("colgroup",null,i.map(function(t,r){return e.createElement("col",{key:r,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:l+"-row "+l+"-row--header"},i.map(function(t,r){return e.createElement("td",{key:t.dataIndex||r,className:l+"-cell "+l+"-cell--header "+(t.headerClassName||""),style:t.headerStyle},H(t.header,o.data,t))}))))},r.prototype.renderBodySideOf=function(t){var r=this,o=t.side,n=t.data,i=Y(t,["side","data"])[o.toLowerCase()+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"body"+o},e.createElement("colgroup",null,i.map(function(t,r){return e.createElement("col",{key:r,style:U(t)})})),e.createElement("tbody",{ref:"body"+o+"Content"},n.map(function(t,o){return e.createElement("tr",{key:o,className:l+"-row "+l+"-row--body",onMouseEnter:function(){return r.handleRowEnter(o)},onMouseLeave:function(){return r.handleRowLeave(o)},onClick:function(){return r.handleClickRow(t,o)}},i.map(function(r,o){return e.createElement("td",{key:o,style:r.cellStyle,className:l+"-cell "+l+"-cell--body "+(r.cellClassName||"")},H(r.cell,t,n,r))}))})))},r.prototype.renderVirtualTable=function(t){var r=t.data,o=t.columns,n=this.props.prefixCls;return e.createElement("table",{className:n+"-hidden-layout",ref:"virtualTable"},e.createElement("colgroup",null,o.map(function(t,r){return e.createElement("col",{key:r,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:n+"-row "+n+"-row--header"},o.map(function(r,o){return e.createElement("td",{key:r.dataIndex||o,className:n+"-cell "+n+"-cell--header",style:r.headerStyle},H(r.header,t.data,r))}))),e.createElement("tbody",{ref:"virtualTableBody"},r.map(function(t,i){return e.createElement("tr",{key:i,className:n+"-row "+n+"-row--body"},o.map(function(o,i){return e.createElement("td",{key:i,style:o.cellStyle,className:n+"-cell "+n+"-cell--body "+(o.cellClassName||"")},H(o.cell,t,r,o))}))})))},r.prototype.render=function(){var t=this,r=this.props,o=r.data,n=r.columns,i=r.prefixCls,l=r.style,a=r.className,s=n.slice(),c=n.filter(function(e){return"left"===e.fixed}),d=n.filter(function(e){return"right"===e.fixed}),h=function(e){return{side:e,columns:n,leftColumns:c,rightColumns:d,middleColumns:s,data:o}};return e.createElement("div",{className:i+" "+(a||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,onTouchStart:this.touchStart,onTouchMove:this.handleMove,onTouchEnd:this.touchEnd,style:Object.assign({visibility:"hidden"},l)},e.createElement("div",{ref:"scrollX",className:i+"-scrollx",onScroll:function(){return t.scrollByOffset(0,0)}},e.createElement("div",{className:i+"__header",ref:"header"},this.renderHeaderSideOf(h("Middle"))),e.createElement("div",{className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},this.renderBodySideOf(h("Middle")),this.renderVirtualTable(h("virtual")))),!!c.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--left"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Left"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Left")))),!!d.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--right"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Right"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Right")))),e.createElement("div",{className:i+"__vscroll",ref:"vScrollPanel",onMouseDown:this.vScrollPanelMouseDown,onTouchStart:this.vScrollPanelMouseDown},e.createElement("div",{ref:"vScrollBar",className:i+"__vscroll__bar",onMouseDown:this.verticalMoveStart,onTouchStart:this.verticalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown,onTouchStart:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",className:i+"__hscroll__bar",onMouseDown:this.horizontalMoveStart,onTouchStart:this.horizontalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),this.props.children)},r}(e.Component);J.propTypes={columns:x.arrayOf(x.shape({header:x.oneOfType([x.string,x.number,x.func,x.element]).isRequired,cell:x.oneOfType([x.string,x.number,x.func,x.element]).isRequired,width:x.number,minWidth:Z,maxWidth:Z,fixed:x.oneOf(["left","right"]),headerClassName:x.string,cellClassName:x.string,headerStyle:x.obj,cellStyle:x.obj})),data:x.array.isRequired,prefixCls:x.string.isRequired,onRowClick:x.func},J.defaultProps={prefixCls:"rb-table",data:[]};return function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}('.rb-table{overflow:hidden;position:relative;background:#fff;color:#333;box-sizing:border-box;border:1px solid #e8e8e8;touch-action:none!important}.rb-table table{width:100%;border-spacing:0;font-size:12px;table-layout:fixed;border:none;word-break:break-all}.rb-table-scrollx{position:relative;overflow-x:scroll;overflow-y:hidden;padding-bottom:99999px;touch-action:none!important}.rb-table__body{overflow-y:scroll;overflow-x:hidden;touch-action:none!important;box-sizing:border-box}.rb-table__body .rb-table-hidden-layout{position:fixed;visibility:hidden;top:1000000px;width:-webkit-max-content;width:-moz-max-content;width:max-content;table-layout:auto}.rb-table-fixed{overflow:hidden;position:absolute;top:0;background:#fff}.rb-table-fixed table{width:auto}.rb-table-fixed__body{overflow:hidden}.rb-table-fixed--left{left:0;border-right:1px solid #e8e8e8}.rb-table-fixed--right{right:0;border:1px solid #e8e8e8;border-width:0 1px}.rb-table-row--hover{background-color:#fafafa}.rb-table-row--clickable{cursor:pointer}.rb-table-cell{padding:14px 10px;border-bottom:1px solid #e8e8e8;font-size:12px}.rb-table__hscroll{visibility:hidden;position:absolute;box-sizing:border-box;left:0;bottom:0;right:14px;background:#f9f9f9;height:14px;z-index:1}.rb-table__hscroll__bar{padding:3px 0;height:100%;box-sizing:border-box;touch-action:none!important}.rb-table__hscroll__bar:before{content:"";display:block;background:#bfbfbf;border-radius:14px;height:100%;width:100%}.rb-table__hscroll__bar:hover:before{background:#7f7f7f}.rb-table__vscroll{visibility:hidden;position:absolute;box-sizing:border-box;background:#f9f9f9;top:0;bottom:3px;right:0;width:14px;z-index:1}.rb-table__vscroll__bar{padding:0 3px;touch-action:none!important}.rb-table__vscroll__bar:before{content:"";display:block;background:#bfbfbf;border-radius:14px;height:100%;width:100%}.rb-table__vscroll__bar:hover:before{background:#7f7f7f}.rb-table-fixed--left .rb-table-cell:first-child,.rb-table-scrollx .rb-table-cell:first-child{padding-left:30px}.rb-table-fixed--right .rb-table-cell:last-child,.rb-table-scrollx .rb-table-cell:last-child{padding-right:30px}'),J});

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.RBTable=t(e.React)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;10>n;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}();var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function i(){}var l,a,s,c,d,h,u,f,p,m,y,v,w,b,_,g,E=(function(e){e.exports=function(){function e(e,t,n,r,i,l){if(l!==o){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=i,n.PropTypes=n,n}()}(l={exports:{}},l.exports),l.exports),S=!1;function x(){if(!S){S=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),n=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(w=/\b(iPhone|iP[ao]d)/.exec(e),b=/\b(iP[ao]d)/.exec(e),y=/Android/i.exec(e),_=/FBAN\/\w+;/i.exec(e),g=/Mobile/i.exec(e),v=!!/Win64/.exec(e),t){(a=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(a=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);u=r?parseFloat(r[1])+4:a,s=t[2]?parseFloat(t[2]):NaN,c=t[3]?parseFloat(t[3]):NaN,(d=t[4]?parseFloat(t[4]):NaN)?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),h=t&&t[1]?parseFloat(t[1]):NaN):h=NaN}else a=s=c=h=d=NaN;if(n){if(n[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);f=!o||parseFloat(o[1].replace("_","."))}else f=!1;p=!!n[2],m=!!n[3]}else f=p=m=!1}}var M,O={ie:function(){return x()||a},ieCompatibilityMode:function(){return x()||u>a},ie64:function(){return O.ie()&&v},firefox:function(){return x()||s},opera:function(){return x()||c},webkit:function(){return x()||d},safari:function(){return O.webkit()},chrome:function(){return x()||h},windows:function(){return x()||p},osx:function(){return x()||f},linux:function(){return x()||m},iphone:function(){return x()||w},mobile:function(){return x()||w||b||y||g},nativeApp:function(){return x()||_},android:function(){return x()||y},ipad:function(){return x()||b}},T=O,R=!("undefined"==typeof window||!window.document||!window.document.createElement),N={canUseDOM:R,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:R&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:R&&!!window.screen,isInWorker:!R};N.canUseDOM&&(M=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var C=function(e,t){if(!N.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var o=document.createElement("div");o.setAttribute(n,"return;"),r="function"==typeof o[n]}return!r&&M&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r},D=10,z=40,L=800;function P(e){var t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=t*D,o=n*D,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1==e.deltaMode?(r*=z,o*=z):(r*=L,o*=L)),r&&!t&&(t=1>r?-1:1),o&&!n&&(n=1>o?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:o}}P.getEventType=function(){return T.firefox()?"DOMMouseScroll":C("wheel")?"wheel":"mousewheel"};var k,W,X=P,B=navigator.userAgent.match(/Trident/),j=(k=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return k(e)}),F=(W=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return W(e)});function q(e){var t=e.target||e.srcElement;t.__resizeRAF__&&F(t.__resizeRAF__),t.__resizeRAF__=j(function(){var n=t.__resizeTrigger__;n.__resizeListeners__.forEach(function(t){t.call(n,e)})})}function A(){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",q)}function I(e,t){if(!e.__resizeListeners__){e.__resizeListeners__=[];var n=e.__resizeTrigger__=document.createElement("object");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),n.__resizeElement__=e,n.onload=A,n.type="text/html",B&&e.appendChild(n),n.data="about:blank",B||e.appendChild(n)}e.__resizeListeners__.push(t)}function Y(e,t){var n={};for(var r in e)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function H(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];if(t)return"string"==typeof t||"number"==typeof t?t:"function"==typeof t?t.apply(void 0,r):e.isValidElement(t)?e.cloneElement(t,{tablecontext:r}):void 0}function U(e){return e.width?{width:e.width}:null}function V(e){return e?e+"px":e}function G(e,t){e.style.height=t}function K(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.touches,n=e.clientX,r=e.clientY;if(t&&t.length>0){var o=t[0];n=o.clientX,r=o.clientY}return{clientX:n,clientY:r}}function Z(e,t,n){return e.width&&e[t]?Error(n+".column."+t+" will not take effect when column.width is set."):"maxWidth"===t&&e.minWidth>e.maxWidth?Error(n+".column.maxWidth is smaller then column.minWidth"):void 0}var J=function(t){function n(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var r=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.call(this,e));return r.setTableRef=r.setTableRef.bind(r),r.handleResize=r.handleResize.bind(r),r.handleScroll=r.handleScroll.bind(r),r.handleClickRow=r.handleClickRow.bind(r),r.handleMoveEnd=r.handleMoveEnd.bind(r),r.handleMove=r.handleMove.bind(r),r.hScrollPanelMouseDown=r.hScrollPanelMouseDown.bind(r),r.vScrollPanelMouseDown=r.vScrollPanelMouseDown.bind(r),r.horizontalMoveStart=r.horizontalMoveStart.bind(r),r.verticalMoveStart=r.verticalMoveStart.bind(r),r.touchStart=r.touchStart.bind(r),r.touchEnd=r.touchEnd.bind(r),r}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)}(n,t),n.prototype.componentWillUnmount=function(){I(this.table,this.handleResize),window.removeEventListener("mousemove",this.handleMove),window.removeEventListener("mouseup",this.handleMoveEnd)},n.prototype.componentDidMount=function(){var e=this;window.addEventListener("mousemove",this.handleMove),window.addEventListener("mouseup",this.handleMoveEnd),setTimeout(function(){e.reflow()})},n.prototype.setTableRef=function(e){var t,n;e&&(this.table&&(n=this.handleResize,(t=this.table).__resizeListeners__&&(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(n),1),t.__resizeListeners__.length||(t.__resizeTrigger__.contentDocument.defaultView.removeEventListener("resize",q),t.__resizeTrigger__=!t.removeChild(t.__resizeTrigger__)))),this.table=e,I(e,this.handleResize))},n.prototype.componentDidUpdate=function(){this.reflow()},n.prototype.handleResize=function(){this.reflow()},n.prototype.reflow=function(){this.refs.virtualTable&&this.refs.body&&(this.alignTable(),this.scrollByOffset(0,0),this.table.style.visibility="visible")},n.prototype.handleScroll=function(e){var t=X(e),n=t.pixelY,r=t.pixelX;n=Math.round(.5*n),this.scrollByOffset(r=Math.round(.5*r),n).hasOffset&&(this.autoSize||e.preventDefault(),e.stopPropagation())},n.prototype.handleClickRow=function(e,t){this.props.onRowClick&&this.props.onRowClick(e,t)},n.prototype.setLocation=function(e){var t=e.clientY;this.x=e.clientX,this.y=t},n.prototype.handleMoveEnd=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1,this.touchIsStarted=!1},n.prototype.handleMove=function(e){var t=K(e),n=t.clientX,r=t.clientY;this.mouseIsDownBottom?this.move({clientX:n,clientY:this.y}):this.mouseIsDownRight?this.move({clientX:this.x,clientY:r}):this.touchIsStarted&&(e.preventDefault(),this.move({clientX:n,clientY:r},-1))},n.prototype.move=function(e){var t=e.clientX,n=e.clientY,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=t-this.x,i=n-this.y;this.setLocation({clientX:t,clientY:n}),this.scrollByOffset(r*o,r*i)},n.prototype.touchStart=function(e){this.touchIsStarted=!0,this.setLocation(K(e))},n.prototype.touchEnd=function(e){this.touchIsStarted=!1},n.prototype.hScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.hScrollBar.getBoundingClientRect(),n=t.left,r=t.right,o=K(e).clientX-.5*(n+r);this.scrollByOffset(o,0)}},n.prototype.vScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.vScrollBar.getBoundingClientRect(),n=t.top,r=t.bottom,o=K(e).clientY-.5*(n+r);this.scrollByOffset(0,o)}},n.prototype.horizontalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(K(e)))},n.prototype.verticalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(K(e)))},n.prototype.getHoverClass=function(){var e=this.props.prefixCls,t=" "+e+"-row--hover";return this.props.onRowClick&&(t+=e+"-row--clickable"),t},n.prototype.bodies=function(){var e=this.refs;return[e.bodyMiddleContent,e.bodyLeftContent,e.bodyRightContent].filter(function(e){return!!e})},n.prototype.handleRowEnter=function(e){var t=this;this.bodies().forEach(function(n){return n.children[e].className+=t.getHoverClass()})},n.prototype.handleRowLeave=function(e){var t=this;this.bodies().forEach(function(n){return n.children[e].className=n.children[e].className.replace(t.getHoverClass(),"")})},n.prototype.getTableWidthHeight=function(){var e=this.refs,t=e.virtualTable,n=e.scrollX,r=[],o=[];t.style.width="",n.clientWidth-this.props.columns.length>t.offsetWidth&&(t.style.width=V(n.clientWidth-this.props.columns.length));var i=t.querySelector("thead > tr"),l=t.querySelector("colgroup");function a(){for(var e=0;i.children.length>e;e++)r[e]=i.children[e].offsetWidth+1}return this.props.columns.forEach(function(e,t){l.children[t].style.width=V(e.width||"")}),a(),this.props.columns.forEach(function(e,t){var n=e.width,o=e.minWidth,i=e.maxWidth;(i||o)&&(n=r[t],n=Math.min(i||n,n),l.children[t].style.width=V(n=Math.max(o||n,n)))}),a(),t.querySelectorAll("tbody > tr").forEach(function(e,t){o[t]=e.offsetHeight}),{columnWs:r,rowHs:o}},n.prototype.alignTable=function(){var e=this,t=this.refs,n=t.headerLeft,r=t.headerRight,o=t.body,i=this.props.columns,l=[n,r].filter(function(e){return!!e});l.forEach(function(e){G(e.querySelector("tr"),"")});var a=this.getTableWidthHeight(),s=a.columnWs,c=a.rowHs,d=this.refs.virtualTable.querySelector("thead > tr").clientHeight,h=this.table.clientHeight,u=this.refs.hScrollPanel.offsetHeight,f=this.refs.bodyMiddle.querySelector("colgroup"),p=this.refs.headerMiddle.querySelector("colgroup"),m=0,y=0;s.forEach(function(t,o){var l=V(t);m+=t,f.children[o].style.width=l,p.children[o].style.width=l,i[o].width||("left"===i[o].fixed?(n.querySelector("colgroup").children[o].style.width=l,e.refs.bodyLeft.querySelector("colgroup").children[o].style.width=l):"right"===i[o].fixed&&(r.querySelector("colgroup").children[y].style.width=l,e.refs.bodyRight.querySelector("colgroup").children[y].style.width=l,y++))});var v,w,b=this.refs.scrollX.clientWidth;this.refs.scrollX.style.overflowX=m>b?"scroll":"hidden",v=this.refs.header,w=V(m=Math.max(m,b)),v.style.width=w,o.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:300+o.offsetWidth-o.clientWidth));var _=this.refs.header.offsetHeight;(this.refs.header.style.height=V(_),l.forEach(function(e){G(e.querySelector("tr"),V(d)),G(e.parentElement,V(_))}),this.bodies().forEach(function(e){!function(e,t){for(var n=0;e.children.length>n;n++)t(e.children[n],n)}(e,function(e,t){return G(e,V(c[t]))})}),h>99999||this.autoSize)?(this.autoSize=!0,o.style.width=V(this.refs.header.clientWidth),this.refs.scrollX.style.paddingBottom=0,this.refs.scrollX.style.overflowX="auto",this.refs.body.style.paddingRight=0,this.refs.body.style.overflowY="hidden"):this.refs.body.style.height=V(h-_-u)},n.prototype.scrollByOffset=function(e,t){var n=this.refs,r=n.bodyMiddle,o=n.hScrollBar,i=n.hScrollPanel,l=n.vScrollBar,a=n.vScrollPanel;if(r){var s=this.refs.scrollX.offsetWidth,c=this.refs.body.clientHeight,d=r.offsetWidth,h=r.offsetHeight,u=1,f=1;if(!this.autoSize&&h>c||(a.style.visibility="hidden",l=null,a=null),!this.autoSize&&d>s||(i.style.visibility="hidden",o=null,i=null),o){var p=i.offsetWidth,m=Math.max(p*s/d,20);u=(d-s)/(p-m)}if(l){var y=a.offsetHeight,v=Math.max(y*c/h,20);f=(h-c)/(y-v)}var w=this.refs.scrollX.scrollLeft+(e*=u),b=this.refs.body.scrollTop+(t*=f),_=!0;if(w>d-s&&(w=d-s,_=!1),0>w&&(w=0,_=!1),b>h-c&&(b=h-c,_=!1),0>b&&(b=0,_=!1),this.refs.body.scrollTop=b,this.refs.scrollX.scrollLeft=w,o)i.style.visibility="visible",o.style.width=Math.round(m)+"px",o.style.transform="translateX("+Math.round(w/u)+"px)";if(E(this.refs.bodyLeft,w),E(this.refs.bodyRight,w-d+s),l){var g=Math.round(b/f);a.style.visibility="visible",l.style.height=Math.round(v)+"px",l.style.transform="translateY("+g+"px)"}return{hasOffset:_}}function E(e,t){e&&(0===t&&e?e.parentElement.parentElement.style.display="none":(e.parentElement.parentElement.style.display="block",e.style.transform="translateY("+-b+"px)"))}},n.prototype.renderHeaderSideOf=function(t){var n=t.side,r=Y(t,["side"]),o=n.toLowerCase(),i=r[o+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"header"+n},e.createElement("colgroup",null,i.map(function(t,n){return e.createElement("col",{key:n,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:l+"-row "+l+"-row--header"},i.map(function(t,n){return e.createElement("td",{key:t.dataIndex||n,className:l+"-cell "+l+"-cell--header "+(t.headerClassName||""),style:t.headerStyle},H(t.header,r.data,t))}))))},n.prototype.renderBodySideOf=function(t){var n=this,r=t.side,o=t.data,i=Y(t,["side","data"])[r.toLowerCase()+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"body"+r},e.createElement("colgroup",null,i.map(function(t,n){return e.createElement("col",{key:n,style:U(t)})})),e.createElement("tbody",{ref:"body"+r+"Content"},o.map(function(t,r){return e.createElement("tr",{key:r,className:l+"-row "+l+"-row--body",onMouseEnter:function(){return n.handleRowEnter(r)},onMouseLeave:function(){return n.handleRowLeave(r)},onClick:function(){return n.handleClickRow(t,r)}},i.map(function(n,r){return e.createElement("td",{key:r,style:n.cellStyle,className:l+"-cell "+l+"-cell--body "+(n.cellClassName||"")},H(n.cell,t,o,n))}))})))},n.prototype.renderVirtualTable=function(t){var n=t.data,r=t.columns,o=this.props.prefixCls;return e.createElement("table",{className:o+"-hidden-layout",ref:"virtualTable"},e.createElement("colgroup",null,r.map(function(t,n){return e.createElement("col",{key:n,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:o+"-row "+o+"-row--header"},r.map(function(n,r){return e.createElement("td",{key:n.dataIndex||r,className:o+"-cell "+o+"-cell--header",style:n.headerStyle},H(n.header,t.data,n))}))),e.createElement("tbody",{ref:"virtualTableBody"},n.map(function(t,i){return e.createElement("tr",{key:i,className:o+"-row "+o+"-row--body"},r.map(function(r,i){return e.createElement("td",{key:i,style:r.cellStyle,className:o+"-cell "+o+"-cell--body "+(r.cellClassName||"")},H(r.cell,t,n,r))}))})))},n.prototype.render=function(){var t=this,n=this.props,r=n.data,o=n.columns,i=n.prefixCls,l=n.style,a=n.className,s=o.slice(),c=o.filter(function(e){return"left"===e.fixed}),d=o.filter(function(e){return"right"===e.fixed}),h=function(e){return{side:e,columns:o,leftColumns:c,rightColumns:d,middleColumns:s,data:r}};return e.createElement("div",{className:i+" "+(a||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,onTouchStart:this.touchStart,onTouchMove:this.handleMove,onTouchEnd:this.touchEnd,style:Object.assign({visibility:"hidden"},l)},e.createElement("div",{ref:"scrollX",className:i+"-scrollx",onScroll:function(){return t.scrollByOffset(0,0)}},e.createElement("div",{className:i+"__header",ref:"header"},this.renderHeaderSideOf(h("Middle"))),e.createElement("div",{className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},this.renderBodySideOf(h("Middle")),this.renderVirtualTable(h("virtual")))),!!c.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--left"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Left"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Left")))),!!d.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--right"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Right"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Right")))),e.createElement("div",{className:i+"__vscroll",ref:"vScrollPanel",onMouseDown:this.vScrollPanelMouseDown,onTouchStart:this.vScrollPanelMouseDown},e.createElement("div",{ref:"vScrollBar",className:i+"__vscroll__bar",onMouseDown:this.verticalMoveStart,onTouchStart:this.verticalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown,onTouchStart:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",className:i+"__hscroll__bar",onMouseDown:this.horizontalMoveStart,onTouchStart:this.horizontalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),this.props.children)},n}(e.Component);return J.propTypes={columns:E.arrayOf(E.shape({header:E.oneOfType([E.string,E.number,E.func,E.element]).isRequired,cell:E.oneOfType([E.string,E.number,E.func,E.element]).isRequired,width:E.number,minWidth:Z,maxWidth:Z,fixed:E.oneOf(["left","right"]),headerClassName:E.string,cellClassName:E.string,headerStyle:E.obj,cellStyle:E.obj})),data:E.array.isRequired,prefixCls:E.string.isRequired,onRowClick:E.func},J.defaultProps={prefixCls:"rb-table",data:[]},J});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.RBTable=t(e.React)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;10>n;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}();var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function i(){}var l,a,s,c,d,h,u,f,p,m,y,v,w,b,_,g,E=(function(e){e.exports=function(){function e(e,t,n,r,i,l){if(l!==o){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=i,n.PropTypes=n,n}()}(l={exports:{}},l.exports),l.exports),S=!1;function x(){if(!S){S=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),n=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(w=/\b(iPhone|iP[ao]d)/.exec(e),b=/\b(iP[ao]d)/.exec(e),y=/Android/i.exec(e),_=/FBAN\/\w+;/i.exec(e),g=/Mobile/i.exec(e),v=!!/Win64/.exec(e),t){(a=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(a=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);u=r?parseFloat(r[1])+4:a,s=t[2]?parseFloat(t[2]):NaN,c=t[3]?parseFloat(t[3]):NaN,(d=t[4]?parseFloat(t[4]):NaN)?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),h=t&&t[1]?parseFloat(t[1]):NaN):h=NaN}else a=s=c=h=d=NaN;if(n){if(n[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);f=!o||parseFloat(o[1].replace("_","."))}else f=!1;p=!!n[2],m=!!n[3]}else f=p=m=!1}}var M,O={ie:function(){return x()||a},ieCompatibilityMode:function(){return x()||u>a},ie64:function(){return O.ie()&&v},firefox:function(){return x()||s},opera:function(){return x()||c},webkit:function(){return x()||d},safari:function(){return O.webkit()},chrome:function(){return x()||h},windows:function(){return x()||p},osx:function(){return x()||f},linux:function(){return x()||m},iphone:function(){return x()||w},mobile:function(){return x()||w||b||y||g},nativeApp:function(){return x()||_},android:function(){return x()||y},ipad:function(){return x()||b}},T=O,R=!("undefined"==typeof window||!window.document||!window.document.createElement),N={canUseDOM:R,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:R&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:R&&!!window.screen,isInWorker:!R};N.canUseDOM&&(M=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var C=function(e,t){if(!N.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var o=document.createElement("div");o.setAttribute(n,"return;"),r="function"==typeof o[n]}return!r&&M&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r},D=10,z=40,L=800;function P(e){var t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=t*D,o=n*D,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1==e.deltaMode?(r*=z,o*=z):(r*=L,o*=L)),r&&!t&&(t=1>r?-1:1),o&&!n&&(n=1>o?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:o}}P.getEventType=function(){return T.firefox()?"DOMMouseScroll":C("wheel")?"wheel":"mousewheel"};var k,W,X=P,B=navigator.userAgent.match(/Trident/),j=(k=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return k(e)}),F=(W=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return W(e)});function q(e){var t=e.target||e.srcElement;t.__resizeRAF__&&F(t.__resizeRAF__),t.__resizeRAF__=j(function(){var n=t.__resizeTrigger__;n.__resizeListeners__.forEach(function(t){t.call(n,e)})})}function A(){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",q)}function I(e,t){if(!e.__resizeListeners__){e.__resizeListeners__=[];var n=e.__resizeTrigger__=document.createElement("object");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),n.__resizeElement__=e,n.onload=A,n.type="text/html",B&&e.appendChild(n),n.data="about:blank",B||e.appendChild(n)}e.__resizeListeners__.push(t)}function Y(e,t){var n={};for(var r in e)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function H(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];if(t)return"string"==typeof t||"number"==typeof t?t:"function"==typeof t?t.apply(void 0,r):e.isValidElement(t)?e.cloneElement(t,{tablecontext:r}):void 0}function U(e){return e.width?{width:e.width}:null}function V(e){return e?e+"px":e}function G(e,t){e.style.height=t}function K(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.touches,n=e.clientX,r=e.clientY;if(t&&t.length>0){var o=t[0];n=o.clientX,r=o.clientY}return{clientX:n,clientY:r}}function Z(e,t,n){return e.width&&e[t]?Error(n+".column."+t+" will not take effect when column.width is set."):"maxWidth"===t&&e.minWidth>e.maxWidth?Error(n+".column.maxWidth is smaller then column.minWidth"):void 0}var J=function(t){function n(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var r=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.call(this,e));return r.setTableRef=r.setTableRef.bind(r),r.handleResize=r.handleResize.bind(r),r.handleScroll=r.handleScroll.bind(r),r.handleClickRow=r.handleClickRow.bind(r),r.handleMoveEnd=r.handleMoveEnd.bind(r),r.handleMove=r.handleMove.bind(r),r.hScrollPanelMouseDown=r.hScrollPanelMouseDown.bind(r),r.vScrollPanelMouseDown=r.vScrollPanelMouseDown.bind(r),r.horizontalMoveStart=r.horizontalMoveStart.bind(r),r.verticalMoveStart=r.verticalMoveStart.bind(r),r.touchStart=r.touchStart.bind(r),r.touchEnd=r.touchEnd.bind(r),r}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)}(n,t),n.prototype.componentWillUnmount=function(){I(this.table,this.handleResize),window.removeEventListener("mousemove",this.handleMove),window.removeEventListener("mouseup",this.handleMoveEnd)},n.prototype.componentDidMount=function(){var e=this;window.addEventListener("mousemove",this.handleMove),window.addEventListener("mouseup",this.handleMoveEnd),setTimeout(function(){e.reflow()})},n.prototype.setTableRef=function(e){var t,n;e&&(this.table&&(n=this.handleResize,(t=this.table).__resizeListeners__&&(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(n),1),t.__resizeListeners__.length||(t.__resizeTrigger__.contentDocument.defaultView.removeEventListener("resize",q),t.__resizeTrigger__=!t.removeChild(t.__resizeTrigger__)))),this.table=e,I(e,this.handleResize))},n.prototype.componentDidUpdate=function(){this.reflow()},n.prototype.handleResize=function(){this.reflow()},n.prototype.reflow=function(){this.refs.virtualTable&&this.refs.body&&(this.alignTable(),this.scrollByOffset(0,0),this.table.style.visibility="visible")},n.prototype.handleScroll=function(e){var t=X(e),n=t.pixelY,r=t.pixelX;n=Math.round(.5*n),this.scrollByOffset(r=Math.round(.5*r),n).hasOffset&&(this.autoSize||e.preventDefault(),e.stopPropagation())},n.prototype.handleClickRow=function(e,t){this.props.onRowClick&&this.props.onRowClick(e,t)},n.prototype.setLocation=function(e){var t=e.clientY;this.x=e.clientX,this.y=t},n.prototype.handleMoveEnd=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1,this.touchIsStarted=!1},n.prototype.handleMove=function(e){var t=K(e),n=t.clientX,r=t.clientY;this.mouseIsDownBottom?this.move({clientX:n,clientY:this.y}):this.mouseIsDownRight?this.move({clientX:this.x,clientY:r}):this.touchIsStarted&&(e.preventDefault(),this.move({clientX:n,clientY:r},-1))},n.prototype.move=function(e){var t=e.clientX,n=e.clientY,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=t-this.x,i=n-this.y;this.setLocation({clientX:t,clientY:n}),this.scrollByOffset(r*o,r*i)},n.prototype.touchStart=function(e){this.touchIsStarted=!0,this.setLocation(K(e))},n.prototype.touchEnd=function(e){this.touchIsStarted=!1},n.prototype.hScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.hScrollBar.getBoundingClientRect(),n=t.left,r=t.right,o=K(e).clientX-.5*(n+r);this.scrollByOffset(o,0)}},n.prototype.vScrollPanelMouseDown=function(e){if(1>=e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=this.refs.vScrollBar.getBoundingClientRect(),n=t.top,r=t.bottom,o=K(e).clientY-.5*(n+r);this.scrollByOffset(0,o)}},n.prototype.horizontalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(K(e)))},n.prototype.verticalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(K(e)))},n.prototype.getHoverClass=function(){var e=this.props.prefixCls,t=" "+e+"-row--hover";return this.props.onRowClick&&(t+=e+"-row--clickable"),t},n.prototype.bodies=function(){var e=this.refs;return[e.bodyMiddleContent,e.bodyLeftContent,e.bodyRightContent].filter(function(e){return!!e})},n.prototype.handleRowEnter=function(e){var t=this;this.bodies().forEach(function(n){return n.children[e].className+=t.getHoverClass()})},n.prototype.handleRowLeave=function(e){var t=this;this.bodies().forEach(function(n){return n.children[e].className=n.children[e].className.replace(t.getHoverClass(),"")})},n.prototype.getTableWidthHeight=function(){var e=this.refs,t=e.virtualTable,n=e.scrollX,r=[],o=[];t.style.width="",n.clientWidth-this.props.columns.length>t.offsetWidth&&(t.style.width=V(n.clientWidth-this.props.columns.length));var i=t.querySelector("thead > tr"),l=t.querySelector("colgroup");this.props.columns.forEach(function(e,t){l.children[t].style.width=V(e.width||"")});var a=this;function s(){for(var e=0;i.children.length>e;e++){var t=a.props.columns[e],n=t.width||Math.ceil(i.children[e].offsetWidth),o=t.maxWidth,l=t.minWidth;(o||l)&&(n=Math.min(o||n,n),n=Math.max(l||n,n)),r[e]=n}}return s(),this.props.columns.forEach(function(e,t){var n=e.width,o=e.minWidth,i=e.maxWidth;(i||o)&&(n=r[t],n=Math.min(i||n,n),l.children[t].style.width=V(n=Math.max(o||n,n)))}),s(),t.querySelectorAll("tbody > tr").forEach(function(e,t){o[t]=e.offsetHeight}),{columnWs:r,rowHs:o}},n.prototype.alignTable=function(){var e=this,t=this.refs,n=t.headerLeft,r=t.headerRight,o=t.body,i=this.props.columns,l=[n,r].filter(function(e){return!!e});l.forEach(function(e){G(e.querySelector("tr"),"")});var a=this.getTableWidthHeight(),s=a.columnWs,c=a.rowHs,d=this.refs.virtualTable.querySelector("thead > tr").clientHeight,h=this.table.clientHeight,u=this.refs.hScrollPanel.offsetHeight,f=this.refs.bodyMiddle.querySelector("colgroup"),p=this.refs.headerMiddle.querySelector("colgroup"),m=0,y=0;s.forEach(function(t,o){var l=V(t);m+=t,f.children[o].style.width=l,p.children[o].style.width=l,i[o].width||("left"===i[o].fixed?(n.querySelector("colgroup").children[o].style.width=l,e.refs.bodyLeft.querySelector("colgroup").children[o].style.width=l):"right"===i[o].fixed&&(r.querySelector("colgroup").children[y].style.width=l,e.refs.bodyRight.querySelector("colgroup").children[y].style.width=l,y++))});var v,w,b=this.refs.scrollX.clientWidth;this.refs.scrollX.style.overflowX=m>b?"scroll":"hidden",v=this.refs.header,w=V(m=Math.max(m,b)),v.style.width=w,o.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:o.offsetWidth-o.clientWidth));var _=this.refs.header.offsetHeight;(this.refs.header.style.height=V(_),l.forEach(function(e){G(e.querySelector("tr"),V(d)),G(e.parentElement,V(_))}),this.bodies().forEach(function(e){!function(e,t){for(var n=0;e.children.length>n;n++)t(e.children[n],n)}(e,function(e,t){return G(e,V(c[t]))})}),h>99999||this.autoSize)?(this.autoSize=!0,o.style.width=V(this.refs.header.clientWidth),this.refs.scrollX.style.paddingBottom=0,this.refs.scrollX.style.overflowX="auto",this.refs.body.style.paddingRight=0,this.refs.body.style.overflowY="hidden"):this.refs.body.style.height=V(h-_-u)},n.prototype.scrollByOffset=function(e,t){var n=this.refs,r=n.bodyMiddle,o=n.hScrollBar,i=n.hScrollPanel,l=n.vScrollBar,a=n.vScrollPanel;if(r){var s=this.refs.scrollX.offsetWidth,c=this.refs.body.clientHeight,d=r.offsetWidth,h=r.offsetHeight,u=1,f=1;if(!this.autoSize&&h>c||(a.style.visibility="hidden",l=null,a=null),!this.autoSize&&d>s||(i.style.visibility="hidden",o=null,i=null),o){var p=i.offsetWidth,m=Math.max(p*s/d,20);u=(d-s)/(p-m)}if(l){var y=a.offsetHeight,v=Math.max(y*c/h,20);f=(h-c)/(y-v)}var w=this.refs.scrollX.scrollLeft+(e*=u),b=this.refs.body.scrollTop+(t*=f),_=!0;if(w>d-s&&(w=d-s,_=!1),0>w&&(w=0,_=!1),b>h-c&&(b=h-c,_=!1),0>b&&(b=0,_=!1),this.refs.body.scrollTop=b,this.refs.scrollX.scrollLeft=w,o)i.style.visibility="visible",o.style.width=Math.round(m)+"px",o.style.transform="translateX("+Math.round(w/u)+"px)";if(E(this.refs.bodyLeft,w),E(this.refs.bodyRight,w-d+s),l){var g=Math.round(b/f);a.style.visibility="visible",l.style.height=Math.round(v)+"px",l.style.transform="translateY("+g+"px)"}return{hasOffset:_}}function E(e,t){e&&(0===t&&e?e.parentElement.parentElement.style.display="none":(e.parentElement.parentElement.style.display="block",e.style.transform="translateY("+-b+"px)"))}},n.prototype.renderHeaderSideOf=function(t){var n=t.side,r=Y(t,["side"]),o=n.toLowerCase(),i=r[o+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"header"+n},e.createElement("colgroup",null,i.map(function(t,n){return e.createElement("col",{key:n,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:l+"-row "+l+"-row--header"},i.map(function(t,n){return e.createElement("td",{key:t.dataIndex||n,className:l+"-cell "+l+"-cell--header "+(t.headerClassName||""),style:t.headerStyle},H(t.header,r.data,t))}))))},n.prototype.renderBodySideOf=function(t){var n=this,r=t.side,o=t.data,i=Y(t,["side","data"])[r.toLowerCase()+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"body"+r},e.createElement("colgroup",null,i.map(function(t,n){return e.createElement("col",{key:n,style:U(t)})})),e.createElement("tbody",{ref:"body"+r+"Content"},o.map(function(t,r){return e.createElement("tr",{key:r,className:l+"-row "+l+"-row--body",onMouseEnter:function(){return n.handleRowEnter(r)},onMouseLeave:function(){return n.handleRowLeave(r)},onClick:function(){return n.handleClickRow(t,r)}},i.map(function(n,r){return e.createElement("td",{key:r,style:n.cellStyle,className:l+"-cell "+l+"-cell--body "+(n.cellClassName||"")},H(n.cell,t,o,n))}))})))},n.prototype.renderVirtualTable=function(t){var n=t.data,r=t.columns,o=this.props.prefixCls;return e.createElement("table",{className:o+"-hidden-layout",ref:"virtualTable"},e.createElement("colgroup",null,r.map(function(t,n){return e.createElement("col",{key:n,style:U(t)})})),e.createElement("thead",null,e.createElement("tr",{className:o+"-row "+o+"-row--header"},r.map(function(n,r){return e.createElement("td",{key:n.dataIndex||r,className:o+"-cell "+o+"-cell--header",style:n.headerStyle},H(n.header,t.data,n))}))),e.createElement("tbody",{ref:"virtualTableBody"},n.map(function(t,i){return e.createElement("tr",{key:i,className:o+"-row "+o+"-row--body"},r.map(function(r,i){return e.createElement("td",{key:i,style:r.cellStyle,className:o+"-cell "+o+"-cell--body "+(r.cellClassName||"")},H(r.cell,t,n,r))}))})))},n.prototype.render=function(){var t=this,n=this.props,r=n.data,o=n.columns,i=n.prefixCls,l=n.style,a=n.className,s=o.slice(),c=o.filter(function(e){return"left"===e.fixed}),d=o.filter(function(e){return"right"===e.fixed}),h=function(e){return{side:e,columns:o,leftColumns:c,rightColumns:d,middleColumns:s,data:r}};return e.createElement("div",{className:i+" "+(a||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,onTouchStart:this.touchStart,onTouchMove:this.handleMove,onTouchEnd:this.touchEnd,style:Object.assign({visibility:"hidden"},l)},e.createElement("div",{ref:"scrollX",className:i+"-scrollx",onScroll:function(){return t.scrollByOffset(0,0)}},e.createElement("div",{className:i+"__header",ref:"header"},this.renderHeaderSideOf(h("Middle"))),e.createElement("div",{className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},this.renderBodySideOf(h("Middle")),this.renderVirtualTable(h("virtual")))),!!c.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--left"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Left"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Left")))),!!d.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--right"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(h("Right"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(h("Right")))),e.createElement("div",{className:i+"__vscroll",ref:"vScrollPanel",onMouseDown:this.vScrollPanelMouseDown,onTouchStart:this.vScrollPanelMouseDown},e.createElement("div",{ref:"vScrollBar",className:i+"__vscroll__bar",onMouseDown:this.verticalMoveStart,onTouchStart:this.verticalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown,onTouchStart:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",className:i+"__hscroll__bar",onMouseDown:this.horizontalMoveStart,onTouchStart:this.horizontalMoveStart,onTouchMove:this.handleMove,onTouchEnd:this.handleMoveEnd})),this.props.children)},n}(e.Component);return J.propTypes={columns:E.arrayOf(E.shape({header:E.oneOfType([E.string,E.number,E.func,E.element]).isRequired,cell:E.oneOfType([E.string,E.number,E.func,E.element]).isRequired,width:E.number,minWidth:Z,maxWidth:Z,fixed:E.oneOf(["left","right"]),headerClassName:E.string,cellClassName:E.string,headerStyle:E.obj,cellStyle:E.obj})),data:E.array.isRequired,prefixCls:E.string.isRequired,onRowClick:E.func},J.defaultProps={prefixCls:"rb-table",data:[]},J});

@@ -369,2 +369,3 @@ import React from 'react';

var me = this;
// 获取列宽

@@ -374,5 +375,16 @@ function getColumnWs() {

// add 1 for firfox -mox-max-content use decimal, when offsetWidth is floor will cause column break into 2 lines.
columnWs[i] = headerRow.children[i].offsetWidth + 1;
var column = me.props.columns[i];
var width = column.width || Math.ceil(headerRow.children[i].offsetWidth);
var maxWidth = column.maxWidth,
minWidth = column.minWidth;
if (maxWidth || minWidth) {
width = Math.min(maxWidth || width, width);
width = Math.max(minWidth || width, width);
}
columnWs[i] = width;
}
}
getColumnWs();

@@ -465,3 +477,3 @@

// 设置 body 宽度,用来隐藏滚动条
body.style.width = px(this.refs.header.clientWidth + (this.autoSize ? 0 : 300 + body.offsetWidth - body.clientWidth));
body.style.width = px(this.refs.header.clientWidth + (this.autoSize ? 0 : body.offsetWidth - body.clientWidth));

@@ -558,2 +570,4 @@ var headerHeight = this.refs.header.offsetHeight;

}
// console.log(this.refs.scrollX.scrollLeft, offsetX, contentWidth - bodyWidth, contentWidth, bodyWidth);
this.refs.body.scrollTop = top;

@@ -560,0 +574,0 @@ this.refs.scrollX.scrollLeft = left;

@@ -373,2 +373,3 @@ 'use strict';

var me = this;
// 获取列宽

@@ -378,5 +379,16 @@ function getColumnWs() {

// add 1 for firfox -mox-max-content use decimal, when offsetWidth is floor will cause column break into 2 lines.
columnWs[i] = headerRow.children[i].offsetWidth + 1;
var column = me.props.columns[i];
var width = column.width || Math.ceil(headerRow.children[i].offsetWidth);
var maxWidth = column.maxWidth,
minWidth = column.minWidth;
if (maxWidth || minWidth) {
width = Math.min(maxWidth || width, width);
width = Math.max(minWidth || width, width);
}
columnWs[i] = width;
}
}
getColumnWs();

@@ -469,3 +481,3 @@

// 设置 body 宽度,用来隐藏滚动条
body.style.width = px(this.refs.header.clientWidth + (this.autoSize ? 0 : 300 + body.offsetWidth - body.clientWidth));
body.style.width = px(this.refs.header.clientWidth + (this.autoSize ? 0 : body.offsetWidth - body.clientWidth));

@@ -562,2 +574,4 @@ var headerHeight = this.refs.header.offsetHeight;

}
// console.log(this.refs.scrollX.scrollLeft, offsetX, contentWidth - bodyWidth, contentWidth, bodyWidth);
this.refs.body.scrollTop = top;

@@ -564,0 +578,0 @@ this.refs.scrollX.scrollLeft = left;

{
"name": "rb-table",
"version": "1.0.16",
"version": "1.0.17",
"description": "High performance table with fixed columns and header support",

@@ -80,4 +80,4 @@ "main": "lib/rb-table.js",

"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
"webpack-dev-server": "^3.1.14"
}
}

@@ -120,4 +120,5 @@ import React from 'react'

pixelX = Math.round(pixelX * .5);
const { hasOffset } = this.scrollByOffset(pixelX, pixelY);
if (hasOffset) {

@@ -128,3 +129,3 @@ if (!this.autoSize) {

e.stopPropagation();
}
}
}

@@ -254,9 +255,20 @@

var me = this;
// 获取列宽
function getColumnWs() {
for (let i = 0; i < headerRow.children.length; i++) {
for (var i = 0; i < headerRow.children.length; i++) {
// add 1 for firfox -mox-max-content use decimal, when offsetWidth is floor will cause column break into 2 lines.
columnWs[i] = headerRow.children[i].offsetWidth + 1;
const column = me.props.columns[i]
let width = column.width || Math.ceil(headerRow.children[i].offsetWidth);
const { maxWidth, minWidth } = column
if (maxWidth || minWidth) {
width = Math.min(maxWidth || width, width);
width = Math.max(minWidth || width, width);
}
columnWs[i] = width;
}
}
getColumnWs();

@@ -333,3 +345,3 @@

// 设置 body 宽度,用来隐藏滚动条
body.style.width = px(this.refs.header.clientWidth + (this.autoSize ? 0 : (300 + body.offsetWidth - body.clientWidth)));
body.style.width = px(this.refs.header.clientWidth + (this.autoSize ? 0 : (body.offsetWidth - body.clientWidth)));

@@ -420,2 +432,4 @@ let headerHeight = this.refs.header.offsetHeight;

}
// console.log(this.refs.scrollX.scrollLeft, offsetX, contentWidth - bodyWidth, contentWidth, bodyWidth);
this.refs.body.scrollTop = top;

@@ -662,2 +676,2 @@ this.refs.scrollX.scrollLeft = left;

data: []
}
}

Sorry, the diff of this file is not supported yet

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

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 not supported yet

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 not supported yet

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 not supported yet

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 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