@@ -71,6 +71,8 @@ $.widget( "ui.progressbar", {
71
71
val = newValue ;
72
72
}
73
73
74
+ this . indeterminate = val === false ;
75
+
74
76
// sanitize value
75
77
if ( typeof val !== "number" ) {
76
78
val = 0 ;
@@ -107,26 +109,33 @@ $.widget( "ui.progressbar", {
107
109
} ,
108
110
109
111
_percentage : function ( ) {
110
- return 100 * this . options . value / this . options . max ;
112
+ return this . indeterminate ? 100 : 100 * this . options . value / this . options . max ;
111
113
} ,
112
114
113
115
_refreshValue : function ( ) {
114
- var percentage = this . _percentage ( ) ;
116
+ var value = this . value ( ) ,
117
+ percentage = this . _percentage ( ) ,
118
+ overlay = this . valueDiv . children ( ) . eq ( 0 ) ;
119
+
120
+ overlay . toggleClass ( "ui-progressbar-overlay" , this . indeterminate ) ;
121
+ this . valueDiv . toggleClass ( "ui-progressbar-indeterminate" , this . indeterminate ) ;
115
122
116
- if ( this . oldValue !== this . options . value ) {
117
- this . oldValue = this . options . value ;
123
+ if ( this . oldValue !== value ) {
124
+ this . oldValue = value ;
118
125
this . _trigger ( "change" ) ;
119
126
}
120
- if ( this . options . value === this . options . max ) {
121
- this . _trigger ( "complete" ) ;
122
- }
123
127
124
128
this . valueDiv
125
- . toggle ( this . options . value > this . min )
126
- . toggleClass ( "ui-corner-right" , this . options . value === this . options . max )
129
+ . toggle ( this . indeterminate || value > this . min )
130
+ . toggleClass ( "ui-corner-right" , value === this . options . max )
127
131
. width ( percentage . toFixed ( 0 ) + "%" ) ;
128
- this . element . attr ( "aria-valuemax" , this . options . max ) ;
129
- this . element . attr ( "aria-valuenow" , this . options . value ) ;
132
+ if ( this . indeterminate ) {
133
+ this . element . removeAttr ( "aria-valuemax" ) ;
134
+ this . element . removeAttr ( "aria-valuenow" ) ;
135
+ } else {
136
+ this . element . attr ( "aria-valuemax" , this . options . max ) ;
137
+ this . element . attr ( "aria-valuenow" , value ) ;
138
+ }
130
139
}
131
140
} ) ;
132
141
0 commit comments