Skip to content

Collections: Add column resize and reorder to the DataView table#43

Merged
priethor merged 22 commits into
mainfrom
priethor/add/drag-columns
May 1, 2026
Merged

Collections: Add column resize and reorder to the DataView table#43
priethor merged 22 commits into
mainfrom
priethor/add/drag-columns

Conversation

@priethor

@priethor priethor commented May 1, 2026

Copy link
Copy Markdown
Collaborator

What

Closes #100
Adds column resize and reorder to the DataView table.

Why

DataViews has no resize handle or reorder hook, so column widths and order were whatever DataViews chose.

How

  • DataViewColumnInteractions portals a drag handle and a resize separator into each <th>. The resize handler writes inline widths on every pointermove and commits the final width to view.layout.styles on pointerup. Reorder goes through dnd-kit.
  • The dataViewColumns helper holds the per-type min widths, the withColumnWidth / withColumnOrder writers, and normalizeView, which prunes stale style entries and re-pins the title if it falls out of view.fields.
  • The table runs in table-layout: fixed with the library's per-cell min-width overridden, so a resized width is the column's actual width.
  • Content wrapping: Plain text gets an ellipsis, chips wrap inside their cell, and the header label truncates without clipping its focus ring.

Upstream opportunities

The adapter exists because DataViews has no public column-interaction surface, so there are many opportunities for upstream fixes, which are documented in the tech debt doc.

Testing Instructions

  1. Open a page with a DataView block.
  2. Drag a column's right edge. Save, reload, confirm the width survives.
  3. Double-click the right edge. The column auto-fits to its widest cell.
  4. Drag a header sideways past another column's midpoint. The displaced columns slide aside and the drop indicator follows the pointer. Save, reload, confirm the new order survives.
  5. Shrink a multiselect column to its minimum. Chips should wrap inside the cell.
  6. Shrink a header until the label truncates. The focus ring should still render in full.
  7. npm test -- dataViewColumns
  8. npm run test:e2e -- data-view-block

Screen recording

Grabacion.de.pantalla.2026-05-01.a.las.13.09.11.mov

@priethor priethor self-assigned this May 1, 2026
Renumbered the DataViews column-interaction tech-debt entry to #15 so it
sits after main's new system-field entries (#12-14), and updated the
tech-debt.md cross-references in DataViewColumnInteractions.js and
index.scss to match.
@priethor priethor merged commit 3521223 into main May 1, 2026
6 checks passed
@priethor priethor deleted the priethor/add/drag-columns branch May 1, 2026 12:07
@priethor priethor added this to the 0.1.0 milestone May 28, 2026
@priethor priethor added type: enhancement Improvement to existing behavior. area: collections Fields, rows, views, DataViews, relations, rollups, formulas, and row properties. labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: collections Fields, rows, views, DataViews, relations, rollups, formulas, and row properties. type: enhancement Improvement to existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let users resize and reorder table columns by dragging

1 participant