UNPKG

8.63 kBSource Map (JSON)View Raw
1{"version":3,"file":"ngx-bootstrap-progressbar.umd.js","sources":["../../../../src/progressbar/bar.component.ts","../../../../src/progressbar/progressbar.config.ts","../../../../src/progressbar/progressbar.component.ts","../../../../src/progressbar/progressbar.module.ts","../../../../src/progressbar/ngx-bootstrap-progressbar.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Input,\n OnChanges,\n Renderer2,\n SimpleChanges\n} from '@angular/core';\n\nimport { isBs3 } from 'ngx-bootstrap/utils';\nimport { ProgressbarType } from './progressbar-type.interface';\n\n@Component({\n selector: 'bar',\n templateUrl: './bar.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n // eslint-disable-next-line @angular-eslint/no-host-metadata-property\n host: {\n role: 'progressbar',\n 'aria-valuemin': '0',\n '[class.progress-bar]': 'true',\n '[class.progress-bar-animated]': '!isBs3 && animate',\n '[class.progress-bar-striped]': 'striped',\n '[class.active]': 'isBs3 && animate',\n '[attr.aria-valuenow]': 'value',\n '[attr.aria-valuetext]': 'percent ? percent.toFixed(0) + \"%\" : \"\"',\n '[attr.aria-valuemax]': 'max',\n '[style.height.%]': '\"100\"',\n '[style.width.%]': 'percent'\n }\n})\nexport class BarComponent implements OnChanges {\n /** maximum total value of progress element */\n @Input() max = 100;\n\n /** current value of progress bar */\n @Input() value? = 0;\n\n /** if `true` changing value of progress bar will be animated */\n @Input() animate? = false;\n\n /** If `true`, striped classes are applied */\n @Input() striped? = false;\n\n /** provide one of the four supported contextual classes: `success`, `info`, `warning`, `danger` */\n @Input() type?: ProgressbarType = 'info';\n\n percent = 100;\n\n get isBs3(): boolean {\n return isBs3();\n }\n\n private _prevType?: string;\n\n constructor(\n private el: ElementRef,\n private renderer: Renderer2\n ) {}\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes.value || changes.max) {\n this.percent = 100 * (Number(changes.value.currentValue || 0)\n / Number((changes.max?.currentValue || this.max) || 100));\n }\n\n if (changes.type) {\n this.applyTypeClasses();\n }\n }\n\n private applyTypeClasses(): void {\n if (this._prevType) {\n const barTypeClass = `progress-bar-${this._prevType}`;\n const bgClass = `bg-${this._prevType}`;\n this.renderer.removeClass(this.el.nativeElement, barTypeClass);\n this.renderer.removeClass(this.el.nativeElement, bgClass);\n this._prevType = void 0;\n }\n\n if (this.type) {\n const barTypeClass = `progress-bar-${this.type}`;\n const bgClass = `bg-${this.type}`;\n this.renderer.addClass(this.el.nativeElement, barTypeClass);\n this.renderer.addClass(this.el.nativeElement, bgClass);\n this._prevType = this.type;\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ProgressbarConfig {\n /** if `true` changing value of progress bar will be animated */\n animate = false;\n /** maximum total value of progress element */\n max = 100;\n}\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { BarValue, ProgressbarType } from './progressbar-type.interface';\nimport { ProgressbarConfig } from './progressbar.config';\n\n@Component({\n selector: 'progressbar',\n templateUrl: './progressbar.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n // eslint-disable-next-line @angular-eslint/no-host-metadata-property\n host: {\n '[class.progress]': 'true',\n '[attr.max]': 'max'\n },\n styles: [`\n :host {\n width: 100%;\n display: flex;\n } `]\n})\nexport class ProgressbarComponent {\n /** maximum total value of progress element */\n @Input() max = 100;\n\n /** if `true` changing value of progress bar will be animated */\n @Input() animate = false;\n\n /** If `true`, striped classes are applied */\n @Input() striped = false;\n\n /** provide one of the four supported contextual classes: `success`, `info`, `warning`, `danger` */\n @Input() type?: ProgressbarType;\n\n /** current value of progress bar. Could be a number or array of objects\n * like {\"value\":15,\"type\":\"info\",\"label\":\"15 %\"}\n */\n @Input()\n set value(value: number | BarValue[]) {\n this.isStacked = Array.isArray(value);\n if (typeof value === 'number') {\n this._value = value;\n this._values = void 0;\n } else {\n this._value = void 0;\n this._values = value;\n }\n }\n\n isStacked = false;\n _value? = 0;\n _values?: BarValue[];\n\n constructor(config: ProgressbarConfig) {\n Object.assign(this, config);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule, ModuleWithProviders } from '@angular/core';\n\nimport { BarComponent } from './bar.component';\nimport { ProgressbarComponent } from './progressbar.component';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [BarComponent, ProgressbarComponent],\n exports: [BarComponent, ProgressbarComponent]\n})\nexport class ProgressbarModule {\n static forRoot(): ModuleWithProviders<ProgressbarModule> {\n return { ngModule: ProgressbarModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["isBs3","Component","ChangeDetectionStrategy","ElementRef","Renderer2","Input","Injectable","NgModule","CommonModule"],"mappings":";;;;;;;QAwDE,sBACU,EAAc,EACd,QAAmB;YADnB,OAAE,GAAF,EAAE,CAAY;YACd,aAAQ,GAAR,QAAQ,CAAW;;YAxBpB,QAAG,GAAG,GAAG,CAAC;;YAGV,UAAK,GAAI,CAAC,CAAC;;YAGX,YAAO,GAAI,KAAK,CAAC;;YAGjB,YAAO,GAAI,KAAK,CAAC;;YAGjB,SAAI,GAAqB,MAAM,CAAC;YAEzC,YAAO,GAAG,GAAG,CAAC;SAWV;QATJ,sBAAI,+BAAK;iBAAT;gBACE,OAAOA,WAAK,EAAE,CAAC;aAChB;;;WAAA;QASD,kCAAW,GAAX,UAAY,OAAsB;;YAChC,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,EAAE;gBAChC,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC;sBACzD,MAAM,CAAC,CAAC,OAAA,OAAO,CAAC,GAAG,0CAAE,YAAY,KAAI,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;aAC7D;YAED,IAAI,OAAO,CAAC,IAAI,EAAE;gBAChB,IAAI,CAAC,gBAAgB,EAAE,CAAC;aACzB;SACF;QAEO,uCAAgB,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