activeadmin 3.2.0 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/views/components/active_admin_form.rb +1 -1
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +1 -1
- data/vendor/assets/javascripts/jquery-ui/data.js +12 -8
- data/vendor/assets/javascripts/jquery-ui/disable-selection.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/focusable.js +12 -9
- data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +60 -57
- data/vendor/assets/javascripts/jquery-ui/form.js +15 -12
- data/vendor/assets/javascripts/jquery-ui/ie.js +5 -2
- data/vendor/assets/javascripts/jquery-ui/keycode.js +11 -7
- data/vendor/assets/javascripts/jquery-ui/labels.js +46 -40
- data/vendor/assets/javascripts/jquery-ui/plugin.js +5 -2
- data/vendor/assets/javascripts/jquery-ui/position.js +30 -17
- data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
- data/vendor/assets/javascripts/jquery-ui/safe-blur.js +6 -2
- data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/tabbable.js +11 -8
- data/vendor/assets/javascripts/jquery-ui/unique-id.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/version.js +6 -3
- data/vendor/assets/javascripts/jquery-ui/widget.js +53 -30
- data/vendor/assets/javascripts/jquery-ui/widgets/button.js +87 -24
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +276 -273
- data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +15 -11
- data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +182 -62
- data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +53 -36
- data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +28 -19
- data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +22 -11
- data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +47 -26
- data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +186 -125
- data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +20 -20
- metadata +17 -4
- data/vendor/assets/javascripts/jquery-ui/escape-selector.js +0 -23
@@ -6,22 +6,24 @@
|
|
6
6
|
//= require jquery-ui/widget
|
7
7
|
|
8
8
|
/*!
|
9
|
-
* jQuery UI Sortable 1.
|
10
|
-
*
|
9
|
+
* jQuery UI Sortable 1.13.3
|
10
|
+
* https://jqueryui.com
|
11
11
|
*
|
12
|
-
* Copyright
|
12
|
+
* Copyright OpenJS Foundation and other contributors
|
13
13
|
* Released under the MIT license.
|
14
|
-
*
|
14
|
+
* https://jquery.org/license
|
15
15
|
*/
|
16
16
|
|
17
17
|
//>>label: Sortable
|
18
18
|
//>>group: Interactions
|
19
19
|
//>>description: Enables items in a list to be sorted using the mouse.
|
20
|
-
//>>docs:
|
21
|
-
//>>demos:
|
20
|
+
//>>docs: https://api.jqueryui.com/sortable/
|
21
|
+
//>>demos: https://jqueryui.com/sortable/
|
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.
|
48
|
+
version: "1.13.3",
|
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
|
-
//
|
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
|
-
|
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
|
-
|
286
|
-
|
287
|
-
|
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
|
-
//
|
334
|
-
|
335
|
-
|
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
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
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
|
-
|
346
|
-
this.position = this._generatePosition( event );
|
347
|
-
this.positionAbs = this._convertPositionTo( "absolute" );
|
359
|
+
this._mouseDrag( event );
|
348
360
|
|
349
|
-
|
350
|
-
this.lastPositionAbs = this.positionAbs;
|
351
|
-
}
|
361
|
+
return true;
|
352
362
|
|
353
|
-
|
354
|
-
if ( this.options.scroll ) {
|
355
|
-
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
356
|
-
this.scrollParent[ 0 ].tagName !== "HTML" ) {
|
363
|
+
},
|
357
364
|
|
358
|
-
|
359
|
-
|
360
|
-
|
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
|
-
|
368
|
-
|
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
|
-
|
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
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
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
|
-
|
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 (
|
399
|
-
|
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
|
-
|
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,6 +428,24 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
411
428
|
this.helper[ 0 ].style.top = this.position.top + "px";
|
412
429
|
}
|
413
430
|
|
431
|
+
//Do scrolling
|
432
|
+
if ( o.scroll ) {
|
433
|
+
if ( this._scroll( event ) !== false ) {
|
434
|
+
|
435
|
+
//Update item positions used in position checks
|
436
|
+
this._refreshItemPositions( true );
|
437
|
+
|
438
|
+
if ( $.ui.ddmanager && !o.dropBehaviour ) {
|
439
|
+
$.ui.ddmanager.prepareOffsets( this, event );
|
440
|
+
}
|
441
|
+
}
|
442
|
+
}
|
443
|
+
|
444
|
+
this.dragDirection = {
|
445
|
+
vertical: this._getDragVerticalDirection(),
|
446
|
+
horizontal: this._getDragHorizontalDirection()
|
447
|
+
};
|
448
|
+
|
414
449
|
//Rearrange
|
415
450
|
for ( i = this.items.length - 1; i >= 0; i-- ) {
|
416
451
|
|
@@ -437,7 +472,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
437
472
|
// no useless actions that have been done before
|
438
473
|
// no action if the item moved is the parent of the item checked
|
439
474
|
if ( itemElement !== this.currentItem[ 0 ] &&
|
440
|
-
this.placeholder[ intersection === 1 ?
|
475
|
+
this.placeholder[ intersection === 1 ?
|
476
|
+
"next" : "prev" ]()[ 0 ] !== itemElement &&
|
441
477
|
!$.contains( this.placeholder[ 0 ], itemElement ) &&
|
442
478
|
( this.options.type === "semi-dynamic" ?
|
443
479
|
!$.contains( this.element[ 0 ], itemElement ) :
|
@@ -447,7 +483,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
447
483
|
|
448
484
|
this.direction = intersection === 1 ? "down" : "up";
|
449
485
|
|
450
|
-
if ( this.options.tolerance === "pointer" ||
|
486
|
+
if ( this.options.tolerance === "pointer" ||
|
487
|
+
this._intersectsWithSides( item ) ) {
|
451
488
|
this._rearrange( event, item );
|
452
489
|
} else {
|
453
490
|
break;
|
@@ -663,12 +700,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
663
700
|
return false;
|
664
701
|
}
|
665
702
|
|
666
|
-
verticalDirection = this.
|
667
|
-
horizontalDirection = this.
|
703
|
+
verticalDirection = this.dragDirection.vertical;
|
704
|
+
horizontalDirection = this.dragDirection.horizontal;
|
668
705
|
|
669
706
|
return this.floating ?
|
670
|
-
( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
|
671
|
-
|
707
|
+
( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
|
708
|
+
( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
|
672
709
|
|
673
710
|
},
|
674
711
|
|
@@ -678,8 +715,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
678
715
|
this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
|
679
716
|
isOverRightHalf = this._isOverAxis( this.positionAbs.left +
|
680
717
|
this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
|
681
|
-
verticalDirection = this.
|
682
|
-
horizontalDirection = this.
|
718
|
+
verticalDirection = this.dragDirection.vertical,
|
719
|
+
horizontalDirection = this.dragDirection.horizontal;
|
683
720
|
|
684
721
|
if ( this.floating && horizontalDirection ) {
|
685
722
|
return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
|
@@ -728,7 +765,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
728
765
|
for ( j = cur.length - 1; j >= 0; j-- ) {
|
729
766
|
inst = $.data( cur[ j ], this.widgetFullName );
|
730
767
|
if ( inst && inst !== this && !inst.options.disabled ) {
|
731
|
-
queries.push( [
|
768
|
+
queries.push( [ typeof inst.options.items === "function" ?
|
732
769
|
inst.options.items.call( inst.element ) :
|
733
770
|
$( inst.options.items, inst.element )
|
734
771
|
.not( ".ui-sortable-helper" )
|
@@ -738,7 +775,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
738
775
|
}
|
739
776
|
}
|
740
777
|
|
741
|
-
queries.push( [
|
778
|
+
queries.push( [ typeof this.options.items === "function" ?
|
742
779
|
this.options.items
|
743
780
|
.call( this.element, null, { options: this.options, item: this.currentItem } ) :
|
744
781
|
$( this.options.items, this.element )
|
@@ -778,7 +815,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
778
815
|
|
779
816
|
var i, j, cur, inst, targetData, _queries, item, queriesLength,
|
780
817
|
items = this.items,
|
781
|
-
queries = [ [
|
818
|
+
queries = [ [ typeof this.options.items === "function" ?
|
782
819
|
this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
|
783
820
|
$( this.options.items, this.element ), this ] ],
|
784
821
|
connectWith = this._connectWith();
|
@@ -790,7 +827,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
790
827
|
for ( j = cur.length - 1; j >= 0; j-- ) {
|
791
828
|
inst = $.data( cur[ j ], this.widgetFullName );
|
792
829
|
if ( inst && inst !== this && !inst.options.disabled ) {
|
793
|
-
queries.push( [
|
830
|
+
queries.push( [ typeof inst.options.items === "function" ?
|
794
831
|
inst.options.items
|
795
832
|
.call( inst.element[ 0 ], event, { item: this.currentItem } ) :
|
796
833
|
$( inst.options.items, inst.element ), inst ] );
|
@@ -821,26 +858,14 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
821
858
|
|
822
859
|
},
|
823
860
|
|
824
|
-
|
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
|
-
|
861
|
+
_refreshItemPositions: function( fast ) {
|
837
862
|
var i, item, t, p;
|
838
863
|
|
839
864
|
for ( i = this.items.length - 1; i >= 0; i-- ) {
|
840
865
|
item = this.items[ i ];
|
841
866
|
|
842
867
|
//We ignore calculating positions of all connected containers when we're not over them
|
843
|
-
if ( item.instance !== this.currentContainer &&
|
868
|
+
if ( this.currentContainer && item.instance !== this.currentContainer &&
|
844
869
|
item.item[ 0 ] !== this.currentItem[ 0 ] ) {
|
845
870
|
continue;
|
846
871
|
}
|
@@ -858,6 +883,24 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
858
883
|
item.left = p.left;
|
859
884
|
item.top = p.top;
|
860
885
|
}
|
886
|
+
},
|
887
|
+
|
888
|
+
refreshPositions: function( fast ) {
|
889
|
+
|
890
|
+
// Determine whether items are being displayed horizontally
|
891
|
+
this.floating = this.items.length ?
|
892
|
+
this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
|
893
|
+
false;
|
894
|
+
|
895
|
+
// This has to be redone because due to the item being moved out/into the offsetParent,
|
896
|
+
// the offsetParent's position will change
|
897
|
+
if ( this.offsetParent && this.helper ) {
|
898
|
+
this.offset.parent = this._getParentOffset();
|
899
|
+
}
|
900
|
+
|
901
|
+
this._refreshItemPositions( fast );
|
902
|
+
|
903
|
+
var i, p;
|
861
904
|
|
862
905
|
if ( this.options.custom && this.options.custom.refreshContainers ) {
|
863
906
|
this.options.custom.refreshContainers.call( this );
|
@@ -878,20 +921,20 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
878
921
|
|
879
922
|
_createPlaceholder: function( that ) {
|
880
923
|
that = that || this;
|
881
|
-
var className,
|
924
|
+
var className, nodeName,
|
882
925
|
o = that.options;
|
883
926
|
|
884
927
|
if ( !o.placeholder || o.placeholder.constructor === String ) {
|
885
928
|
className = o.placeholder;
|
929
|
+
nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
|
886
930
|
o.placeholder = {
|
887
931
|
element: function() {
|
888
932
|
|
889
|
-
var
|
890
|
-
element = $( "<" + nodeName + ">", that.document[ 0 ] );
|
933
|
+
var element = $( "<" + nodeName + ">", that.document[ 0 ] );
|
891
934
|
|
892
|
-
|
893
|
-
|
894
|
-
|
935
|
+
that._addClass( element, "ui-sortable-placeholder",
|
936
|
+
className || that.currentItem[ 0 ].className )
|
937
|
+
._removeClass( element, "ui-sortable-helper" );
|
895
938
|
|
896
939
|
if ( nodeName === "tbody" ) {
|
897
940
|
that._createTrPlaceholder(
|
@@ -920,9 +963,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
920
963
|
return;
|
921
964
|
}
|
922
965
|
|
923
|
-
//If the element doesn't have a actual height by itself (without
|
924
|
-
// from a stylesheet), it receives the inline height
|
925
|
-
|
966
|
+
// If the element doesn't have a actual height or width by itself (without
|
967
|
+
// styles coming from a stylesheet), it receives the inline height and width
|
968
|
+
// from the dragged item. Or, if it's a tbody or tr, it's going to have a height
|
969
|
+
// anyway since we're populating them with <td>s above, but they're unlikely to
|
970
|
+
// be the correct height on their own if the row heights are dynamic, so we'll
|
971
|
+
// always assign the height of the dragged item given forcePlaceholderSize
|
972
|
+
// is true.
|
973
|
+
if ( !p.height() || ( o.forcePlaceholderSize &&
|
974
|
+
( nodeName === "tbody" || nodeName === "tr" ) ) ) {
|
926
975
|
p.height(
|
927
976
|
that.currentItem.innerHeight() -
|
928
977
|
parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
|
@@ -1055,9 +1104,11 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
1055
1104
|
return;
|
1056
1105
|
}
|
1057
1106
|
|
1058
|
-
itemWithLeastDistance
|
1059
|
-
this._rearrange( event, itemWithLeastDistance, null, true )
|
1107
|
+
if ( itemWithLeastDistance ) {
|
1108
|
+
this._rearrange( event, itemWithLeastDistance, null, true );
|
1109
|
+
} else {
|
1060
1110
|
this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
|
1111
|
+
}
|
1061
1112
|
this._trigger( "change", event, this._uiHash() );
|
1062
1113
|
this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
|
1063
1114
|
this.currentContainer = this.containers[ innermostIndex ];
|
@@ -1065,6 +1116,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
1065
1116
|
//Update the placeholder
|
1066
1117
|
this.options.placeholder.update( this.currentContainer, this.placeholder );
|
1067
1118
|
|
1119
|
+
//Update scrollParent
|
1120
|
+
this.scrollParent = this.placeholder.scrollParent();
|
1121
|
+
|
1122
|
+
//Update overflowOffset
|
1123
|
+
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
1124
|
+
this.scrollParent[ 0 ].tagName !== "HTML" ) {
|
1125
|
+
this.overflowOffset = this.scrollParent.offset();
|
1126
|
+
}
|
1127
|
+
|
1068
1128
|
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
|
1069
1129
|
this.containers[ innermostIndex ].containerCache.over = 1;
|
1070
1130
|
}
|
@@ -1074,15 +1134,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
1074
1134
|
_createHelper: function( event ) {
|
1075
1135
|
|
1076
1136
|
var o = this.options,
|
1077
|
-
helper =
|
1137
|
+
helper = typeof o.helper === "function" ?
|
1078
1138
|
$( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
|
1079
1139
|
( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
|
1080
1140
|
|
1081
1141
|
//Add the helper to the DOM if that didn't happen already
|
1082
1142
|
if ( !helper.parents( "body" ).length ) {
|
1083
|
-
|
1084
|
-
o.appendTo :
|
1085
|
-
this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
|
1143
|
+
this.appendTo[ 0 ].appendChild( helper[ 0 ] );
|
1086
1144
|
}
|
1087
1145
|
|
1088
1146
|
if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
|
@@ -1110,7 +1168,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
1110
1168
|
if ( typeof obj === "string" ) {
|
1111
1169
|
obj = obj.split( " " );
|
1112
1170
|
}
|
1113
|
-
if (
|
1171
|
+
if ( Array.isArray( obj ) ) {
|
1114
1172
|
obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
|
1115
1173
|
}
|
1116
1174
|
if ( "left" in obj ) {
|
@@ -1390,9 +1448,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
1390
1448
|
|
1391
1449
|
_rearrange: function( event, i, a, hardRefresh ) {
|
1392
1450
|
|
1393
|
-
|
1451
|
+
if ( a ) {
|
1452
|
+
a[ 0 ].appendChild( this.placeholder[ 0 ] );
|
1453
|
+
} else {
|
1394
1454
|
i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
|
1395
1455
|
( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
|
1456
|
+
}
|
1396
1457
|
|
1397
1458
|
//Various things done here to improve the performance:
|
1398
1459
|
// 1. we create a setTimeout, that calls refreshPositions
|
@@ -1558,4 +1619,4 @@ return $.widget( "ui.sortable", $.ui.mouse, {
|
|
1558
1619
|
|
1559
1620
|
} );
|
1560
1621
|
|
1561
|
-
} )
|
1622
|
+
} );
|