feat(project): add group collapse and UI polish

This commit is contained in:
2026-10-03 05:26:41 +09:00
parent 44f6ca4ef7
commit 494d84f7c2
13 changed files with 306 additions and 51 deletions
+118 -11
View File
@@ -2158,13 +2158,11 @@
try { win.focus(); } catch (_) {}
}
// ── 댓글·답글 입력칸(textarea.pj-composer-ta) — 글 줄 수만큼 높이를 늘린다(최대 160px, 넘으면 칸 안 스크롤).
// Enter = 등록, Shift+Enter = 줄바꿈(각 입력칸 keydown). 코드로 비운 뒤엔 fitComposer 를 불러 한 줄로 되돌린다.
// ── 댓글·답글 입력칸 — 전송·붙여넣기 뒤에도 70px 고정, 긴 글은 내부 스크롤.
function fitComposer(ta) {
if (!ta || ta.tagName !== "TEXTAREA") return;
ta.style.height = "auto";
ta.style.height = Math.min(ta.scrollHeight, 160) + "px";
ta.style.overflowY = ta.scrollHeight > 160 ? "auto" : "hidden";
ta.style.height = "70px";
ta.style.overflowY = "auto";
}
document.addEventListener("input", function (e) {
if (e.target && e.target.classList && e.target.classList.contains("pj-composer-ta")) fitComposer(e.target);
@@ -4165,6 +4163,40 @@
// 섹션별 빠른 작업 입력 초안 — 보드를 다시 그려도 입력값/저장 중 상태를 유지한다.
const boardTaskDrafts = {};
const boardTaskOutsideDown = {};
const BOARD_FOLD_KEY = "pj_board_fold:" + projectId;
let boardFold = {};
try { boardFold = JSON.parse(localStorage.getItem(BOARD_FOLD_KEY) || "{}") || {}; } catch (_) {}
function wireBoardCollapse(col) {
const head = col.querySelector(".pj-col-head");
let actions = head.querySelector(".pj-col-actions");
if (!actions) {
actions = document.createElement("span"); actions.className = "pj-col-actions"; head.appendChild(actions);
}
const btn = document.createElement("button");
btn.type = "button"; btn.className = "pj-icon-btn pj-col-collapse";
// 아사나의 왼쪽 화살표 + 세로 경계선 모양.
btn.innerHTML = '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 3v14M8 6l-4 4 4 4M4 10h12"/></svg>';
actions.prepend(btn);
const key = colKey(col);
function update() {
const folded = boardFold[key] === true;
col.classList.toggle("is-collapsed", folded);
btn.setAttribute("aria-expanded", String(!folded));
btn.setAttribute("aria-label", (folded ? "그룹 펼치기: " : "그룹 축소: ") + head.querySelector(".pj-col-name").textContent);
btn.title = folded ? "그룹 펼치기" : "그룹 축소";
btn.dataset.tip = btn.title;
col.querySelector(".pj-col-body").inert = folded;
}
btn.addEventListener("mousedown", function (e) { e.stopPropagation(); });
btn.addEventListener("dragstart", function (e) { e.preventDefault(); e.stopPropagation(); });
btn.addEventListener("click", function (e) {
e.stopPropagation();
boardFold[key] = !boardFold[key];
try { localStorage.setItem(BOARD_FOLD_KEY, JSON.stringify(boardFold)); } catch (_) {}
update(); syncBoardHBar();
});
update();
}
function renderBoard() {
// pj-board(바깥)는 가로 스크롤 뷰포트, pj-board-canvas(안쪽)는 세션을
// 가로로 늘어놓는 flex 컨테이너(width:max-content) — 세션이 아무리
@@ -4193,6 +4225,7 @@
canvas.appendChild(boardAddStageBtn);
}
canvas.querySelectorAll(".pj-col").forEach(function (col) {
wireBoardCollapse(col);
const top = colScroll[colKey(col)];
const b = col.querySelector(".pj-col-body");
if (top && b) b.scrollTop = top;
@@ -8375,6 +8408,51 @@
});
update();
}
// 공용 왼쪽 메뉴 너비: 170~500px, 마우스·방향키로 조절하고 브라우저에 기억.
function initSideResize() {
const layout = document.querySelector(".pj-layout");
const side = layout && layout.querySelector(".pj-side");
if (!side) return;
const key = "pj_side_w";
const handle = document.createElement("div");
handle.className = "pj-side-resizer"; handle.tabIndex = 0;
handle.setAttribute("role", "separator"); handle.setAttribute("aria-orientation", "vertical");
handle.setAttribute("aria-label", "왼쪽 메뉴 너비 조절");
handle.setAttribute("aria-valuemin", "170"); handle.setAttribute("aria-valuemax", "500");
handle.title = "끌어서 메뉴 너비 조절 (최소 170px)";
layout.appendChild(handle);
function width() { return parseInt(layout.style.getPropertyValue("--pj-side-w"), 10) || Math.round(side.getBoundingClientRect().width / uiZoom()) || 250; }
function apply(w) {
w = Math.max(170, Math.min(500, Math.round(w)));
layout.style.setProperty("--pj-side-w", w + "px"); handle.setAttribute("aria-valuenow", String(w));
window.dispatchEvent(new Event("resize"));
}
function remember() { try { localStorage.setItem(key, String(width())); } catch (_) {} }
try { const saved = Number(localStorage.getItem(key)); if (Number.isFinite(saved) && saved > 0) apply(saved); } catch (_) {}
handle.setAttribute("aria-valuenow", String(width()));
handle.addEventListener("mousedown", function (e) {
if (e.button !== 0) return;
e.preventDefault();
const x = e.clientX, w = width();
handle.classList.add("is-dragging"); document.documentElement.classList.add("pj-side-resizing");
function move(ev) { apply(w + (ev.clientX - x) / uiZoom()); }
function up() {
document.removeEventListener("mousemove", move); document.removeEventListener("mouseup", up);
handle.classList.remove("is-dragging"); document.documentElement.classList.remove("pj-side-resizing"); remember();
}
document.addEventListener("mousemove", move); document.addEventListener("mouseup", up);
});
handle.addEventListener("keydown", function (e) {
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(e.key)) return;
e.preventDefault();
apply(e.key === "Home" ? 170 : e.key === "End" ? 500 : width() + (e.key === "ArrowLeft" ? -10 : 10)); remember();
});
handle.addEventListener("dblclick", function () {
layout.style.removeProperty("--pj-side-w");
try { localStorage.removeItem(key); } catch (_) {}
handle.setAttribute("aria-valuenow", String(width())); window.dispatchEvent(new Event("resize"));
});
}
function initScrollIndicators() {
document.querySelectorAll(".pj-side, .pj-mytasks-pane, .pj-inbox-pane")
.forEach(attachScrollIndicator);
@@ -8536,8 +8614,33 @@
}
applyColW();
let lastColResize = 0;
table.querySelectorAll(".pj-goal-colresize").forEach(function (h) {
h.addEventListener("mousedown", function (e) {
// rowspan/colspan 을 포함한 논리 열을 따라 각 셀의 오른쪽 경계에 손잡이를 붙인다.
// 병합 셀에서는 오른쪽 끝 열의 너비를 조절한다. 새 줄·병합 뒤에도 다시 배선한다.
function addColHandles() {
const keys = Array.from(table.tHead.rows[0].cells).map(function (th) { return th.querySelector(".pj-goal-colresize").dataset.col; });
const occupied = [];
Array.from(table.rows).forEach(function (tr, r) {
occupied[r] = occupied[r] || [];
let c = 0;
Array.from(tr.cells).forEach(function (td) {
while (occupied[r][c]) c++;
const end = c + td.colSpan - 1;
for (let rr = r; rr < r + td.rowSpan; rr++) {
occupied[rr] = occupied[rr] || [];
for (let cc = c; cc <= end; cc++) occupied[rr][cc] = true;
}
if (!td.querySelector(".pj-goal-colresize") && keys[end]) {
const h = document.createElement("span"); h.className = "pj-goal-colresize";
h.dataset.col = keys[end]; h.title = "끌어서 너비 조절"; td.appendChild(h);
}
c = end + 1;
});
});
}
addColHandles();
table.addEventListener("mousedown", function (e) {
const h = e.target.closest(".pj-goal-colresize");
if (!h) return;
if (e.button !== 0) return;
e.preventDefault();
e.stopPropagation();
@@ -8560,15 +8663,16 @@
}
document.addEventListener("mousemove", onMove);
document.addEventListener("mouseup", onUp);
});
h.addEventListener("click", function (e) { e.stopPropagation(); });
h.addEventListener("dblclick", function (e) {
}, true);
table.addEventListener("click", function (e) { if (e.target.closest(".pj-goal-colresize")) e.stopPropagation(); }, true);
table.addEventListener("dblclick", function (e) {
const h = e.target.closest(".pj-goal-colresize");
if (!h) return;
e.stopPropagation();
colW[h.dataset.col] = colDefault[h.dataset.col];
applyColW();
saveColW();
fitAll();
});
});
// ── 틀 고정 — 머리 줄 아래 숫자 지표(매출·로아스) 줄까지 세로 스크롤에도 위에 붙어 있다.
@@ -8660,6 +8764,7 @@
" · " + months.length + "개월";
});
});
addColHandles(); // 합계·달성률의 textContent 를 바꾼 뒤에도 손잡이를 유지한다.
}
recompute();
@@ -8988,6 +9093,7 @@
table.querySelectorAll("tbody.pj-goal-area").forEach(function (t) { t.remove(); });
fresh.querySelectorAll("tbody.pj-goal-area").forEach(function (t) { table.appendChild(document.importNode(t, true)); });
textSaver.prune();
addColHandles();
applyColW();
QUARTERS.forEach(function (q) { applyFold(q, false); });
bindTexts(table);
@@ -10105,6 +10211,7 @@
initMentionInbox();
initLiveRefresh();
initGlobalSearch();
initSideResize();
initScrollIndicators();
initHoverTips();
});