jquery-ui-rails 6.0.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. checksums.yaml +5 -5
  2. data/History.md +11 -2
  3. data/README.md +12 -12
  4. data/Rakefile +8 -3
  5. data/VERSIONS.md +2 -0
  6. data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
  7. data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
  8. data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
  9. data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
  10. data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
  11. data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  12. data/app/assets/javascripts/jquery-ui/data.js +16 -18
  13. data/app/assets/javascripts/jquery-ui/disable-selection.js +10 -7
  14. data/app/assets/javascripts/jquery-ui/effect.js +69 -752
  15. data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +11 -8
  16. data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +11 -8
  17. data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +11 -8
  18. data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +11 -8
  19. data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +13 -10
  20. data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +11 -8
  21. data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +11 -8
  22. data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +11 -8
  23. data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +11 -8
  24. data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +11 -8
  25. data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +11 -8
  26. data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +11 -8
  27. data/app/assets/javascripts/jquery-ui/effects/effect-size.js +13 -8
  28. data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +11 -8
  29. data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +12 -9
  30. data/app/assets/javascripts/jquery-ui/focusable.js +13 -20
  31. data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +11 -10
  32. data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +8 -5
  33. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +8 -5
  34. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +7 -4
  35. data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +14 -11
  36. data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +14 -11
  37. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +15 -12
  38. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +14 -11
  39. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +12 -9
  40. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +12 -9
  41. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +8 -5
  42. data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +15 -12
  43. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
  44. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +14 -11
  45. data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +13 -10
  46. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +8 -5
  47. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +8 -5
  48. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +8 -5
  49. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +14 -11
  50. data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +14 -11
  51. data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +8 -5
  52. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +14 -11
  53. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +8 -5
  54. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +14 -11
  55. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +13 -10
  56. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +5 -2
  57. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +7 -4
  58. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +6 -3
  59. data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +14 -11
  60. data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +14 -11
  61. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +7 -4
  62. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +14 -11
  63. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +9 -6
  64. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +14 -11
  65. data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +16 -12
  66. data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +13 -10
  67. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +14 -11
  68. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +14 -11
  69. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +14 -11
  70. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +11 -8
  71. data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +14 -11
  72. data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +9 -6
  73. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +12 -9
  74. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +12 -9
  75. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +8 -5
  76. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +13 -10
  77. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +11 -8
  78. data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +14 -11
  79. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +8 -5
  80. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +14 -11
  81. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +11 -8
  82. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +7 -4
  83. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +8 -5
  84. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +11 -8
  85. data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +11 -8
  86. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +14 -11
  87. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +13 -10
  88. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +12 -9
  89. data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +10 -7
  90. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +10 -7
  91. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +14 -11
  92. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +14 -11
  93. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +14 -11
  94. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +14 -11
  95. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +14 -11
  96. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +14 -11
  97. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +14 -11
  98. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +10 -7
  99. data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +14 -11
  100. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +14 -11
  101. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +14 -11
  102. data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +14 -11
  103. data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +7 -4
  104. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +14 -11
  105. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +14 -11
  106. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +15 -12
  107. data/app/assets/javascripts/jquery-ui/jquery-patch.js +58 -0
  108. data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
  109. data/app/assets/javascripts/jquery-ui/keycode.js +11 -7
  110. data/app/assets/javascripts/jquery-ui/labels.js +18 -13
  111. data/app/assets/javascripts/jquery-ui/plugin.js +5 -2
  112. data/app/assets/javascripts/jquery-ui/position.js +30 -17
  113. data/app/assets/javascripts/jquery-ui/scroll-parent.js +10 -7
  114. data/app/assets/javascripts/jquery-ui/tabbable.js +11 -8
  115. data/app/assets/javascripts/jquery-ui/unique-id.js +10 -7
  116. data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +691 -0
  117. data/app/assets/javascripts/jquery-ui/version.js +6 -3
  118. data/app/assets/javascripts/jquery-ui/widget.js +56 -30
  119. data/app/assets/javascripts/jquery-ui/widgets/accordion.js +32 -23
  120. data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +31 -74
  121. data/app/assets/javascripts/jquery-ui/widgets/button.js +91 -28
  122. data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +27 -24
  123. data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +15 -11
  124. data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +185 -68
  125. data/app/assets/javascripts/jquery-ui/widgets/dialog.js +57 -54
  126. data/app/assets/javascripts/jquery-ui/widgets/draggable.js +30 -25
  127. data/app/assets/javascripts/jquery-ui/widgets/droppable.js +25 -19
  128. data/app/assets/javascripts/jquery-ui/widgets/menu.js +90 -52
  129. data/app/assets/javascripts/jquery-ui/widgets/mouse.js +36 -40
  130. data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +14 -11
  131. data/app/assets/javascripts/jquery-ui/widgets/resizable.js +116 -42
  132. data/app/assets/javascripts/jquery-ui/widgets/selectable.js +18 -11
  133. data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +30 -52
  134. data/app/assets/javascripts/jquery-ui/widgets/slider.js +15 -12
  135. data/app/assets/javascripts/jquery-ui/widgets/sortable.js +193 -140
  136. data/app/assets/javascripts/jquery-ui/widgets/spinner.js +28 -45
  137. data/app/assets/javascripts/jquery-ui/widgets/tabs.js +32 -66
  138. data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +38 -36
  139. data/app/assets/javascripts/jquery-ui.js +3 -7
  140. data/app/assets/stylesheets/jquery-ui/accordion.css +5 -5
  141. data/app/assets/stylesheets/jquery-ui/all.css +5 -5
  142. data/app/assets/stylesheets/jquery-ui/autocomplete.css +5 -5
  143. data/app/assets/stylesheets/jquery-ui/base.css +5 -5
  144. data/app/assets/stylesheets/jquery-ui/button.css +6 -11
  145. data/app/assets/stylesheets/jquery-ui/checkboxradio.css +5 -5
  146. data/app/assets/stylesheets/jquery-ui/controlgroup.css +5 -8
  147. data/app/assets/stylesheets/jquery-ui/core.css +5 -9
  148. data/app/assets/stylesheets/jquery-ui/datepicker.css +5 -5
  149. data/app/assets/stylesheets/jquery-ui/dialog.css +5 -5
  150. data/app/assets/stylesheets/jquery-ui/draggable.css +4 -5
  151. data/app/assets/stylesheets/jquery-ui/menu.css +5 -7
  152. data/app/assets/stylesheets/jquery-ui/progressbar.css +5 -6
  153. data/app/assets/stylesheets/jquery-ui/resizable.css +4 -5
  154. data/app/assets/stylesheets/jquery-ui/selectable.css +4 -5
  155. data/app/assets/stylesheets/jquery-ui/selectmenu.css +5 -5
  156. data/app/assets/stylesheets/jquery-ui/slider.css +6 -13
  157. data/app/assets/stylesheets/jquery-ui/sortable.css +4 -5
  158. data/app/assets/stylesheets/jquery-ui/spinner.css +5 -5
  159. data/app/assets/stylesheets/jquery-ui/tabs.css +5 -5
  160. data/app/assets/stylesheets/jquery-ui/theme.css.erb +10 -14
  161. data/app/assets/stylesheets/jquery-ui/tooltip.css +5 -5
  162. data/lib/jquery/ui/rails/version.rb +2 -2
  163. metadata +11 -15
  164. data/app/assets/javascripts/jquery-ui/core.js +0 -15
  165. data/app/assets/javascripts/jquery-ui/escape-selector.js +0 -23
  166. data/app/assets/javascripts/jquery-ui/form.js +0 -22
  167. data/app/assets/javascripts/jquery-ui/ie.js +0 -17
  168. data/app/assets/javascripts/jquery-ui/jquery-1-7.js +0 -91
  169. data/app/assets/javascripts/jquery-ui/safe-active-element.js +0 -42
  170. data/app/assets/javascripts/jquery-ui/safe-blur.js +0 -23
