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.6 to 1.0.7

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,n=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 n={};"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}();var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function i(){}var l,a,s,d,c,f,u,h,p,b,m,y,w,v,_,g,x=(function(e){e.exports=function(){function e(e,t,r,n,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 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(w=/\b(iPhone|iP[ao]d)/.exec(e),v=/\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 n=/(?:Trident\/(\d+.\d+))/.exec(e);u=n?parseFloat(n[1])+4:a,s=t[2]?parseFloat(t[2]):NaN,d=t[3]?parseFloat(t[3]):NaN,(c=t[4]?parseFloat(t[4]):NaN)?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),f=t&&t[1]?parseFloat(t[1]):NaN):f=NaN}else a=s=d=f=c=NaN;if(r){if(r[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);h=!o||parseFloat(o[1].replace("_","."))}else h=!1;p=!!r[2],b=!!r[3]}else h=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()||d},webkit:function(){return S()||c},safari:function(){return O.webkit()},chrome:function(){return S()||f},windows:function(){return S()||p},osx:function(){return S()||h},linux:function(){return S()||b},iphone:function(){return S()||w},mobile:function(){return S()||w||v||m||g},nativeApp:function(){return S()||_},android:function(){return S()||m},ipad:function(){return S()||v}},C=O,N=!("undefined"==typeof window||!window.document||!window.document.createElement),R={canUseDOM:N,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:N&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:N&&!!window.screen,isInWorker:!N};R.canUseDOM&&(M=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var k=function(e,t){if(!R.canUseDOM||t&&!("addEventListener"in document))return!1;var r="on"+e,n=r in document;if(!n){var o=document.createElement("div");o.setAttribute(r,"return;"),n="function"==typeof o[r]}return!n&&M&&"wheel"===e&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n},D=10,T=40,z=800;function W(e){var t=0,r=0,n=0,o=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),n=t*D,o=r*D,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||o)&&e.deltaMode&&(1==e.deltaMode?(n*=T,o*=T):(n*=z,o*=z)),n&&!t&&(t=1>n?-1:1),o&&!r&&(r=1>o?-1:1),{spinX:t,spinY:r,pixelX:n,pixelY:o}}W.getEventType=function(){return C.firefox()?"DOMMouseScroll":k("wheel")?"wheel":"mousewheel"};var B,L,P=W,q=navigator.userAgent.match(/Trident/),A=(B=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return B(e)}),F=(L=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return L(e)});function j(e){var t=e.target||e.srcElement;t.__resizeRAF__&&F(t.__resizeRAF__),t.__resizeRAF__=A(function(){var r=t.__resizeTrigger__;r.__resizeListeners__.forEach(function(t){t.call(r,e)})})}function H(){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",j)}function X(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=H,r.type="text/html",q&&e.appendChild(r),r.data="about:blank",q||e.appendChild(r)}e.__resizeListeners__.push(t)}function I(e,t){var r={};for(var n in e)0>t.indexOf(n)&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function U(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];if(t)return"string"==typeof t||"number"==typeof t?t:"function"==typeof t?t.apply(void 0,n):e.isValidElement(t)?e.cloneElement(t,{tableContext:n}):void 0}function Y(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(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 Z=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 n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,t.call(this,e));return n.setTableRef=n.setTableRef.bind(n),n.handleResize=n.handleResize.bind(n),n.handleScroll=n.handleScroll.bind(n),n.handleClickRow=n.handleClickRow.bind(n),n.handleWindowMouseUp=n.handleWindowMouseUp.bind(n),n.handleWindowMouseMove=n.handleWindowMouseMove.bind(n),n.hScrollPanelMouseDown=n.hScrollPanelMouseDown.bind(n),n.vScrollPanelMouseDown=n.vScrollPanelMouseDown.bind(n),n.hScrollBarMouseDown=n.hScrollBarMouseDown.bind(n),n.vScrollBarMouseDown=n.vScrollBarMouseDown.bind(n),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,t),r.prototype.componentWillUnmount=function(){X(this.table,this.handleResize),window.removeEventListener("mouseup",this.handleWindowMouseUp),window.removeEventListener("mousemove",this.handleWindowMouseMove)},r.prototype.componentDidMount=function(){var e=this;window.addEventListener("mouseup",this.handleWindowMouseUp),window.addEventListener("mousemove",this.handleWindowMouseMove),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",j),t.__resizeTrigger__=!t.removeChild(t.__resizeTrigger__)))),this.table=e,X(e,this.handleResize))},r.prototype.componentDidUpdate=function(){this.reflow()},r.prototype.handleResize=function(){this.reflow()},r.prototype.reflow=function(){this.alignTable(),this.scrollByOffset(0,0)},r.prototype.handleScroll=function(e){if(!this.autoSize){var t=P(e),r=t.pixelY,n=t.pixelX;r=Math.round(.5*r),this.scrollByOffset(n=Math.round(.5*n),r).hasOffset&&(e.preventDefault(),e.stopPropagation())}},r.prototype.handleClickRow=function(e,t){this.props.onRowClick&&this.props.onRowClick(e,t)},r.prototype.setLocation=function(e,t){this.x=e,this.y=t},r.prototype.handleWindowMouseUp=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1},r.prototype.handleWindowMouseMove=function(e){var t=e.clientY;this.mouseIsDownBottom?this.handleMouseMove(e.clientX,0):this.mouseIsDownRight&&this.handleMouseMove(0,t)},r.prototype.hScrollPanelMouseDown=function(e){e.preventDefault();var t=e.clientX-this.refs.hScrollBar.getBoundingClientRect().left;this.scrollByOffset(t,0)},r.prototype.vScrollPanelMouseDown=function(e){e.preventDefault();var t=e.clientY-this.refs.vScrollBar.getBoundingClientRect().top;this.scrollByOffset(0,t)},r.prototype.hScrollBarMouseDown=function(e){e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(e)},r.prototype.vScrollBarMouseDown=function(e){e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(e)},r.prototype.handleMouseMove=function(e,t){var r=e-this.x,n=t-this.y;this.setLocation(e,t),this.scrollByOffset(r,n)},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.virtualTable,t=[],r=[],n=e.querySelector("thead > tr"),o=e.querySelector("colgroup");function i(){for(var e=0;n.children.length>e;e++)t[e]=n.children[e].offsetWidth+1}return this.props.columns.forEach(function(e,t){o.children[t].style.width=V(e.width||"")}),i(),this.props.columns.forEach(function(e,r){var n=e.width,i=e.minWidth,l=e.maxWidth;(l||i)&&(n=t[r],n=Math.min(l||n,n),o.children[r].style.width=V(n=Math.max(i||n,n)))}),i(),e.querySelectorAll("tbody > tr").forEach(function(e,t){r[t]=e.offsetHeight}),{columnWs:t,rowHs:r}},r.prototype.alignTable=function(){var e=this,t=this.refs,r=t.headerLeft,n=t.headerRight,o=t.body,i=this.props,l=i.columns,a=i.prefixCls,s=[r,n].filter(function(e){return!!e});s.forEach(function(e){G(e.querySelector("tr"),"")});var d,c,f=this.getTableWidthHeight(),u=f.columnWs,h=f.rowHs,p=this.refs.virtualTable.querySelector("thead > tr").clientHeight,b=this.table.clientHeight,m=this.refs.hScrollPanel.offsetHeight,y=this.refs.bodyMiddle.querySelector("colgroup"),w=this.refs.headerMiddle.querySelector("colgroup"),v=0,_=0;u.forEach(function(t,o){var i=V(t);v+=t,y.children[o].style.width=i,w.children[o].style.width=i,l[o].width||("left"===l[o].fixed?(r.querySelector("colgroup").children[o].style.width=i,e.refs.bodyLeft.querySelector("colgroup").children[o].style.width=i):"right"===l[o].fixed&&(n.querySelector("colgroup").children[_].style.width=i,e.refs.bodyRight.querySelector("colgroup").children[_].style.width=i,_++))}),d=this.refs.header,c=V(v=Math.max(v,this.refs.scrollX.clientWidth)),d.style.width=c,o.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:300+o.offsetWidth-o.clientWidth));var g=this.refs.header.offsetHeight;(s.forEach(function(e){G(e.querySelector("tr"),V(p)),G(e.parentElement,V(g))}),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(h[t]))})}),b>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.table.querySelector("."+a+"-fixed--right").style.right=0,this.table.style.height=V(this.refs.scrollX.offsetHeight)):this.refs.body.style.height=V(b-g-m)},r.prototype.scrollByOffset=function(e,t){var r=this.refs,n=r.bodyMiddle,o=r.hScrollBar,i=r.hScrollPanel,l=r.vScrollBar,a=r.vScrollPanel;if(!this.table||this.autoSize)return i.style.visibility="hidden",void(a.style.visibility="hidden");if(n){var s=this.refs.scrollX.offsetWidth,d=this.refs.body.clientHeight,c=n.offsetWidth,f=n.offsetHeight,u=1,h=1;if(f>d||(a.style.visibility="hidden",l=null,a=null),c>s||(i.style.visibility="hidden",o=null,i=null),o){var p=i.offsetWidth,b=p*s/c;u=(c-s)/(p-b)}if(l){var m=a.offsetHeight,y=m*d/f;h=(f-d)/(m-y)}t*=h;var w=Math.round(this.refs.scrollX.scrollLeft+(e*=u)),v=Math.round(this.refs.body.scrollTop+t),_=!0;if(w>c-s&&(w=c-s,_=!1),0>w&&(w=0,_=!1),v>f-d&&(v=f-d,_=!1),0>v&&(v=0,_=!1),this.refs.body.scrollTop=v,this.refs.scrollX.scrollLeft=w,o)i.style.visibility="visible",o.style.width=Math.round(b)+"px",o.style.transform="translateX("+Math.round(w/u)+"px)";if(x(this.refs.bodyLeft,w),x(this.refs.bodyRight,w-c+s),l){var g=Math.round(v/h);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("+-v+"px)"))}},r.prototype.renderHeaderSideOf=function(t){var r=t.side,n=I(t,["side"]),o=r.toLowerCase(),i=n[o+"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:Y(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},U(t.header,n.data,t))}))))},r.prototype.renderBodySideOf=function(t){var r=this,n=t.side,o=t.data,i=I(t,["side","data"])[n.toLowerCase()+"Columns"];if(0===i.length)return null;var l=this.props.prefixCls;return e.createElement("table",{ref:"body"+n},e.createElement("colgroup",null,i.map(function(t,r){return e.createElement("col",{key:r,style:Y(t)})})),e.createElement("tbody",{ref:"body"+n+"Content"},o.map(function(t,n){return e.createElement("tr",{key:n,className:l+"-row "+l+"-row--body",onMouseEnter:function(){return r.handleRowEnter(n)},onMouseLeave:function(){return r.handleRowLeave(n)},onClick:function(){return r.handleClickRow(t,n)}},i.map(function(r,n){return e.createElement("td",{key:n,style:r.cellStyle,className:l+"-cell "+l+"-cell--body "+(r.cellClassName||"")},U(r.cell,t,o,r))}))})))},r.prototype.renderVirtualTable=function(t){var r=t.data,n=t.columns,o=this.props.prefixCls;return e.createElement("table",{className:o+"-hidden-layout",ref:"virtualTable"},e.createElement("colgroup",null,n.map(function(t,r){return e.createElement("col",{key:r,style:Y(t)})})),e.createElement("thead",null,e.createElement("tr",{className:o+"-row "+o+"-row--header"},n.map(function(r,n){return e.createElement("td",{key:r.dataIndex||n,className:o+"-cell "+o+"-cell--header",style:r.headerStyle},U(r.header,t.data,r))}))),e.createElement("tbody",{ref:"virtualTableBody"},r.map(function(t,i){return e.createElement("tr",{key:i,className:o+"-row "+o+"-row--body"},n.map(function(n,i){return e.createElement("td",{key:i,style:n.cellStyle,className:o+"-cell "+o+"-cell--body "+(n.cellClassName||"")},U(n.cell,t,r,n))}))})))},r.prototype.render=function(){var t=this,r=this.props,n=r.data,o=r.columns,i=r.prefixCls,l=r.style,a=r.className,s=o.slice(),d=o.filter(function(e){return"left"===e.fixed}),c=o.filter(function(e){return"right"===e.fixed}),f=function(e){return{side:e,columns:o,leftColumns:d,rightColumns:c,middleColumns:s,data:n}};return e.createElement("div",{className:i+" "+(a||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,style: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(f("Middle"))),e.createElement("div",{className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},this.renderBodySideOf(f("Middle")),this.renderVirtualTable(f("virtual")))),!!d.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--left"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(f("Left"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(f("Left")))),!!c.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--right"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(f("Right"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(f("Right")))),e.createElement("div",{className:i+"__vscroll",ref:"vScrollPanel",onMouseDown:this.vScrollPanelMouseDown},e.createElement("div",{ref:"vScrollBar",onMouseDown:this.vScrollBarMouseDown,className:i+"__vscroll__bar"})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",onMouseDown:this.hScrollBarMouseDown,className:i+"__hscroll__bar"})),this.props.children)},r}(e.Component);Z.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:K,maxWidth:K,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},Z.defaultProps={prefixCls:"rb-table",data:[]};return function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".rb-table{overflow:hidden;position:relative;background:#fff;color:#333}.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}.rb-table__body{overflow:scroll;overflow-x:hidden;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-left:1px solid #e8e8e8}.rb-table-row--hover{background-color:#fff}.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;left:0;bottom:0;right:12px;padding:2px 0;background:#f9f9f9;height:12px;z-index:1}.rb-table__hscroll__bar{background:#bfbfbf;border-radius:12px;height:100%}.rb-table__hscroll__bar:hover{background:#7f7f7f}.rb-table__vscroll{visibility:hidden;position:absolute;background:#f9f9f9;top:0;bottom:0;right:0;padding:0 2px;width:12px;z-index:1}.rb-table__vscroll__bar{background:#bfbfbf;border-radius:12px;width:100%}.rb-table__vscroll__bar:hover{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}"),Z});
!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,d,c,h,f,u,p,b,m,y,w,v,_,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(w=/\b(iPhone|iP[ao]d)/.exec(e),v=/\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);f=o?parseFloat(o[1])+4:a,s=t[2]?parseFloat(t[2]):NaN,d=t[3]?parseFloat(t[3]):NaN,(c=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=d=h=c=NaN;if(r){if(r[1]){var n=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);u=!n||parseFloat(n[1].replace("_","."))}else u=!1;p=!!r[2],b=!!r[3]}else u=p=b=!1}}var M,O={ie:function(){return S()||a},ieCompatibilityMode:function(){return S()||f>a},ie64:function(){return O.ie()&&y},firefox:function(){return S()||s},opera:function(){return S()||d},webkit:function(){return S()||c},safari:function(){return O.webkit()},chrome:function(){return S()||h},windows:function(){return S()||p},osx:function(){return S()||u},linux:function(){return S()||b},iphone:function(){return S()||w},mobile:function(){return S()||w||v||m||g},nativeApp:function(){return S()||_},android:function(){return S()||m},ipad:function(){return S()||v}},C=O,N=!("undefined"==typeof window||!window.document||!window.document.createElement),k={canUseDOM:N,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:N&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:N&&!!window.screen,isInWorker:!N};k.canUseDOM&&(M=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var R=function(e,t){if(!k.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},D=10,T=40,z=800;function W(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*D,n=r*D,"deltaY"in e&&(n=e.deltaY),"deltaX"in e&&(o=e.deltaX),(o||n)&&e.deltaMode&&(1==e.deltaMode?(o*=T,n*=T):(o*=z,n*=z)),o&&!t&&(t=1>o?-1:1),n&&!r&&(r=1>n?-1:1),{spinX:t,spinY:r,pixelX:o,pixelY:n}}W.getEventType=function(){return C.firefox()?"DOMMouseScroll":R("wheel")?"wheel":"mousewheel"};var B,L,P=W,X=navigator.userAgent.match(/Trident/),A=(B=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return B(e)}),F=(L=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return L(e)});function j(e){var t=e.target||e.srcElement;t.__resizeRAF__&&F(t.__resizeRAF__),t.__resizeRAF__=A(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",j)}function H(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",X&&e.appendChild(r),r.data="about:blank",X||e.appendChild(r)}e.__resizeListeners__.push(t)}function I(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 U(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 Y(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(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 Z=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.handleWindowMouseUp=o.handleWindowMouseUp.bind(o),o.handleWindowMouseMove=o.handleWindowMouseMove.bind(o),o.hScrollPanelMouseDown=o.hScrollPanelMouseDown.bind(o),o.vScrollPanelMouseDown=o.vScrollPanelMouseDown.bind(o),o.hScrollBarMouseDown=o.hScrollBarMouseDown.bind(o),o.vScrollBarMouseDown=o.vScrollBarMouseDown.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(){H(this.table,this.handleResize),window.removeEventListener("mouseup",this.handleWindowMouseUp),window.removeEventListener("mousemove",this.handleWindowMouseMove)},r.prototype.componentDidMount=function(){var e=this;window.addEventListener("mouseup",this.handleWindowMouseUp),window.addEventListener("mousemove",this.handleWindowMouseMove),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",j),t.__resizeTrigger__=!t.removeChild(t.__resizeTrigger__)))),this.table=e,H(e,this.handleResize))},r.prototype.componentDidUpdate=function(){this.reflow()},r.prototype.handleResize=function(){this.reflow()},r.prototype.reflow=function(){this.alignTable(),this.scrollByOffset(0,0)},r.prototype.handleScroll=function(e){if(!this.autoSize){var t=P(e),r=t.pixelY,o=t.pixelX;r=Math.round(.5*r);var n=this.scrollByOffset(o=Math.round(.5*o),r).hasOffset;this.autoSize||e.preventDefault(),n&&e.stopPropagation()}},r.prototype.handleClickRow=function(e,t){this.props.onRowClick&&this.props.onRowClick(e,t)},r.prototype.setLocation=function(e,t){this.x=e,this.y=t},r.prototype.handleWindowMouseUp=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1},r.prototype.handleWindowMouseMove=function(e){var t=e.clientY;this.mouseIsDownBottom?this.handleMouseMove(e.clientX,this.y):this.mouseIsDownRight&&this.handleMouseMove(this.x,t)},r.prototype.hScrollPanelMouseDown=function(e){if(1===e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=e.clientX-this.refs.hScrollBar.getBoundingClientRect().left;this.scrollByOffset(t,0)}},r.prototype.vScrollPanelMouseDown=function(e){if(1===e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=e.clientY-this.refs.vScrollBar.getBoundingClientRect().top;this.scrollByOffset(0,t)}},r.prototype.hScrollBarMouseDown=function(e){1===e.nativeEvent.which&&(e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(e.clientX,e.clientY))},r.prototype.vScrollBarMouseDown=function(e){1===e.nativeEvent.which&&(e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(e.clientX,e.clientY))},r.prototype.handleMouseMove=function(e,t){var r=e-this.x,o=t-this.y;this.setLocation(e,t),this.scrollByOffset(r,o)},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,s,d=this.getTableWidthHeight(),c=d.columnWs,h=d.rowHs,f=this.refs.virtualTable.querySelector("thead > tr").clientHeight,u=this.table.clientHeight,p=this.refs.hScrollPanel.offsetHeight,b=this.refs.bodyMiddle.querySelector("colgroup"),m=this.refs.headerMiddle.querySelector("colgroup"),y=0,w=0;c.forEach(function(t,n){var l=V(t);y+=t,b.children[n].style.width=l,m.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[w].style.width=l,e.refs.bodyRight.querySelector("colgroup").children[w].style.width=l,w++))}),a=this.refs.header,s=V(y=Math.max(y,this.refs.scrollX.clientWidth)),a.style.width=s,n.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:300+n.offsetWidth-n.clientWidth));var v=this.refs.header.offsetHeight;(l.forEach(function(e){G(e.querySelector("tr"),V(f)),G(e.parentElement,V(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(h[t]))})}),u>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.table.style.height=V(this.refs.scrollX.offsetHeight)):this.refs.body.style.height=V(u-v-p)},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(!this.table||this.autoSize)return i.style.visibility="hidden",void(a.style.visibility="hidden");if(o){var s=this.refs.scrollX.offsetWidth,d=this.refs.body.clientHeight,c=o.offsetWidth,h=o.offsetHeight,f=1,u=1;if(h>d||(a.style.visibility="hidden",l=null,a=null),c>s||(i.style.visibility="hidden",n=null,i=null),n){var p=i.offsetWidth,b=Math.max(p*s/c,20);f=(c-s)/(p-b)}if(l){var m=a.offsetHeight,y=Math.max(m*d/h,20);u=(h-d)/(m-y)}var w=this.refs.scrollX.scrollLeft+(e*=f),v=this.refs.body.scrollTop+(t*=u),_=!0;if(w>c-s&&(w=c-s,_=!1),0>w&&(w=0,_=!1),v>h-d&&(v=h-d,_=!1),0>v&&(v=0,_=!1),this.refs.body.scrollTop=v,this.refs.scrollX.scrollLeft=w,n)i.style.visibility="visible",n.style.width=Math.round(b)+"px",n.style.transform="translateX("+Math.round(w/f)+"px)";if(x(this.refs.bodyLeft,w),x(this.refs.bodyRight,w-c+s),l){var g=Math.round(v/u);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("+-v+"px)"))}},r.prototype.renderHeaderSideOf=function(t){var r=t.side,o=I(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:Y(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},U(t.header,o.data,t))}))))},r.prototype.renderBodySideOf=function(t){var r=this,o=t.side,n=t.data,i=I(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:Y(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||"")},U(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:Y(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},U(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||"")},U(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(),d=n.filter(function(e){return"left"===e.fixed}),c=n.filter(function(e){return"right"===e.fixed}),h=function(e){return{side:e,columns:n,leftColumns:d,rightColumns:c,middleColumns:s,data:o}};return e.createElement("div",{className:i+" "+(a||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,style: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")))),!!d.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")))),!!c.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},e.createElement("div",{ref:"vScrollBar",className:i+"__vscroll__bar",onMouseDown:this.vScrollBarMouseDown})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",className:i+"__hscroll__bar",onMouseDown:this.hScrollBarMouseDown})),this.props.children)},r}(e.Component);Z.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:K,maxWidth:K,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},Z.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}.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}.rb-table__body{overflow:scroll;overflow-x:hidden;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-left:1px solid #e8e8e8}.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}.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:0;right:0;width:14px;z-index:1}.rb-table__vscroll__bar{padding:0 3px}.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}'),Z});

