mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Merge branch 'feat/grid-revamp' of https://github.com/ToolJet/ToolJet into feat/grid-revamp
This commit is contained in:
commit
03d92815d2
2 changed files with 22 additions and 20 deletions
|
|
@ -106,25 +106,25 @@ export const Container = ({
|
|||
const [canvasHeight, setCanvasHeight] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
// if (currentLayout === 'mobile' && appDefinition.pages[currentPageId]?.autoComputeLayout) {
|
||||
// const mobLayouts = Object.keys(boxes).map((key) => {
|
||||
// return { ...cloneDeep(boxes[key]?.layouts?.desktop), i: key };
|
||||
// });
|
||||
// const updatedBoxes = cloneDeep(boxes);
|
||||
// let newmMobLayouts = correctBounds(mobLayouts, { cols: 12 });
|
||||
// newmMobLayouts = compact(newmMobLayouts, 'vertical', 12);
|
||||
// Object.keys(boxes).forEach((id) => {
|
||||
// const mobLayout = newmMobLayouts.find((layout) => layout.i === id);
|
||||
// updatedBoxes[id].layouts.mobile = {
|
||||
// left: mobLayout.left,
|
||||
// height: mobLayout.height,
|
||||
// top: mobLayout.top,
|
||||
// width: mobLayout.width,
|
||||
// };
|
||||
// });
|
||||
// setBoxes({ ...updatedBoxes });
|
||||
// // console.log('currentLayout', data);
|
||||
// }
|
||||
if (currentLayout === 'mobile' && appDefinition.pages[currentPageId]?.autoComputeLayout) {
|
||||
const mobLayouts = Object.keys(boxes).map((key) => {
|
||||
return { ...cloneDeep(boxes[key]?.layouts?.desktop), i: key };
|
||||
});
|
||||
const updatedBoxes = cloneDeep(boxes);
|
||||
let newmMobLayouts = correctBounds(mobLayouts, { cols: 43 });
|
||||
newmMobLayouts = compact(newmMobLayouts, 'vertical', 43);
|
||||
Object.keys(boxes).forEach((id) => {
|
||||
const mobLayout = newmMobLayouts.find((layout) => layout.i === id);
|
||||
updatedBoxes[id].layouts.mobile = {
|
||||
left: mobLayout.left,
|
||||
height: mobLayout.height,
|
||||
top: mobLayout.top,
|
||||
width: mobLayout.width,
|
||||
};
|
||||
});
|
||||
setBoxes({ ...updatedBoxes });
|
||||
// console.log('currentLayout', data);
|
||||
}
|
||||
// setNoOfGrids(currentLayout === 'mobile' ? 12 : 43);
|
||||
}, [currentLayout]);
|
||||
|
||||
|
|
|
|||
|
|
@ -228,6 +228,8 @@ function sortLayoutItemsByRowCol(layout) {
|
|||
function scaleLayouts(layouts, cols = 6) {
|
||||
return layouts.map((layout) => ({
|
||||
...layout,
|
||||
width: layout.width <= 4 ? 2 : layout.width <= 8 ? 3 : layout.width,
|
||||
// width: layout.width <= 4 ? 2 : layout.width <= 8 ? 3 : layout.width,
|
||||
// width: layout.width <= 10 ? 10 : layout.width <= 20 ? 24 : 43,
|
||||
width: layout.width * 3 > 43 ? 43 : layout.width * 3,
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue