GridDropTarget.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  3. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6. /**
  7. * Licensed Materials - Property of IBM
  8. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019
  9. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. */
  11. define(['react', 'prop-types'], function (React, PropTypes) {
  12. var _class, _temp;
  13. return _temp = _class = function (_React$Component) {
  14. _inherits(GridDropTarget, _React$Component);
  15. function GridDropTarget(props) {
  16. _classCallCheck(this, GridDropTarget);
  17. var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
  18. _this.ref = React.createRef();
  19. return _this;
  20. }
  21. GridDropTarget.prototype.componentDidMount = function componentDidMount() {
  22. this.props.dndManager.registerElement(this, this.ref.current);
  23. };
  24. GridDropTarget.prototype.componentWillUnmount = function componentWillUnmount() {
  25. this.props.dndManager.deregisterElement(this.ref.current);
  26. };
  27. GridDropTarget.prototype.render = function render() {
  28. var props = _extends({}, this.props);
  29. delete props.dndManager;
  30. return React.createElement('div', _extends({ ref: this.ref }, props));
  31. };
  32. return GridDropTarget;
  33. }(React.Component), _class.propTypes = {
  34. dndManager: PropTypes.any
  35. }, _temp;
  36. });
  37. //# sourceMappingURL=GridDropTarget.js.map