@@ -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,s,a,c,d,u,h,f,p,m,y,w,v,b,_,g,E=(function(e){e.exports=function(){function e(e,t,n,r,i,l){if(l!==o){var s=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 s.name="Invariant Violation",s}}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(v=/\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),w=!!/Win64/.exec(e),t){(s=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(s=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);h=r?parseFloat(r[1])+4:s,a=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),u=t&&t[1]?parseFloat(t[1]):NaN):u=NaN}else s=a=c=u=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()||s},ieCompatibilityMode:function(){return x()||h>s},ie64:function(){return O.ie()&&w},firefox:function(){return x()||a},opera:function(){return x()||c},webkit:function(){return x()||d},safari:function(){return O.webkit()},chrome:function(){return x()||u},windows:function(){return x()||p},osx:function(){return x()||f},linux:function(){return x()||m},iphone:function(){return x()||v},mobile:function(){return x()||v||b||y||g},nativeApp:function(){return x()||_},android:function(){return x()||y},ipad:function(){return x()||b}},C=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 D=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},T=10,W=40,L=800;function k(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*T,o=n*T,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1==e.deltaMode?(r*=W,o*=W):(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}}k.getEventType=function(){return C.firefox()?"DOMMouseScroll":D("wheel")?"wheel":"mousewheel"};var B,z,P=k,q=navigator.userAgent.match(/Trident/),F=(B=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return B(e)}),j=(z=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return z(e)});function A(e){var t=e.target||e.srcElement;t.__resizeRAF__&&j(t.__resizeRAF__),t.__resizeRAF__=F(function(){var n=t.__resizeTrigger__;n.__resizeListeners__.forEach(function(t){t.call(n,e)})})}function H(){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",A)}function X(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=H,n.type="text/html",q&&e.appendChild(n),n.data="about:blank",q||e.appendChild(n)}e.__resizeListeners__.push(t)}function I(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 Y(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(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 Z=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.handleWindowMouseUp=r.handleWindowMouseUp.bind(r),r.handleWindowMouseMove=r.handleWindowMouseMove.bind(r),r.hScrollPanelMouseDown=r.hScrollPanelMouseDown.bind(r),r.vScrollPanelMouseDown=r.vScrollPanelMouseDown.bind(r),r.hScrollBarMouseDown=r.hScrollBarMouseDown.bind(r),r.vScrollBarMouseDown=r.vScrollBarMouseDown.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(){X(this.table,this.handleResize),window.removeEventListener("mouseup",this.handleWindowMouseUp),window.removeEventListener("mousemove",this.handleWindowMouseMove)},n.prototype.componentDidMount=function(){var e=this;window.addEventListener("mouseup",this.handleWindowMouseUp),window.addEventListener("mousemove",this.handleWindowMouseMove),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",A),t.__resizeTrigger__=!t.removeChild(t.__resizeTrigger__)))),this.table=e,X(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=P(e),n=t.pixelY,r=t.pixelX;n=Math.round(.5*n),this.scrollByOffset(r=Math.round(.5*r),n).hasOffset&&(e.preventDefault(),e.stopPropagation())}},n.prototype.handleClickRow=function(e,t){this.props.onRowClick&&this.props.onRowClick(e,t)},n.prototype.setLocation=function(e,t){this.x=e,this.y=t},n.prototype.handleWindowMouseUp=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1},n.prototype.handleWindowMouseMove=function(e){var t=e.clientY;this.mouseIsDownBottom?this.handleMouseMove(e.clientX,0):this.mouseIsDownRight&&this.handleMouseMove(0,t)},n.prototype.hScrollPanelMouseDown=function(e){e.preventDefault();var t=e.clientX-this.refs.hScrollBar.getBoundingClientRect().left;this.scrollByOffset(t,0)},n.prototype.vScrollPanelMouseDown=function(e){e.preventDefault();var t=e.clientY-this.refs.vScrollBar.getBoundingClientRect().top;this.scrollByOffset(0,t)},n.prototype.hScrollBarMouseDown=function(e){e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(e)},n.prototype.vScrollBarMouseDown=function(e){e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(e)},n.prototype.handleMouseMove=function(e,t){var n=e-this.x,r=t-this.y;this.setLocation(e,t),this.scrollByOffset(n,r)},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.virtualTable,t=[],n=[],r=e.querySelector("thead > tr"),o=e.querySelector("colgroup");function i(){for(var e=0;r.children.length>e;e++)t[e]=r.children[e].offsetWidth+1}return this.props.columns.forEach(function(e,t){o.children[t].style.width=V(e.width||"")}),i(),this.props.columns.forEach(function(e,n){var r=e.width,i=e.minWidth,l=e.maxWidth;(l||i)&&(r=t[n],r=Math.min(l||r,r),o.children[n].style.width=V(r=Math.max(i||r,r)))}),i(),e.querySelectorAll("tbody > tr").forEach(function(e,t){n[t]=e.offsetHeight}),{columnWs:t,rowHs:n}},n.prototype.alignTable=function(){var e=this,t=this.refs,n=t.headerLeft,r=t.headerRight,o=t.body,i=this.props,l=i.columns,s=i.prefixCls,a=[n,r].filter(function(e){return!!e});a.forEach(function(e){G(e.querySelector("tr"),"")});var c,d,u=this.getTableWidthHeight(),h=u.columnWs,f=u.rowHs,p=this.refs.virtualTable.querySelector("thead > tr").clientHeight,m=this.table.clientHeight,y=this.refs.hScrollPanel.offsetHeight,w=this.refs.bodyMiddle.querySelector("colgroup"),v=this.refs.headerMiddle.querySelector("colgroup"),b=0,_=0;h.forEach(function(t,o){var i=V(t);b+=t,w.children[o].style.width=i,v.children[o].style.width=i,l[o].width||("left"===l[o].fixed?(n.querySelector("colgroup").children[o].style.width=i,e.refs.bodyLeft.querySelector("colgroup").children[o].style.width=i):"right"===l[o].fixed&&(r.querySelector("colgroup").children[_].style.width=i,e.refs.bodyRight.querySelector("colgroup").children[_].style.width=i,_++))}),c=this.refs.header,d=V(b=Math.max(b,this.refs.scrollX.clientWidth)),c.style.width=d,o.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:300+o.offsetWidth-o.clientWidth));var g=this.refs.header.offsetHeight;(a.forEach(function(e){G(e.querySelector("tr"),V(p)),G(e.parentElement,V(g))}),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(f[t]))})}),m>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.table.querySelector("."+s+"-fixed--right").style.right=0,this.table.style.height=V(this.refs.scrollX.offsetHeight)):this.refs.body.style.height=V(m-g-y)},n.prototype.scrollByOffset=function(e,t){var n=this.refs,r=n.bodyMiddle,o=n.hScrollBar,i=n.hScrollPanel,l=n.vScrollBar,s=n.vScrollPanel;if(!this.table||this.autoSize)return i.style.visibility="hidden",void(s.style.visibility="hidden");if(r){var a=this.refs.scrollX.offsetWidth,c=this.refs.body.clientHeight,d=r.offsetWidth,u=r.offsetHeight,h=1,f=1;if(u>c||(s.style.visibility="hidden",l=null,s=null),d>a||(i.style.visibility="hidden",o=null,i=null),o){var p=i.offsetWidth,m=p*a/d;h=(d-a)/(p-m)}if(l){var y=s.offsetHeight,w=y*c/u;f=(u-c)/(y-w)}t*=f;var v=Math.round(this.refs.scrollX.scrollLeft+(e*=h)),b=Math.round(this.refs.body.scrollTop+t),_=!0;if(v>d-a&&(v=d-a,_=!1),0>v&&(v=0,_=!1),b>u-c&&(b=u-c,_=!1),0>b&&(b=0,_=!1),this.refs.body.scrollTop=b,this.refs.scrollX.scrollLeft=v,o)i.style.visibility="visible",o.style.width=Math.round(m)+"px",o.style.transform="translateX("+Math.round(v/h)+"px)";if(E(this.refs.bodyLeft,v),E(this.refs.bodyRight,v-d+a),l){var g=Math.round(b/f);s.style.visibility="visible",l.style.height=Math.round(w)+"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=I(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:Y(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=I(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:Y(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:Y(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,s=n.className,a=o.slice(),c=o.filter(function(e){return"left"===e.fixed}),d=o.filter(function(e){return"right"===e.fixed}),u=function(e){return{side:e,columns:o,leftColumns:c,rightColumns:d,middleColumns:a,data:r}};return e.createElement("div",{className:i+" "+(s||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,style: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(u("Middle"))),e.createElement("div",{className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},this.renderBodySideOf(u("Middle")),this.renderVirtualTable(u("virtual")))),!!c.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--left"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(u("Left"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(u("Left")))),!!d.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--right"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(u("Right"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(u("Right")))),e.createElement("div",{className:i+"__vscroll",ref:"vScrollPanel",onMouseDown:this.vScrollPanelMouseDown},e.createElement("div",{ref:"vScrollBar",onMouseDown:this.vScrollBarMouseDown,className:i+"__vscroll__bar"})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",onMouseDown:this.hScrollBarMouseDown,className:i+"__hscroll__bar"})),this.props.children)},n}(e.Component);return Z.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:K,maxWidth:K,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},Z.defaultProps={prefixCls:"rb-table",data:[]},Z});
!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,s,a,c,d,u,h,f,p,m,y,w,v,b,_,g,E=(function(e){e.exports=function(){function e(e,t,n,r,i,l){if(l!==o){var s=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 s.name="Invariant Violation",s}}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(v=/\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),w=!!/Win64/.exec(e),t){(s=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(s=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);h=r?parseFloat(r[1])+4:s,a=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),u=t&&t[1]?parseFloat(t[1]):NaN):u=NaN}else s=a=c=u=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()||s},ieCompatibilityMode:function(){return x()||h>s},ie64:function(){return O.ie()&&w},firefox:function(){return x()||a},opera:function(){return x()||c},webkit:function(){return x()||d},safari:function(){return O.webkit()},chrome:function(){return x()||u},windows:function(){return x()||p},osx:function(){return x()||f},linux:function(){return x()||m},iphone:function(){return x()||v},mobile:function(){return x()||v||b||y||g},nativeApp:function(){return x()||_},android:function(){return x()||y},ipad:function(){return x()||b}},R=O,N=!("undefined"==typeof window||!window.document||!window.document.createElement),C={canUseDOM:N,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:N&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:N&&!!window.screen,isInWorker:!N};C.canUseDOM&&(M=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var D=function(e,t){if(!C.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},T=10,W=40,L=800;function k(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*T,o=n*T,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1==e.deltaMode?(r*=W,o*=W):(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}}k.getEventType=function(){return R.firefox()?"DOMMouseScroll":D("wheel")?"wheel":"mousewheel"};var P,z,B=k,X=navigator.userAgent.match(/Trident/),F=(P=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},function(e){return P(e)}),j=(z=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(e){return z(e)});function q(e){var t=e.target||e.srcElement;t.__resizeRAF__&&j(t.__resizeRAF__),t.__resizeRAF__=F(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",X&&e.appendChild(n),n.data="about:blank",X||e.appendChild(n)}e.__resizeListeners__.push(t)}function I(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 Y(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(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 Z=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.handleWindowMouseUp=r.handleWindowMouseUp.bind(r),r.handleWindowMouseMove=r.handleWindowMouseMove.bind(r),r.hScrollPanelMouseDown=r.hScrollPanelMouseDown.bind(r),r.vScrollPanelMouseDown=r.vScrollPanelMouseDown.bind(r),r.hScrollBarMouseDown=r.hScrollBarMouseDown.bind(r),r.vScrollBarMouseDown=r.vScrollBarMouseDown.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("mouseup",this.handleWindowMouseUp),window.removeEventListener("mousemove",this.handleWindowMouseMove)},n.prototype.componentDidMount=function(){var e=this;window.addEventListener("mouseup",this.handleWindowMouseUp),window.addEventListener("mousemove",this.handleWindowMouseMove),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=B(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,t){this.x=e,this.y=t},n.prototype.handleWindowMouseUp=function(){this.mouseIsDownRight=!1,this.mouseIsDownBottom=!1},n.prototype.handleWindowMouseMove=function(e){var t=e.clientY;this.mouseIsDownBottom?this.handleMouseMove(e.clientX,this.y):this.mouseIsDownRight&&this.handleMouseMove(this.x,t)},n.prototype.hScrollPanelMouseDown=function(e){if(1===e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=e.clientX-this.refs.hScrollBar.getBoundingClientRect().left;this.scrollByOffset(t,0)}},n.prototype.vScrollPanelMouseDown=function(e){if(1===e.nativeEvent.which){e.preventDefault(),e.stopPropagation();var t=e.clientY-this.refs.vScrollBar.getBoundingClientRect().top;this.scrollByOffset(0,t)}},n.prototype.hScrollBarMouseDown=function(e){1===e.nativeEvent.which&&(e.preventDefault(),e.stopPropagation(),this.mouseIsDownBottom=!0,this.setLocation(e.clientX,e.clientY))},n.prototype.vScrollBarMouseDown=function(e){1===e.nativeEvent.which&&(e.preventDefault(),e.stopPropagation(),this.mouseIsDownRight=!0,this.setLocation(e.clientX,e.clientY))},n.prototype.handleMouseMove=function(e,t){var n=e-this.x,r=t-this.y;this.setLocation(e,t),this.scrollByOffset(n,r)},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 s(){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||"")}),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 s,a,c=this.getTableWidthHeight(),d=c.columnWs,u=c.rowHs,h=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"),w=0,v=0;d.forEach(function(t,o){var l=V(t);w+=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[v].style.width=l,e.refs.bodyRight.querySelector("colgroup").children[v].style.width=l,v++))}),s=this.refs.header,a=V(w=Math.max(w,this.refs.scrollX.clientWidth)),s.style.width=a,o.style.width=V(this.refs.header.clientWidth+(this.autoSize?0:300+o.offsetWidth-o.clientWidth));var b=this.refs.header.offsetHeight;(l.forEach(function(e){G(e.querySelector("tr"),V(h)),G(e.parentElement,V(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 G(e,V(u[t]))})}),f>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.table.style.height=V(this.refs.scrollX.offsetHeight)):this.refs.body.style.height=V(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,s=n.vScrollPanel;if(!this.table||this.autoSize)return i.style.visibility="hidden",void(s.style.visibility="hidden");if(r){var a=this.refs.scrollX.offsetWidth,c=this.refs.body.clientHeight,d=r.offsetWidth,u=r.offsetHeight,h=1,f=1;if(u>c||(s.style.visibility="hidden",l=null,s=null),d>a||(i.style.visibility="hidden",o=null,i=null),o){var p=i.offsetWidth,m=Math.max(p*a/d,20);h=(d-a)/(p-m)}if(l){var y=s.offsetHeight,w=Math.max(y*c/u,20);f=(u-c)/(y-w)}var v=this.refs.scrollX.scrollLeft+(e*=h),b=this.refs.body.scrollTop+(t*=f),_=!0;if(v>d-a&&(v=d-a,_=!1),0>v&&(v=0,_=!1),b>u-c&&(b=u-c,_=!1),0>b&&(b=0,_=!1),this.refs.body.scrollTop=b,this.refs.scrollX.scrollLeft=v,o)i.style.visibility="visible",o.style.width=Math.round(m)+"px",o.style.transform="translateX("+Math.round(v/h)+"px)";if(E(this.refs.bodyLeft,v),E(this.refs.bodyRight,v-d+a),l){var g=Math.round(b/f);s.style.visibility="visible",l.style.height=Math.round(w)+"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=I(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:Y(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=I(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:Y(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:Y(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,s=n.className,a=o.slice(),c=o.filter(function(e){return"left"===e.fixed}),d=o.filter(function(e){return"right"===e.fixed}),u=function(e){return{side:e,columns:o,leftColumns:c,rightColumns:d,middleColumns:a,data:r}};return e.createElement("div",{className:i+" "+(s||""),key:"rb-table",ref:this.setTableRef,onWheel:this.handleScroll,style: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(u("Middle"))),e.createElement("div",{className:i+"__body",ref:"body",onScroll:function(){return t.scrollByOffset(0,0)}},this.renderBodySideOf(u("Middle")),this.renderVirtualTable(u("virtual")))),!!c.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--left"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(u("Left"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(u("Left")))),!!d.length&&e.createElement("div",{className:i+"-fixed "+i+"-fixed--right"},e.createElement("div",{className:i+"-fixed__header"},this.renderHeaderSideOf(u("Right"))),e.createElement("div",{className:i+"-fixed__body"},this.renderBodySideOf(u("Right")))),e.createElement("div",{className:i+"__vscroll",ref:"vScrollPanel",onMouseDown:this.vScrollPanelMouseDown},e.createElement("div",{ref:"vScrollBar",className:i+"__vscroll__bar",onMouseDown:this.vScrollBarMouseDown})),e.createElement("div",{className:i+"__hscroll",ref:"hScrollPanel",onMouseDown:this.hScrollPanelMouseDown},e.createElement("div",{ref:"hScrollBar",className:i+"__hscroll__bar",onMouseDown:this.hScrollBarMouseDown})),this.props.children)},n}(e.Component);return Z.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:K,maxWidth:K,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},Z.defaultProps={prefixCls:"rb-table",data:[]},Z});

