MCPcopy
hub / github.com/react-grid-layout/react-grid-layout / GridLayout

Function GridLayout

src/react/components/GridLayout.tsx:296–1128  ·  view source on GitHub ↗
(props: GridLayoutProps)

Source from the content-addressed store, hash-verified

294 * GridLayout - A reactive, fluid grid layout with draggable, resizable components.
295 */
296export function GridLayout(props: GridLayoutProps): ReactElement {
297 const {
298 // Required
299 children,
300 width,
301
302 // Composable config interfaces
303 gridConfig: gridConfigProp,
304 dragConfig: dragConfigProp,
305 resizeConfig: resizeConfigProp,
306 dropConfig: dropConfigProp,
307 positionStrategy = defaultPositionStrategy,
308 compactor: compactorProp,
309 constraints = defaultConstraints,
310
311 // Layout data
312 layout: propsLayout = [],
313 droppingItem: droppingItemProp,
314
315 // Container props
316 autoSize = true,
317 className = "",
318 style = {},
319 innerRef,
320
321 // Callbacks
322 onLayoutChange = noop,
323 onDragStart: onDragStartProp = noop,
324 onDrag: onDragProp = noop,
325 onDragStop: onDragStopProp = noop,
326 onResizeStart: onResizeStartProp = noop,
327 onResize: onResizeProp = noop,
328 onResizeStop: onResizeStopProp = noop,
329 onDrop: onDropProp = noop,
330 onDropDragOver: onDropDragOverProp = noop
331 } = props;
332
333 // Resolve config interfaces with defaults
334 const gridConfig: GridConfig = useMemo(
335 () => ({ ...defaultGridConfig, ...gridConfigProp }),
336 [gridConfigProp]
337 );
338 const dragConfig: DragConfig = useMemo(
339 () => ({ ...defaultDragConfig, ...dragConfigProp }),
340 [dragConfigProp]
341 );
342 const resizeConfig: ResizeConfig = useMemo(
343 () => ({ ...defaultResizeConfig, ...resizeConfigProp }),
344 [resizeConfigProp]
345 );
346 const dropConfig: DropConfig = useMemo(
347 () => ({ ...defaultDropConfig, ...dropConfigProp }),
348 [dropConfigProp]
349 );
350
351 // Destructure resolved configs for convenience
352 const { cols, rowHeight, maxRows, margin, containerPadding } = gridConfig;
353 const {

Callers

nothing calls this directly

Calls 14

getCompactorFunction · 0.85
childrenEqualFunction · 0.85
bottomFunction · 0.85
getLayoutItemFunction · 0.85
cloneLayoutItemFunction · 0.85
moveElementFunction · 0.85
withLayoutItemFunction · 0.85
getAllCollisionsFunction · 0.85
calcGridColWidthFunction · 0.85
calcGridItemWHPxFunction · 0.85
calcXYFunction · 0.85
renderPlaceholderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…