feat(project): 연간 목표 상·하반기 칸·반기 접기·이름 바로 수정·월 칸 병합·로아스 %

- 6월·12월 오른쪽에 상반기·하반기 칸 추가. 매출 목표·실적은 반기 합계,
  달성률은 연간과 같은 규칙, 업무 영역 글 칸은 month 13·14 로 저장
- 반기 칸 머리 버튼으로 1~6월 / 7~12월 칸을 접었다 펴기(너비 애니메이션,
  localStorage pj_goal_fold). 표를 width:1px + table-layout:fixed 로 바꿔
  펼칠 때도 애니메이션이 적용되게 함
- 업무 영역·줄 이름을 눌러 그 자리에서 수정(✎ 버튼 제거)
- 월 칸 가로 병합(goal_cell_merges, 반기 안에서만): Shift+클릭 선택 후
  병합 버튼, 우클릭 메뉴로 좌/우 병합·해제. 병합 시 글은 월 순서대로 첫 칸에 모음
- 로아스 목표·실적 칸 % 표기
- 마이그레이션 014 (goal_cells month CHECK 0~14, goal_cell_merges)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 08:24:13 +09:00
parent 91bdc12e78
commit 5d07770ce2
15 changed files with 750 additions and 88 deletions
+55 -1
View File
@@ -2006,8 +2006,10 @@ html.pj-ui-scale .pj-modal-chat { max-height: calc(92vh / var(--pj-z)); }
/* 가로·세로 스크롤은 이 칸 하나가 맡고, 머리 줄과 왼쪽 두 칸(구분·항목)은 붙어 있다 */
.pj-goal-pane { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* width: 1px — table-layout: fixed 는 표 너비가 auto 가 아닐 때만 먹는다. 표는 칸 너비 합만큼 늘어나고,
칸 너비가 머리 칸 width 로만 정해져야 반기 접기 애니메이션이 양방향으로 부드럽다(auto 면 펼 때 한 번에 튄다). */
.pj-goal-table {
border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12.5px;
width: 1px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12.5px;
color: var(--pj-ink); background: #fff; border: 1px solid #dfe2e6; border-radius: 10px;
}
/* 칸 너비는 여백·테두리 포함(border-box) — 안 그러면 padding 만큼 넓어진다 */
@@ -2093,6 +2095,58 @@ textarea.pj-goal-text::placeholder { color: rgba(0, 0, 0, .3); }
.pj-goal-numtd.is-saved, .pj-goal-texttd.is-saved { animation: pj-goal-saved 1s ease-out; }
@keyframes pj-goal-saved { from { box-shadow: inset 0 0 0 2px #34a853; } to { box-shadow: inset 0 0 0 2px transparent; } }
.pj-goal-table th.is-saved { animation: pj-goal-saved 1s ease-out; }
/* 상반기·하반기 칸 — 6월·12월 오른쪽. 앞 칸 오른쪽 테두리와 겹쳐 두 줄로 구분된다. */
.pj-goal-table thead th.pj-goal-half-col {
width: 90px; min-width: 90px; max-width: 90px; padding: 0 6px; background: #eef0f3;
}
.pj-goal-table .pj-goal-half-col { border-left: 1px solid #cfd3d8; }
.pj-goal-kpi td.pj-goal-half-col { background: #f4f5f7; }
.pj-goal-texttd.pj-goal-half-col { font-weight: 600; }
.pj-goal-kpi td { white-space: nowrap; }
/* 반기 접기 버튼(반기 칸 머리) — 펼침 = ‹(왼쪽 월 칸을 접는다), 접힘 = 뒤집혀 ›, 강조색 */
.pj-goal-fold {
display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
margin: 0 2px 0 -2px; padding: 0; border: none; border-radius: 5px; background: transparent;
color: var(--pj-ink-soft); cursor: pointer; vertical-align: -5px;
}
.pj-goal-fold:hover { background: #dfe2e7; color: var(--pj-ink); }
.pj-goal-fold .material-symbols-outlined { font-size: 18px; transition: transform .32s ease; }
.pj-goal-fold.is-folded { background: var(--pj-accent-tint); color: var(--pj-accent-dark); }
.pj-goal-fold.is-folded .material-symbols-outlined { transform: rotate(180deg); }
/* 접기 애니메이션 — 월 칸 너비를 0 으로(.is-shrunk) 줄인 뒤 숨김(.is-gone), 펼 땐 거꾸로(initGoals applyFold).
줄어드는 동안 칸 안 글이 다시 줄바꿈돼 줄 높이가 출렁이지 않게 안쪽 내용은 원래 폭(85px × 칸 수)으로 고정해 잘라 낸다. */
.pj-goal-table .pj-goal-m { overflow: hidden; }
.pj-goal-table.is-folding .pj-goal-m {
transition: width .32s ease, min-width .32s ease, max-width .32s ease,
padding .32s ease, border-right-width .32s ease;
}
.pj-goal-table.is-folding td.pj-goal-m > * { width: calc(85px * var(--span, 1) - 1px); }
.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; }
/* 영역·줄 이름 — 눌러서 그 자리에서 수정(관리자) */
.pj-goal-table [data-goal-edit] { cursor: text; border-radius: 5px; padding: 1px 3px; margin: -1px -3px; }
.pj-goal-table [data-goal-edit]:hover { background: rgba(255, 255, 255, .65); box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); }
.pj-goal-table [data-goal-edit].is-editing {
background: #fff; box-shadow: 0 0 0 2px var(--pj-accent); outline: none; word-break: normal;
}
.pj-goal-row-text[data-goal-edit]:empty { min-height: 1.5em; }
.pj-goal-row-text[data-goal-edit]:empty:hover::before { content: "줄 이름"; color: rgba(0, 0, 0, .3); font-weight: 500; }
/* 월 칸 병합 — Shift+클릭 선택 표시와 떠 있는 병합 버튼(body 에 붙음) */
.pj-goal-table td.pj-goal-texttd.is-merge-sel {
box-shadow: inset 0 0 0 2px var(--pj-accent);
background-image: linear-gradient(rgba(123, 104, 238, .12), rgba(123, 104, 238, .12));
}
.pj-goal-mergebar { position: fixed; z-index: 1000; }
.pj-goal-mergebar .pj-btn { display: inline-flex; align-items: center; gap: 4px; box-shadow: 0 6px 18px rgba(16, 24, 40, .2); }
.pj-goal-mergebar .material-symbols-outlined { font-size: 18px; }
.pj-goal-foot { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; }
/* 영역 색 고르기 팝업(body 에 붙음) */
+281 -28
View File
@@ -8025,27 +8025,104 @@
td.textContent = (Math.round(r * 10) / 10).toLocaleString("ko-KR") + "%";
td.classList.add(r >= 100 ? "is-good" : "is-low");
}
// 합계 칸 — 연간(0) · 상반기(13, 1~6월) · 하반기(14, 7~12월)
const SUM_SCOPES = [[0, 1, 12], [13, 1, 6], [14, 7, 12]];
function recompute() {
const tg = values("sales", "target"), ac = values("sales", "actual");
let sumT = null, sumA = null;
for (let m = 1; m <= 12; m++) {
if (tg[m] != null) sumT = (sumT || 0) + tg[m];
if (ac[m] != null) sumA = (sumA || 0) + ac[m];
const td = table.querySelector('.pj-goal-rate[data-month="' + m + '"]');
if (td) setRate(td, ac[m], tg[m]);
}
const st = table.querySelector('.pj-goal-sum[data-metric="sales"][data-kind="target"]');
const sa = table.querySelector('.pj-goal-sum[data-metric="sales"][data-kind="actual"]');
if (st) st.textContent = sumT == null ? "" : fmtNum(sumT);
if (sa) sa.textContent = sumA == null ? "" : fmtNum(sumA);
// 연간 달성률은 실적이 들어온 달까지만 비교(남은 달 목표까지 넣으면 연중엔 항상 낮게 나온다).
let tUpTo = 0;
for (let m = 1; m <= 12; m++) if (ac[m] != null && tg[m] != null) tUpTo += tg[m];
const y0 = table.querySelector('.pj-goal-rate[data-month="0"]');
if (y0) setRate(y0, sumA, tUpTo);
if (y0) y0.dataset.tip = tUpTo ? "실적이 있는 달의 목표 합계 대비" : "";
SUM_SCOPES.forEach(function (sc) {
let sumT = null, sumA = null, tUpTo = 0;
for (let m = sc[1]; m <= sc[2]; m++) {
if (tg[m] != null) sumT = (sumT || 0) + tg[m];
if (ac[m] != null) sumA = (sumA || 0) + ac[m];
// 달성률은 실적이 들어온 달까지만 비교(남은 달 목표까지 넣으면 기간 중엔 항상 낮게 나온다).
if (ac[m] != null && tg[m] != null) tUpTo += tg[m];
}
const st = table.querySelector('.pj-goal-sum[data-metric="sales"][data-kind="target"][data-scope="' + sc[0] + '"]');
const sa = table.querySelector('.pj-goal-sum[data-metric="sales"][data-kind="actual"][data-scope="' + sc[0] + '"]');
if (st) st.textContent = sumT == null ? "" : fmtNum(sumT);
if (sa) sa.textContent = sumA == null ? "" : fmtNum(sumA);
const rt = table.querySelector('.pj-goal-rate[data-month="' + sc[0] + '"]');
if (rt) {
setRate(rt, sumA, tUpTo);
rt.dataset.tip = tUpTo ? "실적이 있는 달의 목표 합계 대비" : "";
}
});
}
recompute();
// ── 상·하반기 접기 — 반기 칸 머리의 버튼이 그 반기 월 칸(.pj-goal-m[data-h])을 접었다 편다.
// 칸 너비를 0 으로 줄이는 애니메이션(.is-shrunk, CSS transition) 뒤 display:none(.is-gone),
// 펼 때는 거꾸로. 상태는 브라우저에 기억(localStorage pj_goal_fold). 보기만 하는 사람도 쓸 수 있다.
const FOLD_KEY = "pj_goal_fold";
const FOLD_MS = 320;
const fold = { 1: false, 2: false };
try {
const saved = JSON.parse(localStorage.getItem(FOLD_KEY) || "null");
if (saved) { fold[1] = !!saved[1]; fold[2] = !!saved[2]; }
} catch (_) {}
const foldTimers = {};
function halfCells(h) { return table.querySelectorAll('.pj-goal-m[data-h="' + h + '"]'); }
function syncFoldBtn(h) {
const btn = table.querySelector('.pj-goal-fold[data-h="' + h + '"]');
if (!btn) return;
btn.classList.toggle("is-folded", fold[h]);
btn.setAttribute("aria-expanded", fold[h] ? "false" : "true");
btn.title = (btn.dataset.label || "") + (fold[h] ? " 펼치기" : " 접기");
delete btn.dataset.tip; // 공용 말풍선이 옮겨 둔 예전 문구 대신 새 title 을 쓰게
const th = btn.closest("th");
if (th) th.classList.toggle("is-folded", fold[h]);
}
function applyFold(h, animate) {
const cells = halfCells(h);
const folded = fold[h];
clearTimeout(foldTimers[h]);
const reduce = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
syncFoldBtn(h);
if (!animate || reduce) {
cells.forEach(function (c) { c.classList.toggle("is-shrunk", folded); c.classList.toggle("is-gone", folded); });
if (!folded) table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] textarea.pj-goal-text').forEach(fit);
return;
}
table.classList.add("is-folding");
if (folded) {
cells.forEach(function (c) { c.classList.add("is-shrunk"); });
} else {
cells.forEach(function (c) { c.classList.remove("is-gone"); });
void table.offsetWidth; // 너비 0 인 채로 한 번 그린 뒤 원래 너비로 늘린다
cells.forEach(function (c) { c.classList.remove("is-shrunk"); });
}
foldTimers[h] = setTimeout(function () {
if (folded) cells.forEach(function (c) { c.classList.add("is-gone"); });
else table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] textarea.pj-goal-text').forEach(fit);
if (!foldTimers[3 - h]) table.classList.remove("is-folding");
delete foldTimers[h];
}, FOLD_MS + 20);
}
table.querySelectorAll(".pj-goal-fold").forEach(function (btn) {
btn.addEventListener("click", function (e) {
e.stopPropagation();
const h = btn.dataset.h;
fold[h] = !fold[h];
try { localStorage.setItem(FOLD_KEY, JSON.stringify(fold)); } catch (_) {}
clearMergeSel();
applyFold(h, true);
});
});
// 글 칸 높이 맞추기 — 접혀 안 보이는 칸은 건너뛴다(높이 0 으로 재져 펼쳤을 때 글이 잘림). 펼칠 때 다시 잰다.
function fit(ta) {
if (!ta.offsetParent) return;
ta.style.height = "auto";
ta.style.height = ta.scrollHeight + "px";
}
applyFold(1, false);
applyFold(2, false);
// 병합 선택(Shift+클릭) — 관리자 전용, 아래에서 채운다. 접기 버튼이 먼저 부르므로 여기 둔다.
let clearMergeSel = function () {};
if (!isAdmin) return;
// ── 숫자 칸 ──
@@ -8080,7 +8157,6 @@
}
// ── 글 칸 ──
function fit(ta) { ta.style.height = "auto"; ta.style.height = ta.scrollHeight + "px"; }
const pending = new Map(); // textarea → 타이머
function cellUrl(ta) { return "/project/api/goals/rows/" + ta.dataset.row + "/cells/" + ta.dataset.month; }
async function saveText(ta) {
@@ -8199,7 +8275,13 @@
setTimeout(function () { document.addEventListener("mousedown", onColorDocDown, true); }, 0);
}
// ── 영역·줄 도구(✎ 색 ↑ ↓ + ×) — 이벤트 위임 ──
// ── 영역·줄 도구(색 ↑ ↓ + ×) — 이벤트 위임. 이름 바꾸기는 이름을 눌러 그 자리에서(아래 startNameEdit) ──
function textOf(node, sel) {
const t = node && node.querySelector(sel);
return t ? t.textContent.trim() : "";
}
// 저장 안 된 글이 있으면 먼저 저장(구조 변경·병합 전에 — 병합은 서버가 DB 의 글을 모은다)
function flushTexts() { return Promise.all(Array.from(pending.keys()).map(saveText)); }
table.addEventListener("click", async function (e) {
const b = e.target.closest("[data-goal-act]");
if (!b) return;
@@ -8209,17 +8291,14 @@
const areaId = tbody && tbody.dataset.areaId;
const rowId = tr && tr.dataset.rowId;
try {
if (act === "area-rename") {
const v = await prompt("업무 영역 이름", b.dataset.name || "");
if (v == null || !String(v).trim() || v === b.dataset.name) return;
await api("PUT", "/project/api/goals/areas/" + areaId, { name: String(v).trim() });
} else if (act === "area-color") {
if (act === "area-color") {
openColorPop(b, areaId, b.dataset.color, tbody);
return;
} else if (act === "area-up" || act === "area-down") {
await api("POST", "/project/api/goals/areas/" + areaId + "/move", { direction: act === "area-up" ? -1 : 1 });
} else if (act === "area-del") {
const ok = await confirm("'" + (b.dataset.name || "") + "' 업무 영역을 삭제할까요?\n안의 줄과 글도 모두 삭제됩니다.",
const name = textOf(tbody, ".pj-goal-area-text");
const ok = await confirm("'" + name + "' 업무 영역을 삭제할까요?\n안의 줄과 글도 모두 삭제됩니다.",
{ okText: "삭제", cancelText: "취소" });
if (!ok) return;
await api("DELETE", "/project/api/goals/areas/" + areaId);
@@ -8227,23 +8306,197 @@
const v = await prompt("새 줄 이름 (예: 쿠팡 — 비워 둬도 됩니다)", "");
if (v == null) return;
await api("POST", "/project/api/goals/areas/" + areaId + "/rows", { label: String(v).trim() });
} else if (act === "row-rename") {
const v = await prompt("줄 이름", b.dataset.label || "");
if (v == null || v === b.dataset.label) return;
await api("PUT", "/project/api/goals/rows/" + rowId, { label: String(v).trim() });
} else if (act === "row-up" || act === "row-down") {
await api("POST", "/project/api/goals/rows/" + rowId + "/move", { direction: act === "row-up" ? -1 : 1 });
} else if (act === "row-del") {
const label = b.dataset.label ? "'" + b.dataset.label + "' 줄" : "이 줄";
const lb = textOf(tr, ".pj-goal-row-text");
const label = lb ? "'" + lb + "' 줄" : "이 줄";
const ok = await confirm(label + "을 삭제할까요? 그 줄의 글도 모두 삭제됩니다.", { okText: "삭제", cancelText: "취소" });
if (!ok) return;
await api("DELETE", "/project/api/goals/rows/" + rowId);
} else return;
// 저장 안 된 글이 있으면 먼저 저장하고 새로고침
await Promise.all(Array.from(pending.keys()).map(saveText));
await flushTexts();
reloadKeepScroll();
} catch (err) { showToast("처리 실패: " + err.message, "error"); }
});
// ── 영역·줄 이름 — 눌러서 그 자리에서 수정(Enter·칸 떠남 = 저장, Esc = 취소). 서식 없이 글자만. ──
function startNameEdit(span) {
if (span.isContentEditable) return;
const kind = span.dataset.goalEdit;
const orig = span.textContent;
span.contentEditable = "true";
span.classList.add("is-editing");
span.focus();
const r = document.createRange();
r.selectNodeContents(span);
const sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(r);
let done = false;
async function finish(save) {
if (done) return;
done = true;
span.contentEditable = "false";
span.classList.remove("is-editing");
span.removeEventListener("keydown", onKey);
span.removeEventListener("blur", onBlur);
const v = span.textContent.replace(/\s+/g, " ").trim();
if (!save || v === orig.trim()) { span.textContent = orig; return; }
if (kind === "area" && !v) {
span.textContent = orig;
showToast("업무 영역 이름을 입력하세요.", "error");
return;
}
span.textContent = v;
try {
if (kind === "area") {
await api("PUT", "/project/api/goals/areas/" + span.closest(".pj-goal-area").dataset.areaId, { name: v });
} else {
await api("PUT", "/project/api/goals/rows/" + span.closest("tr").dataset.rowId, { label: v });
}
flashSaved(span.closest("th"));
} catch (err) {
span.textContent = orig;
showToast("이름 변경 실패: " + err.message, "error");
}
}
function onKey(e) {
if (isImeEnter(e)) return;
if (e.key === "Enter") { e.preventDefault(); span.blur(); }
else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); finish(false); span.blur(); }
}
function onBlur() { finish(true); }
span.addEventListener("keydown", onKey);
span.addEventListener("blur", onBlur);
}
table.addEventListener("click", function (e) {
const span = e.target.closest("[data-goal-edit]");
if (span) startNameEdit(span);
});
table.addEventListener("paste", function (e) {
const span = e.target.closest && e.target.closest("[data-goal-edit].is-editing");
if (!span) return;
e.preventDefault();
const text = ((e.clipboardData || window.clipboardData).getData("text/plain") || "").replace(/\s+/g, " ");
document.execCommand("insertText", false, text);
});
// ── 월 칸 병합(마이그레이션 014) — 한 줄의 같은 반기 안에서만.
// · Shift+클릭: 마지막으로 누른 월 칸부터 그 칸까지 고른 뒤 떠 있는 "N~M월 병합" 버튼
// · 우클릭: 선택한 칸 병합 / 오른쪽·왼쪽 칸과 병합 / 병합 해제
// 글은 서버가 월 순서대로 줄바꿈으로 이어 첫 칸에 모은다. 해제하면 글은 첫 칸에 남는다.
if (table.dataset.halves === "true") {
let anchor = null; // 마지막으로 누른 월 칸
let mergeSel = null; // {row, h, start, end}
let mergeBar = null;
const monthTd = function (node) {
const td = node && node.closest && node.closest("td.pj-goal-texttd.pj-goal-m");
return td && table.contains(td) ? td : null;
};
const cellInfo = function (td) {
const m = parseInt(td.dataset.month, 10);
const span = parseInt(td.dataset.span || "1", 10);
return { row: td.closest("tr").dataset.rowId, h: td.dataset.h, start: m, end: m + span - 1, span: span };
};
clearMergeSel = function () {
mergeSel = null;
table.querySelectorAll("td.is-merge-sel").forEach(function (td) { td.classList.remove("is-merge-sel"); });
if (mergeBar) { mergeBar.remove(); mergeBar = null; }
};
const mergeCells = async function (rowId, start, end) {
try {
await flushTexts();
await api("POST", "/project/api/goals/rows/" + rowId + "/merge", { start: start, end: end });
reloadKeepScroll();
} catch (err) { showToast("병합 실패: " + err.message, "error"); }
};
const unmergeCell = async function (rowId, start) {
try {
await flushTexts();
await api("DELETE", "/project/api/goals/rows/" + rowId + "/merge/" + start);
reloadKeepScroll();
} catch (err) { showToast("병합 해제 실패: " + err.message, "error"); }
};
const showMergeSel = function (rowId, h, start, end) {
clearMergeSel();
mergeSel = { row: rowId, h: h, start: start, end: end };
let last = null;
table.querySelectorAll('tr[data-row-id="' + rowId + '"] > td.pj-goal-texttd.pj-goal-m[data-h="' + h + '"]')
.forEach(function (td) {
const c = cellInfo(td);
if (c.start >= start && c.end <= end) { td.classList.add("is-merge-sel"); last = td; }
});
// 떠 있는 병합 버튼 — body 에 붙인다(화면 배율 밖)
mergeBar = document.createElement("div");
mergeBar.className = "pj-goal-mergebar";
const btn = document.createElement("button");
btn.type = "button";
btn.className = "pj-btn pj-btn-primary";
btn.innerHTML = '<span class="material-symbols-outlined">cell_merge</span>';
btn.appendChild(document.createTextNode(start + "~" + end + "월 병합"));
btn.addEventListener("click", function () {
const s = mergeSel;
clearMergeSel();
if (s) mergeCells(s.row, s.start, s.end);
});
mergeBar.appendChild(btn);
document.body.appendChild(mergeBar);
const r = last.getBoundingClientRect();
const vw = document.documentElement.clientWidth, vh = document.documentElement.clientHeight;
mergeBar.style.left = Math.max(8, Math.min(r.right - mergeBar.offsetWidth, vw - mergeBar.offsetWidth - 8)) + "px";
mergeBar.style.top = Math.max(8, Math.min(r.bottom + 6, vh - mergeBar.offsetHeight - 8)) + "px";
};
table.addEventListener("mousedown", function (e) {
if (e.button !== 0) return;
const td = monthTd(e.target);
if (!td) return;
const c = cellInfo(td);
if (e.shiftKey && anchor && anchor.row === c.row && anchor.h === c.h && anchor.start !== c.start) {
e.preventDefault(); // 글 선택·포커스 이동 없이 범위만 고른다
showMergeSel(c.row, c.h, Math.min(anchor.start, c.start), Math.max(anchor.end, c.end));
return;
}
anchor = c;
clearMergeSel();
});
// 다른 곳을 누르거나 Esc·스크롤이면 선택 해제
document.addEventListener("mousedown", function (e) {
if (!mergeSel || (mergeBar && mergeBar.contains(e.target)) || monthTd(e.target)) return;
clearMergeSel();
}, true);
document.addEventListener("keydown", function (e) { if (e.key === "Escape" && mergeSel) clearMergeSel(); });
pane.addEventListener("scroll", function () { if (mergeSel) clearMergeSel(); });
table.addEventListener("contextmenu", function (e) {
const td = monthTd(e.target);
if (!td) return;
e.preventDefault();
const c = cellInfo(td);
const isMonth = function (x) { return x && x.classList.contains("pj-goal-m") && x.dataset.h === c.h; };
const items = [];
const s = mergeSel;
if (s && s.row === c.row && c.start >= s.start && c.end <= s.end) {
items.push({ label: "선택한 칸 병합 (" + s.start + "~" + s.end + "월)",
onClick: function () { clearMergeSel(); mergeCells(s.row, s.start, s.end); } });
}
const next = td.nextElementSibling, prev = td.previousElementSibling;
if (isMonth(next)) {
const n = cellInfo(next);
items.push({ label: "오른쪽 칸과 병합 (" + c.start + "~" + n.end + "월)",
onClick: function () { mergeCells(c.row, c.start, n.end); } });
}
if (isMonth(prev)) {
const p = cellInfo(prev);
items.push({ label: "왼쪽 칸과 병합 (" + p.start + "~" + c.end + "월)",
onClick: function () { mergeCells(c.row, p.start, c.end); } });
}
if (c.span > 1) {
if (items.length) items.push(null);
items.push({ label: "병합 해제", onClick: function () { unmergeCell(c.row, c.start); } });
}
if (items.length) showContextMenu(e.clientX, e.clientY, items);
});
}
}
// ── 휴지통(관리자 전용 화면) — [복구] 누르면 원래 id 그대로 되살리고 줄을 지운다.