|
|
|
@ -171,6 +171,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_dragStarted: function () { |
|
|
|
|
if (rootEl && dragEl) { |
|
|
|
|
// Apply effect
|
|
|
|
|
_toggleClass(dragEl, this.options.ghostClass, true); |
|
|
|
|
|
|
|
|
@ -178,6 +179,7 @@
|
|
|
|
|
|
|
|
|
|
// Drag start event
|
|
|
|
|
_dispatchEvent(rootEl, 'start', dragEl, rootEl, oldIndex); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -276,13 +278,6 @@
|
|
|
|
|
} |
|
|
|
|
} catch (err) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (activeGroup.pull == 'clone') { |
|
|
|
|
cloneEl = dragEl.cloneNode(true); |
|
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -347,6 +342,12 @@
|
|
|
|
|
|
|
|
|
|
this._offUpEvents(); |
|
|
|
|
|
|
|
|
|
if (activeGroup.pull == 'clone') { |
|
|
|
|
cloneEl = dragEl.cloneNode(true); |
|
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isTouch) { |
|
|
|
|
var rect = dragEl.getBoundingClientRect(), |
|
|
|
|
css = _css(dragEl), |
|
|
|
@ -470,7 +471,7 @@
|
|
|
|
|
!options.dragoverBubble && evt.stopPropagation(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!_silent && activeGroup && |
|
|
|
|
if (!_silent && activeGroup && !options.disabled && |
|
|
|
|
(isOwner |
|
|
|
|
? canSort || (revert = !rootEl.contains(dragEl)) |
|
|
|
|
: activeGroup.pull && groupPut && ( |
|
|
|
@ -627,17 +628,19 @@
|
|
|
|
|
// Remove event
|
|
|
|
|
_dispatchEvent(rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
|
} |
|
|
|
|
else if (dragEl.nextSibling !== nextEl) { |
|
|
|
|
// (1) Remove clone
|
|
|
|
|
else { |
|
|
|
|
// Remove clone
|
|
|
|
|
cloneEl && cloneEl.parentNode.removeChild(cloneEl); |
|
|
|
|
|
|
|
|
|
// (2) Get the index of the dragged element within its parent
|
|
|
|
|
if (dragEl.nextSibling !== nextEl) { |
|
|
|
|
// Get the index of the dragged element within its parent
|
|
|
|
|
newIndex = _index(dragEl); |
|
|
|
|
|
|
|
|
|
// drag & drop within the same list
|
|
|
|
|
_dispatchEvent(rootEl, 'update', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
|
_dispatchEvent(rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Drag end event
|
|
|
|
|
Sortable.active && _dispatchEvent(rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
@ -820,7 +823,7 @@
|
|
|
|
|
do { |
|
|
|
|
if ( |
|
|
|
|
(tag === '>*' && el.parentNode === ctx) || ( |
|
|
|
|
(tag === '' || el.nodeName == tag) && |
|
|
|
|
(tag === '' || el.nodeName.toUpperCase() == tag) && |
|
|
|
|
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) |
|
|
|
|
) |
|
|
|
|
) { |
|
|
|
@ -948,9 +951,11 @@
|
|
|
|
|
*/ |
|
|
|
|
function _index(/**HTMLElement*/el) { |
|
|
|
|
var index = 0; |
|
|
|
|
while (el && (el = el.previousElementSibling) && (el.nodeName !== 'TEMPLATE')) { |
|
|
|
|
while (el && (el = el.previousElementSibling)) { |
|
|
|
|
if (el.nodeName.toUpperCase() !== 'TEMPLATE') { |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return index; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -994,7 +999,7 @@
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.version = '1.0.0'; |
|
|
|
|
Sortable.version = '1.0.1'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|