this.BX=this.BX||{};(function(e,t){"use strict";var s=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(s,"DEFAULT","ui-alert-default");babelHelpers.defineProperty(s,"DANGER","ui-alert-danger");babelHelpers.defineProperty(s,"SUCCESS","ui-alert-success");babelHelpers.defineProperty(s,"WARNING","ui-alert-warning");babelHelpers.defineProperty(s,"PRIMARY","ui-alert-primary");babelHelpers.defineProperty(s,"INFO","ui-alert-info");var i=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(i,"MD","ui-alert-md");babelHelpers.defineProperty(i,"XS","ui-alert-xs");var n=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(n,"NONE","");babelHelpers.defineProperty(n,"INFO","ui-alert-icon-info");babelHelpers.defineProperty(n,"WARNING","ui-alert-icon-warning");babelHelpers.defineProperty(n,"DANGER","ui-alert-icon-danger");babelHelpers.defineProperty(n,"FORBIDDEN","ui-alert-icon-forbidden");var a;var l=function(){function e(s){babelHelpers.classCallCheck(this,e);this.text=s.text;this.color=s.color;this.size=s.size;this.icon=s.icon;this.closeBtn=!!s.closeBtn?true:s.closeBtn;this.animated=!!s.animated?true:s.animated;this.customClass=s.customClass;this.beforeMessageHtml=t.Type.isElementNode(s.beforeMessageHtml)?s.beforeMessageHtml:false;this.afterMessageHtml=t.Type.isElementNode(s.afterMessageHtml)?s.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)}babelHelpers.createClass(e,[{key:"setColor",value:function e(t){this.color=t;this.setClassList()}},{key:"getColor",value:function e(){return this.color}},{key:"setSize",value:function e(t){this.size=t;this.setClassList()}},{key:"getSize",value:function e(){return this.size}},{key:"setIcon",value:function e(t){this.icon=t;this.setClassList()}},{key:"getIcon",value:function e(){return this.icon}},{key:"setText",value:function e(s){if(t.Type.isStringFilled(s)){this.text=s;this.getTextContainer().innerHTML=s}}},{key:"getText",value:function e(){return this.text}},{key:"getTextContainer",value:function e(){if(!this.textContainer){this.textContainer=t.Dom.create("span",{props:{className:"ui-alert-message"},html:this.text})}return this.textContainer}},{key:"setCloseBtn",value:function e(t){this.closeBtn=t}},{key:"getCloseBtn",value:function e(){if(this.closeBtn!=true){return}if(!this.closeNode&&this.closeBtn===true){this.closeNode=t.Dom.create("span",{props:{className:"ui-alert-close-btn"},events:{click:this.handleCloseBtnClick.bind(this)}})}return this.closeNode}},{key:"handleCloseBtnClick",value:function e(){if(this.animated===true){this.animateClosing()}else{t.Dom.remove(this.container)}}},{key:"setBeforeMessageHtml",value:function e(s){if(t.Type.isElementNode(s)&&s!==false){this.beforeMessageHtml=s}}},{key:"getBeforeMessageHtml",value:function e(){return this.beforeMessageHtml}},{key:"setAfterMessageHtml",value:function e(s){if(t.Type.isElementNode(s)&&s!==false){this.afterMessageHtml=s}}},{key:"getAfterMessageHtml",value:function e(){return this.afterMessageHtml}},{key:"setCustomClass",value:function e(t){this.customClass=t;this.updateClassList()}},{key:"getCustomClass",value:function e(){return this.customClass}},{key:"setClassList",value:function e(){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()}},{key:"getClassList",value:function e(){return this.classList}},{key:"updateClassList",value:function e(){if(!this.container){this.getContainer()}this.container.setAttribute("class",this.classList)}},{key:"animateOpening",value:function e(){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)}},{key:"animateClosing",value:function e(){this.container.style.overflow="hidden";var s=t.Dom.getPosition(this.container);this.container.style.height=s.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(){t.Dom.remove(this.container)}.bind(this),260)}},{key:"show",value:function e(){this.animateOpening()}},{key:"hide",value:function e(){this.animateClosing()}},{key:"getContainer",value:function e(){this.container=t.Tag.render(a||(a=babelHelpers.taggedTemplateLiteral(['<div class="','">',"</div>"])),this.getClassList(),this.getTextContainer());if(this.animated===true){this.animateOpening()}if(this.closeBtn===true){t.Dom.append(this.getCloseBtn(),this.container)}if(t.Type.isElementNode(this.beforeMessageHtml)){t.Dom.prepend(this.getBeforeMessageHtml(),this.getTextContainer())}if(t.Type.isElementNode(this.afterMessageHtml)){t.Dom.append(this.getAfterMessageHtml(),this.getTextContainer())}return this.container}},{key:"render",value:function e(){return this.getContainer()}},{key:"renderTo",value:function e(s){if(t.Type.isDomNode(s)){return s.appendChild(this.getContainer())}return null}},{key:"destroy",value:function e(){t.Dom.remove(this.container);this.container=null;this.finished=false;this.textAfterContainer=null;this.textBeforeContainer=null;this.bar=null;for(var s in this){if(this.hasOwnProperty(s)){delete this[s]}}Object.setPrototypeOf(this,null)}}]);return e}();babelHelpers.defineProperty(l,"Color",s);babelHelpers.defineProperty(l,"Size",i);babelHelpers.defineProperty(l,"Icon",n);e.Alert=l;e.AlertColor=s;e.AlertSize=i;e.AlertIcon=n})(this.BX.UI=this.BX.UI||{},BX);
//# sourceMappingURL=alert.bundle.map.js