From bf567eabfae5f5dffdaaf88976ca828ad7c69d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=20Gon=C3=A7aalves?= Date: Fri, 7 Nov 2025 19:22:20 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20corre=C3=A7=C3=A3o=20do=20scroll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/DRE/analitico.tsx | 56 ++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/app/DRE/analitico.tsx b/src/app/DRE/analitico.tsx index effb14d..d6d6d1c 100644 --- a/src/app/DRE/analitico.tsx +++ b/src/app/DRE/analitico.tsx @@ -939,7 +939,7 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { -
+
row.id || `row-${row.recnum || Math.random()}`} sx={{ overflowAnchor: 'none', + height: "100%", + display: "flex", + flexDirection: "column", "& .MuiDataGrid-root": { display: "flex", flexDirection: "column", height: "100%", + flex: 1, + overflow: "hidden", }, "& .MuiDataGrid-main": { - overflow: "visible", + overflow: "hidden !important", position: "relative", height: "100%", + display: "flex", + flexDirection: "column", + flex: 1, + }, + // Container dos headers - DEVE FICAR FIXO (não rola) + "& .MuiDataGrid-container--top": { + overflow: "hidden !important", + position: "relative", + zIndex: 100, + backgroundColor: "#f9fafb", + flexShrink: 0, + flexGrow: 0, }, "& .MuiDataGrid-columnHeaders": { - position: "sticky", - top: 0, + position: "relative !important", backgroundColor: "#f9fafb !important", zIndex: 100, borderBottom: "1px solid #e5e7eb", @@ -976,31 +992,30 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { backgroundColor: "#f9fafb !important", }, "& .MuiDataGrid-columnHeaderRow": { - position: "sticky", - top: 0, - zIndex: 100, backgroundColor: "#f9fafb !important", }, "& .MuiDataGrid-columnHeadersInner": { - position: "sticky", - top: 0, - zIndex: 100, backgroundColor: "#f9fafb !important", }, - // Garantir que o container dos headers não seja cortado - "& .MuiDataGrid-container--top": { - overflow: "visible", - position: "relative", - zIndex: 100, - }, "& .MuiDataGrid-cell": { borderBottom: "1px solid #f0f0f0", fontSize: "0.875rem", }, + // Container do virtualScroller - deve ter scroll e ocupar espaço restante + "& .MuiDataGrid-container--bottom": { + flex: 1, + overflow: "hidden !important", + position: "relative", + minHeight: 0, + display: "flex", + flexDirection: "column", + }, + // Apenas o virtualScroller deve ter scroll "& .MuiDataGrid-virtualScroller": { - overflowY: "auto", - overflowX: "auto", - maxHeight: "calc(40vh - 120px)", + overflowY: "auto !important", + overflowX: "auto !important", + height: "100% !important", + flex: 1, overflowAnchor: 'none', // Garantir que a barra de scroll seja visível scrollbarWidth: "thin", @@ -1030,9 +1045,6 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { borderBottom: "1px solid #e5e7eb", padding: "8px 16px", }, - "& .MuiDataGrid-container--bottom": { - overflow: "hidden", - }, "& .MuiDataGrid-scrollbar": { display: "none", },