UNPKG

ngx-i24-circular-progress

Version:

A lightweight plugin to render a simple, animated circular progress bar.

1 lines 9.81 kB
{"version":3,"file":"ngx-i24-circular-progress.mjs","sources":["../../../projects/ngx-i24-circular-progress/src/lib/ngx-i24-circular-progress.service.ts","../../../projects/ngx-i24-circular-progress/src/lib/ngx-i24-circular-progress.component.ts","../../../projects/ngx-i24-circular-progress/src/lib/ngx-i24-circular-progress.component.html","../../../projects/ngx-i24-circular-progress/src/lib/ngx-i24-circular-progress.module.ts","../../../projects/ngx-i24-circular-progress/src/public-api.ts","../../../projects/ngx-i24-circular-progress/src/ngx-i24-circular-progress.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxI24CircularProgressService {\n\n constructor() { }\n}\n","import { Component, Input, OnChanges } from '@angular/core';\n\n@Component({\n selector: 'ngx-i24-circular-progress',\n templateUrl: `./ngx-i24-circular-progress.component.html`,\n styleUrls: ['./ngx-i24-circular-progress.component.scss'],\n standalone: false\n})\nexport class NgxI24CircularProgressComponent implements OnChanges {\n @Input() option: I24CircularProgressOptions = {\n primaryColor: '#0495fc',\n secondaryColor: '#191919',\n\n strokeWidth: 2,\n dotWidth: 10,\n\n numberColor: '#000',\n percentColor: '#000',\n textColor: '#000000bf',\n\n text: 'css',\n circleRadius: 70,\n\n numberFontSize: '2.5em',\n percentFontSize: '0.5em',\n textFontSize: '0.75em',\n\n };\n @Input() number: number = 0;\n\n size = '150px';\n steps = 440;\n\n strokeWidth = '2px';\n dotWidth = '10px';\n dotTop = '-5px';\n strokeDashoffset = 0;\n ngOnChanges() {\n this.init();\n }\n init() {\n this.option.primaryColor = this.option.primaryColor ? this.option.primaryColor : '#0495fc';\n this.option.secondaryColor = this.option.secondaryColor ? this.option.secondaryColor : '#191919';\n\n this.option.strokeWidth = this.option.strokeWidth ? this.option.strokeWidth : 2;\n this.option.dotWidth = this.option.dotWidth ? this.option.dotWidth : 10;\n\n\n this.option.numberColor = this.option.numberColor ? this.option.numberColor : '#000';\n this.option.percentColor = this.option.percentColor ? this.option.percentColor : '#000';\n this.option.textColor = this.option.textColor ? this.option.textColor : '#000000bf';\n\n this.option.circleRadius = this.option.circleRadius ? this.option.circleRadius : 70;\n\n this.option.numberFontSize = this.option.numberFontSize ? this.option.numberFontSize : '2.5em';\n this.option.percentFontSize = this.option.percentFontSize ? this.option.percentFontSize : '0.5em';\n this.option.textFontSize = this.option.textFontSize ? this.option.textFontSize : '0.75em';\n this.option.spaceBetweenNumberPercent = this.option.spaceBetweenNumberPercent ? this.option.spaceBetweenNumberPercent : '3px';\n\n this.size = ((this.option.circleRadius * 2) + 10) + 'px';\n this.steps = Math.round(6.2857 * this.option.circleRadius);\n\n this.strokeWidth = this.option.strokeWidth + 'px';\n this.dotWidth = this.option.dotWidth + 'px';\n this.dotTop = '-' + Math.round(this.option.dotWidth / 2) + 'px';\n\n this.strokeDashoffset = this.steps - ((this.steps * this.number) / 100);\n }\n // get size() {\n // return ((this.option.circleRadius * 2) + 10) + 'px';\n // }\n // get steps() {\n // return Math.round(6.2857 * this.option.circleRadius);\n // }\n}\nexport interface I24CircularProgressOptions {\n primaryColor?: string;\n secondaryColor?: string;\n\n strokeWidth?: number;\n dotWidth?: number;\n\n numberColor?: string;\n percentColor?: string;\n textColor?: string;\n\n spaceBetweenNumberPercent?: string;\n\n text?: string;\n circleRadius?: number;\n\n numberFontSize?: string;\n percentFontSize?: string;\n textFontSize?: string;\n}","<div class=\"percent\"\n [style.--primaryColor]=\"option.primaryColor\"\n [style.--secondaryColor]=\"option.secondaryColor\"\n [style.--strokeWidth]=\"strokeWidth\"\n [style.--dotWidth]=\"dotWidth\"\n [style.--dotTop]=\"dotTop\"\n [style.--numberColor]=\"option.numberColor\"\n [style.--percentColor]=\"option.percentColor\"\n [style.--textColor]=\"option.textColor\"\n [style.--num]=\"number\"\n [style.--steps]=\"steps\"\n [style.--size]=\"size\"\n [style.--numberFontSize]=\"option.numberFontSize\"\n [style.--percentFontSize]=\"option.percentFontSize\"\n [style.--textFontSize]=\"option.textFontSize\"\n [style.--strokeDashoffset]=\"strokeDashoffset\">\n <div class=\"dot\"></div>\n <svg>\n <circle [attr.cx]=\"option.circleRadius\"\n [attr.cy]=\"option.circleRadius\"\n [attr.r]=\"option.circleRadius\"></circle>\n <circle [attr.cx]=\"option.circleRadius\"\n [attr.cy]=\"option.circleRadius\"\n [attr.r]=\"option.circleRadius\"></circle>\n </svg>\n <div class=\"number\">\n <h2>{{number}}\n <span>%</span>\n </h2>\n @if (option.text) {\n <p>{{option.text}}</p>\n }\n </div>\n</div>","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { NgxI24CircularProgressComponent } from './ngx-i24-circular-progress.component';\n\n\n\n@NgModule({\n declarations: [\n NgxI24CircularProgressComponent\n ],\n imports: [\n CommonModule\n ],\n exports: [\n NgxI24CircularProgressComponent\n ]\n})\nexport class NgxI24CircularProgressModule { }\n","/*\n * Public API Surface of ngx-i24-circular-progress\n */\n\nexport * from './lib/ngx-i24-circular-progress.service';\nexport * from './lib/ngx-i24-circular-progress.component';\nexport * from './lib/ngx-i24-circular-progress.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAKa,6BAA6B,CAAA;AAExC,IAAA,WAAA,GAAA,EAAgB;8GAFL,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,cAF5B,MAAM,EAAA,CAAA,CAAA;;2FAEP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,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