import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-cd2796be.js";import{c as closest}from"./closest-d2d192be.js";var pdsTableHeadCss=":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)}";var PdsTableHeadStyle0=pdsTableHeadCss;var PdsTableHead=function(){function e(e){var t=this;registerInstance(this,e);this.pdsTableSelectAll=createEvent(this,"pdsTableSelectAll",7);this.generateUniqueId=function(){var e=Math.random().toString(36).substring(2,8);var t=(new Date).toISOString().replace(/[:.]/g,"-");var a="".concat(e,"-").concat(t);return a};this.handleInput=function(e){t.isSelected=!e.target.checked;t.handleSelect(t.isSelected)};this.handleSelect=function(e){t.indeterminate=false;if(closest("pds-table-head",t.hostElement)){t.pdsTableSelectAll.emit({isSelected:e})}};this.indeterminate=undefined;this.isSelected=undefined}e.prototype.componentWillLoad=function(){if(this.isSelected){this.handleSelect(this.isSelected)}};e.prototype.componentWillRender=function(){this.tableRef=this.hostElement.closest("pds-table");if(this.tableRef&&this.tableRef.fixedColumn){var e=this.hostElement.querySelector("pds-table-head-cell:first-child");e===null||e===void 0?void 0:e.classList.add("is-fixed")}};e.prototype.render=function(){return h(Host,{key:"7729235908073cae63294e4ad641bae0403e2c34",role:"row"},this.tableRef&&this.tableRef.selectable&&h("pds-table-head-cell",{key:"2bb801124a3f8d1c9f18d03d1461953da4cdafc6",part:this.tableRef.selectable?"checkbox-cell":""},h("pds-checkbox",{key:"2119be5b2db13a44add35fa9c9fc761a68a2b060",componentId:this.generateUniqueId(),indeterminate:this.indeterminate,onInput:this.handleInput,label:"Select All Rows",labelHidden:true,checked:this.isSelected})),h("slot",{key:"baa5b3af10a77e1a8aff537c3c731fbc59a54ca8"}))};Object.defineProperty(e.prototype,"hostElement",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();PdsTableHead.style=PdsTableHeadStyle0;export{PdsTableHead as pds_table_head};
//# sourceMappingURL=pds-table-head.entry.js.map