import{r as e,c as t,h as i,H as s,g as o}from"./p-05ee992c.js";import{c as a}from"./p-0b77685e.js";const d=":host{--border-head-default:var(--pine-border-width-thin) solid var(--pine-color-grey-300);--color-background-fixed:var(--pine-color-base-white);border-color:inherit;-webkit-box-sizing:border-box;box-sizing:border-box;display:table-header-group;vertical-align:middle}:host::part(checkbox-cell){background-color:var(--color-background-fixed);left:0;position:-webkit-sticky;position:sticky;z-index:1}:host pds-table-checkbox-cell{-webkit-border-after:var(--border-head-default);border-block-end:var(--border-head-default)}";const r=d;const c=class{constructor(i){e(this,i);this.pdsTableSelectAll=t(this,"pdsTableSelectAll",7);this.generateUniqueId=()=>{const e=Math.random().toString(36).substring(2,8);const t=(new Date).toISOString().replace(/[:.]/g,"-");const i=`${e}-${t}`;return i};this.handleInput=e=>{this.isSelected=!e.target.checked;this.handleSelect(this.isSelected)};this.handleSelect=e=>{this.indeterminate=false;if(a("pds-table-head",this.hostElement)){this.pdsTableSelectAll.emit({isSelected:e})}};this.indeterminate=undefined;this.isSelected=undefined}componentWillLoad(){if(this.isSelected){this.handleSelect(this.isSelected)}}componentWillRender(){this.tableRef=this.hostElement.closest("pds-table");if(this.tableRef&&this.tableRef.fixedColumn){const e=this.hostElement.querySelector("pds-table-head-cell:first-child");e===null||e===void 0?void 0:e.classList.add("is-fixed")}}render(){return i(s,{key:"7729235908073cae63294e4ad641bae0403e2c34",role:"row"},this.tableRef&&this.tableRef.selectable&&i("pds-table-head-cell",{key:"2bb801124a3f8d1c9f18d03d1461953da4cdafc6",part:this.tableRef.selectable?"checkbox-cell":""},i("pds-checkbox",{key:"2119be5b2db13a44add35fa9c9fc761a68a2b060",componentId:this.generateUniqueId(),indeterminate:this.indeterminate,onInput:this.handleInput,label:"Select All Rows",labelHidden:true,checked:this.isSelected})),i("slot",{key:"baa5b3af10a77e1a8aff537c3c731fbc59a54ca8"}))}get hostElement(){return o(this)}};c.style=r;export{c as pds_table_head};
//# sourceMappingURL=p-a6eb294d.entry.js.map