mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-30 03:00:57 +00:00
48 lines
968 B
JavaScript
48 lines
968 B
JavaScript
/**
|
|
* @ngdoc component
|
|
* @name superProductivity.component:progressBar
|
|
* @description
|
|
* # progressBar
|
|
*/
|
|
|
|
(() => {
|
|
'use strict';
|
|
|
|
class ProgressBarCtrl {
|
|
/* @ngInject */
|
|
constructor($element) {
|
|
this.$el = $element;
|
|
}
|
|
|
|
set progress(_value) {
|
|
if (_value > 100) {
|
|
this._progress = 100;
|
|
} else {
|
|
this._progress = _value;
|
|
}
|
|
|
|
if (this._progress > 1) {
|
|
this.$el[0].style = `width: ${this._progress}%; visibility: visible;`;
|
|
//this.$el[0].style = `transform: scaleX(${_value/100}); visibility: visible;`;
|
|
} else {
|
|
this.$el[0].style = `visibility: hidden;`;
|
|
}
|
|
}
|
|
|
|
get progress() {
|
|
return this._progress;
|
|
}
|
|
}
|
|
|
|
angular
|
|
.module('superProductivity')
|
|
.component('progressBar', {
|
|
controller: ProgressBarCtrl,
|
|
bindings: {
|
|
progress: '=progress'
|
|
},
|
|
});
|
|
|
|
// hacky fix for ff
|
|
ProgressBarCtrl.$$ngIsClass = true;
|
|
})();
|