UNPKG

element-gui

Version:

A Component Library for Vue.js.

1 lines 5.83 kB
module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(s,o,function(t){return e[t]}.bind(null,o));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=87)}({0:function(e,t,n){"use strict";function s(e,t,n,s,o,i,r,l){var a,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),s&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),r?(a=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},c._ssrRegister=a):o&&(a=l?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),a)if(c.functional){c._injectStyles=a;var u=c.render;c.render=function(e,t){return a.call(t),u(e,t)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,a):[a]}return{exports:e,options:c}}n.d(t,"a",(function(){return s}))},16:function(e,t){e.exports=require("element-gui/lib/utils/types")},17:function(e,t){e.exports=require("element-gui/lib/utils/popup")},27:function(e,t){e.exports=require("element-gui/lib/utils/vdom")},8:function(e,t){e.exports=require("vue")},87:function(e,t,n){"use strict";n.r(t);var s=n(8),o=n.n(s),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("transition",{attrs:{name:"el-message-fade"},on:{"after-leave":e.handleAfterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],class:["el-message",e.type&&!e.iconClass?"el-message--"+e.type:"",e.center?"is-center":"",e.showClose?"is-closable":"",e.plain?"is-plain":"",e.customClass],style:e.style,attrs:{role:"alert"},on:{mouseenter:e.clearTimer,mouseleave:e.startTimer}},[e.iconClass?n("i",{class:e.iconClass}):n("i",{class:e.typeClass}),e._t("default",[e.dangerouslyUseHTMLString?n("p",{staticClass:"el-message__content",domProps:{innerHTML:e._s(e.message)}}):n("p",{staticClass:"el-message__content"},[e._v(e._s(e.message))])]),e.showClose?n("i",{staticClass:"el-message__closeBtn el-icon-close",on:{click:e.close}}):e._e()],2)])};i._withStripped=!0;var r={primary:"info is-primary",success:"success",info:"info",warning:"warning",error:"error"},l={data:function(){return{visible:!1,message:"",duration:(this.$ELEMENT||{}).duration||3e3,type:"primary",iconClass:"",customClass:"",onClose:null,showClose:!1,closed:!1,verticalOffset:20,maxWidth:"",minWidth:"",timer:null,dangerouslyUseHTMLString:!1,center:!1,plain:!1}},computed:{typeClass:function(){return this.type&&!this.iconClass?"el-message__icon el-icon-"+r[this.type]:""},style:function(){var e={};return e.top=this.verticalOffset+"px",this.maxWidth&&(e.maxWidth=this.maxWidth),this.minWidth&&(e.minWidth=this.minWidth),e}},watch:{closed:function(e){e&&(this.visible=!1)}},methods:{handleAfterLeave:function(){this.$destroy(!0),this.$el.parentNode.removeChild(this.$el)},close:function(){this.closed=!0,"function"==typeof this.onClose&&this.onClose(this)},clearTimer:function(){clearTimeout(this.timer)},startTimer:function(){var e=this;this.duration>0&&(this.timer=setTimeout((function(){e.closed||e.close()}),this.duration))},keydown:function(e){27===e.keyCode&&(this.closed||this.close())}},mounted:function(){this.startTimer(),document.addEventListener("keydown",this.keydown)},beforeDestroy:function(){document.removeEventListener("keydown",this.keydown)}},a=n(0),c=Object(a.a)(l,i,[],!1,null,null,null).exports,u=n(17),f=n(27),d=n(16),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},m=o.a.extend(c),h=void 0,v=[],y=1,g=function e(t){o.a.prototype.$isServer||setTimeout((function(){"string"==typeof(t=t||{})&&(t={message:t});var n=t.onClose,s="message_"+y++;t.single&&(v.forEach((function(e){e.handleAfterLeave()})),e.closeAll()),t.onClose=function(){e.close(s,n)},(h=new m({data:t})).id=s,Object(f.isVNode)(h.message)&&(h.$slots.default=[h.message],h.message=null),h.$mount();var i=o.a.prototype.$ELEMENT&&o.a.prototype.$ELEMENT.content&&document.getElementById(o.a.prototype.$ELEMENT.content)||document.body;(document.fullscreenElement||window.fullScreen)&&document.fullscreenElement?document.fullscreenElement.appendChild(h.$el):i.appendChild(h.$el);var r=0===t.offset?t.offset:t.offset||20;return v.forEach((function(e){r+=e.$el.offsetHeight+16})),h.verticalOffset=r,h.visible=!0,h.$el.style.zIndex=u.PopupManager.nextZIndex(),v.push(h),h}))};["success","warning","info","error"].forEach((function(e){g[e]=function(t){return Object(d.isObject)(t)&&!Object(f.isVNode)(t)?g(p({},t,{type:e})):g({type:e,message:t})}})),g.close=function(e,t){for(var n=v.length,s=-1,o=0,i=0;i<n;i++)if(e===v[i].id){o=v[s=i].$el.offsetHeight,"function"==typeof t&&t(v[i]),v.splice(i,1);break}if(!(n<=1||-1===s||s>v.length-1))for(var r=s;r<n-1;r++){var l=v[r].$el;l.style.top=parseInt(l.style.top,10)-o-16+"px"}},g.closeAll=function(){for(var e=v.length-1;e>=0;e--)v[e].close()};var _=g;t.default=_}});