Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
var React = require("react");
var cloneWithProps = require("react/lib/cloneWithProps");
var utils = require("./utils");
var Draggable = require("react-draggable");
var Resizable = require("react-resizable").Resizable;
var PureDeepRenderMixin = require("./mixins/PureDeepRenderMixin");
/**
* An individual item within a ReactGridLayout.
*/
var GridItem = React.createClass({
displayName: "GridItem",
mixins: [PureDeepRenderMixin],
propTypes: {
// General grid attributes
cols: React.PropTypes.number.isRequired,
containerWidth: React.PropTypes.number.isRequired,
rowHeight: React.PropTypes.number.isRequired,
margin: React.PropTypes.array.isRequired,
'use strict';
var React = require('react');
var Resizable = require('react-resizable').Resizable;
var _ = require('../underscore_ext');
// Styles
require('./ResizeOverlay.css');
var max = (x, y) => x > y ? x : y;
var minWidthSize = (minWidth, {width, height}) => ({width: max(minWidth, width), height});
class ResizeOverlay extends React.Component {
state = {zooming: false};
onResizeStart = () => {
var {width, height} = this.props,
minWidth = this.props.minWidth();
this.setState({zooming: true, zoomSize: {width, height}, minWidth});
};
minW = _props6.minW,
minH = _props6.minH,
maxW = _props6.maxW,
maxH = _props6.maxH;
// This is the max possible width - doesn't go to infinity because of the width of the window
var maxWidth = this.calcPosition(0, 0, cols - x, 0).width;
// Calculate min/max constraints using our min & maxes
var mins = this.calcPosition(0, 0, minW, minH);
var maxes = this.calcPosition(0, 0, maxW, maxH);
var minConstraints = [mins.width, mins.height];
var maxConstraints = [Math.min(maxes.width, maxWidth), Math.min(maxes.height, Infinity)];
return _react2.default.createElement(
_reactResizable.Resizable,
{
width: position.width,
height: position.height,
minConstraints: minConstraints,
maxConstraints: maxConstraints,
onResizeStop: this.onResizeHandler("onResizeStop"),
onResizeStart: this.onResizeHandler("onResizeStart"),
onResize: this.onResizeHandler("onResize")
},
child
);
};