Files
coopgo/node_modules/react-dnd/dist/cjs/hooks/useDrop/DropTargetImpl.js
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

60 lines
2.0 KiB
JavaScript

"use strict";
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"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DropTargetImpl = /*#__PURE__*/function () {
function DropTargetImpl(spec, monitor) {
_classCallCheck(this, DropTargetImpl);
_defineProperty(this, "spec", void 0);
_defineProperty(this, "monitor", void 0);
this.spec = spec;
this.monitor = monitor;
}
_createClass(DropTargetImpl, [{
key: "canDrop",
value: function canDrop() {
var spec = this.spec;
var monitor = this.monitor;
return spec.canDrop ? spec.canDrop(monitor.getItem(), monitor) : true;
}
}, {
key: "hover",
value: function hover() {
var spec = this.spec;
var monitor = this.monitor;
if (spec.hover) {
spec.hover(monitor.getItem(), monitor);
}
}
}, {
key: "drop",
value: function drop() {
var spec = this.spec;
var monitor = this.monitor;
if (spec.drop) {
return spec.drop(monitor.getItem(), monitor);
}
}
}]);
return DropTargetImpl;
}();
exports.DropTargetImpl = DropTargetImpl;