1
1
/**!
2
- * Sortable 1.15.3
2
+ * Sortable 1.15.4
3
3
* @author RubaXa <[email protected] >
4
4
* @author owenm <[email protected] >
5
5
* @license MIT
@@ -128,7 +128,7 @@ function _nonIterableSpread() {
128
128
throw new TypeError ( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
129
129
}
130
130
131
- var version = "1.15.3 " ;
131
+ var version = "1.15.4 " ;
132
132
133
133
function userAgent ( pattern ) {
134
134
if ( typeof window !== 'undefined' && window . navigator ) {
@@ -1232,7 +1232,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
1232
1232
pluginEvent ( 'filter' , _this , {
1233
1233
evt : evt
1234
1234
} ) ;
1235
- preventOnFilter && evt . cancelable && evt . preventDefault ( ) ;
1235
+ preventOnFilter && evt . preventDefault ( ) ;
1236
1236
return ; // cancel dnd
1237
1237
}
1238
1238
} else if ( filter ) {
@@ -1254,7 +1254,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
1254
1254
}
1255
1255
} ) ;
1256
1256
if ( filter ) {
1257
- preventOnFilter && evt . cancelable && evt . preventDefault ( ) ;
1257
+ preventOnFilter && evt . preventDefault ( ) ;
1258
1258
return ; // cancel dnd
1259
1259
}
1260
1260
}
@@ -1326,9 +1326,15 @@ Sortable.prototype = /** @lends Sortable.prototype */{
1326
1326
on ( ownerDocument , 'dragover' , nearestEmptyInsertDetectEvent ) ;
1327
1327
on ( ownerDocument , 'mousemove' , nearestEmptyInsertDetectEvent ) ;
1328
1328
on ( ownerDocument , 'touchmove' , nearestEmptyInsertDetectEvent ) ;
1329
- on ( ownerDocument , 'mouseup' , _this . _onDrop ) ;
1330
- on ( ownerDocument , 'touchend' , _this . _onDrop ) ;
1331
- on ( ownerDocument , 'touchcancel' , _this . _onDrop ) ;
1329
+ if ( options . supportPointer ) {
1330
+ on ( ownerDocument , 'pointerup' , _this . _onDrop ) ;
1331
+ // Native D&D triggers pointercancel
1332
+ ! this . nativeDraggable && on ( ownerDocument , 'pointercancel' , _this . _onDrop ) ;
1333
+ } else {
1334
+ on ( ownerDocument , 'mouseup' , _this . _onDrop ) ;
1335
+ on ( ownerDocument , 'touchend' , _this . _onDrop ) ;
1336
+ on ( ownerDocument , 'touchcancel' , _this . _onDrop ) ;
1337
+ }
1332
1338
1333
1339
// Make dragEl draggable (must be before delay for FireFox)
1334
1340
if ( FireFox && this . nativeDraggable ) {
@@ -1348,9 +1354,14 @@ Sortable.prototype = /** @lends Sortable.prototype */{
1348
1354
// If the user moves the pointer or let go the click or touch
1349
1355
// before the delay has been reached:
1350
1356
// disable the delayed drag
1351
- on ( ownerDocument , 'mouseup' , _this . _disableDelayedDrag ) ;
1352
- on ( ownerDocument , 'touchend' , _this . _disableDelayedDrag ) ;
1353
- on ( ownerDocument , 'touchcancel' , _this . _disableDelayedDrag ) ;
1357
+ if ( options . supportPointer ) {
1358
+ on ( ownerDocument , 'pointerup' , _this . _disableDelayedDrag ) ;
1359
+ on ( ownerDocument , 'pointercancel' , _this . _disableDelayedDrag ) ;
1360
+ } else {
1361
+ on ( ownerDocument , 'mouseup' , _this . _disableDelayedDrag ) ;
1362
+ on ( ownerDocument , 'touchend' , _this . _disableDelayedDrag ) ;
1363
+ on ( ownerDocument , 'touchcancel' , _this . _disableDelayedDrag ) ;
1364
+ }
1354
1365
on ( ownerDocument , 'mousemove' , _this . _delayedDragTouchMoveHandler ) ;
1355
1366
on ( ownerDocument , 'touchmove' , _this . _delayedDragTouchMoveHandler ) ;
1356
1367
options . supportPointer && on ( ownerDocument , 'pointermove' , _this . _delayedDragTouchMoveHandler ) ;
@@ -1376,6 +1387,8 @@ Sortable.prototype = /** @lends Sortable.prototype */{
1376
1387
off ( ownerDocument , 'mouseup' , this . _disableDelayedDrag ) ;
1377
1388
off ( ownerDocument , 'touchend' , this . _disableDelayedDrag ) ;
1378
1389
off ( ownerDocument , 'touchcancel' , this . _disableDelayedDrag ) ;
1390
+ off ( ownerDocument , 'pointerup' , this . _disableDelayedDrag ) ;
1391
+ off ( ownerDocument , 'pointercancel' , this . _disableDelayedDrag ) ;
1379
1392
off ( ownerDocument , 'mousemove' , this . _delayedDragTouchMoveHandler ) ;
1380
1393
off ( ownerDocument , 'touchmove' , this . _delayedDragTouchMoveHandler ) ;
1381
1394
off ( ownerDocument , 'pointermove' , this . _delayedDragTouchMoveHandler ) ;
@@ -1395,14 +1408,13 @@ Sortable.prototype = /** @lends Sortable.prototype */{
1395
1408
on ( rootEl , 'dragstart' , this . _onDragStart ) ;
1396
1409
}
1397
1410
try {
1398
- if ( document . selection ) {
1399
- // Timeout neccessary for IE9
1400
- _nextTick ( function ( ) {
1411
+ _nextTick ( function ( ) {
1412
+ if ( document . selection ) {
1401
1413
document . selection . empty ( ) ;
1402
- } ) ;
1403
- } else {
1404
- window . getSelection ( ) . removeAllRanges ( ) ;
1405
- }
1414
+ } else {
1415
+ window . getSelection ( ) . removeAllRanges ( ) ;
1416
+ }
1417
+ } ) ;
1406
1418
} catch ( err ) { }
1407
1419
} ,
1408
1420
_dragStarted : function _dragStarted ( fallback , evt ) {
@@ -1889,6 +1901,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
1889
1901
off ( ownerDocument , 'mouseup' , this . _onDrop ) ;
1890
1902
off ( ownerDocument , 'touchend' , this . _onDrop ) ;
1891
1903
off ( ownerDocument , 'pointerup' , this . _onDrop ) ;
1904
+ off ( ownerDocument , 'pointercancel' , this . _onDrop ) ;
1892
1905
off ( ownerDocument , 'touchcancel' , this . _onDrop ) ;
1893
1906
off ( document , 'selectstart' , this ) ;
1894
1907
} ,
@@ -3079,28 +3092,38 @@ function MultiDragPlugin() {
3079
3092
var lastIndex = index ( lastMultiDragSelect ) ,
3080
3093
currentIndex = index ( dragEl$1 ) ;
3081
3094
if ( ~ lastIndex && ~ currentIndex && lastIndex !== currentIndex ) {
3082
- // Must include lastMultiDragSelect (select it), in case modified selection from no selection
3083
- // (but previous selection existed)
3084
- var n , i ;
3085
- if ( currentIndex > lastIndex ) {
3086
- i = lastIndex ;
3087
- n = currentIndex ;
3088
- } else {
3089
- i = currentIndex ;
3090
- n = lastIndex + 1 ;
3091
- }
3092
- for ( ; i < n ; i ++ ) {
3093
- if ( ~ multiDragElements . indexOf ( children [ i ] ) ) continue ;
3094
- toggleClass ( children [ i ] , options . selectedClass , true ) ;
3095
- multiDragElements . push ( children [ i ] ) ;
3096
- dispatchEvent ( {
3097
- sortable : sortable ,
3098
- rootEl : rootEl ,
3099
- name : 'select' ,
3100
- targetEl : children [ i ] ,
3101
- originalEvent : evt
3102
- } ) ;
3103
- }
3095
+ ( function ( ) {
3096
+ // Must include lastMultiDragSelect (select it), in case modified selection from no selection
3097
+ // (but previous selection existed)
3098
+ var n , i ;
3099
+ if ( currentIndex > lastIndex ) {
3100
+ i = lastIndex ;
3101
+ n = currentIndex ;
3102
+ } else {
3103
+ i = currentIndex ;
3104
+ n = lastIndex + 1 ;
3105
+ }
3106
+ var filter = options . filter ;
3107
+ for ( ; i < n ; i ++ ) {
3108
+ if ( ~ multiDragElements . indexOf ( children [ i ] ) ) continue ;
3109
+ // Check if element is draggable
3110
+ if ( ! closest ( children [ i ] , options . draggable , parentEl , false ) ) continue ;
3111
+ // Check if element is filtered
3112
+ var filtered = filter && ( typeof filter === 'function' ? filter . call ( sortable , evt , children [ i ] , sortable ) : filter . split ( ',' ) . some ( function ( criteria ) {
3113
+ return closest ( children [ i ] , criteria . trim ( ) , parentEl , false ) ;
3114
+ } ) ) ;
3115
+ if ( filtered ) continue ;
3116
+ toggleClass ( children [ i ] , options . selectedClass , true ) ;
3117
+ multiDragElements . push ( children [ i ] ) ;
3118
+ dispatchEvent ( {
3119
+ sortable : sortable ,
3120
+ rootEl : rootEl ,
3121
+ name : 'select' ,
3122
+ targetEl : children [ i ] ,
3123
+ originalEvent : evt
3124
+ } ) ;
3125
+ }
3126
+ } ) ( ) ;
3104
3127
}
3105
3128
} else {
3106
3129
lastMultiDragSelect = dragEl$1 ;
0 commit comments