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