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