Fit all norm cost columns on desktop

This commit is contained in:
anor
2026-12-05 05:57:42 +10:00
parent 011c57df9e
commit 4b1d6b1d07
5 changed files with 42 additions and 20 deletions
+1 -1
View File
@@ -555,7 +555,7 @@ MAX_MESSAGE_LEN = 10_000
# ⚠️ Версия UI — единый источник. БАМПАТЬ ПРИ КАЖДОМ ДЕПЛОЕ (формат: YYYY-MM-DD + буква).
# Фронт берёт её через GET /api/version (chat.html + admin.html, элемент .app-version).
APP_VERSION = "2026-12-04h"
APP_VERSION = "2026-12-05a"
# Audit: path → action name mapping
_AUDIT_MAP = [
+7 -7
View File
@@ -1,4 +1,11 @@
[
{
"version": "2026-12-05a",
"date": "2026-12-05",
"changes": [
"На экранах от 1280 px все колонки подбора норм видны без прокрутки; каталог разделов открывается кнопкой над таблицей"
]
},
{
"version": "2026-12-04h",
"date": "2026-12-04",
@@ -27,12 +34,5 @@
"changes": [
"Выбор региона в подборе норм теперь умещается на экране телефона при длинных названиях"
]
},
{
"version": "2026-12-04d",
"date": "2026-12-04",
"changes": [
"После обновления подбора норм браузер сразу получает новую версию интерфейса"
]
}
]
+8 -11
View File
@@ -71,8 +71,8 @@
.draft-row input { width:110px; }
.quote-controls label { min-width:140px; }
.quote-controls #qty { width:125px; }
.workspace { display:grid; grid-template-columns:minmax(230px,280px) minmax(0,1fr); gap:16px; align-items:start; }
.catalog-tree { max-height:72vh; overflow:auto; position:sticky; top:12px; }
.workspace { display:block; }
.catalog-tree { max-height:45vh; overflow:auto; margin-bottom:12px; }
.catalog-tree h2 { font-size:1.05rem; }
.tree-list { list-style:none; margin:0; padding:0 0 0 12px; border-left:1px solid var(--line); }
.tree-list button { width:100%; text-align:left; border:0; border-radius:5px; background:transparent;
@@ -85,7 +85,7 @@
.table-panel h2 { margin:0; }
.table-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.norm-scroll { max-width:100%; overflow-x:auto; }
.norm-table { min-width:1420px; table-layout:fixed; font-size:.78rem; line-height:1.28; }
.norm-table { min-width:1060px; table-layout:fixed; font-size:.78rem; line-height:1.28; }
.norm-table th,.norm-table td { border:1px solid #d9e0e2; padding:4px 6px; vertical-align:middle; }
.norm-table th { background:#eef2f4; position:sticky; top:0; z-index:1; }
.norm-table tr > :first-child { position:sticky; left:0; z-index:2; background:#fff; }
@@ -125,16 +125,13 @@
.rate-panel input { width:100%; min-width:88px; }
.table-scroll-hint { margin:2px 0 8px; }
.breadcrumb { color:var(--muted); font-size:.84rem; overflow-wrap:anywhere; }
.catalog-mobile { display:none; }
.catalog-mobile { display:block; margin-bottom:10px; }
[hidden] { display:none !important; }
@media (max-width:760px) { .wrap { padding:18px 14px 40px; } header { margin-bottom:24px; }
.detail-grid,.comparison { grid-template-columns:minmax(0,1fr); } .panel,.card { padding:15px; }
.search-row > *, .controls > label { flex:1 1 100%; } .search-row button { width:100%; }
.quote-controls label { min-width:0; } .workspace { display:block; }
.catalog-mobile { display:block; margin-bottom:10px; }
.catalog-tree { position:static; max-height:45vh; margin-bottom:12px; }
.catalog-tree[hidden] { display:none !important; }
.norm-table { min-width:1420px; }
}
</style>
</head>
@@ -158,7 +155,7 @@
<div id="status" class="status" role="status" aria-live="polite"></div>
<button id="catalog-mobile" class="secondary catalog-mobile" type="button" aria-controls="catalog-tree" aria-expanded="false">Разделы сборника</button>
<div class="workspace section">
<aside id="catalog-tree" class="panel catalog-tree"><h2>Разделы сборника</h2><div id="tree-root"></div></aside>
<aside id="catalog-tree" class="panel catalog-tree" hidden><h2>Разделы сборника</h2><div id="tree-root"></div></aside>
<section id="results-section" class="panel table-panel" aria-label="Нормы сборника">
<div class="table-heading"><h2 id="results-title">Нормы сборника</h2><span id="result-count" class="hint"></span></div>
<p id="breadcrumb" class="breadcrumb"></p>
@@ -182,8 +179,8 @@
<td><input id="coef-mat" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент МАТ" placeholder="1,00"></td>
</tr></tbody></table></div>
</details>
<p class="hint table-scroll-hint">Прокрутите таблицу вправо для разбивки затрат; шифр останется виден. ОТм входит в ЭМ. В ГЭСН указаны нормы расхода без готовой единичной цены. Суммы ФЕР-2020 — базис на 01.01.2000, не текущие цены.</p>
<div class="norm-scroll"><table class="norm-table"><colgroup><col style="width:13%"><col style="width:31%"><col style="width:9%"><col style="width:7%"><col style="width:8%"><col style="width:8%"><col style="width:8%"><col style="width:8%"><col style="width:8%"></colgroup><thead><tr><th>Шифр</th><th>Наименование</th><th>Ед. изм.</th><th class="num">Расход</th><th class="num">ПЗ, руб.</th><th class="num" title="Оплата труда рабочих">ОТ, руб.</th><th class="num" title="Эксплуатация машин">ЭМ, руб.</th><th class="num" title="Оплата труда машинистов входит в ЭМ, второй раз к ПЗ не прибавляется">ОТм, руб.</th><th class="num" title="Материалы">МАТ, руб.</th></tr></thead><tbody id="results"></tbody></table></div>
<p class="hint table-scroll-hint">В узком окне таблицу можно прокручивать вправо; шифр останется виден. ОТм входит в ЭМ. В ГЭСН указаны нормы расхода без готовой единичной цены. Суммы ФЕР-2020 — базис на 01.01.2000, не текущие цены.</p>
<div class="norm-scroll"><table class="norm-table"><colgroup><col style="width:15%"><col style="width:29%"><col style="width:9%"><col style="width:7%"><col style="width:8%"><col style="width:8%"><col style="width:8%"><col style="width:8%"><col style="width:8%"></colgroup><thead><tr><th>Шифр</th><th>Наименование</th><th>Ед. изм.</th><th class="num">Расход</th><th class="num">ПЗ, руб.</th><th class="num" title="Оплата труда рабочих">ОТ, руб.</th><th class="num" title="Эксплуатация машин">ЭМ, руб.</th><th class="num" title="Оплата труда машинистов входит в ЭМ, второй раз к ПЗ не прибавляется">ОТм, руб.</th><th class="num" title="Материалы">МАТ, руб.</th></tr></thead><tbody id="results"></tbody></table></div>
<div class="actions" style="margin-top:16px"><button id="more-results" type="button" class="secondary" hidden>Показать ещё нормы</button></div>
</section>
</div>
@@ -214,6 +211,6 @@
<section id="compare-section" class="section" hidden><h2>Сравнение норм</h2><p id="compare-warning" class="notice" hidden></p>
<div id="comparison" class="comparison"></div></section>
</main>
<script src="/static/norm-finder.js?v=2026-12-04h" defer></script>
<script src="/static/norm-finder.js?v=2026-12-05a" defer></script>
</body>
</html>
-1
View File
@@ -728,7 +728,6 @@
tree.hidden = !tree.hidden;
$('catalog-mobile').setAttribute('aria-expanded', String(!tree.hidden));
});
if (matchMedia('(max-width:760px)').matches) $('catalog-tree').hidden = true;
document.querySelectorAll('[data-query]').forEach(button => button.addEventListener('click', () => {
$('query').value = button.dataset.query; $('search-form').requestSubmit();
}));
+26
View File
@@ -103,6 +103,10 @@ def test_catalog_tree_opens_norm_composition_in_the_same_table(browser, site):
};
})()""")
page.goto(site)
assert page.locator('#catalog-tree').is_hidden()
assert page.locator('#catalog-mobile').get_attribute('aria-expanded') == 'false'
page.locator('#catalog-mobile').click()
assert page.locator('#catalog-mobile').get_attribute('aria-expanded') == 'true'
tree = page.locator('#tree-root button', has_text='Земляные работы').first
assert tree.locator('.tree-arrow').inner_text() == '▸'
tree.click()
@@ -124,6 +128,28 @@ def test_catalog_tree_opens_norm_composition_in_the_same_table(browser, site):
page.close()
@pytest.mark.parametrize('width', [1280, 1440, 1545])
def test_desktop_shows_all_cost_columns_without_horizontal_scroll(browser, site, width):
page = browser.new_page(viewport={"width": width, "height": 900})
page.add_init_script("""(() => {
const item = {base:'ГЭСН-2022',base_type:'ГЭСН',code:'37-01-001-01',
name:'Укладка бетонной смеси',unit:'100 м3',section_path:'Бетонные работы'};
window.fetch = async url => {
const path = new URL(url, location.href).pathname;
const value = path.endsWith('/catalog')
? {bases:[{base:'ГЭСН-2022',base_type:'ГЭСН',count:1}]}
: {items:[item],children:[],has_more:false};
return new Response(JSON.stringify(value),{status:200,headers:{'Content-Type':'application/json'}});
};
})()""")
page.goto(site)
page.locator('#results .norm-row').first.wait_for()
assert page.locator('.norm-scroll').evaluate('el => el.scrollWidth <= el.clientWidth + 1')
assert page.locator('#results .norm-row td').first.evaluate('el => el.scrollWidth <= el.clientWidth + 1')
assert page.locator('#catalog-mobile').is_visible()
page.close()
def test_video_table_has_two_triangle_toggles_and_inline_grid_rows(browser, site):
page = browser.new_page(viewport={"width": 1360, "height": 800})
page.add_init_script("""(() => {