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,627 @@
|
|
1
|
+
//= require jquery-ui/version
|
2
|
+
//= require jquery-ui/keycode
|
3
|
+
//= require jquery-ui/unique-id
|
4
|
+
//= require jquery-ui/widget
|
5
|
+
|
6
|
+
/*!
|
7
|
+
* jQuery UI Accordion 1.13.2
|
8
|
+
* http://jqueryui.com
|
9
|
+
*
|
10
|
+
* Copyright jQuery Foundation and other contributors
|
11
|
+
* Released under the MIT license.
|
12
|
+
* http://jquery.org/license
|
13
|
+
*/
|
14
|
+
|
15
|
+
//>>label: Accordion
|
16
|
+
//>>group: Widgets
|
17
|
+
/* eslint-disable max-len */
|
18
|
+
//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
|
19
|
+
/* eslint-enable max-len */
|
20
|
+
//>>docs: http://api.jqueryui.com/accordion/
|
21
|
+
//>>demos: http://jqueryui.com/accordion/
|
22
|
+
//>>css.structure: ../../themes/base/core.css
|
23
|
+
//>>css.structure: ../../themes/base/accordion.css
|
24
|
+
//>>css.theme: ../../themes/base/theme.css
|
25
|
+
|
26
|
+
( function( factory ) {
|
27
|
+
"use strict";
|
28
|
+
|
29
|
+
if ( typeof define === "function" && define.amd ) {
|
30
|
+
|
31
|
+
// AMD. Register as an anonymous module.
|
32
|
+
define( [
|
33
|
+
"jquery",
|
34
|
+
"../version",
|
35
|
+
"../keycode",
|
36
|
+
"../unique-id",
|
37
|
+
"../widget"
|
38
|
+
], factory );
|
39
|
+
} else {
|
40
|
+
|
41
|
+
// Browser globals
|
42
|
+
factory( jQuery );
|
43
|
+
}
|
44
|
+
} )( function( $ ) {
|
45
|
+
"use strict";
|
46
|
+
|
47
|
+
return $.widget( "ui.accordion", {
|
48
|
+
version: "1.13.2",
|
49
|
+
options: {
|
50
|
+
active: 0,
|
51
|
+
animate: {},
|
52
|
+
classes: {
|
53
|
+
"ui-accordion-header": "ui-corner-top",
|
54
|
+
"ui-accordion-header-collapsed": "ui-corner-all",
|
55
|
+
"ui-accordion-content": "ui-corner-bottom"
|
56
|
+
},
|
57
|
+
collapsible: false,
|
58
|
+
event: "click",
|
59
|
+
header: function( elem ) {
|
60
|
+
return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
|
61
|
+
},
|
62
|
+
heightStyle: "auto",
|
63
|
+
icons: {
|
64
|
+
activeHeader: "ui-icon-triangle-1-s",
|
65
|
+
header: "ui-icon-triangle-1-e"
|
66
|
+
},
|
67
|
+
|
68
|
+
// Callbacks
|
69
|
+
activate: null,
|
70
|
+
beforeActivate: null
|
71
|
+
},
|
72
|
+
|
73
|
+
hideProps: {
|
74
|
+
borderTopWidth: "hide",
|
75
|
+
borderBottomWidth: "hide",
|
76
|
+
paddingTop: "hide",
|
77
|
+
paddingBottom: "hide",
|
78
|
+
height: "hide"
|
79
|
+
},
|
80
|
+
|
81
|
+
showProps: {
|
82
|
+
borderTopWidth: "show",
|
83
|
+
borderBottomWidth: "show",
|
84
|
+
paddingTop: "show",
|
85
|
+
paddingBottom: "show",
|
86
|
+
height: "show"
|
87
|
+
},
|
88
|
+
|
89
|
+
_create: function() {
|
90
|
+
var options = this.options;
|
91
|
+
|
92
|
+
this.prevShow = this.prevHide = $();
|
93
|
+
this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
|
94
|
+
this.element.attr( "role", "tablist" );
|
95
|
+
|
96
|
+
// Don't allow collapsible: false and active: false / null
|
97
|
+
if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
|
98
|
+
options.active = 0;
|
99
|
+
}
|
100
|
+
|
101
|
+
this._processPanels();
|
102
|
+
|
103
|
+
// handle negative values
|
104
|
+
if ( options.active < 0 ) {
|
105
|
+
options.active += this.headers.length;
|
106
|
+
}
|
107
|
+
this._refresh();
|
108
|
+
},
|
109
|
+
|
110
|
+
_getCreateEventData: function() {
|
111
|
+
return {
|
112
|
+
header: this.active,
|
113
|
+
panel: !this.active.length ? $() : this.active.next()
|
114
|
+
};
|
115
|
+
},
|
116
|
+
|
117
|
+
_createIcons: function() {
|
118
|
+
var icon, children,
|
119
|
+
icons = this.options.icons;
|
120
|
+
|
121
|
+
if ( icons ) {
|
122
|
+
icon = $( "<span>" );
|
123
|
+
this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
|
124
|
+
icon.prependTo( this.headers );
|
125
|
+
children = this.active.children( ".ui-accordion-header-icon" );
|
126
|
+
this._removeClass( children, icons.header )
|
127
|
+
._addClass( children, null, icons.activeHeader )
|
128
|
+
._addClass( this.headers, "ui-accordion-icons" );
|
129
|
+
}
|
130
|
+
},
|
131
|
+
|
132
|
+
_destroyIcons: function() {
|
133
|
+
this._removeClass( this.headers, "ui-accordion-icons" );
|
134
|
+
this.headers.children( ".ui-accordion-header-icon" ).remove();
|
135
|
+
},
|
136
|
+
|
137
|
+
_destroy: function() {
|
138
|
+
var contents;
|
139
|
+
|
140
|
+
// Clean up main element
|
141
|
+
this.element.removeAttr( "role" );
|
142
|
+
|
143
|
+
// Clean up headers
|
144
|
+
this.headers
|
145
|
+
.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
|
146
|
+
.removeUniqueId();
|
147
|
+
|
148
|
+
this._destroyIcons();
|
149
|
+
|
150
|
+
// Clean up content panels
|
151
|
+
contents = this.headers.next()
|
152
|
+
.css( "display", "" )
|
153
|
+
.removeAttr( "role aria-hidden aria-labelledby" )
|
154
|
+
.removeUniqueId();
|
155
|
+
|
156
|
+
if ( this.options.heightStyle !== "content" ) {
|
157
|
+
contents.css( "height", "" );
|
158
|
+
}
|
159
|
+
},
|
160
|
+
|
161
|
+
_setOption: function( key, value ) {
|
162
|
+
if ( key === "active" ) {
|
163
|
+
|
164
|
+
// _activate() will handle invalid values and update this.options
|
165
|
+
this._activate( value );
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
|
169
|
+
if ( key === "event" ) {
|
170
|
+
if ( this.options.event ) {
|
171
|
+
this._off( this.headers, this.options.event );
|
172
|
+
}
|
173
|
+
this._setupEvents( value );
|
174
|
+
}
|
175
|
+
|
176
|
+
this._super( key, value );
|
177
|
+
|
178
|
+
// Setting collapsible: false while collapsed; open first panel
|
179
|
+
if ( key === "collapsible" && !value && this.options.active === false ) {
|
180
|
+
this._activate( 0 );
|
181
|
+
}
|
182
|
+
|
183
|
+
if ( key === "icons" ) {
|
184
|
+
this._destroyIcons();
|
185
|
+
if ( value ) {
|
186
|
+
this._createIcons();
|
187
|
+
}
|
188
|
+
}
|
189
|
+
},
|
190
|
+
|
191
|
+
_setOptionDisabled: function( value ) {
|
192
|
+
this._super( value );
|
193
|
+
|
194
|
+
this.element.attr( "aria-disabled", value );
|
195
|
+
|
196
|
+
// Support: IE8 Only
|
197
|
+
// #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
|
198
|
+
// so we need to add the disabled class to the headers and panels
|
199
|
+
this._toggleClass( null, "ui-state-disabled", !!value );
|
200
|
+
this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
|
201
|
+
!!value );
|
202
|
+
},
|
203
|
+
|
204
|
+
_keydown: function( event ) {
|
205
|
+
if ( event.altKey || event.ctrlKey ) {
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
|
209
|
+
var keyCode = $.ui.keyCode,
|
210
|
+
length = this.headers.length,
|
211
|
+
currentIndex = this.headers.index( event.target ),
|
212
|
+
toFocus = false;
|
213
|
+
|
214
|
+
switch ( event.keyCode ) {
|
215
|
+
case keyCode.RIGHT:
|
216
|
+
case keyCode.DOWN:
|
217
|
+
toFocus = this.headers[ ( currentIndex + 1 ) % length ];
|
218
|
+
break;
|
219
|
+
case keyCode.LEFT:
|
220
|
+
case keyCode.UP:
|
221
|
+
toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
|
222
|
+
break;
|
223
|
+
case keyCode.SPACE:
|
224
|
+
case keyCode.ENTER:
|
225
|
+
this._eventHandler( event );
|
226
|
+
break;
|
227
|
+
case keyCode.HOME:
|
228
|
+
toFocus = this.headers[ 0 ];
|
229
|
+
break;
|
230
|
+
case keyCode.END:
|
231
|
+
toFocus = this.headers[ length - 1 ];
|
232
|
+
break;
|
233
|
+
}
|
234
|
+
|
235
|
+
if ( toFocus ) {
|
236
|
+
$( event.target ).attr( "tabIndex", -1 );
|
237
|
+
$( toFocus ).attr( "tabIndex", 0 );
|
238
|
+
$( toFocus ).trigger( "focus" );
|
239
|
+
event.preventDefault();
|
240
|
+
}
|
241
|
+
},
|
242
|
+
|
243
|
+
_panelKeyDown: function( event ) {
|
244
|
+
if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
|
245
|
+
$( event.currentTarget ).prev().trigger( "focus" );
|
246
|
+
}
|
247
|
+
},
|
248
|
+
|
249
|
+
refresh: function() {
|
250
|
+
var options = this.options;
|
251
|
+
this._processPanels();
|
252
|
+
|
253
|
+
// Was collapsed or no panel
|
254
|
+
if ( ( options.active === false && options.collapsible === true ) ||
|
255
|
+
!this.headers.length ) {
|
256
|
+
options.active = false;
|
257
|
+
this.active = $();
|
258
|
+
|
259
|
+
// active false only when collapsible is true
|
260
|
+
} else if ( options.active === false ) {
|
261
|
+
this._activate( 0 );
|
262
|
+
|
263
|
+
// was active, but active panel is gone
|
264
|
+
} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
|
265
|
+
|
266
|
+
// all remaining panel are disabled
|
267
|
+
if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
|
268
|
+
options.active = false;
|
269
|
+
this.active = $();
|
270
|
+
|
271
|
+
// activate previous panel
|
272
|
+
} else {
|
273
|
+
this._activate( Math.max( 0, options.active - 1 ) );
|
274
|
+
}
|
275
|
+
|
276
|
+
// was active, active panel still exists
|
277
|
+
} else {
|
278
|
+
|
279
|
+
// make sure active index is correct
|
280
|
+
options.active = this.headers.index( this.active );
|
281
|
+
}
|
282
|
+
|
283
|
+
this._destroyIcons();
|
284
|
+
|
285
|
+
this._refresh();
|
286
|
+
},
|
287
|
+
|
288
|
+
_processPanels: function() {
|
289
|
+
var prevHeaders = this.headers,
|
290
|
+
prevPanels = this.panels;
|
291
|
+
|
292
|
+
if ( typeof this.options.header === "function" ) {
|
293
|
+
this.headers = this.options.header( this.element );
|
294
|
+
} else {
|
295
|
+
this.headers = this.element.find( this.options.header );
|
296
|
+
}
|
297
|
+
this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
|
298
|
+
"ui-state-default" );
|
299
|
+
|
300
|
+
this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
|
301
|
+
this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
|
302
|
+
|
303
|
+
// Avoid memory leaks (#10056)
|
304
|
+
if ( prevPanels ) {
|
305
|
+
this._off( prevHeaders.not( this.headers ) );
|
306
|
+
this._off( prevPanels.not( this.panels ) );
|
307
|
+
}
|
308
|
+
},
|
309
|
+
|
310
|
+
_refresh: function() {
|
311
|
+
var maxHeight,
|
312
|
+
options = this.options,
|
313
|
+
heightStyle = options.heightStyle,
|
314
|
+
parent = this.element.parent();
|
315
|
+
|
316
|
+
this.active = this._findActive( options.active );
|
317
|
+
this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
|
318
|
+
._removeClass( this.active, "ui-accordion-header-collapsed" );
|
319
|
+
this._addClass( this.active.next(), "ui-accordion-content-active" );
|
320
|
+
this.active.next().show();
|
321
|
+
|
322
|
+
this.headers
|
323
|
+
.attr( "role", "tab" )
|
324
|
+
.each( function() {
|
325
|
+
var header = $( this ),
|
326
|
+
headerId = header.uniqueId().attr( "id" ),
|
327
|
+
panel = header.next(),
|
328
|
+
panelId = panel.uniqueId().attr( "id" );
|
329
|
+
header.attr( "aria-controls", panelId );
|
330
|
+
panel.attr( "aria-labelledby", headerId );
|
331
|
+
} )
|
332
|
+
.next()
|
333
|
+
.attr( "role", "tabpanel" );
|
334
|
+
|
335
|
+
this.headers
|
336
|
+
.not( this.active )
|
337
|
+
.attr( {
|
338
|
+
"aria-selected": "false",
|
339
|
+
"aria-expanded": "false",
|
340
|
+
tabIndex: -1
|
341
|
+
} )
|
342
|
+
.next()
|
343
|
+
.attr( {
|
344
|
+
"aria-hidden": "true"
|
345
|
+
} )
|
346
|
+
.hide();
|
347
|
+
|
348
|
+
// Make sure at least one header is in the tab order
|
349
|
+
if ( !this.active.length ) {
|
350
|
+
this.headers.eq( 0 ).attr( "tabIndex", 0 );
|
351
|
+
} else {
|
352
|
+
this.active.attr( {
|
353
|
+
"aria-selected": "true",
|
354
|
+
"aria-expanded": "true",
|
355
|
+
tabIndex: 0
|
356
|
+
} )
|
357
|
+
.next()
|
358
|
+
.attr( {
|
359
|
+
"aria-hidden": "false"
|
360
|
+
} );
|
361
|
+
}
|
362
|
+
|
363
|
+
this._createIcons();
|
364
|
+
|
365
|
+
this._setupEvents( options.event );
|
366
|
+
|
367
|
+
if ( heightStyle === "fill" ) {
|
368
|
+
maxHeight = parent.height();
|
369
|
+
this.element.siblings( ":visible" ).each( function() {
|
370
|
+
var elem = $( this ),
|
371
|
+
position = elem.css( "position" );
|
372
|
+
|
373
|
+
if ( position === "absolute" || position === "fixed" ) {
|
374
|
+
return;
|
375
|
+
}
|
376
|
+
maxHeight -= elem.outerHeight( true );
|
377
|
+
} );
|
378
|
+
|
379
|
+
this.headers.each( function() {
|
380
|
+
maxHeight -= $( this ).outerHeight( true );
|
381
|
+
} );
|
382
|
+
|
383
|
+
this.headers.next()
|
384
|
+
.each( function() {
|
385
|
+
$( this ).height( Math.max( 0, maxHeight -
|
386
|
+
$( this ).innerHeight() + $( this ).height() ) );
|
387
|
+
} )
|
388
|
+
.css( "overflow", "auto" );
|
389
|
+
} else if ( heightStyle === "auto" ) {
|
390
|
+
maxHeight = 0;
|
391
|
+
this.headers.next()
|
392
|
+
.each( function() {
|
393
|
+
var isVisible = $( this ).is( ":visible" );
|
394
|
+
if ( !isVisible ) {
|
395
|
+
$( this ).show();
|
396
|
+
}
|
397
|
+
maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
|
398
|
+
if ( !isVisible ) {
|
399
|
+
$( this ).hide();
|
400
|
+
}
|
401
|
+
} )
|
402
|
+
.height( maxHeight );
|
403
|
+
}
|
404
|
+
},
|
405
|
+
|
406
|
+
_activate: function( index ) {
|
407
|
+
var active = this._findActive( index )[ 0 ];
|
408
|
+
|
409
|
+
// Trying to activate the already active panel
|
410
|
+
if ( active === this.active[ 0 ] ) {
|
411
|
+
return;
|
412
|
+
}
|
413
|
+
|
414
|
+
// Trying to collapse, simulate a click on the currently active header
|
415
|
+
active = active || this.active[ 0 ];
|
416
|
+
|
417
|
+
this._eventHandler( {
|
418
|
+
target: active,
|
419
|
+
currentTarget: active,
|
420
|
+
preventDefault: $.noop
|
421
|
+
} );
|
422
|
+
},
|
423
|
+
|
424
|
+
_findActive: function( selector ) {
|
425
|
+
return typeof selector === "number" ? this.headers.eq( selector ) : $();
|
426
|
+
},
|
427
|
+
|
428
|
+
_setupEvents: function( event ) {
|
429
|
+
var events = {
|
430
|
+
keydown: "_keydown"
|
431
|
+
};
|
432
|
+
if ( event ) {
|
433
|
+
$.each( event.split( " " ), function( index, eventName ) {
|
434
|
+
events[ eventName ] = "_eventHandler";
|
435
|
+
} );
|
436
|
+
}
|
437
|
+
|
438
|
+
this._off( this.headers.add( this.headers.next() ) );
|
439
|
+
this._on( this.headers, events );
|
440
|
+
this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
|
441
|
+
this._hoverable( this.headers );
|
442
|
+
this._focusable( this.headers );
|
443
|
+
},
|
444
|
+
|
445
|
+
_eventHandler: function( event ) {
|
446
|
+
var activeChildren, clickedChildren,
|
447
|
+
options = this.options,
|
448
|
+
active = this.active,
|
449
|
+
clicked = $( event.currentTarget ),
|
450
|
+
clickedIsActive = clicked[ 0 ] === active[ 0 ],
|
451
|
+
collapsing = clickedIsActive && options.collapsible,
|
452
|
+
toShow = collapsing ? $() : clicked.next(),
|
453
|
+
toHide = active.next(),
|
454
|
+
eventData = {
|
455
|
+
oldHeader: active,
|
456
|
+
oldPanel: toHide,
|
457
|
+
newHeader: collapsing ? $() : clicked,
|
458
|
+
newPanel: toShow
|
459
|
+
};
|
460
|
+
|
461
|
+
event.preventDefault();
|
462
|
+
|
463
|
+
if (
|
464
|
+
|
465
|
+
// click on active header, but not collapsible
|
466
|
+
( clickedIsActive && !options.collapsible ) ||
|
467
|
+
|
468
|
+
// allow canceling activation
|
469
|
+
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
|
470
|
+
return;
|
471
|
+
}
|
472
|
+
|
473
|
+
options.active = collapsing ? false : this.headers.index( clicked );
|
474
|
+
|
475
|
+
// When the call to ._toggle() comes after the class changes
|
476
|
+
// it causes a very odd bug in IE 8 (see #6720)
|
477
|
+
this.active = clickedIsActive ? $() : clicked;
|
478
|
+
this._toggle( eventData );
|
479
|
+
|
480
|
+
// Switch classes
|
481
|
+
// corner classes on the previously active header stay after the animation
|
482
|
+
this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
|
483
|
+
if ( options.icons ) {
|
484
|
+
activeChildren = active.children( ".ui-accordion-header-icon" );
|
485
|
+
this._removeClass( activeChildren, null, options.icons.activeHeader )
|
486
|
+
._addClass( activeChildren, null, options.icons.header );
|
487
|
+
}
|
488
|
+
|
489
|
+
if ( !clickedIsActive ) {
|
490
|
+
this._removeClass( clicked, "ui-accordion-header-collapsed" )
|
491
|
+
._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
|
492
|
+
if ( options.icons ) {
|
493
|
+
clickedChildren = clicked.children( ".ui-accordion-header-icon" );
|
494
|
+
this._removeClass( clickedChildren, null, options.icons.header )
|
495
|
+
._addClass( clickedChildren, null, options.icons.activeHeader );
|
496
|
+
}
|
497
|
+
|
498
|
+
this._addClass( clicked.next(), "ui-accordion-content-active" );
|
499
|
+
}
|
500
|
+
},
|
501
|
+
|
502
|
+
_toggle: function( data ) {
|
503
|
+
var toShow = data.newPanel,
|
504
|
+
toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
|
505
|
+
|
506
|
+
// Handle activating a panel during the animation for another activation
|
507
|
+
this.prevShow.add( this.prevHide ).stop( true, true );
|
508
|
+
this.prevShow = toShow;
|
509
|
+
this.prevHide = toHide;
|
510
|
+
|
511
|
+
if ( this.options.animate ) {
|
512
|
+
this._animate( toShow, toHide, data );
|
513
|
+
} else {
|
514
|
+
toHide.hide();
|
515
|
+
toShow.show();
|
516
|
+
this._toggleComplete( data );
|
517
|
+
}
|
518
|
+
|
519
|
+
toHide.attr( {
|
520
|
+
"aria-hidden": "true"
|
521
|
+
} );
|
522
|
+
toHide.prev().attr( {
|
523
|
+
"aria-selected": "false",
|
524
|
+
"aria-expanded": "false"
|
525
|
+
} );
|
526
|
+
|
527
|
+
// if we're switching panels, remove the old header from the tab order
|
528
|
+
// if we're opening from collapsed state, remove the previous header from the tab order
|
529
|
+
// if we're collapsing, then keep the collapsing header in the tab order
|
530
|
+
if ( toShow.length && toHide.length ) {
|
531
|
+
toHide.prev().attr( {
|
532
|
+
"tabIndex": -1,
|
533
|
+
"aria-expanded": "false"
|
534
|
+
} );
|
535
|
+
} else if ( toShow.length ) {
|
536
|
+
this.headers.filter( function() {
|
537
|
+
return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
|
538
|
+
} )
|
539
|
+
.attr( "tabIndex", -1 );
|
540
|
+
}
|
541
|
+
|
542
|
+
toShow
|
543
|
+
.attr( "aria-hidden", "false" )
|
544
|
+
.prev()
|
545
|
+
.attr( {
|
546
|
+
"aria-selected": "true",
|
547
|
+
"aria-expanded": "true",
|
548
|
+
tabIndex: 0
|
549
|
+
} );
|
550
|
+
},
|
551
|
+
|
552
|
+
_animate: function( toShow, toHide, data ) {
|
553
|
+
var total, easing, duration,
|
554
|
+
that = this,
|
555
|
+
adjust = 0,
|
556
|
+
boxSizing = toShow.css( "box-sizing" ),
|
557
|
+
down = toShow.length &&
|
558
|
+
( !toHide.length || ( toShow.index() < toHide.index() ) ),
|
559
|
+
animate = this.options.animate || {},
|
560
|
+
options = down && animate.down || animate,
|
561
|
+
complete = function() {
|
562
|
+
that._toggleComplete( data );
|
563
|
+
};
|
564
|
+
|
565
|
+
if ( typeof options === "number" ) {
|
566
|
+
duration = options;
|
567
|
+
}
|
568
|
+
if ( typeof options === "string" ) {
|
569
|
+
easing = options;
|
570
|
+
}
|
571
|
+
|
572
|
+
// fall back from options to animation in case of partial down settings
|
573
|
+
easing = easing || options.easing || animate.easing;
|
574
|
+
duration = duration || options.duration || animate.duration;
|
575
|
+
|
576
|
+
if ( !toHide.length ) {
|
577
|
+
return toShow.animate( this.showProps, duration, easing, complete );
|
578
|
+
}
|
579
|
+
if ( !toShow.length ) {
|
580
|
+
return toHide.animate( this.hideProps, duration, easing, complete );
|
581
|
+
}
|
582
|
+
|
583
|
+
total = toShow.show().outerHeight();
|
584
|
+
toHide.animate( this.hideProps, {
|
585
|
+
duration: duration,
|
586
|
+
easing: easing,
|
587
|
+
step: function( now, fx ) {
|
588
|
+
fx.now = Math.round( now );
|
589
|
+
}
|
590
|
+
} );
|
591
|
+
toShow
|
592
|
+
.hide()
|
593
|
+
.animate( this.showProps, {
|
594
|
+
duration: duration,
|
595
|
+
easing: easing,
|
596
|
+
complete: complete,
|
597
|
+
step: function( now, fx ) {
|
598
|
+
fx.now = Math.round( now );
|
599
|
+
if ( fx.prop !== "height" ) {
|
600
|
+
if ( boxSizing === "content-box" ) {
|
601
|
+
adjust += fx.now;
|
602
|
+
}
|
603
|
+
} else if ( that.options.heightStyle !== "content" ) {
|
604
|
+
fx.now = Math.round( total - toHide.outerHeight() - adjust );
|
605
|
+
adjust = 0;
|
606
|
+
}
|
607
|
+
}
|
608
|
+
} );
|
609
|
+
},
|
610
|
+
|
611
|
+
_toggleComplete: function( data ) {
|
612
|
+
var toHide = data.oldPanel,
|
613
|
+
prev = toHide.prev();
|
614
|
+
|
615
|
+
this._removeClass( toHide, "ui-accordion-content-active" );
|
616
|
+
this._removeClass( prev, "ui-accordion-header-active" )
|
617
|
+
._addClass( prev, "ui-accordion-header-collapsed" );
|
618
|
+
|
619
|
+
// Work around for rendering bug in IE (#5421)
|
620
|
+
if ( toHide.length ) {
|
621
|
+
toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
|
622
|
+
}
|
623
|
+
this._trigger( "activate", null, data );
|
624
|
+
}
|
625
|
+
} );
|
626
|
+
|
627
|
+
} );
|