|
|
@ -171,6 +171,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_dragStarted: function () { |
|
|
|
_dragStarted: function () { |
|
|
|
|
|
|
|
if (rootEl && dragEl) { |
|
|
|
// Apply effect
|
|
|
|
// Apply effect
|
|
|
|
_toggleClass(dragEl, this.options.ghostClass, true); |
|
|
|
_toggleClass(dragEl, this.options.ghostClass, true); |
|
|
|
|
|
|
|
|
|
|
@ -178,6 +179,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
// Drag start event
|
|
|
|
// Drag start event
|
|
|
|
_dispatchEvent(rootEl, 'start', dragEl, rootEl, oldIndex); |
|
|
|
_dispatchEvent(rootEl, 'start', dragEl, rootEl, oldIndex); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -276,13 +278,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (err) { |
|
|
|
} catch (err) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (activeGroup.pull == 'clone') { |
|
|
|
|
|
|
|
cloneEl = dragEl.cloneNode(true); |
|
|
|
|
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
|
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -347,6 +342,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), |
|
|
@ -470,7 +471,7 @@ |
|
|
|
!options.dragoverBubble && evt.stopPropagation(); |
|
|
|
!options.dragoverBubble && evt.stopPropagation(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!_silent && activeGroup && |
|
|
|
if (!_silent && activeGroup && !options.disabled && |
|
|
|
(isOwner |
|
|
|
(isOwner |
|
|
|
? canSort || (revert = !rootEl.contains(dragEl)) |
|
|
|
? canSort || (revert = !rootEl.contains(dragEl)) |
|
|
|
: activeGroup.pull && groupPut && ( |
|
|
|
: activeGroup.pull && groupPut && ( |
|
|
@ -627,17 +628,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 +823,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,9 +951,11 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
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)) { |
|
|
|
|
|
|
|
if (el.nodeName.toUpperCase() !== 'TEMPLATE') { |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return index; |
|
|
|
return index; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -994,7 +999,7 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.version = '1.0.0'; |
|
|
|
Sortable.version = '1.0.1'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|