(window.webpackJsonp=window.webpackJsonp||[]).push([[307],{342:function(e,t,s){"use strict";s.r(t),s.d(t,"ontotext_pagination",(function(){return o}));var i=s(29);class a{constructor(e,t){this._pageSize=e,this._pageNumber=t}get pageSize(){return this._pageSize}get pageNumber(){return this._pageNumber}}const o=class{constructor(e){Object(i.g)(this,e),this.pageSelected=Object(i.c)(this,"pageSelected",7),this.VISIBLE_PAGES_COUNT=5,this.PAGES_COUNT_AROUND_CURRENT=2,this.pageNumber=1,this.pageSize=10,this.totalElements=0,this.pageElements=void 0,this.hasMorePages=void 0,this.selectPage(this.pageNumber)}getShownPageNumbers(){const e=this.fetchLastShownPage(),t=[];for(let s=this.fetchFirstShownPage(e);s<=e;s++)t.push(s);return t}fetchLastShownPage(){const e=this.pageNumber;let t=e;const s=e<=3?this.VISIBLE_PAGES_COUNT-e:this.PAGES_COUNT_AROUND_CURRENT;for(let i=0;i<s;i++)(e+i)*this.pageSize<this.totalElements&&(t+=1);return t}fetchFirstShownPage(e){const t=e-this.VISIBLE_PAGES_COUNT+1;return t<1?1:t}previousButtonDisabled(){return this.pageNumber<this.PAGES_COUNT_AROUND_CURRENT}nextButtonDisabled(){return this.totalElements&&this.totalElements>=0?this.pageNumber*this.pageSize>=this.totalElements:!this.hasMorePages}nextPage(){this.pageSelected.emit(new a(this.pageSize,this.pageNumber+1))}previousPage(){this.pageSelected.emit(new a(this.pageSize,this.pageNumber-1))}selectPage(e){this.pageNumber!==e&&this.pageSelected.emit(new a(this.pageSize,e))}render(){return Object(i.e)(i.a,{class:"ontotext-pagination"},Object(i.e)("div",{class:"page-selectors"},Object(i.e)("button",{class:"page-selector previous-button",onClick:()=>this.previousPage(),disabled:this.previousButtonDisabled()},"‹"),this.getShownPageNumbers().map(e=>Object(i.e)("button",{class:"page-button page-selector "+(this.pageNumber===e?"selected-page":""),onClick:()=>this.selectPage(e),disabled:this.pageNumber===e},e)),Object(i.e)("button",{class:"page-selector next-button",onClick:()=>this.nextPage(),disabled:this.nextButtonDisabled()},"›")))}};o.style=".ontotext-pagination .page-selectors{height:100%;display:flex;justify-content:space-around;align-items:center;min-width:100px}.ontotext-pagination .page-selector{color:#0060b0;padding:2px 5px;background-color:#FFF;border:none;cursor:pointer}.ontotext-pagination .page-selector:disabled{cursor:unset}.ontotext-pagination .previous-button:disabled,.ontotext-pagination .next-button:disabled{opacity:0.4}.ontotext-pagination .selected-page{background-color:#e84e0f;color:#FFFFFF}"}}]);