import{r as t,h as e,H as r,g as a}from"./p-db677b4c.js";const o=":host{--background:var(--pine-color-base-white);background:var(--background);border-collapse:separate;-webkit-box-sizing:border-box;box-sizing:border-box;display:table;width:100%}:host(.is-responsive){background-attachment:local, local, scroll, scroll;background-image:-webkit-gradient(linear, left top, right top, from(var(--background)), to(var(--background))), -webkit-gradient(linear, left top, right top, from(var(--background)), to(var(--background))), -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.1)), to(rgba(255, 255, 255, 0))), -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.1)), to(rgba(255, 255, 255, 0)));background-image:linear-gradient(to right, var(--background), var(--background)), linear-gradient(to right, var(--background), var(--background)), linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0)), linear-gradient(to left, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0));background-position:left center, right center, left center, right center;background-repeat:no-repeat;background-size:4px 100%, 4px 100%, 4px 100%, 4px 100%;display:block;margin:0 auto;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;overflow-x:auto;white-space:nowrap}";const i=o;const n=class{constructor(e){t(this,e);this.compact=undefined;this.componentId=undefined;this.responsive=undefined;this.fixedColumn=undefined;this.selectable=undefined;this.sortingColumn=null;this.sortingDirection="asc"}componentWillLoad(){this.sortingColumn=null}classNames(){const t=["pds-table"];if(this.compact){t.push("is-compact")}if(this.responsive){t.push("is-responsive")}return t.join("  ")}sortTable(t,e){const r=this.el.querySelector("pds-table-body");const a=Array.from(r.querySelectorAll("pds-table-row"));const o=Array.from(this.el.querySelectorAll("pds-table-head-cell[sortable]"));const i=o.find((e=>e.innerText.trim()===t));if(!i){console.warn(`Column "${t}" not found.`);return}const n=o.indexOf(i);a.sort(((t,r)=>{const a=t.querySelector(`pds-table-cell:nth-child(${n+1})`).textContent.trim();const o=r.querySelector(`pds-table-cell:nth-child(${n+1})`).textContent.trim();if(e==="asc"){return a.localeCompare(o)}else{return o.localeCompare(a)}}));r.innerHTML="";a.forEach((t=>{r.appendChild(t)}))}handleTableSort(t){const{direction:e}=t.detail;this.sortTable(t.detail.column,e);this.sortingColumn=t.detail.column;this.sortingDirection=e}render(){return e(r,{key:"a2c7913248cd3d9f73503bde080e8c88aa1a5a71",class:this.classNames(),id:this.componentId,role:"grid",selectable:this.selectable},e("slot",{key:"94e51585d1c5c868896452a79b972c8ee8e27483"}))}get el(){return a(this)}};n.style=i;export{n as pds_table};
//# sourceMappingURL=p-763e2f83.entry.js.map