@syncfusion/ej2-notifications
Advanced tools
Comparing version 18.4.39 to 19.1.54
@@ -7,10 +7,2 @@ # Changelog | ||
#### New Features | ||
- `I307310` - Provided the 'progressDirection' property to customize the progress bar direction from left-to-right or right-to-left. | ||
## 18.4.34 (2021-01-12) | ||
### Toast | ||
#### Bug Fixes | ||
@@ -17,0 +9,0 @@ |
/*! | ||
* filename: ej2-notifications.umd.min.js | ||
* version : 18.4.39 | ||
* version : 19.1.54 | ||
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved. | ||
@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license. | ||
*/ | ||
!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.ej={},t.ej2Base,t.ej2Buttons,t.ej2Popups)}(this,function(t,e,i,s){"use strict";var o=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),n=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r},r="e-toast",l="e-toast-container",a="e-toast-title",h="e-toast-full-width",p="e-toast-content",d="e-toast-message",c="e-toast-progress",u="e-toast-close-icon",f=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("Left")],i.prototype,"X",void 0),n([e.Property("Top")],i.prototype,"Y",void 0),i}(e.ChildProperty),m=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property(null)],i.prototype,"model",void 0),n([e.Property(null)],i.prototype,"click",void 0),i}(e.ChildProperty),y=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("FadeIn")],i.prototype,"effect",void 0),n([e.Property(600)],i.prototype,"duration",void 0),n([e.Property("ease")],i.prototype,"easing",void 0),i}(e.ChildProperty),v=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Complex({effect:"FadeIn",duration:600,easing:"ease"},y)],i.prototype,"show",void 0),n([e.Complex({effect:"FadeOut",duration:600,easing:"ease"},y)],i.prototype,"hide",void 0),i}(e.ChildProperty),g=function(t){function y(e,i){var s=t.call(this,e,i)||this;return s.toastCollection=[],s}return o(y,t),y.prototype.getModuleName=function(){return"toast"},y.prototype.getPersistData=function(){return this.addOnPersist([])},y.prototype.destroy=function(){this.hide("All"),this.element.classList.remove(l),e.setStyleAttribute(this.element,{position:"","z-index":""}),e.isNullOrUndefined(this.refElement)||e.isNullOrUndefined(this.refElement.parentElement)||(this.refElement.parentElement.insertBefore(this.element,this.refElement),e.detach(this.refElement),this.refElement=void 0),this.isBlazorServer()||t.prototype.destroy.call(this)},y.prototype.preRender=function(){this.isDevice=e.Browser.isDevice,"300px"===this.width&&(this.width=this.isDevice&&screen.width<768?"100%":"300px"),e.isNullOrUndefined(this.target)&&(this.target=document.body),this.enableRtl&&!this.isBlazorServer()&&this.element.classList.add("e-rtl")},y.prototype.render=function(){this.progressObj=[],this.intervalId=[],this.contentTemplate=null,this.toastTemplate=null,this.isDevice&&screen.width<768&&new e.Touch(this.element,{swipe:this.swipeHandler.bind(this)}),this.renderComplete(),this.initRenderClass=this.element.className},y.prototype.show=function(t){var i;if(e.isNullOrUndefined(t)||(this.templateChanges(t),i=JSON.parse(JSON.stringify(t)),e.extend(this,this,t)),e.isNullOrUndefined(this.toastContainer)){this.toastContainer=this.getContainer();var s="string"==typeof this.target?document.querySelector(this.target):document.body;if(e.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:r,id:e.getUniqueID("toast")}),this.setWidthHeight(),this.setCSSClass(this.cssClass),e.isNullOrUndefined(this.template)||""===this.template?this.personalizeToast():this.templateRendering(),this.setProgress(),this.setCloseButton(),this.setAria(),this.appendToTarget(t),e.isNullOrUndefined(i)||(e.extend(i,{element:[this.toastEle]},!0),this.toastCollection.push(i)),this.isReact&&this.renderReactTemplates())},y.prototype.showToast=function(t,e){this.toastEle=this.element.querySelector("#"+t),this.show(e)},y.prototype.isToastModel=function(t){this.toastContainer=this.element,this.setPositioning(this.position);e.isNullOrUndefined(this.element.lastElementChild)||this.setProgress(),this.setAria(),this.appendToTarget(t)},y.prototype.swipeHandler=function(t){var i=e.closest(t.originalEvent.target,".e-toast:not(."+l+")"),s=this.animation.hide.effect;e.isNullOrUndefined(i)||("Right"===t.swipeDirection?(this.animation.hide.effect="SlideRightOut",this.hide(i)):"Left"===t.swipeDirection&&(this.animation.hide.effect="SlideLeftOut",this.hide(i)),this.animation.hide.effect=s)},y.prototype.templateChanges=function(t){e.isUndefined(t.content)||e.isNullOrUndefined(this.contentTemplate)||this.content===t.content||this.clearContentTemplate(),e.isUndefined(t.template)||e.isNullOrUndefined(this.toastTemplate)||this.template===t.template||this.clearToastTemplate()},y.prototype.setCSSClass=function(t){if(t){var i=-1!==t.indexOf(",")?",":" ";e.classList(this.toastEle,t.split(i),[])}},y.prototype.setWidthHeight=function(){"300px"===this.width?this.toastEle.style.width=e.formatUnit(this.width):"100%"===this.width?this.toastContainer.classList.add(h):(this.toastEle.style.width=e.formatUnit(this.width),this.toastContainer.classList.remove(h)),this.toastEle.style.height=e.formatUnit(this.height)},y.prototype.templateRendering=function(){this.fetchEle(this.toastEle,this.template,"template")},y.prototype.sanitizeHelper=function(t){if(this.enableHtmlSanitizer){var i=e.SanitizeHtmlHelper.beforeSanitize();e.extend(i,i,{cancel:!1,helper:null}),this.trigger("beforeSanitizeHtml",i),i.cancel&&!e.isNullOrUndefined(i.helper)?t=i.helper(t):i.cancel||(t=e.SanitizeHtmlHelper.serializeValue(i,t))}return t},y.prototype.hide=function(t){if(!e.isNullOrUndefined(this.toastContainer)&&0!==this.toastContainer.childElementCount)if("string"!=typeof t||"All"!==t)e.isNullOrUndefined(t)&&(t=this.newestOnTop?this.toastContainer.lastElementChild:this.toastContainer.firstElementChild),this.destroyToast(t),this.isReact&&this.clearTemplate();else for(var i=0;i<this.toastContainer.childElementCount;i++)this.destroyToast(this.toastContainer.children[i])},y.prototype.fetchEle=function(t,i,s){i="string"==typeof i?this.sanitizeHelper(i):i;var o,n,r,l;if(l=t.classList.contains(a)?this.element.id+"title":t.classList.contains(p)?this.element.id+"content":this.element.id+"template",n="content"===s?this.contentTemplate:this.toastTemplate,!e.isNullOrUndefined(n))return t.appendChild(n.cloneNode(!0)),t;try{if(document.querySelectorAll(i).length>0){var h=null;"title"!==s&&(h=document.querySelector(i),t.appendChild(h),h.style.display="");var d=e.isNullOrUndefined(h)?n:h.cloneNode(!0);"content"===s?this.contentTemplate=d:this.toastTemplate=d}}catch(t){o=e.compile(i)}if(!e.isNullOrUndefined(o))if(this.isBlazorServer()){r=o({},this,s,l,!0)}else r=o({},this,s,null,!0);return e.isNullOrUndefined(r)||!(r.length>0)||e.isNullOrUndefined(r[0].tagName)&&1===r.length?0===t.childElementCount&&(t.innerHTML=i):[].slice.call(r).forEach(function(i){e.isNullOrUndefined(i.tagName)||(i.style.display=""),t.appendChild(i)}),t},y.prototype.clearProgress=function(t){e.isNullOrUndefined(this.intervalId[t])||(clearInterval(this.intervalId[t]),delete this.intervalId[t]),e.isNullOrUndefined(this.progressObj[t])||(clearInterval(this.progressObj[t].intervalId),delete this.progressObj[t])},y.prototype.clearContainerPos=function(){var t=this;this.isBlazorServer()?this.toastContainer=null:(this.customPosition?(e.setStyleAttribute(this.toastContainer,{left:"",top:""}),this.toastContainer=null,this.customPosition=!1):([r+"-top-left",r+"-top-right",r+"-bottom-left",r+"-bottom-right",r+"-bottom-center",r+"-top-center",r+"-full-width"].forEach(function(i){!e.isNullOrUndefined(t.toastContainer)&&t.toastContainer.classList.contains(i)&&t.toastContainer.classList.remove(i)}),this.toastContainer=null),e.isNullOrUndefined(this.contentTemplate)||this.clearContentTemplate(),e.isNullOrUndefined(this.toastTemplate)||this.clearToastTemplate())},y.prototype.clearContentTemplate=function(){this.contentTemplate.style.display="none",document.body.appendChild(this.contentTemplate),this.contentTemplate=null},y.prototype.clearToastTemplate=function(){this.toastTemplate.style.display="none",document.body.appendChild(this.toastTemplate),this.toastTemplate=null},y.prototype.isBlazorServer=function(){return e.isBlazor()&&this.isServerRendered},y.prototype.destroyToast=function(t){for(var i,s=this,o=0;o<this.toastCollection.length;o++)this.toastCollection[o].element[0]===t&&(i=this.toastCollection[o],this.toastCollection.splice(o,1));var n=this.animation.hide,r={duration:n.duration,name:n.effect,timingFunction:n.easing},l=parseInt(t.id.split("toast_")[1],10),a=this.isBlazorServer()?{options:i,toastContainer:this.toastContainer}:{options:i,toastContainer:this.toastContainer,toastObj:this};e.isNullOrUndefined(this.progressObj[l])||e.isNullOrUndefined(t.querySelector("."+c))||(this.progressObj[l].progressEle.style.width="0%"),r.end=function(){s.clearProgress(l),s.isBlazorServer()&&!e.isNullOrUndefined(i)||e.detach(t),s.trigger("close",a),0===s.toastContainer.childElementCount&&s.clearContainerPos()},new e.Animation({}).animate(t,r)},y.prototype.personalizeToast=function(){this.setIcon(),this.setTitle(),this.setContent(),this.actionButtons()},y.prototype.setAria=function(){e.attributes(this.toastEle,{role:"alert"})},y.prototype.setPositioning=function(t){this.isBlazorServer()||(isNaN(parseFloat(t.X))&&isNaN(parseFloat(t.Y))?this.toastContainer.classList.add(r+"-"+t.Y.toString().toLowerCase()+"-"+t.X.toString().toLowerCase()):(this.customPosition=!0,e.setStyleAttribute(this.toastContainer,{left:e.formatUnit(t.X),top:e.formatUnit(t.Y)})))},y.prototype.setCloseButton=function(){if(this.showCloseButton){this.l10n=new e.L10n("toast",{close:"Close"},this.locale),this.l10n.setLocale(this.locale);var t=this.l10n.getConstant("close"),i=this.createElement("div",{className:u+" e-icons ",attrs:{tabindex:"0","aria-label":t}});this.toastEle.appendChild(i)}},y.prototype.setProgress=function(){if(this.timeOut>0){var 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,this.extendedTimeout>0&&(e.EventHandler.add(this.toastEle,"mouseover",this.toastHoverAction.bind(this,t)),e.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)}},y.prototype.toastHoverAction=function(t){clearTimeout(this.progressObj[t].timeOutId),clearInterval(this.progressObj[t].intervalId),this.progressObj[t].hideEta=0;var i=this.progressObj[t].element;e.isNullOrUndefined(i.querySelector("."+c))||(this.progressObj[t].progressEle.style.width="0%")},y.prototype.delayedToastProgress=function(t){var i=this.progressObj[t],s=i.element;i.timeOutId=window.setTimeout(this.destroyToast.bind(this,s),this.extendedTimeout),i.maxHideTime=parseFloat(this.extendedTimeout+""),i.hideEta=(new Date).getTime()+i.maxHideTime,e.isNullOrUndefined(s.querySelector("."+c))||(i.intervalId=setInterval(this.updateProgressBar.bind(this,i),10))},y.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+"%"},y.prototype.setIcon=function(){if(!e.isNullOrUndefined(this.icon)&&0!==this.icon.length){var t=this.createElement("div",{className:"e-toast-icon e-icons "+this.icon});this.toastEle.appendChild(t)}},y.prototype.setTitle=function(){if(!e.isNullOrUndefined(this.title)){var t=this.createElement("div",{className:a});t=this.fetchEle(t,this.title,"title");var i=this.createElement("div",{className:d});i.appendChild(t),this.toastEle.appendChild(i)}},y.prototype.setContent=function(){var t=this.createElement("div",{className:p}),i=this.element;if(e.isNullOrUndefined(this.content)||""===this.content){var s=""!==this.element.innerHTML.replace(/\s/g,"");if((i.children.length>0||s)&&(!i.firstElementChild||!i.firstElementChild.classList.contains(r))){this.innerEle=document.createDocumentFragment();for(var o=this.createElement("div");0!==i.childNodes.length;)this.innerEle.appendChild(this.element.childNodes[0]);t.appendChild(this.innerEle),[].slice.call(t.children).forEach(function(t){o.appendChild(t.cloneNode(!0))}),this.content=o,this.appendMessageContainer(t)}}else"object"!=typeof this.content||e.isNullOrUndefined(this.content.tagName)?(t=this.fetchEle(t,this.content,"content"),this.appendMessageContainer(t)):(t.appendChild(this.content),this.content=this.content.cloneNode(!0),this.appendMessageContainer(t))},y.prototype.appendMessageContainer=function(t){if(this.toastEle.querySelectorAll("."+d).length>0)this.toastEle.querySelector("."+d).appendChild(t);else{var e=this.createElement("div",{className:d});e.appendChild(t),this.toastEle.appendChild(e)}},y.prototype.actionButtons=function(){var t=this,s=this.createElement("div",{className:"e-toast-actions"});[].slice.call(this.buttons).forEach(function(o){if(!e.isNullOrUndefined(o.model)){var n=t.createElement("button");n.setAttribute("type","button"),(e.isNullOrUndefined(o.model.cssClass)||0===o.model.cssClass.length)&&(o.model.cssClass="e-primary"),n.classList.add("e-small"),new i.Button(o.model,n),e.isNullOrUndefined(o.click)||"function"!=typeof o.click||e.EventHandler.add(n,"click",o.click),s.appendChild(n)}}),s.childElementCount>0&&this.appendMessageContainer(s)},y.prototype.appendToTarget=function(t){var i=this,o=this.isBlazorServer()?{options:t,element:this.toastEle,cancel:!1}:{options:t,toastObj:this,element:this.toastEle,cancel:!1};this.trigger("beforeOpen",o,function(o){if(o.cancel){if(i.isBlazorServer()){var n=parseInt(i.toastEle.id.split("toast_")[1],10);i.clearProgress(n),e.detach(i.toastEle),0===i.toastContainer.childElementCount&&i.clearContainerPos()}}else i.isBlazorServer()||(i.toastEle.style.display="none"),i.newestOnTop&&0!==i.toastContainer.childElementCount?i.toastContainer.insertBefore(i.toastEle,i.toastContainer.children[0]):i.isBlazorServer()||i.toastContainer.appendChild(i.toastEle),e.removeClass([i.toastEle],"e-blazor-toast-hidden"),e.EventHandler.add(i.toastEle,"click",i.clickHandler,i),e.EventHandler.add(i.toastEle,"keydown",i.keyDownHandler,i),i.toastContainer.style.zIndex=s.getZindexPartial(i.toastContainer)+"",i.displayToast(i.toastEle,t)})},y.prototype.clickHandler=function(t){var i=this;this.isBlazorServer()||t.stopPropagation();var s=t.target,o=e.closest(s,"."+r),n=this.isBlazorServer()?{element:o,cancel:!1,clickToClose:!1,originalEvent:t}:{element:o,cancel:!1,clickToClose:!1,originalEvent:t,toastObj:this},l=s.classList.contains(u);this.trigger("click",n,function(t){(l&&!t.cancel||t.clickToClose)&&i.destroyToast(o)})},y.prototype.keyDownHandler=function(t){if(t.target.classList.contains(u)&&(13===t.keyCode||32===t.keyCode)){var i=t.target,s=e.closest(i,"."+r);this.destroyToast(s)}},y.prototype.displayToast=function(t,i){var s=this,o=this.animation.show,n={duration:o.duration,name:o.effect,timingFunction:o.easing},r=this.isBlazorServer()?{options:i,element:this.toastEle}:{options:i,toastObj:this,element:this.toastEle};n.begin=function(){t.style.display=""},n.end=function(){s.trigger("open",r)},new e.Animation(n).animate(t)},y.prototype.getContainer=function(){return this.element.classList.add(l),this.element},y.prototype.onPropertyChanged=function(t,e){for(var i=this.element,s=0,o=Object.keys(t);s<o.length;s++){switch(o[s]){case"enableRtl":t.enableRtl?i.classList.add("e-rtl"):i.classList.remove("e-rtl")}}},n([e.Property("300px")],y.prototype,"width",void 0),n([e.Property("auto")],y.prototype,"height",void 0),n([e.Property(null)],y.prototype,"title",void 0),n([e.Property(null)],y.prototype,"content",void 0),n([e.Property(!0)],y.prototype,"enableHtmlSanitizer",void 0),n([e.Property(null)],y.prototype,"icon",void 0),n([e.Property(null)],y.prototype,"cssClass",void 0),n([e.Property(null)],y.prototype,"template",void 0),n([e.Property(!0)],y.prototype,"newestOnTop",void 0),n([e.Property(!1)],y.prototype,"showCloseButton",void 0),n([e.Property(!1)],y.prototype,"showProgressBar",void 0),n([e.Property(5e3)],y.prototype,"timeOut",void 0),n([e.Property("Rtl")],y.prototype,"progressDirection",void 0),n([e.Property(1e3)],y.prototype,"extendedTimeout",void 0),n([e.Complex({},v)],y.prototype,"animation",void 0),n([e.Complex({},f)],y.prototype,"position",void 0),n([e.Collection([{}],m)],y.prototype,"buttons",void 0),n([e.Property(null)],y.prototype,"target",void 0),n([e.Event()],y.prototype,"created",void 0),n([e.Event()],y.prototype,"beforeSanitizeHtml",void 0),n([e.Event()],y.prototype,"destroyed",void 0),n([e.Event()],y.prototype,"open",void 0),n([e.Event()],y.prototype,"beforeOpen",void 0),n([e.Event()],y.prototype,"close",void 0),n([e.Event()],y.prototype,"click",void 0),y=n([e.NotifyPropertyChanges],y)}(e.Component);t.ToastPosition=f,t.ButtonModelProps=m,t.ToastAnimations=y,t.ToastAnimationSettings=v,t.Toast=g,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!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.ej={},t.ej2Base,t.ej2Buttons,t.ej2Popups)}(this,function(t,e,i,s){"use strict";var o=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),n=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r},r="e-toast",l="e-toast-container",a="e-toast-title",p="e-toast-full-width",h="e-toast-content",d="e-toast-message",c="e-toast-progress",u="e-toast-close-icon",f=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("Left")],i.prototype,"X",void 0),n([e.Property("Top")],i.prototype,"Y",void 0),i}(e.ChildProperty),m=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property(null)],i.prototype,"model",void 0),n([e.Property(null)],i.prototype,"click",void 0),i}(e.ChildProperty),y=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("FadeIn")],i.prototype,"effect",void 0),n([e.Property(600)],i.prototype,"duration",void 0),n([e.Property("ease")],i.prototype,"easing",void 0),i}(e.ChildProperty),v=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Complex({effect:"FadeIn",duration:600,easing:"ease"},y)],i.prototype,"show",void 0),n([e.Complex({effect:"FadeOut",duration:600,easing:"ease"},y)],i.prototype,"hide",void 0),i}(e.ChildProperty),g=function(t){function y(e,i){var s=t.call(this,e,i)||this;return s.toastCollection=[],s}return o(y,t),y.prototype.getModuleName=function(){return"toast"},y.prototype.getPersistData=function(){return this.addOnPersist([])},y.prototype.destroy=function(){this.hide("All"),this.element.classList.remove(l),e.setStyleAttribute(this.element,{position:"","z-index":""}),e.isNullOrUndefined(this.refElement)||e.isNullOrUndefined(this.refElement.parentElement)||(this.refElement.parentElement.insertBefore(this.element,this.refElement),e.detach(this.refElement),this.refElement=void 0),this.isBlazorServer()||t.prototype.destroy.call(this)},y.prototype.preRender=function(){this.isDevice=e.Browser.isDevice,"300px"===this.width&&(this.width=this.isDevice&&screen.width<768?"100%":"300px"),e.isNullOrUndefined(this.target)&&(this.target=document.body),this.enableRtl&&!this.isBlazorServer()&&this.element.classList.add("e-rtl")},y.prototype.render=function(){this.progressObj=[],this.intervalId=[],this.contentTemplate=null,this.toastTemplate=null,this.isDevice&&screen.width<768&&new e.Touch(this.element,{swipe:this.swipeHandler.bind(this)}),this.renderComplete(),this.initRenderClass=this.element.className},y.prototype.show=function(t){var i;if(e.isNullOrUndefined(t)||(this.templateChanges(t),i=JSON.parse(JSON.stringify(t)),e.extend(this,this,t)),e.isNullOrUndefined(this.toastContainer)){this.toastContainer=this.getContainer();var s="string"==typeof this.target?document.querySelector(this.target):document.body;if(e.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:r,id:e.getUniqueID("toast")}),this.setWidthHeight(),this.setCSSClass(this.cssClass),e.isNullOrUndefined(this.template)||""===this.template?this.personalizeToast():this.templateRendering(),this.setProgress(),this.setCloseButton(),this.setAria(),this.appendToTarget(t),e.isNullOrUndefined(i)||(e.extend(i,{element:[this.toastEle]},!0),this.toastCollection.push(i)),this.isReact&&this.renderReactTemplates())},y.prototype.showToast=function(t,e){this.toastEle=this.element.querySelector("#"+t),this.show(e)},y.prototype.isToastModel=function(t){this.toastContainer=this.element,this.setPositioning(this.position);e.isNullOrUndefined(this.element.lastElementChild)||this.setProgress(),this.setAria(),this.appendToTarget(t)},y.prototype.swipeHandler=function(t){var i=e.closest(t.originalEvent.target,".e-toast:not(."+l+")"),s=this.animation.hide.effect;e.isNullOrUndefined(i)||("Right"===t.swipeDirection?(this.animation.hide.effect="SlideRightOut",this.hideToast("swipe",i)):"Left"===t.swipeDirection&&(this.animation.hide.effect="SlideLeftOut",this.hideToast("swipe",i)),this.animation.hide.effect=s)},y.prototype.templateChanges=function(t){e.isUndefined(t.content)||e.isNullOrUndefined(this.contentTemplate)||this.content===t.content||this.clearContentTemplate(),e.isUndefined(t.template)||e.isNullOrUndefined(this.toastTemplate)||this.template===t.template||this.clearToastTemplate()},y.prototype.setCSSClass=function(t){if(t){var i=-1!==t.indexOf(",")?",":" ";e.classList(this.toastEle,t.split(i),[])}},y.prototype.setWidthHeight=function(){"300px"===this.width?this.toastEle.style.width=e.formatUnit(this.width):"100%"===this.width?this.toastContainer.classList.add(p):(this.toastEle.style.width=e.formatUnit(this.width),this.toastContainer.classList.remove(p)),this.toastEle.style.height=e.formatUnit(this.height)},y.prototype.templateRendering=function(){this.fetchEle(this.toastEle,this.template,"template")},y.prototype.sanitizeHelper=function(t){if(this.enableHtmlSanitizer){var i=e.SanitizeHtmlHelper.beforeSanitize();e.extend(i,i,{cancel:!1,helper:null}),this.trigger("beforeSanitizeHtml",i),i.cancel&&!e.isNullOrUndefined(i.helper)?t=i.helper(t):i.cancel||(t=e.SanitizeHtmlHelper.serializeValue(i,t))}return t},y.prototype.hide=function(t){this.hideToast("",t)},y.prototype.hideToast=function(t,i){if(!e.isNullOrUndefined(this.toastContainer)&&0!==this.toastContainer.childElementCount)if("string"!=typeof i||"All"!==i)e.isNullOrUndefined(i)&&(i=this.newestOnTop?this.toastContainer.lastElementChild:this.toastContainer.firstElementChild),this.destroyToast(i,t);else for(var s=0;s<this.toastContainer.childElementCount;s++)this.destroyToast(this.toastContainer.children[s],t)},y.prototype.fetchEle=function(t,i,s){i="string"==typeof i?this.sanitizeHelper(i):i;var o,n,r,l;if(l=t.classList.contains(a)?this.element.id+"title":t.classList.contains(h)?this.element.id+"content":this.element.id+"template",n="content"===s?this.contentTemplate:this.toastTemplate,!e.isNullOrUndefined(n))return t.appendChild(n.cloneNode(!0)),t;try{if(document.querySelectorAll(i).length>0){var p=null;"title"!==s&&(p=document.querySelector(i),t.appendChild(p),p.style.display="");var d=e.isNullOrUndefined(p)?n:p.cloneNode(!0);"content"===s?this.contentTemplate=d:this.toastTemplate=d}}catch(t){o=e.compile(i)}if(!e.isNullOrUndefined(o))if(this.isBlazorServer()){r=o({},this,s,l,!0)}else r=o({},this,s,null,!0);return e.isNullOrUndefined(r)||!(r.length>0)||e.isNullOrUndefined(r[0].tagName)&&1===r.length?0===t.childElementCount&&(t.innerHTML=i):[].slice.call(r).forEach(function(i){e.isNullOrUndefined(i.tagName)||(i.style.display=""),t.appendChild(i)}),t},y.prototype.clearProgress=function(t){e.isNullOrUndefined(this.intervalId[t])||(clearInterval(this.intervalId[t]),delete this.intervalId[t]),e.isNullOrUndefined(this.progressObj[t])||(clearInterval(this.progressObj[t].intervalId),delete this.progressObj[t])},y.prototype.clearContainerPos=function(){var t=this;this.isBlazorServer()?this.toastContainer=null:(this.customPosition?(e.setStyleAttribute(this.toastContainer,{left:"",top:""}),this.toastContainer=null,this.customPosition=!1):([r+"-top-left",r+"-top-right",r+"-bottom-left",r+"-bottom-right",r+"-bottom-center",r+"-top-center",r+"-full-width"].forEach(function(i){!e.isNullOrUndefined(t.toastContainer)&&t.toastContainer.classList.contains(i)&&t.toastContainer.classList.remove(i)}),this.toastContainer=null),e.isNullOrUndefined(this.contentTemplate)||this.clearContentTemplate(),e.isNullOrUndefined(this.toastTemplate)||this.clearToastTemplate())},y.prototype.clearContentTemplate=function(){this.contentTemplate.style.display="none",document.body.appendChild(this.contentTemplate),this.contentTemplate=null},y.prototype.clearToastTemplate=function(){this.toastTemplate.style.display="none",document.body.appendChild(this.toastTemplate),this.toastTemplate=null},y.prototype.isBlazorServer=function(){return e.isBlazor()&&this.isServerRendered},y.prototype.destroyToast=function(t,i){for(var s,o=this,n=0;n<this.toastCollection.length;n++)this.toastCollection[n].element[0]===t&&(s=this.toastCollection[n],this.toastCollection.splice(n,1));var r={options:this,cancel:!1,type:i,element:t,toastContainer:this.toastContainer},l=this.animation.hide,a={duration:l.duration,name:l.effect,timingFunction:l.easing},p=parseInt(t.id.split("toast_")[1],10),h=this.isBlazorServer()?{options:s,toastContainer:this.toastContainer}:{options:s,toastContainer:this.toastContainer,toastObj:this};this.trigger("beforeClose",r,function(i){i.cancel||(e.isNullOrUndefined(o.progressObj[p])||e.isNullOrUndefined(t.querySelector("."+c))||(o.progressObj[p].progressEle.style.width="0%"),a.end=function(){o.clearProgress(p),o.isBlazorServer()&&!e.isNullOrUndefined(s)||e.detach(t),o.trigger("close",h),0===o.toastContainer.childElementCount&&o.clearContainerPos()},new e.Animation({}).animate(t,a))})},y.prototype.personalizeToast=function(){this.setIcon(),this.setTitle(),this.setContent(),this.actionButtons()},y.prototype.setAria=function(){e.attributes(this.toastEle,{role:"alert"})},y.prototype.setPositioning=function(t){this.isBlazorServer()||(isNaN(parseFloat(t.X))&&isNaN(parseFloat(t.Y))?this.toastContainer.classList.add(r+"-"+t.Y.toString().toLowerCase()+"-"+t.X.toString().toLowerCase()):(this.customPosition=!0,e.setStyleAttribute(this.toastContainer,{left:e.formatUnit(t.X),top:e.formatUnit(t.Y)})))},y.prototype.setCloseButton=function(){if(this.showCloseButton){this.l10n=new e.L10n("toast",{close:"Close"},this.locale),this.l10n.setLocale(this.locale);var t=this.l10n.getConstant("close"),i=this.createElement("div",{className:u+" e-icons ",attrs:{tabindex:"0","aria-label":t}});this.toastEle.appendChild(i)}},y.prototype.setProgress=function(){if(this.timeOut>0){var 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,this.extendedTimeout>0&&(e.EventHandler.add(this.toastEle,"mouseover",this.toastHoverAction.bind(this,t)),e.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)}},y.prototype.toastHoverAction=function(t){clearTimeout(this.progressObj[t].timeOutId),clearInterval(this.progressObj[t].intervalId),this.progressObj[t].hideEta=0;var i=this.progressObj[t].element;e.isNullOrUndefined(i.querySelector("."+c))||(this.progressObj[t].progressEle.style.width="0%")},y.prototype.delayedToastProgress=function(t){var i=this.progressObj[t],s=i.element;i.timeOutId=window.setTimeout(this.destroyToast.bind(this,s),this.extendedTimeout),i.maxHideTime=parseFloat(this.extendedTimeout+""),i.hideEta=(new Date).getTime()+i.maxHideTime,e.isNullOrUndefined(s.querySelector("."+c))||(i.intervalId=setInterval(this.updateProgressBar.bind(this,i),10))},y.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+"%"},y.prototype.setIcon=function(){if(!e.isNullOrUndefined(this.icon)&&0!==this.icon.length){var t=this.createElement("div",{className:"e-toast-icon e-icons "+this.icon});this.toastEle.appendChild(t)}},y.prototype.setTitle=function(){if(!e.isNullOrUndefined(this.title)){var t=this.createElement("div",{className:a});t=this.fetchEle(t,this.title,"title");var i=this.createElement("div",{className:d});i.appendChild(t),this.toastEle.appendChild(i)}},y.prototype.setContent=function(){var t=this.createElement("div",{className:h}),i=this.element;if(e.isNullOrUndefined(this.content)||""===this.content){var s=""!==this.element.innerHTML.replace(/\s/g,"");if((i.children.length>0||s)&&(!i.firstElementChild||!i.firstElementChild.classList.contains(r))){this.innerEle=document.createDocumentFragment();for(var o=this.createElement("div");0!==i.childNodes.length;)this.innerEle.appendChild(this.element.childNodes[0]);t.appendChild(this.innerEle),[].slice.call(t.children).forEach(function(t){o.appendChild(t.cloneNode(!0))}),this.content=o,this.appendMessageContainer(t)}}else"object"!=typeof this.content||e.isNullOrUndefined(this.content.tagName)?(t=this.fetchEle(t,this.content,"content"),this.appendMessageContainer(t)):(t.appendChild(this.content),this.content=this.content.cloneNode(!0),this.appendMessageContainer(t))},y.prototype.appendMessageContainer=function(t){if(this.toastEle.querySelectorAll("."+d).length>0)this.toastEle.querySelector("."+d).appendChild(t);else{var e=this.createElement("div",{className:d});e.appendChild(t),this.toastEle.appendChild(e)}},y.prototype.actionButtons=function(){var t=this,s=this.createElement("div",{className:"e-toast-actions"});[].slice.call(this.buttons).forEach(function(o){if(!e.isNullOrUndefined(o.model)){var n=t.createElement("button");n.setAttribute("type","button"),(e.isNullOrUndefined(o.model.cssClass)||0===o.model.cssClass.length)&&(o.model.cssClass="e-primary"),n.classList.add("e-small"),new i.Button(o.model,n),e.isNullOrUndefined(o.click)||"function"!=typeof o.click||e.EventHandler.add(n,"click",o.click),s.appendChild(n)}}),s.childElementCount>0&&this.appendMessageContainer(s)},y.prototype.appendToTarget=function(t){var i=this,o=this.isBlazorServer()?{options:t,element:this.toastEle,cancel:!1}:{options:t,toastObj:this,element:this.toastEle,cancel:!1};this.trigger("beforeOpen",o,function(o){if(o.cancel){if(i.isBlazorServer()){var n=parseInt(i.toastEle.id.split("toast_")[1],10);i.clearProgress(n),e.detach(i.toastEle),0===i.toastContainer.childElementCount&&i.clearContainerPos()}}else i.isBlazorServer()||(i.toastEle.style.display="none"),i.newestOnTop&&0!==i.toastContainer.childElementCount?i.toastContainer.insertBefore(i.toastEle,i.toastContainer.children[0]):i.isBlazorServer()||i.toastContainer.appendChild(i.toastEle),e.removeClass([i.toastEle],"e-blazor-toast-hidden"),e.EventHandler.add(i.toastEle,"click",i.clickHandler,i),e.EventHandler.add(i.toastEle,"keydown",i.keyDownHandler,i),i.toastContainer.style.zIndex=s.getZindexPartial(i.toastContainer)+"",i.displayToast(i.toastEle,t)})},y.prototype.clickHandler=function(t){var i=this;this.isBlazorServer()||t.stopPropagation();var s=t.target,o=e.closest(s,"."+r),n=this.isBlazorServer()?{element:o,cancel:!1,clickToClose:!1,originalEvent:t}:{element:o,cancel:!1,clickToClose:!1,originalEvent:t,toastObj:this},l=s.classList.contains(u);this.trigger("click",n,function(t){(l&&!t.cancel||t.clickToClose)&&i.destroyToast(o,"click")})},y.prototype.keyDownHandler=function(t){if(t.target.classList.contains(u)&&(13===t.keyCode||32===t.keyCode)){var i=t.target,s=e.closest(i,"."+r);this.destroyToast(s,"key")}},y.prototype.displayToast=function(t,i){var s=this,o=this.animation.show,n={duration:o.duration,name:o.effect,timingFunction:o.easing},r=this.isBlazorServer()?{options:i,element:this.toastEle}:{options:i,toastObj:this,element:this.toastEle};n.begin=function(){t.style.display=""},n.end=function(){s.trigger("open",r)},new e.Animation(n).animate(t)},y.prototype.getContainer=function(){return this.element.classList.add(l),this.element},y.prototype.onPropertyChanged=function(t,e){for(var i=this.element,s=0,o=Object.keys(t);s<o.length;s++){switch(o[s]){case"enableRtl":t.enableRtl?i.classList.add("e-rtl"):i.classList.remove("e-rtl")}}},n([e.Property("300px")],y.prototype,"width",void 0),n([e.Property("auto")],y.prototype,"height",void 0),n([e.Property(null)],y.prototype,"title",void 0),n([e.Property(null)],y.prototype,"content",void 0),n([e.Property(!0)],y.prototype,"enableHtmlSanitizer",void 0),n([e.Property(null)],y.prototype,"icon",void 0),n([e.Property(null)],y.prototype,"cssClass",void 0),n([e.Property(null)],y.prototype,"template",void 0),n([e.Property(!0)],y.prototype,"newestOnTop",void 0),n([e.Property(!1)],y.prototype,"showCloseButton",void 0),n([e.Property(!1)],y.prototype,"showProgressBar",void 0),n([e.Property(5e3)],y.prototype,"timeOut",void 0),n([e.Property("Rtl")],y.prototype,"progressDirection",void 0),n([e.Property(1e3)],y.prototype,"extendedTimeout",void 0),n([e.Complex({},v)],y.prototype,"animation",void 0),n([e.Complex({},f)],y.prototype,"position",void 0),n([e.Collection([{}],m)],y.prototype,"buttons",void 0),n([e.Property(null)],y.prototype,"target",void 0),n([e.Event()],y.prototype,"created",void 0),n([e.Event()],y.prototype,"beforeSanitizeHtml",void 0),n([e.Event()],y.prototype,"destroyed",void 0),n([e.Event()],y.prototype,"open",void 0),n([e.Event()],y.prototype,"beforeOpen",void 0),n([e.Event()],y.prototype,"beforeClose",void 0),n([e.Event()],y.prototype,"close",void 0),n([e.Event()],y.prototype,"click",void 0),y=n([e.NotifyPropertyChanges],y)}(e.Component);t.ToastPosition=f,t.ButtonModelProps=m,t.ToastAnimations=y,t.ToastAnimationSettings=v,t.Toast=g,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ej2-notifications.umd.min.js.map |
@@ -72,3 +72,3 @@ import { Animation, Browser, ChildProperty, Collection, Complex, Component, Event, EventHandler, L10n, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, attributes, classList, closest, compile, detach, extend, formatUnit, getUniqueID, isBlazor, isNullOrUndefined, isUndefined, removeClass, setStyleAttribute } from '@syncfusion/ej2-base'; | ||
* The Toast is a notification pop-up that showing on desired position which can provide an information to the user. | ||
* * ```html | ||
* ```html | ||
* <div id="toast"/> | ||
@@ -84,4 +84,5 @@ * <script> | ||
* Initializes a new instance of the Toast class. | ||
* @param options - Specifies Toast model properties as options. | ||
* @param element - Specifies the element that is rendered as a Toast. | ||
* | ||
* @param {ToastModel} options - Specifies Toast model properties as options. | ||
* @param {HTMLElement} element - Specifies the element that is rendered as a Toast. | ||
*/ | ||
@@ -94,2 +95,4 @@ constructor(options, element) { | ||
* Gets the Component module name. | ||
* | ||
* @returns {string} - returns the string | ||
* @private | ||
@@ -102,2 +105,4 @@ */ | ||
* Gets the persisted state properties of the Component. | ||
* | ||
* @returns {string} - returns the string | ||
*/ | ||
@@ -109,2 +114,4 @@ getPersistData() { | ||
* Removes the component from the DOM and detaches all its related event handlers, attributes and classes. | ||
* | ||
* @returns {void} | ||
*/ | ||
@@ -126,2 +133,4 @@ destroy() { | ||
* Initialize the event handler | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -144,2 +153,4 @@ */ | ||
* Initialize the component rendering | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -160,4 +171,5 @@ */ | ||
* To show Toast element on a document with the relative position. | ||
* @param {ToastModel} toastObj? - To show Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {ToastModel} toastObj - To show Toast element on screen. | ||
* @returns {void} | ||
* @deprecated | ||
@@ -174,3 +186,3 @@ */ | ||
this.toastContainer = this.getContainer(); | ||
let target = typeof (this.target) === 'string' ? document.querySelector(this.target) : document.body; | ||
const target = typeof (this.target) === 'string' ? document.querySelector(this.target) : document.body; | ||
if (isNullOrUndefined(target)) { | ||
@@ -196,2 +208,3 @@ return; | ||
this.setCSSClass(this.cssClass); | ||
// eslint-disable-next-line | ||
(isNullOrUndefined(this.template) || this.template === '') ? this.personalizeToast() : this.templateRendering(); | ||
@@ -206,3 +219,3 @@ this.setProgress(); | ||
} | ||
// tslint:disable-next-line:no-any | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (this.isReact) { | ||
@@ -213,5 +226,8 @@ this.renderReactTemplates(); | ||
/** | ||
* @hidden | ||
* @deprecated | ||
* This method applicable for blazor alone. | ||
* @param {string} id - specifies the id | ||
* @param {ToastModel} toastObj - specifies the model | ||
* @returns {void} | ||
* @hidden | ||
* @deprecated | ||
* This method applicable for blazor alone. | ||
*/ | ||
@@ -225,3 +241,4 @@ showToast(id, toastObj) { | ||
this.setPositioning(this.position); | ||
let proxy = this; | ||
// eslint-disable-next-line | ||
const proxy = this; | ||
if (!isNullOrUndefined(proxy.element.lastElementChild)) { | ||
@@ -234,12 +251,12 @@ this.setProgress(); | ||
swipeHandler(e) { | ||
let toastEle = closest(e.originalEvent.target, '.' + ROOT + ':not(.' + CONTAINER + ')'); | ||
let hideAnimation = this.animation.hide.effect; | ||
const toastEle = closest(e.originalEvent.target, '.' + ROOT + ':not(.' + CONTAINER + ')'); | ||
const hideAnimation = this.animation.hide.effect; | ||
if (!isNullOrUndefined(toastEle)) { | ||
if (e.swipeDirection === 'Right') { | ||
this.animation.hide.effect = 'SlideRightOut'; | ||
this.hide(toastEle); | ||
this.hideToast('swipe', toastEle); | ||
} | ||
else if (e.swipeDirection === 'Left') { | ||
this.animation.hide.effect = 'SlideLeftOut'; | ||
this.hide(toastEle); | ||
this.hideToast('swipe', toastEle); | ||
} | ||
@@ -259,3 +276,3 @@ this.animation.hide.effect = hideAnimation; | ||
if (cssClass) { | ||
let split = cssClass.indexOf(',') !== -1 ? ',' : ' '; | ||
const split = cssClass.indexOf(',') !== -1 ? ',' : ' '; | ||
classList(this.toastEle, cssClass.split(split), []); | ||
@@ -281,2 +298,4 @@ } | ||
/** | ||
* @param {string} value - specifies the string value. | ||
* @returns {string} - returns the string | ||
* @hidden | ||
@@ -286,4 +305,4 @@ */ | ||
if (this.enableHtmlSanitizer) { | ||
let item = SanitizeHtmlHelper.beforeSanitize(); | ||
let beforeEvent = { | ||
const item = SanitizeHtmlHelper.beforeSanitize(); | ||
const beforeEvent = { | ||
cancel: false, | ||
@@ -306,6 +325,10 @@ helper: null | ||
* To Hide all toast element when passing 'All'. | ||
* @param {HTMLElement| Element| string} element? - To Hide Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {HTMLElement} element - To Hide Toast element on screen. | ||
* @returns {void} | ||
*/ | ||
hide(element) { | ||
this.hideToast('', element); | ||
} | ||
hideToast(interactionType, element) { | ||
if (isNullOrUndefined(this.toastContainer) || this.toastContainer.childElementCount === 0) { | ||
@@ -316,3 +339,3 @@ return; | ||
for (let i = 0; i < this.toastContainer.childElementCount; i++) { | ||
this.destroyToast(this.toastContainer.children[i]); | ||
this.destroyToast(this.toastContainer.children[i], interactionType); | ||
} | ||
@@ -324,10 +347,7 @@ return; | ||
} | ||
this.destroyToast(element); | ||
// tslint:disable-next-line:no-any | ||
if (this.isReact) { | ||
this.clearTemplate(); | ||
} | ||
this.destroyToast(element, interactionType); | ||
} | ||
fetchEle(ele, value, prob) { | ||
value = typeof (value) === 'string' ? this.sanitizeHelper(value) : value; | ||
// eslint-disable-next-line | ||
let templateFn; | ||
@@ -346,2 +366,3 @@ let tempVar; | ||
} | ||
// eslint-disable-next-line | ||
prob === 'content' ? tempVar = this.contentTemplate : tempVar = this.toastTemplate; | ||
@@ -360,3 +381,4 @@ if (!isNullOrUndefined(tempVar)) { | ||
} | ||
let clo = isNullOrUndefined(elem) ? tempVar : elem.cloneNode(true); | ||
const clo = isNullOrUndefined(elem) ? tempVar : elem.cloneNode(true); | ||
// eslint-disable-next-line | ||
prob === 'content' ? this.contentTemplate = clo : this.toastTemplate = clo; | ||
@@ -367,2 +389,3 @@ } | ||
templateFn = compile(value); | ||
// eslint-disable-next-line | ||
@@ -375,3 +398,3 @@ } | ||
else { | ||
let isString = true; | ||
const isString = true; | ||
tmpArray = templateFn({}, this, prob, templateProps, isString); | ||
@@ -447,3 +470,3 @@ } | ||
} | ||
destroyToast(toastEle) { | ||
destroyToast(toastEle, interactionType) { | ||
let toastObj; | ||
@@ -456,8 +479,15 @@ for (let i = 0; i < this.toastCollection.length; i++) { | ||
} | ||
let hideAnimate = this.animation.hide; | ||
let animate = { | ||
let toastBeforeClose = { | ||
options: this, | ||
cancel: false, | ||
type: interactionType, | ||
element: toastEle, | ||
toastContainer: this.toastContainer | ||
}; | ||
const hideAnimate = this.animation.hide; | ||
const animate = { | ||
duration: hideAnimate.duration, name: hideAnimate.effect, timingFunction: hideAnimate.easing | ||
}; | ||
let intervalId = parseInt(toastEle.id.split('toast_')[1], 10); | ||
let toastClose = this.isBlazorServer() ? { | ||
const intervalId = parseInt(toastEle.id.split('toast_')[1], 10); | ||
const toastClose = this.isBlazorServer() ? { | ||
options: toastObj, | ||
@@ -470,16 +500,20 @@ toastContainer: this.toastContainer | ||
}; | ||
if (!isNullOrUndefined(this.progressObj[intervalId]) && !isNullOrUndefined(toastEle.querySelector('.' + PROGRESS))) { | ||
this.progressObj[intervalId].progressEle.style.width = '0%'; | ||
} | ||
animate.end = () => { | ||
this.clearProgress(intervalId); | ||
if (!this.isBlazorServer() || isNullOrUndefined(toastObj)) { | ||
detach(toastEle); | ||
this.trigger('beforeClose', toastBeforeClose, (toastBeforeCloseArgs) => { | ||
if (!toastBeforeCloseArgs.cancel) { | ||
if (!isNullOrUndefined(this.progressObj[intervalId]) && !isNullOrUndefined(toastEle.querySelector('.' + PROGRESS))) { | ||
this.progressObj[intervalId].progressEle.style.width = '0%'; | ||
} | ||
animate.end = () => { | ||
this.clearProgress(intervalId); | ||
if (!this.isBlazorServer() || isNullOrUndefined(toastObj)) { | ||
detach(toastEle); | ||
} | ||
this.trigger('close', toastClose); | ||
if (this.toastContainer.childElementCount === 0) { | ||
this.clearContainerPos(); | ||
} | ||
}; | ||
new Animation({}).animate(toastEle, animate); | ||
} | ||
this.trigger('close', toastClose); | ||
if (this.toastContainer.childElementCount === 0) { | ||
this.clearContainerPos(); | ||
} | ||
}; | ||
new Animation({}).animate(toastEle, animate); | ||
}); | ||
} | ||
@@ -511,7 +545,8 @@ personalizeToast() { | ||
} | ||
// eslint-disable-next-line | ||
let localeText = { close: 'Close' }; | ||
this.l10n = new L10n('toast', localeText, this.locale); | ||
this.l10n.setLocale(this.locale); | ||
let closeIconTitle = this.l10n.getConstant('close'); | ||
let closeBtn = this.createElement('div', { className: CLOSEBTN + ' e-icons ', attrs: { tabindex: '0', 'aria-label': closeIconTitle } }); | ||
const closeIconTitle = this.l10n.getConstant('close'); | ||
const closeBtn = this.createElement('div', { className: CLOSEBTN + ' e-icons ', attrs: { tabindex: '0', 'aria-label': closeIconTitle } }); | ||
this.toastEle.appendChild(closeBtn); | ||
@@ -521,5 +556,6 @@ } | ||
if (this.timeOut > 0) { | ||
let id = parseInt(this.toastEle.id.split('toast_')[1], 10); | ||
const id = parseInt(this.toastEle.id.split('toast_')[1], 10); | ||
this.intervalId[id] = window.setTimeout(this.destroyToast.bind(this, this.toastEle), this.timeOut); | ||
this.progressObj[id] = { hideEta: null, intervalId: null, maxHideTime: null, element: null, timeOutId: null, progressEle: null }; | ||
this.progressObj[id] = { hideEta: null, intervalId: null, maxHideTime: null, | ||
element: null, timeOutId: null, progressEle: null }; | ||
this.progressObj[id].maxHideTime = parseFloat(this.timeOut + ''); | ||
@@ -545,3 +581,3 @@ this.progressObj[id].hideEta = new Date().getTime() + this.progressObj[id].maxHideTime; | ||
this.progressObj[id].hideEta = 0; | ||
let toastEle = this.progressObj[id].element; | ||
const toastEle = this.progressObj[id].element; | ||
if (!isNullOrUndefined(toastEle.querySelector('.' + PROGRESS))) { | ||
@@ -552,4 +588,4 @@ this.progressObj[id].progressEle.style.width = '0%'; | ||
delayedToastProgress(id) { | ||
let progress = this.progressObj[id]; | ||
let toastEle = progress.element; | ||
const progress = this.progressObj[id]; | ||
const toastEle = progress.element; | ||
progress.timeOutId = window.setTimeout(this.destroyToast.bind(this, toastEle), this.extendedTimeout); | ||
@@ -571,3 +607,3 @@ progress.maxHideTime = parseFloat(this.extendedTimeout + ''); | ||
} | ||
let iconEle = this.createElement('div', { className: ICON + ' e-icons ' + this.icon }); | ||
const iconEle = this.createElement('div', { className: ICON + ' e-icons ' + this.icon }); | ||
this.toastEle.appendChild(iconEle); | ||
@@ -581,3 +617,3 @@ } | ||
titleEle = this.fetchEle(titleEle, this.title, 'title'); | ||
let msgContainer = this.createElement('div', { className: MESSAGE }); | ||
const msgContainer = this.createElement('div', { className: MESSAGE }); | ||
msgContainer.appendChild(titleEle); | ||
@@ -588,8 +624,8 @@ this.toastEle.appendChild(msgContainer); | ||
let contentEle = this.createElement('div', { className: CONTENT }); | ||
let ele = this.element; | ||
const ele = this.element; | ||
if (isNullOrUndefined(this.content) || this.content === '') { | ||
let isContent = this.element.innerHTML.replace(/\s/g, '') !== ''; | ||
const isContent = this.element.innerHTML.replace(/\s/g, '') !== ''; | ||
if ((ele.children.length > 0 || isContent) && !(ele.firstElementChild && ele.firstElementChild.classList.contains(ROOT))) { | ||
this.innerEle = document.createDocumentFragment(); | ||
let tempEle = this.createElement('div'); | ||
const tempEle = this.createElement('div'); | ||
while (ele.childNodes.length !== 0) { | ||
@@ -623,3 +659,3 @@ this.innerEle.appendChild(this.element.childNodes[0]); | ||
else { | ||
let msgContainer = this.createElement('div', { className: MESSAGE }); | ||
const msgContainer = this.createElement('div', { className: MESSAGE }); | ||
msgContainer.appendChild(element); | ||
@@ -630,3 +666,3 @@ this.toastEle.appendChild(msgContainer); | ||
actionButtons() { | ||
let actionBtnContainer = this.createElement('div', { className: ACTIOBUTTONS }); | ||
const actionBtnContainer = this.createElement('div', { className: ACTIOBUTTONS }); | ||
[].slice.call(this.buttons).forEach((actionBtn) => { | ||
@@ -636,3 +672,3 @@ if (isNullOrUndefined(actionBtn.model)) { | ||
} | ||
let btnDom = this.createElement('button'); | ||
const btnDom = this.createElement('button'); | ||
btnDom.setAttribute('type', 'button'); | ||
@@ -654,3 +690,3 @@ if (isNullOrUndefined(actionBtn.model.cssClass) || actionBtn.model.cssClass.length === 0) { | ||
appendToTarget(toastObj) { | ||
let toastBeforeOpen = this.isBlazorServer() ? { | ||
const toastBeforeOpen = this.isBlazorServer() ? { | ||
options: toastObj, | ||
@@ -683,3 +719,3 @@ element: this.toastEle, | ||
else if (this.isBlazorServer()) { | ||
let intervalId = parseInt(this.toastEle.id.split('toast_')[1], 10); | ||
const intervalId = parseInt(this.toastEle.id.split('toast_')[1], 10); | ||
this.clearProgress(intervalId); | ||
@@ -697,5 +733,5 @@ detach(this.toastEle); | ||
} | ||
let target = e.target; | ||
let toastEle = closest(target, '.' + ROOT); | ||
let clickArgs = this.isBlazorServer() ? { | ||
const target = e.target; | ||
const toastEle = closest(target, '.' + ROOT); | ||
const clickArgs = this.isBlazorServer() ? { | ||
element: toastEle, cancel: false, clickToClose: false, originalEvent: e | ||
@@ -705,6 +741,6 @@ } : { | ||
}; | ||
let isCloseIcon = target.classList.contains(CLOSEBTN); | ||
const isCloseIcon = target.classList.contains(CLOSEBTN); | ||
this.trigger('click', clickArgs, (toastClickArgs) => { | ||
if ((isCloseIcon && !toastClickArgs.cancel) || toastClickArgs.clickToClose) { | ||
this.destroyToast(toastEle); | ||
this.destroyToast(toastEle, 'click'); | ||
} | ||
@@ -716,13 +752,13 @@ }); | ||
(e.keyCode === 13 || e.keyCode === 32)) { | ||
let target = e.target; | ||
let toastEle = closest(target, '.' + ROOT); | ||
this.destroyToast(toastEle); | ||
const target = e.target; | ||
const toastEle = closest(target, '.' + ROOT); | ||
this.destroyToast(toastEle, 'key'); | ||
} | ||
} | ||
displayToast(toastEle, toastObj) { | ||
let showAnimate = this.animation.show; | ||
let animate = { | ||
const showAnimate = this.animation.show; | ||
const animate = { | ||
duration: showAnimate.duration, name: showAnimate.effect, timingFunction: showAnimate.easing | ||
}; | ||
let toastOpen = this.isBlazorServer() ? { | ||
const toastOpen = this.isBlazorServer() ? { | ||
options: toastObj, | ||
@@ -749,9 +785,15 @@ element: this.toastEle | ||
* Called internally if any of the property value changed. | ||
* | ||
* @param {ToastModel} newProp - specifies the new property | ||
* @param {ToastModel} oldProp - specifies the old property | ||
* @returns {void} | ||
* @private | ||
*/ | ||
// eslint-disable-next-line | ||
onPropertyChanged(newProp, oldProp) { | ||
let container = this.element; | ||
for (let prop of Object.keys(newProp)) { | ||
const container = this.element; | ||
for (const prop of Object.keys(newProp)) { | ||
switch (prop) { | ||
case 'enableRtl': | ||
// eslint-disable-next-line | ||
newProp.enableRtl ? container.classList.add(RTL) : container.classList.remove(RTL); | ||
@@ -834,2 +876,5 @@ break; | ||
Event() | ||
], Toast.prototype, "beforeClose", void 0); | ||
__decorate([ | ||
Event() | ||
], Toast.prototype, "close", void 0); | ||
@@ -836,0 +881,0 @@ __decorate([ |
@@ -105,3 +105,3 @@ import { Animation, Browser, ChildProperty, Collection, Complex, Component, Event, EventHandler, L10n, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, attributes, classList, closest, compile, detach, extend, formatUnit, getUniqueID, isBlazor, isNullOrUndefined, isUndefined, removeClass, setStyleAttribute } from '@syncfusion/ej2-base'; | ||
* The Toast is a notification pop-up that showing on desired position which can provide an information to the user. | ||
* * ```html | ||
* ```html | ||
* <div id="toast"/> | ||
@@ -118,4 +118,5 @@ * <script> | ||
* Initializes a new instance of the Toast class. | ||
* @param options - Specifies Toast model properties as options. | ||
* @param element - Specifies the element that is rendered as a Toast. | ||
* | ||
* @param {ToastModel} options - Specifies Toast model properties as options. | ||
* @param {HTMLElement} element - Specifies the element that is rendered as a Toast. | ||
*/ | ||
@@ -129,2 +130,4 @@ function Toast(options, element) { | ||
* Gets the Component module name. | ||
* | ||
* @returns {string} - returns the string | ||
* @private | ||
@@ -137,2 +140,4 @@ */ | ||
* Gets the persisted state properties of the Component. | ||
* | ||
* @returns {string} - returns the string | ||
*/ | ||
@@ -144,2 +149,4 @@ Toast.prototype.getPersistData = function () { | ||
* Removes the component from the DOM and detaches all its related event handlers, attributes and classes. | ||
* | ||
* @returns {void} | ||
*/ | ||
@@ -161,2 +168,4 @@ Toast.prototype.destroy = function () { | ||
* Initialize the event handler | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -179,2 +188,4 @@ */ | ||
* Initialize the component rendering | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -195,4 +206,5 @@ */ | ||
* To show Toast element on a document with the relative position. | ||
* @param {ToastModel} toastObj? - To show Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {ToastModel} toastObj - To show Toast element on screen. | ||
* @returns {void} | ||
* @deprecated | ||
@@ -230,2 +242,3 @@ */ | ||
this.setCSSClass(this.cssClass); | ||
// eslint-disable-next-line | ||
(isNullOrUndefined(this.template) || this.template === '') ? this.personalizeToast() : this.templateRendering(); | ||
@@ -240,3 +253,3 @@ this.setProgress(); | ||
} | ||
// tslint:disable-next-line:no-any | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (this.isReact) { | ||
@@ -247,5 +260,8 @@ this.renderReactTemplates(); | ||
/** | ||
* @hidden | ||
* @deprecated | ||
* This method applicable for blazor alone. | ||
* @param {string} id - specifies the id | ||
* @param {ToastModel} toastObj - specifies the model | ||
* @returns {void} | ||
* @hidden | ||
* @deprecated | ||
* This method applicable for blazor alone. | ||
*/ | ||
@@ -259,2 +275,3 @@ Toast.prototype.showToast = function (id, toastObj) { | ||
this.setPositioning(this.position); | ||
// eslint-disable-next-line | ||
var proxy = this; | ||
@@ -273,7 +290,7 @@ if (!isNullOrUndefined(proxy.element.lastElementChild)) { | ||
this.animation.hide.effect = 'SlideRightOut'; | ||
this.hide(toastEle); | ||
this.hideToast('swipe', toastEle); | ||
} | ||
else if (e.swipeDirection === 'Left') { | ||
this.animation.hide.effect = 'SlideLeftOut'; | ||
this.hide(toastEle); | ||
this.hideToast('swipe', toastEle); | ||
} | ||
@@ -314,2 +331,4 @@ this.animation.hide.effect = hideAnimation; | ||
/** | ||
* @param {string} value - specifies the string value. | ||
* @returns {string} - returns the string | ||
* @hidden | ||
@@ -338,6 +357,10 @@ */ | ||
* To Hide all toast element when passing 'All'. | ||
* @param {HTMLElement| Element| string} element? - To Hide Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {HTMLElement} element - To Hide Toast element on screen. | ||
* @returns {void} | ||
*/ | ||
Toast.prototype.hide = function (element) { | ||
this.hideToast('', element); | ||
}; | ||
Toast.prototype.hideToast = function (interactionType, element) { | ||
if (isNullOrUndefined(this.toastContainer) || this.toastContainer.childElementCount === 0) { | ||
@@ -348,3 +371,3 @@ return; | ||
for (var i = 0; i < this.toastContainer.childElementCount; i++) { | ||
this.destroyToast(this.toastContainer.children[i]); | ||
this.destroyToast(this.toastContainer.children[i], interactionType); | ||
} | ||
@@ -356,10 +379,7 @@ return; | ||
} | ||
this.destroyToast(element); | ||
// tslint:disable-next-line:no-any | ||
if (this.isReact) { | ||
this.clearTemplate(); | ||
} | ||
this.destroyToast(element, interactionType); | ||
}; | ||
Toast.prototype.fetchEle = function (ele, value, prob) { | ||
value = typeof (value) === 'string' ? this.sanitizeHelper(value) : value; | ||
// eslint-disable-next-line | ||
var templateFn; | ||
@@ -378,2 +398,3 @@ var tempVar; | ||
} | ||
// eslint-disable-next-line | ||
prob === 'content' ? tempVar = this.contentTemplate : tempVar = this.toastTemplate; | ||
@@ -393,2 +414,3 @@ if (!isNullOrUndefined(tempVar)) { | ||
var clo = isNullOrUndefined(elem) ? tempVar : elem.cloneNode(true); | ||
// eslint-disable-next-line | ||
prob === 'content' ? this.contentTemplate = clo : this.toastTemplate = clo; | ||
@@ -399,2 +421,3 @@ } | ||
templateFn = compile(value); | ||
// eslint-disable-next-line | ||
@@ -479,3 +502,3 @@ } | ||
}; | ||
Toast.prototype.destroyToast = function (toastEle) { | ||
Toast.prototype.destroyToast = function (toastEle, interactionType) { | ||
var _this = this; | ||
@@ -489,2 +512,9 @@ var toastObj; | ||
} | ||
var toastBeforeClose = { | ||
options: this, | ||
cancel: false, | ||
type: interactionType, | ||
element: toastEle, | ||
toastContainer: this.toastContainer | ||
}; | ||
var hideAnimate = this.animation.hide; | ||
@@ -503,16 +533,20 @@ var animate = { | ||
}; | ||
if (!isNullOrUndefined(this.progressObj[intervalId]) && !isNullOrUndefined(toastEle.querySelector('.' + PROGRESS))) { | ||
this.progressObj[intervalId].progressEle.style.width = '0%'; | ||
} | ||
animate.end = function () { | ||
_this.clearProgress(intervalId); | ||
if (!_this.isBlazorServer() || isNullOrUndefined(toastObj)) { | ||
detach(toastEle); | ||
this.trigger('beforeClose', toastBeforeClose, function (toastBeforeCloseArgs) { | ||
if (!toastBeforeCloseArgs.cancel) { | ||
if (!isNullOrUndefined(_this.progressObj[intervalId]) && !isNullOrUndefined(toastEle.querySelector('.' + PROGRESS))) { | ||
_this.progressObj[intervalId].progressEle.style.width = '0%'; | ||
} | ||
animate.end = function () { | ||
_this.clearProgress(intervalId); | ||
if (!_this.isBlazorServer() || isNullOrUndefined(toastObj)) { | ||
detach(toastEle); | ||
} | ||
_this.trigger('close', toastClose); | ||
if (_this.toastContainer.childElementCount === 0) { | ||
_this.clearContainerPos(); | ||
} | ||
}; | ||
new Animation({}).animate(toastEle, animate); | ||
} | ||
_this.trigger('close', toastClose); | ||
if (_this.toastContainer.childElementCount === 0) { | ||
_this.clearContainerPos(); | ||
} | ||
}; | ||
new Animation({}).animate(toastEle, animate); | ||
}); | ||
}; | ||
@@ -544,2 +578,3 @@ Toast.prototype.personalizeToast = function () { | ||
} | ||
// eslint-disable-next-line | ||
var localeText = { close: 'Close' }; | ||
@@ -556,3 +591,4 @@ this.l10n = new L10n('toast', localeText, this.locale); | ||
this.intervalId[id] = window.setTimeout(this.destroyToast.bind(this, this.toastEle), this.timeOut); | ||
this.progressObj[id] = { hideEta: null, intervalId: null, maxHideTime: null, element: null, timeOutId: null, progressEle: null }; | ||
this.progressObj[id] = { hideEta: null, intervalId: null, maxHideTime: null, | ||
element: null, timeOutId: null, progressEle: null }; | ||
this.progressObj[id].maxHideTime = parseFloat(this.timeOut + ''); | ||
@@ -733,3 +769,3 @@ this.progressObj[id].hideEta = new Date().getTime() + this.progressObj[id].maxHideTime; | ||
if ((isCloseIcon && !toastClickArgs.cancel) || toastClickArgs.clickToClose) { | ||
_this.destroyToast(toastEle); | ||
_this.destroyToast(toastEle, 'click'); | ||
} | ||
@@ -743,3 +779,3 @@ }); | ||
var toastEle = closest(target, '.' + ROOT); | ||
this.destroyToast(toastEle); | ||
this.destroyToast(toastEle, 'key'); | ||
} | ||
@@ -775,4 +811,9 @@ }; | ||
* Called internally if any of the property value changed. | ||
* | ||
* @param {ToastModel} newProp - specifies the new property | ||
* @param {ToastModel} oldProp - specifies the old property | ||
* @returns {void} | ||
* @private | ||
*/ | ||
// eslint-disable-next-line | ||
Toast.prototype.onPropertyChanged = function (newProp, oldProp) { | ||
@@ -784,2 +825,3 @@ var container = this.element; | ||
case 'enableRtl': | ||
// eslint-disable-next-line | ||
newProp.enableRtl ? container.classList.add(RTL) : container.classList.remove(RTL); | ||
@@ -861,2 +903,5 @@ break; | ||
Event() | ||
], Toast.prototype, "beforeClose", void 0); | ||
__decorate([ | ||
Event() | ||
], Toast.prototype, "close", void 0); | ||
@@ -863,0 +908,0 @@ __decorate([ |
/*! | ||
* filename: ej2-notifications.min.js | ||
* version : 18.4.39 | ||
* version : 19.1.54 | ||
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved. | ||
@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license. | ||
*/ | ||
this.ej=this.ej||{},this.ej.notifications=function(t,e,i,s){"use strict";var o=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),n=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r},r="e-toast",l="e-toast-message",a="e-toast-progress",h="e-toast-close-icon",p=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("Left")],i.prototype,"X",void 0),n([e.Property("Top")],i.prototype,"Y",void 0),i}(e.ChildProperty),d=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property(null)],i.prototype,"model",void 0),n([e.Property(null)],i.prototype,"click",void 0),i}(e.ChildProperty),c=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("FadeIn")],i.prototype,"effect",void 0),n([e.Property(600)],i.prototype,"duration",void 0),n([e.Property("ease")],i.prototype,"easing",void 0),i}(e.ChildProperty),u=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Complex({effect:"FadeIn",duration:600,easing:"ease"},c)],i.prototype,"show",void 0),n([e.Complex({effect:"FadeOut",duration:600,easing:"ease"},c)],i.prototype,"hide",void 0),i}(e.ChildProperty),f=function(t){function c(e,i){var s=t.call(this,e,i)||this;return s.toastCollection=[],s}return o(c,t),c.prototype.getModuleName=function(){return"toast"},c.prototype.getPersistData=function(){return this.addOnPersist([])},c.prototype.destroy=function(){this.hide("All"),this.element.classList.remove("e-toast-container"),e.setStyleAttribute(this.element,{position:"","z-index":""}),e.isNullOrUndefined(this.refElement)||e.isNullOrUndefined(this.refElement.parentElement)||(this.refElement.parentElement.insertBefore(this.element,this.refElement),e.detach(this.refElement),this.refElement=void 0),this.isBlazorServer()||t.prototype.destroy.call(this)},c.prototype.preRender=function(){this.isDevice=e.Browser.isDevice,"300px"===this.width&&(this.width=this.isDevice&&screen.width<768?"100%":"300px"),e.isNullOrUndefined(this.target)&&(this.target=document.body),this.enableRtl&&!this.isBlazorServer()&&this.element.classList.add("e-rtl")},c.prototype.render=function(){this.progressObj=[],this.intervalId=[],this.contentTemplate=null,this.toastTemplate=null,this.isDevice&&screen.width<768&&new e.Touch(this.element,{swipe:this.swipeHandler.bind(this)}),this.renderComplete(),this.initRenderClass=this.element.className},c.prototype.show=function(t){var i;if(e.isNullOrUndefined(t)||(this.templateChanges(t),i=JSON.parse(JSON.stringify(t)),e.extend(this,this,t)),e.isNullOrUndefined(this.toastContainer)){this.toastContainer=this.getContainer();var s="string"==typeof this.target?document.querySelector(this.target):document.body;if(e.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)}if(this.isBlazorServer()&&this.element.classList.contains("e-control"))return void this.isToastModel(t);this.toastEle=this.createElement("div",{className:r,id:e.getUniqueID("toast")}),this.setWidthHeight(),this.setCSSClass(this.cssClass),e.isNullOrUndefined(this.template)||""===this.template?this.personalizeToast():this.templateRendering(),this.setProgress(),this.setCloseButton(),this.setAria(),this.appendToTarget(t),e.isNullOrUndefined(i)||(e.extend(i,{element:[this.toastEle]},!0),this.toastCollection.push(i)),this.isReact&&this.renderReactTemplates()},c.prototype.showToast=function(t,e){this.toastEle=this.element.querySelector("#"+t),this.show(e)},c.prototype.isToastModel=function(t){this.toastContainer=this.element,this.setPositioning(this.position);var i=this;e.isNullOrUndefined(i.element.lastElementChild)||this.setProgress(),this.setAria(),this.appendToTarget(t)},c.prototype.swipeHandler=function(t){var i=e.closest(t.originalEvent.target,".e-toast:not(.e-toast-container)"),s=this.animation.hide.effect;e.isNullOrUndefined(i)||("Right"===t.swipeDirection?(this.animation.hide.effect="SlideRightOut",this.hide(i)):"Left"===t.swipeDirection&&(this.animation.hide.effect="SlideLeftOut",this.hide(i)),this.animation.hide.effect=s)},c.prototype.templateChanges=function(t){e.isUndefined(t.content)||e.isNullOrUndefined(this.contentTemplate)||this.content===t.content||this.clearContentTemplate(),e.isUndefined(t.template)||e.isNullOrUndefined(this.toastTemplate)||this.template===t.template||this.clearToastTemplate()},c.prototype.setCSSClass=function(t){if(t){var i=-1!==t.indexOf(",")?",":" ";e.classList(this.toastEle,t.split(i),[])}},c.prototype.setWidthHeight=function(){"300px"===this.width?this.toastEle.style.width=e.formatUnit(this.width):"100%"===this.width?this.toastContainer.classList.add("e-toast-full-width"):(this.toastEle.style.width=e.formatUnit(this.width),this.toastContainer.classList.remove("e-toast-full-width")),this.toastEle.style.height=e.formatUnit(this.height)},c.prototype.templateRendering=function(){this.fetchEle(this.toastEle,this.template,"template")},c.prototype.sanitizeHelper=function(t){if(this.enableHtmlSanitizer){var i=e.SanitizeHtmlHelper.beforeSanitize(),s={cancel:!1,helper:null};e.extend(i,i,s),this.trigger("beforeSanitizeHtml",i),i.cancel&&!e.isNullOrUndefined(i.helper)?t=i.helper(t):i.cancel||(t=e.SanitizeHtmlHelper.serializeValue(i,t))}return t},c.prototype.hide=function(t){if(!e.isNullOrUndefined(this.toastContainer)&&0!==this.toastContainer.childElementCount)if("string"!=typeof t||"All"!==t)e.isNullOrUndefined(t)&&(t=this.newestOnTop?this.toastContainer.lastElementChild:this.toastContainer.firstElementChild),this.destroyToast(t),this.isReact&&this.clearTemplate();else for(var i=0;i<this.toastContainer.childElementCount;i++)this.destroyToast(this.toastContainer.children[i])},c.prototype.fetchEle=function(t,i,s){i="string"==typeof i?this.sanitizeHelper(i):i;var o,n,r,l;if(l=t.classList.contains("e-toast-title")?this.element.id+"title":t.classList.contains("e-toast-content")?this.element.id+"content":this.element.id+"template",n="content"===s?this.contentTemplate:this.toastTemplate,!e.isNullOrUndefined(n))return t.appendChild(n.cloneNode(!0)),t;try{if(document.querySelectorAll(i).length>0){var a=null;"title"!==s&&(a=document.querySelector(i),t.appendChild(a),a.style.display="");var h=e.isNullOrUndefined(a)?n:a.cloneNode(!0);"content"===s?this.contentTemplate=h:this.toastTemplate=h}}catch(t){o=e.compile(i)}if(!e.isNullOrUndefined(o))if(this.isBlazorServer()){r=o({},this,s,l,!0)}else r=o({},this,s,null,!0);return e.isNullOrUndefined(r)||!(r.length>0)||e.isNullOrUndefined(r[0].tagName)&&1===r.length?0===t.childElementCount&&(t.innerHTML=i):[].slice.call(r).forEach(function(i){e.isNullOrUndefined(i.tagName)||(i.style.display=""),t.appendChild(i)}),t},c.prototype.clearProgress=function(t){e.isNullOrUndefined(this.intervalId[t])||(clearInterval(this.intervalId[t]),delete this.intervalId[t]),e.isNullOrUndefined(this.progressObj[t])||(clearInterval(this.progressObj[t].intervalId),delete this.progressObj[t])},c.prototype.clearContainerPos=function(){var t=this;if(this.isBlazorServer())return void(this.toastContainer=null);this.customPosition?(e.setStyleAttribute(this.toastContainer,{left:"",top:""}),this.toastContainer=null,this.customPosition=!1):([r+"-top-left",r+"-top-right",r+"-bottom-left",r+"-bottom-right",r+"-bottom-center",r+"-top-center",r+"-full-width"].forEach(function(i){!e.isNullOrUndefined(t.toastContainer)&&t.toastContainer.classList.contains(i)&&t.toastContainer.classList.remove(i)}),this.toastContainer=null),e.isNullOrUndefined(this.contentTemplate)||this.clearContentTemplate(),e.isNullOrUndefined(this.toastTemplate)||this.clearToastTemplate()},c.prototype.clearContentTemplate=function(){this.contentTemplate.style.display="none",document.body.appendChild(this.contentTemplate),this.contentTemplate=null},c.prototype.clearToastTemplate=function(){this.toastTemplate.style.display="none",document.body.appendChild(this.toastTemplate),this.toastTemplate=null},c.prototype.isBlazorServer=function(){return e.isBlazor()&&this.isServerRendered},c.prototype.destroyToast=function(t){for(var i,s=this,o=0;o<this.toastCollection.length;o++)this.toastCollection[o].element[0]===t&&(i=this.toastCollection[o],this.toastCollection.splice(o,1));var n=this.animation.hide,r={duration:n.duration,name:n.effect,timingFunction:n.easing},l=parseInt(t.id.split("toast_")[1],10),h=this.isBlazorServer()?{options:i,toastContainer:this.toastContainer}:{options:i,toastContainer:this.toastContainer,toastObj:this};e.isNullOrUndefined(this.progressObj[l])||e.isNullOrUndefined(t.querySelector("."+a))||(this.progressObj[l].progressEle.style.width="0%"),r.end=function(){s.clearProgress(l),s.isBlazorServer()&&!e.isNullOrUndefined(i)||e.detach(t),s.trigger("close",h),0===s.toastContainer.childElementCount&&s.clearContainerPos()},new e.Animation({}).animate(t,r)},c.prototype.personalizeToast=function(){this.setIcon(),this.setTitle(),this.setContent(),this.actionButtons()},c.prototype.setAria=function(){e.attributes(this.toastEle,{role:"alert"})},c.prototype.setPositioning=function(t){this.isBlazorServer()||(isNaN(parseFloat(t.X))&&isNaN(parseFloat(t.Y))?this.toastContainer.classList.add(r+"-"+t.Y.toString().toLowerCase()+"-"+t.X.toString().toLowerCase()):(this.customPosition=!0,e.setStyleAttribute(this.toastContainer,{left:e.formatUnit(t.X),top:e.formatUnit(t.Y)})))},c.prototype.setCloseButton=function(){if(this.showCloseButton){var t={close:"Close"};this.l10n=new e.L10n("toast",t,this.locale),this.l10n.setLocale(this.locale);var i=this.l10n.getConstant("close"),s=this.createElement("div",{className:h+" e-icons ",attrs:{tabindex:"0","aria-label":i}});this.toastEle.appendChild(s)}},c.prototype.setProgress=function(){if(this.timeOut>0){var 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,this.extendedTimeout>0&&(e.EventHandler.add(this.toastEle,"mouseover",this.toastHoverAction.bind(this,t)),e.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:a}),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)}},c.prototype.toastHoverAction=function(t){clearTimeout(this.progressObj[t].timeOutId),clearInterval(this.progressObj[t].intervalId),this.progressObj[t].hideEta=0;var i=this.progressObj[t].element;e.isNullOrUndefined(i.querySelector("."+a))||(this.progressObj[t].progressEle.style.width="0%")},c.prototype.delayedToastProgress=function(t){var i=this.progressObj[t],s=i.element;i.timeOutId=window.setTimeout(this.destroyToast.bind(this,s),this.extendedTimeout),i.maxHideTime=parseFloat(this.extendedTimeout+""),i.hideEta=(new Date).getTime()+i.maxHideTime,e.isNullOrUndefined(s.querySelector("."+a))||(i.intervalId=setInterval(this.updateProgressBar.bind(this,i),10))},c.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+"%"},c.prototype.setIcon=function(){if(!e.isNullOrUndefined(this.icon)&&0!==this.icon.length){var t=this.createElement("div",{className:"e-toast-icon e-icons "+this.icon});this.toastEle.appendChild(t)}},c.prototype.setTitle=function(){if(!e.isNullOrUndefined(this.title)){var t=this.createElement("div",{className:"e-toast-title"});t=this.fetchEle(t,this.title,"title");var i=this.createElement("div",{className:l});i.appendChild(t),this.toastEle.appendChild(i)}},c.prototype.setContent=function(){var t=this.createElement("div",{className:"e-toast-content"}),i=this.element;if(e.isNullOrUndefined(this.content)||""===this.content){var s=""!==this.element.innerHTML.replace(/\s/g,"");if((i.children.length>0||s)&&(!i.firstElementChild||!i.firstElementChild.classList.contains(r))){this.innerEle=document.createDocumentFragment();for(var o=this.createElement("div");0!==i.childNodes.length;)this.innerEle.appendChild(this.element.childNodes[0]);t.appendChild(this.innerEle),[].slice.call(t.children).forEach(function(t){o.appendChild(t.cloneNode(!0))}),this.content=o,this.appendMessageContainer(t)}}else"object"!=typeof this.content||e.isNullOrUndefined(this.content.tagName)?(t=this.fetchEle(t,this.content,"content"),this.appendMessageContainer(t)):(t.appendChild(this.content),this.content=this.content.cloneNode(!0),this.appendMessageContainer(t))},c.prototype.appendMessageContainer=function(t){if(this.toastEle.querySelectorAll("."+l).length>0)this.toastEle.querySelector("."+l).appendChild(t);else{var e=this.createElement("div",{className:l});e.appendChild(t),this.toastEle.appendChild(e)}},c.prototype.actionButtons=function(){var t=this,s=this.createElement("div",{className:"e-toast-actions"});[].slice.call(this.buttons).forEach(function(o){if(!e.isNullOrUndefined(o.model)){var n=t.createElement("button");n.setAttribute("type","button"),(e.isNullOrUndefined(o.model.cssClass)||0===o.model.cssClass.length)&&(o.model.cssClass="e-primary"),n.classList.add("e-small"),new i.Button(o.model,n),e.isNullOrUndefined(o.click)||"function"!=typeof o.click||e.EventHandler.add(n,"click",o.click),s.appendChild(n)}}),s.childElementCount>0&&this.appendMessageContainer(s)},c.prototype.appendToTarget=function(t){var i=this,o=this.isBlazorServer()?{options:t,element:this.toastEle,cancel:!1}:{options:t,toastObj:this,element:this.toastEle,cancel:!1};this.trigger("beforeOpen",o,function(o){if(o.cancel){if(i.isBlazorServer()){var n=parseInt(i.toastEle.id.split("toast_")[1],10);i.clearProgress(n),e.detach(i.toastEle),0===i.toastContainer.childElementCount&&i.clearContainerPos()}}else i.isBlazorServer()||(i.toastEle.style.display="none"),i.newestOnTop&&0!==i.toastContainer.childElementCount?i.toastContainer.insertBefore(i.toastEle,i.toastContainer.children[0]):i.isBlazorServer()||i.toastContainer.appendChild(i.toastEle),e.removeClass([i.toastEle],"e-blazor-toast-hidden"),e.EventHandler.add(i.toastEle,"click",i.clickHandler,i),e.EventHandler.add(i.toastEle,"keydown",i.keyDownHandler,i),i.toastContainer.style.zIndex=s.getZindexPartial(i.toastContainer)+"",i.displayToast(i.toastEle,t)})},c.prototype.clickHandler=function(t){var i=this;this.isBlazorServer()||t.stopPropagation();var s=t.target,o=e.closest(s,"."+r),n=this.isBlazorServer()?{element:o,cancel:!1,clickToClose:!1,originalEvent:t}:{element:o,cancel:!1,clickToClose:!1,originalEvent:t,toastObj:this},l=s.classList.contains(h);this.trigger("click",n,function(t){(l&&!t.cancel||t.clickToClose)&&i.destroyToast(o)})},c.prototype.keyDownHandler=function(t){if(t.target.classList.contains(h)&&(13===t.keyCode||32===t.keyCode)){var i=t.target,s=e.closest(i,"."+r);this.destroyToast(s)}},c.prototype.displayToast=function(t,i){var s=this,o=this.animation.show,n={duration:o.duration,name:o.effect,timingFunction:o.easing},r=this.isBlazorServer()?{options:i,element:this.toastEle}:{options:i,toastObj:this,element:this.toastEle};n.begin=function(){t.style.display=""},n.end=function(){s.trigger("open",r)},new e.Animation(n).animate(t)},c.prototype.getContainer=function(){return this.element.classList.add("e-toast-container"),this.element},c.prototype.onPropertyChanged=function(t,e){for(var i=this.element,s=0,o=Object.keys(t);s<o.length;s++)switch(o[s]){case"enableRtl":t.enableRtl?i.classList.add("e-rtl"):i.classList.remove("e-rtl")}},n([e.Property("300px")],c.prototype,"width",void 0),n([e.Property("auto")],c.prototype,"height",void 0),n([e.Property(null)],c.prototype,"title",void 0),n([e.Property(null)],c.prototype,"content",void 0),n([e.Property(!0)],c.prototype,"enableHtmlSanitizer",void 0),n([e.Property(null)],c.prototype,"icon",void 0),n([e.Property(null)],c.prototype,"cssClass",void 0),n([e.Property(null)],c.prototype,"template",void 0),n([e.Property(!0)],c.prototype,"newestOnTop",void 0),n([e.Property(!1)],c.prototype,"showCloseButton",void 0),n([e.Property(!1)],c.prototype,"showProgressBar",void 0),n([e.Property(5e3)],c.prototype,"timeOut",void 0),n([e.Property("Rtl")],c.prototype,"progressDirection",void 0),n([e.Property(1e3)],c.prototype,"extendedTimeout",void 0),n([e.Complex({},u)],c.prototype,"animation",void 0),n([e.Complex({},p)],c.prototype,"position",void 0),n([e.Collection([{}],d)],c.prototype,"buttons",void 0),n([e.Property(null)],c.prototype,"target",void 0),n([e.Event()],c.prototype,"created",void 0),n([e.Event()],c.prototype,"beforeSanitizeHtml",void 0),n([e.Event()],c.prototype,"destroyed",void 0),n([e.Event()],c.prototype,"open",void 0),n([e.Event()],c.prototype,"beforeOpen",void 0),n([e.Event()],c.prototype,"close",void 0),n([e.Event()],c.prototype,"click",void 0),c=n([e.NotifyPropertyChanges],c)}(e.Component);return t.ToastPosition=p,t.ButtonModelProps=d,t.ToastAnimations=c,t.ToastAnimationSettings=u,t.Toast=f,t}({},ej.base,ej.buttons,ej.popups),this.ejs=ej; | ||
this.ej=this.ej||{},this.ej.notifications=function(t,e,i,s){"use strict";var o=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),n=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r},r="e-toast",l="e-toast-message",a="e-toast-progress",h="e-toast-close-icon",p=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("Left")],i.prototype,"X",void 0),n([e.Property("Top")],i.prototype,"Y",void 0),i}(e.ChildProperty),d=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property(null)],i.prototype,"model",void 0),n([e.Property(null)],i.prototype,"click",void 0),i}(e.ChildProperty),c=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Property("FadeIn")],i.prototype,"effect",void 0),n([e.Property(600)],i.prototype,"duration",void 0),n([e.Property("ease")],i.prototype,"easing",void 0),i}(e.ChildProperty),u=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return o(i,t),n([e.Complex({effect:"FadeIn",duration:600,easing:"ease"},c)],i.prototype,"show",void 0),n([e.Complex({effect:"FadeOut",duration:600,easing:"ease"},c)],i.prototype,"hide",void 0),i}(e.ChildProperty),f=function(t){function c(e,i){var s=t.call(this,e,i)||this;return s.toastCollection=[],s}return o(c,t),c.prototype.getModuleName=function(){return"toast"},c.prototype.getPersistData=function(){return this.addOnPersist([])},c.prototype.destroy=function(){this.hide("All"),this.element.classList.remove("e-toast-container"),e.setStyleAttribute(this.element,{position:"","z-index":""}),e.isNullOrUndefined(this.refElement)||e.isNullOrUndefined(this.refElement.parentElement)||(this.refElement.parentElement.insertBefore(this.element,this.refElement),e.detach(this.refElement),this.refElement=void 0),this.isBlazorServer()||t.prototype.destroy.call(this)},c.prototype.preRender=function(){this.isDevice=e.Browser.isDevice,"300px"===this.width&&(this.width=this.isDevice&&screen.width<768?"100%":"300px"),e.isNullOrUndefined(this.target)&&(this.target=document.body),this.enableRtl&&!this.isBlazorServer()&&this.element.classList.add("e-rtl")},c.prototype.render=function(){this.progressObj=[],this.intervalId=[],this.contentTemplate=null,this.toastTemplate=null,this.isDevice&&screen.width<768&&new e.Touch(this.element,{swipe:this.swipeHandler.bind(this)}),this.renderComplete(),this.initRenderClass=this.element.className},c.prototype.show=function(t){var i;if(e.isNullOrUndefined(t)||(this.templateChanges(t),i=JSON.parse(JSON.stringify(t)),e.extend(this,this,t)),e.isNullOrUndefined(this.toastContainer)){this.toastContainer=this.getContainer();var s="string"==typeof this.target?document.querySelector(this.target):document.body;if(e.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)}if(this.isBlazorServer()&&this.element.classList.contains("e-control"))return void this.isToastModel(t);this.toastEle=this.createElement("div",{className:r,id:e.getUniqueID("toast")}),this.setWidthHeight(),this.setCSSClass(this.cssClass),e.isNullOrUndefined(this.template)||""===this.template?this.personalizeToast():this.templateRendering(),this.setProgress(),this.setCloseButton(),this.setAria(),this.appendToTarget(t),e.isNullOrUndefined(i)||(e.extend(i,{element:[this.toastEle]},!0),this.toastCollection.push(i)),this.isReact&&this.renderReactTemplates()},c.prototype.showToast=function(t,e){this.toastEle=this.element.querySelector("#"+t),this.show(e)},c.prototype.isToastModel=function(t){this.toastContainer=this.element,this.setPositioning(this.position);var i=this;e.isNullOrUndefined(i.element.lastElementChild)||this.setProgress(),this.setAria(),this.appendToTarget(t)},c.prototype.swipeHandler=function(t){var i=e.closest(t.originalEvent.target,".e-toast:not(.e-toast-container)"),s=this.animation.hide.effect;e.isNullOrUndefined(i)||("Right"===t.swipeDirection?(this.animation.hide.effect="SlideRightOut",this.hideToast("swipe",i)):"Left"===t.swipeDirection&&(this.animation.hide.effect="SlideLeftOut",this.hideToast("swipe",i)),this.animation.hide.effect=s)},c.prototype.templateChanges=function(t){e.isUndefined(t.content)||e.isNullOrUndefined(this.contentTemplate)||this.content===t.content||this.clearContentTemplate(),e.isUndefined(t.template)||e.isNullOrUndefined(this.toastTemplate)||this.template===t.template||this.clearToastTemplate()},c.prototype.setCSSClass=function(t){if(t){var i=-1!==t.indexOf(",")?",":" ";e.classList(this.toastEle,t.split(i),[])}},c.prototype.setWidthHeight=function(){"300px"===this.width?this.toastEle.style.width=e.formatUnit(this.width):"100%"===this.width?this.toastContainer.classList.add("e-toast-full-width"):(this.toastEle.style.width=e.formatUnit(this.width),this.toastContainer.classList.remove("e-toast-full-width")),this.toastEle.style.height=e.formatUnit(this.height)},c.prototype.templateRendering=function(){this.fetchEle(this.toastEle,this.template,"template")},c.prototype.sanitizeHelper=function(t){if(this.enableHtmlSanitizer){var i=e.SanitizeHtmlHelper.beforeSanitize(),s={cancel:!1,helper:null};e.extend(i,i,s),this.trigger("beforeSanitizeHtml",i),i.cancel&&!e.isNullOrUndefined(i.helper)?t=i.helper(t):i.cancel||(t=e.SanitizeHtmlHelper.serializeValue(i,t))}return t},c.prototype.hide=function(t){this.hideToast("",t)},c.prototype.hideToast=function(t,i){if(!e.isNullOrUndefined(this.toastContainer)&&0!==this.toastContainer.childElementCount)if("string"!=typeof i||"All"!==i)e.isNullOrUndefined(i)&&(i=this.newestOnTop?this.toastContainer.lastElementChild:this.toastContainer.firstElementChild),this.destroyToast(i,t);else for(var s=0;s<this.toastContainer.childElementCount;s++)this.destroyToast(this.toastContainer.children[s],t)},c.prototype.fetchEle=function(t,i,s){i="string"==typeof i?this.sanitizeHelper(i):i;var o,n,r,l;if(l=t.classList.contains("e-toast-title")?this.element.id+"title":t.classList.contains("e-toast-content")?this.element.id+"content":this.element.id+"template",n="content"===s?this.contentTemplate:this.toastTemplate,!e.isNullOrUndefined(n))return t.appendChild(n.cloneNode(!0)),t;try{if(document.querySelectorAll(i).length>0){var a=null;"title"!==s&&(a=document.querySelector(i),t.appendChild(a),a.style.display="");var h=e.isNullOrUndefined(a)?n:a.cloneNode(!0);"content"===s?this.contentTemplate=h:this.toastTemplate=h}}catch(t){o=e.compile(i)}if(!e.isNullOrUndefined(o))if(this.isBlazorServer()){r=o({},this,s,l,!0)}else r=o({},this,s,null,!0);return e.isNullOrUndefined(r)||!(r.length>0)||e.isNullOrUndefined(r[0].tagName)&&1===r.length?0===t.childElementCount&&(t.innerHTML=i):[].slice.call(r).forEach(function(i){e.isNullOrUndefined(i.tagName)||(i.style.display=""),t.appendChild(i)}),t},c.prototype.clearProgress=function(t){e.isNullOrUndefined(this.intervalId[t])||(clearInterval(this.intervalId[t]),delete this.intervalId[t]),e.isNullOrUndefined(this.progressObj[t])||(clearInterval(this.progressObj[t].intervalId),delete this.progressObj[t])},c.prototype.clearContainerPos=function(){var t=this;if(this.isBlazorServer())return void(this.toastContainer=null);this.customPosition?(e.setStyleAttribute(this.toastContainer,{left:"",top:""}),this.toastContainer=null,this.customPosition=!1):([r+"-top-left",r+"-top-right",r+"-bottom-left",r+"-bottom-right",r+"-bottom-center",r+"-top-center",r+"-full-width"].forEach(function(i){!e.isNullOrUndefined(t.toastContainer)&&t.toastContainer.classList.contains(i)&&t.toastContainer.classList.remove(i)}),this.toastContainer=null),e.isNullOrUndefined(this.contentTemplate)||this.clearContentTemplate(),e.isNullOrUndefined(this.toastTemplate)||this.clearToastTemplate()},c.prototype.clearContentTemplate=function(){this.contentTemplate.style.display="none",document.body.appendChild(this.contentTemplate),this.contentTemplate=null},c.prototype.clearToastTemplate=function(){this.toastTemplate.style.display="none",document.body.appendChild(this.toastTemplate),this.toastTemplate=null},c.prototype.isBlazorServer=function(){return e.isBlazor()&&this.isServerRendered},c.prototype.destroyToast=function(t,i){for(var s,o=this,n=0;n<this.toastCollection.length;n++)this.toastCollection[n].element[0]===t&&(s=this.toastCollection[n],this.toastCollection.splice(n,1));var r={options:this,cancel:!1,type:i,element:t,toastContainer:this.toastContainer},l=this.animation.hide,h={duration:l.duration,name:l.effect,timingFunction:l.easing},p=parseInt(t.id.split("toast_")[1],10),d=this.isBlazorServer()?{options:s,toastContainer:this.toastContainer}:{options:s,toastContainer:this.toastContainer,toastObj:this};this.trigger("beforeClose",r,function(i){i.cancel||(e.isNullOrUndefined(o.progressObj[p])||e.isNullOrUndefined(t.querySelector("."+a))||(o.progressObj[p].progressEle.style.width="0%"),h.end=function(){o.clearProgress(p),o.isBlazorServer()&&!e.isNullOrUndefined(s)||e.detach(t),o.trigger("close",d),0===o.toastContainer.childElementCount&&o.clearContainerPos()},new e.Animation({}).animate(t,h))})},c.prototype.personalizeToast=function(){this.setIcon(),this.setTitle(),this.setContent(),this.actionButtons()},c.prototype.setAria=function(){e.attributes(this.toastEle,{role:"alert"})},c.prototype.setPositioning=function(t){this.isBlazorServer()||(isNaN(parseFloat(t.X))&&isNaN(parseFloat(t.Y))?this.toastContainer.classList.add(r+"-"+t.Y.toString().toLowerCase()+"-"+t.X.toString().toLowerCase()):(this.customPosition=!0,e.setStyleAttribute(this.toastContainer,{left:e.formatUnit(t.X),top:e.formatUnit(t.Y)})))},c.prototype.setCloseButton=function(){if(this.showCloseButton){var t={close:"Close"};this.l10n=new e.L10n("toast",t,this.locale),this.l10n.setLocale(this.locale);var i=this.l10n.getConstant("close"),s=this.createElement("div",{className:h+" e-icons ",attrs:{tabindex:"0","aria-label":i}});this.toastEle.appendChild(s)}},c.prototype.setProgress=function(){if(this.timeOut>0){var 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,this.extendedTimeout>0&&(e.EventHandler.add(this.toastEle,"mouseover",this.toastHoverAction.bind(this,t)),e.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:a}),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)}},c.prototype.toastHoverAction=function(t){clearTimeout(this.progressObj[t].timeOutId),clearInterval(this.progressObj[t].intervalId),this.progressObj[t].hideEta=0;var i=this.progressObj[t].element;e.isNullOrUndefined(i.querySelector("."+a))||(this.progressObj[t].progressEle.style.width="0%")},c.prototype.delayedToastProgress=function(t){var i=this.progressObj[t],s=i.element;i.timeOutId=window.setTimeout(this.destroyToast.bind(this,s),this.extendedTimeout),i.maxHideTime=parseFloat(this.extendedTimeout+""),i.hideEta=(new Date).getTime()+i.maxHideTime,e.isNullOrUndefined(s.querySelector("."+a))||(i.intervalId=setInterval(this.updateProgressBar.bind(this,i),10))},c.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+"%"},c.prototype.setIcon=function(){if(!e.isNullOrUndefined(this.icon)&&0!==this.icon.length){var t=this.createElement("div",{className:"e-toast-icon e-icons "+this.icon});this.toastEle.appendChild(t)}},c.prototype.setTitle=function(){if(!e.isNullOrUndefined(this.title)){var t=this.createElement("div",{className:"e-toast-title"});t=this.fetchEle(t,this.title,"title");var i=this.createElement("div",{className:l});i.appendChild(t),this.toastEle.appendChild(i)}},c.prototype.setContent=function(){var t=this.createElement("div",{className:"e-toast-content"}),i=this.element;if(e.isNullOrUndefined(this.content)||""===this.content){var s=""!==this.element.innerHTML.replace(/\s/g,"");if((i.children.length>0||s)&&(!i.firstElementChild||!i.firstElementChild.classList.contains(r))){this.innerEle=document.createDocumentFragment();for(var o=this.createElement("div");0!==i.childNodes.length;)this.innerEle.appendChild(this.element.childNodes[0]);t.appendChild(this.innerEle),[].slice.call(t.children).forEach(function(t){o.appendChild(t.cloneNode(!0))}),this.content=o,this.appendMessageContainer(t)}}else"object"!=typeof this.content||e.isNullOrUndefined(this.content.tagName)?(t=this.fetchEle(t,this.content,"content"),this.appendMessageContainer(t)):(t.appendChild(this.content),this.content=this.content.cloneNode(!0),this.appendMessageContainer(t))},c.prototype.appendMessageContainer=function(t){if(this.toastEle.querySelectorAll("."+l).length>0)this.toastEle.querySelector("."+l).appendChild(t);else{var e=this.createElement("div",{className:l});e.appendChild(t),this.toastEle.appendChild(e)}},c.prototype.actionButtons=function(){var t=this,s=this.createElement("div",{className:"e-toast-actions"});[].slice.call(this.buttons).forEach(function(o){if(!e.isNullOrUndefined(o.model)){var n=t.createElement("button");n.setAttribute("type","button"),(e.isNullOrUndefined(o.model.cssClass)||0===o.model.cssClass.length)&&(o.model.cssClass="e-primary"),n.classList.add("e-small"),new i.Button(o.model,n),e.isNullOrUndefined(o.click)||"function"!=typeof o.click||e.EventHandler.add(n,"click",o.click),s.appendChild(n)}}),s.childElementCount>0&&this.appendMessageContainer(s)},c.prototype.appendToTarget=function(t){var i=this,o=this.isBlazorServer()?{options:t,element:this.toastEle,cancel:!1}:{options:t,toastObj:this,element:this.toastEle,cancel:!1};this.trigger("beforeOpen",o,function(o){if(o.cancel){if(i.isBlazorServer()){var n=parseInt(i.toastEle.id.split("toast_")[1],10);i.clearProgress(n),e.detach(i.toastEle),0===i.toastContainer.childElementCount&&i.clearContainerPos()}}else i.isBlazorServer()||(i.toastEle.style.display="none"),i.newestOnTop&&0!==i.toastContainer.childElementCount?i.toastContainer.insertBefore(i.toastEle,i.toastContainer.children[0]):i.isBlazorServer()||i.toastContainer.appendChild(i.toastEle),e.removeClass([i.toastEle],"e-blazor-toast-hidden"),e.EventHandler.add(i.toastEle,"click",i.clickHandler,i),e.EventHandler.add(i.toastEle,"keydown",i.keyDownHandler,i),i.toastContainer.style.zIndex=s.getZindexPartial(i.toastContainer)+"",i.displayToast(i.toastEle,t)})},c.prototype.clickHandler=function(t){var i=this;this.isBlazorServer()||t.stopPropagation();var s=t.target,o=e.closest(s,"."+r),n=this.isBlazorServer()?{element:o,cancel:!1,clickToClose:!1,originalEvent:t}:{element:o,cancel:!1,clickToClose:!1,originalEvent:t,toastObj:this},l=s.classList.contains(h);this.trigger("click",n,function(t){(l&&!t.cancel||t.clickToClose)&&i.destroyToast(o,"click")})},c.prototype.keyDownHandler=function(t){if(t.target.classList.contains(h)&&(13===t.keyCode||32===t.keyCode)){var i=t.target,s=e.closest(i,"."+r);this.destroyToast(s,"key")}},c.prototype.displayToast=function(t,i){var s=this,o=this.animation.show,n={duration:o.duration,name:o.effect,timingFunction:o.easing},r=this.isBlazorServer()?{options:i,element:this.toastEle}:{options:i,toastObj:this,element:this.toastEle};n.begin=function(){t.style.display=""},n.end=function(){s.trigger("open",r)},new e.Animation(n).animate(t)},c.prototype.getContainer=function(){return this.element.classList.add("e-toast-container"),this.element},c.prototype.onPropertyChanged=function(t,e){for(var i=this.element,s=0,o=Object.keys(t);s<o.length;s++)switch(o[s]){case"enableRtl":t.enableRtl?i.classList.add("e-rtl"):i.classList.remove("e-rtl")}},n([e.Property("300px")],c.prototype,"width",void 0),n([e.Property("auto")],c.prototype,"height",void 0),n([e.Property(null)],c.prototype,"title",void 0),n([e.Property(null)],c.prototype,"content",void 0),n([e.Property(!0)],c.prototype,"enableHtmlSanitizer",void 0),n([e.Property(null)],c.prototype,"icon",void 0),n([e.Property(null)],c.prototype,"cssClass",void 0),n([e.Property(null)],c.prototype,"template",void 0),n([e.Property(!0)],c.prototype,"newestOnTop",void 0),n([e.Property(!1)],c.prototype,"showCloseButton",void 0),n([e.Property(!1)],c.prototype,"showProgressBar",void 0),n([e.Property(5e3)],c.prototype,"timeOut",void 0),n([e.Property("Rtl")],c.prototype,"progressDirection",void 0),n([e.Property(1e3)],c.prototype,"extendedTimeout",void 0),n([e.Complex({},u)],c.prototype,"animation",void 0),n([e.Complex({},p)],c.prototype,"position",void 0),n([e.Collection([{}],d)],c.prototype,"buttons",void 0),n([e.Property(null)],c.prototype,"target",void 0),n([e.Event()],c.prototype,"created",void 0),n([e.Event()],c.prototype,"beforeSanitizeHtml",void 0),n([e.Event()],c.prototype,"destroyed",void 0),n([e.Event()],c.prototype,"open",void 0),n([e.Event()],c.prototype,"beforeOpen",void 0),n([e.Event()],c.prototype,"beforeClose",void 0),n([e.Event()],c.prototype,"close",void 0),n([e.Event()],c.prototype,"click",void 0),c=n([e.NotifyPropertyChanges],c)}(e.Component);return t.ToastPosition=p,t.ButtonModelProps=d,t.ToastAnimations=c,t.ToastAnimationSettings=u,t.Toast=f,t}({},ej.base,ej.buttons,ej.popups),this.ejs=ej; | ||
//# sourceMappingURL=ej2-notifications.min.js.map |
/*! | ||
* filename: index.d.ts | ||
* version : 18.4.39 | ||
* version : 19.1.54 | ||
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"_from": "@syncfusion/ej2-notifications@*", | ||
"_id": "@syncfusion/ej2-notifications@18.4.34", | ||
"_id": "@syncfusion/ej2-notifications@18.3.35", | ||
"_inBundle": false, | ||
"_integrity": "sha512-p5Qm76TrNekSqaYSVNLp04Y1d2T9iQFnKk8MwfCWz2ZtyrAC4aMMRkw9DpBmyomq5RG0Jt4bhfTWrSPpbPT1Bw==", | ||
"_integrity": "sha512-5n5RLNf3C7iXCF7m5pss39DvuyN2jA60qIkEOod5KAsjgfTRphrGx8dyHLdXanaEDOEVXglGRgqMzAV7sKuWXw==", | ||
"_location": "/@syncfusion/ej2-notifications", | ||
@@ -27,4 +27,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-notifications/-/ej2-notifications-18.4.34.tgz", | ||
"_shasum": "5f86a2a7aaaeabfe218f7a0580ba049f65ffa994", | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-notifications/-/ej2-notifications-18.3.35.tgz", | ||
"_shasum": "05f79ed030112d206add459701b2b2d08d6c3fa4", | ||
"_spec": "@syncfusion/ej2-notifications@*", | ||
@@ -37,5 +37,5 @@ "_where": "/jenkins/workspace/automation_release_18.4.0.1-WOJ6QVY6EU5ONBWOYGQFKS2VU2UW7E67MOXUPKCE5AX7QQX7M5JQ/packages/included", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~18.4.39", | ||
"@syncfusion/ej2-buttons": "~18.4.39", | ||
"@syncfusion/ej2-popups": "~18.4.39" | ||
"@syncfusion/ej2-base": "~19.1.54", | ||
"@syncfusion/ej2-buttons": "~19.1.54", | ||
"@syncfusion/ej2-popups": "~19.1.54" | ||
}, | ||
@@ -74,4 +74,4 @@ "deprecated": false, | ||
"typings": "index.d.ts", | ||
"version": "18.4.39", | ||
"version": "19.1.54", | ||
"sideEffects": false | ||
} |
import { Component, Property, ChildProperty, INotifyPropertyChanged, NotifyPropertyChanges, Animation } from '@syncfusion/ej2-base';import { Browser, isNullOrUndefined as isNOU, getUniqueID, formatUnit, EventHandler, KeyboardEventArgs } from '@syncfusion/ej2-base';import { EmitType, Collection, Complex, setStyleAttribute, Event, Effect, detach, AnimationModel, L10n } from '@syncfusion/ej2-base';import { attributes, extend, closest, compile as templateCompiler, classList, BaseEventArgs, isUndefined } from '@syncfusion/ej2-base';import { SwipeEventArgs, Touch, isBlazor, SanitizeHtmlHelper, removeClass } from '@syncfusion/ej2-base';import { ButtonModel, Button } from '@syncfusion/ej2-buttons';import { getZindexPartial } from '@syncfusion/ej2-popups'; | ||
import {PositionX,PositionY,ProgressDirectionType,BeforeSanitizeHtmlArgs,ToastOpenArgs,ToastBeforeOpenArgs,ToastCloseArgs,ToastClickEventArgs} from "./toast"; | ||
import {PositionX,PositionY,ProgressDirectionType,BeforeSanitizeHtmlArgs,ToastOpenArgs,ToastBeforeOpenArgs,ToastBeforeCloseArgs,ToastCloseArgs,ToastClickEventArgs} from "./toast"; | ||
import {ComponentModel} from '@syncfusion/ej2-base'; | ||
@@ -11,15 +11,17 @@ | ||
/** | ||
* Specifies the position of the Toast notification with respect to the target container's left edge. | ||
* @default 'Left' | ||
* @aspType string | ||
* @blazorType string | ||
*/ | ||
* Specifies the position of the Toast notification with respect to the target container's left edge. | ||
* | ||
* @default 'Left' | ||
* @aspType string | ||
* @blazorType string | ||
*/ | ||
X?: PositionX | number | string; | ||
/** | ||
* Specifies the position of the Toast notification with respect to the target container's top edge. | ||
* @default 'Top' | ||
* @aspType string | ||
* @blazorType string | ||
*/ | ||
* Specifies the position of the Toast notification with respect to the target container's top edge. | ||
* | ||
* @default 'Top' | ||
* @aspType string | ||
* @blazorType string | ||
*/ | ||
Y?: PositionY | number | string; | ||
@@ -40,11 +42,11 @@ | ||
* ```typescript | ||
* let toast: Toast = new Toast({ | ||
* let toast: Toast = new Toast({ | ||
* buttons: | ||
* [{ | ||
* [{ | ||
* model: { content:`Button1`, cssClass: `e-success` } | ||
* }] | ||
* }] | ||
* }); | ||
* toast.appendTo('#element'); | ||
* ``` | ||
* | ||
* | ||
* @default null | ||
@@ -56,3 +58,4 @@ */ | ||
* Specifies the click event binding of action buttons created within Toast. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Clicked' | ||
@@ -72,2 +75,3 @@ * @blazorType Microsoft.AspNetCore.Components.Web.MouseEventArgs | ||
* Specifies the type of animation. | ||
* | ||
* @default 'FadeIn' | ||
@@ -80,2 +84,3 @@ * @aspType string | ||
* Specifies the duration to animate. | ||
* | ||
* @default 600 | ||
@@ -87,2 +92,3 @@ */ | ||
* Specifies the animation timing function. | ||
* | ||
* @default 'ease' | ||
@@ -101,2 +107,3 @@ */ | ||
* Specifies the animation to appear while showing the Toast. | ||
* | ||
* @default { effect: 'FadeIn', duration: 600, easing: 'ease' } | ||
@@ -108,2 +115,3 @@ */ | ||
* Specifies the animation to appear while hiding the Toast. | ||
* | ||
* @default { effect: 'FadeOut', duration: 600, easing: 'ease' } | ||
@@ -122,3 +130,4 @@ */ | ||
* Specifies the width of the Toast in pixels/numbers/percentage. Number value is considered as pixels. | ||
* In mobile devices, default width is considered as `100%`. | ||
* In mobile devices, default width is considered as `100%`. | ||
* | ||
* @default '300' | ||
@@ -131,2 +140,3 @@ * @blazorType string | ||
* Specifies the height of the Toast in pixels/number/percentage. Number value is considered as pixels. | ||
* | ||
* @default 'auto' | ||
@@ -139,3 +149,4 @@ * @blazorType string | ||
* Specifies the title to be displayed on the Toast. | ||
* Works only with string values. | ||
* Accepts selectors, string values and HTML elements. | ||
* | ||
* @default null | ||
@@ -148,2 +159,3 @@ */ | ||
* Accepts selectors, string values and HTML elements. | ||
* | ||
* @default null | ||
@@ -156,2 +168,3 @@ * @blazorType string | ||
* Defines whether to allow the cross-scripting site or not. | ||
* | ||
* @default true | ||
@@ -163,2 +176,3 @@ */ | ||
* Defines CSS classes to specify an icon for the Toast which is to be displayed at top left corner of the Toast. | ||
* | ||
* @default null | ||
@@ -170,2 +184,3 @@ */ | ||
* Defines single/multiple classes (separated by space) to be used for customization of Toast. | ||
* | ||
* @default null | ||
@@ -188,2 +203,3 @@ */ | ||
* By default, newly added Toast will be added after old Toast's. | ||
* | ||
* @default true | ||
@@ -195,2 +211,3 @@ */ | ||
* Specifies whether to show the close button in Toast message to close the Toast. | ||
* | ||
* @default false | ||
@@ -202,2 +219,3 @@ */ | ||
* Specifies whether to show the progress bar to denote the Toast message display timeout. | ||
* | ||
* @default false | ||
@@ -211,2 +229,3 @@ */ | ||
* - Setting 0 as a time out value displays the Toast on the page until the user closes it manually. | ||
* | ||
* @default 5000 | ||
@@ -223,2 +242,3 @@ */ | ||
* Specifies the Toast display time duration after interacting with the Toast. | ||
* | ||
* @default 1000 | ||
@@ -268,2 +288,3 @@ */ | ||
* The default value is null, which refers the `document.body` element. | ||
* | ||
* @default null | ||
@@ -277,3 +298,4 @@ * @aspType string | ||
* Triggers the event after the Toast gets created. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Created' | ||
@@ -285,3 +307,4 @@ */ | ||
* Event triggers before sanitize the value. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnSanitizeHtml' | ||
@@ -293,3 +316,4 @@ */ | ||
* Triggers the event after the Toast gets destroyed. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Destroyed' | ||
@@ -301,3 +325,4 @@ */ | ||
* Triggers the event after the Toast shown on the target container. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Opened' | ||
@@ -309,3 +334,4 @@ */ | ||
* Triggers the event before the toast shown. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnOpen' | ||
@@ -316,4 +342,13 @@ */ | ||
/** | ||
* Triggers the event before the toast close. | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnClose' | ||
*/ | ||
beforeClose?: EmitType<ToastBeforeCloseArgs>; | ||
/** | ||
* Trigger the event after the Toast hides. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Closed' | ||
@@ -325,3 +360,4 @@ */ | ||
* The event will be fired while clicking on the Toast. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnClick' | ||
@@ -328,0 +364,0 @@ */ |
@@ -23,2 +23,3 @@ import { Component, ChildProperty, INotifyPropertyChanged } from '@syncfusion/ej2-base'; | ||
/** It is a callback function and executed it before our inbuilt action. It should return HTML as a string. | ||
* | ||
* @function | ||
@@ -63,2 +64,3 @@ * @param {string} value - Returns the value. | ||
* Defines the Toast object. | ||
* | ||
@@ -80,2 +82,3 @@ */ | ||
* Defines the Toast object. | ||
* | ||
@@ -92,3 +95,19 @@ */ | ||
/** | ||
* Specifies the event arguments of Toast before close. | ||
*/ | ||
export interface ToastBeforeCloseArgs extends BaseEventArgs { | ||
/** Defines current Toast model properties as options. */ | ||
options?: ToastModel; | ||
/** Defines the Toast element. */ | ||
element: HTMLElement; | ||
/** Defines the prevent action for before closing toast. */ | ||
cancel: boolean; | ||
/** Defines the interaction type. */ | ||
type: string; | ||
/** Defines the Toast container element. */ | ||
toastContainer: HTMLElement; | ||
} | ||
/** | ||
* Toast Collection model | ||
* | ||
* @hidden | ||
@@ -108,2 +127,3 @@ */ | ||
* Defines the Toast object. | ||
* | ||
@@ -127,2 +147,3 @@ */ | ||
* Defines the Toast object. | ||
* | ||
@@ -137,10 +158,12 @@ */ | ||
/** | ||
* Specifies the position of the Toast notification with respect to the target container's left edge. | ||
* @default 'Left' | ||
* @aspType string | ||
* @blazorType string | ||
*/ | ||
* Specifies the position of the Toast notification with respect to the target container's left edge. | ||
* | ||
* @default 'Left' | ||
* @aspType string | ||
* @blazorType string | ||
*/ | ||
X: PositionX | number | string; | ||
/** | ||
* Specifies the position of the Toast notification with respect to the target container's top edge. | ||
* | ||
* @default 'Top' | ||
@@ -157,22 +180,23 @@ * @aspType string | ||
/** | ||
* Specifies the Button component model properties to render the Toast action buttons. | ||
* ```html | ||
* <div id="element"> </div> | ||
* ``` | ||
* ```typescript | ||
* let toast: Toast = new Toast({ | ||
* buttons: | ||
* [{ | ||
* model: { content:`Button1`, cssClass: `e-success` } | ||
* }] | ||
* }); | ||
* toast.appendTo('#element'); | ||
* ``` | ||
* | ||
* @default null | ||
*/ | ||
* Specifies the Button component model properties to render the Toast action buttons. | ||
* ```html | ||
* <div id="element"> </div> | ||
* ``` | ||
* ```typescript | ||
* let toast: Toast = new Toast({ | ||
* buttons: | ||
* [{ | ||
* model: { content:`Button1`, cssClass: `e-success` } | ||
* }] | ||
* }); | ||
* toast.appendTo('#element'); | ||
* ``` | ||
* | ||
* @default null | ||
*/ | ||
model: ButtonModel; | ||
/** | ||
* Specifies the click event binding of action buttons created within Toast. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Clicked' | ||
@@ -189,2 +213,3 @@ * @blazorType Microsoft.AspNetCore.Components.Web.MouseEventArgs | ||
* Specifies the type of animation. | ||
* | ||
* @default 'FadeIn' | ||
@@ -196,2 +221,3 @@ * @aspType string | ||
* Specifies the duration to animate. | ||
* | ||
* @default 600 | ||
@@ -202,2 +228,3 @@ */ | ||
* Specifies the animation timing function. | ||
* | ||
* @default 'ease' | ||
@@ -213,2 +240,3 @@ */ | ||
* Specifies the animation to appear while showing the Toast. | ||
* | ||
* @default { effect: 'FadeIn', duration: 600, easing: 'ease' } | ||
@@ -219,2 +247,3 @@ */ | ||
* Specifies the animation to appear while hiding the Toast. | ||
* | ||
* @default { effect: 'FadeOut', duration: 600, easing: 'ease' } | ||
@@ -226,3 +255,3 @@ */ | ||
* The Toast is a notification pop-up that showing on desired position which can provide an information to the user. | ||
* * ```html | ||
* ```html | ||
* <div id="toast"/> | ||
@@ -252,4 +281,5 @@ * <script> | ||
* Initializes a new instance of the Toast class. | ||
* @param options - Specifies Toast model properties as options. | ||
* @param element - Specifies the element that is rendered as a Toast. | ||
* | ||
* @param {ToastModel} options - Specifies Toast model properties as options. | ||
* @param {HTMLElement} element - Specifies the element that is rendered as a Toast. | ||
*/ | ||
@@ -260,2 +290,3 @@ constructor(options?: ToastModel, element?: HTMLElement); | ||
* In mobile devices, default width is considered as `100%`. | ||
* | ||
* @default '300' | ||
@@ -267,2 +298,3 @@ * @blazorType string | ||
* Specifies the height of the Toast in pixels/number/percentage. Number value is considered as pixels. | ||
* | ||
* @default 'auto' | ||
@@ -274,3 +306,4 @@ * @blazorType string | ||
* Specifies the title to be displayed on the Toast. | ||
* Works only with string values. | ||
* Accepts selectors, string values and HTML elements. | ||
* | ||
* @default null | ||
@@ -282,2 +315,3 @@ */ | ||
* Accepts selectors, string values and HTML elements. | ||
* | ||
* @default null | ||
@@ -289,2 +323,3 @@ * @blazorType string | ||
* Defines whether to allow the cross-scripting site or not. | ||
* | ||
* @default true | ||
@@ -295,2 +330,3 @@ */ | ||
* Defines CSS classes to specify an icon for the Toast which is to be displayed at top left corner of the Toast. | ||
* | ||
* @default null | ||
@@ -301,2 +337,3 @@ */ | ||
* Defines single/multiple classes (separated by space) to be used for customization of Toast. | ||
* | ||
* @default null | ||
@@ -317,2 +354,3 @@ */ | ||
* By default, newly added Toast will be added after old Toast's. | ||
* | ||
* @default true | ||
@@ -323,2 +361,3 @@ */ | ||
* Specifies whether to show the close button in Toast message to close the Toast. | ||
* | ||
* @default false | ||
@@ -329,2 +368,3 @@ */ | ||
* Specifies whether to show the progress bar to denote the Toast message display timeout. | ||
* | ||
* @default false | ||
@@ -337,2 +377,3 @@ */ | ||
* - Setting 0 as a time out value displays the Toast on the page until the user closes it manually. | ||
* | ||
* @default 5000 | ||
@@ -347,2 +388,3 @@ */ | ||
* Specifies the Toast display time duration after interacting with the Toast. | ||
* | ||
* @default 1000 | ||
@@ -388,2 +430,3 @@ */ | ||
* The default value is null, which refers the `document.body` element. | ||
* | ||
* @default null | ||
@@ -396,3 +439,4 @@ * @aspType string | ||
* Triggers the event after the Toast gets created. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Created' | ||
@@ -403,3 +447,4 @@ */ | ||
* Event triggers before sanitize the value. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnSanitizeHtml' | ||
@@ -410,3 +455,4 @@ */ | ||
* Triggers the event after the Toast gets destroyed. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Destroyed' | ||
@@ -417,3 +463,4 @@ */ | ||
* Triggers the event after the Toast shown on the target container. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Opened' | ||
@@ -424,3 +471,4 @@ */ | ||
* Triggers the event before the toast shown. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnOpen' | ||
@@ -430,4 +478,12 @@ */ | ||
/** | ||
* Triggers the event before the toast close. | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnClose' | ||
*/ | ||
beforeClose: EmitType<ToastBeforeCloseArgs>; | ||
/** | ||
* Trigger the event after the Toast hides. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'Closed' | ||
@@ -438,3 +494,4 @@ */ | ||
* The event will be fired while clicking on the Toast. | ||
* @event | ||
* | ||
* @event 'event' | ||
* @blazorProperty 'OnClick' | ||
@@ -445,2 +502,4 @@ */ | ||
* Gets the Component module name. | ||
* | ||
* @returns {string} - returns the string | ||
* @private | ||
@@ -451,2 +510,4 @@ */ | ||
* Gets the persisted state properties of the Component. | ||
* | ||
* @returns {string} - returns the string | ||
*/ | ||
@@ -456,2 +517,4 @@ protected getPersistData(): string; | ||
* Removes the component from the DOM and detaches all its related event handlers, attributes and classes. | ||
* | ||
* @returns {void} | ||
*/ | ||
@@ -461,2 +524,4 @@ destroy(): void; | ||
* Initialize the event handler | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -467,2 +532,4 @@ */ | ||
* Initialize the component rendering | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -473,4 +540,5 @@ */ | ||
* To show Toast element on a document with the relative position. | ||
* @param {ToastModel} toastObj? - To show Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {ToastModel} toastObj - To show Toast element on screen. | ||
* @returns {void} | ||
@@ -480,5 +548,8 @@ */ | ||
/** | ||
* @hidden | ||
* @param {string} id - specifies the id | ||
* @param {ToastModel} toastObj - specifies the model | ||
* @returns {void} | ||
* @hidden | ||
* This method applicable for blazor alone. | ||
* This method applicable for blazor alone. | ||
*/ | ||
@@ -493,2 +564,4 @@ showToast(id: string, toastObj?: ToastModel): void; | ||
/** | ||
* @param {string} value - specifies the string value. | ||
* @returns {string} - returns the string | ||
* @hidden | ||
@@ -500,6 +573,8 @@ */ | ||
* To Hide all toast element when passing 'All'. | ||
* @param {HTMLElement| Element| string} element? - To Hide Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {HTMLElement} element - To Hide Toast element on screen. | ||
* @returns {void} | ||
*/ | ||
hide(element?: HTMLElement | Element | string): void; | ||
private hideToast; | ||
private fetchEle; | ||
@@ -532,2 +607,6 @@ private clearProgress; | ||
* Called internally if any of the property value changed. | ||
* | ||
* @param {ToastModel} newProp - specifies the new property | ||
* @param {ToastModel} oldProp - specifies the old property | ||
* @returns {void} | ||
* @private | ||
@@ -534,0 +613,0 @@ */ |
@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || (function () { | ||
return extendStatics(d, b); | ||
} | ||
}; | ||
return function (d, b) { | ||
@@ -39,2 +39,3 @@ extendStatics(d, b); | ||
var RTL = 'e-rtl'; | ||
// eslint-disable-next-line | ||
var TOAST_REF_ELEMENT = 'e-toast-ref-element'; | ||
@@ -115,3 +116,3 @@ var TOAST_BLAZOR_HIDDEN = 'e-blazor-toast-hidden'; | ||
* The Toast is a notification pop-up that showing on desired position which can provide an information to the user. | ||
* * ```html | ||
* ```html | ||
* <div id="toast"/> | ||
@@ -128,4 +129,5 @@ * <script> | ||
* Initializes a new instance of the Toast class. | ||
* @param options - Specifies Toast model properties as options. | ||
* @param element - Specifies the element that is rendered as a Toast. | ||
* | ||
* @param {ToastModel} options - Specifies Toast model properties as options. | ||
* @param {HTMLElement} element - Specifies the element that is rendered as a Toast. | ||
*/ | ||
@@ -139,2 +141,4 @@ function Toast(options, element) { | ||
* Gets the Component module name. | ||
* | ||
* @returns {string} - returns the string | ||
* @private | ||
@@ -147,2 +151,4 @@ */ | ||
* Gets the persisted state properties of the Component. | ||
* | ||
* @returns {string} - returns the string | ||
*/ | ||
@@ -154,2 +160,4 @@ Toast.prototype.getPersistData = function () { | ||
* Removes the component from the DOM and detaches all its related event handlers, attributes and classes. | ||
* | ||
* @returns {void} | ||
*/ | ||
@@ -171,2 +179,4 @@ Toast.prototype.destroy = function () { | ||
* Initialize the event handler | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -189,2 +199,4 @@ */ | ||
* Initialize the component rendering | ||
* | ||
* @returns {void} | ||
* @private | ||
@@ -205,4 +217,5 @@ */ | ||
* To show Toast element on a document with the relative position. | ||
* @param {ToastModel} toastObj? - To show Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {ToastModel} toastObj - To show Toast element on screen. | ||
* @returns {void} | ||
@@ -240,2 +253,3 @@ */ | ||
this.setCSSClass(this.cssClass); | ||
// eslint-disable-next-line | ||
(isNOU(this.template) || this.template === '') ? this.personalizeToast() : this.templateRendering(); | ||
@@ -250,3 +264,3 @@ this.setProgress(); | ||
} | ||
// tslint:disable-next-line:no-any | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (this.isReact) { | ||
@@ -257,5 +271,8 @@ this.renderReactTemplates(); | ||
/** | ||
* @hidden | ||
* @param {string} id - specifies the id | ||
* @param {ToastModel} toastObj - specifies the model | ||
* @returns {void} | ||
* @hidden | ||
* This method applicable for blazor alone. | ||
* This method applicable for blazor alone. | ||
*/ | ||
@@ -269,2 +286,3 @@ Toast.prototype.showToast = function (id, toastObj) { | ||
this.setPositioning(this.position); | ||
// eslint-disable-next-line | ||
var proxy = this; | ||
@@ -283,7 +301,7 @@ if (!isNOU(proxy.element.lastElementChild)) { | ||
this.animation.hide.effect = 'SlideRightOut'; | ||
this.hide(toastEle); | ||
this.hideToast('swipe', toastEle); | ||
} | ||
else if (e.swipeDirection === 'Left') { | ||
this.animation.hide.effect = 'SlideLeftOut'; | ||
this.hide(toastEle); | ||
this.hideToast('swipe', toastEle); | ||
} | ||
@@ -324,2 +342,4 @@ this.animation.hide.effect = hideAnimation; | ||
/** | ||
* @param {string} value - specifies the string value. | ||
* @returns {string} - returns the string | ||
* @hidden | ||
@@ -348,6 +368,10 @@ */ | ||
* To Hide all toast element when passing 'All'. | ||
* @param {HTMLElement| Element| string} element? - To Hide Toast element on screen. | ||
* @returns void | ||
* | ||
* @param {HTMLElement} element - To Hide Toast element on screen. | ||
* @returns {void} | ||
*/ | ||
Toast.prototype.hide = function (element) { | ||
this.hideToast('', element); | ||
}; | ||
Toast.prototype.hideToast = function (interactionType, element) { | ||
if (isNOU(this.toastContainer) || this.toastContainer.childElementCount === 0) { | ||
@@ -358,3 +382,3 @@ return; | ||
for (var i = 0; i < this.toastContainer.childElementCount; i++) { | ||
this.destroyToast(this.toastContainer.children[i]); | ||
this.destroyToast(this.toastContainer.children[i], interactionType); | ||
} | ||
@@ -366,10 +390,7 @@ return; | ||
} | ||
this.destroyToast(element); | ||
// tslint:disable-next-line:no-any | ||
if (this.isReact) { | ||
this.clearTemplate(); | ||
} | ||
this.destroyToast(element, interactionType); | ||
}; | ||
Toast.prototype.fetchEle = function (ele, value, prob) { | ||
value = typeof (value) === 'string' ? this.sanitizeHelper(value) : value; | ||
// eslint-disable-next-line | ||
var templateFn; | ||
@@ -379,3 +400,2 @@ var tempVar; | ||
var templateProps; | ||
var templateValue; | ||
if (ele.classList.contains(TITLE)) { | ||
@@ -390,2 +410,3 @@ templateProps = this.element.id + 'title'; | ||
} | ||
// eslint-disable-next-line | ||
prob === 'content' ? tempVar = this.contentTemplate : tempVar = this.toastTemplate; | ||
@@ -405,2 +426,3 @@ if (!isNOU(tempVar)) { | ||
var clo = isNOU(elem) ? tempVar : elem.cloneNode(true); | ||
// eslint-disable-next-line | ||
prob === 'content' ? this.contentTemplate = clo : this.toastTemplate = clo; | ||
@@ -411,3 +433,4 @@ } | ||
templateFn = templateCompiler(value); | ||
templateValue = value; | ||
// eslint-disable-next-line | ||
var templateValue = value; | ||
} | ||
@@ -491,3 +514,3 @@ if (!isNOU(templateFn)) { | ||
}; | ||
Toast.prototype.destroyToast = function (toastEle) { | ||
Toast.prototype.destroyToast = function (toastEle, interactionType) { | ||
var _this = this; | ||
@@ -501,2 +524,9 @@ var toastObj; | ||
} | ||
var toastBeforeClose = { | ||
options: this, | ||
cancel: false, | ||
type: interactionType, | ||
element: toastEle, | ||
toastContainer: this.toastContainer | ||
}; | ||
var hideAnimate = this.animation.hide; | ||
@@ -515,16 +545,20 @@ var animate = { | ||
}; | ||
if (!isNOU(this.progressObj[intervalId]) && !isNOU(toastEle.querySelector('.' + PROGRESS))) { | ||
this.progressObj[intervalId].progressEle.style.width = '0%'; | ||
} | ||
animate.end = function () { | ||
_this.clearProgress(intervalId); | ||
if (!_this.isBlazorServer() || isNOU(toastObj)) { | ||
detach(toastEle); | ||
this.trigger('beforeClose', toastBeforeClose, function (toastBeforeCloseArgs) { | ||
if (!toastBeforeCloseArgs.cancel) { | ||
if (!isNOU(_this.progressObj[intervalId]) && !isNOU(toastEle.querySelector('.' + PROGRESS))) { | ||
_this.progressObj[intervalId].progressEle.style.width = '0%'; | ||
} | ||
animate.end = function () { | ||
_this.clearProgress(intervalId); | ||
if (!_this.isBlazorServer() || isNOU(toastObj)) { | ||
detach(toastEle); | ||
} | ||
_this.trigger('close', toastClose); | ||
if (_this.toastContainer.childElementCount === 0) { | ||
_this.clearContainerPos(); | ||
} | ||
}; | ||
new Animation({}).animate(toastEle, animate); | ||
} | ||
_this.trigger('close', toastClose); | ||
if (_this.toastContainer.childElementCount === 0) { | ||
_this.clearContainerPos(); | ||
} | ||
}; | ||
new Animation({}).animate(toastEle, animate); | ||
}); | ||
}; | ||
@@ -556,2 +590,3 @@ Toast.prototype.personalizeToast = function () { | ||
} | ||
// eslint-disable-next-line | ||
var localeText = { close: 'Close' }; | ||
@@ -568,3 +603,4 @@ this.l10n = new L10n('toast', localeText, this.locale); | ||
this.intervalId[id] = window.setTimeout(this.destroyToast.bind(this, this.toastEle), this.timeOut); | ||
this.progressObj[id] = { hideEta: null, intervalId: null, maxHideTime: null, element: null, timeOutId: null, progressEle: null }; | ||
this.progressObj[id] = { hideEta: null, intervalId: null, maxHideTime: null, | ||
element: null, timeOutId: null, progressEle: null }; | ||
this.progressObj[id].maxHideTime = parseFloat(this.timeOut + ''); | ||
@@ -745,3 +781,3 @@ this.progressObj[id].hideEta = new Date().getTime() + this.progressObj[id].maxHideTime; | ||
if ((isCloseIcon && !toastClickArgs.cancel) || toastClickArgs.clickToClose) { | ||
_this.destroyToast(toastEle); | ||
_this.destroyToast(toastEle, 'click'); | ||
} | ||
@@ -755,3 +791,3 @@ }); | ||
var toastEle = closest(target, '.' + ROOT); | ||
this.destroyToast(toastEle); | ||
this.destroyToast(toastEle, 'key'); | ||
} | ||
@@ -787,4 +823,9 @@ }; | ||
* Called internally if any of the property value changed. | ||
* | ||
* @param {ToastModel} newProp - specifies the new property | ||
* @param {ToastModel} oldProp - specifies the old property | ||
* @returns {void} | ||
* @private | ||
*/ | ||
// eslint-disable-next-line | ||
Toast.prototype.onPropertyChanged = function (newProp, oldProp) { | ||
@@ -796,2 +837,3 @@ var container = this.element; | ||
case 'enableRtl': | ||
// eslint-disable-next-line | ||
newProp.enableRtl ? container.classList.add(RTL) : container.classList.remove(RTL); | ||
@@ -873,2 +915,5 @@ break; | ||
Event() | ||
], Toast.prototype, "beforeClose", void 0); | ||
__decorate([ | ||
Event() | ||
], Toast.prototype, "close", void 0); | ||
@@ -875,0 +920,0 @@ __decorate([ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
834783
15329
+ Added@syncfusion/ej2-base@19.1.64(transitive)
+ Added@syncfusion/ej2-buttons@19.1.63(transitive)
+ Added@syncfusion/ej2-icons@19.1.63(transitive)
+ Added@syncfusion/ej2-popups@19.1.67(transitive)
- Removed@syncfusion/ej2-base@18.4.44(transitive)
- Removed@syncfusion/ej2-buttons@18.4.46(transitive)
- Removed@syncfusion/ej2-icons@18.4.39(transitive)
- Removed@syncfusion/ej2-popups@18.4.44(transitive)