fix(performance): 일자별 표 제목·기간 합계 행 — 페이지 스크롤에 고정(매출·광고비), 스크롤 막대 배경 투명

- 10-26 판은 표 상자 안 세로 스크롤이라 진짜 ERP 셸에서 상자 아래가 화면 밖에 잘리고 휠이 페이지로 안 넘어갔다
- 표 상자 세로 스크롤 없앰 → stickyHead 가 .erp-page 스크롤마다 제목 행·기간 합계 행 칸을 translateY 로 내림(표 끝에서 멈춤),
  내려온 동안 제목 칸이 아래 1px 선을 직접 그림(border-collapse 선 틈으로 뒤 줄이 비침 방지)
- 스크롤 막대 트랙 투명(scrollbar-color, 표 상자·실적 화면)
- perf_sticky.browser.test.js 를 진짜 erp_base.html 셸 렌더(perf_*_shell.html)로 — 휠 스크롤·가로 고정·표 끝 멈춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 14:17:25 +09:00
parent 906633a884
commit de5a8a3d0a
8 changed files with 129 additions and 68 deletions
+35 -7
View File
@@ -1434,16 +1434,44 @@
});
}
// 일자별 표 스크롤 고정(2026-10-26) — 기간 합계 행이 제목 행 바로 밑에 붙도록 제목 행 높이를 CSS 변수로.
// 그룹 접기·화면 크기·글꼴에 따라 높이가 바뀌므로 ResizeObserver 로 다시 잰다.
// 일자별 표 스크롤 고정(2026-10-26, 10-27 다시) — 페이지를 스크롤해 표 위쪽이 화면 위로 넘어가면 제목 행 + 맨 위 기간 합계 행 칸을
// 그만큼 translateY 로 내려 화면 위(스크롤 상자 .erp-page 위 끝, 없으면 상단 바 아래)에 붙여 둔다. 표 끝을 넘어가지는 않는다.
// 표 상자가 가로 스크롤 상자라 CSS sticky 로는 안 된다. 스크롤(capture — .erp-page 스크롤도)·창 크기·표 크기(그룹 접기)마다 다시 계산.
function scrollParent(node) {
for (let n = node.parentElement; n && n !== document.body; n = n.parentElement) {
const o = getComputedStyle(n).overflowY;
if ((o === "auto" || o === "scroll") && n.scrollHeight > n.clientHeight + 1) return n;
}
return null;
}
function stickyHead(root) {
root.querySelectorAll(".perf-main-wrap").forEach(function (wrap) {
const head = wrap.querySelector("thead");
const table = wrap.querySelector("table"), head = table && table.tHead;
if (!head) return;
const measure = function () { wrap.style.setProperty("--perf-head-h", head.getBoundingClientRect().height + "px"); };
measure();
if (window.ResizeObserver) new ResizeObserver(measure).observe(head);
else window.addEventListener("resize", measure);
const total = table.querySelector("tbody tr.perf-row-total:first-child");
const cells = Array.from(head.querySelectorAll("th")).concat(total ? Array.from(total.children) : []);
let last = 0;
function edge() {
const sc = scrollParent(wrap);
if (sc) return sc.getBoundingClientRect().top + sc.clientTop;
const bar = document.querySelector(".erp-topbar"); // 좁은 화면 = 문서 스크롤, 상단 바가 위에 붙어 있으면 그 아래
const pos = bar ? getComputedStyle(bar).position : "";
return bar && (pos === "sticky" || pos === "fixed") ? Math.max(0, bar.getBoundingClientRect().bottom) : 0;
}
function update() {
const r = table.getBoundingClientRect();
const h = head.getBoundingClientRect().height + (total ? total.getBoundingClientRect().height : 0);
const off = Math.max(0, Math.min(edge() - r.top, r.height - h));
if (Math.abs(off - last) < 0.25) return;
last = off;
const v = off ? "translateY(" + off + "px)" : "";
cells.forEach(function (c) { c.style.transform = v; });
wrap.classList.toggle("is-stuck", off > 0);
}
window.addEventListener("scroll", update, true);
window.addEventListener("resize", update);
if (window.ResizeObserver) new ResizeObserver(update).observe(table);
update();
});
}