Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/alerts/dist/ |
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/alerts/dist/alert.bundle.min.js |
this.BX=this.BX||{};(function(t,e){"use strict";class s{}s.DEFAULT="ui-alert-default";s.DANGER="ui-alert-danger";s.SUCCESS="ui-alert-success";s.WARNING="ui-alert-warning";s.PRIMARY="ui-alert-primary";s.INFO="ui-alert-info";class i{}i.MD="ui-alert-md";i.XS="ui-alert-xs";class n{}n.NONE="";n.INFO="ui-alert-icon-info";n.WARNING="ui-alert-icon-warning";n.DANGER="ui-alert-icon-danger";n.FORBIDDEN="ui-alert-icon-forbidden";let o=t=>t,a;class r{constructor(t){this.text=t.text;this.color=t.color;this.size=t.size;this.icon=t.icon;this.closeBtn=!!t.closeBtn?true:t.closeBtn;this.animated=!!t.animated?true:t.animated;this.customClass=t.customClass;this.beforeMessageHtml=e.Type.isElementNode(t.beforeMessageHtml)?t.beforeMessageHtml:false;this.afterMessageHtml=e.Type.isElementNode(t.afterMessageHtml)?t.afterMessageHtml:false;this.setText(this.text);this.setSize(this.size);this.setIcon(this.icon);this.setColor(this.color);this.setCloseBtn(this.closeBtn);this.setCustomClass(this.customClass)}setColor(t){this.color=t;this.setClassList()}getColor(){return this.color}setSize(t){this.size=t;this.setClassList()}getSize(){return this.size}setIcon(t){this.icon=t;this.setClassList()}getIcon(){return this.icon}setText(t){if(e.Type.isStringFilled(t)){this.text=t;this.getTextContainer().innerHTML=t}}getText(){return this.text}getTextContainer(){if(!this.textContainer){this.textContainer=e.Dom.create("span",{props:{className:"ui-alert-message"},html:this.text})}return this.textContainer}setCloseBtn(t){this.closeBtn=t}getCloseBtn(){if(this.closeBtn!=true){return}if(!this.closeNode&&this.closeBtn===true){this.closeNode=e.Dom.create("span",{props:{className:"ui-alert-close-btn"},events:{click:this.handleCloseBtnClick.bind(this)}})}return this.closeNode}handleCloseBtnClick(){if(this.animated===true){this.animateClosing()}else{e.Dom.remove(this.container)}}setBeforeMessageHtml(t){if(e.Type.isElementNode(t)&&t!==false){this.beforeMessageHtml=t}}getBeforeMessageHtml(){return this.beforeMessageHtml}setAfterMessageHtml(t){if(e.Type.isElementNode(t)&&t!==false){this.afterMessageHtml=t}}getAfterMessageHtml(){return this.afterMessageHtml}setCustomClass(t){this.customClass=t;this.updateClassList()}getCustomClass(){return this.customClass}setClassList(){this.classList="ui-alert";if(typeof this.getColor()!="undefined"){this.classList=this.classList+" "+this.color}if(typeof this.getSize()!="undefined"){this.classList=this.classList+" "+this.size}if(typeof this.getIcon()!="undefined"){this.classList=this.classList+" "+this.icon}if(typeof this.getCustomClass()!="undefined"){this.classList=this.classList+" "+this.customClass}this.updateClassList()}getClassList(){return this.classList}updateClassList(){if(!this.container){this.getContainer()}this.container.setAttribute("class",this.classList)}animateOpening(){this.container.style.overflow="hidden";this.container.style.height=0;this.container.style.paddingTop=0;this.container.style.paddingBottom=0;this.container.style.marginBottom=0;this.container.style.opacity=0;setTimeout(function(){this.container.style.height=this.container.scrollHeight+"px";this.container.style.height="";this.container.style.paddingTop="";this.container.style.paddingBottom="";this.container.style.marginBottom="";this.container.style.opacity=""}.bind(this),10);setTimeout(function(){this.container.style.height=""}.bind(this),200)}animateClosing(){this.container.style.overflow="hidden";var t=e.Dom.getPosition(this.container);this.container.style.height=t.height+"px";setTimeout(function(){this.container.style.height=0;this.container.style.paddingTop=0;this.container.style.paddingBottom=0;this.container.style.marginBottom=0;this.container.style.opacity=0}.bind(this),10);setTimeout(function(){e.Dom.remove(this.container)}.bind(this),260)}show(){this.animateOpening()}hide(){this.animateClosing()}getContainer(){this.container=e.Tag.render(a||(a=o`<div class="${0}">${0}</div>`),this.getClassList(),this.getTextContainer());if(this.animated===true){this.animateOpening()}if(this.closeBtn===true){e.Dom.append(this.getCloseBtn(),this.container)}if(e.Type.isElementNode(this.beforeMessageHtml)){e.Dom.prepend(this.getBeforeMessageHtml(),this.getTextContainer())}if(e.Type.isElementNode(this.afterMessageHtml)){e.Dom.append(this.getAfterMessageHtml(),this.getTextContainer())}return this.container}render(){return this.getContainer()}renderTo(t){if(e.Type.isDomNode(t)){return t.appendChild(this.getContainer())}return null}destroy(){e.Dom.remove(this.container);this.container=null;this.finished=false;this.textAfterContainer=null;this.textBeforeContainer=null;this.bar=null;for(const t in this){if(this.hasOwnProperty(t)){delete this[t]}}Object.setPrototypeOf(this,null)}}r.Color=s;r.Size=i;r.Icon=n;t.Alert=r;t.AlertColor=s;t.AlertSize=i;t.AlertIcon=n})(this.BX.UI=this.BX.UI||{},BX); //# sourceMappingURL=alert.bundle.map.js