sweetalert2
Advanced tools
Comparing version 4.2.4 to 4.2.5
/*! | ||
* sweetalert2 v4.2.4 | ||
* sweetalert2 v4.2.5 | ||
* Released under the MIT License. | ||
@@ -111,4 +111,4 @@ */ | ||
'<hr class="' + swalClasses.spacer + '">' + | ||
'<button class="' + swalClasses.confirm + '">OK</button>' + | ||
'<button class="' + swalClasses.cancel + '">Cancel</button>' + | ||
'<button type="button" class="' + swalClasses.confirm + '">OK</button>' + | ||
'<button type="button" class="' + swalClasses.cancel + '">Cancel</button>' + | ||
'<span class="' + swalClasses.close + '">×</span>' + | ||
@@ -1090,2 +1090,5 @@ '</div>'; | ||
case 'file': | ||
case 'number': | ||
case 'tel': | ||
case 'range': | ||
input = getChildByClass(modal, swalClasses.input); | ||
@@ -1414,3 +1417,3 @@ input.value = params.inputValue; | ||
sweetAlert.version = '4.2.4'; | ||
sweetAlert.version = '4.2.5'; | ||
@@ -1417,0 +1420,0 @@ window.sweetAlert = window.swal = sweetAlert; |
/*! | ||
* sweetalert2 v4.2.4 | ||
* sweetalert2 v4.2.5 | ||
* Released under the MIT License. | ||
@@ -115,4 +115,4 @@ */ | ||
'<hr class="' + swalClasses.spacer + '">' + | ||
'<button class="' + swalClasses.confirm + '">OK</button>' + | ||
'<button class="' + swalClasses.cancel + '">Cancel</button>' + | ||
'<button type="button" class="' + swalClasses.confirm + '">OK</button>' + | ||
'<button type="button" class="' + swalClasses.cancel + '">Cancel</button>' + | ||
'<span class="' + swalClasses.close + '">×</span>' + | ||
@@ -1094,2 +1094,5 @@ '</div>'; | ||
case 'file': | ||
case 'number': | ||
case 'tel': | ||
case 'range': | ||
input = getChildByClass(modal, swalClasses.input); | ||
@@ -1418,3 +1421,3 @@ input.value = params.inputValue; | ||
sweetAlert.version = '4.2.4'; | ||
sweetAlert.version = '4.2.5'; | ||
@@ -1421,0 +1424,0 @@ window.sweetAlert = window.swal = sweetAlert; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";function e(){if(void 0===arguments[0])return console.error("SweetAlert2 expects at least 1 attribute!"),!1;var e=c({},j);switch(typeof arguments[0]){case"string":e.title=arguments[0],e.text=arguments[1]||"",e.type=arguments[2]||"";break;case"object":c(e,arguments[0]),e.extraParams=arguments[0].extraParams,"email"===e.input&&null===e.inputValidator&&(e.inputValidator=function(e){return new Promise(function(t,n){var o=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;o.test(e)?t():n("Invalid email address")})});break;default:return console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]),!1}K(e);var n=f();return new Promise(function(o,r){function a(t,n){for(var o=b(e.focusCancel),i=0;i<o.length;i++){t+=n,t===o.length?t=0:-1===t&&(t=o.length-1);var r=o[t];if(L(r))return r.focus()}}function l(n){var o=n||window.event,i=o.keyCode||o.which;if(-1!==[9,13,32,27].indexOf(i)){for(var l=o.target||o.srcElement,c=b(e.focusCancel),s=-1,u=0;u<c.length;u++)if(l===c[u]){s=u;break}9===i?(o.shiftKey?a(s,-1):a(s,1),V(o)):13===i||32===i?-1===s&&(e.focusCancel?O(P,o):O(M,o)):27===i&&e.allowEscapeKey===!0&&(t.closeModal(e.onClose),r("esc"))}}e.timer&&(n.timeout=setTimeout(function(){t.closeModal(e.onClose),r("timer")},e.timer));var c=function(){switch(e.input){case"select":return x(n,i.select);case"radio":return n.querySelector("."+i.radio+" input:checked")||n.querySelector("."+i.radio+" input:first-child");case"checkbox":return n.querySelector("#"+i.checkbox);case"textarea":return x(n,i.textarea);default:return x(n,i.input)}},u=function(){var t=c();switch(e.input){case"checkbox":return t.checked?1:0;case"radio":return t.checked?t.value:null;case"file":return t.files.length?t.files[0]:null;default:return e.inputAutoTrim?t.value.trim():t.value}};e.input&&setTimeout(function(){var e=c();e&&w(e)},0);var p,f=function(n){e.showLoaderOnConfirm&&t.showLoading(),e.preConfirm?e.preConfirm(n,e.extraParams).then(function(i){t.closeModal(e.onClose),o(i||n)},function(e){t.hideLoading(),e&&t.showValidationError(e)}):(t.closeModal(e.onClose),o(n))},g=function(n){var o=n||window.event,i=o.target||o.srcElement,a=v(),l=h(),c=a===i||a.contains(i),d=l===i||l.contains(i);switch(o.type){case"mouseover":case"mouseup":e.buttonsStyling&&(c?a.style.backgroundColor=s(e.confirmButtonColor,-.1):d&&(l.style.backgroundColor=s(e.cancelButtonColor,-.1)));break;case"mouseout":e.buttonsStyling&&(c?a.style.backgroundColor=e.confirmButtonColor:d&&(l.style.backgroundColor=e.cancelButtonColor));break;case"mousedown":e.buttonsStyling&&(c?a.style.backgroundColor=s(e.confirmButtonColor,-.2):d&&(l.style.backgroundColor=s(e.cancelButtonColor,-.2)));break;case"click":if(c&&t.isVisible())if(e.input){var p=u();e.inputValidator?(t.disableInput(),e.inputValidator(p,e.extraParams).then(function(){t.enableInput(),f(p)},function(e){t.enableInput(),e&&t.showValidationError(e)})):f(p)}else f(!0);else d&&t.isVisible()&&(t.closeModal(e.onClose),r("cancel"))}},q=n.querySelectorAll("button");for(p=0;p<q.length;p++)q[p].onclick=g,q[p].onmouseover=g,q[p].onmouseout=g,q[p].onmousedown=g;y().onclick=function(){t.closeModal(e.onClose),r("close")},m().onclick=function(){e.allowOutsideClick&&(t.closeModal(e.onClose),r("overlay"))};var M=v(),P=h();e.reverseButtons?M.parentNode.insertBefore(P,M):M.parentNode.insertBefore(M,P),d.previousWindowKeyDown=window.onkeydown,window.onkeydown=l,e.buttonsStyling&&(M.style.borderLeftColor=e.confirmButtonColor,M.style.borderRightColor=e.confirmButtonColor),t.showLoading=t.enableLoading=function(){C(M,"loading"),C(n,"loading"),M.disabled=!0,P.disabled=!0},t.hideLoading=t.disableLoading=function(){k(M,"loading"),k(n,"loading"),M.disabled=!1,P.disabled=!1},t.enableButtons=function(){M.disabled=!1,P.disabled=!1},t.disableButtons=function(){M.disabled=!0,P.disabled=!0},t.enableConfirmButton=function(){M.disabled=!1},t.disableConfirmButton=function(){M.disabled=!0},t.enableInput=function(){var e=c();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!1;else e.disabled=!1},t.disableInput=function(){var e=c();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!0;else e.disabled=!0},t.showValidationError=function(e){var t=n.querySelector("."+i.validationerror);t.innerHTML=e,S(t);var o=c();w(o),C(o,"error")},t.resetValidationError=function(){var e=n.querySelector("."+i.validationerror);B(e);var t=c();t&&k(t,"error")},t.enableButtons(),t.hideLoading(),t.resetValidationError();var T,N=["input","select","radio","checkbox","textarea"];for(p=0;p<N.length;p++){var H=i[N[p]];for(T=x(n,H);T.attributes.length>0;)T.removeAttribute(T.attributes[0].name);for(var D in e.inputAttributes)T.setAttribute(D,e.inputAttributes[D]);T.className=H,e.inputClass&&C(T,e.inputClass),A(T)}var I;switch(e.input){case"text":case"email":case"password":case"file":T=x(n,i.input),T.value=e.inputValue,T.placeholder=e.inputPlaceholder,T.type=e.input,E(T);break;case"select":var j=x(n,i.select);if(j.innerHTML="",e.inputPlaceholder){var K=document.createElement("option");K.innerHTML=e.inputPlaceholder,K.value="",K.disabled=!0,K.selected=!0,j.appendChild(K)}I=function(t){for(var n in t){var o=document.createElement("option");o.value=n,o.innerHTML=t[n],e.inputValue===n&&(o.selected=!0),j.appendChild(o)}E(j),j.focus()};break;case"radio":var z=x(n,i.radio);z.innerHTML="",I=function(t){for(var n in t){var o=1,r=document.createElement("input"),a=document.createElement("label"),l=document.createElement("span");r.type="radio",r.name=i.radio,r.value=n,r.id=i.radio+"-"+o++,e.inputValue===n&&(r.checked=!0),l.innerHTML=t[n],a.appendChild(r),a.appendChild(l),a["for"]=r.id,z.appendChild(a)}E(z);var c=z.querySelectorAll("input");c.length&&c[0].focus()};break;case"checkbox":var R=x(n,i.checkbox),Z=n.querySelector("#"+i.checkbox);Z.value=1,Z.checked=Boolean(e.inputValue);var $=R.getElementsByTagName("span");$.length&&R.removeChild($[0]),$=document.createElement("span"),$.innerHTML=e.inputPlaceholder,R.appendChild($),E(R);break;case"textarea":var F=x(n,i.textarea);F.value=e.inputValue,F.placeholder=e.inputPlaceholder,E(F);break;case null:break;default:console.error('SweetAlert2: Unexpected type of input! Expected "text" or "email" or "password", "select", "checkbox", "textarea" or "file", got "'+e.input+'"')}"select"!==e.input&&"radio"!==e.input||(e.inputOptions instanceof Promise?(t.showLoading(),e.inputOptions.then(function(e){t.hideLoading(),I(e)})):"object"==typeof e.inputOptions?I(e.inputOptions):console.error("SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+typeof e.inputOptions)),W(),U(e.animation,e.onOpen),a(-1,1)})}function t(){var n=arguments,o=f();return null===o&&(t.init(),o=f()),t.isVisible()&&t.close(),e.apply(this,n)}var n="swal2-",o=function(e){var t={};for(var o in e)t[e[o]]=n+e[o];return t},i=o(["container","modal","overlay","close","content","spacer","confirm","cancel","icon","image","input","select","radio","checkbox","textarea","validationerror"]),r=o(["success","warning","info","question","error"]),a={title:"",text:"",html:"",type:null,customClass:"",animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusCancel:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,onOpen:null,onClose:null},l='<div class="'+i.overlay+'" tabIndex="-1"></div><div class="'+i.modal+'" style="display: none" tabIndex="-1"><div class="'+i.icon+" "+r.error+'"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="'+i.icon+" "+r.question+'">?</div><div class="'+i.icon+" "+r.warning+'">!</div><div class="'+i.icon+" "+r.info+'">i</div><div class="'+i.icon+" "+r.success+'"><span class="line tip"></span> <span class="line long"></span><div class="placeholder"></div> <div class="fix"></div></div><img class="'+i.image+'"><h2></h2><div class="'+i.content+'"></div><input class="'+i.input+'"><select class="'+i.select+'"></select><div class="'+i.radio+'"></div><label for="'+i.checkbox+'" class="'+i.checkbox+'"><input type="checkbox" id="'+i.checkbox+'"></label><textarea class="'+i.textarea+'"></textarea><div class="'+i.validationerror+'"></div><hr class="'+i.spacer+'"><button class="'+i.confirm+'">OK</button><button class="'+i.cancel+'">Cancel</button><span class="'+i.close+'">×</span></div>',c=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},s=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;3>o;o++){var i=parseInt(e.substr(2*o,2),16);i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16),n+=("00"+i).substr(i.length)}return n},u=function(e){return"function"==typeof e},d={previousWindowKeyDown:null,previousActiveElement:null},p=function(e){return document.querySelector("."+e)},f=function(){return p(i.modal)},m=function(){return p(i.overlay)},v=function(){return p(i.confirm)},h=function(){return p(i.cancel)},y=function(){return p(i.close)},b=function(e){var t=[v(),h()];return e&&t.reverse(),t.concat(Array.prototype.slice.call(f().querySelectorAll("button:not([class^="+n+"]), input:not([type=hidden]), textarea, select")))},g=function(e,t){return e.classList.contains(t)},w=function(e){e.focus();var t=e.value;e.value="",e.value=t},C=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.add(t)})}},k=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.remove(t)})}},x=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(g(e.childNodes[n],t))return e.childNodes[n]},E=function(e){e.style.opacity="",e.style.display="block"},S=function(e){if(e&&!e.length)return E(e);for(var t=0;t<e.length;++t)E(e[t])},A=function(e){e.style.opacity="",e.style.display="none"},B=function(e){if(e&&!e.length)return A(e);for(var t=0;t<e.length;++t)A(e[t])},L=function(e){return e.offsetWidth||e.offsetHeight||e.getClientRects().length},q=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},M=function(e){var t=e.style.display;e.style.left="-9999px",e.style.display="block";var n=e.clientHeight;return e.style.left="",e.style.display=t,"-"+parseInt(n/2,10)+"px"},P=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var n=+new Date,o=function(){var i=+e.style.opacity+(new Date-n)/100;e.style.opacity=i>1?1:i,n=+new Date,+e.style.opacity<1&&setTimeout(o,t)};o()}},T=function(e,t){if(+e.style.opacity>0){t=t||16;var n=e.style.opacity,o=+new Date,i=function(){var r=new Date-o,a=+e.style.opacity-r/(100*n);e.style.opacity=a,o=+new Date,+e.style.opacity>0?setTimeout(i,t):A(e)};i()}},O=function(e){if("function"==typeof MouseEvent){var t=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});e.dispatchEvent(t)}else if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),e.dispatchEvent(n)}else document.createEventObject?e.fireEvent("onclick"):"function"==typeof e.onclick&&e.onclick()},V=function(e){"function"==typeof e.stopPropagation?(e.stopPropagation(),e.preventDefault()):window.event&&window.event.hasOwnProperty("cancelBubble")&&(window.event.cancelBubble=!0)},N=function(){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),H=function(){var e=f();window.onkeydown=d.previousWindowKeyDown,d.previousActiveElement&&d.previousActiveElement.focus&&d.previousActiveElement.focus(),clearTimeout(e.timeout)},D=function(e){var t=n+"mediaquery-"+Math.random().toString(36).substring(2,7),o=document.getElementsByTagName("head")[0],i=document.createElement("style");return i.type="text/css",i.id=t,i.innerHTML=e,o.appendChild(i),t},I=function(e){if(!e)return!1;var t=document.getElementsByTagName("head")[0],n=document.getElementById(e);n&&t.removeChild(n)},j=c({},a),K=function(e){var t=f();for(var n in e)a.hasOwnProperty(n)||"extraParams"===n||console.warn('SweetAlert2: Unknown parameter "'+n+'"');e.width=e.width.toString();var o,l=e.width.match(/^(\d+)(px|%)?$/);if(l?(o="px",l[2]&&(o=l[2]),l=parseInt(l[1],10),t.style.width=l+o,t.style.marginLeft=-l/2+o):console.warn('SweetAlert2: Invalid width parameter, usage examples: "400px", "50%", or just 500 which equals to "500px"'),t.style.padding=e.padding+"px",t.style.background=e.background,"px"===o){var c=5,s=l+l*(c/100)*2,u=D("@media screen and (max-width: "+s+"px) {."+i.modal+" {width: auto !important;left: "+c+"% !important;right: "+c+"% !important;margin-left: 0 !important;}}");t.setAttribute("data-mediaquery-id",u)}var d=t.querySelector("h2"),p=t.querySelector("."+i.content),m=v(),y=h(),b=t.querySelector("."+i.spacer),g=t.querySelector("."+i.close);if(d.innerHTML=e.title.split("\n").join("<br>"),e.text||e.html){if("object"==typeof e.html)if(p.innerHTML="",0 in e.html)for(var w=0;w in e.html;w++)p.appendChild(e.html[w]);else p.appendChild(e.html);else p.innerHTML=e.html||e.text.split("\n").join("<br>");S(p)}else B(p);if(e.showCloseButton?S(g):B(g),t.className=i.modal,e.customClass&&C(t,e.customClass),B(t.querySelectorAll("."+i.icon)),e.type){var x=!1;for(var E in r)if(e.type===E){x=!0;break}if(!x)return console.error("SweetAlert2: Unknown alert type: "+e.type),!1;var A=t.querySelector("."+i.icon+"."+r[e.type]);switch(S(A),e.type){case"success":C(A,"animate"),C(A.querySelector(".tip"),"animate-success-tip"),C(A.querySelector(".long"),"animate-success-long");break;case"error":C(A,"animate-error-icon"),C(A.querySelector(".x-mark"),"animate-x-mark");break;case"warning":C(A,"pulse-warning")}}var L=t.querySelector("."+i.image);e.imageUrl?(L.setAttribute("src",e.imageUrl),S(L),e.imageWidth?L.setAttribute("width",e.imageWidth):L.removeAttribute("width"),e.imageHeight?L.setAttribute("height",e.imageHeight):L.removeAttribute("height"),L.className=i.image,e.imageClass&&C(L,e.imageClass)):B(L),e.showCancelButton?y.style.display="inline-block":B(y),e.showConfirmButton?q(m,"display"):B(m),e.showConfirmButton||e.showCancelButton?S(b):B(b),m.innerHTML=e.confirmButtonText,y.innerHTML=e.cancelButtonText,e.buttonsStyling&&(m.style.backgroundColor=e.confirmButtonColor,y.style.backgroundColor=e.cancelButtonColor),m.className=i.confirm,C(m,e.confirmButtonClass),y.className=i.cancel,C(y,e.cancelButtonClass),e.buttonsStyling?(C(m,"styled"),C(y,"styled")):(k(m,"styled"),k(y,"styled"),m.style.backgroundColor=m.style.borderLeftColor=m.style.borderRightColor="",y.style.backgroundColor=y.style.borderLeftColor=y.style.borderRightColor=""),e.animation===!0?k(t,"no-animation"):C(t,"no-animation")},U=function(e,t){var n=f();e?(P(m(),10),C(n,"show-swal2"),k(n,"hide-swal2")):S(m()),S(n),d.previousActiveElement=document.activeElement,null!==t&&"function"==typeof t&&t.call(this,n)},W=function(){var e=f();null!==e&&(e.style.marginTop=M(e))};return t.isVisible=function(){var e=f();return L(e)},t.queue=function(e,n){var o;return n&&(o={fork:function(e){n=e,this.next=e[0]},repeatCurrent:function(){n.unshift(this.current),this.next=this.current},insert:function(e){n.unshift(e),this.next=this.state},terminate:function(){n=[],this.next=""}}),new Promise(function(i,r){!function a(l,c){var s=null;u(e)?n&&n.length>0?(o.current=n[0],o.next=n.length>1?n[1]:"",o.alertNumber=l,n.shift(),s=e(o)):s=e(l):l<e.length&&(s=e[l]),s?t(s).then(function(){a(l+1,c)},function(e){r(e)}):i()}(0)})},t.close=t.closeModal=function(e){var t=f();k(t,"show-swal2"),C(t,"hide-swal2");var n=t.querySelector("."+i.icon+"."+r.success);k(n,"animate"),k(n.querySelector(".tip"),"animate-success-tip"),k(n.querySelector(".long"),"animate-success-long");var o=t.querySelector("."+i.icon+"."+r.error);k(o,"animate-error-icon"),k(o.querySelector(".x-mark"),"animate-x-mark");var a=t.querySelector("."+i.icon+"."+r.warning);k(a,"pulse-warning"),H();var l=t.getAttribute("data-mediaquery-id");N&&!g(t,"no-animation")?t.addEventListener(N,function c(){t.removeEventListener(N,c),g(t,"hide-swal2")&&(A(t),T(m(),0)),I(l)}):(A(t),A(m()),I(l)),null!==e&&"function"==typeof e&&e.call(this,t)},t.clickConfirm=function(){v().click()},t.clickCancel=function(){h().click()},t.init=function(){if("undefined"==typeof document)return void console.log("SweetAlert2 requires document to initialize");if(!document.getElementsByClassName(i.container).length){var e=document.createElement("div");e.className=i.container,e.innerHTML=l,document.body.appendChild(e);var n=f(),o=x(n,i.input),r=x(n,i.select),a=n.querySelector("#"+i.checkbox),c=x(n,i.textarea),s=x(n,i.image);o.oninput=function(){t.resetValidationError()},o.onkeyup=function(e){e.stopPropagation(),13===e.keyCode&&t.clickConfirm()},r.onchange=function(){t.resetValidationError()},a.onchange=function(){t.resetValidationError()},c.oninput=function(){t.resetValidationError()},s.onload=s.onerror=W,window.addEventListener("resize",W,!1)}},t.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");c(j,e)},t.resetDefaults=function(){j=c({},a)},t.version="4.2.4",window.sweetAlert=window.swal=t,function(){"complete"===document.readyState||"interactive"===document.readyState&&document.body?t.init():document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e,!1),t.init()},!1)}(),"function"==typeof Promise?Promise.prototype.done=Promise.prototype.done||function(){return this["catch"](function(){})}:console.warn("SweetAlert2: Please inlude Promise polyfill BEFORE including sweetalert2.js if IE10+ support needed."),t}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";function e(){if(void 0===arguments[0])return console.error("SweetAlert2 expects at least 1 attribute!"),!1;var e=c({},j);switch(typeof arguments[0]){case"string":e.title=arguments[0],e.text=arguments[1]||"",e.type=arguments[2]||"";break;case"object":c(e,arguments[0]),e.extraParams=arguments[0].extraParams,"email"===e.input&&null===e.inputValidator&&(e.inputValidator=function(e){return new Promise(function(t,n){var o=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;o.test(e)?t():n("Invalid email address")})});break;default:return console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]),!1}K(e);var n=f();return new Promise(function(o,r){function a(t,n){for(var o=b(e.focusCancel),i=0;i<o.length;i++){t+=n,t===o.length?t=0:-1===t&&(t=o.length-1);var r=o[t];if(L(r))return r.focus()}}function l(n){var o=n||window.event,i=o.keyCode||o.which;if(-1!==[9,13,32,27].indexOf(i)){for(var l=o.target||o.srcElement,c=b(e.focusCancel),s=-1,u=0;u<c.length;u++)if(l===c[u]){s=u;break}9===i?(o.shiftKey?a(s,-1):a(s,1),V(o)):13===i||32===i?-1===s&&(e.focusCancel?O(P,o):O(M,o)):27===i&&e.allowEscapeKey===!0&&(t.closeModal(e.onClose),r("esc"))}}e.timer&&(n.timeout=setTimeout(function(){t.closeModal(e.onClose),r("timer")},e.timer));var c=function(){switch(e.input){case"select":return x(n,i.select);case"radio":return n.querySelector("."+i.radio+" input:checked")||n.querySelector("."+i.radio+" input:first-child");case"checkbox":return n.querySelector("#"+i.checkbox);case"textarea":return x(n,i.textarea);default:return x(n,i.input)}},u=function(){var t=c();switch(e.input){case"checkbox":return t.checked?1:0;case"radio":return t.checked?t.value:null;case"file":return t.files.length?t.files[0]:null;default:return e.inputAutoTrim?t.value.trim():t.value}};e.input&&setTimeout(function(){var e=c();e&&w(e)},0);var p,f=function(n){e.showLoaderOnConfirm&&t.showLoading(),e.preConfirm?e.preConfirm(n,e.extraParams).then(function(i){t.closeModal(e.onClose),o(i||n)},function(e){t.hideLoading(),e&&t.showValidationError(e)}):(t.closeModal(e.onClose),o(n))},g=function(n){var o=n||window.event,i=o.target||o.srcElement,a=v(),l=y(),c=a===i||a.contains(i),d=l===i||l.contains(i);switch(o.type){case"mouseover":case"mouseup":e.buttonsStyling&&(c?a.style.backgroundColor=s(e.confirmButtonColor,-.1):d&&(l.style.backgroundColor=s(e.cancelButtonColor,-.1)));break;case"mouseout":e.buttonsStyling&&(c?a.style.backgroundColor=e.confirmButtonColor:d&&(l.style.backgroundColor=e.cancelButtonColor));break;case"mousedown":e.buttonsStyling&&(c?a.style.backgroundColor=s(e.confirmButtonColor,-.2):d&&(l.style.backgroundColor=s(e.cancelButtonColor,-.2)));break;case"click":if(c&&t.isVisible())if(e.input){var p=u();e.inputValidator?(t.disableInput(),e.inputValidator(p,e.extraParams).then(function(){t.enableInput(),f(p)},function(e){t.enableInput(),e&&t.showValidationError(e)})):f(p)}else f(!0);else d&&t.isVisible()&&(t.closeModal(e.onClose),r("cancel"))}},q=n.querySelectorAll("button");for(p=0;p<q.length;p++)q[p].onclick=g,q[p].onmouseover=g,q[p].onmouseout=g,q[p].onmousedown=g;h().onclick=function(){t.closeModal(e.onClose),r("close")},m().onclick=function(){e.allowOutsideClick&&(t.closeModal(e.onClose),r("overlay"))};var M=v(),P=y();e.reverseButtons?M.parentNode.insertBefore(P,M):M.parentNode.insertBefore(M,P),d.previousWindowKeyDown=window.onkeydown,window.onkeydown=l,e.buttonsStyling&&(M.style.borderLeftColor=e.confirmButtonColor,M.style.borderRightColor=e.confirmButtonColor),t.showLoading=t.enableLoading=function(){C(M,"loading"),C(n,"loading"),M.disabled=!0,P.disabled=!0},t.hideLoading=t.disableLoading=function(){k(M,"loading"),k(n,"loading"),M.disabled=!1,P.disabled=!1},t.enableButtons=function(){M.disabled=!1,P.disabled=!1},t.disableButtons=function(){M.disabled=!0,P.disabled=!0},t.enableConfirmButton=function(){M.disabled=!1},t.disableConfirmButton=function(){M.disabled=!0},t.enableInput=function(){var e=c();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!1;else e.disabled=!1},t.disableInput=function(){var e=c();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!0;else e.disabled=!0},t.showValidationError=function(e){var t=n.querySelector("."+i.validationerror);t.innerHTML=e,S(t);var o=c();w(o),C(o,"error")},t.resetValidationError=function(){var e=n.querySelector("."+i.validationerror);B(e);var t=c();t&&k(t,"error")},t.enableButtons(),t.hideLoading(),t.resetValidationError();var T,N=["input","select","radio","checkbox","textarea"];for(p=0;p<N.length;p++){var H=i[N[p]];for(T=x(n,H);T.attributes.length>0;)T.removeAttribute(T.attributes[0].name);for(var D in e.inputAttributes)T.setAttribute(D,e.inputAttributes[D]);T.className=H,e.inputClass&&C(T,e.inputClass),A(T)}var I;switch(e.input){case"text":case"email":case"password":case"file":case"number":case"tel":case"range":T=x(n,i.input),T.value=e.inputValue,T.placeholder=e.inputPlaceholder,T.type=e.input,E(T);break;case"select":var j=x(n,i.select);if(j.innerHTML="",e.inputPlaceholder){var K=document.createElement("option");K.innerHTML=e.inputPlaceholder,K.value="",K.disabled=!0,K.selected=!0,j.appendChild(K)}I=function(t){for(var n in t){var o=document.createElement("option");o.value=n,o.innerHTML=t[n],e.inputValue===n&&(o.selected=!0),j.appendChild(o)}E(j),j.focus()};break;case"radio":var z=x(n,i.radio);z.innerHTML="",I=function(t){for(var n in t){var o=1,r=document.createElement("input"),a=document.createElement("label"),l=document.createElement("span");r.type="radio",r.name=i.radio,r.value=n,r.id=i.radio+"-"+o++,e.inputValue===n&&(r.checked=!0),l.innerHTML=t[n],a.appendChild(r),a.appendChild(l),a["for"]=r.id,z.appendChild(a)}E(z);var c=z.querySelectorAll("input");c.length&&c[0].focus()};break;case"checkbox":var R=x(n,i.checkbox),Z=n.querySelector("#"+i.checkbox);Z.value=1,Z.checked=Boolean(e.inputValue);var $=R.getElementsByTagName("span");$.length&&R.removeChild($[0]),$=document.createElement("span"),$.innerHTML=e.inputPlaceholder,R.appendChild($),E(R);break;case"textarea":var F=x(n,i.textarea);F.value=e.inputValue,F.placeholder=e.inputPlaceholder,E(F);break;case null:break;default:console.error('SweetAlert2: Unexpected type of input! Expected "text" or "email" or "password", "select", "checkbox", "textarea" or "file", got "'+e.input+'"')}"select"!==e.input&&"radio"!==e.input||(e.inputOptions instanceof Promise?(t.showLoading(),e.inputOptions.then(function(e){t.hideLoading(),I(e)})):"object"==typeof e.inputOptions?I(e.inputOptions):console.error("SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+typeof e.inputOptions)),W(),U(e.animation,e.onOpen),a(-1,1)})}function t(){var n=arguments,o=f();return null===o&&(t.init(),o=f()),t.isVisible()&&t.close(),e.apply(this,n)}var n="swal2-",o=function(e){var t={};for(var o in e)t[e[o]]=n+e[o];return t},i=o(["container","modal","overlay","close","content","spacer","confirm","cancel","icon","image","input","select","radio","checkbox","textarea","validationerror"]),r=o(["success","warning","info","question","error"]),a={title:"",text:"",html:"",type:null,customClass:"",animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusCancel:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,onOpen:null,onClose:null},l='<div class="'+i.overlay+'" tabIndex="-1"></div><div class="'+i.modal+'" style="display: none" tabIndex="-1"><div class="'+i.icon+" "+r.error+'"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="'+i.icon+" "+r.question+'">?</div><div class="'+i.icon+" "+r.warning+'">!</div><div class="'+i.icon+" "+r.info+'">i</div><div class="'+i.icon+" "+r.success+'"><span class="line tip"></span> <span class="line long"></span><div class="placeholder"></div> <div class="fix"></div></div><img class="'+i.image+'"><h2></h2><div class="'+i.content+'"></div><input class="'+i.input+'"><select class="'+i.select+'"></select><div class="'+i.radio+'"></div><label for="'+i.checkbox+'" class="'+i.checkbox+'"><input type="checkbox" id="'+i.checkbox+'"></label><textarea class="'+i.textarea+'"></textarea><div class="'+i.validationerror+'"></div><hr class="'+i.spacer+'"><button type="button" class="'+i.confirm+'">OK</button><button type="button" class="'+i.cancel+'">Cancel</button><span class="'+i.close+'">×</span></div>',c=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},s=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;3>o;o++){var i=parseInt(e.substr(2*o,2),16);i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16),n+=("00"+i).substr(i.length)}return n},u=function(e){return"function"==typeof e},d={previousWindowKeyDown:null,previousActiveElement:null},p=function(e){return document.querySelector("."+e)},f=function(){return p(i.modal)},m=function(){return p(i.overlay)},v=function(){return p(i.confirm)},y=function(){return p(i.cancel)},h=function(){return p(i.close)},b=function(e){var t=[v(),y()];return e&&t.reverse(),t.concat(Array.prototype.slice.call(f().querySelectorAll("button:not([class^="+n+"]), input:not([type=hidden]), textarea, select")))},g=function(e,t){return e.classList.contains(t)},w=function(e){e.focus();var t=e.value;e.value="",e.value=t},C=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.add(t)})}},k=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.remove(t)})}},x=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(g(e.childNodes[n],t))return e.childNodes[n]},E=function(e){e.style.opacity="",e.style.display="block"},S=function(e){if(e&&!e.length)return E(e);for(var t=0;t<e.length;++t)E(e[t])},A=function(e){e.style.opacity="",e.style.display="none"},B=function(e){if(e&&!e.length)return A(e);for(var t=0;t<e.length;++t)A(e[t])},L=function(e){return e.offsetWidth||e.offsetHeight||e.getClientRects().length},q=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},M=function(e){var t=e.style.display;e.style.left="-9999px",e.style.display="block";var n=e.clientHeight;return e.style.left="",e.style.display=t,"-"+parseInt(n/2,10)+"px"},P=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var n=+new Date,o=function(){var i=+e.style.opacity+(new Date-n)/100;e.style.opacity=i>1?1:i,n=+new Date,+e.style.opacity<1&&setTimeout(o,t)};o()}},T=function(e,t){if(+e.style.opacity>0){t=t||16;var n=e.style.opacity,o=+new Date,i=function(){var r=new Date-o,a=+e.style.opacity-r/(100*n);e.style.opacity=a,o=+new Date,+e.style.opacity>0?setTimeout(i,t):A(e)};i()}},O=function(e){if("function"==typeof MouseEvent){var t=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});e.dispatchEvent(t)}else if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),e.dispatchEvent(n)}else document.createEventObject?e.fireEvent("onclick"):"function"==typeof e.onclick&&e.onclick()},V=function(e){"function"==typeof e.stopPropagation?(e.stopPropagation(),e.preventDefault()):window.event&&window.event.hasOwnProperty("cancelBubble")&&(window.event.cancelBubble=!0)},N=function(){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),H=function(){var e=f();window.onkeydown=d.previousWindowKeyDown,d.previousActiveElement&&d.previousActiveElement.focus&&d.previousActiveElement.focus(),clearTimeout(e.timeout)},D=function(e){var t=n+"mediaquery-"+Math.random().toString(36).substring(2,7),o=document.getElementsByTagName("head")[0],i=document.createElement("style");return i.type="text/css",i.id=t,i.innerHTML=e,o.appendChild(i),t},I=function(e){if(!e)return!1;var t=document.getElementsByTagName("head")[0],n=document.getElementById(e);n&&t.removeChild(n)},j=c({},a),K=function(e){var t=f();for(var n in e)a.hasOwnProperty(n)||"extraParams"===n||console.warn('SweetAlert2: Unknown parameter "'+n+'"');e.width=e.width.toString();var o,l=e.width.match(/^(\d+)(px|%)?$/);if(l?(o="px",l[2]&&(o=l[2]),l=parseInt(l[1],10),t.style.width=l+o,t.style.marginLeft=-l/2+o):console.warn('SweetAlert2: Invalid width parameter, usage examples: "400px", "50%", or just 500 which equals to "500px"'),t.style.padding=e.padding+"px",t.style.background=e.background,"px"===o){var c=5,s=l+l*(c/100)*2,u=D("@media screen and (max-width: "+s+"px) {."+i.modal+" {width: auto !important;left: "+c+"% !important;right: "+c+"% !important;margin-left: 0 !important;}}");t.setAttribute("data-mediaquery-id",u)}var d=t.querySelector("h2"),p=t.querySelector("."+i.content),m=v(),h=y(),b=t.querySelector("."+i.spacer),g=t.querySelector("."+i.close);if(d.innerHTML=e.title.split("\n").join("<br>"),e.text||e.html){if("object"==typeof e.html)if(p.innerHTML="",0 in e.html)for(var w=0;w in e.html;w++)p.appendChild(e.html[w]);else p.appendChild(e.html);else p.innerHTML=e.html||e.text.split("\n").join("<br>");S(p)}else B(p);if(e.showCloseButton?S(g):B(g),t.className=i.modal,e.customClass&&C(t,e.customClass),B(t.querySelectorAll("."+i.icon)),e.type){var x=!1;for(var E in r)if(e.type===E){x=!0;break}if(!x)return console.error("SweetAlert2: Unknown alert type: "+e.type),!1;var A=t.querySelector("."+i.icon+"."+r[e.type]);switch(S(A),e.type){case"success":C(A,"animate"),C(A.querySelector(".tip"),"animate-success-tip"),C(A.querySelector(".long"),"animate-success-long");break;case"error":C(A,"animate-error-icon"),C(A.querySelector(".x-mark"),"animate-x-mark");break;case"warning":C(A,"pulse-warning")}}var L=t.querySelector("."+i.image);e.imageUrl?(L.setAttribute("src",e.imageUrl),S(L),e.imageWidth?L.setAttribute("width",e.imageWidth):L.removeAttribute("width"),e.imageHeight?L.setAttribute("height",e.imageHeight):L.removeAttribute("height"),L.className=i.image,e.imageClass&&C(L,e.imageClass)):B(L),e.showCancelButton?h.style.display="inline-block":B(h),e.showConfirmButton?q(m,"display"):B(m),e.showConfirmButton||e.showCancelButton?S(b):B(b),m.innerHTML=e.confirmButtonText,h.innerHTML=e.cancelButtonText,e.buttonsStyling&&(m.style.backgroundColor=e.confirmButtonColor,h.style.backgroundColor=e.cancelButtonColor),m.className=i.confirm,C(m,e.confirmButtonClass),h.className=i.cancel,C(h,e.cancelButtonClass),e.buttonsStyling?(C(m,"styled"),C(h,"styled")):(k(m,"styled"),k(h,"styled"),m.style.backgroundColor=m.style.borderLeftColor=m.style.borderRightColor="",h.style.backgroundColor=h.style.borderLeftColor=h.style.borderRightColor=""),e.animation===!0?k(t,"no-animation"):C(t,"no-animation")},U=function(e,t){var n=f();e?(P(m(),10),C(n,"show-swal2"),k(n,"hide-swal2")):S(m()),S(n),d.previousActiveElement=document.activeElement,null!==t&&"function"==typeof t&&t.call(this,n)},W=function(){var e=f();null!==e&&(e.style.marginTop=M(e))};return t.isVisible=function(){var e=f();return L(e)},t.queue=function(e,n){var o;return n&&(o={fork:function(e){n=e,this.next=e[0]},repeatCurrent:function(){n.unshift(this.current),this.next=this.current},insert:function(e){n.unshift(e),this.next=this.state},terminate:function(){n=[],this.next=""}}),new Promise(function(i,r){!function a(l,c){var s=null;u(e)?n&&n.length>0?(o.current=n[0],o.next=n.length>1?n[1]:"",o.alertNumber=l,n.shift(),s=e(o)):s=e(l):l<e.length&&(s=e[l]),s?t(s).then(function(){a(l+1,c)},function(e){r(e)}):i()}(0)})},t.close=t.closeModal=function(e){var t=f();k(t,"show-swal2"),C(t,"hide-swal2");var n=t.querySelector("."+i.icon+"."+r.success);k(n,"animate"),k(n.querySelector(".tip"),"animate-success-tip"),k(n.querySelector(".long"),"animate-success-long");var o=t.querySelector("."+i.icon+"."+r.error);k(o,"animate-error-icon"),k(o.querySelector(".x-mark"),"animate-x-mark");var a=t.querySelector("."+i.icon+"."+r.warning);k(a,"pulse-warning"),H();var l=t.getAttribute("data-mediaquery-id");N&&!g(t,"no-animation")?t.addEventListener(N,function c(){t.removeEventListener(N,c),g(t,"hide-swal2")&&(A(t),T(m(),0)),I(l)}):(A(t),A(m()),I(l)),null!==e&&"function"==typeof e&&e.call(this,t)},t.clickConfirm=function(){v().click()},t.clickCancel=function(){y().click()},t.init=function(){if("undefined"==typeof document)return void console.log("SweetAlert2 requires document to initialize");if(!document.getElementsByClassName(i.container).length){var e=document.createElement("div");e.className=i.container,e.innerHTML=l,document.body.appendChild(e);var n=f(),o=x(n,i.input),r=x(n,i.select),a=n.querySelector("#"+i.checkbox),c=x(n,i.textarea),s=x(n,i.image);o.oninput=function(){t.resetValidationError()},o.onkeyup=function(e){e.stopPropagation(),13===e.keyCode&&t.clickConfirm()},r.onchange=function(){t.resetValidationError()},a.onchange=function(){t.resetValidationError()},c.oninput=function(){t.resetValidationError()},s.onload=s.onerror=W,window.addEventListener("resize",W,!1)}},t.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");c(j,e)},t.resetDefaults=function(){j=c({},a)},t.version="4.2.5",window.sweetAlert=window.swal=t,function(){"complete"===document.readyState||"interactive"===document.readyState&&document.body?t.init():document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e,!1),t.init()},!1)}(),"function"==typeof Promise?Promise.prototype.done=Promise.prototype.done||function(){return this["catch"](function(){})}:console.warn("SweetAlert2: Please inlude Promise polyfill BEFORE including sweetalert2.js if IE10+ support needed."),t}); |
{ | ||
"name": "sweetalert2", | ||
"version": "4.2.4", | ||
"version": "4.2.5", | ||
"repository": "https://github.com/limonte/sweetalert2.git", | ||
@@ -5,0 +5,0 @@ "homepage": "https://limonte.github.io/sweetalert2/", |
@@ -35,3 +35,5 @@ SweetAlert2 [![Build Status](https://travis-ci.org/limonte/sweetalert2.svg?branch=master)](https://travis-ci.org/limonte/sweetalert2) | ||
Or download from CDN: [https://www.jsdelivr.com/projects/sweetalert2](https://www.jsdelivr.com/projects/sweetalert2) | ||
Or download from CDN: | ||
- [https://www.jsdelivr.com/projects/sweetalert2](https://www.jsdelivr.com/projects/sweetalert2) | ||
- [https://cdnjs.com/libraries/limonte-sweetalert2](https://cdnjs.com/libraries/limonte-sweetalert2) | ||
@@ -130,3 +132,3 @@ To use: | ||
| `type ` | `null` | The type of the modal. SweetAlert2 comes with [5 built-in types](#modal-types) which will show a corresponding icon animation: `warning`, `error`, `success`, `info` and `question`. It can either be put in the array under the key `type` or passed as the third parameter of the function. | | ||
| `input` | `null` | Input field type, can be `"text"`, `"email"`, `"password"`, `"textarea"`, `"select"`, `"radio"`, `"checkbox"` and `"file"`. | | ||
| `input` | `null` | Input field type, can be `"text"`, `"email"`, `"password"`, `"number"`, `"tel"`, `"range"`, `"textarea"`, `"select"`, `"radio"`, `"checkbox"` and `"file"`. | | ||
| `width` | `"500px"` | Modal window width, including paddings (`box-sizing: border-box`). Can be in `px` or `%`. | | ||
@@ -178,3 +180,3 @@ | `padding` | `20` | Modal window padding. | | ||
| `swal.queue([Array] || Function, [Array])` | Provide array of SweetAlert2 parameters to show multiple modals, one modal after another or a function that returns alert parameters given modal number. See [usage example](https://limonte.github.io/sweetalert2/#chaining-modals). | | ||
| `swal.queue(Function, [Array])` | Provide an function that performs state machine like direction of modal flow and an array of default states to follow. The function will recieve an object indicating current and next state along with helper methods (`insert(string)`, `fork([string])`, `repeatCurrent()`, `terminate()`) to augment the flow of modals. See [usage example]((https://limonte.github.io/sweetalert2/#state-machine). | | ||
| `swal.queue(Function, [Array])` | Provide an function that performs state machine like direction of modal flow and an array of default states to follow. The function will recieve an object indicating current and next state along with helper methods (`insert(string)`, `fork([string])`, `repeatCurrent()`, `terminate()`) to augment the flow of modals. See [usage example](https://limonte.github.io/sweetalert2/#state-machine). | | ||
| `swal.close()` or `swal.closeModal()` | Close the currently open SweetAlert2 modal programmatically. | | ||
@@ -181,0 +183,0 @@ | `swal.enableButtons()` | Enable "Confirm" and "Cancel" buttons. | |
@@ -678,2 +678,5 @@ 'use strict'; | ||
case 'file': | ||
case 'number': | ||
case 'tel': | ||
case 'range': | ||
input = dom.getChildByClass(modal, swalClasses.input); | ||
@@ -680,0 +683,0 @@ input.value = params.inputValue; |
@@ -70,5 +70,5 @@ import { swalClasses, iconTypes } from './classes.js'; | ||
'<hr class="' + swalClasses.spacer + '">' + | ||
'<button class="' + swalClasses.confirm + '">OK</button>' + | ||
'<button class="' + swalClasses.cancel + '">Cancel</button>' + | ||
'<button type="button" class="' + swalClasses.confirm + '">OK</button>' + | ||
'<button type="button" class="' + swalClasses.cancel + '">Cancel</button>' + | ||
'<span class="' + swalClasses.close + '">×</span>' + | ||
'</div>'; |
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
207390
4402
223