Skip to content

Commit

Permalink
Prepare Release
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmalonenz committed Mar 27, 2016
1 parent 6b478a4 commit cc4ea6f
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 35 deletions.
8 changes: 4 additions & 4 deletions dist/amd/dragula-and-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define(['exports', 'aurelia-templating', 'aurelia-binding', 'aurelia-dependency-

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _class;

var DragulaAndDrop = exports.DragulaAndDrop = (_dec = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec2 = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec3 = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec4 = (0, _aureliaTemplating.bindable)({ name: 'containers', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec5 = (0, _aureliaTemplating.bindable)({ name: 'isContainer', attribute: 'is-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec6 = (0, _aureliaTemplating.bindable)({ name: 'copy', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec7 = (0, _aureliaTemplating.bindable)({ name: 'copySortSource', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec8 = (0, _aureliaTemplating.bindable)({ name: 'revertOnSpill', attribute: 'revert-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: true }), _dec9 = (0, _aureliaTemplating.bindable)({ name: 'removeOnSpill', attribute: 'remove-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec10 = (0, _aureliaTemplating.bindable)({ name: 'direction', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec11 = (0, _aureliaTemplating.bindable)({ name: 'ignoreInputTextSelection', attribute: 'ingore-input-text-selection', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec12 = (0, _aureliaTemplating.bindable)({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec13 = (0, _aureliaTemplating.bindable)({ name: 'targetClass', attribute: 'target-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drop-target' }), _dec14 = (0, _aureliaTemplating.bindable)({ name: 'sourceClass', attribute: 'source-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drag-source' }), _dec15 = (0, _aureliaTemplating.bindable)({ name: 'dragFn', attribute: 'drag-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: function defaultValue(item, source) {} }), _dec16 = (0, _aureliaTemplating.bindable)({ name: 'dropFn', attribute: 'drop-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: function defaultValue(item, target, source, sibling) {} }), _dec17 = (0, _aureliaTemplating.bindable)({ name: 'dragEndFn', attribute: 'drag-end-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: function defaultValue(item) {} }), _dec18 = (0, _aureliaTemplating.customElement)('dragula-and-drop'), _dec19 = (0, _aureliaTemplating.noView)(), _dec20 = (0, _aureliaDependencyInjection.inject)(_options.GLOBAL_OPTIONS), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = _dec6(_class = _dec7(_class = _dec8(_class = _dec9(_class = _dec10(_class = _dec11(_class = _dec12(_class = _dec13(_class = _dec14(_class = _dec15(_class = _dec16(_class = _dec17(_class = _dec18(_class = _dec19(_class = _dec20(_class = function () {
var DragulaAndDrop = exports.DragulaAndDrop = (_dec = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec2 = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec3 = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec4 = (0, _aureliaTemplating.bindable)({ name: 'containers', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec5 = (0, _aureliaTemplating.bindable)({ name: 'isContainer', attribute: 'is-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec6 = (0, _aureliaTemplating.bindable)({ name: 'copy', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec7 = (0, _aureliaTemplating.bindable)({ name: 'copySortSource', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec8 = (0, _aureliaTemplating.bindable)({ name: 'revertOnSpill', attribute: 'revert-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: true }), _dec9 = (0, _aureliaTemplating.bindable)({ name: 'removeOnSpill', attribute: 'remove-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec10 = (0, _aureliaTemplating.bindable)({ name: 'direction', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec11 = (0, _aureliaTemplating.bindable)({ name: 'ignoreInputTextSelection', attribute: 'ingore-input-text-selection', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec12 = (0, _aureliaTemplating.bindable)({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec13 = (0, _aureliaTemplating.bindable)({ name: 'targetClass', attribute: 'target-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drop-target' }), _dec14 = (0, _aureliaTemplating.bindable)({ name: 'sourceClass', attribute: 'source-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drag-source' }), _dec15 = (0, _aureliaTemplating.bindable)({ name: 'dragFn', attribute: 'drag-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec16 = (0, _aureliaTemplating.bindable)({ name: 'dropFn', attribute: 'drop-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec17 = (0, _aureliaTemplating.bindable)({ name: 'dragEndFn', attribute: 'drag-end-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec18 = (0, _aureliaTemplating.customElement)('dragula-and-drop'), _dec19 = (0, _aureliaTemplating.noView)(), _dec20 = (0, _aureliaDependencyInjection.inject)(_options.GLOBAL_OPTIONS), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = _dec6(_class = _dec7(_class = _dec8(_class = _dec9(_class = _dec10(_class = _dec11(_class = _dec12(_class = _dec13(_class = _dec14(_class = _dec15(_class = _dec16(_class = _dec17(_class = _dec18(_class = _dec19(_class = _dec20(_class = function () {
function DragulaAndDrop(globalOptions) {
_classCallCheck(this, DragulaAndDrop);

Expand All @@ -39,15 +39,15 @@ define(['exports', 'aurelia-templating', 'aurelia-binding', 'aurelia-dependency-

this.dragula.on('drop', function (item, target, source, sibling) {
_this.dragula.cancel();
_this.dropFn({ item: item, target: target, source: source, sibling: sibling });
if (typeof _this.dropFn === 'function') _this.dropFn({ item: item, target: target, source: source, sibling: sibling });
});

this.dragula.on('drag', function (item, source) {
_this.dragFn({ item: item, source: source });
if (typeof _this.dragFn === 'function') _this.dragFn({ item: item, source: source });
});

this.dragula.on('dragend', function (item) {
_this.dragEndFn({ item: item });
if (typeof _this.dragEndFn === 'function') _this.dragEndFn({ item: item });
});
};

Expand Down
6 changes: 4 additions & 2 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
define(['exports', './options', './dragula'], function (exports, _options, _dragula) {
define(['exports', './options', './dragula', './move-before'], function (exports, _options, _dragula, _moveBefore) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Options = exports.Dragula = undefined;
exports.moveBefore = exports.DIRECTION = exports.Options = exports.Dragula = undefined;
exports.configure = configure;
exports.Dragula = _dragula.Dragula;
exports.Options = _options.Options;
exports.DIRECTION = _options.DIRECTION;
exports.moveBefore = _moveBefore.moveBefore;
function configure(config, callback) {
var defaults = new _options.Options();
config.container.registerInstance(_options.GLOBAL_OPTIONS, defaults);
Expand Down
20 changes: 20 additions & 0 deletions dist/amd/move-before.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
define(["exports"], function (exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.moveBefore = moveBefore;
function moveBefore(array, itemMatcherFn, siblingMatcherFn) {
var removedItem = remove(array, itemMatcherFn);
var nextIndex = array.findIndex(siblingMatcherFn);
array.splice(nextIndex >= 0 ? nextIndex : array.length, 0, removedItem);
}

function remove(array, matcherFn) {
var index = array.findIndex(matcherFn);
if (index >= 0) {
return array.splice(index, 1)[0];
}
}
});
27 changes: 21 additions & 6 deletions dist/aurelia-dragula.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export function rm(el, className) {
@bindable({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'targetClass', attribute: 'target-class', defaultBindingMode: bindingMode.oneTime, defaultValue: 'drop-target' })
@bindable({ name: 'sourceClass', attribute: 'source-class', defaultBindingMode: bindingMode.oneTime, defaultValue: 'drag-source' })
@bindable({ name: 'dragFn', attribute: 'drag-fn', defaultBindingMode: bindingMode.oneTime, defaultValue: (item, source) => {}})
@bindable({ name: 'dropFn', attribute: 'drop-fn', defaultBindingMode: bindingMode.oneTime, defaultValue: (item, target, source, sibling) => {}})
@bindable({ name: 'dragEndFn', attribute: 'drag-end-fn', defaultBindingMode: bindingMode.oneTime, defaultValue: (item) => {}})
@bindable({ name: 'dragFn', attribute: 'drag-fn', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'dropFn', attribute: 'drop-fn', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'dragEndFn', attribute: 'drag-end-fn', defaultBindingMode: bindingMode.oneTime })
@customElement('dragula-and-drop')
@noView()
@inject(GLOBAL_OPTIONS)
Expand All @@ -81,15 +81,18 @@ export class DragulaAndDrop {

this.dragula.on('drop', (item, target, source, sibling) => {
this.dragula.cancel();
this.dropFn({ item: item, target: target, source: source, sibling: sibling });
if (typeof this.dropFn === 'function')
this.dropFn({ item: item, target: target, source: source, sibling: sibling });
});

this.dragula.on('drag', (item, source) => {
this.dragFn({ item: item, source: source});
if (typeof this.dragFn === 'function')
this.dragFn({ item: item, source: source});
});

this.dragula.on('dragend', (item) => {
this.dragEndFn({ item: item });
if (typeof this.dragEndFn === 'function')
this.dragEndFn({ item: item });
})
}

Expand Down Expand Up @@ -699,6 +702,18 @@ export class Emitter {
}
}

export function moveBefore(array, itemMatcherFn, siblingMatcherFn) {
let removedItem = remove(array, itemMatcherFn);
let nextIndex = array.findIndex(siblingMatcherFn);
array.splice(nextIndex >= 0 ? nextIndex : array.length, 0, removedItem);
}

function remove(array, matcherFn) {
let index = array.findIndex(matcherFn);
if (index >= 0) {
return array.splice(index, 1)[0];
}
}
export const GLOBAL_OPTIONS = 'GlobalOptions';

export const DIRECTION = {
Expand Down
8 changes: 4 additions & 4 deletions dist/commonjs/dragula-and-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var _dragula = require('./dragula');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var DragulaAndDrop = exports.DragulaAndDrop = (_dec = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec2 = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec3 = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec4 = (0, _aureliaTemplating.bindable)({ name: 'containers', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec5 = (0, _aureliaTemplating.bindable)({ name: 'isContainer', attribute: 'is-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec6 = (0, _aureliaTemplating.bindable)({ name: 'copy', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec7 = (0, _aureliaTemplating.bindable)({ name: 'copySortSource', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec8 = (0, _aureliaTemplating.bindable)({ name: 'revertOnSpill', attribute: 'revert-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: true }), _dec9 = (0, _aureliaTemplating.bindable)({ name: 'removeOnSpill', attribute: 'remove-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec10 = (0, _aureliaTemplating.bindable)({ name: 'direction', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec11 = (0, _aureliaTemplating.bindable)({ name: 'ignoreInputTextSelection', attribute: 'ingore-input-text-selection', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec12 = (0, _aureliaTemplating.bindable)({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec13 = (0, _aureliaTemplating.bindable)({ name: 'targetClass', attribute: 'target-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drop-target' }), _dec14 = (0, _aureliaTemplating.bindable)({ name: 'sourceClass', attribute: 'source-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drag-source' }), _dec15 = (0, _aureliaTemplating.bindable)({ name: 'dragFn', attribute: 'drag-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: function defaultValue(item, source) {} }), _dec16 = (0, _aureliaTemplating.bindable)({ name: 'dropFn', attribute: 'drop-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: function defaultValue(item, target, source, sibling) {} }), _dec17 = (0, _aureliaTemplating.bindable)({ name: 'dragEndFn', attribute: 'drag-end-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: function defaultValue(item) {} }), _dec18 = (0, _aureliaTemplating.customElement)('dragula-and-drop'), _dec19 = (0, _aureliaTemplating.noView)(), _dec20 = (0, _aureliaDependencyInjection.inject)(_options.GLOBAL_OPTIONS), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = _dec6(_class = _dec7(_class = _dec8(_class = _dec9(_class = _dec10(_class = _dec11(_class = _dec12(_class = _dec13(_class = _dec14(_class = _dec15(_class = _dec16(_class = _dec17(_class = _dec18(_class = _dec19(_class = _dec20(_class = function () {
var DragulaAndDrop = exports.DragulaAndDrop = (_dec = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec2 = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec3 = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec4 = (0, _aureliaTemplating.bindable)({ name: 'containers', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec5 = (0, _aureliaTemplating.bindable)({ name: 'isContainer', attribute: 'is-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec6 = (0, _aureliaTemplating.bindable)({ name: 'copy', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec7 = (0, _aureliaTemplating.bindable)({ name: 'copySortSource', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec8 = (0, _aureliaTemplating.bindable)({ name: 'revertOnSpill', attribute: 'revert-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: true }), _dec9 = (0, _aureliaTemplating.bindable)({ name: 'removeOnSpill', attribute: 'remove-on-spill', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec10 = (0, _aureliaTemplating.bindable)({ name: 'direction', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec11 = (0, _aureliaTemplating.bindable)({ name: 'ignoreInputTextSelection', attribute: 'ingore-input-text-selection', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec12 = (0, _aureliaTemplating.bindable)({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec13 = (0, _aureliaTemplating.bindable)({ name: 'targetClass', attribute: 'target-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drop-target' }), _dec14 = (0, _aureliaTemplating.bindable)({ name: 'sourceClass', attribute: 'source-class', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: 'drag-source' }), _dec15 = (0, _aureliaTemplating.bindable)({ name: 'dragFn', attribute: 'drag-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec16 = (0, _aureliaTemplating.bindable)({ name: 'dropFn', attribute: 'drop-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec17 = (0, _aureliaTemplating.bindable)({ name: 'dragEndFn', attribute: 'drag-end-fn', defaultBindingMode: _aureliaBinding.bindingMode.oneTime }), _dec18 = (0, _aureliaTemplating.customElement)('dragula-and-drop'), _dec19 = (0, _aureliaTemplating.noView)(), _dec20 = (0, _aureliaDependencyInjection.inject)(_options.GLOBAL_OPTIONS), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = _dec6(_class = _dec7(_class = _dec8(_class = _dec9(_class = _dec10(_class = _dec11(_class = _dec12(_class = _dec13(_class = _dec14(_class = _dec15(_class = _dec16(_class = _dec17(_class = _dec18(_class = _dec19(_class = _dec20(_class = function () {
function DragulaAndDrop(globalOptions) {
_classCallCheck(this, DragulaAndDrop);

Expand All @@ -44,15 +44,15 @@ var DragulaAndDrop = exports.DragulaAndDrop = (_dec = (0, _aureliaTemplating.bin

this.dragula.on('drop', function (item, target, source, sibling) {
_this.dragula.cancel();
_this.dropFn({ item: item, target: target, source: source, sibling: sibling });
if (typeof _this.dropFn === 'function') _this.dropFn({ item: item, target: target, source: source, sibling: sibling });
});

this.dragula.on('drag', function (item, source) {
_this.dragFn({ item: item, source: source });
if (typeof _this.dragFn === 'function') _this.dragFn({ item: item, source: source });
});

this.dragula.on('dragend', function (item) {
_this.dragEndFn({ item: item });
if (typeof _this.dragEndFn === 'function') _this.dragEndFn({ item: item });
});
};

Expand Down
6 changes: 5 additions & 1 deletion dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Options = exports.Dragula = undefined;
exports.moveBefore = exports.DIRECTION = exports.Options = exports.Dragula = undefined;
exports.configure = configure;

var _options = require('./options');

var _dragula = require('./dragula');

var _moveBefore = require('./move-before');

exports.Dragula = _dragula.Dragula;
exports.Options = _options.Options;
exports.DIRECTION = _options.DIRECTION;
exports.moveBefore = _moveBefore.moveBefore;
function configure(config, callback) {
var defaults = new _options.Options();
config.container.registerInstance(_options.GLOBAL_OPTIONS, defaults);
Expand Down
18 changes: 18 additions & 0 deletions dist/commonjs/move-before.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.moveBefore = moveBefore;
function moveBefore(array, itemMatcherFn, siblingMatcherFn) {
var removedItem = remove(array, itemMatcherFn);
var nextIndex = array.findIndex(siblingMatcherFn);
array.splice(nextIndex >= 0 ? nextIndex : array.length, 0, removedItem);
}

function remove(array, matcherFn) {
var index = array.findIndex(matcherFn);
if (index >= 0) {
return array.splice(index, 1)[0];
}
}
Loading

0 comments on commit cc4ea6f

Please sign in to comment.