feat(project): add meeting cell editing

Apply project_db migration 019 to enable vertical cell merges. Other cell editing remains available before migration.
This commit is contained in:
2026-10-03 15:11:41 +09:00
parent 193da56edf
commit 090e508bf3
18 changed files with 1054 additions and 78 deletions
+21 -6
View File
@@ -10025,8 +10025,12 @@
} catch (e) { create.disabled = false; showToast("만들기 실패: " + e.message, "error"); }
});
initMeetingSync(pane); // 보기만 하는 사람도(실적 권한이 있으면) 매출 자료 갱신
if (!isAdmin) return;
const table = el("pj-meet-table");
const cellGrid = table && window.PJMeetingCells ? window.PJMeetingCells.init({
table: table, pane: pane, admin: isAdmin, api: api, confirm: confirm, toast: showToast,
menu: showContextMenu, icon: menuIcon, zoom: uiZoom,
}) : null;
if (!isAdmin) return;
function flashSaved(node) {
if (!node) return;
@@ -10035,6 +10039,7 @@
node.classList.add("is-saved");
}
function fit(ta) {
if (ta.tagName !== "TEXTAREA") { ta.style.removeProperty("height"); return; }
if (!ta.offsetParent) return;
ta.style.height = "auto";
ta.style.height = ta.scrollHeight + "px";
@@ -10220,6 +10225,7 @@
}
let restored = 0, conflict = 0;
function bindText(ta) {
if (ta.matches("[contenteditable]") && window.PJGoalText) window.PJGoalText.attach(ta);
const r = textSaver.track(ta, ta.value);
if (r === "restored") restored++;
else if (r === "conflict") conflict++;
@@ -10228,10 +10234,15 @@
ta.addEventListener("blur", function () { textSaver.flush(ta).catch(function () {}); });
}
if (notes) bindText(notes);
if (table) table.querySelectorAll("textarea.pj-meet-text").forEach(bindText);
if (table) table.querySelectorAll(".pj-meet-text").forEach(bindText);
if (cellGrid) cellGrid.bindSaver({ flush: flushAll, save: function (ta) { return textSaver.flush(ta); },
replace: function (ta, value) { ta.value = value; textSaver.acceptSaved(ta, ta.value); },
rowMenu: rowMenu, addRow: function (section, ref, place) { run(function () { return addRow(section, ref, place); }); },
reload: reloadKeepScroll });
if (table && window.PJGoalText) window.PJGoalText.init(table, el("pj-goal-format"));
if (restored) showToast("저장되지 않았던 글 " + restored + "칸을 되살려 다시 저장합니다.");
else if (conflict) showToast("다른 곳에서 바뀐 칸 " + conflict + "개는 예전 초안을 되살리지 않았습니다.");
window.addEventListener("resize", function () { document.querySelectorAll("textarea.pj-meet-text, #pj-meet-notes").forEach(fit); });
window.addEventListener("resize", function () { document.querySelectorAll(".pj-meet-text, #pj-meet-notes").forEach(fit); });
// 페이지 떠남 — 글은 keepalive 로 한 번 더 보내고(보장 아님, 초안 백업이 남음), 실패·진행 중·금액 미저장이면 이탈 경고
window.addEventListener("beforeunload", function (e) {
textSaver.onBeforeUnload(e);
@@ -10241,12 +10252,16 @@
if (!table) return;
// 칸이 세로로 길어도 칸 아무 곳이나 누르면 그 칸 입력(글·금액) — 커서는 끝
table.addEventListener("click", function (e) {
if (e.button !== 0 || e.target.closest("textarea, input, select, button, a, [data-meet-edit]")) return;
if (e.button !== 0 || e.defaultPrevented || e.target.closest("textarea, input, select, button, a, [contenteditable], [data-meet-edit], .pj-meet-colresize, .pj-goal-move-edge")) return;
const td = e.target.closest("td");
const f = td && td.querySelector("textarea.pj-meet-text, input.pj-meet-amount");
const f = td && td.querySelector(".pj-meet-text, input.pj-meet-amount");
if (!f || f === document.activeElement) return;
f.focus();
if (f.tagName === "TEXTAREA") { const n = f.value.length; f.setSelectionRange(n, n); }
else if (f.isContentEditable) {
const range = document.createRange(); range.selectNodeContents(f); range.collapse(false);
const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range);
}
});
// ── 달성률(지난주 결과 ÷ 지난주 목표) ──
function paintRate(tr, result) {
@@ -10354,7 +10369,7 @@
return true;
});
} },
]);
].concat(cellGrid ? [null].concat(cellGrid.widthItems(tr.querySelector("th.pj-meet-c-label"))) : []));
}
table.addEventListener("click", function (e) {
const b = e.target.closest("[data-meet-act]");