react-grid-layout 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/GridItem.js CHANGED
@@ -1,542 +1,656 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _react = _interopRequireDefault(require("react"));
11
-
12
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
9
  var _reactDraggable = require("react-draggable");
15
-
16
10
  var _reactResizable = require("react-resizable");
17
-
18
11
  var _utils = require("./utils");
19
-
20
12
  var _calculateUtils = require("./calculateUtils");
21
-
22
13
  var _ReactGridLayoutPropTypes = require("./ReactGridLayoutPropTypes");
23
-
24
14
  var _clsx = _interopRequireDefault(require("clsx"));
25
-
26
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
-
30
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
-
32
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
- 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); } }
35
-
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
-
38
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
-
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
-
42
- 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); }; }
43
-
44
- 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); }
45
-
46
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
-
48
- 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; } }
49
-
50
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
-
52
- 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; }
53
-
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
+ /*:: import type { Element as ReactElement, Node as ReactNode } from "react";*/
20
+ /*:: import type {
21
+ ReactDraggableCallbackData,
22
+ GridDragEvent,
23
+ GridResizeEvent,
24
+ DroppingPosition,
25
+ Position
26
+ } from "./utils";*/
27
+ /*:: import type { PositionParams } from "./calculateUtils";*/
28
+ /*:: import type {
29
+ ResizeHandleAxis,
30
+ ResizeHandle,
31
+ ReactRef
32
+ } from "./ReactGridLayoutPropTypes";*/
33
+ /*:: type PartialPosition = { top: number, left: number };*/
34
+ /*:: type GridItemCallback<Data: GridDragEvent | GridResizeEvent> = (
35
+ i: string,
36
+ w: number,
37
+ h: number,
38
+ Data
39
+ ) => void;*/
40
+ /*:: type GridItemResizeCallback = (
41
+ e: Event,
42
+ data: ResizeCallbackData,
43
+ position: Position
44
+ ) => void;*/
45
+ /*:: type ResizeCallbackData = {
46
+ node: HTMLElement,
47
+ size: Position,
48
+ handle: string
49
+ };*/
50
+ /*:: type State = {
51
+ resizing: ?{ top: number, left: number, width: number, height: number },
52
+ dragging: ?{ top: number, left: number },
53
+ className: string
54
+ };*/
55
+ /*:: type Props = {
56
+ children: ReactElement<any>,
57
+ cols: number,
58
+ containerWidth: number,
59
+ margin: [number, number],
60
+ containerPadding: [number, number],
61
+ rowHeight: number,
62
+ maxRows: number,
63
+ isDraggable: boolean,
64
+ isResizable: boolean,
65
+ isBounded: boolean,
66
+ static?: boolean,
67
+ useCSSTransforms?: boolean,
68
+ usePercentages?: boolean,
69
+ transformScale: number,
70
+ droppingPosition?: DroppingPosition,
71
+
72
+ className: string,
73
+ style?: Object,
74
+ // Draggability
75
+ cancel: string,
76
+ handle: string,
77
+
78
+ x: number,
79
+ y: number,
80
+ w: number,
81
+ h: number,
82
+
83
+ minW: number,
84
+ maxW: number,
85
+ minH: number,
86
+ maxH: number,
87
+ i: string,
88
+
89
+ resizeHandles?: ResizeHandleAxis[],
90
+ resizeHandle?: ResizeHandle,
91
+
92
+ onDrag?: GridItemCallback<GridDragEvent>,
93
+ onDragStart?: GridItemCallback<GridDragEvent>,
94
+ onDragStop?: GridItemCallback<GridDragEvent>,
95
+ onResize?: GridItemCallback<GridResizeEvent>,
96
+ onResizeStart?: GridItemCallback<GridResizeEvent>,
97
+ onResizeStop?: GridItemCallback<GridResizeEvent>
98
+ };*/
99
+ /*:: type DefaultProps = {
100
+ className: string,
101
+ cancel: string,
102
+ handle: string,
103
+ minH: number,
104
+ minW: number,
105
+ maxH: number,
106
+ maxW: number,
107
+ transformScale: number
108
+ };*/
54
109
  /**
55
110
  * An individual item within a ReactGridLayout.
56
111
  */
