ajuste no cabeçalho

This commit is contained in:
Felipe Batista 2025-10-08 01:26:38 -03:00
parent 3015974658
commit 03f860dc30
1 changed files with 53 additions and 28 deletions

View File

@ -495,10 +495,17 @@ export default function Teste() {
</div>
</div>
<Table>
<TableHeader>
<TableRow>
<TableHead>
<div className="max-h-[400px] overflow-y-auto border rounded-md relative">
{/* Header fixo separado */}
<div
className="sticky top-0 z-30 border-b shadow-sm"
style={{ backgroundColor: 'white', opacity: 1 }}
>
<div
className="flex items-center p-4 font-semibold"
style={{ backgroundColor: 'white', opacity: 1 }}
>
<div className="flex-1 min-w-[200px]">
<Button
variant="ghost"
onClick={() => handleSort('descricao')}
@ -507,13 +514,13 @@ export default function Teste() {
Descrição
{getSortIcon('descricao')}
</Button>
</TableHead>
</div>
{mesesDisponiveis.map((mes) => (
<TableHead key={mes} className="text-right">
<div key={mes} className="w-24 text-right px-2">
{mes}
</TableHead>
</div>
))}
<TableHead className="text-right">
<div className="w-24 text-right px-2">
<Button
variant="ghost"
onClick={() => handleSort('valor')}
@ -522,29 +529,47 @@ export default function Teste() {
Total
{getSortIcon('valor')}
</Button>
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{hierarchicalData.map((row, index) => (
<TableRow key={index} className={getRowStyle(row)}>
<TableCell style={getIndentStyle(row.level)}>
{renderCellContent(row)}
</TableCell>
</div>
</div>
</div>
<Table>
<TableHeader className="hidden">
<TableRow>
<TableHead></TableHead>
{mesesDisponiveis.map((mes) => (
<TableCell key={mes} className="text-right font-medium">
{row.valoresPorMes && row.valoresPorMes[mes]
? formatCurrency(row.valoresPorMes[mes])
: '-'}
</TableCell>
<TableHead key={mes}></TableHead>
))}
<TableCell className="text-right font-medium">
{formatCurrency(row.total!)}
</TableCell>
<TableHead></TableHead>
</TableRow>
))}
</TableBody>
</Table>
</TableHeader>
<TableBody>
{hierarchicalData.map((row, index) => (
<TableRow key={index} className={getRowStyle(row)}>
<TableCell
className="flex-1 min-w-[200px]"
style={getIndentStyle(row.level)}
>
{renderCellContent(row)}
</TableCell>
{mesesDisponiveis.map((mes) => (
<TableCell
key={mes}
className="w-24 text-right font-medium px-2"
>
{row.valoresPorMes && row.valoresPorMes[mes]
? formatCurrency(row.valoresPorMes[mes])
: '-'}
</TableCell>
))}
<TableCell className="w-24 text-right font-medium px-2">
{formatCurrency(row.total!)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</div>
);
}