sortablejs 1.15.2 → 1.15.6
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.
- package/README.md +3 -2
- package/Sortable.js +62 -36
- package/Sortable.min.js +2 -2
- package/modular/sortable.complete.esm.js +62 -36
- package/modular/sortable.core.esm.js +62 -36
- package/modular/sortable.esm.js +62 -36
- package/package.json +3 -2
- package/src/Animation.js +175 -0
- package/src/BrowserInfo.js +12 -0
- package/src/EventDispatcher.js +57 -0
- package/src/PluginManager.js +94 -0
- package/src/Sortable.js +2028 -0
- package/src/utils.js +595 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Sortable 1.15.
|
|
2
|
+
* Sortable 1.15.6
|
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
|
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.
|
|
131
|
+
var version = "1.15.6";
|
|
132
132
|
|
|
133
133
|
function userAgent(pattern) {
|
|
134
134
|
if (typeof window !== 'undefined' && window.navigator) {
|
|
@@ -1121,7 +1121,8 @@ function Sortable(el, options) {
|
|
|
1121
1121
|
x: 0,
|
|
1122
1122
|
y: 0
|
|
1123
1123
|
},
|
|
1124
|
-
|
|
1124
|
+
// Disabled on Safari: #1571; Enabled on Safari IOS: #2244
|
|
1125
|
+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
|
|
1125
1126
|
emptyInsertThreshold: 5
|
|
1126
1127
|
};
|
|
1127
1128
|
PluginManager.initializePlugins(this, el, defaults);
|
|
@@ -1232,7 +1233,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1232
1233
|
pluginEvent('filter', _this, {
|
|
1233
1234
|
evt: evt
|
|
1234
1235
|
});
|
|
1235
|
-
preventOnFilter && evt.
|
|
1236
|
+
preventOnFilter && evt.preventDefault();
|
|
1236
1237
|
return; // cancel dnd
|
|
1237
1238
|
}
|
|
1238
1239
|
} else if (filter) {
|
|
@@ -1254,7 +1255,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1254
1255
|
}
|
|
1255
1256
|
});
|
|
1256
1257
|
if (filter) {
|
|
1257
|
-
preventOnFilter && evt.
|
|
1258
|
+
preventOnFilter && evt.preventDefault();
|
|
1258
1259
|
return; // cancel dnd
|
|
1259
1260
|
}
|
|
1260
1261
|
}
|
|
@@ -1326,9 +1327,15 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1326
1327
|
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
|
|
1327
1328
|
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
|
|
1328
1329
|
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1330
|
+
if (options.supportPointer) {
|
|
1331
|
+
on(ownerDocument, 'pointerup', _this._onDrop);
|
|
1332
|
+
// Native D&D triggers pointercancel
|
|
1333
|
+
!this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);
|
|
1334
|
+
} else {
|
|
1335
|
+
on(ownerDocument, 'mouseup', _this._onDrop);
|
|
1336
|
+
on(ownerDocument, 'touchend', _this._onDrop);
|
|
1337
|
+
on(ownerDocument, 'touchcancel', _this._onDrop);
|
|
1338
|
+
}
|
|
1332
1339
|
|
|
1333
1340
|
// Make dragEl draggable (must be before delay for FireFox)
|
|
1334
1341
|
if (FireFox && this.nativeDraggable) {
|
|
@@ -1348,9 +1355,14 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1348
1355
|
// If the user moves the pointer or let go the click or touch
|
|
1349
1356
|
// before the delay has been reached:
|
|
1350
1357
|
// disable the delayed drag
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1358
|
+
if (options.supportPointer) {
|
|
1359
|
+
on(ownerDocument, 'pointerup', _this._disableDelayedDrag);
|
|
1360
|
+
on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);
|
|
1361
|
+
} else {
|
|
1362
|
+
on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
|
1363
|
+
on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
|
1364
|
+
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
|
1365
|
+
}
|
|
1354
1366
|
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
|
|
1355
1367
|
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
|
|
1356
1368
|
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
|
|
@@ -1376,6 +1388,8 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1376
1388
|
off(ownerDocument, 'mouseup', this._disableDelayedDrag);
|
|
1377
1389
|
off(ownerDocument, 'touchend', this._disableDelayedDrag);
|
|
1378
1390
|
off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
|
|
1391
|
+
off(ownerDocument, 'pointerup', this._disableDelayedDrag);
|
|
1392
|
+
off(ownerDocument, 'pointercancel', this._disableDelayedDrag);
|
|
1379
1393
|
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
|
|
1380
1394
|
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
|
|
1381
1395
|
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
|
|
@@ -1396,7 +1410,6 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1396
1410
|
}
|
|
1397
1411
|
try {
|
|
1398
1412
|
if (document.selection) {
|
|
1399
|
-
// Timeout neccessary for IE9
|
|
1400
1413
|
_nextTick(function () {
|
|
1401
1414
|
document.selection.empty();
|
|
1402
1415
|
});
|
|
@@ -1461,7 +1474,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1461
1474
|
}
|
|
1462
1475
|
target = parent; // store last element
|
|
1463
1476
|
}
|
|
1464
|
-
/* jshint boss:true */ while (parent = parent
|
|
1477
|
+
/* jshint boss:true */ while (parent = getParentOrHost(parent));
|
|
1465
1478
|
}
|
|
1466
1479
|
_unhideGhostForTarget();
|
|
1467
1480
|
}
|
|
@@ -1618,6 +1631,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1618
1631
|
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
|
|
1619
1632
|
on(document, 'selectstart', _this);
|
|
1620
1633
|
moved = true;
|
|
1634
|
+
window.getSelection().removeAllRanges();
|
|
1621
1635
|
if (Safari) {
|
|
1622
1636
|
css(document.body, 'user-select', 'none');
|
|
1623
1637
|
}
|
|
@@ -1889,6 +1903,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1889
1903
|
off(ownerDocument, 'mouseup', this._onDrop);
|
|
1890
1904
|
off(ownerDocument, 'touchend', this._onDrop);
|
|
1891
1905
|
off(ownerDocument, 'pointerup', this._onDrop);
|
|
1906
|
+
off(ownerDocument, 'pointercancel', this._onDrop);
|
|
1892
1907
|
off(ownerDocument, 'touchcancel', this._onDrop);
|
|
1893
1908
|
off(document, 'selectstart', this);
|
|
1894
1909
|
},
|
|
@@ -2367,7 +2382,8 @@ Sortable.utils = {
|
|
|
2367
2382
|
nextTick: _nextTick,
|
|
2368
2383
|
cancelNextTick: _cancelNextTick,
|
|
2369
2384
|
detectDirection: _detectDirection,
|
|
2370
|
-
getChild: getChild
|
|
2385
|
+
getChild: getChild,
|
|
2386
|
+
expando: expando
|
|
2371
2387
|
};
|
|
2372
2388
|
|
|
2373
2389
|
/**
|
|
@@ -3078,28 +3094,38 @@ function MultiDragPlugin() {
|
|
|
3078
3094
|
var lastIndex = index(lastMultiDragSelect),
|
|
3079
3095
|
currentIndex = index(dragEl$1);
|
|
3080
3096
|
if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3097
|
+
(function () {
|
|
3098
|
+
// Must include lastMultiDragSelect (select it), in case modified selection from no selection
|
|
3099
|
+
// (but previous selection existed)
|
|
3100
|
+
var n, i;
|
|
3101
|
+
if (currentIndex > lastIndex) {
|
|
3102
|
+
i = lastIndex;
|
|
3103
|
+
n = currentIndex;
|
|
3104
|
+
} else {
|
|
3105
|
+
i = currentIndex;
|
|
3106
|
+
n = lastIndex + 1;
|
|
3107
|
+
}
|
|
3108
|
+
var filter = options.filter;
|
|
3109
|
+
for (; i < n; i++) {
|
|
3110
|
+
if (~multiDragElements.indexOf(children[i])) continue;
|
|
3111
|
+
// Check if element is draggable
|
|
3112
|
+
if (!closest(children[i], options.draggable, parentEl, false)) continue;
|
|
3113
|
+
// Check if element is filtered
|
|
3114
|
+
var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {
|
|
3115
|
+
return closest(children[i], criteria.trim(), parentEl, false);
|
|
3116
|
+
}));
|
|
3117
|
+
if (filtered) continue;
|
|
3118
|
+
toggleClass(children[i], options.selectedClass, true);
|
|
3119
|
+
multiDragElements.push(children[i]);
|
|
3120
|
+
dispatchEvent({
|
|
3121
|
+
sortable: sortable,
|
|
3122
|
+
rootEl: rootEl,
|
|
3123
|
+
name: 'select',
|
|
3124
|
+
targetEl: children[i],
|
|
3125
|
+
originalEvent: evt
|
|
3126
|
+
});
|
|
3127
|
+
}
|
|
3128
|
+
})();
|
|
3103
3129
|
}
|
|
3104
3130
|
} else {
|
|
3105
3131
|
lastMultiDragSelect = dragEl$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Sortable 1.15.
|
|
2
|
+
* Sortable 1.15.6
|
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
|
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.
|
|
131
|
+
var version = "1.15.6";
|
|
132
132
|
|
|
133
133
|
function userAgent(pattern) {
|
|
134
134
|
if (typeof window !== 'undefined' && window.navigator) {
|
|
@@ -1121,7 +1121,8 @@ function Sortable(el, options) {
|
|
|
1121
1121
|
x: 0,
|
|
1122
1122
|
y: 0
|
|
1123
1123
|
},
|
|
1124
|
-
|
|
1124
|
+
// Disabled on Safari: #1571; Enabled on Safari IOS: #2244
|
|
1125
|
+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
|
|
1125
1126
|
emptyInsertThreshold: 5
|
|
1126
1127
|
};
|
|
1127
1128
|
PluginManager.initializePlugins(this, el, defaults);
|
|
@@ -1232,7 +1233,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1232
1233
|
pluginEvent('filter', _this, {
|
|
1233
1234
|
evt: evt
|
|
1234
1235
|
});
|
|
1235
|
-
preventOnFilter && evt.
|
|
1236
|
+
preventOnFilter && evt.preventDefault();
|
|
1236
1237
|
return; // cancel dnd
|
|
1237
1238
|
}
|
|
1238
1239
|
} else if (filter) {
|
|
@@ -1254,7 +1255,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1254
1255
|
}
|
|
1255
1256
|
});
|
|
1256
1257
|
if (filter) {
|
|
1257
|
-
preventOnFilter && evt.
|
|
1258
|
+
preventOnFilter && evt.preventDefault();
|
|
1258
1259
|
return; // cancel dnd
|
|
1259
1260
|
}
|
|
1260
1261
|
}
|
|
@@ -1326,9 +1327,15 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1326
1327
|
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
|
|
1327
1328
|
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
|
|
1328
1329
|
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1330
|
+
if (options.supportPointer) {
|
|
1331
|
+
on(ownerDocument, 'pointerup', _this._onDrop);
|
|
1332
|
+
// Native D&D triggers pointercancel
|
|
1333
|
+
!this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);
|
|
1334
|
+
} else {
|
|
1335
|
+
on(ownerDocument, 'mouseup', _this._onDrop);
|
|
1336
|
+
on(ownerDocument, 'touchend', _this._onDrop);
|
|
1337
|
+
on(ownerDocument, 'touchcancel', _this._onDrop);
|
|
1338
|
+
}
|
|
1332
1339
|
|
|
1333
1340
|
// Make dragEl draggable (must be before delay for FireFox)
|
|
1334
1341
|
if (FireFox && this.nativeDraggable) {
|
|
@@ -1348,9 +1355,14 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1348
1355
|
// If the user moves the pointer or let go the click or touch
|
|
1349
1356
|
// before the delay has been reached:
|
|
1350
1357
|
// disable the delayed drag
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1358
|
+
if (options.supportPointer) {
|
|
1359
|
+
on(ownerDocument, 'pointerup', _this._disableDelayedDrag);
|
|
1360
|
+
on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);
|
|
1361
|
+
} else {
|
|
1362
|
+
on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
|
1363
|
+
on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
|
1364
|
+
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
|
1365
|
+
}
|
|
1354
1366
|
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
|
|
1355
1367
|
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
|
|
1356
1368
|
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
|
|
@@ -1376,6 +1388,8 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1376
1388
|
off(ownerDocument, 'mouseup', this._disableDelayedDrag);
|
|
1377
1389
|
off(ownerDocument, 'touchend', this._disableDelayedDrag);
|
|
1378
1390
|
off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
|
|
1391
|
+
off(ownerDocument, 'pointerup', this._disableDelayedDrag);
|
|
1392
|
+
off(ownerDocument, 'pointercancel', this._disableDelayedDrag);
|
|
1379
1393
|
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
|
|
1380
1394
|
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
|
|
1381
1395
|
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
|
|
@@ -1396,7 +1410,6 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1396
1410
|
}
|
|
1397
1411
|
try {
|
|
1398
1412
|
if (document.selection) {
|
|
1399
|
-
// Timeout neccessary for IE9
|
|
1400
1413
|
_nextTick(function () {
|
|
1401
1414
|
document.selection.empty();
|
|
1402
1415
|
});
|
|
@@ -1461,7 +1474,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1461
1474
|
}
|
|
1462
1475
|
target = parent; // store last element
|
|
1463
1476
|
}
|
|
1464
|
-
/* jshint boss:true */ while (parent = parent
|
|
1477
|
+
/* jshint boss:true */ while (parent = getParentOrHost(parent));
|
|
1465
1478
|
}
|
|
1466
1479
|
_unhideGhostForTarget();
|
|
1467
1480
|
}
|
|
@@ -1618,6 +1631,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1618
1631
|
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
|
|
1619
1632
|
on(document, 'selectstart', _this);
|
|
1620
1633
|
moved = true;
|
|
1634
|
+
window.getSelection().removeAllRanges();
|
|
1621
1635
|
if (Safari) {
|
|
1622
1636
|
css(document.body, 'user-select', 'none');
|
|
1623
1637
|
}
|
|
@@ -1889,6 +1903,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1889
1903
|
off(ownerDocument, 'mouseup', this._onDrop);
|
|
1890
1904
|
off(ownerDocument, 'touchend', this._onDrop);
|
|
1891
1905
|
off(ownerDocument, 'pointerup', this._onDrop);
|
|
1906
|
+
off(ownerDocument, 'pointercancel', this._onDrop);
|
|
1892
1907
|
off(ownerDocument, 'touchcancel', this._onDrop);
|
|
1893
1908
|
off(document, 'selectstart', this);
|
|
1894
1909
|
},
|
|
@@ -2367,7 +2382,8 @@ Sortable.utils = {
|
|
|
2367
2382
|
nextTick: _nextTick,
|
|
2368
2383
|
cancelNextTick: _cancelNextTick,
|
|
2369
2384
|
detectDirection: _detectDirection,
|
|
2370
|
-
getChild: getChild
|
|
2385
|
+
getChild: getChild,
|
|
2386
|
+
expando: expando
|
|
2371
2387
|
};
|
|
2372
2388
|
|
|
2373
2389
|
/**
|
|
@@ -3079,28 +3095,38 @@ function MultiDragPlugin() {
|
|
|
3079
3095
|
var lastIndex = index(lastMultiDragSelect),
|
|
3080
3096
|
currentIndex = index(dragEl$1);
|
|
3081
3097
|
if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3098
|
+
(function () {
|
|
3099
|
+
// Must include lastMultiDragSelect (select it), in case modified selection from no selection
|
|
3100
|
+
// (but previous selection existed)
|
|
3101
|
+
var n, i;
|
|
3102
|
+
if (currentIndex > lastIndex) {
|
|
3103
|
+
i = lastIndex;
|
|
3104
|
+
n = currentIndex;
|
|
3105
|
+
} else {
|
|
3106
|
+
i = currentIndex;
|
|
3107
|
+
n = lastIndex + 1;
|
|
3108
|
+
}
|
|
3109
|
+
var filter = options.filter;
|
|
3110
|
+
for (; i < n; i++) {
|
|
3111
|
+
if (~multiDragElements.indexOf(children[i])) continue;
|
|
3112
|
+
// Check if element is draggable
|
|
3113
|
+
if (!closest(children[i], options.draggable, parentEl, false)) continue;
|
|
3114
|
+
// Check if element is filtered
|
|
3115
|
+
var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {
|
|
3116
|
+
return closest(children[i], criteria.trim(), parentEl, false);
|
|
3117
|
+
}));
|
|
3118
|
+
if (filtered) continue;
|
|
3119
|
+
toggleClass(children[i], options.selectedClass, true);
|
|
3120
|
+
multiDragElements.push(children[i]);
|
|
3121
|
+
dispatchEvent({
|
|
3122
|
+
sortable: sortable,
|
|
3123
|
+
rootEl: rootEl,
|
|
3124
|
+
name: 'select',
|
|
3125
|
+
targetEl: children[i],
|
|
3126
|
+
originalEvent: evt
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
})();
|
|
3104
3130
|
}
|
|
3105
3131
|
} else {
|
|
3106
3132
|
lastMultiDragSelect = dragEl$1;
|
package/modular/sortable.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Sortable 1.15.
|
|
2
|
+
* Sortable 1.15.6
|
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
|
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.
|
|
131
|
+
var version = "1.15.6";
|
|
132
132
|
|
|
133
133
|
function userAgent(pattern) {
|
|
134
134
|
if (typeof window !== 'undefined' && window.navigator) {
|
|
@@ -1121,7 +1121,8 @@ function Sortable(el, options) {
|
|
|
1121
1121
|
x: 0,
|
|
1122
1122
|
y: 0
|
|
1123
1123
|
},
|
|
1124
|
-
|
|
1124
|
+
// Disabled on Safari: #1571; Enabled on Safari IOS: #2244
|
|
1125
|
+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
|
|
1125
1126
|
emptyInsertThreshold: 5
|
|
1126
1127
|
};
|
|
1127
1128
|
PluginManager.initializePlugins(this, el, defaults);
|
|
@@ -1232,7 +1233,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1232
1233
|
pluginEvent('filter', _this, {
|
|
1233
1234
|
evt: evt
|
|
1234
1235
|
});
|
|
1235
|
-
preventOnFilter && evt.
|
|
1236
|
+
preventOnFilter && evt.preventDefault();
|
|
1236
1237
|
return; // cancel dnd
|
|
1237
1238
|
}
|
|
1238
1239
|
} else if (filter) {
|
|
@@ -1254,7 +1255,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1254
1255
|
}
|
|
1255
1256
|
});
|
|
1256
1257
|
if (filter) {
|
|
1257
|
-
preventOnFilter && evt.
|
|
1258
|
+
preventOnFilter && evt.preventDefault();
|
|
1258
1259
|
return; // cancel dnd
|
|
1259
1260
|
}
|
|
1260
1261
|
}
|
|
@@ -1326,9 +1327,15 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1326
1327
|
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
|
|
1327
1328
|
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
|
|
1328
1329
|
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1330
|
+
if (options.supportPointer) {
|
|
1331
|
+
on(ownerDocument, 'pointerup', _this._onDrop);
|
|
1332
|
+
// Native D&D triggers pointercancel
|
|
1333
|
+
!this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);
|
|
1334
|
+
} else {
|
|
1335
|
+
on(ownerDocument, 'mouseup', _this._onDrop);
|
|
1336
|
+
on(ownerDocument, 'touchend', _this._onDrop);
|
|
1337
|
+
on(ownerDocument, 'touchcancel', _this._onDrop);
|
|
1338
|
+
}
|
|
1332
1339
|
|
|
1333
1340
|
// Make dragEl draggable (must be before delay for FireFox)
|
|
1334
1341
|
if (FireFox && this.nativeDraggable) {
|
|
@@ -1348,9 +1355,14 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1348
1355
|
// If the user moves the pointer or let go the click or touch
|
|
1349
1356
|
// before the delay has been reached:
|
|
1350
1357
|
// disable the delayed drag
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1358
|
+
if (options.supportPointer) {
|
|
1359
|
+
on(ownerDocument, 'pointerup', _this._disableDelayedDrag);
|
|
1360
|
+
on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);
|
|
1361
|
+
} else {
|
|
1362
|
+
on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
|
1363
|
+
on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
|
1364
|
+
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
|
1365
|
+
}
|
|
1354
1366
|
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
|
|
1355
1367
|
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
|
|
1356
1368
|
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
|
|
@@ -1376,6 +1388,8 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1376
1388
|
off(ownerDocument, 'mouseup', this._disableDelayedDrag);
|
|
1377
1389
|
off(ownerDocument, 'touchend', this._disableDelayedDrag);
|
|
1378
1390
|
off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
|
|
1391
|
+
off(ownerDocument, 'pointerup', this._disableDelayedDrag);
|
|
1392
|
+
off(ownerDocument, 'pointercancel', this._disableDelayedDrag);
|
|
1379
1393
|
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
|
|
1380
1394
|
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
|
|
1381
1395
|
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
|
|
@@ -1396,7 +1410,6 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1396
1410
|
}
|
|
1397
1411
|
try {
|
|
1398
1412
|
if (document.selection) {
|
|
1399
|
-
// Timeout neccessary for IE9
|
|
1400
1413
|
_nextTick(function () {
|
|
1401
1414
|
document.selection.empty();
|
|
1402
1415
|
});
|
|
@@ -1461,7 +1474,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1461
1474
|
}
|
|
1462
1475
|
target = parent; // store last element
|
|
1463
1476
|
}
|
|
1464
|
-
/* jshint boss:true */ while (parent = parent
|
|
1477
|
+
/* jshint boss:true */ while (parent = getParentOrHost(parent));
|
|
1465
1478
|
}
|
|
1466
1479
|
_unhideGhostForTarget();
|
|
1467
1480
|
}
|
|
@@ -1618,6 +1631,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1618
1631
|
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
|
|
1619
1632
|
on(document, 'selectstart', _this);
|
|
1620
1633
|
moved = true;
|
|
1634
|
+
window.getSelection().removeAllRanges();
|
|
1621
1635
|
if (Safari) {
|
|
1622
1636
|
css(document.body, 'user-select', 'none');
|
|
1623
1637
|
}
|
|
@@ -1889,6 +1903,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
|
|
|
1889
1903
|
off(ownerDocument, 'mouseup', this._onDrop);
|
|
1890
1904
|
off(ownerDocument, 'touchend', this._onDrop);
|
|
1891
1905
|
off(ownerDocument, 'pointerup', this._onDrop);
|
|
1906
|
+
off(ownerDocument, 'pointercancel', this._onDrop);
|
|
1892
1907
|
off(ownerDocument, 'touchcancel', this._onDrop);
|
|
1893
1908
|
off(document, 'selectstart', this);
|
|
1894
1909
|
},
|
|
@@ -2367,7 +2382,8 @@ Sortable.utils = {
|
|
|
2367
2382
|
nextTick: _nextTick,
|
|
2368
2383
|
cancelNextTick: _cancelNextTick,
|
|
2369
2384
|
detectDirection: _detectDirection,
|
|
2370
|
-
getChild: getChild
|
|
2385
|
+
getChild: getChild,
|
|
2386
|
+
expando: expando
|
|
2371
2387
|
};
|
|
2372
2388
|
|
|
2373
2389
|
/**
|
|
@@ -3078,28 +3094,38 @@ function MultiDragPlugin() {
|
|
|
3078
3094
|
var lastIndex = index(lastMultiDragSelect),
|
|
3079
3095
|
currentIndex = index(dragEl$1);
|
|
3080
3096
|
if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3097
|
+
(function () {
|
|
3098
|
+
// Must include lastMultiDragSelect (select it), in case modified selection from no selection
|
|
3099
|
+
// (but previous selection existed)
|
|
3100
|
+
var n, i;
|
|
3101
|
+
if (currentIndex > lastIndex) {
|
|
3102
|
+
i = lastIndex;
|
|
3103
|
+
n = currentIndex;
|
|
3104
|
+
} else {
|
|
3105
|
+
i = currentIndex;
|
|
3106
|
+
n = lastIndex + 1;
|
|
3107
|
+
}
|
|
3108
|
+
var filter = options.filter;
|
|
3109
|
+
for (; i < n; i++) {
|
|
3110
|
+
if (~multiDragElements.indexOf(children[i])) continue;
|
|
3111
|
+
// Check if element is draggable
|
|
3112
|
+
if (!closest(children[i], options.draggable, parentEl, false)) continue;
|
|
3113
|
+
// Check if element is filtered
|
|
3114
|
+
var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {
|
|
3115
|
+
return closest(children[i], criteria.trim(), parentEl, false);
|
|
3116
|
+
}));
|
|
3117
|
+
if (filtered) continue;
|
|
3118
|
+
toggleClass(children[i], options.selectedClass, true);
|
|
3119
|
+
multiDragElements.push(children[i]);
|
|
3120
|
+
dispatchEvent({
|
|
3121
|
+
sortable: sortable,
|
|
3122
|
+
rootEl: rootEl,
|
|
3123
|
+
name: 'select',
|
|
3124
|
+
targetEl: children[i],
|
|
3125
|
+
originalEvent: evt
|
|
3126
|
+
});
|
|
3127
|
+
}
|
|
3128
|
+
})();
|
|
3103
3129
|
}
|
|
3104
3130
|
} else {
|
|
3105
3131
|
lastMultiDragSelect = dragEl$1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sortablejs",
|
|
3
3
|
"exportName": "Sortable",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.6",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/core": "^7.4.4",
|
|
7
7
|
"@babel/plugin-transform-object-assign": "^7.2.0",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"files": [
|
|
40
40
|
"Sortable.js",
|
|
41
41
|
"Sortable.min.js",
|
|
42
|
-
"modular/"
|
|
42
|
+
"modular/",
|
|
43
|
+
"src/"
|
|
43
44
|
],
|
|
44
45
|
"keywords": [
|
|
45
46
|
"sortable",
|