jquery-ui-rails 2.0.2 → 3.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 +15 -0
- data/License.txt +2 -3
- data/README.md +17 -19
- data/Rakefile +79 -28
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.ui.accordion.js +537 -417
- data/vendor/assets/javascripts/jquery.ui.all.js +17 -14
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +311 -339
- data/vendor/assets/javascripts/jquery.ui.button.js +63 -59
- data/vendor/assets/javascripts/jquery.ui.core.js +134 -112
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +16 -16
- data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +5 -5
- data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +13 -13
- data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +9 -9
- data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +5 -5
- data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +11 -11
- data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +18 -18
- data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +7 -7
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +9 -9
- data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +51 -59
- data/vendor/assets/javascripts/jquery.ui.dialog.js +402 -409
- data/vendor/assets/javascripts/jquery.ui.draggable.js +79 -75
- data/vendor/assets/javascripts/jquery.ui.droppable.js +10 -17
- data/vendor/assets/javascripts/jquery.ui.effect-blind.js +84 -0
- data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +115 -0
- data/vendor/assets/javascripts/jquery.ui.effect-clip.js +69 -0
- data/vendor/assets/javascripts/jquery.ui.effect-drop.js +67 -0
- data/vendor/assets/javascripts/jquery.ui.effect-explode.js +99 -0
- data/vendor/assets/javascripts/jquery.ui.effect-fade.js +32 -0
- data/vendor/assets/javascripts/jquery.ui.effect-fold.js +78 -0
- data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +52 -0
- data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +65 -0
- data/vendor/assets/javascripts/jquery.ui.effect-scale.js +320 -0
- data/vendor/assets/javascripts/jquery.ui.effect-shake.js +76 -0
- data/vendor/assets/javascripts/jquery.ui.effect-slide.js +66 -0
- data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +49 -0
- data/vendor/assets/javascripts/jquery.ui.effect.all.js +14 -0
- data/vendor/assets/javascripts/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery.ui.menu.js +614 -0
- data/vendor/assets/javascripts/jquery.ui.mouse.js +22 -20
- data/vendor/assets/javascripts/jquery.ui.position.js +367 -158
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +10 -14
- data/vendor/assets/javascripts/jquery.ui.resizable.js +143 -149
- data/vendor/assets/javascripts/jquery.ui.selectable.js +22 -28
- data/vendor/assets/javascripts/jquery.ui.slider.js +88 -106
- data/vendor/assets/javascripts/jquery.ui.sortable.js +97 -95
- data/vendor/assets/javascripts/jquery.ui.spinner.js +482 -0
- data/vendor/assets/javascripts/jquery.ui.tabs.js +1189 -580
- data/vendor/assets/javascripts/jquery.ui.tooltip.js +402 -0
- data/vendor/assets/javascripts/jquery.ui.widget.js +373 -117
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +10 -13
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +10 -44
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +7 -3
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +6 -4
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +5 -4
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +6 -5
- data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +34 -0
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +27 -0
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +8 -8
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +8 -7
- data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +25 -0
- metadata +24 -19
- data/dependencies.js +0 -31
- data/vendor/assets/javascripts/jquery.effects.all.js +0 -14
- data/vendor/assets/javascripts/jquery.effects.blind.js +0 -51
- data/vendor/assets/javascripts/jquery.effects.bounce.js +0 -80
- data/vendor/assets/javascripts/jquery.effects.clip.js +0 -56
- data/vendor/assets/javascripts/jquery.effects.core.js +0 -612
- data/vendor/assets/javascripts/jquery.effects.drop.js +0 -52
- data/vendor/assets/javascripts/jquery.effects.explode.js +0 -81
- data/vendor/assets/javascripts/jquery.effects.fade.js +0 -34
- data/vendor/assets/javascripts/jquery.effects.fold.js +0 -58
- data/vendor/assets/javascripts/jquery.effects.highlight.js +0 -52
- data/vendor/assets/javascripts/jquery.effects.pulsate.js +0 -53
- data/vendor/assets/javascripts/jquery.effects.scale.js +0 -180
- data/vendor/assets/javascripts/jquery.effects.shake.js +0 -59
- data/vendor/assets/javascripts/jquery.effects.slide.js +0 -52
- data/vendor/assets/javascripts/jquery.effects.transfer.js +0 -47
@@ -3,13 +3,14 @@
|
|
3
3
|
//= require jquery.ui.mouse
|
4
4
|
|
5
5
|
/*!
|
6
|
-
* jQuery UI Sortable 1.
|
6
|
+
* jQuery UI Sortable 1.9.2
|
7
|
+
* http://jqueryui.com
|
7
8
|
*
|
8
|
-
* Copyright 2012
|
9
|
-
*
|
9
|
+
* Copyright 2012 jQuery Foundation and other contributors
|
10
|
+
* Released under the MIT license.
|
10
11
|
* http://jquery.org/license
|
11
12
|
*
|
12
|
-
* http://
|
13
|
+
* http://api.jqueryui.com/sortable/
|
13
14
|
*
|
14
15
|
* Depends:
|
15
16
|
* jquery.ui.core.js
|
@@ -19,6 +20,7 @@
|
|
19
20
|
(function( $, undefined ) {
|
20
21
|
|
21
22
|
$.widget("ui.sortable", $.ui.mouse, {
|
23
|
+
version: "1.9.2",
|
22
24
|
widgetEventPrefix: "sort",
|
23
25
|
ready: false,
|
24
26
|
options: {
|
@@ -62,14 +64,13 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
62
64
|
|
63
65
|
//Initialize mouse events for interaction
|
64
66
|
this._mouseInit();
|
65
|
-
|
67
|
+
|
66
68
|
//We're ready to go
|
67
69
|
this.ready = true
|
68
70
|
|
69
71
|
},
|
70
72
|
|
71
|
-
|
72
|
-
$.Widget.prototype.destroy.call( this );
|
73
|
+
_destroy: function() {
|
73
74
|
this.element
|
74
75
|
.removeClass("ui-sortable ui-sortable-disabled");
|
75
76
|
this._mouseDestroy();
|
@@ -83,9 +84,8 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
83
84
|
_setOption: function(key, value){
|
84
85
|
if ( key === "disabled" ) {
|
85
86
|
this.options[ key ] = value;
|
86
|
-
|
87
|
-
this.widget()
|
88
|
-
[ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
|
87
|
+
|
88
|
+
this.widget().toggleClass( "ui-sortable-disabled", !!value );
|
89
89
|
} else {
|
90
90
|
// Don't call widget base _setOption for disable as it adds ui-state-disabled class
|
91
91
|
$.Widget.prototype._setOption.apply(this, arguments);
|
@@ -105,13 +105,13 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
105
105
|
this._refreshItems(event);
|
106
106
|
|
107
107
|
//Find out if the clicked node (or one of its parents) is a actual item in this.items
|
108
|
-
var currentItem = null,
|
109
|
-
if($.data(this, that.widgetName + '-item') ==
|
108
|
+
var currentItem = null, nodes = $(event.target).parents().each(function() {
|
109
|
+
if($.data(this, that.widgetName + '-item') == that) {
|
110
110
|
currentItem = $(this);
|
111
111
|
return false;
|
112
112
|
}
|
113
113
|
});
|
114
|
-
if($.data(event.target, that.widgetName + '-item') ==
|
114
|
+
if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target);
|
115
115
|
|
116
116
|
if(!currentItem) return false;
|
117
117
|
if(this.options.handle && !overrideHandle) {
|
@@ -129,7 +129,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
129
129
|
|
130
130
|
_mouseStart: function(event, overrideHandle, noActivation) {
|
131
131
|
|
132
|
-
var o = this.options
|
132
|
+
var o = this.options;
|
133
133
|
this.currentContainer = this;
|
134
134
|
|
135
135
|
//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
|
@@ -172,7 +172,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
172
172
|
// TODO: Still need to figure out a way to make relative sorting possible
|
173
173
|
this.helper.css("position", "absolute");
|
174
174
|
this.cssPosition = this.helper.css("position");
|
175
|
-
|
175
|
+
|
176
176
|
//Generate the original position
|
177
177
|
this.originalPosition = this._generatePosition(event);
|
178
178
|
this.originalPageX = event.pageX;
|
@@ -225,7 +225,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
225
225
|
|
226
226
|
//Post 'activate' events to possible containers
|
227
227
|
if(!noActivation) {
|
228
|
-
for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event,
|
228
|
+
for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
|
229
229
|
}
|
230
230
|
|
231
231
|
//Prepare possible droppables
|
@@ -311,8 +311,8 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
311
311
|
|
312
312
|
if (itemElement != this.currentItem[0] //cannot intersect with itself
|
313
313
|
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
|
314
|
-
&& !$.
|
315
|
-
&& (this.options.type == 'semi-dynamic' ? !$.
|
314
|
+
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
|
315
|
+
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
|
316
316
|
//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
|
317
317
|
) {
|
318
318
|
|
@@ -352,16 +352,16 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
352
352
|
$.ui.ddmanager.drop(this, event);
|
353
353
|
|
354
354
|
if(this.options.revert) {
|
355
|
-
var
|
356
|
-
var cur =
|
355
|
+
var that = this;
|
356
|
+
var cur = this.placeholder.offset();
|
357
357
|
|
358
|
-
|
358
|
+
this.reverting = true;
|
359
359
|
|
360
360
|
$(this.helper).animate({
|
361
|
-
left: cur.left - this.offset.parent.left -
|
362
|
-
top: cur.top - this.offset.parent.top -
|
361
|
+
left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
|
362
|
+
top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
|
363
363
|
}, parseInt(this.options.revert, 10) || 500, function() {
|
364
|
-
|
364
|
+
that._clear(event);
|
365
365
|
});
|
366
366
|
} else {
|
367
367
|
this._clear(event, noPropagation);
|
@@ -373,8 +373,6 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
373
373
|
|
374
374
|
cancel: function() {
|
375
375
|
|
376
|
-
var self = this;
|
377
|
-
|
378
376
|
if(this.dragging) {
|
379
377
|
|
380
378
|
this._mouseUp({ target: null });
|
@@ -386,9 +384,9 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
386
384
|
|
387
385
|
//Post deactivating events to containers
|
388
386
|
for (var i = this.containers.length - 1; i >= 0; i--){
|
389
|
-
this.containers[i]._trigger("deactivate", null,
|
387
|
+
this.containers[i]._trigger("deactivate", null, this._uiHash(this));
|
390
388
|
if(this.containers[i].containerCache.over) {
|
391
|
-
this.containers[i]._trigger("out", null,
|
389
|
+
this.containers[i]._trigger("out", null, this._uiHash(this));
|
392
390
|
this.containers[i].containerCache.over = 0;
|
393
391
|
}
|
394
392
|
}
|
@@ -533,10 +531,9 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
533
531
|
? [options.connectWith]
|
534
532
|
: options.connectWith;
|
535
533
|
},
|
536
|
-
|
534
|
+
|
537
535
|
_getItemsAsjQuery: function(connected) {
|
538
536
|
|
539
|
-
var self = this;
|
540
537
|
var items = [];
|
541
538
|
var queries = [];
|
542
539
|
var connectWith = this._connectWith();
|
@@ -569,14 +566,13 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
569
566
|
|
570
567
|
var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
|
571
568
|
|
572
|
-
|
573
|
-
|
569
|
+
this.items = $.grep(this.items, function (item) {
|
574
570
|
for (var j=0; j < list.length; j++) {
|
575
|
-
if(list[j] ==
|
576
|
-
|
571
|
+
if(list[j] == item.item[0])
|
572
|
+
return false;
|
577
573
|
};
|
578
|
-
|
579
|
-
};
|
574
|
+
return true;
|
575
|
+
});
|
580
576
|
|
581
577
|
},
|
582
578
|
|
@@ -585,7 +581,6 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
585
581
|
this.items = [];
|
586
582
|
this.containers = [this];
|
587
583
|
var items = this.items;
|
588
|
-
var self = this;
|
589
584
|
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
|
590
585
|
var connectWith = this._connectWith();
|
591
586
|
|
@@ -664,16 +659,16 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
664
659
|
},
|
665
660
|
|
666
661
|
_createPlaceholder: function(that) {
|
667
|
-
|
668
|
-
var
|
662
|
+
that = that || this;
|
663
|
+
var o = that.options;
|
669
664
|
|
670
665
|
if(!o.placeholder || o.placeholder.constructor == String) {
|
671
666
|
var className = o.placeholder;
|
672
667
|
o.placeholder = {
|
673
668
|
element: function() {
|
674
669
|
|
675
|
-
var el = $(document.createElement(
|
676
|
-
.addClass(className ||
|
670
|
+
var el = $(document.createElement(that.currentItem[0].nodeName))
|
671
|
+
.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
|
677
672
|
.removeClass("ui-sortable-helper")[0];
|
678
673
|
|
679
674
|
if(!className)
|
@@ -688,46 +683,46 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
688
683
|
if(className && !o.forcePlaceholderSize) return;
|
689
684
|
|
690
685
|
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
|
691
|
-
if(!p.height()) { p.height(
|
692
|
-
if(!p.width()) { p.width(
|
686
|
+
if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
|
687
|
+
if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
|
693
688
|
}
|
694
689
|
};
|
695
690
|
}
|
696
691
|
|
697
692
|
//Create the placeholder
|
698
|
-
|
693
|
+
that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
|
699
694
|
|
700
695
|
//Append it after the actual current item
|
701
|
-
|
696
|
+
that.currentItem.after(that.placeholder);
|
702
697
|
|
703
698
|
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
|
704
|
-
o.placeholder.update(
|
699
|
+
o.placeholder.update(that, that.placeholder);
|
705
700
|
|
706
701
|
},
|
707
702
|
|
708
703
|
_contactContainers: function(event) {
|
709
|
-
|
710
|
-
// get innermost container that intersects with item
|
711
|
-
var innermostContainer = null, innermostIndex = null;
|
712
|
-
|
713
|
-
|
704
|
+
|
705
|
+
// get innermost container that intersects with item
|
706
|
+
var innermostContainer = null, innermostIndex = null;
|
707
|
+
|
708
|
+
|
714
709
|
for (var i = this.containers.length - 1; i >= 0; i--){
|
715
710
|
|
716
|
-
// never consider a container that's located within the item itself
|
717
|
-
if($.
|
711
|
+
// never consider a container that's located within the item itself
|
712
|
+
if($.contains(this.currentItem[0], this.containers[i].element[0]))
|
718
713
|
continue;
|
719
714
|
|
720
715
|
if(this._intersectsWith(this.containers[i].containerCache)) {
|
721
716
|
|
722
|
-
// if we've already found a container and it's more "inner" than this, then continue
|
723
|
-
if(innermostContainer && $.
|
717
|
+
// if we've already found a container and it's more "inner" than this, then continue
|
718
|
+
if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0]))
|
724
719
|
continue;
|
725
720
|
|
726
|
-
innermostContainer = this.containers[i];
|
721
|
+
innermostContainer = this.containers[i];
|
727
722
|
innermostIndex = i;
|
728
|
-
|
723
|
+
|
729
724
|
} else {
|
730
|
-
// container doesn't intersect. trigger "out" event if necessary
|
725
|
+
// container doesn't intersect. trigger "out" event if necessary
|
731
726
|
if(this.containers[i].containerCache.over) {
|
732
727
|
this.containers[i]._trigger("out", event, this._uiHash(this));
|
733
728
|
this.containers[i].containerCache.over = 0;
|
@@ -735,24 +730,34 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
735
730
|
}
|
736
731
|
|
737
732
|
}
|
738
|
-
|
739
|
-
// if no intersecting containers found, return
|
740
|
-
if(!innermostContainer) return;
|
733
|
+
|
734
|
+
// if no intersecting containers found, return
|
735
|
+
if(!innermostContainer) return;
|
741
736
|
|
742
737
|
// move the item into the container if it's not there already
|
743
738
|
if(this.containers.length === 1) {
|
744
739
|
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
|
745
740
|
this.containers[innermostIndex].containerCache.over = 1;
|
746
|
-
} else
|
741
|
+
} else {
|
747
742
|
|
748
743
|
//When entering a new container, we will find the item with the least distance and append our item near it
|
749
|
-
var dist = 10000; var itemWithLeastDistance = null;
|
744
|
+
var dist = 10000; var itemWithLeastDistance = null;
|
745
|
+
var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top';
|
746
|
+
var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height';
|
747
|
+
var base = this.positionAbs[posProperty] + this.offset.click[posProperty];
|
750
748
|
for (var j = this.items.length - 1; j >= 0; j--) {
|
751
|
-
if(!$.
|
752
|
-
|
749
|
+
if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
|
750
|
+
if(this.items[j].item[0] == this.currentItem[0]) continue;
|
751
|
+
var cur = this.items[j].item.offset()[posProperty];
|
752
|
+
var nearBottom = false;
|
753
|
+
if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
|
754
|
+
nearBottom = true;
|
755
|
+
cur += this.items[j][sizeProperty];
|
756
|
+
}
|
757
|
+
|
753
758
|
if(Math.abs(cur - base) < dist) {
|
754
759
|
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
|
755
|
-
this.direction =
|
760
|
+
this.direction = nearBottom ? "up": "down";
|
756
761
|
}
|
757
762
|
}
|
758
763
|
|
@@ -769,9 +774,9 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
769
774
|
|
770
775
|
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
|
771
776
|
this.containers[innermostIndex].containerCache.over = 1;
|
772
|
-
}
|
773
|
-
|
774
|
-
|
777
|
+
}
|
778
|
+
|
779
|
+
|
775
780
|
},
|
776
781
|
|
777
782
|
_createHelper: function(event) {
|
@@ -824,13 +829,13 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
824
829
|
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
825
830
|
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
826
831
|
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
827
|
-
if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.
|
832
|
+
if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
828
833
|
po.left += this.scrollParent.scrollLeft();
|
829
834
|
po.top += this.scrollParent.scrollTop();
|
830
835
|
}
|
831
836
|
|
832
837
|
if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
|
833
|
-
|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.
|
838
|
+
|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
|
834
839
|
po = { top: 0, left: 0 };
|
835
840
|
|
836
841
|
return {
|
@@ -898,20 +903,20 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
898
903
|
|
899
904
|
if(!pos) pos = this.position;
|
900
905
|
var mod = d == "absolute" ? 1 : -1;
|
901
|
-
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.
|
906
|
+
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
902
907
|
|
903
908
|
return {
|
904
909
|
top: (
|
905
910
|
pos.top // The absolute mouse position
|
906
911
|
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
907
912
|
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
|
908
|
-
- (
|
913
|
+
- ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
909
914
|
),
|
910
915
|
left: (
|
911
916
|
pos.left // The absolute mouse position
|
912
917
|
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
913
918
|
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
|
914
|
-
- (
|
919
|
+
- ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
915
920
|
)
|
916
921
|
};
|
917
922
|
|
@@ -919,7 +924,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
919
924
|
|
920
925
|
_generatePosition: function(event) {
|
921
926
|
|
922
|
-
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.
|
927
|
+
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
923
928
|
|
924
929
|
// This is another very weird special case that only happens for relative elements:
|
925
930
|
// 1. If the css position is relative
|
@@ -962,14 +967,14 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
962
967
|
- this.offset.click.top // Click offset (relative to the element)
|
963
968
|
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
|
964
969
|
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
|
965
|
-
+ (
|
970
|
+
+ ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
|
966
971
|
),
|
967
972
|
left: (
|
968
973
|
pageX // The absolute mouse position
|
969
974
|
- this.offset.click.left // Click offset (relative to the element)
|
970
975
|
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
|
971
976
|
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
|
972
|
-
+ (
|
977
|
+
+ ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
|
973
978
|
)
|
974
979
|
};
|
975
980
|
|
@@ -985,11 +990,11 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
985
990
|
// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
|
986
991
|
// 4. this lets only the last addition to the timeout stack through
|
987
992
|
this.counter = this.counter ? ++this.counter : 1;
|
988
|
-
var
|
993
|
+
var counter = this.counter;
|
989
994
|
|
990
|
-
|
991
|
-
if(counter ==
|
992
|
-
}
|
995
|
+
this._delay(function() {
|
996
|
+
if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
|
997
|
+
});
|
993
998
|
|
994
999
|
},
|
995
1000
|
|
@@ -998,7 +1003,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
998
1003
|
this.reverting = false;
|
999
1004
|
// We delay all events that have to be triggered to after the point where the placeholder has been removed and
|
1000
1005
|
// everything else normalized again
|
1001
|
-
var delayedTriggers = []
|
1006
|
+
var delayedTriggers = [];
|
1002
1007
|
|
1003
1008
|
// We first have to update the dom position of the actual currentItem
|
1004
1009
|
// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
|
@@ -1027,6 +1032,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
1027
1032
|
}
|
1028
1033
|
}
|
1029
1034
|
|
1035
|
+
|
1030
1036
|
//Post events to containers
|
1031
1037
|
for (var i = this.containers.length - 1; i >= 0; i--){
|
1032
1038
|
if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
|
@@ -1076,23 +1082,19 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|
1076
1082
|
}
|
1077
1083
|
},
|
1078
1084
|
|
1079
|
-
_uiHash: function(
|
1080
|
-
var
|
1085
|
+
_uiHash: function(_inst) {
|
1086
|
+
var inst = _inst || this;
|
1081
1087
|
return {
|
1082
|
-
helper:
|
1083
|
-
placeholder:
|
1084
|
-
position:
|
1085
|
-
originalPosition:
|
1086
|
-
offset:
|
1087
|
-
item:
|
1088
|
-
sender:
|
1088
|
+
helper: inst.helper,
|
1089
|
+
placeholder: inst.placeholder || $([]),
|
1090
|
+
position: inst.position,
|
1091
|
+
originalPosition: inst.originalPosition,
|
1092
|
+
offset: inst.positionAbs,
|
1093
|
+
item: inst.currentItem,
|
1094
|
+
sender: _inst ? _inst.element : null
|
1089
1095
|
};
|
1090
1096
|
}
|
1091
1097
|
|
1092
1098
|
});
|
1093
1099
|
|
1094
|
-
$.extend($.ui.sortable, {
|
1095
|
-
version: "1.8.24"
|
1096
|
-
});
|
1097
|
-
|
1098
1100
|
})(jQuery);
|