Skip to content

Commit 6ee94f7

Browse files
committed
Rebuild files
Rebuild distributable files
1 parent f9b2c7d commit 6ee94f7

File tree

2 files changed

+70
-21
lines changed

2 files changed

+70
-21
lines changed

build/knockout-sortable.js

Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// knockout-sortable 0.12.0 | (c) 2016 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
1+
// knockout-sortable 0.13.0 | (c) 2016 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
22
;(function(factory) {
33
if (typeof define === "function" && define.amd) {
44
// AMD anonymous module
@@ -247,24 +247,73 @@
247247
if (arg && arg.cancelDrop) {
248248
return;
249249
}
250-
251-
//do the actual move
252-
if (targetIndex >= 0) {
253-
if (sourceParent) {
254-
sourceParent.splice(sourceIndex, 1);
255-
256-
//if using deferred updates plugin, force updates
257-
if (ko.processAllDeferredBindingUpdates) {
258-
ko.processAllDeferredBindingUpdates();
259-
}
260-
}
261-
262-
targetParent.splice(targetIndex, 0, item);
263-
}
264-
265-
//rendering is handled by manipulating the observableArray; ignore dropped element
266-
dataSet(el, ITEMKEY, null);
267-
250+
251+
//if the strategy option is unset or false, employ the order strategy involving removal and insertion of items
252+
if(!sortable.hasOwnProperty("strategyMove") || sortable.strategyMove === false)
253+
{
254+
//do the actual move
255+
if (targetIndex >= 0) {
256+
if (sourceParent) {
257+
sourceParent.splice(sourceIndex, 1);
258+
259+
//if using deferred updates plugin, force updates
260+
if (ko.processAllDeferredBindingUpdates) {
261+
ko.processAllDeferredBindingUpdates();
262+
}
263+
}
264+
265+
targetParent.splice(targetIndex, 0, item);
266+
}
267+
268+
//rendering is handled by manipulating the observableArray; ignore dropped element
269+
dataSet(el, ITEMKEY, null);
270+
}
271+
else { //employ the strategy of moving items
272+
if (targetIndex >= 0) {
273+
if (sourceParent) {
274+
if (sourceParent !== targetParent) {
275+
// moving from one list to another
276+
277+
sourceParent.splice(sourceIndex, 1);
278+
279+
//if using deferred updates plugin, force updates
280+
if (ko.processAllDeferredBindingUpdates) {
281+
ko.processAllDeferredBindingUpdates();
282+
}
283+
284+
targetParent.splice(targetIndex, 0, item);
285+
286+
//rendering is handled by manipulating the observableArray; ignore dropped element
287+
dataSet(el, ITEMKEY, null);
288+
ui.item.remove();
289+
}
290+
else {
291+
// moving within same list
292+
var underlyingList = unwrap(sourceParent);
293+
294+
// notify 'beforeChange' subscribers
295+
sourceParent.valueWillMutate();
296+
297+
// move from source index ...
298+
underlyingList.splice(sourceIndex, 1);
299+
// ... to target index
300+
underlyingList.splice(targetIndex, 0, item);
301+
302+
// notify subscribers
303+
sourceParent.valueHasMutated();
304+
}
305+
}
306+
else {
307+
// drop new element from outside
308+
targetParent.splice(targetIndex, 0, item);
309+
310+
//rendering is handled by manipulating the observableArray; ignore dropped element
311+
dataSet(el, ITEMKEY, null);
312+
ui.item.remove();
313+
}
314+
}
315+
}
316+
268317
//if using deferred updates plugin, force updates
269318
if (ko.processAllDeferredBindingUpdates) {
270319
ko.processAllDeferredBindingUpdates();

build/knockout-sortable.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)