@@ -77,3 +77,3 @@ import React from 'react';

if (typeof item === 'function') return item.apply(undefined, props);
if (React.isValidElement(item)) return React.cloneElement(item, { tableContext: props });
if (React.isValidElement(item)) return React.cloneElement(item, { tablecontext: props });
}

@@ -185,4 +185,6 @@ function getWidthStyle(r) {

if (!this.autoSize) {
e.preventDefault();
}
if (hasOffset) {
e.preventDefault();
e.stopPropagation();

@@ -211,5 +213,5 @@ }

if (this.mouseIsDownBottom) {
this.handleMouseMove(clientX, 0);
this.handleMouseMove(clientX, this.y);
} else if (this.mouseIsDownRight) {
this.handleMouseMove(0, clientY);
this.handleMouseMove(this.x, clientY);
}

@@ -219,3 +221,5 @@ };

RBTable.prototype.hScrollPanelMouseDown = function hScrollPanelMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
var x = e.clientX - this.refs.hScrollBar.getBoundingClientRect().left;

@@ -226,3 +230,5 @@ this.scrollByOffset(x, 0);

RBTable.prototype.vScrollPanelMouseDown = function vScrollPanelMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
var y = e.clientY - this.refs.vScrollBar.getBoundingClientRect().top;

@@ -233,13 +239,15 @@ this.scrollByOffset(0, y);

