UNPKG

element-gui

Version:

A Component Library for Vue.js.

1 lines 7.02 kB
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.l=!0,s.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 s in t)r.d(n,s,function(e){return t[e]}.bind(null,s));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="/dist/",r(r.s=115)}({0:function(t,e,r){"use strict";function n(t,e,r,n,s,i,o,a){var l,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=r,c._compiled=!0),n&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),o?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=l):s&&(l=a?function(){s.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:s),l)if(c.functional){c._injectStyles=l;var u=c.render;c.render=function(t,e){return l.call(e),u(t,e)}}else{var p=c.beforeCreate;c.beforeCreate=p?[].concat(p,l):[l]}return{exports:t,options:c}}r.d(e,"a",(function(){return n}))},115:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"el-progress",class:["el-progress--"+t.type,t.status?"is-"+t.status:"",{"el-progress--without-text":!t.showText,"el-progress--text-inside":t.textInside}],attrs:{role:"progressbar","aria-valuenow":t.percentage,"aria-valuemin":"0","aria-valuemax":"100"}},["line"===t.type?r("div",{staticClass:"el-progress-bar"},[r("div",{staticClass:"el-progress-bar__outer",style:{height:t.strokeWidth+"px",backgroundColor:t.strokeColor}},[r("div",{staticClass:"el-progress-bar__inner",class:[{active:t.showActive,"is-indeterminate":t.indeterminate,"is-striped":t.striped,"el-progress-bar__inner--striped-flow":t.stripedFlow}],style:t.barStyle},[t.showText&&t.textInside?r("div",{staticClass:"el-progress-bar__innerText",style:{fontSize:t.progressTextSize+"px",color:t.textInsideColor}},[t._t("default",[t._v(t._s(t.content))])],2):t._e()])])]):r("div",{staticClass:"el-progress-circle",style:{height:t.width+"px",width:t.width+"px"}},[r("svg",{attrs:{viewBox:"0 0 100 100",width:t.width+"px",height:t.width+"px"}},[r("path",{staticClass:"el-progress-circle__track",style:t.trailPathStyle,attrs:{d:t.trackPath,stroke:t.strokeColor,"stroke-width":t.relativeStrokeWidth,fill:"none"}}),r("path",{staticClass:"el-progress-circle__path",style:t.circlePathStyle,attrs:{d:t.trackPath,stroke:t.stroke,fill:"none","stroke-linecap":t.strokeLinecap,"stroke-width":t.percentage?t.relativeStrokeWidth:0}})])]),t.showText&&!t.textInside?r("div",{staticClass:"el-progress__text"},[t._t("default",[r("span",{style:{fontSize:t.progressTextSize+"px",color:t.textOutsideColor}},[t.status?r("i",{class:t.iconClass}):[t._v(t._s(t.content))]],2)])],2):t._e()])};n._withStripped=!0;var s={name:"ElProgress",props:{type:{type:String,default:"line",validator:function(t){return["line","circle","dashboard"].indexOf(t)>-1}},percentage:{type:Number,default:0,required:!0,validator:function(t){return t>=0&&t<=100}},status:{type:String,validator:function(t){return["success","exception","warning","default"].indexOf(t)>-1}},strokeColor:{type:[String,Array,Function],default:"#e5e9f2"},strokeWidth:{type:Number,default:10},strokeLinecap:{type:String,default:"round"},active:{type:Boolean,default:!1},striped:{type:Boolean,default:!1},stripedFlow:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1},duration:{type:Number,default:3},textInside:{type:Boolean,default:!1},width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:[String,Array,Function],default:""},textOutsideColor:{type:[String,Array,Function],default:"#606266"},textInsideColor:{type:[String,Array,Function],default:"#FFFFFF"},format:Function},computed:{barStyle:function(){var t={};return t.width=this.percentage+"%",(this.indeterminate||this.striped)&&(t.animationDuration=this.duration+"s"),t.backgroundColor=this.getCurrentColor(this.percentage),t},relativeStrokeWidth:function(){return(this.strokeWidth/this.width*100).toFixed(1)},radius:function(){return"circle"===this.type||"dashboard"===this.type?parseInt(50-parseFloat(this.relativeStrokeWidth)/2,10):0},trackPath:function(){var t=this.radius,e="dashboard"===this.type;return"\n M 50 50\n m 0 "+(e?"":"-")+t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"-":"")+2*t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"":"-")+2*t+"\n "},perimeter:function(){return 2*Math.PI*this.radius},rate:function(){return"dashboard"===this.type?.75:1},strokeDashoffset:function(){return-1*this.perimeter*(1-this.rate)/2+"px"},trailPathStyle:function(){return{strokeDasharray:this.perimeter*this.rate+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset}},circlePathStyle:function(){return{strokeDasharray:this.perimeter*this.rate*(this.percentage/100)+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"}},stroke:function(){var t=void 0;if(this.color)t=this.getCurrentColor(this.percentage);else switch(this.status){case"success":t="#57B21C";break;case"exception":t="#E82F2F";break;case"warning":t="#FC9306";break;default:t="#20a0ff"}return t},iconClass:function(){return"warning"===this.status?"el-icon-warning":"line"===this.type?"success"===this.status?"el-icon-circle-check":"el-icon-circle-close":"success"===this.status?"el-icon-check":"el-icon-close"},progressTextSize:function(){return"line"===this.type?12+.4*(this.strokeWidth-5):.111111*this.width+2},content:function(){return"function"==typeof this.format?this.format(this.percentage)||"":this.percentage+"%"},showActive:function(){return 100!==this.percentage&&this.active}},methods:{getCurrentColor:function(t){return"function"==typeof this.color?this.color(t):"string"==typeof this.color?this.color:this.getLevelColor(t)},getLevelColor:function(t){for(var e=this.getColorArray().sort((function(t,e){return t.percentage-e.percentage})),r=0;r<e.length;r++)if(e[r].percentage>t)return e[r].color;return e[e.length-1].color},getColorArray:function(){var t=this.color,e=100/t.length;return t.map((function(t,r){return"string"==typeof t?{color:t,percentage:(r+1)*e}:t}))}}},i=r(0),o=Object(i.a)(s,n,[],!1,null,null,null).exports;o.install=function(t){t.component(o.name,o)};e.default=o}});