sn-jquery-ui-rails 6.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/Gemfile +3 -0
- data/History.md +168 -0
- data/License.txt +2 -0
- data/README.md +311 -0
- data/Rakefile +258 -0
- data/VERSIONS.md +39 -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 +41 -0
- data/app/assets/javascripts/jquery-ui/disable-selection.js +48 -0
- data/app/assets/javascripts/jquery-ui/effect.all.js +15 -0
- data/app/assets/javascripts/jquery-ui/effect.js +1637 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +73 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +113 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +68 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +72 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +114 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +50 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +92 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +60 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +46 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +67 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +60 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +77 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-size.js +194 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +79 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +43 -0
- data/app/assets/javascripts/jquery-ui/escape-selector.js +23 -0
- data/app/assets/javascripts/jquery-ui/focusable.js +86 -0
- data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +80 -0
- data/app/assets/javascripts/jquery-ui/form.js +22 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +38 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +36 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +73 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +36 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +38 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +49 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +49 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +50 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +45 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +44 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +61 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +38 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +53 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +38 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +37 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +37 -0
- data/app/assets/javascripts/jquery-ui/ie.js +17 -0
- data/app/assets/javascripts/jquery-ui/jquery-1-7.js +91 -0
- data/app/assets/javascripts/jquery-ui/keycode.js +47 -0
- data/app/assets/javascripts/jquery-ui/labels.js +65 -0
- data/app/assets/javascripts/jquery-ui/plugin.js +46 -0
- data/app/assets/javascripts/jquery-ui/position.js +500 -0
- data/app/assets/javascripts/jquery-ui/safe-active-element.js +42 -0
- data/app/assets/javascripts/jquery-ui/safe-blur.js +23 -0
- data/app/assets/javascripts/jquery-ui/scroll-parent.js +47 -0
- data/app/assets/javascripts/jquery-ui/tabbable.js +38 -0
- data/app/assets/javascripts/jquery-ui/unique-id.js +51 -0
- data/app/assets/javascripts/jquery-ui/version.js +17 -0
- data/app/assets/javascripts/jquery-ui/widget.js +735 -0
- data/app/assets/javascripts/jquery-ui/widgets/accordion.js +618 -0
- data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +689 -0
- data/app/assets/javascripts/jquery-ui/widgets/button.js +391 -0
- data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +291 -0
- data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +300 -0
- data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +2123 -0
- data/app/assets/javascripts/jquery-ui/widgets/dialog.js +954 -0
- data/app/assets/javascripts/jquery-ui/widgets/draggable.js +1259 -0
- data/app/assets/javascripts/jquery-ui/widgets/droppable.js +502 -0
- data/app/assets/javascripts/jquery-ui/widgets/menu.js +680 -0
- data/app/assets/javascripts/jquery-ui/widgets/mouse.js +230 -0
- data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +181 -0
- data/app/assets/javascripts/jquery-ui/widgets/resizable.js +1207 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectable.js +314 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +697 -0
- data/app/assets/javascripts/jquery-ui/widgets/slider.js +757 -0
- data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1561 -0
- data/app/assets/javascripts/jquery-ui/widgets/spinner.js +581 -0
- data/app/assets/javascripts/jquery-ui/widgets/tabs.js +931 -0
- data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +526 -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 +453 -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 +248 -0
@@ -0,0 +1,502 @@
|
|
1
|
+
//= require jquery-ui/widgets/draggable
|
2
|
+
//= require jquery-ui/widgets/mouse
|
3
|
+
//= require jquery-ui/version
|
4
|
+
//= require jquery-ui/widget
|
5
|
+
|
6
|
+
/*!
|
7
|
+
* jQuery UI Droppable 1.12.1
|
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: Droppable
|
16
|
+
//>>group: Interactions
|
17
|
+
//>>description: Enables drop targets for draggable elements.
|
18
|
+
//>>docs: http://api.jqueryui.com/droppable/
|
19
|
+
//>>demos: http://jqueryui.com/droppable/
|
20
|
+
|
21
|
+
( function( factory ) {
|
22
|
+
if ( typeof define === "function" && define.amd ) {
|
23
|
+
|
24
|
+
// AMD. Register as an anonymous module.
|
25
|
+
define( [
|
26
|
+
"jquery",
|
27
|
+
"./draggable",
|
28
|
+
"./mouse",
|
29
|
+
"../version",
|
30
|
+
"../widget"
|
31
|
+
], factory );
|
32
|
+
} else {
|
33
|
+
|
34
|
+
// Browser globals
|
35
|
+
factory( jQuery );
|
36
|
+
}
|
37
|
+
}( function( $ ) {
|
38
|
+
|
39
|
+
$.widget( "ui.droppable", {
|
40
|
+
version: "1.12.1",
|
41
|
+
widgetEventPrefix: "drop",
|
42
|
+
options: {
|
43
|
+
accept: "*",
|
44
|
+
addClasses: true,
|
45
|
+
greedy: false,
|
46
|
+
scope: "default",
|
47
|
+
tolerance: "intersect",
|
48
|
+
|
49
|
+
// Callbacks
|
50
|
+
activate: null,
|
51
|
+
deactivate: null,
|
52
|
+
drop: null,
|
53
|
+
out: null,
|
54
|
+
over: null
|
55
|
+
},
|
56
|
+
_create: function() {
|
57
|
+
|
58
|
+
var proportions,
|
59
|
+
o = this.options,
|
60
|
+
accept = o.accept;
|
61
|
+
|
62
|
+
this.isover = false;
|
63
|
+
this.isout = true;
|
64
|
+
|
65
|
+
this.accept = $.isFunction( accept ) ? accept : function( d ) {
|
66
|
+
return d.is( accept );
|
67
|
+
};
|
68
|
+
|
69
|
+
this.proportions = function( /* valueToWrite */ ) {
|
70
|
+
if ( arguments.length ) {
|
71
|
+
|
72
|
+
// Store the droppable's proportions
|
73
|
+
proportions = arguments[ 0 ];
|
74
|
+
} else {
|
75
|
+
|
76
|
+
// Retrieve or derive the droppable's proportions
|
77
|
+
return proportions ?
|
78
|
+
proportions :
|
79
|
+
proportions = {
|
80
|
+
width: this.element[ 0 ].offsetWidth,
|
81
|
+
height: this.element[ 0 ].offsetHeight
|
82
|
+
};
|
83
|
+
}
|
84
|
+
};
|
85
|
+
|
86
|
+
this._addToManager( o.scope );
|
87
|
+
|
88
|
+
o.addClasses && this._addClass( "ui-droppable" );
|
89
|
+
|
90
|
+
},
|
91
|
+
|
92
|
+
_addToManager: function( scope ) {
|
93
|
+
|
94
|
+
// Add the reference and positions to the manager
|
95
|
+
$.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
|
96
|
+
$.ui.ddmanager.droppables[ scope ].push( this );
|
97
|
+
},
|
98
|
+
|
99
|
+
_splice: function( drop ) {
|
100
|
+
var i = 0;
|
101
|
+
for ( ; i < drop.length; i++ ) {
|
102
|
+
if ( drop[ i ] === this ) {
|
103
|
+
drop.splice( i, 1 );
|
104
|
+
}
|
105
|
+
}
|
106
|
+
},
|
107
|
+
|
108
|
+
_destroy: function() {
|
109
|
+
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
|
110
|
+
|
111
|
+
this._splice( drop );
|
112
|
+
},
|
113
|
+
|
114
|
+
_setOption: function( key, value ) {
|
115
|
+
|
116
|
+
if ( key === "accept" ) {
|
117
|
+
this.accept = $.isFunction( value ) ? value : function( d ) {
|
118
|
+
return d.is( value );
|
119
|
+
};
|
120
|
+
} else if ( key === "scope" ) {
|
121
|
+
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
|
122
|
+
|
123
|
+
this._splice( drop );
|
124
|
+
this._addToManager( value );
|
125
|
+
}
|
126
|
+
|
127
|
+
this._super( key, value );
|
128
|
+
},
|
129
|
+
|
130
|
+
_activate: function( event ) {
|
131
|
+
var draggable = $.ui.ddmanager.current;
|
132
|
+
|
133
|
+
this._addActiveClass();
|
134
|
+
if ( draggable ) {
|
135
|
+
this._trigger( "activate", event, this.ui( draggable ) );
|
136
|
+
}
|
137
|
+
},
|
138
|
+
|
139
|
+
_deactivate: function( event ) {
|
140
|
+
var draggable = $.ui.ddmanager.current;
|
141
|
+
|
142
|
+
this._removeActiveClass();
|
143
|
+
if ( draggable ) {
|
144
|
+
this._trigger( "deactivate", event, this.ui( draggable ) );
|
145
|
+
}
|
146
|
+
},
|
147
|
+
|
148
|
+
_over: function( event ) {
|
149
|
+
|
150
|
+
var draggable = $.ui.ddmanager.current;
|
151
|
+
|
152
|
+
// Bail if draggable and droppable are same element
|
153
|
+
if ( !draggable || ( draggable.currentItem ||
|
154
|
+
draggable.element )[ 0 ] === this.element[ 0 ] ) {
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
|
158
|
+
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
|
159
|
+
draggable.element ) ) ) {
|
160
|
+
this._addHoverClass();
|
161
|
+
this._trigger( "over", event, this.ui( draggable ) );
|
162
|
+
}
|
163
|
+
|
164
|
+
},
|
165
|
+
|
166
|
+
_out: function( event ) {
|
167
|
+
|
168
|
+
var draggable = $.ui.ddmanager.current;
|
169
|
+
|
170
|
+
// Bail if draggable and droppable are same element
|
171
|
+
if ( !draggable || ( draggable.currentItem ||
|
172
|
+
draggable.element )[ 0 ] === this.element[ 0 ] ) {
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
|
176
|
+
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
|
177
|
+
draggable.element ) ) ) {
|
178
|
+
this._removeHoverClass();
|
179
|
+
this._trigger( "out", event, this.ui( draggable ) );
|
180
|
+
}
|
181
|
+
|
182
|
+
},
|
183
|
+
|
184
|
+
_drop: function( event, custom ) {
|
185
|
+
|
186
|
+
var draggable = custom || $.ui.ddmanager.current,
|
187
|
+
childrenIntersection = false;
|
188
|
+
|
189
|
+
// Bail if draggable and droppable are same element
|
190
|
+
if ( !draggable || ( draggable.currentItem ||
|
191
|
+
draggable.element )[ 0 ] === this.element[ 0 ] ) {
|
192
|
+
return false;
|
193
|
+
}
|
194
|
+
|
195
|
+
this.element
|
196
|
+
.find( ":data(ui-droppable)" )
|
197
|
+
.not( ".ui-draggable-dragging" )
|
198
|
+
.each( function() {
|
199
|
+
var inst = $( this ).droppable( "instance" );
|
200
|
+
if (
|
201
|
+
inst.options.greedy &&
|
202
|
+
!inst.options.disabled &&
|
203
|
+
inst.options.scope === draggable.options.scope &&
|
204
|
+
inst.accept.call(
|
205
|
+
inst.element[ 0 ], ( draggable.currentItem || draggable.element )
|
206
|
+
) &&
|
207
|
+
intersect(
|
208
|
+
draggable,
|
209
|
+
$.extend( inst, { offset: inst.element.offset() } ),
|
210
|
+
inst.options.tolerance, event
|
211
|
+
)
|
212
|
+
) {
|
213
|
+
childrenIntersection = true;
|
214
|
+
return false; }
|
215
|
+
} );
|
216
|
+
if ( childrenIntersection ) {
|
217
|
+
return false;
|
218
|
+
}
|
219
|
+
|
220
|
+
if ( this.accept.call( this.element[ 0 ],
|
221
|
+
( draggable.currentItem || draggable.element ) ) ) {
|
222
|
+
this._removeActiveClass();
|
223
|
+
this._removeHoverClass();
|
224
|
+
|
225
|
+
this._trigger( "drop", event, this.ui( draggable ) );
|
226
|
+
return this.element;
|
227
|
+
}
|
228
|
+
|
229
|
+
return false;
|
230
|
+
|
231
|
+
},
|
232
|
+
|
233
|
+
ui: function( c ) {
|
234
|
+
return {
|
235
|
+
draggable: ( c.currentItem || c.element ),
|
236
|
+
helper: c.helper,
|
237
|
+
position: c.position,
|
238
|
+
offset: c.positionAbs
|
239
|
+
};
|
240
|
+
},
|
241
|
+
|
242
|
+
// Extension points just to make backcompat sane and avoid duplicating logic
|
243
|
+
// TODO: Remove in 1.13 along with call to it below
|
244
|
+
_addHoverClass: function() {
|
245
|
+
this._addClass( "ui-droppable-hover" );
|
246
|
+
},
|
247
|
+
|
248
|
+
_removeHoverClass: function() {
|
249
|
+
this._removeClass( "ui-droppable-hover" );
|
250
|
+
},
|
251
|
+
|
252
|
+
_addActiveClass: function() {
|
253
|
+
this._addClass( "ui-droppable-active" );
|
254
|
+
},
|
255
|
+
|
256
|
+
_removeActiveClass: function() {
|
257
|
+
this._removeClass( "ui-droppable-active" );
|
258
|
+
}
|
259
|
+
} );
|
260
|
+
|
261
|
+
var intersect = $.ui.intersect = ( function() {
|
262
|
+
function isOverAxis( x, reference, size ) {
|
263
|
+
return ( x >= reference ) && ( x < ( reference + size ) );
|
264
|
+
}
|
265
|
+
|
266
|
+
return function( draggable, droppable, toleranceMode, event ) {
|
267
|
+
|
268
|
+
if ( !droppable.offset ) {
|
269
|
+
return false;
|
270
|
+
}
|
271
|
+
|
272
|
+
var x1 = ( draggable.positionAbs ||
|
273
|
+
draggable.position.absolute ).left + draggable.margins.left,
|
274
|
+
y1 = ( draggable.positionAbs ||
|
275
|
+
draggable.position.absolute ).top + draggable.margins.top,
|
276
|
+
x2 = x1 + draggable.helperProportions.width,
|
277
|
+
y2 = y1 + draggable.helperProportions.height,
|
278
|
+
l = droppable.offset.left,
|
279
|
+
t = droppable.offset.top,
|
280
|
+
r = l + droppable.proportions().width,
|
281
|
+
b = t + droppable.proportions().height;
|
282
|
+
|
283
|
+
switch ( toleranceMode ) {
|
284
|
+
case "fit":
|
285
|
+
return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
|
286
|
+
case "intersect":
|
287
|
+
return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
|
288
|
+
x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
|
289
|
+
t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
|
290
|
+
y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
|
291
|
+
case "pointer":
|
292
|
+
return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
|
293
|
+
isOverAxis( event.pageX, l, droppable.proportions().width );
|
294
|
+
case "touch":
|
295
|
+
return (
|
296
|
+
( y1 >= t && y1 <= b ) || // Top edge touching
|
297
|
+
( y2 >= t && y2 <= b ) || // Bottom edge touching
|
298
|
+
( y1 < t && y2 > b ) // Surrounded vertically
|
299
|
+
) && (
|
300
|
+
( x1 >= l && x1 <= r ) || // Left edge touching
|
301
|
+
( x2 >= l && x2 <= r ) || // Right edge touching
|
302
|
+
( x1 < l && x2 > r ) // Surrounded horizontally
|
303
|
+
);
|
304
|
+
default:
|
305
|
+
return false;
|
306
|
+
}
|
307
|
+
};
|
308
|
+
} )();
|
309
|
+
|
310
|
+
/*
|
311
|
+
This manager tracks offsets of draggables and droppables
|
312
|
+
*/
|
313
|
+
$.ui.ddmanager = {
|
314
|
+
current: null,
|
315
|
+
droppables: { "default": [] },
|
316
|
+
prepareOffsets: function( t, event ) {
|
317
|
+
|
318
|
+
var i, j,
|
319
|
+
m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
|
320
|
+
type = event ? event.type : null, // workaround for #2317
|
321
|
+
list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
|
322
|
+
|
323
|
+
droppablesLoop: for ( i = 0; i < m.length; i++ ) {
|
324
|
+
|
325
|
+
// No disabled and non-accepted
|
326
|
+
if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
|
327
|
+
( t.currentItem || t.element ) ) ) ) {
|
328
|
+
continue;
|
329
|
+
}
|
330
|
+
|
331
|
+
// Filter out elements in the current dragged item
|
332
|
+
for ( j = 0; j < list.length; j++ ) {
|
333
|
+
if ( list[ j ] === m[ i ].element[ 0 ] ) {
|
334
|
+
m[ i ].proportions().height = 0;
|
335
|
+
continue droppablesLoop;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
|
339
|
+
m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
|
340
|
+
if ( !m[ i ].visible ) {
|
341
|
+
continue;
|
342
|
+
}
|
343
|
+
|
344
|
+
// Activate the droppable if used directly from draggables
|
345
|
+
if ( type === "mousedown" ) {
|
346
|
+
m[ i ]._activate.call( m[ i ], event );
|
347
|
+
}
|
348
|
+
|
349
|
+
m[ i ].offset = m[ i ].element.offset();
|
350
|
+
m[ i ].proportions( {
|
351
|
+
width: m[ i ].element[ 0 ].offsetWidth,
|
352
|
+
height: m[ i ].element[ 0 ].offsetHeight
|
353
|
+
} );
|
354
|
+
|
355
|
+
}
|
356
|
+
|
357
|
+
},
|
358
|
+
drop: function( draggable, event ) {
|
359
|
+
|
360
|
+
var dropped = false;
|
361
|
+
|
362
|
+
// Create a copy of the droppables in case the list changes during the drop (#9116)
|
363
|
+
$.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
|
364
|
+
|
365
|
+
if ( !this.options ) {
|
366
|
+
return;
|
367
|
+
}
|
368
|
+
if ( !this.options.disabled && this.visible &&
|
369
|
+
intersect( draggable, this, this.options.tolerance, event ) ) {
|
370
|
+
dropped = this._drop.call( this, event ) || dropped;
|
371
|
+
}
|
372
|
+
|
373
|
+
if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
|
374
|
+
( draggable.currentItem || draggable.element ) ) ) {
|
375
|
+
this.isout = true;
|
376
|
+
this.isover = false;
|
377
|
+
this._deactivate.call( this, event );
|
378
|
+
}
|
379
|
+
|
380
|
+
} );
|
381
|
+
return dropped;
|
382
|
+
|
383
|
+
},
|
384
|
+
dragStart: function( draggable, event ) {
|
385
|
+
|
386
|
+
// Listen for scrolling so that if the dragging causes scrolling the position of the
|
387
|
+
// droppables can be recalculated (see #5003)
|
388
|
+
draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
|
389
|
+
if ( !draggable.options.refreshPositions ) {
|
390
|
+
$.ui.ddmanager.prepareOffsets( draggable, event );
|
391
|
+
}
|
392
|
+
} );
|
393
|
+
},
|
394
|
+
drag: function( draggable, event ) {
|
395
|
+
|
396
|
+
// If you have a highly dynamic page, you might try this option. It renders positions
|
397
|
+
// every time you move the mouse.
|
398
|
+
if ( draggable.options.refreshPositions ) {
|
399
|
+
$.ui.ddmanager.prepareOffsets( draggable, event );
|
400
|
+
}
|
401
|
+
|
402
|
+
// Run through all droppables and check their positions based on specific tolerance options
|
403
|
+
$.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
|
404
|
+
|
405
|
+
if ( this.options.disabled || this.greedyChild || !this.visible ) {
|
406
|
+
return;
|
407
|
+
}
|
408
|
+
|
409
|
+
var parentInstance, scope, parent,
|
410
|
+
intersects = intersect( draggable, this, this.options.tolerance, event ),
|
411
|
+
c = !intersects && this.isover ?
|
412
|
+
"isout" :
|
413
|
+
( intersects && !this.isover ? "isover" : null );
|
414
|
+
if ( !c ) {
|
415
|
+
return;
|
416
|
+
}
|
417
|
+
|
418
|
+
if ( this.options.greedy ) {
|
419
|
+
|
420
|
+
// find droppable parents with same scope
|
421
|
+
scope = this.options.scope;
|
422
|
+
parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
|
423
|
+
return $( this ).droppable( "instance" ).options.scope === scope;
|
424
|
+
} );
|
425
|
+
|
426
|
+
if ( parent.length ) {
|
427
|
+
parentInstance = $( parent[ 0 ] ).droppable( "instance" );
|
428
|
+
parentInstance.greedyChild = ( c === "isover" );
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
// We just moved into a greedy child
|
433
|
+
if ( parentInstance && c === "isover" ) {
|
434
|
+
parentInstance.isover = false;
|
435
|
+
parentInstance.isout = true;
|
436
|
+
parentInstance._out.call( parentInstance, event );
|
437
|
+
}
|
438
|
+
|
439
|
+
this[ c ] = true;
|
440
|
+
this[ c === "isout" ? "isover" : "isout" ] = false;
|
441
|
+
this[ c === "isover" ? "_over" : "_out" ].call( this, event );
|
442
|
+
|
443
|
+
// We just moved out of a greedy child
|
444
|
+
if ( parentInstance && c === "isout" ) {
|
445
|
+
parentInstance.isout = false;
|
446
|
+
parentInstance.isover = true;
|
447
|
+
parentInstance._over.call( parentInstance, event );
|
448
|
+
}
|
449
|
+
} );
|
450
|
+
|
451
|
+
},
|
452
|
+
dragStop: function( draggable, event ) {
|
453
|
+
draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
|
454
|
+
|
455
|
+
// Call prepareOffsets one final time since IE does not fire return scroll events when
|
456
|
+
// overflow was caused by drag (see #5003)
|
457
|
+
if ( !draggable.options.refreshPositions ) {
|
458
|
+
$.ui.ddmanager.prepareOffsets( draggable, event );
|
459
|
+
}
|
460
|
+
}
|
461
|
+
};
|
462
|
+
|
463
|
+
// DEPRECATED
|
464
|
+
// TODO: switch return back to widget declaration at top of file when this is removed
|
465
|
+
if ( $.uiBackCompat !== false ) {
|
466
|
+
|
467
|
+
// Backcompat for activeClass and hoverClass options
|
468
|
+
$.widget( "ui.droppable", $.ui.droppable, {
|
469
|
+
options: {
|
470
|
+
hoverClass: false,
|
471
|
+
activeClass: false
|
472
|
+
},
|
473
|
+
_addActiveClass: function() {
|
474
|
+
this._super();
|
475
|
+
if ( this.options.activeClass ) {
|
476
|
+
this.element.addClass( this.options.activeClass );
|
477
|
+
}
|
478
|
+
},
|
479
|
+
_removeActiveClass: function() {
|
480
|
+
this._super();
|
481
|
+
if ( this.options.activeClass ) {
|
482
|
+
this.element.removeClass( this.options.activeClass );
|
483
|
+
}
|
484
|
+
},
|
485
|
+
_addHoverClass: function() {
|
486
|
+
this._super();
|
487
|
+
if ( this.options.hoverClass ) {
|
488
|
+
this.element.addClass( this.options.hoverClass );
|
489
|
+
}
|
490
|
+
},
|
491
|
+
_removeHoverClass: function() {
|
492
|
+
this._super();
|
493
|
+
if ( this.options.hoverClass ) {
|
494
|
+
this.element.removeClass( this.options.hoverClass );
|
495
|
+
}
|
496
|
+
}
|
497
|
+
} );
|
498
|
+
}
|
499
|
+
|
500
|
+
return $.ui.droppable;
|
501
|
+
|
502
|
+
} ) );
|