import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import o from"@babel/runtime/helpers/objectWithoutProperties";import{jsxs as r,Fragment as n,jsx as i}from"react/jsx-runtime";import{useState as s,useMemo as u}from"react";import{AutoSizer as l}from"react-virtualized";import{makeStyles as c,IconButton as a}from"@material-ui/core";import m from"@material-ui/icons/Settings";import d from"./CustomizeColumnsDialog.js";import{VirtualizedTableComponent as h}from"./VirtualizedTable.js";var p=["columns","data","useColumnSetting","useFixedColumnWidth","headerHeight","rowHeight","savedColumns","onChangeColumns","customMuiStyles","isTopSettingIconShownAlways","CustomCellRenderer","CustomHeaderCellRenderer","customRowStyle","sort","sortBy","sortDirection"];function f(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function g(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?f(Object(r),!0).forEach((function(o){e(t,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var C=c({vtTopSetting:{position:"relative",height:"25px"},vtTopSettingIcon:{position:"fixed",right:"20px",padding:"3px",fontSize:"20px"}}),y=function(e){var c=e.columns,f=void 0===c?[]:c,y=e.data,v=void 0===y?[]:y,S=e.useColumnSetting,w=void 0!==S&&S,b=e.useFixedColumnWidth,O=void 0!==b&&b,j=e.headerHeight,x=void 0===j?50:j,P=e.rowHeight,T=void 0===P?35:P,D=e.savedColumns,H=void 0===D?[]:D,R=e.onChangeColumns,k=e.customMuiStyles,z=void 0===k?{}:k,I=e.isTopSettingIconShownAlways,W=void 0!==I&&I,A=e.CustomCellRenderer,E=e.CustomHeaderCellRenderer,B=e.customRowStyle,F=e.sort,M=e.sortBy,N=e.sortDirection,K=o(e,p),V=C(),q=s(!1),G=t(q,2),J=G[0],L=G[1],Q=s(!1),U=t(Q,2),X=U[0],Y=U[1],Z=u((function(){var e=[];return H.forEach((function(t){var o=f.find((function(e){return e.key===t.key}));o&&e.push(g(g({},o),{},{show:t.show}))})),f.forEach((function(t){e.find((function(e){return e.key===t.key}))||e.push(t)})),e}),[f,H]),$=w&&X?25:0;return r(n,{children:[w&&X&&i("div",{className:V.vtTopSetting,children:i(a,{size:"small",className:V.vtTopSettingIcon,onClick:function(){return L(!0)},children:i(m,{fontSize:"inherit"})})}),i(l,{children:function(e){var t=e.width,o=e.height;return i(h,g({width:t,height:o-$,columns:Z,useColumnSetting:w,onOpenSettingDlg:function(){return L(!0)},showTopSettingIcon:function(e){return Y(e)},customMuiStyles:z,data:v,useFixedColumnWidth:O,headerHeight:x,rowHeight:T,isTopSettingIconShownAlways:W,CustomCellRenderer:A,CustomHeaderCellRenderer:E,customRowStyle:B,sort:F,sortBy:M,sortDirection:N},K))}}),i(d,{open:J,columns:Z,handleCloseWithCancel:function(){return L(!1)},handleCloseWithOK:function(e){R&&R(e),L(!1)}})]})};export{y as VTableComponent,y as default};
//# sourceMappingURL=index.js.map
