diff --git a/ui/src/components/ui/data-table/DataTable.vue b/ui/src/components/ui/data-table/DataTable.vue index 1c52cf568..aef8feeaf 100644 --- a/ui/src/components/ui/data-table/DataTable.vue +++ b/ui/src/components/ui/data-table/DataTable.vue @@ -79,6 +79,16 @@ const sortIcon = (id: string) => (sortBy.value?.id !== id ? ArrowUpDown : sortBy const grows = computed(() => (props.columns.some((c) => c.width === "auto") ? "auto" : props.columns[0]?.id)); const width = (column: DataTableColumn) => column.width === "auto" || (!column.width && grows.value === column.id) ? undefined : { width: column.width ?? "10rem" }; +// The table never squeezes the growing column below 8rem: it scrolls instead. +// Each breakpoint sums only the columns it still shows. +const rem = (column: DataTableColumn) => (column.width === "auto" || (!column.width && grows.value === column.id) ? 8 : parseFloat(column.width ?? "10")); +const minimum = (keep: (column: DataTableColumn) => boolean) => + `${shown.value.filter(keep).reduce((sum, c) => sum + rem(c), trailing.value ? 3 : 0)}rem`; +const minimums = computed(() => ({ + "--min-lg": minimum(() => true), + "--min-md": minimum((c) => c.hide !== "md"), + "--min-sm": minimum((c) => !c.hide), +})); const hidden = (column: DataTableColumn) => (column.hide ? (column.hide === "sm" ? "max-sm:hidden" : "max-md:hidden") : undefined); const expandable = computed(() => !props.rowLink && !!slots.detail); @@ -99,7 +109,7 @@ function open(row: Row): void {