template.js.base.progressbar.min.js Maven / Gradle / Ivy
'use strict';(function(c){"function"===typeof define&&define.amd?define(["jquery","../version","../widget"],c):c(jQuery)})(function(c){return c.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue();this.element.attr({role:"progressbar","aria-valuemin":this.min});
this._addClass("ui-progressbar","ui-widget ui-widget-content");this.valueDiv=c("\x3cdiv\x3e").appendTo(this.element);this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header");this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow");this.valueDiv.remove()},value:function(a){if(void 0===a)return this.options.value;this.options.value=this._constrainedValue(a);this._refreshValue()},_constrainedValue:function(a){void 0===a&&(a=this.options.value);
this.indeterminate=!1===a;"number"!==typeof a&&(a=0);return this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,a))},_setOptions:function(a){var b=a.value;delete a.value;this._super(a);this.options.value=this._constrainedValue(b);this._refreshValue()},_setOption:function(a,b){"max"===a&&(b=Math.max(this.min,b));this._super(a,b)},_setOptionDisabled:function(a){this._super(a);this.element.attr("aria-disabled",a);this._toggleClass(null,"ui-state-disabled",!!a)},_percentage:function(){return this.indeterminate?
100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var a=this.options.value,b=this._percentage();this.valueDiv.toggle(this.indeterminate||a>this.min).width(b.toFixed(0)+"%");this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,a===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate);this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=c("\x3cdiv\x3e").appendTo(this.valueDiv),
this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":a}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null));this.oldValue!==a&&(this.oldValue=a,this._trigger("change"));a===this.options.max&&this._trigger("complete")}})});
© 2015 - 2024 Weber Informatics LLC | Privacy Policy