public_html/layouts/basic/components/IconsModal.min.js
'use strict';
/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor);}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}window.AppComponents_IconsModal_Js=/*#__PURE__*/function(){function _class(){_classCallCheck(this,_class);}return _createClass(_class,[{key:"setPage",value:/**
* Set page
* @param {int} page
*/function setPage(){var page=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,min=(page-1)*this.pageLimit,max=page*this.pageLimit,elements=this.container.find(".js-icon-item:not(.not-match)");this.container.find(".js-icon-item").addClass("d-none"),elements.slice(min,max).removeClass("d-none"),this.container.find(".js-page--set").data("id",page).find(".page-link").text(page),elements.eq(max+1).length?this.container.find(".js-page--next,.js-page--last").removeClass("disabled"):this.container.find(".js-page--next,.js-page--last").addClass("disabled"),0!==min&&elements.eq(min-1).length?this.container.find(".js-page--previous,.js-page--first").removeClass("disabled"):this.container.find(".js-page--previous,.js-page--first").addClass("disabled");}/**
* Register pagination events
*/},{key:"registerPaginationEvents",value:function registerPaginationEvents(){var _this=this;this.container.on("click",".js-page--next:not(.disabled)",function(){var currentPage=_this.container.find(".js-page--set.active").data("id");_this.setPage(parseInt(currentPage)+1);}),this.container.on("click",".js-page--previous:not(.disabled)",function(){var currentPage=_this.container.find(".js-page--set.active").data("id");1!==currentPage&&_this.setPage(currentPage-1);}),this.container.on("click",".js-page--first:not(.disabled)",function(){_this.setPage(1);}),this.container.on("click",".js-page--last:not(.disabled)",function(){var elements=_this.container.find(".js-icon-item:not(.not-match)"),totalPages=Math.ceil(elements.length/_this.pageLimit);_this.setPage(totalPages);});}/**
* Register Icon Search
*/},{key:"registerSearchIcon",value:function registerSearchIcon(){var _this2=this;this.container.find(".js-icon-search").on("keyup",function(e){_this2.container.find(".js-icon-item.not-match").removeClass("not-match");var value=e.currentTarget.value.toString().replace("\"","").toLowerCase();value.length&&_this2.container.find(".js-icon-item:not([data-icon-search*=\"".concat(value,"\"])")).addClass("not-match"),_this2.setPage(1);});}/**
* Register events
*/},{key:"registerEvents",value:function registerEvents(container){this.container=container,this.pageLimit=parseInt(this.container.find(".js-page-size").val()),this.setPage(),this.registerPaginationEvents(),this.registerSearchIcon();}}]),_class}();
//# sourceMappingURL=IconsModal.min.js.map