Socket
Socket
Sign inDemoInstall

sortablejs

Package Overview
Dependencies
0
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.7.0 to 1.8.0-rc1

11

package.json
{
"name": "sortablejs",
"exportName": "Sortable",
"version": "1.7.0",
"version": "1.8.0-rc1",
"devDependencies": {

@@ -18,8 +18,11 @@ "grunt": "*",

"test": "./node_modules/grunt/bin/grunt",
"prepublish": "./node_modules/grunt/bin/grunt",
"http-server": "http-server -s ./"
},
"contributors": [
"Konstantin Lebedev <ibnRubaXa@gmail.com>",
"Owen Mills <owen23355@gmail.com>"
],
"repository": {
"type": "git",
"url": "git://github.com/rubaxa/Sortable.git"
"url": "git://github.com/SortableJS/Sortable.git"
},

@@ -38,5 +41,5 @@ "files": [

"react",
"vue",
"mixin"
],
"author": "Konstantin Lebedev <ibnRubaXa@gmail.com>",
"license": "MIT",

@@ -43,0 +46,0 @@ "spm": {

# Sortable
Sortable is a <s>minimalist</s> JavaScript library for reorderable drag-and-drop lists.
Demo: http://rubaxa.github.io/Sortable/
Demo: http://sortablejs.github.io/Sortable/

@@ -16,12 +16,12 @@

* Supports
* [Meteor](https://github.com/SortableJS/meteor-sortablejs)
* AngularJS
* [2.0+](https://github.com/SortableJS/angular-sortablejs)
* [1.*](https://github.com/SortableJS/angular-legacy-sortablejs)
* React
* [ES2015+](https://github.com/SortableJS/react-sortablejs)
* [Mixin](https://github.com/SortableJS/react-mixin-sortablejs)
* [Knockout](https://github.com/SortableJS/knockout-sortablejs)
* [Polymer](https://github.com/SortableJS/polymer-sortablejs)
* [Vue](https://github.com/SortableJS/Vue.Draggable)
* [Meteor](https://github.com/SortableJS/meteor-sortablejs)
* AngularJS
* [2.0+](https://github.com/SortableJS/angular-sortablejs)
* [1.*](https://github.com/SortableJS/angular-legacy-sortablejs)
* React
* [ES2015+](https://github.com/SortableJS/react-sortablejs)
* [Mixin](https://github.com/SortableJS/react-mixin-sortablejs)
* [Knockout](https://github.com/SortableJS/knockout-sortablejs)
* [Polymer](https://github.com/SortableJS/polymer-sortablejs)
* [Vue](https://github.com/SortableJS/Vue.Draggable)
* Supports any CSS library, e.g. [Bootstrap](#bs)

@@ -38,6 +38,6 @@ * Simple API

* [Sortable v1.0 — New capabilities](https://github.com/RubaXa/Sortable/wiki/Sortable-v1.0-—-New-capabilities/) (December 22, 2014)
* [Sorting with the help of HTML5 Drag'n'Drop API](https://github.com/RubaXa/Sortable/wiki/Sorting-with-the-help-of-HTML5-Drag'n'Drop-API/) (December 23, 2013)
* [Swap Thresholds and Direction](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction) (December 2, 2018)
* [Sortable v1.0 — New capabilities](https://github.com/SortableJS/Sortable/wiki/Sortable-v1.0-—-New-capabilities/) (December 22, 2014)
* [Sorting with the help of HTML5 Drag'n'Drop API](https://github.com/SortableJS/Sortable/wiki/Sorting-with-the-help-of-HTML5-Drag'n'Drop-API/) (December 23, 2013)
<br/>

@@ -75,3 +75,3 @@

You can use any element for the list and its elements, not just `ul`/`li`. Here is an [example with `div`s](http://jsbin.com/qumuwe/edit?html,js,output).
You can use any element for the list and its elements, not just `ul`/`li`. Here is an [example with `div`s](https://jsbin.com/visimub/edit?html,js,output).

@@ -85,5 +85,6 @@

var sortable = new Sortable(el, {
group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] }
group: "name", // or { name: "...", pull: [true, false, 'clone', array], put: [true, false, array] }
sort: true, // sorting inside list
delay: 0, // time in milliseconds to define when the sorting should start
touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event
disabled: false, // Disables the sortable if set to true.

@@ -101,2 +102,7 @@ store: null, // @see Store

swapThreshold: 1, // Threshold of the swap zone
invertSwap: false, // Will always use inverted swap zone if set to true
invertedSwapThreshold: 1, // Threshold of the inverted swap zone (will be set to swapThreshold value by default)
direction: 'horizontal', // Direction of Sortable (will be detected automatically if not given)
forceFallback: false, // ignore the HTML5 DnD behaviour and force the fallback to kick in

@@ -106,9 +112,12 @@

fallbackOnBody: false, // Appends the cloned DOM Element into the Document's Body
fallbackTolerance: 0, // Specify in pixels how far the mouse should move before it's considered as a drag.
fallbackTolerance: 0, // Specify in pixels how far the mouse should move before it's considered as a drag.
scroll: true, // or HTMLElement
scrollFn: function(offsetX, offsetY, originalEvent) { ... }, // if you have custom scrollbar scrollFn may be used for autoscrolling
scrollFn: function(offsetX, offsetY, originalEvent, touchEvt, hoverTargetEl) { ... }, // if you have custom scrollbar scrollFn may be used for autoscrolling
scrollSensitivity: 30, // px, how near the mouse must be to an edge to start scrolling.
scrollSpeed: 10, // px
bubbleScroll: true, // apply autoscroll to all parent elements, allowing for easier movement
dragoverBubble: false,
setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) {

@@ -164,3 +173,3 @@ dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent

onMove: function (/**Event*/evt, /**Event*/originalEvent) {
// Example: http://jsbin.com/tuyafe/1/edit?js,output
// Example: https://jsbin.com/nawahef/edit?js,output
evt.dragged; // dragged HTMLElement

@@ -173,3 +182,3 @@ evt.draggedRect; // TextRectangle {left, top, right и bottom}

},
// Called when creating a clone of element

@@ -192,4 +201,4 @@ onClone: function (/**Event*/evt) {

* name: `String` — group name
* pull: `true|false|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move.
* put: `true|false|["foo", "bar"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be taken.
* pull: `true|false|["foo", "bar"]|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move. Or an array of group names which the elements may be put in. Defaults to `true`.
* put: `true|false|["baz", "qux"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be taken.
* revertClone: `boolean` — revert cloned element to initial position after moving to a another list.

@@ -199,5 +208,5 @@

Demo:
- http://jsbin.com/naduvo/edit?js,output
- http://jsbin.com/rusuvot/edit?js,output — use of complex logic in the `pull` and` put`
- http://jsbin.com/magogub/edit?js,output — use `revertClone: true`
- https://jsbin.com/hijetos/edit?js,output
- https://jsbin.com/nacoyah/edit?js,output — use of complex logic in the `pull` and` put`
- https://jsbin.com/bifuyab/edit?js,output — use `revertClone: true`

@@ -211,3 +220,3 @@

Demo: http://jsbin.com/videzob/edit?html,js,output
Demo: https://jsbin.com/jayedig/edit?js,output

@@ -221,3 +230,3 @@

Demo: http://jsbin.com/xizeh/edit?html,js,output
Demo: https://jsbin.com/zosiwah/edit?js,output

@@ -228,6 +237,67 @@

#### `swapThreshold` option
Percentage of the target that the swap zone will take up, as a float between `0` and `1`.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold
---
#### `invertSwap` option
Set to `true` to set the swap zone to the sides of the target, for the effect of sorting "in between" items.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#forcing-inverted-swap-zone
---
#### `invertedSwapThreshold` option
Percentage of the target that the inverted swap zone will take up, as a float between `0` and `1`. If not given, will default to `swapThreshold`.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#dealing-with-swap-glitching
---
#### `direction` option
Direction that the Sortable should sort in. Can be set to `'vertical'`, `'horizontal'`, or a function, which will be called whenever a target is dragged over. Must return `'vertical'` or `'horizontal'`.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#direction
Example of dynamic direction detection:
```js
Sortable.create(el, {
direction: function(evt, target, dragEl) {
return Sortable.utils.detectDirection(el);
}
});
```
---
#### `touchStartThreshold` option
This option is similar to `fallbackTolerance` option.
When the `delay` option is set, some phones with very sensitive touch displays like the Samsung Galaxy S8 will fire
unwanted touchmove events even when your finger is not moving, resulting in the sort not triggering.
This option sets the minimum pointer movement that must occur before the delayed sorting is cancelled.
Values between 3 to 5 are good.
---
#### `disabled` options
Disables the sortable if set to `true`.
Demo: http://jsbin.com/xiloqu/edit?html,js,output
Demo: https://jsbin.com/sewokud/edit?js,output

@@ -253,3 +323,3 @@ ```js

Demo: http://jsbin.com/newize/edit?html,js,output
Demo: https://jsbin.com/numakuh/edit?html,js,output

@@ -307,3 +377,3 @@ ```js

Demo: http://jsbin.com/hunifu/4/edit?css,js,output
Demo: https://jsbin.com/henuyiw/edit?css,js,output

@@ -329,3 +399,3 @@ ```css

Demo: http://jsbin.com/hunifu/3/edit?html,css,js,output
Demo: https://jsbin.com/hoqufox/edit?css,js,output

@@ -356,3 +426,3 @@ ```css

Demo: http://jsbin.com/yacuqib/edit?html,css,js,output
Demo: https://jsbin.com/sibiput/edit?html,css,js,output

@@ -367,3 +437,3 @@

When the user clicks inside a sortable element, it's not uncommon for your hand to move a little between the time you press and the time you release.
When the user clicks inside a sortable element, it's not uncommon for your hand to move a little between the time you press and the time you release.
Dragging only starts if you move the pointer past a certain tolerance, so that you don't accidentally start dragging every time you click.

@@ -381,4 +451,4 @@

Demo:
- `window`: http://jsbin.com/tutuzeh/edit?html,js,output
- `overflow: hidden`: http://jsbin.com/kolisu/edit?html,js,output
- `window`: https://jsbin.com/dosilir/edit?js,output
- `overflow: hidden`: https://jsbin.com/xecihez/edit?html,js,output

@@ -411,4 +481,20 @@

### Event object ([demo](http://jsbin.com/xedusu/edit?js,output))
#### `bubbleScroll` option
If set to `true`, the normal `autoscroll` function will also be applied to all parent elements of the element the user is dragging over.
Demo: https://jsbin.com/kesewor/edit?html,js,output
---
#### `dragoverBubble` option
If set to `true`, the dragover event will bubble to parent Sortables. Useful for nested Sortables. Works on both fallback and native dragover event.
---
### Event object ([demo](https://jsbin.com/fogujiv/edit?js,output))
- to:`HTMLElement` — list, in which moved element.

@@ -514,3 +600,3 @@ - from:`HTMLElement` — previous list

### Bootstrap
Demo: http://jsbin.com/qumuwe/edit?html,js,output
Demo: https://jsbin.com/visimub/edit?html,js,output

@@ -523,3 +609,3 @@ ```html

<!-- Latest Sortable -->
<script src="http://rubaxa.github.io/Sortable/Sortable.js"></script>
<script src="http://SortableJS.github.io/Sortable/Sortable.js"></script>

@@ -529,3 +615,3 @@

<ul id="simpleList" class="list-group">
<li class="list-group-item">This is <a href="http://rubaxa.github.io/Sortable/">Sortable</a></li>
<li class="list-group-item">This is <a href="http://SortableJS.github.io/Sortable/">Sortable</a></li>
<li class="list-group-item">It works with Bootstrap...</li>

@@ -578,2 +664,3 @@ <li class="list-group-item">...out of the box.</li>

* toggleClass(el`:HTMLElement`, name`:String`, state`:Boolean`) — add or remove one classes from each element
* detectDirection(el`:HTMLElement`)`:String` — automatically detect the direction of the element as either `'vertical'` or `'horizontal'`

@@ -588,8 +675,4 @@

```html
<!-- jsDelivr :: Sortable (http://www.jsdelivr.com/package/npm/sortablejs) -->
<script src="//cdn.jsdelivr.net/npm/sortablejs@1.6.1/Sortable.min.js"></script>
<!-- jsDelivr :: Sortable :: Latest (http://www.jsdelivr.com/package/npm/sortablejs) -->
<script src="//cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<!-- jsDelivr :: Sortable :: Latest (https://www.jsdelivr.com/package/npm/sortablejs) -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
```

@@ -640,5 +723,2 @@

## MIT LICENSE
Copyright 2013-2017 Lebedev Konstantin <ibnRubaXa@gmail.com>
http://rubaxa.github.io/Sortable/
Permission is hereby granted, free of charge, to any person obtaining

@@ -662,2 +742,1 @@ a copy of this software and associated documentation files (the

WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/**!
* Sortable
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT

@@ -41,6 +42,2 @@ */

lastEl,
lastCSS,
lastParentCSS,
oldIndex,

@@ -52,4 +49,9 @@ newIndex,

autoScroll = {},
autoScrolls = [],
scrolling = false,
pointerElemChangedInterval,
lastPointerElemX,
lastPointerElemY,
tapEvt,

@@ -60,5 +62,12 @@ touchEvt,

lastTarget,
lastDirection,
pastFirstInvertThresh = false,
isCircumstantialInvert = false,
forRepaintDummy,
realDragElRect, // dragEl rect after current animation
/** @const */
R_SPACE = /\s+/g,
R_FLOAT = /left|right|inline/,

@@ -75,4 +84,6 @@ expando = 'Sortable' + (new Date).getTime(),

captureMode = false,
passiveMode = false,
captureMode = {
capture: false,
passive: false
},

@@ -91,2 +102,3 @@ supportDraggable = ('draggable' in document.createElement('div')),

_silent = false,
_alignedSilent = false,

@@ -99,8 +111,74 @@ abs = Math.abs,

_autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
alwaysFalse = function () { return false; },
_detectDirection = function(el, options) {
var elCSS = _css(el),
elWidth = parseInt(elCSS.width),
child1 = _getChild(el, 0, options),
child2 = _getChild(el, 1, options),
firstChildCSS = child1 && _css(child1),
secondChildCSS = child2 && _css(child2),
firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + child1.getBoundingClientRect().width,
secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + child2.getBoundingClientRect().width
;
if (elCSS.display === 'flex') {
return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse'
? 'vertical' : 'horizontal';
}
return (child1 &&
(
firstChildCSS.display === 'block' ||
firstChildCSS.display === 'grid' ||
firstChildWidth >= elWidth &&
elCSS.float === 'none' ||
child2 &&
elCSS.float === 'none' &&
firstChildWidth + secondChildWidth > elWidth
) ?
'vertical' : 'horizontal'
);
},
_isInRowColumn = function(x, y, el, axis, options) {
var targetRect = realDragElRect || dragEl.getBoundingClientRect(),
targetS1Opp = axis === 'vertical' ? targetRect.left : targetRect.top,
targetS2Opp = axis === 'vertical' ? targetRect.right : targetRect.bottom,
mouseOnOppAxis = axis === 'vertical' ? x : y
;
return targetS1Opp < mouseOnOppAxis && mouseOnOppAxis < targetS2Opp;
},
_getParentAutoScrollElement = function(el, includeSelf) {
// skip to window
if (!el || !el.getBoundingClientRect) return win;
var elem = el;
var gotSelf = false;
do {
// we don't need to get elem css if it isn't even overflowing in the first place (performance)
if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
var elemCSS = _css(elem);
if (
elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') ||
elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')
) {
if (!elem || !elem.getBoundingClientRect || elem === document.body) return win;
if (gotSelf || includeSelf) return elem;
gotSelf = true;
}
}
/* jshint boss:true */
} while (elem = elem.parentNode);
return win;
},
_autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl, /**Boolean*/isFallback) {
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
if (rootEl && options.scroll) {
var _this = rootEl[expando],
el,
if (options.scroll) {
var _this = rootEl ? rootEl[expando] : window,
rect,
css,
sens = options.scrollSensitivity,

@@ -118,91 +196,114 @@ speed = options.scrollSpeed,

scrollOffsetX,
scrollOffsetY
scrollThisInstance = false
;
// Delect scrollEl
// Detect scrollEl
if (scrollParentEl !== rootEl) {
_clearAutoScrolls();
scrollEl = options.scroll;
scrollParentEl = rootEl;
scrollCustomFn = options.scrollFn;
if (scrollEl === true) {
scrollEl = rootEl;
do {
if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
(scrollEl.offsetHeight < scrollEl.scrollHeight)
) {
break;
}
/* jshint boss:true */
} while (scrollEl = scrollEl.parentNode);
scrollEl = _getParentAutoScrollElement(rootEl, true);
scrollParentEl = scrollEl;
}
}
if (scrollEl) {
el = scrollEl;
rect = scrollEl.getBoundingClientRect();
vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
}
var layersOut = 0;
var currentParent = scrollEl;
do {
var el;
if (!(vx || vy)) {
vx = (winWidth - x <= sens) - (x <= sens);
vy = (winHeight - y <= sens) - (y <= sens);
if (currentParent && currentParent !== win) {
el = currentParent;
css = _css(el);
rect = currentParent.getBoundingClientRect();
vx = el.clientWidth < el.scrollWidth && (css.overflowX == 'auto' || css.overflowX == 'scroll') &&
((abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens));
/* jshint expr:true */
(vx || vy) && (el = win);
}
vy = el.clientHeight < el.scrollHeight && (css.overflowY == 'auto' || css.overflowY == 'scroll') &&
((abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens));
} else if (currentParent === win) {
el = win;
vx = (winWidth - x <= sens) - (x <= sens);
vy = (winHeight - y <= sens) - (y <= sens);
}
if (!autoScrolls[layersOut]) {
for (var i = 0; i <= layersOut; i++) {
if (!autoScrolls[i]) {
autoScrolls[i] = {};
}
}
}
if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
autoScroll.el = el;
autoScroll.vx = vx;
autoScroll.vy = vy;
if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
autoScrolls[layersOut].el = el;
autoScrolls[layersOut].vx = vx;
autoScrolls[layersOut].vy = vy;
clearInterval(autoScroll.pid);
clearInterval(autoScrolls[layersOut].pid);
if (el) {
autoScroll.pid = setInterval(function () {
scrollOffsetY = vy ? vy * speed : 0;
scrollOffsetX = vx ? vx * speed : 0;
if (el && (vx != 0 || vy != 0)) {
scrollThisInstance = true;
/* jshint loopfunc:true */
autoScrolls[layersOut].pid = setInterval((function () {
// emulate drag over during autoscroll (fallback), emulating native DnD behaviour
if (isFallback && this.layer === 0) {
Sortable.active._emulateDragOver(true);
}
var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
if ('function' === typeof(scrollCustomFn)) {
return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
}
if (el === win) {
win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
} else {
el.scrollTop += scrollOffsetY;
el.scrollLeft += scrollOffsetX;
}
}, 24);
if ('function' === typeof(scrollCustomFn)) {
if (scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt, touchEvt, autoScrolls[this.layer].el) !== 'continue') {
return;
}
}
if (autoScrolls[this.layer].el === win) {
win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
} else {
autoScrolls[this.layer].el.scrollTop += scrollOffsetY;
autoScrolls[this.layer].el.scrollLeft += scrollOffsetX;
}
}).bind({layer: layersOut}), 24);
}
}
}
layersOut++;
} while (options.bubbleScroll && currentParent !== win && (currentParent = _getParentAutoScrollElement(currentParent, false)));
scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
}
}, 30),
_clearAutoScrolls = function () {
autoScrolls.forEach(function(autoScroll) {
clearInterval(autoScroll.pid);
});
autoScrolls = [];
},
_prepareGroup = function (options) {
function toFn(value, pull) {
if (value === void 0 || value === true) {
value = group.name;
}
return function(to, from, dragEl, evt) {
var ret;
if (typeof value === 'function') {
return value;
} else {
return function (to, from) {
var fromGroup = from.options.group.name;
if (value == null && pull) {
ret = true; // default pull value: true (backwards compatibility)
} else if (value == null || value === false) {
ret = false;
} else if (pull && value === 'clone') {
ret = value;
} else if (typeof value === 'function') {
ret = value(to, from, dragEl, evt);
} else {
var otherGroup = (pull ? to : from).options.group.name;
return pull
? value
: value && (value.join
? value.indexOf(fromGroup) > -1
: (fromGroup == value)
);
};
}
ret = (value === true ||
(typeof value === 'string' && value === otherGroup) ||
(value.join && value.indexOf(otherGroup) > -1));
}
return ret || (to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name);
};
}

@@ -223,19 +324,10 @@

options.group = group;
},
_checkAlignment = function(evt) {
if (!dragEl) return;
dragEl.parentNode[expando] && dragEl.parentNode[expando]._computeIsAligned(evt);
}
;
// Detect support a passive mode
try {
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
get: function () {
// `false`, because everything starts to work incorrectly and instead of d'n'd,
// begins the page has scrolled.
passiveMode = false;
captureMode = {
capture: false,
passive: passiveMode
};
}
}));
} catch (err) {}

@@ -261,3 +353,3 @@ /**

var defaults = {
group: Math.random(),
group: null,
sort: true,

@@ -270,3 +362,9 @@ disabled: false,

scrollSpeed: 10,
bubbleScroll: true,
draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
swapThreshold: 1, // percentage; 0 <= x <= 1
invertSwap: false, // invert always
invertedSwapThreshold: null, // will be set to same as swapThreshold if default
ghostClass: 'sortable-ghost',

@@ -286,2 +384,3 @@ chosenClass: 'sortable-chosen',

delay: 0,
touchStartThreshold: parseInt(window.devicePixelRatio, 10) || 1,
forceFallback: false,

@@ -292,3 +391,6 @@ fallbackClass: 'sortable-fallback',

fallbackOffset: {x: 0, y: 0},
supportPointer: Sortable.supportPointer !== false
supportPointer: Sortable.supportPointer !== false && (
('PointerEvent' in window) ||
window.navigator && ('msPointerEnabled' in window.navigator) // microsoft
)
};

@@ -302,4 +404,11 @@

if (!('direction' in options)) {
options.direction = function() {
return _detectDirection(el, options);
};
}
_prepareGroup(options);
options.invertedSwapThreshold == null && (options.invertedSwapThreshold = options.swapThreshold);
// Bind all private methods

@@ -328,9 +437,28 @@ for (var fn in this) {

// Restore sorting
options.store && this.sort(options.store.get(this));
options.store && options.store.get && this.sort(options.store.get(this) || []);
}
Sortable.prototype = /** @lends Sortable.prototype */ {
constructor: Sortable,
// is mouse aligned with dragEl?
_isAligned: true,
_computeIsAligned: function(evt, isDragEl) {
if (_alignedSilent) return;
if (!dragEl || dragEl.parentNode !== this.el) return;
if (isDragEl !== true && isDragEl !== false) {
isDragEl = !!_closest(evt.target, null, dragEl, true);
}
this._isAligned = !scrolling && (isDragEl || this._isAligned && _isInRowColumn(evt.clientX, evt.clientY, this.el, this._getDirection(evt, null), this.options));
_alignedSilent = true;
setTimeout(function() {
_alignedSilent = false;
}, 30);
},
_getDirection: function(evt, target) {
return (typeof this.options.direction === 'function') ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
},
_onTapStart: function (/** Event|TouchEvent */evt) {

@@ -344,3 +472,3 @@ var _this = this,

target = (touch || evt).target,
originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0]) || target,
originalTarget = evt.target.shadowRoot && ((evt.path && evt.path[0]) || (evt.composedPath && evt.composedPath()[0])) || target,
filter = options.filter,

@@ -366,3 +494,3 @@ startIndex;

target = _closest(target, options.draggable, el);
target = _closest(target, options.draggable, el, true);

@@ -385,3 +513,3 @@ if (!target) {

_dispatchEvent(_this, originalTarget, 'filter', target, el, el, startIndex);
preventOnFilter && evt.preventDefault();
preventOnFilter && evt.cancelable && evt.preventDefault();
return; // cancel dnd

@@ -392,3 +520,3 @@ }

filter = filter.split(',').some(function (criteria) {
criteria = _closest(originalTarget, criteria.trim(), el);
criteria = _closest(originalTarget, criteria.trim(), el, false);

@@ -402,3 +530,3 @@ if (criteria) {

if (filter) {
preventOnFilter && evt.preventDefault();
preventOnFilter && evt.cancelable && evt.preventDefault();
return; // cancel dnd

@@ -408,3 +536,3 @@ }

if (options.handle && !_closest(originalTarget, options.handle, el)) {
if (options.handle && !_closest(originalTarget, options.handle, el, false)) {
return;

@@ -417,2 +545,53 @@ }

_handleAutoScroll: function(evt, fallback) {
if (!dragEl || !this.options.scroll) return;
var x = evt.clientX,
y = evt.clientY,
elem = document.elementFromPoint(x, y),
_this = this
;
// firefox does not have native autoscroll
if (fallback || (window.navigator && window.navigator.userAgent.toLowerCase().indexOf('firefox') > -1)) {
_autoScroll(evt, _this.options, elem, true);
// Listener for pointer element change
var ogElemScroller = _getParentAutoScrollElement(elem, true);
if (
scrolling &&
(
!pointerElemChangedInterval ||
x !== lastPointerElemX ||
y !== lastPointerElemY
)
) {
pointerElemChangedInterval && clearInterval(pointerElemChangedInterval);
// Detect for pointer elem change, emulating native DnD behaviour
pointerElemChangedInterval = setInterval(function() {
if (!dragEl) return;
// could also check if scroll direction on newElem changes due to parent autoscrolling
var newElem = _getParentAutoScrollElement(document.elementFromPoint(x, y), true);
if (newElem !== ogElemScroller) {
ogElemScroller = newElem;
_clearAutoScrolls();
_autoScroll(evt, _this.options, ogElemScroller, true);
}
}, 10);
lastPointerElemX = x;
lastPointerElemY = y;
}
} else {
// if DnD is enabled (not on firefox), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
if (!_this.options.bubbleScroll || _getParentAutoScrollElement(elem, true) === window) {
_clearAutoScrolls();
return;
}
_autoScroll(evt, _this.options, _getParentAutoScrollElement(elem, false));
}
},
_prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {

@@ -449,5 +628,2 @@ var _this = this,

// Chosen item
_toggleClass(dragEl, options.chosenClass, true);
// Bind the events: dragstart/dragend

@@ -458,2 +634,5 @@ _this._triggerDragStart(evt, touch);

_dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, rootEl, oldIndex);
// Chosen item
_toggleClass(dragEl, options.chosenClass, true);
};

@@ -469,3 +648,2 @@

_on(ownerDocument, 'touchcancel', _this._onDrop);
_on(ownerDocument, 'selectstart', _this);
options.supportPointer && _on(ownerDocument, 'pointercancel', _this._onDrop);

@@ -480,7 +658,7 @@

_on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
_on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
_on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
options.supportPointer && _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
_on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
_on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
options.supportPointer && _on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
_this._dragStartTimer = setTimeout(dragStartFn, options.delay);
_this._dragStartTimer = setTimeout(dragStartFn.bind(_this), options.delay);
} else {

@@ -494,2 +672,11 @@ dragStartFn();

_delayedDragTouchMoveHandler: function (/** TouchEvent|PointerEvent **/e) {
var touch = e.touches ? e.touches[0] : e;
if (min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY))
>= this.options.touchStartThreshold
) {
this._disableDelayedDrag();
}
},
_disableDelayedDrag: function () {

@@ -502,5 +689,5 @@ var ownerDocument = this.el.ownerDocument;

_off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
_off(ownerDocument, 'mousemove', this._disableDelayedDrag);
_off(ownerDocument, 'touchmove', this._disableDelayedDrag);
_off(ownerDocument, 'pointermove', this._disableDelayedDrag);
_off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
_off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
_off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
},

@@ -511,2 +698,3 @@

if (touch) {

@@ -545,10 +733,18 @@ // Touch device support

if (rootEl && dragEl) {
if (this.nativeDraggable) {
_on(document, 'dragover', this._handleAutoScroll);
_on(document, 'dragover', _checkAlignment);
}
var options = this.options;
// Apply effect
_toggleClass(dragEl, options.dragClass, false);
_toggleClass(dragEl, options.ghostClass, true);
_toggleClass(dragEl, options.dragClass, false);
_css(dragEl, 'transform', '');
Sortable.active = this;
this._isAligned = true;
// Drag start event

@@ -561,5 +757,5 @@ _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, rootEl, oldIndex);

_emulateDragOver: function () {
_emulateDragOver: function (bypassLastTouchCheck) {
if (touchEvt) {
if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY && !bypassLastTouchCheck) {
return;

@@ -577,5 +773,5 @@ }

var parent = target;
var i = touchDragOverListeners.length;
var isDragEl = !!_closest(target, null, dragEl, true);
if (target && target.shadowRoot) {
while (target && target.shadowRoot) {
target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);

@@ -588,2 +784,3 @@ parent = target;

if (parent[expando]) {
var i = touchDragOverListeners.length;
while (i--) {

@@ -598,3 +795,5 @@ touchDragOverListeners[i]({

break;
if (!this.options.dragoverBubble) {
break;
}
}

@@ -607,2 +806,3 @@

}
dragEl.parentNode[expando]._computeIsAligned(touchEvt, isDragEl);

@@ -626,2 +826,5 @@ if (!supportCssPointerEvents) {

// prevent duplicate event firing
if (this.options.supportPointer && evt.type === 'touchmove') return;
// only set the status to dragging, when we are actually dragging

@@ -641,2 +844,5 @@ if (!Sortable.active) {

this._handleAutoScroll(touch, true);
moved = true;

@@ -650,3 +856,3 @@ touchEvt = touch;

evt.preventDefault();
evt.cancelable && evt.preventDefault();
}

@@ -692,3 +898,2 @@ },

_this._offUpEvents();
if (activeGroup.checkPull(_this, _this, dragEl, evt)) {

@@ -700,3 +905,4 @@ cloneEl = _clone(dragEl);

_css(cloneEl, 'display', 'none');
this._hideClone();
_toggleClass(cloneEl, _this.options.chosenClass, false);

@@ -715,2 +921,5 @@

if (useFallback === 'touch') {
// Fixed #973:
_on(document, 'touchmove', _preventScroll);
// Bind touch events

@@ -732,2 +941,3 @@ _on(document, 'touchmove', _this._onTouchMove);

_this._loopId = setInterval(_this._emulateDragOver, 50);
_toggleClass(dragEl, options.dragClass, false);
}

@@ -742,9 +952,8 @@ else {

// #1143: Бывает элемент с IFrame внутри блокирует `drop`,
// поэтому если вызвался `mouseover`, значит надо отменять весь d'n'd.
// Breaking Chrome 62+
// _on(document, 'mouseover', _this);
// #1276 fix:
_css(dragEl, 'transform', 'translateZ(0)');
_this._dragStartId = _nextTick(_this._dragStarted);
}
_on(document, 'selectstart', _this);
},

@@ -763,15 +972,37 @@

isMovingBetweenSortable = false,
canSort = options.sort;
canSort = options.sort
;
if (evt.rootEl !== void 0 && evt.rootEl !== this.el) return; // touch fallback
// no bubbling and not fallback
if (!options.dragoverBubble && !evt.rootEl) {
this._handleAutoScroll(evt);
dragEl.parentNode[expando]._computeIsAligned(evt);
}
if (evt.preventDefault !== void 0) {
evt.preventDefault();
evt.cancelable && evt.preventDefault();
!options.dragoverBubble && evt.stopPropagation();
}
if (dragEl.animated) {
moved = true;
target = _closest(evt.target, options.draggable, el, true);
if (dragEl.animated && target === dragEl || target.animated || _silent) {
return;
}
moved = true;
if (target !== lastTarget) {
isCircumstantialInvert = false;
pastFirstInvertThresh = false;
lastTarget = null;
}
if (activeSortable && !options.disabled &&

@@ -783,26 +1014,24 @@ (isOwner

(
(activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
(this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
group.checkPut(this, activeSortable, dragEl, evt)
)
)
) &&
(evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
)
) {
// Smart auto-scrolling
_autoScroll(evt, options, this.el);
var direction;
var axis = this._getDirection(evt, target);
if (_silent) {
return;
}
target = _closest(evt.target, options.draggable, el);
dragRect = dragEl.getBoundingClientRect();
if (putSortable !== this) {
if (putSortable !== this && this !== Sortable.active) {
putSortable = this;
isMovingBetweenSortable = true;
} else if (this === Sortable.active) {
isMovingBetweenSortable = false;
putSortable = null;
}
if (revert) {
_cloneHide(activeSortable, true);
this._hideClone();
parentEl = rootEl; // actualization

@@ -820,9 +1049,8 @@

if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
(el === evt.target) && (_ghostIsLast(el, evt))
(el === evt.target) && _ghostIsLast(evt, axis, el)
) {
//assign target only if condition is true
if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
target = el.lastElementChild;
target = _lastChild(el);
}

@@ -838,8 +1066,14 @@

_cloneHide(activeSortable, isOwner);
if (isOwner) {
activeSortable._hideClone();
} else {
activeSortable._showClone(this);
}
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
if (!dragEl.contains(el)) {
el.appendChild(dragEl);
parentEl = el; // actualization
this._isAligned = true; // must be for _ghostIsLast to pass
realDragElRect = null;
}

@@ -851,38 +1085,31 @@

}
else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
if (lastEl !== target) {
lastEl = target;
lastCSS = _css(target);
lastParentCSS = _css(target.parentNode);
else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0) && target !== el) {
isCircumstantialInvert = isCircumstantialInvert || options.invertSwap || dragEl.parentNode !== el || !this._isAligned;
direction = _getSwapDirection(evt, target, axis,
options.swapThreshold, options.invertedSwapThreshold,
isCircumstantialInvert,
lastTarget === target);
if (direction === 0) return;
realDragElRect = null;
this._isAligned = true;
if (!lastTarget || lastTarget !== target && (!target || !target.animated)) {
pastFirstInvertThresh = false;
lastTarget = target;
}
lastDirection = direction;
targetRect = target.getBoundingClientRect();
var width = targetRect.right - targetRect.left,
height = targetRect.bottom - targetRect.top,
floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
|| (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
isWide = (target.offsetWidth > dragEl.offsetWidth),
isLong = (target.offsetHeight > dragEl.offsetHeight),
halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
nextSibling = target.nextElementSibling,
var nextSibling = target.nextElementSibling,
after = false
;
if (floating) {
var elTop = dragEl.offsetTop,
tgTop = target.offsetTop;
after = direction === 1;
if (elTop === tgTop) {
after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
}
else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
after = (evt.clientY - targetRect.top) / height > 0.5;
} else {
after = tgTop > elTop;
}
} else if (!isMovingBetweenSortable) {
after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
}
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);

@@ -898,3 +1125,7 @@

_cloneHide(activeSortable, isOwner);
if (isOwner) {
activeSortable._hideClone();
} else {
activeSortable._showClone(this);
}

@@ -924,2 +1155,6 @@ if (!dragEl.contains(el)) {

if (target === dragEl) {
realDragElRect = currentRect;
}
if (prevRect.nodeType === 1) {

@@ -929,2 +1164,7 @@ prevRect = prevRect.getBoundingClientRect();

// Check if actually moving position
if ((prevRect.left + prevRect.width / 2) === (currentRect.left + currentRect.width / 2)
&& (prevRect.top + prevRect.height / 2) === (currentRect.top + currentRect.height / 2)
) return;
_css(target, 'transition', 'none');

@@ -936,3 +1176,3 @@ _css(target, 'transform', 'translate3d('

target.offsetWidth; // repaint
forRepaintDummy = target.offsetWidth; // repaint

@@ -954,2 +1194,3 @@ _css(target, 'transition', 'all ' + ms + 'ms');

_off(document, 'touchmove', _preventScroll);
_off(document, 'touchmove', this._onTouchMove);

@@ -962,3 +1203,3 @@ _off(document, 'pointermove', this._onTouchMove);

_off(ownerDocument, 'pointercancel', this._onDrop);
_off(ownerDocument, 'selectstart', this);
_off(document, 'selectstart', this);
},

@@ -969,5 +1210,12 @@

options = this.options;
scrolling = false;
isCircumstantialInvert = false;
pastFirstInvertThresh = false;
clearInterval(this._loopId);
clearInterval(autoScroll.pid);
clearInterval(pointerElemChangedInterval);
_clearAutoScrolls();
_cancelThrottle();
clearTimeout(this._dragStartTimer);

@@ -979,8 +1227,10 @@

// Unbind events
_off(document, 'mouseover', this);
_off(document, 'mousemove', this._onTouchMove);
if (this.nativeDraggable) {
_off(document, 'drop', this);
_off(el, 'dragstart', this._onDragStart);
_off(document, 'dragover', this._handleAutoScroll);
_off(document, 'dragover', _checkAlignment);
}

@@ -992,3 +1242,3 @@

if (moved) {
evt.preventDefault();
evt.cancelable && evt.preventDefault();
!options.dropBubble && evt.stopPropagation();

@@ -999,3 +1249,3 @@ }

if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
if (rootEl === parentEl || (putSortable && putSortable.lastPutMode !== 'clone')) {
// Remove clone

@@ -1018,3 +1268,3 @@ cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);

// Drag stop event
_dispatchEvent(this, rootEl, 'unchoose', dragEl, parentEl, rootEl, oldIndex);
_dispatchEvent(this, rootEl, 'unchoose', dragEl, parentEl, rootEl, oldIndex, null, evt);

@@ -1026,11 +1276,13 @@ if (rootEl !== parentEl) {

// Add event
_dispatchEvent(null, parentEl, 'add', dragEl, parentEl, rootEl, oldIndex, newIndex);
_dispatchEvent(null, parentEl, 'add', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
// Remove event
_dispatchEvent(this, rootEl, 'remove', dragEl, parentEl, rootEl, oldIndex, newIndex);
_dispatchEvent(this, rootEl, 'remove', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
// drag from one list and drop into another
_dispatchEvent(null, parentEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex);
_dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex);
_dispatchEvent(null, parentEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
_dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
}
putSortable && putSortable.save();
}

@@ -1044,4 +1296,4 @@ else {

// drag & drop within the same list
_dispatchEvent(this, rootEl, 'update', dragEl, parentEl, rootEl, oldIndex, newIndex);
_dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex);
_dispatchEvent(this, rootEl, 'update', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
_dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
}

@@ -1057,3 +1309,3 @@ }

_dispatchEvent(this, rootEl, 'end', dragEl, parentEl, rootEl, oldIndex, newIndex);
_dispatchEvent(this, rootEl, 'end', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);

@@ -1066,3 +1318,2 @@ // Save sorting

}
this._nulling();

@@ -1082,3 +1333,8 @@ },

scrollParentEl =
autoScrolls.length =
pointerElemChangedInterval =
lastPointerElemX =
lastPointerElemY =
tapEvt =

@@ -1089,6 +1345,10 @@ touchEvt =

newIndex =
oldIndex =
lastEl =
lastCSS =
lastTarget =
lastDirection =
forRepaintDummy =
realDragElRect =
putSortable =

@@ -1111,4 +1371,4 @@ activeGroup =

case 'dragenter':
case 'dragover':
case 'dragenter':
if (dragEl) {

@@ -1120,6 +1380,2 @@ this._onDragOver(evt);

case 'mouseover':
this._onDrop(evt);
break;
case 'selectstart':

@@ -1146,3 +1402,3 @@ evt.preventDefault();

el = children[i];
if (_closest(el, options.draggable, this.el)) {
if (_closest(el, options.draggable, this.el, false)) {
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));

@@ -1166,3 +1422,3 @@ }

if (_closest(el, this.options.draggable, rootEl)) {
if (_closest(el, this.options.draggable, rootEl, false)) {
items[id] = el;

@@ -1186,3 +1442,3 @@ }

var store = this.options.store;
store && store.set(this);
store && store.set && store.set(this);
},

@@ -1198,3 +1454,3 @@

closest: function (el, selector) {
return _closest(el, selector || this.options.draggable, this.el);
return _closest(el, selector || this.options.draggable, this.el, false);
},

@@ -1240,3 +1496,2 @@

}
// Remove draggable attributes

@@ -1252,31 +1507,37 @@ Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {

this.el = el = null;
}
};
},
_hideClone: function() {
if (!cloneEl.cloneHidden) {
_css(cloneEl, 'display', 'none');
cloneEl.cloneHidden = true;
}
},
function _cloneHide(sortable, state) {
if (sortable.lastPullMode !== 'clone') {
state = true;
}
_showClone: function(putSortable) {
if (putSortable.lastPutMode !== 'clone') {
this._hideClone();
return;
}
if (cloneEl && (cloneEl.state !== state)) {
_css(cloneEl, 'display', state ? 'none' : '');
if (cloneEl.cloneHidden) {
// show clone at dragEl or original position
if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
rootEl.insertBefore(cloneEl, dragEl);
} else if (nextEl) {
rootEl.insertBefore(cloneEl, nextEl);
} else {
rootEl.appendChild(cloneEl);
}
if (!state) {
if (cloneEl.state) {
if (sortable.options.group.revertClone) {
rootEl.insertBefore(cloneEl, nextEl);
sortable._animate(dragEl, cloneEl);
} else {
rootEl.insertBefore(cloneEl, dragEl);
}
if (this.options.group.revertClone) {
this._animate(dragEl, cloneEl);
}
_css(cloneEl, 'display', '');
cloneEl.cloneHidden = false;
}
cloneEl.state = state;
}
}
};
function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
if (el) {

@@ -1286,5 +1547,7 @@ ctx = ctx || document;

do {
if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector) || (includeCTX && el === ctx)) {
return el;
}
if (el === ctx) break;
/* jshint boss:true */

@@ -1299,5 +1562,5 @@ } while (el = _getParentOrHost(el));

function _getParentOrHost(el) {
var parent = el.host;
return (parent && parent.nodeType) ? parent : el.parentNode;
return (el.host && el !== document && el.host.nodeType)
? el.host
: el.parentNode;
}

@@ -1310,3 +1573,3 @@

}
evt.preventDefault();
evt.cancelable && evt.preventDefault();
}

@@ -1326,3 +1589,3 @@

function _toggleClass(el, name, state) {
if (el) {
if (el && name) {
if (el.classList) {

@@ -1382,11 +1645,19 @@ el.classList[state ? 'add' : 'remove'](name);

function _dispatchEvent(sortable, rootEl, name, targetEl, toEl, fromEl, startIndex, newIndex) {
function _dispatchEvent(sortable, rootEl, name, targetEl, toEl, fromEl, startIndex, newIndex, originalEvt) {
sortable = (sortable || rootEl[expando]);
var evt = document.createEvent('Event'),
var evt,
options = sortable.options,
onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
// Support for new CustomEvent feature
if (window.CustomEvent) {
evt = new CustomEvent(name, {
bubbles: true,
cancelable: true
});
} else {
evt = document.createEvent('Event');
evt.initEvent(name, true, true);
}
evt.initEvent(name, true, true);
evt.to = toEl || rootEl;

@@ -1400,2 +1671,4 @@ evt.from = fromEl || rootEl;

evt.originalEvent = originalEvt;
rootEl.dispatchEvent(evt);

@@ -1414,6 +1687,13 @@

retVal;
// Support for new CustomEvent feature
if (window.CustomEvent) {
evt = new CustomEvent('move', {
bubbles: true,
cancelable: true
});
} else {
evt = document.createEvent('Event');
evt.initEvent('move', true, true);
}
evt = document.createEvent('Event');
evt.initEvent('move', true, true);
evt.to = toEl;

@@ -1427,2 +1707,4 @@ evt.from = fromEl;

evt.originalEvent = originalEvt;
fromEl.dispatchEvent(evt);

@@ -1437,3 +1719,2 @@

function _disableDraggable(el) {

@@ -1443,3 +1724,2 @@ el.draggable = false;

function _unsilent() {

@@ -1449,15 +1729,130 @@ _silent = false;

function _getChild(el, childNum, options) {
var currentChild = 0,
i = 0,
children = el.children
;
while (i < children.length) {
if (
children[i].style.display !== 'none' &&
children[i] !== ghostEl &&
children[i] !== dragEl &&
_closest(children[i], options.draggable, el, false)
) {
if (currentChild === childNum) {
return children[i];
}
currentChild++;
}
/** @returns {HTMLElement|false} */
function _ghostIsLast(el, evt) {
var lastEl = el.lastElementChild,
rect = lastEl.getBoundingClientRect();
i++;
}
return null;
}
// 5 — min delta
// abs — нельзя добавлять, а то глюки при наведении сверху
return (evt.clientY - (rect.top + rect.height) > 5) ||
(evt.clientX - (rect.left + rect.width) > 5);
function _lastChild(el) {
var last = el.lastElementChild;
if (last === ghostEl) {
last = el.children[el.childElementCount - 2];
}
return last || null;
}
function _ghostIsLast(evt, axis, el) {
var elRect = _lastChild(el).getBoundingClientRect(),
mouseOnAxis = axis === 'vertical' ? evt.clientY : evt.clientX,
mouseOnOppAxis = axis === 'vertical' ? evt.clientX : evt.clientY,
targetS2 = axis === 'vertical' ? elRect.bottom : elRect.right,
targetS1Opp = axis === 'vertical' ? elRect.left : elRect.top,
targetS2Opp = axis === 'vertical' ? elRect.right : elRect.bottom
;
return (
mouseOnOppAxis > targetS1Opp &&
mouseOnOppAxis < targetS2Opp &&
mouseOnAxis > targetS2
);
}
function _getSwapDirection(evt, target, axis, swapThreshold, invertedSwapThreshold, invertSwap, inside) {
var targetRect = target.getBoundingClientRect(),
mouseOnAxis = axis === 'vertical' ? evt.clientY : evt.clientX,
targetLength = axis === 'vertical' ? targetRect.height : targetRect.width,
targetS1 = axis === 'vertical' ? targetRect.top : targetRect.left,
targetS2 = axis === 'vertical' ? targetRect.bottom : targetRect.right,
dragRect = dragEl.getBoundingClientRect(),
dragLength = axis === 'vertical' ? dragRect.height : dragRect.width,
invert = false
;
var dragStyle = _css(dragEl);
dragLength += parseInt(dragStyle.marginLeft) + parseInt(dragStyle.marginRight);
if (!invertSwap) {
// Never invert or create dragEl shadow when width causes mouse to move past the end of regular swapThreshold
if (inside && dragLength < targetLength * swapThreshold) { // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
// check if past first invert threshold on side opposite of lastDirection
if (!pastFirstInvertThresh &&
(lastDirection === 1 ?
(
mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2
) :
(
mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2
)
)
)
{
// past first invert threshold, do not restrict inverted threshold to dragEl shadow
pastFirstInvertThresh = true;
}
if (!pastFirstInvertThresh) {
var dragS1 = axis === 'vertical' ? dragRect.top : dragRect.left,
dragS2 = axis === 'vertical' ? dragRect.bottom : dragRect.right
;
// dragEl shadow
if (
lastDirection === 1 ?
(
mouseOnAxis < targetS1 + dragLength // over dragEl shadow
) :
(
mouseOnAxis > targetS2 - dragLength
)
)
{
return lastDirection * -1;
}
} else {
invert = true;
}
} else {
// Regular
if (
mouseOnAxis > targetS1 + (targetLength * (1 - swapThreshold) / 2) &&
mouseOnAxis < targetS2 - (targetLength * (1 - swapThreshold) / 2)
) {
return ((mouseOnAxis > targetS1 + targetLength / 2) ? -1 : 1);
}
}
}
invert = invert || invertSwap;
if (invert) {
// Invert of regular
if (
mouseOnAxis < targetS1 + (targetLength * invertedSwapThreshold / 2) ||
mouseOnAxis > targetS2 - (targetLength * invertedSwapThreshold / 2)
)
{
return ((mouseOnAxis > targetS1 + targetLength / 2) ? 1 : -1);
}
}
return 0;
}
/**

@@ -1506,11 +1901,11 @@ * Generate id

if (el) {
selector = selector.split('.');
var tag = selector.shift().toUpperCase(),
re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
return (
(tag === '' || el.nodeName.toUpperCase() == tag) &&
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
);
try {
if (el.matches) {
return el.matches(selector);
} else if (el.msMatchesSelector) {
return el.msMatchesSelector(selector);
}
} catch(_) {
return false;
}
}

@@ -1521,11 +1916,11 @@

var _throttleTimeout;
function _throttle(callback, ms) {
var args, _this;
return function () {
if (args === void 0) {
args = arguments;
_this = this;
if (!_throttleTimeout) {
var args = arguments,
_this = this
;
setTimeout(function () {
_throttleTimeout = setTimeout(function () {
if (args.length === 1) {

@@ -1537,3 +1932,3 @@ callback.call(_this, args[0]);

args = void 0;
_throttleTimeout = void 0;
}, ms);

@@ -1544,2 +1939,7 @@ }

function _cancelThrottle() {
clearTimeout(_throttleTimeout);
_throttleTimeout = void 0;
}
function _extend(dst, src) {

@@ -1570,2 +1970,4 @@ if (dst && src) {

function _saveInputCheckedState(root) {
savedInputChecked.length = 0;
var inputs = root.getElementsByTagName('input');

@@ -1588,9 +1990,9 @@ var idx = inputs.length;

// Fixed #973:
_on(document, 'touchmove', function (evt) {
if (Sortable.active) {
function _preventScroll(evt) {
if (Sortable.active && evt.cancelable) {
evt.preventDefault();
}
});
}
// Export utils

@@ -1603,3 +2005,3 @@ Sortable.utils = {

is: function (el, selector) {
return !!_closest(el, selector, el);
return !!_closest(el, selector, el, false);
},

@@ -1613,3 +2015,5 @@ extend: _extend,

nextTick: _nextTick,
cancelNextTick: _cancelNextTick
cancelNextTick: _cancelNextTick,
detectDirection: _detectDirection,
getChild: _getChild
};

@@ -1629,4 +2033,4 @@

// Export
Sortable.version = '1.7.0';
Sortable.version = '1.8.0-rc1';
return Sortable;
});
});

@@ -1,2 +0,3 @@

/*! Sortable 1.7.0 - MIT | git://github.com/rubaxa/Sortable.git */
!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():window.Sortable=a()}(function(){"use strict";function a(b,c){if(!b||!b.nodeType||1!==b.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(b);this.el=b,this.options=c=t({},c),b[V]=this;var d={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(b.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:a.supportPointer!==!1};for(var e in d)!(e in c)&&(c[e]=d[e]);ka(c);for(var g in this)"_"===g.charAt(0)&&"function"==typeof this[g]&&(this[g]=this[g].bind(this));this.nativeDraggable=!c.forceFallback&&ca,f(b,"mousedown",this._onTapStart),f(b,"touchstart",this._onTapStart),c.supportPointer&&f(b,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(b,"dragover",this),f(b,"dragenter",this)),ia.push(this._onDragOver),c.store&&this.sort(c.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),B&&B.state!==b&&(i(B,"display",b?"none":""),b||B.state&&(a.options.group.revertClone?(C.insertBefore(B,D),a._animate(y,B)):C.insertBefore(B,y)),B.state=b)}function c(a,b,c){if(a){c=c||X;do if(">*"===b&&a.parentNode===c||r(a,b))return a;while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,aa)}function g(a,b,c){a.removeEventListener(b,c,aa)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(T," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(T," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return X.defaultView&&X.defaultView.getComputedStyle?c=X.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e<f;e++)c(d[e],e);return d}return[]}function k(a,b,c,d,e,f,g,h){a=a||b[V];var i=X.createEvent("Event"),j=a.options,k="on"+c.charAt(0).toUpperCase()+c.substr(1);i.initEvent(c,!0,!0),i.to=e||b,i.from=f||b,i.item=d||b,i.clone=B,i.oldIndex=g,i.newIndex=h,b.dispatchEvent(i),j[k]&&j[k].call(a,i)}function l(a,b,c,d,e,f,g,h){var i,j,k=a[V],l=k.options.onMove;return i=X.createEvent("Event"),i.initEvent("move",!0,!0),i.to=b,i.from=a,i.dragged=c,i.draggedRect=d,i.related=e||b,i.relatedRect=f||b.getBoundingClientRect(),i.willInsertAfter=h,a.dispatchEvent(i),l&&(j=l.call(k,i,g)),j}function m(a){a.draggable=!1}function n(){ea=!1}function o(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return b.clientY-(d.top+d.height)>5||b.clientX-(d.left+d.width)>5}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,Z(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return _&&_.dom?_.dom(a).cloneNode(!0):$?$(a).clone(!0)[0]:a.cloneNode(!0)}function v(a){for(var b=a.getElementsByTagName("input"),c=b.length;c--;){var d=b[c];d.checked&&ha.push(d)}}function w(a){return Z(a,0)}function x(a){return clearTimeout(a)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S={},T=/\s+/g,U=/left|right|inline/,V="Sortable"+(new Date).getTime(),W=window,X=W.document,Y=W.parseInt,Z=W.setTimeout,$=W.jQuery||W.Zepto,_=W.Polymer,aa=!1,ba=!1,ca="draggable"in X.createElement("div"),da=function(a){return!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie)/i)&&(a=X.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),ea=!1,fa=Math.abs,ga=Math.min,ha=[],ia=[],ja=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[V],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(G!==c&&(F=b.scroll,G=c,H=b.scrollFn,F===!0)){F=c;do if(F.offsetWidth<F.scrollWidth||F.offsetHeight<F.scrollHeight)break;while(F=F.parentNode)}F&&(d=F,e=F.getBoundingClientRect(),f=(fa(e.right-m)<=k)-(fa(e.left-m)<=k),g=(fa(e.bottom-n)<=k)-(fa(e.top-n)<=k)),f||g||(f=(o-m<=k)-(m<=k),g=(p-n<=k)-(n<=k),(f||g)&&(d=W)),S.vx===f&&S.vy===g&&S.el===d||(S.el=d,S.vx=f,S.vy=g,clearInterval(S.pid),d&&(S.pid=setInterval(function(){return i=g?g*l:0,h=f?f*l:0,"function"==typeof H?H.call(j,h,i,a):void(d===W?W.scrollTo(W.pageXOffset+h,W.pageYOffset+i):(d.scrollTop+=i,d.scrollLeft+=h))},24)))}},30),ka=function(a){function b(a,b){return void 0!==a&&a!==!0||(a=c.name),"function"==typeof a?a:function(c,d){var e=d.options.group.name;return b?a:a&&(a.join?a.indexOf(e)>-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){ba=!1,aa={capture:!1,passive:ba}}}))}catch(a){}return a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path&&a.path[0]||j,m=f.filter;if(v(e),!y&&!(/mousedown|pointerdown/.test(h)&&0!==a.button||f.disabled)&&!l.isContentEditable&&(j=c(j,f.draggable,e),j&&E!==j)){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!y&&c.parentNode===i&&(P=a,C=i,y=c,z=y.parentNode,D=y.nextSibling,E=c,N=l.group,L=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,y.style["will-change"]="all",e=function(){g._disableDelayedDrag(),y.draggable=g.nativeDraggable,h(y,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,C,"choose",y,C,C,L)},l.ignore.split(",").forEach(function(a){j(y,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"selectstart",g),l.supportPointer&&f(n,"pointercancel",g._onDrop),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),l.supportPointer&&f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=Z(e,l.delay)):e())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(P={target:y,clientX:b.clientX,clientY:b.clientY},this._onDragStart(P,"touch")):this.nativeDraggable?(f(y,"dragend",this),f(C,"dragstart",this._onDragStart)):this._onDragStart(P,!0);try{X.selection?w(function(){X.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(C&&y){var b=this.options;h(y,b.ghostClass,!0),h(y,b.dragClass,!1),a.active=this,k(this,C,"start",y,C,C,L)}else this._nulling()},_emulateDragOver:function(){if(Q){if(this._lastX===Q.clientX&&this._lastY===Q.clientY)return;this._lastX=Q.clientX,this._lastY=Q.clientY,da||i(A,"display","none");var a=X.elementFromPoint(Q.clientX,Q.clientY),b=a,c=ia.length;if(a&&a.shadowRoot&&(a=a.shadowRoot.elementFromPoint(Q.clientX,Q.clientY),b=a),b)do{if(b[V]){for(;c--;)ia[c]({clientX:Q.clientX,clientY:Q.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);da||i(A,"display","")}},_onTouchMove:function(b){if(P){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-P.clientX+e.x,h=f.clientY-P.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&ga(fa(f.clientX-this._lastX),fa(f.clientY-this._lastY))<d)return;this._dragStarted()}this._appendGhost(),R=!0,Q=f,i(A,"webkitTransform",j),i(A,"mozTransform",j),i(A,"msTransform",j),i(A,"transform",j),b.preventDefault()}},_appendGhost:function(){if(!A){var a,b=y.getBoundingClientRect(),c=i(y),d=this.options;A=y.cloneNode(!0),h(A,d.ghostClass,!1),h(A,d.fallbackClass,!0),h(A,d.dragClass,!0),i(A,"top",b.top-Y(c.marginTop,10)),i(A,"left",b.left-Y(c.marginLeft,10)),i(A,"width",b.width),i(A,"height",b.height),i(A,"opacity","0.8"),i(A,"position","fixed"),i(A,"zIndex","100000"),i(A,"pointerEvents","none"),d.fallbackOnBody&&X.body.appendChild(A)||C.appendChild(A),a=A.getBoundingClientRect(),i(A,"width",2*b.width-a.width),i(A,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=this,d=a.dataTransfer,e=c.options;c._offUpEvents(),N.checkPull(c,c,y,a)&&(B=u(y),B.draggable=!1,B.style["will-change"]="",i(B,"display","none"),h(B,c.options.chosenClass,!1),c._cloneId=w(function(){C.insertBefore(B,y),k(c,C,"clone",y)})),h(y,e.dragClass,!0),b?("touch"===b?(f(X,"touchmove",c._onTouchMove),f(X,"touchend",c._onDrop),f(X,"touchcancel",c._onDrop),e.supportPointer&&(f(X,"pointermove",c._onTouchMove),f(X,"pointerup",c._onDrop))):(f(X,"mousemove",c._onTouchMove),f(X,"mouseup",c._onDrop)),c._loopId=setInterval(c._emulateDragOver,50)):(d&&(d.effectAllowed="move",e.setData&&e.setData.call(c,d,y)),f(X,"drop",c),c._dragStartId=w(c._dragStarted))},_onDragOver:function(d){var e,f,g,h,j=this.el,k=this.options,m=k.group,p=a.active,q=N===m,r=!1,s=k.sort;if(void 0!==d.preventDefault&&(d.preventDefault(),!k.dragoverBubble&&d.stopPropagation()),!y.animated&&(R=!0,p&&!k.disabled&&(q?s||(h=!C.contains(y)):O===this||(p.lastPullMode=N.checkPull(this,p,y,d))&&m.checkPut(this,p,y,d))&&(void 0===d.rootEl||d.rootEl===this.el))){if(ja(d,k,this.el),ea)return;if(e=c(d.target,k.draggable,j),f=y.getBoundingClientRect(),O!==this&&(O=this,r=!0),h)return b(p,!0),z=C,void(B||D?C.insertBefore(y,B||D):s||C.appendChild(y));if(0===j.children.length||j.children[0]===A||j===d.target&&o(j,d)){if(0!==j.children.length&&j.children[0]!==A&&j===d.target&&(e=j.lastElementChild),e){if(e.animated)return;g=e.getBoundingClientRect()}b(p,q),l(C,j,y,f,e,g,d)!==!1&&(y.contains(j)||(j.appendChild(y),z=j),this._animate(f,y),e&&this._animate(g,e))}else if(e&&!e.animated&&e!==y&&void 0!==e.parentNode[V]){I!==e&&(I=e,J=i(e),K=i(e.parentNode)),g=e.getBoundingClientRect();var t=g.right-g.left,u=g.bottom-g.top,v=U.test(J.cssFloat+J.display)||"flex"==K.display&&0===K["flex-direction"].indexOf("row"),w=e.offsetWidth>y.offsetWidth,x=e.offsetHeight>y.offsetHeight,E=(v?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,F=e.nextElementSibling,G=!1;if(v){var H=y.offsetTop,L=e.offsetTop;G=H===L?e.previousElementSibling===y&&!w||E&&w:e.previousElementSibling===y||y.previousElementSibling===e?(d.clientY-g.top)/u>.5:L>H}else r||(G=F!==y&&!x||E&&x);var M=l(C,j,y,f,e,g,d,G);M!==!1&&(1!==M&&M!==-1||(G=1===M),ea=!0,Z(n,30),b(p,q),y.contains(j)||(G&&!F?j.appendChild(y):e.parentNode.insertBefore(y,G?F:e)),z=y.parentNode,this._animate(f,y),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=Z(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(X,"touchmove",this._onTouchMove),g(X,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop),g(a,"pointercancel",this._onDrop),g(a,"selectstart",this)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(S.pid),clearTimeout(this._dragStartTimer),x(this._cloneId),x(this._dragStartId),g(X,"mouseover",this),g(X,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(X,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(R&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),A&&A.parentNode&&A.parentNode.removeChild(A),C!==z&&"clone"===a.active.lastPullMode||B&&B.parentNode&&B.parentNode.removeChild(B),y&&(this.nativeDraggable&&g(y,"dragend",this),m(y),y.style["will-change"]="",h(y,this.options.ghostClass,!1),h(y,this.options.chosenClass,!1),k(this,C,"unchoose",y,z,C,L),C!==z?(M=q(y,d.draggable),M>=0&&(k(null,z,"add",y,z,C,L,M),k(this,C,"remove",y,z,C,L,M),k(null,z,"sort",y,z,C,L,M),k(this,C,"sort",y,z,C,L,M))):y.nextSibling!==D&&(M=q(y,d.draggable),M>=0&&(k(this,C,"update",y,z,C,L,M),k(this,C,"sort",y,z,C,L,M))),a.active&&(null!=M&&M!==-1||(M=L),k(this,C,"end",y,z,C,L,M),this.save()))),this._nulling()},_nulling:function(){C=y=z=A=D=B=E=F=G=P=Q=R=M=I=J=O=N=a.active=null,ha.forEach(function(a){a.checked=!0}),ha.length=0},handleEvent:function(a){switch(a.type){case"drop":case"dragend":this._onDrop(a);break;case"dragover":case"dragenter":y&&(this._onDragOver(a),e(a));break;case"mouseover":this._onDrop(a);break;case"selectstart":a.preventDefault()}},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e<f;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||p(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&ka(c)))},destroy:function(){var a=this.el;a[V]=null,g(a,"mousedown",this._onTapStart),g(a,"touchstart",this._onTapStart),g(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(g(a,"dragover",this),g(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),ia.splice(ia.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},f(X,"touchmove",function(b){a.active&&b.preventDefault()}),a.utils={on:f,off:g,css:i,find:j,is:function(a,b){return!!c(a,b,a)},extend:t,throttle:s,closest:c,toggleClass:h,clone:u,index:q,nextTick:w,cancelNextTick:x},a.create=function(b,c){return new a(b,c)},a.version="1.7.0",a});
/*! Sortable 1.8.0-rc1 - MIT | git://github.com/SortableJS/Sortable.git */
!function(t){"use strict";"function"==typeof define&&define.amd?define(t):"undefined"!=typeof module&&void 0!==module.exports?module.exports=t():window.Sortable=t()}(function(){"use strict";if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var T,S,E,x,A,B,h,w,y,D,c,i,N,P,l,s,d,u,C,X,Y,k,R,t,o,I=[],M=!1,H=!1,O=!1,r=/\s+/g,L="Sortable"+(new Date).getTime(),F=window,f=F.document,W=F.parseInt,U=F.setTimeout,e=F.jQuery||F.Zepto,n=F.Polymer,a={capture:!1,passive:!1},p="draggable"in f.createElement("div"),g=!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie)/i)&&((t=f.createElement("x")).style.cssText="pointer-events:auto","auto"===t.style.pointerEvents),j=!1,v=!1,z=Math.abs,m=Math.min,_=[],b=[],V=function(t,e){var n=it(t),i=W(n.width),o=ct(t,0,e),r=ct(t,1,e),a=o&&it(o),l=r&&it(r),s=a&&W(a.marginLeft)+W(a.marginRight)+o.getBoundingClientRect().width,c=l&&W(l.marginLeft)+W(l.marginRight)+r.getBoundingClientRect().width;return"flex"===n.display?"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal":o&&("block"===a.display||"grid"===a.display||i<=s&&"none"===n.float||r&&"none"===n.float&&i<s+c)?"vertical":"horizontal"},q=function(t,e){if(!t||!t.getBoundingClientRect)return F;var n=t,i=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=it(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n||!n.getBoundingClientRect||n===f.body)return F;if(i||e)return n;i=!0}}}while(n=n.parentNode);return F},G=pt(function(n,t,e,i){if(t.scroll){var o,r,a,l,s=e?e[L]:window,c=t.scrollSensitivity,d=t.scrollSpeed,h=n.clientX,u=n.clientY,f=window.innerWidth,p=window.innerHeight,g=!1;y!==e&&(Z(),w=t.scroll,D=t.scrollFn,!0===w&&(w=q(e,!0),y=w));var v=0,m=w;do{var _;if(m&&m!==F?(r=it(_=m),o=m.getBoundingClientRect(),a=_.clientWidth<_.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)&&(z(o.right-h)<=c)-(z(o.left-h)<=c),l=_.clientHeight<_.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)&&(z(o.bottom-u)<=c)-(z(o.top-u)<=c)):m===F&&(_=F,a=(f-h<=c)-(h<=c),l=(p-u<=c)-(u<=c)),!I[v])for(var b=0;b<=v;b++)I[b]||(I[b]={});I[v].vx==a&&I[v].vy==l&&I[v].el===_||(I[v].el=_,I[v].vx=a,I[v].vy=l,clearInterval(I[v].pid),!_||0==a&&0==l||(g=!0,I[v].pid=setInterval(function(){i&&0===this.layer&&K.active._emulateDragOver(!0);var t=I[this.layer].vy?I[this.layer].vy*d:0,e=I[this.layer].vx?I[this.layer].vx*d:0;"function"==typeof D&&"continue"!==D.call(s,e,t,n,C,I[this.layer].el)||(I[this.layer].el===F?F.scrollTo(F.pageXOffset+e,F.pageYOffset+t):(I[this.layer].el.scrollTop+=t,I[this.layer].el.scrollLeft+=e))}.bind({layer:v}),24))),v++}while(t.bubbleScroll&&m!==F&&(m=q(m,!1)));M=g}},30),Z=function(){I.forEach(function(t){clearInterval(t.pid)}),I=[]},Q=function(t){function e(a,l){return function(t,e,n,i){var o;if(null==a&&l)o=!0;else if(null==a||!1===a)o=!1;else if(l&&"clone"===a)o=a;else if("function"==typeof a)o=a(t,e,n,i);else{var r=(l?t:e).options.group.name;o=!0===a||"string"==typeof a&&a===r||a.join&&-1<a.indexOf(r)}return o||t.options.group.name&&e.options.group.name&&t.options.group.name===e.options.group.name}}var n={},i=t.group;i&&"object"==typeof i||(i={name:i}),n.name=i.name,n.checkPull=e(i.pull,!0),n.checkPut=e(i.put),n.revertClone=i.revertClone,t.group=n},J=function(t){T&&T.parentNode[L]&&T.parentNode[L]._computeIsAligned(t)};function K(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(t);this.el=t,this.options=e=gt({},e),t[L]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0,draggable:/[uo]l/i.test(t.nodeName)?"li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,touchStartThreshold:W(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==K.supportPointer&&("PointerEvent"in window||window.navigator&&"msPointerEnabled"in window.navigator)};for(var i in n)!(i in e)&&(e[i]=n[i]);for(var o in"direction"in e||(e.direction=function(){return V(t,e)}),Q(e),null==e.invertedSwapThreshold&&(e.invertedSwapThreshold=e.swapThreshold),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!e.forceFallback&&p,tt(t,"mousedown",this._onTapStart),tt(t,"touchstart",this._onTapStart),e.supportPointer&&tt(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(tt(t,"dragover",this),tt(t,"dragenter",this)),b.push(this._onDragOver),e.store&&e.store.get&&this.sort(e.store.get(this)||[])}function $(t,e,n,i){if(t){n=n||f;do{if(">*"===e&&t.parentNode===n||ft(t,e)||i&&t===n)return t;if(t===n)break}while(t=(o=t).host&&o!==f&&o.host.nodeType?o.host:o.parentNode)}var o;return null}function tt(t,e,n){t.addEventListener(e,n,a)}function et(t,e,n){t.removeEventListener(e,n,a)}function nt(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(r," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(r," ")}}function it(t,e,n){var i=t&&t.style;if(i){if(void 0===n)return f.defaultView&&f.defaultView.getComputedStyle?n=f.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in i||(e="-webkit-"+e),i[e]=n+("string"==typeof n?"":"px")}}function ot(t,e,n){if(t){var i=t.getElementsByTagName(e),o=0,r=i.length;if(n)for(;o<r;o++)n(i[o],o);return i}return[]}function rt(t,e,n,i,o,r,a,l,s){var c,d=(t=t||e[L]).options,h="on"+n.charAt(0).toUpperCase()+n.substr(1);window.CustomEvent?c=new CustomEvent(n,{bubbles:!0,cancelable:!0}):(c=f.createEvent("Event")).initEvent(n,!0,!0),c.to=o||e,c.from=r||e,c.item=i||e,c.clone=x,c.oldIndex=a,c.newIndex=l,c.originalEvent=s,e.dispatchEvent(c),d[h]&&d[h].call(t,c)}function at(t,e,n,i,o,r,a,l){var s,c,d=t[L],h=d.options.onMove;return window.CustomEvent?s=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(s=f.createEvent("Event")).initEvent("move",!0,!0),s.to=e,s.from=t,s.dragged=n,s.draggedRect=i,s.related=o||e,s.relatedRect=r||e.getBoundingClientRect(),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),h&&(c=h.call(d,s,a)),c}function lt(t){t.draggable=!1}function st(){j=!1}function ct(t,e,n){for(var i=0,o=0,r=t.children;o<r.length;){if("none"!==r[o].style.display&&r[o]!==E&&r[o]!==T&&$(r[o],n.draggable,t,!1)){if(i===e)return r[o];i++}o++}return null}function dt(t){var e=t.lastElementChild;return e===E&&(e=t.children[t.childElementCount-2]),e||null}function ht(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,i=0;n--;)i+=e.charCodeAt(n);return i.toString(36)}function ut(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t&&(t=t.previousElementSibling);)"TEMPLATE"===t.nodeName.toUpperCase()||">*"!==e&&!ft(t,e)||n++;return n}function ft(t,e){if(t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e)}catch(t){return!1}return!1}function pt(n,i){return function(){if(!o){var t=arguments,e=this;o=U(function(){1===t.length?n.call(e,t[0]):n.apply(e,t),o=void 0},i)}}}function gt(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function vt(t){return n&&n.dom?n.dom(t).cloneNode(!0):e?e(t).clone(!0)[0]:t.cloneNode(!0)}function mt(t){return U(t,0)}function _t(t){return clearTimeout(t)}function bt(t){K.active&&t.cancelable&&t.preventDefault()}return K.prototype={constructor:K,_isAligned:!0,_computeIsAligned:function(t,e){var n,i,o,r,a,l,s;v||T&&T.parentNode===this.el&&(!0!==e&&!1!==e&&(e=!!$(t.target,null,T,!0)),this._isAligned=!M&&(e||this._isAligned&&(n=t.clientX,i=t.clientY,this.el,o=this._getDirection(t,null),this.options,r=R||T.getBoundingClientRect(),a="vertical"===o?r.left:r.top,l="vertical"===o?r.right:r.bottom,a<(s="vertical"===o?n:i)&&s<l)),v=!0,U(function(){v=!1},30))},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,T):this.options.direction},_onTapStart:function(t){var e,n=this,i=this.el,o=this.options,r=o.preventOnFilter,a=t.type,l=t.touches&&t.touches[0],s=(l||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,d=o.filter;if(function(t){_.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var i=e[n];i.checked&&_.push(i)}}(i),!T&&!(/mousedown|pointerdown/.test(a)&&0!==t.button||o.disabled)&&!c.isContentEditable&&(s=$(s,o.draggable,i,!0))&&h!==s){if(e=ut(s,o.draggable),"function"==typeof d){if(d.call(this,t,s,this))return rt(n,c,"filter",s,i,i,e),void(r&&t.cancelable&&t.preventDefault())}else if(d&&(d=d.split(",").some(function(t){if(t=$(c,t.trim(),i,!1))return rt(n,t,"filter",s,i,i,e),!0})))return void(r&&t.cancelable&&t.preventDefault());o.handle&&!$(c,o.handle,i,!1)||this._prepareDragStart(t,l,s,e)}},_handleAutoScroll:function(e,t){if(T&&this.options.scroll){var n=e.clientX,i=e.clientY,o=f.elementFromPoint(n,i),r=this;if(t||window.navigator&&-1<window.navigator.userAgent.toLowerCase().indexOf("firefox")){G(e,r.options,o,!0);var a=q(o,!0);!M||l&&n===s&&i===d||(l&&clearInterval(l),l=setInterval(function(){if(T){var t=q(f.elementFromPoint(n,i),!0);t!==a&&(a=t,Z(),G(e,r.options,a,!0))}},10),s=n,d=i)}else{if(!r.options.bubbleScroll||q(o,!0)===window)return void Z();G(e,r.options,q(o,!1))}}},_prepareDragStart:function(t,e,n,i){var o,r=this,a=r.el,l=r.options,s=a.ownerDocument;n&&!T&&n.parentNode===a&&(u=t,A=a,S=(T=n).parentNode,B=T.nextSibling,h=n,N=l.group,c=i,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,T.style["will-change"]="all",o=function(){r._disableDelayedDrag(),T.draggable=r.nativeDraggable,r._triggerDragStart(t,e),rt(r,A,"choose",T,A,A,c),nt(T,l.chosenClass,!0)},l.ignore.split(",").forEach(function(t){ot(T,t.trim(),lt)}),tt(s,"mouseup",r._onDrop),tt(s,"touchend",r._onDrop),tt(s,"touchcancel",r._onDrop),l.supportPointer&&tt(s,"pointercancel",r._onDrop),l.delay?(tt(s,"mouseup",r._disableDelayedDrag),tt(s,"touchend",r._disableDelayedDrag),tt(s,"touchcancel",r._disableDelayedDrag),tt(s,"mousemove",r._delayedDragTouchMoveHandler),tt(s,"touchmove",r._delayedDragTouchMoveHandler),l.supportPointer&&tt(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=U(o.bind(r),l.delay)):o())},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;m(z(e.clientX-this._lastX),z(e.clientY-this._lastY))>=this.options.touchStartThreshold&&this._disableDelayedDrag()},_disableDelayedDrag:function(){var t=this.el.ownerDocument;clearTimeout(this._dragStartTimer),et(t,"mouseup",this._disableDelayedDrag),et(t,"touchend",this._disableDelayedDrag),et(t,"touchcancel",this._disableDelayedDrag),et(t,"mousemove",this._delayedDragTouchMoveHandler),et(t,"touchmove",this._delayedDragTouchMoveHandler),et(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){(e=e||("touch"==t.pointerType?t:null))?(u={target:T,clientX:e.clientX,clientY:e.clientY},this._onDragStart(u,"touch")):this.nativeDraggable?(tt(T,"dragend",this),tt(A,"dragstart",this._onDragStart)):this._onDragStart(u,!0);try{f.selection?mt(function(){f.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(){if(A&&T){this.nativeDraggable&&(tt(f,"dragover",this._handleAutoScroll),tt(f,"dragover",J));var t=this.options;nt(T,t.dragClass,!1),nt(T,t.ghostClass,!0),it(T,"transform",""),(K.active=this)._isAligned=!0,rt(this,A,"start",T,A,A,c)}else this._nulling()},_emulateDragOver:function(t){if(C){if(this._lastX===C.clientX&&this._lastY===C.clientY&&!t)return;this._lastX=C.clientX,this._lastY=C.clientY,g||it(E,"display","none");for(var e=f.elementFromPoint(C.clientX,C.clientY),n=e,i=!!$(e,null,T,!0);e&&e.shadowRoot;)n=e=e.shadowRoot.elementFromPoint(C.clientX,C.clientY);if(n)do{if(n[L]){for(var o=b.length;o--;)b[o]({clientX:C.clientX,clientY:C.clientY,target:e,rootEl:n});if(!this.options.dragoverBubble)break}e=n}while(n=n.parentNode);T.parentNode[L]._computeIsAligned(C,i),g||it(E,"display","")}},_onTouchMove:function(t){if(u){var e=this.options,n=e.fallbackTolerance,i=e.fallbackOffset,o=t.touches?t.touches[0]:t,r=o.clientX-u.clientX+i.x,a=o.clientY-u.clientY+i.y,l=t.touches?"translate3d("+r+"px,"+a+"px,0)":"translate("+r+"px,"+a+"px)";if(this.options.supportPointer&&"touchmove"===t.type)return;if(!K.active){if(n&&m(z(o.clientX-this._lastX),z(o.clientY-this._lastY))<n)return;this._dragStarted()}this._appendGhost(),this._handleAutoScroll(o,!0),X=!0,C=o,it(E,"webkitTransform",l),it(E,"mozTransform",l),it(E,"msTransform",l),it(E,"transform",l),t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!E){var t,e=T.getBoundingClientRect(),n=it(T),i=this.options;nt(E=T.cloneNode(!0),i.ghostClass,!1),nt(E,i.fallbackClass,!0),nt(E,i.dragClass,!0),it(E,"top",e.top-W(n.marginTop,10)),it(E,"left",e.left-W(n.marginLeft,10)),it(E,"width",e.width),it(E,"height",e.height),it(E,"opacity","0.8"),it(E,"position","fixed"),it(E,"zIndex","100000"),it(E,"pointerEvents","none"),i.fallbackOnBody&&f.body.appendChild(E)||A.appendChild(E),t=E.getBoundingClientRect(),it(E,"width",2*e.width-t.width),it(E,"height",2*e.height-t.height)}},_onDragStart:function(t,e){var n=this,i=t.dataTransfer,o=n.options;n._offUpEvents(),N.checkPull(n,n,T,t)&&((x=vt(T)).draggable=!1,x.style["will-change"]="",this._hideClone(),nt(x,n.options.chosenClass,!1),n._cloneId=mt(function(){A.insertBefore(x,T),rt(n,A,"clone",T)})),nt(T,o.dragClass,!0),e?("touch"===e?(tt(f,"touchmove",bt),tt(f,"touchmove",n._onTouchMove),tt(f,"touchend",n._onDrop),tt(f,"touchcancel",n._onDrop),o.supportPointer&&(tt(f,"pointermove",n._onTouchMove),tt(f,"pointerup",n._onDrop))):(tt(f,"mousemove",n._onTouchMove),tt(f,"mouseup",n._onDrop)),n._loopId=setInterval(n._emulateDragOver,50),nt(T,o.dragClass,!1)):(i&&(i.effectAllowed="move",o.setData&&o.setData.call(n,i,T)),tt(f,"drop",n),it(T,"transform","translateZ(0)"),n._dragStartId=mt(n._dragStarted)),tt(f,"selectstart",n)},_onDragOver:function(t){var e,n,i,o,r,a,l,s,c,d,h,u,f=this.el,p=this.options,g=p.group,v=K.active,m=N===g,_=p.sort;if((void 0===t.rootEl||t.rootEl===this.el)&&(p.dragoverBubble||t.rootEl||(this._handleAutoScroll(t),T.parentNode[L]._computeIsAligned(t)),void 0!==t.preventDefault&&(t.cancelable&&t.preventDefault(),!p.dragoverBubble&&t.stopPropagation()),X=!0,e=$(t.target,p.draggable,f,!0),!(T.animated&&e===T||e.animated||j)&&(e!==Y&&(H=O=!1,Y=null),v&&!p.disabled&&(m?_||(o=!A.contains(T)):P===this||(this.lastPutMode=N.checkPull(this,v,T,t))&&g.checkPut(this,v,T,t))))){var b,w=this._getDirection(t,e);if(n=T.getBoundingClientRect(),P!==this&&this!==K.active?(P=this,!0):this===K.active&&(!1,P=null),o)return this._hideClone(),S=A,void(x||B?A.insertBefore(T,x||B):_||A.appendChild(T));if(0===f.children.length||f.children[0]===E||f===t.target&&(r=t,a=w,l=dt(f).getBoundingClientRect(),s="vertical"===a?r.clientY:r.clientX,c="vertical"===a?r.clientX:r.clientY,d="vertical"===a?l.bottom:l.right,h="vertical"===a?l.left:l.top,u="vertical"===a?l.right:l.bottom,h<c&&c<u&&d<s)){if(0!==f.children.length&&f.children[0]!==E&&f===t.target&&(e=dt(f)),e){if(e.animated)return;i=e.getBoundingClientRect()}m?v._hideClone():v._showClone(this),!1!==at(A,f,T,n,e,i,t,!!e)&&(T.contains(f)||(f.appendChild(T),S=f,this._isAligned=!0,R=null),this._animate(n,T),e&&this._animate(i,e))}else if(e&&!e.animated&&e!==T&&void 0!==e.parentNode[L]&&e!==f){if(O=O||p.invertSwap||T.parentNode!==f||!this._isAligned,0===(b=function(t,e,n,i,o,r,a){var l=e.getBoundingClientRect(),s="vertical"===n?t.clientY:t.clientX,c="vertical"===n?l.height:l.width,d="vertical"===n?l.top:l.left,h="vertical"===n?l.bottom:l.right,u=T.getBoundingClientRect(),f="vertical"===n?u.height:u.width,p=!1,g=it(T);if(f+=W(g.marginLeft)+W(g.marginRight),!r)if(a&&f<c*i)if(!H&&(1===k?d+c*o/2<s:s<h-c*o/2)&&(H=!0),H)p=!0;else{"vertical"===n?u.top:u.left,"vertical"===n?u.bottom:u.right;if(1===k?s<d+f:h-f<s)return-1*k}else if(d+c*(1-i)/2<s&&s<h-c*(1-i)/2)return d+c/2<s?-1:1;if((p=p||r)&&(s<d+c*o/2||h-c*o/2<s))return d+c/2<s?1:-1;return 0}(t,e,w,p.swapThreshold,p.invertedSwapThreshold,O,Y===e)))return;R=null,this._isAligned=!0,Y&&(Y===e||e&&e.animated)||(H=!1,Y=e),k=b,i=e.getBoundingClientRect();var y=e.nextElementSibling,D=!1,C=at(A,f,T,n,e,i,t,D=1===b);!1!==C&&(1!==C&&-1!==C||(D=1===C),j=!0,U(st,30),m?v._hideClone():v._showClone(this),T.contains(f)||(D&&!y?f.appendChild(T):e.parentNode.insertBefore(T,D?y:e)),S=T.parentNode,this._animate(n,T),this._animate(i,e))}}},_animate:function(t,e){var n=this.options.animation;if(n){var i=e.getBoundingClientRect();if(e===T&&(R=i),1===t.nodeType&&(t=t.getBoundingClientRect()),t.left+t.width/2===i.left+i.width/2&&t.top+t.height/2===i.top+i.height/2)return;it(e,"transition","none"),it(e,"transform","translate3d("+(t.left-i.left)+"px,"+(t.top-i.top)+"px,0)"),e.offsetWidth,it(e,"transition","all "+n+"ms"),it(e,"transform","translate3d(0,0,0)"),clearTimeout(e.animated),e.animated=U(function(){it(e,"transition",""),it(e,"transform",""),e.animated=!1},n)}},_offUpEvents:function(){var t=this.el.ownerDocument;et(f,"touchmove",bt),et(f,"touchmove",this._onTouchMove),et(f,"pointermove",this._onTouchMove),et(t,"mouseup",this._onDrop),et(t,"touchend",this._onDrop),et(t,"pointerup",this._onDrop),et(t,"touchcancel",this._onDrop),et(t,"pointercancel",this._onDrop),et(f,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;H=O=M=!1,clearInterval(this._loopId),clearInterval(l),Z(),clearTimeout(o),o=void 0,clearTimeout(this._dragStartTimer),_t(this._cloneId),_t(this._dragStartId),et(f,"mousemove",this._onTouchMove),this.nativeDraggable&&(et(f,"drop",this),et(e,"dragstart",this._onDragStart),et(f,"dragover",this._handleAutoScroll),et(f,"dragover",J)),this._offUpEvents(),t&&(X&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),E&&E.parentNode&&E.parentNode.removeChild(E),(A===S||P&&"clone"!==P.lastPutMode)&&x&&x.parentNode&&x.parentNode.removeChild(x),T&&(this.nativeDraggable&&et(T,"dragend",this),lt(T),T.style["will-change"]="",nt(T,this.options.ghostClass,!1),nt(T,this.options.chosenClass,!1),rt(this,A,"unchoose",T,S,A,c,null,t),A!==S?(0<=(i=ut(T,n.draggable))&&(rt(null,S,"add",T,S,A,c,i,t),rt(this,A,"remove",T,S,A,c,i,t),rt(null,S,"sort",T,S,A,c,i,t),rt(this,A,"sort",T,S,A,c,i,t)),P&&P.save()):T.nextSibling!==B&&0<=(i=ut(T,n.draggable))&&(rt(this,A,"update",T,S,A,c,i,t),rt(this,A,"sort",T,S,A,c,i,t)),K.active&&(null!=i&&-1!==i||(i=c),rt(this,A,"end",T,S,A,c,i,t),this.save()))),this._nulling()},_nulling:function(){A=T=S=E=B=x=h=w=y=I.length=l=s=d=u=C=X=i=c=Y=k=R=P=N=K.active=null,_.forEach(function(t){t.checked=!0}),_.length=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":T&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,i=0,o=n.length,r=this.options;i<o;i++)$(t=n[i],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||ht(t));return e},sort:function(t){var i={},o=this.el;this.toArray().forEach(function(t,e){var n=o.children[e];$(n,this.options.draggable,o,!1)&&(i[t]=n)},this),t.forEach(function(t){i[t]&&(o.removeChild(i[t]),o.appendChild(i[t]))})},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return $(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];n[t]=e,"group"===t&&Q(n)},destroy:function(){var t=this.el;t[L]=null,et(t,"mousedown",this._onTapStart),et(t,"touchstart",this._onTapStart),et(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(et(t,"dragover",this),et(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),b.splice(b.indexOf(this._onDragOver),1),this._onDrop(),this.el=t=null},_hideClone:function(){x.cloneHidden||(it(x,"display","none"),x.cloneHidden=!0)},_showClone:function(t){"clone"===t.lastPutMode?x.cloneHidden&&(A.contains(T)&&!this.options.group.revertClone?A.insertBefore(x,T):B?A.insertBefore(x,B):A.appendChild(x),this.options.group.revertClone&&this._animate(T,x),it(x,"display",""),x.cloneHidden=!1):this._hideClone()}},K.utils={on:tt,off:et,css:it,find:ot,is:function(t,e){return!!$(t,e,t,!1)},extend:gt,throttle:pt,closest:$,toggleClass:nt,clone:vt,index:ut,nextTick:mt,cancelNextTick:_t,detectDirection:V,getChild:ct},K.create=function(t,e){return new K(t,e)},K.version="1.8.0-rc1",K});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc