import o from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/objectWithoutProperties";import{useState as s}from"react";import{makeStyles as i,TableCell as c}from"@material-ui/core";import n from"classnames";import r from"../../IconButton/index.js";import{Tooltip as l}from"../../Tooltip/Tooltip.js";import"../../Tooltip/ScrollableTooltip.js";import{LeftIcon as m,RightIcon as a}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";import{jsxs as p,jsx as d}from"react/jsx-runtime";var u=["isExpanded","setIsExpanded","tooltipTitle","collapsibleHeader","collapsibleBody","maxCellWidth","maxCharsNumberFromStart","maxCharsNumberFromEnd","cellWidth","children"];function b(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),t.push.apply(t,s)}return t}function h(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?b(Object(s),!0).forEach((function(t){o(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):b(Object(s)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(s,o))}))}return e}var j=i((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 e=o.isExpanded,t=o.maxCellWidth,s=o.cellWidth;return e?t:s}},tableCellWrapper:{display:"flex",alignItems:"center",justifyContent:"space-between",width:function(o){var e=o.isExpanded,t=o.maxCellWidth,s=o.cellWidth;return e?t:s}},iconButton:{padding:0,fontSize:16,"&:hover":{backgroundColor:"transparent"}}}})),C=function(o){var i,b=o.isExpanded,C=o.setIsExpanded,f=o.tooltipTitle,y=o.collapsibleHeader,I=o.collapsibleBody,x=o.maxCellWidth,k=o.maxCharsNumberFromStart,O=o.maxCharsNumberFromEnd,E=o.cellWidth,g=o.children,v=t(o,u),W=v.stickyCell&&!v.emptyCell,P=j({isExpanded:b,cellWidth:E,maxCellWidth:x}),F=s(!1),w=e(F,2),N=w[0],S=w[1];return p(c,h(h({},v),{},{className:n(y&&P.collapseHeader,W&&P.stickyCell,v.emptyCell&&P.stickyEmptyCell,W&&"stickyCell",v.emptyCell&&"stickyEmptyCell",v.className),children:[y&&p("div",{className:P.tableCellWrapper,children:[g,d(r,{className:P.iconButton,size:"small",onClick:function(){S(!1),C(!b)},tooltipProps:{title:b?"Collapse":"Expand",open:N,disableHoverListener:!0,onMouseEnter:function(){return S(!0)},onMouseLeave:function(){return S(!1)}},children:d(b?m:a,{size:16})})]}),I&&d(l,{title:b?"":f,children:d("div",{children:b?g:(i=f,i.length>k+O?"".concat(i.substring(0,k)," ... ").concat(i.substring(i.length-O)):i)})}),!y&&!I&&g]}))};export{C as TableCell};
