fix(project): restore smooth quarter toggles

Hide monthly content until column widths settle to prevent numeric shifts during expansion.
This commit is contained in:
2026-10-03 18:09:10 +09:00
parent 321bf11f65
commit d89875db7e
7 changed files with 125 additions and 31 deletions
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003m" />
<link rel="stylesheet" href="/static/project.css?v=20261003n" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -202,5 +202,5 @@
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
<script src="/static/project.js?v=20261003m" defer></script>
<script src="/static/project.js?v=20261003n" defer></script>
{% endblock %}
@@ -543,7 +543,7 @@
<h3 id="goals-table">분기 접기·열 너비·행 높이</h3>
<ul>
<li>열은 연간 → 1~3월 → 1분기 → 4~6월 → 2분기 → 7~9월 → 3분기 → 10~12월 → 4분기 순서입니다. <b>분기 머리 칸</b>을 누르면 해당 월 3개가 즉시 접히거나 원래 너비로 펼쳐집니다. 네모 안 <b>−</b>는 접기, <b>+</b>는 펼치기입니다.</li>
<li>열은 연간 → 1~3월 → 1분기 → 4~6월 → 2분기 → 7~9월 → 3분기 → 10~12월 → 4분기 순서입니다. <b>분기 머리 칸</b>을 누르면 해당 월 3개가 부드럽게 접히거나 펼쳐집니다. 숫자와 글은 펼침이 끝난 뒤 나타납니다. 네모 안 <b>−</b>는 접기, <b>+</b>는 펼치기입니다.</li>
<li>어느 행에서든 셀의 <b>오른쪽 경계</b>를 끌어 열 너비를 조절합니다. 경계를 더블클릭하면 가장 긴 문단에 맞춥니다. 직접 넣은 줄바꿈·글자 크기·굵기도 반영합니다.</li>
<li>셀 우클릭의 <span class="pjh-ui">현재 열 너비 자동 맞춤</span>·<span class="pjh-ui">전체 열 너비 자동 맞춤</span>도 사용할 수 있습니다. 전체 맞춤은 접힌 월 열까지 포함합니다. 병합 칸은 다른 열을 유지하며 오른쪽 끝 열 너비를 조절합니다.</li>
<li>접힘·열 너비는 내 브라우저에 기억됩니다. 행 높이는 가장 높은 글 칸에 맞춰 늘고, 글이 줄면 함께 줄어듭니다. 1열(업무 영역)·2열(항목 이름)은 병합된 칸도 항상 세로 가운데 정렬이며, 목표 내용은 상단 정렬입니다.</li>
+22 -1
View File
@@ -2321,9 +2321,30 @@ html.pj-goal-selecting .pj-goal-menu-btn { pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
.pj-goal-fold-ic, .pj-goal-fold-v { transition: none; }
}
/* 분기 월 열은 즉시 표시/숨김 — 너비 전환에 따른 숫자 이동·글 재줄바꿈을 방지한다. */
/* 분기 접기 — 열은 부드럽게 움직이고, 내용은 최종 너비가 된 뒤 나타난다.
원래 폭으로 글 높이를 유지하고, 정렬이 재계산되는 동안 내용만 가려 숫자 밀림을 방지한다. */
.pj-goal-table .pj-goal-m { overflow: hidden; }
.pj-goal-table .pj-goal-m.is-folding {
transition: width .32s ease, min-width .32s ease, max-width .32s ease,
padding .32s ease, border-right-width .32s ease;
color: transparent !important;
}
.pj-goal-table .pj-goal-m > :is(.pj-goal-num, .pj-goal-text, .pj-goal-text-ro, .pj-goal-mlabel) {
transition: opacity .12s ease;
}
.pj-goal-table .pj-goal-m.is-folding > :not(.pj-goal-colresize):not(.pj-goal-move-edge) {
opacity: 0; transition: none; pointer-events: none;
}
.pj-goal-table td.pj-goal-m.is-folding > :is(.pj-goal-num, .pj-goal-text, .pj-goal-text-ro) { width: var(--fold-w); }
.pj-goal-table thead th.pj-goal-m.is-shrunk,
.pj-goal-table td.pj-goal-m.is-shrunk {
width: 0; min-width: 0; max-width: 0; padding-left: 0 !important; padding-right: 0 !important; border-right-width: 0;
}
.pj-goal-table .pj-goal-m.is-gone { display: none; }
@media (prefers-reduced-motion: reduce) {
.pj-goal-table .pj-goal-m.is-folding,
.pj-goal-table .pj-goal-m > :is(.pj-goal-num, .pj-goal-text, .pj-goal-text-ro, .pj-goal-mlabel) { transition: none; }
}
/* 영역·줄 이름 — 눌러서 그 자리에서 수정(관리자) */
.pj-goal-table [data-goal-edit] { cursor: text; border-radius: 5px; padding: 1px 3px; margin: -1px -3px; }
+32 -8
View File
@@ -8636,6 +8636,13 @@
table.querySelectorAll("thead th[data-col]").forEach(function (th) {
th.style.setProperty("--cw", colW[th.dataset.col] + "px");
});
// 접기/펼치기 중에도 글 칸의 자연 높이와 숫자 입력칸의 원래 폭을 유지한다.
table.querySelectorAll("td.pj-goal-m[data-month]").forEach(function (td) {
const m = parseInt(td.dataset.month, 10), span = parseInt(td.dataset.span || "1", 10);
let w = 0;
for (let i = m; i < m + span; i++) w += colW["m" + i] || 85;
td.style.setProperty("--fold-w", (w - 1) + "px");
});
}
applyColW();
let lastColResize = 0;
@@ -8685,7 +8692,7 @@
});
[copy].concat(Array.from(copy.querySelectorAll("*"))).forEach(function (n) {
n.removeAttribute("id"); n.removeAttribute("contenteditable"); n.removeAttribute("data-placeholder");
n.classList.remove("is-gone");
n.classList.remove("is-gone", "is-shrunk", "is-folding");
const overrides = { position: "static", width: "max-content", "min-width": "0", "max-width": "none",
height: "auto", overflow: "visible", transition: "none", "overflow-wrap": "normal", "word-break": "normal" };
Object.keys(overrides).forEach(function (p) { n.style.setProperty(p, overrides[p], "important"); });
@@ -8896,10 +8903,12 @@
recompute();
// ── 분기 접기 — 분기 칸 머리의 버튼이 그 분기 월 칸(.pj-goal-m[data-h], 1~4)을 접었다 편다.
// 월 칸은 즉시 숨기거나 원래 너비로 표시한다. 너비 애니메이션 중 숫자가 밀리는 현상을 막는다.
// 월 열 너비를 애니메이션하되 내용은 완료 뒤 표시해 숫자의 정렬 이동을 감춘다.
// 상태는 브라우저에 기억(localStorage pj_goal_fold_q — 반기 때 키 pj_goal_fold 와 따로).
// 보기만 하는 사람도 쓸 수 있다.
const FOLD_KEY = "pj_goal_fold_q";
const FOLD_MS = 320;
const foldTimers = {};
const QUARTERS = [1, 2, 3, 4];
const fold = { 1: false, 2: false, 3: false, 4: false };
try {
@@ -8921,12 +8930,27 @@
delete th.dataset.tip;
}
}
function applyFold(h) {
function applyFold(h, animate) {
const cells = halfCells(h);
const folded = fold[h];
clearTimeout(foldTimers[h]);
delete foldTimers[h];
syncFoldBtn(h);
cells.forEach(function (c) { c.classList.toggle("is-gone", folded); });
if (!folded) table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] .pj-goal-text').forEach(fit);
function finish() {
cells.forEach(function (c) {
c.classList.toggle("is-gone", folded);
c.classList.toggle("is-shrunk", folded);
c.classList.remove("is-folding");
});
if (!folded) table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] .pj-goal-text').forEach(fit);
delete foldTimers[h];
}
const reduce = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
if (!animate || reduce) { finish(); return; }
cells.forEach(function (c) { c.classList.add("is-folding"); c.classList.remove("is-gone"); });
void table.offsetWidth; // 펼침은 너비 0, 접기는 현재 너비에서 시작한다.
cells.forEach(function (c) { c.classList.toggle("is-shrunk", folded); });
foldTimers[h] = setTimeout(finish, FOLD_MS + 20);
}
// 분기 머리 칸 아무 곳이나 누르면 접기/펴기(버튼만이 아니라). 너비 조절 손잡이를 끈 뒤의 클릭은 무시.
table.querySelectorAll("thead th.pj-goal-fold-th").forEach(function (th) {
@@ -8939,7 +8963,7 @@
fold[h] = !fold[h];
try { localStorage.setItem(FOLD_KEY, JSON.stringify(fold)); } catch (_) {}
clearMergeSel();
applyFold(h);
applyFold(h, true);
});
});
// contenteditable 글 칸은 내용의 자연 높이를 쓴다. 표가 가장 높은 칸에 행을 맞추고
@@ -8952,7 +8976,7 @@
ta.style.height = ta.scrollHeight + "px";
}
function fitAll() { table.querySelectorAll(".pj-goal-text").forEach(fit); }
QUARTERS.forEach(applyFold);
QUARTERS.forEach(function (q) { applyFold(q, false); });
// 병합 선택(Shift+클릭) — 관리자 전용, 아래에서 채운다. 접기 버튼이 먼저 부르므로 여기 둔다.
let clearMergeSel = function () {};
@@ -9314,7 +9338,7 @@
textSaver.prune();
addColHandles();
applyColW();
QUARTERS.forEach(applyFold);
QUARTERS.forEach(function (q) { applyFold(q, false); });
bindTexts(table);
if (!reduce) {
table.querySelectorAll("tbody.pj-goal-area > tr[data-row-id]").forEach(function (tr) {