Your IP : 18.191.212.21


Current Path : /var/www/admin_ftp_12/data/www/httpdocs/bitrix/js/ui/graph/circle/dist/
Upload File :
Current File : /var/www/admin_ftp_12/data/www/httpdocs/bitrix/js/ui/graph/circle/dist/ui.circle.bundle.min.js

this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(t,e){"use strict";class s{constructor(t,e,s,r,i){this.domNode=t;this.perimetr=e;this.radius=e/2;this.progressBar=Number(s)>100?100:s;this.progressBg=null;this.number=null;this.waves=null;this.leftWave=null;this.rightWave=null;this.fixCounter=r?r:null;this.withoutWaves=i?i:null}getCircumFerence(){return(this.radius-10)*2*3.14}getCircumProgress(){return this.getCircumFerence()-this.getCircumFerence()/100*this.progressBar}createCircle(){this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg");this.svg.setAttributeNS(null,"class","ui-graph-circle-bar");this.svg.setAttributeNS(null,"viewport","0 0 "+this.radius+" "+this.radius);this.svg.setAttributeNS(null,"width",this.perimetr);this.svg.setAttributeNS(null,"height",this.perimetr);this.progressBg=document.createElementNS("http://www.w3.org/2000/svg","circle");this.progressBg.setAttributeNS(null,"r",this.radius-10);this.progressBg.setAttributeNS(null,"cx",this.radius);this.progressBg.setAttributeNS(null,"cy",this.radius);this.progressBg.setAttributeNS(null,"class","ui-graph-circle-bar-bg");this.progressMove=document.createElementNS("http://www.w3.org/2000/svg","circle");this.progressMove.setAttributeNS(null,"r",this.radius-10);this.progressMove.setAttributeNS(null,"cx",this.radius);this.progressMove.setAttributeNS(null,"cy",this.radius);this.progressMove.setAttributeNS(null,"stroke-dasharray",this.getCircumFerence());this.progressMove.setAttributeNS(null,"stroke-dashoffset",this.getCircumFerence());this.progressMove.setAttributeNS(null,"class","ui-graph-circle-bar-progress");e.Dom.append(this.progressBg,this.svg);e.Dom.append(this.progressMove,this.svg);return this.svg}animateFixedBar(){this.svg.setAttributeNS(null,"class","ui-graph-circle-bar ui-graph-circle-bar-animate ui-graph-circle-bar-without-animate");this.progressMove.setAttributeNS(null,"stroke-dashoffset",0)}animateProgressBar(){this.svg.setAttributeNS(null,"class","ui-graph-circle-bar ui-graph-circle-bar-animate");this.progressMove.setAttributeNS(null,"stroke-dashoffset",this.getCircumProgress())}createNumberBlock(){this.number=e.Dom.create("div",{attrs:{className:"ui-graph-circle-number","data-progress":this.progressBar}});return this.number}createWavesBlock(){return e.Dom.create("div",{attrs:{className:"ui-graph-circle-waves-wrapper"},children:[this.waves=e.Dom.create("div",{attrs:{className:"ui-graph-circle-waves"},children:[this.leftWave=e.Dom.create("div",{attrs:{className:"ui-graph-circle-waves-left"}}),this.rightWave=e.Dom.create("div",{attrs:{className:"ui-graph-circle-waves-right"}})]})]})}animateWavesBlock(t){let e=this.progressBar;if(t){if(e<=50){e=45}if(e>50){e=85}this.progressBar<=25?e=25:null;this.waves.style.transform="translateY(-"+e+"%)"}this.progressBar<=25?e=25:null;this.waves.style.transform="translateY(-"+e+"%)"}animateBothWaves(){let t=0;let e=50;let s=15;let r;let i=Date.now();let a=1e3/s;let h;function l(){requestAnimationFrame(l);r=Date.now();h=r-i;if(h>a){i=r-h%a;const s=document.querySelector(".ui-graph-circle-waves-left");const l=document.querySelector(".ui-graph-circle-waves-right");t+=1;e-=1;s.style.transform="translate3d("+t+"%, 0, 0)";l.style.transform="translate3d("+e+"%, 0, 0)";if(parseInt(t,10)>=50){t=0}if(parseInt(e,10)<=0){e=50}}}l()}createWrapper(){this.graph=e.Dom.create("div",{attrs:{className:"ui-graph-circle-wrapper"}});e.Dom.append(this.createCircle(),this.graph);e.Dom.append(this.createNumberBlock(),this.graph);e.Dom.append(this.createWavesBlock(),this.graph);return this.graph}addWrapperClass(){e.Dom.addClass(this.graph,"ui-graph-circle-wrapper-animate");if(this.fixCounter){e.Dom.addClass(this.graph,"ui-graph-circle-counter")}}animateNumber(t){let e=this.progressBar;if(t){e=t}if(Number(e)<=0){if(t){this.number.innerHTML="0"}else{this.number.innerHTML="0"+" <span>%</span>"}return}if(t){this.number.innerHTML=t;this.number.innerHTML.length>=4?this.graph.classList.add("ui-graph-font-sm"):null}else{let t=0;let s=1e3/e;let r=setInterval(function(){t++;this.number.innerHTML=t+" <span>%</span>";t===Number(e)?clearInterval(r):null}.bind(this),s)}}updateCounter(t,e){this.progressBar=t;if(e){this.progressMove.setAttributeNS(null,"stroke-dashoffset",0)}else{this.progressMove.setAttributeNS(null,"stroke-dashoffset",this.getCircumProgress())}this.animateNumber(e);this.animateWavesBlock(e)}show(){e.Dom.append(this.createWrapper(),this.domNode);setTimeout(function(){this.addWrapperClass();this.animateNumber(this.fixCounter);if(this.fixCounter){this.animateFixedBar()}else{this.animateProgressBar()}if(this.withoutWaves){return}else{this.animateBothWaves();this.animateWavesBlock(this.fixCounter)}}.bind(this),500)}}t.Circle=s})(this.BX.UI.Graph=this.BX.UI.Graph||{},BX);
//# sourceMappingURL=ui.circle.bundle.map.js