From b0a40fcc16d15682f08df7095a8010da29eda1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=20Gon=C3=A7aalves?= Date: Wed, 22 Oct 2025 18:40:38 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20corre=C3=A7=C3=A3o=20dos=20valores=20da?= =?UTF-8?q?=20coluna?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/DRE/analitico.tsx | 50 +++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/src/app/DRE/analitico.tsx b/src/app/DRE/analitico.tsx index b3e8f0f..fa3acd0 100644 --- a/src/app/DRE/analitico.tsx +++ b/src/app/DRE/analitico.tsx @@ -251,22 +251,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 130, sortable: true, resizable: true, - valueFormatter: (params: any) => { + renderCell: (params: any) => { const value = params.value; if (value === null || value === undefined || value === "" || value === 0) return "-"; const numValue = typeof value === "string" ? parseFloat(value) : Number(value); if (isNaN(numValue)) return "-"; - return new Intl.NumberFormat("pt-BR", { + const formatted = new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL", }).format(numValue); - }, - cellClassName: (params: any) => { - const value = params.value; - if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500"; - const numValue = typeof value === "string" ? parseFloat(value) : Number(value); - if (isNaN(numValue)) return "text-gray-500"; - return numValue < 0 ? "text-red-600" : "text-gray-900"; + return ( + + {formatted} + + ); }, }, { @@ -276,22 +274,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 140, sortable: true, resizable: true, - valueFormatter: (params: any) => { + renderCell: (params: any) => { const value = params.value; if (value === null || value === undefined || value === "" || value === 0) return "-"; const numValue = typeof value === "string" ? parseFloat(value) : Number(value); if (isNaN(numValue)) return "-"; - return new Intl.NumberFormat("pt-BR", { + const formatted = new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL", }).format(numValue); - }, - cellClassName: (params: any) => { - const value = params.value; - if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500"; - const numValue = typeof value === "string" ? parseFloat(value) : Number(value); - if (isNaN(numValue)) return "text-gray-500"; - return numValue < 0 ? "text-red-600" : "text-gray-900"; + return ( + + {formatted} + + ); }, }, { @@ -301,22 +297,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 130, sortable: true, resizable: true, - valueFormatter: (params: any) => { + renderCell: (params: any) => { const value = params.value; if (value === null || value === undefined || value === "" || value === 0) return "-"; const numValue = typeof value === "string" ? parseFloat(value) : Number(value); if (isNaN(numValue)) return "-"; - return new Intl.NumberFormat("pt-BR", { + const formatted = new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL", }).format(numValue); - }, - cellClassName: (params: any) => { - const value = params.value; - if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500"; - const numValue = typeof value === "string" ? parseFloat(value) : Number(value); - if (isNaN(numValue)) return "text-gray-500"; - return numValue < 0 ? "text-red-600" : "text-gray-900"; + return ( + + {formatted} + + ); }, }, { @@ -341,7 +335,7 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { width: 80, sortable: true, resizable: true, - valueFormatter: (params: any) => params.value || "-", + renderCell: (params: any) => params.value || "-", }, ] as any, []);