ProgressBar JAVASCRIPT UI Component API

ProgressBar Javascript API

Class

ProgressBar

Progress indicators. It can be used to show a user how far along he/she is in a process.

Selector

smart-progress-bar

Properties

Events

Properties

animation"none" | "simple" | "advanced"

Sets or gets the animation mode. Animation is disabled when the property is set to 'none'

Default value

"advanced"

Example

Set the animation property.

 <smart-progress-bar animation='none'></smart-progress-bar>

Set the animation property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.animation = 'simple';

Get the animation property.

 const progressbar = document.querySelector('smart-progress-bar');
 let animation = progressbar.animation;

disabledboolean

Enables or disables the element.

Default value

false

Example

Set the disabled property.

 <smart-progress-bar disabled></smart-progress-bar>

Set the disabled property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.disabled = false;

Get the disabled property.

 const progressbar = document.querySelector('smart-progress-bar');
 let disabled = progressbar.disabled;

indeterminateboolean

Sets the value of the Progress bar to indeterminate state(null) and starts the animation.

Default value

false

Example

Set the indeterminate property.

 <smart-progress-bar indeterminate></smart-progress-bar>

Set the indeterminate property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.indeterminate = false;

Get the indeterminate property.

 const progressbar = document.querySelector('smart-progress-bar');
 let indeterminate = progressbar.indeterminate;

invertedboolean

Sets the filling direction of the Progress Bar.

Default value

false

Example

Set the inverted property.

 <smart-progress-bar inverted></smart-progress-bar>

Set the inverted property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.inverted = false;

Get the inverted property.

 const progressbar = document.querySelector('smart-progress-bar');
 let inverted = progressbar.inverted;

formatFunctionfunction | null

A callback function defining the new format for the label of the Progress Bar.

Example

Set the formatFunction property.

 <smart-progress-bar format-function='function(value) { return value + "$" }'></smart-progress-bar>

Set the formatFunction property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.formatFunction = function(value) { return "$" + value };

Get the formatFunction property.

 const progressbar = document.querySelector('smart-progress-bar');
 let formatFunction = progressbar.formatFunction;

localestring

Sets or gets the language. Used in conjunction with the property messages.

Default value

"en"

Example

Set the locale property.

 <smart-progress-bar locale='de'></smart-progress-bar>

Set the locale property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.locale = 'fr';

Get the locale property.

 const progressbar = document.querySelector('smart-progress-bar');
 let locale = progressbar.locale;

localizeFormatFunctionfunction | null

Callback, related to localization module.

Example

Set the localizeFormatFunction property.

 <smart-progress-bar localize-format-function='function(defaultMessage, message, messageArguments){return '...'}'></smart-progress-bar>

Set the localizeFormatFunction property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.localizeFormatFunction = function(defaultMessage, message, messageArguments){return '...'};

Get the localizeFormatFunction property.

 const progressbar = document.querySelector('smart-progress-bar');
 let localizeFormatFunction = progressbar.localizeFormatFunction;

maxnumber

Sets progress bars maximum possible value.

Default value

100

Example

Set the max property.

 <smart-progress-bar max='10'></smart-progress-bar>

Set the max property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.max = 50;

Get the max property.

 const progressbar = document.querySelector('smart-progress-bar');
 let max = progressbar.max;

messagesobject

Sets an object with string values, related to the different states of passwords strength.

Default value




"en": {

"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",

"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",

"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",

"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",

"moduleUndefined": "Module is undefined.",

"missingReference": "{{elementType}}: Missing reference to {{files}}.",

"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",

"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."

}

Example