RBTable.prototype.hScrollBarMouseDown = function hScrollBarMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
this.mouseIsDownBottom = true;
this.setLocation(e);
this.setLocation(e.clientX, e.clientY);
};
RBTable.prototype.vScrollBarMouseDown = function vScrollBarMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
this.mouseIsDownRight = true;
this.setLocation(e);
this.setLocation(e.clientX, e.clientY);
};

@@ -295,3 +303,5 @@

RBTable.prototype.getTableWidthHeight = function getTableWidthHeight() {
var virtualTable = this.refs.virtualTable;
var _refs2 = this.refs,
virtualTable = _refs2.virtualTable,
scrollX = _refs2.scrollX;

@@ -302,2 +312,9 @@

virtualTable.style.width = '';
if (virtualTable.offsetWidth < scrollX.clientWidth - this.props.columns.length) {
// 获取列换的加了1,这个减掉
virtualTable.style.width = px(scrollX.clientWidth - this.props.columns.length);
}
var headerRow = virtualTable.querySelector('thead > tr');

@@ -348,9 +365,7 @@ var colgroup = virtualTable.querySelector('colgroup');

var _refs2 = this.refs,
headerLeft = _refs2.headerLeft,
headerRight = _refs2.headerRight,
body = _refs2.body;
var _props = this.props,
columns = _props.columns,
prefixCls = _props.prefixCls;
var _refs3 = this.refs,
headerLeft = _refs3.headerLeft,
headerRight = _refs3.headerRight,
body = _refs3.body;
var columns = this.props.columns;

@@ -430,3 +445,2 @@

this.refs.body.style.overflowY = 'hidden';
this.table.querySelector('.' + prefixCls + '-fixed--right').style.right = 0;
this.table.style.height = px(this.refs.scrollX.offsetHeight);

@@ -440,8 +454,8 @@ } else {

RBTable.prototype.scrollByOffset = function scrollByOffset(offsetX, offsetY) {
var _refs3 = this.refs,
bodyMiddle = _refs3.bodyMiddle,
hScrollBar = _refs3.hScrollBar,
hScrollPanel = _refs3.hScrollPanel,
vScrollBar = _refs3.vScrollBar,
vScrollPanel = _refs3.vScrollPanel;
var _refs4 = this.refs,
bodyMiddle = _refs4.bodyMiddle,
hScrollBar = _refs4.hScrollBar,
hScrollPanel = _refs4.hScrollPanel,
vScrollBar = _refs4.vScrollBar,
vScrollPanel = _refs4.vScrollPanel;

@@ -461,3 +475,2 @@ if (!this.table || this.autoSize) {

vOffsetRatio = 1;
if (contentHeight <= bodyHeight) {

@@ -476,3 +489,3 @@ vScrollPanel.style.visibility = 'hidden';

var hScrollPanelWidth = hScrollPanel.offsetWidth;
var hScrollBarWidth = hScrollPanelWidth * bodyWidth / contentWidth;
var hScrollBarWidth = Math.max(hScrollPanelWidth * bodyWidth / contentWidth, 20);
hOffsetRatio = (contentWidth - bodyWidth) / (hScrollPanelWidth - hScrollBarWidth);

@@ -483,3 +496,3 @@ }

var vScrollPanelHeight = vScrollPanel.offsetHeight;
var vScrollBarHeight = vScrollPanelHeight * bodyHeight / contentHeight;
var vScrollBarHeight = Math.max(vScrollPanelHeight * bodyHeight / contentHeight, 20);
vOffsetRatio = (contentHeight - bodyHeight) / (vScrollPanelHeight - vScrollBarHeight);

@@ -491,4 +504,4 @@ }

var left = Math.round(this.refs.scrollX.scrollLeft + offsetX);
var top = Math.round(this.refs.body.scrollTop + offsetY);
var left = this.refs.scrollX.scrollLeft + offsetX;
var top = this.refs.body.scrollTop + offsetY;
// hasOffset 用来判断 wheel 已经滑到边缘,这样可以不用 preventDefault 和 stopPropagation wheel 的事件,让外层的滚动元素起作用

@@ -695,8 +708,8 @@ var hasOffset = true;

var _props2 = this.props,
data = _props2.data,
columns = _props2.columns,
prefixCls = _props2.prefixCls,
style = _props2.style,
className = _props2.className;
var _props = this.props,
data = _props.data,
columns = _props.columns,
prefixCls = _props.prefixCls,
style = _props.style,
className = _props.className;

@@ -776,3 +789,3 @@

},
React.createElement('div', { ref: 'vScrollBar', onMouseDown: this.vScrollBarMouseDown, className: prefixCls + '__vscroll__bar' })
React.createElement('div', { ref: 'vScrollBar', className: prefixCls + '__vscroll__bar', onMouseDown: this.vScrollBarMouseDown })
),

