react-grid-layout 1.5.2 → 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/CHANGELOG.md +8 -8
- package/README.md +1 -0
- package/build/GridItem.js +3 -5
- package/build/ReactGridLayout.js +14 -17
- package/build/ReactGridLayoutPropTypes.js +1 -1
- package/build/ResponsiveReactGridLayout.js +21 -18
- package/build/components/WidthProvider.js +8 -4
- package/build/utils.js +34 -26
- package/dist/react-grid-layout.min.js +1 -1
- package/dist/react-grid-layout.min.js.map +1 -1
- package/lib/utils.js +20 -4
- package/package.json +3 -2
- package/yarn-error.log +7780 -0
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",
|
|
@@ -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",
|