jquery-ui-rails 4.2.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/History.md +6 -0
- data/README.md +69 -73
- data/Rakefile +28 -24
- data/VERSIONS.md +1 -0
- data/app/assets/javascripts/jquery-ui.js +37 -0
- data/app/assets/javascripts/{jquery.ui.accordion.js → jquery-ui/accordion.js} +62 -57
- data/app/assets/javascripts/{jquery.ui.autocomplete.js → jquery-ui/autocomplete.js} +70 -50
- data/app/assets/javascripts/{jquery.ui.button.js → jquery-ui/button.js} +41 -25
- data/app/assets/javascripts/{jquery.ui.core.js → jquery-ui/core.js} +106 -123
- data/app/assets/javascripts/jquery-ui/datepicker-af.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ar-DZ.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ar.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-az.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-be.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-bg.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-bs.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ca.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-cs.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-cy-GB.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-da.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-de.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-el.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-AU.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-GB.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-NZ.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-eo.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-es.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-et.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-eu.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fa.js +73 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fo.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CA.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr.js +39 -0
- data/app/assets/javascripts/jquery-ui/datepicker-gl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-he.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hu.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hy.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-id.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-is.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-it-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-it.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ja.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ka.js +35 -0
- data/app/assets/javascripts/jquery-ui/datepicker-kk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-km.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ko.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ky.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lb.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lt.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lv.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-mk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ml.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ms.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nb.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nl-BE.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nn.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-no.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pt-BR.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pt.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-rm.js +35 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ro.js +40 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ru.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sl.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sq.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sr-SR.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sv.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ta.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-th.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-tj.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-tr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-uk.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-vi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-CN.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-HK.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-TW.js +37 -0
- data/app/assets/javascripts/{jquery.ui.datepicker.js → jquery-ui/datepicker.js} +72 -37
- data/app/assets/javascripts/{jquery.ui.dialog.js → jquery-ui/dialog.js} +215 -180
- data/app/assets/javascripts/{jquery.ui.draggable.js → jquery-ui/draggable.js} +219 -161
- data/app/assets/javascripts/jquery-ui/droppable.js +421 -0
- data/app/assets/javascripts/{jquery.ui.effect-blind.js → jquery-ui/effect-blind.js} +20 -12
- data/app/assets/javascripts/{jquery.ui.effect-bounce.js → jquery-ui/effect-bounce.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-clip.js → jquery-ui/effect-clip.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-drop.js → jquery-ui/effect-drop.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-explode.js → jquery-ui/effect-explode.js} +20 -10
- data/app/assets/javascripts/{jquery.ui.effect-fade.js → jquery-ui/effect-fade.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-fold.js → jquery-ui/effect-fold.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-highlight.js → jquery-ui/effect-highlight.js} +18 -8
- data/app/assets/javascripts/jquery-ui/effect-puff.js +63 -0
- data/app/assets/javascripts/{jquery.ui.effect-pulsate.js → jquery-ui/effect-pulsate.js} +18 -8
- data/app/assets/javascripts/jquery-ui/effect-scale.js +92 -0
- data/app/assets/javascripts/{jquery.ui.effect-shake.js → jquery-ui/effect-shake.js} +19 -9
- data/app/assets/javascripts/{jquery.ui.effect-scale.js → jquery-ui/effect-size.js} +19 -104
- data/app/assets/javascripts/{jquery.ui.effect-slide.js → jquery-ui/effect-slide.js} +18 -8
- data/app/assets/javascripts/{jquery.ui.effect-transfer.js → jquery-ui/effect-transfer.js} +22 -12
- data/app/assets/javascripts/jquery-ui/effect.all.js +16 -0
- data/app/assets/javascripts/{jquery.ui.effect.js → jquery-ui/effect.js} +28 -20
- data/app/assets/javascripts/{jquery.ui.menu.js → jquery-ui/menu.js} +93 -80
- data/app/assets/javascripts/{jquery.ui.mouse.js → jquery-ui/mouse.js} +41 -23
- data/app/assets/javascripts/{jquery.ui.position.js → jquery-ui/position.js} +25 -12
- data/app/assets/javascripts/{jquery.ui.progressbar.js → jquery-ui/progressbar.js} +26 -12
- data/app/assets/javascripts/{jquery.ui.resizable.js → jquery-ui/resizable.js} +196 -146
- data/app/assets/javascripts/{jquery.ui.selectable.js → jquery-ui/selectable.js} +25 -15
- data/app/assets/javascripts/jquery-ui/selectmenu.js +560 -0
- data/app/assets/javascripts/{jquery.ui.slider.js → jquery-ui/slider.js} +43 -31
- data/app/assets/javascripts/{jquery.ui.sortable.js → jquery-ui/sortable.js} +71 -50
- data/app/assets/javascripts/{jquery.ui.spinner.js → jquery-ui/spinner.js} +46 -29
- data/app/assets/javascripts/{jquery.ui.tabs.js → jquery-ui/tabs.js} +69 -52
- data/app/assets/javascripts/{jquery.ui.tooltip.js → jquery-ui/tooltip.js} +97 -55
- data/app/assets/javascripts/{jquery.ui.widget.js → jquery-ui/widget.js} +52 -30
- data/app/assets/stylesheets/jquery-ui.css +1 -0
- data/app/assets/stylesheets/{jquery.ui.accordion.css.erb → jquery-ui/accordion.css.erb} +5 -7
- data/app/assets/stylesheets/{jquery.ui.all.css.erb → jquery-ui/all.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.autocomplete.css.erb → jquery-ui/autocomplete.css.erb} +4 -4
- data/app/assets/stylesheets/jquery-ui/base.css.erb +30 -0
- data/app/assets/stylesheets/{jquery.ui.button.css.erb → jquery-ui/button.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.core.css.erb → jquery-ui/core.css.erb} +4 -1
- data/app/assets/stylesheets/{jquery.ui.datepicker.css.erb → jquery-ui/datepicker.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.dialog.css.erb → jquery-ui/dialog.css.erb} +6 -5
- data/app/assets/stylesheets/jquery-ui/draggable.css.erb +16 -0
- data/app/assets/stylesheets/{jquery.ui.menu.css.erb → jquery-ui/menu.css.erb} +18 -34
- data/app/assets/stylesheets/{jquery.ui.progressbar.css.erb → jquery-ui/progressbar.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.resizable.css.erb → jquery-ui/resizable.css.erb} +5 -3
- data/app/assets/stylesheets/{jquery.ui.selectable.css.erb → jquery-ui/selectable.css.erb} +7 -3
- data/app/assets/stylesheets/jquery-ui/selectmenu.css.erb +64 -0
- data/app/assets/stylesheets/{jquery.ui.slider.css.erb → jquery-ui/slider.css.erb} +5 -3
- data/app/assets/stylesheets/jquery-ui/sortable.css.erb +16 -0
- data/app/assets/stylesheets/{jquery.ui.spinner.css.erb → jquery-ui/spinner.css.erb} +4 -4
- data/app/assets/stylesheets/{jquery.ui.tabs.css.erb → jquery-ui/tabs.css.erb} +3 -3
- data/app/assets/stylesheets/{jquery.ui.theme.css.erb → jquery-ui/theme.css.erb} +1 -4
- data/app/assets/stylesheets/{jquery.ui.tooltip.css.erb → jquery-ui/tooltip.css.erb} +3 -3
- data/lib/jquery/ui/rails/version.rb +2 -2
- metadata +137 -129
- data/app/assets/javascripts/jquery.ui.all.js +0 -34
- data/app/assets/javascripts/jquery.ui.datepicker-af.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ar.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-az.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-be.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-bg.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-bs.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ca.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-cs.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-cy-GB.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-da.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-de.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-el.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-en-AU.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-en-GB.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-en-NZ.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-eo.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-es.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-et.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-eu.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fa.js +0 -59
- data/app/assets/javascripts/jquery.ui.datepicker-fi.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fo.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fr-CA.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fr-CH.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-fr.js +0 -25
- data/app/assets/javascripts/jquery.ui.datepicker-gl.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-he.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hi.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hr.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hu.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-hy.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-id.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-is.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-it.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ja.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ka.js +0 -21
- data/app/assets/javascripts/jquery.ui.datepicker-kk.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-km.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ko.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ky.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-lb.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-lt.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-lv.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-mk.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ml.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ms.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-nb.js +0 -22
- data/app/assets/javascripts/jquery.ui.datepicker-nl-BE.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-nl.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-nn.js +0 -22
- data/app/assets/javascripts/jquery.ui.datepicker-no.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-pl.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-pt-BR.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-pt.js +0 -22
- data/app/assets/javascripts/jquery.ui.datepicker-rm.js +0 -21
- data/app/assets/javascripts/jquery.ui.datepicker-ro.js +0 -26
- data/app/assets/javascripts/jquery.ui.datepicker-ru.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sk.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sl.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-sq.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sr-SR.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sr.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-sv.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-ta.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-th.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-tj.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-tr.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-uk.js +0 -24
- data/app/assets/javascripts/jquery.ui.datepicker-vi.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-zh-CN.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-zh-HK.js +0 -23
- data/app/assets/javascripts/jquery.ui.datepicker-zh-TW.js +0 -23
- data/app/assets/javascripts/jquery.ui.droppable.js +0 -394
- data/app/assets/javascripts/jquery.ui.effect.all.js +0 -14
- data/app/assets/stylesheets/jquery.ui.base.css.erb +0 -27
@@ -1,9 +1,9 @@
|
|
1
|
-
//= require jquery
|
2
|
-
//= require jquery
|
3
|
-
//= require jquery
|
1
|
+
//= require jquery-ui/core
|
2
|
+
//= require jquery-ui/widget
|
3
|
+
//= require jquery-ui/mouse
|
4
4
|
|
5
5
|
/*!
|
6
|
-
* jQuery UI Draggable 1.
|
6
|
+
* jQuery UI Draggable 1.11.0
|
7
7
|
* http://jqueryui.com
|
8
8
|
*
|
9
9
|
* Copyright 2014 jQuery Foundation and other contributors
|
@@ -11,16 +11,26 @@
|
|
11
11
|
* http://jquery.org/license
|
12
12
|
*
|
13
13
|
* http://api.jqueryui.com/draggable/
|
14
|
-
*
|
15
|
-
* Depends:
|
16
|
-
* jquery.ui.core.js
|
17
|
-
* jquery.ui.mouse.js
|
18
|
-
* jquery.ui.widget.js
|
19
14
|
*/
|
20
|
-
(function(
|
15
|
+
(function( factory ) {
|
16
|
+
if ( typeof define === "function" && define.amd ) {
|
17
|
+
|
18
|
+
// AMD. Register as an anonymous module.
|
19
|
+
define([
|
20
|
+
"jquery",
|
21
|
+
"./core",
|
22
|
+
"./mouse",
|
23
|
+
"./widget"
|
24
|
+
], factory );
|
25
|
+
} else {
|
26
|
+
|
27
|
+
// Browser globals
|
28
|
+
factory( jQuery );
|
29
|
+
}
|
30
|
+
}(function( $ ) {
|
21
31
|
|
22
32
|
$.widget("ui.draggable", $.ui.mouse, {
|
23
|
-
version: "1.
|
33
|
+
version: "1.11.0",
|
24
34
|
widgetEventPrefix: "drag",
|
25
35
|
options: {
|
26
36
|
addClasses: true,
|
@@ -64,19 +74,43 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
64
74
|
if (this.options.disabled){
|
65
75
|
this.element.addClass("ui-draggable-disabled");
|
66
76
|
}
|
77
|
+
this._setHandleClassName();
|
67
78
|
|
68
79
|
this._mouseInit();
|
80
|
+
},
|
69
81
|
|
82
|
+
_setOption: function( key, value ) {
|
83
|
+
this._super( key, value );
|
84
|
+
if ( key === "handle" ) {
|
85
|
+
this._setHandleClassName();
|
86
|
+
}
|
70
87
|
},
|
71
88
|
|
72
89
|
_destroy: function() {
|
90
|
+
if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
|
91
|
+
this.destroyOnClear = true;
|
92
|
+
return;
|
93
|
+
}
|
73
94
|
this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
|
95
|
+
this._removeHandleClassName();
|
74
96
|
this._mouseDestroy();
|
75
97
|
},
|
76
98
|
|
77
99
|
_mouseCapture: function(event) {
|
78
100
|
|
79
|
-
var
|
101
|
+
var document = this.document[ 0 ],
|
102
|
+
o = this.options;
|
103
|
+
|
104
|
+
// support: IE9
|
105
|
+
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
|
106
|
+
try {
|
107
|
+
// Support: IE9+
|
108
|
+
// If the <body> is blurred, IE will switch windows, see #9520
|
109
|
+
if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
|
110
|
+
// Blur any element that currently has focus, see #4261
|
111
|
+
$( document.activeElement ).blur();
|
112
|
+
}
|
113
|
+
} catch ( error ) {}
|
80
114
|
|
81
115
|
// among others, prevent a drag on a resizable-handle
|
82
116
|
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
|
@@ -92,7 +126,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
92
126
|
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
|
93
127
|
$("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>")
|
94
128
|
.css({
|
95
|
-
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
|
129
|
+
width: this.offsetWidth + "px", height: this.offsetHeight + "px",
|
96
130
|
position: "absolute", opacity: "0.001", zIndex: 1000
|
97
131
|
})
|
98
132
|
.css($(this).offset())
|
@@ -116,7 +150,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
116
150
|
this._cacheHelperProportions();
|
117
151
|
|
118
152
|
//If ddmanager is used for droppables, set the global draggable
|
119
|
-
if($.ui.ddmanager) {
|
153
|
+
if ($.ui.ddmanager) {
|
120
154
|
$.ui.ddmanager.current = this;
|
121
155
|
}
|
122
156
|
|
@@ -154,7 +188,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
154
188
|
});
|
155
189
|
|
156
190
|
//Generate the original position
|
157
|
-
this.originalPosition = this.position = this._generatePosition(event);
|
191
|
+
this.originalPosition = this.position = this._generatePosition( event, false );
|
158
192
|
this.originalPageX = event.pageX;
|
159
193
|
this.originalPageY = event.pageY;
|
160
194
|
|
@@ -165,7 +199,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
165
199
|
this._setContainment();
|
166
200
|
|
167
201
|
//Trigger event + callbacks
|
168
|
-
if(this._trigger("start", event) === false) {
|
202
|
+
if (this._trigger("start", event) === false) {
|
169
203
|
this._clear();
|
170
204
|
return false;
|
171
205
|
}
|
@@ -178,7 +212,6 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
178
212
|
$.ui.ddmanager.prepareOffsets(this, event);
|
179
213
|
}
|
180
214
|
|
181
|
-
|
182
215
|
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
183
216
|
|
184
217
|
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
|
@@ -196,26 +229,23 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
196
229
|
}
|
197
230
|
|
198
231
|
//Compute the helpers position
|
199
|
-
this.position = this._generatePosition(event);
|
232
|
+
this.position = this._generatePosition( event, true );
|
200
233
|
this.positionAbs = this._convertPositionTo("absolute");
|
201
234
|
|
202
235
|
//Call plugins and callbacks and use the resulting position if something is returned
|
203
236
|
if (!noPropagation) {
|
204
237
|
var ui = this._uiHash();
|
205
|
-
if(this._trigger("drag", event, ui) === false) {
|
238
|
+
if (this._trigger("drag", event, ui) === false) {
|
206
239
|
this._mouseUp({});
|
207
240
|
return false;
|
208
241
|
}
|
209
242
|
this.position = ui.position;
|
210
243
|
}
|
211
244
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
if(
|
216
|
-
this.helper[0].style.top = this.position.top+"px";
|
217
|
-
}
|
218
|
-
if($.ui.ddmanager) {
|
245
|
+
this.helper[ 0 ].style.left = this.position.left + "px";
|
246
|
+
this.helper[ 0 ].style.top = this.position.top + "px";
|
247
|
+
|
248
|
+
if ($.ui.ddmanager) {
|
219
249
|
$.ui.ddmanager.drag(this, event);
|
220
250
|
}
|
221
251
|
|
@@ -232,24 +262,19 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
232
262
|
}
|
233
263
|
|
234
264
|
//if a drop comes from outside (a sortable)
|
235
|
-
if(this.dropped) {
|
265
|
+
if (this.dropped) {
|
236
266
|
dropped = this.dropped;
|
237
267
|
this.dropped = false;
|
238
268
|
}
|
239
269
|
|
240
|
-
|
241
|
-
if ( this.options.helper === "original" && !$.contains( this.element[ 0 ].ownerDocument, this.element[ 0 ] ) ) {
|
242
|
-
return false;
|
243
|
-
}
|
244
|
-
|
245
|
-
if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
|
270
|
+
if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
|
246
271
|
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
|
247
|
-
if(that._trigger("stop", event) !== false) {
|
272
|
+
if (that._trigger("stop", event) !== false) {
|
248
273
|
that._clear();
|
249
274
|
}
|
250
275
|
});
|
251
276
|
} else {
|
252
|
-
if(this._trigger("stop", event) !== false) {
|
277
|
+
if (this._trigger("stop", event) !== false) {
|
253
278
|
this._clear();
|
254
279
|
}
|
255
280
|
}
|
@@ -264,16 +289,19 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
264
289
|
});
|
265
290
|
|
266
291
|
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
|
267
|
-
if( $.ui.ddmanager ) {
|
292
|
+
if ( $.ui.ddmanager ) {
|
268
293
|
$.ui.ddmanager.dragStop(this, event);
|
269
294
|
}
|
270
295
|
|
296
|
+
// The interaction is over; whether or not the click resulted in a drag, focus the element
|
297
|
+
this.element.focus();
|
298
|
+
|
271
299
|
return $.ui.mouse.prototype._mouseUp.call(this, event);
|
272
300
|
},
|
273
301
|
|
274
302
|
cancel: function() {
|
275
303
|
|
276
|
-
if(this.helper.is(".ui-draggable-dragging")) {
|
304
|
+
if (this.helper.is(".ui-draggable-dragging")) {
|
277
305
|
this._mouseUp({});
|
278
306
|
} else {
|
279
307
|
this._clear();
|
@@ -289,16 +317,27 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
289
317
|
true;
|
290
318
|
},
|
291
319
|
|
320
|
+
_setHandleClassName: function() {
|
321
|
+
this._removeHandleClassName();
|
322
|
+
$( this.options.handle || this.element ).addClass( "ui-draggable-handle" );
|
323
|
+
},
|
324
|
+
|
325
|
+
_removeHandleClassName: function() {
|
326
|
+
this.element.find( ".ui-draggable-handle" )
|
327
|
+
.addBack()
|
328
|
+
.removeClass( "ui-draggable-handle" );
|
329
|
+
},
|
330
|
+
|
292
331
|
_createHelper: function(event) {
|
293
332
|
|
294
333
|
var o = this.options,
|
295
|
-
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
|
334
|
+
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[ 0 ], [ event ])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
|
296
335
|
|
297
|
-
if(!helper.parents("body").length) {
|
336
|
+
if (!helper.parents("body").length) {
|
298
337
|
helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
|
299
338
|
}
|
300
339
|
|
301
|
-
if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
|
340
|
+
if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
|
302
341
|
helper.css("position", "absolute");
|
303
342
|
}
|
304
343
|
|
@@ -311,7 +350,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
311
350
|
obj = obj.split(" ");
|
312
351
|
}
|
313
352
|
if ($.isArray(obj)) {
|
314
|
-
obj = {left: +obj[0], top: +obj[1] || 0};
|
353
|
+
obj = { left: +obj[0], top: +obj[1] || 0 };
|
315
354
|
}
|
316
355
|
if ("left" in obj) {
|
317
356
|
this.offset.click.left = obj.left + this.margins.left;
|
@@ -327,24 +366,26 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
327
366
|
}
|
328
367
|
},
|
329
368
|
|
369
|
+
_isRootNode: function( element ) {
|
370
|
+
return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
|
371
|
+
},
|
372
|
+
|
330
373
|
_getParentOffset: function() {
|
331
374
|
|
332
375
|
//Get the offsetParent and cache its position
|
333
|
-
var po = this.offsetParent.offset()
|
376
|
+
var po = this.offsetParent.offset(),
|
377
|
+
document = this.document[ 0 ];
|
334
378
|
|
335
379
|
// This is a special case where we need to modify a offset calculated on start, since the following happened:
|
336
380
|
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
337
381
|
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
338
382
|
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
339
|
-
if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
383
|
+
if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
340
384
|
po.left += this.scrollParent.scrollLeft();
|
341
385
|
po.top += this.scrollParent.scrollTop();
|
342
386
|
}
|
343
387
|
|
344
|
-
|
345
|
-
//Ugly IE fix
|
346
|
-
if((this.offsetParent[0] === document.body) ||
|
347
|
-
(this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
|
388
|
+
if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
|
348
389
|
po = { top: 0, left: 0 };
|
349
390
|
}
|
350
391
|
|
@@ -356,17 +397,18 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
356
397
|
},
|
357
398
|
|
358
399
|
_getRelativeOffset: function() {
|
359
|
-
|
360
|
-
if(this.cssPosition === "relative") {
|
361
|
-
var p = this.element.position();
|
362
|
-
return {
|
363
|
-
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
|
364
|
-
left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
|
365
|
-
};
|
366
|
-
} else {
|
400
|
+
if ( this.cssPosition !== "relative" ) {
|
367
401
|
return { top: 0, left: 0 };
|
368
402
|
}
|
369
403
|
|
404
|
+
var p = this.element.position(),
|
405
|
+
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
|
406
|
+
|
407
|
+
return {
|
408
|
+
top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
|
409
|
+
left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
|
410
|
+
};
|
411
|
+
|
370
412
|
},
|
371
413
|
|
372
414
|
_cacheMargins: function() {
|
@@ -388,7 +430,10 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
388
430
|
_setContainment: function() {
|
389
431
|
|
390
432
|
var over, c, ce,
|
391
|
-
o = this.options
|
433
|
+
o = this.options,
|
434
|
+
document = this.document[ 0 ];
|
435
|
+
|
436
|
+
this.relative_container = null;
|
392
437
|
|
393
438
|
if ( !o.containment ) {
|
394
439
|
this.containment = null;
|
@@ -427,7 +472,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
427
472
|
c = $( o.containment );
|
428
473
|
ce = c[ 0 ];
|
429
474
|
|
430
|
-
if( !ce ) {
|
475
|
+
if ( !ce ) {
|
431
476
|
return;
|
432
477
|
}
|
433
478
|
|
@@ -435,7 +480,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
435
480
|
|
436
481
|
this.containment = [
|
437
482
|
( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
|
438
|
-
( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 )
|
483
|
+
( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
|
439
484
|
( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right,
|
440
485
|
( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top - this.margins.bottom
|
441
486
|
];
|
@@ -444,46 +489,44 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
444
489
|
|
445
490
|
_convertPositionTo: function(d, pos) {
|
446
491
|
|
447
|
-
if(!pos) {
|
492
|
+
if (!pos) {
|
448
493
|
pos = this.position;
|
449
494
|
}
|
450
495
|
|
451
496
|
var mod = d === "absolute" ? 1 : -1,
|
452
|
-
|
453
|
-
|
454
|
-
//Cache the scroll
|
455
|
-
if (!this.offset.scroll) {
|
456
|
-
this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()};
|
457
|
-
}
|
497
|
+
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
|
458
498
|
|
459
499
|
return {
|
460
500
|
top: (
|
461
501
|
pos.top + // The absolute mouse position
|
462
502
|
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
463
503
|
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
|
464
|
-
( ( this.cssPosition === "fixed" ? -this.
|
504
|
+
( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
|
465
505
|
),
|
466
506
|
left: (
|
467
507
|
pos.left + // The absolute mouse position
|
468
508
|
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
469
509
|
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
|
470
|
-
( ( this.cssPosition === "fixed" ? -this.
|
510
|
+
( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
|
471
511
|
)
|
472
512
|
};
|
473
513
|
|
474
514
|
},
|
475
515
|
|
476
|
-
_generatePosition: function(event) {
|
516
|
+
_generatePosition: function( event, constrainPosition ) {
|
477
517
|
|
478
518
|
var containment, co, top, left,
|
479
519
|
o = this.options,
|
480
|
-
|
520
|
+
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
|
481
521
|
pageX = event.pageX,
|
482
522
|
pageY = event.pageY;
|
483
523
|
|
484
|
-
//Cache the scroll
|
485
|
-
if (!this.offset.scroll) {
|
486
|
-
this.offset.scroll = {
|
524
|
+
// Cache the scroll
|
525
|
+
if ( !scrollIsRootNode || !this.offset.scroll ) {
|
526
|
+
this.offset.scroll = {
|
527
|
+
top: this.scrollParent.scrollTop(),
|
528
|
+
left: this.scrollParent.scrollLeft()
|
529
|
+
};
|
487
530
|
}
|
488
531
|
|
489
532
|
/*
|
@@ -492,7 +535,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
492
535
|
*/
|
493
536
|
|
494
537
|
// If we are not dragging yet, we won't check for options
|
495
|
-
if (
|
538
|
+
if ( constrainPosition ) {
|
496
539
|
if ( this.containment ) {
|
497
540
|
if ( this.relative_container ){
|
498
541
|
co = this.relative_container.offset();
|
@@ -502,26 +545,25 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
502
545
|
this.containment[ 2 ] + co.left,
|
503
546
|
this.containment[ 3 ] + co.top
|
504
547
|
];
|
505
|
-
}
|
506
|
-
else {
|
548
|
+
} else {
|
507
549
|
containment = this.containment;
|
508
550
|
}
|
509
551
|
|
510
|
-
if(event.pageX - this.offset.click.left < containment[0]) {
|
552
|
+
if (event.pageX - this.offset.click.left < containment[0]) {
|
511
553
|
pageX = containment[0] + this.offset.click.left;
|
512
554
|
}
|
513
|
-
if(event.pageY - this.offset.click.top < containment[1]) {
|
555
|
+
if (event.pageY - this.offset.click.top < containment[1]) {
|
514
556
|
pageY = containment[1] + this.offset.click.top;
|
515
557
|
}
|
516
|
-
if(event.pageX - this.offset.click.left > containment[2]) {
|
558
|
+
if (event.pageX - this.offset.click.left > containment[2]) {
|
517
559
|
pageX = containment[2] + this.offset.click.left;
|
518
560
|
}
|
519
|
-
if(event.pageY - this.offset.click.top > containment[3]) {
|
561
|
+
if (event.pageY - this.offset.click.top > containment[3]) {
|
520
562
|
pageY = containment[3] + this.offset.click.top;
|
521
563
|
}
|
522
564
|
}
|
523
565
|
|
524
|
-
if(o.grid) {
|
566
|
+
if (o.grid) {
|
525
567
|
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
|
526
568
|
top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
|
527
569
|
pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
@@ -530,6 +572,13 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
530
572
|
pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
531
573
|
}
|
532
574
|
|
575
|
+
if ( o.axis === "y" ) {
|
576
|
+
pageX = this.originalPageX;
|
577
|
+
}
|
578
|
+
|
579
|
+
if ( o.axis === "x" ) {
|
580
|
+
pageY = this.originalPageY;
|
581
|
+
}
|
533
582
|
}
|
534
583
|
|
535
584
|
return {
|
@@ -538,14 +587,14 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
538
587
|
this.offset.click.top - // Click offset (relative to the element)
|
539
588
|
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
|
540
589
|
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
|
541
|
-
( this.cssPosition === "fixed" ? -this.
|
590
|
+
( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
|
542
591
|
),
|
543
592
|
left: (
|
544
593
|
pageX - // The absolute mouse position
|
545
594
|
this.offset.click.left - // Click offset (relative to the element)
|
546
595
|
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
|
547
596
|
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
|
548
|
-
( this.cssPosition === "fixed" ? -this.
|
597
|
+
( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
|
549
598
|
)
|
550
599
|
};
|
551
600
|
|
@@ -553,20 +602,23 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
553
602
|
|
554
603
|
_clear: function() {
|
555
604
|
this.helper.removeClass("ui-draggable-dragging");
|
556
|
-
if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
|
605
|
+
if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
|
557
606
|
this.helper.remove();
|
558
607
|
}
|
559
608
|
this.helper = null;
|
560
609
|
this.cancelHelperRemoval = false;
|
610
|
+
if ( this.destroyOnClear ) {
|
611
|
+
this.destroy();
|
612
|
+
}
|
561
613
|
},
|
562
614
|
|
563
615
|
// From now on bulk stuff - mainly helpers
|
564
616
|
|
565
617
|
_trigger: function(type, event, ui) {
|
566
618
|
ui = ui || this._uiHash();
|
567
|
-
$.ui.plugin.call(this, type, [event, ui]);
|
619
|
+
$.ui.plugin.call( this, type, [ event, ui, this ], true );
|
568
620
|
//The absolute position has to be recalculated after plugins
|
569
|
-
if(type === "drag") {
|
621
|
+
if (type === "drag") {
|
570
622
|
this.positionAbs = this._convertPositionTo("absolute");
|
571
623
|
}
|
572
624
|
return $.Widget.prototype._trigger.call(this, type, event, ui);
|
@@ -586,13 +638,13 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
586
638
|
});
|
587
639
|
|
588
640
|
$.ui.plugin.add("draggable", "connectToSortable", {
|
589
|
-
start: function(event, ui) {
|
641
|
+
start: function( event, ui, inst ) {
|
590
642
|
|
591
|
-
var
|
643
|
+
var o = inst.options,
|
592
644
|
uiSortable = $.extend({}, ui, { item: inst.element });
|
593
645
|
inst.sortables = [];
|
594
646
|
$(o.connectToSortable).each(function() {
|
595
|
-
var sortable =
|
647
|
+
var sortable = $( this ).sortable( "instance" );
|
596
648
|
if (sortable && !sortable.options.disabled) {
|
597
649
|
inst.sortables.push({
|
598
650
|
instance: sortable,
|
@@ -604,14 +656,15 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
604
656
|
});
|
605
657
|
|
606
658
|
},
|
607
|
-
stop: function(event, ui) {
|
659
|
+
stop: function( event, ui, inst ) {
|
608
660
|
|
609
661
|
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
|
610
|
-
var
|
611
|
-
|
662
|
+
var uiSortable = $.extend( {}, ui, {
|
663
|
+
item: inst.element
|
664
|
+
});
|
612
665
|
|
613
666
|
$.each(inst.sortables, function() {
|
614
|
-
if(this.instance.isOver) {
|
667
|
+
if (this.instance.isOver) {
|
615
668
|
|
616
669
|
this.instance.isOver = 0;
|
617
670
|
|
@@ -619,7 +672,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
619
672
|
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
|
620
673
|
|
621
674
|
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
|
622
|
-
if(this.shouldRevert) {
|
675
|
+
if (this.shouldRevert) {
|
623
676
|
this.instance.options.revert = this.shouldRevert;
|
624
677
|
}
|
625
678
|
|
@@ -629,7 +682,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
629
682
|
this.instance.options.helper = this.instance.options._helper;
|
630
683
|
|
631
684
|
//If the helper has been the original item, restore properties in the sortable
|
632
|
-
if(inst.options.helper === "original") {
|
685
|
+
if (inst.options.helper === "original") {
|
633
686
|
this.instance.currentItem.css({ top: "auto", left: "auto" });
|
634
687
|
}
|
635
688
|
|
@@ -641,9 +694,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
641
694
|
});
|
642
695
|
|
643
696
|
},
|
644
|
-
drag: function(event, ui) {
|
697
|
+
drag: function( event, ui, inst ) {
|
645
698
|
|
646
|
-
var
|
699
|
+
var that = this;
|
647
700
|
|
648
701
|
$.each(inst.sortables, function() {
|
649
702
|
|
@@ -655,9 +708,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
655
708
|
this.instance.helperProportions = inst.helperProportions;
|
656
709
|
this.instance.offset.click = inst.offset.click;
|
657
710
|
|
658
|
-
if(this.instance._intersectsWith(this.instance.containerCache)) {
|
711
|
+
if (this.instance._intersectsWith(this.instance.containerCache)) {
|
659
712
|
innermostIntersecting = true;
|
660
|
-
$.each(inst.sortables, function
|
713
|
+
$.each(inst.sortables, function() {
|
661
714
|
this.instance.positionAbs = inst.positionAbs;
|
662
715
|
this.instance.helperProportions = inst.helperProportions;
|
663
716
|
this.instance.offset.click = inst.offset.click;
|
@@ -671,10 +724,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
671
724
|
});
|
672
725
|
}
|
673
726
|
|
674
|
-
|
675
|
-
if(innermostIntersecting) {
|
727
|
+
if (innermostIntersecting) {
|
676
728
|
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
|
677
|
-
if(!this.instance.isOver) {
|
729
|
+
if (!this.instance.isOver) {
|
678
730
|
|
679
731
|
this.instance.isOver = 1;
|
680
732
|
//Now we fake the start of dragging for the sortable instance,
|
@@ -703,7 +755,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
703
755
|
}
|
704
756
|
|
705
757
|
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
|
706
|
-
if(this.instance.currentItem) {
|
758
|
+
if (this.instance.currentItem) {
|
707
759
|
this.instance._mouseDrag(event);
|
708
760
|
}
|
709
761
|
|
@@ -711,7 +763,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
711
763
|
|
712
764
|
//If it doesn't intersect with the sortable, and it intersected before,
|
713
765
|
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
|
714
|
-
if(this.instance.isOver) {
|
766
|
+
if (this.instance.isOver) {
|
715
767
|
|
716
768
|
this.instance.isOver = 0;
|
717
769
|
this.instance.cancelHelperRemoval = true;
|
@@ -727,7 +779,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
727
779
|
|
728
780
|
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
|
729
781
|
this.instance.currentItem.remove();
|
730
|
-
if(this.instance.placeholder) {
|
782
|
+
if (this.instance.placeholder) {
|
731
783
|
this.instance.placeholder.remove();
|
732
784
|
}
|
733
785
|
|
@@ -743,15 +795,17 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
743
795
|
});
|
744
796
|
|
745
797
|
$.ui.plugin.add("draggable", "cursor", {
|
746
|
-
start: function() {
|
747
|
-
var t = $("body"),
|
798
|
+
start: function( event, ui, instance ) {
|
799
|
+
var t = $( "body" ),
|
800
|
+
o = instance.options;
|
801
|
+
|
748
802
|
if (t.css("cursor")) {
|
749
803
|
o._cursor = t.css("cursor");
|
750
804
|
}
|
751
805
|
t.css("cursor", o.cursor);
|
752
806
|
},
|
753
|
-
stop: function() {
|
754
|
-
var o =
|
807
|
+
stop: function( event, ui, instance ) {
|
808
|
+
var o = instance.options;
|
755
809
|
if (o._cursor) {
|
756
810
|
$("body").css("cursor", o._cursor);
|
757
811
|
}
|
@@ -759,71 +813,72 @@ $.ui.plugin.add("draggable", "cursor", {
|
|
759
813
|
});
|
760
814
|
|
761
815
|
$.ui.plugin.add("draggable", "opacity", {
|
762
|
-
start: function(event, ui) {
|
763
|
-
var t = $(ui.helper),
|
764
|
-
|
816
|
+
start: function( event, ui, instance ) {
|
817
|
+
var t = $( ui.helper ),
|
818
|
+
o = instance.options;
|
819
|
+
if (t.css("opacity")) {
|
765
820
|
o._opacity = t.css("opacity");
|
766
821
|
}
|
767
822
|
t.css("opacity", o.opacity);
|
768
823
|
},
|
769
|
-
stop: function(event, ui) {
|
770
|
-
var o =
|
771
|
-
if(o._opacity) {
|
824
|
+
stop: function( event, ui, instance ) {
|
825
|
+
var o = instance.options;
|
826
|
+
if (o._opacity) {
|
772
827
|
$(ui.helper).css("opacity", o._opacity);
|
773
828
|
}
|
774
829
|
}
|
775
830
|
});
|
776
831
|
|
777
832
|
$.ui.plugin.add("draggable", "scroll", {
|
778
|
-
start: function() {
|
779
|
-
|
780
|
-
if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
|
833
|
+
start: function( event, ui, i ) {
|
834
|
+
if ( i.scrollParent[ 0 ] !== i.document[ 0 ] && i.scrollParent[ 0 ].tagName !== "HTML" ) {
|
781
835
|
i.overflowOffset = i.scrollParent.offset();
|
782
836
|
}
|
783
837
|
},
|
784
|
-
drag: function( event ) {
|
785
|
-
|
786
|
-
var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;
|
838
|
+
drag: function( event, ui, i ) {
|
787
839
|
|
788
|
-
|
840
|
+
var o = i.options,
|
841
|
+
scrolled = false,
|
842
|
+
document = i.document[ 0 ];
|
789
843
|
|
790
|
-
|
791
|
-
|
844
|
+
if ( i.scrollParent[ 0 ] !== document && i.scrollParent[ 0 ].tagName !== "HTML" ) {
|
845
|
+
if (!o.axis || o.axis !== "x") {
|
846
|
+
if ((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
|
792
847
|
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
|
793
|
-
} else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
|
848
|
+
} else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
|
794
849
|
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
|
795
850
|
}
|
796
851
|
}
|
797
852
|
|
798
|
-
if(!o.axis || o.axis !== "y") {
|
799
|
-
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
|
853
|
+
if (!o.axis || o.axis !== "y") {
|
854
|
+
if ((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
|
800
855
|
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
|
801
|
-
} else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
|
856
|
+
} else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
|
802
857
|
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
|
803
858
|
}
|
804
859
|
}
|
805
860
|
|
806
861
|
} else {
|
807
862
|
|
808
|
-
if(!o.axis || o.axis !== "x") {
|
809
|
-
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
|
863
|
+
if (!o.axis || o.axis !== "x") {
|
864
|
+
if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
|
810
865
|
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
811
|
-
} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
|
866
|
+
} else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
|
812
867
|
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
813
868
|
}
|
814
869
|
}
|
815
870
|
|
816
|
-
if(!o.axis || o.axis !== "y") {
|
817
|
-
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
|
871
|
+
if (!o.axis || o.axis !== "y") {
|
872
|
+
if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
|
818
873
|
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
819
|
-
} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
|
874
|
+
} else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
|
820
875
|
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
821
876
|
}
|
822
877
|
}
|
823
878
|
|
824
879
|
}
|
825
880
|
|
826
|
-
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
|
881
|
+
if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
|
827
882
|
$.ui.ddmanager.prepareOffsets(i, event);
|
828
883
|
}
|
829
884
|
|
@@ -831,17 +886,16 @@ $.ui.plugin.add("draggable", "scroll", {
|
|
831
886
|
});
|
832
887
|
|
833
888
|
$.ui.plugin.add("draggable", "snap", {
|
834
|
-
start: function() {
|
889
|
+
start: function( event, ui, i ) {
|
835
890
|
|
836
|
-
var
|
837
|
-
o = i.options;
|
891
|
+
var o = i.options;
|
838
892
|
|
839
893
|
i.snapElements = [];
|
840
894
|
|
841
895
|
$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
|
842
896
|
var $t = $(this),
|
843
897
|
$o = $t.offset();
|
844
|
-
if(this !== i.element[0]) {
|
898
|
+
if (this !== i.element[0]) {
|
845
899
|
i.snapElements.push({
|
846
900
|
item: this,
|
847
901
|
width: $t.outerWidth(), height: $t.outerHeight(),
|
@@ -851,10 +905,9 @@ $.ui.plugin.add("draggable", "snap", {
|
|
851
905
|
});
|
852
906
|
|
853
907
|
},
|
854
|
-
drag: function(event, ui) {
|
908
|
+
drag: function( event, ui, inst ) {
|
855
909
|
|
856
910
|
var ts, bs, ls, rs, l, r, t, b, i, first,
|
857
|
-
inst = $(this).data("ui-draggable"),
|
858
911
|
o = inst.options,
|
859
912
|
d = o.snapTolerance,
|
860
913
|
x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
|
@@ -868,54 +921,54 @@ $.ui.plugin.add("draggable", "snap", {
|
|
868
921
|
b = t + inst.snapElements[i].height;
|
869
922
|
|
870
923
|
if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
|
871
|
-
if(inst.snapElements[i].snapping) {
|
924
|
+
if (inst.snapElements[i].snapping) {
|
872
925
|
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
873
926
|
}
|
874
927
|
inst.snapElements[i].snapping = false;
|
875
928
|
continue;
|
876
929
|
}
|
877
930
|
|
878
|
-
if(o.snapMode !== "inner") {
|
931
|
+
if (o.snapMode !== "inner") {
|
879
932
|
ts = Math.abs(t - y2) <= d;
|
880
933
|
bs = Math.abs(b - y1) <= d;
|
881
934
|
ls = Math.abs(l - x2) <= d;
|
882
935
|
rs = Math.abs(r - x1) <= d;
|
883
|
-
if(ts) {
|
936
|
+
if (ts) {
|
884
937
|
ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
885
938
|
}
|
886
|
-
if(bs) {
|
939
|
+
if (bs) {
|
887
940
|
ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
|
888
941
|
}
|
889
|
-
if(ls) {
|
942
|
+
if (ls) {
|
890
943
|
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
|
891
944
|
}
|
892
|
-
if(rs) {
|
945
|
+
if (rs) {
|
893
946
|
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
|
894
947
|
}
|
895
948
|
}
|
896
949
|
|
897
950
|
first = (ts || bs || ls || rs);
|
898
951
|
|
899
|
-
if(o.snapMode !== "outer") {
|
952
|
+
if (o.snapMode !== "outer") {
|
900
953
|
ts = Math.abs(t - y1) <= d;
|
901
954
|
bs = Math.abs(b - y2) <= d;
|
902
955
|
ls = Math.abs(l - x1) <= d;
|
903
956
|
rs = Math.abs(r - x2) <= d;
|
904
|
-
if(ts) {
|
957
|
+
if (ts) {
|
905
958
|
ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
|
906
959
|
}
|
907
|
-
if(bs) {
|
960
|
+
if (bs) {
|
908
961
|
ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
909
962
|
}
|
910
|
-
if(ls) {
|
963
|
+
if (ls) {
|
911
964
|
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
|
912
965
|
}
|
913
|
-
if(rs) {
|
966
|
+
if (rs) {
|
914
967
|
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
|
915
968
|
}
|
916
969
|
}
|
917
970
|
|
918
|
-
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
|
971
|
+
if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
|
919
972
|
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
920
973
|
}
|
921
974
|
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
|
@@ -926,9 +979,9 @@ $.ui.plugin.add("draggable", "snap", {
|
|
926
979
|
});
|
927
980
|
|
928
981
|
$.ui.plugin.add("draggable", "stack", {
|
929
|
-
start: function() {
|
982
|
+
start: function( event, ui, instance ) {
|
930
983
|
var min,
|
931
|
-
o =
|
984
|
+
o = instance.options,
|
932
985
|
group = $.makeArray($(o.stack)).sort(function(a,b) {
|
933
986
|
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
|
934
987
|
});
|
@@ -944,19 +997,24 @@ $.ui.plugin.add("draggable", "stack", {
|
|
944
997
|
});
|
945
998
|
|
946
999
|
$.ui.plugin.add("draggable", "zIndex", {
|
947
|
-
start: function(event, ui) {
|
948
|
-
var t = $(ui.helper),
|
949
|
-
|
1000
|
+
start: function( event, ui, instance ) {
|
1001
|
+
var t = $( ui.helper ),
|
1002
|
+
o = instance.options;
|
1003
|
+
|
1004
|
+
if (t.css("zIndex")) {
|
950
1005
|
o._zIndex = t.css("zIndex");
|
951
1006
|
}
|
952
1007
|
t.css("zIndex", o.zIndex);
|
953
1008
|
},
|
954
|
-
stop: function(event, ui) {
|
955
|
-
var o =
|
956
|
-
|
1009
|
+
stop: function( event, ui, instance ) {
|
1010
|
+
var o = instance.options;
|
1011
|
+
|
1012
|
+
if (o._zIndex) {
|
957
1013
|
$(ui.helper).css("zIndex", o._zIndex);
|
958
1014
|
}
|
959
1015
|
}
|
960
1016
|
});
|
961
1017
|
|
962
|
-
|
1018
|
+
return $.ui.draggable;
|
1019
|
+
|
1020
|
+
}));
|