mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
feat: added gridutils funcs
This commit is contained in:
parent
d314ecf120
commit
8b3f2a4c68
2 changed files with 11 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ import _ from 'lodash';
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { diff } from 'deep-object-diff';
|
||||
import DragContainer from './DragContainer';
|
||||
import { correctBounds } from './gridUtils';
|
||||
|
||||
const NO_OF_GRIDS = 24;
|
||||
|
||||
|
|
@ -93,6 +94,13 @@ export const Container = ({
|
|||
const [isContainerFocused, setContainerFocus] = useState(false);
|
||||
const [canvasHeight, setCanvasHeight] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentLayout === 'mobile') {
|
||||
const mobLayouts = boxes.map((box) => box?.layout?.mobile);
|
||||
correctBounds(mobLayouts, { cols: 6 });
|
||||
}
|
||||
}, [currentLayout]);
|
||||
|
||||
const router = useRouter();
|
||||
const canvasRef = useRef(null);
|
||||
const focusedParentIdRef = useRef(undefined);
|
||||
|
|
@ -801,6 +809,7 @@ export const Container = ({
|
|||
gridWidth={gridWidth}
|
||||
selectedComponents={selectedComponents}
|
||||
setIsDragging={setIsDragging}
|
||||
currentLayout
|
||||
/>
|
||||
{/* {Object.keys(boxes).map((key) => {
|
||||
const box = boxes[key];
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export default function DragContainer({
|
|||
gridWidth,
|
||||
selectedComponents = [],
|
||||
setIsDragging,
|
||||
currentLayout,
|
||||
}) {
|
||||
const [dragTarget, setDragTarget] = useState();
|
||||
const [draggedTarget, setDraggedTarget] = useState();
|
||||
|
|
@ -36,7 +37,7 @@ export default function DragContainer({
|
|||
useEffect(() => {
|
||||
moveableRef.current.updateRect();
|
||||
setTimeout(() => moveableRef.current.updateRect(), 100);
|
||||
}, [selectedComponents.length, JSON.stringify(boxes)]);
|
||||
}, [selectedComponents.length, JSON.stringify(boxes), currentLayout]);
|
||||
|
||||
useEffect(() => {
|
||||
setList(boxList);
|
||||
|
|
|
|||
Loading…
Reference in a new issue