Comparing version 0.0.10 to 0.0.11
@@ -28,5 +28,7 @@ "use strict"; | ||
manager: manager | ||
}, [ | ||
(0, _vue1).h(ChildComponent) | ||
]); | ||
}, { | ||
default: function() { | ||
return (0, _vue1).h(ChildComponent); | ||
} | ||
}); | ||
}; | ||
@@ -49,5 +51,7 @@ }); | ||
backend: _reactDndTestBackend.TestBackend | ||
}, [ | ||
(0, _vue1).h(ChildComponent) | ||
]); | ||
}, { | ||
default: function() { | ||
return (0, _vue1).h(ChildComponent); | ||
} | ||
}); | ||
}; | ||
@@ -54,0 +58,0 @@ }); |
@@ -10,6 +10,17 @@ "use strict"; | ||
var prevWatchStop; | ||
var prevNode; | ||
var prevOptions; | ||
return function(elementOrNode, options) { | ||
var callConnect = function callConnect() { | ||
var nowOptions = scopedOptions || options; | ||
// Avoid repeatedly triggering the connect function when vue patch calls setRef due to data changes in the drag process | ||
if (!(0, _vue).isRef(elementOrNode)) { | ||
if (prevNode === elementOrNode && prevOptions === nowOptions) { | ||
return elementOrNode; | ||
} | ||
prevNode = elementOrNode; | ||
prevOptions = nowOptions; | ||
} | ||
return fn(elementOrNode, // Because of the special nature of vue, when it calls setRef, it will pass in two parameters. Therefore, when we pass connect as a setRef function, we may receive a non-ideal options. For this reason, we assume that when there are options in the spec, The options passed in by Connect are no longer adopted to ensure that the options of spec always take precedence over the options of connect | ||
scopedOptions || options); | ||
nowOptions); | ||
}; | ||
@@ -16,0 +27,0 @@ if ((0, _vue).isRef(elementOrNode)) { |
@@ -35,6 +35,2 @@ "use strict"; | ||
dropTarget: function(node, options) { | ||
// Avoid dragging and dropping while Vue keeps calling connect Function | ||
// if (this.dropTargetNode === node && node) { | ||
// return | ||
// } | ||
_this.clearDropTarget(); | ||
@@ -41,0 +37,0 @@ _this.dropTargetOptions = options; |
@@ -22,5 +22,7 @@ import { createDragDropManager } from 'dnd-core'; | ||
manager: manager | ||
}, [ | ||
h(ChildComponent) | ||
]); | ||
}, { | ||
default: function() { | ||
return h(ChildComponent); | ||
} | ||
}); | ||
}; | ||
@@ -43,5 +45,7 @@ }); | ||
backend: TestBackend | ||
}, [ | ||
h(ChildComponent) | ||
]); | ||
}, { | ||
default: function() { | ||
return h(ChildComponent); | ||
} | ||
}); | ||
}; | ||
@@ -48,0 +52,0 @@ }); |
@@ -5,6 +5,17 @@ import { isRef, watch } from 'vue'; | ||
var prevWatchStop; | ||
var prevNode; | ||
var prevOptions; | ||
return function(elementOrNode, options) { | ||
var callConnect = function callConnect() { | ||
var nowOptions = scopedOptions || options; | ||
// Avoid repeatedly triggering the connect function when vue patch calls setRef due to data changes in the drag process | ||
if (!isRef(elementOrNode)) { | ||
if (prevNode === elementOrNode && prevOptions === nowOptions) { | ||
return elementOrNode; | ||
} | ||
prevNode = elementOrNode; | ||
prevOptions = nowOptions; | ||
} | ||
return fn(elementOrNode, // Because of the special nature of vue, when it calls setRef, it will pass in two parameters. Therefore, when we pass connect as a setRef function, we may receive a non-ideal options. For this reason, we assume that when there are options in the spec, The options passed in by Connect are no longer adopted to ensure that the options of spec always take precedence over the options of connect | ||
scopedOptions || options); | ||
nowOptions); | ||
}; | ||
@@ -11,0 +22,0 @@ if (isRef(elementOrNode)) { |
@@ -30,6 +30,2 @@ function _classCallCheck(instance, Constructor) { | ||
dropTarget: function(node, options) { | ||
// Avoid dragging and dropping while Vue keeps calling connect Function | ||
// if (this.dropTargetNode === node && node) { | ||
// return | ||
// } | ||
_this.clearDropTarget(); | ||
@@ -36,0 +32,0 @@ _this.dropTargetOptions = options; |
{ | ||
"name": "vue3-dnd", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Drag and Drop for Vue3", | ||
@@ -97,3 +97,4 @@ "scripts": { | ||
"*.{js,js,ts,tsx,vue}": [ | ||
"prettier --write" | ||
"prettier --write", | ||
"vitest related --run" | ||
], | ||
@@ -100,0 +101,0 @@ "*.{less,css}": [ |
313052
7064