jquery-ui-rails 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/History.md +10 -0
- data/README.md +1 -1
- data/Rakefile +4 -5
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.ui.accordion.js +130 -290
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +30 -18
- data/vendor/assets/javascripts/jquery.ui.button.js +9 -8
- data/vendor/assets/javascripts/jquery.ui.core.js +19 -53
- data/vendor/assets/javascripts/jquery.ui.datepicker-be.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CA.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ky.js +24 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nb.js +22 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nn.js +22 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +1076 -878
- data/vendor/assets/javascripts/jquery.ui.dialog.js +456 -547
- data/vendor/assets/javascripts/jquery.ui.draggable.js +317 -207
- data/vendor/assets/javascripts/jquery.ui.droppable.js +177 -100
- data/vendor/assets/javascripts/jquery.ui.effect-blind.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-clip.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-drop.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-explode.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-fade.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-fold.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-scale.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-shake.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-slide.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.effect.js +91 -99
- data/vendor/assets/javascripts/jquery.ui.menu.js +20 -9
- data/vendor/assets/javascripts/jquery.ui.mouse.js +25 -25
- data/vendor/assets/javascripts/jquery.ui.position.js +39 -59
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +73 -33
- data/vendor/assets/javascripts/jquery.ui.resizable.js +461 -294
- data/vendor/assets/javascripts/jquery.ui.selectable.js +67 -51
- data/vendor/assets/javascripts/jquery.ui.slider.js +100 -95
- data/vendor/assets/javascripts/jquery.ui.sortable.js +411 -257
- data/vendor/assets/javascripts/jquery.ui.spinner.js +19 -5
- data/vendor/assets/javascripts/jquery.ui.tabs.js +47 -567
- data/vendor/assets/javascripts/jquery.ui.tooltip.js +14 -10
- data/vendor/assets/javascripts/jquery.ui.widget.js +33 -40
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +30 -8
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +2 -2
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +2 -5
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +2 -2
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +100 -26
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +65 -12
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +166 -55
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +61 -14
- data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +61 -14
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +20 -4
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +70 -13
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +7 -3
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +63 -15
- data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +52 -10
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +44 -10
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +196 -38
- data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +4 -6
- metadata +8 -3
@@ -3,10 +3,10 @@
|
|
3
3
|
//= require jquery.ui.position
|
4
4
|
|
5
5
|
/*!
|
6
|
-
* jQuery UI Menu 1.
|
6
|
+
* jQuery UI Menu 1.10.0
|
7
7
|
* http://jqueryui.com
|
8
8
|
*
|
9
|
-
* Copyright
|
9
|
+
* Copyright 2013 jQuery Foundation and other contributors
|
10
10
|
* Released under the MIT license.
|
11
11
|
* http://jquery.org/license
|
12
12
|
*
|
@@ -19,10 +19,8 @@
|
|
19
19
|
*/
|
20
20
|
(function( $, undefined ) {
|
21
21
|
|
22
|
-
var mouseHandled = false;
|
23
|
-
|
24
22
|
$.widget( "ui.menu", {
|
25
|
-
version: "1.
|
23
|
+
version: "1.10.0",
|
26
24
|
defaultElement: "<ul>",
|
27
25
|
delay: 300,
|
28
26
|
options: {
|
@@ -44,6 +42,9 @@ $.widget( "ui.menu", {
|
|
44
42
|
|
45
43
|
_create: function() {
|
46
44
|
this.activeMenu = this.element;
|
45
|
+
// flag used to prevent firing of the click handler
|
46
|
+
// as the event bubbles up through nested menus
|
47
|
+
this.mouseHandled = false;
|
47
48
|
this.element
|
48
49
|
.uniqueId()
|
49
50
|
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
@@ -77,8 +78,8 @@ $.widget( "ui.menu", {
|
|
77
78
|
},
|
78
79
|
"click .ui-menu-item:has(a)": function( event ) {
|
79
80
|
var target = $( event.target ).closest( ".ui-menu-item" );
|
80
|
-
if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
81
|
-
mouseHandled = true;
|
81
|
+
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
82
|
+
this.mouseHandled = true;
|
82
83
|
|
83
84
|
this.select( event );
|
84
85
|
// Open submenu on click
|
@@ -134,7 +135,7 @@ $.widget( "ui.menu", {
|
|
134
135
|
}
|
135
136
|
|
136
137
|
// Reset the mouseHandled flag
|
137
|
-
mouseHandled = false;
|
138
|
+
this.mouseHandled = false;
|
138
139
|
}
|
139
140
|
});
|
140
141
|
},
|
@@ -143,7 +144,7 @@ $.widget( "ui.menu", {
|
|
143
144
|
// Destroy (sub)menus
|
144
145
|
this.element
|
145
146
|
.removeAttr( "aria-activedescendant" )
|
146
|
-
.find( ".ui-menu" ).
|
147
|
+
.find( ".ui-menu" ).addBack()
|
147
148
|
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
|
148
149
|
.removeAttr( "role" )
|
149
150
|
.removeAttr( "tabIndex" )
|
@@ -177,6 +178,7 @@ $.widget( "ui.menu", {
|
|
177
178
|
},
|
178
179
|
|
179
180
|
_keydown: function( event ) {
|
181
|
+
/*jshint maxcomplexity:20*/
|
180
182
|
var match, prev, character, skip, regex,
|
181
183
|
preventDefault = true;
|
182
184
|
|
@@ -346,6 +348,15 @@ $.widget( "ui.menu", {
|
|
346
348
|
}[ this.options.role ];
|
347
349
|
},
|
348
350
|
|
351
|
+
_setOption: function( key, value ) {
|
352
|
+
if ( key === "icons" ) {
|
353
|
+
this.element.find( ".ui-menu-icon" )
|
354
|
+
.removeClass( this.options.icons.submenu )
|
355
|
+
.addClass( value.submenu );
|
356
|
+
}
|
357
|
+
this._super( key, value );
|
358
|
+
},
|
359
|
+
|
349
360
|
focus: function( event, item ) {
|
350
361
|
var nested, focused;
|
351
362
|
this.blur( event, event && event.type === "focus" );
|
@@ -2,10 +2,10 @@
|
|
2
2
|
//= require jquery.ui.widget
|
3
3
|
|
4
4
|
/*!
|
5
|
-
* jQuery UI Mouse 1.
|
5
|
+
* jQuery UI Mouse 1.10.0
|
6
6
|
* http://jqueryui.com
|
7
7
|
*
|
8
|
-
* Copyright
|
8
|
+
* Copyright 2013 jQuery Foundation and other contributors
|
9
9
|
* Released under the MIT license.
|
10
10
|
* http://jquery.org/license
|
11
11
|
*
|
@@ -17,14 +17,14 @@
|
|
17
17
|
(function( $, undefined ) {
|
18
18
|
|
19
19
|
var mouseHandled = false;
|
20
|
-
$( document ).mouseup( function(
|
20
|
+
$( document ).mouseup( function() {
|
21
21
|
mouseHandled = false;
|
22
22
|
});
|
23
23
|
|
24
24
|
$.widget("ui.mouse", {
|
25
|
-
version: "1.
|
25
|
+
version: "1.10.0",
|
26
26
|
options: {
|
27
|
-
cancel:
|
27
|
+
cancel: "input,textarea,button,select,option",
|
28
28
|
distance: 1,
|
29
29
|
delay: 0
|
30
30
|
},
|
@@ -32,12 +32,12 @@ $.widget("ui.mouse", {
|
|
32
32
|
var that = this;
|
33
33
|
|
34
34
|
this.element
|
35
|
-
.bind(
|
35
|
+
.bind("mousedown."+this.widgetName, function(event) {
|
36
36
|
return that._mouseDown(event);
|
37
37
|
})
|
38
|
-
.bind(
|
39
|
-
if (true === $.data(event.target, that.widgetName +
|
40
|
-
$.removeData(event.target, that.widgetName +
|
38
|
+
.bind("click."+this.widgetName, function(event) {
|
39
|
+
if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
|
40
|
+
$.removeData(event.target, that.widgetName + ".preventClickEvent");
|
41
41
|
event.stopImmediatePropagation();
|
42
42
|
return false;
|
43
43
|
}
|
@@ -49,11 +49,11 @@ $.widget("ui.mouse", {
|
|
49
49
|
// TODO: make sure destroying one instance of mouse doesn't mess with
|
50
50
|
// other instances of mouse
|
51
51
|
_mouseDestroy: function() {
|
52
|
-
this.element.unbind(
|
52
|
+
this.element.unbind("."+this.widgetName);
|
53
53
|
if ( this._mouseMoveDelegate ) {
|
54
54
|
$(document)
|
55
|
-
.unbind(
|
56
|
-
.unbind(
|
55
|
+
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
56
|
+
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
57
57
|
}
|
58
58
|
},
|
59
59
|
|
@@ -91,8 +91,8 @@ $.widget("ui.mouse", {
|
|
91
91
|
}
|
92
92
|
|
93
93
|
// Click event may never have fired (Gecko & Opera)
|
94
|
-
if (true === $.data(event.target, this.widgetName +
|
95
|
-
$.removeData(event.target, this.widgetName +
|
94
|
+
if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
|
95
|
+
$.removeData(event.target, this.widgetName + ".preventClickEvent");
|
96
96
|
}
|
97
97
|
|
98
98
|
// these delegates are required to keep context
|
@@ -103,8 +103,8 @@ $.widget("ui.mouse", {
|
|
103
103
|
return that._mouseUp(event);
|
104
104
|
};
|
105
105
|
$(document)
|
106
|
-
.bind(
|
107
|
-
.bind(
|
106
|
+
.bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
107
|
+
.bind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
108
108
|
|
109
109
|
event.preventDefault();
|
110
110
|
|
@@ -114,7 +114,7 @@ $.widget("ui.mouse", {
|
|
114
114
|
|
115
115
|
_mouseMove: function(event) {
|
116
116
|
// IE mouseup check - mouseup happened when mouse was out of window
|
117
|
-
if ($.ui.ie && !
|
117
|
+
if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
|
118
118
|
return this._mouseUp(event);
|
119
119
|
}
|
120
120
|
|
@@ -134,14 +134,14 @@ $.widget("ui.mouse", {
|
|
134
134
|
|
135
135
|
_mouseUp: function(event) {
|
136
136
|
$(document)
|
137
|
-
.unbind(
|
138
|
-
.unbind(
|
137
|
+
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
138
|
+
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
139
139
|
|
140
140
|
if (this._mouseStarted) {
|
141
141
|
this._mouseStarted = false;
|
142
142
|
|
143
143
|
if (event.target === this._mouseDownEvent.target) {
|
144
|
-
$.data(event.target, this.widgetName +
|
144
|
+
$.data(event.target, this.widgetName + ".preventClickEvent", true);
|
145
145
|
}
|
146
146
|
|
147
147
|
this._mouseStop(event);
|
@@ -158,15 +158,15 @@ $.widget("ui.mouse", {
|
|
158
158
|
);
|
159
159
|
},
|
160
160
|
|
161
|
-
_mouseDelayMet: function(event) {
|
161
|
+
_mouseDelayMet: function(/* event */) {
|
162
162
|
return this.mouseDelayMet;
|
163
163
|
},
|
164
164
|
|
165
165
|
// These are placeholder methods, to be overriden by extending plugin
|
166
|
-
_mouseStart: function(event) {},
|
167
|
-
_mouseDrag: function(event) {},
|
168
|
-
_mouseStop: function(event) {},
|
169
|
-
_mouseCapture: function(event) { return true; }
|
166
|
+
_mouseStart: function(/* event */) {},
|
167
|
+
_mouseDrag: function(/* event */) {},
|
168
|
+
_mouseStop: function(/* event */) {},
|
169
|
+
_mouseCapture: function(/* event */) { return true; }
|
170
170
|
});
|
171
171
|
|
172
172
|
})(jQuery);
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/*!
|
2
|
-
* jQuery UI Position 1.
|
2
|
+
* jQuery UI Position 1.10.0
|
3
3
|
* http://jqueryui.com
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2013 jQuery Foundation and other contributors
|
6
6
|
* Released under the MIT license.
|
7
7
|
* http://jquery.org/license
|
8
8
|
*
|
@@ -29,10 +29,41 @@ function getOffsets( offsets, width, height ) {
|
|
29
29
|
parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
|
30
30
|
];
|
31
31
|
}
|
32
|
+
|
32
33
|
function parseCss( element, property ) {
|
33
34
|
return parseInt( $.css( element, property ), 10 ) || 0;
|
34
35
|
}
|
35
36
|
|
37
|
+
function getDimensions( elem ) {
|
38
|
+
var raw = elem[0];
|
39
|
+
if ( raw.nodeType === 9 ) {
|
40
|
+
return {
|
41
|
+
width: elem.width(),
|
42
|
+
height: elem.height(),
|
43
|
+
offset: { top: 0, left: 0 }
|
44
|
+
};
|
45
|
+
}
|
46
|
+
if ( $.isWindow( raw ) ) {
|
47
|
+
return {
|
48
|
+
width: elem.width(),
|
49
|
+
height: elem.height(),
|
50
|
+
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
|
51
|
+
};
|
52
|
+
}
|
53
|
+
if ( raw.preventDefault ) {
|
54
|
+
return {
|
55
|
+
width: 0,
|
56
|
+
height: 0,
|
57
|
+
offset: { top: raw.pageY, left: raw.pageX }
|
58
|
+
};
|
59
|
+
}
|
60
|
+
return {
|
61
|
+
width: elem.outerWidth(),
|
62
|
+
height: elem.outerHeight(),
|
63
|
+
offset: elem.offset()
|
64
|
+
};
|
65
|
+
}
|
66
|
+
|
36
67
|
$.position = {
|
37
68
|
scrollbarWidth: function() {
|
38
69
|
if ( cachedScrollbarWidth !== undefined ) {
|
@@ -91,32 +122,21 @@ $.fn.position = function( options ) {
|
|
91
122
|
// make a copy, we don't want to modify arguments
|
92
123
|
options = $.extend( {}, options );
|
93
124
|
|
94
|
-
var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
|
125
|
+
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
|
95
126
|
target = $( options.of ),
|
96
127
|
within = $.position.getWithinInfo( options.within ),
|
97
128
|
scrollInfo = $.position.getScrollInfo( within ),
|
98
|
-
targetElem = target[0],
|
99
129
|
collision = ( options.collision || "flip" ).split( " " ),
|
100
130
|
offsets = {};
|
101
131
|
|
102
|
-
|
103
|
-
|
104
|
-
targetHeight = target.height();
|
105
|
-
targetOffset = { top: 0, left: 0 };
|
106
|
-
} else if ( $.isWindow( targetElem ) ) {
|
107
|
-
targetWidth = target.width();
|
108
|
-
targetHeight = target.height();
|
109
|
-
targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
|
110
|
-
} else if ( targetElem.preventDefault ) {
|
132
|
+
dimensions = getDimensions( target );
|
133
|
+
if ( target[0].preventDefault ) {
|
111
134
|
// force left top to allow flipping
|
112
135
|
options.at = "left top";
|
113
|
-
targetWidth = targetHeight = 0;
|
114
|
-
targetOffset = { top: targetElem.pageY, left: targetElem.pageX };
|
115
|
-
} else {
|
116
|
-
targetWidth = target.outerWidth();
|
117
|
-
targetHeight = target.outerHeight();
|
118
|
-
targetOffset = target.offset();
|
119
136
|
}
|
137
|
+
targetWidth = dimensions.width;
|
138
|
+
targetHeight = dimensions.height;
|
139
|
+
targetOffset = dimensions.offset;
|
120
140
|
// clone to reuse original targetOffset later
|
121
141
|
basePosition = $.extend( {}, targetOffset );
|
122
142
|
|
@@ -230,10 +250,6 @@ $.fn.position = function( options ) {
|
|
230
250
|
}
|
231
251
|
});
|
232
252
|
|
233
|
-
if ( $.fn.bgiframe ) {
|
234
|
-
elem.bgiframe();
|
235
|
-
}
|
236
|
-
|
237
253
|
if ( options.using ) {
|
238
254
|
// adds feedback as second argument to using callback, if present
|
239
255
|
using = function( props ) {
|
@@ -478,40 +494,4 @@ $.ui.position = {
|
|
478
494
|
testElementParent.removeChild( testElement );
|
479
495
|
})();
|
480
496
|
|
481
|
-
// DEPRECATED
|
482
|
-
if ( $.uiBackCompat !== false ) {
|
483
|
-
// offset option
|
484
|
-
(function( $ ) {
|
485
|
-
var _position = $.fn.position;
|
486
|
-
$.fn.position = function( options ) {
|
487
|
-
if ( !options || !options.offset ) {
|
488
|
-
return _position.call( this, options );
|
489
|
-
}
|
490
|
-
var offset = options.offset.split( " " ),
|
491
|
-
at = options.at.split( " " );
|
492
|
-
if ( offset.length === 1 ) {
|
493
|
-
offset[ 1 ] = offset[ 0 ];
|
494
|
-
}
|
495
|
-
if ( /^\d/.test( offset[ 0 ] ) ) {
|
496
|
-
offset[ 0 ] = "+" + offset[ 0 ];
|
497
|
-
}
|
498
|
-
if ( /^\d/.test( offset[ 1 ] ) ) {
|
499
|
-
offset[ 1 ] = "+" + offset[ 1 ];
|
500
|
-
}
|
501
|
-
if ( at.length === 1 ) {
|
502
|
-
if ( /left|center|right/.test( at[ 0 ] ) ) {
|
503
|
-
at[ 1 ] = "center";
|
504
|
-
} else {
|
505
|
-
at[ 1 ] = at[ 0 ];
|
506
|
-
at[ 0 ] = "center";
|
507
|
-
}
|
508
|
-
}
|
509
|
-
return _position.call( this, $.extend( options, {
|
510
|
-
at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
|
511
|
-
offset: undefined
|
512
|
-
} ) );
|
513
|
-
};
|
514
|
-
}( jQuery ) );
|
515
|
-
}
|
516
|
-
|
517
497
|
}( jQuery ) );
|
@@ -2,10 +2,10 @@
|
|
2
2
|
//= require jquery.ui.widget
|
3
3
|
|
4
4
|
/*!
|
5
|
-
* jQuery UI Progressbar 1.
|
5
|
+
* jQuery UI Progressbar 1.10.0
|
6
6
|
* http://jqueryui.com
|
7
7
|
*
|
8
|
-
* Copyright
|
8
|
+
* Copyright 2013 jQuery Foundation and other contributors
|
9
9
|
* Released under the MIT license.
|
10
10
|
* http://jquery.org/license
|
11
11
|
*
|
@@ -18,28 +18,33 @@
|
|
18
18
|
(function( $, undefined ) {
|
19
19
|
|
20
20
|
$.widget( "ui.progressbar", {
|
21
|
-
version: "1.
|
21
|
+
version: "1.10.0",
|
22
22
|
options: {
|
23
|
+
max: 100,
|
23
24
|
value: 0,
|
24
|
-
|
25
|
+
|
26
|
+
change: null,
|
27
|
+
complete: null
|
25
28
|
},
|
26
29
|
|
27
30
|
min: 0,
|
28
31
|
|
29
32
|
_create: function() {
|
33
|
+
// Constrain initial value
|
34
|
+
this.oldValue = this.options.value = this._constrainedValue();
|
35
|
+
|
30
36
|
this.element
|
31
37
|
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
|
32
38
|
.attr({
|
39
|
+
// Only set static values, aria-valuenow and aria-valuemax are
|
40
|
+
// set inside _refreshValue()
|
33
41
|
role: "progressbar",
|
34
|
-
"aria-valuemin": this.min
|
35
|
-
"aria-valuemax": this.options.max,
|
36
|
-
"aria-valuenow": this._value()
|
42
|
+
"aria-valuemin": this.min
|
37
43
|
});
|
38
44
|
|
39
45
|
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
|
40
46
|
.appendTo( this.element );
|
41
47
|
|
42
|
-
this.oldValue = this._value();
|
43
48
|
this._refreshValue();
|
44
49
|
},
|
45
50
|
|
@@ -56,52 +61,87 @@ $.widget( "ui.progressbar", {
|
|
56
61
|
|
57
62
|
value: function( newValue ) {
|
58
63
|
if ( newValue === undefined ) {
|
59
|
-
return this.
|
64
|
+
return this.options.value;
|
60
65
|
}
|
61
66
|
|
62
|
-
this.
|
63
|
-
|
67
|
+
this.options.value = this._constrainedValue( newValue );
|
68
|
+
this._refreshValue();
|
64
69
|
},
|
65
70
|
|
66
|
-
|
67
|
-
if (
|
68
|
-
this.options.value
|
69
|
-
this._refreshValue();
|
70
|
-
if ( this._value() === this.options.max ) {
|
71
|
-
this._trigger( "complete" );
|
72
|
-
}
|
71
|
+
_constrainedValue: function( newValue ) {
|
72
|
+
if ( newValue === undefined ) {
|
73
|
+
newValue = this.options.value;
|
73
74
|
}
|
74
75
|
|
75
|
-
this.
|
76
|
+
this.indeterminate = newValue === false;
|
77
|
+
|
78
|
+
// sanitize value
|
79
|
+
if ( typeof newValue !== "number" ) {
|
80
|
+
newValue = 0;
|
81
|
+
}
|
82
|
+
|
83
|
+
return this.indeterminate ? false :
|
84
|
+
Math.min( this.options.max, Math.max( this.min, newValue ) );
|
76
85
|
},
|
77
86
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
87
|
+
_setOptions: function( options ) {
|
88
|
+
// Ensure "value" option is set after other values (like max)
|
89
|
+
var value = options.value;
|
90
|
+
delete options.value;
|
91
|
+
|
92
|
+
this._super( options );
|
93
|
+
|
94
|
+
this.options.value = this._constrainedValue( value );
|
95
|
+
this._refreshValue();
|
96
|
+
},
|
97
|
+
|
98
|
+
_setOption: function( key, value ) {
|
99
|
+
if ( key === "max" ) {
|
100
|
+
// Don't allow a max less than min
|
101
|
+
value = Math.max( this.min, value );
|
83
102
|
}
|
84
|
-
|
103
|
+
|
104
|
+
this._super( key, value );
|
85
105
|
},
|
86
106
|
|
87
107
|
_percentage: function() {
|
88
|
-
return 100 * this.
|
108
|
+
return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
|
89
109
|
},
|
90
110
|
|
91
111
|
_refreshValue: function() {
|
92
|
-
var value = this.value
|
112
|
+
var value = this.options.value,
|
93
113
|
percentage = this._percentage();
|
94
114
|
|
115
|
+
this.valueDiv
|
116
|
+
.toggle( this.indeterminate || value > this.min )
|
117
|
+
.toggleClass( "ui-corner-right", value === this.options.max )
|
118
|
+
.width( percentage.toFixed(0) + "%" );
|
119
|
+
|
120
|
+
this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
|
121
|
+
|
122
|
+
if ( this.indeterminate ) {
|
123
|
+
this.element.removeAttr( "aria-valuenow" );
|
124
|
+
if ( !this.overlayDiv ) {
|
125
|
+
this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
|
126
|
+
}
|
127
|
+
} else {
|
128
|
+
this.element.attr({
|
129
|
+
"aria-valuemax": this.options.max,
|
130
|
+
"aria-valuenow": value
|
131
|
+
});
|
132
|
+
if ( this.overlayDiv ) {
|
133
|
+
this.overlayDiv.remove();
|
134
|
+
this.overlayDiv = null;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
95
138
|
if ( this.oldValue !== value ) {
|
96
139
|
this.oldValue = value;
|
97
140
|
this._trigger( "change" );
|
98
141
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
.toggleClass( "ui-corner-right", value === this.options.max )
|
103
|
-
.width( percentage.toFixed(0) + "%" );
|
104
|
-
this.element.attr( "aria-valuenow", value );
|
142
|
+
if ( value === this.options.max ) {
|
143
|
+
this._trigger( "complete" );
|
144
|
+
}
|
105
145
|
}
|
106
146
|
});
|
107
147
|
|