table changes

This commit is contained in:
Carter 2026-03-16 12:30:18 -06:00
parent 843e3a792e
commit 0ea05bdb72

View file

@ -546,15 +546,19 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
const clampedWidth = Math.max(MIN_COLUMN_WIDTH, newWidthForIndex) const clampedWidth = Math.max(MIN_COLUMN_WIDTH, newWidthForIndex)
const actualDelta = newWidths[index] - clampedWidth const actualDelta = newWidths[index] - clampedWidth
newWidths[index] = clampedWidth newWidths[index] = clampedWidth
newWidths.every((width, j) => {
if (j <= index || width === 0) return true if (actualDelta > 0) {
else if (newWidths[j] !== undefined) { // Shrinking current column give space to next column
newWidths[j] = newWidths[j] + actualDelta newWidths[index + 1] = (newWidths[index + 1] ?? 0) + actualDelta
return false } else if (actualDelta < 0) {
} // Growing current column take from next column only what it can give
}) const nextWidth = newWidths[index + 1] ?? 0
const availableFromNext = Math.max(0, nextWidth - MIN_COLUMN_WIDTH)
const takeFromNext = Math.min(-actualDelta, availableFromNext)
newWidths[index + 1] = nextWidth - takeFromNext
// If we couldn't take enough, the table grows (clampedWidth already applied)
}
setRowWidths(newWidths) setRowWidths(newWidths)
} }
const MIN_COLUMN_WIDTH = 24; const MIN_COLUMN_WIDTH = 24;