|
|
@ -348,7 +348,7 @@ |
|
|
|
// Check filter
|
|
|
|
// Check filter
|
|
|
|
if (typeof filter === 'function') { |
|
|
|
if (typeof filter === 'function') { |
|
|
|
if (filter.call(this, evt, target, this)) { |
|
|
|
if (filter.call(this, evt, target, this)) { |
|
|
|
_dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex); |
|
|
|
_dispatchEvent(_this, originalTarget, 'filter', target, el, el, startIndex); |
|
|
|
preventOnFilter && evt.preventDefault(); |
|
|
|
preventOnFilter && evt.preventDefault(); |
|
|
|
return; // cancel dnd
|
|
|
|
return; // cancel dnd
|
|
|
|
} |
|
|
|
} |
|
|
@ -358,7 +358,7 @@ |
|
|
|
criteria = _closest(originalTarget, criteria.trim(), el); |
|
|
|
criteria = _closest(originalTarget, criteria.trim(), el); |
|
|
|
|
|
|
|
|
|
|
|
if (criteria) { |
|
|
|
if (criteria) { |
|
|
|
_dispatchEvent(_this, criteria, 'filter', target, el, startIndex); |
|
|
|
_dispatchEvent(_this, criteria, 'filter', target, el, el, startIndex); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -415,7 +415,7 @@ |
|
|
|
_this._triggerDragStart(evt, touch); |
|
|
|
_this._triggerDragStart(evt, touch); |
|
|
|
|
|
|
|
|
|
|
|
// Drag start event
|
|
|
|
// Drag start event
|
|
|
|
_dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex); |
|
|
|
_dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, rootEl, oldIndex); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Disable "draggable"
|
|
|
|
// Disable "draggable"
|
|
|
@ -506,7 +506,7 @@ |
|
|
|
Sortable.active = this; |
|
|
|
Sortable.active = this; |
|
|
|
|
|
|
|
|
|
|
|
// Drag start event
|
|
|
|
// Drag start event
|
|
|
|
_dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'start', dragEl, rootEl, rootEl, oldIndex); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this._nulling(); |
|
|
|
this._nulling(); |
|
|
|
} |
|
|
|
} |
|
|
@ -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, parentEl, rootEl, oldIndex); |
|
|
|
|
|
|
|
|
|
|
|
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, parentEl, rootEl, oldIndex, newIndex); |
|
|
|
|
|
|
|
|
|
|
|
// Remove event
|
|
|
|
// Remove event
|
|
|
|
_dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'remove', dragEl, parentEl, rootEl, oldIndex, newIndex); |
|
|
|
|
|
|
|
|
|
|
|
// 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, parentEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
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, parentEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -955,7 +955,7 @@ |
|
|
|
newIndex = oldIndex; |
|
|
|
newIndex = oldIndex; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(this, rootEl, 'end', dragEl, parentEl, rootEl, oldIndex, newIndex); |
|
|
|
|
|
|
|
|
|
|
|
// 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, toEl, fromEl, startIndex, newIndex) { |
|
|
|
sortable = (sortable || rootEl[expando]); |
|
|
|
sortable = (sortable || rootEl[expando]); |
|
|
|
|
|
|
|
|
|
|
|
var evt = document.createEvent('Event'), |
|
|
|
var evt = document.createEvent('Event'), |
|
|
@ -1269,7 +1269,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
evt.initEvent(name, true, true); |
|
|
|
evt.initEvent(name, true, true); |
|
|
|
|
|
|
|
|
|
|
|
evt.to = rootEl; |
|
|
|
evt.to = toEl || rootEl; |
|
|
|
evt.from = fromEl || rootEl; |
|
|
|
evt.from = fromEl || rootEl; |
|
|
|
evt.item = targetEl || rootEl; |
|
|
|
evt.item = targetEl || rootEl; |
|
|
|
evt.clone = cloneEl; |
|
|
|
evt.clone = cloneEl; |
|
|
|