diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index 77d8fcf..b7ee34d 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -227,10 +227,12 @@ {% endif %} - {{ it.label }} - {% if it.market_unknown %}{{ it.market_name }} · 미확인 - {% elif it.market_off %}{{ it.market_name }} · 실적 미사용 - {% elif it.market_name %}{{ it.market_name }}{% endif %} + + {{ it.label }} + {% if it.market_unknown %}자동입력 · 미확인 + {% elif it.market_off %}실적 미사용 + {% elif it.market_name %}자동입력{% endif %} + {% if edit %}{% endif %} diff --git a/app/static/project.css b/app/static/project.css index 3c1ed34..2178b76 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -2592,22 +2592,23 @@ html.pj-goal-selecting, html.pj-goal-selecting * { user-select: none !important; .pj-meet-sec > tr > th, .pj-meet-sec > tr > td:not(.is-prev) { background: var(--goal-bg, #fff); border-color: rgba(0, 0, 0, .07); } .pj-meet-sec > tr > td.is-prev { background: #fafbfc; } .pj-meet-sec > tr:first-child > * { border-top: 1px solid rgba(0, 0, 0, .12); } -.pj-meet-sec th { padding: 7px 8px; vertical-align: middle; text-align: center; } -th.pj-meet-c-sec { position: relative; font-size: 13px; font-weight: 800; } +.pj-meet-sec th { padding: 6px 8px; vertical-align: top; text-align: center; } +th.pj-meet-c-sec { position: relative; font-size: 13px; font-weight: 800; vertical-align: middle; } .pj-meet-sec-add { - display: block; margin: 4px auto 0; width: 22px; height: 22px; border: 1px dashed rgba(0, 0, 0, .25); border-radius: 6px; + position: absolute; right: 4px; bottom: 4px; display: block; margin: 0; width: 22px; height: 22px; border: 1px dashed rgba(0, 0, 0, .25); border-radius: 6px; background: rgba(255, 255, 255, .6); color: var(--pj-ink-soft); cursor: pointer; line-height: 18px; opacity: 0; transition: opacity .12s; } th.pj-meet-c-sec:hover .pj-meet-sec-add, .pj-meet-sec-add:focus { opacity: 1; } th.pj-meet-c-label { position: relative; font-weight: 600; color: #3b4048; text-align: left; } -.pj-meet-label { word-break: keep-all; overflow-wrap: anywhere; } +.pj-meet-label-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; } +.pj-meet-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pj-meet-label[data-meet-edit] { cursor: text; border-radius: 5px; padding: 1px 3px; margin: -1px -3px; } .pj-meet-label[data-meet-edit]:hover { background: rgba(255, 255, 255, .65); box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); } .pj-meet-label.is-editing { background: #fff; box-shadow: 0 0 0 2px var(--pj-accent); outline: none; } .pj-meet-label[data-meet-edit]:empty { display: inline-block; min-width: 3em; min-height: 1.4em; } .pj-meet-market { - display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700; - background: #e8f1ff; color: #1d4ed8; vertical-align: 1px; + flex: none; display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700; + background: #e8f1ff; color: #1d4ed8; line-height: 18px; white-space: nowrap; } .pj-meet-more { position: absolute; top: 3px; right: 2px; width: 24px; height: 24px; opacity: 0; transition: opacity .12s; } .pj-meet-more .material-symbols-outlined { font-size: 18px; } @@ -2617,34 +2618,37 @@ textarea.pj-meet-text, .pj-meet-notes textarea { font: inherit; line-height: var(--pj-text-leading); color: inherit; resize: none; overflow: hidden; } textarea.pj-meet-text:focus { outline: none; } +/* 같은 행의 가장 긴 내용으로 높이를 정하고, 짧은 셀은 위에서 시작한다. */ +textarea.pj-meet-text { min-height: calc(var(--pj-text-leading) + 12px); } .pj-meet-notes textarea:focus { outline: 2px solid var(--pj-accent); outline-offset: -2px; background: rgba(255, 255, 255, .8); } /* 입력 중인 칸 — 칸 전체(td) 테두리 */ .pj-meet-table td:focus-within:not(.pj-meet-c-eval) { box-shadow: inset 0 0 0 2px var(--pj-accent); background-image: linear-gradient(rgba(255, 255, 255, .8), rgba(255, 255, 255, .8)); } -.pj-meet-ro { min-height: 38px; padding: 6px; line-height: var(--pj-text-leading); white-space: pre-wrap; overflow-wrap: anywhere; } -.pj-meet-table td.pj-meet-c-amt { text-align: right; vertical-align: middle; padding: 0 6px; font-variant-numeric: tabular-nums; } +.pj-meet-ro { box-sizing: border-box; min-height: calc(var(--pj-text-leading) + 12px); padding: 6px; line-height: var(--pj-text-leading); white-space: pre-wrap; overflow-wrap: anywhere; } +.pj-meet-table td.pj-meet-c-amt { text-align: right; vertical-align: top; padding: 6px 10px; font-variant-numeric: tabular-nums; } input.pj-meet-amount { - display: block; width: 100%; box-sizing: border-box; height: 34px; padding: 0 4px; border: none; background: transparent; - font: inherit; text-align: right; font-variant-numeric: tabular-nums; + display: block; width: 100%; box-sizing: border-box; height: var(--pj-text-leading); padding: 0; border: none; background: transparent; + font: inherit; line-height: var(--pj-text-leading); text-align: right; font-variant-numeric: tabular-nums; } input.pj-meet-amount:focus { outline: none; background: transparent; } .pj-meet-kpi input.pj-meet-amount:focus { outline: 2px solid var(--pj-accent); outline-offset: -1px; } input.pj-meet-amount::placeholder { color: rgba(0, 0, 0, .28); } .pj-meet-auto { color: #1d4ed8; font-weight: 600; } .pj-meet-market.is-off { background: #fdecec; color: #b42318; } -.pj-meet-week-auto { display: block; padding: 0 4px 5px; font-size: 11px; color: #1d4ed8; text-align: right; white-space: nowrap; } +.pj-meet-week-slot { display: block; } +.pj-meet-week-auto { display: block; font-size: 11px; line-height: 18px; color: #1d4ed8; text-align: right; white-space: nowrap; } .pj-meet-auto::before { content: "자동 "; font-size: 10.5px; font-weight: 700; color: #6b8fd6; } -.pj-meet-c-rate { text-align: right; vertical-align: middle !important; padding: 0 6px !important; font-weight: 700; } +.pj-meet-c-rate { text-align: right; vertical-align: top !important; padding: 6px !important; font-weight: 700; } .pj-meet-c-rate .is-good { color: #1f8a4c; } .pj-meet-c-rate .is-low { color: #c2410c; } -.pj-meet-c-eval { vertical-align: middle !important; text-align: center; } -select.pj-meet-eval { width: calc(100% - 8px); height: 28px; margin: 0 4px; border: 1px solid var(--pj-border); border-radius: 6px; background: #fff; font: inherit; } +.pj-meet-c-eval { vertical-align: top !important; text-align: center; padding: 6px 0 !important; } +select.pj-meet-eval { width: calc(100% - 8px); height: var(--pj-text-leading); margin: 0 4px; border: 1px solid var(--pj-border); border-radius: 6px; background: #fff; font: inherit; } select.pj-meet-eval[data-v="done"], .pj-meet-eval-ro[data-v="done"] { color: #1f8a4c; font-weight: 700; } select.pj-meet-eval[data-v="partial"], .pj-meet-eval-ro[data-v="partial"] { color: #b45309; font-weight: 700; } select.pj-meet-eval[data-v="miss"], .pj-meet-eval-ro[data-v="miss"] { color: #c22b10; font-weight: 700; } -.pj-meet-table td.is-none { vertical-align: middle; padding: 0 8px; font-size: 12px; } +.pj-meet-table td.is-none { vertical-align: top; padding: 6px 8px; font-size: 12px; } .pj-meet-table td.is-saved, .pj-meet-table th.is-saved, .pj-meet-notes textarea.is-saved, #pj-meet-attendees.is-saved { animation: pj-goal-saved 1s ease-out; } diff --git a/tests/js/README.md b/tests/js/README.md index 9921acb..d03c1e1 100644 --- a/tests/js/README.md +++ b/tests/js/README.md @@ -29,6 +29,8 @@ node tests/js/goals_meeting_ui.test.js # jsdom 필요(npm install jsdom 목표 열 자동 맞춤은 실제 Chromium에서도 검증한다. 로컬 테스트 HTML·프로젝트 CSS/폰트를 사용하며 운영 서버·DB에 연결하지 않는다. 부분 서식과 셀 여백, 명시적 줄바꿈, 75% 배율, 600px를 넘는 긴 문단, 저장된 너비 복원을 확인한다. 행 높이는 3줄/2줄 셀의 상단 정렬·같은 위아래 여백, 한 줄로 줄였을 때 높이 축소, 큰 글씨, 보기 전용 화면까지 확인한다. +회의록도 3줄/2줄 셀·한 줄 행·빈 실적 영역·75% 배율·보기 전용 화면을 확인하고, +항목명 오른쪽의 `자동입력`·`실적 미사용` 표시가 같은 줄에 들어가는지 검증한다. 실제 마우스로 셀 테두리를 끌어 내용·부분 서식을 이동하고, 지연 응답 동안 원본을 유지하는지 확인한다. 우클릭 현재/전체 열 자동 맞춤은 접힌 월 열의 측정·너비 저장도 검증한다. jsdom에서는 저장 실패·409 충돌·덮어쓰기 취소·Esc 취소를 추가로 확인한다. diff --git a/tests/js/goals_autofit.browser.test.js b/tests/js/goals_autofit.browser.test.js index 2f78839..573de19 100644 --- a/tests/js/goals_autofit.browser.test.js +++ b/tests/js/goals_autofit.browser.test.js @@ -18,6 +18,14 @@ const server = http.createServer(function (req, res) { .replace("", ""); res.setHeader("Content-Type", "text/html; charset=utf-8"); res.end(html); return; } + if (url.pathname === "/project/goals/2026/meetings/9") { + const fixture = url.searchParams.has("readonly") ? "meeting_layout_ro.html" : "meeting_layout_admin.html"; + const html = fs.readFileSync(path.join(__dirname, ".out", fixture), "utf8") + .replace('", '
') + .replace("", "
"); + res.setHeader("Content-Type", "text/html; charset=utf-8"); res.end(html); return; + } if (url.pathname.startsWith("/project/api/")) { res.setHeader("Content-Type", "application/json"); res.end("{}"); return; } @@ -201,6 +209,63 @@ const server = http.createServer(function (req, res) { console.log("PASS content row height, symmetric padding, top alignment" + (readonly ? " (read-only)" : ", shrink and large font")); await heightPage.close(); } + for (const readonly of [false, true]) { + const meetingPage = await browser.newPage({ viewport: { width: 1600, height: 1000 } }); + await meetingPage.goto("http://127.0.0.1:" + server.address().port + "/project/goals/2026/meetings/9" + (readonly ? "?readonly=1" : "")); + await meetingPage.evaluate(() => document.fonts.ready); + async function meetingMetrics() { + return meetingPage.evaluate(function () { + const row = document.querySelector('tr[data-item="2"]'); + const long = row.querySelector(".pj-meet-c-text:not(.is-prev) > *"), short = row.querySelector(".pj-meet-c-text.is-prev > *"); + const cell = long.closest("td"), style = getComputedStyle(long), cs = getComputedStyle(cell); + const zoom = document.documentElement.classList.contains("pj-ui-scale") ? 0.75 : 1; + const labels = Array.from(document.querySelectorAll(".pj-meet-market")).map(function (badge) { + const name = badge.previousElementSibling, br = badge.getBoundingClientRect(), nr = name.getBoundingClientRect(); + return { text: badge.textContent, rightOfName: br.left >= nr.right, + sameLine: br.top < nr.bottom && nr.top < br.bottom, + fits: br.right <= badge.closest("th").getBoundingClientRect().right }; + }); + return { row: row.getBoundingClientRect().height / zoom, long: long.getBoundingClientRect().height / zoom, + short: short.getBoundingClientRect().height / zoom, line: parseFloat(style.lineHeight), + top: parseFloat(style.paddingTop), bottom: parseFloat(style.paddingBottom), + border: parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth), + topDifference: (short.getBoundingClientRect().top - long.getBoundingClientRect().top) / zoom, + oneLine: document.querySelector('tr[data-item="4"]').getBoundingClientRect().height / zoom, + emptySlot: document.querySelector('tr[data-item="4"] .pj-meet-week-slot').getBoundingClientRect().height, + cellsAtTop: Array.from(row.querySelectorAll("td, th.pj-meet-c-label")).every(c => getComputedStyle(c).verticalAlign === "top"), + labels, clipped: long.scrollHeight > long.clientHeight }; + }); + } + function checkMeeting(m, lines) { + assert.equal(m.top, m.bottom, JSON.stringify(m)); + assert(Math.abs(m.long - (m.line * lines + m.top + m.bottom)) <= 1, JSON.stringify(m)); + assert(Math.abs(m.row - m.long - m.border) <= 1, JSON.stringify(m)); + assert(Math.abs(m.topDifference) <= 1 && m.cellsAtTop && !m.clipped, JSON.stringify(m)); + assert(m.oneLine <= m.line + m.top + m.bottom + m.border + 1 && m.emptySlot === 0, JSON.stringify(m)); + assert.deepEqual(m.labels.map(b => b.text), ["자동입력", "실적 미사용"]); + assert(m.labels.every(b => b.rightOfName && b.sameLine && b.fits), JSON.stringify(m.labels)); + } + const initial = await meetingMetrics(); + checkMeeting(initial, 3); + assert(Math.abs(initial.short - initial.line * 2 - initial.top - initial.bottom) <= 1, JSON.stringify(initial)); + if (!readonly) { + await meetingPage.locator('tr[data-item="2"] textarea').fill("한 줄"); + await meetingPage.locator('tr[data-item="2"] .is-prev .pj-meet-ro').evaluate(e => { e.textContent = "한 줄"; }); + const smaller = await meetingMetrics(); + checkMeeting(smaller, 1); + assert(smaller.row < initial.row); + await meetingPage.locator('tr[data-item="2"] textarea').fill("첫 번째 줄\n두 번째 줄\n세 번째 줄"); + } + await meetingPage.evaluate(function () { + document.documentElement.classList.add("pj-ui-scale"); + window.dispatchEvent(new Event("resize")); + }); + checkMeeting(await meetingMetrics(), 3); + await meetingPage.locator("#pj-meet-table").screenshot({ path: path.join(__dirname, ".out", readonly ? "meeting-layout-ro.png" : "meeting-layout-admin.png") }); + await meetingPage.close(); + console.log("PASS meeting row height, equal padding, top alignment, inline automatic/unused labels, shrink and 75% zoom" + (readonly ? " (read-only)" : "")); + } + const interactive = await browser.newPage({ viewport: { width: 1600, height: 1000 } }); let releaseMove, startedMove; const moveGate = new Promise(function (resolve) { releaseMove = resolve; }); diff --git a/tests/js/render_goals.py b/tests/js/render_goals.py index f2b0280..e51cdb6 100644 --- a/tests/js/render_goals.py +++ b/tests/js/render_goals.py @@ -104,6 +104,22 @@ def meeting_ctx(admin: bool, err: bool, can_sync: bool = True) -> dict: } +def meeting_layout_ctx(admin: bool) -> dict: + ctx = meeting_ctx(admin, False, can_sync=False) + meeting = ctx["meeting"] + product = meeting["sections"][0]["rows"][0] + product["content"] = "첫 번째 줄\n두 번째 줄\n세 번째 줄" + product["prev"]["content"] = "첫 번째 줄\n두 번째 줄" + inactive = copy.deepcopy(meeting["sections"][1]["rows"][0]) + inactive.update(id=4, label="네이버", section="마케팅", content="한 줄", marketplace_code="naver", + market_name="네이버 스마트스토어", market_off=True, week_auto=None) + inactive["prev"].update(id=904, content="한 줄", auto_result=None, market_off=True, + marketplace_code="naver", market_name="네이버 스마트스토어") + meeting["items"].append(inactive) + meeting["sections"].append({"name": "마케팅", "color": "", "rows": [inactive]}) + return ctx + + def main() -> None: env = jinja2.Environment(loader=jinja2.ChoiceLoader([ jinja2.DictLoader({"erp_base.html": BASE_STUB}), @@ -117,6 +133,8 @@ def main() -> None: "meeting_admin.html": ("project/goal_meeting.html", meeting_ctx(True, False)), "meeting_err.html": ("project/goal_meeting.html", meeting_ctx(True, True)), "meeting_ro.html": ("project/goal_meeting.html", meeting_ctx(False, False, can_sync=False)), + "meeting_layout_admin.html": ("project/goal_meeting.html", meeting_layout_ctx(True)), + "meeting_layout_ro.html": ("project/goal_meeting.html", meeting_layout_ctx(False)), } for name, (tpl, ctx) in pages.items(): html = env.get_template(tpl).render(**ctx)