@@ -1,27 +1,28 @@
1
1
  //= require jquery-ui/widgets/mouse
2
2
  //= require jquery-ui/data
3
- //= require jquery-ui/ie
4
3
  //= require jquery-ui/scroll-parent
5
4
  //= require jquery-ui/version
6
5
  //= require jquery-ui/widget
7
6
 
8
7
  /*!
9
- * jQuery UI Sortable 1.12.1
10
- * http://jqueryui.com
8
+ * jQuery UI Sortable 1.14.1
9
+ * https://jqueryui.com
11
10
  *
12
- * Copyright jQuery Foundation and other contributors
11
+ * Copyright OpenJS Foundation and other contributors
13
12
  * Released under the MIT license.
14
- * http://jquery.org/license
13
+ * https://jquery.org/license
15
14
  */
16
15
 
17
16
  //>>label: Sortable
18
17
  //>>group: Interactions
19
18
  //>>description: Enables items in a list to be sorted using the mouse.
20
- //>>docs: http://api.jqueryui.com/sortable/
21
- //>>demos: http://jqueryui.com/sortable/
19
+ //>>docs: https://api.jqueryui.com/sortable/
20
+ //>>demos: https://jqueryui.com/sortable/
22
21
  //>>css.structure: ../../themes/base/sortable.css
