react-grid-layout 2.1.1 → 2.2.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/dist/{chunk-WWS3M5Y3.js → chunk-2TEFHZC4.js} +112 -112
- package/dist/{chunk-WWS3M5Y3.js.map → chunk-2TEFHZC4.js.map} +1 -1
- package/dist/{chunk-YQQYHEEG.js → chunk-43GDBEG4.js} +18 -18
- package/dist/{chunk-YQQYHEEG.js.map → chunk-43GDBEG4.js.map} +1 -1
- package/dist/{chunk-LIKX67MZ.mjs → chunk-MUNIXYTV.mjs} +3 -3
- package/dist/{chunk-LIKX67MZ.mjs.map → chunk-MUNIXYTV.mjs.map} +1 -1
- package/dist/{chunk-RB2IKK5B.js → chunk-NQUM7RXX.js} +162 -82
- package/dist/chunk-NQUM7RXX.js.map +1 -0
- package/dist/{chunk-FLITZMQC.mjs → chunk-OH26KG7Y.mjs} +113 -113
- package/dist/{chunk-FLITZMQC.mjs.map → chunk-OH26KG7Y.mjs.map} +1 -1
- package/dist/{chunk-PLWMASMX.mjs → chunk-OWK47QTG.mjs} +131 -51
- package/dist/chunk-OWK47QTG.mjs.map +1 -0
- package/dist/core.js +42 -42
- package/dist/core.mjs +1 -1
- package/dist/index.js +23 -23
- package/dist/index.mjs +3 -3
- package/dist/legacy.js +17 -14
- package/dist/legacy.js.map +1 -1
- package/dist/legacy.mjs +6 -3
- package/dist/legacy.mjs.map +1 -1
- package/dist/react.d.mts +5 -1
- package/dist/react.d.ts +5 -1
- package/dist/react.js +17 -17
- package/dist/react.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-PLWMASMX.mjs.map +0 -1
- package/dist/chunk-RB2IKK5B.js.map +0 -1
|
@@ -358,113 +358,8 @@ var defaultDropConfig = {
|
|
|
358
358
|
defaultItem: { w: 1, h: 1 }
|
|
359
359
|
};
|
|
360
360
|
|
|
361
|
-
// src/core/compact-compat.ts
|
|
362
|
-
function getStatics2(layout) {
|
|
363
|
-
return layout.filter((l) => l.static);
|
|
364
|
-
}
|
|
365
|
-
var heightWidth = { x: "w", y: "h" };
|
|
366
|
-
function resolveCompactionCollision(layout, item, moveToCoord, axis, hasStatics) {
|
|
367
|
-
const sizeProp = heightWidth[axis];
|
|
368
|
-
item[axis] += 1;
|
|
369
|
-
const itemIndex = layout.findIndex((l) => l.i === item.i);
|
|
370
|
-
const layoutHasStatics = hasStatics ?? getStatics2(layout).length > 0;
|
|
371
|
-
for (let i = itemIndex + 1; i < layout.length; i++) {
|
|
372
|
-
const otherItem = layout[i];
|
|
373
|
-
if (otherItem === void 0) continue;
|
|
374
|
-
if (otherItem.static) continue;
|
|
375
|
-
if (!layoutHasStatics && otherItem.y > item.y + item.h) break;
|
|
376
|
-
if (chunkBJFPTW5Q_js.collides(item, otherItem)) {
|
|
377
|
-
resolveCompactionCollision(
|
|
378
|
-
layout,
|
|
379
|
-
otherItem,
|
|
380
|
-
moveToCoord + item[sizeProp],
|
|
381
|
-
axis,
|
|
382
|
-
layoutHasStatics
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
item[axis] = moveToCoord;
|
|
387
|
-
}
|
|
388
|
-
function compactItemInternal(compareWith, l, compactType, cols, fullLayout, allowOverlap, b) {
|
|
389
|
-
const compactV = compactType === "vertical";
|
|
390
|
-
const compactH = compactType === "horizontal";
|
|
391
|
-
if (!allowOverlap) {
|
|
392
|
-
if (compactV) {
|
|
393
|
-
if (typeof b === "number") {
|
|
394
|
-
l.y = Math.min(b, l.y);
|
|
395
|
-
} else {
|
|
396
|
-
l.y = Math.min(chunkBJFPTW5Q_js.bottom(compareWith), l.y);
|
|
397
|
-
}
|
|
398
|
-
while (l.y > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
399
|
-
l.y--;
|
|
400
|
-
}
|
|
401
|
-
} else if (compactH) {
|
|
402
|
-
while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
403
|
-
l.x--;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
let collision;
|
|
408
|
-
while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0 && !allowOverlap) {
|
|
409
|
-
if (compactH) {
|
|
410
|
-
resolveCompactionCollision(fullLayout, l, collision.x + collision.w, "x");
|
|
411
|
-
} else {
|
|
412
|
-
resolveCompactionCollision(fullLayout, l, collision.y + collision.h, "y");
|
|
413
|
-
}
|
|
414
|
-
if (compactH && l.x + l.w > cols) {
|
|
415
|
-
l.x = cols - l.w;
|
|
416
|
-
l.y++;
|
|
417
|
-
while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
418
|
-
l.x--;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
l.y = Math.max(l.y, 0);
|
|
423
|
-
l.x = Math.max(l.x, 0);
|
|
424
|
-
return l;
|
|
425
|
-
}
|
|
426
|
-
function compact(layout, compactType, cols, allowOverlap) {
|
|
427
|
-
const compareWith = getStatics2(layout);
|
|
428
|
-
let b = chunkBJFPTW5Q_js.bottom(compareWith);
|
|
429
|
-
const sorted = chunkBJFPTW5Q_js.sortLayoutItems(layout, compactType);
|
|
430
|
-
const out = new Array(layout.length);
|
|
431
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
432
|
-
const sortedItem = sorted[i];
|
|
433
|
-
if (sortedItem === void 0) continue;
|
|
434
|
-
let l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
|
|
435
|
-
if (!l.static) {
|
|
436
|
-
l = compactItemInternal(
|
|
437
|
-
compareWith,
|
|
438
|
-
l,
|
|
439
|
-
compactType,
|
|
440
|
-
cols,
|
|
441
|
-
sorted,
|
|
442
|
-
allowOverlap,
|
|
443
|
-
b
|
|
444
|
-
);
|
|
445
|
-
b = Math.max(b, l.y + l.h);
|
|
446
|
-
compareWith.push(l);
|
|
447
|
-
}
|
|
448
|
-
const originalIndex = layout.indexOf(sortedItem);
|
|
449
|
-
out[originalIndex] = l;
|
|
450
|
-
l.moved = false;
|
|
451
|
-
}
|
|
452
|
-
return out;
|
|
453
|
-
}
|
|
454
|
-
function compactItem(compareWith, l, compactType, cols, fullLayout, allowOverlap, maxY) {
|
|
455
|
-
return compactItemInternal(
|
|
456
|
-
compareWith,
|
|
457
|
-
chunkBJFPTW5Q_js.cloneLayoutItem(l),
|
|
458
|
-
compactType,
|
|
459
|
-
cols,
|
|
460
|
-
fullLayout,
|
|
461
|
-
allowOverlap,
|
|
462
|
-
maxY
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
361
|
// src/core/compactors.ts
|
|
467
|
-
function
|
|
362
|
+
function resolveCompactionCollision(layout, item, moveToCoord, axis, hasStatics) {
|
|
468
363
|
const sizeProp = axis === "x" ? "w" : "h";
|
|
469
364
|
item[axis] += 1;
|
|
470
365
|
const itemIndex = layout.findIndex((l) => l.i === item.i);
|
|
@@ -475,7 +370,7 @@ function resolveCompactionCollision2(layout, item, moveToCoord, axis, hasStatics
|
|
|
475
370
|
if (otherItem.static) continue;
|
|
476
371
|
if (!layoutHasStatics && otherItem.y > item.y + item.h) break;
|
|
477
372
|
if (chunkBJFPTW5Q_js.collides(item, otherItem)) {
|
|
478
|
-
|
|
373
|
+
resolveCompactionCollision(
|
|
479
374
|
layout,
|
|
480
375
|
otherItem,
|
|
481
376
|
moveToCoord + item[sizeProp],
|
|
@@ -493,7 +388,7 @@ function compactItemVertical(compareWith, l, fullLayout, maxY) {
|
|
|
493
388
|
}
|
|
494
389
|
let collision;
|
|
495
390
|
while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0) {
|
|
496
|
-
|
|
391
|
+
resolveCompactionCollision(fullLayout, l, collision.y + collision.h, "y");
|
|
497
392
|
}
|
|
498
393
|
l.y = Math.max(l.y, 0);
|
|
499
394
|
return l;
|
|
@@ -504,7 +399,7 @@ function compactItemHorizontal(compareWith, l, cols, fullLayout) {
|
|
|
504
399
|
}
|
|
505
400
|
let collision;
|
|
506
401
|
while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0) {
|
|
507
|
-
|
|
402
|
+
resolveCompactionCollision(fullLayout, l, collision.x + collision.w, "x");
|
|
508
403
|
if (l.x + l.w > cols) {
|
|
509
404
|
l.x = cols - l.w;
|
|
510
405
|
l.y++;
|
|
@@ -635,6 +530,111 @@ function getCompactor(compactType, allowOverlap = false, preventCollision = fals
|
|
|
635
530
|
return baseCompactor;
|
|
636
531
|
}
|
|
637
532
|
|
|
533
|
+
// src/core/compact-compat.ts
|
|
534
|
+
function getStatics2(layout) {
|
|
535
|
+
return layout.filter((l) => l.static);
|
|
536
|
+
}
|
|
537
|
+
var heightWidth = { x: "w", y: "h" };
|
|
538
|
+
function resolveCompactionCollision2(layout, item, moveToCoord, axis, hasStatics) {
|
|
539
|
+
const sizeProp = heightWidth[axis];
|
|
540
|
+
item[axis] += 1;
|
|
541
|
+
const itemIndex = layout.findIndex((l) => l.i === item.i);
|
|
542
|
+
const layoutHasStatics = hasStatics ?? getStatics2(layout).length > 0;
|
|
543
|
+
for (let i = itemIndex + 1; i < layout.length; i++) {
|
|
544
|
+
const otherItem = layout[i];
|
|
545
|
+
if (otherItem === void 0) continue;
|
|
546
|
+
if (otherItem.static) continue;
|
|
547
|
+
if (!layoutHasStatics && otherItem.y > item.y + item.h) break;
|
|
548
|
+
if (chunkBJFPTW5Q_js.collides(item, otherItem)) {
|
|
549
|
+
resolveCompactionCollision2(
|
|
550
|
+
layout,
|
|
551
|
+
otherItem,
|
|
552
|
+
moveToCoord + item[sizeProp],
|
|
553
|
+
axis,
|
|
554
|
+
layoutHasStatics
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
item[axis] = moveToCoord;
|
|
559
|
+
}
|
|
560
|
+
function compactItemInternal(compareWith, l, compactType, cols, fullLayout, allowOverlap, b) {
|
|
561
|
+
const compactV = compactType === "vertical";
|
|
562
|
+
const compactH = compactType === "horizontal";
|
|
563
|
+
if (!allowOverlap) {
|
|
564
|
+
if (compactV) {
|
|
565
|
+
if (typeof b === "number") {
|
|
566
|
+
l.y = Math.min(b, l.y);
|
|
567
|
+
} else {
|
|
568
|
+
l.y = Math.min(chunkBJFPTW5Q_js.bottom(compareWith), l.y);
|
|
569
|
+
}
|
|
570
|
+
while (l.y > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
571
|
+
l.y--;
|
|
572
|
+
}
|
|
573
|
+
} else if (compactH) {
|
|
574
|
+
while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
575
|
+
l.x--;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
let collision;
|
|
580
|
+
while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0 && !allowOverlap) {
|
|
581
|
+
if (compactH) {
|
|
582
|
+
resolveCompactionCollision2(fullLayout, l, collision.x + collision.w, "x");
|
|
583
|
+
} else {
|
|
584
|
+
resolveCompactionCollision2(fullLayout, l, collision.y + collision.h, "y");
|
|
585
|
+
}
|
|
586
|
+
if (compactH && l.x + l.w > cols) {
|
|
587
|
+
l.x = cols - l.w;
|
|
588
|
+
l.y++;
|
|
589
|
+
while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
590
|
+
l.x--;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
l.y = Math.max(l.y, 0);
|
|
595
|
+
l.x = Math.max(l.x, 0);
|
|
596
|
+
return l;
|
|
597
|
+
}
|
|
598
|
+
function compact(layout, compactType, cols, allowOverlap) {
|
|
599
|
+
const compareWith = getStatics2(layout);
|
|
600
|
+
let b = chunkBJFPTW5Q_js.bottom(compareWith);
|
|
601
|
+
const sorted = chunkBJFPTW5Q_js.sortLayoutItems(layout, compactType);
|
|
602
|
+
const out = new Array(layout.length);
|
|
603
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
604
|
+
const sortedItem = sorted[i];
|
|
605
|
+
if (sortedItem === void 0) continue;
|
|
606
|
+
let l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
|
|
607
|
+
if (!l.static) {
|
|
608
|
+
l = compactItemInternal(
|
|
609
|
+
compareWith,
|
|
610
|
+
l,
|
|
611
|
+
compactType,
|
|
612
|
+
cols,
|
|
613
|
+
sorted,
|
|
614
|
+
allowOverlap,
|
|
615
|
+
b
|
|
616
|
+
);
|
|
617
|
+
b = Math.max(b, l.y + l.h);
|
|
618
|
+
compareWith.push(l);
|
|
619
|
+
}
|
|
620
|
+
const originalIndex = layout.indexOf(sortedItem);
|
|
621
|
+
out[originalIndex] = l;
|
|
622
|
+
l.moved = false;
|
|
623
|
+
}
|
|
624
|
+
return out;
|
|
625
|
+
}
|
|
626
|
+
function compactItem(compareWith, l, compactType, cols, fullLayout, allowOverlap, maxY) {
|
|
627
|
+
return compactItemInternal(
|
|
628
|
+
compareWith,
|
|
629
|
+
chunkBJFPTW5Q_js.cloneLayoutItem(l),
|
|
630
|
+
compactType,
|
|
631
|
+
cols,
|
|
632
|
+
fullLayout,
|
|
633
|
+
allowOverlap,
|
|
634
|
+
maxY
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
638
|
// src/core/responsive.ts
|
|
639
639
|
function sortBreakpoints(breakpoints) {
|
|
640
640
|
const keys = Object.keys(breakpoints);
|
|
@@ -739,7 +739,7 @@ exports.noCompactor = noCompactor;
|
|
|
739
739
|
exports.noOverlapCompactor = noOverlapCompactor;
|
|
740
740
|
exports.perc = perc;
|
|
741
741
|
exports.resizeItemInDirection = resizeItemInDirection;
|
|
742
|
-
exports.resolveCompactionCollision =
|
|
742
|
+
exports.resolveCompactionCollision = resolveCompactionCollision;
|
|
743
743
|
exports.setTopLeft = setTopLeft;
|
|
744
744
|
exports.setTransform = setTransform;
|
|
745
745
|
exports.snapToGrid = snapToGrid;
|
|
@@ -747,5 +747,5 @@ exports.sortBreakpoints = sortBreakpoints;
|
|
|
747
747
|
exports.transformStrategy = transformStrategy;
|
|
748
748
|
exports.verticalCompactor = verticalCompactor;
|
|
749
749
|
exports.verticalOverlapCompactor = verticalOverlapCompactor;
|
|
750
|
-
//# sourceMappingURL=chunk-
|
|
751
|
-
//# sourceMappingURL=chunk-
|
|
750
|
+
//# sourceMappingURL=chunk-2TEFHZC4.js.map
|
|
751
|
+
//# sourceMappingURL=chunk-2TEFHZC4.js.map
|