📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

angular-progress-bar

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-progress-bar - npm Package Compare versions

Comparing version

to
1.0.1-beta4

25

bundles/progress-bar.umd.js

@@ -15,2 +15,3 @@ (function (global, factory) {

function ProgressBarComponent() {
// Default color
this.color = "#488aff";

@@ -23,13 +24,25 @@ }

ProgressBarComponent.prototype.whichColor = function (percent) {
var keys = Object.keys(this.degraded).sort();
var last = keys[0];
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var val = keys_1[_i];
if (val < 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;
}
else if (val > percent) {
// 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];

@@ -36,0 +49,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){for(var e=Object.keys(this.degraded).sort(),o=e[0],n=0,t=e;n<t.length;n++){var s=t[n];if(s<r)o=s;else if(r<s)return this.degraded[o]}return this.degraded[o]},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(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})});
{
"name": "angular-progress-bar",
"version": "1.0.1-beta3",
"version": "1.0.1-beta4",
"description": "An angular progress-bar",

@@ -5,0 +5,0 @@ "main": "bundles/progress-bar.umd.js",

@@ -10,2 +10,3 @@ import { Component, Input } from '@angular/core';

function ProgressBarComponent() {
// Default color
this.color = "#488aff";

@@ -18,13 +19,25 @@ }

ProgressBarComponent.prototype.whichColor = function (percent) {
var keys = Object.keys(this.degraded).sort();
var last = keys[0];
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var val = keys_1[_i];
if (val < 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;
}
else if (val > percent) {
// 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];

@@ -31,0 +44,0 @@ };

Sorry, the diff of this file is not supported yet