Browse Source

* bump

gh-pages
RubaXa 9 years ago
parent
commit
ebd0e1c65a
  1. 15
      Sortable.js
  2. 4
      Sortable.min.js
  3. 7
      jquery.binding.js
  4. 10
      knockout-sortable.js
  5. 17
      ng-sortable.js
  6. 15
      react-sortable-mixin.js

15
Sortable.js

@ -172,6 +172,10 @@
* @param {Object} [options]
*/
function Sortable(el, options) {
if (!(el && el.nodeType && el.nodeType === 1)) {
throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
}
this.el = el; // root element
this.options = options = _extend({}, options);
@ -489,12 +493,13 @@
if (!ghostEl) {
var rect = dragEl.getBoundingClientRect(),
css = _css(dragEl),
options = this.options,
ghostRect;
ghostEl = dragEl.cloneNode(true);
_toggleClass(ghostEl, this.options.ghostClass, false);
_toggleClass(ghostEl, this.options.fallbackClass, true);
_toggleClass(ghostEl, options.ghostClass, false);
_toggleClass(ghostEl, options.fallbackClass, true);
_css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
_css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
@ -505,7 +510,7 @@
_css(ghostEl, 'zIndex', '100000');
_css(ghostEl, 'pointerEvents', 'none');
this.options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
// Fixing dimensions.
ghostRect = ghostEl.getBoundingClientRect();
@ -792,7 +797,7 @@
}
if (Sortable.active) {
if (newIndex == null || newIndex === -1) {
if (newIndex === null || newIndex === -1) {
newIndex = oldIndex;
}
@ -1239,6 +1244,6 @@
// Export
Sortable.version = '1.3.0-rc1';
Sortable.version = '1.4.2';
return Sortable;
});

4
Sortable.min.js vendored

File diff suppressed because one or more lines are too long

7
jquery.binding.js

@ -27,7 +27,8 @@
* @returns {jQuery|*}
*/
$.fn.sortable = function (options) {
var retVal;
var retVal,
args = arguments;
this.each(function () {
var $el = $(this),
@ -47,10 +48,10 @@
$el.removeData('sortable');
}
else if (typeof sortable[options] === 'function') {
retVal = sortable[options].apply(sortable, [].slice.call(arguments, 1));
retVal = sortable[options].apply(sortable, [].slice.call(args, 1));
}
else if (options in sortable.options) {
retVal = sortable.option.apply(sortable, arguments);
retVal = sortable.option.apply(sortable, args);
}
}
});

10
knockout-sortable.js

@ -36,11 +36,11 @@
}.bind(undefined, e, viewModel, allBindings, options[e]);
});
viewModel._sortable = Sortable.create(element, options);
var sortableElement = Sortable.create(element, options);
//Destroy the sortable if knockout disposes the element it's connected to
ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
viewModel._sortable.destroy();
sortableElement.destroy();
});
return ko.bindingHandlers.template.init(element, valueAccessor);
},
@ -84,9 +84,11 @@
newIndex = e.newIndex;
if (e.item.previousElementSibling)
{
newIndex = fromArray.indexOf(ko.dataFor(e.item.previousElementSibling));
if (originalIndex > newIndex)
newIndex = newIndex + 1;
if (originalIndex > newIndex)
newIndex = newIndex + 1;
}
//Remove sortables "unbound" element
e.item.parentNode.removeChild(e.item);

17
ng-sortable.js

@ -5,12 +5,17 @@
(function (factory) {
'use strict';
if (window.angular && window.Sortable) {
factory(angular, Sortable);
}
else if (typeof define === 'function' && define.amd) {
if (typeof define === 'function' && define.amd) {
define(['angular', './Sortable'], factory);
}
else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
require('angular');
factory(angular, require('./Sortable'));
module.exports = 'ng-sortable';
}
else if (window.angular && window.Sortable) {
factory(angular, Sortable);
}
})(function (angular, Sortable) {
'use strict';
@ -41,7 +46,9 @@
if (!ngRepeat) {
// Without ng-repeat
return null;
return function () {
return null;
};
}
// tests: http://jsbin.com/kosubutilo/1/edit?js,output

15
react-sortable-mixin.js vendored

@ -70,7 +70,7 @@
* @mixin
*/
var SortableMixin = {
sortableMixinVersion: '0.1.0',
sortableMixinVersion: '0.1.1',
/**
@ -81,7 +81,7 @@
componentDidMount: function () {
var options = _extend(_extend({}, _defaultOptions), this.sortableOptions || {}),
var DOMNode, options = _extend(_extend({}, _defaultOptions), this.sortableOptions || {}),
copyOptions = _extend({}, options),
emitEvent = function (/** string */type, /** Event */evt) {
@ -120,7 +120,13 @@
}
newState[_getModelName(this)] = items;
this.setState(newState);
if (copyOptions.stateHandler) {
this[copyOptions.stateHandler](newState);
} else {
this.setState(newState);
}
(this !== _activeComponent) && _activeComponent.setState(remoteState);
}
@ -130,9 +136,10 @@
}.bind(this);
}, this);
DOMNode = this.getDOMNode() ? (this.refs[options.ref] || this).getDOMNode() : this.refs[options.ref] || this;
/** @namespace this.refs — http://facebook.github.io/react/docs/more-about-refs.html */
this._sortableInstance = Sortable.create((this.refs[options.ref] || this).getDOMNode(), copyOptions);
this._sortableInstance = Sortable.create(DOMNode, copyOptions);
},
componentWillReceiveProps: function (nextProps) {

Loading…
Cancel
Save