@syncfusion/ej2-notifications
Version:
A package of Essential JS 2 notification components such as Toast and Badge which used to notify important information to end-users.
12 lines (11 loc) • 30.7 kB
JavaScript
/*!
* filename: ej2-notifications.umd.min.js
* version : 29.1.33
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-buttons","@syncfusion/ej2-popups"],e):e((t=t||self).ej={},t.ej2Base,t.ej2Buttons,t.ej2Popups)}(this,function(t,h,R,z){"use strict";i=function(t,e){return(i=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])}))(t,e)};var i,e,s=function(t,e){function s(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)},o=function(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;0<=l;l--)(o=t[l])&&(r=(n<3?o(r):3<n?o(e,s,r):o(e,s))||r);return 3<n&&r&&Object.defineProperty(e,s,r),r},l="e-toast",a="e-toast-container",A="e-toast-title",_="e-toast-full-width",D="e-toast-content",n="e-toast-message",c="e-toast-progress",r="e-toast-close-icon",p="e-rtl",F=(e=h.ChildProperty,s(d,e),o([h.Property("Left")],d.prototype,"X",void 0),o([h.Property("Top")],d.prototype,"Y",void 0),d);function d(){return null!==e&&e.apply(this,arguments)||this}u=h.ChildProperty,s(m,u),o([h.Property(null)],m.prototype,"model",void 0),o([h.Property(null)],m.prototype,"click",void 0);var u,M=m;function m(){return null!==u&&u.apply(this,arguments)||this}f=h.ChildProperty,s(v,f),o([h.Property("FadeIn")],v.prototype,"effect",void 0),o([h.Property(600)],v.prototype,"duration",void 0),o([h.Property("ease")],v.prototype,"easing",void 0);var f,y=v;function v(){return null!==f&&f.apply(this,arguments)||this}C=h.ChildProperty,s(g,C),o([h.Complex({effect:"FadeIn",duration:600,easing:"ease"},y)],g.prototype,"show",void 0),o([h.Complex({effect:"FadeOut",duration:600,easing:"ease"},y)],g.prototype,"hide",void 0);var C,q=g;function g(){return null!==C&&C.apply(this,arguments)||this}E=h.Component,s(b,E),b.prototype.getModuleName=function(){return"toast"},b.prototype.getPersistData=function(){return this.addOnPersist([])},b.prototype.destroy=function(){this.hide("All"),this.element.classList.remove(a),h.setStyleAttribute(this.element,{position:"","z-index":""}),h.isNullOrUndefined(this.refElement)||h.isNullOrUndefined(this.refElement.parentElement)||(this.refElement.parentElement.insertBefore(this.element,this.refElement),h.detach(this.refElement),this.refElement=void 0),this.isBlazorServer()||E.prototype.destroy.call(this)},b.prototype.preRender=function(){this.isDevice=h.Browser.isDevice,"300px"===this.width&&(this.width=this.isDevice&&screen.width<768?"100%":"300px"),h.isNullOrUndefined(this.target)&&(this.target=document.body),this.enableRtl&&!this.isBlazorServer()&&this.element.classList.add(p)},b.prototype.render=function(){this.progressObj=[],this.intervalId=[],this.contentTemplate=null,this.toastTemplate=null,this.renderComplete(),this.initRenderClass=this.element.className},b.prototype.show=function(t){var e;if(h.isNullOrUndefined(t)||(this.templateChanges(t),e=JSON.parse(JSON.stringify(t)),h.extend(this,this,t)),h.isNullOrUndefined(this.toastContainer)){this.toastContainer=this.getContainer();var s="string"==typeof this.target?document.querySelector(this.target):"object"==typeof this.target?this.target:document.body;if(h.isNullOrUndefined(s))return;"BODY"===s.tagName?this.toastContainer.style.position="fixed":(this.toastContainer.style.position="absolute",s.style.position="relative"),this.setPositioning(this.position),s.appendChild(this.toastContainer)}this.isBlazorServer()&&this.element.classList.contains("e-control")?this.isToastModel(t):(this.toastEle=this.createElement("div",{className:l,id:h.getUniqueID("toast")}),this.setWidthHeight(),this.setCSSClass(this.cssClass),h.isNullOrUndefined(this.template)||""===this.template?this.personalizeToast():this.templateRendering(),this.setProgress(),this.setCloseButton(),this.setAria(),this.appendToTarget(t),this.isDevice&&screen.width<768&&new h.Touch(this.toastEle,{swipe:this.swipeHandler.bind(this)}),h.isNullOrUndefined(e)||(h.extend(e,{element:[this.toastEle]},!0),this.toastCollection.push(e)),this.isReact&&this.renderReactTemplates())},b.prototype.showToast=function(t,e){this.toastEle=this.element.querySelector("#"+t),this.show(e)},b.prototype.isToastModel=function(t){this.toastContainer=this.element,this.setPositioning(this.position);h.isNullOrUndefined(this.element.lastElementChild)||this.setProgress(),this.setAria(),this.appendToTarget(t)},b.prototype.swipeHandler=function(t){var e=h.closest(t.originalEvent.target,"."+l+":not(."+a+")"),s=this.animation.hide.effect;h.isNullOrUndefined(e)||("Right"===t.swipeDirection?(this.animation.hide.effect="SlideRightOut",this.hideToast("swipe",e)):"Left"===t.swipeDirection&&(this.animation.hide.effect="SlideLeftOut",this.hideToast("swipe",e)),this.animation.hide.effect=s)},b.prototype.templateChanges=function(t){h.isUndefined(t.content)||h.isNullOrUndefined(this.contentTemplate)||this.content===t.content||this.clearContentTemplate(),h.isUndefined(t.template)||h.isNullOrUndefined(this.toastTemplate)||this.template===t.template||this.clearToastTemplate()},b.prototype.setCSSClass=function(t){var e;t&&(e=-1!==t.indexOf(",")?",":" ",h.classList(this.toastEle,t.split(e),[]),this.toastContainer)&&h.classList(this.toastContainer,t.split(e),[])},b.prototype.setWidthHeight=function(){"300px"===this.width?this.toastEle.style.width=h.formatUnit(this.width):"100%"===this.width?this.toastContainer.classList.add(_):(this.toastEle.style.width=h.formatUnit(this.width),this.toastContainer.classList.remove(_)),this.toastEle.style.height=h.formatUnit(this.height)},b.prototype.templateRendering=function(){this.fetchEle(this.toastEle,this.template,"template")},b.prototype.sanitizeHelper=function(t){var e;return this.enableHtmlSanitizer&&(e=h.SanitizeHtmlHelper.beforeSanitize(),h.extend(e,e,{cancel:!1,helper:null}),this.trigger("beforeSanitizeHtml",e),e.cancel&&!h.isNullOrUndefined(e.helper)?t=e.helper(t):e.cancel||(t=h.SanitizeHtmlHelper.serializeValue(e,t))),t},b.prototype.hide=function(t){this.hideToast("",t)},b.prototype.hideToast=function(t,e){if(!h.isNullOrUndefined(this.toastContainer)&&0!==this.toastContainer.childElementCount)if("string"==typeof e&&"All"===e)for(var s=0;s<this.toastContainer.childElementCount;s++)this.destroyToast(this.toastContainer.children[s],t);else h.isNullOrUndefined(e)&&(e=this.newestOnTop?this.toastContainer.lastElementChild:this.toastContainer.firstElementChild),this.destroyToast(e,t)},b.prototype.fetchEle=function(e,s,t){var i,o,n,r,l,a;if(s="string"==typeof s?this.sanitizeHelper(s):s,n=e.classList.contains(A)?this.element.id+"title":e.classList.contains(D)?this.element.id+"content":this.element.id+"template",o="content"===t?this.contentTemplate:this.toastTemplate,h.isNullOrUndefined(o)){try{"function"!=typeof s&&0<document.querySelectorAll(s).length?(r=null,"title"!==t&&(r=document.querySelector(s),e.appendChild(r),r.style.display=""),l=h.isNullOrUndefined(r)?o:r.cloneNode(!0),"content"===t?this.contentTemplate=l:this.toastTemplate=l):i=h.compile(s)}catch(t){i="object"==typeof s?h.compile(s):h.compile(h.initializeCSPTemplate(function(){return s}))}h.isNullOrUndefined(i)||(a=this.isBlazorServer()?i({},this,t,n,!0):i({},this,t,null,!0)),h.isNullOrUndefined(a)||!(0<a.length)||h.isNullOrUndefined(a[0].tagName)&&1===a.length?"function"!=typeof s&&0===e.childElementCount&&(e.innerHTML=s):[].slice.call(a).forEach(function(t){h.isNullOrUndefined(t.tagName)||(t.style.display=""),e.appendChild(t)})}else e.appendChild(o.cloneNode(!0));return e},b.prototype.clearProgress=function(t){h.isNullOrUndefined(this.intervalId[t])||(clearInterval(this.intervalId[t]),delete this.intervalId[t]),h.isNullOrUndefined(this.progressObj[t])||(clearInterval(this.progressObj[t].intervalId),delete this.progressObj[t])},b.prototype.removeToastContainer=function(t){t&&this.toastContainer.classList.contains("e-toast-util")&&h.detach(this.toastContainer)},b.prototype.clearContainerPos=function(t){var e=this;this.isBlazorServer()?this.toastContainer=null:(this.customPosition?(h.setStyleAttribute(this.toastContainer,{left:"",top:""}),this.removeToastContainer(t),this.toastContainer=null,this.customPosition=!1):([l+"-top-left",l+"-top-right",l+"-bottom-left",l+"-bottom-right",l+"-bottom-center",l+"-top-center",l+"-full-width"].forEach(function(t){!h.isNullOrUndefined(e.toastContainer)&&e.toastContainer.classList.contains(t)&&e.toastContainer.classList.remove(t)}),this.removeToastContainer(t),this.toastContainer=null),h.isNullOrUndefined(this.contentTemplate)||this.clearContentTemplate(),h.isNullOrUndefined(this.toastTemplate)||this.clearToastTemplate())},b.prototype.clearContentTemplate=function(){this.contentTemplate.style.display="none",document.body.appendChild(this.contentTemplate),this.contentTemplate=null},b.prototype.clearToastTemplate=function(){this.toastTemplate.style.display="none",document.body.appendChild(this.toastTemplate),this.toastTemplate=null},b.prototype.isBlazorServer=function(){return h.isBlazor()&&this.isServerRendered},b.prototype.destroyToast=function(e,t){for(var s,i=this,o=0;o<this.toastCollection.length;o++)this.toastCollection[o].element[0]===e&&(s=this.toastCollection[o],this.toastCollection.splice(o,1));var t={options:this,cancel:!1,type:t,element:e,toastContainer:this.toastContainer},n=this.animation.hide,r={duration:n.duration,name:"None"===n.effect&&"Enable"===h.animationMode?"FadeOut":n.effect,timingFunction:n.easing},l=parseInt(e.id.split("toast_")[1],10),a=this.isBlazorServer()?{options:s,toastContainer:this.toastContainer}:{options:s,toastContainer:this.toastContainer,toastObj:this};this.trigger("beforeClose",t,function(t){t.cancel||(h.isNullOrUndefined(i.progressObj[l])||h.isNullOrUndefined(e.querySelector("."+c))||(i.progressObj[l].progressEle.style.width="0%"),r.end=function(){i.clearProgress(l),i.isBlazorServer()&&!h.isNullOrUndefined(s)||h.detach(e),i.trigger("close",a),0===i.toastContainer.childElementCount&&i.clearContainerPos(!0),r=n=null},new h.Animation(r).animate(e))})},b.prototype.personalizeToast=function(){this.setIcon(),this.setTitle(),this.setContent(),this.actionButtons()},b.prototype.setAria=function(){h.attributes(this.toastEle,{role:"alert"})},b.prototype.setPositioning=function(t){this.isBlazorServer()||(isNaN(parseFloat(t.X))&&isNaN(parseFloat(t.Y))?this.toastContainer.classList.add(l+"-"+t.Y.toString().toLowerCase()+"-"+t.X.toString().toLowerCase()):(this.customPosition=!0,h.setStyleAttribute(this.toastContainer,{left:h.formatUnit(t.X),top:h.formatUnit(t.Y)})))},b.prototype.setCloseButton=function(){var t;this.showCloseButton&&(this.l10n=new h.L10n("toast",{close:"Close"},this.locale),this.l10n.setLocale(this.locale),t=this.l10n.getConstant("close"),t=this.createElement("div",{className:r+" e-icons ",attrs:{tabindex:"0","aria-label":t,role:"button"}}),this.toastEle.classList.add("e-toast-header-close-icon"),this.toastEle.appendChild(t))},b.prototype.setProgress=function(){var t;0<this.timeOut&&(t=parseInt(this.toastEle.id.split("toast_")[1],10),this.intervalId[t]=window.setTimeout(this.destroyToast.bind(this,this.toastEle),this.timeOut),this.progressObj[t]={hideEta:null,intervalId:null,maxHideTime:null,element:null,timeOutId:null,progressEle:null},this.progressObj[t].maxHideTime=parseFloat(this.timeOut+""),this.progressObj[t].hideEta=(new Date).getTime()+this.progressObj[t].maxHideTime,this.progressObj[t].element=this.toastEle,0<this.extendedTimeout&&(h.EventHandler.add(this.toastEle,"mouseover",this.toastHoverAction.bind(this,t)),h.EventHandler.add(this.toastEle,"mouseleave",this.delayedToastProgress.bind(this,t)),this.progressObj[t].timeOutId=this.intervalId[t]),this.showProgressBar)&&(this.progressBarEle=this.createElement("div",{className:c}),this.toastEle.insertBefore(this.progressBarEle,this.toastEle.children[0]),this.progressObj[t].intervalId=setInterval(this.updateProgressBar.bind(this,this.progressObj[t]),10),this.progressObj[t].progressEle=this.progressBarEle)},b.prototype.toastHoverAction=function(t){clearTimeout(this.progressObj[t].timeOutId),clearInterval(this.progressObj[t].intervalId),this.progressObj[t].hideEta=0;var e=this.progressObj[t].element;h.isNullOrUndefined(e.querySelector("."+c))||(this.progressObj[t].progressEle.style.width="0%")},b.prototype.delayedToastProgress=function(t){var e,t=this.progressObj[t];h.isNullOrUndefined(t)||(e=t.element,t.timeOutId=window.setTimeout(this.destroyToast.bind(this,e),this.extendedTimeout),t.maxHideTime=parseFloat(this.extendedTimeout+""),t.hideEta=(new Date).getTime()+t.maxHideTime,h.isNullOrUndefined(e.querySelector("."+c)))||(t.intervalId=setInterval(this.updateProgressBar.bind(this,t),10))},b.prototype.updateProgressBar=function(t){var e=(t.hideEta-(new Date).getTime())/t.maxHideTime*100,e="Ltr"===this.progressDirection?100-e:e;t.progressEle.style.width=e+"%"},b.prototype.setIcon=function(){var t;h.isNullOrUndefined(this.icon)||0===this.icon.length||(t=this.createElement("div",{className:"e-toast-icon e-icons "+this.icon}),this.toastEle.classList.add("e-toast-header-icon"),this.toastEle.appendChild(t))},b.prototype.setTitle=function(){var t,e;h.isNullOrUndefined(this.title)||(t=this.createElement("div",{className:A}),t=this.fetchEle(t,this.title,"title"),(e=this.createElement("div",{className:n})).appendChild(t),this.toastEle.appendChild(e))},b.prototype.setContent=function(){var t=this.createElement("div",{className:D}),e=this.element;if(h.isNullOrUndefined(this.content)||""===this.content){var s=""!==this.element.innerHTML.replace(/\s/g,"");if((0<e.children.length||s)&&(!e.firstElementChild||!e.firstElementChild.classList.contains(l))){this.innerEle=document.createDocumentFragment();for(var i=this.createElement("div");0!==e.childNodes.length;)this.innerEle.appendChild(this.element.childNodes[0]);t.appendChild(this.innerEle),[].slice.call(t.children).forEach(function(t){i.appendChild(t.cloneNode(!0))}),this.content=i,this.appendMessageContainer(t)}}else"object"!=typeof this.content||h.isNullOrUndefined(this.content.tagName)?t=this.fetchEle(t,this.content,"content"):(t.appendChild(this.content),this.content=this.content.cloneNode(!0)),this.appendMessageContainer(t)},b.prototype.appendMessageContainer=function(t){var e;0<this.toastEle.querySelectorAll("."+n).length?this.toastEle.querySelector("."+n).appendChild(t):((e=this.createElement("div",{className:n})).appendChild(t),this.toastEle.appendChild(e))},b.prototype.actionButtons=function(){var s=this,i=this.createElement("div",{className:"e-toast-actions"});[].slice.call(this.buttons).forEach(function(t){var e;h.isNullOrUndefined(t.model)||((e=s.createElement("button")).setAttribute("type","button"),!h.isNullOrUndefined(t.model.cssClass)&&0!==t.model.cssClass.length||(t.model.cssClass="e-primary "+s.cssClass),e.classList.add("e-small"),new R.Button(t.model,e),h.isNullOrUndefined(t.click)||"function"!=typeof t.click||h.EventHandler.add(e,"click",t.click),i.appendChild(e))}),0<i.childElementCount&&this.appendMessageContainer(i)},b.prototype.appendToTarget=function(e){var s=this,t=this.isBlazorServer()?{options:e,element:this.toastEle,cancel:!1}:{options:e,toastObj:this,element:this.toastEle,cancel:!1};this.trigger("beforeOpen",t,function(t){t.cancel?s.isBlazorServer()&&(t=parseInt(s.toastEle.id.split("toast_")[1],10),s.clearProgress(t),h.detach(s.toastEle),0===s.toastContainer.childElementCount)&&s.clearContainerPos():(s.isBlazorServer()||(s.toastEle.style.display="none"),s.newestOnTop&&0!==s.toastContainer.childElementCount?s.toastContainer.insertBefore(s.toastEle,s.toastContainer.children[0]):s.isBlazorServer()||s.toastContainer.appendChild(s.toastEle),h.removeClass([s.toastEle],"e-blazor-toast-hidden"),h.EventHandler.add(s.toastEle,"click",s.clickHandler,s),h.EventHandler.add(s.toastEle,"keydown",s.keyDownHandler,s),s.toastContainer.style.zIndex=z.getZindexPartial(s.toastContainer)+"",s.displayToast(s.toastEle,e))})},b.prototype.clickHandler=function(t){var e=this,s=(this.isBlazorServer()||t.stopPropagation(),t.target),i=h.closest(s,"."+l),t=this.isBlazorServer()?{element:i,cancel:!1,clickToClose:!1,originalEvent:t}:{element:i,cancel:!1,clickToClose:!1,originalEvent:t,toastObj:this},o=s.classList.contains(r);this.trigger("click",t,function(t){(o&&!t.cancel||t.clickToClose)&&e.destroyToast(i,"click")})},b.prototype.keyDownHandler=function(t){!t.target.classList.contains(r)||13!==t.keyCode&&32!==t.keyCode||(t=t.target,t=h.closest(t,"."+l),this.destroyToast(t,"key"))},b.prototype.displayToast=function(t,e){var s=this,i=this.animation.show,i={duration:i.duration,name:"None"===i.effect&&"Enable"===h.animationMode?"FadeIn":i.effect,timingFunction:i.easing},o=this.isBlazorServer()?{options:e,element:this.toastEle}:{options:e,toastObj:this,element:this.toastEle};i.begin=function(){t.style.display=""},i.end=function(){s.trigger("open",o)},new h.Animation(i).animate(t)},b.prototype.getContainer=function(){return this.element.classList.add(a),this.element},b.prototype.onPropertyChanged=function(t,e){for(var s=this.element,i=0,o=Object.keys(t);i<o.length;i++)"enableRtl"===o[i]&&(t.enableRtl?s.classList.add(p):s.classList.remove(p))},o([h.Property("300px")],b.prototype,"width",void 0),o([h.Property("auto")],b.prototype,"height",void 0),o([h.Property(null)],b.prototype,"title",void 0),o([h.Property(null)],b.prototype,"content",void 0),o([h.Property(!0)],b.prototype,"enableHtmlSanitizer",void 0),o([h.Property(null)],b.prototype,"icon",void 0),o([h.Property(null)],b.prototype,"cssClass",void 0),o([h.Property(null)],b.prototype,"template",void 0),o([h.Property(!0)],b.prototype,"newestOnTop",void 0),o([h.Property(!1)],b.prototype,"showCloseButton",void 0),o([h.Property(!1)],b.prototype,"showProgressBar",void 0),o([h.Property(5e3)],b.prototype,"timeOut",void 0),o([h.Property("Rtl")],b.prototype,"progressDirection",void 0),o([h.Property(1e3)],b.prototype,"extendedTimeout",void 0),o([h.Complex({},q)],b.prototype,"animation",void 0),o([h.Complex({},F)],b.prototype,"position",void 0),o([h.Collection([{}],M)],b.prototype,"buttons",void 0),o([h.Property(null)],b.prototype,"target",void 0),o([h.Event()],b.prototype,"created",void 0),o([h.Event()],b.prototype,"beforeSanitizeHtml",void 0),o([h.Event()],b.prototype,"destroyed",void 0),o([h.Event()],b.prototype,"open",void 0),o([h.Event()],b.prototype,"beforeOpen",void 0),o([h.Event()],b.prototype,"beforeClose",void 0),o([h.Event()],b.prototype,"close",void 0),o([h.Event()],b.prototype,"click",void 0);var E,V=o([h.NotifyPropertyChanges],b);function b(t,e){t=E.call(this,t,e)||this;return t.toastCollection=[],t.needsID=!0,t}(t.ToastUtility||(t.ToastUtility={})).show=function(t,e,s){var i,o;if(document.querySelector("."+a)?i=document.querySelector("."+a):(i=h.createElement("div",{className:l+" "+a+" e-toast-util"}),document.body.appendChild(i)),"string"==typeof t){var n=void 0,r=void 0;if(h.isNullOrUndefined(e))r=n="";else switch(e){case"Warning":n="e-toast-warning",r="e-toast-warning-icon";break;case"Success":n="e-toast-success",r="e-toast-success-icon";break;case"Error":n="e-toast-danger",r="e-toast-error-icon";break;case"Information":n="e-toast-info",r="e-toast-info-icon"}o={content:t,cssClass:n,icon:r,timeOut:h.isNullOrUndefined(s)?5e3:s}}else o=t;return(e=new V(o)).appendTo(i),e.show(),e};O=function(t,e){return(O=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])}))(t,e)};var O,T,s=function(t,e){function s(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)},o=function(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;0<=l;l--)(o=t[l])&&(r=(n<3?o(r):3<n?o(e,s,r):o(e,s))||r);return 3<n&&r&&Object.defineProperty(e,s,r),r},P=((j=t.Severity||(t.Severity={})).Normal="Normal",j.Success="Success",j.Info="Info",j.Warning="Warning",j.Error="Error",(j=t.Variant||(t.Variant={})).Text="Text",j.Outlined="Outlined",j.Filled="Filled","e-msg-icon"),W="e-content-center",N="e-rtl",w="e-success",S="e-warning",I="e-info",U="e-error",X="e-outlined",Y="e-filled",k="e-hidden",j=(T=h.Component,s(L,T),L.prototype.getModuleName=function(){return"message"},L.prototype.getPersistData=function(){return this.addOnPersist([])},L.prototype.preRender=function(){this.l10n=new h.L10n("message",{close:"Close"},this.locale)},L.prototype.render=function(){this.innerContent=this.element.innerHTML,this.element.innerHTML="",this.msgElement=this.createElement("div",{className:"e-msg-content-wrap"}),this.initialize(),this.wireEvents(),this.renderComplete(),this.renderReactTemplates(),this.initialRender=!1},L.prototype.initialize=function(){this.element.setAttribute("role","alert"),this.setCssClass(),this.setIcon(),this.setContent(),this.setCloseIcon(),this.setSeverity(),this.setVariant(),this.setVisible(),this.enableRtl&&this.element.classList.add(N)},L.prototype.setIcon=function(){this.showIcon&&(this.iconElement=this.createElement("span",{className:P}),(this.element.classList.contains(W)?this.msgElement:this.element).appendChild(this.iconElement))},L.prototype.setCloseIcon=function(){this.showCloseIcon&&(this.closeIcon=this.createElement("button",{attrs:{type:"button",class:"e-msg-close-icon"}}),this.element.appendChild(this.closeIcon),this.setTitle())},L.prototype.setTitle=function(){this.l10n.setLocale(this.locale);var t=this.l10n.getConstant("close");this.closeIcon.setAttribute("title",t),this.closeIcon.setAttribute("aria-label",t)},L.prototype.setContent=function(){this.txtElement=this.createElement("div",{className:"e-msg-content"}),this.element.classList.contains(W)?(this.msgElement.appendChild(this.txtElement),this.element.appendChild(this.msgElement)):this.element.appendChild(this.txtElement),this.setTemplate()},L.prototype.setTemplate=function(){var t;h.isNullOrUndefined(this.content)||""===this.content?this.txtElement.innerHTML=this.innerContent:h.isNullOrUndefined(this.content)||""===this.content||"string"!=typeof this.content&&"string"==typeof this.content||(this.isVue||"string"!=typeof this.content?(t=h.compile(this.content),h.isNullOrUndefined(t)||(t=t({},this,"content",this.element.id+"content",!0))&&(t=Array.prototype.slice.call(t),h.append(t,this.txtElement),this.renderReactTemplates())):this.txtElement.innerHTML=this.content)},L.prototype.setSeverity=function(){h.removeClass([this.element],[w,S,I,U]),"Success"===this.severity?h.addClass([this.element],w):"Warning"===this.severity?h.addClass([this.element],S):"Error"===this.severity?h.addClass([this.element],U):"Info"===this.severity&&h.addClass([this.element],I)},L.prototype.setVariant=function(){h.removeClass([this.element],[Y,X]),"Outlined"===this.variant?h.addClass([this.element],X):"Filled"===this.variant&&h.addClass([this.element],Y)},L.prototype.setCssClass=function(t){t&&h.removeClass([this.element],t.split(" ")),this.cssClass&&h.addClass([this.element],this.cssClass.split(" "))},L.prototype.setVisible=function(){this.visible?h.removeClass([this.element],k):(h.addClass([this.element],k),this.initialRender||this.trigger("closed",{event:event,isInteracted:!1,element:this.element}))},L.prototype.clickHandler=function(t){this.closeMessage(t)},L.prototype.keyboardHandler=function(t){32!==t.keyCode&&13!==t.keyCode||this.closeMessage(t)},L.prototype.closeMessage=function(t){h.addClass([this.element],k),this.setProperties({visible:!1},!0);t={event:t,isInteracted:!0,element:this.element};this.trigger("closed",t)},L.prototype.wireEvents=function(){this.showCloseIcon&&(h.EventHandler.add(this.closeIcon,"click",this.clickHandler,this),h.EventHandler.add(this.closeIcon,"keydown",this.keyboardHandler,this))},L.prototype.unWireEvents=function(){this.showCloseIcon&&(h.EventHandler.remove(this.closeIcon,"click",this.clickHandler),h.EventHandler.remove(this.closeIcon,"keydown",this.keyboardHandler))},L.prototype.onPropertyChanged=function(t,e){for(var s=0,i=Object.keys(t);s<i.length;s++)switch(i[s]){case"cssClass":this.setCssClass(e.cssClass);break;case"content":this.txtElement.innerHTML="",this.setTemplate();break;case"enableRtl":this.enableRtl?this.element.classList.add(N):this.element.classList.remove(N);break;case"locale":this.showCloseIcon&&this.setTitle();break;case"showIcon":!this.showIcon&&0<this.element.getElementsByClassName(P).length&&h.detach(this.iconElement),this.showIcon&&(this.iconElement=this.createElement("span",{className:P}),this.element.insertBefore(this.iconElement,this.txtElement));break;case"showCloseIcon":this.showCloseIcon||h.isNullOrUndefined(this.closeIcon)?(this.setCloseIcon(),this.wireEvents()):(this.unWireEvents(),h.detach(this.closeIcon));break;case"severity":this.setSeverity();break;case"variant":this.setVariant();break;case"visible":this.setVisible()}},L.prototype.destroy=function(){var t=h.isNullOrUndefined(this.cssClass)?[""]:this.cssClass.split(" "),e=[w,S,I,U,N,k,X,Y],e=1===t.length&&""===t[0]?e:e.concat(t);h.removeClass([this.element],e),this.element.removeAttribute("role"),this.unWireEvents(),h.isNullOrUndefined(this.iconElement)||h.detach(this.iconElement),h.detach(this.txtElement),h.isNullOrUndefined(this.closeIcon)||h.detach(this.closeIcon),T.prototype.destroy.call(this)},o([h.Property(null)],L.prototype,"content",void 0),o([h.Property("")],L.prototype,"cssClass",void 0),o([h.Property(!0)],L.prototype,"showIcon",void 0),o([h.Property(!1)],L.prototype,"showCloseIcon",void 0),o([h.Property("Normal")],L.prototype,"severity",void 0),o([h.Property("Text")],L.prototype,"variant",void 0),o([h.Property(!0)],L.prototype,"visible",void 0),o([h.Event()],L.prototype,"created",void 0),o([h.Event()],L.prototype,"destroyed",void 0),o([h.Event()],L.prototype,"closed",void 0),o([h.NotifyPropertyChanges],L));function L(t,e){t=T.call(this,t,e)||this;return t.initialRender=!0,t}J=function(t,e){return(J=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])}))(t,e)};var J,H,s=function(t,e){function s(){this.constructor=t}J(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)},o=function(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;0<=l;l--)(o=t[l])&&(r=(n<3?o(r):3<n?o(e,s,r):o(e,s))||r);return 3<n&&r&&Object.defineProperty(e,s,r),r},G={TEXTSHAPE:"e-skeleton-text",CIRCLESHAPE:"e-skeleton-circle",SQUARESHAPE:"e-skeleton-square",RECTANGLESHAPE:"e-skeleton-rectangle",WAVEEFFECT:"e-shimmer-wave",PULSEEFFECT:"e-shimmer-pulse",FADEEFFECT:"e-shimmer-fade",VISIBLENONE:"e-visible-none"},x=((x=t.SkeletonType||(t.SkeletonType={})).Text="Text",x.Circle="Circle",x.Square="Square",x.Rectangle="Rectangle",(x=t.ShimmerEffect||(t.ShimmerEffect={})).Wave="Wave",x.Fade="Fade",x.Pulse="Pulse",x.None="None",H=h.Component,s(B,H),B.prototype.getModuleName=function(){return"skeleton"},B.prototype.getPersistData=function(){return this.addOnPersist([])},B.prototype.preRender=function(){this.element.id||(this.element.id=h.getUniqueID("e-"+this.getModuleName())),this.updateCssClass(),h.attributes(this.element,{role:"alert","aria-busy":"true","aria-live":"polite","aria-label":this.label})},B.prototype.render=function(){this.initialize()},B.prototype.onPropertyChanged=function(t,e){for(var s=0,i=Object.keys(t);s<i.length;s++)switch(i[s]){case"width":case"height":this.updateDimension();break;case"shape":this.updateShape();break;case"shimmerEffect":this.updateEffect();break;case"visible":this.updateVisibility();break;case"label":this.element.setAttribute("aria-label",this.label);break;case"cssClass":e.cssClass&&h.removeClass([this.element],e.cssClass.split(" ")),this.updateCssClass()}},B.prototype.destroy=function(){H.prototype.destroy.call(this);var t=["role","aria-live","aria-busy","aria-label"],e=[];this.cssClass&&(e=e.concat(this.cssClass.split(" ")));for(var s=0;s<t.length;s++)this.element.removeAttribute(t[parseInt(s.toString(),10)]);e=(e=e.concat(this.element.classList.value.match(/(e-skeleton-[^\s]+)/g)||[])).concat(this.element.classList.value.match(/(e-shimmer-[^\s]+)/g)||[]),h.removeClass([this.element],e)},B.prototype.initialize=function(){this.updateShape(),this.updateEffect(),this.updateVisibility()},B.prototype.updateShape=function(){var t,e;h.isNullOrUndefined(this.shape)||(t=G[this.shape.toUpperCase()+"SHAPE"],e=this.element.classList.value.match(/(e-skeleton-[^\s]+)/g)||[],this.updateDimension(),e&&h.removeClass([this.element],e),h.addClass([this.element],[t]))},B.prototype.updateDimension=function(){var t=!this.width&&-1<["Text","Rectangle"].indexOf(this.shape)?"100%":h.formatUnit(this.width),e=-1<["Circle","Square"].indexOf(this.shape)?t:h.formatUnit(this.height);this.element.style.width=t,this.element.style.height=e},B.prototype.updateEffect=function(){var t=this.element.classList.value.match(/(e-shimmer-[^\s]+)/g)||[];t&&h.removeClass([this.element],t),h.isNullOrUndefined(this.shimmerEffect)||h.addClass([this.element],[G[this.shimmerEffect.toUpperCase()+"EFFECT"]])},B.prototype.updateVisibility=function(){this.element.classList[this.visible?"remove":"add"](G.VISIBLENONE)},B.prototype.updateCssClass=function(){this.cssClass&&h.addClass([this.element],this.cssClass.split(" "))},o([h.Property("")],B.prototype,"width",void 0),o([h.Property("")],B.prototype,"height",void 0),o([h.Property(!0)],B.prototype,"visible",void 0),o([h.Property("Text")],B.prototype,"shape",void 0),o([h.Property("Wave")],B.prototype,"shimmerEffect",void 0),o([h.Property("Loading...")],B.prototype,"label",void 0),o([h.Property("")],B.prototype,"cssClass",void 0),o([h.NotifyPropertyChanges],B));function B(t,e){return H.call(this,t,e)||this}t.ButtonModelProps=M,t.Message=j,t.Skeleton=x,t.Toast=V,t.ToastAnimationSettings=q,t.ToastAnimations=y,t.ToastPosition=F,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-notifications.umd.min.js.map