Skip to content

Commit

Permalink
1.15.2
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-m1 committed Jan 14, 2024
1 parent 38e4d87 commit 07708fa
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 107 deletions.
49 changes: 23 additions & 26 deletions Sortable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.15.1
* Sortable 1.15.2
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -134,7 +134,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.15.1";
var version = "1.15.2";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -335,26 +335,6 @@
};
}

/**
* Returns the content rect of the element (bounding rect minus border and padding)
* @param {HTMLElement} el
*/
function getContentRect(el) {
var rect = getRect(el);
var paddingLeft = parseInt(css(el, 'padding-left')),
paddingTop = parseInt(css(el, 'padding-top')),
paddingRight = parseInt(css(el, 'padding-right')),
paddingBottom = parseInt(css(el, 'padding-bottom'));
rect.top += paddingTop + parseInt(css(el, 'border-top-width'));
rect.left += paddingLeft + parseInt(css(el, 'border-left-width'));
// Client Width/Height includes padding only
rect.width = el.clientWidth - paddingLeft - paddingRight;
rect.height = el.clientHeight - paddingTop - paddingBottom;
rect.bottom = rect.top + rect.height;
rect.right = rect.left + rect.width;
return rect;
}

/**
* Checks if a side of an element is scrolled past a side of its parents
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
Expand Down Expand Up @@ -561,6 +541,23 @@
css(el, 'width', '');
css(el, 'height', '');
}
function getChildContainingRectFromElement(container, options, ghostEl) {
var rect = {};
Array.from(container.children).forEach(function (child) {
var _rect$left, _rect$top, _rect$right, _rect$bottom;
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
var childRect = getRect(child);
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
});
rect.width = rect.right - rect.left;
rect.height = rect.bottom - rect.top;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
var expando = 'Sortable' + new Date().getTime();

function AnimationStateManager() {
Expand Down Expand Up @@ -2253,15 +2250,15 @@
}
function _ghostIsFirst(evt, vertical, sortable) {
var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX < sortableContentRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < sortableContentRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
}
function _ghostIsLast(evt, vertical, sortable) {
var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX > sortableContentRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > sortableContentRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
}
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
Expand Down
4 changes: 2 additions & 2 deletions Sortable.min.js

Large diffs are not rendered by default.

49 changes: 23 additions & 26 deletions modular/sortable.complete.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.15.1
* Sortable 1.15.2
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -128,7 +128,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.15.1";
var version = "1.15.2";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -329,26 +329,6 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
};
}

/**
* Returns the content rect of the element (bounding rect minus border and padding)
* @param {HTMLElement} el
*/
function getContentRect(el) {
var rect = getRect(el);
var paddingLeft = parseInt(css(el, 'padding-left')),
paddingTop = parseInt(css(el, 'padding-top')),
paddingRight = parseInt(css(el, 'padding-right')),
paddingBottom = parseInt(css(el, 'padding-bottom'));
rect.top += paddingTop + parseInt(css(el, 'border-top-width'));
rect.left += paddingLeft + parseInt(css(el, 'border-left-width'));
// Client Width/Height includes padding only
rect.width = el.clientWidth - paddingLeft - paddingRight;
rect.height = el.clientHeight - paddingTop - paddingBottom;
rect.bottom = rect.top + rect.height;
rect.right = rect.left + rect.width;
return rect;
}

/**
* Checks if a side of an element is scrolled past a side of its parents
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
Expand Down Expand Up @@ -555,6 +535,23 @@ function unsetRect(el) {
css(el, 'width', '');
css(el, 'height', '');
}
function getChildContainingRectFromElement(container, options, ghostEl) {
var rect = {};
Array.from(container.children).forEach(function (child) {
var _rect$left, _rect$top, _rect$right, _rect$bottom;
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
var childRect = getRect(child);
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
});
rect.width = rect.right - rect.left;
rect.height = rect.bottom - rect.top;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
var expando = 'Sortable' + new Date().getTime();

function AnimationStateManager() {
Expand Down Expand Up @@ -2247,15 +2244,15 @@ function _unsilent() {
}
function _ghostIsFirst(evt, vertical, sortable) {
var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX < sortableContentRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < sortableContentRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
}
function _ghostIsLast(evt, vertical, sortable) {
var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX > sortableContentRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > sortableContentRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
}
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
Expand Down
49 changes: 23 additions & 26 deletions modular/sortable.core.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.15.1
* Sortable 1.15.2
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -128,7 +128,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.15.1";
var version = "1.15.2";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -329,26 +329,6 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
};
}

/**
* Returns the content rect of the element (bounding rect minus border and padding)
* @param {HTMLElement} el
*/
function getContentRect(el) {
var rect = getRect(el);
var paddingLeft = parseInt(css(el, 'padding-left')),
paddingTop = parseInt(css(el, 'padding-top')),
paddingRight = parseInt(css(el, 'padding-right')),
paddingBottom = parseInt(css(el, 'padding-bottom'));
rect.top += paddingTop + parseInt(css(el, 'border-top-width'));
rect.left += paddingLeft + parseInt(css(el, 'border-left-width'));
// Client Width/Height includes padding only
rect.width = el.clientWidth - paddingLeft - paddingRight;
rect.height = el.clientHeight - paddingTop - paddingBottom;
rect.bottom = rect.top + rect.height;
rect.right = rect.left + rect.width;
return rect;
}

