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

Commit 11bb2b8

Browse files
author
AngularUI (via TravisCI)
committed
Travis commit : build 513
1 parent 30f3129 commit 11bb2b8

File tree

3 files changed

+54
-14
lines changed

3 files changed

+54
-14
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.16.1",
3+
"version": "0.17.0",
44
"main": ["./sortable.js"],
55
"dependencies": {
66
"angular": ">=1.2.x",

sortable.js

Lines changed: 51 additions & 11 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.16.1 - 2016-12-16
3+
* @version v0.17.0 - 2017-03-08
44
* @link http://angular-ui.github.com
55
* @license MIT
66
*/
@@ -23,10 +23,25 @@ angular.module('ui.sortable', [])
2323
'uiSortableConfig', '$timeout', '$log',
2424
function(uiSortableConfig, $timeout, $log) {
2525
return {
26-
require: '?ngModel',
26+
require:'?ngModel',
2727
scope: {
28-
ngModel: '=',
29-
uiSortable: '='
28+
ngModel:'=',
29+
uiSortable:'=',
30+
////Expression bindings from html.
31+
create:'&uiSortableCreate',
32+
// helper:'&uiSortableHelper',
33+
start:'&uiSortableStart',
34+
activate:'&uiSortableActivate',
35+
// sort:'&uiSortableSort',
36+
// change:'&uiSortableChange',
37+
// over:'&uiSortableOver',
38+
// out:'&uiSortableOut',
39+
beforeStop:'&uiSortableBeforeStop',
40+
update:'&uiSortableUpdate',
41+
remove:'&uiSortableRemove',
42+
receive:'&uiSortableReceive',
43+
deactivate:'&uiSortableDeactivate',
44+
stop:'&uiSortableStop'
3045
},
3146
link: function(scope, element, attrs, ngModel) {
3247
var savedNodes;
@@ -226,11 +241,19 @@ angular.module('ui.sortable', [])
226241
};
227242

228243
var callbacks = {
229-
receive: null,
230-
remove: null,
244+
create: null,
231245
start: null,
232-
stop: null,
233-
update: null
246+
activate: null,
247+
// sort: null,
248+
// change: null,
249+
// over: null,
250+
// out: null,
251+
beforeStop: null,
252+
update: null,
253+
remove: null,
254+
receive: null,
255+
deactivate: null,
256+
stop: null
234257
};
235258

236259
var wrappers = {
@@ -331,7 +354,7 @@ angular.module('ui.sortable', [])
331354
// Save current drop position but only if this is not a second
332355
// update that happens when moving between lists because then
333356
// the value will be overwritten with the old value
334-
if(!ui.item.sortable.received) {
357+
if (!ui.item.sortable.received) {
335358
ui.item.sortable.dropindex = getItemIndex(ui.item);
336359
var droptarget = ui.item.closest('[ui-sortable], [data-ui-sortable], [x-ui-sortable]');
337360
ui.item.sortable.droptarget = droptarget;
@@ -365,19 +388,20 @@ angular.module('ui.sortable', [])
365388
// it's safe to clear the restored nodes since:
366389
// update is currently running and
367390
// stop is not called for the target list.
368-
if(ui.item.sortable.received) {
391+
if (ui.item.sortable.received) {
369392
savedNodes = null;
370393
}
371394

372395
// If received is true (an item was dropped in from another list)
373396
// then we add the new item to this list otherwise wait until the
374397
// stop event where we will know if it was a sort or item was
375398
// moved here from another list
376-
if(ui.item.sortable.received && !ui.item.sortable.isCanceled()) {
399+
if (ui.item.sortable.received && !ui.item.sortable.isCanceled()) {
377400
scope.$apply(function () {
378401
ngModel.$modelValue.splice(ui.item.sortable.dropindex, 0,
379402
ui.item.sortable.moved);
380403
});
404+
scope.$emit('ui-sortable:moved', ui);
381405
}
382406
};
383407

@@ -395,6 +419,7 @@ angular.module('ui.sortable', [])
395419
ui.item.sortable.dropindex, 0,
396420
ngModel.$modelValue.splice(ui.item.sortable.index, 1)[0]);
397421
});
422+
scope.$emit('ui-sortable:moved', ui);
398423
} else if (!wasMoved &&
399424
!angular.equals(element.contents().toArray(), savedNodes.toArray())) {
400425
// if the item was not moved
@@ -442,6 +467,21 @@ angular.module('ui.sortable', [])
442467
}
443468
};
444469

470+
// setup attribute handlers
471+
angular.forEach(callbacks, function(value, key) {
472+
callbacks[key] = combineCallbacks(callbacks[key],
473+
function () {
474+
var attrHandler = scope[key];
475+
var attrHandlerFn;
476+
if (typeof attrHandler === 'function' &&
477+
('uiSortable' + key.substring(0,1).toUpperCase() + key.substring(1)).length &&
478+
typeof (attrHandlerFn = attrHandler()) === 'function') {
479+
attrHandlerFn.apply(this, arguments);
480+
}
481+
});
482+
});
483+
484+
445485
wrappers.helper = function (inner) {
446486
if (inner && typeof inner === 'function') {
447487
return function (e, item) {

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)