Completely updated React, fixed #11, (hopefully)
This commit is contained in:
		
							
								
								
									
										49
									
								
								goTorrentWebUI/node_modules/react-grid-layout/build/components/WidthProvider.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										49
									
								
								goTorrentWebUI/node_modules/react-grid-layout/build/components/WidthProvider.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,23 +1,27 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
exports.__esModule = true;
 | 
			
		||||
 | 
			
		||||
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; };
 | 
			
		||||
 | 
			
		||||
var _react = require('react');
 | 
			
		||||
exports.default = WidthProvider;
 | 
			
		||||
 | 
			
		||||
var _react = require("react");
 | 
			
		||||
 | 
			
		||||
var _react2 = _interopRequireDefault(_react);
 | 
			
		||||
 | 
			
		||||
var _propTypes = require('prop-types');
 | 
			
		||||
var _propTypes = require("prop-types");
 | 
			
		||||
 | 
			
		||||
var _propTypes2 = _interopRequireDefault(_propTypes);
 | 
			
		||||
 | 
			
		||||
var _reactDom = require('react-dom');
 | 
			
		||||
var _reactDom = require("react-dom");
 | 
			
		||||
 | 
			
		||||
var _reactDom2 = _interopRequireDefault(_reactDom);
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
 | 
			
		||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
 | 
			
		||||
 | 
			
		||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
			
		||||
 | 
			
		||||
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; }
 | 
			
		||||
@@ -27,16 +31,16 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
 | 
			
		||||
/*
 | 
			
		||||
 * A simple HOC that provides facility for listening to container resizes.
 | 
			
		||||
 */
 | 
			
		||||
var WidthProvider = function WidthProvider(ComposedComponent) {
 | 
			
		||||
function WidthProvider(ComposedComponent) {
 | 
			
		||||
  var _class, _temp2;
 | 
			
		||||
 | 
			
		||||
  return _temp2 = _class = function (_React$Component) {
 | 
			
		||||
    _inherits(_class, _React$Component);
 | 
			
		||||
    _inherits(WidthProvider, _React$Component);
 | 
			
		||||
 | 
			
		||||
    function _class() {
 | 
			
		||||
    function WidthProvider() {
 | 
			
		||||
      var _temp, _this, _ret;
 | 
			
		||||
 | 
			
		||||
      _classCallCheck(this, _class);
 | 
			
		||||
      _classCallCheck(this, WidthProvider);
 | 
			
		||||
 | 
			
		||||
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
 | 
			
		||||
        args[_key] = arguments[_key];
 | 
			
		||||
@@ -44,37 +48,42 @@ var WidthProvider = function WidthProvider(ComposedComponent) {
 | 
			
		||||
 | 
			
		||||
      return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
 | 
			
		||||
        width: 1280
 | 
			
		||||
      }, _this.mounted = false, _this.onWindowResize = function (_event) {
 | 
			
		||||
      }, _this.mounted = false, _this.onWindowResize = function () {
 | 
			
		||||
        if (!_this.mounted) return;
 | 
			
		||||
        // eslint-disable-next-line
 | 
			
		||||
        var node = _reactDom2.default.findDOMNode(_this); // Flow casts this to Text | Element
 | 
			
		||||
        if (node instanceof HTMLElement) _this.setState({ width: node.offsetWidth });
 | 
			
		||||
      }, _temp), _possibleConstructorReturn(_this, _ret);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _class.prototype.componentDidMount = function componentDidMount() {
 | 
			
		||||
    WidthProvider.prototype.componentDidMount = function componentDidMount() {
 | 
			
		||||
      this.mounted = true;
 | 
			
		||||
 | 
			
		||||
      window.addEventListener('resize', this.onWindowResize);
 | 
			
		||||
      window.addEventListener("resize", this.onWindowResize);
 | 
			
		||||
      // Call to properly set the breakpoint and resize the elements.
 | 
			
		||||
      // Note that if you're doing a full-width element, this can get a little wonky if a scrollbar
 | 
			
		||||
      // appears because of the grid. In that case, fire your own resize event, or set `overflow: scroll` on your body.
 | 
			
		||||
      this.onWindowResize();
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _class.prototype.componentWillUnmount = function componentWillUnmount() {
 | 
			
		||||
    WidthProvider.prototype.componentWillUnmount = function componentWillUnmount() {
 | 
			
		||||
      this.mounted = false;
 | 
			
		||||
      window.removeEventListener('resize', this.onWindowResize);
 | 
			
		||||
      window.removeEventListener("resize", this.onWindowResize);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _class.prototype.render = function render() {
 | 
			
		||||
      if (this.props.measureBeforeMount && !this.mounted) {
 | 
			
		||||
        return _react2.default.createElement('div', { className: this.props.className, style: this.props.style });
 | 
			
		||||
    WidthProvider.prototype.render = function render() {
 | 
			
		||||
      var _props = this.props,
 | 
			
		||||
          measureBeforeMount = _props.measureBeforeMount,
 | 
			
		||||
          rest = _objectWithoutProperties(_props, ["measureBeforeMount"]);
 | 
			
		||||
 | 
			
		||||
      if (measureBeforeMount && !this.mounted) {
 | 
			
		||||
        return _react2.default.createElement("div", { className: this.props.className, style: this.props.style });
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return _react2.default.createElement(ComposedComponent, _extends({}, this.props, this.state));
 | 
			
		||||
      return _react2.default.createElement(ComposedComponent, _extends({}, rest, this.state));
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    return _class;
 | 
			
		||||
    return WidthProvider;
 | 
			
		||||
  }(_react2.default.Component), _class.defaultProps = {
 | 
			
		||||
    measureBeforeMount: false
 | 
			
		||||
  }, _class.propTypes = {
 | 
			
		||||
@@ -82,6 +91,4 @@ var WidthProvider = function WidthProvider(ComposedComponent) {
 | 
			
		||||
    // rendering, to prevent any unsightly resizing.
 | 
			
		||||
    measureBeforeMount: _propTypes2.default.bool
 | 
			
		||||
  }, _temp2;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.default = WidthProvider;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user