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 +1 -1
- package/CHANGELOG.md +21 -8
- package/README.md +1 -0
- package/build/GridItem.js +10 -14
- package/build/ReactGridLayout.js +19 -23
- package/build/ReactGridLayoutPropTypes.js +2 -2
- package/build/ResponsiveReactGridLayout.js +27 -25
- package/build/components/WidthProvider.js +19 -16
- package/build/utils.js +35 -27
- package/dist/react-grid-layout.min.js +1 -1
- package/dist/react-grid-layout.min.js.map +1 -1
- package/lib/GridItem.jsx +3 -3
- package/lib/utils.js +20 -4
- package/package.json +22 -15
- package/yarn-error.log +7780 -0
package/lib/GridItem.jsx
CHANGED
|
@@ -510,15 +510,15 @@ export default class GridItem extends React.Component<Props, State> {
|
|
|
510
510
|
const { offsetParent } = node;
|
|
511
511
|
|
|
512
512
|
if (offsetParent) {
|
|
513
|
-
const { margin, rowHeight
|
|
513
|
+
const { margin, rowHeight } = this.props;
|
|
514
514
|
const bottomBoundary =
|
|
515
515
|
offsetParent.clientHeight - calcGridItemWHPx(h, rowHeight, margin[1]);
|
|
516
|
-
top = clamp(top
|
|
516
|
+
top = clamp(top, 0, bottomBoundary);
|
|
517
517
|
|
|
518
518
|
const colWidth = calcGridColWidth(positionParams);
|
|
519
519
|
const rightBoundary =
|
|
520
520
|
containerWidth - calcGridItemWHPx(w, colWidth, margin[0]);
|
|
521
|
-
left = clamp(left
|
|
521
|
+
left = clamp(left, 0, rightBoundary);
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
|
package/lib/utils.js
CHANGED
|
@@ -239,6 +239,8 @@ export function compact(
|
|
|
239
239
|
): Layout {
|
|
240
240
|
// Statics go in the compareWith array right away so items flow around them.
|
|
241
241
|
const compareWith = getStatics(layout);
|
|
242
|
+
// We keep track of the bottom position.
|
|
243
|
+
let b = bottom(compareWith);
|
|
242
244
|
// We go through the items by row and column.
|
|
243
245
|
const sorted = sortLayoutItems(layout, compactType);
|
|
244
246
|
// Holding for new items.
|
|
@@ -249,7 +251,16 @@ export function compact(
|
|
|
249
251
|
|
|
250
252
|
// Don't move static elements
|
|
251
253
|
if (!l.static) {
|
|
252
|
-
l = compactItem(
|
|
254
|
+
l = compactItem(
|
|
255
|
+
compareWith,
|
|
256
|
+
l,
|
|
257
|
+
compactType,
|
|
258
|
+
cols,
|
|
259
|
+
sorted,
|
|
260
|
+
allowOverlap,
|
|
261
|
+
b
|
|
262
|
+
);
|
|
263
|
+
b = Math.max(b, l.y + l.h);
|
|
253
264
|
|
|
254
265
|
// Add to comparison array. We only collide with items before this one.
|
|
255
266
|
// Statics are already in this array.
|
|
@@ -319,7 +330,8 @@ export function compactItem(
|
|
|
319
330
|
compactType: CompactType,
|
|
320
331
|
cols: number,
|
|
321
332
|
fullLayout: Layout,
|
|
322
|
-
allowOverlap: ?boolean
|
|
333
|
+
allowOverlap: ?boolean,
|
|
334
|
+
b: ?number
|
|
323
335
|
): LayoutItem {
|
|
324
336
|
const compactV = compactType === "vertical";
|
|
325
337
|
const compactH = compactType === "horizontal";
|
|
@@ -327,7 +339,11 @@ export function compactItem(
|
|
|
327
339
|
// Bottom 'y' possible is the bottom of the layout.
|
|
328
340
|
// This allows you to do nice stuff like specify {y: Infinity}
|
|
329
341
|
// This is here because the layout must be sorted in order to get the correct bottom `y`.
|
|
330
|
-
|
|
342
|
+
if (typeof b === "number") {
|
|
343
|
+
l.y = Math.min(b, l.y);
|
|
344
|
+
} else {
|
|
345
|
+
l.y = Math.min(bottom(compareWith), l.y);
|
|
346
|
+
}
|
|
331
347
|
// Move the element up as far as it can go without colliding.
|
|
332
348
|
while (l.y > 0 && !getFirstCollision(compareWith, l)) {
|
|
333
349
|
l.y--;
|
|
@@ -619,7 +635,7 @@ export function moveElementAwayFromCollision(
|
|
|
619
635
|
layout,
|
|
620
636
|
itemToMove,
|
|
621
637
|
undefined,
|
|
622
|
-
|
|
638
|
+
itemToMove.y + 1,
|
|
623
639
|
isUserAction,
|
|
624
640
|
preventCollision,
|
|
625
641
|
compactType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-grid-layout",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "A draggable and resizable grid layout with responsive breakpoints, for React.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"build": "make build",
|
|
10
10
|
"build-example": "make build-example",
|
|
11
11
|
"view-example": "make view-example",
|
|
12
|
-
"dev": "make dev",
|
|
12
|
+
"dev": "npx @react-grab/claude-code@latest && make dev",
|
|
13
13
|
"prepublishOnly": "make build",
|
|
14
14
|
"validate": "npm ls",
|
|
15
15
|
"flow": "flow",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/STRML/react-grid-layout",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"clsx": "^2.
|
|
40
|
+
"clsx": "^2.1.1",
|
|
41
41
|
"fast-equals": "^4.0.3",
|
|
42
42
|
"prop-types": "^15.8.1",
|
|
43
|
-
"react-draggable": "^4.4.
|
|
43
|
+
"react-draggable": "^4.4.6",
|
|
44
44
|
"react-resizable": "^3.0.5",
|
|
45
45
|
"resize-observer-polyfill": "^1.5.1"
|
|
46
46
|
},
|
|
@@ -48,23 +48,23 @@
|
|
|
48
48
|
"fast-equals": "Bug in CRA5 causes fast-equals@5 to fail to import due to .cjs file. See https://github.com/react-grid-layout/react-grid-layout/issues/1904"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/cli": "^7.
|
|
52
|
-
"@babel/core": "^7.
|
|
53
|
-
"@babel/eslint-parser": "^7.
|
|
54
|
-
"@babel/plugin-
|
|
55
|
-
"@babel/plugin-transform-flow-comments": "^7.
|
|
56
|
-
"@babel/preset-env": "^7.
|
|
57
|
-
"@babel/preset-flow": "^7.
|
|
58
|
-
"@babel/preset-react": "^7.
|
|
59
|
-
"@babel/register": "^7.
|
|
51
|
+
"@babel/cli": "^7.27.2",
|
|
52
|
+
"@babel/core": "^7.27.4",
|
|
53
|
+
"@babel/eslint-parser": "^7.27.5",
|
|
54
|
+
"@babel/plugin-transform-class-properties": "^7.18.6",
|
|
55
|
+
"@babel/plugin-transform-flow-comments": "^7.27.3",
|
|
56
|
+
"@babel/preset-env": "^7.27.2",
|
|
57
|
+
"@babel/preset-flow": "^7.27.1",
|
|
58
|
+
"@babel/preset-react": "^7.27.1",
|
|
59
|
+
"@babel/register": "^7.27.1",
|
|
60
60
|
"@webpack-cli/serve": "^2.0.5",
|
|
61
61
|
"babel-jest": "^29.7.0",
|
|
62
62
|
"babel-loader": "^9.1.3",
|
|
63
63
|
"babel-plugin-preval": "^5.1.0",
|
|
64
64
|
"css-loader": "^6.8.1",
|
|
65
|
-
"ejs": "^3.1.
|
|
65
|
+
"ejs": "^3.1.10",
|
|
66
66
|
"enzyme": "^3.11.0",
|
|
67
|
-
"enzyme-adapter-react-16": "^1.15.
|
|
67
|
+
"enzyme-adapter-react-16": "^1.15.8",
|
|
68
68
|
"enzyme-to-json": "^3.6.2",
|
|
69
69
|
"eslint": "^8.54.0",
|
|
70
70
|
"eslint-plugin-flowtype": "^8.0.3",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"prettier": "^3.1.0",
|
|
84
84
|
"react": "^16.13.1",
|
|
85
85
|
"react-dom": "^16.13.1",
|
|
86
|
+
"react-grab": "^0.0.71",
|
|
86
87
|
"react-hot-loader": "^4.13.1",
|
|
87
88
|
"react-transform-hmr": "^1.0.2",
|
|
88
89
|
"style-loader": "^3.3.3",
|
|
@@ -91,6 +92,12 @@
|
|
|
91
92
|
"webpack-cli": "^5.1.4",
|
|
92
93
|
"webpack-dev-server": "^4.15.1"
|
|
93
94
|
},
|
|
95
|
+
"resolutions": {
|
|
96
|
+
"**/cheerio": "npm:cheerio@1.0.0-rc.12"
|
|
97
|
+
},
|
|
98
|
+
"_resolutionNotes": {
|
|
99
|
+
"**/cheerio": "See https://github.com/cheeriojs/cheerio/issues/4618"
|
|
100
|
+
},
|
|
94
101
|
"peerDependencies": {
|
|
95
102
|
"react": ">= 16.3.0",
|
|
96
103
|
"react-dom": ">= 16.3.0"
|