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