jquery-ui-rails 6.0.1 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +5 -5
  2. data/.gitmodules +1 -1
  3. data/History.md +7 -2
  4. data/README.md +12 -12
  5. data/Rakefile +8 -3
  6. data/VERSIONS.md +1 -0
  7. data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
  8. data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
  9. data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
  10. data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
  11. data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
  12. data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  13. data/app/assets/javascripts/jquery-ui/core.js +1 -1
  14. data/app/assets/javascripts/jquery-ui/data.js +8 -4
  15. data/app/assets/javascripts/jquery-ui/disable-selection.js +6 -3
  16. data/app/assets/javascripts/jquery-ui/effect.js +55 -717
  17. data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +6 -3
  18. data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +6 -3
  19. data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +6 -3
  20. data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +6 -3
  21. data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +8 -5
  22. data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +6 -3
  23. data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +6 -3
  24. data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +6 -3
  25. data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +6 -3
  26. data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +6 -3
  27. data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +6 -3
  28. data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +6 -3
  29. data/app/assets/javascripts/jquery-ui/effects/effect-size.js +8 -3
  30. data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +6 -3
  31. data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +6 -3
  32. data/app/assets/javascripts/jquery-ui/focusable.js +8 -5
  33. data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +7 -4
  34. data/app/assets/javascripts/jquery-ui/form.js +6 -3
  35. data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +8 -5
  36. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +6 -3
  37. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +5 -2
  38. data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +12 -9
  39. data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +12 -9
  40. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +12 -9
  41. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +12 -9
  42. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +12 -9
  43. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +10 -7
  44. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +8 -5
  45. data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +13 -10
  46. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
  47. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +12 -9
  48. data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +12 -9
  49. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +8 -5
  50. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +8 -5
  51. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +8 -5
  52. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +12 -9
  53. data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +12 -9
  54. data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +8 -5
  55. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +12 -9
  56. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +6 -3
  57. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +12 -9
  58. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +11 -8
  59. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +5 -2
  60. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +5 -2
  61. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +6 -3
  62. data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +12 -9
  63. data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +12 -9
  64. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +7 -4
  65. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +12 -9
  66. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +9 -6
  67. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +12 -9
  68. data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +12 -9
  69. data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +11 -8
  70. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +12 -9
  71. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +12 -9
  72. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +12 -9
  73. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +9 -6
  74. data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +12 -9
  75. data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +9 -6
  76. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +12 -9
  77. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +10 -7
  78. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +8 -5
  79. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +11 -8
  80. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +11 -8
  81. data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +12 -9
  82. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +8 -5
  83. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +12 -9
  84. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +9 -6
  85. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +5 -2
  86. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +5 -2
  87. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +9 -6
  88. data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +9 -6
  89. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +12 -9
  90. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +11 -8
  91. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +12 -9
  92. data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +8 -5
  93. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +8 -5
  94. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +12 -9
  95. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +12 -9
  96. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +12 -9
  97. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +12 -9
  98. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +12 -9
  99. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +12 -9
  100. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +12 -9
  101. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +10 -7
  102. data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +12 -9
  103. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +12 -9
  104. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +12 -9
  105. data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +12 -9
  106. data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +5 -2
  107. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +12 -9
  108. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +12 -9
  109. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +15 -12
  110. data/app/assets/javascripts/jquery-ui/ie.js +5 -2
  111. data/app/assets/javascripts/jquery-ui/jquery-patch.js +91 -0
  112. data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
  113. data/app/assets/javascripts/jquery-ui/keycode.js +7 -3
  114. data/app/assets/javascripts/jquery-ui/labels.js +12 -6
  115. data/app/assets/javascripts/jquery-ui/plugin.js +5 -2
  116. data/app/assets/javascripts/jquery-ui/position.js +24 -11
  117. data/app/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
  118. data/app/assets/javascripts/jquery-ui/safe-blur.js +6 -2
  119. data/app/assets/javascripts/jquery-ui/scroll-parent.js +6 -3
  120. data/app/assets/javascripts/jquery-ui/tabbable.js +7 -4
  121. data/app/assets/javascripts/jquery-ui/unique-id.js +6 -3
  122. data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +722 -0
  123. data/app/assets/javascripts/jquery-ui/version.js +6 -3
  124. data/app/assets/javascripts/jquery-ui/widget.js +43 -24
  125. data/app/assets/javascripts/jquery-ui/widgets/accordion.js +17 -8
  126. data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +23 -32
  127. data/app/assets/javascripts/jquery-ui/widgets/button.js +82 -19
  128. data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +9 -11
  129. data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +10 -6
  130. data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +176 -56
  131. data/app/assets/javascripts/jquery-ui/widgets/dialog.js +45 -31
  132. data/app/assets/javascripts/jquery-ui/widgets/draggable.js +22 -13
  133. data/app/assets/javascripts/jquery-ui/widgets/droppable.js +19 -13
  134. data/app/assets/javascripts/jquery-ui/widgets/menu.js +83 -43
  135. data/app/assets/javascripts/jquery-ui/widgets/mouse.js +18 -7
  136. data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +9 -6
  137. data/app/assets/javascripts/jquery-ui/widgets/resizable.js +36 -18
  138. data/app/assets/javascripts/jquery-ui/widgets/selectable.js +13 -6
  139. data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +15 -10
  140. data/app/assets/javascripts/jquery-ui/widgets/slider.js +10 -7
  141. data/app/assets/javascripts/jquery-ui/widgets/sortable.js +221 -159
  142. data/app/assets/javascripts/jquery-ui/widgets/spinner.js +20 -13
  143. data/app/assets/javascripts/jquery-ui/widgets/tabs.js +13 -13
  144. data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +15 -11
  145. data/app/assets/javascripts/jquery-ui.js +3 -2
  146. data/app/assets/stylesheets/jquery-ui/accordion.css +1 -1
  147. data/app/assets/stylesheets/jquery-ui/all.css +1 -1
  148. data/app/assets/stylesheets/jquery-ui/autocomplete.css +1 -1
  149. data/app/assets/stylesheets/jquery-ui/base.css +1 -1
  150. data/app/assets/stylesheets/jquery-ui/button.css +1 -1
  151. data/app/assets/stylesheets/jquery-ui/checkboxradio.css +1 -1
  152. data/app/assets/stylesheets/jquery-ui/controlgroup.css +1 -1
  153. data/app/assets/stylesheets/jquery-ui/core.css +2 -2
  154. data/app/assets/stylesheets/jquery-ui/datepicker.css +1 -1
  155. data/app/assets/stylesheets/jquery-ui/dialog.css +1 -1
  156. data/app/assets/stylesheets/jquery-ui/draggable.css +1 -1
  157. data/app/assets/stylesheets/jquery-ui/menu.css +1 -1
  158. data/app/assets/stylesheets/jquery-ui/progressbar.css +2 -2
  159. data/app/assets/stylesheets/jquery-ui/resizable.css +1 -1
  160. data/app/assets/stylesheets/jquery-ui/selectable.css +1 -1
  161. data/app/assets/stylesheets/jquery-ui/selectmenu.css +1 -1
  162. data/app/assets/stylesheets/jquery-ui/slider.css +2 -2
  163. data/app/assets/stylesheets/jquery-ui/sortable.css +1 -1
  164. data/app/assets/stylesheets/jquery-ui/spinner.css +1 -1
  165. data/app/assets/stylesheets/jquery-ui/tabs.css +1 -1
  166. data/app/assets/stylesheets/jquery-ui/theme.css.erb +9 -6
  167. data/app/assets/stylesheets/jquery-ui/tooltip.css +1 -1
  168. data/lib/jquery/ui/rails/version.rb +2 -2
  169. metadata +8 -7
  170. data/app/assets/javascripts/jquery-ui/escape-selector.js +0 -23
  171. data/app/assets/javascripts/jquery-ui/jquery-1-7.js +0 -91
