sortablejs 1.14.0 → 1.15.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.
- package/Sortable.js +84 -73
- package/Sortable.min.js +2 -2
- package/modular/sortable.complete.esm.js +84 -73
- package/modular/sortable.core.esm.js +84 -73
- package/modular/sortable.esm.js +84 -73
- package/package.json +56 -56
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Sortable 1.
|
|
2
|
+
* Sortable 1.15.0
|
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
|
5
5
|
* @license MIT
|
|
@@ -160,7 +160,7 @@ function _nonIterableSpread() {
|
|
|
160
160
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
var version = "1.
|
|
163
|
+
var version = "1.15.0";
|
|
164
164
|
|
|
165
165
|
function userAgent(pattern) {
|
|
166
166
|
if (typeof window !== 'undefined' && window.navigator) {
|
|
@@ -1097,11 +1097,11 @@ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in
|
|
|
1097
1097
|
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
|
|
1098
1098
|
},
|
|
1099
1099
|
|
|
1100
|
-
/**
|
|
1101
|
-
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
|
1102
|
-
* @param {Number} x X position
|
|
1103
|
-
* @param {Number} y Y position
|
|
1104
|
-
* @return {HTMLElement} Element of the first found nearest Sortable
|
|
1100
|
+
/**
|
|
1101
|
+
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
|
1102
|
+
* @param {Number} x X position
|
|
1103
|
+
* @param {Number} y Y position
|
|
1104
|
+
* @return {HTMLElement} Element of the first found nearest Sortable
|
|
1105
1105
|
*/
|
|
1106
1106
|
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
|
1107
1107
|
var ret;
|
|
@@ -1167,7 +1167,7 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
|
|
1167
1167
|
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
|
|
1168
1168
|
|
|
1169
1169
|
|
|
1170
|
-
if (documentExists) {
|
|
1170
|
+
if (documentExists && !ChromeForAndroid) {
|
|
1171
1171
|
document.addEventListener('click', function (evt) {
|
|
1172
1172
|
if (ignoreNextClick) {
|
|
1173
1173
|
evt.preventDefault();
|
|
@@ -1209,10 +1209,10 @@ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
|
|
|
1209
1209
|
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
|
1210
1210
|
}
|
|
1211
1211
|
};
|
|
1212
|
-
/**
|
|
1213
|
-
* @class Sortable
|
|
1214
|
-
* @param {HTMLElement} el
|
|
1215
|
-
* @param {Object} [options]
|
|
1212
|
+
/**
|
|
1213
|
+
* @class Sortable
|
|
1214
|
+
* @param {HTMLElement} el
|
|
1215
|
+
* @param {Object} [options]
|
|
1216
1216
|
*/
|
|
1217
1217
|
|
|
1218
1218
|
|
|
@@ -1786,6 +1786,7 @@ Sortable.prototype =
|
|
|
1786
1786
|
|
|
1787
1787
|
if (!Sortable.eventCanceled) {
|
|
1788
1788
|
cloneEl = clone(dragEl);
|
|
1789
|
+
cloneEl.removeAttribute("id");
|
|
1789
1790
|
cloneEl.draggable = false;
|
|
1790
1791
|
cloneEl.style['will-change'] = '';
|
|
1791
1792
|
|
|
@@ -2027,7 +2028,14 @@ Sortable.prototype =
|
|
|
2027
2028
|
|
|
2028
2029
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
|
|
2029
2030
|
capture();
|
|
2030
|
-
|
|
2031
|
+
|
|
2032
|
+
if (elLastChild && elLastChild.nextSibling) {
|
|
2033
|
+
// the last draggable element is not the last node
|
|
2034
|
+
el.insertBefore(dragEl, elLastChild.nextSibling);
|
|
2035
|
+
} else {
|
|
2036
|
+
el.appendChild(dragEl);
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2031
2039
|
parentEl = el; // actualization
|
|
2032
2040
|
|
|
2033
2041
|
changed();
|
|
@@ -2350,9 +2358,9 @@ Sortable.prototype =
|
|
|
2350
2358
|
}
|
|
2351
2359
|
},
|
|
2352
2360
|
|
|
2353
|
-
/**
|
|
2354
|
-
* Serializes the item into an array of string.
|
|
2355
|
-
* @returns {String[]}
|
|
2361
|
+
/**
|
|
2362
|
+
* Serializes the item into an array of string.
|
|
2363
|
+
* @returns {String[]}
|
|
2356
2364
|
*/
|
|
2357
2365
|
toArray: function toArray() {
|
|
2358
2366
|
var order = [],
|
|
@@ -2373,9 +2381,9 @@ Sortable.prototype =
|
|
|
2373
2381
|
return order;
|
|
2374
2382
|
},
|
|
2375
2383
|
|
|
2376
|
-
/**
|
|
2377
|
-
* Sorts the elements according to the array.
|
|
2378
|
-
* @param {String[]} order order of the items
|
|
2384
|
+
/**
|
|
2385
|
+
* Sorts the elements according to the array.
|
|
2386
|
+
* @param {String[]} order order of the items
|
|
2379
2387
|
*/
|
|
2380
2388
|
sort: function sort(order, useAnimation) {
|
|
2381
2389
|
var items = {},
|
|
@@ -2397,29 +2405,29 @@ Sortable.prototype =
|
|
|
2397
2405
|
useAnimation && this.animateAll();
|
|
2398
2406
|
},
|
|
2399
2407
|
|
|
2400
|
-
/**
|
|
2401
|
-
* Save the current sorting
|
|
2408
|
+
/**
|
|
2409
|
+
* Save the current sorting
|
|
2402
2410
|
*/
|
|
2403
2411
|
save: function save() {
|
|
2404
2412
|
var store = this.options.store;
|
|
2405
2413
|
store && store.set && store.set(this);
|
|
2406
2414
|
},
|
|
2407
2415
|
|
|
2408
|
-
/**
|
|
2409
|
-
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
|
2410
|
-
* @param {HTMLElement} el
|
|
2411
|
-
* @param {String} [selector] default: `options.draggable`
|
|
2412
|
-
* @returns {HTMLElement|null}
|
|
2416
|
+
/**
|
|
2417
|
+
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
|
2418
|
+
* @param {HTMLElement} el
|
|
2419
|
+
* @param {String} [selector] default: `options.draggable`
|
|
2420
|
+
* @returns {HTMLElement|null}
|
|
2413
2421
|
*/
|
|
2414
2422
|
closest: function closest$1(el, selector) {
|
|
2415
2423
|
return closest(el, selector || this.options.draggable, this.el, false);
|
|
2416
2424
|
},
|
|
2417
2425
|
|
|
2418
|
-
/**
|
|
2419
|
-
* Set/get option
|
|
2420
|
-
* @param {string} name
|
|
2421
|
-
* @param {*} [value]
|
|
2422
|
-
* @returns {*}
|
|
2426
|
+
/**
|
|
2427
|
+
* Set/get option
|
|
2428
|
+
* @param {string} name
|
|
2429
|
+
* @param {*} [value]
|
|
2430
|
+
* @returns {*}
|
|
2423
2431
|
*/
|
|
2424
2432
|
option: function option(name, value) {
|
|
2425
2433
|
var options = this.options;
|
|
@@ -2441,8 +2449,8 @@ Sortable.prototype =
|
|
|
2441
2449
|
}
|
|
2442
2450
|
},
|
|
2443
2451
|
|
|
2444
|
-
/**
|
|
2445
|
-
* Destroy
|
|
2452
|
+
/**
|
|
2453
|
+
* Destroy
|
|
2446
2454
|
*/
|
|
2447
2455
|
destroy: function destroy() {
|
|
2448
2456
|
pluginEvent('destroy', this);
|
|
@@ -2619,11 +2627,11 @@ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, inv
|
|
|
2619
2627
|
|
|
2620
2628
|
return 0;
|
|
2621
2629
|
}
|
|
2622
|
-
/**
|
|
2623
|
-
* Gets the direction dragEl must be swapped relative to target in order to make it
|
|
2624
|
-
* seem that dragEl has been "inserted" into that element's position
|
|
2625
|
-
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
|
2626
|
-
* @return {Number} Direction dragEl must be swapped
|
|
2630
|
+
/**
|
|
2631
|
+
* Gets the direction dragEl must be swapped relative to target in order to make it
|
|
2632
|
+
* seem that dragEl has been "inserted" into that element's position
|
|
2633
|
+
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
|
2634
|
+
* @return {Number} Direction dragEl must be swapped
|
|
2627
2635
|
*/
|
|
2628
2636
|
|
|
2629
2637
|
|
|
@@ -2634,11 +2642,11 @@ function _getInsertDirection(target) {
|
|
|
2634
2642
|
return -1;
|
|
2635
2643
|
}
|
|
2636
2644
|
}
|
|
2637
|
-
/**
|
|
2638
|
-
* Generate id
|
|
2639
|
-
* @param {HTMLElement} el
|
|
2640
|
-
* @returns {String}
|
|
2641
|
-
* @private
|
|
2645
|
+
/**
|
|
2646
|
+
* Generate id
|
|
2647
|
+
* @param {HTMLElement} el
|
|
2648
|
+
* @returns {String}
|
|
2649
|
+
* @private
|
|
2642
2650
|
*/
|
|
2643
2651
|
|
|
2644
2652
|
|
|
@@ -2702,18 +2710,18 @@ Sortable.utils = {
|
|
|
2702
2710
|
detectDirection: _detectDirection,
|
|
2703
2711
|
getChild: getChild
|
|
2704
2712
|
};
|
|
2705
|
-
/**
|
|
2706
|
-
* Get the Sortable instance of an element
|
|
2707
|
-
* @param {HTMLElement} element The element
|
|
2708
|
-
* @return {Sortable|undefined} The instance of Sortable
|
|
2713
|
+
/**
|
|
2714
|
+
* Get the Sortable instance of an element
|
|
2715
|
+
* @param {HTMLElement} element The element
|
|
2716
|
+
* @return {Sortable|undefined} The instance of Sortable
|
|
2709
2717
|
*/
|
|
2710
2718
|
|
|
2711
2719
|
Sortable.get = function (element) {
|
|
2712
2720
|
return element[expando];
|
|
2713
2721
|
};
|
|
2714
|
-
/**
|
|
2715
|
-
* Mount a plugin to Sortable
|
|
2716
|
-
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
|
2722
|
+
/**
|
|
2723
|
+
* Mount a plugin to Sortable
|
|
2724
|
+
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
|
2717
2725
|
*/
|
|
2718
2726
|
|
|
2719
2727
|
|
|
@@ -2732,10 +2740,10 @@ Sortable.mount = function () {
|
|
|
2732
2740
|
PluginManager.mount(plugin);
|
|
2733
2741
|
});
|
|
2734
2742
|
};
|
|
2735
|
-
/**
|
|
2736
|
-
* Create sortable instance
|
|
2737
|
-
* @param {HTMLElement} el
|
|
2738
|
-
* @param {Object} [options]
|
|
2743
|
+
/**
|
|
2744
|
+
* Create sortable instance
|
|
2745
|
+
* @param {HTMLElement} el
|
|
2746
|
+
* @param {Object} [options]
|
|
2739
2747
|
*/
|
|
2740
2748
|
|
|
2741
2749
|
|
|
@@ -3172,11 +3180,13 @@ function MultiDragPlugin() {
|
|
|
3172
3180
|
}
|
|
3173
3181
|
}
|
|
3174
3182
|
|
|
3175
|
-
if (sortable.options.
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3183
|
+
if (!sortable.options.avoidImplicitDeselect) {
|
|
3184
|
+
if (sortable.options.supportPointer) {
|
|
3185
|
+
on(document, 'pointerup', this._deselectMultiDrag);
|
|
3186
|
+
} else {
|
|
3187
|
+
on(document, 'mouseup', this._deselectMultiDrag);
|
|
3188
|
+
on(document, 'touchend', this._deselectMultiDrag);
|
|
3189
|
+
}
|
|
3180
3190
|
}
|
|
3181
3191
|
|
|
3182
3192
|
on(document, 'keydown', this._checkKeyDown);
|
|
@@ -3184,6 +3194,7 @@ function MultiDragPlugin() {
|
|
|
3184
3194
|
this.defaults = {
|
|
3185
3195
|
selectedClass: 'sortable-selected',
|
|
3186
3196
|
multiDragKey: null,
|
|
3197
|
+
avoidImplicitDeselect: false,
|
|
3187
3198
|
setData: function setData(dataTransfer, dragEl) {
|
|
3188
3199
|
var data = '';
|
|
3189
3200
|
|
|
@@ -3474,7 +3485,7 @@ function MultiDragPlugin() {
|
|
|
3474
3485
|
rootEl: rootEl,
|
|
3475
3486
|
name: 'select',
|
|
3476
3487
|
targetEl: dragEl$1,
|
|
3477
|
-
|
|
3488
|
+
originalEvent: evt
|
|
3478
3489
|
}); // Modifier activated, select from last to dragEl
|
|
3479
3490
|
|
|
3480
3491
|
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
|
|
@@ -3503,7 +3514,7 @@ function MultiDragPlugin() {
|
|
|
3503
3514
|
rootEl: rootEl,
|
|
3504
3515
|
name: 'select',
|
|
3505
3516
|
targetEl: children[i],
|
|
3506
|
-
|
|
3517
|
+
originalEvent: evt
|
|
3507
3518
|
});
|
|
3508
3519
|
}
|
|
3509
3520
|
}
|
|
@@ -3520,7 +3531,7 @@ function MultiDragPlugin() {
|
|
|
3520
3531
|
rootEl: rootEl,
|
|
3521
3532
|
name: 'deselect',
|
|
3522
3533
|
targetEl: dragEl$1,
|
|
3523
|
-
|
|
3534
|
+
originalEvent: evt
|
|
3524
3535
|
});
|
|
3525
3536
|
}
|
|
3526
3537
|
} // Multi-drag drop
|
|
@@ -3631,7 +3642,7 @@ function MultiDragPlugin() {
|
|
|
3631
3642
|
rootEl: this.sortable.el,
|
|
3632
3643
|
name: 'deselect',
|
|
3633
3644
|
targetEl: el,
|
|
3634
|
-
|
|
3645
|
+
originalEvent: evt
|
|
3635
3646
|
});
|
|
3636
3647
|
}
|
|
3637
3648
|
},
|
|
@@ -3650,9 +3661,9 @@ function MultiDragPlugin() {
|
|
|
3650
3661
|
// Static methods & properties
|
|
3651
3662
|
pluginName: 'multiDrag',
|
|
3652
3663
|
utils: {
|
|
3653
|
-
/**
|
|
3654
|
-
* Selects the provided multi-drag item
|
|
3655
|
-
* @param {HTMLElement} el The element to be selected
|
|
3664
|
+
/**
|
|
3665
|
+
* Selects the provided multi-drag item
|
|
3666
|
+
* @param {HTMLElement} el The element to be selected
|
|
3656
3667
|
*/
|
|
3657
3668
|
select: function select(el) {
|
|
3658
3669
|
var sortable = el.parentNode[expando];
|
|
@@ -3668,9 +3679,9 @@ function MultiDragPlugin() {
|
|
|
3668
3679
|
multiDragElements.push(el);
|
|
3669
3680
|
},
|
|
3670
3681
|
|
|
3671
|
-
/**
|
|
3672
|
-
* Deselects the provided multi-drag item
|
|
3673
|
-
* @param {HTMLElement} el The element to be deselected
|
|
3682
|
+
/**
|
|
3683
|
+
* Deselects the provided multi-drag item
|
|
3684
|
+
* @param {HTMLElement} el The element to be deselected
|
|
3674
3685
|
*/
|
|
3675
3686
|
deselect: function deselect(el) {
|
|
3676
3687
|
var sortable = el.parentNode[expando],
|
|
@@ -3740,10 +3751,10 @@ function insertMultiDragElements(clonesInserted, rootEl) {
|
|
|
3740
3751
|
}
|
|
3741
3752
|
});
|
|
3742
3753
|
}
|
|
3743
|
-
/**
|
|
3744
|
-
* Insert multi-drag clones
|
|
3745
|
-
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3746
|
-
* @param {HTMLElement} rootEl
|
|
3754
|
+
/**
|
|
3755
|
+
* Insert multi-drag clones
|
|
3756
|
+
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3757
|
+
* @param {HTMLElement} rootEl
|
|
3747
3758
|
*/
|
|
3748
3759
|
|
|
3749
3760
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Sortable 1.
|
|
2
|
+
* Sortable 1.15.0
|
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
|
5
5
|
* @license MIT
|
|
@@ -160,7 +160,7 @@ function _nonIterableSpread() {
|
|
|
160
160
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
var version = "1.
|
|
163
|
+
var version = "1.15.0";
|
|
164
164
|
|
|
165
165
|
function userAgent(pattern) {
|
|
166
166
|
if (typeof window !== 'undefined' && window.navigator) {
|
|
@@ -1097,11 +1097,11 @@ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in
|
|
|
1097
1097
|
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
|
|
1098
1098
|
},
|
|
1099
1099
|
|
|
1100
|
-
/**
|
|
1101
|
-
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
|
1102
|
-
* @param {Number} x X position
|
|
1103
|
-
* @param {Number} y Y position
|
|
1104
|
-
* @return {HTMLElement} Element of the first found nearest Sortable
|
|
1100
|
+
/**
|
|
1101
|
+
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
|
1102
|
+
* @param {Number} x X position
|
|
1103
|
+
* @param {Number} y Y position
|
|
1104
|
+
* @return {HTMLElement} Element of the first found nearest Sortable
|
|
1105
1105
|
*/
|
|
1106
1106
|
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
|
1107
1107
|
var ret;
|
|
@@ -1167,7 +1167,7 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
|
|
1167
1167
|
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
|
|
1168
1168
|
|
|
1169
1169
|
|
|
1170
|
-
if (documentExists) {
|
|
1170
|
+
if (documentExists && !ChromeForAndroid) {
|
|
1171
1171
|
document.addEventListener('click', function (evt) {
|
|
1172
1172
|
if (ignoreNextClick) {
|
|
1173
1173
|
evt.preventDefault();
|
|
@@ -1209,10 +1209,10 @@ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
|
|
|
1209
1209
|
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
|
1210
1210
|
}
|
|
1211
1211
|
};
|
|
1212
|
-
/**
|
|
1213
|
-
* @class Sortable
|
|
1214
|
-
* @param {HTMLElement} el
|
|
1215
|
-
* @param {Object} [options]
|
|
1212
|
+
/**
|
|
1213
|
+
* @class Sortable
|
|
1214
|
+
* @param {HTMLElement} el
|
|
1215
|
+
* @param {Object} [options]
|
|
1216
1216
|
*/
|
|
1217
1217
|
|
|
1218
1218
|
|
|
@@ -1786,6 +1786,7 @@ Sortable.prototype =
|
|
|
1786
1786
|
|
|
1787
1787
|
if (!Sortable.eventCanceled) {
|
|
1788
1788
|
cloneEl = clone(dragEl);
|
|
1789
|
+
cloneEl.removeAttribute("id");
|
|
1789
1790
|
cloneEl.draggable = false;
|
|
1790
1791
|
cloneEl.style['will-change'] = '';
|
|
1791
1792
|
|
|
@@ -2027,7 +2028,14 @@ Sortable.prototype =
|
|
|
2027
2028
|
|
|
2028
2029
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
|
|
2029
2030
|
capture();
|
|
2030
|
-
|
|
2031
|
+
|
|
2032
|
+
if (elLastChild && elLastChild.nextSibling) {
|
|
2033
|
+
// the last draggable element is not the last node
|
|
2034
|
+
el.insertBefore(dragEl, elLastChild.nextSibling);
|
|
2035
|
+
} else {
|
|
2036
|
+
el.appendChild(dragEl);
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2031
2039
|
parentEl = el; // actualization
|
|
2032
2040
|
|
|
2033
2041
|
changed();
|
|
@@ -2350,9 +2358,9 @@ Sortable.prototype =
|
|
|
2350
2358
|
}
|
|
2351
2359
|
},
|
|
2352
2360
|
|
|
2353
|
-
/**
|
|
2354
|
-
* Serializes the item into an array of string.
|
|
2355
|
-
* @returns {String[]}
|
|
2361
|
+
/**
|
|
2362
|
+
* Serializes the item into an array of string.
|
|
2363
|
+
* @returns {String[]}
|
|
2356
2364
|
*/
|
|
2357
2365
|
toArray: function toArray() {
|
|
2358
2366
|
var order = [],
|
|
@@ -2373,9 +2381,9 @@ Sortable.prototype =
|
|
|
2373
2381
|
return order;
|
|
2374
2382
|
},
|
|
2375
2383
|
|
|
2376
|
-
/**
|
|
2377
|
-
* Sorts the elements according to the array.
|
|
2378
|
-
* @param {String[]} order order of the items
|
|
2384
|
+
/**
|
|
2385
|
+
* Sorts the elements according to the array.
|
|
2386
|
+
* @param {String[]} order order of the items
|
|
2379
2387
|
*/
|
|
2380
2388
|
sort: function sort(order, useAnimation) {
|
|
2381
2389
|
var items = {},
|
|
@@ -2397,29 +2405,29 @@ Sortable.prototype =
|
|
|
2397
2405
|
useAnimation && this.animateAll();
|
|
2398
2406
|
},
|
|
2399
2407
|
|
|
2400
|
-
/**
|
|
2401
|
-
* Save the current sorting
|
|
2408
|
+
/**
|
|
2409
|
+
* Save the current sorting
|
|
2402
2410
|
*/
|
|
2403
2411
|
save: function save() {
|
|
2404
2412
|
var store = this.options.store;
|
|
2405
2413
|
store && store.set && store.set(this);
|
|
2406
2414
|
},
|
|
2407
2415
|
|
|
2408
|
-
/**
|
|
2409
|
-
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
|
2410
|
-
* @param {HTMLElement} el
|
|
2411
|
-
* @param {String} [selector] default: `options.draggable`
|
|
2412
|
-
* @returns {HTMLElement|null}
|
|
2416
|
+
/**
|
|
2417
|
+
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
|
2418
|
+
* @param {HTMLElement} el
|
|
2419
|
+
* @param {String} [selector] default: `options.draggable`
|
|
2420
|
+
* @returns {HTMLElement|null}
|
|
2413
2421
|
*/
|
|
2414
2422
|
closest: function closest$1(el, selector) {
|
|
2415
2423
|
return closest(el, selector || this.options.draggable, this.el, false);
|
|
2416
2424
|
},
|
|
2417
2425
|
|
|
2418
|
-
/**
|
|
2419
|
-
* Set/get option
|
|
2420
|
-
* @param {string} name
|
|
2421
|
-
* @param {*} [value]
|
|
2422
|
-
* @returns {*}
|
|
2426
|
+
/**
|
|
2427
|
+
* Set/get option
|
|
2428
|
+
* @param {string} name
|
|
2429
|
+
* @param {*} [value]
|
|
2430
|
+
* @returns {*}
|
|
2423
2431
|
*/
|
|
2424
2432
|
option: function option(name, value) {
|
|
2425
2433
|
var options = this.options;
|
|
@@ -2441,8 +2449,8 @@ Sortable.prototype =
|
|
|
2441
2449
|
}
|
|
2442
2450
|
},
|
|
2443
2451
|
|
|
2444
|
-
/**
|
|
2445
|
-
* Destroy
|
|
2452
|
+
/**
|
|
2453
|
+
* Destroy
|
|
2446
2454
|
*/
|
|
2447
2455
|
destroy: function destroy() {
|
|
2448
2456
|
pluginEvent('destroy', this);
|
|
@@ -2619,11 +2627,11 @@ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, inv
|
|
|
2619
2627
|
|
|
2620
2628
|
return 0;
|
|
2621
2629
|
}
|
|
2622
|
-
/**
|
|
2623
|
-
* Gets the direction dragEl must be swapped relative to target in order to make it
|
|
2624
|
-
* seem that dragEl has been "inserted" into that element's position
|
|
2625
|
-
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
|
2626
|
-
* @return {Number} Direction dragEl must be swapped
|
|
2630
|
+
/**
|
|
2631
|
+
* Gets the direction dragEl must be swapped relative to target in order to make it
|
|
2632
|
+
* seem that dragEl has been "inserted" into that element's position
|
|
2633
|
+
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
|
2634
|
+
* @return {Number} Direction dragEl must be swapped
|
|
2627
2635
|
*/
|
|
2628
2636
|
|
|
2629
2637
|
|
|
@@ -2634,11 +2642,11 @@ function _getInsertDirection(target) {
|
|
|
2634
2642
|
return -1;
|
|
2635
2643
|
}
|
|
2636
2644
|
}
|
|
2637
|
-
/**
|
|
2638
|
-
* Generate id
|
|
2639
|
-
* @param {HTMLElement} el
|
|
2640
|
-
* @returns {String}
|
|
2641
|
-
* @private
|
|
2645
|
+
/**
|
|
2646
|
+
* Generate id
|
|
2647
|
+
* @param {HTMLElement} el
|
|
2648
|
+
* @returns {String}
|
|
2649
|
+
* @private
|
|
2642
2650
|
*/
|
|
2643
2651
|
|
|
2644
2652
|
|
|
@@ -2702,18 +2710,18 @@ Sortable.utils = {
|
|
|
2702
2710
|
detectDirection: _detectDirection,
|
|
2703
2711
|
getChild: getChild
|
|
2704
2712
|
};
|
|
2705
|
-
/**
|
|
2706
|
-
* Get the Sortable instance of an element
|
|
2707
|
-
* @param {HTMLElement} element The element
|
|
2708
|
-
* @return {Sortable|undefined} The instance of Sortable
|
|
2713
|
+
/**
|
|
2714
|
+
* Get the Sortable instance of an element
|
|
2715
|
+
* @param {HTMLElement} element The element
|
|
2716
|
+
* @return {Sortable|undefined} The instance of Sortable
|
|
2709
2717
|
*/
|
|
2710
2718
|
|
|
2711
2719
|
Sortable.get = function (element) {
|
|
2712
2720
|
return element[expando];
|
|
2713
2721
|
};
|
|
2714
|
-
/**
|
|
2715
|
-
* Mount a plugin to Sortable
|
|
2716
|
-
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
|
2722
|
+
/**
|
|
2723
|
+
* Mount a plugin to Sortable
|
|
2724
|
+
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
|
2717
2725
|
*/
|
|
2718
2726
|
|
|
2719
2727
|
|
|
@@ -2732,10 +2740,10 @@ Sortable.mount = function () {
|
|
|
2732
2740
|
PluginManager.mount(plugin);
|
|
2733
2741
|
});
|
|
2734
2742
|
};
|
|
2735
|
-
/**
|
|
2736
|
-
* Create sortable instance
|
|
2737
|
-
* @param {HTMLElement} el
|
|
2738
|
-
* @param {Object} [options]
|
|
2743
|
+
/**
|
|
2744
|
+
* Create sortable instance
|
|
2745
|
+
* @param {HTMLElement} el
|
|
2746
|
+
* @param {Object} [options]
|
|
2739
2747
|
*/
|
|
2740
2748
|
|
|
2741
2749
|
|
|
@@ -3174,11 +3182,13 @@ function MultiDragPlugin() {
|
|
|
3174
3182
|
}
|
|
3175
3183
|
}
|
|
3176
3184
|
|
|
3177
|
-
if (sortable.options.
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3185
|
+
if (!sortable.options.avoidImplicitDeselect) {
|
|
3186
|
+
if (sortable.options.supportPointer) {
|
|
3187
|
+
on(document, 'pointerup', this._deselectMultiDrag);
|
|
3188
|
+
} else {
|
|
3189
|
+
on(document, 'mouseup', this._deselectMultiDrag);
|
|
3190
|
+
on(document, 'touchend', this._deselectMultiDrag);
|
|
3191
|
+
}
|
|
3182
3192
|
}
|
|
3183
3193
|
|
|
3184
3194
|
on(document, 'keydown', this._checkKeyDown);
|
|
@@ -3186,6 +3196,7 @@ function MultiDragPlugin() {
|
|
|
3186
3196
|
this.defaults = {
|
|
3187
3197
|
selectedClass: 'sortable-selected',
|
|
3188
3198
|
multiDragKey: null,
|
|
3199
|
+
avoidImplicitDeselect: false,
|
|
3189
3200
|
setData: function setData(dataTransfer, dragEl) {
|
|
3190
3201
|
var data = '';
|
|
3191
3202
|
|
|
@@ -3476,7 +3487,7 @@ function MultiDragPlugin() {
|
|
|
3476
3487
|
rootEl: rootEl,
|
|
3477
3488
|
name: 'select',
|
|
3478
3489
|
targetEl: dragEl$1,
|
|
3479
|
-
|
|
3490
|
+
originalEvent: evt
|
|
3480
3491
|
}); // Modifier activated, select from last to dragEl
|
|
3481
3492
|
|
|
3482
3493
|
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
|
|
@@ -3505,7 +3516,7 @@ function MultiDragPlugin() {
|
|
|
3505
3516
|
rootEl: rootEl,
|
|
3506
3517
|
name: 'select',
|
|
3507
3518
|
targetEl: children[i],
|
|
3508
|
-
|
|
3519
|
+
originalEvent: evt
|
|
3509
3520
|
});
|
|
3510
3521
|
}
|
|
3511
3522
|
}
|
|
@@ -3522,7 +3533,7 @@ function MultiDragPlugin() {
|
|
|
3522
3533
|
rootEl: rootEl,
|
|
3523
3534
|
name: 'deselect',
|
|
3524
3535
|
targetEl: dragEl$1,
|
|
3525
|
-
|
|
3536
|
+
originalEvent: evt
|
|
3526
3537
|
});
|
|
3527
3538
|
}
|
|
3528
3539
|
} // Multi-drag drop
|
|
@@ -3633,7 +3644,7 @@ function MultiDragPlugin() {
|
|
|
3633
3644
|
rootEl: this.sortable.el,
|
|
3634
3645
|
name: 'deselect',
|
|
3635
3646
|
targetEl: el,
|
|
3636
|
-
|
|
3647
|
+
originalEvent: evt
|
|
3637
3648
|
});
|
|
3638
3649
|
}
|
|
3639
3650
|
},
|
|
@@ -3652,9 +3663,9 @@ function MultiDragPlugin() {
|
|
|
3652
3663
|
// Static methods & properties
|
|
3653
3664
|
pluginName: 'multiDrag',
|
|
3654
3665
|
utils: {
|
|
3655
|
-
/**
|
|
3656
|
-
* Selects the provided multi-drag item
|
|
3657
|
-
* @param {HTMLElement} el The element to be selected
|
|
3666
|
+
/**
|
|
3667
|
+
* Selects the provided multi-drag item
|
|
3668
|
+
* @param {HTMLElement} el The element to be selected
|
|
3658
3669
|
*/
|
|
3659
3670
|
select: function select(el) {
|
|
3660
3671
|
var sortable = el.parentNode[expando];
|
|
@@ -3670,9 +3681,9 @@ function MultiDragPlugin() {
|
|
|
3670
3681
|
multiDragElements.push(el);
|
|
3671
3682
|
},
|
|
3672
3683
|
|
|
3673
|
-
/**
|
|
3674
|
-
* Deselects the provided multi-drag item
|
|
3675
|
-
* @param {HTMLElement} el The element to be deselected
|
|
3684
|
+
/**
|
|
3685
|
+
* Deselects the provided multi-drag item
|
|
3686
|
+
* @param {HTMLElement} el The element to be deselected
|
|
3676
3687
|
*/
|
|
3677
3688
|
deselect: function deselect(el) {
|
|
3678
3689
|
var sortable = el.parentNode[expando],
|
|
@@ -3742,10 +3753,10 @@ function insertMultiDragElements(clonesInserted, rootEl) {
|
|
|
3742
3753
|
}
|
|
3743
3754
|
});
|
|
3744
3755
|
}
|
|
3745
|
-
/**
|
|
3746
|
-
* Insert multi-drag clones
|
|
3747
|
-
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3748
|
-
* @param {HTMLElement} rootEl
|
|
3756
|
+
/**
|
|
3757
|
+
* Insert multi-drag clones
|
|
3758
|
+
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3759
|
+
* @param {HTMLElement} rootEl
|
|
3749
3760
|
*/
|
|
3750
3761
|
|
|
3751
3762
|
|