You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

7 lines
3.8 KiB

/*!
* Angular Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.2-master-a9ba340
*/
function MdProgressCircularDirective(e,r,t,a,n,i){function o(i,o,M){function w(t,n,o,s,d,g){function f(e){b.attr("stroke-dashoffset",u(M,w,e,k)),b.attr("transform","rotate("+$+" "+M/2+" "+M/2+")")}var v=++D,p=a.now(),h=n-t,M=l(i.mdDiameter),w=m(M),C=o||r.easeFn,P=s||r.duration,$=-90*(d||0),k=g||100;n===t?f(n):I=c(function x(){var r=e.Math.max(0,e.Math.min(a.now()-p,P));f(C(r,t,h,P)),v===D&&r<P&&(I=c(x))})}function C(){w(A,q,r.easeFnIndeterminate,r.durationIndeterminate,y,75),y=++y%4}function P(){k||(k=n(C,r.durationIndeterminate,0,!1),C(),o.addClass(h).removeAttr("aria-valuenow"))}function $(){k&&(n.cancel(k),k=null,o.removeClass(h))}var I,k,x=o[0],F=angular.element(x.querySelector("svg")),b=angular.element(x.querySelector("path")),A=r.startIndeterminate,q=r.endIndeterminate,y=0,D=0;t(o),o.toggleClass(p,M.hasOwnProperty("disabled")),i.mdMode===v&&P(),i.$on("$destroy",function(){$(),I&&g(I)}),i.$watchGroup(["value","mdMode",function(){var e=x.disabled;return e===!0||e===!1?e:angular.isDefined(o.attr("disabled"))}],function(e,r){var t=e[1],a=e[2],n=r[2];if(a!==n&&o.toggleClass(p,!!a),a)$();else if(t!==f&&t!==v&&(t=v,M.$set("mdMode",t)),t===v)P();else{var i=d(e[0]);$(),o.attr("aria-valuenow",i),w(d(r[0]),i)}}),i.$watch("mdDiameter",function(r){var t=l(r),a=m(t),n=d(i.value),c=t/2+"px",g={width:t+"px",height:t+"px"};F[0].setAttribute("viewBox","0 0 "+t+" "+t),F.css(g).css("transform-origin",c+" "+c+" "+c),o.css(g),b.attr("stroke-width",a),b.attr("stroke-linecap","square"),i.mdMode==v?(b.attr("d",s(t,a,!0)),b.attr("stroke-dasharray",(t-a)*e.Math.PI*.75),b.attr("stroke-dashoffset",u(t,a,1,75))):(b.attr("d",s(t,a,!1)),b.attr("stroke-dasharray",(t-a)*e.Math.PI),b.attr("stroke-dashoffset",u(t,a,0,100)),w(n,n))})}function s(e,r,t){var a=e/2,n=r/2,i=a+","+n,o=n+","+a,s=a-n;return"M"+i+"A"+s+","+s+" 0 1 1 "+o+(t?"":"A"+s+","+s+" 0 0 1 "+i)}function u(r,t,a,n){return(r-t)*e.Math.PI*(3*(n||100)/100-a/100)}function d(r){return e.Math.max(0,e.Math.min(r||0,100))}function l(e){var t=r.progressSize;if(e){var a=parseFloat(e);return e.lastIndexOf("%")===e.length-1&&(a=a/100*t),a}return t}function m(e){return r.strokeWidth/100*e}var c=e.requestAnimationFrame||e.webkitRequestAnimationFrame||angular.noop,g=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.webkitCancelRequestAnimationFrame||angular.noop,f="determinate",v="indeterminate",p="_md-progress-circular-disabled",h="md-mode-indeterminate";return{restrict:"E",scope:{value:"@",mdDiameter:"@",mdMode:"@"},template:'<svg xmlns="http://www.w3.org/2000/svg"><path fill="none"/></svg>',compile:function(e,r){if(e.attr({"aria-valuemin":0,"aria-valuemax":100,role:"progressbar"}),angular.isUndefined(r.mdMode)){var t=r.hasOwnProperty("value")?f:v;r.$set("mdMode",t)}else r.$set("mdMode",r.mdMode.trim());return o}}}function MdProgressCircularProvider(){function e(e,r,t,a){return t*e/a+r}function r(e,r,t,a){var n=(e/=a)*e,i=n*e;return r+t*(6*i*n+-15*n*n+10*i)}var t={progressSize:50,strokeWidth:10,duration:100,easeFn:e,durationIndeterminate:1333,startIndeterminate:1,endIndeterminate:149,easeFnIndeterminate:r,easingPresets:{linearEase:e,materialEase:r}};return{configure:function(e){return t=angular.extend(t,e||{})},$get:function(){return t}}}goog.provide("ngmaterial.components.progressCircular"),goog.require("ngmaterial.core"),angular.module("material.components.progressCircular",["material.core"]),MdProgressCircularDirective.$inject=["$window","$mdProgressCircular","$mdTheming","$mdUtil","$interval","$log"],angular.module("material.components.progressCircular").directive("mdProgressCircular",MdProgressCircularDirective),angular.module("material.components.progressCircular").provider("$mdProgressCircular",MdProgressCircularProvider),ngmaterial.components.progressCircular=angular.module("material.components.progressCircular");