Skip to content

Commit 17be30e

Browse files
sending event after tick (issue #)
1 parent 71e0033 commit 17be30e

File tree

4 files changed

+468
-230
lines changed

4 files changed

+468
-230
lines changed

dist/vuedraggable.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4+
35
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; };
46

57
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); } }
@@ -33,17 +35,21 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
3335
}
3436

3537
function emit(evtName, evtData) {
36-
this.$emit(evtName.toLowerCase(), evtData);
38+
var _this = this;
39+
40+
this.$nextTick(function () {
41+
return _this.$emit(evtName.toLowerCase(), evtData);
42+
});
3743
}
3844

3945
function delegateAndEmit(evtName) {
40-
var _this = this;
46+
var _this2 = this;
4147

4248
return function (evtData) {
43-
if (_this.realList !== null) {
44-
_this['onDrag' + evtName](evtData);
49+
if (_this2.realList !== null) {
50+
_this2['onDrag' + evtName](evtData);
4551
}
46-
emit.call(_this, evtName, evtData);
52+
emit.call(_this2, evtName, evtData);
4753
};
4854
}
4955

@@ -100,19 +106,19 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
100106
return h(this.element, null, this.$slots.default);
101107
},
102108
mounted: function mounted() {
103-
var _this2 = this;
109+
var _this3 = this;
104110

105111
var optionsAdded = {};
106112
eventsListened.forEach(function (elt) {
107-
optionsAdded['on' + elt] = delegateAndEmit.call(_this2, elt);
113+
optionsAdded['on' + elt] = delegateAndEmit.call(_this3, elt);
108114
});
109115

110116
eventsToEmit.forEach(function (elt) {
111-
optionsAdded['on' + elt] = emit.bind(_this2, elt);
117+
optionsAdded['on' + elt] = emit.bind(_this3, elt);
112118
});
113119

114120
var options = _extends({}, this.options, optionsAdded, { onMove: function onMove(evt) {
115-
return _this2.onDragMove(evt);
121+
return _this3.onDragMove(evt);
116122
} });
117123
this._sortable = new Sortable(this.rootContainer, options);
118124
this.computeIndexes();
@@ -127,7 +133,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
127133
return this.transitionMode ? this.$el.children[0] : this.$el;
128134
},
129135
isCloning: function isCloning() {
130-
return !!this.options && !!this.options.group && this.options.group.pull === 'clone';
136+
return !!this.options && !!this.options.group !== null && this.options.group.pull === 'clone';
131137
},
132138
realList: function realList() {
133139
return !!this.list ? this.list : this.value;
@@ -153,10 +159,10 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
153159
return this.transitionMode ? rawNodes[0].child.$slots.default : rawNodes;
154160
},
155161
computeIndexes: function computeIndexes() {
156-
var _this3 = this;
162+
var _this4 = this;
157163

158164
this.$nextTick(function () {
159-
_this3.visibleIndexes = _computeIndexes(_this3.getChildrenNodes(), _this3.rootContainer.children);
165+
_this4.visibleIndexes = _computeIndexes(_this4.getChildrenNodes(), _this4.rootContainer.children);
160166
});
161167
},
162168
getUnderlyingVm: function getUnderlyingVm(htmlElt) {
@@ -173,10 +179,10 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
173179
return __vue__.$parent;
174180
},
175181
emitChanges: function emitChanges(evt) {
176-
var _this4 = this;
182+
var _this5 = this;
177183

178184
this.$nextTick(function () {
179-
_this4.$emit('change', evt);
185+
_this5.$emit('change', evt);
180186
});
181187
},
182188
alterList: function alterList(onList) {
@@ -203,8 +209,8 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
203209
this.alterList(updatePosition);
204210
},
205211
getRelatedContextFromMoveEvent: function getRelatedContextFromMoveEvent(_ref2) {
206-
var to = _ref2.to;
207-
var related = _ref2.related;
212+
var to = _ref2.to,
213+
related = _ref2.related;
208214

209215
var component = this.getUnderlyingPotencialDraggableComponent(to);
210216
if (!component) {
@@ -293,7 +299,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
293299
return draggableComponent;
294300
}
295301

296-
if (typeof exports == "object") {
302+
if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) == "object") {
297303
var Sortable = require("sortablejs");
298304
module.exports = buildDraggable(Sortable);
299305
} else if (typeof define == "function" && define.amd) {

dist/vuedraggable.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)