@@ -785,3 +798,3 @@ React.createElement(

},
React.createElement('div', { ref: 'hScrollBar', onMouseDown: this.hScrollBarMouseDown, className: prefixCls + '__hscroll__bar' })
React.createElement('div', { ref: 'hScrollBar', className: prefixCls + '__hscroll__bar', onMouseDown: this.hScrollBarMouseDown })
),

@@ -788,0 +801,0 @@ this.props.children

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

if (typeof item === 'function') return item.apply(undefined, props);
if (React.isValidElement(item)) return React.cloneElement(item, { tableContext: props });
if (React.isValidElement(item)) return React.cloneElement(item, { tablecontext: props });
}

@@ -189,4 +189,6 @@ function getWidthStyle(r) {

if (!this.autoSize) {
e.preventDefault();
}
if (hasOffset) {
e.preventDefault();
e.stopPropagation();

@@ -215,5 +217,5 @@ }

if (this.mouseIsDownBottom) {
this.handleMouseMove(clientX, 0);
this.handleMouseMove(clientX, this.y);
} else if (this.mouseIsDownRight) {
this.handleMouseMove(0, clientY);
this.handleMouseMove(this.x, clientY);
}

@@ -223,3 +225,5 @@ };

RBTable.prototype.hScrollPanelMouseDown = function hScrollPanelMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
var x = e.clientX - this.refs.hScrollBar.getBoundingClientRect().left;

