diff --git a/src/docs/demos/progress/progress-demo.html b/src/docs/demos/progress/progress-demo.html index 9e2cac8..e675875 100644 --- a/src/docs/demos/progress/progress-demo.html +++ b/src/docs/demos/progress/progress-demo.html @@ -6,13 +6,13 @@
Side-By-Side HTML5 and Bootstrap 4
{{$ctrl.value}} perc. - {{$ctrl.label === 'custom' ? $ctrl.value + ' perc.' : ''}}
@@ -69,7 +69,7 @@
Side-By-Side HTML5 and Bootstrap 4
diff --git a/src/docs/demos/progress/progress-demo.md b/src/docs/demos/progress/progress-demo.md index e49efda..0bea2d4 100644 --- a/src/docs/demos/progress/progress-demo.md +++ b/src/docs/demos/progress/progress-demo.md @@ -2,16 +2,16 @@ This component merges the simplicity of HTML5's `` with the beauty of Bootstrap 4's Progress component. In addition to the attributes below, the component's `height` style can be set for a taller (or shorter) progress indicator. -**max** (*number*, optional) - Represents how much of a particular task needs to be done before it is considered complete. If provided, the number must be greater than zero. +**progress-max** (*number*, optional) - Represents how much of a particular task needs to be done before it is considered complete. If provided, the number must be greater than zero. -**value** (*number*, optional) - Represents how much of a particular task has been done. If provided, the number must be greater than or equal to 0 and less than or equal to `max`. This attribute is optional, which allows you to illustrate that a particular task is ongoing with no indication of how long it is expected to take. +**progress-value** (*number*, optional) - Represents how much of a particular task has been done. If provided, the number must be greater than or equal to 0 and less than or equal to `progress-max`. This attribute is optional, which allows you to illustrate that a particular task is ongoing with no indication of how long it is expected to take. -**animated-progress** (*boolean*, optional) - Whether or not changes to the `value` should be animated. Defaults to `false`. +**progress-animated-progress** (*boolean*, optional) - Whether or not changes to the `progress-value` should be animated. Defaults to `false`. -**auto-label** (*boolean*, optional) - Automatically displays a label inside of the progress indicator (e.g.- 25%). You can also specify your own custom label via `innerHTML`. Defaults to `false`. +**progress-auto-label** (*boolean*, optional) - Automatically displays a label inside of the progress indicator (e.g.- 25%). You can also specify your own custom label via `innerHTML`. Defaults to `false`. -**striped** (*boolean*, optional) - The display style of the progress indicator. Defaults to `false`. +**progress-striped** (*boolean*, optional) - The display style of the progress indicator. Defaults to `false`. -**animated-striped** (*boolean*, optional) - Used in conjunction with the `striped` attribute. Defaults to `false`. +**progress-animated-striped** (*boolean*, optional) - Used in conjunction with the `progress-striped` attribute. Defaults to `false`. -**background** (*string*, optional) - This maps to Bootstrap 4's colors. Values can be `'primary'`, `'success'`, `'info'`, `'warning'`, `'danger'`, `'inverse'`, or `'faded'`. Defaults to `'primary'`. +**progress-background** (*string*, optional) - This maps to Bootstrap 4's colors. Values can be `'primary'`, `'success'`, `'info'`, `'warning'`, `'danger'`, `'inverse'`, or `'faded'`. Defaults to `'primary'`. diff --git a/src/library/progress/progress.component.js b/src/library/progress/progress.component.js index bef61bb..9784b53 100644 --- a/src/library/progress/progress.component.js +++ b/src/library/progress/progress.component.js @@ -16,37 +16,37 @@ class controller { $onChanges(changesObj) { // (re)validate bindings - if (this.max && (typeof this.max !== 'number' || isFinite(this.max) === false)) { - this.$log.error('invalid ngbsProgress::max:', JSON.stringify(this.max), 'expecting a number'); + if (this.progressMax && (typeof this.progressMax !== 'number' || isFinite(this.progressMax) === false)) { + this.$log.error('invalid ngbsProgress::progressMax:', JSON.stringify(this.progressMax), 'expecting a number'); } - if (this.value && (typeof this.value !== 'number' || isFinite(this.value) === false)) { - this.$log.error('invalid ngbsProgress::value:', JSON.stringify(this.value), 'expecting a number'); + if (this.progressValue && (typeof this.progressValue !== 'number' || isFinite(this.progressValue) === false)) { + this.$log.error('invalid ngbsProgress::progressValue:', JSON.stringify(this.progressValue), 'expecting a number'); } - if (this.animatedProgress && typeof this.animatedProgress !== 'boolean') { - this.$log.error('invalid ngbsProgress::animatedProgress:', JSON.stringify(this.animatedProgress), 'expecting a boolean'); + if (this.progressAnimatedProgression && typeof this.progressAnimatedProgression !== 'boolean') { + this.$log.error('invalid ngbsProgress::progressAnimatedProgression:', JSON.stringify(this.progressAnimatedProgression), 'expecting a boolean'); } - if (this.autoLabel && typeof this.autoLabel !== 'boolean') { - this.$log.error('invalid ngbsProgress::autoLabel:', JSON.stringify(this.autoLabel), 'expecting a boolean'); + if (this.progressAutoLabel && typeof this.progressAutoLabel !== 'boolean') { + this.$log.error('invalid ngbsProgress::progressAutoLabel:', JSON.stringify(this.progressAutoLabel), 'expecting a boolean'); } - if (this.striped && typeof this.striped !== 'boolean') { - this.$log.error('invalid ngbsProgress::striped:', JSON.stringify(this.striped), 'expecting a boolean'); + if (this.progressStriped && typeof this.progressStriped !== 'boolean') { + this.$log.error('invalid ngbsProgress::progressStriped:', JSON.stringify(this.progressStriped), 'expecting a boolean'); } - if (this.animatedStripes && typeof this.animatedStripes !== 'boolean') { - this.$log.error('invalid ngbsProgress::animatedStripes:', JSON.stringify(this.animatedStripes), 'expecting a boolean'); + if (this.progressAnimatedStripes && typeof this.progressAnimatedStripes !== 'boolean') { + this.$log.error('invalid ngbsProgress::progressAnimatedStripes:', JSON.stringify(this.progressAnimatedStripes), 'expecting a boolean'); } - if (this.background && SUPPORTED_BACKGROUNDS.includes(this.background) === false) { - this.$log.error('invalid ngbsProgress::background:', JSON.stringify(this.background), 'expecting one of the following', SUPPORTED_BACKGROUNDS); + if (this.progressBackground && SUPPORTED_BACKGROUNDS.includes(this.progressBackground) === false) { + this.$log.error('invalid ngbsProgress::progressBackground:', JSON.stringify(this.progressBackground), 'expecting one of the following', SUPPORTED_BACKGROUNDS); } - // recalculate percentage if max/value change - if (changesObj.value || changesObj.max) { - this.percentage = this.value / this.max * 100; + // recalculate percentage if progressMax/progressValue change + if (changesObj.progressValue || changesObj.progressMax) { + this.percentage = this.progressValue / this.progressMax * 100; this.roundedPercentage = Math.round(this.percentage); } } @@ -55,13 +55,13 @@ class controller { // Define and export component export default { bindings: { - animatedProgress: '<', - animatedStripes: '<', - autoLabel: '<', - background: '<', - max: '<', - striped: '<', - value: '<', + progressAnimatedProgression: '<', + progressAnimatedStripes: '<', + progressAutoLabel: '<', + progressBackground: '<', + progressMax: '<', + progressStriped: '<', + progressValue: '<', }, transclude: true, template, diff --git a/src/library/progress/progress.html b/src/library/progress/progress.html index 13ffc19..5d5b717 100644 --- a/src/library/progress/progress.html +++ b/src/library/progress/progress.html @@ -1,17 +1,17 @@
- {{$ctrl.roundedPercentage}}% - + ng-class="[$ctrl.progressBackground ? 'bg-' + $ctrl.progressBackground : '', { 'animated-progress': $ctrl.progressAnimatedProgression, 'progress-bar-animated': $ctrl.progressAnimatedStripes, 'progress-bar-striped': $ctrl.progressStriped }]"> + {{$ctrl.roundedPercentage}}% +
+ ng-class="[$ctrl.progressBackground ? 'bg-' + $ctrl.progressBackground : '', { 'progress-bar-animated': $ctrl.progressAnimatedStripes, 'progress-bar-striped': $ctrl.progressStriped }]">