react-grid-layout 1.5.1 → 1.5.3

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/.babelrc.js CHANGED
@@ -16,7 +16,7 @@ module.exports = {
16
16
  ],
17
17
  plugins: [
18
18
  "@babel/plugin-transform-flow-comments",
19
- "@babel/plugin-proposal-class-properties",
19
+ "@babel/plugin-transform-class-properties",
20
20
  "babel-plugin-preval"
21
21
  ]
22
22
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.3 (Dec 5, 2025)
4
+
5
+ - Fix collision detection y-coordinate offset. [#2173](https://github.com/react-grid-layout/react-grid-layout/pull/2173)
6
+ - Memoize bottom computation in compact for performance. [#2115](https://github.com/react-grid-layout/react-grid-layout/pull/2115)
7
+ - Make `b` param in `compactItem` optional. [#2165](https://github.com/react-grid-layout/react-grid-layout/pull/2165)
8
+ - Fix example animations and rework example styles.
9
+ - Various devDependency updates and security fixes. [#2179](https://github.com/react-grid-layout/react-grid-layout/pull/2179)
10
+
11
+ ## 1.5.2 (Jun 25, 2025)
12
+
13
+ - Fix `calcXY` when `isBounded=true` moving items incorrectly. Likely related to #2059. Thanks @wanpan11. [#2102](https://github.com/react-grid-layout/react-grid-layout/pull/2102)
14
+
15
+ ## 1.5.1 (Mar 11, 2025)
16
+
17
+ - Fix for React 18: wrap state calls in `flushSync`. Thanks @ashharrison90. [#2043](https://github.com/react-grid-layout/react-grid-layout/pull/2043)
18
+
19
+ ## 1.5.0 (Oct 9, 2024)
20
+
21
+ - Fix `calcXY` moving grid items slightly above and to the left of where they should be. Thanks @MaxMusing. [#2059](https://github.com/react-grid-layout/react-grid-layout/pull/2059)
22
+ - Change `onBreakpointChange`/`onLayoutChange` event order. `onBreakpointChange` now fires first. This should make managing responsive layouts easier, as you can set the current breakpoint in storage, then save the new layout to it.
23
+
3
24
  ## 1.4.4 (Nov 28, 2023)
4
25
 
5
26
  ### Bugfixes
@@ -427,7 +448,6 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
427
448
  ---
428
449
 
429
450
  - Fix React PropTypes & createClass warnings
430
-
431
451
  - See https://github.com/facebook/react/issues/10583
432
452
 
433
453
  0.15.0 (Aug 21, 2017)
@@ -443,7 +463,6 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
443
463
  ---
444
464
 
445
465
  - Fixed a dragging bug when the grid container is scrollable. Thanks @chultquist.
446
-
447
466
  - Ref: https://github.com/STRML/react-grid-layout/pull/555
448
467
 
449
468
  0.14.6 (Apr 19, 2017)
@@ -518,7 +537,6 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
518
537
  #### Fixes:
519
538
 
520
539
  - Fixed sorting of layout items, which could be different in IE if two items have the same x & y coordinate.
521
-
522
540
  - See [#369](https://github.com/STRML/react-grid-layout/issues/369).
523
541
 
524
542
  0.13.8 (Oct 13, 2016)
@@ -528,7 +546,6 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
528
546
  #### Fixes:
529
547
 
530
548
  - Fixed breakage introduced in `0.13.7` when items are added without a layout or `data-grid` property.
531
-
532
549
  - See [#368](https://github.com/STRML/react-grid-layout/issues/368).
533
550
 
534
551
  0.13.7 (Oct 3, 2016)
@@ -566,7 +583,6 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
566
583
 
567
584
  - Fixed potential call to `ReactDOM.findDOMNode(this)` after unmount of `WidthProvider`.
568
585
  - Fixed an issue where layout items using `data-grid` could rearrange on mount depending on how they were ordered.
569
-
570
586
  - See [#342](https://github.com/STRML/react-grid-layout/pull/342) for reference.
571
587
 
572
588
  0.13.3 (Aug 31, 2016)
@@ -589,7 +605,6 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
589
605
  - I'm aware this could be a breaking change if you were relying on this bad behavior. If so, please
590
606
  use your own `WidthProvider`-style HOC.
591
607
  - `babel-plugin-transform-flow-comments` had limited support for defining types like transpiled classes.
592
-
593
608
  - This has been updated to instead copy source to `.js.flow` files, which preserves all type information.
594
609
 
595
610
  0.13.1 (Aug 16, 2016)
@@ -637,7 +652,6 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
637
652
  ---
638
653
 
639
654
  - Update to React-Draggable v2. Fixes: #241, #239, #24
640
-
641
655
  - v2 contains a number of bugfixes & enhancements for touchscreens, multitouch, and scrolling containers.
642
656
 
643
657
  0.12.3 (May 3, 2016)
@@ -815,7 +829,6 @@ Other changes:
815
829
  - Upgraded to Babel 6.
816
830
  - Full typechecking via Flow.
817
831
  - Lots of misc bugfixes.
818
-
819
832
  - See beta releases below for more details.
820
833
 
821
834
  0.10.0-beta1
package/README.md CHANGED
@@ -62,6 +62,7 @@ RGL is React-only and does not require jQuery.
62
62
 
63
63
  #### Projects Using React-Grid-Layout
64
64
 
65
+ - [Basedash](https://www.basedash.com)
65
66
  - [BitMEX](https://www.bitmex.com/)
66
67
  - [AWS CloudFront Dashboards](https://aws.amazon.com/blogs/aws/cloudwatch-dashboards-create-use-customized-metrics-views/)
67
68
  - [Grafana](https://grafana.com/)
package/build/GridItem.js CHANGED
@@ -13,10 +13,12 @@ var _utils = require("./utils");
13
13
  var _calculateUtils = require("./calculateUtils");
14
14
  var _ReactGridLayoutPropTypes = require("./ReactGridLayoutPropTypes");
15
15
  var _clsx = _interopRequireDefault(require("clsx"));
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- 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; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
19
- 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); }
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
21
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
22
  /*:: import type { Element as ReactElement, Node as ReactNode } from "react";*/
21
23
  /*:: import type {
22
24
  ReactDraggableCallbackData,
@@ -201,14 +203,13 @@ class GridItem extends _react.default.Component /*:: <Props, State>*/{
201
203
  if (offsetParent) {
202
204
  const {
203
205
  margin,
204
- rowHeight,
205
- containerPadding
206
+ rowHeight
206
207
  } = this.props;
207
208
  const bottomBoundary = offsetParent.clientHeight - (0, _calculateUtils.calcGridItemWHPx)(h, rowHeight, margin[1]);
208
- top = (0, _calculateUtils.clamp)(top - containerPadding[1], 0, bottomBoundary);
209
+ top = (0, _calculateUtils.clamp)(top, 0, bottomBoundary);
209
210
  const colWidth = (0, _calculateUtils.calcGridColWidth)(positionParams);
210
211
  const rightBoundary = containerWidth - (0, _calculateUtils.calcGridItemWHPx)(w, colWidth, margin[0]);
211
- left = (0, _calculateUtils.clamp)(left - containerPadding[0], 0, rightBoundary);
212
+ left = (0, _calculateUtils.clamp)(left, 0, rightBoundary);
212
213
  }
213
214
  }
214
215
  const newPosition /*: PartialPosition*/ = {
@@ -345,7 +346,6 @@ class GridItem extends _react.default.Component /*:: <Props, State>*/{
345
346
  );
346
347
  }
347
348
  }
348
-
349
349
  getPositionParams() /*: PositionParams*/{
350
350
  let props /*: Props*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
351
351
  return {
@@ -545,11 +545,7 @@ class GridItem extends _react.default.Component /*:: <Props, State>*/{
545
545
  cssTransforms: useCSSTransforms
546
546
  }),
547
547
  // We can set the width and height on the child, but unfortunately we can't set the position.
548
- style: {
549
- ...this.props.style,
550
- ...child.props.style,
551
- ...this.createStyle(pos)
552
- }
548
+ style: _objectSpread(_objectSpread(_objectSpread({}, this.props.style), child.props.style), this.createStyle(pos))
553
549
  });
554
550
 
555
551
  // Resizable support. This is usually on but the user can toggle it off.
@@ -11,12 +11,13 @@ var _utils = require("./utils");
11
11
  var _calculateUtils = require("./calculateUtils");
12
12
  var _GridItem = _interopRequireDefault(require("./GridItem"));
13
13
  var _ReactGridLayoutPropTypes = _interopRequireDefault(require("./ReactGridLayoutPropTypes"));
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- 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; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
19
- 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); }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
20
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
21
  /*:: import type {
21
22
  ChildrenArray as ReactChildrenArray,
22
23
  Element as ReactElement
@@ -266,13 +267,12 @@ class ReactGridLayout extends React.Component /*:: <Props, State>*/{
266
267
  // Something like quad tree should be used
267
268
  // to find collisions faster
268
269
  if (preventCollision && !allowOverlap) {
269
- const collisions = (0, _utils.getAllCollisions)(layout, {
270
- ...l,
270
+ const collisions = (0, _utils.getAllCollisions)(layout, _objectSpread(_objectSpread({}, l), {}, {
271
271
  w,
272
272
  h,
273
273
  x,
274
274
  y
275
- }).filter(layoutItem => layoutItem.i !== l.i);
275
+ })).filter(layoutItem => layoutItem.i !== l.i);
276
276
  hasCollisions = collisions.length > 0;
277
277
 
278
278
  // If we're colliding, we need adjust the placeholder.
@@ -349,6 +349,7 @@ class ReactGridLayout extends React.Component /*:: <Props, State>*/{
349
349
  // Called while dragging an element. Part of browser native drag/drop API.
350
350
  // Native event target might be the layout itself, or an element within the layout.
351
351
  _defineProperty(this, "onDragOver", e => {
352
+ var _e$nativeEvent$target;
352
353
  e.preventDefault(); // Prevent any browser native action
353
354
  e.stopPropagation();
354
355
 
@@ -357,7 +358,7 @@ class ReactGridLayout extends React.Component /*:: <Props, State>*/{
357
358
  // FIXME remove this hack
358
359
  if (isFirefox &&
359
360
  // $FlowIgnore can't figure this out
360
- !e.nativeEvent.target?.classList.contains(layoutClassName)) {
361
+ !((_e$nativeEvent$target = e.nativeEvent.target) !== null && _e$nativeEvent$target !== void 0 && _e$nativeEvent$target.classList.contains(layoutClassName))) {
361
362
  return false;
362
363
  }
363
364
  const {
@@ -373,17 +374,14 @@ class ReactGridLayout extends React.Component /*:: <Props, State>*/{
373
374
  } = this.props;
374
375
  // Allow user to customize the dropping item or short-circuit the drop based on the results
375
376
  // of the `onDragOver(e: Event)` callback.
376
- const onDragOverResult = onDropDragOver?.(e);
377
+ const onDragOverResult = onDropDragOver === null || onDropDragOver === void 0 ? void 0 : onDropDragOver(e);
377
378
  if (onDragOverResult === false) {
378
379
  if (this.state.droppingDOMNode) {
379
380
  this.removeDroppingPlaceholder();
380
381
  }
381
382
  return false;
382
383
  }
383
- const finalDroppingItem = {
384
- ...droppingItem,
385
- ...onDragOverResult
386
- };
384
+ const finalDroppingItem = _objectSpread(_objectSpread({}, droppingItem), onDragOverResult);
387
385
  const {
388
386
  layout
389
387
  } = this.state;
@@ -414,13 +412,12 @@ class ReactGridLayout extends React.Component /*:: <Props, State>*/{
414
412
  key: finalDroppingItem.i
415
413
  }),
416
414
  droppingPosition,
417
- layout: [...layout, {
418
- ...finalDroppingItem,
415
+ layout: [...layout, _objectSpread(_objectSpread({}, finalDroppingItem), {}, {
419
416
  x: calculatedPosition.x,
420
417
  y: calculatedPosition.y,
421
418
  static: false,
422
419
  isDraggable: true
423
- }]
420
+ })]
424
421
  });
425
422
  } else if (this.state.droppingPosition) {
426
423
  const {
@@ -585,7 +582,7 @@ class ReactGridLayout extends React.Component /*:: <Props, State>*/{
585
582
  x: activeDrag.x,
586
583
  y: activeDrag.y,
587
584
  i: activeDrag.i,
588
- className: `react-grid-placeholder ${this.state.resizing ? "placeholder-resizing" : ""}`,
585
+ className: "react-grid-placeholder ".concat(this.state.resizing ? "placeholder-resizing" : ""),
589
586
  containerWidth: width,
590
587
  cols: cols,
591
588
  margin: margin,
@@ -684,10 +681,9 @@ class ReactGridLayout extends React.Component /*:: <Props, State>*/{
684
681
  innerRef
685
682
  } = this.props;
686
683
  const mergedClassName = (0, _clsx.default)(layoutClassName, className);
687
- const mergedStyle = {
688
- height: this.containerHeight(),
689
- ...style
690
- };
684
+ const mergedStyle = _objectSpread({
685
+ height: this.containerHeight()
686
+ }, style);
691
687
  return /*#__PURE__*/React.createElement("div", {
692
688
  ref: innerRef,
693
689
  className: mergedClassName,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.resizeHandleType = exports.resizeHandleAxesType = exports.default = void 0;
7
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
8
8
  var _react = _interopRequireDefault(require("react"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  /*:: import type {
11
11
  Ref,
12
12
  ChildrenArray as ReactChildrenArray,
@@ -198,7 +198,7 @@ var _default = exports.default = {
198
198
  // Check children keys for duplicates. Throw if found.
199
199
  const keys = {};
200
200
  _react.default.Children.forEach(children, function (child) {
201
- if (child?.key == null) return;
201
+ if ((child === null || child === void 0 ? void 0 : child.key) == null) return;
202
202
  if (keys[child.key]) {
203
203
  throw new Error('Duplicate child key "' + child.key + '" found! This will cause problems in ReactGridLayout.');
204
204
  }
@@ -10,13 +10,17 @@ var _fastEquals = require("fast-equals");
10
10
  var _utils = require("./utils");
11
11
  var _responsiveUtils = require("./responsiveUtils");
12
12
  var _ReactGridLayout = _interopRequireDefault(require("./ReactGridLayout"));
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
17
- 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; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
19
- 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); } /*:: import { type Layout, type Pick } from "./utils";*/ /*:: import { type ResponsiveLayout, type OnLayoutChangeCallback, type Breakpoints } from "./responsiveUtils";*/
13
+ const _excluded = ["breakpoint", "breakpoints", "cols", "layouts", "margin", "containerPadding", "onBreakpointChange", "onLayoutChange", "onWidthChange"];
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
17
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
18
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*:: import { type Layout, type Pick } from "./utils";*/ /*:: import { type ResponsiveLayout, type OnLayoutChangeCallback, type Breakpoints } from "./responsiveUtils";*/
20
24
  // $FlowFixMe[method-unbinding]
21
25
  const type = obj => Object.prototype.toString.call(obj);
22
26
 
@@ -87,10 +91,9 @@ class ResponsiveReactGridLayout extends React.Component
87
91
  _defineProperty(this, "state", this.generateInitialState());
88
92
  // wrap layouts so we do not need to pass layouts to child
89
93
  _defineProperty(this, "onLayoutChange", (layout /*: Layout*/) => {
90
- this.props.onLayoutChange(layout, {
91
- ...this.props.layouts,
94
+ this.props.onLayoutChange(layout, _objectSpread(_objectSpread({}, this.props.layouts), {}, {
92
95
  [this.state.breakpoint]: layout
93
- });
96
+ }));
94
97
  });
95
98
  }
96
99
  generateInitialState() /*: State*/{
@@ -151,9 +154,7 @@ class ResponsiveReactGridLayout extends React.Component
151
154
  const newBreakpoint = this.props.breakpoint || (0, _responsiveUtils.getBreakpointFromWidth)(this.props.breakpoints, this.props.width);
152
155
  const lastBreakpoint = this.state.breakpoint;
153
156
  const newCols /*: number*/ = (0, _responsiveUtils.getColsFromBreakpoint)(newBreakpoint, cols);
154
- const newLayouts = {
155
- ...layouts
156
- };
157
+ const newLayouts = _objectSpread({}, layouts);
157
158
 
158
159
  // Breakpoint change
159
160
  if (lastBreakpoint !== newBreakpoint || prevProps.breakpoints !== breakpoints || prevProps.cols !== cols) {
@@ -186,18 +187,19 @@ class ResponsiveReactGridLayout extends React.Component
186
187
  }
187
188
  render() /*: React.Element<typeof ReactGridLayout>*/{
188
189
  /* eslint-disable no-unused-vars */
189
- const {
190
- breakpoint,
191
- breakpoints,
192
- cols,
193
- layouts,
194
- margin,
195
- containerPadding,
196
- onBreakpointChange,
197
- onLayoutChange,
198
- onWidthChange,
199
- ...other
200
- } = this.props;
190
+ const _this$props = this.props,
191
+ {
192
+ breakpoint,
193
+ breakpoints,
194
+ cols,
195
+ layouts,
196
+ margin,
197
+ containerPadding,
198
+ onBreakpointChange,
199
+ onLayoutChange,
200
+ onWidthChange
201
+ } = _this$props,
202
+ other = _objectWithoutProperties(_this$props, _excluded);
201
203
  /* eslint-enable no-unused-vars */
202
204
 
203
205
  return /*#__PURE__*/React.createElement(_ReactGridLayout.default, _extends({}, other, {
@@ -8,13 +8,15 @@ var React = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-polyfill"));
10
10
  var _clsx = _interopRequireDefault(require("clsx"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
15
- 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; }
16
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
- 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); }
11
+ const _excluded = ["measureBeforeMount"];
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
15
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
16
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
20
  /*:: import type { ReactRef } from "../ReactGridLayoutPropTypes";*/
19
21
  /*:: type WPDefaultProps = {|
20
22
  measureBeforeMount: boolean
@@ -44,8 +46,8 @@ const layoutClassName = "react-grid-layout";
44
46
  * a flow bug of some sort that causes it to stop typechecking.
45
47
  */
46
48
  function WidthProvideRGL /*:: <Config>*/(ComposedComponent /*: React.AbstractComponent<Config>*/) /*: React.AbstractComponent<ComposedProps<Config>>*/{
47
- var _class;
48
- return _class = class WidthProvider extends React.Component
49
+ var _WidthProvider;
50
+ return _WidthProvider = class WidthProvider extends React.Component
49
51
  /*:: <
50
52
  ComposedProps<Config>,
51
53
  WPState
@@ -85,10 +87,11 @@ function WidthProvideRGL /*:: <Config>*/(ComposedComponent /*: React.AbstractCom
85
87
  this.resizeObserver.disconnect();
86
88
  }
87
89
  render() {
88
- const {
89
- measureBeforeMount,
90
- ...rest
91
- } = this.props;
90
+ const _this$props = this.props,
91
+ {
92
+ measureBeforeMount
93
+ } = _this$props,
94
+ rest = _objectWithoutProperties(_this$props, _excluded);
92
95
  if (measureBeforeMount && !this.mounted) {
93
96
  return /*#__PURE__*/React.createElement("div", {
94
97
  className: (0, _clsx.default)(this.props.className, layoutClassName),
@@ -102,11 +105,11 @@ function WidthProvideRGL /*:: <Config>*/(ComposedComponent /*: React.AbstractCom
102
105
  innerRef: this.elementRef
103
106
  }, rest, this.state));
104
107
  }
105
- }, _defineProperty(_class, "defaultProps", {
108
+ }, _defineProperty(_WidthProvider, "defaultProps", {
106
109
  measureBeforeMount: false
107
- }), _defineProperty(_class, "propTypes", {
110
+ }), _defineProperty(_WidthProvider, "propTypes", {
108
111
  // If true, will not render children until mounted. Useful for getting the exact width before
109
112
  // rendering, to prevent any unsightly resizing.
110
113
  measureBeforeMount: _propTypes.default.bool
111
- }), _class;
114
+ }), _WidthProvider;
112
115
  }