Browse Source

* upd

gh-pages
RubaXa 10 years ago
parent
commit
969e313007
  1. 2
      CONTRIBUTING.md
  2. 14
      README.md
  3. 8
      Sortable.js
  4. 7
      bower.json
  5. 2
      index.html
  6. 37
      ng-sortable.js
  7. 4
      package.json

2
CONTRIBUTING.md

@ -5,7 +5,7 @@
1. Try [dev](https://github.com/RubaXa/Sortable/tree/dev/)-branch, perhaps the problem has been solved;
2. [Use the search](https://github.com/RubaXa/Sortable/search?q=problem), maybe already have an answer;
3. If not found, create example on [jsbin.com](http://jsbin.com/zunibaxada/1/edit?html,js,output) and describe the problem.
3. If not found, create example on [jsbin.com (draft)](http://jsbin.com/zunibaxada/1/edit?html,js,output) and describe the problem.
---

14
README.md

@ -55,6 +55,7 @@ You can use any element for the list and its elements, not just `ul`/`li`. Here
var sortable = new Sortable(el, {
group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] }
sort: true, // sorting inside list
delay: 0, // time in milliseconds to define when the sorting should start
disabled: false, // Disables the sortable if set to true.
store: null, // @see Store
animation: 150, // ms, animation speed moving items when sorting, `0` — without animation
@ -140,7 +141,7 @@ You can also define whether lists can give away, give and keep a copy (`clone`),
#### `sort` option
Sorting inside list
Sorting inside list.
Demo: http://jsbin.com/xizeh/2/edit?html,js,output
@ -148,6 +149,15 @@ Demo: http://jsbin.com/xizeh/2/edit?html,js,output
---
#### `delay` option
Time in milliseconds to define when the sorting should start.
Demo: http://jsbin.com/xizeh/4/edit?html,js,output
---
#### `disabled` options
Disables the sortable if set to `true`.
@ -205,7 +215,7 @@ Sortable.create(el, {
Sortable.create(list, {
filter: ".js-remove, .js-edit",
onFilter: function (evt) {
var item = el.item,
var item = evt.item,
ctrl = evt.target;
if (Sortable.utils.is(ctrl, ".js-remove")) { // Click on remove button

8
Sortable.js

@ -991,11 +991,11 @@
evt.oldIndex = startIndex;
evt.newIndex = newIndex;
rootEl.dispatchEvent(evt);
if (options[onName]) {
options[onName].call(sortable, evt);
}
rootEl.dispatchEvent(evt);
}
@ -1035,7 +1035,9 @@
/** @returns {HTMLElement|false} */
function _ghostInBottom(el, evt) {
var lastEl = el.lastElementChild, rect = lastEl.getBoundingClientRect();
var lastEl = el.lastElementChild,
rect = lastEl.getBoundingClientRect();
return (evt.clientY - (rect.top + rect.height) > 5) && lastEl; // min delta
}

7
bower.json

@ -1,6 +1,11 @@
{
"name": "Sortable",
"main": "Sortable.js",
"main": [
"Sortable.js",
"ng-sortable.js",
"knockout-sortable.js",
"react-sortable-mixin.js"
],
"version": "1.2.0",
"homepage": "http://rubaxa.github.io/Sortable/",
"authors": [

2
index.html

@ -173,7 +173,7 @@
<a name="ng"></a>
<div id="todos" ng-app="todoApp" class="container" style="margin-top: 100px">
<div style="margin-left: 30px">
<div><div data-force="5" class="layer title title_xl">AngluarJS / ng-sortable</div></div>
<div><div data-force="5" class="layer title title_xl">AngularJS / ng-sortable</div></div>
<div style="width: 30%; margin-top: -8px; margin-left: 10px; float: left;" class="block__list block__list_words">
<div ng-controller="TodoController">

37
ng-sortable.js

@ -64,11 +64,12 @@
// Export
return {
restrict: 'AC',
scope: { ngSortable: "=?" },
link: function (scope, $el, attrs) {
var el = $el[0],
ngSortable = attrs.ngSortable,
options = scope.$eval(ngSortable) || {},
options = scope.ngSortable || {},
source = getSource(el),
watchers = [],
sortable
;
@ -154,27 +155,29 @@
}));
$el.on('$destroy', function () {
angular.forEach(watchers, function (/** Function */unwatch) {
unwatch();
});
sortable.destroy();
watchers = null;
sortable = null;
nextSibling = null;
});
if (ngSortable && !/{|}/.test(ngSortable)) { // todo: ugly
angular.forEach([
'sort', 'disabled', 'draggable', 'handle', 'animation',
'onStart', 'onEnd', 'onAdd', 'onUpdate', 'onRemove', 'onSort'
], function (name) {
scope.$watch(ngSortable + '.' + name, function (value) {
if (value !== void 0) {
options[name] = value;
if (!/^on[A-Z]/.test(name)) {
sortable.option(name, value);
}
angular.forEach([
'sort', 'disabled', 'draggable', 'handle', 'animation',
'onStart', 'onEnd', 'onAdd', 'onUpdate', 'onRemove', 'onSort'
], function (name) {
watchers.push(scope.$watch('ngSortable.' + name, function (value) {
if (value !== void 0) {
options[name] = value;
if (!/^on[A-Z]/.test(name)) {
sortable.option(name, value);
}
});
});
}
}
}));
});
}
};
}]);

4
package.json

@ -1,7 +1,7 @@
{
"name": "sortablejs",
"exportName": "Sortable",
"version": "1.2.0",
"version": "1.2.1",
"devDependencies": {
"grunt": "*",
"grunt-version": "*",
@ -25,7 +25,7 @@
"drag",
"meteor",
"angular",
"ng-srotable",
"ng-sortable",
"react",
"mixin"
],

Loading…
Cancel
Save