|
1 | 1 | import 'react-grid-layout/css/styles.css'; |
2 | 2 | import ReactGridLayout, { useContainerWidth, LayoutItem } from 'react-grid-layout'; |
| 3 | +import type { ResizeConfig } from 'react-grid-layout/core'; |
3 | 4 | import GridTile, { SetWidgetAttribute } from './GridTile'; |
4 | 5 | import { useEffect, useMemo, useState } from 'react'; |
5 | 6 | import { isWidgetType } from './utils'; |
@@ -59,6 +60,8 @@ export interface GridLayoutProps { |
59 | 60 | onActiveWidgetsChange?: (widgetTypes: string[]) => void; |
60 | 61 | /** Widget type currently being dragged from drawer */ |
61 | 62 | droppingWidgetType?: string; |
| 63 | + /** Resize configuration options */ |
| 64 | + resizeWidgetConfig?: Partial<ResizeConfig>; |
62 | 65 | } |
63 | 66 |
|
64 | 67 | const LayoutEmptyState = ({ |
@@ -103,6 +106,7 @@ const GridLayout = ({ |
103 | 106 | onDrawerExpandChange, |
104 | 107 | onActiveWidgetsChange, |
105 | 108 | droppingWidgetType, |
| 109 | + resizeWidgetConfig, |
106 | 110 | }: GridLayoutProps) => { |
107 | 111 | const [isDragging, setIsDragging] = useState(false); |
108 | 112 | const [isInitialRender, setIsInitialRender] = useState(true); |
@@ -254,6 +258,7 @@ const GridLayout = ({ |
254 | 258 | enabled: !isLayoutLocked, |
255 | 259 | handles: ['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'], |
256 | 260 | handleComponent: getResizeHandle, |
| 261 | + ...resizeWidgetConfig, |
257 | 262 | }} |
258 | 263 | dropConfig={{ |
259 | 264 | enabled: !isLayoutLocked, |
|
0 commit comments