UNPKG

@zeit-ui/vue

Version:

A popular UI framework for Vue

2 lines 5.06 kB
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["badge"]=e():t["badge"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"04de":function(t,e,n){},"7ce0":function(t,e,n){},ba8f:function(t,e,n){"use strict";var r=n("7ce0"),o=n.n(r);o.a},f6c8:function(t,e,n){"use strict";var r=n("04de"),o=n.n(r);o.a},f6fd:function(t,e){(function(t){var e="currentScript",n=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(r){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(t in n)if(n[t].src==e||"interactive"==n[t].readyState)return n[t];return null}}})})(document)},fb15:function(t,e,n){"use strict";n.r(e);var r,o={};(n.r(o),n.d(o,"enums",(function(){return a})),n.d(o,"isMac",(function(){return s})),"undefined"!==typeof window)&&(n("f6fd"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.hasSlot?n("span",{staticClass:"zi-badge-group"},[t._t("default"),t.showSup?n("span",{staticClass:"zi-badge",class:[t.status||"",t.dot&&"dot"]},[t._v(t._s(t.countLabel))]):t._e()],2):n("span",{staticClass:"zi-badge",class:t.status||""},[t._v(t._s(t.countLabel))])},u=[],a=function(t){return function(e){return!!Array.isArray(t)&&!!t.find((function(t){return t===e}))}},s=function(){if("undefined"===typeof window||!window.navigator)return!1;var t=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(t)},c=function(t){var e=t.getBoundingClientRect(),n=window.getComputedStyle(t),r=n.width,o=n.height,i=function(t,e){if(!t)return 0;var n=t.includes("px")?+t.split("px")[0]:t.includes("%")?+t.split("%")[0]*e*.01:t;return Number.isNaN(+n)?0:+n};return{width:i("".concat(r),e.width),height:i("".concat(o),e.height)}},l=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"expand"},on:{enter:t.enter,"after-enter":t.afterEnter,leave:t.leave}},[t._t("default")],2)},f=[],d={name:"zi-transition-expand",methods:{enter:function(t){var e=c(t),n=e.width;t.style.width="".concat(n,"px"),t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto";var r=c(t),o=r.height;t.style.width=null,t.style.position=null,t.style.visibility=null,t.style.height=0,c(t);var i=setTimeout((function(){t.style.height="".concat(o,"px"),clearTimeout(i)}),0)},afterEnter:function(t){t.style.height="auto"},leave:function(t){var e=c(t),n=e.height;t.style.height="".concat(n,"px"),c(t);var r=setTimeout((function(){t.style.height=0,clearTimeout(r)}),0)},afterLeave:function(t){t.style.height=null}}},p=d;n("ba8f");function h(t,e,n,r,o,i,u,a){var s,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),u?(s=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(u)},c._ssrRegister=s):o&&(s=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),s)if(c.functional){c._injectStyles=s;var l=c.render;c.render=function(t,e){return s.call(e),l(t,e)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,s):[s]}return{exports:t,options:c}}var v=h(p,l,f,!1,null,null,null),y=(v.exports,new Map,{name:"zi-badge",props:{count:[String,Number],maxCount:[String,Number],showZero:Boolean,dot:Boolean,status:{type:String,validator:o.enums(["success","warning","error"])}},computed:{hasSlot:function(){return!!this.$slots.default},showSup:function(){return!!this.showZero||0!==+this.count},countLabel:function(){var t=+this.maxCount;return Number.isNaN(t)?this.count:this.count>t?"".concat(t,"+"):this.count}}}),g=y,m=(n("f6c8"),h(g,i,u,!1,null,null,null)),b=m.exports;b.install=function(t){return t.component(b.name,b)};var _=b;e["default"]=_}})["default"]})); //# sourceMappingURL=badge.umd.min.js.map