diff --git a/app/modules/performance/CLAUDE.md b/app/modules/performance/CLAUDE.md index 3db2c09..e43723e 100644 --- a/app/modules/performance/CLAUDE.md +++ b/app/modules/performance/CLAUDE.md @@ -51,6 +51,10 @@ 직접 추가 쇼핑몰만 그룹 select 로 묶음, 이름 변경·삭제(삭제 = 그 쇼핑몰 수동 입력·수수료도). 매출 실적 표 그룹 열 = 보이는 하위 합계(일 합계엔 안 더함), ▾/▸ 하위 열 접기(localStorage). ⠿ 드래그 → `PUT /api/marketplace-order` → `sort_order`, 화면 순서는 `dashboard.ordered_marketplaces` (그룹 바로 뒤 하위) 한 곳. 상세 `docs/PERFORMANCE_MODULE.md` "직접 추가 쇼핑몰·그룹". +- **매출 실적 표 모양(2026-10-22)** — `table.perf-autofit`(매출 탭만, 모든 기간 같음): 표가 100% 로 늘지 않고 **열 너비 = 내용 길이**, 날짜 열은 고정 210px 대신 자동 + + **가로 스크롤해도 고정**(sticky left, 오른쪽 그림자). 그룹 열 = 진한 보라 머리·왼쪽 묶음 선, 하위 열 = 옅은 보라 머리(위 띠)·옅은 칸, 마지막 하위(`is-glast`, 접히면 그룹 열 `is-gclosed`) = 오른쪽 선. + 접기 단추 = 22px ⊟/⊞(SVG, 세로 막대가 돌아 바뀜). 접기·펴기 애니메이션 = 하위 칸 내용 `.perf-gc` 너비·칸 여백·투명도 260ms(`setGroup(code, fold, animate)`, + 끝나면 `is-gfolded` display:none, 빠르게 연속 클릭은 `groupRun` 번호로 마지막만, 움직임 줄이기면 바로). ## 매출 실적 화면 (2026-10-19) diff --git a/app/modules/performance/templates/performance/ads.html b/app/modules/performance/templates/performance/ads.html index 4aee597..ee4bcfa 100644 --- a/app/modules/performance/templates/performance/ads.html +++ b/app/modules/performance/templates/performance/ads.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {#- ROAS 덧붙임 — "광고비(ROAS%)". 광고비가 없으면 아무것도 안 붙는다. -#} {%- macro roas(p) -%}{%- if p is not none -%}({{ "{:,}".format(p) }}%){%- endif -%}{%- endmacro -%} @@ -238,4 +238,4 @@ } | tojson }} {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/modules/performance/templates/performance/index.html b/app/modules/performance/templates/performance/index.html index a8f2fd7..975b0ae 100644 --- a/app/modules/performance/templates/performance/index.html +++ b/app/modules/performance/templates/performance/index.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {%- macro won(v) -%} {%- if v is none -%} @@ -135,14 +135,17 @@
| {% if period_kind == 'year' %}월{% else %}날짜{% endif %} | - {#- 그룹(2026-10-22) — 그룹 열 = 보이는 하위 쇼핑몰 합계, ▾ 로 하위 열 접기/펴기(이 브라우저에 기억) -#} + {#- 그룹(2026-10-22) — 그룹 열 = 보이는 하위 쇼핑몰 합계, ⊟/⊞ 로 하위 열 접기/펴기(이 브라우저에 기억, 펼치고 접을 때 애니메이션). + 하위 열은 .perf-gc 로 내용을 감싼다 — 접을 때 그 너비를 0 으로 줄여 열이 부드럽게 닫힌다. is-glast = 그룹의 마지막 하위 열(오른쪽 묶음 선) -#} {% for col in cols %}{% set c = col.code %} - {% if col.kind == 'group' %}{{ short_names[c] }} | - {% else %}{{ short_names[c] }}{% if c in manual_codes %} ✎{% endif %} | {% endif %} + {% set glast = col.kind == 'child' and (not loop.nextitem or loop.nextitem.group != col.group) %} + {% if col.kind == 'group' %}{{ short_names[c] }} | + {% else %}{% if col.kind == 'child' %} {% endif %}{{ short_names[c] }}{% if c in manual_codes %} ✎{% endif %}{% if col.kind == 'child' %} {% endif %} | {% endif %}
{% endfor %}
{% if period_kind == 'year' %}월 합계{% else %}일 합계{% endif %} | {{ m3(m) }} | {% elif r.kind == 'day' and c in manual_codes %} {% set is_manual = (r.date ~ '|' ~ c) in manual_cells %} {% set fx = (formula_cells or {}).get(r.date ~ '|' ~ c) %} -{{ m3(m) }}{{ adl(r.ads[c]) }} | + title="{% if fx %}계산식 {{ fx }} — 눌러 고치기{% elif is_manual %}수동 입력값 — 눌러 고치기(비우고 저장하면 API 값){% else %}눌러 총매출 직접 입력(1000+2000 같은 계산식도 됨){% endif %}">{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }} {% else %} -{{ m3(m) }}{{ adl(r.ads[c]) }} | +{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }} | {% endif %} {% endfor %}{{ m3(r.total) }}{% if r.ads_total %}{{ adl_total(r.ads_total) }}{% endif %} | @@ -283,4 +288,4 @@ } | tojson }} {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/modules/performance/templates/performance/settings.html b/app/modules/performance/templates/performance/settings.html index 1047f26..8f463ae 100644 --- a/app/modules/performance/templates/performance/settings.html +++ b/app/modules/performance/templates/performance/settings.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {%- macro when(v) -%}{{ (v or '')[:16] | replace('T', ' ') or '—' }}{%- endmacro -%} @@ -259,4 +259,4 @@ {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/static/performance.css b/app/static/performance.css index d04d29d..ee05d19 100644 --- a/app/static/performance.css +++ b/app/static/performance.css @@ -407,3 +407,37 @@ body.perf-dragging, body.perf-dragging * { cursor: grabbing !important; user-sel .perf-group-sel { width: auto; min-width: 110px; height: 28px; padding: 2px 6px; font-size: 12.5px; margin-right: 4px; } .perf-del-btn { color: var(--perf-down); } .perf-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; } + +/* ── 매출 실적 표(2026-10-22): 열 너비 = 내용 길이(모든 기간 같음), 날짜 열 고정, 그룹·하위 열 구분, 접기 애니메이션 ── */ +.perf-main.perf-autofit { width: auto; } +.perf-main.perf-autofit thead th.perf-th-label, .perf-main.perf-autofit .perf-td-label { width: auto; min-width: 0; max-width: none; overflow: visible; } +/* 날짜 열 — 가로 스크롤해도 왼쪽에 고정(배경을 깔아 뒤로 지나가는 칸을 가림, 오른쪽 그림자로 경계) */ +.perf-main.perf-autofit .perf-th-label, .perf-main.perf-autofit .perf-td-label { + position: sticky; left: 0; z-index: 2; box-shadow: inset -1px 0 0 #e3e3e3, 6px 0 6px -6px rgba(0, 0, 0, .22); +} +.perf-main.perf-autofit thead th.perf-th-label { z-index: 4; } +:where(.perf-main.perf-autofit) .perf-td-label { background: #fff; } /* 주간합계·기간 합계 줄 배경은 그 줄 규칙 그대로 */ +/* 그룹 열 = 진한 보라 머리 + 왼쪽 묶음 선, 하위 열 = 옅은 보라 머리(위 띠) + 옅은 칸, 마지막 하위 열(접히면 그룹 열)이 오른쪽 묶음 선 */ +.perf-main th.perf-th-group { background: #e6defa; color: #3d1d8a; font-weight: 800; box-shadow: inset 2px 0 0 #8a6fd8; } +.perf-main td.perf-td-group { box-shadow: inset 2px 0 0 #8a6fd8; } +.perf-main th.perf-th-group.is-gclosed, .perf-main td.perf-td-group.is-gclosed { box-shadow: inset 2px 0 0 #8a6fd8, inset -2px 0 0 #8a6fd8; } +.perf-main th.perf-th-child { background: #f6f3fe; color: #5b4a86; font-weight: 600; font-size: 11.5px; box-shadow: inset 0 3px 0 #b9a6ee; } +.perf-main th.perf-th-child.is-glast { box-shadow: inset 0 3px 0 #b9a6ee, inset -2px 0 0 #8a6fd8; } +.perf-row-day > td[data-group-child], .perf-row-month > td[data-group-child] { background: #fcfbff; } +.perf-main td.is-glast { box-shadow: inset -2px 0 0 #8a6fd8; } +.perf-gh { display: inline-flex; align-items: center; gap: 6px; } +/* 접기/펴기 단추 — 18px 둥근 네모 ⊟(펼침) / ⊞(접힘), 세로 막대가 돌며 바뀐다 */ +.perf-main .perf-gtoggle { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; margin: 0; + border: 0; border-radius: 6px; background: none; cursor: pointer; vertical-align: middle; } +.perf-main .perf-gtoggle:hover { background: #d9cff6; } +.perf-main .perf-gtoggle:focus-visible { outline: 2px solid #6d4fd1; outline-offset: 1px; } +.perf-gtoggle .g-box { fill: #fff; stroke: #8a6fd8; stroke-width: 1.4; } +.perf-gtoggle .g-h, .perf-gtoggle .g-v { stroke: #4c2a9a; stroke-width: 1.9; stroke-linecap: round; } +.perf-gtoggle .g-v { transform-origin: 9px 9px; transition: transform .26s ease; } +.perf-gtoggle[aria-expanded="true"] .g-v { transform: rotate(90deg); } /* 펼침 = − (세로 막대가 가로로 겹침) */ +/* 하위 열 접기·펴기 애니메이션 — .perf-gc 너비·칸 좌우 여백·투명도 */ +.perf-gc { overflow: hidden; } +.perf-main .is-ganim, .perf-main .is-ganim .perf-gc { transition: padding .26s ease, max-width .26s ease, opacity .2s ease; } +.perf-main .is-gshut { padding-left: 0 !important; padding-right: 0 !important; } +.perf-main .is-gshut .perf-gc { opacity: 0; } +@media (prefers-reduced-motion: reduce) { .perf-gtoggle .g-v { transition: none; } } diff --git a/app/static/performance.js b/app/static/performance.js index 352dfaa..0dd1847 100644 --- a/app/static/performance.js +++ b/app/static/performance.js @@ -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 (_) { /* 기억만 못 함 */ } diff --git a/tests/js/perf_groups.browser.test.js b/tests/js/perf_groups.browser.test.js index 26da5eb..f887685 100644 --- a/tests/js/perf_groups.browser.test.js +++ b/tests/js/perf_groups.browser.test.js @@ -1,7 +1,8 @@ // 실적 쇼핑몰 그룹·드래그 순서(2026-10-22) — 실제 브라우저(Chromium). // python tests/js/render_performance.py // NODE_PATH=
|---|