|
|
@ -276,13 +276,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (err) { |
|
|
|
} catch (err) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (activeGroup.pull == 'clone') { |
|
|
|
|
|
|
|
cloneEl = dragEl.cloneNode(true); |
|
|
|
|
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
|
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -347,6 +340,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
this._offUpEvents(); |
|
|
|
this._offUpEvents(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (activeGroup.pull == 'clone') { |
|
|
|
|
|
|
|
cloneEl = dragEl.cloneNode(true); |
|
|
|
|
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
|
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isTouch) { |
|
|
|
if (isTouch) { |
|
|
|
var rect = dragEl.getBoundingClientRect(), |
|
|
|
var rect = dragEl.getBoundingClientRect(), |
|
|
|
css = _css(dragEl), |
|
|
|
css = _css(dragEl), |
|
|
@ -627,17 +626,19 @@ |
|
|
|
// Remove event
|
|
|
|
// Remove event
|
|
|
|
_dispatchEvent(rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (dragEl.nextSibling !== nextEl) { |
|
|
|
else { |
|
|
|
// (1) Remove clone
|
|
|
|
// Remove clone
|
|
|
|
cloneEl && cloneEl.parentNode.removeChild(cloneEl); |
|
|
|
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); |
|
|
|
newIndex = _index(dragEl); |
|
|
|
|
|
|
|
|
|
|
|
// drag & drop within the same list
|
|
|
|
// drag & drop within the same list
|
|
|
|
_dispatchEvent(rootEl, 'update', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'update', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Drag end event
|
|
|
|
// Drag end event
|
|
|
|
Sortable.active && _dispatchEvent(rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
Sortable.active && _dispatchEvent(rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); |
|
|
@ -820,7 +821,7 @@ |
|
|
|
do { |
|
|
|
do { |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
(tag === '>*' && el.parentNode === ctx) || ( |
|
|
|
(tag === '>*' && el.parentNode === ctx) || ( |
|
|
|
(tag === '' || el.nodeName == tag) && |
|
|
|
(tag === '' || el.nodeName.toUpperCase() == tag) && |
|
|
|
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) |
|
|
|
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) |
|
|
|
) |
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
@ -948,7 +949,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function _index(/**HTMLElement*/el) { |
|
|
|
function _index(/**HTMLElement*/el) { |
|
|
|
var index = 0; |
|
|
|
var index = 0; |
|
|
|
while (el && (el = el.previousElementSibling) && (el.nodeName !== 'TEMPLATE')) { |
|
|
|
while (el && (el = el.previousElementSibling) && (el.nodeName.toUpperCase() !== 'TEMPLATE')) { |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
return index; |
|
|
|
return index; |
|
|
@ -994,7 +995,7 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.version = '1.0.0'; |
|
|
|
Sortable.version = '1.0.1'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|