From e28a81c07c0ed3089b530b590b3decc233f4396f Mon Sep 17 00:00:00 2001 From: Galindo97 Date: Wed, 21 Jan 2026 15:44:54 -0600 Subject: [PATCH] fix(table): add overflow handling and className support for table columns --- frontend/src/app.css | 2 +- .../dashboard/pedimentos/columns.ts | 22 +++++++++++++++++++ .../dashboard/pedimentos/data-table.svelte | 10 ++++----- frontend/src/routes/dashboard/+layout.svelte | 4 ++-- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/frontend/src/app.css b/frontend/src/app.css index 8d9a66ab..6c344082 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -118,6 +118,6 @@ @apply border-border outline-ring/50; } body { - @apply bg-background text-foreground; + @apply bg-background text-foreground overflow-x-hidden; } } diff --git a/frontend/src/lib/components/dashboard/pedimentos/columns.ts b/frontend/src/lib/components/dashboard/pedimentos/columns.ts index 2bdfbe51..d56a174e 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/columns.ts +++ b/frontend/src/lib/components/dashboard/pedimentos/columns.ts @@ -4,6 +4,13 @@ import { createRawSnippet } from "svelte"; import DataTableActions from "./data-table-actions.svelte"; import type { Pedimento } from "$lib/api/dashboard/a76/pedimentos"; +// Extender el tipo ColumnMeta para incluir className +declare module "@tanstack/table-core" { + interface ColumnMeta { + className?: string; + } +} + /** * Formatea un número como moneda */ @@ -120,6 +127,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_type", header: "Tipo", + meta: { className: "hidden md:table-cell" }, cell: ({ row }) => { const typeSnippet = createRawSnippet<[{ type?: string | null }]>((getType) => { const { type } = getType(); @@ -134,6 +142,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_code", header: "Clave", + meta: { className: "hidden lg:table-cell" }, cell: ({ row }) => { const codeSnippet = createRawSnippet<[{ code?: string | null }]>((getCode) => { const { code } = getCode(); @@ -148,6 +157,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "regime", header: "Régimen", + meta: { className: "hidden lg:table-cell" }, cell: ({ row }) => { const regimeSnippet = createRawSnippet<[{ regime?: string | null }]>((getRegime) => { const { regime } = getRegime(); @@ -162,6 +172,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_dates.start_date", header: "Fecha Inicio", + meta: { className: "hidden xl:table-cell" }, cell: ({ row }) => { const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => { const { date } = getDate(); @@ -176,6 +187,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_dates.end_date", header: "Fecha Final", + meta: { className: "hidden xl:table-cell" }, cell: ({ row }) => { const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => { const { date } = getDate(); @@ -190,6 +202,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_dates.payment_date", header: "Fecha de Pago", + meta: { className: "hidden xl:table-cell" }, cell: ({ row }) => { const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => { const { date } = getDate(); @@ -204,6 +217,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_config_update_rectification.pediment_rectifed_18", header: "Pedimento 18", + meta: { className: "hidden lg:table-cell" }, cell: ({ row }) => { const ped18Snippet = createRawSnippet<[{ value?: string | null }]>((getValue) => { const { value } = getValue(); @@ -218,6 +232,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_config_update_rectification.r1", header: "Pedimento R1", + meta: { className: "hidden lg:table-cell" }, cell: ({ row }) => { const r1Snippet = createRawSnippet<[{ value?: string | null }]>((getValue) => { const { value } = getValue(); @@ -232,6 +247,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_validation.electronic_signature", header: "Acuse Electrónico", + meta: { className: "hidden xl:table-cell" }, cell: ({ row }) => { const ackSnippet = createRawSnippet<[{ value?: string | null }]>((getValue) => { const { value } = getValue(); @@ -249,6 +265,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "pedimento_payments.total_contributions", header: "¿Se pagó el impuesto?", + meta: { className: "hidden xl:table-cell" }, cell: ({ row }) => { const paidSnippet = createRawSnippet<[{ value?: string | null }]>((getValue) => { const { value } = getValue(); @@ -266,6 +283,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "client_id", header: "Cliente", + meta: { className: "hidden md:table-cell" }, cell: ({ row }) => { const clientSnippet = createRawSnippet<[{ clientId?: number | null }]>((getClient) => { const { clientId } = getClient(); @@ -309,6 +327,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { }); return renderSnippet(headerSnippet, {}); }, + meta: { className: "hidden lg:table-cell" }, cell: ({ row }) => { const valueSnippet = createRawSnippet<[{ value: string }]>((getValue) => { const { value } = getValue(); @@ -330,6 +349,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { }); return renderSnippet(headerSnippet, {}); }, + meta: { className: "hidden xl:table-cell" }, cell: ({ row }) => { const priceSnippet = createRawSnippet<[{ price: string }]>((getPrice) => { const { price } = getPrice(); @@ -351,6 +371,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { }); return renderSnippet(headerSnippet, {}); }, + meta: { className: "hidden lg:table-cell" }, cell: ({ row }) => { const weightSnippet = createRawSnippet<[{ weight: string }]>((getWeight) => { const { weight } = getWeight(); @@ -365,6 +386,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { accessorKey: "created_at", header: "Fecha de Creación", + meta: { className: "hidden 2xl:table-cell" }, cell: ({ row }) => { const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => { const { date } = getDate(); diff --git a/frontend/src/lib/components/dashboard/pedimentos/data-table.svelte b/frontend/src/lib/components/dashboard/pedimentos/data-table.svelte index 4c448e3d..1a5b4fd6 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/data-table.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/data-table.svelte @@ -60,13 +60,13 @@
-
- - +
+ + {#each table.getHeaderGroups() as headerGroup (headerGroup.id)} {#each headerGroup.headers as header (header.id)} - + {#if !header.isPlaceholder} {#each row.getVisibleCells() as cell (cell.id)} - + - +
@@ -55,7 +55,7 @@ -->
-
+
{@render children()}