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
+11 -6
View File
@@ -458,11 +458,16 @@ body.perf-dragging, body.perf-dragging * { cursor: grabbing !important; user-sel
font: inherit; font-size: 13.5px; line-height: 1.5; resize: vertical; }
.perf-memo-input:focus { outline: none; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26, 86, 219, .12); }
/* ── 일자별 표 스크롤 고정(2026-10-26): 표 상자 안에서 세로 스크롤 → 제목 행 + 맨 위 기간 합계 행 고정 ──
(상자가 가로 스크롤(overflow-x)이라 페이지 스크롤 기준 sticky 는 안 먹는다 — 상자 높이를 화면 높이로 묶고 상자 안에서 스크롤)
--perf-head-h = 제목 행 높이(performance.js stickyHead 가 잼, 기본 31px). 연간 보기 "연간 합계"는 맨 아래 그대로. */
.perf-main-wrap { overflow: auto; max-height: calc(100vh - var(--erp-topbar-h, 56px) - 24px); overscroll-behavior: contain; }
/* ── 일자별 표 스크롤 고정(2026-10-26, 10-27 다시): 페이지(.erp-page)를 스크롤해도 제목 행 + 맨 위 기간 합계 행이 화면 위에 ──
표 상자는 가로 스크롤 상자(overflow-x)라 CSS sticky 가 페이지 스크롤에 안 먹는다 → performance.js stickyHead 가 스크롤 때마다
두 줄 칸을 translateY 로 내린다(상자 세로 스크롤 없음 — 예전엔 상자 안에서만 스크롤돼 상자 아래가 화면 밖에 잘리고 휠이 페이지로 안 넘어갔다).
날짜 칸 가로 고정(sticky left)은 그대로. 연간 보기 "연간 합계"는 맨 아래 그대로(제목 행만 고정). */
.perf-main-wrap { overflow-x: auto; overflow-y: hidden; }
.perf-main-wrap .perf-main thead th { z-index: 3; }
.perf-main-wrap .perf-main thead th.perf-th-label { z-index: 5; }
.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > * { position: sticky; top: var(--perf-head-h, 31px); z-index: 1; }
.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > .perf-td-label { left: 0; z-index: 4; }
.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > * { position: relative; z-index: 2; }
.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > .perf-td-label { position: sticky; left: 0; z-index: 4; }
/* 내려온 제목 행 아래 1px — 표 칸 사이 선(border-collapse)은 칸과 함께 안 움직여 그 틈으로 뒤 줄 글자가 비쳤다 → 칸이 직접 선을 그림 */
.perf-main-wrap.is-stuck .perf-main thead th::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--perf-line); }
/* 스크롤 막대 배경(트랙) 투명(2026-10-27) — 표 상자 가로 막대·실적 화면 세로 막대. 손잡이만 옅은 회색 */
.perf-table-wrap, .erp-page:has(> .perf) { scrollbar-color: #c3c6cb transparent; }
+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();
});
}