|
|
@ -919,21 +919,21 @@ |
|
|
|
_toggleClass(dragEl, this.options.chosenClass, false); |
|
|
|
_toggleClass(dragEl, this.options.chosenClass, false); |
|
|
|
|
|
|
|
|
|
|
|
// Drag stop event
|
|
|
|
// Drag stop event
|
|
|
|
_dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex, null, evt); |
|
|
|
|
|
|
|
|
|
|
|
if (rootEl !== parentEl) { |
|
|
|
if (rootEl !== parentEl) { |
|
|
|
newIndex = _index(dragEl, options.draggable); |
|
|
|
newIndex = _index(dragEl, options.draggable); |
|
|
|
|
|
|
|
|
|
|
|
if (newIndex >= 0) { |
|
|
|
if (newIndex >= 0) { |
|
|
|
// Add event
|
|
|
|
// Add event
|
|
|
|
_dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex, evt); |
|
|
|
|
|
|
|
|
|
|
|
// Remove event
|
|
|
|
// Remove event
|
|
|
|
_dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex, evt); |
|
|
|
|
|
|
|
|
|
|
|
// drag from one list and drop into another
|
|
|
|
// drag from one list and drop into another
|
|
|
|
_dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex, evt); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex, evt); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
@ -943,8 +943,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
if (newIndex >= 0) { |
|
|
|
if (newIndex >= 0) { |
|
|
|
// drag & drop within the same list
|
|
|
|
// drag & drop within the same list
|
|
|
|
_dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex, evt); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex, evt); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -955,7 +955,7 @@ |
|
|
|
newIndex = oldIndex; |
|
|
|
newIndex = oldIndex; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex, evt); |
|
|
|
|
|
|
|
|
|
|
|
// Save sorting
|
|
|
|
// Save sorting
|
|
|
|
this.save(); |
|
|
|
this.save(); |
|
|
@ -1260,7 +1260,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) { |
|
|
|
function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex, originalEvt) { |
|
|
|
sortable = (sortable || rootEl[expando]); |
|
|
|
sortable = (sortable || rootEl[expando]); |
|
|
|
|
|
|
|
|
|
|
|
var evt = document.createEvent('Event'), |
|
|
|
var evt = document.createEvent('Event'), |
|
|
@ -1277,6 +1277,8 @@ |
|
|
|
evt.oldIndex = startIndex; |
|
|
|
evt.oldIndex = startIndex; |
|
|
|
evt.newIndex = newIndex; |
|
|
|
evt.newIndex = newIndex; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
evt.originalEvent = originalEvt; |
|
|
|
|
|
|
|
|
|
|
|
rootEl.dispatchEvent(evt); |
|
|
|
rootEl.dispatchEvent(evt); |
|
|
|
|
|
|
|
|
|
|
|
if (options[onName]) { |
|
|
|
if (options[onName]) { |
|
|
@ -1302,6 +1304,8 @@ |
|
|
|
evt.relatedRect = targetRect || toEl.getBoundingClientRect(); |
|
|
|
evt.relatedRect = targetRect || toEl.getBoundingClientRect(); |
|
|
|
evt.willInsertAfter = willInsertAfter; |
|
|
|
evt.willInsertAfter = willInsertAfter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
evt.originalEvent = originalEvt; |
|
|
|
|
|
|
|
|
|
|
|
fromEl.dispatchEvent(evt); |
|
|
|
fromEl.dispatchEvent(evt); |
|
|
|
|
|
|
|
|
|
|
|
if (onMoveFn) { |
|
|
|
if (onMoveFn) { |
|
|
|