@@ -230,3 +234,5 @@ this.scrollByOffset(x, 0);

RBTable.prototype.vScrollPanelMouseDown = function vScrollPanelMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
var y = e.clientY - this.refs.vScrollBar.getBoundingClientRect().top;

@@ -237,13 +243,15 @@ this.scrollByOffset(0, y);

RBTable.prototype.hScrollBarMouseDown = function hScrollBarMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
this.mouseIsDownBottom = true;
this.setLocation(e);
this.setLocation(e.clientX, e.clientY);
};
RBTable.prototype.vScrollBarMouseDown = function vScrollBarMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
this.mouseIsDownRight = true;
this.setLocation(e);
this.setLocation(e.clientX, e.clientY);
};

@@ -299,3 +307,5 @@

RBTable.prototype.getTableWidthHeight = function getTableWidthHeight() {
var virtualTable = this.refs.virtualTable;
var _refs2 = this.refs,
virtualTable = _refs2.virtualTable,
scrollX = _refs2.scrollX;

@@ -306,2 +316,9 @@

virtualTable.style.width = '';
if (virtualTable.offsetWidth < scrollX.clientWidth - this.props.columns.length) {
// 获取列换的加了1,这个减掉
virtualTable.style.width = px(scrollX.clientWidth - this.props.columns.length);
}
var headerRow = virtualTable.querySelector('thead > tr');

@@ -352,9 +369,7 @@ var colgroup = virtualTable.querySelector('colgroup');

var _refs2 = this.refs,
headerLeft = _refs2.headerLeft,
headerRight = _refs2.headerRight,
body = _refs2.body;
var _props = this.props,
columns = _props.columns,
prefixCls = _props.prefixCls;
var _refs3 = this.refs,
headerLeft = _refs3.headerLeft,
headerRight = _refs3.headerRight,
body = _refs3.body;
var columns = this.props.columns;

@@ -434,3 +449,2 @@

this.refs.body.style.overflowY = 'hidden';
this.table.querySelector('.' + prefixCls + '-fixed--right').style.right = 0;
this.table.style.height = px(this.refs.scrollX.offsetHeight);

@@ -444,8 +458,8 @@ } else {

RBTable.prototype.scrollByOffset = function scrollByOffset(offsetX, offsetY) {
var _refs3 = this.refs,
bodyMiddle = _refs3.bodyMiddle,
hScrollBar = _refs3.hScrollBar,
hScrollPanel = _refs3.hScrollPanel,
vScrollBar = _refs3.vScrollBar,
vScrollPanel = _refs3.vScrollPanel;
var _refs4 = this.refs,
bodyMiddle = _refs4.bodyMiddle,
hScrollBar = _refs4.hScrollBar,
hScrollPanel = _refs4.hScrollPanel,
vScrollBar = _refs4.vScrollBar,
vScrollPanel = _refs4.vScrollPanel;

@@ -465,3 +479,2 @@ if (!this.table || this.autoSize) {

vOffsetRatio = 1;
if (contentHeight <= bodyHeight) {

@@ -480,3 +493,3 @@ vScrollPanel.style.visibility = 'hidden';

var hScrollPanelWidth = hScrollPanel.offsetWidth;
var hScrollBarWidth = hScrollPanelWidth * bodyWidth / contentWidth;
var hScrollBarWidth = Math.max(hScrollPanelWidth * bodyWidth / contentWidth, 20);
hOffsetRatio = (contentWidth - bodyWidth) / (hScrollPanelWidth - hScrollBarWidth);

@@ -487,3 +500,3 @@ }

var vScrollPanelHeight = vScrollPanel.offsetHeight;
var vScrollBarHeight = vScrollPanelHeight * bodyHeight / contentHeight;
var vScrollBarHeight = Math.max(vScrollPanelHeight * bodyHeight / contentHeight, 20);
vOffsetRatio = (contentHeight - bodyHeight) / (vScrollPanelHeight - vScrollBarHeight);

@@ -495,4 +508,4 @@ }

var left = Math.round(this.refs.scrollX.scrollLeft + offsetX);
var top = Math.round(this.refs.body.scrollTop + offsetY);
var left = this.refs.scrollX.scrollLeft + offsetX;
var top = this.refs.body.scrollTop + offsetY;
// hasOffset 用来判断 wheel 已经滑到边缘,这样可以不用 preventDefault 和 stopPropagation wheel 的事件,让外层的滚动元素起作用

@@ -699,8 +712,8 @@ var hasOffset = true;

var _props2 = this.props,
data = _props2.data,
columns = _props2.columns,
prefixCls = _props2.prefixCls,
style = _props2.style,
className = _props2.className;
var _props = this.props,
data = _props.data,
columns = _props.columns,
prefixCls = _props.prefixCls,
style = _props.style,
className = _props.className;

@@ -780,3 +793,3 @@

},
React.createElement('div', { ref: 'vScrollBar', onMouseDown: this.vScrollBarMouseDown, className: prefixCls + '__vscroll__bar' })
React.createElement('div', { ref: 'vScrollBar', className: prefixCls + '__vscroll__bar', onMouseDown: this.vScrollBarMouseDown })
),

