react-grid-layout 1.2.4 → 1.2.5

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/lib/GridItem.jsx CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  clamp
14
14
  } from "./calculateUtils";
15
15
  import {
16
- resizeHandlesType,
16
+ resizeHandleAxesType,
17
17
  resizeHandleType
18
18
  } from "./ReactGridLayoutPropTypes";
19
19
  import classNames from "classnames";
@@ -29,7 +29,7 @@ import type {
29
29
 
30
30
  import type { PositionParams } from "./calculateUtils";
31
31
  import type {
32
- ResizeHandles,
32
+ ResizeHandleAxis,
33
33
  ResizeHandle,
34
34
  ReactRef
35
35
  } from "./ReactGridLayoutPropTypes";
@@ -82,7 +82,7 @@ type Props = {
82
82
  maxH: number,
83
83
  i: string,
84
84
 
85
- resizeHandles?: ResizeHandles,
85
+ resizeHandles?: ResizeHandleAxis[],
86
86
  resizeHandle?: ResizeHandle,
87
87
 
88
88
  onDrag?: GridItemCallback<GridDragEvent>,
@@ -159,7 +159,7 @@ export default class GridItem extends React.Component<Props, State> {
159
159
  i: PropTypes.string.isRequired,
160
160
 
161
161
  // Resize handle options
162
- resizeHandles: resizeHandlesType,
162
+ resizeHandles: resizeHandleAxesType,
163
163
  resizeHandle: resizeHandleType,
164
164
 
165
165
  // Functions
@@ -394,9 +394,9 @@ export default class GridItem extends React.Component<Props, State> {
394
394
  ];
395
395
  return (
396
396
  <Resizable
397
+ // These are opts for the resize handle itself
397
398
  draggableOpts={{
398
399
  disabled: !isResizable,
399
- nodeRef: this.elementRef
400
400
  }}
401
401
  className={isResizable ? undefined : "react-resizable-hide"}
402
402
  width={position.width}
@@ -8,17 +8,17 @@ import type {
8
8
  } from "react";
9
9
  import type { EventCallback, CompactType, Layout, LayoutItem } from "./utils";
10
10
 
11
- type ResizeHandleAxis = "s" | "w" | "e" | "n" | "sw" | "nw" | "se" | "ne";
12
- export type ResizeHandles = Array<ResizeHandleAxis>;
13
- export type ResizeHandle =
14
- | ReactElement<any>
15
- | ((resizeHandleAxis: ResizeHandleAxis) => ReactElement<any>);
16
-
17
11
  // util
18
12
  export type ReactRef<T: HTMLElement> = {|
19
13
  +current: T | null
20
14
  |};
21
15
 
16
+ export type ResizeHandleAxis = "s" | "w" | "e" | "n" | "sw" | "nw" | "se" | "ne";
17
+ export type ResizeHandle =
18
+ | ReactElement<any>
19
+ | ((resizeHandleAxis: ResizeHandleAxis, ref: ReactRef<HTMLElement>) => ReactElement<any>);
20
+
21
+
22
22
  // Defines which resize handles should be rendered (default: 'se')
23
23
  // Allows for any combination of:
24
24
  // 's' - South handle (bottom-center)
@@ -29,7 +29,7 @@ export type ReactRef<T: HTMLElement> = {|
29
29
  // 'nw' - Northwest handle (top-left)
30
30
  // 'se' - Southeast handle (bottom-right)
31
31
  // 'ne' - Northeast handle (top-right)
32
- export const resizeHandlesType: ReactPropsChainableTypeChecker = PropTypes.arrayOf(
32
+ export const resizeHandleAxesType: ReactPropsChainableTypeChecker = PropTypes.arrayOf(
33
33
  PropTypes.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])
34
34
  );
35
35
  // Custom component for resize handles
@@ -60,7 +60,7 @@ export type Props = {|
60
60
  useCSSTransforms: boolean,
61
61
  transformScale: number,
62
62
  droppingItem: $Shape<LayoutItem>,
63
- resizeHandles: ResizeHandles,
63
+ resizeHandles: ResizeHandleAxis[],
64
64
  resizeHandle?: ResizeHandle,
65
65
 
66
66
  // Callbacks
@@ -169,7 +169,7 @@ export default {
169
169
  isDroppable: PropTypes.bool,
170
170
 
171
171
  // Resize handle options
172
- resizeHandles: resizeHandlesType,
172
+ resizeHandles: resizeHandleAxesType,
173
173
  resizeHandle: resizeHandleType,
174
174
 
175
175
  //
package/lib/utils.js CHANGED
@@ -328,6 +328,11 @@ export function compactItem(
328
328
  l.y++;
329
329
  }
330
330
  }
331
+
332
+ // Ensure that there are no negative positions
333
+ l.y = Math.max(l.y, 0);
334
+ l.x = Math.max(l.x, 0);
335
+
331
336
  return l;
332
337
  }
333
338
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-grid-layout",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "A draggable and resizable grid layout with responsive breakpoints, for React.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,51 +35,52 @@
35
35
  },
36
36
  "homepage": "https://github.com/STRML/react-grid-layout",
37
37
  "dependencies": {
38
- "classnames": "2.x",
38
+ "classnames": "2.3.1",
39
39
  "lodash.isequal": "^4.0.0",
40
40
  "prop-types": "^15.0.0",
41
41
  "react-draggable": "^4.0.0",
42
- "react-resizable": "^1.10.0"
42
+ "react-resizable": "^3.0.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@babel/cli": "^7.13.0",
46
- "@babel/core": "^7.13.8",
45
+ "@babel/cli": "^7.13.16",
46
+ "@babel/core": "^7.14.0",
47
47
  "@babel/plugin-proposal-class-properties": "^7.13.0",
48
48
  "@babel/plugin-transform-flow-comments": "^7.12.13",
49
- "@babel/preset-env": "^7.13.8",
50
- "@babel/preset-flow": "^7.12.13",
51
- "@babel/preset-react": "^7.12.13",
52
- "@babel/register": "^7.13.8",
49
+ "@babel/preset-env": "^7.14.1",
50
+ "@babel/preset-flow": "^7.13.13",
51
+ "@babel/preset-react": "^7.13.13",
52
+ "@babel/register": "^7.13.16",
53
+ "@webpack-cli/serve": "^1.4.0",
53
54
  "babel-eslint": "^10.1.0",
54
55
  "babel-jest": "^26.6.3",
55
56
  "babel-loader": "^8.2.2",
56
57
  "babel-plugin-preval": "^5.0.0",
57
- "css-loader": "^5.1.1",
58
+ "css-loader": "^5.2.4",
58
59
  "ejs": "^3.1.6",
59
60
  "enzyme": "^3.11.0",
60
61
  "enzyme-adapter-react-16": "^1.15.6",
61
- "enzyme-to-json": "^3.6.1",
62
- "eslint": "^7.21.0",
63
- "eslint-plugin-flowtype": "^5.3.1",
64
- "eslint-plugin-mocha": "^8.0.0",
65
- "eslint-plugin-react": "^7.22.0",
62
+ "enzyme-to-json": "^3.6.2",
63
+ "eslint": "^7.26.0",
64
+ "eslint-plugin-flowtype": "^5.7.2",
65
+ "eslint-plugin-mocha": "^8.1.0",
66
+ "eslint-plugin-react": "^7.23.2",
66
67
  "exports-loader": "^2.0.0",
67
- "flow-bin": "^0.145.0",
68
- "husky": "^5.1.2",
68
+ "flow-bin": "^0.150.1",
69
+ "husky": "^6.0.0",
69
70
  "imports-loader": "^2.0.0",
70
71
  "jest": "^26.6.3",
71
- "lint-staged": "^10.5.4",
72
+ "lint-staged": "^11.0.0",
72
73
  "lodash": "^4.17.21",
73
74
  "opener": "^1.5.2",
74
- "prettier": "^2.2.1",
75
+ "prettier": "^2.3.0",
75
76
  "react": "^16.13.1",
76
77
  "react-dom": "^16.13.1",
77
78
  "react-hot-loader": "^4.13.0",
78
79
  "react-transform-hmr": "^1.0.2",
79
80
  "style-loader": "^2.0.0",
80
81
  "timsort": "^0.3.0",
81
- "webpack": "^5.24.2",
82
- "webpack-cli": "^4.5.0",
82
+ "webpack": "^5.36.2",
83
+ "webpack-cli": "^4.7.0",
83
84
  "webpack-dev-server": "^3.11.2"
84
85
  },
85
86
  "peerDependencies": {
package/.husky/pre-commit DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- yarn lint-staged
5
- make lint
6
- make test
package/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 10
4
- - 12
5
- - "lts/*"
6
- script:
7
- - make build test
8
- cache: yarn
9
-