react-grid-layout 2.1.0 → 2.1.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/README.md +20 -3
- package/dist/{chunk-2O3ZME4Q.mjs → chunk-FLITZMQC.mjs} +23 -17
- package/dist/chunk-FLITZMQC.mjs.map +1 -0
- package/dist/{chunk-LWF5EYMO.mjs → chunk-LIKX67MZ.mjs} +6 -5
- package/dist/chunk-LIKX67MZ.mjs.map +1 -0
- package/dist/{chunk-MXXN7GUE.mjs → chunk-PLWMASMX.mjs} +41 -31
- package/dist/chunk-PLWMASMX.mjs.map +1 -0
- package/dist/{chunk-QRW3ND4U.js → chunk-RB2IKK5B.js} +77 -67
- package/dist/chunk-RB2IKK5B.js.map +1 -0
- package/dist/{chunk-FN6MIZ24.js → chunk-WWS3M5Y3.js} +23 -16
- package/dist/chunk-WWS3M5Y3.js.map +1 -0
- package/dist/{chunk-GPZBANOK.js → chunk-YQQYHEEG.js} +21 -20
- package/dist/chunk-YQQYHEEG.js.map +1 -0
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +45 -41
- package/dist/core.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -23
- package/dist/index.mjs +3 -3
- package/dist/legacy.js +13 -13
- package/dist/legacy.mjs +2 -2
- package/dist/{position-C8a5g6bb.d.mts → position-CXNzFxI0.d.mts} +7 -1
- package/dist/{position-H8tBL91b.d.ts → position-Dk0FRWA9.d.ts} +7 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +17 -17
- package/dist/react.mjs +3 -3
- package/package.json +4 -3
- package/dist/chunk-2O3ZME4Q.mjs.map +0 -1
- package/dist/chunk-FN6MIZ24.js.map +0 -1
- package/dist/chunk-GPZBANOK.js.map +0 -1
- package/dist/chunk-LWF5EYMO.mjs.map +0 -1
- package/dist/chunk-MXXN7GUE.mjs.map +0 -1
- package/dist/chunk-QRW3ND4U.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWWS3M5Y3_js = require('./chunk-WWS3M5Y3.js');
|
|
4
4
|
var chunkBJFPTW5Q_js = require('./chunk-BJFPTW5Q.js');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
var reactDraggable = require('react-draggable');
|
|
@@ -46,7 +46,7 @@ function GridItem(props) {
|
|
|
46
46
|
i,
|
|
47
47
|
resizeHandles,
|
|
48
48
|
resizeHandle,
|
|
49
|
-
constraints =
|
|
49
|
+
constraints = chunkWWS3M5Y3_js.defaultConstraints,
|
|
50
50
|
layoutItem,
|
|
51
51
|
layout = [],
|
|
52
52
|
onDragStart: onDragStartProp,
|
|
@@ -110,14 +110,14 @@ function GridItem(props) {
|
|
|
110
110
|
const createStyle = React2.useCallback(
|
|
111
111
|
(pos2) => {
|
|
112
112
|
if (useCSSTransforms) {
|
|
113
|
-
return
|
|
113
|
+
return chunkWWS3M5Y3_js.setTransform(pos2);
|
|
114
114
|
}
|
|
115
|
-
const styleObj =
|
|
115
|
+
const styleObj = chunkWWS3M5Y3_js.setTopLeft(pos2);
|
|
116
116
|
if (usePercentages) {
|
|
117
117
|
return {
|
|
118
118
|
...styleObj,
|
|
119
|
-
left:
|
|
120
|
-
width:
|
|
119
|
+
left: chunkWWS3M5Y3_js.perc(pos2.left / containerWidth),
|
|
120
|
+
width: chunkWWS3M5Y3_js.perc(pos2.width / containerWidth)
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
return styleObj;
|
|
@@ -146,7 +146,7 @@ function GridItem(props) {
|
|
|
146
146
|
newPosition.top,
|
|
147
147
|
newPosition.left
|
|
148
148
|
);
|
|
149
|
-
const { x: newX, y: newY } =
|
|
149
|
+
const { x: newX, y: newY } = chunkWWS3M5Y3_js.applyPositionConstraints(
|
|
150
150
|
constraints,
|
|
151
151
|
effectiveLayoutItem,
|
|
152
152
|
rawPos.x,
|
|
@@ -187,7 +187,7 @@ function GridItem(props) {
|
|
|
187
187
|
const newPosition = { top, left };
|
|
188
188
|
dragPositionRef.current = newPosition;
|
|
189
189
|
const rawPos = chunkBJFPTW5Q_js.calcXYRaw(positionParams, top, left);
|
|
190
|
-
const { x: newX, y: newY } =
|
|
190
|
+
const { x: newX, y: newY } = chunkWWS3M5Y3_js.applyPositionConstraints(
|
|
191
191
|
constraints,
|
|
192
192
|
effectiveLayoutItem,
|
|
193
193
|
rawPos.x,
|
|
@@ -224,7 +224,7 @@ function GridItem(props) {
|
|
|
224
224
|
setDragging(false);
|
|
225
225
|
dragPositionRef.current = { left: 0, top: 0 };
|
|
226
226
|
const rawPos = chunkBJFPTW5Q_js.calcXYRaw(positionParams, top, left);
|
|
227
|
-
const { x: newX, y: newY } =
|
|
227
|
+
const { x: newX, y: newY } = chunkWWS3M5Y3_js.applyPositionConstraints(
|
|
228
228
|
constraints,
|
|
229
229
|
effectiveLayoutItem,
|
|
230
230
|
rawPos.x,
|
|
@@ -253,7 +253,7 @@ function GridItem(props) {
|
|
|
253
253
|
if (!handler) return;
|
|
254
254
|
let updatedSize;
|
|
255
255
|
if (node) {
|
|
256
|
-
updatedSize =
|
|
256
|
+
updatedSize = chunkWWS3M5Y3_js.resizeItemInDirection(
|
|
257
257
|
resizeHandle2,
|
|
258
258
|
position,
|
|
259
259
|
size,
|
|
@@ -272,7 +272,7 @@ function GridItem(props) {
|
|
|
272
272
|
updatedSize.width,
|
|
273
273
|
updatedSize.height
|
|
274
274
|
);
|
|
275
|
-
const { w: newW, h: newH } =
|
|
275
|
+
const { w: newW, h: newH } = chunkWWS3M5Y3_js.applySizeConstraints(
|
|
276
276
|
constraints,
|
|
277
277
|
effectiveLayoutItem,
|
|
278
278
|
rawSize.w,
|
|
@@ -504,7 +504,7 @@ function synchronizeLayoutWithChildren(initialLayout, children, cols, compactTyp
|
|
|
504
504
|
}
|
|
505
505
|
});
|
|
506
506
|
const corrected = chunkBJFPTW5Q_js.correctBounds(layout, { cols });
|
|
507
|
-
return
|
|
507
|
+
return chunkWWS3M5Y3_js.compact(corrected, compactType, cols, allowOverlap);
|
|
508
508
|
}
|
|
509
509
|
function GridLayout(props) {
|
|
510
510
|
const {
|
|
@@ -516,9 +516,9 @@ function GridLayout(props) {
|
|
|
516
516
|
dragConfig: dragConfigProp,
|
|
517
517
|
resizeConfig: resizeConfigProp,
|
|
518
518
|
dropConfig: dropConfigProp,
|
|
519
|
-
positionStrategy =
|
|
519
|
+
positionStrategy = chunkWWS3M5Y3_js.defaultPositionStrategy,
|
|
520
520
|
compactor: compactorProp,
|
|
521
|
-
constraints =
|
|
521
|
+
constraints = chunkWWS3M5Y3_js.defaultConstraints,
|
|
522
522
|
// Layout data
|
|
523
523
|
layout: propsLayout = [],
|
|
524
524
|
droppingItem: droppingItemProp,
|
|
@@ -539,19 +539,19 @@ function GridLayout(props) {
|
|
|
539
539
|
onDropDragOver: onDropDragOverProp = noop
|
|
540
540
|
} = props;
|
|
541
541
|
const gridConfig = React2.useMemo(
|
|
542
|
-
() => ({ ...
|
|
542
|
+
() => ({ ...chunkWWS3M5Y3_js.defaultGridConfig, ...gridConfigProp }),
|
|
543
543
|
[gridConfigProp]
|
|
544
544
|
);
|
|
545
545
|
const dragConfig = React2.useMemo(
|
|
546
|
-
() => ({ ...
|
|
546
|
+
() => ({ ...chunkWWS3M5Y3_js.defaultDragConfig, ...dragConfigProp }),
|
|
547
547
|
[dragConfigProp]
|
|
548
548
|
);
|
|
549
549
|
const resizeConfig = React2.useMemo(
|
|
550
|
-
() => ({ ...
|
|
550
|
+
() => ({ ...chunkWWS3M5Y3_js.defaultResizeConfig, ...resizeConfigProp }),
|
|
551
551
|
[resizeConfigProp]
|
|
552
552
|
);
|
|
553
553
|
const dropConfig = React2.useMemo(
|
|
554
|
-
() => ({ ...
|
|
554
|
+
() => ({ ...chunkWWS3M5Y3_js.defaultDropConfig, ...dropConfigProp }),
|
|
555
555
|
[dropConfigProp]
|
|
556
556
|
);
|
|
557
557
|
const { cols, rowHeight, maxRows, margin, containerPadding } = gridConfig;
|
|
@@ -567,7 +567,7 @@ function GridLayout(props) {
|
|
|
567
567
|
handleComponent: resizeHandle
|
|
568
568
|
} = resizeConfig;
|
|
569
569
|
const { enabled: isDroppable, defaultItem: defaultDropItem } = dropConfig;
|
|
570
|
-
const compactor = compactorProp ??
|
|
570
|
+
const compactor = compactorProp ?? chunkWWS3M5Y3_js.getCompactor("vertical");
|
|
571
571
|
const compactType = compactor.type;
|
|
572
572
|
const allowOverlap = compactor.allowOverlap;
|
|
573
573
|
const preventCollision = compactor.preventCollision ?? false;
|
|
@@ -605,6 +605,8 @@ function GridLayout(props) {
|
|
|
605
605
|
const prevPropsLayoutRef = React2.useRef(propsLayout);
|
|
606
606
|
const prevChildrenRef = React2.useRef(children);
|
|
607
607
|
const prevCompactTypeRef = React2.useRef(compactType);
|
|
608
|
+
const layoutRef = React2.useRef(layout);
|
|
609
|
+
layoutRef.current = layout;
|
|
608
610
|
React2.useEffect(() => {
|
|
609
611
|
setMounted(true);
|
|
610
612
|
if (!fastEquals.deepEqual(layout, propsLayout)) {
|
|
@@ -613,6 +615,7 @@ function GridLayout(props) {
|
|
|
613
615
|
}, []);
|
|
614
616
|
React2.useEffect(() => {
|
|
615
617
|
if (activeDrag) return;
|
|
618
|
+
if (droppingDOMNode) return;
|
|
616
619
|
const layoutChanged = !fastEquals.deepEqual(propsLayout, prevPropsLayoutRef.current);
|
|
617
620
|
const childrenChanged = !childrenEqual(children, prevChildrenRef.current);
|
|
618
621
|
const compactTypeChanged = compactType !== prevCompactTypeRef.current;
|
|
@@ -637,6 +640,7 @@ function GridLayout(props) {
|
|
|
637
640
|
compactType,
|
|
638
641
|
allowOverlap,
|
|
639
642
|
activeDrag,
|
|
643
|
+
droppingDOMNode,
|
|
640
644
|
layout
|
|
641
645
|
]);
|
|
642
646
|
React2.useEffect(() => {
|
|
@@ -653,7 +657,8 @@ function GridLayout(props) {
|
|
|
653
657
|
}, [autoSize, layout, rowHeight, margin, effectiveContainerPadding]);
|
|
654
658
|
const onDragStart = React2.useCallback(
|
|
655
659
|
(i, _x, _y, data) => {
|
|
656
|
-
const
|
|
660
|
+
const currentLayout = layoutRef.current;
|
|
661
|
+
const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
|
|
657
662
|
if (!l) return;
|
|
658
663
|
const placeholder = {
|
|
659
664
|
w: l.w,
|
|
@@ -663,16 +668,17 @@ function GridLayout(props) {
|
|
|
663
668
|
i
|
|
664
669
|
};
|
|
665
670
|
oldDragItemRef.current = chunkBJFPTW5Q_js.cloneLayoutItem(l);
|
|
666
|
-
oldLayoutRef.current =
|
|
671
|
+
oldLayoutRef.current = currentLayout;
|
|
667
672
|
setActiveDrag(placeholder);
|
|
668
|
-
onDragStartProp(
|
|
673
|
+
onDragStartProp(currentLayout, l, l, null, data.e, data.node);
|
|
669
674
|
},
|
|
670
|
-
[
|
|
675
|
+
[onDragStartProp]
|
|
671
676
|
);
|
|
672
677
|
const onDrag = React2.useCallback(
|
|
673
678
|
(i, x, y, data) => {
|
|
679
|
+
const currentLayout = layoutRef.current;
|
|
674
680
|
const oldDragItem = oldDragItemRef.current;
|
|
675
|
-
const l = chunkBJFPTW5Q_js.getLayoutItem(
|
|
681
|
+
const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
|
|
676
682
|
if (!l) return;
|
|
677
683
|
const placeholder = {
|
|
678
684
|
w: l.w,
|
|
@@ -682,7 +688,7 @@ function GridLayout(props) {
|
|
|
682
688
|
i
|
|
683
689
|
};
|
|
684
690
|
const newLayout = chunkBJFPTW5Q_js.moveElement(
|
|
685
|
-
|
|
691
|
+
currentLayout,
|
|
686
692
|
l,
|
|
687
693
|
x,
|
|
688
694
|
y,
|
|
@@ -694,20 +700,21 @@ function GridLayout(props) {
|
|
|
694
700
|
);
|
|
695
701
|
onDragProp(newLayout, oldDragItem, l, placeholder, data.e, data.node);
|
|
696
702
|
setLayout(
|
|
697
|
-
allowOverlap ? newLayout :
|
|
703
|
+
allowOverlap ? newLayout : chunkWWS3M5Y3_js.compact(newLayout, compactType, cols)
|
|
698
704
|
);
|
|
699
705
|
setActiveDrag(placeholder);
|
|
700
706
|
},
|
|
701
|
-
[
|
|
707
|
+
[preventCollision, compactType, cols, allowOverlap, onDragProp]
|
|
702
708
|
);
|
|
703
709
|
const onDragStop = React2.useCallback(
|
|
704
710
|
(i, x, y, data) => {
|
|
705
711
|
if (!activeDrag) return;
|
|
712
|
+
const currentLayout = layoutRef.current;
|
|
706
713
|
const oldDragItem = oldDragItemRef.current;
|
|
707
|
-
const l = chunkBJFPTW5Q_js.getLayoutItem(
|
|
714
|
+
const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
|
|
708
715
|
if (!l) return;
|
|
709
716
|
const newLayout = chunkBJFPTW5Q_js.moveElement(
|
|
710
|
-
|
|
717
|
+
currentLayout,
|
|
711
718
|
l,
|
|
712
719
|
x,
|
|
713
720
|
y,
|
|
@@ -717,7 +724,7 @@ function GridLayout(props) {
|
|
|
717
724
|
cols,
|
|
718
725
|
allowOverlap
|
|
719
726
|
);
|
|
720
|
-
const finalLayout = allowOverlap ? newLayout :
|
|
727
|
+
const finalLayout = allowOverlap ? newLayout : chunkWWS3M5Y3_js.compact(newLayout, compactType, cols);
|
|
721
728
|
onDragStopProp(finalLayout, oldDragItem, l, null, data.e, data.node);
|
|
722
729
|
const oldLayout = oldLayoutRef.current;
|
|
723
730
|
oldDragItemRef.current = null;
|
|
@@ -730,7 +737,6 @@ function GridLayout(props) {
|
|
|
730
737
|
},
|
|
731
738
|
[
|
|
732
739
|
activeDrag,
|
|
733
|
-
layout,
|
|
734
740
|
preventCollision,
|
|
735
741
|
compactType,
|
|
736
742
|
cols,
|
|
@@ -741,23 +747,25 @@ function GridLayout(props) {
|
|
|
741
747
|
);
|
|
742
748
|
const onResizeStart = React2.useCallback(
|
|
743
749
|
(i, _w, _h, data) => {
|
|
744
|
-
const
|
|
750
|
+
const currentLayout = layoutRef.current;
|
|
751
|
+
const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
|
|
745
752
|
if (!l) return;
|
|
746
753
|
oldResizeItemRef.current = chunkBJFPTW5Q_js.cloneLayoutItem(l);
|
|
747
|
-
oldLayoutRef.current =
|
|
754
|
+
oldLayoutRef.current = currentLayout;
|
|
748
755
|
setResizing(true);
|
|
749
|
-
onResizeStartProp(
|
|
756
|
+
onResizeStartProp(currentLayout, l, l, null, data.e, data.node);
|
|
750
757
|
},
|
|
751
|
-
[
|
|
758
|
+
[onResizeStartProp]
|
|
752
759
|
);
|
|
753
760
|
const onResize = React2.useCallback(
|
|
754
761
|
(i, w, h, data) => {
|
|
762
|
+
const currentLayout = layoutRef.current;
|
|
755
763
|
const oldResizeItem = oldResizeItemRef.current;
|
|
756
764
|
const { handle } = data;
|
|
757
765
|
let shouldMoveItem = false;
|
|
758
766
|
let newX;
|
|
759
767
|
let newY;
|
|
760
|
-
const [newLayout, l] = chunkBJFPTW5Q_js.withLayoutItem(
|
|
768
|
+
const [newLayout, l] = chunkBJFPTW5Q_js.withLayoutItem(currentLayout, i, (item) => {
|
|
761
769
|
newX = item.x;
|
|
762
770
|
newY = item.y;
|
|
763
771
|
if (["sw", "w", "nw", "n", "ne"].includes(handle)) {
|
|
@@ -774,7 +782,7 @@ function GridLayout(props) {
|
|
|
774
782
|
shouldMoveItem = true;
|
|
775
783
|
}
|
|
776
784
|
if (preventCollision && !allowOverlap) {
|
|
777
|
-
const collisions = chunkBJFPTW5Q_js.getAllCollisions(
|
|
785
|
+
const collisions = chunkBJFPTW5Q_js.getAllCollisions(currentLayout, {
|
|
778
786
|
...item,
|
|
779
787
|
w,
|
|
780
788
|
h,
|
|
@@ -825,17 +833,18 @@ function GridLayout(props) {
|
|
|
825
833
|
data.node
|
|
826
834
|
);
|
|
827
835
|
setLayout(
|
|
828
|
-
allowOverlap ? finalLayout :
|
|
836
|
+
allowOverlap ? finalLayout : chunkWWS3M5Y3_js.compact(finalLayout, compactType, cols)
|
|
829
837
|
);
|
|
830
838
|
setActiveDrag(placeholder);
|
|
831
839
|
},
|
|
832
|
-
[
|
|
840
|
+
[preventCollision, allowOverlap, compactType, cols, onResizeProp]
|
|
833
841
|
);
|
|
834
842
|
const onResizeStop = React2.useCallback(
|
|
835
843
|
(i, _w, _h, data) => {
|
|
844
|
+
const currentLayout = layoutRef.current;
|
|
836
845
|
const oldResizeItem = oldResizeItemRef.current;
|
|
837
|
-
const l = chunkBJFPTW5Q_js.getLayoutItem(
|
|
838
|
-
const finalLayout = allowOverlap ?
|
|
846
|
+
const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
|
|
847
|
+
const finalLayout = allowOverlap ? currentLayout : chunkWWS3M5Y3_js.compact(currentLayout, compactType, cols);
|
|
839
848
|
onResizeStopProp(
|
|
840
849
|
finalLayout,
|
|
841
850
|
oldResizeItem,
|
|
@@ -854,11 +863,12 @@ function GridLayout(props) {
|
|
|
854
863
|
onLayoutChange(finalLayout);
|
|
855
864
|
}
|
|
856
865
|
},
|
|
857
|
-
[
|
|
866
|
+
[allowOverlap, compactType, cols, onResizeStopProp, onLayoutChange]
|
|
858
867
|
);
|
|
859
868
|
const removeDroppingPlaceholder = React2.useCallback(() => {
|
|
860
|
-
const
|
|
861
|
-
|
|
869
|
+
const currentLayout = layoutRef.current;
|
|
870
|
+
const newLayout = chunkWWS3M5Y3_js.compact(
|
|
871
|
+
currentLayout.filter((l) => l.i !== droppingItem.i),
|
|
862
872
|
compactType,
|
|
863
873
|
cols,
|
|
864
874
|
allowOverlap
|
|
@@ -867,7 +877,7 @@ function GridLayout(props) {
|
|
|
867
877
|
setDroppingDOMNode(null);
|
|
868
878
|
setActiveDrag(null);
|
|
869
879
|
setDroppingPosition(void 0);
|
|
870
|
-
}, [
|
|
880
|
+
}, [droppingItem.i, compactType, cols, allowOverlap]);
|
|
871
881
|
const handleDragOver = React2.useCallback(
|
|
872
882
|
(e) => {
|
|
873
883
|
e.preventDefault();
|
|
@@ -932,7 +942,7 @@ function GridLayout(props) {
|
|
|
932
942
|
setDroppingDOMNode(/* @__PURE__ */ jsxRuntime.jsx("div", {}, finalDroppingItem.i));
|
|
933
943
|
setDroppingPosition(newDroppingPosition);
|
|
934
944
|
setLayout([
|
|
935
|
-
...
|
|
945
|
+
...layoutRef.current,
|
|
936
946
|
{
|
|
937
947
|
...finalDroppingItem,
|
|
938
948
|
x: calculatedPosition.x,
|
|
@@ -960,8 +970,7 @@ function GridLayout(props) {
|
|
|
960
970
|
maxRows,
|
|
961
971
|
rowHeight,
|
|
962
972
|
width,
|
|
963
|
-
effectiveContainerPadding
|
|
964
|
-
layout
|
|
973
|
+
effectiveContainerPadding
|
|
965
974
|
]
|
|
966
975
|
);
|
|
967
976
|
const handleDragLeave = React2.useCallback(
|
|
@@ -984,12 +993,13 @@ function GridLayout(props) {
|
|
|
984
993
|
(e) => {
|
|
985
994
|
e.preventDefault();
|
|
986
995
|
e.stopPropagation();
|
|
987
|
-
const
|
|
996
|
+
const currentLayout = layoutRef.current;
|
|
997
|
+
const item = currentLayout.find((l) => l.i === droppingItem.i);
|
|
988
998
|
dragEnterCounterRef.current = 0;
|
|
989
999
|
removeDroppingPlaceholder();
|
|
990
|
-
onDropProp(
|
|
1000
|
+
onDropProp(currentLayout, item, e.nativeEvent);
|
|
991
1001
|
},
|
|
992
|
-
[
|
|
1002
|
+
[droppingItem.i, removeDroppingPlaceholder, onDropProp]
|
|
993
1003
|
);
|
|
994
1004
|
const processGridItem = React2.useCallback(
|
|
995
1005
|
(child, isDroppingItem) => {
|
|
@@ -1186,7 +1196,7 @@ function synchronizeLayoutWithChildren2(initialLayout, children, cols, compactTy
|
|
|
1186
1196
|
}
|
|
1187
1197
|
});
|
|
1188
1198
|
const corrected = chunkBJFPTW5Q_js.correctBounds(layout, { cols });
|
|
1189
|
-
return
|
|
1199
|
+
return chunkWWS3M5Y3_js.compact(corrected, compactType, cols, allowOverlap);
|
|
1190
1200
|
}
|
|
1191
1201
|
function ResponsiveGridLayout(props) {
|
|
1192
1202
|
const {
|
|
@@ -1206,17 +1216,17 @@ function ResponsiveGridLayout(props) {
|
|
|
1206
1216
|
onWidthChange = noop2,
|
|
1207
1217
|
...restProps
|
|
1208
1218
|
} = props;
|
|
1209
|
-
const compactor = compactorProp ??
|
|
1219
|
+
const compactor = compactorProp ?? chunkWWS3M5Y3_js.getCompactor("vertical");
|
|
1210
1220
|
const compactType = compactor.type;
|
|
1211
1221
|
const allowOverlap = compactor.allowOverlap;
|
|
1212
1222
|
const initialBreakpoint = React2.useMemo(() => {
|
|
1213
|
-
return propBreakpoint ??
|
|
1223
|
+
return propBreakpoint ?? chunkWWS3M5Y3_js.getBreakpointFromWidth(breakpoints, width);
|
|
1214
1224
|
}, []);
|
|
1215
1225
|
const initialCols = React2.useMemo(() => {
|
|
1216
|
-
return
|
|
1226
|
+
return chunkWWS3M5Y3_js.getColsFromBreakpoint(initialBreakpoint, colsConfig);
|
|
1217
1227
|
}, [initialBreakpoint, colsConfig]);
|
|
1218
1228
|
const initialLayout = React2.useMemo(() => {
|
|
1219
|
-
return
|
|
1229
|
+
return chunkWWS3M5Y3_js.findOrGenerateResponsiveLayout(
|
|
1220
1230
|
propsLayouts,
|
|
1221
1231
|
breakpoints,
|
|
1222
1232
|
initialBreakpoint,
|
|
@@ -1241,7 +1251,7 @@ function ResponsiveGridLayout(props) {
|
|
|
1241
1251
|
}, [layouts]);
|
|
1242
1252
|
const derivedLayout = React2.useMemo(() => {
|
|
1243
1253
|
if (!fastEquals.deepEqual(propsLayouts, prevLayoutsRef.current)) {
|
|
1244
|
-
return
|
|
1254
|
+
return chunkWWS3M5Y3_js.findOrGenerateResponsiveLayout(
|
|
1245
1255
|
propsLayouts,
|
|
1246
1256
|
breakpoints,
|
|
1247
1257
|
breakpoint,
|
|
@@ -1263,7 +1273,7 @@ function ResponsiveGridLayout(props) {
|
|
|
1263
1273
|
}, [derivedLayout, propsLayouts]);
|
|
1264
1274
|
React2.useEffect(() => {
|
|
1265
1275
|
if (compactType !== prevCompactTypeRef.current) {
|
|
1266
|
-
const newLayout =
|
|
1276
|
+
const newLayout = chunkWWS3M5Y3_js.compact(
|
|
1267
1277
|
chunkBJFPTW5Q_js.cloneLayout(effectiveLayout),
|
|
1268
1278
|
compactType,
|
|
1269
1279
|
cols,
|
|
@@ -1296,15 +1306,15 @@ function ResponsiveGridLayout(props) {
|
|
|
1296
1306
|
);
|
|
1297
1307
|
const colsChanged = !fastEquals.deepEqual(colsConfig, prevColsRef.current);
|
|
1298
1308
|
if (widthChanged || breakpointPropChanged || breakpointsChanged || colsChanged) {
|
|
1299
|
-
const newBreakpoint = propBreakpoint ??
|
|
1300
|
-
const newCols =
|
|
1309
|
+
const newBreakpoint = propBreakpoint ?? chunkWWS3M5Y3_js.getBreakpointFromWidth(breakpoints, width);
|
|
1310
|
+
const newCols = chunkWWS3M5Y3_js.getColsFromBreakpoint(newBreakpoint, colsConfig);
|
|
1301
1311
|
const lastBreakpoint = breakpoint;
|
|
1302
1312
|
if (lastBreakpoint !== newBreakpoint || breakpointsChanged || colsChanged) {
|
|
1303
1313
|
const newLayouts = { ...layoutsRef.current };
|
|
1304
1314
|
if (!newLayouts[lastBreakpoint]) {
|
|
1305
1315
|
newLayouts[lastBreakpoint] = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
1306
1316
|
}
|
|
1307
|
-
let newLayout =
|
|
1317
|
+
let newLayout = chunkWWS3M5Y3_js.findOrGenerateResponsiveLayout(
|
|
1308
1318
|
newLayouts,
|
|
1309
1319
|
breakpoints,
|
|
1310
1320
|
newBreakpoint,
|
|
@@ -1328,11 +1338,11 @@ function ResponsiveGridLayout(props) {
|
|
|
1328
1338
|
onBreakpointChange(newBreakpoint, newCols);
|
|
1329
1339
|
onLayoutChange(newLayout, newLayouts);
|
|
1330
1340
|
}
|
|
1331
|
-
const currentMargin2 =
|
|
1341
|
+
const currentMargin2 = chunkWWS3M5Y3_js.getIndentationValue(
|
|
1332
1342
|
propMargin,
|
|
1333
1343
|
newBreakpoint
|
|
1334
1344
|
);
|
|
1335
|
-
const currentPadding = propContainerPadding ?
|
|
1345
|
+
const currentPadding = propContainerPadding ? chunkWWS3M5Y3_js.getIndentationValue(
|
|
1336
1346
|
propContainerPadding,
|
|
1337
1347
|
newBreakpoint
|
|
1338
1348
|
) : null;
|
|
@@ -1374,14 +1384,14 @@ function ResponsiveGridLayout(props) {
|
|
|
1374
1384
|
[breakpoint, onLayoutChange]
|
|
1375
1385
|
);
|
|
1376
1386
|
const currentMargin = React2.useMemo(() => {
|
|
1377
|
-
return
|
|
1387
|
+
return chunkWWS3M5Y3_js.getIndentationValue(
|
|
1378
1388
|
propMargin,
|
|
1379
1389
|
breakpoint
|
|
1380
1390
|
);
|
|
1381
1391
|
}, [propMargin, breakpoint]);
|
|
1382
1392
|
const currentContainerPadding = React2.useMemo(() => {
|
|
1383
1393
|
if (propContainerPadding === null) return null;
|
|
1384
|
-
return
|
|
1394
|
+
return chunkWWS3M5Y3_js.getIndentationValue(
|
|
1385
1395
|
propContainerPadding,
|
|
1386
1396
|
breakpoint
|
|
1387
1397
|
);
|
|
@@ -1413,5 +1423,5 @@ function ResponsiveGridLayout(props) {
|
|
|
1413
1423
|
exports.GridItem = GridItem;
|
|
1414
1424
|
exports.GridLayout = GridLayout;
|
|
1415
1425
|
exports.ResponsiveGridLayout = ResponsiveGridLayout;
|
|
1416
|
-
//# sourceMappingURL=chunk-
|
|
1417
|
-
//# sourceMappingURL=chunk-
|
|
1426
|
+
//# sourceMappingURL=chunk-RB2IKK5B.js.map
|
|
1427
|
+
//# sourceMappingURL=chunk-RB2IKK5B.js.map
|