dees-dashboardgrid
<dees-dashboardgrid> renders a configurable dashboard layout with draggable and resizable tiles. The component is now grouped in its own folder alongside supporting utilities and styles.
Key Features
- Pointer-driven drag and resize interactions with keyboard fallbacks (arrow keys to move, Shift+ arrows to resize).
- Collision-aware placement that swaps compatible tiles or displaces blocking tiles into the next free slot.
- Context menu (right-click on a tile header) that exposes destructive actions such as tile removal via dees-contextmenu.
- Layout persistence helpers via getLayout(),setLayout(...), and thelayout-changeevent.
- Responsive presets through the layoutsmap andapplyBreakpointLayout(...)helper to hydrate per-breakpoint arrangements.
Public API Highlights
| Property | Description | 
| widgets | Array of tile descriptors ( DashboardWidget). | 
| columns | Number of grid columns. | 
| layouts | Optional record of named layout definitions. | 
| activeBreakpoint | Name of the currently applied breakpoint layout. | 
| editable | Toggles drag/resize affordances. | 
| Method | Description | 
| addWidget(widget, autoPosition?) | Adds a tile, optionally auto-placing it into the next free slot. | 
| removeWidget(id) | Removes a tile and emits widget-remove. | 
| applyBreakpointLayout(name) | Applies a layout from the layoutsmap. | 
| getLayout()/setLayout(layout) | Retrieve or apply persisted layouts. | 
| compact(direction?) | Densifies the grid vertically (default) or horizontally. | 
| Event | Detail payload | 
| widget-move | { widget, displaced, swappedWith } | 
| widget-resize | { widget, displaced, swappedWith } | 
| widget-remove | { widget } | 
| layout-change | { layout } | 
Usage Notes
- Right-click a tile header to open the contextual menu and delete the tile.
- When resizing, blocking tiles will automatically reflow into free space once the interaction completes.
- Listen to layout-changeto persist layouts to storage; rehydrate usingsetLayoutor thelayoutsmap.
- For responsive dashboards, populate grid.layouts = { base: [...], mobile: [...] }and callapplyBreakpointLayoutbased on your own breakpoint logic (see the co-located demo for an example).
Demo
The updated dees-dashboardgrid.demo.ts showcases live breakpoint switching, layout persistence, and the context menu. Run the demo gallery to explore the interactions end-to-end.