jquery-ui-rails 4.2.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/History.md +6 -0
- data/README.md +69 -73
- data/Rakefile +28 -24
- data/VERSIONS.md +1 -0
- data/app/assets/javascripts/jquery-ui.js +37 -0
- data/app/assets/javascripts/{jquery.ui.accordion.js → jquery-ui/accordion.js} +62 -57
- data/app/assets/javascripts/{jquery.ui.autocomplete.js → jquery-ui/autocomplete.js} +70 -50
- data/app/assets/javascripts/{jquery.ui.button.js → jquery-ui/button.js} +41 -25
- data/app/assets/javascripts/{jquery.ui.core.js → jquery-ui/core.js} +106 -123
- data/app/assets/javascripts/jquery-ui/datepicker-af.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ar-DZ.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ar.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-az.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-be.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-bg.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-bs.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ca.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-cs.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-cy-GB.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-da.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-de.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-el.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-AU.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-GB.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-NZ.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-eo.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-es.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-et.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-eu.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fa.js +73 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fo.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CA.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr.js +39 -0
- data/app/assets/javascripts/jquery-ui/datepicker-gl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-he.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hu.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hy.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-id.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-is.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-it-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-it.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ja.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ka.js +35 -0
- data/app/assets/javascripts/jquery-ui/datepicker-kk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-km.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ko.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ky.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lb.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lt.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lv.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-mk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ml.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ms.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nb.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nl-BE.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nn.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-no.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pt-BR.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pt.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-rm.js +35 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ro.js +40 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ru.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sl.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sq.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sr-SR.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sv.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ta.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-th.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-tj.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-tr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-uk.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-vi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-CN.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-HK.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-TW.js +37 -0
- data/app/assets/javascripts/{jquery.ui.datepicker.js → jquery-ui/datepicker.js} +72 -37
- data/app/assets/javascripts/{jquery.ui.dialog.js → jquery-ui/dialog.js} +215 -180
- data/app/assets/javascripts/{jquery.ui.draggable.js → jquery-ui/draggable.js} +219 -161
- data/app/assets/javascripts/jquery-ui/droppable.js +421 -0
- data/app/assets/javascripts/{jquery.ui.effect-blind.js → jquery-ui/effect-blind.js} +20 -12
- data/app/assets/javascripts/{jquery.ui.effect-bounce.js → jquery-ui/effect-bounce.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-clip.js → jquery-ui/effect-clip.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-drop.js → jquery-ui/effect-drop.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-explode.js → jquery-ui/effect-explode.js} +20 -10
- data/app/assets/javascripts/{jquery.ui.effect-fade.js → jquery-ui/effect-fade.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-fold.js → jquery-ui/effect-fold.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-highlight.js → jquery-ui/effect-highlight.js} +18 -8
- data/app/assets/javascripts/jquery-ui/effect-puff.js +63 -0
- data/app/assets/javascripts/{jquery.ui.effect-pulsate.js → jquery-ui/effect-pulsate.js} +18 -8
- data/app/assets/javascripts/jquery-ui/effect-scale.js +92 -0
- data/app/assets/javascripts/{jquery.ui.effect-shake.js → jquery-ui/effect-shake.js} +19 -9
- data/app/assets/javascripts/{jquery.ui.effect-scale.js → jquery-ui/effect-size.js} +19 -104
- data/app/assets/javascripts/{jquery.ui.effect-slide.js → jquery-ui/effect-slide.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-transfer.js → jquery-ui/effect-transfer.js} +22 -12
- data/app/assets/javascripts/jquery-ui/effect.all.js +16 -0
- data/app/assets/javascripts/{jquery.ui.effect.js → jquery-ui/effect.js} +28 -20
- data/app/assets/javascripts/{jquery.ui.menu.js → jquery-ui/menu.js} +93 -80
- data/app/assets/javascripts/{jquery.ui.mouse.js → jquery-ui/mouse.js} +41 -23
- data/app/assets/javascripts/{jquery.ui.position.js → jquery-ui/position.js} +25 -12
- data/app/assets/javascripts/{jquery.ui.progressbar.js → jquery-ui/progressbar.js} +26 -12
- data/app/assets/javascripts/{jquery.ui.resizable.js → jquery-ui/resizable.js} +196 -146
- data/app/assets/javascripts/{jquery.ui.selectable.js → jquery-ui/selectable.js} +25 -15
- data/app/assets/javascripts/jquery-ui/selectmenu.js +560 -0
- data/app/assets/javascripts/{jquery.ui.slider.js → jquery-ui/slider.js} +43 -31
- data/app/assets/javascripts/{jquery.ui.sortable.js → jquery-ui/sortable.js} +71 -50
- data/app/assets/javascripts/{jquery.ui.spinner.js → jquery-ui/spinner.js} +46 -29
- data/app/assets/javascripts/{jquery.ui.tabs.js → jquery-ui/tabs.js} +69 -52
- data/app/assets/javascripts/{jquery.ui.tooltip.js → jquery-ui/tooltip.js} +97 -55
- data/app/assets/javascripts/{jquery.ui.widget.js → jquery-ui/widget.js} +52 -30
- data/app/assets/stylesheets/jquery-ui.css +1 -0
- data/app/assets/stylesheets/{jquery.ui.accordion.css.erb → jquery-ui/accordion.css.erb} +5 -7
- data/app/assets/stylesheets/{jquery.ui.all.css.erb → jquery-ui/all.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.autocomplete.css.erb → jquery-ui/autocomplete.css.erb} +4 -4
- data/app/assets/stylesheets/jquery-ui/base.css.erb +30 -0
- data/app/assets/stylesheets/{jquery.ui.button.css.erb → jquery-ui/button.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.core.css.erb → jquery-ui/core.css.erb} +4 -1
- data/app/assets/stylesheets/{jquery.ui.datepicker.css.erb → jquery-ui/datepicker.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.dialog.css.erb → jquery-ui/dialog.css.erb} +6 -5
- data/app/assets/stylesheets/jquery-ui/draggable.css.erb +16 -0
- data/app/assets/stylesheets/{jquery.ui.menu.css.erb → jquery-ui/menu.css.erb} +18 -34
- data/app/assets/stylesheets/{jquery.ui.progressbar.css.erb → jquery-ui/progressbar.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.resizable.css.erb → jquery-ui/resizable.css.erb} +5 -3
- data/app/assets/stylesheets/{jquery.ui.selectable.css.erb → jquery-ui/selectable.css.erb} +7 -3
- data/app/assets/stylesheets/jquery-ui/selectmenu.css.erb +64 -0
- data/app/assets/stylesheets/{jquery.ui.slider.css.erb → jquery-ui/slider.css.erb} +5 -3
- data/app/assets/stylesheets/jquery-ui/sortable.css.erb +16 -0
- data/app/assets/stylesheets/{jquery.ui.spinner.css.erb → jquery-ui/spinner.css.erb} +4 -4
- data/app/assets/stylesheets/{jquery.ui.tabs.css.erb → jquery-ui/tabs.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.theme.css.erb → jquery-ui/theme.css.erb} +1 -4
- data/app/assets/stylesheets/{jquery.ui.tooltip.css.erb → jquery-ui/tooltip.css.erb} +3 -3
- data/lib/jquery/ui/rails/version.rb +2 -2
- metadata +137 -129
- data/app/assets/javascripts/jquery.ui.all.js +0 -34
- data/app/assets/javascripts/jquery.ui.datepicker-af.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ar.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-az.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-be.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-bg.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-bs.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ca.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-cs.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-cy-GB.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-da.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-de.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-el.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-en-AU.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-en-GB.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-en-NZ.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-eo.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-es.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-et.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-eu.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fa.js +0 -59
- data/app/assets/javascripts/jquery.ui.datepicker-fi.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fo.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fr-CA.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fr-CH.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fr.js +0 -25
- data/app/assets/javascripts/jquery.ui.datepicker-gl.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-he.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hi.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hr.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hu.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hy.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-id.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-is.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-it.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ja.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ka.js +0 -21
- data/app/assets/javascripts/jquery.ui.datepicker-kk.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-km.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ko.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ky.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-lb.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-lt.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-lv.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-mk.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ml.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ms.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-nb.js +0 -22
- data/app/assets/javascripts/jquery.ui.datepicker-nl-BE.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-nl.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-nn.js +0 -22
- data/app/assets/javascripts/jquery.ui.datepicker-no.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-pl.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-pt-BR.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-pt.js +0 -22
- data/app/assets/javascripts/jquery.ui.datepicker-rm.js +0 -21
- data/app/assets/javascripts/jquery.ui.datepicker-ro.js +0 -26
- data/app/assets/javascripts/jquery.ui.datepicker-ru.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sk.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sl.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-sq.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sr-SR.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sr.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sv.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ta.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-th.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-tj.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-tr.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-uk.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-vi.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-zh-CN.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-zh-HK.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-zh-TW.js +0 -23
- data/app/assets/javascripts/jquery.ui.droppable.js +0 -394
- data/app/assets/javascripts/jquery.ui.effect.all.js +0 -14
- data/app/assets/stylesheets/jquery.ui.base.css.erb +0 -27
@@ -1,9 +1,9 @@
|
|
1
|
-
//= require jquery
|
2
|
-
//= require jquery
|
3
|
-
//= require jquery
|
1
|
+
//= require jquery-ui/core
|
2
|
+
//= require jquery-ui/widget
|
3
|
+
//= require jquery-ui/mouse
|
4
4
|
|
5
5
|
/*!
|
6
|
-
* jQuery UI Selectable 1.
|
6
|
+
* jQuery UI Selectable 1.11.0
|
7
7
|
* http://jqueryui.com
|
8
8
|
*
|
9
9
|
* Copyright 2014 jQuery Foundation and other contributors
|
@@ -11,16 +11,26 @@
|
|
11
11
|
* http://jquery.org/license
|
12
12
|
*
|
13
13
|
* http://api.jqueryui.com/selectable/
|
14
|
-
*
|
15
|
-
* Depends:
|
16
|
-
* jquery.ui.core.js
|
17
|
-
* jquery.ui.mouse.js
|
18
|
-
* jquery.ui.widget.js
|
19
14
|
*/
|
20
|
-
(function(
|
15
|
+
(function( factory ) {
|
16
|
+
if ( typeof define === "function" && define.amd ) {
|
17
|
+
|
18
|
+
// AMD. Register as an anonymous module.
|
19
|
+
define([
|
20
|
+
"jquery",
|
21
|
+
"./core",
|
22
|
+
"./mouse",
|
23
|
+
"./widget"
|
24
|
+
], factory );
|
25
|
+
} else {
|
26
|
+
|
27
|
+
// Browser globals
|
28
|
+
factory( jQuery );
|
29
|
+
}
|
30
|
+
}(function( $ ) {
|
21
31
|
|
22
|
-
$.widget("ui.selectable", $.ui.mouse, {
|
23
|
-
version: "1.
|
32
|
+
return $.widget("ui.selectable", $.ui.mouse, {
|
33
|
+
version: "1.11.0",
|
24
34
|
options: {
|
25
35
|
appendTo: "body",
|
26
36
|
autoRefresh: true,
|
@@ -87,7 +97,7 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|
87
97
|
var that = this,
|
88
98
|
options = this.options;
|
89
99
|
|
90
|
-
this.opos = [event.pageX, event.pageY];
|
100
|
+
this.opos = [ event.pageX, event.pageY ];
|
91
101
|
|
92
102
|
if (this.options.disabled) {
|
93
103
|
return;
|
@@ -170,7 +180,7 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|
170
180
|
|
171
181
|
if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
|
172
182
|
if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
|
173
|
-
this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
|
183
|
+
this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
|
174
184
|
|
175
185
|
this.selectees.each(function() {
|
176
186
|
var selectee = $.data(this, "selectable-item"),
|
@@ -278,4 +288,4 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|
278
288
|
|
279
289
|
});
|
280
290
|
|
281
|
-
})
|
291
|
+
}));
|
@@ -0,0 +1,560 @@
|
|
1
|
+
//= require jquery-ui/core
|
2
|
+
//= require jquery-ui/widget
|
3
|
+
//= require jquery-ui/position
|
4
|
+
//= require jquery-ui/menu
|
5
|
+
|
6
|
+
/*!
|
7
|
+
* jQuery UI Selectmenu 1.11.0
|
8
|
+
* http://jqueryui.com
|
9
|
+
*
|
10
|
+
* Copyright 2014 jQuery Foundation and other contributors
|
11
|
+
* Released under the MIT license.
|
12
|
+
* http://jquery.org/license
|
13
|
+
*
|
14
|
+
* http://api.jqueryui.com/selectmenu
|
15
|
+
*/
|
16
|
+
(function( factory ) {
|
17
|
+
if ( typeof define === "function" && define.amd ) {
|
18
|
+
|
19
|
+
// AMD. Register as an anonymous module.
|
20
|
+
define([
|
21
|
+
"jquery",
|
22
|
+
"./core",
|
23
|
+
"./widget",
|
24
|
+
"./position",
|
25
|
+
"./menu"
|
26
|
+
], factory );
|
27
|
+
} else {
|
28
|
+
|
29
|
+
// Browser globals
|
30
|
+
factory( jQuery );
|
31
|
+
}
|
32
|
+
}(function( $ ) {
|
33
|
+
|
34
|
+
return $.widget( "ui.selectmenu", {
|
35
|
+
version: "1.11.0",
|
36
|
+
defaultElement: "<select>",
|
37
|
+
options: {
|
38
|
+
appendTo: null,
|
39
|
+
disabled: null,
|
40
|
+
icons: {
|
41
|
+
button: "ui-icon-triangle-1-s"
|
42
|
+
},
|
43
|
+
position: {
|
44
|
+
my: "left top",
|
45
|
+
at: "left bottom",
|
46
|
+
collision: "none"
|
47
|
+
},
|
48
|
+
width: null,
|
49
|
+
|
50
|
+
// callbacks
|
51
|
+
change: null,
|
52
|
+
close: null,
|
53
|
+
focus: null,
|
54
|
+
open: null,
|
55
|
+
select: null
|
56
|
+
},
|
57
|
+
|
58
|
+
_create: function() {
|
59
|
+
var selectmenuId = this.element.uniqueId().attr( "id" );
|
60
|
+
this.ids = {
|
61
|
+
element: selectmenuId,
|
62
|
+
button: selectmenuId + "-button",
|
63
|
+
menu: selectmenuId + "-menu"
|
64
|
+
};
|
65
|
+
|
66
|
+
this._drawButton();
|
67
|
+
this._drawMenu();
|
68
|
+
|
69
|
+
if ( this.options.disabled ) {
|
70
|
+
this.disable();
|
71
|
+
}
|
72
|
+
},
|
73
|
+
|
74
|
+
_drawButton: function() {
|
75
|
+
var that = this,
|
76
|
+
tabindex = this.element.attr( "tabindex" );
|
77
|
+
|
78
|
+
// Associate existing label with the new button
|
79
|
+
this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
|
80
|
+
this._on( this.label, {
|
81
|
+
click: function( event ) {
|
82
|
+
this.button.focus();
|
83
|
+
event.preventDefault();
|
84
|
+
}
|
85
|
+
});
|
86
|
+
|
87
|
+
// Hide original select element
|
88
|
+
this.element.hide();
|
89
|
+
|
90
|
+
// Create button
|
91
|
+
this.button = $( "<span>", {
|
92
|
+
"class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
|
93
|
+
tabindex: tabindex || this.options.disabled ? -1 : 0,
|
94
|
+
id: this.ids.button,
|
95
|
+
role: "combobox",
|
96
|
+
"aria-expanded": "false",
|
97
|
+
"aria-autocomplete": "list",
|
98
|
+
"aria-owns": this.ids.menu,
|
99
|
+
"aria-haspopup": "true"
|
100
|
+
})
|
101
|
+
.insertAfter( this.element );
|
102
|
+
|
103
|
+
$( "<span>", {
|
104
|
+
"class": "ui-icon " + this.options.icons.button
|
105
|
+
})
|
106
|
+
.prependTo( this.button );
|
107
|
+
|
108
|
+
this.buttonText = $( "<span>", {
|
109
|
+
"class": "ui-selectmenu-text"
|
110
|
+
})
|
111
|
+
.appendTo( this.button );
|
112
|
+
|
113
|
+
this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
|
114
|
+
this._setOption( "width", this.options.width );
|
115
|
+
|
116
|
+
this._on( this.button, this._buttonEvents );
|
117
|
+
this.button.one( "focusin", function() {
|
118
|
+
|
119
|
+
// Delay rendering the menu items until the button receives focus.
|
120
|
+
// The menu may have already been rendered via a programmatic open.
|
121
|
+
if ( !that.menuItems ) {
|
122
|
+
that._refreshMenu();
|
123
|
+
}
|
124
|
+
});
|
125
|
+
this._hoverable( this.button );
|
126
|
+
this._focusable( this.button );
|
127
|
+
},
|
128
|
+
|
129
|
+
_drawMenu: function() {
|
130
|
+
var that = this;
|
131
|
+
|
132
|
+
// Create menu
|
133
|
+
this.menu = $( "<ul>", {
|
134
|
+
"aria-hidden": "true",
|
135
|
+
"aria-labelledby": this.ids.button,
|
136
|
+
id: this.ids.menu
|
137
|
+
});
|
138
|
+
|
139
|
+
// Wrap menu
|
140
|
+
this.menuWrap = $( "<div>", {
|
141
|
+
"class": "ui-selectmenu-menu ui-front"
|
142
|
+
})
|
143
|
+
.append( this.menu )
|
144
|
+
.appendTo( this._appendTo() );
|
145
|
+
|
146
|
+
// Initialize menu widget
|
147
|
+
this.menuInstance = this.menu
|
148
|
+
.menu({
|
149
|
+
role: "listbox",
|
150
|
+
select: function( event, ui ) {
|
151
|
+
event.preventDefault();
|
152
|
+
that._select( ui.item.data( "ui-selectmenu-item" ), event );
|
153
|
+
},
|
154
|
+
focus: function( event, ui ) {
|
155
|
+
var item = ui.item.data( "ui-selectmenu-item" );
|
156
|
+
|
157
|
+
// Prevent inital focus from firing and check if its a newly focused item
|
158
|
+
if ( that.focusIndex != null && item.index !== that.focusIndex ) {
|
159
|
+
that._trigger( "focus", event, { item: item } );
|
160
|
+
if ( !that.isOpen ) {
|
161
|
+
that._select( item, event );
|
162
|
+
}
|
163
|
+
}
|
164
|
+
that.focusIndex = item.index;
|
165
|
+
|
166
|
+
that.button.attr( "aria-activedescendant",
|
167
|
+
that.menuItems.eq( item.index ).attr( "id" ) );
|
168
|
+
}
|
169
|
+
})
|
170
|
+
.menu( "instance" );
|
171
|
+
|
172
|
+
// Adjust menu styles to dropdown
|
173
|
+
this.menu
|
174
|
+
.addClass( "ui-corner-bottom" )
|
175
|
+
.removeClass( "ui-corner-all" );
|
176
|
+
|
177
|
+
// Don't close the menu on mouseleave
|
178
|
+
this.menuInstance._off( this.menu, "mouseleave" );
|
179
|
+
|
180
|
+
// Cancel the menu's collapseAll on document click
|
181
|
+
this.menuInstance._closeOnDocumentClick = function() {
|
182
|
+
return false;
|
183
|
+
};
|
184
|
+
|
185
|
+
// Selects often contain empty items, but never contain dividers
|
186
|
+
this.menuInstance._isDivider = function() {
|
187
|
+
return false;
|
188
|
+
};
|
189
|
+
},
|
190
|
+
|
191
|
+
refresh: function() {
|
192
|
+
this._refreshMenu();
|
193
|
+
this._setText( this.buttonText, this._getSelectedItem().text() );
|
194
|
+
this._setOption( "width", this.options.width );
|
195
|
+
},
|
196
|
+
|
197
|
+
_refreshMenu: function() {
|
198
|
+
this.menu.empty();
|
199
|
+
|
200
|
+
var item,
|
201
|
+
options = this.element.find( "option" );
|
202
|
+
|
203
|
+
if ( !options.length ) {
|
204
|
+
return;
|
205
|
+
}
|
206
|
+
|
207
|
+
this._parseOptions( options );
|
208
|
+
this._renderMenu( this.menu, this.items );
|
209
|
+
|
210
|
+
this.menuInstance.refresh();
|
211
|
+
this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
|
212
|
+
|
213
|
+
item = this._getSelectedItem();
|
214
|
+
|
215
|
+
// Update the menu to have the correct item focused
|
216
|
+
this.menuInstance.focus( null, item );
|
217
|
+
this._setAria( item.data( "ui-selectmenu-item" ) );
|
218
|
+
|
219
|
+
// Set disabled state
|
220
|
+
this._setOption( "disabled", this.element.prop( "disabled" ) );
|
221
|
+
},
|
222
|
+
|
223
|
+
open: function( event ) {
|
224
|
+
if ( this.options.disabled ) {
|
225
|
+
return;
|
226
|
+
}
|
227
|
+
|
228
|
+
// If this is the first time the menu is being opened, render the items
|
229
|
+
if ( !this.menuItems ) {
|
230
|
+
this._refreshMenu();
|
231
|
+
} else {
|
232
|
+
|
233
|
+
// Menu clears focus on close, reset focus to selected item
|
234
|
+
this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
|
235
|
+
this.menuInstance.focus( null, this._getSelectedItem() );
|
236
|
+
}
|
237
|
+
|
238
|
+
this.isOpen = true;
|
239
|
+
this._toggleAttr();
|
240
|
+
this._resizeMenu();
|
241
|
+
this._position();
|
242
|
+
|
243
|
+
this._on( this.document, this._documentClick );
|
244
|
+
|
245
|
+
this._trigger( "open", event );
|
246
|
+
},
|
247
|
+
|
248
|
+
_position: function() {
|
249
|
+
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
|
250
|
+
},
|
251
|
+
|
252
|
+
close: function( event ) {
|
253
|
+
if ( !this.isOpen ) {
|
254
|
+
return;
|
255
|
+
}
|
256
|
+
|
257
|
+
this.isOpen = false;
|
258
|
+
this._toggleAttr();
|
259
|
+
|
260
|
+
this._off( this.document );
|
261
|
+
|
262
|
+
this._trigger( "close", event );
|
263
|
+
},
|
264
|
+
|
265
|
+
widget: function() {
|
266
|
+
return this.button;
|
267
|
+
},
|
268
|
+
|
269
|
+
menuWidget: function() {
|
270
|
+
return this.menu;
|
271
|
+
},
|
272
|
+
|
273
|
+
_renderMenu: function( ul, items ) {
|
274
|
+
var that = this,
|
275
|
+
currentOptgroup = "";
|
276
|
+
|
277
|
+
$.each( items, function( index, item ) {
|
278
|
+
if ( item.optgroup !== currentOptgroup ) {
|
279
|
+
$( "<li>", {
|
280
|
+
"class": "ui-selectmenu-optgroup ui-menu-divider" +
|
281
|
+
( item.element.parent( "optgroup" ).prop( "disabled" ) ?
|
282
|
+
" ui-state-disabled" :
|
283
|
+
"" ),
|
284
|
+
text: item.optgroup
|
285
|
+
})
|
286
|
+
.appendTo( ul );
|
287
|
+
|
288
|
+
currentOptgroup = item.optgroup;
|
289
|
+
}
|
290
|
+
|
291
|
+
that._renderItemData( ul, item );
|
292
|
+
});
|
293
|
+
},
|
294
|
+
|
295
|
+
_renderItemData: function( ul, item ) {
|
296
|
+
return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
|
297
|
+
},
|
298
|
+
|
299
|
+
_renderItem: function( ul, item ) {
|
300
|
+
var li = $( "<li>" );
|
301
|
+
|
302
|
+
if ( item.disabled ) {
|
303
|
+
li.addClass( "ui-state-disabled" );
|
304
|
+
}
|
305
|
+
this._setText( li, item.label );
|
306
|
+
|
307
|
+
return li.appendTo( ul );
|
308
|
+
},
|
309
|
+
|
310
|
+
_setText: function( element, value ) {
|
311
|
+
if ( value ) {
|
312
|
+
element.text( value );
|
313
|
+
} else {
|
314
|
+
element.html( " " );
|
315
|
+
}
|
316
|
+
},
|
317
|
+
|
318
|
+
_move: function( direction, event ) {
|
319
|
+
var item, next,
|
320
|
+
filter = ".ui-menu-item";
|
321
|
+
|
322
|
+
if ( this.isOpen ) {
|
323
|
+
item = this.menuItems.eq( this.focusIndex );
|
324
|
+
} else {
|
325
|
+
item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
|
326
|
+
filter += ":not(.ui-state-disabled)";
|
327
|
+
}
|
328
|
+
|
329
|
+
if ( direction === "first" || direction === "last" ) {
|
330
|
+
next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
|
331
|
+
} else {
|
332
|
+
next = item[ direction + "All" ]( filter ).eq( 0 );
|
333
|
+
}
|
334
|
+
|
335
|
+
if ( next.length ) {
|
336
|
+
this.menuInstance.focus( event, next );
|
337
|
+
}
|
338
|
+
},
|
339
|
+
|
340
|
+
_getSelectedItem: function() {
|
341
|
+
return this.menuItems.eq( this.element[ 0 ].selectedIndex );
|
342
|
+
},
|
343
|
+
|
344
|
+
_toggle: function( event ) {
|
345
|
+
this[ this.isOpen ? "close" : "open" ]( event );
|
346
|
+
},
|
347
|
+
|
348
|
+
_documentClick: {
|
349
|
+
mousedown: function( event ) {
|
350
|
+
if ( !this.isOpen ) {
|
351
|
+
return;
|
352
|
+
}
|
353
|
+
|
354
|
+
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
|
355
|
+
this.close( event );
|
356
|
+
}
|
357
|
+
}
|
358
|
+
},
|
359
|
+
|
360
|
+
_buttonEvents: {
|
361
|
+
click: "_toggle",
|
362
|
+
keydown: function( event ) {
|
363
|
+
var preventDefault = true;
|
364
|
+
switch ( event.keyCode ) {
|
365
|
+
case $.ui.keyCode.TAB:
|
366
|
+
case $.ui.keyCode.ESCAPE:
|
367
|
+
this.close( event );
|
368
|
+
preventDefault = false;
|
369
|
+
break;
|
370
|
+
case $.ui.keyCode.ENTER:
|
371
|
+
if ( this.isOpen ) {
|
372
|
+
this._selectFocusedItem( event );
|
373
|
+
}
|
374
|
+
break;
|
375
|
+
case $.ui.keyCode.UP:
|
376
|
+
if ( event.altKey ) {
|
377
|
+
this._toggle( event );
|
378
|
+
} else {
|
379
|
+
this._move( "prev", event );
|
380
|
+
}
|
381
|
+
break;
|
382
|
+
case $.ui.keyCode.DOWN:
|
383
|
+
if ( event.altKey ) {
|
384
|
+
this._toggle( event );
|
385
|
+
} else {
|
386
|
+
this._move( "next", event );
|
387
|
+
}
|
388
|
+
break;
|
389
|
+
case $.ui.keyCode.SPACE:
|
390
|
+
if ( this.isOpen ) {
|
391
|
+
this._selectFocusedItem( event );
|
392
|
+
} else {
|
393
|
+
this._toggle( event );
|
394
|
+
}
|
395
|
+
break;
|
396
|
+
case $.ui.keyCode.LEFT:
|
397
|
+
this._move( "prev", event );
|
398
|
+
break;
|
399
|
+
case $.ui.keyCode.RIGHT:
|
400
|
+
this._move( "next", event );
|
401
|
+
break;
|
402
|
+
case $.ui.keyCode.HOME:
|
403
|
+
case $.ui.keyCode.PAGE_UP:
|
404
|
+
this._move( "first", event );
|
405
|
+
break;
|
406
|
+
case $.ui.keyCode.END:
|
407
|
+
case $.ui.keyCode.PAGE_DOWN:
|
408
|
+
this._move( "last", event );
|
409
|
+
break;
|
410
|
+
default:
|
411
|
+
this.menu.trigger( event );
|
412
|
+
preventDefault = false;
|
413
|
+
}
|
414
|
+
|
415
|
+
if ( preventDefault ) {
|
416
|
+
event.preventDefault();
|
417
|
+
}
|
418
|
+
}
|
419
|
+
},
|
420
|
+
|
421
|
+
_selectFocusedItem: function( event ) {
|
422
|
+
var item = this.menuItems.eq( this.focusIndex );
|
423
|
+
if ( !item.hasClass( "ui-state-disabled" ) ) {
|
424
|
+
this._select( item.data( "ui-selectmenu-item" ), event );
|
425
|
+
}
|
426
|
+
},
|
427
|
+
|
428
|
+
_select: function( item, event ) {
|
429
|
+
var oldIndex = this.element[ 0 ].selectedIndex;
|
430
|
+
|
431
|
+
// Change native select element
|
432
|
+
this.element[ 0 ].selectedIndex = item.index;
|
433
|
+
this._setText( this.buttonText, item.label );
|
434
|
+
this._setAria( item );
|
435
|
+
this._trigger( "select", event, { item: item } );
|
436
|
+
|
437
|
+
if ( item.index !== oldIndex ) {
|
438
|
+
this._trigger( "change", event, { item: item } );
|
439
|
+
}
|
440
|
+
|
441
|
+
this.close( event );
|
442
|
+
},
|
443
|
+
|
444
|
+
_setAria: function( item ) {
|
445
|
+
var id = this.menuItems.eq( item.index ).attr( "id" );
|
446
|
+
|
447
|
+
this.button.attr({
|
448
|
+
"aria-labelledby": id,
|
449
|
+
"aria-activedescendant": id
|
450
|
+
});
|
451
|
+
this.menu.attr( "aria-activedescendant", id );
|
452
|
+
},
|
453
|
+
|
454
|
+
_setOption: function( key, value ) {
|
455
|
+
if ( key === "icons" ) {
|
456
|
+
this.button.find( "span.ui-icon" )
|
457
|
+
.removeClass( this.options.icons.button )
|
458
|
+
.addClass( value.button );
|
459
|
+
}
|
460
|
+
|
461
|
+
this._super( key, value );
|
462
|
+
|
463
|
+
if ( key === "appendTo" ) {
|
464
|
+
this.menuWrap.appendTo( this._appendTo() );
|
465
|
+
}
|
466
|
+
|
467
|
+
if ( key === "disabled" ) {
|
468
|
+
this.menuInstance.option( "disabled", value );
|
469
|
+
this.button
|
470
|
+
.toggleClass( "ui-state-disabled", value )
|
471
|
+
.attr( "aria-disabled", value );
|
472
|
+
|
473
|
+
this.element.prop( "disabled", value );
|
474
|
+
if ( value ) {
|
475
|
+
this.button.attr( "tabindex", -1 );
|
476
|
+
this.close();
|
477
|
+
} else {
|
478
|
+
this.button.attr( "tabindex", 0 );
|
479
|
+
}
|
480
|
+
}
|
481
|
+
|
482
|
+
if ( key === "width" ) {
|
483
|
+
if ( !value ) {
|
484
|
+
value = this.element.outerWidth();
|
485
|
+
}
|
486
|
+
this.button.outerWidth( value );
|
487
|
+
}
|
488
|
+
},
|
489
|
+
|
490
|
+
_appendTo: function() {
|
491
|
+
var element = this.options.appendTo;
|
492
|
+
|
493
|
+
if ( element ) {
|
494
|
+
element = element.jquery || element.nodeType ?
|
495
|
+
$( element ) :
|
496
|
+
this.document.find( element ).eq( 0 );
|
497
|
+
}
|
498
|
+
|
499
|
+
if ( !element || !element[ 0 ] ) {
|
500
|
+
element = this.element.closest( ".ui-front" );
|
501
|
+
}
|
502
|
+
|
503
|
+
if ( !element.length ) {
|
504
|
+
element = this.document[ 0 ].body;
|
505
|
+
}
|
506
|
+
|
507
|
+
return element;
|
508
|
+
},
|
509
|
+
|
510
|
+
_toggleAttr: function() {
|
511
|
+
this.button
|
512
|
+
.toggleClass( "ui-corner-top", this.isOpen )
|
513
|
+
.toggleClass( "ui-corner-all", !this.isOpen )
|
514
|
+
.attr( "aria-expanded", this.isOpen );
|
515
|
+
this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
|
516
|
+
this.menu.attr( "aria-hidden", !this.isOpen );
|
517
|
+
},
|
518
|
+
|
519
|
+
_resizeMenu: function() {
|
520
|
+
this.menu.outerWidth( Math.max(
|
521
|
+
this.button.outerWidth(),
|
522
|
+
|
523
|
+
// support: IE10
|
524
|
+
// IE10 wraps long text (possibly a rounding bug)
|
525
|
+
// so we add 1px to avoid the wrapping
|
526
|
+
this.menu.width( "" ).outerWidth() + 1
|
527
|
+
) );
|
528
|
+
},
|
529
|
+
|
530
|
+
_getCreateOptions: function() {
|
531
|
+
return { disabled: this.element.prop( "disabled" ) };
|
532
|
+
},
|
533
|
+
|
534
|
+
_parseOptions: function( options ) {
|
535
|
+
var data = [];
|
536
|
+
options.each(function( index, item ) {
|
537
|
+
var option = $( item ),
|
538
|
+
optgroup = option.parent( "optgroup" );
|
539
|
+
data.push({
|
540
|
+
element: option,
|
541
|
+
index: index,
|
542
|
+
value: option.attr( "value" ),
|
543
|
+
label: option.text(),
|
544
|
+
optgroup: optgroup.attr( "label" ) || "",
|
545
|
+
disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
|
546
|
+
});
|
547
|
+
});
|
548
|
+
this.items = data;
|
549
|
+
},
|
550
|
+
|
551
|
+
_destroy: function() {
|
552
|
+
this.menuWrap.remove();
|
553
|
+
this.button.remove();
|
554
|
+
this.element.show();
|
555
|
+
this.element.removeUniqueId();
|
556
|
+
this.label.attr( "for", this.ids.element );
|
557
|
+
}
|
558
|
+
});
|
559
|
+
|
560
|
+
}));
|