From 037806593b095de8a4220104e2bbbd295b459665 Mon Sep 17 00:00:00 2001 From: Yichang Liu Date: Tue, 28 Jun 2016 14:23:05 +0800 Subject: [PATCH] Release 1.0.4 --- dist/vue-dragula.js | 18 +++++++++++++++++- dist/vue-dragula.min.js | 2 +- package.json | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/dist/vue-dragula.js b/dist/vue-dragula.js index fefb158..a5317e9 100644 --- a/dist/vue-dragula.js +++ b/dist/vue-dragula.js @@ -224,7 +224,23 @@ } }, unbind: function unbind() { - service.destroy(name); + var container = this.el; + var unbindBagName = 'globalBag'; + var bagName = this.params.bag; + if (bagName !== undefined && bagName.length !== 0) { + unbindBagName = bagName; + } + var drake = service.find(unbindBagName).drake; + if (!drake) { + return; + } + var containerIndex = drake.containers.indexOf(container); + if (containerIndex > -1) { + drake.containers.splice(containerIndex, 1); + } + if (drake.containers.length === 0) { + service.destroy(unbindBagName); + } } }); } diff --git a/dist/vue-dragula.min.js b/dist/vue-dragula.min.js index 4c03ce5..3c71da6 100644 --- a/dist/vue-dragula.min.js +++ b/dist/vue-dragula.min.js @@ -3,4 +3,4 @@ * (c) 2016 Yichang Liu * Released under the MIT License. */ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("dragula")):"function"==typeof define&&define.amd?define(["dragula"],n):e.vueDragula=n(e.dragula)}(this,function(e){"use strict";function n(n){var t=new a(n),i="globalBag",o=void 0;n.vueDragula={options:t.setOptions.bind(t),eventBus:t.eventBus},n.directive("dragula",{params:["bag"],bind:function(){var n=this.el,a=this.params.bag;void 0!==a&&0!==a.length&&(i=a);var r=t.find(i);return r?(o=r.drake,void o.containers.push(n)):(o=e({containers:[n]}),t.add(i,o),void t.handleModels(i,o))},update:function(e,n){if(e)if(o.models){var t=n?o.models.indexOf(n):-1;t>=0?o.models.splice(t,1,e):o.models.push(e)}else o.models=[e]},unbind:function(){t.destroy(i)}})}function t(e){arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.installed&&console.warn("[vue-dragula] already installed."),n(e)}e="default"in e?e["default"]:e;var i={};if(i.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},i.createClass=function(){function e(e,n){for(var t=0;t=0?o.models.splice(i,1,e):o.models.push(e)}else o.models=[e]},unbind:function(){var e=this.el,n="globalBag",a=this.params.bag;void 0!==a&&0!==a.length&&(n=a);var t=i.find(n).drake;if(t){var o=t.containers.indexOf(e);o>-1&&t.containers.splice(o,1),0===t.containers.length&&i.destroy(n)}}})}function i(e){arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i.installed&&console.warn("[vue-dragula] already installed."),n(e)}e="default"in e?e["default"]:e;var a={};if(a.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a.createClass=function(){function e(e,n){for(var i=0;i