fix table

This commit is contained in:
2026-09-02 15:42:48 +03:00
parent dd235f675c
commit 22c7ab7140
7 changed files with 554 additions and 42 deletions
+28 -2
View File
@@ -234,6 +234,10 @@ export default function ProjectPage() {
}, [tableType, project, loadTable, loadTableSettings]);
const columns = useMemo(() => COLUMNS[tableType] || [], [tableType]);
const overflowCount = useMemo(
() => rows.reduce((n, r) => n + (r.overflow_fields?.length || 0), 0),
[rows]
);
async function onUpload(e, method = "POST") {
const file = e.target.files?.[0];
@@ -620,11 +624,30 @@ export default function ProjectPage() {
Excel
</button>
{tableType !== "simple_list" && (
<button disabled={busy} onClick={() => api.exportDoc(projectId, tableType, "pdf")}>
<button
disabled={busy}
onClick={async () => {
setBusy(true);
try {
await api.exportDoc(projectId, tableType, "pdf");
await loadTable();
} catch (e) {
setError(e.message);
} finally {
setBusy(false);
}
}}
>
PDF
</button>
)}
</div>
{overflowCount > 0 && (
<div className="overflow-banner">
Переполнение ячеек: {overflowCount}. Красным отмечены поля, не влезающие в PDF даже с поджимом.
Сократите текст или уменьшите поджим в настройках.
</div>
)}
{tableSettings?.fields?.length > 0 && (
<div className="settings-panel stack">
@@ -714,7 +737,10 @@ export default function ProjectPage() {
<tr key={row.id || idx} className={row.is_header ? "header-row" : ""}>
<td className="muted">{row.row_index ?? idx}</td>
{columns.map(([key]) => (
<td key={key}>
<td
key={key}
className={row.overflow_fields?.includes(key) ? "cell-overflow" : ""}
>
<input
value={row[key] ?? ""}
disabled={row.is_empty}
+8
View File
@@ -68,6 +68,14 @@ table.data input {
}
table.data input:focus { border-color: var(--accent); background: #fff; }
table.data tr.header-row td { font-weight: 700; text-decoration: underline; }
table.data td.cell-overflow input { background: #ffd5d5; }
.overflow-banner {
background: #fff0f0;
border: 1px solid #e8a0a0;
border-radius: 6px;
padding: 0.5rem 0.75rem;
font-size: 0.85rem;
}
.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.tab {
background: #e7e0d2; color: var(--ink); border-radius: 999px; padding: 0.35rem 0.8rem;