/**
* Checks if a side of an element is scrolled past a side of its parents
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
Expand Down Expand Up @@ -555,6 +535,23 @@ function unsetRect(el) {
css(el, 'width', '');
css(el, 'height', '');
}
function getChildContainingRectFromElement(container, options, ghostEl) {
var rect = {};
Array.from(container.children).forEach(function (child) {
var _rect$left, _rect$top, _rect$right, _rect$bottom;
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
var childRect = getRect(child);
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
});
rect.width = rect.right - rect.left;
rect.height = rect.bottom - rect.top;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
var expando = 'Sortable' + new Date().getTime();

function AnimationStateManager() {
Expand Down Expand Up @@ -2247,15 +2244,15 @@ function _unsilent() {
}
function _ghostIsFirst(evt, vertical, sortable) {
var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX < sortableContentRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < sortableContentRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
}
function _ghostIsLast(evt, vertical, sortable) {
var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX > sortableContentRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > sortableContentRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
}
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
Expand Down
49 changes: 23 additions & 26 deletions modular/sortable.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.15.1
* Sortable 1.15.2
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -128,7 +128,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.15.1";
var version = "1.15.2";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -329,26 +329,6 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
};
}

/**
* Returns the content rect of the element (bounding rect minus border and padding)
* @param {HTMLElement} el
*/
function getContentRect(el) {
var rect = getRect(el);
var paddingLeft = parseInt(css(el, 'padding-left')),
paddingTop = parseInt(css(el, 'padding-top')),
paddingRight = parseInt(css(el, 'padding-right')),
paddingBottom = parseInt(css(el, 'padding-bottom'));
rect.top += paddingTop + parseInt(css(el, 'border-top-width'));
rect.left += paddingLeft + parseInt(css(el, 'border-left-width'));
// Client Width/Height includes padding only
rect.width = el.clientWidth - paddingLeft - paddingRight;
rect.height = el.clientHeight - paddingTop - paddingBottom;
rect.bottom = rect.top + rect.height;
rect.right = rect.left + rect.width;
return rect;
}

/**
* Checks if a side of an element is scrolled past a side of its parents
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
Expand Down Expand Up @@ -555,6 +535,23 @@ function unsetRect(el) {
css(el, 'width', '');
css(el, 'height', '');
}
function getChildContainingRectFromElement(container, options, ghostEl) {
var rect = {};
Array.from(container.children).forEach(function (child) {
var _rect$left, _rect$top, _rect$right, _rect$bottom;
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
var childRect = getRect(child);
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
});
rect.width = rect.right - rect.left;
rect.height = rect.bottom - rect.top;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
var expando = 'Sortable' + new Date().getTime();

function AnimationStateManager() {
Expand Down Expand Up @@ -2247,15 +2244,15 @@ function _unsilent() {
}
function _ghostIsFirst(evt, vertical, sortable) {
var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX < sortableContentRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < sortableContentRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
}
function _ghostIsLast(evt, vertical, sortable) {
var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
var sortableContentRect = getContentRect(sortable.el);
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
var spacer = 10;
return vertical ? evt.clientX > sortableContentRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > sortableContentRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
}
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sortablejs",
"exportName": "Sortable",
"version": "1.15.1",
"version": "1.15.2",
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-transform-object-assign": "^7.2.0",
Expand Down

0 comments on commit 07708fa

Please sign in to comment.