UNPKG

material-datatable

Version:
1 lines 54.8 kB
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var React=_interopDefault(require("react")),propTypes=_interopDefault(require("prop-types")),Paper=_interopDefault(require("@material-ui/core/Paper")),Table=_interopDefault(require("@material-ui/core/Table")),Typography=_interopDefault(require("@material-ui/core/Typography")),Toolbar=_interopDefault(require("@material-ui/core/Toolbar")),Tooltip=_interopDefault(require("@material-ui/core/Tooltip")),IconButton=_interopDefault(require("@material-ui/core/IconButton")),Popover=_interopDefault(require("@material-ui/core/Popover")),reactDom=require("react-dom"),classNames=_interopDefault(require("classnames")),FormControl=_interopDefault(require("@material-ui/core/FormControl")),FormGroup=_interopDefault(require("@material-ui/core/FormGroup")),FormControlLabel=_interopDefault(require("@material-ui/core/FormControlLabel")),InputLabel=_interopDefault(require("@material-ui/core/InputLabel")),Input=_interopDefault(require("@material-ui/core/Input")),MenuItem=_interopDefault(require("@material-ui/core/MenuItem")),Select=_interopDefault(require("@material-ui/core/Select")),Checkbox=_interopDefault(require("@material-ui/core/Checkbox")),ListItemText=_interopDefault(require("@material-ui/core/ListItemText")),styles=require("@material-ui/core/styles"),Grow=_interopDefault(require("@material-ui/core/Grow")),TextField=_interopDefault(require("@material-ui/core/TextField")),SearchIcon=_interopDefault(require("@material-ui/icons/Search")),ClearIcon=_interopDefault(require("@material-ui/icons/Clear")),DownloadIcon=_interopDefault(require("@material-ui/icons/CloudDownload")),PrintIcon=_interopDefault(require("@material-ui/icons/Print")),ViewColumnIcon=_interopDefault(require("@material-ui/icons/ViewColumn")),FilterIcon=_interopDefault(require("@material-ui/icons/FilterList")),ReactToPrint=_interopDefault(require("react-to-print")),merge=_interopDefault(require("lodash.merge")),DeleteIcon=_interopDefault(require("@material-ui/icons/Delete")),Chip=_interopDefault(require("@material-ui/core/Chip")),TableBody=_interopDefault(require("@material-ui/core/TableBody")),TableCell=_interopDefault(require("@material-ui/core/TableCell")),TableRow=_interopDefault(require("@material-ui/core/TableRow")),TableHead=_interopDefault(require("@material-ui/core/TableHead")),TableSortLabel=_interopDefault(require("@material-ui/core/TableSortLabel")),TableFooter=_interopDefault(require("@material-ui/core/TableFooter")),TablePagination=_interopDefault(require("@material-ui/core/TablePagination")),cloneDeep=_interopDefault(require("lodash.clonedeep")),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function o(e,t){for(var a=0;a<t.length;a++){var o=t[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,t,a){return t&&o(e.prototype,t),a&&o(e,a),e}}(),defineProperty=function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},inherits=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)},objectWithoutProperties=function(e,t){var a={};for(var o in e)0<=t.indexOf(o)||Object.prototype.hasOwnProperty.call(e,o)&&(a[o]=e[o]);return a},possibleConstructorReturn=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},slicedToArray=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],o=!0,n=!1,r=void 0;try{for(var l,i=e[Symbol.iterator]();!(o=(l=i.next()).done)&&(a.push(l.value),!t||a.length!==t);o=!0);}catch(e){n=!0,r=e}finally{try{!o&&i.return&&i.return()}finally{if(n)throw r}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)},MaterialPopoverContent=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){return this.props.children}}]),t}(React.Component),MaterialPopoverTarget=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){var a=this;return React.Children.map(this.props.children,function(e,t){return React.cloneElement(e,{key:t,ref:a.props.targetRef,onClick:a.props.onClick})})}}]),t}(React.Component),MaterialPopover=function(e){function l(){var e,t,a;classCallCheck(this,l);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=a=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).state={open:!1},a.handleClick=function(){a.anchorEl=reactDom.findDOMNode(a.anchorEl),a.setState({open:!0})},a.handleRequestClose=function(e){a.setState({open:!1},e&&"function"==typeof e?e():function(){})},a.handleOnExit=function(){a.props.refExit&&a.props.refExit()},possibleConstructorReturn(a,t)}return inherits(l,e),createClass(l,[{key:"componentWillMount",value:function(){this.anchorEl=null}},{key:"componentDidMount",value:function(){this.props.refClose&&this.props.refClose(this.handleRequestClose)}},{key:"componentDidUpdate",value:function(e,t){!0===this.state.open&&(this.anchorEl=reactDom.findDOMNode(this.anchorEl),this.popoverActions.updatePosition())}},{key:"render",value:function(){var n=this,r=[],e=this.props,t=(e.className,e.placement,e.refClose,e.refExit,e.children),l=objectWithoutProperties(e,["className","placement","refClose","refExit","children"]);return React.Children.map(t,function(e,t){if(e.type===MaterialPopoverContent||e.type===React.createElement(MaterialPopoverContent,null).type){var a=React.createElement(Popover,_extends({action:function(e){return n.popoverActions=e},key:t,elevation:2,open:n.state.open,onClose:n.handleRequestClose,onExited:n.handleOnExit,anchorEl:n.anchorEl,ref:function(e){return n.popoverEl},anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},l),e);r.push(a)}else if(e.type===MaterialPopoverTarget||e.type===React.createElement(MaterialPopoverTarget,null).type){var o=React.cloneElement(e,{key:t,targetRef:function(e){return n.anchorEl=e},onClick:n.handleClick});r.push(o)}}),r}}]),l}(React.Component),defaultFilterStyles={root:{padding:"16px 24px 16px 24px",fontFamily:"Roboto"},header:{flex:"0 0 auto",marginBottom:"16px",width:"100%",display:"flex",justifyContent:"space-between"},title:{display:"inline-block",marginLeft:"7px",color:"#424242",fontSize:"14px",fontWeight:500},noMargin:{marginLeft:"0px"},reset:{alignSelf:"left"},resetLink:{color:"#027cb5",backgroundColor:"#FFF",display:"inline-block",marginLeft:"24px",fontSize:"12px",cursor:"pointer",border:"none","&:hover":{color:"#FF0000"}},filtersSelected:{alignSelf:"right"},checkboxList:{flex:"1 1 100%",display:"inline-flex",marginRight:"24px"},checkboxListTitle:{marginLeft:"7px",marginBottom:"8px",fontSize:"14px",textAlign:"left",fontWeight:500},checkboxFormGroup:{marginTop:"8px"},checkboxFormControl:{margin:"0px"},checkboxFormControlLabel:{fontSize:"15px",marginLeft:"8px"},checkboxIcon:{width:"32px",height:"32px"},checkbox:{"&$checked":{color:"#027cB5"}},checked:{},selectRoot:{display:"flex",marginTop:"16px",flexDirection:"row",flexWrap:"wrap",width:"100%",height:"80%",justifyContent:"space-between"},selectFormControl:{flex:"1 1 calc(50% - 24px)",marginRight:"24px",marginBottom:"24px",minWidth:70}},MaterialDatatableFilter=function(e){function l(){var e,t,o;classCallCheck(this,l);for(var a=arguments.length,n=Array(a),r=0;r<a;r++)n[r]=arguments[r];return(t=o=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).handleCheckboxChange=function(e,t){o.props.onFilterUpdate(e,t,"checkbox")},o.handleDropdownChange=function(e,t){var a="All"===e.target.value?"":e.target.value;o.props.onFilterUpdate(t,a,"dropdown")},o.handleMultiselectChange=function(e,t){o.props.onFilterUpdate(e,t,"multiselect")},possibleConstructorReturn(o,t)}return inherits(l,e),createClass(l,[{key:"renderCheckbox",value:function(e){var o=this,t=this.props,n=t.classes,r=t.filterData,l=t.filterList;return e.map(function(e,a){return!!e.filter&&React.createElement("div",{className:n.checkboxList,key:a},React.createElement(FormGroup,null,React.createElement(Typography,{variant:"caption",className:n.checkboxListTitle},e.name),r[a].map(function(e,t){return React.createElement(FormControlLabel,{key:t,classes:{root:n.checkboxFormControl,label:n.checkboxFormControlLabel},control:React.createElement(Checkbox,{className:n.checkboxIcon,onChange:o.handleCheckboxChange.bind(null,a,e),checked:0<=l[a].indexOf(e),classes:{root:n.checkbox,checked:n.checked},value:null!==e?e.toString():""}),label:e})})))})}},{key:"renderSelect",value:function(e){var a=this,t=this.props,o=t.classes,n=t.filterData,r=t.filterList,l=t.options.textLabels.filter;return React.createElement("div",{className:o.selectRoot},e.map(function(e,t){return!!e.filter&&React.createElement(FormControl,{className:o.selectFormControl,key:t},React.createElement(InputLabel,{htmlFor:e.name},e.name),React.createElement(Select,{value:r[t][0]||l.all,name:e.name,onChange:function(e){return a.handleDropdownChange(e,t)},input:React.createElement(Input,{name:e.name,id:e.name})},React.createElement(MenuItem,{value:l.all,key:0},l.all),n[t].map(function(e,t){return React.createElement(MenuItem,{value:e,key:t+1},null!==e?e.toString():"")})))}))}},{key:"renderMultiselect",value:function(e){var t=this,a=this.props,o=a.classes,n=a.filterData,r=a.filterList;a.options;return React.createElement("div",{className:o.selectRoot},e.map(function(e,a){return!!e.filter&&React.createElement(FormControl,{className:o.selectFormControl,key:a},React.createElement(InputLabel,{htmlFor:e.name},e.name),React.createElement(Select,{multiple:!0,value:r[a]||[],renderValue:function(e){return e.join(", ")},name:e.name,onChange:function(e){return t.handleMultiselectChange(a,e.target.value)},input:React.createElement(Input,{name:e.name,id:e.name})},n[a].map(function(e,t){return null!=e&&React.createElement(MenuItem,{value:e,key:t+1},React.createElement(Checkbox,{checked:0<=r[a].indexOf(e),value:e.toString(),className:o.checkboxIcon,classes:{root:o.checkbox,checked:o.checked}}),React.createElement(ListItemText,{primary:e}))})))}))}},{key:"render",value:function(){var e,t=this.props,a=t.classes,o=t.columns,n=t.options,r=t.onFilterReset,l=n.textLabels.filter;return React.createElement("div",{className:a.root},React.createElement("div",{className:a.header},React.createElement("div",{className:a.reset},React.createElement(Typography,{variant:"caption",className:classNames((e={},defineProperty(e,a.title,!0),defineProperty(e,a.noMargin,"checkbox"!==n.filterType),e))},l.title),React.createElement("button",{className:a.resetLink,tabIndex:0,"aria-label":l.reset,onClick:r},l.reset)),React.createElement("div",{className:a.filtersSelected})),"checkbox"===n.filterType?this.renderCheckbox(o):"multiselect"===n.filterType?this.renderMultiselect(o):this.renderSelect(o))}}]),l}(React.Component),MaterialDatatableFilter$1=styles.withStyles(defaultFilterStyles,{name:"MaterialDatatableFilter"})(MaterialDatatableFilter),defaultViewColStyles={root:{padding:"16px 24px 16px 24px",fontFamily:"Roboto"},title:{marginLeft:"-7px",fontSize:"14px",textAlign:"left",fontWeight:500},formGroup:{marginTop:"8px"},formControl:{},checkbox:{width:"32px",height:"32px"},checkboxRoot:{"&$checked":{color:"#027cb5"}},checked:{},label:{fontSize:"15px",marginLeft:"8px"}},MaterialDatatableViewCol=function(e){function l(){var e,t,a;classCallCheck(this,l);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=a=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).handleColChange=function(e){a.props.onColumnUpdate(e)},possibleConstructorReturn(a,t)}return inherits(l,e),createClass(l,[{key:"render",value:function(){var a=this,e=this.props,o=e.classes,t=e.columns,n=e.options.textLabels.viewColumns;return React.createElement(FormControl,{component:"fieldset",className:o.root,"aria-label":n.titleAria},React.createElement(Typography,{variant:"caption",className:o.title},n.title),React.createElement(FormGroup,{className:o.formGroup},t.map(function(e,t){return"excluded"!==e.display&&React.createElement(FormControlLabel,{key:t,classes:{root:o.formControl,label:o.label},control:React.createElement(Checkbox,{className:o.checkbox,classes:{root:o.checkboxRoot,checked:o.checked},onChange:a.handleColChange.bind(null,t),checked:"true"===e.display,value:e.name}),label:e.name})})))}}]),l}(React.Component),MaterialDatatableViewCol$1=styles.withStyles(defaultViewColStyles,{name:"MaterialDatatableViewCol"})(MaterialDatatableViewCol),defaultSearchStyles={main:{display:"flex",flex:"1 0 auto"},searchIcon:{marginTop:"10px",marginRight:"8px"},searchText:{flex:"0.8 0"},clearIcon:{"&:hover":{color:"#FF0000"}}},MaterialDatatableSearch=function(e){function l(){var e,t,a;classCallCheck(this,l);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=a=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).handleTextChange=function(e){var t=a.props.options.onSearchChange;t&&t(e.target.value),a.props.onSearch(e.target.value)},a.onKeyDown=function(e){27===e.keyCode&&a.props.onHide()},possibleConstructorReturn(a,t)}return inherits(l,e),createClass(l,[{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.onKeyDown,!1)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.onKeyDown,!1)}},{key:"render",value:function(){var t=this,e=this.props,a=e.classes,o=e.options,n=e.onHide;return React.createElement(Grow,{appear:!0,in:!0,timeout:300},React.createElement("div",{className:a.main,ref:function(e){return t.rootRef=e}},React.createElement(SearchIcon,{className:a.searchIcon}),React.createElement(TextField,{className:a.searchText,value:null!==this.props.searchText&&null!==this.props.searchText?this.props.searchText:"",autoFocus:!0,InputProps:{"aria-label":o.textLabels.toolbar.search},onChange:this.handleTextChange,fullWidth:!0,inputRef:function(e){return t.searchField=e}}),React.createElement(IconButton,{className:a.clearIcon,onClick:n},React.createElement(ClearIcon,null))))}}]),l}(React.Component),MaterialDatatableSearch$1=styles.withStyles(defaultSearchStyles,{name:"MaterialDatatableSearch"})(MaterialDatatableSearch),styles$1=function(e,t,a){return"function"==typeof a?a(e,t):a},StyledComponent=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){var e=this.props,t=e.classes,a=e.className,o=void 0===a?"":a,n=e.WrappedComponent,r=objectWithoutProperties(e,["classes","className","WrappedComponent"]);return React.createElement(n,_extends({classes:t,className:o},r))}}]),t}(React.Component),styled=function(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function(o){var a,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return a=e,function(e){function t(a){classCallCheck(this,t);var e=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a));return e.FinalComponent=styles.withStyles(function(e){var t=styles$1(e,a,o);return merge(t,a.styles?a.styles:{})},n)(StyledComponent),e}return inherits(t,e),createClass(t,[{key:"render",value:function(){var e=this.props,t=(e.styles,objectWithoutProperties(e,["styles"]));return React.createElement(this.FinalComponent,_extends({},r,t,{WrappedComponent:a}))}}]),t}(React.Component)}},defaultToolbarStyles=function(e,t){return _extends({root:{},left:{flex:"1 1 55%"},actions:{flex:"0 0 45%",textAlign:"right"},titleRoot:{},titleText:{},icon:{"&:hover":{color:"#307BB0"}},iconActive:{color:"#307BB0"},searchIcon:{display:"inline-flex",marginTop:"10px",marginRight:"8px"}},t.options.responsive?_extends({},responsiveToolbarStyles):{})},responsiveToolbarStyles={"@media screen and (max-width: 960px)":{titleRoot:{},titleText:{fontSize:"16px"},spacer:{display:"none"},left:{padding:"8px 0px"},actions:{textAlign:"right"}},"@media screen and (max-width: 600px)":{root:{display:"block"},left:{padding:"8px 0px 0px 0px"},titleText:{textAlign:"center"},actions:{textAlign:"center"}},"@media screen and (max-width: 480px)":{}},MaterialDatatableToolbar=function(e){function r(){var e,t,u;classCallCheck(this,r);for(var a=arguments.length,o=Array(a),n=0;n<a;n++)o[n]=arguments[n];return(t=u=possibleConstructorReturn(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(o)))).state={iconActive:null,showSearch:!1},u.handleCSVDownload=function(){var e=u.props,t=e.data,a=e.columns,o=e.options,n=""+(a.reduce(function(e,t){return t.download?e+'"'+t.name+'"'+o.downloadOptions.separator:e},"").slice(0,-1)+"\r\n")+t.reduce(function(e,t){return e+'"'+t.data.filter(function(e,t){return a[t].download}).join('"'+o.downloadOptions.separator+'"')+'"\r\n'},[]).trim(),r=new Blob([n],{type:"text/csv"}),l="data:text/csv;charset=utf-8,"+n,i=window.URL||window.webkitURL,s=void 0===i.createObjectURL?l:i.createObjectURL(r),c=document.createElement("a");c.setAttribute("href",s),c.setAttribute("download",o.downloadOptions.filename),document.body.appendChild(c),c.click(),document.body.removeChild(c)},u.setActiveIcon=function(e){u.setState(function(){return{iconActive:e,showSearch:"search"===e}})},u.getActiveIcon=function(e,t){return u.state.iconActive!==t?e.icon:e.iconActive},u.hideSearch=function(){var e=u.props.options.onSearchClose;e&&e(),u.props.searchTextUpdate(null),u.setState(function(){return{iconActive:null,showSearch:!1}}),u.searchButton.focus()},possibleConstructorReturn(u,t)}return inherits(r,e),createClass(r,[{key:"render",value:function(){var t=this,e=this.props,a=e.data,o=e.options,n=e.classes,r=e.columns,l=e.filterData,i=e.filterList,s=e.filterUpdate,c=e.resetFilters,u=e.searchTextUpdate,p=e.toggleViewColumn,d=e.title,h=e.tableRef,f=e.searchText,m=o.textLabels.toolbar,b=m.search,y=m.downloadCsv,R=m.print,v=m.viewColumns,C=m.filterTable,g=this.state.showSearch;return React.createElement(Toolbar,{className:n.root,role:"toolbar","aria-label":"Table Toolbar"},React.createElement("div",{className:n.left},!0===g||null!=f?React.createElement(MaterialDatatableSearch$1,{searchText:f,onSearch:u,onHide:this.hideSearch,options:o}):React.createElement("div",{className:n.titleRoot,"aria-hidden":"true"},React.createElement(Typography,{variant:"h6",className:n.titleText},d))),React.createElement("div",{className:n.actions},!!o.search&&React.createElement(Tooltip,{title:b},React.createElement(IconButton,{"aria-label":b,buttonRef:function(e){return t.searchButton=e},classes:{root:this.getActiveIcon(n,"search")},onClick:this.setActiveIcon.bind(null,"search")},React.createElement(SearchIcon,null))),!!o.download&&React.createElement(Tooltip,{title:y},React.createElement(IconButton,{"aria-label":y,classes:{root:n.icon},onClick:this.handleCSVDownload},React.createElement(DownloadIcon,null))),!!o.print&&React.createElement(Tooltip,{title:R},React.createElement("span",null,React.createElement(ReactToPrint,{trigger:function(){return React.createElement(IconButton,{"aria-label":R,classes:{root:n.icon}},React.createElement(PrintIcon,null))},content:function(){return t.props.tableRef()}}))),!!o.viewColumns&&React.createElement(MaterialPopover,{refExit:this.setActiveIcon.bind(null),container:h},React.createElement(MaterialPopoverTarget,null,React.createElement(IconButton,{"aria-label":v,classes:{root:this.getActiveIcon(n,"viewcolumns")},onClick:this.setActiveIcon.bind(null,"viewcolumns")},React.createElement(Tooltip,{title:v},React.createElement(ViewColumnIcon,null)))),React.createElement(MaterialPopoverContent,null,React.createElement(MaterialDatatableViewCol$1,{data:a,columns:r,options:o,onColumnUpdate:p}))),!!o.filter&&React.createElement(MaterialPopover,{refExit:this.setActiveIcon.bind(null),container:h},React.createElement(MaterialPopoverTarget,null,React.createElement(IconButton,{"aria-label":C,classes:{root:this.getActiveIcon(n,"filter")},onClick:this.setActiveIcon.bind(null,"filter")},React.createElement(Tooltip,{title:C},React.createElement(FilterIcon,null)))),React.createElement(MaterialPopoverContent,null,React.createElement(MaterialDatatableFilter$1,{columns:r,options:o,filterList:i,filterData:l,onFilterUpdate:s,onFilterReset:c}))),!!o.customToolbar&&o.customToolbar()))}}]),r}(React.Component),MaterialDatatableToolbar$1=styled(MaterialDatatableToolbar)(defaultToolbarStyles,{name:"MaterialDatatableToolbar"}),defaultToolbarSelectStyles={root:{flex:"1 1 100%",display:"flex",height:"64px",justifyContent:"space-between"},title:{paddingLeft:"26px",top:"50%",position:"relative",transform:"translateY(-50%)"},iconButton:{marginRight:"24px",top:"50%",display:"block",position:"relative",transform:"translateY(-50%)"},deleteIcon:{color:"#000"}},MaterialDatatableToolbarSelect=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){var e=this.props,t=e.classes,a=e.onRowsDelete,o=e.selectedRows,n=e.options,r=n.textLabels.selectedRows;return React.createElement(Paper,{className:t.root},React.createElement("div",null,React.createElement(Typography,{variant:"subtitle1",className:t.title},o.data.length," ",r.text)),n.customToolbarSelect?n.customToolbarSelect(o):React.createElement(Tooltip,{title:r.delete},React.createElement(IconButton,{className:t.iconButton,onClick:a,"aria-label":r.deleteAria},React.createElement(DeleteIcon,{className:t.deleteIcon}))))}}]),t}(React.Component),MaterialDatatableToolbarSelect$1=styles.withStyles(defaultToolbarSelectStyles,{name:"MaterialDatatableToolbarSelect"})(MaterialDatatableToolbarSelect),defaultFilterListStyles={root:{display:"flex",justifyContent:"left",flexWrap:"wrap",margin:"0px 16px 0px 16px"},chip:{margin:"8px 8px 0px 0px"}},MaterialDatatableFilterList=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){var e=this.props,o=e.classes,t=e.filterList,n=e.filterUpdate;return React.createElement("div",{className:o.root},t.map(function(e,a){return e.map(function(e,t){return React.createElement(Chip,{label:e,key:t,onDelete:n.bind(null,a,e,"checkbox"),className:o.chip})})}))}}]),t}(React.Component),MaterialDatatableFilterList$1=styles.withStyles(defaultFilterListStyles,{name:"MaterialDatatableFilterList"})(MaterialDatatableFilterList),defaultBodyCellStyles={root:{},cellHide:{display:"none"},cellStacked:{"@media screen and (max-width: 960px)":{display:"inline-block",backgroundColor:"#FFF",fontSize:"16px",height:"24px",width:"calc(50% - 80px)",whiteSpace:"nowrap"}},responsiveStacked:{"@media screen and (max-width: 960px)":{display:"inline-block",fontSize:"16px",width:"calc(50% - 80px)",whiteSpace:"nowrap",height:"24px"}}},MaterialDatatableBodyCell=function(e){function l(){var e,t,r;classCallCheck(this,l);for(var a=arguments.length,o=Array(a),n=0;n<a;n++)o[n]=arguments[n];return(t=r=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(o)))).handleClick=function(){var e=r.props,t=e.colIndex,a=e.options,o=e.children,n=(e.dataIndex,e.rowIndex);a.onCellClick&&a.onCellClick(o,{colIndex:t,rowIndex:n})},possibleConstructorReturn(r,t)}return inherits(l,e),createClass(l,[{key:"render",value:function(){var e,t,a=this.props,o=a.children,n=a.classes,r=(a.colIndex,a.columnHeader),l=a.options,i=(a.dataIndex,a.rowIndex,objectWithoutProperties(a,["children","classes","colIndex","columnHeader","options","dataIndex","rowIndex"]));return[React.createElement(TableCell,{key:1,className:classNames((e={},defineProperty(e,n.root,!0),defineProperty(e,n.cellHide,!0),defineProperty(e,n.cellStacked,"stacked"===l.responsive),e))},r),React.createElement(TableCell,_extends({key:2,onClick:this.handleClick,className:classNames((t={},defineProperty(t,n.root,!0),defineProperty(t,n.responsiveStacked,"stacked"===l.responsive),t))},i),o)]}}]),l}(React.Component),MaterialDatatableBodyCell$1=styles.withStyles(defaultBodyCellStyles,{name:"MaterialDatatableBodyCell"})(MaterialDatatableBodyCell),defaultBodyRowStyles={root:{},responsiveStacked:{"@media screen and (max-width: 960px)":{border:"solid 2px rgba(0, 0, 0, 0.15)"}},cursorHover:{"&:hover":{cursor:"pointer"}}},MaterialDatatableBodyRow=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){var e,t=this.props,a=t.classes,o=t.options,n=t.rowSelected,r=t.onClick;return React.createElement(TableRow,{hover:o.rowHover,onClick:r,className:classNames((e={},defineProperty(e,a.root,!0),defineProperty(e,a.cursorHover,o.rowCursorHand),defineProperty(e,a.responsiveStacked,"stacked"===o.responsive),e)),selected:n},this.props.children)}}]),t}(React.Component),MaterialDatatableBodyRow$1=styles.withStyles(defaultBodyRowStyles,{name:"MaterialDatatableBodyRow"})(MaterialDatatableBodyRow),defaultSelectCellStyles={root:{"@media screen and (max-width: 960px)":{display:"none"},width:70},checkboxRoot:{"&$checked":{color:"#027cb5"}},checked:{},disabled:{}},MaterialDatatableSelectCell=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){var e=this.props,t=e.classes,a=objectWithoutProperties(e,["classes"]);return React.createElement(TableCell,{className:t.root,padding:"checkbox"},React.createElement(Checkbox,_extends({classes:{root:t.checkboxRoot,checked:t.checked,disabled:t.disabled}},a)))}}]),t}(React.Component),MaterialDatatableSelectCell$1=styles.withStyles(defaultSelectCellStyles,{name:"MaterialDatatableSelectCell"})(MaterialDatatableSelectCell),defaultBodyStyles={root:{},emptyTitle:{textAlign:"center"}},MaterialDatatableBody=function(e){function l(){var e,t,a;classCallCheck(this,l);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=a=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).handleRowSelect=function(e){a.props.selectRowUpdate("cell",e,null)},possibleConstructorReturn(a,t)}return inherits(l,e),createClass(l,[{key:"buildRows",value:function(){var e=this.props,t=e.data,a=e.page,o=e.rowsPerPage,n=e.count;if(this.props.options.serverSide)return t;var r=[],l=Math.floor(n/o),i=0===a?0:a*o,s=Math.min(n,(a+1)*o);if(l<a&&0!==l)throw new Error("Provided options.page of `"+a+"` is greater than the total available page length of `"+l+"`");for(var c=i;c<n&&c<s;c++)void 0!==t[c]&&r.push(t[c]);return r.length?r:null}},{key:"getRowIndex",value:function(e){var t=this.props,a=t.page,o=t.rowsPerPage;return t.options.serverSide?e:(0===a?0:a*o)+e}},{key:"isRowSelected",value:function(e){var t=this.props,a=t.selectedRows,o=t.options;return!(null==a||!o.selectableRows)&&!(!a.lookup||!a.lookup[e])}},{key:"onRowClick",value:function(e,t){this.props.selectRowUpdate("cell",t,e)}},{key:"render",value:function(){var r=this,e=this.props,t=e.classes,l=e.columns,i=e.options,a=this.buildRows();return React.createElement(TableBody,null,a?a.map(function(e,a){var t=e.data,o=e.dataIndex,n=e.dataObject;return React.createElement(MaterialDatatableBodyRow$1,{options:i,rowSelected:r.isRowSelected(o),onClick:function(){return r.onRowClick(n,{rowIndex:a,dataIndex:o})},id:"MaterialDatatableBodyRow-"+o,key:a},(i.selectableRows||i.onlyOneRowCanBeSelected)&&React.createElement(MaterialDatatableSelectCell$1,{checked:r.isRowSelected(o)}),t.map(function(e,t){return"true"===l[t].display&&React.createElement(MaterialDatatableBodyCell$1,{dataIndex:o,rowIndex:a,colIndex:t,columnHeader:l[t].name,options:i,key:t},e)}))}):React.createElement(MaterialDatatableBodyRow$1,{options:i},React.createElement(MaterialDatatableBodyCell$1,{colSpan:i.selectableRows?l.length+1:l.length,options:i,colIndex:0,rowIndex:0},React.createElement(Typography,{variant:"subtitle1",className:t.emptyTitle},i.textLabels.body.noMatch))))}}]),l}(React.Component),MaterialDatatableBody$1=styles.withStyles(defaultBodyStyles,{name:"MaterialDatatableBody"})(MaterialDatatableBody),defaultResizeStyles={root:{position:"absolute"},resizer:{position:"absolute",width:"1px",height:"100%",left:"100px",cursor:"ew-resize",border:"0.1px solid rgba(224, 224, 224, 1)"}},MaterialDatatableResize=function(e){function r(){var e,t,c;classCallCheck(this,r);for(var a=arguments.length,o=Array(a),n=0;n<a;n++)o[n]=arguments[n];return(t=c=possibleConstructorReturn(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(o)))).state={resizeCoords:{},startPosition:0,tableWidth:"100%",tableHeight:"100%"},c.handleReize=function(){window.innerWidth!==c.windowWidth&&(c.windowWidth=window.innerWidth,c.setDividers())},c.setCellRefs=function(e,t){c.cellsRef=e,c.tableRef=t,c.setDividers()},c.setDividers=function(){var e=reactDom.findDOMNode(c.tableRef).getBoundingClientRect(),t=e.width,a=e.height,l={};Object.entries(c.cellsRef).forEach(function(e){var t=slicedToArray(e,2),a=t[0],o=t[1],n=o.getBoundingClientRect(),r=window.getComputedStyle(o,null);l[a]={left:n.left+o.offsetWidth-parseInt(r.paddingLeft)/2}}),c.setState({tableWidth:t,tableHeight:a,resizeCoords:l},c.updateWidths())},c.updateWidths=function(){var r=0,e=c.state,t=e.resizeCoords,l=e.tableWidth;e.tableHeight;Object.entries(t).forEach(function(e){var t=slicedToArray(e,2),a=t[0],o=t[1],n=Number((o.left-r)/l*100).toFixed(2);o.percent=n,r=o.left,c.cellsRef[a].style.width=n+"%"})},c.onResizeStart=function(e,t){c.setState({isResize:!0,id:e,startPosition:t.clientX})},c.onResizeMove=function(e,t){var a=c.state,o=a.startPosition,n=a.isResize,r=a.resizeCoords;if(n){var l=o-(o-t.clientX),i=_extends({},r[e],{left:l}),s=_extends({},r,defineProperty({},e,i));c.setState({resizeCoords:s},c.updateWidths())}},c.onResizeEnd=function(e,t){c.setState({isResize:!1,id:null})},possibleConstructorReturn(c,t)}return inherits(r,e),createClass(r,[{key:"componentDidMount",value:function(){this.windowWidth=null,this.props.setResizeable(this.setCellRefs),window.addEventListener("resize",this.handleReize,!1)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleReize,!1)}},{key:"render",value:function(){var n=this,e=this.props,r=e.classes,t=(e.options,e.rowSelected,this.state),l=t.id,i=t.isResize,a=t.resizeCoords,s=t.tableWidth,c=t.tableHeight;return React.createElement("div",{className:r.root,style:{width:s}},Object.entries(a).map(function(e){var t=slicedToArray(e,2),a=t[0],o=t[1];return React.createElement("div",{"aria-hidden":"true",key:a,onMouseMove:n.onResizeMove.bind(null,a),onMouseUp:n.onResizeEnd.bind(null,a),style:{width:i&&l==a?s:"auto",position:"absolute",height:c,zIndex:1e3}},React.createElement("div",{"aria-hidden":"true",onMouseDown:n.onResizeStart.bind(null,a),className:r.resizer,style:{left:o.left}}))}))}}]),r}(React.Component),MaterialDatatableResize$1=styles.withStyles(defaultResizeStyles,{name:"MaterialDatatableResize"})(MaterialDatatableResize),defaultHeadRowStyles={root:{}},MaterialDatatableHeadRow=function(e){function t(){return classCallCheck(this,t),possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return inherits(t,e),createClass(t,[{key:"render",value:function(){var e=this.props.classes;return React.createElement(TableRow,{className:classNames(defineProperty({},e.root,!0))},this.props.children)}}]),t}(React.Component),MaterialDatatableHeadRow$1=styles.withStyles(defaultHeadRowStyles,{name:"MaterialDatatableHeadRow"})(MaterialDatatableHeadRow),defaultHeadCellStyles={root:{},tooltip:{cursor:"pointer"},mypopper:{"&[data-x-out-of-boundaries]":{display:"none"}},data:{display:"inline-block"},sortAction:{display:"inline-block",cursor:"pointer",paddingLeft:"4px",height:"10px"},sortActive:{color:"rgba(0, 0, 0, 0.87)"},toolButton:{height:"10px",outline:"none",cursor:"pointer"}},MaterialDatatableHeadCell=function(e){function l(){var e,t,a;classCallCheck(this,l);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=a=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).handleSortClick=function(){a.props.toggleSort(a.props.index)},possibleConstructorReturn(a,t)}return inherits(l,e),createClass(l,[{key:"render",value:function(){var e,t=this.props,a=t.children,o=t.classes,n=t.options,r=t.sortDirection,l=t.sort,i=t.width,s=t.headerNoWrap,c=null!=r,u=_extends({active:c},r?{direction:r}:{});return React.createElement(TableCell,{className:o.root,scope:"col",style:{width:i,whiteSpace:null!==s&&!0===s?"nowrap":"normal"},sortDirection:r},n.sort&&l?React.createElement(Tooltip,{title:n.textLabels.body.toolTip,placement:"bottom-end",enterDelay:300,classes:{popper:o.mypopper,tooltip:o.tooltip}},React.createElement("span",{role:"button",onKeyUp:function(){},onClick:this.handleSortClick,className:o.toolButton,tabIndex:0},React.createElement("div",{className:classNames((e={},defineProperty(e,o.data,!0),defineProperty(e,o.sortActive,c),e))},a),React.createElement("div",{className:o.sortAction},React.createElement(TableSortLabel,u)))):a)}}]),l}(React.Component),MaterialDatatableHeadCell$1=styles.withStyles(defaultHeadCellStyles,{name:"MaterialDatatableHeadCell"})(MaterialDatatableHeadCell),defaultHeadStyles={main:{},responsiveStacked:{"@media screen and (max-width: 960px)":{display:"none"}}},MaterialDatatableHead=function(e){function l(){var e,t,a;classCallCheck(this,l);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=a=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).handleToggleColumn=function(e){a.props.toggleSort(e)},a.handleRowSelect=function(){a.props.selectRowUpdate("head",null,null)},possibleConstructorReturn(a,t)}return inherits(l,e),createClass(l,[{key:"render",value:function(){var e,a=this,t=this.props,o=t.classes,n=t.columns,r=t.count,l=t.options,i=t.setCellRef,s=t.selectedRows,c=s&&s.data.length||0,u=0<c&&c<r,p=c===r;return React.createElement(TableHead,{className:classNames((e={},defineProperty(e,o.responsiveStacked,"stacked"===l.responsive),defineProperty(e,o.main,!0),e))},React.createElement(MaterialDatatableHeadRow$1,null,l.selectableRows&&!1===l.onlyOneRowCanBeSelected&&React.createElement(MaterialDatatableSelectCell$1,{ref:function(e){return i(0,reactDom.findDOMNode(e))},onChange:function(){return a.handleRowSelect(null)},indeterminate:u,checked:p}),l.selectableRows&&!0===l.onlyOneRowCanBeSelected&&React.createElement(TableCell,{style:{width:70},padding:"checkbox"}),n.map(function(e,t){return"true"===e.display&&(e.customHeadRender?e.customHeadRender(_extends({index:t},e),a.handleToggleColumn):React.createElement(MaterialDatatableHeadCell$1,{key:t,index:t,type:"cell",ref:function(e){return i(t+1,reactDom.findDOMNode(e))},sort:e.sort,width:e.width,headerNoWrap:e.headerNoWrap,sortDirection:e.sortDirection,toggleSort:a.handleToggleColumn,options:l},e.name))})))}}]),l}(React.Component),MaterialDatatableHead$1=styles.withStyles(defaultHeadStyles,{name:"MaterialDatatableHead"})(MaterialDatatableHead),defaultPaginationStyles={root:{"&:last-child":{padding:"0px 24px 0px 24px"}},toolbar:{},selectRoot:{},"@media screen and (max-width: 400px)":{toolbar:{"& span:nth-child(2)":{display:"none"}},selectRoot:{marginRight:"8px"}}},MaterialDatatablePagination=function(e){function l(){var e,t,a;classCallCheck(this,l);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=a=possibleConstructorReturn(this,(e=l.__proto__||Object.getPrototypeOf(l)).call.apply(e,[this].concat(n)))).handleRowChange=function(e){a.props.changeRowsPerPage(e.target.value)},a.handlePageChange=function(e,t){a.props.options;a.props.changePage(t)},possibleConstructorReturn(a,t)}return inherits(l,e),createClass(l,[{key:"render",value:function(){var e=this.props,t=e.count,a=e.classes,o=e.options,n=e.rowsPerPage,r=e.page,l=o.textLabels.pagination;return React.createElement(TableFooter,null,React.createElement(TableRow,null,React.createElement(TablePagination,{className:a.root,classes:{caption:a.caption,toolbar:a.toolbar,selectRoot:a.selectRoot},count:t,rowsPerPage:n,page:r,labelRowsPerPage:l.rowsPerPage,labelDisplayedRows:function(e){var t=e.from,a=e.to,o=e.count;return t+"-"+a+" "+l.displayRows+" "+o},backIconButtonProps:{"aria-label":l.previous},nextIconButtonProps:{"aria-label":l.next},rowsPerPageOptions:o.rowsPerPageOptions,onChangePage:this.handlePageChange,onChangeRowsPerPage:this.handleRowChange})))}}]),l}(React.Component),MaterialDatatablePagination$1=styles.withStyles(defaultPaginationStyles,{name:"MaterialDatatablePagination"})(MaterialDatatablePagination),textLabels={body:{noMatch:"Sorry, no matching records found",toolTip:"Sort"},pagination:{next:"Next Page",previous:"Previous Page",rowsPerPage:"Rows per page:",displayRows:"of"},toolbar:{search:"Search",downloadCsv:"Download CSV",print:"Print",viewColumns:"View Columns",filterTable:"Filter Table"},filter:{all:"All",title:"FILTERS",reset:"RESET"},viewColumns:{title:"Show Columns",titleAria:"Show/Hide Table Columns"},selectedRows:{text:"rows(s) selected",delete:"Delete",deleteAria:"Delete Selected Rows"}},defaultTableStyles={root:{},responsiveScroll:{overflowX:"auto"},caption:{position:"absolute",left:"-1000px"},liveAnnounce:{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}},TABLE_LOAD={INITIAL:1,UPDATE:2},MaterialDatatable$1=function(e){function t(e){classCallCheck(this,t);var p=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return p.state={announceText:null,activeColumn:null,data:[],displayData:[],notModifiedDisplayData:[],page:0,rowsPerPage:10,columns:[],filterData:[],filterList:[],selectedRows:{data:[],lookup:{}},rowsSelected:[],sortColumnIndex:null,sortColumnDirection:null,showResponsive:!1,searchText:null},p.setTableAction=function(e){"function"==typeof p.options.onTableChange&&p.options.onTableChange(e,p.state)},p.setHeadCellRef=function(e,t){p.headCellRefs[e]=t},p.updateDataCol=function(s,c,u){p.setState(function(e){var t=cloneDeep(e.data),a=cloneDeep(e.filterData),o=e.data[s][c],n=p.getTableMeta(s,c,s,e.columns[c],e.data,e),r=e.columns[c].customBodyRender(u,n);React.isValidElement(r)&&r.props.value?o=r.props.value:"function"==typeof e.columns[c].customValue&&(o=e.columns[c].customValue(u)),null==o&&(o="");var l=a[c].indexOf(o);if(a[c].splice(l,1,o),t[s].data[c]=u,p.options.sortFilterList){var i=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});a[c].sort(i.compare)}return{data:t,filterData:a,displayData:p.getDisplayData(e.columns,t,e.filterList,e.searchText)}})},p.getTableMeta=function(e,t,a,o,n,r){r.columns,r.data,r.displayData,r.filterData;return{rowIndex:e,columnIndex:t,columnData:o,rowData:a,tableData:n,tableState:objectWithoutProperties(r,["columns","data","displayData","filterData"])}},p.toggleViewColumn=function(a){p.setState(function(e){var t=cloneDeep(e.columns);return t[a].display="true"===t[a].display?"false":"true",{columns:t}},function(){p.setTableAction("columnViewChange"),p.options.onColumnViewChange&&p.options.onColumnViewChange(p.state.columns[a].name,"true"===p.state.columns[a].display?"add":"remove")})},p.changeRowsPerPage=function(e){var t=p.options.count||p.state.displayData.length,a=Math.max(0,Math.ceil(t/e)-1);p.setState(function(){return{page:Math.min(p.state.page,a),rowsPerPage:e}},function(){p.setTableAction("changeRowsPerPage"),p.options.onChangeRowsPerPage&&p.options.onChangeRowsPerPage(p.state.rowsPerPage)})},p.changePage=function(e){p.setState(function(){return{page:e}},function(){p.setTableAction("changePage"),p.options.onChangePage&&p.options.onChangePage(p.state.page)})},p.searchTextUpdate=function(t){p.setState(function(e){return{searchText:t&&t.length?t:null,page:0,displayData:p.options.serverSide?e.displayData:p.getDisplayData(e.columns,e.data,e.filterList,t)}},function(){p.setTableAction("search")})},p.resetFilters=function(){p.setState(function(e){var t=e.columns.map(function(e,t){return[]});return{filterList:t,displayData:p.options.serverSide?e.displayData:p.getDisplayData(e.columns,e.data,t,e.searchText)}},function(){p.setTableAction("resetFilters"),p.options.onFilterChange&&p.options.onFilterChange(null,p.state.filterList)})},p.filterUpdate=function(o,n,r){p.setState(function(e){var t=cloneDeep(e.filterList),a=t[o].indexOf(n);switch(r){case"checkbox":0<=a?t[o].splice(a,1):t[o].push(n);break;case"multiselect":t[o]=""===n?[]:n;break;default:t[o]=0<=a||""===n?[]:[n]}return{filterList:t,displayData:p.options.serverSide?e.displayData:p.getDisplayData(e.columns,e.data,t,e.searchText)}},function(){p.setTableAction("filterChange"),p.options.onFilterChange&&p.options.onFilterChange(n,p.state.filterList)})},p.selectRowDelete=function(){var e=p.state,t=e.selectedRows,a=e.data,o=e.filterList,n=p.buildSelectedMap(t.data),r=a.filter(function(e,t){return!n[t]});p.options.onRowsDelete&&p.options.onRowsDelete(t),p.setTableData({columns:p.props.columns,data:r,options:{filterList:o}},TABLE_LOAD.UPDATE,function(){p.setTableAction("rowDelete")})},p.buildSelectedMap=function(e){return e.reduce(function(e,t){return e[t.dataIndex]=!0,e},{})},p.selectRowUpdate=function(e,l,t){"head"===e?p.setState(function(e){if(!1===p.options.selectableRows)return e;var a=e.data,t=e.selectedRows.data.length,o=t===a.length||t<a.length&&0<t,n=Array(a.length).fill().map(function(e,t){return{index:t,dataIndex:a[t].index}}),r=[].concat(toConsumableArray(e.selectedRows),toConsumableArray(n)),l=p.buildSelectedMap(r);o&&(r=e.selectedRows.data.filter(function(e){var t=e.index;return!l[t]}),l=p.buildSelectedMap(r));var i=r.map(function(e){return e.dataIndex});return{curSelectedRows:r,selectedRows:{data:r,lookup:l},rowsSelected:i}},function(){p.setTableAction("rowsSelect"),p.options.onRowsSelect&&p.options.onRowsSelect(p.state.curSelectedRows,p.state.selectedRows.data)}):"cell"===e&&p.setState(function(e){if(!1===p.options.selectableRows)return e;for(var t=l.dataIndex,a=[].concat(toConsumableArray(e.selectedRows.data)),o=-1,n=0;n<a.length;n++)if(a[n].dataIndex===t){o=n;break}p.options.onlyOneRowCanBeSelected&&(a=[]),0<=o?a.splice(o,1):a.push(l);var r=a.map(function(e){return e.dataIndex});return{selectedRows:{lookup:p.buildSelectedMap(a),data:a},rowsSelected:r}},function(){p.setTableAction("rowsSelect"),p.options.onRowsSelect&&p.options.selectableRows&&p.options.onRowsSelect([l],p.state.selectedRows.data),p.options.onRowClick&&p.options.onRowClick(t,l)})},p.tableRef=!1,p.headCellRefs={},p.setHeadResizeable=function(){},p}return inherits(t,e),createClass(t,[{key:"componentWillMount",value:function(){this.initializeTable(this.props)}},{key:"componentDidMount",value:function(){this.setHeadResizeable(this.headCellRefs,this.tableRef),this.setInitialSort(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.props.data===e.data&&this.props.columns===e.columns||void 0!==this.props.options&&void 0!==this.props.options.componentWillReceiveProps&&!0!==this.props.options.componentWillReceiveProps||(this.initializeTable(e),this.setInitialSort(e))}},{key:"initializeTable",value:function(e){this.getDefaultOptions(e),this.setTableOptions(e),this.setTableData(e,TABLE_LOAD.INITIAL)}},{key:"setInitialSort",value:function(e){null!==e.options.sortColumnIndex&&void 0!==e.options.sortColumnIndex&&null!==e.options.sortColumnDirection&&void 0!==e.options.sortColumnDirection&&0<=e.options.sortColumnIndex&&e.options.sortColumnIndex<e.columns.length&&("asc"===e.options.sortColumnDirection||"desc"===e.options.sortColumnDirection)&&this.sortTableData(e.options.sortColumnIndex,e.options.sortColumnDirection,!1)}},{key:"getDefaultOptions",value:function(e){var t={responsive:"stacked",filterType:"checkbox",usePaperPlaceholder:!0,pagination:!0,textLabels:textLabels,resizableColumns:!1,selectableRows:!0,rowCursorHand:!1,onlyOneRowCanBeSelected:!1,showSelectedRowsToolbar:!0,caseSensitive:!1,serverSide:!1,rowHover:!0,rowsPerPage:10,rowsPerPageOptions:[10,15,100],filter:!0,sortFilterList:!0,sort:!0,sortColumnIndex:null,sortColumnDirection:null,search:!0,searchText:null,print:!0,viewColumns:!0,download:!0,componentWillReceiveProps:!0,downloadOptions:{filename:"tableDownload.csv",separator:","}};this.options=merge(t,e.options)}},{key:"validateOptions",value:function(e){if(e.serverSide&&void 0===e.onTableChange)throw Error("onTableChange callback must be provided when using serverSide option")}},{key:"setTableOptions",value:function(e){var t=_extends({},this.state,e.options);this.setState(t)}},{key:"setTableData",value:function(e,c){var u=this,t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(){},p=e.data,d=e.columns,a=e.options,h=this.state.columns,f=[],m=[],b=[],y=[],R=[];if(d.forEach(function(e,t){var a={display:"true",filter:!0,sort:!0,download:!0,sortDirection:null,width:null,headerNoWrap:null};"object"===(void 0===e?"undefined":_typeof(e))?(e.options&&void 0!==e.options.display?e.options.display=e.options.display.toString():void 0!==h&&h.length===d.length&&h[t].name===e.name&&(a.display=h[t].display.toString()),e.options&&void 0!==e.options.sortDirection?e.options.sortDirection=e.options.sortDirection.toString():void 0!==h&&h.length===d.length&&h[t].name===e.name&&null!==h[t].sortDirection&&(a.sortDirection=h[t].sortDirection),a=_extends({name:e.name,field:e.field},a,e.options?e.options:{})):a=_extends({},a,{name:e}),f.push(a),m[t]=[],b[t]=[],y[t]=[];for(var o=0;o<p.length;o++){var n=c===TABLE_LOAD.INITIAL?p[o]:p[o].data,r=n[d[t].field];if(void 0===R[o]&&R.push({index:c===TABLE_LOAD.INITIAL?o:p[o].index,data:c===TABLE_LOAD.INITIAL?p[o]:p[o].data}),"function"==typeof a.customBodyRender){var l=u.getTableMeta(o,t,n,[],f,u.state),i=a.customBodyRender(n,l);r=i,React.isValidElement(i)&&i.props.value?r=i.props.value:"function"==typeof a.customValue&&(r=a.customValue(n)),(null==r||React.isValidElement(r))&&(r="")}m[t].indexOf(r)<0&&m[t].push(r)}if(u.options.sortFilterList){var s=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});m[t].sort(s.compare)}}),a.filterList&&(b=a.filterList),b.length!==d.length)throw new Error("Provided options.filterList does not match the column length");var o={data:[],lookup:{}};TABLE_LOAD.INITIAL&&a.rowsSelected&&a.rowsSelected.length&&a.rowsSelected.forEach(function(e){o.data.push({index:e,dataIndex:e}),o.lookup[e]=!0}),this.setState(function(e){return{columns:f,filterData:m,filterList:b,selectedRows:o,data:R,displayData:u.getDisplayData(f,R,b,e.searchText),notModifiedDisplayData:u.getDisplayData(f,R,y,"")}},t)}},{key:"computeDisplayRow",value:function(e,t,a,o,n){for(var r=!1,l=!1,i=[],s=0;s<e.length;s++){var c="",u="";if(e[s].customBodyRender){var p=this.getTableMeta(a,s,t,e[s],this.state.data,_extends({},this.state,{filterList:o,searchText:n})),d=e[s].customBodyRender(t,p,this.updateDataCol.bind(null,a,s));u=c=d,React.isValidElement(d)&&d.props.value?u=d.props.value:"function"==typeof e[s].customValue&&(u=e[s].customValue(t)),(null==u||React.isValidElement(u))&&(u="")}else if(c=t[e[s].field],void 0===(u=t[e[s].field])||void 0===c){var h="Wrong column name "+e[s].field;u=c=h}i.push(c),o[s].length&&o[s].indexOf(u)<0&&(r=!0);var f=null===u?"":u.toString();if(n){var m=n.toString(),b=f.toString();this.options.caseSensitive||(m=m.toLowerCase(),b=b.toLowerCase()),0<=b.indexOf(m)&&(l=!0)}}return r||n&&!l?null:i}},{key:"getDisplayData",value:function(e,t,a,o){for(var n=[],r=0;r<t.length;r++){var l=t[r].data,i=this.computeDisplayRow(e,l,r,a,o);i&&n.push({data:i,dataObject:l,dataIndex:void 0!==t[r].dataIndex?t[r].dataIndex:r})}return n}},{key:"getSortDirection",value:function(e){return"asc"===e.sortDirection?"ascending":"descending"}},{key:"sortTableData",value:function(s,c,e){var u=this;this.setState(function(e){for(var t=cloneDeep(e.columns),a=e.data,o=e.notModifiedDisplayData,n=0;n<t.length;n++)t[n].sortDirection=s!==n?null:c;var r=u.getSortDirection(t[s]),l={columns:t,announceText:"Table now sorted by "+t[s].name+" : "+r,activeColumn:s,sortColumnIndex:s,sortColumnDirection:c};if(u.options.serverSide)l=_extends({},l,{data:e.data,displayData:e.displayData,selectedRows:e.selectedRows});else{var i=u.sortTable(a,s,c,o,t[s]);l=_extends({},l,{data:i.data,displayData:u.getDisplayData(t,i.data,e.filterList,e.searchText),selectedRows:i.selectedRows})}return l},functi