diff --git a/src/components/DashKit/__stories__/DashKitGroupsShowcase.tsx b/src/components/DashKit/__stories__/DashKitGroupsShowcase.tsx index e4d30a4..4976162 100644 --- a/src/components/DashKit/__stories__/DashKitGroupsShowcase.tsx +++ b/src/components/DashKit/__stories__/DashKitGroupsShowcase.tsx @@ -7,8 +7,10 @@ import { ActionPanel, DashKit, DashKitDnDWrapper, + DashKitGroup, DashKitProps, DashkitGroupRenderProps, + ReactGridLayoutProps, } from '../../..'; import {DEFAULT_GROUP, MenuItems} from '../../../helpers'; import {i18n} from '../../../i18n'; @@ -153,7 +155,7 @@ export const DashKitGroupsShowcase: React.FC = () => { [config], ); - const groups = React.useMemo( + const groups = React.useMemo( () => [ { id: fixedGroup, @@ -185,6 +187,9 @@ export const DashKitGroupsShowcase: React.FC = () => { ); }, + gridProperties: (props: ReactGridLayoutProps) => { + return {...props, compactType: 'horizontal'}; + }, }, { id: DEFAULT_GROUP, diff --git a/src/components/GridLayout/GridLayout.js b/src/components/GridLayout/GridLayout.js index 4fabddd..69e9c9a 100644 --- a/src/components/GridLayout/GridLayout.js +++ b/src/components/GridLayout/GridLayout.js @@ -203,7 +203,7 @@ export default class GridLayout extends React.PureComponent { ); } - renderGroup(group, renderLayout, renderItems, offset = 0) { + renderGroup(group, renderLayout, renderItems, offset = 0, groupGridProperties) { const { registerManager, editMode, @@ -213,11 +213,17 @@ export default class GridLayout extends React.PureComponent { outerDnDEnable, } = this.context; + const properties = groupGridProperties + ? groupGridProperties({ + ...registerManager.gridLayout, + }) + : registerManager.gridLayout; + return ( ; + export interface DashKitGroup { id?: string; render?: ( @@ -28,4 +47,5 @@ export interface DashKitGroup { children: React.ReactNode, props: DashkitGroupRenderProps, ) => React.ReactNode; + gridProperties?: (props: ReactGridLayoutProps) => ReactGridLayoutProps; }