@@ -789,3 +802,3 @@ React.createElement(

},
React.createElement('div', { ref: 'hScrollBar', onMouseDown: this.hScrollBarMouseDown, className: prefixCls + '__hscroll__bar' })
React.createElement('div', { ref: 'hScrollBar', className: prefixCls + '__hscroll__bar', onMouseDown: this.hScrollBarMouseDown })
),

@@ -792,0 +805,0 @@ this.props.children

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

@@ -15,5 +15,7 @@ "main": "lib/rb-table.js",

"scripts": {
"start": "webpack-dev-server --config webpack.config.dev.js --hot",
"clean": "rimraf lib dist es coverage",
"build": "npm run clean && rollup -c",
"prepare": "npm run clean && npm run build"
"build": "rollup -c",
"build-doc": "webpack",
"prepare": "npm run clean && npm run build && npm run build-doc"
},

@@ -49,2 +51,3 @@ "keywords": [

"babel-jest": "^22.4.3",
"babel-loader": "^7.1.5",
"babel-plugin-external-helpers": "^6.22.0",

@@ -59,5 +62,8 @@ "babel-plugin-transform-class-properties": "^6.24.1",

"cross-env": "^5.1.4",
"css-loader": "^1.0.0",
"glob": "^7.1.1",
"jest": "^22.4.3",
"less": "^3.8.1",
"less-loader": "^4.1.0",
"react-resizable": "^1.7.5",
"rimraf": "^2.6.2",

@@ -72,4 +78,8 @@ "rollup": "^0.66.0",

"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-terser": "^3.0.0"
"rollup-plugin-terser": "^3.0.0",
"style-loader": "^0.23.1",
"webpack": "^4.23.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
}
}
}
# rb-table
Declarative React table component with highly customizable scroll and layout feature
Declarative React table component with highly customizable scroll and layout feature. [demo](https://sijiecai.github.io/rb-table/index.html)

@@ -5,0 +5,0 @@ ## Festures

@@ -10,3 +10,3 @@ import React from 'react'

if (typeof (item) === 'function') return item(...props);
if (React.isValidElement(item)) return React.cloneElement(item, { tableContext: props });
if (React.isValidElement(item)) return React.cloneElement(item, { tablecontext: props });
}

