Files
hoperun-custom-sign/src/main/resources/static/coco-message.js

12 lines
11 KiB
JavaScript
Raw Normal View History

2023-01-10 16:52:33 +08:00
function _typeof(f){"@babel/helpers - typeof";_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"===typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g};return _typeof(f)}
!function(f,g){"object"===("undefined"===typeof exports?"undefined":_typeof(exports))&&"undefined"!==typeof module?module.exports=g():"function"===typeof define&&define.amd?define(g):(f=f||self,f.cocoMessage=g())}(void 0,function(){function f(a,b){var c=document.createElement("div");for(e in a){var d=a[e];if("className"==e){var e="class";c.setAttribute(e,d)}else"_"==e[0]&&c.addEventListener(e.slice(1),d)}if("string"==typeof b)c.innerHTML=b;else if("object"==_typeof(b)&&b.tagName)c.appendChild(b);
else if(b)for(a=0;a<b.length;a++)c.appendChild(b[a]);return c}function g(a,b){["a","webkitA"].forEach(function(c){a.addEventListener(c+"nimationEnd",function(){b()})})}function t(a,b){for(var c in b)a.style[c]=b[c];""===a.getAttribute("style")&&a.removeAttribute("style")}function v(a,b){var c=a.className||"";-1<c.indexOf(b)||(c=c.split(/\s+/),c.push(b),a.className=c.join(" "))}function n(a,b){var c={},d;for(d in u)c[d]=u[d];for(d=0;d<a.length;d++){var e=a[d];void 0!==e&&("string"==typeof e||"object"==
_typeof(e)?c.msg=e:"boolean"==typeof e?c.showClose=e:"function"==typeof e?c.onClose=e:"number"==typeof e&&(c.duration=e))}c.type=b;return w(c)}function w(a){var b=a.type,c=a.duration,d=a.msg,e=a.showClose,p=a.onClose,q=0===c;"loading"==b&&(d=""===d?"\u6b63\u5728\u52a0\u8f7d\uff0c\u8bf7\u7a0d\u540e":d,q=e,c=0);a=f({className:"coco-msg-icon"},{info:'\n <svg t="1609810636603" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3250"><path d="M469.333333 341.333333h85.333334v469.333334H469.333333z" fill="#ffffff" p-id="3251"></path><path d="M469.333333 213.333333h85.333334v85.333334H469.333333z" fill="#ffffff" p-id="3252"></path><path d="M384 341.333333h170.666667v85.333334H384z" fill="#ffffff" p-id="3253"></path><path d="M384 725.333333h256v85.333334H384z" fill="#ffffff" p-id="3254"></path></svg>\n ',
success:'\n <svg t="1609781242911" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1807"><path d="M455.42 731.04c-8.85 0-17.75-3.05-24.99-9.27L235.14 553.91c-16.06-13.81-17.89-38.03-4.09-54.09 13.81-16.06 38.03-17.89 54.09-4.09l195.29 167.86c16.06 13.81 17.89 38.03 4.09 54.09-7.58 8.83-18.31 13.36-29.1 13.36z" p-id="1808" fill="#ffffff"></path><path d="M469.89 731.04c-8.51 0-17.07-2.82-24.18-8.6-16.43-13.37-18.92-37.53-5.55-53.96L734.1 307.11c13.37-16.44 37.53-18.92 53.96-5.55 16.43 13.37 18.92 37.53 5.55 53.96L499.67 716.89c-7.58 9.31-18.64 14.15-29.78 14.15z" p-id="1809" fill="#ffffff"></path></svg>\n ',
warning:'\n <svg t="1609776406944" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18912"><path d="M468.114286 621.714286c7.314286 21.942857 21.942857 36.571429 43.885714 36.571428s36.571429-14.628571 43.885714-36.571428L585.142857 219.428571c0-43.885714-36.571429-73.142857-73.142857-73.142857-43.885714 0-73.142857 36.571429-73.142857 80.457143l29.257143 394.971429zM512 731.428571c-43.885714 0-73.142857 29.257143-73.142857 73.142858s29.257143 73.142857 73.142857 73.142857 73.142857-29.257143 73.142857-73.142857-29.257143-73.142857-73.142857-73.142858z" p-id="18913" fill="#ffffff"></path></svg>\n ',
error:'\n <svg t="1609810716933" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5514"><path d="M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z" p-id="5515" fill="#ffffff"></path></svg>\n ',loading:'\n <div class="coco-msg_loading">\n <svg class="coco-msg-circular" viewBox="25 25 50 50">\n <circle class="coco-msg-path" cx="50" cy="50" r="20" fill="none" stroke-width="4" stroke-miterlimit="10"/>\n </svg>\n </div>\n '}[b]);
d=f({className:"coco-msg-content"},d);e={className:"coco-msg-wait "+(q?"coco-msg-pointer":""),_click:function(){q&&l(k,p)}};var k=f({className:"coco-msg-wrapper"},[f({className:"coco-msg coco-msg-fade-in "+b},[a,d,f(e,q?'\n <svg class="coco-msg-close" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5514"><path d="M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z" p-id="5515"></path></svg>\n ':'<svg class="coco-msg-progress" viewBox="0 0 33.83098862 33.83098862" xmlns="http://www.w3.org/2000/svg">\n <circle class="coco-msg__background" cx="16.9" cy="16.9" r="15.9"></circle>\n <circle class="coco-msg__circle" stroke-dasharray="100,100" cx="16.9" cy="16.9" r="15.9"></circle>\n </svg>\n ')])]);
if(d=k.querySelector(".coco-msg__circle"))t(d,{animation:"coco-msg_"+b+" "+c+"ms linear"}),"onanimationend"in window?g(d,function(){l(k,p)}):setTimeout(function(){l(k,p)},c);"loading"==b&&0!==c&&setTimeout(function(){l(k,p)},c);h.children.length||document.body.appendChild(h);h.appendChild(k);t(k,{height:k.offsetHeight+"px"});setTimeout(function(){var r=k.children[0],m=r.className||"";if(-1<m.indexOf("coco-msg-fade-in")){m=m.split(/\s+/);var x=m.indexOf("coco-msg-fade-in");m.splice(x,1);r.className=
m.join(" ")}""===r.className&&r.removeAttribute("class")},300);if("loading"==b)return function(){l(k,p)}}function l(a,b){a&&(t(a,{padding:0,height:0}),v(a.children[0],"coco-msg-fade-out"),b&&b(),setTimeout(function(){if(a){for(var c=!1,d=0;d<h.children.length;d++)h.children[d]===a&&(c=!0);c&&a&&a.parentNode.removeChild(a);a=null;h.children.length||c&&h&&h.parentNode.removeChild(h)}},300))}var h=f({className:"coco-msg-stage"}),u={msg:"",duration:2E3,showClose:!1};window.addEventListener("DOMContentLoaded",
function(){var a=document;if(a&&a.head){var b=a.head;a=a.createElement("style");a.innerHTML="\n\n[class|=coco],[class|=coco]::after,[class|=coco]::before{box-sizing:border-box;outline:0}.coco-msg-progress{width:13px;height:13px}.coco-msg__circle{stroke-width:2;stroke-linecap:square;fill:none;transform:rotate(-90deg);transform-origin:center}.coco-msg-stage:hover .coco-msg__circle{-webkit-animation-play-state:paused!important;animation-play-state:paused!important}.coco-msg__background{stroke-width:2;fill:none}.coco-msg-stage{position:fixed;top:20px;left:50%;width:auto;transform:translate(-50%,0);z-index:3000}.coco-msg-wrapper{position:relative;left:50%;transform:translate(-50%,0);transform:translate3d(-50%,0,0);transition:height .3s ease,padding .3s ease;padding:6px 0;will-change:transform,opacity}.coco-msg{padding:15px 21px;border-radius:3px;position:relative;left:50%;transform:translate(-50%,0);transform:translate3d(-50%,0,0);display:flex;align-items:center}.coco-msg-content,.coco-msg-icon,.coco-msg-wait{display:inline-block}.coco-msg-icon{position:relative;width:13px;height:13px;border-radius:100%;display:flex;justify-content:center;align-items:center}.coco-msg-icon svg{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:11px;height:11px}.coco-msg-wait{width:20px;height:20px;position:relative;fill:#4eb127}.coco-msg-wait svg{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.coco-msg-close{width:14px;height:14px}.coco-msg-content{margin:0 10px;min-width:240px;text-align:left;font-size:14px;font-weight:500;font-family:-apple-system,Microsoft Yahei,sans-serif;text-shadow:0 0 1px rgba(0,0,0,.01)}.coco-msg.info{color:#0fafad;background-color:#e7fdfc;box-shadow:0 0 2px 0 rgba(0,1,1,.01),0 0 0 1px #c0faf9}.coco-msg.info .coco-msg-icon{background-color:#0fafad}.coco-msg.success{color:#4ebb23;background-color:#f3ffe8;box-shadow:0 0 2px 0 rgba(0,1,0,.01),0 0 0 1px #d9f8bb}.coco-msg.success .coco-msg-icon{background-color:#4ebb23}.coco-msg.warning{color:#f1b306;background-color:#fff9eb;box-shadow:0 0 2px 0 rgba(1,1,0,.01),0 0 0 1px #fcf2cd}.coco-msg.warning .coco-msg-icon{background-color:#f1b306}.coco-msg.error{color:#f34b51;background-color:#fff7f7;box-shadow:0 0 2px 0 rgba(1,0,0,.01),0 0 0 1px #ffe3e3}.coco-msg.error .coco-msg-icon{background-color:#f34b51}.coco-msg.loading{color:#0fafad;background-color:#e7fdfc;box-shadow:0 0 2px 0 rgba(0,1,1,.01),0 0 0 1px #c2faf9}.coco-msg_loading{flex-shrink:0;width:20px;height:20px;position:relative}.coco-msg-circular{-webkit-animation:coco-msg-rotate 2s linear infinite both;animation:coco-msg-rotate 2s linear infinite both;transform-origin:center center;height:18px!important;width:18px!important}.coco-msg-path{stroke-dasharray:1,200;stroke-dashoffset:0;stroke:#0fafad;-webkit-animation:coco-msg-dash 1.5s ease-in-out infinite;animation:coco-msg-dash 1.5s ease-in-out infinite;stroke-linecap:round}@-webkit-keyframes coco-msg-rotate{100%{transform:translate(-50%,-50%) rotate(360deg)}}@keyframes coco-msg-rotate{100%{transform:translate(-50%,-50%) rotate(360deg)}}@-webkit-keyframes coco-msg-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes coco-msg-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}.coco-msg.info .coco-msg-wait{fill:#0fafad}.coco-msg.success .coco-msg-wait{fill:#4ebb23}.coco-msg.warning .coco-msg-wait{fill:#f1b306}.coco-msg.error .coco-msg-wait{fill:#f34b51}.coco-msg.loading .coco-msg-wait{fill:#0fafad}.coco-msg-pointer{cursor:pointer}@-webkit-keyframes coco-msg_info{0%{stroke:#0fafad}to{stroke:#0fafad;stroke-dasharray:0 100}}@keyframes coco-msg_info{0%{stroke:#0fafad}to{stroke:#0fafad;stroke-dasharray:0 100}}@-webkit-keyframes coco-msg_success{0%{stroke:#4eb127}to{stroke:#4eb127;stroke-dasharray:0 100}}@keyframes coco-msg_success{0%{stroke:#4eb127}to{stroke:#4eb127;stroke-dasharray:0 100}}@-webkit-keyframes coco-msg
b.children.length?b.insertBefore(a,b.children[0]):b.appendChild(a)}});return{info:function(){n(arguments,"info")},success:function(){n(arguments,"success")},warning:function(){n(arguments,"warning")},error:function(){n(arguments,"error")},loading:function(){return n(arguments,"loading")},destroyAll:function(){for(var a=0;a<h.children.length;a++)l(h.children[a])},config:function(a){for(var b in a)Object.hasOwnProperty.call(a,b)&&void 0!==a[b]&&(u[b]=a[b])}}});