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
+7 -3
View File
@@ -46,9 +46,13 @@
- 일자별 표 **기간 합계 행은 맨 위**(제목 행 바로 아래, 2026-10-21 `calc.main_table`) — 매출·광고비 공통, 연간 보기 "연간 합계"는 그대로 맨 아래.
- **기간 빠른 선택 = 이번달·올해·직접선택**(2026-10-26 — 오늘·이번주 버튼 삭제, `dashboard.build_dashboard`·`ad_spend.build_ad_dashboard` 의 `nav.quick`),
매출 실적 기본 기간도 **이번달**(`router.dashboard_page` `period="month"`, 광고비는 원래 이번달). day·week 주소(`?period=week`)는 그대로 열린다.
- **일자별 표 스크롤 고정**(2026-10-26, `.perf-main-wrap`) — 표 상자를 화면 높이(`100vh − 상단 바 − 24px`)로 묶어 상자 안에서 세로 스크롤,
제목 행 + 맨 위 기간 합계 행(`tbody tr.perf-row-total:first-child`)이 sticky. 합계 행 top = 제목 행 높이(`--perf-head-h`, `performance.js stickyHead`
가 ResizeObserver 로 잼). 상자가 가로 스크롤이라 페이지 스크롤 기준 sticky 는 안 먹어서 상자 안 스크롤로 했다. 테스트 `tests/js/perf_sticky.browser.test.js`.
- **일자별 표 스크롤 고정**(2026-10-26, **10-27 다시** `.perf-main-wrap`) — 페이지(`.erp-page`)를 스크롤해도 제목 행 + 맨 위 기간 합계 행
(`tbody tr.perf-row-total:first-child`)이 화면 위에 붙어 있다. 표 상자는 가로 스크롤 상자라 CSS sticky 가 페이지 스크롤에 안 먹어서
`performance.js stickyHead` 가 스크롤(capture)·창 크기·표 크기마다 두 줄 칸을 `translateY` 로 내린다(표 끝에서 멈춤, 내려온 동안 `is-stuck` →
제목 칸 `::after` 가 아래 1px 선 — 표 칸 선(border-collapse)은 안 움직여 틈이 비쳤다). **표 상자 세로 스크롤 금지** — 10-26 판은 상자를 화면 높이로
묶어 상자 안에서 스크롤했는데, 진짜 셸에서는 상자 아래가 화면 밖에 잘리고(`overscroll-behavior: contain`) 휠이 페이지로 안 넘어갔다.
스크롤 막대 배경(트랙) 투명 = `scrollbar-color: #c3c6cb transparent`(표 상자·실적 화면 `.erp-page`). 테스트 `tests/js/perf_sticky.browser.test.js`
(진짜 `erp_base.html` 셸 렌더 `perf_*_shell.html` 로 휠 스크롤 — 스텁 셸로는 이 문제가 안 보였다).
- 열 순서 카페24·네이버·쿠팡(윙)·쿠팡(로켓)·오늘의집·G마켓·카카오·GS샵·11번가·롯데ON·토스·애터미아자몰(마이그레이션 003).
- 쿠팡(로켓)·애터미아자몰은 **수동 입력 전용**(`adapters/manual.py`, `manual_only` — 매출 업데이트에서 빠지고 인증 설정·연결 테스트 없음, 수동 입력 늘 켜짐).
- **직접 추가 쇼핑몰·그룹·순서 드래그**(2026-10-22, 마이그레이션 009 `is_custom`·`is_group`·`parent_code`) — 설정 [+ 쇼핑몰 추가(수동 입력)]
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261026a" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261027a" />{% endblock %}
{#- ROAS 덧붙임 — "광고비(ROAS%)". 광고비가 없으면 아무것도 안 붙는다. -#}
{%- macro roas(p) -%}{%- if p is not none -%}<span class="perf-roas">({{ "{:,}".format(p) }}%)</span>{%- endif -%}{%- endmacro -%}
@@ -241,4 +241,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261026a" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261027a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261026a" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261027a" />{% endblock %}
{%- macro won(v) -%}
{%- if v is none -%}<span class="perf-na"></span>
@@ -292,4 +292,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261026a" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261027a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261026a" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261027a" />{% endblock %}
{%- macro when(v) -%}{{ (v or '')[:16] | replace('T', ' ') or '—' }}{%- endmacro -%}
@@ -259,4 +259,4 @@
</section>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261026a" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261027a" defer></script>{% endblock %}
+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();
});
}