Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 7a27438

Browse files
author
AngularUI (via TravisCI)
committed
Travis commit : build 454
1 parent 638ae83 commit 7a27438

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-sortable",
3-
"version": "0.14.0",
3+
"version": "0.14.1",
44
"main": ["./sortable.js"],
55
"dependencies": {
66
"angular": ">=1.2.x",

sortable.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* angular-ui-sortable - This directive allows you to jQueryUI Sortable.
3-
* @version v0.14.0 - 2016-03-28
3+
* @version v0.14.1 - 2016-06-06
44
* @link http://angular-ui.github.com
55
* @license MIT
66
*/
@@ -218,10 +218,10 @@ angular.module('ui.sortable', [])
218218
// return the index of ui.item among the items
219219
// we can't just do ui.item.index() because there it might have siblings
220220
// which are not items
221-
function getItemIndex(ui) {
222-
return ui.item.parent()
221+
function getItemIndex(item) {
222+
return item.parent()
223223
.find(opts['ui-model-items'])
224-
.index(ui.item);
224+
.index(item);
225225
}
226226

227227
var opts = {};
@@ -275,7 +275,7 @@ angular.module('ui.sortable', [])
275275
}
276276

277277
// Save the starting position of dragged item
278-
var index = getItemIndex(ui);
278+
var index = getItemIndex(ui.item);
279279
ui.item.sortable = {
280280
model: ngModel.$modelValue[index],
281281
index: index,
@@ -331,7 +331,7 @@ angular.module('ui.sortable', [])
331331
// update that happens when moving between lists because then
332332
// the value will be overwritten with the old value
333333
if(!ui.item.sortable.received) {
334-
ui.item.sortable.dropindex = getItemIndex(ui);
334+
ui.item.sortable.dropindex = getItemIndex(ui.item);
335335
var droptarget = ui.item.parent();
336336
ui.item.sortable.droptarget = droptarget;
337337

@@ -440,7 +440,24 @@ angular.module('ui.sortable', [])
440440
wrappers.helper = function (inner) {
441441
if (inner && typeof inner === 'function') {
442442
return function (e, item) {
443+
var oldItemSortable = item.sortable;
444+
var index = getItemIndex(item);
445+
item.sortable = {
446+
model: ngModel.$modelValue[index],
447+
index: index,
448+
source: item.parent(),
449+
sourceModel: ngModel.$modelValue,
450+
_restore: function () {
451+
angular.forEach(item.sortable, function(value, key) {
452+
item.sortable[key] = undefined;
453+
});
454+
455+
item.sortable = oldItemSortable;
456+
}
457+
};
458+
443459
var innerResult = inner.apply(this, arguments);
460+
item.sortable._restore();
444461
item.sortable._isCustomHelperUsed = item !== innerResult;
445462
return innerResult;
446463
};

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)