1 | import { Directive, HostBinding, Input } from '@angular/core';
|
2 |
|
3 |
|
4 | export var ProgressDirective = (function () {
|
5 | function ProgressDirective() {
|
6 | this.addClass = true;
|
7 | this.bars = [];
|
8 | this._max = 100;
|
9 | }
|
10 | Object.defineProperty(ProgressDirective.prototype, "max", {
|
11 |
|
12 | get: function () {
|
13 | return this._max;
|
14 | },
|
15 | set: function (v) {
|
16 | this._max = v;
|
17 | this.bars.forEach(function (bar) {
|
18 | bar.recalculatePercentage();
|
19 | });
|
20 | },
|
21 | enumerable: true,
|
22 | configurable: true
|
23 | });
|
24 | ProgressDirective.prototype.addBar = function (bar) {
|
25 | if (!this.animate) {
|
26 | bar.transition = 'none';
|
27 | }
|
28 | this.bars.push(bar);
|
29 | };
|
30 | ProgressDirective.prototype.removeBar = function (bar) {
|
31 | this.bars.splice(this.bars.indexOf(bar), 1);
|
32 | };
|
33 | ProgressDirective.decorators = [
|
34 | { type: Directive, args: [{ selector: 'bs-progress, [progress]' },] },
|
35 | ];
|
36 |
|
37 | ProgressDirective.ctorParameters = function () { return []; };
|
38 | ProgressDirective.propDecorators = {
|
39 | 'animate': [{ type: Input },],
|
40 | 'max': [{ type: HostBinding, args: ['attr.max',] }, { type: Input },],
|
41 | 'addClass': [{ type: HostBinding, args: ['class.progress',] },],
|
42 | };
|
43 | return ProgressDirective;
|
44 | }());
|
45 |
|
\ | No newline at end of file |