UNPKG

ng-progress-arc

Version:

AngularJS directive for displaying a circular progress meter.

1 lines 3.88 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("angular")):"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["ng-progress-arc"]=t(require("angular")):e["ng-progress-arc"]=t(e.angular)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r.n(n),a=r(2),i=r(4);t.default=o.a.module("ng-progress-arc",[]).directive("ngProgressArc",["ngProgressArcDefaults",function(e){return new a.a(e)}]).provider("ngProgressArcDefaults",i.a).name},function(e,t,r){"use strict";var n=r(3),o=r.n(n),a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.template=o.a,this.restrict="E",this.scope={size:"@",strokeWidth:"@",stroke:"@",counterClockwise:"@",complete:"&",background:"@",label:"@",labelStyle:"@",supLabel:"@",fontSize:"@"},this.progressArcDefaults=t}return e.$inject=["progressArcDefaults"],a(e,[{key:"compile",value:function(e,t){return this.progressArcDefaults(t),function(e){e.offset=/firefox/i.test(navigator.userAgent)?-89.9:-90;var t=function(){e.strokeWidthCapped=Math.min(e.strokeWidth,e.size/2-1),e.radius=Math.max((e.size-e.strokeWidthCapped)/2-1,0),e.circumference=2*Math.PI*e.radius};e.$watchCollection("[size, strokeWidth]",t),t()}}}]),e}();t.a=i},function(e,t){e.exports="<svg ng-attr-view_box=\"0 0 {{size + ' ' + size}}\"> <circle class=ngpa-background fill=none ng-attr-r={{radius}} ng-attr-cx={{size/2}} ng-attr-cy={{size/2}} ng-attr-stroke={{background}} ng-attr-stroke-width={{strokeWidthCapped}}></circle> <text y=50% x=50% text-anchor=middle ng-attr-fill={{stroke}} ng-attr-dy=\"{{(fontSize / 2) - strokeWidth}}\" ng-attr-font-size={{fontSize}} ng-if=label> <tspan ng-style=\"{'font-weight': labelStyle}\"> {{label}} </tspan> <tspan ng-attr-dy={{(fontSize/2)*(-1)}} dx=-5 ng-if=supLabel font-size=0.4em> {{supLabel}} </tspan> </text> <circle class=ngpa-progress fill=none ng-attr-r={{radius}} ng-attr-cx={{size/2}} ng-attr-cy={{size/2}} ng-attr-stroke={{stroke}} ng-attr-stroke-width={{strokeWidthCapped}} ng-attr-stroke-dasharray={{circumference}} ng-attr-stroke-dashoffset=\"{{(1 - complete()) * circumference}}\" ng-attr-transform=\"rotate({{offset}}, {{size/2}}, {{size/2}}){{ (counterClockwise && counterClockwise != 'false') ? ' translate(0, ' + size + ') scale(1, -1)' : '' }}\"></circle> </svg>"},function(e,t,r){"use strict";var n=r(0),o=r.n(n),a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var i={size:200,strokeWidth:20,stroke:"black",background:null},s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return a(e,[{key:"$get",value:function(){return function(e){o.a.forEach(i,function(t,r){e[r]||(e[r]=t)})}}},{key:"setDefault",value:function(e,t){return i[e]=t,this}}]),e}();t.a=s}])});