var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var a,t=1,r=arguments.length;t<r;t++){a=arguments[t];for(var s in a)if(Object.prototype.hasOwnProperty.call(a,s))e[s]=a[s]}return e};return __assign.apply(this,arguments)};import{h}from"./index-38ad4957.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{g as gap}from"./mixins-f750863a.js";function GenericTableView(e){var a;var t=e.states,r=e.data,s=e.callbacks,l=e.elements;var i=l.columns,o=l.rows;var n=t.show;var d=r.hiddenColumns&&r.hiddenColumns.split(",").map(Number);var p="@media (max-width: "+r.mdBreakpoint+"px)";var m="@media (min-width: "+(Boolean(o.length<2)?r.mdBreakpoint:r.smBreakpoint)+"px) and (max-width: "+r.mdBreakpoint+"px)";var c={Table:(a={borderCollapse:"collapse",tableLayout:"fixed",width:"100%","& tbody tr":{borderBottom:"var(--sqm-border-thickness, 1px) solid var(--sqm-border-color)","&:first-child":{borderTop:"var(--sqm-border-thickness, 1px) solid var(--sqm-border-color)"}},"& th":{paddingBottom:"var(--sl-spacing-small)",textAlign:"left",fontWeight:"var(--sl-font-weight-semibold)",overflowWrap:"anywhere"},"& td":{padding:"var(--sl-spacing-small)",paddingLeft:"0",overflow:"hidden",textOverflow:"ellipsis"}},a[p]={"& thead":{display:"none"},"& tr":{display:"block",background:"inherit",border:"var(--sqm-border-thickness, 1px) solid var(--sqm-border-color)",boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.1)",borderRadius:"var(--sl-border-radius-large)",padding:"var(--sl-spacing-medium)",fontSize:"var(--sl-font-size-small)",marginBottom:"var(--sl-spacing-large)"},"& td":{display:"grid",borderTop:"none",padding:"0",marginBottom:"var(--sl-spacing-medium)","&:first-child":{textAlign:"left"},"&:before":{content:"attr(data-label)",whiteSpace:"nowrap"},"&:last-child":{marginBottom:"0"},"&.hidden:before":{content:"none"}}},a[m]={"& tbody":{display:"grid",gridTemplateColumns:"0.5fr 0.5fr",gap:"25px"}},a),ButtonContainer:__assign({display:"flex","justify-content":"flex-end","margin-top":"var(--sl-spacing-small)"},gap({direction:"row",size:"var(--sl-spacing-small)"})),ButtonDisabled:{"&::part(base)":{opacity:"0.25"}}};var b=createStyleSheet(c);var g=b.toString();if(n==="empty")return l.emptyElement;return h("div",null,h("style",{type:"text/css"},g),h("table",{class:b.classes.Table},r.textOverrides.showLabels&&h("thead",null,h("tr",null,i===null||i===void 0?void 0:i.map((function(e){if(typeof e==="string")return h("th",null,e);return h("th",{style:{width:"30px"}},e)})))),h("tbody",null,n==="loading"&&l.loadingElement,n==="rows"&&(o===null||o===void 0?void 0:o.map((function(e,a){return h("tr",{style:{borderTop:""+(!r.textOverrides.showLabels&&a===0?"none":"")},part:"table-row"},e.map((function(e,a){return typeof i[a]==="string"?h("td",{class:(d===null||d===void 0?void 0:d.includes(a))?"hidden":"","data-label":i[a]+":",style:{gridTemplateColumns:(d===null||d===void 0?void 0:d.includes(a))?"1fr":"0.5fr 0.5fr"}},e):h("td",null,e)})))}))))),h("div",{class:b.classes.ButtonContainer,part:t.namespace+"-button-wrapper"},h("sl-button",{size:"small",disabled:!t.hasPrev,loading:n==="loading",onClick:s.prevPage,exportparts:"base: secondarybutton-base",class:!t.hasPrev?b.classes.ButtonDisabled:""},r.textOverrides.prevLabel),h("sl-button",{size:"small",loading:n==="loading",disabled:!t.hasNext,onClick:s.nextPage,exportparts:"base: secondarybutton-base",class:!t.hasNext?b.classes.ButtonDisabled:""},r.textOverrides.moreLabel)))}export{GenericTableView as G};