|
|
@ -195,6 +195,7 @@ |
|
|
|
if (typeof filter === 'function') { |
|
|
|
if (typeof filter === 'function') { |
|
|
|
if (filter.call(this, evt, target, this)) { |
|
|
|
if (filter.call(this, evt, target, this)) { |
|
|
|
_dispatchEvent(originalTarget, 'filter', target, el, startIndex); |
|
|
|
_dispatchEvent(originalTarget, 'filter', target, el, startIndex); |
|
|
|
|
|
|
|
evt.preventDefault(); |
|
|
|
return; // cancel dnd
|
|
|
|
return; // cancel dnd
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -208,7 +209,8 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (filter.length) { |
|
|
|
if (filter) { |
|
|
|
|
|
|
|
evt.preventDefault(); |
|
|
|
return; // cancel dnd
|
|
|
|
return; // cancel dnd
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -276,6 +278,8 @@ |
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.active = this; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -446,6 +450,8 @@ |
|
|
|
isOwner = (activeGroup === group), |
|
|
|
isOwner = (activeGroup === group), |
|
|
|
canSort = options.sort; |
|
|
|
canSort = options.sort; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(evt.stopPropagation !== void 0) && evt.stopPropagation(); |
|
|
|
|
|
|
|
|
|
|
|
if (!_silent && activeGroup && |
|
|
|
if (!_silent && activeGroup && |
|
|
|
(isOwner |
|
|
|
(isOwner |
|
|
|
? canSort || (revert = !rootEl.contains(dragEl)) |
|
|
|
? canSort || (revert = !rootEl.contains(dragEl)) |
|
|
@ -459,13 +465,10 @@ |
|
|
|
target = _closest(evt.target, options.draggable, el); |
|
|
|
target = _closest(evt.target, options.draggable, el); |
|
|
|
dragRect = dragEl.getBoundingClientRect(); |
|
|
|
dragRect = dragEl.getBoundingClientRect(); |
|
|
|
|
|
|
|
|
|
|
|
if (cloneEl && (cloneEl.state !== isOwner)) { |
|
|
|
|
|
|
|
_css(cloneEl, 'display', isOwner ? 'none' : ''); |
|
|
|
|
|
|
|
!isOwner && cloneEl.state && rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
|
|
|
|
cloneEl.state = isOwner; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (revert) { |
|
|
|
if (revert) { |
|
|
|
|
|
|
|
_cloneHide(true); |
|
|
|
|
|
|
|
|
|
|
|
if (cloneEl || nextEl) { |
|
|
|
if (cloneEl || nextEl) { |
|
|
|
rootEl.insertBefore(dragEl, cloneEl || nextEl); |
|
|
|
rootEl.insertBefore(dragEl, cloneEl || nextEl); |
|
|
|
} |
|
|
|
} |
|
|
@ -476,6 +479,7 @@ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((el.children.length === 0) || (el.children[0] === ghostEl) || |
|
|
|
if ((el.children.length === 0) || (el.children[0] === ghostEl) || |
|
|
|
(el === evt.target) && (target = _ghostInBottom(el, evt)) |
|
|
|
(el === evt.target) && (target = _ghostInBottom(el, evt)) |
|
|
|
) { |
|
|
|
) { |
|
|
@ -486,6 +490,8 @@ |
|
|
|
targetRect = target.getBoundingClientRect(); |
|
|
|
targetRect = target.getBoundingClientRect(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_cloneHide(isOwner); |
|
|
|
|
|
|
|
|
|
|
|
el.appendChild(dragEl); |
|
|
|
el.appendChild(dragEl); |
|
|
|
this._animate(dragRect, dragEl); |
|
|
|
this._animate(dragRect, dragEl); |
|
|
|
target && this._animate(targetRect, target); |
|
|
|
target && this._animate(targetRect, target); |
|
|
@ -511,6 +517,8 @@ |
|
|
|
_silent = true; |
|
|
|
_silent = true; |
|
|
|
setTimeout(_unsilent, 30); |
|
|
|
setTimeout(_unsilent, 30); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_cloneHide(isOwner); |
|
|
|
|
|
|
|
|
|
|
|
if (floating) { |
|
|
|
if (floating) { |
|
|
|
after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide; |
|
|
|
after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -626,7 +634,8 @@ |
|
|
|
lastEl = |
|
|
|
lastEl = |
|
|
|
lastCSS = |
|
|
|
lastCSS = |
|
|
|
|
|
|
|
|
|
|
|
activeGroup = null; |
|
|
|
activeGroup = |
|
|
|
|
|
|
|
Sortable.active = null; |
|
|
|
|
|
|
|
|
|
|
|
// Save sorting
|
|
|
|
// Save sorting
|
|
|
|
this.options.store && this.options.store.set(this); |
|
|
|
this.options.store && this.options.store.set(this); |
|
|
@ -753,6 +762,15 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _cloneHide(state) { |
|
|
|
|
|
|
|
if (cloneEl && (cloneEl.state !== state)) { |
|
|
|
|
|
|
|
_css(cloneEl, 'display', state ? 'none' : ''); |
|
|
|
|
|
|
|
!state && cloneEl.state && rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
|
|
|
|
cloneEl.state = state; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _bind(ctx, fn) { |
|
|
|
function _bind(ctx, fn) { |
|
|
|
var args = slice.call(arguments, 2); |
|
|
|
var args = slice.call(arguments, 2); |
|
|
|
return fn.bind ? fn.bind.apply(fn, [ctx].concat(args)) : function () { |
|
|
|
return fn.bind ? fn.bind.apply(fn, [ctx].concat(args)) : function () { |
|
|
@ -900,7 +918,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function _index(/**HTMLElement*/el) { |
|
|
|
function _index(/**HTMLElement*/el) { |
|
|
|
var index = 0; |
|
|
|
var index = 0; |
|
|
|
while (el && (el = el.previousElementSibling)) { |
|
|
|
while (el && (el = el.previousElementSibling) && (el.nodeName !== 'TEMPLATE')) { |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
return index; |
|
|
|
return index; |
|
|
@ -946,7 +964,7 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.version = '0.7.2'; |
|
|
|
Sortable.version = '0.7.3'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|