Browse Source

* upd

gh-pages
RubaXa 10 years ago
parent
commit
0b22d98075
  1. 0
      Gruntfile.js
  2. 2
      README.md
  3. 35
      Sortable.js
  4. 4
      Sortable.min.js
  5. 2
      bower.json
  6. 2
      component.json
  7. 2
      index.html
  8. 6
      ng-sortable.js
  9. 15
      package.json

0
Gruntfile.js

2
README.md

@ -202,7 +202,7 @@ Sortable.create(list, {
#### `ghostClass` option #### `ghostClass` option
Class name for the drop placeholder. Class name for the drop placeholder.
Demo: http://jsbin.com/boqugumiqi/1/edit?css,js,output Demo: http://jsbin.com/hunifu/1/edit?css,js,output
```css ```css
.ghost { .ghost {

35
Sortable.js

@ -276,13 +276,6 @@
} }
} catch (err) { } catch (err) {
} }
if (activeGroup.pull == 'clone') {
cloneEl = dragEl.cloneNode(true);
_css(cloneEl, 'display', 'none');
rootEl.insertBefore(cloneEl, dragEl);
}
} }
}, },
@ -347,6 +340,12 @@
this._offUpEvents(); this._offUpEvents();
if (activeGroup.pull == 'clone') {
cloneEl = dragEl.cloneNode(true);
_css(cloneEl, 'display', 'none');
rootEl.insertBefore(cloneEl, dragEl);
}
if (isTouch) { if (isTouch) {
var rect = dragEl.getBoundingClientRect(), var rect = dragEl.getBoundingClientRect(),
css = _css(dragEl), css = _css(dragEl),
@ -627,16 +626,18 @@
// Remove event // Remove event
_dispatchEvent(rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); _dispatchEvent(rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
} }
else if (dragEl.nextSibling !== nextEl) { else {
// (1) Remove clone // Remove clone
cloneEl && cloneEl.parentNode.removeChild(cloneEl); cloneEl && cloneEl.parentNode.removeChild(cloneEl);
// (2) Get the index of the dragged element within its parent if (dragEl.nextSibling !== nextEl) {
newIndex = _index(dragEl); // Get the index of the dragged element within its parent
newIndex = _index(dragEl);
// drag & drop within the same list // drag & drop within the same list
_dispatchEvent(rootEl, 'update', dragEl, rootEl, oldIndex, newIndex); _dispatchEvent(rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
_dispatchEvent(rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); _dispatchEvent(rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
}
} }
// Drag end event // Drag end event
@ -820,7 +821,7 @@
do { do {
if ( if (
(tag === '>*' && el.parentNode === ctx) || ( (tag === '>*' && el.parentNode === ctx) || (
(tag === '' || el.nodeName == tag) && (tag === '' || el.nodeName.toUpperCase() == tag) &&
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
) )
) { ) {
@ -948,7 +949,7 @@
*/ */
function _index(/**HTMLElement*/el) { function _index(/**HTMLElement*/el) {
var index = 0; var index = 0;
while (el && (el = el.previousElementSibling) && (el.nodeName !== 'TEMPLATE')) { while (el && (el = el.previousElementSibling) && (el.nodeName.toUpperCase() !== 'TEMPLATE')) {
index++; index++;
} }
return index; return index;
@ -994,7 +995,7 @@
}; };
Sortable.version = '1.0.0'; Sortable.version = '1.0.1';
/** /**

4
Sortable.min.js vendored

File diff suppressed because one or more lines are too long

2
bower.json

@ -1,7 +1,7 @@
{ {
"name": "Sortable", "name": "Sortable",
"main": "Sortable.js", "main": "Sortable.js",
"version": "1.0.0", "version": "1.0.1",
"homepage": "http://rubaxa.github.io/Sortable/", "homepage": "http://rubaxa.github.io/Sortable/",
"authors": [ "authors": [
"RubaXa <ibnRubaXa@gmail.com>" "RubaXa <ibnRubaXa@gmail.com>"

2
component.json

@ -1,7 +1,7 @@
{ {
"name": "Sortable", "name": "Sortable",
"main": "Sortable.js", "main": "Sortable.js",
"version": "1.0.0", "version": "1.0.1",
"homepage": "http://rubaxa.github.io/Sortable/", "homepage": "http://rubaxa.github.io/Sortable/",
"repo": "RubaXa/Sortable", "repo": "RubaXa/Sortable",
"authors": [ "authors": [

2
index.html

@ -128,7 +128,7 @@
</div> </div>
<div style="width: 25%; float: left; margin-top: 15px; margin-left: 10px" class="block__list block__list_words"> <div style="width: 25%; float: left; margin-top: 15px; margin-left: 10px" class="block__list block__list_words">
<div class="block__list-title">only pull (clone), no reordering</div> <div class="block__list-title">only pull (clone) no&nbsp;reordering</div>
<ul id="advanced-2"> <ul id="advanced-2">
<li>Sex</li> <li>Sex</li>
<li>Drugs</li> <li>Drugs</li>

6
ng-sortable.js

@ -15,7 +15,7 @@
'use strict'; 'use strict';
angular.module('ng-sortable', []) angular.module('ng-sortable', [])
.constant('$version', '0.3.3') .constant('$version', '0.3.4')
.directive('ngSortable', ['$parse', function ($parse) { .directive('ngSortable', ['$parse', function ($parse) {
var removed, var removed,
nextSibling; nextSibling;
@ -28,7 +28,9 @@
(node.nodeValue.indexOf('ngRepeat:') !== -1) (node.nodeValue.indexOf('ngRepeat:') !== -1)
); );
})[0]; })[0];
ngRepeat = ngRepeat.nodeValue.match(/ngRepeat:\s*([^\s]+)\s+in\s+([^\s|]+)/);
// tests: http://jsbin.com/kosubutilo/1/edit?js,output
ngRepeat = ngRepeat.nodeValue.match(/ngRepeat:\s*(?:\(.*?,\s*)?([^\s)]+)[\s)]+in\s+([^\s|]+)/);
var itemExpr = $parse(ngRepeat[1]); var itemExpr = $parse(ngRepeat[1]);
var itemsExpr = $parse(ngRepeat[2]); var itemsExpr = $parse(ngRepeat[2]);

15
package.json

@ -1,7 +1,7 @@
{ {
"name": "sortablejs", "name": "sortablejs",
"exportName": "Sortable", "exportName": "Sortable",
"version": "1.0.0", "version": "1.0.1",
"devDependencies": { "devDependencies": {
"grunt": "*", "grunt": "*",
"grunt-version": "*", "grunt-version": "*",
@ -22,8 +22,17 @@
"keywords": [ "keywords": [
"sortable", "sortable",
"reorder", "reorder",
"drag" "drag",
"ng-srotable",
"angular"
], ],
"author": "Konstantin Lebedev <ibnRubaXa@gmail.com>", "author": "Konstantin Lebedev <ibnRubaXa@gmail.com>",
"license": "MIT" "license": "MIT",
"spm": {
"main": "Sortable.js",
"ignore": [
"meteor",
"st"
]
}
} }

Loading…
Cancel
Save