react-grid-layout 0.17.0 → 0.17.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ 0.17.1 (Oct 29, 2019)
4
+ ----
5
+
6
+ ### Bugfixes
7
+
8
+ - Surround `navigator` check in `try/catch` to avoid problems with mocked navigators [#1057](https://github.com/STRML/react-grid-layout/pull/1054)
9
+ - TransformScale is not applied properly while dragging an element [#1046](https://github.com/STRML/react-grid-layout/pull/1054)
10
+
3
11
  0.17.0 (Oct 24, 2019)
4
12
  ----
5
13
 
@@ -9,7 +17,7 @@ Thanks to @daynin and @n1ghtmare for taking an active role in maintaining RGL, a
9
17
 
10
18
  ### New Features
11
19
 
12
- - Added ability to drag items into the grid from outside. [#980](https://github.com/STRML/react-grid-layout/pull/980). See [the example](https://strml.github.io/react-grid-layout/examples/15-drag-from-outside.html).
20
+ - Added ability to drag items into the grid from outside. [#980](https://github.com/STRML/react-grid-layout/pull/980). See [the example](https://strml.github.io/react-grid-layout/examples/15-drag-from-outside.html).
13
21
  - This is especially exciting as it opens up new "widget toolbox" use cases such as [Example 14](https://strml.github.io/react-grid-layout/examples/14-toolbox.html) with more intuitive interaction. Thanks @daynin.
14
22
  - `transformScale` prop [#987](https://github.com/STRML/react-grid-layout/pull/987)
15
23
  - `<ResponsiveReactGridLayout>` now supports margin-per-breakpoint [#1016](https://github.com/STRML/react-grid-layout/pull/1016)
package/build/GridItem.js CHANGED
@@ -450,7 +450,8 @@ function (_React$Component) {
450
450
  onDrag: this.onDrag,
451
451
  onStop: this.onDragStop,
452
452
  handle: this.props.handle,
453
- cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : "")
453
+ cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
454
+ scale: this.props.transformScale
454
455
  }, child);
455
456
  }
456
457
  /**
@@ -65,11 +65,18 @@ var compactType = function compactType(props
65
65
  };
66
66
 
67
67
  var layoutClassName = "react-grid-layout";
68
- var isFirefox = navigator.userAgent.toLowerCase().includes("firefox");
68
+ var isFirefox = false; // Try...catch will protect from navigator not existing (e.g. node) or a bad implementation of navigator
69
+
70
+ try {
71
+ isFirefox = navigator.userAgent.toLowerCase().includes("firefox");
72
+ } catch (e) {}
73
+ /* Ignore */
74
+
69
75
  /**
70
76
  * A reactive, fluid grid layout with draggable, resizable components.
71
77
  */
72
78
 
79
+
73
80
  var ReactGridLayout =
74
81
  /*#__PURE__*/
75
82
  function (_React$Component) {
package/lib/GridItem.jsx CHANGED
@@ -248,17 +248,19 @@ export default class GridItem extends React.Component<Props, State> {
248
248
  if (state && state.resizing) {
249
249
  out.width = Math.round(state.resizing.width);
250
250
  out.height = Math.round(state.resizing.height);
251
- }
251
+ }
252
252
  // Otherwise, calculate from grid units.
253
253
  else {
254
254
  // 0 * Infinity === NaN, which causes problems with resize constraints;
255
255
  // Fix this if it occurs.
256
256
  // Note we do it here rather than later because Math.round(Infinity) causes deopt
257
- out.width = w === Infinity
257
+ out.width =
258
+ w === Infinity
258
259
  ? w
259
260
  : Math.round(colWidth * w + Math.max(0, w - 1) * margin[0]);
260
- out.height = h === Infinity
261
- ? h
261
+ out.height =
262
+ h === Infinity
263
+ ? h
262
264
  : Math.round(rowHeight * h + Math.max(0, h - 1) * margin[1]);
263
265
  }
264
266
 
@@ -266,7 +268,7 @@ export default class GridItem extends React.Component<Props, State> {
266
268
  if (state && state.dragging) {
267
269
  out.top = Math.round(state.dragging.top);
268
270
  out.left = Math.round(state.dragging.left);
269
- }
271
+ }
270
272
  // Otherwise, calculate from grid units.
271
273
  else {
272
274
  out.top = Math.round((rowHeight + margin[1]) * y + containerPadding[1]);
@@ -378,6 +380,7 @@ export default class GridItem extends React.Component<Props, State> {
378
380
  ".react-resizable-handle" +
379
381
  (this.props.cancel ? "," + this.props.cancel : "")
380
382
  }
383
+ scale={this.props.transformScale}
381
384
  >
382
385
  {child}
383
386
  </DraggableCore>
@@ -97,7 +97,13 @@ const compactType = (props: Props): CompactType => {
97
97
  };
98
98
 
99
99
  const layoutClassName = "react-grid-layout";
100
- const isFirefox = navigator.userAgent.toLowerCase().includes("firefox");
100
+ let isFirefox = false;
101
+ // Try...catch will protect from navigator not existing (e.g. node) or a bad implementation of navigator
102
+ try {
103
+ isFirefox = navigator.userAgent.toLowerCase().includes("firefox");
104
+ } catch (e) {
105
+ /* Ignore */
106
+ }
101
107
 
102
108
  /**
103
109
  * A reactive, fluid grid layout with draggable, resizable components.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-grid-layout",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "A draggable and resizable grid layout with responsive breakpoints, for React.",
5
5
  "main": "index.js",
6
6
  "scripts": {