Liferay.Loader.define("frontend-js-web@5.0.33/liferay/DynamicInlineScroll.es",["module","exports","require","./PortletBase.es","./delegate/delegate.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(a("./PortletBase.es")),n=l(a("./delegate/delegate.es"));function l(e){return e&&e.__esModule?e:{default:e}}function i(e){return"string"==typeof e}class e extends r.default{attached(){let{rootNode:e}=this;e=e||document,this.inlineScrollEventHandler_=(0,n.default)(e,"scroll","ul.pagination ul.inline-scroller",this.onScroll_.bind(this))}created(){this.handleListItemClick_=this.handleListItemClick_.bind(this)}detached(){super.detached(),this.inlineScrollEventHandler_.dispose();document.createElement("li").removeEventListener("click",this.handleListItemClick_)}addListItem_(e,t){const a=document.createElement("li");a.innerHTML='<a class="dropdown-item" href="'.concat(this.getHREF_(t),'">').concat(t,"</a>"),t++,e.appendChild(a),e.setAttribute("data-page-index",t),a.addEventListener("click",this.handleListItemClick_)}getHREF_(e){const{curParam:t,formName:a,jsCall:r,namespace:n,url:l,urlAnchor:i}=this;let o="javascript:document.".concat(a,".").concat(n).concat(t,'.value = "').concat(e,"; ").concat(r);return null!==this.url&&(o="".concat(l,"&").concat(n).concat(t,"=").concat(e).concat(i)),o}getNumber_(e){return Number(e)}handleListItemClick_(e){if(this.forcePost){e.preventDefault();const{curParam:t,namespace:a,randomNamespace:r}=this,n=document.getElementById(r+a+"pageIteratorFm");n.elements[a+t].value=e.currentTarget.textContent,n.submit()}}onScroll_(e){const{cur:t,initialPages:a,pages:r}=this,{target:n}=e;let l=this.getNumber_(n.dataset.pageIndex),i=this.getNumber_(n.dataset.maxIndex);if(0===l){const e=this.getNumber_(n.dataset.currentIndex);l=0===e?a:e+a}0===i&&(i=r),t<=r&&l<i&&n.getAttribute("scrollTop")>=n.getAttribute("scrollHeight")-300&&this.addListItem_(n,l)}}e.STATE={cur:{setter:"getNumber_",validator:i},curParam:{validator:i},forcePost:{validator:function(e){return"boolean"==typeof e}},formName:{validator:i},initialPages:{setter:"getNumber_",validator:i},jsCall:{validator:i},namespace:{validator:i},pages:{setter:"getNumber_",validator:i},randomNamespace:{validator:i},url:{validator:i},urlAnchor:{validator:i}};var o=e;t.default=o}}));
//# sourceMappingURL=DynamicInlineScroll.es.js.map