feat(project): 연간 목표 모든 열 너비 조절·지표 줄 틀 고정·항목 줄 위/아래 추가·삭제
- 연간·1~12월·상/하반기 열도 머리 칸 오른쪽 끝을 끌어 너비 조절(더블클릭 = 기본), localStorage pj_goal_col_w
에 기본값과 다른 칸만 저장. 반기 접기 애니메이션의 안쪽 고정 폭은 --fold-w(병합 칸 = 걸친 월 너비 합)
- 세로 스크롤 틀 고정: 머리 줄 + 매출·로아스 지표 줄까지 sticky(줄마다 --kpi-top, stickKpi)
- 항목 칸 도구 막대에 + (아래에 줄 추가) 항상 표시, 우클릭 메뉴로 위/아래 줄 추가·줄 삭제
- POST /api/goals/areas/{id}/rows 에 ref_row_id·place(above|below) — 기준 줄 위/아래에 넣고 순서 다시 매김
- project.css/js 캐시 버전 20261001b, 문서·회귀 테스트 갱신
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+18
-9
@@ -2019,11 +2019,12 @@ html.pj-ui-scale .pj-modal-chat { max-height: calc(92vh / var(--pj-z)); }
|
||||
}
|
||||
.pj-goal-table tr > :last-child { border-right: none; }
|
||||
.pj-goal-table thead th {
|
||||
position: sticky; top: 0; z-index: 3; background: #f7f8f9; height: 32px; padding: 0 10px;
|
||||
position: sticky; top: 0; z-index: 9; background: #f7f8f9; height: 32px; padding: 0 10px;
|
||||
font-weight: 700; text-align: center; vertical-align: middle; white-space: nowrap;
|
||||
}
|
||||
.pj-goal-table thead th { width: 85px; min-width: 85px; max-width: 85px; } /* 1~12월 */
|
||||
.pj-goal-table thead th.pj-goal-year-col { width: 90px; min-width: 90px; max-width: 90px; }
|
||||
/* 열 너비 = 머리 칸 너비(table-layout: fixed). --cw 는 initGoals 가 머리 칸마다 넣는다(끌어서 조절, localStorage pj_goal_col_w) */
|
||||
.pj-goal-table thead th { width: var(--cw, 85px); min-width: var(--cw, 85px); max-width: var(--cw, 85px); } /* 1~12월 */
|
||||
.pj-goal-table thead th.pj-goal-year-col { width: var(--cw, 90px); min-width: var(--cw, 90px); max-width: var(--cw, 90px); }
|
||||
.pj-goal-table thead th.is-now { color: var(--pj-accent-dark); box-shadow: inset 0 -2px 0 var(--pj-accent); }
|
||||
/* 왼쪽 고정 두 칸(구분·항목) — 너비는 머리 칸 오른쪽 끝을 끌어 조절(initGoals, localStorage
|
||||
pj_goal_col_w). --goal-c1-w 가 c2 의 left 도 같이 정한다. */
|
||||
@@ -2036,8 +2037,8 @@ html.pj-ui-scale .pj-modal-chat { max-height: calc(92vh / var(--pj-z)); }
|
||||
left: var(--goal-c1-w); width: var(--goal-c2-w); min-width: var(--goal-c2-w); max-width: var(--goal-c2-w);
|
||||
font-weight: 600; color: #3b4048;
|
||||
}
|
||||
.pj-goal-table thead th.pj-goal-c1 { z-index: 4; width: var(--goal-c1-w); min-width: var(--goal-c1-w); max-width: var(--goal-c1-w); }
|
||||
.pj-goal-table thead th.pj-goal-c2 { z-index: 4; width: var(--goal-c2-w); min-width: var(--goal-c2-w); max-width: var(--goal-c2-w); }
|
||||
.pj-goal-table thead th.pj-goal-c1 { z-index: 10; width: var(--goal-c1-w); min-width: var(--goal-c1-w); max-width: var(--goal-c1-w); }
|
||||
.pj-goal-table thead th.pj-goal-c2 { z-index: 10; width: var(--goal-c2-w); min-width: var(--goal-c2-w); max-width: var(--goal-c2-w); }
|
||||
.pj-goal-colresize {
|
||||
position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; z-index: 5; cursor: col-resize;
|
||||
}
|
||||
@@ -2045,10 +2046,18 @@ html.pj-ui-scale .pj-modal-chat { max-height: calc(92vh / var(--pj-z)); }
|
||||
content: ""; position: absolute; top: 6px; bottom: 6px; left: 3px; width: 2px; border-radius: 2px; background: transparent;
|
||||
}
|
||||
.pj-goal-colresize:hover::after, .pj-goal-colresize.is-dragging::after { background: var(--pj-accent); }
|
||||
/* 월 칸은 overflow: hidden(접기 애니메이션)이라 칸 밖으로 나간 손잡이가 잘린다 — 칸 안쪽 오른쪽 끝에 둔다 */
|
||||
.pj-goal-table thead th.pj-goal-m .pj-goal-colresize { right: 0; width: 7px; }
|
||||
.pj-goal-table thead th.pj-goal-m .pj-goal-colresize::after { left: auto; right: 1px; }
|
||||
html.pj-goal-resizing, html.pj-goal-resizing * { cursor: col-resize !important; user-select: none !important; }
|
||||
.pj-goal-table tbody th { padding: 7px 8px; vertical-align: middle; } /* 왼쪽 이름은 세로 가운데 */
|
||||
|
||||
/* 숫자 지표 */
|
||||
/* 숫자 지표 — 틀 고정: 머리 줄 아래에 로아스 줄까지 붙어 있다(줄마다 top = --kpi-top, initGoals stickKpi).
|
||||
z-index: 업무 영역 이름 칸 2(마우스 올림 6) < 지표 칸 7 < 지표 이름 칸 8 < 머리 줄 9 < 머리 이름 칸 10.
|
||||
스크롤에 아래 줄이 비치지 않게 배경을 채운다(:where = 아래 .pj-goal-sum 등 배경이 이긴다). */
|
||||
.pj-goal-kpi > tr > * { position: sticky; top: var(--kpi-top, 0); z-index: 7; }
|
||||
.pj-goal-kpi > tr > .pj-goal-c1, .pj-goal-kpi > tr > .pj-goal-c2 { z-index: 8; }
|
||||
:where(.pj-goal-kpi) td { background: #fff; }
|
||||
.pj-goal-kpi td { height: 32px; vertical-align: middle; }
|
||||
.pj-goal-kpi td.is-now { background: #faf9ff; }
|
||||
input.pj-goal-num, span.pj-goal-num {
|
||||
@@ -2099,7 +2108,7 @@ textarea.pj-goal-text::placeholder { color: rgba(0, 0, 0, .3); }
|
||||
|
||||
/* 상반기·하반기 칸 — 6월·12월 오른쪽. 앞 칸 오른쪽 테두리와 겹쳐 두 줄로 구분된다. */
|
||||
.pj-goal-table thead th.pj-goal-half-col {
|
||||
width: 90px; min-width: 90px; max-width: 90px; padding: 0 6px; background: #eef0f3;
|
||||
width: var(--cw, 90px); min-width: var(--cw, 90px); max-width: var(--cw, 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; }
|
||||
@@ -2116,13 +2125,13 @@ textarea.pj-goal-text::placeholder { color: rgba(0, 0, 0, .3); }
|
||||
.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 × 칸 수)으로 고정해 잘라 낸다. */
|
||||
줄어드는 동안 칸 안 글이 다시 줄바꿈돼 줄 높이가 출렁이지 않게 안쪽 내용은 원래 폭(--fold-w = 걸친 월 너비 합)으로 고정해 잘라 낸다. */
|
||||
.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.is-folding td.pj-goal-m > * { width: var(--fold-w, 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;
|
||||
|
||||
+97
-21
@@ -7952,21 +7952,42 @@
|
||||
const year = table.dataset.year;
|
||||
const isAdmin = table.dataset.admin === "true";
|
||||
|
||||
// ── 왼쪽 이름 두 칸(구분·항목) 너비 — 머리 칸 오른쪽 끝을 끌어 조절, 브라우저에 기억 ──
|
||||
// 화면 배율(uiZoom) 안이라 마우스 이동 거리는 배율로 나눈다.
|
||||
// ── 열 너비 — 머리 칸 오른쪽 끝을 끌어 조절, 브라우저에 기억(localStorage pj_goal_col_w) ──
|
||||
// · c1·c2 = 왼쪽 이름 두 칸(구분·항목) → 표의 CSS 변수 --goal-c1-w·--goal-c2-w(c2 의 left 도 c1 너비로 정해진다)
|
||||
// · y = 연간, m1~m12 = 월, h1·h2 = 상·하반기 → 그 머리 칸의 --cw(표는 table-layout: fixed 라 머리 칸 너비가 열 너비)
|
||||
// 화면 배율(uiZoom) 안이라 마우스 이동 거리는 배율로 나눈다. 더블클릭 = 기본 너비.
|
||||
const COL_KEY = "pj_goal_col_w";
|
||||
const COL_MIN = 48, COL_MAX = 320;
|
||||
const colW = { c1: 72, c2: 72 };
|
||||
const colDefault = { c1: 72, c2: 72, y: 90, h1: 90, h2: 90 };
|
||||
for (let m = 1; m <= 12; m++) colDefault["m" + m] = 85;
|
||||
function colLimit(key) { return key === "c1" || key === "c2" ? [48, 320] : [40, 600]; }
|
||||
function clampCol(key, w) { const lim = colLimit(key); return Math.min(lim[1], Math.max(lim[0], w)); }
|
||||
const colW = Object.assign({}, colDefault);
|
||||
try {
|
||||
const saved = JSON.parse(localStorage.getItem(COL_KEY) || "null");
|
||||
if (saved) ["c1", "c2"].forEach(function (k) {
|
||||
if (saved) Object.keys(colDefault).forEach(function (k) {
|
||||
const v = parseInt(saved[k], 10);
|
||||
if (v) colW[k] = Math.min(COL_MAX, Math.max(COL_MIN, v));
|
||||
if (v) colW[k] = clampCol(k, v);
|
||||
});
|
||||
} catch (_) {}
|
||||
function saveColW() {
|
||||
// 기본값과 같은 칸은 저장하지 않는다(나중에 기본 너비를 바꾸면 따라가게)
|
||||
const out = {};
|
||||
Object.keys(colW).forEach(function (k) { if (colW[k] !== colDefault[k]) out[k] = colW[k]; });
|
||||
try { localStorage.setItem(COL_KEY, JSON.stringify(out)); } catch (_) {}
|
||||
}
|
||||
function applyColW() {
|
||||
table.style.setProperty("--goal-c1-w", colW.c1 + "px");
|
||||
table.style.setProperty("--goal-c2-w", colW.c2 + "px");
|
||||
table.querySelectorAll("thead th[data-col]").forEach(function (th) {
|
||||
th.style.setProperty("--cw", colW[th.dataset.col] + "px");
|
||||
});
|
||||
// 반기 접기 애니메이션 동안 월 칸 안 내용을 고정할 폭(병합 칸 = 걸친 월 너비 합, 오른쪽 테두리 1px 빼고)
|
||||
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();
|
||||
table.querySelectorAll(".pj-goal-colresize").forEach(function (h) {
|
||||
@@ -7979,8 +8000,7 @@
|
||||
h.classList.add("is-dragging");
|
||||
document.documentElement.classList.add("pj-goal-resizing");
|
||||
function onMove(ev) {
|
||||
const w = Math.round(startW + (ev.clientX - startX) / uiZoom());
|
||||
colW[key] = Math.min(COL_MAX, Math.max(COL_MIN, w));
|
||||
colW[key] = clampCol(key, Math.round(startW + (ev.clientX - startX) / uiZoom()));
|
||||
applyColW();
|
||||
}
|
||||
function onUp() {
|
||||
@@ -7988,19 +8008,37 @@
|
||||
document.removeEventListener("mouseup", onUp);
|
||||
h.classList.remove("is-dragging");
|
||||
document.documentElement.classList.remove("pj-goal-resizing");
|
||||
try { localStorage.setItem(COL_KEY, JSON.stringify(colW)); } catch (_) {}
|
||||
saveColW();
|
||||
fitAll(); // 폭이 바뀌면 글 줄바꿈이 달라진다
|
||||
}
|
||||
document.addEventListener("mousemove", onMove);
|
||||
document.addEventListener("mouseup", onUp);
|
||||
});
|
||||
// 두 번 누르면 기본 너비(72px)로
|
||||
h.addEventListener("dblclick", function () {
|
||||
colW[h.dataset.col] = 72;
|
||||
h.addEventListener("click", function (e) { e.stopPropagation(); });
|
||||
h.addEventListener("dblclick", function (e) {
|
||||
e.stopPropagation();
|
||||
colW[h.dataset.col] = colDefault[h.dataset.col];
|
||||
applyColW();
|
||||
try { localStorage.setItem(COL_KEY, JSON.stringify(colW)); } catch (_) {}
|
||||
saveColW();
|
||||
fitAll();
|
||||
});
|
||||
});
|
||||
|
||||
// ── 틀 고정 — 머리 줄 아래 숫자 지표(매출·로아스) 줄까지 세로 스크롤에도 위에 붙어 있다.
|
||||
// 줄마다 sticky top(--kpi-top) = 머리 줄 높이 + 앞 지표 줄 높이 합. 배율 안이라 offsetHeight(배율 전 값)로 잰다.
|
||||
function stickKpi() {
|
||||
const head = table.tHead && table.tHead.rows[0];
|
||||
if (!head) return;
|
||||
let top = head.offsetHeight;
|
||||
table.querySelectorAll("tbody.pj-goal-kpi > tr").forEach(function (tr) {
|
||||
tr.style.setProperty("--kpi-top", top + "px");
|
||||
top += tr.offsetHeight;
|
||||
});
|
||||
}
|
||||
stickKpi();
|
||||
if (document.fonts && document.fonts.ready) document.fonts.ready.then(stickKpi);
|
||||
window.addEventListener("resize", stickKpi);
|
||||
|
||||
// ── 합계·달성률 ──
|
||||
function numOf(node) {
|
||||
const raw = (node.tagName === "INPUT" ? node.value : node.textContent) || "";
|
||||
@@ -8118,6 +8156,7 @@
|
||||
ta.style.height = "auto";
|
||||
ta.style.height = ta.scrollHeight + "px";
|
||||
}
|
||||
function fitAll() { table.querySelectorAll("textarea.pj-goal-text").forEach(fit); }
|
||||
applyFold(1, false);
|
||||
applyFold(2, false);
|
||||
|
||||
@@ -8181,9 +8220,7 @@
|
||||
ta.addEventListener("blur", function () { saveText(ta); });
|
||||
});
|
||||
// 한 줄 안 칸들 높이는 표가 맞춘다 — 창 폭이 바뀌면 글 줄바꿈이 달라지니 다시 잰다.
|
||||
window.addEventListener("resize", function () {
|
||||
table.querySelectorAll("textarea.pj-goal-text").forEach(fit);
|
||||
});
|
||||
window.addEventListener("resize", fitAll);
|
||||
window.addEventListener("beforeunload", function () {
|
||||
pending.forEach(function (timer, ta) {
|
||||
clearTimeout(timer);
|
||||
@@ -8306,20 +8343,59 @@
|
||||
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-insert") {
|
||||
if (!(await insertRow(tr, "below"))) return;
|
||||
} 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 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);
|
||||
if (!(await deleteRow(tr))) return;
|
||||
} else return;
|
||||
await flushTexts();
|
||||
reloadKeepScroll();
|
||||
} catch (err) { showToast("처리 실패: " + err.message, "error"); }
|
||||
});
|
||||
|
||||
// ── 줄(항목 칸) 추가·삭제 — 도구 막대의 +·× 와 항목 칸 우클릭 메뉴가 같이 쓴다. 한 일이 있으면 true.
|
||||
async function insertRow(tr, place) {
|
||||
const v = await prompt("새 줄 이름 (예: 쿠팡 — 비워 둬도 됩니다)", "");
|
||||
if (v == null) return false;
|
||||
await api("POST", "/project/api/goals/areas/" + tr.closest(".pj-goal-area").dataset.areaId + "/rows",
|
||||
{ label: String(v).trim(), ref_row_id: tr.dataset.rowId, place: place });
|
||||
return true;
|
||||
}
|
||||
async function deleteRow(tr) {
|
||||
const lb = textOf(tr, ".pj-goal-row-text");
|
||||
const label = lb ? "'" + lb + "' 줄" : "이 줄";
|
||||
const ok = await confirm(label + "을 삭제할까요? 그 줄의 글도 모두 삭제됩니다.", { okText: "삭제", cancelText: "취소" });
|
||||
if (!ok) return false;
|
||||
await api("DELETE", "/project/api/goals/rows/" + tr.dataset.rowId);
|
||||
return true;
|
||||
}
|
||||
table.addEventListener("contextmenu", function (e) {
|
||||
const th = e.target.closest("th.pj-goal-row-label");
|
||||
if (!th || !table.contains(th) || e.target.closest(".is-editing")) return;
|
||||
e.preventDefault();
|
||||
const tr = th.closest("tr");
|
||||
const run = function (fn) {
|
||||
return async function () {
|
||||
try {
|
||||
if (!(await fn())) return;
|
||||
await flushTexts();
|
||||
reloadKeepScroll();
|
||||
} catch (err) { showToast("처리 실패: " + err.message, "error"); }
|
||||
};
|
||||
};
|
||||
const items = [
|
||||
{ label: "위에 줄 추가", onClick: run(function () { return insertRow(tr, "above"); }) },
|
||||
{ label: "아래에 줄 추가", onClick: run(function () { return insertRow(tr, "below"); }) },
|
||||
];
|
||||
// 영역의 마지막 한 줄은 못 지운다(영역을 지운다) — 서버도 400
|
||||
if (tr.closest(".pj-goal-area").rows.length > 1) {
|
||||
items.push(null, { label: "줄 삭제", danger: true, onClick: run(function () { return deleteRow(tr); }) });
|
||||
}
|
||||
showContextMenu(e.clientX, e.clientY, items);
|
||||
});
|
||||
|
||||
// ── 영역·줄 이름 — 눌러서 그 자리에서 수정(Enter·칸 떠남 = 저장, Esc = 취소). 서식 없이 글자만. ──
|
||||
function startNameEdit(span) {
|
||||
if (span.isContentEditable) return;
|
||||
|
||||
Reference in New Issue
Block a user