Merge branch 'feat/perf-table-autofit-groups'
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022a" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022b" />{% endblock %}
|
||||
|
||||
{#- ROAS 덧붙임 — "광고비(ROAS%)". 광고비가 없으면 아무것도 안 붙는다. -#}
|
||||
{%- macro roas(p) -%}{%- if p is not none -%}<span class="perf-roas">({{ "{:,}".format(p) }}%)</span>{%- endif -%}{%- endmacro -%}
|
||||
@@ -238,4 +238,4 @@
|
||||
} | tojson }}</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}<script src="/static/performance.js?v=20261022a" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/performance.js?v=20261022b" defer></script>{% endblock %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022a" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022b" />{% endblock %}
|
||||
|
||||
{%- macro won(v) -%}
|
||||
{%- if v is none -%}<span class="perf-na"></span>
|
||||
@@ -135,14 +135,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="erp-table-wrap perf-table-wrap">
|
||||
<table class="perf-table perf-main">
|
||||
{#- perf-autofit(2026-10-22) = 열 너비는 내용 길이만큼, 날짜 열은 가로 스크롤해도 고정 -#}
|
||||
<table class="perf-table perf-main perf-autofit">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="perf-th-label">{% if period_kind == 'year' %}월{% else %}날짜{% endif %}</th>
|
||||
{#- 그룹(2026-10-22) — 그룹 열 = 보이는 하위 쇼핑몰 합계, ▾ 로 하위 열 접기/펴기(이 브라우저에 기억) -#}
|
||||
{#- 그룹(2026-10-22) — 그룹 열 = 보이는 하위 쇼핑몰 합계, ⊟/⊞ 로 하위 열 접기/펴기(이 브라우저에 기억, 펼치고 접을 때 애니메이션).
|
||||
하위 열은 .perf-gc 로 내용을 감싼다 — 접을 때 그 너비를 0 으로 줄여 열이 부드럽게 닫힌다. is-glast = 그룹의 마지막 하위 열(오른쪽 묶음 선) -#}
|
||||
{% for col in cols %}{% set c = col.code %}
|
||||
{% if col.kind == 'group' %}<th class="perf-th-group" data-group-head="{{ c }}" title="{{ names[c] }} — 하위 쇼핑몰 {{ group_members[c] | length }}곳 매출 합계"><button type="button" class="perf-gtoggle" data-group-toggle="{{ c }}" aria-expanded="true" title="하위 쇼핑몰 접기/펴기">▾</button>{{ short_names[c] }}</th>
|
||||
{% else %}<th{% if col.kind == 'child' %} class="perf-th-child" data-group-child="{{ col.group }}"{% endif %} title="{{ names[c] }}{% if c in manual_codes %} — 수동 입력(날짜 칸을 눌러 입력){% endif %}">{{ short_names[c] }}{% if c in manual_codes %} <span class="perf-manual-mark" aria-label="수동 입력">✎</span>{% endif %}</th>{% endif %}
|
||||
{% set glast = col.kind == 'child' and (not loop.nextitem or loop.nextitem.group != col.group) %}
|
||||
{% if col.kind == 'group' %}<th class="perf-th-group" data-group-head="{{ c }}" title="{{ names[c] }} — 하위 쇼핑몰 {{ group_members[c] | length }}곳 매출 합계"><span class="perf-gh"><button type="button" class="perf-gtoggle" data-group-toggle="{{ c }}" aria-expanded="true" aria-label="{{ short_names[c] }} 하위 쇼핑몰 접기" title="하위 쇼핑몰 접기/펴기"><svg viewBox="0 0 18 18" width="18" height="18" aria-hidden="true"><rect class="g-box" x="1" y="1" width="16" height="16" rx="4"/><path class="g-h" d="M5 9h8"/><path class="g-v" d="M9 5v8"/></svg></button><span>{{ short_names[c] }}</span></span></th>
|
||||
{% else %}<th{% if col.kind == 'child' %} class="perf-th-child{% if glast %} is-glast{% endif %}" data-group-child="{{ col.group }}"{% endif %} title="{{ names[c] }}{% if c in manual_codes %} — 수동 입력(날짜 칸을 눌러 입력){% endif %}">{% if col.kind == 'child' %}<div class="perf-gc">{% endif %}{{ short_names[c] }}{% if c in manual_codes %} <span class="perf-manual-mark" aria-label="수동 입력">✎</span>{% endif %}{% if col.kind == 'child' %}</div>{% endif %}</th>{% endif %}
|
||||
{% endfor %}
|
||||
<th class="perf-th-total">{% if period_kind == 'year' %}월 합계{% else %}일 합계{% endif %}</th>
|
||||
</tr>
|
||||
@@ -156,18 +159,20 @@
|
||||
{% for col in cols %}
|
||||
{% set c = col.code %}
|
||||
{% set m = r.cells[c] %}
|
||||
{% set glast = col.kind == 'child' and (not loop.nextitem or loop.nextitem.group != col.group) %}
|
||||
{% set gattr %}{% if col.kind == 'child' %} data-group-child="{{ col.group }}"{% endif %}{% endset %}
|
||||
{% set gc0 %}{% if col.kind == 'child' %}<div class="perf-gc">{% endif %}{% endset %}{% set gc1 %}{% if col.kind == 'child' %}</div>{% endif %}{% endset %}
|
||||
{% if col.kind == 'group' %}
|
||||
<td class="perf-num perf-td-group" data-group-cell="{{ c }}">{{ m3(m) }}</td>
|
||||
{% 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) %}
|
||||
<td class="perf-num is-manual-cell{% if is_manual %} is-manual{% endif %}{% if fx %} is-formula{% endif %}"{{ gattr }} data-manual-code="{{ c }}" data-date="{{ r.date }}"
|
||||
<td class="perf-num is-manual-cell{% if is_manual %} is-manual{% endif %}{% if fx %} is-formula{% endif %}{% if glast %} is-glast{% endif %}"{{ gattr }} data-manual-code="{{ c }}" data-date="{{ r.date }}"
|
||||
data-manual-value="{{ m.gross if is_manual else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %} tabindex="0"
|
||||
title="{% if fx %}계산식 {{ fx }} — 눌러 고치기{% elif is_manual %}수동 입력값 — 눌러 고치기(비우고 저장하면 API 값){% else %}눌러 총매출 직접 입력(1000+2000 같은 계산식도 됨){% endif %}">{{ m3(m) }}{{ adl(r.ads[c]) }}</td>
|
||||
title="{% if fx %}계산식 {{ fx }} — 눌러 고치기{% elif is_manual %}수동 입력값 — 눌러 고치기(비우고 저장하면 API 값){% else %}눌러 총매출 직접 입력(1000+2000 같은 계산식도 됨){% endif %}">{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
|
||||
{% else %}
|
||||
<td class="perf-num{% if r['from'] and (m.gross or m.commission) %} is-link{% endif %}"{{ gattr }}
|
||||
{% if r['from'] %}data-code="{{ c }}" data-from="{{ r['from'] }}" data-to="{{ r['to'] }}"{% endif %}>{{ m3(m) }}{{ adl(r.ads[c]) }}</td>
|
||||
<td class="perf-num{% if r['from'] and (m.gross or m.commission) %} is-link{% endif %}{% if glast %} is-glast{% endif %}"{{ gattr }}
|
||||
{% if r['from'] %}data-code="{{ c }}" data-from="{{ r['from'] }}" data-to="{{ r['to'] }}"{% endif %}>{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td class="perf-num perf-td-total">{{ m3(r.total) }}{% if r.ads_total %}{{ adl_total(r.ads_total) }}{% endif %}</td>
|
||||
@@ -283,4 +288,4 @@
|
||||
} | tojson }}</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}<script src="/static/performance.js?v=20261022a" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/performance.js?v=20261022b" defer></script>{% endblock %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022a" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022b" />{% 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=20261022a" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/performance.js?v=20261022b" defer></script>{% endblock %}
|
||||
|
||||
@@ -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; } }
|
||||
|
||||
@@ -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 (_) { /* 기억만 못 함 */ }
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// 실적 쇼핑몰 그룹·드래그 순서(2026-10-22) — 실제 브라우저(Chromium).
|
||||
// python tests/js/render_performance.py
|
||||
// NODE_PATH=<playwright 경로> PJ_TEST_BROWSER=<Chrome 경로> node tests/js/perf_groups.browser.test.js
|
||||
// 매출 실적: 그룹 열 = 하위 합계, ▾ 누르면 하위 열이 숨고(▸) 새로고침해도 기억.
|
||||
// 매출 실적: 그룹 열 = 하위 합계, ⊟ 누르면 하위 열이 애니메이션으로 접히고(⊞) 새로고침해도 기억(2026-10-22 단추·애니메이션).
|
||||
// 열 너비 = 내용 길이(표가 100% 로 늘지 않음), 날짜 열은 가로 스크롤해도 고정, 그룹·하위 열 구분 색·묶음 선.
|
||||
// 설정: ⠿ 를 끌어 놓으면 화면 순서 그대로 PUT /api/marketplace-order — 그룹은 하위와 함께, 하위는 그룹 안에서만.
|
||||
const fs = require("fs"), path = require("path");
|
||||
const { chromium } = require("playwright");
|
||||
@@ -34,23 +35,85 @@ function page(file) {
|
||||
});
|
||||
};
|
||||
const h0 = await heads();
|
||||
check("그룹 열이 하위 열 바로 앞", JSON.stringify(h0.slice(1, 7)) === JSON.stringify(["카페24", "네이버", "▾오프라인", "매장A ✎", "매장B ✎", "행사 ✎"]), h0);
|
||||
check("그룹 열이 하위 열 바로 앞", JSON.stringify(h0.slice(1, 7)) === JSON.stringify(["카페24", "네이버", "오프라인", "매장A ✎", "매장B ✎", "행사 ✎"]), h0);
|
||||
const expanded = function () { return p.getAttribute('[data-group-toggle="group_off"]', "aria-expanded"); };
|
||||
// 열 너비 = 내용 길이 — 표가 화면보다 좁으면 늘이지 않는다, 각 열은 그 열의 가장 긴 글자 + 여백 정도
|
||||
const fit = await p.evaluate(function () {
|
||||
const t = document.querySelector(".perf-main"), wrap = t.closest(".perf-table-wrap");
|
||||
const ths = Array.from(t.querySelectorAll("thead th")).filter(function (th) { return th.offsetParent !== null; });
|
||||
const slack = ths.map(function (th) {
|
||||
const cells = Array.from(t.querySelectorAll("tbody tr")).map(function (tr) { return tr.children[th.cellIndex]; }).concat([th]);
|
||||
const widest = Math.max.apply(null, cells.map(function (c) {
|
||||
const r = document.createRange(); r.selectNodeContents(c); return r.getBoundingClientRect().width;
|
||||
}));
|
||||
return Math.round(th.getBoundingClientRect().width - widest);
|
||||
});
|
||||
return { tableW: Math.round(t.getBoundingClientRect().width), wrapW: wrap.clientWidth, maxSlack: Math.max.apply(null, slack), slack: slack };
|
||||
});
|
||||
// 날짜 열은 "오늘" 표시(::after — 글자 범위 재기에 안 잡힘)만큼 더 넓다 → 쇼핑몰·합계 열만 엄격히(여유 = 좌우 여백 16px)
|
||||
check("열 너비 = 내용 길이(표가 늘지 않고, 칸 여유는 여백 정도)", fit.tableW < fit.wrapW && Math.max.apply(null, fit.slack.slice(1)) <= 20, fit);
|
||||
const grp = await p.evaluate(function () {
|
||||
const cs = function (sel) { const e = document.querySelector(sel); const c = getComputedStyle(e); return { bg: c.backgroundColor, sh: c.boxShadow, w: c.fontWeight }; };
|
||||
const btn = document.querySelector('[data-group-toggle="group_off"]').getBoundingClientRect();
|
||||
return { head: cs('th[data-group-head="group_off"]'), child: cs('th[data-group-child="group_off"]'), last: cs('th.perf-th-child.is-glast'),
|
||||
btn: [Math.round(btn.width), Math.round(btn.height)], cell: cs('td[data-group-cell="group_off"]') };
|
||||
});
|
||||
check("그룹 머리(진한 보라·굵게·왼쪽 선) ≠ 하위 머리(옅은 보라·위 띠), 마지막 하위 = 오른쪽 선",
|
||||
grp.head.bg !== grp.child.bg && Number(grp.head.w) >= 700 && /inset/.test(grp.head.sh) && /inset/.test(grp.child.sh) && /-2px/.test(grp.last.sh) && /2px/.test(grp.cell.sh), grp);
|
||||
check("접기 단추 22px(예전 15px 글자)", grp.btn[0] >= 20 && grp.btn[1] >= 20 && (await expanded()) === "true", grp.btn);
|
||||
const g5 = await p.evaluate(function () {
|
||||
const tr = document.querySelector('td[data-manual-code="custom_a"][data-date="2026-10-05"]').closest("tr");
|
||||
return tr.querySelector('[data-group-cell="group_off"] .v-gross').textContent.trim();
|
||||
});
|
||||
check("그룹 칸 = 하위 합계(30,000 + 12,000)", g5 === "42,000", g5);
|
||||
const wBefore = await p.evaluate(function () { return document.querySelector('th[data-group-child="group_off"]').getBoundingClientRect().width; });
|
||||
await p.click('[data-group-toggle="group_off"]');
|
||||
await p.waitForTimeout(110); // 애니메이션 중간 — 열이 줄어드는 중(아직 숨지 않음)
|
||||
const mid = await p.evaluate(function () {
|
||||
const th = document.querySelector('th[data-group-child="group_off"]');
|
||||
return { w: th.getBoundingClientRect().width, anim: th.classList.contains("is-ganim"), shown: th.offsetParent !== null };
|
||||
});
|
||||
check("접는 중 = 열이 점점 줄어듦(애니메이션)", mid.anim && mid.shown && mid.w > 0 && mid.w < wBefore, { mid: mid, wBefore: wBefore });
|
||||
await p.waitForTimeout(400);
|
||||
const h1 = await heads();
|
||||
const hiddenTd = await p.evaluate(function () {
|
||||
return Array.from(document.querySelectorAll('td[data-group-child="group_off"]')).every(function (td) { return td.offsetParent === null; });
|
||||
});
|
||||
check("▾ 누르면 하위 열(머리글·칸) 숨김, ▸ 표시", h1.indexOf("매장A ✎") < 0 && h1.indexOf("▸오프라인") >= 0 && hiddenTd && h1.indexOf("행사 ✎") >= 0, h1);
|
||||
check("⊟ 누르면 하위 열(머리글·칸) 숨김, 단추 = 펴기(⊞)", h1.indexOf("매장A ✎") < 0 && (await expanded()) === "false" && hiddenTd && h1.indexOf("행사 ✎") >= 0, h1);
|
||||
const closed = await p.evaluate(function () { return getComputedStyle(document.querySelector('th[data-group-head="group_off"]')).boxShadow; });
|
||||
check("접히면 그룹 열이 오른쪽 묶음 선도", /-2px/.test(closed), closed);
|
||||
await p.reload();
|
||||
const h2 = await heads();
|
||||
check("접은 상태 새로고침 후에도 기억", h2.indexOf("매장A ✎") < 0 && h2.indexOf("▸오프라인") >= 0, h2);
|
||||
check("접은 상태 새로고침 후에도 기억", h2.indexOf("매장A ✎") < 0 && (await expanded()) === "false", h2);
|
||||
await p.click('[data-group-toggle="group_off"]');
|
||||
check("다시 누르면 펼침", (await heads()).indexOf("매장B ✎") >= 0);
|
||||
await p.waitForTimeout(110);
|
||||
const mid2 = await p.evaluate(function () {
|
||||
const th = document.querySelector('th[data-group-child="group_off"]');
|
||||
return { w: th.getBoundingClientRect().width, anim: th.classList.contains("is-ganim") };
|
||||
});
|
||||
await p.waitForTimeout(400);
|
||||
const wAfter = await p.evaluate(function () { return document.querySelector('th[data-group-child="group_off"]').getBoundingClientRect().width; });
|
||||
check("다시 누르면 펼침(점점 넓어져 원래 너비로)", (await heads()).indexOf("매장B ✎") >= 0 && mid2.anim && mid2.w < wAfter - 2 && Math.abs(wAfter - wBefore) < 2,
|
||||
{ mid2: mid2, wAfter: wAfter, wBefore: wBefore });
|
||||
// 빠르게 두 번 — 마지막 상태(펼침)로 끝난다
|
||||
await p.click('[data-group-toggle="group_off"]');
|
||||
await p.click('[data-group-toggle="group_off"]');
|
||||
await p.waitForTimeout(450);
|
||||
check("빠르게 두 번 눌러도 마지막 상태(펼침)", (await heads()).indexOf("매장A ✎") >= 0 && (await expanded()) === "true");
|
||||
// 날짜 열 고정 — 좁은 화면에서 가로 스크롤해도 날짜 칸이 왼쪽에 그대로
|
||||
const sticky = await p.evaluate(function () {
|
||||
const wrap = document.querySelector(".perf-table-wrap"), lab = document.querySelector(".perf-row-day .perf-td-label");
|
||||
wrap.style.width = "320px"; // 테스트 표는 열이 적어 넓은 화면에선 스크롤이 안 생긴다 — 좁은 화면 흉내
|
||||
const x0 = lab.getBoundingClientRect().left;
|
||||
wrap.scrollLeft = 300;
|
||||
const x1 = lab.getBoundingClientRect().left, wrapX = wrap.getBoundingClientRect().left;
|
||||
const under = document.elementFromPoint(x1 + 5, lab.getBoundingClientRect().top + 5);
|
||||
return { scrolled: wrap.scrollLeft, x0: x0, x1: x1, wrapX: wrapX, top: under === lab || lab.contains(under) };
|
||||
});
|
||||
check("가로 스크롤해도 날짜 열 고정(위에 그려짐)", sticky.scrolled > 0 && Math.abs(sticky.x1 - sticky.wrapX) < 2 && sticky.top, sticky);
|
||||
await p.locator(".perf-table-wrap").screenshot({ path: path.join(__dirname, ".out", "perf_dash_groups_sticky.png") });
|
||||
await p.evaluate(function () { const w = document.querySelector(".perf-table-wrap"); w.style.width = ""; w.scrollLeft = 0; });
|
||||
await p.locator(".perf-main").screenshot({ path: path.join(__dirname, ".out", "perf_dash_groups.png") });
|
||||
await ctx.close();
|
||||
|
||||
// ── 설정 — 드래그 순서 ──
|
||||
|
||||
@@ -75,8 +75,9 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
|
||||
"날짜,카페24,네이버,쿠팡,토스,GS샵,11번가,오늘의집,G마켓,카카오,롯데ON,일 합계", heads);
|
||||
check("[수동] 수동 입력 쇼핑몰 제목에 ✎ 표시", /✎/.test(e.d.querySelectorAll(".perf-main thead th")[3].textContent) &&
|
||||
!/✎/.test(e.d.querySelectorAll(".perf-main thead th")[1].textContent));
|
||||
check("[수동] 오늘까지 날짜 칸만 입력 칸(앞으로의 날·주간합계 아님), 수동 값 칸은 파란 표시",
|
||||
!!cell(e, "coupang", "2026-10-07") && !cell(e, "coupang", "2026-10-08") && cell(e, "coupang", "2026-10-05").classList.contains("is-manual") &&
|
||||
// 2026-10-21 — 앞으로의 날도 입력 칸(사용자 요청). 주간합계 줄은 여전히 아님
|
||||
check("[수동] 날짜 칸은 앞으로의 날도 입력 칸(주간합계 아님), 수동 값 칸은 파란 표시",
|
||||
!!cell(e, "coupang", "2026-10-07") && !!cell(e, "coupang", "2026-10-08") && cell(e, "coupang", "2026-10-05").classList.contains("is-manual") &&
|
||||
!cell(e, "coupang", "2026-10-06").classList.contains("is-manual") && !e.d.querySelector(".perf-row-week td.is-manual-cell"));
|
||||
check("[수동] 입력 칸은 주문 상세 링크가 아님", !cell(e, "coupang", "2026-10-06").classList.contains("is-link") &&
|
||||
e.d.querySelector('td.is-link[data-code="cafe24"]') !== null);
|
||||
@@ -94,7 +95,8 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
|
||||
key(e, in5, "Enter");
|
||||
await settle();
|
||||
const put = e.calls.find(function (c) { return c.method === "PUT"; });
|
||||
check("[입력] Enter → 그 칸 저장(쉼표·원 빼고 숫자)", put && put.url === "/performance/api/manual-sales/coupang/2026-10-05" && put.body.amount === 90000, e.calls);
|
||||
// 2026-10-21 — 칸 입력은 글자 그대로(쉼표·원만 뺀) 보낸다: 계산식(1000+2000)도 서버가 계산(formula.parse_amount)
|
||||
check("[입력] Enter → 그 칸 저장(쉼표·원 빼고 보냄)", put && put.url === "/performance/api/manual-sales/coupang/2026-10-05" && put.body.amount === "90000", e.calls);
|
||||
check("[입력] 저장한 값 표시 + 아래 칸(10/6)으로 입력칸 이동", gross(td5) === "90,000" && !td5.querySelector(".perf-manual-input") &&
|
||||
!!cell(e, "coupang", "2026-10-06").querySelector(".perf-manual-input"));
|
||||
const in6 = cell(e, "coupang", "2026-10-06").querySelector(".perf-manual-input");
|
||||
@@ -168,7 +170,7 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
|
||||
const up = cell(e, "coupang_rocket", "2026-10-01"), man = cell(e, "google", "2026-10-02");
|
||||
check("[광고비] 업로드 값 = 주황(is-upload), 직접 입력 = 파랑(is-manual)", up.classList.contains("is-upload") &&
|
||||
!up.classList.contains("is-manual") && man.classList.contains("is-manual") && gross(up) === "220,000");
|
||||
check("[광고비] 앞으로의 날은 입력 칸 아님", !cell(e, "google", "2026-10-08") && !!cell(e, "google", "2026-10-07"));
|
||||
check("[광고비] 앞으로의 날도 입력 칸(2026-10-21)", !!cell(e, "google", "2026-10-08") && !!cell(e, "google", "2026-10-07"));
|
||||
const kpi = Array.from(e.d.querySelectorAll(".perf-kpi-value")).map(function (n) { return n.textContent.trim(); });
|
||||
// 렌더 데이터(render_performance.py)에 구글 광고 API 값 10/04 123,457 이 더해졌다(2026-10-15 구글 광고 API 연동)
|
||||
check("[광고비] KPI — 이번달 광고비 722,457(네이버 300,000·구글 API 123,457 포함) · 매출 대비 비율", kpi[0] === "₩722,457" && /%$/.test(kpi[1]), kpi);
|
||||
@@ -196,7 +198,7 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
|
||||
await settle();
|
||||
const put = e.calls.find(function (c) { return c.method === "PUT"; });
|
||||
check("[광고비] 저장 → /api/ad-spend/meta/2026-10-03 (33000)", put && put.url === "/performance/api/ad-spend/meta/2026-10-03" &&
|
||||
put.body.amount === 33000, e.calls);
|
||||
put.body.amount === "33000", e.calls);
|
||||
check("[광고비] 저장 후 파란 표시", gross(td) === "33,000" && td.classList.contains("is-manual"));
|
||||
// 파일 업로드 창
|
||||
e.d.getElementById("perf-ad-upload").click();
|
||||
|
||||
Reference in New Issue
Block a user