import{r as s,c as t,h as i,H as e,g as a}from"./p-a6030c6e.js";import{g as h}from"./p-1de3e07c.js";const n=":host{display:block}:host .actions{display:-ms-flexbox;display:flex;gap:8px}:host .actions_select{width:74px}";const o=n;const c=class{constructor(i){s(this,i);this.bdsPaginationChange=t(this,"bdsPaginationChange",7);this.previewPage=s=>{const t=this.value;if(t>1){s.preventDefault();this.value=this.value-1}};this.nextPage=s=>{const t=this.value;if(t<this.pages){s.preventDefault();this.value=this.value+1}};this.firstPage=s=>{const t=this.value;if(t>1){s.preventDefault();this.value=this.paginationNumbers[0]}};this.lastPage=s=>{const t=this.value;if(t<this.pages){s.preventDefault();this.value=this.pages}};this.openOptions=()=>{this.openSelect=!this.openSelect};this.onBlur=()=>{this.openSelect=false};this.value=this.startedPage;this.openSelect=undefined;this.paginationNumbers=[];this.intoView=null;this.pages=undefined;this.startedPage=undefined;this.optionsPosition="auto";this.dtButtonInitial=null;this.dtButtonPrev=null;this.dtSelectNumber=null;this.dtButtonNext=null;this.dtButtonEnd=null}componentWillLoad(){this.countPage();this.intoView=h(this.el)}pagesChanged(){this.countPage()}valueChanged(){this.bdsPaginationChange.emit(this.value)}countPage(){if(this.paginationNumbers.length!==0){this.paginationNumbers=[]}if(this.paginationNumbers.length===0){for(let s=1;s<=this.pages;s++){this.paginationNumbers.push(s)}if(this.startedPage&&this.startedPage<this.pages){this.value=this.startedPage}else{this.value=this.paginationNumbers[0]}}}optionSelected(s){this.value=s;this.openOptions()}render(){return i(e,{key:"6d809302f56f178e05b342fa1c8f38e71fae1b03"},i("div",{key:"92aa0223d828d85a89c86bdae6e576b0287741ad",class:"actions"},i("bds-button-icon",{key:"a58e27370c6a1de98586436905b55d1fd88eab35",onBdsClick:s=>this.firstPage(s),size:"short",variant:"secondary",icon:"arrow-first",dataTest:this.dtButtonInitial}),i("bds-button-icon",{key:"e97a7282e7c839c1c4a8b7db04612ccfd73a153e",onBdsClick:s=>this.previewPage(s),size:"short",variant:"secondary",icon:"arrow-left",dataTest:this.dtButtonPrev}),i("bds-select",{key:"e6205ce289890db171572f7aa30a0cbc7fe3ecbf",class:"actions_select",value:this.value,"options-position":this.optionsPosition},this.paginationNumbers.map(((s,t)=>i("bds-select-option",{key:t,value:s,onClick:()=>this.optionSelected(s)},s)))),i("bds-button-icon",{key:"8f65ea30b5a88e379170dcd366b753fcddd8e1fe",onBdsClick:s=>this.nextPage(s),size:"short",variant:"secondary",icon:"arrow-right",dataTest:this.dtButtonNext}),i("bds-button-icon",{key:"75636ade2a47f0c98b08b51f2a16acd16f8fba32",onBdsClick:s=>this.lastPage(s),size:"short",variant:"secondary",icon:"arrow-last",dataTest:this.dtButtonEnd})))}get el(){return a(this)}static get watchers(){return{pages:["pagesChanged"],startedPage:["pagesChanged"],value:["valueChanged"]}}};c.style=o;export{c as bds_pagination};
//# sourceMappingURL=p-3a47ae7e.entry.js.map