feat(performance): 매출 실적 표 열 너비 자동·날짜 열 고정·그룹 구분·접기 애니메이션

- 열 너비 = 내용 길이(표가 100% 로 늘지 않음, 모든 기간 같음), 날짜 열 고정 너비 → 자동
- 가로 스크롤해도 날짜 열 고정(sticky)
- 그룹 열(진한 보라·묶음 선)과 하위 열(옅은 보라·위 띠) 구분, 마지막 하위 열 오른쪽 선
- 접기 단추 22px ⊟/⊞, 펼치고 접을 때 열 너비 애니메이션
- perf_manual.test.js 를 10/21 변경(앞날 입력·계산식 글자 그대로 전송)에 맞게 고침

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 11:44:37 +09:00
parent ac9159bdbd
commit 08d0b2c013
8 changed files with 166 additions and 31 deletions
+34 -7
View File
@@ -276,25 +276,52 @@
b.addEventListener("click", function () { setMetric(b.dataset.metric); });
});
// 쇼핑몰 그룹(2026-10-22) — 그룹 머리글 ▾ 로 하위 쇼핑몰 열 접기/펴기. 접은 그룹은 이 브라우저에 기억(localStorage).
// 쇼핑몰 그룹(2026-10-22) — 그룹 머리글 ⊟/⊞ 로 하위 쇼핑몰 열 접기/펴기. 접은 그룹은 이 브라우저에 기억(localStorage).
// 누를 때는 애니메이션 — 하위 칸 내용(.perf-gc)의 너비를 0 ↔ 원래 너비로, 칸 좌우 여백도 함께 줄여 열이 부드럽게 닫히고 열린다
// (표 열은 display 로는 애니메이션이 안 돼서). 끝나면 접힌 열은 display:none(is-gfolded). 움직임 줄이기 설정이면 바로.
const GROUP_KEY = "perf_groups_collapsed";
const GROUP_MS = 260;
const REDUCE_MOTION = !!(window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
const groupRun = {}; // 그룹 → 애니메이션 번호(빠르게 두 번 누르면 앞 애니메이션의 마무리를 버린다)
let collapsed = [];
try { collapsed = JSON.parse(localStorage.getItem(GROUP_KEY) || "[]") || []; } catch (_) { collapsed = []; }
function setGroup(code, fold) {
root.querySelectorAll('[data-group-child="' + code + '"]').forEach(function (n) { n.classList.toggle("is-gfolded", fold); });
function setGroup(code, fold, animate) {
const cells = Array.prototype.slice.call(root.querySelectorAll('[data-group-child="' + code + '"]'));
root.querySelectorAll('[data-group-toggle="' + code + '"]').forEach(function (b) {
b.setAttribute("aria-expanded", fold ? "false" : "true");
b.textContent = fold ? "▸" : "▾";
b.setAttribute("aria-label", (b.getAttribute("aria-label") || "").replace(/ (접기|펴기)$/, "") + (fold ? " 펴기" : " 접기"));
});
root.querySelectorAll('[data-group-head="' + code + '"]').forEach(function (th) { th.classList.toggle("is-gfolded", fold); });
root.querySelectorAll('[data-group-head="' + code + '"], [data-group-cell="' + code + '"]').forEach(function (n) { n.classList.toggle("is-gclosed", fold); });
const run = groupRun[code] = (groupRun[code] || 0) + 1;
const boxes = cells.map(function (n) { return n.querySelector(".perf-gc"); }).filter(Boolean);
const settle = function () {
if (groupRun[code] !== run) return;
cells.forEach(function (n) { n.classList.remove("is-ganim", "is-gshut"); n.classList.toggle("is-gfolded", fold); });
boxes.forEach(function (b) { b.style.maxWidth = ""; });
};
if (!animate || REDUCE_MOTION || !boxes.length) { settle(); return; }
if (fold) {
cells.forEach(function (n) { n.classList.remove("is-gfolded"); n.classList.add("is-ganim"); });
boxes.forEach(function (b) { b.style.maxWidth = b.scrollWidth + "px"; });
void root.offsetWidth; // 지금 너비에서 출발
cells.forEach(function (n) { n.classList.add("is-gshut"); });
boxes.forEach(function (b) { b.style.maxWidth = "0px"; });
} else {
cells.forEach(function (n) { n.classList.remove("is-gfolded", "is-ganim"); n.classList.add("is-gshut"); });
boxes.forEach(function (b) { b.style.maxWidth = "0px"; });
void root.offsetWidth; // 0 에서 출발
cells.forEach(function (n) { n.classList.add("is-ganim"); n.classList.remove("is-gshut"); });
boxes.forEach(function (b) { b.style.maxWidth = b.scrollWidth + "px"; });
}
setTimeout(settle, GROUP_MS + 30);
}
collapsed.forEach(function (code) { setGroup(code, true); });
collapsed.forEach(function (code) { setGroup(code, true, false); });
root.addEventListener("click", function (e) {
const b = e.target.closest("[data-group-toggle]");
if (!b) return;
const code = b.dataset.groupToggle;
const fold = b.getAttribute("aria-expanded") !== "false";
setGroup(code, fold);
setGroup(code, fold, true);
collapsed = collapsed.filter(function (c) { return c !== code; });
if (fold) collapsed.push(code);
try { localStorage.setItem(GROUP_KEY, JSON.stringify(collapsed)); } catch (_) { /* 기억만 못 함 */ }