"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),n=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("react"),u=require("prop-types"),o=require("react-virtualized"),i=require("@material-ui/core"),l=require("@material-ui/icons/Settings"),s=require("./CustomizeColumnsDialog.js"),a=require("./VirtualizedTable.js"),c=require("react/jsx-runtime");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=f(e),h=f(t),p=f(n),m=f(u),g=f(l),y=["columns","useColumnSetting","savedColumns","onChangeColumns","customMuiStyles"];function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){d.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var b=i.makeStyles({vtTopSetting:{position:"relative",height:"25px"},vtTopSettingIcon:{position:"fixed",right:"20px",padding:"3px",fontSize:"20px"}});function j(e){var t=e.columns,n=e.useColumnSetting,u=e.savedColumns,l=e.onChangeColumns,f=e.customMuiStyles,d=p.default(e,y),m=b(),S=r.useState(!1),j=h.default(S,2),v=j[0],O=j[1],w=r.useState(!1),x=h.default(w,2),q=x[0],P=x[1],T=r.useMemo((function(){var e=[];return u.forEach((function(n){var r=t.find((function(e){return e.key===n.key}));r&&e.push(C(C({},r),{},{show:n.show}))})),t.forEach((function(t){e.find((function(e){return e.key===t.key}))||e.push(t)})),e}),[t,u]),D=n&&q?25:0;return c.jsxs(c.Fragment,{children:[n&&q&&c.jsx("div",{className:m.vtTopSetting,children:c.jsx(i.IconButton,{size:"small",className:m.vtTopSettingIcon,onClick:function(){return O(!0)},children:c.jsx(g.default,{fontSize:"inherit"})})}),c.jsx(o.AutoSizer,{children:function(e){var t=e.width,r=e.height;return c.jsx(a.default,C({width:t,height:r-D,columns:T,useColumnSetting:n,onOpenSettingDlg:function(){return O(!0)},showTopSettingIcon:function(e){return P(e)},customMuiStyles:f},d))}}),c.jsx(s,{open:v,columns:T,handleCloseWithCancel:function(){return O(!1)},handleCloseWithOK:function(e){l&&l(e),O(!1)}})]})}j.propTypes={columns:m.default.arrayOf(m.default.shape({})),data:m.default.arrayOf(m.default.shape({})),useColumnSetting:m.default.bool,useFixedColumnWidth:m.default.bool,headerHeight:m.default.number,rowHeight:m.default.number,savedColumns:m.default.arrayOf(m.default.shape({})),onChangeColumns:m.default.func,customMuiStyles:m.default.shape({}),isTopSettingIconShownAlways:m.default.bool,CustomCellRenderer:m.default.func,customRowStyle:m.default.func,sort:m.default.func,sortBy:m.default.string,sortDirection:m.default.string},j.defaultProps={columns:[],data:[],useColumnSetting:!1,useFixedColumnWidth:!1,headerHeight:50,rowHeight:35,savedColumns:[],onChangeColumns:null,customMuiStyles:{},isTopSettingIconShownAlways:!1,CustomCellRenderer:null,customRowStyle:null,sort:null,sortBy:null,sortDirection:null},module.exports=j;
