From dfc934019316f923a965b55f3bb64d931af35d22 Mon Sep 17 00:00:00 2001 From: overtrue Date: Wed, 29 Oct 2025 22:37:28 +0800 Subject: [PATCH] wip: object list fixed --- components/data-table/data-table.vue | 24 ++- components/modal.vue | 2 +- components/object/info.vue | 123 +++++++++++--- components/object/list.vue | 234 +++++++++++++++++++-------- components/object/task-stats.vue | 5 +- components/object/upload/picker.vue | 4 +- components/object/versions.vue | 62 ++++--- components/page.vue | 2 +- layouts/default.vue | 4 +- pages/browser/[bucket]/[[key]].vue | 9 +- tests/utils/functions.test.ts | 219 +++++++++++-------------- utils/functions.ts | 79 +++------ 12 files changed, 451 insertions(+), 316 deletions(-) diff --git a/components/data-table/data-table.vue b/components/data-table/data-table.vue index a11d1cb..ed93690 100644 --- a/components/data-table/data-table.vue +++ b/components/data-table/data-table.vue @@ -11,7 +11,7 @@ import { Table as UiTable, } from '@/components/ui/table' import { cn } from '@/lib/utils' -import type { Table } from '@tanstack/vue-table' +import type { Column, Table } from '@tanstack/vue-table' import { FlexRender } from '@tanstack/vue-table' import { computed } from 'vue' @@ -40,6 +40,16 @@ const props = withDefaults( const visibleColumnCount = computed(() => props.table.getVisibleLeafColumns().length) const hasRows = computed(() => props.table.getRowModel().rows.length > 0) + +const resolveMaxWidth = (value?: string | number) => { + if (value == null) return undefined + return typeof value === 'number' ? `${value}px` : value +} + +const getColumnStyles = (column: Column) => { + const maxWidth = resolveMaxWidth(column.columnDef.meta?.maxWidth) + return maxWidth ? { maxWidth } : undefined +}