jquery-ui-rails-dox-fork 7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/.travis.yml +2 -0
- data/CONTRIBUTING.txt +30 -0
- data/Gemfile +3 -0
- data/History.md +172 -0
- data/License.txt +2 -0
- data/README.md +311 -0
- data/Rakefile +263 -0
- data/VERSIONS.md +41 -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 +41 -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/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 +294 -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 +57 -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,294 @@
|
|
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.2
|
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.2",
|
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, labelContents;
|
58
|
+
var options = this._super() || {};
|
59
|
+
|
60
|
+
// We read the type here, because it makes more sense to throw a element type error first,
|
61
|
+
// rather then the error for lack of a label. Often if its the wrong type, it
|
62
|
+
// won't have a label (e.g. calling on a div, btn, etc)
|
63
|
+
this._readType();
|
64
|
+
|
65
|
+
labels = this.element.labels();
|
66
|
+
|
67
|
+
// If there are multiple labels, use the last one
|
68
|
+
this.label = $( labels[ labels.length - 1 ] );
|
69
|
+
if ( !this.label.length ) {
|
70
|
+
$.error( "No label found for checkboxradio widget" );
|
71
|
+
}
|
72
|
+
|
73
|
+
this.originalLabel = "";
|
74
|
+
|
75
|
+
// We need to get the label text but this may also need to make sure it does not contain the
|
76
|
+
// input itself.
|
77
|
+
// The label contents could be text, html, or a mix. We wrap all elements
|
78
|
+
// and read the wrapper's `innerHTML` to get a string representation of
|
79
|
+
// the label, without the input as part of it.
|
80
|
+
labelContents = this.label.contents().not( this.element[ 0 ] );
|
81
|
+
|
82
|
+
if ( labelContents.length ) {
|
83
|
+
this.originalLabel += labelContents
|
84
|
+
.clone()
|
85
|
+
.wrapAll( "<div></div>" )
|
86
|
+
.parent()
|
87
|
+
.html();
|
88
|
+
}
|
89
|
+
|
90
|
+
// Set the label option if we found label text
|
91
|
+
if ( this.originalLabel ) {
|
92
|
+
options.label = this.originalLabel;
|
93
|
+
}
|
94
|
+
|
95
|
+
disabled = this.element[ 0 ].disabled;
|
96
|
+
if ( disabled != null ) {
|
97
|
+
options.disabled = disabled;
|
98
|
+
}
|
99
|
+
return options;
|
100
|
+
},
|
101
|
+
|
102
|
+
_create: function() {
|
103
|
+
var checked = this.element[ 0 ].checked;
|
104
|
+
|
105
|
+
this._bindFormResetHandler();
|
106
|
+
|
107
|
+
if ( this.options.disabled == null ) {
|
108
|
+
this.options.disabled = this.element[ 0 ].disabled;
|
109
|
+
}
|
110
|
+
|
111
|
+
this._setOption( "disabled", this.options.disabled );
|
112
|
+
this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
|
113
|
+
this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
|
114
|
+
|
115
|
+
if ( this.type === "radio" ) {
|
116
|
+
this._addClass( this.label, "ui-checkboxradio-radio-label" );
|
117
|
+
}
|
118
|
+
|
119
|
+
if ( this.options.label && this.options.label !== this.originalLabel ) {
|
120
|
+
this._updateLabel();
|
121
|
+
} else if ( this.originalLabel ) {
|
122
|
+
this.options.label = this.originalLabel;
|
123
|
+
}
|
124
|
+
|
125
|
+
this._enhance();
|
126
|
+
|
127
|
+
if ( checked ) {
|
128
|
+
this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
|
129
|
+
}
|
130
|
+
|
131
|
+
this._on( {
|
132
|
+
change: "_toggleClasses",
|
133
|
+
focus: function() {
|
134
|
+
this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
|
135
|
+
},
|
136
|
+
blur: function() {
|
137
|
+
this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
|
138
|
+
}
|
139
|
+
} );
|
140
|
+
},
|
141
|
+
|
142
|
+
_readType: function() {
|
143
|
+
var nodeName = this.element[ 0 ].nodeName.toLowerCase();
|
144
|
+
this.type = this.element[ 0 ].type;
|
145
|
+
if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
|
146
|
+
$.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
|
147
|
+
" and element.type=" + this.type );
|
148
|
+
}
|
149
|
+
},
|
150
|
+
|
151
|
+
// Support jQuery Mobile enhanced option
|
152
|
+
_enhance: function() {
|
153
|
+
this._updateIcon( this.element[ 0 ].checked );
|
154
|
+
},
|
155
|
+
|
156
|
+
widget: function() {
|
157
|
+
return this.label;
|
158
|
+
},
|
159
|
+
|
160
|
+
_getRadioGroup: function() {
|
161
|
+
var group;
|
162
|
+
var name = this.element[ 0 ].name;
|
163
|
+
var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
|
164
|
+
|
165
|
+
if ( !name ) {
|
166
|
+
return $( [] );
|
167
|
+
}
|
168
|
+
|
169
|
+
if ( this.form.length ) {
|
170
|
+
group = $( this.form[ 0 ].elements ).filter( nameSelector );
|
171
|
+
} else {
|
172
|
+
|
173
|
+
// Not inside a form, check all inputs that also are not inside a form
|
174
|
+
group = $( nameSelector ).filter( function() {
|
175
|
+
return $( this )._form().length === 0;
|
176
|
+
} );
|
177
|
+
}
|
178
|
+
|
179
|
+
return group.not( this.element );
|
180
|
+
},
|
181
|
+
|
182
|
+
_toggleClasses: function() {
|
183
|
+
var checked = this.element[ 0 ].checked;
|
184
|
+
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
|
185
|
+
|
186
|
+
if ( this.options.icon && this.type === "checkbox" ) {
|
187
|
+
this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
|
188
|
+
._toggleClass( this.icon, null, "ui-icon-blank", !checked );
|
189
|
+
}
|
190
|
+
|
191
|
+
if ( this.type === "radio" ) {
|
192
|
+
this._getRadioGroup()
|
193
|
+
.each( function() {
|
194
|
+
var instance = $( this ).checkboxradio( "instance" );
|
195
|
+
|
196
|
+
if ( instance ) {
|
197
|
+
instance._removeClass( instance.label,
|
198
|
+
"ui-checkboxradio-checked", "ui-state-active" );
|
199
|
+
}
|
200
|
+
} );
|
201
|
+
}
|
202
|
+
},
|
203
|
+
|
204
|
+
_destroy: function() {
|
205
|
+
this._unbindFormResetHandler();
|
206
|
+
|
207
|
+
if ( this.icon ) {
|
208
|
+
this.icon.remove();
|
209
|
+
this.iconSpace.remove();
|
210
|
+
}
|
211
|
+
},
|
212
|
+
|
213
|
+
_setOption: function( key, value ) {
|
214
|
+
|
215
|
+
// We don't allow the value to be set to nothing
|
216
|
+
if ( key === "label" && !value ) {
|
217
|
+
return;
|
218
|
+
}
|
219
|
+
|
220
|
+
this._super( key, value );
|
221
|
+
|
222
|
+
if ( key === "disabled" ) {
|
223
|
+
this._toggleClass( this.label, null, "ui-state-disabled", value );
|
224
|
+
this.element[ 0 ].disabled = value;
|
225
|
+
|
226
|
+
// Don't refresh when setting disabled
|
227
|
+
return;
|
228
|
+
}
|
229
|
+
this.refresh();
|
230
|
+
},
|
231
|
+
|
232
|
+
_updateIcon: function( checked ) {
|
233
|
+
var toAdd = "ui-icon ui-icon-background ";
|
234
|
+
|
235
|
+
if ( this.options.icon ) {
|
236
|
+
if ( !this.icon ) {
|
237
|
+
this.icon = $( "<span>" );
|
238
|
+
this.iconSpace = $( "<span> </span>" );
|
239
|
+
this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
|
240
|
+
}
|
241
|
+
|
242
|
+
if ( this.type === "checkbox" ) {
|
243
|
+
toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
|
244
|
+
this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
|
245
|
+
} else {
|
246
|
+
toAdd += "ui-icon-blank";
|
247
|
+
}
|
248
|
+
this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
|
249
|
+
if ( !checked ) {
|
250
|
+
this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
|
251
|
+
}
|
252
|
+
this.icon.prependTo( this.label ).after( this.iconSpace );
|
253
|
+
} else if ( this.icon !== undefined ) {
|
254
|
+
this.icon.remove();
|
255
|
+
this.iconSpace.remove();
|
256
|
+
delete this.icon;
|
257
|
+
}
|
258
|
+
},
|
259
|
+
|
260
|
+
_updateLabel: function() {
|
261
|
+
|
262
|
+
// Remove the contents of the label ( minus the icon, icon space, and input )
|
263
|
+
var contents = this.label.contents().not( this.element[ 0 ] );
|
264
|
+
if ( this.icon ) {
|
265
|
+
contents = contents.not( this.icon[ 0 ] );
|
266
|
+
}
|
267
|
+
if ( this.iconSpace ) {
|
268
|
+
contents = contents.not( this.iconSpace[ 0 ] );
|
269
|
+
}
|
270
|
+
contents.remove();
|
271
|
+
|
272
|
+
this.label.append( this.options.label );
|
273
|
+
},
|
274
|
+
|
275
|
+
refresh: function() {
|
276
|
+
var checked = this.element[ 0 ].checked,
|
277
|
+
isDisabled = this.element[ 0 ].disabled;
|
278
|
+
|
279
|
+
this._updateIcon( checked );
|
280
|
+
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
|
281
|
+
if ( this.options.label !== null ) {
|
282
|
+
this._updateLabel();
|
283
|
+
}
|
284
|
+
|
285
|
+
if ( isDisabled !== this.options.disabled ) {
|
286
|
+
this._setOptions( { "disabled": isDisabled } );
|
287
|
+
}
|
288
|
+
}
|
289
|
+
|
290
|
+
} ] );
|
291
|
+
|
292
|
+
return $.ui.checkboxradio;
|
293
|
+
|
294
|
+
} );
|
@@ -0,0 +1,304 @@
|
|
1
|
+
//= require jquery-ui/widget
|
2
|
+
|
3
|
+
/*!
|
4
|
+
* jQuery UI Controlgroup 1.13.2
|
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.2",
|
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
|
+
} );
|