angular-progress-bar
Advanced tools
Comparing version
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core'], factory) : | ||
(factory((global.ng = global.ng || {}, global.ng['progress-bar'] = {}),global.ng.core)); | ||
}(this, (function (exports,core) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.ng = global.ng || {}, global.ng['progress-bar'] = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
/** | ||
* Generated class for the ProgressBarComponent component. | ||
* | ||
* See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html | ||
* for more info on Angular Components. | ||
*/ | ||
var ProgressBarComponent = /** @class */ (function () { | ||
function ProgressBarComponent() { | ||
// Default color | ||
this.color = "#488aff"; | ||
} | ||
/** | ||
* Returns a color for a certains percent | ||
* @param percent The current progress | ||
*/ | ||
ProgressBarComponent.prototype.whichColor = function (percent) { | ||
// Get all entries index as an array | ||
var k = Object.keys(this.degraded); | ||
// Convert string to number | ||
k.forEach(function (e, i) { return k[i] = +e; }); | ||
// Sort them by value | ||
k = k.sort(function (a, b) { return a - b; }); | ||
// Percent as number | ||
var p = +percent; | ||
// Set last by default as the first occurence | ||
var last = k[0]; | ||
// Foreach keys | ||
for (var _i = 0, k_1 = k; _i < k_1.length; _i++) { | ||
var val = k_1[_i]; | ||
// if current val is < than percent | ||
if (val < p) { | ||
last = val; | ||
} | ||
// if val >= percent then the val that we could show has been reached | ||
else if (val >= p - 1) { | ||
return this.degraded[last]; | ||
} | ||
} | ||
// if its the last one retrun the last | ||
return this.degraded[last]; | ||
}; | ||
ProgressBarComponent.decorators = [ | ||
{ type: core.Component, args: [{ | ||
selector: 'progress-bar', | ||
styles: ["\n .progress-outer {\n width: 96%;\n margin: 10px 2%;\n padding: 3px;\n text-align: center;\n background-color: #f4f4f4;\n border: 1px solid #dcdcdc;\n color: #fff;\n border-radius: 20px;\n }\n .progress-inner {\n min-width: 15%;\n white-space: nowrap;\n overflow: hidden;\n padding: 5px;\n border-radius: 20px;\n }\n "], | ||
template: "<div class=\"progress-outer\">\n" + | ||
" <div class=\"progress-inner\" [style.width]=\"progress + '%'\" [style.background-color]=\"degraded == null ? color : whichColor(progress)\">\n" + | ||
" {{progress}}%\n" + | ||
"</div>\n" + | ||
"</div>" | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
ProgressBarComponent.ctorParameters = function () { return []; }; | ||
ProgressBarComponent.propDecorators = { | ||
'progress': [{ type: core.Input, args: ['progress',] },], | ||
'color': [{ type: core.Input, args: ['color',] },], | ||
'degraded': [{ type: core.Input, args: ['color-degraded',] },], | ||
}; | ||
return ProgressBarComponent; | ||
}()); | ||
var ProgressBarModule = /** @class */ (function () { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var progress_bar_1 = require("./progress-bar/progress-bar"); | ||
var ProgressBarModule = (function () { | ||
function ProgressBarModule() { | ||
} | ||
ProgressBarModule.decorators = [ | ||
{ type: core.NgModule, args: [{ | ||
declarations: [ProgressBarComponent], | ||
exports: [ProgressBarComponent] | ||
{ type: core_1.NgModule, args: [{ | ||
declarations: [progress_bar_1.ProgressBarComponent], | ||
exports: [progress_bar_1.ProgressBarComponent] | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
ProgressBarModule.ctorParameters = function () { return []; }; | ||
return ProgressBarModule; | ||
}()); | ||
exports.ProgressBarModule = ProgressBarModule; | ||
@@ -84,0 +24,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],e):e((r.ng=r.ng||{},r.ng["progress-bar"]={}),r.ng.core)}(this,function(r,e){"use strict";var o=function(){function r(){this.color="#488aff"}return r.prototype.whichColor=function(r){var o=Object.keys(this.degraded);o.forEach(function(r,e){return o[e]=+r});for(var e=+r,n=(o=o.sort(function(r,e){return r-e}))[0],t=0,s=o;t<s.length;t++){var d=s[t];if(d<e)n=d;else if(e-1<=d)return this.degraded[n]}return this.degraded[n]},r.decorators=[{type:e.Component,args:[{selector:"progress-bar",styles:["\n .progress-outer {\n width: 96%;\n margin: 10px 2%;\n padding: 3px;\n text-align: center;\n background-color: #f4f4f4;\n border: 1px solid #dcdcdc;\n color: #fff;\n border-radius: 20px;\n }\n .progress-inner {\n min-width: 15%;\n white-space: nowrap;\n overflow: hidden;\n padding: 5px;\n border-radius: 20px;\n }\n "],template:'<div class="progress-outer">\n <div class="progress-inner" [style.width]="progress + \'%\'" [style.background-color]="degraded == null ? color : whichColor(progress)">\n {{progress}}%\n</div>\n</div>'}]}],r.ctorParameters=function(){return[]},r.propDecorators={progress:[{type:e.Input,args:["progress"]}],color:[{type:e.Input,args:["color"]}],degraded:[{type:e.Input,args:["color-degraded"]}]},r}(),n=function(){function r(){}return r.decorators=[{type:e.NgModule,args:[{declarations:[o],exports:[o]}]}],r.ctorParameters=function(){return[]},r}();r.ProgressBarModule=n,Object.defineProperty(r,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e.ng=e.ng||{},e.ng["progress-bar"]={}))}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=require("@angular/core"),o=require("./progress-bar/progress-bar"),n=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{declarations:[o.ProgressBarComponent],exports:[o.ProgressBarComponent]}]}],e.ctorParameters=function(){return[]},e}();e.ProgressBarModule=n,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "angular-progress-bar", | ||
"version": "1.0.3-beta8", | ||
"version": "1.0.3-beta9", | ||
"description": "An angular progress-bar", | ||
"main": "index.js", | ||
"main": "bundles/progress-bar.umd.js", | ||
"module": "src/index.js", | ||
"typings": "src/index.d.ts", | ||
"scripts": { | ||
@@ -7,0 +9,0 @@ "generate": "npm run build && cp -r ./assets/ ./dist/assets/ && cp ./package.json ./dist/package.json && cp ./README.md ./dist/README.md", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
50869
71.55%37
85%394
112.97%3
50%1
Infinity%