import{__rest as o,__assign as s}from'./../../../ext-esm/tslib/tslib.es6.js';import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as c}from"react";import{makeStyles as e,TableCell as n}from"@material-ui/core";import l from"classnames";import r from"../../IconButton/index.js";import{Tooltip as m}from"../../Tooltip/Tooltip.js";import"../../Tooltip/ScrollableTooltip.js";import{LeftIcon as a,RightIcon as p}from"../../../icons/iconParkIcons.js";import"../../../icons/customIcons/icons/AddMessage.js";import"../../../icons/customIcons/icons/Attention.js";import"../../../icons/customIcons/icons/Collapse.js";import"../../../icons/customIcons/icons/Dashboard.js";import"../../../icons/customIcons/icons/Expand.js";import"../../../icons/customIcons/icons/FolderClosed.js";import"../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../icons/customIcons/icons/FolderOpened.js";import"../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../icons/customIcons/icons/LessOrEqual.js";import"../../../icons/customIcons/icons/Search.js";import"../../../icons/customIcons/icons/Wellhub.js";import"../../../icons/customIcons/icons/MultiRuler.js";import"../../../icons/customIcons/icons/Checkbox.js";import"../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../icons/customIcons/icons/Radio.js";import"../../../icons/customIcons/icons/RadioChecked.js";import"../../../icons/customIcons/icons/SimulFrac.js";import"../../../icons/customIcons/icons/ZipperFrac.js";import"../../../icons/customIcons/icons/CautionFilled.js";import"../../../icons/customIcons/icons/MoreApp.js";var d=e((function(o){return{stickyCell:{position:"sticky",left:0,zIndex:2,background:o.palette.background.b4},stickyEmptyCell:{position:"sticky",right:0,zIndex:2},collapseHeader:{width:function(o){var s=o.isExpanded,i=o.maxCellWidth,t=o.cellWidth;return s?i:t}},tableCellWrapper:{display:"flex",alignItems:"center",justifyContent:"space-between",width:function(o){var s=o.isExpanded,i=o.maxCellWidth,t=o.cellWidth;return s?i:t}},iconButton:{padding:0,fontSize:16,"&:hover":{backgroundColor:"transparent"}}}})),u=function(e){var u,h=e.isExpanded,C=e.setIsExpanded,I=e.tooltipTitle,j=e.collapsibleHeader,b=e.collapsibleBody,x=e.maxCellWidth,k=e.cellWidth,f=e.maxCharsNumberFromStart,y=e.maxCharsNumberFromEnd,E=e.children,W=e.stickyCell,g=e.emptyCell,F=e.className,v=o(e,["isExpanded","setIsExpanded","tooltipTitle","collapsibleHeader","collapsibleBody","maxCellWidth","cellWidth","maxCharsNumberFromStart","maxCharsNumberFromEnd","children","stickyCell","emptyCell","className"]),N=W&&!g,T=d({isExpanded:h,cellWidth:k,maxCellWidth:x}),S=c(!1),z=S[0],B=S[1];return i(n,s({},v,{className:l(j&&T.collapseHeader,N&&T.stickyCell,g&&T.stickyEmptyCell,N&&"stickyCell",g&&"stickyEmptyCell",F)},{children:[j&&i("div",s({className:T.tableCellWrapper},{children:[E,t(r,s({className:T.iconButton,size:"small",onClick:function(){B(!1),C(!h)},tooltipProps:{title:h?"Collapse":"Expand",open:z,disableHoverListener:!0,onMouseEnter:function(){return B(!0)},onMouseLeave:function(){return B(!1)}}},{children:t(h?a:p,{size:16})}))]})),b&&t(m,s({title:h?"":I},{children:t("div",{children:h?E:(u=I,u.length>f+y?"".concat(u.substring(0,f)," ... ").concat(u.substring(u.length-y)):u)})})),!j&&!b&&E]}))};export{u as TableCell};
