UNPKG

@zeit-ui/vue

Version:

A popular UI framework for Vue

2 lines 5.89 kB
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["progress"]=e():t["progress"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s="fb15")}({2106:function(t,e,r){"use strict";var n=r("d38a"),i=r.n(n);i.a},"7ce0":function(t,e,r){},ba8f:function(t,e,r){"use strict";var n=r("7ce0"),i=r.n(n);i.a},d38a:function(t,e,r){},f6fd:function(t,e){(function(t){var e="currentScript",r=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(n){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(n.stack)||[!1])[1];for(t in r)if(r[t].src==e||"interactive"==r[t].readyState)return r[t];return null}}})})(document)},fb15:function(t,e,r){"use strict";r.r(e);var n,i={};(r.r(i),r.d(i,"enums",(function(){return u})),r.d(i,"isMac",(function(){return s})),"undefined"!==typeof window)&&(r("f6fd"),(n=window.document.currentScript)&&(n=n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(r.p=n[1]));var o=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"zi-progress-bar",class:t.fix},[r("div",{staticClass:"zi-progress"},[r("div",{staticClass:"zi-progress__inner",class:t.type,style:t.styles})])])},a=[],u=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(),r=window.getComputedStyle(t),n=r.width,i=r.height,o=function(t,e){if(!t)return 0;var r=t.includes("px")?+t.split("px")[0]:t.includes("%")?+t.split("%")[0]*e*.01:t;return Number.isNaN(+r)?0:+r};return{width:o("".concat(n),e.width),height:o("".concat(i),e.height)}},l=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("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),r=e.width;t.style.width="".concat(r,"px"),t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto";var n=c(t),i=n.height;t.style.width=null,t.style.position=null,t.style.visibility=null,t.style.height=0,c(t);var o=setTimeout((function(){t.style.height="".concat(i,"px"),clearTimeout(o)}),0)},afterEnter:function(t){t.style.height="auto"},leave:function(t){var e=c(t),r=e.height;t.style.height="".concat(r,"px"),c(t);var n=setTimeout((function(){t.style.height=0,clearTimeout(n)}),0)},afterLeave:function(t){t.style.height=null}}},p=d;r("ba8f");function h(t,e,r,n,i,o,a,u){var s,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=r,c._compiled=!0),n&&(c.functional=!0),o&&(c._scopeId="data-v-"+o),a?(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__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},c._ssrRegister=s):i&&(s=u?function(){i.call(this,this.$root.$options.shadowRoot)}:i),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-progress",props:{value:{type:[Number,String],default:0},fix:{type:String,validator:i.enums(["top","bottom"])},colors:Array,max:{type:[Number,String],default:100},type:{type:String,default:"default",validator:i.enums(["default","success","danger","warning","secondary"])}},data:function(){return{currentColor:""}},computed:{privateMax:function(){if(Number.isNaN(+this.max))throw new Error("[Progress Error]max must be Number type");return+this.max},privateValue:function(){if(Number.isNaN(+this.value))throw new Error("[Progress Error]value must be Number type");var t=+this.value;return t<0?0:t>this.privateMax?this.privateMax:t},privatePercentage:function(){return Math.round(this.privateValue/this.privateMax*100)},styles:function(){var t={width:"".concat(this.privatePercentage,"%")};return this.colors&&this.colors.length?Object.assign({},t,{backgroundColor:this.safeHex(this.background)}):t},background:function(){var t=this,e=this.sortable.find((function(e){var r=+e.value;return r>t.privateMax&&(r=t.privateMax),t.privatePercentage>=Math.round(r/t.privateMax*100)}));return e&&(this.currentColor=e.color)},sortable:function(){return this.colors.sort((function(t,e){return+e.value-+t.value}))}},methods:{safeHex:function(t){if(!t)return t;var e="".concat(t);return e.startsWith("rgb")||e.startsWith("#")?t:"#".concat(t)}}}),g=y,m=(r("2106"),h(g,o,a,!1,null,null,null)),b=m.exports;b.install=function(t){t.component(b.name,b)};var x=b;e["default"]=x}})["default"]})); //# sourceMappingURL=progress.umd.min.js.map