diff --git a/docs/verification/live-compare-desktop.png b/docs/verification/live-compare-desktop.png new file mode 100644 index 0000000..c475d85 Binary files /dev/null and b/docs/verification/live-compare-desktop.png differ diff --git a/docs/verification/live-compare-mobile-right.png b/docs/verification/live-compare-mobile-right.png new file mode 100644 index 0000000..6403fdb Binary files /dev/null and b/docs/verification/live-compare-mobile-right.png differ diff --git a/docs/verification/live-compare-mobile-table.png b/docs/verification/live-compare-mobile-table.png new file mode 100644 index 0000000..c3bdc45 Binary files /dev/null and b/docs/verification/live-compare-mobile-table.png differ diff --git a/docs/verification/live-compare-mobile.png b/docs/verification/live-compare-mobile.png new file mode 100644 index 0000000..95ee526 Binary files /dev/null and b/docs/verification/live-compare-mobile.png differ diff --git a/static/chat.html b/static/chat.html index 69f44b3..5f7e96b 100644 --- a/static/chat.html +++ b/static/chat.html @@ -364,6 +364,10 @@ button { font-family: inherit; } .file-compare-status { padding: .4rem .9rem; color: var(--text-muted); font-size: .82rem; } .file-compare-status[role="alert"] { color: var(--error, #ad3434); } .file-compare-pages { display: flex; gap: .5rem; align-items: center; padding: .5rem .9rem; } +.file-compare-panel .est-scroll { overflow-x: auto; } +.file-compare-panel .est-table { min-width: 850px; table-layout: auto; } +.file-compare-panel .est-table th, .file-compare-panel .est-table td { min-width: 80px; word-break: normal; overflow-wrap: normal; } +.file-compare-panel .est-table th:nth-child(2), .file-compare-panel .est-table td:nth-child(2) { min-width: 150px; } .est-basis-picker { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; } .est-basis-picker button, .est-basis-picker select { max-width: 100%; font: inherit; color: var(--text); background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: .25rem .4rem; cursor: pointer; } .est-basis-picker button:hover, .est-basis-picker select:focus-visible { border-color: var(--accent); } @@ -540,6 +544,16 @@ button { font-family: inherit; } .msg-ai.has-estimate .est-actions .est-dl { width: 100%; min-height: 2.5rem; word-break: normal; overflow-wrap: normal; } + /* Сверка файлов остаётся таблицей с горизонтальной прокруткой. Карточная + раскладка сметы выше растягивает её строки и ломает селекторы. */ + .msg-ai.has-estimate .file-compare-panel .est-table { display: table; width: 100%; } + .msg-ai.has-estimate .file-compare-panel .est-table tbody { display: table-row-group; width: auto; } + .msg-ai.has-estimate .file-compare-panel .est-table tr { display: table-row; width: auto; padding: 0; } + .msg-ai.has-estimate .file-compare-panel .est-table td { + display: table-cell; width: auto; max-width: 360px; border: 1px solid var(--border-light); + padding: .35rem .55rem; white-space: normal; overflow-wrap: normal; + } + .msg-ai.has-estimate .file-compare-panel .est-table td::before { content: none; } } /* Меряем колонку переписки, а не окно: при открытой панели диалогов колонка узкая и на широком экране. От названия в узкой колонке остаётся «Сметн…» — место нужнее дате сметы @@ -3583,6 +3597,7 @@ function addFileComparePanel(initial, host) { host.classList.add('has-estimate'); host.appendChild(panel); let state = initial, workbooks = [], page = 0; + let pending = Promise.resolve(); const modeNames = {ka_lsr: 'КА ↔ ЛСР: цены', vor_lsr: 'ВОР ↔ ЛСР: объёмы', ka_kp: 'КА ↔ КП: цены'}; const sideNames = {ka_lsr: ['Конъюнктурный анализ', 'Локальная смета'], vor_lsr: ['Ведомость объёмов', 'Локальная смета'], @@ -3602,14 +3617,20 @@ function addFileComparePanel(initial, host) { state = data; page = nextPage; render(); } - async function update(change) { - const r = await authFetch(endpoint, {method: 'POST', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({revision: state._revision, ...change})}); - const data = await r.json().catch(() => ({})); - if (!r.ok) throw new Error(data.detail || 'Не удалось пересчитать сверку'); - state = data; page = 0; - render(); + function update(change) { + // Быстрые изменения двух селекторов идут последовательно: каждый POST + // получает ревизию после предыдущего, иначе второй законно вернёт 409. + const operation = pending.catch(() => {}).then(async () => { + const r = await authFetch(endpoint, {method: 'POST', + headers: {'Content-Type': 'application/json'}, + body: JSON.stringify({revision: state._revision, ...change})}); + const data = await r.json().catch(() => ({})); + if (!r.ok) throw new Error(data.detail || 'Не удалось пересчитать сверку'); + state = data; page = 0; + render(); + }); + pending = operation; + return operation; } function showError(message) { let status = panel.querySelector('.file-compare-status');