sortablejs 1.10.1 → 1.10.2
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 +813 -782
- package/Sortable.js +66 -60
- package/Sortable.min.js +2 -2
- package/modular/sortable.complete.esm.js +66 -60
- package/modular/sortable.core.esm.js +66 -60
- package/modular/sortable.esm.js +66 -60
- package/package.json +1 -1
package/modular/sortable.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Sortable 1.10.
|
|
2
|
+
* Sortable 1.10.2
|
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
|
5
5
|
* @license MIT
|
|
@@ -126,7 +126,7 @@ function _nonIterableSpread() {
|
|
|
126
126
|
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
var version = "1.10.
|
|
129
|
+
var version = "1.10.2";
|
|
130
130
|
|
|
131
131
|
function userAgent(pattern) {
|
|
132
132
|
if (typeof window !== 'undefined' && window.navigator) {
|
|
@@ -260,7 +260,7 @@ function matrix(el, selfOnly) {
|
|
|
260
260
|
} while (!selfOnly && (el = el.parentNode));
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix;
|
|
263
|
+
var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
|
264
264
|
/*jshint -W056 */
|
|
265
265
|
|
|
266
266
|
return matrixFn && new matrixFn(appliedTransforms);
|
|
@@ -285,20 +285,22 @@ function find(ctx, tagName, iterator) {
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
function getWindowScrollingElement() {
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
var scrollingElement = document.scrollingElement;
|
|
289
|
+
|
|
290
|
+
if (scrollingElement) {
|
|
291
|
+
return scrollingElement;
|
|
290
292
|
} else {
|
|
291
|
-
return document.
|
|
293
|
+
return document.documentElement;
|
|
292
294
|
}
|
|
293
295
|
}
|
|
294
|
-
/**
|
|
295
|
-
* Returns the "bounding client rect" of given element
|
|
296
|
-
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
|
297
|
-
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
|
298
|
-
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
|
299
|
-
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
|
300
|
-
* @param {[HTMLElement]} container The parent the element will be placed in
|
|
301
|
-
* @return {Object} The boundingClientRect of el, with specified adjustments
|
|
296
|
+
/**
|
|
297
|
+
* Returns the "bounding client rect" of given element
|
|
298
|
+
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
|
299
|
+
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
|
300
|
+
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
|
301
|
+
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
|
302
|
+
* @param {[HTMLElement]} container The parent the element will be placed in
|
|
303
|
+
* @return {Object} The boundingClientRect of el, with specified adjustments
|
|
302
304
|
*/
|
|
303
305
|
|
|
304
306
|
|
|
@@ -370,12 +372,12 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
|
|
|
370
372
|
height: height
|
|
371
373
|
};
|
|
372
374
|
}
|
|
373
|
-
/**
|
|
374
|
-
* Checks if a side of an element is scrolled past a side of its parents
|
|
375
|
-
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
|
376
|
-
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
|
377
|
-
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
|
378
|
-
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
|
375
|
+
/**
|
|
376
|
+
* Checks if a side of an element is scrolled past a side of its parents
|
|
377
|
+
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
|
378
|
+
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
|
379
|
+
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
|
380
|
+
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
|
379
381
|
*/
|
|
380
382
|
|
|
381
383
|
|
|
@@ -401,13 +403,13 @@ function isScrolledPast(el, elSide, parentSide) {
|
|
|
401
403
|
|
|
402
404
|
return false;
|
|
403
405
|
}
|
|
404
|
-
/**
|
|
405
|
-
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
|
406
|
-
* and non-draggable elements
|
|
407
|
-
* @param {HTMLElement} el The parent element
|
|
408
|
-
* @param {Number} childNum The index of the child
|
|
409
|
-
* @param {Object} options Parent Sortable's options
|
|
410
|
-
* @return {HTMLElement} The child at index childNum, or null if not found
|
|
406
|
+
/**
|
|
407
|
+
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
|
408
|
+
* and non-draggable elements
|
|
409
|
+
* @param {HTMLElement} el The parent element
|
|
410
|
+
* @param {Number} childNum The index of the child
|
|
411
|
+
* @param {Object} options Parent Sortable's options
|
|
412
|
+
* @return {HTMLElement} The child at index childNum, or null if not found
|
|
411
413
|
*/
|
|
412
414
|
|
|
413
415
|
|
|
@@ -430,11 +432,11 @@ function getChild(el, childNum, options) {
|
|
|
430
432
|
|
|
431
433
|
return null;
|
|
432
434
|
}
|
|
433
|
-
/**
|
|
434
|
-
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
|
435
|
-
* @param {HTMLElement} el Parent element
|
|
436
|
-
* @param {selector} selector Any other elements that should be ignored
|
|
437
|
-
* @return {HTMLElement} The last child, ignoring ghostEl
|
|
435
|
+
/**
|
|
436
|
+
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
|
437
|
+
* @param {HTMLElement} el Parent element
|
|
438
|
+
* @param {selector} selector Any other elements that should be ignored
|
|
439
|
+
* @return {HTMLElement} The last child, ignoring ghostEl
|
|
438
440
|
*/
|
|
439
441
|
|
|
440
442
|
|
|
@@ -447,12 +449,12 @@ function lastChild(el, selector) {
|
|
|
447
449
|
|
|
448
450
|
return last || null;
|
|
449
451
|
}
|
|
450
|
-
/**
|
|
451
|
-
* Returns the index of an element within its parent for a selected set of
|
|
452
|
-
* elements
|
|
453
|
-
* @param {HTMLElement} el
|
|
454
|
-
* @param {selector} selector
|
|
455
|
-
* @return {number}
|
|
452
|
+
/**
|
|
453
|
+
* Returns the index of an element within its parent for a selected set of
|
|
454
|
+
* elements
|
|
455
|
+
* @param {HTMLElement} el
|
|
456
|
+
* @param {selector} selector
|
|
457
|
+
* @return {number}
|
|
456
458
|
*/
|
|
457
459
|
|
|
458
460
|
|
|
@@ -473,11 +475,11 @@ function index(el, selector) {
|
|
|
473
475
|
|
|
474
476
|
return index;
|
|
475
477
|
}
|
|
476
|
-
/**
|
|
477
|
-
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
|
478
|
-
* The value is returned in real pixels.
|
|
479
|
-
* @param {HTMLElement} el
|
|
480
|
-
* @return {Array} Offsets in the format of [left, top]
|
|
478
|
+
/**
|
|
479
|
+
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
|
480
|
+
* The value is returned in real pixels.
|
|
481
|
+
* @param {HTMLElement} el
|
|
482
|
+
* @return {Array} Offsets in the format of [left, top]
|
|
481
483
|
*/
|
|
482
484
|
|
|
483
485
|
|
|
@@ -498,11 +500,11 @@ function getRelativeScrollOffset(el) {
|
|
|
498
500
|
|
|
499
501
|
return [offsetLeft, offsetTop];
|
|
500
502
|
}
|
|
501
|
-
/**
|
|
502
|
-
* Returns the index of the object within the given array
|
|
503
|
-
* @param {Array} arr Array that may or may not hold the object
|
|
504
|
-
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
|
505
|
-
* @return {Number} The index of the object in the array, or -1
|
|
503
|
+
/**
|
|
504
|
+
* Returns the index of the object within the given array
|
|
505
|
+
* @param {Array} arr Array that may or may not hold the object
|
|
506
|
+
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
|
507
|
+
* @return {Number} The index of the object in the array, or -1
|
|
506
508
|
*/
|
|
507
509
|
|
|
508
510
|
|
|
@@ -1625,7 +1627,7 @@ Sortable.prototype =
|
|
|
1625
1627
|
fallbackTolerance = options.fallbackTolerance,
|
|
1626
1628
|
fallbackOffset = options.fallbackOffset,
|
|
1627
1629
|
touch = evt.touches ? evt.touches[0] : evt,
|
|
1628
|
-
ghostMatrix = ghostEl && matrix(ghostEl),
|
|
1630
|
+
ghostMatrix = ghostEl && matrix(ghostEl, true),
|
|
1629
1631
|
scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
|
|
1630
1632
|
scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
|
|
1631
1633
|
relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
|
|
@@ -2130,6 +2132,8 @@ Sortable.prototype =
|
|
|
2130
2132
|
css(document.body, 'user-select', '');
|
|
2131
2133
|
}
|
|
2132
2134
|
|
|
2135
|
+
css(dragEl, 'transform', '');
|
|
2136
|
+
|
|
2133
2137
|
if (evt) {
|
|
2134
2138
|
if (moved) {
|
|
2135
2139
|
evt.cancelable && evt.preventDefault();
|
|
@@ -2394,6 +2398,8 @@ Sortable.prototype =
|
|
|
2394
2398
|
|
|
2395
2399
|
this._onDrop();
|
|
2396
2400
|
|
|
2401
|
+
this._disableDelayedDragEvents();
|
|
2402
|
+
|
|
2397
2403
|
sortables.splice(sortables.indexOf(this.el), 1);
|
|
2398
2404
|
this.el = el = null;
|
|
2399
2405
|
},
|
|
@@ -3534,7 +3540,7 @@ function MultiDragPlugin() {
|
|
|
3534
3540
|
off(document, 'keyup', this._checkKeyUp);
|
|
3535
3541
|
},
|
|
3536
3542
|
_deselectMultiDrag: function _deselectMultiDrag(evt) {
|
|
3537
|
-
if (dragStarted) return; // Only deselect if selection is in this sortable
|
|
3543
|
+
if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable
|
|
3538
3544
|
|
|
3539
3545
|
if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable
|
|
3540
3546
|
|
|
@@ -3570,9 +3576,9 @@ function MultiDragPlugin() {
|
|
|
3570
3576
|
// Static methods & properties
|
|
3571
3577
|
pluginName: 'multiDrag',
|
|
3572
3578
|
utils: {
|
|
3573
|
-
/**
|
|
3574
|
-
* Selects the provided multi-drag item
|
|
3575
|
-
* @param {HTMLElement} el The element to be selected
|
|
3579
|
+
/**
|
|
3580
|
+
* Selects the provided multi-drag item
|
|
3581
|
+
* @param {HTMLElement} el The element to be selected
|
|
3576
3582
|
*/
|
|
3577
3583
|
select: function select(el) {
|
|
3578
3584
|
var sortable = el.parentNode[expando];
|
|
@@ -3588,9 +3594,9 @@ function MultiDragPlugin() {
|
|
|
3588
3594
|
multiDragElements.push(el);
|
|
3589
3595
|
},
|
|
3590
3596
|
|
|
3591
|
-
/**
|
|
3592
|
-
* Deselects the provided multi-drag item
|
|
3593
|
-
* @param {HTMLElement} el The element to be deselected
|
|
3597
|
+
/**
|
|
3598
|
+
* Deselects the provided multi-drag item
|
|
3599
|
+
* @param {HTMLElement} el The element to be deselected
|
|
3594
3600
|
*/
|
|
3595
3601
|
deselect: function deselect(el) {
|
|
3596
3602
|
var sortable = el.parentNode[expando],
|
|
@@ -3660,10 +3666,10 @@ function insertMultiDragElements(clonesInserted, rootEl) {
|
|
|
3660
3666
|
}
|
|
3661
3667
|
});
|
|
3662
3668
|
}
|
|
3663
|
-
/**
|
|
3664
|
-
* Insert multi-drag clones
|
|
3665
|
-
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3666
|
-
* @param {HTMLElement} rootEl
|
|
3669
|
+
/**
|
|
3670
|
+
* Insert multi-drag clones
|
|
3671
|
+
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3672
|
+
* @param {HTMLElement} rootEl
|
|
3667
3673
|
*/
|
|
3668
3674
|
|
|
3669
3675
|
|