Skip to content

Commit

Permalink
add Object.assign compiliation using babel
Browse files Browse the repository at this point in the history
  • Loading branch information
pc-david\david.desmaisons committed Jan 26, 2017
1 parent afc342c commit 0d30928
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
14 changes: 8 additions & 6 deletions dist/vuedraggable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

(function () {
Expand Down Expand Up @@ -104,7 +106,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
optionsAdded['on' + elt] = emit.bind(_this2, elt);
});

var options = Object.assign({}, this.options, optionsAdded, { onMove: function onMove(evt) {
var options = _extends({}, this.options, optionsAdded, { onMove: function onMove(evt) {
return _this2.onDragMove(evt);
} });
this._sortable = new Sortable(this.rootContainer, options);
Expand Down Expand Up @@ -175,8 +177,8 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
this.list.splice(newIndex, 0, this.list.splice(oldIndex, 1)[0]);
},
getRelatedContextFromMoveEvent: function getRelatedContextFromMoveEvent(_ref2) {
var to = _ref2.to;
var related = _ref2.related;
var to = _ref2.to,
related = _ref2.related;

var component = this.getUnderlyingPotencialDraggableComponent(to);
if (!component) {
Expand All @@ -186,7 +188,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
var context = { list: list, component: component };
if (to !== related && list && component.getUnderlyingVm) {
var destination = component.getUnderlyingVm(related);
return Object.assign(destination, context);
return _extends(destination, context);
}

return context;
Expand Down Expand Up @@ -253,8 +255,8 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
var relatedContext = this.getRelatedContextFromMoveEvent(evt);
var draggedContext = this.context;
var futureIndex = this.computeFutureIndex(relatedContext, evt);
Object.assign(draggedContext, { futureIndex: futureIndex });
Object.assign(evt, { relatedContext: relatedContext, draggedContext: draggedContext });
_extends(draggedContext, { futureIndex: futureIndex });
_extends(evt, { relatedContext: relatedContext, draggedContext: draggedContext });
return onMove(evt);
},
onDragEnd: function onDragEnd(evt) {
Expand Down
2 changes: 1 addition & 1 deletion dist/vuedraggable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const babel = require('gulp-babel');
gulp.task('scripts', function () {
return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015']
presets: ['es2015'],
plugins: ["transform-object-assign"]
}))
.pipe($.jshint())
.pipe($.jshint.reporter(require('jshint-stylish')))
Expand All @@ -25,7 +26,8 @@ gulp.task('buildjs', ['scripts'], function () {

return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015']
presets: ['es2015'],
plugins: ["transform-object-assign"]
}))
.pipe(gulp.dest('dist'))
.pipe($.size());
Expand All @@ -36,7 +38,8 @@ gulp.task('js', ['buildjs'], function () {

return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015']
presets: ['es2015'],
plugins: ["transform-object-assign"]
}))
.pipe($.uglify())
.pipe(rename({
Expand Down Expand Up @@ -91,7 +94,8 @@ gulp.task('main-bower-files', function() {
gulp.task('copy-js', function() {
return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015']
presets: ['es2015'],
plugins: ["transform-object-assign"]
}))
.pipe(gulp.dest('./examples/src'));
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"sortablejs": "^1.5.0-rc1"
},
"devDependencies": {
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-polyfill": "^6.20.0",
"babel-preset-es2015": "^6.16.0",
"bower": "^1.7.9",
Expand Down

0 comments on commit 0d30928

Please sign in to comment.