jquery-ui-rails-test 6.0.2
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.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/.travis.yml +2 -0
- data/Gemfile +3 -0
- data/History.md +172 -0
- data/License.txt +2 -0
- data/README.md +311 -0
- data/Rakefile +261 -0
- data/VERSIONS.md +40 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/javascripts/jquery-ui/core.js +15 -0
- data/app/assets/javascripts/jquery-ui/data.js +45 -0
- data/app/assets/javascripts/jquery-ui/disable-selection.js +51 -0
- data/app/assets/javascripts/jquery-ui/effect.all.js +15 -0
- data/app/assets/javascripts/jquery-ui/effect.js +975 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +76 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +116 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +71 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +75 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +117 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +53 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +95 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +63 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +49 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +70 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +63 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +80 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-size.js +199 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +82 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +46 -0
- data/app/assets/javascripts/jquery-ui/focusable.js +89 -0
- data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +83 -0
- data/app/assets/javascripts/jquery-ui/form.js +25 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +76 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +51 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +52 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +52 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +53 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +47 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +64 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +43 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +56 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +40 -0
- data/app/assets/javascripts/jquery-ui/ie.js +20 -0
- data/app/assets/javascripts/jquery-ui/jquery-patch.js +91 -0
- data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
- data/app/assets/javascripts/jquery-ui/keycode.js +51 -0
- data/app/assets/javascripts/jquery-ui/labels.js +71 -0
- data/app/assets/javascripts/jquery-ui/plugin.js +49 -0
- data/app/assets/javascripts/jquery-ui/position.js +513 -0
- data/app/assets/javascripts/jquery-ui/safe-active-element.js +46 -0
- data/app/assets/javascripts/jquery-ui/safe-blur.js +27 -0
- data/app/assets/javascripts/jquery-ui/scroll-parent.js +50 -0
- data/app/assets/javascripts/jquery-ui/tabbable.js +41 -0
- data/app/assets/javascripts/jquery-ui/unique-id.js +54 -0
- data/app/assets/javascripts/jquery-ui/vendor/jquery-color/LICENSE.txt +43 -0
- data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +722 -0
- data/app/assets/javascripts/jquery-ui/version.js +20 -0
- data/app/assets/javascripts/jquery-ui/widget.js +758 -0
- data/app/assets/javascripts/jquery-ui/widgets/accordion.js +627 -0
- data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +685 -0
- data/app/assets/javascripts/jquery-ui/widgets/button.js +454 -0
- data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +289 -0
- data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +304 -0
- data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +2243 -0
- data/app/assets/javascripts/jquery-ui/widgets/dialog.js +968 -0
- data/app/assets/javascripts/jquery-ui/widgets/draggable.js +1268 -0
- data/app/assets/javascripts/jquery-ui/widgets/droppable.js +508 -0
- data/app/assets/javascripts/jquery-ui/widgets/menu.js +720 -0
- data/app/assets/javascripts/jquery-ui/widgets/mouse.js +241 -0
- data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +184 -0
- data/app/assets/javascripts/jquery-ui/widgets/resizable.js +1225 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectable.js +321 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +702 -0
- data/app/assets/javascripts/jquery-ui/widgets/slider.js +760 -0
- data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1622 -0
- data/app/assets/javascripts/jquery-ui/widgets/spinner.js +588 -0
- data/app/assets/javascripts/jquery-ui/widgets/tabs.js +931 -0
- data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +533 -0
- data/app/assets/javascripts/jquery-ui.js +56 -0
- data/app/assets/stylesheets/jquery-ui/accordion.css +26 -0
- data/app/assets/stylesheets/jquery-ui/all.css +14 -0
- data/app/assets/stylesheets/jquery-ui/autocomplete.css +19 -0
- data/app/assets/stylesheets/jquery-ui/base.css +32 -0
- data/app/assets/stylesheets/jquery-ui/button.css +85 -0
- data/app/assets/stylesheets/jquery-ui/checkboxradio.css +37 -0
- data/app/assets/stylesheets/jquery-ui/controlgroup.css +68 -0
- data/app/assets/stylesheets/jquery-ui/core.css +100 -0
- data/app/assets/stylesheets/jquery-ui/datepicker.css +188 -0
- data/app/assets/stylesheets/jquery-ui/dialog.css +104 -0
- data/app/assets/stylesheets/jquery-ui/draggable.css +15 -0
- data/app/assets/stylesheets/jquery-ui/menu.css +67 -0
- data/app/assets/stylesheets/jquery-ui/progressbar.css +31 -0
- data/app/assets/stylesheets/jquery-ui/resizable.css +81 -0
- data/app/assets/stylesheets/jquery-ui/selectable.css +20 -0
- data/app/assets/stylesheets/jquery-ui/selectmenu.css +53 -0
- data/app/assets/stylesheets/jquery-ui/slider.css +78 -0
- data/app/assets/stylesheets/jquery-ui/sortable.css +15 -0
- data/app/assets/stylesheets/jquery-ui/spinner.css +55 -0
- data/app/assets/stylesheets/jquery-ui/tabs.css +54 -0
- data/app/assets/stylesheets/jquery-ui/theme.css.erb +456 -0
- data/app/assets/stylesheets/jquery-ui/tooltip.css +22 -0
- data/app/assets/stylesheets/jquery-ui.css +1 -0
- data/lib/jquery/ui/rails/engine.rb +8 -0
- data/lib/jquery/ui/rails/version.rb +8 -0
- data/lib/jquery/ui/rails.rb +2 -0
- data/lib/jquery-ui-rails.rb +1 -0
- metadata +250 -0
@@ -0,0 +1,289 @@
|
|
1
|
+
//= require jquery-ui/form-reset-mixin
|
2
|
+
//= require jquery-ui/labels
|
3
|
+
//= require jquery-ui/widget
|
4
|
+
|
5
|
+
/*!
|
6
|
+
* jQuery UI Checkboxradio 1.13.1
|
7
|
+
* http://jqueryui.com
|
8
|
+
*
|
9
|
+
* Copyright jQuery Foundation and other contributors
|
10
|
+
* Released under the MIT license.
|
11
|
+
* http://jquery.org/license
|
12
|
+
*/
|
13
|
+
|
14
|
+
//>>label: Checkboxradio
|
15
|
+
//>>group: Widgets
|
16
|
+
//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
|
17
|
+
//>>docs: http://api.jqueryui.com/checkboxradio/
|
18
|
+
//>>demos: http://jqueryui.com/checkboxradio/
|
19
|
+
//>>css.structure: ../../themes/base/core.css
|
20
|
+
//>>css.structure: ../../themes/base/button.css
|
21
|
+
//>>css.structure: ../../themes/base/checkboxradio.css
|
22
|
+
//>>css.theme: ../../themes/base/theme.css
|
23
|
+
|
24
|
+
( function( factory ) {
|
25
|
+
"use strict";
|
26
|
+
|
27
|
+
if ( typeof define === "function" && define.amd ) {
|
28
|
+
|
29
|
+
// AMD. Register as an anonymous module.
|
30
|
+
define( [
|
31
|
+
"jquery",
|
32
|
+
"../form-reset-mixin",
|
33
|
+
"../labels",
|
34
|
+
"../widget"
|
35
|
+
], factory );
|
36
|
+
} else {
|
37
|
+
|
38
|
+
// Browser globals
|
39
|
+
factory( jQuery );
|
40
|
+
}
|
41
|
+
} )( function( $ ) {
|
42
|
+
"use strict";
|
43
|
+
|
44
|
+
$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
|
45
|
+
version: "1.13.1",
|
46
|
+
options: {
|
47
|
+
disabled: null,
|
48
|
+
label: null,
|
49
|
+
icon: true,
|
50
|
+
classes: {
|
51
|
+
"ui-checkboxradio-label": "ui-corner-all",
|
52
|
+
"ui-checkboxradio-icon": "ui-corner-all"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
|
56
|
+
_getCreateOptions: function() {
|
57
|
+
var disabled, labels;
|
58
|
+
var that = this;
|
59
|
+
var options = this._super() || {};
|
60
|
+
|
61
|
+
// We read the type here, because it makes more sense to throw a element type error first,
|
62
|
+
// rather then the error for lack of a label. Often if its the wrong type, it
|
63
|
+
// won't have a label (e.g. calling on a div, btn, etc)
|
64
|
+
this._readType();
|
65
|
+
|
66
|
+
labels = this.element.labels();
|
67
|
+
|
68
|
+
// If there are multiple labels, use the last one
|
69
|
+
this.label = $( labels[ labels.length - 1 ] );
|
70
|
+
if ( !this.label.length ) {
|
71
|
+
$.error( "No label found for checkboxradio widget" );
|
72
|
+
}
|
73
|
+
|
74
|
+
this.originalLabel = "";
|
75
|
+
|
76
|
+
// We need to get the label text but this may also need to make sure it does not contain the
|
77
|
+
// input itself.
|
78
|
+
this.label.contents().not( this.element[ 0 ] ).each( function() {
|
79
|
+
|
80
|
+
// The label contents could be text, html, or a mix. We concat each element to get a
|
81
|
+
// string representation of the label, without the input as part of it.
|
82
|
+
that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
|
83
|
+
} );
|
84
|
+
|
85
|
+
// Set the label option if we found label text
|
86
|
+
if ( this.originalLabel ) {
|
87
|
+
options.label = this.originalLabel;
|
88
|
+
}
|
89
|
+
|
90
|
+
disabled = this.element[ 0 ].disabled;
|
91
|
+
if ( disabled != null ) {
|
92
|
+
options.disabled = disabled;
|
93
|
+
}
|
94
|
+
return options;
|
95
|
+
},
|
96
|
+
|
97
|
+
_create: function() {
|
98
|
+
var checked = this.element[ 0 ].checked;
|
99
|
+
|
100
|
+
this._bindFormResetHandler();
|
101
|
+
|
102
|
+
if ( this.options.disabled == null ) {
|
103
|
+
this.options.disabled = this.element[ 0 ].disabled;
|
104
|
+
}
|
105
|
+
|
106
|
+
this._setOption( "disabled", this.options.disabled );
|
107
|
+
this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
|
108
|
+
this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
|
109
|
+
|
110
|
+
if ( this.type === "radio" ) {
|
111
|
+
this._addClass( this.label, "ui-checkboxradio-radio-label" );
|
112
|
+
}
|
113
|
+
|
114
|
+
if ( this.options.label && this.options.label !== this.originalLabel ) {
|
115
|
+
this._updateLabel();
|
116
|
+
} else if ( this.originalLabel ) {
|
117
|
+
this.options.label = this.originalLabel;
|
118
|
+
}
|
119
|
+
|
120
|
+
this._enhance();
|
121
|
+
|
122
|
+
if ( checked ) {
|
123
|
+
this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
|
124
|
+
}
|
125
|
+
|
126
|
+
this._on( {
|
127
|
+
change: "_toggleClasses",
|
128
|
+
focus: function() {
|
129
|
+
this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
|
130
|
+
},
|
131
|
+
blur: function() {
|
132
|
+
this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
|
133
|
+
}
|
134
|
+
} );
|
135
|
+
},
|
136
|
+
|
137
|
+
_readType: function() {
|
138
|
+
var nodeName = this.element[ 0 ].nodeName.toLowerCase();
|
139
|
+
this.type = this.element[ 0 ].type;
|
140
|
+
if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
|
141
|
+
$.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
|
142
|
+
" and element.type=" + this.type );
|
143
|
+
}
|
144
|
+
},
|
145
|
+
|
146
|
+
// Support jQuery Mobile enhanced option
|
147
|
+
_enhance: function() {
|
148
|
+
this._updateIcon( this.element[ 0 ].checked );
|
149
|
+
},
|
150
|
+
|
151
|
+
widget: function() {
|
152
|
+
return this.label;
|
153
|
+
},
|
154
|
+
|
155
|
+
_getRadioGroup: function() {
|
156
|
+
var group;
|
157
|
+
var name = this.element[ 0 ].name;
|
158
|
+
var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
|
159
|
+
|
160
|
+
if ( !name ) {
|
161
|
+
return $( [] );
|
162
|
+
}
|
163
|
+
|
164
|
+
if ( this.form.length ) {
|
165
|
+
group = $( this.form[ 0 ].elements ).filter( nameSelector );
|
166
|
+
} else {
|
167
|
+
|
168
|
+
// Not inside a form, check all inputs that also are not inside a form
|
169
|
+
group = $( nameSelector ).filter( function() {
|
170
|
+
return $( this )._form().length === 0;
|
171
|
+
} );
|
172
|
+
}
|
173
|
+
|
174
|
+
return group.not( this.element );
|
175
|
+
},
|
176
|
+
|
177
|
+
_toggleClasses: function() {
|
178
|
+
var checked = this.element[ 0 ].checked;
|
179
|
+
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
|
180
|
+
|
181
|
+
if ( this.options.icon && this.type === "checkbox" ) {
|
182
|
+
this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
|
183
|
+
._toggleClass( this.icon, null, "ui-icon-blank", !checked );
|
184
|
+
}
|
185
|
+
|
186
|
+
if ( this.type === "radio" ) {
|
187
|
+
this._getRadioGroup()
|
188
|
+
.each( function() {
|
189
|
+
var instance = $( this ).checkboxradio( "instance" );
|
190
|
+
|
191
|
+
if ( instance ) {
|
192
|
+
instance._removeClass( instance.label,
|
193
|
+
"ui-checkboxradio-checked", "ui-state-active" );
|
194
|
+
}
|
195
|
+
} );
|
196
|
+
}
|
197
|
+
},
|
198
|
+
|
199
|
+
_destroy: function() {
|
200
|
+
this._unbindFormResetHandler();
|
201
|
+
|
202
|
+
if ( this.icon ) {
|
203
|
+
this.icon.remove();
|
204
|
+
this.iconSpace.remove();
|
205
|
+
}
|
206
|
+
},
|
207
|
+
|
208
|
+
_setOption: function( key, value ) {
|
209
|
+
|
210
|
+
// We don't allow the value to be set to nothing
|
211
|
+
if ( key === "label" && !value ) {
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
|
215
|
+
this._super( key, value );
|
216
|
+
|
217
|
+
if ( key === "disabled" ) {
|
218
|
+
this._toggleClass( this.label, null, "ui-state-disabled", value );
|
219
|
+
this.element[ 0 ].disabled = value;
|
220
|
+
|
221
|
+
// Don't refresh when setting disabled
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
this.refresh();
|
225
|
+
},
|
226
|
+
|
227
|
+
_updateIcon: function( checked ) {
|
228
|
+
var toAdd = "ui-icon ui-icon-background ";
|
229
|
+
|
230
|
+
if ( this.options.icon ) {
|
231
|
+
if ( !this.icon ) {
|
232
|
+
this.icon = $( "<span>" );
|
233
|
+
this.iconSpace = $( "<span> </span>" );
|
234
|
+
this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
|
235
|
+
}
|
236
|
+
|
237
|
+
if ( this.type === "checkbox" ) {
|
238
|
+
toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
|
239
|
+
this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
|
240
|
+
} else {
|
241
|
+
toAdd += "ui-icon-blank";
|
242
|
+
}
|
243
|
+
this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
|
244
|
+
if ( !checked ) {
|
245
|
+
this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
|
246
|
+
}
|
247
|
+
this.icon.prependTo( this.label ).after( this.iconSpace );
|
248
|
+
} else if ( this.icon !== undefined ) {
|
249
|
+
this.icon.remove();
|
250
|
+
this.iconSpace.remove();
|
251
|
+
delete this.icon;
|
252
|
+
}
|
253
|
+
},
|
254
|
+
|
255
|
+
_updateLabel: function() {
|
256
|
+
|
257
|
+
// Remove the contents of the label ( minus the icon, icon space, and input )
|
258
|
+
var contents = this.label.contents().not( this.element[ 0 ] );
|
259
|
+
if ( this.icon ) {
|
260
|
+
contents = contents.not( this.icon[ 0 ] );
|
261
|
+
}
|
262
|
+
if ( this.iconSpace ) {
|
263
|
+
contents = contents.not( this.iconSpace[ 0 ] );
|
264
|
+
}
|
265
|
+
contents.remove();
|
266
|
+
|
267
|
+
this.label.append( this.options.label );
|
268
|
+
},
|
269
|
+
|
270
|
+
refresh: function() {
|
271
|
+
var checked = this.element[ 0 ].checked,
|
272
|
+
isDisabled = this.element[ 0 ].disabled;
|
273
|
+
|
274
|
+
this._updateIcon( checked );
|
275
|
+
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
|
276
|
+
if ( this.options.label !== null ) {
|
277
|
+
this._updateLabel();
|
278
|
+
}
|
279
|
+
|
280
|
+
if ( isDisabled !== this.options.disabled ) {
|
281
|
+
this._setOptions( { "disabled": isDisabled } );
|
282
|
+
}
|
283
|
+
}
|
284
|
+
|
285
|
+
} ] );
|
286
|
+
|
287
|
+
return $.ui.checkboxradio;
|
288
|
+
|
289
|
+
} );
|
@@ -0,0 +1,304 @@
|
|
1
|
+
//= require jquery-ui/widget
|
2
|
+
|
3
|
+
/*!
|
4
|
+
* jQuery UI Controlgroup 1.13.1
|
5
|
+
* http://jqueryui.com
|
6
|
+
*
|
7
|
+
* Copyright jQuery Foundation and other contributors
|
8
|
+
* Released under the MIT license.
|
9
|
+
* http://jquery.org/license
|
10
|
+
*/
|
11
|
+
|
12
|
+
//>>label: Controlgroup
|
13
|
+
//>>group: Widgets
|
14
|
+
//>>description: Visually groups form control widgets
|
15
|
+
//>>docs: http://api.jqueryui.com/controlgroup/
|
16
|
+
//>>demos: http://jqueryui.com/controlgroup/
|
17
|
+
//>>css.structure: ../../themes/base/core.css
|
18
|
+
//>>css.structure: ../../themes/base/controlgroup.css
|
19
|
+
//>>css.theme: ../../themes/base/theme.css
|
20
|
+
|
21
|
+
( function( factory ) {
|
22
|
+
"use strict";
|
23
|
+
|
24
|
+
if ( typeof define === "function" && define.amd ) {
|
25
|
+
|
26
|
+
// AMD. Register as an anonymous module.
|
27
|
+
define( [
|
28
|
+
"jquery",
|
29
|
+
"../widget"
|
30
|
+
], factory );
|
31
|
+
} else {
|
32
|
+
|
33
|
+
// Browser globals
|
34
|
+
factory( jQuery );
|
35
|
+
}
|
36
|
+
} )( function( $ ) {
|
37
|
+
"use strict";
|
38
|
+
|
39
|
+
var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
|
40
|
+
|
41
|
+
return $.widget( "ui.controlgroup", {
|
42
|
+
version: "1.13.1",
|
43
|
+
defaultElement: "<div>",
|
44
|
+
options: {
|
45
|
+
direction: "horizontal",
|
46
|
+
disabled: null,
|
47
|
+
onlyVisible: true,
|
48
|
+
items: {
|
49
|
+
"button": "input[type=button], input[type=submit], input[type=reset], button, a",
|
50
|
+
"controlgroupLabel": ".ui-controlgroup-label",
|
51
|
+
"checkboxradio": "input[type='checkbox'], input[type='radio']",
|
52
|
+
"selectmenu": "select",
|
53
|
+
"spinner": ".ui-spinner-input"
|
54
|
+
}
|
55
|
+
},
|
56
|
+
|
57
|
+
_create: function() {
|
58
|
+
this._enhance();
|
59
|
+
},
|
60
|
+
|
61
|
+
// To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
|
62
|
+
_enhance: function() {
|
63
|
+
this.element.attr( "role", "toolbar" );
|
64
|
+
this.refresh();
|
65
|
+
},
|
66
|
+
|
67
|
+
_destroy: function() {
|
68
|
+
this._callChildMethod( "destroy" );
|
69
|
+
this.childWidgets.removeData( "ui-controlgroup-data" );
|
70
|
+
this.element.removeAttr( "role" );
|
71
|
+
if ( this.options.items.controlgroupLabel ) {
|
72
|
+
this.element
|
73
|
+
.find( this.options.items.controlgroupLabel )
|
74
|
+
.find( ".ui-controlgroup-label-contents" )
|
75
|
+
.contents().unwrap();
|
76
|
+
}
|
77
|
+
},
|
78
|
+
|
79
|
+
_initWidgets: function() {
|
80
|
+
var that = this,
|
81
|
+
childWidgets = [];
|
82
|
+
|
83
|
+
// First we iterate over each of the items options
|
84
|
+
$.each( this.options.items, function( widget, selector ) {
|
85
|
+
var labels;
|
86
|
+
var options = {};
|
87
|
+
|
88
|
+
// Make sure the widget has a selector set
|
89
|
+
if ( !selector ) {
|
90
|
+
return;
|
91
|
+
}
|
92
|
+
|
93
|
+
if ( widget === "controlgroupLabel" ) {
|
94
|
+
labels = that.element.find( selector );
|
95
|
+
labels.each( function() {
|
96
|
+
var element = $( this );
|
97
|
+
|
98
|
+
if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
element.contents()
|
102
|
+
.wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
|
103
|
+
} );
|
104
|
+
that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
|
105
|
+
childWidgets = childWidgets.concat( labels.get() );
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
|
109
|
+
// Make sure the widget actually exists
|
110
|
+
if ( !$.fn[ widget ] ) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
|
114
|
+
// We assume everything is in the middle to start because we can't determine
|
115
|
+
// first / last elements until all enhancments are done.
|
116
|
+
if ( that[ "_" + widget + "Options" ] ) {
|
117
|
+
options = that[ "_" + widget + "Options" ]( "middle" );
|
118
|
+
} else {
|
119
|
+
options = { classes: {} };
|
120
|
+
}
|
121
|
+
|
122
|
+
// Find instances of this widget inside controlgroup and init them
|
123
|
+
that.element
|
124
|
+
.find( selector )
|
125
|
+
.each( function() {
|
126
|
+
var element = $( this );
|
127
|
+
var instance = element[ widget ]( "instance" );
|
128
|
+
|
129
|
+
// We need to clone the default options for this type of widget to avoid
|
130
|
+
// polluting the variable options which has a wider scope than a single widget.
|
131
|
+
var instanceOptions = $.widget.extend( {}, options );
|
132
|
+
|
133
|
+
// If the button is the child of a spinner ignore it
|
134
|
+
// TODO: Find a more generic solution
|
135
|
+
if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
|
139
|
+
// Create the widget if it doesn't exist
|
140
|
+
if ( !instance ) {
|
141
|
+
instance = element[ widget ]()[ widget ]( "instance" );
|
142
|
+
}
|
143
|
+
if ( instance ) {
|
144
|
+
instanceOptions.classes =
|
145
|
+
that._resolveClassesValues( instanceOptions.classes, instance );
|
146
|
+
}
|
147
|
+
element[ widget ]( instanceOptions );
|
148
|
+
|
149
|
+
// Store an instance of the controlgroup to be able to reference
|
150
|
+
// from the outermost element for changing options and refresh
|
151
|
+
var widgetElement = element[ widget ]( "widget" );
|
152
|
+
$.data( widgetElement[ 0 ], "ui-controlgroup-data",
|
153
|
+
instance ? instance : element[ widget ]( "instance" ) );
|
154
|
+
|
155
|
+
childWidgets.push( widgetElement[ 0 ] );
|
156
|
+
} );
|
157
|
+
} );
|
158
|
+
|
159
|
+
this.childWidgets = $( $.uniqueSort( childWidgets ) );
|
160
|
+
this._addClass( this.childWidgets, "ui-controlgroup-item" );
|
161
|
+
},
|
162
|
+
|
163
|
+
_callChildMethod: function( method ) {
|
164
|
+
this.childWidgets.each( function() {
|
165
|
+
var element = $( this ),
|
166
|
+
data = element.data( "ui-controlgroup-data" );
|
167
|
+
if ( data && data[ method ] ) {
|
168
|
+
data[ method ]();
|
169
|
+
}
|
170
|
+
} );
|
171
|
+
},
|
172
|
+
|
173
|
+
_updateCornerClass: function( element, position ) {
|
174
|
+
var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
|
175
|
+
var add = this._buildSimpleOptions( position, "label" ).classes.label;
|
176
|
+
|
177
|
+
this._removeClass( element, null, remove );
|
178
|
+
this._addClass( element, null, add );
|
179
|
+
},
|
180
|
+
|
181
|
+
_buildSimpleOptions: function( position, key ) {
|
182
|
+
var direction = this.options.direction === "vertical";
|
183
|
+
var result = {
|
184
|
+
classes: {}
|
185
|
+
};
|
186
|
+
result.classes[ key ] = {
|
187
|
+
"middle": "",
|
188
|
+
"first": "ui-corner-" + ( direction ? "top" : "left" ),
|
189
|
+
"last": "ui-corner-" + ( direction ? "bottom" : "right" ),
|
190
|
+
"only": "ui-corner-all"
|
191
|
+
}[ position ];
|
192
|
+
|
193
|
+
return result;
|
194
|
+
},
|
195
|
+
|
196
|
+
_spinnerOptions: function( position ) {
|
197
|
+
var options = this._buildSimpleOptions( position, "ui-spinner" );
|
198
|
+
|
199
|
+
options.classes[ "ui-spinner-up" ] = "";
|
200
|
+
options.classes[ "ui-spinner-down" ] = "";
|
201
|
+
|
202
|
+
return options;
|
203
|
+
},
|
204
|
+
|
205
|
+
_buttonOptions: function( position ) {
|
206
|
+
return this._buildSimpleOptions( position, "ui-button" );
|
207
|
+
},
|
208
|
+
|
209
|
+
_checkboxradioOptions: function( position ) {
|
210
|
+
return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
|
211
|
+
},
|
212
|
+
|
213
|
+
_selectmenuOptions: function( position ) {
|
214
|
+
var direction = this.options.direction === "vertical";
|
215
|
+
return {
|
216
|
+
width: direction ? "auto" : false,
|
217
|
+
classes: {
|
218
|
+
middle: {
|
219
|
+
"ui-selectmenu-button-open": "",
|
220
|
+
"ui-selectmenu-button-closed": ""
|
221
|
+
},
|
222
|
+
first: {
|
223
|
+
"ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
|
224
|
+
"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
|
225
|
+
},
|
226
|
+
last: {
|
227
|
+
"ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
|
228
|
+
"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
|
229
|
+
},
|
230
|
+
only: {
|
231
|
+
"ui-selectmenu-button-open": "ui-corner-top",
|
232
|
+
"ui-selectmenu-button-closed": "ui-corner-all"
|
233
|
+
}
|
234
|
+
|
235
|
+
}[ position ]
|
236
|
+
};
|
237
|
+
},
|
238
|
+
|
239
|
+
_resolveClassesValues: function( classes, instance ) {
|
240
|
+
var result = {};
|
241
|
+
$.each( classes, function( key ) {
|
242
|
+
var current = instance.options.classes[ key ] || "";
|
243
|
+
current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) );
|
244
|
+
result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
|
245
|
+
} );
|
246
|
+
return result;
|
247
|
+
},
|
248
|
+
|
249
|
+
_setOption: function( key, value ) {
|
250
|
+
if ( key === "direction" ) {
|
251
|
+
this._removeClass( "ui-controlgroup-" + this.options.direction );
|
252
|
+
}
|
253
|
+
|
254
|
+
this._super( key, value );
|
255
|
+
if ( key === "disabled" ) {
|
256
|
+
this._callChildMethod( value ? "disable" : "enable" );
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
|
260
|
+
this.refresh();
|
261
|
+
},
|
262
|
+
|
263
|
+
refresh: function() {
|
264
|
+
var children,
|
265
|
+
that = this;
|
266
|
+
|
267
|
+
this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
|
268
|
+
|
269
|
+
if ( this.options.direction === "horizontal" ) {
|
270
|
+
this._addClass( null, "ui-helper-clearfix" );
|
271
|
+
}
|
272
|
+
this._initWidgets();
|
273
|
+
|
274
|
+
children = this.childWidgets;
|
275
|
+
|
276
|
+
// We filter here because we need to track all childWidgets not just the visible ones
|
277
|
+
if ( this.options.onlyVisible ) {
|
278
|
+
children = children.filter( ":visible" );
|
279
|
+
}
|
280
|
+
|
281
|
+
if ( children.length ) {
|
282
|
+
|
283
|
+
// We do this last because we need to make sure all enhancment is done
|
284
|
+
// before determining first and last
|
285
|
+
$.each( [ "first", "last" ], function( index, value ) {
|
286
|
+
var instance = children[ value ]().data( "ui-controlgroup-data" );
|
287
|
+
|
288
|
+
if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
|
289
|
+
var options = that[ "_" + instance.widgetName + "Options" ](
|
290
|
+
children.length === 1 ? "only" : value
|
291
|
+
);
|
292
|
+
options.classes = that._resolveClassesValues( options.classes, instance );
|
293
|
+
instance.element[ instance.widgetName ]( options );
|
294
|
+
} else {
|
295
|
+
that._updateCornerClass( children[ value ](), value );
|
296
|
+
}
|
297
|
+
} );
|
298
|
+
|
299
|
+
// Finally call the refresh method on each of the child widgets.
|
300
|
+
this._callChildMethod( "refresh" );
|
301
|
+
}
|
302
|
+
}
|
303
|
+
} );
|
304
|
+
} );
|