Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/module/src/WidgetLayout/GridLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'react-grid-layout/css/styles.css';
import ReactGridLayout, { useContainerWidth, LayoutItem } from 'react-grid-layout';
import type { ResizeConfig } from 'react-grid-layout/core';
import GridTile, { SetWidgetAttribute } from './GridTile';
import { useEffect, useMemo, useState } from 'react';
import { isWidgetType } from './utils';
Expand Down Expand Up @@ -59,6 +60,8 @@ export interface GridLayoutProps {
onActiveWidgetsChange?: (widgetTypes: string[]) => void;
/** Widget type currently being dragged from drawer */
droppingWidgetType?: string;
/** Resize configuration options */
resizeWidgetConfig?: Partial<ResizeConfig>;
}

const LayoutEmptyState = ({
Expand Down Expand Up @@ -103,6 +106,7 @@ const GridLayout = ({
onDrawerExpandChange,
onActiveWidgetsChange,
droppingWidgetType,
resizeWidgetConfig,
}: GridLayoutProps) => {
const [isDragging, setIsDragging] = useState(false);
const [isInitialRender, setIsInitialRender] = useState(true);
Expand Down Expand Up @@ -254,6 +258,7 @@ const GridLayout = ({
enabled: !isLayoutLocked,
handles: ['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'],
handleComponent: getResizeHandle,
...resizeWidgetConfig,
}}
dropConfig={{
enabled: !isLayoutLocked,
Expand Down