diff --git a/docs/changelog/2026-09-15-c163-falas-colunas.md b/docs/changelog/2026-09-15-c163-falas-colunas.md new file mode 100644 index 00000000..d8f8ff7f --- /dev/null +++ b/docs/changelog/2026-09-15-c163-falas-colunas.md @@ -0,0 +1 @@ +**C163 — largura das colunas no acervo de falas (2026-09-15):** a tabela "Acervo de falas" ganhou larguras explícitas por coluna (Data 8% · Fase 11% · O que é 37% · Menção ao município 32% · Link 12%) porque o sumário oficial e o trecho de menção são descrições elaboradas; o renderer passou a aceitar `width` por coluna e usa `table-layout: fixed` com `overflow-wrap` quando definido (a URL do Diário quebra dentro da célula). Unit 3117/3117 e `tsc` verdes; PDF de Itamaraju regerado. diff --git a/scripts/lib/cityReportBlocks.mjs b/scripts/lib/cityReportBlocks.mjs index 6368071c..f31e556a 100644 --- a/scripts/lib/cityReportBlocks.mjs +++ b/scripts/lib/cityReportBlocks.mjs @@ -802,11 +802,11 @@ const buildSpeechesSection = ({ snapshot }) => { kind: 'table', title: 'Acervo de falas', columns: [ - { key: 'date', label: 'Data' }, - { key: 'phase', label: 'Fase' }, - { key: 'description', label: 'O que é' }, - { key: 'mention', label: `Menção a ${cityLabel}` }, - { key: 'link', label: 'Link' }, + { key: 'date', label: 'Data', width: 8 }, + { key: 'phase', label: 'Fase', width: 11 }, + { key: 'description', label: 'O que é', width: 37 }, + { key: 'mention', label: `Menção a ${cityLabel}`, width: 32 }, + { key: 'link', label: 'Link', width: 12 }, ], rows: speeches.rows.map((row) => ({ date: formatDateBr(row.speechAt), diff --git a/scripts/lib/cityReportRender.mjs b/scripts/lib/cityReportRender.mjs index f48689c3..662f8f11 100644 --- a/scripts/lib/cityReportRender.mjs +++ b/scripts/lib/cityReportRender.mjs @@ -127,6 +127,8 @@ const PRINT_CSS = ` .pair .panel li, .bullets li { margin-bottom: .8mm; } .pair-note { color: #92400e; font-size: 7.6pt; margin: 1.2mm 0 0; } table { width: 100%; border-collapse: collapse; font-size: 8pt; } + table.table-fixed { table-layout: fixed; } + table.table-fixed td, table.table-fixed th { overflow-wrap: anywhere; } caption { caption-side: top; text-align: left; font-weight: 600; font-size: 8.6pt; padding-bottom: 1.2mm; color: #18181b; } th { text-align: left; background: #f4f4f5; border-bottom: .8px solid #d4d4d8; padding: 1.4mm 1.4mm; font-size: 7pt; text-transform: uppercase; letter-spacing: .03em; color: #52525b; } td { border-bottom: .6px solid #e4e4e7; padding: 1.4mm 1.4mm; vertical-align: top; } @@ -217,8 +219,12 @@ const renderPair = (block) => { } const renderTable = (block) => { + const fixed = block.columns.some((column) => column.width) const head = block.columns - .map((column) => `
${htmlEscape(block.note)}
` : '' }` } diff --git a/tests/unit/cityReportBlocks.unit.spec.ts b/tests/unit/cityReportBlocks.unit.spec.ts index e9efb0ed..f462c07d 100644 --- a/tests/unit/cityReportBlocks.unit.spec.ts +++ b/tests/unit/cityReportBlocks.unit.spec.ts @@ -306,7 +306,7 @@ type ReportBlock = { title?: string items?: ReportItem[] rows?: ReportRow[] - columns?: Array<{ key: string; label: string }> + columns?: Array<{ key: string; label: string; width?: number }> cells?: Array<{ title: string; blocks: ReportBlock[] }> body?: string[] sources?: Array<{ kind: string; url?: string | null }> @@ -389,6 +389,8 @@ describe('buildCityReport', () => { `Menção a ${snapshot.municipality.name}`, 'Link', ]) + expect(falas.columns!.find((column) => column.key === 'description')!.width).toBe(37) + expect(falas.columns!.find((column) => column.key === 'mention')!.width).toBe(32) expect(rows[0].description).toBe('Resumo da fala') expect(rows[0].mention).toContain('cita Feira de Santana') expect(rows[1].description).toBe('Saúde indígena na Bahia')