refactor(web): trim data table public API
- remove unused data-table exports and dead static table helper types. - keep internal table header, skeleton, empty state, and faceted filter helpers private to the data-table module. - route feature imports through the data-table barrel to avoid subpath coupling.
This commit is contained in:
@@ -318,11 +318,13 @@ function getPinnedColumnClassName(
|
||||
? 'bg-background z-30'
|
||||
: 'bg-background z-10 group-hover:bg-muted/50 group-data-[state=selected]:bg-muted',
|
||||
pinnedColumn.className,
|
||||
kind === 'header' ? pinnedColumn.headerClassName : pinnedColumn.cellClassName
|
||||
kind === 'header'
|
||||
? pinnedColumn.headerClassName
|
||||
: pinnedColumn.cellClassName
|
||||
)
|
||||
}
|
||||
|
||||
export function DataTableHeader<TData>({
|
||||
function DataTableHeader<TData>({
|
||||
table,
|
||||
applyHeaderSize,
|
||||
className,
|
||||
|
||||
+1
-11
@@ -18,7 +18,6 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
export { DataTablePagination } from './pagination'
|
||||
export { DataTableColumnHeader } from './column-header'
|
||||
export { DataTableFacetedFilter } from './faceted-filter'
|
||||
export { DataTableViewOptions } from './view-options'
|
||||
export { DataTableToolbar } from './toolbar'
|
||||
export { DataTableBulkActions } from './bulk-actions'
|
||||
@@ -34,13 +33,10 @@ export {
|
||||
} from '@/components/ui/table'
|
||||
export {
|
||||
StaticDataTable,
|
||||
StaticDataTableEmptyState,
|
||||
StaticDataTableEmptyRow,
|
||||
staticDataTableClassNames,
|
||||
type StaticDataTableElement,
|
||||
} from './static-data-table'
|
||||
export {
|
||||
DataTableHeader,
|
||||
DataTableRow,
|
||||
DataTableView,
|
||||
type DataTableColumnClassName,
|
||||
@@ -48,15 +44,9 @@ export {
|
||||
type DataTableRenderRowHelpers,
|
||||
type DataTableViewProps,
|
||||
} from './data-table-view'
|
||||
export { TableSkeleton } from './table-skeleton'
|
||||
export { TableEmpty } from './table-empty'
|
||||
export { MobileCardList } from './mobile-card-list'
|
||||
export { DataTablePage, type DataTablePageProps } from './data-table-page'
|
||||
export {
|
||||
useDataTable,
|
||||
type DataTableRowSelectionPredicate,
|
||||
type UseDataTableOptions,
|
||||
} from './use-data-table'
|
||||
export { useDataTable } from './use-data-table'
|
||||
|
||||
export const DISABLED_ROW_DESKTOP =
|
||||
'bg-muted/85 hover:bg-muted [&>td:first-child]:border-l-muted-foreground/35 [&>td:first-child]:border-l-4 [&>td:first-child]:pl-1'
|
||||
|
||||
+4
-31
@@ -19,7 +19,6 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import * as React from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Table, TableCell, TableRow } from '@/components/ui/table'
|
||||
import { TableEmpty } from './table-empty'
|
||||
|
||||
export const staticDataTableClassNames = {
|
||||
container: 'overflow-hidden rounded-md border',
|
||||
@@ -55,7 +54,10 @@ type StaticDataTableProps = {
|
||||
className?: string
|
||||
tableClassName?: string
|
||||
containerProps?: Omit<React.ComponentProps<'div'>, 'className' | 'children'>
|
||||
tableProps?: Omit<React.ComponentProps<typeof Table>, 'className' | 'children'>
|
||||
tableProps?: Omit<
|
||||
React.ComponentProps<typeof Table>,
|
||||
'className' | 'children'
|
||||
>
|
||||
}
|
||||
|
||||
export function StaticDataTable({
|
||||
@@ -99,32 +101,3 @@ export function StaticDataTableEmptyRow({
|
||||
</TableRow>
|
||||
)
|
||||
}
|
||||
|
||||
type StaticDataTableEmptyStateProps = {
|
||||
colSpan: number
|
||||
title?: string
|
||||
description?: string
|
||||
icon?: React.ReactNode
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
export function StaticDataTableEmptyState({
|
||||
colSpan,
|
||||
title,
|
||||
description,
|
||||
icon,
|
||||
children,
|
||||
}: StaticDataTableEmptyStateProps) {
|
||||
return (
|
||||
<TableEmpty
|
||||
colSpan={colSpan}
|
||||
title={title}
|
||||
description={description}
|
||||
icon={icon}
|
||||
>
|
||||
{children}
|
||||
</TableEmpty>
|
||||
)
|
||||
}
|
||||
|
||||
export type StaticDataTableElement = React.ComponentProps<typeof Table>
|
||||
|
||||
+1
-4
@@ -23,7 +23,6 @@ import {
|
||||
type ExpandedState,
|
||||
type OnChangeFn,
|
||||
type PaginationState,
|
||||
type Row,
|
||||
type RowSelectionState,
|
||||
type SortingState,
|
||||
type TableOptions,
|
||||
@@ -81,7 +80,7 @@ type DataTableRowModelOptions = {
|
||||
withExpandedRowModel?: boolean
|
||||
}
|
||||
|
||||
export type UseDataTableOptions<TData> = DataTableFeatureOptions<TData> &
|
||||
type UseDataTableOptions<TData> = DataTableFeatureOptions<TData> &
|
||||
DataTableStateOptions &
|
||||
DataTableRowModelOptions & {
|
||||
data: TData[]
|
||||
@@ -239,5 +238,3 @@ export function useDataTable<TData>(options: UseDataTableOptions<TData>) {
|
||||
onPaginationChange,
|
||||
}
|
||||
}
|
||||
|
||||
export type DataTableRowSelectionPredicate<TData> = (row: Row<TData>) => boolean
|
||||
|
||||
@@ -46,7 +46,7 @@ import {
|
||||
TooltipTrigger,
|
||||
} from '@/components/ui/tooltip'
|
||||
import { ConfirmDialog } from '@/components/confirm-dialog'
|
||||
import { DataTableColumnHeader } from '@/components/data-table/column-header'
|
||||
import { DataTableColumnHeader } from '@/components/data-table'
|
||||
import { GroupBadge } from '@/components/group-badge'
|
||||
import { StatusBadge, StatusBadgeList } from '@/components/status-badge'
|
||||
import { TableId } from '@/components/table-id'
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ import {
|
||||
DataTableView,
|
||||
useDataTable,
|
||||
} from '@/components/data-table'
|
||||
import { DataTablePagination } from '@/components/data-table/pagination'
|
||||
import { DataTablePagination } from '@/components/data-table'
|
||||
import { Dialog } from '@/components/dialog'
|
||||
import {
|
||||
sideDrawerContentClassName,
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Eye, Info, Pencil, Settings2, Timer, Trash2 } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { formatTimestampToDate } from '@/lib/format'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { DataTableColumnHeader } from '@/components/data-table/column-header'
|
||||
import { DataTableColumnHeader } from '@/components/data-table'
|
||||
import { StatusBadge } from '@/components/status-badge'
|
||||
import { TableId } from '@/components/table-id'
|
||||
import { getDeploymentStatusConfig } from '../constants'
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from '@/components/ui/tooltip'
|
||||
import { DataTableColumnHeader } from '@/components/data-table/column-header'
|
||||
import { DataTableColumnHeader } from '@/components/data-table'
|
||||
import { GroupBadge } from '@/components/group-badge'
|
||||
import { StatusBadge, StatusBadgeList } from '@/components/status-badge'
|
||||
import { TableId } from '@/components/table-id'
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from '@/components/ui/tooltip'
|
||||
import { DataTableColumnHeader } from '@/components/data-table/column-header'
|
||||
import { DataTableColumnHeader } from '@/components/data-table'
|
||||
import { GroupBadge } from '@/components/group-badge'
|
||||
import { StatusBadge, StatusBadgeList } from '@/components/status-badge'
|
||||
import { DEFAULT_TOKEN_UNIT, QUOTA_TYPE_VALUES } from '../constants'
|
||||
@@ -107,9 +107,7 @@ export function usePricingColumns(
|
||||
cell: ({ row }) => {
|
||||
const model = row.original
|
||||
const modelIconKey = model.icon || model.vendor_icon
|
||||
const modelIcon = modelIconKey
|
||||
? getLobeIcon(modelIconKey, 14)
|
||||
: null
|
||||
const modelIcon = modelIconKey ? getLobeIcon(modelIconKey, 14) : null
|
||||
|
||||
return (
|
||||
<div className='flex min-w-[200px] items-center gap-2'>
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
DataTableView,
|
||||
useDataTable,
|
||||
} from '@/components/data-table'
|
||||
import { DataTablePagination } from '@/components/data-table/pagination'
|
||||
import { DataTablePagination } from '@/components/data-table'
|
||||
import { DEFAULT_PRICING_PAGE_SIZE, DEFAULT_TOKEN_UNIT } from '../constants'
|
||||
import type { PricingModel, TokenUnit } from '../types'
|
||||
import { usePricingColumns } from './pricing-columns'
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { DataTableView, useDataTable } from '@/components/data-table'
|
||||
import { DataTablePagination } from '@/components/data-table/pagination'
|
||||
import { DataTablePagination } from '@/components/data-table'
|
||||
import { Dialog } from '@/components/dialog'
|
||||
import { StatusBadge } from '@/components/status-badge'
|
||||
import type { UpstreamChannel } from '../types'
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { DataTableView, useDataTable } from '@/components/data-table'
|
||||
import { DataTablePagination } from '@/components/data-table/pagination'
|
||||
import { DataTablePagination } from '@/components/data-table'
|
||||
import type { DifferencesMap, RatioType } from '../types'
|
||||
import { RATIO_TYPE_OPTIONS } from './constants'
|
||||
import { useUpstreamRatioSyncColumns } from './upstream-ratio-sync-columns'
|
||||
|
||||
Reference in New Issue
Block a user