text: !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,P=800;function L(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*=P,o*=P)),r&&!t&&(t=1>r?-1:1),o&&!n&&(n=1>o?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:o}}L.getEventType=function(){return T.firefox()?"DOMMouseScroll":C("wheel")?"wheel":"mousewheel"};var k,W,X=L,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 H(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)}var I=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};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 U(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 V(e){return e.width?{width:e.width}:null}function G(e){return e?e+"px":e}function K(e,t){e.style.height=t}function Z(){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 J(e){e.preventDefault()}function Q(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 $=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(){H(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,H(e,this.handleResize))},n.prototype.componentDidUpdate=function(){this.reflow()},n.prototype.handleResize=function(){this.reflow()},n.prototype.reflow=function(){this.alignTable(),this.scrollByOffset(0,0)},n.prototype.handleScroll=function(e){if(!this.autoSize){var t=X(e),n=t.pixelY,r=t.pixelX;n=Math.round(.5*n);var o=this.scrollByOffset(r=Math.round(.5*r),n).hasOffset;this.autoSize||e.preventDefault(),o&&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=Z(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(Z(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=Z(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=Z(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(Z(e)))},n.prototype.verticalMoveStart=function(e){e.nativeEvent.which>1||(e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(Z(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=G(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=G(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=G(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){K(e.querySelector("tr"),"")});var a,s,c=this.getTableWidthHeight(),d=c.columnWs,h=c.rowHs,u=this.refs.virtualTable.querySelector("thead > tr").clientHeight,f=this.table.clientHeight,p=this.refs.hScrollPanel.offsetHeight,m=this.refs.bodyMiddle.querySelector("colgroup"),y=this.refs.headerMiddle.querySelector("colgroup"),v=0,w=0;d.forEach(function(t,o){var l=G(t);v+=t,m.children[o].style.width=l,y.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[w].style.width=l,e.refs.bodyRight.querySelector("colgroup").children[w].style.width=l,w++))}),a=this.refs.header,s=G(v=Math.max(v,this.refs.scrollX.clientWidth)),a.style.width=s,o.style.width=G(this.refs.header.clientWidth+(this.autoSize?0:300+o.offsetWidth-o.clientWidth));var b=this.refs.header.offsetHeight;(l.forEach(function(e){K(e.querySelector("tr"),G(u)),K(e.parentElement,G(b))}),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 K(e,G(h[t]))})}),f>99999||this.autoSize)?(this.autoSize=!0,o.style.width=G(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.table.style.height=G(this.refs.scrollX.offsetHeight)):this.refs.body.style.height=G(f-b-p)},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(!this.table||this.autoSize)return i.style.visibility="hidden",void(a.style.visibility="hidden");if(r){var s=this.refs.scrollX.offsetWidth,c=this.refs.body.clientHeight,d=r.offsetWidth,h=r.offsetHeight,u=1,f=1;if(h>c||(a.style.visibility="hidden",l=null,a=null),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:V(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},U(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:V(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||"")},U(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:V(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},U(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||"")},U(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}},u={onTouchStart:J,onTouchMove:J};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:l},e.createElement("div",I({ref:"scrollX",className:i+"-scrollx",onScroll:function(){return t.scrollByOffset(0,0)}},u),e.createElement("div",{className:i+"__header",ref:"header"},this.renderHeaderSideOf(h("Middle"))),e.createElement("div",I({className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},u),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 $.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:Q,maxWidth:Q,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},$.defaultProps={prefixCls:"rb-table",data:[]},$});
  