23
22
 
24
23
  ( function( factory ) {
24
+ "use strict";
25
+
25
26
  if ( typeof define === "function" && define.amd ) {
26
27
 
27
28
  // AMD. Register as an anonymous module.
@@ -29,7 +30,6 @@
29
30
  "jquery",
30
31
  "./mouse",
31
32
  "../data",
32
- "../ie",
33
33
  "../scroll-parent",
34
34
  "../version",
35
35
  "../widget"
@@ -39,10 +39,11 @@
39
39
  // Browser globals
40
40
  factory( jQuery );
41
41
  }
42
- }( function( $ ) {
42
+ } )( function( $ ) {
43
+ "use strict";
43
44
 
44
45
  return $.widget( "ui.sortable", $.ui.mouse, {
45
- version: "1.12.1",
46
+ version: "1.14.1",
46
47
  widgetEventPrefix: "sort",
47
48
  ready: false,
48
49
  options: {
@@ -202,6 +203,11 @@ return $.widget( "ui.sortable", $.ui.mouse, {
202
203
  // mouseCapture
203
204
  this.refreshPositions();
204
205
 
206
+ //Prepare the dragged items parent
207
+ this.appendTo = $( o.appendTo !== "parent" ?
208
+ o.appendTo :
209
+ this.currentItem.parent() );
210
+
205
211
  //Create and append the visible helper
206
212
  this.helper = this._createHelper( event );
207
213
 
@@ -216,9 +222,6 @@ return $.widget( "ui.sortable", $.ui.mouse, {
216
222
  //Cache the margins of the original element
217
223
  this._cacheMargins();
218
224
 
219
- //Get the next scrolling parent
220
- this.scrollParent = this.helper.scrollParent();
221
-
222
225
  //The element's absolute position on the page minus margins
223
226
  this.offset = this.currentItem.offset();
224
227
  this.offset = {
@@ -231,25 +234,22 @@ return $.widget( "ui.sortable", $.ui.mouse, {
231
234
  left: event.pageX - this.offset.left,
232
235
  top: event.pageY - this.offset.top
233
236
  },
234
- parent: this._getParentOffset(),
235
237
 
236
238
  // This is a relative to absolute position minus the actual position calculation -
237
239
  // only used for relative positioned helper
238
240
  relative: this._getRelativeOffset()
239
241
  } );
240
242
 
241
- // Only after we got the offset, we can change the helper's position to absolute
243
+ // After we get the helper offset, but before we get the parent offset we can
244
+ // change the helper's position to absolute
242
245
  // TODO: Still need to figure out a way to make relative sorting possible
243
246
  this.helper.css( "position", "absolute" );
244
247
  this.cssPosition = this.helper.css( "position" );
245
248
 
246
- //Generate the original position
247
- this.originalPosition = this._generatePosition( event );
248
- this.originalPageX = event.pageX;
249
- this.originalPageY = event.pageY;
250
-
251
249
  //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
252
- ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
250
+ if ( o.cursorAt ) {
251
+ this._adjustOffsetFromHelper( o.cursorAt );
252
+ }
253
253
 
254
254
  //Cache the former DOM position
255
255
  this.domPosition = {
@@ -266,6 +266,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
266
266
  //Create the placeholder
267
267
  this._createPlaceholder();
268
268
 
269
+ //Get the next scrolling parent
270
+ this.scrollParent = this.placeholder.scrollParent();
271
+
272
+ $.extend( this.offset, {
273
+ parent: this._getParentOffset()
274
+ } );
275
+
269
276
  //Set a containment if given in the options
270
277
  if ( o.containment ) {
271
278
  this._setContainment();
@@ -274,21 +281,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
274
281
  if ( o.cursor && o.cursor !== "auto" ) { // cursor option
275
282
  body = this.document.find( "body" );
276
283
 
277
- // Support: IE
278
- this.storedCursor = body.css( "cursor" );
279
- body.css( "cursor", o.cursor );
280
-
281
- this.storedStylesheet =
284
+ this._storedStylesheet =
282
285
  $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
283
286
  }
284
287
 
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
-
288
+ // We need to make sure to grab the zIndex before setting the
289
+ // opacity, because setting the opacity to anything lower than 1
290
+ // causes the zIndex to change from "auto" to 0.
292
291
  if ( o.zIndex ) { // zIndex option
293
292
  if ( this.helper.css( "zIndex" ) ) {
294
293
  this._storedZIndex = this.helper.css( "zIndex" );
@@ -296,6 +295,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
296
295
  this.helper.css( "zIndex", o.zIndex );
297
296
  }
298
297
 
298
+ if ( o.opacity ) { // opacity option
299
+ if ( this.helper.css( "opacity" ) ) {
300
+ this._storedOpacity = this.helper.css( "opacity" );
301
+ }
302
+ this.helper.css( "opacity", o.opacity );
303
+ }
304
+
299
305
  //Prepare scrolling
300
306
  if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
301
307
  this.scrollParent[ 0 ].tagName !== "HTML" ) {
@@ -330,77 +336,82 @@ return $.widget( "ui.sortable", $.ui.mouse, {
330
336
 
331
337
  this._addClass( this.helper, "ui-sortable-helper" );
332
338
 
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;
339
+ //Move the helper, if needed
340
+ if ( !this.helper.parent().is( this.appendTo ) ) {
341
+ this.helper.detach().appendTo( this.appendTo );
337
342
 
338
- },
343
+ //Update position
344
+ this.offset.parent = this._getParentOffset();
345
+ }
339
346
 
340
- _mouseDrag: function( event ) {
341
- var i, item, itemElement, intersection,
342
- o = this.options,
343
- scrolled = false;
347
+ //Generate the original position
348
+ this.position = this.originalPosition = this._generatePosition( event );
349
+ this.originalPageX = event.pageX;
350
+ this.originalPageY = event.pageY;
351
+ this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );
344
352
 
345
- //Compute the helpers position
346
- this.position = this._generatePosition( event );
347
- this.positionAbs = this._convertPositionTo( "absolute" );
353
+ this._mouseDrag( event );
348
354
 
349
- if ( !this.lastPositionAbs ) {
350
- this.lastPositionAbs = this.positionAbs;
351
- }
355
+ return true;
352
356
 
353
- //Do scrolling
354
- if ( this.options.scroll ) {
355
- if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
356
- this.scrollParent[ 0 ].tagName !== "HTML" ) {
357
+ },
357
358
 
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
- }
359
+ _scroll: function( event ) {
360
+ var o = this.options,
361
+ scrolled = false;
366
362
 
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
- }
363
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
364
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
375
365
 
376
- } else {
366
+ if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
367
+ event.pageY < o.scrollSensitivity ) {
368
+ this.scrollParent[ 0 ].scrollTop =
369
+ scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
370
+ } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
371
+ this.scrollParent[ 0 ].scrollTop =
372
+ scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
373
+ }
377
374
 
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
- }
375
+ if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
376
+ event.pageX < o.scrollSensitivity ) {
377
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
378
+ this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
379
+ } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
380
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
381
+ this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
382
+ }
384
383
 
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
- }
384
+ } else {
395
385
 
386
+ if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
387
+ scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
388
+ } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
389
+ o.scrollSensitivity ) {
390
+ scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
396
391
  }
397
392
 
398
- if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
399
- $.ui.ddmanager.prepareOffsets( this, event );
393
+ if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
394
+ scrolled = this.document.scrollLeft(
395
+ this.document.scrollLeft() - o.scrollSpeed
396
+ );
397
+ } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
398
+ o.scrollSensitivity ) {
399
+ scrolled = this.document.scrollLeft(
400
+ this.document.scrollLeft() + o.scrollSpeed
401
+ );
400
402
  }
403
+
401
404
  }
402
405
 
403
- //Regenerate the absolute position used for position checks
406
+ return scrolled;
407
+ },
408
+
409
+ _mouseDrag: function( event ) {
410
+ var i, item, itemElement, intersection,
411
+ o = this.options;
412
+
413
+ //Compute the helpers position
414
+ this.position = this._generatePosition( event );
404
415
  this.positionAbs = this._convertPositionTo( "absolute" );
405
416
 
406
417
  //Set the helper position
@@ -411,6 +422,24 @@ return $.widget( "ui.sortable", $.ui.mouse, {
411
422
  this.helper[ 0 ].style.top = this.position.top + "px";
412
423
  }
413
424
 
425
+ //Do scrolling
426
+ if ( o.scroll ) {
427
+ if ( this._scroll( event ) !== false ) {
428
+
429
+ //Update item positions used in position checks
430
+ this._refreshItemPositions( true );
431
+
432
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {
433
+ $.ui.ddmanager.prepareOffsets( this, event );
434
+ }
435
+ }
436
+ }
437
+
438
+ this.dragDirection = {
439
+ vertical: this._getDragVerticalDirection(),
440
+ horizontal: this._getDragHorizontalDirection()
441
+ };
442
+
414
443
  //Rearrange
415
444
  for ( i = this.items.length - 1; i >= 0; i-- ) {
416
445
 
@@ -437,7 +466,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
437
466
  // no useless actions that have been done before
438
467
  // no action if the item moved is the parent of the item checked
439
468
  if ( itemElement !== this.currentItem[ 0 ] &&
440
- this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
469
+ this.placeholder[ intersection === 1 ?
470
+ "next" : "prev" ]()[ 0 ] !== itemElement &&
441
471
  !$.contains( this.placeholder[ 0 ], itemElement ) &&
442
472
  ( this.options.type === "semi-dynamic" ?
443
473
  !$.contains( this.element[ 0 ], itemElement ) :
@@ -447,7 +477,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
447
477
 
448
478
  this.direction = intersection === 1 ? "down" : "up";
449
479
 
450
- if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
480
+ if ( this.options.tolerance === "pointer" ||
481
+ this._intersectsWithSides( item ) ) {
451
482
  this._rearrange( event, item );
452
483
  } else {
453
484
  break;
@@ -663,12 +694,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
663
694
  return false;
664
695
  }
665
696
 
666
- verticalDirection = this._getDragVerticalDirection();
667
- horizontalDirection = this._getDragHorizontalDirection();
697
+ verticalDirection = this.dragDirection.vertical;
698
+ horizontalDirection = this.dragDirection.horizontal;
668
699
 
669
700
  return this.floating ?
670
- ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
671
- : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
701
+ ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
702
+ ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
672
703
 
673
704
  },
674
705
 
@@ -678,8 +709,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
678
709
  this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
679
710
  isOverRightHalf = this._isOverAxis( this.positionAbs.left +
680
711
  this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
681
- verticalDirection = this._getDragVerticalDirection(),
682
- horizontalDirection = this._getDragHorizontalDirection();
712
+ verticalDirection = this.dragDirection.vertical,
713
+ horizontalDirection = this.dragDirection.horizontal;
683
714
 
684
715
  if ( this.floating && horizontalDirection ) {
685
716
  return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
@@ -728,7 +759,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
728
759
  for ( j = cur.length - 1; j >= 0; j-- ) {
729
760
  inst = $.data( cur[ j ], this.widgetFullName );
730
761
  if ( inst && inst !== this && !inst.options.disabled ) {
731
- queries.push( [ $.isFunction( inst.options.items ) ?
762
+ queries.push( [ typeof inst.options.items === "function" ?
732
763
  inst.options.items.call( inst.element ) :
733
764
  $( inst.options.items, inst.element )
734
765
  .not( ".ui-sortable-helper" )
@@ -738,7 +769,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
738
769
  }
739
770
  }
740
771
 
741
- queries.push( [ $.isFunction( this.options.items ) ?
772
+ queries.push( [ typeof this.options.items === "function" ?
742
773
  this.options.items
743
774
  .call( this.element, null, { options: this.options, item: this.currentItem } ) :
744
775
  $( this.options.items, this.element )
@@ -778,7 +809,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
778
809
 
779
810
  var i, j, cur, inst, targetData, _queries, item, queriesLength,
780
811
  items = this.items,
781
- queries = [ [ $.isFunction( this.options.items ) ?
812
+ queries = [ [ typeof this.options.items === "function" ?
782
813
  this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
783
814
  $( this.options.items, this.element ), this ] ],
784
815
  connectWith = this._connectWith();
@@ -790,7 +821,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
790
821
  for ( j = cur.length - 1; j >= 0; j-- ) {
791
822
  inst = $.data( cur[ j ], this.widgetFullName );
792
823
  if ( inst && inst !== this && !inst.options.disabled ) {
793
- queries.push( [ $.isFunction( inst.options.items ) ?
824
+ queries.push( [ typeof inst.options.items === "function" ?
794
825
  inst.options.items
795
826
  .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
796
827
  $( inst.options.items, inst.element ), inst ] );
@@ -821,26 +852,14 @@ return $.widget( "ui.sortable", $.ui.mouse, {
821
852
 
822
853
  },
823
854
 
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
-
855
+ _refreshItemPositions: function( fast ) {
837
856
  var i, item, t, p;
838
857
 
839
858
  for ( i = this.items.length - 1; i >= 0; i-- ) {
840
859
  item = this.items[ i ];
841
860
 
842
861
  //We ignore calculating positions of all connected containers when we're not over them
843
- if ( item.instance !== this.currentContainer && this.currentContainer &&
862
+ if ( this.currentContainer && item.instance !== this.currentContainer &&
844
863
  item.item[ 0 ] !== this.currentItem[ 0 ] ) {
845
864
  continue;
846
865
  }
@@ -858,6 +877,24 @@ return $.widget( "ui.sortable", $.ui.mouse, {
858
877
  item.left = p.left;
859
878
  item.top = p.top;
860
879
  }
880
+ },
881
+
882
+ refreshPositions: function( fast ) {
883
+
884
+ // Determine whether items are being displayed horizontally
885
+ this.floating = this.items.length ?
886
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
887
+ false;
888
+
889
+ // This has to be redone because due to the item being moved out/into the offsetParent,
890
+ // the offsetParent's position will change
891
+ if ( this.offsetParent && this.helper ) {
892
+ this.offset.parent = this._getParentOffset();
893
+ }
894
+
895
+ this._refreshItemPositions( fast );
896
+
897
+ var i, p;
861
898
 
862
899
  if ( this.options.custom && this.options.custom.refreshContainers ) {
863
900
  this.options.custom.refreshContainers.call( this );
@@ -878,20 +915,20 @@ return $.widget( "ui.sortable", $.ui.mouse, {
878
915
 
879
916
  _createPlaceholder: function( that ) {
880
917
  that = that || this;
881
- var className,
918
+ var className, nodeName,
882
919
  o = that.options;
883
920
 
884
921
  if ( !o.placeholder || o.placeholder.constructor === String ) {
885
922
  className = o.placeholder;
923
+ nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
886
924
  o.placeholder = {
887
925
  element: function() {
888
926
 
889
- var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
890
- element = $( "<" + nodeName + ">", that.document[ 0 ] );
927
+ var element = $( "<" + nodeName + ">", that.document[ 0 ] );
891
928
 
892
- that._addClass( element, "ui-sortable-placeholder",
893
- className || that.currentItem[ 0 ].className )
894
- ._removeClass( element, "ui-sortable-helper" );
929
+ that._addClass( element, "ui-sortable-placeholder",
930
+ className || that.currentItem[ 0 ].className )
931
+ ._removeClass( element, "ui-sortable-helper" );
895
932
 
896
933
  if ( nodeName === "tbody" ) {
897
934
  that._createTrPlaceholder(
@@ -920,9 +957,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
920
957
  return;
921
958
  }
922
959
 
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() ) {
960
+ // If the element doesn't have a actual height or width by itself (without
961
+ // styles coming from a stylesheet), it receives the inline height and width
962
+ // from the dragged item. Or, if it's a tbody or tr, it's going to have a height
963
+ // anyway since we're populating them with <td>s above, but they're unlikely to
964
+ // be the correct height on their own if the row heights are dynamic, so we'll
965
+ // always assign the height of the dragged item given forcePlaceholderSize
966
+ // is true.
967
+ if ( !p.height() || ( o.forcePlaceholderSize &&
968
+ ( nodeName === "tbody" || nodeName === "tr" ) ) ) {
926
969
  p.height(
927
970
  that.currentItem.innerHeight() -
928
971
  parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
@@ -1055,9 +1098,11 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1055
1098
  return;
1056
1099
  }
1057
1100
 
1058
- itemWithLeastDistance ?
1059
- this._rearrange( event, itemWithLeastDistance, null, true ) :
1101
+ if ( itemWithLeastDistance ) {
1102
+ this._rearrange( event, itemWithLeastDistance, null, true );
1103
+ } else {
1060
1104
  this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
1105
+ }
1061
1106
  this._trigger( "change", event, this._uiHash() );
1062
1107
  this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
1063
1108
  this.currentContainer = this.containers[ innermostIndex ];
@@ -1065,6 +1110,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1065
1110
  //Update the placeholder
1066
1111
  this.options.placeholder.update( this.currentContainer, this.placeholder );
1067
1112
 
1113
+ //Update scrollParent
1114
+ this.scrollParent = this.placeholder.scrollParent();
1115
+
1116
+ //Update overflowOffset
1117
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1118
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
1119
+ this.overflowOffset = this.scrollParent.offset();
1120
+ }
1121
+
1068
1122
  this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
1069
1123
  this.containers[ innermostIndex ].containerCache.over = 1;
1070
1124
  }
@@ -1074,15 +1128,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1074
1128
  _createHelper: function( event ) {
1075
1129
 
1076
1130
  var o = this.options,
1077
- helper = $.isFunction( o.helper ) ?
1131
+ helper = typeof o.helper === "function" ?
1078
1132
  $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
1079
1133
  ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
1080
1134
 
1081
1135
  //Add the helper to the DOM if that didn't happen already
1082
1136
  if ( !helper.parents( "body" ).length ) {
1083
- $( o.appendTo !== "parent" ?
1084
- o.appendTo :
1085
- this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
1137
+ this.appendTo[ 0 ].appendChild( helper[ 0 ] );
1086
1138
  }
1087
1139
 
1088
1140
  if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
@@ -1110,7 +1162,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1110
1162
  if ( typeof obj === "string" ) {
1111
1163
  obj = obj.split( " " );
1112
1164
  }
1113
- if ( $.isArray( obj ) ) {
1165
+ if ( Array.isArray( obj ) ) {
1114
1166
  obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
1115
1167
  }
1116
1168
  if ( "left" in obj ) {
@@ -1146,11 +1198,9 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1146
1198
  po.top += this.scrollParent.scrollTop();
1147
1199
  }
1148
1200
 
1149
- // This needs to be actually done for all browsers, since pageX/pageY includes this
1150
- // information with an ugly IE fix
1151
- if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
1152
- ( this.offsetParent[ 0 ].tagName &&
1153
- this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
1201
+ // This needs to be actually done for all browsers, since pageX/pageY includes
1202
+ // this information.
1203
+ if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ) {
1154
1204
  po = { top: 0, left: 0 };
1155
1205
  }
1156
1206
 
@@ -1390,9 +1440,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1390
1440
 
1391
1441
  _rearrange: function( event, i, a, hardRefresh ) {
1392
1442
 
1393
- a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
1443
+ if ( a ) {
1444
+ a[ 0 ].appendChild( this.placeholder[ 0 ] );
1445
+ } else {
1394
1446
  i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
1395
1447
  ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
1448
+ }
1396
1449
 
1397
1450
  //Various things done here to improve the performance:
1398
1451
  // 1. we create a setTimeout, that calls refreshPositions
@@ -1495,9 +1548,9 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1495
1548
  }
1496
1549
 
1497
1550
  //Do what was originally in plugins
1498
- if ( this.storedCursor ) {
1499
- this.document.find( "body" ).css( "cursor", this.storedCursor );
1500
- this.storedStylesheet.remove();
1551
+ if ( this._storedStylesheet ) {
1552
+ this._storedStylesheet.remove();
1553
+ this._storedStylesheet = null;
1501
1554
  }
1502
1555
  if ( this._storedOpacity ) {
1503
1556
  this.helper.css( "opacity", this._storedOpacity );
@@ -1558,4 +1611,4 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1558
1611
 
1559
1612
  } );
1560
1613
 
1561
- } ) );
1614
+ } );