feat: add drag-to-rearrange and resize handles to dashboard widgets
Edit mode now supports: - Drag handle (grip icon, top-left) to rearrange widgets via HTML5 DnD (drops swap widget positions, persists via API) - Resize handle (corner icon, bottom-right) with mousedown→mousemove→mouseup tracking to change widget width/height in grid units, persists via API - Cursor feedback: grab cursor on draggable widgets, se-resize on handle - Visual feedback: dragging widget shows 50% opacity Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -331,6 +331,15 @@ export async function createWidget(dashboardId: string, data: {
|
||||
return request<DashboardWidget>(`/dashboards/${dashboardId}/widgets`, { method: "POST", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export async function updateWidget(dashboardId: string, widgetId: string, data: {
|
||||
title?: string;
|
||||
widget_type?: string;
|
||||
position?: { x: number; y: number; w: number; h: number };
|
||||
config?: Record<string, unknown>;
|
||||
}): Promise<{ data: DashboardWidget | null; error: string | null }> {
|
||||
return request<DashboardWidget>(`/dashboards/${dashboardId}/widgets/${widgetId}`, { method: "PATCH", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export async function deleteWidget(dashboardId: string, widgetId: string): Promise<{ data: { ok: boolean } | null; error: string | null }> {
|
||||
return request<{ ok: boolean }>(`/dashboards/${dashboardId}/widgets/${widgetId}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user