Skip to content

Commit

Permalink
1.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-m1 committed Mar 20, 2022
1 parent 632d70b commit babf6ab
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 57 deletions.
37 changes: 24 additions & 13 deletions Sortable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.14.0
* Sortable 1.15.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
Expand Down Expand Up @@ -166,7 +166,7 @@
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

var version = "1.14.0";
var version = "1.15.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -1173,7 +1173,7 @@
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position


if (documentExists) {
if (documentExists && !ChromeForAndroid) {
document.addEventListener('click', function (evt) {
if (ignoreNextClick) {
evt.preventDefault();
Expand Down Expand Up @@ -1792,6 +1792,7 @@

if (!Sortable.eventCanceled) {
cloneEl = clone(dragEl);
cloneEl.removeAttribute("id");
cloneEl.draggable = false;
cloneEl.style['will-change'] = '';

Expand Down Expand Up @@ -2033,7 +2034,14 @@

if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
capture();
el.appendChild(dragEl);

if (elLastChild && elLastChild.nextSibling) {
// the last draggable element is not the last node
el.insertBefore(dragEl, elLastChild.nextSibling);
} else {
el.appendChild(dragEl);
}

parentEl = el; // actualization

changed();
Expand Down Expand Up @@ -3178,18 +3186,21 @@
}
}

if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
if (!sortable.options.avoidImplicitDeselect) {
if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
}
}

on(document, 'keydown', this._checkKeyDown);
on(document, 'keyup', this._checkKeyUp);
this.defaults = {
selectedClass: 'sortable-selected',
multiDragKey: null,
avoidImplicitDeselect: false,
setData: function setData(dataTransfer, dragEl) {
var data = '';

Expand Down Expand Up @@ -3480,7 +3491,7 @@
rootEl: rootEl,
name: 'select',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
}); // Modifier activated, select from last to dragEl

if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
Expand Down Expand Up @@ -3509,7 +3520,7 @@
rootEl: rootEl,
name: 'select',
targetEl: children[i],
originalEvt: evt
originalEvent: evt
});
}
}
Expand All @@ -3526,7 +3537,7 @@
rootEl: rootEl,
name: 'deselect',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
});
}
} // Multi-drag drop
Expand Down Expand Up @@ -3637,7 +3648,7 @@
rootEl: this.sortable.el,
name: 'deselect',
targetEl: el,
originalEvt: evt
originalEvent: evt
});
}
},
Expand Down
4 changes: 2 additions & 2 deletions Sortable.min.js

Large diffs are not rendered by default.

37 changes: 24 additions & 13 deletions modular/sortable.complete.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.14.0
* Sortable 1.15.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
Expand Down Expand Up @@ -160,7 +160,7 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

var version = "1.14.0";
var version = "1.15.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position


if (documentExists) {
if (documentExists && !ChromeForAndroid) {
document.addEventListener('click', function (evt) {
if (ignoreNextClick) {
evt.preventDefault();
Expand Down Expand Up @@ -1786,6 +1786,7 @@ Sortable.prototype =

if (!Sortable.eventCanceled) {
cloneEl = clone(dragEl);
cloneEl.removeAttribute("id");
cloneEl.draggable = false;
cloneEl.style['will-change'] = '';

Expand Down Expand Up @@ -2027,7 +2028,14 @@ Sortable.prototype =

if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
capture();
el.appendChild(dragEl);

if (elLastChild && elLastChild.nextSibling) {
// the last draggable element is not the last node
el.insertBefore(dragEl, elLastChild.nextSibling);
} else {
el.appendChild(dragEl);
}

parentEl = el; // actualization

changed();
Expand Down Expand Up @@ -3172,18 +3180,21 @@ function MultiDragPlugin() {
}
}

if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
if (!sortable.options.avoidImplicitDeselect) {
if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
}
}

on(document, 'keydown', this._checkKeyDown);
on(document, 'keyup', this._checkKeyUp);
this.defaults = {
selectedClass: 'sortable-selected',
multiDragKey: null,
avoidImplicitDeselect: false,
setData: function setData(dataTransfer, dragEl) {
var data = '';

Expand Down Expand Up @@ -3474,7 +3485,7 @@ function MultiDragPlugin() {
rootEl: rootEl,
name: 'select',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
}); // Modifier activated, select from last to dragEl

if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
Expand Down Expand Up @@ -3503,7 +3514,7 @@ function MultiDragPlugin() {
rootEl: rootEl,
name: 'select',
targetEl: children[i],
originalEvt: evt
originalEvent: evt
});
}
}
Expand All @@ -3520,7 +3531,7 @@ function MultiDragPlugin() {
rootEl: rootEl,
name: 'deselect',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
});
}
} // Multi-drag drop
Expand Down Expand Up @@ -3631,7 +3642,7 @@ function MultiDragPlugin() {
rootEl: this.sortable.el,
name: 'deselect',
targetEl: el,
originalEvt: evt
originalEvent: evt
});
}
},
Expand Down
37 changes: 24 additions & 13 deletions modular/sortable.core.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.14.0
* Sortable 1.15.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
Expand Down Expand Up @@ -160,7 +160,7 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

var version = "1.14.0";
var version = "1.15.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position


if (documentExists) {
if (documentExists && !ChromeForAndroid) {
document.addEventListener('click', function (evt) {
if (ignoreNextClick) {
evt.preventDefault();
Expand Down Expand Up @@ -1786,6 +1786,7 @@ Sortable.prototype =

if (!Sortable.eventCanceled) {
cloneEl = clone(dragEl);
cloneEl.removeAttribute("id");
cloneEl.draggable = false;
cloneEl.style['will-change'] = '';

Expand Down Expand Up @@ -2027,7 +2028,14 @@ Sortable.prototype =

if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
capture();
el.appendChild(dragEl);

if (elLastChild && elLastChild.nextSibling) {
// the last draggable element is not the last node
el.insertBefore(dragEl, elLastChild.nextSibling);
} else {
el.appendChild(dragEl);
}

parentEl = el; // actualization

changed();
Expand Down Expand Up @@ -3174,18 +3182,21 @@ function MultiDragPlugin() {
}
}

if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
if (!sortable.options.avoidImplicitDeselect) {
if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
}
}

on(document, 'keydown', this._checkKeyDown);
on(document, 'keyup', this._checkKeyUp);
this.defaults = {
selectedClass: 'sortable-selected',
multiDragKey: null,
avoidImplicitDeselect: false,
setData: function setData(dataTransfer, dragEl) {
var data = '';

Expand Down Expand Up @@ -3476,7 +3487,7 @@ function MultiDragPlugin() {
rootEl: rootEl,
name: 'select',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
}); // Modifier activated, select from last to dragEl

if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
Expand Down Expand Up @@ -3505,7 +3516,7 @@ function MultiDragPlugin() {
rootEl: rootEl,
name: 'select',
targetEl: children[i],
originalEvt: evt
originalEvent: evt
});
}
}
Expand All @@ -3522,7 +3533,7 @@ function MultiDragPlugin() {
rootEl: rootEl,
name: 'deselect',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
});
}
} // Multi-drag drop
Expand Down Expand Up @@ -3633,7 +3644,7 @@ function MultiDragPlugin() {
rootEl: this.sortable.el,
name: 'deselect',
targetEl: el,
originalEvt: evt
originalEvent: evt
});
}
},
Expand Down
Loading

2 comments on commit babf6ab

@vitality82
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@Jhonchuan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, I have a problem. sortable component failed when I set zoom property for 'body'. Is there any solution ?

Please sign in to comment.