@@ -107,4 +107,6 @@ function getWidthStyle(r) {

const { hasOffset } = this.scrollByOffset(pixelX, pixelY);
if (!this.autoSize) {
e.preventDefault();
}
if (hasOffset) {
e.preventDefault();
e.stopPropagation();

@@ -130,5 +132,5 @@ }

if (this.mouseIsDownBottom) {
this.handleMouseMove(clientX, 0);
this.handleMouseMove(clientX, this.y);
} else if (this.mouseIsDownRight) {
this.handleMouseMove(0, clientY);
this.handleMouseMove(this.x, clientY);
}

@@ -138,3 +140,5 @@ }

hScrollPanelMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
let x = e.clientX - this.refs.hScrollBar.getBoundingClientRect().left;

@@ -145,3 +149,5 @@ this.scrollByOffset(x, 0);

vScrollPanelMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
let y = e.clientY - this.refs.vScrollBar.getBoundingClientRect().top;

@@ -152,13 +158,15 @@ this.scrollByOffset(0, y);

hScrollBarMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
this.mouseIsDownBottom = true;
this.setLocation(e);
this.setLocation(e.clientX, e.clientY);
}
vScrollBarMouseDown(e) {
if (e.nativeEvent.which !== 1) return;
e.preventDefault();
e.stopPropagation();
this.mouseIsDownRight = true;
this.setLocation(e);
this.setLocation(e.clientX, e.clientY);
}

@@ -197,3 +205,3 @@

getTableWidthHeight() {
const { virtualTable } = this.refs;
const { virtualTable, scrollX } = this.refs;

@@ -203,2 +211,9 @@ const columnWs = [];

virtualTable.style.width = '';
if (virtualTable.offsetWidth < scrollX.clientWidth - this.props.columns.length ) {
// 获取列换的加了1,这个减掉
virtualTable.style.width = px(scrollX.clientWidth - this.props.columns.length );
}
const headerRow = virtualTable.querySelector('thead > tr');

@@ -228,2 +243,3 @@ const colgroup = virtualTable.querySelector('colgroup');

colgroup.children[i].style.width = px(width);
}

@@ -243,3 +259,3 @@ })

const { headerLeft, headerRight, body } = this.refs;
const { columns, prefixCls } = this.props;
const { columns } = this.props;

@@ -311,3 +327,2 @@ const fixedHeaders = [headerLeft, headerRight].filter(i => !!i);

this.refs.body.style.overflowY = 'hidden';
this.table.querySelector(`.${prefixCls}-fixed--right`).style.right = 0;
this.table.style.height = px(this.refs.scrollX.offsetHeight);

@@ -337,3 +352,2 @@ } else {

var hOffsetRatio = 1, vOffsetRatio = 1;
if (contentHeight <= bodyHeight) {

@@ -352,3 +366,3 @@ vScrollPanel.style.visibility = 'hidden';

var hScrollPanelWidth = hScrollPanel.offsetWidth;
var hScrollBarWidth = hScrollPanelWidth * bodyWidth / contentWidth;
var hScrollBarWidth = Math.max(hScrollPanelWidth * bodyWidth / contentWidth, 20);
hOffsetRatio = (contentWidth - bodyWidth) / (hScrollPanelWidth - hScrollBarWidth);

@@ -359,3 +373,3 @@ }

var vScrollPanelHeight = vScrollPanel.offsetHeight;
var vScrollBarHeight = vScrollPanelHeight * bodyHeight / contentHeight;
var vScrollBarHeight = Math.max(vScrollPanelHeight * bodyHeight / contentHeight, 20);
vOffsetRatio = (contentHeight - bodyHeight) / (vScrollPanelHeight - vScrollBarHeight);

@@ -367,4 +381,4 @@ }

var left = Math.round(this.refs.scrollX.scrollLeft + offsetX);
var top = Math.round(this.refs.body.scrollTop + offsetY);
var left = this.refs.scrollX.scrollLeft + offsetX;
var top = this.refs.body.scrollTop + offsetY;
// hasOffset 用来判断 wheel 已经滑到边缘,这样可以不用 preventDefault 和 stopPropagation wheel 的事件,让外层的滚动元素起作用

@@ -562,3 +576,3 @@ var hasOffset = true;

>
<div ref="vScrollBar" onMouseDown={this.vScrollBarMouseDown} className={`${prefixCls}__vscroll__bar`} />
<div ref="vScrollBar" className={`${prefixCls}__vscroll__bar`} onMouseDown={this.vScrollBarMouseDown} />
</div>

@@ -570,3 +584,3 @@

>
<div ref="hScrollBar" onMouseDown={this.hScrollBarMouseDown} className={`${prefixCls}__hscroll__bar`} />
<div ref="hScrollBar" className={`${prefixCls}__hscroll__bar`} onMouseDown={this.hScrollBarMouseDown} />
</div>

@@ -573,0 +587,0 @@ {this.props.children}

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

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