UNPKG

7.93 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../../../src/progressbar/bar.component.ts","../../../../src/progressbar/progressbar.config.ts","../../../../src/progressbar/progressbar.component.ts","../../../../src/progressbar/progressbar.module.ts"],"names":["BarComponent","el","renderer","this","max","value","animate","striped","type","percent","Object","defineProperty","prototype","isBs3","ngOnChanges","changes","Number","currentValue","_a","applyTypeClasses","_prevType","barTypeClass","bgClass","removeClass","nativeElement","addClass","Component","args","selector","template","changeDetection","ChangeDetectionStrategy","OnPush","host","role","ElementRef","Renderer2","Input","Injectable","providedIn","ProgressbarComponent","config","isStacked","_value","assign","Array","isArray","_values","ProgressbarConfig","ProgressbarModule","forRoot","ngModule","providers","NgModule","imports","CommonModule","declarations","exports"],"mappings":"4gBAwDE,SAAAA,EACUC,EACAC,GADAC,KAAAF,GAAAA,EACAE,KAAAD,SAAAA,EAxBDC,KAAAC,IAAM,IAGND,KAAAE,MAAS,EAGTF,KAAAG,SAAW,EAGXH,KAAAI,SAAW,EAGXJ,KAAAK,KAAyB,OAElCL,KAAAM,QAAU,WAEVC,OAAAC,eAAIX,EAAAY,UAAA,QAAK,KAAT,WACE,OAAOC,EAAAA,yCAUTb,EAAAY,UAAAE,YAAA,SAAYC,UACNA,EAAQV,OAASU,EAAQX,OAC3BD,KAAKM,QAAiBO,OAAOD,EAAQV,MAAMY,cAAgB,GACvDD,QAAmB,QAAXE,EAAAH,EAAQX,WAAG,IAAAc,OAAA,EAAAA,EAAED,eAAgBd,KAAKC,KAAQ,KADvC,KAIbW,EAAQP,MACVL,KAAKgB,oBAIDnB,EAAAY,UAAAO,iBAAA,WACN,GAAIhB,KAAKiB,UAAW,CAClB,IAAMC,EAAe,gBAAgBlB,KAAKiB,UACpCE,EAAU,MAAMnB,KAAKiB,UAC3BjB,KAAKD,SAASqB,YAAYpB,KAAKF,GAAGuB,cAAeH,GACjDlB,KAAKD,SAASqB,YAAYpB,KAAKF,GAAGuB,cAAeF,GACjDnB,KAAKiB,eAAY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AAAA,uBAGAA,EAAAA,uBAGAA,EAAAA,oBAGAA,EAAAA,qBAKAA,EAAAA,0BCxBH,SAAAY,YACSA,EAAAC,QAAP,WACE,MAAO,CAAEC,SAAUF,EAAmBG,UAAW,8BAPpDC,EAAAA,SAAQ1B,KAAA,CAAC,CACR2B,QAAS,CAACC,EAAAA,cACVC,aAAc,CAACxD,EAAcwC,GAC7BiB,QAAS,CAACzD,EAAcwC","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"]}
\No newline at end of file