This commit is contained in:
22
node_modules/react-dnd/LICENSE
generated
vendored
Normal file
22
node_modules/react-dnd/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Dan Abramov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
17
node_modules/react-dnd/README.md
generated
vendored
Normal file
17
node_modules/react-dnd/README.md
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
[](https://www.npmjs.com/package/react-dnd)
|
||||
[](https://www.npmjs.com/package/react-dnd)
|
||||
[](https://travis-ci.org/react-dnd/react-dnd)
|
||||
|
||||
# React _DnD_
|
||||
|
||||
Drag and Drop for React.
|
||||
|
||||
See the docs, tutorials and examples on the website:
|
||||
|
||||
http://react-dnd.github.io/react-dnd/
|
||||
|
||||
See the changelog on the Releases page:
|
||||
|
||||
https://github.com/react-dnd/react-dnd/releases
|
||||
|
||||
Big thanks to [BrowserStack](https://www.browserstack.com) for letting the maintainers use their service to debug browser issues.
|
||||
16
node_modules/react-dnd/dist/cjs/core/DndContext.js
generated
vendored
Normal file
16
node_modules/react-dnd/dist/cjs/core/DndContext.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DndContext = void 0;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
/**
|
||||
* Create the React Context
|
||||
*/
|
||||
var DndContext = (0, _react.createContext)({
|
||||
dragDropManager: undefined
|
||||
});
|
||||
exports.DndContext = DndContext;
|
||||
105
node_modules/react-dnd/dist/cjs/core/DndProvider.js
generated
vendored
Normal file
105
node_modules/react-dnd/dist/cjs/core/DndProvider.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DndProvider = void 0;
|
||||
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _dndCore = require("dnd-core");
|
||||
|
||||
var _DndContext = require("./DndContext");
|
||||
|
||||
var _excluded = ["children"];
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
var refCount = 0;
|
||||
var INSTANCE_SYM = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');
|
||||
/**
|
||||
* A React component that provides the React-DnD context
|
||||
*/
|
||||
|
||||
var DndProvider = (0, _react.memo)(function DndProvider(_ref) {
|
||||
var children = _ref.children,
|
||||
props = _objectWithoutProperties(_ref, _excluded);
|
||||
|
||||
var _getDndContextValue = getDndContextValue(props),
|
||||
_getDndContextValue2 = _slicedToArray(_getDndContextValue, 2),
|
||||
manager = _getDndContextValue2[0],
|
||||
isGlobalInstance = _getDndContextValue2[1]; // memoized from props
|
||||
|
||||
/**
|
||||
* If the global context was used to store the DND context
|
||||
* then where theres no more references to it we should
|
||||
* clean it up to avoid memory leaks
|
||||
*/
|
||||
|
||||
|
||||
(0, _react.useEffect)(function () {
|
||||
if (isGlobalInstance) {
|
||||
var context = getGlobalContext();
|
||||
++refCount;
|
||||
return function () {
|
||||
if (--refCount === 0) {
|
||||
context[INSTANCE_SYM] = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}, []);
|
||||
return (0, _jsxRuntime.jsx)(_DndContext.DndContext.Provider, Object.assign({
|
||||
value: manager
|
||||
}, {
|
||||
children: children
|
||||
}), void 0);
|
||||
});
|
||||
exports.DndProvider = DndProvider;
|
||||
|
||||
function getDndContextValue(props) {
|
||||
if ('manager' in props) {
|
||||
var _manager = {
|
||||
dragDropManager: props.manager
|
||||
};
|
||||
return [_manager, false];
|
||||
}
|
||||
|
||||
var manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);
|
||||
var isGlobalInstance = !props.context;
|
||||
return [manager, isGlobalInstance];
|
||||
}
|
||||
|
||||
function createSingletonDndContext(backend) {
|
||||
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getGlobalContext();
|
||||
var options = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var debugMode = arguments.length > 3 ? arguments[3] : undefined;
|
||||
var ctx = context;
|
||||
|
||||
if (!ctx[INSTANCE_SYM]) {
|
||||
ctx[INSTANCE_SYM] = {
|
||||
dragDropManager: (0, _dndCore.createDragDropManager)(backend, context, options, debugMode)
|
||||
};
|
||||
}
|
||||
|
||||
return ctx[INSTANCE_SYM];
|
||||
}
|
||||
|
||||
function getGlobalContext() {
|
||||
return typeof global !== 'undefined' ? global : window;
|
||||
}
|
||||
35
node_modules/react-dnd/dist/cjs/core/DragPreviewImage.js
generated
vendored
Normal file
35
node_modules/react-dnd/dist/cjs/core/DragPreviewImage.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DragPreviewImage = void 0;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
/**
|
||||
* A utility for rendering a drag preview image
|
||||
*/
|
||||
var DragPreviewImage = (0, _react.memo)(function DragPreviewImage(_ref) {
|
||||
var connect = _ref.connect,
|
||||
src = _ref.src;
|
||||
(0, _react.useEffect)(function () {
|
||||
if (typeof Image === 'undefined') return;
|
||||
var connected = false;
|
||||
var img = new Image();
|
||||
img.src = src;
|
||||
|
||||
img.onload = function () {
|
||||
connect(img);
|
||||
connected = true;
|
||||
};
|
||||
|
||||
return function () {
|
||||
if (connected) {
|
||||
connect(null);
|
||||
}
|
||||
};
|
||||
});
|
||||
return null;
|
||||
});
|
||||
exports.DragPreviewImage = DragPreviewImage;
|
||||
44
node_modules/react-dnd/dist/cjs/core/index.js
generated
vendored
Normal file
44
node_modules/react-dnd/dist/cjs/core/index.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _DndContext = require("./DndContext");
|
||||
|
||||
Object.keys(_DndContext).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DndContext[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DndContext[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _DndProvider = require("./DndProvider");
|
||||
|
||||
Object.keys(_DndProvider).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DndProvider[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DndProvider[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _DragPreviewImage = require("./DragPreviewImage");
|
||||
|
||||
Object.keys(_DragPreviewImage).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DragPreviewImage[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DragPreviewImage[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
196
node_modules/react-dnd/dist/cjs/decorators/DragLayer.js
generated
vendored
Normal file
196
node_modules/react-dnd/dist/cjs/decorators/DragLayer.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DragLayer = DragLayer;
|
||||
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _shallowequal = require("@react-dnd/shallowequal");
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
||||
|
||||
var _core = require("../core");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
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; }
|
||||
|
||||
/**
|
||||
* @param collect The props collector function
|
||||
* @param options The DnD options
|
||||
*/
|
||||
function DragLayer(collect) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
(0, _utils.checkDecoratorArguments)('DragLayer', 'collect[, options]', collect, options);
|
||||
(0, _invariant.invariant)(typeof collect === 'function', 'Expected "collect" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', collect);
|
||||
(0, _invariant.invariant)((0, _utils.isPlainObject)(options), 'Expected "options" provided as the second argument to DragLayer to be a plain object when specified. ' + 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', options);
|
||||
return function decorateLayer(DecoratedComponent) {
|
||||
var Decorated = DecoratedComponent;
|
||||
var _options$arePropsEqua = options.arePropsEqual,
|
||||
arePropsEqual = _options$arePropsEqua === void 0 ? _shallowequal.shallowEqual : _options$arePropsEqua;
|
||||
var displayName = Decorated.displayName || Decorated.name || 'Component';
|
||||
|
||||
var DragLayerContainer = /*#__PURE__*/function (_Component) {
|
||||
_inherits(DragLayerContainer, _Component);
|
||||
|
||||
var _super = _createSuper(DragLayerContainer);
|
||||
|
||||
function DragLayerContainer() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, DragLayerContainer);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _super.call.apply(_super, [this].concat(args));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "manager", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "isCurrentlyMounted", false);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "unsubscribeFromOffsetChange", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "unsubscribeFromStateChange", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "ref", (0, _react.createRef)());
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handleChange", function () {
|
||||
if (!_this.isCurrentlyMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nextState = _this.getCurrentState();
|
||||
|
||||
if (!(0, _shallowequal.shallowEqual)(nextState, _this.state)) {
|
||||
_this.setState(nextState);
|
||||
}
|
||||
});
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(DragLayerContainer, [{
|
||||
key: "getDecoratedComponentInstance",
|
||||
value: function getDecoratedComponentInstance() {
|
||||
(0, _invariant.invariant)(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
|
||||
return this.ref.current;
|
||||
}
|
||||
}, {
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps, nextState) {
|
||||
return !arePropsEqual(nextProps, this.props) || !(0, _shallowequal.shallowEqual)(nextState, this.state);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.isCurrentlyMounted = true;
|
||||
this.handleChange();
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.isCurrentlyMounted = false;
|
||||
|
||||
if (this.unsubscribeFromOffsetChange) {
|
||||
this.unsubscribeFromOffsetChange();
|
||||
this.unsubscribeFromOffsetChange = undefined;
|
||||
}
|
||||
|
||||
if (this.unsubscribeFromStateChange) {
|
||||
this.unsubscribeFromStateChange();
|
||||
this.unsubscribeFromStateChange = undefined;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return (0, _jsxRuntime.jsx)(_core.DndContext.Consumer, {
|
||||
children: function children(_ref) {
|
||||
var dragDropManager = _ref.dragDropManager;
|
||||
|
||||
if (dragDropManager === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
_this2.receiveDragDropManager(dragDropManager); // Let componentDidMount fire to initialize the collected state
|
||||
|
||||
|
||||
if (!_this2.isCurrentlyMounted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (0, _jsxRuntime.jsx)(Decorated, Object.assign({}, _this2.props, _this2.state, {
|
||||
ref: (0, _utils.isRefable)(Decorated) ? _this2.ref : null
|
||||
}), void 0);
|
||||
}
|
||||
}, void 0);
|
||||
}
|
||||
}, {
|
||||
key: "receiveDragDropManager",
|
||||
value: function receiveDragDropManager(dragDropManager) {
|
||||
if (this.manager !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.manager = dragDropManager;
|
||||
(0, _invariant.invariant)(_typeof(dragDropManager) === 'object', 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
|
||||
var monitor = this.manager.getMonitor();
|
||||
this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleChange);
|
||||
this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleChange);
|
||||
}
|
||||
}, {
|
||||
key: "getCurrentState",
|
||||
value: function getCurrentState() {
|
||||
if (!this.manager) {
|
||||
return {};
|
||||
}
|
||||
|
||||
var monitor = this.manager.getMonitor();
|
||||
return collect(monitor, this.props);
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragLayerContainer;
|
||||
}(_react.Component);
|
||||
|
||||
_defineProperty(DragLayerContainer, "displayName", "DragLayer(".concat(displayName, ")"));
|
||||
|
||||
_defineProperty(DragLayerContainer, "DecoratedComponent", DecoratedComponent);
|
||||
|
||||
return (0, _hoistNonReactStatics.default)(DragLayerContainer, DecoratedComponent);
|
||||
};
|
||||
}
|
||||
59
node_modules/react-dnd/dist/cjs/decorators/DragSource.js
generated
vendored
Normal file
59
node_modules/react-dnd/dist/cjs/decorators/DragSource.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DragSource = DragSource;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _internals = require("../internals");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _decorateHandler = require("./decorateHandler");
|
||||
|
||||
var _createSourceFactory = require("./createSourceFactory");
|
||||
|
||||
/**
|
||||
* Decorates a component as a dragsource
|
||||
* @param type The dragsource type
|
||||
* @param spec The drag source specification
|
||||
* @param collect The props collector function
|
||||
* @param options DnD options
|
||||
*/
|
||||
function DragSource(type, spec, collect) {
|
||||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
(0, _utils.checkDecoratorArguments)('DragSource', 'type, spec, collect[, options]', type, spec, collect, options);
|
||||
var getType = type;
|
||||
|
||||
if (typeof type !== 'function') {
|
||||
(0, _invariant.invariant)((0, _utils.isValidType)(type), 'Expected "type" provided as the first argument to DragSource to be ' + 'a string, or a function that returns a string given the current props. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', type);
|
||||
|
||||
getType = function getType() {
|
||||
return type;
|
||||
};
|
||||
}
|
||||
|
||||
(0, _invariant.invariant)((0, _utils.isPlainObject)(spec), 'Expected "spec" provided as the second argument to DragSource to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', spec);
|
||||
var createSource = (0, _createSourceFactory.createSourceFactory)(spec);
|
||||
(0, _invariant.invariant)(typeof collect === 'function', 'Expected "collect" provided as the third argument to DragSource to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);
|
||||
(0, _invariant.invariant)((0, _utils.isPlainObject)(options), 'Expected "options" provided as the fourth argument to DragSource to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);
|
||||
return function decorateSource(DecoratedComponent) {
|
||||
return (0, _decorateHandler.decorateHandler)({
|
||||
containerDisplayName: 'DragSource',
|
||||
createHandler: createSource,
|
||||
registerHandler: _internals.registerSource,
|
||||
createConnector: function createConnector(backend) {
|
||||
return new _internals.SourceConnector(backend);
|
||||
},
|
||||
createMonitor: function createMonitor(manager) {
|
||||
return new _internals.DragSourceMonitorImpl(manager);
|
||||
},
|
||||
DecoratedComponent: DecoratedComponent,
|
||||
getType: getType,
|
||||
collect: collect,
|
||||
options: options
|
||||
});
|
||||
};
|
||||
}
|
||||
58
node_modules/react-dnd/dist/cjs/decorators/DropTarget.js
generated
vendored
Normal file
58
node_modules/react-dnd/dist/cjs/decorators/DropTarget.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DropTarget = DropTarget;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _internals = require("../internals");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _decorateHandler = require("./decorateHandler");
|
||||
|
||||
var _createTargetFactory = require("./createTargetFactory");
|
||||
|
||||
/**
|
||||
* @param type The accepted target type
|
||||
* @param spec The DropTarget specification
|
||||
* @param collect The props collector function
|
||||
* @param options Options
|
||||
*/
|
||||
function DropTarget(type, spec, collect) {
|
||||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
(0, _utils.checkDecoratorArguments)('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);
|
||||
var getType = type;
|
||||
|
||||
if (typeof type !== 'function') {
|
||||
(0, _invariant.invariant)((0, _utils.isValidType)(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' + 'a string, an array of strings, or a function that returns either given ' + 'the current props. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', type);
|
||||
|
||||
getType = function getType() {
|
||||
return type;
|
||||
};
|
||||
}
|
||||
|
||||
(0, _invariant.invariant)((0, _utils.isPlainObject)(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', spec);
|
||||
var createTarget = (0, _createTargetFactory.createTargetFactory)(spec);
|
||||
(0, _invariant.invariant)(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
|
||||
(0, _invariant.invariant)((0, _utils.isPlainObject)(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
|
||||
return function decorateTarget(DecoratedComponent) {
|
||||
return (0, _decorateHandler.decorateHandler)({
|
||||
containerDisplayName: 'DropTarget',
|
||||
createHandler: createTarget,
|
||||
registerHandler: _internals.registerTarget,
|
||||
createMonitor: function createMonitor(manager) {
|
||||
return new _internals.DropTargetMonitorImpl(manager);
|
||||
},
|
||||
createConnector: function createConnector(backend) {
|
||||
return new _internals.TargetConnector(backend);
|
||||
},
|
||||
DecoratedComponent: DecoratedComponent,
|
||||
getType: getType,
|
||||
collect: collect,
|
||||
options: options
|
||||
});
|
||||
};
|
||||
}
|
||||
116
node_modules/react-dnd/dist/cjs/decorators/createSourceFactory.js
generated
vendored
Normal file
116
node_modules/react-dnd/dist/cjs/decorators/createSourceFactory.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createSourceFactory = createSourceFactory;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
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 ALLOWED_SPEC_METHODS = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];
|
||||
var REQUIRED_SPEC_METHODS = ['beginDrag'];
|
||||
|
||||
var SourceImpl = /*#__PURE__*/function () {
|
||||
function SourceImpl(spec, monitor, ref) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, SourceImpl);
|
||||
|
||||
_defineProperty(this, "props", null);
|
||||
|
||||
_defineProperty(this, "spec", void 0);
|
||||
|
||||
_defineProperty(this, "monitor", void 0);
|
||||
|
||||
_defineProperty(this, "ref", void 0);
|
||||
|
||||
_defineProperty(this, "beginDrag", function () {
|
||||
if (!_this.props) {
|
||||
return;
|
||||
}
|
||||
|
||||
var item = _this.spec.beginDrag(_this.props, _this.monitor, _this.ref.current);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _invariant.invariant)((0, _utils.isPlainObject)(item), 'beginDrag() must return a plain object that represents the dragged item. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', item);
|
||||
}
|
||||
|
||||
return item;
|
||||
});
|
||||
|
||||
this.spec = spec;
|
||||
this.monitor = monitor;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
_createClass(SourceImpl, [{
|
||||
key: "receiveProps",
|
||||
value: function receiveProps(props) {
|
||||
this.props = props;
|
||||
}
|
||||
}, {
|
||||
key: "canDrag",
|
||||
value: function canDrag() {
|
||||
if (!this.props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.spec.canDrag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.spec.canDrag(this.props, this.monitor);
|
||||
}
|
||||
}, {
|
||||
key: "isDragging",
|
||||
value: function isDragging(globalMonitor, sourceId) {
|
||||
if (!this.props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.spec.isDragging) {
|
||||
return sourceId === globalMonitor.getSourceId();
|
||||
}
|
||||
|
||||
return this.spec.isDragging(this.props, this.monitor);
|
||||
}
|
||||
}, {
|
||||
key: "endDrag",
|
||||
value: function endDrag() {
|
||||
if (!this.props) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.spec.endDrag) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.spec.endDrag(this.props, this.monitor, (0, _utils.getDecoratedComponent)(this.ref));
|
||||
}
|
||||
}]);
|
||||
|
||||
return SourceImpl;
|
||||
}();
|
||||
|
||||
function createSourceFactory(spec) {
|
||||
Object.keys(spec).forEach(function (key) {
|
||||
(0, _invariant.invariant)(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', ALLOWED_SPEC_METHODS.join(', '), key);
|
||||
(0, _invariant.invariant)(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);
|
||||
});
|
||||
REQUIRED_SPEC_METHODS.forEach(function (key) {
|
||||
(0, _invariant.invariant)(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);
|
||||
});
|
||||
return function createSource(monitor, ref) {
|
||||
return new SourceImpl(spec, monitor, ref);
|
||||
};
|
||||
}
|
||||
95
node_modules/react-dnd/dist/cjs/decorators/createTargetFactory.js
generated
vendored
Normal file
95
node_modules/react-dnd/dist/cjs/decorators/createTargetFactory.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createTargetFactory = createTargetFactory;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
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 ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];
|
||||
|
||||
var TargetImpl = /*#__PURE__*/function () {
|
||||
function TargetImpl(spec, monitor, ref) {
|
||||
_classCallCheck(this, TargetImpl);
|
||||
|
||||
_defineProperty(this, "props", null);
|
||||
|
||||
_defineProperty(this, "spec", void 0);
|
||||
|
||||
_defineProperty(this, "monitor", void 0);
|
||||
|
||||
_defineProperty(this, "ref", void 0);
|
||||
|
||||
this.spec = spec;
|
||||
this.monitor = monitor;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
_createClass(TargetImpl, [{
|
||||
key: "receiveProps",
|
||||
value: function receiveProps(props) {
|
||||
this.props = props;
|
||||
}
|
||||
}, {
|
||||
key: "receiveMonitor",
|
||||
value: function receiveMonitor(monitor) {
|
||||
this.monitor = monitor;
|
||||
}
|
||||
}, {
|
||||
key: "canDrop",
|
||||
value: function canDrop() {
|
||||
if (!this.spec.canDrop) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.spec.canDrop(this.props, this.monitor);
|
||||
}
|
||||
}, {
|
||||
key: "hover",
|
||||
value: function hover() {
|
||||
if (!this.spec.hover || !this.props) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.spec.hover(this.props, this.monitor, (0, _utils.getDecoratedComponent)(this.ref));
|
||||
}
|
||||
}, {
|
||||
key: "drop",
|
||||
value: function drop() {
|
||||
if (!this.spec.drop) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var dropResult = this.spec.drop(this.props, this.monitor, this.ref.current);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _invariant.invariant)(typeof dropResult === 'undefined' || (0, _utils.isPlainObject)(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', dropResult);
|
||||
}
|
||||
|
||||
return dropResult;
|
||||
}
|
||||
}]);
|
||||
|
||||
return TargetImpl;
|
||||
}();
|
||||
|
||||
function createTargetFactory(spec) {
|
||||
Object.keys(spec).forEach(function (key) {
|
||||
(0, _invariant.invariant)(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', ALLOWED_SPEC_METHODS.join(', '), key);
|
||||
(0, _invariant.invariant)(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', key, key, spec[key]);
|
||||
});
|
||||
return function createTarget(monitor, ref) {
|
||||
return new TargetImpl(spec, monitor, ref);
|
||||
};
|
||||
}
|
||||
274
node_modules/react-dnd/dist/cjs/decorators/decorateHandler.js
generated
vendored
Normal file
274
node_modules/react-dnd/dist/cjs/decorators/decorateHandler.js
generated
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.decorateHandler = decorateHandler;
|
||||
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _shallowequal = require("@react-dnd/shallowequal");
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _core = require("../core");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _disposables = require("./disposables");
|
||||
|
||||
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
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; }
|
||||
|
||||
function decorateHandler(_ref) {
|
||||
var DecoratedComponent = _ref.DecoratedComponent,
|
||||
createHandler = _ref.createHandler,
|
||||
createMonitor = _ref.createMonitor,
|
||||
createConnector = _ref.createConnector,
|
||||
registerHandler = _ref.registerHandler,
|
||||
containerDisplayName = _ref.containerDisplayName,
|
||||
getType = _ref.getType,
|
||||
collect = _ref.collect,
|
||||
options = _ref.options;
|
||||
var _options$arePropsEqua = options.arePropsEqual,
|
||||
arePropsEqual = _options$arePropsEqua === void 0 ? _shallowequal.shallowEqual : _options$arePropsEqua;
|
||||
var Decorated = DecoratedComponent;
|
||||
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
|
||||
|
||||
var DragDropContainer = /*#__PURE__*/function (_Component) {
|
||||
_inherits(DragDropContainer, _Component);
|
||||
|
||||
var _super = _createSuper(DragDropContainer);
|
||||
|
||||
function DragDropContainer(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, DragDropContainer);
|
||||
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "decoratedRef", (0, _react.createRef)());
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handlerId", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "manager", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handlerMonitor", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handlerConnector", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handler", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "disposable", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "currentType", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handleChange", function () {
|
||||
var nextState = _this.getCurrentState();
|
||||
|
||||
if (!(0, _shallowequal.shallowEqual)(nextState, _this.state)) {
|
||||
_this.setState(nextState);
|
||||
}
|
||||
});
|
||||
|
||||
_this.disposable = new _disposables.SerialDisposable();
|
||||
|
||||
_this.receiveProps(props);
|
||||
|
||||
_this.dispose();
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(DragDropContainer, [{
|
||||
key: "getHandlerId",
|
||||
value: function getHandlerId() {
|
||||
return this.handlerId;
|
||||
}
|
||||
}, {
|
||||
key: "getDecoratedComponentInstance",
|
||||
value: function getDecoratedComponentInstance() {
|
||||
(0, _invariant.invariant)(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
|
||||
return this.decoratedRef.current;
|
||||
}
|
||||
}, {
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps, nextState) {
|
||||
return !arePropsEqual(nextProps, this.props) || !(0, _shallowequal.shallowEqual)(nextState, this.state);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.disposable = new _disposables.SerialDisposable();
|
||||
this.currentType = undefined;
|
||||
this.receiveProps(this.props);
|
||||
this.handleChange();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
if (!arePropsEqual(this.props, prevProps)) {
|
||||
this.receiveProps(this.props);
|
||||
this.handleChange();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.dispose();
|
||||
}
|
||||
}, {
|
||||
key: "receiveProps",
|
||||
value: function receiveProps(props) {
|
||||
if (!this.handler) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.handler.receiveProps(props);
|
||||
this.receiveType(getType(props));
|
||||
}
|
||||
}, {
|
||||
key: "receiveType",
|
||||
value: function receiveType(type) {
|
||||
if (!this.handlerMonitor || !this.manager || !this.handlerConnector) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === this.currentType) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentType = type;
|
||||
|
||||
var _registerHandler = registerHandler(type, this.handler, this.manager),
|
||||
_registerHandler2 = _slicedToArray(_registerHandler, 2),
|
||||
handlerId = _registerHandler2[0],
|
||||
unregister = _registerHandler2[1];
|
||||
|
||||
this.handlerId = handlerId;
|
||||
this.handlerMonitor.receiveHandlerId(handlerId);
|
||||
this.handlerConnector.receiveHandlerId(handlerId);
|
||||
var globalMonitor = this.manager.getMonitor();
|
||||
var unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, {
|
||||
handlerIds: [handlerId]
|
||||
});
|
||||
this.disposable.setDisposable(new _disposables.CompositeDisposable(new _disposables.Disposable(unsubscribe), new _disposables.Disposable(unregister)));
|
||||
}
|
||||
}, {
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
this.disposable.dispose();
|
||||
|
||||
if (this.handlerConnector) {
|
||||
this.handlerConnector.receiveHandlerId(null);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "getCurrentState",
|
||||
value: function getCurrentState() {
|
||||
if (!this.handlerConnector) {
|
||||
return {};
|
||||
}
|
||||
|
||||
var nextState = collect(this.handlerConnector.hooks, this.handlerMonitor, this.props);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _invariant.invariant)((0, _utils.isPlainObject)(nextState), 'Expected `collect` specified as the second argument to ' + '%s for %s to return a plain object of props to inject. ' + 'Instead, received %s.', containerDisplayName, displayName, nextState);
|
||||
}
|
||||
|
||||
return nextState;
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return (0, _jsxRuntime.jsx)(_core.DndContext.Consumer, {
|
||||
children: function children(_ref2) {
|
||||
var dragDropManager = _ref2.dragDropManager;
|
||||
|
||||
_this2.receiveDragDropManager(dragDropManager);
|
||||
|
||||
if (typeof requestAnimationFrame !== 'undefined') {
|
||||
requestAnimationFrame(function () {
|
||||
var _this2$handlerConnect;
|
||||
|
||||
return (_this2$handlerConnect = _this2.handlerConnector) === null || _this2$handlerConnect === void 0 ? void 0 : _this2$handlerConnect.reconnect();
|
||||
});
|
||||
}
|
||||
|
||||
return (0, _jsxRuntime.jsx)(Decorated, Object.assign({}, _this2.props, _this2.getCurrentState(), {
|
||||
// NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.
|
||||
ref: (0, _utils.isRefable)(Decorated) ? _this2.decoratedRef : null
|
||||
}), void 0);
|
||||
}
|
||||
}, void 0);
|
||||
}
|
||||
}, {
|
||||
key: "receiveDragDropManager",
|
||||
value: function receiveDragDropManager(dragDropManager) {
|
||||
if (this.manager !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _invariant.invariant)(dragDropManager !== undefined, 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
|
||||
|
||||
if (dragDropManager === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.manager = dragDropManager;
|
||||
this.handlerMonitor = createMonitor(dragDropManager);
|
||||
this.handlerConnector = createConnector(dragDropManager.getBackend());
|
||||
this.handler = createHandler(this.handlerMonitor, this.decoratedRef);
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragDropContainer;
|
||||
}(_react.Component);
|
||||
|
||||
_defineProperty(DragDropContainer, "DecoratedComponent", DecoratedComponent);
|
||||
|
||||
_defineProperty(DragDropContainer, "displayName", "".concat(containerDisplayName, "(").concat(displayName, ")"));
|
||||
|
||||
return (0, _hoistNonReactStatics.default)(DragDropContainer, DecoratedComponent);
|
||||
}
|
||||
260
node_modules/react-dnd/dist/cjs/decorators/disposables.js
generated
vendored
Normal file
260
node_modules/react-dnd/dist/cjs/decorators/disposables.js
generated
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SerialDisposable = exports.CompositeDisposable = exports.Disposable = void 0;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Provides a set of static methods for creating Disposables.
|
||||
* @param {Function} action Action to run during the first call to dispose.
|
||||
* The action is guaranteed to be run at most once.
|
||||
*/
|
||||
var Disposable = /*#__PURE__*/function () {
|
||||
function Disposable(action) {
|
||||
_classCallCheck(this, Disposable);
|
||||
|
||||
_defineProperty(this, "isDisposed", false);
|
||||
|
||||
_defineProperty(this, "action", void 0);
|
||||
|
||||
this.action = (0, _utils.isFunction)(action) ? action : _utils.noop;
|
||||
}
|
||||
/** Performs the task of cleaning up resources. */
|
||||
|
||||
|
||||
_createClass(Disposable, [{
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
if (!this.isDisposed) {
|
||||
this.action();
|
||||
this.isDisposed = true;
|
||||
}
|
||||
}
|
||||
}], [{
|
||||
key: "isDisposable",
|
||||
value:
|
||||
/**
|
||||
* Gets the disposable that does nothing when disposed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Validates whether the given object is a disposable
|
||||
* @param {Object} Object to test whether it has a dispose method
|
||||
* @returns {Boolean} true if a disposable object, else false.
|
||||
*/
|
||||
function isDisposable(d) {
|
||||
return Boolean(d && (0, _utils.isFunction)(d.dispose));
|
||||
}
|
||||
}, {
|
||||
key: "_fixup",
|
||||
value: function _fixup(result) {
|
||||
return Disposable.isDisposable(result) ? result : Disposable.empty;
|
||||
}
|
||||
/**
|
||||
* Creates a disposable object that invokes the specified action when disposed.
|
||||
* @param {Function} dispose Action to run during the first call to dispose.
|
||||
* The action is guaranteed to be run at most once.
|
||||
* @return {Disposable} The disposable object that runs the given action upon disposal.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "create",
|
||||
value: function create(action) {
|
||||
return new Disposable(action);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Disposable;
|
||||
}();
|
||||
/**
|
||||
* Represents a group of disposable resources that are disposed together.
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
|
||||
exports.Disposable = Disposable;
|
||||
|
||||
_defineProperty(Disposable, "empty", {
|
||||
dispose: _utils.noop
|
||||
});
|
||||
|
||||
var CompositeDisposable = /*#__PURE__*/function () {
|
||||
function CompositeDisposable() {
|
||||
_classCallCheck(this, CompositeDisposable);
|
||||
|
||||
_defineProperty(this, "isDisposed", false);
|
||||
|
||||
_defineProperty(this, "disposables", void 0);
|
||||
|
||||
for (var _len = arguments.length, disposables = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
disposables[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
this.disposables = disposables;
|
||||
}
|
||||
/**
|
||||
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
|
||||
* @param {Any} item Disposable to add.
|
||||
*/
|
||||
|
||||
|
||||
_createClass(CompositeDisposable, [{
|
||||
key: "add",
|
||||
value: function add(item) {
|
||||
if (this.isDisposed) {
|
||||
item.dispose();
|
||||
} else {
|
||||
this.disposables.push(item);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
|
||||
* @param {Any} item Disposable to remove.
|
||||
* @returns {Boolean} true if found; false otherwise.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "remove",
|
||||
value: function remove(item) {
|
||||
var shouldDispose = false;
|
||||
|
||||
if (!this.isDisposed) {
|
||||
var idx = this.disposables.indexOf(item);
|
||||
|
||||
if (idx !== -1) {
|
||||
shouldDispose = true;
|
||||
this.disposables.splice(idx, 1);
|
||||
item.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return shouldDispose;
|
||||
}
|
||||
/**
|
||||
* Disposes all disposables in the group and removes them from the group but
|
||||
* does not dispose the CompositeDisposable.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "clear",
|
||||
value: function clear() {
|
||||
if (!this.isDisposed) {
|
||||
var len = this.disposables.length;
|
||||
var currentDisposables = new Array(len);
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
currentDisposables[i] = this.disposables[i];
|
||||
}
|
||||
|
||||
this.disposables = [];
|
||||
|
||||
for (var _i = 0; _i < len; _i++) {
|
||||
currentDisposables[_i].dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Disposes all disposables in the group and removes them from the group.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
if (!this.isDisposed) {
|
||||
this.isDisposed = true;
|
||||
var len = this.disposables.length;
|
||||
var currentDisposables = new Array(len);
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
currentDisposables[i] = this.disposables[i];
|
||||
}
|
||||
|
||||
this.disposables = [];
|
||||
|
||||
for (var _i2 = 0; _i2 < len; _i2++) {
|
||||
currentDisposables[_i2].dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return CompositeDisposable;
|
||||
}();
|
||||
/**
|
||||
* Represents a disposable resource whose underlying disposable resource can
|
||||
* be replaced by another disposable resource, causing automatic disposal of
|
||||
* the previous underlying disposable resource.
|
||||
*/
|
||||
|
||||
|
||||
exports.CompositeDisposable = CompositeDisposable;
|
||||
|
||||
var SerialDisposable = /*#__PURE__*/function () {
|
||||
function SerialDisposable() {
|
||||
_classCallCheck(this, SerialDisposable);
|
||||
|
||||
_defineProperty(this, "isDisposed", false);
|
||||
|
||||
_defineProperty(this, "current", void 0);
|
||||
}
|
||||
|
||||
_createClass(SerialDisposable, [{
|
||||
key: "getDisposable",
|
||||
value:
|
||||
/**
|
||||
* Gets the underlying disposable.
|
||||
* @returns {Any} the underlying disposable.
|
||||
*/
|
||||
function getDisposable() {
|
||||
return this.current;
|
||||
}
|
||||
}, {
|
||||
key: "setDisposable",
|
||||
value: function setDisposable(value) {
|
||||
var shouldDispose = this.isDisposed;
|
||||
|
||||
if (!shouldDispose) {
|
||||
var old = this.current;
|
||||
this.current = value;
|
||||
|
||||
if (old) {
|
||||
old.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldDispose && value) {
|
||||
value.dispose();
|
||||
}
|
||||
}
|
||||
/** Performs the task of cleaning up resources. */
|
||||
|
||||
}, {
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
if (!this.isDisposed) {
|
||||
this.isDisposed = true;
|
||||
var old = this.current;
|
||||
this.current = undefined;
|
||||
|
||||
if (old) {
|
||||
old.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return SerialDisposable;
|
||||
}();
|
||||
|
||||
exports.SerialDisposable = SerialDisposable;
|
||||
57
node_modules/react-dnd/dist/cjs/decorators/index.js
generated
vendored
Normal file
57
node_modules/react-dnd/dist/cjs/decorators/index.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _DragSource = require("./DragSource");
|
||||
|
||||
Object.keys(_DragSource).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DragSource[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DragSource[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _DropTarget = require("./DropTarget");
|
||||
|
||||
Object.keys(_DropTarget).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DropTarget[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DropTarget[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _DragLayer = require("./DragLayer");
|
||||
|
||||
Object.keys(_DragLayer).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DragLayer[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DragLayer[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _types[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _types[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
5
node_modules/react-dnd/dist/cjs/decorators/types.js
generated
vendored
Normal file
5
node_modules/react-dnd/dist/cjs/decorators/types.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
93
node_modules/react-dnd/dist/cjs/decorators/utils.js
generated
vendored
Normal file
93
node_modules/react-dnd/dist/cjs/decorators/utils.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getDecoratedComponent = getDecoratedComponent;
|
||||
exports.isClassComponent = isClassComponent;
|
||||
exports.isRefForwardingComponent = isRefForwardingComponent;
|
||||
exports.isRefable = isRefable;
|
||||
exports.checkDecoratorArguments = checkDecoratorArguments;
|
||||
exports.isFunction = isFunction;
|
||||
exports.noop = noop;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isValidType = isValidType;
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function getDecoratedComponent(instanceRef) {
|
||||
var currentRef = instanceRef.current;
|
||||
|
||||
if (currentRef == null) {
|
||||
return null;
|
||||
} else if (currentRef.decoratedRef) {
|
||||
// go through the private field in decorateHandler to avoid the invariant hit
|
||||
return currentRef.decoratedRef.current;
|
||||
} else {
|
||||
return currentRef;
|
||||
}
|
||||
}
|
||||
|
||||
function isClassComponent(Component) {
|
||||
return Component && Component.prototype && typeof Component.prototype.render === 'function';
|
||||
}
|
||||
|
||||
function isRefForwardingComponent(C) {
|
||||
var _item$$$typeof;
|
||||
|
||||
var item = C;
|
||||
return (item === null || item === void 0 ? void 0 : (_item$$$typeof = item.$$typeof) === null || _item$$$typeof === void 0 ? void 0 : _item$$$typeof.toString()) === 'Symbol(react.forward_ref)';
|
||||
}
|
||||
|
||||
function isRefable(C) {
|
||||
return isClassComponent(C) || isRefForwardingComponent(C);
|
||||
}
|
||||
|
||||
function checkDecoratorArguments(functionName, signature) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) {
|
||||
var arg = i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2];
|
||||
|
||||
if (arg && arg.prototype && arg.prototype.render) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('You seem to be applying the arguments in the wrong order. ' + "It should be ".concat(functionName, "(").concat(signature, ")(Component), not the other way around. ") + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#you-seem-to-be-applying-the-arguments-in-the-wrong-order');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isFunction(input) {
|
||||
return typeof input === 'function';
|
||||
}
|
||||
|
||||
function noop() {// noop
|
||||
}
|
||||
|
||||
function isObjectLike(input) {
|
||||
return _typeof(input) === 'object' && input !== null;
|
||||
}
|
||||
|
||||
function isPlainObject(input) {
|
||||
if (!isObjectLike(input)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Object.getPrototypeOf(input) === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var proto = input;
|
||||
|
||||
while (Object.getPrototypeOf(proto) !== null) {
|
||||
proto = Object.getPrototypeOf(proto);
|
||||
}
|
||||
|
||||
return Object.getPrototypeOf(input) === proto;
|
||||
}
|
||||
|
||||
function isValidType(type, allowArray) {
|
||||
return typeof type === 'string' || _typeof(type) === 'symbol' || !!allowArray && Array.isArray(type) && type.every(function (t) {
|
||||
return isValidType(t, false);
|
||||
});
|
||||
}
|
||||
70
node_modules/react-dnd/dist/cjs/hooks/index.js
generated
vendored
Normal file
70
node_modules/react-dnd/dist/cjs/hooks/index.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _useDrag = require("./useDrag");
|
||||
|
||||
Object.keys(_useDrag).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _useDrag[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _useDrag[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _useDrop = require("./useDrop");
|
||||
|
||||
Object.keys(_useDrop).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _useDrop[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _useDrop[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _useDragLayer = require("./useDragLayer");
|
||||
|
||||
Object.keys(_useDragLayer).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _useDragLayer[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _useDragLayer[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _useDragDropManager = require("./useDragDropManager");
|
||||
|
||||
Object.keys(_useDragDropManager).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _useDragDropManager[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _useDragDropManager[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _types[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _types[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
5
node_modules/react-dnd/dist/cjs/hooks/types.js
generated
vendored
Normal file
5
node_modules/react-dnd/dist/cjs/hooks/types.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
16
node_modules/react-dnd/dist/cjs/hooks/useCollectedProps.js
generated
vendored
Normal file
16
node_modules/react-dnd/dist/cjs/hooks/useCollectedProps.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useCollectedProps = useCollectedProps;
|
||||
|
||||
var _useMonitorOutput = require("./useMonitorOutput");
|
||||
|
||||
function useCollectedProps(collector, monitor, connector) {
|
||||
return (0, _useMonitorOutput.useMonitorOutput)(monitor, collector || function () {
|
||||
return {};
|
||||
}, function () {
|
||||
return connector.reconnect();
|
||||
});
|
||||
}
|
||||
59
node_modules/react-dnd/dist/cjs/hooks/useCollector.js
generated
vendored
Normal file
59
node_modules/react-dnd/dist/cjs/hooks/useCollector.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useCollector = useCollector;
|
||||
|
||||
var _fastDeepEqual = _interopRequireDefault(require("fast-deep-equal"));
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param monitor The monitor to collect state from
|
||||
* @param collect The collecting function
|
||||
* @param onUpdate A method to invoke when updates occur
|
||||
*/
|
||||
function useCollector(monitor, collect, onUpdate) {
|
||||
var _useState = (0, _react.useState)(function () {
|
||||
return collect(monitor);
|
||||
}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
collected = _useState2[0],
|
||||
setCollected = _useState2[1];
|
||||
|
||||
var updateCollected = (0, _react.useCallback)(function () {
|
||||
var nextValue = collect(monitor); // This needs to be a deep-equality check because some monitor-collected values
|
||||
// include XYCoord objects that may be equivalent, but do not have instance equality.
|
||||
|
||||
if (!(0, _fastDeepEqual.default)(collected, nextValue)) {
|
||||
setCollected(nextValue);
|
||||
|
||||
if (onUpdate) {
|
||||
onUpdate();
|
||||
}
|
||||
}
|
||||
}, [collected, monitor, onUpdate]); // update the collected properties after react renders.
|
||||
// Note that the "Dustbin Stress Test" fails if this is not
|
||||
// done when the component updates
|
||||
|
||||
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(updateCollected);
|
||||
return [collected, updateCollected];
|
||||
}
|
||||
93
node_modules/react-dnd/dist/cjs/hooks/useDrag/DragSourceImpl.js
generated
vendored
Normal file
93
node_modules/react-dnd/dist/cjs/hooks/useDrag/DragSourceImpl.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DragSourceImpl = void 0;
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
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 DragSourceImpl = /*#__PURE__*/function () {
|
||||
function DragSourceImpl(spec, monitor, connector) {
|
||||
_classCallCheck(this, DragSourceImpl);
|
||||
|
||||
_defineProperty(this, "spec", void 0);
|
||||
|
||||
_defineProperty(this, "monitor", void 0);
|
||||
|
||||
_defineProperty(this, "connector", void 0);
|
||||
|
||||
this.spec = spec;
|
||||
this.monitor = monitor;
|
||||
this.connector = connector;
|
||||
}
|
||||
|
||||
_createClass(DragSourceImpl, [{
|
||||
key: "beginDrag",
|
||||
value: function beginDrag() {
|
||||
var _result;
|
||||
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
var result = null;
|
||||
|
||||
if (_typeof(spec.item) === 'object') {
|
||||
result = spec.item;
|
||||
} else if (typeof spec.item === 'function') {
|
||||
result = spec.item(monitor);
|
||||
} else {
|
||||
result = {};
|
||||
}
|
||||
|
||||
return (_result = result) !== null && _result !== void 0 ? _result : null;
|
||||
}
|
||||
}, {
|
||||
key: "canDrag",
|
||||
value: function canDrag() {
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
|
||||
if (typeof spec.canDrag === 'boolean') {
|
||||
return spec.canDrag;
|
||||
} else if (typeof spec.canDrag === 'function') {
|
||||
return spec.canDrag(monitor);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isDragging",
|
||||
value: function isDragging(globalMonitor, target) {
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
var isDragging = spec.isDragging;
|
||||
return isDragging ? isDragging(monitor) : target === globalMonitor.getSourceId();
|
||||
}
|
||||
}, {
|
||||
key: "endDrag",
|
||||
value: function endDrag() {
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
var connector = this.connector;
|
||||
var end = spec.end;
|
||||
|
||||
if (end) {
|
||||
end(monitor.getItem(), monitor);
|
||||
}
|
||||
|
||||
connector.reconnect();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragSourceImpl;
|
||||
}();
|
||||
|
||||
exports.DragSourceImpl = DragSourceImpl;
|
||||
21
node_modules/react-dnd/dist/cjs/hooks/useDrag/connectors.js
generated
vendored
Normal file
21
node_modules/react-dnd/dist/cjs/hooks/useDrag/connectors.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useConnectDragSource = useConnectDragSource;
|
||||
exports.useConnectDragPreview = useConnectDragPreview;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
function useConnectDragSource(connector) {
|
||||
return (0, _react.useMemo)(function () {
|
||||
return connector.hooks.dragSource();
|
||||
}, [connector]);
|
||||
}
|
||||
|
||||
function useConnectDragPreview(connector) {
|
||||
return (0, _react.useMemo)(function () {
|
||||
return connector.hooks.dragPreview();
|
||||
}, [connector]);
|
||||
}
|
||||
18
node_modules/react-dnd/dist/cjs/hooks/useDrag/index.js
generated
vendored
Normal file
18
node_modules/react-dnd/dist/cjs/hooks/useDrag/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _useDrag = require("./useDrag");
|
||||
|
||||
Object.keys(_useDrag).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _useDrag[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _useDrag[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
34
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDrag.js
generated
vendored
Normal file
34
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDrag.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDrag = useDrag;
|
||||
|
||||
var _useRegisteredDragSource = require("./useRegisteredDragSource");
|
||||
|
||||
var _useOptionalFactory = require("../useOptionalFactory");
|
||||
|
||||
var _useDragSourceMonitor = require("./useDragSourceMonitor");
|
||||
|
||||
var _useDragSourceConnector = require("./useDragSourceConnector");
|
||||
|
||||
var _useCollectedProps = require("../useCollectedProps");
|
||||
|
||||
var _connectors = require("./connectors");
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
/**
|
||||
* useDragSource hook
|
||||
* @param sourceSpec The drag source specification (object or function, function preferred)
|
||||
* @param deps The memoization deps array to use when evaluating spec changes
|
||||
*/
|
||||
function useDrag(specArg, deps) {
|
||||
var spec = (0, _useOptionalFactory.useOptionalFactory)(specArg, deps);
|
||||
(0, _invariant.invariant)(!spec.begin, "useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");
|
||||
var monitor = (0, _useDragSourceMonitor.useDragSourceMonitor)();
|
||||
var connector = (0, _useDragSourceConnector.useDragSourceConnector)(spec.options, spec.previewOptions);
|
||||
(0, _useRegisteredDragSource.useRegisteredDragSource)(spec, monitor, connector);
|
||||
return [(0, _useCollectedProps.useCollectedProps)(spec.collect, monitor, connector), (0, _connectors.useConnectDragSource)(connector), (0, _connectors.useConnectDragPreview)(connector)];
|
||||
}
|
||||
20
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragSource.js
generated
vendored
Normal file
20
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragSource.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDragSource = useDragSource;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _DragSourceImpl = require("./DragSourceImpl");
|
||||
|
||||
function useDragSource(spec, monitor, connector) {
|
||||
var handler = (0, _react.useMemo)(function () {
|
||||
return new _DragSourceImpl.DragSourceImpl(spec, monitor, connector);
|
||||
}, [monitor, connector]);
|
||||
(0, _react.useEffect)(function () {
|
||||
handler.spec = spec;
|
||||
}, [spec]);
|
||||
return handler;
|
||||
}
|
||||
36
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragSourceConnector.js
generated
vendored
Normal file
36
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragSourceConnector.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDragSourceConnector = useDragSourceConnector;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _internals = require("../../internals");
|
||||
|
||||
var _useDragDropManager = require("../useDragDropManager");
|
||||
|
||||
var _useIsomorphicLayoutEffect = require("../useIsomorphicLayoutEffect");
|
||||
|
||||
function useDragSourceConnector(dragSourceOptions, dragPreviewOptions) {
|
||||
var manager = (0, _useDragDropManager.useDragDropManager)();
|
||||
var connector = (0, _react.useMemo)(function () {
|
||||
return new _internals.SourceConnector(manager.getBackend());
|
||||
}, [manager]);
|
||||
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(function () {
|
||||
connector.dragSourceOptions = dragSourceOptions || null;
|
||||
connector.reconnect();
|
||||
return function () {
|
||||
return connector.disconnectDragSource();
|
||||
};
|
||||
}, [connector, dragSourceOptions]);
|
||||
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(function () {
|
||||
connector.dragPreviewOptions = dragPreviewOptions || null;
|
||||
connector.reconnect();
|
||||
return function () {
|
||||
return connector.disconnectDragPreview();
|
||||
};
|
||||
}, [connector, dragPreviewOptions]);
|
||||
return connector;
|
||||
}
|
||||
19
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragSourceMonitor.js
generated
vendored
Normal file
19
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragSourceMonitor.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDragSourceMonitor = useDragSourceMonitor;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _internals = require("../../internals");
|
||||
|
||||
var _useDragDropManager = require("../useDragDropManager");
|
||||
|
||||
function useDragSourceMonitor() {
|
||||
var manager = (0, _useDragDropManager.useDragDropManager)();
|
||||
return (0, _react.useMemo)(function () {
|
||||
return new _internals.DragSourceMonitorImpl(manager);
|
||||
}, [manager]);
|
||||
}
|
||||
18
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragType.js
generated
vendored
Normal file
18
node_modules/react-dnd/dist/cjs/hooks/useDrag/useDragType.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDragType = useDragType;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
function useDragType(spec) {
|
||||
return (0, _react.useMemo)(function () {
|
||||
var result = spec.type;
|
||||
(0, _invariant.invariant)(result != null, 'spec.type must be defined');
|
||||
return result;
|
||||
}, [spec]);
|
||||
}
|
||||
46
node_modules/react-dnd/dist/cjs/hooks/useDrag/useRegisteredDragSource.js
generated
vendored
Normal file
46
node_modules/react-dnd/dist/cjs/hooks/useDrag/useRegisteredDragSource.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useRegisteredDragSource = useRegisteredDragSource;
|
||||
|
||||
var _internals = require("../../internals");
|
||||
|
||||
var _useIsomorphicLayoutEffect = require("../useIsomorphicLayoutEffect");
|
||||
|
||||
var _useDragSource = require("./useDragSource");
|
||||
|
||||
var _useDragDropManager = require("../useDragDropManager");
|
||||
|
||||
var _useDragType = require("./useDragType");
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function useRegisteredDragSource(spec, monitor, connector) {
|
||||
var manager = (0, _useDragDropManager.useDragDropManager)();
|
||||
var handler = (0, _useDragSource.useDragSource)(spec, monitor, connector);
|
||||
var itemType = (0, _useDragType.useDragType)(spec);
|
||||
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(function registerDragSource() {
|
||||
if (itemType != null) {
|
||||
var _registerSource = (0, _internals.registerSource)(itemType, handler, manager),
|
||||
_registerSource2 = _slicedToArray(_registerSource, 2),
|
||||
handlerId = _registerSource2[0],
|
||||
unregister = _registerSource2[1];
|
||||
|
||||
monitor.receiveHandlerId(handlerId);
|
||||
connector.receiveHandlerId(handlerId);
|
||||
return unregister;
|
||||
}
|
||||
}, [manager, monitor, connector, handler, itemType]);
|
||||
}
|
||||
23
node_modules/react-dnd/dist/cjs/hooks/useDragDropManager.js
generated
vendored
Normal file
23
node_modules/react-dnd/dist/cjs/hooks/useDragDropManager.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDragDropManager = useDragDropManager;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _core = require("../core");
|
||||
|
||||
/**
|
||||
* A hook to retrieve the DragDropManager from Context
|
||||
*/
|
||||
function useDragDropManager() {
|
||||
var _useContext = (0, _react.useContext)(_core.DndContext),
|
||||
dragDropManager = _useContext.dragDropManager;
|
||||
|
||||
(0, _invariant.invariant)(dragDropManager != null, 'Expected drag drop context');
|
||||
return dragDropManager;
|
||||
}
|
||||
46
node_modules/react-dnd/dist/cjs/hooks/useDragLayer.js
generated
vendored
Normal file
46
node_modules/react-dnd/dist/cjs/hooks/useDragLayer.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDragLayer = useDragLayer;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _useDragDropManager = require("./useDragDropManager");
|
||||
|
||||
var _useCollector3 = require("./useCollector");
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
/**
|
||||
* useDragLayer Hook
|
||||
* @param collector The property collector
|
||||
*/
|
||||
function useDragLayer(collect) {
|
||||
var dragDropManager = (0, _useDragDropManager.useDragDropManager)();
|
||||
var monitor = dragDropManager.getMonitor();
|
||||
|
||||
var _useCollector = (0, _useCollector3.useCollector)(monitor, collect),
|
||||
_useCollector2 = _slicedToArray(_useCollector, 2),
|
||||
collected = _useCollector2[0],
|
||||
updateCollected = _useCollector2[1];
|
||||
|
||||
(0, _react.useEffect)(function () {
|
||||
return monitor.subscribeToOffsetChange(updateCollected);
|
||||
});
|
||||
(0, _react.useEffect)(function () {
|
||||
return monitor.subscribeToStateChange(updateCollected);
|
||||
});
|
||||
return collected;
|
||||
}
|
||||
60
node_modules/react-dnd/dist/cjs/hooks/useDrop/DropTargetImpl.js
generated
vendored
Normal file
60
node_modules/react-dnd/dist/cjs/hooks/useDrop/DropTargetImpl.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"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;
|
||||
14
node_modules/react-dnd/dist/cjs/hooks/useDrop/connectors.js
generated
vendored
Normal file
14
node_modules/react-dnd/dist/cjs/hooks/useDrop/connectors.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useConnectDropTarget = useConnectDropTarget;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
function useConnectDropTarget(connector) {
|
||||
return (0, _react.useMemo)(function () {
|
||||
return connector.hooks.dropTarget();
|
||||
}, [connector]);
|
||||
}
|
||||
18
node_modules/react-dnd/dist/cjs/hooks/useDrop/index.js
generated
vendored
Normal file
18
node_modules/react-dnd/dist/cjs/hooks/useDrop/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _useDrop = require("./useDrop");
|
||||
|
||||
Object.keys(_useDrop).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _useDrop[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _useDrop[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
23
node_modules/react-dnd/dist/cjs/hooks/useDrop/useAccept.js
generated
vendored
Normal file
23
node_modules/react-dnd/dist/cjs/hooks/useDrop/useAccept.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useAccept = useAccept;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
/**
|
||||
* Internal utility hook to get an array-version of spec.accept.
|
||||
* The main utility here is that we aren't creating a new array on every render if a non-array spec.accept is passed in.
|
||||
* @param spec
|
||||
*/
|
||||
function useAccept(spec) {
|
||||
var accept = spec.accept;
|
||||
return (0, _react.useMemo)(function () {
|
||||
(0, _invariant.invariant)(spec.accept != null, 'accept must be defined');
|
||||
return Array.isArray(accept) ? accept : [accept];
|
||||
}, [accept]);
|
||||
}
|
||||
31
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDrop.js
generated
vendored
Normal file
31
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDrop.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDrop = useDrop;
|
||||
|
||||
var _useRegisteredDropTarget = require("./useRegisteredDropTarget");
|
||||
|
||||
var _useOptionalFactory = require("../useOptionalFactory");
|
||||
|
||||
var _useDropTargetMonitor = require("./useDropTargetMonitor");
|
||||
|
||||
var _useDropTargetConnector = require("./useDropTargetConnector");
|
||||
|
||||
var _useCollectedProps = require("../useCollectedProps");
|
||||
|
||||
var _connectors = require("./connectors");
|
||||
|
||||
/**
|
||||
* useDropTarget Hook
|
||||
* @param spec The drop target specification (object or function, function preferred)
|
||||
* @param deps The memoization deps array to use when evaluating spec changes
|
||||
*/
|
||||
function useDrop(specArg, deps) {
|
||||
var spec = (0, _useOptionalFactory.useOptionalFactory)(specArg, deps);
|
||||
var monitor = (0, _useDropTargetMonitor.useDropTargetMonitor)();
|
||||
var connector = (0, _useDropTargetConnector.useDropTargetConnector)(spec.options);
|
||||
(0, _useRegisteredDropTarget.useRegisteredDropTarget)(spec, monitor, connector);
|
||||
return [(0, _useCollectedProps.useCollectedProps)(spec.collect, monitor, connector), (0, _connectors.useConnectDropTarget)(connector)];
|
||||
}
|
||||
20
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDropTarget.js
generated
vendored
Normal file
20
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDropTarget.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDropTarget = useDropTarget;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _DropTargetImpl = require("./DropTargetImpl");
|
||||
|
||||
function useDropTarget(spec, monitor) {
|
||||
var dropTarget = (0, _react.useMemo)(function () {
|
||||
return new _DropTargetImpl.DropTargetImpl(spec, monitor);
|
||||
}, [monitor]);
|
||||
(0, _react.useEffect)(function () {
|
||||
dropTarget.spec = spec;
|
||||
}, [spec]);
|
||||
return dropTarget;
|
||||
}
|
||||
29
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDropTargetConnector.js
generated
vendored
Normal file
29
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDropTargetConnector.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDropTargetConnector = useDropTargetConnector;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _internals = require("../../internals");
|
||||
|
||||
var _useDragDropManager = require("../useDragDropManager");
|
||||
|
||||
var _useIsomorphicLayoutEffect = require("../useIsomorphicLayoutEffect");
|
||||
|
||||
function useDropTargetConnector(options) {
|
||||
var manager = (0, _useDragDropManager.useDragDropManager)();
|
||||
var connector = (0, _react.useMemo)(function () {
|
||||
return new _internals.TargetConnector(manager.getBackend());
|
||||
}, [manager]);
|
||||
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(function () {
|
||||
connector.dropTargetOptions = options || null;
|
||||
connector.reconnect();
|
||||
return function () {
|
||||
return connector.disconnectDropTarget();
|
||||
};
|
||||
}, [options]);
|
||||
return connector;
|
||||
}
|
||||
19
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDropTargetMonitor.js
generated
vendored
Normal file
19
node_modules/react-dnd/dist/cjs/hooks/useDrop/useDropTargetMonitor.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDropTargetMonitor = useDropTargetMonitor;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _internals = require("../../internals");
|
||||
|
||||
var _useDragDropManager = require("../useDragDropManager");
|
||||
|
||||
function useDropTargetMonitor() {
|
||||
var manager = (0, _useDragDropManager.useDragDropManager)();
|
||||
return (0, _react.useMemo)(function () {
|
||||
return new _internals.DropTargetMonitorImpl(manager);
|
||||
}, [manager]);
|
||||
}
|
||||
46
node_modules/react-dnd/dist/cjs/hooks/useDrop/useRegisteredDropTarget.js
generated
vendored
Normal file
46
node_modules/react-dnd/dist/cjs/hooks/useDrop/useRegisteredDropTarget.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useRegisteredDropTarget = useRegisteredDropTarget;
|
||||
|
||||
var _internals = require("../../internals");
|
||||
|
||||
var _useDragDropManager = require("../useDragDropManager");
|
||||
|
||||
var _useIsomorphicLayoutEffect = require("../useIsomorphicLayoutEffect");
|
||||
|
||||
var _useAccept = require("./useAccept");
|
||||
|
||||
var _useDropTarget = require("./useDropTarget");
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function useRegisteredDropTarget(spec, monitor, connector) {
|
||||
var manager = (0, _useDragDropManager.useDragDropManager)();
|
||||
var dropTarget = (0, _useDropTarget.useDropTarget)(spec, monitor);
|
||||
var accept = (0, _useAccept.useAccept)(spec);
|
||||
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(function registerDropTarget() {
|
||||
var _registerTarget = (0, _internals.registerTarget)(accept, dropTarget, manager),
|
||||
_registerTarget2 = _slicedToArray(_registerTarget, 2),
|
||||
handlerId = _registerTarget2[0],
|
||||
unregister = _registerTarget2[1];
|
||||
|
||||
monitor.receiveHandlerId(handlerId);
|
||||
connector.receiveHandlerId(handlerId);
|
||||
return unregister;
|
||||
}, [manager, monitor, dropTarget, connector, accept.map(function (a) {
|
||||
return a.toString();
|
||||
}).join('|')]);
|
||||
}
|
||||
12
node_modules/react-dnd/dist/cjs/hooks/useIsomorphicLayoutEffect.js
generated
vendored
Normal file
12
node_modules/react-dnd/dist/cjs/hooks/useIsomorphicLayoutEffect.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useIsomorphicLayoutEffect = void 0;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
// suppress the useLayoutEffect warning on server side.
|
||||
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
|
||||
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
||||
42
node_modules/react-dnd/dist/cjs/hooks/useMonitorOutput.js
generated
vendored
Normal file
42
node_modules/react-dnd/dist/cjs/hooks/useMonitorOutput.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useMonitorOutput = useMonitorOutput;
|
||||
|
||||
var _useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect");
|
||||
|
||||
var _useCollector3 = require("./useCollector");
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function useMonitorOutput(monitor, collect, onCollect) {
|
||||
var _useCollector = (0, _useCollector3.useCollector)(monitor, collect, onCollect),
|
||||
_useCollector2 = _slicedToArray(_useCollector, 2),
|
||||
collected = _useCollector2[0],
|
||||
updateCollected = _useCollector2[1];
|
||||
|
||||
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(function subscribeToMonitorStateChange() {
|
||||
var handlerId = monitor.getHandlerId();
|
||||
|
||||
if (handlerId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
return monitor.subscribeToStateChange(updateCollected, {
|
||||
handlerIds: [handlerId]
|
||||
});
|
||||
}, [monitor, updateCollected]);
|
||||
return collected;
|
||||
}
|
||||
32
node_modules/react-dnd/dist/cjs/hooks/useOptionalFactory.js
generated
vendored
Normal file
32
node_modules/react-dnd/dist/cjs/hooks/useOptionalFactory.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useOptionalFactory = useOptionalFactory;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function useOptionalFactory(arg, deps) {
|
||||
var memoDeps = _toConsumableArray(deps || []);
|
||||
|
||||
if (deps == null && typeof arg !== 'function') {
|
||||
memoDeps.push(arg);
|
||||
}
|
||||
|
||||
return (0, _react.useMemo)(function () {
|
||||
return typeof arg === 'function' ? arg() : arg;
|
||||
}, memoDeps);
|
||||
}
|
||||
57
node_modules/react-dnd/dist/cjs/index.js
generated
vendored
Normal file
57
node_modules/react-dnd/dist/cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _types[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _types[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _core = require("./core");
|
||||
|
||||
Object.keys(_core).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _core[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _core[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _decorators = require("./decorators");
|
||||
|
||||
Object.keys(_decorators).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _decorators[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _decorators[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _hooks = require("./hooks");
|
||||
|
||||
Object.keys(_hooks).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _hooks[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _hooks[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
165
node_modules/react-dnd/dist/cjs/internals/DragSourceMonitorImpl.js
generated
vendored
Normal file
165
node_modules/react-dnd/dist/cjs/internals/DragSourceMonitorImpl.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DragSourceMonitorImpl = void 0;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
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 isCallingCanDrag = false;
|
||||
var isCallingIsDragging = false;
|
||||
|
||||
var DragSourceMonitorImpl = /*#__PURE__*/function () {
|
||||
function DragSourceMonitorImpl(manager) {
|
||||
_classCallCheck(this, DragSourceMonitorImpl);
|
||||
|
||||
_defineProperty(this, "internalMonitor", void 0);
|
||||
|
||||
_defineProperty(this, "sourceId", null);
|
||||
|
||||
this.internalMonitor = manager.getMonitor();
|
||||
}
|
||||
|
||||
_createClass(DragSourceMonitorImpl, [{
|
||||
key: "receiveHandlerId",
|
||||
value: function receiveHandlerId(sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
}, {
|
||||
key: "getHandlerId",
|
||||
value: function getHandlerId() {
|
||||
return this.sourceId;
|
||||
}
|
||||
}, {
|
||||
key: "canDrag",
|
||||
value: function canDrag() {
|
||||
(0, _invariant.invariant)(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
||||
|
||||
try {
|
||||
isCallingCanDrag = true;
|
||||
return this.internalMonitor.canDragSource(this.sourceId);
|
||||
} finally {
|
||||
isCallingCanDrag = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isDragging",
|
||||
value: function isDragging() {
|
||||
if (!this.sourceId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
(0, _invariant.invariant)(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
||||
|
||||
try {
|
||||
isCallingIsDragging = true;
|
||||
return this.internalMonitor.isDraggingSource(this.sourceId);
|
||||
} finally {
|
||||
isCallingIsDragging = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "subscribeToStateChange",
|
||||
value: function subscribeToStateChange(listener, options) {
|
||||
return this.internalMonitor.subscribeToStateChange(listener, options);
|
||||
}
|
||||
}, {
|
||||
key: "isDraggingSource",
|
||||
value: function isDraggingSource(sourceId) {
|
||||
return this.internalMonitor.isDraggingSource(sourceId);
|
||||
}
|
||||
}, {
|
||||
key: "isOverTarget",
|
||||
value: function isOverTarget(targetId, options) {
|
||||
return this.internalMonitor.isOverTarget(targetId, options);
|
||||
}
|
||||
}, {
|
||||
key: "getTargetIds",
|
||||
value: function getTargetIds() {
|
||||
return this.internalMonitor.getTargetIds();
|
||||
}
|
||||
}, {
|
||||
key: "isSourcePublic",
|
||||
value: function isSourcePublic() {
|
||||
return this.internalMonitor.isSourcePublic();
|
||||
}
|
||||
}, {
|
||||
key: "getSourceId",
|
||||
value: function getSourceId() {
|
||||
return this.internalMonitor.getSourceId();
|
||||
}
|
||||
}, {
|
||||
key: "subscribeToOffsetChange",
|
||||
value: function subscribeToOffsetChange(listener) {
|
||||
return this.internalMonitor.subscribeToOffsetChange(listener);
|
||||
}
|
||||
}, {
|
||||
key: "canDragSource",
|
||||
value: function canDragSource(sourceId) {
|
||||
return this.internalMonitor.canDragSource(sourceId);
|
||||
}
|
||||
}, {
|
||||
key: "canDropOnTarget",
|
||||
value: function canDropOnTarget(targetId) {
|
||||
return this.internalMonitor.canDropOnTarget(targetId);
|
||||
}
|
||||
}, {
|
||||
key: "getItemType",
|
||||
value: function getItemType() {
|
||||
return this.internalMonitor.getItemType();
|
||||
}
|
||||
}, {
|
||||
key: "getItem",
|
||||
value: function getItem() {
|
||||
return this.internalMonitor.getItem();
|
||||
}
|
||||
}, {
|
||||
key: "getDropResult",
|
||||
value: function getDropResult() {
|
||||
return this.internalMonitor.getDropResult();
|
||||
}
|
||||
}, {
|
||||
key: "didDrop",
|
||||
value: function didDrop() {
|
||||
return this.internalMonitor.didDrop();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialClientOffset",
|
||||
value: function getInitialClientOffset() {
|
||||
return this.internalMonitor.getInitialClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialSourceClientOffset",
|
||||
value: function getInitialSourceClientOffset() {
|
||||
return this.internalMonitor.getInitialSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getSourceClientOffset",
|
||||
value: function getSourceClientOffset() {
|
||||
return this.internalMonitor.getSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getClientOffset",
|
||||
value: function getClientOffset() {
|
||||
return this.internalMonitor.getClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getDifferenceFromInitialOffset",
|
||||
value: function getDifferenceFromInitialOffset() {
|
||||
return this.internalMonitor.getDifferenceFromInitialOffset();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragSourceMonitorImpl;
|
||||
}();
|
||||
|
||||
exports.DragSourceMonitorImpl = DragSourceMonitorImpl;
|
||||
124
node_modules/react-dnd/dist/cjs/internals/DropTargetMonitorImpl.js
generated
vendored
Normal file
124
node_modules/react-dnd/dist/cjs/internals/DropTargetMonitorImpl.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DropTargetMonitorImpl = void 0;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
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 isCallingCanDrop = false;
|
||||
|
||||
var DropTargetMonitorImpl = /*#__PURE__*/function () {
|
||||
function DropTargetMonitorImpl(manager) {
|
||||
_classCallCheck(this, DropTargetMonitorImpl);
|
||||
|
||||
_defineProperty(this, "internalMonitor", void 0);
|
||||
|
||||
_defineProperty(this, "targetId", null);
|
||||
|
||||
this.internalMonitor = manager.getMonitor();
|
||||
}
|
||||
|
||||
_createClass(DropTargetMonitorImpl, [{
|
||||
key: "receiveHandlerId",
|
||||
value: function receiveHandlerId(targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
}, {
|
||||
key: "getHandlerId",
|
||||
value: function getHandlerId() {
|
||||
return this.targetId;
|
||||
}
|
||||
}, {
|
||||
key: "subscribeToStateChange",
|
||||
value: function subscribeToStateChange(listener, options) {
|
||||
return this.internalMonitor.subscribeToStateChange(listener, options);
|
||||
}
|
||||
}, {
|
||||
key: "canDrop",
|
||||
value: function canDrop() {
|
||||
// Cut out early if the target id has not been set. This should prevent errors
|
||||
// where the user has an older version of dnd-core like in
|
||||
// https://github.com/react-dnd/react-dnd/issues/1310
|
||||
if (!this.targetId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
(0, _invariant.invariant)(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');
|
||||
|
||||
try {
|
||||
isCallingCanDrop = true;
|
||||
return this.internalMonitor.canDropOnTarget(this.targetId);
|
||||
} finally {
|
||||
isCallingCanDrop = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isOver",
|
||||
value: function isOver(options) {
|
||||
if (!this.targetId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.internalMonitor.isOverTarget(this.targetId, options);
|
||||
}
|
||||
}, {
|
||||
key: "getItemType",
|
||||
value: function getItemType() {
|
||||
return this.internalMonitor.getItemType();
|
||||
}
|
||||
}, {
|
||||
key: "getItem",
|
||||
value: function getItem() {
|
||||
return this.internalMonitor.getItem();
|
||||
}
|
||||
}, {
|
||||
key: "getDropResult",
|
||||
value: function getDropResult() {
|
||||
return this.internalMonitor.getDropResult();
|
||||
}
|
||||
}, {
|
||||
key: "didDrop",
|
||||
value: function didDrop() {
|
||||
return this.internalMonitor.didDrop();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialClientOffset",
|
||||
value: function getInitialClientOffset() {
|
||||
return this.internalMonitor.getInitialClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialSourceClientOffset",
|
||||
value: function getInitialSourceClientOffset() {
|
||||
return this.internalMonitor.getInitialSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getSourceClientOffset",
|
||||
value: function getSourceClientOffset() {
|
||||
return this.internalMonitor.getSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getClientOffset",
|
||||
value: function getClientOffset() {
|
||||
return this.internalMonitor.getClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getDifferenceFromInitialOffset",
|
||||
value: function getDifferenceFromInitialOffset() {
|
||||
return this.internalMonitor.getDifferenceFromInitialOffset();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DropTargetMonitorImpl;
|
||||
}();
|
||||
|
||||
exports.DropTargetMonitorImpl = DropTargetMonitorImpl;
|
||||
253
node_modules/react-dnd/dist/cjs/internals/SourceConnector.js
generated
vendored
Normal file
253
node_modules/react-dnd/dist/cjs/internals/SourceConnector.js
generated
vendored
Normal file
@@ -0,0 +1,253 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SourceConnector = void 0;
|
||||
|
||||
var _wrapConnectorHooks = require("./wrapConnectorHooks");
|
||||
|
||||
var _isRef = require("./isRef");
|
||||
|
||||
var _shallowequal = require("@react-dnd/shallowequal");
|
||||
|
||||
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 SourceConnector = /*#__PURE__*/function () {
|
||||
// The drop target may either be attached via ref or connect function
|
||||
// The drag preview may either be attached via ref or connect function
|
||||
function SourceConnector(backend) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, SourceConnector);
|
||||
|
||||
_defineProperty(this, "hooks", (0, _wrapConnectorHooks.wrapConnectorHooks)({
|
||||
dragSource: function dragSource(node, options) {
|
||||
_this.clearDragSource();
|
||||
|
||||
_this.dragSourceOptions = options || null;
|
||||
|
||||
if ((0, _isRef.isRef)(node)) {
|
||||
_this.dragSourceRef = node;
|
||||
} else {
|
||||
_this.dragSourceNode = node;
|
||||
}
|
||||
|
||||
_this.reconnectDragSource();
|
||||
},
|
||||
dragPreview: function dragPreview(node, options) {
|
||||
_this.clearDragPreview();
|
||||
|
||||
_this.dragPreviewOptions = options || null;
|
||||
|
||||
if ((0, _isRef.isRef)(node)) {
|
||||
_this.dragPreviewRef = node;
|
||||
} else {
|
||||
_this.dragPreviewNode = node;
|
||||
}
|
||||
|
||||
_this.reconnectDragPreview();
|
||||
}
|
||||
}));
|
||||
|
||||
_defineProperty(this, "handlerId", null);
|
||||
|
||||
_defineProperty(this, "dragSourceRef", null);
|
||||
|
||||
_defineProperty(this, "dragSourceNode", void 0);
|
||||
|
||||
_defineProperty(this, "dragSourceOptionsInternal", null);
|
||||
|
||||
_defineProperty(this, "dragSourceUnsubscribe", void 0);
|
||||
|
||||
_defineProperty(this, "dragPreviewRef", null);
|
||||
|
||||
_defineProperty(this, "dragPreviewNode", void 0);
|
||||
|
||||
_defineProperty(this, "dragPreviewOptionsInternal", null);
|
||||
|
||||
_defineProperty(this, "dragPreviewUnsubscribe", void 0);
|
||||
|
||||
_defineProperty(this, "lastConnectedHandlerId", null);
|
||||
|
||||
_defineProperty(this, "lastConnectedDragSource", null);
|
||||
|
||||
_defineProperty(this, "lastConnectedDragSourceOptions", null);
|
||||
|
||||
_defineProperty(this, "lastConnectedDragPreview", null);
|
||||
|
||||
_defineProperty(this, "lastConnectedDragPreviewOptions", null);
|
||||
|
||||
_defineProperty(this, "backend", void 0);
|
||||
|
||||
this.backend = backend;
|
||||
}
|
||||
|
||||
_createClass(SourceConnector, [{
|
||||
key: "receiveHandlerId",
|
||||
value: function receiveHandlerId(newHandlerId) {
|
||||
if (this.handlerId === newHandlerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.handlerId = newHandlerId;
|
||||
this.reconnect();
|
||||
}
|
||||
}, {
|
||||
key: "connectTarget",
|
||||
get: function get() {
|
||||
return this.dragSource;
|
||||
}
|
||||
}, {
|
||||
key: "dragSourceOptions",
|
||||
get: function get() {
|
||||
return this.dragSourceOptionsInternal;
|
||||
},
|
||||
set: function set(options) {
|
||||
this.dragSourceOptionsInternal = options;
|
||||
}
|
||||
}, {
|
||||
key: "dragPreviewOptions",
|
||||
get: function get() {
|
||||
return this.dragPreviewOptionsInternal;
|
||||
},
|
||||
set: function set(options) {
|
||||
this.dragPreviewOptionsInternal = options;
|
||||
}
|
||||
}, {
|
||||
key: "reconnect",
|
||||
value: function reconnect() {
|
||||
this.reconnectDragSource();
|
||||
this.reconnectDragPreview();
|
||||
}
|
||||
}, {
|
||||
key: "reconnectDragSource",
|
||||
value: function reconnectDragSource() {
|
||||
var dragSource = this.dragSource; // if nothing has changed then don't resubscribe
|
||||
|
||||
var didChange = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange();
|
||||
|
||||
if (didChange) {
|
||||
this.disconnectDragSource();
|
||||
}
|
||||
|
||||
if (!this.handlerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dragSource) {
|
||||
this.lastConnectedDragSource = dragSource;
|
||||
return;
|
||||
}
|
||||
|
||||
if (didChange) {
|
||||
this.lastConnectedHandlerId = this.handlerId;
|
||||
this.lastConnectedDragSource = dragSource;
|
||||
this.lastConnectedDragSourceOptions = this.dragSourceOptions;
|
||||
this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "reconnectDragPreview",
|
||||
value: function reconnectDragPreview() {
|
||||
var dragPreview = this.dragPreview; // if nothing has changed then don't resubscribe
|
||||
|
||||
var didChange = this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange();
|
||||
|
||||
if (didChange) {
|
||||
this.disconnectDragPreview();
|
||||
}
|
||||
|
||||
if (!this.handlerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dragPreview) {
|
||||
this.lastConnectedDragPreview = dragPreview;
|
||||
return;
|
||||
}
|
||||
|
||||
if (didChange) {
|
||||
this.lastConnectedHandlerId = this.handlerId;
|
||||
this.lastConnectedDragPreview = dragPreview;
|
||||
this.lastConnectedDragPreviewOptions = this.dragPreviewOptions;
|
||||
this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "didHandlerIdChange",
|
||||
value: function didHandlerIdChange() {
|
||||
return this.lastConnectedHandlerId !== this.handlerId;
|
||||
}
|
||||
}, {
|
||||
key: "didConnectedDragSourceChange",
|
||||
value: function didConnectedDragSourceChange() {
|
||||
return this.lastConnectedDragSource !== this.dragSource;
|
||||
}
|
||||
}, {
|
||||
key: "didConnectedDragPreviewChange",
|
||||
value: function didConnectedDragPreviewChange() {
|
||||
return this.lastConnectedDragPreview !== this.dragPreview;
|
||||
}
|
||||
}, {
|
||||
key: "didDragSourceOptionsChange",
|
||||
value: function didDragSourceOptionsChange() {
|
||||
return !(0, _shallowequal.shallowEqual)(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
|
||||
}
|
||||
}, {
|
||||
key: "didDragPreviewOptionsChange",
|
||||
value: function didDragPreviewOptionsChange() {
|
||||
return !(0, _shallowequal.shallowEqual)(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
|
||||
}
|
||||
}, {
|
||||
key: "disconnectDragSource",
|
||||
value: function disconnectDragSource() {
|
||||
if (this.dragSourceUnsubscribe) {
|
||||
this.dragSourceUnsubscribe();
|
||||
this.dragSourceUnsubscribe = undefined;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "disconnectDragPreview",
|
||||
value: function disconnectDragPreview() {
|
||||
if (this.dragPreviewUnsubscribe) {
|
||||
this.dragPreviewUnsubscribe();
|
||||
this.dragPreviewUnsubscribe = undefined;
|
||||
this.dragPreviewNode = null;
|
||||
this.dragPreviewRef = null;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "dragSource",
|
||||
get: function get() {
|
||||
return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current;
|
||||
}
|
||||
}, {
|
||||
key: "dragPreview",
|
||||
get: function get() {
|
||||
return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current;
|
||||
}
|
||||
}, {
|
||||
key: "clearDragSource",
|
||||
value: function clearDragSource() {
|
||||
this.dragSourceNode = null;
|
||||
this.dragSourceRef = null;
|
||||
}
|
||||
}, {
|
||||
key: "clearDragPreview",
|
||||
value: function clearDragPreview() {
|
||||
this.dragPreviewNode = null;
|
||||
this.dragPreviewRef = null;
|
||||
}
|
||||
}]);
|
||||
|
||||
return SourceConnector;
|
||||
}();
|
||||
|
||||
exports.SourceConnector = SourceConnector;
|
||||
156
node_modules/react-dnd/dist/cjs/internals/TargetConnector.js
generated
vendored
Normal file
156
node_modules/react-dnd/dist/cjs/internals/TargetConnector.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TargetConnector = void 0;
|
||||
|
||||
var _shallowequal = require("@react-dnd/shallowequal");
|
||||
|
||||
var _wrapConnectorHooks = require("./wrapConnectorHooks");
|
||||
|
||||
var _isRef = require("./isRef");
|
||||
|
||||
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 TargetConnector = /*#__PURE__*/function () {
|
||||
// The drop target may either be attached via ref or connect function
|
||||
function TargetConnector(backend) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, TargetConnector);
|
||||
|
||||
_defineProperty(this, "hooks", (0, _wrapConnectorHooks.wrapConnectorHooks)({
|
||||
dropTarget: function dropTarget(node, options) {
|
||||
_this.clearDropTarget();
|
||||
|
||||
_this.dropTargetOptions = options;
|
||||
|
||||
if ((0, _isRef.isRef)(node)) {
|
||||
_this.dropTargetRef = node;
|
||||
} else {
|
||||
_this.dropTargetNode = node;
|
||||
}
|
||||
|
||||
_this.reconnect();
|
||||
}
|
||||
}));
|
||||
|
||||
_defineProperty(this, "handlerId", null);
|
||||
|
||||
_defineProperty(this, "dropTargetRef", null);
|
||||
|
||||
_defineProperty(this, "dropTargetNode", void 0);
|
||||
|
||||
_defineProperty(this, "dropTargetOptionsInternal", null);
|
||||
|
||||
_defineProperty(this, "unsubscribeDropTarget", void 0);
|
||||
|
||||
_defineProperty(this, "lastConnectedHandlerId", null);
|
||||
|
||||
_defineProperty(this, "lastConnectedDropTarget", null);
|
||||
|
||||
_defineProperty(this, "lastConnectedDropTargetOptions", null);
|
||||
|
||||
_defineProperty(this, "backend", void 0);
|
||||
|
||||
this.backend = backend;
|
||||
}
|
||||
|
||||
_createClass(TargetConnector, [{
|
||||
key: "connectTarget",
|
||||
get: function get() {
|
||||
return this.dropTarget;
|
||||
}
|
||||
}, {
|
||||
key: "reconnect",
|
||||
value: function reconnect() {
|
||||
// if nothing has changed then don't resubscribe
|
||||
var didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();
|
||||
|
||||
if (didChange) {
|
||||
this.disconnectDropTarget();
|
||||
}
|
||||
|
||||
var dropTarget = this.dropTarget;
|
||||
|
||||
if (!this.handlerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dropTarget) {
|
||||
this.lastConnectedDropTarget = dropTarget;
|
||||
return;
|
||||
}
|
||||
|
||||
if (didChange) {
|
||||
this.lastConnectedHandlerId = this.handlerId;
|
||||
this.lastConnectedDropTarget = dropTarget;
|
||||
this.lastConnectedDropTargetOptions = this.dropTargetOptions;
|
||||
this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "receiveHandlerId",
|
||||
value: function receiveHandlerId(newHandlerId) {
|
||||
if (newHandlerId === this.handlerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.handlerId = newHandlerId;
|
||||
this.reconnect();
|
||||
}
|
||||
}, {
|
||||
key: "dropTargetOptions",
|
||||
get: function get() {
|
||||
return this.dropTargetOptionsInternal;
|
||||
},
|
||||
set: function set(options) {
|
||||
this.dropTargetOptionsInternal = options;
|
||||
}
|
||||
}, {
|
||||
key: "didHandlerIdChange",
|
||||
value: function didHandlerIdChange() {
|
||||
return this.lastConnectedHandlerId !== this.handlerId;
|
||||
}
|
||||
}, {
|
||||
key: "didDropTargetChange",
|
||||
value: function didDropTargetChange() {
|
||||
return this.lastConnectedDropTarget !== this.dropTarget;
|
||||
}
|
||||
}, {
|
||||
key: "didOptionsChange",
|
||||
value: function didOptionsChange() {
|
||||
return !(0, _shallowequal.shallowEqual)(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
|
||||
}
|
||||
}, {
|
||||
key: "disconnectDropTarget",
|
||||
value: function disconnectDropTarget() {
|
||||
if (this.unsubscribeDropTarget) {
|
||||
this.unsubscribeDropTarget();
|
||||
this.unsubscribeDropTarget = undefined;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "dropTarget",
|
||||
get: function get() {
|
||||
return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;
|
||||
}
|
||||
}, {
|
||||
key: "clearDropTarget",
|
||||
value: function clearDropTarget() {
|
||||
this.dropTargetRef = null;
|
||||
this.dropTargetNode = null;
|
||||
}
|
||||
}]);
|
||||
|
||||
return TargetConnector;
|
||||
}();
|
||||
|
||||
exports.TargetConnector = TargetConnector;
|
||||
70
node_modules/react-dnd/dist/cjs/internals/index.js
generated
vendored
Normal file
70
node_modules/react-dnd/dist/cjs/internals/index.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _DragSourceMonitorImpl = require("./DragSourceMonitorImpl");
|
||||
|
||||
Object.keys(_DragSourceMonitorImpl).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DragSourceMonitorImpl[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DragSourceMonitorImpl[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _DropTargetMonitorImpl = require("./DropTargetMonitorImpl");
|
||||
|
||||
Object.keys(_DropTargetMonitorImpl).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _DropTargetMonitorImpl[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DropTargetMonitorImpl[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _SourceConnector = require("./SourceConnector");
|
||||
|
||||
Object.keys(_SourceConnector).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _SourceConnector[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _SourceConnector[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _TargetConnector = require("./TargetConnector");
|
||||
|
||||
Object.keys(_TargetConnector).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _TargetConnector[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _TargetConnector[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _registration = require("./registration");
|
||||
|
||||
Object.keys(_registration).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _registration[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _registration[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
14
node_modules/react-dnd/dist/cjs/internals/isRef.js
generated
vendored
Normal file
14
node_modules/react-dnd/dist/cjs/internals/isRef.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isRef = isRef;
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function isRef(obj) {
|
||||
return (// eslint-disable-next-line no-prototype-builtins
|
||||
obj !== null && _typeof(obj) === 'object' && Object.prototype.hasOwnProperty.call(obj, 'current')
|
||||
);
|
||||
}
|
||||
23
node_modules/react-dnd/dist/cjs/internals/registration.js
generated
vendored
Normal file
23
node_modules/react-dnd/dist/cjs/internals/registration.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.registerTarget = registerTarget;
|
||||
exports.registerSource = registerSource;
|
||||
|
||||
function registerTarget(type, target, manager) {
|
||||
var registry = manager.getRegistry();
|
||||
var targetId = registry.addTarget(type, target);
|
||||
return [targetId, function () {
|
||||
return registry.removeTarget(targetId);
|
||||
}];
|
||||
}
|
||||
|
||||
function registerSource(type, source, manager) {
|
||||
var registry = manager.getRegistry();
|
||||
var sourceId = registry.addSource(type, source);
|
||||
return [sourceId, function () {
|
||||
return registry.removeSource(sourceId);
|
||||
}];
|
||||
}
|
||||
93
node_modules/react-dnd/dist/cjs/internals/wrapConnectorHooks.js
generated
vendored
Normal file
93
node_modules/react-dnd/dist/cjs/internals/wrapConnectorHooks.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.wrapConnectorHooks = wrapConnectorHooks;
|
||||
|
||||
var _invariant = require("@react-dnd/invariant");
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
function throwIfCompositeComponentElement(element) {
|
||||
// Custom components can no longer be wrapped directly in React DnD 2.0
|
||||
// so that we don't need to depend on findDOMNode() from react-dom.
|
||||
if (typeof element.type === 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
var displayName = element.type.displayName || element.type.name || 'the component';
|
||||
throw new Error('Only native element nodes can now be passed to React DnD connectors.' + "You can either wrap ".concat(displayName, " into a <div>, or turn it into a ") + 'drag source or a drop target itself.');
|
||||
}
|
||||
|
||||
function wrapHookToRecognizeElement(hook) {
|
||||
return function () {
|
||||
var elementOrNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
|
||||
// When passed a node, call the hook straight away.
|
||||
if (!(0, _react.isValidElement)(elementOrNode)) {
|
||||
var node = elementOrNode;
|
||||
hook(node, options); // return the node so it can be chained (e.g. when within callback refs
|
||||
// <div ref={node => connectDragSource(connectDropTarget(node))}/>
|
||||
|
||||
return node;
|
||||
} // If passed a ReactElement, clone it and attach this function as a ref.
|
||||
// This helps us achieve a neat API where user doesn't even know that refs
|
||||
// are being used under the hood.
|
||||
|
||||
|
||||
var element = elementOrNode;
|
||||
throwIfCompositeComponentElement(element); // When no options are passed, use the hook directly
|
||||
|
||||
var ref = options ? function (node) {
|
||||
return hook(node, options);
|
||||
} : hook;
|
||||
return cloneWithRef(element, ref);
|
||||
};
|
||||
}
|
||||
|
||||
function wrapConnectorHooks(hooks) {
|
||||
var wrappedHooks = {};
|
||||
Object.keys(hooks).forEach(function (key) {
|
||||
var hook = hooks[key]; // ref objects should be passed straight through without wrapping
|
||||
|
||||
if (key.endsWith('Ref')) {
|
||||
wrappedHooks[key] = hooks[key];
|
||||
} else {
|
||||
var wrappedHook = wrapHookToRecognizeElement(hook);
|
||||
|
||||
wrappedHooks[key] = function () {
|
||||
return wrappedHook;
|
||||
};
|
||||
}
|
||||
});
|
||||
return wrappedHooks;
|
||||
}
|
||||
|
||||
function setRef(ref, node) {
|
||||
if (typeof ref === 'function') {
|
||||
ref(node);
|
||||
} else {
|
||||
ref.current = node;
|
||||
}
|
||||
}
|
||||
|
||||
function cloneWithRef(element, newRef) {
|
||||
var previousRef = element.ref;
|
||||
(0, _invariant.invariant)(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + 'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' + 'Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs');
|
||||
|
||||
if (!previousRef) {
|
||||
// When there is no ref on the element, use the new ref directly
|
||||
return (0, _react.cloneElement)(element, {
|
||||
ref: newRef
|
||||
});
|
||||
} else {
|
||||
return (0, _react.cloneElement)(element, {
|
||||
ref: function ref(node) {
|
||||
setRef(previousRef, node);
|
||||
setRef(newRef, node);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
5
node_modules/react-dnd/dist/cjs/types/connectors.js
generated
vendored
Normal file
5
node_modules/react-dnd/dist/cjs/types/connectors.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
44
node_modules/react-dnd/dist/cjs/types/index.js
generated
vendored
Normal file
44
node_modules/react-dnd/dist/cjs/types/index.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _monitors = require("./monitors");
|
||||
|
||||
Object.keys(_monitors).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _monitors[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _monitors[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _options = require("./options");
|
||||
|
||||
Object.keys(_options).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _options[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _options[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _connectors = require("./connectors");
|
||||
|
||||
Object.keys(_connectors).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _connectors[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _connectors[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
5
node_modules/react-dnd/dist/cjs/types/monitors.js
generated
vendored
Normal file
5
node_modules/react-dnd/dist/cjs/types/monitors.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
5
node_modules/react-dnd/dist/cjs/types/options.js
generated
vendored
Normal file
5
node_modules/react-dnd/dist/cjs/types/options.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
8
node_modules/react-dnd/dist/esm/core/DndContext.js
generated
vendored
Normal file
8
node_modules/react-dnd/dist/esm/core/DndContext.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { createContext } from 'react';
|
||||
/**
|
||||
* Create the React Context
|
||||
*/
|
||||
|
||||
export var DndContext = createContext({
|
||||
dragDropManager: undefined
|
||||
});
|
||||
93
node_modules/react-dnd/dist/esm/core/DndProvider.js
generated
vendored
Normal file
93
node_modules/react-dnd/dist/esm/core/DndProvider.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
var _excluded = ["children"];
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { useEffect, memo } from 'react';
|
||||
import { createDragDropManager } from 'dnd-core';
|
||||
import { DndContext } from './DndContext';
|
||||
var refCount = 0;
|
||||
var INSTANCE_SYM = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');
|
||||
/**
|
||||
* A React component that provides the React-DnD context
|
||||
*/
|
||||
|
||||
export var DndProvider = memo(function DndProvider(_ref) {
|
||||
var children = _ref.children,
|
||||
props = _objectWithoutProperties(_ref, _excluded);
|
||||
|
||||
var _getDndContextValue = getDndContextValue(props),
|
||||
_getDndContextValue2 = _slicedToArray(_getDndContextValue, 2),
|
||||
manager = _getDndContextValue2[0],
|
||||
isGlobalInstance = _getDndContextValue2[1]; // memoized from props
|
||||
|
||||
/**
|
||||
* If the global context was used to store the DND context
|
||||
* then where theres no more references to it we should
|
||||
* clean it up to avoid memory leaks
|
||||
*/
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if (isGlobalInstance) {
|
||||
var context = getGlobalContext();
|
||||
++refCount;
|
||||
return function () {
|
||||
if (--refCount === 0) {
|
||||
context[INSTANCE_SYM] = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}, []);
|
||||
return _jsx(DndContext.Provider, Object.assign({
|
||||
value: manager
|
||||
}, {
|
||||
children: children
|
||||
}), void 0);
|
||||
});
|
||||
|
||||
function getDndContextValue(props) {
|
||||
if ('manager' in props) {
|
||||
var _manager = {
|
||||
dragDropManager: props.manager
|
||||
};
|
||||
return [_manager, false];
|
||||
}
|
||||
|
||||
var manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);
|
||||
var isGlobalInstance = !props.context;
|
||||
return [manager, isGlobalInstance];
|
||||
}
|
||||
|
||||
function createSingletonDndContext(backend) {
|
||||
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getGlobalContext();
|
||||
var options = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var debugMode = arguments.length > 3 ? arguments[3] : undefined;
|
||||
var ctx = context;
|
||||
|
||||
if (!ctx[INSTANCE_SYM]) {
|
||||
ctx[INSTANCE_SYM] = {
|
||||
dragDropManager: createDragDropManager(backend, context, options, debugMode)
|
||||
};
|
||||
}
|
||||
|
||||
return ctx[INSTANCE_SYM];
|
||||
}
|
||||
|
||||
function getGlobalContext() {
|
||||
return typeof global !== 'undefined' ? global : window;
|
||||
}
|
||||
27
node_modules/react-dnd/dist/esm/core/DragPreviewImage.js
generated
vendored
Normal file
27
node_modules/react-dnd/dist/esm/core/DragPreviewImage.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { useEffect, memo } from 'react';
|
||||
/**
|
||||
* A utility for rendering a drag preview image
|
||||
*/
|
||||
|
||||
export var DragPreviewImage = memo(function DragPreviewImage(_ref) {
|
||||
var connect = _ref.connect,
|
||||
src = _ref.src;
|
||||
useEffect(function () {
|
||||
if (typeof Image === 'undefined') return;
|
||||
var connected = false;
|
||||
var img = new Image();
|
||||
img.src = src;
|
||||
|
||||
img.onload = function () {
|
||||
connect(img);
|
||||
connected = true;
|
||||
};
|
||||
|
||||
return function () {
|
||||
if (connected) {
|
||||
connect(null);
|
||||
}
|
||||
};
|
||||
});
|
||||
return null;
|
||||
});
|
||||
3
node_modules/react-dnd/dist/esm/core/index.js
generated
vendored
Normal file
3
node_modules/react-dnd/dist/esm/core/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './DndContext';
|
||||
export * from './DndProvider';
|
||||
export * from './DragPreviewImage';
|
||||
181
node_modules/react-dnd/dist/esm/decorators/DragLayer.js
generated
vendored
Normal file
181
node_modules/react-dnd/dist/esm/decorators/DragLayer.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
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; }
|
||||
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { createRef, Component } from 'react';
|
||||
import { shallowEqual } from '@react-dnd/shallowequal';
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import hoistStatics from 'hoist-non-react-statics';
|
||||
import { DndContext } from '../core';
|
||||
import { isRefable, checkDecoratorArguments, isPlainObject } from './utils';
|
||||
/**
|
||||
* @param collect The props collector function
|
||||
* @param options The DnD options
|
||||
*/
|
||||
|
||||
export function DragLayer(collect) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
checkDecoratorArguments('DragLayer', 'collect[, options]', collect, options);
|
||||
invariant(typeof collect === 'function', 'Expected "collect" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', collect);
|
||||
invariant(isPlainObject(options), 'Expected "options" provided as the second argument to DragLayer to be a plain object when specified. ' + 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', options);
|
||||
return function decorateLayer(DecoratedComponent) {
|
||||
var Decorated = DecoratedComponent;
|
||||
var _options$arePropsEqua = options.arePropsEqual,
|
||||
arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;
|
||||
var displayName = Decorated.displayName || Decorated.name || 'Component';
|
||||
|
||||
var DragLayerContainer = /*#__PURE__*/function (_Component) {
|
||||
_inherits(DragLayerContainer, _Component);
|
||||
|
||||
var _super = _createSuper(DragLayerContainer);
|
||||
|
||||
function DragLayerContainer() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, DragLayerContainer);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _super.call.apply(_super, [this].concat(args));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "manager", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "isCurrentlyMounted", false);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "unsubscribeFromOffsetChange", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "unsubscribeFromStateChange", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "ref", createRef());
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handleChange", function () {
|
||||
if (!_this.isCurrentlyMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nextState = _this.getCurrentState();
|
||||
|
||||
if (!shallowEqual(nextState, _this.state)) {
|
||||
_this.setState(nextState);
|
||||
}
|
||||
});
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(DragLayerContainer, [{
|
||||
key: "getDecoratedComponentInstance",
|
||||
value: function getDecoratedComponentInstance() {
|
||||
invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
|
||||
return this.ref.current;
|
||||
}
|
||||
}, {
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps, nextState) {
|
||||
return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.isCurrentlyMounted = true;
|
||||
this.handleChange();
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.isCurrentlyMounted = false;
|
||||
|
||||
if (this.unsubscribeFromOffsetChange) {
|
||||
this.unsubscribeFromOffsetChange();
|
||||
this.unsubscribeFromOffsetChange = undefined;
|
||||
}
|
||||
|
||||
if (this.unsubscribeFromStateChange) {
|
||||
this.unsubscribeFromStateChange();
|
||||
this.unsubscribeFromStateChange = undefined;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return _jsx(DndContext.Consumer, {
|
||||
children: function children(_ref) {
|
||||
var dragDropManager = _ref.dragDropManager;
|
||||
|
||||
if (dragDropManager === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
_this2.receiveDragDropManager(dragDropManager); // Let componentDidMount fire to initialize the collected state
|
||||
|
||||
|
||||
if (!_this2.isCurrentlyMounted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return _jsx(Decorated, Object.assign({}, _this2.props, _this2.state, {
|
||||
ref: isRefable(Decorated) ? _this2.ref : null
|
||||
}), void 0);
|
||||
}
|
||||
}, void 0);
|
||||
}
|
||||
}, {
|
||||
key: "receiveDragDropManager",
|
||||
value: function receiveDragDropManager(dragDropManager) {
|
||||
if (this.manager !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.manager = dragDropManager;
|
||||
invariant(_typeof(dragDropManager) === 'object', 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
|
||||
var monitor = this.manager.getMonitor();
|
||||
this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleChange);
|
||||
this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleChange);
|
||||
}
|
||||
}, {
|
||||
key: "getCurrentState",
|
||||
value: function getCurrentState() {
|
||||
if (!this.manager) {
|
||||
return {};
|
||||
}
|
||||
|
||||
var monitor = this.manager.getMonitor();
|
||||
return collect(monitor, this.props);
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragLayerContainer;
|
||||
}(Component);
|
||||
|
||||
_defineProperty(DragLayerContainer, "displayName", "DragLayer(".concat(displayName, ")"));
|
||||
|
||||
_defineProperty(DragLayerContainer, "DecoratedComponent", DecoratedComponent);
|
||||
|
||||
return hoistStatics(DragLayerContainer, DecoratedComponent);
|
||||
};
|
||||
}
|
||||
48
node_modules/react-dnd/dist/esm/decorators/DragSource.js
generated
vendored
Normal file
48
node_modules/react-dnd/dist/esm/decorators/DragSource.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { registerSource, DragSourceMonitorImpl, SourceConnector } from '../internals';
|
||||
import { checkDecoratorArguments, isPlainObject, isValidType } from './utils';
|
||||
import { decorateHandler } from './decorateHandler';
|
||||
import { createSourceFactory } from './createSourceFactory';
|
||||
/**
|
||||
* Decorates a component as a dragsource
|
||||
* @param type The dragsource type
|
||||
* @param spec The drag source specification
|
||||
* @param collect The props collector function
|
||||
* @param options DnD options
|
||||
*/
|
||||
|
||||
export function DragSource(type, spec, collect) {
|
||||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
checkDecoratorArguments('DragSource', 'type, spec, collect[, options]', type, spec, collect, options);
|
||||
var getType = type;
|
||||
|
||||
if (typeof type !== 'function') {
|
||||
invariant(isValidType(type), 'Expected "type" provided as the first argument to DragSource to be ' + 'a string, or a function that returns a string given the current props. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', type);
|
||||
|
||||
getType = function getType() {
|
||||
return type;
|
||||
};
|
||||
}
|
||||
|
||||
invariant(isPlainObject(spec), 'Expected "spec" provided as the second argument to DragSource to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', spec);
|
||||
var createSource = createSourceFactory(spec);
|
||||
invariant(typeof collect === 'function', 'Expected "collect" provided as the third argument to DragSource to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);
|
||||
invariant(isPlainObject(options), 'Expected "options" provided as the fourth argument to DragSource to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);
|
||||
return function decorateSource(DecoratedComponent) {
|
||||
return decorateHandler({
|
||||
containerDisplayName: 'DragSource',
|
||||
createHandler: createSource,
|
||||
registerHandler: registerSource,
|
||||
createConnector: function createConnector(backend) {
|
||||
return new SourceConnector(backend);
|
||||
},
|
||||
createMonitor: function createMonitor(manager) {
|
||||
return new DragSourceMonitorImpl(manager);
|
||||
},
|
||||
DecoratedComponent: DecoratedComponent,
|
||||
getType: getType,
|
||||
collect: collect,
|
||||
options: options
|
||||
});
|
||||
};
|
||||
}
|
||||
48
node_modules/react-dnd/dist/esm/decorators/DropTarget.js
generated
vendored
Normal file
48
node_modules/react-dnd/dist/esm/decorators/DropTarget.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { TargetConnector, DropTargetMonitorImpl, registerTarget } from '../internals';
|
||||
import { isPlainObject, isValidType } from './utils';
|
||||
import { checkDecoratorArguments } from './utils';
|
||||
import { decorateHandler } from './decorateHandler';
|
||||
import { createTargetFactory } from './createTargetFactory';
|
||||
/**
|
||||
* @param type The accepted target type
|
||||
* @param spec The DropTarget specification
|
||||
* @param collect The props collector function
|
||||
* @param options Options
|
||||
*/
|
||||
|
||||
export function DropTarget(type, spec, collect) {
|
||||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
checkDecoratorArguments('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);
|
||||
var getType = type;
|
||||
|
||||
if (typeof type !== 'function') {
|
||||
invariant(isValidType(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' + 'a string, an array of strings, or a function that returns either given ' + 'the current props. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', type);
|
||||
|
||||
getType = function getType() {
|
||||
return type;
|
||||
};
|
||||
}
|
||||
|
||||
invariant(isPlainObject(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', spec);
|
||||
var createTarget = createTargetFactory(spec);
|
||||
invariant(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
|
||||
invariant(isPlainObject(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
|
||||
return function decorateTarget(DecoratedComponent) {
|
||||
return decorateHandler({
|
||||
containerDisplayName: 'DropTarget',
|
||||
createHandler: createTarget,
|
||||
registerHandler: registerTarget,
|
||||
createMonitor: function createMonitor(manager) {
|
||||
return new DropTargetMonitorImpl(manager);
|
||||
},
|
||||
createConnector: function createConnector(backend) {
|
||||
return new TargetConnector(backend);
|
||||
},
|
||||
DecoratedComponent: DecoratedComponent,
|
||||
getType: getType,
|
||||
collect: collect,
|
||||
options: options
|
||||
});
|
||||
};
|
||||
}
|
||||
107
node_modules/react-dnd/dist/esm/decorators/createSourceFactory.js
generated
vendored
Normal file
107
node_modules/react-dnd/dist/esm/decorators/createSourceFactory.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
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; }
|
||||
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { isPlainObject, getDecoratedComponent } from './utils';
|
||||
var ALLOWED_SPEC_METHODS = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];
|
||||
var REQUIRED_SPEC_METHODS = ['beginDrag'];
|
||||
|
||||
var SourceImpl = /*#__PURE__*/function () {
|
||||
function SourceImpl(spec, monitor, ref) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, SourceImpl);
|
||||
|
||||
_defineProperty(this, "props", null);
|
||||
|
||||
_defineProperty(this, "spec", void 0);
|
||||
|
||||
_defineProperty(this, "monitor", void 0);
|
||||
|
||||
_defineProperty(this, "ref", void 0);
|
||||
|
||||
_defineProperty(this, "beginDrag", function () {
|
||||
if (!_this.props) {
|
||||
return;
|
||||
}
|
||||
|
||||
var item = _this.spec.beginDrag(_this.props, _this.monitor, _this.ref.current);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
invariant(isPlainObject(item), 'beginDrag() must return a plain object that represents the dragged item. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', item);
|
||||
}
|
||||
|
||||
return item;
|
||||
});
|
||||
|
||||
this.spec = spec;
|
||||
this.monitor = monitor;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
_createClass(SourceImpl, [{
|
||||
key: "receiveProps",
|
||||
value: function receiveProps(props) {
|
||||
this.props = props;
|
||||
}
|
||||
}, {
|
||||
key: "canDrag",
|
||||
value: function canDrag() {
|
||||
if (!this.props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.spec.canDrag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.spec.canDrag(this.props, this.monitor);
|
||||
}
|
||||
}, {
|
||||
key: "isDragging",
|
||||
value: function isDragging(globalMonitor, sourceId) {
|
||||
if (!this.props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.spec.isDragging) {
|
||||
return sourceId === globalMonitor.getSourceId();
|
||||
}
|
||||
|
||||
return this.spec.isDragging(this.props, this.monitor);
|
||||
}
|
||||
}, {
|
||||
key: "endDrag",
|
||||
value: function endDrag() {
|
||||
if (!this.props) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.spec.endDrag) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.spec.endDrag(this.props, this.monitor, getDecoratedComponent(this.ref));
|
||||
}
|
||||
}]);
|
||||
|
||||
return SourceImpl;
|
||||
}();
|
||||
|
||||
export function createSourceFactory(spec) {
|
||||
Object.keys(spec).forEach(function (key) {
|
||||
invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', ALLOWED_SPEC_METHODS.join(', '), key);
|
||||
invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);
|
||||
});
|
||||
REQUIRED_SPEC_METHODS.forEach(function (key) {
|
||||
invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);
|
||||
});
|
||||
return function createSource(monitor, ref) {
|
||||
return new SourceImpl(spec, monitor, ref);
|
||||
};
|
||||
}
|
||||
86
node_modules/react-dnd/dist/esm/decorators/createTargetFactory.js
generated
vendored
Normal file
86
node_modules/react-dnd/dist/esm/decorators/createTargetFactory.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
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; }
|
||||
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { isPlainObject, getDecoratedComponent } from './utils';
|
||||
var ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];
|
||||
|
||||
var TargetImpl = /*#__PURE__*/function () {
|
||||
function TargetImpl(spec, monitor, ref) {
|
||||
_classCallCheck(this, TargetImpl);
|
||||
|
||||
_defineProperty(this, "props", null);
|
||||
|
||||
_defineProperty(this, "spec", void 0);
|
||||
|
||||
_defineProperty(this, "monitor", void 0);
|
||||
|
||||
_defineProperty(this, "ref", void 0);
|
||||
|
||||
this.spec = spec;
|
||||
this.monitor = monitor;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
_createClass(TargetImpl, [{
|
||||
key: "receiveProps",
|
||||
value: function receiveProps(props) {
|
||||
this.props = props;
|
||||
}
|
||||
}, {
|
||||
key: "receiveMonitor",
|
||||
value: function receiveMonitor(monitor) {
|
||||
this.monitor = monitor;
|
||||
}
|
||||
}, {
|
||||
key: "canDrop",
|
||||
value: function canDrop() {
|
||||
if (!this.spec.canDrop) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.spec.canDrop(this.props, this.monitor);
|
||||
}
|
||||
}, {
|
||||
key: "hover",
|
||||
value: function hover() {
|
||||
if (!this.spec.hover || !this.props) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.spec.hover(this.props, this.monitor, getDecoratedComponent(this.ref));
|
||||
}
|
||||
}, {
|
||||
key: "drop",
|
||||
value: function drop() {
|
||||
if (!this.spec.drop) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var dropResult = this.spec.drop(this.props, this.monitor, this.ref.current);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
invariant(typeof dropResult === 'undefined' || isPlainObject(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', dropResult);
|
||||
}
|
||||
|
||||
return dropResult;
|
||||
}
|
||||
}]);
|
||||
|
||||
return TargetImpl;
|
||||
}();
|
||||
|
||||
export function createTargetFactory(spec) {
|
||||
Object.keys(spec).forEach(function (key) {
|
||||
invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', ALLOWED_SPEC_METHODS.join(', '), key);
|
||||
invariant(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', key, key, spec[key]);
|
||||
});
|
||||
return function createTarget(monitor, ref) {
|
||||
return new TargetImpl(spec, monitor, ref);
|
||||
};
|
||||
}
|
||||
258
node_modules/react-dnd/dist/esm/decorators/decorateHandler.js
generated
vendored
Normal file
258
node_modules/react-dnd/dist/esm/decorators/decorateHandler.js
generated
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
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; }
|
||||
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { createRef, Component } from 'react';
|
||||
import { shallowEqual } from '@react-dnd/shallowequal';
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { DndContext } from '../core';
|
||||
import { isPlainObject } from './utils';
|
||||
import { Disposable, CompositeDisposable, SerialDisposable } from './disposables';
|
||||
import { isRefable } from './utils';
|
||||
import hoistStatics from 'hoist-non-react-statics';
|
||||
export function decorateHandler(_ref) {
|
||||
var DecoratedComponent = _ref.DecoratedComponent,
|
||||
createHandler = _ref.createHandler,
|
||||
createMonitor = _ref.createMonitor,
|
||||
createConnector = _ref.createConnector,
|
||||
registerHandler = _ref.registerHandler,
|
||||
containerDisplayName = _ref.containerDisplayName,
|
||||
getType = _ref.getType,
|
||||
collect = _ref.collect,
|
||||
options = _ref.options;
|
||||
var _options$arePropsEqua = options.arePropsEqual,
|
||||
arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;
|
||||
var Decorated = DecoratedComponent;
|
||||
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
|
||||
|
||||
var DragDropContainer = /*#__PURE__*/function (_Component) {
|
||||
_inherits(DragDropContainer, _Component);
|
||||
|
||||
var _super = _createSuper(DragDropContainer);
|
||||
|
||||
function DragDropContainer(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, DragDropContainer);
|
||||
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "decoratedRef", createRef());
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handlerId", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "manager", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handlerMonitor", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handlerConnector", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handler", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "disposable", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "currentType", void 0);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handleChange", function () {
|
||||
var nextState = _this.getCurrentState();
|
||||
|
||||
if (!shallowEqual(nextState, _this.state)) {
|
||||
_this.setState(nextState);
|
||||
}
|
||||
});
|
||||
|
||||
_this.disposable = new SerialDisposable();
|
||||
|
||||
_this.receiveProps(props);
|
||||
|
||||
_this.dispose();
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(DragDropContainer, [{
|
||||
key: "getHandlerId",
|
||||
value: function getHandlerId() {
|
||||
return this.handlerId;
|
||||
}
|
||||
}, {
|
||||
key: "getDecoratedComponentInstance",
|
||||
value: function getDecoratedComponentInstance() {
|
||||
invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
|
||||
return this.decoratedRef.current;
|
||||
}
|
||||
}, {
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps, nextState) {
|
||||
return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.disposable = new SerialDisposable();
|
||||
this.currentType = undefined;
|
||||
this.receiveProps(this.props);
|
||||
this.handleChange();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
if (!arePropsEqual(this.props, prevProps)) {
|
||||
this.receiveProps(this.props);
|
||||
this.handleChange();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.dispose();
|
||||
}
|
||||
}, {
|
||||
key: "receiveProps",
|
||||
value: function receiveProps(props) {
|
||||
if (!this.handler) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.handler.receiveProps(props);
|
||||
this.receiveType(getType(props));
|
||||
}
|
||||
}, {
|
||||
key: "receiveType",
|
||||
value: function receiveType(type) {
|
||||
if (!this.handlerMonitor || !this.manager || !this.handlerConnector) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === this.currentType) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentType = type;
|
||||
|
||||
var _registerHandler = registerHandler(type, this.handler, this.manager),
|
||||
_registerHandler2 = _slicedToArray(_registerHandler, 2),
|
||||
handlerId = _registerHandler2[0],
|
||||
unregister = _registerHandler2[1];
|
||||
|
||||
this.handlerId = handlerId;
|
||||
this.handlerMonitor.receiveHandlerId(handlerId);
|
||||
this.handlerConnector.receiveHandlerId(handlerId);
|
||||
var globalMonitor = this.manager.getMonitor();
|
||||
var unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, {
|
||||
handlerIds: [handlerId]
|
||||
});
|
||||
this.disposable.setDisposable(new CompositeDisposable(new Disposable(unsubscribe), new Disposable(unregister)));
|
||||
}
|
||||
}, {
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
this.disposable.dispose();
|
||||
|
||||
if (this.handlerConnector) {
|
||||
this.handlerConnector.receiveHandlerId(null);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "getCurrentState",
|
||||
value: function getCurrentState() {
|
||||
if (!this.handlerConnector) {
|
||||
return {};
|
||||
}
|
||||
|
||||
var nextState = collect(this.handlerConnector.hooks, this.handlerMonitor, this.props);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
invariant(isPlainObject(nextState), 'Expected `collect` specified as the second argument to ' + '%s for %s to return a plain object of props to inject. ' + 'Instead, received %s.', containerDisplayName, displayName, nextState);
|
||||
}
|
||||
|
||||
return nextState;
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
return _jsx(DndContext.Consumer, {
|
||||
children: function children(_ref2) {
|
||||
var dragDropManager = _ref2.dragDropManager;
|
||||
|
||||
_this2.receiveDragDropManager(dragDropManager);
|
||||
|
||||
if (typeof requestAnimationFrame !== 'undefined') {
|
||||
requestAnimationFrame(function () {
|
||||
var _this2$handlerConnect;
|
||||
|
||||
return (_this2$handlerConnect = _this2.handlerConnector) === null || _this2$handlerConnect === void 0 ? void 0 : _this2$handlerConnect.reconnect();
|
||||
});
|
||||
}
|
||||
|
||||
return _jsx(Decorated, Object.assign({}, _this2.props, _this2.getCurrentState(), {
|
||||
// NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.
|
||||
ref: isRefable(Decorated) ? _this2.decoratedRef : null
|
||||
}), void 0);
|
||||
}
|
||||
}, void 0);
|
||||
}
|
||||
}, {
|
||||
key: "receiveDragDropManager",
|
||||
value: function receiveDragDropManager(dragDropManager) {
|
||||
if (this.manager !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
invariant(dragDropManager !== undefined, 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
|
||||
|
||||
if (dragDropManager === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.manager = dragDropManager;
|
||||
this.handlerMonitor = createMonitor(dragDropManager);
|
||||
this.handlerConnector = createConnector(dragDropManager.getBackend());
|
||||
this.handler = createHandler(this.handlerMonitor, this.decoratedRef);
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragDropContainer;
|
||||
}(Component);
|
||||
|
||||
_defineProperty(DragDropContainer, "DecoratedComponent", DecoratedComponent);
|
||||
|
||||
_defineProperty(DragDropContainer, "displayName", "".concat(containerDisplayName, "(").concat(displayName, ")"));
|
||||
|
||||
return hoistStatics(DragDropContainer, DecoratedComponent);
|
||||
}
|
||||
245
node_modules/react-dnd/dist/esm/decorators/disposables.js
generated
vendored
Normal file
245
node_modules/react-dnd/dist/esm/decorators/disposables.js
generated
vendored
Normal file
@@ -0,0 +1,245 @@
|
||||
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; }
|
||||
|
||||
import { isFunction, noop } from './utils';
|
||||
/**
|
||||
* Provides a set of static methods for creating Disposables.
|
||||
* @param {Function} action Action to run during the first call to dispose.
|
||||
* The action is guaranteed to be run at most once.
|
||||
*/
|
||||
|
||||
export var Disposable = /*#__PURE__*/function () {
|
||||
function Disposable(action) {
|
||||
_classCallCheck(this, Disposable);
|
||||
|
||||
_defineProperty(this, "isDisposed", false);
|
||||
|
||||
_defineProperty(this, "action", void 0);
|
||||
|
||||
this.action = isFunction(action) ? action : noop;
|
||||
}
|
||||
/** Performs the task of cleaning up resources. */
|
||||
|
||||
|
||||
_createClass(Disposable, [{
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
if (!this.isDisposed) {
|
||||
this.action();
|
||||
this.isDisposed = true;
|
||||
}
|
||||
}
|
||||
}], [{
|
||||
key: "isDisposable",
|
||||
value:
|
||||
/**
|
||||
* Gets the disposable that does nothing when disposed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Validates whether the given object is a disposable
|
||||
* @param {Object} Object to test whether it has a dispose method
|
||||
* @returns {Boolean} true if a disposable object, else false.
|
||||
*/
|
||||
function isDisposable(d) {
|
||||
return Boolean(d && isFunction(d.dispose));
|
||||
}
|
||||
}, {
|
||||
key: "_fixup",
|
||||
value: function _fixup(result) {
|
||||
return Disposable.isDisposable(result) ? result : Disposable.empty;
|
||||
}
|
||||
/**
|
||||
* Creates a disposable object that invokes the specified action when disposed.
|
||||
* @param {Function} dispose Action to run during the first call to dispose.
|
||||
* The action is guaranteed to be run at most once.
|
||||
* @return {Disposable} The disposable object that runs the given action upon disposal.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "create",
|
||||
value: function create(action) {
|
||||
return new Disposable(action);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Disposable;
|
||||
}();
|
||||
/**
|
||||
* Represents a group of disposable resources that are disposed together.
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
_defineProperty(Disposable, "empty", {
|
||||
dispose: noop
|
||||
});
|
||||
|
||||
export var CompositeDisposable = /*#__PURE__*/function () {
|
||||
function CompositeDisposable() {
|
||||
_classCallCheck(this, CompositeDisposable);
|
||||
|
||||
_defineProperty(this, "isDisposed", false);
|
||||
|
||||
_defineProperty(this, "disposables", void 0);
|
||||
|
||||
for (var _len = arguments.length, disposables = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
disposables[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
this.disposables = disposables;
|
||||
}
|
||||
/**
|
||||
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
|
||||
* @param {Any} item Disposable to add.
|
||||
*/
|
||||
|
||||
|
||||
_createClass(CompositeDisposable, [{
|
||||
key: "add",
|
||||
value: function add(item) {
|
||||
if (this.isDisposed) {
|
||||
item.dispose();
|
||||
} else {
|
||||
this.disposables.push(item);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
|
||||
* @param {Any} item Disposable to remove.
|
||||
* @returns {Boolean} true if found; false otherwise.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "remove",
|
||||
value: function remove(item) {
|
||||
var shouldDispose = false;
|
||||
|
||||
if (!this.isDisposed) {
|
||||
var idx = this.disposables.indexOf(item);
|
||||
|
||||
if (idx !== -1) {
|
||||
shouldDispose = true;
|
||||
this.disposables.splice(idx, 1);
|
||||
item.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return shouldDispose;
|
||||
}
|
||||
/**
|
||||
* Disposes all disposables in the group and removes them from the group but
|
||||
* does not dispose the CompositeDisposable.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "clear",
|
||||
value: function clear() {
|
||||
if (!this.isDisposed) {
|
||||
var len = this.disposables.length;
|
||||
var currentDisposables = new Array(len);
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
currentDisposables[i] = this.disposables[i];
|
||||
}
|
||||
|
||||
this.disposables = [];
|
||||
|
||||
for (var _i = 0; _i < len; _i++) {
|
||||
currentDisposables[_i].dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Disposes all disposables in the group and removes them from the group.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
if (!this.isDisposed) {
|
||||
this.isDisposed = true;
|
||||
var len = this.disposables.length;
|
||||
var currentDisposables = new Array(len);
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
currentDisposables[i] = this.disposables[i];
|
||||
}
|
||||
|
||||
this.disposables = [];
|
||||
|
||||
for (var _i2 = 0; _i2 < len; _i2++) {
|
||||
currentDisposables[_i2].dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return CompositeDisposable;
|
||||
}();
|
||||
/**
|
||||
* Represents a disposable resource whose underlying disposable resource can
|
||||
* be replaced by another disposable resource, causing automatic disposal of
|
||||
* the previous underlying disposable resource.
|
||||
*/
|
||||
|
||||
export var SerialDisposable = /*#__PURE__*/function () {
|
||||
function SerialDisposable() {
|
||||
_classCallCheck(this, SerialDisposable);
|
||||
|
||||
_defineProperty(this, "isDisposed", false);
|
||||
|
||||
_defineProperty(this, "current", void 0);
|
||||
}
|
||||
|
||||
_createClass(SerialDisposable, [{
|
||||
key: "getDisposable",
|
||||
value:
|
||||
/**
|
||||
* Gets the underlying disposable.
|
||||
* @returns {Any} the underlying disposable.
|
||||
*/
|
||||
function getDisposable() {
|
||||
return this.current;
|
||||
}
|
||||
}, {
|
||||
key: "setDisposable",
|
||||
value: function setDisposable(value) {
|
||||
var shouldDispose = this.isDisposed;
|
||||
|
||||
if (!shouldDispose) {
|
||||
var old = this.current;
|
||||
this.current = value;
|
||||
|
||||
if (old) {
|
||||
old.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldDispose && value) {
|
||||
value.dispose();
|
||||
}
|
||||
}
|
||||
/** Performs the task of cleaning up resources. */
|
||||
|
||||
}, {
|
||||
key: "dispose",
|
||||
value: function dispose() {
|
||||
if (!this.isDisposed) {
|
||||
this.isDisposed = true;
|
||||
var old = this.current;
|
||||
this.current = undefined;
|
||||
|
||||
if (old) {
|
||||
old.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return SerialDisposable;
|
||||
}();
|
||||
4
node_modules/react-dnd/dist/esm/decorators/index.js
generated
vendored
Normal file
4
node_modules/react-dnd/dist/esm/decorators/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './DragSource';
|
||||
export * from './DropTarget';
|
||||
export * from './DragLayer';
|
||||
export * from './types';
|
||||
1
node_modules/react-dnd/dist/esm/decorators/types.js
generated
vendored
Normal file
1
node_modules/react-dnd/dist/esm/decorators/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
71
node_modules/react-dnd/dist/esm/decorators/utils.js
generated
vendored
Normal file
71
node_modules/react-dnd/dist/esm/decorators/utils.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
export function getDecoratedComponent(instanceRef) {
|
||||
var currentRef = instanceRef.current;
|
||||
|
||||
if (currentRef == null) {
|
||||
return null;
|
||||
} else if (currentRef.decoratedRef) {
|
||||
// go through the private field in decorateHandler to avoid the invariant hit
|
||||
return currentRef.decoratedRef.current;
|
||||
} else {
|
||||
return currentRef;
|
||||
}
|
||||
}
|
||||
export function isClassComponent(Component) {
|
||||
return Component && Component.prototype && typeof Component.prototype.render === 'function';
|
||||
}
|
||||
export function isRefForwardingComponent(C) {
|
||||
var _item$$$typeof;
|
||||
|
||||
var item = C;
|
||||
return (item === null || item === void 0 ? void 0 : (_item$$$typeof = item.$$typeof) === null || _item$$$typeof === void 0 ? void 0 : _item$$$typeof.toString()) === 'Symbol(react.forward_ref)';
|
||||
}
|
||||
export function isRefable(C) {
|
||||
return isClassComponent(C) || isRefForwardingComponent(C);
|
||||
}
|
||||
export function checkDecoratorArguments(functionName, signature) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) {
|
||||
var arg = i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2];
|
||||
|
||||
if (arg && arg.prototype && arg.prototype.render) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('You seem to be applying the arguments in the wrong order. ' + "It should be ".concat(functionName, "(").concat(signature, ")(Component), not the other way around. ") + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#you-seem-to-be-applying-the-arguments-in-the-wrong-order');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export function isFunction(input) {
|
||||
return typeof input === 'function';
|
||||
}
|
||||
export function noop() {// noop
|
||||
}
|
||||
|
||||
function isObjectLike(input) {
|
||||
return _typeof(input) === 'object' && input !== null;
|
||||
}
|
||||
|
||||
export function isPlainObject(input) {
|
||||
if (!isObjectLike(input)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Object.getPrototypeOf(input) === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var proto = input;
|
||||
|
||||
while (Object.getPrototypeOf(proto) !== null) {
|
||||
proto = Object.getPrototypeOf(proto);
|
||||
}
|
||||
|
||||
return Object.getPrototypeOf(input) === proto;
|
||||
}
|
||||
export function isValidType(type, allowArray) {
|
||||
return typeof type === 'string' || _typeof(type) === 'symbol' || !!allowArray && Array.isArray(type) && type.every(function (t) {
|
||||
return isValidType(t, false);
|
||||
});
|
||||
}
|
||||
5
node_modules/react-dnd/dist/esm/hooks/index.js
generated
vendored
Normal file
5
node_modules/react-dnd/dist/esm/hooks/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './useDrag';
|
||||
export * from './useDrop';
|
||||
export * from './useDragLayer';
|
||||
export * from './useDragDropManager';
|
||||
export * from './types';
|
||||
1
node_modules/react-dnd/dist/esm/hooks/types.js
generated
vendored
Normal file
1
node_modules/react-dnd/dist/esm/hooks/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
8
node_modules/react-dnd/dist/esm/hooks/useCollectedProps.js
generated
vendored
Normal file
8
node_modules/react-dnd/dist/esm/hooks/useCollectedProps.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { useMonitorOutput } from './useMonitorOutput';
|
||||
export function useCollectedProps(collector, monitor, connector) {
|
||||
return useMonitorOutput(monitor, collector || function () {
|
||||
return {};
|
||||
}, function () {
|
||||
return connector.reconnect();
|
||||
});
|
||||
}
|
||||
48
node_modules/react-dnd/dist/esm/hooks/useCollector.js
generated
vendored
Normal file
48
node_modules/react-dnd/dist/esm/hooks/useCollector.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import equal from 'fast-deep-equal';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
|
||||
/**
|
||||
*
|
||||
* @param monitor The monitor to collect state from
|
||||
* @param collect The collecting function
|
||||
* @param onUpdate A method to invoke when updates occur
|
||||
*/
|
||||
|
||||
export function useCollector(monitor, collect, onUpdate) {
|
||||
var _useState = useState(function () {
|
||||
return collect(monitor);
|
||||
}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
collected = _useState2[0],
|
||||
setCollected = _useState2[1];
|
||||
|
||||
var updateCollected = useCallback(function () {
|
||||
var nextValue = collect(monitor); // This needs to be a deep-equality check because some monitor-collected values
|
||||
// include XYCoord objects that may be equivalent, but do not have instance equality.
|
||||
|
||||
if (!equal(collected, nextValue)) {
|
||||
setCollected(nextValue);
|
||||
|
||||
if (onUpdate) {
|
||||
onUpdate();
|
||||
}
|
||||
}
|
||||
}, [collected, monitor, onUpdate]); // update the collected properties after react renders.
|
||||
// Note that the "Dustbin Stress Test" fails if this is not
|
||||
// done when the component updates
|
||||
|
||||
useIsomorphicLayoutEffect(updateCollected);
|
||||
return [collected, updateCollected];
|
||||
}
|
||||
84
node_modules/react-dnd/dist/esm/hooks/useDrag/DragSourceImpl.js
generated
vendored
Normal file
84
node_modules/react-dnd/dist/esm/hooks/useDrag/DragSourceImpl.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
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; }
|
||||
|
||||
export var DragSourceImpl = /*#__PURE__*/function () {
|
||||
function DragSourceImpl(spec, monitor, connector) {
|
||||
_classCallCheck(this, DragSourceImpl);
|
||||
|
||||
_defineProperty(this, "spec", void 0);
|
||||
|
||||
_defineProperty(this, "monitor", void 0);
|
||||
|
||||
_defineProperty(this, "connector", void 0);
|
||||
|
||||
this.spec = spec;
|
||||
this.monitor = monitor;
|
||||
this.connector = connector;
|
||||
}
|
||||
|
||||
_createClass(DragSourceImpl, [{
|
||||
key: "beginDrag",
|
||||
value: function beginDrag() {
|
||||
var _result;
|
||||
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
var result = null;
|
||||
|
||||
if (_typeof(spec.item) === 'object') {
|
||||
result = spec.item;
|
||||
} else if (typeof spec.item === 'function') {
|
||||
result = spec.item(monitor);
|
||||
} else {
|
||||
result = {};
|
||||
}
|
||||
|
||||
return (_result = result) !== null && _result !== void 0 ? _result : null;
|
||||
}
|
||||
}, {
|
||||
key: "canDrag",
|
||||
value: function canDrag() {
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
|
||||
if (typeof spec.canDrag === 'boolean') {
|
||||
return spec.canDrag;
|
||||
} else if (typeof spec.canDrag === 'function') {
|
||||
return spec.canDrag(monitor);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isDragging",
|
||||
value: function isDragging(globalMonitor, target) {
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
var isDragging = spec.isDragging;
|
||||
return isDragging ? isDragging(monitor) : target === globalMonitor.getSourceId();
|
||||
}
|
||||
}, {
|
||||
key: "endDrag",
|
||||
value: function endDrag() {
|
||||
var spec = this.spec;
|
||||
var monitor = this.monitor;
|
||||
var connector = this.connector;
|
||||
var end = spec.end;
|
||||
|
||||
if (end) {
|
||||
end(monitor.getItem(), monitor);
|
||||
}
|
||||
|
||||
connector.reconnect();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragSourceImpl;
|
||||
}();
|
||||
11
node_modules/react-dnd/dist/esm/hooks/useDrag/connectors.js
generated
vendored
Normal file
11
node_modules/react-dnd/dist/esm/hooks/useDrag/connectors.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useMemo } from 'react';
|
||||
export function useConnectDragSource(connector) {
|
||||
return useMemo(function () {
|
||||
return connector.hooks.dragSource();
|
||||
}, [connector]);
|
||||
}
|
||||
export function useConnectDragPreview(connector) {
|
||||
return useMemo(function () {
|
||||
return connector.hooks.dragPreview();
|
||||
}, [connector]);
|
||||
}
|
||||
1
node_modules/react-dnd/dist/esm/hooks/useDrag/index.js
generated
vendored
Normal file
1
node_modules/react-dnd/dist/esm/hooks/useDrag/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './useDrag';
|
||||
21
node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.js
generated
vendored
Normal file
21
node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { useRegisteredDragSource } from './useRegisteredDragSource';
|
||||
import { useOptionalFactory } from '../useOptionalFactory';
|
||||
import { useDragSourceMonitor } from './useDragSourceMonitor';
|
||||
import { useDragSourceConnector } from './useDragSourceConnector';
|
||||
import { useCollectedProps } from '../useCollectedProps';
|
||||
import { useConnectDragPreview, useConnectDragSource } from './connectors';
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
/**
|
||||
* useDragSource hook
|
||||
* @param sourceSpec The drag source specification (object or function, function preferred)
|
||||
* @param deps The memoization deps array to use when evaluating spec changes
|
||||
*/
|
||||
|
||||
export function useDrag(specArg, deps) {
|
||||
var spec = useOptionalFactory(specArg, deps);
|
||||
invariant(!spec.begin, "useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");
|
||||
var monitor = useDragSourceMonitor();
|
||||
var connector = useDragSourceConnector(spec.options, spec.previewOptions);
|
||||
useRegisteredDragSource(spec, monitor, connector);
|
||||
return [useCollectedProps(spec.collect, monitor, connector), useConnectDragSource(connector), useConnectDragPreview(connector)];
|
||||
}
|
||||
11
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragSource.js
generated
vendored
Normal file
11
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragSource.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { DragSourceImpl } from './DragSourceImpl';
|
||||
export function useDragSource(spec, monitor, connector) {
|
||||
var handler = useMemo(function () {
|
||||
return new DragSourceImpl(spec, monitor, connector);
|
||||
}, [monitor, connector]);
|
||||
useEffect(function () {
|
||||
handler.spec = spec;
|
||||
}, [spec]);
|
||||
return handler;
|
||||
}
|
||||
25
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragSourceConnector.js
generated
vendored
Normal file
25
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragSourceConnector.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { useMemo } from 'react';
|
||||
import { SourceConnector } from '../../internals';
|
||||
import { useDragDropManager } from '../useDragDropManager';
|
||||
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';
|
||||
export function useDragSourceConnector(dragSourceOptions, dragPreviewOptions) {
|
||||
var manager = useDragDropManager();
|
||||
var connector = useMemo(function () {
|
||||
return new SourceConnector(manager.getBackend());
|
||||
}, [manager]);
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
connector.dragSourceOptions = dragSourceOptions || null;
|
||||
connector.reconnect();
|
||||
return function () {
|
||||
return connector.disconnectDragSource();
|
||||
};
|
||||
}, [connector, dragSourceOptions]);
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
connector.dragPreviewOptions = dragPreviewOptions || null;
|
||||
connector.reconnect();
|
||||
return function () {
|
||||
return connector.disconnectDragPreview();
|
||||
};
|
||||
}, [connector, dragPreviewOptions]);
|
||||
return connector;
|
||||
}
|
||||
9
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragSourceMonitor.js
generated
vendored
Normal file
9
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragSourceMonitor.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useMemo } from 'react';
|
||||
import { DragSourceMonitorImpl } from '../../internals';
|
||||
import { useDragDropManager } from '../useDragDropManager';
|
||||
export function useDragSourceMonitor() {
|
||||
var manager = useDragDropManager();
|
||||
return useMemo(function () {
|
||||
return new DragSourceMonitorImpl(manager);
|
||||
}, [manager]);
|
||||
}
|
||||
9
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragType.js
generated
vendored
Normal file
9
node_modules/react-dnd/dist/esm/hooks/useDrag/useDragType.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { useMemo } from 'react';
|
||||
export function useDragType(spec) {
|
||||
return useMemo(function () {
|
||||
var result = spec.type;
|
||||
invariant(result != null, 'spec.type must be defined');
|
||||
return result;
|
||||
}, [spec]);
|
||||
}
|
||||
34
node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.js
generated
vendored
Normal file
34
node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import { registerSource } from '../../internals';
|
||||
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';
|
||||
import { useDragSource } from './useDragSource';
|
||||
import { useDragDropManager } from '../useDragDropManager';
|
||||
import { useDragType } from './useDragType';
|
||||
export function useRegisteredDragSource(spec, monitor, connector) {
|
||||
var manager = useDragDropManager();
|
||||
var handler = useDragSource(spec, monitor, connector);
|
||||
var itemType = useDragType(spec);
|
||||
useIsomorphicLayoutEffect(function registerDragSource() {
|
||||
if (itemType != null) {
|
||||
var _registerSource = registerSource(itemType, handler, manager),
|
||||
_registerSource2 = _slicedToArray(_registerSource, 2),
|
||||
handlerId = _registerSource2[0],
|
||||
unregister = _registerSource2[1];
|
||||
|
||||
monitor.receiveHandlerId(handlerId);
|
||||
connector.receiveHandlerId(handlerId);
|
||||
return unregister;
|
||||
}
|
||||
}, [manager, monitor, connector, handler, itemType]);
|
||||
}
|
||||
14
node_modules/react-dnd/dist/esm/hooks/useDragDropManager.js
generated
vendored
Normal file
14
node_modules/react-dnd/dist/esm/hooks/useDragDropManager.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useContext } from 'react';
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { DndContext } from '../core';
|
||||
/**
|
||||
* A hook to retrieve the DragDropManager from Context
|
||||
*/
|
||||
|
||||
export function useDragDropManager() {
|
||||
var _useContext = useContext(DndContext),
|
||||
dragDropManager = _useContext.dragDropManager;
|
||||
|
||||
invariant(dragDropManager != null, 'Expected drag drop context');
|
||||
return dragDropManager;
|
||||
}
|
||||
37
node_modules/react-dnd/dist/esm/hooks/useDragLayer.js
generated
vendored
Normal file
37
node_modules/react-dnd/dist/esm/hooks/useDragLayer.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useDragDropManager } from './useDragDropManager';
|
||||
import { useCollector } from './useCollector';
|
||||
/**
|
||||
* useDragLayer Hook
|
||||
* @param collector The property collector
|
||||
*/
|
||||
|
||||
export function useDragLayer(collect) {
|
||||
var dragDropManager = useDragDropManager();
|
||||
var monitor = dragDropManager.getMonitor();
|
||||
|
||||
var _useCollector = useCollector(monitor, collect),
|
||||
_useCollector2 = _slicedToArray(_useCollector, 2),
|
||||
collected = _useCollector2[0],
|
||||
updateCollected = _useCollector2[1];
|
||||
|
||||
useEffect(function () {
|
||||
return monitor.subscribeToOffsetChange(updateCollected);
|
||||
});
|
||||
useEffect(function () {
|
||||
return monitor.subscribeToStateChange(updateCollected);
|
||||
});
|
||||
return collected;
|
||||
}
|
||||
51
node_modules/react-dnd/dist/esm/hooks/useDrop/DropTargetImpl.js
generated
vendored
Normal file
51
node_modules/react-dnd/dist/esm/hooks/useDrop/DropTargetImpl.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
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; }
|
||||
|
||||
export 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;
|
||||
}();
|
||||
6
node_modules/react-dnd/dist/esm/hooks/useDrop/connectors.js
generated
vendored
Normal file
6
node_modules/react-dnd/dist/esm/hooks/useDrop/connectors.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { useMemo } from 'react';
|
||||
export function useConnectDropTarget(connector) {
|
||||
return useMemo(function () {
|
||||
return connector.hooks.dropTarget();
|
||||
}, [connector]);
|
||||
}
|
||||
1
node_modules/react-dnd/dist/esm/hooks/useDrop/index.js
generated
vendored
Normal file
1
node_modules/react-dnd/dist/esm/hooks/useDrop/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './useDrop';
|
||||
15
node_modules/react-dnd/dist/esm/hooks/useDrop/useAccept.js
generated
vendored
Normal file
15
node_modules/react-dnd/dist/esm/hooks/useDrop/useAccept.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { useMemo } from 'react';
|
||||
/**
|
||||
* Internal utility hook to get an array-version of spec.accept.
|
||||
* The main utility here is that we aren't creating a new array on every render if a non-array spec.accept is passed in.
|
||||
* @param spec
|
||||
*/
|
||||
|
||||
export function useAccept(spec) {
|
||||
var accept = spec.accept;
|
||||
return useMemo(function () {
|
||||
invariant(spec.accept != null, 'accept must be defined');
|
||||
return Array.isArray(accept) ? accept : [accept];
|
||||
}, [accept]);
|
||||
}
|
||||
19
node_modules/react-dnd/dist/esm/hooks/useDrop/useDrop.js
generated
vendored
Normal file
19
node_modules/react-dnd/dist/esm/hooks/useDrop/useDrop.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useRegisteredDropTarget } from './useRegisteredDropTarget';
|
||||
import { useOptionalFactory } from '../useOptionalFactory';
|
||||
import { useDropTargetMonitor } from './useDropTargetMonitor';
|
||||
import { useDropTargetConnector } from './useDropTargetConnector';
|
||||
import { useCollectedProps } from '../useCollectedProps';
|
||||
import { useConnectDropTarget } from './connectors';
|
||||
/**
|
||||
* useDropTarget Hook
|
||||
* @param spec The drop target specification (object or function, function preferred)
|
||||
* @param deps The memoization deps array to use when evaluating spec changes
|
||||
*/
|
||||
|
||||
export function useDrop(specArg, deps) {
|
||||
var spec = useOptionalFactory(specArg, deps);
|
||||
var monitor = useDropTargetMonitor();
|
||||
var connector = useDropTargetConnector(spec.options);
|
||||
useRegisteredDropTarget(spec, monitor, connector);
|
||||
return [useCollectedProps(spec.collect, monitor, connector), useConnectDropTarget(connector)];
|
||||
}
|
||||
11
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTarget.js
generated
vendored
Normal file
11
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTarget.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { DropTargetImpl } from './DropTargetImpl';
|
||||
export function useDropTarget(spec, monitor) {
|
||||
var dropTarget = useMemo(function () {
|
||||
return new DropTargetImpl(spec, monitor);
|
||||
}, [monitor]);
|
||||
useEffect(function () {
|
||||
dropTarget.spec = spec;
|
||||
}, [spec]);
|
||||
return dropTarget;
|
||||
}
|
||||
18
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTargetConnector.js
generated
vendored
Normal file
18
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTargetConnector.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useMemo } from 'react';
|
||||
import { TargetConnector } from '../../internals';
|
||||
import { useDragDropManager } from '../useDragDropManager';
|
||||
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';
|
||||
export function useDropTargetConnector(options) {
|
||||
var manager = useDragDropManager();
|
||||
var connector = useMemo(function () {
|
||||
return new TargetConnector(manager.getBackend());
|
||||
}, [manager]);
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
connector.dropTargetOptions = options || null;
|
||||
connector.reconnect();
|
||||
return function () {
|
||||
return connector.disconnectDropTarget();
|
||||
};
|
||||
}, [options]);
|
||||
return connector;
|
||||
}
|
||||
9
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTargetMonitor.js
generated
vendored
Normal file
9
node_modules/react-dnd/dist/esm/hooks/useDrop/useDropTargetMonitor.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useMemo } from 'react';
|
||||
import { DropTargetMonitorImpl } from '../../internals';
|
||||
import { useDragDropManager } from '../useDragDropManager';
|
||||
export function useDropTargetMonitor() {
|
||||
var manager = useDragDropManager();
|
||||
return useMemo(function () {
|
||||
return new DropTargetMonitorImpl(manager);
|
||||
}, [manager]);
|
||||
}
|
||||
34
node_modules/react-dnd/dist/esm/hooks/useDrop/useRegisteredDropTarget.js
generated
vendored
Normal file
34
node_modules/react-dnd/dist/esm/hooks/useDrop/useRegisteredDropTarget.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import { registerTarget } from '../../internals';
|
||||
import { useDragDropManager } from '../useDragDropManager';
|
||||
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';
|
||||
import { useAccept } from './useAccept';
|
||||
import { useDropTarget } from './useDropTarget';
|
||||
export function useRegisteredDropTarget(spec, monitor, connector) {
|
||||
var manager = useDragDropManager();
|
||||
var dropTarget = useDropTarget(spec, monitor);
|
||||
var accept = useAccept(spec);
|
||||
useIsomorphicLayoutEffect(function registerDropTarget() {
|
||||
var _registerTarget = registerTarget(accept, dropTarget, manager),
|
||||
_registerTarget2 = _slicedToArray(_registerTarget, 2),
|
||||
handlerId = _registerTarget2[0],
|
||||
unregister = _registerTarget2[1];
|
||||
|
||||
monitor.receiveHandlerId(handlerId);
|
||||
connector.receiveHandlerId(handlerId);
|
||||
return unregister;
|
||||
}, [manager, monitor, dropTarget, connector, accept.map(function (a) {
|
||||
return a.toString();
|
||||
}).join('|')]);
|
||||
}
|
||||
3
node_modules/react-dnd/dist/esm/hooks/useIsomorphicLayoutEffect.js
generated
vendored
Normal file
3
node_modules/react-dnd/dist/esm/hooks/useIsomorphicLayoutEffect.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { useLayoutEffect, useEffect } from 'react'; // suppress the useLayoutEffect warning on server side.
|
||||
|
||||
export var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
||||
33
node_modules/react-dnd/dist/esm/hooks/useMonitorOutput.js
generated
vendored
Normal file
33
node_modules/react-dnd/dist/esm/hooks/useMonitorOutput.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
|
||||
import { useCollector } from './useCollector';
|
||||
export function useMonitorOutput(monitor, collect, onCollect) {
|
||||
var _useCollector = useCollector(monitor, collect, onCollect),
|
||||
_useCollector2 = _slicedToArray(_useCollector, 2),
|
||||
collected = _useCollector2[0],
|
||||
updateCollected = _useCollector2[1];
|
||||
|
||||
useIsomorphicLayoutEffect(function subscribeToMonitorStateChange() {
|
||||
var handlerId = monitor.getHandlerId();
|
||||
|
||||
if (handlerId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
return monitor.subscribeToStateChange(updateCollected, {
|
||||
handlerIds: [handlerId]
|
||||
});
|
||||
}, [monitor, updateCollected]);
|
||||
return collected;
|
||||
}
|
||||
24
node_modules/react-dnd/dist/esm/hooks/useOptionalFactory.js
generated
vendored
Normal file
24
node_modules/react-dnd/dist/esm/hooks/useOptionalFactory.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
import { useMemo } from 'react';
|
||||
export function useOptionalFactory(arg, deps) {
|
||||
var memoDeps = _toConsumableArray(deps || []);
|
||||
|
||||
if (deps == null && typeof arg !== 'function') {
|
||||
memoDeps.push(arg);
|
||||
}
|
||||
|
||||
return useMemo(function () {
|
||||
return typeof arg === 'function' ? arg() : arg;
|
||||
}, memoDeps);
|
||||
}
|
||||
4
node_modules/react-dnd/dist/esm/index.js
generated
vendored
Normal file
4
node_modules/react-dnd/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './types';
|
||||
export * from './core';
|
||||
export * from './decorators';
|
||||
export * from './hooks';
|
||||
154
node_modules/react-dnd/dist/esm/internals/DragSourceMonitorImpl.js
generated
vendored
Normal file
154
node_modules/react-dnd/dist/esm/internals/DragSourceMonitorImpl.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
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; }
|
||||
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
var isCallingCanDrag = false;
|
||||
var isCallingIsDragging = false;
|
||||
export var DragSourceMonitorImpl = /*#__PURE__*/function () {
|
||||
function DragSourceMonitorImpl(manager) {
|
||||
_classCallCheck(this, DragSourceMonitorImpl);
|
||||
|
||||
_defineProperty(this, "internalMonitor", void 0);
|
||||
|
||||
_defineProperty(this, "sourceId", null);
|
||||
|
||||
this.internalMonitor = manager.getMonitor();
|
||||
}
|
||||
|
||||
_createClass(DragSourceMonitorImpl, [{
|
||||
key: "receiveHandlerId",
|
||||
value: function receiveHandlerId(sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
}, {
|
||||
key: "getHandlerId",
|
||||
value: function getHandlerId() {
|
||||
return this.sourceId;
|
||||
}
|
||||
}, {
|
||||
key: "canDrag",
|
||||
value: function canDrag() {
|
||||
invariant(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
||||
|
||||
try {
|
||||
isCallingCanDrag = true;
|
||||
return this.internalMonitor.canDragSource(this.sourceId);
|
||||
} finally {
|
||||
isCallingCanDrag = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isDragging",
|
||||
value: function isDragging() {
|
||||
if (!this.sourceId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
invariant(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
||||
|
||||
try {
|
||||
isCallingIsDragging = true;
|
||||
return this.internalMonitor.isDraggingSource(this.sourceId);
|
||||
} finally {
|
||||
isCallingIsDragging = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "subscribeToStateChange",
|
||||
value: function subscribeToStateChange(listener, options) {
|
||||
return this.internalMonitor.subscribeToStateChange(listener, options);
|
||||
}
|
||||
}, {
|
||||
key: "isDraggingSource",
|
||||
value: function isDraggingSource(sourceId) {
|
||||
return this.internalMonitor.isDraggingSource(sourceId);
|
||||
}
|
||||
}, {
|
||||
key: "isOverTarget",
|
||||
value: function isOverTarget(targetId, options) {
|
||||
return this.internalMonitor.isOverTarget(targetId, options);
|
||||
}
|
||||
}, {
|
||||
key: "getTargetIds",
|
||||
value: function getTargetIds() {
|
||||
return this.internalMonitor.getTargetIds();
|
||||
}
|
||||
}, {
|
||||
key: "isSourcePublic",
|
||||
value: function isSourcePublic() {
|
||||
return this.internalMonitor.isSourcePublic();
|
||||
}
|
||||
}, {
|
||||
key: "getSourceId",
|
||||
value: function getSourceId() {
|
||||
return this.internalMonitor.getSourceId();
|
||||
}
|
||||
}, {
|
||||
key: "subscribeToOffsetChange",
|
||||
value: function subscribeToOffsetChange(listener) {
|
||||
return this.internalMonitor.subscribeToOffsetChange(listener);
|
||||
}
|
||||
}, {
|
||||
key: "canDragSource",
|
||||
value: function canDragSource(sourceId) {
|
||||
return this.internalMonitor.canDragSource(sourceId);
|
||||
}
|
||||
}, {
|
||||
key: "canDropOnTarget",
|
||||
value: function canDropOnTarget(targetId) {
|
||||
return this.internalMonitor.canDropOnTarget(targetId);
|
||||
}
|
||||
}, {
|
||||
key: "getItemType",
|
||||
value: function getItemType() {
|
||||
return this.internalMonitor.getItemType();
|
||||
}
|
||||
}, {
|
||||
key: "getItem",
|
||||
value: function getItem() {
|
||||
return this.internalMonitor.getItem();
|
||||
}
|
||||
}, {
|
||||
key: "getDropResult",
|
||||
value: function getDropResult() {
|
||||
return this.internalMonitor.getDropResult();
|
||||
}
|
||||
}, {
|
||||
key: "didDrop",
|
||||
value: function didDrop() {
|
||||
return this.internalMonitor.didDrop();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialClientOffset",
|
||||
value: function getInitialClientOffset() {
|
||||
return this.internalMonitor.getInitialClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialSourceClientOffset",
|
||||
value: function getInitialSourceClientOffset() {
|
||||
return this.internalMonitor.getInitialSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getSourceClientOffset",
|
||||
value: function getSourceClientOffset() {
|
||||
return this.internalMonitor.getSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getClientOffset",
|
||||
value: function getClientOffset() {
|
||||
return this.internalMonitor.getClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getDifferenceFromInitialOffset",
|
||||
value: function getDifferenceFromInitialOffset() {
|
||||
return this.internalMonitor.getDifferenceFromInitialOffset();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DragSourceMonitorImpl;
|
||||
}();
|
||||
113
node_modules/react-dnd/dist/esm/internals/DropTargetMonitorImpl.js
generated
vendored
Normal file
113
node_modules/react-dnd/dist/esm/internals/DropTargetMonitorImpl.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
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; }
|
||||
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
var isCallingCanDrop = false;
|
||||
export var DropTargetMonitorImpl = /*#__PURE__*/function () {
|
||||
function DropTargetMonitorImpl(manager) {
|
||||
_classCallCheck(this, DropTargetMonitorImpl);
|
||||
|
||||
_defineProperty(this, "internalMonitor", void 0);
|
||||
|
||||
_defineProperty(this, "targetId", null);
|
||||
|
||||
this.internalMonitor = manager.getMonitor();
|
||||
}
|
||||
|
||||
_createClass(DropTargetMonitorImpl, [{
|
||||
key: "receiveHandlerId",
|
||||
value: function receiveHandlerId(targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
}, {
|
||||
key: "getHandlerId",
|
||||
value: function getHandlerId() {
|
||||
return this.targetId;
|
||||
}
|
||||
}, {
|
||||
key: "subscribeToStateChange",
|
||||
value: function subscribeToStateChange(listener, options) {
|
||||
return this.internalMonitor.subscribeToStateChange(listener, options);
|
||||
}
|
||||
}, {
|
||||
key: "canDrop",
|
||||
value: function canDrop() {
|
||||
// Cut out early if the target id has not been set. This should prevent errors
|
||||
// where the user has an older version of dnd-core like in
|
||||
// https://github.com/react-dnd/react-dnd/issues/1310
|
||||
if (!this.targetId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');
|
||||
|
||||
try {
|
||||
isCallingCanDrop = true;
|
||||
return this.internalMonitor.canDropOnTarget(this.targetId);
|
||||
} finally {
|
||||
isCallingCanDrop = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isOver",
|
||||
value: function isOver(options) {
|
||||
if (!this.targetId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.internalMonitor.isOverTarget(this.targetId, options);
|
||||
}
|
||||
}, {
|
||||
key: "getItemType",
|
||||
value: function getItemType() {
|
||||
return this.internalMonitor.getItemType();
|
||||
}
|
||||
}, {
|
||||
key: "getItem",
|
||||
value: function getItem() {
|
||||
return this.internalMonitor.getItem();
|
||||
}
|
||||
}, {
|
||||
key: "getDropResult",
|
||||
value: function getDropResult() {
|
||||
return this.internalMonitor.getDropResult();
|
||||
}
|
||||
}, {
|
||||
key: "didDrop",
|
||||
value: function didDrop() {
|
||||
return this.internalMonitor.didDrop();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialClientOffset",
|
||||
value: function getInitialClientOffset() {
|
||||
return this.internalMonitor.getInitialClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getInitialSourceClientOffset",
|
||||
value: function getInitialSourceClientOffset() {
|
||||
return this.internalMonitor.getInitialSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getSourceClientOffset",
|
||||
value: function getSourceClientOffset() {
|
||||
return this.internalMonitor.getSourceClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getClientOffset",
|
||||
value: function getClientOffset() {
|
||||
return this.internalMonitor.getClientOffset();
|
||||
}
|
||||
}, {
|
||||
key: "getDifferenceFromInitialOffset",
|
||||
value: function getDifferenceFromInitialOffset() {
|
||||
return this.internalMonitor.getDifferenceFromInitialOffset();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DropTargetMonitorImpl;
|
||||
}();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user