Set the messages property.

 <smart-progress-bar messages='{"de":{"propertyUnknownType":"Die Eigenschaft '{{name}}' hat ein nicht definiertes 'type'-Member!","propertyInvalidValue":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualValue}}, Erwarteter Wert: {{value}}!","propertyInvalidValueType":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualType}}, Erwarteter Wert: {{type}}!","elementNotInDOM":"Element existiert nicht in DOM! Bitte fugen Sie das Element zum DOM hinzu, bevor Sie eine Methode aufrufen.","moduleUndefined":"Modul ist nicht definiert.","missingReference":"{{elementType}}: Fehlender Verweis auf {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser unterstutzt keine HTMLTemplate-Elemente.","invalidTemplate":"{{elementType}}: '{{property}}' Die Eigenschaft akzeptiert eine Zeichenfolge, die mit der ID eines HTMLTemplate-Elements aus dem DOM ubereinstimmen muss."}}'></smart-progress-bar>

Set the messages property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.messages = {"en":{"propertyUnknownType":"'{{name}}' property is with undefined 'type' member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Module is undefined.","missingReference":"{{elementType}}: Missing reference to {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser doesn't support HTMLTemplate elements.","invalidTemplate":"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."}};

Get the messages property.

 const progressbar = document.querySelector('smart-progress-bar');
 let messages = progressbar.messages;

minnumber

Sets progress bars minimum possible value.

Default value

0

Example

Set the min property.

 <smart-progress-bar min='5'></smart-progress-bar>

Set the min property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.min = 10;

Get the min property.

 const progressbar = document.querySelector('smart-progress-bar');
 let min = progressbar.min;

orientation"horizontal" | "vertical"

Sets the orientation of the progress bar

Default value

"horizontal"

Example

Set the orientation property.

 <smart-progress-bar orientation='horizontal'></smart-progress-bar>

Set the orientation property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.orientation = 'vertical';

Get the orientation property.

 const progressbar = document.querySelector('smart-progress-bar');
 let orientation = progressbar.orientation;

rightToLeftboolean

Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.

Default value

false

Example

Set the rightToLeft property.

 <smart-progress-bar right-to-left></smart-progress-bar>

Set the rightToLeft property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.rightToLeft = false;

Get the rightToLeft property.

 const progressbar = document.querySelector('smart-progress-bar');
 let rightToLeft = progressbar.rightToLeft;

showProgressValueboolean

Enables/Disabled the label for the Progress Bar.

Default value

false

Example

Set the showProgressValue property.

 <smart-progress-bar show-progress-value></smart-progress-bar>

Set the showProgressValue property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.showProgressValue = false;

Get the showProgressValue property.

 const progressbar = document.querySelector('smart-progress-bar');
 let showProgressValue = progressbar.showProgressValue;

themestring

Determines the theme. Theme defines the look of the element

Default value

""

Example

Set the theme property.

 <smart-progress-bar theme='blue'></smart-progress-bar>

Set the theme property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.theme = 'red';

Get the theme property.

 const progressbar = document.querySelector('smart-progress-bar');
 let theme = progressbar.theme;

unfocusableboolean

If is set to true, the element cannot be focused.

Default value

false

Example

Set the unfocusable property.

 <smart-progress-bar unfocusable></smart-progress-bar>

Set the unfocusable property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.unfocusable = false;

Get the unfocusable property.

 const progressbar = document.querySelector('smart-progress-bar');
 let unfocusable = progressbar.unfocusable;

valuenumber

Sets or gets the value of the progress bar

Default value

0

Example

Set the value property.

 <smart-progress-bar value='5'></smart-progress-bar>

Set the value property by using the HTML Element's instance.

 const progressbar = document.querySelector('smart-progress-bar');
 progressbar.value = 45;

Get the value property.

 const progressbar = document.querySelector('smart-progress-bar');
 let value = progressbar.value;

Events

changeCustomEvent

This event is triggered when the value is changed.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onChange

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of change event.

const progressbar = document.querySelector('smart-progress-bar');
progressbar.addEventListener('change', function (event) {
	// event handling code goes here.
})

CSS Variables

--smart-progress-bar-default-widthvar()

Default value

"var(--smart-editor-width)"

smartProgressBar default width

--smart-progress-bar-default-heightvar()

Default value

"var(--smart-editor-height)"

smartProgressBar default height