Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

frontello-ui-progress

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frontello-ui-progress - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

2

package.json
{
"name": "frontello-ui-progress",
"version": "1.1.0",
"version": "2.0.0",
"description": "UI progress",

@@ -5,0 +5,0 @@ "main": "progress.js",

"use strict";
class Progress {
constructor(container, currentStep, numberOfSteps, config = {})
constructor(container, currentStep = 0, numberOfSteps = 0, config = {})
{

@@ -11,3 +11,2 @@ this.container = container;

boxSize: 32,
progressClass: 'progress',
progressUnitClass: 'unit',

@@ -17,5 +16,21 @@ }, config);

this._build();
this._dispatchEvent('init', {
steps: this.steps
});
this._updateState();
}
setNumberOfSteps(numberOfSteps)
{
this._setNumberOfStep(numberOfSteps);
this._updateStepNumber();
this._updateState();
this._dispatchEvent('change', {
currentStep: this.currentStep
});
}
setStep(step)

@@ -26,4 +41,19 @@ {

this._updateState();
this._dispatchEvent('change', {
currentStep: this.currentStep
});
}
_updateStepNumber()
{
this.progressCurrent.innerHTML = this.currentStep;
}
_setNumberOfStep(numberOfSteps)
{
this.numberOfSteps = numberOfSteps;
this.progressUnit.innerHTML = this.numberOfSteps;
}
_build()

@@ -64,3 +94,2 @@ {

{
this.container.classList.add(this.config.progressClass);
this.progressCurrent = document.createElement('span');

@@ -71,11 +100,5 @@ this.container.appendChild(this.progressCurrent);

this.progressUnit.classList.add(this.config.progressUnitClass);
this.progressUnit.innerHTML = this.numberOfSteps;
this.container.appendChild(this.progressUnit);
}
_updateStepNumber()
{
this.progressCurrent.innerHTML = this.currentStep;
}
_updateState()

@@ -86,2 +109,9 @@ {

}
_dispatchEvent(id, datas)
{
const event = new CustomEvent(id, { detail: datas } );
this.container.dispatchEvent(event);
}
}

@@ -1,1 +0,33 @@

# progress
# Progress
Dynamically set the progress status of steps, on a round progress preview.
## Header
```html
<script src="progress.js"></script>
<link rel="stylesheet" href="progress.css">
```
## Body
```html
<nav class="frontello-ui-progress"></nav>
<script>
document.addEventListener('DOMContentLoaded', () => {
let progressElement = document.querySelector('.frontello-ui-progress');
progressElement.addEventListener('init', (event) => {
console.log('progress: init');
console.log(event.detail);
}, false);
progressElement.addEventListener('change', (event) => {
console.log('progress: change');
console.log(event.detail);
}, false);
let progress = new Progress(progressElement);
progress.setNumberOfSteps(3);
progress.setStep(1);
});
</script>
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc