Skip to content

Commit 17d1d26

Browse files
authored
Merge pull request #22 from Jakub007d/resizable
feat: adding resizeWidgetConfig
2 parents e27cf3a + 5a11970 commit 17d1d26

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/module/src/WidgetLayout/GridLayout.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'react-grid-layout/css/styles.css';
22
import ReactGridLayout, { useContainerWidth, LayoutItem } from 'react-grid-layout';
3+
import type { ResizeConfig } from 'react-grid-layout/core';
34
import GridTile, { SetWidgetAttribute } from './GridTile';
45
import { useEffect, useMemo, useState } from 'react';
56
import { isWidgetType } from './utils';
@@ -59,6 +60,8 @@ export interface GridLayoutProps {
5960
onActiveWidgetsChange?: (widgetTypes: string[]) => void;
6061
/** Widget type currently being dragged from drawer */
6162
droppingWidgetType?: string;
63+
/** Resize configuration options */
64+
resizeWidgetConfig?: Partial<ResizeConfig>;
6265
}
6366

6467
const LayoutEmptyState = ({
@@ -103,6 +106,7 @@ const GridLayout = ({
103106
onDrawerExpandChange,
104107
onActiveWidgetsChange,
105108
droppingWidgetType,
109+
resizeWidgetConfig,
106110
}: GridLayoutProps) => {
107111
const [isDragging, setIsDragging] = useState(false);
108112
const [isInitialRender, setIsInitialRender] = useState(true);
@@ -254,6 +258,7 @@ const GridLayout = ({
254258
enabled: !isLayoutLocked,
255259
handles: ['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'],
256260
handleComponent: getResizeHandle,
261+
...resizeWidgetConfig,
257262
}}
258263
dropConfig={{
259264
enabled: !isLayoutLocked,

0 commit comments

Comments
 (0)