ngx-bootstrap
Version:
Native Angular Bootstrap Components
2 lines • 4.21 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("ngx-bootstrap/utils"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-bootstrap/progressbar",["exports","@angular/core","ngx-bootstrap/utils","@angular/common"],t):t((e["ngx-bootstrap"]=e["ngx-bootstrap"]||{},e["ngx-bootstrap"].progressbar={}),e.ng.core,e.utils,e.ng.common)}(this,function(e,t,r,n){"use strict";var o=function(){function e(){this.animate=!1,this.max=100}return e.decorators=[{type:t.Injectable}],e}(),a=function(){function e(e){this.isStacked=!1,this.addClass=!0,this.bars=[],this._max=100,Object.assign(this,e)}return Object.defineProperty(e.prototype,"animate",{set:function(t){this._animate=t,this.bars.forEach(function(e){e.animate=t})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"striped",{set:function(t){this._striped=t,this.bars.forEach(function(e){e.striped=t})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{set:function(e){this.isStacked=Array.isArray(e),this._value=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBs3",{get:function(){return r.isBs3()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},set:function(e){this._max=e,this.bars.forEach(function(e){e.recalculatePercentage()})},enumerable:!0,configurable:!0}),e.prototype.addBar=function(e){e.animate=this._animate,e.striped=this._striped,this.bars.push(e)},e.prototype.removeBar=function(e){this.bars.splice(this.bars.indexOf(e),1)},e.decorators=[{type:t.Component,args:[{selector:"progressbar",template:'<bar [type]="type" [value]="_value" *ngIf="!isStacked">\n <ng-content></ng-content>\n</bar>\n<ng-template [ngIf]="isStacked">\n <bar *ngFor="let item of _value" [type]="item.type" [value]="item.value">{{ item.label }}</bar>\n</ng-template>\n',styles:["\n :host {\n width: 100%;\n display: flex;\n }\n "]}]}],e.ctorParameters=function(){return[{type:o}]},e.propDecorators={animate:[{type:t.Input}],striped:[{type:t.Input}],type:[{type:t.Input}],value:[{type:t.Input}],max:[{type:t.HostBinding,args:["attr.max"]},{type:t.Input}],addClass:[{type:t.HostBinding,args:["class.progress"]}]},e}(),s=function(){function e(e){this.percent=0,this.progress=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){(e||0===e)&&(this._value=e,this.recalculatePercentage())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"setBarWidth",{get:function(){return this.recalculatePercentage(),this.percent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBs3",{get:function(){return r.isBs3()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.progress.addBar(this)},e.prototype.ngOnDestroy=function(){this.progress.removeBar(this)},e.prototype.recalculatePercentage=function(){this.percent=+(this.value/this.progress.max*100).toFixed(2);var e=this.progress.bars.reduce(function(e,t){return e+t.percent},0);100<e&&(this.percent-=e-100)},e.decorators=[{type:t.Component,args:[{selector:"bar",template:"<ng-content></ng-content>\n",host:{role:"progressbar","aria-valuemin":"0","[class]":'"progress-bar " + (type ? "progress-bar-" + type + " bg-" + type : "")',"[class.progress-bar-animated]":"!isBs3 && animate","[class.progress-bar-striped]":"striped","[class.active]":"isBs3 && animate","[attr.aria-valuenow]":"value","[attr.aria-valuetext]":'percent ? percent.toFixed(0) + "%" : ""',"[attr.aria-valuemax]":"max","[style.height.%]":'"100"'}}]}],e.ctorParameters=function(){return[{type:a,decorators:[{type:t.Host}]}]},e.propDecorators={type:[{type:t.Input}],value:[{type:t.Input}],setBarWidth:[{type:t.HostBinding,args:["style.width.%"]}]},e}(),i=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[o]}},e.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[s,a],exports:[s,a]}]}],e}();e.BarComponent=s,e.ProgressbarComponent=a,e.ProgressbarModule=i,e.ProgressbarConfig=o,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-bootstrap-progressbar.umd.min.js.map