57
- var GridItem = /*#__PURE__*/function (_React$Component) {
58
- _inherits(GridItem, _React$Component);
59
-
60
- var _super = _createSuper(GridItem);
61
-
62
- function GridItem() {
63
- var _this;
64
-
65
- _classCallCheck(this, GridItem);
66
-
67
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
68
- args[_key] = arguments[_key];
69
- }
70
-
71
- _this = _super.call.apply(_super, [this].concat(args));
72
-
73
- _defineProperty(_assertThisInitialized(_this), "state", {
112
+ class GridItem extends _react.default.Component /*:: <Props, State>*/{
113
+ constructor() {
114
+ super(...arguments);
115
+ _defineProperty(this, "state", {
74
116
  resizing: null,
75
117
  dragging: null,
76
118
  className: ""
77
119
  });
78
-
79
- _defineProperty(_assertThisInitialized(_this), "elementRef", /*#__PURE__*/_react.default.createRef());
80
-
81
- _defineProperty(_assertThisInitialized(_this), "onDragStart", function (e, _ref) {
82
- var node = _ref.node;
83
- var _this$props = _this.props,
84
- onDragStart = _this$props.onDragStart,
85
- transformScale = _this$props.transformScale;
120
+ _defineProperty(this, "elementRef", /*#__PURE__*/_react.default.createRef());
121
+ /**
122
+ * onDragStart event handler
123
+ * @param {Event} e event data
124
+ * @param {Object} callbackData an object with node, delta and position information
125
+ */
126
+ _defineProperty(this, "onDragStart", (e, _ref) => {
127
+ let {
128
+ node
129
+ } = _ref;
130
+ const {
131
+ onDragStart,
132
+ transformScale
133
+ } = this.props;
86
134
  if (!onDragStart) return;
87
- var newPosition
88
- /*: PartialPosition*/
89
- = {
135
+ const newPosition /*: PartialPosition*/ = {
90
136
  top: 0,
91
137
  left: 0
92
- }; // TODO: this wont work on nested parents
138
+ };
93
139
 
94
- var offsetParent = node.offsetParent;
140
+ // TODO: this wont work on nested parents
141
+ const {
142
+ offsetParent
143
+ } = node;
95
144
  if (!offsetParent) return;
96
- var parentRect = offsetParent.getBoundingClientRect();
97
- var clientRect = node.getBoundingClientRect();
98
- var cLeft = clientRect.left / transformScale;
99
- var pLeft = parentRect.left / transformScale;
100
- var cTop = clientRect.top / transformScale;
101
- var pTop = parentRect.top / transformScale;
145
+ const parentRect = offsetParent.getBoundingClientRect();
146
+ const clientRect = node.getBoundingClientRect();
147
+ const cLeft = clientRect.left / transformScale;
148
+ const pLeft = parentRect.left / transformScale;
149
+ const cTop = clientRect.top / transformScale;
150
+ const pTop = parentRect.top / transformScale;
102
151
  newPosition.left = cLeft - pLeft + offsetParent.scrollLeft;
103
152
  newPosition.top = cTop - pTop + offsetParent.scrollTop;
104
-
105
- _this.setState({
153
+ this.setState({
106
154
  dragging: newPosition
107
- }); // Call callback with this data
108
-
109
-
110
- var _calcXY = (0, _calculateUtils.calcXY)(_this.getPositionParams(), newPosition.top, newPosition.left, _this.props.w, _this.props.h),
111
- x = _calcXY.x,
112
- y = _calcXY.y;
155
+ });
113
156
 
114
- return onDragStart.call(_assertThisInitialized(_this), _this.props.i, x, y, {
115
- e: e,
116
- node: node,
117
- newPosition: newPosition
157
+ // Call callback with this data
158
+ const {
159
+ x,
160
+ y
161
+ } = (0, _calculateUtils.calcXY)(this.getPositionParams(), newPosition.top, newPosition.left, this.props.w, this.props.h);
162
+ return onDragStart.call(this, this.props.i, x, y, {
163
+ e,
164
+ node,
165
+ newPosition
118
166
  });
119
167
  });
120
-
121
- _defineProperty(_assertThisInitialized(_this), "onDrag", function (e, _ref2) {
122
- var node = _ref2.node,
123
- deltaX = _ref2.deltaX,
124
- deltaY = _ref2.deltaY;
125
- var onDrag = _this.props.onDrag;
168
+ /**
169
+ * onDrag event handler
170
+ * @param {Event} e event data
171
+ * @param {Object} callbackData an object with node, delta and position information
172
+ */
173
+ _defineProperty(this, "onDrag", (e, _ref2) => {
174
+ let {
175
+ node,
176
+ deltaX,
177
+ deltaY
178
+ } = _ref2;
179
+ const {
180
+ onDrag
181
+ } = this.props;
126
182
  if (!onDrag) return;
127
-
128
- if (!_this.state.dragging) {
183
+ if (!this.state.dragging) {
129
184
  throw new Error("onDrag called before onDragStart.");
130
185
  }
131
-
132
- var top = _this.state.dragging.top + deltaY;
133
- var left = _this.state.dragging.left + deltaX;
134
- var _this$props2 = _this.props,
135
- isBounded = _this$props2.isBounded,
136
- i = _this$props2.i,
137
- w = _this$props2.w,
138
- h = _this$props2.h,
139
- containerWidth = _this$props2.containerWidth;
140
-
141
- var positionParams = _this.getPositionParams(); // Boundary calculations; keeps items within the grid
142
-
143
-
186
+ let top = this.state.dragging.top + deltaY;
187
+ let left = this.state.dragging.left + deltaX;
188
+ const {
189
+ isBounded,
190
+ i,
191
+ w,
192
+ h,
193
+ containerWidth
194
+ } = this.props;
195
+ const positionParams = this.getPositionParams();
196
+
197
+ // Boundary calculations; keeps items within the grid
144
198
  if (isBounded) {
145
- var offsetParent = node.offsetParent;
146
-
199
+ const {
200
+ offsetParent
201
+ } = node;
147
202
  if (offsetParent) {
148
- var _this$props3 = _this.props,
149
- margin = _this$props3.margin,
150
- rowHeight = _this$props3.rowHeight;
151
- var bottomBoundary = offsetParent.clientHeight - (0, _calculateUtils.calcGridItemWHPx)(h, rowHeight, margin[1]);
203
+ const {
204
+ margin,
205
+ rowHeight
206
+ } = this.props;
207
+ const bottomBoundary = offsetParent.clientHeight - (0, _calculateUtils.calcGridItemWHPx)(h, rowHeight, margin[1]);
152
208
  top = (0, _calculateUtils.clamp)(top, 0, bottomBoundary);
153
- var colWidth = (0, _calculateUtils.calcGridColWidth)(positionParams);
154
- var rightBoundary = containerWidth - (0, _calculateUtils.calcGridItemWHPx)(w, colWidth, margin[0]);
209
+ const colWidth = (0, _calculateUtils.calcGridColWidth)(positionParams);
210
+ const rightBoundary = containerWidth - (0, _calculateUtils.calcGridItemWHPx)(w, colWidth, margin[0]);
155
211
  left = (0, _calculateUtils.clamp)(left, 0, rightBoundary);
156
212
  }
157
213
  }
158
-
159
- var newPosition
160
- /*: PartialPosition*/
161
- = {
162
- top: top,
163
- left: left
214
+ const newPosition /*: PartialPosition*/ = {
215
+ top,
216
+ left
164
217
  };
165
-
166
- _this.setState({
218
+ this.setState({
167
219
  dragging: newPosition
168
- }); // Call callback with this data
169
-
170
-
171
- var _calcXY2 = (0, _calculateUtils.calcXY)(positionParams, top, left, w, h),
172
- x = _calcXY2.x,
173
- y = _calcXY2.y;
220
+ });
174
221
 
175
- return onDrag.call(_assertThisInitialized(_this), i, x, y, {
176
- e: e,
177
- node: node,
178
- newPosition: newPosition
222
+ // Call callback with this data
223
+ const {
224
+ x,
225
+ y
226
+ } = (0, _calculateUtils.calcXY)(positionParams, top, left, w, h);
227
+ return onDrag.call(this, i, x, y, {
228
+ e,
229
+ node,
230
+ newPosition
179
231
  });
180
232
  });
181
-
182
- _defineProperty(_assertThisInitialized(_this), "onDragStop", function (e, _ref3) {
183
- var node = _ref3.node;
184
- var onDragStop = _this.props.onDragStop;
233
+ /**
234
+ * onDragStop event handler
235
+ * @param {Event} e event data
236
+ * @param {Object} callbackData an object with node, delta and position information
237
+ */
238
+ _defineProperty(this, "onDragStop", (e, _ref3) => {
239
+ let {
240
+ node
241
+ } = _ref3;
242
+ const {
243
+ onDragStop
244
+ } = this.props;
185
245
  if (!onDragStop) return;
186
-
187
- if (!_this.state.dragging) {
246
+ if (!this.state.dragging) {
188
247
  throw new Error("onDragEnd called before onDragStart.");
189
248
  }
190
-
191
- var _this$props4 = _this.props,
192
- w = _this$props4.w,
193
- h = _this$props4.h,
194
- i = _this$props4.i;
195
- var _this$state$dragging = _this.state.dragging,
196
- left = _this$state$dragging.left,
197
- top = _this$state$dragging.top;
198
- var newPosition
199
- /*: PartialPosition*/
200
- = {
201
- top: top,
202
- left: left
249
+ const {
250
+ w,
251
+ h,
252
+ i
253
+ } = this.props;
254
+ const {
255
+ left,
256
+ top
257
+ } = this.state.dragging;
258
+ const newPosition /*: PartialPosition*/ = {
259
+ top,
260
+ left
203
261
  };
204
-
205
- _this.setState({
262
+ this.setState({
206
263
  dragging: null
207
264
  });
208
-
209
- var _calcXY3 = (0, _calculateUtils.calcXY)(_this.getPositionParams(), top, left, w, h),
210
- x = _calcXY3.x,
211
- y = _calcXY3.y;
212
-
213
- return onDragStop.call(_assertThisInitialized(_this), i, x, y, {
214
- e: e,
215
- node: node,
216
- newPosition: newPosition
265
+ const {
266
+ x,
267
+ y
268
+ } = (0, _calculateUtils.calcXY)(this.getPositionParams(), top, left, w, h);
269
+ return onDragStop.call(this, i, x, y, {
270
+ e,
271
+ node,
272
+ newPosition
217
273
  });
218
274
  });
219
-
220
- _defineProperty(_assertThisInitialized(_this), "onResizeStop", function (e, callbackData) {
221
- _this.onResizeHandler(e, callbackData, "onResizeStop");
222
- });
223
-
224
- _defineProperty(_assertThisInitialized(_this), "onResizeStart", function (e, callbackData) {
225
- _this.onResizeHandler(e, callbackData, "onResizeStart");
226
- });
227
-
228
- _defineProperty(_assertThisInitialized(_this), "onResize", function (e, callbackData) {
229
- _this.onResizeHandler(e, callbackData, "onResize");
230
- });
231
-
232
- return _this;
233
- }
234
-
235
- _createClass(GridItem, [{
236
- key: "shouldComponentUpdate",
237
- value: function shouldComponentUpdate(nextProps
238
- /*: Props*/
239
- , nextState
240
- /*: State*/
241
- )
242
- /*: boolean*/
243
- {
244
- // We can't deeply compare children. If the developer memoizes them, we can
245
- // use this optimization.
246
- if (this.props.children !== nextProps.children) return true;
247
- if (this.props.droppingPosition !== nextProps.droppingPosition) return true; // TODO memoize these calculations so they don't take so long?
248
-
249
- var oldPosition = (0, _calculateUtils.calcGridItemPosition)(this.getPositionParams(this.props), this.props.x, this.props.y, this.props.w, this.props.h, this.state);
250
- var newPosition = (0, _calculateUtils.calcGridItemPosition)(this.getPositionParams(nextProps), nextProps.x, nextProps.y, nextProps.w, nextProps.h, nextState);
251
- return !(0, _utils.fastPositionEqual)(oldPosition, newPosition) || this.props.useCSSTransforms !== nextProps.useCSSTransforms;
252
- }
253
- }, {
254
- key: "componentDidMount",
255
- value: function componentDidMount() {
256
- this.moveDroppingItem({});
257
- }
258
- }, {
259
- key: "componentDidUpdate",
260
- value: function componentDidUpdate(prevProps
261
- /*: Props*/
262
- ) {
263
- this.moveDroppingItem(prevProps);
264
- } // When a droppingPosition is present, this means we should fire a move event, as if we had moved
265
- // this element by `x, y` pixels.
266
-
267
- }, {
268
- key: "moveDroppingItem",
269
- value: function moveDroppingItem(prevProps
270
- /*: Props*/
271
- ) {
272
- var droppingPosition = this.props.droppingPosition;
273
- if (!droppingPosition) return;
274
- var node = this.elementRef.current; // Can't find DOM node (are we unmounted?)
275
-
276
- if (!node) return;
277
- var prevDroppingPosition = prevProps.droppingPosition || {
278
- left: 0,
279
- top: 0
280
- };
281
- var dragging = this.state.dragging;
282
- var shouldDrag = dragging && droppingPosition.left !== prevDroppingPosition.left || droppingPosition.top !== prevDroppingPosition.top;
283
-
284
- if (!dragging) {
285
- this.onDragStart(droppingPosition.e, {
286
- node: node,
287
- deltaX: droppingPosition.left,
288
- deltaY: droppingPosition.top
289
- });
290
- } else if (shouldDrag) {
291
- var deltaX = droppingPosition.left - dragging.left;
292
- var deltaY = droppingPosition.top - dragging.top;
293
- this.onDrag(droppingPosition.e, {
294
- node: node,
295
- deltaX: deltaX,
296
- deltaY: deltaY
297
- });
298
- }
299
- }
300
- }, {
301
- key: "getPositionParams",
302
- value: function getPositionParams()
303
- /*: PositionParams*/
304
- {
305
- var props
306
- /*: Props*/
307
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
308
- return {
309
- cols: props.cols,
310
- containerPadding: props.containerPadding,
311
- containerWidth: props.containerWidth,
312
- margin: props.margin,
313
- maxRows: props.maxRows,
314
- rowHeight: props.rowHeight
315
- };
316
- }
317
275
  /**
318
- * This is where we set the grid item's absolute placement. It gets a little tricky because we want to do it
319
- * well when server rendering, and the only way to do that properly is to use percentage width/left because
320
- * we don't know exactly what the browser viewport is.
321
- * Unfortunately, CSS Transforms, which are great for performance, break in this instance because a percentage
322
- * left is relative to the item itself, not its container! So we cannot use them on the server rendering pass.
323
- *
324
- * @param {Object} pos Position object with width, height, left, top.
325
- * @return {Object} Style object.
326
- */
327
-
328
- }, {
329
- key: "createStyle",
330
- value: function createStyle(pos
331
- /*: Position*/
332
- )
333
- /*: { [key: string]: ?string }*/
334
- {
335
- var _this$props5 = this.props,
336
- usePercentages = _this$props5.usePercentages,
337
- containerWidth = _this$props5.containerWidth,
338
- useCSSTransforms = _this$props5.useCSSTransforms;
339
- var style; // CSS Transforms support (default)
340
-
341
- if (useCSSTransforms) {
342
- style = (0, _utils.setTransform)(pos);
343
- } else {
344
- // top,left (slow)
345
- style = (0, _utils.setTopLeft)(pos); // This is used for server rendering.
346
-
347
- if (usePercentages) {
348
- style.left = (0, _utils.perc)(pos.left / containerWidth);
349
- style.width = (0, _utils.perc)(pos.width / containerWidth);
350
- }
351
- }
352
-
353
- return style;
354
- }
355
- /**
356
- * Mix a Draggable instance into a child.
357
- * @param {Element} child Child element.
358
- * @return {Element} Child wrapped in Draggable.
276
+ * onResizeStop event handler
277
+ * @param {Event} e event data
278
+ * @param {Object} callbackData an object with node and size information
359
279
  */
280
+ _defineProperty(this, "onResizeStop", (e, callbackData, position) => this.onResizeHandler(e, callbackData, position, "onResizeStop"));
281
+ // onResizeStart event handler
282
+ _defineProperty(this, "onResizeStart", (e, callbackData, position) => this.onResizeHandler(e, callbackData, position, "onResizeStart"));
283
+ // onResize event handler
284
+ _defineProperty(this, "onResize", (e, callbackData, position) => this.onResizeHandler(e, callbackData, position, "onResize"));
285
+ }
286
+ shouldComponentUpdate(nextProps /*: Props*/, nextState /*: State*/) /*: boolean*/{
287
+ // We can't deeply compare children. If the developer memoizes them, we can
288
+ // use this optimization.
289
+ if (this.props.children !== nextProps.children) return true;
290
+ if (this.props.droppingPosition !== nextProps.droppingPosition) return true;
291
+ // TODO memoize these calculations so they don't take so long?
292
+ const oldPosition = (0, _calculateUtils.calcGridItemPosition)(this.getPositionParams(this.props), this.props.x, this.props.y, this.props.w, this.props.h, this.state);
293
+ const newPosition = (0, _calculateUtils.calcGridItemPosition)(this.getPositionParams(nextProps), nextProps.x, nextProps.y, nextProps.w, nextProps.h, nextState);
294
+ return !(0, _utils.fastPositionEqual)(oldPosition, newPosition) || this.props.useCSSTransforms !== nextProps.useCSSTransforms;
295
+ }
296
+ componentDidMount() {
297
+ this.moveDroppingItem({});
298
+ }
299
+ componentDidUpdate(prevProps /*: Props*/) {
300
+ this.moveDroppingItem(prevProps);
301
+ }
360
302
 
361
- }, {
362
- key: "mixinDraggable",
363
- value: function mixinDraggable(child
364
- /*: ReactElement<any>*/
365
- , isDraggable
366
- /*: boolean*/
367
- )
368
- /*: ReactElement<any>*/
369
- {
370
- return /*#__PURE__*/_react.default.createElement(_reactDraggable.DraggableCore, {
371
- disabled: !isDraggable,
372
- onStart: this.onDragStart,
373
- onDrag: this.onDrag,
374
- onStop: this.onDragStop,
375
- handle: this.props.handle,
376
- cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
377
- scale: this.props.transformScale,
378
- nodeRef: this.elementRef
379
- }, child);
303
+ // When a droppingPosition is present, this means we should fire a move event, as if we had moved
304
+ // this element by `x, y` pixels.
305
+ moveDroppingItem(prevProps /*: Props*/) {
306
+ const {
307
+ droppingPosition
308
+ } = this.props;
309
+ if (!droppingPosition) return;
310
+ const node = this.elementRef.current;
311
+ // Can't find DOM node (are we unmounted?)
312
+ if (!node) return;
313
+ const prevDroppingPosition = prevProps.droppingPosition || {
314
+ left: 0,
315
+ top: 0
316
+ };
317
+ const {
318
+ dragging
319
+ } = this.state;
320
+ const shouldDrag = dragging && droppingPosition.left !== prevDroppingPosition.left || droppingPosition.top !== prevDroppingPosition.top;
321
+ if (!dragging) {
322
+ this.onDragStart(droppingPosition.e, {
323
+ node,
324
+ deltaX: droppingPosition.left,
325
+ deltaY: droppingPosition.top
326
+ });
327
+ } else if (shouldDrag) {
328
+ const deltaX = droppingPosition.left - dragging.left;
329
+ const deltaY = droppingPosition.top - dragging.top;
330
+ this.onDrag(droppingPosition.e, {
331
+ node,
332
+ deltaX,
333
+ deltaY
334
+ });
380
335
  }
381
- /**
382
- * Mix a Resizable instance into a child.
383
- * @param {Element} child Child element.
384
- * @param {Object} position Position object (pixel values)
385
- * @return {Element} Child wrapped in Resizable.
386
- */
387
-
388
- }, {
389
- key: "mixinResizable",
390
- value: function mixinResizable(child
391
- /*: ReactElement<any>*/
392
- , position
393
- /*: Position*/
394
- , isResizable
395
- /*: boolean*/
396
- )
397
- /*: ReactElement<any>*/
398
- {
399
- var _this$props6 = this.props,
400
- cols = _this$props6.cols,
401
- x = _this$props6.x,
402
- minW = _this$props6.minW,
403
- minH = _this$props6.minH,
404
- maxW = _this$props6.maxW,
405
- maxH = _this$props6.maxH,
406
- transformScale = _this$props6.transformScale,
407
- resizeHandles = _this$props6.resizeHandles,
408
- resizeHandle = _this$props6.resizeHandle;
409
- var positionParams = this.getPositionParams(); // This is the max possible width - doesn't go to infinity because of the width of the window
410
-
411
- var maxWidth = (0, _calculateUtils.calcGridItemPosition)(positionParams, 0, 0, cols - x, 0).width; // Calculate min/max constraints using our min & maxes
336
+ }
337
+ getPositionParams() /*: PositionParams*/{
338
+ let props /*: Props*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
339
+ return {
340
+ cols: props.cols,
341
+ containerPadding: props.containerPadding,
342
+ containerWidth: props.containerWidth,
343
+ margin: props.margin,
344
+ maxRows: props.maxRows,
345
+ rowHeight: props.rowHeight
346
+ };
347
+ }
412
348
 
413
- var mins = (0, _calculateUtils.calcGridItemPosition)(positionParams, 0, 0, minW, minH);
414
- var maxes = (0, _calculateUtils.calcGridItemPosition)(positionParams, 0, 0, maxW, maxH);
415
- var minConstraints = [mins.width, mins.height];
416
- var maxConstraints = [Math.min(maxes.width, maxWidth), Math.min(maxes.height, Infinity)];
417
- return /*#__PURE__*/_react.default.createElement(_reactResizable.Resizable // These are opts for the resize handle itself
418
- , {
419
- draggableOpts: {
420
- disabled: !isResizable
421
- },
422
- className: isResizable ? undefined : "react-resizable-hide",
423
- width: position.width,
424
- height: position.height,
425
- minConstraints: minConstraints,
426
- maxConstraints: maxConstraints,
427
- onResizeStop: this.onResizeStop,
428
- onResizeStart: this.onResizeStart,
429
- onResize: this.onResize,
430
- transformScale: transformScale,
431
- resizeHandles: resizeHandles,
432
- handle: resizeHandle
433
- }, child);
349
+ /**
350
+ * This is where we set the grid item's absolute placement. It gets a little tricky because we want to do it
351
+ * well when server rendering, and the only way to do that properly is to use percentage width/left because
352
+ * we don't know exactly what the browser viewport is.
353
+ * Unfortunately, CSS Transforms, which are great for performance, break in this instance because a percentage
354
+ * left is relative to the item itself, not its container! So we cannot use them on the server rendering pass.
355
+ *
356
+ * @param {Object} pos Position object with width, height, left, top.
357
+ * @return {Object} Style object.
358
+ */
359
+ createStyle(pos /*: Position*/) /*: { [key: string]: ?string }*/{
360
+ const {
361
+ usePercentages,
362
+ containerWidth,
363
+ useCSSTransforms
364
+ } = this.props;
365
+ let style;
366
+ // CSS Transforms support (default)
367
+ if (useCSSTransforms) {
368
+ style = (0, _utils.setTransform)(pos);
369
+ } else {
370
+ // top,left (slow)
371
+ style = (0, _utils.setTopLeft)(pos);
372
+
373
+ // This is used for server rendering.
374
+ if (usePercentages) {
375
+ style.left = (0, _utils.perc)(pos.left / containerWidth);
376
+ style.width = (0, _utils.perc)(pos.width / containerWidth);
377
+ }
434
378
  }
435
- /**
436
- * onDragStart event handler
437
- * @param {Event} e event data
438
- * @param {Object} callbackData an object with node, delta and position information
439
- */
440
-
441
- }, {
442
- key: "onResizeHandler",
443
- value:
444
- /**
445
- * Wrapper around drag events to provide more useful data.
446
- * All drag events call the function with the given handler name,
447
- * with the signature (index, x, y).
448
- *
449
- * @param {String} handlerName Handler name to wrap.
450
- * @return {Function} Handler function.
451
- */
452
- function onResizeHandler(e
453
- /*: Event*/
454
- , _ref4, handlerName
455
- /*: string*/
456
- )
457
- /*: void*/
458
- {
459
- var node = _ref4.node,
460
- size = _ref4.size;
461
- var handler = this.props[handlerName];
462
- if (!handler) return;
463
- var _this$props7 = this.props,
464
- cols = _this$props7.cols,
465
- x = _this$props7.x,
466
- y = _this$props7.y,
467
- i = _this$props7.i,
468
- maxH = _this$props7.maxH,
469
- minH = _this$props7.minH;
470
- var _this$props8 = this.props,
471
- minW = _this$props8.minW,
472
- maxW = _this$props8.maxW; // Get new XY
473
-
474
- var _calcWH = (0, _calculateUtils.calcWH)(this.getPositionParams(), size.width, size.height, x, y),
475
- w = _calcWH.w,
476
- h = _calcWH.h; // minW should be at least 1 (TODO propTypes validation?)
477
-
379
+ return style;
380
+ }
478
381
 
479
- minW = Math.max(minW, 1); // maxW should be at most (cols - x)
382
+ /**
383
+ * Mix a Draggable instance into a child.
384
+ * @param {Element} child Child element.
385
+ * @return {Element} Child wrapped in Draggable.
386
+ */
387
+ mixinDraggable(child /*: ReactElement<any>*/, isDraggable /*: boolean*/) /*: ReactElement<any>*/{
388
+ return /*#__PURE__*/_react.default.createElement(_reactDraggable.DraggableCore, {
389
+ disabled: !isDraggable,
390
+ onStart: this.onDragStart,
391
+ onDrag: this.onDrag,
392
+ onStop: this.onDragStop,
393
+ handle: this.props.handle,
394
+ cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
395
+ scale: this.props.transformScale,
396
+ nodeRef: this.elementRef
397
+ }, child);
398
+ }
480
399
 
481
- maxW = Math.min(maxW, cols - x); // Min/max capping
400
+ /**
401
+ * Utility function to setup callback handler definitions for
402
+ * similarily structured resize events.
403
+ */
404
+ curryResizeHandler(position /*: Position*/, handler /*: function*/) /*: function*/{
405
+ return (e /*: Event*/, data /*: ResizeCallbackData*/) => /*: function*/handler(e, data, position);
406
+ }
482
407
 
483
- w = (0, _calculateUtils.clamp)(w, minW, maxW);
484
- h = (0, _calculateUtils.clamp)(h, minH, maxH);
408
+ /**
409
+ * Mix a Resizable instance into a child.
410
+ * @param {Element} child Child element.
411
+ * @param {Object} position Position object (pixel values)
412
+ * @return {Element} Child wrapped in Resizable.
413
+ */
414
+ mixinResizable(child /*: ReactElement<any>*/, position /*: Position*/, isResizable /*: boolean*/) /*: ReactElement<any>*/{
415
+ const {
416
+ cols,
417
+ x,
418
+ minW,
419
+ minH,
420
+ maxW,
421
+ maxH,
422
+ transformScale,
423
+ resizeHandles,
424
+ resizeHandle
425
+ } = this.props;
426
+ const positionParams = this.getPositionParams();
427
+
428
+ // This is the max possible width - doesn't go to infinity because of the width of the window
429
+ const maxWidth = (0, _calculateUtils.calcGridItemPosition)(positionParams, 0, 0, cols, 0).width;
430
+
431
+ // Calculate min/max constraints using our min & maxes
432
+ const mins = (0, _calculateUtils.calcGridItemPosition)(positionParams, 0, 0, minW, minH);
433
+ const maxes = (0, _calculateUtils.calcGridItemPosition)(positionParams, 0, 0, maxW, maxH);
434
+ const minConstraints = [mins.width, mins.height];
435
+ const maxConstraints = [Math.min(maxes.width, maxWidth), Math.min(maxes.height, Infinity)];
436
+ return /*#__PURE__*/_react.default.createElement(_reactResizable.Resizable
437
+ // These are opts for the resize handle itself
438
+ , {
439
+ draggableOpts: {
440
+ disabled: !isResizable
441
+ },
442
+ className: isResizable ? undefined : "react-resizable-hide",
443
+ width: position.width,
444
+ height: position.height,
445
+ minConstraints: minConstraints,
446
+ maxConstraints: maxConstraints,
447
+ onResizeStop: this.curryResizeHandler(position, this.onResizeStop),
448
+ onResizeStart: this.curryResizeHandler(position, this.onResizeStart),
449
+ onResize: this.curryResizeHandler(position, this.onResize),
450
+ transformScale: transformScale,
451
+ resizeHandles: resizeHandles,
452
+ handle: resizeHandle
453
+ }, child);
454
+ }
455
+ /**
456
+ * Wrapper around drag events to provide more useful data.
457
+ * All drag events call the function with the given handler name,
458
+ * with the signature (index, x, y).
459
+ */
460
+ onResizeHandler(e /*: Event*/, _ref4 /*:: */, position /*: Position*/, handlerName /*: string*/) /*: void*/{
461
+ let {
462
+ node,
463
+ size,
464
+ handle
465
+ } /*: ResizeCallbackData*/ = _ref4 /*: ResizeCallbackData*/;
466
+ const handler = this.props[handlerName];
467
+ if (!handler) return;
468
+ const {
469
+ x,
470
+ y,
471
+ i,
472
+ maxH,
473
+ minH
474
+ } = this.props;
475
+ let {
476
+ minW,
477
+ maxW
478
+ } = this.props;
479
+
480
+ // Get new XY
481
+ let {
482
+ w,
483
+ h
484
+ } = (0, _calculateUtils.calcWH)(this.getPositionParams(), size.width, size.height, x, y, handle);
485
+
486
+ // minW should be at least 1 (TODO propTypes validation?)
487
+ minW = Math.max(minW, 1);
488
+
489
+ // Min/max capping
490
+ w = (0, _calculateUtils.clamp)(w, minW, maxW);
491
+ h = (0, _calculateUtils.clamp)(h, minH, maxH);
492
+ let updatedSize = size;
493
+ if (node) {
494
+ const currentLeft = position.left;
495
+ const currentTop = position.top;
496
+ const currentWidth = position.width;
497
+ const currentHeight = position.height;
498
+ const resizeNorth = _ref5 => {
499
+ let {
500
+ left,
501
+ height,
502
+ width
503
+ } = _ref5;
504
+ const top = currentTop - (height - currentHeight);
505
+ return {
506
+ top,
507
+ left,
508
+ width,
509
+ height: this.constrainHeight(top, currentHeight, height),
510
+ top: this.constrainTop(top)
511
+ };
512
+ };
513
+ const resizeEast = _ref6 => {
514
+ let {
515
+ top,
516
+ left,
517
+ height,
518
+ width
519
+ } = _ref6;
520
+ return {
521
+ top,
522
+ height,
523
+ width: this.constrainWidth(currentLeft, currentWidth, width),
524
+ left: this.constrainLeft(left)
525
+ };
526
+ };
527
+ const resizeWest = _ref7 => {
528
+ let {
529
+ top,
530
+ height,
531
+ width
532
+ } = _ref7;
533
+ const left = currentLeft - (width - currentWidth);
534
+ return {
535
+ height,
536
+ width: left <= 0 ? currentWidth : this.constrainWidth(currentLeft, currentWidth, width),
537
+ top: this.constrainTop(top),
538
+ left: this.constrainLeft(left)
539
+ };
540
+ };
541
+ const resizeSouth = _ref8 => {
542
+ let {
543
+ top,
544
+ left,
545
+ height,
546
+ width
547
+ } = _ref8;
548
+ return {
549
+ width,
550
+ left,
551
+ height: this.constrainHeight(top, currentHeight, height),
552
+ top: this.constrainTop(top)
553
+ };
554
+ };
555
+ const resizeNorthEast = function () {
556
+ return resizeNorth(resizeEast(...arguments));
557
+ };
558
+ const resizeNorthWest = function () {
559
+ return resizeNorth(resizeWest(...arguments));
560
+ };
561
+ const resizeSouthEast = function () {
562
+ return resizeSouth(resizeEast(...arguments));
563
+ };
564
+ const resizeSouthWest = function () {
565
+ return resizeSouth(resizeWest(...arguments));
566
+ };
567
+ const ordinalResizeHandlerMap = {
568
+ n: resizeNorth,
569
+ ne: resizeNorthEast,
570
+ e: resizeEast,
571
+ se: resizeSouthEast,
572
+ s: resizeSouth,
573
+ sw: resizeSouthWest,
574
+ w: resizeWest,
575
+ nw: resizeNorthWest
576
+ };
577
+ const resizeHandler = ordinalResizeHandlerMap[handle];
578
+ updatedSize = resizeHandler ? resizeHandler({
579
+ top: currentTop,
580
+ left: currentLeft,
581
+ height: currentHeight,
582
+ width: currentWidth,
583
+ ...size
584
+ }) : size;
485
585
  this.setState({
486
- resizing: handlerName === "onResizeStop" ? null : size
487
- });
488
- handler.call(this, i, w, h, {
489
- e: e,
490
- node: node,
491
- size: size
586
+ resizing: handlerName === "onResizeStop" ? null : updatedSize
492
587
  });
493
588
  }
494
- }, {
495
- key: "render",
496
- value: function render()
497
- /*: ReactNode*/
498
- {
499
- var _this$props9 = this.props,
500
- x = _this$props9.x,
501
- y = _this$props9.y,
502
- w = _this$props9.w,
503
- h = _this$props9.h,
504
- isDraggable = _this$props9.isDraggable,
505
- isResizable = _this$props9.isResizable,
506
- droppingPosition = _this$props9.droppingPosition,
507
- useCSSTransforms = _this$props9.useCSSTransforms;
508
- var pos = (0, _calculateUtils.calcGridItemPosition)(this.getPositionParams(), x, y, w, h, this.state);
509
-
510
- var child = _react.default.Children.only(this.props.children); // Create the child element. We clone the existing element but modify its className and style.
511
-
512
-
513
- var newChild = /*#__PURE__*/_react.default.cloneElement(child, {
514
- ref: this.elementRef,
515
- className: (0, _clsx.default)("react-grid-item", child.props.className, this.props.className, {
516
- static: this.props.static,
517
- resizing: Boolean(this.state.resizing),
518
- "react-draggable": isDraggable,
519
- "react-draggable-dragging": Boolean(this.state.dragging),
520
- dropping: Boolean(droppingPosition),
521
- cssTransforms: useCSSTransforms
522
- }),
523
- // We can set the width and height on the child, but unfortunately we can't set the position.
524
- style: _objectSpread(_objectSpread(_objectSpread({}, this.props.style), child.props.style), this.createStyle(pos))
525
- }); // Resizable support. This is usually on but the user can toggle it off.
526
-
527
-
528
- newChild = this.mixinResizable(newChild, pos, isResizable); // Draggable support. This is always on, except for with placeholders.
589
+ handler.call(this, i, w, h, {
590
+ e,
591
+ node,
592
+ size: updatedSize,
593
+ handle
594
+ });
595
+ }
529
596
 
530
- newChild = this.mixinDraggable(newChild, isDraggable);
531
- return newChild;
532
- }
533
- }]);
597
+ /**
598
+ * Helper functions to constrain dimensions of a GridItem
599
+ */
600
+ constrainWidth(left /*: number*/, currentWidth /*: number*/, newWidth /*: number*/) /*: number*/{
601
+ return left + newWidth > this.props.containerWidth ? currentWidth : newWidth;
602
+ }
603
+ constrainHeight(top /*: number*/, currentHeight /*: number*/, newHeight /*: number*/) /*: number*/{
604
+ return top <= 0 ? currentHeight : newHeight;
605
+ }
606
+ constrainLeft(left /*: number*/) /*: number*/{
607
+ return Math.max(0, left);
608
+ }
609
+ constrainTop(top /*: number*/) /*: number*/{
610
+ return Math.max(0, top);
611
+ }
612
+ render() /*: ReactNode*/{
613
+ const {
614
+ x,
615
+ y,
616
+ w,
617
+ h,
618
+ isDraggable,
619
+ isResizable,
620
+ droppingPosition,
621
+ useCSSTransforms
622
+ } = this.props;
623
+ const pos = (0, _calculateUtils.calcGridItemPosition)(this.getPositionParams(), x, y, w, h, this.state);
624
+ const child = _react.default.Children.only(this.props.children);
625
+
626
+ // Create the child element. We clone the existing element but modify its className and style.
627
+ let newChild = /*#__PURE__*/_react.default.cloneElement(child, {
628
+ ref: this.elementRef,
629
+ className: (0, _clsx.default)("react-grid-item", child.props.className, this.props.className, {
630
+ static: this.props.static,
631
+ resizing: Boolean(this.state.resizing),
632
+ "react-draggable": isDraggable,
633
+ "react-draggable-dragging": Boolean(this.state.dragging),
634
+ dropping: Boolean(droppingPosition),
635
+ cssTransforms: useCSSTransforms
636
+ }),
637
+ // We can set the width and height on the child, but unfortunately we can't set the position.
638
+ style: {
639
+ ...this.props.style,
640
+ ...child.props.style,
641
+ ...this.createStyle(pos)
642
+ }
643
+ });
534
644
 
535
- return GridItem;
536
- }(_react.default.Component);
645
+ // Resizable support. This is usually on but the user can toggle it off.
646
+ newChild = this.mixinResizable(newChild, pos, isResizable);
537
647
 
648
+ // Draggable support. This is always on, except for with placeholders.
649
+ newChild = this.mixinDraggable(newChild, isDraggable);
650
+ return newChild;
651
+ }
652
+ }
538
653
  exports.default = GridItem;
539
-
540
654
  _defineProperty(GridItem, "propTypes", {
541
655
  // Children must be only a single element
542
656
  children: _propTypes.default.element,
@@ -553,39 +667,23 @@ _defineProperty(GridItem, "propTypes", {
553
667
  w: _propTypes.default.number.isRequired,
554
668
  h: _propTypes.default.number.isRequired,
555
669
  // All optional
556
- minW: function minW(props
557
- /*: Props*/
558
- , propName
559
- /*: string*/
560
- ) {
561
- var value = props[propName];
670
+ minW: function (props /*: Props*/, propName /*: string*/) {
671
+ const value = props[propName];
562
672
  if (typeof value !== "number") return new Error("minWidth not Number");
563
673
  if (value > props.w || value > props.maxW) return new Error("minWidth larger than item width/maxWidth");
564
674
  },
565
- maxW: function maxW(props
566
- /*: Props*/
567
- , propName
568
- /*: string*/
569
- ) {
570
- var value = props[propName];
675
+ maxW: function (props /*: Props*/, propName /*: string*/) {
676
+ const value = props[propName];
571
677
  if (typeof value !== "number") return new Error("maxWidth not Number");
572
678
  if (value < props.w || value < props.minW) return new Error("maxWidth smaller than item width/minWidth");
573
679
  },
574
- minH: function minH(props
575
- /*: Props*/
576
- , propName
577
- /*: string*/
578
- ) {
579
- var value = props[propName];
680
+ minH: function (props /*: Props*/, propName /*: string*/) {
681
+ const value = props[propName];
580
682
  if (typeof value !== "number") return new Error("minHeight not Number");
581
683
  if (value > props.h || value > props.maxH) return new Error("minHeight larger than item height/maxHeight");
582
684
  },
583
- maxH: function maxH(props
584
- /*: Props*/
585
- , propName
586
- /*: string*/
587
- ) {
588
- var value = props[propName];
685
+ maxH: function (props /*: Props*/, propName /*: string*/) {
686
+ const value = props[propName];
589
687
  if (typeof value !== "number") return new Error("maxHeight not Number");
590
688
  if (value < props.h || value < props.minH) return new Error("maxHeight smaller than item height/minHeight");
591
689
  },
@@ -622,7 +720,6 @@ _defineProperty(GridItem, "propTypes", {
622
720
  top: _propTypes.default.number.isRequired
623
721
  })
624
722
  });
625
-
626
723
  _defineProperty(GridItem, "defaultProps", {
627
724
  className: "",
628
725
  cancel: "",