react-grid-layout 1.2.2 → 1.3.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/.flowconfig +1 -3
- package/CHANGELOG.md +55 -0
- package/README.md +55 -16
- package/build/GridItem.js +14 -20
- package/build/ReactGridLayout.js +299 -319
- package/build/ReactGridLayoutPropTypes.js +11 -5
- package/build/ResponsiveReactGridLayout.js +12 -6
- package/build/calculateUtils.js +6 -6
- package/build/components/WidthProvider.js +31 -25
- package/build/fastRGLPropsEqual.js +1 -1
- package/build/utils.js +29 -32
- package/dist/react-grid-layout.min.js +1 -1
- package/dist/react-grid-layout.min.js.LICENSE.txt +1 -1
- package/dist/react-grid-layout.min.js.map +1 -1
- package/foo.html +388 -0
- package/lib/GridItem.jsx +18 -14
- package/lib/ReactGridLayout.jsx +93 -58
- package/lib/ReactGridLayoutPropTypes.js +40 -14
- package/lib/ResponsiveReactGridLayout.jsx +7 -1
- package/lib/components/WidthProvider.jsx +35 -23
- package/lib/utils.js +30 -20
- package/package.json +35 -29
- package/.husky/pre-commit +0 -6
- package/.travis.yml +0 -9
package/.flowconfig
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
1.3.0 (Aug 27, 2021)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
### New Features
|
|
7
|
+
- `allowOverlap` prop, when `true`, allows overlapping grid items. [#1470](https://github.com/react-grid-layout/react-grid-layout/pull/1470)
|
|
8
|
+
- Add `onDropDragOver` callback. [#1395](https://github.com/react-grid-layout/react-grid-layout/pull/1395)
|
|
9
|
+
- Use this callback to dynamically adjust the `droppingItem` based on what is being dragged over. Return `w` and `h` to adjust the item. It is then [spread into the dropping placeholder](https://github.com/react-grid-layout/react-grid-layout/pull/1395/files#diff-83ab569936bfd4bf0460a4f23653ecbe8bc88509062c95e75c9402218b2b8733R609).
|
|
10
|
+
- This callback has the type:
|
|
11
|
+
- `onDragOver: (e: DragOverEvent) => { w: number, h: number } | false;`
|
|
12
|
+
- Return `false` to short-circuit the dragover.
|
|
13
|
+
|
|
14
|
+
### Bugfixes
|
|
15
|
+
- Remove sorting when `compactType` is `null`. [#1474](https://github.com/react-grid-layout/react-grid-layout/pull/1474)
|
|
16
|
+
- Droppable fixes for Chrome behavior. [#1442](https://github.com/react-grid-layout/react-grid-layout/issues/1442) [#1448](https://github.com/react-grid-layout/react-grid-layout/issues/1442)
|
|
17
|
+
- Allow `null` children as a convenience so that inline expressions don't break the library. [#1296](https://github.com/react-grid-layout/react-grid-layout/pull/1296)
|
|
18
|
+
- Various dependency upgrades.
|
|
19
|
+
|
|
20
|
+
### Documentation
|
|
21
|
+
- Add docs on using custom components as grid children.
|
|
22
|
+
- Note required class on resizable handles for proper styling.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
1.2.5 (May 10, 2021)
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
### Bugfixes
|
|
29
|
+
- Ensure no negative positions are possible when compacting
|
|
30
|
+
- Thanks @DonnyLi [#829](https://github.com/react-grid-layout/react-grid-layout/pull/829)
|
|
31
|
+
- Fixes [#535](https://github.com/react-grid-layout/react-grid-layout/issues/535)
|
|
32
|
+
- Fix resizing on mobile. This was caused by the `ref` refactor to remove ReactDOM in 1.2.3.
|
|
33
|
+
- Fixes #[1458](https://github.com/react-grid-layout/react-grid-layout/issues/1458)
|
|
34
|
+
- Note: this upgrades `react-resizable` to `3.0.1`, which like our other deps, is only compatible with `React@>=16.3`.
|
|
35
|
+
|
|
36
|
+
### Documentation
|
|
37
|
+
- Document new arity of `resizeHandle` (`(axis: ResizeHandleAxis, ref: ReactRef<HTMLElement>) => React$Element`)
|
|
38
|
+
- Remove references to the deprecated `verticalCompact` prop
|
|
39
|
+
|
|
40
|
+
1.2.4 (Mar 18, 2021)
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
*This version fixes a serious render bug in `<WidthProvider>`. 1.2.3 should not be used.*
|
|
44
|
+
|
|
45
|
+
### Bugfixes
|
|
46
|
+
- Fix failure to mount when layout is WidthProvider-wrapped and `measureBeforeMount` is `true`.
|
|
47
|
+
- Ref: [#1428](https://github.com/react-grid-layout/react-grid-layout/issues/1428)
|
|
48
|
+
- `<WidthProvider>` no longer updates grid with if it has been set to 0. This prevents unnecessary updates
|
|
49
|
+
if the grid is set to `display: none;`. Thanks @405go [#1427](https://github.com/react-grid-layout/react-grid-layout/pull/1427)
|
|
50
|
+
|
|
51
|
+
1.2.3 (Mar 16, 2021)
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### New Features
|
|
55
|
+
- React-Grid-Layout is now fully compatible with `<React.StrictMode>`.
|
|
56
|
+
- Usage of `ReactDOM` has been removed by using `React.createRef()` inside RGL, and the new [`nodeRef` prop](https://github.com/react-grid-layout/react-draggable/blob/master/CHANGELOG.md#440-may-12-2020) in `react-draggable`.
|
|
57
|
+
|
|
3
58
|
1.2.2 (Mar 1, 2021)
|
|
4
59
|
---
|
|
5
60
|
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ RGL is React-only and does not require jQuery.
|
|
|
16
16
|

|
|
17
17
|
> GIF from production usage on [BitMEX.com](https://www.bitmex.com)
|
|
18
18
|
|
|
19
|
-
[**[Demo](https://react-grid-layout.github.io/react-grid-layout/
|
|
19
|
+
[**[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)**]
|
|
20
20
|
|
|
21
21
|
## Table of Contents
|
|
22
22
|
|
|
@@ -55,6 +55,7 @@ RGL is React-only and does not require jQuery.
|
|
|
55
55
|
1. [Bounded Layout](https://react-grid-layout.github.io/react-grid-layout/examples/16-bounded.html)
|
|
56
56
|
1. [Resizable Handles](https://react-grid-layout.github.io/react-grid-layout/examples/17-resizable-handles.html)
|
|
57
57
|
1. [Scaled Containers](https://react-grid-layout.github.io/react-grid-layout/examples/18-scale.html)
|
|
58
|
+
1. [Allow Overlap](https://react-grid-layout.github.io/react-grid-layout/examples/19-allow-overlap.html)
|
|
58
59
|
|
|
59
60
|
#### Projects Using React-Grid-Layout
|
|
60
61
|
|
|
@@ -74,6 +75,7 @@ RGL is React-only and does not require jQuery.
|
|
|
74
75
|
- [Hakkiri](https://www.hakkiri.io)
|
|
75
76
|
- [Ubidots](https://help.ubidots.com/en/articles/2400308-create-dashboards-and-widgets)
|
|
76
77
|
- [Statsout](https://statsout.com/)
|
|
78
|
+
- [Datto RMM](https://www.datto.com/uk/products/rmm/)
|
|
77
79
|
|
|
78
80
|
*Know of others? Create a PR to let me know!*
|
|
79
81
|
|
|
@@ -92,11 +94,12 @@ RGL is React-only and does not require jQuery.
|
|
|
92
94
|
* Separate layouts per responsive breakpoint
|
|
93
95
|
* Grid Items placed using CSS Transforms
|
|
94
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>`
|
|
95
98
|
|
|
96
99
|
|Version | Compatibility |
|
|
97
100
|
|----------------|------------------|
|
|
98
|
-
| >= 0.17.0 | React
|
|
99
|
-
| >= 0.11.3 | React 0.14 &
|
|
101
|
+
| >= 0.17.0 | React 16 & 17 |
|
|
102
|
+
| >= 0.11.3 | React 0.14 & 15 |
|
|
100
103
|
| >= 0.10.0 | React 0.14 |
|
|
101
104
|
| 0.8. - 0.9.2 | React 0.13 |
|
|
102
105
|
| < 0.8 | React 0.12 |
|
|
@@ -265,6 +268,7 @@ cols: ?number = 12,
|
|
|
265
268
|
// A CSS selector for tags that will not be draggable.
|
|
266
269
|
// For example: draggableCancel:'.MyNonDraggableAreaClassName'
|
|
267
270
|
// If you forget the leading . it will not work.
|
|
271
|
+
// .react-resizable-handle" is always prepended to this value.
|
|
268
272
|
draggableCancel: ?string = '',
|
|
269
273
|
|
|
270
274
|
// A CSS selector for tags that will act as the draggable handle.
|
|
@@ -272,9 +276,6 @@ draggableCancel: ?string = '',
|
|
|
272
276
|
// If you forget the leading . it will not work.
|
|
273
277
|
draggableHandle: ?string = '',
|
|
274
278
|
|
|
275
|
-
// If true, the layout will compact vertically
|
|
276
|
-
verticalCompact: ?boolean = true,
|
|
277
|
-
|
|
278
279
|
// Compaction type.
|
|
279
280
|
compactType: ?('vertical' | 'horizontal') = 'vertical';
|
|
280
281
|
|
|
@@ -317,9 +318,12 @@ useCSSTransforms: ?boolean = true,
|
|
|
317
318
|
// we should set scale coefficient to avoid render artefacts while dragging.
|
|
318
319
|
transformScale: ?number = 1,
|
|
319
320
|
|
|
321
|
+
// If true, grid can be placed one over the other.
|
|
322
|
+
allowOverlap: ?boolean = false,
|
|
323
|
+
|
|
320
324
|
// If true, grid items won't change position when being
|
|
321
325
|
// dragged over.
|
|
322
|
-
preventCollision: ?boolean = false
|
|
326
|
+
preventCollision: ?boolean = false,
|
|
323
327
|
|
|
324
328
|
// If true, droppable elements (with `draggable={true}` attribute)
|
|
325
329
|
// can be dropped on the grid. It triggers "onDrop" callback
|
|
@@ -331,7 +335,7 @@ preventCollision: ?boolean = false;
|
|
|
331
335
|
// along with `draggable={true}` otherwise this feature will work incorrect.
|
|
332
336
|
// onDragStart attribute is required for Firefox for a dragging initialization
|
|
333
337
|
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=568313
|
|
334
|
-
isDroppable: ?boolean = false
|
|
338
|
+
isDroppable: ?boolean = false,
|
|
335
339
|
// Defines which resize handles should be rendered
|
|
336
340
|
// Allows for any combination of:
|
|
337
341
|
// 's' - South handle (bottom-center)
|
|
@@ -342,9 +346,12 @@ isDroppable: ?boolean = false
|
|
|
342
346
|
// 'nw' - Northwest handle (top-left)
|
|
343
347
|
// 'se' - Southeast handle (bottom-right)
|
|
344
348
|
// 'ne' - Northeast handle (top-right)
|
|
345
|
-
resizeHandles: ?Array<'s' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne'> = ['se']
|
|
349
|
+
resizeHandles: ?Array<'s' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne'> = ['se'],
|
|
346
350
|
// Custom component for resize handles
|
|
347
|
-
|
|
351
|
+
// See `handle` as used in https://github.com/react-grid-layout/react-resizable#resize-handle
|
|
352
|
+
// Your component should have the class `.react-resizable-handle`, or you should add your custom
|
|
353
|
+
// class to the `draggableCancel` prop.
|
|
354
|
+
resizeHandle?: ReactElement<any> | ((resizeHandleAxis: ResizeHandleAxis, ref: ReactRef<HTMLElement>) => ReactElement<any>),
|
|
348
355
|
|
|
349
356
|
//
|
|
350
357
|
// Callbacks
|
|
@@ -359,7 +366,7 @@ onLayoutChange: (layout: Layout) => void,
|
|
|
359
366
|
// 'start' and 'stop' callbacks pass `undefined` for 'placeholder'.
|
|
360
367
|
//
|
|
361
368
|
type ItemCallback = (layout: Layout, oldItem: LayoutItem, newItem: LayoutItem,
|
|
362
|
-
placeholder: LayoutItem, e: MouseEvent, element: HTMLElement) => void
|
|
369
|
+
placeholder: LayoutItem, e: MouseEvent, element: HTMLElement) => void,
|
|
363
370
|
|
|
364
371
|
// Calls when drag starts.
|
|
365
372
|
onDragStart: ItemCallback,
|
|
@@ -373,12 +380,21 @@ onResizeStart: ItemCallback,
|
|
|
373
380
|
onResize: ItemCallback,
|
|
374
381
|
// Calls when resize is complete.
|
|
375
382
|
onResizeStop: ItemCallback,
|
|
383
|
+
|
|
384
|
+
//
|
|
385
|
+
// Dropover functionality
|
|
386
|
+
//
|
|
387
|
+
|
|
376
388
|
// Calls when an element has been dropped into the grid from outside.
|
|
377
|
-
onDrop: (layout: Layout, item: ?LayoutItem, e: Event) => void
|
|
389
|
+
onDrop: (layout: Layout, item: ?LayoutItem, e: Event) => void,
|
|
390
|
+
// Calls when an element is being dragged over the grid from outside as above.
|
|
391
|
+
// This callback should return an object to dynamically change the droppingItem size
|
|
392
|
+
// Return false to short-circuit the dragover
|
|
393
|
+
onDropDragOver: (e: DragOverEvent) => ?({|w?: number, h?: number|} | false),
|
|
378
394
|
|
|
379
395
|
// Ref for getting a reference for the grid's wrapping div.
|
|
380
396
|
// You can use this instead of a regular ref and the deprecated `ReactDOM.findDOMNode()`` function.
|
|
381
|
-
innerRef: ?React.Ref<"div"
|
|
397
|
+
innerRef: ?React.Ref<"div">,
|
|
382
398
|
```
|
|
383
399
|
|
|
384
400
|
### Responsive Grid Layout Props
|
|
@@ -396,16 +412,16 @@ cols: ?Object = {lg: 12, md: 10, sm: 6, xs: 4, xxs: 2},
|
|
|
396
412
|
|
|
397
413
|
|
|
398
414
|
// margin (in pixels). Can be specified either as horizontal and vertical margin, e.g. `[10, 10]` or as a breakpoint -> margin map, e.g. `{lg: [10, 10], md: [10, 10], ...}.
|
|
399
|
-
margin: [number, number] | {[breakpoint: $Keys<breakpoints>]: [number, number]}
|
|
415
|
+
margin: [number, number] | {[breakpoint: $Keys<breakpoints>]: [number, number]},
|
|
400
416
|
|
|
401
417
|
|
|
402
418
|
// containerPadding (in pixels). Can be specified either as horizontal and vertical padding, e.g. `[10, 10]` or as a breakpoint -> containerPadding map, e.g. `{lg: [10, 10], md: [10, 10], ...}.
|
|
403
|
-
containerPadding: [number, number] | {[breakpoint: $Keys<breakpoints>]: [number, number]}
|
|
419
|
+
containerPadding: [number, number] | {[breakpoint: $Keys<breakpoints>]: [number, number]},
|
|
404
420
|
|
|
405
421
|
|
|
406
422
|
// layouts is an object mapping breakpoints to layouts.
|
|
407
423
|
// e.g. {lg: Layout, md: Layout, ...}
|
|
408
|
-
layouts: {[key: $Keys<breakpoints>]: Layout}
|
|
424
|
+
layouts: {[key: $Keys<breakpoints>]: Layout},
|
|
409
425
|
|
|
410
426
|
//
|
|
411
427
|
// Callbacks
|
|
@@ -508,6 +524,29 @@ function MyGrid(props) {
|
|
|
508
524
|
|
|
509
525
|
Because the `children` prop doesn't change between rerenders, updates to `<MyGrid>` won't result in new renders, improving performance.
|
|
510
526
|
|
|
527
|
+
### Custom Child Components and Draggable Handles
|
|
528
|
+
|
|
529
|
+
If you use React Components as grid children, they need to do a few things:
|
|
530
|
+
|
|
531
|
+
1. Forward refs to an underlying DOM node, and
|
|
532
|
+
2. Forward `style` and `className` to that same DOM node.
|
|
533
|
+
|
|
534
|
+
For example:
|
|
535
|
+
|
|
536
|
+
```js
|
|
537
|
+
const CustomGridItemComponent = React.forwardRef(({style, className, ...props}, ref) => {
|
|
538
|
+
return (
|
|
539
|
+
<div style={{ /* styles */, ...style}} className={className} ref={ref}>
|
|
540
|
+
{/* Some other content */}
|
|
541
|
+
</div>
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
The same is true of custom elements as draggable handles using the `draggableHandle` prop. This is so that
|
|
547
|
+
the underlying `react-draggable` library can get a reference to the DOM node underneath, manipulate
|
|
548
|
+
positioning via `style`, and set classes.
|
|
549
|
+
|
|
511
550
|
## Contribute
|
|
512
551
|
|
|
513
552
|
If you have a feature request, please add it as an issue or make a pull request.
|
package/build/GridItem.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
-
|
|
14
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
13
|
|
|
16
14
|
var _reactDraggable = require("react-draggable");
|
|
@@ -27,7 +25,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
27
25
|
|
|
28
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
27
|
|
|
30
|
-
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); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
31
29
|
|
|
32
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; }
|
|
33
31
|
|
|
@@ -43,7 +41,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
43
41
|
|
|
44
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); }; }
|
|
45
43
|
|
|
46
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
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); }
|
|
47
45
|
|
|
48
46
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
47
|
|
|
@@ -78,7 +76,7 @@ var GridItem = /*#__PURE__*/function (_React$Component) {
|
|
|
78
76
|
className: ""
|
|
79
77
|
});
|
|
80
78
|
|
|
81
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "elementRef", /*#__PURE__*/_react.default.createRef());
|
|
82
80
|
|
|
83
81
|
_defineProperty(_assertThisInitialized(_this), "onDragStart", function (e, _ref) {
|
|
84
82
|
var node = _ref.node;
|
|
@@ -273,26 +271,19 @@ var GridItem = /*#__PURE__*/function (_React$Component) {
|
|
|
273
271
|
) {
|
|
274
272
|
var droppingPosition = this.props.droppingPosition;
|
|
275
273
|
if (!droppingPosition) return;
|
|
274
|
+
var node = this.elementRef.current; // Can't find DOM node (are we unmounted?)
|
|
275
|
+
|
|
276
|
+
if (!node) return;
|
|
276
277
|
var prevDroppingPosition = prevProps.droppingPosition || {
|
|
277
278
|
left: 0,
|
|
278
279
|
top: 0
|
|
279
280
|
};
|
|
280
281
|
var dragging = this.state.dragging;
|
|
281
|
-
|
|
282
|
-
if (!this.currentNode) {
|
|
283
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
284
|
-
this.currentNode = ((_reactDom.default.findDOMNode(this)
|
|
285
|
-
/*: any*/
|
|
286
|
-
)
|
|
287
|
-
/*: HTMLElement*/
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
282
|
var shouldDrag = dragging && droppingPosition.left !== prevDroppingPosition.left || droppingPosition.top !== prevDroppingPosition.top;
|
|
292
283
|
|
|
293
284
|
if (!dragging) {
|
|
294
285
|
this.onDragStart(droppingPosition.e, {
|
|
295
|
-
node:
|
|
286
|
+
node: node,
|
|
296
287
|
deltaX: droppingPosition.left,
|
|
297
288
|
deltaY: droppingPosition.top
|
|
298
289
|
});
|
|
@@ -300,7 +291,7 @@ var GridItem = /*#__PURE__*/function (_React$Component) {
|
|
|
300
291
|
var deltaX = droppingPosition.left - dragging.left;
|
|
301
292
|
var deltaY = droppingPosition.top - dragging.top;
|
|
302
293
|
this.onDrag(droppingPosition.e, {
|
|
303
|
-
node:
|
|
294
|
+
node: node,
|
|
304
295
|
deltaX: deltaX,
|
|
305
296
|
deltaY: deltaY
|
|
306
297
|
});
|
|
@@ -383,7 +374,8 @@ var GridItem = /*#__PURE__*/function (_React$Component) {
|
|
|
383
374
|
onStop: this.onDragStop,
|
|
384
375
|
handle: this.props.handle,
|
|
385
376
|
cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
|
|
386
|
-
scale: this.props.transformScale
|
|
377
|
+
scale: this.props.transformScale,
|
|
378
|
+
nodeRef: this.elementRef
|
|
387
379
|
}, child);
|
|
388
380
|
}
|
|
389
381
|
/**
|
|
@@ -422,7 +414,8 @@ var GridItem = /*#__PURE__*/function (_React$Component) {
|
|
|
422
414
|
var maxes = (0, _calculateUtils.calcGridItemPosition)(positionParams, 0, 0, maxW, maxH);
|
|
423
415
|
var minConstraints = [mins.width, mins.height];
|
|
424
416
|
var maxConstraints = [Math.min(maxes.width, maxWidth), Math.min(maxes.height, Infinity)];
|
|
425
|
-
return /*#__PURE__*/_react.default.createElement(_reactResizable.Resizable
|
|
417
|
+
return /*#__PURE__*/_react.default.createElement(_reactResizable.Resizable // These are opts for the resize handle itself
|
|
418
|
+
, {
|
|
426
419
|
draggableOpts: {
|
|
427
420
|
disabled: !isResizable
|
|
428
421
|
},
|
|
@@ -518,6 +511,7 @@ var GridItem = /*#__PURE__*/function (_React$Component) {
|
|
|
518
511
|
|
|
519
512
|
|
|
520
513
|
var newChild = /*#__PURE__*/_react.default.cloneElement(child, {
|
|
514
|
+
ref: this.elementRef,
|
|
521
515
|
className: (0, _classnames.default)("react-grid-item", child.props.className, this.props.className, {
|
|
522
516
|
static: this.props.static,
|
|
523
517
|
resizing: Boolean(this.state.resizing),
|
|
@@ -598,7 +592,7 @@ _defineProperty(GridItem, "propTypes", {
|
|
|
598
592
|
// ID is nice to have for callbacks
|
|
599
593
|
i: _propTypes.default.string.isRequired,
|
|
600
594
|
// Resize handle options
|
|
601
|
-
resizeHandles: _ReactGridLayoutPropTypes.
|
|
595
|
+
resizeHandles: _ReactGridLayoutPropTypes.resizeHandleAxesType,
|
|
602
596
|
resizeHandle: _ReactGridLayoutPropTypes.resizeHandleType,
|
|
603
597
|
// Functions
|
|
604
598
|
onDragStop: _propTypes.default.func,
|