@@ -6,7 +6,7 @@
6
6
  //= require jquery-ui/widget
7
7
 
8
8
  /*!
9
- * jQuery UI Sortable 1.12.1
9
+ * jQuery UI Sortable 1.13.0
10
10
  * http://jqueryui.com
11
11
  *
12
12
  * Copyright jQuery Foundation and other contributors
@@ -22,6 +22,8 @@
22
22
  //>>css.structure: ../../themes/base/sortable.css
23
23
 
24
24
  ( function( factory ) {
25
+ "use strict";
26
+
25
27
  if ( typeof define === "function" && define.amd ) {
26
28
 
27
29
  // AMD. Register as an anonymous module.
@@ -39,10 +41,11 @@
39
41
  // Browser globals
40
42
  factory( jQuery );
41
43
  }
42
- }( function( $ ) {
44
+ } )( function( $ ) {
45
+ "use strict";
43
46
 
44
47
  return $.widget( "ui.sortable", $.ui.mouse, {
45
- version: "1.12.1",
48
+ version: "1.13.0",
46
49
  widgetEventPrefix: "sort",
47
50
  ready: false,
48
51
  options: {
@@ -202,6 +205,11 @@ return $.widget( "ui.sortable", $.ui.mouse, {
202
205
  // mouseCapture
203
206
  this.refreshPositions();
204
207
 
208
+ //Prepare the dragged items parent
209
+ this.appendTo = $( o.appendTo !== "parent" ?
210
+ o.appendTo :
211
+ this.currentItem.parent() );
212
+
205
213
  //Create and append the visible helper
206
214
  this.helper = this._createHelper( event );
207
215
 
@@ -216,9 +224,6 @@ return $.widget( "ui.sortable", $.ui.mouse, {
216
224
  //Cache the margins of the original element
217
225
  this._cacheMargins();
218
226
 
219
- //Get the next scrolling parent
220
- this.scrollParent = this.helper.scrollParent();
221
-
222
227
  //The element's absolute position on the page minus margins
223
228
  this.offset = this.currentItem.offset();
224
229
  this.offset = {
@@ -231,25 +236,22 @@ return $.widget( "ui.sortable", $.ui.mouse, {
231
236
  left: event.pageX - this.offset.left,
232
237
  top: event.pageY - this.offset.top
233
238
  },
234
- parent: this._getParentOffset(),
235
239
 
236
240
  // This is a relative to absolute position minus the actual position calculation -
237
241
  // only used for relative positioned helper
238
242
  relative: this._getRelativeOffset()
239
243
  } );
240
244
 
241
- // Only after we got the offset, we can change the helper's position to absolute
245
+ // After we get the helper offset, but before we get the parent offset we can
246
+ // change the helper's position to absolute
242
247
  // TODO: Still need to figure out a way to make relative sorting possible
243
248
  this.helper.css( "position", "absolute" );
244
249
  this.cssPosition = this.helper.css( "position" );
245
250
 
246
- //Generate the original position
247
- this.originalPosition = this._generatePosition( event );
248
- this.originalPageX = event.pageX;
249
- this.originalPageY = event.pageY;
250
-
251
251
  //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
252
- ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
252
+ if ( o.cursorAt ) {
253
+ this._adjustOffsetFromHelper( o.cursorAt );
254
+ }
253
255
 
254
256
  //Cache the former DOM position
255
257
  this.domPosition = {
@@ -266,6 +268,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
266
268
  //Create the placeholder
267
269
  this._createPlaceholder();
268
270
 
271
+ //Get the next scrolling parent
272
+ this.scrollParent = this.placeholder.scrollParent();
273
+
274
+ $.extend( this.offset, {
275
+ parent: this._getParentOffset()
276
+ } );
277
+
269
278
  //Set a containment if given in the options
270
279
  if ( o.containment ) {
271
280
  this._setContainment();
@@ -282,13 +291,9 @@ return $.widget( "ui.sortable", $.ui.mouse, {
282
291
  $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
283
292
  }
284
293
 
285
- if ( o.opacity ) { // opacity option
286
- if ( this.helper.css( "opacity" ) ) {
287
- this._storedOpacity = this.helper.css( "opacity" );
288
- }
289
- this.helper.css( "opacity", o.opacity );
290
- }
291
-
294
+ // We need to make sure to grab the zIndex before setting the
295
+ // opacity, because setting the opacity to anything lower than 1
296
+ // causes the zIndex to change from "auto" to 0.
292
297
  if ( o.zIndex ) { // zIndex option
293
298
  if ( this.helper.css( "zIndex" ) ) {
294
299
  this._storedZIndex = this.helper.css( "zIndex" );
@@ -296,6 +301,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
296
301
  this.helper.css( "zIndex", o.zIndex );
297
302
  }
298
303
 
304
+ if ( o.opacity ) { // opacity option
305
+ if ( this.helper.css( "opacity" ) ) {
306
+ this._storedOpacity = this.helper.css( "opacity" );
307
+ }
308
+ this.helper.css( "opacity", o.opacity );
309
+ }
310
+
299
311
  //Prepare scrolling
300
312
  if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
301
313
  this.scrollParent[ 0 ].tagName !== "HTML" ) {
@@ -330,77 +342,82 @@ return $.widget( "ui.sortable", $.ui.mouse, {
330
342
 
331
343
  this._addClass( this.helper, "ui-sortable-helper" );
332
344
 
333
- // Execute the drag once - this causes the helper not to be visiblebefore getting its
334
- // correct position
335
- this._mouseDrag( event );
336
- return true;
345
+ //Move the helper, if needed
346
+ if ( !this.helper.parent().is( this.appendTo ) ) {
347
+ this.helper.detach().appendTo( this.appendTo );
337
348
 
338
- },
349
+ //Update position
350
+ this.offset.parent = this._getParentOffset();
351
+ }
339
352
 
340
- _mouseDrag: function( event ) {
341
- var i, item, itemElement, intersection,
342
- o = this.options,
343
- scrolled = false;
353
+ //Generate the original position
354
+ this.position = this.originalPosition = this._generatePosition( event );
355
+ this.originalPageX = event.pageX;
356
+ this.originalPageY = event.pageY;
357
+ this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );
344
358
 
345
- //Compute the helpers position
346
- this.position = this._generatePosition( event );
347
- this.positionAbs = this._convertPositionTo( "absolute" );
359
+ this._mouseDrag( event );
348
360
 
349
- if ( !this.lastPositionAbs ) {
350
- this.lastPositionAbs = this.positionAbs;
351
- }
361
+ return true;
352
362
 
353
- //Do scrolling
354
- if ( this.options.scroll ) {
355
- if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
356
- this.scrollParent[ 0 ].tagName !== "HTML" ) {
363
+ },
357
364
 
358
- if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
359
- event.pageY < o.scrollSensitivity ) {
360
- this.scrollParent[ 0 ].scrollTop =
361
- scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
362
- } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
363
- this.scrollParent[ 0 ].scrollTop =
364
- scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
365
- }
365
+ _scroll: function( event ) {
366
+ var o = this.options,
367
+ scrolled = false;
366
368
 
367
- if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
368
- event.pageX < o.scrollSensitivity ) {
369
- this.scrollParent[ 0 ].scrollLeft = scrolled =
370
- this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
371
- } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
372
- this.scrollParent[ 0 ].scrollLeft = scrolled =
373
- this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
374
- }
369
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
370
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
375
371
 
376
- } else {
372
+ if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
373
+ event.pageY < o.scrollSensitivity ) {
374
+ this.scrollParent[ 0 ].scrollTop =
375
+ scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
376
+ } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
377
+ this.scrollParent[ 0 ].scrollTop =
378
+ scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
379
+ }
377
380
 
378
- if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
379
- scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
380
- } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
381
- o.scrollSensitivity ) {
382
- scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
383
- }
381
+ if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
382
+ event.pageX < o.scrollSensitivity ) {
383
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
384
+ this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
385
+ } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
386
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
387
+ this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
388
+ }
384
389
 
385
- if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
386
- scrolled = this.document.scrollLeft(
387
- this.document.scrollLeft() - o.scrollSpeed
388
- );
389
- } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
390
- o.scrollSensitivity ) {
391
- scrolled = this.document.scrollLeft(
392
- this.document.scrollLeft() + o.scrollSpeed
393
- );
394
- }
390
+ } else {
395
391
 
392
+ if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
393
+ scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
394
+ } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
395
+ o.scrollSensitivity ) {
396
+ scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
396
397
  }
397
398
 
398
- if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
399
- $.ui.ddmanager.prepareOffsets( this, event );
399
+ if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
400
+ scrolled = this.document.scrollLeft(
401
+ this.document.scrollLeft() - o.scrollSpeed
402
+ );
403
+ } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
404
+ o.scrollSensitivity ) {
405
+ scrolled = this.document.scrollLeft(
406
+ this.document.scrollLeft() + o.scrollSpeed
407
+ );
400
408
  }
409
+
401
410
  }
402
411
 
403
- //Regenerate the absolute position used for position checks
412
+ return scrolled;
413
+ },
414
+
415
+ _mouseDrag: function( event ) {
416
+ var i, item, itemElement, intersection,
417
+ o = this.options;
418
+
419
+ //Compute the helpers position
420
+ this.position = this._generatePosition( event );
404
421
  this.positionAbs = this._convertPositionTo( "absolute" );
405
422
 
406
423
  //Set the helper position
@@ -411,56 +428,79 @@ return $.widget( "ui.sortable", $.ui.mouse, {
411
428
  this.helper[ 0 ].style.top = this.position.top + "px";
412
429
  }
413
430
 
414
- //Rearrange
415
- for ( i = this.items.length - 1; i >= 0; i-- ) {
431
+ //Post events to containers
432
+ this._contactContainers( event );
416
433
 
417
- //Cache variables and intersection, continue if no intersection
418
- item = this.items[ i ];
419
- itemElement = item.item[ 0 ];
420
- intersection = this._intersectsWithPointer( item );
421
- if ( !intersection ) {
422
- continue;
423
- }
434
+ if ( this.innermostContainer !== null ) {
424
435
 
425
- // Only put the placeholder inside the current Container, skip all
426
- // items from other containers. This works because when moving
427
- // an item from one container to another the
428
- // currentContainer is switched before the placeholder is moved.
429
- //
430
- // Without this, moving items in "sub-sortables" can cause
431
- // the placeholder to jitter between the outer and inner container.
432
- if ( item.instance !== this.currentContainer ) {
433
- continue;
436
+ //Do scrolling
437
+ if ( o.scroll ) {
438
+ if ( this._scroll( event ) !== false ) {
439
+
440
+ //Update item positions used in position checks
441
+ this._refreshItemPositions( true );
442
+
443
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {
444
+ $.ui.ddmanager.prepareOffsets( this, event );
445
+ }
446
+ }
434
447
  }
435
448
 
436
- // Cannot intersect with itself
437
- // no useless actions that have been done before
438
- // no action if the item moved is the parent of the item checked
439
- if ( itemElement !== this.currentItem[ 0 ] &&
440
- this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
441
- !$.contains( this.placeholder[ 0 ], itemElement ) &&
442
- ( this.options.type === "semi-dynamic" ?
443
- !$.contains( this.element[ 0 ], itemElement ) :
444
- true
445
- )
446
- ) {
447
-
448
- this.direction = intersection === 1 ? "down" : "up";
449
-
450
- if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
451
- this._rearrange( event, item );
452
- } else {
453
- break;
449
+ this.dragDirection = {
450
+ vertical: this._getDragVerticalDirection(),
451
+ horizontal: this._getDragHorizontalDirection()
452
+ };
453
+
454
+ //Rearrange
455
+ for ( i = this.items.length - 1; i >= 0; i-- ) {
456
+
457
+ //Cache variables and intersection, continue if no intersection
458
+ item = this.items[ i ];
459
+ itemElement = item.item[ 0 ];
460
+ intersection = this._intersectsWithPointer( item );
461
+ if ( !intersection ) {
462
+ continue;
454
463
  }
455
464
 
456
- this._trigger( "change", event, this._uiHash() );
457
- break;
465
+ // Only put the placeholder inside the current Container, skip all
466
+ // items from other containers. This works because when moving
467
+ // an item from one container to another the
468
+ // currentContainer is switched before the placeholder is moved.
469
+ //
470
+ // Without this, moving items in "sub-sortables" can cause
471
+ // the placeholder to jitter between the outer and inner container.
472
+ if ( item.instance !== this.currentContainer ) {
473
+ continue;
474
+ }
475
+
476
+ // Cannot intersect with itself
477
+ // no useless actions that have been done before
478
+ // no action if the item moved is the parent of the item checked
479
+ if ( itemElement !== this.currentItem[ 0 ] &&
480
+ this.placeholder[ intersection === 1 ?
481
+ "next" : "prev" ]()[ 0 ] !== itemElement &&
482
+ !$.contains( this.placeholder[ 0 ], itemElement ) &&
483
+ ( this.options.type === "semi-dynamic" ?
484
+ !$.contains( this.element[ 0 ], itemElement ) :
485
+ true
486
+ )
487
+ ) {
488
+
489
+ this.direction = intersection === 1 ? "down" : "up";
490
+
491
+ if ( this.options.tolerance === "pointer" ||
492
+ this._intersectsWithSides( item ) ) {
493
+ this._rearrange( event, item );
494
+ } else {
495
+ break;
496
+ }
497
+
498
+ this._trigger( "change", event, this._uiHash() );
499
+ break;
500
+ }
458
501
  }
459
502
  }
460
503
 
461
- //Post events to containers
462
- this._contactContainers( event );
463
-
464
504
  //Interconnect with droppables
465
505
  if ( $.ui.ddmanager ) {
466
506
  $.ui.ddmanager.drag( this, event );
@@ -663,12 +703,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
663
703
  return false;
664
704
  }
665
705
 
666
- verticalDirection = this._getDragVerticalDirection();
667
- horizontalDirection = this._getDragHorizontalDirection();
706
+ verticalDirection = this.dragDirection.vertical;
707
+ horizontalDirection = this.dragDirection.horizontal;
668
708
 
669
709
  return this.floating ?
670
- ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
671
- : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
710
+ ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
711
+ ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
672
712
 
673
713
  },
674
714
 
@@ -678,8 +718,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
678
718
  this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
679
719
  isOverRightHalf = this._isOverAxis( this.positionAbs.left +
680
720
  this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
681
- verticalDirection = this._getDragVerticalDirection(),
682
- horizontalDirection = this._getDragHorizontalDirection();
721
+ verticalDirection = this.dragDirection.vertical,
722
+ horizontalDirection = this.dragDirection.horizontal;
683
723
 
684
724
  if ( this.floating && horizontalDirection ) {
685
725
  return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
@@ -728,7 +768,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
728
768
  for ( j = cur.length - 1; j >= 0; j-- ) {
729
769
  inst = $.data( cur[ j ], this.widgetFullName );
730
770
  if ( inst && inst !== this && !inst.options.disabled ) {
731
- queries.push( [ $.isFunction( inst.options.items ) ?
771
+ queries.push( [ typeof inst.options.items === "function" ?
732
772
  inst.options.items.call( inst.element ) :
733
773
  $( inst.options.items, inst.element )
734
774
  .not( ".ui-sortable-helper" )
@@ -738,7 +778,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
738
778
  }
739
779
  }
740
780
 
741
- queries.push( [ $.isFunction( this.options.items ) ?
781
+ queries.push( [ typeof this.options.items === "function" ?
742
782
  this.options.items
743
783
  .call( this.element, null, { options: this.options, item: this.currentItem } ) :
744
784
  $( this.options.items, this.element )
@@ -778,7 +818,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
778
818
 
779
819
  var i, j, cur, inst, targetData, _queries, item, queriesLength,
780
820
  items = this.items,
781
- queries = [ [ $.isFunction( this.options.items ) ?
821
+ queries = [ [ typeof this.options.items === "function" ?
782
822
  this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
783
823
  $( this.options.items, this.element ), this ] ],
784
824
  connectWith = this._connectWith();
@@ -790,7 +830,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
790
830
  for ( j = cur.length - 1; j >= 0; j-- ) {
791
831
  inst = $.data( cur[ j ], this.widgetFullName );
792
832
  if ( inst && inst !== this && !inst.options.disabled ) {
793
- queries.push( [ $.isFunction( inst.options.items ) ?
833
+ queries.push( [ typeof inst.options.items === "function" ?
794
834
  inst.options.items
795
835
  .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
796
836
  $( inst.options.items, inst.element ), inst ] );
@@ -821,26 +861,14 @@ return $.widget( "ui.sortable", $.ui.mouse, {
821
861
 
822
862
  },
823
863
 
824
- refreshPositions: function( fast ) {
825
-
826
- // Determine whether items are being displayed horizontally
827
- this.floating = this.items.length ?
828
- this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
829
- false;
830
-
831
- //This has to be redone because due to the item being moved out/into the offsetParent,
832
- // the offsetParent's position will change
833
- if ( this.offsetParent && this.helper ) {
834
- this.offset.parent = this._getParentOffset();
835
- }
836
-
864
+ _refreshItemPositions: function( fast ) {
837
865
  var i, item, t, p;
838
866
 
839
867
  for ( i = this.items.length - 1; i >= 0; i-- ) {
840
868
  item = this.items[ i ];
841
869
 
842
870
  //We ignore calculating positions of all connected containers when we're not over them
843
- if ( item.instance !== this.currentContainer && this.currentContainer &&
871
+ if ( this.currentContainer && item.instance !== this.currentContainer &&
844
872
  item.item[ 0 ] !== this.currentItem[ 0 ] ) {
845
873
  continue;
846
874
  }
@@ -858,6 +886,20 @@ return $.widget( "ui.sortable", $.ui.mouse, {
858
886
  item.left = p.left;
859
887
  item.top = p.top;
860
888
  }
889
+ },
890
+
891
+ refreshPositions: function( fast ) {
892
+
893
+ // Determine whether items are being displayed horizontally
894
+ this.floating = this.items.length ?
895
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
896
+ false;
897
+
898
+ if ( this.innermostContainer !== null ) {
899
+ this._refreshItemPositions( fast );
900
+ }
901
+
902
+ var i, p;
861
903
 
862
904
  if ( this.options.custom && this.options.custom.refreshContainers ) {
863
905
  this.options.custom.refreshContainers.call( this );
@@ -878,20 +920,20 @@ return $.widget( "ui.sortable", $.ui.mouse, {
878
920
 
879
921
  _createPlaceholder: function( that ) {
880
922
  that = that || this;
881
- var className,
923
+ var className, nodeName,
882
924
  o = that.options;
883
925
 
884
926
  if ( !o.placeholder || o.placeholder.constructor === String ) {
885
927
  className = o.placeholder;
928
+ nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
886
929
  o.placeholder = {
887
930
  element: function() {
888
931
 
889
- var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
890
- element = $( "<" + nodeName + ">", that.document[ 0 ] );
932
+ var element = $( "<" + nodeName + ">", that.document[ 0 ] );
891
933
 
892
- that._addClass( element, "ui-sortable-placeholder",
893
- className || that.currentItem[ 0 ].className )
894
- ._removeClass( element, "ui-sortable-helper" );
934
+ that._addClass( element, "ui-sortable-placeholder",
935
+ className || that.currentItem[ 0 ].className )
936
+ ._removeClass( element, "ui-sortable-helper" );
895
937
 
896
938
  if ( nodeName === "tbody" ) {
897
939
  that._createTrPlaceholder(
@@ -920,9 +962,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
920
962
  return;
921
963
  }
922
964
 
923
- //If the element doesn't have a actual height by itself (without styles coming
924
- // from a stylesheet), it receives the inline height from the dragged item
925
- if ( !p.height() ) {
965
+ // If the element doesn't have a actual height or width by itself (without
966
+ // styles coming from a stylesheet), it receives the inline height and width
967
+ // from the dragged item. Or, if it's a tbody or tr, it's going to have a height
968
+ // anyway since we're populating them with <td>s above, but they're unlikely to
969
+ // be the correct height on their own if the row heights are dynamic, so we'll
970
+ // always assign the height of the dragged item given forcePlaceholderSize
971
+ // is true.
972
+ if ( !p.height() || ( o.forcePlaceholderSize &&
973
+ ( nodeName === "tbody" || nodeName === "tr" ) ) ) {
926
974
  p.height(
927
975
  that.currentItem.innerHeight() -
928
976
  parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
@@ -997,6 +1045,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
997
1045
 
998
1046
  }
999
1047
 
1048
+ this.innermostContainer = innermostContainer;
1049
+
1000
1050
  // If no intersecting containers found, return
1001
1051
  if ( !innermostContainer ) {
1002
1052
  return;
@@ -1055,9 +1105,11 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1055
1105
  return;
1056
1106
  }
1057
1107
 
1058
- itemWithLeastDistance ?
1059
- this._rearrange( event, itemWithLeastDistance, null, true ) :
1108
+ if ( itemWithLeastDistance ) {
1109
+ this._rearrange( event, itemWithLeastDistance, null, true );
1110
+ } else {
1060
1111
  this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
1112
+ }
1061
1113
  this._trigger( "change", event, this._uiHash() );
1062
1114
  this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
1063
1115
  this.currentContainer = this.containers[ innermostIndex ];
@@ -1065,6 +1117,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1065
1117
  //Update the placeholder
1066
1118
  this.options.placeholder.update( this.currentContainer, this.placeholder );
1067
1119
 
1120
+ //Update scrollParent
1121
+ this.scrollParent = this.placeholder.scrollParent();
1122
+
1123
+ //Update overflowOffset
1124
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1125
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
1126
+ this.overflowOffset = this.scrollParent.offset();
1127
+ }
1128
+
1068
1129
  this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
1069
1130
  this.containers[ innermostIndex ].containerCache.over = 1;
1070
1131
  }
@@ -1074,15 +1135,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1074
1135
  _createHelper: function( event ) {
1075
1136
 
1076
1137
  var o = this.options,
1077
- helper = $.isFunction( o.helper ) ?
1138
+ helper = typeof o.helper === "function" ?
1078
1139
  $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
1079
1140
  ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
1080
1141
 
1081
1142
  //Add the helper to the DOM if that didn't happen already
1082
1143
  if ( !helper.parents( "body" ).length ) {
1083
- $( o.appendTo !== "parent" ?
1084
- o.appendTo :
1085
- this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
1144
+ this.appendTo[ 0 ].appendChild( helper[ 0 ] );
1086
1145
  }
1087
1146
 
1088
1147
  if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
@@ -1110,7 +1169,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1110
1169
  if ( typeof obj === "string" ) {
1111
1170
  obj = obj.split( " " );
1112
1171
  }
1113
- if ( $.isArray( obj ) ) {
1172
+ if ( Array.isArray( obj ) ) {
1114
1173
  obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
1115
1174
  }
1116
1175
  if ( "left" in obj ) {
@@ -1390,9 +1449,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1390
1449
 
1391
1450
  _rearrange: function( event, i, a, hardRefresh ) {
1392
1451
 
1393
- a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
1452
+ if ( a ) {
1453
+ a[ 0 ].appendChild( this.placeholder[ 0 ] );
1454
+ } else {
1394
1455
  i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
1395
1456
  ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
1457
+ }
1396
1458
 
1397
1459
  //Various things done here to improve the performance:
1398
1460
  // 1. we create a setTimeout, that calls refreshPositions
@@ -1558,4 +1620,4 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1558
1620
 
1559
1621
  } );
1560
1622
 
1561
- } ) );
1623
+ } );