vue3-dnd
Version:
Drag and Drop for Vue Composition API
42 lines (41 loc) • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DropTargetImpl = void 0;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var DropTargetImpl = /*#__PURE__*/ function() {
"use strict";
function DropTargetImpl(spec, monitor) {
_classCallCheck(this, DropTargetImpl);
this.spec = spec;
this.monitor = monitor;
}
var _proto = DropTargetImpl.prototype;
_proto.canDrop = function canDrop() {
var spec = this.spec;
var monitor = this.monitor;
return spec.canDrop ? spec.canDrop(monitor.getItem(), monitor) : true;
};
_proto.hover = function hover() {
var spec = this.spec;
var monitor = this.monitor;
if (spec.hover) {
spec.hover(monitor.getItem(), monitor);
}
};
_proto.drop = function drop() {
var spec = this.spec;
var monitor = this.monitor;
if (spec.drop) {
return spec.drop(monitor.getItem(), monitor);
}
return;
};
return DropTargetImpl;
}();
exports.DropTargetImpl = DropTargetImpl;