fix(project): stop quarter reveal numeric drift
This commit is contained in:
+9
-37
@@ -8636,13 +8636,6 @@
|
||||
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();
|
||||
let lastColResize = 0;
|
||||
@@ -8692,7 +8685,7 @@
|
||||
});
|
||||
[copy].concat(Array.from(copy.querySelectorAll("*"))).forEach(function (n) {
|
||||
n.removeAttribute("id"); n.removeAttribute("contenteditable"); n.removeAttribute("data-placeholder");
|
||||
n.classList.remove("is-shrunk", "is-gone");
|
||||
n.classList.remove("is-gone");
|
||||
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"); });
|
||||
@@ -8903,18 +8896,16 @@
|
||||
recompute();
|
||||
|
||||
// ── 분기 접기 — 분기 칸 머리의 버튼이 그 분기 월 칸(.pj-goal-m[data-h], 1~4)을 접었다 편다.
|
||||
// 칸 너비를 0 으로 줄이는 애니메이션(.is-shrunk, CSS transition) 뒤 display:none(.is-gone),
|
||||
// 펼 때는 거꾸로. 상태는 브라우저에 기억(localStorage pj_goal_fold_q — 반기 때 키 pj_goal_fold 와 따로).
|
||||
// 월 칸은 즉시 숨기거나 원래 너비로 표시한다. 너비 애니메이션 중 숫자가 밀리는 현상을 막는다.
|
||||
// 상태는 브라우저에 기억(localStorage pj_goal_fold_q — 반기 때 키 pj_goal_fold 와 따로).
|
||||
// 보기만 하는 사람도 쓸 수 있다.
|
||||
const FOLD_KEY = "pj_goal_fold_q";
|
||||
const FOLD_MS = 320;
|
||||
const QUARTERS = [1, 2, 3, 4];
|
||||
const fold = { 1: false, 2: false, 3: false, 4: false };
|
||||
try {
|
||||
const saved = JSON.parse(localStorage.getItem(FOLD_KEY) || "null");
|
||||
if (saved) QUARTERS.forEach(function (q) { fold[q] = !!saved[q]; });
|
||||
} 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 + '"]');
|
||||
@@ -8930,31 +8921,12 @@
|
||||
delete th.dataset.tip;
|
||||
}
|
||||
}
|
||||
function applyFold(h, animate) {
|
||||
function applyFold(h) {
|
||||
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 + '"] .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 + '"] .pj-goal-text').forEach(fit);
|
||||
delete foldTimers[h];
|
||||
if (!Object.keys(foldTimers).length) table.classList.remove("is-folding");
|
||||
}, FOLD_MS + 20);
|
||||
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);
|
||||
}
|
||||
// 분기 머리 칸 아무 곳이나 누르면 접기/펴기(버튼만이 아니라). 너비 조절 손잡이를 끈 뒤의 클릭은 무시.
|
||||
table.querySelectorAll("thead th.pj-goal-fold-th").forEach(function (th) {
|
||||
@@ -8967,7 +8939,7 @@
|
||||
fold[h] = !fold[h];
|
||||
try { localStorage.setItem(FOLD_KEY, JSON.stringify(fold)); } catch (_) {}
|
||||
clearMergeSel();
|
||||
applyFold(h, true);
|
||||
applyFold(h);
|
||||
});
|
||||
});
|
||||
// contenteditable 글 칸은 내용의 자연 높이를 쓴다. 표가 가장 높은 칸에 행을 맞추고
|
||||
@@ -8980,7 +8952,7 @@
|
||||
ta.style.height = ta.scrollHeight + "px";
|
||||
}
|
||||
function fitAll() { table.querySelectorAll(".pj-goal-text").forEach(fit); }
|
||||
QUARTERS.forEach(function (q) { applyFold(q, false); });
|
||||
QUARTERS.forEach(applyFold);
|
||||
|
||||
// 병합 선택(Shift+클릭) — 관리자 전용, 아래에서 채운다. 접기 버튼이 먼저 부르므로 여기 둔다.
|
||||
let clearMergeSel = function () {};
|
||||
@@ -9342,7 +9314,7 @@
|
||||
textSaver.prune();
|
||||
addColHandles();
|
||||
applyColW();
|
||||
QUARTERS.forEach(function (q) { applyFold(q, false); });
|
||||
QUARTERS.forEach(applyFold);
|
||||
bindTexts(table);
|
||||
if (!reduce) {
|
||||
table.querySelectorAll("tbody.pj-goal-area > tr[data-row-id]").forEach(function (tr) {
|
||||
|
||||
Reference in New Issue
Block a user