react-grid-layout 1.3.0 → 1.3.4

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/README.md CHANGED
@@ -14,6 +14,7 @@ or autogenerated.
14
14
  RGL is React-only and does not require jQuery.
15
15
 
16
16
  ![BitMEX UI](http://i.imgur.com/oo1NT6c.gif)
17
+
17
18
  > GIF from production usage on [BitMEX.com](https://www.bitmex.com)
18
19
 
19
20
  [**[Demo](https://react-grid-layout.github.io/react-grid-layout/) | [Changelog](/CHANGELOG.md) | [CodeSandbox Editable demo](https://codesandbox.io/s/5wy3rz5z1x?module=%2Fsrc%2FShowcaseLayout.js)**]
@@ -77,32 +78,32 @@ RGL is React-only and does not require jQuery.
77
78
  - [Statsout](https://statsout.com/)
78
79
  - [Datto RMM](https://www.datto.com/uk/products/rmm/)
79
80
 
80
- *Know of others? Create a PR to let me know!*
81
+ _Know of others? Create a PR to let me know!_
81
82
 
82
83
  ## Features
83
84
 
84
- * 100% React - no jQuery
85
- * Compatible with server-rendered apps
86
- * Draggable widgets
87
- * Resizable widgets
88
- * Static widgets
89
- * Configurable packing: horizontal, vertical, or off
90
- * Bounds checking for dragging and resizing
91
- * Widgets may be added or removed without rebuilding grid
92
- * Layout can be serialized and restored
93
- * Responsive breakpoints
94
- * Separate layouts per responsive breakpoint
95
- * Grid Items placed using CSS Transforms
96
- * Performance with CSS Transforms: [on](http://i.imgur.com/FTogpLp.jpg) / [off](http://i.imgur.com/gOveMm8.jpg), note paint (green) as % of time
97
- * Compatibility with `<React.StrictMode>`
98
-
99
- |Version | Compatibility |
100
- |----------------|------------------|
101
- | >= 0.17.0 | React 16 & 17 |
102
- | >= 0.11.3 | React 0.14 & 15 |
103
- | >= 0.10.0 | React 0.14 |
104
- | 0.8. - 0.9.2 | React 0.13 |
105
- | < 0.8 | React 0.12 |
85
+ - 100% React - no jQuery
86
+ - Compatible with server-rendered apps
87
+ - Draggable widgets
88
+ - Resizable widgets
89
+ - Static widgets
90
+ - Configurable packing: horizontal, vertical, or off
91
+ - Bounds checking for dragging and resizing
92
+ - Widgets may be added or removed without rebuilding grid
93
+ - Layout can be serialized and restored
94
+ - Responsive breakpoints
95
+ - Separate layouts per responsive breakpoint
96
+ - Grid Items placed using CSS Transforms
97
+ - Performance with CSS Transforms: [on](http://i.imgur.com/FTogpLp.jpg) / [off](http://i.imgur.com/gOveMm8.jpg), note paint (green) as % of time
98
+ - Compatibility with `<React.StrictMode>`
99
+
100
+ | Version | Compatibility |
101
+ | ------------ | --------------- |
102
+ | >= 0.17.0 | React 16 & 17 |
103
+ | >= 0.11.3 | React 0.14 & 15 |
104
+ | >= 0.10.0 | React 0.14 |
105
+ | 0.8. - 0.9.2 | React 0.13 |
106
+ | < 0.8 | React 0.12 |
106
107
 
107
108
  ## Installation
108
109
 
@@ -129,23 +130,29 @@ produce a grid with three items where:
129
130
  - users will be able to freely drag and resize item `c`
130
131
 
131
132
  ```js
132
- import GridLayout from 'react-grid-layout';
133
+ import GridLayout from "react-grid-layout";
133
134
 
134
135
  class MyFirstGrid extends React.Component {
135
136
  render() {
136
137
  // layout is an array of objects, see the demo for more complete usage
137
138
  const layout = [
138
- {i: 'a', x: 0, y: 0, w: 1, h: 2, static: true},
139
- {i: 'b', x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4},
140
- {i: 'c', x: 4, y: 0, w: 1, h: 2}
139
+ { i: "a", x: 0, y: 0, w: 1, h: 2, static: true },
140
+ { i: "b", x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 },
141
+ { i: "c", x: 4, y: 0, w: 1, h: 2 }
141
142
  ];
142
143
  return (
143
- <GridLayout className="layout" layout={layout} cols={12} rowHeight={30} width={1200}>
144
+ <GridLayout
145
+ className="layout"
146
+ layout={layout}
147
+ cols={12}
148
+ rowHeight={30}
149
+ width={1200}
150
+ >
144
151
  <div key="a">a</div>
145
152
  <div key="b">b</div>
146
153
  <div key="c">c</div>
147
154
  </GridLayout>
148
- )
155
+ );
149
156
  }
150
157
  }
151
158
  ```
@@ -153,17 +160,23 @@ class MyFirstGrid extends React.Component {
153
160
  You may also choose to set layout properties directly on the children:
154
161
 
155
162
  ```js
156
- import GridLayout from 'react-grid-layout';
163
+ import GridLayout from "react-grid-layout";
157
164
 
158
165
  class MyFirstGrid extends React.Component {
159
166
  render() {
160
167
  return (
161
168
  <GridLayout className="layout" cols={12} rowHeight={30} width={1200}>
162
- <div key="a" data-grid={{x: 0, y: 0, w: 1, h: 2, static: true}}>a</div>
163
- <div key="b" data-grid={{x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4}}>b</div>
164
- <div key="c" data-grid={{x: 4, y: 0, w: 1, h: 2}}>c</div>
169
+ <div key="a" data-grid={{ x: 0, y: 0, w: 1, h: 2, static: true }}>
170
+ a
171
+ </div>
172
+ <div key="b" data-grid={{ x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 }}>
173
+ b
174
+ </div>
175
+ <div key="c" data-grid={{ x: 4, y: 0, w: 1, h: 2 }}>
176
+ c
177
+ </div>
165
178
  </GridLayout>
166
- )
179
+ );
167
180
  }
168
181
  }
169
182
  ```
@@ -178,21 +191,24 @@ excludes `React`, so it must be otherwise available in your application, either
178
191
  To make RGL responsive, use the `<ResponsiveReactGridLayout>` element:
179
192
 
180
193
  ```js
181
- import { Responsive as ResponsiveGridLayout } from 'react-grid-layout';
194
+ import { Responsive as ResponsiveGridLayout } from "react-grid-layout";
182
195
 
183
196
  class MyResponsiveGrid extends React.Component {
184
197
  render() {
185
198
  // {lg: layout1, md: layout2, ...}
186
199
  const layouts = getLayoutsFromSomewhere();
187
200
  return (
188
- <ResponsiveGridLayout className="layout" layouts={layouts}
189
- breakpoints={{lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0}}
190
- cols={{lg: 12, md: 10, sm: 6, xs: 4, xxs: 2}}>
201
+ <ResponsiveGridLayout
202
+ className="layout"
203
+ layouts={layouts}
204
+ breakpoints={{ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }}
205
+ cols={{ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }}
206
+ >
191
207
  <div key="1">1</div>
192
208
  <div key="2">2</div>
193
209
  <div key="3">3</div>
194
210
  </ResponsiveGridLayout>
195
- )
211
+ );
196
212
  }
197
213
  }
198
214
  ```
@@ -215,7 +231,7 @@ positions on drag events. In simple cases a HOC `WidthProvider` can be used to a
215
231
  width upon initialization and window resize events.
216
232
 
217
233
  ```js
218
- import { Responsive, WidthProvider } from 'react-grid-layout';
234
+ import { Responsive, WidthProvider } from "react-grid-layout";
219
235
 
220
236
  const ResponsiveGridLayout = WidthProvider(Responsive);
221
237
 
@@ -224,14 +240,17 @@ class MyResponsiveGrid extends React.Component {
224
240
  // {lg: layout1, md: layout2, ...}
225
241
  var layouts = getLayoutsFromSomewhere();
226
242
  return (
227
- <ResponsiveGridLayout className="layout" layouts={layouts}
228
- breakpoints={{lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0}}
229
- cols={{lg: 12, md: 10, sm: 6, xs: 4, xxs: 2}}>
243
+ <ResponsiveGridLayout
244
+ className="layout"
245
+ layouts={layouts}
246
+ breakpoints={{ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }}
247
+ cols={{ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }}
248
+ >
230
249
  <div key="1">1</div>
231
250
  <div key="2">2</div>
232
251
  <div key="3">3</div>
233
252
  </ResponsiveGridLayout>
234
- )
253
+ );
235
254
  }
236
255
  }
237
256
  ```
@@ -319,10 +338,12 @@ useCSSTransforms: ?boolean = true,
319
338
  transformScale: ?number = 1,
320
339
 
321
340
  // If true, grid can be placed one over the other.
341
+ // If set, implies `preventCollision`.
322
342
  allowOverlap: ?boolean = false,
323
343
 
324
344
  // If true, grid items won't change position when being
325
- // dragged over.
345
+ // dragged over. If `allowOverlap` is still false,
346
+ // this simply won't allow one to drop on an existing object.
326
347
  preventCollision: ?boolean = false,
327
348
 
328
349
  // If true, droppable elements (with `draggable={true}` attribute)
@@ -394,7 +415,9 @@ onDropDragOver: (e: DragOverEvent) => ?({|w?: number, h?: number|} | false),
394
415
 
395
416
  // Ref for getting a reference for the grid's wrapping div.
396
417
  // You can use this instead of a regular ref and the deprecated `ReactDOM.findDOMNode()`` function.
397
- innerRef: ?React.Ref<"div">,
418
+ // Note that this type is React.Ref<HTMLDivElement> in TypeScript, Flow has a bug here
419
+ // https://github.com/facebook/flow/issues/8671#issuecomment-862634865
420
+ innerRef: {current: null | HTMLDivElement},
398
421
  ```
399
422
 
400
423
  ### Responsive Grid Layout Props
@@ -492,7 +515,6 @@ will be draggable, even if the item is marked `static: true`.
492
515
 
493
516
  `<ReactGridLayout>` has [an optimized `shouldComponentUpdate` implementation](lib/ReactGridLayout.jsx), but it relies on the user memoizing the `children` array:
494
517
 
495
-
496
518
  ```js
497
519
  // lib/ReactGridLayout.jsx
498
520
  // ...
@@ -515,7 +537,7 @@ If you memoize your children, you can take advantage of this, and reap faster re
515
537
  function MyGrid(props) {
516
538
  const children = React.useMemo(() => {
517
539
  return new Array(props.count).fill(undefined).map((val, idx) => {
518
- return <div key={idx} data-grid={{x: idx, y: 1, w: 1, h: 1}} />;
540
+ return <div key={idx} data-grid={{ x: idx, y: 1, w: 1, h: 1 }} />;
519
541
  });
520
542
  }, [props.count]);
521
543
  return <ReactGridLayout cols={12}>{children}</ReactGridLayout>;
@@ -538,7 +560,7 @@ const CustomGridItemComponent = React.forwardRef(({style, className, ...props},
538
560
  return (
539
561
  <div style={{ /* styles */, ...style}} className={className} ref={ref}>
540
562
  {/* Some other content */}
541
- </div>
563
+ </div>
542
564
  );
543
565
  }
544
566
  ```
@@ -551,7 +573,7 @@ positioning via `style`, and set classes.
551
573
 
552
574
  If you have a feature request, please add it as an issue or make a pull request.
553
575
 
554
- If you have a bug to report, please reproduce the bug in [CodeSandbox](https://codesandbox.io/s/5wy3rz5z1x?module=%2Fsrc%2FShowcaseLayout.js) to help
576
+ If you have a bug to report, please reproduce the bug in [CodeSandbox](https://codesandbox.io/s/staging-bush-3lvt7?file=/src/ShowcaseLayout.js) to help
555
577
  us easily isolate it.
556
578
 
557
579
  ## TODO List
@@ -567,5 +589,5 @@ us easily isolate it.
567
589
  - [x] Static elements
568
590
  - [x] Persistent id per item for predictable localstorage restores, even when # items changes
569
591
  - [x] Min/max w/h per item
570
- - [ ] Resizable handles on other corners
592
+ - [x] Resizable handles on other corners
571
593
  - [ ] Configurable w/h per breakpoint
package/build/GridItem.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -21,21 +21,21 @@ var _calculateUtils = require("./calculateUtils");
21
21
 
22
22
  var _ReactGridLayoutPropTypes = require("./ReactGridLayoutPropTypes");
23
23
 
24
- var _classnames = _interopRequireDefault(require("classnames"));
24
+ var _clsx = _interopRequireDefault(require("clsx"));
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
28
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
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
29
 
30
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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
31
 
32
32
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
33
 
34
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
35
 
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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
37
 
38
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
38
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
39
 
40
40
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
41
 
@@ -512,7 +512,7 @@ var GridItem = /*#__PURE__*/function (_React$Component) {
512
512
 
513
513
  var newChild = /*#__PURE__*/_react.default.cloneElement(child, {
514
514
  ref: this.elementRef,
515
- className: (0, _classnames.default)("react-grid-item", child.props.className, this.props.className, {
515
+ className: (0, _clsx.default)("react-grid-item", child.props.className, this.props.className, {
516
516
  static: this.props.static,
517
517
  resizing: Boolean(this.state.resizing),
518
518
  "react-draggable": isDraggable,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _lodash = _interopRequireDefault(require("lodash.isequal"));
13
13
 
14
- var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _clsx = _interopRequireDefault(require("clsx"));
15
15
 
16
16
  var _utils = require("./utils");
17
17
 
@@ -35,9 +35,9 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
35
35
 
36
36
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
37
37
 
38
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
38
+ 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; }
39
39
 
40
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
40
+ 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; }
41
41
 
42
42
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
43
 
@@ -55,9 +55,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
55
55
 
56
56
  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); } }
57
57
 
58
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
58
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
59
59
 
60
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
60
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
61
61
 
62
62
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
63
63
 
@@ -132,7 +132,7 @@ var ReactGridLayout = /*#__PURE__*/function (_React$Component) {
132
132
 
133
133
  _this.setState({
134
134
  oldDragItem: (0, _utils.cloneLayoutItem)(l),
135
- oldLayout: _this.state.layout
135
+ oldLayout: layout
136
136
  });
137
137
 
138
138
  return _this.props.onDragStart(layout, l, l, null, e, node);
@@ -145,7 +145,8 @@ var ReactGridLayout = /*#__PURE__*/function (_React$Component) {
145
145
  var layout = _this.state.layout;
146
146
  var _this$props = _this.props,
147
147
  cols = _this$props.cols,
148
- allowOverlap = _this$props.allowOverlap;
148
+ allowOverlap = _this$props.allowOverlap,
149
+ preventCollision = _this$props.preventCollision;
149
150
  var l = (0, _utils.getLayoutItem)(layout, i);
150
151
  if (!l) return; // Create placeholder (display only)
151
152
 
@@ -159,7 +160,7 @@ var ReactGridLayout = /*#__PURE__*/function (_React$Component) {
159
160
  }; // Move the element to the dragged location.
160
161
 
161
162
  var isUserAction = true;
162
- layout = (0, _utils.moveElement)(layout, l, x, y, isUserAction, _this.props.preventCollision, (0, _utils.compactType)(_this.props), cols, allowOverlap);
163
+ layout = (0, _utils.moveElement)(layout, l, x, y, isUserAction, preventCollision, (0, _utils.compactType)(_this.props), cols, allowOverlap);
163
164
 
164
165
  _this.props.onDrag(layout, oldDragItem, l, placeholder, e, node);
165
166
 
@@ -423,6 +424,7 @@ var ReactGridLayout = /*#__PURE__*/function (_React$Component) {
423
424
  _defineProperty(_assertThisInitialized(_this), "onDragLeave", function (e) {
424
425
  e.preventDefault(); // Prevent any browser native action
425
426
 
427
+ e.stopPropagation();
426
428
  _this.dragEnterCounter--; // onDragLeave can be triggered on each layout's child.
427
429
  // But we know that count of dragEnter and dragLeave events
428
430
  // will be balanced after leaving the layout's container
@@ -437,6 +439,7 @@ var ReactGridLayout = /*#__PURE__*/function (_React$Component) {
437
439
  _defineProperty(_assertThisInitialized(_this), "onDragEnter", function (e) {
438
440
  e.preventDefault(); // Prevent any browser native action
439
441
 
442
+ e.stopPropagation();
440
443
  _this.dragEnterCounter++;
441
444
  });
442
445
 
@@ -445,6 +448,7 @@ var ReactGridLayout = /*#__PURE__*/function (_React$Component) {
445
448
  ) {
446
449
  e.preventDefault(); // Prevent any browser native action
447
450
 
451
+ e.stopPropagation();
448
452
  var droppingItem = _this.props.droppingItem;
449
453
  var layout = _this.state.layout;
450
454
  var item = layout.find(function (l) {
@@ -673,7 +677,7 @@ var ReactGridLayout = /*#__PURE__*/function (_React$Component) {
673
677
  style = _this$props9.style,
674
678
  isDroppable = _this$props9.isDroppable,
675
679
  innerRef = _this$props9.innerRef;
676
- var mergedClassName = (0, _classnames.default)(layoutClassName, className);
680
+ var mergedClassName = (0, _clsx.default)(layoutClassName, className);
677
681
 
678
682
  var mergedStyle = _objectSpread({
679
683
  height: this.containerHeight()
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.resizeHandleType = exports.resizeHandleAxesType = void 0;
6
+ exports.resizeHandleType = exports.resizeHandleAxesType = exports.default = void 0;
7
7
 
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -33,17 +33,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
33
33
 
34
34
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
35
35
 
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
36
+ 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; }
37
37
 
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
38
+ 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; }
39
39
 
40
40
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41
41
 
42
42
  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); } }
43
43
 
44
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
44
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
45
45
 
46
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
46
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
47
47
 
48
48
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
49
49
 
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.calcGridColWidth = calcGridColWidth;
7
- exports.calcGridItemWHPx = calcGridItemWHPx;
8
7
  exports.calcGridItemPosition = calcGridItemPosition;
9
- exports.calcXY = calcXY;
8
+ exports.calcGridItemWHPx = calcGridItemWHPx;
10
9
  exports.calcWH = calcWH;
10
+ exports.calcXY = calcXY;
11
11
  exports.clamp = clamp;
12
12
 
13
13
  /*:: import type { Position } from "./utils";*/
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
- var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _clsx = _interopRequireDefault(require("clsx"));
15
15
 
16
16
  var _excluded = ["measureBeforeMount"];
17
17
 
@@ -31,9 +31,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
31
31
 
32
32
  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); } }
33
33
 
34
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
34
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
35
35
 
36
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
36
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
37
37
 
38
38
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
39
 
@@ -64,9 +64,9 @@ function WidthProvideRGL
64
64
  )
65
65
  /*: React.AbstractComponent<ComposedProps<Config>>*/
66
66
  {
67
- var _class, _temp;
67
+ var _class;
68
68
 
69
- return _temp = _class = /*#__PURE__*/function (_React$Component) {
69
+ return _class = /*#__PURE__*/function (_React$Component) {
70
70
  _inherits(WidthProvider, _React$Component);
71
71
 
72
72
  var _super = _createSuper(WidthProvider);
@@ -131,7 +131,7 @@ function WidthProvideRGL
131
131
 
132
132
  if (measureBeforeMount && !this.mounted) {
133
133
  return /*#__PURE__*/React.createElement("div", {
134
- className: (0, _classnames.default)(this.props.className, layoutClassName),
134
+ className: (0, _clsx.default)(this.props.className, layoutClassName),
135
135
  style: this.props.style // $FlowIgnore ref types
136
136
  ,
137
137
  ref: this.elementRef
@@ -151,5 +151,5 @@ function WidthProvideRGL
151
151
  // If true, will not render children until mounted. Useful for getting the exact width before
152
152
  // rendering, to prevent any unsightly resizing.
153
153
  measureBeforeMount: _propTypes.default.bool
154
- }), _temp;
154
+ }), _class;
155
155
  }
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.findOrGenerateResponsiveLayout = findOrGenerateResponsiveLayout;
6
7
  exports.getBreakpointFromWidth = getBreakpointFromWidth;
7
8
  exports.getColsFromBreakpoint = getColsFromBreakpoint;
8
- exports.findOrGenerateResponsiveLayout = findOrGenerateResponsiveLayout;
9
9
  exports.sortBreakpoints = sortBreakpoints;
10
10
 
11
11
  var _utils = require("./utils");