import{r as i,c as t,h as e,H as s,g as a}from"./p-0b541f88.js";import{e as o,d as r}from"./p-1b86047e.js";const l=":host{--border-head-cell-default:var(--pine-border-width-thin) solid var(--pine-color-grey-300);--box-shadow-default:3px 3px 6px -2px rgba(0, 0, 0, 0.1);--color-background-fixed:var(--pine-color-white);--color-sorting:var(--pine-color-grey-950);--color-text-default:var(--pine-color-grey-700);--dimension-fixed-cell-position:0;--font-size-head-cell:var(--pine-font-size-085);--font-weight-cell-default:var(--pine-font-weight-normal);--line-height-cell-default:var(--pine-line-height-125);--padding-cell-default:calc(var(--pine-spacing-300) / 2);--spacing-margin-inline-start-arrow:var(--pine-spacing-050);--spacing-padding-arrow:calc(var(--pine-spacing-050) / 2);--spacing-padding-block-compact:var(--pine-spacing-050);-webkit-border-after:var(--border-head-cell-default);border-block-end:var(--border-head-cell-default);color:var(--color-text-default);display:table-cell;font-size:var(--font-size-head-cell);font-style:normal;font-weight:var(--font-weight-cell-default);line-height:var(--line-height-cell-default);padding:var(--padding-cell-default);text-align:start;vertical-align:inherit}:host(.is-compact){padding-block:var(--spacing-padding-block-compact)}:host(.is-fixed){background:var(--color-background-fixed);left:var(--dimension-fixed-cell-position);position:-webkit-sticky;position:sticky;z-index:1}:host(.has-scrolled.is-fixed){-webkit-box-shadow:var(--box-shadow-default);box-shadow:var(--box-shadow-default)}:host(.is-sortable){cursor:pointer}:host(.is-sortable) pds-icon{-webkit-margin-start:var(--spacing-margin-inline-start-arrow);margin-inline-start:var(--spacing-margin-inline-start-arrow);-webkit-padding-before:var(--spacing-padding-arrow);padding-block-start:var(--spacing-padding-arrow);position:absolute}:host(.is-sortable:hover),:host(.is-active){color:var(--color-sorting)}";const n=l;const c=class{constructor(e){i(this,e);this.pdsTableSort=t(this,"pdsTableSort",7);this.handleScroll=()=>{if(this.tableRef.scrollLeft>0){this.tableScrolling=true}else{this.tableScrolling=false}};this.toggleSort=()=>{if(this.sortable){const i=this.hostElement.innerText.trim();this.sortingDirection=this.sortingDirection==="asc"?"desc":"asc";this.tableRef.querySelectorAll("pds-table-head-cell").forEach((i=>{i.classList.remove("is-active")}));this.hostElement.classList.toggle("is-active");this.pdsTableSort.emit({column:i,direction:this.sortingDirection})}};this.sortable=undefined;this.sortingDirection="asc";this.tableScrolling=false;this.isSelected=false}componentWillRender(){this.tableRef=this.hostElement.closest("pds-table")}componentDidLoad(){if(this.tableRef&&this.tableRef.responsive&&this.tableRef.fixedColumn){this.tableRef.addEventListener("scroll",this.handleScroll)}}classNames(){const i=[];if(this.tableRef&&this.tableRef.compact){i.push("is-compact")}if(this.sortable){i.push("is-sortable")}if(this.sortable&&this.sortingDirection!==null){i.push("sort-"+this.sortingDirection)}if(this.tableRef&&this.tableRef.fixedColumn&&this.tableScrolling){i.push("has-scrolled")}return i.join("  ")}render(){return e(s,{key:"72e242a22774d4b534b7a8653673606e0e9c6ef1",class:this.classNames(),role:"columnheader",onClick:this.toggleSort,style:this.tableRef&&this.tableRef.fixedColumn&&this.tableRef.selectable?{"--fixed-cell-position":"40px"}:{}},e("slot",{key:"08e1d5aab1761ed097e2669716884196c946bcc3"}),this.sortable&&e("pds-icon",{key:"43421a2b1401426878601468acee702ce45404bf",icon:this.sortingDirection==="asc"?o:r}))}get hostElement(){return a(this)}};c.style=n;export{c as pds_table_head_cell};
//# sourceMappingURL=p-8d83093d.entry.js.map